mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
Add GetCloseMobList into other calls
This commit is contained in:
parent
ec5faea9b1
commit
233f26996b
@ -5032,6 +5032,9 @@ void EntityList::ReloadMerchants() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* If we have a distance requested that is greater than our scanning distance
|
||||||
|
* then we return the full list
|
||||||
|
*
|
||||||
* @param mob
|
* @param mob
|
||||||
* @param distance
|
* @param distance
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@ -512,7 +512,7 @@ public:
|
|||||||
inline const std::unordered_map<uint16, Object *> &GetObjectList() { return object_list; }
|
inline const std::unordered_map<uint16, Object *> &GetObjectList() { return object_list; }
|
||||||
inline const std::unordered_map<uint16, Doors *> &GetDoorsList() { return door_list; }
|
inline const std::unordered_map<uint16, Doors *> &GetDoorsList() { return door_list; }
|
||||||
|
|
||||||
std::unordered_map<uint16, Mob *> &GetCloseMobList(Mob *mob, float distance);
|
std::unordered_map<uint16, Mob *> &GetCloseMobList(Mob *mob, float distance = 0);
|
||||||
|
|
||||||
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
|
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
|
||||||
|
|
||||||
|
|||||||
@ -171,7 +171,6 @@ public:
|
|||||||
void DisplayInfo(Mob *mob);
|
void DisplayInfo(Mob *mob);
|
||||||
|
|
||||||
std::unordered_map<uint16, Mob *> close_mobs;
|
std::unordered_map<uint16, Mob *> close_mobs;
|
||||||
std::unordered_map<uint16, Mob *>& GetSmartMobList(float distance = 0);
|
|
||||||
Timer mob_scan_close;
|
Timer mob_scan_close;
|
||||||
Timer mob_check_moving_timer;
|
Timer mob_check_moving_timer;
|
||||||
|
|
||||||
|
|||||||
26
zone/npc.cpp
26
zone/npc.cpp
@ -3019,14 +3019,14 @@ void NPC::SetSimpleRoamBox(float box_size, float move_distance, int move_delay)
|
|||||||
/**
|
/**
|
||||||
* @param caster
|
* @param caster
|
||||||
* @param chance
|
* @param chance
|
||||||
* @param in_cast_range
|
* @param cast_range
|
||||||
* @param spell_types
|
* @param spell_types
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool NPC::AICheckCloseBeneficialSpells(
|
bool NPC::AICheckCloseBeneficialSpells(
|
||||||
NPC *caster,
|
NPC *caster,
|
||||||
uint8 chance,
|
uint8 chance,
|
||||||
float in_cast_range,
|
float cast_range,
|
||||||
uint32 spell_types
|
uint32 spell_types
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -3061,24 +3061,18 @@ bool NPC::AICheckCloseBeneficialSpells(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Cast range
|
|
||||||
*/
|
|
||||||
in_cast_range = (in_cast_range * in_cast_range);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check through close range mobs
|
* Check through close range mobs
|
||||||
*/
|
*/
|
||||||
for (auto & close_mob : close_mobs) {
|
for (auto & close_mob : entity_list.GetCloseMobList(caster, cast_range)) {
|
||||||
Mob *mob = close_mob.second;
|
Mob *mob = close_mob.second;
|
||||||
|
|
||||||
if (mob->IsClient()) {
|
if (mob->IsClient()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float distance = DistanceSquared(mob->GetPosition(), GetPosition());
|
float distance = Distance(mob->GetPosition(), caster->GetPosition());
|
||||||
|
if (distance > cast_range) {
|
||||||
if (distance > in_cast_range) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3086,7 +3080,7 @@ bool NPC::AICheckCloseBeneficialSpells(
|
|||||||
"NPC [{}] Distance [{}] Cast Range [{}] Caster [{}]",
|
"NPC [{}] Distance [{}] Cast Range [{}] Caster [{}]",
|
||||||
mob->GetCleanName(),
|
mob->GetCleanName(),
|
||||||
distance,
|
distance,
|
||||||
in_cast_range,
|
cast_range,
|
||||||
caster->GetCleanName()
|
caster->GetCleanName()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3134,7 +3128,7 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
|
|||||||
GetID()
|
GetID()
|
||||||
);
|
);
|
||||||
|
|
||||||
for (auto &close_mob : close_mobs) {
|
for (auto &close_mob : entity_list.GetCloseMobList(sender)) {
|
||||||
Mob *mob = close_mob.second;
|
Mob *mob = close_mob.second;
|
||||||
float distance = DistanceSquared(m_Position, mob->GetPosition());
|
float distance = DistanceSquared(m_Position, mob->GetPosition());
|
||||||
|
|
||||||
@ -3143,18 +3137,18 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
|
|||||||
}
|
}
|
||||||
|
|
||||||
float assist_range = (mob->GetAssistRange() * mob->GetAssistRange());
|
float assist_range = (mob->GetAssistRange() * mob->GetAssistRange());
|
||||||
|
|
||||||
if (distance > assist_range) {
|
if (distance > assist_range) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogAIYellForHelpDetail(
|
LogAIYellForHelpDetail(
|
||||||
"NPC [{}] ID [{}] is scanning - checking against NPC [{}] range [{}] dist [{}]",
|
"NPC [{}] ID [{}] is scanning - checking against NPC [{}] range [{}] dist [{}] in_range [{}]",
|
||||||
GetCleanName(),
|
GetCleanName(),
|
||||||
GetID(),
|
GetID(),
|
||||||
mob->GetCleanName(),
|
mob->GetCleanName(),
|
||||||
assist_range,
|
assist_range,
|
||||||
distance
|
distance,
|
||||||
|
(distance < assist_range)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mob->CheckAggro(attacker)) {
|
if (mob->CheckAggro(attacker)) {
|
||||||
|
|||||||
@ -143,7 +143,7 @@ public:
|
|||||||
virtual bool AI_IdleCastCheck();
|
virtual bool AI_IdleCastCheck();
|
||||||
virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot);
|
virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot);
|
||||||
|
|
||||||
bool AICheckCloseBeneficialSpells(NPC* caster, uint8 chance, float in_cast_range, uint32 spell_types);
|
bool AICheckCloseBeneficialSpells(NPC* caster, uint8 chance, float cast_range, uint32 spell_types);
|
||||||
void AIYellForHelp(Mob* sender, Mob* attacker);
|
void AIYellForHelp(Mob* sender, Mob* attacker);
|
||||||
|
|
||||||
void LevelScale();
|
void LevelScale();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user