1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00

d2enum: move compositeType.Name method int composite_type.go; lintfix

This commit is contained in:
M. Sz 2021-03-11 09:22:50 +01:00
parent 00bd2c52a0
commit a662bbaeb4
4 changed files with 35 additions and 32 deletions

View File

@ -1,5 +1,9 @@
package d2enum package d2enum
const (
unknown = "Unknown"
)
//go:generate stringer -linecomment -type CompositeType -output composite_type_string.go //go:generate stringer -linecomment -type CompositeType -output composite_type_string.go
// CompositeType represents a composite type // CompositeType represents a composite type
@ -25,3 +29,32 @@ const (
CompositeTypeSpecial8 // S8 CompositeTypeSpecial8 // S8
CompositeTypeMax CompositeTypeMax
) )
// Name returns a full name of layer
func (i CompositeType) Name() string {
strings := map[CompositeType]string{
CompositeTypeHead: "Head",
CompositeTypeTorso: "Torso",
CompositeTypeLegs: "Legs",
CompositeTypeRightArm: "Right Arm",
CompositeTypeLeftArm: "Left Arm",
CompositeTypeRightHand: "Right Hand",
CompositeTypeLeftHand: "Left Hand",
CompositeTypeShield: "Shield",
CompositeTypeSpecial1: "Special 1",
CompositeTypeSpecial2: "Special 2",
CompositeTypeSpecial3: "Special 3",
CompositeTypeSpecial4: "Special 4",
CompositeTypeSpecial5: "Special 5",
CompositeTypeSpecial6: "Special 6",
CompositeTypeSpecial7: "Special 7",
CompositeTypeSpecial8: "Special 8",
}
layerName, found := strings[i]
if !found {
return unknown
}
return layerName
}

View File

@ -37,33 +37,3 @@ func (i CompositeType) String() string {
} }
return _CompositeType_name[_CompositeType_index[i]:_CompositeType_index[i+1]] return _CompositeType_name[_CompositeType_index[i]:_CompositeType_index[i+1]]
} }
// Name returns a full name of layer
func (i CompositeType) Name() string {
strings := map[CompositeType]string{
CompositeTypeHead: "Head",
CompositeTypeTorso: "Torso",
CompositeTypeLegs: "Legs",
CompositeTypeRightArm: "Right Arm",
CompositeTypeLeftArm: "Left Arm",
CompositeTypeRightHand: "Right Hand",
CompositeTypeLeftHand: "Left Hand",
CompositeTypeShield: "Shield",
CompositeTypeSpecial1: "Special 1",
CompositeTypeSpecial2: "Special 2",
CompositeTypeSpecial3: "Special 3",
CompositeTypeSpecial4: "Special 4",
CompositeTypeSpecial5: "Special 5",
CompositeTypeSpecial6: "Special 6",
CompositeTypeSpecial7: "Special 7",
CompositeTypeSpecial8: "Special 8",
}
layerName, found := strings[i]
if !found {
return "Unknown"
}
return layerName
}

View File

@ -61,7 +61,7 @@ func (d DrawEffect) String() string {
drawEffect, found := strings[d] drawEffect, found := strings[d]
if !found { if !found {
return "Unknown" return unknown
} }
return drawEffect return drawEffect

View File

@ -46,7 +46,7 @@ func (w WeaponClass) Name() string {
weaponClass, found := strings[w] weaponClass, found := strings[w]
if !found { if !found {
return "Unknown" return unknown
} }
return weaponClass return weaponClass