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