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