Core/Spells: Destructable Buildings

- Fix issue where damage can be done to GameObjects with hp 0
- add check for Gameobjects with faction 0

--HG--
branch : trunk
This commit is contained in:
Supabad
2010-10-19 13:15:47 +02:00
parent 43220cc1f6
commit b7b65eacf2
+6 -2
View File
@@ -6760,11 +6760,15 @@ void Spell::EffectWMODamage(SpellEffIndex /*effIndex*/)
if (!caster) if (!caster)
return; return;
// Do not allow damage if hp is 0
if (gameObjTarget->GetGOValue()->building.health == 0)
return;
FactionTemplateEntry const *casterft, *goft; FactionTemplateEntry const *casterft, *goft;
casterft = caster->getFactionTemplateEntry(); casterft = caster->getFactionTemplateEntry();
goft = sFactionTemplateStore.LookupEntry(gameObjTarget->GetUInt32Value(GAMEOBJECT_FACTION)); goft = sFactionTemplateStore.LookupEntry(gameObjTarget->GetUInt32Value(GAMEOBJECT_FACTION));
// Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls) // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls/Ulduar Storm Beacons)
if (casterft && goft && !casterft->IsFriendlyTo(*goft)) if ((casterft && goft && !casterft->IsFriendlyTo(*goft)) || !goft)
{ {
gameObjTarget->TakenDamage(uint32(damage), caster); gameObjTarget->TakenDamage(uint32(damage), caster);
WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8+8+8+4+4); WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8+8+8+4+4);