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