mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Merge pull request #342 from addtheice/data_bundling2
Looks fine on initial review.
This commit is contained in:
commit
8cde35ca88
@ -88,7 +88,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
|
|||||||
if (mob->IsClient()) //also ensures that mob != around
|
if (mob->IsClient()) //also ensures that mob != around
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mob->DistNoRoot(*from_who) > d2)
|
if (ComparativeDistance(mob->GetPosition(), from_who->GetPosition()) > d2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (engaged) {
|
if (engaged) {
|
||||||
@ -150,7 +150,8 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float dist2 = mob->DistNoRoot(*this);
|
float dist2 = ComparativeDistance(mob->GetPosition(), m_Position);
|
||||||
|
|
||||||
float iAggroRange2 = iAggroRange*iAggroRange;
|
float iAggroRange2 = iAggroRange*iAggroRange;
|
||||||
if( dist2 > iAggroRange2 ) {
|
if( dist2 > iAggroRange2 ) {
|
||||||
towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
|
towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
|
||||||
@ -295,7 +296,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
float dist2 = mob->DistNoRoot(*this);
|
float dist2 = ComparativeDistance(mob->GetPosition(), m_Position);
|
||||||
float iAggroRange2 = iAggroRange*iAggroRange;
|
float iAggroRange2 = iAggroRange*iAggroRange;
|
||||||
|
|
||||||
if( dist2 > iAggroRange2 ) {
|
if( dist2 > iAggroRange2 ) {
|
||||||
@ -413,7 +414,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude)
|
|||||||
|
|
||||||
AggroRange *= AggroRange;
|
AggroRange *= AggroRange;
|
||||||
|
|
||||||
if (mob->DistNoRoot(*attacker) > AggroRange)
|
if (ComparativeDistance(mob->GetPosition(), attacker->GetPosition()) > AggroRange)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
@ -443,7 +444,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
|
|||||||
// && !mob->IsCorpse()
|
// && !mob->IsCorpse()
|
||||||
// && mob->IsAIControlled()
|
// && mob->IsAIControlled()
|
||||||
&& mob->GetPrimaryFaction() != 0
|
&& mob->GetPrimaryFaction() != 0
|
||||||
&& mob->DistNoRoot(*sender) <= r
|
&& ComparativeDistance(mob->GetPosition(), sender->GetPosition()) <= r
|
||||||
&& !mob->IsEngaged()
|
&& !mob->IsEngaged()
|
||||||
&& ((!mob->IsPet()) || (mob->IsPet() && mob->GetOwner() && !mob->GetOwner()->IsClient()))
|
&& ((!mob->IsPet()) || (mob->IsPet() && mob->GetOwner() && !mob->GetOwner()->IsClient()))
|
||||||
// If we're a pet we don't react to any calls for help if our owner is a client
|
// If we're a pet we don't react to any calls for help if our owner is a client
|
||||||
@ -470,7 +471,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
|
|||||||
if(mob->CheckLosFN(sender)) {
|
if(mob->CheckLosFN(sender)) {
|
||||||
#if (EQDEBUG>=5)
|
#if (EQDEBUG>=5)
|
||||||
LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
|
LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
|
||||||
sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ()));
|
sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), ComparativeDistance(mob->GetPosition(), sender->GetPosition()), fabs(sender->GetZ()+mob->GetZ()));
|
||||||
#endif
|
#endif
|
||||||
mob->AddToHateList(attacker, 1, 0, false);
|
mob->AddToHateList(attacker, 1, 0, false);
|
||||||
}
|
}
|
||||||
@ -877,7 +878,7 @@ bool Mob::CombatRange(Mob* other)
|
|||||||
if (size_mod > 10000)
|
if (size_mod > 10000)
|
||||||
size_mod = size_mod / 7;
|
size_mod = size_mod / 7;
|
||||||
|
|
||||||
float _DistNoRoot = DistNoRoot(*other);
|
float _DistNoRoot = ComparativeDistance(m_Position, other->GetPosition());
|
||||||
|
|
||||||
if (GetSpecialAbility(NPC_CHASE_DISTANCE)){
|
if (GetSpecialAbility(NPC_CHASE_DISTANCE)){
|
||||||
|
|
||||||
|
|||||||
@ -68,19 +68,12 @@ Beacon::Beacon(Mob *at_mob, int lifetime)
|
|||||||
caster_id = 0;
|
caster_id = 0;
|
||||||
|
|
||||||
if(lifetime)
|
if(lifetime)
|
||||||
{
|
|
||||||
remove_timer.Start();
|
remove_timer.Start();
|
||||||
}
|
}
|
||||||
#ifdef SOLAR
|
|
||||||
entity_list.Message(0, 0, "Beacon being created at %0.2f %0.2f %0.2f heading %0.2f lifetime %d", GetX(), GetY(), GetZ(), GetHeading(), lifetime);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Beacon::~Beacon()
|
Beacon::~Beacon()
|
||||||
{
|
{
|
||||||
#ifdef SOLAR
|
|
||||||
entity_list.Message(0, 0, "Beacon %d being removed at %0.2f %0.2f %0.2f heading %0.2f", GetID(), GetX(), GetY(), GetZ(), GetHeading());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Beacon::Process()
|
bool Beacon::Process()
|
||||||
|
|||||||
18
zone/bot.cpp
18
zone/bot.cpp
@ -3354,7 +3354,7 @@ void Bot::AI_Process() {
|
|||||||
if(GetHasBeenSummoned()) {
|
if(GetHasBeenSummoned()) {
|
||||||
if(IsBotCaster() || IsBotArcher()) {
|
if(IsBotCaster() || IsBotArcher()) {
|
||||||
if (AImovement_timer->Check()) {
|
if (AImovement_timer->Check()) {
|
||||||
if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistNoRootNoZ(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y) < 10)) {
|
if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (ComparativeDistanceNoZ(static_cast<xyz_location>(m_Position), m_PreSummonLocation) < 10)) {
|
||||||
if(GetTarget())
|
if(GetTarget())
|
||||||
FaceTarget(GetTarget());
|
FaceTarget(GetTarget());
|
||||||
SetHasBeenSummoned(false);
|
SetHasBeenSummoned(false);
|
||||||
@ -3505,7 +3505,7 @@ void Bot::AI_Process() {
|
|||||||
if(IsBotCasterCombatRange(GetTarget()))
|
if(IsBotCasterCombatRange(GetTarget()))
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
else if(DistNoRoot(*GetTarget()) <= meleeDistance) {
|
else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) {
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3533,7 +3533,7 @@ void Bot::AI_Process() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) {
|
else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(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
|
// 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;
|
float newX = 0;
|
||||||
float newY = 0;
|
float newY = 0;
|
||||||
@ -3732,7 +3732,7 @@ void Bot::AI_Process() {
|
|||||||
Mob* follow = entity_list.GetMob(GetFollowID());
|
Mob* follow = entity_list.GetMob(GetFollowID());
|
||||||
|
|
||||||
if(follow) {
|
if(follow) {
|
||||||
float dist = DistNoRoot(*follow);
|
float dist = ComparativeDistance(m_Position, follow->GetPosition());
|
||||||
float speed = follow->GetRunspeed();
|
float speed = follow->GetRunspeed();
|
||||||
|
|
||||||
if(dist < GetFollowDistance() + 1000)
|
if(dist < GetFollowDistance() + 1000)
|
||||||
@ -3865,7 +3865,7 @@ void Bot::PetAIProcess() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(botPet->DistNoRootNoZ(*botPet->GetTarget()) < botPet->GetTarget()->GetSize()) {
|
else if(ComparativeDistanceNoZ(botPet->GetPosition(), botPet->GetTarget()->GetPosition()) < botPet->GetTarget()->GetSize()) {
|
||||||
// Let's try to adjust our melee range so we don't appear to be bunched up
|
// Let's try to adjust our melee range so we don't appear to be bunched up
|
||||||
bool isBehindMob = false;
|
bool isBehindMob = false;
|
||||||
bool moveBehindMob = false;
|
bool moveBehindMob = false;
|
||||||
@ -4003,7 +4003,7 @@ void Bot::PetAIProcess() {
|
|||||||
switch(pStandingPetOrder) {
|
switch(pStandingPetOrder) {
|
||||||
case SPO_Follow:
|
case SPO_Follow:
|
||||||
{
|
{
|
||||||
float dist = botPet->DistNoRoot(*botPet->GetTarget());
|
float dist = ComparativeDistance(botPet->GetPosition(), botPet->GetTarget()->GetPosition());
|
||||||
botPet->SetRunAnimSpeed(0);
|
botPet->SetRunAnimSpeed(0);
|
||||||
if(dist > 184) {
|
if(dist > 184) {
|
||||||
botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetTarget()->GetRunspeed());
|
botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetTarget()->GetRunspeed());
|
||||||
@ -10387,7 +10387,7 @@ bool Bot::IsArcheryRange(Mob *target) {
|
|||||||
|
|
||||||
range *= range;
|
range *= range;
|
||||||
|
|
||||||
float targetDistance = DistNoRootNoZ(*target);
|
float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition());
|
||||||
|
|
||||||
float minRuleDistance = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist);
|
float minRuleDistance = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist);
|
||||||
|
|
||||||
@ -10411,7 +10411,7 @@ bool Bot::IsBotCasterCombatRange(Mob *target) {
|
|||||||
// half the max so the bot doesn't always stop at max range to allow combat movement
|
// half the max so the bot doesn't always stop at max range to allow combat movement
|
||||||
range *= .5;
|
range *= .5;
|
||||||
|
|
||||||
float targetDistance = DistNoRootNoZ(*target);
|
float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition());
|
||||||
|
|
||||||
if(targetDistance > range)
|
if(targetDistance > range)
|
||||||
result = false;
|
result = false;
|
||||||
@ -15811,7 +15811,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
|
|||||||
|
|
||||||
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
||||||
curMob = it->second;
|
curMob = it->second;
|
||||||
if (curMob && curMob->DistNoZ(*client)<=Distance) {
|
if (curMob && DistanceNoZ(curMob->GetPosition(), client->GetPosition()) <= Distance) {
|
||||||
if(curMob->IsTrackable()) {
|
if(curMob->IsTrackable()) {
|
||||||
Mob* cur_entity = curMob;
|
Mob* cur_entity = curMob;
|
||||||
int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient());
|
int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient());
|
||||||
|
|||||||
@ -898,7 +898,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
|||||||
if (AIspells[i].type & SpellType_Escape) {
|
if (AIspells[i].type & SpellType_Escape) {
|
||||||
dist2 = 0;
|
dist2 = 0;
|
||||||
} else
|
} else
|
||||||
dist2 = DistNoRoot(*tar);
|
dist2 = ComparativeDistance(m_Position, tar->GetPosition());
|
||||||
|
|
||||||
if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2)
|
if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2)
|
||||||
|| spells[AIspells[i].spellid].targettype==ST_AECaster
|
|| spells[AIspells[i].spellid].targettype==ST_AECaster
|
||||||
@ -1755,7 +1755,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) {
|
|||||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||||
NPC* npc = *itr;
|
NPC* npc = *itr;
|
||||||
|
|
||||||
if(npc->DistNoRootNoZ(*botCaster) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) {
|
if(ComparativeDistanceNoZ(npc->GetPosition(), botCaster->GetPosition()) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) {
|
||||||
if(!npc->IsMezzed()) {
|
if(!npc->IsMezzed()) {
|
||||||
if(botCaster->HasGroup()) {
|
if(botCaster->HasGroup()) {
|
||||||
Group* g = botCaster->GetGroup();
|
Group* g = botCaster->GetGroup();
|
||||||
|
|||||||
@ -40,6 +40,7 @@ extern volatile bool RunLoops;
|
|||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
#include "../common/string_util.h"
|
#include "../common/string_util.h"
|
||||||
#include "../common/data_verification.h"
|
#include "../common/data_verification.h"
|
||||||
|
#include "position.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
@ -993,7 +994,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
|||||||
CheckEmoteHail(GetTarget(), message);
|
CheckEmoteHail(GetTarget(), message);
|
||||||
|
|
||||||
|
|
||||||
if(DistNoRootNoZ(*GetTarget()) <= 200) {
|
if(ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) {
|
||||||
NPC *tar = GetTarget()->CastToNPC();
|
NPC *tar = GetTarget()->CastToNPC();
|
||||||
parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language);
|
parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language);
|
||||||
|
|
||||||
@ -1005,7 +1006,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (DistNoRootNoZ(*GetTarget()) <= 200) {
|
if (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) {
|
||||||
parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language);
|
parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2539,7 +2540,7 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if (!GetFeigned() && (bindmob->DistNoRoot(*this) <= 400)) {
|
if (!GetFeigned() && (ComparativeDistance(bindmob->GetPosition(), m_Position) <= 400)) {
|
||||||
// send bindmob bind done
|
// send bindmob bind done
|
||||||
if(!bindmob->IsAIControlled() && bindmob != this ) {
|
if(!bindmob->IsAIControlled() && bindmob != this ) {
|
||||||
|
|
||||||
@ -3178,7 +3179,7 @@ void Client::Insight(uint32 t_id)
|
|||||||
Message(0,"This ability can only be used on NPCs.");
|
Message(0,"This ability can only be used on NPCs.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Dist(*who) > 200)
|
if (Distance(static_cast<xyz_location>(m_Position), static_cast<xyz_location>(who->GetPosition())) > 200)
|
||||||
{
|
{
|
||||||
Message(0,"You must get closer to your target!");
|
Message(0,"You must get closer to your target!");
|
||||||
return;
|
return;
|
||||||
@ -4552,7 +4553,7 @@ void Client::HandleLDoNOpen(NPC *target)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if(ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range",
|
LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range",
|
||||||
GetName(), target->GetName(), target->GetName());
|
GetName(), target->GetName(), target->GetName());
|
||||||
@ -6186,7 +6187,7 @@ void Client::DragCorpses()
|
|||||||
Mob *corpse = entity_list.GetMob(It->second);
|
Mob *corpse = entity_list.GetMob(It->second);
|
||||||
|
|
||||||
if (corpse && corpse->IsPlayerCorpse() &&
|
if (corpse && corpse->IsPlayerCorpse() &&
|
||||||
(DistNoRootNoZ(*corpse) <= RuleR(Character, DragCorpseDistance)))
|
(ComparativeDistanceNoZ(m_Position, corpse->GetPosition()) <= RuleR(Character, DragCorpseDistance)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!corpse || !corpse->IsPlayerCorpse() ||
|
if (!corpse || !corpse->IsPlayerCorpse() ||
|
||||||
|
|||||||
@ -2030,7 +2030,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to them to be properly using them
|
//you have to be somewhat close to them to be properly using them
|
||||||
if (DistNoRoot(*tmp) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
merchantid = tmp->CastToNPC()->MerchantType;
|
merchantid = tmp->CastToNPC()->MerchantType;
|
||||||
@ -2205,7 +2205,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to them to be properly using them
|
//you have to be somewhat close to them to be properly using them
|
||||||
if (DistNoRoot(*tmp) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
merchantid = tmp->CastToNPC()->MerchantType;
|
merchantid = tmp->CastToNPC()->MerchantType;
|
||||||
@ -2296,7 +2296,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DistNoRoot(*vendor) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2)
|
||||||
{
|
{
|
||||||
Message(13, "Vendor is out of range.");
|
Message(13, "Vendor is out of range.");
|
||||||
return;
|
return;
|
||||||
@ -2554,7 +2554,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app
|
|||||||
|
|
||||||
NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer));
|
NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer));
|
||||||
if (tar) {
|
if (tar) {
|
||||||
if (DistNoRoot(*tar) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
||||||
@ -2633,7 +2633,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
|
|||||||
AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer;
|
AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer;
|
||||||
NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id);
|
NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id);
|
||||||
if (tar) {
|
if (tar) {
|
||||||
if (DistNoRoot(*tar) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tar->GetPosition())> USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
||||||
@ -2770,7 +2770,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id);
|
NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id);
|
||||||
if (tar) {
|
if (tar) {
|
||||||
if (DistNoRoot(*tar) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
||||||
@ -2867,7 +2867,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app)
|
|||||||
AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer;
|
AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer;
|
||||||
NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id);
|
NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id);
|
||||||
if (tar) {
|
if (tar) {
|
||||||
if (DistNoRoot(*tar) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
|
||||||
@ -3025,7 +3025,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app)
|
|||||||
if (assistee->GetTarget()) {
|
if (assistee->GetTarget()) {
|
||||||
Mob *new_target = assistee->GetTarget();
|
Mob *new_target = assistee->GetTarget();
|
||||||
if (new_target && (GetGM() ||
|
if (new_target && (GetGM() ||
|
||||||
Dist(*assistee) <= TARGETING_RANGE)) {
|
Distance(m_Position, assistee->GetPosition()) <= TARGETING_RANGE)) {
|
||||||
SetAssistExemption(true);
|
SetAssistExemption(true);
|
||||||
eid->entity_id = new_target->GetID();
|
eid->entity_id = new_target->GetID();
|
||||||
}
|
}
|
||||||
@ -8707,7 +8707,7 @@ void Client::Handle_OP_LDoNDisarmTraps(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
if (HasSkill(SkillDisarmTraps))
|
if (HasSkill(SkillDisarmTraps))
|
||||||
{
|
{
|
||||||
if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
Message(13, "%s is too far away.", target->GetCleanName());
|
Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
@ -8740,7 +8740,7 @@ void Client::Handle_OP_LDoNPickLock(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
if (HasSkill(SkillPickLock))
|
if (HasSkill(SkillPickLock))
|
||||||
{
|
{
|
||||||
if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
Message(13, "%s is too far away.", target->GetCleanName());
|
Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
@ -8759,7 +8759,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
if (HasSkill(SkillSenseTraps))
|
if (HasSkill(SkillSenseTraps))
|
||||||
{
|
{
|
||||||
if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
Message(13, "%s is too far away.", target->GetCleanName());
|
Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
@ -9182,7 +9182,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
SetLooting(ent->GetID()); //store the entity we are looting
|
SetLooting(ent->GetID()); //store the entity we are looting
|
||||||
Corpse *ent_corpse = ent->CastToCorpse();
|
Corpse *ent_corpse = ent->CastToCorpse();
|
||||||
if (DistNoRootNoZ(ent_corpse->GetX(), ent_corpse->GetY()) > 625)
|
if (ComparativeDistanceNoZ(m_Position, ent_corpse->GetPosition()) > 625)
|
||||||
{
|
{
|
||||||
Message(13, "Corpse too far away.");
|
Message(13, "Corpse too far away.");
|
||||||
Corpse::SendLootReqErrorPacket(this);
|
Corpse::SendLootReqErrorPacket(this);
|
||||||
@ -9414,7 +9414,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
|
|||||||
int mercTypeCount = 0;
|
int mercTypeCount = 0;
|
||||||
int mercCount = 0;
|
int mercCount = 0;
|
||||||
|
|
||||||
if (DistNoRoot(*tar) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tar->GetClass() != MERCERNARY_MASTER) {
|
if (tar->GetClass() != MERCERNARY_MASTER) {
|
||||||
@ -9796,7 +9796,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
|
|||||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||||
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
|
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
|
||||||
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == GUILD_TRIBUTE_MASTER
|
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == GUILD_TRIBUTE_MASTER
|
||||||
&& DistNoRoot(*tribmast) <= USE_NPC_RANGE2) {
|
&& ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) {
|
||||||
st->response = 1;
|
st->response = 1;
|
||||||
QueuePacket(app);
|
QueuePacket(app);
|
||||||
tribute_master_id = st->tribute_master_id;
|
tribute_master_id = st->tribute_master_id;
|
||||||
@ -9828,7 +9828,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
|
|||||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||||
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
|
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
|
||||||
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == TRIBUTE_MASTER
|
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == TRIBUTE_MASTER
|
||||||
&& DistNoRoot(*tribmast) <= USE_NPC_RANGE2) {
|
&& ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) {
|
||||||
st->response = 1;
|
st->response = 1;
|
||||||
QueuePacket(app);
|
QueuePacket(app);
|
||||||
tribute_master_id = st->tribute_master_id;
|
tribute_master_id = st->tribute_master_id;
|
||||||
@ -9923,7 +9923,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) {
|
if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) {
|
||||||
if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
|
if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
|
||||||
if (mypet->IsHeld()) {
|
if (mypet->IsHeld()) {
|
||||||
if (!mypet->IsFocused()) {
|
if (!mypet->IsFocused()) {
|
||||||
mypet->SetHeld(false); //break the hold and guard if we explicitly tell the pet to attack.
|
mypet->SetHeld(false); //break the hold and guard if we explicitly tell the pet to attack.
|
||||||
@ -9958,7 +9958,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) {
|
if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) {
|
||||||
if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
|
if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
|
||||||
zone->AddAggroMob();
|
zone->AddAggroMob();
|
||||||
mypet->AddToHateList(GetTarget(), 1);
|
mypet->AddToHateList(GetTarget(), 1);
|
||||||
Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName());
|
Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName());
|
||||||
@ -12102,7 +12102,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
|
|||||||
if (mp->quantity < 1) return;
|
if (mp->quantity < 1) return;
|
||||||
|
|
||||||
//you have to be somewhat close to them to be properly using them
|
//you have to be somewhat close to them to be properly using them
|
||||||
if (DistNoRoot(*tmp) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
merchantid = tmp->CastToNPC()->MerchantType;
|
merchantid = tmp->CastToNPC()->MerchantType;
|
||||||
@ -12351,7 +12351,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to them to be properly using them
|
//you have to be somewhat close to them to be properly using them
|
||||||
if (DistNoRoot(*vendor) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 price = 0;
|
uint32 price = 0;
|
||||||
@ -12510,7 +12510,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to them to be properly using them
|
//you have to be somewhat close to them to be properly using them
|
||||||
if (DistNoRoot(*tmp) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
merchantid = tmp->CastToNPC()->MerchantType;
|
merchantid = tmp->CastToNPC()->MerchantType;
|
||||||
@ -13006,7 +13006,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
// For /target, send reject or success packet
|
// For /target, send reject or success packet
|
||||||
if (app->GetOpcode() == OP_TargetCommand) {
|
if (app->GetOpcode() == OP_TargetCommand) {
|
||||||
if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (DistNoRoot(*GetTarget()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) {
|
if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) {
|
||||||
if (GetTarget()->GetBodyType() == BT_NoTarget2 || GetTarget()->GetBodyType() == BT_Special
|
if (GetTarget()->GetBodyType() == BT_NoTarget2 || GetTarget()->GetBodyType() == BT_Special
|
||||||
|| GetTarget()->GetBodyType() == BT_NoTarget)
|
|| GetTarget()->GetBodyType() == BT_NoTarget)
|
||||||
{
|
{
|
||||||
@ -13095,9 +13095,9 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
else if (GetBindSightTarget())
|
else if (GetBindSightTarget())
|
||||||
{
|
{
|
||||||
if (GetBindSightTarget()->DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
if (ComparativeDistance(GetBindSightTarget()->GetPosition(), GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
||||||
{
|
{
|
||||||
if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
||||||
{
|
{
|
||||||
char *hacker_str = nullptr;
|
char *hacker_str = nullptr;
|
||||||
MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units,"
|
MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units,"
|
||||||
@ -13111,7 +13111,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
else if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip))
|
||||||
{
|
{
|
||||||
char *hacker_str = nullptr;
|
char *hacker_str = nullptr;
|
||||||
MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units,"
|
MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units,"
|
||||||
@ -13743,7 +13743,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
|
|||||||
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
|
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
|
||||||
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
|
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
|
||||||
return;
|
return;
|
||||||
if (DistNoRoot(*tribmast) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t->tribute_points = TributeItem(t->slot, t->quantity);
|
t->tribute_points = TributeItem(t->slot, t->quantity);
|
||||||
@ -13772,7 +13772,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
|
|||||||
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
|
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
|
||||||
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
|
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
|
||||||
return;
|
return;
|
||||||
if (DistNoRoot(*tribmast) > USE_NPC_RANGE2)
|
if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t->tribute_points = TributeMoney(t->platinum);
|
t->tribute_points = TributeMoney(t->platinum);
|
||||||
|
|||||||
@ -1601,7 +1601,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to a trainer to be properly using them
|
//you have to be somewhat close to a trainer to be properly using them
|
||||||
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
|
if(ComparativeDistance(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas
|
// if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas
|
||||||
@ -1649,7 +1649,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to a trainer to be properly using them
|
//you have to be somewhat close to a trainer to be properly using them
|
||||||
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
|
if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// goodbye message
|
// goodbye message
|
||||||
@ -1678,7 +1678,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//you have to be somewhat close to a trainer to be properly using them
|
//you have to be somewhat close to a trainer to be properly using them
|
||||||
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
|
if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gmskill->skillbank == 0x01)
|
if (gmskill->skillbank == 0x01)
|
||||||
|
|||||||
@ -4908,7 +4908,7 @@ void command_manaburn(Client *c, const Seperator *sep)
|
|||||||
c->Message(0, "#Manaburn needs a target.");
|
c->Message(0, "#Manaburn needs a target.");
|
||||||
else {
|
else {
|
||||||
int cur_level=c->GetAA(MANA_BURN);//ManaBurn ID
|
int cur_level=c->GetAA(MANA_BURN);//ManaBurn ID
|
||||||
if (c->DistNoRootNoZ(*target) > 200)
|
if (ComparativeDistance(c->GetPosition(), target->GetPosition()) > 200)
|
||||||
c->Message(0,"You are too far away from your target.");
|
c->Message(0,"You are too far away from your target.");
|
||||||
else {
|
else {
|
||||||
if(cur_level == 1) {
|
if(cur_level == 1) {
|
||||||
@ -10183,7 +10183,7 @@ void command_distance(Client *c, const Seperator *sep) {
|
|||||||
if(c && c->GetTarget()) {
|
if(c && c->GetTarget()) {
|
||||||
Mob* target = c->GetTarget();
|
Mob* target = c->GetTarget();
|
||||||
|
|
||||||
c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), c->Dist(*target));
|
c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), Distance(c->GetPosition(), target->GetPosition()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10305,7 +10305,7 @@ void command_disarmtrap(Client *c, const Seperator *sep)
|
|||||||
{
|
{
|
||||||
if(c->HasSkill(SkillDisarmTraps))
|
if(c->HasSkill(SkillDisarmTraps))
|
||||||
{
|
{
|
||||||
if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
c->Message(13, "%s is too far away.", target->GetCleanName());
|
c->Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
@ -10330,7 +10330,7 @@ void command_sensetrap(Client *c, const Seperator *sep)
|
|||||||
{
|
{
|
||||||
if(c->HasSkill(SkillSenseTraps))
|
if(c->HasSkill(SkillSenseTraps))
|
||||||
{
|
{
|
||||||
if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
c->Message(13, "%s is too far away.", target->GetCleanName());
|
c->Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
@ -10355,7 +10355,7 @@ void command_picklock(Client *c, const Seperator *sep)
|
|||||||
{
|
{
|
||||||
if(c->HasSkill(SkillPickLock))
|
if(c->HasSkill(SkillPickLock))
|
||||||
{
|
{
|
||||||
if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse))
|
if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
|
||||||
{
|
{
|
||||||
c->Message(13, "%s is too far away.", target->GetCleanName());
|
c->Message(13, "%s is too far away.", target->GetCleanName());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1328,7 +1328,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
|||||||
client->Message(13, "That corpse is locked by a GM.");
|
client->Message(13, "That corpse is locked by a GM.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) {
|
if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) {
|
||||||
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
||||||
is_corpse_changed = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1343,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
|||||||
std::list<std::string>::iterator itr;
|
std::list<std::string>::iterator itr;
|
||||||
for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) {
|
for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) {
|
||||||
if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) {
|
if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) {
|
||||||
if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) {
|
if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) {
|
||||||
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
GMMove(client->GetX(), client->GetY(), client->GetZ());
|
||||||
is_corpse_changed = true;
|
is_corpse_changed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "string_ids.h"
|
#include "string_ids.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
|
#include "position.h"
|
||||||
|
|
||||||
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
|
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
|
||||||
{
|
{
|
||||||
@ -673,7 +674,7 @@ void EntityList::AETaunt(Client* taunter, float range)
|
|||||||
zdiff *= -1;
|
zdiff *= -1;
|
||||||
if (zdiff < 10
|
if (zdiff < 10
|
||||||
&& taunter->IsAttackAllowed(them)
|
&& taunter->IsAttackAllowed(them)
|
||||||
&& taunter->DistNoRootNoZ(*them) <= range) {
|
&& ComparativeDistanceNoZ(taunter->GetPosition(), them->GetPosition()) <= range) {
|
||||||
if (taunter->CheckLosFN(them)) {
|
if (taunter->CheckLosFN(them)) {
|
||||||
taunter->Taunt(them, true);
|
taunter->Taunt(them, true);
|
||||||
}
|
}
|
||||||
@ -720,10 +721,10 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spells[spell_id].targettype == ST_Ring) {
|
if (spells[spell_id].targettype == ST_Ring) {
|
||||||
dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ());
|
dist_targ = ComparativeDistance(static_cast<xyz_location>(curmob->GetPosition()), caster->GetTargetRingLocation());
|
||||||
}
|
}
|
||||||
else if (center) {
|
else if (center) {
|
||||||
dist_targ = center->DistNoRoot(*curmob);
|
dist_targ = ComparativeDistance(curmob->GetPosition(), center->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dist_targ > dist2) //make sure they are in range
|
if (dist_targ > dist2) //make sure they are in range
|
||||||
@ -795,7 +796,7 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a
|
|||||||
continue;
|
continue;
|
||||||
if (curmob == caster && !affect_caster) //watch for caster too
|
if (curmob == caster && !affect_caster) //watch for caster too
|
||||||
continue;
|
continue;
|
||||||
if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range
|
if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Only npcs mgb should hit are client pets...
|
//Only npcs mgb should hit are client pets...
|
||||||
@ -837,7 +838,7 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff
|
|||||||
continue;
|
continue;
|
||||||
if (curmob == caster && !affect_caster) //watch for caster too
|
if (curmob == caster && !affect_caster) //watch for caster too
|
||||||
continue;
|
continue;
|
||||||
if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range
|
if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range
|
||||||
continue;
|
continue;
|
||||||
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
|
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
|
||||||
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
|
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
|
||||||
@ -887,7 +888,7 @@ void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count, bool I
|
|||||||
&& curmob != attacker //this is not needed unless NPCs can use this
|
&& curmob != attacker //this is not needed unless NPCs can use this
|
||||||
&&(attacker->IsAttackAllowed(curmob))
|
&&(attacker->IsAttackAllowed(curmob))
|
||||||
&& curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */
|
&& curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */
|
||||||
&& (curmob->DistNoRoot(*attacker) <= dist2)
|
&& (ComparativeDistance(curmob->GetPosition(), attacker->GetPosition()) <= dist2)
|
||||||
) {
|
) {
|
||||||
attacker->Attack(curmob, Hand, false, false, IsFromSpell);
|
attacker->Attack(curmob, Hand, false, false, IsFromSpell);
|
||||||
hit++;
|
hit++;
|
||||||
|
|||||||
@ -1119,7 +1119,7 @@ void EntityList::ChannelMessage(Mob *from, uint8 chan_num, uint8 language,
|
|||||||
filter = FilterAuctions;
|
filter = FilterAuctions;
|
||||||
//
|
//
|
||||||
// Only say is limited in range
|
// Only say is limited in range
|
||||||
if (chan_num != 8 || client->Dist(*from) < 200)
|
if (chan_num != 8 || Distance(client->GetPosition(), from->GetPosition()) < 200)
|
||||||
if (filter == FilterNone || client->GetFilter(filter) != FilterHide)
|
if (filter == FilterNone || client->GetFilter(filter) != FilterHide)
|
||||||
client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer);
|
client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer);
|
||||||
++it;
|
++it;
|
||||||
@ -1442,7 +1442,7 @@ void EntityList::QueueCloseClients(Mob *sender, const EQApplicationPacket *app,
|
|||||||
|| (filter2 == FilterShowGroupOnly && (sender == ent ||
|
|| (filter2 == FilterShowGroupOnly && (sender == ent ||
|
||||||
(ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender))))
|
(ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender))))
|
||||||
|| (filter2 == FilterShowSelfOnly && ent == sender))
|
|| (filter2 == FilterShowSelfOnly && ent == sender))
|
||||||
&& (ent->DistNoRoot(*sender) <= dist2)) {
|
&& (ComparativeDistance(ent->GetPosition(), sender->GetPosition()) <= dist2)) {
|
||||||
ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
|
ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1558,7 +1558,7 @@ Client *EntityList::GetRandomClient(const xyz_location& location, float Distance
|
|||||||
|
|
||||||
|
|
||||||
for (auto it = client_list.begin();it != client_list.end(); ++it)
|
for (auto it = client_list.begin();it != client_list.end(); ++it)
|
||||||
if ((it->second != ExcludeClient) && (it->second->DistNoRoot(location.m_X, location.m_Y, location.m_Z) <= Distance))
|
if ((it->second != ExcludeClient) && (ComparativeDistance(static_cast<xyz_location>(it->second->GetPosition()), location) <= Distance))
|
||||||
ClientsInRange.push_back(it->second);
|
ClientsInRange.push_back(it->second);
|
||||||
|
|
||||||
if (ClientsInRange.empty())
|
if (ClientsInRange.empty())
|
||||||
@ -1584,7 +1584,7 @@ Corpse *EntityList::GetCorpseByOwnerWithinRange(Client *client, Mob *center, int
|
|||||||
auto it = corpse_list.begin();
|
auto it = corpse_list.begin();
|
||||||
while (it != corpse_list.end()) {
|
while (it != corpse_list.end()) {
|
||||||
if (it->second->IsPlayerCorpse())
|
if (it->second->IsPlayerCorpse())
|
||||||
if (center->DistNoRootNoZ(*it->second) < range &&
|
if (ComparativeDistanceNoZ(center->GetPosition(), it->second->GetPosition()) < range &&
|
||||||
strcasecmp(it->second->GetOwnerName(), client->GetName()) == 0)
|
strcasecmp(it->second->GetOwnerName(), client->GetName()) == 0)
|
||||||
return it->second;
|
return it->second;
|
||||||
++it;
|
++it;
|
||||||
@ -1921,7 +1921,7 @@ void EntityList::MessageClose_StringID(Mob *sender, bool skipsender, float dist,
|
|||||||
|
|
||||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||||
c = it->second;
|
c = it->second;
|
||||||
if(c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender))
|
if(c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender))
|
||||||
c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9);
|
c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1937,7 +1937,7 @@ void EntityList::FilteredMessageClose_StringID(Mob *sender, bool skipsender,
|
|||||||
|
|
||||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||||
c = it->second;
|
c = it->second;
|
||||||
if (c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender))
|
if (c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender))
|
||||||
c->FilteredMessage_StringID(sender, type, filter, string_id,
|
c->FilteredMessage_StringID(sender, type, filter, string_id,
|
||||||
message1, message2, message3, message4, message5,
|
message1, message2, message3, message4, message5,
|
||||||
message6, message7, message8, message9);
|
message6, message7, message8, message9);
|
||||||
@ -1985,7 +1985,7 @@ void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 t
|
|||||||
|
|
||||||
auto it = client_list.begin();
|
auto it = client_list.begin();
|
||||||
while (it != client_list.end()) {
|
while (it != client_list.end()) {
|
||||||
if (it->second->DistNoRoot(*sender) <= dist2 && (!skipsender || it->second != sender))
|
if (ComparativeDistance(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender))
|
||||||
it->second->Message(type, buffer);
|
it->second->Message(type, buffer);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@ -2460,7 +2460,7 @@ void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate,
|
|||||||
//bool Grouped = client->HasGroup() && mob->IsClient() && (client->GetGroup() == mob->CastToClient()->GetGroup());
|
//bool Grouped = client->HasGroup() && mob->IsClient() && (client->GetGroup() == mob->CastToClient()->GetGroup());
|
||||||
|
|
||||||
//if (range == 0 || (iterator.GetData() == alwayssend) || Grouped || (mob->DistNoRootNoZ(*client) <= range)) {
|
//if (range == 0 || (iterator.GetData() == alwayssend) || Grouped || (mob->DistNoRootNoZ(*client) <= range)) {
|
||||||
if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (mob->DistNoRoot(*client) <= range)) {
|
if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (ComparativeDistance(mob->GetPosition(), client->GetPosition()) <= range)) {
|
||||||
mob->MakeSpawnUpdate(ppu);
|
mob->MakeSpawnUpdate(ppu);
|
||||||
}
|
}
|
||||||
if(mob && mob->IsClient() && mob->GetID()>0) {
|
if(mob && mob->IsClient() && mob->GetID()>0) {
|
||||||
@ -2942,7 +2942,7 @@ bool EntityList::MakeTrackPacket(Client *client)
|
|||||||
it->second->IsInvisible(client))
|
it->second->IsInvisible(client))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MobDistance = it->second->DistNoZ(*client);
|
MobDistance = DistanceNoZ(it->second->GetPosition(), client->GetPosition());
|
||||||
if (MobDistance > distance)
|
if (MobDistance > distance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -2991,7 +2991,8 @@ void EntityList::MessageGroup(Mob *sender, bool skipclose, uint32 type, const ch
|
|||||||
|
|
||||||
auto it = client_list.begin();
|
auto it = client_list.begin();
|
||||||
while (it != client_list.end()) {
|
while (it != client_list.end()) {
|
||||||
if (it->second != sender && (it->second->Dist(*sender) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) {
|
if (it->second != sender &&
|
||||||
|
(Distance(it->second->GetPosition(), sender->GetPosition()) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) {
|
||||||
it->second->Message(type, buffer);
|
it->second->Message(type, buffer);
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
@ -3545,7 +3546,7 @@ void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (around->DistNoRoot(*mob) > range2)
|
if (ComparativeDistance(around->GetPosition(), mob->GetPosition()) > range2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
@ -3665,7 +3666,7 @@ void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator,
|
|||||||
// Use the old method for all other nearby clients
|
// Use the old method for all other nearby clients
|
||||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||||
c = it->second;
|
c = it->second;
|
||||||
if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2)
|
if(c && (c != QuestInitiator) && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2)
|
||||||
c->Message_StringID(10, GENERIC_SAY, mobname, message);
|
c->Message_StringID(10, GENERIC_SAY, mobname, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3867,7 +3868,7 @@ Mob *EntityList::GetTargetForMez(Mob *caster)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caster->DistNoRoot(*d) > 22250) { //only pick targets within 150 range
|
if (ComparativeDistance(caster->GetPosition(), d->GetPosition()) > 22250) { //only pick targets within 150 range
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -758,7 +758,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
|
|||||||
}
|
}
|
||||||
else if(members[z] != nullptr)
|
else if(members[z] != nullptr)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[z]);
|
distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition());
|
||||||
if(distance <= range2 && distance >= min_range2) {
|
if(distance <= range2 && distance >= min_range2) {
|
||||||
members[z]->CalcSpellPowerDistanceMod(spell_id, distance);
|
members[z]->CalcSpellPowerDistanceMod(spell_id, distance);
|
||||||
caster->SpellOnTarget(spell_id, members[z]);
|
caster->SpellOnTarget(spell_id, members[z]);
|
||||||
@ -798,7 +798,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) {
|
|||||||
}
|
}
|
||||||
else if(members[z] != nullptr)
|
else if(members[z] != nullptr)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[z]);
|
distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition());
|
||||||
if(distance <= range2) {
|
if(distance <= range2) {
|
||||||
members[z]->BardPulse(spell_id, caster);
|
members[z]->BardPulse(spell_id, caster);
|
||||||
#ifdef GROUP_BUFF_PETS
|
#ifdef GROUP_BUFF_PETS
|
||||||
@ -1197,7 +1197,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range)
|
|||||||
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi]){
|
if(members[gi]){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
numMem += 1;
|
numMem += 1;
|
||||||
}
|
}
|
||||||
@ -1208,7 +1208,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range)
|
|||||||
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi]){
|
if(members[gi]){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
members[gi]->HealDamage(heal_amt, caster);
|
members[gi]->HealDamage(heal_amt, caster);
|
||||||
members[gi]->SendHPUpdate();
|
members[gi]->SendHPUpdate();
|
||||||
@ -1235,7 +1235,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit)
|
|||||||
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi]){
|
if(members[gi]){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
|
|
||||||
dmgtaken_tmp = members[gi]->GetMaxHP() - members[gi]->GetHP();
|
dmgtaken_tmp = members[gi]->GetMaxHP() - members[gi]->GetHP();
|
||||||
@ -1253,7 +1253,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit)
|
|||||||
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi]){
|
if(members[gi]){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone
|
if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone
|
||||||
members[gi]->SetHP(1); //but it will come darn close
|
members[gi]->SetHP(1); //but it will come darn close
|
||||||
@ -1284,7 +1284,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit)
|
|||||||
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
for(; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi] && (members[gi]->GetMaxMana() > 0)){
|
if(members[gi] && (members[gi]->GetMaxMana() > 0)){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
|
|
||||||
manataken_tmp = members[gi]->GetMaxMana() - members[gi]->GetMana();
|
manataken_tmp = members[gi]->GetMaxMana() - members[gi]->GetMana();
|
||||||
@ -1306,7 +1306,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit)
|
|||||||
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
||||||
{
|
{
|
||||||
if(members[gi]){
|
if(members[gi]){
|
||||||
distance = caster->DistNoRoot(*members[gi]);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
if((members[gi]->GetMaxMana() - manataken) < 1){
|
if((members[gi]->GetMaxMana() - manataken) < 1){
|
||||||
members[gi]->SetMana(1);
|
members[gi]->SetMana(1);
|
||||||
|
|||||||
@ -158,7 +158,7 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
|
|||||||
|
|
||||||
auto iterator = list.begin();
|
auto iterator = list.begin();
|
||||||
while (iterator != list.end()) {
|
while (iterator != list.end()) {
|
||||||
this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater);
|
this_distance = ComparativeDistanceNoZ((*iterator)->entity_on_hatelist->GetPosition(), hater->GetPosition());
|
||||||
if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) {
|
if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) {
|
||||||
close_distance = this_distance;
|
close_distance = this_distance;
|
||||||
close_entity = (*iterator)->entity_on_hatelist;
|
close_entity = (*iterator)->entity_on_hatelist;
|
||||||
@ -592,7 +592,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent
|
|||||||
struct_HateList *h = (*iterator);
|
struct_HateList *h = (*iterator);
|
||||||
if (range > 0)
|
if (range > 0)
|
||||||
{
|
{
|
||||||
dist_targ = center->DistNoRoot(*h->entity_on_hatelist);
|
dist_targ = ComparativeDistance(center->GetPosition(), h->entity_on_hatelist->GetPosition());
|
||||||
if (dist_targ <= range && dist_targ >= min_range2)
|
if (dist_targ <= range && dist_targ >= min_range2)
|
||||||
{
|
{
|
||||||
id_list.push_back(h->entity_on_hatelist->GetID());
|
id_list.push_back(h->entity_on_hatelist->GetID());
|
||||||
|
|||||||
@ -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
|
// half the max so the merc doesn't always stop at max range to allow combat movement
|
||||||
range *= .5;
|
range *= .5;
|
||||||
|
|
||||||
float targetDistance = DistNoRootNoZ(*target);
|
float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition());
|
||||||
|
|
||||||
if(targetDistance > range)
|
if(targetDistance > range)
|
||||||
result = false;
|
result = false;
|
||||||
@ -1480,7 +1480,7 @@ void Merc::AI_Process() {
|
|||||||
if(IsMercCasterCombatRange(GetTarget()))
|
if(IsMercCasterCombatRange(GetTarget()))
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
else if(DistNoRoot(*GetTarget()) <= meleeDistance) {
|
else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) {
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1513,7 +1513,7 @@ void Merc::AI_Process() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize()))
|
else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(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
|
// 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;
|
float newX = 0;
|
||||||
@ -1701,7 +1701,7 @@ void Merc::AI_Process() {
|
|||||||
|
|
||||||
if(follow)
|
if(follow)
|
||||||
{
|
{
|
||||||
float dist = DistNoRoot(*follow);
|
float dist = ComparativeDistance(m_Position, follow->GetPosition());
|
||||||
float speed = GetRunspeed();
|
float speed = GetRunspeed();
|
||||||
|
|
||||||
if(dist < GetFollowDistance() + 1000)
|
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) {
|
if (mercSpell.type & SpellType_Escape) {
|
||||||
dist2 = 0;
|
dist2 = 0;
|
||||||
} else
|
} else
|
||||||
dist2 = DistNoRoot(*tar);
|
dist2 = ComparativeDistance(m_Position, tar->GetPosition());
|
||||||
|
|
||||||
if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal)
|
if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal)
|
||||||
|| spells[spellid].targettype==ST_AECaster
|
|| 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())) {
|
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);
|
float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius);
|
||||||
range = range * range;
|
range = range * range;
|
||||||
if(MercOwner->GetTarget()->DistNoRootNoZ(*this) < range) {
|
if(ComparativeDistanceNoZ(m_Position, MercOwner->GetTarget()->GetPosition()) < range) {
|
||||||
AddToHateList(MercOwner->GetTarget(), 1);
|
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) {
|
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||||
NPC* npc = *itr;
|
NPC* npc = *itr;
|
||||||
float dist = npc->DistNoRootNoZ(*this);
|
float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition());
|
||||||
int radius = RuleI(Mercs, AggroRadius);
|
int radius = RuleI(Mercs, AggroRadius);
|
||||||
radius *= radius;
|
radius *= radius;
|
||||||
if(dist <= radius) {
|
if(dist <= radius) {
|
||||||
@ -2457,7 +2457,7 @@ void Merc::CheckHateList() {
|
|||||||
if(!hate_list.IsEntOnHateList(npc)) {
|
if(!hate_list.IsEntOnHateList(npc)) {
|
||||||
float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius);
|
float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius);
|
||||||
range *= range;
|
range *= range;
|
||||||
if(npc->DistNoRootNoZ(*this) < range) {
|
if(ComparativeDistanceNoZ(m_Position, npc->GetPosition()) < range) {
|
||||||
hate_list.AddEntToHateList(npc, 1);
|
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) {
|
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||||
NPC* npc = *itr;
|
NPC* npc = *itr;
|
||||||
|
|
||||||
if(npc->DistNoRootNoZ(*tar) <= spells[spell_id].aoerange * spells[spell_id].aoerange) {
|
if(ComparativeDistanceNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) {
|
||||||
if(!npc->IsMezzed()) {
|
if(!npc->IsMezzed()) {
|
||||||
numTargets++;
|
numTargets++;
|
||||||
}
|
}
|
||||||
@ -4098,7 +4098,7 @@ bool Merc::CheckAETaunt() {
|
|||||||
|
|
||||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||||
NPC* npc = *itr;
|
NPC* npc = *itr;
|
||||||
float dist = npc->DistNoRootNoZ(*this);
|
float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition());
|
||||||
int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range);
|
int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range);
|
||||||
range *= range;
|
range *= range;
|
||||||
|
|
||||||
@ -4201,7 +4201,7 @@ bool Merc::CheckConfidence() {
|
|||||||
|
|
||||||
AggroRange = AggroRange * AggroRange;
|
AggroRange = AggroRange * AggroRange;
|
||||||
|
|
||||||
if(mob->DistNoRoot(*this) > AggroRange) continue;
|
if(ComparativeDistance(m_Position, mob->GetPosition()) > AggroRange) continue;
|
||||||
|
|
||||||
CurrentCon = this->GetLevelCon(mob->GetLevel());
|
CurrentCon = this->GetLevelCon(mob->GetLevel());
|
||||||
switch(CurrentCon) {
|
switch(CurrentCon) {
|
||||||
@ -5150,7 +5150,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for merchant too far away
|
//check for merchant too far away
|
||||||
if(DistNoRoot(*merchant) > USE_NPC_RANGE2) {
|
if(ComparativeDistance(m_Position, merchant->GetPosition()) > USE_NPC_RANGE2) {
|
||||||
SendMercResponsePackets(18);
|
SendMercResponsePackets(18);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
58
zone/mob.cpp
58
zone/mob.cpp
@ -2267,59 +2267,7 @@ bool Mob::CanThisClassBlock(void) const
|
|||||||
return(CastToClient()->HasSkill(SkillBlock));
|
return(CastToClient()->HasSkill(SkillBlock));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
float Mob::Dist(const Mob &other) const {
|
|
||||||
float xDiff = other.m_Position.m_X - m_Position.m_X;
|
|
||||||
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
|
|
||||||
float zDiff = other.m_Position.m_Z - m_Position.m_Z;
|
|
||||||
|
|
||||||
return sqrtf( (xDiff * xDiff)
|
|
||||||
+ (yDiff * yDiff)
|
|
||||||
+ (zDiff * zDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::DistNoZ(const Mob &other) const {
|
|
||||||
float xDiff = other.m_Position.m_X - m_Position.m_X;
|
|
||||||
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
|
|
||||||
|
|
||||||
return sqrtf( (xDiff * xDiff)
|
|
||||||
+ (yDiff * yDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::DistNoRoot(const Mob &other) const {
|
|
||||||
float xDiff = other.m_Position.m_X - m_Position.m_X;
|
|
||||||
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
|
|
||||||
float zDiff = other.m_Position.m_Z - m_Position.m_Z;
|
|
||||||
|
|
||||||
return ( (xDiff * xDiff)
|
|
||||||
+ (yDiff * yDiff)
|
|
||||||
+ (zDiff * zDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::DistNoRoot(float x, float y, float z) const {
|
|
||||||
float xDiff = x - m_Position.m_X;
|
|
||||||
float yDiff = y - m_Position.m_Y;
|
|
||||||
float zDiff = z - m_Position.m_Z;
|
|
||||||
|
|
||||||
return ( (xDiff * xDiff)
|
|
||||||
+ (yDiff * yDiff)
|
|
||||||
+ (zDiff * zDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::DistNoRootNoZ(float x, float y) const {
|
|
||||||
float xDiff = x - m_Position.m_X;
|
|
||||||
float yDiff = y - m_Position.m_Y;
|
|
||||||
|
|
||||||
return ( (xDiff * xDiff) + (yDiff * yDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::DistNoRootNoZ(const Mob &other) const {
|
|
||||||
float xDiff = other.m_Position.m_X - m_Position.m_X;
|
|
||||||
float yDiff = other.m_Position.m_Y - m_Position.m_Y;
|
|
||||||
|
|
||||||
return ( (xDiff * xDiff) + (yDiff * yDiff) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float Mob::GetReciprocalHeading(Mob* target) {
|
float Mob::GetReciprocalHeading(Mob* target) {
|
||||||
float Result = 0;
|
float Result = 0;
|
||||||
|
|
||||||
@ -2336,7 +2284,7 @@ float Mob::GetReciprocalHeading(Mob* target) {
|
|||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc) {
|
bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc) {
|
||||||
bool Result = false;
|
bool Result = false;
|
||||||
|
|
||||||
@ -2344,7 +2292,7 @@ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, fl
|
|||||||
float look_heading = 0;
|
float look_heading = 0;
|
||||||
|
|
||||||
if(lookForAftArc)
|
if(lookForAftArc)
|
||||||
look_heading = GetReciprocalHeading(target);
|
look_heading = GetReciprocalHeading(target->GetPosition());
|
||||||
else
|
else
|
||||||
look_heading = target->GetHeading();
|
look_heading = target->GetHeading();
|
||||||
|
|
||||||
|
|||||||
@ -294,6 +294,7 @@ public:
|
|||||||
inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; }
|
inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; }
|
||||||
inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; }
|
inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; }
|
||||||
void RemoveNimbusEffect(int effectid);
|
void RemoveNimbusEffect(int effectid);
|
||||||
|
inline const xyz_location& GetTargetRingLocation() const { return m_TargetRing; }
|
||||||
inline float GetTargetRingX() const { return m_TargetRing.m_X; }
|
inline float GetTargetRingX() const { return m_TargetRing.m_X; }
|
||||||
inline float GetTargetRingY() const { return m_TargetRing.m_Y; }
|
inline float GetTargetRingY() const { return m_TargetRing.m_Y; }
|
||||||
inline float GetTargetRingZ() const { return m_TargetRing.m_Z; }
|
inline float GetTargetRingZ() const { return m_TargetRing.m_Z; }
|
||||||
@ -510,13 +511,6 @@ public:
|
|||||||
void ShowStats(Client* client);
|
void ShowStats(Client* client);
|
||||||
void ShowBuffs(Client* client);
|
void ShowBuffs(Client* client);
|
||||||
void ShowBuffList(Client* client);
|
void ShowBuffList(Client* client);
|
||||||
float Dist(const Mob &) const;
|
|
||||||
float DistNoZ(const Mob &) const;
|
|
||||||
float DistNoRoot(const Mob &) const;
|
|
||||||
float DistNoRoot(float x, float y, float z) const;
|
|
||||||
float DistNoRootNoZ(float x, float y) const;
|
|
||||||
float DistNoRootNoZ(const Mob &) const;
|
|
||||||
static float GetReciprocalHeading(Mob* target);
|
|
||||||
bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest,
|
bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest,
|
||||||
bool lookForAftArc = true);
|
bool lookForAftArc = true);
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
|||||||
dist2 = 0; //DistNoRoot(*this); //WTF was up with this...
|
dist2 = 0; //DistNoRoot(*this); //WTF was up with this...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dist2 = DistNoRoot(*tar);
|
dist2 = ComparativeDistance(m_Position, tar->GetPosition());
|
||||||
|
|
||||||
bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once.
|
bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once.
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
|
|||||||
if (t1 > iRange
|
if (t1 > iRange
|
||||||
|| t2 > iRange
|
|| t2 > iRange
|
||||||
|| t3 > iRange
|
|| t3 > iRange
|
||||||
|| mob->DistNoRoot(*caster) > iRange2
|
|| ComparativeDistance(mob->GetPosition(), caster->GetPosition()) > iRange2
|
||||||
//this call should seem backwards:
|
//this call should seem backwards:
|
||||||
|| !mob->CheckLosFN(caster)
|
|| !mob->CheckLosFN(caster)
|
||||||
|| mob->GetReverseFactionCon(caster) >= FACTION_KINDLY
|
|| mob->GetReverseFactionCon(caster) >= FACTION_KINDLY
|
||||||
@ -622,7 +622,7 @@ void Client::AI_SpellCast()
|
|||||||
if(!targ)
|
if(!targ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float dist = DistNoRootNoZ(*targ);
|
float dist = ComparativeDistanceNoZ(m_Position, targ->GetPosition());
|
||||||
|
|
||||||
std::vector<uint32> valid_spells;
|
std::vector<uint32> valid_spells;
|
||||||
std::vector<uint32> slots;
|
std::vector<uint32> slots;
|
||||||
@ -997,7 +997,7 @@ void Client::AI_Process()
|
|||||||
if(owner == nullptr)
|
if(owner == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float dist = DistNoRoot(*owner);
|
float dist = ComparativeDistance(m_Position, owner->GetPosition());
|
||||||
if (dist >= 100)
|
if (dist >= 100)
|
||||||
{
|
{
|
||||||
float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed();
|
float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed();
|
||||||
@ -1129,14 +1129,14 @@ void Mob::AI_Process() {
|
|||||||
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
|
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
|
||||||
tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange;
|
tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange;
|
||||||
|
|
||||||
if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > tether_range) {
|
if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > tether_range) {
|
||||||
GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading);
|
GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading);
|
||||||
}
|
}
|
||||||
} else if(GetSpecialAbility(LEASH)) {
|
} else if(GetSpecialAbility(LEASH)) {
|
||||||
float leash_range = static_cast<float>(GetSpecialAbilityParam(LEASH, 0));
|
float leash_range = static_cast<float>(GetSpecialAbilityParam(LEASH, 0));
|
||||||
leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange;
|
leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange;
|
||||||
|
|
||||||
if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > leash_range) {
|
if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > leash_range) {
|
||||||
GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading);
|
GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading);
|
||||||
SetHP(GetMaxHP());
|
SetHP(GetMaxHP());
|
||||||
BuffFadeAll();
|
BuffFadeAll();
|
||||||
@ -1492,7 +1492,7 @@ void Mob::AI_Process() {
|
|||||||
//if(owner->IsClient())
|
//if(owner->IsClient())
|
||||||
// printf("Pet start pos: (%f, %f, %f)\n", GetX(), GetY(), GetZ());
|
// printf("Pet start pos: (%f, %f, %f)\n", GetX(), GetY(), GetZ());
|
||||||
|
|
||||||
float dist = DistNoRoot(*owner);
|
float dist = ComparativeDistance(m_Position, owner->GetPosition());
|
||||||
if (dist >= 400)
|
if (dist >= 400)
|
||||||
{
|
{
|
||||||
float speed = GetWalkspeed();
|
float speed = GetWalkspeed();
|
||||||
@ -1547,7 +1547,7 @@ void Mob::AI_Process() {
|
|||||||
if (!follow) SetFollowID(0);
|
if (!follow) SetFollowID(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float dist2 = DistNoRoot(*follow);
|
float dist2 = ComparativeDistance(m_Position, follow->GetPosition());
|
||||||
int followdist = GetFollowDistance();
|
int followdist = GetFollowDistance();
|
||||||
|
|
||||||
if (dist2 >= followdist) // Default follow distance is 100
|
if (dist2 >= followdist) // Default follow distance is 100
|
||||||
@ -1812,7 +1812,7 @@ void NPC::AI_DoMovement() {
|
|||||||
ClearFeignMemory();
|
ClearFeignMemory();
|
||||||
moved=false;
|
moved=false;
|
||||||
SetMoving(false);
|
SetMoving(false);
|
||||||
if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 )
|
if (GetTarget() == nullptr || ComparativeDistance(m_Position, GetTarget()->GetPosition()) >= 5*5 )
|
||||||
{
|
{
|
||||||
SetHeading(m_GuardPoint.m_Heading);
|
SetHeading(m_GuardPoint.m_Heading);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -5963,7 +5963,7 @@ XS(XS_Client_SilentMessage)
|
|||||||
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
|
||||||
if(THIS->GetTarget() != NULL){
|
if(THIS->GetTarget() != NULL){
|
||||||
if(THIS->GetTarget()->IsNPC()){
|
if(THIS->GetTarget()->IsNPC()){
|
||||||
if (THIS->DistNoRootNoZ(*THIS->GetTarget()) <= 200) {
|
if (ComparativeDistanceNoZ(THIS->GetPosition(), THIS->GetTarget()->GetPosition()) <= 200) {
|
||||||
if(THIS->GetTarget()->CastToNPC()->IsMoving() && !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget()))
|
if(THIS->GetTarget()->CastToNPC()->IsMoving() && !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget()))
|
||||||
THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec));
|
THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec));
|
||||||
THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1)));
|
THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1)));
|
||||||
|
|||||||
@ -148,6 +148,13 @@ float ComparativeDistance(const xyz_location& point1, const xyz_location& point2
|
|||||||
return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z;
|
return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces the non square root'ed distance between the two points.
|
||||||
|
*/
|
||||||
|
float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2) {
|
||||||
|
ComparativeDistance(static_cast<xyz_location>(point1), static_cast<xyz_location>(point2));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces the distance between the two points.
|
* Produces the distance between the two points.
|
||||||
*/
|
*/
|
||||||
@ -155,6 +162,13 @@ float Distance(const xyz_location& point1, const xyz_location& point2) {
|
|||||||
return sqrt(ComparativeDistance(point1, point2));
|
return sqrt(ComparativeDistance(point1, point2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces the distance between the two points.
|
||||||
|
*/
|
||||||
|
float Distance(const xyz_heading& point1, const xyz_heading& point2) {
|
||||||
|
Distance(static_cast<xyz_location>(point1), static_cast<xyz_location>(point2));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces the distance between the two points within the XY plane.
|
* Produces the distance between the two points within the XY plane.
|
||||||
*/
|
*/
|
||||||
@ -162,6 +176,13 @@ float DistanceNoZ(const xyz_location& point1, const xyz_location& point2) {
|
|||||||
return Distance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
return Distance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces the distance between the two points within the XY plane.
|
||||||
|
*/
|
||||||
|
float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) {
|
||||||
|
return Distance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces the non square root'ed distance between the two points within the XY plane.
|
* Produces the non square root'ed distance between the two points within the XY plane.
|
||||||
*/
|
*/
|
||||||
@ -169,6 +190,13 @@ float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& poi
|
|||||||
return ComparativeDistance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
return ComparativeDistance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces the non square root'ed distance between the two points within the XY plane.
|
||||||
|
*/
|
||||||
|
float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) {
|
||||||
|
return ComparativeDistance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if 'position' is within (inclusive) the axis aligned
|
* Determines if 'position' is within (inclusive) the axis aligned
|
||||||
* box (3 dimensional) formed from the points minimum and maximum.
|
* box (3 dimensional) formed from the points minimum and maximum.
|
||||||
@ -197,3 +225,33 @@ bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &mini
|
|||||||
|
|
||||||
return xcheck && ycheck;
|
return xcheck && ycheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the heading directly 180 degrees from the
|
||||||
|
* current heading.
|
||||||
|
* Takes the EQfloat from the xyz_heading and returns
|
||||||
|
* an EQFloat.
|
||||||
|
*/
|
||||||
|
float GetReciprocalHeading(const xyz_heading& point1) {
|
||||||
|
return GetReciprocalHeading(point1.m_Heading);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the heading directly 180 degrees from the
|
||||||
|
* current heading.
|
||||||
|
* Takes an EQfloat and returns an EQFloat.
|
||||||
|
*/
|
||||||
|
float GetReciprocalHeading(const float heading) {
|
||||||
|
float result = 0;
|
||||||
|
|
||||||
|
// Convert to radians
|
||||||
|
float h = (heading / 256.0f) * 6.283184f;
|
||||||
|
|
||||||
|
// Calculate the reciprocal heading in radians
|
||||||
|
result = h + 3.141592f;
|
||||||
|
|
||||||
|
// Convert back to eq heading from radians
|
||||||
|
result = (result / 6.283184f) * 256.0f;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@ -94,4 +94,12 @@ float Distance(const xyz_location& point1, const xyz_location& point2);
|
|||||||
float DistanceNoZ(const xyz_location& point1, const xyz_location& point2);
|
float DistanceNoZ(const xyz_location& point1, const xyz_location& point2);
|
||||||
float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2);
|
float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2);
|
||||||
|
|
||||||
|
float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2);
|
||||||
|
float Distance(const xyz_heading& point1, const xyz_heading& point2);
|
||||||
|
float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2);
|
||||||
|
float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2);
|
||||||
|
|
||||||
|
float GetReciprocalHeading(const xyz_heading& point1);
|
||||||
|
float GetReciprocalHeading(const float heading);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -489,7 +489,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid)
|
|||||||
else if(members[x].member != nullptr)
|
else if(members[x].member != nullptr)
|
||||||
{
|
{
|
||||||
if(members[x].GroupNumber == gid){
|
if(members[x].GroupNumber == gid){
|
||||||
distance = caster->DistNoRoot(*members[x].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[x].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
caster->SpellOnTarget(spellid, members[x].member);
|
caster->SpellOnTarget(spellid, members[x].member);
|
||||||
#ifdef GROUP_BUFF_PETS
|
#ifdef GROUP_BUFF_PETS
|
||||||
@ -537,7 +537,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range)
|
|||||||
if(members[gi].member){
|
if(members[gi].member){
|
||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
numMem += 1;
|
numMem += 1;
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range)
|
|||||||
if(members[gi].member){
|
if(members[gi].member){
|
||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
members[gi].member->SetHP(members[gi].member->GetHP() + heal_amt);
|
members[gi].member->SetHP(members[gi].member->GetHP() + heal_amt);
|
||||||
members[gi].member->SendHPUpdate();
|
members[gi].member->SendHPUpdate();
|
||||||
@ -581,7 +581,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32
|
|||||||
if(members[gi].member){
|
if(members[gi].member){
|
||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
|
|
||||||
dmgtaken_tmp = members[gi].member->GetMaxHP() - members[gi].member->GetHP();
|
dmgtaken_tmp = members[gi].member->GetMaxHP() - members[gi].member->GetHP();
|
||||||
@ -602,7 +602,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32
|
|||||||
if(members[gi].member){
|
if(members[gi].member){
|
||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
if((members[gi].member->GetMaxHP() - dmgtaken) < 1){//this way the ability will never kill someone
|
if((members[gi].member->GetMaxHP() - dmgtaken) < 1){//this way the ability will never kill someone
|
||||||
members[gi].member->SetHP(1); //but it will come darn close
|
members[gi].member->SetHP(1); //but it will come darn close
|
||||||
@ -637,7 +637,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3
|
|||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
if (members[gi].member->GetMaxMana() > 0) {
|
if (members[gi].member->GetMaxMana() > 0) {
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
|
|
||||||
manataken_tmp = members[gi].member->GetMaxMana() - members[gi].member->GetMana();
|
manataken_tmp = members[gi].member->GetMaxMana() - members[gi].member->GetMana();
|
||||||
@ -660,7 +660,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3
|
|||||||
if(members[gi].member){
|
if(members[gi].member){
|
||||||
if(members[gi].GroupNumber == gid)
|
if(members[gi].GroupNumber == gid)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[gi].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition());
|
||||||
if(distance <= range2){
|
if(distance <= range2){
|
||||||
if((members[gi].member->GetMaxMana() - manataken) < 1){
|
if((members[gi].member->GetMaxMana() - manataken) < 1){
|
||||||
members[gi].member->SetMana(1);
|
members[gi].member->SetMana(1);
|
||||||
@ -791,7 +791,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
|
|||||||
else if(members[z].member != nullptr)
|
else if(members[z].member != nullptr)
|
||||||
{
|
{
|
||||||
if(members[z].GroupNumber == gid){
|
if(members[z].GroupNumber == gid){
|
||||||
distance = caster->DistNoRoot(*members[z].member);
|
distance = ComparativeDistance(caster->GetPosition(), members[z].member->GetPosition());
|
||||||
if(distance <= range2) {
|
if(distance <= range2) {
|
||||||
members[z].member->BardPulse(spellid, caster);
|
members[z].member->BardPulse(spellid, caster);
|
||||||
#ifdef GROUP_BUFF_PETS
|
#ifdef GROUP_BUFF_PETS
|
||||||
|
|||||||
@ -769,7 +769,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
|
|||||||
float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget());
|
float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget());
|
||||||
mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range);
|
mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range);
|
||||||
range *= range;
|
range *= range;
|
||||||
float dist = DistNoRoot(*other);
|
float dist = ComparativeDistance(m_Position, other->GetPosition());
|
||||||
if(dist > range) {
|
if(dist > range) {
|
||||||
mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
|
mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
|
||||||
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
|
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
|
||||||
@ -1219,9 +1219,9 @@ void NPC::RangedAttack(Mob* other)
|
|||||||
min_range = static_cast<float>(sa_min_range);
|
min_range = static_cast<float>(sa_min_range);
|
||||||
|
|
||||||
max_range *= max_range;
|
max_range *= max_range;
|
||||||
if(DistNoRoot(*other) > max_range)
|
if(ComparativeDistance(m_Position, other->GetPosition()) > max_range)
|
||||||
return;
|
return;
|
||||||
else if(DistNoRoot(*other) < (min_range * min_range))
|
else if(ComparativeDistance(m_Position, other->GetPosition()) < (min_range * min_range))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!other || !IsAttackAllowed(other) ||
|
if(!other || !IsAttackAllowed(other) ||
|
||||||
@ -1408,7 +1408,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
|
|||||||
float range = item->Range + GetRangeDistTargetSizeMod(other);
|
float range = item->Range + GetRangeDistTargetSizeMod(other);
|
||||||
mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range);
|
mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range);
|
||||||
range *= range;
|
range *= range;
|
||||||
float dist = DistNoRoot(*other);
|
float dist = ComparativeDistance(m_Position, other->GetPosition());
|
||||||
if(dist > range) {
|
if(dist > range) {
|
||||||
mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
|
mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
|
||||||
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
|
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
|
||||||
|
|||||||
@ -2002,7 +2002,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
|||||||
}
|
}
|
||||||
if(spell_target != nullptr && spell_target != this) {
|
if(spell_target != nullptr && spell_target != this) {
|
||||||
//casting a spell on somebody but ourself, make sure they are in range
|
//casting a spell on somebody but ourself, make sure they are in range
|
||||||
float dist2 = DistNoRoot(*spell_target);
|
float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition());
|
||||||
float range2 = range * range;
|
float range2 = range * range;
|
||||||
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
||||||
if(dist2 > range2) {
|
if(dist2 > range2) {
|
||||||
@ -2344,7 +2344,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) {
|
|||||||
range = GetActSpellRange(spell_id, spells[spell_id].range, true);
|
range = GetActSpellRange(spell_id, spells[spell_id].range, true);
|
||||||
if(spell_target != nullptr && spell_target != this) {
|
if(spell_target != nullptr && spell_target != this) {
|
||||||
//casting a spell on somebody but ourself, make sure they are in range
|
//casting a spell on somebody but ourself, make sure they are in range
|
||||||
float dist2 = DistNoRoot(*spell_target);
|
float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition());
|
||||||
float range2 = range * range;
|
float range2 = range * range;
|
||||||
if(dist2 > range2) {
|
if(dist2 > range2) {
|
||||||
//target is out of range.
|
//target is out of range.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user