Exemplo n.º 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));
    }
Exemplo n.º 2
0
    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");
    }
Exemplo n.º 3
0
    void CharRevive()
    {
        string CustomerID = web.CustomerID();
        string CharID     = web.Param("CharID");

        int NeedMoney;
        int SecToRevive;

        APICharReviveCheck(out NeedMoney, out SecToRevive);

        // buy revive item if we must
        if (NeedMoney > 0)
        {
            // make sure that client understand that we're reviving with money
            int ClientNeedMoney = web.GetInt("NeedMoney");
            if (NeedMoney > 0 && ClientNeedMoney == 0)
            {
                throw new ApiExitException("client must ack revive");
            }

            int CHAR_REVIVE_ITEMID = 301159;

            // permanent real $ buying
            string BuyIdx = "4";

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

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

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

        // actual revive
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_CharRevive";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_CharID", CharID);

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

            Response.Write("WO_0");
        }
    }
Exemplo n.º 4
0
    void ClanBuySlots()
    {
        // calc item id for add members
        int idx = web.GetInt("idx");

        if (idx < 0 || idx >= 6)
        {
            throw new ApiExitException("bad idx");
        }

        int CLAN_ADDMEMBERS_ITEMID = 301152 + idx;

        // step 1 - buy upgrade item
        int balance = 0;
        {
            // 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", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_ItemId", CLAN_ADDMEMBERS_ITEMID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);

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

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

        // step 2: actually add slots
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_ClanAddClanMembers";
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_ItemID", CLAN_ADDMEMBERS_ITEMID);

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

            Response.Write("WO_0");
        }
    }
Exemplo n.º 5
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));
    }
Exemplo n.º 6
0
    void CreateClan()
    {
        string ClanName        = web.Param("ClanName");
        string ClanNameColor   = web.Param("ClanNameColor");
        string ClanTag         = web.Param("ClanTag");
        string ClanTagColor    = web.Param("ClanTagColor");
        string ClanEmblemID    = web.Param("ClanEmblemID");
        string ClanEmblemColor = web.Param("ClanEmblemColor");

        // see if we can create clan without money
        {
            if (ClanName.Length < 1)
            {
                throw new ApiExitException("ClanName too small");
            }
            if (ClanTag.Length < 1)
            {
                throw new ApiExitException("ClanTag too small");
            }

            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_ClanCreateCheckParams";
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_ClanName", ClanName);
            sqcmd.Parameters.AddWithValue("@in_ClanTag", ClanTag);

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

        int NeedMoney = IsNeedMoney();
        int balance   = 0;

        if (NeedMoney > 0)
        {
            int CLAN_CREATE_ITEMID = 301151;

            // permanent real $ buying
            string BuyIdx = "4";

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

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

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

        // actually create the clan
        int ClanID = 0;

        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_ClanCreate";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_ClanName", ClanName);
            sqcmd.Parameters.AddWithValue("@in_ClanNameColor", ClanNameColor);
            sqcmd.Parameters.AddWithValue("@in_ClanTag", ClanTag);
            sqcmd.Parameters.AddWithValue("@in_ClanTagColor", ClanTagColor);
            sqcmd.Parameters.AddWithValue("@in_ClanEmblemID", ClanEmblemID);
            sqcmd.Parameters.AddWithValue("@in_ClanEmblemColor", ClanEmblemColor);

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

            reader.Read();
            ClanID = getInt("ClanID");
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1}", ClanID, balance));
    }
Exemplo n.º 7
0
    void CreateClan()
    {
        string ClanName        = web.Param("ClanName");
        string ClanNameColor   = web.Param("ClanNameColor");
        string ClanTag         = web.Param("ClanTag");
        string ClanTagColor    = web.Param("ClanTagColor");
        string ClanEmblemID    = web.Param("ClanEmblemID");
        string ClanEmblemColor = web.Param("ClanEmblemColor");
        string rexClanValidate = @"^[a-zA-Z0-9]+$";

        if (ClanName.IndexOfAny("!@#$%^&*()-=+_<>,./?'\":;|{}[]".ToCharArray()) >= 0) // do not allow this symbols
        {
            Response.Write("WO_1");
            Response.Write("Clan name cannot contain special symbols");
            return;
        }

        if (!Regex.IsMatch(ClanName, rexClanValidate))
        {
            Response.Write("WO_1");
            Response.Write("Clan name cannot contain special symbols");
            return;
        }

        if (ClanTag.IndexOfAny("!@#$%^&*()-=+_<>,./?'\":;|{}[]".ToCharArray()) >= 0) // do not allow this symbols
        {
            Response.Write("WO_2");
            Response.Write("Clan tag cannot contain special symbols");
            return;
        }

        if (!Regex.IsMatch(ClanTag, rexClanValidate))
        {
            Response.Write("WO_1");
            Response.Write("Clan tag cannot contain special symbols");
            return;
        }

        // see if we can create clan without money
        {
            if (ClanName.Length < 1)
            {
                throw new ApiExitException("ClanName too small");
            }
            if (ClanTag.Length < 1)
            {
                throw new ApiExitException("ClanTag too small");
            }

            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_ClanCreateCheckParams";
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_ClanName", ClanName);
            sqcmd.Parameters.AddWithValue("@in_ClanTag", ClanTag);

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

        int NeedMoney = IsNeedMoney();
        int balance   = 0;

        if (NeedMoney > 0)
        {
            int CLAN_CREATE_ITEMID = 301151;

            // 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", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_ItemId", CLAN_CREATE_ITEMID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);

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

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

        // actually create the clan
        int ClanID = 0;

        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_ClanCreate";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_ClanName", ClanName);
            sqcmd.Parameters.AddWithValue("@in_ClanNameColor", ClanNameColor);
            sqcmd.Parameters.AddWithValue("@in_ClanTag", ClanTag);
            sqcmd.Parameters.AddWithValue("@in_ClanTagColor", ClanTagColor);
            sqcmd.Parameters.AddWithValue("@in_ClanEmblemID", ClanEmblemID);
            sqcmd.Parameters.AddWithValue("@in_ClanEmblemColor", ClanEmblemColor);

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

            reader.Read();
            ClanID = getInt("ClanID");
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1}", ClanID, balance));
    }
Exemplo n.º 8
0
    void CharRename()
    {
        string Gamertag = web.Param("Gamertag");

        if (!CheckCharName(Gamertag))
        {
            Response.Write("WO_7");
            Response.Write("Character name cannot contain special symbols");
            return;
        }

        // check if can rename
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_CharRenameCheck";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_Gamertag", Gamertag);

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

            reader.Read();
            int MinutesLeft = getInt("MinutesLeft");
            if (MinutesLeft > 0)
            {
                Response.Write(string.Format("WO_4{0}", MinutesLeft));
                return;
            }
        }

        // buy item
        {
            int CHAR_RENAME_ITEMID = 301399;

            // permanent real $ buying
            string BuyIdx = "4";

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

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

        // exec rename
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_CharRename";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", web.CustomerID());
            sqcmd.Parameters.AddWithValue("@in_CharID", web.Param("CharID"));
            sqcmd.Parameters.AddWithValue("@in_Gamertag", Gamertag);

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

        Response.Write("WO_0");
    }
Exemplo n.º 9
0
    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;
    }
Exemplo n.º 10
0
    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));
    }