]> jfr.im git - irc/gameservirc.git/commitdiff
Fixed some bugs and added VLife as a supported ircd
authorkainazzzo <redacted>
Fri, 20 Oct 2006 17:33:33 +0000 (17:33 +0000)
committerkainazzzo <redacted>
Fri, 20 Oct 2006 17:33:33 +0000 (17:33 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@456 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/Changes
gameserv/Config
gameserv/do_attack.cpp
gameserv/player.h
gameserv/script.cpp
gameserv/tcpclient.cpp

index 4dd0eb94a80b57a272e9b6b458921e595b1acbd4..094574fb2018cbedc288802945c43e654c85d79f 100644 (file)
@@ -1,4 +1,5 @@
 Version 1.3.4
+* Added VLife as a new supported ircd - Kain (thanks bernardocr)
 * Fixed a new bug that crashed gameserv when someone attempted to register a nickname - Kain
 * SET [playername] HP # now also sets the Max HP for a player if it's lower than what you're
     setting the hp to. If you type /msg gameserv set player hp 1000, but their maxhp was
index b097cef9c731a5a71b45cf5760ebaea992a250d2..5d692428a51efcf55c11270fa9896af22610e390 100755 (executable)
@@ -14,6 +14,7 @@ Choose your IRCD
 4. ircd-hybrid, ircd-ratbox, or csircd
 5. UltimateIRCD 2.8.x
 6. PTLink
+7. VLife
 ++
 
 printf "Make your selection: "
@@ -26,42 +27,56 @@ case $select in
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
            echo "#undef ULTIMATE2" >> options.h
-            echo "#undef PTLINK" >> options.h;;
+            echo "#undef PTLINK" >> options.h
+           echo "#undef VLIFE" >> options.h;;
        2)
            echo "#undef UNREAL" > options.h
            echo "#define BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
            echo "#undef ULTIMATE2" >> options.h
-            echo "#undef PTLINK" >> options.h;;
+            echo "#undef PTLINK" >> options.h
+            echo "#undef VLIFE" >> options.h;;
        3)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#define P10" >> options.h
            echo "#undef HYBRID" >> options.h
            echo "#undef ULTIMATE2" >> options.h
-            echo "#undef PTLINK" >> options.h;;
+            echo "#undef PTLINK" >> options.h
+            echo "#undef VLIFE" >> options.h;;
        4)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#define HYBRID" >> options.h
            echo "#undef ULTIMATE2" >> options.h
-            echo "#undef PTLINK" >> options.h;;
+            echo "#undef PTLINK" >> options.h
+            echo "#undef VLIFE" >> options.h;;
        5)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
            echo "#define ULTIMATE2" >> options.h
-            echo "#undef PTLINK" >> options.h;;
+            echo "#undef PTLINK" >> options.h
+            echo "#undef VLIFE" >> options.h;;
         6)
            echo "#undef UNREAL" > options.h
            echo "#undef BAHAMUT" >> options.h
            echo "#undef P10" >> options.h
            echo "#undef HYBRID" >> options.h
            echo "#undef ULTIMATE2" >> options.h
-            echo "#define PTLINK" >> options.h;;
+            echo "#define PTLINK" >> options.h
+            echo "#undef VLIFE" >> options.h;;
+       7)
+           echo "#undef UNREAL" > options.h
+           echo "#undef BAHAMUT" >> options.h
+           echo "#undef P10" >> options.h
+           echo "#undef HYBRID" >> options.h
+           echo "#undef ULTIMATE2" >> options.h
+            echo "#undef PTLINK" >> options.h
+            echo "#define VLIFE" >> options.h;;
        *)
            echo
            echo "Improper selection"
index 70aa62b5c4bf22eb740157ff01e90d5a131a62a2..17137c5053d9261eb09593308abd11604b79d852 100644 (file)
@@ -210,13 +210,18 @@ void do_attack(char *u)
     {
       if (is_playing(battle))
                {
-                 if (!isYourTurn(ni->stats))
+                 if (!isYourTurn(ni->stats) && isYourTurn(battle->stats))
                        {
                          notice(s_GameServ, u, "Please wait until %s decides what to do!",
                                         battle->stats->getName().c_str());
                          return;
                        }
-                 if (hit > 0)
+                 else if (!isYourTurn(ni->stats) && !isYourTurn(battle->stats))
+                       {
+                         // If somehow the player vs. player fight hangs, give the turn to the first attacker
+                         setYourTurn(ni->stats);
+                       }
+                if (hit > 0)
                        {
                          notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->stats->getName().c_str(), hit);
                          
index 6c2a8a8035c76c44de82e7b8d26406e4fdf0f031..f4b1bba3354acc2abd4682b5fad64e8654c0bd2f 100644 (file)
@@ -13,6 +13,7 @@ class weapon;  // forward declaration
 class armor;   // forward declaration
 class potion;  // forward declaration
 class pouch;   // forward declaration
+class script;  // forward declaration
 
 class Player {
 public:
@@ -23,6 +24,7 @@ public:
   void setData(Player *);
 
   void reset();
+  friend script;
   
   long int getFlags() { return flags; };          // Returns the Client's current flags
   // Functions also return the flags after modifying them
index 91ef0f8292a670d5e4f3862e6987b442035d5fa5..6ddfd69965e8edaadd7240adca5bb05234ae4794 100644 (file)
@@ -1,3 +1,4 @@
+
 #include "script.h"
 #include "extern.h"
 #include <fstream>
@@ -40,6 +41,8 @@ bool script::executeScript(Player *p)
   string line;
   string::size_type begin = 0;
   string::size_type end = scriptstr.find("\n", 0);
+  char *left, *op, *right, *buffer;
+  void *leftptr;
 
   while (end != string::npos)
        {
@@ -47,7 +50,26 @@ bool script::executeScript(Player *p)
          line = scriptstr.substr(begin, end - begin);
 
          log("Line: %s", line.c_str());
-         
+
+         if (line.c_str()[0] != '#')
+               {
+                 // Not a comment
+                 buffer = new char[line.length()];
+
+                 left = strtok(buffer, " ");
+                 op = strtok(NULL, " ");
+                 right = strtok(NULL, " ");
+
+                 if (stricmp(left, "GOLD") == 0)
+                       {
+                         (int*)leftptr = p->gold;
+                       }
+                 else if (stricmp(left, "STRENGTH") == 0)
+                       {
+                         (int*)leftptr = p->strength;
+                       }
+               }
+          
          // Find the next line
          begin = end + 1;
          end = scriptstr.find("\n", begin);
index 48e7823371ba1ec40f001774ab3b11b775d6c9b2..90cfc7062d8721833004c157c76bbf859716ac5c 100644 (file)
@@ -225,6 +225,14 @@ int main(int argc, char *argv[])
          raw("SERVER %s 1 :%s", servername, servername);
          raw("NICK %S 1 %d %s%s %s %s %s :GameServ", time(NULL), (isBOper() ? "+iow " : ""), gsident, gshost, gshost, servername);
          raw(":%s SJOIN %d %s +nt :@%S", servername, time(NULL), c_Forest);
+#elif defined(VLIFE)
+         raw("PASS %s :TS", remotepass);
+         raw("SERVER %s 1 %d :%s", servername, time(NULL), servername);
+         //NNICK Kain 1 1161359175 +G kain 209.204.118.242 virtualife.1413884c.bf6674e.IP PTlink6.server.net :Kain
+         //NNICK Kainazzzo 1 1161359234 +G kain 209.204.118.242 virtualife.1413884c.bf6674e.IP PTlink6.server.net :Kain
+               
+         raw("NNICK %S 1 %d +w%s %s %s %s %s :GameServ", time(NULL),(isBOper() ? "o" : ""), gsident, gshost, gshost, servername);
+         raw(":%s SJOIN %d %s +nt :@%S", servername, time(NULL), c_Forest);
 #elif defined(P10)
          // Server numeric is: []  <-- must be unique
          raw("PASS :%s", remotepass);
@@ -382,7 +390,11 @@ int main(int argc, char *argv[])
                        }
                  // Code indenting is clean up until here!
 #if !defined(P10)
-                 else if (strncmp(cmd, "NICK", 4) == 0)
+                 else if (strncmp(cmd, "NICK", 4) == 0
+                                  #ifdef VLIFE
+                                  || strncmp(cmd, "NNICK", 5) == 0
+                                  #endif
+                                  )
                        {
                          if (buffer[0] == ':')
                                {