Ejemplo n.º 1
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
Ejemplo n.º 2
0
    def send_recommended_world(worlds):
        packet = Packet(op_code=CSendOps.LP_RecommendWorldMessage)
        packet.encode_byte(len(worlds))

        for world in worlds:
            packet.encode_int(world.id)
            packet.encode_string(world.event_message)

        return packet
Ejemplo n.º 3
0
    def broadcast_msg(type_, msg):
        packet = Packet(op_code=CSendOps.LP_BroadcastMsg)
        packet.encode_byte(type_)

        if type_ == 4:
            packet.encode_byte(True)

        packet.encode_string(msg)
        return packet
Ejemplo n.º 4
0
    def npc_script_message(npc, msg_type, msg, end_bytes, type_, other_npc):
        packet = Packet(op_code=CSendOps.LP_ScriptMessage)

        packet.encode_byte(4)
        packet.encode_int(npc)
        packet.encode_byte(msg_type)
        packet.encode_byte(type_)

        if type_ in [4, 5]:
            packet.encode_int(other_npc)

        packet.encode_string(msg)

        if end_bytes:
            packet.encode(bytes(end_bytes))

        return packet
Ejemplo n.º 5
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
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def check_duplicated_id_result(name, is_available):
     packet = Packet(op_code=CSendOps.LP_CheckDuplicatedIDResult)
     packet.encode_string(name)
     packet.encode_byte(is_available)
     return packet