コード例 #1
0
        public override void Handle(virtualUser User)
        {
            //N***a will invade the world.
            bool   Equip        = (getBlock(0) == "0") ? true : false;
            int    Class        = Convert.ToInt32(getBlock(1));
            string Code         = getBlock(4);
            int    WhereToPlace = Convert.ToInt32(getBlock(5));

            string Costume = getCostume(User, Class);

            Item Item = ItemManager.getItem(Code);

            {
                if (Equip == true)
                {
                    string[] Placment = Costume.Split(new char[] { ',' });
                    if (Code.Contains("BA"))
                    {
                        for (int I = 0; I < Placment.Length; I++)
                        {
                            Placment[I] = "^";
                        }
                        Placment[0] = Code;
                    }
                    else
                    {
                        Placment[WhereToPlace] = Code;
                    }
                    string newCostumeParts = string.Join(",", Placment);
                    Code = newCostumeParts;
                    updateCostume(User, Class, Code);
                    DB.runQuery("UPDATE users_costumes SET class_" + Class + "='" + Code + "' WHERE ownerid='" + User.UserID + "'");
                }
                else
                {
                    string[] Placment = Costume.Split(new char[] { ',' });
                    if (Code.Contains("BA"))
                    {
                        for (int I = 0; I < Placment.Length; I++)
                        {
                            Placment[I] = "^";
                        }
                        Placment[0] = getDefaultClass(Class);
                    }
                    else
                    {
                        Placment[WhereToPlace] = "^";
                    }
                    string newCostumeParts = string.Join(",", Placment);
                    Code = newCostumeParts;
                    updateCostume(User, Class, Code);
                    DB.runQuery("UPDATE users_costumes SET class_" + Class + "='" + Code + "' WHERE ownerid='" + User.UserID + "'");
                }
            }
            User.send(new Packets.PACKET_COSTUME_EQUIPMENT(User, Class, Code));
            User.reloadCash();
        }
コード例 #2
0
        public override void Handle(virtualUser User)
        {
            int    ID             = Convert.ToInt32(getBlock(0));
            int    Days           = 0;
            int    CouponToRemove = 0;
            string WeaponToBuy    = null;

            #region Calculate
            switch (ID)
            {
            case 0: WeaponToBuy = "DS01"; Days = 3; CouponToRemove = 5; break;

            case 1: WeaponToBuy = "DS10"; Days = 3; CouponToRemove = 10; break;

            case 2: WeaponToBuy = "DS03"; Days = 3; CouponToRemove = 10; break;

            case 3: WeaponToBuy = "DF15"; Days = 3; CouponToRemove = 20; break;

            case 4: WeaponToBuy = "DG40"; Days = 3; CouponToRemove = 25; break;

            case 5: WeaponToBuy = "DJ35"; Days = 3; CouponToRemove = 30; break;

            case 6: WeaponToBuy = "CC41"; Days = 1; CouponToRemove = 30; break;

            case 7: WeaponToBuy = "DG22"; Days = 3; CouponToRemove = 35; break;

            case 8: WeaponToBuy = "DC77"; Days = 7; CouponToRemove = 45; break;

            default: User.disconnect(); break;
            }
            #endregion
            if (User.Coupons >= CouponToRemove)
            {
                int InventorySlot = User.InventorySlots;
                if (InventorySlot > 0)
                {
                    User.Coupons -= CouponToRemove;
                    DB.runQuery("UPDATE users SET coupons='" + User.Coupons + "' WHERE id='" + User.UserID + "'");
                    if (WeaponToBuy == null)
                    {
                        User.disconnect();
                    }
                    User.AddItem(WeaponToBuy, Days, 1);
                    User.send(new PACKET_COUPON_BUY(WeaponToBuy, User));
                    User.send(new PACKET_COUPON_EVENT(User));
                    User.reloadCash();
                }
                else
                {
                    User.send(new PACKET_ITEMSHOP(PACKET_ITEMSHOP.ErrorCodes.InventoryFull, "NULL"));
                }
            }
            else
            {
                User.send(new PACKET_COUPON_BUY(PACKET_COUPON_BUY.ErrorCode.NotEnoughCoupons));
            }
        }