[Release] Working GC Transactions

Results 1 to 6 of 6
  1. #1
    Your average Dutch guy Laenoar is offline
    True MemberRank
    Apr 2013 Join Date
    The NetherlandsLocation
    358Posts

    [Release] Working GC Transactions


    RaGEZONE Recommends

    RaGEZONE Recommends

    You should know where to place the following 4 files.

    SQL functions:
    https://mega.co.nz/#!Lx5iUSqK!V8sQeh...k4hyy7uUJ1PTTg
    https://mega.co.nz/#!ClAVGACK!n1xqeS...W4BTBjvysrm7iM

    API:
    https://mega.co.nz/#!7thzxK5b!rvrg66..._wTKVBrP9pZj3Y
    https://mega.co.nz/#!ehA3xRBL!sGNwSX...FAO-QRuJKFN8XU

    In WarZ.sln --> UserProfile.cpp


    Under:
    Code:
    int CClientUserProfile::ApiFriendRemove(DWORD friendId)
    {
        CWOBackendReq req(this, "api_Friends.aspx");
        req.AddParam("func", "remove");
        req.AddParam("FriendID", friendId);
    
    
        if(!req.Issue())
        {
            r3dOutToLog("ApiFriendRemove FAILED, code: %d\n", req.resultCode_);
            return req.resultCode_;
        }
        
        return 0;
    }

    Add:
    Code:
    int CClientUserProfile::ApiGetTransactions()
    {
        CWOBackendReq req(this, "api_GetTransactions.aspx");
        req.AddParam("CustomerID", CustomerID);
        if(!req.Issue())
        {
            r3dOutToLog("ApiGetTransactions FAILED, code: %d\n", req.resultCode_);
            return req.resultCode_;
        }
    
    
        tscount = 0;
        m_tsData.reserve(1024*1024);
        m_tsData.clear();
    
    
    
    
        pugi::xml_document xmlFile;
        req.ParseXML(xmlFile);
        
        pugi::xml_node xml = xmlFile.child("trans");
    
    
        pugi::xml_node xmlItem = xml.first_child();
        while(!xmlItem.empty())
        {
            TSEntry_s ts;
            r3dscpy(ts.type, xmlItem.attribute("TId").value());
            r3dscpy(ts.time, xmlItem.attribute("Time").value());
            ts.itemID = xmlItem.attribute("ItemID").as_int();
            ts.amount = xmlItem.attribute("amount").as_float();
            ts.balance = xmlItem.attribute("bl").as_float();
            ts.id = xmlItem.attribute("id").as_int();
            m_tsData.push_back(ts);
    
    
            tscount++;
            xmlItem = xmlItem.next_sibling();
        }
    
    
        return 0;
    }
    
    
    int CClientUserProfile::ApiFriendGetStats(DWORD friendId)
    {
        CWOBackendReq req(this, "api_Friends.aspx");
        req.AddParam("func", "stats");
        req.AddParam("FriendID", friendId);
    
    
        if(!req.Issue())
        {
            r3dOutToLog("ApiFriendGetStats FAILED, code: %d\n", req.resultCode_);
            return req.resultCode_;
        }
        
        pugi::xml_document xmlFile;
        req.ParseXML(xmlFile);
        friends->SetCurrentStats(xmlFile);
        
        return 0;
    }

    In WarZ.sln --> UserProfile.h


    Under:
    Code:
    int        ApiGetItemsInfo();

    Add:
    Code:
    int ApiGetTransactions();

    In WarZ.sln --> FrontEndWarZ.cpp


    Under:
    Code:
    gfxMovie.RegisterEventHandler("eventMyServerJoinServer", MAKE_CALLBACK(eventMyServerJoinServer));

    Add:
    Code:
    gfxMovie.RegisterEventHandler("eventRequestGCTransactionData", MAKE_CALLBACK(eventRequestGCTransactionData));

    Under:
    Code:
    void FrontendWarZ::eventRequestMyServerList(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
    {
        Scaleform::GFx::Value var[3];
        var[0].SetStringW(gLangMngr.getString("FetchingGamesListFromServer"));
        var[1].SetBoolean(false);
        var[2].SetString("");
        gfxMovie.Invoke("_root.api.showInfoMsg", var, 3);
        async_.StartAsyncOperation(this, &FrontendWarZ::as_BrowseGamesThread, &FrontendWarZ::OnMyServerListReceived);
    }

    Add:
    Code:
    void FrontendWarZ::eventRequestGCTransactionData(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
    {
        Scaleform::GFx::Value var[3];
        var[0].SetStringW(gLangMngr.getString("OneMomentPlease"));
        var[1].SetBoolean(false);
        var[2].SetString("");
        gfxMovie.Invoke("_root.api.showInfoMsg", var, 3);
        async_.StartAsyncOperation(this, &FrontendWarZ::as_TransactionsThread, &FrontendWarZ::OnTransactionsDataSuccess);
    }

    Under:
    Code:
    const char* FrontendWarZ::FindClanTagAndColorById(int id ,char* name,CUserClans* clan)
    {
        if (id == 0) return name;
        //CUserClans* clan = new CUserClans();
        //clan->ApiClanGetLeaderboard();
        //const char* msg[512] = {0};
        for(std::list<CUserClans::ClanInfo_s>::iterator iter=clan->leaderboard_.begin(); iter!=clan->leaderboard_.end(); ++iter)
        {
            CUserClans::ClanInfo_s& clanInfo = *iter;
            //r3dOutToLog("id %d %s %d\n",id,name,clanInfo.ClanID);
            if (clanInfo.ClanID == id)
            {
                const char* tagColor = "#000000";
                switch(clanInfo.ClanTagColor)
                {
                case 1: tagColor = "#aa0000"; break;
                case 2: tagColor = "#a6780c"; break;
                case 3: tagColor = "#10a49e"; break;
                case 4: tagColor = "#20a414"; break;
                case 5: tagColor = "#104ea4"; break;
                case 6: tagColor = "#9610a4"; break;
                case 7: tagColor = "#444444"; break;
                case 8: tagColor = "#a4a4a4"; break;
                default:
                    break;
                }
                char gamertag[512] = {0};
                sprintf(gamertag,"%s",name);
                sprintf(name,"<font color='%s'>[%s]</font>%s",tagColor,clanInfo.ClanTag,gamertag);
                break;
                //str = (const char*)msg;
                //return msg;
            }
        }
        //r3dOutToLog("%s\n");
        return name;
    }

    Add:
    Code:
    void FrontendWarZ::OnTransactionsDataSuccess()
    {
        gfxMovie.Invoke("_root.api.hideInfoMsg", "");
        for(std::vector<CClientUserProfile::TSEntry_s>::iterator it = gUserProfile.m_tsData.begin(); it != gUserProfile.m_tsData.end(); ++it)
        {
            CClientUserProfile::TSEntry_s& tse = *it;
    
    
            char date[64] = {0};
            char name[64] = {0};
            char amount[64] = {0};
            char balance[64] = {0};
            sscanf(tse.time,"%s",&date);
            // TODO ADD LOGIC
            Scaleform::GFx::Value var[5];
            var[0].SetInt(tse.id);
            var[1].SetString(date); // date 
    
    
            const BaseItemConfig* cfg = g_pWeaponArmory->getConfig(tse.itemID);
    
    
            // transactions descriptions
            if (strcmp(tse.type, "INGAME")==0 && cfg) // buying in marketplace.
                sprintf(name,"Marketplace: %s",cfg->m_StoreName);
            else if (strcmp(tse.type, "EarlyRevive")==0)
                sprintf(name,"Early Revive");
            else if (strcmp(tse.type, "ConvertGCToGD")==0)
                sprintf(name,"Convert GC");
            else if (strcmp(tse.type, "Premium")==0)
                sprintf(name,"Premium Account");
    
    
            var[2].SetString(name); // name
            sprintf(amount,"-%.2f",tse.amount);
            var[3].SetString(amount); // amount
            sprintf(balance,"%.2f",tse.balance);
            var[4].SetString(balance); // balance
            if (name[0])
                gfxMovie.Invoke("_root.api.Main.Marketplace.addTransactionData", var, 5);
        }
        gfxMovie.Invoke("_root.api.Main.Marketplace.showTransactionsPopup", "");
    }
    
    
    unsigned int WINAPI FrontendWarZ::as_TransactionsThread(void* in_data)
    {
        if (gUserProfile.ApiGetTransactions())
        {
            FrontendWarZ* This = (FrontendWarZ*)in_data;
            This->async_.SetAsyncError(0,L"Get Transactions Failed");
            return 1;
        }
    
    
        return 0;
    }

    In WarZ.sln --> FrontEndWarZ.h


    Under:
    Code:
    static unsigned int WINAPI DrawThread(void* in_data);

    Add:
    Code:
    static unsigned int WINAPI as_TransactionsThread(void* in_data);
        void OnTransactionsDataSuccess();

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

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


  2. #2
    Registered Madrugamer6 is offline
    MemberRank
    Feb 2014 Join Date
    16Posts

    Re: [Release] Working GC Transactions

    When I run the Query gave this error:


  3. #3
    Your average Dutch guy Laenoar is offline
    True MemberRank
    Apr 2013 Join Date
    The NetherlandsLocation
    358Posts

    Re: [Release] Working GC Transactions

    Quote Originally Posted by Madrugamer6 View Post
    When I run the Query gave this error:
    Execute FinancialTransactions.sql first.

  4. #4
    Alpha Member javaz97 is offline
    Alpha MaleRank
    May 2006 Join Date
    HellLocation
    1,542Posts

    Re: [Release] Working GC Transactions

    thank you

  5. #5
    Account Upgraded | Title Enabled! Cryptopia is offline
    True MemberRank
    Oct 2013 Join Date
    HelveteLocation
    287Posts

    http://prntscr.com/4ahvfm

    Im getting some errors :/
    How can I fix them ?
    (Im working with the new DNC Release)

    --- Merged ---

    Help me please

    [Err] 42S02 - [SQL Server]Invalid object name 'dbo.WZ_GetTransactions'.
    http://prntscr.com/4c9vis
    Last edited by GigaToni; 13-08-14 at 09:31 AM.

  6. #6
    Account Upgraded | Title Enabled! JonnyTruant is offline
    True MemberRank
    Mar 2013 Join Date
    557Posts

    Re: [Release] Working GC Transactions

    Guess you've forgotten this, Laenoar:

    Code:
    struct TSEntry_s
        {
            char    type[256];
            char    time[256];
            int        itemID;
            float    amount;
            float    balance;
            int        id;
        };




Advertisement