Example #1
0
 async def process(self, message_header: MessageHeader):
     if self.request.client_name == 'AmazingWorld':
         self.response.client_version = '133852.true'
         message_header.result_code = ResultCode.OK
         message_header.app_code = AppCode.OK
     else:
         raise ValueError('invalid client_name')
Example #2
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.currencies = [Currency(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     asset_map={},
        #     asset_packages=[],
        #     stats_type_id=ObjectID(1, 2, 3, 4),
        #     is_default=True
        # ), Currency(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     asset_map={},
        #     asset_packages=[],
        #     stats_type_id=ObjectID(1, 2, 3, 4),
        #     is_default=False
        # ), Currency(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     asset_map={},
        #     asset_packages=[],
        #     stats_type_id=ObjectID(1, 2, 3, 4),
        #     is_default=None
        # )]

        self.response.currencies = []
Example #3
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # notification = Notification(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     notification_category=NotificationCategory(
        #         ObjectID(1, 2, 3, 4), 1, 2),
        #     notification_type=3,
        #     requires_email=False
        # )

        # self.response.player_notifications = [PlayerNotification(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     from_player_id=ObjectID(1, 2, 3, 4),
        #     from_player_name='from_player_name',
        #     to_player_id=ObjectID(1, 2, 3, 4),
        #     village_name='from_player_name',
        #     village_id=ObjectID(1, 2, 3, 4),
        #     object_id=ObjectID(1, 2, 3, 4),
        #     notification_text='notification_text',
        #     notification=notification,
        #     is_read=False,
        #     create_date=dt.datetime.now(),
        #     expiry_date=(dt.datetime.now() + dt.timedelta(days=1))
        # )]

        self.response.player_notifications = []
Example #4
0
 async def process(self, message_header: MessageHeader):
     if self.request.name_part_type == 'Family_1':
         self.response.names = random.sample(FAMILY_1, self.request.amount)
     elif self.request.name_part_type == 'Family_2':
         self.response.names = random.sample(FAMILY_2, self.request.amount)
     elif self.request.name_part_type == 'Family_3':
         self.response.names = random.sample(FAMILY_3, self.request.amount)
     else:
         raise NotImplementedError('unknown random name type')
     message_header.result_code = ResultCode.OK
     message_header.app_code = AppCode.OK
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.npc_relationship_levels = [NpcRelationshipLevel(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     level=0,
        #     relationship_value=1,
        #     npc_id=ObjectID(1, 2, 3, 4)
        # )]

        self.response.npc_relationship_levels = []
Example #6
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.notifications = [Notification(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     notification_category=NotificationCategory(
        #         ObjectID(1, 2, 3, 4), 1, 2),
        #     notification_type=3,
        #     requires_email=False
        # )]

        self.response.notifications = []
Example #7
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.player_stats = [PlayerStats(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     player_avatar_id=ObjectID(1, 2, 3, 4),
        #     stats_type_id=ObjectID(1, 2, 3, 4),
        #     level=12,
        #     object_id=ObjectID(1, 2, 3, 4)
        # )]

        self.response.player_stats = []
Example #8
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.player_stats_types = [PlayerStatsType(
        #     container_aw_object_id=ObjectID(1, 2, 3, 4),
        #     container_asset_map={},
        #     container_asset_pkg=[],
        #     player_stats_type_value=PlayerStatsTypeValue.LEVEL,
        #     is_avatar=False,
        #     name='name'
        # )]

        self.response.player_stats_types = []
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.player_home_invites = [PlayerHomeInvite(
        #     aw_object_id=ObjectID(1, 2, 3, 4),
        #     invite_player_id=ObjectID(1, 2, 3, 4),
        #     player_id=ObjectID(1, 2, 3, 4),
        #     is_player_home=True,
        #     invite_status=0,
        #     invite_date=dt.datetime.now(),
        #     blocked_date=(dt.datetime.now() + dt.timedelta(days=1))
        # )]

        self.response.player_home_invites = []
Example #10
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # HardCodedZoneId: LoadNPCsCommand.cs -> SpawnPoints.Instance.ParseZone(NPCManager.HardCodedZoneId)
        hardcoded_zone_id = ObjectID(4, 16, 0, 2937912)

        rule_property = RuleProperty(ObjectID(0, 0, 0, 0), ObjectID(
            0, 0, 0, 0), [], [], None, None, {}, {})

        dimensions = Dimensions(1, 1, 1, 1, 1, 1)

        npc_zone = Zone(hardcoded_zone_id, {}, [], rule_property, False,
                        False, True, False, dimensions, [], 'ptag', 28)

        self.response.zones = [npc_zone]
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.invalid_code_count = 0
        self.response.invalid_code_threshold = 0

        object_id = ObjectID(1, 2, 3, 4)

        asset = Asset(
            aw_object_id=object_id,
            asset_type_name='asset_type_name',
            cdn_id='cdn_id',
            res_name='res_name',
            group_name='group_name',
            file_size=1024)

        apc = AssetPackage(
            p_tag='p_tag', create_date=dt.datetime.now())
        apc.container_aw_object_id = object_id
        apc.container_asset_map = {}
        apc.container_asset_pkg = []

        avatar = Avatar(
            aw_object_id=object_id,
            asset_map={'asset_map_key': [asset]},
            asset_packages=[apc],
            dimensions='6',
            weight=7,
            height=8,
            max_outfits=9,
            name='avatar_name')

        self.response.player_avatar = PlayerAvatar(
            aw_object_id=object_id,
            avatar=avatar,
            player_id=object_id,
            name='player_name',
            bio='player_bio',
            secret_code='1234',
            create_ts=dt.datetime.now(),
            player_avatar_outfit_id=object_id,
            outfit_no=10,
            play_time=11,
            last_play=dt.datetime.now())
Example #12
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        # self.response.tiers = [Tier(
        #     container_aw_object_id=ObjectID(1, 2, 3, 4),
        #     container_asset_map={},
        #     container_asset_pkg=[],
        #     rotation_days=1,
        #     rotation_rate=2,
        #     reporting_level_id=ObjectID(1, 2, 3, 4),
        #     paid=True,
        #     premium=True,
        #     closed=False,
        #     pricing_info='pricing_info',
        #     expiry_period=3,
        #     ordinal=4,
        #     expiry_tier_id=ObjectID(1, 2, 3, 4)
        # )]

        self.response.tiers = []
Example #13
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.site_frame = SiteFrame(
            aw_object_id=ObjectID(0, 0, 0, 0),
            asset_map={
                # this is used to load hardcoded assets (instead of using Resources.Load())
                'Amazing_Core': [
                    # LoadLoginScene.cs -> LoadAvatar -> DownloadManager.LoadAsset("Player_Base.unity3d")
                    Asset(ObjectID(0, 0, 0, 0), 'asset_type',
                          'assets/OTU2NTAzNTgyMzExOA', 'Player_Base.unity3d',
                          'asset_group', 565066),
                    # OutdoorMazeLoader.cs -> LoadSharedPrefabsCommand -> DownloadManager.LoadAsset("PlayerCamera.unity3d")
                    Asset(ObjectID(0, 0, 0, 0), 'asset_type',
                          'assets/OTQyNDc5ODIyMDMwMg', 'PlayerCamera.unity3d',
                          'asset_group', 1878),
                    # ClientManager.cs -> LoadPreloadAssetsCommand -> DownloadManager.LoadAsset("ShadersList.unity3d")
                    Asset(ObjectID(0, 0, 0, 0), 'asset_type',
                          'assets/OTYyNDQwNDA5OTA4Ng', 'ShadersList.unity3d',
                          'asset_group', 91142),
                ],

                # LoadLoginScene.cs -> AvatarLoadedHandler() -> LoadSlotIds()
                # DressAvatarManager.cs -> LoadSlotIds -> ClientManager.Instance.configList
                'Config_Text': [],

                # preload objects are downloaded to the Cached folder ClientManager.cs -> LoadPreloadedAssets()
                # also used to pass AWLoadingScreen: OutdoorMazeLoader.cs -> LoadPreloadAssetsCommand() -> preloadList
                'Preload_PrefabUnity3D': [],

                # also used to pass AWLoadingScreen: OutdoorMazeLoader.cs -> LoadPreloadAssetsCommand() -> audioClipList
                'Audio': [],
            },
            asset_packages=[],
            type_value=1)

        self.response.asset_delivery_url = 'http://localhost:8080/'  # + asset.cdn_id
Example #14
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.sync_server_token = '1234'
        self.response.sync_server_ip = 'localhost'
        self.response.sync_server_port = 8182

        object_id = ObjectID(0, 0, 0, 0)

        home_theme = HomeTheme(object_id, {
            # LoadMazeCommand.cs -> LoadMainScene() -> AssetDownloadManager.cs -> LoadMainScene()
            'Scene_Unity3D': [Asset(object_id, 'asset_type', 'non_existing_cdn_id', 'HomeLotSmall.unity3d', 'Main_Scene', 0)]
            # 'Scene_Unity3D': [Asset(object_id, 'asset_type', 'non_existing_cdn_id', 'Springtime003.unity3d', 'Main_Scene', 0)]
        }, [])

        player_maze = PlayerMaze(
            object_id, 'coremaze', 42, None, dt.datetime.now(
            ), 1, 1, 1, False, True, True, False, object_id, [], home_theme, object_id, object_id
        )

        self.response.home = PlayerHome(
            player_maze, 'kek', True, dt.datetime.now(), home_theme, object_id, [player_maze])
Example #15
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        object_id = ObjectID(0, 0, 0, 0)

        avatar = Avatar(
            aw_object_id=object_id,
            asset_map={
                "Prefab_Unity3D": [
                    Asset(ObjectID(0, 0, 0, 0), 'asset_type', 'assets/Player_Avatar.unity3d',
                          'Player_Avatar.unity3d', 'asset_group', 59109),  # !(item.resName == "PF__Avatar.unity3d")
                ],
            },
            asset_packages=[],
            dimensions='1',
            weight=1,
            height=1,
            max_outfits=1,
            name='avatar_name')

        # activePlayerAvatar should be in AvatarManager.Instance.GSFPlayerAvatars: LoadAvatarsCommand.cs -> Step2()
        self.response.avatars = [
            PlayerAvatar(
                aw_object_id=object_id,
                avatar=avatar,
                player_id=object_id,
                name='player_name',
                bio='player_bio',
                secret_code='1234',
                create_ts=dt.datetime.now(),
                player_avatar_outfit_id=object_id,
                outfit_no=10,
                play_time=11,
                last_play=dt.datetime.now())
        ]
Example #16
0
    async def process_message(self, peer_name: str,
                              data: bytearray) -> BitStream:
        request_bs = BitStream(data)
        message_header = MessageHeader()
        message_header.deserialize(request_bs)
        message = self.message_factory.build_message(message_header)

        if not message:
            log(
                LogLevel.WARN,
                '{} [bold yellow]<{}>[/] is not supported yet: {}'.format(
                    peer_name, message_header.message_type,
                    bytes(request_bs.data)))
            return

        if message_header.is_response:
            log(
                LogLevel.WARN,
                '{} [bold yellow]<{}>[/] responses from client are not supported yet: {}'
                .format(peer_name, message_header.message_type,
                        bytes(request_bs.data)))
            return

        message.request.deserialize(request_bs)
        await message.process(message_header)
        message_header.is_response = True

        log(
            LogLevel.INFO,
            '{} Processed [bold blue]<{}>[/] with [bold blue]<{}> <{}>[/]'.
            format(peer_name, message_header.message_type,
                   message_header.result_code, message_header.app_code))

        response_bs = BitStream()
        message_header.serialize(response_bs)
        message.response.serialize(response_bs)

        log(
            LogLevel.DEBUG, '=>', {
                'request_bs': bytes(request_bs.data),
                'response_bs': bytes(response_bs.data),
                'request': message.request.to_dict(),
                'response': message.response.to_dict()
            })

        return response_bs
Example #17
0
 async def process_message(self, peer_name: str, data: bytearray) -> BitStream:
     request_bs = BitStream(data)
     message_header = MessageHeader()
     message_header.deserialize(request_bs)
     message = self.message_factory.build_message(message_header)
     if message:
         message.request.deserialize(request_bs)
         log(f'{peer_name} Request <{message_header}> {message.request}', LogLevel.TRACE)
         await message.process(message_header)
         if message.response:
             message_header.is_response = True
             log(f'{peer_name} Response <{message_header}> {message.response}', LogLevel.TRACE)
             response_bs = BitStream()
             message_header.serialize(response_bs)
             message.response.serialize(response_bs)
             return response_bs
         else:
             log(f'{peer_name} No Response <{message_header.message_type}>', LogLevel.TRACE)
     else:
         log(f'{peer_name} Request <{message_header.message_type}> is not supported yet: {bytes(request_bs.data)}',
             LogLevel.WARN)
Example #18
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.announcements = []
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.online_statuses = []
Example #20
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.player_build_objects = []
Example #21
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.player_avatar_outfits = []
Example #22
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.chat_channel_types = []
Example #23
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.player_missions = [
        ]  # nested classes are not implemented
Example #24
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.relationships = []
Example #25
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        object_id = ObjectID(0, 0, 0, 0)

        self.response.site_info = SiteInfo(
            site_id=object_id,
            nickname_first='nickname_first',
            nickname_last='nickname_last',
            site_user_id=object_id)

        self.response.session_status = SessionStatus.IN_PROGRESS
        self.response.session_id = object_id
        self.response.conversation_id = 5
        self.response.asset_delivery_url = 'http://localhost:8080/'

        avatar = Avatar(
            aw_object_id=object_id,
            asset_map={
                "Prefab_Unity3D": [
                    Asset(ObjectID(0, 0, 0, 0), 'asset_type', 'assets/Player_Avatar.unity3d',
                          'Player_Avatar.unity3d', 'asset_group', 59109),  # !(item.resName == "PF__Avatar.unity3d")
                ],
            },
            asset_packages=[],
            dimensions='1',
            weight=1,
            height=1,
            max_outfits=1,
            name='avatar_name')

        player_avatar = PlayerAvatar(
            aw_object_id=object_id,
            avatar=avatar,
            player_id=object_id,
            name='AMAZING_CORE',
            bio='player_bio',
            secret_code='1234',
            create_ts=dt.datetime.now(),
            player_avatar_outfit_id=object_id,
            outfit_no=10,
            play_time=11,
            last_play=dt.datetime.now())

        race_mode = RaceMode(aw_object_id=object_id, name='race_name')

        self.response.player = Player(
            aw_object_id=object_id,
            create_date=dt.datetime.now(),
            active_player_avatar=player_avatar,
            home_theme_id=object_id,
            current_race_mode=race_mode,
            workshop_options='workshop_options',
            is_tutorial_completed=False,
            yard_building_id=object_id,
            last_login=dt.datetime.now(),
            play_time=12,
            is_qa=True,
            home_village_plot_id=object_id,
            store_village_plot_id=object_id,
            player_store_id=object_id,
            player_maze_id=object_id,
            village_id=object_id)

        self.response.max_outfit = 13
        self.response.player_stats = []

        crisp_data = CrispData(
            crisp_action_id=object_id,
            crisp_message='crisp_message',
            crisp_expiry_date=dt.datetime.now() + dt.timedelta(days=1),
            crisp_confirmed=True)

        # player_setting_1 = PlayerSetting(
        #     aw_object_id=object_id,
        #     player_id=object_id,
        #     setting_name='setting_name',
        #     value='value')

        self.response.player_info = PlayerInfo(
            tier_id=object_id,
            player_name='omnio',
            world_name='2021',
            crisp_data=crisp_data,
            verified=True,
            verification_expiry=dt.datetime.now() + dt.timedelta(days=1),
            scs_block_expiry=dt.datetime.now() + dt.timedelta(days=1),
            eula_id=object_id,
            current_eula_id=object_id,
            u_13=True,
            chat_blocked_parent=False,
            chat_allowed=True,
            chat_blocked_expiry=dt.datetime.now() + dt.timedelta(days=1),
            findable=True,
            findable_date=dt.datetime.now() + dt.timedelta(days=1),
            user_subscription_expiry_date=dt.datetime.now() + dt.timedelta(days=1),
            qa=True,
            player_settings=[])

        self.response.current_server_time = dt.datetime.now()
        self.response.system_lockout_time = dt.datetime.now() + dt.timedelta(days=1)
        self.response.system_shutdown_time = dt.datetime.now() + dt.timedelta(days=1)
        self.response.client_inactivity_timeout = 365
        self.response.cnl = 'cnl'
Example #26
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.maze_items = []
Example #27
0
 async def process(self, message_header: MessageHeader):
     message_header.result_code = ResultCode.OK
     message_header.app_code = AppCode.OK
     self.response.player_id = ObjectID(1, 2, 3, 4)
Example #28
0
 async def process(self, message_header: MessageHeader):
     # restrict new username patterns
     if self.request.name.lower().find('f**k') != -1:
         self.response.filter_name = 'bad'
     message_header.result_code = ResultCode.OK
     message_header.app_code = AppCode.OK
Example #29
0
 async def process(self, message_header: MessageHeader):
     message_header.result_code = ResultCode.OK
     message_header.app_code = AppCode.OK
Example #30
0
    async def process(self, message_header: MessageHeader):
        message_header.result_code = ResultCode.OK
        message_header.app_code = AppCode.OK

        self.response.building_id = ObjectID(0, 0, 0, 0)