1 package cz.cuni.amis.pogamut.ut2004.tournament;
2
3 import java.io.File;
4 import java.io.InputStream;
5 import java.net.URISyntaxException;
6
7 import cz.cuni.amis.utils.IniFile;
8 import cz.cuni.amis.utils.exception.PogamutException;
9
10
11
12
13
14
15
16
17
18
19 public class GameBots2004Ini extends IniFile {
20
21
22
23
24
25 public static final String Section_GameBots2004_BotConnection = "GameBots2004.BotConnection";
26 public static final String Section_GameBots2004_RemoteBot = "GameBots2004.RemoteBot";
27 public static final String Section_GameBots2004_GBHUD = "GameBots2004.GBHUD";
28 public static final String Section_GameBots2004_ControlConnection = "GameBots2004.ControlConnection";
29 public static final String Section_GameBots2004_ControlServer = "GameBots2004.ControlServer";
30 public static final String Section_GameBots2004_BotScenario = "GameBots2004.BotScenario";
31 public static final String Section_GameBots2004_BotDeathMatch = "GameBots2004.BotDeathMatch";
32 public static final String Section_GameBots2004_BotTeamGame = "GameBots2004.BotTeamGame";
33 public static final String Section_GameBots2004_BotCTFGame = "GameBots2004.BotCTFGame";
34 public static final String Section_GameBots2004_BotDoubleDomination = "GameBots2004.BotDoubleDomination";
35 public static final String Section_Engine_GameInfo = "Engine.GameInfo";
36 public static final String Section_UnrealGame_UnrealMPGameInfo = "UnrealGame.UnrealMPGameInfo";
37 public static final String Section_UnrealGame_DeathMatch = "UnrealGame.DeathMatch";
38 public static final String Section_GameBots2004_GBScenarioMutator = "GameBots2004.GBScenarioMutator";
39
40
41
42
43
44 public static final String Key_DM_TimeLimit = "TimeLimit";
45 public static final String Key_DM_FragLimit = "GoalScore";
46
47 public static final String Key_CTF_TimeLimit = "TimeLimit";
48 public static final String Key_CTF_ScoreLimit = "GoalScore";
49
50
51
52
53 public GameBots2004Ini() {
54 InputStream defaults = GameBots2004Ini.class.getResourceAsStream("/cz/cuni/amis/pogamut/ut2004/tournament/deathmatch/GameBots2004-Deathmatch.ini");
55 load(defaults);
56 }
57
58
59
60
61
62
63 public GameBots2004Ini(File source) {
64 if (!source.exists()) {
65 throw new PogamutException("File with defaults for GameBots2004.ini does not exist at: " + source.getAbsolutePath() + ".", this);
66 }
67 load(source);
68 }
69
70 public GameBots2004Ini(GameBots2004Ini gb2004Ini) {
71 super(gb2004Ini);
72 }
73
74
75
76
77
78 public Integer getDMTimeLimit() {
79 String value = get(Section_GameBots2004_BotDeathMatch, Key_DM_TimeLimit);
80 if (value == null) return null;
81 return Integer.parseInt(value);
82 }
83
84
85
86
87
88
89 public void setDMTimeLimit(int timeLimitInMin) {
90 set(Section_GameBots2004_BotDeathMatch, Key_DM_TimeLimit, String.valueOf(timeLimitInMin));
91 }
92
93
94
95
96
97 public Integer getDMFragLimit() {
98 String value = get(Section_GameBots2004_BotDeathMatch, Key_DM_FragLimit);
99 if (value == null) return null;
100 return Integer.parseInt(value);
101 }
102
103
104
105
106
107 public void setDMFragLimit(int fragLimit) {
108 set(Section_GameBots2004_BotDeathMatch, Key_DM_FragLimit, String.valueOf(fragLimit));
109 }
110
111
112
113
114
115 public Integer getCTFTimeLimit() {
116 String value = get(Section_GameBots2004_BotCTFGame, Key_CTF_TimeLimit);
117 if (value == null) return null;
118 return Integer.parseInt(value);
119 }
120
121
122
123
124
125
126 public void setCTFTimeLimit(int timeLimitInMin) {
127 set(Section_GameBots2004_BotCTFGame, Key_CTF_TimeLimit, String.valueOf(timeLimitInMin));
128 }
129
130
131
132
133
134 public Integer getCTFScoreLimit() {
135 String value = get(Section_GameBots2004_BotCTFGame, Key_CTF_ScoreLimit);
136 if (value == null) return null;
137 return Integer.parseInt(value);
138 }
139
140
141
142
143
144 public void setCTFScoreLimit(int scoreLimit) {
145 set(Section_GameBots2004_BotCTFGame, Key_CTF_ScoreLimit, String.valueOf(scoreLimit));
146 }
147
148 }