mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Allow spell casting during movement
This commit is contained in:
@@ -1441,7 +1441,7 @@ bool PlayerbotAI::IsCaster(Player* player) { return IsRanged(player) && player->
|
|||||||
|
|
||||||
bool PlayerbotAI::IsCombo(Player* player)
|
bool PlayerbotAI::IsCombo(Player* player)
|
||||||
{
|
{
|
||||||
int tab = AiFactory::GetPlayerSpecTab(player);
|
// int tab = AiFactory::GetPlayerSpecTab(player);
|
||||||
return player->getClass() == CLASS_ROGUE ||
|
return player->getClass() == CLASS_ROGUE ||
|
||||||
(player->getClass() == CLASS_DRUID && player->HasAura(768)); // cat druid
|
(player->getClass() == CLASS_DRUID && player->HasAura(768)); // cat druid
|
||||||
}
|
}
|
||||||
@@ -2634,8 +2634,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
aiObjectContext->GetValue<LastMovement&>("last movement")->Get().Set(nullptr);
|
// aiObjectContext->GetValue<LastMovement&>("last movement")->Get().Set(nullptr);
|
||||||
aiObjectContext->GetValue<time_t>("stay time")->Set(0);
|
// aiObjectContext->GetValue<time_t>("stay time")->Set(0);
|
||||||
|
|
||||||
if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
{
|
{
|
||||||
@@ -2820,8 +2820,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, float x, float y, float z, Item* ite
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
aiObjectContext->GetValue<LastMovement&>("last movement")->Get().Set(nullptr);
|
// aiObjectContext->GetValue<LastMovement&>("last movement")->Get().Set(nullptr);
|
||||||
aiObjectContext->GetValue<time_t>("stay time")->Set(0);
|
// aiObjectContext->GetValue<time_t>("stay time")->Set(0);
|
||||||
|
|
||||||
MotionMaster& mm = *bot->GetMotionMaster();
|
MotionMaster& mm = *bot->GetMotionMaster();
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ bool CheckMountStateAction::Execute(Event event)
|
|||||||
bool enemy = AI_VALUE(Unit*, "enemy player target");
|
bool enemy = AI_VALUE(Unit*, "enemy player target");
|
||||||
// ignore grind target in BG or bots will dismount near any creature (eg: the rams in AV)
|
// ignore grind target in BG or bots will dismount near any creature (eg: the rams in AV)
|
||||||
bool dps = AI_VALUE(Unit*, "dps target");
|
bool dps = AI_VALUE(Unit*, "dps target");
|
||||||
bool fartarget =
|
// bool fartarget = (enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player
|
||||||
(enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
// target"), 40.0f)) ||
|
||||||
(dps && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), 50.0f));
|
// (dps && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), 50.0f));
|
||||||
bool attackdistance = false;
|
bool attackdistance = false;
|
||||||
// bool chasedistance = false;
|
// bool chasedistance = false;
|
||||||
float attack_distance = 35.0f;
|
float attack_distance = 35.0f;
|
||||||
@@ -34,6 +34,9 @@ bool CheckMountStateAction::Execute(Event event)
|
|||||||
attack_distance = 30.0f;
|
attack_distance = 30.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (enemy)
|
||||||
|
// attack_distance /= 2;
|
||||||
|
|
||||||
if (dps || enemy)
|
if (dps || enemy)
|
||||||
{
|
{
|
||||||
Unit* currentTarget = AI_VALUE(Unit*, "current target");
|
Unit* currentTarget = AI_VALUE(Unit*, "current target");
|
||||||
@@ -91,8 +94,7 @@ bool CheckMountStateAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot->InBattleground() && !attackdistance && (noattackers || fartarget) && !bot->IsInCombat() &&
|
if (bot->InBattleground() && !attackdistance && noattackers && !bot->IsInCombat() && !bot->IsMounted())
|
||||||
!bot->IsMounted())
|
|
||||||
{
|
{
|
||||||
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_WS)
|
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_WS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void MovementAction::JumpTo(uint32 mapId, float x, float y, float z)
|
|||||||
botAI->SetNextCheckDelay(1000);
|
botAI->SetNextCheckDelay(1000);
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MoveJump(x, y, z, speed, speed, 1);
|
mm.MoveJump(x, y, z, speed, speed, 1);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovementAction::MoveNear(uint32 mapId, float x, float y, float z, float distance)
|
bool MovementAction::MoveNear(uint32 mapId, float x, float y, float z, float distance)
|
||||||
@@ -167,6 +167,14 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (IsDuplicateMove(mapId, x, y, z))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (IsWaitingForLastMove())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// if (bot->Unit::IsFalling()) {
|
// if (bot->Unit::IsFalling()) {
|
||||||
// bot->Say("I'm falling!, flag:" + std::to_string(bot->m_movementInfo.GetMovementFlags()), LANG_UNIVERSAL);
|
// bot->Say("I'm falling!, flag:" + std::to_string(bot->m_movementInfo.GetMovementFlags()), LANG_UNIVERSAL);
|
||||||
// return false;
|
// return false;
|
||||||
@@ -177,8 +185,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (bot->Unit::IsFalling()) {
|
// if (bot->Unit::IsFalling()) {
|
||||||
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
||||||
// }
|
// }
|
||||||
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->IsFlying() &&
|
// !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
|
||||||
!bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
|
|
||||||
|
bool generatePath = !bot->IsFlying() && !bot->isSwimming();
|
||||||
bool disableMoveSplinePath = sPlayerbotAIConfig->disableMoveSplinePath >= 2 ||
|
bool disableMoveSplinePath = sPlayerbotAIConfig->disableMoveSplinePath >= 2 ||
|
||||||
(sPlayerbotAIConfig->disableMoveSplinePath == 1 && bot->InBattleground());
|
(sPlayerbotAIConfig->disableMoveSplinePath == 1 && bot->InBattleground());
|
||||||
if (disableMoveSplinePath || !generatePath)
|
if (disableMoveSplinePath || !generatePath)
|
||||||
@@ -186,8 +195,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
float distance = bot->GetExactDist(x, y, z);
|
float distance = bot->GetExactDist(x, y, z);
|
||||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
{
|
{
|
||||||
WaitForReach(distance);
|
|
||||||
|
|
||||||
if (bot->IsSitState())
|
if (bot->IsSitState())
|
||||||
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
|
||||||
@@ -199,7 +206,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
MotionMaster& mm = *bot->GetMotionMaster();
|
MotionMaster& mm = *bot->GetMotionMaster();
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MovePoint(mapId, x, y, z, generatePath);
|
mm.MovePoint(mapId, x, y, z, generatePath);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
float delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, 1000.0f * MoveDelay(distance));
|
||||||
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,8 +223,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
float distance = bot->GetExactDist(x, y, modifiedZ);
|
float distance = bot->GetExactDist(x, y, modifiedZ);
|
||||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
{
|
{
|
||||||
WaitForReach(distance);
|
|
||||||
|
|
||||||
if (bot->IsSitState())
|
if (bot->IsSitState())
|
||||||
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
|
||||||
@@ -229,7 +235,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
|
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MoveSplinePath(&path);
|
mm.MoveSplinePath(&path);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
// mm.MoveSplinePath(&path);
|
||||||
|
float delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, 1000.0f * MoveDelay(distance));
|
||||||
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,6 +855,29 @@ bool MovementAction::IsMovingAllowed(uint32 mapId, float x, float y, float z)
|
|||||||
return IsMovingAllowed();
|
return IsMovingAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MovementAction::IsDuplicateMove(uint32 mapId, float x, float y, float z)
|
||||||
|
{
|
||||||
|
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");
|
||||||
|
|
||||||
|
// heuristic 5s
|
||||||
|
if (lastMove.msTime + sPlayerbotAIConfig->maxWaitForMove < getMSTime() ||
|
||||||
|
lastMove.lastMoveShort.GetExactDist(x, y, z) > 0.01f)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MovementAction::IsWaitingForLastMove()
|
||||||
|
{
|
||||||
|
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");
|
||||||
|
|
||||||
|
// heuristic 5s
|
||||||
|
if (lastMove.lastdelayTime + lastMove.msTime > getMSTime())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MovementAction::IsMovingAllowed()
|
bool MovementAction::IsMovingAllowed()
|
||||||
{
|
{
|
||||||
// do not allow if not vehicle driver
|
// do not allow if not vehicle driver
|
||||||
@@ -878,7 +909,7 @@ void MovementAction::UpdateMovementState()
|
|||||||
{
|
{
|
||||||
bot->SetSwim(true);
|
bot->SetSwim(true);
|
||||||
}
|
}
|
||||||
else
|
else if (!bot->Unit::IsInWater())
|
||||||
{
|
{
|
||||||
bot->SetSwim(false);
|
bot->SetSwim(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ protected:
|
|||||||
void WaitForReach(float distance);
|
void WaitForReach(float distance);
|
||||||
bool IsMovingAllowed(Unit* target);
|
bool IsMovingAllowed(Unit* target);
|
||||||
bool IsMovingAllowed(uint32 mapId, float x, float y, float z);
|
bool IsMovingAllowed(uint32 mapId, float x, float y, float z);
|
||||||
|
bool IsDuplicateMove(uint32 mapId, float x, float y, float z);
|
||||||
|
bool IsWaitingForLastMove();
|
||||||
bool IsMovingAllowed();
|
bool IsMovingAllowed();
|
||||||
bool Flee(Unit* target);
|
bool Flee(Unit* target);
|
||||||
void ClearIdleState();
|
void ClearIdleState();
|
||||||
|
|||||||
@@ -183,27 +183,7 @@ public:
|
|||||||
creators["petition signed"] = &TriggerContext::petition_signed;
|
creators["petition signed"] = &TriggerContext::petition_signed;
|
||||||
creators["buy tabard"] = &TriggerContext::buy_tabard;
|
creators["buy tabard"] = &TriggerContext::buy_tabard;
|
||||||
creators["leave large guild"] = &TriggerContext::leave_large_guild;
|
creators["leave large guild"] = &TriggerContext::leave_large_guild;
|
||||||
|
|
||||||
creators["rpg"] = &TriggerContext::rpg;
|
|
||||||
creators["rpg taxi"] = &TriggerContext::rpg_taxi;
|
|
||||||
creators["rpg discover"] = &TriggerContext::rpg_discover;
|
|
||||||
creators["rpg start quest"] = &TriggerContext::rpg_start_quest;
|
|
||||||
creators["rpg end quest"] = &TriggerContext::rpg_end_quest;
|
|
||||||
creators["rpg buy"] = &TriggerContext::rpg_buy;
|
|
||||||
creators["rpg sell"] = &TriggerContext::rpg_sell;
|
|
||||||
creators["rpg repair"] = &TriggerContext::rpg_repair;
|
|
||||||
creators["rpg train"] = &TriggerContext::rpg_train;
|
|
||||||
creators["rpg heal"] = &TriggerContext::rpg_heal;
|
|
||||||
creators["rpg home bind"] = &TriggerContext::rpg_home_bind;
|
|
||||||
creators["rpg queue bg"] = &TriggerContext::rpg_queue_bg;
|
|
||||||
creators["rpg buy petition"] = &TriggerContext::rpg_buy_petition;
|
|
||||||
creators["rpg use"] = &TriggerContext::rpg_use;
|
|
||||||
creators["rpg spell"] = &TriggerContext::rpg_spell;
|
|
||||||
creators["rpg craft"] = &TriggerContext::rpg_craft;
|
|
||||||
creators["rpg trade useful"] = &TriggerContext::rpg_trade_useful;
|
|
||||||
creators["rpg duel"] = &TriggerContext::rpg_duel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Trigger* give_food(PlayerbotAI * botAI) { return new GiveFoodTrigger(botAI); }
|
static Trigger* give_food(PlayerbotAI * botAI) { return new GiveFoodTrigger(botAI); }
|
||||||
static Trigger* give_water(PlayerbotAI * botAI) { return new GiveWaterTrigger(botAI); }
|
static Trigger* give_water(PlayerbotAI * botAI) { return new GiveWaterTrigger(botAI); }
|
||||||
@@ -224,7 +204,10 @@ private:
|
|||||||
{
|
{
|
||||||
return new AoeHealTrigger(botAI, "critical aoe heal", "critical", 2);
|
return new AoeHealTrigger(botAI, "critical aoe heal", "critical", 2);
|
||||||
}
|
}
|
||||||
static Trigger* low_aoe_heal(PlayerbotAI* botAI) { return new AoeHealTrigger(botAI, "low aoe heal", "low", 2); }
|
static Trigger* low_aoe_heal(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new AoeHealTrigger(botAI, "low aoe heal", "low", 2);
|
||||||
|
}
|
||||||
static Trigger* medium_aoe_heal(PlayerbotAI * botAI)
|
static Trigger* medium_aoe_heal(PlayerbotAI * botAI)
|
||||||
{
|
{
|
||||||
return new AoeHealTrigger(botAI, "medium aoe heal", "medium", 2);
|
return new AoeHealTrigger(botAI, "medium aoe heal", "medium", 2);
|
||||||
@@ -239,7 +222,7 @@ private:
|
|||||||
}
|
}
|
||||||
static Trigger* medium_group_heal_occasion(PlayerbotAI * ai)
|
static Trigger* medium_group_heal_occasion(PlayerbotAI * ai)
|
||||||
{
|
{
|
||||||
return new AoeInGroupTrigger(ai, "group heal occasion", "medium", 0.4);
|
return new AoeInGroupTrigger(ai, "group heal occasion", "medium", 0.6);
|
||||||
}
|
}
|
||||||
static Trigger* target_changed(PlayerbotAI * botAI) { return new TargetChangedTrigger(botAI); }
|
static Trigger* target_changed(PlayerbotAI * botAI) { return new TargetChangedTrigger(botAI); }
|
||||||
static Trigger* swimming(PlayerbotAI * botAI) { return new IsSwimmingTrigger(botAI); }
|
static Trigger* swimming(PlayerbotAI * botAI) { return new IsSwimmingTrigger(botAI); }
|
||||||
@@ -284,7 +267,10 @@ private:
|
|||||||
static Trigger* NoTarget(PlayerbotAI * botAI) { return new NoTargetTrigger(botAI); }
|
static Trigger* NoTarget(PlayerbotAI * botAI) { return new NoTargetTrigger(botAI); }
|
||||||
static Trigger* TargetInSight(PlayerbotAI * botAI) { return new TargetInSightTrigger(botAI); }
|
static Trigger* TargetInSight(PlayerbotAI * botAI) { return new TargetInSightTrigger(botAI); }
|
||||||
static Trigger* not_dps_target_active(PlayerbotAI * botAI) { return new NotDpsTargetActiveTrigger(botAI); }
|
static Trigger* not_dps_target_active(PlayerbotAI * botAI) { return new NotDpsTargetActiveTrigger(botAI); }
|
||||||
static Trigger* not_dps_aoe_target_active(PlayerbotAI* botAI) { return new NotDpsAoeTargetActiveTrigger(botAI); }
|
static Trigger* not_dps_aoe_target_active(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new NotDpsAoeTargetActiveTrigger(botAI);
|
||||||
|
}
|
||||||
static Trigger* has_nearest_adds(PlayerbotAI * botAI) { return new HasNearestAddsTrigger(botAI); }
|
static Trigger* has_nearest_adds(PlayerbotAI * botAI) { return new HasNearestAddsTrigger(botAI); }
|
||||||
static Trigger* enemy_player_near(PlayerbotAI * botAI) { return new EnemyPlayerNear(botAI); }
|
static Trigger* enemy_player_near(PlayerbotAI * botAI) { return new EnemyPlayerNear(botAI); }
|
||||||
static Trigger* Random(PlayerbotAI * botAI) { return new RandomTrigger(botAI, "random", 20); }
|
static Trigger* Random(PlayerbotAI * botAI) { return new RandomTrigger(botAI, "random", 20); }
|
||||||
@@ -292,13 +278,22 @@ private:
|
|||||||
static Trigger* often(PlayerbotAI * botAI) { return new RandomTrigger(botAI, "often", 5); }
|
static Trigger* often(PlayerbotAI * botAI) { return new RandomTrigger(botAI, "often", 5); }
|
||||||
static Trigger* EnemyOutOfMelee(PlayerbotAI * botAI) { return new EnemyOutOfMeleeTrigger(botAI); }
|
static Trigger* EnemyOutOfMelee(PlayerbotAI * botAI) { return new EnemyOutOfMeleeTrigger(botAI); }
|
||||||
static Trigger* EnemyOutOfSpell(PlayerbotAI * botAI) { return new EnemyOutOfSpellRangeTrigger(botAI); }
|
static Trigger* EnemyOutOfSpell(PlayerbotAI * botAI) { return new EnemyOutOfSpellRangeTrigger(botAI); }
|
||||||
static Trigger* enemy_too_close_for_spell(PlayerbotAI* botAI) { return new EnemyTooCloseForSpellTrigger(botAI); }
|
static Trigger* enemy_too_close_for_spell(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new EnemyTooCloseForSpellTrigger(botAI);
|
||||||
|
}
|
||||||
static Trigger* enemy_too_close_for_auto_shot(PlayerbotAI * botAI)
|
static Trigger* enemy_too_close_for_auto_shot(PlayerbotAI * botAI)
|
||||||
{
|
{
|
||||||
return new EnemyTooCloseForAutoShotTrigger(botAI);
|
return new EnemyTooCloseForAutoShotTrigger(botAI);
|
||||||
}
|
}
|
||||||
static Trigger* enemy_too_close_for_shoot(PlayerbotAI* botAI) { return new EnemyTooCloseForShootTrigger(botAI); }
|
static Trigger* enemy_too_close_for_shoot(PlayerbotAI * botAI)
|
||||||
static Trigger* enemy_too_close_for_melee(PlayerbotAI* botAI) { return new EnemyTooCloseForMeleeTrigger(botAI); }
|
{
|
||||||
|
return new EnemyTooCloseForShootTrigger(botAI);
|
||||||
|
}
|
||||||
|
static Trigger* enemy_too_close_for_melee(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new EnemyTooCloseForMeleeTrigger(botAI);
|
||||||
|
}
|
||||||
static Trigger* enemy_is_close(PlayerbotAI * botAI) { return new EnemyIsCloseTrigger(botAI); }
|
static Trigger* enemy_is_close(PlayerbotAI * botAI) { return new EnemyIsCloseTrigger(botAI); }
|
||||||
static Trigger* enemy_within_melee(PlayerbotAI * botAI) { return new EnemyWithinMeleeTrigger(botAI); }
|
static Trigger* enemy_within_melee(PlayerbotAI * botAI) { return new EnemyWithinMeleeTrigger(botAI); }
|
||||||
static Trigger* party_member_to_heal_out_of_spell_range(PlayerbotAI * botAI)
|
static Trigger* party_member_to_heal_out_of_spell_range(PlayerbotAI * botAI)
|
||||||
@@ -313,7 +308,10 @@ private:
|
|||||||
static Trigger* PartyMemberDead(PlayerbotAI * botAI) { return new PartyMemberDeadTrigger(botAI); }
|
static Trigger* PartyMemberDead(PlayerbotAI * botAI) { return new PartyMemberDeadTrigger(botAI); }
|
||||||
static Trigger* CombatPartyMemberDead(PlayerbotAI * botAI) { return new CombatPartyMemberDeadTrigger(botAI); }
|
static Trigger* CombatPartyMemberDead(PlayerbotAI * botAI) { return new CombatPartyMemberDeadTrigger(botAI); }
|
||||||
static Trigger* PartyMemberLowHealth(PlayerbotAI * botAI) { return new PartyMemberLowHealthTrigger(botAI); }
|
static Trigger* PartyMemberLowHealth(PlayerbotAI * botAI) { return new PartyMemberLowHealthTrigger(botAI); }
|
||||||
static Trigger* PartyMemberMediumHealth(PlayerbotAI* botAI) { return new PartyMemberMediumHealthTrigger(botAI); }
|
static Trigger* PartyMemberMediumHealth(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new PartyMemberMediumHealthTrigger(botAI);
|
||||||
|
}
|
||||||
static Trigger* PartyMemberAlmostFullHealth(PlayerbotAI * botAI)
|
static Trigger* PartyMemberAlmostFullHealth(PlayerbotAI * botAI)
|
||||||
{
|
{
|
||||||
return new PartyMemberAlmostFullHealthTrigger(botAI);
|
return new PartyMemberAlmostFullHealthTrigger(botAI);
|
||||||
@@ -328,7 +326,10 @@ private:
|
|||||||
static Trigger* pet_attack(PlayerbotAI * botAI) { return new PetAttackTrigger(botAI); }
|
static Trigger* pet_attack(PlayerbotAI * botAI) { return new PetAttackTrigger(botAI); }
|
||||||
static Trigger* has_attackers(PlayerbotAI * botAI) { return new HasAttackersTrigger(botAI); }
|
static Trigger* has_attackers(PlayerbotAI * botAI) { return new HasAttackersTrigger(botAI); }
|
||||||
static Trigger* random_bot_update_trigger(PlayerbotAI * botAI) { return new RandomBotUpdateTrigger(botAI); }
|
static Trigger* random_bot_update_trigger(PlayerbotAI * botAI) { return new RandomBotUpdateTrigger(botAI); }
|
||||||
static Trigger* no_non_bot_players_around(PlayerbotAI* botAI) { return new NoNonBotPlayersAroundTrigger(botAI); }
|
static Trigger* no_non_bot_players_around(PlayerbotAI * botAI)
|
||||||
|
{
|
||||||
|
return new NoNonBotPlayersAroundTrigger(botAI);
|
||||||
|
}
|
||||||
static Trigger* new_player_nearby(PlayerbotAI * botAI) { return new NewPlayerNearbyTrigger(botAI); }
|
static Trigger* new_player_nearby(PlayerbotAI * botAI) { return new NewPlayerNearbyTrigger(botAI); }
|
||||||
static Trigger* bg_waiting(PlayerbotAI * botAI) { return new BgWaitingTrigger(botAI); }
|
static Trigger* bg_waiting(PlayerbotAI * botAI) { return new BgWaitingTrigger(botAI); }
|
||||||
static Trigger* bg_active(PlayerbotAI * botAI) { return new BgActiveTrigger(botAI); }
|
static Trigger* bg_active(PlayerbotAI * botAI) { return new BgActiveTrigger(botAI); }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
|
||||||
LastMovement::LastMovement() { clear(); }
|
LastMovement::LastMovement() { clear(); }
|
||||||
|
|
||||||
@@ -38,17 +39,19 @@ void LastMovement::clear()
|
|||||||
lastAreaTrigger = 0;
|
lastAreaTrigger = 0;
|
||||||
lastFlee = 0;
|
lastFlee = 0;
|
||||||
nextTeleport = 0;
|
nextTeleport = 0;
|
||||||
|
msTime = 0;
|
||||||
|
lastdelayTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastMovement::Set(Unit* follow)
|
void LastMovement::Set(Unit* follow)
|
||||||
{
|
{
|
||||||
Set(0, 0.0f, 0.0f, 0.0f, 0.0f);
|
Set(0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
setShort(WorldPosition());
|
setShort(WorldPosition());
|
||||||
setPath(TravelPath());
|
setPath(TravelPath());
|
||||||
lastFollow = follow;
|
lastFollow = follow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori)
|
void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori, float delayTime)
|
||||||
{
|
{
|
||||||
lastMoveToMapId = mapId;
|
lastMoveToMapId = mapId;
|
||||||
lastMoveToX = x;
|
lastMoveToX = x;
|
||||||
@@ -57,6 +60,8 @@ void LastMovement::Set(uint32 mapId, float x, float y, float z, float ori)
|
|||||||
lastMoveToOri = ori;
|
lastMoveToOri = ori;
|
||||||
lastFollow = nullptr;
|
lastFollow = nullptr;
|
||||||
lastMoveShort = WorldPosition(mapId, x, y, z, ori);
|
lastMoveShort = WorldPosition(mapId, x, y, z, ori);
|
||||||
|
msTime = getMSTime();
|
||||||
|
lastdelayTime = delayTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastMovement::setShort(WorldPosition point)
|
void LastMovement::setShort(WorldPosition point)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void Set(Unit* follow);
|
void Set(Unit* follow);
|
||||||
void Set(uint32 mapId, float x, float y, float z, float ori);
|
void Set(uint32 mapId, float x, float y, float z, float ori, float delayTime);
|
||||||
|
|
||||||
void setShort(WorldPosition point);
|
void setShort(WorldPosition point);
|
||||||
void setPath(TravelPath path);
|
void setPath(TravelPath path);
|
||||||
@@ -50,7 +50,9 @@ public:
|
|||||||
float lastMoveToY;
|
float lastMoveToY;
|
||||||
float lastMoveToZ;
|
float lastMoveToZ;
|
||||||
float lastMoveToOri;
|
float lastMoveToOri;
|
||||||
|
float lastdelayTime;
|
||||||
WorldPosition lastMoveShort;
|
WorldPosition lastMoveShort;
|
||||||
|
uint32 msTime;
|
||||||
TravelPath lastPath;
|
TravelPath lastPath;
|
||||||
time_t nextTeleport;
|
time_t nextTeleport;
|
||||||
std::future<TravelPath> future;
|
std::future<TravelPath> future;
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ bool PartyMemberToHeal::Check(Unit* player)
|
|||||||
// sServerFacade->GetDistance2d(bot, player) < (player->IsPlayer() && botAI->IsTank((Player*)player) ? 50.0f
|
// sServerFacade->GetDistance2d(bot, player) < (player->IsPlayer() && botAI->IsTank((Player*)player) ? 50.0f
|
||||||
// : 40.0f);
|
// : 40.0f);
|
||||||
return player->GetMapId() == bot->GetMapId() && !player->IsCharmed() &&
|
return player->GetMapId() == bot->GetMapId() && !player->IsCharmed() &&
|
||||||
bot->GetDistance2d(player) < sPlayerbotAIConfig->healDistance * 2 &&
|
bot->GetDistance2d(player) < sPlayerbotAIConfig->healDistance * 2 && bot->IsWithinLOSInMap(player);
|
||||||
bot->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* PartyMemberToProtect::Calculate()
|
Unit* PartyMemberToProtect::Calculate()
|
||||||
|
|||||||
Reference in New Issue
Block a user