]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Finished splitting files, and updated dependencies.
[irc/gameservirc.git] / gameserv / gameserv.cpp
index d4f555597a6444b8145844a70dff3fff98c18355..d71c7b3d5d6613706dd426b79f3532080563fa61 100644 (file)
@@ -29,7 +29,7 @@ using namespace std;
 
 #endif
 
-Monster dragon;                                // The current dragon
+
 Level levels[LEVELS];                  // The newest way to store monsters
 list<item*> Items;                      // The master list of items
 list<tavernItem> tavern;                // The list of items available at the tavern
@@ -41,19 +41,6 @@ toplist myToplist;          // List of the top 10 players
 
 bool shuttingdown;
 
-void do_logout(char *u);
-void do_master(char *u);
-void do_dragon(char *u);
-void do_play(char *u);
-void do_quitg(char *u);
-void do_reset(char *u);
-void do_run(char *u);
-void do_set(char *u);
-void do_stats(char *u);
-void do_store(char *u);
-void do_tavern(char *u);
-void do_use(char *u);
-
 #define WNA 16
 
 int hpbonus[11] = {10, 15, 20, 30, 50, 75, 125, 185, 250, 350, 550};
@@ -329,1150 +316,3 @@ void gameserv(char *source, char *buf)
        cmd--;     // Same thing :)
 }
 
-
-
-
-void do_set(char *u)
-{
-  aClient *user;
-  Player *p;
-  char *name = strtok(NULL, " ");
-  char *cmd = strtok(NULL, " ");
-  char *cmd2;
-  
-  if (!(user = find(u)))
-    {
-      notice(s_GameServ, u, "Fatal error. Cannot find aClient. "\
-                        "Buf: %s LOGOUT", u);
-      return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-      log("Ignoring %s.", user->getNick());
-#endif
-      return;
-    }
-  else if (!name || !cmd)
-    {
-      notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|ALIVE|SEEN MASTER} {STRING|NUMBER|TRUE|FALSE}");
-      return;
-    }
-  else if (!(p = findplayer(name)))
-    {
-      // Back the pointers up... they didn't send a name probably
-      cmd2 = cmd;
-      cmd = name;
-      p = user->stats;
-         
-      if (!is_playing(user))
-               {
-                 notice(s_GameServ, u, "You must be playing to set things for yourself!");
-                 return;
-               }
-    }
-  else
-    {
-      cmd2 = strtok(NULL, " ");
-    }
-  if (!cmd2)
-       {
-         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] {PASSWORD|BANK BALANCE|PLAYER FIGHTS|FOREST FIGHTS|GOLD|STRENGTH|DEFENSE|HP|MAXHP|EXP|LEVEL|ALIVE|SEEN MASTER} {STRING|NUMBER|TRUE|FALSE}");
-         return;
-       }
-  
-  // Regardless of the previous if/else, if it got here, we know we have the cmd pointer at the right spot.
-  if (stricmp(cmd, "PASSWORD") == 0)
-    {
-      // Person is looking to change their password
-      // If they're an admin, or it's theirself, allow it
-      // cmd2 is pointing to the password now
-      if (isAdmin(user) || user == p->getClient())
-               {
-                 p->setPassword(cmd2);
-                 notice(s_GameServ, u, "Password successfully changed");
-               }
-      else if (user != p->getClient() && !isAdmin(user))
-               {
-                 notice(s_GameServ, u, "You must be a <S admin to set other peoples' passwords.");
-                 return;
-               }
-    }
-  else if (stricmp(cmd, "BANK") == 0 || stricmp(cmd, "BALANCE") == 0)
-    {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;
-               }
-         else if (stricmp(cmd, "BANK") == 0)
-               {
-                 cmd2 = strtok(NULL, " "); // Need an extra parameter for set bank balance
-               }
-         if (!cmd2)
-               {
-                 notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] [BANK] BALANCE <NUMBER>");
-                 return;
-               }
-         
-         p->setBank(stringtoint(cmd2));
-         
-         notice(s_GameServ, u, "Bank balance changed to %ld!", p->getBank());
-    }
-  else if (stricmp(cmd, "PLAYER") == 0)
-    {
-      if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;
-               }
-      else if (stricmp(cmd2, "FIGHTS") != 0)
-               {
-                 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;
-                       }
-                 p->setPlayerFights(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Player fights changed to %d!", p->getPlayerFights());
-               }         
-    }
-  else if (stricmp(cmd, "FOREST") == 0)
-    {
-      if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;
-               }
-      else if (stricmp(cmd2, "FIGHTS") != 0)
-               {
-                 notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] FOREST FIGHTS <number>");
-                 return;
-               }
-      else
-               {
-                 cmd2 = strtok(NULL, " ");
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] FOREST FIGHTS <NUMBER>");
-                         return;
-                       }
-                 
-                 p->setForestFights(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Forest fights changed to %d!", p->getForestFights());
-               }         
-    }
-  else if (stricmp(cmd, "GOLD") == 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] GOLD <NUMBER>");
-                         return;
-                       }
-                 p->setGold(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Gold set to %ld", p->getGold());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "STRENGTH") == 0 && stricmp(cmd2, "POTIONS") != 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] STRENGTH <NUMBER>");
-                         return;
-                       }
-                 
-                 p->setStrength(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Strength set to %d", p->getStrength());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "DEFENSE") == 0 && stricmp(cmd2, "POTIONS") != 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] DEFENSE <NUMBER>");
-                         return;
-                       }
-                 
-                 p->setDefense(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Defense set to %d", p->getDefense());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "HP") == 0 && stricmp(cmd2, "POTIONS") != 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] HP <NUMBER>");
-                         return;
-                       }
-
-                 // Make sure it's easy for an admin to set the hp
-                 if (p->getMaxHP() < stringtoint(cmd2))
-                       p->setMaxHP(stringtoint(cmd2));
-                 
-                 p->setHP(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "HP set to %d", p->getHP());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "MAXHP") == 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] MAXHP <NUMBER>");
-                         return;
-                       }
-                 p->setMaxHP(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "MaxHP set to %d", p->getMaxHP());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "EXPERIENCE") == 0 || stricmp(cmd, "EXP") == 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] {EXPERIENCE|EXP} <NUMBER>");
-                         return;
-                       }
-                 
-                 p->setExp(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Exp set to %ld", p->getExp());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "LEVEL") == 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;         
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] LEVEL <NUMBER>");
-                         return;
-                       }
-                 p->setLevel(stringtoint(cmd2));
-                 
-                 notice(s_GameServ, u, "Level set to %d", p->getLevel());
-                 return;
-               }
-       }
-  else if (stricmp(cmd, "ALIVE") == 0)
-       {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "Admins Only!");
-                 return;
-               }
-         else
-               {
-                 if (!cmd2)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NAME] ALIVE TRUE|FALSE");
-                         return;
-                       }
-                 else if (stricmp(cmd2, "TRUE") == 0)
-                       {
-                         notice(s_GameServ, u, "%s has been Resurrected!", p->getName().c_str());
-                         setAlive(p);
-                       }
-                 else
-                       {
-                         notice(s_GameServ, u, "%s is now dead!", p->getName().c_str());
-                         clearAlive(p);
-                       }
-               }
-       }
-  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)
-                       {
-                         notice(s_GameServ, u, "SYNTAX: /msg <S SET [NICK] SEEN MASTER {TRUE|FALSE}");
-                         return;
-                       }
-                 else if (stricmp(cmd2, "TRUE") == 0)
-                       {
-                         notice(s_GameServ, u, "%s has seen their master now.", p->getName().c_str());
-                         p->addFlag(FLAG_MASTER);
-                       }
-                 else
-                       {
-                         notice(s_GameServ, u, "%s has not seen their master now.", p->getName().c_str());
-                         p->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|ALIVE|SEEN MASTER} {STRING|NUMBER|TRUE|FALSE}");
-         return;
-       }
-}
-
-void do_logout(char *u)
-{
-  aClient *user;
-  Player *p;
-  char *name = strtok(NULL, " ");
-  
-  if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal error. Cannot find aClient. "\
-                        "Buf: %s LOGOUT", u);
-         log("Could not find aClient Buf: %s LOGOUT", 
-                 u);
-         return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-         return;
-    }
-  
-  if (name)
-    {
-         if (!isAdmin(user))
-               {
-                 notice(s_GameServ, u, "You must be a <S admin to use this command!");
-               }
-         else if (!(p = findplayer(name)))
-               {
-                 notice(s_GameServ, u, "Couldn't find a player named %s", name);
-               }
-         else
-               {
-                 notice(s_GameServ, u, "Logging out %s", p->getName().c_str());
-                 logout(p->getClient());
-               }
-    }
-  else if (!name)
-    {
-         if (!is_playing(user))
-               {
-                 notice(s_GameServ, u, "You're not logged in!");
-               }
-         else if (is_fighting(user))
-               {
-                 notice(s_GameServ, u, "You can't logout while fighting!");
-               }
-         else
-               {
-                 notice(s_GameServ, u, "You have left the fields. You have lived to kill another day!");
-                 logout(user);
-               }
-    }
-}
-
-void do_stats(char *u)
-{
-  char *nick;
-  aClient *user;
-  
-  nick = strtok(NULL, " ");
-  
-  if (!(user = find(u)))
-    {
-         log("Fatal Error: %s not found in client list", u);
-         return;
-    }
-  else if (isIgnore(user))
-    {
-#ifdef DEBUGMODE
-         log("Ignoring %s.", user->getNick());
-#endif
-         return;
-    }
-  else if (!nick)
-    {
-         if (!is_playing(user))
-               {
-                 notice(s_GameServ, u, "You're not playing, so you have no stats!");
-                 return;
-               }
-         else
-               {
-                 if (!is_fighting(user))
-                       updateTS(user->stats);
-                 showstats(u, user->stats->getName().c_str());
-               }
-    }
-  else
-       showstats(u, nick);
-}
-
-void do_use(char *u)
-{
-  aClient *user;
-  pouch *p;
-  
-  char *item = strtok(NULL, " ");
-  char *numuse = strtok(NULL, " ");
-  int id, num;
-  itemContainer *used;
-  
-  if (!item || int(item[0]) < 48 || int(item[0]) > 57 || (numuse && (int(numuse[0]) < 48 || int(numuse[0]) > 57)))
-    {
-         notice(s_GameServ, u, "SYNTAX: USE ####");
-         notice(s_GameServ, u, "Type /msg <S HELP USE for more information.");
-         return;
-    }
-  else if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal Error in do_use. Contact a(n) <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 use items!");
-         return;
-    }
-  id = stringtoint(item);
-  
-  if (!numuse)
-       {
-         num = 1;
-       }
-  else
-       {
-         num = stringtoint(numuse);
-       }
-  
-  updateTS(user->stats);
-  p = user->stats->inventory;
-  
-
-  if (!(used = p->Find(id)))
-       {
-         if (!p->isEmpty())
-               {
-                 notice(s_GameServ, u, "You aren't carrying that item!");
-               }
-         showinventory(user->stats, user);
-       }
-  else if (used->getItem()->getType() != POTION)
-       {
-         notice(s_GameServ, u, "You can't use %s like that. Try /msg <S equip", used->getItem()->getName().c_str());
-       }
-  else
-       {
-         // Use the item(s)
-         if (num <= 1 || is_fighting(user))
-               {
-                 notice(s_GameServ, u, "You used %s.", used->getItem()->getName().c_str());
-                 used->use(user->stats);
-                 if (used->getUses() <= 0)
-                       {
-                         p->deleteItem(used->getItem());
-                       }
-                 end_turn(user);
-               }
-         else if (num > 1)
-               {
-                 int count;
-                 const char *name = used->getItem()->getName().c_str();
-                 for (count = 0; count < num; count++)
-                       {
-                         if (!(used = p->Find(id)))
-                               {
-                                 break;
-                               }
-                         else
-                               {
-                                 used->use(user->stats);
-                                 if (used->getUses() == 0)
-                                       {
-                                         p->deleteItem(used->getItem());
-                                       }
-                               }
-                       }
-                 notice(s_GameServ, u, "You used %d %s's", count, name);
-               }
-       }
-}
-void do_run(char *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;
-    }
-  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 run!");
-         return;
-    }
-  
-  updateTS(user->stats);
-  p = user->stats;
-  
-  if (p->getBattle())
-       p2 = p->getBattle()->stats;
-  
-  if (!is_fighting(user))
-       notice(s_GameServ, u, "You run in place... try fighting next time.");
-  else if (!player_fight(user) && !master_fight(user) && !dragon_fight(user))
-    {
-         notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p->getMonster()->name.c_str());
-         p->delMonster();
-    }
-  else if (player_fight(user) && isYourTurn(p))
-    {
-         notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p2->getName().c_str());
-         notice(s_GameServ, p->getBattle()->getNick(), "\ 2%s\ 2 ran away from you like a little baby!", p->getName().c_str());
-         addNews(todaysnews, "%s ran away from %s like a little baby!!", p->getName().c_str(), p2->getName().c_str()); /* DrLnet - edited by Kain */
-         p2->delBattle();
-         p->delBattle();
-       }
-  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->getName().c_str());
-    }
-  else if (master_fight(user))
-    {
-         notice(s_GameServ, u, "You cannot run from \ 2%s\ 2! FIGHT!", p->getMaster()->name.c_str());
-    }
-  else if (dragon_fight(user))
-       {
-         notice(s_GameServ, u, "You cannot run from %s! FIGHT!", dragon.name.c_str());
-       }
-}
-
-void do_store(char *u)
-{
-  list<item*>::iterator item_iterator;
-  item *tempItem;
-  char *cmd = strtok(NULL, " ");
-  char *num = strtok(NULL, " ");
-  char *space;
-  int id;
-  aClient *user;
-  Player *p;
-  
-  
-  if (!cmd || !num)
-    {
-      notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}");
-      notice(s_GameServ, u, "        \ 2STORE SELL NUMBER\ 2");
-      notice(s_GameServ, u, "        \ 2STORE BUY \1fNUMBER\1f\ 2");
-      return;
-    }
-  else if (!(user = find(u)))
-    {
-      log("Fatal Error: could not find %s in client list", u);
-      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 use the store!");
-      return;
-    }
-  else if (is_fighting(user))
-    {
-      notice(s_GameServ, u, "You can't go to the store while fighting!");
-      return;
-    }
-  else if (!isAlive(user->stats))
-    {
-      notice(s_GameServ, u, "You are dead. Wait until tomorrow to purchase weapons and armor!");
-      return;
-    }
-  updateTS(user->stats);
-  
-  if (stricmp(cmd, "LIST") == 0)
-    {
-      if (stricmp(num, "WEAPONS") == 0)
-               {
-                 notice(s_GameServ, u, "Welcome to Kain's Armory");
-                 notice(s_GameServ, u, "Here are the weapons we have available for the killing, sire:");
-                 for (item_iterator = store.begin(); item_iterator != store.end(); ++item_iterator)
-            {
-                         if ((*item_iterator)->getType() == WEAPON)
-                               {
-                                 space = spaces(strlen((*item_iterator)->getName().c_str()), ".");
-                                 notice(s_GameServ, u, "%s%ld. %20s..........%ld", 
-              ((*item_iterator)->getID() < 10 ? " " : ""), 
-              (*item_iterator)->getID(), (*item_iterator)->getName().c_str(), (*item_iterator)->price());
-                               }
-                       }
-                 notice(s_GameServ, u, "To purchase a weapon, type /msg <S STORE BUY \ 2#\ 2.");
-                 notice(s_GameServ, u, "Where # is the weapon number from the menu above.");
-                 
-               }
-      else if (stricmp(num, "ARMOR") == 0)
-               {
-                 notice(s_GameServ, u, "Welcome to Kain's Armory");
-                 notice(s_GameServ, u, "I hope you enjoy the fine armor we have available for your protection:");
-                 for (item_iterator = store.begin(); item_iterator != store.end(); ++item_iterator)
-            {
-                         if ((*item_iterator)->getType() == ARMOR)
-                               {
-                                 notice(s_GameServ, u, "%s%ld. %20s..........%d",
-              ((*item_iterator)->getID() < 10 ? " " : ""), 
-               (*item_iterator)->getID(), (*item_iterator)->getName().c_str(), 
-               (*item_iterator)->price());
-                               }
-            }
-                 
-                 notice(s_GameServ, u, "To purchase armor, type /msg <S store buy #");
-                 notice(s_GameServ, u, "Where # is the armor number from the menu above.");
-               }
-      
-    } 
-  else if (stricmp(cmd, "BUY") == 0) 
-    {
-      p = user->stats;
-      if (!num)
-               {
-                 notice(s_GameServ, u, "SYNTAX: \ 2STORE BUY \1f#\1f\ 2");
-                 return;
-               }
-      else
-               {
-                 id = stringtoint(num);
-               }
-         
-      if (!isstringnum(num))
-               {
-                 notice(s_GameServ, u, "SYNTAX: \ 2STORE BUY \1f#\1f\ 2");
-                 return;
-               }
-      else if (!(tempItem = findStoreItemByID(id)))
-               {
-                 notice(s_GameServ, u, "Sorry, we don't carry that item!");
-                 return;
-               }
-      else if (p->getGold() < tempItem->price())
-               {
-                 notice(s_GameServ, u, "You can't afford to buy %s", tempItem->getName().c_str());
-                 return;
-               }
-      else if (p->inventory->addItem(tempItem))
-               {
-                 notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", tempItem->getName().c_str());
-                 p->subtractGold(tempItem->price());
-                 notice(s_GameServ, u, "Don't forget to type /msg <S equip %ld", tempItem->getID());
-               }
-         else
-               {
-                 notice(s_GameServ, u, "You can't carry any more!");
-               }
-    }
-  else if (stricmp(cmd, "SELL" ) == 0)
-    {
-      itemContainer *tempContainer;
-      p = user->stats;
-      id = stringtoint(num);
-      if (!isstringnum(num))
-               {
-                 notice(s_GameServ, u, "SYNTAX: /msg <S store sell #");
-                 return;
-               }
-      else if (!(tempContainer = p->inventory->Find(id)))
-               {
-                 notice(s_GameServ, u, "You're not carrying that!");
-                 return;
-               }
-      else if (p->getGold() >= 2000000000)
-               {
-                 notice(s_GameServ, u, "You have enough gold. Just hang on to it for now.");
-               }
-      else 
-               {
-                 tempItem = tempContainer->getItem();
-                 
-                 notice(s_GameServ, u, "Thank you for your business! We gave you %ld gold for %s!", (tempItem->price() / 2), tempItem->getName().c_str());
-                 p->addGold((tempItem->price() / 2));
-                 p->inventory->deleteItem(tempItem);
-                 if (tempItem == p->getWeapon())
-                       {
-                         notice(s_GameServ, u, "Since you equipped %s, you're going to have to reequip something", tempItem->getName().c_str());
-                         tempItem->undo(p);
-                         p->clearWeapon();
-                       }
-                 else if (tempItem == p->getArmor())
-                       {
-                         tempItem->undo(p);
-                         notice(s_GameServ, u, "Since you equipped %s, you're going to have to reequip something", tempItem->getName().c_str());
-                         p->clearArmor();
-                       }
-               }
-    }
-  else
-    {
-      notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}");
-      notice(s_GameServ, u, "        \ 2STORE SELL #\ 2");
-      notice(s_GameServ, u, "        \ 2STORE BUY \1f#\1f\ 2");
-      return;
-    }
-}
-
-
-void do_tavern(char *u)
-{
-  char *cmd = strtok(NULL, " ");
-
-  aClient *user;
-  Player *p;
-  
-  if (!(user = find(u)))
-    {
-      notice(s_GameServ, u, "Fatal Error. See a <S admin for help");
-      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 go to the Tavern");
-      return;
-    }
-  else if (is_fighting(user))
-    {
-      notice(s_GameServ, u, "You cannot go to the Tavern during a fight!");
-      return;
-    }
-  
-  updateTS(user->stats);
-  p = user->stats;
-  
-  if (!cmd)
-    {
-      notice(s_GameServ, u, "Welcome to Boot Liquors Mystic Apothecary and General Store");
-      notice(s_GameServ, u, "Your commands:");
-      notice(s_GameServ, u, "/msg <S TAVERN {LIST | BUY} [NUMBER]");
-      notice(s_GameServ, u, "What'll it be?");
-    }
-  else if (stricmp(cmd, "LIST") == 0)
-    {
-      notice(s_GameServ, u, "Here is a list of what we have to offer:");
-      showTavern(user);
-      notice(s_GameServ, u, "To buy an item, type /msg <S TAVERN BUY #");
-    }
-  else if (stricmp(cmd, "BUY") == 0)
-    {
-         int amt = 1;
-      char *chid = strtok(NULL, " ");
-         char *amount = strtok(NULL, " ");
-
-         if (amount)
-               amt = stringtoint(amount);
-      
-      if (!chid)
-               {
-                 notice(s_GameServ, u, "SYNTAX: TAVERN BUY # [#]");
-                 notice(s_GameServ, u, "Example: /msg <S TAVERN BUY 6001");
-                 notice(s_GameServ, u, "Example: /msg <S TAVERN BUY 6001 10");
-                 return;
-               }
-      long id = stringtoint(chid);
-      tavernItem *tempItem;
-      
-      if (!(tempItem = findTavernItemByID(id)) || user->stats->getLevel() < tempItem->getLevel())
-               {
-                 notice(s_GameServ, u, "Invalid Choice!");
-                 notice(s_GameServ, u, "Here is a list of what we have to offer:");
-                 showTavern(user);
-                 notice(s_GameServ, u, "To buy an item, type /msg <S TAVERN BUY #");
-                 return;
-               }
-      else if (!amount && user->stats->getGold() < tempItem->getItem()->price())
-               {
-                 notice(s_GameServ, u, "You don't have enough gold!");
-                 notice(s_GameServ, u, "Here is a list of what we have to offer:");
-                 showTavern(user);
-                 notice(s_GameServ, u, "To buy an item, type /msg <S TAVERN BUY #");
-               }
-         else if (user->stats->getGold() < amt * tempItem->getItem()->price())
-               {
-                 notice(s_GameServ, u, "You don't have enough gold!");
-                 notice(s_GameServ, u, "Here is a list of what we have to offer:");
-                 showTavern(user);
-                 notice(s_GameServ, u, "To buy an item, type /msg <S TAVERN BUY # [#]");
-               }
-         else
-               {
-                 if (amount)
-                       {
-                         int amt = stringtoint(amount);
-                         if (amt < 0 || amount[0] == '-')
-                               {
-                                 notice(s_GameServ, u, "You trying to steal from me?");
-                               }
-                         else if (user->stats->inventory->addItem(tempItem->getItem(), amt) == NULL)
-                               {
-                                 notice(s_GameServ, u, "You can't carry that many!");
-                               }
-                         else
-                               {
-                                 notice(s_GameServ, u, "%d %s's coming right up!", amt, tempItem->getItem()->getName().c_str());
-                                 user->stats->subtractGold(tempItem->getItem()->price() * amt);
-                               }
-                       }
-                 else
-                       {
-                         if (user->stats->inventory->addItem(tempItem->getItem()) == NULL)
-                               {
-                                 notice(s_GameServ, u, "You can't carry any more!");
-                               }
-                         else
-                               {
-                                 notice(s_GameServ, u, "One %s coming right up!", tempItem->getItem()->getName().c_str());
-                                 user->stats->subtractGold(tempItem->getItem()->price());
-                               }
-                       }
-               }
-    }
-  else
-    {
-      notice(s_GameServ, u, "Improper Syntax.");
-      notice(s_GameServ, u, "Type /msg <S HELP TAVERN for help");
-    }
-  return;
-}
-
-
-
-void do_dragon(char *u)
-{
-  aClient *user;
-  
-  if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal error. Contact a(n) <S admin. buf: %s", strtok(NULL, ""));
-         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 fight the dragon!");
-         return;
-    }
-  else if (is_fighting(user))
-    {
-         notice(s_GameServ, u, "You are already in a fight. How will you fight the almighty dragon!?");
-         return;
-    }
-  else if (!isAlive(user->stats))
-    {
-         notice(s_GameServ, u, "You're dead. Wait until tomorrow to see your master!");
-         return;
-    }
-  else if (user->stats->getLevel() < LEVELS)
-    {
-         notice(s_GameServ, u, "You fool! Only those strong enough "\
-                        "to vanquish any foe should DARE fight the dragon!");
-         notice(s_GameServ, u, "To put it in terms you can understand: "\
-                        "You are too weak. You must be Level %d!", REALLEVELS);
-         return;
-    }
-  
-  updateTS(user->stats);
-  
-  Player *p = user->stats;
-  setMaster(p);
-  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 "\
-                "heated mist of deadly fire from beyond the cave "\
-                "entrance.");
-  notice(s_GameServ, u, "You adjust your %s, tighten your grip on "\
-                "your %s, and venture into the hot, dark cave. "\
-                "You are surprised at the angle of descent as you climb "\
-                "lower and lower, deeper into the dragon's den.", 
-                (p->getArmor() ? p->getArmor()->getName().c_str() : "Fists"), (p->getWeapon() ? p->getWeapon()->getName().c_str() : "Birthday Suit"));
-  notice(s_GameServ, u, "You come to the end of the cave to find "\
-                "a tooth. It is a large tooth... bigger than your torso."\
-                " Suddenly the darkness lifts from the gleam of an eye "\
-                " staring into your soul! The eye is large... HUGE!");
-  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!");
-  p->setMonster(&dragon);
-  setDragonFight(p);
-  display_monster(u);
-}
-
-void do_master(char *u)
-{
-  aClient *user;
-  
-  
-  if (!(user = find(u)))
-    {
-         notice(s_GameServ, u, "Fatal error. Contact a(n) <S admin. buf: %s", strtok(NULL, ""));
-         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 see your master!");
-         return;
-    }
-  else if (is_fighting(user))
-    {
-         notice(s_GameServ, u, "You're in the middle of a fight! Pay attention!");
-         return;
-    }
-  else if (!isAlive(user->stats))
-    {
-         notice(s_GameServ, u, "You're dead. Wait until tomorrow to see your master!");
-         return;
-    }
-  
-  updateTS(user->stats);
-  
-  char *cmd = strtok(NULL, " ");
-  Player *p = user->stats;
-  long int need = 0;
-  
-  if (seenMaster(p))
-    {
-         notice(s_GameServ, u, "You have already seen your master today. Wait until tomorrow to try again");
-         return;
-    }
-  
-  if (cmd != NULL)
-    {
-         switch(p->getLevel())
-               {
-           case 1:
-                 need = 200;
-                 break;
-           case 2:
-                 need = 800;
-                 break;
-           case 3:
-                 need = 2000;
-                 break;
-           case 4:
-                 need = 8000;
-                 break;
-           case 5:
-                 need = 20000;
-                 break;
-           case 6:
-                 need = 80000;
-                 break;
-           case 7:
-                 need = 200000;
-                 break;
-           case 8:
-                 need = 800000;
-                 break;
-           case 9:
-                 need = 2000000;
-                 break;
-           case 10:
-                 need = 8000000;
-                 break;
-           case 11:
-                 need = 20000000;
-                 break;
-                 
-           case REALLEVELS:
-                 need = p->getExp() + 1;
-                 notice(s_GameServ, u, "You are at level %d. You are the master. What's left? The DRAGON!", REALLEVELS);
-                 return;
-                 break;
-           default:
-                 need = p->getExp() + 1; // Unknown level... don't let them fight a fake master!
-                 break;
-               }   
-    }
-  else
-    {
-         notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}");
-         return;
-    }
-  
-  if (stricmp(cmd, "FIGHT") == 0)
-    {
-         if (p->getExp() >= need)
-               {
-                 setMaster(p);
-                 see_master(u);
-               }
-         else
-           notice(s_GameServ, u, "You are not worthy of fighting %s! You need %ld more experience.", 
-                          levels[p->getLevel() - 1].master.name.c_str(), (need - p->getExp()));
-         return;
-    }
-  else if (stricmp(cmd, "QUESTION") == 0)
-    {
-         if (p->getExp() >= need)
-           notice(s_GameServ, u, "%s looks you up and down and decides you are more ready than you will ever be.", 
-                          levels[p->getLevel() - 1].master.name.c_str());
-         else
-           notice(s_GameServ, u, "You pathetic fool! You are no match for %s, %s!", 
-                          levels[p->getLevel() - 1].master.name.c_str(), p->getName().c_str());
-         
-         return;
-    }
-  else
-    {
-         notice(s_GameServ, u, "SYNTAX: MASTER {FIGHT | QUESTION}");
-    }
-}
-
-
-
-void do_reset(char *u)
-{
-  char *nick = 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 (!isAdmin(user))
-    {
-         notice(s_GameServ, u, "You must be a <S admin to use this command!");
-         return;
-    }
-  
-  if (!nick)
-    {
-         notice(s_GameServ, u, "SYNTAX: RESET {ALL | NICK}");
-    }
-  else if (stricmp(nick, "ALL") == 0)
-    {
-         notice(s_GameServ, u, "Resetting everyone's stats!");
-         resetall();
-    }
-  else if (!(p = findplayer(nick)))
-       {
-         notice(s_GameServ, u, "Nick %s not found.", nick);
-       }
-  else
-    {
-         notice(s_GameServ, u, "Resetting %s.", p->getName().c_str());
-         reset(p);
-       }
-}
-
-
-
-
-