]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
Added the USE command and a few other changes to code
[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 E int forestfights;
59
60 E List<aClient> clients;
61 E List<aClient> players;
62
63 /** List search functions **/
64 E aClient *find(char *nick);
65 E aClient *find(const char *nick);
66 E aClient *findbynick(char *nick);
67 E aClient *findbynick(const char *nick);
68 E aClient *findplayer(const char *name);
69
70 /** Sock writing functions **/
71 E void notice(const char *source, const char *dest, const char *fmt, ...);
72 E void raw(const char *fmt, ...);
73
74 /** gameserv.cpp **/
75 E void gameserv(char *source, char *buf);
76 E Monster *monsters[LEVELS][MONSTERS];
77
78 /** forest.cpp **/
79 E void forest(char *source, char *buf);
80
81 /** functions.cpp **/
82
83 E bool is_playing(char *u);
84 E bool is_playing(aClient *user);
85
86 E bool is_fighting(char *u);
87 E bool is_fighting(aClient *user);
88
89 E bool player_fight(char *u);
90 E bool player_fight(aClient *user);
91
92 E bool master_fight(char *u);
93 E bool master_fight(aClient *user);
94
95 E bool is_alive(char *u);
96 E bool is_alive(aClient *user);
97
98 #ifndef HAVE_STRTOK
99 E char *strtok(char *str, const char *delim);
100 #endif
101
102 E char *spaces(int len, char *seperator);
103 E void display_monster(char *u);
104 E void display_players(char *u);
105 E int stricmp(const char *s1, const char *s2);
106 E int strnicmp(const char *s1, const char *s2, size_t len);
107 E long int chartoint(char ch);
108 E int isstringnum(char *num);
109 E long int pow (int x, int y);
110 E long int stringtoint(char *number);
111 E void init_masters();
112 E void init_monsters();
113 E bool load_monsters();
114 E void delete_monsters();
115 E void delete_masters();
116 E Monster *getNewMonster(Monster *m);
117 E void deleteMonster(Monster *m);
118 E void refresh(Player *p);
119 E void refreshall();
120 E void reset(aClient *ni);
121
122 E void do_attack(char *u);
123 E void do_bank(char *u);
124 E void do_fight(char *u);
125 E void do_forest(char *u);
126 E void do_heal(char *u);
127 E void do_identify(char *u);
128 E void do_invenory(char *u);
129 E void do_list(char *u);
130 E void do_play(char *u);
131 E void do_quitg(char *u);
132 E void do_refresh(char *u);
133 E void do_register(char *u);
134 E void do_reset(char *u);
135 E void do_run(char *u);
136 E void do_stats(char *u);
137 E void do_store(char *u);
138 E void do_tavern(char *u);
139 E void do_use(char *u);
140 E void see_mystic(char *u);
141
142 E void showstats(const char *u, const char *nick);
143 E void showinventory(aClient *from, aClient *to = NULL);
144 /* Database saving stuff */
145
146 E int save_gs_dbase();
147 E int load_gs_dbase();
148
149 #endif