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