示例#1
0
        private static void HandleModifyExistingBeauty(GameSession session, PacketReader packet)
        {
            byte       unk           = packet.ReadByte();
            bool       useVoucher    = packet.ReadBool();
            long       beautyItemUid = packet.ReadLong();
            EquipColor equipColor    = packet.Read <EquipColor>();

            Item beautyItem = session.Player.GetEquippedItem(beautyItemUid);

            if (beautyItem.ItemSlot == ItemSlot.CP)
            {
                HatData hatData = packet.Read <HatData>();
                beautyItem.HatData = hatData;
                session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, beautyItem));
                return;
            }

            BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(session.Player.ShopId);

            if (!HandleShopPay(session, beautyShop, useVoucher))
            {
                return;
            }

            beautyItem.Color = equipColor;
            ModifyBeauty(session, packet, beautyItem);
        }
示例#2
0
    private static void HandleModifyExistingBeauty(GameSession session, PacketReader packet)
    {
        byte       unk           = packet.ReadByte();
        bool       useVoucher    = packet.ReadBool();
        long       beautyItemUid = packet.ReadLong();
        EquipColor equipColor    = packet.Read <EquipColor>();

        Item beautyItem = session.Player.Inventory.GetEquippedItem(beautyItemUid);

        if (beautyItem.ItemSlot is ItemSlot.CP) // This should only work with the mirror shop
        {
            HatData hatData = packet.Read <HatData>();
            beautyItem.HatData = hatData;
            session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.Player.FieldPlayer, beautyItem));
            return;
        }

        BeautyShop beautyShop = DatabaseManager.BeautyShops.FindById(session.Player.ShopId);

        if (beautyShop is null)
        {
            return;
        }

        if (!HandleShopPay(session, beautyShop, useVoucher))
        {
            return;
        }

        beautyItem.Color = equipColor;
        ModifyBeauty(session, packet, beautyItem);
    }
示例#3
0
        private static void HandleDyeItem(GameSession session, PacketReader packet)
        {
            BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(506);

            byte itemCount = packet.ReadByte();

            short[]      quantity     = new short[itemCount];
            bool[]       useVoucher   = new bool[itemCount];
            byte[]       unk1         = new byte[itemCount];
            long[]       unk2         = new long[itemCount];
            int[]        unk3         = new int[itemCount];
            long[]       itemUid      = new long[itemCount];
            int[]        itemId       = new int[itemCount];
            EquipColor[] equipColor   = new EquipColor[itemCount];
            int[]        paletteId    = new int[itemCount];
            CoordF[]     hatXPosition = new CoordF[itemCount];
            CoordF[]     hatYPosition = new CoordF[itemCount];
            CoordF[]     hatZPosition = new CoordF[itemCount];
            CoordF[]     hatRotation  = new CoordF[itemCount];
            int[]        hatScale     = new int[itemCount];

            for (int i = 0; i < itemCount; i++)
            {
                quantity[i]   = packet.ReadShort(); // should always be one
                useVoucher[i] = packet.ReadBool();
                unk1[i]       = packet.ReadByte();  // just 0
                unk2[i]       = packet.ReadLong();  // just 0
                unk3[i]       = packet.ReadInt();   // also 0
                itemUid[i]    = packet.ReadLong();
                itemId[i]     = packet.ReadInt();
                equipColor[i] = packet.Read <EquipColor>();
                paletteId[i]  = packet.ReadInt();
                Item item = session.Player.GetEquippedItem(itemUid[i]);
                if (item == null)
                {
                    return;
                }

                if (item.ItemSlot == ItemSlot.CP)
                {
                    hatXPosition[i] = packet.Read <CoordF>(); // TODO: implement correct hat positioning
                    hatYPosition[i] = packet.Read <CoordF>();
                    hatZPosition[i] = packet.Read <CoordF>();
                    hatRotation[i]  = packet.Read <CoordF>();
                    hatScale[i]     = packet.ReadInt();
                }

                if (!HandleShopPay(session, beautyShop, useVoucher[i]))
                {
                    return;
                }

                item.Color = equipColor[i];
                session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, item));
            }
        }
示例#4
0
        private static void HandleDyeItem(GameSession session, PacketReader packet)
        {
            BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(506);

            byte itemCount = packet.ReadByte();

            short[]      quantity   = new short[itemCount];
            bool[]       useVoucher = new bool[itemCount];
            byte[]       unk1       = new byte[itemCount];
            long[]       unk2       = new long[itemCount];
            int[]        unk3       = new int[itemCount];
            long[]       itemUid    = new long[itemCount];
            int[]        itemId     = new int[itemCount];
            EquipColor[] equipColor = new EquipColor[itemCount];
            HatData[]    hatData    = new HatData[itemCount];

            for (int i = 0; i < itemCount; i++)
            {
                quantity[i]   = packet.ReadShort(); // should always be one
                useVoucher[i] = packet.ReadBool();
                unk1[i]       = packet.ReadByte();  // just 0
                unk2[i]       = packet.ReadLong();  // just 0
                unk3[i]       = packet.ReadInt();   // also 0
                itemUid[i]    = packet.ReadLong();
                itemId[i]     = packet.ReadInt();
                equipColor[i] = packet.Read <EquipColor>();
                Item item = session.Player.GetEquippedItem(itemUid[i]);
                if (item == null)
                {
                    return;
                }

                if (!HandleShopPay(session, beautyShop, useVoucher[i]))
                {
                    return;
                }

                if (item.ItemSlot == ItemSlot.CP)
                {
                    hatData[i]   = packet.Read <HatData>();
                    item.HatData = hatData[i];
                }

                item.Color = equipColor[i];
                Console.WriteLine(item.Color);
                session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, item));
            }
        }