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