void Totem::Summon(Unit* owner) { owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } AIM_Initialize(); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); // Totem of Wrath, Area Aura Enemies: Mod Crit % Taken if (m_spells[1] == 30708) CastSpell(this, m_spells[1], true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::UnSummon() { SendObjectDeSpawnAnim(GetGUID()); CombatStop(); RemoveAurasDueToSpell(GetSpell()); Unit *owner = GetOwner(); if (owner) { owner->_RemoveTotem(this); owner->RemoveAurasDueToSpell(GetSpell()); //remove aura all party members too if (owner->GetTypeId() == TYPEID_PLAYER) { // Not only the player can summon the totem (scripted AI) if(Group *pGroup = ((Player*)owner)->GetGroup()) { for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if(Target && pGroup->SameSubGroup((Player*)owner, Target)) Target->RemoveAurasDueToSpell(GetSpell()); } } } if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this); } AddObjectToRemoveList(); }
void Totem::Summon(Unit* owner) { owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } AIM_Initialize(); switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::Summon(Unit* owner) { AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); switch(m_type) { case TOTEM_PASSIVE: { for (uint32 i = 0; i <= GetSpellMaxIndex(); ++i) { if (uint32 spellId = GetSpell(i)) CastSpell(this, spellId, true); } break; } case TOTEM_STATUE: { if (GetSpell(0)) CastSpell(GetOwner(), GetSpell(0), true); break; } default: break; } }
void Totem::UnSummon() { CombatStop(); RemoveAurasDueToSpell(GetSpell()); // clear owner's totem slot for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { if (m_owner->m_SummonSlot[i] == GetGUID()) { m_owner->m_SummonSlot[i] = 0; break; } } m_owner->RemoveAurasDueToSpell(GetSpell()); //remove aura all party members too Group *pGroup = NULL; if (m_owner->GetTypeId() == TYPEID_PLAYER) { m_owner->ToPlayer()->SendAutoRepeatCancel(this); // Not only the player can summon the totem (scripted AI) pGroup = m_owner->ToPlayer()->GetGroup(); if (pGroup) { for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if (Target && pGroup->SameSubGroup((Player*) m_owner, Target)) Target->RemoveAurasDueToSpell(GetSpell()); } } } AddObjectToRemoveList(); }
void CMagicState::SpendCost() { if (m_PSpell->getSpellGroup() == SPELLGROUP_NINJUTSU) { if (!(m_flags & MAGICFLAGS_IGNORE_TOOLS)) { // handle ninja tools battleutils::HasNinjaTool(m_PEntity, GetSpell(), true); } } else if (m_PSpell->hasMPCost() && !m_PEntity->StatusEffectContainer->HasStatusEffect(EFFECT_MANAFONT) && !(m_flags & MAGICFLAGS_IGNORE_MP)) { int16 cost = battleutils::CalculateSpellCost(m_PEntity, GetSpell()); // conserve mp int16 rate = m_PEntity->getMod(MOD_CONSERVE_MP); if (dsprand::GetRandomNumber(100) < rate) { cost *= (dsprand::GetRandomNumber(8.f, 16.f) / 16.0f); } m_PEntity->addMP(-cost); } }
void Totem::Summon(Unit* owner) { sLog.outDebug("AddObject at Totem.cpp line 49"); SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId()==TYPEID_PLAYER && cinfo) { uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::Summon(Unit* owner) { AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i) if (m_spells[i]) CastSpell(this, m_spells[i], true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::Summon(Unit* owner) { AIM_Initialize(); owner->GetMap()->Add((Creature*)this); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); #ifdef ENABLE_ELUNA sEluna->OnSummoned(this, owner); #endif /* ENABLE_ELUNA */ // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch (m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::Summon(Unit* owner) { // Mana Tide Totem should have 10% of caster's health if(GetSpell() == 16191) { SetMaxHealth(owner->GetMaxHealth()*10/100); SetHealth(GetMaxHealth()); } owner->GetMap()->Add((Creature*)this); AIM_Initialize(); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::Summon(Unit* owner) { AIM_Initialize(); owner->GetMap()->Add((Creature*)this); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetObjectGuid(); SendMessageToSet(&data, true); if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->JustSummoned((Creature*)this); // there are some totems, which exist just for their visual appeareance if (!GetSpell()) return; switch (m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } }
void Totem::UnSummon() { CombatStop(); uint32 maxIdx = GetSpellMaxIndex(); for (int32 i = maxIdx; i >= 0; --i) { if (uint32 spellId = GetSpell(i)) RemoveAurasDueToSpell(spellId); } if (Unit* owner = GetOwner()) { owner->_RemoveTotem(this); for (int32 i = maxIdx; i >= 0; --i) { if (uint32 spellId = GetSpell(i)) owner->RemoveAurasDueToSpell(spellId); } // Remove Sentry Totem aura on totem unsummon if (GetEntry() == SENTRY_TOTEM_ENTRY) owner->RemoveAurasDueToSpell(6495); //remove aura all party members too if (owner->GetTypeId() == TYPEID_PLAYER) { ((Player*)owner)->SendAutoRepeatCancel(this); // Not only the player can summon the totem (scripted AI) if (Group* pGroup = ((Player*)owner)->GetGroup()) { for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if (Target && pGroup->SameSubGroup((Player*)owner, Target)) { for (int32 i = maxIdx; i >= 0; --i) { if (uint32 spellId = GetSpell(i)) Target->RemoveAurasDueToSpell(spellId); } } } } } if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI()) ((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this); } // any totem unsummon look like as totem kill, req. for proper animation if (isAlive()) SetDeathState(DEAD); AddObjectToRemoveList(); }
void Totem::InitSummon() { if (m_type == TOTEM_PASSIVE) CastSpell(this, GetSpell(), true); // Some totems can have both instant effect and passive spell if (GetSpell(1)) CastSpell(this, GetSpell(1), true); }
void Totem::UnSummon(uint32 msTime) { if (msTime) { m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime)); return; } CombatStop(); RemoveAurasDueToSpell(GetSpell(), GetGUID()); // clear owner's totem slot for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { if (GetOwner()->m_SummonSlot[i] == GetGUID()) { GetOwner()->m_SummonSlot[i].Clear(); break; } } GetOwner()->RemoveAurasDueToSpell(GetSpell(), GetGUID()); // Remove Sentry Totem Aura if (GetEntry() == SENTRY_TOTEM_ENTRY) GetOwner()->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); //remove aura all party members too if (Player* owner = GetOwner()->ToPlayer()) { owner->SendAutoRepeatCancel(this); if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL))) GetSpellHistory()->SendCooldownEvent(spell, 0, nullptr, false); if (Group* group = owner->GetGroup()) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* target = itr->GetSource(); if (target && group->SameSubGroup(owner, target)) target->RemoveAurasDueToSpell(GetSpell(), GetGUID()); } } } //npcbot: send SummonedCreatureDespawn() if (GetCreatorGUID().IsCreature()) if (Unit* bot = ObjectAccessor::FindConnectedPlayer(GetCreatorGUID())) if (bot->ToCreature()->GetIAmABot()) bot->ToCreature()->OnBotDespawn(this); //end npcbot AddObjectToRemoveList(); }
void Totem::InitSummon() { if (m_type == TOTEM_PASSIVE) CastSpell(this, GetSpell(), true); // Some totems can have both instant effect and passive spell if (GetSpell(1)) CastSpell(this, GetSpell(1), true); if (m_owner->HasAuraEffect(58585, 0)) CastSpell(this, 55277, true); }
void Totem::InitSummon() { if (m_type == TOTEM_PASSIVE && GetSpell()) CastSpell(this, GetSpell(), true); // Some totems can have both instant effect and passive spell if (GetSpell(1)) CastSpell(this, GetSpell(1), true); if (m_Properties->ID == SUMMON_TYPE_TOTEM_FIRE && GetOwner()->HasAura(SPELL_TOTEMIC_WRATH_TALENT)) CastSpell(this, SPELL_TOTEMIC_WRATH, true); }
void Totem::InitSummon() { WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data, true); if(m_type == TOTEM_PASSIVE) CastSpell(this, GetSpell(), true); // Some totems can have both instant effect and passive spell if (GetSpell(1)) CastSpell(this, GetSpell(1), true); }
void Totem::UnSummon(uint32 msTime) { if (msTime) { m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime)); return; } CombatStop(); RemoveAurasDueToSpell(GetSpell(), GetGUID()); // clear owner's totem slot for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { if (GetOwner()->m_SummonSlot[i] == GetGUID()) { GetOwner()->m_SummonSlot[i].Clear(); break; } } GetOwner()->RemoveAurasDueToSpell(GetSpell(), GetGUID()); // Remove Sentry Totem Aura if (GetEntry() == SENTRY_TOTEM_ENTRY) GetOwner()->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); //remove aura all party members too if (Player* owner = GetOwner()->ToPlayer()) { owner->SendAutoRepeatCancel(this); if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL))) GetSpellHistory()->SendCooldownEvent(spell, 0, nullptr, false); if (Group* group = owner->GetGroup()) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* target = itr->GetSource(); if (target && group->SameSubGroup(owner, target)) target->RemoveAurasDueToSpell(GetSpell(), GetGUID()); } } } // any totem unsummon look like as totem kill, req. for proper animation if (IsAlive()) setDeathState(DEAD); AddObjectToRemoveList(); }
void Totem::UnSummon(uint32 msTime) { if (msTime) { m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime)); return; } CombatStop(); RemoveAurasDueToSpell(GetSpell(), GetGUID()); Unit *m_owner = GetOwner(); // clear owner's totem slot for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { if (m_owner->m_SummonSlot[i] == GetGUID()) { m_owner->m_SummonSlot[i] = 0; break; } } m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID()); // Remove Sentry Totem Aura if (GetEntry() == SENTRY_TOTEM_ENTRY) m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); //remove aura all party members too if (Player* owner = m_owner->ToPlayer()) { owner->SendAutoRepeatCancel(this); if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL))) owner->SendCooldownEvent(spell, 0, NULL, false); if (Group* group = owner->GetGroup()) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* target = itr->GetSource(); if (target && target->IsInMap(owner) && group->SameSubGroup(owner, target)) target->RemoveAurasDueToSpell(GetSpell(), GetGUID()); } } } AddObjectToRemoveList(); }
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 (uint32 totemDisplayId = sSpellMgr->GetModelForTotem(GetUInt32Value(UNIT_CREATED_BY_SPELL), owner->getRace())) SetDisplayId(totemDisplayId); } 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::InitSummon() { if (m_type == TOTEM_PASSIVE) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(GetSpell()); // use AddAura instead of CastSpell if it's a passive aura - this in fact should be an AddSpell equivalent for creatures, but nothing like that exists so far. if (spellInfo->Attributes & SPELL_ATTR0_PASSIVE) AddAura(spellInfo->Id, this); else CastSpell(this, spellInfo->Id, true); } // Some totems can have both instant effect and passive spell if (GetSpell(1)) CastSpell(this, GetSpell(1), true); }
void Totem::InitStats(uint32 duration) { Minion::InitStats(duration); CreatureTemplate const *cinfo = GetCreatureInfo(); if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 displayID = sObjectMgr->ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo); sObjectMgr->GetCreatureModelRandomGender(&displayID); switch (m_owner->ToPlayer()->GetTeam()) { case ALLIANCE: displayID = cinfo->Modelid1; break; case HORDE: if (cinfo->Modelid3) displayID = cinfo->Modelid3; else displayID = cinfo->Modelid1; switch (((Player*)m_owner)->getRace()) { case RACE_ORC: if (cinfo->Modelid2) displayID = cinfo->Modelid2; else displayID = cinfo->Modelid1; break; case RACE_TROLL: if (cinfo->Modelid4) displayID = cinfo->Modelid4; else displayID = cinfo->Modelid1; break; default: break; } break; default: break; } SetDisplayId(displayID); } // Get spell casted by totem SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } if (GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void Totem::InitStats(uint32 duration) { Minion::InitStats(duration); CreatureInfo const *cinfo = GetCreatureInfo(); if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo) { uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } // Get spell casted by totem SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } if(GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); m_duration = duration; SetLevel(m_owner->getLevel()); }
void DoNormalAttack(uint32 diff) { opponent = me->GetVictim(); if (opponent) { if (!IsCasting()) StartAttack(opponent, true); } else return; if (MoveBehind(*opponent)) wait = 5; //float dist = me->GetExactDist(opponent); float meleedist = me->GetDistance(opponent); //TORMENT if (IsSpellReady(TORMENT_1, diff, false) && meleedist < 5 && !IsTank(opponent->GetVictim())) { temptimer = GC_Timer; if (doCast(opponent, GetSpell(TORMENT_1))) { GC_Timer = temptimer; return; } } }
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::Summon(Unit* owner) { CreatureInfo const *cinfo = GetCreatureInfo(); if (owner->GetTypeId()==TYPEID_PLAYER && cinfo) { uint32 modelid = 0; if(((Player*)owner)->GetTeam() == HORDE) { if(cinfo->Modelid_H1) modelid = cinfo->Modelid_H1; else if(cinfo->Modelid_H2) modelid = cinfo->Modelid_H2; } else { if(cinfo->Modelid_A1) modelid = cinfo->Modelid_A1; else if(cinfo->Modelid_A2) modelid = cinfo->Modelid_A2; } if (modelid) SetDisplayId(modelid); else sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam()); } // Only add if a display exists. sLog.outDebug("AddObject at Totem.cpp line 49"); SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data,true); AIM_Initialize(); switch(m_type) { case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; default: break; } if(GetEntry() == SENTRY_TOTEM_ENTRY) SetReactState(REACT_AGGRESSIVE); }
void SpellCreationSystem::ProcessMessage(Message* data) { /* Check spellcastingcomponent If a spell is being cast Is it done casting? Yes -> create spell No -> Finish processing If spellname contains a string/int not equal to NOCAST If valid spell from spellbook Yes -> Check if entity has appropriate resources Yes -> Subtract resources and update spellcasting component No -> Finish processing No -> Finish processing; throw warning If spellname contains NOCAST Finish processing */ LARGE_INTEGER StartingTime, EndingTime, ElapsedMicroseconds; LARGE_INTEGER Frequency; QueryPerformanceFrequency(&Frequency); QueryPerformanceCounter(&StartingTime); // Check for valid spell message if (data->GetID() == SPELLMESSAGEID)// auto msg = dynamic_cast<SpellMessage*>(data)) { auto msg = static_cast<SpellMessage*>(data); QueryPerformanceCounter(&EndingTime); ElapsedMicroseconds.QuadPart = EndingTime.QuadPart - StartingTime.QuadPart; auto spellcastingcomponent = GetEntityComponent<SpellCastingComponent*>(msg->entity, SpellCastingComponentID); auto spellbookcomponent = GetEntityComponent<SpellbookComponent*>(msg->entity, SpellbookComponentID); auto equipmentcomponent = GetEntityComponent<EquipmentComponent*>(msg->entity, EquipmentComponentID); Spell* queuedspell = spellbookcomponent->GetSpell(msg->spellId); if (spellcastingcomponent->SpellToCast() == NO_CAST) { // Check if spell is still coolingdown if (((TimeRunning() - queuedspell->lastcast) >= (queuedspell->cooldown + queuedspell->duration))) { // Check any other spell casting requirements spellcastingcomponent->SetSpellToCast(msg->spellId); spellcastingcomponent->SetCastTime(queuedspell->casttime); spellcastingcomponent->SetStartTimeOfCast(TimeRunning()); spellcastingcomponent->SetCancelable(queuedspell->cancelable); castspells_.push_back(msg->entity); } } } else { std::cout << "Invalid message type! Expected: SpellMessage Receieved: " << typeid(*data).name() << std::endl; } ElapsedMicroseconds.QuadPart *= 1000000; ElapsedMicroseconds.QuadPart /= Frequency.QuadPart; //std::cout << ElapsedMicroseconds.QuadPart << std::endl; }
void Totem::InitSummon() { WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << GetGUID(); SendMessageToSet(&data, true); if (m_type == TOTEM_PASSIVE) CastSpell(this, GetSpell(), true); }
void Totem::InitSummon() { if (m_type == TOTEM_PASSIVE && GetSpell()) CastSpell(this, GetSpell(), true); // Some totems can have both instant effect and passive spell if(GetSpell(1)) CastSpell(this, GetSpell(1), true); // xinef: this is better than the script, 100% sure to work if(GetEntry() == SENTRY_TOTEM_ENTRY) { SetReactState(REACT_AGGRESSIVE); GetOwner()->CastSpell(this, 6277, true); } this->GetMotionMaster()->MoveFall(); }