Crossfire Server, Trunk  1.75.0
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;
173  float last_speed;
175  int16_t last_golem_hp;
177  object *ob;
184  char title[BIG_NAME];
186  int8_t levhp[11];
187  int8_t levsp[11];
188  int8_t levgrace[11];
190  char killer[BIG_NAME];
193  char password[16];
194  char new_password[16];
196  int16_t encumbrance;
197 #ifdef SAVE_INTERVAL
198  time_t last_save_time;
199 #endif /* SAVE_INTERVAL */
200 #ifdef AUTOSAVE
201  uint32_t last_save_tick;
202 #endif
208  object *last_exit;
212  uint32_t mark_count;
213  object *mark;
214  object *transport;
216  /* Special DM fields */
221  const char *unarmed_skill;
222  uint32_t ticks_played;
227  bool is_wraith;
229 };
230 
236 
237 #define FIND_PLAYER_PARTIAL_NAME 0x1
238 #define FIND_PLAYER_NO_HIDDEN_DM 0x2
241 
242 
247 #define ADD_PLAYER_NEW 0x1
248 #define ADD_PLAYER_NO_MAP 0x2
249 #define ADD_PLAYER_NO_STATS_ROLL 0x4
251 
252 void commit_crime(object *op, const char *description);
253 bool is_criminal(object *op);
254 
255 #endif /* PLAYER_H */
player::gen_sp
int16_t gen_sp
Bonuses to regeneration speed of sp.
Definition: player.h:127
party_rejoin_no
@ party_rejoin_no
Don't rejoin.
Definition: player.h:99
player::do_los
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
Definition: player.h:141
player::bed_y
int16_t bed_y
x,y - coordinates of respawn (savebed).
Definition: player.h:111
MAP_CLIENT_X
#define MAP_CLIENT_X
This determines the maximum map size the client can request (and thus what the server will send to th...
Definition: config.h:237
player::stack_items
tag_t * stack_items
Item stack for patch/dump/...
Definition: player.h:217
player::next
player * next
Pointer to next player, NULL if this is last.
Definition: player.h:106
bow_spreadshot
@ bow_spreadshot
Fire three arrows in a cone.
Definition: player.h:44
bow_normal
@ bow_normal
Standard mode, one random arrow.
Definition: player.h:42
player::unarmed_skill
const char * unarmed_skill
Prefered skill to use in unarmed combat.
Definition: player.h:221
range_bow
@ range_bow
Bow.
Definition: player.h:31
player::mode
uint32_t mode
Mode of player for pickup.
Definition: player.h:123
language_t
void * language_t
Strings that should be manipulated through add_string() and free_string().
Definition: global.h:69
player::last_golem_hp
int16_t last_golem_hp
Last golem hp value sent to the client.
Definition: player.h:175
bow_threewide
@ bow_threewide
Fire three arrows in the same direction.
Definition: player.h:43
bow_e
@ bow_e
Fire east whatever the facing direction.
Definition: player.h:47
client_spell
This stores, for a spell a player knows, the last sp/gr/dam information sent to client.
Definition: player.h:87
player::digestion
int16_t digestion
Any bonuses/penalties to digestion.
Definition: player.h:125
player
One player.
Definition: player.h:105
player::gen_grace
int16_t gen_grace
Bonuses to regeneration speed of grace.
Definition: player.h:129
player::golem_count
uint32_t golem_count
To track the golem.
Definition: player.h:119
player::is_wraith
bool is_wraith
Whether this player is a wraith or not, initialized at load time.
Definition: player.h:227
socket_struct
Socket structure, represents a client-server connection.
Definition: newserver.h:89
player::spell_state
client_spell * spell_state
Spell information sent to client.
Definition: player.h:215
player::mark_count
uint32_t mark_count
Count of marked object.
Definition: player.h:212
bowtype_t
bowtype_t
Bow firing mode.
Definition: player.h:41
pet_defend
@ pet_defend
Stay close to the owner.
Definition: player.h:60
player::bed_x
int16_t bed_x
Definition: player.h:111
client_spell::next
struct client_spell * next
Next spell information.
Definition: player.h:92
player::no_shout
uint32_t no_shout
if True, player is *not *able to use shout command.
Definition: player.h:148
player::peaceful
uint32_t peaceful
If set, won't attack friendly creatures.
Definition: player.h:146
player::ob
object * ob
The object representing the player.
Definition: player.h:177
bow_ne
@ bow_ne
Fire north-east whatever the facing direction.
Definition: player.h:46
player::transport
object * transport
Transport the player is in.
Definition: player.h:214
player::last_applied_stats
living last_applied_stats
Last applied stats sent to the client.
Definition: player.h:172
player::levhp
int8_t levhp[11]
What hp bonus the player gained on that level.
Definition: player.h:186
range_none
@ range_none
No range selected.
Definition: player.h:30
party_rejoin_if_exists
@ party_rejoin_if_exists
Rejoin if party exists.
Definition: player.h:100
player::delayed_buffers
SockList ** delayed_buffers
Buffers which will be sent after the player's tick completes.
Definition: player.h:226
player::last_path_denied
uint32_t last_path_denied
Last spell denied sent to client.
Definition: player.h:162
client_spell::last_sp
int16_t last_sp
Last spell cost.
Definition: player.h:89
player::partial_commands
uint32_t partial_commands
If 1, then first letters of a command are enough if no ambiguity in name.
Definition: player.h:150
player::last_level
int8_t last_level
Last level we sent to client.
Definition: player.h:134
player::levsp
int8_t levsp[11]
What sp bonus the player gained on that level.
Definition: player.h:187
player::savebed_map
char savebed_map[MAX_BUF]
Map where player will respawn after death.
Definition: player.h:110
player::last_stats
living last_stats
Last stats as sent to client.
Definition: player.h:168
player::hidden
uint32_t hidden
If True, player (DM) is hidden from view.
Definition: player.h:147
unapply_always
@ unapply_always
Will unapply whatever is necessary - this goes beyond no choice - if there are multiple ojbect of the...
Definition: player.h:78
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
range_golem
@ range_golem
Control golem.
Definition: player.h:34
partylist
One party.
Definition: party.h:10
player::applied_stats
living applied_stats
Stat changes due to gear or skills.
Definition: player.h:171
bow_bestarrow
@ bow_bestarrow
Try to find an arrow matching the target.
Definition: player.h:53
player::swap_first
int swap_first
First stat player has selected to swap.
Definition: player.h:166
bow_sw
@ bow_sw
Fire south-west whatever the facing direction.
Definition: player.h:50
party_rejoin_always
@ party_rejoin_always
If party doesn't exist, form it.
Definition: player.h:101
range_builder
@ range_builder
Map builder.
Definition: player.h:36
MAP_CLIENT_Y
#define MAP_CLIENT_Y
Definition: config.h:238
player::killer
char killer[BIG_NAME]
Who killed this player.
Definition: player.h:190
player::last_speed
float last_speed
Last speed as sent to client.
Definition: player.h:173
player::run_on
uint32_t run_on
Player should keep moving in dir until run is off.
Definition: player.h:143
client_spell::last_dam
int16_t last_dam
Last damage.
Definition: player.h:91
range_size
@ range_size
Maximum, exclusive, value.
Definition: player.h:37
player::blocked_los
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Array showing what spaces the player can see.
Definition: player.h:178
player::last_flags
uint16_t last_flags
Fire/run on flags for last tick.
Definition: player.h:157
player::followed_player
sstring followed_player
Player the DM is following.
Definition: player.h:218
unapplymode
unapplymode
This is used to control what to do when we need to unapply an object before we can apply another one.
Definition: player.h:75
player::ranges
object * ranges[range_size]
Object for each range.
Definition: player.h:116
player::delayed_buffers_used
uint8_t delayed_buffers_used
Used items in delayed_buffers_used.
Definition: player.h:225
range_magic
@ range_magic
Spells.
Definition: player.h:32
petmode_t
petmode_t
Petmode.
Definition: player.h:57
bow_w
@ bow_w
Fire west whatever the facing direction.
Definition: player.h:51
player::last_path_attuned
uint32_t last_path_attuned
Last spell attunment sent to client.
Definition: player.h:160
player::encumbrance
int16_t encumbrance
How much our player is encumbered.
Definition: player.h:196
player::last_character_flags
uint32_t last_character_flags
Last character flags (CS_STAT_CHARACTER_FLAGS) sent to client.
Definition: player.h:163
player::last_skill_exp
int64_t last_skill_exp[MAX_SKILLS]
Last exp sent to client.
Definition: player.h:154
client_spell::spell
object * spell
Spell object this structure is about.
Definition: player.h:88
description
spell prayer lvl t sp speed range duration short description
Definition: spell-summary.txt:2
player::levgrace
int8_t levgrace[11]
What grace bonus the player gained on that level.
Definition: player.h:188
client_spell::last_grace
int16_t last_grace
Last grace cost.
Definition: player.h:90
player::tmp_invis
uint32_t tmp_invis
Will invis go away when we attack?
Definition: player.h:140
bow_nw
@ bow_nw
Fire north-west whatever the facing direction.
Definition: player.h:52
title
Information on one title.
Definition: readable.cpp:108
MAX_NAME
#define MAX_NAME
Definition: define.h:41
player::item_power
int16_t item_power
Total item power of objects equipped.
Definition: player.h:130
range_bottom
@ range_bottom
Minimum, exclusive, value.
Definition: player.h:29
rangetype
rangetype
What range is currently selected by the player.
Definition: player.h:28
tag_t
uint32_t tag_t
Object tag, unique during the whole game.
Definition: object.h:14
player::shoottype
rangetype shoottype
Which range-attack is being used by player.
Definition: player.h:112
player::last_weight_limit
int32_t last_weight_limit
Last weight limit transmitted to client.
Definition: player.h:159
MAX_SKILLS
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
Definition: skills.h:70
player::last_race_stats
living last_race_stats
Last race stats sent to the client.
Definition: player.h:170
player::maplevel
char maplevel[MAX_BUF]
On which level is the player?
Definition: player.h:109
player::fire_on
uint32_t fire_on
Player should fire object, not move.
Definition: player.h:142
player::last_item_power
uint16_t last_item_power
Last value for item_power.
Definition: player.h:164
living
Various statistics of objects.
Definition: living.h:35
key_inventory
@ key_inventory
Only use keys in inventory.
Definition: player.h:66
player::last_skill_ob
object * last_skill_ob[MAX_SKILLS]
Exp objects sent to client.
Definition: player.h:153
MAX_BUF
#define MAX_BUF
Used for all kinds of things.
Definition: define.h:35
player::last_weight
int32_t last_weight
Last weight as sent to client; -1 means do not send weight.
Definition: player.h:158
player::listening
uint8_t listening
Which priority will be used in info_all.
Definition: player.h:133
player::orig_stats
living orig_stats
Permanent real stats of player.
Definition: player.h:167
pet_sad
@ pet_sad
Try to find enemies.
Definition: player.h:59
player::unapply
unapplymode unapply
Method for auto unapply.
Definition: player.h:121
player::last_golem_maxhp
int16_t last_golem_maxhp
Last golem max hp value sent to the client.
Definition: player.h:176
player::gen_sp_armour
int16_t gen_sp_armour
Penalty to sp regen from armour.
Definition: player.h:128
player::search_str
char search_str[MAX_BUF]
Item we are looking for.
Definition: player.h:211
player::new_password
char new_password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
Definition: player.h:194
player::gen_hp
int16_t gen_hp
Bonuses to regeneration speed of hp.
Definition: player.h:126
player::mark
object * mark
Marked object.
Definition: player.h:213
range_misc
@ range_misc
Misc items.
Definition: player.h:33
pet_normal
@ pet_normal
Standard mode/.
Definition: player.h:58
player::has_hit
uint32_t has_hit
If set, weapon_sp instead of speed will count.
Definition: player.h:144
player::party_to_join
partylist * party_to_join
Used when player wants to join a party but we will have to get password first so we have to remember ...
Definition: player.h:204
unapply_nochoice
@ unapply_nochoice
Will unapply objects when there no choice to unapply.
Definition: player.h:76
player::is_old_wraith
bool is_old_wraith
Whether this player is a "old" wraith, initialized at load time and updated when eating.
Definition: player.h:228
player::own_title
char own_title[MAX_NAME]
Title the player has chosen for themself.
Definition: player.h:182
sstring
const typedef char * sstring
Definition: sstring.h:2
player::language
language_t language
The language the player wishes to use.
Definition: player.h:220
player::state
uint8_t state
Input state of the player (name, password, etc).
Definition: player.h:131
player::braced
uint32_t braced
Will not move if braced, only attack.
Definition: player.h:139
pet_arena
@ pet_arena
Attack other players in arena.
Definition: player.h:61
player::last_orig_stats
living last_orig_stats
Last permanent stats sent to client.
Definition: player.h:169
bow_n
@ bow_n
Fire north whatever the facing direction.
Definition: player.h:45
bow_s
@ bow_s
Fire south whatever the facing direction.
Definition: player.h:49
player::last_resist
int16_t last_resist[NROFATTACKS]
last resist values sent to client.
Definition: player.h:174
player::party
partylist * party
Party this player is part of.
Definition: player.h:203
containers
@ containers
Use keys in inventory and active containers.
Definition: player.h:68
keyrings
@ keyrings
Use keys in inventory and active key rings.
Definition: player.h:67
player::count
uint32_t count
Any numbers typed before a command.
Definition: player.h:122
player::last_examined
tag_t last_examined
Tag of most recently 'examined object.
Definition: player.h:165
player::last_tell
char last_tell[MAX_NAME]
last player that told you something [mids 01/14/2002].
Definition: player.h:191
player::character_load
float character_load
Value between 0 and 1 indicating how much the character is overloaded.
Definition: player.h:135
player::delayed_buffers_allocated
uint8_t delayed_buffers_allocated
Number of items in delayed_buffers_used.
Definition: player.h:224
player::has_directory
uint32_t has_directory
If 0, the player was not yet saved, its directory doesn't exist.
Definition: player.h:149
player::last_path_repelled
uint32_t last_path_repelled
Last spell repelled sent to client.
Definition: player.h:161
player::password
char password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
Definition: player.h:193
player::stack_position
int stack_position
Current stack position, 0 for no item.
Definition: player.h:219
player::socket
socket_struct * socket
Socket information for this player.
Definition: player.h:107
is_criminal
bool is_criminal(object *op)
Definition: player.cpp:312
unapply_never
@ unapply_never
Will not unapply objects automatically.
Definition: player.h:77
range_skill
@ range_skill
Use 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
Fire south-east whatever the facing direction.
Definition: player.h:48
player::petmode
petmode_t petmode
Which petmode?
Definition: player.h:115
player::last_exit
object * last_exit
Last exit used by player or NULL.
Definition: player.h:208
player::last_weapon_sp
float last_weapon_sp
if diff than weapon_sp, update client.
Definition: player.h:156
player::invis_race
const char * invis_race
What race invisible to?
Definition: player.h:151
player::spellparam
char spellparam[MAX_BUF]
What param to add to spells.
Definition: player.h:113
party_rejoin_mode
party_rejoin_mode
Whether to rejoin party at login or not.
Definition: player.h:98
player::name_changed
uint32_t name_changed
If true, the player has set a name.
Definition: player.h:145
SockList
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:684
player::bowtype
bowtype_t bowtype
Which firemode?
Definition: player.h:114
player::last_character_load
float last_character_load
Last value sent to the client.
Definition: player.h:136
usekeytype
usekeytype
How to use keys.
Definition: player.h:65
player::ticks_played
uint32_t ticks_played
How many ticks this player has played.
Definition: player.h:222
player::usekeys
usekeytype usekeys
Method for finding keys for doors.
Definition: player.h:120
player::rejoin_party
party_rejoin_mode rejoin_party
Whether to rejoin or not party at login.
Definition: player.h:210