mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-17 18:06:03 -05:00
Merge pull request #1090 from gucio321/hotfix4
d2enum: String and full name methods
This commit is contained in:
commit
98e13a706a
@ -1,5 +1,9 @@
|
||||
package d2enum
|
||||
|
||||
const (
|
||||
unknown = "Unknown"
|
||||
)
|
||||
|
||||
//go:generate stringer -linecomment -type CompositeType -output composite_type_string.go
|
||||
|
||||
// CompositeType represents a composite type
|
||||
@ -25,3 +29,32 @@ const (
|
||||
CompositeTypeSpecial8 // S8
|
||||
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
|
||||
}
|
||||
|
@ -37,7 +37,3 @@ func (i CompositeType) String() string {
|
||||
}
|
||||
return _CompositeType_name[_CompositeType_index[i]:_CompositeType_index[i+1]]
|
||||
}
|
||||
|
||||
func (i CompositeType) Int() int {
|
||||
return int(i)
|
||||
}
|
||||
|
@ -45,3 +45,24 @@ const (
|
||||
func (d DrawEffect) Transparent() bool {
|
||||
return d != DrawEffectNone
|
||||
}
|
||||
|
||||
func (d DrawEffect) String() string {
|
||||
strings := map[DrawEffect]string{
|
||||
DrawEffectPctTransparency25: "25% alpha",
|
||||
DrawEffectPctTransparency50: "50% alpha",
|
||||
DrawEffectPctTransparency75: "75% alpha",
|
||||
DrawEffectModulate: "Modulate",
|
||||
DrawEffectBurn: "Burn",
|
||||
DrawEffectNormal: "Normal",
|
||||
DrawEffectMod2XTrans: "Mod2XTrans",
|
||||
DrawEffectMod2X: "Mod2X",
|
||||
DrawEffectNone: "None",
|
||||
}
|
||||
|
||||
drawEffect, found := strings[d]
|
||||
if !found {
|
||||
return unknown
|
||||
}
|
||||
|
||||
return drawEffect
|
||||
}
|
||||
|
@ -24,3 +24,31 @@ const (
|
||||
WeaponClassOneHandToHand // ht1
|
||||
WeaponClassTwoHandToHand // ht2
|
||||
)
|
||||
|
||||
// Name returns a full name of weapon class
|
||||
func (w WeaponClass) Name() string {
|
||||
strings := map[WeaponClass]string{
|
||||
WeaponClassNone: "None",
|
||||
WeaponClassHandToHand: "Hand To Hand",
|
||||
WeaponClassBow: "Bow",
|
||||
WeaponClassOneHandSwing: "One Hand Swing",
|
||||
WeaponClassOneHandThrust: "One Hand Thrust",
|
||||
WeaponClassStaff: "Staff",
|
||||
WeaponClassTwoHandSwing: "Two Hand Swing",
|
||||
WeaponClassTwoHandThrust: "Two Hand Thrust",
|
||||
WeaponClassCrossbow: "Crossbow",
|
||||
WeaponClassLeftJabRightSwing: "Left Jab Right Swing",
|
||||
WeaponClassLeftJabRightThrust: "Left Jab Right Thrust",
|
||||
WeaponClassLeftSwingRightSwing: "Left Swing Right Swing",
|
||||
WeaponClassLeftSwingRightThrust: "Left Swing Right Thrust",
|
||||
WeaponClassOneHandToHand: "One Hand To Hand",
|
||||
WeaponClassTwoHandToHand: "Two Hand To Hand",
|
||||
}
|
||||
|
||||
weaponClass, found := strings[w]
|
||||
if !found {
|
||||
return unknown
|
||||
}
|
||||
|
||||
return weaponClass
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ func (c *COF) Marshal() []byte {
|
||||
sw.PushBytes(c.unknownBodyBytes...)
|
||||
|
||||
for i := range c.CofLayers {
|
||||
sw.PushBytes(byte(c.CofLayers[i].Type.Int()))
|
||||
sw.PushBytes(byte(c.CofLayers[i].Type))
|
||||
sw.PushBytes(c.CofLayers[i].Shadow)
|
||||
|
||||
if c.CofLayers[i].Selectable {
|
||||
|
Loading…
Reference in New Issue
Block a user