script.h pouch.h item.h level.h flags.h
do_fight.o: do_fight.cpp extern.h config.h options.h aClient.h player.h \
script.h flags.h
+do_heal.o: do_heal.cpp extern.h config.h options.h aClient.h player.h \
+ script.h flags.h
+do_help.o: do_help.cpp extern.h config.h options.h
+do_identify.o: do_identify.cpp extern.h config.h options.h aClient.h \
+ player.h script.h flags.h
+do_inventory.o: do_inventory.cpp extern.h config.h options.h aClient.h \
+ player.h script.h flags.h
+do_list.o: do_list.cpp extern.h config.h options.h player.h script.h \
+ aClient.h flags.h toplist.h
+do_refresh.o: do_refresh.cpp extern.h config.h options.h aClient.h \
+ player.h script.h flags.h
+do_register.o: do_register.cpp extern.h config.h options.h aClient.h \
+ player.h script.h flags.h pouch.h item.h level.h toplist.h
find.o: find.cpp extern.h config.h options.h item.h level.h player.h \
script.h
gameserv.o: gameserv.cpp aClient.h options.h player.h script.h config.h \
do_check.cpp \
do_equip.cpp \
do_fight.cpp \
+ do_heal.cpp \
+ do_help.cpp \
+ do_identify.cpp \
+ do_inventory.cpp \
+ do_list.cpp \
+ do_refresh.cpp \
+ do_register.cpp \
find.cpp \
gameserv.cpp \
hash.cpp \
--- /dev/null
+#include "extern.h"
+#include "aClient.h"
+#include "config.h"
+#include "flags.h"
+
+void do_heal(char *u)
+{
+ aClient *ni;
+ char *amount = strtok(NULL, " ");
+ int price, num;
+
+ if (!amount)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
+ return;
+ }
+ else if (!(ni = find(u)))
+ {
+ notice(s_GameServ, u, "Fatal error. Contact a(n) <S admin. buf: %s", strtok(NULL, ""));
+ return;
+ }
+ else if (isIgnore(ni))
+ {
+ #ifdef DEBUGMODE
+ log("Ignoring %s.", ni->getNick());
+ #endif
+ return;
+ }
+ else if (!is_playing(ni))
+ {
+ notice(s_GameServ, u, "You aren't playing!");
+ return;
+ }
+ else if (!isAlive(ni->stats))
+ {
+ notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing.");
+ return;
+ }
+ else if (is_fighting(ni))
+ {
+ notice(s_GameServ, u, "You can't heal in battle!");
+ return;
+ }
+ else if (ni->stats->getHP() >= ni->stats->getMaxHP())
+ {
+ notice(s_GameServ, u, "You don't need healing!");
+ return;
+ }
+
+ updateTS(ni->stats);
+ if (stricmp(amount, "ALL") == 0)
+ {
+ price = ni->stats->getLevel() * 3;
+ if (ni->stats->getGold() < (ni->stats->getMaxHP() - ni->stats->getHP()) * price)
+ {
+ notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
+ (long int)ni->stats->getGold()/price, price);
+ ni->stats->addHP(ni->stats->getGold() / price);
+ ni->stats->setGold(ni->stats->getGold() % price);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
+ "per point.", price);
+ notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
+ (ni->stats->getMaxHP() - ni->stats->getHP()),
+ (price * (ni->stats->getMaxHP() - ni->stats->getHP())) );
+ ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
+ ni->stats->healall();
+ }
+ }
+ else if (isstringnum(amount))
+ {
+ num = stringtoint(amount);
+ price = ni->stats->getLevel() * 3;
+ if (ni->stats->getGold() < price * num)
+ {
+ notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!",
+ (long int)ni->stats->getGold()/price);
+ }
+ else if (num <= ni->stats->getMaxHP() - ni->stats->getHP())
+ {
+ notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.",
+ num, price);
+ ni->stats->addHP(num);
+ ni->stats->subtractGold(num * price);
+ }
+ else if (num > ni->stats->getMaxHP() - ni->stats->getHP())
+ {
+ notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
+ "per point.", price);
+ notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!",
+ (ni->stats->getMaxHP() - ni->stats->getHP()));
+ ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
+ ni->stats->healall();
+ }
+ }
+ else if (amount[0] == '-')
+ notice(s_GameServ, u, "You trying to cheat?");
+ else
+ notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
+}
+
--- /dev/null
+#include "extern.h"
+
+void do_help(char *u)
+{
+ char *cmd = strtok(NULL, " ");
+
+ display_help(u, cmd);
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+
+void do_identify(char *u)
+{
+ char *password, *name;
+ aClient *user;
+ Player *p;
+ name = strtok(NULL, " ");
+ password = strtok(NULL, " ");
+ if (!password || !name)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg <S IDENTIFY NAME PASSWORD");
+ }
+ else if (!(user = find(u)))
+ {
+ notice(s_GameServ, u, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL, ""));
+ log("Error: aClient not found: %s", u);
+ }
+ else if (isIgnore(user))
+ {
+#ifdef DEBUGMODE
+ log("Ignoring %s.", user->getNick());
+#endif
+ return;
+ }
+ else if (!(p = findplayer(name)))
+ {
+ notice(s_GameServ, u, "Player %s not found", name);
+ }
+ else if (is_playing(user))
+ {
+ notice(s_GameServ, u, "You are already playing!");
+ }
+ else if (is_playing(p->getClient()) && !isAdmin(user))
+ {
+ notice(s_GameServ, u, "That player has already identified.");
+ }
+ else if (!check_password(name, password) && !isAdmin(user))
+ {
+ notice(s_GameServ, u, "Password incorrect");
+ }
+ else
+ {
+ list<Player*>::iterator iter;
+ unsigned long hv = iHASH((unsigned char *) p->getName().c_str());
+
+ iter = find(players[hv].begin(), players[hv].end(), p);
+
+ if (iter == players[hv].end())
+ {
+ notice(s_GameServ, u, "Fatal error. Contact <S Admin. Buf: %s",
+ strtok(NULL, ""));
+ return;
+ }
+ // Make sure the other user is logged out
+ logout(p->getClient());
+
+ user->stats = p;
+ p->setClient(user);
+ updateTS(p);
+
+
+#ifdef DEBUGMODE
+ log("Player %s IRC: %s Identified", user->stats->getName().c_str(),
+ user->getNick());
+#endif
+ //Set the playing flag
+ setPlaying(user);
+
+ // Update the last login time
+ user->stats->lastlogin = time(NULL);
+
+ notice(s_GameServ, u, "Password Accepted. Identified.");
+ showNews(u, todaysnews);
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "flags.h"
+
+void do_inventory(char *u)
+{
+ aClient *user;
+
+ if (!(user = find(u)))
+ {
+ notice(s_GameServ, u, "Fatal Error. Contact a <S admin!");
+ return;
+ }
+ else if (isIgnore(user))
+ {
+#ifdef DEBUGMODE
+ log("Ignoring %s.", user->getNick());
+#endif
+ return;
+ }
+ else if (!is_playing(user))
+ {
+ notice(s_GameServ, u, "You must be playing to check your inventory!");
+ return;
+ }
+ if (!is_fighting(user))
+ updateTS(user->stats);
+ showinventory(user->stats, user);
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "player.h"
+#include "aClient.h"
+#include "flags.h"
+#include "toplist.h"
+
+void do_list(char *u)
+{
+ aClient *user;
+ Player *p;
+ char *cmd = strtok(NULL, " ");
+
+ if (!(user = find(u)))
+ {
+ log("Fatal Error: Couldn't find %s in the client list", u);
+ return;
+ }
+ else if (isIgnore(user))
+ {
+#ifdef DEBUGMODE
+ log("Ignoring %s. Command LIST", user->getNick());
+#endif
+ return;
+ }
+
+ if (cmd == NULL || stricmp(cmd, "TOP") == 0)
+ {
+ list<PlayerWrapper>::iterator iter;
+ bool header = false;
+
+ if (myToplist.empty())
+ {
+ notice(s_GameServ, u, "There are no players");
+ return;
+ }
+ myToplist.sort();
+ myToplist.reverse();
+
+ iter = myToplist.begin();
+
+ while (iter != myToplist.end())
+ {
+ if (!header)
+ {
+ notice(s_GameServ, u, "Top Players");
+ header = true;
+
+ }
+ notice(s_GameServ, u, "Level: %2d Exp: %10d Name: %s",
+ (*iter).getLevel(), (*iter).getExp(), (*iter).getName().c_str());
+ iter++;
+ }
+ }
+ else
+ {
+
+ list<Player*>::iterator iter;
+ bool header = false;
+
+ for (unsigned long x = 0; x < U_TABLE_SIZE; x++)
+ {
+ iter = players[x].begin();
+ if (!players[x].empty())
+ {
+ while(iter != players[x].end())
+ {
+ p = (*iter);
+ if (cmd || is_playing(p->getClient()))
+ {
+ if (!header)
+ {
+ notice(s_GameServ, u, "Players:");
+ header = true;
+ }
+ #ifdef P10
+ notice(s_GameServ, u, "IRC: %s Game: %s", (p->getClient() ? p->getClient()->getRealNick() : "Not Playing"),
+ p->getName().c_str());
+ #else
+ notice(s_GameServ, u, "IRC: %s Game: %s", (p->getClient() ? p->getClient()->getNick() : "Not Playing"),
+ p->getName().c_str());
+ #endif
+ }
+ iter++;
+ }
+ }
+ }
+ if (!header)
+ notice(s_GameServ, u, "No one is playing");
+ else
+ notice(s_GameServ, u, "End of List");
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+
+void do_refresh(char *u)
+{
+ char *name = strtok(NULL, " ");
+ aClient *user;
+ Player *p;
+
+ if (!(user = find(u)))
+ {
+ notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
+ log("Error: aClient not found: %s", u);
+ return;
+ }
+ else if (isIgnore(user))
+ {
+#ifdef DEBUGMODE
+ log("Ignoring %s.", user->getNick());
+#endif
+ return;
+ }
+ else if (!isAdmin(user))
+ {
+ notice(s_GameServ, u, "You must be a <S admin to use this command!");
+ return;
+ }
+ if (!name)
+ {
+ notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}");
+ return;
+ }
+ else if (stricmp(name, "ALL") == 0)
+ {
+ notice(s_GameServ, u, "Refreshing everyone's stats!");
+ refreshall();
+ }
+ else if ((p = findplayer(name)))
+ {
+ notice(s_GameServ, u, "Refreshing %s.", p->getName().c_str());
+ refresh(p);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Player %s not found.", name);
+ return;
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+#include "pouch.h"
+#include "item.h"
+#include "toplist.h"
+
+void do_register(char *u)
+{
+ char *password, *name;
+ aClient *user;
+ Player *p;
+ name = strtok(NULL, " ");
+ password = strtok(NULL, " ");
+
+ if (!name)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
+ }
+ else if (stricmp(name, s_GameServ) == 0)
+ {
+ notice(s_GameServ, u, "You can't use <S as a name!");
+ }
+ else if (!password)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
+ }
+ else if (strlen(name) > maxnicklen)
+ {
+ notice(s_GameServ, u, "Name too long. Maximum length: %d", maxnicklen);
+ }
+ else if (!alphaNumeric(name))
+ {
+ notice(s_GameServ, u, "That is not a valid name. Please use only AlphaNumeric (A-Z, 0-9) characters!");
+ }
+ else if ((p = findplayer(name)))
+ {
+ notice(s_GameServ, u, "%s is already registered!", name);
+ notice(s_GameServ, u, "Choose another name!");
+ }
+ else if (!(user = find(u)))
+ {
+ log("Fatal Error: Couldn't find %s in the clients list", u);
+ }
+ else if (isIgnore(user))
+ {
+#ifdef DEBUGMODE
+ log("Ignoring %s.", user->getNick());
+#endif
+ }
+ else
+ {
+ if (!is_playing(user))
+ {
+ item *tempItem;
+ unsigned long hv = iHASH((unsigned char *) name);
+
+ // First create the Player
+ user->stats = new Player();
+
+ // Set the backwards pointer
+ user->stats->setClient(user);
+
+ // Set the player's password
+ user->stats->setPassword(password);
+
+ // Set the player's name
+ user->stats->setName(name);
+
+ // Make sure they have a proper time stamp
+ updateTS(user->stats);
+
+ // Update the last login time
+ user->stats->lastlogin = time(NULL);
+
+ // Send notification of success
+ notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->getName().c_str(), password);
+ notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!");
+
+ // Log the new player
+ log("Nickname %s registered player %s.", u, user->stats->getName().c_str());
+
+ // Log the player in
+ setPlaying(user);
+
+ // Start the player at the beginning
+ reset(user->stats);
+
+ // Add the stick and clothes
+ tempItem = findItemByID(3001);
+ user->stats->inventory->addItem((*Items.begin()))->use(user->stats); // Add the stick
+ user->stats->inventory->addItem(tempItem)->use(user->stats); // Add Clothes
+
+ // Add the player to the list
+ players[hv].push_back(user->stats);
+
+ // Attempt to add the player to the top list
+ // The class takes care of pruning the user out if they don't deserve to be in the list
+ myToplist.insertPlayer(user->stats);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Already registered. Contact a <S admin for help.");
+ }
+ }
+}
E void do_fight(char *u);
E void do_forest(char *u);
E void do_heal(char *u);
-E void do_identify(char *u);
E void do_invenory(char *u);
E void do_list(char *u);
E void do_logout(char *u);
bool shuttingdown;
-
-void do_heal(char *u);
-void do_help(char *u);
-void do_identify(char *u);
-void do_inventory(char *u);
-void do_refresh(char *u);
-void do_register(char *u);
-void do_list(char *u);
void do_logout(char *u);
void do_master(char *u);
void do_dragon(char *u);
-void do_list(char *u)
-{
- aClient *user;
- Player *p;
- char *cmd = strtok(NULL, " ");
-
- if (!(user = find(u)))
- {
- log("Fatal Error: Couldn't find %s in the client list", u);
- return;
- }
- else if (isIgnore(user))
- {
-#ifdef DEBUGMODE
- log("Ignoring %s. Command LIST", user->getNick());
-#endif
- return;
- }
-
- if (cmd == NULL || stricmp(cmd, "TOP") == 0)
- {
- list<PlayerWrapper>::iterator iter;
- bool header = false;
-
- if (myToplist.empty())
- {
- notice(s_GameServ, u, "There are no players");
- return;
- }
- myToplist.sort();
- myToplist.reverse();
-
- iter = myToplist.begin();
-
- while (iter != myToplist.end())
- {
- if (!header)
- {
- notice(s_GameServ, u, "Top Players");
- header = true;
-
- }
- notice(s_GameServ, u, "Level: %2d Exp: %10d Name: %s",
- (*iter).getLevel(), (*iter).getExp(), (*iter).getName().c_str());
- iter++;
- }
- }
- else
- {
-
- list<Player*>::iterator iter;
- bool header = false;
-
- for (unsigned long x = 0; x < U_TABLE_SIZE; x++)
- {
- iter = players[x].begin();
- if (!players[x].empty())
- {
- while(iter != players[x].end())
- {
- p = (*iter);
- if (cmd || is_playing(p->getClient()))
- {
- if (!header)
- {
- notice(s_GameServ, u, "Players:");
- header = true;
- }
- #ifdef P10
- notice(s_GameServ, u, "IRC: %s Game: %s", (p->getClient() ? p->getClient()->getRealNick() : "Not Playing"),
- p->getName().c_str());
- #else
- notice(s_GameServ, u, "IRC: %s Game: %s", (p->getClient() ? p->getClient()->getNick() : "Not Playing"),
- p->getName().c_str());
- #endif
- }
- iter++;
- }
- }
- }
- if (!header)
- notice(s_GameServ, u, "No one is playing");
- else
- notice(s_GameServ, u, "End of List");
- }
-}
void do_set(char *u)
{
}
}
-void do_register(char *u)
-{
- char *password, *name;
- aClient *user;
- Player *p;
- name = strtok(NULL, " ");
- password = strtok(NULL, " ");
-
- if (!name)
- {
- notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
- }
- else if (stricmp(name, s_GameServ) == 0)
- {
- notice(s_GameServ, u, "You can't use <S as a name!");
- }
- else if (!password)
- {
- notice(s_GameServ, u, "SYNTAX: /msg <S REGISTER NAME PASSWORD");
- }
- else if (strlen(name) > maxnicklen)
- {
- notice(s_GameServ, u, "Name too long. Maximum length: %d", maxnicklen);
- }
- else if (!alphaNumeric(name))
- {
- notice(s_GameServ, u, "That is not a valid name. Please use only AlphaNumeric (A-Z, 0-9) characters!");
- }
- else if ((p = findplayer(name)))
- {
- notice(s_GameServ, u, "%s is already registered!", name);
- notice(s_GameServ, u, "Choose another name!");
- }
- else if (!(user = find(u)))
- {
- log("Fatal Error: Couldn't find %s in the clients list", u);
- }
- else if (isIgnore(user))
- {
-#ifdef DEBUGMODE
- log("Ignoring %s.", user->getNick());
-#endif
- }
- else
- {
- if (!is_playing(user))
- {
- item *tempItem;
- unsigned long hv = iHASH((unsigned char *) name);
-
- // First create the Player
- user->stats = new Player();
-
- // Set the backwards pointer
- user->stats->setClient(user);
-
- // Set the player's password
- user->stats->setPassword(password);
-
- // Set the player's name
- user->stats->setName(name);
-
- // Make sure they have a proper time stamp
- updateTS(user->stats);
-
- // Update the last login time
- user->stats->lastlogin = time(NULL);
-
- // Send notification of success
- notice(s_GameServ, u, "Player %s registered with password %s.", user->stats->getName().c_str(), password);
- notice(s_GameServ, u, "Write this password down. If you lose it, there is no way to retrieve it!");
-
- // Log the new player
- log("Nickname %s registered player %s.", u, user->stats->getName().c_str());
-
- // Log the player in
- setPlaying(user);
-
- // Start the player at the beginning
- reset(user->stats);
-
- // Add the stick and clothes
- tempItem = findItemByID(3001);
- user->stats->inventory->addItem((*Items.begin()))->use(user->stats); // Add the stick
- user->stats->inventory->addItem(tempItem)->use(user->stats); // Add Clothes
-
- // Add the player to the list
- players[hv].push_back(user->stats);
-
- // Attempt to add the player to the top list
- // The class takes care of pruning the user out if they don't deserve to be in the list
- myToplist.insertPlayer(user->stats);
- }
- else
- {
- notice(s_GameServ, u, "Already registered. Contact a <S admin for help.");
- }
- }
-}
-
-void do_identify(char *u)
-{
- char *password, *name;
- aClient *user;
- Player *p;
- name = strtok(NULL, " ");
- password = strtok(NULL, " ");
- if (!password || !name)
- {
- notice(s_GameServ, u, "SYNTAX: /msg <S IDENTIFY NAME PASSWORD");
- }
- else if (!(user = find(u)))
- {
- notice(s_GameServ, u, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL, ""));
- log("Error: aClient not found: %s", u);
- }
- else if (isIgnore(user))
- {
-#ifdef DEBUGMODE
- log("Ignoring %s.", user->getNick());
-#endif
- return;
- }
- else if (!(p = findplayer(name)))
- {
- notice(s_GameServ, u, "Player %s not found", name);
- }
- else if (is_playing(user))
- {
- notice(s_GameServ, u, "You are already playing!");
- }
- else if (is_playing(p->getClient()) && !isAdmin(user))
- {
- notice(s_GameServ, u, "That player has already identified.");
- }
- else if (!check_password(name, password) && !isAdmin(user))
- {
- notice(s_GameServ, u, "Password incorrect");
- }
- else
- {
- list<Player*>::iterator iter;
- unsigned long hv = iHASH((unsigned char *) p->getName().c_str());
-
- iter = find(players[hv].begin(), players[hv].end(), p);
-
- if (iter == players[hv].end())
- {
- notice(s_GameServ, u, "Fatal error. Contact <S Admin. Buf: %s",
- strtok(NULL, ""));
- return;
- }
- // Make sure the other user is logged out
- logout(p->getClient());
-
- user->stats = p;
- p->setClient(user);
- updateTS(p);
-
-
-#ifdef DEBUGMODE
- log("Player %s IRC: %s Identified", user->stats->getName().c_str(),
- user->getNick());
-#endif
- //Set the playing flag
- setPlaying(user);
-
- // Update the last login time
- user->stats->lastlogin = time(NULL);
-
- notice(s_GameServ, u, "Password Accepted. Identified.");
- showNews(u, todaysnews);
- }
-}
-
void do_stats(char *u)
{
char *nick;
}
}
-
-void do_heal(char *u)
-{
- aClient *ni;
- char *amount = strtok(NULL, " ");
- int price, num;
-
- if (!amount)
- {
- notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
- return;
- }
- else if (!(ni = find(u)))
- {
- notice(s_GameServ, u, "Fatal error. Contact a(n) <S admin. buf: %s", strtok(NULL, ""));
- return;
- }
- else if (isIgnore(ni))
- {
- #ifdef DEBUGMODE
- log("Ignoring %s.", ni->getNick());
- #endif
- return;
- }
- else if (!is_playing(ni))
- {
- notice(s_GameServ, u, "You aren't playing!");
- return;
- }
- else if (!isAlive(ni->stats))
- {
- notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing.");
- return;
- }
- else if (is_fighting(ni))
- {
- notice(s_GameServ, u, "You can't heal in battle!");
- return;
- }
- else if (ni->stats->getHP() >= ni->stats->getMaxHP())
- {
- notice(s_GameServ, u, "You don't need healing!");
- return;
- }
-
- updateTS(ni->stats);
- if (stricmp(amount, "ALL") == 0)
- {
- price = ni->stats->getLevel() * 3;
- if (ni->stats->getGold() < (ni->stats->getMaxHP() - ni->stats->getHP()) * price)
- {
- notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
- (long int)ni->stats->getGold()/price, price);
- ni->stats->addHP(ni->stats->getGold() / price);
- ni->stats->setGold(ni->stats->getGold() % price);
- }
- else
- {
- notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
- "per point.", price);
- notice(s_GameServ, u, "\ 2%d\ 2 points healed for \ 2%ld\ 2 gold. HP at MAX!",
- (ni->stats->getMaxHP() - ni->stats->getHP()),
- (price * (ni->stats->getMaxHP() - ni->stats->getHP())) );
- ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
- ni->stats->healall();
- }
- }
- else if (isstringnum(amount))
- {
- num = stringtoint(amount);
- price = ni->stats->getLevel() * 3;
- if (ni->stats->getGold() < price * num)
- {
- notice(s_GameServ, u, "You only have enough gold to heal \ 2%d\ 2 points!",
- (long int)ni->stats->getGold()/price);
- }
- else if (num <= ni->stats->getMaxHP() - ni->stats->getHP())
- {
- notice(s_GameServ, u, "Healing \ 2%d\ 2 points at \ 2%d\ 2 gold per point.",
- num, price);
- ni->stats->addHP(num);
- ni->stats->subtractGold(num * price);
- }
- else if (num > ni->stats->getMaxHP() - ni->stats->getHP())
- {
- notice(s_GameServ, u, "Healing all possible points at \ 2%d\ 2 gold "\
- "per point.", price);
- notice(s_GameServ, u, "\ 2%d\ 2 points healed. HP at MAX!",
- (ni->stats->getMaxHP() - ni->stats->getHP()));
- ni->stats->subtractGold(price * (ni->stats->getMaxHP() - ni->stats->getHP()));
- ni->stats->healall();
- }
- }
- else if (amount[0] == '-')
- notice(s_GameServ, u, "You trying to cheat?");
- else
- notice(s_GameServ, u, "SYNTAX: /msg <S HEAL {ALL | #}");
-}
-
-
-
-
void do_store(char *u)
{
list<item*>::iterator item_iterator;
return;
}
}
-void do_inventory(char *u)
-{
- aClient *user;
-
- if (!(user = find(u)))
- {
- notice(s_GameServ, u, "Fatal Error. Contact a <S admin!");
- return;
- }
- else if (isIgnore(user))
- {
-#ifdef DEBUGMODE
- log("Ignoring %s.", user->getNick());
-#endif
- return;
- }
- else if (!is_playing(user))
- {
- notice(s_GameServ, u, "You must be playing to check your inventory!");
- return;
- }
- if (!is_fighting(user))
- updateTS(user->stats);
- showinventory(user->stats, user);
-}
void do_tavern(char *u)
}
}
-void do_help(char *u)
-{
- char *cmd = strtok(NULL, " ");
-
- display_help(u, cmd);
-}
clearMaster(p);
}
-void do_refresh(char *u)
-{
- char *name = strtok(NULL, " ");
- aClient *user;
- Player *p;
-
- if (!(user = find(u)))
- {
- notice(s_GameServ, u, "Error: aClient not found. Contact a <S admin");
- log("Error: aClient not found: %s", u);
- return;
- }
- else if (isIgnore(user))
- {
-#ifdef DEBUGMODE
- log("Ignoring %s.", user->getNick());
-#endif
- return;
- }
- else if (!isAdmin(user))
- {
- notice(s_GameServ, u, "You must be a <S admin to use this command!");
- return;
- }
- if (!name)
- {
- notice(s_GameServ, u, "SYNTAX: REFRESH {ALL | NICK}");
- return;
- }
- else if (stricmp(name, "ALL") == 0)
- {
- notice(s_GameServ, u, "Refreshing everyone's stats!");
- refreshall();
- }
- else if ((p = findplayer(name)))
- {
- notice(s_GameServ, u, "Refreshing %s.", p->getName().c_str());
- refresh(p);
- }
- else
- {
- notice(s_GameServ, u, "Player %s not found.", name);
- return;
- }
-}
+
void resetall()