]>
Commit | Line | Data |
---|---|---|
96f71fee | 1 | #include "aClient.h" |
c1068b6e | 2 | #include "config.h" |
3 | #include "extern.h" | |
96f71fee | 4 | #include "flags.h" |
85ce9d3e | 5 | #include "list.h" |
96f71fee | 6 | #include "sockhelp.h" |
7 | ||
85ce9d3e | 8 | #include <cctype> |
9 | #include <fstream.h> | |
c1068b6e | 10 | |
11 | #if defined(HAVE_CRYPT_H) | |
12 | ||
e3c5fe46 | 13 | #include <crypt.h> |
85ce9d3e | 14 | |
c1068b6e | 15 | #elif defined(HAVE_UNISTD_H) |
16 | ||
17 | #include <unistd.h> | |
18 | ||
19 | #endif | |
c8ada07e | 20 | |
85ce9d3e | 21 | List<aClient> players; |
c8ada07e | 22 | Monster *monsters[LEVELS][MONSTERS]; // Monsters per level. Total = MONSTERS * LEVELS |
23 | ||
24 | Monster *masters[LEVELS]; // A master for each level | |
85ce9d3e | 25 | |
a8fb9757 | 26 | // Database functions |
85ce9d3e | 27 | int save_gs_dbase(); |
28 | int load_gs_dbase(); | |
29 | ||
30 | // String functions | |
653c4f62 | 31 | #ifndef HAVE_STRTOK |
85ce9d3e | 32 | char *strtok(char *str, const char *delim); |
653c4f62 | 33 | #endif |
34 | ||
85ce9d3e | 35 | int stricmp(const char *s1, const char *s2); |
36 | int strnicmp(const char *s1, const char *s2, size_t len); | |
37 | // String Functions | |
38 | ||
e3c5fe46 | 39 | |
40 | /********** Password functions **********/ | |
41 | ||
42 | bool passcmp(char *encrypted, char *plaintext); // Compares an encrypted pass with a plain text one | |
43 | ||
44 | bool check_password(char *name, char *plaintext); // Finds a password for the given name, and checks it with passcmp against the plaintext password given. | |
45 | ||
46 | /********** Password functions **********/ | |
47 | ||
48 | ||
49 | /********** GameServ Booleans **********/ | |
50 | ||
51 | bool is_playing(char *u); // True if the given nickname in the clients list is playing. | |
1af35752 | 52 | bool is_playing(aClient *user); |
53 | ||
e3c5fe46 | 54 | bool is_fighting(char *u); // True if the given nick in the clients list is fighting anything. |
1af35752 | 55 | bool is_fighting(aClient *user); |
56 | ||
e3c5fe46 | 57 | bool player_fight(char *u); // True if the player is fighting another player. |
1af35752 | 58 | bool player_fight(aClient *user); |
59 | ||
e3c5fe46 | 60 | bool master_fight(char *u); // True if the player is fighting their master. |
1af35752 | 61 | bool master_fight(aClient *user); |
e3c5fe46 | 62 | |
63 | /********** GameServ Booleans **********/ | |
85ce9d3e | 64 | |
c7340cbd | 65 | void display_help(char *u, char *file = NULL); |
85ce9d3e | 66 | void display_monster(char *u); |
67 | void display_players(char *u); | |
83cf716f | 68 | void display_players(aClient *user); |
85ce9d3e | 69 | long int chartoint(char ch); |
70 | int isstringnum(char *num); | |
71 | long int pow (int x, int y); | |
72 | long int stringtoint(char *number); | |
73 | ||
74 | char *spaces(int len, char *seperator); | |
44ea29f7 | 75 | void refresh(Player *p); |
85ce9d3e | 76 | void refreshall(); |
ee38284f | 77 | void reset(Player *p); |
c8ada07e | 78 | void init_masters(); |
85ce9d3e | 79 | void init_monsters(); |
4dde2ed9 | 80 | bool load_monsters(); |
c8ada07e | 81 | void delete_monsters(); |
82 | void delete_masters(); | |
85ce9d3e | 83 | |
96f71fee | 84 | void do_admin(char *u); |
c7340cbd | 85 | void do_attack(char *u); |
86 | void do_bank(char *u); | |
87 | void do_fight(char *u); | |
88 | void do_heal(char *u); | |
89 | void do_help(char *u); | |
85ce9d3e | 90 | void do_identify(char *u); |
9cda831c | 91 | void do_inventory(char *u); |
c7340cbd | 92 | void do_refresh(char *u); |
93 | void do_register(char *u); | |
94 | void do_list(char *u); | |
95 | void do_master(char *u); | |
85ce9d3e | 96 | void do_play(char *u); |
97 | void do_quitg(char *u); | |
98 | void do_reset(char *u); | |
85ce9d3e | 99 | void do_run(char *u); |
85ce9d3e | 100 | void do_stats(char *u); |
c7340cbd | 101 | void do_store(char *u); |
f5c25639 | 102 | void do_tavern(char *u); |
83cf716f | 103 | void do_use(char *u); |
c7340cbd | 104 | void see_master(char *u); |
85ce9d3e | 105 | |
106 | void showstats(const char *u, const char *nick); | |
9cda831c | 107 | void showinventory(aClient *from, aClient *to = NULL); |
e282e9d2 | 108 | void showBankBalance(const char *u); |
83cf716f | 109 | void end_turn(aClient *user); |
85ce9d3e | 110 | |
111 | #define WNA 16 | |
112 | char *weapons[WNA] = { "Fists", "Stick", "Dagger", "Quarterstaff", "Short Sword", | |
113 | "Long Sword", "Silver Spear", "Battle Axe", "The Ragnarok", | |
114 | "Chain Saw", "Poison Sword", "Flame Sword", "Earth Hammer", | |
115 | "Light Saber", "Masamune", "Mystical Sword"}; | |
116 | ||
117 | char *armors[WNA] = { "Nothing", "Clothes", "Leather Vest", "Chain Mail", "Plate Armor", | |
118 | "Full Body Armor", "Magic Mail", "Graphite Suit", "Steel Suit", | |
119 | "Force Field", "Armor of Light", "Mythril Vest", "DemiGod Armor", | |
e7a0d0ab | 120 | "Hades' Cloak", "Dragon Scales", "Adamantium"}; |
85ce9d3e | 121 | |
122 | int prices[WNA - 1] = {200, 1000, 3000, 10000, 30000, 100000, 150000, 200000, 400000, | |
123 | 1000000, 4000000, 10000000, 40000000, 100000000, 400000000}; | |
124 | int webonus[WNA] = {0, 10, 15, 25, 35, 45, 65, 85, 125, 185, 255, 355, 505, 805, 1205, 1805}; | |
125 | int arbonus[WNA] = {0, 1, 3, 10, 15, 25, 35, 50, 75, 100, 150, 225, 300, 400, 600, 1000}; | |
126 | ||
127 | int hpbonus[11] = {10, 15, 20, 30, 50, 75, 125, 185, 250, 350, 550}; | |
128 | int strbonus[11] = {5, 7, 10, 12, 20, 35, 50, 75, 110, 150, 200}; | |
129 | int defbonus[11] = {2, 3, 5, 10, 15, 22, 35, 60, 80, 120, 150}; | |
130 | ||
85ce9d3e | 131 | void gameserv(char *source, char *buf) |
132 | { | |
28f552b8 | 133 | char *cmd; |
85ce9d3e | 134 | cmd = strtok(buf, " "); |
135 | ||
136 | source++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text | |
137 | cmd++; // Get rid of that : at the beginning of the :text (command) | |
138 | ||
139 | cout << "Source: " << source << "\ncmd: " << cmd << endl; | |
0eeaca4c | 140 | long int mn = midnight() - 12 * 3600; // 12 noon ;) |
44ea29f7 | 141 | |
142 | if (mn > timestamp) | |
143 | { | |
144 | refreshall(); | |
145 | timestamp = mn; | |
146 | save_timestamp(); | |
147 | } | |
148 | ||
0eeaca4c | 149 | if (strnicmp(cmd, "\1PING", 6) == 0) |
85ce9d3e | 150 | { |
44ea29f7 | 151 | char *ts; |
152 | ts = strtok(NULL, "\1"); | |
153 | notice(s_GameServ, source, "\1PING %s\1", ts); | |
0eeaca4c | 154 | } else if (stricmp(cmd, "\1VERSION\1") == 0) { |
173302fe | 155 | notice(s_GameServ, source, "\1VERSION %s %s +devel\1", PACKAGE, VERSION); |
85ce9d3e | 156 | } else if (stricmp(cmd, "SEARCH") == 0) { |
157 | cmd = strtok(NULL, " "); | |
158 | ||
159 | if (!cmd) | |
160 | notice(s_GameServ, source, "SYNTAX: /msg %S SEARCH FOREST"); | |
161 | else | |
162 | do_forest(source); | |
1af35752 | 163 | |
85ce9d3e | 164 | } else if (stricmp(cmd, "FIGHT") == 0) { |
165 | do_fight(source); | |
166 | } else if (stricmp(cmd, "ATTACK") == 0) { | |
167 | do_attack(source); | |
c8ada07e | 168 | } else if (stricmp(cmd, "RUN") == 0) { |
169 | do_run(source); | |
83cf716f | 170 | } else if (stricmp(cmd, "USE") == 0) { |
171 | do_use(source); | |
85ce9d3e | 172 | } else if (stricmp(cmd, "HEAL") == 0) { |
173 | do_heal(source); | |
9cda831c | 174 | } else if (stricmp(cmd, "INVENTORY") == 0) { |
175 | do_inventory(source); | |
ab4f4ec0 | 176 | } else if (stricmp(cmd, "MASTER") == 0) { |
177 | do_master(source); | |
ad7dfaa0 | 178 | } else if (stricmp(cmd, "STORE") == 0) { |
179 | do_store(source); | |
8c126acc | 180 | } else if (stricmp(cmd, "BANK") == 0) { |
181 | do_bank(source); | |
96f71fee | 182 | } else if (stricmp(cmd, "ADMIN") == 0) { |
183 | do_admin(source); | |
c7340cbd | 184 | } else if (stricmp(cmd, "REFRESH") == 0) { |
96f71fee | 185 | do_refresh(source); |
ee38284f | 186 | } else if (stricmp(cmd, "RESET") == 0) { |
187 | do_reset(source); | |
f5c25639 | 188 | } else if (stricmp(cmd, "TAVERN") == 0) { |
189 | do_tavern(source); | |
85ce9d3e | 190 | } else if (stricmp(cmd, "PRINT") == 0) { |
191 | cout << "Printing Clients List: " << endl; | |
192 | clients.print(); | |
0a1518fa | 193 | cout << "\nPrinting Player List: " << endl; |
85ce9d3e | 194 | players.print(); |
ee38284f | 195 | cout << "\nPrinting Level 1 of monsters:" << endl; |
196 | for (int xx = 0; xx < 12; xx++) | |
197 | { | |
198 | cout << monsters[0][xx]->name << ' ' << | |
199 | monsters[0][xx]->weapon << ' ' << monsters[0][xx]->hp << '/' << | |
200 | monsters[0][xx]->maxhp << ' ' << | |
201 | monsters[0][xx]->strength << ' ' << monsters[0][xx]->exp << ' ' << | |
202 | monsters[0][xx]->gold << ' ' << monsters[0][xx]->death << endl; | |
203 | } | |
85ce9d3e | 204 | } else if (stricmp(cmd, "LIST") == 0) { |
205 | do_list(source); | |
206 | } else if (stricmp(cmd, "REGISTER") == 0) { | |
207 | do_register(source); | |
208 | } else if (stricmp(cmd, "IDENTIFY") == 0) { | |
209 | do_identify(source); | |
210 | } else if (stricmp(cmd, "HELP") == 0) { | |
c7340cbd | 211 | do_help(source); |
85ce9d3e | 212 | } else if (stricmp(cmd, "STATS") == 0) { |
213 | do_stats(source); | |
214 | } else if (stricmp(cmd, "SHUTDOWN") == 0) { | |
96f71fee | 215 | aClient *user; |
216 | ||
217 | if (!(user = find(source))) | |
45a84400 | 218 | { |
96f71fee | 219 | notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin"); |
220 | cout << "Error: aClient not found: " << source << endl; | |
221 | } | |
222 | else if (!isAdmin(user)) | |
223 | { | |
224 | notice(s_GameServ, source, "You must be a %S admin to use this command!"); | |
45a84400 | 225 | } |
226 | else | |
227 | { | |
96f71fee | 228 | save_gs_dbase(); |
229 | raw("SQUIT %s :leaving", servername); | |
45a84400 | 230 | } |
85ce9d3e | 231 | } else if (stricmp(cmd, "SAVE") == 0) { |
96f71fee | 232 | aClient *user; |
233 | ||
234 | if (!(user = find(source))) | |
235 | { | |
236 | notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin"); | |
237 | cout << "Error: aClient not found: " << source << endl; | |
238 | } | |
239 | else if (!isAdmin(user)) | |
240 | { | |
241 | notice(s_GameServ, source, "You must be a %S admin to use this command!"); | |
242 | } | |
243 | else | |
45a84400 | 244 | { |
245 | save_gs_dbase(); | |
246 | } | |
85ce9d3e | 247 | } else if (stricmp(cmd, "LOAD") == 0) { |
96f71fee | 248 | aClient *user; |
249 | ||
250 | if (!(user = find(source))) | |
251 | { | |
252 | notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin"); | |
253 | cout << "Error: aClient not found: " << source << endl; | |
254 | } | |
255 | else if (!isAdmin(user)) | |
256 | { | |
257 | notice(s_GameServ, source, "You must be a %S admin to use this command!"); | |
258 | } | |
259 | else | |
45a84400 | 260 | { |
4dde2ed9 | 261 | char *cmd2 = strtok(NULL, " "); |
262 | if (!cmd2) | |
263 | { | |
264 | notice(s_GameServ, source, "Loading player data from %s", playerdata); | |
265 | load_gs_dbase(); | |
266 | } | |
267 | else if (stricmp(cmd2, "MONSTERS") == 0) | |
268 | { | |
269 | notice(s_GameServ, source, "Loading monster data from %s", monsterdata); | |
270 | load_monsters(); | |
271 | } | |
272 | else | |
273 | display_help(source, cmd); | |
45a84400 | 274 | } |
85ce9d3e | 275 | } else if (stricmp(cmd, "RAW") == 0) { |
96f71fee | 276 | aClient *user; |
277 | ||
278 | if (!(user = find(source))) | |
279 | { | |
280 | notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin"); | |
281 | cout << "Error: aClient not found: " << source << endl; | |
282 | } | |
283 | else if (!isAdmin(user)) | |
284 | { | |
285 | notice(s_GameServ, source, "You must be a %S admin to use this command!"); | |
286 | } | |
287 | else | |
45a84400 | 288 | { |
289 | char *rest = strtok(NULL, ""); | |
290 | raw("%s", rest); | |
291 | } | |
42ec1800 | 292 | } else { |
293 | notice(s_GameServ, source, "Unknown command \002%s\002. Type /msg %S \002HELP\002 to get a list of commands.", cmd); | |
c7340cbd | 294 | } |
85ce9d3e | 295 | |
c7340cbd | 296 | source--; // Bring the ':' back so we don't leak memory |
85ce9d3e | 297 | cmd--; // Same thing :) |
298 | } | |
299 | ||
300 | int stricmp(const char *s1, const char *s2) | |
301 | { | |
302 | register int c; | |
303 | ||
304 | while ((c = tolower(*s1)) == tolower(*s2)) { | |
305 | if (c == 0) | |
306 | return 0; | |
307 | s1++; | |
308 | s2++; | |
309 | } | |
310 | if (c < tolower(*s2)) | |
311 | return -1; | |
312 | return 1; | |
313 | } | |
314 | ||
315 | void showstats(const char *u, const char *nick) | |
316 | { | |
317 | aClient *ni, *sender = find(u); | |
318 | char *buf; | |
319 | buf = new char[50]; | |
320 | char *space; | |
321 | ||
322 | ||
73c71976 | 323 | if (!(ni = findplayer(nick))) |
85ce9d3e | 324 | { |
325 | notice(s_GameServ, u, "%s not found", nick); | |
326 | } | |
327 | else if (ni->stats) | |
328 | { | |
85ce9d3e | 329 | notice(s_GameServ, sender->getNick(), "Stats for %s:", ni->stats->name); |
330 | ||
331 | sprintf(buf, "Experience: %ld", ni->stats->exp); | |
332 | space = spaces(strlen(buf), " "); | |
333 | notice(s_GameServ, sender->getNick(), "%s%sLevel: %d", buf, space, | |
334 | ni->stats->level); | |
1cf88153 | 335 | delete [] space; |
85ce9d3e | 336 | |
337 | sprintf(buf, "Gold: %ld", ni->stats->gold); | |
338 | space = spaces(strlen(buf), " "); | |
339 | notice(s_GameServ, sender->getNick(), "%s%sGold in Bank: %ld", buf, space, ni->stats->bank); | |
1cf88153 | 340 | delete [] space; |
85ce9d3e | 341 | |
c7340cbd | 342 | notice(s_GameServ, sender->getNick(), "Hit Points: %d of %d", ni->stats->hp, |
85ce9d3e | 343 | ni->stats->maxhp); |
344 | ||
345 | sprintf(buf, "Strength: %d", ni->stats->strength + webonus[ni->stats->weapon]); | |
346 | space = spaces(strlen(buf), " "); | |
347 | notice(s_GameServ, sender->getNick(), "%s%sDefense: %d", | |
348 | buf, space, ni->stats->defense + arbonus[ni->stats->armor]); | |
1cf88153 | 349 | delete [] space; |
85ce9d3e | 350 | |
351 | sprintf(buf, "Armor: %s", armors[ni->stats->armor]); | |
352 | space = spaces(strlen(buf), " "); | |
353 | notice(s_GameServ, sender->getNick(), "%s%sWeapon: %s", buf, space, | |
354 | weapons[ni->stats->weapon]); | |
1cf88153 | 355 | delete [] space; |
85ce9d3e | 356 | |
357 | sprintf(buf, "Forest Fights: %d", ni->stats->forest_fights); | |
358 | space = spaces(strlen(buf), " "); | |
359 | notice(s_GameServ, sender->getNick(), "%s%sPlayer Fights: %d", buf, space, ni->stats->player_fights); | |
1cf88153 | 360 | delete [] space; |
85ce9d3e | 361 | } |
73c71976 | 362 | else |
363 | { | |
364 | notice(s_GameServ, u, "%s is not playing!", ni->stats->name); | |
365 | } | |
1cf88153 | 366 | delete [] buf; |
85ce9d3e | 367 | } |
368 | ||
369 | char *spaces(int len, char *seperator) | |
370 | { | |
371 | char *final; | |
42ec1800 | 372 | final = new char[30]; |
85ce9d3e | 373 | int y; |
374 | strcpy(final, seperator); | |
42ec1800 | 375 | for (y = 0; y < 30 - len; y++) |
85ce9d3e | 376 | strcat(final, seperator); |
377 | return final; | |
378 | } | |
379 | ||
380 | void raw(const char *fmt, ...) | |
381 | { | |
382 | va_list args; | |
383 | char *input; | |
384 | const char *t = fmt; | |
385 | input = new char[1024]; | |
386 | va_start(args, fmt); | |
387 | memset(input, 0, sizeof(input)); // Initialize to NULL | |
388 | for (; *t; t++) | |
389 | { | |
390 | if (*t == '%') | |
391 | { | |
392 | switch(*++t) { | |
393 | case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break; | |
394 | case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break; | |
395 | case 'S': sprintf(input, "%s%s", input, s_GameServ); break; | |
396 | case 'l': | |
397 | if (*++t == 'd') | |
398 | sprintf(input, "%s%ld", input, va_arg(args, long int)); break; | |
399 | } | |
400 | } | |
401 | else | |
402 | { | |
403 | sprintf(input, "%s%c", input, *t); | |
404 | } | |
405 | ||
406 | } | |
407 | sprintf(input, "%s%s", input, "\r\n"); | |
408 | cout << "input: " << input << flush; | |
409 | sock_puts(sock, input); | |
1cf88153 | 410 | delete [] input; |
85ce9d3e | 411 | va_end(args); |
412 | } | |
413 | /* Send a NOTICE from the given source to the given nick. */ | |
414 | ||
415 | void notice(const char *source, const char *dest, const char *fmt, ...) | |
416 | { | |
c7340cbd | 417 | if (fmt[0] == '\0') |
418 | return; | |
419 | ||
85ce9d3e | 420 | va_list args; |
421 | char *input; | |
422 | const char *t = fmt; | |
423 | input = new char[1024]; | |
424 | va_start(args, fmt); | |
425 | if (dest[0] == ':') | |
426 | { | |
427 | dest++; | |
428 | sprintf(input, ":%s NOTICE %s :", source, dest); | |
429 | dest--; | |
430 | } | |
431 | else | |
432 | sprintf(input, ":%s NOTICE %s :", source, dest); | |
433 | ||
434 | for (; *t; t++) | |
435 | { | |
436 | if (*t == '%') | |
437 | { | |
438 | switch(*++t) { | |
439 | case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break; | |
440 | case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break; | |
441 | case 'S': sprintf(input, "%s%s", input, s_GameServ); break; | |
442 | case 'l': | |
443 | if (*++t == 'd') | |
444 | sprintf(input, "%s%ld", input, va_arg(args, long int)); break; | |
445 | } | |
446 | } | |
447 | else | |
448 | { | |
449 | sprintf(input, "%s%c", input, *t); | |
450 | } | |
451 | ||
452 | } | |
453 | sprintf(input, "%s%s", input, "\r\n"); | |
454 | cout << "input: " << input << flush; | |
455 | sock_puts(sock, input); | |
1cf88153 | 456 | delete [] input; |
85ce9d3e | 457 | va_end(args); |
458 | } | |
459 | ||
460 | ||
461 | int strnicmp(const char *s1, const char *s2, size_t len) | |
462 | { | |
463 | register int c; | |
464 | ||
465 | if (!len) | |
466 | return 0; | |
467 | while ((c = tolower(*s1)) == tolower(*s2) && len > 0) { | |
468 | if (c == 0 || --len == 0) | |
469 | return 0; | |
470 | s1++; | |
471 | s2++; | |
472 | } | |
473 | if (c < tolower(*s2)) | |
474 | return -1; | |
475 | return 1; | |
476 | } | |
477 | ||
653c4f62 | 478 | #ifndef HAVE_STRTOK |
85ce9d3e | 479 | char *strtok(char *str, const char *delim) |
480 | { | |
481 | static char *current = NULL; | |
482 | char *ret; | |
483 | ||
484 | if (str) | |
485 | current = str; | |
486 | if (!current) | |
487 | return NULL; | |
488 | current += strspn(current, delim); | |
489 | ret = *current ? current : NULL; | |
490 | current += strcspn(current, delim); | |
491 | if (!*current) | |
492 | current = NULL; | |
493 | else | |
494 | *current++ = 0; | |
495 | return ret; | |
496 | } | |
653c4f62 | 497 | #endif |
85ce9d3e | 498 | |
499 | void do_list(char *u) | |
500 | { | |
501 | ListNode<aClient> *temp; | |
502 | temp = players.First(); | |
503 | if (!players.isEmpty()) | |
504 | { | |
505 | notice(s_GameServ, u, "People Playing:"); | |
506 | while(temp) | |
507 | { | |
508 | notice(s_GameServ, u, "IRC: %s Game: %s", temp->getData()->getNick(), temp->getData()->stats->name); | |
509 | temp = temp->Next(); | |
510 | } | |
511 | notice(s_GameServ, u, "End of List"); | |
512 | } | |
513 | else | |
514 | notice(s_GameServ, u, "No one is playing"); | |
515 | } | |
1af35752 | 516 | |
85ce9d3e | 517 | void do_register(char *u) |
518 | { | |
519 | char *password; | |
f27a378f | 520 | aClient *user, *p; |
85ce9d3e | 521 | password = strtok(NULL, " "); |
522 | ||
e3c5fe46 | 523 | static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; |
524 | static char salt[3]; | |
525 | ||
526 | salt[0] = saltChars[rand() % strlen(saltChars)]; | |
527 | salt[1] = saltChars[rand() % strlen(saltChars)]; | |
f27a378f | 528 | salt[2] = '\0'; |
e3c5fe46 | 529 | |
85ce9d3e | 530 | if (!password) |
531 | { | |
532 | notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER PASSWORD"); | |
533 | } | |
28f552b8 | 534 | else if ((user = find(u))) |
85ce9d3e | 535 | { |
f27a378f | 536 | p = findplayer(u); |
537 | if (!user->stats && !p) | |
85ce9d3e | 538 | { |
539 | user->stats = new Player(user); | |
85ce9d3e | 540 | user->stats->user = user; // Set the backwards pointer |
e3c5fe46 | 541 | strcpy(user->stats->password, crypt(password, salt)); |
85ce9d3e | 542 | players.insertAtBack(user); |
c7340cbd | 543 | notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->name, password); |
544 | notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!"); | |
85ce9d3e | 545 | } |
546 | else | |
547 | { | |
548 | notice(s_GameServ, u, "Already registered. Contact a %S admin for help."); | |
549 | } | |
550 | } | |
551 | } | |
552 | ||
553 | void do_identify(char *u) | |
554 | { | |
0a1518fa | 555 | char *password, *name; |
556 | aClient *user, *p; | |
557 | name = strtok(NULL, " "); | |
85ce9d3e | 558 | password = strtok(NULL, " "); |
20d5d721 | 559 | user = find(u); |
0a1518fa | 560 | if (!password || !name) |
85ce9d3e | 561 | { |
0a1518fa | 562 | notice(s_GameServ, u, "SYNTAX: /msg %S IDENTIFY NAME PASSWORD"); |
85ce9d3e | 563 | } |
20d5d721 | 564 | else if (!user) |
565 | notice(s_GameServ, u, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL, "")); | |
0a1518fa | 566 | else if (!(p = findplayer(name)) || !p->stats) |
567 | notice(s_GameServ, u, "Player %s not found", name); | |
20d5d721 | 568 | else if (!check_password(name, password) && !isAdmin(user)) |
85ce9d3e | 569 | { |
0a1518fa | 570 | notice(s_GameServ, u, "Password incorrect"); |
85ce9d3e | 571 | } |
20d5d721 | 572 | else |
85ce9d3e | 573 | { |
20d5d721 | 574 | if (p->stats->user && !isAdmin(user)) |
575 | { | |
576 | notice(s_GameServ, u, "That player has already identified."); | |
577 | return; | |
578 | } | |
85ce9d3e | 579 | if (!user->stats) |
580 | { | |
1cf88153 | 581 | ListNode<aClient> *temp; |
582 | temp = players.Find(p); | |
583 | if (!temp) | |
584 | { | |
585 | notice(s_GameServ, u, "Fatal error. Contact %S Admin. Buf: %s", | |
586 | strtok(NULL, "")); | |
587 | return; | |
588 | } | |
cdc9a6db | 589 | user->stats = new Player(p->stats->name); |
590 | cout << "Setting data for identified" << endl; | |
1cf88153 | 591 | user->stats->setData(p->stats); |
cdc9a6db | 592 | cout << "Player Identified" << endl << flush; |
593 | ||
594 | temp->setPtr(user); | |
595 | ||
596 | notice(s_GameServ, u, "Password Accepted. Identified."); | |
1cf88153 | 597 | |
85ce9d3e | 598 | } |
599 | else | |
600 | { | |
601 | notice(s_GameServ, u, "Already identified. Contact a %S admin for help."); | |
602 | } | |
603 | } | |
604 | } | |
605 | ||
606 | void do_stats(char *u) | |
607 | { | |
608 | char *nick; | |
73c71976 | 609 | aClient *user; |
85ce9d3e | 610 | |
611 | nick = strtok(NULL, " "); | |
85ce9d3e | 612 | |
613 | if (!nick) | |
73c71976 | 614 | { |
615 | if (!(user = find(u))) | |
616 | { | |
617 | notice(s_GameServ, u, "Fatal Error in do_stats(). Contact a %S admin for help!"); | |
618 | return; | |
619 | } | |
620 | else if (!is_playing(user)) | |
621 | { | |
622 | notice(s_GameServ, u, "You're not playing, so you have no stats!"); | |
623 | return; | |
624 | } | |
625 | else | |
626 | showstats(u, user->stats->name); | |
627 | } | |
85ce9d3e | 628 | else |
629 | showstats(u, nick); | |
630 | } | |
ad7dfaa0 | 631 | void init_masters() |
632 | { | |
ab4f4ec0 | 633 | delete_masters(); |
c8ada07e | 634 | |
635 | for (int x = 0; x < LEVELS; x++) | |
636 | masters[x] = new Monster; | |
637 | ||
638 | strcpy(masters[0]->name, "Old Bones"); | |
639 | strcpy(masters[0]->weapon, "Dull Sword Cane"); | |
c7340cbd | 640 | masters[0]->strength = 15; |
c8ada07e | 641 | masters[0]->gold = 0; |
642 | masters[0]->exp = 0; | |
643 | masters[0]->maxhp = 30; | |
e282e9d2 | 644 | masters[0]->hp = 30; |
c8ada07e | 645 | strcpy(masters[0]->death, "You have done well my student, but the road is long. Use your new strength with humility and honor as you progress in levels!"); |
e282e9d2 | 646 | |
c8ada07e | 647 | strcpy(masters[1]->name, "Master Chang"); |
648 | strcpy(masters[1]->weapon, "Nanchaku"); | |
c7340cbd | 649 | masters[1]->strength = 30; |
c8ada07e | 650 | masters[1]->gold = 0; |
651 | masters[1]->exp = 0; | |
652 | masters[1]->maxhp = 40; | |
e282e9d2 | 653 | masters[1]->hp = 40; |
c8ada07e | 654 | strcpy(masters[1]->death, "You try to make out what Master Chang is saying, but the only thing you catch is something about a grasshopper."); |
655 | ||
656 | strcpy(masters[2]->name, "Chuck Norris"); | |
657 | strcpy(masters[2]->weapon, "Ranger Kick"); | |
658 | masters[2]->strength = 85; | |
659 | masters[2]->gold = 0; | |
660 | masters[2]->exp = 0; | |
661 | masters[2]->maxhp = 70; | |
e282e9d2 | 662 | masters[2]->hp = 70; |
c8ada07e | 663 | strcpy(masters[2]->death, "Be strong, and keep your goals in site. Drink milk, and don't do drugs. One day you may be fighting next to me as a Texas Ranger YEEHAW!"); |
664 | ||
665 | ||
666 | strcpy(masters[3]->name, "Mr. Miagi"); | |
667 | strcpy(masters[3]->weapon, "Petrified Bonsai"); | |
9b17b158 | 668 | masters[3]->strength = 120; |
c8ada07e | 669 | masters[3]->gold = 0; |
670 | masters[3]->exp = 0; | |
671 | masters[3]->maxhp = 120; | |
e282e9d2 | 672 | masters[3]->hp = 120; |
c8ada07e | 673 | strcpy(masters[3]->death, "Skill comes from repeating the correct but seemingly mundane actions. Wax ON, wax OFF!"); |
674 | ||
675 | strcpy(masters[4]->name, "Jackie Chan"); | |
e282e9d2 | 676 | strcpy(masters[4]->weapon, "Kung Fu Kick"); |
9b17b158 | 677 | masters[4]->strength = 135; |
c8ada07e | 678 | masters[4]->gold = 0; |
679 | masters[4]->exp = 0; | |
e282e9d2 | 680 | masters[4]->maxhp = 200; |
681 | masters[4]->hp = 200; | |
c8ada07e | 682 | strcpy(masters[4]->death, "I like to let people talk who like to talk... it's easier to find out how full of it they really are!"); |
683 | ||
684 | strcpy(masters[5]->name, "Jet Li"); | |
685 | strcpy(masters[5]->weapon, "Motorcycle"); | |
9b17b158 | 686 | masters[5]->strength = 160; |
c8ada07e | 687 | masters[5]->gold = 0; |
688 | masters[5]->exp = 0; | |
e282e9d2 | 689 | masters[5]->maxhp = 400; |
690 | masters[5]->hp = 400; | |
c8ada07e | 691 | strcpy(masters[5]->death, "Failure is a fuel for excuses. It's the doing the do, that makes the making."); |
692 | ||
693 | ||
694 | strcpy(masters[6]->name, "Muhammad Ali"); | |
695 | strcpy(masters[6]->weapon, "Quick Jab"); | |
9b17b158 | 696 | masters[6]->strength = 185; |
c8ada07e | 697 | masters[6]->gold = 0; |
698 | masters[6]->exp = 0; | |
e282e9d2 | 699 | masters[6]->maxhp = 600; |
700 | masters[6]->hp = 600; | |
c8ada07e | 701 | strcpy(masters[6]->death, "It's just a job. Grass grows, birds fly, waves pound the sand. I beat people up."); |
702 | ||
703 | strcpy(masters[7]->name, "Li Mu Bai"); | |
704 | strcpy(masters[7]->weapon, "Green Destiny"); | |
9b17b158 | 705 | masters[7]->strength = 210; |
c8ada07e | 706 | masters[7]->gold = 0; |
707 | masters[7]->exp = 0; | |
e282e9d2 | 708 | masters[7]->maxhp = 800; |
709 | masters[7]->hp = 800; | |
c8ada07e | 710 | strcpy(masters[7]->death, "No growth without resistance. No action without reaction. No desire without restraint."); |
711 | ||
712 | ||
713 | strcpy(masters[8]->name, "Jimmy Wang Yu"); | |
714 | strcpy(masters[8]->weapon, "Flying Guillotine"); | |
715 | masters[8]->strength = 275; | |
c8ada07e | 716 | masters[8]->gold = 0; |
717 | masters[8]->exp = 0; | |
e282e9d2 | 718 | masters[8]->maxhp = 1200; |
719 | masters[8]->hp = 1200; | |
c8ada07e | 720 | strcpy(masters[8]->death, "You have beaten the one armed boxer. Proceed with caution!"); |
721 | ||
722 | strcpy(masters[9]->name, "Wong Fei Hung"); | |
723 | strcpy(masters[9]->weapon, "Drunken Boxing"); | |
9b17b158 | 724 | masters[9]->strength = 360; |
c8ada07e | 725 | masters[9]->gold = 0; |
726 | masters[9]->exp = 0; | |
e282e9d2 | 727 | masters[9]->maxhp = 1800; |
728 | masters[9]->hp = 1800; | |
729 | strcpy(masters[9]->death, "Hiccup! Monkey drinks master's wine!"); | |
c8ada07e | 730 | |
731 | strcpy(masters[10]->name, "Bruce Lee"); | |
732 | strcpy(masters[10]->weapon, "Fists of fury"); | |
733 | masters[10]->strength = 575; | |
c8ada07e | 734 | masters[10]->gold = 0; |
735 | masters[10]->exp = 0; | |
e282e9d2 | 736 | masters[10]->maxhp = 2500; |
737 | masters[10]->hp = 2500; | |
c8ada07e | 738 | strcpy(masters[10]->death, "You must learn to concentrate. It is like a finger pointing away to the moon... DONT concentrate on the finger, or you will miss all the heavenly glory."); |
ad7dfaa0 | 739 | } |
85ce9d3e | 740 | |
741 | void init_monsters() | |
742 | { | |
c8ada07e | 743 | delete_monsters(); |
744 | for (int x = 0; x < LEVELS; x++) | |
745 | for (int y = 0; y < MONSTERS; y++) | |
746 | monsters[x][y] = new Monster(); | |
747 | ||
85ce9d3e | 748 | // Hard coded for now - Kain |
4dde2ed9 | 749 | /* |
c8ada07e | 750 | |
751 | strcpy(monsters[0][0]->name, "Slime"); | |
752 | strcpy(monsters[0][0]->weapon, "Acid Goo"); | |
753 | monsters[0][0]->strength = 6; | |
754 | monsters[0][0]->gold = 50; | |
755 | monsters[0][0]->exp = 3; | |
756 | monsters[0][0]->maxhp = 9; | |
757 | strcpy(monsters[0][0]->death, "The slime oozes into nothing... you clean the acid goo off of your weapon"); | |
758 | ||
759 | strcpy(monsters[0][1]->name, "Ghost"); | |
760 | strcpy(monsters[0][1]->weapon, "Cold Breath"); | |
761 | monsters[0][1]->strength = 8; | |
762 | monsters[0][1]->gold = 100; | |
763 | monsters[0][1]->exp = 10; | |
764 | monsters[0][1]->maxhp = 10; | |
765 | strcpy(monsters[0][1]->death, "You feel a chill as the spirit leaves the realm."); | |
766 | ||
767 | strcpy(monsters[0][2]->name, "Ugly Rodent"); | |
768 | strcpy(monsters[0][2]->weapon, "Sharp Teeth"); | |
769 | monsters[0][2]->strength = 9; | |
770 | monsters[0][2]->gold = 75; | |
771 | monsters[0][2]->exp = 8; | |
772 | monsters[0][2]->maxhp = 13; | |
773 | strcpy(monsters[0][2]->death, "You stomp on the Ugly Rodent's remains for a finishing blow."); | |
774 | ||
775 | strcpy(monsters[0][3]->name, "Whart Hog"); | |
776 | strcpy(monsters[0][3]->weapon, "Tusks"); | |
777 | monsters[0][3]->strength = 10; | |
778 | monsters[0][3]->gold = 80; | |
779 | monsters[0][3]->exp = 6; | |
780 | monsters[0][3]->maxhp = 10; | |
781 | strcpy(monsters[0][3]->death, "You cook and eat the hog for good measure!"); | |
782 | ||
783 | strcpy(monsters[0][4]->name, "Pesky Kid"); | |
784 | strcpy(monsters[0][4]->weapon, "Slingshot"); | |
785 | monsters[0][4]->strength = 8; | |
786 | monsters[0][4]->gold = 30; | |
787 | monsters[0][4]->exp = 4; | |
788 | monsters[0][4]->maxhp = 6; | |
789 | strcpy(monsters[0][4]->death, "You take his slingshot and snap the band, sending the kid crying home to mom!"); | |
790 | ||
791 | strcpy(monsters[0][5]->name, "Playground Bully"); | |
792 | strcpy(monsters[0][5]->weapon, "Painful Noogie"); | |
793 | monsters[0][5]->strength = 11; | |
794 | monsters[0][5]->gold = 44; | |
795 | monsters[0][5]->exp = 6; | |
796 | monsters[0][5]->maxhp = 10; | |
797 | strcpy(monsters[0][5]->death, "You give him an indian burn, and punt him across the schoolyard!"); | |
798 | ||
799 | strcpy(monsters[0][6]->name, "Small Imp"); | |
800 | strcpy(monsters[0][6]->weapon, "Dagger"); | |
801 | monsters[0][6]->strength = 6; | |
802 | monsters[0][6]->gold = 64; | |
803 | monsters[0][6]->exp = 10; | |
804 | monsters[0][6]->maxhp = 10; | |
805 | strcpy(monsters[0][6]->death, "You can't help but laugh as he stumbles and falls onto his own dagger!"); | |
806 | ||
807 | strcpy(monsters[0][7]->name, "Little Monkey"); | |
808 | strcpy(monsters[0][7]->weapon, "Monkey Wrench"); | |
809 | monsters[0][7]->strength = 6; | |
810 | monsters[0][7]->gold = 53; | |
811 | monsters[0][7]->exp = 9; | |
812 | monsters[0][7]->maxhp = 9; | |
813 | strcpy(monsters[0][7]->death, "You want to cook it, but you just can't think of eating something that looks so human!"); | |
814 | ||
815 | strcpy(monsters[0][8]->name, "Grub Worm"); | |
816 | strcpy(monsters[0][8]->weapon, "Minor Nudge"); | |
817 | monsters[0][8]->strength = 2; | |
818 | monsters[0][8]->gold = 10; | |
819 | monsters[0][8]->exp = 3; | |
820 | monsters[0][8]->maxhp = 3; | |
821 | strcpy(monsters[0][8]->death, "You decide to save the poor little fella for your next fishing trip."); | |
822 | ||
823 | strcpy(monsters[0][9]->name, "Drakee"); | |
824 | strcpy(monsters[0][9]->weapon, "Tail Slap"); | |
825 | monsters[0][9]->strength = 5; | |
826 | monsters[0][9]->gold = 22; | |
827 | monsters[0][9]->exp = 7; | |
828 | monsters[0][9]->maxhp = 5; | |
829 | strcpy(monsters[0][9]->death, "You pull the little Drakee by its tale and slam it down on a dry stump!"); | |
830 | ||
831 | strcpy(monsters[0][10]->name, "Fat Slob"); | |
832 | strcpy(monsters[0][10]->weapon, "Smelly Breath"); | |
833 | monsters[0][10]->strength = 6; | |
834 | monsters[0][10]->gold = 40; | |
835 | monsters[0][10]->exp = 10; | |
836 | monsters[0][10]->maxhp = 7; | |
837 | strcpy(monsters[0][10]->death, "You kick his stomach for fun, and are thrown back by the spring of it all!"); | |
838 | ||
839 | strcpy(monsters[0][11]->name, "Lost Warrior"); | |
840 | strcpy(monsters[0][11]->weapon, "Long Sword"); | |
841 | monsters[0][11]->strength = 10; | |
842 | monsters[0][11]->gold = 250; | |
843 | monsters[0][11]->exp = 19; | |
844 | monsters[0][11]->maxhp = 15; | |
845 | strcpy(monsters[0][11]->death, "You give him a proper burial in respect for the dead warrior."); | |
846 | ||
847 | strcpy(monsters[1][0]->name, "Lost Warrior's Cousin Larry"); | |
848 | strcpy(monsters[1][0]->weapon, "Wood Axe"); | |
849 | monsters[1][0]->strength = 19; | |
850 | monsters[1][0]->gold = 134; | |
851 | monsters[1][0]->exp = 24; | |
852 | monsters[1][0]->maxhp = 30; | |
853 | strcpy(monsters[1][0]->death, "He was pretty pissed you killed his cousin, but he seems to have suffered the same fate!"); | |
854 | ||
855 | strcpy(monsters[1][1]->name, "Sandman"); | |
856 | strcpy(monsters[1][1]->weapon, "Sleeping Dust"); | |
857 | monsters[1][1]->strength = 25; | |
858 | monsters[1][1]->gold = 80; | |
859 | monsters[1][1]->exp = 6; | |
860 | monsters[1][1]->maxhp = 27; | |
861 | strcpy(monsters[1][1]->death, "You put the sandman to his final sleep."); | |
862 | ||
863 | strcpy(monsters[1][2]->name, "Dirty Prostitute"); | |
864 | strcpy(monsters[1][2]->weapon, "Stiletto Heel"); | |
865 | monsters[1][2]->strength = 21; | |
866 | monsters[1][2]->gold = 160; | |
867 | monsters[1][2]->exp = 12; | |
868 | monsters[1][2]->maxhp = 25; | |
869 | strcpy(monsters[1][2]->death, "Your pimp hand is strong!"); | |
870 | ||
871 | strcpy(monsters[1][3]->name, "Goblin Gardener"); | |
872 | strcpy(monsters[1][3]->weapon, "Garden Spade"); | |
873 | monsters[1][3]->strength = 18; | |
874 | monsters[1][3]->gold = 130; | |
875 | monsters[1][3]->exp = 8; | |
876 | monsters[1][3]->maxhp = 20; | |
877 | strcpy(monsters[1][3]->death, "You trample on his garden after slaying him... that felt good!"); | |
878 | ||
879 | strcpy(monsters[1][4]->name, "Evil Elf"); | |
880 | strcpy(monsters[1][4]->weapon, "Dark Bow"); | |
881 | monsters[1][4]->strength = 23; | |
882 | monsters[1][4]->gold = 136; | |
883 | monsters[1][4]->exp = 13; | |
884 | monsters[1][4]->maxhp = 24; | |
885 | strcpy(monsters[1][4]->death, "Elves are usually nice you thought... hmm."); | |
886 | ||
887 | strcpy(monsters[1][5]->name, "Viking Warrior"); | |
888 | strcpy(monsters[1][5]->weapon, "Broad Sword"); | |
889 | monsters[1][5]->strength = 21; | |
890 | monsters[1][5]->gold = 330; | |
891 | monsters[1][5]->exp = 20; | |
892 | monsters[1][5]->maxhp = 18; | |
893 | strcpy(monsters[1][5]->death, "You heard vikings were big, but not THAT big you thought."); | |
894 | ||
895 | strcpy(monsters[1][6]->name, "Wicked Witch"); | |
896 | strcpy(monsters[1][6]->weapon, "Cackling Laugh"); | |
897 | monsters[1][6]->strength = 20; | |
898 | monsters[1][6]->gold = 130; | |
899 | monsters[1][6]->exp = 20; | |
900 | monsters[1][6]->maxhp = 26; | |
901 | strcpy(monsters[1][6]->death, "Just for kicks, you splash some water on her and watch her melt."); | |
902 | ||
903 | strcpy(monsters[1][7]->name, "Vampire Bat"); | |
904 | strcpy(monsters[1][7]->weapon, "Blood Sucking Fangs"); | |
905 | monsters[1][7]->strength = 18; | |
906 | monsters[1][7]->gold = 125; | |
907 | monsters[1][7]->exp = 21; | |
908 | monsters[1][7]->maxhp = 29; | |
909 | strcpy(monsters[1][7]->death, "You fry up the bat and eat it... needs garlic."); | |
910 | ||
911 | strcpy(monsters[1][8]->name, "Thorn Bush"); | |
912 | strcpy(monsters[1][8]->weapon, "101 Thorns"); | |
913 | monsters[1][8]->strength = 16; | |
914 | monsters[1][8]->gold = 94; | |
915 | monsters[1][8]->exp = 15; | |
916 | monsters[1][8]->maxhp = 25; | |
917 | strcpy(monsters[1][8]->death, "You set the bush ablaze and roast some marshmallows."); | |
918 | ||
919 | strcpy(monsters[1][9]->name, "Barbarian"); | |
920 | strcpy(monsters[1][9]->weapon, "Heavy Sword"); | |
921 | monsters[1][9]->strength = 29; | |
922 | monsters[1][9]->gold = 250; | |
923 | monsters[1][9]->exp = 25; | |
924 | monsters[1][9]->maxhp = 30; | |
925 | strcpy(monsters[1][9]->death, "You listen to him moan as he falls over dead."); | |
926 | ||
927 | strcpy(monsters[1][10]->name, "Crypt Rat"); | |
928 | strcpy(monsters[1][10]->weapon, "Stinging Bite"); | |
929 | monsters[1][10]->strength = 25; | |
930 | monsters[1][10]->gold = 119; | |
931 | monsters[1][10]->exp = 20; | |
932 | monsters[1][10]->maxhp = 26; | |
933 | strcpy(monsters[1][10]->death, "You squash the little rodent for fear that it might not be dead."); | |
934 | ||
935 | strcpy(monsters[1][11]->name, "Small Orc"); | |
936 | strcpy(monsters[1][11]->weapon, "blade"); | |
937 | monsters[1][11]->strength = 28; | |
938 | monsters[1][11]->gold = 300; | |
939 | monsters[1][11]->exp = 30; | |
940 | monsters[1][11]->maxhp = 36; | |
941 | strcpy(monsters[1][11]->death, "It's an ugly one, and it would've grown up to be a terror..."); | |
942 | ||
943 | strcpy(monsters[2][0]->name, "Teferi"); | |
944 | strcpy(monsters[2][0]->weapon, "Puzzle Box"); | |
945 | monsters[2][0]->strength = 29; | |
946 | monsters[2][0]->gold = 380; | |
947 | monsters[2][0]->exp = 18; | |
948 | monsters[2][0]->maxhp = 29; | |
949 | strcpy(monsters[2][0]->death, "It was a puzzling experience."); | |
950 | ||
951 | strcpy(monsters[2][1]->name, "Spineless Thug"); | |
952 | strcpy(monsters[2][1]->weapon, "Spiked Bat"); | |
953 | monsters[2][1]->strength = 37; | |
954 | monsters[2][1]->gold = 384; | |
955 | monsters[2][1]->exp = 27; | |
956 | monsters[2][1]->maxhp = 32; | |
957 | strcpy(monsters[2][1]->death, "See you at the crossroads!"); | |
958 | ||
959 | strcpy(monsters[2][2]->name, "Pyromaniac"); | |
960 | strcpy(monsters[2][2]->weapon, "Flame Thrower"); | |
961 | monsters[2][2]->strength = 29; | |
962 | monsters[2][2]->gold = 563; | |
963 | monsters[2][2]->exp = 22; | |
964 | monsters[2][2]->maxhp = 45; | |
965 | strcpy(monsters[2][2]->death, "He chants FIRE FIRE as he falls to the ground... a burning heap of flesh."); | |
966 | ||
967 | strcpy(monsters[2][3]->name, "Evil Enchantress"); | |
968 | strcpy(monsters[2][3]->weapon, "Deadly Spell"); | |
969 | monsters[2][3]->strength = 50; | |
970 | monsters[2][3]->gold = 830; | |
971 | monsters[2][3]->exp = 35; | |
972 | monsters[2][3]->maxhp = 35; | |
973 | strcpy(monsters[2][3]->death, "She looked just about as good as she fought."); | |
974 | ||
975 | strcpy(monsters[2][4]->name, "Killer Leprechaun"); | |
976 | strcpy(monsters[2][4]->weapon, "Gold Rush"); | |
977 | monsters[2][4]->strength = 35; | |
978 | monsters[2][4]->gold = 1300; | |
979 | monsters[2][4]->exp = 30; | |
980 | monsters[2][4]->maxhp = 37; | |
981 | strcpy(monsters[2][4]->death, "You steal his pot of gold... that's a lot of money!"); | |
982 | ||
983 | strcpy(monsters[2][5]->name, "Avalanche Rider"); | |
984 | strcpy(monsters[2][5]->weapon, "Huge Snowball"); | |
985 | monsters[2][5]->strength = 32; | |
986 | monsters[2][5]->gold = 700; | |
987 | monsters[2][5]->exp = 32; | |
988 | monsters[2][5]->maxhp = 38; | |
989 | strcpy(monsters[2][5]->death, "You take his snowboard and snap it in two!"); | |
990 | ||
991 | strcpy(monsters[2][6]->name, "Blundering Idiot"); | |
992 | strcpy(monsters[2][6]->weapon, "Stupidity"); | |
993 | monsters[2][6]->strength = 14; | |
994 | monsters[2][6]->gold = 700; | |
995 | monsters[2][6]->exp = 20; | |
996 | monsters[2][6]->maxhp = 29; | |
997 | strcpy(monsters[2][6]->death, "Now there's one person you don't feel sorry for killing!"); | |
998 | ||
999 | strcpy(monsters[2][7]->name, "Militant Anarchist"); | |
1000 | strcpy(monsters[2][7]->weapon, "Molotov Cocktail"); | |
1001 | monsters[2][7]->strength = 33; | |
1002 | monsters[2][7]->gold = 245; | |
1003 | monsters[2][7]->exp = 45; | |
1004 | monsters[2][7]->maxhp = 32; | |
1005 | strcpy(monsters[2][7]->death, "Order has been restored for now..."); | |
1006 | ||
1007 | strcpy(monsters[2][8]->name, "Scathe Zombies"); | |
1008 | strcpy(monsters[2][8]->weapon, "Death Grip"); | |
1009 | monsters[2][8]->strength = 38; | |
1010 | monsters[2][8]->gold = 763; | |
1011 | monsters[2][8]->exp = 15; | |
1012 | monsters[2][8]->maxhp = 45; | |
1013 | strcpy(monsters[2][8]->death, "That was perhaps the scariest experience of your life."); | |
1014 | ||
1015 | strcpy(monsters[2][9]->name, "Spitting Llama"); | |
1016 | strcpy(monsters[2][9]->weapon, "Spit Spray"); | |
1017 | monsters[2][9]->strength = 48; | |
1018 | monsters[2][9]->gold = 638; | |
1019 | monsters[2][9]->exp = 28; | |
1020 | monsters[2][9]->maxhp = 34; | |
1021 | strcpy(monsters[2][9]->death, "You wipe the spit off your face and fling it back at the Llama."); | |
1022 | ||
1023 | strcpy(monsters[2][10]->name, "Juggalo"); | |
1024 | strcpy(monsters[2][10]->weapon, "Clown Axe"); | |
1025 | monsters[2][10]->strength = 60; | |
1026 | monsters[2][10]->gold = 650; | |
1027 | monsters[2][10]->exp = 30; | |
1028 | monsters[2][10]->maxhp = 29; | |
1029 | strcpy(monsters[2][10]->death, "What is a Juggalo? I don't know!"); | |
1030 | ||
1031 | strcpy(monsters[2][11]->name, "The Boogie Man"); | |
1032 | strcpy(monsters[2][11]->weapon, "Striking Fear"); | |
1033 | monsters[2][11]->strength = 46; | |
1034 | monsters[2][11]->gold = 600; | |
1035 | monsters[2][11]->exp = 35; | |
1036 | monsters[2][11]->maxhp = 27; | |
1037 | strcpy(monsters[2][11]->death, "He's scared you for the very last time!"); | |
1038 | ||
1039 | strcpy(monsters[3][0]->name, "Living Fire"); | |
1040 | strcpy(monsters[3][0]->weapon, "Scorching Wind"); | |
1041 | monsters[3][0]->strength = 55; | |
1042 | monsters[3][0]->gold = 1100; | |
1043 | monsters[3][0]->exp = 36; | |
1044 | monsters[3][0]->maxhp = 55; | |
1045 | strcpy(monsters[3][0]->death, "You extinguish the Living Flame once and for all!"); | |
1046 | ||
1047 | strcpy(monsters[3][1]->name, "Raging Orc"); | |
1048 | strcpy(monsters[3][1]->weapon, "Orcish Artillary"); | |
1049 | monsters[3][1]->strength = 89; | |
1050 | monsters[3][1]->gold = 900; | |
1051 | monsters[3][1]->exp = 25; | |
1052 | monsters[3][1]->maxhp = 50; | |
1053 | strcpy(monsters[3][1]->death, "This orc was a bit tougher than you remembered!"); | |
1054 | ||
1055 | strcpy(monsters[3][2]->name, "Huge Tarantula"); | |
1056 | strcpy(monsters[3][2]->weapon, "Tangling Web"); | |
1057 | monsters[3][2]->strength = 59; | |
1058 | monsters[3][2]->gold = 1000; | |
1059 | monsters[3][2]->exp = 35; | |
1060 | monsters[3][2]->maxhp = 60; | |
1061 | strcpy(monsters[3][2]->death, "You're glad you overcame your arachniphobia so soon!"); | |
1062 | ||
1063 | strcpy(monsters[3][3]->name, "Rabid Wolf"); | |
1064 | strcpy(monsters[3][3]->weapon, "Cujo Bite"); | |
1065 | monsters[3][3]->strength = 40; | |
1066 | monsters[3][3]->gold = 1200; | |
1067 | monsters[3][3]->exp = 47; | |
1068 | monsters[3][3]->maxhp = 76; | |
1069 | strcpy(monsters[3][3]->death, "The mutt falls over dead as white foam drips from its deadly canines..."); | |
1070 | ||
1071 | strcpy(monsters[3][4]->name, "Goblin Fighter"); | |
1072 | strcpy(monsters[3][4]->weapon, "Morning Star"); | |
1073 | monsters[3][4]->strength = 38; | |
1074 | monsters[3][4]->gold = 700; | |
1075 | monsters[3][4]->exp = 30; | |
1076 | monsters[3][4]->maxhp = 75; | |
1077 | strcpy(monsters[3][4]->death, "He almost caught you with his chain mace, but you sliced off his head."); | |
1078 | ||
1079 | strcpy(monsters[3][5]->name, "Grizzly Bear"); | |
1080 | strcpy(monsters[3][5]->weapon, "Razor Claws"); | |
1081 | monsters[3][5]->strength = 68; | |
1082 | monsters[3][5]->gold = 1747; | |
1083 | monsters[3][5]->exp = 81; | |
1084 | monsters[3][5]->maxhp = 51; | |
1085 | strcpy(monsters[3][5]->death, "It almost got you this time... better be careful"); | |
1086 | ||
1087 | strcpy(monsters[3][6]->name, "Skeleton Man"); | |
1088 | strcpy(monsters[3][6]->weapon, "Leg Bone"); | |
1089 | monsters[3][6]->strength = 70; | |
1090 | monsters[3][6]->gold = 597; | |
1091 | monsters[3][6]->exp = 57; | |
1092 | monsters[3][6]->maxhp = 60; | |
1093 | strcpy(monsters[3][6]->death, "As a finisher, you wind up with the broad side of your weapon and hit his skull off for a home run!"); | |
1094 | ||
1095 | strcpy(monsters[3][7]->name, "Young Werewolf"); | |
1096 | strcpy(monsters[3][7]->weapon, "Howling Bites"); | |
1097 | monsters[3][7]->strength = 75; | |
1098 | monsters[3][7]->gold = 1742; | |
1099 | monsters[3][7]->exp = 65; | |
1100 | monsters[3][7]->maxhp = 42; | |
1101 | strcpy(monsters[3][7]->death, "You scatter the wolf's body parts in hopes he will stay dead!"); | |
1102 | ||
1103 | strcpy(monsters[3][8]->name, "Dark Infantry"); | |
1104 | strcpy(monsters[3][8]->weapon, "Flesh Reaper"); | |
1105 | monsters[3][8]->strength = 69; | |
1106 | monsters[3][8]->gold = 870; | |
1107 | monsters[3][8]->exp = 43; | |
1108 | monsters[3][8]->maxhp = 65; | |
1109 | strcpy(monsters[3][8]->death, "Light has prevailed this time... but it's only so long before you meet again."); | |
1110 | ||
1111 | strcpy(monsters[3][9]->name, "Erie Spirit"); | |
1112 | strcpy(monsters[3][9]->weapon, "Deadly Grin"); | |
1113 | monsters[3][9]->strength = 63; | |
1114 | monsters[3][9]->gold = 1300; | |
1115 | monsters[3][9]->exp = 32; | |
1116 | monsters[3][9]->maxhp = 50; | |
1117 | strcpy(monsters[3][9]->death, "His cousin the ghost was a little bit easier."); | |
1118 | ||
1119 | strcpy(monsters[3][10]->name, "Gollum"); | |
1120 | strcpy(monsters[3][10]->weapon, "Precious Treasure"); | |
1121 | monsters[3][10]->strength = 66; | |
1122 | monsters[3][10]->gold = 1492; | |
1123 | monsters[3][10]->exp = 73; | |
1124 | monsters[3][10]->maxhp = 54; | |
1125 | strcpy(monsters[3][10]->death, "Gollum screams out \"MY PRECIOUS\" as his small body falls limp from your blow."); | |
1126 | ||
1127 | strcpy(monsters[3][11]->name, "Rock Fighter"); | |
1128 | strcpy(monsters[3][11]->weapon, "Small Boulders"); | |
1129 | monsters[3][11]->strength = 87; | |
1130 | monsters[3][11]->gold = 1742; | |
1131 | monsters[3][11]->exp = 99; | |
1132 | monsters[3][11]->maxhp = 65; | |
1133 | strcpy(monsters[3][11]->death, "You dodge his last rock, and counter with a low blow, cutting off his legs."); | |
1134 | ||
1135 | ||
1136 | strcpy(monsters[4][0]->name, "Giant Sphinx"); | |
1137 | strcpy(monsters[4][0]->weapon, "Ancient Curse"); | |
1138 | monsters[4][0]->strength = 120; | |
1139 | monsters[4][0]->gold = 1000; | |
1140 | monsters[4][0]->exp = 100; | |
1141 | monsters[4][0]->maxhp = 80; | |
1142 | strcpy(monsters[4][0]->death, "You look in awe at the great wonder, collapsed at your feet!"); | |
1143 | ||
1144 | strcpy(monsters[4][1]->name, "Giant Ogre"); | |
1145 | strcpy(monsters[4][1]->weapon, "Big Log"); | |
1146 | monsters[4][1]->strength = 130; | |
1147 | monsters[4][1]->gold = 857; | |
1148 | monsters[4][1]->exp = 175; | |
1149 | monsters[4][1]->maxhp = 100; | |
1150 | strcpy(monsters[4][1]->death, "Your wits outmatched the ogre's brawn... big dumb thing."); | |
1151 | ||
1152 | strcpy(monsters[4][2]->name, "Massive Cockroach"); | |
1153 | strcpy(monsters[4][2]->weapon, "Piercing Hiss"); | |
1154 | monsters[4][2]->strength = 125; | |
1155 | monsters[4][2]->gold = 700; | |
1156 | monsters[4][2]->exp = 150; | |
1157 | monsters[4][2]->maxhp = 112; | |
1158 | strcpy(monsters[4][2]->death, "Where's the exterminator when you need one?"); | |
1159 | ||
1160 | strcpy(monsters[4][3]->name, "Big Venomous Snake"); | |
1161 | strcpy(monsters[4][3]->weapon, "Poison Fangs"); | |
1162 | monsters[4][3]->strength = 140; | |
1163 | monsters[4][3]->gold = 900; | |
1164 | monsters[4][3]->exp = 175; | |
1165 | monsters[4][3]->maxhp = 126; | |
1166 | strcpy(monsters[4][3]->death, "After killing this beast you check for puncture marks... you find none, luckily."); | |
1167 | ||
1168 | strcpy(monsters[4][4]->name, "Lizard Man"); | |
1169 | strcpy(monsters[4][4]->weapon, "Deadly Jaws"); | |
1170 | monsters[4][4]->strength = 145; | |
1171 | monsters[4][4]->gold = 1250; | |
1172 | monsters[4][4]->exp = 175; | |
1173 | monsters[4][4]->maxhp = 150; | |
1174 | strcpy(monsters[4][4]->death, "His scales made for tough armor, and his jaws for a tougher opponent!"); | |
1175 | ||
1176 | strcpy(monsters[4][5]->name, "Face Dancer"); | |
1177 | strcpy(monsters[4][5]->weapon, "Illusion Scyth"); | |
1178 | monsters[4][5]->strength = 138; | |
1179 | monsters[4][5]->gold = 1603; | |
1180 | monsters[4][5]->exp = 198; | |
1181 | monsters[4][5]->maxhp = 173; | |
1182 | strcpy(monsters[4][5]->death, "His carcus takes the shape of many things before it dies. His true form is so repulsive, you know why he changed faces so much!"); | |
1183 | ||
1184 | strcpy(monsters[4][6]->name, "Darklord Longbow Archer"); | |
1185 | strcpy(monsters[4][6]->weapon, "Deadly Bow and Arrows"); | |
1186 | monsters[4][6]->strength = 145; | |
1187 | monsters[4][6]->gold = 1569; | |
1188 | monsters[4][6]->exp = 243; | |
1189 | monsters[4][6]->maxhp = 170; | |
1190 | strcpy(monsters[4][6]->death, "Your face turns white with horror after you realize you just met the devil's protector!"); | |
1191 | ||
1192 | strcpy(monsters[4][7]->name, "Hell's Paladin"); | |
1193 | strcpy(monsters[4][7]->weapon, "Sword of Hellfire"); | |
1194 | monsters[4][7]->strength = 200; | |
1195 | monsters[4][7]->gold = 2191; | |
1196 | monsters[4][7]->exp = 254; | |
1197 | monsters[4][7]->maxhp = 175; | |
1198 | strcpy(monsters[4][7]->death, "This is starting to get tough you think. Do you really want to go to level 6?"); | |
1199 | ||
1200 | strcpy(monsters[4][8]->name, "The Unknown Soldier"); | |
1201 | strcpy(monsters[4][8]->weapon, "Soul Torture"); | |
1202 | monsters[4][8]->strength = 175; | |
1203 | monsters[4][8]->gold = 1890; | |
1204 | monsters[4][8]->exp = 200; | |
1205 | monsters[4][8]->maxhp = 180; | |
1206 | strcpy(monsters[4][8]->death, "Who was that? Where was he from? And what was that weapon??"); | |
1207 | ||
1208 | strcpy(monsters[4][9]->name, "Undead Cult Leader"); | |
1209 | strcpy(monsters[4][9]->weapon, "Lance of Deceit"); | |
1210 | monsters[4][9]->strength = 180; | |
1211 | monsters[4][9]->gold = 1792; | |
1212 | monsters[4][9]->exp = 195; | |
1213 | monsters[4][9]->maxhp = 190; | |
1214 | strcpy(monsters[4][9]->death, "His words fall on deaf ears... this is one cult you will NOT be part of!"); | |
1215 | ||
1216 | strcpy(monsters[4][10]->name, "Water Serpent"); | |
1217 | strcpy(monsters[4][10]->weapon, "Forked Tongue"); | |
1218 | monsters[4][10]->strength = 150; | |
1219 | monsters[4][10]->gold = 1500; | |
1220 | monsters[4][10]->exp = 176; | |
1221 | monsters[4][10]->maxhp = 220; | |
1222 | strcpy(monsters[4][10]->death, "The serpent squeals as you cut off its head!"); | |
1223 | ||
1224 | strcpy(monsters[4][11]->name, "Silverback Gorilla"); | |
1225 | strcpy(monsters[4][11]->weapon, "Deadly Banana Peel"); | |
1226 | monsters[4][11]->strength = 160; | |
1227 | monsters[4][11]->gold = 1300; | |
1228 | monsters[4][11]->exp = 150; | |
1229 | monsters[4][11]->maxhp = 178; | |
1230 | strcpy(monsters[4][11]->death, "Was that gorilla or guerilla?"); | |
cb1ad920 | 1231 | |
1232 | strcpy( monsters[5][0]->name, ""); | |
1233 | strcpy( monsters[5][0]->weapon, ""); | |
1234 | monsters[5][0]->strength = 200; | |
1235 | monsters[5][0]->gold = 2500; | |
1236 | monsters[5][0]->exp = 200; | |
1237 | monsters[5][0]->maxhp = 200; | |
1238 | strcpy( monsters[5][0]->death, ""); | |
1239 | ||
1240 | strcpy( monsters[5][1]->name, ""); | |
1241 | strcpy( monsters[5][1]->weapon, ""); | |
1242 | monsters[5][1]->strength = 230; | |
1243 | monsters[5][1]->gold = 3215; | |
1244 | monsters[5][1]->exp = 230; | |
1245 | monsters[5][1]->maxhp = 210; | |
1246 | strcpy( monsters[5][1]->death, ""); | |
1247 | ||
1248 | strcpy( monsters[5][2]->name, ""); | |
1249 | strcpy( monsters[5][2]->weapon, ""); | |
1250 | monsters[5][2]->strength = 215; | |
1251 | monsters[5][2]->gold = 2750; | |
1252 | monsters[5][2]->exp = 245; | |
1253 | monsters[5][2]->maxhp = 214; | |
1254 | strcpy( monsters[5][2]->death, ""); | |
1255 | ||
1256 | strcpy( monsters[5][3]->name, "Cheap Bastard"); | |
1257 | strcpy( monsters[5][3]->weapon, "Sack of Pennies"); | |
1258 | monsters[5][3]->strength = 245; | |
1259 | monsters[5][3]->gold = 1000; | |
1260 | monsters[5][3]->exp = 195; | |
1261 | monsters[5][3]->maxhp = 200; | |
1262 | strcpy( monsters[5][3]->death, "You hear him scream, \"MY COINS!!\" as you run off with his sack."); | |
1263 | ||
1264 | strcpy( monsters[5][4]->name, ""); | |
1265 | strcpy( monsters[5][4]->weapon, ""); | |
1266 | monsters[5][4]->strength = 300; | |
1267 | monsters[5][4]->gold = 4500; | |
1268 | monsters[5][4]->exp = 375; | |
1269 | monsters[5][4]->maxhp = 221; | |
1270 | strcpy( monsters[5][4]->death, ""); | |
1271 | ||
1272 | strcpy( monsters[5][5]->name, ""); | |
1273 | strcpy( monsters[5][5]->weapon, ""); | |
1274 | monsters[5][5]->strength = 1; | |
1275 | monsters[5][5]->gold = 1; | |
1276 | monsters[5][5]->exp = 1; | |
1277 | monsters[5][5]->maxhp = 1; | |
1278 | strcpy( monsters[5][5]->death, ""); | |
1279 | ||
1280 | strcpy( monsters[5][6]->name, ""); | |
1281 | strcpy( monsters[5][6]->weapon, ""); | |
1282 | monsters[5][6]->strength = 1; | |
1283 | monsters[5][6]->gold = 1; | |
1284 | monsters[5][6]->exp = 1; | |
1285 | monsters[5][6]->maxhp = 1; | |
1286 | strcpy( monsters[5][6]->death, ""); | |
1287 | ||
1288 | strcpy( monsters[5][7]->name, ""); | |
1289 | strcpy( monsters[5][7]->weapon, ""); | |
1290 | monsters[5][7]->strength = 1; | |
1291 | monsters[5][7]->gold = 1; | |
1292 | monsters[5][7]->exp = 1; | |
1293 | monsters[5][7]->maxhp = 1; | |
1294 | strcpy( monsters[5][7]->death, ""); | |
1295 | ||
1296 | strcpy( monsters[5][8]->name, ""); | |
1297 | strcpy( monsters[5][8]->weapon, ""); | |
1298 | monsters[5][8]->strength = 1; | |
1299 | monsters[5][8]->gold = 1; | |
1300 | monsters[5][8]->exp = 1; | |
1301 | monsters[5][8]->maxhp = 1; | |
1302 | strcpy( monsters[5][8]->death, ""); | |
1303 | ||
1304 | strcpy( monsters[5][9]->name, ""); | |
1305 | strcpy( monsters[5][9]->weapon, ""); | |
1306 | monsters[5][9]->strength = 1; | |
1307 | monsters[5][9]->gold = 1; | |
1308 | monsters[5][9]->exp = 1; | |
1309 | monsters[5][9]->maxhp = 1; | |
1310 | strcpy( monsters[5][9]->death, ""); | |
1311 | ||
1312 | strcpy( monsters[5][10]->name, ""); | |
1313 | strcpy( monsters[5][10]->weapon, ""); | |
1314 | monsters[5][10]->strength = 1; | |
1315 | monsters[5][10]->gold = 1; | |
1316 | monsters[5][10]->exp = 1; | |
1317 | monsters[5][10]->maxhp = 1; | |
1318 | strcpy( monsters[5][10]->death, ""); | |
1319 | ||
1320 | strcpy( monsters[5][11]->name, ""); | |
1321 | strcpy( monsters[5][11]->weapon, ""); | |
1322 | monsters[5][11]->strength = 1; | |
1323 | monsters[5][11]->gold = 1; | |
1324 | monsters[5][11]->exp = 1; | |
1325 | monsters[5][11]->maxhp = 1; | |
1326 | strcpy( monsters[5][11]->death, ""); | |
1327 | ||
1328 | strcpy( monsters[6][0]->name, ""); | |
1329 | strcpy( monsters[6][0]->weapon, ""); | |
1330 | monsters[6][0]->strength = 1; | |
1331 | monsters[6][0]->gold = 1; | |
1332 | monsters[6][0]->exp = 1; | |
1333 | monsters[6][0]->maxhp = 1; | |
1334 | strcpy( monsters[6][0]->death, ""); | |
1335 | ||
1336 | strcpy( monsters[6][1]->name, ""); | |
1337 | strcpy( monsters[6][1]->weapon, ""); | |
1338 | monsters[6][1]->strength = 1; | |
1339 | monsters[6][1]->gold = 1; | |
1340 | monsters[6][1]->exp = 1; | |
1341 | monsters[6][1]->maxhp = 1; | |
1342 | strcpy( monsters[6][1]->death, ""); | |
1343 | ||
1344 | strcpy( monsters[6][2]->name, ""); | |
1345 | strcpy( monsters[6][2]->weapon, ""); | |
1346 | monsters[6][2]->strength = 1; | |
1347 | monsters[6][2]->gold = 1; | |
1348 | monsters[6][2]->exp = 1; | |
1349 | monsters[6][2]->maxhp = 1; | |
1350 | strcpy( monsters[6][2]->death, ""); | |
1351 | ||
1352 | strcpy( monsters[6][3]->name, ""); | |
1353 | strcpy( monsters[6][3]->weapon, ""); | |
1354 | monsters[6][3]->strength = 1; | |
1355 | monsters[6][3]->gold = 1; | |
1356 | monsters[6][3]->exp = 1; | |
1357 | monsters[6][3]->maxhp = 1; | |
1358 | strcpy( monsters[6][3]->death, ""); | |
1359 | ||
1360 | strcpy( monsters[6][4]->name, ""); | |
1361 | strcpy( monsters[6][4]->weapon, ""); | |
1362 | monsters[6][4]->strength = 1; | |
1363 | monsters[6][4]->gold = 1; | |
1364 | monsters[6][4]->exp = 1; | |
1365 | monsters[6][4]->maxhp = 1; | |
1366 | strcpy( monsters[6][4]->death, ""); | |
1367 | ||
1368 | strcpy( monsters[6][5]->name, ""); | |
1369 | strcpy( monsters[6][5]->weapon, ""); | |
1370 | monsters[6][5]->strength = 1; | |
1371 | monsters[6][5]->gold = 1; | |
1372 | monsters[6][5]->exp = 1; | |
1373 | monsters[6][5]->maxhp = 1; | |
1374 | strcpy( monsters[6][5]->death, ""); | |
1375 | ||
1376 | strcpy( monsters[6][6]->name, ""); | |
1377 | strcpy( monsters[6][6]->weapon, ""); | |
1378 | monsters[6][6]->strength = 1; | |
1379 | monsters[6][6]->gold = 1; | |
1380 | monsters[6][6]->exp = 1; | |
1381 | monsters[6][6]->maxhp = 1; | |
1382 | strcpy( monsters[6][6]->death, ""); | |
1383 | ||
1384 | strcpy( monsters[6][7]->name, ""); | |
1385 | strcpy( monsters[6][7]->weapon, ""); | |
1386 | monsters[6][7]->strength = 1; | |
1387 | monsters[6][7]->gold = 1; | |
1388 | monsters[6][7]->exp = 1; | |
1389 | monsters[6][7]->maxhp = 1; | |
1390 | strcpy( monsters[6][7]->death, ""); | |
1391 | ||
1392 | strcpy( monsters[6][8]->name, ""); | |
1393 | strcpy( monsters[6][8]->weapon, ""); | |
1394 | monsters[6][8]->strength = 1; | |
1395 | monsters[6][8]->gold = 1; | |
1396 | monsters[6][8]->exp = 1; | |
1397 | monsters[6][8]->maxhp = 1; | |
1398 | strcpy( monsters[6][8]->death, ""); | |
1399 | ||
1400 | strcpy( monsters[6][9]->name, ""); | |
1401 | strcpy( monsters[6][9]->weapon, ""); | |
1402 | monsters[6][9]->strength = 1; | |
1403 | monsters[6][9]->gold = 1; | |
1404 | monsters[6][9]->exp = 1; | |
1405 | monsters[6][9]->maxhp = 1; | |
1406 | strcpy( monsters[6][9]->death, ""); | |
1407 | ||
1408 | strcpy( monsters[6][10]->name, ""); | |
1409 | strcpy( monsters[6][10]->weapon, ""); | |
1410 | monsters[6][10]->strength = 1; | |
1411 | monsters[6][10]->gold = 1; | |
1412 | monsters[6][10]->exp = 1; | |
1413 | monsters[6][10]->maxhp = 1; | |
1414 | strcpy( monsters[6][10]->death, ""); | |
1415 | ||
1416 | strcpy( monsters[6][11]->name, ""); | |
1417 | strcpy( monsters[6][11]->weapon, ""); | |
1418 | monsters[6][11]->strength = 1; | |
1419 | monsters[6][11]->gold = 1; | |
1420 | monsters[6][11]->exp = 1; | |
1421 | monsters[6][11]->maxhp = 1; | |
1422 | strcpy( monsters[6][11]->death, ""); | |
1423 | ||
1424 | strcpy( monsters[7][0]->name, ""); | |
1425 | strcpy( monsters[7][0]->weapon, ""); | |
1426 | monsters[7][0]->strength = 1; | |
1427 | monsters[7][0]->gold = 1; | |
1428 | monsters[7][0]->exp = 1; | |
1429 | monsters[7][0]->maxhp = 1; | |
1430 | strcpy( monsters[7][0]->death, ""); | |
1431 | ||
1432 | strcpy( monsters[7][1]->name, ""); | |
1433 | strcpy( monsters[7][1]->weapon, ""); | |
1434 | monsters[7][1]->strength = 1; | |
1435 | monsters[7][1]->gold = 1; | |
1436 | monsters[7][1]->exp = 1; | |
1437 | monsters[7][1]->maxhp = 1; | |
1438 | strcpy( monsters[7][1]->death, ""); | |
1439 | ||
1440 | strcpy( monsters[7][2]->name, ""); | |
1441 | strcpy( monsters[7][2]->weapon, ""); | |
1442 | monsters[7][2]->strength = 1; | |
1443 | monsters[7][2]->gold = 1; | |
1444 | monsters[7][2]->exp = 1; | |
1445 | monsters[7][2]->maxhp = 1; | |
1446 | strcpy( monsters[7][2]->death, ""); | |
1447 | ||
1448 | strcpy( monsters[7][3]->name, ""); | |
1449 | strcpy( monsters[7][3]->weapon, ""); | |
1450 | monsters[7][3]->strength = 1; | |
1451 | monsters[7][3]->gold = 1; | |
1452 | monsters[7][3]->exp = 1; | |
1453 | monsters[7][3]->maxhp = 1; | |
1454 | strcpy( monsters[7][3]->death, ""); | |
1455 | ||
1456 | strcpy( monsters[7][4]->name, ""); | |
1457 | strcpy( monsters[7][4]->weapon, ""); | |
1458 | monsters[7][4]->strength = 1; | |
1459 | monsters[7][4]->gold = 1; | |
1460 | monsters[7][4]->exp = 1; | |
1461 | monsters[7][4]->maxhp = 1; | |
1462 | strcpy( monsters[7][4]->death, ""); | |
1463 | ||
1464 | strcpy( monsters[7][5]->name, ""); | |
1465 | strcpy( monsters[7][5]->weapon, ""); | |
1466 | monsters[7][5]->strength = 1; | |
1467 | monsters[7][5]->gold = 1; | |
1468 | monsters[7][5]->exp = 1; | |
1469 | monsters[7][5]->maxhp = 1; | |
1470 | strcpy( monsters[7][5]->death, ""); | |
1471 | ||
1472 | strcpy( monsters[7][6]->name, ""); | |
1473 | strcpy( monsters[7][6]->weapon, ""); | |
1474 | monsters[7][6]->strength = 1; | |
1475 | monsters[7][6]->gold = 1; | |
1476 | monsters[7][6]->exp = 1; | |
1477 | monsters[7][6]->maxhp = 1; | |
1478 | strcpy( monsters[7][6]->death, ""); | |
1479 | ||
1480 | strcpy( monsters[7][7]->name, ""); | |
1481 | strcpy( monsters[7][7]->weapon, ""); | |
1482 | monsters[7][7]->strength = 1; | |
1483 | monsters[7][7]->gold = 1; | |
1484 | monsters[7][7]->exp = 1; | |
1485 | monsters[7][7]->maxhp = 1; | |
1486 | strcpy( monsters[7][7]->death, ""); | |
1487 | ||
1488 | strcpy( monsters[7][8]->name, ""); | |
1489 | strcpy( monsters[7][8]->weapon, ""); | |
1490 | monsters[7][8]->strength = 1; | |
1491 | monsters[7][8]->gold = 1; | |
1492 | monsters[7][8]->exp = 1; | |
1493 | monsters[7][8]->maxhp = 1; | |
1494 | strcpy( monsters[7][8]->death, ""); | |
1495 | ||
1496 | strcpy( monsters[7][9]->name, ""); | |
1497 | strcpy( monsters[7][9]->weapon, ""); | |
1498 | monsters[7][9]->strength = 1; | |
1499 | monsters[7][9]->gold = 1; | |
1500 | monsters[7][9]->exp = 1; | |
1501 | monsters[7][9]->maxhp = 1; | |
1502 | strcpy( monsters[7][9]->death, ""); | |
1503 | ||
1504 | strcpy( monsters[7][10]->name, ""); | |
1505 | strcpy( monsters[7][10]->weapon, ""); | |
1506 | monsters[7][10]->strength = 1; | |
1507 | monsters[7][10]->gold = 1; | |
1508 | monsters[7][10]->exp = 1; | |
1509 | monsters[7][10]->maxhp = 1; | |
1510 | strcpy( monsters[7][10]->death, ""); | |
1511 | ||
1512 | strcpy( monsters[7][11]->name, ""); | |
1513 | strcpy( monsters[7][11]->weapon, ""); | |
1514 | monsters[7][11]->strength = 1; | |
1515 | monsters[7][11]->gold = 1; | |
1516 | monsters[7][11]->exp = 1; | |
1517 | monsters[7][11]->maxhp = 1; | |
1518 | strcpy( monsters[7][11]->death, ""); | |
1519 | ||
1520 | strcpy( monsters[8][0]->name, ""); | |
1521 | strcpy( monsters[8][0]->weapon, ""); | |
1522 | monsters[8][0]->strength = 1; | |
1523 | monsters[8][0]->gold = 1; | |
1524 | monsters[8][0]->exp = 1; | |
1525 | monsters[8][0]->maxhp = 1; | |
1526 | strcpy( monsters[8][0]->death, ""); | |
1527 | ||
1528 | strcpy( monsters[8][1]->name, ""); | |
1529 | strcpy( monsters[8][1]->weapon, ""); | |
1530 | monsters[8][1]->strength = 1; | |
1531 | monsters[8][1]->gold = 1; | |
1532 | monsters[8][1]->exp = 1; | |
1533 | monsters[8][1]->maxhp = 1; | |
1534 | strcpy( monsters[8][1]->death, ""); | |
1535 | ||
1536 | strcpy( monsters[8][2]->name, ""); | |
1537 | strcpy( monsters[8][2]->weapon, ""); | |
1538 | monsters[8][2]->strength = 1; | |
1539 | monsters[8][2]->gold = 1; | |
1540 | monsters[8][2]->exp = 1; | |
1541 | monsters[8][2]->maxhp = 1; | |
1542 | strcpy( monsters[8][2]->death, ""); | |
1543 | ||
1544 | strcpy( monsters[8][3]->name, ""); | |
1545 | strcpy( monsters[8][3]->weapon, ""); | |
1546 | monsters[8][3]->strength = 1; | |
1547 | monsters[8][3]->gold = 1; | |
1548 | monsters[8][3]->exp = 1; | |
1549 | monsters[8][3]->maxhp = 1; | |
1550 | strcpy( monsters[8][3]->death, ""); | |
1551 | ||
1552 | strcpy( monsters[8][4]->name, ""); | |
1553 | strcpy( monsters[8][4]->weapon, ""); | |
1554 | monsters[8][4]->strength = 1; | |
1555 | monsters[8][4]->gold = 1; | |
1556 | monsters[8][4]->exp = 1; | |
1557 | monsters[8][4]->maxhp = 1; | |
1558 | strcpy( monsters[8][4]->death, ""); | |
1559 | ||
1560 | strcpy( monsters[8][5]->name, ""); | |
1561 | strcpy( monsters[8][5]->weapon, ""); | |
1562 | monsters[8][5]->strength = 1; | |
1563 | monsters[8][5]->gold = 1; | |
1564 | monsters[8][5]->exp = 1; | |
1565 | monsters[8][5]->maxhp = 1; | |
1566 | strcpy( monsters[8][5]->death, ""); | |
1567 | ||
1568 | strcpy( monsters[8][6]->name, ""); | |
1569 | strcpy( monsters[8][6]->weapon, ""); | |
1570 | monsters[8][6]->strength = 1; | |
1571 | monsters[8][6]->gold = 1; | |
1572 | monsters[8][6]->exp = 1; | |
1573 | monsters[8][6]->maxhp = 1; | |
1574 | strcpy( monsters[8][6]->death, ""); | |
1575 | ||
1576 | strcpy( monsters[8][7]->name, ""); | |
1577 | strcpy( monsters[8][7]->weapon, ""); | |
1578 | monsters[8][7]->strength = 1; | |
1579 | monsters[8][7]->gold = 1; | |
1580 | monsters[8][7]->exp = 1; | |
1581 | monsters[8][7]->maxhp = 1; | |
1582 | strcpy( monsters[8][7]->death, ""); | |
1583 | ||
1584 | strcpy( monsters[8][8]->name, ""); | |
1585 | strcpy( monsters[8][8]->weapon, ""); | |
1586 | monsters[8][8]->strength = 1; | |
1587 | monsters[8][8]->gold = 1; | |
1588 | monsters[8][8]->exp = 1; | |
1589 | monsters[8][8]->maxhp = 1; | |
1590 | strcpy( monsters[8][8]->death, ""); | |
1591 | ||
1592 | strcpy( monsters[8][9]->name, ""); | |
1593 | strcpy( monsters[8][9]->weapon, ""); | |
1594 | monsters[8][9]->strength = 1; | |
1595 | monsters[8][9]->gold = 1; | |
1596 | monsters[8][9]->exp = 1; | |
1597 | monsters[8][9]->maxhp = 1; | |
1598 | strcpy( monsters[8][9]->death, ""); | |
1599 | ||
1600 | strcpy( monsters[8][10]->name, ""); | |
1601 | strcpy( monsters[8][10]->weapon, ""); | |
1602 | monsters[8][10]->strength = 1; | |
1603 | monsters[8][10]->gold = 1; | |
1604 | monsters[8][10]->exp = 1; | |
1605 | monsters[8][10]->maxhp = 1; | |
1606 | strcpy( monsters[8][10]->death, ""); | |
1607 | ||
1608 | strcpy( monsters[8][11]->name, ""); | |
1609 | strcpy( monsters[8][11]->weapon, ""); | |
1610 | monsters[8][11]->strength = 1; | |
1611 | monsters[8][11]->gold = 1; | |
1612 | monsters[8][11]->exp = 1; | |
1613 | monsters[8][11]->maxhp = 1; | |
1614 | strcpy( monsters[8][11]->death, ""); | |
1615 | ||
1616 | strcpy( monsters[9][0]->name, ""); | |
1617 | strcpy( monsters[9][0]->weapon, ""); | |
1618 | monsters[9][0]->strength = 1; | |
1619 | monsters[9][0]->gold = 1; | |
1620 | monsters[9][0]->exp = 1; | |
1621 | monsters[9][0]->maxhp = 1; | |
1622 | strcpy( monsters[9][0]->death, ""); | |
1623 | ||
1624 | strcpy( monsters[9][1]->name, ""); | |
1625 | strcpy( monsters[9][1]->weapon, ""); | |
1626 | monsters[9][1]->strength = 1; | |
1627 | monsters[9][1]->gold = 1; | |
1628 | monsters[9][1]->exp = 1; | |
1629 | monsters[9][1]->maxhp = 1; | |
1630 | strcpy( monsters[9][1]->death, ""); | |
1631 | ||
1632 | strcpy( monsters[9][2]->name, ""); | |
1633 | strcpy( monsters[9][2]->weapon, ""); | |
1634 | monsters[9][2]->strength = 1; | |
1635 | monsters[9][2]->gold = 1; | |
1636 | monsters[9][2]->exp = 1; | |
1637 | monsters[9][2]->maxhp = 1; | |
1638 | strcpy( monsters[9][2]->death, ""); | |
1639 | ||
1640 | strcpy( monsters[9][3]->name, ""); | |
1641 | strcpy( monsters[9][3]->weapon, ""); | |
1642 | monsters[9][3]->strength = 1; | |
1643 | monsters[9][3]->gold = 1; | |
1644 | monsters[9][3]->exp = 1; | |
1645 | monsters[9][3]->maxhp = 1; | |
1646 | strcpy( monsters[9][3]->death, ""); | |
1647 | ||
1648 | strcpy( monsters[9][4]->name, ""); | |
1649 | strcpy( monsters[9][4]->weapon, ""); | |
1650 | monsters[9][4]->strength = 1; | |
1651 | monsters[9][4]->gold = 1; | |
1652 | monsters[9][4]->exp = 1; | |
1653 | monsters[9][4]->maxhp = 1; | |
1654 | strcpy( monsters[9][4]->death, ""); | |
1655 | ||
1656 | strcpy( monsters[9][5]->name, ""); | |
1657 | strcpy( monsters[9][5]->weapon, ""); | |
1658 | monsters[9][5]->strength = 1; | |
1659 | monsters[9][5]->gold = 1; | |
1660 | monsters[9][5]->exp = 1; | |
1661 | monsters[9][5]->maxhp = 1; | |
1662 | strcpy( monsters[9][5]->death, ""); | |
1663 | ||
1664 | strcpy( monsters[9][6]->name, ""); | |
1665 | strcpy( monsters[9][6]->weapon, ""); | |
1666 | monsters[9][6]->strength = 1; | |
1667 | monsters[9][6]->gold = 1; | |
1668 | monsters[9][6]->exp = 1; | |
1669 | monsters[9][6]->maxhp = 1; | |
1670 | strcpy( monsters[9][6]->death, ""); | |
1671 | ||
1672 | strcpy( monsters[9][7]->name, ""); | |
1673 | strcpy( monsters[9][7]->weapon, ""); | |
1674 | monsters[9][7]->strength = 1; | |
1675 | monsters[9][7]->gold = 1; | |
1676 | monsters[9][7]->exp = 1; | |
1677 | monsters[9][7]->maxhp = 1; | |
1678 | strcpy( monsters[9][7]->death, ""); | |
1679 | ||
1680 | strcpy( monsters[9][8]->name, ""); | |
1681 | strcpy( monsters[9][8]->weapon, ""); | |
1682 | monsters[9][8]->strength = 1; | |
1683 | monsters[9][8]->gold = 1; | |
1684 | monsters[9][8]->exp = 1; | |
1685 | monsters[9][8]->maxhp = 1; | |
1686 | strcpy( monsters[9][8]->death, ""); | |
1687 | ||
1688 | strcpy( monsters[9][9]->name, ""); | |
1689 | strcpy( monsters[9][9]->weapon, ""); | |
1690 | monsters[9][9]->strength = 1; | |
1691 | monsters[9][9]->gold = 1; | |
1692 | monsters[9][9]->exp = 1; | |
1693 | monsters[9][9]->maxhp = 1; | |
1694 | strcpy( monsters[9][9]->death, ""); | |
1695 | ||
1696 | strcpy( monsters[9][10]->name, ""); | |
1697 | strcpy( monsters[9][10]->weapon, ""); | |
1698 | monsters[9][10]->strength = 1; | |
1699 | monsters[9][10]->gold = 1; | |
1700 | monsters[9][10]->exp = 1; | |
1701 | monsters[9][10]->maxhp = 1; | |
1702 | strcpy( monsters[9][10]->death, ""); | |
1703 | ||
1704 | strcpy( monsters[9][11]->name, ""); | |
1705 | strcpy( monsters[9][11]->weapon, ""); | |
1706 | monsters[9][11]->strength = 1; | |
1707 | monsters[9][11]->gold = 1; | |
1708 | monsters[9][11]->exp = 1; | |
1709 | monsters[9][11]->maxhp = 1; | |
1710 | strcpy( monsters[9][11]->death, ""); | |
1711 | ||
1712 | strcpy( monsters[10][0]->name, ""); | |
1713 | strcpy( monsters[10][0]->weapon, ""); | |
1714 | monsters[10][0]->strength = 1; | |
1715 | monsters[10][0]->gold = 1; | |
1716 | monsters[10][0]->exp = 1; | |
1717 | monsters[10][0]->maxhp = 1; | |
1718 | strcpy( monsters[10][0]->death, ""); | |
1719 | ||
1720 | strcpy( monsters[10][1]->name, ""); | |
1721 | strcpy( monsters[10][1]->weapon, ""); | |
1722 | monsters[10][1]->strength = 1; | |
1723 | monsters[10][1]->gold = 1; | |
1724 | monsters[10][1]->exp = 1; | |
1725 | monsters[10][1]->maxhp = 1; | |
1726 | strcpy( monsters[10][1]->death, ""); | |
1727 | ||
1728 | strcpy( monsters[10][2]->name, ""); | |
1729 | strcpy( monsters[10][2]->weapon, ""); | |
1730 | monsters[10][2]->strength = 1; | |
1731 | monsters[10][2]->gold = 1; | |
1732 | monsters[10][2]->exp = 1; | |
1733 | monsters[10][2]->maxhp = 1; | |
1734 | strcpy( monsters[10][2]->death, ""); | |
1735 | ||
1736 | strcpy( monsters[10][3]->name, ""); | |
1737 | strcpy( monsters[10][3]->weapon, ""); | |
1738 | monsters[10][3]->strength = 1; | |
1739 | monsters[10][3]->gold = 1; | |
1740 | monsters[10][3]->exp = 1; | |
1741 | monsters[10][3]->maxhp = 1; | |
1742 | strcpy( monsters[10][3]->death, ""); | |
1743 | ||
1744 | strcpy( monsters[10][4]->name, ""); | |
1745 | strcpy( monsters[10][4]->weapon, ""); | |
1746 | monsters[10][4]->strength = 1; | |
1747 | monsters[10][4]->gold = 1; | |
1748 | monsters[10][4]->exp = 1; | |
1749 | monsters[10][4]->maxhp = 1; | |
1750 | strcpy( monsters[10][4]->death, ""); | |
1751 | ||
1752 | strcpy( monsters[10][5]->name, ""); | |
1753 | strcpy( monsters[10][5]->weapon, ""); | |
1754 | monsters[10][5]->strength = 1; | |
1755 | monsters[10][5]->gold = 1; | |
1756 | monsters[10][5]->exp = 1; | |
1757 | monsters[10][5]->maxhp = 1; | |
1758 | strcpy( monsters[10][5]->death, ""); | |
1759 | ||
1760 | strcpy( monsters[10][6]->name, ""); | |
1761 | strcpy( monsters[10][6]->weapon, ""); | |
1762 | monsters[10][6]->strength = 1; | |
1763 | monsters[10][6]->gold = 1; | |
1764 | monsters[10][6]->exp = 1; | |
1765 | monsters[10][6]->maxhp = 1; | |
1766 | strcpy( monsters[10][6]->death, ""); | |
1767 | ||
1768 | strcpy( monsters[10][7]->name, ""); | |
1769 | strcpy( monsters[10][7]->weapon, ""); | |
1770 | monsters[10][7]->strength = 1; | |
1771 | monsters[10][7]->gold = 1; | |
1772 | monsters[10][7]->exp = 1; | |
1773 | monsters[10][7]->maxhp = 1; | |
1774 | strcpy( monsters[10][7]->death, ""); | |
1775 | ||
1776 | strcpy( monsters[10][8]->name, ""); | |
1777 | strcpy( monsters[10][8]->weapon, ""); | |
1778 | monsters[10][8]->strength = 1; | |
1779 | monsters[10][8]->gold = 1; | |
1780 | monsters[10][8]->exp = 1; | |
1781 | monsters[10][8]->maxhp = 1; | |
1782 | strcpy( monsters[10][8]->death, ""); | |
1783 | ||
1784 | strcpy( monsters[10][9]->name, ""); | |
1785 | strcpy( monsters[10][9]->weapon, ""); | |
1786 | monsters[10][9]->strength = 1; | |
1787 | monsters[10][9]->gold = 1; | |
1788 | monsters[10][9]->exp = 1; | |
1789 | monsters[10][9]->maxhp = 1; | |
1790 | strcpy( monsters[10][9]->death, ""); | |
1791 | ||
1792 | strcpy( monsters[10][10]->name, ""); | |
1793 | strcpy( monsters[10][10]->weapon, ""); | |
1794 | monsters[10][10]->strength = 1; | |
1795 | monsters[10][10]->gold = 1; | |
1796 | monsters[10][10]->exp = 1; | |
1797 | monsters[10][10]->maxhp = 1; | |
1798 | strcpy( monsters[10][10]->death, ""); | |
1799 | ||
1800 | strcpy( monsters[10][11]->name, ""); | |
1801 | strcpy( monsters[10][11]->weapon, ""); | |
1802 | monsters[10][11]->strength = 1; | |
1803 | monsters[10][11]->gold = 1; | |
1804 | monsters[10][11]->exp = 1; | |
1805 | monsters[10][11]->maxhp = 1; | |
1806 | strcpy( monsters[10][11]->death, ""); | |
1807 | ||
1808 | strcpy( monsters[11][0]->name, ""); | |
1809 | strcpy( monsters[11][0]->weapon, ""); | |
1810 | monsters[11][0]->strength = 1; | |
1811 | monsters[11][0]->gold = 1; | |
1812 | monsters[11][0]->exp = 1; | |
1813 | monsters[11][0]->maxhp = 1; | |
1814 | strcpy( monsters[11][0]->death, ""); | |
1815 | ||
1816 | strcpy( monsters[11][1]->name, ""); | |
1817 | strcpy( monsters[11][1]->weapon, ""); | |
1818 | monsters[11][1]->strength = 1; | |
1819 | monsters[11][1]->gold = 1; | |
1820 | monsters[11][1]->exp = 1; | |
1821 | monsters[11][1]->maxhp = 1; | |
1822 | strcpy( monsters[11][1]->death, ""); | |
1823 | ||
1824 | strcpy( monsters[11][2]->name, ""); | |
1825 | strcpy( monsters[11][2]->weapon, ""); | |
1826 | monsters[11][2]->strength = 1; | |
1827 | monsters[11][2]->gold = 1; | |
1828 | monsters[11][2]->exp = 1; | |
1829 | monsters[11][2]->maxhp = 1; | |
1830 | strcpy( monsters[11][2]->death, ""); | |
1831 | ||
1832 | strcpy( monsters[11][3]->name, ""); | |
1833 | strcpy( monsters[11][3]->weapon, ""); | |
1834 | monsters[11][3]->strength = 1; | |
1835 | monsters[11][3]->gold = 1; | |
1836 | monsters[11][3]->exp = 1; | |
1837 | monsters[11][3]->maxhp = 1; | |
1838 | strcpy( monsters[11][3]->death, ""); | |
1839 | ||
1840 | strcpy( monsters[11][4]->name, ""); | |
1841 | strcpy( monsters[11][4]->weapon, ""); | |
1842 | monsters[11][4]->strength = 1; | |
1843 | monsters[11][4]->gold = 1; | |
1844 | monsters[11][4]->exp = 1; | |
1845 | monsters[11][4]->maxhp = 1; | |
1846 | strcpy( monsters[11][4]->death, ""); | |
1847 | ||
1848 | strcpy( monsters[11][5]->name, ""); | |
1849 | strcpy( monsters[11][5]->weapon, ""); | |
1850 | monsters[11][5]->strength = 1; | |
1851 | monsters[11][5]->gold = 1; | |
1852 | monsters[11][5]->exp = 1; | |
1853 | monsters[11][5]->maxhp = 1; | |
1854 | strcpy( monsters[11][5]->death, ""); | |
1855 | ||
1856 | strcpy( monsters[11][6]->name, ""); | |
1857 | strcpy( monsters[11][6]->weapon, ""); | |
1858 | monsters[11][6]->strength = 1; | |
1859 | monsters[11][6]->gold = 1; | |
1860 | monsters[11][6]->exp = 1; | |
1861 | monsters[11][6]->maxhp = 1; | |
1862 | strcpy( monsters[11][6]->death, ""); | |
1863 | ||
1864 | strcpy( monsters[11][7]->name, ""); | |
1865 | strcpy( monsters[11][7]->weapon, ""); | |
1866 | monsters[11][7]->strength = 1; | |
1867 | monsters[11][7]->gold = 1; | |
1868 | monsters[11][7]->exp = 1; | |
1869 | monsters[11][7]->maxhp = 1; | |
1870 | strcpy( monsters[11][7]->death, ""); | |
1871 | ||
1872 | strcpy( monsters[11][8]->name, ""); | |
1873 | strcpy( monsters[11][8]->weapon, ""); | |
1874 | monsters[11][8]->strength = 1; | |
1875 | monsters[11][8]->gold = 1; | |
1876 | monsters[11][8]->exp = 1; | |
1877 | monsters[11][8]->maxhp = 1; | |
1878 | strcpy( monsters[11][8]->death, ""); | |
1879 | ||
1880 | strcpy( monsters[11][9]->name, ""); | |
1881 | strcpy( monsters[11][9]->weapon, ""); | |
1882 | monsters[11][9]->strength = 1; | |
1883 | monsters[11][9]->gold = 1; | |
1884 | monsters[11][9]->exp = 1; | |
1885 | monsters[11][9]->maxhp = 1; | |
1886 | strcpy( monsters[11][9]->death, ""); | |
1887 | ||
1888 | strcpy( monsters[11][10]->name, ""); | |
1889 | strcpy( monsters[11][10]->weapon, ""); | |
1890 | monsters[11][10]->strength = 1; | |
1891 | monsters[11][10]->gold = 1; | |
1892 | monsters[11][10]->exp = 1; | |
1893 | monsters[11][10]->maxhp = 1; | |
1894 | strcpy( monsters[11][10]->death, ""); | |
1895 | ||
1896 | strcpy( monsters[11][11]->name, ""); | |
1897 | strcpy( monsters[11][11]->weapon, ""); | |
1898 | monsters[11][11]->strength = 1; | |
1899 | monsters[11][11]->gold = 1; | |
1900 | monsters[11][11]->exp = 1; | |
1901 | monsters[11][11]->maxhp = 1; | |
1902 | strcpy( monsters[11][11]->death, ""); | |
4dde2ed9 | 1903 | |
1904 | */ | |
c8ada07e | 1905 | } |
1906 | ||
1907 | void delete_monsters() | |
1908 | { | |
1909 | for (int x = 0; x < LEVELS; x++) | |
1910 | for (int y = 0; y < MONSTERS; y++) | |
1911 | if (monsters[x][y]) | |
1912 | delete monsters[x][y]; | |
1913 | } | |
1914 | ||
1915 | void delete_masters() | |
1916 | { | |
1917 | for (int x = 0; x < LEVELS; x++) | |
1918 | if (masters[x]) | |
1919 | delete masters[x]; | |
85ce9d3e | 1920 | } |
1921 | ||
1922 | void display_monster(char *u) | |
1923 | { | |
1924 | if (is_playing(u)) | |
1925 | { | |
1926 | aClient *user = find(u); | |
1927 | Player *ni = user->stats; | |
1928 | ||
1929 | notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", ni->hp); | |
1930 | notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", ni->fight->name, ni->fight->hp); | |
1931 | notice(s_GameServ, u, "Here are your commands:"); | |
1932 | notice(s_GameServ, u, "/msg %S attack"); | |
1933 | notice(s_GameServ, u, "/msg %S run"); | |
1934 | notice(s_GameServ, u, "What will you do?"); | |
1935 | } | |
1936 | } | |
1937 | ||
1938 | void display_players(char *u) | |
1939 | { | |
1940 | if (is_playing(u)) | |
1941 | { | |
1942 | aClient *ni = find(u); | |
1943 | ||
1944 | aClient *battle = ni->stats->battle; | |
1945 | ||
1946 | notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", ni->stats->hp); | |
1947 | notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", battle->getNick(), | |
1948 | battle->stats->hp); | |
1949 | ||
1950 | notice(s_GameServ, u, "Here are your commands:"); | |
83cf716f | 1951 | notice(s_GameServ, u, "/msg %S attack"); |
1952 | notice(s_GameServ, u, "/msg %S run"); | |
1953 | notice(s_GameServ, u, "What will you do?"); | |
1954 | } | |
1955 | } | |
1956 | void display_players(aClient *user) | |
1957 | { | |
1958 | char *u = user->getNick(); | |
1959 | if (is_playing(user) && player_fight(user)) | |
1960 | { | |
1961 | aClient *battle = user->stats->battle; | |
1962 | notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", user->stats->hp); | |
1963 | notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", battle->getNick(), battle->stats->hp); | |
1964 | notice(s_GameServ, u, "Here are your commands:"); | |
1965 | notice(s_GameServ, u, "/msg %S attack"); | |
1966 | notice(s_GameServ, u, "/msg %S run"); | |
85ce9d3e | 1967 | notice(s_GameServ, u, "What will you do?"); |
1968 | } | |
1969 | } | |
1970 | ||
1971 | ||
1972 | bool is_playing(char *u) | |
1973 | { | |
1974 | aClient *user; | |
1975 | if (!(user = find(u))) | |
1976 | { | |
1977 | return false; | |
1978 | } | |
1979 | else | |
1980 | { | |
1981 | return user->stats != NULL; | |
1982 | } | |
1983 | } | |
1984 | ||
1af35752 | 1985 | bool is_playing(aClient *user) |
1986 | { | |
73c71976 | 1987 | return user->stats != NULL && (stricmp(user->getNick(), "!NULL!") != 0); |
1af35752 | 1988 | } |
1989 | ||
85ce9d3e | 1990 | bool is_fighting(char *u) |
1991 | { | |
1992 | aClient *user; | |
1993 | ||
1994 | if (!(user = find(u))) | |
1995 | { | |
1996 | return false; | |
1997 | } | |
1998 | else if (user->stats) | |
1999 | { | |
2000 | return user->stats->fight != NULL || user->stats->battle != NULL | |
2001 | || user->stats->master != NULL; | |
2002 | } | |
2003 | else | |
2004 | return false; | |
2005 | } | |
1af35752 | 2006 | bool is_fighting(aClient *user) |
2007 | { | |
2008 | if (!is_playing(user)) | |
2009 | return false; | |
2010 | else | |
2011 | return (user->stats->fight != NULL || user->stats->battle != NULL || user->stats->master != NULL); | |
2012 | } | |
85ce9d3e | 2013 | |
2014 | bool player_fight(char *u) | |
2015 | { | |
2016 | aClient *user; | |
2017 | ||
2018 | if (!(user = find(u))) | |
2019 | return false; | |
2020 | else if (user->stats) | |
2021 | return user->stats->battle != NULL; | |
2022 | else | |
2023 | return false; | |
2024 | } | |
1af35752 | 2025 | bool player_fight(aClient *user) |
2026 | { | |
2027 | if (!is_fighting(user)) | |
2028 | return false; | |
2029 | else | |
2030 | return user->stats->battle != NULL; | |
2031 | } | |
85ce9d3e | 2032 | |
2033 | bool master_fight(char *u) | |
2034 | { | |
2035 | aClient *user; | |
2036 | ||
2037 | if (!(user = find(u))) | |
2038 | return false; | |
2039 | else if (user->stats) | |
2040 | return user->stats->master != NULL; | |
2041 | else | |
2042 | return false; | |
2043 | } | |
1af35752 | 2044 | bool master_fight(aClient *user) |
85ce9d3e | 2045 | { |
1af35752 | 2046 | if (!is_playing(user)) |
2047 | return false; | |
2048 | else | |
2049 | return user->stats->master != NULL; | |
85ce9d3e | 2050 | } |
2051 | ||
2052 | void do_fight(char *u) | |
2053 | { | |
2054 | aClient *ni, *battle; | |
2055 | ||
2056 | char *nick = strtok(NULL, " "); | |
2057 | ||
2058 | if (!nick) | |
2059 | { | |
2060 | notice(s_GameServ, u, "SYNTAX: /msg %S FIGHT PLAYER"); | |
2061 | } | |
2062 | else if (!(ni = find(u))) | |
2063 | { | |
1af35752 | 2064 | notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, "")); |
85ce9d3e | 2065 | return; |
2066 | } | |
2067 | else if (!(battle = find(nick))) | |
2068 | { | |
2069 | notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick); | |
1902338e | 2070 | return; |
85ce9d3e | 2071 | } |
1af35752 | 2072 | else if (!is_playing(ni)) |
85ce9d3e | 2073 | { |
2074 | notice(s_GameServ, u, "You are not playing!"); | |
1902338e | 2075 | return; |
85ce9d3e | 2076 | } |
2077 | /* | |
2078 | * Offline fighting not implemented yet. | |
2079 | * else if (!(fight = finduser(nick))) | |
2080 | * { | |
2081 | * ni->stats->battle = battle; | |
2082 | * battle->battle = ni; | |
2083 | * ni->yourturn = 1; | |
2084 | * battle->yourturn = 0; | |
2085 | * notice(s_GameServ, u, "You decide to fight %s while they're not online!", | |
2086 | * battle->getNick()); | |
2087 | * display_players(u); | |
2088 | * } | |
2089 | */ | |
ee38284f | 2090 | else if (!isAlive(ni->stats)) |
1af35752 | 2091 | { |
2092 | notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!"); | |
2093 | return; | |
2094 | } | |
1902338e | 2095 | else if (player_fight(battle)) |
2096 | { | |
2097 | notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name, battle->stats->battle->stats->name); | |
2098 | return; | |
2099 | } | |
2100 | else if (is_fighting(battle)) | |
2101 | { | |
2102 | notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name, battle->stats->fight->name); | |
2103 | return; | |
2104 | } | |
1af35752 | 2105 | else if (is_playing(ni) && is_playing(battle) && stricmp(ni->stats->name, battle->stats->name) != 0) |
85ce9d3e | 2106 | { |
2107 | // Set your battle pointer to the other player | |
2108 | ni->stats->battle = battle; | |
2109 | ||
2110 | // Set the other player's battle pointer to you | |
2111 | battle->stats->battle = ni; | |
2112 | ||
2113 | // The initiator gets the first move (perhaps this should be 50/50) | |
ee38284f | 2114 | setYourTurn(ni->stats); |
2115 | clearYourTurn(battle->stats); | |
85ce9d3e | 2116 | |
2117 | // Initiate Battle sequence! | |
2118 | notice(s_GameServ, u, "You challenge %s to an online duel!", battle->getNick()); | |
2119 | notice(s_GameServ, battle->getNick(), "%s has challenged you to an online duel!", u); | |
2120 | notice(s_GameServ, battle->getNick(), "%s gets to go first because he initiated!", u); | |
2121 | notice(s_GameServ, battle->getNick(), "Please wait while %s decides what to do.", u); | |
2122 | display_players(u); | |
2123 | } | |
2124 | } | |
83cf716f | 2125 | void do_use(char *u) |
2126 | { | |
2127 | aClient *user; | |
2128 | Pouch *p; | |
2129 | ||
2130 | char *item = strtok(NULL, " "); | |
2131 | ||
2132 | if (!item) | |
2133 | { | |
2134 | notice(s_GameServ, u, "SYNTAX: USE ITEM"); | |
2135 | notice(s_GameServ, u, "Type /msg %S HELP USE for more information."); | |
2136 | return; | |
2137 | } | |
2138 | else if (!(user = find(u))) | |
2139 | { | |
2140 | notice(s_GameServ, u, "Fatal Error in do_use. Contact a(n) %S Admin"); | |
2141 | return; | |
2142 | } | |
2143 | else if (!is_playing(user)) | |
2144 | { | |
2145 | notice(s_GameServ, u, "You must be playing to use items!"); | |
2146 | return; | |
2147 | } | |
2148 | ||
2149 | p = &user->stats->inventory; | |
2150 | ||
2151 | if (stricmp(item, "HEALTH") == 0) | |
2152 | { | |
2153 | if (p->Healing() <= 0) | |
2154 | { | |
2155 | notice(s_GameServ, u, "You are out of Health Potions!"); | |
2156 | return; | |
2157 | } | |
2158 | int oldhealth = user->stats->hp; | |
2159 | notice(s_GameServ, u, "You hastiliy gulp down the flask of cool life-giving waters."); | |
2160 | notice(s_GameServ, u, "Rejuvination spreads throughout your body."); | |
2161 | user->stats->hp += (10 * user->stats->level) + (rand() % 10) * user->stats->level; | |
2162 | notice(s_GameServ, u, "You gain %d HP!", user->stats->hp - oldhealth); | |
2163 | p->decHealing(); | |
2164 | } | |
2165 | else if (stricmp(item, "STRENGTH") == 0) | |
2166 | { | |
2167 | if (p->Strength() <= 0) | |
2168 | { | |
2169 | notice(s_GameServ, u, "You are out of Strength Potions!"); | |
2170 | return; | |
2171 | } | |
2172 | int oldstrength = user->stats->strength; | |
2173 | notice(s_GameServ, u, "As you grip the flask containing pure power, you feel adrenaline coarse through your veins!"); | |
2174 | notice(s_GameServ, u, "In one swallow you drink the potion and feel your muscle fibers bulging andgrowing!"); | |
b2641ac4 | 2175 | user->stats->strength += 1 + rand() % 2; // 1 - 2 Strength Added |
83cf716f | 2176 | notice(s_GameServ, u, "You gain %d Strength points!", user->stats->strength - oldstrength); |
2177 | p->decStrength(); | |
2178 | } | |
2179 | else if (stricmp(item, "DEFENSE") == 0) | |
2180 | { | |
2181 | if (p->Defense() <= 0) | |
2182 | { | |
2183 | notice(s_GameServ, u, "You are out of Defense Potions!"); | |
2184 | return; | |
2185 | } | |
8c734eb9 | 2186 | int olddefense = user->stats->defense; |
83cf716f | 2187 | notice(s_GameServ, u, "You drink the foul tasting viscous liquid while pinching your nose in disgust."); |
2188 | notice(s_GameServ, u, "It tasted bad, but you feel like you are unbeatable!"); | |
b2641ac4 | 2189 | user->stats->defense += 1 + rand() % 2; // 1 - 2 Defense Added |
83cf716f | 2190 | notice(s_GameServ, u, "You gain %d Defense points!", user->stats->defense - olddefense); |
2191 | p->decDefense(); | |
2192 | } | |
8c734eb9 | 2193 | else if (stricmp(item, "HP") == 0) |
2194 | { | |
2195 | if (p->HP() <= 0) | |
2196 | { | |
2197 | notice(s_GameServ, u, "You are out of HP Potions!"); | |
2198 | return; | |
2199 | } | |
2200 | int oldHP = user->stats->maxhp; | |
2201 | notice(s_GameServ, u, "You feel your life growing longer as you drink the green glowing liquid."); | |
2202 | user->stats->maxhp += 1 + rand() % 5; // 1 - 5 Maxhp | |
2203 | notice(s_GameServ, u, "You gain %d Maximum hit points!", user->stats->maxhp - oldHP); | |
2204 | p->decHP(); | |
2205 | } | |
ee38284f | 2206 | else |
2207 | { | |
2208 | notice(s_GameServ, u, "SYNTAX: /msg %S USE {HEALTH | STRENGTH | DEFENSE}"); | |
2209 | return; | |
2210 | } | |
83cf716f | 2211 | |
2212 | end_turn(user); // If they're fighting, end their turn | |
2213 | } | |
c8ada07e | 2214 | void do_run(char *u) |
2215 | { | |
2216 | aClient *user; | |
28f552b8 | 2217 | Player *p, *p2 = NULL; |
85ce9d3e | 2218 | |
c8ada07e | 2219 | if (!(user = find(u))) |
2220 | { | |
2221 | notice(s_GameServ, u, "Couldn't find you. Error. Contact a %S admin"); | |
2222 | return; | |
2223 | } | |
2224 | ||
2225 | p = user->stats; | |
2226 | ||
2227 | if (p->battle) | |
2228 | p2 = p->battle->stats; | |
2229 | ||
1af35752 | 2230 | if (!is_fighting(user)) |
c8ada07e | 2231 | notice(s_GameServ, u, "You run in place... try fighting next time."); |
1af35752 | 2232 | else if (!player_fight(user) && !master_fight(user)) |
c8ada07e | 2233 | { |
2234 | notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p->fight->name); | |
2235 | delete p->fight; | |
2236 | p->fight = NULL; | |
2237 | } | |
ee38284f | 2238 | else if (player_fight(user) && isYourTurn(p)) |
c8ada07e | 2239 | { |
2240 | notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p2->name); | |
2241 | notice(s_GameServ, p->battle->getNick(), "\ 2%s\ 2 ran away from you like a little baby!", p->name); | |
2242 | p2->battle = NULL; | |
2243 | } | |
ee38284f | 2244 | else if (player_fight(user) && !isYourTurn(p)) |
c8ada07e | 2245 | { |
2246 | notice(s_GameServ, u, "It is not your turn. Please wait until \ 2%s\ 2 decides what to do.", p2->name); | |
2247 | } | |
1af35752 | 2248 | else if (master_fight(user)) |
c8ada07e | 2249 | { |
2250 | notice(s_GameServ, u, "You cannot run from \ 2%s\ 2! FIGHT!", p->master->name); | |
2251 | } | |
2252 | p->battle = NULL; | |
2253 | } | |
83cf716f | 2254 | |
2255 | void end_turn(aClient *user) | |
2256 | { | |
2257 | char *nick, *u = user->getNick(); | |
2258 | Monster *fight; | |
2259 | aClient *battle; | |
2260 | int mhit; | |
2261 | ||
2262 | nick = new char[strlen(user->getNick()) + 1]; | |
2263 | ||
2264 | if (!user || !is_playing(user) || !is_fighting(user)) | |
2265 | goto endturn; | |
2266 | ||
2267 | if (!player_fight(user) && !master_fight(user)) | |
2268 | fight = user->stats->fight; | |
2269 | else | |
2270 | fight = user->stats->master; | |
2271 | battle = user->stats->battle; | |
2272 | ||
2273 | if (!player_fight(user)) | |
2274 | { | |
2275 | // Opponent's Hit | |
2276 | mhit = (fight->strength / 2) + | |
2277 | (rand() % (fight->strength / 2) - (user->stats->defense + | |
2278 | arbonus[user->stats->armor])); | |
2279 | } | |
2280 | else | |
2281 | { | |
2282 | // Opponent's Hit | |
2283 | mhit = (((battle->stats->strength + webonus[battle->stats->weapon]) / 2) + | |
2284 | (rand() % ((battle->stats->strength + webonus[battle->stats->weapon])) / 2) - | |
2285 | (user->stats->defense + arbonus[user->stats->armor])); | |
2286 | } | |
2287 | if (!player_fight(user)) | |
2288 | { | |
2289 | ||
2290 | if (mhit > 0) | |
2291 | { | |
2292 | notice(s_GameServ, u, "\1f%s\1f attacks with their \1f%s\1f for \ 2%d\ 2 damage!", | |
2293 | fight->name, fight->weapon, mhit); | |
2294 | } | |
2295 | else if (mhit <= 0) | |
2296 | notice(s_GameServ, u, "%s completely misses you!", fight->name); | |
2297 | ||
2298 | if (mhit >= user->stats->hp) | |
2299 | { | |
2300 | if (!master_fight(user)) | |
2301 | { | |
2302 | notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", fight->name); | |
2303 | notice(s_GameServ, u, "You lose all gold on hand and lose 10 percent "\ | |
2304 | "of your experience!"); | |
2305 | user->stats->gold = 0; | |
2306 | user->stats->exp -= (long int)(user->stats->exp * .10); | |
2307 | user->stats->fight = NULL; | |
ee38284f | 2308 | clearAlive(user->stats); |
83cf716f | 2309 | goto endturn; |
2310 | } | |
2311 | else | |
2312 | { | |
2313 | notice(s_GameServ, u, "%s has bested you! You will have to wait "\ | |
2314 | "until tomorrow to try again", user->stats->master->name); | |
2315 | user->stats->fight = NULL; | |
2316 | user->stats->master = NULL; | |
2317 | goto endturn; | |
2318 | } | |
2319 | } | |
2320 | else | |
2321 | { | |
2322 | if (mhit > 0) | |
2323 | user->stats->hp -= mhit; | |
2324 | display_monster(u); | |
2325 | goto endturn; | |
2326 | } | |
2327 | } | |
2328 | else | |
2329 | { | |
ee38284f | 2330 | clearYourTurn(user->stats); |
2331 | setYourTurn(battle->stats); | |
83cf716f | 2332 | display_players(battle); |
2333 | } | |
2334 | endturn: | |
2335 | delete nick; | |
2336 | } | |
2337 | ||
85ce9d3e | 2338 | void do_attack(char *u) |
2339 | { | |
2340 | int hit, mhit; | |
2341 | aClient *ni, *battle; // The player and perhaps the player they're fighting | |
2342 | Monster *fight; // The monster they may be fighting | |
2343 | ||
2344 | if (!(ni = find(u))) | |
83cf716f | 2345 | { |
2346 | notice(s_GameServ, u, "Fatal error in do_attack. Contact a(n) %S admin for help."); | |
2347 | return; | |
2348 | } | |
2349 | else if (!is_playing(ni)) | |
85ce9d3e | 2350 | { |
2351 | notice(s_GameServ, u, "You're not playing!"); | |
2352 | return; | |
2353 | } | |
83cf716f | 2354 | else if (!is_fighting(ni)) |
85ce9d3e | 2355 | { |
2356 | notice(s_GameServ, u, "You're not in battle!"); | |
2357 | return; | |
2358 | } | |
2359 | else | |
2360 | { | |
2361 | if (!ni->stats->master) // This is not a master fight | |
2362 | fight = ni->stats->fight; // Monster Could be NULL | |
2363 | else // This IS a master fight | |
2364 | fight = ni->stats->master; // Master Could be NULL | |
2365 | ||
2366 | battle = ni->stats->battle; // Player Could be NULL | |
2367 | ||
2368 | // One has to be !NULL based on the previous else if | |
2369 | // We wouldn't be here if they were all NULL | |
2370 | } | |
2371 | ||
1af35752 | 2372 | if (!player_fight(ni)) |
85ce9d3e | 2373 | { |
2374 | // Player's Hit | |
2375 | hit = ((ni->stats->strength + webonus[ni->stats->weapon]) / 2) + | |
2376 | (rand() % ((ni->stats->strength + webonus[ni->stats->weapon]) / 2)); | |
2377 | ||
2378 | // Opponent's Hit | |
2379 | mhit = (fight->strength / 2) + | |
2380 | (rand() % (fight->strength / 2) - (ni->stats->defense + | |
2381 | arbonus[ni->stats->armor])); | |
2382 | } | |
2383 | else | |
2384 | { | |
2385 | // Opponent's Hit | |
2386 | mhit = (((battle->stats->strength + webonus[battle->stats->weapon]) / 2) + | |
2387 | (rand() % ((battle->stats->strength + webonus[battle->stats->weapon])) / 2) - | |
2388 | (ni->stats->defense + arbonus[ni->stats->armor])); | |
2389 | ||
2390 | // Player's Hit | |
2391 | hit = (((ni->stats->strength + webonus[ni->stats->weapon]) / 2) + | |
2392 | (rand() % ((ni->stats->strength + webonus[ni->stats->weapon])) / 2) - | |
2393 | (battle->stats->defense + arbonus[battle->stats->armor])); | |
2394 | } | |
2395 | ||
1af35752 | 2396 | if (!player_fight(ni)) |
85ce9d3e | 2397 | { |
2398 | if (hit > 0) | |
2399 | notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", fight->name, hit); | |
2400 | else | |
2401 | notice(s_GameServ, u, "You miss \1f%s\1f completely!", fight->name); | |
2402 | ||
2403 | if (hit >= fight->hp) | |
2404 | { | |
1af35752 | 2405 | if (master_fight(ni)) |
85ce9d3e | 2406 | notice(s_GameServ, u, "You have bested %s!", fight->name); |
2407 | else | |
2408 | notice(s_GameServ, u, "You have killed \ 2%s\ 2!", fight->name); | |
2409 | ||
2410 | notice(s_GameServ, u, "%s", fight->death); | |
2411 | notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%d\ 2 gold!", | |
2412 | fight->exp, fight->gold); | |
2413 | ||
2414 | // If your new experience (or gold) will be greater than 2 billion, | |
2415 | // then set your exp to 2bil. (2 billion max)... otherwise add them. | |
2416 | // This could be a problem with overflowing out of the sign bit. | |
2417 | // Unsigned long int maybe? Leave it for now. | |
2418 | ni->stats->exp = ( (ni->stats->exp + fight->exp) > 2000000000 ? 2000000000 : | |
2419 | ni->stats->exp + fight->exp); | |
ee38284f | 2420 | |
85ce9d3e | 2421 | ni->stats->gold = (ni->stats->gold + fight->gold > 2000000000 ? 2000000000 : |
2422 | ni->stats->gold + fight->gold); | |
c8ada07e | 2423 | |
85ce9d3e | 2424 | |
1af35752 | 2425 | if (master_fight(ni)) |
85ce9d3e | 2426 | { |
2427 | notice(s_GameServ, u, "You are now level %d!", ni->stats->level + 1); | |
2428 | notice(s_GameServ, u, "You gain %d Strength, and %d Defense points!", | |
2429 | strbonus[ni->stats->level - 1], defbonus[ni->stats->level - 1]); | |
2430 | ||
2431 | // Increase your level | |
2432 | ni->stats->level++; | |
2433 | ||
2434 | // Increase your maximum hit points | |
2435 | ni->stats->maxhp += hpbonus[ni->stats->level - 1]; | |
2436 | ||
2437 | // Heal the player by setting hp to their max | |
2438 | ni->stats->hp = ni->stats->maxhp; | |
2439 | ||
2440 | // Add to your strength | |
2441 | ni->stats->strength += strbonus[ni->stats->level - 1]; | |
2442 | ||
2443 | // Add to your defensive power | |
2444 | ni->stats->defense += defbonus[ni->stats->level - 1]; | |
2445 | ||
2446 | // Clear the pointer for your master | |
2447 | ni->stats->master = NULL; | |
2448 | } | |
ab4f4ec0 | 2449 | |
2450 | // They're dead so remove the pointer | |
2451 | delete ni->stats->fight; | |
2452 | ni->stats->fight = NULL; | |
2453 | ni->stats->master = NULL; | |
2454 | ||
85ce9d3e | 2455 | return; |
2456 | } | |
2457 | else | |
2458 | { | |
2459 | if (hit > 0) | |
2460 | fight->hp -= hit; | |
2461 | if (mhit > 0) | |
2462 | { | |
e282e9d2 | 2463 | notice(s_GameServ, u, "\1f%s\1f attacks with their \1f%s\1f for \ 2%d\ 2 damage!", |
85ce9d3e | 2464 | fight->name, fight->weapon, mhit); |
2465 | } | |
2466 | else if (mhit <= 0) | |
2467 | notice(s_GameServ, u, "%s completely misses you!", fight->name); | |
2468 | ||
2469 | if (mhit >= ni->stats->hp) | |
2470 | { | |
1af35752 | 2471 | if (!master_fight(ni)) |
85ce9d3e | 2472 | { |
2473 | notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", fight->name); | |
2474 | notice(s_GameServ, u, "You lose all gold on hand and lose 10 percent "\ | |
2475 | "of your experience!"); | |
2476 | ni->stats->gold = 0; | |
2477 | ni->stats->exp -= (long int)(ni->stats->exp * .10); | |
2478 | ni->stats->fight = NULL; | |
ee38284f | 2479 | clearAlive(ni->stats); |
85ce9d3e | 2480 | return; |
2481 | } | |
2482 | else | |
2483 | { | |
2484 | notice(s_GameServ, u, "%s has bested you! You will have to wait "\ | |
2485 | "until tomorrow to try again", ni->stats->master->name); | |
2486 | ni->stats->fight = NULL; | |
2487 | ni->stats->master = NULL; | |
2488 | return; | |
2489 | } | |
2490 | } | |
2491 | else | |
2492 | { | |
2493 | if (mhit > 0) | |
2494 | ni->stats->hp -= mhit; | |
2495 | display_monster(u); | |
2496 | return; | |
2497 | } | |
2498 | } | |
2499 | } | |
1af35752 | 2500 | else if (player_fight(ni)) |
85ce9d3e | 2501 | { |
2502 | /* Offline fighting not available yet | |
2503 | if (!(online = finduser(ni->stats->battle->nick)) || !nick_identified(online)) | |
2504 | { | |
2505 | if (hit > 0) | |
2506 | notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->nick, hit); | |
2507 | else | |
2508 | notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->nick); | |
2509 | if (hit >= battle->stats->hp) | |
2510 | { | |
2511 | notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->nick); | |
2512 | * notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!", | |
2513 | (long int)(battle->stats->exp * .10), battle->stats->gold); | |
2514 | if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10)) | |
2515 | { | |
2516 | ni->stats->exp += (long int)(battle->stats->exp * .10); | |
2517 | battle->stats->exp -= (long int)(battle->stats->exp * .10); | |
2518 | } | |
2519 | * else | |
2520 | { | |
2521 | battle->stats->exp -= (long int)(battle->stats->exp * .10); | |
2522 | ni->stats->exp = 2000000000; | |
2523 | } | |
2524 | ||
2525 | if (2000000000 - ni->stats->gold > battle->stats->gold) | |
2526 | { | |
2527 | * ni->stats->gold += battle->stats->gold; | |
2528 | battle->stats->gold = 0; | |
2529 | } | |
2530 | else | |
2531 | { | |
2532 | battle->stats->gold = 2000000000 - ni->stats->gold; | |
2533 | ni->stats->gold = 2000000000; | |
2534 | } | |
2535 | * ni->stats->battle->stats->alive = 0; | |
2536 | ni->stats->battle->battle = NULL; | |
2537 | ni->stats->battle = NULL; | |
2538 | return; | |
2539 | } | |
2540 | else | |
2541 | { | |
2542 | if (hit > 0) | |
2543 | * battle->stats->hp -= hit; | |
2544 | if (mhit > 0) | |
2545 | { | |
2546 | notice(s_GameServ, u, "\1f%s\1f hits you with their \1f%s\1f for \ 2%d\ 2 damage!", | |
2547 | battle->nick, weapons[battle->stats->weapon], mhit); | |
2548 | } | |
2549 | else if (mhit <= 0) | |
2550 | notice(s_GameServ, u, "%s completely misses you!", battle->nick); | |
2551 | * | |
2552 | if (mhit >= ni->stats->hp) | |
2553 | { | |
2554 | notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", battle->nick); | |
2555 | if (2000000000 - battle->stats->gold > ni->stats->gold) | |
2556 | { | |
2557 | notice(s_GameServ, u, "%s took all your gold!", battle->nick); | |
2558 | battle->stats->gold += ni->stats->gold; | |
2559 | * ni->stats->gold = 0; | |
2560 | } | |
2561 | else | |
2562 | { | |
2563 | notice(s_GameServ, u, "You're lucky, %s couldn't carry all your gold.", | |
2564 | battle->nick); | |
2565 | ni->stats->gold -= (2000000000 - battle->stats->gold); | |
2566 | notice(s_GameServ, u, "You were left dead with %d gold.", | |
2567 | * (long int)ni->stats->gold); | |
2568 | battle->stats->gold = 2000000000; | |
2569 | } | |
2570 | ni->stats->battle->battle = NULL; | |
2571 | ni->stats->battle = NULL; | |
2572 | ni->stats->alive = 0; | |
2573 | return; | |
2574 | } | |
2575 | * else | |
2576 | { | |
2577 | if (mhit > 0) | |
2578 | ni->stats->hp -= mhit; | |
2579 | display_players(u); | |
2580 | return; | |
2581 | } | |
2582 | } | |
2583 | } | |
2584 | * end offline fighting */ | |
2585 | ||
2586 | if (is_playing(battle->getNick())) | |
2587 | { | |
ee38284f | 2588 | if (!isYourTurn(ni->stats)) |
85ce9d3e | 2589 | { |
2590 | notice(s_GameServ, u, "Please wait until %s decides what to do!", | |
2591 | battle->getNick()); | |
2592 | return; | |
2593 | } | |
2594 | if (hit > 0) | |
2595 | { | |
2596 | notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->getNick(), hit); | |
2597 | ||
2598 | notice(s_GameServ, battle->getNick(), "%s has hit you with their %s for "\ | |
2599 | "\ 2%d\ 2 damage!", u, weapons[ni->stats->weapon], | |
2600 | hit); | |
ee38284f | 2601 | clearYourTurn(ni->stats); |
2602 | setYourTurn(battle->stats); | |
85ce9d3e | 2603 | display_players(battle->getNick()); |
2604 | } | |
2605 | else | |
2606 | { | |
2607 | notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->getNick()); | |
2608 | notice(s_GameServ, battle->getNick(), "%s misses you completely!", u); | |
ee38284f | 2609 | clearYourTurn(ni->stats); |
2610 | setYourTurn(battle->stats); | |
85ce9d3e | 2611 | display_players(battle->getNick()); |
2612 | } | |
2613 | if (hit >= battle->stats->hp) | |
2614 | { | |
2615 | notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->getNick()); | |
2616 | notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!", | |
2617 | (long int)(battle->stats->exp * .10), battle->stats->gold); | |
2618 | notice(s_GameServ, battle->getNick(), "You have been killed by \ 2%s\ 2!", u); | |
2619 | battle->stats->hp = 0; | |
ee38284f | 2620 | clearAlive(battle->stats); |
85ce9d3e | 2621 | |
2622 | if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10)) | |
2623 | { | |
2624 | ni->stats->exp += (long int)(battle->stats->exp * .10); | |
2625 | battle->stats->exp -= (long int)(battle->stats->exp * .10); | |
2626 | } | |
2627 | else | |
2628 | { | |
2629 | battle->stats->exp -= (long int)(battle->stats->exp * .10); | |
2630 | ni->stats->exp = 2000000000; | |
2631 | } | |
2632 | ||
2633 | if (2000000000 - ni->stats->gold > battle->stats->gold) | |
2634 | { | |
2635 | notice(s_GameServ, battle->getNick(), "You lose ten percent of experience and "\ | |
2636 | "all gold on hand!"); | |
2637 | ni->stats->gold += battle->stats->gold; | |
2638 | battle->stats->gold = 0; | |
2639 | } | |
2640 | else | |
2641 | { | |
2642 | battle->stats->gold = 2000000000 - ni->stats->gold; | |
2643 | notice(s_GameServ, battle->getNick(), "You lose ten percent of your experience!"); | |
2644 | ||
2645 | notice(s_GameServ, battle->getNick(), "However, %s could not carry all of your "\ | |
2646 | "gold.", u); | |
2647 | ||
2648 | notice(s_GameServ, battle->getNick(), "Luckily, you still have \ 2%ld\ 2 gold "\ | |
2649 | "left. All is not lost!", battle->stats->gold); | |
2650 | ||
2651 | ni->stats->gold = 2000000000; | |
2652 | } | |
2653 | battle->stats->battle = NULL; | |
2654 | ni->stats->battle = NULL; | |
2655 | return; | |
2656 | } | |
2657 | else | |
2658 | { | |
2659 | if (hit > 0) | |
2660 | battle->stats->hp -= hit; | |
ee38284f | 2661 | clearYourTurn(ni->stats); |
2662 | setYourTurn(battle->stats); | |
85ce9d3e | 2663 | notice(s_GameServ, u, "Please wait while %s decides what to do!", |
2664 | battle->getNick()); | |
2665 | ||
2666 | return; | |
2667 | } | |
2668 | } | |
2669 | } | |
2670 | } | |
2671 | void do_heal(char *u) | |
2672 | { | |
2673 | aClient *ni; | |
2674 | char *amount = strtok(NULL, " "); | |
2675 | int price, num; | |
2676 | ||
2677 | if (!amount) | |
2678 | { | |
2679 | notice(s_GameServ, u, "SYNTAX: /msg %S HEAL {ALL | #}"); | |
2680 | } | |
1af35752 | 2681 | else if (!(ni = find(u))) |
2682 | { | |
2683 | notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, "")); | |
2684 | return; | |
2685 | } | |
2686 | else if (!is_playing(ni)) | |
85ce9d3e | 2687 | { |
2688 | notice(s_GameServ, u, "You aren't playing!"); | |
1af35752 | 2689 | return; |
2690 | } | |
ee38284f | 2691 | else if (!isAlive(ni->stats)) |
1af35752 | 2692 | { |
2693 | notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing."); | |
2694 | return; | |
85ce9d3e | 2695 | } |
1af35752 | 2696 | else if (is_fighting(ni)) |
85ce9d3e | 2697 | { |
2698 | notice(s_GameServ, u, "You can't heal in battle!"); | |
2699 | } | |
2700 | else if (ni->stats->hp >= ni->stats->maxhp) | |
2701 | { | |
2702 | notice(s_GameServ, u, "You don't need healing!"); | |
2703 | } | |
2704 | else if (stricmp(amount, "ALL") == 0) | |
2705 | { | |
2706 | price = ni->stats->level * 3; | |
2707 | if (ni->stats->gold < (ni->stats->maxhp - ni->stats->hp) * price) | |
2708 | { | |
2709 | notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.", | |
2710 | (long int)ni->stats->gold/price, price); | |
2711 | ni->stats->hp += ni->stats->gold / price; | |
2712 | ni->stats->gold %= price; | |
2713 | } | |
2714 | else | |
2715 | { | |
2716 | notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\ | |
2717 | "per point.", price); | |
ad7dfaa0 | 2718 | notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!", |
2719 | (ni->stats->maxhp - ni->stats->hp), | |
2720 | (price * (ni->stats->maxhp - ni->stats->hp)) ); | |
85ce9d3e | 2721 | ni->stats->gold -= price * (ni->stats->maxhp - ni->stats->hp); |
2722 | ni->stats->hp = ni->stats->maxhp; | |
2723 | } | |
2724 | } | |
2725 | else if (isstringnum(amount)) | |
2726 | { | |
2727 | num = stringtoint(amount); | |
2728 | price = ni->stats->level * 3; | |
2729 | if (ni->stats->gold < price * num) | |
2730 | { | |
2731 | notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!", | |
2732 | (long int)ni->stats->gold/price); | |
2733 | } | |
2734 | else if (num <= ni->stats->maxhp - ni->stats->hp) | |
2735 | { | |
2736 | notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.", | |
2737 | num, price); | |
2738 | ni->stats->hp += num; | |
2739 | ni->stats->gold -= num * price; | |
2740 | } | |
2741 | else if (num > ni->stats->maxhp - ni->stats->hp) | |
2742 | { | |
2743 | notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\ | |
2744 | "per point.", price); | |
2745 | notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!", | |
2746 | (ni->stats->maxhp - ni->stats->hp)); | |
2747 | ni->stats->gold -= price * (ni->stats->maxhp - ni->stats->hp); | |
2748 | ni->stats->hp = ni->stats->maxhp; | |
2749 | } | |
2750 | } | |
2751 | else if (amount[0] == '-') | |
2752 | notice(s_GameServ, u, "You trying to cheat?"); | |
2753 | else | |
2754 | notice(s_GameServ, u, "SYNTAX: /msg %S HEAL {ALL | #}"); | |
2755 | } | |
2756 | ||
2757 | int isstringnum(char *num) | |
2758 | { | |
28f552b8 | 2759 | unsigned int x; |
85ce9d3e | 2760 | for (x = 0; x < strlen(num); x++) |
2761 | { | |
2762 | if ((int)num[x] < 48 || (int)num[x] > 57) | |
2763 | return 0; | |
2764 | } | |
2765 | return 1; | |
2766 | } | |
2767 | ||
2768 | long int stringtoint(char *number) | |
2769 | { | |
2770 | long int x, len = strlen(number), sum = 0; | |
2771 | if (len == 1) | |
2772 | return chartoint(number[0]); | |
2773 | sum += chartoint(number[len - 1]); | |
2774 | for (x = len - 2; x >= 0; x--) | |
85ce9d3e | 2775 | sum += chartoint(number[x]) * pow(10, abs(x - len + 1)); |
85ce9d3e | 2776 | return sum; |
2777 | } | |
2778 | ||
2779 | long int pow(int x, int y) | |
2780 | { | |
2781 | long int value = 0; | |
2782 | int count = 0; | |
2783 | value += x; | |
2784 | ||
2785 | if (x != 0 && y != 0) | |
2786 | { | |
2787 | for (count = 1; count <= y - 1; count++) | |
2788 | value *= x; | |
2789 | } | |
2790 | else | |
2791 | return 1; | |
2792 | return value; | |
2793 | } | |
2794 | ||
2795 | long int chartoint(char ch) | |
2796 | { | |
8c126acc | 2797 | if (int(ch) >= 48 && int(ch) <= 57) |
2798 | return int(ch) - 48; | |
2799 | else | |
2800 | return 0; | |
85ce9d3e | 2801 | } |
2802 | ||
2803 | int save_gs_dbase() | |
2804 | { | |
2805 | ListNode<aClient> *ptr = players.First(); | |
2806 | Player *it; | |
2807 | ofstream outfile; | |
2808 | ||
2809 | outfile.open(playerdata); | |
2810 | ||
2811 | if (!outfile) | |
2812 | { | |
9cc5ab57 | 2813 | cout << "Error opening " << playerdata << endl; |
85ce9d3e | 2814 | return 0; |
2815 | } | |
2816 | ||
2817 | while(ptr) | |
2818 | { | |
2819 | it = ptr->getData()->stats; | |
2820 | outfile << it->name << ' ' << it->level << ' ' << it->exp << ' ' << it->gold << ' ' << it->bank << ' ' | |
2821 | << it->hp << ' ' << it->maxhp << ' ' << it->strength << ' ' << it->defense << ' ' | |
ee38284f | 2822 | << it->armor << ' ' << it->weapon << ' ' |
e3c5fe46 | 2823 | << it->forest_fights << ' ' << it->player_fights << ' ' |
266608f6 | 2824 | << it->getFlags() << ' ' << it->password << ' ' << it->inventory.Healing() |
2825 | << ' ' << it->inventory.Strength() << ' ' << it->inventory.Defense() << endl; | |
85ce9d3e | 2826 | ptr = ptr->Next(); |
2827 | } | |
2828 | outfile.close(); | |
28f552b8 | 2829 | return 1; |
85ce9d3e | 2830 | } |
2831 | ||
2832 | int load_gs_dbase() | |
2833 | { | |
2834 | ifstream infile; | |
2835 | aClient *temp; | |
2836 | Player *p; | |
ee38284f | 2837 | char *tempname, *buf, *password; |
85ce9d3e | 2838 | buf = new char[1023]; |
2839 | ||
2840 | infile.open(playerdata); | |
2841 | ||
2842 | if (infile.fail()) | |
2843 | { | |
9cc5ab57 | 2844 | cout << "Error opening " << playerdata << endl; |
85ce9d3e | 2845 | return 0; |
2846 | } | |
2847 | ||
2848 | while (infile.getline(buf, 1024, '\n')) | |
2849 | { | |
2850 | temp = new aClient; | |
2851 | tempname = strtok(buf, " "); | |
2852 | temp->stats = new Player(tempname); | |
2853 | p = temp->stats; | |
2854 | ||
85ce9d3e | 2855 | p->level = stringtoint(strtok(NULL, " ")); |
2856 | p->exp = stringtoint(strtok(NULL, " ")); | |
2857 | p->gold = stringtoint(strtok(NULL, " ")); | |
2858 | p->bank = stringtoint(strtok(NULL, " ")); | |
2859 | p->hp = stringtoint(strtok(NULL, " ")); | |
2860 | p->maxhp = stringtoint(strtok(NULL, " ")); | |
2861 | p->strength = stringtoint(strtok(NULL, " ")); | |
2862 | p->defense = stringtoint(strtok(NULL, " ")); | |
2863 | p->armor = stringtoint(strtok(NULL, " ")); | |
2864 | p->weapon = stringtoint(strtok(NULL, " ")); | |
85ce9d3e | 2865 | p->forest_fights = stringtoint(strtok(NULL, " ")); |
2866 | p->player_fights = stringtoint(strtok(NULL, " ")); | |
1af35752 | 2867 | p->setFlags(stringtoint(strtok(NULL, " "))); |
ee38284f | 2868 | |
e3c5fe46 | 2869 | password = strtok(NULL, " "); |
2870 | strcpy(p->password, password); | |
73c71976 | 2871 | temp->setNick("!NULL!"); |
85ce9d3e | 2872 | |
ee38284f | 2873 | // Old player databases didn't have these three extra values |
2874 | // If they come up null, leave them to 0 as the default. | |
2875 | // On the next gameserv database save, it will save the values. | |
266608f6 | 2876 | tempname = strtok(NULL, " "); |
ee38284f | 2877 | cout << tempname << endl; |
2878 | p->inventory.setHealing(stringtoint(tempname)); | |
2879 | p->inventory.setStrength(stringtoint(strtok(NULL, " "))); | |
2880 | p->inventory.setDefense(stringtoint(strtok(NULL, " "))); | |
e3c5fe46 | 2881 | |
85ce9d3e | 2882 | players.insertAtBack(temp); |
2883 | delete temp; | |
2884 | } | |
1cf88153 | 2885 | delete [] buf; |
28f552b8 | 2886 | infile.close(); |
2887 | return 1; | |
85ce9d3e | 2888 | } |
2889 | ||
e3c5fe46 | 2890 | bool passcmp(char *encrypted, char *plaintext) |
2891 | { | |
2892 | char salt[3]; | |
cdc9a6db | 2893 | char *plaintext2, *plainToencrypt; |
2894 | bool same = false; | |
2895 | ||
2896 | plaintext2 = new char[strlen(encrypted) + strlen(plaintext)]; // Extra | |
2897 | strcpy(plaintext2, plaintext); | |
2898 | ||
e3c5fe46 | 2899 | salt[0] = encrypted[0]; |
2900 | salt[1] = encrypted[1]; | |
2901 | salt[3] = '\0'; | |
cdc9a6db | 2902 | |
2903 | plainToencrypt = crypt(plaintext2, salt); | |
2904 | ||
2905 | same = (strcmp((const char *)encrypted, plainToencrypt) == 0 ? true : false); | |
2906 | ||
2907 | delete []plaintext2; | |
2908 | ||
2909 | return same; | |
e3c5fe46 | 2910 | } |
2911 | ||
2912 | bool check_password(char *name, char *plaintext) | |
2913 | { | |
0a1518fa | 2914 | aClient *client; |
e3c5fe46 | 2915 | |
0a1518fa | 2916 | if (!(client = findplayer(name))) |
2917 | return false; | |
2918 | else | |
e3c5fe46 | 2919 | { |
0a1518fa | 2920 | return passcmp(client->stats->password, plaintext); |
e3c5fe46 | 2921 | } |
e3c5fe46 | 2922 | } |
1cf88153 | 2923 | |
ad7dfaa0 | 2924 | void do_store(char *u) |
2925 | { | |
2926 | char *cmd = strtok(NULL, " "); | |
2927 | char *item = strtok(NULL, " "); | |
2928 | char *num = strtok(NULL, " "); | |
2929 | char *space; | |
8c126acc | 2930 | int wep; |
2931 | aClient *user; | |
2932 | Player *p; | |
ad7dfaa0 | 2933 | |
1af35752 | 2934 | if (!cmd || !item) |
ad7dfaa0 | 2935 | { |
2936 | notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}"); | |
2937 | notice(s_GameServ, u, " \ 2STORE SELL {ARMOR | WEAPON}\ 2"); | |
2938 | notice(s_GameServ, u, " \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2"); | |
2939 | } | |
1af35752 | 2940 | else if (!(user = find(u)) || !is_playing(user)) |
2941 | notice(s_GameServ, u, "You must be playing to use the store!"); | |
ee38284f | 2942 | else if (!isAlive(user->stats)) |
1af35752 | 2943 | { |
2944 | notice(s_GameServ, u, "You are dead. Wait until tomorrow to purchase weapons and armor!"); | |
2945 | return; | |
2946 | } | |
ad7dfaa0 | 2947 | else if (stricmp(cmd, "LIST") == 0) |
2948 | { | |
2949 | if (stricmp(item, "WEAPONS") == 0) | |
2950 | { | |
2951 | notice(s_GameServ, u, "Welcome to Kain's Armory"); | |
2952 | notice(s_GameServ, u, "Here are the weapons we have available for the killing, sire:"); | |
2953 | for (int x = 1; x < WNA; x++) | |
2954 | { | |
2955 | space = spaces(strlen(weapons[x]), "."); | |
2956 | notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, weapons[x], space, prices[x - 1]); | |
2957 | free(space); | |
2958 | } | |
2959 | notice(s_GameServ, u, "To purchase a weapon, type /msg %S STORE BUY \ 2NUM\ 2."); | |
2960 | notice(s_GameServ, u, "Where num. is the weapon number from the menu above."); | |
2961 | ||
2962 | } | |
2963 | else if (stricmp(item, "ARMOR") == 0) | |
2964 | { | |
2965 | notice(s_GameServ, u, "Welcome to Kain's Armory"); | |
2966 | notice(s_GameServ, u, "I hope you enjoy the fine armor we have available for your protection:"); | |
2967 | for (int x = 1; x < WNA; x++) | |
2968 | { | |
2969 | space = spaces(strlen(armors[x]), "."); | |
2970 | notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, armors[x], space, prices[x - 1]); | |
2971 | free(space); | |
2972 | } | |
2973 | notice(s_GameServ, u, "To purchase armor, type /msg %S store buy armor num."); | |
2974 | notice(s_GameServ, u, "Where num. is the armor number from the menu above."); | |
2975 | ||
2976 | ||
2977 | } | |
2978 | } else if (stricmp(cmd, "BUY") == 0) { | |
8c126acc | 2979 | if (!num) |
2980 | { | |
2981 | notice(s_GameServ, u, "SYNTAX: \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2"); | |
2982 | return; | |
2983 | } | |
2984 | else if (!isstringnum(num)) | |
2985 | { | |
2986 | notice(s_GameServ, u, "You must specify a number between 1 and %d. Not %s!", WNA - 1, num); | |
2987 | return; | |
2988 | } | |
2989 | if (stricmp(item, "WEAPON") == 0) | |
2990 | { | |
2991 | wep = stringtoint(num); | |
2992 | if (wep >= WNA || wep < 1) | |
2993 | { | |
2994 | notice(s_GameServ, u, "The number %d is out of range. The number you provide must be between 1 and %d.", wep, WNA - 1); | |
2995 | return; | |
2996 | } | |
2997 | ||
2998 | p = user->stats; | |
2999 | ||
3000 | if (p->weapon != 0) | |
3001 | notice(s_GameServ, u, "You have to sell your %s first!", weapons[p->weapon]); | |
3002 | else if (p->gold < prices[wep - 1]) | |
3003 | notice(s_GameServ, u, "You don't have enough gold for %s!", weapons[wep]); | |
3004 | else | |
3005 | { | |
3006 | notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", weapons[wep]); | |
3007 | p->weapon = wep; | |
3008 | p->gold -= prices[wep - 1]; | |
3009 | } | |
3010 | } | |
3011 | else if (stricmp(item, "ARMOR") == 0) | |
3012 | { | |
3013 | wep = stringtoint(num); | |
3014 | if (wep >= WNA || wep < 1) | |
3015 | { | |
3016 | notice(s_GameServ, u, "The number %d is out of range. The number you provide must be between 1 and %d.", wep, WNA - 1); | |
3017 | return; | |
3018 | } | |
3019 | ||
3020 | p = user->stats; | |
3021 | ||
3022 | if (p->armor != 0) | |
3023 | notice(s_GameServ, u, "You have to sell your %s first!", armors[p->armor]); | |
3024 | else if (p->gold < prices[wep - 1]) | |
3025 | notice(s_GameServ, u, "You don't have enough gold for %s!", armors[wep]); | |
3026 | else | |
3027 | { | |
3028 | notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", armors[wep]); | |
3029 | p->armor = wep; | |
3030 | p->gold -= prices[wep - 1]; | |
3031 | } | |
3032 | } | |
3033 | } | |
3034 | else if (stricmp(cmd, "SELL" ) == 0) | |
3035 | { | |
3036 | p = user->stats; | |
3037 | ||
3038 | if (stricmp(item, "WEAPON") == 0) | |
3039 | { | |
3040 | if (p->weapon == 0) | |
3041 | { | |
3042 | notice(s_GameServ, u, "You want me to chop off your hands?"); | |
3043 | return; | |
3044 | } | |
3045 | else if (p->gold == 2000000000) | |
3046 | { | |
3047 | notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire."); | |
3048 | p->weapon = 0; | |
3049 | } | |
3050 | else if (2000000000 - p->gold < (prices[p->weapon - 1] / 2)) | |
3051 | { | |
3052 | notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry."); | |
3053 | notice(s_GameServ, u, "However, you have no weapon... can I interest you in the %s?", weapons[WNA - 1]); | |
3054 | p->gold = 2000000000; | |
3055 | p->weapon = 0; | |
3056 | } | |
3057 | else | |
3058 | { | |
3059 | notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no weapon!", (prices[p->weapon - 1] / 2)); | |
3060 | p->gold += (prices[p->weapon - 1] / 2); | |
3061 | p->weapon = 0; | |
3062 | } | |
3063 | } | |
3064 | else if (stricmp(item, "ARMOR") == 0) | |
3065 | { | |
3066 | p = user->stats; | |
3067 | ||
3068 | if (p->armor == 0) | |
3069 | { | |
3070 | notice(s_GameServ, u, "I don't think you can be any more naked..."); | |
3071 | return; | |
3072 | } | |
3073 | if (p->gold == 2000000000) | |
3074 | { | |
3075 | notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire."); | |
3076 | p->armor = 0; | |
3077 | } | |
3078 | else if (2000000000 - p->gold < (prices[p->armor - 1] / 2)) | |
3079 | { | |
3080 | notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry."); | |
3081 | notice(s_GameServ, u, "However, you have no armor... can I interest you in %s?", armors[WNA - 1]); | |
3082 | p->gold = 2000000000; | |
3083 | p->armor = 0; | |
3084 | } | |
3085 | else | |
3086 | { | |
3087 | notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no armor!", | |
3088 | (prices[p->armor - 1] / 2)); | |
3089 | ||
3090 | p->gold += (prices[p->armor - 1] / 2); | |
3091 | p->armor = 0; | |
3092 | } | |
3093 | } | |
3094 | else | |
3095 | { | |
3096 | notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}"); | |
3097 | notice(s_GameServ, u, " \ 2STORE SELL {ARMOR | WEAPON}\ 2"); | |
3098 | notice(s_GameServ, u, " \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2"); | |
3099 | } | |
3100 | } | |
3101 | } | |
9cda831c | 3102 | void do_inventory(char *u) |
3103 | { | |
3104 | aClient *user; | |
3105 | ||
3106 | if (!(user = find(u))) | |
3107 | { | |
3108 | notice(s_GameServ, u, "Fatal Error. Contact a %S admin!"); | |
3109 | return; | |
3110 | } | |
3111 | else if (!is_playing(user)) | |
3112 | { | |
3113 | notice(s_GameServ, u, "You must be playing to check your inventory!"); | |
3114 | return; | |
3115 | } | |
3116 | showinventory(user, user); | |
3117 | } | |
3118 | void showinventory(aClient *from, aClient *to) | |
3119 | { | |
3120 | char *nick = to->getNick(); | |
8c126acc | 3121 | |
9cda831c | 3122 | if (!to) |
3123 | to = from; | |
3124 | if (is_playing(from)) | |
3125 | { | |
3126 | Pouch *p = &from->stats->inventory; | |
3127 | notice(s_GameServ, nick, "Inventory for %s:", from->getNick()); | |
3128 | notice(s_GameServ, nick, " Healing Potions: %d", p->Healing()); | |
3129 | notice(s_GameServ, nick, "Strength Potions: %d", p->Strength()); | |
3130 | notice(s_GameServ, nick, " Defense Potions: %d", p->Defense()); | |
3131 | } | |
3132 | } | |
f5c25639 | 3133 | void do_tavern(char *u) |
3134 | { | |
3135 | char *cmd = strtok(NULL, " "); | |
3136 | long int price; | |
3137 | ||
3138 | aClient *user; | |
3139 | Player *p; | |
3140 | if (!(user = find(u))) | |
3141 | { | |
3142 | notice(s_GameServ, u, "Fatal Error. See a %S admin for help"); | |
3143 | return; | |
3144 | } | |
3145 | else if (!is_playing(user)) | |
3146 | { | |
3147 | notice(s_GameServ, u, "You must be playing to go to the Tavern"); | |
3148 | return; | |
3149 | } | |
9cda831c | 3150 | else if (is_fighting(user)) |
3151 | { | |
3152 | notice(s_GameServ, u, "You cannot go to the Tavern during a fight!"); | |
3153 | return; | |
3154 | } | |
f5c25639 | 3155 | p = user->stats; |
3156 | if (!cmd) | |
3157 | { | |
3158 | notice(s_GameServ, u, "Welcome to Boot Liquors Mystic Apothecary"); | |
3159 | notice(s_GameServ, u, "Your commands:"); | |
3160 | notice(s_GameServ, u, "/msg %S TAVERN {LIST | BUY} [NUMBER]"); | |
3161 | notice(s_GameServ, u, "What'll it be?"); | |
3162 | } | |
3163 | else if (stricmp(cmd, "LIST") == 0) | |
3164 | { | |
3165 | notice(s_GameServ, u, "Here is a list of what we have to offer:"); | |
3166 | notice(s_GameServ, u, "1. Healing Potions for %ld Gold", 1000 * p->level + (p->exp / 10)); | |
3167 | notice(s_GameServ, u, "2. Strength Potions for %ld Gold", 2050 * p->level + (p->exp / 10)); | |
3168 | notice(s_GameServ, u, "3. Defense Potions for %ld Gold", 2000 * p->level + (p->exp / 10)); | |
8c734eb9 | 3169 | notice(s_GameServ, u, "4. HP Potions for %ld Gold", 2300 * p->level + (p->exp / 10)); |
f5c25639 | 3170 | notice(s_GameServ, u, "To buy a potion, type /msg %S TAVERN BUY #"); |
3171 | notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1 buys a healing potion!"); | |
3172 | notice(s_GameServ, u, "By something will ya!"); | |
3173 | } | |
3174 | else if (stricmp(cmd, "BUY") == 0) | |
3175 | { | |
3176 | char *chnum = strtok(NULL, " "); | |
3177 | int num = stringtoint(chnum); | |
3178 | ||
3179 | if (!chnum) | |
3180 | { | |
3181 | notice(s_GameServ, u, "SYNTAX: TAVERN BUY #"); | |
3182 | notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1"); | |
3183 | return; | |
3184 | } | |
8c734eb9 | 3185 | if (num < 1 || num > 4) |
f5c25639 | 3186 | { |
3187 | notice(s_GameServ, u, "Invalid Choice!"); | |
3188 | notice(s_GameServ, u, "Here is a list of what we have to offer:"); | |
3189 | notice(s_GameServ, u, "1. Healing Potions for %ld Gold", 1000 * p->level + (p->exp / 10)); | |
3190 | notice(s_GameServ, u, "2. Strength Potions for %ld Gold", 2050 * p->level + (p->exp / 10)); | |
3191 | notice(s_GameServ, u, "3. Defense Potions for %ld Gold", 2000 * p->level + (p->exp / 10)); | |
8c734eb9 | 3192 | notice(s_GameServ, u, "4. HP Potions for %ld Gold", 2300 * p->level + (p->exp / 10)); |
f5c25639 | 3193 | notice(s_GameServ, u, "To buy a potion, type /msg %S TAVERN BUY #"); |
3194 | notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1 buys a healing potion!"); | |
ee38284f | 3195 | return; |
f5c25639 | 3196 | } |
3197 | switch(num) | |
3198 | { | |
3199 | case 1: | |
3200 | price = (1000 * p->level) + (p->exp / 10); | |
3201 | if (p->gold >= price) | |
3202 | { | |
3203 | notice(s_GameServ, u, "One healing potion coming right up!"); | |
3204 | p->inventory.incHealing(); | |
ee38284f | 3205 | p->gold -= price; |
f5c25639 | 3206 | } |
3207 | else | |
3208 | notice(s_GameServ, u, "You don't have enough gold!"); | |
3209 | break; | |
3210 | case 2: | |
3211 | price = (2050 * p->level) + (p->exp / 10); | |
3212 | if (p->gold >= price) | |
3213 | { | |
3214 | notice(s_GameServ, u, "One strength boost coming right up!"); | |
3215 | p->inventory.incStrength(); | |
ee38284f | 3216 | p->gold -= price; |
f5c25639 | 3217 | } |
3218 | else | |
3219 | notice(s_GameServ, u, "You don't have enough gold!"); | |
3220 | break; | |
3221 | case 3: | |
3222 | price = (2000 * p->level) + (p->exp / 10); | |
3223 | if (p->gold >= price) | |
3224 | { | |
3225 | notice(s_GameServ, u, "One defense boost coming right up!"); | |
3226 | p->inventory.incDefense(); | |
ee38284f | 3227 | p->gold -= price; |
f5c25639 | 3228 | } |
3229 | else | |
3230 | notice(s_GameServ, u, "You don't have enough gold!"); | |
3231 | break; | |
8c734eb9 | 3232 | case 4: |
3233 | price = (2300 * p->level) + (p->exp / 10); | |
3234 | if (p->gold >= price) | |
3235 | { | |
3236 | notice(s_GameServ, u, "One HP Potion coming right up!"); | |
3237 | p->inventory.incHP(); | |
3238 | p->gold -= price; | |
3239 | } | |
3240 | else | |
3241 | notice(s_GameServ, u, "You don't have enough gold!"); | |
3242 | break; | |
f5c25639 | 3243 | default: |
3244 | notice(s_GameServ, u, "Logical Error. See a %S admin for help!"); | |
3245 | break; | |
3246 | } | |
3247 | } | |
9cda831c | 3248 | else |
3249 | { | |
3250 | notice(s_GameServ, u, "Improper Syntax."); | |
3251 | notice(s_GameServ, u, "Type /msg %S HELP TAVERN for help"); | |
3252 | } | |
f5c25639 | 3253 | } |
3254 | ||
8c126acc | 3255 | void do_bank(char *u) |
3256 | { | |
3257 | char *cmd = strtok(NULL, " "); | |
3258 | char *amount = strtok(NULL, " "); | |
3259 | char *nick = strtok(NULL, " "); | |
3260 | ||
3261 | aClient *user; | |
3262 | Player *p; | |
3263 | ||
8c734eb9 | 3264 | if (!cmd || (!amount && stricmp(cmd, "BALANCE") != 0) || (stricmp(cmd, "TRANSFER") == 0 && !nick)) |
8c126acc | 3265 | { |
3266 | notice(s_GameServ, u, "BANK {WITHDRAW | DEPOSIT} {ALL | AMOUNT}"); | |
e282e9d2 | 3267 | notice (s_GameServ, u, "BANK BALANCE"); |
8c126acc | 3268 | return; |
3269 | } | |
1af35752 | 3270 | |
3271 | user = find(u); | |
3272 | if (!is_playing(user)) | |
8c126acc | 3273 | { |
3274 | notice(s_GameServ, u, "You must be playing to use the bank!"); | |
3275 | return; | |
ad7dfaa0 | 3276 | } |
ee38284f | 3277 | else if (!isAlive(user->stats)) |
1af35752 | 3278 | { |
3279 | notice(s_GameServ, u, "You are dead. We don't accept gold from dead folk! Wait 'til tomorrow!"); | |
3280 | return; | |
3281 | } | |
8c126acc | 3282 | else if (!isstringnum(amount) && stricmp(amount, "ALL") != 0) |
3283 | { | |
3284 | notice(s_GameServ, u, "I don't know how to convert alphabet letters into currency, sire!"); | |
3285 | return; | |
3286 | } | |
3287 | ||
3288 | p = user->stats; | |
3289 | ||
e282e9d2 | 3290 | if (stricmp(cmd, "BALANCE") == 0) |
3291 | { | |
3292 | showBankBalance(u); | |
3293 | } | |
3294 | else if (stricmp(cmd, "DEPOSIT") == 0) | |
8c126acc | 3295 | { |
3296 | if (p->bank == 2000000000) | |
3297 | { | |
3298 | notice(s_GameServ, u, "Your bank account is full, sire!"); | |
3299 | return; | |
3300 | } | |
3301 | else if (stricmp(amount, "ALL") == 0) | |
3302 | { | |
3303 | if (2000000000 - p->bank < p->gold) | |
3304 | { | |
3305 | notice(s_GameServ, u, "You don't have enough room for all of your gold."); | |
3306 | notice(s_GameServ, u, "Depositing %ld gold into your account", (2000000000 - p->bank)); | |
3307 | p->gold -= (2000000000 - p->bank); | |
3308 | p->bank = 2000000000; | |
e282e9d2 | 3309 | showBankBalance(u); |
8c126acc | 3310 | } |
3311 | else | |
3312 | { | |
3313 | notice(s_GameServ, u, "Depositing %ld gold into your account!", p->gold); | |
3314 | p->bank += p->gold; | |
3315 | p->gold = 0; | |
e282e9d2 | 3316 | showBankBalance(u); |
8c126acc | 3317 | } |
3318 | } | |
3319 | else if (stringtoint(amount) > p->gold) | |
3320 | { | |
3321 | notice(s_GameServ, u, "Sire, you only have %ld gold!", p->gold); | |
e282e9d2 | 3322 | showBankBalance(u); |
8c126acc | 3323 | return; |
3324 | } | |
3325 | else | |
3326 | { | |
3327 | if (2000000000 - p->bank < stringtoint(amount)) | |
3328 | { | |
3329 | notice(s_GameServ, u, "You don't have room in your account for that much."); | |
3330 | notice(s_GameServ, u, "Capping off your account with %ld gold!", (2000000000 - p->bank)); | |
3331 | p->gold -= (2000000000 - p->bank); | |
3332 | p->bank = 2000000000; | |
e282e9d2 | 3333 | showBankBalance(u); |
8c126acc | 3334 | } |
3335 | else | |
3336 | { | |
3337 | notice(s_GameServ, u, "Depositing %d gold into your account!", stringtoint(amount)); | |
3338 | p->bank += stringtoint(amount); | |
3339 | p->gold -= stringtoint(amount); | |
e282e9d2 | 3340 | showBankBalance(u); |
8c126acc | 3341 | } |
3342 | } | |
3343 | } | |
3344 | else if (stricmp(cmd, "WITHDRAW") == 0) | |
3345 | { | |
3346 | if (p->gold == 2000000000) | |
3347 | { | |
3348 | notice(s_GameServ, u, "You cannot carry any more gold, sire!"); | |
e282e9d2 | 3349 | showBankBalance(u); |
8c126acc | 3350 | return; |
3351 | } | |
3352 | else if (stricmp(amount, "ALL") == 0) | |
3353 | { | |
3354 | if (2000000000 - p->gold < p->bank) | |
3355 | { | |
3356 | notice(s_GameServ, u, "You don't have enough room to carry all that gold."); | |
3357 | notice(s_GameServ, u, "Withdrawing %ld gold from your account", (2000000000 - p->gold)); | |
3358 | p->bank -= (2000000000 - p->gold); | |
3359 | p->gold = 2000000000; | |
e282e9d2 | 3360 | showBankBalance(u); |
8c126acc | 3361 | } |
3362 | else | |
3363 | { | |
3364 | notice(s_GameServ, u, "Withdrawing %ld gold from your account!", p->bank); | |
3365 | p->gold += p->bank; | |
3366 | p->bank = 0; | |
e282e9d2 | 3367 | showBankBalance(u); |
8c126acc | 3368 | } |
3369 | } | |
3370 | else if (stringtoint(amount) > p->bank) | |
3371 | { | |
3372 | notice(s_GameServ, u, "Sire, you only have %ld gold in the bank!", p->bank); | |
e282e9d2 | 3373 | showBankBalance(u); |
8c126acc | 3374 | return; |
3375 | } | |
3376 | else | |
3377 | { | |
3378 | if (2000000000 - p->gold < stringtoint(amount)) | |
3379 | { | |
3380 | notice(s_GameServ, u, "You don't enough have room to carry that much gold!"); | |
3381 | notice(s_GameServ, u, "You fill your pockets with %ld gold!", | |
3382 | (2000000000 - p->gold)); | |
3383 | p->bank -= (2000000000 - p->gold); | |
3384 | p->gold = 2000000000; | |
e282e9d2 | 3385 | showBankBalance(u); |
8c126acc | 3386 | } |
3387 | else | |
3388 | { | |
3389 | notice(s_GameServ, u, "Withdrawing %d gold from your account!", stringtoint(amount)); | |
3390 | p->gold += stringtoint(amount); | |
3391 | p->bank -= stringtoint(amount); | |
e282e9d2 | 3392 | showBankBalance(u); |
8c126acc | 3393 | } |
3394 | } | |
3395 | } | |
3396 | ||
ad7dfaa0 | 3397 | } |
ab4f4ec0 | 3398 | |
3399 | void do_master(char *u) | |
3400 | { | |
3401 | aClient *user; | |
1af35752 | 3402 | user = find(u); |
3403 | ||
3404 | if (!user) | |
ab4f4ec0 | 3405 | { |
3406 | notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, "")); | |
3407 | return; | |
3408 | } | |
1af35752 | 3409 | else if (is_fighting(user)) |
ab4f4ec0 | 3410 | { |
3411 | notice(s_GameServ, u, "You're in the middle of a fight! Pay attention!"); | |
3412 | return; | |
3413 | } | |
ee38284f | 3414 | else if (!isAlive(user->stats)) |
1af35752 | 3415 | { |
3416 | notice(s_GameServ, u, "You're dead. Wait until tomorrow to see your master!"); | |
3417 | return; | |
3418 | } | |
3419 | else if (!is_playing(user)) | |
ab4f4ec0 | 3420 | { |
3421 | notice(s_GameServ, u, "You must be playing to see your master!"); | |
3422 | return; | |
3423 | } | |
c7340cbd | 3424 | |
3425 | char *cmd = strtok(NULL, " "); | |
3426 | Player *p = user->stats; | |
3427 | long int need = 0; | |
3428 | ||
1af35752 | 3429 | if (seenMaster(p)) |
3430 | { | |
3431 | notice(s_GameServ, u, "You have already seen your master today. Wait until tomorrow to try again"); | |
3432 | return; | |
3433 | } | |
3434 | ||
c7340cbd | 3435 | if (cmd != NULL) |
ab4f4ec0 | 3436 | { |
ab4f4ec0 | 3437 | switch(p->level) |
3438 | { | |
3439 | case 1: | |
3440 | need = 100; | |
3441 | break; | |
3442 | case 2: | |
3443 | need = 400; | |
3444 | break; | |
3445 | case 3: | |
3446 | need = 1000; | |
3447 | break; | |
3448 | case 4: | |
3449 | need = 4000; | |
3450 | break; | |
3451 | case 5: | |
3452 | need = 10000; | |
3453 | break; | |
3454 | case 6: | |
3455 | need = 40000; | |
3456 | break; | |
3457 | case 7: | |
3458 | need = 100000; | |
3459 | break; | |
3460 | case 8: | |
3461 | need = 400000; | |
3462 | break; | |
3463 | case 9: | |
3464 | need = 1000000; | |
3465 | break; | |
3466 | case 10: | |
3467 | need = 4000000; | |
3468 | break; | |
3469 | case 11: | |
3470 | need = 10000000; | |
3471 | break; | |
3472 | case 12: | |
3473 | need = p->exp + 1; | |
3474 | notice(s_GameServ, u, "You are at level 12. You are the master. What's left? The DRAGON!"); | |
3475 | break; | |
3476 | default: | |
3477 | need = p->exp + 1; // Unknown level... don't let them fight a fake master! | |
3478 | break; | |
c7340cbd | 3479 | } |
3480 | } | |
3481 | else | |
3482 | { | |
3483 | notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}"); | |
3484 | return; | |
3485 | } | |
3486 | ||
3487 | if (stricmp(cmd, "FIGHT") == 0) | |
3488 | { | |
ab4f4ec0 | 3489 | if (p->exp >= need) |
1af35752 | 3490 | { |
3491 | setMaster(p); | |
ab4f4ec0 | 3492 | see_master(u); |
1af35752 | 3493 | } |
ab4f4ec0 | 3494 | else |
3495 | notice(s_GameServ, u, "You are not worthy of fighting %s! You need %ld more experience.", masters[p->level - 1]->name, (need - p->exp)); | |
c7340cbd | 3496 | return; |
3497 | } | |
3498 | else if (stricmp(cmd, "QUESTION") == 0) | |
3499 | { | |
3500 | if (p->exp >= need) | |
3501 | notice(s_GameServ, u, "%s looks you up and down and decides you are more ready than you will ever be.", masters[p->level - 1]->name); | |
3502 | else | |
3503 | notice(s_GameServ, u, "You pathetic fool! You are no match for %s, %s!", masters[p->level - 1]->name, p->name); | |
3504 | ||
3505 | return; | |
3506 | } | |
3507 | else | |
3508 | { | |
3509 | notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}"); | |
ab4f4ec0 | 3510 | } |
3511 | } | |
3512 | ||
3513 | void see_master(char *u) | |
3514 | { | |
3515 | aClient *user; | |
1af35752 | 3516 | |
ab4f4ec0 | 3517 | if (!(user = find(u))) |
3518 | { | |
3519 | notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, "")); | |
3520 | return; | |
3521 | } | |
3522 | ||
1af35752 | 3523 | if (!is_fighting(user) && is_playing(user)) |
ab4f4ec0 | 3524 | { |
3525 | Player *p = user->stats; | |
3526 | p->master = new Monster(masters[p->level - 1]); | |
3527 | p->fight = p->master; | |
3528 | display_monster(u); // Since master is the same structure, use this function | |
3529 | } | |
3530 | } | |
e282e9d2 | 3531 | |
3532 | void showBankBalance(const char *u) | |
3533 | { | |
3534 | aClient *user; | |
3535 | Player *p; | |
1af35752 | 3536 | |
e282e9d2 | 3537 | if (!(user = find(u))) |
3538 | return; | |
3539 | ||
3540 | p = user->stats; | |
3541 | ||
3542 | if (!p) | |
3543 | return; | |
3544 | ||
3545 | notice(s_GameServ, u, "Account Balance: %ld Gold On hand: %ld", p->bank, p->gold); | |
3546 | ||
3547 | } | |
44ea29f7 | 3548 | |
3549 | void refreshall() | |
3550 | { | |
3551 | ListNode <aClient> *it; | |
3552 | Player *p; | |
3553 | ||
3554 | it = players.First(); | |
3555 | ||
3556 | while (it) | |
3557 | { | |
3558 | p = it->getData()->stats; | |
3559 | refresh(p); | |
3560 | it = it->Next(); | |
3561 | } | |
3562 | } | |
3563 | ||
3564 | void refresh(Player *p) | |
3565 | { | |
3566 | if (!p) | |
3567 | return; | |
3568 | ||
ee38284f | 3569 | if (p->hp < p->maxhp) |
3570 | p->hp = p->maxhp; | |
20d5d721 | 3571 | p->forest_fights = forestfights; |
44ea29f7 | 3572 | p->player_fights = 3; |
ee38284f | 3573 | setAlive(p); |
1af35752 | 3574 | clearMaster(p); |
44ea29f7 | 3575 | } |
c7340cbd | 3576 | |
3577 | void do_refresh(char *u) | |
3578 | { | |
3579 | char *nick = strtok(NULL, " "); | |
3580 | aClient *user; | |
3581 | ||
96f71fee | 3582 | if (!(user = find(u))) |
3583 | { | |
3584 | notice(s_GameServ, u, "Error: aClient not found. Contact a %S admin"); | |
3585 | cout << "Error: aClient not found: " << u << endl; | |
3586 | return; | |
3587 | } | |
3588 | else if (!isAdmin(user)) | |
3589 | { | |
3590 | notice(s_GameServ, u, "You must be a %S admin to use this command!"); | |
3591 | return; | |
3592 | } | |
c7340cbd | 3593 | if (!nick) |
3594 | { | |
96f71fee | 3595 | notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}"); |
c7340cbd | 3596 | return; |
3597 | } | |
3598 | else if (stricmp(nick, "ALL") == 0) | |
3599 | { | |
3600 | notice(s_GameServ, u, "Refreshing everyone's stats!"); | |
3601 | refreshall(); | |
3602 | } | |
3603 | else if ((user = find(nick))) | |
3604 | { | |
1af35752 | 3605 | if (is_playing(user)) |
c7340cbd | 3606 | { |
3607 | notice(s_GameServ, u, "Refreshing %s.", user->getNick()); | |
3608 | refresh(user->stats); | |
3609 | } | |
3610 | else | |
3611 | { | |
3612 | notice(s_GameServ, u, "%s is not playing.", user->getNick()); | |
3613 | } | |
3614 | } | |
3615 | else | |
3616 | { | |
3617 | notice(s_GameServ, u, "Nick %s not found.", nick); | |
3618 | return; | |
3619 | } | |
3620 | } | |
3621 | ||
ee38284f | 3622 | |
3623 | void resetall() | |
3624 | { | |
3625 | ListNode <aClient> *it; | |
3626 | Player *p; | |
3627 | ||
3628 | it = players.First(); | |
3629 | ||
3630 | while (it) | |
3631 | { | |
3632 | p = it->getData()->stats; | |
3633 | reset(p); | |
3634 | it = it->Next(); | |
3635 | } | |
3636 | } | |
3637 | ||
3638 | void reset(Player *p) | |
3639 | { | |
3640 | if (!p) | |
3641 | return; | |
3642 | ||
3643 | p->reset(); | |
3644 | } | |
3645 | ||
3646 | void do_reset(char *u) | |
3647 | { | |
3648 | char *nick = strtok(NULL, " "); | |
3649 | aClient *user; | |
3650 | ||
3651 | if (!(user = find(u))) | |
3652 | { | |
3653 | notice(s_GameServ, u, "Error: aClient not found. Contact a %S admin"); | |
3654 | cout << "Error: aClient not found: " << u << endl; | |
3655 | return; | |
3656 | } | |
3657 | else if (!isAdmin(user)) | |
3658 | { | |
3659 | notice(s_GameServ, u, "You must be a %S admin to use this command!"); | |
3660 | return; | |
3661 | } | |
3662 | if (!nick) | |
3663 | { | |
3664 | notice(s_GameServ, u, "SYNTAX: RESET {ALL | NICK}"); | |
3665 | return; | |
3666 | } | |
3667 | else if (stricmp(nick, "ALL") == 0) | |
3668 | { | |
3669 | notice(s_GameServ, u, "Resetting everyone's stats!"); | |
3670 | resetall(); | |
3671 | } | |
3672 | else if ((user = find(nick))) | |
3673 | { | |
3674 | if (is_playing(user)) | |
3675 | { | |
3676 | notice(s_GameServ, u, "Resetting %s.", user->getNick()); | |
3677 | reset(user->stats); | |
3678 | } | |
3679 | else | |
3680 | { | |
3681 | notice(s_GameServ, u, "%s is not playing.", user->getNick()); | |
3682 | } | |
3683 | } | |
3684 | else | |
3685 | { | |
3686 | notice(s_GameServ, u, "Nick %s not found.", nick); | |
3687 | return; | |
3688 | } | |
3689 | } | |
3690 | ||
c7340cbd | 3691 | void do_help(char *u) |
3692 | { | |
3693 | char *cmd = strtok(NULL, " "); | |
3694 | ||
c7340cbd | 3695 | display_help(u, cmd); |
3696 | } | |
3697 | ||
3698 | void display_help(char *u, char *file) | |
3699 | { | |
3700 | ifstream infile; | |
3701 | char *buf; | |
3702 | ||
3703 | if (!file) | |
3704 | { | |
3705 | infile.open("helpfiles/help"); | |
3706 | if (infile.fail()) | |
3707 | { | |
3708 | cout << "Error opening helpfiles/help" << endl; | |
3709 | notice(s_GameServ, u, "Error opening helpfiles/help"); | |
3710 | return; | |
3711 | } | |
3712 | buf = new char[1024]; | |
3713 | while(infile.getline(buf, 1024)) | |
3714 | { | |
3715 | // Written this way, it will process %S in the helpfiles | |
3716 | // Instead of notice(s_GameServ, u, "%s", buf); | |
3717 | notice(s_GameServ, u, buf); | |
3718 | } | |
3719 | ||
3720 | // Minor recursion | |
96f71fee | 3721 | aClient *user = find(u); |
3722 | if (user && isAdmin(user)) | |
3723 | display_help(u, "admin_commands"); | |
c7340cbd | 3724 | } |
3725 | else | |
3726 | { | |
3727 | char *filename; | |
f27a378f | 3728 | filename = new char[strlen(file) + 11]; |
3729 | strcpy(filename, "helpfiles/"); | |
3730 | strcat(filename, file); | |
4dde2ed9 | 3731 | |
f27a378f | 3732 | for (unsigned int x = 10; x < strlen(filename); x++) |
3733 | filename[x] = tolower(filename[x]); | |
4dde2ed9 | 3734 | |
c7340cbd | 3735 | infile.open(filename); |
3736 | delete [] filename; | |
3737 | if (infile.fail()) | |
3738 | { | |
3739 | notice(s_GameServ, u, "No help for \ 2%s\ 2", file); | |
3740 | return; | |
3741 | } | |
3742 | buf = new char[1024]; | |
3743 | while(infile.getline(buf, 1024)) | |
3744 | { | |
3745 | // Written this way, it will process %S in the helpfiles | |
3746 | // Instead of notice(s_GameServ, u, "%s", buf); | |
3747 | notice(s_GameServ, u, buf); | |
3748 | } | |
3749 | } | |
3750 | infile.close(); | |
3751 | delete [] buf; | |
3752 | } | |
96f71fee | 3753 | |
3754 | void do_admin(char *u) | |
3755 | { | |
3756 | aClient *user; | |
3757 | char *pass = strtok(NULL, " "); | |
3758 | ||
3759 | if (!(user = find(u))) | |
3760 | { | |
3761 | cout << "Error: aClient not found: " << u << endl; | |
3762 | notice(s_GameServ, u, "Error: aClient not found. Contact %S admin."); | |
3763 | return; | |
3764 | } | |
3765 | if (!pass) | |
3766 | { | |
3767 | notice(s_GameServ, u, "SYNTAX: \ 2ADMIN\ 2 \ 2\1fpassword\1f\ 2"); | |
3768 | return; | |
3769 | } | |
3770 | ||
1af35752 | 3771 | if (isAdmin(user)) |
3772 | { | |
3773 | notice(s_GameServ, u, "You already have administrator privledges."); | |
3774 | return; | |
3775 | } | |
3776 | else if (strcmp(pass, adminpass) == 0) | |
96f71fee | 3777 | { |
3778 | notice(s_GameServ, u, "Password accepted. You now have administrator privledges."); | |
3779 | setAdmin(user); | |
3780 | } | |
3781 | else | |
3782 | { | |
3783 | notice(s_GameServ, u, "Invalid password. Remember: case sensitive"); | |
3784 | return; | |
3785 | } | |
3786 | } | |
1af35752 | 3787 | |
4dde2ed9 | 3788 | bool load_monsters() |
3789 | { | |
3790 | ifstream infile; | |
3791 | infile.open("monsters.dat"); | |
3792 | ||
3793 | char *buf; | |
3794 | ||
3795 | if (infile.fail()) | |
3796 | { | |
3797 | cout << "Error opening monsters.dat" << endl; | |
3798 | return false; | |
3799 | } | |
3800 | init_monsters(); | |
3801 | buf = new char[2048]; | |
3802 | ||
3803 | for (int l = 0; l < REALLEVELS; l++) | |
3804 | { | |
3805 | for (int m = 0; m < MONSTERS;) | |
3806 | { | |
3807 | infile.getline(buf, 2048); | |
3808 | if (buf[0] == '\n' || buf[0] == '\0' || buf[0] == '#') | |
3809 | continue; | |
3810 | else | |
3811 | { | |
3812 | strcpy(monsters[l][m]->name, strtok(buf, "~")); | |
3813 | strcpy(monsters[l][m]->weapon, strtok(NULL, "~")); | |
3814 | monsters[l][m]->strength = stringtoint(strtok(NULL, "~")); | |
3815 | monsters[l][m]->gold = stringtoint(strtok(NULL, "~")); | |
3816 | monsters[l][m]->exp = stringtoint(strtok(NULL, "~")); | |
3817 | monsters[l][m]->maxhp = stringtoint(strtok(NULL, "~")); | |
ee38284f | 3818 | monsters[l][m]->hp = monsters[l][m]->maxhp; |
4dde2ed9 | 3819 | strcpy(monsters[l][m]->death, strtok(NULL, "")); |
3820 | m++; | |
3821 | } | |
3822 | } | |
3823 | } | |
3824 | delete [] buf; | |
3825 | return true; | |
3826 | } |