1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-17 18:06:03 -05:00

d2enum: weapon class: Name method

This commit is contained in:
M. Sz 2021-03-11 09:11:54 +01:00
parent 36f356d0c3
commit 00bd2c52a0
2 changed files with 48 additions and 0 deletions

View File

@ -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
}

View File

@ -24,3 +24,30 @@ const (
WeaponClassOneHandToHand // ht1
WeaponClassTwoHandToHand // ht2
)
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
}