X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/174e7f8facfa25922fe0cbc5e8dcb1e5a6f5bc07..0b9f497281b2a327fd9186d4f5b114aa6a466987:/gameserv/gameserv.cpp diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index 7a6414a..a5d0862 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -158,20 +158,6 @@ void gameserv(char *source, char *buf) log("Source: %s Command: %s", source, cmd); #endif - struct tm *tm; - time_t ti; - time(&ti); - tm = localtime(&ti); - - int curday = tm->tm_mday; - - if (curday != day) - { - refreshall(); - day = curday; - save_day(); // here i come to save the day! - } - if (strnicmp(cmd, "\1PING", 6) == 0) { char *ts; @@ -220,8 +206,7 @@ void gameserv(char *source, char *buf) } else if (stricmp(cmd, "LOGOUT") == 0) { do_logout(source); } else if (stricmp(cmd, "NEWS") == 0) { - addNews(todaysnews, "This is a test"); - showNews(source, todaysnews); + do_news(source); } else if (stricmp(cmd, "REGISTER") == 0) { do_register(source); } else if (stricmp(cmd, "IDENTIFY") == 0) { @@ -1356,9 +1341,20 @@ void do_use(char *u) return; } int oldhealing = user->stats->hp; + user->stats->hp += (10 * user->stats->level) + (rand() % 10) * user->stats->level; + if (user->stats->hp - user->stats->maxhp >= 100) + { + user->stats->hp = user->stats->maxhp + 100; + + if (oldhealing >= (user->stats->maxhp + 100)) + { + notice(s_GameServ, u, "You cannot hold anymore HP!"); + return; + } + } + notice(s_GameServ, u, "You hastiliy gulp down the flask of cool life-giving waters."); notice(s_GameServ, u, "Rejuvination spreads throughout your body."); - user->stats->hp += (10 * user->stats->level) + (rand() % 10) * user->stats->level; notice(s_GameServ, u, "You gain %d HP!", user->stats->hp - oldhealing); p->decHealing(); if (player_fight(user)) @@ -2116,6 +2112,19 @@ int load_gs_dbase() return 0; } + for (int x = 0; x < U_TABLE_SIZE; x++) + { + ListNode *tempNode; + tempNode = players[x].First(); + while (tempNode) + { + if (tempNode->getData()->stats->client) + logout(tempNode->getData()->stats->client); + tempNode = tempNode->Next(); + } + players[x].deleteNodes(); + } + while (infile.getline(buf, 1024, '\n')) { temp = new aClient; @@ -2509,7 +2518,6 @@ void do_tavern(char *u) else if (stricmp(cmd, "BUY") == 0) { char *chnum = strtok(NULL, " "); - int num = stringtoint(chnum); if (!chnum) { @@ -2517,6 +2525,8 @@ void do_tavern(char *u) notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1"); return; } + int num = stringtoint(chnum); + if (num < 1 || num > 4) { notice(s_GameServ, u, "Invalid Choice!"); @@ -2646,7 +2656,12 @@ void do_bank(char *u) notice(s_GameServ, u, "I don't know how to convert alphabet letters into currency, sire!"); return; } - + if (stringtoint(amount) < 0) + { + notice(s_GameServ, u, "Sorry. This bank is not licensed "\ + "to handle such sums of cash, noble Lord."); + return; + } p = user->stats; if (stricmp(cmd, "DEPOSIT") == 0)