]> jfr.im git - irc/gameservirc.git/commitdiff
Added do_register.cpp, do_identify.cpp, do_list.cpp, do_help.cpp, do_refresh.cpp...
authorkainazzzo <redacted>
Mon, 22 Jan 2007 04:52:34 +0000 (04:52 +0000)
committerkainazzzo <redacted>
Mon, 22 Jan 2007 04:52:34 +0000 (04:52 +0000)
Updated dependencies

git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@476 bc333340-6410-0410-a689-9d09f3c113fa

12 files changed:
gameserv/.depend
gameserv/Makefile.in
gameserv/do_heal.cpp [new file with mode: 0644]
gameserv/do_help.cpp [new file with mode: 0644]
gameserv/do_identify.cpp [new file with mode: 0644]
gameserv/do_inventory.cpp [new file with mode: 0644]
gameserv/do_list.cpp [new file with mode: 0644]
gameserv/do_refresh.cpp [new file with mode: 0644]
gameserv/do_register.cpp [new file with mode: 0644]
gameserv/extern.h
gameserv/gameserv.cpp
gameserv/misc.cpp

index 7041eb1f632107b87583cc52a35605d1fd36d39f..2baf48efab3302b983fee57d82c37418352ae409 100644 (file)
@@ -16,6 +16,19 @@ do_equip.o: do_equip.cpp extern.h config.h options.h aClient.h player.h \
   script.h pouch.h item.h level.h flags.h
 do_fight.o: do_fight.cpp extern.h config.h options.h aClient.h player.h \
   script.h flags.h
+do_heal.o: do_heal.cpp extern.h config.h options.h aClient.h player.h \
+  script.h flags.h
+do_help.o: do_help.cpp extern.h config.h options.h
+do_identify.o: do_identify.cpp extern.h config.h options.h aClient.h \
+  player.h script.h flags.h
+do_inventory.o: do_inventory.cpp extern.h config.h options.h aClient.h \
+  player.h script.h flags.h
+do_list.o: do_list.cpp extern.h config.h options.h player.h script.h \
+  aClient.h flags.h toplist.h
+do_refresh.o: do_refresh.cpp extern.h config.h options.h aClient.h \
+  player.h script.h flags.h
+do_register.o: do_register.cpp extern.h config.h options.h aClient.h \
+  player.h script.h flags.h pouch.h item.h level.h toplist.h
 find.o: find.cpp extern.h config.h options.h item.h level.h player.h \
   script.h
 gameserv.o: gameserv.cpp aClient.h options.h player.h script.h config.h \
index 957984b43019ffa0d7970d2282819e48bb6c0122..adf6fe85ec81154aedf8b46339f49d979ad304e2 100644 (file)
@@ -31,6 +31,13 @@ TSRCS =      aClient.cpp \
        do_check.cpp \
        do_equip.cpp \
        do_fight.cpp \
+       do_heal.cpp \
+       do_help.cpp \
+       do_identify.cpp \
+       do_inventory.cpp \
+       do_list.cpp \
+       do_refresh.cpp \
+       do_register.cpp \
        find.cpp \
        gameserv.cpp \
        hash.cpp \
diff --git a/gameserv/do_heal.cpp b/gameserv/do_heal.cpp
new file mode 100644 (file)
index 0000000..dac5cb2
--- /dev/null
@@ -0,0 +1,103 @@
+#include "extern.h"
+#include "aClient.h"
+#include "config.h"
+#include "flags.h"
+
+void do_heal(char *u)
+{
+  aClient *ni;
+  char *amount = strtok(NULL, " ");
+  int price, num;
+  
+  if (!amount)
+    {
+         notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
+         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))
+    {
+       #ifdef DEBUGMODE
+           log("Ignoring %s.", ni->getNick());
+       #endif
+       return;
+    }
+    else if (!is_playing(ni))
+    {
+       notice(s_GameServ, u, "You aren't playing!");
+       return;
+    }
+    else if (!isAlive(ni->stats))
+    {
+       notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing.");
+       return;
+    }
+    else if (is_fighting(ni))
+    {
+       notice(s_GameServ, u, "You can't heal in battle!");
+       return;
+    }
+    else if (ni->stats->getHP() >= ni->stats->getMaxHP())
+    {
+        notice(s_GameServ, u, "You don't need healing!");
+       return;
+    }
+
+    updateTS(ni->stats);
+    if (stricmp(amount, "ALL") == 0)
+    {
+        price = ni->stats->getLevel() * 3;
+        if (ni->stats->getGold() < (ni->stats->getMaxHP() - ni->stats->getHP()) * price)
+        {
+            notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
+                     (long int)ni->stats->getGold()/price, price);
+            ni->stats->addHP(ni->stats->getGold() / price);
+            ni->stats->setGold(ni->stats->getGold() % price);
+        }
+        else
+        {
+            notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
+                       "per point.", price);
+            notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
+                     (ni->stats->getMaxHP() - ni->stats->getHP()), 
+                    (price * (ni->stats->getMaxHP() - ni->stats->getHP())) );
+            ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
+            ni->stats->healall();
+        }
+    }
+    else if (isstringnum(amount))
+    {
+        num = stringtoint(amount);
+        price = ni->stats->getLevel() * 3;
+        if (ni->stats->getGold() < price * num)
+        {
+            notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!",
+                     (long int)ni->stats->getGold()/price);
+        }
+        else if (num <= ni->stats->getMaxHP() - ni->stats->getHP())
+        {
+            notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.",
+                     num, price);
+            ni->stats->addHP(num);
+            ni->stats->subtractGold(num * price);
+        }
+        else if (num > ni->stats->getMaxHP() - ni->stats->getHP())
+        {
+            notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
+                       "per point.", price);
+            notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!",
+                     (ni->stats->getMaxHP() - ni->stats->getHP()));
+            ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
+            ni->stats->healall();
+        }
+    }
+    else if (amount[0] == '-')
+        notice(s_GameServ, u, "You trying to cheat?");
+    else
+       notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
+}
+
diff --git a/gameserv/do_help.cpp b/gameserv/do_help.cpp
new file mode 100644 (file)
index 0000000..8bcd256
--- /dev/null
@@ -0,0 +1,8 @@
+#include "extern.h"
+
+void do_help(char *u)
+{
+  char *cmd = strtok(NULL, " ");
+  
+  display_help(u, cmd);
+}
diff --git a/gameserv/do_identify.cpp b/gameserv/do_identify.cpp
new file mode 100644 (file)
index 0000000..2466623
--- /dev/null
@@ -0,0 +1,80 @@
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+
+void do_identify(char *u)
+{
+  char *password, *name;
+  aClient *user;
+  Player *p;
+  name = strtok(NULL, " ");
+  password = strtok(NULL, " ");
+  if (!password || !name)
+    {
+         notice(s_GameServ, u, "SYNTAX: /msg <S IDENTIFY NAME PASSWORD");
+    }
+  else if (!(user = find(u)))
+    {
+         notice(s_GameServ, u, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL, ""));
+         log("Error: aClient not found: %s", u);
+    }
+  else if (isIgnore(user))
+    {
+#ifdef DEBUGMODE
+         log("Ignoring %s.", user->getNick());
+#endif
+         return;
+    }
+  else if (!(p = findplayer(name)))
+       {
+         notice(s_GameServ, u, "Player %s not found", name);
+       }
+  else if (is_playing(user))
+    {
+         notice(s_GameServ, u, "You are already playing!");
+    }
+  else if (is_playing(p->getClient()) && !isAdmin(user))
+    {
+         notice(s_GameServ, u, "That player has already identified.");
+    }
+  else if (!check_password(name, password) && !isAdmin(user))
+    {
+         notice(s_GameServ, u, "Password incorrect");
+    }
+  else
+       {
+         list<Player*>::iterator iter;
+         unsigned long hv = iHASH((unsigned char *) p->getName().c_str());
+
+         iter = find(players[hv].begin(), players[hv].end(), p);
+
+         if (iter == players[hv].end())
+               {
+                 notice(s_GameServ, u, "Fatal error. Contact <S Admin. Buf: %s", 
+                                strtok(NULL, ""));
+                 return;
+               }
+         // Make sure the other user is logged out
+         logout(p->getClient());
+         
+         user->stats = p;
+         p->setClient(user);
+         updateTS(p);
+               
+               
+#ifdef DEBUGMODE
+           log("Player %s IRC: %s Identified", user->stats->getName().c_str(), 
+                       user->getNick());
+#endif
+               //Set the playing flag
+               setPlaying(user);
+               
+               // Update the last login time
+               user->stats->lastlogin = time(NULL);
+
+               notice(s_GameServ, u, "Password Accepted. Identified.");
+               showNews(u, todaysnews);
+    }
+}
diff --git a/gameserv/do_inventory.cpp b/gameserv/do_inventory.cpp
new file mode 100644 (file)
index 0000000..b884069
--- /dev/null
@@ -0,0 +1,30 @@
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "flags.h"
+
+void do_inventory(char *u)
+{
+  aClient *user;
+  
+  if (!(user = find(u)))
+    {
+         notice(s_GameServ, u, "Fatal Error. Contact a <S admin!");
+         return;
+    }
+  else if (isIgnore(user))
+    {
+#ifdef DEBUGMODE
+         log("Ignoring %s.", user->getNick());
+#endif
+         return;
+    }
+  else if (!is_playing(user))
+    {
+         notice(s_GameServ, u, "You must be playing to check your inventory!");
+         return;
+    }
+  if (!is_fighting(user))
+       updateTS(user->stats);
+  showinventory(user->stats, user);
+}
diff --git a/gameserv/do_list.cpp b/gameserv/do_list.cpp
new file mode 100644 (file)
index 0000000..935ce83
--- /dev/null
@@ -0,0 +1,93 @@
+#include "extern.h"
+#include "config.h"
+#include "player.h"
+#include "aClient.h"
+#include "flags.h"
+#include "toplist.h"
+
+void do_list(char *u)
+{
+  aClient *user;
+  Player *p;
+  char *cmd = strtok(NULL, " ");
+  
+  if (!(user = find(u)))
+    {
+         log("Fatal Error: Couldn't find %s in the client list", u);
+         return;
+    }
+  else if (isIgnore(user))
+    {
+#ifdef DEBUGMODE
+         log("Ignoring %s. Command LIST", user->getNick());
+#endif
+         return;
+    }
+  
+  if (cmd == NULL || stricmp(cmd, "TOP") == 0)
+  {
+    list<PlayerWrapper>::iterator iter;
+    bool header = false;
+
+    if (myToplist.empty())
+      {
+         notice(s_GameServ, u, "There are no players");
+         return;
+      }
+    myToplist.sort();
+    myToplist.reverse();
+     
+    iter = myToplist.begin();
+     
+    while (iter != myToplist.end())
+    {
+        if (!header)
+        {
+           notice(s_GameServ, u, "Top Players");
+           header = true;
+
+        }
+        notice(s_GameServ, u, "Level: %2d Exp: %10d Name: %s", 
+        (*iter).getLevel(), (*iter).getExp(), (*iter).getName().c_str());
+        iter++;
+     }
+  }
+  else
+  {
+        
+     list<Player*>::iterator iter;
+     bool header = false;
+   
+     for (unsigned long x = 0; x < U_TABLE_SIZE; x++)
+      {
+        iter = players[x].begin();
+        if (!players[x].empty())
+         {
+           while(iter != players[x].end())
+            {
+              p = (*iter);
+              if (cmd || is_playing(p->getClient()))
+               {
+                 if (!header)
+                  {
+                    notice(s_GameServ, u, "Players:");
+                    header = true;
+                  }
+      #ifdef P10
+                 notice(s_GameServ, u, "IRC: %s     Game: %s", (p->getClient() ? p->getClient()->getRealNick() : "Not Playing"), 
+                      p->getName().c_str());
+      #else
+                 notice(s_GameServ, u, "IRC: %s     Game: %s", (p->getClient() ? p->getClient()->getNick() : "Not Playing"), 
+                      p->getName().c_str());
+      #endif
+               }
+              iter++;
+            }
+         }
+      }
+     if (!header)
+      notice(s_GameServ, u, "No one is playing");
+     else
+      notice(s_GameServ, u, "End of List"); 
+   }
+}
diff --git a/gameserv/do_refresh.cpp b/gameserv/do_refresh.cpp
new file mode 100644 (file)
index 0000000..dc54b41
--- /dev/null
@@ -0,0 +1,51 @@
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+
+void do_refresh(char *u)
+{
+  char *name = strtok(NULL, " ");
+  aClient *user;
+  Player *p;
+  
+  if (!(user = find(u)))
+    {
+         notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+         log("Error: aClient not found: %s", u);
+         return;
+    }
+  else if (isIgnore(user))
+    {
+#ifdef DEBUGMODE
+         log("Ignoring %s.", user->getNick());
+#endif
+         return;
+    }
+  else if (!isAdmin(user))
+    {
+         notice(s_GameServ, u, "You must be a <S admin to use this command!");
+         return;
+    }
+  if (!name)
+    {
+         notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}");
+         return;
+    }
+  else if (stricmp(name, "ALL") == 0)
+    {
+         notice(s_GameServ, u, "Refreshing everyone's stats!");
+         refreshall();
+    }
+  else if ((p = findplayer(name)))
+    {
+         notice(s_GameServ, u, "Refreshing %s.", p->getName().c_str());
+         refresh(p);
+       }
+  else
+    {
+         notice(s_GameServ, u, "Player %s not found.", name);
+         return;
+    }
+}
diff --git a/gameserv/do_register.cpp b/gameserv/do_register.cpp
new file mode 100644 (file)
index 0000000..f79db5f
--- /dev/null
@@ -0,0 +1,108 @@
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+#include "pouch.h"
+#include "item.h"
+#include "toplist.h"
+
+void do_register(char *u)
+{
+  char *password, *name;
+  aClient *user;
+  Player *p;
+  name = strtok(NULL, " ");
+  password = strtok(NULL, " ");
+  
+  if (!name)
+    {
+         notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
+    }
+  else if (stricmp(name, s_GameServ) == 0)
+    {
+         notice(s_GameServ, u, "You can't use <S as a name!");
+    }
+  else if (!password)
+    {
+         notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
+    }
+  else if (strlen(name) > maxnicklen)
+       {
+         notice(s_GameServ, u, "Name too long. Maximum length: %d", maxnicklen);
+       }
+  else if (!alphaNumeric(name))
+       {
+         notice(s_GameServ, u, "That is not a valid name. Please use only AlphaNumeric (A-Z, 0-9) characters!");
+       }
+  else if ((p = findplayer(name)))
+    {
+         notice(s_GameServ, u, "%s is already registered!", name);
+         notice(s_GameServ, u, "Choose another name!");
+    }
+  else if (!(user = find(u)))
+    {
+         log("Fatal Error: Couldn't find %s in the clients list", u);
+    }
+  else if (isIgnore(user))
+    {
+#ifdef DEBUGMODE
+         log("Ignoring %s.", user->getNick());
+#endif
+    }
+  else
+    {
+         if (!is_playing(user))
+        {
+                 item *tempItem;
+                 unsigned long hv = iHASH((unsigned char *) name);
+
+                 // First create the Player
+                 user->stats = new Player();
+
+                 // Set the backwards pointer
+                 user->stats->setClient(user);
+
+                 // Set the player's password
+                 user->stats->setPassword(password);
+
+                 // Set the player's name
+                 user->stats->setName(name);
+
+                 // Make sure they have a proper time stamp
+                 updateTS(user->stats);
+
+                 // Update the last login time
+                 user->stats->lastlogin = time(NULL);
+                 
+                 // Send notification of success
+                 notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->getName().c_str(), password);
+                 notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!");
+
+                 // Log the new player
+                 log("Nickname %s registered player %s.", u, user->stats->getName().c_str());
+
+                 // Log the player in
+                 setPlaying(user);
+
+                 // Start the player at the beginning
+                 reset(user->stats);
+                 
+                 // Add the stick and clothes
+                 tempItem = findItemByID(3001);
+                 user->stats->inventory->addItem((*Items.begin()))->use(user->stats); // Add the stick
+                 user->stats->inventory->addItem(tempItem)->use(user->stats); // Add Clothes
+
+                 // Add the player to the list
+                 players[hv].push_back(user->stats);
+
+                 // Attempt to add the player to the top list
+                 // The class takes care of pruning the user out if they don't deserve to be in the list
+                 myToplist.insertPlayer(user->stats);
+               }
+         else
+               {
+                 notice(s_GameServ, u, "Already registered. Contact a <S admin for help.");
+               }
+    }
+}
index ea137bef8b09197928dd9830db9da92c0c1524d6..0e433de58842ec0f7d6d8374293ee0a9e4722402 100644 (file)
@@ -268,7 +268,6 @@ E void do_equip(char *u);
 E void do_fight(char *u);
 E void do_forest(char *u);
 E void do_heal(char *u);
-E void do_identify(char *u);
 E void do_invenory(char *u);
 E void do_list(char *u);
 E void do_logout(char *u);
index ce27a5014329915685db4f3b3584a2ca8013d340..d4f555597a6444b8145844a70dff3fff98c18355 100644 (file)
@@ -41,14 +41,6 @@ toplist myToplist;          // List of the top 10 players
 
 bool shuttingdown;
 
-
-void do_heal(char *u);
-void do_help(char *u);
-void do_identify(char *u);
-void do_inventory(char *u);
-void do_refresh(char *u);
-void do_register(char *u);
-void do_list(char *u);
 void do_logout(char *u);
 void do_master(char *u);
 void do_dragon(char *u);
@@ -339,92 +331,6 @@ void gameserv(char *source, char *buf)
 
 
 
-void do_list(char *u)
-{
-  aClient *user;
-  Player *p;
-  char *cmd = strtok(NULL, " ");
-  
-  if (!(user = find(u)))
-    {
-         log("Fatal Error: Couldn't find %s in the client list", u);
-         return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s. Command LIST", user->getNick());
-#endif
-         return;
-    }
-  
-  if (cmd == NULL || stricmp(cmd, "TOP") == 0)
-  {
-    list<PlayerWrapper>::iterator iter;
-    bool header = false;
-
-    if (myToplist.empty())
-      {
-         notice(s_GameServ, u, "There are no players");
-         return;
-      }
-    myToplist.sort();
-    myToplist.reverse();
-     
-    iter = myToplist.begin();
-     
-    while (iter != myToplist.end())
-    {
-        if (!header)
-        {
-           notice(s_GameServ, u, "Top Players");
-           header = true;
-
-        }
-        notice(s_GameServ, u, "Level: %2d Exp: %10d Name: %s", 
-        (*iter).getLevel(), (*iter).getExp(), (*iter).getName().c_str());
-        iter++;
-     }
-  }
-  else
-  {
-        
-     list<Player*>::iterator iter;
-     bool header = false;
-   
-     for (unsigned long x = 0; x < U_TABLE_SIZE; x++)
-      {
-        iter = players[x].begin();
-        if (!players[x].empty())
-         {
-           while(iter != players[x].end())
-            {
-              p = (*iter);
-              if (cmd || is_playing(p->getClient()))
-               {
-                 if (!header)
-                  {
-                    notice(s_GameServ, u, "Players:");
-                    header = true;
-                  }
-      #ifdef P10
-                 notice(s_GameServ, u, "IRC: %s     Game: %s", (p->getClient() ? p->getClient()->getRealNick() : "Not Playing"), 
-                      p->getName().c_str());
-      #else
-                 notice(s_GameServ, u, "IRC: %s     Game: %s", (p->getClient() ? p->getClient()->getNick() : "Not Playing"), 
-                      p->getName().c_str());
-      #endif
-               }
-              iter++;
-            }
-         }
-      }
-     if (!header)
-      notice(s_GameServ, u, "No one is playing");
-     else
-      notice(s_GameServ, u, "End of List"); 
-   }
-}
 
 void do_set(char *u)
 {
@@ -834,181 +740,6 @@ void do_logout(char *u)
     }
 }
 
-void do_register(char *u)
-{
-  char *password, *name;
-  aClient *user;
-  Player *p;
-  name = strtok(NULL, " ");
-  password = strtok(NULL, " ");
-  
-  if (!name)
-    {
-         notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
-    }
-  else if (stricmp(name, s_GameServ) == 0)
-    {
-         notice(s_GameServ, u, "You can't use <S as a name!");
-    }
-  else if (!password)
-    {
-         notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
-    }
-  else if (strlen(name) > maxnicklen)
-       {
-         notice(s_GameServ, u, "Name too long. Maximum length: %d", maxnicklen);
-       }
-  else if (!alphaNumeric(name))
-       {
-         notice(s_GameServ, u, "That is not a valid name. Please use only AlphaNumeric (A-Z, 0-9) characters!");
-       }
-  else if ((p = findplayer(name)))
-    {
-         notice(s_GameServ, u, "%s is already registered!", name);
-         notice(s_GameServ, u, "Choose another name!");
-    }
-  else if (!(user = find(u)))
-    {
-         log("Fatal Error: Couldn't find %s in the clients list", u);
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-    }
-  else
-    {
-         if (!is_playing(user))
-        {
-                 item *tempItem;
-                 unsigned long hv = iHASH((unsigned char *) name);
-
-                 // First create the Player
-                 user->stats = new Player();
-
-                 // Set the backwards pointer
-                 user->stats->setClient(user);
-
-                 // Set the player's password
-                 user->stats->setPassword(password);
-
-                 // Set the player's name
-                 user->stats->setName(name);
-
-                 // Make sure they have a proper time stamp
-                 updateTS(user->stats);
-
-                 // Update the last login time
-                 user->stats->lastlogin = time(NULL);
-                 
-                 // Send notification of success
-                 notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->getName().c_str(), password);
-                 notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!");
-
-                 // Log the new player
-                 log("Nickname %s registered player %s.", u, user->stats->getName().c_str());
-
-                 // Log the player in
-                 setPlaying(user);
-
-                 // Start the player at the beginning
-                 reset(user->stats);
-                 
-                 // Add the stick and clothes
-                 tempItem = findItemByID(3001);
-                 user->stats->inventory->addItem((*Items.begin()))->use(user->stats); // Add the stick
-                 user->stats->inventory->addItem(tempItem)->use(user->stats); // Add Clothes
-
-                 // Add the player to the list
-                 players[hv].push_back(user->stats);
-
-                 // Attempt to add the player to the top list
-                 // The class takes care of pruning the user out if they don't deserve to be in the list
-                 myToplist.insertPlayer(user->stats);
-               }
-         else
-               {
-                 notice(s_GameServ, u, "Already registered. Contact a <S admin for help.");
-               }
-    }
-}
-
-void do_identify(char *u)
-{
-  char *password, *name;
-  aClient *user;
-  Player *p;
-  name = strtok(NULL, " ");
-  password = strtok(NULL, " ");
-  if (!password || !name)
-    {
-         notice(s_GameServ, u, "SYNTAX: /msg <S IDENTIFY NAME PASSWORD");
-    }
-  else if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL, ""));
-         log("Error: aClient not found: %s", u);
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-         return;
-    }
-  else if (!(p = findplayer(name)))
-       {
-         notice(s_GameServ, u, "Player %s not found", name);
-       }
-  else if (is_playing(user))
-    {
-         notice(s_GameServ, u, "You are already playing!");
-    }
-  else if (is_playing(p->getClient()) && !isAdmin(user))
-    {
-         notice(s_GameServ, u, "That player has already identified.");
-    }
-  else if (!check_password(name, password) && !isAdmin(user))
-    {
-         notice(s_GameServ, u, "Password incorrect");
-    }
-  else
-       {
-         list<Player*>::iterator iter;
-         unsigned long hv = iHASH((unsigned char *) p->getName().c_str());
-
-         iter = find(players[hv].begin(), players[hv].end(), p);
-
-         if (iter == players[hv].end())
-               {
-                 notice(s_GameServ, u, "Fatal error. Contact <S Admin. Buf: %s", 
-                                strtok(NULL, ""));
-                 return;
-               }
-         // Make sure the other user is logged out
-         logout(p->getClient());
-         
-         user->stats = p;
-         p->setClient(user);
-         updateTS(p);
-               
-               
-#ifdef DEBUGMODE
-           log("Player %s IRC: %s Identified", user->stats->getName().c_str(), 
-                       user->getNick());
-#endif
-               //Set the playing flag
-               setPlaying(user);
-               
-               // Update the last login time
-               user->stats->lastlogin = time(NULL);
-
-               notice(s_GameServ, u, "Password Accepted. Identified.");
-               showNews(u, todaysnews);
-    }
-}
-
 void do_stats(char *u)
 {
   char *nick;
@@ -1200,108 +931,6 @@ void do_run(char *u)
        }
 }
 
-
-void do_heal(char *u)
-{
-  aClient *ni;
-  char *amount = strtok(NULL, " ");
-  int price, num;
-  
-  if (!amount)
-    {
-         notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
-         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))
-    {
-       #ifdef DEBUGMODE
-           log("Ignoring %s.", ni->getNick());
-       #endif
-       return;
-    }
-    else if (!is_playing(ni))
-    {
-       notice(s_GameServ, u, "You aren't playing!");
-       return;
-    }
-    else if (!isAlive(ni->stats))
-    {
-       notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing.");
-       return;
-    }
-    else if (is_fighting(ni))
-    {
-       notice(s_GameServ, u, "You can't heal in battle!");
-       return;
-    }
-    else if (ni->stats->getHP() >= ni->stats->getMaxHP())
-    {
-        notice(s_GameServ, u, "You don't need healing!");
-       return;
-    }
-
-    updateTS(ni->stats);
-    if (stricmp(amount, "ALL") == 0)
-    {
-        price = ni->stats->getLevel() * 3;
-        if (ni->stats->getGold() < (ni->stats->getMaxHP() - ni->stats->getHP()) * price)
-        {
-            notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
-                     (long int)ni->stats->getGold()/price, price);
-            ni->stats->addHP(ni->stats->getGold() / price);
-            ni->stats->setGold(ni->stats->getGold() % price);
-        }
-        else
-        {
-            notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
-                       "per point.", price);
-            notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
-                     (ni->stats->getMaxHP() - ni->stats->getHP()), 
-                    (price * (ni->stats->getMaxHP() - ni->stats->getHP())) );
-            ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
-            ni->stats->healall();
-        }
-    }
-    else if (isstringnum(amount))
-    {
-        num = stringtoint(amount);
-        price = ni->stats->getLevel() * 3;
-        if (ni->stats->getGold() < price * num)
-        {
-            notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!",
-                     (long int)ni->stats->getGold()/price);
-        }
-        else if (num <= ni->stats->getMaxHP() - ni->stats->getHP())
-        {
-            notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.",
-                     num, price);
-            ni->stats->addHP(num);
-            ni->stats->subtractGold(num * price);
-        }
-        else if (num > ni->stats->getMaxHP() - ni->stats->getHP())
-        {
-            notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
-                       "per point.", price);
-            notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!",
-                     (ni->stats->getMaxHP() - ni->stats->getHP()));
-            ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
-            ni->stats->healall();
-        }
-    }
-    else if (amount[0] == '-')
-        notice(s_GameServ, u, "You trying to cheat?");
-    else
-       notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
-}
-
-
-
-
 void do_store(char *u)
 {
   list<item*>::iterator item_iterator;
@@ -1477,31 +1106,6 @@ void do_store(char *u)
       return;
     }
 }
-void do_inventory(char *u)
-{
-  aClient *user;
-  
-  if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal Error. Contact a <S admin!");
-         return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-         return;
-    }
-  else if (!is_playing(user))
-    {
-         notice(s_GameServ, u, "You must be playing to check your inventory!");
-         return;
-    }
-  if (!is_fighting(user))
-       updateTS(user->stats);
-  showinventory(user->stats, user);
-}
 
 
 void do_tavern(char *u)
@@ -1868,12 +1472,6 @@ void do_reset(char *u)
        }
 }
 
-void do_help(char *u)
-{
-  char *cmd = strtok(NULL, " ");
-  
-  display_help(u, cmd);
-}
 
 
 
index 09beb7690bb75f595fc3f2dda9446a243dfc8cd0..9197d512ba885204e41369abc6fb748c484550c2 100644 (file)
@@ -75,51 +75,7 @@ void refresh(Player *p)
   clearMaster(p);
 }
 
-void do_refresh(char *u)
-{
-  char *name = strtok(NULL, " ");
-  aClient *user;
-  Player *p;
-  
-  if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
-         log("Error: aClient not found: %s", u);
-         return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-         return;
-    }
-  else if (!isAdmin(user))
-    {
-         notice(s_GameServ, u, "You must be a <S admin to use this command!");
-         return;
-    }
-  if (!name)
-    {
-         notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}");
-         return;
-    }
-  else if (stricmp(name, "ALL") == 0)
-    {
-         notice(s_GameServ, u, "Refreshing everyone's stats!");
-         refreshall();
-    }
-  else if ((p = findplayer(name)))
-    {
-         notice(s_GameServ, u, "Refreshing %s.", p->getName().c_str());
-         refresh(p);
-       }
-  else
-    {
-         notice(s_GameServ, u, "Player %s not found.", name);
-         return;
-    }
-}
+
 
 
 void resetall()