author | koda |
Thu, 09 Dec 2010 22:50:16 +0100 | |
changeset 4488 | e83216eba1db |
parent 4463 | 1fe77f2bc1d1 |
child 4605 | a5c2f09daaaa |
permissions | -rw-r--r-- |
4281 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
3 |
* Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 12/11/2010. |
|
19 |
*/ |
|
20 |
||
21 |
||
22 |
#import "CreationChamber.h" |
|
23 |
||
24 |
void createTeamNamed (NSString *nameWithoutExt) { |
|
25 |
NSString *teamsDirectory = TEAMS_DIRECTORY(); |
|
26 |
||
27 |
if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { |
|
28 |
[[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory |
|
29 |
withIntermediateDirectories:NO |
|
30 |
attributes:nil |
|
31 |
error:NULL]; |
|
32 |
} |
|
33 |
||
34 |
NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: HW_getMaxNumberOfHogs()]; |
|
35 |
||
36 |
for (int i = 0; i < HW_getMaxNumberOfHogs(); i++) { |
|
37 |
NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; |
|
38 |
NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
39 |
[NSNumber numberWithInt:0],@"level", |
|
40 |
hogName,@"hogname", |
|
41 |
@"NoHat",@"hat", |
|
42 |
nil]; |
|
43 |
[hogName release]; |
|
44 |
[hedgehogs addObject:hog]; |
|
45 |
[hog release]; |
|
46 |
} |
|
47 |
||
48 |
NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
49 |
@"0",@"hash", |
|
50 |
@"Statue",@"grave", |
|
51 |
@"Plane",@"fort", |
|
52 |
@"Default",@"voicepack", |
|
53 |
@"hedgewars",@"flag", |
|
54 |
hedgehogs,@"hedgehogs", |
|
55 |
nil]; |
|
56 |
[hedgehogs release]; |
|
57 |
||
58 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt]; |
|
59 |
||
60 |
[theTeam writeToFile:teamFile atomically:YES]; |
|
61 |
[teamFile release]; |
|
62 |
[theTeam release]; |
|
63 |
} |
|
64 |
||
65 |
void createWeaponNamed (NSString *nameWithoutExt, int type) { |
|
66 |
NSString *weaponsDirectory = WEAPONS_DIRECTORY(); |
|
67 |
||
68 |
if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) { |
|
69 |
[[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory |
|
70 |
withIntermediateDirectories:NO |
|
71 |
attributes:nil |
|
72 |
error:NULL]; |
|
73 |
} |
|
74 |
||
75 |
NSDictionary *theWeapon = nil; |
|
76 |
switch (type) { |
|
77 |
case 0: //default |
|
78 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
79 |
@"93919294221991210322351110012010000002111101010111",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
80 |
@"04050405416006555465544647765766666661555101011154",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
81 |
@"00000000000002055000000400070040000000002000000006",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
82 |
@"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil]; |
4281 | 83 |
break; |
84 |
case 1: //crazy |
|
85 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
86 |
@"99999999999999999929999999999999992999999999099999",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
87 |
@"11111101111111111111111111111111111111111111011111",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
88 |
@"00000000000000000000000000000000000000000000000000",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
89 |
@"13111103121111111231141111111111111112111101011111",@"ammostore_crate", nil]; |
4281 | 90 |
break; |
91 |
case 2: //pro mode |
|
92 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
93 |
@"90900090000000000000090000000000000000000000000000",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
94 |
@"00000000000000000000000000000000000000000000000000",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
95 |
@"00000000000002055000000400070040000000002000000000",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
96 |
@"11111111111111111111111111111111111111111001011111",@"ammostore_crate", nil]; |
4281 | 97 |
break; |
98 |
case 3: //shoppa |
|
99 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
100 |
@"00000099000000000000000000000000000000000000000000",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
101 |
@"44444100442444022101121212224220000000020004000100",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
102 |
@"00000000000000000000000000000000000000000000000000",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
103 |
@"11111111111111111111111111111111111111111011011111",@"ammostore_crate", nil]; |
4281 | 104 |
break; |
105 |
case 4: //clean slate |
|
106 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
107 |
@"10100090000100000110000000000000000000000000000010",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
108 |
@"04050405416006555465544647765766666661555101011154",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
109 |
@"00000000000002055000000400070040000000002000000000",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
110 |
@"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil]; |
4281 | 111 |
break; |
112 |
case 5: //minefield |
|
113 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
114 |
@"00000099000900000003000000000000000000000000000000",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
115 |
@"00000000000000000000000000000000000000000000000000",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
116 |
@"00000000000002055000000400070040000000002000000000",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
117 |
@"11111111111111111111111111111111111111111111011111",@"ammostore_crate", nil]; |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
118 |
break; |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
119 |
case 6: //thinking with portals |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
120 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
121 |
@"90000090020000000021000000000000001100000900000000",@"ammostore_initialqt", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
122 |
@"04050405416006555465544647765766666661555101011154",@"ammostore_probability", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
123 |
@"00000000000002055000000400070040000000002000000006",@"ammostore_delay", |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
124 |
@"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil]; |
4281 | 125 |
break; |
126 |
default: |
|
127 |
NSLog(@"Nope"); |
|
128 |
break; |
|
129 |
} |
|
130 |
||
131 |
NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt]; |
|
132 |
||
133 |
[theWeapon writeToFile:weaponFile atomically:YES]; |
|
134 |
[weaponFile release]; |
|
135 |
[theWeapon release]; |
|
136 |
} |
|
137 |
||
138 |
void createSchemeNamed (NSString *nameWithoutExt) { |
|
139 |
NSString *schemesDirectory = SCHEMES_DIRECTORY(); |
|
140 |
||
141 |
if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { |
|
142 |
[[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory |
|
143 |
withIntermediateDirectories:NO |
|
144 |
attributes:nil |
|
145 |
error:NULL]; |
|
146 |
} |
|
147 |
||
148 |
NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects: |
|
149 |
[NSNumber numberWithInt:100], //initialhealth |
|
150 |
[NSNumber numberWithInt:45], //turntime |
|
4488 | 151 |
[NSNumber numberWithInt:3], //minestime |
4281 | 152 |
[NSNumber numberWithInt:100], //damagemodifier |
153 |
[NSNumber numberWithInt:15], //suddendeathtimeout |
|
154 |
[NSNumber numberWithInt:47], //waterrise |
|
155 |
[NSNumber numberWithInt:5], //healthdecrease |
|
4463 | 156 |
[NSNumber numberWithInt:100], //ropelength |
4281 | 157 |
[NSNumber numberWithInt:5], //cratedrops |
158 |
[NSNumber numberWithInt:35], //healthprob |
|
159 |
[NSNumber numberWithInt:25], //healthamount |
|
160 |
[NSNumber numberWithInt:4], //minesnumber |
|
161 |
[NSNumber numberWithInt:0], //dudmines |
|
162 |
[NSNumber numberWithInt:2], //explosives |
|
163 |
nil]; |
|
164 |
||
165 |
NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithObjects: |
|
166 |
[NSNumber numberWithBool:NO], //fortmode |
|
167 |
[NSNumber numberWithBool:NO], //divideteam |
|
168 |
[NSNumber numberWithBool:NO], //solidland |
|
169 |
[NSNumber numberWithBool:NO], //addborder |
|
170 |
[NSNumber numberWithBool:NO], //lowgravity |
|
171 |
[NSNumber numberWithBool:NO], //lasersight |
|
172 |
[NSNumber numberWithBool:NO], //invulnerable |
|
173 |
[NSNumber numberWithBool:NO], //resethealth |
|
174 |
[NSNumber numberWithBool:NO], //vampirism |
|
175 |
[NSNumber numberWithBool:NO], //karma |
|
176 |
[NSNumber numberWithBool:NO], //artillery |
|
177 |
[NSNumber numberWithBool:YES], //randomorder |
|
178 |
[NSNumber numberWithBool:NO], //king |
|
179 |
[NSNumber numberWithBool:NO], //placehedgehogs |
|
180 |
[NSNumber numberWithBool:NO], //clansharesammo |
|
181 |
[NSNumber numberWithBool:NO], //disablegirders |
|
182 |
[NSNumber numberWithBool:NO], //disablelandobjects |
|
183 |
[NSNumber numberWithBool:NO], //aisurvival |
|
184 |
[NSNumber numberWithBool:NO], //infattack |
|
185 |
[NSNumber numberWithBool:NO], //resetweaps |
|
186 |
[NSNumber numberWithBool:NO], //perhogammo |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
187 |
[NSNumber numberWithBool:NO], //nowind |
4463 | 188 |
[NSNumber numberWithBool:NO], //morewind |
4281 | 189 |
nil]; |
190 |
||
191 |
NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: |
|
192 |
basicArray,@"basic", |
|
193 |
gamemodArray,@"gamemod", |
|
194 |
nil]; |
|
195 |
[gamemodArray release]; |
|
196 |
[basicArray release]; |
|
197 |
||
198 |
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; |
|
199 |
||
200 |
[theScheme writeToFile:schemeFile atomically:YES]; |
|
201 |
[schemeFile release]; |
|
202 |
[theScheme release]; |
|
203 |
} |