diff options
-rw-r--r-- | player.py | 49 |
1 files changed, 0 insertions, 49 deletions
@@ -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) |