randombot refresh

This commit is contained in:
Yunfan Li
2023-08-07 23:34:05 +08:00
parent 7d26647b4b
commit 1381a4b809
6 changed files with 29 additions and 13 deletions

View File

@@ -337,10 +337,11 @@ void PlayerbotFactory::Refresh()
InitAmmo(); InitAmmo();
InitFood(); InitFood();
InitReagents(); InitReagents();
InitPotions(); // InitPotions();
InitTalents(true); InitTalentsTree(true);
InitClassSpells(); InitClassSpells();
InitAvailableSpells(); InitAvailableSpells();
InitSkills();
bot->DurabilityRepairAll(false, 1.0f, false); bot->DurabilityRepairAll(false, 1.0f, false);
if (bot->isDead()) if (bot->isDead())
bot->ResurrectPlayer(1.0f, false); bot->ResurrectPlayer(1.0f, false);
@@ -2144,6 +2145,9 @@ void PlayerbotFactory::InitAmmo()
case ITEM_SUBCLASS_WEAPON_CROSSBOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW:
subClass = ITEM_SUBCLASS_ARROW; subClass = ITEM_SUBCLASS_ARROW;
break; break;
case ITEM_SUBCLASS_WEAPON_THROWN:
subClass = ITEM_SUBCLASS_THROWN;
break;
} }
if (!subClass) if (!subClass)
@@ -2292,6 +2296,9 @@ void PlayerbotFactory::InitPotions()
void PlayerbotFactory::InitFood() void PlayerbotFactory::InitFood()
{ {
if (sPlayerbotAIConfig->freeFood) {
return;
}
std::map<uint32, std::vector<uint32> > items; std::map<uint32, std::vector<uint32> > items;
ItemTemplateContainer const* itemTemplateContainer = sObjectMgr->GetItemTemplateStore(); ItemTemplateContainer const* itemTemplateContainer = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator i = itemTemplateContainer->begin(); i != itemTemplateContainer->end(); ++i) for (ItemTemplateContainer::const_iterator i = itemTemplateContainer->begin(); i != itemTemplateContainer->end(); ++i)
@@ -2961,6 +2968,7 @@ float PlayerbotFactory::CalculateItemScore(uint32 item_id, Player* bot)
{ {
score *= 0.8; score *= 0.8;
} }
// double hand
if (proto->Class == ITEM_CLASS_WEAPON) { if (proto->Class == ITEM_CLASS_WEAPON) {
bool isDoubleHand = proto->Class == ITEM_CLASS_WEAPON && bool isDoubleHand = proto->Class == ITEM_CLASS_WEAPON &&
!(ITEM_SUBCLASS_MASK_SINGLE_HAND & (1 << proto->SubClass)) && !(ITEM_SUBCLASS_MASK_SINGLE_HAND & (1 << proto->SubClass)) &&
@@ -2990,6 +2998,11 @@ float PlayerbotFactory::CalculateItemScore(uint32 item_id, Player* bot)
score *= 10; score *= 10;
} }
} }
if (proto->Class == ITEM_CLASS_WEAPON) {
if (cls == CLASS_HUNTER && proto->SubClass == ITEM_SUBCLASS_WEAPON_THROWN) {
score *= 0.1;
}
}
return (0.01 + score) * itemLevel * (quality + 1); return (0.01 + score) * itemLevel * (quality + 1);
// return score; // return score;
} }

View File

@@ -2179,7 +2179,7 @@ void RandomItemMgr::BuildAmmoCache()
uint32 counter = 0; uint32 counter = 0;
for (uint32 level = 1; level <= maxLevel; level += 1) for (uint32 level = 1; level <= maxLevel; level += 1)
{ {
for (uint32 subClass = ITEM_SUBCLASS_ARROW; subClass <= ITEM_SUBCLASS_BULLET; subClass++) for (uint32 subClass = ITEM_SUBCLASS_ARROW; subClass <= ITEM_SUBCLASS_THROWN; subClass++)
{ {
QueryResult results = WorldDatabase.Query("SELECT entry FROM item_template WHERE class = {} AND subclass = {} AND RequiredLevel <= {} " QueryResult results = WorldDatabase.Query("SELECT entry FROM item_template WHERE class = {} AND subclass = {} AND RequiredLevel <= {} "
"ORDER BY RequiredLevel DESC", ITEM_CLASS_PROJECTILE, subClass, level); "ORDER BY RequiredLevel DESC", ITEM_CLASS_PROJECTILE, subClass, level);

View File

@@ -833,8 +833,8 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
} }
} }
if (botAI->HasPlayerNearby(sPlayerbotAIConfig->grindDistance)) // if (botAI->HasPlayerNearby(sPlayerbotAIConfig->grindDistance))
update = false; // update = false;
} }
if (update) if (update)
@@ -1428,8 +1428,8 @@ void RandomPlayerbotMgr::Refresh(Player* bot)
botAI->ResetStrategies(false); botAI->ResetStrategies(false);
} }
if (sPlayerbotAIConfig->disableRandomLevels) // if (sPlayerbotAIConfig->disableRandomLevels)
return; // return;
if (bot->InBattleground()) if (bot->InBattleground())
return; return;
@@ -1472,9 +1472,6 @@ bool RandomPlayerbotMgr::IsRandomBot(Player* bot)
} }
if (bot) if (bot)
{ {
if (sPlayerbotAIConfig->IsInRandomAccountList(bot->GetSession()->GetAccountId()))
return true;
return IsRandomBot(bot->GetGUID().GetCounter()); return IsRandomBot(bot->GetGUID().GetCounter());
} }

View File

@@ -21,4 +21,5 @@ void AutoTeleportForLevelAction::AutoUpgradeEquip() {
} }
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE); PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
factory.InitEquipment(true); factory.InitEquipment(true);
factory.InitSkills();
} }

View File

@@ -30,8 +30,9 @@ void HealDruidStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member critical health", "party member critical health",
NextAction::array(0, NextAction::array(0,
new NextAction("swiftmend on party", ACTION_CRITICAL_HEAL + 3), new NextAction("swiftmend on party", ACTION_CRITICAL_HEAL + 4),
new NextAction("wild growth", ACTION_CRITICAL_HEAL + 2), new NextAction("wild growth", ACTION_CRITICAL_HEAL + 3),
new NextAction("regrowth on party", ACTION_CRITICAL_HEAL + 2),
new NextAction("nourish on party", ACTION_CRITICAL_HEAL + 1), new NextAction("nourish on party", ACTION_CRITICAL_HEAL + 1),
new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 0), new NextAction("healing touch on party", ACTION_CRITICAL_HEAL + 0),
NULL))); NULL)));

View File

@@ -97,6 +97,10 @@ Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount)
if (CreatureTemplate->rank > CREATURE_ELITE_NORMAL && !AI_VALUE(bool, "can fight elite")) if (CreatureTemplate->rank > CREATURE_ELITE_NORMAL && !AI_VALUE(bool, "can fight elite"))
continue; continue;
if (!bot->IsWithinLOSInMap(unit)) {
continue;
}
if (group) if (group)
{ {
Group::MemberSlotList const& groupSlot = group->GetMemberSlots(); Group::MemberSlotList const& groupSlot = group->GetMemberSlots();