|
@@ -58,11 +58,11 @@ LOGIN:
|
|
|
}
|
|
|
d.WriteS(door.Reset + door.CRNL)
|
|
|
bb := door.ColorTextS("BRI BLA ON BLA")
|
|
|
- d.WriteS(bb + "[" + door.ColorTextS("BRI CYA ON BLA") + "K" + bb + "] " + door.ColorTextS("CYA ON BLA") + "Knight" + door.Reset + door.CRNL)
|
|
|
- d.WriteS(bb + "[" + door.ColorTextS("BRO ON BLA") + "T" + bb + "] " + door.ColorTextS("BRO ON BLA") + "Thief" + door.Reset + door.CRNL)
|
|
|
- d.WriteS(bb + "[" + door.ColorTextS("BRI GRE ON BLA") + "C" + bb + "] " + door.ColorTextS("GRE ON BLA") + "Cleric" + door.Reset + door.CRNL)
|
|
|
- d.WriteS(bb + "[" + door.ColorTextS("BRI MAG ON BLA") + "W" + bb + "] " + door.ColorTextS("MAG ON BLA") + "Wizard" + door.Reset + door.CRNL)
|
|
|
- d.WriteS(bb + "[" + door.ColorTextS("BRI RED ON BLA") + "R" + bb + "] " + door.ColorTextS("RED ON BLA") + "Ranger" + door.Reset + door.CRNL)
|
|
|
+ d.WriteS(bb + "[" + door.ColorTextS(C_KNIGHT.ColorText()) + "K" + bb + "] " + door.ColorTextS(C_KNIGHT.ColorText()) + C_KNIGHT.Name() + door.Reset + door.CRNL)
|
|
|
+ d.WriteS(bb + "[" + door.ColorTextS(C_THIEF.ColorText()) + "T" + bb + "] " + door.ColorTextS(C_THIEF.ColorText()) + C_THIEF.Name() + door.Reset + door.CRNL)
|
|
|
+ d.WriteS(bb + "[" + door.ColorTextS(C_CLERIC.ColorText()) + "C" + bb + "] " + door.ColorTextS(C_CLERIC.ColorText()) + C_CLERIC.Name() + door.Reset + door.CRNL)
|
|
|
+ d.WriteS(bb + "[" + door.ColorTextS(C_WIZARD.ColorText()) + "W" + bb + "] " + door.ColorTextS(C_WIZARD.ColorText()) + C_WIZARD.Name() + door.Reset + door.CRNL)
|
|
|
+ d.WriteS(bb + "[" + door.ColorTextS(C_RANGER.ColorText()) + "R" + bb + "] " + door.ColorTextS(C_RANGER.ColorText()) + C_RANGER.Name() + door.Reset + door.CRNL)
|
|
|
r, _, err := d.WaitKey(door.Inactivity)
|
|
|
if err != nil {
|
|
|
if errors.Is(err, door.ErrDisconnected) {
|
|
@@ -72,35 +72,35 @@ LOGIN:
|
|
|
}
|
|
|
switch r {
|
|
|
case 'k', 'K':
|
|
|
- u.Class = 1
|
|
|
+ u.Class = C_KNIGHT
|
|
|
u.Health = 30
|
|
|
u.MaxHealth = 30
|
|
|
u.MaxMagic = 0
|
|
|
u.Magic = 0
|
|
|
u.Gold = 200
|
|
|
case 't', 'T':
|
|
|
- u.Class = 2
|
|
|
+ u.Class = C_THIEF
|
|
|
u.Health = 20
|
|
|
u.MaxHealth = 20
|
|
|
u.MaxMagic = 0
|
|
|
u.Magic = 0
|
|
|
u.Gold = 250
|
|
|
case 'c', 'C':
|
|
|
- u.Class = 3
|
|
|
+ u.Class = C_CLERIC
|
|
|
u.Health = 25
|
|
|
u.MaxHealth = 25
|
|
|
u.MaxMagic = 7
|
|
|
u.Magic = 7
|
|
|
u.Gold = 200
|
|
|
case 'w', 'W':
|
|
|
- u.Class = 4
|
|
|
+ u.Class = C_WIZARD
|
|
|
u.Health = 20
|
|
|
u.MaxHealth = 20
|
|
|
u.MaxMagic = 12
|
|
|
u.Magic = 12
|
|
|
u.Gold = 200
|
|
|
case 'r', 'R':
|
|
|
- u.Class = 5
|
|
|
+ u.Class = C_RANGER
|
|
|
u.Health = 20
|
|
|
u.MaxHealth = 20
|
|
|
u.MaxMagic = 0
|
|
@@ -139,26 +139,19 @@ LOGIN:
|
|
|
}
|
|
|
}
|
|
|
d.WriteS(door.ColorTextS("BRI CYA ON BLA") + "Welcome " + door.ColorTextS("BRI WHI ON BLA") + u.Name + door.ColorTextS("BRI CYA ON BLA") + " the ")
|
|
|
- switch u.Class {
|
|
|
- case 1:
|
|
|
- d.WriteS(door.ColorTextS("CYA ON BLA") + "Knight")
|
|
|
- case 2:
|
|
|
- d.WriteS(door.ColorTextS("BRO ON BLA") + "Thief")
|
|
|
- case 3:
|
|
|
- d.WriteS(door.ColorTextS("GRE ON BLA") + "Cleric")
|
|
|
- case 4:
|
|
|
- d.WriteS(door.ColorTextS("MAG ON BLA") + "Wizard")
|
|
|
- case 5:
|
|
|
- d.WriteS(door.ColorTextS("RED ON BLA") + "Ranger")
|
|
|
- default:
|
|
|
- d.WriteS(door.ColorTextS("BLI BRI RED ON BLA") + "Unknown")
|
|
|
- }
|
|
|
+ d.WriteS(door.ColorTextS(u.Class.ColorText()) + u.Class.Name())
|
|
|
d.WriteS(door.Reset + door.CRNL)
|
|
|
- go renderStatusBar()
|
|
|
+ go renderStatusBar("Hello "+u.Name, time.Now().Format("Jan 02 2006 @ 03:04:05PM"))
|
|
|
+ d.WriteS(fmt.Sprintf("Weapon: %s with %s enchantment", u.Weapon.Name(), u.WeaponEnchant.Name()) + door.CRNL)
|
|
|
+ d.WriteS(fmt.Sprintf("Armor: %s with %s enchantment", u.Armor.Name(), u.ArmorEnchant.Name()) + door.CRNL)
|
|
|
+ d.WriteS(fmt.Sprintf("Ranged: %s with %s enchantment", u.RangedWeapon.Name(), u.RangedWeaponEnchant.Name()) + door.CRNL)
|
|
|
+ d.WriteS(fmt.Sprintf("Shield: %s", u.Shield.Name()) + door.CRNL)
|
|
|
+ d.WriteS(fmt.Sprintf("Ring: %s", u.Ring.Name()) + door.CRNL)
|
|
|
+ d.WriteS(fmt.Sprintf("Amulet: %s", u.Amulet.Name()) + door.CRNL)
|
|
|
d.WaitKey(door.Inactivity)
|
|
|
}
|
|
|
|
|
|
-func renderStatusBar() {
|
|
|
+func renderStatusBar(msg ...string) {
|
|
|
if d.Disconnected || u == nil {
|
|
|
return
|
|
|
}
|
|
@@ -167,7 +160,18 @@ func renderStatusBar() {
|
|
|
bb := door.ColorTextS("BRI BLA ON BLA")
|
|
|
bar_width := ((door.Width - 3) / 2) - 1
|
|
|
hp := int(float64(bar_width) * (float64(u.Health) / float64(u.MaxHealth)))
|
|
|
- pos_txt := fmt.Sprintf("%-3d%% (%d, %d) %-3d%%", int((float64(u.Health)/float64(u.MaxHealth))*100.0), u.X, u.Y, int((float64(u.Magic)/float64(u.MaxMagic))*100.0))
|
|
|
+ var pos_txt string
|
|
|
+ if len(msg) >= 1 {
|
|
|
+ pos_txt += msg[0] + " - "
|
|
|
+ }
|
|
|
+ if u.MaxMagic != 0 {
|
|
|
+ pos_txt += fmt.Sprintf("%-3d%% (%d, %d) %-3d%%", int((float64(u.Health)/float64(u.MaxHealth))*100.0), u.X, u.Y, int((float64(u.Magic)/float64(u.MaxMagic))*100.0))
|
|
|
+ } else {
|
|
|
+ pos_txt += fmt.Sprintf("%-3d%% (%d, %d)", int((float64(u.Health)/float64(u.MaxHealth))*100.0), u.X, u.Y)
|
|
|
+ }
|
|
|
+ if len(msg) >= 2 {
|
|
|
+ pos_txt += " - " + msg[1]
|
|
|
+ }
|
|
|
d.WriteS(door.SavePos + door.GotoS((door.Width/2)-(len(pos_txt)/2), door.Height-1) + door.ColorTextS("BRI CYA ON BLA") + pos_txt + door.RestorePos)
|
|
|
if u.MaxMagic != 0 {
|
|
|
mp := int(float64(bar_width) * (float64(u.Magic) / float64(u.MaxMagic)))
|