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