mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-08-23 04:14:16 -05:00
allnet: improve billing playlimit to include history
This commit is contained in:
@@ -711,6 +711,7 @@ class BillingServlet:
|
||||
"messages": []
|
||||
}
|
||||
playhist = "000000/0:000000/0:000000/0"
|
||||
total_playcount = req.playcnt
|
||||
|
||||
if machine is not None:
|
||||
if self.config.allnet.save_billing:
|
||||
@@ -722,16 +723,21 @@ class BillingServlet:
|
||||
|
||||
# Technically if a cab resets it's playcount and then does more plays then the previous
|
||||
# playcount before a billing checkin occours, we will lose plays equal to the current playcount.
|
||||
if req.playcnt < last_playct: await self.data.arcade.billing_add_playcount(machine['id'], req.gameid, req.playcnt)
|
||||
elif req.playcnt == last_playct: pass # No plays since last checkin, skip update
|
||||
else: await self.data.arcade.billing_add_playcount(machine['id'], req.gameid, req.playcnt - last_playct)
|
||||
if req.playcnt < last_playct:
|
||||
await self.data.arcade.billing_add_playcount(machine['id'], req.gameid, req.playcnt)
|
||||
elif req.playcnt == last_playct:
|
||||
pass # No plays since last checkin, skip update
|
||||
else:
|
||||
await self.data.arcade.billing_add_playcount(machine['id'], req.gameid, req.playcnt - last_playct)
|
||||
|
||||
plays = await self.data.arcade.billing_get_playcount_3mo(machine['id'], req.gameid)
|
||||
if plays is not None and len(plays) > 0:
|
||||
playhist = ""
|
||||
|
||||
for x in range(len(plays) - 1, -1, -1): playhist += f"{plays[x]['year']:04d}{plays[x]['month']:02d}/{plays[x]['playct']}:"
|
||||
playhist = playhist[:-1]
|
||||
if plays:
|
||||
total_playcount = sum(p['playct'] for p in plays)
|
||||
|
||||
playhist = ":".join(
|
||||
f"{p['year']:04d}{p['month']:02d}/{p['playct']}"
|
||||
for p in reversed(plays)
|
||||
)
|
||||
|
||||
for x in range(1, len(req_dict)):
|
||||
if not req_dict[x]:
|
||||
@@ -814,10 +820,10 @@ class BillingServlet:
|
||||
return PlainTextResponse("result=6&waittime=0&linelimit=20\r\n")
|
||||
|
||||
playlimit = req.playlimit
|
||||
while req.playcnt > playlimit:
|
||||
while total_playcount > playlimit:
|
||||
playlimit += 1024
|
||||
|
||||
nearfull = req.nearfull + (req.billingtype.value * 0x00010000)
|
||||
nearfull = req.nearfull | (req.billingtype.value << 16)
|
||||
|
||||
digest.update(playlimit.to_bytes(4, "little") + kc_serial_bytes)
|
||||
playlimit_sig = signer.sign(digest).hex()
|
||||
|
||||
Reference in New Issue
Block a user