summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-21 09:41:33 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-21 09:41:33 -0300
commited566094a41293407f0b2dd8025eeec4deb4ece8 (patch)
treed4989789de9855ff5ce6ff068afb531f2eee7e8d /game
parent3677497d7390f1b67d4f0f199a427619b3d5e271 (diff)
downloadclient-ed566094a41293407f0b2dd8025eeec4deb4ece8.tar.gz
client-ed566094a41293407f0b2dd8025eeec4deb4ece8.tar.bz2
client-ed566094a41293407f0b2dd8025eeec4deb4ece8.tar.xz
client-ed566094a41293407f0b2dd8025eeec4deb4ece8.zip
Remove the self calculation of AP timing, and have server handle it.
It no longer auto refreshes, though, as the timer was removed. Beware!
Diffstat (limited to 'game')
-rw-r--r--game/01_init.rpy3
-rw-r--r--game/misc.rpy47
-rw-r--r--game/script.rpy12
3 files changed, 14 insertions, 48 deletions
diff --git a/game/01_init.rpy b/game/01_init.rpy
index 99f8587..58fe801 100644
--- a/game/01_init.rpy
+++ b/game/01_init.rpy
@@ -34,9 +34,6 @@ init -3 python:
if (PYTHON_VERSION < 2700 or PYTHON_VERSION > 3000):
raise Exception("WARNING: Python version is not 2.7\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.")
- # Why setting this...?
- ApTimer=""
-
# Configuration
config.autoreload = False
config.save_on_mobile_background = False
diff --git a/game/misc.rpy b/game/misc.rpy
index 3b7f9e1..2e0bf26 100644
--- a/game/misc.rpy
+++ b/game/misc.rpy
@@ -294,43 +294,22 @@ image spinner:
# Player data internals
init python:
def ap_restore():
- global ApTimer, Player
-
- Player["ap"]+=1
- if (Player["ap"] < Player["max_ap"]):
- try:
- ApTimer.cancel()
- except:
- pass
- ApTimer=Timer(360.0, ap_restore)
- ApTimer.daemon=True
- ApTimer.start()
+ # TODO: Request AP Data from websocket
+ raw=send_packet("apdata")
+ apdata=json_decode(raw)
+ try:
+ Player["ap"]=apdata["ap"]
+ Player["max_ap"]=apdata["max_ap"]
+ Player["aptime"]=apdata["aptime"]
+ except:
+ stdout("Failed to restore AP!")
+ traceback.print_exc()
+ pass
return
def update_ap(newval):
- global ApTimer, Player
-
- running=False
- # FIXME ApTimer might not have been started =/
- # And in overall is horrible and a waste of resources
- if (Player["ap"] < Player["max_ap"]):
- running=True
-
- # Update AP
- # TODO: Do we allow over-the-cap AP?
- Player["ap"]+=newval
-
- # Handle the timer
- if (not running and Player["ap"] < Player["max_ap"]):
- ApTimer=Timer(360.0, ap_restore)
- ApTimer.daemon=True
- ApTimer.start()
- if (running and Player["ap"] >= Player["max_ap"]):
- try:
- ApTimer.cancel()
- except:
- pass
-
+ # TODO: Request AP Data from websocket
+ renpy.invoke_in_thread(ap_restore)
return
diff --git a/game/script.rpy b/game/script.rpy
index 9391ecb..3c81e7e 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -115,10 +115,7 @@ label login:
for a in inv:
Player["inv"].append(a)
- # Run AP Timer if needed (FIXME)
- if (Player["ap"] < Player["max_ap"]):
- ApTimer=Timer(360.0, ap_restore)
- ApTimer.start()
+ # TODO: Run AP Timer if needed
# Remove some temporary variables
$ del password
@@ -241,13 +238,6 @@ label prologue:
label quit:
$ stdout("Received quit signal!")
python:
- # Delete ApTimer
- try:
- ApTimer.cancel()
- del ApTimer
- except:
- pass
-
# If needed, logout
try:
token=Player["token"]