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