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