示例#1
0
    def set_field(character, character_data, channel: int):
        packet = Packet(op_code=CSendOps.LP_SetField)
        # CPacket.cclient_opt_man__encode_opt(packet, 0)
        packet.encode_short(0)

        packet.encode_int(channel)
        packet.encode_int(0)

        packet.encode_byte(1)
        packet.encode_byte(character_data)
        packet.encode_short(0)

        if character_data:
            # character.random.encode(packet)
            packet.encode_int(0)
            packet.encode_int(0)
            packet.encode_int(0)
            character.encode(packet)

            packet.encode_int(0)
            packet.encode_int(0)
            packet.encode_int(0)
            packet.encode_int(0)

        else:
            packet.encode_byte(0)
            packet.encode_int(character.field_id)
            packet.encode_byte(character.stats.portal)
            packet.encode_int(character.stats.hp)
            packet.encode_byte(0)

        packet.encode_long(150842304000000000)

        return packet
示例#2
0
    def check_password_result(client: PendingLogin | None = None,
                              response=None):
        packet = Packet(op_code=CSendOps.LP_CheckPasswordResult)

        if response != 0:
            packet.encode_int(response)
            packet.encode_short(0)

        if not client:
            return packet

        packet.encode_byte(0)
        packet.encode_byte(0)
        packet.encode_int(0)

        packet.encode_int(client.account.id)
        packet.encode_byte(client.account.gender)
        packet.encode_byte(0)
        packet.encode_short(0)
        packet.encode_byte(0)
        packet.encode_string(client.account.username)
        packet.encode_byte(0)
        packet.encode_byte(0)
        packet.encode_long(0)
        packet.encode_long(0)
        packet.encode_int(4)

        packet.encode_byte(True)
        packet.encode_byte(1)

        packet.encode_long(0)

        return packet
示例#3
0
    def select_character_result(uid, port):
        packet = Packet(op_code=CSendOps.LP_SelectCharacterResult)

        packet.encode_byte(0)  # world
        packet.encode_byte(0)  # selected char

        packet.encode_buffer(constants.SERVER_ADDRESS)
        packet.encode_short(port)
        packet.encode_int(uid)
        packet.encode_byte(0)
        packet.encode_int(0)

        return packet
示例#4
0
    def world_information(world):

        packet = Packet(op_code=CSendOps.LP_WorldInformation)
        packet.encode_byte(world.id)
        packet.encode_string(world.name)
        packet.encode_byte(2)  # 0 : Normal 1 : Event 2 : New 3 : Hot
        packet.encode_string("Issa Event")
        packet.encode_short(100)
        packet.encode_short(100)
        packet.encode_byte(False)

        packet.encode_byte(2)

        for i in range(2):
            packet.encode_string(f"{world.name}-{i}")
            packet.encode_int(100)  # Online Count
            packet.encode_byte(1)
            packet.encode_byte(i)
            packet.encode_byte(False)

        packet.encode_short(0)

        return packet
示例#5
0
    def npc_enter_field(npc):
        packet = Packet(op_code=CSendOps.LP_NpcEnterField)
        packet.encode_int(npc.obj_id)
        packet.encode_int(npc.life_id)

        packet.encode_short(npc.x)
        packet.encode_short(abs(npc.cy))
        packet.encode_byte(npc.f != 1)
        packet.encode_short(npc.foothold)

        packet.encode_short(npc.rx0)
        packet.encode_short(npc.rx1)

        packet.encode_byte(True)

        return packet
示例#6
0
    def user_enter_field(character):
        packet = Packet(op_code=CSendOps.LP_UserEnterField)
        packet.encode_int(character.id)

        packet.encode_byte(character.stats.level)
        packet.encode_string(character.stats.name)

        packet.skip(8)

        packet.encode_long(0).encode_long(0).encode_byte(0).encode_byte(0)

        packet.encode_short(character.stats.job)
        character.encode_look(packet)

        packet.encode_int(0)  # driver ID
        packet.encode_int(0)  # passenger ID
        packet.encode_int(0)  # choco count
        packet.encode_int(0)  # active effeect item ID
        packet.encode_int(0)  # completed set item ID
        packet.encode_int(0)  # portable chair ID

        packet.encode_short(0)  # private?

        packet.encode_short(0)
        packet.encode_byte(character.position.stance)
        packet.encode_short(character.position.foothold)
        packet.encode_byte(0)  # show admin effect

        packet.encode_byte(0)  # pets?

        packet.encode_int(0)  # taming mob level
        packet.encode_int(0)  # taming mob exp
        packet.encode_int(0)  # taming mob fatigue

        packet.encode_byte(0)  # mini room type

        packet.encode_byte(0)  # ad board remote
        packet.encode_byte(0)  # on couple record add
        packet.encode_byte(0)  # on friend record add
        packet.encode_byte(0)  # on marriage record add

        packet.encode_byte(0)  # some sort of effect bit flag

        packet.encode_byte(0)  # new year card record add
        packet.encode_int(0)  # phase
        return packet