]> jfr.im git - irc/gameservirc.git/blame_incremental - gameserv/extern.h
added code to load items from master database
[irc/gameservirc.git] / gameserv / extern.h
... / ...
CommitLineData
1#ifndef EXTERN_H
2#define EXTERN_H
3
4#define E extern
5
6#define LEVELS 12 // Levels in the game
7#define REALLEVELS 12 // Levels to load from monsters.dat
8#define MONSTERS 12 // Monsters per level
9#define WNA 16 // Weapons and armor
10
11#include <stdarg.h>
12#include <list>
13#include "player.h"
14#include "level.h"
15#include "list.h"
16#include "config.h"
17#include "options.h"
18
19#if TIME_WITH_SYS_TIME
20# include <sys/time.h>
21# include <time.h>
22#else
23# if HAVE_SYS_TIME_H
24# include <sys/time.h>
25# else
26# include <time.h>
27# endif
28#endif
29
30// Hash.cpp stuff start
31#define U_TABLE_SIZE 1999
32E unsigned long sHASH(const unsigned char *name);
33E unsigned long iHASH(const unsigned char *name);
34// hash.cpp stuff end
35
36E long lastrefresh;
37E void save_lastrefresh();
38E void load_lastrefresh();
39
40// The socket
41E int sock;
42
43
44/* config.cpp start */
45E int load_config_file(char *config = "gameserv.conf");
46E void unload_config_file();
47E char *s_GameServ;
48E char *c_Forest;
49E char *c_ForestTopic;
50E char *gshost;
51E char *gsident;
52E char *pidfile;
53E char *newsdata;
54E char *nsname;
55E char *nspass;
56E Monster dragon;
57
58#if defined(P10)
59E char *gsnum;
60#endif
61
62E char *servername;
63E char *remoteserver;
64E char *remoteport;
65E char *remotepass;
66E char *playerdata;
67E char *itemdata;
68E char *dragondata;
69E char *masterdata;
70E char *logfile;
71E char *adminpass;
72E char *VERSION;
73E char *PACKAGE;
74E char *welcomemsg;
75E char *ignoreserverslist;
76
77E long configflags;
78E long refreshperiod;
79E int level1expire;
80E int defaultexpire;
81E bool shuttingdown;
82E int welcomedelay;
83E int updateperiod;
84E int forestfights;
85E int maxafightdistance;
86E int maxbfightdistance;
87E int maxidletime;
88E int idlecheckperiod;
89
90/* config.cpp end */
91
92E List<aClient> players[U_TABLE_SIZE];
93E List<aClient> clients[U_TABLE_SIZE];
94E List<string> todaysnews;
95
96/** tcpclient.cpp **/
97E void check_idles();
98
99/** List search functions **/
100E aClient *find(char *nick);
101E aClient *find(const char *nick);
102E aClient *findbynick(char *nick);
103E aClient *findbynick(const char *nick);
104E aClient *findbyrealnick(char *realnick);
105E aClient *findplayer(const char *name);
106E aClient *findIRCplayer(const char *nick);
107#ifdef P10
108E aClient *findbyrealnick(char *realnick);
109#endif
110
111/** tcpclient.cpp **/
112
113/** Sock writing functions **/
114E void notice(const char *source, const char *dest, const char *fmt, ...);
115E void raw(const char *fmt, ...);
116
117/** news.cpp **/
118E void addNews(List<string> &news, const char *fmt, ...);
119E void do_news(char *u);
120E void clearNews(List<string> &news);
121E void loadNews(char *filename, List<string> &news);
122E void saveNews(char *filename, List<string> &news);
123E void showNews(char *nick, List<string> &news);
124
125/** gameserv.cpp **/
126E char *weapons[WNA];
127E char *armors[WNA];
128E int prices[WNA - 1];
129E int hpbonus[LEVELS - 1];
130E int strbonus[LEVELS - 1];
131E int defbonus[LEVELS - 1];
132E int webonus[WNA];
133E int arbonus[WNA];
134E void gameserv(char *source, char *buf);
135E Level levels[LEVELS];
136E list<item*> Items;
137
138/** forest.cpp **/
139E void forest(char *source, char *buf);
140
141/** functions.cpp **/
142
143E bool is_playing(char *u);
144E bool is_playing(aClient *user);
145
146E bool is_fighting(char *u);
147E bool is_fighting(aClient *user);
148
149E bool player_fight(char *u);
150E bool player_fight(aClient *user);
151
152E bool dragon_fight(aClient *user);
153
154E bool master_fight(char *u);
155E bool master_fight(aClient *user);
156
157#ifndef HAVE_STRTOK
158E char *strtok(char *str, const char *delim);
159#endif
160
161E char *spaces(int len, char *seperator);
162E void display_monster(char *u);
163E void display_players(char *u);
164E void display_players(aClient *user);
165E int stricmp(const char *s1, const char *s2);
166E int strnicmp(const char *s1, const char *s2, size_t len);
167E long int chartoint(char ch);
168E int isstringnum(char *num);
169E long int pow (int x, int y);
170E long int stringtoint(char *number);
171E bool load_masters();
172E bool load_monsters();
173E bool load_levels();
174E void delete_monsters();
175E void delete_masters();
176E Monster *getNewMonster(Monster *m);
177E void deleteMonster(Monster *m);
178E void refresh(Player *p);
179E void refreshall();
180E void updateTS(Player *p);
181E bool timedOut(Player *p);
182E void timeOutEvent(Player *p);
183E void reset(Player *p);
184E void resetall();
185
186E void do_attack(char *u);
187E void do_bank(char *u);
188E void do_check(char *u);
189E void do_fight(char *u);
190E void do_forest(char *u);
191E void do_heal(char *u);
192E void do_identify(char *u);
193E void do_invenory(char *u);
194E void do_list(char *u);
195E void do_logout(char *u);
196E void do_play(char *u);
197E void do_quitg(char *u);
198E void do_refresh(char *u);
199E void do_register(char *u);
200E void do_reset(char *u);
201E void do_run(char *u);
202E void do_set(char *u);
203E void do_stats(char *u);
204E void do_store(char *u);
205E void do_tavern(char *u);
206E void do_use(char *u);
207E void see_mystic(char *u);
208
209E void logout(aClient *user); // log a user off the game
210E void showstats(const char *u, const char *nick);
211E void showinventory(aClient *from, aClient *to = NULL);
212/* Database saving stuff */
213
214E int save_gs_dbase();
215E int load_gs_dbase();
216E int load_items();
217E int load_dragon();
218E int save_dragon();
219
220// Log File Stuff
221E void log(const char *fmt, ...);
222
223#endif