mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
TwoRoundsGearInit config option
This commit is contained in:
@@ -216,6 +216,9 @@ AiPlayerbot.AutoEquipUpgradeLoot = 1
|
||||
# Default: 1.1 (Equip when the equipment score is 1.1 times higher than the current)
|
||||
AiPlayerbot.EquipUpgradeThreshold = 1.1
|
||||
|
||||
# Two rounds of equipment initialization to create more suitable gear
|
||||
AiPlayerbot.TwoRoundsGearInit = 0
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@@ -471,6 +471,7 @@ bool PlayerbotAIConfig::Initialize()
|
||||
autoPickReward = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoPickReward", "yes");
|
||||
autoEquipUpgradeLoot = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoEquipUpgradeLoot", true);
|
||||
equipUpgradeThreshold = sConfigMgr->GetOption<float>("AiPlayerbot.EquipUpgradeThreshold", 1.1f);
|
||||
twoRoundsGearInit = sConfigMgr->GetOption<bool>("AiPlayerbot.TwoRoundsGearInit", false);
|
||||
syncQuestWithPlayer = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncQuestWithPlayer", true);
|
||||
syncQuestForPlayer = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncQuestForPlayer", false);
|
||||
autoTrainSpells = sConfigMgr->GetOption<std::string>("AiPlayerbot.AutoTrainSpells", "yes");
|
||||
|
||||
@@ -271,6 +271,7 @@ public:
|
||||
std::string autoPickReward;
|
||||
bool autoEquipUpgradeLoot;
|
||||
float equipUpgradeThreshold;
|
||||
bool twoRoundsGearInit;
|
||||
bool syncQuestWithPlayer;
|
||||
bool syncQuestForPlayer;
|
||||
std::string autoTrainSpells;
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3))
|
||||
|
||||
const uint64 diveMask = (1LL << 7) | (1LL << 44) | (1LL << 37) | (1LL << 38) | (1LL << 26) | (1LL << 30) | (1LL << 27) | (1LL << 33) | (1LL << 24) | (1LL << 34);
|
||||
const uint64 diveMask = (1LL << 7) | (1LL << 44) | (1LL << 37) | (1LL << 38) | (1LL << 26) | (1LL << 30) | (1LL << 27) |
|
||||
(1LL << 33) | (1LL << 24) | (1LL << 34);
|
||||
uint32 PlayerbotFactory::tradeSkills[] = {SKILL_ALCHEMY, SKILL_ENCHANTING, SKILL_SKINNING, SKILL_TAILORING,
|
||||
SKILL_LEATHERWORKING, SKILL_ENGINEERING, SKILL_HERBALISM, SKILL_MINING,
|
||||
SKILL_BLACKSMITHING, SKILL_COOKING, SKILL_FIRST_AID, SKILL_FISHING,
|
||||
@@ -287,7 +288,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
||||
LOG_DEBUG("playerbots", "Initializing equipmemt...");
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
InitEquipment(incremental, incremental ? false : true);
|
||||
InitEquipment(incremental, incremental ? false : sPlayerbotAIConfig->twoRoundsGearInit);
|
||||
}
|
||||
// bot->SaveToDB(false, false);
|
||||
if (pmo)
|
||||
@@ -626,16 +627,19 @@ void PlayerbotFactory::InitPetTalents()
|
||||
// prevent learn talent for different family (cheating)
|
||||
if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
|
||||
continue;
|
||||
bool diveClass = talentInfo->TalentID == 2201 || talentInfo->TalentID == 2208 || talentInfo->TalentID == 2219 || talentInfo->TalentID == 2203;
|
||||
bool diveClass = talentInfo->TalentID == 2201 || talentInfo->TalentID == 2208 || talentInfo->TalentID == 2219 ||
|
||||
talentInfo->TalentID == 2203;
|
||||
if (diveClass && !diveTypePet)
|
||||
continue;
|
||||
bool dashClass = talentInfo->TalentID == 2119 || talentInfo->TalentID == 2207 || talentInfo->TalentID == 2111 || talentInfo->TalentID == 2109;
|
||||
bool dashClass = talentInfo->TalentID == 2119 || talentInfo->TalentID == 2207 || talentInfo->TalentID == 2111 ||
|
||||
talentInfo->TalentID == 2109;
|
||||
if (dashClass && diveTypePet)
|
||||
continue;
|
||||
spells[talentInfo->Row].push_back(talentInfo);
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint32>> order = sPlayerbotAIConfig->parsedHunterPetLinkOrder[pet_family->petTalentType][20];
|
||||
std::vector<std::vector<uint32>> order =
|
||||
sPlayerbotAIConfig->parsedHunterPetLinkOrder[pet_family->petTalentType][20];
|
||||
uint32 maxTalentPoints = pet->GetMaxTalentPointsForLevel(pet->GetLevel());
|
||||
|
||||
if (order.empty())
|
||||
@@ -946,7 +950,8 @@ void PlayerbotFactory::InitTalentsTree(bool increment /*false*/, bool use_templa
|
||||
/// @todo: match current talent with template
|
||||
specTab = AiFactory::GetPlayerSpecTab(bot);
|
||||
/// @todo: fix cat druid hardcode
|
||||
if (bot->getClass() == CLASS_DRUID && specTab == DRUID_TAB_FERAL && bot->GetLevel() >= 20 && !bot->HasAura(16931))
|
||||
if (bot->getClass() == CLASS_DRUID && specTab == DRUID_TAB_FERAL && bot->GetLevel() >= 20 &&
|
||||
!bot->HasAura(16931))
|
||||
specTab = 3;
|
||||
}
|
||||
else
|
||||
@@ -1706,7 +1711,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
|
||||
}
|
||||
// Secondary init for better equips
|
||||
/// @todo: clean up duplicate code
|
||||
if (!incremental && second_chance)
|
||||
if (second_chance)
|
||||
{
|
||||
for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)
|
||||
{
|
||||
@@ -1725,20 +1730,12 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
|
||||
if (level < 20 && (slot == EQUIPMENT_SLOT_FINGER1 || slot == EQUIPMENT_SLOT_FINGER2))
|
||||
continue;
|
||||
|
||||
Item* oldItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
||||
|
||||
if (oldItem)
|
||||
{
|
||||
if (Item* oldItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
bot->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
|
||||
}
|
||||
|
||||
oldItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
||||
|
||||
std::vector<uint32>& ids = items[slot];
|
||||
if (ids.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float bestScoreForSlot = -1;
|
||||
uint32 bestItemForSlot = 0;
|
||||
@@ -1771,25 +1768,6 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (incremental && oldItem)
|
||||
{
|
||||
float old_score = calculator.CalculateItem(oldItem->GetEntry());
|
||||
if (bestScoreForSlot < 1.2f * old_score)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (oldItem)
|
||||
{
|
||||
uint8 bagIndex = oldItem->GetBagSlot();
|
||||
uint8 slot = oldItem->GetSlot();
|
||||
uint8 dstBag = NULL_BAG;
|
||||
|
||||
WorldPacket packet(CMSG_AUTOSTORE_BAG_ITEM, 3);
|
||||
packet << bagIndex << slot << dstBag;
|
||||
bot->GetSession()->HandleAutoStoreBagItemOpcode(packet);
|
||||
}
|
||||
|
||||
Item* newItem = bot->EquipNewItem(dest, bestItemForSlot, true);
|
||||
bot->AutoUnequipOffhandIfNeed();
|
||||
if (newItem)
|
||||
@@ -2810,7 +2788,10 @@ void PlayerbotFactory::InitAmmo()
|
||||
bot->SetAmmo(entry);
|
||||
}
|
||||
|
||||
uint32 PlayerbotFactory::CalcMixedGearScore(uint32 gs, uint32 quality) { return gs * PlayerbotAI::GetItemScoreMultiplier(ItemQualities(quality)); }
|
||||
uint32 PlayerbotFactory::CalcMixedGearScore(uint32 gs, uint32 quality)
|
||||
{
|
||||
return gs * PlayerbotAI::GetItemScoreMultiplier(ItemQualities(quality));
|
||||
}
|
||||
|
||||
void PlayerbotFactory::InitMounts()
|
||||
{
|
||||
@@ -2978,7 +2959,8 @@ std::vector<uint32> PlayerbotFactory::GetCurrentGemsCount()
|
||||
Item* pItem2 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (pItem2 && !pItem2->IsBroken() && pItem2->HasSocket())
|
||||
{
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT;
|
||||
++enchant_slot)
|
||||
{
|
||||
if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
|
||||
continue;
|
||||
@@ -3936,7 +3918,9 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (enchant->requiredSkill && (!bot->HasSkill(enchant->requiredSkill) || (bot->GetSkillValue(enchant->requiredSkill) < enchant->requiredSkillValue)))
|
||||
if (enchant->requiredSkill &&
|
||||
(!bot->HasSkill(enchant->requiredSkill) ||
|
||||
(bot->GetSkillValue(enchant->requiredSkill) < enchant->requiredSkillValue)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user