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