]>
jfr.im git - irc/gameservirc.git/blob - gameserv/gameserv.cpp
9 #define LEVELS 5 // Number of character levels in the game
10 #define MONSTERS 12 // Monsters per level
12 List
< aClient
> players
;
13 Monster
* monsters
[ LEVELS
][ MONSTERS
]; // Monsters per level. Total = MONSTERS * LEVELS
15 Monster
* masters
[ LEVELS
]; // A master for each level
23 char * strtok ( char * str
, const char * delim
);
24 int stricmp ( const char * s1
, const char * s2
);
25 int strnicmp ( const char * s1
, const char * s2
, size_t len
);
29 /********** Password functions **********/
31 bool passcmp ( char * encrypted
, char * plaintext
); // Compares an encrypted pass with a plain text one
33 bool check_password ( char * name
, char * plaintext
); // Finds a password for the given name, and checks it with passcmp against the plaintext password given.
35 /********** Password functions **********/
38 /********** GameServ Booleans **********/
40 bool is_playing ( char * u
); // True if the given nickname in the clients list is playing.
41 bool has_started ( char * u
); // True if the given nickname in the clients list has started playing.
42 bool is_fighting ( char * u
); // True if the given nick in the clients list is fighting anything.
43 bool isnt_fighting ( char * u
); // True if the given nick isn't fighting. Same as !is_fighting(u).
44 bool player_fight ( char * u
); // True if the player is fighting another player.
45 bool master_fight ( char * u
); // True if the player is fighting their master.
47 /********** GameServ Booleans **********/
50 void display_monster ( char * u
);
51 void display_players ( char * u
);
52 long int chartoint ( char ch
);
53 int isstringnum ( char * num
);
54 long int pow ( int x
, int y
);
55 long int stringtoint ( char * number
);
57 char * spaces ( int len
, char * seperator
);
58 void refresh ( aClient
* ni
);
60 void reset ( aClient
* ni
);
63 void delete_monsters ();
64 void delete_masters ();
66 void do_list ( char * u
);
67 void do_register ( char * u
);
68 void do_identify ( char * u
);
69 void do_play ( char * u
);
70 void do_quitg ( char * u
);
71 void do_reset ( char * u
);
72 void do_fight ( char * u
);
73 void do_store ( char * u
);
74 void do_heal ( char * u
);
75 void do_bank ( char * u
);
76 void do_attack ( char * u
);
78 void do_visit ( char * u
);
79 void do_stats ( char * u
);
80 void see_mystic ( char * u
);
82 void showstats ( const char * u
, const char * nick
);
85 char * weapons
[ WNA
] = { "Fists" , "Stick" , "Dagger" , "Quarterstaff" , "Short Sword" ,
86 "Long Sword" , "Silver Spear" , "Battle Axe" , "The Ragnarok" ,
87 "Chain Saw" , "Poison Sword" , "Flame Sword" , "Earth Hammer" ,
88 "Light Saber" , "Masamune" , "Mystical Sword" };
90 char * armors
[ WNA
] = { "Nothing" , "Clothes" , "Leather Vest" , "Chain Mail" , "Plate Armor" ,
91 "Full Body Armor" , "Magic Mail" , "Graphite Suit" , "Steel Suit" ,
92 "Force Field" , "Armor of Light" , "Mythril Vest" , "DemiGod Armor" ,
93 "Hades' Cloak" , "Dragon Scales" , "Mystical Armor" };
95 int prices
[ WNA
- 1 ] = { 200 , 1000 , 3000 , 10000 , 30000 , 100000 , 150000 , 200000 , 400000 ,
96 1000000 , 4000000 , 10000000 , 40000000 , 100000000 , 400000000 };
97 int webonus
[ WNA
] = { 0 , 10 , 15 , 25 , 35 , 45 , 65 , 85 , 125 , 185 , 255 , 355 , 505 , 805 , 1205 , 1805 };
98 int arbonus
[ WNA
] = { 0 , 1 , 3 , 10 , 15 , 25 , 35 , 50 , 75 , 100 , 150 , 225 , 300 , 400 , 600 , 1000 };
100 int hpbonus
[ 11 ] = { 10 , 15 , 20 , 30 , 50 , 75 , 125 , 185 , 250 , 350 , 550 };
101 int strbonus
[ 11 ] = { 5 , 7 , 10 , 12 , 20 , 35 , 50 , 75 , 110 , 150 , 200 };
102 int defbonus
[ 11 ] = { 2 , 3 , 5 , 10 , 15 , 22 , 35 , 60 , 80 , 120 , 150 };
105 void gameserv ( char * source
, char * buf
)
107 char * cmd
, input
[ 1024 ];
108 cmd
= strtok ( buf
, " " );
110 source
++; // Get rid of that : at the beginning of a :Nick privmsg Gameserv :text
111 cmd
++; // Get rid of that : at the beginning of the :text (command)
113 cout
<< "Source: " << source
<< " \n cmd: " << cmd
<< endl
;
114 if ( strnicmp ( cmd
, ":\1PING" , 6 ) == 0 )
117 timestamp
= strtok ( NULL
, "\1" );
118 notice ( s_GameServ
, source
, "\1PING %s \1" , timestamp
);
119 } else if ( stricmp ( cmd
, ":\1VERSION\1" ) == 0 ) {
120 notice ( s_GameServ
, source
, "\1VERSION GameServ v1.0b\1" );
121 } else if ( stricmp ( cmd
, "SEARCH" ) == 0 ) {
122 cmd
= strtok ( NULL
, " " );
125 notice ( s_GameServ
, source
, "SYNTAX: /msg %S SEARCH FOREST" );
128 } else if ( stricmp ( cmd
, "FIGHT" ) == 0 ) {
130 } else if ( stricmp ( cmd
, "ATTACK" ) == 0 ) {
132 } else if ( stricmp ( cmd
, "RUN" ) == 0 ) {
134 } else if ( stricmp ( cmd
, "HEAL" ) == 0 ) {
136 } else if ( stricmp ( cmd
, "STORE" ) == 0 ) {
138 } else if ( stricmp ( cmd
, "BANK" ) == 0 ) {
140 } else if ( stricmp ( cmd
, "PRINT" ) == 0 ) {
141 cout
<< "Printing Clients List: " << endl
;
143 cout
<< " \n Printing Player List: " << endl
;
145 } else if ( stricmp ( cmd
, "LIST" ) == 0 ) {
147 } else if ( stricmp ( cmd
, "REGISTER" ) == 0 ) {
149 } else if ( stricmp ( cmd
, "IDENTIFY" ) == 0 ) {
151 } else if ( stricmp ( cmd
, "HELP" ) == 0 ) {
152 } else if ( stricmp ( cmd
, "STATS" ) == 0 ) {
154 } else if ( stricmp ( cmd
, "SHUTDOWN" ) == 0 ) {
156 raw ( "SQUIT %s :leaving" , servername
);
157 } else if ( stricmp ( cmd
, "SAVE" ) == 0 ) {
159 } else if ( stricmp ( cmd
, "LOAD" ) == 0 ) {
161 } else if ( stricmp ( cmd
, "RAW" ) == 0 ) {
162 char * rest
= strtok ( NULL
, "" );
166 source
--; // Bring the : back so we don't leak memory
167 cmd
--; // Same thing :)
170 int stricmp ( const char * s1
, const char * s2
)
174 while (( c
= tolower (* s1
)) == tolower (* s2
)) {
180 if ( c
< tolower (* s2
))
185 void showstats ( const char * u
, const char * nick
)
187 aClient
* ni
, * sender
= find ( u
);
193 cout
<< " \n\n u: " << u
<< " \n nick: " << nick
<< endl
;
194 if (!( ni
= findbynick ( nick
)))
196 notice ( s_GameServ
, u
, " %s not found" , nick
);
201 notice ( s_GameServ
, sender
-> getNick (), "Stats for %s :" , ni
-> stats
-> name
);
203 sprintf ( buf
, "Experience: %l d" , ni
-> stats
-> exp
);
204 space
= spaces ( strlen ( buf
), " " );
205 notice ( s_GameServ
, sender
-> getNick (), " %s%s Level: %d " , buf
, space
,
209 sprintf ( buf
, "Gold: %l d" , ni
-> stats
-> gold
);
210 space
= spaces ( strlen ( buf
), " " );
211 notice ( s_GameServ
, sender
-> getNick (), " %s%s Gold in Bank: %l d" , buf
, space
, ni
-> stats
-> bank
);
214 notice ( s_GameServ
, sender
-> getNick (), "Health Points: %d of %d " , ni
-> stats
-> hp
,
217 sprintf ( buf
, "Strength: %d " , ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]);
218 space
= spaces ( strlen ( buf
), " " );
219 notice ( s_GameServ
, sender
-> getNick (), " %s%s Defense: %d " ,
220 buf
, space
, ni
-> stats
-> defense
+ arbonus
[ ni
-> stats
-> armor
]);
223 sprintf ( buf
, "Armor: %s " , armors
[ ni
-> stats
-> armor
]);
224 space
= spaces ( strlen ( buf
), " " );
225 notice ( s_GameServ
, sender
-> getNick (), " %s%s Weapon: %s " , buf
, space
,
226 weapons
[ ni
-> stats
-> weapon
]);
229 sprintf ( buf
, "Forest Fights: %d " , ni
-> stats
-> forest_fights
);
230 space
= spaces ( strlen ( buf
), " " );
231 notice ( s_GameServ
, sender
-> getNick (), " %s%s Player Fights: %d " , buf
, space
, ni
-> stats
-> player_fights
);
238 char * spaces ( int len
, char * seperator
)
241 final
= new char [ 40 ];
243 strcpy ( final
, seperator
);
244 for ( y
= 0 ; y
< 40 - len
; y
++)
245 strcat ( final
, seperator
);
249 void raw ( const char * fmt
, ...)
254 input
= new char [ 1024 ];
256 memset ( input
, 0 , sizeof ( input
)); // Initialize to NULL
262 case 'd' : sprintf ( input
, " %s%d " , input
, va_arg ( args
, int )); break ;
263 case 's' : sprintf ( input
, " %s%s " , input
, va_arg ( args
, char *)); break ;
264 case 'S' : sprintf ( input
, " %s%s " , input
, s_GameServ
); break ;
267 sprintf ( input
, " %s%l d" , input
, va_arg ( args
, long int )); break ;
272 sprintf ( input
, " %s%c " , input
, * t
);
276 sprintf ( input
, " %s%s " , input
, " \r\n " );
277 cout
<< "input: " << input
<< flush
;
278 sock_puts ( sock
, input
);
282 /* Send a NOTICE from the given source to the given nick. */
284 void notice ( const char * source
, const char * dest
, const char * fmt
, ...)
289 input
= new char [ 1024 ];
294 sprintf ( input
, ": %s NOTICE %s :" , source
, dest
);
298 sprintf ( input
, ": %s NOTICE %s :" , source
, dest
);
305 case 'd' : sprintf ( input
, " %s%d " , input
, va_arg ( args
, int )); break ;
306 case 's' : sprintf ( input
, " %s%s " , input
, va_arg ( args
, char *)); break ;
307 case 'S' : sprintf ( input
, " %s%s " , input
, s_GameServ
); break ;
310 sprintf ( input
, " %s%l d" , input
, va_arg ( args
, long int )); break ;
315 sprintf ( input
, " %s%c " , input
, * t
);
319 sprintf ( input
, " %s%s " , input
, " \r\n " );
320 cout
<< "input: " << input
<< flush
;
321 sock_puts ( sock
, input
);
327 int strnicmp ( const char * s1
, const char * s2
, size_t len
)
333 while (( c
= tolower (* s1
)) == tolower (* s2
) && len
> 0 ) {
334 if ( c
== 0 || -- len
== 0 )
339 if ( c
< tolower (* s2
))
344 char * strtok ( char * str
, const char * delim
)
346 static char * current
= NULL
;
353 current
+= strspn ( current
, delim
);
354 ret
= * current
? current
: NULL
;
355 current
+= strcspn ( current
, delim
);
363 void do_list ( char * u
)
365 ListNode
< aClient
> * temp
;
366 temp
= players
. First ();
367 if (! players
. isEmpty ())
369 notice ( s_GameServ
, u
, "People Playing:" );
372 notice ( s_GameServ
, u
, "IRC: %s Game: %s " , temp
-> getData ()-> getNick (), temp
-> getData ()-> stats
-> name
);
375 notice ( s_GameServ
, u
, "End of List" );
378 notice ( s_GameServ
, u
, "No one is playing" );
380 void do_register ( char * u
)
384 password
= strtok ( NULL
, " " );
386 static char saltChars
[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./" ;
389 salt
[ 0 ] = saltChars
[ rand () % strlen ( saltChars
)];
390 salt
[ 1 ] = saltChars
[ rand () % strlen ( saltChars
)];
395 notice ( s_GameServ
, u
, "SYNTAX: /msg %S REGISTER PASSWORD" );
397 else if ( user
= find ( u
))
401 user
-> stats
= new Player ( user
);
402 user
-> stats
-> started
= 1 ;
403 user
-> stats
-> user
= user
; // Set the backwards pointer
404 strcpy ( user
-> stats
-> password
, crypt ( password
, salt
));
405 players
. insertAtBack ( user
);
409 notice ( s_GameServ
, u
, "Already registered. Contact a %S admin for help." );
414 void do_identify ( char * u
)
416 char * password
, * name
;
418 name
= strtok ( NULL
, " " );
419 password
= strtok ( NULL
, " " );
421 if (! password
|| ! name
)
423 notice ( s_GameServ
, u
, "SYNTAX: /msg %S IDENTIFY NAME PASSWORD" );
425 else if (!( p
= findplayer ( name
)) || ! p
-> stats
)
426 notice ( s_GameServ
, u
, "Player %s not found" , name
);
427 else if (! check_password ( name
, password
))
429 notice ( s_GameServ
, u
, "Password incorrect" );
431 else if ( user
= find ( u
))
435 ListNode
< aClient
> * temp
;
436 temp
= players
. Find ( p
);
439 notice ( s_GameServ
, u
, "Fatal error. Contact %S Admin. Buf: %s " ,
443 user
-> stats
= new Player ( p
-> stats
-> name
);
444 cout
<< "Setting data for identified" << endl
;
445 user
-> stats
-> setData ( p
-> stats
);
446 cout
<< "Player Identified" << endl
<< flush
;
450 notice ( s_GameServ
, u
, "Password Accepted. Identified." );
455 notice ( s_GameServ
, u
, "Already identified. Contact a %S admin for help." );
460 void do_stats ( char * u
)
465 nick
= strtok ( NULL
, " " );
469 showstats ( u
, source
-> getNick ());
477 for ( int x
= 0 ; x
< LEVELS
; x
++)
478 masters
[ x
] = new Monster
;
480 strcpy ( masters
[ 0 ]-> name
, "Old Bones" );
481 strcpy ( masters
[ 0 ]-> weapon
, "Dull Sword Cane" );
482 masters
[ 0 ]-> strength
= 30 ;
483 masters
[ 0 ]-> gold
= 0 ;
485 masters
[ 0 ]-> maxhp
= 30 ;
486 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!" );
488 strcpy ( masters
[ 1 ]-> name
, "Master Chang" );
489 strcpy ( masters
[ 1 ]-> weapon
, "Nanchaku" );
490 masters
[ 1 ]-> strength
= 57 ;
491 masters
[ 1 ]-> gold
= 0 ;
493 masters
[ 1 ]-> maxhp
= 40 ;
494 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." );
496 strcpy ( masters
[ 2 ]-> name
, "Chuck Norris" );
497 strcpy ( masters
[ 2 ]-> weapon
, "Ranger Kick" );
498 masters
[ 2 ]-> strength
= 85 ;
499 masters
[ 2 ]-> gold
= 0 ;
501 masters
[ 2 ]-> maxhp
= 70 ;
502 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!" );
505 strcpy ( masters
[ 3 ]-> name
, "Mr. Miagi" );
506 strcpy ( masters
[ 3 ]-> weapon
, "Petrified Bonsai" );
507 masters
[ 3 ]-> strength
= 100 ;
508 masters
[ 3 ]-> gold
= 0 ;
510 masters
[ 3 ]-> maxhp
= 120 ;
511 strcpy ( masters
[ 3 ]-> death
, "Skill comes from repeating the correct but seemingly mundane actions. Wax ON, wax OFF!" );
513 strcpy ( masters
[ 4 ]-> name
, "Jackie Chan" );
514 strcpy ( masters
[ 4 ]-> weapon
, "Drunken Boxing" );
515 masters
[ 4 ]-> strength
= 125 ;
516 masters
[ 4 ]-> maxhp
= 200 ;
517 masters
[ 4 ]-> gold
= 0 ;
519 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!" );
521 strcpy ( masters
[ 5 ]-> name
, "Jet Li" );
522 strcpy ( masters
[ 5 ]-> weapon
, "Motorcycle" );
523 masters
[ 5 ]-> strength
= 150 ;
524 masters
[ 5 ]-> maxhp
= 400 ;
525 masters
[ 5 ]-> gold
= 0 ;
527 strcpy ( masters
[ 5 ]-> death
, "Failure is a fuel for excuses. It's the doing the do, that makes the making." );
530 strcpy ( masters
[ 6 ]-> name
, "Muhammad Ali" );
531 strcpy ( masters
[ 6 ]-> weapon
, "Quick Jab" );
532 masters
[ 6 ]-> strength
= 175 ;
533 masters
[ 6 ]-> maxhp
= 600 ;
534 masters
[ 6 ]-> gold
= 0 ;
536 strcpy ( masters
[ 6 ]-> death
, "It's just a job. Grass grows, birds fly, waves pound the sand. I beat people up." );
538 strcpy ( masters
[ 7 ]-> name
, "Li Mu Bai" );
539 strcpy ( masters
[ 7 ]-> weapon
, "Green Destiny" );
540 masters
[ 7 ]-> strength
= 200 ;
541 masters
[ 7 ]-> maxhp
= 800 ;
542 masters
[ 7 ]-> gold
= 0 ;
544 strcpy ( masters
[ 7 ]-> death
, "No growth without resistance. No action without reaction. No desire without restraint." );
547 strcpy ( masters
[ 8 ]-> name
, "Jimmy Wang Yu" );
548 strcpy ( masters
[ 8 ]-> weapon
, "Flying Guillotine" );
549 masters
[ 8 ]-> strength
= 275 ;
550 masters
[ 8 ]-> maxhp
= 1200 ;
551 masters
[ 8 ]-> gold
= 0 ;
553 strcpy ( masters
[ 8 ]-> death
, "You have beaten the one armed boxer. Proceed with caution!" );
555 strcpy ( masters
[ 9 ]-> name
, "Wong Fei Hung" );
556 strcpy ( masters
[ 9 ]-> weapon
, "Drunken Boxing" );
557 masters
[ 9 ]-> strength
= 350 ;
558 masters
[ 9 ]-> maxhp
= 1800 ;
559 masters
[ 9 ]-> gold
= 0 ;
561 strcpy ( masters
[ 9 ]-> death
, "Hiccup!" );
563 strcpy ( masters
[ 10 ]-> name
, "Bruce Lee" );
564 strcpy ( masters
[ 10 ]-> weapon
, "Fists of fury" );
565 masters
[ 10 ]-> strength
= 575 ;
566 masters
[ 10 ]-> maxhp
= 2500 ;
567 masters
[ 10 ]-> gold
= 0 ;
568 masters
[ 10 ]-> exp
= 0 ;
569 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." );
575 for ( int x
= 0 ; x
< LEVELS
; x
++)
576 for ( int y
= 0 ; y
< MONSTERS
; y
++)
577 monsters
[ x
][ y
] = new Monster ();
579 // Hard coded for now - Kain
581 strcpy ( monsters
[ 0 ][ 0 ]-> name
, "Slime" );
582 strcpy ( monsters
[ 0 ][ 0 ]-> weapon
, "Acid Goo" );
583 monsters
[ 0 ][ 0 ]-> strength
= 6 ;
584 monsters
[ 0 ][ 0 ]-> gold
= 50 ;
585 monsters
[ 0 ][ 0 ]-> exp
= 3 ;
586 monsters
[ 0 ][ 0 ]-> maxhp
= 9 ;
587 strcpy ( monsters
[ 0 ][ 0 ]-> death
, "The slime oozes into nothing... you clean the acid goo off of your weapon" );
589 strcpy ( monsters
[ 0 ][ 1 ]-> name
, "Ghost" );
590 strcpy ( monsters
[ 0 ][ 1 ]-> weapon
, "Cold Breath" );
591 monsters
[ 0 ][ 1 ]-> strength
= 8 ;
592 monsters
[ 0 ][ 1 ]-> gold
= 100 ;
593 monsters
[ 0 ][ 1 ]-> exp
= 10 ;
594 monsters
[ 0 ][ 1 ]-> maxhp
= 10 ;
595 strcpy ( monsters
[ 0 ][ 1 ]-> death
, "You feel a chill as the spirit leaves the realm." );
597 strcpy ( monsters
[ 0 ][ 2 ]-> name
, "Ugly Rodent" );
598 strcpy ( monsters
[ 0 ][ 2 ]-> weapon
, "Sharp Teeth" );
599 monsters
[ 0 ][ 2 ]-> strength
= 9 ;
600 monsters
[ 0 ][ 2 ]-> gold
= 75 ;
601 monsters
[ 0 ][ 2 ]-> exp
= 8 ;
602 monsters
[ 0 ][ 2 ]-> maxhp
= 13 ;
603 strcpy ( monsters
[ 0 ][ 2 ]-> death
, "You stomp on the Ugly Rodent's remains for a finishing blow." );
605 strcpy ( monsters
[ 0 ][ 3 ]-> name
, "Whart Hog" );
606 strcpy ( monsters
[ 0 ][ 3 ]-> weapon
, "Tusks" );
607 monsters
[ 0 ][ 3 ]-> strength
= 10 ;
608 monsters
[ 0 ][ 3 ]-> gold
= 80 ;
609 monsters
[ 0 ][ 3 ]-> exp
= 6 ;
610 monsters
[ 0 ][ 3 ]-> maxhp
= 10 ;
611 strcpy ( monsters
[ 0 ][ 3 ]-> death
, "You cook and eat the hog for good measure!" );
613 strcpy ( monsters
[ 0 ][ 4 ]-> name
, "Pesky Kid" );
614 strcpy ( monsters
[ 0 ][ 4 ]-> weapon
, "Slingshot" );
615 monsters
[ 0 ][ 4 ]-> strength
= 8 ;
616 monsters
[ 0 ][ 4 ]-> gold
= 30 ;
617 monsters
[ 0 ][ 4 ]-> exp
= 4 ;
618 monsters
[ 0 ][ 4 ]-> maxhp
= 6 ;
619 strcpy ( monsters
[ 0 ][ 4 ]-> death
, "You take his slingshot and snap the band, sending the kid crying home to mom!" );
621 strcpy ( monsters
[ 0 ][ 5 ]-> name
, "Playground Bully" );
622 strcpy ( monsters
[ 0 ][ 5 ]-> weapon
, "Painful Noogie" );
623 monsters
[ 0 ][ 5 ]-> strength
= 11 ;
624 monsters
[ 0 ][ 5 ]-> gold
= 44 ;
625 monsters
[ 0 ][ 5 ]-> exp
= 6 ;
626 monsters
[ 0 ][ 5 ]-> maxhp
= 10 ;
627 strcpy ( monsters
[ 0 ][ 5 ]-> death
, "You give him an indian burn, and punt him across the schoolyard!" );
629 strcpy ( monsters
[ 0 ][ 6 ]-> name
, "Small Imp" );
630 strcpy ( monsters
[ 0 ][ 6 ]-> weapon
, "Dagger" );
631 monsters
[ 0 ][ 6 ]-> strength
= 6 ;
632 monsters
[ 0 ][ 6 ]-> gold
= 64 ;
633 monsters
[ 0 ][ 6 ]-> exp
= 10 ;
634 monsters
[ 0 ][ 6 ]-> maxhp
= 10 ;
635 strcpy ( monsters
[ 0 ][ 6 ]-> death
, "You can't help but laugh as he stumbles and falls onto his own dagger!" );
637 strcpy ( monsters
[ 0 ][ 7 ]-> name
, "Little Monkey" );
638 strcpy ( monsters
[ 0 ][ 7 ]-> weapon
, "Monkey Wrench" );
639 monsters
[ 0 ][ 7 ]-> strength
= 6 ;
640 monsters
[ 0 ][ 7 ]-> gold
= 53 ;
641 monsters
[ 0 ][ 7 ]-> exp
= 9 ;
642 monsters
[ 0 ][ 7 ]-> maxhp
= 9 ;
643 strcpy ( monsters
[ 0 ][ 7 ]-> death
, "You want to cook it, but you just can't think of eating something that looks so human!" );
645 strcpy ( monsters
[ 0 ][ 8 ]-> name
, "Grub Worm" );
646 strcpy ( monsters
[ 0 ][ 8 ]-> weapon
, "Minor Nudge" );
647 monsters
[ 0 ][ 8 ]-> strength
= 2 ;
648 monsters
[ 0 ][ 8 ]-> gold
= 10 ;
649 monsters
[ 0 ][ 8 ]-> exp
= 3 ;
650 monsters
[ 0 ][ 8 ]-> maxhp
= 3 ;
651 strcpy ( monsters
[ 0 ][ 8 ]-> death
, "You decide to save the poor little fella for your next fishing trip." );
653 strcpy ( monsters
[ 0 ][ 9 ]-> name
, "Drakee" );
654 strcpy ( monsters
[ 0 ][ 9 ]-> weapon
, "Tail Slap" );
655 monsters
[ 0 ][ 9 ]-> strength
= 5 ;
656 monsters
[ 0 ][ 9 ]-> gold
= 22 ;
657 monsters
[ 0 ][ 9 ]-> exp
= 7 ;
658 monsters
[ 0 ][ 9 ]-> maxhp
= 5 ;
659 strcpy ( monsters
[ 0 ][ 9 ]-> death
, "You pull the little Drakee by its tale and slam it down on a dry stump!" );
661 strcpy ( monsters
[ 0 ][ 10 ]-> name
, "Fat Slob" );
662 strcpy ( monsters
[ 0 ][ 10 ]-> weapon
, "Smelly Breath" );
663 monsters
[ 0 ][ 10 ]-> strength
= 6 ;
664 monsters
[ 0 ][ 10 ]-> gold
= 40 ;
665 monsters
[ 0 ][ 10 ]-> exp
= 10 ;
666 monsters
[ 0 ][ 10 ]-> maxhp
= 7 ;
667 strcpy ( monsters
[ 0 ][ 10 ]-> death
, "You kick his stomach for fun, and are thrown back by the spring of it all!" );
669 strcpy ( monsters
[ 0 ][ 11 ]-> name
, "Lost Warrior" );
670 strcpy ( monsters
[ 0 ][ 11 ]-> weapon
, "Long Sword" );
671 monsters
[ 0 ][ 11 ]-> strength
= 10 ;
672 monsters
[ 0 ][ 11 ]-> gold
= 250 ;
673 monsters
[ 0 ][ 11 ]-> exp
= 19 ;
674 monsters
[ 0 ][ 11 ]-> maxhp
= 15 ;
675 strcpy ( monsters
[ 0 ][ 11 ]-> death
, "You give him a proper burial in respect for the dead warrior." );
677 strcpy ( monsters
[ 1 ][ 0 ]-> name
, "Lost Warrior's Cousin Larry" );
678 strcpy ( monsters
[ 1 ][ 0 ]-> weapon
, "Wood Axe" );
679 monsters
[ 1 ][ 0 ]-> strength
= 19 ;
680 monsters
[ 1 ][ 0 ]-> gold
= 134 ;
681 monsters
[ 1 ][ 0 ]-> exp
= 24 ;
682 monsters
[ 1 ][ 0 ]-> maxhp
= 30 ;
683 strcpy ( monsters
[ 1 ][ 0 ]-> death
, "He was pretty pissed you killed his cousin, but he seems to have suffered the same fate!" );
685 strcpy ( monsters
[ 1 ][ 1 ]-> name
, "Sandman" );
686 strcpy ( monsters
[ 1 ][ 1 ]-> weapon
, "Sleeping Dust" );
687 monsters
[ 1 ][ 1 ]-> strength
= 25 ;
688 monsters
[ 1 ][ 1 ]-> gold
= 80 ;
689 monsters
[ 1 ][ 1 ]-> exp
= 6 ;
690 monsters
[ 1 ][ 1 ]-> maxhp
= 27 ;
691 strcpy ( monsters
[ 1 ][ 1 ]-> death
, "You put the sandman to his final sleep." );
693 strcpy ( monsters
[ 1 ][ 2 ]-> name
, "Dirty Prostitute" );
694 strcpy ( monsters
[ 1 ][ 2 ]-> weapon
, "Stiletto Heel" );
695 monsters
[ 1 ][ 2 ]-> strength
= 21 ;
696 monsters
[ 1 ][ 2 ]-> gold
= 160 ;
697 monsters
[ 1 ][ 2 ]-> exp
= 12 ;
698 monsters
[ 1 ][ 2 ]-> maxhp
= 25 ;
699 strcpy ( monsters
[ 1 ][ 2 ]-> death
, "Your pimp hand is strong!" );
701 strcpy ( monsters
[ 1 ][ 3 ]-> name
, "Goblin Gardener" );
702 strcpy ( monsters
[ 1 ][ 3 ]-> weapon
, "Garden Spade" );
703 monsters
[ 1 ][ 3 ]-> strength
= 18 ;
704 monsters
[ 1 ][ 3 ]-> gold
= 130 ;
705 monsters
[ 1 ][ 3 ]-> exp
= 8 ;
706 monsters
[ 1 ][ 3 ]-> maxhp
= 20 ;
707 strcpy ( monsters
[ 1 ][ 3 ]-> death
, "You trample on his garden after slaying him... that felt good!" );
709 strcpy ( monsters
[ 1 ][ 4 ]-> name
, "Evil Elf" );
710 strcpy ( monsters
[ 1 ][ 4 ]-> weapon
, "Dark Bow" );
711 monsters
[ 1 ][ 4 ]-> strength
= 23 ;
712 monsters
[ 1 ][ 4 ]-> gold
= 136 ;
713 monsters
[ 1 ][ 4 ]-> exp
= 13 ;
714 monsters
[ 1 ][ 4 ]-> maxhp
= 24 ;
715 strcpy ( monsters
[ 1 ][ 4 ]-> death
, "Elves are usually nice you thought... hmm." );
717 strcpy ( monsters
[ 1 ][ 5 ]-> name
, "Viking Warrior" );
718 strcpy ( monsters
[ 1 ][ 5 ]-> weapon
, "Broad Sword" );
719 monsters
[ 1 ][ 5 ]-> strength
= 21 ;
720 monsters
[ 1 ][ 5 ]-> gold
= 330 ;
721 monsters
[ 1 ][ 5 ]-> exp
= 20 ;
722 monsters
[ 1 ][ 5 ]-> maxhp
= 18 ;
723 strcpy ( monsters
[ 1 ][ 5 ]-> death
, "You heard vikings were big, but not THAT big you thought." );
725 strcpy ( monsters
[ 1 ][ 6 ]-> name
, "Wicked Witch" );
726 strcpy ( monsters
[ 1 ][ 6 ]-> weapon
, "Cackling Laugh" );
727 monsters
[ 1 ][ 6 ]-> strength
= 20 ;
728 monsters
[ 1 ][ 6 ]-> gold
= 130 ;
729 monsters
[ 1 ][ 6 ]-> exp
= 20 ;
730 monsters
[ 1 ][ 6 ]-> maxhp
= 26 ;
731 strcpy ( monsters
[ 1 ][ 6 ]-> death
, "Just for kicks, you splash some water on her and watch her melt." );
733 strcpy ( monsters
[ 1 ][ 7 ]-> name
, "Vampire Bat" );
734 strcpy ( monsters
[ 1 ][ 7 ]-> weapon
, "Blood Sucking Fangs" );
735 monsters
[ 1 ][ 7 ]-> strength
= 18 ;
736 monsters
[ 1 ][ 7 ]-> gold
= 125 ;
737 monsters
[ 1 ][ 7 ]-> exp
= 21 ;
738 monsters
[ 1 ][ 7 ]-> maxhp
= 29 ;
739 strcpy ( monsters
[ 1 ][ 7 ]-> death
, "You fry up the bat and eat it... needs garlic." );
741 strcpy ( monsters
[ 1 ][ 8 ]-> name
, "Thorn Bush" );
742 strcpy ( monsters
[ 1 ][ 8 ]-> weapon
, "101 Thorns" );
743 monsters
[ 1 ][ 8 ]-> strength
= 16 ;
744 monsters
[ 1 ][ 8 ]-> gold
= 94 ;
745 monsters
[ 1 ][ 8 ]-> exp
= 15 ;
746 monsters
[ 1 ][ 8 ]-> maxhp
= 25 ;
747 strcpy ( monsters
[ 1 ][ 8 ]-> death
, "You set the bush ablaze and roast some marshmallows." );
749 strcpy ( monsters
[ 1 ][ 9 ]-> name
, "Barbarian" );
750 strcpy ( monsters
[ 1 ][ 9 ]-> weapon
, "Heavy Sword" );
751 monsters
[ 1 ][ 9 ]-> strength
= 29 ;
752 monsters
[ 1 ][ 9 ]-> gold
= 250 ;
753 monsters
[ 1 ][ 9 ]-> exp
= 25 ;
754 monsters
[ 1 ][ 9 ]-> maxhp
= 30 ;
755 strcpy ( monsters
[ 1 ][ 9 ]-> death
, "You listen to him moan as he falls over dead." );
757 strcpy ( monsters
[ 1 ][ 10 ]-> name
, "Crypt Rat" );
758 strcpy ( monsters
[ 1 ][ 10 ]-> weapon
, "Stinging Bite" );
759 monsters
[ 1 ][ 10 ]-> strength
= 25 ;
760 monsters
[ 1 ][ 10 ]-> gold
= 119 ;
761 monsters
[ 1 ][ 10 ]-> exp
= 20 ;
762 monsters
[ 1 ][ 10 ]-> maxhp
= 26 ;
763 strcpy ( monsters
[ 1 ][ 10 ]-> death
, "You squash the little rodent for fear that it might not be dead." );
765 strcpy ( monsters
[ 1 ][ 11 ]-> name
, "Small Orc" );
766 strcpy ( monsters
[ 1 ][ 11 ]-> weapon
, "blade" );
767 monsters
[ 1 ][ 11 ]-> strength
= 28 ;
768 monsters
[ 1 ][ 11 ]-> gold
= 300 ;
769 monsters
[ 1 ][ 11 ]-> exp
= 30 ;
770 monsters
[ 1 ][ 11 ]-> maxhp
= 36 ;
771 strcpy ( monsters
[ 1 ][ 11 ]-> death
, "It's an ugly one, and it would've grown up to be a terror..." );
773 strcpy ( monsters
[ 2 ][ 0 ]-> name
, "Teferi" );
774 strcpy ( monsters
[ 2 ][ 0 ]-> weapon
, "Puzzle Box" );
775 monsters
[ 2 ][ 0 ]-> strength
= 29 ;
776 monsters
[ 2 ][ 0 ]-> gold
= 380 ;
777 monsters
[ 2 ][ 0 ]-> exp
= 18 ;
778 monsters
[ 2 ][ 0 ]-> maxhp
= 29 ;
779 strcpy ( monsters
[ 2 ][ 0 ]-> death
, "It was a puzzling experience." );
781 strcpy ( monsters
[ 2 ][ 1 ]-> name
, "Spineless Thug" );
782 strcpy ( monsters
[ 2 ][ 1 ]-> weapon
, "Spiked Bat" );
783 monsters
[ 2 ][ 1 ]-> strength
= 37 ;
784 monsters
[ 2 ][ 1 ]-> gold
= 384 ;
785 monsters
[ 2 ][ 1 ]-> exp
= 27 ;
786 monsters
[ 2 ][ 1 ]-> maxhp
= 32 ;
787 strcpy ( monsters
[ 2 ][ 1 ]-> death
, "See you at the crossroads!" );
789 strcpy ( monsters
[ 2 ][ 2 ]-> name
, "Pyromaniac" );
790 strcpy ( monsters
[ 2 ][ 2 ]-> weapon
, "Flame Thrower" );
791 monsters
[ 2 ][ 2 ]-> strength
= 29 ;
792 monsters
[ 2 ][ 2 ]-> gold
= 563 ;
793 monsters
[ 2 ][ 2 ]-> exp
= 22 ;
794 monsters
[ 2 ][ 2 ]-> maxhp
= 45 ;
795 strcpy ( monsters
[ 2 ][ 2 ]-> death
, "He chants FIRE FIRE as he falls to the ground... a burning heap of flesh." );
797 strcpy ( monsters
[ 2 ][ 3 ]-> name
, "Evil Enchantress" );
798 strcpy ( monsters
[ 2 ][ 3 ]-> weapon
, "Deadly Spell" );
799 monsters
[ 2 ][ 3 ]-> strength
= 50 ;
800 monsters
[ 2 ][ 3 ]-> gold
= 830 ;
801 monsters
[ 2 ][ 3 ]-> exp
= 35 ;
802 monsters
[ 2 ][ 3 ]-> maxhp
= 35 ;
803 strcpy ( monsters
[ 2 ][ 3 ]-> death
, "She looked just about as good as she fought." );
805 strcpy ( monsters
[ 2 ][ 4 ]-> name
, "Killer Leprechaun" );
806 strcpy ( monsters
[ 2 ][ 4 ]-> weapon
, "Gold Rush" );
807 monsters
[ 2 ][ 4 ]-> strength
= 35 ;
808 monsters
[ 2 ][ 4 ]-> gold
= 1300 ;
809 monsters
[ 2 ][ 4 ]-> exp
= 30 ;
810 monsters
[ 2 ][ 4 ]-> maxhp
= 37 ;
811 strcpy ( monsters
[ 2 ][ 4 ]-> death
, "You steal his pot of gold... that's a lot of money!" );
813 strcpy ( monsters
[ 2 ][ 5 ]-> name
, "Avalanche Rider" );
814 strcpy ( monsters
[ 2 ][ 5 ]-> weapon
, "Huge Snowball" );
815 monsters
[ 2 ][ 5 ]-> strength
= 32 ;
816 monsters
[ 2 ][ 5 ]-> gold
= 700 ;
817 monsters
[ 2 ][ 5 ]-> exp
= 32 ;
818 monsters
[ 2 ][ 5 ]-> maxhp
= 38 ;
819 strcpy ( monsters
[ 2 ][ 5 ]-> death
, "You take his snowboard and snap it in two!" );
821 strcpy ( monsters
[ 2 ][ 6 ]-> name
, "Blundering Idiot" );
822 strcpy ( monsters
[ 2 ][ 6 ]-> weapon
, "Stupidity" );
823 monsters
[ 2 ][ 6 ]-> strength
= 14 ;
824 monsters
[ 2 ][ 6 ]-> gold
= 700 ;
825 monsters
[ 2 ][ 6 ]-> exp
= 20 ;
826 monsters
[ 2 ][ 6 ]-> maxhp
= 29 ;
827 strcpy ( monsters
[ 2 ][ 6 ]-> death
, "Now there's one person you don't feel sorry for killing!" );
829 strcpy ( monsters
[ 2 ][ 7 ]-> name
, "Militant Anarchist" );
830 strcpy ( monsters
[ 2 ][ 7 ]-> weapon
, "Molotov Cocktail" );
831 monsters
[ 2 ][ 7 ]-> strength
= 33 ;
832 monsters
[ 2 ][ 7 ]-> gold
= 245 ;
833 monsters
[ 2 ][ 7 ]-> exp
= 45 ;
834 monsters
[ 2 ][ 7 ]-> maxhp
= 32 ;
835 strcpy ( monsters
[ 2 ][ 7 ]-> death
, "Order has been restored for now..." );
837 strcpy ( monsters
[ 2 ][ 8 ]-> name
, "Scathe Zombies" );
838 strcpy ( monsters
[ 2 ][ 8 ]-> weapon
, "Death Grip" );
839 monsters
[ 2 ][ 8 ]-> strength
= 38 ;
840 monsters
[ 2 ][ 8 ]-> gold
= 763 ;
841 monsters
[ 2 ][ 8 ]-> exp
= 15 ;
842 monsters
[ 2 ][ 8 ]-> maxhp
= 45 ;
843 strcpy ( monsters
[ 2 ][ 8 ]-> death
, "That was perhaps the scariest experience of your life." );
845 strcpy ( monsters
[ 2 ][ 9 ]-> name
, "Spitting Llama" );
846 strcpy ( monsters
[ 2 ][ 9 ]-> weapon
, "Spit Spray" );
847 monsters
[ 2 ][ 9 ]-> strength
= 48 ;
848 monsters
[ 2 ][ 9 ]-> gold
= 638 ;
849 monsters
[ 2 ][ 9 ]-> exp
= 28 ;
850 monsters
[ 2 ][ 9 ]-> maxhp
= 34 ;
851 strcpy ( monsters
[ 2 ][ 9 ]-> death
, "You wipe the spit off your face and fling it back at the Llama." );
853 strcpy ( monsters
[ 2 ][ 10 ]-> name
, "Juggalo" );
854 strcpy ( monsters
[ 2 ][ 10 ]-> weapon
, "Clown Axe" );
855 monsters
[ 2 ][ 10 ]-> strength
= 60 ;
856 monsters
[ 2 ][ 10 ]-> gold
= 650 ;
857 monsters
[ 2 ][ 10 ]-> exp
= 30 ;
858 monsters
[ 2 ][ 10 ]-> maxhp
= 29 ;
859 strcpy ( monsters
[ 2 ][ 10 ]-> death
, "What is a Juggalo? I don't know!" );
861 strcpy ( monsters
[ 2 ][ 11 ]-> name
, "The Boogie Man" );
862 strcpy ( monsters
[ 2 ][ 11 ]-> weapon
, "Striking Fear" );
863 monsters
[ 2 ][ 11 ]-> strength
= 46 ;
864 monsters
[ 2 ][ 11 ]-> gold
= 600 ;
865 monsters
[ 2 ][ 11 ]-> exp
= 35 ;
866 monsters
[ 2 ][ 11 ]-> maxhp
= 27 ;
867 strcpy ( monsters
[ 2 ][ 11 ]-> death
, "He's scared you for the very last time!" );
869 strcpy ( monsters
[ 3 ][ 0 ]-> name
, "Living Fire" );
870 strcpy ( monsters
[ 3 ][ 0 ]-> weapon
, "Scorching Wind" );
871 monsters
[ 3 ][ 0 ]-> strength
= 55 ;
872 monsters
[ 3 ][ 0 ]-> gold
= 1100 ;
873 monsters
[ 3 ][ 0 ]-> exp
= 36 ;
874 monsters
[ 3 ][ 0 ]-> maxhp
= 55 ;
875 strcpy ( monsters
[ 3 ][ 0 ]-> death
, "You extinguish the Living Flame once and for all!" );
877 strcpy ( monsters
[ 3 ][ 1 ]-> name
, "Raging Orc" );
878 strcpy ( monsters
[ 3 ][ 1 ]-> weapon
, "Orcish Artillary" );
879 monsters
[ 3 ][ 1 ]-> strength
= 89 ;
880 monsters
[ 3 ][ 1 ]-> gold
= 900 ;
881 monsters
[ 3 ][ 1 ]-> exp
= 25 ;
882 monsters
[ 3 ][ 1 ]-> maxhp
= 50 ;
883 strcpy ( monsters
[ 3 ][ 1 ]-> death
, "This orc was a bit tougher than you remembered!" );
885 strcpy ( monsters
[ 3 ][ 2 ]-> name
, "Huge Tarantula" );
886 strcpy ( monsters
[ 3 ][ 2 ]-> weapon
, "Tangling Web" );
887 monsters
[ 3 ][ 2 ]-> strength
= 59 ;
888 monsters
[ 3 ][ 2 ]-> gold
= 1000 ;
889 monsters
[ 3 ][ 2 ]-> exp
= 35 ;
890 monsters
[ 3 ][ 2 ]-> maxhp
= 60 ;
891 strcpy ( monsters
[ 3 ][ 2 ]-> death
, "You're glad you overcame your arachniphobia so soon!" );
893 strcpy ( monsters
[ 3 ][ 3 ]-> name
, "Rabid Wolf" );
894 strcpy ( monsters
[ 3 ][ 3 ]-> weapon
, "Cujo Bite" );
895 monsters
[ 3 ][ 3 ]-> strength
= 40 ;
896 monsters
[ 3 ][ 3 ]-> gold
= 1200 ;
897 monsters
[ 3 ][ 3 ]-> exp
= 47 ;
898 monsters
[ 3 ][ 3 ]-> maxhp
= 76 ;
899 strcpy ( monsters
[ 3 ][ 3 ]-> death
, "The mutt falls over dead as white foam drips from its deadly canines..." );
901 strcpy ( monsters
[ 3 ][ 4 ]-> name
, "Goblin Fighter" );
902 strcpy ( monsters
[ 3 ][ 4 ]-> weapon
, "Morning Star" );
903 monsters
[ 3 ][ 4 ]-> strength
= 38 ;
904 monsters
[ 3 ][ 4 ]-> gold
= 700 ;
905 monsters
[ 3 ][ 4 ]-> exp
= 30 ;
906 monsters
[ 3 ][ 4 ]-> maxhp
= 75 ;
907 strcpy ( monsters
[ 3 ][ 4 ]-> death
, "He almost caught you with his chain mace, but you sliced off his head." );
909 strcpy ( monsters
[ 3 ][ 5 ]-> name
, "Grizzly Bear" );
910 strcpy ( monsters
[ 3 ][ 5 ]-> weapon
, "Razor Claws" );
911 monsters
[ 3 ][ 5 ]-> strength
= 68 ;
912 monsters
[ 3 ][ 5 ]-> gold
= 1747 ;
913 monsters
[ 3 ][ 5 ]-> exp
= 81 ;
914 monsters
[ 3 ][ 5 ]-> maxhp
= 51 ;
915 strcpy ( monsters
[ 3 ][ 5 ]-> death
, "It almost got you this time... better be careful" );
917 strcpy ( monsters
[ 3 ][ 6 ]-> name
, "Skeleton Man" );
918 strcpy ( monsters
[ 3 ][ 6 ]-> weapon
, "Leg Bone" );
919 monsters
[ 3 ][ 6 ]-> strength
= 70 ;
920 monsters
[ 3 ][ 6 ]-> gold
= 597 ;
921 monsters
[ 3 ][ 6 ]-> exp
= 57 ;
922 monsters
[ 3 ][ 6 ]-> maxhp
= 60 ;
923 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!" );
925 strcpy ( monsters
[ 3 ][ 7 ]-> name
, "Young Werewolf" );
926 strcpy ( monsters
[ 3 ][ 7 ]-> weapon
, "Howling Bites" );
927 monsters
[ 3 ][ 7 ]-> strength
= 75 ;
928 monsters
[ 3 ][ 7 ]-> gold
= 1742 ;
929 monsters
[ 3 ][ 7 ]-> exp
= 65 ;
930 monsters
[ 3 ][ 7 ]-> maxhp
= 42 ;
931 strcpy ( monsters
[ 3 ][ 7 ]-> death
, "You scatter the wolf's body parts in hopes he will stay dead!" );
933 strcpy ( monsters
[ 3 ][ 8 ]-> name
, "Dark Infantry" );
934 strcpy ( monsters
[ 3 ][ 8 ]-> weapon
, "Flesh Reaper" );
935 monsters
[ 3 ][ 8 ]-> strength
= 69 ;
936 monsters
[ 3 ][ 8 ]-> gold
= 870 ;
937 monsters
[ 3 ][ 8 ]-> exp
= 43 ;
938 monsters
[ 3 ][ 8 ]-> maxhp
= 65 ;
939 strcpy ( monsters
[ 3 ][ 8 ]-> death
, "Light has prevailed this time... but it's only so long before you meet again." );
941 strcpy ( monsters
[ 3 ][ 9 ]-> name
, "Erie Spirit" );
942 strcpy ( monsters
[ 3 ][ 9 ]-> weapon
, "Deadly Grin" );
943 monsters
[ 3 ][ 9 ]-> strength
= 63 ;
944 monsters
[ 3 ][ 9 ]-> gold
= 1300 ;
945 monsters
[ 3 ][ 9 ]-> exp
= 32 ;
946 monsters
[ 3 ][ 9 ]-> maxhp
= 50 ;
947 strcpy ( monsters
[ 3 ][ 9 ]-> death
, "His cousin the ghost was a little bit easier." );
949 strcpy ( monsters
[ 3 ][ 10 ]-> name
, "Gollum" );
950 strcpy ( monsters
[ 3 ][ 10 ]-> weapon
, "Precious Treasure" );
951 monsters
[ 3 ][ 10 ]-> strength
= 66 ;
952 monsters
[ 3 ][ 10 ]-> gold
= 1492 ;
953 monsters
[ 3 ][ 10 ]-> exp
= 73 ;
954 monsters
[ 3 ][ 10 ]-> maxhp
= 54 ;
955 strcpy ( monsters
[ 3 ][ 10 ]-> death
, "Gollum screams out \" MY PRECIOUS \" as his small body falls limp from your blow." );
957 strcpy ( monsters
[ 3 ][ 11 ]-> name
, "Rock Fighter" );
958 strcpy ( monsters
[ 3 ][ 11 ]-> weapon
, "Small Boulders" );
959 monsters
[ 3 ][ 11 ]-> strength
= 87 ;
960 monsters
[ 3 ][ 11 ]-> gold
= 1742 ;
961 monsters
[ 3 ][ 11 ]-> exp
= 99 ;
962 monsters
[ 3 ][ 11 ]-> maxhp
= 65 ;
963 strcpy ( monsters
[ 3 ][ 11 ]-> death
, "You dodge his last rock, and counter with a low blow, cutting off his legs." );
966 strcpy ( monsters
[ 4 ][ 0 ]-> name
, "Giant Sphinx" );
967 strcpy ( monsters
[ 4 ][ 0 ]-> weapon
, "Ancient Curse" );
968 monsters
[ 4 ][ 0 ]-> strength
= 120 ;
969 monsters
[ 4 ][ 0 ]-> gold
= 1000 ;
970 monsters
[ 4 ][ 0 ]-> exp
= 100 ;
971 monsters
[ 4 ][ 0 ]-> maxhp
= 80 ;
972 strcpy ( monsters
[ 4 ][ 0 ]-> death
, "You look in awe at the great wonder, collapsed at your feet!" );
974 strcpy ( monsters
[ 4 ][ 1 ]-> name
, "Giant Ogre" );
975 strcpy ( monsters
[ 4 ][ 1 ]-> weapon
, "Big Log" );
976 monsters
[ 4 ][ 1 ]-> strength
= 130 ;
977 monsters
[ 4 ][ 1 ]-> gold
= 857 ;
978 monsters
[ 4 ][ 1 ]-> exp
= 175 ;
979 monsters
[ 4 ][ 1 ]-> maxhp
= 100 ;
980 strcpy ( monsters
[ 4 ][ 1 ]-> death
, "Your wits outmatched the ogre's brawn... big dumb thing." );
982 strcpy ( monsters
[ 4 ][ 2 ]-> name
, "Massive Cockroach" );
983 strcpy ( monsters
[ 4 ][ 2 ]-> weapon
, "Piercing Hiss" );
984 monsters
[ 4 ][ 2 ]-> strength
= 125 ;
985 monsters
[ 4 ][ 2 ]-> gold
= 700 ;
986 monsters
[ 4 ][ 2 ]-> exp
= 150 ;
987 monsters
[ 4 ][ 2 ]-> maxhp
= 112 ;
988 strcpy ( monsters
[ 4 ][ 2 ]-> death
, "Where's the exterminator when you need one?" );
990 strcpy ( monsters
[ 4 ][ 3 ]-> name
, "Big Venomous Snake" );
991 strcpy ( monsters
[ 4 ][ 3 ]-> weapon
, "Poison Fangs" );
992 monsters
[ 4 ][ 3 ]-> strength
= 140 ;
993 monsters
[ 4 ][ 3 ]-> gold
= 900 ;
994 monsters
[ 4 ][ 3 ]-> exp
= 175 ;
995 monsters
[ 4 ][ 3 ]-> maxhp
= 126 ;
996 strcpy ( monsters
[ 4 ][ 3 ]-> death
, "After killing this beast you check for puncture marks... you find none, luckily." );
998 strcpy ( monsters
[ 4 ][ 4 ]-> name
, "Lizard Man" );
999 strcpy ( monsters
[ 4 ][ 4 ]-> weapon
, "Deadly Jaws" );
1000 monsters
[ 4 ][ 4 ]-> strength
= 145 ;
1001 monsters
[ 4 ][ 4 ]-> gold
= 1250 ;
1002 monsters
[ 4 ][ 4 ]-> exp
= 175 ;
1003 monsters
[ 4 ][ 4 ]-> maxhp
= 150 ;
1004 strcpy ( monsters
[ 4 ][ 4 ]-> death
, "His scales made for tough armor, and his jaws for a tougher opponent!" );
1006 strcpy ( monsters
[ 4 ][ 5 ]-> name
, "Face Dancer" );
1007 strcpy ( monsters
[ 4 ][ 5 ]-> weapon
, "Illusion Scyth" );
1008 monsters
[ 4 ][ 5 ]-> strength
= 138 ;
1009 monsters
[ 4 ][ 5 ]-> gold
= 1603 ;
1010 monsters
[ 4 ][ 5 ]-> exp
= 198 ;
1011 monsters
[ 4 ][ 5 ]-> maxhp
= 173 ;
1012 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!" );
1014 strcpy ( monsters
[ 4 ][ 6 ]-> name
, "Darklord Longbow Archer" );
1015 strcpy ( monsters
[ 4 ][ 6 ]-> weapon
, "Deadly Bow and Arrows" );
1016 monsters
[ 4 ][ 6 ]-> strength
= 145 ;
1017 monsters
[ 4 ][ 6 ]-> gold
= 1569 ;
1018 monsters
[ 4 ][ 6 ]-> exp
= 243 ;
1019 monsters
[ 4 ][ 6 ]-> maxhp
= 170 ;
1020 strcpy ( monsters
[ 4 ][ 6 ]-> death
, "Your face turns white with horror after you realize you just met the devil's protector!" );
1022 strcpy ( monsters
[ 4 ][ 7 ]-> name
, "Hell's Paladin" );
1023 strcpy ( monsters
[ 4 ][ 7 ]-> weapon
, "Sword of Hellfire" );
1024 monsters
[ 4 ][ 7 ]-> strength
= 200 ;
1025 monsters
[ 4 ][ 7 ]-> gold
= 2191 ;
1026 monsters
[ 4 ][ 7 ]-> exp
= 254 ;
1027 monsters
[ 4 ][ 7 ]-> maxhp
= 175 ;
1028 strcpy ( monsters
[ 4 ][ 7 ]-> death
, "This is starting to get tough you think. Do you really want to go to level 6?" );
1030 strcpy ( monsters
[ 4 ][ 8 ]-> name
, "The Unknown Soldier" );
1031 strcpy ( monsters
[ 4 ][ 8 ]-> weapon
, "Soul Torture" );
1032 monsters
[ 4 ][ 8 ]-> strength
= 175 ;
1033 monsters
[ 4 ][ 8 ]-> gold
= 1890 ;
1034 monsters
[ 4 ][ 8 ]-> exp
= 200 ;
1035 monsters
[ 4 ][ 8 ]-> maxhp
= 180 ;
1036 strcpy ( monsters
[ 4 ][ 8 ]-> death
, "Who was that? Where was he from? And what was that weapon??" );
1038 strcpy ( monsters
[ 4 ][ 9 ]-> name
, "Undead Cult Leader" );
1039 strcpy ( monsters
[ 4 ][ 9 ]-> weapon
, "Lance of Deceit" );
1040 monsters
[ 4 ][ 9 ]-> strength
= 180 ;
1041 monsters
[ 4 ][ 9 ]-> gold
= 1792 ;
1042 monsters
[ 4 ][ 9 ]-> exp
= 195 ;
1043 monsters
[ 4 ][ 9 ]-> maxhp
= 190 ;
1044 strcpy ( monsters
[ 4 ][ 9 ]-> death
, "His words fall on deaf ears... this is one cult you will NOT be part of!" );
1046 strcpy ( monsters
[ 4 ][ 10 ]-> name
, "Water Serpent" );
1047 strcpy ( monsters
[ 4 ][ 10 ]-> weapon
, "Forked Tongue" );
1048 monsters
[ 4 ][ 10 ]-> strength
= 150 ;
1049 monsters
[ 4 ][ 10 ]-> gold
= 1500 ;
1050 monsters
[ 4 ][ 10 ]-> exp
= 176 ;
1051 monsters
[ 4 ][ 10 ]-> maxhp
= 220 ;
1052 strcpy ( monsters
[ 4 ][ 10 ]-> death
, "The serpent squeals as you cut off its head!" );
1054 strcpy ( monsters
[ 4 ][ 11 ]-> name
, "Silverback Gorilla" );
1055 strcpy ( monsters
[ 4 ][ 11 ]-> weapon
, "Deadly Banana Peel" );
1056 monsters
[ 4 ][ 11 ]-> strength
= 160 ;
1057 monsters
[ 4 ][ 11 ]-> gold
= 1300 ;
1058 monsters
[ 4 ][ 11 ]-> exp
= 150 ;
1059 monsters
[ 4 ][ 11 ]-> maxhp
= 178 ;
1060 strcpy ( monsters
[ 4 ][ 11 ]-> death
, "Was that gorilla or guerilla?" );
1063 void delete_monsters ()
1065 for ( int x
= 0 ; x
< LEVELS
; x
++)
1066 for ( int y
= 0 ; y
< MONSTERS
; y
++)
1068 delete monsters
[ x
][ y
];
1071 void delete_masters ()
1073 for ( int x
= 0 ; x
< LEVELS
; x
++)
1078 void display_monster ( char * u
)
1082 aClient
* user
= find ( u
);
1083 Player
* ni
= user
-> stats
;
1085 notice ( s_GameServ
, u
, "Your Hitpoints: \ 2 %d \ 2 ", ni
-> hp
);
1086 notice ( s_GameServ
, u
, " %s 's Hitpoints: \ 2 %d \ 2 ", ni
-> fight
-> name
, ni
-> fight
-> hp
);
1087 notice ( s_GameServ
, u
, "Here are your commands:" );
1088 notice ( s_GameServ
, u
, "/msg %S attack" );
1089 notice ( s_GameServ
, u
, "/msg %S run" );
1090 notice ( s_GameServ
, u
, "What will you do?" );
1094 void display_players ( char * u
)
1098 aClient
* ni
= find ( u
);
1100 aClient
* battle
= ni
-> stats
-> battle
;
1102 notice ( s_GameServ
, u
, "Your Hitpoints: \ 2 %d \ 2 ", ni
-> stats
-> hp
);
1103 notice ( s_GameServ
, u
, " %s 's Hitpoints: \ 2 %d \ 2 ", battle
-> getNick (),
1106 notice ( s_GameServ
, u
, "Here are your commands:" );
1107 notice ( s_GameServ
, u
, "/msg %s attack" , s_GameServ
);
1108 notice ( s_GameServ
, u
, "/msg %s run" , s_GameServ
);
1109 notice ( s_GameServ
, u
, "What will you do?" );
1114 bool is_playing ( char * u
)
1117 if (!( user
= find ( u
)))
1123 return user
-> stats
!= NULL
;
1127 bool is_fighting ( char * u
)
1131 if (!( user
= find ( u
)))
1135 else if ( user
-> stats
)
1137 return user
-> stats
-> fight
!= NULL
|| user
-> stats
-> battle
!= NULL
1138 || user
-> stats
-> master
!= NULL
;
1144 bool player_fight ( char * u
)
1148 if (!( user
= find ( u
)))
1150 else if ( user
-> stats
)
1151 return user
-> stats
-> battle
!= NULL
;
1156 bool master_fight ( char * u
)
1160 if (!( user
= find ( u
)))
1162 else if ( user
-> stats
)
1163 return user
-> stats
-> master
!= NULL
;
1168 bool isnt_fighting ( char * u
)
1170 return ! is_fighting ( u
);
1173 void do_fight ( char * u
)
1175 aClient
* ni
, * battle
;
1177 char * nick
= strtok ( NULL
, " " );
1181 notice ( s_GameServ
, u
, "SYNTAX: /msg %S FIGHT PLAYER" );
1183 else if (!( ni
= find ( u
)))
1187 else if (!( battle
= find ( nick
)))
1189 notice ( s_GameServ
, u
, "You can't attack %s while they aren't playing!" , nick
);
1191 else if (! is_playing ( u
))
1193 notice ( s_GameServ
, u
, "You are not playing!" );
1196 * Offline fighting not implemented yet.
1197 * else if (!(fight = finduser(nick)))
1199 * ni->stats->battle = battle;
1200 * battle->battle = ni;
1202 * battle->yourturn = 0;
1203 * notice(s_GameServ, u, "You decide to fight %s while they're not online!",
1204 * battle->getNick());
1205 * display_players(u);
1208 else if ( is_playing ( u
) && is_playing ( nick
))
1210 // Set your battle pointer to the other player
1211 ni
-> stats
-> battle
= battle
;
1213 // Set the other player's battle pointer to you
1214 battle
-> stats
-> battle
= ni
;
1216 // The initiator gets the first move (perhaps this should be 50/50)
1217 ni
-> stats
-> yourturn
= 1 ;
1218 battle
-> stats
-> yourturn
= 0 ;
1220 // Initiate Battle sequence!
1221 notice ( s_GameServ
, u
, "You challenge %s to an online duel!" , battle
-> getNick ());
1222 notice ( s_GameServ
, battle
-> getNick (), " %s has challenged you to an online duel!" , u
);
1223 notice ( s_GameServ
, battle
-> getNick (), " %s gets to go first because he initiated!" , u
);
1224 notice ( s_GameServ
, battle
-> getNick (), "Please wait while %s decides what to do." , u
);
1228 void do_run ( char * u
)
1233 if (!( user
= find ( u
)))
1235 notice ( s_GameServ
, u
, "Couldn't find you. Error. Contact a %S admin" );
1242 p2
= p
-> battle
-> stats
;
1244 if (! is_fighting ( u
))
1245 notice ( s_GameServ
, u
, "You run in place... try fighting next time." );
1246 else if (! player_fight ( u
) && ! master_fight ( u
))
1248 notice ( s_GameServ
, u
, "You run away from \ 2 %s \ 2 like a little baby!", p
-> fight
-> name
);
1252 else if ( player_fight ( u
) && p
-> yourturn
)
1254 notice ( s_GameServ
, u
, "You run away from \ 2 %s \ 2 like a little baby!", p2
-> name
);
1255 notice ( s_GameServ
, p
-> battle
-> getNick (), "\ 2 %s \ 2 ran away from you like a little baby!", p
-> name
);
1258 else if ( player_fight ( u
) && ! p
-> yourturn
)
1260 notice ( s_GameServ
, u
, "It is not your turn. Please wait until \ 2 %s \ 2 decides what to do.", p2
-> name
);
1262 else if ( master_fight ( u
))
1264 notice ( s_GameServ
, u
, "You cannot run from \ 2 %s \ 2 ! FIGHT!", p
-> master
-> name
);
1268 void do_attack ( char * u
)
1271 aClient
* ni
, * battle
; // The player and perhaps the player they're fighting
1272 Monster
* fight
; // The monster they may be fighting
1274 if (!( ni
= find ( u
)))
1276 notice ( s_GameServ
, u
, "You're not playing!" );
1279 else if (! ni
-> stats
-> fight
&& ! ni
-> stats
-> battle
&& ! ni
-> stats
-> master
)
1281 notice ( s_GameServ
, u
, "You're not in battle!" );
1286 if (! ni
-> stats
-> master
) // This is not a master fight
1287 fight
= ni
-> stats
-> fight
; // Monster Could be NULL
1288 else // This IS a master fight
1289 fight
= ni
-> stats
-> master
; // Master Could be NULL
1291 battle
= ni
-> stats
-> battle
; // Player Could be NULL
1293 // One has to be !NULL based on the previous else if
1294 // We wouldn't be here if they were all NULL
1297 if (! player_fight ( u
))
1300 hit
= (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ) +
1301 ( rand () % (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ));
1304 mhit
= ( fight
-> strength
/ 2 ) +
1305 ( rand () % ( fight
-> strength
/ 2 ) - ( ni
-> stats
-> defense
+
1306 arbonus
[ ni
-> stats
-> armor
]));
1311 mhit
= ((( battle
-> stats
-> strength
+ webonus
[ battle
-> stats
-> weapon
]) / 2 ) +
1312 ( rand () % (( battle
-> stats
-> strength
+ webonus
[ battle
-> stats
-> weapon
])) / 2 ) -
1313 ( ni
-> stats
-> defense
+ arbonus
[ ni
-> stats
-> armor
]));
1316 hit
= ((( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
]) / 2 ) +
1317 ( rand () % (( ni
-> stats
-> strength
+ webonus
[ ni
-> stats
-> weapon
])) / 2 ) -
1318 ( battle
-> stats
-> defense
+ arbonus
[ battle
-> stats
-> armor
]));
1321 if (! player_fight ( u
))
1324 notice ( s_GameServ
, u
, "You attack \1f %s \1f for \ 2 %d \ 2 points!", fight
-> name
, hit
);
1326 notice ( s_GameServ
, u
, "You miss \1f %s \1f completely!", fight
-> name
);
1328 if ( hit
>= fight
-> hp
)
1330 if ( master_fight ( u
))
1331 notice ( s_GameServ
, u
, "You have bested %s !" , fight
-> name
);
1333 notice ( s_GameServ
, u
, "You have killed \ 2 %s \ 2 !", fight
-> name
);
1335 notice ( s_GameServ
, u
, " %s " , fight
-> death
);
1336 notice ( s_GameServ
, u
, "You recieve \ 2 %d \ 2 experience and \ 2 %d \ 2 gold!",
1337 fight
-> exp
, fight
-> gold
);
1339 // If your new experience (or gold) will be greater than 2 billion,
1340 // then set your exp to 2bil. (2 billion max)... otherwise add them.
1341 // This could be a problem with overflowing out of the sign bit.
1342 // Unsigned long int maybe? Leave it for now.
1343 ni
-> stats
-> exp
= ( ( ni
-> stats
-> exp
+ fight
-> exp
) > 2000000000 ? 2000000000 :
1344 ni
-> stats
-> exp
+ fight
-> exp
);
1345 ni
-> stats
-> gold
= ( ni
-> stats
-> gold
+ fight
-> gold
> 2000000000 ? 2000000000 :
1346 ni
-> stats
-> gold
+ fight
-> gold
);
1348 // They're dead so remove the pointer
1349 delete ni
-> stats
-> fight
;
1350 ni
-> stats
-> fight
= NULL
;
1352 if ( master_fight ( u
))
1354 notice ( s_GameServ
, u
, "You are now level %d !" , ni
-> stats
-> level
+ 1 );
1355 notice ( s_GameServ
, u
, "You gain %d Strength, and %d Defense points!" ,
1356 strbonus
[ ni
-> stats
-> level
- 1 ], defbonus
[ ni
-> stats
-> level
- 1 ]);
1358 // Increase your level
1361 // Increase your maximum hit points
1362 ni
-> stats
-> maxhp
+= hpbonus
[ ni
-> stats
-> level
- 1 ];
1364 // Heal the player by setting hp to their max
1365 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1367 // Add to your strength
1368 ni
-> stats
-> strength
+= strbonus
[ ni
-> stats
-> level
- 1 ];
1370 // Add to your defensive power
1371 ni
-> stats
-> defense
+= defbonus
[ ni
-> stats
-> level
- 1 ];
1373 // Clear the pointer for your master
1374 ni
-> stats
-> master
= NULL
;
1384 notice ( s_GameServ
, u
, "\1f %s \1f hits you with their \1f %s \1f for \ 2 %d \ 2 damage!",
1385 fight
-> name
, fight
-> weapon
, mhit
);
1388 notice ( s_GameServ
, u
, " %s completely misses you!" , fight
-> name
);
1390 if ( mhit
>= ni
-> stats
-> hp
)
1392 if (! master_fight ( u
))
1394 notice ( s_GameServ
, u
, "You have been \ 2 \1f killed\1f \ 2 by %s !" , fight
-> name
);
1395 notice ( s_GameServ
, u
, "You lose all gold on hand and lose 10 percent " \
1396 "of your experience!" );
1397 ni
-> stats
-> gold
= 0 ;
1398 ni
-> stats
-> exp
-= ( long int )( ni
-> stats
-> exp
* .10 );
1399 ni
-> stats
-> fight
= NULL
;
1404 notice ( s_GameServ
, u
, " %s has bested you! You will have to wait " \
1405 "until tomorrow to try again" , ni
-> stats
-> master
-> name
);
1406 ni
-> stats
-> fight
= NULL
;
1407 ni
-> stats
-> master
= NULL
;
1414 ni
-> stats
-> hp
-= mhit
;
1420 else if ( player_fight ( u
))
1422 /* Offline fighting not available yet
1423 if (!(online = finduser(ni->stats->battle->nick)) || !nick_identified(online))
1426 notice(s_GameServ, u, "You attack \1f %s\1f for \ 2 %d\ 2 points!", battle->nick, hit);
1428 notice(s_GameServ, u, "You miss \1f %s\1f completely!", battle->nick);
1429 if (hit >= battle->stats->hp)
1431 notice(s_GameServ, u, "You have killed \ 2 %s\ 2 !", battle->nick);
1432 * notice(s_GameServ, u, "You recieve \ 2 %d\ 2 experience and \ 2 %ld\ 2 gold!",
1433 (long int)(battle->stats->exp * .10), battle->stats->gold);
1434 if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
1436 ni->stats->exp += (long int)(battle->stats->exp * .10);
1437 battle->stats->exp -= (long int)(battle->stats->exp * .10);
1441 battle->stats->exp -= (long int)(battle->stats->exp * .10);
1442 ni->stats->exp = 2000000000;
1445 if (2000000000 - ni->stats->gold > battle->stats->gold)
1447 * ni->stats->gold += battle->stats->gold;
1448 battle->stats->gold = 0;
1452 battle->stats->gold = 2000000000 - ni->stats->gold;
1453 ni->stats->gold = 2000000000;
1455 * ni->stats->battle->stats->alive = 0;
1456 ni->stats->battle->battle = NULL;
1457 ni->stats->battle = NULL;
1463 * battle->stats->hp -= hit;
1466 notice(s_GameServ, u, "\1f %s\1f hits you with their \1f %s\1f for \ 2 %d\ 2 damage!",
1467 battle->nick, weapons[battle->stats->weapon], mhit);
1470 notice(s_GameServ, u, "%s completely misses you!", battle->nick);
1472 if (mhit >= ni->stats->hp)
1474 notice(s_GameServ, u, "You have been \ 2 \1f killed\1f \ 2 by %s!", battle->nick);
1475 if (2000000000 - battle->stats->gold > ni->stats->gold)
1477 notice(s_GameServ, u, "%s took all your gold!", battle->nick);
1478 battle->stats->gold += ni->stats->gold;
1479 * ni->stats->gold = 0;
1483 notice(s_GameServ, u, "You're lucky, %s couldn't carry all your gold.",
1485 ni->stats->gold -= (2000000000 - battle->stats->gold);
1486 notice(s_GameServ, u, "You were left dead with %d gold.",
1487 * (long int)ni->stats->gold);
1488 battle->stats->gold = 2000000000;
1490 ni->stats->battle->battle = NULL;
1491 ni->stats->battle = NULL;
1492 ni->stats->alive = 0;
1498 ni->stats->hp -= mhit;
1504 * end offline fighting */
1506 if ( is_playing ( battle
-> getNick ()))
1508 if ( ni
-> stats
-> yourturn
== 0 )
1510 notice ( s_GameServ
, u
, "Please wait until %s decides what to do!" ,
1516 notice ( s_GameServ
, u
, "You attack \1f %s \1f for \ 2 %d \ 2 points!", battle
-> getNick (), hit
);
1518 notice ( s_GameServ
, battle
-> getNick (), " %s has hit you with their %s for " \
1519 "\ 2 %d \ 2 damage!", u
, weapons
[ ni
-> stats
-> weapon
],
1521 ni
-> stats
-> yourturn
= 0 ;
1522 battle
-> stats
-> yourturn
= 1 ;
1523 display_players ( battle
-> getNick ());
1527 notice ( s_GameServ
, u
, "You miss \1f %s \1f completely!", battle
-> getNick ());
1528 notice ( s_GameServ
, battle
-> getNick (), " %s misses you completely!" , u
);
1529 ni
-> stats
-> yourturn
= 0 ;
1530 battle
-> stats
-> yourturn
= 1 ;
1531 display_players ( battle
-> getNick ());
1533 if ( hit
>= battle
-> stats
-> hp
)
1535 notice ( s_GameServ
, u
, "You have killed \ 2 %s \ 2 !", battle
-> getNick ());
1536 notice ( s_GameServ
, u
, "You recieve \ 2 %d \ 2 experience and \ 2 %l d\ 2 gold!" ,
1537 ( long int )( battle
-> stats
-> exp
* .10 ), battle
-> stats
-> gold
);
1538 notice ( s_GameServ
, battle
-> getNick (), "You have been killed by \ 2 %s \ 2 !", u
);
1539 battle
-> stats
-> hp
= 0 ;
1540 battle
-> stats
-> alive
= 0 ;
1542 if ( 2000000000 - ni
-> stats
-> exp
> ( long int )( battle
-> stats
-> exp
* .10 ))
1544 ni
-> stats
-> exp
+= ( long int )( battle
-> stats
-> exp
* .10 );
1545 battle
-> stats
-> exp
-= ( long int )( battle
-> stats
-> exp
* .10 );
1549 battle
-> stats
-> exp
-= ( long int )( battle
-> stats
-> exp
* .10 );
1550 ni
-> stats
-> exp
= 2000000000 ;
1553 if ( 2000000000 - ni
-> stats
-> gold
> battle
-> stats
-> gold
)
1555 notice ( s_GameServ
, battle
-> getNick (), "You lose ten percent of experience and " \
1556 "all gold on hand!" );
1557 ni
-> stats
-> gold
+= battle
-> stats
-> gold
;
1558 battle
-> stats
-> gold
= 0 ;
1562 battle
-> stats
-> gold
= 2000000000 - ni
-> stats
-> gold
;
1563 notice ( s_GameServ
, battle
-> getNick (), "You lose ten percent of your experience!" );
1565 notice ( s_GameServ
, battle
-> getNick (), "However, %s could not carry all of your " \
1568 notice ( s_GameServ
, battle
-> getNick (), "Luckily, you still have \ 2 %l d\ 2 gold " \
1569 "left. All is not lost!" , battle
-> stats
-> gold
);
1571 ni
-> stats
-> gold
= 2000000000 ;
1573 battle
-> stats
-> battle
= NULL
;
1574 ni
-> stats
-> battle
= NULL
;
1580 battle
-> stats
-> hp
-= hit
;
1581 //display_players(battle->getNick());
1582 ni
-> stats
-> yourturn
= 0 ;
1583 battle
-> stats
-> yourturn
= 1 ;
1584 notice ( s_GameServ
, u
, "Please wait while %s decides what to do!" ,
1592 void do_heal ( char * u
)
1595 char * amount
= strtok ( NULL
, " " );
1600 notice ( s_GameServ
, u
, "SYNTAX: /msg %S HEAL {ALL | #}" );
1602 else if (!( ni
= find ( u
)) || ! ni
-> stats
)
1604 notice ( s_GameServ
, u
, "You aren't playing!" );
1606 else if ( is_fighting ( u
))
1608 notice ( s_GameServ
, u
, "You can't heal in battle!" );
1610 else if ( ni
-> stats
-> hp
>= ni
-> stats
-> maxhp
)
1612 notice ( s_GameServ
, u
, "You don't need healing!" );
1614 else if ( stricmp ( amount
, "ALL" ) == 0 )
1616 price
= ni
-> stats
-> level
* 3 ;
1617 if ( ni
-> stats
-> gold
< ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
) * price
)
1619 notice ( s_GameServ
, u
, "Healing \ 2 %d \ 2 points for \ 2 %d \ 2 gold per point.",
1620 ( long int ) ni
-> stats
-> gold
/ price
, price
);
1621 ni
-> stats
-> hp
+= ni
-> stats
-> gold
/ price
;
1622 ni
-> stats
-> gold
%= price
;
1626 notice ( s_GameServ
, u
, "Healing all possible points at \ 2 %d \ 2 gold "\
1627 "per point." , price
);
1628 notice ( s_GameServ
, u
, "\ 2 %d \ 2 points healed for \ 2 %l d\ 2 gold. HP at MAX!" ,
1629 ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
),
1630 ( price
* ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
)) );
1631 ni
-> stats
-> gold
-= price
* ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
);
1632 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1635 else if ( isstringnum ( amount
))
1637 num
= stringtoint ( amount
);
1638 price
= ni
-> stats
-> level
* 3 ;
1639 if ( ni
-> stats
-> gold
< price
* num
)
1641 notice ( s_GameServ
, u
, "You only have enough gold to heal \ 2 %d \ 2 points!",
1642 ( long int ) ni
-> stats
-> gold
/ price
);
1644 else if ( num
<= ni
-> stats
-> maxhp
- ni
-> stats
-> hp
)
1646 notice ( s_GameServ
, u
, "Healing \ 2 %d \ 2 points at \ 2 %d \ 2 gold per point.",
1648 ni
-> stats
-> hp
+= num
;
1649 ni
-> stats
-> gold
-= num
* price
;
1651 else if ( num
> ni
-> stats
-> maxhp
- ni
-> stats
-> hp
)
1653 notice ( s_GameServ
, u
, "Healing all possible points at \ 2 %d \ 2 gold "\
1654 "per point." , price
);
1655 notice ( s_GameServ
, u
, "\ 2 %d \ 2 points healed. HP at MAX!",
1656 ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
));
1657 ni
-> stats
-> gold
-= price
* ( ni
-> stats
-> maxhp
- ni
-> stats
-> hp
);
1658 ni
-> stats
-> hp
= ni
-> stats
-> maxhp
;
1661 else if ( amount
[ 0 ] == '-' )
1662 notice ( s_GameServ
, u
, "You trying to cheat?" );
1664 notice ( s_GameServ
, u
, "SYNTAX: /msg %S HEAL {ALL | #}" );
1667 int isstringnum ( char * num
)
1670 for ( x
= 0 ; x
< strlen ( num
); x
++)
1672 if (( int ) num
[ x
] < 48 || ( int ) num
[ x
] > 57 )
1678 long int stringtoint ( char * number
)
1680 cout
<< "stringtoint: " << number
<< endl
;
1681 long int x
, len
= strlen ( number
), sum
= 0 ;
1683 return chartoint ( number
[ 0 ]);
1684 sum
+= chartoint ( number
[ len
- 1 ]);
1685 for ( x
= len
- 2 ; x
>= 0 ; x
--)
1687 cout
<< "Adding: " << chartoint ( number
[ x
]) * pow ( 10 , abs ( x
- len
+ 1 )) <<
1689 sum
+= chartoint ( number
[ x
]) * pow ( 10 , abs ( x
- len
+ 1 ));
1694 long int pow ( int x
, int y
)
1700 if ( x
!= 0 && y
!= 0 )
1702 for ( count
= 1 ; count
<= y
- 1 ; count
++)
1710 long int chartoint ( char ch
)
1712 if ( int ( ch
) >= 48 && int ( ch
) <= 57 )
1713 return int ( ch
) - 48 ;
1720 ListNode
< aClient
> * ptr
= players
. First ();
1724 outfile
. open ( playerdata
);
1728 cerr
<< "Error opening " << playerdata
<< endl
;
1734 it
= ptr
-> getData ()-> stats
;
1735 outfile
<< it
-> name
<< ' ' << it
-> level
<< ' ' << it
-> exp
<< ' ' << it
-> gold
<< ' ' << it
-> bank
<< ' '
1736 << it
-> hp
<< ' ' << it
-> maxhp
<< ' ' << it
-> strength
<< ' ' << it
-> defense
<< ' '
1737 << it
-> armor
<< ' ' << it
-> weapon
<< ' ' << ( it
-> alive
? "alive" : "dead" ) << ' '
1738 << it
-> forest_fights
<< ' ' << it
-> player_fights
<< ' '
1739 << it
-> password
<< endl
;
1750 char * alive
, * tempname
, * buf
, * password
;
1751 buf
= new char [ 1023 ];
1753 infile
. open ( playerdata
);
1757 cerr
<< "Error opening " << playerdata
<< endl
;
1761 while ( infile
. getline ( buf
, 1024 , ' \n ' ))
1763 cout
<< "temp = new aClient;" << endl
<< flush
;
1765 cout
<< "tempname = strtok(buf, " ");" << endl
<< flush
;
1766 tempname
= strtok ( buf
, " " );
1768 cout
<< "temp->stats = new Player(tempname);" << endl
<< flush
;
1770 temp
-> stats
= new Player ( tempname
);
1772 cout
<< "p = temp->stats;" << endl
<< flush
;
1775 //Kain 1 1 0 500 10 10 0 0 1 1 alive 100 3
1776 p
-> level
= stringtoint ( strtok ( NULL
, " " ));
1777 p
-> exp
= stringtoint ( strtok ( NULL
, " " ));
1778 p
-> gold
= stringtoint ( strtok ( NULL
, " " ));
1779 p
-> bank
= stringtoint ( strtok ( NULL
, " " ));
1780 p
-> hp
= stringtoint ( strtok ( NULL
, " " ));
1781 p
-> maxhp
= stringtoint ( strtok ( NULL
, " " ));
1782 p
-> strength
= stringtoint ( strtok ( NULL
, " " ));
1783 p
-> defense
= stringtoint ( strtok ( NULL
, " " ));
1784 p
-> armor
= stringtoint ( strtok ( NULL
, " " ));
1785 p
-> weapon
= stringtoint ( strtok ( NULL
, " " ));
1786 alive
= strtok ( NULL
, " " );
1787 p
-> alive
= ( stricmp ( alive
, "ALIVE" ) == 0 ? true : false );
1788 p
-> forest_fights
= stringtoint ( strtok ( NULL
, " " ));
1789 p
-> player_fights
= stringtoint ( strtok ( NULL
, " " ));
1790 password
= strtok ( NULL
, " " );
1791 strcpy ( p
-> password
, password
);
1792 temp
-> setNick ( "NULL" );
1794 printf ( " %s %d %l d %l d %l d %d %d %d %d %d %d %s %d %d %s \n " , p
-> name
, p
-> level
,
1795 p
-> exp
, p
-> gold
, p
-> bank
, p
-> hp
, p
-> maxhp
, p
-> strength
, p
-> defense
, p
-> armor
, p
-> weapon
,
1796 alive
, p
-> forest_fights
, p
-> player_fights
, p
-> password
);
1798 cout
<< "Inserting " << temp
-> stats
-> name
<< " at back of list" << endl
;
1799 players
. insertAtBack ( temp
);
1800 cout
<< temp
-> stats
-> name
<< " Inserted, now deleting" << endl
;
1802 cout
<< "Deleted" << endl
;
1807 bool passcmp ( char * encrypted
, char * plaintext
)
1810 char * plaintext2
, * plainToencrypt
;
1813 plaintext2
= new char [ strlen ( encrypted
) + strlen ( plaintext
)]; // Extra
1814 strcpy ( plaintext2
, plaintext
);
1816 salt
[ 0 ] = encrypted
[ 0 ];
1817 salt
[ 1 ] = encrypted
[ 1 ];
1820 plainToencrypt
= crypt ( plaintext2
, salt
);
1822 same
= ( strcmp (( const char *) encrypted
, plainToencrypt
) == 0 ? true : false );
1824 delete [] plaintext2
;
1829 bool check_password ( char * name
, char * plaintext
)
1833 if (!( client
= findplayer ( name
)))
1837 return passcmp ( client
-> stats
-> password
, plaintext
);
1841 void do_store ( char * u
)
1843 char * cmd
= strtok ( NULL
, " " );
1844 char * item
= strtok ( NULL
, " " );
1845 char * num
= strtok ( NULL
, " " );
1851 if (! is_playing ( u
) || !( user
= find ( u
)))
1852 notice ( s_GameServ
, u
, "You must be playing to use the store!" );
1853 else if (! cmd
|| ! item
)
1855 notice ( s_GameServ
, u
, "SYNTAX: STORE LIST {ARMOR | WEAPONS}" );
1856 notice ( s_GameServ
, u
, " \ 2 STORE SELL {ARMOR | WEAPON}\ 2 " );
1857 notice ( s_GameServ
, u
, " \ 2 STORE BUY {ARMOR | WEAPON} \1f NUMBER\1f \ 2 " );
1859 else if ( stricmp ( cmd
, "LIST" ) == 0 )
1861 if ( stricmp ( item
, "WEAPONS" ) == 0 )
1863 notice ( s_GameServ
, u
, "Welcome to Kain's Armory" );
1864 notice ( s_GameServ
, u
, "Here are the weapons we have available for the killing, sire:" );
1865 for ( int x
= 1 ; x
< WNA
; x
++)
1867 space
= spaces ( strlen ( weapons
[ x
]), "." );
1868 notice ( s_GameServ
, u
, " %s%d . %s%s%d " ,( x
< 10 ? " " : "" ), x
, weapons
[ x
], space
, prices
[ x
- 1 ]);
1871 notice ( s_GameServ
, u
, "To purchase a weapon, type /msg %S STORE BUY \ 2 NUM\ 2 ." );
1872 notice ( s_GameServ
, u
, "Where num. is the weapon number from the menu above." );
1875 else if ( stricmp ( item
, "ARMOR" ) == 0 )
1877 notice ( s_GameServ
, u
, "Welcome to Kain's Armory" );
1878 notice ( s_GameServ
, u
, "I hope you enjoy the fine armor we have available for your protection:" );
1879 for ( int x
= 1 ; x
< WNA
; x
++)
1881 space
= spaces ( strlen ( armors
[ x
]), "." );
1882 notice ( s_GameServ
, u
, " %s%d . %s%s%d " ,( x
< 10 ? " " : "" ), x
, armors
[ x
], space
, prices
[ x
- 1 ]);
1885 notice ( s_GameServ
, u
, "To purchase armor, type /msg %S store buy armor num." );
1886 notice ( s_GameServ
, u
, "Where num. is the armor number from the menu above." );
1890 } else if ( stricmp ( cmd
, "BUY" ) == 0 ) {
1893 notice ( s_GameServ
, u
, "SYNTAX: \ 2 STORE BUY {ARMOR | WEAPON} \1f NUMBER\1f \ 2 " );
1896 else if (! isstringnum ( num
))
1898 notice ( s_GameServ
, u
, "You must specify a number between 1 and %d . Not %s !" , WNA
- 1 , num
);
1901 if ( stricmp ( item
, "WEAPON" ) == 0 )
1903 wep
= stringtoint ( num
);
1904 if ( wep
>= WNA
|| wep
< 1 )
1906 notice ( s_GameServ
, u
, "The number %d is out of range. The number you provide must be between 1 and %d ." , wep
, WNA
- 1 );
1913 notice ( s_GameServ
, u
, "You have to sell your %s first!" , weapons
[ p
-> weapon
]);
1914 else if ( p
-> gold
< prices
[ wep
- 1 ])
1915 notice ( s_GameServ
, u
, "You don't have enough gold for %s !" , weapons
[ wep
]);
1918 notice ( s_GameServ
, u
, "You have purchased %s ! Thanks for the gold!" , weapons
[ wep
]);
1920 p
-> gold
-= prices
[ wep
- 1 ];
1923 else if ( stricmp ( item
, "ARMOR" ) == 0 )
1925 wep
= stringtoint ( num
);
1926 if ( wep
>= WNA
|| wep
< 1 )
1928 notice ( s_GameServ
, u
, "The number %d is out of range. The number you provide must be between 1 and %d ." , wep
, WNA
- 1 );
1935 notice ( s_GameServ
, u
, "You have to sell your %s first!" , armors
[ p
-> armor
]);
1936 else if ( p
-> gold
< prices
[ wep
- 1 ])
1937 notice ( s_GameServ
, u
, "You don't have enough gold for %s !" , armors
[ wep
]);
1940 notice ( s_GameServ
, u
, "You have purchased %s ! Thanks for the gold!" , armors
[ wep
]);
1942 p
-> gold
-= prices
[ wep
- 1 ];
1946 else if ( stricmp ( cmd
, "SELL" ) == 0 )
1950 if ( stricmp ( item
, "WEAPON" ) == 0 )
1954 notice ( s_GameServ
, u
, "You want me to chop off your hands?" );
1957 else if ( p
-> gold
== 2000000000 )
1959 notice ( s_GameServ
, u
, "You have enough gold. I'll just take that off your hands, sire." );
1962 else if ( 2000000000 - p
-> gold
< ( prices
[ p
-> weapon
- 1 ] / 2 ))
1964 notice ( s_GameServ
, u
, "Thank you for your business! You now have as much gold as you can carry." );
1965 notice ( s_GameServ
, u
, "However, you have no weapon... can I interest you in the %s ?" , weapons
[ WNA
- 1 ]);
1966 p
-> gold
= 2000000000 ;
1971 notice ( s_GameServ
, u
, "Thank you for your business! You now have %d more gold but no weapon!" , ( prices
[ p
-> weapon
- 1 ] / 2 ));
1972 p
-> gold
+= ( prices
[ p
-> weapon
- 1 ] / 2 );
1976 else if ( stricmp ( item
, "ARMOR" ) == 0 )
1982 notice ( s_GameServ
, u
, "I don't think you can be any more naked..." );
1985 if ( p
-> gold
== 2000000000 )
1987 notice ( s_GameServ
, u
, "You have enough gold. I'll just take that off your hands, sire." );
1990 else if ( 2000000000 - p
-> gold
< ( prices
[ p
-> armor
- 1 ] / 2 ))
1992 notice ( s_GameServ
, u
, "Thank you for your business! You now have as much gold as you can carry." );
1993 notice ( s_GameServ
, u
, "However, you have no armor... can I interest you in %s ?" , armors
[ WNA
- 1 ]);
1994 p
-> gold
= 2000000000 ;
1999 notice ( s_GameServ
, u
, "Thank you for your business! You now have %d more gold but no armor!" ,
2000 ( prices
[ p
-> armor
- 1 ] / 2 ));
2002 p
-> gold
+= ( prices
[ p
-> armor
- 1 ] / 2 );
2008 notice ( s_GameServ
, u
, "SYNTAX: STORE LIST {ARMOR | WEAPONS}" );
2009 notice ( s_GameServ
, u
, " \ 2 STORE SELL {ARMOR | WEAPON}\ 2 " );
2010 notice ( s_GameServ
, u
, " \ 2 STORE BUY {ARMOR | WEAPON} \1f NUMBER\1f \ 2 " );
2015 void do_bank ( char * u
)
2017 char * cmd
= strtok ( NULL
, " " );
2018 char * amount
= strtok ( NULL
, " " );
2019 char * nick
= strtok ( NULL
, " " );
2024 if (! cmd
|| ! amount
|| ( stricmp ( cmd
, "TRANSFER" ) == 0 && ! nick
))
2026 notice ( s_GameServ
, u
, "BANK {WITHDRAW | DEPOSIT} {ALL | AMOUNT}" );
2029 else if (! is_playing ( u
) || !( user
= find ( u
)))
2031 notice ( s_GameServ
, u
, "You must be playing to use the bank!" );
2034 else if (! isstringnum ( amount
) && stricmp ( amount
, "ALL" ) != 0 )
2036 notice ( s_GameServ
, u
, "I don't know how to convert alphabet letters into currency, sire!" );
2042 if ( stricmp ( cmd
, "DEPOSIT" ) == 0 )
2044 if ( p
-> bank
== 2000000000 )
2046 notice ( s_GameServ
, u
, "Your bank account is full, sire!" );
2049 else if ( stricmp ( amount
, "ALL" ) == 0 )
2051 if ( 2000000000 - p
-> bank
< p
-> gold
)
2053 notice ( s_GameServ
, u
, "You don't have enough room for all of your gold." );
2054 notice ( s_GameServ
, u
, "Depositing %l d gold into your account" , ( 2000000000 - p
-> bank
));
2055 p
-> gold
-= ( 2000000000 - p
-> bank
);
2056 p
-> bank
= 2000000000 ;
2060 notice ( s_GameServ
, u
, "Depositing %l d gold into your account!" , p
-> gold
);
2065 else if ( stringtoint ( amount
) > p
-> gold
)
2067 notice ( s_GameServ
, u
, "Sire, you only have %l d gold!" , p
-> gold
);
2072 if ( 2000000000 - p
-> bank
< stringtoint ( amount
))
2074 notice ( s_GameServ
, u
, "You don't have room in your account for that much." );
2075 notice ( s_GameServ
, u
, "Capping off your account with %l d gold!" , ( 2000000000 - p
-> bank
));
2076 p
-> gold
-= ( 2000000000 - p
-> bank
);
2077 p
-> bank
= 2000000000 ;
2081 notice ( s_GameServ
, u
, "Depositing %d gold into your account!" , stringtoint ( amount
));
2082 p
-> bank
+= stringtoint ( amount
);
2083 p
-> gold
-= stringtoint ( amount
);
2087 else if ( stricmp ( cmd
, "WITHDRAW" ) == 0 )
2089 if ( p
-> gold
== 2000000000 )
2091 notice ( s_GameServ
, u
, "You cannot carry any more gold, sire!" );
2094 else if ( stricmp ( amount
, "ALL" ) == 0 )
2096 if ( 2000000000 - p
-> gold
< p
-> bank
)
2098 notice ( s_GameServ
, u
, "You don't have enough room to carry all that gold." );
2099 notice ( s_GameServ
, u
, "Withdrawing %l d gold from your account" , ( 2000000000 - p
-> gold
));
2100 p
-> bank
-= ( 2000000000 - p
-> gold
);
2101 p
-> gold
= 2000000000 ;
2105 notice ( s_GameServ
, u
, "Withdrawing %l d gold from your account!" , p
-> bank
);
2110 else if ( stringtoint ( amount
) > p
-> bank
)
2112 notice ( s_GameServ
, u
, "Sire, you only have %l d gold in the bank!" , p
-> bank
);
2117 if ( 2000000000 - p
-> gold
< stringtoint ( amount
))
2119 notice ( s_GameServ
, u
, "You don't enough have room to carry that much gold!" );
2120 notice ( s_GameServ
, u
, "You fill your pockets with %l d gold!" ,
2121 ( 2000000000 - p
-> gold
));
2122 p
-> bank
-= ( 2000000000 - p
-> gold
);
2123 p
-> gold
= 2000000000 ;
2127 notice ( s_GameServ
, u
, "Withdrawing %d gold from your account!" , stringtoint ( amount
));
2128 p
-> gold
+= stringtoint ( amount
);
2129 p
-> bank
-= stringtoint ( amount
);