Ejemplo n.º 1
0
    def sendShamanItems(this):
        packet = ByteArray()

        shamanItems = [] if this.client.shamanItems == "" else this.client.shamanItems.split(
            ",")
        packet.writeShort(len(shamanItems))

        for item in shamanItems:
            if "_" in item:
                itemSplited = item.split("_")
                realItem = itemSplited[0]
                custom = itemSplited[1] if len(itemSplited) >= 2 else ""
                realCustom = [] if custom == "" else custom.split("+")

                packet.writeShort(int(realItem))
                packet.writeBool(item in this.client.shamanLook.split(","))
                packet.writeByte(len(realCustom) + 1)

                x = 0
                while x < len(realCustom):
                    packet.writeInt(int(realCustom[x], 16))
                    x += 1
            else:
                packet.writeShort(int(item)).writeBool(
                    item in this.client.shamanLook.split(",")).writeByte(0)

        this.client.sendPacket(Identifiers.send.Shaman_Items,
                               packet.toByteArray(), True)
Ejemplo n.º 2
0
    def sendShamanSkills(this, newBoolean):
        p = ByteArray().writeByte(len(this.client.playerSkills))
        for skill in this.client.playerSkills.items():
            p.writeByte(skill[0]).writeByte(skill[1])

        this.client.sendPacket(Identifiers.send.Shaman_Skills, p.writeBool(newBoolean).toByteArray(), True)
Ejemplo n.º 3
0
 def sendShamanSkills(this):
     p = ByteArray().writeByte(len(this.client.playerSkills))
     for skill in this.client.playerSkills.items():
         p.writeByte(skill[0]).writeByte(skill[1])
     p.writeBool(this.client.isSkill)
     this.client.sendPacket(Identifiers.send.Shaman_Skills, p.toByteArray())
Ejemplo n.º 4
0
    def sendShopList(this, sendItems=True):
        shopItems = [] if this.client.shopItems == "" else this.client.shopItems.split(
            ",")

        packet = ByteArray().writeInt(this.client.shopCheeses).writeInt(
            this.client.shopFraises).writeUTF(this.client.playerLook).writeInt(
                len(shopItems))
        for item in shopItems:
            if "_" in item:
                itemSplited = item.split("_")
                realItem = itemSplited[0]
                custom = itemSplited[1] if len(itemSplited) >= 2 else ""
                realCustom = [] if custom == "" else custom.split("+")

                packet.writeByte(len(realCustom) + 1).writeInt(int(realItem))

                x = 0
                while x < len(realCustom):
                    packet.writeInt(int(realCustom[x], 16))
                    x += 1
            else:
                packet.writeByte(0).writeInt(int(item))

        shop = this.server.shopList if sendItems else []
        packet.writeInt(len(shop))

        for item in shop:
            value = item.split(",")
            packet.writeShort(int(value[0]))
            packet.writeShort(int(value[1])).writeByte(int(
                value[2])).writeByte(int(value[3])).writeByte(
                    int(value[4])).writeInt(int(value[5])).writeInt(
                        int(value[6])).writeShort(0)

        looks = []

        packet.writeByte(len(looks))
        for look in looks:
            packet.writeUTF(look[0])
            packet.writeByte(look[1])

        packet.writeByte(0)

        packet.writeByte(len(this.client.clothes))

        for clothe in this.client.clothes:
            clotheSplited = clothe.split("/")
            packet.writeUTF(clotheSplited[1] + ";" + clotheSplited[2] + ";" +
                            clotheSplited[3])

        shamanItems = [] if this.client.shamanItems == "" else this.client.shamanItems.split(
            ",")
        packet.writeShort(len(shamanItems))

        for item in shamanItems:
            if "_" in item:
                itemSplited = item.split("_")
                realItem = itemSplited[0]
                custom = itemSplited[1] if len(itemSplited) >= 2 else ""
                realCustom = [] if custom == "" else custom.split("+")

                packet.writeShort(int(realItem))

                packet.writeBool(item in this.client.shamanLook.split(
                    ",")).writeByte(len(realCustom) + 1)

                x = 0
                while x < len(realCustom):
                    packet.writeInt(int(realCustom[x], 16))
                    x += 1
            else:
                packet.writeShort(int(item)).writeBool(
                    item in this.client.shamanLook.split(",")).writeByte(0)

        shamanShop = this.server.shamanShopList if sendItems else []
        packet.writeShort(len(shamanShop))

        for item in shamanShop:
            value = item.split(",")
            packet.writeInt(int(value[0])).writeByte(int(value[1])).writeByte(
                int(value[2])).writeInt(int(value[3])).writeShort(int(
                    value[4]))

        this.client.sendPacket(Identifiers.send.Shop_List,
                               packet.toByteArray(), True)