}
void do_fight(char *u)
{
- aClient *ni, *battle;
-
- char *nick = strtok(NULL, " ");
-
- if (!nick)
- {
- notice(s_GameServ, u, "SYNTAX: /msg %S FIGHT PLAYER");
- return;
- }
- else if (!(ni = find(u)))
- {
- notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, ""));
- return;
- }
- else if (isIgnore(ni))
+ aClient *ni, *battle;
+
+ char *nick = strtok(NULL, " ");
+
+ if (!nick)
{
- #ifdef DEBUGMODE
- log("Ignoring %s.", ni->getNick());
- #endif
- return;
+ notice(s_GameServ, u, "SYNTAX: /msg %S FIGHT PLAYER");
+ return;
}
- else if (!is_playing(ni))
+ else if (!(ni = find(u)))
{
- notice(s_GameServ, u, "You are not playing!");
- return;
+ notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, ""));
+ return;
}
-
- updateTS(ni->stats);
-
- if (ni->stats->player_fights <= 0)
+ else if (isIgnore(ni))
{
- ni->stats->player_fights = 0; // just to be safe
- notice(s_GameServ, u, "You are out of player fights for the "\
- "day. You have to wait until tomorrow!");
+#ifdef DEBUGMODE
+ log("Ignoring %s.", ni->getNick());
+#endif
+ return;
}
- else if (!(battle = findplayer(nick)))
+ else if (!is_playing(ni))
{
- notice(s_GameServ, u, "Player %s not found!", nick);
+ notice(s_GameServ, u, "You are not playing!");
+ return;
}
- else if (!isAlive(ni->stats))
+
+ updateTS(ni->stats);
+
+ if (ni->stats->player_fights <= 0)
{
- notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!");
+ ni->stats->player_fights = 0; // just to be safe
+ notice(s_GameServ, u, "You are out of player fights for the "\
+ "day. You have to wait until tomorrow!");
}
- else if (!is_playing(battle))
+ else if (!(battle = findplayer(nick)))
{
- notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick);
+ notice(s_GameServ, u, "Player %s not found!", nick);
}
-
-/* offline fighting not available yet
- else if (!(fight = finduser(nick)))
+ else if (!isAlive(ni->stats))
{
- ni->stats->battle = battle;
- battle->battle = ni;
- setYourTurn(ni->stats);
- clearYourTurn(battle->stats);
-
- notice(s_GameServ, u, "You decide to fight %s while they're "\
- "not in the realm!",
- battle->stats->name.c_str());
- display_players(u);
+ notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!");
}
-*/
- else if (stricmp(ni->stats->name.c_str(), battle->stats->name.c_str()) == 0)
+ else if (!is_playing(battle))
{
- notice(s_GameServ, u, "Are you trying to commit suicide!?");
+ notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick);
}
- else if (!isAlive(battle->stats))
+
+ /* offline fighting not available yet
+ else if (!(fight = finduser(nick)))
+ {
+ ni->stats->battle = battle;
+ battle->battle = ni;
+ setYourTurn(ni->stats);
+ clearYourTurn(battle->stats);
+
+ notice(s_GameServ, u, "You decide to fight %s while they're "\
+ "not in the realm!",
+ battle->stats->name.c_str());
+ display_players(u);
+ }
+ */
+ else if (stricmp(ni->stats->name.c_str(), battle->stats->name.c_str()) == 0)
{
- notice(s_GameServ, u, "They are dead. Cannot fight dead players!");
+ notice(s_GameServ, u, "Are you trying to commit suicide!?");
}
- else if (player_fight(battle))
+ else if (!isAlive(battle->stats))
{
- notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name.c_str(), battle->stats->battle->stats->name.c_str());
+ notice(s_GameServ, u, "They are dead. Cannot fight dead players!");
}
- else if (master_fight(battle))
+ else if (player_fight(battle))
{
- notice(s_GameServ, u, "%s is fighting their master!", battle->stats->name.c_str());
+ notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name.c_str(), battle->stats->battle->stats->name.c_str());
}
- else if (is_fighting(battle))
+ else if (master_fight(battle))
{
- notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name.c_str(), battle->stats->fight->name.c_str());
+ notice(s_GameServ, u, "%s is fighting their master!", battle->stats->name.c_str());
}
- else if (ni->stats->level - battle->stats->level > maxbfightdistance)
+ else if (is_fighting(battle))
{
- // You can't fight someone below you by more than X level(s)
- // level 12 can fight level (12 - X) but not < (12 - X)
- notice(s_GameServ, u, "You may not fight %s. You're too strong!",
- battle->stats->name.c_str());
+ notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name.c_str(), battle->stats->fight->name.c_str());
}
- else if (battle->stats->level - ni->stats->level > maxafightdistance)
+ else if (ni->stats->level - battle->stats->level > maxbfightdistance)
{
- // You can't fight someone above you by more than X level(S)
- // level 1 can fight level (1 + X), but not > (1 + X)
- notice(s_GameServ, u, "%s, do you really have a death wish? Try the forest you "\
- "weakling!", ni->stats->name.c_str());
+ // You can't fight someone below you by more than X level(s)
+ // level 12 can fight level (12 - X) but not < (12 - X)
+ notice(s_GameServ, u, "You may not fight %s. You're too strong!",
+ battle->stats->name.c_str());
}
- else
+ else if (battle->stats->level - ni->stats->level > maxafightdistance)
{
- // Set your battle pointer to the other player
- ni->stats->battle = battle;
-
- // Set the other player's battle pointer to you
- ni->stats->battle->stats->battle = ni;
-
- // The initiator gets the first move (perhaps this should be 50/50)
- setYourTurn(ni->stats);
- clearYourTurn(battle->stats);
-
- // Initiate Battle sequence!
- ni->stats->player_fights -= 1;
-
- notice(s_GameServ, u, "You challenge %s to an online duel!", battle->stats->name.c_str());
- notice(s_GameServ, battle->getNick(), "%s has challenged you to an online duel!", ni->stats->name.c_str());
- notice(s_GameServ, battle->getNick(), "%s gets to go first "\
- "because they initiated!", ni->stats->name.c_str());
- notice(s_GameServ, battle->getNick(), "Please wait while %s decides what to do.", ni->stats->name.c_str());
- display_players(ni);
+ // You can't fight someone above you by more than X level(S)
+ // level 1 can fight level (1 + X), but not > (1 + X)
+ notice(s_GameServ, u, "%s, do you really have a death wish? Try the forest you "\
+ "weakling!", ni->stats->name.c_str());
}
+ else
+ {
+ // Set your battle pointer to the other player
+ ni->stats->battle = battle;
+
+ // Set the other player's battle pointer to you
+ ni->stats->battle->stats->battle = ni;
+
+ // The initiator gets the first move (perhaps this should be 50/50)
+ setYourTurn(ni->stats);
+ clearYourTurn(battle->stats);
+
+ // Initiate Battle sequence!
+ ni->stats->player_fights -= 1;
+
+ notice(s_GameServ, u, "You challenge %s to an online duel!", battle->stats->name.c_str());
+ notice(s_GameServ, c_Forest, "%s walks up and hits %s in the face! Let's see who will bite the dust.",
+ ni->stats->name.c_str(), battle->stats->name.c_str()); /* DrLnet - Modified by Kain*/
+
+ notice(s_GameServ, battle->getNick(), "%s has challenged you to an online duel!", ni->stats->name.c_str());
+ notice(s_GameServ, battle->getNick(), "%s gets to go first "\
+ "because they initiated!", ni->stats->name.c_str());
+ notice(s_GameServ, battle->getNick(), "Please wait while %s decides what to do.", ni->stats->name.c_str());
+ display_players(ni);
+ }
}
void do_equip(char *u)
}
void do_run(char *u)
{
- aClient *user;
- Player *p, *p2 = NULL;
-
- if (!(user = find(u)))
+ aClient *user;
+ Player *p, *p2 = NULL;
+
+ if (!(user = find(u)))
{
- notice(s_GameServ, u, "Couldn't find you. Error. Contact a %S admin");
- return;
+ notice(s_GameServ, u, "Couldn't find you. Error. Contact a %S admin");
+ return;
}
- else if (isIgnore(user))
+ else if (isIgnore(user))
{
- #ifdef DEBUGMODE
- log("Ignoring %s.", user->getNick());
- #endif
- return;
+#ifdef DEBUGMODE
+ log("Ignoring %s.", user->getNick());
+#endif
+ return;
}
- else if (!is_playing(user))
+ else if (!is_playing(user))
{
- notice(s_GameServ, u, "You must be playing to run!");
- return;
+ notice(s_GameServ, u, "You must be playing to run!");
+ return;
}
-
- updateTS(user->stats);
- p = user->stats;
-
- if (p->battle)
+
+ updateTS(user->stats);
+ p = user->stats;
+
+ if (p->battle)
p2 = p->battle->stats;
-
- if (!is_fighting(user))
+
+ if (!is_fighting(user))
notice(s_GameServ, u, "You run in place... try fighting next time.");
- else if (!player_fight(user) && !master_fight(user))
+ else if (!player_fight(user) && !master_fight(user))
{
- notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p->fight->name.c_str());
- delete p->fight;
- p->fight = NULL;
+ notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p->fight->name.c_str());
+ delete p->fight;
+ p->fight = NULL;
}
- else if (player_fight(user) && isYourTurn(p))
+ else if (player_fight(user) && isYourTurn(p))
{
- notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p2->name.c_str());
- notice(s_GameServ, p->battle->getNick(), "\ 2%s\ 2 ran away from you like a little baby!", p->name.c_str());
- p2->battle = NULL;
+ notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p2->name.c_str());
+ notice(s_GameServ, p->battle->getNick(), "\ 2%s\ 2 ran away from you like a little baby!", p->name.c_str());
+ addNews(todaysnews, "%s ran away from %s like a little baby!!", p->name.c_str(), p2->name.c_str()); /* DrLnet - edited by Kain */
+ p2->battle = NULL;
}
- else if (player_fight(user) && !isYourTurn(p))
+ else if (player_fight(user) && !isYourTurn(p))
{
- notice(s_GameServ, u, "It is not your turn. Please wait until \ 2%s\ 2 decides what to do.", p2->name.c_str());
+ notice(s_GameServ, u, "It is not your turn. Please wait until \ 2%s\ 2 decides what to do.", p2->name.c_str());
}
- else if (master_fight(user))
+ else if (master_fight(user))
{
- notice(s_GameServ, u, "You cannot run from \ 2%s\ 2! FIGHT!", p->master->name.c_str());
+ notice(s_GameServ, u, "You cannot run from \ 2%s\ 2! FIGHT!", p->master->name.c_str());
}
- p->battle = NULL;
+ p->battle = NULL;
}
void end_turn(aClient *user)