mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Item Usage and Loot Roll (#1059)
* Better Disenchant and final AH usage * CalculateRollVote instead of just needing on items allowed by StoreLootAction::IsLootAllowed
This commit is contained in:
@@ -66,7 +66,7 @@ bool LootRollAction::Execute(Event event)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (StoreLootAction::IsLootAllowed(itemId, botAI))
|
if (StoreLootAction::IsLootAllowed(itemId, botAI))
|
||||||
vote = NEED;
|
vote = CalculateRollVote(proto); // Ensure correct Need/Greed behavior
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,10 +92,25 @@ ItemUsage ItemUsageValue::Calculate()
|
|||||||
if (equip != ITEM_USAGE_NONE)
|
if (equip != ITEM_USAGE_NONE)
|
||||||
return equip;
|
return equip;
|
||||||
|
|
||||||
|
// Get item instance to check if it's soulbound
|
||||||
|
Item* item = bot->GetItemByEntry(proto->ItemId);
|
||||||
|
bool isSoulbound = item && item->IsSoulBound();
|
||||||
|
|
||||||
if ((proto->Class == ITEM_CLASS_ARMOR || proto->Class == ITEM_CLASS_WEAPON) &&
|
if ((proto->Class == ITEM_CLASS_ARMOR || proto->Class == ITEM_CLASS_WEAPON) &&
|
||||||
proto->Bonding != BIND_WHEN_PICKED_UP && botAI->HasSkill(SKILL_ENCHANTING) &&
|
botAI->HasSkill(SKILL_ENCHANTING) &&
|
||||||
proto->Quality >= ITEM_QUALITY_UNCOMMON)
|
proto->Quality >= ITEM_QUALITY_UNCOMMON)
|
||||||
return ITEM_USAGE_DISENCHANT;
|
{
|
||||||
|
// Retrieve the bot's Enchanting skill level
|
||||||
|
uint32 enchantingSkill = bot->GetSkillValue(SKILL_ENCHANTING);
|
||||||
|
|
||||||
|
// Check if the bot has a high enough skill to disenchant this item
|
||||||
|
if (proto->RequiredDisenchantSkill > 0 && enchantingSkill < proto->RequiredDisenchantSkill)
|
||||||
|
return ITEM_USAGE_NONE; // Not skilled enough to disenchant
|
||||||
|
|
||||||
|
// BoE (Bind on Equip) items should NOT be disenchanted unless they are already bound
|
||||||
|
if (proto->Bonding == BIND_WHEN_PICKED_UP || (proto->Bonding == BIND_WHEN_EQUIPPED && isSoulbound))
|
||||||
|
return ITEM_USAGE_DISENCHANT;
|
||||||
|
}
|
||||||
|
|
||||||
// While sync is on, do not loot quest items that are also Useful for master. Master
|
// While sync is on, do not loot quest items that are also Useful for master. Master
|
||||||
if (!botAI->GetMaster() || !sPlayerbotAIConfig->syncQuestWithPlayer ||
|
if (!botAI->GetMaster() || !sPlayerbotAIConfig->syncQuestWithPlayer ||
|
||||||
@@ -169,7 +184,7 @@ ItemUsage ItemUsageValue::Calculate()
|
|||||||
// Need to add something like free bagspace or item value.
|
// Need to add something like free bagspace or item value.
|
||||||
if (proto->SellPrice > 0)
|
if (proto->SellPrice > 0)
|
||||||
{
|
{
|
||||||
if (proto->Quality > ITEM_QUALITY_NORMAL)
|
if (proto->Quality >= ITEM_QUALITY_NORMAL && !isSoulbound)
|
||||||
{
|
{
|
||||||
return ITEM_USAGE_AH;
|
return ITEM_USAGE_AH;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user