]> jfr.im git - irc/gameservirc.git/commitdiff
Implemented DrLnet's player fight notification mod
authorkainazzzo <redacted>
Sat, 8 Oct 2005 21:54:50 +0000 (21:54 +0000)
committerkainazzzo <redacted>
Sat, 8 Oct 2005 21:54:50 +0000 (21:54 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@384 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/do_attack.cpp
gameserv/gameserv.cpp

index a45e9f1e9c6883122d8a0209280468d08cd51533..92ad40951794d0f44970bcfa89dc4e0825816a7d 100644 (file)
@@ -245,7 +245,8 @@ void do_attack(char *u)
            {
              notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->stats->name.c_str());
              notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!",
-                    (long int)(battle->stats->exp * .10), battle->stats->gold);
+                                (long int)(battle->stats->exp * .10), battle->stats->gold);
+                 addNews(todaysnews, "%s has defeated %s, leaving %s in a pool of blood", ni->stats->name.c_str(), battle->stats->name.c_str()); /* DrLnet - Modified by kain for news instead of just a message */ 
              notice(s_GameServ, battle->getNick(), "You have been killed by \ 2%s\ 2!",
                     ni->stats->name.c_str());
              battle->stats->hp = 0;
index e38d7fbb6c1b1303ea306a10914c7c16e7ea5274..bffee494a8c039406497ad6616b9928a9f6464b3 100644 (file)
@@ -1544,124 +1544,127 @@ bool dragon_fight(aClient *user)
 }
 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)
@@ -1783,56 +1786,57 @@ void do_use(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)