]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Implemented the definitions for the new items class and added some declarations into...
[irc/gameservirc.git] / gameserv / gameserv.cpp
index 97caf63e2d88076cb352defe63827b0fce71cbef..a4ed61a167f9e872176e4300bb5a184b22a4be30 100644 (file)
@@ -386,16 +386,16 @@ void showstats(const char *u, const char *nick)
         notice(s_GameServ, sender->getNick(), "Hit Points: %d of %d", ni->stats->hp,
                  ni->stats->maxhp);
 
-        sprintf(buf, "Strength: %d", ni->stats->strength + webonus[ni->stats->weapon]);
+        sprintf(buf, "Strength: %d", ni->stats->strength + webonus[ni->stats->wea]);
         space = spaces(strlen(buf), " ");
         notice(s_GameServ, sender->getNick(), "%s%sDefense: %d",
-                 buf, space, ni->stats->defense + arbonus[ni->stats->armor]);
+                 buf, space, ni->stats->defense + arbonus[ni->stats->arm]);
         delete [] space;
 
-        sprintf(buf, "Armor: %s", armors[ni->stats->armor]);
+        sprintf(buf, "Armor: %s", armors[ni->stats->arm]);
         space = spaces(strlen(buf), " ");
         notice(s_GameServ, sender->getNick(), "%s%sWeapon: %s", buf, space,
-                 weapons[ni->stats->weapon]);
+                 weapons[ni->stats->wea]);
         delete [] space;
 
         sprintf(buf, "Forest Fights: %d", ni->stats->forest_fights);
@@ -985,13 +985,13 @@ void do_set(char *u)
            return;
        }
 
-         target->stats->weapon = stringtoint(cmd2);
+         target->stats->wea = stringtoint(cmd2);
 
-         if (target->stats->weapon < 0)
-               target->stats->weapon = 0;
-         else if (target->stats->weapon >= WNA)
-               target->stats->weapon = WNA - 1;
-         notice(s_GameServ, u, "Weapon set to %s", weapons[target->stats->weapon]);
+         if (target->stats->wea < 0)
+               target->stats->wea = 0;
+         else if (target->stats->wea >= WNA)
+               target->stats->wea = WNA - 1;
+         notice(s_GameServ, u, "Weapon set to %s", weapons[target->stats->wea]);
          return;
        }
   }
@@ -1009,14 +1009,14 @@ void do_set(char *u)
            notice(s_GameServ, u, "SYNTAX: /msg %S SET [NAME] ARMOR <NUMBER>");
            return;
        }
-         target->stats->armor = stringtoint(cmd2);
+         target->stats->arm = stringtoint(cmd2);
 
-         if (target->stats->armor < 0)
-             target->stats->armor = 0;
-         else if (target->stats->armor >= WNA)
-             target->stats->armor = WNA - 1;
+         if (target->stats->arm < 0)
+             target->stats->arm = 0;
+         else if (target->stats->arm >= WNA)
+             target->stats->arm = WNA - 1;
 
-         notice(s_GameServ, u, "Armor set to %s", armors[target->stats->armor]);
+         notice(s_GameServ, u, "Armor set to %s", armors[target->stats->arm]);
          return;
        }
   }
@@ -1317,7 +1317,7 @@ void do_register(char *u)
         if (!is_playing(user))
         {
            ListNode<aClient> *temp;
-           user->stats = new Player(user);
+           user->stats = new Player();
            user->stats->client = user; // Set the backwards pointer
            user->stats->reset(); // set the user up
            user->stats->setPassword(password);
@@ -1990,14 +1990,14 @@ void end_turn(aClient *user)
         // Opponent's Hit
         mhit = (fight->strength / 2) +
                (rand() % (fight->strength / 2) - (user->stats->defense +
-                arbonus[user->stats->armor]));
+                arbonus[user->stats->arm]));
     }
     else
     {
         // Opponent's Hit
-        mhit = (((battle->stats->strength + webonus[battle->stats->weapon]) / 2) +
-               (rand() % ((battle->stats->strength + webonus[battle->stats->weapon])) / 2) -
-               (user->stats->defense + arbonus[user->stats->armor]));
+        mhit = (((battle->stats->strength + webonus[battle->stats->wea]) / 2) +
+               (rand() % ((battle->stats->strength + webonus[battle->stats->wea])) / 2) -
+               (user->stats->defense + arbonus[user->stats->arm]));
     }
     if (!player_fight(user))
     {
@@ -2221,7 +2221,7 @@ int save_gs_dbase()
        clearYourTurn(it);
        outfile << it->name.c_str() << ' ' << it->level << ' ' << it->exp << ' ' << it->gold << ' ' << it->bank << ' '
                << it->hp << ' ' << it->maxhp << ' ' << it->strength << ' ' << it->defense << ' '
-               << it->armor << ' ' << it->weapon << ' '
+               << it->arm << ' ' << it->wea << ' '
                << it->forest_fights << ' ' << it->player_fights <<  ' ' 
                << it->getFlags() << ' ' << it->password << ' ' << it->inventory.Healing()
                << ' ' << it->inventory.Strength() << ' ' << it->inventory.Defense() << ' ' << it->inventory.HP()
@@ -2339,8 +2339,8 @@ int load_gs_dbase()
        p->maxhp = stringtoint(strtok(NULL, " "));
        p->strength = stringtoint(strtok(NULL, " "));
        p->defense = stringtoint(strtok(NULL, " "));
-       p->armor = stringtoint(strtok(NULL, " "));
-       p->weapon = stringtoint(strtok(NULL, " "));
+       p->arm = stringtoint(strtok(NULL, " "));
+       p->wea = stringtoint(strtok(NULL, " "));
        p->forest_fights = stringtoint(strtok(NULL, " "));
        p->player_fights = stringtoint(strtok(NULL, " "));
        p->setFlags(stringtoint(strtok(NULL, " ")));
@@ -2517,14 +2517,14 @@ void do_store(char *u)
 
            p = user->stats;
 
-            if (p->weapon != 0)
-                notice(s_GameServ, u, "You have to sell your %s first!", weapons[p->weapon]);
+            if (p->wea != 0)
+                notice(s_GameServ, u, "You have to sell your %s first!", weapons[p->wea]);
             else if (p->gold < prices[wep - 1])
                 notice(s_GameServ, u, "You don't have enough gold for %s!", weapons[wep]);
             else
             {
                 notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", weapons[wep]);
-                p->weapon = wep;
+                p->wea = wep;
                 p->gold -= prices[wep - 1];
             }
         }
@@ -2539,14 +2539,14 @@ void do_store(char *u)
 
            p = user->stats;
 
-            if (p->armor != 0)
-                notice(s_GameServ, u, "You have to sell your %s first!", armors[p->armor]);
+            if (p->arm != 0)
+                notice(s_GameServ, u, "You have to sell your %s first!", armors[p->arm]);
             else if (p->gold < prices[wep - 1])
                 notice(s_GameServ, u, "You don't have enough gold for %s!", armors[wep]);
             else
             {
                 notice(s_GameServ, u, "You have purchased %s! Thanks for the gold!", armors[wep]);
-                p->armor = wep;
+                p->arm = wep;
                 p->gold -= prices[wep - 1];
             }
         }
@@ -2562,7 +2562,7 @@ void do_store(char *u)
 
         if (stricmp(item, "WEAPON") == 0)
         {
-            if (p->weapon == 0)
+            if (p->wea == 0)
             {
                 notice(s_GameServ, u, "You want me to chop off your hands?");
                 return;
@@ -2570,27 +2570,27 @@ void do_store(char *u)
             else if (p->gold == 2000000000)
             {
                 notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire.");
-                p->weapon = 0;
+                p->wea = 0;
             }
-            else if (2000000000 - p->gold < (prices[p->weapon - 1] / 2))
+            else if (2000000000 - p->gold < (prices[p->wea - 1] / 2))
             {
                 notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry.");
                 notice(s_GameServ, u, "However, you have no weapon... can I interest you in the %s?", weapons[WNA - 1]);
                 p->gold = 2000000000;
-                p->weapon = 0;
+                p->wea = 0;
             }
             else
            {
-                notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no weapon!", (prices[p->weapon - 1] / 2));
-                p->gold += (prices[p->weapon - 1] / 2);
-                p->weapon = 0;
+                notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no weapon!", (prices[p->wea - 1] / 2));
+                p->gold += (prices[p->wea - 1] / 2);
+                p->wea = 0;
             }
         }
         else if (stricmp(item, "ARMOR") == 0)
         {
            p = user->stats;
 
-            if (p->armor == 0)
+            if (p->arm == 0)
             {
                 notice(s_GameServ, u, "I don't think you can be any more naked...");
                 return;
@@ -2598,22 +2598,22 @@ void do_store(char *u)
             if (p->gold == 2000000000)
             {
                 notice(s_GameServ, u, "You have enough gold. I'll just take that off your hands, sire.");
-                p->armor = 0;
+                p->arm = 0;
             }
-            else if (2000000000 - p->gold < (prices[p->armor - 1] / 2))
+            else if (2000000000 - p->gold < (prices[p->arm - 1] / 2))
             {
                 notice(s_GameServ, u, "Thank you for your business! You now have as much gold as you can carry.");
                 notice(s_GameServ, u, "However, you have no armor... can I interest you in %s?", armors[WNA - 1]);
                p->gold = 2000000000;
-                p->armor = 0;
+                p->arm = 0;
             }
             else
             {
                 notice(s_GameServ, u, "Thank you for your business! You now have %d more gold but no armor!",
-                         (prices[p->armor - 1] / 2));
+                         (prices[p->arm - 1] / 2));
 
-                p->gold += (prices[p->armor - 1] / 2);
-                p->armor = 0;
+                p->gold += (prices[p->arm - 1] / 2);
+                p->arm = 0;
             }
        }
         else
@@ -3033,7 +3033,7 @@ void do_dragon(char *u)
        "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.", 
-       armors[p->armor], weapons[p->weapon]);
+       armors[p->arm], weapons[p->wea]);
     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 "\