Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 29883

[Tutorial] Convert GC to Game Dollars - All SOURCE

$
0
0
First I will not support the code



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 @GamePoints int
    SELECT @GamePoints=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID




    if @GamePoints < @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






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));


Viewing all articles
Browse latest Browse all 29883

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>