diff --git a/Data/expansions/wotlk/update_fields.json b/Data/expansions/wotlk/update_fields.json index c26aefe6..12f92ceb 100644 --- a/Data/expansions/wotlk/update_fields.json +++ b/Data/expansions/wotlk/update_fields.json @@ -2,7 +2,7 @@ "OBJECT_FIELD_ENTRY": 3, "UNIT_FIELD_TARGET_LO": 6, "UNIT_FIELD_TARGET_HI": 7, - "UNIT_FIELD_BYTES_0": 56, + "UNIT_FIELD_BYTES_0": 23, "UNIT_FIELD_HEALTH": 24, "UNIT_FIELD_POWER1": 25, "UNIT_FIELD_MAXHEALTH": 32, diff --git a/include/game/entity.hpp b/include/game/entity.hpp index 702bf7a0..9f4dfde7 100644 --- a/include/game/entity.hpp +++ b/include/game/entity.hpp @@ -205,12 +205,14 @@ public: uint32_t getMaxHealth() const { return maxHealth; } void setMaxHealth(uint32_t h) { maxHealth = h; } - // Power (mana/rage/energy) - uint32_t getPower() const { return power; } - void setPower(uint32_t p) { power = p; } + // Power (mana/rage/energy) — indexed by power type (0-6) + uint32_t getPower() const { return powers[powerType < 7 ? powerType : 0]; } + void setPower(uint32_t p) { powers[powerType < 7 ? powerType : 0] = p; } + void setPowerByType(uint8_t type, uint32_t p) { if (type < 7) powers[type] = p; } - uint32_t getMaxPower() const { return maxPower; } - void setMaxPower(uint32_t p) { maxPower = p; } + uint32_t getMaxPower() const { return maxPowers[powerType < 7 ? powerType : 0]; } + void setMaxPower(uint32_t p) { maxPowers[powerType < 7 ? powerType : 0] = p; } + void setMaxPowerByType(uint8_t type, uint32_t p) { if (type < 7) maxPowers[type] = p; } uint8_t getPowerType() const { return powerType; } void setPowerType(uint8_t t) { powerType = t; } @@ -256,9 +258,9 @@ protected: std::string name; uint32_t health = 0; uint32_t maxHealth = 0; - uint32_t power = 0; - uint32_t maxPower = 0; - uint8_t powerType = 0; // 0=mana, 1=rage, 2=focus, 3=energy + uint32_t powers[7] = {}; // Indexed by power type (0=mana,1=rage,2=focus,3=energy,4=happiness,5=runes,6=runic) + uint32_t maxPowers[7] = {}; // Max values per power type + uint8_t powerType = 0; // Active power type uint32_t level = 1; uint32_t entry = 0; uint32_t displayId = 0; diff --git a/src/game/update_field_table.cpp b/src/game/update_field_table.cpp index 33bf038e..1c072bbc 100644 --- a/src/game/update_field_table.cpp +++ b/src/game/update_field_table.cpp @@ -64,7 +64,7 @@ void UpdateFieldTable::loadWotlkDefaults() { {UF::OBJECT_FIELD_ENTRY, 3}, {UF::UNIT_FIELD_TARGET_LO, 6}, {UF::UNIT_FIELD_TARGET_HI, 7}, - {UF::UNIT_FIELD_BYTES_0, 56}, + {UF::UNIT_FIELD_BYTES_0, 23}, {UF::UNIT_FIELD_HEALTH, 24}, {UF::UNIT_FIELD_POWER1, 25}, {UF::UNIT_FIELD_MAXHEALTH, 32},