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