• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Release] Buy Item Quantity From Marketplace

Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
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. > <

--------
Stage 1 Editing Flash Files
Open src\classes\warz\events\charPopup.as
Find
if (xp)
FrontEndEvents.eventBuyItem (charID, 0, charStoreItem.priceGD);
else
FrontEndEvents.eventBuyItem (charID, charStoreItem.price, 0);
Replace With
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
public static function eventBuyItem (itemID:uint, price:int, priceGD:int)
{
send("eventBuyItem", itemID, price, priceGD);
}
Replace With
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
private var transactionsData:Array = null;
Add Below
private var BuyQuantity;
private var BuyItemID;
private var BuyGameDollar;
private var BuyGamePoints;

Find
public function ActionFunction (button:String)
{
....
}
Replace With
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

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
sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);
Add Below
sqcmd.Parameters.AddWithValue("@in_Qty", 1);


Inside api_ClanCreate.aspx.cs;
Find
sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);
Add Below
sqcmd.Parameters.AddWithValue("@in_Qty", 1);

Inside api_CharSlots.aspx.cs;
Find
sqcmd.Parameters.AddWithValue("@in_BuyDays", 2000);
Add Below
sqcmd.Parameters.AddWithValue("@in_Qty", 1);

Inside api_BuyItem3.aspx.cs;
Find
string BuyIdx = web.Param("BuyIdx");
Add Below
string Qty = web.Param("Qty");

Find
sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));
Add Below
sqcmd.Parameters.AddWithValue("@in_Qty", Qty);

--------
Stage 3 Editing Function in Database
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

Open FontEndWarZ.h
Find
int mStore_BuyPriceGD;
Add Below
int mStore_BuyQuantity;

Open FrontEndWarZ.cpp :: eventBuyItem
Find
mStore_BuyPriceGD = args[2].GetInt();
Add Below
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))
int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID);
Replace With
int apiCode = gUserProfile.ApiBuyItem(This->mStore_BuyItemID, buyIdx, &This->m_inventoryID, This->mStore_BuyQuantity);

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

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

Within (ApiBuyItem)
Find
req.AddParam("BuyIdx", buyIdx);
Add Below
req.AddParam("Qty", qty);

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

Server
Open AsyncFuncs.cpp
Find
req.AddParam("BuyIdx", BuyIdx);
Add Below
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:
Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
Re: Buy Item Quantity From Marketplace

All updated. Awaiting feedback of working state.
 
Experienced Elementalist
Joined
Sep 13, 2013
Messages
205
Reaction score
23
Re: Buy Item Quantity From Marketplace

i can not find the other things under frontendevents :L
 
Junior Spellweaver
Joined
Sep 29, 2008
Messages
110
Reaction score
57
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

0D773wi - [Release] Buy Item Quantity From Marketplace - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
Re: Buy Item Quantity From Marketplace

i can not find the other things under frontendevents :L
Open src\classes\warz\FrontEnd\MarketPlace.as

sorry was inside for the rest.
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

GetRektBambi - [Release] Buy Item Quantity From Marketplace - RaGEZONE Forums

will take a look when I get home, just doing some shopping.
 
Junior Spellweaver
Joined
Sep 29, 2008
Messages
110
Reaction score
57
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
 
Newbie Spellweaver
Joined
Jul 16, 2015
Messages
43
Reaction score
17
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

GetRektBambi - [Release] Buy Item Quantity From Marketplace - RaGEZONE Forums
I have this error aswell :/
 
Newbie Spellweaver
Joined
Jul 16, 2015
Messages
43
Reaction score
17
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.
 
Junior Spellweaver
Joined
Sep 29, 2008
Messages
110
Reaction score
57
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.

me too

would not have to be changed here?


Code:
int totalQuantity = 1;
 
Last edited:
Newbie Spellweaver
Joined
Nov 12, 2015
Messages
23
Reaction score
2
Re: Buy Item Quantity From Marketplace

Post the querys from sql on pastebin...There you will not spoil
 
Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
Re: Buy Item Quantity From Marketplace

Have fixed the single item purchase

Inside the Marketplacescreen.fla
public function eventBuyQtyCallback (state:Boolean, text:String=""):void
{
if (state)
{
var q:uint = uint(text);
if(q>0)
FrontEndEvents.eventBuyItem (BuyItemID, BuyGamePoints, BuyGameDollar, q);
}
}
Red was the problem. Re-publish and should be fixed. I will uploaded a new swf. It was reading from variable initially set to 1 and never updated. It is not needed and will read directly from the box reply.
 
Newbie Spellweaver
Joined
Nov 12, 2015
Messages
23
Reaction score
2
Re: Buy Item Quantity From Marketplace

GetRektBambi

You could put the sql querys on pastebin? There he not mess anything. Please
 
Back
Top