mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
- Possible loop fix for Call of the Elements (#1649)
This commit is contained in:
@@ -121,9 +121,10 @@ bool SpiritWalkTrigger::IsActive()
|
|||||||
// Fires the trigger if at least 2 of the totem slots are empty or out of range.
|
// Fires the trigger if at least 2 of the totem slots are empty or out of range.
|
||||||
bool CallOfTheElementsTrigger::IsActive()
|
bool CallOfTheElementsTrigger::IsActive()
|
||||||
{
|
{
|
||||||
Player* bot = botAI->GetBot();
|
if (!botAI->CanCastSpell(SPELL_CALL_OF_THE_ELEMENTS, bot, true))
|
||||||
if (!bot->HasSpell(66842))
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int emptyCount = 0;
|
int emptyCount = 0;
|
||||||
static const uint8 slots[] = {SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, SUMMON_SLOT_TOTEM_WATER,
|
static const uint8 slots[] = {SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, SUMMON_SLOT_TOTEM_WATER,
|
||||||
@@ -132,16 +133,32 @@ bool CallOfTheElementsTrigger::IsActive()
|
|||||||
for (uint8 slot : slots)
|
for (uint8 slot : slots)
|
||||||
{
|
{
|
||||||
ObjectGuid guid = bot->m_SummonSlot[slot];
|
ObjectGuid guid = bot->m_SummonSlot[slot];
|
||||||
|
bool possibleEmpty = false;
|
||||||
|
|
||||||
if (guid.IsEmpty())
|
if (guid.IsEmpty())
|
||||||
{
|
{
|
||||||
++emptyCount;
|
possibleEmpty = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Creature* totem = bot->GetMap()->GetCreature(guid);
|
||||||
|
if (!totem || totem->GetDistance(bot) > 30.0f)
|
||||||
|
{
|
||||||
|
possibleEmpty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!possibleEmpty)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* totem = bot->GetMap()->GetCreature(guid);
|
if ((slot == SUMMON_SLOT_TOTEM_EARTH && bot->HasSpell(SPELL_STONESKIN_TOTEM_RANK_1)) ||
|
||||||
if (!totem || totem->GetDistance(bot) > 30.0f)
|
(slot == SUMMON_SLOT_TOTEM_FIRE && bot->HasSpell(SPELL_SEARING_TOTEM_RANK_1)) ||
|
||||||
|
(slot == SUMMON_SLOT_TOTEM_WATER && bot->HasSpell(SPELL_HEALING_STREAM_TOTEM_RANK_1)) ||
|
||||||
|
(slot == SUMMON_SLOT_TOTEM_AIR && bot->HasSpell(SPELL_NATURE_RESISTANCE_TOTEM_RANK_1)))
|
||||||
{
|
{
|
||||||
++emptyCount;
|
emptyCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,37 +208,33 @@ bool TotemicRecallTrigger::IsActive()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_WATER];
|
||||||
|
if (!guid.IsEmpty())
|
||||||
{
|
{
|
||||||
ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_WATER];
|
Creature* totem = bot->GetMap()->GetCreature(guid);
|
||||||
if (!guid.IsEmpty())
|
uint32 currentSpell = 0;
|
||||||
{
|
if (totem)
|
||||||
Creature* totem = bot->GetMap()->GetCreature(guid);
|
currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||||
uint32 currentSpell = 0;
|
|
||||||
if (totem)
|
|
||||||
currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < MANA_TIDE_TOTEM_COUNT; ++i)
|
for (size_t i = 0; i < MANA_TIDE_TOTEM_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (currentSpell == MANA_TIDE_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f)
|
if (currentSpell == MANA_TIDE_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE];
|
||||||
|
if (!guid.IsEmpty())
|
||||||
{
|
{
|
||||||
ObjectGuid guid = bot->m_SummonSlot[SUMMON_SLOT_TOTEM_FIRE];
|
Creature* totem = bot->GetMap()->GetCreature(guid);
|
||||||
if (!guid.IsEmpty())
|
uint32 currentSpell = 0;
|
||||||
{
|
if (totem)
|
||||||
Creature* totem = bot->GetMap()->GetCreature(guid);
|
currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||||
uint32 currentSpell = 0;
|
|
||||||
if (totem)
|
|
||||||
currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < FIRE_ELEMENTAL_TOTEM_COUNT; ++i)
|
for (size_t i = 0; i < FIRE_ELEMENTAL_TOTEM_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (currentSpell == FIRE_ELEMENTAL_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f)
|
if (currentSpell == FIRE_ELEMENTAL_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +422,7 @@ bool NoAirTotemTrigger::IsActive()
|
|||||||
|
|
||||||
bool SetTotemTrigger::IsActive()
|
bool SetTotemTrigger::IsActive()
|
||||||
{
|
{
|
||||||
if (!bot->HasSpell(66842))
|
if (!bot->HasSpell(SPELL_CALL_OF_THE_ELEMENTS))
|
||||||
return false;
|
return false;
|
||||||
if (!bot->HasSpell(requiredSpellId))
|
if (!bot->HasSpell(requiredSpellId))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ const uint32 SPELL_WINDFURY_TOTEM_RANK_1 = 8512;
|
|||||||
const uint32 SPELL_NATURE_RESISTANCE_TOTEM_RANK_1 = 10595;
|
const uint32 SPELL_NATURE_RESISTANCE_TOTEM_RANK_1 = 10595;
|
||||||
const uint32 SPELL_TOTEM_OF_WRATH_RANK_1 = 30706;
|
const uint32 SPELL_TOTEM_OF_WRATH_RANK_1 = 30706;
|
||||||
const uint32 SPELL_TOTEMIC_RECALL = 36936;
|
const uint32 SPELL_TOTEMIC_RECALL = 36936;
|
||||||
|
const uint32 SPELL_CALL_OF_THE_ELEMENTS = 66842;
|
||||||
|
|
||||||
class MainHandWeaponNoImbueTrigger : public BuffTrigger
|
class MainHandWeaponNoImbueTrigger : public BuffTrigger
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user