void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem if (m_owner->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->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)); m_owner->ToPlayer()->SendDirectMessage(&data); // set display id depending on caster's race SetDisplayId(m_owner->GetModelForTotem(PlayerTotemType(m_Properties->Id))); } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime()) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; if (GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
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) { ObjectGuid TotemGUID = GetGUID(); uint32 SpellID = GetUInt32Value(UNIT_FIELD_CREATED_BY_SPELL); uint8 Slot = uint8(m_Properties->Slot - 1); GetOwner()->ToPlayer()->GetSession()->SendTotemCreated(TotemGUID, duration, SpellID, Slot); // set display id depending on caster's race SetDisplayId(GetOwner()->GetModelForTotem(PlayerTotemType(m_Properties->Id))); } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime(getLevel())) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; m_duration = duration; SetLevel(GetOwner()->getLevel()); }
void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem if (Player* owner = GetOwner()->ToPlayer()) { if (m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) { WorldPackets::Totem::TotemCreated data; data.Totem = GetGUID(); data.Slot = m_Properties->Slot - SUMMON_SLOT_TOTEM; data.Duration = duration; data.SpellID = GetUInt32Value(UNIT_CREATED_BY_SPELL); owner->SendDirectMessage(data.Write()); } // set display id depending on caster's race if (SpellInfo const* createdBySpell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL))) { SpellEffectInfoVector effects = createdBySpell->GetEffectsForDifficulty(DIFFICULTY_NONE); auto summonEffect = std::find_if(effects.begin(), effects.end(), [](SpellEffectInfo const* effect) { return effect && effect->IsEffect(SPELL_EFFECT_SUMMON); }); if (summonEffect != effects.end()) SetDisplayId(owner->GetModelForTotem(PlayerTotemType((*summonEffect)->MiscValueB))); } } Minion::InitStats(duration); // Get spell cast by totem if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell())) if (totemSpell->CalcCastTime(getLevel())) // If spell has cast time -> its an active totem m_type = TOTEM_ACTIVE; m_duration = duration; SetLevel(GetOwner()->getLevel()); }