mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Moved yells to database
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
DELETE FROM ai_playerbot_texts WHERE name IN (
|
||||
'netherspite_beam_blocking_red',
|
||||
'netherspite_beam_blocking_blue',
|
||||
'netherspite_beam_blocking_green',
|
||||
'netherspite_beam_leaving_blue',
|
||||
'netherspite_beam_leaving_green'
|
||||
);
|
||||
|
||||
DELETE FROM ai_playerbot_texts_chance WHERE name IN (
|
||||
'netherspite_beam_blocking_red',
|
||||
'netherspite_beam_blocking_blue',
|
||||
'netherspite_beam_blocking_green',
|
||||
'netherspite_beam_leaving_blue',
|
||||
'netherspite_beam_leaving_green'
|
||||
);
|
||||
|
||||
INSERT INTO ai_playerbot_texts (name, text, say_type, reply_type, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8) VALUES
|
||||
('netherspite_beam_blocking_red', '%player is moving to block the red beam!', 0, 0, '', '', '', '', '', '', '', ''),
|
||||
('netherspite_beam_blocking_blue', '%player is moving to block the blue beam!', 0, 0, '', '', '', '', '', '', '', ''),
|
||||
('netherspite_beam_blocking_green', '%player is moving to block the green beam!', 0, 0, '', '', '', '', '', '', '', ''),
|
||||
('netherspite_beam_leaving_blue', '%player is leaving the blue beam--next blocker up!', 0, 0, '', '', '', '', '', '', '', ''),
|
||||
('netherspite_beam_leaving_green', '%player is leaving the green beam--next blocker up!', 0, 0, '', '', '', '', '', '', '', '');
|
||||
|
||||
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES
|
||||
('netherspite_beam_blocking_red', 100),
|
||||
('netherspite_beam_blocking_blue', 100),
|
||||
('netherspite_beam_blocking_green', 100),
|
||||
('netherspite_beam_leaving_blue', 100),
|
||||
('netherspite_beam_leaving_green', 100);
|
||||
@@ -101,6 +101,7 @@ bool KarazhanMaidenOfVirtuePositionBossAction::Execute(Event event)
|
||||
bot->GetPositionZ(), false, false, false, false, MovementPriority::MOVEMENT_COMBAT, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,6 +147,7 @@ bool KarazhanMaidenOfVirtuePositionRangedAction::Execute(Event event)
|
||||
KARAZHAN_MAIDEN_OF_VIRTUE_RANGED_POSITION[index].GetPositionY(), bot->GetPositionZ(), false,
|
||||
false, false, false, MovementPriority::MOVEMENT_COMBAT, true, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -176,9 +178,11 @@ bool KarazhanBigBadWolfPositionBossAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return MoveTo(bot->GetMapId(), mX, mY, bot->GetPositionZ(), false, false, false, false,
|
||||
MovementPriority::MOVEMENT_COMBAT, true, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +197,6 @@ bool KarazhanBigBadWolfPositionBossAction::isUseful()
|
||||
bool KarazhanBigBadWolfRunAwayAction::Execute(Event event)
|
||||
{
|
||||
constexpr float threshold = 1.0f;
|
||||
|
||||
Position target = KARAZHAN_BIG_BAD_WOLF_RUN_POSITION[currentIndex];
|
||||
|
||||
while (bot->GetExactDist2d(target.GetPositionX(), target.GetPositionY()) < threshold)
|
||||
@@ -201,6 +204,7 @@ bool KarazhanBigBadWolfRunAwayAction::Execute(Event event)
|
||||
currentIndex = (currentIndex + 1) % 4;
|
||||
target = KARAZHAN_BIG_BAD_WOLF_RUN_POSITION[currentIndex];
|
||||
}
|
||||
|
||||
return MoveTo(bot->GetMapId(), target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(),
|
||||
false, false, false, true, MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
@@ -257,13 +261,8 @@ bool KarazhanWizardOfOzMarkTargetAction::Execute(Event event)
|
||||
bool KarazhanWizardOfOzScorchStrawmanAction::Execute(Event event)
|
||||
{
|
||||
Unit* strawman = AI_VALUE2(Unit*, "find target", "strawman");
|
||||
if (!strawman || !strawman->IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group)
|
||||
if (!strawman || !strawman->IsAlive() || !group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -271,17 +270,8 @@ bool KarazhanWizardOfOzScorchStrawmanAction::Execute(Event event)
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* member = itr->GetSource();
|
||||
if (!member || !member->IsAlive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (member->getClass() != CLASS_MAGE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerbotAI* mageAI = sPlayerbotsMgr->GetPlayerbotAI(member);
|
||||
if (!mageAI)
|
||||
if (!member || !member->IsAlive() || member->getClass() != CLASS_MAGE || !mageAI)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -290,6 +280,7 @@ bool KarazhanWizardOfOzScorchStrawmanAction::Execute(Event event)
|
||||
mageAI->CastSpell("scorch", strawman);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,6 +316,7 @@ bool KarazhanTheCuratorPositionBossAction::Execute(Event event)
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -345,6 +337,7 @@ bool KarazhanTheCuratorSpreadRangedAction::Execute(Event event)
|
||||
{
|
||||
return FleePosition(nearestPlayer->GetPosition(), minDistance);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -391,6 +384,7 @@ bool KarazhanShadeOfAranArcaneExplosionRunAwayAction::Execute(Event event)
|
||||
{
|
||||
return MoveAway(boss, safeDistance - distance);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -415,6 +409,7 @@ bool KarazhanShadeOfAranFlameWreathStopMovementAction::Execute(Event event)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -422,15 +417,14 @@ bool KarazhanShadeOfAranMarkConjuredElementalAction::Execute(Event event)
|
||||
{
|
||||
RaidKarazhanHelpers karazhanHelper(botAI);
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "shade of aran");
|
||||
if (!boss || !boss->IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Unit* target = karazhanHelper.GetFirstAliveUnitByEntry(NPC_CONJURED_ELEMENTAL);
|
||||
if (!target || !target->IsAlive() || target->HasAura(SPELL_WARLOCK_BANISH))
|
||||
|
||||
if (!boss || !boss->IsAlive() ||
|
||||
!target || !target->IsAlive() || target->HasAura(SPELL_WARLOCK_BANISH))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
karazhanHelper.MarkTargetWithSkull(target);
|
||||
|
||||
return false;
|
||||
@@ -464,21 +458,17 @@ bool KarazhanShadeOfAranSpreadRangedAction::Execute(Event event)
|
||||
{
|
||||
return FleePosition(nearestPlayer->GetPosition(), minDistance);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool KarazhanShadeOfAranSpreadRangedAction::isUseful()
|
||||
{
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "shade of aran");
|
||||
if (!boss || !boss->IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RaidKarazhanHelpers karazhanHelper(botAI);
|
||||
|
||||
return botAI->IsRanged(bot) && !karazhanHelper.IsFlameWreathActive() && !(boss->HasUnitState(UNIT_STATE_CASTING)
|
||||
&& boss->FindCurrentSpellBySpellId(SPELL_ARCANE_EXPLOSION));
|
||||
return boss && boss->IsAlive() && botAI->IsRanged(bot) && !karazhanHelper.IsFlameWreathActive() &&
|
||||
!(boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_ARCANE_EXPLOSION));
|
||||
}
|
||||
|
||||
// One tank per phase will dance in and out of the red beam (5 seconds in, 5 seconds out)
|
||||
@@ -498,29 +488,33 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event)
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* member = itr->GetSource();
|
||||
if (!member || !member->IsAlive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
PlayerbotAI* memberAI = sPlayerbotsMgr->GetPlayerbotAI(member);
|
||||
if (!memberAI || !memberAI->IsTank(member))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (member->HasAura(SPELL_NETHER_EXHAUSTION_RED))
|
||||
if (!member || !member->IsAlive() || !memberAI || !memberAI->IsTank(member) ||
|
||||
member->HasAura(SPELL_NETHER_EXHAUSTION_RED))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
eligibleTank = member;
|
||||
break;
|
||||
}
|
||||
|
||||
RaidKarazhanHelpers karazhanHelper(botAI);
|
||||
Position beamPos = karazhanHelper.GetPositionOnBeam(boss, redPortal, 18.0f);
|
||||
|
||||
if (bot == eligibleTank)
|
||||
{
|
||||
bot->Yell("I'm moving to block the red beam!", LANG_UNIVERSAL);
|
||||
std::string msg;
|
||||
std::map<std::string, std::string> ph;
|
||||
ph["%player"] = bot->GetName();
|
||||
bool got = sPlayerbotTextMgr->GetBotText("netherspite_beam_blocking_red", msg, ph);
|
||||
if (got && !msg.empty())
|
||||
{
|
||||
bot->Yell(msg, LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(bot->GetName() + " is moving to block the red beam!", LANG_UNIVERSAL);
|
||||
}
|
||||
|
||||
ObjectGuid botGuid = bot->GetGUID();
|
||||
uint32 intervalSecs = 5;
|
||||
|
||||
@@ -539,6 +533,7 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event)
|
||||
return MoveTo(bot->GetMapId(), beamPos.GetPositionX(), beamPos.GetPositionY(), beamPos.GetPositionZ(),
|
||||
false, false, false, true, MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
float bx = boss->GetPositionX();
|
||||
@@ -552,6 +547,7 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dx /= length;
|
||||
dy /= length;
|
||||
float perpDx = -dy;
|
||||
@@ -564,6 +560,7 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event)
|
||||
MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -576,10 +573,11 @@ bool KarazhanNetherspiteBlockRedBeamAction::isUseful()
|
||||
static std::map<ObjectGuid, bool> lastBossBanishState;
|
||||
bool bossIsBanished = boss && boss->HasAura(SPELL_NETHERSPITE_BANISHED);
|
||||
|
||||
if (!boss || !redPortal)
|
||||
if (!boss || !redPortal || bossIsBanished)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lastBossBanishState[botGuid] != bossIsBanished)
|
||||
{
|
||||
if (!bossIsBanished)
|
||||
@@ -589,10 +587,7 @@ bool KarazhanNetherspiteBlockRedBeamAction::isUseful()
|
||||
}
|
||||
lastBossBanishState[botGuid] = bossIsBanished;
|
||||
}
|
||||
if (bossIsBanished)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -613,18 +608,42 @@ bool KarazhanNetherspiteBlockBlueBeamAction::Execute(Event event)
|
||||
|
||||
if (wasBlocking && !isBlockingNow)
|
||||
{
|
||||
bot->Yell("I'm leaving the blue beam--next blocker up!", LANG_UNIVERSAL);
|
||||
std::string msg;
|
||||
std::map<std::string, std::string> ph;
|
||||
ph["%player"] = bot->GetName();
|
||||
bool got = sPlayerbotTextMgr->GetBotText("netherspite_beam_leaving_blue", msg, ph);
|
||||
if (got && !msg.empty())
|
||||
{
|
||||
bot->Yell(msg, LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(bot->GetName() + " is leaving the blue beam--next blocker up!", LANG_UNIVERSAL);
|
||||
}
|
||||
|
||||
wasBlockingBlueBeam[botGuid] = false;
|
||||
return false;
|
||||
}
|
||||
else if (isBlockingNow)
|
||||
{
|
||||
wasBlockingBlueBeam[botGuid] = true;
|
||||
}
|
||||
|
||||
if (isBlockingNow)
|
||||
{
|
||||
if (!wasBlocking)
|
||||
bot->Yell("I'm moving to block the blue beam!", LANG_UNIVERSAL);
|
||||
{
|
||||
std::string msg;
|
||||
std::map<std::string, std::string> ph;
|
||||
ph["%player"] = bot->GetName();
|
||||
bool got = sPlayerbotTextMgr->GetBotText("netherspite_beam_blocking_blue", msg, ph);
|
||||
if (got && !msg.empty())
|
||||
{
|
||||
bot->Yell(msg, LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(bot->GetName() + " is moving to block the blue beam!", LANG_UNIVERSAL);
|
||||
}
|
||||
}
|
||||
wasBlockingBlueBeam[botGuid] = true;
|
||||
|
||||
std::vector<Unit*> voidZones = karazhanHelper.GetAllVoidZones();
|
||||
float bx = boss->GetPositionX();
|
||||
float by = boss->GetPositionY();
|
||||
@@ -677,12 +696,11 @@ bool KarazhanNetherspiteBlockBlueBeamAction::Execute(Event event)
|
||||
return MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(),
|
||||
false, false, false, true, MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (wasBlocking)
|
||||
{
|
||||
wasBlockingBlueBeam[botGuid] = false;
|
||||
}
|
||||
|
||||
wasBlockingBlueBeam[botGuid] = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -712,14 +730,42 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event)
|
||||
|
||||
if (wasBlocking && !isBlockingNow)
|
||||
{
|
||||
bot->Yell("I'm leaving the green beam--next blocker up!", LANG_UNIVERSAL);
|
||||
std::string msg;
|
||||
std::map<std::string, std::string> ph;
|
||||
ph["%player"] = bot->GetName();
|
||||
bool got = sPlayerbotTextMgr->GetBotText("netherspite_beam_leaving_green", msg, ph);
|
||||
if (got && !msg.empty())
|
||||
{
|
||||
bot->Yell(msg, LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(bot->GetName() + " TESTRUN is leaving the green beam--next blocker up!", LANG_UNIVERSAL);
|
||||
}
|
||||
|
||||
wasBlockingGreenBeam[botGuid] = false;
|
||||
return false;
|
||||
}
|
||||
else if (isBlockingNow)
|
||||
|
||||
if (isBlockingNow)
|
||||
{
|
||||
if (!wasBlocking)
|
||||
bot->Yell("I'm moving to block the green beam!", LANG_UNIVERSAL);
|
||||
{
|
||||
std::string msg;
|
||||
std::map<std::string, std::string> ph;
|
||||
ph["%player"] = bot->GetName();
|
||||
bool got = sPlayerbotTextMgr->GetBotText("netherspite_beam_blocking_green", msg, ph);
|
||||
if (got && !msg.empty())
|
||||
{
|
||||
bot->Yell(msg, LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot->Yell(bot->GetName() + " TESTRUN is moving to block the green beam!", LANG_UNIVERSAL);
|
||||
}
|
||||
}
|
||||
wasBlockingGreenBeam[botGuid] = true;
|
||||
|
||||
std::vector<Unit*> voidZones = karazhanHelper.GetAllVoidZones();
|
||||
float bx = boss->GetPositionX();
|
||||
float by = boss->GetPositionY();
|
||||
@@ -733,6 +779,7 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dx /= length;
|
||||
dy /= length;
|
||||
float bestDist = 150.0f;
|
||||
@@ -747,7 +794,7 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event)
|
||||
for (Unit* voidZone : voidZones)
|
||||
{
|
||||
float voidZoneDist = sqrt(pow(candidateX - voidZone->GetPositionX(), 2) +
|
||||
pow(candidateY - voidZone->GetPositionY(), 2));
|
||||
pow(candidateY - voidZone->GetPositionY(), 2));
|
||||
if (voidZoneDist < 4.0f)
|
||||
{
|
||||
outsideAllVoidZones = false;
|
||||
@@ -771,12 +818,11 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event)
|
||||
return MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(),
|
||||
false, false, false, true, MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (wasBlocking)
|
||||
{
|
||||
wasBlockingGreenBeam[botGuid] = false;
|
||||
}
|
||||
|
||||
wasBlockingGreenBeam[botGuid] = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -835,7 +881,6 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event)
|
||||
float length = sqrt(dx*dx + dy*dy);
|
||||
beams.push_back({greenPortal, 0.0f, length});
|
||||
}
|
||||
|
||||
bool nearBeam = false;
|
||||
for (const auto& beam : beams)
|
||||
{
|
||||
@@ -844,7 +889,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event)
|
||||
float dx = px - bx, dy = py - by;
|
||||
float length = sqrt(dx*dx + dy*dy);
|
||||
if (length == 0.0f)
|
||||
{continue;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dx /= length; dy /= length;
|
||||
@@ -858,7 +903,6 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nearVoidZone && !nearBeam)
|
||||
{
|
||||
return false;
|
||||
@@ -936,12 +980,14 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::isUseful()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RaidKarazhanHelpers karazhanHelper(botAI);
|
||||
auto [redBlocker, greenBlocker, blueBlocker] = karazhanHelper.GetCurrentBeamBlockers();
|
||||
if (bot == redBlocker || bot == blueBlocker || bot == greenBlocker)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -957,6 +1003,7 @@ bool KarazhanNetherspiteBanishPhaseAvoidVoidZoneAction::Execute(Event event)
|
||||
return FleePosition(vz->GetPosition(), 4.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -967,6 +1014,7 @@ bool KarazhanNetherspiteBanishPhaseAvoidVoidZoneAction::isUseful()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RaidKarazhanHelpers karazhanHelper(botAI);
|
||||
std::vector<Unit*> voidZones = karazhanHelper.GetAllVoidZones();
|
||||
for (Unit* vz : voidZones)
|
||||
@@ -976,6 +1024,7 @@ bool KarazhanNetherspiteBanishPhaseAvoidVoidZoneAction::isUseful()
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1037,6 +1086,7 @@ bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::Execute(Event event)
|
||||
return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true,
|
||||
MovementPriority::MOVEMENT_FORCED);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1127,6 +1177,7 @@ bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1165,6 +1216,7 @@ bool KarazhanPrinceMalchezaarTankAvoidHazardAction::Execute(Event event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearInfernal)
|
||||
{
|
||||
for (int i = 0; i < numAngles; ++i)
|
||||
@@ -1238,6 +1290,7 @@ bool KarazhanPrinceMalchezaarTankAvoidHazardAction::Execute(Event event)
|
||||
MovementPriority::MOVEMENT_COMBAT);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,18 +100,14 @@ Unit* RaidKarazhanHelpers::GetNearestPlayerInRadius(float radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool RaidKarazhanHelpers::IsFlameWreathActive()
|
||||
{
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "shade of aran");
|
||||
if (!boss)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Spell* currentSpell = boss->GetCurrentSpell(CURRENT_GENERIC_SPELL);
|
||||
Spell* currentSpell = boss ? boss->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
|
||||
if (currentSpell && currentSpell->m_spellInfo && currentSpell->m_spellInfo->Id == SPELL_FLAME_WREATH)
|
||||
{
|
||||
return true;
|
||||
@@ -132,6 +128,7 @@ bool RaidKarazhanHelpers::IsFlameWreathActive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -148,20 +145,19 @@ std::vector<Player*> RaidKarazhanHelpers::GetBlueBlockers()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isDps = botAI->IsDps(member);
|
||||
bool isWarrior = member->getClass() == CLASS_WARRIOR;
|
||||
bool isRogue = member->getClass() == CLASS_ROGUE;
|
||||
bool hasExhaustion = member->HasAura(SPELL_NETHER_EXHAUSTION_BLUE);
|
||||
Aura* blueBuff = member->GetAura(SPELL_BLUE_BEAM_DEBUFF);
|
||||
bool overStack = blueBuff && blueBuff->GetStackAmount() >= 25;
|
||||
|
||||
if (isDps && !isWarrior && !isRogue && !hasExhaustion && !overStack)
|
||||
{
|
||||
blueBlockers.push_back(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blueBlockers;
|
||||
}
|
||||
|
||||
@@ -180,7 +176,6 @@ std::vector<Player*> RaidKarazhanHelpers::GetGreenBlockers()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool hasExhaustion = member->HasAura(SPELL_NETHER_EXHAUSTION_GREEN);
|
||||
Aura* greenBuff = member->GetAura(SPELL_GREEN_BEAM_DEBUFF);
|
||||
bool overStack = greenBuff && greenBuff->GetStackAmount() >= 25;
|
||||
@@ -189,13 +184,13 @@ std::vector<Player*> RaidKarazhanHelpers::GetGreenBlockers()
|
||||
bool eligibleRogueWarrior = (isRogue || isDpsWarrior) && !hasExhaustion;
|
||||
bool isHealer = botAI->IsHeal(member);
|
||||
bool eligibleHealer = isHealer && !hasExhaustion && !overStack;
|
||||
|
||||
if (eligibleRogueWarrior || eligibleHealer)
|
||||
{
|
||||
greenBlockers.push_back(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return greenBlockers;
|
||||
}
|
||||
|
||||
@@ -210,7 +205,6 @@ Position RaidKarazhanHelpers::GetPositionOnBeam(Unit* boss, Unit* portal, float
|
||||
float dx = px - bx;
|
||||
float dy = py - by;
|
||||
float length = sqrt(dx*dx + dy*dy);
|
||||
|
||||
if (length == 0.0f)
|
||||
{
|
||||
return Position(bx, by, bz);
|
||||
@@ -218,7 +212,6 @@ Position RaidKarazhanHelpers::GetPositionOnBeam(Unit* boss, Unit* portal, float
|
||||
|
||||
dx /= length;
|
||||
dy /= length;
|
||||
|
||||
float targetX = bx + dx * distanceFromBoss;
|
||||
float targetY = by + dy * distanceFromBoss;
|
||||
float targetZ = bz;
|
||||
@@ -233,38 +226,29 @@ std::tuple<Player*, Player*, Player*> RaidKarazhanHelpers::GetCurrentBeamBlocker
|
||||
Player* blueBlocker = nullptr;
|
||||
std::vector<Player*> redBlockers;
|
||||
|
||||
if (Group* group = bot->GetGroup())
|
||||
if (Group* group = bot->GetGroup())
|
||||
{
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
Player* member = itr->GetSource();
|
||||
PlayerbotAI* memberAI = sPlayerbotsMgr->GetPlayerbotAI(member);
|
||||
if (!member || !member->IsAlive() || !memberAI || !memberAI->IsTank(member) ||
|
||||
member->HasAura(SPELL_NETHER_EXHAUSTION_RED))
|
||||
{
|
||||
Player* member = itr->GetSource();
|
||||
if (!member || !member->IsAlive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!botAI->IsTank(member))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (member->HasAura(SPELL_NETHER_EXHAUSTION_RED))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
redBlockers.push_back(member);
|
||||
continue;
|
||||
}
|
||||
redBlockers.push_back(member);
|
||||
}
|
||||
|
||||
}
|
||||
if (!redBlockers.empty())
|
||||
{
|
||||
redBlocker = redBlockers.front();
|
||||
}
|
||||
|
||||
std::vector<Player*> greenBlockers = GetGreenBlockers();
|
||||
if (!greenBlockers.empty())
|
||||
{
|
||||
greenBlocker = greenBlockers.front();
|
||||
}
|
||||
|
||||
std::vector<Player*> blueBlockers = GetBlueBlockers();
|
||||
if (!blueBlockers.empty())
|
||||
{
|
||||
@@ -286,13 +270,13 @@ std::vector<Unit*> RaidKarazhanHelpers::GetAllVoidZones()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = bot->GetExactDist2d(unit);
|
||||
if (dist < radius)
|
||||
{
|
||||
voidZones.push_back(unit);
|
||||
}
|
||||
}
|
||||
|
||||
return voidZones;
|
||||
}
|
||||
|
||||
@@ -302,12 +286,12 @@ bool RaidKarazhanHelpers::IsSafePosition(float x, float y, float z,
|
||||
for (Unit* hazard : hazards)
|
||||
{
|
||||
float dist = std::sqrt(std::pow(x - hazard->GetPositionX(), 2) + std::pow(y - hazard->GetPositionY(), 2));
|
||||
|
||||
if (dist < hazardRadius)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -315,16 +299,15 @@ std::vector<Unit*> RaidKarazhanHelpers::GetSpawnedInfernals() const
|
||||
{
|
||||
std::vector<Unit*> infernals;
|
||||
const GuidVector npcs = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest hostile npcs")->Get();
|
||||
|
||||
for (const auto& npcGuid : npcs)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(npcGuid);
|
||||
|
||||
if (unit && unit->GetEntry() == NPC_NETHERSPITE_INFERNAL)
|
||||
{
|
||||
infernals.push_back(unit);
|
||||
}
|
||||
}
|
||||
|
||||
return infernals;
|
||||
}
|
||||
|
||||
@@ -384,7 +367,6 @@ Position RaidKarazhanHelpers::CalculateArcPoint(const Position& current, const P
|
||||
float dotProduct = currentX * targetX + currentY * targetY;
|
||||
dotProduct = std::max(-1.0f, std::min(1.0f, dotProduct));
|
||||
float angle = std::acos(dotProduct);
|
||||
|
||||
float crossProduct = currentX * targetY - currentY * targetX;
|
||||
float stepAngle = angle * arcFraction;
|
||||
if (crossProduct < 0)
|
||||
@@ -394,10 +376,8 @@ Position RaidKarazhanHelpers::CalculateArcPoint(const Position& current, const P
|
||||
|
||||
float cos_a = std::cos(stepAngle);
|
||||
float sin_a = std::sin(stepAngle);
|
||||
|
||||
float rotatedX = currentX * cos_a - currentY * sin_a;
|
||||
float rotatedY = currentX * sin_a + currentY * cos_a;
|
||||
|
||||
float desiredDist = currentDist * 0.9f + targetDist * 0.1f;
|
||||
|
||||
return Position(center.GetPositionX() + rotatedX * desiredDist,
|
||||
|
||||
@@ -31,6 +31,7 @@ float KarazhanBigBadWolfMultiplier::GetValue(Action* action)
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -81,6 +82,7 @@ float KarazhanShadeOfAranMultiplier::GetValue(Action* action)
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -125,6 +127,7 @@ float KarazhanNetherspiteBlueAndGreenBeamMultiplier::GetValue(Action* action)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (inBeam)
|
||||
{
|
||||
std::vector<Unit*> voidZones = karazhanHelper.GetAllVoidZones();
|
||||
@@ -145,6 +148,7 @@ float KarazhanNetherspiteBlueAndGreenBeamMultiplier::GetValue(Action* action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -208,6 +212,7 @@ float KarazhanNetherspiteRedBeamMultiplier::GetValue(Action* action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -215,13 +220,11 @@ float KarazhanPrinceMalchezaarMultiplier::GetValue(Action* action)
|
||||
{
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "prince malchezaar");
|
||||
|
||||
if (boss && botAI->IsMelee(bot) && bot->HasAura(SPELL_ENFEEBLE))
|
||||
if (boss && botAI->IsMelee(bot) && bot->HasAura(SPELL_ENFEEBLE) &&
|
||||
!dynamic_cast<KarazhanPrinceMalchezaarNonTankAvoidHazardAction*>(action))
|
||||
{
|
||||
if (dynamic_cast<KarazhanPrinceMalchezaarNonTankAvoidHazardAction*>(action))
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user