Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Share] TW Random Buff

Newbie Spellweaver
Joined
Jun 29, 2021
Messages
80
Reaction score
4
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
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
May 7, 2023
Messages
6
Reaction score
4
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 Ducking 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 Ducking 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
 
Newbie Spellweaver
Joined
Jan 1, 2021
Messages
92
Reaction score
13
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 Ducking 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 Ducking 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
 

Attachments

You must be registered for see attachments list
Last edited:
Elite Diviner
Joined
Sep 7, 2020
Messages
458
Reaction score
78
1685811884418 - [Share] TW Random Buff - RaGEZONE Forums


HELP o_O
 

Attachments

You must be registered for see attachments list
Banned
Banned
Joined
Aug 26, 2016
Messages
336
Reaction score
19
Good day, awesome work as always (y).
Thank you for sharing.
 
Back
Top