mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
*Rewritten method for Dalaran Mageguards to determine if they should teleport you.
--HG-- branch : trunk
This commit is contained in:
@@ -36,6 +36,16 @@ enum Spells
|
||||
SPELL_TRESPASSER_H = 54029
|
||||
};
|
||||
|
||||
inline float __round(float x, int precision)
|
||||
{
|
||||
if (precision > 0)
|
||||
{
|
||||
x *= pow(10.0f, precision);
|
||||
return int(x > 0.0 ? x + 0.5 : x - 0.5)/precision;
|
||||
}
|
||||
return int(x > 0.0 ? x + 0.5 : x - 0.5);
|
||||
}
|
||||
|
||||
struct TRINITY_DLL_DECL npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
{
|
||||
npc_mageguard_dalaranAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
|
||||
@@ -70,7 +80,7 @@ struct TRINITY_DLL_DECL npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
if (pWho->GetZoneId() != 4395) // Dalaran
|
||||
return;
|
||||
|
||||
if (!me->IsWithinDist(pWho, 50.0f, false))
|
||||
if (!me->IsWithinDist(pWho, 100.0f, false))
|
||||
return;
|
||||
|
||||
Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
@@ -78,21 +88,25 @@ struct TRINITY_DLL_DECL npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
if (!pPlayer || pPlayer->isGameMaster())
|
||||
return;
|
||||
|
||||
float radians = me->GetAngle(pWho);
|
||||
float xWeight = __round(cos(radians), 3);
|
||||
float yWeight = __round(sin(radians), 3);
|
||||
float x = pWho->GetPositionX();
|
||||
float y = pWho->GetPositionY();
|
||||
switch (m_creature->GetEntry())
|
||||
{
|
||||
case 29254:
|
||||
if (pPlayer->GetTeam() == HORDE)
|
||||
if (x < 5760.0f && y > 665.0f && y < 812.0f) // Silver Enclave (Dalaran), fast check
|
||||
float myX = me->GetPositionX();
|
||||
float myY = me->GetPositionY();
|
||||
if (x + (2.0f * xWeight) < myX && y + (2.0f * yWeight) < myY)
|
||||
switch (m_creature->GetEntry())
|
||||
{
|
||||
case 29254:
|
||||
if (pPlayer->GetTeam() == HORDE)
|
||||
DoCast(pWho, SPELL_TRESPASSER_A);
|
||||
break;
|
||||
case 29255:
|
||||
if (pPlayer->GetTeam() == ALLIANCE)
|
||||
if (x > 5864.0f && y > 507.0f && y < 600.0f) // Sunreaver's Sanctuary (Dalaran), fast check
|
||||
break;
|
||||
case 29255:
|
||||
if (pPlayer->GetTeam() == ALLIANCE)
|
||||
DoCast(pWho, SPELL_TRESPASSER_H);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2529,7 +2529,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
|
||||
|
||||
// Charges can be set only for mods with auras
|
||||
if (!mod->ownerAura)
|
||||
assert(mod->charges==0);
|
||||
assert(mod->charges == 0);
|
||||
|
||||
if(!IsAffectedBySpellmod(spellInfo,mod,spell))
|
||||
continue;
|
||||
|
||||
@@ -10299,7 +10299,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att
|
||||
|
||||
// ..done (base at attack power for marked target and base at attack power for creature type)
|
||||
int32 APbonus = 0;
|
||||
if(attType == RANGED_ATTACK)
|
||||
if (attType == RANGED_ATTACK)
|
||||
{
|
||||
APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user