X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/fa3764539889da15509933424e98cc73c91b2388..03e0a9d83003fd07ae25f946053ec10989bfd132:/gameserv/gameserv.cpp diff --git a/gameserv/gameserv.cpp b/gameserv/gameserv.cpp index 93da1eb..485937c 100644 --- a/gameserv/gameserv.cpp +++ b/gameserv/gameserv.cpp @@ -24,6 +24,7 @@ using std::ofstream; List players; Monster *monsters[LEVELS][MONSTERS]; // Monsters per level. Total = MONSTERS * LEVELS +Monster boss; // The boss monster Monster *masters[LEVELS]; // A master for each level @@ -125,8 +126,8 @@ char *armors[WNA] = { "Nothing", "Clothes", "Leather Vest", "Chain Mail", "Plate int prices[WNA - 1] = {200, 1000, 3000, 10000, 30000, 100000, 150000, 200000, 400000, 1000000, 4000000, 10000000, 40000000, 100000000, 400000000}; -int webonus[WNA] = {0, 10, 15, 25, 35, 45, 65, 85, 125, 185, 255, 355, 505, 805, 1205, 1805}; -int arbonus[WNA] = {0, 1, 3, 10, 15, 25, 35, 50, 75, 100, 150, 225, 300, 400, 600, 1000}; +int webonus[WNA] = {1, 10, 15, 25, 35, 45, 65, 85, 125, 185, 255, 355, 505, 805, 1205, 1805}; +int arbonus[WNA] = {1, 2, 4, 10, 15, 25, 35, 50, 75, 100, 150, 225, 300, 400, 600, 1000}; int hpbonus[11] = {10, 15, 20, 30, 50, 75, 125, 185, 250, 350, 550}; int strbonus[11] = {5, 7, 10, 12, 20, 35, 50, 75, 110, 150, 200}; @@ -159,7 +160,7 @@ void gameserv(char *source, char *buf) { refreshall(); day = curday; - save_day(); + save_day(); // here i come to save the day! } if (strnicmp(cmd, "\1PING", 6) == 0) @@ -285,6 +286,7 @@ void gameserv(char *source, char *buf) else display_help(source, cmd); } + #ifdef DEBUGMODE } else if (stricmp(cmd, "RAW") == 0) { aClient *user; @@ -302,6 +304,7 @@ void gameserv(char *source, char *buf) char *rest = strtok(NULL, ""); raw("%s", rest); } + #endif } else { notice(s_GameServ, source, "Unknown command \002%s\002. Type /msg %S \002HELP\002 to get a list of commands.", cmd); } @@ -535,7 +538,6 @@ void do_list(char *u) notice(s_GameServ, u, "People Playing:"); while(temp) { - #ifdef P10 notice(s_GameServ, u, "IRC: %s Game: %s", temp->getData()->getRealNick(), temp->getData()->stats->name); @@ -574,6 +576,11 @@ void do_register(char *u) { notice(s_GameServ, u, "SYNTAX: /msg %S REGISTER NAME PASSWORD"); } + else if ((user = findplayer(name))) + { + notice(s_GameServ, u, "%s is already registered!", name); + notice(s_GameServ, u, "Choose another name!"); + } else if ((user = find(u))) { p = findplayer(u); @@ -613,18 +620,17 @@ void do_identify(char *u) } else if (!(p = findplayer(name)) || !p->stats) notice(s_GameServ, u, "Player %s not found", name); + else if (p->stats->user != NULL && !isAdmin(user)) + { + notice(s_GameServ, u, "That player has already identified."); + return; + } else if (!check_password(name, password) && !isAdmin(user)) { notice(s_GameServ, u, "Password incorrect"); } - else - { - if (p->stats->user && !isAdmin(user)) - { - notice(s_GameServ, u, "That player has already identified."); - return; - } - if (!user->stats) + else { + if (!user->stats) { ListNode *temp; temp = players.Find(p); @@ -972,14 +978,14 @@ void do_fight(char *u) notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, "")); return; } - else if (!(battle = findbyrealnick(nick))) + else if (!is_playing(ni)) { - notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick); + notice(s_GameServ, u, "You are not playing!"); return; } - else if (!is_playing(ni)) + else if (!(battle = findplayer(nick))) { - notice(s_GameServ, u, "You are not playing!"); + notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick); return; } /* @@ -1000,6 +1006,11 @@ void do_fight(char *u) notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!"); return; } + else if (!isAlive(battle->stats)) + { + notice(s_GameServ, u, "They are dead. Cannot fight dead players!"); + return; + } else if (player_fight(battle)) { notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name, battle->stats->battle->stats->name); @@ -1010,6 +1021,22 @@ void do_fight(char *u) notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->name, battle->stats->fight->name); return; } + else if (ni->stats->level - battle->stats->level > maxbfightdistance) + { + // You can't fight someone below you by more than X level(s) + // level 12 can fight level (12 - X) but not < (12 - X) + notice(s_GameServ, u, "You may not fight %s. You're too strong!", + battle->stats->level); + return; + } + else if (battle->stats->level - ni->stats->level > maxafightdistance) + { + // You can't fight someone above you by more than X level(S) + // level 1 can fight level (1 + X), but not > (1 + X) + notice(s_GameServ, u, "%s, do you really have a death wish? Try the forest you "\ + "weakling!", ni->stats->name); + return; + } else if (is_playing(ni) && is_playing(battle) && stricmp(ni->stats->name, battle->stats->name) != 0) { // Set your battle pointer to the other player @@ -1025,7 +1052,8 @@ void do_fight(char *u) // Initiate Battle sequence! notice(s_GameServ, u, "You challenge %s to an online duel!", battle->stats->name); notice(s_GameServ, battle->getNick(), "%s has challenged you to an online duel!", ni->stats->name); - notice(s_GameServ, battle->getNick(), "%s gets to go first because he initiated!", ni->stats->name); + notice(s_GameServ, battle->getNick(), "%s gets to go first "\ + "because they initiated!", ni->stats->name); notice(s_GameServ, battle->getNick(), "Please wait while %s decides what to do.", ni->stats->name); display_players(u); } @@ -1130,6 +1158,12 @@ void do_run(char *u) return; } + else if (!is_playing(user)) + { + notice(s_GameServ, u, "You must be playing to run!"); + return; + } + p = user->stats; if (p->battle) @@ -1802,7 +1836,7 @@ int load_gs_dbase() tempname = strtok(NULL, " "); if (tempname) p->inventory.setHP(stringtoint(tempname)); - + temp->stats->user = NULL; players.insertAtBack(temp); delete temp; }