MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | // 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 | |
| 56 | nomask public int SetTimedAttrModifier(string key, mapping modifier, int outdated, object dependent, mixed notify); |
| 57 | nomask public mapping QueryTimedAttrModifier(string key); |
| 58 | nomask public int DeleteTimedAttrModifier(string key); |
| 59 | |
| 60 | public int SetAttr(string attr, int val); |
| 61 | nomask public void register_modifier(object modifier); |
| 62 | nomask public void deregister_modifier(object modifier); |
| 63 | |
| 64 | public int SetAttribute(string attr, int val); |
| 65 | public int SetRealAttribute(string attr, int val); |
| 66 | public int QueryAttribute(string attr); |
| 67 | public int QueryRealAttribute(string attr); |
| 68 | public int QueryAttributeOffset(string attr); |
| 69 | |
| 70 | public void UpdateAttributes(); |
| 71 | |
| 72 | public status TestLimitViolation(mapping check); |
| 73 | |
| 74 | // Set- und Query-Methoden |
| 75 | static mapping _set_attributes(mapping arr); |
| 76 | static mapping _query_attributes(); |
| 77 | static mapping _set_attributes_offsets(mapping arr); |
| 78 | static mapping _query_attributes_offsets(); |
| 79 | static mixed _set_attributes_modifier(mixed arr); |
| 80 | static mapping _query_attributes_modifier(); |
| 81 | static mixed _query_timed_attr_mod(); |
| 82 | |
| 83 | // internal |
| 84 | nomask protected void attribute_hb(); |
| 85 | protected void add_offsets(mapping arr); |
| 86 | protected nomask void calculate_valid_modifiers(); |
| 87 | protected nomask void notifyInvalidModifiers(); |
| 88 | protected int _filterattr_str(int val); |
| 89 | protected int _filterattr_dex(int val); |
| 90 | protected int _filterattr_int(int val); |
| 91 | protected int _filterattr_con(int val); |
| 92 | nomask protected void notifyExpiredModifiers(mapping nots); |
| 93 | |
| 94 | #endif // __LIVING_ATTRIBUTES_H_PROTO__ |
| 95 | |
| 96 | #endif // NEED_PROTOYPES |