#define LEVELS 12 // Levels in the game
#define REALLEVELS 12 // Levels to load from monsters.dat
#define MONSTERS 12 // Monsters per level
+#define WNA 16 // Weapons and armor
#include <stdarg.h>
-#include "player.h"
-#include "level.h"
-#include "list.h"
+#include <list>
+#include <string>
+
#include "config.h"
-#include "myString.h"
#include "options.h"
+using namespace std;
+
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# endif
#endif
+// Forward declarations
+class toplist;
+class Player;
+class aClient;
+class Level;
+class item;
+class itemContainer;
+class weapon;
+class armor;
+class potion;
+class tavernItem;
+class Monster;
+
// Hash.cpp stuff start
#define U_TABLE_SIZE 1999
E unsigned long sHASH(const unsigned char *name);
// hash.cpp stuff end
E long lastrefresh;
+E long lastrollover;
E void save_lastrefresh();
E void load_lastrefresh();
+E void save_lastrollover();
+E void load_lastrollover();
// The socket
E int sock;
E char *gsident;
E char *pidfile;
E char *newsdata;
+E char *nsname;
+E char *nspass;
+E Monster dragon;
#if defined(P10)
E char *gsnum;
#endif
E char *servername;
+E char *localhost;
E char *remoteserver;
-E char *remoteport;
+E int remoteport;
E char *remotepass;
E char *playerdata;
+E char *itemdata;
+E char *tavernitemdata;
+E char *storeitemdata;
+E char *dragondata;
+E char *masterdata;
E char *logfile;
E char *adminpass;
E char *VERSION;
E long configflags;
E long refreshperiod;
+E long rolloverperiod;
+E long numrolloverfights;
E int level1expire;
E int defaultexpire;
E bool shuttingdown;
E int maxbfightdistance;
E int maxidletime;
E int idlecheckperiod;
+E int maxitems;
+E long maxforestfights;
+E unsigned int maxnicklen;
/* config.cpp end */
-E List<aClient> players[U_TABLE_SIZE];
-E List<aClient> clients[U_TABLE_SIZE];
-E List<myString> todaysnews;
-E Monster boss;
+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
+
+/* misc.cpp begin */
+E void end_turn(aClient *user);
+E void see_master(char *u);
+
+/* misc.cpp end */
+/* find.cpp begin */
+E item *findItemByID(int id);
+E item *findStoreItemByID(int id);
+E tavernItem *findTavernItemByID(int id);
+/* find.cpp end */
+
+/* messages.cpp begin */
+E void display_help(char *u, char *file);
+E void display_monster(char *u);
+E void display_players(char *u);
+E void display_players(aClient *user);
+E void showBankBalance(const char *u);
+void showTavern(aClient *user);
+/* messages.cpp end */
+
+/* boolean.cpp begin */
+E bool check_password(char *name, char *plaintext);
+/* boolean.cpp end */
/** tcpclient.cpp **/
E void check_idles();
+E void clearClients();
+E void clearPlayers();
/** List search functions **/
E aClient *find(char *nick);
E aClient *findbynick(char *nick);
E aClient *findbynick(const char *nick);
E aClient *findbyrealnick(char *realnick);
-E aClient *findplayer(const char *name);
-E aClient *findIRCplayer(const char *nick);
+E Player *findplayer(const char *name);
#ifdef P10
E aClient *findbyrealnick(char *realnick);
#endif
E void raw(const char *fmt, ...);
/** news.cpp **/
-E void addNews(List<myString> &news, const char *fmt, ...);
-E void do_news(char *u);
-E void clearNews(List<myString> &news);
-E void loadNews(char *filename, List<myString> &news);
-E void saveNews(char *filename, List<myString> &news);
-E void showNews(char *nick, List<myString> &news);
+E void addNews(list<string> &news, const char *fmt, ...);
+
+E void clearNews(list<string> &news);
+E void loadNews(char *filename, list<string> &news);
+E void saveNews(char *filename, list<string> &news);
+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_load(char *u);
+E void do_logout(char *u);
+E void do_master(char *u);
+E void do_news(char *u);
+E void do_dragon(char *u);
+E void do_play(char *u);
+E void do_quitg(char *u);
+E void do_raw(char *u);
+E void do_reset(char *u);
+E void do_run(char *u);
+E void do_save(char *u);
+E void do_set(char *u);
+E void do_shutdown(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];
+E int defbonus[LEVELS - 1];
E void gameserv(char *source, char *buf);
E Level levels[LEVELS];
+E list<item*> Items;
+E list<tavernItem> tavern;
+E toplist myToplist;
/** forest.cpp **/
E void forest(char *source, char *buf);
E bool player_fight(char *u);
E bool player_fight(aClient *user);
+E bool dragon_fight(aClient *user);
+
E bool master_fight(char *u);
E bool master_fight(aClient *user);
+E bool alphaNumeric(const char *str);
+
#ifndef HAVE_STRTOK
E char *strtok(char *str, const char *delim);
#endif
E char *spaces(int len, char *seperator);
-E void display_monster(char *u);
-E void display_players(char *u);
+
E int stricmp(const char *s1, const char *s2);
E int strnicmp(const char *s1, const char *s2, size_t len);
E long int chartoint(char ch);
E bool load_levels();
E void delete_monsters();
E void delete_masters();
-E Monster *getNewMonster(Monster *m);
E void deleteMonster(Monster *m);
E void refresh(Player *p);
E void refreshall();
+E void rolloverall();
+E void rollover(Player *p);
E void updateTS(Player *p);
E bool timedOut(Player *p);
E void timeOutEvent(Player *p);
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_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);
E void do_register(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 logout(aClient *user); // log a user off the game
E void showstats(const char *u, const char *nick);
-E void showinventory(aClient *from, aClient *to = NULL);
+E void showinventory(Player *from, aClient *to);
/* Database saving stuff */
E int save_gs_dbase();
E int load_gs_dbase();
+E int load_tavern();
+E int load_items();
+E int load_store();
+E int load_dragon();
+E int save_dragon();
// Log File Stuff
E void log(const char *fmt, ...);