This commit is contained in:
Yunfan Li
2023-08-28 17:29:14 +08:00
parent 1136b7bfdc
commit 9efec9b325
8 changed files with 39 additions and 30 deletions

View File

@@ -78,7 +78,7 @@ ItemUsage ItemUsageValue::Calculate()
}
}
}
if (bot->GetGuildId() && sGuildTaskMgr->IsGuildTaskItem(itemId, bot->GetGuildId()))
return ITEM_USAGE_GUILD_TASK;
@@ -202,13 +202,13 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto)
return ITEM_USAGE_BAD_EQUIP;
ItemTemplate const* oldItemProto = oldItem->GetTemplate();
float oldScore = PlayerbotFactory::CalculateItemScore(oldItemProto->ItemId, bot);
if (oldItem)
{
// uint32 oldStatWeight = sRandomItemMgr->GetLiveStatWeight(bot, oldItemProto->ItemId);
float oldScore = PlayerbotFactory::CalculateItemScore(oldItemProto->ItemId, bot);
if (itemScore || oldScore)
{
shouldEquip = itemScore >= oldScore * 1.5;
shouldEquip = itemScore > oldScore * 1.1;
}
}
@@ -226,17 +226,17 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto)
if (oldItemProto->Class == ITEM_CLASS_ARMOR && !sRandomItemMgr->CanEquipArmor(bot->getClass(), bot->getLevel(), oldItemProto))
existingShouldEquip = false;
uint32 oldItemPower = sRandomItemMgr->GetLiveStatWeight(bot, oldItemProto->ItemId);
uint32 newItemPower = sRandomItemMgr->GetLiveStatWeight(bot, itemProto->ItemId);
// uint32 oldItemPower = sRandomItemMgr->GetLiveStatWeight(bot, oldItemProto->ItemId);
// uint32 newItemPower = sRandomItemMgr->GetLiveStatWeight(bot, itemProto->ItemId);
//Compare items based on item level, quality or itemId.
bool isBetter = false;
if (newItemPower > oldItemPower)
isBetter = true;
else if (newItemPower == oldItemPower && itemProto->Quality > oldItemProto->Quality)
isBetter = true;
else if (newItemPower == oldItemPower && itemProto->Quality == oldItemProto->Quality && itemProto->ItemId > oldItemProto->ItemId)
if (itemScore > oldScore)
isBetter = true;
// else if (newItemPower == oldScore && itemProto->Quality > oldItemProto->Quality)
// isBetter = true;
// else if (newItemPower == oldScore && itemProto->Quality == oldItemProto->Quality && itemProto->ItemId > oldItemProto->ItemId)
// isBetter = true;
Item* item = CurrentItem(itemProto);
bool itemIsBroken = item && item->GetUInt32Value(ITEM_FIELD_DURABILITY) == 0 && item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0;