*Some update of summon effect code.
--HG-- branch : trunk
This commit is contained in:
@@ -2446,22 +2446,6 @@ enum SummonType
|
|||||||
SUMMON_TYPE_VEHICLE = 9,
|
SUMMON_TYPE_VEHICLE = 9,
|
||||||
SUMMON_TYPE_VEHICLE2 = 10,
|
SUMMON_TYPE_VEHICLE2 = 10,
|
||||||
SUMMON_TYPE_OBJECT = 11,
|
SUMMON_TYPE_OBJECT = 11,
|
||||||
|
|
||||||
SUMMON_TYPE_CRITTER = 41,
|
|
||||||
//SUMMON_TYPE_GUARDIAN = 61,
|
|
||||||
SUMMON_TYPE_WILD = 64,
|
|
||||||
SUMMON_TYPE_DEMON = 66,
|
|
||||||
SUMMON_TYPE_SUMMON = 67,
|
|
||||||
SUMMON_TYPE_UNKNOWN3 = 181,
|
|
||||||
SUMMON_TYPE_UNKNOWN4 = 187,
|
|
||||||
SUMMON_TYPE_UNKNOWN1 = 247,
|
|
||||||
SUMMON_TYPE_CRITTER2 = 407,
|
|
||||||
SUMMON_TYPE_CRITTER3 = 307,
|
|
||||||
SUMMON_TYPE_UNKNOWN5 = 409,
|
|
||||||
SUMMON_TYPE_FROZEN_EARTH = 429,
|
|
||||||
SUMMON_TYPE_FORCE_OF_NATURE = 669,
|
|
||||||
SUMMON_TYPE_LIGHTWELL = 1141,
|
|
||||||
SUMMON_TYPE_FERAL_SPIRIT = 1161
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ResponseCodes
|
enum ResponseCodes
|
||||||
|
|||||||
+1
-13
@@ -4214,24 +4214,12 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
// This is generic summon effect
|
// This is generic summon effect
|
||||||
case SPELL_EFFECT_SUMMON:
|
case SPELL_EFFECT_SUMMON:
|
||||||
{
|
{
|
||||||
switch(m_spellInfo->EffectMiscValueB[i])
|
|
||||||
{
|
|
||||||
case SUMMON_TYPE_DEMON:
|
|
||||||
case SUMMON_TYPE_SUMMON:
|
|
||||||
{
|
|
||||||
if(m_caster->GetPetGUID())
|
|
||||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
|
||||||
|
|
||||||
if(m_caster->GetCharmGUID())
|
|
||||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
|
SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
|
||||||
if(!SummonProperties)
|
if(!SummonProperties)
|
||||||
break;
|
break;
|
||||||
switch(SummonProperties->Category)
|
switch(SummonProperties->Category)
|
||||||
{
|
{
|
||||||
|
case SUMMON_CATEGORY_PET:
|
||||||
case SUMMON_CATEGORY_POSSESSED:
|
case SUMMON_CATEGORY_POSSESSED:
|
||||||
{
|
{
|
||||||
if(m_caster->GetPetGUID())
|
if(m_caster->GetPetGUID())
|
||||||
|
|||||||
@@ -603,10 +603,7 @@ class Spell
|
|||||||
void SpellDamageHeal(uint32 i);
|
void SpellDamageHeal(uint32 i);
|
||||||
|
|
||||||
void GetSummonPosition(float &x, float &y, float &z, float radius = 0.0f, uint32 count = 0);
|
void GetSummonPosition(float &x, float &y, float &z, float radius = 0.0f, uint32 count = 0);
|
||||||
void SummonTotem (uint32 entry, SummonPropertiesEntry const *properties);
|
|
||||||
void SummonGuardian (uint32 entry, SummonPropertiesEntry const *properties);
|
void SummonGuardian (uint32 entry, SummonPropertiesEntry const *properties);
|
||||||
void SummonPossessed(uint32 entry, SummonPropertiesEntry const *properties);
|
|
||||||
void SummonVehicle (uint32 entry, SummonPropertiesEntry const *properties);
|
|
||||||
|
|
||||||
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
|
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|||||||
+141
-197
@@ -3238,6 +3238,38 @@ void Spell::EffectSummonType(uint32 i)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!m_originalCaster)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int32 duration = GetSpellDuration(m_spellInfo);
|
||||||
|
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
||||||
|
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
|
||||||
|
|
||||||
|
float x, y, z;
|
||||||
|
GetSummonPosition(x, y, z);
|
||||||
|
|
||||||
|
/*//totem must be at same Z in case swimming caster and etc.
|
||||||
|
if( fabs( z - m_caster->GetPositionZ() ) > 5 )
|
||||||
|
z = m_caster->GetPositionZ();
|
||||||
|
|
||||||
|
uint32 level = m_caster->getLevel();
|
||||||
|
|
||||||
|
// level of creature summoned using engineering item based at engineering skill level
|
||||||
|
if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem)
|
||||||
|
{
|
||||||
|
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||||
|
if(proto && proto->RequiredSkill == SKILL_ENGINERING)
|
||||||
|
{
|
||||||
|
uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING);
|
||||||
|
if(skill202)
|
||||||
|
{
|
||||||
|
level = skill202/5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
TempSummon *summon = NULL;
|
||||||
|
|
||||||
switch(properties->Category)
|
switch(properties->Category)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -3250,28 +3282,130 @@ void Spell::EffectSummonType(uint32 i)
|
|||||||
break;
|
break;
|
||||||
case SUMMON_TYPE_VEHICLE:
|
case SUMMON_TYPE_VEHICLE:
|
||||||
case SUMMON_TYPE_VEHICLE2:
|
case SUMMON_TYPE_VEHICLE2:
|
||||||
SummonVehicle(entry, properties);
|
{
|
||||||
|
Vehicle *vehicle = m_caster->SummonVehicle(entry, x, y, z, m_caster->GetOrientation());
|
||||||
|
if(!vehicle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
vehicle->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||||
|
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SUMMON_TYPE_TOTEM:
|
case SUMMON_TYPE_TOTEM:
|
||||||
SummonTotem(entry, properties);
|
{
|
||||||
|
summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), properties, duration, m_originalCaster);
|
||||||
|
if(!summon || !summon->isTotem())
|
||||||
|
return;
|
||||||
|
|
||||||
|
summon->SetOwner(m_originalCaster, true);
|
||||||
|
|
||||||
|
if(damage) // if not spell info, DB values used
|
||||||
|
{
|
||||||
|
summon->SetMaxHealth(damage);
|
||||||
|
summon->SetHealth(damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
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(m_originalCaster->GetGUID());
|
||||||
|
data << uint32(duration);
|
||||||
|
data << uint32(m_spellInfo->Id);
|
||||||
|
((Player*)m_originalCaster)->SendDirectMessage(&data);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SUMMON_TYPE_MINIPET:
|
case SUMMON_TYPE_MINIPET:
|
||||||
EffectSummonCritter(i);
|
{
|
||||||
|
summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), properties, duration, m_originalCaster);
|
||||||
|
if(!summon)
|
||||||
|
return;
|
||||||
|
|
||||||
|
summon->SetOwner(m_originalCaster, true);
|
||||||
|
summon->SetCreatorGUID(m_originalCaster->GetGUID());
|
||||||
|
summon->setFaction(m_originalCaster->getFaction());
|
||||||
|
|
||||||
|
//summon->InitPetCreateSpells(); // e.g. disgusting oozeling has a create spell as summon...
|
||||||
|
summon->SetMaxHealth(1);
|
||||||
|
summon->SetHealth(1);
|
||||||
|
summon->SetLevel(1);
|
||||||
|
|
||||||
|
summon->SetReactState(REACT_PASSIVE);
|
||||||
|
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||||
|
|
||||||
|
summon->GetMotionMaster()->MoveTargetedHome();
|
||||||
|
|
||||||
|
std::string name = m_originalCaster->GetName();
|
||||||
|
name.append(petTypeSuffix[3]);
|
||||||
|
summon->SetName( name );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
EffectSummonWild(i);
|
{
|
||||||
|
float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||||
|
|
||||||
|
int32 amount = damage > 0 ? damage : 1;
|
||||||
|
|
||||||
|
for(int32 count = 0; count < amount; ++count)
|
||||||
|
{
|
||||||
|
float px, py, pz;
|
||||||
|
GetSummonPosition(px, py, pz, radius, count);
|
||||||
|
|
||||||
|
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
|
||||||
|
|
||||||
|
m_originalCaster->SummonCreature(entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}//switch
|
||||||
break;
|
break;
|
||||||
case SUMMON_CATEGORY_PET:
|
case SUMMON_CATEGORY_PET:
|
||||||
SummonGuardian(entry, properties);
|
SummonGuardian(entry, properties);
|
||||||
break;
|
break;
|
||||||
case SUMMON_CATEGORY_POSSESSED:
|
case SUMMON_CATEGORY_POSSESSED:
|
||||||
SummonPossessed(entry, properties);
|
{
|
||||||
|
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float x, y, z;
|
||||||
|
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
||||||
|
|
||||||
|
int32 duration = GetSpellDuration(m_spellInfo);
|
||||||
|
|
||||||
|
Pet* pet = ((Player*)m_caster)->SummonPet(entry, x, y, z, m_caster->GetOrientation(), POSSESSED_PET, duration);
|
||||||
|
if(!pet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
|
pet->SetCharmedOrPossessedBy(m_caster, true);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SUMMON_CATEGORY_VEHICLE:
|
case SUMMON_CATEGORY_VEHICLE:
|
||||||
SummonVehicle(entry, properties);
|
{
|
||||||
|
float x, y, z;
|
||||||
|
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
||||||
|
Vehicle *vehicle = m_caster->SummonVehicle(entry, x, y, z, m_caster->GetOrientation());
|
||||||
|
if(!vehicle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
vehicle->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||||
|
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
|
|
||||||
|
if(damage)
|
||||||
|
{
|
||||||
|
m_caster->CastSpell(vehicle, damage, true);
|
||||||
|
m_caster->EnterVehicle(vehicle);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(summon)
|
||||||
|
{
|
||||||
|
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3504,48 +3638,6 @@ void Spell::EffectAddFarsight(uint32 i)
|
|||||||
((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectSummonWild(uint32 i)
|
|
||||||
{
|
|
||||||
uint32 creature_entry = m_spellInfo->EffectMiscValue[i];
|
|
||||||
if(!creature_entry)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint32 level = m_caster->getLevel();
|
|
||||||
|
|
||||||
// level of creature summoned using engineering item based at engineering skill level
|
|
||||||
if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem)
|
|
||||||
{
|
|
||||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
|
||||||
if(proto && proto->RequiredSkill == SKILL_ENGINERING)
|
|
||||||
{
|
|
||||||
uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING);
|
|
||||||
if(skill202)
|
|
||||||
{
|
|
||||||
level = skill202/5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
|
||||||
|
|
||||||
int32 amount = damage > 0 ? damage : 1;
|
|
||||||
|
|
||||||
for(int32 count = 0; count < amount; ++count)
|
|
||||||
{
|
|
||||||
float px, py, pz;
|
|
||||||
GetSummonPosition(px, py, pz, radius, count);
|
|
||||||
|
|
||||||
int32 duration = GetSpellDuration(m_spellInfo);
|
|
||||||
|
|
||||||
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
|
|
||||||
|
|
||||||
if(m_originalCaster)
|
|
||||||
m_originalCaster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
|
|
||||||
else
|
|
||||||
m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Spell::EffectTeleUnitsFaceCaster(uint32 i)
|
void Spell::EffectTeleUnitsFaceCaster(uint32 i)
|
||||||
{
|
{
|
||||||
if(!unitTarget)
|
if(!unitTarget)
|
||||||
@@ -5723,44 +5815,6 @@ void Spell::EffectCharge(uint32 /*i*/)
|
|||||||
m_caster->Attack(target, true);
|
m_caster->Attack(target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectSummonCritter(uint32 i)
|
|
||||||
{
|
|
||||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
|
||||||
return;
|
|
||||||
Player* player = (Player*)m_caster;
|
|
||||||
|
|
||||||
uint32 pet_entry = m_spellInfo->EffectMiscValue[i];
|
|
||||||
if(!pet_entry)
|
|
||||||
return;
|
|
||||||
|
|
||||||
float x,y,z;
|
|
||||||
GetSummonPosition(x, y, z);
|
|
||||||
|
|
||||||
int32 duration = GetSpellDuration(m_spellInfo);
|
|
||||||
TempSummon *critter = m_caster->GetMap()->SummonCreature(pet_entry, x, y, z, m_caster->GetOrientation(), sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]), duration, m_caster);
|
|
||||||
if(!critter)
|
|
||||||
return;
|
|
||||||
|
|
||||||
critter->SetOwner(m_caster, true);
|
|
||||||
critter->SetCreatorGUID(m_caster->GetGUID());
|
|
||||||
critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
|
|
||||||
critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
|
||||||
|
|
||||||
//critter->InitPetCreateSpells(); // e.g. disgusting oozeling has a create spell as critter...
|
|
||||||
critter->SetMaxHealth(1);
|
|
||||||
critter->SetHealth(1);
|
|
||||||
critter->SetLevel(1);
|
|
||||||
|
|
||||||
critter->SetReactState(REACT_PASSIVE);
|
|
||||||
critter->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
|
||||||
|
|
||||||
critter->GetMotionMaster()->MoveTargetedHome();
|
|
||||||
|
|
||||||
std::string name = player->GetName();
|
|
||||||
name.append(petTypeSuffix[3]);
|
|
||||||
critter->SetName( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Spell::EffectKnockBack(uint32 i)
|
void Spell::EffectKnockBack(uint32 i)
|
||||||
{
|
{
|
||||||
if(!unitTarget)
|
if(!unitTarget)
|
||||||
@@ -6366,78 +6420,6 @@ void Spell::EffectRedirectThreat(uint32 /*i*/)
|
|||||||
m_caster->SetReducedThreatPercent((uint32)damage, unitTarget->GetGUID());
|
m_caster->SetReducedThreatPercent((uint32)damage, unitTarget->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::SummonTotem(uint32 entry, SummonPropertiesEntry const *properties)
|
|
||||||
{
|
|
||||||
int8 slot = (int8)properties->Slot;
|
|
||||||
|
|
||||||
if(slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT)
|
|
||||||
{
|
|
||||||
uint64 guid = m_caster->m_SummonSlot[slot];
|
|
||||||
if(guid != 0)
|
|
||||||
{
|
|
||||||
Creature *OldTotem = m_caster->GetMap()->GetCreature(guid);
|
|
||||||
if(OldTotem && OldTotem->isTotem())
|
|
||||||
((Totem*)OldTotem)->UnSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 team = 0;
|
|
||||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
|
||||||
team = ((Player*)m_caster)->GetTeam();
|
|
||||||
|
|
||||||
Totem* pTotem = new Totem(properties, m_caster);
|
|
||||||
|
|
||||||
if(!pTotem->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), m_caster->GetMap(), m_caster->GetPhaseMask(),
|
|
||||||
entry, team ))
|
|
||||||
{
|
|
||||||
delete pTotem;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float x,y,z;
|
|
||||||
GetSummonPosition(x, y, z);
|
|
||||||
|
|
||||||
// totem must be at same Z in case swimming caster and etc.
|
|
||||||
if( fabs( z - m_caster->GetPositionZ() ) > 5 )
|
|
||||||
z = m_caster->GetPositionZ();
|
|
||||||
|
|
||||||
pTotem->Relocate(x, y, z, m_caster->GetOrientation());
|
|
||||||
|
|
||||||
if(slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT)
|
|
||||||
m_caster->m_SummonSlot[slot] = pTotem->GetGUID();
|
|
||||||
|
|
||||||
pTotem->SetOwner(m_caster);
|
|
||||||
pTotem->SetTypeBySummonSpell(m_spellInfo); // must be after Create call where m_spells initilized
|
|
||||||
|
|
||||||
int32 duration=GetSpellDuration(m_spellInfo);
|
|
||||||
if(Player* modOwner = m_caster->GetSpellModOwner())
|
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id,SPELLMOD_DURATION, duration);
|
|
||||||
pTotem->SetDuration(duration);
|
|
||||||
|
|
||||||
if (damage) // if not spell info, DB values used
|
|
||||||
{
|
|
||||||
pTotem->SetMaxHealth(damage);
|
|
||||||
pTotem->SetHealth(damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
pTotem->SetUInt32Value(UNIT_CREATED_BY_SPELL,m_spellInfo->Id);
|
|
||||||
|
|
||||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
pTotem->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_PVP_ATTACKABLE);
|
|
||||||
|
|
||||||
pTotem->Summon(m_caster);
|
|
||||||
|
|
||||||
if(slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT && m_caster->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
WorldPacket data(SMSG_TOTEM_CREATED, 1+8+4+4);
|
|
||||||
data << uint8(slot-1);
|
|
||||||
data << uint64(pTotem->GetGUID());
|
|
||||||
data << uint32(duration);
|
|
||||||
data << uint32(m_spellInfo->Id);
|
|
||||||
((Player*)m_caster)->SendDirectMessage(&data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Spell::SummonGuardian(uint32 entry, SummonPropertiesEntry const *properties)
|
void Spell::SummonGuardian(uint32 entry, SummonPropertiesEntry const *properties)
|
||||||
{
|
{
|
||||||
Unit *caster = m_originalCaster;
|
Unit *caster = m_originalCaster;
|
||||||
@@ -6486,44 +6468,6 @@ void Spell::SummonGuardian(uint32 entry, SummonPropertiesEntry const *properties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::SummonPossessed(uint32 entry, SummonPropertiesEntry const *properties)
|
|
||||||
{
|
|
||||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint32 level = m_caster->getLevel();
|
|
||||||
|
|
||||||
float x, y, z;
|
|
||||||
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
|
||||||
|
|
||||||
int32 duration = GetSpellDuration(m_spellInfo);
|
|
||||||
|
|
||||||
Pet* pet = ((Player*)m_caster)->SummonPet(entry, x, y, z, m_caster->GetOrientation(), POSSESSED_PET, duration);
|
|
||||||
if(!pet)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
|
||||||
pet->SetCharmedOrPossessedBy(m_caster, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Spell::SummonVehicle(uint32 entry, SummonPropertiesEntry const *properties)
|
|
||||||
{
|
|
||||||
float x, y, z;
|
|
||||||
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
|
|
||||||
Vehicle *vehicle = m_caster->SummonVehicle(entry, x, y, z, m_caster->GetOrientation());
|
|
||||||
if(!vehicle)
|
|
||||||
return;
|
|
||||||
|
|
||||||
vehicle->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
|
||||||
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
|
||||||
|
|
||||||
if(damage)
|
|
||||||
{
|
|
||||||
m_caster->CastSpell(vehicle, damage, true);
|
|
||||||
m_caster->EnterVehicle(vehicle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Spell::GetSummonPosition(float &x, float &y, float &z, float radius, uint32 count)
|
void Spell::GetSummonPosition(float &x, float &y, float &z, float radius, uint32 count)
|
||||||
{
|
{
|
||||||
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||||
|
|||||||
@@ -198,9 +198,9 @@ void TempSummon::InitSummon(uint32 duration)
|
|||||||
{
|
{
|
||||||
if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
|
if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
|
||||||
{
|
{
|
||||||
Creature *OldTotem = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
|
Creature *oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
|
||||||
if(OldTotem && OldTotem->isSummon())
|
if(oldSummon && oldSummon->isSummon())
|
||||||
((TempSummon*)OldTotem)->UnSummon();
|
((TempSummon*)oldSummon)->UnSummon();
|
||||||
}
|
}
|
||||||
owner->m_SummonSlot[slot] = GetGUID();
|
owner->m_SummonSlot[slot] = GetGUID();
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,10 @@ bool TempSummon::SetOwner(Unit *owner, bool apply)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(owner->GetTypeId() == TYPEID_PLAYER)
|
if(owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
m_ControlledByPlayer = true;
|
m_ControlledByPlayer = true;
|
||||||
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+24
-34
@@ -53,8 +53,12 @@ void Totem::Update( uint32 time )
|
|||||||
Creature::Update( time );
|
Creature::Update( time );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Totem::Summon(Unit* owner)
|
void Totem::InitSummon(uint32 duration)
|
||||||
{
|
{
|
||||||
|
Unit *owner = GetOwner();
|
||||||
|
if(!owner)
|
||||||
|
return;
|
||||||
|
|
||||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||||
if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
|
if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
|
||||||
{
|
{
|
||||||
@@ -79,24 +83,32 @@ void Totem::Summon(Unit* owner)
|
|||||||
sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam());
|
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);
|
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
|
||||||
data << GetGUID();
|
data << GetGUID();
|
||||||
SendMessageToSet(&data,true);
|
SendMessageToSet(&data,true);
|
||||||
|
|
||||||
switch(m_type)
|
if(m_type == TOTEM_PASSIVE)
|
||||||
{
|
CastSpell(this, GetSpell(), true);
|
||||||
case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break;
|
|
||||||
case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(GetEntry() == SENTRY_TOTEM_ENTRY)
|
if(GetEntry() == SENTRY_TOTEM_ENTRY)
|
||||||
SetReactState(REACT_AGGRESSIVE);
|
SetReactState(REACT_AGGRESSIVE);
|
||||||
|
|
||||||
|
m_duration = duration;
|
||||||
|
|
||||||
|
SetCreatorGUID(owner->GetGUID());
|
||||||
|
setFaction(owner->getFaction());
|
||||||
|
SetLevel(owner->getLevel());
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
TempSummon::InitSummon(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Totem::UnSummon()
|
void Totem::UnSummon()
|
||||||
@@ -142,14 +154,6 @@ void Totem::UnSummon()
|
|||||||
AddObjectToRemoveList();
|
AddObjectToRemoveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Totem::SetOwner(Unit *owner)
|
|
||||||
{
|
|
||||||
SetCreatorGUID(owner->GetGUID());
|
|
||||||
TempSummon::SetOwner(owner, true);
|
|
||||||
setFaction(owner->getFaction());
|
|
||||||
SetLevel(owner->getLevel());
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit *Totem::GetOwner()
|
Unit *Totem::GetOwner()
|
||||||
{
|
{
|
||||||
uint64 ownerid = GetOwnerGUID();
|
uint64 ownerid = GetOwnerGUID();
|
||||||
@@ -158,20 +162,6 @@ Unit *Totem::GetOwner()
|
|||||||
return ObjectAccessor::GetUnit(*this, ownerid);
|
return ObjectAccessor::GetUnit(*this, ownerid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)
|
|
||||||
{
|
|
||||||
// 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(spellProto->SpellIconID==2056)
|
|
||||||
m_type = TOTEM_STATUE; //Jewelery statue
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
|
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
|
||||||
{
|
{
|
||||||
// TODO: possibly all negative auras immuned?
|
// TODO: possibly all negative auras immuned?
|
||||||
|
|||||||
+1
-5
@@ -27,7 +27,6 @@ enum TotemType
|
|||||||
{
|
{
|
||||||
TOTEM_PASSIVE = 0,
|
TOTEM_PASSIVE = 0,
|
||||||
TOTEM_ACTIVE = 1,
|
TOTEM_ACTIVE = 1,
|
||||||
TOTEM_STATUE = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SENTRY_TOTEM_ENTRY 3968
|
#define SENTRY_TOTEM_ENTRY 3968
|
||||||
@@ -38,15 +37,12 @@ class Totem : public TempSummon
|
|||||||
explicit Totem(SummonPropertiesEntry const *properties, Unit *owner);
|
explicit Totem(SummonPropertiesEntry const *properties, Unit *owner);
|
||||||
virtual ~Totem(){};
|
virtual ~Totem(){};
|
||||||
void Update( uint32 time );
|
void Update( uint32 time );
|
||||||
void Summon(Unit* owner);
|
void InitSummon(uint32 duration);
|
||||||
void UnSummon();
|
void UnSummon();
|
||||||
uint32 GetSpell() const { return m_spells[0]; }
|
uint32 GetSpell() const { return m_spells[0]; }
|
||||||
uint32 GetTotemDuration() const { return m_duration; }
|
uint32 GetTotemDuration() const { return m_duration; }
|
||||||
Unit *GetOwner();
|
Unit *GetOwner();
|
||||||
TotemType GetTotemType() const { return m_type; }
|
TotemType GetTotemType() const { return m_type; }
|
||||||
void SetTypeBySummonSpell(SpellEntry const * spellProto);
|
|
||||||
void SetDuration(uint32 dur) { m_duration = dur; }
|
|
||||||
void SetOwner(Unit *owner);
|
|
||||||
|
|
||||||
bool UpdateStats(Stats /*stat*/) { return true; }
|
bool UpdateStats(Stats /*stat*/) { return true; }
|
||||||
bool UpdateAllStats() { return true; }
|
bool UpdateAllStats() { return true; }
|
||||||
|
|||||||
+2
-2
@@ -8397,7 +8397,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
|||||||
return pdamage;
|
return pdamage;
|
||||||
|
|
||||||
// For totems get damage bonus from owner (statue isn't totem in fact)
|
// For totems get damage bonus from owner (statue isn't totem in fact)
|
||||||
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
|
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem())
|
||||||
{
|
{
|
||||||
if(Unit* owner = GetOwner())
|
if(Unit* owner = GetOwner())
|
||||||
return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype);
|
return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype);
|
||||||
@@ -8970,7 +8970,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
|
|||||||
return healamount;
|
return healamount;
|
||||||
|
|
||||||
// For totems get healing bonus from owner (statue isn't totem in fact)
|
// For totems get healing bonus from owner (statue isn't totem in fact)
|
||||||
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
|
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem())
|
||||||
if(Unit* owner = GetOwner())
|
if(Unit* owner = GetOwner())
|
||||||
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user