Misc fixes

This commit is contained in:
hondacrx
2017-09-06 12:00:21 -04:00
parent 38b6c72499
commit 36a74cf873
18 changed files with 161 additions and 312 deletions
+24 -2
View File
@@ -5315,7 +5315,9 @@ namespace Game.Entities
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
// there is an equip limit on this item
if (HasItemOrGemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitEntry.Quantity - limit_count + 1, except_slot))
if (HasItemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitEntry.Quantity - limit_count + 1, except_slot))
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
else if (HasGemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitEntry.Quantity - limit_count + 1, except_slot))
return InventoryResult.ItemMaxCountEquippedSocketed;
}
@@ -5484,7 +5486,7 @@ namespace Game.Entities
return false;
}
bool HasItemOrGemWithLimitCategoryEquipped(uint limitCategory, uint count, byte except_slot)
bool HasItemWithLimitCategoryEquipped(uint limitCategory, uint count, byte except_slot)
{
uint tempcount = 0;
for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i)
@@ -5506,6 +5508,26 @@ namespace Game.Entities
if (tempcount >= count)
return true;
}
}
return false;
}
bool HasGemWithLimitCategoryEquipped(uint limitCategory, uint count, byte except_slot)
{
uint tempcount = 0;
for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i)
{
if (i == except_slot)
continue;
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (!pItem)
continue;
ItemTemplate pProto = pItem.GetTemplate();
if (pProto == null)
continue;
if (pItem.GetSocketColor(0) != 0 || pItem.GetEnchantmentId(EnchantmentSlot.Prismatic) != 0)
{