diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-18 00:03:46 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-18 00:03:46 -0300 |
commit | 57cbea204d0ee66509783664af9757f9273fa254 (patch) | |
tree | f4973b78d8f3040354901bad54568622c64a8fee | |
parent | 1555f32044278603b892e500b5d52a00561e715e (diff) | |
download | renpy-57cbea204d0ee66509783664af9757f9273fa254.tar.gz renpy-57cbea204d0ee66509783664af9757f9273fa254.tar.bz2 renpy-57cbea204d0ee66509783664af9757f9273fa254.tar.xz renpy-57cbea204d0ee66509783664af9757f9273fa254.zip |
Create mySoul structure and make the /souldata request
-rw-r--r-- | game/client.rpy | 22 | ||||
-rw-r--r-- | game/renpy.rpy | 5 |
2 files changed, 24 insertions, 3 deletions
diff --git a/game/client.rpy b/game/client.rpy index 9b5a8fe..9a26ea3 100644 --- a/game/client.rpy +++ b/game/client.rpy @@ -138,8 +138,26 @@ init 2 python: ############################################ # TODO: Launch thread requesting /soul data def load_souldata(): - global progress - progress = 100 + global progress, responsive, vaultId, vaultToken, mySoul + try: + auth = {"vaultId": vaultId, + "token": vaultToken} + + ## Make the POST request + r=vault.post(VAULT_HOST+"/souldata", json=auth, timeout=15.0) + if r.status_code != 200: + raise Exception("Request error: %d" % r.status_code) + dat=r.json() + + ## Update mySoul + mySoul={} + mySoul["level"]=dat["soulv"] + mySoul["exp"]=dat["soulx"] + progress = 100 + except: + traceback.print_exc() + mySoul = None + responsive = False return diff --git a/game/renpy.rpy b/game/renpy.rpy index f87c368..824e29e 100644 --- a/game/renpy.rpy +++ b/game/renpy.rpy @@ -262,6 +262,7 @@ Soul Level remains constant regardless of the subworld you're at.{/color}{fast}" ################################################################################# label thevoid: $ progress = 0 + $ mySoul = None $ renpy.invoke_in_thread(load_souldata) scene DKBG show expression (ManaSparkle().sm) as flare @@ -276,7 +277,9 @@ label thevoid: else: break hide loader with None - pause + if mySoul is not None: + $ stdout("Level %d EXP %d" % (mySoul["level"], mySoul["exp"])) + pause scene black with Dissolve(1.5) pause 0.15 return |