mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Worldbuff feral druid bear/cat logic (#816)
* Add logic to separate cat and bear druid buffs Check for Thick Hide (16929) talent, use regular buffs if found, use new fourth row if not. * Added cat druid buffs (ArP food, AP flask) * Update playerbots.conf.dist * Refined logic for feral druids * Use rank 3 of Thick Hide and GetActiveSpec * Update WorldBuffAction.cpp * Added DK Blood DPS buffs AP Flask, STR food * Added logic for DPS Blood DKs
This commit is contained in:
@@ -26,36 +26,76 @@ std::vector<uint32> WorldBuffAction::NeedWorldBuffs(Unit* unit)
|
||||
std::vector<uint32> retVec;
|
||||
|
||||
if (sPlayerbotAIConfig->worldBuffs.empty())
|
||||
return std::move(retVec);
|
||||
return retVec;
|
||||
|
||||
FactionTemplateEntry const* humanFaction = sFactionTemplateStore.LookupEntry(1);
|
||||
uint32 factionId =
|
||||
(Unit::GetFactionReactionTo(unit->GetFactionTemplateEntry(), humanFaction) >= REP_NEUTRAL) ? 1 : 2;
|
||||
|
||||
for (auto& wb : sPlayerbotAIConfig->worldBuffs)
|
||||
Player* bot = unit->ToPlayer();
|
||||
if (!bot)
|
||||
return retVec;
|
||||
|
||||
uint8 botClass = bot->getClass();
|
||||
uint8 botLevel = bot->GetLevel();
|
||||
|
||||
uint8 tab = AiFactory::GetPlayerSpecTab(bot);
|
||||
|
||||
// We'll store the final "effective" spec ID here.
|
||||
// For non-Feral druids (and all other classes),
|
||||
// effectiveSpec = tab by default.
|
||||
uint8 effectiveSpec = tab;
|
||||
|
||||
// If this is a druid in the Feral tab, decide Bear vs. Cat
|
||||
if (botClass == CLASS_DRUID && tab == 1) // 1 = feral
|
||||
{
|
||||
bool isBear = bot->HasTalent(16931, bot->GetActiveSpec()); // Thick Hide rank 3
|
||||
if (!isBear)
|
||||
{
|
||||
// If not bear, then treat it as "cat" spec = 3
|
||||
effectiveSpec = 3;
|
||||
}
|
||||
// If bear, effectiveSpec remains 1
|
||||
}
|
||||
|
||||
// If this is a Death Knight in the Blood tab, decide Tank vs. DPS
|
||||
if (botClass == CLASS_DEATH_KNIGHT && tab == 0) // 0 = Blood
|
||||
{
|
||||
bool isTank = bot->HasTalent(55226, bot->GetActiveSpec()); // Blade Barrier rank 5
|
||||
if (!isTank)
|
||||
{
|
||||
// If not tank, then treat it as DPS spec = 3
|
||||
effectiveSpec = 3;
|
||||
}
|
||||
// If tank, effectiveSpec remains unchanged
|
||||
}
|
||||
|
||||
|
||||
for (auto const& wb : sPlayerbotAIConfig->worldBuffs)
|
||||
{
|
||||
// Faction check
|
||||
if (wb.factionId != 0 && wb.factionId != factionId)
|
||||
continue;
|
||||
|
||||
if (wb.classId != 0 && wb.classId != unit->getClass())
|
||||
// Class check
|
||||
if (wb.classId != 0 && wb.classId != botClass)
|
||||
continue;
|
||||
|
||||
uint8 tab = AiFactory::GetPlayerSpecTab(unit->ToPlayer());
|
||||
|
||||
if (wb.specId != tab)
|
||||
// Level check
|
||||
if (wb.minLevel != 0 && wb.minLevel > botLevel)
|
||||
continue;
|
||||
if (wb.maxLevel != 0 && wb.maxLevel < botLevel)
|
||||
continue;
|
||||
|
||||
if (wb.minLevel != 0 && wb.minLevel > unit->GetLevel())
|
||||
// Already has aura?
|
||||
if (bot->HasAura(wb.spellId))
|
||||
continue;
|
||||
|
||||
if (wb.maxLevel != 0 && wb.maxLevel < unit->GetLevel())
|
||||
continue;
|
||||
|
||||
if (unit->HasAura(wb.spellId))
|
||||
continue;
|
||||
|
||||
retVec.push_back(wb.spellId);
|
||||
// Final check: does the world-buff spec ID match our effective spec?
|
||||
if (wb.specId == effectiveSpec)
|
||||
retVec.push_back(wb.spellId);
|
||||
}
|
||||
|
||||
return std::move(retVec);
|
||||
return retVec;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user