mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Bots] Add attack flag when told to attack (#4490)
This adds a flag to mobs that are told to attack by their owner to prevent unintended attacks. Previously, if you were to send your bots to attack a target and then switch targets: before casters land their spell or if melee (especially anyone with pets) hasn't engaged before the target switch, they could switch to your new target and attack. This adds a flag upon attack and bots will only attack flagged targets.
This commit is contained in:
+26
-1
@@ -129,7 +129,8 @@ Mob::Mob(
|
||||
position_update_melee_push_timer(500),
|
||||
hate_list_cleanup_timer(6000),
|
||||
mob_close_scan_timer(6000),
|
||||
mob_check_moving_timer(1000)
|
||||
mob_check_moving_timer(1000),
|
||||
bot_attack_flag_timer(10000)
|
||||
{
|
||||
mMovementManager = &MobMovementManager::Get();
|
||||
mMovementManager->AddMob(this);
|
||||
@@ -400,6 +401,10 @@ Mob::Mob(
|
||||
pet_owner_npc = false;
|
||||
pet_targetlock_id = 0;
|
||||
|
||||
//bot attack flag
|
||||
bot_attack_flags.clear();
|
||||
bot_attack_flag_timer.Disable();
|
||||
|
||||
attacked_count = 0;
|
||||
mezzed = false;
|
||||
stunned = false;
|
||||
@@ -8623,3 +8628,23 @@ bool Mob::IsCloseToBanker()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Mob::HasBotAttackFlag(Mob* tar) {
|
||||
if (!tar) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<uint32> l = tar->GetBotAttackFlags();
|
||||
|
||||
for (uint32 e : l) {
|
||||
if (IsBot() && e == CastToBot()->GetBotOwnerCharacterID()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsClient() && e == CastToClient()->CharacterID()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user