]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
Made some changes in the config file and added a new directive updateperiod. Gameserv...
[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 6 // 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
15 #if TIME_WITH_SYS_TIME
16 # include <sys/time.h>
17 # include <time.h>
18 #else
19 # if HAVE_SYS_TIME_H
20 # include <sys/time.h>
21 # else
22 # include <time.h>
23 # endif
24 #endif
25
26
27 // The timestamp from load time to be compared against the current midnight time.
28 E long timestamp;
29 E void save_timestamp();
30 E void load_timestamp();
31 E long int midnight(long int offset = 8);
32
33 // The socket
34 E int sock;
35
36
37 // Random configuration stuff
38 E void load_config_file(char *config = "gameserv.conf");
39 E void unload_config_file();
40 E char *s_GameServ;
41 E char *c_Forest;
42 E char *c_ForestTopic;
43 E char *gshost;
44 E char *gsident;
45 E char *servername;
46 E char *remoteserver;
47 E char *remoteport;
48 E char *remotepass;
49 E char *playerdata;
50 E char *monsterdata;
51 E char *adminpass;
52 E char *VERSION;
53 E char *PACKAGE;
54 E char *welcomemsg;
55
56 E int welcomedelay;
57 E int updateperiod;
58
59 E List<aClient> clients;
60 E List<aClient> players;
61
62 /** List search functions **/
63 E aClient *find(char *nick);
64 E aClient *find(const char *nick);
65 E aClient *findbynick(char *nick);
66 E aClient *findbynick(const char *nick);
67 E aClient *findplayer(const char *name);
68
69 /** Sock writing functions **/
70 E void notice(const char *source, const char *dest, const char *fmt, ...);
71 E void raw(const char *fmt, ...);
72
73 /** gameserv.cpp **/
74 E void gameserv(char *source, char *buf);
75 E Monster *monsters[LEVELS][MONSTERS];
76
77 /** forest.cpp **/
78 E void forest(char *source, char *buf);
79
80 /** functions.cpp **/
81
82 E bool is_playing(char *u);
83 E bool is_playing(aClient *user);
84
85 E bool is_fighting(char *u);
86 E bool is_fighting(aClient *user);
87
88 E bool player_fight(char *u);
89 E bool player_fight(aClient *user);
90
91 E bool master_fight(char *u);
92 E bool master_fight(aClient *user);
93
94 E bool is_alive(char *u);
95 E bool is_alive(aClient *user);
96
97 #ifndef HAVE_STRTOK
98 E char *strtok(char *str, const char *delim);
99 #endif
100
101 E char *spaces(int len, char *seperator);
102 E void display_monster(char *u);
103 E void display_players(char *u);
104 E int stricmp(const char *s1, const char *s2);
105 E int strnicmp(const char *s1, const char *s2, size_t len);
106 E long int chartoint(char ch);
107 E int isstringnum(char *num);
108 E long int pow (int x, int y);
109 E long int stringtoint(char *number);
110 E void init_masters();
111 E void init_monsters();
112 E bool load_monsters();
113 E void delete_monsters();
114 E void delete_masters();
115 E Monster *getNewMonster(Monster *m);
116 E void deleteMonster(Monster *m);
117 E void refresh(Player *p);
118 E void refreshall();
119 E void reset(aClient *ni);
120
121 E void do_list(char *u);
122 E void do_refresh(char *u);
123 E void do_register(char *u);
124 E void do_identify(char *u);
125 E void do_play(char *u);
126 E void do_quitg(char *u);
127 E void do_reset(char *u);
128 E void do_fight(char *u);
129 E void do_store(char *u);
130 E void do_heal(char *u);
131 E void do_bank(char *u);
132 E void do_attack(char *u);
133 E void do_run(char *u);
134 E void do_visit(char *u);
135 E void do_stats(char *u);
136 E void do_forest(char *u);
137 E void see_mystic(char *u);
138 E void showstats(const char *u, const char *nick);
139
140 /* Database saving stuff */
141
142 E int save_gs_dbase();
143 E int load_gs_dbase();
144
145 #endif