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