Fix missing ivtr equipable item

This commit is contained in:
hungdk
2025-09-28 22:07:11 +07:00
parent fbe413e9c2
commit ca193b1a5a
@@ -91,6 +91,20 @@ namespace PerfectWorld.Scripts.Managers
}
}
// Decoration -> derive from sub-type mask (neck, waist, etc.)
foreach (var it in edm.decoration_essence_array)
{
if (it.id == id)
{
var slot = ResolveDecorationSlotBySubtype(edm, it.id_sub_type);
if (slot < IndexOfIteminEquipmentInventory.SIZE_EQUIPIVTR)
{
return (byte)slot;
}
break;
}
}
// Fashion -> derive from sub-type mask
foreach (var it in edm.fashion_essence_array)
{
@@ -165,7 +179,6 @@ namespace PerfectWorld.Scripts.Managers
if (sub.id != armorSubTypeId) continue;
uint mask = sub.equip_mask;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_HEAD)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_HEAD;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_NECK)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_NECK;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_SHOULDER)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_SHOULDER;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_BODY)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_BODY;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_WAIST)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_WAIST;
@@ -179,6 +192,22 @@ namespace PerfectWorld.Scripts.Managers
return IndexOfIteminEquipmentInventory.SIZE_EQUIPIVTR;
}
private static IndexOfIteminEquipmentInventory ResolveDecorationSlotBySubtype(elementdataman edm, uint decorationSubTypeId)
{
foreach (var sub in edm.decoration_sub_type_array)
{
if (sub.id != decorationSubTypeId) continue;
uint mask = sub.equip_mask;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_NECK)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_NECK;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_WAIST)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_WAIST;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_FINGER1)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_FINGER1;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_FINGER2)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_FINGER2;
if ((mask & (1u << (int)IndexOfIteminEquipmentInventory.EQUIPIVTR_WRIST)) != 0) return IndexOfIteminEquipmentInventory.EQUIPIVTR_WRIST;
break;
}
return IndexOfIteminEquipmentInventory.SIZE_EQUIPIVTR;
}
private static IndexOfIteminEquipmentInventory ResolveFashionSlotBySubtype(elementdataman edm, uint fashionSubTypeId)
{
foreach (var sub in edm.fashion_sub_type_array)