From 915f8a9d2c2244a0f32e3dd4983ccb47e90ee8fa Mon Sep 17 00:00:00 2001 From: ForesterDev <11771800+ForesterDev@users.noreply.github.com> Date: Thu, 25 Jul 2019 01:53:31 +0400 Subject: Core/Totems: update select display for shaman totems (#23583) (cherry picked from commit 8ca6a20e7303e942adfb6d97b9aa94fab7c6b895) # Conflicts: # src/server/game/Entities/Totem/Totem.cpp # src/server/game/Entities/Unit/Unit.cpp # src/server/game/Entities/Unit/Unit.h # src/server/game/Spells/SpellMgr.cpp # src/server/game/Spells/SpellMgr.h # src/server/game/World/World.cpp --- src/server/game/Entities/Totem/Totem.cpp | 26 +++++----- src/server/game/Entities/Unit/Unit.cpp | 83 -------------------------------- src/server/game/Entities/Unit/Unit.h | 18 ------- 3 files changed, 15 insertions(+), 112 deletions(-) (limited to 'src/server/game/Entities') diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 47d1cceb7fa..294306bd9a5 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -18,6 +18,7 @@ #include "Totem.h" #include "Group.h" +#include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" #include "SpellHistory.h" @@ -54,19 +55,22 @@ void Totem::Update(uint32 time) void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem - if (GetOwner()->GetTypeId() == TYPEID_PLAYER - && m_Properties->Slot >= SUMMON_SLOT_TOTEM - && m_Properties->Slot < MAX_TOTEM_SLOT) + if (Player* owner = GetOwner()->ToPlayer()) { - WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); - data << uint8(m_Properties->Slot - 1); - data << uint64(GetGUID()); - data << uint32(duration); - data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); - GetOwner()->ToPlayer()->SendDirectMessage(&data); + uint32 slot = m_Properties->Slot; + if (slot >= SUMMON_SLOT_TOTEM_FIRE && slot < MAX_TOTEM_SLOT) + { + WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); + data << uint8(m_Properties->Slot - 1); + data << uint64(GetGUID()); + data << uint32(duration); + data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); + GetOwner()->ToPlayer()->SendDirectMessage(&data); + } // set display id depending on caster's race - SetDisplayId(GetOwner()->GetModelForTotem(PlayerTotemType(m_Properties->Id))); + if (uint32 totemDisplayId = sObjectMgr->GetModelForTotem(SummonSlot(slot), Races(owner->GetRace()))) + SetDisplayId(totemDisplayId); } Minion::InitStats(duration); @@ -108,7 +112,7 @@ void Totem::UnSummon(uint32 msTime) RemoveAurasDueToSpell(GetSpell(), GetGUID()); // clear owner's totem slot - for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) + for (uint8 i = SUMMON_SLOT_TOTEM_FIRE; i < MAX_TOTEM_SLOT; ++i) { if (GetOwner()->m_SummonSlot[i] == GetGUID()) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index dee11e65a3b..e864a17117d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12266,89 +12266,6 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const return modelid; } -uint32 Unit::GetModelForTotem(PlayerTotemType totemType) -{ - switch (GetRace()) - { - case RACE_ORC: - { - switch (totemType) - { - case SUMMON_TYPE_TOTEM_FIRE: // fire - return 30758; - case SUMMON_TYPE_TOTEM_EARTH: // earth - return 30757; - case SUMMON_TYPE_TOTEM_WATER: // water - return 30759; - case SUMMON_TYPE_TOTEM_AIR: // air - return 30756; - } - break; - } - case RACE_DWARF: - { - switch (totemType) - { - case SUMMON_TYPE_TOTEM_FIRE: // fire - return 30754; - case SUMMON_TYPE_TOTEM_EARTH: // earth - return 30753; - case SUMMON_TYPE_TOTEM_WATER: // water - return 30755; - case SUMMON_TYPE_TOTEM_AIR: // air - return 30736; - } - break; - } - case RACE_TROLL: - { - switch (totemType) - { - case SUMMON_TYPE_TOTEM_FIRE: // fire - return 30762; - case SUMMON_TYPE_TOTEM_EARTH: // earth - return 30761; - case SUMMON_TYPE_TOTEM_WATER: // water - return 30763; - case SUMMON_TYPE_TOTEM_AIR: // air - return 30760; - } - break; - } - case RACE_TAUREN: - { - switch (totemType) - { - case SUMMON_TYPE_TOTEM_FIRE: // fire - return 4589; - case SUMMON_TYPE_TOTEM_EARTH: // earth - return 4588; - case SUMMON_TYPE_TOTEM_WATER: // water - return 4587; - case SUMMON_TYPE_TOTEM_AIR: // air - return 4590; - } - break; - } - case RACE_DRAENEI: - { - switch (totemType) - { - case SUMMON_TYPE_TOTEM_FIRE: // fire - return 19074; - case SUMMON_TYPE_TOTEM_EARTH: // earth - return 19073; - case SUMMON_TYPE_TOTEM_WATER: // water - return 19075; - case SUMMON_TYPE_TOTEM_AIR: // air - return 19071; - } - break; - } - } - return 0; -} - void Unit::JumpTo(float speedXY, float speedZ, bool forward) { float angle = forward ? 0 : float(M_PI); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 16d1ffb5e34..aefbacecb12 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -715,23 +715,6 @@ enum ReactiveType MAX_REACTIVE }; -#define SUMMON_SLOT_PET 0 -#define SUMMON_SLOT_TOTEM 1 -#define MAX_TOTEM_SLOT 5 -#define SUMMON_SLOT_MINIPET 5 -#define SUMMON_SLOT_QUEST 6 -#define MAX_SUMMON_SLOT 7 - -#define MAX_GAMEOBJECT_SLOT 4 - -enum PlayerTotemType -{ - SUMMON_TYPE_TOTEM_FIRE = 63, - SUMMON_TYPE_TOTEM_EARTH = 81, - SUMMON_TYPE_TOTEM_WATER = 82, - SUMMON_TYPE_TOTEM_AIR = 83 -}; - // delay time next attack to prevent client attack animation problems #define ATTACK_DISPLAY_DELAY 200 #define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player @@ -1605,7 +1588,6 @@ class TC_GAME_API Unit : public WorldObject void SetCantProc(bool apply); uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const; - uint32 GetModelForTotem(PlayerTotemType totemType); friend class VehicleJoinEvent; ObjectGuid LastCharmerGUID; -- cgit v1.2.3