Crossfire Server, Trunk
player.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2022 the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
19 #ifndef PLAYER_H
20 #define PLAYER_H
21 
28 typedef enum rangetype {
29  range_bottom = -1,
30  range_none = 0,
31  range_bow = 1,
33  range_misc = 3,
38 } rangetype;
39 
41 typedef enum _bowtype {
42  bow_normal = 0,
45  bow_n = 3,
46  bow_ne = 4,
47  bow_e = 5,
48  bow_se = 6,
49  bow_s = 7,
50  bow_sw = 8,
51  bow_w = 9,
52  bow_nw = 10,
54 } bowtype_t;
55 
57 typedef enum _petmode {
58  pet_normal = 0,
59  pet_sad = 1,
60  pet_defend = 2,
61  pet_arena = 3
62 } petmode_t;
63 
65 typedef enum usekeytype {
67  keyrings = 1,
69 } usekeytype;
70 
75 typedef enum unapplymode {
82 } unapplymode;
83 
87 typedef struct client_spell {
88  object *spell;
89  int16_t last_sp;
90  int16_t last_grace;
91  int16_t last_dam;
92  struct client_spell *next;
93 } client_spell;
94 
98 typedef enum party_rejoin_mode {
103 
105 typedef struct pl {
106  struct pl *next;
111  int16_t bed_x, bed_y;
116  object *ranges[range_size];
119  uint32_t golem_count;
122  uint32_t count;
123  uint32_t mode;
125  int16_t digestion;
126  int16_t gen_hp;
127  int16_t gen_sp;
128  int16_t gen_sp_armour;
129  int16_t gen_grace;
130  int16_t item_power;
131  uint8_t state;
133  uint8_t listening;
134  int8_t last_level;
138  /* Try to put all the bitfields together - saves some small amount of memory */
139  uint32_t braced:1;
140  uint32_t tmp_invis:1;
141  uint32_t do_los:1;
142  uint32_t fire_on:1;
143  uint32_t run_on:1;
144  uint32_t has_hit:1;
145  uint32_t name_changed:1;
146  uint32_t peaceful:1;
147  uint32_t hidden:1;
148  uint32_t no_shout:1;
149  uint32_t has_directory:1;
150  uint32_t partial_commands:1;
151  const char *invis_race;
157  uint16_t last_flags;
158  int32_t last_weight;
160  uint32_t last_path_attuned;
162  uint32_t last_path_denied;
164  uint16_t last_item_power;
172  float last_speed;
174  int16_t last_golem_hp;
176  object *ob;
183  char title[BIG_NAME];
185  int8_t levhp[11];
186  int8_t levsp[11];
187  int8_t levgrace[11];
189  char killer[BIG_NAME];
192  char password[16];
193  char new_password[16];
195  int16_t encumbrance;
196 #ifdef SAVE_INTERVAL
197  time_t last_save_time;
198 #endif /* SAVE_INTERVAL */
199 #ifdef AUTOSAVE
200  uint32_t last_save_tick;
201 #endif
207  struct obj *last_exit;
211  uint32_t mark_count;
212  object *mark;
213  object *transport;
215  /* Special DM fields */
219  int language;
220  const char *unarmed_skill;
221  uint32_t ticks_played;
226 } player;
227 
233 
234 #define FIND_PLAYER_PARTIAL_NAME 0x1
235 #define FIND_PLAYER_NO_HIDDEN_DM 0x2
238 
239 
244 #define ADD_PLAYER_NEW 0x1
245 #define ADD_PLAYER_NO_MAP 0x2
246 #define ADD_PLAYER_NO_STATS_ROLL 0x4
248 
249 void commit_crime(object *op, const char *description);
250 bool is_criminal(object *op);
251 
252 #endif /* PLAYER_H */
party_rejoin_no
@ party_rejoin_no
Definition: player.h:99
MAP_CLIENT_X
#define MAP_CLIENT_X
Definition: config.h:237
pl::delayed_buffers
SockList ** delayed_buffers
Definition: player.h:225
bow_nw
@ bow_nw
Definition: player.h:52
pl::count
uint32_t count
Definition: player.h:122
pl::golem_count
uint32_t golem_count
Definition: player.h:119
pl::transport
object * transport
Definition: player.h:213
pl::spellparam
char spellparam[MAX_BUF]
Definition: player.h:113
range_bow
@ range_bow
Definition: player.h:31
client_spell
Definition: player.h:87
bow_sw
@ bow_sw
Definition: player.h:50
pl::peaceful
uint32_t peaceful
Definition: player.h:146
pl::last_race_stats
living last_race_stats
Definition: player.h:169
socket_struct
Definition: newserver.h:89
client_spell::next
struct client_spell * next
Definition: player.h:92
pl::braced
uint32_t braced
Definition: player.h:139
pl::socket
socket_struct socket
Definition: player.h:107
pl::shoottype
rangetype shoottype
Definition: player.h:112
pl
Definition: player.h:105
pl::blocked_los
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Definition: player.h:177
pl::name_changed
uint32_t name_changed
Definition: player.h:145
client_spell
struct client_spell client_spell
pl::swap_first
int swap_first
Definition: player.h:165
_bowtype
_bowtype
Definition: player.h:41
pl::last_golem_hp
int16_t last_golem_hp
Definition: player.h:174
range_none
@ range_none
Definition: player.h:30
party_rejoin_if_exists
@ party_rejoin_if_exists
Definition: player.h:100
pl::mode
uint32_t mode
Definition: player.h:123
pl::ob
object * ob
Definition: player.h:176
bow_threewide
@ bow_threewide
Definition: player.h:43
client_spell::last_sp
int16_t last_sp
Definition: player.h:89
pl::delayed_buffers_used
uint8_t delayed_buffers_used
Definition: player.h:224
bowtype_t
enum _bowtype bowtype_t
pl::bowtype
bowtype_t bowtype
Definition: player.h:114
pl::partial_commands
uint32_t partial_commands
Definition: player.h:150
unapply_always
@ unapply_always
Definition: player.h:78
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
pl::last_resist
int16_t last_resist[NROFATTACKS]
Definition: player.h:173
pl::last_weapon_sp
float last_weapon_sp
Definition: player.h:156
range_golem
@ range_golem
Definition: player.h:34
pl::maplevel
char maplevel[MAX_BUF]
Definition: player.h:109
pl::gen_sp
int16_t gen_sp
Definition: player.h:127
pl::last_speed
float last_speed
Definition: player.h:172
party_rejoin_always
@ party_rejoin_always
Definition: player.h:101
obj
Definition: object.h:277
range_builder
@ range_builder
Definition: player.h:36
pl::levsp
int8_t levsp[11]
Definition: player.h:186
pl::item_power
int16_t item_power
Definition: player.h:130
bow_ne
@ bow_ne
Definition: player.h:46
pl::savebed_map
char savebed_map[MAX_BUF]
Definition: player.h:110
pl::mark
object * mark
Definition: player.h:212
pl::next
struct pl * next
Definition: player.h:106
MAP_CLIENT_Y
#define MAP_CLIENT_Y
Definition: config.h:238
titlestruct
Definition: readable.c:107
bow_n
@ bow_n
Definition: player.h:45
pl::state
uint8_t state
Definition: player.h:131
pl::digestion
int16_t digestion
Definition: player.h:125
client_spell::last_dam
int16_t last_dam
Definition: player.h:91
bow_bestarrow
@ bow_bestarrow
Definition: player.h:53
range_size
@ range_size
Definition: player.h:37
pl::tmp_invis
uint32_t tmp_invis
Definition: player.h:140
pl::unarmed_skill
const char * unarmed_skill
Definition: player.h:220
pl::last_orig_stats
living last_orig_stats
Definition: player.h:168
pet_normal
@ pet_normal
Definition: player.h:58
unapplymode
unapplymode
Definition: player.h:75
pl::petmode
petmode_t petmode
Definition: player.h:115
petmode_t
enum _petmode petmode_t
range_magic
@ range_magic
Definition: player.h:32
pet_defend
@ pet_defend
Definition: player.h:60
pl::party_to_join
partylist * party_to_join
Definition: player.h:203
bow_se
@ bow_se
Definition: player.h:48
pl::last_path_attuned
uint32_t last_path_attuned
Definition: player.h:160
client_spell::spell
object * spell
Definition: player.h:88
pl::last_character_flags
uint32_t last_character_flags
Definition: player.h:163
client_spell::last_grace
int16_t last_grace
Definition: player.h:90
pl::no_shout
uint32_t no_shout
Definition: player.h:148
pl::levgrace
int8_t levgrace[11]
Definition: player.h:187
MAX_NAME
#define MAX_NAME
Definition: define.h:41
pl::last_character_load
float last_character_load
Definition: player.h:136
pl::has_hit
uint32_t has_hit
Definition: player.h:144
player
struct pl player
range_bottom
@ range_bottom
Definition: player.h:29
sstring
const typedef char * sstring
Definition: global.h:40
pl::run_on
uint32_t run_on
Definition: player.h:143
pl::gen_hp
int16_t gen_hp
Definition: player.h:126
rangetype
rangetype
Definition: player.h:28
pl::followed_player
sstring followed_player
Definition: player.h:217
tag_t
uint32_t tag_t
Definition: object.h:12
MAX_SKILLS
#define MAX_SKILLS
Definition: skills.h:70
pl::last_golem_maxhp
int16_t last_golem_maxhp
Definition: player.h:175
pl::last_path_denied
uint32_t last_path_denied
Definition: player.h:162
pl::unapply
unapplymode unapply
Definition: player.h:121
liv
Definition: living.h:35
pl::bed_x
int16_t bed_x
Definition: player.h:111
pl::last_tell
char last_tell[MAX_NAME]
Definition: player.h:190
party_struct
Definition: party.h:10
key_inventory
@ key_inventory
Definition: player.h:66
pl::listening
uint8_t listening
Definition: player.h:133
MAX_BUF
#define MAX_BUF
Definition: define.h:35
pl::search_str
char search_str[MAX_BUF]
Definition: player.h:210
pl::levhp
int8_t levhp[11]
Definition: player.h:185
pl::last_weight
int32_t last_weight
Definition: player.h:158
bow_normal
@ bow_normal
Definition: player.h:42
pl::spell_state
client_spell * spell_state
Definition: player.h:214
pl::gen_grace
int16_t gen_grace
Definition: player.h:129
range_misc
@ range_misc
Definition: player.h:33
pl::bed_y
int16_t bed_y
Definition: player.h:111
pl::last_applied_stats
living last_applied_stats
Definition: player.h:171
bow_spreadshot
@ bow_spreadshot
Definition: player.h:44
pl::language
int language
Definition: player.h:219
pl::gen_sp_armour
int16_t gen_sp_armour
Definition: player.h:128
pl::encumbrance
int16_t encumbrance
Definition: player.h:195
unapply_nochoice
@ unapply_nochoice
Definition: player.h:76
pl::fire_on
uint32_t fire_on
Definition: player.h:142
pl::password
char password[16]
Definition: player.h:192
pl::last_skill_exp
int64_t last_skill_exp[MAX_SKILLS]
Definition: player.h:154
pl::delayed_buffers_allocated
uint8_t delayed_buffers_allocated
Definition: player.h:223
give.op
op
Definition: give.py:33
pl::has_directory
uint32_t has_directory
Definition: player.h:149
pet_sad
@ pet_sad
Definition: player.h:59
pl::do_los
uint32_t do_los
Definition: player.h:141
pl::last_weight_limit
int32_t last_weight_limit
Definition: player.h:159
pl::last_skill_ob
object * last_skill_ob[MAX_SKILLS]
Definition: player.h:153
pet_arena
@ pet_arena
Definition: player.h:61
_petmode
_petmode
Definition: player.h:57
pl::killer
char killer[BIG_NAME]
Definition: player.h:189
bow_w
@ bow_w
Definition: player.h:51
pl::rejoin_party
party_rejoin_mode rejoin_party
Definition: player.h:209
pl::stack_position
int stack_position
Definition: player.h:218
pl::new_password
char new_password[16]
Definition: player.h:193
pl::hidden
uint32_t hidden
Definition: player.h:147
pl::last_stats
living last_stats
Definition: player.h:167
pl::invis_race
const char * invis_race
Definition: player.h:151
bow_e
@ bow_e
Definition: player.h:47
pl::own_title
char own_title[MAX_NAME]
Definition: player.h:181
pl::ranges
object * ranges[range_size]
Definition: player.h:116
containers
@ containers
Definition: player.h:68
keyrings
@ keyrings
Definition: player.h:67
pl::mark_count
uint32_t mark_count
Definition: player.h:211
pl::ticks_played
uint32_t ticks_played
Definition: player.h:221
pl::last_exit
struct obj * last_exit
Definition: player.h:207
is_criminal
bool is_criminal(object *op)
Definition: player.c:312
unapply_never
@ unapply_never
Definition: player.h:77
range_skill
@ range_skill
Definition: player.h:35
pl::stack_items
tag_t * stack_items
Definition: player.h:216
commit_crime
void commit_crime(object *op, const char *description)
Definition: player.c:307
BIG_NAME
#define BIG_NAME
Definition: define.h:42
pl::character_load
float character_load
Definition: player.h:135
pl::party
partylist * party
Definition: player.h:202
pl::usekeys
usekeytype usekeys
Definition: player.h:120
bow_s
@ bow_s
Definition: player.h:49
party_rejoin_mode
party_rejoin_mode
Definition: player.h:98
SockList
Definition: newclient.h:681
pl::applied_stats
living applied_stats
Definition: player.h:170
pl::last_level
int8_t last_level
Definition: player.h:134
usekeytype
usekeytype
Definition: player.h:65
pl::last_flags
uint16_t last_flags
Definition: player.h:157
pl::orig_stats
living orig_stats
Definition: player.h:166
pl::last_item_power
uint16_t last_item_power
Definition: player.h:164
pl::last_path_repelled
uint32_t last_path_repelled
Definition: player.h:161