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();
InitFood();
InitReagents();
InitPotions();
InitTalents(true);
// InitPotions();
InitTalentsTree(true);
InitClassSpells();
InitAvailableSpells();
InitSkills();
bot->DurabilityRepairAll(false, 1.0f, false);
if (bot->isDead())
bot->ResurrectPlayer(1.0f, false);
@@ -2144,6 +2145,9 @@ void PlayerbotFactory::InitAmmo()
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
subClass = ITEM_SUBCLASS_ARROW;
break;
case ITEM_SUBCLASS_WEAPON_THROWN:
subClass = ITEM_SUBCLASS_THROWN;
break;
}
if (!subClass)
@@ -2292,6 +2296,9 @@ void PlayerbotFactory::InitPotions()
void PlayerbotFactory::InitFood()
{
if (sPlayerbotAIConfig->freeFood) {
return;
}
std::map<uint32, std::vector<uint32> > items;
ItemTemplateContainer const* itemTemplateContainer = sObjectMgr->GetItemTemplateStore();
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;
}
// double hand
if (proto->Class == ITEM_CLASS_WEAPON) {
bool isDoubleHand = proto->Class == ITEM_CLASS_WEAPON &&
!(ITEM_SUBCLASS_MASK_SINGLE_HAND & (1 << proto->SubClass)) &&
@@ -2990,6 +2998,11 @@ float PlayerbotFactory::CalculateItemScore(uint32 item_id, Player* bot)
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 score;
}

View File

@@ -2179,7 +2179,7 @@ void RandomItemMgr::BuildAmmoCache()
uint32 counter = 0;
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 <= {} "
"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))
update = false;
// if (botAI->HasPlayerNearby(sPlayerbotAIConfig->grindDistance))
// update = false;
}
if (update)
@@ -1428,8 +1428,8 @@ void RandomPlayerbotMgr::Refresh(Player* bot)
botAI->ResetStrategies(false);
}
if (sPlayerbotAIConfig->disableRandomLevels)
return;
// if (sPlayerbotAIConfig->disableRandomLevels)
// return;
if (bot->InBattleground())
return;
@@ -1472,9 +1472,6 @@ bool RandomPlayerbotMgr::IsRandomBot(Player* bot)
}
if (bot)
{
if (sPlayerbotAIConfig->IsInRandomAccountList(bot->GetSession()->GetAccountId()))
return true;
return IsRandomBot(bot->GetGUID().GetCounter());
}

View File

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

View File

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

View File

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