Merge pull request #842 from liyunfan1223/lfg_leave_group

Fix LFG leave group and several minor issues
This commit is contained in:
Yunfan Li
2025-01-04 16:12:12 +08:00
committed by GitHub
6 changed files with 32 additions and 30 deletions

View File

@@ -8,6 +8,7 @@
#include "ChooseRpgTargetAction.h"
#include "Event.h"
#include "LootObjectStack.h"
#include "NewRpgStrategy.h"
#include "Playerbots.h"
#include "PossibleRpgTargetsValue.h"
#include "PvpTriggers.h"
@@ -35,19 +36,26 @@ bool AttackAnythingAction::isUseful()
if (!AI_VALUE(bool, "can move around"))
return false;
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
ChooseRpgTargetAction::isFollowValid(
bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
return false;
// if (bot->IsInCombat()) {
// if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
// ChooseRpgTargetAction::isFollowValid(
// bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
// return false;
// }
Unit* target = GetTarget();
if (!target)
return false;
bool inactiveGrindStatus = botAI->rpgInfo.status == NewRpgStatus::GO_GRIND ||
botAI->rpgInfo.status == NewRpgStatus::NEAR_NPC ||
botAI->rpgInfo.status == NewRpgStatus::REST ||
botAI->rpgInfo.status == NewRpgStatus::GO_INNKEEPER;
if (inactiveGrindStatus && bot->GetDistance(target) > 25.0f)
return false;
std::string const name = std::string(target->GetName());
// Check for invalid targets: Dummy, Charge Target, Melee Target, Ranged Target
if (!name.empty() &&
@@ -59,10 +67,6 @@ bool AttackAnythingAction::isUseful()
return false; // Target is one of the disallowed types
}
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far
// away from master.
// return false;
return true;
}

View File

@@ -236,11 +236,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
if (bot->IsSitState())
bot->SetStandState(UNIT_STAND_STATE_STAND);
if (bot->IsNonMeleeSpellCast(true))
{
bot->CastStop();
botAI->InterruptSpell();
}
// if (bot->IsNonMeleeSpellCast(true))
// {
// bot->CastStop();
// botAI->InterruptSpell();
// }
MotionMaster& mm = *bot->GetMotionMaster();
mm.Clear();
if (!backwards)
@@ -277,11 +277,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
if (bot->IsSitState())
bot->SetStandState(UNIT_STAND_STATE_STAND);
if (bot->IsNonMeleeSpellCast(true))
{
bot->CastStop();
botAI->InterruptSpell();
}
// if (bot->IsNonMeleeSpellCast(true))
// {
// bot->CastStop();
// botAI->InterruptSpell();
// }
MotionMaster& mm = *bot->GetMotionMaster();
G3D::Vector3 endP = path.back();
mm.Clear();