]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Fixed a bug causing the dragon's stats to be displayed twice
[irc/gameservirc.git] / gameserv / gameserv.cpp
index 527480a1804b90acc18af95c029e6a5a07fad558..8926afea894f02e69bf2a0c7060f613854ee213f 100644 (file)
@@ -675,7 +675,7 @@ void do_set(char *u)
     }
   else if (!name)
     {
-      notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|WEAPON|ARMOR|HP POTIONS|STRENGTH POTIONS|DEFENSE POTIONS|HEALING POTIONS|ALIVE|SEEN MASTER} {STRING|NUMBER|ON|OFF}");
+      notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|WEAPON|ARMOR|HP POTIONS|STRENGTH POTIONS|DEFENSE POTIONS|HEALING POTIONS|ALIVE|SEEN MASTER} {STRING|NUMBER|TRUE|FALSE}");
       return;
     }
   else if (!(target = findplayer(name)))
@@ -715,20 +715,23 @@ void do_set(char *u)
     }
   else if (stricmp(cmd, "BANK") == 0 || stricmp(cmd, "BALANCE") == 0)
     {
-      if (!isAdmin(user))
+        if (!isAdmin(user))
        {
          notice(s_GameServ, u, "Admins Only!");
          return;
        }
-      else if (stricmp(cmd, "BANK") == 0)
+       else if (stricmp(cmd, "BANK") == 0)
        {
          cmd2 = strtok(NULL, " "); // Need an extra parameter for set bank balance
        }
-      else
+       if (!cmd2)
        {
-         target->stats->bank = stringtoint(cmd2);
-         notice(s_GameServ, u, "Balance changed!");
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] [BANK] BALANCE <NUMBER>");
+           return;
        }
+
+       target->stats->bank = stringtoint(cmd2);
+       notice(s_GameServ, u, "Bank balance changed to %s!", cmd2);
     }
   else if (stricmp(cmd, "PLAYER") == 0)
     {
@@ -739,14 +742,19 @@ void do_set(char *u)
        }
       else if (stricmp(cmd2, "FIGHTS") != 0)
        {
-         notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] PLAYER FIGHTS <number>");
+         notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] PLAYER FIGHTS <NUMBER>");
          return;
        }
       else
        {
          cmd2 = strtok(NULL, " ");
+           if (!cmd2)
+           {
+               notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] PLAYER FIGHTS <NUMBER>");
+               return;
+           }
          target->stats->player_fights = stringtoint(cmd2);
-         notice(s_GameServ, u, "Player fights changed!");
+         notice(s_GameServ, u, "Player fights changed to %s!", cmd2);
        }         
     }
   else if (stricmp(cmd, "FOREST") == 0)
@@ -764,8 +772,13 @@ void do_set(char *u)
       else
        {
          cmd2 = strtok(NULL, " ");
-         target->stats->player_fights = stringtoint(cmd2);
-         notice(s_GameServ, u, "Player fights changed!");
+           if (!cmd2)
+           {
+               notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] FOREST FIGHTS <NUMBER>");
+               return;
+           }
+         target->stats->forest_fights = stringtoint(cmd2);
+         notice(s_GameServ, u, "Forest fights changed to %s!", cmd2);
        }         
     }
   else if (stricmp(cmd, "GOLD") == 0)
@@ -777,12 +790,17 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] GOLD <NUMBER>");
+           return;
+       }
          target->stats->gold = stringtoint(cmd2);
          notice(s_GameServ, u, "Gold set to %s", cmd2);
          return;
        }
   }
-  else if (stricmp(cmd, "STRENGTH") == 0 && stricmp(cmd, "POTIONS") != 0)
+  else if (stricmp(cmd, "STRENGTH") == 0 && stricmp(cmd2, "POTIONS") != 0)
   {
     if (!isAdmin(user))
        {
@@ -791,12 +809,18 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] STRENGTH <NUMBER>");
+           return;
+       }
+
          target->stats->strength = stringtoint(cmd2);
          notice(s_GameServ, u, "Strength set to %s", cmd2);
          return;
        }
   }
-  else if (stricmp(cmd, "DEFENSE") == 0 && stricmp(cmd, "POTIONS") != 0)
+  else if (stricmp(cmd, "DEFENSE") == 0 && stricmp(cmd2, "POTIONS") != 0)
   {
     if (!isAdmin(user))
        {
@@ -805,6 +829,12 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] DEFENSE <NUMBER>");
+           return;
+       }
+
          target->stats->defense = stringtoint(cmd2);
          notice(s_GameServ, u, "Defense set to %s", cmd2);
          return;
@@ -819,6 +849,11 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] HP <NUMBER>");
+           return;
+       }
          target->stats->hp = stringtoint(cmd2);
          notice(s_GameServ, u, "HP set to %s", cmd2);
          return;
@@ -833,6 +868,11 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] MAXHP <NUMBER>");
+           return;
+       }
          target->stats->maxhp = stringtoint(cmd2);
          notice(s_GameServ, u, "MaxHP set to %s", cmd2);
          return;
@@ -847,6 +887,12 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] {EXPERIENCE|EXP} <NUMBER>");
+           return;
+       }
+
          target->stats->exp = stringtoint(cmd2);
          notice(s_GameServ, u, "Exp set to %s", cmd2);
          return;
@@ -861,6 +907,11 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] LEVEL <NUMBER>");
+           return;
+       }
          target->stats->level = stringtoint(cmd2);
          notice(s_GameServ, u, "Level set to %s", cmd2);
          return;
@@ -875,6 +926,12 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] WEAPON <NUMBER>");
+           return;
+       }
+
          target->stats->weapon = stringtoint(cmd2);
          notice(s_GameServ, u, "Weapon set to %s", weapons[target->stats->weapon]);
          return;
@@ -889,6 +946,11 @@ void do_set(char *u)
        }
     else
        {
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] ARMOR <NUMBER>");
+           return;
+       }
          target->stats->armor = stringtoint(cmd2);
          notice(s_GameServ, u, "Armor set to %s", armors[target->stats->armor]);
          return;
@@ -904,6 +966,11 @@ void do_set(char *u)
     else
        {
          cmd2 = strtok(NULL, " ");
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] HP POTIONS <NUMBER>");
+           return;
+       }
          target->stats->inventory.setHP(stringtoint(cmd2));
          notice(s_GameServ, u, "HP Potions set to %s", cmd2);
          return;
@@ -919,6 +986,11 @@ void do_set(char *u)
     else
        {
          cmd2 = strtok(NULL, " ");
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] HEALING POTIONS <NUMBER>");
+           return;
+       }
          target->stats->inventory.setHealing(stringtoint(cmd2));
          notice(s_GameServ, u, "Healing Potions set to %s", cmd2);
          return;
@@ -934,6 +1006,11 @@ void do_set(char *u)
     else
        {
          cmd2 = strtok(NULL, " ");
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] STRENGTH POTIONS <NUMBER>");
+           return;
+       }
          target->stats->inventory.setStrength(stringtoint(cmd2));
          notice(s_GameServ, u, "Strength Potions set to %s", cmd2);
          return;
@@ -949,6 +1026,11 @@ void do_set(char *u)
     else
        {
          cmd2 = strtok(NULL, " ");
+       if (!cmd2)
+       {
+           notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] DEFENSE POTIONS <NUMBER>");
+           return;
+       }
          target->stats->inventory.setDefense(stringtoint(cmd2));
          notice(s_GameServ, u, "Defense Potions set to %s", cmd2);
          return;
@@ -969,12 +1051,54 @@ void do_set(char *u)
             notice(s_GameServ, u, "SYNTAX: /msg %S SET ALIVE TRUE|FALSE");
             return;
          }
+         else if (stricmp(cmd2, "TRUE") == 0)
+         {
+            notice(s_GameServ, u, "Target has been Resurrected!");
+            target->addFlag(FLAG_ALIVE);
+         }
+         else
+         {
+            notice(s_GameServ, u, "Target is now dead!");
+            target->remFlag(FLAG_ALIVE);
+         }
        }
   }
+  else if (stricmp(cmd, "SEEN") == 0)
+    {
+      if (!isAdmin(user))
+       {
+         notice(s_GameServ, u, "Admins Only!");
+         return;
+       }
+      else if (stricmp(cmd2, "MASTER") != 0)
+       {
+         notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] SEEN MASTER {TRUE|FALSE}");
+         return;
+       }
+      else
+       {
+         cmd2 = strtok(NULL, " ");
+         if (!cmd2 || (stricmp(cmd2, "TRUE") != 0 && stricmp(cmd2, "FALSE") != 0))
+         {
+            notice(s_GameServ, u, "SYNTAX: /msg %S SET [NICK] SEEN MASTER {TRUE|FALSE}");
+            return;
+         }
+         else if (stricmp(cmd2, "TRUE") == 0)
+         {
+            notice(s_GameServ, u, "Target has seen their master now.");
+            target->addFlag(FLAG_MASTER);
+         }
+         else
+         {
+            notice(s_GameServ, u, "Target has not seen their master now.");
+            target->remFlag(FLAG_MASTER);
+         }
+       }         
+    }
   else
   {
      notice(s_GameServ, u, "Unknown command: SET %s", cmd);
-     notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|WEAPON|ARMOR|HP POTIONS|STRENGTH POTIONS|DEFENSE POTIONS|HEALING POTIONS|ALIVE|SEEN MASTER} {STRING|NUMBER|ON|OFF}");
+     notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|WEAPON|ARMOR|HP POTIONS|STRENGTH POTIONS|DEFENSE POTIONS|HEALING POTIONS|ALIVE|SEEN MASTER} {STRING|NUMBER|TRUE|FALSE}");
      return;
   }
 }
@@ -3121,7 +3245,6 @@ void do_dragon(char *u)
 
     Player *p = user->stats;
     setMaster(p);
-    see_master(u);
     notice(s_GameServ, u, "You approach the dragon's lair cautiously.");
     notice(s_GameServ, u, "The stench of sulfer fills the air as a "\
        "deep, red fog rolls in. The air is filled with the "\
@@ -3139,7 +3262,7 @@ void do_dragon(char *u)
     notice(s_GameServ, u, "Just then you notice the eye begin to "\
        "glare orange! The tooth is moving... but it is still too "\
        "dark for you to make out.... THE DRAGON! You see it!");
-    display_monster(u);
+    see_master(u);
 }
 
 void do_master(char *u)