]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
I've begun to add daily news and split up gameserv.cpp a bit
[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
53 #if defined(P10)
54 E char *gsnum;
55 #endif
56
57 E char *servername;
58 E char *remoteserver;
59 E char *remoteport;
60 E char *remotepass;
61 E char *playerdata;
62 E char *logfile;
63 E char *monsterdata;
64 E char *adminpass;
65 E char *VERSION;
66 E char *PACKAGE;
67 E char *welcomemsg;
68 E char *ignoreserverslist;
69
70 E long configflags;
71 E bool shuttingdown;
72 E int welcomedelay;
73 E int updateperiod;
74 E int forestfights;
75 E int maxafightdistance;
76 E int maxbfightdistance;
77 E int maxidletime;
78 E int idlecheckperiod;
79
80 /* config.cpp end */
81
82 E List<aClient> players[U_TABLE_SIZE];
83 E List<aClient> clients[U_TABLE_SIZE];
84 E List<myString> todaysnews;
85 E Monster boss;
86
87 /** tcpclient.cpp **/
88 E void check_idles();
89
90 /** List search functions **/
91 E aClient *find(char *nick);
92 E aClient *find(const char *nick);
93 E aClient *findbynick(char *nick);
94 E aClient *findbynick(const char *nick);
95 E aClient *findbyrealnick(char *realnick);
96 E aClient *findplayer(const char *name);
97 E aClient *findIRCplayer(const char *nick);
98 #ifdef P10
99 E aClient *findbyrealnick(char *realnick);
100 #endif
101
102 /** tcpclient.cpp **/
103
104 /** Sock writing functions **/
105 E void notice(const char *source, const char *dest, const char *fmt, ...);
106 E void raw(const char *fmt, ...);
107
108 /** news.cpp **/
109 E void addNews(List<myString> &news, const char *fmt, ...);
110 E void showNews(char *nick, List<myString> &news);
111
112 /** gameserv.cpp **/
113 E void gameserv(char *source, char *buf);
114 E Monster *monsters[LEVELS][MONSTERS];
115
116 /** forest.cpp **/
117 E void forest(char *source, char *buf);
118
119 /** functions.cpp **/
120
121 E bool is_playing(char *u);
122 E bool is_playing(aClient *user);
123
124 E bool is_fighting(char *u);
125 E bool is_fighting(aClient *user);
126
127 E bool player_fight(char *u);
128 E bool player_fight(aClient *user);
129
130 E bool master_fight(char *u);
131 E bool master_fight(aClient *user);
132
133 #ifndef HAVE_STRTOK
134 E char *strtok(char *str, const char *delim);
135 #endif
136
137 E char *spaces(int len, char *seperator);
138 E void display_monster(char *u);
139 E void display_players(char *u);
140 E int stricmp(const char *s1, const char *s2);
141 E int strnicmp(const char *s1, const char *s2, size_t len);
142 E long int chartoint(char ch);
143 E int isstringnum(char *num);
144 E long int pow (int x, int y);
145 E long int stringtoint(char *number);
146 E void init_masters();
147 E void init_monsters();
148 E bool load_monsters();
149 E void delete_monsters();
150 E void delete_masters();
151 E Monster *getNewMonster(Monster *m);
152 E void deleteMonster(Monster *m);
153 E void refresh(Player *p);
154 E void refreshall();
155 E void updateTS(Player *p);
156 E bool timedOut(Player *p);
157 E void timeOutEvent(Player *p);
158 E void reset(Player *p);
159 E void resetall();
160
161 E void do_attack(char *u);
162 E void do_bank(char *u);
163 E void do_fight(char *u);
164 E void do_forest(char *u);
165 E void do_heal(char *u);
166 E void do_identify(char *u);
167 E void do_invenory(char *u);
168 E void do_list(char *u);
169 E void do_logout(char *u);
170 E void do_play(char *u);
171 E void do_quitg(char *u);
172 E void do_refresh(char *u);
173 E void do_register(char *u);
174 E void do_reset(char *u);
175 E void do_run(char *u);
176 E void do_stats(char *u);
177 E void do_store(char *u);
178 E void do_tavern(char *u);
179 E void do_use(char *u);
180 E void see_mystic(char *u);
181
182 E void logout(aClient *user); // log a user off the game
183 E void showstats(const char *u, const char *nick);
184 E void showinventory(aClient *from, aClient *to = NULL);
185 /* Database saving stuff */
186
187 E int save_gs_dbase();
188 E int load_gs_dbase();
189
190 // Log File Stuff
191 E void log(const char *fmt, ...);
192
193 #endif