• 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.

[Tutorial] Convert GC to Game Dollars - All SOURCE

Newbie Spellweaver
Joined
Jul 7, 2013
Messages
26
Reaction score
8
First I will not support the code

VWvDE9h - [Tutorial] Convert GC to Game Dollars  - All SOURCE - RaGEZONE Forums


search - warz.sln


Code:
void FrontendWarZ::eventSetSelectedChar(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
    gUserProfile.SelectedCharID = args[0].GetInt();
    m_Player->uberAnim_->anim.StopAll();    // prevent animation blending on loadout switch
    m_Player->UpdateLoadoutSlot(gUserProfile.ProfileData.ArmorySlots[gUserProfile.SelectedCharID]);
}


bellow add


Code:
void FrontendWarZ::eventMarketplaceActive(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount){
    gfxMovie.SetVariable("_root.api.Main.Marketplace.MarketplaceTab7.visible", true);
}
void FrontendWarZ::eventStorePurchaseGD(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
    if(currentvalue > gUserProfile.ProfileData.GamePoints)
    {
        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("Converting Please Wait..."));
    var[1].SetBoolean(false);
    gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);




    async_.StartAsyncOperation(this, &FrontendWarZ::as_ConvertGDThread, &FrontendWarZ::OnConvertGDSuccess);
}
void FrontendWarZ::OnConvertGDSuccess()
{
    Scaleform::GFx::Value var[1];
    var[0].SetInt(gUserProfile.ProfileData.GamePoints);
    gfxMovie.Invoke("_root.api.setGC", var, 1);




    var[0].SetInt(gUserProfile.ProfileData.GameDollars);
    gfxMovie.Invoke("_root.api.setDollars", var, 1);




    gfxMovie.Invoke("_root.api.hideInfoMsg", "");
}
void FrontendWarZ::eventStorePurchaseGDCallback(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
    r3d_assert(args);
    r3d_assert(argCount == 1);
    convertvalue = args[0].GetInt() * 20;
    currentvalue = args[0].GetInt();
    Scaleform::GFx::Value vars1[1];
    vars1[0].SetInt(convertvalue);
    gfxMovie.Invoke("_root.api.Main.PurchaseGC.setGCValue", vars1, 1);
}


search


Code:
void FrontendWarZ::eventPlayGame(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount){
    if(gUserProfile.ProfileData.NumSlots == 0)
        return;
        
    async_.StartAsyncOperation(this, &FrontendWarZ::as_PlayGameThread);
}


bellow add


Code:
unsigned int WINAPI FrontendWarZ::as_ConvertGDThread(void* in_data){
    r3dThreadAutoInstallCrashHelper crashHelper;
    FrontendWarZ* This = (FrontendWarZ*)in_data;




    This->async_.DelayServerRequest();
        int apiCode = gUserProfile.ApiConvertGCToGD(This->currentvalue,This->convertvalue);
            This->async_.SetAsyncError(0, L"Successful Purchase of GD\n Please Restart Your Client");
            return 1;
}


search


Code:
void eventChangeBackpack(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);


bellow add


Code:
void OnConvertGDSuccess();
static unsigned int WINAPI as_ConvertGDThread(void* in_data);


search


Code:
void setClanInfo();


bellow add


Code:
void FrontendWarZ::eventStorePurchaseGDCallback(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);    void FrontendWarZ::eventMarketplaceActive(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
    void FrontendWarZ::eventStorePurchaseGD(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);
    int convertvalue;
    int currentvalue;


search


Code:
int CClientUserProfile::ApiMysteryBoxGetContent(int itemId, const MysteryBox_s** out_box)


above add


Code:
int CClientUserProfile::ApiConvertGCToGD(int currentvalue,int convertvalue){
    GetProfile();
    CWOBackendReq req(this, "api_ConvertM.aspx");
    req.AddParam("CustomerID", CustomerID);
    req.AddParam("Var1", currentvalue);
    req.AddParam("Var2", convertvalue);
    if(!req.Issue())
    {
        r3dOutToLog("ApiConvertGCToGD FAILED, code: %d\n", req.resultCode_);
        return req.resultCode_;
    }
    GetProfile();
    return 0;
}


search


Code:
int        ApiCharRevive();


bellow add


Code:
int CClientUserProfile::ApiConvertGCToGD(int currentvalue,int convertvalue);


search


Code:
gfxMovie.RegisterEventHandler("eventRequestLeaderboardData", MAKE_CALLBACK(eventRequestLeaderboardData));


bellow add


Code:
gfxMovie.RegisterEventHandler("eventStorePurchaseGDCallback", MAKE_CALLBACK(eventStorePurchaseGDCallback));    gfxMovie.RegisterEventHandler("eventStorePurchaseGD", MAKE_CALLBACK(eventStorePurchaseGD));
    gfxMovie.RegisterEventHandler("eventMarketplaceActive", MAKE_CALLBACK(eventMarketplaceActive));


SQL


Code:
-- ------------------------------ 
Procedure structure for [dbo].[WZ_ConvertGD]
-- ----------------------------
CREATE PROCEDURE [dbo].[WZ_ConvertGD]
@in_CustomerID int,
    @in_Var1 int,
    @in_Var2 int
AS
BEGIN
    declare @[I][B][URL="http://forum.ragezone.com/members/21783.html"]Game[/URL][/B][/I]Points int
    SELECT @[I][B][URL="http://forum.ragezone.com/members/21783.html"]Game[/URL][/B][/I]Points=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID




    if @[I][B][URL="http://forum.ragezone.com/members/21783.html"]Game[/URL][/B][/I]Points < @in_Var1) begin
        select 7 as ResultCode, 'Not Enough GP' as ResultMsg
        return
    end
update UsersData set GamePoints=(GamePoints-@in_Var1) WHERE CustomerID=@in_CustomerID
update UsersData set GameDollars=(GameDollars+@in_Var2) WHERE CustomerID=@in_CustomerID
INSERT INTO FinancialTransactions
        VALUES (@in_CustomerID, 'ConvertGCToGD', '3000', GETDATE(), 
                @in_var1, '1', 'APPROVED', @in_Var2)
select 0 as ResultCode
END


API WZBackend-ASP.NET - ADD NEW ITEM WITH NAME api_ConvertM.aspx


4RRo9qX - [Tutorial] Convert GC to Game Dollars  - All SOURCE - RaGEZONE Forums




api_ConvertM.aspx - CLEAN ALL AND ADD


Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="api_ConvertM.aspx.cs" Inherits="api_ConvertM" %>


api_ConvertM.aspx.cs - CLEAN ALL AND ADD


Code:
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;




public partial class api_ConvertM : WOApiWebPage
{
    void OutfitOp( string Var1,string Var2,string CustomerID)
    {
        SqlCommand sqcmd = new SqlCommand();
        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WZ_ConvertGD";
        sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
        sqcmd.Parameters.AddWithValue("@in_Var1", Var1);
        sqcmd.Parameters.AddWithValue("@in_Var2", Var2);




        if (!CallWOApi(sqcmd))
            return;




        Response.Write("WO_0");
    }




    protected override void Execute()
    {
        if (!WoCheckLoginSession())
            return;
        string CustomerID = web.Param("CustomerID");
        string Var1 = web.Param("Var1");
        string Var2 = web.Param("Var2");




        OutfitOp(Var1,Var2,CustomerID);
    }
}




    gfxMovie.RegisterEventHandler("eventMarketplaceActive", MAKE_CALLBACK(eventMarketplaceActive));
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
Apr 5, 2012
Messages
148
Reaction score
5
Exelent tutorial! How I can change the exchange amount of GC for GameDollar Like $150 = 10GC
 
Newbie Spellweaver
Joined
Nov 19, 2014
Messages
22
Reaction score
2
You can find sql table named "DataGPConvertRates" and change value
 
Junior Spellweaver
Joined
Apr 5, 2012
Messages
148
Reaction score
5
that doesn't exist in sql, other name?
 
Last edited:
Newbie Spellweaver
Joined
Feb 17, 2010
Messages
39
Reaction score
5
I got error ->

Code:
Error	2	A namespace does not directly contain members such as fields or methods	E:\pathtoapi\Site\api_ConvertM.aspx.cs	55	5	E:\...\Site\

Line 55:
Code:
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;




public partial class api_ConvertM : WOApiWebPage
{
    void OutfitOp( string Var1,string Var2,string CustomerID)
    {
        SqlCommand sqcmd = new SqlCommand();
        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WZ_ConvertGD";
        sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
        sqcmd.Parameters.AddWithValue("@in_Var1", Var1);
        sqcmd.Parameters.AddWithValue("@in_Var2", Var2);




        if (!CallWOApi(sqcmd))
            return;




        Response.Write("WO_0");
    }




    protected override void Execute()
    {
        if (!WoCheckLoginSession())
            return;
        string CustomerID = web.Param("CustomerID");
        string Var1 = web.Param("Var1");
        string Var2 = web.Param("Var2");




        OutfitOp(Var1,Var2,CustomerID);
    }
}

[B][COLOR="#FF0000"]    gfxMovie.RegisterEventHandler("eventMarketplaceActive", MAKE_CALLBACK(eventMarketplaceActive));
[/COLOR][/B]


and Sql i did it like that:

Code:
-- ------------------------------ 
--Procedure structure for [dbo].[WZ_ConvertGD]
-- ----------------------------
CREATE PROCEDURE [dbo].[WZ_ConvertGD]
@in_CustomerID int,
    @in_Var1 int,
    @in_Var2 int
AS
BEGIN
    declare   [USER=21783]Game[/USER]Points int
    SELECT   [USER=21783]Game[/USER]Points=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID




    if [B][COLOR="#FF0000"] ( @ GamePoints < @in_Var1)[/COLOR][/B] begin
        select 7 as ResultCode, 'Not Enough GP' as ResultMsg
        return
    end
update UsersData set GamePoints=(GamePoints-@in_Var1) WHERE CustomerID=@in_CustomerID
update UsersData set GameDollars=(GameDollars+@in_Var2) WHERE CustomerID=@in_CustomerID
INSERT INTO FinancialTransactions
        VALUES (@in_CustomerID, 'ConvertGCToGD', '3000', GETDATE(), 
                @in_var1, '1', 'APPROVED', @in_Var2)
select 0 as ResultCode
END

Forum replacing it with Mention :D
Still who can help me with aspx.cs problem? :D
 
Back
Top