X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/f0314ad533cd4d8bebdabea118a365da50a9f1d9..c260a8d7699447c74d9a9ee8912582cc8814cec2:/gameserv/gameserv.cpp diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index 75cb328..4374857 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -22,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 @@ -881,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); } } @@ -1650,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); @@ -1720,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; @@ -1731,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; @@ -1846,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); @@ -1899,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; @@ -1909,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; } } @@ -2454,6 +2454,7 @@ void do_tavern(char *u) aClient *user; Player *p; + if (!(user = find(u))) { notice(s_GameServ, u, "Fatal Error. See a %S admin for help"); @@ -2489,14 +2490,17 @@ void do_tavern(char *u) } else if (stricmp(cmd, "LIST") == 0) { - notice(s_GameServ, u, "Here is a list of what we have to offer:"); - notice(s_GameServ, u, "1. Healing Potions for %ld Gold", 100 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "2. Strength Potions for %ld Gold", 205 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "3. Defense Potions for %ld Gold", 200 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "4. HP Potions for %ld Gold", 230 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "To buy a potion, type /msg %S TAVERN BUY #"); - notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1 buys a healing potion!"); - notice(s_GameServ, u, "By something will ya!"); + notice(s_GameServ, u, "Here is a list of what we have to offer:"); + notice(s_GameServ, u, "1. Healing Potions for %ld Gold", + 1000 * p->level * 4); + notice(s_GameServ, u, "2. Strength Potions for %ld Gold", + 2500 * p->level * 4); + notice(s_GameServ, u, "3. Defense Potions for %ld Gold", + 3000 * p->level * 4); + notice(s_GameServ, u, "4. HP Potions for %ld Gold", + 2000 * p->level * 4); + notice(s_GameServ, u, "To buy a potion, type /msg %S TAVERN BUY #"); + notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1 buys a healing potion!"); } else if (stricmp(cmd, "BUY") == 0) { @@ -2513,10 +2517,14 @@ void do_tavern(char *u) { notice(s_GameServ, u, "Invalid Choice!"); notice(s_GameServ, u, "Here is a list of what we have to offer:"); - notice(s_GameServ, u, "1. Healing Potions for %ld Gold", 100 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "2. Strength Potions for %ld Gold", 205 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "3. Defense Potions for %ld Gold", 200 * p->level + (p->exp / 10)); - notice(s_GameServ, u, "4. HP Potions for %ld Gold", 230 * p->level + (p->exp / 10)); + notice(s_GameServ, u, "1. Healing Potions for %ld Gold", + 1000 * p->level * 4); + notice(s_GameServ, u, "2. Strength Potions for %ld Gold", + 2500 * p->level * 4); + notice(s_GameServ, u, "3. Defense Potions for %ld Gold", + 3000 * p->level * 4); + notice(s_GameServ, u, "4. HP Potions for %ld Gold", + 2000 * p->level * 4); notice(s_GameServ, u, "To buy a potion, type /msg %S TAVERN BUY #"); notice(s_GameServ, u, "Example: /msg %S TAVERN BUY 1 buys a healing potion!"); return; @@ -2524,7 +2532,7 @@ void do_tavern(char *u) switch(num) { case 1: - price = (100 * p->level) + (p->exp / 10); + price = (1000 * p->level * 4); if (p->gold >= price) { notice(s_GameServ, u, "One healing potion coming right up!"); @@ -2535,7 +2543,7 @@ void do_tavern(char *u) notice(s_GameServ, u, "You don't have enough gold!"); break; case 2: - price = (205 * p->level) + (p->exp / 10); + price = 2500 * p->level * 4; if (p->gold >= price) { notice(s_GameServ, u, "One strength boost coming right up!"); @@ -2546,7 +2554,7 @@ void do_tavern(char *u) notice(s_GameServ, u, "You don't have enough gold!"); break; case 3: - price = (200 * p->level) + (p->exp / 10); + price = 3000 * p->level * 4; if (p->gold >= price) { notice(s_GameServ, u, "One defense boost coming right up!"); @@ -2557,7 +2565,7 @@ void do_tavern(char *u) notice(s_GameServ, u, "You don't have enough gold!"); break; case 4: - price = (230 * p->level) + (p->exp / 10); + price = 3000 * p->level * 4; if (p->gold >= price) { notice(s_GameServ, u, "One HP Potion coming right up!"); @@ -3409,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