Exemple #1
0
    protected override void Execute()
    {
        if (!WoCheckLoginSession())
        {
            return;
        }

        string CustomerID = web.CustomerID();
        string ItemID     = web.Param("ItemID");
        string BuyIdx     = web.Param("BuyIdx");

        SqlCommand sqcmd = new SqlCommand();

        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
        sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
        sqcmd.Parameters.AddWithValue("@in_ItemId", ItemID);
        sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

        if (!CallWOApi(sqcmd))
        {
            return;
        }

        reader.Read();
        int balance = getInt("Balance");

        Response.Write("WO_0");
        Response.Write(string.Format("{0}", balance));
    }
    protected override void Execute()
    {
        if (!WoCheckLoginSession())
        {
            return;
        }

        string CustomerID = web.CustomerID();
        string LoadoutID  = web.Param("LoadoutID");
        string Class      = web.Param("Class");

        int balance = 0;

        // try to buy
        {
            int LOADOUT_RESET_ITEMID = 301150;    // special item for loadout reset

            // permanent real $ buying
            string BuyIdx = "4";
            if (ConfigurationManager.AppSettings.Get("WO_Region") == "RU")
            {
                BuyIdx = "12";
            }

            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_ItemId", LOADOUT_RESET_ITEMID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            reader.Read();
            balance = getInt("Balance");
        }

        // ok, reset loadout
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_LoadoutResetClass";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_LoadoutID", LoadoutID);
            sqcmd.Parameters.AddWithValue("@in_Class", Class);

            if (!CallWOApi(sqcmd))
            {
                return;
            }
        }

        Response.Write("WO_0");
    }
Exemple #3
0
    void BuyAttachment()
    {
        string CustomerID = web.CustomerID();
        string WeaponID   = web.Param("WeaponID");
        string AttachID   = web.Param("AttachID");
        string Slot       = web.Param("Slot");
        string BuyIdx     = web.Param("BuyIdx");

        // check if attachment is valid
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_WeaponAttachCheckBuy";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_WeaponID", WeaponID);
            sqcmd.Parameters.AddWithValue("@in_AttachmentID", AttachID);
            sqcmd.Parameters.AddWithValue("@in_Slot", Slot);

            if (!CallWOApi(sqcmd))
            {
                return;
            }
        }

        int balance = 0;

        // buy attachment item for specified weapon
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_ItemId", AttachID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));
            sqcmd.Parameters.AddWithValue("@in_Param1", WeaponID);

            if (!CallWOApi(sqcmd))
            {
                return;
            }
        }

        // return new balance
        reader.Read();
        balance = getInt("Balance");
        Response.Write("WO_0");
        Response.Write(string.Format("{0}", balance));
    }
    void RollBox()
    {
        string CustomerID = web.CustomerID();
        string ItemID     = web.Param("ItemID");
        string BuyIdx     = web.Param("BuyIdx");

        // step 1: read loot box info
        ReadLootInfo(ItemID);

        // only storecat_MysteryBox can be bought for GD
        if (category_ != 3 && BuyItem3.IsGD(BuyIdx))
        {
            throw new ApiExitException("can't buy loot for GD");
        }

        // step 2: see what we won
        WinData win = GetWinning();

        // step 3: actually buy item
        int balance = 0;

        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_ItemId", ItemID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            reader.Read();
            balance = getInt("Balance");
        }

        // step 4: add winning!
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_LootAddReward";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_Roll", win.Roll);
            sqcmd.Parameters.AddWithValue("@in_LootID", ItemID);
            sqcmd.Parameters.AddWithValue("@in_ItemID", win.ItemID.ToString());
            sqcmd.Parameters.AddWithValue("@in_ExpDays", win.ExpDays.ToString());
            sqcmd.Parameters.AddWithValue("@in_GD", win.GD.ToString());

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            // overwrite GD result from procedure
            reader.Read();
            win.GD = getInt("GD");
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1} {2} {3}", win.ItemID, win.ExpDays, win.GD, balance));

        return;
    }
    protected override void Execute()
    {
        if (!WoCheckLoginSession())
        {
            return;
        }

        string CustomerID = web.CustomerID();
        string ItemID     = web.Param("ItemID");
        string BuyIdx     = web.Param("BuyIdx");
        string gametag    = web.Param("gametag");

        if (!ValidateGamertag(gametag))
        {
            Response.Write("WO_4");
            return;
        }

        // check if gamer tag exists
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_ChangeGamertag";
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_GamerTag", gametag);
            sqcmd.Parameters.AddWithValue("@in_ActualExec", 0);

            if (!CallWOApi(sqcmd))
            {
                return;
            }
        }

        int balance = 0;

        // try to buy
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_ItemId", ItemID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            reader.Read();
            balance = getInt("Balance");
        }

        // ok, change gamer tag
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_ChangeGamertag";
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_GamerTag", gametag);
            sqcmd.Parameters.AddWithValue("@in_ActualExec", 1);

            if (!CallWOApi(sqcmd))
            {
                return;
            }
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0}", balance));
    }