]>
jfr.im git - irc/gameservirc.git/blob - gameserv/gameserv.cpp
9 Monster monsters
[ 5 ][ 12 ];
17 char * strtok ( char * str
, const char * delim
);
18 int stricmp ( const char * s1
, const char * s2
);
19 int strnicmp ( const char * s1
, const char * s2
, size_t len
);
23 bool is_playing ( char * u
);
24 bool has_started ( char * u
);
25 bool is_fighting ( char * u
);
26 bool isnt_fighting ( char * u
);
27 bool player_fight ( char * u
);
28 bool master_fight ( char * u
);
32 void display_monster ( char * u
);
33 void display_players ( char * u
);
34 long int chartoint ( char ch
);
35 int isstringnum ( char * num
);
36 long int pow ( int x
, int y
);
37 long int stringtoint ( char * number
);
39 char * spaces ( int len
, char * seperator
);
41 void refresh ( aClient
* ni
);
43 void reset ( aClient
* ni
);
46 void do_list ( char * u
);
47 void do_register ( char * u
);
48 void do_identify ( char * u
);
49 void do_play ( char * u
);
50 void do_quitg ( char * u
);
51 void do_reset ( char * u
);
52 void do_fight ( char * u
);
53 void do_store ( char * u
);
54 void do_heal ( char * u
);
55 void do_bank ( char * u
);
56 void do_attack ( char * u
);
58 void do_visit ( char * u
);
59 void do_stats ( char * u
);
60 void see_mystic ( char * u
);
62 void showstats ( const char * u
, const char * nick
);
65 char * weapons
[ WNA
] = { "Fists" , "Stick" , "Dagger" , "Quarterstaff" , "Short Sword" ,
66 "Long Sword" , "Silver Spear" , "Battle Axe" , "The Ragnarok" ,
67 "Chain Saw" , "Poison Sword" , "Flame Sword" , "Earth Hammer" ,
68 "Light Saber" , "Masamune" , "Mystical Sword" };
70 char * armors
[ WNA
] = { "Nothing" , "Clothes" , "Leather Vest" , "Chain Mail" , "Plate Armor" ,
71 "Full Body Armor" , "Magic Mail" , "Graphite Suit" , "Steel Suit" ,
72 "Force Field" , "Armor of Light" , "Mythril Vest" , "DemiGod Armor" ,
73 "Hades' Cloak" , "Dragon Scales" , "Mystical Armor" };
75 int prices
[ WNA
- 1 ] = { 200 , 1000 , 3000 , 10000 , 30000 , 100000 , 150000 , 200000 , 400000 ,
76 1000000 , 4000000 , 10000000 , 40000000 , 100000000 , 400000000 };
77 int webonus
[ WNA
] = { 0 , 10 , 15 , 25 , 35 , 45 , 65 , 85 , 125 , 185 , 255 , 355 , 505 , 805 , 1205 , 1805 };
78 int arbonus
[ WNA
] = { 0 , 1 , 3 , 10 , 15 , 25 , 35 , 50 , 75 , 100 , 150 , 225 , 300 , 400 , 600 , 1000 };
80 int hpbonus
[ 11 ] = { 10 , 15 , 20 , 30 , 50 , 75 , 125 , 185 , 250 , 350 , 550 };
81 int strbonus
[ 11 ] = { 5 , 7 , 10 , 12 , 20 , 35 , 50 , 75 , 110 , 150 , 200 };
82 int defbonus
[ 11 ] = { 2 , 3 , 5 , 10 , 15 , 22 , 35 , 60 , 80 , 120 , 150 };
85 void gameserv ( char * source
, char * buf
)
87 char * cmd
, input
[ 1024 ];
88 cmd
= strtok ( buf
, " " );
90 source
++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text
91 cmd
++; // Get rid of that : at the beginning of the :text (command)
93 cout
<< "Source: " << source
<< " \n cmd: " << cmd
<< endl
;
94 if ( strnicmp ( cmd
, ":\1PING" , 6 ) == 0 )
97 timestamp
= strtok ( NULL
, "\1" );
98 notice ( s_GameServ
, source
, "\1PING %s \1" , timestamp
);
99 } else if ( stricmp ( cmd
, ":\1VERSION\1" ) == 0 ) {
100 notice ( s_GameServ
, source
, "\1VERSION GameServ v1.0b\1" );
101 } else if ( stricmp ( cmd
, "SEARCH" ) == 0 ) {
102 cmd
= strtok ( NULL
, " " );
105 notice ( s_GameServ
, source
, "SYNTAX: /msg %S SEARCH FOREST" );
108 } else if ( stricmp ( cmd
, "FIGHT" ) == 0 ) {
110 } else if ( stricmp ( cmd
, "ATTACK" ) == 0 ) {
112 } else if ( stricmp ( cmd
, "HEAL" ) == 0 ) {
114 } else if ( stricmp ( cmd
, "PRINT" ) == 0 ) {
115 cout
<< "Printing Clients List: " << endl
;
117 cout
<< "Printing Player List: " << endl
;
119 } else if ( stricmp ( cmd
, "LIST" ) == 0 ) {
121 } else if ( stricmp ( cmd
, "REGISTER" ) == 0 ) {
123 } else if ( stricmp ( cmd
, "IDENTIFY" ) == 0 ) {
125 } else if ( stricmp ( cmd
, "HELP" ) == 0 ) {
126 } else if ( stricmp ( cmd
, "STATS" ) == 0 ) {
128 } else if ( stricmp ( cmd
, "SHUTDOWN" ) == 0 ) {
130 raw ( "SQUIT %s :leaving" , servername
);
131 } else if ( stricmp ( cmd
, "SAVE" ) == 0 ) {
133 } else if ( stricmp ( cmd
, "LOAD" ) == 0 ) {
135 } else if ( stricmp ( cmd
, "RAW" ) == 0 ) {
136 char * rest
= strtok ( NULL
, "" );
140 source
--; // Bring the : back so we don't leak memory
141 cmd
--; // Same thing :)
144 int stricmp ( const char * s1
, const char * s2
)
148 while (( c
= tolower (* s1
)) == tolower (* s2
)) {
154 if ( c
< tolower (* s2
))
159 void showstats ( const char * u
, const char * nick
)
161 aClient
* ni
, * sender
= find ( u
);
167 cout
<< " \n\n u: " << u
<< " \n nick: " << nick
<< endl
;
168 if (!( ni
= findbynick ( nick
)))
170 notice ( s_GameServ
, u
, " %s not found" , nick
);
175 notice ( s_GameServ
, sender
-> getNick (), "Stats for %s :" , ni
-> stats
-> name
);
177 sprintf ( buf
, "Experience: %l d" , ni
-> stats
-> exp
);
178 space
= spaces ( strlen ( buf
), " " );
179 notice ( s_GameServ
, sender
-> getNick (), " %s%s Level: %d " , buf
, space
,
183 sprintf ( buf
, "Gold: %l d" , ni
-> stats
-> gold
);
184 space
= spaces ( strlen ( buf
), " " );
185 notice ( s_GameServ
, sender
-> getNick (), " %s%s Gold in Bank: %l d" , buf
, space
, ni
-> stats
-> bank
);
188 notice ( s_GameServ
, sender
-> getNick (), "Health Points: %d of %d " , ni
-> stats
-> hp
,
191 sprintf ( buf
, "Strength: %d " , ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]);
192 space
= spaces ( strlen ( buf
), " " );
193 notice ( s_GameServ
, sender
-> getNick (), " %s%s Defense: %d " ,
194 buf
, space
, ni
-> stats
-> defense
+ arbonus
[ ni
-> stats
-> armor
]);
197 sprintf ( buf
, "Armor: %s " , armors
[ ni
-> stats
-> armor
]);
198 space
= spaces ( strlen ( buf
), " " );
199 notice ( s_GameServ
, sender
-> getNick (), " %s%s Weapon: %s " , buf
, space
,
200 weapons
[ ni
-> stats
-> weapon
]);
203 sprintf ( buf
, "Forest Fights: %d " , ni
-> stats
-> forest_fights
);
204 space
= spaces ( strlen ( buf
), " " );
205 notice ( s_GameServ
, sender
-> getNick (), " %s%s Player Fights: %d " , buf
, space
, ni
-> stats
-> player_fights
);
212 char * spaces ( int len
, char * seperator
)
215 final
= new char [ 40 ];
217 strcpy ( final
, seperator
);
218 for ( y
= 0 ; y
< 40 - len
; y
++)
219 strcat ( final
, seperator
);
223 void raw ( const char * fmt
, ...)
228 input
= new char [ 1024 ];
230 memset ( input
, 0 , sizeof ( input
)); // Initialize to NULL
236 case 'd' : sprintf ( input
, " %s%d " , input
, va_arg ( args
, int )); break ;
237 case 's' : sprintf ( input
, " %s%s " , input
, va_arg ( args
, char *)); break ;
238 case 'S' : sprintf ( input
, " %s%s " , input
, s_GameServ
); break ;
241 sprintf ( input
, " %s%l d" , input
, va_arg ( args
, long int )); break ;
246 sprintf ( input
, " %s%c " , input
, * t
);
250 sprintf ( input
, " %s%s " , input
, " \r\n " );
251 cout
<< "input: " << input
<< flush
;
252 sock_puts ( sock
, input
);
256 /* Send a NOTICE from the given source to the given nick. */
258 void notice ( const char * source
, const char * dest
, const char * fmt
, ...)
263 input
= new char [ 1024 ];
268 sprintf ( input
, ": %s NOTICE %s :" , source
, dest
);
272 sprintf ( input
, ": %s NOTICE %s :" , source
, dest
);
279 case 'd' : sprintf ( input
, " %s%d " , input
, va_arg ( args
, int )); break ;
280 case 's' : sprintf ( input
, " %s%s " , input
, va_arg ( args
, char *)); break ;
281 case 'S' : sprintf ( input
, " %s%s " , input
, s_GameServ
); break ;
284 sprintf ( input
, " %s%l d" , input
, va_arg ( args
, long int )); break ;
289 sprintf ( input
, " %s%c " , input
, * t
);
293 sprintf ( input
, " %s%s " , input
, " \r\n " );
294 cout
<< "input: " << input
<< flush
;
295 sock_puts ( sock
, input
);
301 int strnicmp ( const char * s1
, const char * s2
, size_t len
)
307 while (( c
= tolower (* s1
)) == tolower (* s2
) && len
> 0 ) {
308 if ( c
== 0 || -- len
== 0 )
313 if ( c
< tolower (* s2
))
318 char * strtok ( char * str
, const char * delim
)
320 static char * current
= NULL
;
327 current
+= strspn ( current
, delim
);
328 ret
= * current
? current
: NULL
;
329 current
+= strcspn ( current
, delim
);
337 void do_list ( char * u
)
339 ListNode
< aClient
> * temp
;
340 temp
= players
. First ();
341 if (! players
. isEmpty ())
343 notice ( s_GameServ
, u
, "People Playing:" );
346 notice ( s_GameServ
, u
, "IRC: %s Game: %s " , temp
-> getData ()-> getNick (), temp
-> getData ()-> stats
-> name
);
349 notice ( s_GameServ
, u
, "End of List" );
352 notice ( s_GameServ
, u
, "No one is playing" );
354 void do_register ( char * u
)
358 password
= strtok ( NULL
, " " );
362 notice ( s_GameServ
, u
, "SYNTAX: /msg %S REGISTER PASSWORD" );
364 else if ( user
= find ( u
))
368 user
-> stats
= new Player ( user
);
369 user
-> stats
-> started
= 1 ;
370 user
-> stats
-> user
= user
; // Set the backwards pointer
371 players
. insertAtBack ( user
);
375 notice ( s_GameServ
, u
, "Already registered. Contact a %S admin for help." );
380 void do_identify ( char * u
)
384 password
= strtok ( NULL
, " " );
388 notice ( s_GameServ
, u
, "SYNTAX: /msg %S IDENTIFY PASSWORD" );
390 else if ( stricmp ( password
, "TEST" ) != 0 )
392 notice ( s_GameServ
, u
, "Password incorrect" );
394 else if ( user
= find ( u
))
398 user
-> stats
= new Player ( user
);
399 user
-> stats
-> started
= 1 ;
400 players
. insertAtBack ( user
);
401 notice ( s_GameServ
, u
, "Password Accepted. Identified." );
405 notice ( s_GameServ
, u
, "Already identified. Contact a %S admin for help." );
410 void do_stats ( char * u
)
415 nick
= strtok ( NULL
, " " );
419 showstats ( u
, source
-> getNick ());
426 // Hard coded for now - Kain
427 monsters
[ 0 ][ 0 ]. name
= "Slime" ;
428 monsters
[ 0 ][ 0 ]. weapon
= "Acid Goo" ;
429 monsters
[ 0 ][ 0 ]. strength
= 6 ;
430 monsters
[ 0 ][ 0 ]. gold
= 50 ;
431 monsters
[ 0 ][ 0 ]. exp
= 3 ;
432 monsters
[ 0 ][ 0 ]. maxhp
= 9 ;
433 monsters
[ 0 ][ 0 ]. death
= "The slime oozes into nothing... you clean the acid goo off of your weapon" ;
435 monsters
[ 0 ][ 1 ]. name
= "Ghost" ;
436 monsters
[ 0 ][ 1 ]. weapon
= "Cold Breath" ;
437 monsters
[ 0 ][ 1 ]. strength
= 8 ;
438 monsters
[ 0 ][ 1 ]. gold
= 100 ;
439 monsters
[ 0 ][ 1 ]. exp
= 10 ;
440 monsters
[ 0 ][ 1 ]. maxhp
= 10 ;
441 monsters
[ 0 ][ 1 ]. death
= "You feel a chill as the spirit leaves the realm." ;
443 monsters
[ 0 ][ 2 ]. name
= "Ugly Rodent" ;
444 monsters
[ 0 ][ 2 ]. weapon
= "Sharp Teeth" ;
445 monsters
[ 0 ][ 2 ]. strength
= 9 ;
446 monsters
[ 0 ][ 2 ]. gold
= 75 ;
447 monsters
[ 0 ][ 2 ]. exp
= 8 ;
448 monsters
[ 0 ][ 2 ]. maxhp
= 13 ;
449 monsters
[ 0 ][ 2 ]. death
= "You stomp on the Ugly Rodent's remains for a finishing blow." ;
451 monsters
[ 0 ][ 3 ]. name
= "Whart Hog" ;
452 monsters
[ 0 ][ 3 ]. weapon
= "Tusks" ;
453 monsters
[ 0 ][ 3 ]. strength
= 10 ;
454 monsters
[ 0 ][ 3 ]. gold
= 80 ;
455 monsters
[ 0 ][ 3 ]. exp
= 6 ;
456 monsters
[ 0 ][ 3 ]. maxhp
= 10 ;
457 monsters
[ 0 ][ 3 ]. death
= "You cook and eat the hog for good measure!" ;
459 monsters
[ 0 ][ 4 ]. name
= "Pesky Kid" ;
460 monsters
[ 0 ][ 4 ]. weapon
= "Slingshot" ;
461 monsters
[ 0 ][ 4 ]. strength
= 8 ;
462 monsters
[ 0 ][ 4 ]. gold
= 30 ;
463 monsters
[ 0 ][ 4 ]. exp
= 4 ;
464 monsters
[ 0 ][ 4 ]. maxhp
= 6 ;
465 monsters
[ 0 ][ 4 ]. death
= "You take his slingshot and snap the band, sending the kid crying home to mom!" ;
467 monsters
[ 0 ][ 5 ]. name
= "Playground Bully" ;
468 monsters
[ 0 ][ 5 ]. weapon
= "Painful Noogie" ;
469 monsters
[ 0 ][ 5 ]. strength
= 11 ;
470 monsters
[ 0 ][ 5 ]. gold
= 44 ;
471 monsters
[ 0 ][ 5 ]. exp
= 6 ;
472 monsters
[ 0 ][ 5 ]. maxhp
= 10 ;
473 monsters
[ 0 ][ 5 ]. death
= "You give him an indian burn, and punt him across the schoolyard!" ;
475 monsters
[ 0 ][ 6 ]. name
= "Small Imp" ;
476 monsters
[ 0 ][ 6 ]. weapon
= "Dagger" ;
477 monsters
[ 0 ][ 6 ]. strength
= 6 ;
478 monsters
[ 0 ][ 6 ]. gold
= 64 ;
479 monsters
[ 0 ][ 6 ]. exp
= 10 ;
480 monsters
[ 0 ][ 6 ]. maxhp
= 10 ;
481 monsters
[ 0 ][ 6 ]. death
= "You can't help but laugh as he stumbles and falls onto his own dagger!" ;
483 monsters
[ 0 ][ 7 ]. name
= "Little Monkey" ;
484 monsters
[ 0 ][ 7 ]. weapon
= "Monkey Wrench" ;
485 monsters
[ 0 ][ 7 ]. strength
= 6 ;
486 monsters
[ 0 ][ 7 ]. gold
= 53 ;
487 monsters
[ 0 ][ 7 ]. exp
= 9 ;
488 monsters
[ 0 ][ 7 ]. maxhp
= 9 ;
489 monsters
[ 0 ][ 7 ]. death
= "You want to cook it, but you just can't think of eating something that looks so human!" ;
491 monsters
[ 0 ][ 8 ]. name
= "Grub Worm" ;
492 monsters
[ 0 ][ 8 ]. weapon
= "Minor Nudge" ;
493 monsters
[ 0 ][ 8 ]. strength
= 2 ;
494 monsters
[ 0 ][ 8 ]. gold
= 10 ;
495 monsters
[ 0 ][ 8 ]. exp
= 3 ;
496 monsters
[ 0 ][ 8 ]. maxhp
= 3 ;
497 monsters
[ 0 ][ 8 ]. death
= "You decide to save the poor little fella for your next fishing trip." ;
499 monsters
[ 0 ][ 9 ]. name
= "Drakee" ;
500 monsters
[ 0 ][ 9 ]. weapon
= "Tail Slap" ;
501 monsters
[ 0 ][ 9 ]. strength
= 5 ;
502 monsters
[ 0 ][ 9 ]. gold
= 22 ;
503 monsters
[ 0 ][ 9 ]. exp
= 7 ;
504 monsters
[ 0 ][ 9 ]. maxhp
= 5 ;
505 monsters
[ 0 ][ 9 ]. death
= "You pull the little Drakee by its tale and slam it down on a dry stump!" ;
507 monsters
[ 0 ][ 10 ]. name
= "Fat Slob" ;
508 monsters
[ 0 ][ 10 ]. weapon
= "Smelly Breath" ;
509 monsters
[ 0 ][ 10 ]. strength
= 6 ;
510 monsters
[ 0 ][ 10 ]. gold
= 40 ;
511 monsters
[ 0 ][ 10 ]. exp
= 10 ;
512 monsters
[ 0 ][ 10 ]. maxhp
= 7 ;
513 monsters
[ 0 ][ 10 ]. death
= "You kick his stomach for fun, and are thrown back by the spring of it all!" ;
515 monsters
[ 0 ][ 11 ]. name
= "Lost Warrior" ;
516 monsters
[ 0 ][ 11 ]. weapon
= "Long Sword" ;
517 monsters
[ 0 ][ 11 ]. strength
= 10 ;
518 monsters
[ 0 ][ 11 ]. gold
= 250 ;
519 monsters
[ 0 ][ 11 ]. exp
= 19 ;
520 monsters
[ 0 ][ 11 ]. maxhp
= 15 ;
521 monsters
[ 0 ][ 11 ]. death
= "You give him a proper burial in respect for the dead warrior." ;
523 monsters
[ 1 ][ 0 ]. name
= "Lost Warrior's Cousin Larry" ;
524 monsters
[ 1 ][ 0 ]. weapon
= "Wood Axe" ;
525 monsters
[ 1 ][ 0 ]. strength
= 19 ;
526 monsters
[ 1 ][ 0 ]. gold
= 134 ;
527 monsters
[ 1 ][ 0 ]. exp
= 24 ;
528 monsters
[ 1 ][ 0 ]. maxhp
= 30 ;
529 monsters
[ 1 ][ 0 ]. death
= "He was pretty pissed you killed his cousin, but he seems to have suffered the same fate!" ;
531 monsters
[ 1 ][ 1 ]. name
= "Sandman" ;
532 monsters
[ 1 ][ 1 ]. weapon
= "Sleeping Dust" ;
533 monsters
[ 1 ][ 1 ]. strength
= 25 ;
534 monsters
[ 1 ][ 1 ]. gold
= 80 ;
535 monsters
[ 1 ][ 1 ]. exp
= 6 ;
536 monsters
[ 1 ][ 1 ]. maxhp
= 27 ;
537 monsters
[ 1 ][ 1 ]. death
= "You put the sandman to his final sleep." ;
539 monsters
[ 1 ][ 2 ]. name
= "Dirty Transvestite" ;
540 monsters
[ 1 ][ 2 ]. weapon
= "Stiletto Heel" ;
541 monsters
[ 1 ][ 2 ]. strength
= 21 ;
542 monsters
[ 1 ][ 2 ]. gold
= 160 ;
543 monsters
[ 1 ][ 2 ]. exp
= 12 ;
544 monsters
[ 1 ][ 2 ]. maxhp
= 25 ;
545 monsters
[ 1 ][ 2 ]. death
= "You shudder at the thought of ever mistaking this for a woman!" ;
547 monsters
[ 1 ][ 3 ]. name
= "Goblin Gardener" ;
548 monsters
[ 1 ][ 3 ]. weapon
= "Garden Spade" ;
549 monsters
[ 1 ][ 3 ]. strength
= 18 ;
550 monsters
[ 1 ][ 3 ]. gold
= 130 ;
551 monsters
[ 1 ][ 3 ]. exp
= 8 ;
552 monsters
[ 1 ][ 3 ]. maxhp
= 20 ;
553 monsters
[ 1 ][ 3 ]. death
= "You trample on his garden after slaying him... that felt good!" ;
555 monsters
[ 1 ][ 4 ]. name
= "Evil Elf" ;
556 monsters
[ 1 ][ 4 ]. weapon
= "Elvish Bow" ;
557 monsters
[ 1 ][ 4 ]. strength
= 23 ;
558 monsters
[ 1 ][ 4 ]. gold
= 136 ;
559 monsters
[ 1 ][ 4 ]. exp
= 13 ;
560 monsters
[ 1 ][ 4 ]. maxhp
= 24 ;
561 monsters
[ 1 ][ 4 ]. death
= "Elves are usually nice you thought... hmm." ;
563 monsters
[ 1 ][ 5 ]. name
= "Viking Warrior" ;
564 monsters
[ 1 ][ 5 ]. weapon
= "Broad Sword" ;
565 monsters
[ 1 ][ 5 ]. strength
= 21 ;
566 monsters
[ 1 ][ 5 ]. gold
= 330 ;
567 monsters
[ 1 ][ 5 ]. exp
= 20 ;
568 monsters
[ 1 ][ 5 ]. maxhp
= 18 ;
569 monsters
[ 1 ][ 5 ]. death
= "You heard vikings were big, but not THAT big you thought." ;
571 monsters
[ 1 ][ 6 ]. name
= "Wicked Witch" ;
572 monsters
[ 1 ][ 6 ]. weapon
= "Cackling Laugh" ;
573 monsters
[ 1 ][ 6 ]. strength
= 20 ;
574 monsters
[ 1 ][ 6 ]. gold
= 130 ;
575 monsters
[ 1 ][ 6 ]. exp
= 20 ;
576 monsters
[ 1 ][ 6 ]. maxhp
= 26 ;
577 monsters
[ 1 ][ 6 ]. death
= "Just for kicks, you splash some water on her and watch her melt." ;
579 monsters
[ 1 ][ 7 ]. name
= "Vampire Bat" ;
580 monsters
[ 1 ][ 7 ]. weapon
= "Blood Sucking Fangs" ;
581 monsters
[ 1 ][ 7 ]. strength
= 18 ;
582 monsters
[ 1 ][ 7 ]. gold
= 125 ;
583 monsters
[ 1 ][ 7 ]. exp
= 21 ;
584 monsters
[ 1 ][ 7 ]. maxhp
= 29 ;
585 monsters
[ 1 ][ 7 ]. death
= "You fry up the bat and eat it... needs garlic." ;
587 monsters
[ 1 ][ 8 ]. name
= "Thorn Bush" ;
588 monsters
[ 1 ][ 8 ]. weapon
= "101 Thorns" ;
589 monsters
[ 1 ][ 8 ]. strength
= 16 ;
590 monsters
[ 1 ][ 8 ]. gold
= 94 ;
591 monsters
[ 1 ][ 8 ]. exp
= 15 ;
592 monsters
[ 1 ][ 8 ]. maxhp
= 25 ;
593 monsters
[ 1 ][ 8 ]. death
= "You set the bush ablaze and roast some marshmallows." ;
595 monsters
[ 1 ][ 9 ]. name
= "Barbarian" ;
596 monsters
[ 1 ][ 9 ]. weapon
= "Heavy Sword" ;
597 monsters
[ 1 ][ 9 ]. strength
= 29 ;
598 monsters
[ 1 ][ 9 ]. gold
= 250 ;
599 monsters
[ 1 ][ 9 ]. exp
= 25 ;
600 monsters
[ 1 ][ 9 ]. maxhp
= 30 ;
601 monsters
[ 1 ][ 9 ]. death
= "You listen to him moan as he falls over dead." ;
603 monsters
[ 1 ][ 10 ]. name
= "Crypt Rat" ;
604 monsters
[ 1 ][ 10 ]. weapon
= "Stinging Bite" ;
605 monsters
[ 1 ][ 10 ]. strength
= 25 ;
606 monsters
[ 1 ][ 10 ]. gold
= 119 ;
607 monsters
[ 1 ][ 10 ]. exp
= 20 ;
608 monsters
[ 1 ][ 10 ]. maxhp
= 26 ;
609 monsters
[ 1 ][ 10 ]. death
= "You squash the little rodent for fear that it might not be dead." ;
611 monsters
[ 1 ][ 11 ]. name
= "Small Orc" ;
612 monsters
[ 1 ][ 11 ]. weapon
= "blade" ;
613 monsters
[ 1 ][ 11 ]. strength
= 28 ;
614 monsters
[ 1 ][ 11 ]. gold
= 300 ;
615 monsters
[ 1 ][ 11 ]. exp
= 30 ;
616 monsters
[ 1 ][ 11 ]. maxhp
= 36 ;
617 monsters
[ 1 ][ 11 ]. death
= "It's an ugly one, and it would've grown up to be a terror..." ;
619 monsters
[ 2 ][ 0 ]. name
= "Teferi" ;
620 monsters
[ 2 ][ 0 ]. weapon
= "Puzzle Box" ;
621 monsters
[ 2 ][ 0 ]. strength
= 29 ;
622 monsters
[ 2 ][ 0 ]. gold
= 380 ;
623 monsters
[ 2 ][ 0 ]. exp
= 18 ;
624 monsters
[ 2 ][ 0 ]. maxhp
= 29 ;
625 monsters
[ 2 ][ 0 ]. death
= "It was a puzzling experience." ;
627 monsters
[ 2 ][ 1 ]. name
= "Spineless Thug" ;
628 monsters
[ 2 ][ 1 ]. weapon
= "Spiked Bat" ;
629 monsters
[ 2 ][ 1 ]. strength
= 37 ;
630 monsters
[ 2 ][ 1 ]. gold
= 384 ;
631 monsters
[ 2 ][ 1 ]. exp
= 27 ;
632 monsters
[ 2 ][ 1 ]. maxhp
= 32 ;
633 monsters
[ 2 ][ 1 ]. death
= "See you at the crossroads!" ;
635 monsters
[ 2 ][ 2 ]. name
= "Pyromaniac" ;
636 monsters
[ 2 ][ 2 ]. weapon
= "Pyrotechnics" ;
637 monsters
[ 2 ][ 2 ]. strength
= 29 ;
638 monsters
[ 2 ][ 2 ]. gold
= 563 ;
639 monsters
[ 2 ][ 2 ]. exp
= 22 ;
640 monsters
[ 2 ][ 2 ]. maxhp
= 45 ;
641 monsters
[ 2 ][ 2 ]. death
= "He chants FIRE FIRE as he falls to the ground... a burning heap of flesh." ;
643 monsters
[ 2 ][ 3 ]. name
= "Evil Enchantress" ;
644 monsters
[ 2 ][ 3 ]. weapon
= "Deadly Spell" ;
645 monsters
[ 2 ][ 3 ]. strength
= 50 ;
646 monsters
[ 2 ][ 3 ]. gold
= 830 ;
647 monsters
[ 2 ][ 3 ]. exp
= 35 ;
648 monsters
[ 2 ][ 3 ]. maxhp
= 35 ;
649 monsters
[ 2 ][ 3 ]. death
= "She looked just about as good as she fought." ;
651 monsters
[ 2 ][ 4 ]. name
= "Killer Leprechaun" ;
652 monsters
[ 2 ][ 4 ]. weapon
= "Gold Rush" ;
653 monsters
[ 2 ][ 4 ]. strength
= 35 ;
654 monsters
[ 2 ][ 4 ]. gold
= 1300 ;
655 monsters
[ 2 ][ 4 ]. exp
= 30 ;
656 monsters
[ 2 ][ 4 ]. maxhp
= 37 ;
657 monsters
[ 2 ][ 4 ]. death
= "You steal his pot of gold... that's a lot of money!" ;
659 monsters
[ 2 ][ 5 ]. name
= "Avalanche Rider" ;
660 monsters
[ 2 ][ 5 ]. weapon
= "Huge Snowball" ;
661 monsters
[ 2 ][ 5 ]. strength
= 32 ;
662 monsters
[ 2 ][ 5 ]. gold
= 700 ;
663 monsters
[ 2 ][ 5 ]. exp
= 32 ;
664 monsters
[ 2 ][ 5 ]. maxhp
= 38 ;
665 monsters
[ 2 ][ 5 ]. death
= "You take his snowboard and snap it in two!" ;
667 monsters
[ 2 ][ 6 ]. name
= "Blundering Idiot" ;
668 monsters
[ 2 ][ 6 ]. weapon
= "Stupidity" ;
669 monsters
[ 2 ][ 6 ]. strength
= 14 ;
670 monsters
[ 2 ][ 6 ]. gold
= 700 ;
671 monsters
[ 2 ][ 6 ]. exp
= 20 ;
672 monsters
[ 2 ][ 6 ]. maxhp
= 29 ;
673 monsters
[ 2 ][ 6 ]. death
= "Now there's one person you don't feel sorry for killing!" ;
675 monsters
[ 2 ][ 7 ]. name
= "Militant Anarchist" ;
676 monsters
[ 2 ][ 7 ]. weapon
= "Molotov Cocktail" ;
677 monsters
[ 2 ][ 7 ]. strength
= 33 ;
678 monsters
[ 2 ][ 7 ]. gold
= 245 ;
679 monsters
[ 2 ][ 7 ]. exp
= 45 ;
680 monsters
[ 2 ][ 7 ]. maxhp
= 32 ;
681 monsters
[ 2 ][ 7 ]. death
= "Order has been restored for now..." ;
683 monsters
[ 2 ][ 8 ]. name
= "Scathe Zombies" ;
684 monsters
[ 2 ][ 8 ]. weapon
= "Death Grip" ;
685 monsters
[ 2 ][ 8 ]. strength
= 38 ;
686 monsters
[ 2 ][ 8 ]. gold
= 763 ;
687 monsters
[ 2 ][ 8 ]. exp
= 15 ;
688 monsters
[ 2 ][ 8 ]. maxhp
= 45 ;
689 monsters
[ 2 ][ 8 ]. death
= "That was perhaps the scariest experience of your life." ;
691 monsters
[ 2 ][ 9 ]. name
= "Spitting Llama" ;
692 monsters
[ 2 ][ 9 ]. weapon
= "Spit Spray" ;
693 monsters
[ 2 ][ 9 ]. strength
= 48 ;
694 monsters
[ 2 ][ 9 ]. gold
= 638 ;
695 monsters
[ 2 ][ 9 ]. exp
= 28 ;
696 monsters
[ 2 ][ 9 ]. maxhp
= 34 ;
697 monsters
[ 2 ][ 9 ]. death
= "You wipe the spit off your face and fling it back at the Llama." ;
699 monsters
[ 2 ][ 10 ]. name
= "Juggalo" ;
700 monsters
[ 2 ][ 10 ]. weapon
= "Clown Axe" ;
701 monsters
[ 2 ][ 10 ]. strength
= 60 ;
702 monsters
[ 2 ][ 10 ]. gold
= 650 ;
703 monsters
[ 2 ][ 10 ]. exp
= 30 ;
704 monsters
[ 2 ][ 10 ]. maxhp
= 29 ;
705 monsters
[ 2 ][ 10 ]. death
= "What is a Juggalo? I don't know!" ;
707 monsters
[ 2 ][ 11 ]. name
= "The Boogie Man" ;
708 monsters
[ 2 ][ 11 ]. weapon
= "Striking Fear" ;
709 monsters
[ 2 ][ 11 ]. strength
= 46 ;
710 monsters
[ 2 ][ 11 ]. gold
= 600 ;
711 monsters
[ 2 ][ 11 ]. exp
= 35 ;
712 monsters
[ 2 ][ 11 ]. maxhp
= 27 ;
713 monsters
[ 2 ][ 11 ]. death
= "He's scared you for the very last time!" ;
715 monsters
[ 3 ][ 0 ]. name
= "Living Fire" ;
716 monsters
[ 3 ][ 0 ]. weapon
= "Scorching Wind" ;
717 monsters
[ 3 ][ 0 ]. strength
= 55 ;
718 monsters
[ 3 ][ 0 ]. gold
= 1100 ;
719 monsters
[ 3 ][ 0 ]. exp
= 36 ;
720 monsters
[ 3 ][ 0 ]. maxhp
= 55 ;
721 monsters
[ 3 ][ 0 ]. death
= "You extinguish the Living Flame once and for all!" ;
723 monsters
[ 3 ][ 1 ]. name
= "Raging Orc" ;
724 monsters
[ 3 ][ 1 ]. weapon
= "Orcish Artillary" ;
725 monsters
[ 3 ][ 1 ]. strength
= 89 ;
726 monsters
[ 3 ][ 1 ]. gold
= 900 ;
727 monsters
[ 3 ][ 1 ]. exp
= 25 ;
728 monsters
[ 3 ][ 1 ]. maxhp
= 50 ;
729 monsters
[ 3 ][ 1 ]. death
= "This orc was a bit tougher than you remembered!" ;
731 monsters
[ 3 ][ 2 ]. name
= "Huge Tarantula" ;
732 monsters
[ 3 ][ 2 ]. weapon
= "Tangling Web" ;
733 monsters
[ 3 ][ 2 ]. strength
= 59 ;
734 monsters
[ 3 ][ 2 ]. gold
= 1000 ;
735 monsters
[ 3 ][ 2 ]. exp
= 35 ;
736 monsters
[ 3 ][ 2 ]. maxhp
= 60 ;
737 monsters
[ 3 ][ 2 ]. death
= "You're glad you overcame your arachniphobia so soon!" ;
739 monsters
[ 3 ][ 3 ]. name
= "Rabid Wolf" ;
740 monsters
[ 3 ][ 3 ]. weapon
= "Cujo Bite" ;
741 monsters
[ 3 ][ 3 ]. strength
= 40 ;
742 monsters
[ 3 ][ 3 ]. gold
= 1200 ;
743 monsters
[ 3 ][ 3 ]. exp
= 47 ;
744 monsters
[ 3 ][ 3 ]. maxhp
= 76 ;
745 monsters
[ 3 ][ 3 ]. death
= "The mutt falls over dead as white foam drips from its deadly canines..." ;
747 monsters
[ 3 ][ 4 ]. name
= "Goblin Fighter" ;
748 monsters
[ 3 ][ 4 ]. weapon
= "Morning Star" ;
749 monsters
[ 3 ][ 4 ]. strength
= 38 ;
750 monsters
[ 3 ][ 4 ]. gold
= 700 ;
751 monsters
[ 3 ][ 4 ]. exp
= 30 ;
752 monsters
[ 3 ][ 4 ]. maxhp
= 75 ;
753 monsters
[ 3 ][ 4 ]. death
= "He almost caught you with his chain mace, but you sliced off his head." ;
755 monsters
[ 3 ][ 5 ]. name
= "Grizzly Bear" ;
756 monsters
[ 3 ][ 5 ]. weapon
= "Razor Claws" ;
757 monsters
[ 3 ][ 5 ]. strength
= 68 ;
758 monsters
[ 3 ][ 5 ]. gold
= 1747 ;
759 monsters
[ 3 ][ 5 ]. exp
= 81 ;
760 monsters
[ 3 ][ 5 ]. maxhp
= 51 ;
761 monsters
[ 3 ][ 5 ]. death
= "It almost got you this time... better be careful" ;
763 monsters
[ 3 ][ 6 ]. name
= "Skeleton Man" ;
764 monsters
[ 3 ][ 6 ]. weapon
= "Leg Bone" ;
765 monsters
[ 3 ][ 6 ]. strength
= 70 ;
766 monsters
[ 3 ][ 6 ]. gold
= 597 ;
767 monsters
[ 3 ][ 6 ]. exp
= 57 ;
768 monsters
[ 3 ][ 6 ]. maxhp
= 60 ;
769 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!" ;
771 monsters
[ 3 ][ 7 ]. name
= "Young Werewolf" ;
772 monsters
[ 3 ][ 7 ]. weapon
= "Howling Bites" ;
773 monsters
[ 3 ][ 7 ]. strength
= 75 ;
774 monsters
[ 3 ][ 7 ]. gold
= 1742 ;
775 monsters
[ 3 ][ 7 ]. exp
= 65 ;
776 monsters
[ 3 ][ 7 ]. maxhp
= 42 ;
777 monsters
[ 3 ][ 7 ]. death
= "You scatter the wolf's body parts in hopes he will stay dead!" ;
779 monsters
[ 3 ][ 8 ]. name
= "Dark Infantry" ;
780 monsters
[ 3 ][ 8 ]. weapon
= "Flesh Reaper" ;
781 monsters
[ 3 ][ 8 ]. strength
= 69 ;
782 monsters
[ 3 ][ 8 ]. gold
= 870 ;
783 monsters
[ 3 ][ 8 ]. exp
= 43 ;
784 monsters
[ 3 ][ 8 ]. maxhp
= 65 ;
785 monsters
[ 3 ][ 8 ]. death
= "Light has prevailed this time... but it's only so long before you meet again." ;
787 monsters
[ 3 ][ 9 ]. name
= "Erie Spirit" ;
788 monsters
[ 3 ][ 9 ]. weapon
= "Deadly Grin" ;
789 monsters
[ 3 ][ 9 ]. strength
= 63 ;
790 monsters
[ 3 ][ 9 ]. gold
= 1300 ;
791 monsters
[ 3 ][ 9 ]. exp
= 32 ;
792 monsters
[ 3 ][ 9 ]. maxhp
= 50 ;
793 monsters
[ 3 ][ 9 ]. death
= "His cousin the ghost was a little bit easier." ;
795 monsters
[ 3 ][ 10 ]. name
= "Gollum" ;
796 monsters
[ 3 ][ 10 ]. weapon
= "Precious Treasure" ;
797 monsters
[ 3 ][ 10 ]. strength
= 66 ;
798 monsters
[ 3 ][ 10 ]. gold
= 1492 ;
799 monsters
[ 3 ][ 10 ]. exp
= 73 ;
800 monsters
[ 3 ][ 10 ]. maxhp
= 54 ;
801 monsters
[ 3 ][ 10 ]. death
= "Gollum screams out \" MY PRECIOUS \" as his small body falls limp from your blow." ;
803 monsters
[ 3 ][ 11 ]. name
= "Rock Fighter" ;
804 monsters
[ 3 ][ 11 ]. weapon
= "Small Boulders" ;
805 monsters
[ 3 ][ 11 ]. strength
= 87 ;
806 monsters
[ 3 ][ 11 ]. gold
= 1742 ;
807 monsters
[ 3 ][ 11 ]. exp
= 99 ;
808 monsters
[ 3 ][ 11 ]. maxhp
= 65 ;
809 monsters
[ 3 ][ 11 ]. death
= "You dodge his last rock, and counter with a low blow, cutting off his legs." ;
812 monsters
[ 4 ][ 0 ]. name
= "Giant Sphinx" ;
813 monsters
[ 4 ][ 0 ]. weapon
= "Ancient Curse" ;
814 monsters
[ 4 ][ 0 ]. strength
= 120 ;
815 monsters
[ 4 ][ 0 ]. gold
= 1000 ;
816 monsters
[ 4 ][ 0 ]. exp
= 100 ;
817 monsters
[ 4 ][ 0 ]. maxhp
= 80 ;
818 monsters
[ 4 ][ 0 ]. death
= "You look in awe at the great wonder, collapsed at your feet!" ;
820 monsters
[ 4 ][ 1 ]. name
= "Giant Ogre" ;
821 monsters
[ 4 ][ 1 ]. weapon
= "Big Log" ;
822 monsters
[ 4 ][ 1 ]. strength
= 130 ;
823 monsters
[ 4 ][ 1 ]. gold
= 857 ;
824 monsters
[ 4 ][ 1 ]. exp
= 175 ;
825 monsters
[ 4 ][ 1 ]. maxhp
= 100 ;
826 monsters
[ 4 ][ 1 ]. death
= "Your witz outmatched the ogres brawn... big dumb thing." ;
828 monsters
[ 4 ][ 2 ]. name
= "Massive Cockroach" ;
829 monsters
[ 4 ][ 2 ]. weapon
= "Piercing Hiss" ;
830 monsters
[ 4 ][ 2 ]. strength
= 125 ;
831 monsters
[ 4 ][ 2 ]. gold
= 700 ;
832 monsters
[ 4 ][ 2 ]. exp
= 150 ;
833 monsters
[ 4 ][ 2 ]. maxhp
= 112 ;
834 monsters
[ 4 ][ 2 ]. death
= "Where's the exterminator when you need one?" ;
836 monsters
[ 4 ][ 3 ]. name
= "Big Venomous Snake" ;
837 monsters
[ 4 ][ 3 ]. weapon
= "Poison Fangs" ;
838 monsters
[ 4 ][ 3 ]. strength
= 140 ;
839 monsters
[ 4 ][ 3 ]. gold
= 900 ;
840 monsters
[ 4 ][ 3 ]. exp
= 175 ;
841 monsters
[ 4 ][ 3 ]. maxhp
= 126 ;
842 monsters
[ 4 ][ 3 ]. death
= "After killing this beast you check for puncture marks... you find none, luckily." ;
844 monsters
[ 4 ][ 4 ]. name
= "Lizard Man" ;
845 monsters
[ 4 ][ 4 ]. weapon
= "Deadly Jaws" ;
846 monsters
[ 4 ][ 4 ]. strength
= 145 ;
847 monsters
[ 4 ][ 4 ]. gold
= 1250 ;
848 monsters
[ 4 ][ 4 ]. exp
= 175 ;
849 monsters
[ 4 ][ 4 ]. maxhp
= 150 ;
850 monsters
[ 4 ][ 4 ]. death
= "His scales made for tough armor, and his jaws for a tougher opponent!" ;
852 monsters
[ 4 ][ 5 ]. name
= "Face Dancer" ;
853 monsters
[ 4 ][ 5 ]. weapon
= "Illusion Scyth" ;
854 monsters
[ 4 ][ 5 ]. strength
= 138 ;
855 monsters
[ 4 ][ 5 ]. gold
= 1603 ;
856 monsters
[ 4 ][ 5 ]. exp
= 198 ;
857 monsters
[ 4 ][ 5 ]. maxhp
= 173 ;
858 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!" ;
860 monsters
[ 4 ][ 6 ]. name
= "Darklord Longbow Archer" ;
861 monsters
[ 4 ][ 6 ]. weapon
= "Deadly Bow and Arrows" ;
862 monsters
[ 4 ][ 6 ]. strength
= 145 ;
863 monsters
[ 4 ][ 6 ]. gold
= 1569 ;
864 monsters
[ 4 ][ 6 ]. exp
= 243 ;
865 monsters
[ 4 ][ 6 ]. maxhp
= 170 ;
866 monsters
[ 4 ][ 6 ]. death
= "Your face turns white with horror after you realize you just met the devil's protector!" ;
868 monsters
[ 4 ][ 7 ]. name
= "Hell's Paladin" ;
869 monsters
[ 4 ][ 7 ]. weapon
= "Sword of Hellfire" ;
870 monsters
[ 4 ][ 7 ]. strength
= 200 ;
871 monsters
[ 4 ][ 7 ]. gold
= 2191 ;
872 monsters
[ 4 ][ 7 ]. exp
= 254 ;
873 monsters
[ 4 ][ 7 ]. maxhp
= 175 ;
874 monsters
[ 4 ][ 7 ]. death
= "This is starting to get tough you think. Do you really want to go to level 12?" ;
876 monsters
[ 4 ][ 8 ]. name
= "The Unknown Soldier" ;
877 monsters
[ 4 ][ 8 ]. weapon
= "Soul Torture" ;
878 monsters
[ 4 ][ 8 ]. strength
= 175 ;
879 monsters
[ 4 ][ 8 ]. gold
= 1890 ;
880 monsters
[ 4 ][ 8 ]. exp
= 200 ;
881 monsters
[ 4 ][ 8 ]. maxhp
= 180 ;
882 monsters
[ 4 ][ 8 ]. death
= "Who was that? Where was he from? And what was that weapon??" ;
884 monsters
[ 4 ][ 9 ]. name
= "Undead Cult Leader" ;
885 monsters
[ 4 ][ 9 ]. weapon
= "Lance of Deceit" ;
886 monsters
[ 4 ][ 9 ]. strength
= 180 ;
887 monsters
[ 4 ][ 9 ]. gold
= 1792 ;
888 monsters
[ 4 ][ 9 ]. exp
= 195 ;
889 monsters
[ 4 ][ 9 ]. maxhp
= 190 ;
890 monsters
[ 4 ][ 9 ]. death
= "His words fall on deaf ears... this is one cult you will NOT be part of!" ;
892 monsters
[ 4 ][ 10 ]. name
= "Water Serpent" ;
893 monsters
[ 4 ][ 10 ]. weapon
= "Forked Tongue" ;
894 monsters
[ 4 ][ 10 ]. strength
= 150 ;
895 monsters
[ 4 ][ 10 ]. gold
= 1500 ;
896 monsters
[ 4 ][ 10 ]. exp
= 176 ;
897 monsters
[ 4 ][ 10 ]. maxhp
= 220 ;
898 monsters
[ 4 ][ 10 ]. death
= "The serpent squeals as you cut off its head!" ;
900 monsters
[ 4 ][ 11 ]. name
= "Silverback Gorilla" ;
901 monsters
[ 4 ][ 11 ]. weapon
= "Deadly Banana Peel" ;
902 monsters
[ 4 ][ 11 ]. strength
= 160 ;
903 monsters
[ 4 ][ 11 ]. gold
= 1300 ;
904 monsters
[ 4 ][ 11 ]. exp
= 150 ;
905 monsters
[ 4 ][ 11 ]. maxhp
= 178 ;
906 monsters
[ 4 ][ 11 ]. death
= "Was that gorilla or guerilla?" ;
909 void display_monster ( char * u
)
913 aClient
* user
= find ( u
);
914 Player
* ni
= user
-> stats
;
916 notice ( s_GameServ
, u
, "Your Hitpoints: \ 2 %d \ 2 ", ni
-> hp
);
917 notice ( s_GameServ
, u
, " %s 's Hitpoints: \ 2 %d \ 2 ", ni
-> fight
-> name
, ni
-> fight
-> hp
);
918 notice ( s_GameServ
, u
, "Here are your commands:" );
919 notice ( s_GameServ
, u
, "/msg %S attack" );
920 notice ( s_GameServ
, u
, "/msg %S run" );
921 notice ( s_GameServ
, u
, "What will you do?" );
925 void display_players ( char * u
)
929 aClient
* ni
= find ( u
);
931 aClient
* battle
= ni
-> stats
-> battle
;
933 notice ( s_GameServ
, u
, "Your Hitpoints: \ 2 %d \ 2 ", ni
-> stats
-> hp
);
934 notice ( s_GameServ
, u
, " %s 's Hitpoints: \ 2 %d \ 2 ", battle
-> getNick (),
937 notice ( s_GameServ
, u
, "Here are your commands:" );
938 notice ( s_GameServ
, u
, "/msg %s attack" , s_GameServ
);
939 notice ( s_GameServ
, u
, "/msg %s run" , s_GameServ
);
940 notice ( s_GameServ
, u
, "What will you do?" );
945 bool is_playing ( char * u
)
948 if (!( user
= find ( u
)))
954 return user
-> stats
!= NULL
;
958 bool is_fighting ( char * u
)
962 if (!( user
= find ( u
)))
966 else if ( user
-> stats
)
968 return user
-> stats
-> fight
!= NULL
|| user
-> stats
-> battle
!= NULL
969 || user
-> stats
-> master
!= NULL
;
975 bool player_fight ( char * u
)
979 if (!( user
= find ( u
)))
981 else if ( user
-> stats
)
982 return user
-> stats
-> battle
!= NULL
;
987 bool master_fight ( char * u
)
991 if (!( user
= find ( u
)))
993 else if ( user
-> stats
)
994 return user
-> stats
-> master
!= NULL
;
999 bool isnt_fighting ( char * u
)
1001 return ! is_fighting ( u
);
1004 void do_fight ( char * u
)
1006 aClient
* ni
, * battle
;
1008 char * nick
= strtok ( NULL
, " " );
1012 notice ( s_GameServ
, u
, "SYNTAX: /msg %S FIGHT PLAYER" );
1014 else if (!( ni
= find ( u
)))
1018 else if (!( battle
= find ( nick
)))
1020 notice ( s_GameServ
, u
, "You can't attack %s while they aren't playing!" , nick
);
1022 else if (! is_playing ( u
))
1024 notice ( s_GameServ
, u
, "You are not playing!" );
1027 * Offline fighting not implemented yet.
1028 * else if (!(fight = finduser(nick)))
1030 * ni->stats->battle = battle;
1031 * battle->battle = ni;
1033 * battle->yourturn = 0;
1034 * notice(s_GameServ, u, "You decide to fight %s while they're not online!",
1035 * battle->getNick());
1036 * display_players(u);
1039 else if ( is_playing ( u
) && is_playing ( nick
))
1041 // Set your battle pointer to the other player
1042 ni
-> stats
-> battle
= battle
;
1044 // Set the other player's battle pointer to you
1045 battle
-> stats
-> battle
= ni
;
1047 // The initiator gets the first move (perhaps this should be 50/50)
1048 ni
-> stats
-> yourturn
= 1 ;
1049 battle
-> stats
-> yourturn
= 0 ;
1051 // Initiate Battle sequence!
1052 notice ( s_GameServ
, u
, "You challenge %s to an online duel!" , battle
-> getNick ());
1053 notice ( s_GameServ
, battle
-> getNick (), " %s has challenged you to an online duel!" , u
);
1054 notice ( s_GameServ
, battle
-> getNick (), " %s gets to go first because he initiated!" , u
);
1055 notice ( s_GameServ
, battle
-> getNick (), "Please wait while %s decides what to do." , u
);
1060 void do_attack ( char * u
)
1063 aClient
* ni
, * battle
; // The player and perhaps the player they're fighting
1064 Monster
* fight
; // The monster they may be fighting
1066 if (!( ni
= find ( u
)))
1068 notice ( s_GameServ
, u
, "You're not playing!" );
1071 else if (! ni
-> stats
-> fight
&& ! ni
-> stats
-> battle
&& ! ni
-> stats
-> master
)
1073 notice ( s_GameServ
, u
, "You're not in battle!" );
1078 if (! ni
-> stats
-> master
) // This is not a master fight
1079 fight
= ni
-> stats
-> fight
; // Monster Could be NULL
1080 else // This IS a master fight
1081 fight
= ni
-> stats
-> master
; // Master Could be NULL
1083 battle
= ni
-> stats
-> battle
; // Player Could be NULL
1085 // One has to be !NULL based on the previous else if
1086 // We wouldn't be here if they were all NULL
1089 if (! player_fight ( u
))
1092 hit
= (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ) +
1093 ( rand () % (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ));
1096 mhit
= ( fight
-> strength
/ 2 ) +
1097 ( rand () % ( fight
-> strength
/ 2 ) - ( ni
-> stats
-> defense
+
1098 arbonus
[ ni
-> stats
-> armor
]));
1103 mhit
= ((( battle
-> stats
-> strength
+ webonus
[ battle
-> stats
-> weapon
]) / 2 ) +
1104 ( rand () % (( battle
-> stats
-> strength
+ webonus
[ battle
-> stats
-> weapon
])) / 2 ) -
1105 ( ni
-> stats
-> defense
+ arbonus
[ ni
-> stats
-> armor
]));
1108 hit
= ((( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ) +
1109 ( rand () % (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
])) / 2 ) -
1110 ( battle
-> stats
-> defense
+ arbonus
[ battle
-> stats
-> armor
]));
1113 if (! player_fight ( u
))
1116 notice ( s_GameServ
, u
, "You attack \1f %s \1f for \ 2 %d \ 2 points!", fight
-> name
, hit
);
1118 notice ( s_GameServ
, u
, "You miss \1f %s \1f completely!", fight
-> name
);
1120 if ( hit
>= fight
-> hp
)
1122 if ( master_fight ( u
))
1123 notice ( s_GameServ
, u
, "You have bested %s !" , fight
-> name
);
1125 notice ( s_GameServ
, u
, "You have killed \ 2 %s \ 2 !", fight
-> name
);
1127 notice ( s_GameServ
, u
, " %s " , fight
-> death
);
1128 notice ( s_GameServ
, u
, "You recieve \ 2 %d \ 2 experience and \ 2 %d \ 2 gold!",
1129 fight
-> exp
, fight
-> gold
);
1131 // If your new experience (or gold) will be greater than 2 billion,
1132 // then set your exp to 2bil. (2 billion max)... otherwise add them.
1133 // This could be a problem with overflowing out of the sign bit.
1134 // Unsigned long int maybe? Leave it for now.
1135 ni
-> stats
-> exp
= ( ( ni
-> stats
-> exp
+ fight
-> exp
) > 2000000000 ? 2000000000 :
1136 ni
-> stats
-> exp
+ fight
-> exp
);
1137 ni
-> stats
-> gold
= ( ni
-> stats
-> gold
+ fight
-> gold
> 2000000000 ? 2000000000 :
1138 ni
-> stats
-> gold
+ fight
-> gold
);
1139 ni
-> stats
-> fight
= NULL
; // They're dead so remove the pointer
1141 if ( master_fight ( u
))
1143 notice ( s_GameServ
, u
, "You are now level %d !" , ni
-> stats
-> level
+ 1 );
1144 notice ( s_GameServ
, u
, "You gain %d Strength, and %d Defense points!" ,
1145 strbonus
[ ni
-> stats
-> level
- 1 ], defbonus
[ ni
-> stats
-> level
- 1 ]);
1147 // Increase your level
1150 // Increase your maximum hit points
1151 ni
-> stats
-> maxhp
+= hpbonus
[ ni
-> stats
-> level
- 1 ];
1153 // Heal the player by setting hp to their max
1154 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1156 // Add to your strength
1157 ni
-> stats
-> strength
+= strbonus
[ ni
-> stats
-> level
- 1 ];
1159 // Add to your defensive power
1160 ni
-> stats
-> defense
+= defbonus
[ ni
-> stats
-> level
- 1 ];
1162 // Clear the pointer for your master
1163 ni
-> stats
-> master
= NULL
;
1173 notice ( s_GameServ
, u
, "\1f %s \1f hits you with their \1f %s \1f for \ 2 %d \ 2 damage!",
1174 fight
-> name
, fight
-> weapon
, mhit
);
1177 notice ( s_GameServ
, u
, " %s completely misses you!" , fight
-> name
);
1179 if ( mhit
>= ni
-> stats
-> hp
)
1181 if (! master_fight ( u
))
1183 notice ( s_GameServ
, u
, "You have been \ 2 \1f killed\1f \ 2 by %s !" , fight
-> name
);
1184 notice ( s_GameServ
, u
, "You lose all gold on hand and lose 10 percent " \
1185 "of your experience!" );
1186 ni
-> stats
-> gold
= 0 ;
1187 ni
-> stats
-> exp
-= ( long int )( ni
-> stats
-> exp
* .10 );
1188 ni
-> stats
-> fight
= NULL
;
1193 notice ( s_GameServ
, u
, " %s has bested you! You will have to wait " \
1194 "until tomorrow to try again" , ni
-> stats
-> master
-> name
);
1195 ni
-> stats
-> fight
= NULL
;
1196 ni
-> stats
-> master
= NULL
;
1203 ni
-> stats
-> hp
-= mhit
;
1209 else if ( player_fight ( u
))
1211 /* Offline fighting not available yet
1212 if (!(online = finduser(ni->stats->battle->nick)) || !nick_identified(online))
1215 notice(s_GameServ, u, "You attack \1f %s\1f for \ 2 %d\ 2 points!", battle->nick, hit);
1217 notice(s_GameServ, u, "You miss \1f %s\1f completely!", battle->nick);
1218 if (hit >= battle->stats->hp)
1220 notice(s_GameServ, u, "You have killed \ 2 %s\ 2 !", battle->nick);
1221 * notice(s_GameServ, u, "You recieve \ 2 %d\ 2 experience and \ 2 %ld\ 2 gold!",
1222 (long int)(battle->stats->exp * .10), battle->stats->gold);
1223 if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
1225 ni->stats->exp += (long int)(battle->stats->exp * .10);
1226 battle->stats->exp -= (long int)(battle->stats->exp * .10);
1230 battle->stats->exp -= (long int)(battle->stats->exp * .10);
1231 ni->stats->exp = 2000000000;
1234 if (2000000000 - ni->stats->gold > battle->stats->gold)
1236 * ni->stats->gold += battle->stats->gold;
1237 battle->stats->gold = 0;
1241 battle->stats->gold = 2000000000 - ni->stats->gold;
1242 ni->stats->gold = 2000000000;
1244 * ni->stats->battle->stats->alive = 0;
1245 ni->stats->battle->battle = NULL;
1246 ni->stats->battle = NULL;
1252 * battle->stats->hp -= hit;
1255 notice(s_GameServ, u, "\1f %s\1f hits you with their \1f %s\1f for \ 2 %d\ 2 damage!",
1256 battle->nick, weapons[battle->stats->weapon], mhit);
1259 notice(s_GameServ, u, "%s completely misses you!", battle->nick);
1261 if (mhit >= ni->stats->hp)
1263 notice(s_GameServ, u, "You have been \ 2 \1f killed\1f \ 2 by %s!", battle->nick);
1264 if (2000000000 - battle->stats->gold > ni->stats->gold)
1266 notice(s_GameServ, u, "%s took all your gold!", battle->nick);
1267 battle->stats->gold += ni->stats->gold;
1268 * ni->stats->gold = 0;
1272 notice(s_GameServ, u, "You're lucky, %s couldn't carry all your gold.",
1274 ni->stats->gold -= (2000000000 - battle->stats->gold);
1275 notice(s_GameServ, u, "You were left dead with %d gold.",
1276 * (long int)ni->stats->gold);
1277 battle->stats->gold = 2000000000;
1279 ni->stats->battle->battle = NULL;
1280 ni->stats->battle = NULL;
1281 ni->stats->alive = 0;
1287 ni->stats->hp -= mhit;
1293 * end offline fighting */
1295 if ( is_playing ( battle
-> getNick ()))
1297 if ( ni
-> stats
-> yourturn
== 0 )
1299 notice ( s_GameServ
, u
, "Please wait until %s decides what to do!" ,
1305 notice ( s_GameServ
, u
, "You attack \1f %s \1f for \ 2 %d \ 2 points!", battle
-> getNick (), hit
);
1307 notice ( s_GameServ
, battle
-> getNick (), " %s has hit you with their %s for " \
1308 "\ 2 %d \ 2 damage!", u
, weapons
[ ni
-> stats
-> weapon
],
1310 ni
-> stats
-> yourturn
= 0 ;
1311 battle
-> stats
-> yourturn
= 1 ;
1312 display_players ( battle
-> getNick ());
1316 notice ( s_GameServ
, u
, "You miss \1f %s \1f completely!", battle
-> getNick ());
1317 notice ( s_GameServ
, battle
-> getNick (), " %s misses you completely!" , u
);
1318 ni
-> stats
-> yourturn
= 0 ;
1319 battle
-> stats
-> yourturn
= 1 ;
1320 display_players ( battle
-> getNick ());
1322 if ( hit
>= battle
-> stats
-> hp
)
1324 notice ( s_GameServ
, u
, "You have killed \ 2 %s \ 2 !", battle
-> getNick ());
1325 notice ( s_GameServ
, u
, "You recieve \ 2 %d \ 2 experience and \ 2 %l d\ 2 gold!" ,
1326 ( long int )( battle
-> stats
-> exp
* .10 ), battle
-> stats
-> gold
);
1327 notice ( s_GameServ
, battle
-> getNick (), "You have been killed by \ 2 %s \ 2 !", u
);
1328 battle
-> stats
-> hp
= 0 ;
1329 battle
-> stats
-> alive
= 0 ;
1331 if ( 2000000000 - ni
-> stats
-> exp
> ( long int )( battle
-> stats
-> exp
* .10 ))
1333 ni
-> stats
-> exp
+= ( long int )( battle
-> stats
-> exp
* .10 );
1334 battle
-> stats
-> exp
-= ( long int )( battle
-> stats
-> exp
* .10 );
1338 battle
-> stats
-> exp
-= ( long int )( battle
-> stats
-> exp
* .10 );
1339 ni
-> stats
-> exp
= 2000000000 ;
1342 if ( 2000000000 - ni
-> stats
-> gold
> battle
-> stats
-> gold
)
1344 notice ( s_GameServ
, battle
-> getNick (), "You lose ten percent of experience and " \
1345 "all gold on hand!" );
1346 ni
-> stats
-> gold
+= battle
-> stats
-> gold
;
1347 battle
-> stats
-> gold
= 0 ;
1351 battle
-> stats
-> gold
= 2000000000 - ni
-> stats
-> gold
;
1352 notice ( s_GameServ
, battle
-> getNick (), "You lose ten percent of your experience!" );
1354 notice ( s_GameServ
, battle
-> getNick (), "However, %s could not carry all of your " \
1357 notice ( s_GameServ
, battle
-> getNick (), "Luckily, you still have \ 2 %l d\ 2 gold " \
1358 "left. All is not lost!" , battle
-> stats
-> gold
);
1360 ni
-> stats
-> gold
= 2000000000 ;
1362 battle
-> stats
-> battle
= NULL
;
1363 ni
-> stats
-> battle
= NULL
;
1369 battle
-> stats
-> hp
-= hit
;
1370 //display_players(battle->getNick());
1371 ni
-> stats
-> yourturn
= 0 ;
1372 battle
-> stats
-> yourturn
= 1 ;
1373 notice ( s_GameServ
, u
, "Please wait while %s decides what to do!" ,
1381 void do_heal ( char * u
)
1384 char * amount
= strtok ( NULL
, " " );
1389 notice ( s_GameServ
, u
, "SYNTAX: /msg %S HEAL {ALL | #}" );
1391 else if (!( ni
= find ( u
)) || ! ni
-> stats
)
1393 notice ( s_GameServ
, u
, "You aren't playing!" );
1395 else if ( is_fighting ( u
))
1397 notice ( s_GameServ
, u
, "You can't heal in battle!" );
1399 else if ( ni
-> stats
-> hp
>= ni
-> stats
-> maxhp
)
1401 notice ( s_GameServ
, u
, "You don't need healing!" );
1403 else if ( stricmp ( amount
, "ALL" ) == 0 )
1405 price
= ni
-> stats
-> level
* 3 ;
1406 if ( ni
-> stats
-> gold
< ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
) * price
)
1408 notice ( s_GameServ
, u
, "Healing \ 2 %d \ 2 points for \ 2 %d \ 2 gold per point.",
1409 ( long int ) ni
-> stats
-> gold
/ price
, price
);
1410 ni
-> stats
-> hp
+= ni
-> stats
-> gold
/ price
;
1411 ni
-> stats
-> gold
%= price
;
1415 notice ( s_GameServ
, u
, "Healing all possible points at \ 2 %d \ 2 gold "\
1416 "per point." , price
);
1417 notice ( s_GameServ
, u
, "\ 2 %d \ 2 points healed. HP at MAX!",
1418 ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
));
1419 ni
-> stats
-> gold
-= price
* ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
);
1420 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1423 else if ( isstringnum ( amount
))
1425 num
= stringtoint ( amount
);
1426 price
= ni
-> stats
-> level
* 3 ;
1427 if ( ni
-> stats
-> gold
< price
* num
)
1429 notice ( s_GameServ
, u
, "You only have enough gold to heal \ 2 %d \ 2 points!",
1430 ( long int ) ni
-> stats
-> gold
/ price
);
1432 else if ( num
<= ni
-> stats
-> maxhp
- ni
-> stats
-> hp
)
1434 notice ( s_GameServ
, u
, "Healing \ 2 %d \ 2 points at \ 2 %d \ 2 gold per point.",
1436 ni
-> stats
-> hp
+= num
;
1437 ni
-> stats
-> gold
-= num
* price
;
1439 else if ( num
> ni
-> stats
-> maxhp
- ni
-> stats
-> hp
)
1441 notice ( s_GameServ
, u
, "Healing all possible points at \ 2 %d \ 2 gold "\
1442 "per point." , price
);
1443 notice ( s_GameServ
, u
, "\ 2 %d \ 2 points healed. HP at MAX!",
1444 ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
));
1445 ni
-> stats
-> gold
-= price
* ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
);
1446 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1449 else if ( amount
[ 0 ] == '-' )
1450 notice ( s_GameServ
, u
, "You trying to cheat?" );
1452 notice ( s_GameServ
, u
, "SYNTAX: /msg %S HEAL {ALL | #}" );
1455 int isstringnum ( char * num
)
1458 for ( x
= 0 ; x
< strlen ( num
); x
++)
1460 if (( int ) num
[ x
] < 48 || ( int ) num
[ x
] > 57 )
1466 long int stringtoint ( char * number
)
1468 long int x
, len
= strlen ( number
), sum
= 0 ;
1470 return chartoint ( number
[ 0 ]);
1471 sum
+= chartoint ( number
[ len
- 1 ]);
1472 for ( x
= len
- 2 ; x
>= 0 ; x
--)
1474 sum
+= chartoint ( number
[ x
]) * pow ( 10 , abs ( x
- len
+ 1 ));
1479 long int pow ( int x
, int y
)
1485 if ( x
!= 0 && y
!= 0 )
1487 for ( count
= 1 ; count
<= y
- 1 ; count
++)
1495 long int chartoint ( char ch
)
1530 ListNode
< aClient
> * ptr
= players
. First ();
1534 outfile
. open ( playerdata
);
1538 cerr
<< "Error opening " << playerdata
<< endl
;
1544 it
= ptr
-> getData ()-> stats
;
1545 outfile
<< it
-> name
<< ' ' << it
-> level
<< ' ' << it
-> exp
<< ' ' << it
-> gold
<< ' ' << it
-> bank
<< ' '
1546 << it
-> hp
<< ' ' << it
-> maxhp
<< ' ' << it
-> strength
<< ' ' << it
-> defense
<< ' '
1547 << it
-> armor
<< ' ' << it
-> weapon
<< ' ' << ( it
-> alive
? "alive" : "dead" ) << ' '
1548 << it
-> forest_fights
<< ' ' << it
-> player_fights
<< endl
;
1559 char * alive
, * tempname
, * buf
;
1560 buf
= new char [ 1023 ];
1562 infile
. open ( playerdata
);
1566 cerr
<< "Error opening " << playerdata
<< endl
;
1570 while ( infile
. getline ( buf
, 1024 , ' \n ' ))
1573 tempname
= strtok ( buf
, " " );
1574 temp
-> stats
= new Player ( tempname
);
1577 //Kain 1 1 0 500 10 10 0 0 1 1 alive 100 3
1578 p
-> level
= stringtoint ( strtok ( NULL
, " " ));
1579 p
-> exp
= stringtoint ( strtok ( NULL
, " " ));
1580 p
-> gold
= stringtoint ( strtok ( NULL
, " " ));
1581 p
-> bank
= stringtoint ( strtok ( NULL
, " " ));
1582 p
-> hp
= stringtoint ( strtok ( NULL
, " " ));
1583 p
-> maxhp
= stringtoint ( strtok ( NULL
, " " ));
1584 p
-> strength
= stringtoint ( strtok ( NULL
, " " ));
1585 p
-> defense
= stringtoint ( strtok ( NULL
, " " ));
1586 p
-> armor
= stringtoint ( strtok ( NULL
, " " ));
1587 p
-> weapon
= stringtoint ( strtok ( NULL
, " " ));
1588 alive
= strtok ( NULL
, " " );
1589 p
-> alive
= ( stricmp ( alive
, "ALIVE" ) == 0 ? true : false );
1590 p
-> forest_fights
= stringtoint ( strtok ( NULL
, " " ));
1591 p
-> player_fights
= stringtoint ( strtok ( NULL
, " " ));
1592 temp
-> setNick ( "NULL" );
1594 printf ( " %s %d %l d %l d %l d %d %d %d %d %d %d %s %d %d \n " , p
-> name
, p
-> level
, p
-> exp
, p
-> gold
, p
-> bank
, p
-> hp
, p
-> maxhp
, p
-> strength
, p
-> defense
, p
-> armor
, p
-> weapon
, alive
, p
-> forest_fights
, p
-> player_fights
);
1595 players
. insertAtBack ( temp
);