Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions modules_directory/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
help_text = "Type BAL to view your cash and assets. View balance, net worth, stocks, and property deeds."
persistent = False
oof_params = {}
_last_balance = None

def run(player_id:int, server: socket, active_terminal: ss.Terminal):
"""
Expand Down Expand Up @@ -39,13 +40,13 @@ def run(player_id:int, server: socket, active_terminal: ss.Terminal):
# Get moneybag image and create the lists of lines
image = str(g.get("moneybag"))
image = image.splitlines()
info_lines = info.splitlines()
info_lines = info.splitlines()

ret_val = ""

for i in range(len(image)):
ret_val += " " * 35 + image[i] + "\n"
active_terminal.update(ret_val, False) # print just the moneybags
active_terminal.update(ret_val, False) # print just the moneybags

ret_val = ""
for i in range(ss.rows):
Expand All @@ -60,6 +61,7 @@ def oof() -> str:
"""
Update function for when the terminal is out of focus. Does NOT need active_terminal, and returns the string to be displayed.
"""
global _last_balance
server = oof_params["server"]
player_id = oof_params["player_id"]

Expand All @@ -68,6 +70,10 @@ def oof() -> str:
net.send_message(server, f'{player_id}bal,get_assets,get_net_worth')
info = header + "\n" + net.receive_message(server)

if info == _last_balance:
return ""

_last_balance = info
# Get moneybag image and create the lists of lines
image = str(g.get("moneybag"))
image = image.splitlines()
Expand Down