]> jfr.im git - irc/gameservirc.git/blame - gameserv/gameserv.cpp
Removed the configure.in file.
[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.
52bool has_started(char *u); // True if the given nickname in the clients list has started playing.
53bool is_fighting(char *u); // True if the given nick in the clients list is fighting anything.
54bool isnt_fighting(char *u); // True if the given nick isn't fighting. Same as !is_fighting(u).
55bool player_fight(char *u); // True if the player is fighting another player.
56bool master_fight(char *u); // True if the player is fighting their master.
57
58/********** GameServ Booleans **********/
85ce9d3e 59
c7340cbd 60void display_help(char *u, char *file = NULL);
85ce9d3e 61void display_monster(char *u);
62void display_players(char *u);
63long int chartoint(char ch);
64int isstringnum(char *num);
65long int pow (int x, int y);
66long int stringtoint(char *number);
67
68char *spaces(int len, char *seperator);
44ea29f7 69void refresh(Player *p);
85ce9d3e 70void refreshall();
71void reset(aClient *ni);
c8ada07e 72void init_masters();
85ce9d3e 73void init_monsters();
c8ada07e 74void delete_monsters();
75void delete_masters();
85ce9d3e 76
96f71fee 77void do_admin(char *u);
c7340cbd 78void do_attack(char *u);
79void do_bank(char *u);
80void do_fight(char *u);
81void do_heal(char *u);
82void do_help(char *u);
85ce9d3e 83void do_identify(char *u);
c7340cbd 84void do_refresh(char *u);
85void do_register(char *u);
86void do_list(char *u);
87void do_master(char *u);
85ce9d3e 88void do_play(char *u);
89void do_quitg(char *u);
90void do_reset(char *u);
85ce9d3e 91void do_run(char *u);
85ce9d3e 92void do_stats(char *u);
c7340cbd 93void do_store(char *u);
94void see_master(char *u);
85ce9d3e 95
96void showstats(const char *u, const char *nick);
e282e9d2 97void showBankBalance(const char *u);
85ce9d3e 98
99#define WNA 16
100char *weapons[WNA] = { "Fists", "Stick", "Dagger", "Quarterstaff", "Short Sword",
101 "Long Sword", "Silver Spear", "Battle Axe", "The Ragnarok",
102 "Chain Saw", "Poison Sword", "Flame Sword", "Earth Hammer",
103 "Light Saber", "Masamune", "Mystical Sword"};
104
105char *armors[WNA] = { "Nothing", "Clothes", "Leather Vest", "Chain Mail", "Plate Armor",
106 "Full Body Armor", "Magic Mail", "Graphite Suit", "Steel Suit",
107 "Force Field", "Armor of Light", "Mythril Vest", "DemiGod Armor",
108 "Hades' Cloak", "Dragon Scales", "Mystical Armor"};
109
110int prices[WNA - 1] = {200, 1000, 3000, 10000, 30000, 100000, 150000, 200000, 400000,
111 1000000, 4000000, 10000000, 40000000, 100000000, 400000000};
112int webonus[WNA] = {0, 10, 15, 25, 35, 45, 65, 85, 125, 185, 255, 355, 505, 805, 1205, 1805};
113int arbonus[WNA] = {0, 1, 3, 10, 15, 25, 35, 50, 75, 100, 150, 225, 300, 400, 600, 1000};
114
115int hpbonus[11] = {10, 15, 20, 30, 50, 75, 125, 185, 250, 350, 550};
116int strbonus[11] = {5, 7, 10, 12, 20, 35, 50, 75, 110, 150, 200};
117int defbonus[11] = {2, 3, 5, 10, 15, 22, 35, 60, 80, 120, 150};
118
85ce9d3e 119void gameserv(char *source, char *buf)
120{
28f552b8 121 char *cmd;
85ce9d3e 122 cmd = strtok(buf, " ");
123
124 source++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text
125 cmd++; // Get rid of that : at the beginning of the :text (command)
126
127 cout << "Source: " << source << "\ncmd: " << cmd << endl;
0eeaca4c 128 long int mn = midnight() - 12 * 3600; // 12 noon ;)
44ea29f7 129
130 if (mn > timestamp)
131 {
132 refreshall();
133 timestamp = mn;
134 save_timestamp();
135 }
136
0eeaca4c 137 if (strnicmp(cmd, "\1PING", 6) == 0)
85ce9d3e 138 {
44ea29f7 139 char *ts;
140 ts = strtok(NULL, "\1");
141 notice(s_GameServ, source, "\1PING %s\1", ts);
0eeaca4c 142 } else if (stricmp(cmd, "\1VERSION\1") == 0) {
143 notice(s_GameServ, source, "\1VERSION GameServ v1.0.1 +devel\1");
85ce9d3e 144 } else if (stricmp(cmd, "SEARCH") == 0) {
145 cmd = strtok(NULL, " ");
146
147 if (!cmd)
148 notice(s_GameServ, source, "SYNTAX: /msg %S SEARCH FOREST");
149 else
150 do_forest(source);
151 } else if (stricmp(cmd, "FIGHT") == 0) {
152 do_fight(source);
153 } else if (stricmp(cmd, "ATTACK") == 0) {
154 do_attack(source);
c8ada07e 155 } else if (stricmp(cmd, "RUN") == 0) {
156 do_run(source);
85ce9d3e 157 } else if (stricmp(cmd, "HEAL") == 0) {
158 do_heal(source);
ab4f4ec0 159 } else if (stricmp(cmd, "MASTER") == 0) {
160 do_master(source);
ad7dfaa0 161 } else if (stricmp(cmd, "STORE") == 0) {
162 do_store(source);
8c126acc 163 } else if (stricmp(cmd, "BANK") == 0) {
164 do_bank(source);
96f71fee 165 } else if (stricmp(cmd, "ADMIN") == 0) {
166 do_admin(source);
c7340cbd 167 } else if (stricmp(cmd, "REFRESH") == 0) {
96f71fee 168 do_refresh(source);
85ce9d3e 169 } else if (stricmp(cmd, "PRINT") == 0) {
170 cout << "Printing Clients List: " << endl;
171 clients.print();
0a1518fa 172 cout << "\nPrinting Player List: " << endl;
85ce9d3e 173 players.print();
174 } else if (stricmp(cmd, "LIST") == 0) {
175 do_list(source);
176 } else if (stricmp(cmd, "REGISTER") == 0) {
177 do_register(source);
178 } else if (stricmp(cmd, "IDENTIFY") == 0) {
179 do_identify(source);
180 } else if (stricmp(cmd, "HELP") == 0) {
c7340cbd 181 do_help(source);
85ce9d3e 182 } else if (stricmp(cmd, "STATS") == 0) {
183 do_stats(source);
184 } else if (stricmp(cmd, "SHUTDOWN") == 0) {
96f71fee 185 aClient *user;
186
187 if (!(user = find(source)))
45a84400 188 {
96f71fee 189 notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin");
190 cout << "Error: aClient not found: " << source << endl;
191 }
192 else if (!isAdmin(user))
193 {
194 notice(s_GameServ, source, "You must be a %S admin to use this command!");
45a84400 195 }
196 else
197 {
96f71fee 198 save_gs_dbase();
199 raw("SQUIT %s :leaving", servername);
45a84400 200 }
85ce9d3e 201 } else if (stricmp(cmd, "SAVE") == 0) {
96f71fee 202 aClient *user;
203
204 if (!(user = find(source)))
205 {
206 notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin");
207 cout << "Error: aClient not found: " << source << endl;
208 }
209 else if (!isAdmin(user))
210 {
211 notice(s_GameServ, source, "You must be a %S admin to use this command!");
212 }
213 else
45a84400 214 {
215 save_gs_dbase();
216 }
85ce9d3e 217 } else if (stricmp(cmd, "LOAD") == 0) {
96f71fee 218 aClient *user;
219
220 if (!(user = find(source)))
221 {
222 notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin");
223 cout << "Error: aClient not found: " << source << endl;
224 }
225 else if (!isAdmin(user))
226 {
227 notice(s_GameServ, source, "You must be a %S admin to use this command!");
228 }
229 else
45a84400 230 {
231 load_gs_dbase();
232 }
85ce9d3e 233 } else if (stricmp(cmd, "RAW") == 0) {
96f71fee 234 aClient *user;
235
236 if (!(user = find(source)))
237 {
238 notice(s_GameServ, source, "Error: aClient not found. Contact a %S admin");
239 cout << "Error: aClient not found: " << source << endl;
240 }
241 else if (!isAdmin(user))
242 {
243 notice(s_GameServ, source, "You must be a %S admin to use this command!");
244 }
245 else
45a84400 246 {
247 char *rest = strtok(NULL, "");
248 raw("%s", rest);
249 }
c7340cbd 250 }
85ce9d3e 251
c7340cbd 252 source--; // Bring the ':' back so we don't leak memory
85ce9d3e 253 cmd--; // Same thing :)
254}
255
256int stricmp(const char *s1, const char *s2)
257{
258 register int c;
259
260 while ((c = tolower(*s1)) == tolower(*s2)) {
261 if (c == 0)
262 return 0;
263 s1++;
264 s2++;
265 }
266 if (c < tolower(*s2))
267 return -1;
268 return 1;
269}
270
271void showstats(const char *u, const char *nick)
272{
273 aClient *ni, *sender = find(u);
274 char *buf;
275 buf = new char[50];
276 char *space;
277
278
279 cout << "\n\nu: " << u << "\nnick: " << nick << endl;
280 if (!(ni = findbynick(nick)))
281 {
282 notice(s_GameServ, u, "%s not found", nick);
283 }
284 else if (ni->stats)
285 {
286
287 notice(s_GameServ, sender->getNick(), "Stats for %s:", ni->stats->name);
288
289 sprintf(buf, "Experience: %ld", ni->stats->exp);
290 space = spaces(strlen(buf), " ");
291 notice(s_GameServ, sender->getNick(), "%s%sLevel: %d", buf, space,
292 ni->stats->level);
1cf88153 293 delete [] space;
85ce9d3e 294
295 sprintf(buf, "Gold: %ld", ni->stats->gold);
296 space = spaces(strlen(buf), " ");
297 notice(s_GameServ, sender->getNick(), "%s%sGold in Bank: %ld", buf, space, ni->stats->bank);
1cf88153 298 delete [] space;
85ce9d3e 299
c7340cbd 300 notice(s_GameServ, sender->getNick(), "Hit Points: %d of %d", ni->stats->hp,
85ce9d3e 301 ni->stats->maxhp);
302
303 sprintf(buf, "Strength: %d", ni->stats->strength + webonus[ni->stats->weapon]);
304 space = spaces(strlen(buf), " ");
305 notice(s_GameServ, sender->getNick(), "%s%sDefense: %d",
306 buf, space, ni->stats->defense + arbonus[ni->stats->armor]);
1cf88153 307 delete [] space;
85ce9d3e 308
309 sprintf(buf, "Armor: %s", armors[ni->stats->armor]);
310 space = spaces(strlen(buf), " ");
311 notice(s_GameServ, sender->getNick(), "%s%sWeapon: %s", buf, space,
312 weapons[ni->stats->weapon]);
1cf88153 313 delete [] space;
85ce9d3e 314
315 sprintf(buf, "Forest Fights: %d", ni->stats->forest_fights);
316 space = spaces(strlen(buf), " ");
317 notice(s_GameServ, sender->getNick(), "%s%sPlayer Fights: %d", buf, space, ni->stats->player_fights);
1cf88153 318 delete [] space;
85ce9d3e 319 }
1cf88153 320 delete [] buf;
85ce9d3e 321
322}
323
324char *spaces(int len, char *seperator)
325{
326 char *final;
327 final = new char[40];
328 int y;
329 strcpy(final, seperator);
330 for (y = 0; y < 40 - len; y++)
331 strcat(final, seperator);
332 return final;
333}
334
335void raw(const char *fmt, ...)
336{
337 va_list args;
338 char *input;
339 const char *t = fmt;
340 input = new char[1024];
341 va_start(args, fmt);
342 memset(input, 0, sizeof(input)); // Initialize to NULL
343 for (; *t; t++)
344 {
345 if (*t == '%')
346 {
347 switch(*++t) {
348 case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break;
349 case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break;
350 case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
351 case 'l':
352 if (*++t == 'd')
353 sprintf(input, "%s%ld", input, va_arg(args, long int)); break;
354 }
355 }
356 else
357 {
358 sprintf(input, "%s%c", input, *t);
359 }
360
361 }
362 sprintf(input, "%s%s", input, "\r\n");
363 cout << "input: " << input << flush;
364 sock_puts(sock, input);
1cf88153 365 delete [] input;
85ce9d3e 366 va_end(args);
367}
368/* Send a NOTICE from the given source to the given nick. */
369
370void notice(const char *source, const char *dest, const char *fmt, ...)
371{
c7340cbd 372 if (fmt[0] == '\0')
373 return;
374
85ce9d3e 375 va_list args;
376 char *input;
377 const char *t = fmt;
378 input = new char[1024];
379 va_start(args, fmt);
380 if (dest[0] == ':')
381 {
382 dest++;
383 sprintf(input, ":%s NOTICE %s :", source, dest);
384 dest--;
385 }
386 else
387 sprintf(input, ":%s NOTICE %s :", source, dest);
388
389 for (; *t; t++)
390 {
391 if (*t == '%')
392 {
393 switch(*++t) {
394 case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break;
395 case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break;
396 case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
397 case 'l':
398 if (*++t == 'd')
399 sprintf(input, "%s%ld", input, va_arg(args, long int)); break;
400 }
401 }
402 else
403 {
404 sprintf(input, "%s%c", input, *t);
405 }
406
407 }
408 sprintf(input, "%s%s", input, "\r\n");
409 cout << "input: " << input << flush;
410 sock_puts(sock, input);
1cf88153 411 delete [] input;
85ce9d3e 412va_end(args);
413}
414
415
416int strnicmp(const char *s1, const char *s2, size_t len)
417{
418 register int c;
419
420 if (!len)
421 return 0;
422 while ((c = tolower(*s1)) == tolower(*s2) && len > 0) {
423 if (c == 0 || --len == 0)
424 return 0;
425 s1++;
426 s2++;
427 }
428 if (c < tolower(*s2))
429 return -1;
430 return 1;
431}
432
653c4f62 433#ifndef HAVE_STRTOK
85ce9d3e 434char *strtok(char *str, const char *delim)
435{
436 static char *current = NULL;
437 char *ret;
438
439 if (str)
440 current = str;
441 if (!current)
442 return NULL;
443 current += strspn(current, delim);
444 ret = *current ? current : NULL;
445 current += strcspn(current, delim);
446 if (!*current)
447 current = NULL;
448 else
449 *current++ = 0;
450 return ret;
451}
653c4f62 452#endif
85ce9d3e 453
454void do_list(char *u)
455{
456 ListNode<aClient> *temp;
457 temp = players.First();
458 if (!players.isEmpty())
459 {
460 notice(s_GameServ, u, "People Playing:");
461 while(temp)
462 {
463 notice(s_GameServ, u, "IRC: %s Game: %s", temp->getData()->getNick(), temp->getData()->stats->name);
464 temp = temp->Next();
465 }
466 notice(s_GameServ, u, "End of List");
467 }
468 else
469 notice(s_GameServ, u, "No one is playing");
470}
471void do_register(char *u)
472{
473 char *password;
474 aClient *user;
475 password = strtok(NULL, " ");
476
e3c5fe46 477 static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
478 static char salt[3];
479
480 salt[0] = saltChars[rand() % strlen(saltChars)];
481 salt[1] = saltChars[rand() % strlen(saltChars)];
482 salt[3] = '\0';
483
85ce9d3e 484 if (!password)
485 {
486 notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER PASSWORD");
487 }
28f552b8 488 else if ((user = find(u)))
85ce9d3e 489 {
490 if (!user->stats)
491 {
492 user->stats = new Player(user);
493 user->stats->started = 1;
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 }
2189 }
2190 else
2191 {
2192 if (mhit > 0)
2193 ni->stats->hp -= mhit;
2194 display_monster(u);
2195 return;
2196 }
2197 }
2198 }
2199 else if (player_fight(u))
2200 {
2201/* Offline fighting not available yet
2202 if (!(online = finduser(ni->stats->battle->nick)) || !nick_identified(online))
2203 {
2204 if (hit > 0)
2205 notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->nick, hit);
2206 else
2207 notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->nick);
2208 if (hit >= battle->stats->hp)
2209 {
2210 notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->nick);
2211* notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!",
2212 (long int)(battle->stats->exp * .10), battle->stats->gold);
2213 if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
2214 {
2215 ni->stats->exp += (long int)(battle->stats->exp * .10);
2216 battle->stats->exp -= (long int)(battle->stats->exp * .10);
2217 }
2218* else
2219 {
2220 battle->stats->exp -= (long int)(battle->stats->exp * .10);
2221 ni->stats->exp = 2000000000;
2222 }
2223
2224 if (2000000000 - ni->stats->gold > battle->stats->gold)
2225 {
2226* ni->stats->gold += battle->stats->gold;
2227 battle->stats->gold = 0;
2228 }
2229 else
2230 {
2231 battle->stats->gold = 2000000000 - ni->stats->gold;
2232 ni->stats->gold = 2000000000;
2233 }
2234* ni->stats->battle->stats->alive = 0;
2235 ni->stats->battle->battle = NULL;
2236 ni->stats->battle = NULL;
2237 return;
2238 }
2239 else
2240 {
2241 if (hit > 0)
2242* battle->stats->hp -= hit;
2243 if (mhit > 0)
2244 {
2245 notice(s_GameServ, u, "\1f%s\1f hits you with their \1f%s\1f for \ 2%d\ 2 damage!",
2246 battle->nick, weapons[battle->stats->weapon], mhit);
2247 }
2248 else if (mhit <= 0)
2249 notice(s_GameServ, u, "%s completely misses you!", battle->nick);
2250*
2251 if (mhit >= ni->stats->hp)
2252 {
2253 notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", battle->nick);
2254 if (2000000000 - battle->stats->gold > ni->stats->gold)
2255 {
2256 notice(s_GameServ, u, "%s took all your gold!", battle->nick);
2257 battle->stats->gold += ni->stats->gold;
2258* ni->stats->gold = 0;
2259 }
2260 else
2261 {
2262 notice(s_GameServ, u, "You're lucky, %s couldn't carry all your gold.",
2263 battle->nick);
2264 ni->stats->gold -= (2000000000 - battle->stats->gold);
2265 notice(s_GameServ, u, "You were left dead with %d gold.",
2266* (long int)ni->stats->gold);
2267 battle->stats->gold = 2000000000;
2268 }
2269 ni->stats->battle->battle = NULL;
2270 ni->stats->battle = NULL;
2271 ni->stats->alive = 0;
2272 return;
2273 }
2274* else
2275 {
2276 if (mhit > 0)
2277 ni->stats->hp -= mhit;
2278 display_players(u);
2279 return;
2280 }
2281 }
2282 }
2283* end offline fighting */
2284
2285 if (is_playing(battle->getNick()))
2286 {
2287 if (ni->stats->yourturn == 0)
2288 {
2289 notice(s_GameServ, u, "Please wait until %s decides what to do!",
2290 battle->getNick());
2291 return;
2292 }
2293 if (hit > 0)
2294 {
2295 notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->getNick(), hit);
2296
2297 notice(s_GameServ, battle->getNick(), "%s has hit you with their %s for "\
2298 "\ 2%d\ 2 damage!", u, weapons[ni->stats->weapon],
2299 hit);
2300 ni->stats->yourturn = 0;
2301 battle->stats->yourturn = 1;
2302 display_players(battle->getNick());
2303 }
2304 else
2305 {
2306 notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->getNick());
2307 notice(s_GameServ, battle->getNick(), "%s misses you completely!", u);
2308 ni->stats->yourturn = 0;
2309 battle->stats->yourturn = 1;
2310 display_players(battle->getNick());
2311 }
2312 if (hit >= battle->stats->hp)
2313 {
2314 notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->getNick());
2315 notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!",
2316 (long int)(battle->stats->exp * .10), battle->stats->gold);
2317 notice(s_GameServ, battle->getNick(), "You have been killed by \ 2%s\ 2!", u);
2318 battle->stats->hp = 0;
2319 battle->stats->alive = 0;
2320
2321 if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
2322 {
2323 ni->stats->exp += (long int)(battle->stats->exp * .10);
2324 battle->stats->exp -= (long int)(battle->stats->exp * .10);
2325 }
2326 else
2327 {
2328 battle->stats->exp -= (long int)(battle->stats->exp * .10);
2329 ni->stats->exp = 2000000000;
2330 }
2331
2332 if (2000000000 - ni->stats->gold > battle->stats->gold)
2333 {
2334 notice(s_GameServ, battle->getNick(), "You lose ten percent of experience and "\
2335 "all gold on hand!");
2336 ni->stats->gold += battle->stats->gold;
2337 battle->stats->gold = 0;
2338 }
2339 else
2340 {
2341 battle->stats->gold = 2000000000 - ni->stats->gold;
2342 notice(s_GameServ, battle->getNick(), "You lose ten percent of your experience!");
2343
2344 notice(s_GameServ, battle->getNick(), "However, %s could not carry all of your "\
2345 "gold.", u);
2346
2347 notice(s_GameServ, battle->getNick(), "Luckily, you still have \ 2%ld\ 2 gold "\
2348 "left. All is not lost!", battle->stats->gold);
2349
2350 ni->stats->gold = 2000000000;
2351 }
2352 battle->stats->battle = NULL;
2353 ni->stats->battle = NULL;
2354 return;
2355 }
2356 else
2357 {
2358 if (hit > 0)
2359 battle->stats->hp -= hit;
2360 //display_players(battle->getNick());
2361 ni->stats->yourturn = 0;
2362 battle->stats->yourturn = 1;
2363 notice(s_GameServ, u, "Please wait while %s decides what to do!",
2364 battle->getNick());
2365
2366 return;
2367 }
2368 }
2369 }
2370}
2371void do_heal(char *u)
2372{
2373 aClient *ni;
2374 char *amount = strtok(NULL, " ");
2375 int price, num;
2376
2377 if (!amount)
2378 {
2379 notice(s_GameServ, u, "SYNTAX: /msg %S HEAL {ALL | #}");
2380 }
2381 else if (!(ni = find(u)) || !ni->stats)
2382 {
2383 notice(s_GameServ, u, "You aren't playing!");
2384 }
2385 else if (is_fighting(u))
2386 {
2387 notice(s_GameServ, u, "You can't heal in battle!");
2388 }
2389 else if (ni->stats->hp >= ni->stats->maxhp)
2390 {
2391 notice(s_GameServ, u, "You don't need healing!");
2392 }
2393 else if (stricmp(amount, "ALL") == 0)
2394 {
2395 price = ni->stats->level * 3;
2396 if (ni->stats->gold < (ni->stats->maxhp - ni->stats->hp) * price)
2397 {
2398 notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
2399 (long int)ni->stats->gold/price, price);
2400 ni->stats->hp += ni->stats->gold / price;
2401 ni->stats->gold %= price;
2402 }
2403 else
2404 {
2405 notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
2406 "per point.", price);
ad7dfaa0 2407 notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
2408 (ni->stats->maxhp - ni->stats->hp),
2409 (price * (ni->stats->maxhp - ni->stats->hp)) );
85ce9d3e 2410 ni->stats->gold -= price * (ni->stats->maxhp - ni->stats->hp);
2411 ni->stats->hp = ni->stats->maxhp;
2412 }
2413 }
2414 else if (isstringnum(amount))
2415 {
2416 num = stringtoint(amount);
2417 price = ni->stats->level * 3;
2418 if (ni->stats->gold < price * num)
2419 {
2420 notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!",
2421 (long int)ni->stats->gold/price);
2422 }
2423 else if (num <= ni->stats->maxhp - ni->stats->hp)
2424 {
2425 notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.",
2426 num, price);
2427 ni->stats->hp += num;
2428 ni->stats->gold -= num * price;
2429 }
2430 else if (num > ni->stats->maxhp - ni->stats->hp)
2431 {
2432 notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
2433 "per point.", price);
2434 notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!",
2435 (ni->stats->maxhp - ni->stats->hp));
2436 ni->stats->gold -= price * (ni->stats->maxhp - ni->stats->hp);
2437 ni->stats->hp = ni->stats->maxhp;
2438 }
2439 }
2440 else if (amount[0] == '-')
2441 notice(s_GameServ, u, "You trying to cheat?");
2442 else
2443 notice(s_GameServ, u, "SYNTAX: /msg %S HEAL {ALL | #}");
2444}
2445
2446int isstringnum(char *num)
2447{
28f552b8 2448 unsigned int x;
85ce9d3e 2449 for (x = 0; x < strlen(num); x++)
2450 {
2451 if ((int)num[x] < 48 || (int)num[x] > 57)
2452 return 0;
2453 }
2454return 1;
2455}
2456
2457long int stringtoint(char *number)
2458{
2459 long int x, len = strlen(number), sum = 0;
2460 if (len == 1)
2461 return chartoint(number[0]);
2462 sum += chartoint(number[len - 1]);
2463 for (x = len - 2; x >= 0; x--)
85ce9d3e 2464 sum += chartoint(number[x]) * pow(10, abs(x - len + 1));
85ce9d3e 2465 return sum;
2466}
2467
2468long int pow(int x, int y)
2469{
2470 long int value = 0;
2471 int count = 0;
2472 value += x;
2473
2474 if (x != 0 && y != 0)
2475 {
2476 for (count = 1; count <= y - 1; count++)
2477 value *= x;
2478 }
2479 else
2480 return 1;
2481return value;
2482}
2483
2484long int chartoint(char ch)
2485{
8c126acc 2486 if (int(ch) >= 48 && int(ch) <= 57)
2487 return int(ch) - 48;
2488 else
2489 return 0;
85ce9d3e 2490}
2491
2492int save_gs_dbase()
2493{
2494 ListNode<aClient> *ptr = players.First();
2495 Player *it;
2496 ofstream outfile;
2497
2498 outfile.open(playerdata);
2499
2500 if (!outfile)
2501 {
9cc5ab57 2502 cout << "Error opening " << playerdata << endl;
85ce9d3e 2503 return 0;
2504 }
2505
2506 while(ptr)
2507 {
2508 it = ptr->getData()->stats;
2509 outfile << it->name << ' ' << it->level << ' ' << it->exp << ' ' << it->gold << ' ' << it->bank << ' '
2510 << it->hp << ' ' << it->maxhp << ' ' << it->strength << ' ' << it->defense << ' '
2511 << it->armor << ' ' << it->weapon << ' ' << (it->alive ? "alive" : "dead") << ' '
e3c5fe46 2512 << it->forest_fights << ' ' << it->player_fights << ' '
2513 << it->password << endl;
85ce9d3e 2514 ptr = ptr->Next();
2515 }
2516outfile.close();
28f552b8 2517return 1;
85ce9d3e 2518}
2519
2520int load_gs_dbase()
2521{
2522 ifstream infile;
2523 aClient *temp;
2524 Player *p;
e3c5fe46 2525 char *alive, *tempname, *buf, *password;
85ce9d3e 2526 buf = new char[1023];
2527
2528 infile.open(playerdata);
2529
2530 if (infile.fail())
2531 {
9cc5ab57 2532 cout << "Error opening " << playerdata << endl;
85ce9d3e 2533 return 0;
2534 }
2535
2536 while (infile.getline(buf, 1024, '\n'))
2537 {
2538 temp = new aClient;
2539 tempname = strtok(buf, " ");
2540 temp->stats = new Player(tempname);
2541 p = temp->stats;
2542
85ce9d3e 2543 p->level = stringtoint(strtok(NULL, " "));
2544 p->exp = stringtoint(strtok(NULL, " "));
2545 p->gold = stringtoint(strtok(NULL, " "));
2546 p->bank = stringtoint(strtok(NULL, " "));
2547 p->hp = stringtoint(strtok(NULL, " "));
2548 p->maxhp = stringtoint(strtok(NULL, " "));
2549 p->strength = stringtoint(strtok(NULL, " "));
2550 p->defense = stringtoint(strtok(NULL, " "));
2551 p->armor = stringtoint(strtok(NULL, " "));
2552 p->weapon = stringtoint(strtok(NULL, " "));
2553 alive = strtok(NULL, " ");
2554 p->alive = (stricmp(alive, "ALIVE") == 0 ? true : false);
2555 p->forest_fights = stringtoint(strtok(NULL, " "));
2556 p->player_fights = stringtoint(strtok(NULL, " "));
e3c5fe46 2557 password = strtok(NULL, " ");
2558 strcpy(p->password, password);
85ce9d3e 2559 temp->setNick("NULL");
2560
e3c5fe46 2561 printf("%s %d %ld %ld %ld %d %d %d %d %d %d %s %d %d %s\n", p->name, p->level,
2562 p->exp, p->gold, p->bank, p->hp, p->maxhp, p->strength, p->defense, p->armor, p->weapon,
2563 alive, p->forest_fights, p->player_fights, p->password);
2564
85ce9d3e 2565 players.insertAtBack(temp);
2566 delete temp;
2567 }
1cf88153 2568delete [] buf;
28f552b8 2569infile.close();
2570return 1;
85ce9d3e 2571}
2572
e3c5fe46 2573bool passcmp(char *encrypted, char *plaintext)
2574{
2575 char salt[3];
cdc9a6db 2576 char *plaintext2, *plainToencrypt;
2577 bool same = false;
2578
2579 plaintext2 = new char[strlen(encrypted) + strlen(plaintext)]; // Extra
2580 strcpy(plaintext2, plaintext);
2581
e3c5fe46 2582 salt[0] = encrypted[0];
2583 salt[1] = encrypted[1];
2584 salt[3] = '\0';
cdc9a6db 2585
2586 plainToencrypt = crypt(plaintext2, salt);
2587
2588 same = (strcmp((const char *)encrypted, plainToencrypt) == 0 ? true : false);
2589
2590 delete []plaintext2;
2591
2592 return same;
e3c5fe46 2593}
2594
2595bool check_password(char *name, char *plaintext)
2596{
0a1518fa 2597 aClient *client;
e3c5fe46 2598
0a1518fa 2599 if (!(client = findplayer(name)))
2600 return false;
2601 else
e3c5fe46 2602 {
0a1518fa 2603 return passcmp(client->stats->password, plaintext);
e3c5fe46 2604 }
e3c5fe46 2605}
1cf88153 2606
ad7dfaa0 2607void do_store(char *u)
2608{
2609 char *cmd = strtok(NULL, " ");
2610 char *item = strtok(NULL, " ");
2611 char *num = strtok(NULL, " ");
2612 char *space;
8c126acc 2613 int wep;
2614 aClient *user;
2615 Player *p;
ad7dfaa0 2616
8c126acc 2617 if (!is_playing(u) || !(user = find(u)))
2618 notice(s_GameServ, u, "You must be playing to use the store!");
2619 else if (!cmd || !item)
ad7dfaa0 2620 {
2621 notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}");
2622 notice(s_GameServ, u, " \ 2STORE SELL {ARMOR | WEAPON}\ 2");
2623 notice(s_GameServ, u, " \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2");
2624 }
2625 else if (stricmp(cmd, "LIST") == 0)
2626 {
2627 if (stricmp(item, "WEAPONS") == 0)
2628 {
2629 notice(s_GameServ, u, "Welcome to Kain's Armory");
2630 notice(s_GameServ, u, "Here are the weapons we have available for the killing, sire:");
2631 for (int x = 1; x < WNA; x++)
2632 {
2633 space = spaces(strlen(weapons[x]), ".");
2634 notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, weapons[x], space, prices[x - 1]);
2635 free(space);
2636 }
2637 notice(s_GameServ, u, "To purchase a weapon, type /msg %S STORE BUY \ 2NUM\ 2.");
2638 notice(s_GameServ, u, "Where num. is the weapon number from the menu above.");
2639
2640 }
2641 else if (stricmp(item, "ARMOR") == 0)
2642 {
2643 notice(s_GameServ, u, "Welcome to Kain's Armory");
2644 notice(s_GameServ, u, "I hope you enjoy the fine armor we have available for your protection:");
2645 for (int x = 1; x < WNA; x++)
2646 {
2647 space = spaces(strlen(armors[x]), ".");
2648 notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, armors[x], space, prices[x - 1]);
2649 free(space);
2650 }
2651 notice(s_GameServ, u, "To purchase armor, type /msg %S store buy armor num.");
2652 notice(s_GameServ, u, "Where num. is the armor number from the menu above.");
2653
2654
2655 }
2656 } else if (stricmp(cmd, "BUY") == 0) {
8c126acc 2657 if (!num)
2658 {
2659 notice(s_GameServ, u, "SYNTAX: \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2");
2660 return;
2661 }
2662 else if (!isstringnum(num))
2663 {
2664 notice(s_GameServ, u, "You must specify a number between 1 and %d. Not %s!", WNA - 1, num);
2665 return;
2666 }
2667 if (stricmp(item, "WEAPON") == 0)
2668 {
2669 wep = stringtoint(num);
2670 if (wep >= WNA || wep < 1)
2671 {
2672 notice(s_GameServ, u, "The number %d is out of range. The number you provide must be between 1 and %d.", wep, WNA - 1);
2673 return;
2674 }
2675
2676 p = user->stats;
2677
2678 if (p->weapon != 0)
2679 notice(s_GameServ, u, "You have to sell your %s first!", weapons[p->weapon]);
2680 else if (p->gold < prices[wep - 1])
2681 notice(s_GameServ, u, "You don't have enough gold for %s!", weapons[wep]);
2682 else
2683 {
2684 notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", weapons[wep]);
2685 p->weapon = wep;
2686 p->gold -= prices[wep - 1];
2687 }
2688 }
2689 else if (stricmp(item, "ARMOR") == 0)
2690 {
2691 wep = stringtoint(num);
2692 if (wep >= WNA || wep < 1)
2693 {
2694 notice(s_GameServ, u, "The number %d is out of range. The number you provide must be between 1 and %d.", wep, WNA - 1);
2695 return;
2696 }
2697
2698 p = user->stats;
2699
2700 if (p->armor != 0)
2701 notice(s_GameServ, u, "You have to sell your %s first!", armors[p->armor]);
2702 else if (p->gold < prices[wep - 1])
2703 notice(s_GameServ, u, "You don't have enough gold for %s!", armors[wep]);
2704 else
2705 {
2706 notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", armors[wep]);
2707 p->armor = wep;
2708 p->gold -= prices[wep - 1];
2709 }
2710 }
2711 }
2712 else if (stricmp(cmd, "SELL" ) == 0)
2713 {
2714 p = user->stats;
2715
2716 if (stricmp(item, "WEAPON") == 0)
2717 {
2718 if (p->weapon == 0)
2719 {
2720 notice(s_GameServ, u, "You want me to chop off your hands?");
2721 return;
2722 }
2723 else if (p->gold == 2000000000)
2724 {
2725 notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire.");
2726 p->weapon = 0;
2727 }
2728 else if (2000000000 - p->gold < (prices[p->weapon - 1] / 2))
2729 {
2730 notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry.");
2731 notice(s_GameServ, u, "However, you have no weapon... can I interest you in the %s?", weapons[WNA - 1]);
2732 p->gold = 2000000000;
2733 p->weapon = 0;
2734 }
2735 else
2736 {
2737 notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no weapon!", (prices[p->weapon - 1] / 2));
2738 p->gold += (prices[p->weapon - 1] / 2);
2739 p->weapon = 0;
2740 }
2741 }
2742 else if (stricmp(item, "ARMOR") == 0)
2743 {
2744 p = user->stats;
2745
2746 if (p->armor == 0)
2747 {
2748 notice(s_GameServ, u, "I don't think you can be any more naked...");
2749 return;
2750 }
2751 if (p->gold == 2000000000)
2752 {
2753 notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire.");
2754 p->armor = 0;
2755 }
2756 else if (2000000000 - p->gold < (prices[p->armor - 1] / 2))
2757 {
2758 notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry.");
2759 notice(s_GameServ, u, "However, you have no armor... can I interest you in %s?", armors[WNA - 1]);
2760 p->gold = 2000000000;
2761 p->armor = 0;
2762 }
2763 else
2764 {
2765 notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no armor!",
2766 (prices[p->armor - 1] / 2));
2767
2768 p->gold += (prices[p->armor - 1] / 2);
2769 p->armor = 0;
2770 }
2771 }
2772 else
2773 {
2774 notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}");
2775 notice(s_GameServ, u, " \ 2STORE SELL {ARMOR | WEAPON}\ 2");
2776 notice(s_GameServ, u, " \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2");
2777 }
2778 }
2779}
2780
2781void do_bank(char *u)
2782{
2783 char *cmd = strtok(NULL, " ");
2784 char *amount = strtok(NULL, " ");
2785 char *nick = strtok(NULL, " ");
2786
2787 aClient *user;
2788 Player *p;
2789
2790 if (!cmd || !amount || (stricmp(cmd, "TRANSFER") == 0 && !nick))
2791 {
2792 notice(s_GameServ, u, "BANK {WITHDRAW | DEPOSIT} {ALL | AMOUNT}");
e282e9d2 2793 notice (s_GameServ, u, "BANK BALANCE");
8c126acc 2794 return;
2795 }
2796 else if (!is_playing(u) || !(user = find(u)))
2797 {
2798 notice(s_GameServ, u, "You must be playing to use the bank!");
2799 return;
ad7dfaa0 2800 }
8c126acc 2801 else if (!isstringnum(amount) && stricmp(amount, "ALL") != 0)
2802 {
2803 notice(s_GameServ, u, "I don't know how to convert alphabet letters into currency, sire!");
2804 return;
2805 }
2806
2807 p = user->stats;
2808
e282e9d2 2809 if (stricmp(cmd, "BALANCE") == 0)
2810 {
2811 showBankBalance(u);
2812 }
2813 else if (stricmp(cmd, "DEPOSIT") == 0)
8c126acc 2814 {
2815 if (p->bank == 2000000000)
2816 {
2817 notice(s_GameServ, u, "Your bank account is full, sire!");
2818 return;
2819 }
2820 else if (stricmp(amount, "ALL") == 0)
2821 {
2822 if (2000000000 - p->bank < p->gold)
2823 {
2824 notice(s_GameServ, u, "You don't have enough room for all of your gold.");
2825 notice(s_GameServ, u, "Depositing %ld gold into your account", (2000000000 - p->bank));
2826 p->gold -= (2000000000 - p->bank);
2827 p->bank = 2000000000;
e282e9d2 2828 showBankBalance(u);
8c126acc 2829 }
2830 else
2831 {
2832 notice(s_GameServ, u, "Depositing %ld gold into your account!", p->gold);
2833 p->bank += p->gold;
2834 p->gold = 0;
e282e9d2 2835 showBankBalance(u);
8c126acc 2836 }
2837 }
2838 else if (stringtoint(amount) > p->gold)
2839 {
2840 notice(s_GameServ, u, "Sire, you only have %ld gold!", p->gold);
e282e9d2 2841 showBankBalance(u);
8c126acc 2842 return;
2843 }
2844 else
2845 {
2846 if (2000000000 - p->bank < stringtoint(amount))
2847 {
2848 notice(s_GameServ, u, "You don't have room in your account for that much.");
2849 notice(s_GameServ, u, "Capping off your account with %ld gold!", (2000000000 - p->bank));
2850 p->gold -= (2000000000 - p->bank);
2851 p->bank = 2000000000;
e282e9d2 2852 showBankBalance(u);
8c126acc 2853 }
2854 else
2855 {
2856 notice(s_GameServ, u, "Depositing %d gold into your account!", stringtoint(amount));
2857 p->bank += stringtoint(amount);
2858 p->gold -= stringtoint(amount);
e282e9d2 2859 showBankBalance(u);
8c126acc 2860 }
2861 }
2862 }
2863 else if (stricmp(cmd, "WITHDRAW") == 0)
2864 {
2865 if (p->gold == 2000000000)
2866 {
2867 notice(s_GameServ, u, "You cannot carry any more gold, sire!");
e282e9d2 2868 showBankBalance(u);
8c126acc 2869 return;
2870 }
2871 else if (stricmp(amount, "ALL") == 0)
2872 {
2873 if (2000000000 - p->gold < p->bank)
2874 {
2875 notice(s_GameServ, u, "You don't have enough room to carry all that gold.");
2876 notice(s_GameServ, u, "Withdrawing %ld gold from your account", (2000000000 - p->gold));
2877 p->bank -= (2000000000 - p->gold);
2878 p->gold = 2000000000;
e282e9d2 2879 showBankBalance(u);
8c126acc 2880 }
2881 else
2882 {
2883 notice(s_GameServ, u, "Withdrawing %ld gold from your account!", p->bank);
2884 p->gold += p->bank;
2885 p->bank = 0;
e282e9d2 2886 showBankBalance(u);
8c126acc 2887 }
2888 }
2889 else if (stringtoint(amount) > p->bank)
2890 {
2891 notice(s_GameServ, u, "Sire, you only have %ld gold in the bank!", p->bank);
e282e9d2 2892 showBankBalance(u);
8c126acc 2893 return;
2894 }
2895 else
2896 {
2897 if (2000000000 - p->gold < stringtoint(amount))
2898 {
2899 notice(s_GameServ, u, "You don't enough have room to carry that much gold!");
2900 notice(s_GameServ, u, "You fill your pockets with %ld gold!",
2901 (2000000000 - p->gold));
2902 p->bank -= (2000000000 - p->gold);
2903 p->gold = 2000000000;
e282e9d2 2904 showBankBalance(u);
8c126acc 2905 }
2906 else
2907 {
2908 notice(s_GameServ, u, "Withdrawing %d gold from your account!", stringtoint(amount));
2909 p->gold += stringtoint(amount);
2910 p->bank -= stringtoint(amount);
e282e9d2 2911 showBankBalance(u);
8c126acc 2912 }
2913 }
2914 }
2915
ad7dfaa0 2916}
ab4f4ec0 2917
2918void do_master(char *u)
2919{
2920 aClient *user;
2921 if (!(user = find(u)))
2922 {
2923 notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, ""));
2924 return;
2925 }
2926
2927 if (is_fighting(u))
2928 {
2929 notice(s_GameServ, u, "You're in the middle of a fight! Pay attention!");
2930 return;
2931 }
2932 else if (!is_playing(u))
2933 {
2934 notice(s_GameServ, u, "You must be playing to see your master!");
2935 return;
2936 }
c7340cbd 2937
2938 char *cmd = strtok(NULL, " ");
2939 Player *p = user->stats;
2940 long int need = 0;
2941
2942 if (cmd != NULL)
ab4f4ec0 2943 {
ab4f4ec0 2944 switch(p->level)
2945 {
2946 case 1:
2947 need = 100;
2948 break;
2949 case 2:
2950 need = 400;
2951 break;
2952 case 3:
2953 need = 1000;
2954 break;
2955 case 4:
2956 need = 4000;
2957 break;
2958 case 5:
2959 need = 10000;
2960 break;
2961 case 6:
2962 need = 40000;
2963 break;
2964 case 7:
2965 need = 100000;
2966 break;
2967 case 8:
2968 need = 400000;
2969 break;
2970 case 9:
2971 need = 1000000;
2972 break;
2973 case 10:
2974 need = 4000000;
2975 break;
2976 case 11:
2977 need = 10000000;
2978 break;
2979 case 12:
2980 need = p->exp + 1;
2981 notice(s_GameServ, u, "You are at level 12. You are the master. What's left? The DRAGON!");
2982 break;
2983 default:
2984 need = p->exp + 1; // Unknown level... don't let them fight a fake master!
2985 break;
c7340cbd 2986 }
2987 }
2988 else
2989 {
2990 notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}");
2991 return;
2992 }
2993
2994 if (stricmp(cmd, "FIGHT") == 0)
2995 {
ab4f4ec0 2996 if (p->exp >= need)
2997 see_master(u);
2998 else
2999 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 3000 return;
3001 }
3002 else if (stricmp(cmd, "QUESTION") == 0)
3003 {
3004 if (p->exp >= need)
3005 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);
3006 else
3007 notice(s_GameServ, u, "You pathetic fool! You are no match for %s, %s!", masters[p->level - 1]->name, p->name);
3008
3009 return;
3010 }
3011 else
3012 {
3013 notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}");
ab4f4ec0 3014 }
3015}
3016
3017void see_master(char *u)
3018{
3019 aClient *user;
3020 if (!(user = find(u)))
3021 {
3022 notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, ""));
3023 return;
3024 }
3025
3026 if (!is_fighting(u) && is_playing(u))
3027 {
3028 Player *p = user->stats;
3029 p->master = new Monster(masters[p->level - 1]);
3030 p->fight = p->master;
3031 display_monster(u); // Since master is the same structure, use this function
3032 }
3033}
e282e9d2 3034
3035void showBankBalance(const char *u)
3036{
3037 aClient *user;
3038 Player *p;
3039 if (!(user = find(u)))
3040 return;
3041
3042 p = user->stats;
3043
3044 if (!p)
3045 return;
3046
3047 notice(s_GameServ, u, "Account Balance: %ld Gold On hand: %ld", p->bank, p->gold);
3048
3049}
44ea29f7 3050
3051void refreshall()
3052{
3053 ListNode <aClient> *it;
3054 Player *p;
3055
3056 it = players.First();
3057
3058 while (it)
3059 {
3060 p = it->getData()->stats;
3061 refresh(p);
3062 it = it->Next();
3063 }
3064}
3065
3066void refresh(Player *p)
3067{
3068 if (!p)
3069 return;
3070
3071 p->hp = p->maxhp;
3072 p->forest_fights = 100;
3073 p->player_fights = 3;
3074 p->alive = true;
3075}
c7340cbd 3076
3077void do_refresh(char *u)
3078{
3079 char *nick = strtok(NULL, " ");
3080 aClient *user;
3081
96f71fee 3082 if (!(user = find(u)))
3083 {
3084 notice(s_GameServ, u, "Error: aClient not found. Contact a %S admin");
3085 cout << "Error: aClient not found: " << u << endl;
3086 return;
3087 }
3088 else if (!isAdmin(user))
3089 {
3090 notice(s_GameServ, u, "You must be a %S admin to use this command!");
3091 return;
3092 }
c7340cbd 3093 if (!nick)
3094 {
96f71fee 3095 notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}");
c7340cbd 3096 return;
3097 }
3098 else if (stricmp(nick, "ALL") == 0)
3099 {
3100 notice(s_GameServ, u, "Refreshing everyone's stats!");
3101 refreshall();
3102 }
3103 else if ((user = find(nick)))
3104 {
3105 if (user->stats)
3106 {
3107 notice(s_GameServ, u, "Refreshing %s.", user->getNick());
3108 refresh(user->stats);
3109 }
3110 else
3111 {
3112 notice(s_GameServ, u, "%s is not playing.", user->getNick());
3113 }
3114 }
3115 else
3116 {
3117 notice(s_GameServ, u, "Nick %s not found.", nick);
3118 return;
3119 }
3120}
3121
3122void do_help(char *u)
3123{
3124 char *cmd = strtok(NULL, " ");
3125
3126 if (cmd)
3127 for (unsigned int x = 0; x < strlen(cmd); x++)
3128 cmd[x] = tolower(cmd[x]);
3129 display_help(u, cmd);
3130}
3131
3132void display_help(char *u, char *file)
3133{
3134 ifstream infile;
3135 char *buf;
3136
3137 if (!file)
3138 {
3139 infile.open("helpfiles/help");
3140 if (infile.fail())
3141 {
3142 cout << "Error opening helpfiles/help" << endl;
3143 notice(s_GameServ, u, "Error opening helpfiles/help");
3144 return;
3145 }
3146 buf = new char[1024];
3147 while(infile.getline(buf, 1024))
3148 {
3149 // Written this way, it will process %S in the helpfiles
3150 // Instead of notice(s_GameServ, u, "%s", buf);
3151 notice(s_GameServ, u, buf);
3152 }
3153
3154 // Minor recursion
96f71fee 3155 aClient *user = find(u);
3156 if (user && isAdmin(user))
3157 display_help(u, "admin_commands");
c7340cbd 3158 }
3159 else
3160 {
3161 char *filename;
3162 filename = new char[strlen(file) + 12];
3163 sprintf(filename, "helpfiles/%s", file);
3164 infile.open(filename);
3165 delete [] filename;
3166 if (infile.fail())
3167 {
3168 notice(s_GameServ, u, "No help for \ 2%s\ 2", file);
3169 return;
3170 }
3171 buf = new char[1024];
3172 while(infile.getline(buf, 1024))
3173 {
3174 // Written this way, it will process %S in the helpfiles
3175 // Instead of notice(s_GameServ, u, "%s", buf);
3176 notice(s_GameServ, u, buf);
3177 }
3178 }
3179 infile.close();
3180 delete [] buf;
3181}
96f71fee 3182
3183void do_admin(char *u)
3184{
3185 aClient *user;
3186 char *pass = strtok(NULL, " ");
3187
3188 if (!(user = find(u)))
3189 {
3190 cout << "Error: aClient not found: " << u << endl;
3191 notice(s_GameServ, u, "Error: aClient not found. Contact %S admin.");
3192 return;
3193 }
3194 if (!pass)
3195 {
3196 notice(s_GameServ, u, "SYNTAX: \ 2ADMIN\ 2 \ 2\1fpassword\1f\ 2");
3197 return;
3198 }
3199
3200 if (strcmp(pass, adminpass) == 0)
3201 {
3202 notice(s_GameServ, u, "Password accepted. You now have administrator privledges.");
3203 setAdmin(user);
3204 }
3205 else
3206 {
3207 notice(s_GameServ, u, "Invalid password. Remember: case sensitive");
3208 return;
3209 }
3210}