示例#1
0
        public static void Gifts_Req(InPacket lea, Client c)
        {
            int    ItemID        = lea.ReadInt();
            string ItemName      = lea.ReadString(62);
            string CharacterName = lea.ReadString(20);
            int    Type          = 1;

            if (CashShopFactory.GetItemData(ItemID) == null)
            {
                return;
            }

            c.Account.GamePoints -= CashShopFactory.GetItemData(ItemID).BargainPrice;
            c.Account.Save();

            dynamic datum = new Datum("gifts");

            datum.name     = CharacterName;
            datum.itemID   = ItemID;
            datum.itemName = ItemName;
            datum.receive  = 0;
            datum.Insert();

            CashShopPacket.Gifts(c, Type);
            CashShopPacket.MgameCash(c);
            CashShopPacket.GuiHonCash(c);
        }
示例#2
0
        public static void BuyCommodity_Req(InPacket lea, Client c)
        {
            int    ItemID   = lea.ReadInt();
            string ItemName = lea.ReadString(62);
            short  Quantity = 1;
            bool   IsLocked = true;

            var chr = c.Character;

            if (CashShopFactory.GetItemData(ItemID) == null)
            {
                return;
            }

            if (ItemID == 8842002)
            {
                Quantity = 10;
            }

            if (ItemID == 8841001 || ItemID == 8841002 || ItemID == 8841003 || ItemID == 8841004 || ItemID == 8841005)
            {
                Quantity = 20;
            }

            if (ItemID == 8890031 || ItemID == 8890037)             // 鞭炮 + 心花怒放
            {
                Quantity = 100;
            }

            if (ItemID / 100000 == 92 || ItemID == 8890031 || ItemID == 8890037)             // 寵物 + 鞭炮 + 心花怒放
            {
                IsLocked = false;
            }

            // 購買日誌
            dynamic datum = new Datum("BuyCommodityLog");

            datum.name     = chr.Name;
            datum.itemID   = ItemID;
            datum.itemName = ItemName;
            datum.Insert();

            c.Account.GamePoints -= CashShopFactory.GetItemData(ItemID).BargainPrice;
            c.Account.Save();

            chr.Items.Add(new Item(ItemID, IsLocked, 0, -1, (byte)InventoryType.ItemType.Cash,
                                   chr.Items.GetNextFreeSlot(InventoryType.ItemType.Cash), Quantity));
            chr.Items.Save();
            CashShopPacket.BuyCommodity(c);
            CashShopPacket.MgameCash(c);
            CashShopPacket.GuiHonCash(c);
            InventoryPacket.getInvenCash(c);
        }