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 enum rangetype {
29  range_bottom = -1,
30  range_none = 0,
31  range_bow = 1,
33  range_misc = 3,
38 };
39 
41 enum bowtype_t {
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 };
55 
57 enum petmode_t {
58  pet_normal = 0,
59  pet_sad = 1,
60  pet_defend = 2,
61  pet_arena = 3
62 };
63 
65 enum usekeytype {
67  keyrings = 1,
69 };
70 
82 };
83 
87 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 };
94 
102 };
103 
105 struct player {
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  object *last_exit;
211  uint32_t mark_count;
212  object *mark;
213  object *transport;
215  /* Special DM fields */
220  const char *unarmed_skill;
221  uint32_t ticks_played;
226 };
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 */
player::gen_sp
int16_t gen_sp
Definition: player.h:127
party_rejoin_no
@ party_rejoin_no
Definition: player.h:99
player::do_los
uint32_t do_los
Definition: player.h:141
player::bed_y
int16_t bed_y
Definition: player.h:111
MAP_CLIENT_X
#define MAP_CLIENT_X
Definition: config.h:237
player::stack_items
tag_t * stack_items
Definition: player.h:216
player::next
player * next
Definition: player.h:106
bow_spreadshot
@ bow_spreadshot
Definition: player.h:44
bow_normal
@ bow_normal
Definition: player.h:42
player::unarmed_skill
const char * unarmed_skill
Definition: player.h:220
range_bow
@ range_bow
Definition: player.h:31
player::mode
uint32_t mode
Definition: player.h:123
language_t
void * language_t
Definition: global.h:67
player::last_golem_hp
int16_t last_golem_hp
Definition: player.h:174
bow_threewide
@ bow_threewide
Definition: player.h:43
bow_e
@ bow_e
Definition: player.h:47
client_spell
Definition: player.h:87
player::digestion
int16_t digestion
Definition: player.h:125
player
Definition: player.h:105
player::gen_grace
int16_t gen_grace
Definition: player.h:129
player::golem_count
uint32_t golem_count
Definition: player.h:119
socket_struct
Definition: newserver.h:89
player::spell_state
client_spell * spell_state
Definition: player.h:214
player::mark_count
uint32_t mark_count
Definition: player.h:211
bowtype_t
bowtype_t
Definition: player.h:41
pet_defend
@ pet_defend
Definition: player.h:60
player::bed_x
int16_t bed_x
Definition: player.h:111
client_spell::next
struct client_spell * next
Definition: player.h:92
player::no_shout
uint32_t no_shout
Definition: player.h:148
player::peaceful
uint32_t peaceful
Definition: player.h:146
player::ob
object * ob
Definition: player.h:176
bow_ne
@ bow_ne
Definition: player.h:46
player::transport
object * transport
Definition: player.h:213
player::last_applied_stats
living last_applied_stats
Definition: player.h:171
player::levhp
int8_t levhp[11]
Definition: player.h:185
range_none
@ range_none
Definition: player.h:30
party_rejoin_if_exists
@ party_rejoin_if_exists
Definition: player.h:100
player::delayed_buffers
SockList ** delayed_buffers
Definition: player.h:225
player::last_path_denied
uint32_t last_path_denied
Definition: player.h:162
client_spell::last_sp
int16_t last_sp
Definition: player.h:89
player::partial_commands
uint32_t partial_commands
Definition: player.h:150
player::last_level
int8_t last_level
Definition: player.h:134
player::levsp
int8_t levsp[11]
Definition: player.h:186
player::savebed_map
char savebed_map[MAX_BUF]
Definition: player.h:110
player::last_stats
living last_stats
Definition: player.h:167
player::hidden
uint32_t hidden
Definition: player.h:147
unapply_always
@ unapply_always
Definition: player.h:78
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
range_golem
@ range_golem
Definition: player.h:34
partylist
Definition: party.h:10
player::applied_stats
living applied_stats
Definition: player.h:170
bow_bestarrow
@ bow_bestarrow
Definition: player.h:53
player::swap_first
int swap_first
Definition: player.h:165
bow_sw
@ bow_sw
Definition: player.h:50
party_rejoin_always
@ party_rejoin_always
Definition: player.h:101
range_builder
@ range_builder
Definition: player.h:36
MAP_CLIENT_Y
#define MAP_CLIENT_Y
Definition: config.h:238
player::killer
char killer[BIG_NAME]
Definition: player.h:189
player::last_speed
float last_speed
Definition: player.h:172
player::run_on
uint32_t run_on
Definition: player.h:143
client_spell::last_dam
int16_t last_dam
Definition: player.h:91
range_size
@ range_size
Definition: player.h:37
player::blocked_los
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Definition: player.h:177
player::last_flags
uint16_t last_flags
Definition: player.h:157
player::followed_player
sstring followed_player
Definition: player.h:217
unapplymode
unapplymode
Definition: player.h:75
player::ranges
object * ranges[range_size]
Definition: player.h:116
player::delayed_buffers_used
uint8_t delayed_buffers_used
Definition: player.h:224
range_magic
@ range_magic
Definition: player.h:32
petmode_t
petmode_t
Definition: player.h:57
bow_w
@ bow_w
Definition: player.h:51
player::last_path_attuned
uint32_t last_path_attuned
Definition: player.h:160
player::encumbrance
int16_t encumbrance
Definition: player.h:195
player::last_character_flags
uint32_t last_character_flags
Definition: player.h:163
player::last_skill_exp
int64_t last_skill_exp[MAX_SKILLS]
Definition: player.h:154
client_spell::spell
object * spell
Definition: player.h:88
player::levgrace
int8_t levgrace[11]
Definition: player.h:187
client_spell::last_grace
int16_t last_grace
Definition: player.h:90
player::tmp_invis
uint32_t tmp_invis
Definition: player.h:140
bow_nw
@ bow_nw
Definition: player.h:52
title
Definition: readable.cpp:108
MAX_NAME
#define MAX_NAME
Definition: define.h:41
player::item_power
int16_t item_power
Definition: player.h:130
range_bottom
@ range_bottom
Definition: player.h:29
sstring
const typedef char * sstring
Definition: global.h:47
rangetype
rangetype
Definition: player.h:28
tag_t
uint32_t tag_t
Definition: object.h:12
player::shoottype
rangetype shoottype
Definition: player.h:112
player::last_weight_limit
int32_t last_weight_limit
Definition: player.h:159
MAX_SKILLS
#define MAX_SKILLS
Definition: skills.h:70
player::last_race_stats
living last_race_stats
Definition: player.h:169
player::maplevel
char maplevel[MAX_BUF]
Definition: player.h:109
player::fire_on
uint32_t fire_on
Definition: player.h:142
player::last_item_power
uint16_t last_item_power
Definition: player.h:164
living
Definition: living.h:35
key_inventory
@ key_inventory
Definition: player.h:66
player::last_skill_ob
object * last_skill_ob[MAX_SKILLS]
Definition: player.h:153
MAX_BUF
#define MAX_BUF
Definition: define.h:35
player::last_weight
int32_t last_weight
Definition: player.h:158
player::listening
uint8_t listening
Definition: player.h:133
player::orig_stats
living orig_stats
Definition: player.h:166
pet_sad
@ pet_sad
Definition: player.h:59
player::unapply
unapplymode unapply
Definition: player.h:121
player::last_golem_maxhp
int16_t last_golem_maxhp
Definition: player.h:175
player::gen_sp_armour
int16_t gen_sp_armour
Definition: player.h:128
player::search_str
char search_str[MAX_BUF]
Definition: player.h:210
player::new_password
char new_password[16]
Definition: player.h:193
player::gen_hp
int16_t gen_hp
Definition: player.h:126
player::mark
object * mark
Definition: player.h:212
range_misc
@ range_misc
Definition: player.h:33
pet_normal
@ pet_normal
Definition: player.h:58
player::has_hit
uint32_t has_hit
Definition: player.h:144
player::party_to_join
partylist * party_to_join
Definition: player.h:203
unapply_nochoice
@ unapply_nochoice
Definition: player.h:76
player::own_title
char own_title[MAX_NAME]
Definition: player.h:181
give.op
op
Definition: give.py:33
player::language
language_t language
Definition: player.h:219
player::state
uint8_t state
Definition: player.h:131
player::braced
uint32_t braced
Definition: player.h:139
pet_arena
@ pet_arena
Definition: player.h:61
player::last_orig_stats
living last_orig_stats
Definition: player.h:168
bow_n
@ bow_n
Definition: player.h:45
bow_s
@ bow_s
Definition: player.h:49
player::last_resist
int16_t last_resist[NROFATTACKS]
Definition: player.h:173
player::party
partylist * party
Definition: player.h:202
containers
@ containers
Definition: player.h:68
keyrings
@ keyrings
Definition: player.h:67
player::count
uint32_t count
Definition: player.h:122
player::last_tell
char last_tell[MAX_NAME]
Definition: player.h:190
player::character_load
float character_load
Definition: player.h:135
player::delayed_buffers_allocated
uint8_t delayed_buffers_allocated
Definition: player.h:223
player::has_directory
uint32_t has_directory
Definition: player.h:149
player::last_path_repelled
uint32_t last_path_repelled
Definition: player.h:161
player::password
char password[16]
Definition: player.h:192
player::stack_position
int stack_position
Definition: player.h:218
player::socket
socket_struct * socket
Definition: player.h:107
is_criminal
bool is_criminal(object *op)
Definition: player.cpp:312
unapply_never
@ unapply_never
Definition: player.h:77
range_skill
@ range_skill
Definition: player.h:35
commit_crime
void commit_crime(object *op, const char *description)
Definition: player.cpp:307
BIG_NAME
#define BIG_NAME
Definition: define.h:42
bow_se
@ bow_se
Definition: player.h:48
player::petmode
petmode_t petmode
Definition: player.h:115
player::last_exit
object * last_exit
Definition: player.h:207
player::last_weapon_sp
float last_weapon_sp
Definition: player.h:156
player::invis_race
const char * invis_race
Definition: player.h:151
player::spellparam
char spellparam[MAX_BUF]
Definition: player.h:113
party_rejoin_mode
party_rejoin_mode
Definition: player.h:98
player::name_changed
uint32_t name_changed
Definition: player.h:145
SockList
Definition: newclient.h:681
player::bowtype
bowtype_t bowtype
Definition: player.h:114
player::last_character_load
float last_character_load
Definition: player.h:136
usekeytype
usekeytype
Definition: player.h:65
player::ticks_played
uint32_t ticks_played
Definition: player.h:221
player::usekeys
usekeytype usekeys
Definition: player.h:120
player::rejoin_party
party_rejoin_mode rejoin_party
Definition: player.h:209