X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/accc7c20201425b55c4462263641efc331043a8c..c260a8d7699447c74d9a9ee8912582cc8814cec2:/gameserv/gameserv.cpp diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index d7a0f31..4374857 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -3,7 +3,6 @@ #include "extern.h" #include "flags.h" #include "list.h" -#include "myString.h" #include "sockhelp.h" #include @@ -23,13 +22,6 @@ using std::ios; #endif -// this will be hash.cpp start -// thank you wcampbel -unsigned long sHASH(const unsigned char *name); -unsigned long iHASH(const unsigned char *name); -List players[U_TABLE_SIZE]; -// this will be hash.cpp end - Monster *monsters[LEVELS][MONSTERS]; // Monsters per level. Total = MONSTERS * LEVELS Monster boss; // The boss monster @@ -225,16 +217,6 @@ void gameserv(char *source, char *buf) do_tavern(source); } else if (stricmp(cmd, "LIST") == 0) { do_list(source); - #ifdef DEBUGMODE - } else if (stricmp(cmd, "PRINT") == 0) { - List news; - myString *st; - st = new myString("This is a test"); - cout << news.insertAtBack_RLN(st)->getData() << endl; - cout << st << endl; - news.print(); - delete st; - #endif } else if (stricmp(cmd, "LOGOUT") == 0) { do_logout(source); } else if (stricmp(cmd, "REGISTER") == 0) { @@ -892,7 +874,8 @@ void do_identify(char *u) setPlaying(user); // set the playing flag temp->setPtr(user); - notice(s_GameServ, u, "Password Accepted. Identified."); + notice(s_GameServ, u, "Password Accepted. Identified."); + showNews(u, todaysnews); } } @@ -1661,7 +1644,12 @@ void do_attack(char *u) if (hit >= fight->hp) { if (master_fight(ni)) + { notice(s_GameServ, u, "You have bested %s!", fight->name); + addNews(todaysnews, "%s has bested %s and moved "\ + "to level %d", ni->stats->name, fight->name, + (ni->stats->level + 1)); + } else notice(s_GameServ, u, "You have killed %s!", fight->name); @@ -1731,6 +1719,8 @@ void do_attack(char *u) notice(s_GameServ, u, "You have been killed by %s!", fight->name); notice(s_GameServ, u, "You lose all gold on hand and lose 10 percent "\ "of your experience!"); + addNews(todaysnews, "%s has been killed by %s!", + ni->stats->name, fight->name); ni->stats->gold = 0; ni->stats->exp -= (long int)(ni->stats->exp * .10); ni->stats->hp = 0; @@ -1742,6 +1732,8 @@ void do_attack(char *u) { notice(s_GameServ, u, "%s has bested you! You will have to wait "\ "until tomorrow to try again", ni->stats->master->name); + addNews(todaysnews, "%s tried to best %s and failed!", + ni->stats->name, fight->name); ni->stats->fight = NULL; ni->stats->master = NULL; return; @@ -1857,18 +1849,13 @@ void do_attack(char *u) notice(s_GameServ, battle->getNick(), "%s has hit you with their %s for "\ "%d damage!", ni->stats->name, weapons[ni->stats->weapon], hit); - clearYourTurn(ni->stats); - setYourTurn(battle->stats); - display_players(battle); } else { notice(s_GameServ, u, "You miss %s completely!", battle->stats->name); notice(s_GameServ, battle->getNick(), "%s misses you completely!", ni->stats->name); - clearYourTurn(ni->stats); - setYourTurn(battle->stats); - display_players(battle); } + if (hit >= battle->stats->hp) { notice(s_GameServ, u, "You have killed %s!", battle->stats->name); @@ -1910,6 +1897,8 @@ void do_attack(char *u) ni->stats->gold = 2000000000; } + clearYourTurn(ni->stats); + clearYourTurn(battle->stats); battle->stats->battle = NULL; ni->stats->battle = NULL; return; @@ -1920,9 +1909,9 @@ void do_attack(char *u) battle->stats->hp -= hit; clearYourTurn(ni->stats); setYourTurn(battle->stats); + display_players(battle); notice(s_GameServ, u, "Please wait while %s decides what to do!", battle->stats->name); - return; } } @@ -3428,35 +3417,3 @@ bool load_monsters() delete [] buf; return true; } - -// this will be hash.cpp start -// thank you wcampbel -unsigned long sHASH(const unsigned char *name) -{ - unsigned long h = 0, g; - - while (*name) - { - h = (h << 4) + (*name++); // Case sensitive for numerics - if ((g = (h & 0xF0000000))) - h ^= g >> 24; - h &= ~g; - } - return h % U_TABLE_SIZE; -} - -unsigned long iHASH(const unsigned char *name) -{ - unsigned long h = 0, g; - - while (*name) - { - h = (h << 4) + tolower(*name++); - if ((g = (h & 0xF0000000))) - h ^= g >> 24; - h &= ~g; - } - return h % U_TABLE_SIZE; -} - -// this will be hash.cpp end