From 977692c07081e3ffb9076f41d6b15a00ee36b085 Mon Sep 17 00:00:00 2001 From: maximius Date: Wed, 18 Nov 2009 02:31:38 -0800 Subject: *Better (but still hacky) Dalaran Mageguard 'Trespasser!' conditions --HG-- branch : trunk --- src/bindings/scripts/scripts/northrend/dalaran.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/northrend/dalaran.cpp b/src/bindings/scripts/scripts/northrend/dalaran.cpp index ea06c2d3a0f..f7b01fd2551 100644 --- a/src/bindings/scripts/scripts/northrend/dalaran.cpp +++ b/src/bindings/scripts/scripts/northrend/dalaran.cpp @@ -67,26 +67,30 @@ struct TRINITY_DLL_DECL npc_mageguard_dalaranAI : public Scripted_NoMovementAI if (!pWho) return; - Player* pVisiblePlayer = NULL; - - if (pWho->GetTypeId() == TYPEID_PLAYER) - pVisiblePlayer = CAST_PLR(pWho); + if (pWho->GetZoneId() != 4395) // Dalaran + return; - if (!pVisiblePlayer || pVisiblePlayer->isGameMaster()) + if (!me->IsWithinDist(pWho, 50.0f, false)) return; - if (m_creature->GetDistance(pVisiblePlayer) >= 12.0f) + Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself(); + + if (!pPlayer || pPlayer->isGameMaster()) return; + float x = pWho->GetPositionX(); + float y = pWho->GetPositionY(); switch (m_creature->GetEntry()) { case 29254: - if (pVisiblePlayer->GetTeam() == HORDE) - DoCast(pVisiblePlayer, SPELL_TRESPASSER_A); + if (pPlayer->GetTeam() == HORDE) + if (x < 5760.0f && y > 665.0f && y < 812.0f) // Silver Enclave (Dalaran), fast check + DoCast(pWho, SPELL_TRESPASSER_A); break; case 29255: - if (pVisiblePlayer->GetTeam() == ALLIANCE) - DoCast(pVisiblePlayer, SPELL_TRESPASSER_H); + if (pPlayer->GetTeam() == ALLIANCE) + if (x > 5864.0f && y > 507.0f && y < 600.0f) // Sunreaver's Sanctuary (Dalaran), fast check + DoCast(pWho, SPELL_TRESPASSER_H); break; } return; -- cgit v1.2.3