diff options
author | kaelima <kaelima@live.se> | 2012-05-13 17:47:12 +0200 |
---|---|---|
committer | kaelima <kaelima@live.se> | 2012-05-13 17:47:27 +0200 |
commit | a1ff27a1c64d87717d0b0f65905ffff064329fb7 (patch) | |
tree | b2b5ff0a44a6264f50498cab5bd853cde6589df3 /src | |
parent | e5268ba0b5959a5e7498497f01c3b14e00d8ec56 (diff) |
Core/Threat: Some corrections to 5709929d2b575e83f427c7f48cd6bd0d7ed1b29d
Fixes HandleChannelDeathItem (spells such as Drain Soul), which got broken by moving m_deathState = s, thanks Shauren
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Combat/ThreatManager.cpp | 5 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 7 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 91 |
3 files changed, 46 insertions, 57 deletions
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 104d2d3d52b..9737d4584ea 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -535,10 +535,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } - if (getOwner() && getOwner()->IsInWorld()) - if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid())) - if (getOwner()->IsInMap(target)) - getOwner()->SendRemoveFromThreatListOpcode(hostilRef); + iOwner->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e78c18ea3de..b1fcdf888c2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12833,9 +12833,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::setDeathState(DeathState s) { - // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that - // it can be used to check creation of death items (such as soul shards). - if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); @@ -12880,9 +12877,7 @@ void Unit::setDeathState(DeathState s) zoneScript->OnUnitDeath(this); } else if (s == JUST_RESPAWNED) - { - RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) - } + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) m_deathState = s; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7d245539c97..d28ba9e1e19 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5272,66 +5272,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (!apply) - { - Unit* caster = GetCaster(); + if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH) + return; - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); + + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - Player* plCaster = caster->ToPlayer(); - Unit* target = aurApp->GetTarget(); + Player* plCaster = caster->ToPlayer(); + Unit* target = aurApp->GetTarget(); - if (target->getDeathState() != JUST_DIED) - return; + // Item amount + if (GetAmount() <= 0) + return; - // Item amount - if (GetAmount() <= 0) - return; + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + return; - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + // Soul Shard + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + { + // Soul Shard only from units that grant XP or honor + if (!plCaster->isHonorOrXPTarget(target) || + (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) return; - // Soul Shard - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + // If this is Drain Soul, check for Glyph of Drain Soul + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) { - // Soul Shard only from units that grant XP or honor - if (!plCaster->isHonorOrXPTarget(target) || - (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) - return; - - // If this is Drain Soul, check for Glyph of Drain Soul - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) - { - // Glyph of Drain Soul - chance to create an additional Soul Shard - if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) - if (roll_chance_i(aur->GetMiscValue())) - caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) - } + // Glyph of Drain Soul - chance to create an additional Soul Shard + if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) + if (roll_chance_i(aur->GetMiscValue())) + caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) } + } - //Adding items - uint32 noSpaceForCount = 0; - uint32 count = m_amount; - - ItemPosCountVec dest; - InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) - { - count-=noSpaceForCount; - plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); - if (count == 0) - return; - } + //Adding items + uint32 noSpaceForCount = 0; + uint32 count = m_amount; - Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); - if (!newitem) - { - plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + ItemPosCountVec dest; + InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) + { + count-=noSpaceForCount; + plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); + if (count == 0) return; - } - plCaster->SendNewItem(newitem, count, true, true); } + + Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); + if (!newitem) + { + plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + return; + } + plCaster->SendNewItem(newitem, count, true, true); } void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const |