mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
* Addresses #1360 * Additional check, If item exists in bags, don't roll.
This commit is contained in:
parent
db9bcb97ba
commit
9986469042
@ -88,9 +88,16 @@ bool LootRollAction::Execute(Event event)
|
|||||||
else if (sPlayerbotAIConfig->lootRollLevel == 1)
|
else if (sPlayerbotAIConfig->lootRollLevel == 1)
|
||||||
{
|
{
|
||||||
if (vote == NEED)
|
if (vote == NEED)
|
||||||
|
{
|
||||||
|
if (RollUniqueCheck(proto, bot))
|
||||||
|
{
|
||||||
|
vote = PASS;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
vote = GREED;
|
vote = GREED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (vote == GREED)
|
else if (vote == GREED)
|
||||||
{
|
{
|
||||||
vote = PASS;
|
vote = PASS;
|
||||||
@ -196,3 +203,24 @@ bool CanBotUseToken(ItemTemplate const* proto, Player* bot)
|
|||||||
|
|
||||||
return false; // Bot's class cannot use this token
|
return false; // Bot's class cannot use this token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RollUniqueCheck(ItemTemplate const* proto, Player* bot)
|
||||||
|
{
|
||||||
|
// Count the total number of the item (equipped + in bags)
|
||||||
|
uint32 totalItemCount = bot->GetItemCount(proto->ItemId, true);
|
||||||
|
|
||||||
|
// Count the number of the item in bags only
|
||||||
|
uint32 bagItemCount = bot->GetItemCount(proto->ItemId, false);
|
||||||
|
|
||||||
|
// Determine if the unique item is already equipped
|
||||||
|
bool isEquipped = (totalItemCount > bagItemCount);
|
||||||
|
if (isEquipped && proto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
|
||||||
|
{
|
||||||
|
return true; // Unique Item is already equipped
|
||||||
|
}
|
||||||
|
else if (proto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE) && (bagItemCount > 1))
|
||||||
|
{
|
||||||
|
return true; // Unique item already in bag, don't roll for it
|
||||||
|
}
|
||||||
|
return false; // Item is not equipped or in bags, roll for it
|
||||||
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool CanBotUseToken(ItemTemplate const* proto, Player* bot);
|
bool CanBotUseToken(ItemTemplate const* proto, Player* bot);
|
||||||
|
bool RollUniqueCheck(ItemTemplate const* proto, Player* bot);
|
||||||
|
|
||||||
class MasterLootRollAction : public LootRollAction
|
class MasterLootRollAction : public LootRollAction
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user