mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 00:06:36 +00:00
Switched out our kinda juryrigged vector types for glm::vec types since we use that as a 3d math library already but never switched out the types
This commit is contained in:
+13
-13
@@ -20,7 +20,7 @@
|
||||
extern volatile bool ZoneLoaded;
|
||||
|
||||
Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
||||
: NPC(d, nullptr, xyz_heading(x, y, z, heading), 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000)
|
||||
: NPC(d, nullptr, glm::vec4(x, y, z, heading), 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000)
|
||||
{
|
||||
base_hp = d->max_hp;
|
||||
base_mana = d->Mana;
|
||||
@@ -1318,7 +1318,7 @@ bool Merc::IsMercCasterCombatRange(Mob *target) {
|
||||
// half the max so the merc doesn't always stop at max range to allow combat movement
|
||||
range *= .5;
|
||||
|
||||
float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition());
|
||||
float targetDistance = DistanceSquaredNoZ(m_Position, target->GetPosition());
|
||||
|
||||
if(targetDistance > range)
|
||||
result = false;
|
||||
@@ -1480,7 +1480,7 @@ void Merc::AI_Process() {
|
||||
if(IsMercCasterCombatRange(GetTarget()))
|
||||
atCombatRange = true;
|
||||
}
|
||||
else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) {
|
||||
else if(DistanceSquared(m_Position, GetTarget()->GetPosition()) <= meleeDistance) {
|
||||
atCombatRange = true;
|
||||
}
|
||||
|
||||
@@ -1513,7 +1513,7 @@ void Merc::AI_Process() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize()))
|
||||
else if(!IsMoving() && GetClass() != ROGUE && (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize()))
|
||||
{
|
||||
// If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up
|
||||
float newX = 0;
|
||||
@@ -1701,7 +1701,7 @@ void Merc::AI_Process() {
|
||||
|
||||
if(follow)
|
||||
{
|
||||
float dist = ComparativeDistance(m_Position, follow->GetPosition());
|
||||
float dist = DistanceSquared(m_Position, follow->GetPosition());
|
||||
float speed = GetRunspeed();
|
||||
|
||||
if(dist < GetFollowDistance() + 1000)
|
||||
@@ -1938,7 +1938,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon
|
||||
if (mercSpell.type & SpellType_Escape) {
|
||||
dist2 = 0;
|
||||
} else
|
||||
dist2 = ComparativeDistance(m_Position, tar->GetPosition());
|
||||
dist2 = DistanceSquared(m_Position, tar->GetPosition());
|
||||
|
||||
if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal)
|
||||
|| spells[spellid].targettype==ST_AECaster
|
||||
@@ -2435,7 +2435,7 @@ void Merc::CheckHateList() {
|
||||
if(MercOwner && MercOwner->GetTarget() && MercOwner->GetTarget()->IsNPC() && (MercOwner->GetTarget()->GetHateAmount(MercOwner) || MercOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(MercOwner->GetTarget())) {
|
||||
float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius);
|
||||
range = range * range;
|
||||
if(ComparativeDistanceNoZ(m_Position, MercOwner->GetTarget()->GetPosition()) < range) {
|
||||
if(DistanceSquaredNoZ(m_Position, MercOwner->GetTarget()->GetPosition()) < range) {
|
||||
AddToHateList(MercOwner->GetTarget(), 1);
|
||||
}
|
||||
}
|
||||
@@ -2445,7 +2445,7 @@ void Merc::CheckHateList() {
|
||||
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||
NPC* npc = *itr;
|
||||
float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition());
|
||||
float dist = DistanceSquaredNoZ(m_Position, npc->GetPosition());
|
||||
int radius = RuleI(Mercs, AggroRadius);
|
||||
radius *= radius;
|
||||
if(dist <= radius) {
|
||||
@@ -2457,7 +2457,7 @@ void Merc::CheckHateList() {
|
||||
if(!hate_list.IsEntOnHateList(npc)) {
|
||||
float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius);
|
||||
range *= range;
|
||||
if(ComparativeDistanceNoZ(m_Position, npc->GetPosition()) < range) {
|
||||
if(DistanceSquaredNoZ(m_Position, npc->GetPosition()) < range) {
|
||||
hate_list.AddEntToHateList(npc, 1);
|
||||
}
|
||||
}
|
||||
@@ -2499,7 +2499,7 @@ bool Merc::CheckAENuke(Merc* caster, Mob* tar, uint16 spell_id, uint8 &numTarget
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||
NPC* npc = *itr;
|
||||
|
||||
if(ComparativeDistanceNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) {
|
||||
if(DistanceSquaredNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) {
|
||||
if(!npc->IsMezzed()) {
|
||||
numTargets++;
|
||||
}
|
||||
@@ -4098,7 +4098,7 @@ bool Merc::CheckAETaunt() {
|
||||
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||
NPC* npc = *itr;
|
||||
float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition());
|
||||
float dist = DistanceSquaredNoZ(m_Position, npc->GetPosition());
|
||||
int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range);
|
||||
range *= range;
|
||||
|
||||
@@ -4201,7 +4201,7 @@ bool Merc::CheckConfidence() {
|
||||
|
||||
AggroRange = AggroRange * AggroRange;
|
||||
|
||||
if(ComparativeDistance(m_Position, mob->GetPosition()) > AggroRange) continue;
|
||||
if(DistanceSquared(m_Position, mob->GetPosition()) > AggroRange) continue;
|
||||
|
||||
CurrentCon = this->GetLevelCon(mob->GetLevel());
|
||||
switch(CurrentCon) {
|
||||
@@ -5150,7 +5150,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) {
|
||||
}
|
||||
|
||||
//check for merchant too far away
|
||||
if(ComparativeDistance(m_Position, merchant->GetPosition()) > USE_NPC_RANGE2) {
|
||||
if(DistanceSquared(m_Position, merchant->GetPosition()) > USE_NPC_RANGE2) {
|
||||
SendMercResponsePackets(18);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user