forked from Hay1tsme/artemis
fix: ignore guest plays correctly
This commit is contained in:
@ -809,8 +809,10 @@ class ChuniBase:
|
||||
upsert = data["upsertUserAll"]
|
||||
user_id = data["userId"]
|
||||
|
||||
if int(user_id) & (1 << 48) != 0:
|
||||
self.logger.info("Guest play, ignoring.")
|
||||
if int(user_id) & 0x1000000000001 == 0x1000000000001:
|
||||
place_id = int(user_id) & 0xFFFC00000000
|
||||
|
||||
self.logger.info("Guest play from place ID %d, ignoring.", place_id)
|
||||
return {"returnCode": "1"}
|
||||
|
||||
if "userData" in upsert:
|
||||
|
@ -238,9 +238,10 @@ class Mai2Base:
|
||||
user_id = data["userId"]
|
||||
upsert = data["upsertUserAll"]
|
||||
|
||||
if int(user_id) & 1000000000001 == 1000000000001:
|
||||
self.logger.info("Guest play, ignoring.")
|
||||
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
|
||||
if int(user_id) & 0x1000000000001 == 0x1000000000001:
|
||||
place_id = int(user_id) & 0xFFFC00000000
|
||||
|
||||
self.logger.info("Guest play from place ID %d, ignoring.", place_id)
|
||||
|
||||
if "userData" in upsert and len(upsert["userData"]) > 0:
|
||||
upsert["userData"][0].pop("accessCode")
|
||||
|
@ -119,8 +119,10 @@ class Mai2DX(Mai2Base):
|
||||
user_id = data["userId"]
|
||||
upsert = data["upsertUserAll"]
|
||||
|
||||
if int(user_id) & 1000000000001 == 1000000000001:
|
||||
self.logger.info("Guest play, ignoring.")
|
||||
if int(user_id) & 0x1000000000001 == 0x1000000000001:
|
||||
place_id = int(user_id) & 0xFFFC00000000
|
||||
|
||||
self.logger.info("Guest play from place ID %d, ignoring.", place_id)
|
||||
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
|
||||
|
||||
if "userData" in upsert and len(upsert["userData"]) > 0:
|
||||
|
@ -293,7 +293,9 @@ class OngekiBase:
|
||||
|
||||
async def handle_upsert_user_gplog_api_request(self, data: Dict) -> Dict:
|
||||
user = data["userId"]
|
||||
if user >= 200000000000000: # Account for guest play
|
||||
|
||||
# If playing as guest, the user ID is or(0x1000000000001, (placeId & 65535) << 32)
|
||||
if user & 0x1000000000001 == 0x1000000000001:
|
||||
user = None
|
||||
|
||||
await self.data.log.put_gp_log(
|
||||
@ -945,6 +947,12 @@ class OngekiBase:
|
||||
upsert = data["upsertUserAll"]
|
||||
user_id = data["userId"]
|
||||
|
||||
if user_id & 0x1000000000001 == 0x1000000000001:
|
||||
place_id = int(user_id) & 0xFFFC00000000
|
||||
|
||||
self.logger.info("Guest play from place ID %d, ignoring.", place_id)
|
||||
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
|
||||
|
||||
# The isNew fields are new as of Red and up. We just won't use them for now.
|
||||
|
||||
if "userData" in upsert and len(upsert["userData"]) > 0:
|
||||
|
Reference in New Issue
Block a user