astandy 0.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Astandy/__init__.py +42 -0
- Astandy/cipher.py +58 -0
- Astandy/client.py +355 -0
- Astandy/dispatcher.py +19 -0
- Astandy/enums/__init__.py +0 -0
- Astandy/enums/events.py +9 -0
- Astandy/errors.py +1 -0
- Astandy/events/__init__.py +10 -0
- Astandy/events/onConnect.py +16 -0
- Astandy/generated/__init__.py +41 -0
- Astandy/generated/listeners.py +1534 -0
- Astandy/generated/schemes_pb2.py +1354 -0
- Astandy/generated/schemes_pb2.pyi +5194 -0
- Astandy/generated/services.py +3322 -0
- Astandy/listener.py +12 -0
- Astandy/listeners/__init__.py +1 -0
- Astandy/listeners/onConnect.py +6 -0
- Astandy/logging.py +20 -0
- Astandy/parser.py +20 -0
- Astandy/schemes/messages_pb2.py +52 -0
- Astandy/schemes/messages_pb2.pyi +87 -0
- Astandy/services/__init__.py +18 -0
- Astandy/services/bolt.py +24 -0
- Astandy/services/handshake.py +23 -0
- Astandy/services/hello.py +50 -0
- Astandy/services/player.py +21 -0
- Astandy/types/__init__.py +4 -0
- Astandy/types/extras.py +14 -0
- Astandy/types/gmessage.py +4 -0
- Astandy/types/service.py +3 -0
- Astandy/types/update.py +10 -0
- Astandy/updates/__init__.py +1 -0
- Astandy/updates/connect.py +5 -0
- Astandy/utils.py +26 -0
- astandy-0.2.4.dist-info/METADATA +16 -0
- astandy-0.2.4.dist-info/RECORD +38 -0
- astandy-0.2.4.dist-info/WHEEL +5 -0
- astandy-0.2.4.dist-info/top_level.txt +1 -0
Astandy/listener.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from Astandy.types.update import Update
|
|
3
|
+
from Astandy.enums.events import BaseEvent
|
|
4
|
+
|
|
5
|
+
class Listener:
|
|
6
|
+
event: BaseEvent = BaseEvent.UNKNOWN
|
|
7
|
+
|
|
8
|
+
def __init__(self, callback: Callable):
|
|
9
|
+
self._callback = callback
|
|
10
|
+
|
|
11
|
+
async def call(self, client, update: Update):
|
|
12
|
+
await self._callback(client, update)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .onConnect import OnConnect
|
Astandy/logging.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from .types.extras import Extra, ConnectionInfo
|
|
4
|
+
|
|
5
|
+
class AstandyLoggers:
|
|
6
|
+
class Adapter(logging.LoggerAdapter):
|
|
7
|
+
def __init__(self, logger):
|
|
8
|
+
super(AstandyLoggers.Adapter, self).__init__(logger, {})
|
|
9
|
+
self.extra: Extra = Extra()
|
|
10
|
+
|
|
11
|
+
def process(self, msg, kwargs):
|
|
12
|
+
if issubclass(self.extra.__class__, Extra) and Extra != self.extra.__class__:
|
|
13
|
+
return '[%s] - %s' % (self.extra, msg), kwargs
|
|
14
|
+
else:
|
|
15
|
+
return msg, kwargs
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def get_logger(name):
|
|
19
|
+
logger = logging.getLogger(name)
|
|
20
|
+
return AstandyLoggers.Adapter(logger)
|
Astandy/parser.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from Astandy.schemes.messages_pb2 import ClientMsg, BinaryValue, ServerMsg
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Parser:
|
|
5
|
+
@staticmethod
|
|
6
|
+
def new_msg(uuid: str, code: int, payload: bytes):
|
|
7
|
+
msg = ClientMsg()
|
|
8
|
+
msg.id = uuid
|
|
9
|
+
msg.code = code
|
|
10
|
+
msg.data.append(BinaryValue())
|
|
11
|
+
msg.data[0].one = payload
|
|
12
|
+
|
|
13
|
+
return msg.SerializeToString()
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def parse_response(request: bytes) -> ServerMsg:
|
|
17
|
+
msg = ServerMsg()
|
|
18
|
+
msg.ParseFromString(request)
|
|
19
|
+
|
|
20
|
+
return msg
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: Astandy/schemes/messages.proto
|
|
5
|
+
# Protobuf Python Version: 5.29.0
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
5,
|
|
15
|
+
29,
|
|
16
|
+
0,
|
|
17
|
+
'',
|
|
18
|
+
'Astandy/schemes/messages.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x41standy/schemes/messages.proto\x12\x0c\x41standy.Base\"9\n\x0b\x42inaryValue\x12\x0e\n\x06isNull\x18\x01 \x01(\x08\x12\r\n\x05\x61rray\x18\x02 \x03(\x0c\x12\x0b\n\x03one\x18\x03 \x01(\x0c\"i\n\tClientMsg\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0b\n\x03\x63ls\x18\x02 \x01(\t\x12\x0c\n\x04\x66unc\x18\x03 \x01(\t\x12\'\n\x04\x64\x61ta\x18\x04 \x03(\x0b\x32\x19.Astandy.Base.BinaryValue\x12\x0c\n\x04\x63ode\x18\x05 \x01(\r\"\x95\x01\n\tException\x12\n\n\x02\x61t\x18\x01 \x01(\x03\x12\x0c\n\x04\x63ode\x18\x02 \x01(\x03\x12;\n\nproperties\x18\x03 \x03(\x0b\x32\'.Astandy.Base.Exception.PropertiesEntry\x1a\x31\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"k\n\x08Response\x12\n\n\x02id\x18\x01 \x01(\t\x12*\n\texception\x18\x02 \x01(\x0b\x32\x17.Astandy.Base.Exception\x12\'\n\x04\x64\x61ta\x18\x03 \x03(\x0b\x32\x19.Astandy.Base.BinaryValue\"a\n\x05\x45vent\x12\x10\n\x08listener\x18\x01 \x01(\t\x12\r\n\x05\x65vent\x18\x02 \x01(\t\x12)\n\x06params\x18\x03 \x01(\x0b\x32\x19.Astandy.Base.BinaryValue\x12\x0c\n\x04\x63ode\x18\x04 \x01(\x03\"C\n\x12\x43ompressedInstance\x12\x19\n\x11uncompressed_size\x18\x01 \x01(\x04\x12\x12\n\ncompressed\x18\x02 \x01(\x0c\"\x9b\x01\n\tServerMsg\x12)\n\tresponses\x18\x01 \x03(\x0b\x32\x16.Astandy.Base.Response\x12#\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x13.Astandy.Base.Event\x12>\n\x14\x63ompressed_instances\x18\x03 \x03(\x0b\x32 .Astandy.Base.CompressedInstanceb\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'Astandy.schemes.messages_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
DESCRIPTOR._loaded_options = None
|
|
34
|
+
_globals['_EXCEPTION_PROPERTIESENTRY']._loaded_options = None
|
|
35
|
+
_globals['_EXCEPTION_PROPERTIESENTRY']._serialized_options = b'8\001'
|
|
36
|
+
_globals['_BINARYVALUE']._serialized_start=48
|
|
37
|
+
_globals['_BINARYVALUE']._serialized_end=105
|
|
38
|
+
_globals['_CLIENTMSG']._serialized_start=107
|
|
39
|
+
_globals['_CLIENTMSG']._serialized_end=212
|
|
40
|
+
_globals['_EXCEPTION']._serialized_start=215
|
|
41
|
+
_globals['_EXCEPTION']._serialized_end=364
|
|
42
|
+
_globals['_EXCEPTION_PROPERTIESENTRY']._serialized_start=315
|
|
43
|
+
_globals['_EXCEPTION_PROPERTIESENTRY']._serialized_end=364
|
|
44
|
+
_globals['_RESPONSE']._serialized_start=366
|
|
45
|
+
_globals['_RESPONSE']._serialized_end=473
|
|
46
|
+
_globals['_EVENT']._serialized_start=475
|
|
47
|
+
_globals['_EVENT']._serialized_end=572
|
|
48
|
+
_globals['_COMPRESSEDINSTANCE']._serialized_start=574
|
|
49
|
+
_globals['_COMPRESSEDINSTANCE']._serialized_end=641
|
|
50
|
+
_globals['_SERVERMSG']._serialized_start=644
|
|
51
|
+
_globals['_SERVERMSG']._serialized_end=799
|
|
52
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from google.protobuf.internal import containers as _containers
|
|
2
|
+
from google.protobuf import descriptor as _descriptor
|
|
3
|
+
from google.protobuf import message as _message
|
|
4
|
+
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
|
|
5
|
+
|
|
6
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
7
|
+
|
|
8
|
+
class BinaryValue(_message.Message):
|
|
9
|
+
__slots__ = ("isNull", "array", "one")
|
|
10
|
+
ISNULL_FIELD_NUMBER: _ClassVar[int]
|
|
11
|
+
ARRAY_FIELD_NUMBER: _ClassVar[int]
|
|
12
|
+
ONE_FIELD_NUMBER: _ClassVar[int]
|
|
13
|
+
isNull: bool
|
|
14
|
+
array: _containers.RepeatedScalarFieldContainer[bytes]
|
|
15
|
+
one: bytes
|
|
16
|
+
def __init__(self, isNull: bool = ..., array: _Optional[_Iterable[bytes]] = ..., one: _Optional[bytes] = ...) -> None: ...
|
|
17
|
+
|
|
18
|
+
class ClientMsg(_message.Message):
|
|
19
|
+
__slots__ = ("id", "cls", "func", "data", "code")
|
|
20
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
21
|
+
CLS_FIELD_NUMBER: _ClassVar[int]
|
|
22
|
+
FUNC_FIELD_NUMBER: _ClassVar[int]
|
|
23
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
|
24
|
+
CODE_FIELD_NUMBER: _ClassVar[int]
|
|
25
|
+
id: str
|
|
26
|
+
cls: str
|
|
27
|
+
func: str
|
|
28
|
+
data: _containers.RepeatedCompositeFieldContainer[BinaryValue]
|
|
29
|
+
code: int
|
|
30
|
+
def __init__(self, id: _Optional[str] = ..., cls: _Optional[str] = ..., func: _Optional[str] = ..., data: _Optional[_Iterable[_Union[BinaryValue, _Mapping]]] = ..., code: _Optional[int] = ...) -> None: ...
|
|
31
|
+
|
|
32
|
+
class Exception(_message.Message):
|
|
33
|
+
__slots__ = ("at", "code", "properties")
|
|
34
|
+
class PropertiesEntry(_message.Message):
|
|
35
|
+
__slots__ = ("key", "value")
|
|
36
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
37
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
38
|
+
key: str
|
|
39
|
+
value: str
|
|
40
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
41
|
+
AT_FIELD_NUMBER: _ClassVar[int]
|
|
42
|
+
CODE_FIELD_NUMBER: _ClassVar[int]
|
|
43
|
+
PROPERTIES_FIELD_NUMBER: _ClassVar[int]
|
|
44
|
+
at: int
|
|
45
|
+
code: int
|
|
46
|
+
properties: _containers.ScalarMap[str, str]
|
|
47
|
+
def __init__(self, at: _Optional[int] = ..., code: _Optional[int] = ..., properties: _Optional[_Mapping[str, str]] = ...) -> None: ...
|
|
48
|
+
|
|
49
|
+
class Response(_message.Message):
|
|
50
|
+
__slots__ = ("id", "exception", "data")
|
|
51
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
52
|
+
EXCEPTION_FIELD_NUMBER: _ClassVar[int]
|
|
53
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
|
54
|
+
id: str
|
|
55
|
+
exception: Exception
|
|
56
|
+
data: _containers.RepeatedCompositeFieldContainer[BinaryValue]
|
|
57
|
+
def __init__(self, id: _Optional[str] = ..., exception: _Optional[_Union[Exception, _Mapping]] = ..., data: _Optional[_Iterable[_Union[BinaryValue, _Mapping]]] = ...) -> None: ...
|
|
58
|
+
|
|
59
|
+
class Event(_message.Message):
|
|
60
|
+
__slots__ = ("listener", "event", "params", "code")
|
|
61
|
+
LISTENER_FIELD_NUMBER: _ClassVar[int]
|
|
62
|
+
EVENT_FIELD_NUMBER: _ClassVar[int]
|
|
63
|
+
PARAMS_FIELD_NUMBER: _ClassVar[int]
|
|
64
|
+
CODE_FIELD_NUMBER: _ClassVar[int]
|
|
65
|
+
listener: str
|
|
66
|
+
event: str
|
|
67
|
+
params: BinaryValue
|
|
68
|
+
code: int
|
|
69
|
+
def __init__(self, listener: _Optional[str] = ..., event: _Optional[str] = ..., params: _Optional[_Union[BinaryValue, _Mapping]] = ..., code: _Optional[int] = ...) -> None: ...
|
|
70
|
+
|
|
71
|
+
class CompressedInstance(_message.Message):
|
|
72
|
+
__slots__ = ("uncompressed_size", "compressed")
|
|
73
|
+
UNCOMPRESSED_SIZE_FIELD_NUMBER: _ClassVar[int]
|
|
74
|
+
COMPRESSED_FIELD_NUMBER: _ClassVar[int]
|
|
75
|
+
uncompressed_size: int
|
|
76
|
+
compressed: bytes
|
|
77
|
+
def __init__(self, uncompressed_size: _Optional[int] = ..., compressed: _Optional[bytes] = ...) -> None: ...
|
|
78
|
+
|
|
79
|
+
class ServerMsg(_message.Message):
|
|
80
|
+
__slots__ = ("responses", "events", "compressed_instances")
|
|
81
|
+
RESPONSES_FIELD_NUMBER: _ClassVar[int]
|
|
82
|
+
EVENTS_FIELD_NUMBER: _ClassVar[int]
|
|
83
|
+
COMPRESSED_INSTANCES_FIELD_NUMBER: _ClassVar[int]
|
|
84
|
+
responses: _containers.RepeatedCompositeFieldContainer[Response]
|
|
85
|
+
events: _containers.RepeatedCompositeFieldContainer[Event]
|
|
86
|
+
compressed_instances: _containers.RepeatedCompositeFieldContainer[CompressedInstance]
|
|
87
|
+
def __init__(self, responses: _Optional[_Iterable[_Union[Response, _Mapping]]] = ..., events: _Optional[_Iterable[_Union[Event, _Mapping]]] = ..., compressed_instances: _Optional[_Iterable[_Union[CompressedInstance, _Mapping]]] = ...) -> None: ...
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from .hello import HelloRemoteService
|
|
2
|
+
from .bolt import BoltRemoteService
|
|
3
|
+
from .handshake import HandshakeRemoteService
|
|
4
|
+
from .player import PlayerRemoteService
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Services(
|
|
8
|
+
HelloRemoteService,
|
|
9
|
+
BoltRemoteService,
|
|
10
|
+
HandshakeRemoteService,
|
|
11
|
+
PlayerRemoteService
|
|
12
|
+
):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
super().__init__()
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"Services"
|
|
18
|
+
]
|
Astandy/services/bolt.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from Astandy.generated.schemes_pb2 import SubscribeRequest
|
|
2
|
+
from Astandy.types.service import Service
|
|
3
|
+
import Astandy
|
|
4
|
+
|
|
5
|
+
class BoltRemoteService(Service):
|
|
6
|
+
async def subscribe(self: 'Astandy.StandClient', topic: str):
|
|
7
|
+
'''
|
|
8
|
+
:param topic: topic name
|
|
9
|
+
'''
|
|
10
|
+
request = SubscribeRequest()
|
|
11
|
+
request.topic = topic
|
|
12
|
+
|
|
13
|
+
response = self.raw.BoltRemoteService.subscribe2Response(
|
|
14
|
+
await self.send_request(
|
|
15
|
+
*self.raw.BoltRemoteService.subscribe2Request(
|
|
16
|
+
request
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return True
|
|
22
|
+
|
|
23
|
+
async def subscribe_trade(self: 'Astandy.StandClient', item_definition_id: int):
|
|
24
|
+
return await self.subscribe(f"marketplace_trade_{item_definition_id}")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from secrets import token_bytes
|
|
2
|
+
|
|
3
|
+
from Astandy.generated.schemes_pb2 import GACHFBFBBEHDAAD
|
|
4
|
+
from Astandy.types.service import Service
|
|
5
|
+
import Astandy
|
|
6
|
+
|
|
7
|
+
class HandshakeRemoteService(Service):
|
|
8
|
+
async def handshake(self: 'Astandy.StandClient', handshake: str):
|
|
9
|
+
request = GACHFBFBBEHDAAD()
|
|
10
|
+
request.GFCCADHDDFAFHFE = handshake
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
response = self.raw.HandshakeRemoteService.encryptedHandshakeResponse(
|
|
14
|
+
await self.send_request(
|
|
15
|
+
*self.raw.HandshakeRemoteService.encryptedHandshakeRequest(
|
|
16
|
+
request,
|
|
17
|
+
self.cipher
|
|
18
|
+
)
|
|
19
|
+
),
|
|
20
|
+
self.cipher
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
return True
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from secrets import token_bytes
|
|
2
|
+
|
|
3
|
+
from cryptography.hazmat.primitives.asymmetric import rsa, padding
|
|
4
|
+
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicNumbers
|
|
5
|
+
from cryptography.hazmat.primitives import hashes
|
|
6
|
+
|
|
7
|
+
from Astandy.generated.schemes_pb2 import CHGACEEHFADEDHH
|
|
8
|
+
from Astandy.types.service import Service
|
|
9
|
+
import Astandy
|
|
10
|
+
|
|
11
|
+
class HelloRemoteService(Service):
|
|
12
|
+
def __init__(self):
|
|
13
|
+
super().__init__()
|
|
14
|
+
|
|
15
|
+
self._rsa_key: RSAPrivateKey
|
|
16
|
+
self._public_nums: RSAPublicNumbers
|
|
17
|
+
|
|
18
|
+
def generate_keys(self):
|
|
19
|
+
self._rsa_key = rsa.generate_private_key(
|
|
20
|
+
public_exponent=65537,
|
|
21
|
+
key_size=1024
|
|
22
|
+
)
|
|
23
|
+
self._public_nums = self._rsa_key.public_key().public_numbers()
|
|
24
|
+
|
|
25
|
+
async def hello(self: 'Astandy.StandClient'):
|
|
26
|
+
iv = token_bytes(16)
|
|
27
|
+
|
|
28
|
+
request = CHGACEEHFADEDHH()
|
|
29
|
+
request.DCAGCDFCHBBDCDB = self._public_nums.n.to_bytes(128, "big")
|
|
30
|
+
request.GABAFEDDDBEGGAE = self._public_nums.e.to_bytes(3, "big")
|
|
31
|
+
request.CGCGBGBEGCADABH = iv
|
|
32
|
+
|
|
33
|
+
response = self.raw.HelloRemoteService.helloResponse(
|
|
34
|
+
await self.send_request(
|
|
35
|
+
*self.raw.HelloRemoteService.helloRequest(
|
|
36
|
+
request,
|
|
37
|
+
self.cipher
|
|
38
|
+
)
|
|
39
|
+
),
|
|
40
|
+
self.cipher
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
key = self._rsa_key.decrypt(
|
|
44
|
+
response.FBHHACGFCHFEEED,
|
|
45
|
+
padding.PKCS1v15()
|
|
46
|
+
)
|
|
47
|
+
self.cipher.new_aes_cipher(key, iv)
|
|
48
|
+
|
|
49
|
+
return True
|
|
50
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from Astandy.generated.schemes_pb2 import GetPlayerRequest
|
|
2
|
+
from Astandy.types.service import Service
|
|
3
|
+
import Astandy
|
|
4
|
+
|
|
5
|
+
class PlayerRemoteService(Service):
|
|
6
|
+
async def me(self: 'Astandy.StandClient'):
|
|
7
|
+
'''
|
|
8
|
+
Get handshake owner's player profile
|
|
9
|
+
'''
|
|
10
|
+
request = GetPlayerRequest()
|
|
11
|
+
|
|
12
|
+
response = self.raw.PlayerRemoteService.getPlayer2Response(
|
|
13
|
+
await self.send_request(
|
|
14
|
+
*self.raw.PlayerRemoteService.getPlayer2Request(
|
|
15
|
+
request
|
|
16
|
+
)
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return response
|
|
21
|
+
|
Astandy/types/extras.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
class Extra:
|
|
4
|
+
def __str__(self):
|
|
5
|
+
return ', '.join(f'{k}={v!r}' for k, v in self.__dict__.items())
|
|
6
|
+
|
|
7
|
+
def __repr__(self):
|
|
8
|
+
return self.__str__
|
|
9
|
+
|
|
10
|
+
class ConnectionInfo(Extra):
|
|
11
|
+
def __init__(self):
|
|
12
|
+
self.ping: int = 0
|
|
13
|
+
|
|
14
|
+
super().__init__()
|
Astandy/types/service.py
ADDED
Astandy/types/update.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .connect import Connected
|
Astandy/utils.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import sys
|
|
3
|
+
import platform
|
|
4
|
+
import importlib
|
|
5
|
+
from collections.abc import Coroutine
|
|
6
|
+
|
|
7
|
+
def run_on_uvloop(func: Coroutine, *args, **kwargs):
|
|
8
|
+
if platform.system() == 'Windows':
|
|
9
|
+
print("It is recommended to use Linux with uvloop for better performance.")
|
|
10
|
+
asyncio.run(func)
|
|
11
|
+
return
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
import uvloop
|
|
15
|
+
|
|
16
|
+
if sys.version_info >= (3, 11):
|
|
17
|
+
with asyncio.Runner(loop_factory=uvloop.new_event_loop) as runner:
|
|
18
|
+
runner.run(func)
|
|
19
|
+
else:
|
|
20
|
+
uvloop.install()
|
|
21
|
+
asyncio.run(func)
|
|
22
|
+
except ImportError:
|
|
23
|
+
if platform.system() == 'Linux':
|
|
24
|
+
print("It is recommended to install uvloop for better performance on Linux.")
|
|
25
|
+
asyncio.run(func)
|
|
26
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astandy
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Astandy is so2 game client
|
|
5
|
+
Author-email: BonePolk <bonepolk@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: cryptography==44.0.0
|
|
12
|
+
Requires-Dist: lz4
|
|
13
|
+
Requires-Dist: protobuf==5.29.3
|
|
14
|
+
Requires-Dist: python-socks[asyncio]
|
|
15
|
+
|
|
16
|
+
# Astandy# AstandyClient
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Astandy/__init__.py,sha256=yWt_5c7iX6fEBN-qa5MCGQG4zVv84uvGQyYAY7kqsAc,1002
|
|
2
|
+
Astandy/cipher.py,sha256=Qixmkil2duIG16-LonDz5jv34vtPpvn8OvW3qYC5TSo,1721
|
|
3
|
+
Astandy/client.py,sha256=su5IJqGQjP2XnhHKSBy3O9Ba6V1QDw3LGmvhIuLwfig,12303
|
|
4
|
+
Astandy/dispatcher.py,sha256=OvxbCyaJy_jzrRNW1iC12sSrxDKQazvFrtWmqTCi7HI,635
|
|
5
|
+
Astandy/errors.py,sha256=AenbzLf55X3F7-uaKb0qcvNmuiVX6fITp1roVAgFx00,42
|
|
6
|
+
Astandy/listener.py,sha256=NUKfIQsSj9i5N604k3tKli9Fzpy0lHsPAA4-OAocFG8,363
|
|
7
|
+
Astandy/logging.py,sha256=tx1Q-yj32NhRk3mcsgriZPAJbCHTkhZYqwyVdtgML3o,679
|
|
8
|
+
Astandy/parser.py,sha256=0BuWBBV2rii0_gJMZLv_R2zePi6qR_d3Lh5CObJOUGk,508
|
|
9
|
+
Astandy/utils.py,sha256=o3WUHEU_n5a5vs-D6ULvVf52iJNtquSQkgMUwCWBPZE,798
|
|
10
|
+
Astandy/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
Astandy/enums/events.py,sha256=zYCwOoTvHzCl0oGl24EAh7SWgrSCjM2qXiKpeolJjkY,130
|
|
12
|
+
Astandy/events/__init__.py,sha256=X9futOEJXdDZJxRf3uS2ZjMciWnPydjmi9dm4ekFnJA,110
|
|
13
|
+
Astandy/events/onConnect.py,sha256=Td3M80OvI-UAoAfXR0AVg1-smv0FAdx8-4YsJDNbiGw,368
|
|
14
|
+
Astandy/generated/__init__.py,sha256=NjWM3URItXO6wN8q8nASOiRXJa0S3LoPUkXP1hBplBA,1766
|
|
15
|
+
Astandy/generated/listeners.py,sha256=yl82Eo_GAb0-YHoo_zr9olfvwybAW1yQFh9QLqQF9tA,92832
|
|
16
|
+
Astandy/generated/schemes_pb2.py,sha256=6MiNS5KEHnN5af16jMSRhrAmN0Ww_DKwYgEl2uaVPhw,176676
|
|
17
|
+
Astandy/generated/schemes_pb2.pyi,sha256=t6d43S4_DIObF7nNhOm6amv0R-eKSyZk9i-rUUw59EA,236992
|
|
18
|
+
Astandy/generated/services.py,sha256=jmxIFhbPI3OBkzfzPFYlVTfthK3Q3TAAKkoe8Qd4cDo,97526
|
|
19
|
+
Astandy/listeners/__init__.py,sha256=AJ2DeTQ4pirJPOKh_0UX06R1rU_zCjwIkiyEIVvIu9A,32
|
|
20
|
+
Astandy/listeners/onConnect.py,sha256=_gSRQaiaS3VZ6HkrdRs7hqtkmx7opl_iNX0baCATKIw,139
|
|
21
|
+
Astandy/schemes/messages_pb2.py,sha256=r58m5XNyuqJ-zzFoNkyb_aPQlY5hSmefCrprzDZZIu8,3506
|
|
22
|
+
Astandy/schemes/messages_pb2.pyi,sha256=mDHP5gsMNYirWfzkvHSKJHsUhom-j7DVxTf9qhQeEGE,4110
|
|
23
|
+
Astandy/services/__init__.py,sha256=KYwRQOSgy1xdJvrUlUyqM4Du-NUCv7ztgn8GjRN6fHc,361
|
|
24
|
+
Astandy/services/bolt.py,sha256=_F8gyyop9IDxGo9hVtTS1fCOX5ocJl2Sl4_BiFtGsRg,764
|
|
25
|
+
Astandy/services/handshake.py,sha256=avq2TzQcdrmhpbNKzzWOtJLl4Efz5mLcOKd8q5DIZGs,689
|
|
26
|
+
Astandy/services/hello.py,sha256=Caxq2B2lWXlSdj_8r2xlqOMprJ4NecLh8j4JYMuQb-o,1528
|
|
27
|
+
Astandy/services/player.py,sha256=Dys1FC5lB1sknvBnNacDGM1dK6K4tDEUvsUcigdWV4w,573
|
|
28
|
+
Astandy/types/__init__.py,sha256=-2JcV0nfrslvM3Cuao--F_Ccy_KcOuy3tKfH2-Ot_uE,129
|
|
29
|
+
Astandy/types/extras.py,sha256=msZduvmcNrFHsMMOVzhW0DdQhb5UfhEMj9UTNuZTjUQ,309
|
|
30
|
+
Astandy/types/gmessage.py,sha256=6rYFFQDOX4Ml0yqxc3LNkwjqx9HFeWikt4-tw0lIoQs,122
|
|
31
|
+
Astandy/types/service.py,sha256=8FIDKsY9ujhdZ2ONc2wsILx9l3v7bCUTXqt9qbyLRO0,65
|
|
32
|
+
Astandy/types/update.py,sha256=ZckdYUj21NszG5ifUthUfqfCSCNYBTogADIp3rG4RkI,201
|
|
33
|
+
Astandy/updates/__init__.py,sha256=E3Lk2VFl8J5z3wOSlXDkoq2oNEE7iA4FjKAoINN7Jh0,30
|
|
34
|
+
Astandy/updates/connect.py,sha256=ftvzeIzGVJhcOWdGXHI5e7Fa5P2Zxj2ylXITuyLUJyI,138
|
|
35
|
+
astandy-0.2.4.dist-info/METADATA,sha256=k3NvgkRxQwcyNCnrSXSo3kyxAvZUvrr6nUjgPdNmL5U,491
|
|
36
|
+
astandy-0.2.4.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
37
|
+
astandy-0.2.4.dist-info/top_level.txt,sha256=IXBJNETTz2ZDHExxHUH7a5fr24vmZoyUvm1hynCeNr0,8
|
|
38
|
+
astandy-0.2.4.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Astandy
|