]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Added the do_store command, and some store functionality. Also added an init_masters...
[irc/gameservirc.git] / gameserv / gameserv.cpp
index f804381939752d12ffd05ad2191aad6e7ce6b86e..546692be60115f5b1fe16d6b90fad43d73f310a7 100644 (file)
@@ -8,6 +8,7 @@
 
 List<aClient> players;
 Monster monsters[5][12];
+Monster masters[12];
 
 // Database functions
 int save_gs_dbase();
@@ -124,6 +125,8 @@ void gameserv(char *source, char *buf)
        do_attack(source);
     } else if (stricmp(cmd, "HEAL") == 0) {
        do_heal(source);
+    } else if (stricmp(cmd, "STORE") == 0) {
+       do_store(source);
     } else if (stricmp(cmd, "PRINT") == 0) {
        cout << "Printing Clients List: " << endl;
        clients.print();
@@ -139,7 +142,7 @@ void gameserv(char *source, char *buf)
     } else if (stricmp(cmd, "STATS") == 0) {
        do_stats(source);
     } else if (stricmp(cmd, "SHUTDOWN") == 0) {
-       //save_gs_dbase();
+       save_gs_dbase();
        raw("SQUIT %s :leaving", servername);
     } else if (stricmp(cmd, "SAVE") == 0) {
        save_gs_dbase();
@@ -457,6 +460,98 @@ void do_stats(char *u)
     else
        showstats(u, nick);
 }
+void init_masters()
+{
+    masters[0].name = "Old Bones";
+    masters[0].weapon = "Dull Sword Cane";
+    masters[0].strength = 30;
+    masters[0].gold = 0;
+    masters[0].exp = 0;
+    masters[0].maxhp = 30;
+    masters[0].death = "You have done well my student, but the road is long. Use your new strength with humility and honor as you progress in levels!";
+
+    masters[1].name = "Master Chang";
+    masters[1].weapon = "Nanchaku";
+    masters[1].strength = 57;
+    masters[1].gold = 0;
+    masters[1].exp = 0;
+    masters[1].maxhp = 40;
+    masters[1].death = "You try to make out what Master Chang is saying, but the only thing you catch is something about a grasshopper.";
+
+    masters[2].name = "Chuck Norris";
+    masters[2].weapon = "Ranger Kick";
+    masters[2].strength = 85;
+    masters[2].gold = 0;
+    masters[2].exp = 0;
+    masters[2].maxhp = 70;
+    masters[2].death = "Be strong, and keep your goals in site. Drink milk, and don't do drugs. One day you may be fighting next to me as a Texas Ranger YEEHAW!";
+
+
+    masters[3].name = "Mr. Miagi";
+    masters[3].weapon = "Petrified Bonsai";
+    masters[3].strength = 100;
+    masters[3].gold = 0;
+    masters[3].exp = 0;
+    masters[3].maxhp = 120;
+    masters[3].death = "Skill comes from repeating the correct but seemingly mundane actions. Wax ON, wax OFF!";
+
+    masters[4].name = "Jackie Chan";
+    masters[4].weapon = "Drunken Boxing";
+    masters[4].strength = 125;
+    masters[4].maxhp = 200;
+    masters[4].gold = 0;
+    masters[4].exp = 0;
+    masters[4].death = "I like to let people talk who like to talk... it's easier to find out how full of it they really are!";
+
+    masters[5].name = "Jet Li";
+    masters[5].weapon = "Motorcycle";
+    masters[5].strength = 150;
+    masters[5].maxhp = 400;
+    masters[5].gold = 0;
+    masters[5].exp = 0;
+    masters[5].death = "Failure is a fuel for excuses. It's the doing the do, that makes the making.";
+
+
+    masters[6].name = "Muhammad Ali";
+    masters[6].weapon = "Quick Jab";
+    masters[6].strength = 175;
+    masters[6].maxhp = 600;
+    masters[6].gold = 0;
+    masters[6].exp = 0;
+    masters[6].death = "It's just a job. Grass grows, birds fly, waves pound the sand. I beat people up.";
+
+    masters[7].name = "Li Mu Bai";
+    masters[7].weapon = "Green Destiny";
+    masters[7].strength = 200;
+    masters[7].maxhp = 800;
+    masters[7].gold = 0;
+    masters[7].exp = 0;
+    masters[7].death = "No growth without resistance.  No action without reaction.  No desire without restraint.";
+
+
+    masters[8].name = "Jimmy Wang Yu";
+    masters[8].weapon = "Flying Guillotine";
+    masters[8].strength = 275;
+    masters[8].maxhp = 1200;
+    masters[8].gold = 0;
+    masters[8].exp = 0;
+    masters[8].death = "You have beaten the one armed boxer. Proceed with caution!";
+
+    masters[9].name = "Wong Fei Hung";
+    masters[9].weapon = "Drunken Boxing";
+    masters[9].strength = 350;
+    masters[9].maxhp = 1800;
+    masters[9].gold = 0;
+    masters[9].exp = 0;
+    masters[9].death = "";
+
+    masters[10].name = "Bruce Lee";
+    masters[10].strength = 575;
+    masters[10].maxhp = 2500;
+    masters[10].gold = 0;
+    masters[10].exp = 0;
+    masters[10].death = "You must learn to concentrate. It is like a finger pointing away to the moon... DONT concentrate on the finger, or you will miss all the heavenly glory.";
+}
 
 void init_monsters()
 {
@@ -1451,8 +1546,9 @@ void do_heal(char *u)
         {
             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->maxhp - ni->stats->hp));
+            notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
+                     (ni->stats->maxhp - ni->stats->hp), 
+                    (price * (ni->stats->maxhp - ni->stats->hp)) );
             ni->stats->gold -= price * (ni->stats->maxhp - ni->stats->hp);
             ni->stats->hp = ni->stats->maxhp;
         }
@@ -1685,3 +1781,50 @@ bool check_password(char *name, char *plaintext)
     }
 }
 
+void do_store(char *u)
+{
+    char *cmd = strtok(NULL, " ");
+    char *item = strtok(NULL, " ");
+    char *num = strtok(NULL, " ");
+    char *space;
+
+    if (!cmd || !item)
+    {
+       notice(s_GameServ, u, "SYNTAX: STORE LIST {ARMOR | WEAPONS}");
+       notice(s_GameServ, u, "        \ 2STORE SELL {ARMOR | WEAPON}\ 2");
+       notice(s_GameServ, u, "        \ 2STORE BUY {ARMOR | WEAPON} \1fNUMBER\1f\ 2");
+    }
+    else if (stricmp(cmd, "LIST") == 0)
+    {
+       if (stricmp(item, "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 (int x = 1; x < WNA; x++)
+            {
+                space = spaces(strlen(weapons[x]), ".");
+                notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, weapons[x], space, prices[x - 1]);
+                free(space);
+            }
+           notice(s_GameServ, u, "To purchase a weapon, type /msg %S STORE BUY \ 2NUM\ 2.");
+            notice(s_GameServ, u, "Where num. is the weapon number from the menu above.");
+
+       }
+       else if (stricmp(item, "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 (int x = 1; x < WNA; x++)
+            {
+               space = spaces(strlen(armors[x]), ".");
+               notice(s_GameServ, u, "%s%d. %s%s%d",(x < 10 ? " " : ""), x, armors[x], space, prices[x - 1]);
+               free(space);
+           }
+            notice(s_GameServ, u, "To purchase armor, type /msg %S store buy armor num.");
+            notice(s_GameServ, u, "Where num. is the armor number from the menu above.");
+
+
+       }
+    } else if (stricmp(cmd, "BUY") == 0) {
+    }
+}