1 package cz.cuni.amis.pogamut.ut2004.bot.impl;
2
3 import java.util.logging.Level;
4
5 import com.google.inject.Inject;
6
7 import cz.cuni.amis.pogamut.base.communication.command.IAct;
8 import cz.cuni.amis.pogamut.base.utils.guice.AgentScoped;
9 import cz.cuni.amis.pogamut.base.utils.logging.LogCategory;
10 import cz.cuni.amis.pogamut.base3d.worldview.IVisionWorldView;
11 import cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController;
12 import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemTypeTranslator;
13 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize;
14 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.PasswordReply;
15 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled;
16 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange;
17 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo;
18 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage;
19 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
20
21 @AgentScoped
22 public class UT2004BotController<BOT extends UT2004Bot> implements IUT2004BotController<BOT> {
23
24
25
26
27 public static final String USER_LOG_CATEGORY_ID = "User";
28
29
30
31
32 protected BOT bot;
33
34
35
36
37 protected LogCategory log = null;
38
39 @Override
40 public void initializeController(BOT bot) {
41 this.bot = bot;
42 log = bot.getLogger().getCategory(USER_LOG_CATEGORY_ID);
43
44 log.setLevel(Level.ALL);
45 }
46
47 @Override
48 public void prepareBot(BOT bot) {
49 }
50
51 @Override
52 public PasswordReply getPassword() {
53 return new PasswordReply().setPassword("unspecified");
54 }
55
56 @Override
57 public Initialize getInitializeCommand() {
58 return new Initialize();
59 }
60
61 @Override
62 public void botInitialized(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init) {
63 }
64
65 @Override
66 public void botFirstSpawn(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init, Self self) {
67 }
68
69 @Override
70 public void finishControllerInitialization() {
71 }
72
73 @Override
74 public void botKilled(BotKilled event) {
75 }
76
77 @Override
78 public void botShutdown() {
79 }
80
81 @Override
82 public IVisionWorldView getWorldView() {
83 return bot.getWorldView();
84 }
85
86 @Override
87 public IAct getAct() {
88 return bot.getAct();
89 }
90
91 @Override
92 public BOT getBot() {
93 return bot;
94 }
95
96 public UT2004BotName getName() {
97 return bot.getBotName();
98 }
99
100 @Override
101 public LogCategory getLog() {
102 return log;
103 }
104
105 }