]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Fixed a bug with RUN, where if a user was not logged in (playing), the
[irc/gameservirc.git] / gameserv / gameserv.cpp
index 6ab518d1485078314c24c64788932aeeaa204e12..e0a9b6680468759bb4bdac7e98166c470fec1a5f 100644 (file)
@@ -24,6 +24,7 @@ using std::ofstream;
 List<aClient> players;
 
 Monster *monsters[LEVELS][MONSTERS];   // Monsters per level. Total = MONSTERS * LEVELS
+Monster boss;                          // The boss monster
 
 Monster *masters[LEVELS];              // A master for each level
 
@@ -148,13 +149,18 @@ void gameserv(char *source, char *buf)
        log("Source: %s  Command: %s", source, cmd);
     #endif
 
-    long int mn = midnight() - 12 * 3600; // 12 noon ;)
+    struct tm *tm;
+    time_t ti;
+    time(&ti);
+    tm = localtime(&ti);
 
-    if (mn > timestamp)
+    int curday = tm->tm_mday;
+
+    if (curday != day)
     {
         refreshall();
-        timestamp = mn;
-       save_timestamp();
+        day = curday;
+       save_day();
     }
 
     if (strnicmp(cmd, "\1PING", 6) == 0)
@@ -1125,6 +1131,12 @@ void do_run(char *u)
        return;
     }
 
+    else if (!is_playing(user))
+    {
+        notice(s_GameServ, u, "You must be playing to use items!");
+        return;
+    }
+
     p = user->stats;
 
     if (p->battle)
@@ -2194,6 +2206,11 @@ void do_bank(char *u)
        notice(s_GameServ, u, "You must be playing to use the bank!");
        return;
     }
+    else if (stricmp(cmd, "BALANCE") == 0)
+    {
+        showBankBalance(u);
+        return;
+    }
     else if (!isAlive(user->stats))
     {
        notice(s_GameServ, u, "You are dead. We don't accept gold from dead folk! Wait 'til tomorrow!");
@@ -2207,11 +2224,7 @@ void do_bank(char *u)
 
     p = user->stats;
 
-    if (stricmp(cmd, "BALANCE") == 0)
-    {
-       showBankBalance(u);
-    }
-    else if (stricmp(cmd, "DEPOSIT") == 0)
+    if (stricmp(cmd, "DEPOSIT") == 0)
     {
         if (p->bank == 2000000000)
         {