blob: 8f282996aec205b98d9ac2407f056bdf5980ae10 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// living/attributes.h -- living attributes
4//
5// $Id: attributes.h 6282 2007-05-09 20:55:17Z Zesstra $
6
7#ifndef __LIVING_ATTRIBUTES_H__
8#define __LIVING_ATTRIBUTES_H__
9
10// properties
11
12#define P_ATTRIBUTES "attributes"
13#define P_ATTRIBUTES_OFFSETS "attributes_offsets"
14#define P_ATTRIBUTES_MODIFIER "attributes_modifier"
15#define P_X_ATTR_MOD "extern_attributes_modifier"
16#define P_X_HEALTH_MOD "extern_health_modifier"
17#define P_M_ATTR_MOD "magic_attributes_modifier"
18#define P_M_HEALTH_MOD "magic_health_modifier"
19#define P_ABILITIES "abilities"
20#define P_TIMED_ATTR_MOD "timed_attr_mod"
21
22// special defines
23
24/* standard attributes */
25#define A_STR "str"
26#define A_INT "int"
27#define A_DEX "dex"
28#define A_CON "con"
29
30/* errorcodes for P_TIMED_ATTR_MOD */
31#define TATTR_OK 0
32#define TATTR_NO_SUCH_MODIFIER 1
33#define TATTR_INVALID_ARGS 2
34
35/* indices used for P_TIMED_ATTR_MOD */
36#define TATTR_OUTDATE 0
37#define TATTR_DEPENDENTS 1
38#define TATTR_ENTRIES 2
39#define TATTR_MOD 0
40#define TATTR_OUTDATED 1
41#define TATTR_DEPENDENT 2
42#define TATTR_NOTIFY 3
43
44/* maximum of cumulative attribute modifiers */
45#define CUMULATIVE_ATTR_LIMIT 4
46
47#endif // __LIVING_ATTRIBUTES_H__
48
49#ifdef NEED_PROTOTYPES
50
51#ifndef __LIVING_ATTRIBUTES_H_PROTO__
52#define __LIVING_ATTRIBUTES_H_PROTO__
53
54// prototypes
55
56nomask public int SetTimedAttrModifier(string key, mapping modifier, int outdated, object dependent, mixed notify);
57nomask public mapping QueryTimedAttrModifier(string key);
58nomask public int DeleteTimedAttrModifier(string key);
59
60public int SetAttr(string attr, int val);
61nomask public void register_modifier(object modifier);
62nomask public void deregister_modifier(object modifier);
63
64public int SetAttribute(string attr, int val);
65public int SetRealAttribute(string attr, int val);
66public int QueryAttribute(string attr);
67public int QueryRealAttribute(string attr);
68public int QueryAttributeOffset(string attr);
69
70public void UpdateAttributes();
71
72public status TestLimitViolation(mapping check);
73
74// Set- und Query-Methoden
75static mapping _set_attributes(mapping arr);
76static mapping _query_attributes();
77static mapping _set_attributes_offsets(mapping arr);
78static mapping _query_attributes_offsets();
79static mixed _set_attributes_modifier(mixed arr);
80static mapping _query_attributes_modifier();
81static mixed _query_timed_attr_mod();
82
83// internal
84nomask protected void attribute_hb();
85protected void add_offsets(mapping arr);
86protected nomask void calculate_valid_modifiers();
87protected nomask void notifyInvalidModifiers();
88protected int _filterattr_str(int val);
89protected int _filterattr_dex(int val);
90protected int _filterattr_int(int val);
91protected int _filterattr_con(int val);
92nomask protected void notifyExpiredModifiers(mapping nots);
93
94#endif // __LIVING_ATTRIBUTES_H_PROTO__
95
96#endif // NEED_PROTOYPES