Skip to content

Instantly share code, notes, and snippets.

@rsa
Created September 2, 2011 16:06
Show Gist options
  • Select an option

  • Save rsa/1189021 to your computer and use it in GitHub Desktop.

Select an option

Save rsa/1189021 to your computer and use it in GitHub Desktop.
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 94949e8..ea91a68 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7957,6 +7957,12 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
if (!pVictim || pdamage == 0 || (spellProto && spellProto->AttributesEx6 & SPELL_ATTR_EX6_NO_DMG_MODS))
return pdamage;
+ if (!pVictim->IsInWorld() || !pVictim->GetMap() || !GetMap())
+ return pdamage;
+
+ MAPLOCK_READ(this,MAP_LOCK_TYPE_AURAS);
+ MAPLOCK_READ1(pVictim,MAP_LOCK_TYPE_AURAS);
+
// differentiate for weapon damage based spells
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType,true,false) : NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment