mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix cannon enter
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#include "RaidIccActions.h"
|
#include "RaidIccActions.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
|
|
||||||
enum CreatureIds {
|
enum CreatureIds {
|
||||||
NPC_KOR_KRON_BATTLE_MAGE = 37117,
|
NPC_KOR_KRON_BATTLE_MAGE = 37117,
|
||||||
@@ -69,6 +71,7 @@ bool IccGunshipEnterCannonAction::Execute(Event event)
|
|||||||
// do not switch vehicles yet
|
// do not switch vehicles yet
|
||||||
if (bot->GetVehicle())
|
if (bot->GetVehicle())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Unit* vehicleToEnter = nullptr;
|
Unit* vehicleToEnter = nullptr;
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest vehicles");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest vehicles");
|
||||||
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
||||||
@@ -80,13 +83,19 @@ bool IccGunshipEnterCannonAction::Execute(Event event)
|
|||||||
if (vehicleBase->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
if (vehicleBase->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!vehicleBase->IsFriendlyTo(bot))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!vehicleBase->GetVehicleKit() || !vehicleBase->GetVehicleKit()->GetAvailableSeatCount())
|
||||||
|
continue;
|
||||||
|
|
||||||
uint32 entry = vehicleBase->GetEntry();
|
uint32 entry = vehicleBase->GetEntry();
|
||||||
if (entry != 36838 && entry != 36839)
|
if (entry != 36838 && entry != 36839)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (vehicleBase->HasAura(69704) || vehicleBase->HasAura(69705))
|
if (vehicleBase->HasAura(69704) || vehicleBase->HasAura(69705))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!vehicleToEnter || bot->GetExactDist(vehicleToEnter) > bot->GetExactDist(vehicleBase))
|
if (!vehicleToEnter || bot->GetExactDist(vehicleToEnter) > bot->GetExactDist(vehicleBase))
|
||||||
vehicleToEnter = vehicleBase;
|
vehicleToEnter = vehicleBase;
|
||||||
}
|
}
|
||||||
@@ -110,8 +119,11 @@ bool IccGunshipEnterCannonAction::EnterVehicle(Unit* vehicleBase, bool moveIfFar
|
|||||||
if (dist > INTERACTION_DISTANCE)
|
if (dist > INTERACTION_DISTANCE)
|
||||||
return MoveTo(vehicleBase);
|
return MoveTo(vehicleBase);
|
||||||
|
|
||||||
|
|
||||||
botAI->RemoveShapeshift();
|
botAI->RemoveShapeshift();
|
||||||
// Use HandleSpellClick instead of Unit::EnterVehicle to handle special vehicle script (ulduar)
|
|
||||||
|
bot->GetMotionMaster()->Clear();
|
||||||
|
bot->StopMoving();
|
||||||
vehicleBase->HandleSpellClick(bot);
|
vehicleBase->HandleSpellClick(bot);
|
||||||
|
|
||||||
if (!bot->IsOnVehicle(vehicleBase))
|
if (!bot->IsOnVehicle(vehicleBase))
|
||||||
|
|||||||
Reference in New Issue
Block a user