2020-11-06 18:53:27 +00:00
|
|
|
import curses
|
|
|
|
|
2020-11-06 20:15:09 +00:00
|
|
|
from dungeonbattle.entities.player import Player
|
|
|
|
|
|
|
|
|
2020-11-06 18:50:26 +00:00
|
|
|
class StatsDisplay:
|
2020-11-06 20:15:09 +00:00
|
|
|
def __init__(self, player: Player, height: int, width: int,
|
|
|
|
topleftx: int, toplefty: int):
|
2020-11-06 18:50:26 +00:00
|
|
|
self.width = width
|
|
|
|
self.height = height
|
2020-11-06 20:15:09 +00:00
|
|
|
self.topleftx = topleftx
|
|
|
|
self.toplefty = toplefty
|
|
|
|
self.player = player
|
2020-11-06 18:50:26 +00:00
|
|
|
self.pad = curses.newpad(height, width)
|
2020-11-06 20:15:09 +00:00
|
|
|
|
|
|
|
def update_pad(self) -> None:
|
|
|
|
string = "Player -- LVL {} EXP {}/{} HP {}/{}\n" \
|
|
|
|
"Stats : STR {} INT {} CHR {} DEX {} CON {}"\
|
|
|
|
.format(self.player.level, self.player.current_xp,
|
|
|
|
self.player.max_xp, self.player.health,
|
|
|
|
self.player.maxhealth, self.player.strength,
|
|
|
|
self.player.intelligence, self.player.charisma,
|
|
|
|
self.player.dexterity, self.player.constitution)
|
2020-11-06 18:50:26 +00:00
|
|
|
self.pad.addstr(0, 0, string)
|
2020-11-06 20:15:09 +00:00
|
|
|
|
|
|
|
def refresh(self) -> None:
|
2020-11-06 18:50:26 +00:00
|
|
|
self.pad.clear()
|
|
|
|
self.update_pad()
|
2020-11-06 20:15:09 +00:00
|
|
|
self.pad.refresh(0, 0, self.toplefty, self.topleftx,
|
|
|
|
self.heigth + self.toplefty,
|
|
|
|
self.width + self.topleftx)
|