fix item wrap not equipable

This commit is contained in:
Eccentric 2024-01-20 23:06:36 +00:00
parent 1c92ed3abd
commit 9f6c57587b

View File

@ -168,7 +168,7 @@ func clientEquipBattleRoyaleCustomizationAction(c *fiber.Ctx, person *p.Person,
} }
} }
attr := profile.Attributes.GetAttributeByKey("favorite_" + strings.ToLower(body.SlotName)) attr := profile.Attributes.GetAttributeByKey("favorite_" + strings.ReplaceAll(strings.ToLower(body.SlotName), "wrap", "wraps"))
if attr == nil { if attr == nil {
return fmt.Errorf("attribute not found") return fmt.Errorf("attribute not found")
} }
@ -180,6 +180,10 @@ func clientEquipBattleRoyaleCustomizationAction(c *fiber.Ctx, person *p.Person,
attr.ValueJSON = aid.JSONStringify(value) attr.ValueJSON = aid.JSONStringify(value)
case "ItemWrap": case "ItemWrap":
value := aid.JSONParse(attr.ValueJSON) value := aid.JSONParse(attr.ValueJSON)
if body.IndexWithinSlot == -1 {
attr.ValueJSON = aid.JSONStringify([]any{item.ID,item.ID,item.ID,item.ID,item.ID,item.ID,item.ID})
break
}
value.([]any)[body.IndexWithinSlot] = item.ID value.([]any)[body.IndexWithinSlot] = item.ID
attr.ValueJSON = aid.JSONStringify(value) attr.ValueJSON = aid.JSONStringify(value)
default: default: