[Share] TW Random Buff

Random buff is working, anyone encounter Fortune of victory, Retrieval of victory, Luck of victory, this buff not appear on me
IMG_5208 - [Share] TW Random Buff - RaGEZONE Forums
 
Might as well share this.


DxGlobalStage.cpp

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_RANKINFO_PC:

Add:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_BUFF_REWARD:

GLAgentServerEx.cpp

Find:
C++:
netmsgbuff.sRewardBuffMain = GLPVPTyrannyAgent::GetInstance().m_sRewardBuffMain;

Add and replace:
C++:
for ( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
    {
        if ( i <= GLPVPTyrannyAgent::GetInstance().GetTotalBuff() )
        {
            int nPicked = GLPVPTyrannyAgent::GetInstance().GetPicked(i);
            const SNATIVEID &sID = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[nPicked].sidSkill;
            if ( sID != NATIVEID_NULL() && GLPVPTyrannyAgent::GetInstance().m_sRewardBuff->sidSkill.wMainID == 51 )
            {
                PGLSKILL pSkill = GLSkillMan::GetInstance().GetData ( sID );
                if ( !pSkill )    continue;


                if ( pSkill->m_sBASIC.sNATIVEID.wMainID != GLPVPTyrannyAgent::GetInstance().m_sRewardBuff->sidSkill.wMainID ) continue;


                netmsgbuff.sRewardBuff[i] = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[nPicked];
            }
        }
    }
    //netmsgbuff.sRewardBuff[i] = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[i];

GLPVPTyrannyAgent.cpp

Find:
C++:
GLAgentServer::GetInstance().TyrannyResetBuffs();

Add:
C++:
//every fucking registration time set the new reward buff
    SetRewardBuff();

Same file add function at the end:
C++:
void GLPVPTyrannyAgent::SetRewardBuff()
{
    m_sRewardBuffCount = 0;
    typedef std::multimap<DWORD,SNATIVEID>        MAP_REWARDBUFF;
    typedef MAP_REWARDBUFF::iterator            MAP_REWARDBUFF_ITER;

    MAP_REWARDBUFF mapREWARDBUFFGET;
    mapREWARDBUFFGET.clear();

    while ( mapREWARDBUFFGET.size() < 4 )
    {
        int nRand = RandomNumber ( 0, 9 );

        if ( nRand > 9 ) return;
        if ( nRand < 0 ) return;

        //const SNATIVEID &sID = SNATIVEID(m_sRewardBuff[nRand].wMainID,m_sRewardBuff[nRand].wSubID);
        const SNATIVEID &sID = m_sRewardBuff[nRand].sidSkill;

        MAP_REWARDBUFF_ITER iter = mapREWARDBUFFGET.find ( sID.dwID );
        if ( iter == mapREWARDBUFFGET.end() )
        {
            PGLSKILL pSkill = GLSkillMan::GetInstance().GetData ( sID );
            if ( pSkill )                                                 
            {
                m_nBuffPicked[m_sRewardBuffCount] = nRand; 
                m_sRewardBuffCount++;
                mapREWARDBUFFGET.insert ( std::make_pair ( sID.dwID, sID ) );
            }
        }
    }

    //Send the fucking selected reward buffs to client
    GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD netmsgbuffreward;
    for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
    {
        int nPicked = GetPicked(i);
        netmsgbuffreward.sRewardBuff[i] = m_sRewardBuff[nPicked].sidSkill;
    }
    GLAgentServer::GetInstance().SENDTOALLCLIENT ( &netmsgbuffreward );

    GLAgentServer::GetInstance().CONSOLEMSG_WRITE("[Tyranny] Buff Picked: (%d)",m_sRewardBuffCount );
 );

    CDebugSet::ToFileWithTime( "_PVP_TW.txt", "SetRewardBuff - %d Total Buff Picked", m_sRewardBuffCount  );
    mapREWARDBUFFGET.clear();
}
int GLPVPTyrannyAgent::GetPicked( int i )
{
    return m_nBuffPicked[i];
}

GLPVPTyrannyAgentMSG.cpp

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_F2A_RANKINFO_PC:

Add/replace/compare:
C++:
case NET_MSG_GCTRL_TYRANNY_F2A_RANKINFO_PC:
        {
            GLMSG::SNETPC_TYRANNY_F2A_RANKINFO_PC* pnetmsg = ( GLMSG::SNETPC_TYRANNY_F2A_RANKINFO_PC* ) nmg;

            for( int i=0; i<TYRANNY_MINI_RANKING_NUM; ++i )
                m_sLastTop[i] = TYRANNY_PLAYER_DATA();

            for( int i=0; i<pnetmsg->wRankNum; ++i )
            {
                if ( pnetmsg->sPlayerData[i].wRankAll > 0 && pnetmsg->sPlayerData[i].wRankAll <= TYRANNY_MINI_RANKING_NUM )
                {
                    m_sLastTop[pnetmsg->sPlayerData[i].wRankAll-1] = pnetmsg->sPlayerData[i];
                }
            }

            GLMSG::SNETPC_TYRANNY_A2C_RANKINFO_PC netmsgclient;
            netmsgclient.wLastWinner = m_wLastWinner;
            for( int i=0; i<TYRANNY_MINI_RANKING_NUM; ++i )
                netmsgclient.sPlayerData[i] = m_sLastTop[i];

            for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
            {
                int nPicked = GetPicked(i);
                netmsgclient.sRewardBuff[i] = m_sRewardBuff[nPicked].sidSkill;
            }

            GLAgentServer::GetInstance().SENDTOALLCLIENT( &netmsgclient );

        }break;

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_RANKINFO_PC:

Add below / replace / compare:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_BUFF_REWARD:
        {
            GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD* pnetmsg = ( GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD* ) nmg;

            for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
                m_sRewardBuff[i] = pnetmsg->sRewardBuff[i];
        }break;
    };


[Hidden content]

Credits to the rightful owner.

NO SUPPORT WILL BE GIVEN.
thx sir
 
Might as well share this.


DxGlobalStage.cpp

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_RANKINFO_PC:

Add:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_BUFF_REWARD:

GLAgentServerEx.cpp

Find:
C++:
netmsgbuff.sRewardBuffMain = GLPVPTyrannyAgent::GetInstance().m_sRewardBuffMain;

Add and replace:
C++:
for ( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
    {
        if ( i <= GLPVPTyrannyAgent::GetInstance().GetTotalBuff() )
        {
            int nPicked = GLPVPTyrannyAgent::GetInstance().GetPicked(i);
            const SNATIVEID &sID = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[nPicked].sidSkill;
            if ( sID != NATIVEID_NULL() && GLPVPTyrannyAgent::GetInstance().m_sRewardBuff->sidSkill.wMainID == 51 )
            {
                PGLSKILL pSkill = GLSkillMan::GetInstance().GetData ( sID );
                if ( !pSkill )    continue;


                if ( pSkill->m_sBASIC.sNATIVEID.wMainID != GLPVPTyrannyAgent::GetInstance().m_sRewardBuff->sidSkill.wMainID ) continue;


                netmsgbuff.sRewardBuff[i] = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[nPicked];
            }
        }
    }
    //netmsgbuff.sRewardBuff[i] = GLPVPTyrannyAgent::GetInstance().m_sRewardBuff[i];

GLPVPTyrannyAgent.cpp

Find:
C++:
GLAgentServer::GetInstance().TyrannyResetBuffs();

Add:
C++:
//every fucking registration time set the new reward buff
    SetRewardBuff();

Same file add function at the end:
C++:
void GLPVPTyrannyAgent::SetRewardBuff()
{
    m_sRewardBuffCount = 0;
    typedef std::multimap<DWORD,SNATIVEID>        MAP_REWARDBUFF;
    typedef MAP_REWARDBUFF::iterator            MAP_REWARDBUFF_ITER;

    MAP_REWARDBUFF mapREWARDBUFFGET;
    mapREWARDBUFFGET.clear();

    while ( mapREWARDBUFFGET.size() < 4 )
    {
        int nRand = RandomNumber ( 0, 9 );

        if ( nRand > 9 ) return;
        if ( nRand < 0 ) return;

        //const SNATIVEID &sID = SNATIVEID(m_sRewardBuff[nRand].wMainID,m_sRewardBuff[nRand].wSubID);
        const SNATIVEID &sID = m_sRewardBuff[nRand].sidSkill;

        MAP_REWARDBUFF_ITER iter = mapREWARDBUFFGET.find ( sID.dwID );
        if ( iter == mapREWARDBUFFGET.end() )
        {
            PGLSKILL pSkill = GLSkillMan::GetInstance().GetData ( sID );
            if ( pSkill )                                                 
            {
                m_nBuffPicked[m_sRewardBuffCount] = nRand; 
                m_sRewardBuffCount++;
                mapREWARDBUFFGET.insert ( std::make_pair ( sID.dwID, sID ) );
            }
        }
    }

    //Send the fucking selected reward buffs to client
    GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD netmsgbuffreward;
    for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
    {
        int nPicked = GetPicked(i);
        netmsgbuffreward.sRewardBuff[i] = m_sRewardBuff[nPicked].sidSkill;
    }
    GLAgentServer::GetInstance().SENDTOALLCLIENT ( &netmsgbuffreward );

    GLAgentServer::GetInstance().CONSOLEMSG_WRITE("[Tyranny] Buff Picked: (%d)",m_sRewardBuffCount );
 );

    CDebugSet::ToFileWithTime( "_PVP_TW.txt", "SetRewardBuff - %d Total Buff Picked", m_sRewardBuffCount  );
    mapREWARDBUFFGET.clear();
}
int GLPVPTyrannyAgent::GetPicked( int i )
{
    return m_nBuffPicked[i];
}

GLPVPTyrannyAgentMSG.cpp

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_F2A_RANKINFO_PC:

Add/replace/compare:
C++:
case NET_MSG_GCTRL_TYRANNY_F2A_RANKINFO_PC:
        {
            GLMSG::SNETPC_TYRANNY_F2A_RANKINFO_PC* pnetmsg = ( GLMSG::SNETPC_TYRANNY_F2A_RANKINFO_PC* ) nmg;

            for( int i=0; i<TYRANNY_MINI_RANKING_NUM; ++i )
                m_sLastTop[i] = TYRANNY_PLAYER_DATA();

            for( int i=0; i<pnetmsg->wRankNum; ++i )
            {
                if ( pnetmsg->sPlayerData[i].wRankAll > 0 && pnetmsg->sPlayerData[i].wRankAll <= TYRANNY_MINI_RANKING_NUM )
                {
                    m_sLastTop[pnetmsg->sPlayerData[i].wRankAll-1] = pnetmsg->sPlayerData[i];
                }
            }

            GLMSG::SNETPC_TYRANNY_A2C_RANKINFO_PC netmsgclient;
            netmsgclient.wLastWinner = m_wLastWinner;
            for( int i=0; i<TYRANNY_MINI_RANKING_NUM; ++i )
                netmsgclient.sPlayerData[i] = m_sLastTop[i];

            for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
            {
                int nPicked = GetPicked(i);
                netmsgclient.sRewardBuff[i] = m_sRewardBuff[nPicked].sidSkill;
            }

            GLAgentServer::GetInstance().SENDTOALLCLIENT( &netmsgclient );

        }break;

Find:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_RANKINFO_PC:

Add below / replace / compare:
C++:
case NET_MSG_GCTRL_TYRANNY_A2C_BUFF_REWARD:
        {
            GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD* pnetmsg = ( GLMSG::SNETPC_TYRANNY_A2C_BUFF_REWARD* ) nmg;

            for( int i=0; i<TYRANNY_REWARD_BUFF_NUM; ++i )
                m_sRewardBuff[i] = pnetmsg->sRewardBuff[i];
        }break;
    };


[Hidden content]

Credits to the rightful owner.

NO SUPPORT WILL BE GIVEN.
let see how it is

Got lot problem here :D
Screenshot (203) - [Share] TW Random Buff - RaGEZONE Forums
 
Last edited:
Good day, awesome work as always (y).
Thank you for sharing.
 
We appreciate you guys replying but pls do take note that we do not tolerate spam and msg without relevant context. Use this opportunity to converse :) this is a forum. Welcome wherever you came from! 🚀
 
Back