aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/northrend/dalaran.cpp24
1 files changed, 14 insertions, 10 deletions
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;