Yesterday i just made this system and today i managed to fix it and now i think i got it working almost 100%, if theres any bug please report in this thread. Okay, lets go on
In WarZ.sln
Open FrontEndWarZ.cpp
Spoiler:
Search for:
Spoiler:
void FrontendWarZ::eventReviveCharMoney(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
//gfxMovie.SetVariable("_root.api.Main.PopUpEarlyRevival.visible",false);
if (gUserProfile.ProfileData.GamePoints < 40)
{
Scaleform::GFx::Value var[2];
var[0].SetStringW(gLangMngr.getString("NotEnoughGP"));
var[1].SetBoolean(true);
gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
return;
}
{
Scaleform::GFx::Value var[2];
var[0].SetStringW(gLangMngr.getString("OneMomentPlease"));
var[1].SetBoolean(false);
gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
async_.StartAsyncOperation(this, &FrontendWarZ::as_ReviveCharThread, &FrontendWarZ::OnReviveCharSuccess);
}
}
Add after it:
Spoiler:
void FrontendWarZ::eventBuyPremiumAccount(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
//gfxMovie.SetVariable("_root.api.Main.PopUpEarlyRevival.visible",false);
if (gUserProfile.ProfileData.GamePoints < 10000)
{
Scaleform::GFx::Value var[2];
var[0].SetStringW(gLangMngr.getString("NotEnoughGP"));
var[1].SetBoolean(true);
gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
return;
}
{
Scaleform::GFx::Value var[2];
var[0].SetStringW(gLangMngr.getString("OneMomentPlease"));
var[1].SetBoolean(false);
gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
async_.StartAsyncOperation(this, &FrontendWarZ::as_BuyPremiumThread, &FrontendWarZ::OnBuyPremiumSuccess);
}
}
Search for:
Spoiler:
unsigned int WINAPI FrontendWarZ::as_ReviveCharThread(void* in_data)
{
r3dThreadAutoInstallCrashHelper crashHelper;
FrontendWarZ* This = (FrontendWarZ*)in_data;
This->async_.DelayServerRequest();
int apiCode = gUserProfile.ApiCharRevive();
if(apiCode != 0)
{
This->async_.SetAsyncError(apiCode, gLangMngr.getString("FailedToReviveChar"));
return 0;
}
return 1;
}
Add after it:
Spoiler:
unsigned int WINAPI FrontendWarZ::as_BuyPremiumThread(void* in_data)
{
r3dThreadAutoInstallCrashHelper crashHelper;
FrontendWarZ* This = (FrontendWarZ*)in_data;
This->async_.DelayServerRequest();
int apiCode = gUserProfile.ApiBuyPremium();
if(apiCode == 50)
{
This->async_.SetAsyncError(apiCode, gLangMngr.getString("FailedToBuyPremium"));
return 0;
}
return 1;
}
void FrontendWarZ::OnBuyPremiumSuccess()
{
// sync what server does. after revive you are allowed to access global inventory
gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID].GameFlags |= wiCharDataFull::GAMEFLAG_NearPostBox;
Scaleform::GFx::Value var[2];
var[0].SetStringW(gLangMngr.getString("RestartGameForChangesToTakeEffect"));
var[1].SetBoolean(true);
gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
// Update User GC
var[0].SetInt(gUserProfile.ProfileData.GamePoints);
gfxMovie.Invoke("_root.api.setGC", var, 1);
//AomBESkill : Update
updateInventoryAndSkillItems();
const wiCharDataFull& slot2 = gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID];
Scaleform::GFx::Value var2[11];
var2[0].SetString(slot2.Gamertag);
var2[1].SetNumber(slot2.Health);
var2[2].SetNumber(slot2.Stats.XP);
var2[3].SetNumber(slot2.Stats.TimePlayed);
var2[4].SetNumber(slot2.Alive);
var2[5].SetNumber(slot2.Hunger);
var2[6].SetNumber(slot2.Thirst);
var2[7].SetNumber(slot2.Toxic);
var2[8].SetNumber(slot2.BackpackID);
var2[9].SetNumber(slot2.BackpackSize);
var2[10].SetNumber(slot2.Stats.SkillXPPool);
gfxMovie.Invoke("_root.api.updateClientSurvivor", var2, 11);
//gfxMovie.Invoke("_root.api.hideInfoMsg", "");
gfxMovie.Invoke("_root.api.Main.SkillTree.refreshSkillTree", "");
gfxMovie.SetVariable("_root.api.Main.SurvivorsAnim.Survivors.PremiumAcc.visible", true);
//r3dOutToLog("Update Health");
return;
}
Search for:
Spoiler:
void FrontendWarZ::eventSetCurrentBrowseChannel(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
Replace all that function to:
Spoiler:
void FrontendWarZ::eventSetCurrentBrowseChannel(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
r3d_assert(argCount == 1);
CurrentBrowse = args[0].GetUInt();
if(CurrentBrowse == 4)
{
if (!gUserProfile.ProfileData.isPunisher)
{
gfxMovie.SetVariable("_root.api.PremiumAccount_Price",10000);
gfxMovie.Invoke("_root.api.Main.PremiumNeededPopUp.showPopUp",0);
return;
}
else
{
gfxMovie.Invoke("_root.api.Main.showScreen","ServerBrowse");
}
}
if(CurrentBrowse != 4)
{
gfxMovie.Invoke("_root.api.Main.showScreen","ServerBrowse");
}
}
Search for:
Spoiler:
gfxMovie.RegisterEventHandler("eventReviveChar", MAKE_CALLBACK(eventReviveChar));
Add after that:
Spoiler:
gfxMovie.RegisterEventHandler("eventBuyPremiumAccount", MAKE_CALLBACK(eventBuyPremiumAccount));
Now go to FrontEndWarZ.h
Spoiler:
Search for:
Spoiler:
static unsigned int WINAPI as_ReviveCharThread(void* in_data);
void OnReviveCharSuccess();
Add after that:
Spoiler:
static unsigned int WINAPI as_BuyPremiumThread(void* in_data);
void OnBuyPremiumSuccess();
Search for:
Spoiler:
void eventPlayGame(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
Add after that:
Spoiler:
void eventBuyPremiumAccount(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
Now go to UserProfile.h
Spoiler:
Search for:
Spoiler:
int ApiCharRevive();
Add after it:
Spoiler:
int ApiBuyPremium();
Now go to UserProfile.cpp
Spoiler:
Search for:
Spoiler:
int CClientUserProfile::ApiCharRevive()
{
r3d_assert(SelectedCharID >= 0 && SelectedCharID < wiUserProfile::MAX_LOADOUT_SLOTS);
wiCharDataFull& w = ProfileData.ArmorySlots[SelectedCharID];
r3d_assert(w.LoadoutID > 0);
CWOBackendReq req(this, "api_CharSlots.aspx");
req.AddParam("func", "revive");
req.AddParam("CharID", w.LoadoutID);
if(!req.Issue())
{
r3dOutToLog("ApiCharRevive failed: %d", req.resultCode_);
return req.resultCode_;
}
// reread profile
GetProfile();
return 0;
}
Add after that:
Spoiler:
int CClientUserProfile::ApiBuyPremium()
{
wiCharDataFull& w = ProfileData.ArmorySlots[SelectedCharID];
CWOBackendReq req(this, "api_BuyPremium.aspx");
req.AddParam("CustomerID", CustomerID);
req.AddParam("CharID", w.LoadoutID);
if(!req.Issue())
{
return 50;
}
GetProfile();
return 0;
}
Now compile WarZ.sln and open up your api solution (WZBackend-ASP.NET)
Spoiler:
Add a new file called: api_BuyPremium.aspx
Code for api_BuyPremium.aspx
Spoiler:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="api_BuyPremium.aspx.cs" Inherits="api_BuyPremium" %>
Code for api_BuyPremium.aspx.cs
Spoiler:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Text.RegularExpressions;
public partial class api_BuyPremium : WOApiWebPage
{
void OutfitOp(string CustomerID, string CharID)
{
int cus = Convert.ToInt32(CustomerID);
int CharI = Convert.ToInt32(CharID);
SqlCommand sqcmd = new SqlCommand();
sqcmd.CommandType = CommandType.StoredProcedure;
sqcmd.CommandText = "WZ_CharBuyPremium";
sqcmd.Parameters.AddWithValue("@in_CharID", CharI);
sqcmd.Parameters.AddWithValue("@in_CustomerID", cus);
if (!CallWOApi(sqcmd))
return;
Response.Write("WO_0");
}
protected override void Execute()
{
if (!WoCheckLoginSession())
return;
// string func = web.Param("func");
string CustomerID = web.Param("CustomerID");
string CharID = web.Param("CharID");
OutfitOp(CustomerID, CharID);
}
}
Now open up Navicat:
Spoiler:
Go to WarZ->dbo->Functions->New Function->
(Function name: WZ_CharBuyPremium
Tipe: Procedure)
Click Next than finish and change the code to this:
Spoiler:
CREATE PROCEDURE [dbo].[WZ_CharBuyPremium]
@in_CustomerID int,
@in_CharID int
AS
BEGIN
declare @GamePoints int
SELECT @GamePoints=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID
if (@GamePoints < 10000) begin
select 7 as ResultCode, 'Not Enough GP' as ResultMsg
return
end
update UsersData set GamePoints=(GamePoints-10000) WHERE CustomerID=@in_CustomerID
update UsersData set IsPunisher=1 WHERE CustomerID=@in_CustomerID
select 0 as ResultCode
END
https://www.youtube.com/watch?v=XA9q56Jm4fk
If you enjoy it, please leave a like :p

