]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
fixing news up
[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
10 #include <stdarg.h>
11 #include "player.h"
12 #include "list.h"
13 #include "config.h"
14 #include "myString.h"
15 #include "options.h"
16
17 #if TIME_WITH_SYS_TIME
18 # include <sys/time.h>
19 # include <time.h>
20 #else
21 # if HAVE_SYS_TIME_H
22 # include <sys/time.h>
23 # else
24 # include <time.h>
25 # endif
26 #endif
27
28 // Hash.cpp stuff start
29 #define U_TABLE_SIZE 1999
30 E unsigned long sHASH(const unsigned char *name);
31 E unsigned long iHASH(const unsigned char *name);
32 // hash.cpp stuff end
33
34
35 E int day;
36 E void save_day();
37 E void load_day();
38
39 // The socket
40 E int sock;
41
42
43 /* config.cpp start */
44 E int load_config_file(char *config = "gameserv.conf");
45 E void unload_config_file();
46 E char *s_GameServ;
47 E char *c_Forest;
48 E char *c_ForestTopic;
49 E char *gshost;
50 E char *gsident;
51 E char *pidfile;
52 E char *newsdata;
53
54 #if defined(P10)
55 E char *gsnum;
56 #endif
57
58 E char *servername;
59 E char *remoteserver;
60 E char *remoteport;
61 E char *remotepass;
62 E char *playerdata;
63 E char *logfile;
64 E char *monsterdata;
65 E char *adminpass;
66 E char *VERSION;
67 E char *PACKAGE;
68 E char *welcomemsg;
69 E char *ignoreserverslist;
70
71 E long configflags;
72 E bool shuttingdown;
73 E int welcomedelay;
74 E int updateperiod;
75 E int forestfights;
76 E int maxafightdistance;
77 E int maxbfightdistance;
78 E int maxidletime;
79 E int idlecheckperiod;
80
81 /* config.cpp end */
82
83 E List<aClient> players[U_TABLE_SIZE];
84 E List<aClient> clients[U_TABLE_SIZE];
85 E List<myString> todaysnews;
86 E Monster boss;
87
88 /** tcpclient.cpp **/
89 E void check_idles();
90
91 /** List search functions **/
92 E aClient *find(char *nick);
93 E aClient *find(const char *nick);
94 E aClient *findbynick(char *nick);
95 E aClient *findbynick(const char *nick);
96 E aClient *findbyrealnick(char *realnick);
97 E aClient *findplayer(const char *name);
98 E aClient *findIRCplayer(const char *nick);
99 #ifdef P10
100 E aClient *findbyrealnick(char *realnick);
101 #endif
102
103 /** tcpclient.cpp **/
104
105 /** Sock writing functions **/
106 E void notice(const char *source, const char *dest, const char *fmt, ...);
107 E void raw(const char *fmt, ...);
108
109 /** news.cpp **/
110 E void addNews(List<myString> &news, const char *fmt, ...);
111 E void do_news(char *u);
112 E void clearNews(List<myString> &news);
113 E void loadNews(char *filename, List<myString> &news);
114 E void saveNews(char *filename, List<myString> &news);
115 E void showNews(char *nick, List<myString> &news);
116
117 /** gameserv.cpp **/
118 E void gameserv(char *source, char *buf);
119 E Monster *monsters[LEVELS][MONSTERS];
120
121 /** forest.cpp **/
122 E void forest(char *source, char *buf);
123
124 /** functions.cpp **/
125
126 E bool is_playing(char *u);
127 E bool is_playing(aClient *user);
128
129 E bool is_fighting(char *u);
130 E bool is_fighting(aClient *user);
131
132 E bool player_fight(char *u);
133 E bool player_fight(aClient *user);
134
135 E bool master_fight(char *u);
136 E bool master_fight(aClient *user);
137
138 #ifndef HAVE_STRTOK
139 E char *strtok(char *str, const char *delim);
140 #endif
141
142 E char *spaces(int len, char *seperator);
143 E void display_monster(char *u);
144 E void display_players(char *u);
145 E int stricmp(const char *s1, const char *s2);
146 E int strnicmp(const char *s1, const char *s2, size_t len);
147 E long int chartoint(char ch);
148 E int isstringnum(char *num);
149 E long int pow (int x, int y);
150 E long int stringtoint(char *number);
151 E void init_masters();
152 E void init_monsters();
153 E bool load_monsters();
154 E void delete_monsters();
155 E void delete_masters();
156 E Monster *getNewMonster(Monster *m);
157 E void deleteMonster(Monster *m);
158 E void refresh(Player *p);
159 E void refreshall();
160 E void updateTS(Player *p);
161 E bool timedOut(Player *p);
162 E void timeOutEvent(Player *p);
163 E void reset(Player *p);
164 E void resetall();
165
166 E void do_attack(char *u);
167 E void do_bank(char *u);
168 E void do_fight(char *u);
169 E void do_forest(char *u);
170 E void do_heal(char *u);
171 E void do_identify(char *u);
172 E void do_invenory(char *u);
173 E void do_list(char *u);
174 E void do_logout(char *u);
175 E void do_play(char *u);
176 E void do_quitg(char *u);
177 E void do_refresh(char *u);
178 E void do_register(char *u);
179 E void do_reset(char *u);
180 E void do_run(char *u);
181 E void do_stats(char *u);
182 E void do_store(char *u);
183 E void do_tavern(char *u);
184 E void do_use(char *u);
185 E void see_mystic(char *u);
186
187 E void logout(aClient *user); // log a user off the game
188 E void showstats(const char *u, const char *nick);
189 E void showinventory(aClient *from, aClient *to = NULL);
190 /* Database saving stuff */
191
192 E int save_gs_dbase();
193 E int load_gs_dbase();
194
195 // Log File Stuff
196 E void log(const char *fmt, ...);
197
198 #endif