script.h flags.h
do_attack.o: do_attack.cpp aClient.h options.h player.h script.h extern.h \
config.h flags.h level.h item.h
+do_bank.o: do_bank.cpp extern.h config.h options.h aClient.h player.h \
+ script.h flags.h
+do_check.o: do_check.cpp extern.h config.h options.h flags.h
+do_equip.o: do_equip.cpp extern.h config.h options.h aClient.h player.h \
+ 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
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 \
c_forest.cpp \
do_admin.cpp \
do_attack.cpp \
+ do_bank.cpp \
+ do_check.cpp \
+ do_equip.cpp \
+ do_fight.cpp \
find.cpp \
gameserv.cpp \
hash.cpp \
--- /dev/null
+#include "extern.h"
+#include "aClient.h"
+#include "player.h"
+#include "flags.h"
+
+
+void do_bank(char *u)
+{
+ char *cmd = strtok(NULL, " ");
+ char *amount = strtok(NULL, " ");
+ char *nick = strtok(NULL, " ");
+
+ aClient *user;
+ Player *p;
+
+ if (!cmd || (!amount && stricmp(cmd, "BALANCE") != 0) || (stricmp(cmd, "TRANSFER") == 0 && !nick))
+ {
+ notice(s_GameServ, u, "BANK {WITHDRAW | DEPOSIT} {ALL | AMOUNT}");
+ notice (s_GameServ, u, "BANK BALANCE");
+ return;
+ }
+ else if (!(user = find(u)))
+ {
+ notice(s_GameServ, u, "Fatal Error. Couldn't find your aClient. Contact a(n) <S "\
+ " admin for help");
+ log("Fatal Error. Couldn't find %s while executing do_bank()", u);
+ 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 use the bank!");
+ return;
+ }
+ else if (is_fighting(user))
+ {
+ notice(s_GameServ, u, "You can't go to the bank during a fight!");
+ return;
+ }
+ updateTS(user->stats);
+ if (stricmp(cmd, "BALANCE") == 0)
+ {
+ showBankBalance(u);
+ return;
+ }
+ else if (!isAlive(user->stats))
+ {
+ notice(s_GameServ, u, "You are dead. We don't accept gold from dead folk! Wait 'til tomorrow!");
+ return;
+ }
+ else if (!isstringnum(amount) && stricmp(amount, "ALL") != 0)
+ {
+ 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)
+ {
+ if (p->getBank() == 2000000000)
+ {
+ notice(s_GameServ, u, "Your bank account is full, sire!");
+ return;
+ }
+ else if (stricmp(amount, "ALL") == 0)
+ {
+ if (2000000000 - p->getBank() < p->getGold())
+ {
+ notice(s_GameServ, u, "You don't have enough room for all of your gold.");
+ notice(s_GameServ, u, "Depositing %ld gold into your account", (2000000000 - p->getBank()));
+ p->subtractGold((2000000000 - p->getBank()));
+ p->setBank(2000000000);
+ showBankBalance(u);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Depositing %ld gold into your account!", p->getGold());
+ p->addBank(p->getGold());
+ p->setGold(0);
+ showBankBalance(u);
+ }
+ }
+ else if (stringtoint(amount) > p->getGold())
+ {
+ notice(s_GameServ, u, "Sire, you only have %ld gold!", p->getGold());
+ showBankBalance(u);
+ return;
+ }
+ else
+ {
+ if (2000000000 - p->getBank() < stringtoint(amount))
+ {
+ notice(s_GameServ, u, "You don't have room in your account for that much.");
+ notice(s_GameServ, u, "Capping off your account with %ld gold!", (2000000000 - p->getBank()));
+ p->subtractGold((2000000000 - p->getBank()));
+ p->setBank(2000000000);
+ showBankBalance(u);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Depositing %d gold into your account!", stringtoint(amount));
+ p->addBank(stringtoint(amount));
+ p->subtractGold(stringtoint(amount));
+ showBankBalance(u);
+ }
+ }
+ }
+ else if (stricmp(cmd, "WITHDRAW") == 0)
+ {
+ if (p->getGold() == 2000000000)
+ {
+ notice(s_GameServ, u, "You cannot carry any more gold, sire!");
+ showBankBalance(u);
+ return;
+ }
+ else if (stricmp(amount, "ALL") == 0)
+ {
+ if (2000000000 - p->getGold() < p->getBank())
+ {
+ notice(s_GameServ, u, "You don't have enough room to carry all that gold.");
+ notice(s_GameServ, u, "Withdrawing %ld gold from your account", (2000000000 - p->getGold()));
+ p->subtractBank((2000000000 - p->getGold()));
+ p->setGold(2000000000);
+ showBankBalance(u);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Withdrawing %ld gold from your account!", p->getBank());
+ p->addGold(p->getBank());
+ p->setBank(0);
+ showBankBalance(u);
+ }
+ }
+ else if (stringtoint(amount) > p->getBank())
+ {
+ notice(s_GameServ, u, "Sire, you only have %ld gold in the bank!", p->getBank());
+ showBankBalance(u);
+ return;
+ }
+ else
+ {
+ if (2000000000 - p->getGold() < stringtoint(amount))
+ {
+ notice(s_GameServ, u, "You don't enough have room to carry that much gold!");
+ notice(s_GameServ, u, "You fill your pockets with %ld gold!",
+ (2000000000 - p->getGold()));
+ p->subtractBank((2000000000 - p->getGold()));
+ p->setGold(2000000000);
+ showBankBalance(u);
+ }
+ else
+ {
+ notice(s_GameServ, u, "Withdrawing %d gold from your account!", stringtoint(amount));
+ p->addGold(stringtoint(amount));
+ p->subtractBank(stringtoint(amount));
+ showBankBalance(u);
+ }
+ }
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "flags.h"
+
+void do_check(char *u)
+{
+ int days, hours, minutes, seconds;
+ long complete;
+ complete = (lastrefresh + refreshperiod) - time(NULL);
+ days = complete / 86400;
+ hours = (complete % 86400) / 3600;
+ minutes = (complete % 86400) % 3600 / 60;
+ seconds = (complete % 86400) % 3600 % 60;
+
+ notice(s_GameServ, u, "Time left to next refresh: %dd %dh %dm %ds",
+ days, hours, minutes, seconds);
+
+ if (isRolloverForestFights())
+ {
+ complete = (lastrollover + rolloverperiod) - time(NULL);
+
+ days = complete / 86400;
+ hours = (complete % 86400) / 3600;
+ minutes = (complete % 86400) % 3600 / 60;
+ seconds = (complete % 86400) % 3600 % 60;
+
+ notice(s_GameServ, u, "Time left to next rollover: %dd %dh %dm %ds",
+ days, hours, minutes, seconds);
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "config.h"
+#include "aClient.h"
+#include "pouch.h"
+#include "item.h"
+#include "flags.h"
+
+void do_equip(char *u)
+{
+ aClient *user;
+ pouch *p;
+ itemContainer *equip;
+ int id;
+
+ char *item = strtok(NULL, " ");
+
+ if (!item || int(item[0]) < 48 || int(item[0] > 57))
+ {
+ notice(s_GameServ, u, "SYNTAX: EQUIP ####");
+ notice(s_GameServ, u, "Type /msg <S HELP EQUIP for more information.");
+ return;
+ }
+ else if (!(user = find(u)))
+ {
+ notice(s_GameServ, u, "Fatal error in do_equip. Contact a(n) <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 equip weapons and armor!");
+ return;
+ }
+ id = stringtoint(item);
+ if (!is_fighting(user))
+ updateTS(user->stats);
+ p = user->stats->inventory;
+
+
+ if (!(equip = p->Find(id)))
+ {
+ if (!p->isEmpty())
+ {
+ notice(s_GameServ, u, "You aren't carrying that item!");
+ }
+ showinventory(user->stats, user);
+ }
+ else if (equip->getItem()->getType() != ARMOR && equip->getItem()->getType() != WEAPON)
+ {
+ notice(s_GameServ, u, "You can't use %s like that. Try /msg <S use", equip->getItem()->getName().c_str());
+ }
+ else
+ {
+ // Use the item
+ notice(s_GameServ, u, "You equip %s.", equip->getItem()->getName().c_str());
+ equip->use(user->stats);
+ }
+}
--- /dev/null
+#include "extern.h"
+#include "aClient.h"
+#include "player.h"
+#include "config.h"
+#include "flags.h"
+
+void do_fight(char *u)
+{
+ aClient *ni;
+ Player *battle;
+
+ char *nick = strtok(NULL, " ");
+
+ if (!nick)
+ {
+ notice(s_GameServ, u, "SYNTAX: /msg <S FIGHT PLAYER");
+ 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 are not playing!");
+ return;
+ }
+
+ updateTS(ni->stats);
+
+ if (ni->stats->getPlayerFights() <= 0)
+ {
+ ni->stats->setPlayerFights(0); // just to be safe
+ notice(s_GameServ, u, "You are out of player fights for the "\
+ "day. You have to wait until tomorrow!");
+ }
+ else if (!(battle = findplayer(nick)))
+ {
+ notice(s_GameServ, u, "Player %s not found!", nick);
+ }
+ else if (!isAlive(ni->stats))
+ {
+ notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!");
+ }
+ else if (!is_playing(battle->getClient()))
+ {
+ notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick);
+ }
+
+ /* offline fighting not available yet
+ else if (!(fight = finduser(nick)))
+ {
+ ni->stats->battle = battle;
+ battle->battle = ni;
+ setYourTurn(ni->stats);
+ clearYourTurn(battle->stats);
+
+ notice(s_GameServ, u, "You decide to fight %s while they're "\
+ "not in the realm!",
+ battle->stats->name.c_str());
+ display_players(u);
+ }
+ */
+ else if (stricmp(ni->stats->getName().c_str(), battle->getName().c_str()) == 0)
+ {
+ notice(s_GameServ, u, "Are you trying to commit suicide!?");
+ }
+ else if (!isAlive(battle))
+ {
+ notice(s_GameServ, u, "They are dead. Cannot fight dead players!");
+ }
+ else if (player_fight(battle->getClient()))
+ {
+ notice(s_GameServ, u, "%s is fighting %s already!", battle->getName().c_str(), battle->getBattle()->stats->getName().c_str());
+ }
+ else if (master_fight(battle->getClient()))
+ {
+ notice(s_GameServ, u, "%s is fighting their master!", battle->getName().c_str());
+ }
+ else if (is_fighting(battle->getClient()))
+ {
+ notice(s_GameServ, u, "%s is fighting %s already!", battle->getName().c_str(), battle->getMonster()->name.c_str());
+ }
+ else if (!isAdmin(ni) && isFairFights() && (ni->stats->getStrength()/2 - battle->getDefense()) > battle->getHP())
+ {
+ notice(s_GameServ, u, "Fair fighting is enabled, and you're too strong for %s!", battle->getName().c_str());
+ }
+ else if (ni->stats->getLevel() - battle->getLevel() > 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->getName().c_str());
+ }
+ else if (battle->getLevel() - ni->stats->getLevel() > 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->getName().c_str());
+ }
+ else
+ {
+ // Set your battle pointer to the other player
+ ni->stats->setBattle(battle->getClient());
+
+ // Set the other player's battle pointer to you
+ battle->setBattle(ni);
+
+ // The initiator gets the first move (perhaps this should be 50/50)
+ setYourTurn(ni->stats);
+ clearYourTurn(battle);
+
+ // Initiate Battle sequence!
+ ni->stats->subtractPlayerFights(1);
+
+ notice(s_GameServ, u, "You challenge %s to an online duel!", battle->getName().c_str());
+ notice(s_GameServ, c_Forest, "%s walks up and hits %s in the face! Let's see who will bite the dust.",
+ ni->stats->getName().c_str(), battle->getName().c_str()); /* DrLnet - Modified by Kain*/
+
+ notice(s_GameServ, battle->getClient()->getNick(), "%s has challenged you to an online duel!", ni->stats->getName().c_str());
+ notice(s_GameServ, battle->getClient()->getNick(), "%s gets to go first "\
+ "because they initiated!", ni->stats->getName().c_str());
+ notice(s_GameServ, battle->getClient()->getNick(), "Please wait while %s decides what to do.", ni->stats->getName().c_str());
+ display_players(ni);
+ }
+}
E void showNews(char *nick, list<string> &news);
/** gameserv.cpp **/
+E void do_admin(char *u);
+E void do_attack(char *u);
+E void do_bank(char *u);
+E void do_check(char *u);
+E void do_equip(char *u);
+E void do_fight(char *u);
+E void do_heal(char *u);
+E void do_help(char *u);
+E void do_identify(char *u);
+E void do_inventory(char *u);
+E void do_refresh(char *u);
+E void do_register(char *u);
+E void do_list(char *u);
+E void do_logout(char *u);
+E void do_master(char *u);
+E void do_dragon(char *u);
+E void do_play(char *u);
+E void do_quitg(char *u);
+E void do_reset(char *u);
+E void do_run(char *u);
+E void do_set(char *u);
+E void do_stats(char *u);
+E void do_store(char *u);
+E void do_tavern(char *u);
+E void do_use(char *u);
+
E item *findItemByID(int id);
E int hpbonus[LEVELS - 1];
E int strbonus[LEVELS - 1];
bool shuttingdown;
-void do_admin(char *u);
-void do_attack(char *u);
-void do_bank(char *u);
-void do_check(char *u);
-void do_equip(char *u);
-void do_fight(char *u);
+
void do_heal(char *u);
void do_help(char *u);
void do_identify(char *u);
cmd--; // Same thing :)
}
-void do_check(char *u)
-{
- int days, hours, minutes, seconds;
- long complete;
- complete = (lastrefresh + refreshperiod) - time(NULL);
- days = complete / 86400;
- hours = (complete % 86400) / 3600;
- minutes = (complete % 86400) % 3600 / 60;
- seconds = (complete % 86400) % 3600 % 60;
-
- notice(s_GameServ, u, "Time left to next refresh: %dd %dh %dm %ds",
- days, hours, minutes, seconds);
-
- if (isRolloverForestFights())
- {
- complete = (lastrollover + rolloverperiod) - time(NULL);
-
- days = complete / 86400;
- hours = (complete % 86400) / 3600;
- minutes = (complete % 86400) % 3600 / 60;
- seconds = (complete % 86400) % 3600 % 60;
-
- notice(s_GameServ, u, "Time left to next rollover: %dd %dh %dm %ds",
- days, hours, minutes, seconds);
- }
-}
+
void do_list(char *u)
{
showstats(u, nick);
}
-
-
-
-
-void do_fight(char *u)
-{
- aClient *ni;
- Player *battle;
-
- char *nick = strtok(NULL, " ");
-
- if (!nick)
- {
- notice(s_GameServ, u, "SYNTAX: /msg <S FIGHT PLAYER");
- 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 are not playing!");
- return;
- }
-
- updateTS(ni->stats);
-
- if (ni->stats->getPlayerFights() <= 0)
- {
- ni->stats->setPlayerFights(0); // just to be safe
- notice(s_GameServ, u, "You are out of player fights for the "\
- "day. You have to wait until tomorrow!");
- }
- else if (!(battle = findplayer(nick)))
- {
- notice(s_GameServ, u, "Player %s not found!", nick);
- }
- else if (!isAlive(ni->stats))
- {
- notice(s_GameServ, u, "You are dead. Wait until tomorrow to fight others!");
- }
- else if (!is_playing(battle->getClient()))
- {
- notice(s_GameServ, u, "You can't attack %s while they aren't playing!", nick);
- }
-
- /* offline fighting not available yet
- else if (!(fight = finduser(nick)))
- {
- ni->stats->battle = battle;
- battle->battle = ni;
- setYourTurn(ni->stats);
- clearYourTurn(battle->stats);
-
- notice(s_GameServ, u, "You decide to fight %s while they're "\
- "not in the realm!",
- battle->stats->name.c_str());
- display_players(u);
- }
- */
- else if (stricmp(ni->stats->getName().c_str(), battle->getName().c_str()) == 0)
- {
- notice(s_GameServ, u, "Are you trying to commit suicide!?");
- }
- else if (!isAlive(battle))
- {
- notice(s_GameServ, u, "They are dead. Cannot fight dead players!");
- }
- else if (player_fight(battle->getClient()))
- {
- notice(s_GameServ, u, "%s is fighting %s already!", battle->getName().c_str(), battle->getBattle()->stats->getName().c_str());
- }
- else if (master_fight(battle->getClient()))
- {
- notice(s_GameServ, u, "%s is fighting their master!", battle->getName().c_str());
- }
- else if (is_fighting(battle->getClient()))
- {
- notice(s_GameServ, u, "%s is fighting %s already!", battle->getName().c_str(), battle->getMonster()->name.c_str());
- }
- else if (!isAdmin(ni) && isFairFights() && (ni->stats->getStrength()/2 - battle->getDefense()) > battle->getHP())
- {
- notice(s_GameServ, u, "Fair fighting is enabled, and you're too strong for %s!", battle->getName().c_str());
- }
- else if (ni->stats->getLevel() - battle->getLevel() > 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->getName().c_str());
- }
- else if (battle->getLevel() - ni->stats->getLevel() > 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->getName().c_str());
- }
- else
- {
- // Set your battle pointer to the other player
- ni->stats->setBattle(battle->getClient());
-
- // Set the other player's battle pointer to you
- battle->setBattle(ni);
-
- // The initiator gets the first move (perhaps this should be 50/50)
- setYourTurn(ni->stats);
- clearYourTurn(battle);
-
- // Initiate Battle sequence!
- ni->stats->subtractPlayerFights(1);
-
- notice(s_GameServ, u, "You challenge %s to an online duel!", battle->getName().c_str());
- notice(s_GameServ, c_Forest, "%s walks up and hits %s in the face! Let's see who will bite the dust.",
- ni->stats->getName().c_str(), battle->getName().c_str()); /* DrLnet - Modified by Kain*/
-
- notice(s_GameServ, battle->getClient()->getNick(), "%s has challenged you to an online duel!", ni->stats->getName().c_str());
- notice(s_GameServ, battle->getClient()->getNick(), "%s gets to go first "\
- "because they initiated!", ni->stats->getName().c_str());
- notice(s_GameServ, battle->getClient()->getNick(), "Please wait while %s decides what to do.", ni->stats->getName().c_str());
- display_players(ni);
- }
-}
-
-void do_equip(char *u)
-{
- aClient *user;
- pouch *p;
- itemContainer *equip;
- int id;
-
- char *item = strtok(NULL, " ");
-
- if (!item || int(item[0]) < 48 || int(item[0] > 57))
- {
- notice(s_GameServ, u, "SYNTAX: EQUIP ####");
- notice(s_GameServ, u, "Type /msg <S HELP EQUIP for more information.");
- return;
- }
- else if (!(user = find(u)))
- {
- notice(s_GameServ, u, "Fatal error in do_equip. Contact a(n) <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 equip weapons and armor!");
- return;
- }
- id = stringtoint(item);
- if (!is_fighting(user))
- updateTS(user->stats);
- p = user->stats->inventory;
-
-
- if (!(equip = p->Find(id)))
- {
- if (!p->isEmpty())
- {
- notice(s_GameServ, u, "You aren't carrying that item!");
- }
- showinventory(user->stats, user);
- }
- else if (equip->getItem()->getType() != ARMOR && equip->getItem()->getType() != WEAPON)
- {
- notice(s_GameServ, u, "You can't use %s like that. Try /msg <S use", equip->getItem()->getName().c_str());
- }
- else
- {
- // Use the item
- notice(s_GameServ, u, "You equip %s.", equip->getItem()->getName().c_str());
- equip->use(user->stats);
- }
-}
-
void do_use(char *u)
{
aClient *user;
return;
}
-void do_bank(char *u)
-{
- char *cmd = strtok(NULL, " ");
- char *amount = strtok(NULL, " ");
- char *nick = strtok(NULL, " ");
-
- aClient *user;
- Player *p;
-
- if (!cmd || (!amount && stricmp(cmd, "BALANCE") != 0) || (stricmp(cmd, "TRANSFER") == 0 && !nick))
- {
- notice(s_GameServ, u, "BANK {WITHDRAW | DEPOSIT} {ALL | AMOUNT}");
- notice (s_GameServ, u, "BANK BALANCE");
- return;
- }
- else if (!(user = find(u)))
- {
- notice(s_GameServ, u, "Fatal Error. Couldn't find your aClient. Contact a(n) <S "\
- " admin for help");
- log("Fatal Error. Couldn't find %s while executing do_bank()", u);
- 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 use the bank!");
- return;
- }
- else if (is_fighting(user))
- {
- notice(s_GameServ, u, "You can't go to the bank during a fight!");
- return;
- }
- updateTS(user->stats);
- if (stricmp(cmd, "BALANCE") == 0)
- {
- showBankBalance(u);
- return;
- }
- else if (!isAlive(user->stats))
- {
- notice(s_GameServ, u, "You are dead. We don't accept gold from dead folk! Wait 'til tomorrow!");
- return;
- }
- else if (!isstringnum(amount) && stricmp(amount, "ALL") != 0)
- {
- 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)
- {
- if (p->getBank() == 2000000000)
- {
- notice(s_GameServ, u, "Your bank account is full, sire!");
- return;
- }
- else if (stricmp(amount, "ALL") == 0)
- {
- if (2000000000 - p->getBank() < p->getGold())
- {
- notice(s_GameServ, u, "You don't have enough room for all of your gold.");
- notice(s_GameServ, u, "Depositing %ld gold into your account", (2000000000 - p->getBank()));
- p->subtractGold((2000000000 - p->getBank()));
- p->setBank(2000000000);
- showBankBalance(u);
- }
- else
- {
- notice(s_GameServ, u, "Depositing %ld gold into your account!", p->getGold());
- p->addBank(p->getGold());
- p->setGold(0);
- showBankBalance(u);
- }
- }
- else if (stringtoint(amount) > p->getGold())
- {
- notice(s_GameServ, u, "Sire, you only have %ld gold!", p->getGold());
- showBankBalance(u);
- return;
- }
- else
- {
- if (2000000000 - p->getBank() < stringtoint(amount))
- {
- notice(s_GameServ, u, "You don't have room in your account for that much.");
- notice(s_GameServ, u, "Capping off your account with %ld gold!", (2000000000 - p->getBank()));
- p->subtractGold((2000000000 - p->getBank()));
- p->setBank(2000000000);
- showBankBalance(u);
- }
- else
- {
- notice(s_GameServ, u, "Depositing %d gold into your account!", stringtoint(amount));
- p->addBank(stringtoint(amount));
- p->subtractGold(stringtoint(amount));
- showBankBalance(u);
- }
- }
- }
- else if (stricmp(cmd, "WITHDRAW") == 0)
- {
- if (p->getGold() == 2000000000)
- {
- notice(s_GameServ, u, "You cannot carry any more gold, sire!");
- showBankBalance(u);
- return;
- }
- else if (stricmp(amount, "ALL") == 0)
- {
- if (2000000000 - p->getGold() < p->getBank())
- {
- notice(s_GameServ, u, "You don't have enough room to carry all that gold.");
- notice(s_GameServ, u, "Withdrawing %ld gold from your account", (2000000000 - p->getGold()));
- p->subtractBank((2000000000 - p->getGold()));
- p->setGold(2000000000);
- showBankBalance(u);
- }
- else
- {
- notice(s_GameServ, u, "Withdrawing %ld gold from your account!", p->getBank());
- p->addGold(p->getBank());
- p->setBank(0);
- showBankBalance(u);
- }
- }
- else if (stringtoint(amount) > p->getBank())
- {
- notice(s_GameServ, u, "Sire, you only have %ld gold in the bank!", p->getBank());
- showBankBalance(u);
- return;
- }
- else
- {
- if (2000000000 - p->getGold() < stringtoint(amount))
- {
- notice(s_GameServ, u, "You don't enough have room to carry that much gold!");
- notice(s_GameServ, u, "You fill your pockets with %ld gold!",
- (2000000000 - p->getGold()));
- p->subtractBank((2000000000 - p->getGold()));
- p->setGold(2000000000);
- showBankBalance(u);
- }
- else
- {
- notice(s_GameServ, u, "Withdrawing %d gold from your account!", stringtoint(amount));
- p->addGold(stringtoint(amount));
- p->subtractBank(stringtoint(amount));
- showBankBalance(u);
- }
- }
- }
-}
+
void do_dragon(char *u)
{