]> jfr.im git - irc/gameservirc.git/blob - gameserv/do_dragon.cpp
Added code for the start of the DataLayer format as well as a basic FilePlayerDAO...
[irc/gameservirc.git] / gameserv / do_dragon.cpp
1 #include "extern.h"
2 #include "aClient.h"
3 #include "flags.h"
4 #include "options.h"
5 #include "item.h"
6
7 Monster dragon; // The current dragon
8
9 void do_dragon(char *u)
10 {
11 aClient *user;
12
13 if (!(user = find(u)))
14 {
15 notice(s_GameServ, u, "Fatal error. Contact a(n) <S admin. buf: %s", strtok(NULL, ""));
16 return;
17 }
18 else if (isIgnore(user))
19 {
20 #ifdef DEBUGMODE
21 log("Ignoring %s.", user->getNick());
22 #endif
23 return;
24 }
25 else if (!is_playing(user))
26 {
27 notice(s_GameServ, u, "You must be playing to fight the dragon!");
28 return;
29 }
30 else if (is_fighting(user))
31 {
32 notice(s_GameServ, u, "You are already in a fight. How will you fight the almighty dragon!?");
33 return;
34 }
35 else if (!isAlive(user->stats))
36 {
37 notice(s_GameServ, u, "You're dead. Wait until tomorrow to see your master!");
38 return;
39 }
40 else if (user->stats->getLevel() < LEVELS)
41 {
42 notice(s_GameServ, u, "You fool! Only those strong enough "\
43 "to vanquish any foe should DARE fight the dragon!");
44 notice(s_GameServ, u, "To put it in terms you can understand: "\
45 "You are too weak. You must be Level %d!", REALLEVELS);
46 return;
47 }
48
49 updateTS(user->stats);
50
51 Player *p = user->stats;
52 setMaster(p);
53 notice(s_GameServ, u, "You approach the dragon's lair cautiously.");
54 notice(s_GameServ, u, "The stench of sulfer fills the air as a "\
55 "deep, red fog rolls in. The air is filled with the "\
56 "heated mist of deadly fire from beyond the cave "\
57 "entrance.");
58 notice(s_GameServ, u, "You adjust your %s, tighten your grip on "\
59 "your %s, and venture into the hot, dark cave. "\
60 "You are surprised at the angle of descent as you climb "\
61 "lower and lower, deeper into the dragon's den.",
62 (p->getArmor() ? p->getArmor()->getName().c_str() : "Fists"), (p->getWeapon() ? p->getWeapon()->getName().c_str() : "Birthday Suit"));
63 notice(s_GameServ, u, "You come to the end of the cave to find "\
64 "a tooth. It is a large tooth... bigger than your torso."\
65 " Suddenly the darkness lifts from the gleam of an eye "\
66 " staring into your soul! The eye is large... HUGE!");
67 notice(s_GameServ, u, "Just then you notice the eye begin to "\
68 "glare orange! The tooth is moving... but it is still too "\
69 "dark for you to make out.... THE DRAGON! You see it!");
70 p->setMonster(&dragon);
71 setDragonFight(p);
72 display_monster(u);
73 }