]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
P10 is now functional. The game is playable, but it does not display text nicknames...
[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 8 // 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
28 // The timestamp from load time to be compared against the current midnight time.
29 E long timestamp;
30 E void save_timestamp();
31 E void load_timestamp();
32 E long int midnight(long int offset = 8);
33
34 // The socket
35 E int sock;
36
37
38 // Random configuration stuff
39 E void load_config_file(char *config = "gameserv.conf");
40 E void unload_config_file();
41 E char *s_GameServ;
42 E char *c_Forest;
43 E char *c_ForestTopic;
44 E char *gshost;
45 E char *gsident;
46
47 #if defined(P10)
48 E char *gsnum;
49 #endif
50
51 E char *servername;
52 E char *remoteserver;
53 E char *remoteport;
54 E char *remotepass;
55 E char *playerdata;
56 E char *logfile;
57 E char *monsterdata;
58 E char *adminpass;
59 E char *VERSION;
60 E char *PACKAGE;
61 E char *welcomemsg;
62
63 E int welcomedelay;
64 E int updateperiod;
65 E int forestfights;
66
67 E List<aClient> clients;
68 E List<aClient> players;
69
70 /** List search functions **/
71 E aClient *find(char *nick);
72 E aClient *find(const char *nick);
73 E aClient *findbynick(char *nick);
74 E aClient *findbynick(const char *nick);
75 E aClient *findplayer(const char *name);
76 E aClient *findIRCplayer(const char *nick);
77
78 /** Sock writing functions **/
79 E void notice(const char *source, const char *dest, const char *fmt, ...);
80 E void raw(const char *fmt, ...);
81
82 /** gameserv.cpp **/
83 E void gameserv(char *source, char *buf);
84 E Monster *monsters[LEVELS][MONSTERS];
85
86 /** forest.cpp **/
87 E void forest(char *source, char *buf);
88
89 /** functions.cpp **/
90
91 E bool is_playing(char *u);
92 E bool is_playing(aClient *user);
93
94 E bool is_fighting(char *u);
95 E bool is_fighting(aClient *user);
96
97 E bool player_fight(char *u);
98 E bool player_fight(aClient *user);
99
100 E bool master_fight(char *u);
101 E bool master_fight(aClient *user);
102
103 #ifndef HAVE_STRTOK
104 E char *strtok(char *str, const char *delim);
105 #endif
106
107 E char *spaces(int len, char *seperator);
108 E void display_monster(char *u);
109 E void display_players(char *u);
110 E int stricmp(const char *s1, const char *s2);
111 E int strnicmp(const char *s1, const char *s2, size_t len);
112 E long int chartoint(char ch);
113 E int isstringnum(char *num);
114 E long int pow (int x, int y);
115 E long int stringtoint(char *number);
116 E void init_masters();
117 E void init_monsters();
118 E bool load_monsters();
119 E void delete_monsters();
120 E void delete_masters();
121 E Monster *getNewMonster(Monster *m);
122 E void deleteMonster(Monster *m);
123 E void refresh(Player *p);
124 E void refreshall();
125 E void reset(Player *p);
126 E void resetall();
127
128 E void do_attack(char *u);
129 E void do_bank(char *u);
130 E void do_fight(char *u);
131 E void do_forest(char *u);
132 E void do_heal(char *u);
133 E void do_identify(char *u);
134 E void do_invenory(char *u);
135 E void do_list(char *u);
136 E void do_play(char *u);
137 E void do_quitg(char *u);
138 E void do_refresh(char *u);
139 E void do_register(char *u);
140 E void do_reset(char *u);
141 E void do_run(char *u);
142 E void do_stats(char *u);
143 E void do_store(char *u);
144 E void do_tavern(char *u);
145 E void do_use(char *u);
146 E void see_mystic(char *u);
147
148 E void showstats(const char *u, const char *nick);
149 E void showinventory(aClient *from, aClient *to = NULL);
150 /* Database saving stuff */
151
152 E int save_gs_dbase();
153 E int load_gs_dbase();
154
155 // Log File Stuff
156 E void log(const char *fmt, ...);
157
158 #endif