[Release] Buy Item Quantity From Marketplace

Page 1 of 4 1234 LastLast
Results 1 to 15 of 56
  1. #1
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    thumbs up [Release] Buy Item Quantity From Marketplace

    Requires Flash Source Files < Click here

    If you are not using a custom FrontEnd you can get away with using this Published version with only the below changes made. > Fixed FrontEnd Link Click Here<

    --------
    Stage 1 Editing Flash Files
    Spoiler:

    Open src\classes\warz\events\charPopup.as
    Find
    Spoiler:

    if (xp)
    FrontEndEvents.eventBuyItem (charID, 0, charStoreItem.priceGD);
    else
    FrontEndEvents.eventBuyItem (charID, charStoreItem.price, 0);

    Replace With
    Spoiler:

    if (xp)
    FrontEndEvents.eventBuyItem (charID, 0, charStoreItem.priceGD, 1);
    else
    FrontEndEvents.eventBuyItem (charID, charStoreItem.price, 0 , 1);



    Open src\classes\warz\events\FrontEndEvents.as
    Find
    Spoiler:

    public static function eventBuyItem (itemID:uint, price:int, priceGD:int)
    {
    send("eventBuyItem", itemID, price, priceGD);
    }

    Replace With
    Spoiler:
    public static function eventBuyItem (itemID:uint, price:int, priceGD:int, Quantity:int)
    {
    send("eventBuyItem", itemID, price, priceGD, Quantity);
    }



    Open src\classes\warz\frontend\MarketplaceScreen.as
    Find
    Spoiler:

    private var transactionsData:Array = null;

    Add Below
    Spoiler:

    private var BuyQuantity;
    private var BuyItemID;
    private var BuyGameDollar;
    private var BuyGamePoints;


    Find
    Spoiler:

    public function ActionFunction (button:String)
    {
    ....
    }

    Replace With
    Spoiler:

    public function ActionFunction (button:String)
    {
    if (button == "BuyBtn")
    {
    Marketplace.BuyBtn.State = "off";
    Marketplace.BuyBtn.gotoAndPlay("out");

    if (SelectedItem)
    {
    var item:Item = SelectedItem.Item;
    var storeItem:StoreItem = SelectedItem.StoreItem;

    if (api.isDebug)
    {
    var inventItem:InventoryItem = api.getInventoryItemByID (item.itemID);


    if (inventItem)
    {
    inventItem.quantity += 1;
    }
    else
    api.addInventoryItem(api.InventoryDB.length, item.itemID, 1, 0, 0, false);

    api.money.gc -= storeItem.price;
    api.money.dollars -= storeItem.priceGD;

    api.buyItemSuccessful ()
    }
    else
    {
    BuyQuantity = 1;
    BuyItemID = item.itemID;
    BuyGameDollar = storeItem.priceGD;
    BuyGamePoints = storeItem.price;
    api.Main.MsgBox.showInfoInputMsg("How many would you like to buy?", "", eventBuyQtyCallback);
    }


    }
    }
    else if (button.indexOf("PopupSlot") != -1)
    {
    var slot = int (button.slice (9)) - 1;
    var storeSlot = Marketplace.Slots.getChildAt(slot);


    if (storeSlot)
    {
    showDescription (storeSlot);
    }
    }
    else if (button.indexOf("Tab") != -1)
    {
    var tab = int (button.slice (3)) - 1;
    var Name = "Tab" + (SelectedTabID + 1);
    Marketplace[Name].State = "off";
    Marketplace[Name].gotoAndPlay("out");


    updateStoreItemsList (tab);
    showDescription (null);
    }
    }


    public function eventBuyQtyCallback (state:Boolean, text:String=""):void
    {
    if (state)
    {
    var q:uint = uint(text);
    if(q>0)
    FrontEndEvents.eventBuyItem (BuyItemID, BuyGamePoints, BuyGameDollar, q);
    }
    }



    Open src\Frontend.fla and Publish.

    --------
    Stage 2 Editing the API

    Spoiler:

    Open server\src\Scripts\WZBackend-ASP.NET\WZBackend-ASP.NET.sln
    The files you will need open are: api_ClanMgr.aspx.cs, api_ClanCreate.aspx.cs, api_CharSlots.aspx.cs, api_BuyItem3.aspx.cs

    Inside api_ClanMgr.aspx.cs;
    Find
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);

    Add Below
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_Qty", 1);



    Inside api_ClanCreate.aspx.cs;
    Find
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);

    Add Below
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_Qty", 1);


    Inside api_CharSlots.aspx.cs;
    Find
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);

    Add Below
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_Qty", 1);


    Inside api_BuyItem3.aspx.cs;
    Find
    Spoiler:
    string BuyIdx = web.Param("BuyIdx");

    Add Below
    Spoiler:
    string Qty = web.Param("Qty");


    Find
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

    Add Below
    Spoiler:
    sqcmd.Parameters.AddWithValue("@in_Qty", Qty);



    --------
    Stage 3 Editing Function in Database
    Spoiler:

    Open your Server DB


    Open WarZ\Functions\WZ_BuyItemFN_Exec
    Here is the full code


    Open WarZ\Functions\WZ_BuyItem_GD

    Here is the full code


    Open WarZ\Functions\WZ_BuyItem_GP
    Here is the full code


    --------
    Stage 4 Editing the Source

    Client

    Spoiler:



    Open FontEndWarZ.h
    Find
    Spoiler:
    int mStore_BuyPriceGD;

    Add Below
    Spoiler:
    int mStore_BuyQuantity;


    Open FrontEndWarZ.cpp :: eventBuyItem
    Find
    Spoiler:
    mStore_BuyPriceGD = args[2].GetInt();

    Add Below
    Spoiler:

    mStore_BuyQuantity = args[3].GetInt(); // new quantity code
    mStore_BuyPrice *= mStore_BuyQuantity; // make price take into account the new quantity!
    mStore_BuyPriceGD *= mStore_BuyQuantity; // make price take into account the new quantity!


    Find (unsigned int WINAPI FrontendWarZ::as_BuyItemThread(void* in_data))
    Spoiler:
    int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID);

    Replace With
    Spoiler:
    int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID, This->mStore_BuyQuantity);


    Find
    Spoiler:
    int quantityToAdd = storecat_GetItemBuyStackSize(mStore_BuyItemID);

    Replace With
    Spoiler:
    int quantityToAdd = storecat_GetItemBuyStackSize(mStore_BuyItemID) * mStore_BuyQuantity;


    Open UserProfile.cpp
    Find
    Spoiler:
    int CClientUserProfile::ApiBuyItem(int itemId, int buyIdx, __int64* out_InventoryID)

    Replace With
    Spoiler:
    int CClientUserProfile::ApiBuyItem(int itemId, int buyIdx, __int64* out_InventoryID, int qty)


    Within (ApiBuyItem)
    Find
    Spoiler:
    req.AddParam("BuyIdx", buyIdx);

    Add Below
    Spoiler:
    req.AddParam("Qty", qty);


    Open UserProfile.h
    Find
    Spoiler:
    int ApiBuyItem(int itemId, int buyIdx, __int64* out_InventoryID);

    Replace
    Spoiler:
    int ApiBuyItem(int itemId, int buyIdx, __int64* out_InventoryID, int qty);



    Server
    Spoiler:

    Open AsyncFuncs.cpp
    Find
    Spoiler:
    req.AddParam("BuyIdx", BuyIdx);

    Add Below
    Spoiler:
    req.AddParam("Qty", 1);

    This will fix ingame store. As it does not yet have support for qty purchases will default to 1 / 1 stack.

    --------

    * Confirmed Working *

    Please post any errors you receive on this thread and will gladly fix these for you.



    Hope it all works regardless or atleast helps you make progress getting this system running.


    <3 Hit that Likes button


    Special Thanks @erickstyle for posting a fix and the community for feeding back bugs.
    Last edited by GetRektBambi; 15-12-15 at 11:54 AM.


  2. #2
    I can do it!, i guess... Sylvanas1234 is offline
    MemberRank
    May 2014 Join Date
    PolandLocation
    760Posts

    Re: Buy Item Quantity From Marketplace

    Cheers big ears! <3

  3. #3
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: Buy Item Quantity From Marketplace

    All updated. Awaiting feedback of working state.

  4. #4
    |The GOD| beastgameer is offline
    MemberRank
    Sep 2013 Join Date
    205Posts

    Re: Buy Item Quantity From Marketplace

    i can not find the other things under frontendevents :L

  5. #5
    Valued Member erickstyle is offline
    MemberRank
    Sep 2008 Join Date
    Santo André, BLocation
    104Posts

    Re: Buy Item Quantity From Marketplace

    i have this error

    Code:
    1>.\Sources\UI\FrontEndWarZ.cpp(2820) : error C2664: 'CClientUserProfile::ApiBuyItem' : cannot convert parameter 4 from 'int *' to 'int'
    1>        There is no context in which this conversion is possible

  6. #6
    Account Upgraded | Title Enabled! Oosmar02 is offline
    MemberRank
    Sep 2013 Join Date
    FranceLocation
    894Posts

    Re: Buy Item Quantity From Marketplace

    i dont find : private var transactionsData:Array = null; ....

  7. #7
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: Buy Item Quantity From Marketplace

    Quote Originally Posted by beastgameer View Post
    i can not find the other things under frontendevents :L
    Open src\classes\warz\FrontEnd\MarketPlace.as

    sorry was inside for the rest.
    Quote Originally Posted by erickstyle View Post
    i have this error

    Code:
    1>.\Sources\UI\FrontEndWarZ.cpp(2820) : error C2664: 'CClientUserProfile::ApiBuyItem' : cannot convert parameter 4 from 'int *' to 'int'
    1>        There is no context in which this conversion is possible
    will take a look when I get home, just doing some shopping.

  8. #8
    Account Upgraded | Title Enabled! Oosmar02 is offline
    MemberRank
    Sep 2013 Join Date
    FranceLocation
    894Posts

    Re: Buy Item Quantity From Marketplace

    And public function ActionFunction (button:String) not find :c

  9. #9
    Make WarZ great again! Nikita505 is offline
    MemberRank
    Mar 2014 Join Date
    Mountain ViewLocation
    223Posts

    Re: Buy Item Quantity From Marketplace

    thx for sharing, and

    sir, can u clear PM?

  10. #10
    Valued Member erickstyle is offline
    MemberRank
    Sep 2008 Join Date
    Santo André, BLocation
    104Posts

    Re: Buy Item Quantity From Marketplace

    i remove the "$"

    int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID, This->mStore_BuyQuantity);

    and compile ok.. i will continue

  11. #11
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: Buy Item Quantity From Marketplace

    Quote Originally Posted by Oosmar02 View Post
    And public function ActionFunction (button:String) not find :c
    Open src\classes\warz\FrontEnd\MarketPlace......as

    sorry was inside for the rest.

    Quote Originally Posted by Nikita505 View Post
    thx for sharing, and

    sir, can u clear PM?
    Np and cleared.

  12. #12
    Enthusiast LukeFire is offline
    MemberRank
    Jul 2015 Join Date
    43Posts

    Re: Buy Item Quantity From Marketplace

    Quote Originally Posted by erickstyle View Post
    i have this error

    Code:
    1>.\Sources\UI\FrontEndWarZ.cpp(2820) : error C2664: 'CClientUserProfile::ApiBuyItem' : cannot convert parameter 4 from 'int *' to 'int'
    1>        There is no context in which this conversion is possible
    I have this error aswell :/

  13. #13
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: Buy Item Quantity From Marketplace

    Quote Originally Posted by LukeFire View Post
    I have this error aswell :/
    Quote Originally Posted by erickstyle View Post
    i remove the "$"

    int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID, This->mStore_BuyQuantity);

    and compile ok.. i will continue
    fix has been posted

  14. #14
    Enthusiast LukeFire is offline
    MemberRank
    Jul 2015 Join Date
    43Posts

    Re: Buy Item Quantity From Marketplace

    Everything works fine but when i buy something it gives me only one... it doesn't give me the quantity i ask for.

  15. #15
    Valued Member erickstyle is offline
    MemberRank
    Sep 2008 Join Date
    Santo André, BLocation
    104Posts

    Re: Buy Item Quantity From Marketplace

    Quote Originally Posted by LukeFire View Post
    Everything works fine but when i buy something it gives me only one... it doesn't give me the quantity i ask for.
    me too

    would not have to be changed here?


    Code:
    int totalQuantity = 1;
    Last edited by erickstyle; 13-12-15 at 05:31 PM.



Page 1 of 4 1234 LastLast

Advertisement