mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Limit JC jeweler's gems to 3
If bot has jewelcrafting, enforce limit of 3 of any type of jeweler's gems when autogearing/gemming
This commit is contained in:
@@ -3853,6 +3853,7 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
int32 bestGemEnchantId[4] = {-1, -1, -1, -1}; // 1, 2, 4, 8 color
|
int32 bestGemEnchantId[4] = {-1, -1, -1, -1}; // 1, 2, 4, 8 color
|
||||||
float bestGemScore[4] = {0, 0, 0, 0};
|
float bestGemScore[4] = {0, 0, 0, 0};
|
||||||
std::vector<uint32> curCount = GetCurrentGemsCount();
|
std::vector<uint32> curCount = GetCurrentGemsCount();
|
||||||
|
uint8 jewelersCount = 0;
|
||||||
int requiredActive = bot->GetLevel() <= 70 ? 2 : 1;
|
int requiredActive = bot->GetLevel() <= 70 ? 2 : 1;
|
||||||
std::vector<uint32> availableGems;
|
std::vector<uint32> availableGems;
|
||||||
for (const uint32& enchantGem : enchantGemIdCache)
|
for (const uint32& enchantGem : enchantGemIdCache)
|
||||||
@@ -3982,6 +3983,7 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
}
|
}
|
||||||
int32 enchantIdChosen = -1;
|
int32 enchantIdChosen = -1;
|
||||||
int32 colorChosen;
|
int32 colorChosen;
|
||||||
|
bool jewelersGemChosen;
|
||||||
float bestGemScore = -1;
|
float bestGemScore = -1;
|
||||||
for (uint32& enchantGem : availableGems)
|
for (uint32& enchantGem : availableGems)
|
||||||
{
|
{
|
||||||
@@ -3989,6 +3991,11 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
if (!gemTemplate)
|
if (!gemTemplate)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Limit jewelers (JC) epic gems to 3
|
||||||
|
bool isJewelersGem = gemTemplate->ItemLimitCategory == 2;
|
||||||
|
if (isJewelersGem && jewelersCount >= 3)
|
||||||
|
continue;
|
||||||
|
|
||||||
const GemPropertiesEntry* gemProperties = sGemPropertiesStore.LookupEntry(gemTemplate->GemProperties);
|
const GemPropertiesEntry* gemProperties = sGemPropertiesStore.LookupEntry(gemTemplate->GemProperties);
|
||||||
if (!gemProperties)
|
if (!gemProperties)
|
||||||
continue;
|
continue;
|
||||||
@@ -4022,6 +4029,7 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
enchantIdChosen = enchant_id;
|
enchantIdChosen = enchant_id;
|
||||||
colorChosen = gemProperties->color;
|
colorChosen = gemProperties->color;
|
||||||
bestGemScore = score;
|
bestGemScore = score;
|
||||||
|
jewelersGemChosen = isJewelersGem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enchantIdChosen == -1)
|
if (enchantIdChosen == -1)
|
||||||
@@ -4030,6 +4038,8 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
item->SetEnchantment(EnchantmentSlot(enchant_slot), enchantIdChosen, 0, 0, bot->GetGUID());
|
item->SetEnchantment(EnchantmentSlot(enchant_slot), enchantIdChosen, 0, 0, bot->GetGUID());
|
||||||
bot->ApplyEnchantment(item, EnchantmentSlot(enchant_slot), true);
|
bot->ApplyEnchantment(item, EnchantmentSlot(enchant_slot), true);
|
||||||
curCount = GetCurrentGemsCount();
|
curCount = GetCurrentGemsCount();
|
||||||
|
if (jewelersGemChosen)
|
||||||
|
++jewelersCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user