aClient.o: aClient.cpp aClient.h options.h player.h script.h extern.h \
- config.h
+ config.h
config.o: config.cpp extern.h config.h options.h flags.h
-c_forest.o: c_forest.cpp aClient.h options.h player.h script.h \
- extern.h config.h flags.h item.h level.h pouch.h sockhelp.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
-gameserv.o: gameserv.cpp aClient.h options.h player.h script.h \
- config.h extern.h pouch.h flags.h level.h sockhelp.h item.h toplist.h
-hash.o: hash.cpp extern.h config.h options.h aClient.h player.h \
- script.h
+c_forest.o: c_forest.cpp aClient.h options.h player.h script.h extern.h \
+ config.h flags.h item.h level.h pouch.h sockhelp.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
+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 \
+ extern.h pouch.h flags.h level.h sockhelp.h item.h toplist.h
+hash.o: hash.cpp extern.h config.h options.h aClient.h player.h script.h
item.o: item.cpp item.h level.h player.h script.h extern.h config.h \
- options.h
+ options.h
level.o: level.cpp item.h level.h player.h script.h extern.h config.h \
- options.h
+ options.h
log.o: log.cpp extern.h config.h options.h
news.o: news.cpp extern.h config.h options.h
pouch.o: pouch.cpp extern.h config.h options.h pouch.h item.h level.h \
- player.h script.h
+ player.h script.h
player.o: player.cpp item.h level.h player.h script.h pouch.h extern.h \
- config.h options.h flags.h
+ config.h options.h flags.h
script.o: script.cpp script.h extern.h config.h options.h player.h
sockhelp.o: sockhelp.cpp sockhelp.h extern.h config.h options.h
+messages.o: messages.cpp aClient.h options.h player.h script.h item.h \
+ level.h pouch.h extern.h config.h sockhelp.h flags.h
toplist.o: toplist.cpp toplist.h player.h script.h
tcpclient.o: tcpclient.cpp sockhelp.h options.h aClient.h player.h \
- script.h extern.h config.h flags.h item.h level.h toplist.h
+ script.h extern.h config.h flags.h item.h level.h toplist.h
devel.o: devel.cpp options.h aClient.h player.h script.h extern.h \
- config.h flags.h item.h level.h pouch.h
+ config.h flags.h item.h level.h pouch.h
config.cpp \
c_forest.cpp \
do_attack.cpp \
+ find.cpp \
gameserv.cpp \
hash.cpp \
item.cpp \
player.cpp \
script.cpp \
sockhelp.cpp \
+ messages.cpp \
toplist.cpp
CONSOLESRCS = $(TSRCS) $(CONSOLEDRIVER)
E list<Player*> players[U_TABLE_SIZE];
E list<aClient*> clients[U_TABLE_SIZE];
E list<string> todaysnews;
+E list<item*> store; // The list of items available at the store
+
+/* find.cpp begin */
+E item *findItemByID(int id);
+E item *findStoreItemByID(int id);
+E tavernItem *findTavernItemByID(int id);
+/* find.cpp end */
/** tcpclient.cpp **/
E void check_idles();
--- /dev/null
+/* This file contains functions related to searching */
+
+#include "extern.h"
+#include "item.h"
+
+
+item *findItemByID(int id)
+{
+ list<item*>::iterator item_iterator;
+
+ item_iterator = Items.begin();
+
+ while (item_iterator != Items.end())
+ {
+ if ((*item_iterator)->getID() == id)
+ {
+ return (*item_iterator);
+ }
+ item_iterator++;
+ }
+ return NULL;
+}
+
+item *findStoreItemByID(int id)
+{
+ list<item*>::iterator item_iterator;
+
+ item_iterator = store.begin();
+
+ while (item_iterator != store.end())
+ {
+ if ((*item_iterator)->getID() == id)
+ {
+ return (*item_iterator);
+ }
+ item_iterator++;
+ }
+ return NULL;
+}
+
+tavernItem *findTavernItemByID(int id)
+{
+ list<tavernItem>::iterator item_iterator;
+
+ item_iterator = tavern.begin();
+
+ while (item_iterator != tavern.end())
+ {
+ if ((*item_iterator).getItem()->getID() == id)
+ {
+ return &(*item_iterator);
+ }
+ item_iterator++;
+ }
+ return NULL;
+}
+
+
Level levels[LEVELS]; // The newest way to store monsters
list<item*> Items; // The master list of items
list<tavernItem> tavern; // The list of items available at the tavern
-list<item*> store; // The list of items available at the store
+
toplist myToplist; // List of the top 10 players
// Database functions
int load_dragon();
int save_dragon();
-item *findItemByID(int id);
-item *findStoreItemByID(int id);
-tavernItem *findTavernItemByID(int id);
-
// String functions
#ifndef HAVE_STRTOK
char *strtok(char *str, const char *delim);
return 1;
}
-void showstats(const char *u, const char *nick)
-{
- aClient *sender = find(u);
- Player *p;
- char *buf;
- buf = new char[50];
- char *space;
- if (!(p = findplayer(nick)))
- {
- notice(s_GameServ, u, "%s not found", nick);
- }
- else
- {
- notice(s_GameServ, sender->getNick(), "Stats for %s:", p->getName().c_str());
-
- sprintf(buf, "Experience: %ld", p->getExp());
- space = spaces(strlen(buf), " ");
- notice(s_GameServ, sender->getNick(), "%s%sLevel: %d", buf, space,
- p->getLevel());
- delete [] space;
-
- sprintf(buf, "Gold: %ld", p->getGold());
- space = spaces(strlen(buf), " ");
- notice(s_GameServ, sender->getNick(), "%s%sGold in Bank: %ld", buf, space, p->getBank());
- delete [] space;
-
- notice(s_GameServ, sender->getNick(), "Hit Points: %d of %d", p->getHP(),
- p->getMaxHP());
-
- sprintf(buf, "Strength: %d", p->getStrength());
- space = spaces(strlen(buf), " ");
- notice(s_GameServ, sender->getNick(), "%s%sDefense: %d",
- buf, space, p->getDefense());
- delete [] space;
-
- sprintf(buf, "Armor: %s", (p->getArmor() ? p->getArmor()->getName().c_str() : "Nothing"));
- space = spaces(strlen(buf), " ");
-
- notice(s_GameServ, sender->getNick(), "%s%sWeapon: %s", buf, space,
- (p->getWeapon() ? p->getWeapon()->getName().c_str() : "Fists"));
-
- delete [] space;
-
- sprintf(buf, "Forest Fights: %d", p->getForestFights());
- space = spaces(strlen(buf), " ");
- notice(s_GameServ, sender->getNick(), "%s%sPlayer Fights: %d", buf, space, p->getPlayerFights());
- delete [] space;
- if (p->getClient() == sender || isAdmin(sender))
- {
- showinventory(p, sender);
- }
- }
-
- delete [] buf;
-}
-
char *spaces(int len, char *seperator)
{
char *final;
return final;
}
-void raw(const char *fmt, ...)
-{
- va_list args;
- char *input, *buffer;
- const char *t = fmt;
- input = new char[2048];
- buffer = new char[1024];
- va_start(args, fmt);
- vsnprintf(buffer, 1024, fmt, args);
- va_end(args);
-
- memset(input, 0, sizeof(input)); // Initialize to NULL
- for (t = buffer; *t; t++)
- {
- if (*t == '<')
- {
- switch(*++t) {
- case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
- }
- }
- else
- {
- sprintf(input, "%s%c", input, *t);
- }
-
- }
- #ifdef DEBUGMODE
- log("Input: %s", input);
- #endif
-
- sprintf(input, "%s%s", input, "\r\n");
- sock_puts(sock, input);
- delete [] input;
- delete [] buffer;
-}
-/* Send a NOTICE from the given source to the given nick. */
-
-void notice(const char *source, const char *dest, const char *fmt, ...)
-{
- if (fmt[0] == '\0')
- return;
-
- char *commanduse;
- commanduse = new char[16];
-
- #ifdef P10
- if (isUsePrivmsg())
- strcpy(commanduse, "P");
- else
- strcpy(commanduse, "O");
- #else
-
- if (isUsePrivmsg())
- strcpy(commanduse, "PRIVMSG");
- else
- strcpy(commanduse, "NOTICE");
- #endif
-
- va_list args;
- char *input, *buffer;
- const char *t = fmt;
- input = new char[2048];
- buffer = new char[1024];
- va_start(args, fmt);
- vsnprintf(buffer, 1024, fmt, args);
- va_end(args);
-
- if (dest[0] == ':')
- {
- dest++;
-
- #if !defined(P10)
- sprintf(input, ":%s %s %s :", source, commanduse, dest);
- #else
- sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
- #endif
-
- dest--;
- }
- else
- {
- #if !defined(P10)
- sprintf(input, ":%s %s %s :", source, commanduse, dest);
- #else
- sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
- #endif
- }
- log("buffer: %s", buffer);
- for (t = buffer; *t; t++)
- {
- if (*t == '<')
- {
- if(*(++t) == 'S')
- {
- sprintf(input, "%s%s", input, s_GameServ);
- }
- }
- else
- {
- sprintf(input, "%s%c", input, *t);
- }
-
- }
- #ifdef DEBUGMODE
- log("Input: %s", input);
- #endif
- sprintf(input, "%s%s", input, "\r\n");
- sock_puts(sock, input);
- delete [] commanduse;
- delete [] input;
- delete [] buffer;
-}
int strnicmp(const char *s1, const char *s2, size_t len)
return;
}
- if (cmd != NULL && stricmp(cmd, "TOP") == 0)
+ if (cmd == NULL || stricmp(cmd, "TOP") == 0)
{
- list<Player>::iterator iter;
- bool header = false;
+ 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();
+ iter = myToplist.begin();
- while (iter != myToplist.end())
- {
-
- p = &(*iter);
+ while (iter != myToplist.end())
+ {
if (!header)
{
notice(s_GameServ, u, "Top Players");
header = true;
}
- notice(s_GameServ, u, "Name: %s Level: %d",
- p->getName().c_str(), p->getLevel());
+ notice(s_GameServ, u, "Level: %2d Exp: %10d Name: %s",
+ (*iter).getLevel(), (*iter).getExp(), (*iter).getName().c_str());
iter++;
}
}
levels[x].monsters.clear();
}
-void display_monster(char *u)
-{
- if (is_playing(u))
- {
- aClient *user = find(u);
- Player *ni = user->stats;
-
- notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", ni->getHP());
- notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", ni->getMonster()->name.c_str(), ni->getMonster()->hp);
- notice(s_GameServ, u, "Here are your commands:");
- notice(s_GameServ, u, "/msg <S attack");
- notice(s_GameServ, u, "/msg <S run");
- notice(s_GameServ, u, "What will you do?");
- }
-}
-
-void display_players(char *u)
-{
- aClient *user;
- if (!(user = find(u)))
- {
- log("Fatal error in display_players(): Couldn't find %s", u);
- }
- else
- display_players(user);
-}
-
-void display_players(aClient *user)
-{
- char *u = user->getNick();
- if (is_playing(user) && player_fight(user))
- {
- aClient *battle = user->stats->getBattle();
- notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", user->stats->getHP());
- notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", battle->stats->getName().c_str(), battle->stats->getHP());
- notice(s_GameServ, u, "Here are your commands:");
- notice(s_GameServ, u, "/msg <S attack");
- notice(s_GameServ, u, "/msg <S run");
- notice(s_GameServ, u, "What will you do?");
- }
-}
bool is_playing(char *u)
showinventory(user->stats, user);
}
-void showinventory(Player *from, aClient *to)
-{
- char *nick;
- if (!to || !from)
- {
- return;
- }
-
- nick = to->getNick();
-
- if (from->inventory->isEmpty())
- {
- notice(s_GameServ, nick, "You aren't carrying anything");
- return;
- }
-
- list <itemContainer> *items;
- items = from->inventory->getItems();
-
- list <itemContainer>::iterator item_iter, item_iter2;
- item_iter = items->begin();
-
- notice(s_GameServ, nick, "Inventory for %s:", from->getName().c_str());
- long count;
- while (item_iter != items->end())
- {
- // Display a list of counted items so as not to show an extra line for duplicate items
- count = 0;
- item_iter2 = item_iter;
- while (item_iter != items->end() && (*item_iter) == (*item_iter2))
- {
- if ((*item_iter) == (*item_iter2))
- {
- ++count;
- }
- else
- {
- break;
- }
- ++item_iter;
- }
- notice(s_GameServ, nick, "%ld.) %s (%ld)", (*item_iter2).getItem()->getID(), (*item_iter2).getItem()->getName().c_str(), count);
- }
-}
void do_tavern(char *u)
{
}
}
-void showTavern(aClient *user)
-{
- Player *p;
- list<tavernItem>::iterator item_iterator;
- item *tempItem;
-
- p = user->stats;
-
- if (!p)
- return;
-
- item_iterator = tavern.begin();
- if (tavern.empty())
- {
- notice(s_GameServ, user->getNick(), "Tavern is empty");
- return;
- }
-
- while (item_iterator != tavern.end())
- {
- if (p->getLevel() < (*item_iterator).getLevel())
- {
- item_iterator++;
- continue;
- }
- tempItem = (*item_iterator).getItem();
- notice(s_GameServ, user->getNick(), "%d. %s for %ld gold", tempItem->getID(), tempItem->getName().c_str(), tempItem->price());
- item_iterator++;
- }
-}
-
-void showBankBalance(const char *u)
-{
- aClient *user;
- Player *p;
-
- if (!(user = find(u)))
- return;
-
- p = user->stats;
-
- if (!p)
- return;
-
- notice(s_GameServ, u, "Account Balance: %ld Gold On hand: %ld", p->getBank(), p->getGold());
-}
-
void rolloverall()
{
list<Player*>::iterator iter;
display_help(u, cmd);
}
-void display_help(char *u, char *file)
-{
- ifstream infile;
- char *buf;
-
- if (!file)
- {
- infile.open("helpfiles/help");
- if (infile.fail())
- {
- log("Error opening helpfiles/help");
- notice(s_GameServ, u, "Error opening helpfiles/help");
- return;
- }
- buf = new char[1024];
- while(infile.getline(buf, 1024))
- {
- // Written this way, it will process <S in the helpfiles
- // Instead of notice(s_GameServ, u, "%s", buf);
- notice(s_GameServ, u, buf);
- }
-
- // Minor recursion
- aClient *user = find(u);
- if (user && isAdmin(user))
- display_help(u, "admin_commands");
- }
- else
- {
- char *filename;
- filename = new char[strlen(file) + 11];
- strcpy(filename, "helpfiles/");
- strcat(filename, file);
-
- for (unsigned int x = 10; x < strlen(filename); x++)
- filename[x] = tolower(filename[x]);
-
- infile.open(filename);
- delete [] filename;
- if (infile.fail())
- {
- notice(s_GameServ, u, "No help for \ 2%s\ 2", file);
- return;
- }
- buf = new char[1024];
- while(infile.getline(buf, 1024))
- {
- // Written this way, it will process <S in the helpfiles
- // Instead of notice(s_GameServ, u, "%s", buf);
- notice(s_GameServ, u, buf);
- }
- }
- infile.close();
- delete [] buf;
-}
+
void do_admin(char *u)
{
return true;
}
-item *findItemByID(int id)
-{
- list<item*>::iterator item_iterator;
-
- item_iterator = Items.begin();
-
- while (item_iterator != Items.end())
- {
- if ((*item_iterator)->getID() == id)
- {
- return (*item_iterator);
- }
- item_iterator++;
- }
- return NULL;
-}
-
-item *findStoreItemByID(int id)
-{
- list<item*>::iterator item_iterator;
-
- item_iterator = store.begin();
-
- while (item_iterator != store.end())
- {
- if ((*item_iterator)->getID() == id)
- {
- return (*item_iterator);
- }
- item_iterator++;
- }
- return NULL;
-}
-tavernItem *findTavernItemByID(int id)
-{
- list<tavernItem>::iterator item_iterator;
-
- item_iterator = tavern.begin();
-
- while (item_iterator != tavern.end())
- {
- if ((*item_iterator).getItem()->getID() == id)
- {
- return &(*item_iterator);
- }
- item_iterator++;
- }
- return NULL;
-}
# one %s. Do not put any %d %ld or other %s into this string! You will
# break something, because there will be a leftover argument when it is
# called in tcpclient.cpp, because that expects one %s and nothing else.
+# You can use <S as many times as you want, though, because that is automatically
+# Replaced with the s_GameServ variable.
# *****Comment this out to disable sending a welcome message*****
-welcomemsg Hello, %s! This network utilizes a services package called GameServ. For info on how to play the game, type /msg %S help.
+welcomemsg Hello, %s! This network utilizes a services package called GameServ. For info on how to play the game, type /msg <S help.
# This is an optional config file entry that allows you to specify
# up to 32 servers that gameserv should completly ignore.
This command enables you to identify yourself as a(n) %S administrator.
After you identify this way, you can perform all administrator commands listed in:
-/msg %S \ 2HELP\ 2 \ 2\1fadmin_commands\1f\ 2
+/msg <S \ 2HELP\ 2 \ 2\1fadmin_commands\1f\ 2
-
SYNTAX: \ 2ADMIN\ 2 \ 2\1fpassword\1f\ 2
-Example: /msg %S \ 2ADMIN\ 2 \ 2\1ffakepass\1f\ 2
+Example: /msg <S \ 2ADMIN\ 2 \ 2\1ffakepass\1f\ 2
-Welcome to %S!
+Welcome to <S!
-Here are the commands available to only %S administrators:
+Here are the commands available to only <S administrators:
\ 2LOAD\ 2 \1fPerform a manual load of the players or monsters data file\1f
\ 2RAW\ 2 \1fSend a raw string through the GameServ pseudo server\1f
\ 2RESET\ 2 \1fCompletely resets all players' or a single player's stats back to Level 1\1f
\ 2SAVE\ 2 \1fPerform a manual save on the players data file\1f
\ 2SET\ 2 \1fSet various settings on a person's character\1f
- \ 2SHUTDOWN\ 2 \1fSave data and shut down %S\1f
+ \ 2SHUTDOWN\ 2 \1fSave data and shut down <S\1f
-Further help on individual commands can be accessed by typing /msg %S \ 2HELP\ 2 \ 2\1fcommand\1f\ 2
+Further help on individual commands can be accessed by typing /msg <S \ 2HELP\ 2 \ 2\1fcommand\1f\ 2
When you attack, if you win, the fight is over.
If your opponent still has hit points, it is their turn and you must wait for them to attack or run.
SYNTAX: \ 2ATTACK\ 2
-Example: /msg %S \ 2ATTACK\ 2
+Example: /msg <S \ 2ATTACK\ 2
You may withdraw and deposit funds at any point in the game except for in the middle
of a fight.
SYNTAX: \ 2BANK\ 2 {\ 2\1fWITHDRAW\1f\ 2 | \ 2\1fDEPOSIT\1f\ 2} {\ 2\1f#\1f\ 2 | \ 2\1fALL\1f\ 2}
-Example: /msg %S \ 2BANK\ 2 \ 2\1fwithdraw\1f\ 2 \ 2\1fall\1f\ 2
-Example: /msg %S \ 2BANK\ 2 \ 2\1fdeposit\1f\ 2 \ 2\1f400\1f\ 2
+Example: /msg <S \ 2BANK\ 2 \ 2\1fwithdraw\1f\ 2 \ 2\1fall\1f\ 2
+Example: /msg <S \ 2BANK\ 2 \ 2\1fdeposit\1f\ 2 \ 2\1f400\1f\ 2
Shows how long until the next refresh
SYNTAX: \ 2CHECK\ 2
-Example: /msg \ 2%S\ 2 \ 2\1fCHECK\1f\ 2
+Example: /msg \ 2<S\ 2 \ 2\1fCHECK\1f\ 2
If you can beat the dragon, you will be awarded VERY generously!
SYNTAX: \ 2DRAGON\ 2
-Example: /msg %S \ 2DRAGON\ 2
+Example: /msg <S \ 2DRAGON\ 2
The equip command allows you to equip various weapons and armor to use them in battle. You may equip during battle if it's your turn.
The number you use must correspond to an item in your inventory.
-SYNTAX: /msg %S \ 2EQUIP\ 2 \ 2\1fNUMBER\1f\ 2
+SYNTAX: /msg <S \ 2EQUIP\ 2 \ 2\1fNUMBER\1f\ 2
-Example: /msg %S EQUIP 1
+Example: /msg <S EQUIP 1
When you lose to another player, the player takes all the gold you have on hand.
It is wise to keep your money in the bank for this reason.
SYNTAX: \ 2FIGHT\ 2 \ 2\1fplayer\1f\ 2
-Example: /msg %S \ 2FIGHT\ 2 \ 2\1fircnick\1f\ 2
+Example: /msg <S \ 2FIGHT\ 2 \ 2\1fircnick\1f\ 2
levels, the price for healing goes up. You can either heal all possible points, or
chose an arbitrary number of hit points for healing.
SYNTAX: \ 2HEAL\ 2 {\ 2\1f#\1f\ 2 | \ 2\1fALL\1f\ 2}
-Example: /msg %S \ 2HEAL\ 2 \ 2\1fall\1f\ 2
-Example: /msg %S \ 2HEAL\ 2 \ 2\1f34\1f\ 2
+Example: /msg <S \ 2HEAL\ 2 \ 2\1fall\1f\ 2
+Example: /msg <S \ 2HEAL\ 2 \ 2\1f34\1f\ 2
-Welcome to %S!
+Welcome to <S!
Here are the basic commands available to everyone:
\ 2IDENTIFY\ 2 \1fIdentify yourself with a previously registered login\1f
\ 2INVENTORY\ 2 \1fView your inventory\1f
\ 2LIST\ 2 \1fList who is currently in the realm\1f
- \ 2LOGOUT\ 2 \1fLets you stop playing %S without quitting\1f
+ \ 2LOGOUT\ 2 \1fLets you stop playing <S without quitting\1f
\ 2MASTER\ 2 \1fQuestion and fight your master to gain a level\1f
\ 2NEWS\ 2 \1fView the daily happenings\1f
\ 2REGISTER\ 2 \1fRegister a login and join the realm\1f
\ 2TAVERN\ 2 \1fBuy and Sell Potions\1f
\ 2USE\ 2 \1fUse Items in your Inventory\1f
-Further help on individual commands can be accessed by typing /msg %S \ 2HELP\ 2 \ 2\1fcommand\1f\ 2
+Further help on individual commands can be accessed by typing /msg <S \ 2HELP\ 2 \ 2\1fcommand\1f\ 2
-This command enables you to restart playing on %S after having logged off of IRC.
-You must be the owner of an already registered %S player name.
+This command enables you to restart playing on <S after having logged off of IRC.
+You must be the owner of an already registered <S player name.
This is where remembering your password from the register command is needed.
SYNTAX: \ 2IDENTIFY\ 2 \ 2\1fplayername\1f\ 2 \ 2\1fpassword\1f\ 2
-Example: /msg %S \ 2IDENTIFY\ 2 \ 2\1fKiller\1f\ 2 \ 2\1fkillerpassword\1f\ 2
+Example: /msg <S \ 2IDENTIFY\ 2 \ 2\1fKiller\1f\ 2 \ 2\1fkillerpassword\1f\ 2
The inventory command allows a player to check their inventory to see how
many potions they have on hand. You may check your inventory during a fight.
-SYNTAX: /msg %S \ 2INVENTORY\ 2
+SYNTAX: /msg <S \ 2INVENTORY\ 2
Lists the current players in the realm and their IRC Nicknames.
-Just /msg %S LIST lists all players currently logged in.
-/msg %S LIST ALL lists all existing players.
+Just /msg <S LIST lists all players currently logged in.
+/msg <S LIST ALL lists all existing players.
SYNTAX: \ 2LIST\ 2 [\ 2\1fALL\1f\ 2]
-Example: /msg %S \ 2LIST\ 2
-Example: /msg %S \ 2LIST\ 2 \ 2ALL\ 2
+Example: /msg <S \ 2LIST\ 2
+Example: /msg <S \ 2LIST\ 2 \ 2ALL\ 2
-This command manually loads the %S database file with all player stats or the monsterdata file.
+This command manually loads the <S database file with all player stats or the monsterdata file.
SYNTAX: \ 2LOAD\ 2 \1f[MONSTERS]\1f
-Example: /msg %S \ 2LOAD\ 2
-Example: /msg %S \ 2LOAD \1fMONSTERS\1f\ 2
+Example: /msg <S \ 2LOAD\ 2
+Example: /msg <S \ 2LOAD \1fMONSTERS\1f\ 2
This command allows players to stop playing without needing to quit the IRC Server.
-Only %S admins may logout other players.
+Only <S admins may logout other players.
SYNTAX: \ 2LOGOUT\ 2 [\1fname\1f]
-Example: /msg %S \ 2LOGOUT\ 2
+Example: /msg <S \ 2LOGOUT\ 2
If you lose, you are not dead, and your hit points to not diminish, but your master
has won, and you must wait until the next day to fight them again.
SYNTAX: \ 2MASTER\ 2 {\ 2\1fQUESTION\1f\ 2 | \ 2\1fFIGHT\1f\ 2}
-Example: /msg %S \ 2MASTER\ 2 \ 2\1fquestion\1f\ 2
-Example: /msg %S \ 2MASTER\ 2 \ 2\1ffight\1f\ 2
+Example: /msg <S \ 2MASTER\ 2 \ 2\1fquestion\1f\ 2
+Example: /msg <S \ 2MASTER\ 2 \ 2\1ffight\1f\ 2
Shows today's daily happenings
SYNTAX: \ 2NEWS\ 2
-Example: /msg \ 2%S\ 2 \ 2\1fNEWS\1f\ 2
+Example: /msg \ 2<S\ 2 \ 2\1fNEWS\1f\ 2
-Sends a string of unformatted text to the uplink via %S's server link.
+Sends a string of unformatted text to the uplink via <S's server link.
SYNTAX: \ 2RAW \1ftext\1f\ 2
-Example: /msg %S \ 2RAW\ 2 :%S PRIVMSG #Channel :Hello Everyone :)
+Example: /msg <S \ 2RAW\ 2 :<S PRIVMSG #Channel :Hello Everyone :)
This command refreshes all or one of the people playing in the realm.
Forest fights, player fights, master fight, and your hit points are maxed out.
SYNTAX: \ 2REFRESH\ 2 {\ 2\1fALL\1f\ 2 | \ 2\1fNICK\1f\ 2}
-Example: /msg %S \ 2REFRESH\ 2 \ 2\1fall\1f\ 2
-Example: /msg %S \ 2REFRESH\ 2 \ 2\1fkiller\1f\ 2
+Example: /msg <S \ 2REFRESH\ 2 \ 2\1fall\1f\ 2
+Example: /msg <S \ 2REFRESH\ 2 \ 2\1fkiller\1f\ 2
-This is the command you must use to register your nickname with %S as a player.
-You provide a password, and %S responds by telling you that you are registered.
+This is the command you must use to register your nickname with <S as a player.
+You provide a password, and <S responds by telling you that you are registered.
\ 2\1fWrite down your password!\1f\ 2
Passwords are encrypted and stored in the player data file.
This encryption can not be reversed.
In other words: If you lose your password, there is no way to get it back.
SYNTAX: \ 2REGISTER\ 2 \ 2\1fname\1f\ 2 \ 2\1fpassword\1f\ 2
-Example: /msg %S \ 2REGISTER\ 2 \ 2\1fKiller\1f\ 2 \ 2\1ffakepass\1f\ 2
+Example: /msg <S \ 2REGISTER\ 2 \ 2\1fKiller\1f\ 2 \ 2\1ffakepass\1f\ 2
The player or all players have to restart the game from the beginning.
This is useful for dealing with problematic players and bugs!
SYNTAX: \ 2RESET\ 2 {\ 2\1fALL\1f\ 2 | \ 2\1fNICK\1f\ 2}
-Example: /msg %S \ 2RESET\ 2 \ 2\1fall\1f\ 2
-Example: /msg %S \ 2RESET\ 2 \ 2\1fkiller\1f\ 2
+Example: /msg <S \ 2RESET\ 2 \ 2\1fall\1f\ 2
+Example: /msg <S \ 2RESET\ 2 \ 2\1fkiller\1f\ 2
run is the command that lets you flee from the fight. You still lose one forest fight
or one player fight for the day, however, and any hit points lost do not replenish automatically.
SYNTAX: \ 2RUN\ 2
-Example: /msg %S \ 2RUN\ 2
+Example: /msg <S \ 2RUN\ 2
-This command manually saves the %S players' statistical database.
+This command manually saves the <S players' statistical database.
SYNTAX: \ 2SAVE\ 2
-Example: /msg %S \ 2SAVE\ 2
+Example: /msg <S \ 2SAVE\ 2
When you defeat a monster, you gain experience and gold.
Gold can be used to buy things from the store, and experience is needed to gain levels.
SYNTAX: \ 2SEARCH FOREST\ 2
-Example: /msg %S \ 2SEARCH FOREST\ 2
+Example: /msg <S \ 2SEARCH FOREST\ 2
This command lets you, as an admin, set every aspect of a player's stats
to a custom value.
-SYNTAX: SYNTAX: /msg %S SET [NAME] {\ 2PASSWORD\ 2|\ 2BANK BALANCE\ 2|\ 2PLAYER FIGHTS\ 2|\ 2FOREST FIGHTS\ 2|\ 2GOLD\ 2|\ 2STRENGTH\ 2|\ 2DEFENSE\ 2|\ 2HP\ 2|\ 2MAXHP\ 2|\ 2EXP\ 2|\ 2LEVEL\ 2|\ 2ALIVE\ 2|\ 2WEAPON\ 2|\ 2ARMOR\ 2|\ 2SEEN MASTER\ 2} {\ 2STRING\ 2|\ 2NUMBER\ 2|\ 2TRUE\ 2|\ 2FALSE\ 2}
+SYNTAX: SYNTAX: /msg <S SET [NAME] {\ 2PASSWORD\ 2|\ 2BANK BALANCE\ 2|\ 2PLAYER FIGHTS\ 2|\ 2FOREST FIGHTS\ 2|\ 2GOLD\ 2|\ 2STRENGTH\ 2|\ 2DEFENSE\ 2|\ 2HP\ 2|\ 2MAXHP\ 2|\ 2EXP\ 2|\ 2LEVEL\ 2|\ 2ALIVE\ 2|\ 2WEAPON\ 2|\ 2ARMOR\ 2|\ 2SEEN MASTER\ 2} {\ 2STRING\ 2|\ 2NUMBER\ 2|\ 2TRUE\ 2|\ 2FALSE\ 2}
-Example: /msg %S \ 2SET GOLD \1f1000\1f\ 2
-Example: /msg %S \ 2SET Kain \1fHEALING POTIONS\1f \1f100\1f\ 2
-Example: /msg %S \ 2SET Kain Alive \1fTRUE\1f\ 2
+Example: /msg <S \ 2SET GOLD \1f1000\1f\ 2
+Example: /msg <S \ 2SET Kain \1fHEALING POTIONS\1f \1f100\1f\ 2
+Example: /msg <S \ 2SET Kain Alive \1fTRUE\1f\ 2
-This command shuts down %S while saving the database of player statistics for later.
+This command shuts down <S while saving the database of player statistics for later.
SYNTAX: \ 2SHUTDOWN\ 2
-Example: /msg %S \ 2SHUTDOWN\ 2
+Example: /msg <S \ 2SHUTDOWN\ 2
-Get a list of %S related stats on you or another player in the realm.
+Get a list of <S related stats on you or another player in the realm.
SYNTAX: \ 2STATS\ 2 [\ 2\1fplayername\1f\ 2]
-Example: /msg %S \ 2STATS\ 2
-Example: /msg %S \ 2STATS\ 2 \ 2\1fBob\1f\ 2
+Example: /msg <S \ 2STATS\ 2
+Example: /msg <S \ 2STATS\ 2 \ 2\1fBob\1f\ 2
-This is perhaps the most complex command in %S from a user's perspective.
+This is perhaps the most complex command in <S from a user's perspective.
There are three modes for this command: \ 2LIST\ 2, \ 2BUY\ 2, and \ 2SELL\ 2.
You will want to list weapons or armors before attempting to purchase a
new piece of equipment so that you have an idea of the prices involved.
SYNTAX: \ 2STORE\ 2 \ 2\1fLIST\1f\ 2 {\ 2\1fWEAPONS\1f\ 2 | \ 2\1fARMOR\1f\ 2}
SYNTAX: \ 2STORE\ 2 \ 2\1fBUY\1f\ 2 {\ 2\1fWEAPON\1f\ 2 | \ 2\1fARMOR\1f\ 2} \ 2\1f#\1f\ 2
SYNTAX: \ 2STORE\ 2 \ 2\1fSELL\1f\ 2 {\ 2\1fWEAPON\1f\ 2 | \ 2\1fARMOR\1f\ 2}
-Example: /msg %S \ 2STORE\ 2 \ 2\1flist\1f\ 2 \ 2\1fweapons\1f\ 2
-Example: /msg %S \ 2STORE\ 2 \ 2\1fbuy\1f\ 2 \ 2\1fweapon\1f\ 2 \ 215\ 2
-Example: /msg %S \ 2STORE\ 2 \ 2\1fsell\1f\ 2 \ 2\1farmor\1f\ 2
+Example: /msg <S \ 2STORE\ 2 \ 2\1flist\1f\ 2 \ 2\1fweapons\1f\ 2
+Example: /msg <S \ 2STORE\ 2 \ 2\1fbuy\1f\ 2 \ 2\1fweapon\1f\ 2 \ 215\ 2
+Example: /msg <S \ 2STORE\ 2 \ 2\1fsell\1f\ 2 \ 2\1farmor\1f\ 2
boosts and healing.
SYNTAX: \ 2TAVERN\ 2 [LIST | BUY {NUMBER} <NUMBER OF ITEMS TO BUY>]
-Example: /msg %S \ 2TAVERN\ 2
-Example: /msg %S \ 2TAVERN\ 2 \ 2\1flist\1f\ 2
-Example: /msg %S \ 2TAVERN\ 2 \ 2\1fbuy\1f\ 2 \ 26001\ 2
-Example: /msg %S \ 2TAVERN\ 2 \ 2\1fbuy\1f\ 2 \ 26001\ 2 100
+Example: /msg <S \ 2TAVERN\ 2
+Example: /msg <S \ 2TAVERN\ 2 \ 2\1flist\1f\ 2
+Example: /msg <S \ 2TAVERN\ 2 \ 2\1fbuy\1f\ 2 \ 26001\ 2
+Example: /msg <S \ 2TAVERN\ 2 \ 2\1fbuy\1f\ 2 \ 26001\ 2 100
This command lets you use items and potions that you may be carrying.
-SYNTAX: /msg %S USE \ 2NUMBER\ 2
-Example: /msg %S \ 2USE 6001\ 2
+SYNTAX: /msg <S USE \ 2NUMBER\ 2
+Example: /msg <S \ 2USE 6001\ 2
--- /dev/null
+/* This file contains only functions related to sending messages over the
+ ircd socket */
+#include "aClient.h"
+#include "player.h"
+#include "item.h"
+#include "pouch.h"
+#include "extern.h"
+#include "sockhelp.h"
+#include "flags.h"
+
+#include <fstream>
+
+using namespace std;
+
+void raw(const char *fmt, ...)
+{
+ va_list args;
+ char *input, *buffer;
+ const char *t = fmt;
+ input = new char[2048];
+ buffer = new char[1024];
+ va_start(args, fmt);
+ vsnprintf(buffer, 1024, fmt, args);
+ va_end(args);
+
+ memset(input, 0, sizeof(input)); // Initialize to NULL
+ for (t = buffer; *t; t++)
+ {
+ if (*t == '<')
+ {
+ switch(*++t) {
+ case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
+ }
+ }
+ else
+ {
+ sprintf(input, "%s%c", input, *t);
+ }
+
+ }
+ #ifdef DEBUGMODE
+ log("Input: %s", input);
+ #endif
+
+ sprintf(input, "%s%s", input, "\r\n");
+ sock_puts(sock, input);
+ delete [] input;
+ delete [] buffer;
+}
+/* Send a NOTICE from the given source to the given nick. */
+
+void notice(const char *source, const char *dest, const char *fmt, ...)
+{
+ if (fmt[0] == '\0')
+ return;
+
+ char *commanduse;
+ commanduse = new char[16];
+
+ #ifdef P10
+ if (isUsePrivmsg())
+ strcpy(commanduse, "P");
+ else
+ strcpy(commanduse, "O");
+ #else
+
+ if (isUsePrivmsg())
+ strcpy(commanduse, "PRIVMSG");
+ else
+ strcpy(commanduse, "NOTICE");
+ #endif
+
+ va_list args;
+ char *input, *buffer;
+ const char *t = fmt;
+ input = new char[2048];
+ buffer = new char[1024];
+ va_start(args, fmt);
+ vsnprintf(buffer, 1024, fmt, args);
+ va_end(args);
+
+ if (dest[0] == ':')
+ {
+ dest++;
+
+ #if !defined(P10)
+ sprintf(input, ":%s %s %s :", source, commanduse, dest);
+ #else
+ sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
+ #endif
+
+ dest--;
+ }
+ else
+ {
+ #if !defined(P10)
+ sprintf(input, ":%s %s %s :", source, commanduse, dest);
+ #else
+ sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
+ #endif
+ }
+ log("buffer: %s", buffer);
+ for (t = buffer; *t; t++)
+ {
+ if (*t == '<')
+ {
+ if(*(++t) == 'S')
+ {
+ sprintf(input, "%s%s", input, s_GameServ);
+ }
+ }
+ else
+ {
+ sprintf(input, "%s%c", input, *t);
+ }
+
+ }
+ #ifdef DEBUGMODE
+ log("Input: %s", input);
+ #endif
+ sprintf(input, "%s%s", input, "\r\n");
+ sock_puts(sock, input);
+ delete [] commanduse;
+ delete [] input;
+ delete [] buffer;
+}
+
+void showstats(const char *u, const char *nick)
+{
+ aClient *sender = find(u);
+ Player *p;
+ char *buf;
+ buf = new char[50];
+ char *space;
+
+
+ if (!(p = findplayer(nick)))
+ {
+ notice(s_GameServ, u, "%s not found", nick);
+ }
+ else
+ {
+ notice(s_GameServ, sender->getNick(), "Stats for %s:", p->getName().c_str());
+
+ sprintf(buf, "Experience: %ld", p->getExp());
+ space = spaces(strlen(buf), " ");
+ notice(s_GameServ, sender->getNick(), "%s%sLevel: %d", buf, space,
+ p->getLevel());
+ delete [] space;
+
+ sprintf(buf, "Gold: %ld", p->getGold());
+ space = spaces(strlen(buf), " ");
+ notice(s_GameServ, sender->getNick(), "%s%sGold in Bank: %ld", buf, space, p->getBank());
+ delete [] space;
+
+ notice(s_GameServ, sender->getNick(), "Hit Points: %d of %d", p->getHP(),
+ p->getMaxHP());
+
+ sprintf(buf, "Strength: %d", p->getStrength());
+ space = spaces(strlen(buf), " ");
+ notice(s_GameServ, sender->getNick(), "%s%sDefense: %d",
+ buf, space, p->getDefense());
+ delete [] space;
+
+ sprintf(buf, "Armor: %s", (p->getArmor() ? p->getArmor()->getName().c_str() : "Nothing"));
+ space = spaces(strlen(buf), " ");
+
+ notice(s_GameServ, sender->getNick(), "%s%sWeapon: %s", buf, space,
+ (p->getWeapon() ? p->getWeapon()->getName().c_str() : "Fists"));
+
+ delete [] space;
+
+ sprintf(buf, "Forest Fights: %d", p->getForestFights());
+ space = spaces(strlen(buf), " ");
+ notice(s_GameServ, sender->getNick(), "%s%sPlayer Fights: %d", buf, space, p->getPlayerFights());
+ delete [] space;
+ if (p->getClient() == sender || isAdmin(sender))
+ {
+ showinventory(p, sender);
+ }
+ }
+
+ delete [] buf;
+}
+
+void display_monster(char *u)
+{
+ if (is_playing(u))
+ {
+ aClient *user = find(u);
+ Player *ni = user->stats;
+
+ notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", ni->getHP());
+ notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", ni->getMonster()->name.c_str(), ni->getMonster()->hp);
+ notice(s_GameServ, u, "Here are your commands:");
+ notice(s_GameServ, u, "/msg <S attack");
+ notice(s_GameServ, u, "/msg <S run");
+ notice(s_GameServ, u, "What will you do?");
+ }
+}
+
+void display_players(char *u)
+{
+ aClient *user;
+ if (!(user = find(u)))
+ {
+ log("Fatal error in display_players(): Couldn't find %s", u);
+ }
+ else
+ display_players(user);
+}
+
+void display_players(aClient *user)
+{
+ char *u = user->getNick();
+ if (is_playing(user) && player_fight(user))
+ {
+ aClient *battle = user->stats->getBattle();
+ notice(s_GameServ, u, "Your Hitpoints: \ 2%d\ 2", user->stats->getHP());
+ notice(s_GameServ, u, "%s's Hitpoints: \ 2%d\ 2", battle->stats->getName().c_str(), battle->stats->getHP());
+ notice(s_GameServ, u, "Here are your commands:");
+ notice(s_GameServ, u, "/msg <S attack");
+ notice(s_GameServ, u, "/msg <S run");
+ notice(s_GameServ, u, "What will you do?");
+ }
+}
+
+void showinventory(Player *from, aClient *to)
+{
+ char *nick;
+ if (!to || !from)
+ {
+ return;
+ }
+
+ nick = to->getNick();
+
+ if (from->inventory->isEmpty())
+ {
+ notice(s_GameServ, nick, "You aren't carrying anything");
+ return;
+ }
+
+ list <itemContainer> *items;
+ items = from->inventory->getItems();
+
+ list <itemContainer>::iterator item_iter, item_iter2;
+ item_iter = items->begin();
+
+ notice(s_GameServ, nick, "Inventory for %s:", from->getName().c_str());
+ long count;
+ while (item_iter != items->end())
+ {
+ // Display a list of counted items so as not to show an extra line for duplicate items
+ count = 0;
+ item_iter2 = item_iter;
+ while (item_iter != items->end() && (*item_iter) == (*item_iter2))
+ {
+ if ((*item_iter) == (*item_iter2))
+ {
+ ++count;
+ }
+ else
+ {
+ break;
+ }
+ ++item_iter;
+ }
+ notice(s_GameServ, nick, "%ld.) %s (%ld)", (*item_iter2).getItem()->getID(), (*item_iter2).getItem()->getName().c_str(), count);
+ }
+}
+
+
+void showTavern(aClient *user)
+{
+ Player *p;
+ list<tavernItem>::iterator item_iterator;
+ item *tempItem;
+
+ p = user->stats;
+
+ if (!p)
+ return;
+
+ item_iterator = tavern.begin();
+ if (tavern.empty())
+ {
+ notice(s_GameServ, user->getNick(), "Tavern is empty");
+ return;
+ }
+
+ while (item_iterator != tavern.end())
+ {
+ if (p->getLevel() < (*item_iterator).getLevel())
+ {
+ item_iterator++;
+ continue;
+ }
+ tempItem = (*item_iterator).getItem();
+ notice(s_GameServ, user->getNick(), "%d. %s for %ld gold", tempItem->getID(), tempItem->getName().c_str(), tempItem->price());
+ item_iterator++;
+ }
+}
+
+void showBankBalance(const char *u)
+{
+ aClient *user;
+ Player *p;
+
+ if (!(user = find(u)))
+ return;
+
+ p = user->stats;
+
+ if (!p)
+ return;
+
+ notice(s_GameServ, u, "Account Balance: %ld Gold On hand: %ld", p->getBank(), p->getGold());
+}
+
+void display_help(char *u, char *file)
+{
+ ifstream infile;
+ char *buf;
+
+ if (!file)
+ {
+ infile.open("helpfiles/help");
+ if (infile.fail())
+ {
+ log("Error opening helpfiles/help");
+ notice(s_GameServ, u, "Error opening helpfiles/help");
+ return;
+ }
+ buf = new char[1024];
+ while(infile.getline(buf, 1024))
+ {
+ // Written this way, it will process <S in the helpfiles
+ // Instead of notice(s_GameServ, u, "%s", buf);
+ notice(s_GameServ, u, buf);
+ }
+
+ // Minor recursion
+ aClient *user = find(u);
+ if (user && isAdmin(user))
+ display_help(u, "admin_commands");
+ }
+ else
+ {
+ char *filename;
+ filename = new char[strlen(file) + 11];
+ strcpy(filename, "helpfiles/");
+ strcat(filename, file);
+
+ for (unsigned int x = 10; x < strlen(filename); x++)
+ filename[x] = tolower(filename[x]);
+
+ infile.open(filename);
+ delete [] filename;
+ if (infile.fail())
+ {
+ notice(s_GameServ, u, "No help for \ 2%s\ 2", file);
+ return;
+ }
+ buf = new char[1024];
+ while(infile.getline(buf, 1024))
+ {
+ // Written this way, it will process <S in the helpfiles
+ // Instead of notice(s_GameServ, u, "%s", buf);
+ notice(s_GameServ, u, buf);
+ }
+ }
+ infile.close();
+ delete [] buf;
+}
+
battle = NULL;
}
-bool Player::operator <(Player &right)
+bool Player::operator < (Player &right)
{
if (getLevel() < right.getLevel())
{
long int lastcommand; // timestamp for the last command typed
long int lastlogin; // timestamp for the last login
- bool operator <(Player &right);
+ bool operator < (Player &right);
private:
string name; // Player's Name
}
void toplist::insertPlayer(Player *p)
-{
- myList.push_front(*p);
-// sort();
+{\r
+ PlayerWrapper *pw;\r
+ pw = new PlayerWrapper(p);
+ myList.push_front(*pw);
+ sort();
- // Reverse the list since list::sort() uses the < operator
- myList.reverse();
- //prune();
+ // Reverse the list since list::sort() uses the < operator
+ reverse();
+ prune();
}
void toplist::setCount(int c)
{
myList.sort();
}
-
+\r
+void toplist::reverse()\r
+{\r
+ myList.reverse();\r
+}
void toplist::prune()
{
- list<Player>::iterator it;
+ list<PlayerWrapper>::iterator it;
it = myList.begin();
for (int x = 0; it != myList.end(); x++, it++)
}
}
-list<Player>::iterator toplist::begin()
+list<PlayerWrapper>::iterator toplist::begin()
{
return myList.begin();
}
\r
\r
-list<Player>::iterator toplist::end()\r
+list<PlayerWrapper>::iterator toplist::end()\r
{\r
return myList.end();\r
}\r
+\r
+bool toplist::empty()\r
+{\r
+ return myList.empty();\r
+}\r
+\r
+bool PlayerWrapper::operator < (PlayerWrapper &right)\r
+{\r
+ return (*p < *right.p);\r
+}\r
+\r
+PlayerWrapper::PlayerWrapper()\r
+{\r
+ p = NULL;\r
+}\r
+\r
+PlayerWrapper::PlayerWrapper(Player *pl)\r
+{\r
+ p = pl;\r
+}\r
+\r
+PlayerWrapper::~PlayerWrapper()\r
+{\r
+ p = NULL;\r
+}\r
+\r
+void PlayerWrapper::setPlayer(Player *pl)\r
+{\r
+ p = pl;\r
+}\r
+\r
#ifndef TOPLIST_H
#define TOPLIST_H
-#include <list>
+#include <list>\r
+#include <string>\r
+#include "player.h"
using namespace std;
// Forward declaration
-class Player;
+class Player;\r
+class aClient;\r
+class Monster;\r
+class item;\r
-class toplist {
+class PlayerWrapper\r
+{\r
+ public:\r
+ PlayerWrapper();\r
+ PlayerWrapper(Player *pl);\r
+ ~PlayerWrapper();\r
+ \r
+ void setPlayer(Player *pl);\r
+ \r
+ string getName() { return p->getName(); };\r
+ int getLevel() { return p->getLevel(); };\r
+ long int getExp() { return p->getExp(); };\r
+ long int getGold() { return p->getGold(); };\r
+ long int getBank() { return p->getBank(); };\r
+ int getHP() { return p->getHP(); };\r
+ int getMaxHP() { return p->getMaxHP(); };\r
+ int getStrength() { return p->getStrength(); };\r
+ int getDefense() { return p->getDefense(); };\r
+ int getForestFights() { return p->getForestFights(); };\r
+ int getPlayerFights() { return p->getPlayerFights(); };\r
+ string getPassword() { return p->getPassword(); };\r
+\r
+ aClient *getClient() { return p->getClient(); };\r
+ Monster *getMonster() { return p->getMonster(); };\r
+ Monster *getMaster() { return p->getMaster(); };\r
+ aClient *getBattle() { return p->getBattle(); };\r
+\r
+ bool operator < (PlayerWrapper &right);\r
+ \r
+ private:\r
+ Player *p;\r
+};\r
+
+class toplist \r
+{
public:
// Default Constructor
toplist();
void sort();
// Prune the list so it's not larger than the count
- void prune();
+ void prune();\r
+ \r
+ void reverse();
- list<Player>::iterator begin();\r
- list<Player>::iterator end();
+ list<PlayerWrapper>::iterator begin();\r
+ list<PlayerWrapper>::iterator end();\r
+ bool empty();
private:
// The actual list of players
- list<Player> myList;
+ list<PlayerWrapper> myList;
// The number of players to keep in the list
int count;
-};
+};\r
+\r
+\r
+
#endif