]> jfr.im git - irc/gameservirc.git/blame_incremental - gameserv/extern.h
Added capability for gameserv to identify with nickserv
[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 "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
30E unsigned long sHASH(const unsigned char *name);
31E unsigned long iHASH(const unsigned char *name);
32// hash.cpp stuff end
33
34E long lastrefresh;
35E void save_lastrefresh();
36E void load_lastrefresh();
37
38// The socket
39E int sock;
40
41
42/* config.cpp start */
43E int load_config_file(char *config = "gameserv.conf");
44E void unload_config_file();
45E char *s_GameServ;
46E char *c_Forest;
47E char *c_ForestTopic;
48E char *gshost;
49E char *gsident;
50E char *pidfile;
51E char *newsdata;
52E char *nsname;
53E char *nspass;
54
55#if defined(P10)
56E char *gsnum;
57#endif
58
59E char *servername;
60E char *remoteserver;
61E char *remoteport;
62E char *remotepass;
63E char *playerdata;
64E char *logfile;
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<string> todaysnews;
89
90/** tcpclient.cpp **/
91E void check_idles();
92
93/** List search functions **/
94E aClient *find(char *nick);
95E aClient *find(const char *nick);
96E aClient *findbynick(char *nick);
97E aClient *findbynick(const char *nick);
98E aClient *findbyrealnick(char *realnick);
99E aClient *findplayer(const char *name);
100E aClient *findIRCplayer(const char *nick);
101#ifdef P10
102E aClient *findbyrealnick(char *realnick);
103#endif
104
105/** tcpclient.cpp **/
106
107/** Sock writing functions **/
108E void notice(const char *source, const char *dest, const char *fmt, ...);
109E void raw(const char *fmt, ...);
110
111/** news.cpp **/
112E void addNews(List<string> &news, const char *fmt, ...);
113E void do_news(char *u);
114E void clearNews(List<string> &news);
115E void loadNews(char *filename, List<string> &news);
116E void saveNews(char *filename, List<string> &news);
117E void showNews(char *nick, List<string> &news);
118
119/** gameserv.cpp **/
120E void gameserv(char *source, char *buf);
121E Level levels[LEVELS];
122
123/** forest.cpp **/
124E void forest(char *source, char *buf);
125
126/** functions.cpp **/
127
128E bool is_playing(char *u);
129E bool is_playing(aClient *user);
130
131E bool is_fighting(char *u);
132E bool is_fighting(aClient *user);
133
134E bool player_fight(char *u);
135E bool player_fight(aClient *user);
136
137E bool master_fight(char *u);
138E bool master_fight(aClient *user);
139
140#ifndef HAVE_STRTOK
141E char *strtok(char *str, const char *delim);
142#endif
143
144E char *spaces(int len, char *seperator);
145E void display_monster(char *u);
146E void display_players(char *u);
147E int stricmp(const char *s1, const char *s2);
148E int strnicmp(const char *s1, const char *s2, size_t len);
149E long int chartoint(char ch);
150E int isstringnum(char *num);
151E long int pow (int x, int y);
152E long int stringtoint(char *number);
153E bool load_masters();
154E bool load_monsters();
155E bool load_levels();
156E void delete_monsters();
157E void delete_masters();
158E Monster *getNewMonster(Monster *m);
159E void deleteMonster(Monster *m);
160E void refresh(Player *p);
161E void refreshall();
162E void updateTS(Player *p);
163E bool timedOut(Player *p);
164E void timeOutEvent(Player *p);
165E void reset(Player *p);
166E void resetall();
167
168E void do_attack(char *u);
169E void do_bank(char *u);
170E void do_check(char *u);
171E void do_fight(char *u);
172E void do_forest(char *u);
173E void do_heal(char *u);
174E void do_identify(char *u);
175E void do_invenory(char *u);
176E void do_list(char *u);
177E void do_logout(char *u);
178E void do_play(char *u);
179E void do_quitg(char *u);
180E void do_refresh(char *u);
181E void do_register(char *u);
182E void do_reset(char *u);
183E void do_run(char *u);
184E void do_stats(char *u);
185E void do_store(char *u);
186E void do_tavern(char *u);
187E void do_use(char *u);
188E void see_mystic(char *u);
189
190E void logout(aClient *user); // log a user off the game
191E void showstats(const char *u, const char *nick);
192E void showinventory(aClient *from, aClient *to = NULL);
193/* Database saving stuff */
194
195E int save_gs_dbase();
196E int load_gs_dbase();
197
198// Log File Stuff
199E void log(const char *fmt, ...);
200
201#endif