Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

This commit is contained in:
Vincent-Michael
2014-05-04 04:24:59 +02:00
4 changed files with 35 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
--
UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`=26918;

View File

@@ -3024,7 +3024,12 @@ void Spell::cancel()
void Spell::cast(bool skipCheck)
{
// update pointers base at GUIDs to prevent access to non-existed already object
UpdatePointers();
if (!UpdatePointers())
{
// cancel the spell if UpdatePointers() returned false, something wrong happened there
cancel();
return;
}
// cancel at lost explicit target during cast
if (m_targets.GetObjectTargetGUID() && !m_targets.GetObjectTarget())
@@ -3274,7 +3279,12 @@ void Spell::handle_immediate()
uint64 Spell::handle_delayed(uint64 t_offset)
{
UpdatePointers();
if (!UpdatePointers())
{
// finish the spell if UpdatePointers() returned false, something wrong happened there
finish(false);
return 0;
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
@@ -3429,7 +3439,12 @@ void Spell::SendSpellCooldown()
void Spell::update(uint32 difftime)
{
// update pointers based at it's GUIDs
UpdatePointers();
if (!UpdatePointers())
{
// cancel the spell if UpdatePointers() returned false, something wrong happened there
cancel();
return;
}
if (m_targets.GetUnitTargetGUID() && !m_targets.GetUnitTarget())
{
@@ -4283,6 +4298,7 @@ void Spell::TakeCastItem()
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
m_castItemGUID = 0;
}
}
@@ -4521,6 +4537,7 @@ void Spell::TakeReagents()
}
m_CastItem = NULL;
m_castItemGUID = 0;
}
// if GetItemTarget is also spell reagent
@@ -6336,7 +6353,7 @@ void Spell::DelayedChannel()
SendChannelUpdate(m_timer);
}
void Spell::UpdatePointers()
bool Spell::UpdatePointers()
{
if (m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
@@ -6348,13 +6365,18 @@ void Spell::UpdatePointers()
}
if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID);
// cast item not found, somehow the item is no longer where we expected
if (!m_CastItem)
return false;
}
m_targets.Update(m_caster);
// further actions done only for dest targets
if (!m_targets.HasDst())
return;
return true;
// cache last transport
WorldObject* transport = NULL;
@@ -6375,6 +6397,8 @@ void Spell::UpdatePointers()
dest._position.RelocateOffset(dest._transportOffset);
}
}
return true;
}
CurrentSpellTypes Spell::GetCurrentContainer() const

View File

@@ -491,7 +491,7 @@ class Spell
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
int32 GetPowerCost() const { return m_powerCost; }
void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
bool UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
void CleanupTargetList();

View File

@@ -1933,6 +1933,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
m_castItemGUID = 0;
player->StoreItem(dest, pNewItem, true);
return;
@@ -1951,6 +1952,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
m_castItemGUID = 0;
player->BankItem(dest, pNewItem, true);
return;
@@ -1973,6 +1975,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
m_castItemGUID = 0;
player->EquipItem(dest, pNewItem, true);
player->AutoUnequipOffhandIfNeed();