コード例 #1
0
ファイル: phantom_physics.py プロジェクト: luxaritas/PyLUS
 def __init__(self,
              pos=Vector3(0, 0, 0),
              rot=Vector4(0, 0, 0, 0),
              effect=False,
              effect_type=0,
              effect_amount=0,
              effect_direction=Vector3(0, 0, 0)):
     super().__init__(**{k: v for k, v in locals().items() if k != 'self'})
コード例 #2
0
 def __init__(self,
              jetpack=False,
              jetpack_effect=0,
              player=True,
              player_pos=Vector3(0, 0, 0),
              player_rot=Vector4(0, 0, 0, 0),
              player_ground=True,
              player_rail=False,
              player_velocity=False,
              player_velocity_vec=Vector3(0, 0, 0),
              player_angular_velocity=False,
              player_angular_velocity_vec=Vector3(0, 0, 0),
              player_platform=False):
     super().__init__(**{k: v for k, v in locals().items() if k != 'self'})
コード例 #3
0
    def client_load_complete(self, packet, conn: Connection):
        session = self.server.handle_until_return('session:get_session',
                                                  conn.get_address())

        char_info = DetailedUserInfo(session.account.user.pk,
                                     session.character.name,
                                     ZONE_IDS[self.server.type],
                                     session.character.pk,
                                     missions=[
                                         Mission(mission=1727,
                                                 character=session.character,
                                                 state=8,
                                                 times_completed=1,
                                                 last_completion=0)
                                     ])
        conn.send(char_info)

        self.server.repman.add_participant(conn)

        player = Player(session.character,
                        Vector3(*ZONE_SPAWNPOINTS[ZONE_IDS[self.server.type]]),
                        Vector4(0, 0, 0))
        self.server.repman.construct(player, True)

        obj_load = ServerGameMessage(session.character.pk,
                                     GameMessageID.DONE_LOADING_OBJECTS)
        conn.send(obj_load)

        player_ready = ServerGameMessage(session.character.pk,
                                         GameMessageID.PLAYER_READY)
        conn.send(player_ready)
コード例 #4
0
ファイル: player.py プロジェクト: luxaritas/PyLUS
    def __init__(self, char, pos=Vector3(0, 0, 0), rot=Vector4(0, 0, 0, 0)):
        super().__init__(char.pk, 1, char.name)
        control = ControllablePhysics(player=True,
                                      player_pos=pos,
                                      player_rot=rot)
        destructible = Destructible()
        stats = Stats()
        character = Character(shirt_color=char.shirt_color,
                              hair_style=char.hair_style,
                              hair_color=char.hair_color,
                              pants_color=char.pants_color,
                              eyebrows=char.eyebrows,
                              eyes=char.eyes,
                              account_id=char.account.user.pk)

        inventory = Inventory()
        script = Script()
        skill = Skill()
        render = Render()
        component107 = Component107()

        self.components = [
            control, destructible, stats, character, inventory, script, skill,
            render, component107
        ]
コード例 #5
0
 def __init__(self,
              state=2,
              success=False,
              enabled=True,
              start=0,
              paused=0,
              activator_pos=Vector3(0, 0, 0)):
     super().__init__(**{k: v for k, v in locals().items() if k != 'self'})
コード例 #6
0
    def get_components(self):
        """
        Returns all components for this object
        """
        order = [108, 61, 1, 3, 20, 30, 40, 7, 23, 26, 4, 19, 17, 5, 9, 60, 48, 25, 49, 16, 6, 39, 71, 75, 42, 2, 50, 107, 69, 116]

        sorted_order = sorted(order)
        nums = [x for x in range(sorted_order[0], sorted_order[-1] + 1)]
        order += list(set(order) ^ set(nums))

        order_dict = {k: v for v, k in enumerate(order)}

        comps = self.conn.execute('SELECT * FROM ComponentsRegistry WHERE id = ?', (self.lot,)).fetchall()

        comps.sort(key=lambda x: order_dict.get(x[1]))

        components = []

        for comp in comps:
            comp_type = comp[1]

            component = None

            if comp_type == 1:
                component = ControllablePhysics(player_pos=self.position, player_rot=self.rotation)
            elif comp_type == 2:
                component = Render(self.config.get('renderDisabled', False))
            elif comp_type == 3:
                component = SimplePhysics(self.position, self.rotation)
            elif comp_type == 4:
                component = Character()  # TODO: read stuff from config?
            elif comp_type == 5:
                component = Script()  # TODO: read stuff from config?
            elif comp_type == 6:
                component = Bouncer()
            elif comp_type == 7:
                component = Destructible()
            elif comp_type == 9:
                component = Skill()  # TODO: read stuff from config?
            elif comp_type == 40:
                component = PhantomPhysics(self.position, self.rotation)  # TODO: read stuff from config?
            elif comp_type == 48:
                component = [
                    Stats(stats=False),
                    Rebuild(activator_pos=Vector3.from_ldf(self.config['rebuild_activators'])),
                ]
            elif comp_type == 107:
                component = Component107()
            else:
                log.debug(f'Unhandled component type in {self.name}: {comp_type}')

            if component:
                if isinstance(component, list):
                    components.extend(component)
                else:
                    components.append(component)

        return components
コード例 #7
0
    def __init__(self, file, server_zone):
        self.conn = sqlite3.connect('client_assets/cdclient.sqlite')
        self.scenes = []

        with open(file, 'rb') as file:
            self.data = file.read()
            self.size = len(self.data)
            self.stream = ReadStream(self.data, unlocked=True)

        self.version = self.stream.read(c_uint)
        assert self.version in (36, 38, 39, 40, 41), 'Unknown LUZ version ' + self.version
        self.unknown1 = self.stream.read(c_uint)
        self.world_id = self.stream.read(c_uint)

        if self.version >= 38:
            self.spawnpoint = Vector3(self.stream.read(c_float), self.stream.read(c_float), self.stream.read(c_float))
            self.spawnpoint_rot = LVLVector4(self.stream.read(c_float), self.stream.read(c_float), self.stream.read(c_float),
                                          self.stream.read(c_float))
        else:
            # TODO: Verify what should actually happen in versions < 38
            self.spawnpoint = Vector3(0,0,0)
            self.spawnpoint_rot = Vector4(0,0,0,0)

        if self.version >= 37:
            self.num_scenes = self.stream.read(c_uint)
        else:
            self.num_scenes = self.stream.read(c_ubyte)

        for _ in range(self.num_scenes):
            filename = self.stream.read(bytes, length_type=c_ubyte).decode('latin1')
            scene_id = self.stream.read(c_uint64)
            scene_name = self.stream.read(bytes, length_type=c_ubyte).decode('latin1')
            assert self.stream.read(bytes, length=3)
            lvl_path = os.path.join('client_assets', 'lvl', server_zone, filename)

            if os.path.exists(lvl_path):
                with open(lvl_path, 'rb') as file:
                    objects = self.get_lvl_objects(ReadStream(file.read(), unlocked=True))
                    self.scenes.append(LUScene(scene_id, scene_name, objects))
            else:
                self.scenes.append(LUScene(scene_id, scene_name))
コード例 #8
0
    def load_world(self, session, conn: Connection):
        zone_id = ZONE_IDS[self.server.type]
        self.server.handle('world:zone_entered', session, zone_id)

        res = WorldInfo(
            zone_id,
            0,  # Instance
            0,  # Clone
            ZONE_CHECKSUMS[zone_id],
            Vector3(*ZONE_SPAWNPOINTS[zone_id]),
            0)  # Activity

        conn.send(res)
コード例 #9
0
ファイル: simple_physics.py プロジェクト: luxaritas/PyLUS
 def __init__(self, pos=Vector3(0, 0, 0), rot=Vector4(0, 0, 0, 0)):
     super().__init__(**{k: v for k, v in locals().items() if k != 'self'})