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
Spoiler:
Open WarZ\Functions\WZ_BuyItem_GD
Here is the full code
Spoiler:
Open WarZ\Functions\WZ_BuyItem_GP
Here is the full code
Spoiler:
--------
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.



Reply With Quote![[Release] Buy Item Quantity From Marketplace](http://ragezone.com/hyper728.png)



