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