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