diff options
-rw-r--r-- | src/game/SpellEffects.cpp | 17 | ||||
-rw-r--r-- | src/game/Unit.cpp | 5 | ||||
-rw-r--r-- | src/game/Wintergrasp.cpp | 22 |
3 files changed, 42 insertions, 2 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 56679b1abe4..465730eaab6 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -7038,7 +7038,22 @@ void Spell::EffectRedirectThreat(uint32 /*i*/) void Spell::EffectWMODamage(uint32 /*i*/) { if(gameObjTarget && gameObjTarget->GetGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) - gameObjTarget->TakenDamage((uint32)damage); + { + Unit *caster = m_originalCaster; + if(!caster) + return; + + const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(gameObjTarget->GetEntry()); + if (!gInfo) + return; + + FactionTemplateEntry const *casterft, *goft; + casterft = caster->getFactionTemplateEntry(); + goft = sFactionTemplateStore.LookupEntry(gInfo->faction); + // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls) + if (casterft && goft && !casterft->IsFriendlyTo(*goft)) + gameObjTarget->TakenDamage((uint32)damage); + } } void Spell::EffectWMORepair(uint32 /*i*/) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6bdb04cd90f..33109f6851d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -14291,7 +14291,10 @@ void Unit::RestoreFaction() } if(CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo()) // normal creature - setFaction(cinfo->faction_A); + { + FactionTemplateEntry const *faction = getFactionTemplateEntry(); + setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A); + } } } diff --git a/src/game/Wintergrasp.cpp b/src/game/Wintergrasp.cpp index 8305d76ec47..4ebd7c3c6a6 100644 --- a/src/game/Wintergrasp.cpp +++ b/src/game/Wintergrasp.cpp @@ -630,6 +630,7 @@ bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature) const bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const { +/* switch(go->GetEntry()) { // Defender's Portal @@ -641,6 +642,27 @@ bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[OTHER_TEAM(m_defender)]); return true; } +*/ + const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(go->GetEntry()); + if (!gInfo) + return false; + + switch(gInfo->displayId) + { + case 8165: // Wintergrasp Keep Door + case 7877: // Wintergrasp Fortress Wall + case 7878: // Wintergrasp Keep Tower + case 7906: // Wintergrasp Fortress Gate + case 7909: // Wintergrasp Wall + case 8244: // Defender's Portal - Vehicle Teleporter + go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_defender]); + return true; + case 7900: // Flamewatch Tower - Shadowsight Tower - Winter's Edge Tower + case 7967: // Titan relic + go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[OTHER_TEAM(m_defender)]); + return true; +// case 8208: // Goblin Workshop + } // Note: this is only for test, still need db support TeamPairMap::const_iterator itr = m_goDisplayPair.find(go->GetGOInfo()->displayId); |