@@ -2067,7 +2067,7 @@ void WorldObject::AddObjectToRemoveList()
|
|||||||
map->AddObjectToRemoveList(this);
|
map->AddObjectToRemoveList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties, uint32 duration, Unit *summoner, uint32 vehId)
|
TempSummon* Map::SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties /*= NULL*/, uint32 duration /*= 0*/, Unit *summoner /*= NULL*/, uint32 vehId /*= 0*/, bool addToWorld /*= false*/)
|
||||||
{
|
{
|
||||||
uint32 mask = UNIT_MASK_SUMMON;
|
uint32 mask = UNIT_MASK_SUMMON;
|
||||||
if (properties)
|
if (properties)
|
||||||
@@ -2128,7 +2128,8 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
|
|||||||
summon->SetHomePosition(pos);
|
summon->SetHomePosition(pos);
|
||||||
|
|
||||||
summon->InitStats(duration);
|
summon->InitStats(duration);
|
||||||
Add(summon->ToCreature());
|
if (addToWorld)
|
||||||
|
Add(summon->ToCreature());
|
||||||
summon->InitSummon();
|
summon->InitSummon();
|
||||||
|
|
||||||
//ObjectAccessor::UpdateObjectVisibility(summon);
|
//ObjectAccessor::UpdateObjectVisibility(summon);
|
||||||
|
|||||||
@@ -54,45 +54,9 @@ void Totem::InitStats(uint32 duration)
|
|||||||
{
|
{
|
||||||
Minion::InitStats(duration);
|
Minion::InitStats(duration);
|
||||||
|
|
||||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
|
// set display id depending on race
|
||||||
{
|
SetDisplayId(m_owner->GetModelForTotem(PlayerTotemType(m_Properties->Id)));
|
||||||
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
|
// Get spell casted by totem
|
||||||
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
|
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
|
||||||
@@ -139,19 +103,20 @@ void Totem::UnSummon()
|
|||||||
m_owner->RemoveAurasDueToSpell(GetSpell());
|
m_owner->RemoveAurasDueToSpell(GetSpell());
|
||||||
|
|
||||||
//remove aura all party members too
|
//remove aura all party members too
|
||||||
Group *pGroup = NULL;
|
if (Player* owner = m_owner->ToPlayer())
|
||||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
{
|
||||||
m_owner->ToPlayer()->SendAutoRepeatCancel(this);
|
owner->SendAutoRepeatCancel(this);
|
||||||
|
if (SpellEntry const* spell = sSpellStore.LookupEntry(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
|
||||||
|
owner->SendCooldownEvent(spell);
|
||||||
// Not only the player can summon the totem (scripted AI)
|
// Not only the player can summon the totem (scripted AI)
|
||||||
pGroup = m_owner->ToPlayer()->GetGroup();
|
Group* group = owner->GetGroup();
|
||||||
if (pGroup)
|
if (group)
|
||||||
{
|
{
|
||||||
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player* Target = itr->getSource();
|
Player* target = itr->getSource();
|
||||||
if (Target && pGroup->SameSubGroup((Player*)m_owner, Target))
|
if (target && group->SameSubGroup(owner, target))
|
||||||
Target->RemoveAurasDueToSpell(GetSpell());
|
target->RemoveAurasDueToSpell(GetSpell());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class Map : public GridRefManager<NGridType>
|
|||||||
|
|
||||||
void UpdateIteratorBack(Player *player);
|
void UpdateIteratorBack(Player *player);
|
||||||
|
|
||||||
TempSummon *SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties = NULL, uint32 duration = 0, Unit *summoner = NULL, uint32 vehId = 0);
|
TempSummon *SummonCreature(uint32 entry, const Position &pos, SummonPropertiesEntry const *properties = NULL, uint32 duration = 0, Unit *summoner = NULL, uint32 vehId = 0, bool addToWorld = true);
|
||||||
Creature* GetCreature(uint64 guid);
|
Creature* GetCreature(uint64 guid);
|
||||||
GameObject* GetGameObject(uint64 guid);
|
GameObject* GetGameObject(uint64 guid);
|
||||||
DynamicObject* GetDynamicObject(uint64 guid);
|
DynamicObject* GetDynamicObject(uint64 guid);
|
||||||
|
|||||||
@@ -3018,37 +3018,36 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
|||||||
break;
|
break;
|
||||||
case SUMMON_TYPE_TOTEM:
|
case SUMMON_TYPE_TOTEM:
|
||||||
{
|
{
|
||||||
summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster);
|
summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, 0, false);
|
||||||
if (!summon || !summon->isTotem())
|
if (summon && summon->isTotem())
|
||||||
return;
|
|
||||||
|
|
||||||
// Mana Tide Totem
|
|
||||||
if (m_spellInfo->Id == 16190)
|
|
||||||
damage = m_caster->CountPctFromMaxHealth(10);
|
|
||||||
|
|
||||||
if (damage) // if not spell info, DB values used
|
|
||||||
{
|
{
|
||||||
summon->SetMaxHealth(damage);
|
|
||||||
summon->SetHealth(damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER
|
// Mana Tide Totem
|
||||||
&& properties->Slot >= SUMMON_SLOT_TOTEM
|
if (m_spellInfo->Id == 16190)
|
||||||
&& properties->Slot < MAX_TOTEM_SLOT)
|
damage = m_caster->CountPctFromMaxHealth(10);
|
||||||
{
|
|
||||||
// set display id depending on race
|
|
||||||
uint32 displayId = m_originalCaster->GetModelForTotem(PlayerTotemType(properties->Id));
|
|
||||||
summon->SetNativeDisplayId(displayId);
|
|
||||||
summon->SetDisplayId(displayId);
|
|
||||||
|
|
||||||
//summon->SendUpdateToPlayerm_originalCaster->ToPlayer();
|
if (damage) // if not spell info, DB values used
|
||||||
WorldPacket data(SMSG_TOTEM_CREATED, 1+8+4+4);
|
{
|
||||||
data << uint8(properties->Slot-1);
|
summon->SetMaxHealth(damage);
|
||||||
data << uint64(m_originalCaster->GetGUID());
|
summon->SetHealth(damage);
|
||||||
data << uint32(duration);
|
}
|
||||||
data << uint32(m_spellInfo->Id);
|
|
||||||
m_originalCaster->ToPlayer()->SendDirectMessage(&data);
|
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER
|
||||||
|
&& properties->Slot >= SUMMON_SLOT_TOTEM
|
||||||
|
&& properties->Slot < MAX_TOTEM_SLOT)
|
||||||
|
{
|
||||||
|
WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
|
||||||
|
data << uint8(properties->Slot - 1);
|
||||||
|
data << uint64(summon->GetGUID());
|
||||||
|
data << uint32(duration);
|
||||||
|
data << uint32(m_spellInfo->Id);
|
||||||
|
m_originalCaster->ToPlayer()->SendDirectMessage(&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// client requires SMSG_TOTEM_CREATED to be sent before CreateObject and at the same time
|
||||||
|
// expects the summon's GUID so adding to world must be delayed
|
||||||
|
if (summon)
|
||||||
|
m_caster->GetMap()->Add(summon->ToCreature());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUMMON_TYPE_MINIPET:
|
case SUMMON_TYPE_MINIPET:
|
||||||
|
|||||||
Reference in New Issue
Block a user