From 6cf7cb8a324d7e06e236a81e5130d336fe3c9e8a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 8 Sep 2023 01:27:30 -0300 Subject: Remove part of the AP system functionality. It'll no longer be consumed. It is still used as restriction for quests, however. (You can't pick a quest with AP cost > your own AP) --- player.py | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/player.py b/player.py index a8b6f6e..a6f411d 100644 --- a/player.py +++ b/player.py @@ -33,27 +33,6 @@ from threading import Timer # Internal function for ApTimer, DO NOT CAST manually # FIXME: Maybe find a better replacement for this def ap_updater(token): - global ApTimer, Player - - # TODO: What if token is no longer valid? (Maybe use queue instead?) - Player[token]["ap"]+=1 - if (Player[token]["ap"] < Player[token]["max_ap"]): - try: - ApTimer[token].cancel() - del ApTimer[token] - except: - pass - ApTimer[token]=Timer(AP_REGEN_TIME_F, ap_updater, args=[token]) - ApTimer[token].daemon=True - ApTimer[token].start() - - # Send APREFRESH packet to client - try: - usr=cli_search(Player[token]["userid"]) - usr.send_message("APREFRESH:%d" % Player[token]["ap"]) - except: - traceback.print_exc() - stdout("Unable to send AP Info for token %s" % token) return # Internal function for SQL, DO NOT CAST manually @@ -87,28 +66,6 @@ def inventoryplace(token): # Adds/Deletes AP from a user, manages the ApTimer def update_ap(token, newval): - global ApTimer, Player - - running=False - if (Player[token]["ap"] < Player[token]["max_ap"]): - running=True - - # Update AP - # TODO: Do we allow over-the-cap AP? - Player[token]["ap"]+=int(newval) - - # Handle the timer - if (not running and Player[token]["ap"] < Player[token]["max_ap"]): - ApTimer[token]=Timer(AP_REGEN_TIME_F, ap_updater, args=[token]) - ApTimer[token].daemon=True - ApTimer[token].start() - if (running and Player[token]["ap"] >= Player[token]["max_ap"]): - # If it is not running/error: We don't care (very rare error) - try: - ApTimer[token].cancel() - except: - pass - return # Function which list all unit id on party @@ -417,12 +374,6 @@ def get_data(args, token): Player[token]["ap"]=int(min(Player[token]["max_ap"], Player[token]["ap"]+delta)) Player[token]["aptime"]=now()-delta2 - # This is only to start the timer if needed - if (Player[token]["ap"] < Player[token]["max_ap"]): - ApTimer[token]=Timer(AP_REGEN_TIME_F-delta2, ap_updater, args=[token]) - ApTimer[token].daemon=True - ApTimer[token].start() - # Daily login rewards Player[token]["code"]=daily_login(token) -- cgit v1.2.3-70-g09d2