diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-05-24 20:57:24 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-05-24 20:57:24 -0300 |
| commit | 3f557369c7bbd08fdf2e6dbd9271873b20a9a144 (patch) | |
| tree | 28bb9b4ad9c0324036d753eea772855a180c37f3 /src/objects.hh | |
| parent | b7432b4e74284138f1740f4577b9cb32e1f120d0 (diff) | |
| download | game-3f557369c7bbd08fdf2e6dbd9271873b20a9a144.tar.gz game-3f557369c7bbd08fdf2e6dbd9271873b20a9a144.zip | |
halfway of `map.cc` and start of `objects.cc`
Diffstat (limited to 'src/objects.hh')
| -rw-r--r-- | src/objects.hh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/objects.hh b/src/objects.hh new file mode 100644 index 0000000..3cbc401 --- /dev/null +++ b/src/objects.hh @@ -0,0 +1,73 @@ +#ifndef TIBIA_OBJECTS_HH_ +#define TIBIA_OBJECTS_HH_ 1 + +#include "common.hh" +#include "enums.hh" + +enum : int{ + TYPEID_MAP_CONTAINER = 0, + TYPEID_HEAD_CONTAINER = 1, + TYPEID_NECK_CONTAINER = 2, + TYPEID_BACKPACK_CONTAINER = 3, + TYPEID_TORSO_CONTAINER = 4, + TYPEID_RIGHTHAND_CONTAINER = 5, + TYPEID_LEFTHAND_CONTAINER = 6, + TYPEID_LEGS_CONTAINER = 7, + TYPEID_FEET_CONTAINER = 8, + TYPEID_FINGER_CONTAINER = 9, + TYPEID_AMMO_CONTAINER = 10, + TYPEID_CREATURE_CONTAINER = 99, +}; + +struct ObjectType { + // REGULAR FUNCTIONS + // ========================================================================= + ObjectType(void) { this->setTypeID(0); } + ObjectType(int TypeID) { this->setTypeID(TypeID); } + void setTypeID(int TypeID); + bool getFlag(FLAG Flag); + uint32 getAttribute(TYPEATTRIBUTE Attribute); + int getAttributeOffset(INSTANCEATTRIBUTE Attribute); + const char *getName(int Count); + const char *getDescription(void); + + bool isMapContainer(void) const { + return this->TypeID == TYPEID_MAP_CONTAINER; + } + + bool isBodyContainer(void) const { + return this->TypeID == TYPEID_HEAD_CONTAINER + || this->TypeID == TYPEID_NECK_CONTAINER + || this->TypeID == TYPEID_BACKPACK_CONTAINER + || this->TypeID == TYPEID_TORSO_CONTAINER + || this->TypeID == TYPEID_RIGHTHAND_CONTAINER + || this->TypeID == TYPEID_LEFTHAND_CONTAINER + || this->TypeID == TYPEID_LEGS_CONTAINER + || this->TypeID == TYPEID_FEET_CONTAINER + || this->TypeID == TYPEID_FINGER_CONTAINER + || this->TypeID == TYPEID_AMMO_CONTAINER; + } + + bool isCreatureContainer(void) const { + return this->TypeID == TYPEID_CREATURE_CONTAINER; + } + + // DATA + // ========================================================================= + int TypeID; +}; + +struct TObjectType { + char *Name; + char *Description; + uint8 Flags[9]; + uint32 Attributes[62]; + int AttributeOffsets[18]; +}; + +int GetInstanceAttributeByName(const char *Name); +bool ObjectTypeExists(int TypeID); +//void InitObjects(void); +//void ExitObjects(void); + +#endif //TIBIA_OBJECTS_HH_ |
