1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-07-01 11:25:26 +00:00
OpenDiablo2/d2core/d2inventory/inventory_item_armor.go

69 lines
1.8 KiB
Go
Raw Normal View History

package d2inventory
2019-11-15 03:20:01 +00:00
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
2019-11-15 03:20:01 +00:00
)
// InventoryItemArmor stores the info of an armor item in the inventory
2019-11-15 03:20:01 +00:00
type InventoryItemArmor struct {
InventorySizeX int `json:"inventorySizeX"`
InventorySizeY int `json:"inventorySizeY"`
InventorySlotX int `json:"inventorySlotX"`
InventorySlotY int `json:"inventorySlotY"`
ItemName string `json:"itemName"`
ItemCode string `json:"itemCode"`
ArmorClass string `json:"armorClass"`
2019-11-15 03:20:01 +00:00
}
// GetArmorClass returns the class of the armor
func (v *InventoryItemArmor) GetArmorClass() string {
if v == nil || v.ItemCode == "" {
2019-11-15 03:20:01 +00:00
return "lit"
}
return v.ArmorClass
2019-11-15 03:20:01 +00:00
}
// InventoryItemName returns the name of the armor
func (v *InventoryItemArmor) InventoryItemName() string {
if v == nil {
return ""
}
return v.ItemName
2019-11-15 03:20:01 +00:00
}
// InventoryItemType returns the item type of the armor
func (v *InventoryItemArmor) InventoryItemType() d2enum.InventoryItemType {
2019-11-15 03:20:01 +00:00
return d2enum.InventoryItemTypeArmor
}
// InventoryGridSize returns the grid size of the armor
func (v *InventoryItemArmor) InventoryGridSize() (sizeX, sizeY int) {
return v.InventorySizeX, v.InventorySizeY
2019-11-15 03:20:01 +00:00
}
// InventoryGridSlot returns the grid slot coordinates of the armor
func (v *InventoryItemArmor) InventoryGridSlot() (slotX, slotY int) {
return v.InventorySlotX, v.InventorySlotY
}
// SetInventoryGridSlot sets the InventorySlotX and InventorySlotY of the armor with the given x and y values
func (v *InventoryItemArmor) SetInventoryGridSlot(x, y int) {
v.InventorySlotX, v.InventorySlotY = x, y
}
// Serialize returns the armor object as a byte array
func (v *InventoryItemArmor) Serialize() []byte {
2019-11-15 03:20:01 +00:00
return []byte{}
}
// GetItemCode returns the item code of the armor
func (v *InventoryItemArmor) GetItemCode() string {
if v == nil {
return ""
}
return v.ItemCode
2019-11-15 03:20:01 +00:00
}