]> jfr.im git - irc/gameservirc.git/commitdiff
Added a tavern and inventory command.
authorkainazzzo <redacted>
Sat, 29 Nov 2003 04:49:37 +0000 (04:49 +0000)
committerkainazzzo <redacted>
Sat, 29 Nov 2003 04:49:37 +0000 (04:49 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@72 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/Changes
gameserv/TODO
gameserv/c_forest.cpp
gameserv/extern.h
gameserv/gameserv.cpp
gameserv/helpfiles/help
gameserv/helpfiles/inventory [new file with mode: 0644]

index 768bebe11c9dbd1d362991cc645c03df2c2c4e09..c32537933fa2d715d9c492eba8d5396508be9c89 100644 (file)
@@ -1,4 +1,8 @@
 Version 1.1.6
+* Added an inventory command which allows players to view how many
+    potions they are storing.
+* Added a tavern command which allows players to buy potions and store
+    them in their inventory for later use.
 * Made some cosmetic changes to this file.
 * Added an inventory class Pouch which allows players to carry around
     things such as potions and such.
index 67d87fe35e3144a6160f38c1e4e5bd5cc7c18df1..dfe550d6ae17ca3051d30941cdcf48fa52ded8d4 100644 (file)
@@ -2,6 +2,14 @@
 - = Started
 X = Finsihed
 
+- Finish the monsters for all levels.
+
+* Make all applicable commands take the player name instead of the irc
+    nickname as their parameter. This way players can have different names
+    and stay anonymous on IRC while enjoying full game functionality.
+
+* Add functionality for potions
+
 * Make GameServ a true daemon instead of using nohup
     * No output unless it's a loading error
 
@@ -10,8 +18,6 @@ X = Finsihed
 * Town square shouts. Array of 10 strings that gets rotated
     * Choose how many strings to rotate in the config file
 
-- Tavern where you can buy potions and powerups
-
 - Forest events
     X Wishing well
     X Fountain of youth - rejuvination & forest fights
@@ -45,7 +51,7 @@ X Fix bug where people can identify while they are two different
 
 X Add option to config file for forest fights per day, etc.
 
-* Finish the monsters for all levels.
-    X Load monsters from a monsters.dat file so they can be changed easily.
+X Load monsters from a monsters.dat file so they can be changed easily.
 
 X Periodic updates of the gameserv databases to avoid lost data
+X Tavern where you can buy potions and powerups
index 3dd0f80266507089dad86afca3937955e5cc6d22..7e1fc2f4fb32da9404698fa130759684b6d5dc14 100644 (file)
@@ -59,6 +59,7 @@ void do_forest(char *u)
         else if (!is_fighting(u))
         {
            int eventnum = rand() % 100;
+           eventnum = 14;
            Player *p = source->stats;
            p->forest_fights--;
 
@@ -97,18 +98,18 @@ void do_forest(char *u)
                if (eventnum < 5) // forest fights
                {
                    notice(s_GameServ, u, "EXTRA FOREST FIGHTS!!");
-                   p->forest_fights += 5;
+                   p->forest_fights += (rand() % 11) + 5;
                }
                else if (eventnum < 10)
                {
                    notice(s_GameServ, u, "A SACK OF GOLD!");
-                   p->gold += 1000 * p->level;
+                   p->gold += (rand() % 1000) * (p->level + (rand() % 10));
                }
                else
                {
                    notice(s_GameServ, u, "Time seems to stand still for a moment.");
                    notice(s_GameServ, u, "EXTRA EXPERIENCE POINTS");
-                   p->exp += 10 * 10 / (p->level / 100);
+                   p->exp += (rand() % 100) * (p->level + rand() % 10);
                }
            }
         }
index 4bf850944eb51add66a859ab008b3f4e1deebf4b..99ed2563bfdb0ce6a51e2d58c1f1bca3222ec2f0 100644 (file)
@@ -119,25 +119,28 @@ E void refresh(Player *p);
 E void refreshall();
 E void reset(aClient *ni);
 
-E void do_list(char *u);
-E void do_refresh(char *u);
-E void do_register(char *u);
+E void do_attack(char *u);
+E void do_bank(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_play(char *u);
 E void do_quitg(char *u);
+E void do_refresh(char *u);
+E void do_register(char *u);
 E void do_reset(char *u);
-E void do_fight(char *u);
-E void do_store(char *u);
-E void do_heal(char *u);
-E void do_bank(char *u);
-E void do_attack(char *u);
 E void do_run(char *u);
-E void do_visit(char *u);
 E void do_stats(char *u);
-E void do_forest(char *u);
+E void do_store(char *u);
+E void do_tavern(char *u);
+E void do_visit(char *u);
 E void see_mystic(char *u);
-E void showstats(const char *u, const char *nick);
 
+E void showstats(const char *u, const char *nick);
+E void showinventory(aClient *from, aClient *to = NULL);
 /* Database saving stuff */
 
 E int save_gs_dbase();
index c569cdc834cd77790338bf67dfced3bd35b73b5a..2ac16953a884a7c5ea807770121cb69fc7ce0780 100644 (file)
@@ -90,6 +90,7 @@ void do_fight(char *u);
 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);
@@ -104,6 +105,7 @@ void do_tavern(char *u);
 void see_master(char *u);
 
 void showstats(const char *u, const char *nick);
+void showinventory(aClient *from, aClient *to = NULL);
 void showBankBalance(const char *u);
 
 #define WNA 16
@@ -167,6 +169,8 @@ void gameserv(char *source, char *buf)
        do_run(source);
     } else if (stricmp(cmd, "HEAL") == 0) {
        do_heal(source);
+    } else if (stricmp(cmd, "INVENTORY") == 0) {
+       do_inventory(source);
     } else if (stricmp(cmd, "MASTER") == 0) {
        do_master(source);
     } else if (stricmp(cmd, "STORE") == 0) {
@@ -2878,7 +2882,37 @@ void do_store(char *u)
        }
     }
 }
+void do_inventory(char *u)
+{
+    aClient *user;
 
+    if (!(user = find(u)))
+    {
+       notice(s_GameServ, u, "Fatal Error. Contact a %S admin!");
+       return;
+    }
+    else if (!is_playing(user))
+    {
+       notice(s_GameServ, u, "You must be playing to check your inventory!");
+       return;
+    }
+    showinventory(user, user);
+}
+void showinventory(aClient *from, aClient *to)
+{
+    char *nick = to->getNick();
+
+    if (!to)
+       to = from;
+    if (is_playing(from))
+    {
+       Pouch *p = &from->stats->inventory;
+       notice(s_GameServ, nick, "Inventory for %s:", from->getNick());
+       notice(s_GameServ, nick, " Healing Potions: %d", p->Healing());
+       notice(s_GameServ, nick, "Strength Potions: %d", p->Strength());
+       notice(s_GameServ, nick, " Defense Potions: %d", p->Defense());
+    }
+}
 void do_tavern(char *u)
 {
     char *cmd = strtok(NULL, " ");
@@ -2896,6 +2930,11 @@ void do_tavern(char *u)
        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;
+    }
     p = user->stats;
     if (!cmd)
     {
@@ -2972,6 +3011,11 @@ void do_tavern(char *u)
                break;
        }
     }
+    else
+    {
+       notice(s_GameServ, u, "Improper Syntax.");
+       notice(s_GameServ, u, "Type /msg %S HELP TAVERN for help");
+    }
 }
 
 void do_bank(char *u)
index d62be33768de488fb67771772111a17d174f6da9..4c5f9a17d1527c1545cab0735901dabc32c67e7c 100644 (file)
@@ -9,6 +9,7 @@ Here are the basic commands available to everyone:
     \ 2HEAL\ 2            \1fHeal yourself. Replenishes Hit points\1f
     \ 2HELP\ 2            \1fBrings up this help menu\1f
     \ 2IDENTIFY\ 2        \1fIdentify yourself with a previously registered login\1f
+    \ 2INVENTORY\ 2       \1fView your inventory\1f
     \ 2LIST\ 2            \1fList who is currently in the realm\1f
     \ 2MASTER\ 2          \1fQuestion and fight your master to gain a level\1f
     \ 2REGISTER\ 2        \1fRegister a login and join the realm\1f
diff --git a/gameserv/helpfiles/inventory b/gameserv/helpfiles/inventory
new file mode 100644 (file)
index 0000000..35d4e3e
--- /dev/null
@@ -0,0 +1,4 @@
+The inventory command allows a player to check their inventory to see how
+many potions they have on hand. You may check your inventory during a fight.
+
+SYNTAX: /msg %S \ 2INVENTORY\ 2