From adc0d6e72c720374cae267f7ecc4ae2fcd3d463e Mon Sep 17 00:00:00 2001 From: avirar Date: Sun, 29 Dec 2024 01:27:31 +1100 Subject: [PATCH] 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 --- conf/playerbots.conf.dist | 4 +- src/strategy/actions/WorldBuffAction.cpp | 70 +++++++++++++++++++----- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 18d1e527..c6644435 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -1072,6 +1072,7 @@ AiPlayerbot.WorldBuff.0.5.2.80.80 = 53755,57327 #PRIEST SHADOW AiPlayerbot.WorldBuff.0.6.0.80.80 = 53758,57356 #DEATH KNIGHT BLOOD AiPlayerbot.WorldBuff.0.6.1.80.80 = 53760,57358 #DEATH KNIGHT FROST AiPlayerbot.WorldBuff.0.6.2.80.80 = 53760,57358 #DEATH KNIGHT UNHOLY +AiPlayerbot.WorldBuff.0.6.3.80.80 = 53760,57371 #DEATH KNIGHT BLOOD DPS AiPlayerbot.WorldBuff.0.7.0.80.80 = 53755,57327 #SHAMAN ELEMENTAL AiPlayerbot.WorldBuff.0.7.1.80.80 = 53760,57325 #SHAMAN ENHANCEMENT AiPlayerbot.WorldBuff.0.7.2.80.80 = 53755,57327 #SHAMAN RESTORATION @@ -1082,8 +1083,9 @@ AiPlayerbot.WorldBuff.0.9.0.80.80 = 53755,57327 #WARLOCK AFFLICTION AiPlayerbot.WorldBuff.0.9.1.80.80 = 53755,57327 #WARLOCK DEMONOLOGY AiPlayerbot.WorldBuff.0.9.2.80.80 = 53755,57327 #WARLOCK DESTRUCTION AiPlayerbot.WorldBuff.0.11.0.80.80 = 53755,57327 #DRUID BALANCE -AiPlayerbot.WorldBuff.0.11.1.80.80 = 53749,53763,57367 #DRUID FERAL +AiPlayerbot.WorldBuff.0.11.1.80.80 = 53749,53763,57367 #DRUID FERAL BEAR AiPlayerbot.WorldBuff.0.11.2.80.80 = 54212,57334 #DRUID RESTORATION +AiPlayerbot.WorldBuff.0.11.3.80.80 = 53760,57358 #DRUID FERAL CAT # # diff --git a/src/strategy/actions/WorldBuffAction.cpp b/src/strategy/actions/WorldBuffAction.cpp index a21dfc56..6e0c0175 100644 --- a/src/strategy/actions/WorldBuffAction.cpp +++ b/src/strategy/actions/WorldBuffAction.cpp @@ -26,36 +26,76 @@ std::vector WorldBuffAction::NeedWorldBuffs(Unit* unit) std::vector 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; } +