My v19 source + download

Page 35 of 43 FirstFirst ... 252728293031323334353637383940414243 LastLast
Results 511 to 525 of 641
  1. #511
    Account Inactive ademir is offline
    InactiveRank
    Sep 2012 Join Date
    2Posts

    Re: My v19 source + download

    My v19 source + download
    Quote Originally Posted by Jopsi332 View Post
    Wont give credits for Coupon?
    The credits are mine!

  2. #512
    Member Joren Reis is offline
    MemberRank
    Nov 2012 Join Date
    PhilippinesLocation
    49Posts

    Re: My v19 source + download

    Which database should i use? Is the database is included of this post? @_@

  3. #513
    Account Upgraded | Title Enabled! Fur Zi is offline
    True MemberRank
    Feb 2012 Join Date
    HellLocation
    229Posts

    Re: My v19 source + download

    ^ You can use v15 database, just restore it if you don't want to see crappy errors.

  4. #514
    Member Joren Reis is offline
    MemberRank
    Nov 2012 Join Date
    PhilippinesLocation
    49Posts

    Re: My v19 source + download

    Client crashed when i'm trying to login. :/ Hmm Seems like the update 3 doesn't fully fixed? I'm also using Flyff Gold Client. Is there anyone could help me? :3

    What client should i use?

  5. #515
    Member Equisol is offline
    MemberRank
    Apr 2011 Join Date
    FlyFF.CodesLocation
    95Posts

    Re: My v19 source + download

    @Joren Reis - Update 3 works for me. They say that the Colosseum is bugged. Yes in its BUGGED! But i already FIXED it just by Changing the Codes in Colosseum.cpp and Colosseum.h.

    And also you can custom edit the Update 3 for this matter, it just require basic knowledge for the source. :)
    [STRIKE]Dexus[/STRIKE]

  6. #516
    Member Joren Reis is offline
    MemberRank
    Nov 2012 Join Date
    PhilippinesLocation
    49Posts

    Re: My v19 source + download

    [QUOTE=Equisol;7807433]@Joren Reis - Update 3 works for me. They say that the Colosseum is bugged. Yes in its BUGGED! But i already FIXED it just by Changing the Codes in Colosseum.cpp and Colosseum.h.

    And also you can custom edit the Update 3 for this matter, it just require basic knowledge for the source. :)[/

    I have a simple knowledge for developing cause i came from Ran Pserver but sometimes i just need to ask something to gain some idea :) Now this all files is now working fine for my computer, No bugs and errors. and one thing just wanna know. lol i know navigator is working fine but what is the sqaure texture under the circle navigator. ? how can i fix this? someone told me that i need to draw minimap in render d3d? something like that blah blah blah.

  7. #517
    Member Equisol is offline
    MemberRank
    Apr 2011 Join Date
    FlyFF.CodesLocation
    95Posts

    Re: My v19 source + download

    @Joren - just edit the navigator thru source or you can make it small so that it could fit in the Circle Navigator.
    [STRIKE]Dexus[/STRIKE]

  8. #518
    Member Joren Reis is offline
    MemberRank
    Nov 2012 Join Date
    PhilippinesLocation
    49Posts

    Re: My v19 source + download

    I still can't make it:/ I replace and add something in wndfield but my minimap can't fit on circle navigator. Demn. i'm still hoping for someone who can solve my problem.
    pm me or reply for this thread. thanks appreciate it:)

  9. #519
    audisbroder is offline
    True MemberRank
    Aug 2011 Join Date
    Not foundLocation
    1,186Posts

    Re: My v19 source + download

    Quote Originally Posted by Equisol View Post
    @Joren Reis - Update 3 works for me. They say that the Colosseum is bugged. Yes in its BUGGED! But i already FIXED it just by Changing the Codes in Colosseum.cpp and Colosseum.h.

    And also you can custom edit the Update 3 for this matter, it just require basic knowledge for the source. :)
    What kinda of codes do I have to look for Colosseum.cpp and Colosseum.h? (Give me a clue). ^^

  10. #520
    Member Equisol is offline
    MemberRank
    Apr 2011 Join Date
    FlyFF.CodesLocation
    95Posts

    Re: My v19 source + download

    Quote Originally Posted by audisbroder View Post
    What kinda of codes do I have to look for Colosseum.cpp and Colosseum.h? (Give me a clue). ^^
    This is what the Update 3 Colosseum.cpp and Colosseum.h looks like:

    Colosseum.cpp:
    Spoiler:
    #include "stdafx.h"
    #include "Colosseum.h"

    #ifdef __COLOSSEUM

    #include "defineText.h"
    #include "User.h"
    #include "worldmng.h"

    extern CWorldMng g_WorldMng;
    extern CUserMng g_UserMng;
    extern CPartyMng g_PartyMng;


    CColosseumMng::CColosseumMng()
    {
    }

    CColosseumMng::~CColosseumMng()
    {
    }

    CColosseumMng* CColosseumMng::GetInstance( void )
    {
    static CColosseumMng sColosseum;
    return &sColosseum;
    }

    BOOL CColosseumMng::CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu )
    {
    CParty* pParty = g_PartyMng.GetParty( pUser->GetPartyId() );
    if( pParty && IsValidObj( pUser ) )
    {
    if( GetMatchByParty( pParty ) != 0 ) return FALSE;
    if( !pUser->GetGuild() && byMenu == 2 ) return FALSE;
    if( byDifficult != 1 && byDifficult != 2 ) byDifficult = 1;
    if( byMenu != 1 && byMenu != 2 ) byMenu = 1;
    if( byDifficult == 1 && pUser->m_nLevel > 90 ) return FALSE;

    CColosseumMatch* pMatch = new CColosseumMatch;
    pMatch->m_uPartyID = pParty->m_uPartyId;
    pMatch->m_byDifficult = byDifficult;
    pMatch->m_byMenu = byMenu;
    if( byMenu == 2 )
    pMatch->m_uGuildID = pUser->m_idGuild;

    if( byMenu == 1 )
    pMatch->m_byBossStage = xRandom( 1, byMaxLowStage );
    else
    pMatch->m_byBossStage = xRandom( 1, byMaxHardStage );

    pMatch->CreateRoomLayer();

    for( int i = 1; i < pParty->m_nSizeofMember; i++ )
    {
    CUser* pPartyUser = g_UserMng.GetUserByPlayerID( pParty->m_aMember[i].m_uPlayerId );
    if( pPartyUser )
    if( pMatch->m_byMenu == 2 )
    {
    if( pPartyUser->m_idGuild == pMatch->m_uGuildID )
    pPartyUser->SendColosseumEnter();
    }
    else
    pPartyUser->SendColosseumEnter();
    }

    m_mapMatch.insert( make_pair( pParty->m_uPartyId, pMatch ));
    return TRUE;
    }
    return FALSE;
    }

    BOOL CColosseumMng::LoadScript()
    {
    if( m_Lua.RunScript( "Colosseum.lua" ) != 0 )
    {
    Error( "Colosseum.lua Load Failed!!!" );
    exit(0);
    }

    nStartWaitTime = static_cast<int>( m_Lua.GetGlobalNumber( "StartWaitTime" ) );
    nWaitAfterStage = static_cast<int>( m_Lua.GetGlobalNumber( "WaitAfterStage" ) );
    byMaxLowStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "LowStages" ) );
    byMaxHardStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "HardStages" ) );

    m_Lua.GetGloabal( "tMonster" );
    m_Lua.PushNil();


    while( m_Lua.TableLoop( -2 ) )
    {
    __COLOSSEUM_MONSTER srMonster;
    srMonster.dwFakeId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strFakeMonsterId" ) ) );
    srMonster.dwTrueId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strTrueMonsterId" ) ) );
    srMonster.nTime = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nTime" ) );
    srMonster.nStage = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nStage" ) );
    srMonster.nDifficult = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nType" ) );
    srMonster.nProb = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nProb" ) );
    m_vecMonster.push_back( srMonster );
    m_Lua.Pop(1);
    }


    m_Lua.Pop(0);


    return TRUE;
    }

    void CColosseumMng::DestroyMatch( u_long m_uPartyID )
    {
    COLOSSEUMMATCH::iterator it=m_mapMatch.find( m_uPartyID );
    if( it == m_mapMatch.end() )
    {
    return;
    }

    safe_delete ( it->second );
    m_mapMatch.erase( it );
    }

    void CColosseumMng::Process()
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    u_long idParty = it->first;
    CColosseumMatch* pMatch = it->second;

    if( !pMatch ) return;

    CMover* pMover = prj.GetMover(pMatch->m_nMoverID);
    if( pMover )
    {
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    pMatch->EndMatch( FALSE );
    }
    else
    {
    //Kontrollieren ob letze Stage erreicht wurde
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    {
    if( pMatch->m_nStage == 0 )
    {
    for( int i = 0; i < pMatch->m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = pMatch->GetUser( pMatch->m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) && pMatch->m_bWaitTime )
    pUser->SendColosseumStart(0);
    }
    }
    if( pMatch->m_nStage >= byMaxLowStage )
    pMatch->EndMatch( TRUE );
    else
    {
    pMatch->m_bWaitTime = FALSE;
    pMatch->m_nStage++;
    pMatch->CreateMover();
    }
    }
    }
    }
    }

    CColosseumMatch* CColosseumMng::GetMatchByParty( CParty* pParty)
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    if( pParty->m_uPartyId == it->first )
    {
    return it->second;
    }


    return NULL;
    }

    CColosseumMatch* CColosseumMng::GetMatchByMoverID( DWORD dwMoverID )
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    CColosseumMatch* cMatch = it->second;
    if( cMatch && cMatch->m_nMoverID == dwMoverID )
    return cMatch;
    }

    return NULL;
    }

    CColosseumMatch::CColosseumMatch()
    {
    m_bWaitTime = TRUE;
    m_nMoverID = NULL;
    m_nStartTime = g_tmCurrent;
    m_nStage = 0;
    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nStartWaitTime;
    }

    CColosseumMatch::~CColosseumMatch()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->Invalidate( m_uPartyID );
    }

    void CColosseumMatch::Process()
    {
    }
    void CColosseumMatch::CreateMover()
    {
    int nMoverID = 0;
    int nTime = 0;

    vector<__COLOSSEUM_MONSTER> m_vecMobInfo = CColosseumMng::GetInstance()->m_vecMonster;
    for( unsigned int i = 0; i < m_vecMobInfo.size(); i++ )
    {
    if( m_vecMobInfo.at(i).nDifficult == m_byDifficult && m_vecMobInfo.at(i).nStage == m_nStage )
    {
    int nRnd = xRandom(1, 100);

    if( nRnd > 100 - m_vecMobInfo.at(i).nProb )
    nMoverID = m_vecMobInfo.at(i).dwTrueId;
    else
    nMoverID = m_vecMobInfo.at(i).dwFakeId;

    nTime = m_vecMobInfo.at(i).nTime;
    m_nNextStage = g_tmCurrent + nTime;
    }
    }

    if( nMoverID != 0 )
    {
    MoverProp* pMoverProp = prj.GetMoverPropEx( nMoverID );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );

    if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
    {
    D3DXVECTOR3 vPos( 1291.0F, 100.0F, 1231.0F );
    CObj* pObj = CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
    pObj->SetPos( vPos );
    pObj->InitMotion( MTI_STAND );
    pObj->UpdateLocalMatrix();
    ((CMover*)pObj)->m_bActiveAttack = TRUE;
    ((CMover*)pObj)->AddItToGlobalId();
    pWorld->ADDOBJ( pObj, FALSE, m_uPartyID );

    m_nMoverID = ((CMover*)pObj)->GetId();
    }
    if( pWorld->GetID() == WI_WORLD_MADRIGAL )
    {
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->SendColosseumReady2( nTime );
    }
    }

    void CColosseumMatch::CreateRoomLayer()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && !pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->CreateLayer( static_cast<int>( m_uPartyID ) );
    }

    CUser* CColosseumMatch::GetUser( u_long uPlayerID )
    {
    return g_UserMng.GetUserByPlayerID( uPlayerID );
    }

    void CColosseumMatch::EnterRoom( CUser* pUser )
    {
    if( IsValidObj( pUser ) && m_bWaitTime && !IsTeleported( pUser->m_idPlayer ) )
    {
    m_vecPlayerID.push_back( pUser->m_idPlayer );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld )
    if( pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    {
    pUser->SendColosseumStart( (int)(m_nNextStage) );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_COLOSSEUM, D3DXVECTOR3( 1446.0F, 100.0F, 1219.0F ), REPLACE_NORMAL, static_cast<int>( m_uPartyID ) );
    }
    }
    }

    void CColosseumMatch::KickUser( u_long m_uPlayerID )
    {
    BOOL bWin;
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, 0 );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }
    void CColosseumMatch::EndWaitTime()
    {

    if( m_bWaitTime )
    {
    m_nNextStage = (int)g_tmCurrent + (int)CColosseumMng::GetInstance()->nWaitAfterStage;
    m_bWaitTime = FALSE;
    }

    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {

    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumStart(0);
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }
    }
    }

    void CColosseumMatch::DestroyMover()
    {
    //CMover* g_pPlayer;
    CWorld* pWorld;/// = g_pPlayer->GetWorld();
    if( pWorld->GetID() == WI_WORLD_COLOSSEUM )
    {
    m_nMoverID = NULL;
    m_bWaitTime = FALSE;

    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nWaitAfterStage;

    TCHAR strInt[2];
    itoa( m_nStage, strInt, 10 );
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    CString strTemp;
    strTemp.Format(_T( prj.GetTextColor(TID_COLOSSEUM_COLOSUCCESS01) ), strInt );//.GetText
    pUser->AddText( strTemp );


    if( m_nStage < CColosseumMng::GetInstance()->byMaxHardStage )
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }

    }
    }
    else
    {
    }
    }

    void CColosseumMatch::EndMatch( BOOL bWin )
    {
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, ( g_tmCurrent - m_nStartTime ) );

    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }

    BOOL CColosseumMatch::IsTeleported( u_long m_uPlayerID )
    {
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_vecPlayerID.at(i) == m_uPlayerID )
    return TRUE;
    return FALSE;
    }
    #endif //__COLOSSEUM


    Colosseum.h
    Spoiler:
    #ifndef TESTCLASS_H
    #define TESTCLASS_H

    #ifdef __COLOSSEUM

    struct __COLOSSEUM_MONSTER
    {
    int dwTrueId;
    int dwFakeId;
    int nProb;
    int dwId;
    int nTime;
    int nStage;
    int nDifficult;
    };

    class CColosseumMatch
    {
    public:
    CColosseumMatch();
    virtual ~CColosseumMatch();
    void Process();
    void CreateMover();
    void DestroyMover();
    void CreateRoomLayer();
    void EnterRoom( CUser* pUser );
    void EndMatch( BOOL bWin );
    CUser* GetUser( u_long uPlayerID );
    void EndWaitTime();
    void KickUser( u_long m_uPlayerID );
    BOOL IsTeleported( u_long m_uPlayerID );

    u_long m_uPartyID;
    BYTE m_nStage;
    int m_nStartTime;
    int m_nNextStage;
    BOOL m_bWaitTime;
    BYTE m_byDifficult;
    BYTE m_byMenu;
    vector<u_long> m_vecPlayerID;
    DWORD m_nMoverID;
    u_long m_uGuildID;
    BYTE m_byBossStage;
    };

    typedef map<u_long, CColosseumMatch*> COLOSSEUMMATCH;

    class CColosseumMng
    {
    public:
    CColosseumMng();
    virtual ~CColosseumMng();

    static CColosseumMng* GetInstance( void );
    BOOL CreateRoomLayer( int nPartyID );
    void DeleteRoomLayer( int nPartyID );
    BOOL CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu );
    void Process();
    BOOL LoadScript();
    void DestroyMatch( u_long m_uPartyID );
    CColosseumMatch* GetMatchByParty( CParty* pParty );
    CColosseumMatch* GetMatchByMoverID( DWORD dwMoverID );

    CLuaBase m_Lua;
    int nStartWaitTime;
    int nWaitAfterStage;
    BYTE byMaxLowStage;
    BYTE byMaxHardStage;
    COLOSSEUMMATCH m_mapMatch;

    vector<__COLOSSEUM_MONSTER> m_vecMonster;
    };

    #endif //__COLOSSEUM
    #endif //__COLOSSEUM_H__


    And this what my Colosseum.cpp and Colosseum.h looks like:

    Colosseum.cpp
    Spoiler:
    #include "stdafx.h"
    #include "Colosseum.h"

    #ifdef __COLOSSEUM

    #include "defineText.h"
    #include "User.h"
    #include "worldmng.h"

    extern CWorldMng g_WorldMng;
    extern CUserMng g_UserMng;
    extern CPartyMng g_PartyMng;


    CColosseumMng::CColosseumMng()
    {
    }

    CColosseumMng::~CColosseumMng()
    {
    }

    CColosseumMng* CColosseumMng::GetInstance( void )
    {
    static CColosseumMng sColosseum;
    return &sColosseum;
    }

    BOOL CColosseumMng::CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu )
    {
    CParty* pParty = g_PartyMng.GetParty( pUser->GetPartyId() );
    if( pParty && IsValidObj( pUser ) )
    {
    if( GetMatchByParty( pParty ) != 0 ) return FALSE;
    if( !pUser->GetGuild() && byMenu == 2 ) return FALSE;
    if( byDifficult != 1 && byDifficult != 2 ) byDifficult = 1;
    if( byMenu != 1 && byMenu != 2 ) byMenu = 1;
    if( byDifficult == 1 && pUser->m_nLevel > 200 ) return FALSE;

    CColosseumMatch* pMatch = new CColosseumMatch;
    pMatch->m_uPartyID = pParty->m_uPartyId;
    pMatch->m_byDifficult = byDifficult;
    pMatch->m_byMenu = byMenu;
    if( byMenu == 2 )
    pMatch->m_uGuildID = pUser->m_idGuild;

    if( byMenu == 1 )
    pMatch->m_byBossStage = (BYTE)xRandom( 1, (BYTE)byMaxLowStage );
    else
    pMatch->m_byBossStage = (BYTE)xRandom( 1, (BYTE)byMaxHardStage );

    pMatch->CreateRoomLayer();

    for( int i = 1; i < pParty->m_nSizeofMember; i++ )
    {
    CUser* pPartyUser = g_UserMng.GetUserByPlayerID( pParty->m_aMember[i].m_uPlayerId );
    if( pPartyUser )
    if( pMatch->m_byMenu == 2 )
    {
    if( pPartyUser->m_idGuild == pMatch->m_uGuildID )
    pPartyUser->SendColosseumEnter();
    }
    else
    pPartyUser->SendColosseumEnter();
    }

    m_mapMatch.insert( make_pair( pParty->m_uPartyId, pMatch ));
    return TRUE;
    }
    return FALSE;
    }

    BOOL CColosseumMng::LoadScript()
    {
    if( m_Lua.RunScript( "Colosseum.lua" ) != 0 )
    {
    Error( "Colosseum.lua Load Failed!!!" );
    exit(0);
    }

    nStartWaitTime = static_cast<int>( m_Lua.GetGlobalNumber( "StartWaitTime" ) );
    nWaitAfterStage = static_cast<int>( m_Lua.GetGlobalNumber( "WaitAfterStage" ) );
    byMaxLowStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "LowStages" ) );
    byMaxHardStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "HardStages" ) );

    m_Lua.GetGloabal( "tMonster" );
    m_Lua.PushNil();

    while( m_Lua.TableLoop( -2 ) )
    {
    __COLOSSEUM_MONSTER srMonster;
    srMonster.dwId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strMonsterId" ) ) );
    srMonster.nTime = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nTime" ) );
    srMonster.nStage = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nStage" ) );
    srMonster.nDifficult = static_cast<int>( m_Lua.GetFieldToNumber(-1, "nType" ) );
    m_vecMonster.push_back( srMonster );
    m_Lua.Pop(1);
    }

    m_Lua.Pop(0);


    return TRUE;
    }

    void CColosseumMng::DestroyMatch( u_long m_uPartyID )
    {
    COLOSSEUMMATCH::iterator it=m_mapMatch.find( m_uPartyID );
    if( it == m_mapMatch.end() )
    return;

    safe_delete ( it->second );
    m_mapMatch.erase( it );
    }

    void CColosseumMng::Process()
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    u_long idParty = it->first;
    CColosseumMatch* pMatch = it->second;

    if( !pMatch ) return;

    CMover* pMover = prj.GetMover(pMatch->m_nMoverID);
    if( pMover )
    {
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    pMatch->EndMatch( FALSE );
    }
    else
    {
    //Kontrollieren ob letze Stage erreicht wurde
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    {
    if( pMatch->m_nStage == 0 )
    {
    for( unsigned int i = 0; i < pMatch->m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = pMatch->GetUser( pMatch->m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) && pMatch->m_bWaitTime )
    pUser->SendColosseumStart(0);
    }
    }
    if( pMatch->m_nStage >= byMaxLowStage )
    pMatch->EndMatch( TRUE );
    else
    {
    pMatch->m_bWaitTime = FALSE;
    pMatch->m_nStage++;
    pMatch->CreateMover();
    }
    }
    }
    }
    }

    CColosseumMatch* CColosseumMng::GetMatchByParty( CParty* pParty)
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    if( pParty->m_uPartyId == it->first )
    return it->second;

    return NULL;
    }

    CColosseumMatch* CColosseumMng::GetMatchByMoverID( DWORD dwMoverID )
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    CColosseumMatch* cMatch = it->second;
    if( cMatch->m_nMoverID == dwMoverID )
    return cMatch;
    }

    return NULL;
    }

    CColosseumMatch::CColosseumMatch()
    {
    m_bWaitTime = TRUE;
    m_nMoverID = NULL;
    m_nStartTime = g_tmCurrent;
    m_nStage = 0;
    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nStartWaitTime;
    }

    CColosseumMatch::~CColosseumMatch()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->Invalidate( m_uPartyID );
    }

    void CColosseumMatch::Process()
    {

    }

    void CColosseumMatch::CreateMover()
    {
    int nMoverID = 0;

    vector<__COLOSSEUM_MONSTER> m_vecMobInfo = CColosseumMng::GetInstance()->m_vecMonster;
    for( unsigned int i = 0; i < m_vecMobInfo.size(); i++ )
    {
    if( m_nStage == m_byBossStage && m_vecMobInfo.at(i).nDifficult == m_byDifficult )
    {
    nMoverID = m_vecMobInfo.at(i).dwId;
    m_nNextStage = g_tmCurrent + m_vecMobInfo.at(i).nTime;
    }
    else
    if( m_vecMobInfo.at(i).nDifficult == m_byDifficult && m_vecMobInfo.at(i).nStage == m_nStage )
    {
    nMoverID = m_vecMobInfo.at(i).dwId;
    m_nNextStage = g_tmCurrent + m_vecMobInfo.at(i).nTime;
    }
    }

    MoverProp* pMoverProp = prj.GetMoverPropEx( nMoverID );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
    {
    D3DXVECTOR3 vPos( 1296.0F, 100.0F, 1228.0F );
    CObj* pObj = CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
    pObj->SetPos( vPos );
    pObj->InitMotion( MTI_STAND );
    pObj->UpdateLocalMatrix();
    ((CMover*)pObj)->m_bActiveAttack = TRUE;
    ((CMover*)pObj)->AddItToGlobalId();
    pWorld->ADDOBJ( pObj, FALSE, m_uPartyID );

    m_nMoverID = ((CMover*)pObj)->GetId();
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->SendColosseumReady2( m_nNextStage );
    }
    }

    void CColosseumMatch::CreateRoomLayer()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && !pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->CreateLayer( static_cast<int>( m_uPartyID ) );
    }

    CUser* CColosseumMatch::GetUser( u_long uPlayerID )
    {
    return g_UserMng.GetUserByPlayerID( uPlayerID );
    }

    void CColosseumMatch::EnterRoom( CUser* pUser )
    {
    if( IsValidObj( pUser ) && m_bWaitTime && !IsTeleported( pUser->m_idPlayer ) )
    {
    m_vecPlayerID.push_back( pUser->m_idPlayer );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld )
    if( pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    {
    pUser->SendColosseumStart( (int)(m_nNextStage) );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_COLOSSEUM, D3DXVECTOR3( 1286.0F, 100.0F, 1087.0F ), REPLACE_NORMAL, static_cast<int>( m_uPartyID ) );
    }
    }
    }

    void CColosseumMatch::KickUser( u_long m_uPlayerID )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_uPlayerID == m_vecPlayerID.at(i) )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    m_vecPlayerID.erase(m_vecPlayerID.begin()+i);
    }
    }

    void CColosseumMatch::EndWaitTime()
    {

    if( m_bWaitTime )
    {
    m_nNextStage = (int)g_tmCurrent + (int)CColosseumMng::GetInstance()->nWaitAfterStage;
    m_bWaitTime = FALSE;
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {

    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumStart(0);
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }
    }
    }

    void CColosseumMatch::DestroyMover()
    {
    m_nMoverID = NULL;
    m_bWaitTime = FALSE;

    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nWaitAfterStage;

    TCHAR strInt[2];
    itoa( m_nStage, strInt, 10 );
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    CString strTemp;
    strTemp.Format(_T( prj.GetText(TID_COLOSSEUM_COLOSUCCESS01) ), strInt );
    pUser->AddText( strTemp );

    if( m_nStage < CColosseumMng::GetInstance()->byMaxHardStage )
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }

    }
    }

    void CColosseumMatch::EndMatch( BOOL bWin )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, ( g_tmCurrent - m_nStartTime ) );

    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }

    BOOL CColosseumMatch::IsTeleported( u_long m_uPlayerID )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_vecPlayerID.at(i) == m_uPlayerID )
    return TRUE;
    return FALSE;
    }
    #endif //__COLOSSEUM


    Colosseum.h
    Spoiler:
    #ifndef TESTCLASS_H
    #define TESTCLASS_H

    #ifdef __COLOSSEUM

    struct __COLOSSEUM_MONSTER
    {
    int dwId;
    int nTime;
    int nStage;
    int nDifficult;
    };

    class CColosseumMatch
    {
    public:
    CColosseumMatch();
    virtual ~CColosseumMatch();
    void Process();
    void CreateMover();
    void DestroyMover();
    void CreateRoomLayer();
    void EnterRoom( CUser* pUser );
    void EndMatch( BOOL bWin );
    CUser* GetUser( u_long uPlayerID );
    void EndWaitTime();
    void KickUser( u_long m_uPlayerID );
    BOOL IsTeleported( u_long m_uPlayerID );

    u_long m_uPartyID;
    BYTE m_nStage;
    int m_nStartTime;
    int m_nNextStage;
    BOOL m_bWaitTime;
    BYTE m_byDifficult;
    BYTE m_byMenu;
    vector<u_long> m_vecPlayerID;
    DWORD m_nMoverID;
    u_long m_uGuildID;
    BYTE m_byBossStage;
    };

    typedef map<u_long, CColosseumMatch*> COLOSSEUMMATCH;

    class CColosseumMng
    {
    public:
    CColosseumMng();
    virtual ~CColosseumMng();

    static CColosseumMng* GetInstance( void );
    BOOL CreateRoomLayer( int nPartyID );
    void DeleteRoomLayer( int nPartyID );
    BOOL CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu );
    void Process();
    BOOL LoadScript();
    void DestroyMatch( u_long m_uPartyID );
    CColosseumMatch* GetMatchByParty( CParty* pParty );
    CColosseumMatch* GetMatchByMoverID( DWORD dwMoverID );

    CLuaBase m_Lua;
    int nStartWaitTime;
    int nWaitAfterStage;
    BYTE byMaxLowStage;
    BYTE byMaxHardStage;
    COLOSSEUMMATCH m_mapMatch;

    vector<__COLOSSEUM_MONSTER> m_vecMonster;
    };

    #endif //__COLOSSEUM
    #endif //__COLOSSEUM_H__


    There you go. You can compare those files with mine.
    [STRIKE]Dexus[/STRIKE]

  11. #521
    audisbroder is offline
    True MemberRank
    Aug 2011 Join Date
    Not foundLocation
    1,186Posts

    Re: My v19 source + download

    Quote Originally Posted by Equisol View Post
    This is what the Update 3 Colosseum.cpp and Colosseum.h looks like:

    Colosseum.cpp:
    Spoiler:
    #include "stdafx.h"
    #include "Colosseum.h"

    #ifdef __COLOSSEUM

    #include "defineText.h"
    #include "User.h"
    #include "worldmng.h"

    extern CWorldMng g_WorldMng;
    extern CUserMng g_UserMng;
    extern CPartyMng g_PartyMng;


    CColosseumMng::CColosseumMng()
    {
    }

    CColosseumMng::~CColosseumMng()
    {
    }

    CColosseumMng* CColosseumMng::GetInstance( void )
    {
    static CColosseumMng sColosseum;
    return &sColosseum;
    }

    BOOL CColosseumMng::CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu )
    {
    CParty* pParty = g_PartyMng.GetParty( pUser->GetPartyId() );
    if( pParty && IsValidObj( pUser ) )
    {
    if( GetMatchByParty( pParty ) != 0 ) return FALSE;
    if( !pUser->GetGuild() && byMenu == 2 ) return FALSE;
    if( byDifficult != 1 && byDifficult != 2 ) byDifficult = 1;
    if( byMenu != 1 && byMenu != 2 ) byMenu = 1;
    if( byDifficult == 1 && pUser->m_nLevel > 90 ) return FALSE;

    CColosseumMatch* pMatch = new CColosseumMatch;
    pMatch->m_uPartyID = pParty->m_uPartyId;
    pMatch->m_byDifficult = byDifficult;
    pMatch->m_byMenu = byMenu;
    if( byMenu == 2 )
    pMatch->m_uGuildID = pUser->m_idGuild;

    if( byMenu == 1 )
    pMatch->m_byBossStage = xRandom( 1, byMaxLowStage );
    else
    pMatch->m_byBossStage = xRandom( 1, byMaxHardStage );

    pMatch->CreateRoomLayer();

    for( int i = 1; i < pParty->m_nSizeofMember; i++ )
    {
    CUser* pPartyUser = g_UserMng.GetUserByPlayerID( pParty->m_aMember[i].m_uPlayerId );
    if( pPartyUser )
    if( pMatch->m_byMenu == 2 )
    {
    if( pPartyUser->m_idGuild == pMatch->m_uGuildID )
    pPartyUser->SendColosseumEnter();
    }
    else
    pPartyUser->SendColosseumEnter();
    }

    m_mapMatch.insert( make_pair( pParty->m_uPartyId, pMatch ));
    return TRUE;
    }
    return FALSE;
    }

    BOOL CColosseumMng::LoadScript()
    {
    if( m_Lua.RunScript( "Colosseum.lua" ) != 0 )
    {
    Error( "Colosseum.lua Load Failed!!!" );
    exit(0);
    }

    nStartWaitTime = static_cast<int>( m_Lua.GetGlobalNumber( "StartWaitTime" ) );
    nWaitAfterStage = static_cast<int>( m_Lua.GetGlobalNumber( "WaitAfterStage" ) );
    byMaxLowStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "LowStages" ) );
    byMaxHardStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "HardStages" ) );

    m_Lua.GetGloabal( "tMonster" );
    m_Lua.PushNil();


    while( m_Lua.TableLoop( -2 ) )
    {
    __COLOSSEUM_MONSTER srMonster;
    srMonster.dwFakeId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strFakeMonsterId" ) ) );
    srMonster.dwTrueId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strTrueMonsterId" ) ) );
    srMonster.nTime = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nTime" ) );
    srMonster.nStage = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nStage" ) );
    srMonster.nDifficult = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nType" ) );
    srMonster.nProb = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nProb" ) );
    m_vecMonster.push_back( srMonster );
    m_Lua.Pop(1);
    }


    m_Lua.Pop(0);


    return TRUE;
    }

    void CColosseumMng::DestroyMatch( u_long m_uPartyID )
    {
    COLOSSEUMMATCH::iterator it=m_mapMatch.find( m_uPartyID );
    if( it == m_mapMatch.end() )
    {
    return;
    }

    safe_delete ( it->second );
    m_mapMatch.erase( it );
    }

    void CColosseumMng::Process()
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    u_long idParty = it->first;
    CColosseumMatch* pMatch = it->second;

    if( !pMatch ) return;

    CMover* pMover = prj.GetMover(pMatch->m_nMoverID);
    if( pMover )
    {
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    pMatch->EndMatch( FALSE );
    }
    else
    {
    //Kontrollieren ob letze Stage erreicht wurde
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    {
    if( pMatch->m_nStage == 0 )
    {
    for( int i = 0; i < pMatch->m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = pMatch->GetUser( pMatch->m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) && pMatch->m_bWaitTime )
    pUser->SendColosseumStart(0);
    }
    }
    if( pMatch->m_nStage >= byMaxLowStage )
    pMatch->EndMatch( TRUE );
    else
    {
    pMatch->m_bWaitTime = FALSE;
    pMatch->m_nStage++;
    pMatch->CreateMover();
    }
    }
    }
    }
    }

    CColosseumMatch* CColosseumMng::GetMatchByParty( CParty* pParty)
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    if( pParty->m_uPartyId == it->first )
    {
    return it->second;
    }


    return NULL;
    }

    CColosseumMatch* CColosseumMng::GetMatchByMoverID( DWORD dwMoverID )
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    CColosseumMatch* cMatch = it->second;
    if( cMatch && cMatch->m_nMoverID == dwMoverID )
    return cMatch;
    }

    return NULL;
    }

    CColosseumMatch::CColosseumMatch()
    {
    m_bWaitTime = TRUE;
    m_nMoverID = NULL;
    m_nStartTime = g_tmCurrent;
    m_nStage = 0;
    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nStartWaitTime;
    }

    CColosseumMatch::~CColosseumMatch()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->Invalidate( m_uPartyID );
    }

    void CColosseumMatch::Process()
    {
    }
    void CColosseumMatch::CreateMover()
    {
    int nMoverID = 0;
    int nTime = 0;

    vector<__COLOSSEUM_MONSTER> m_vecMobInfo = CColosseumMng::GetInstance()->m_vecMonster;
    for( unsigned int i = 0; i < m_vecMobInfo.size(); i++ )
    {
    if( m_vecMobInfo.at(i).nDifficult == m_byDifficult && m_vecMobInfo.at(i).nStage == m_nStage )
    {
    int nRnd = xRandom(1, 100);

    if( nRnd > 100 - m_vecMobInfo.at(i).nProb )
    nMoverID = m_vecMobInfo.at(i).dwTrueId;
    else
    nMoverID = m_vecMobInfo.at(i).dwFakeId;

    nTime = m_vecMobInfo.at(i).nTime;
    m_nNextStage = g_tmCurrent + nTime;
    }
    }

    if( nMoverID != 0 )
    {
    MoverProp* pMoverProp = prj.GetMoverPropEx( nMoverID );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );

    if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
    {
    D3DXVECTOR3 vPos( 1291.0F, 100.0F, 1231.0F );
    CObj* pObj = CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
    pObj->SetPos( vPos );
    pObj->InitMotion( MTI_STAND );
    pObj->UpdateLocalMatrix();
    ((CMover*)pObj)->m_bActiveAttack = TRUE;
    ((CMover*)pObj)->AddItToGlobalId();
    pWorld->ADDOBJ( pObj, FALSE, m_uPartyID );

    m_nMoverID = ((CMover*)pObj)->GetId();
    }
    if( pWorld->GetID() == WI_WORLD_MADRIGAL )
    {
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->SendColosseumReady2( nTime );
    }
    }

    void CColosseumMatch::CreateRoomLayer()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && !pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->CreateLayer( static_cast<int>( m_uPartyID ) );
    }

    CUser* CColosseumMatch::GetUser( u_long uPlayerID )
    {
    return g_UserMng.GetUserByPlayerID( uPlayerID );
    }

    void CColosseumMatch::EnterRoom( CUser* pUser )
    {
    if( IsValidObj( pUser ) && m_bWaitTime && !IsTeleported( pUser->m_idPlayer ) )
    {
    m_vecPlayerID.push_back( pUser->m_idPlayer );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld )
    if( pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    {
    pUser->SendColosseumStart( (int)(m_nNextStage) );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_COLOSSEUM, D3DXVECTOR3( 1446.0F, 100.0F, 1219.0F ), REPLACE_NORMAL, static_cast<int>( m_uPartyID ) );
    }
    }
    }

    void CColosseumMatch::KickUser( u_long m_uPlayerID )
    {
    BOOL bWin;
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, 0 );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }
    void CColosseumMatch::EndWaitTime()
    {

    if( m_bWaitTime )
    {
    m_nNextStage = (int)g_tmCurrent + (int)CColosseumMng::GetInstance()->nWaitAfterStage;
    m_bWaitTime = FALSE;
    }

    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {

    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumStart(0);
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }
    }
    }

    void CColosseumMatch::DestroyMover()
    {
    //CMover* g_pPlayer;
    CWorld* pWorld;/// = g_pPlayer->GetWorld();
    if( pWorld->GetID() == WI_WORLD_COLOSSEUM )
    {
    m_nMoverID = NULL;
    m_bWaitTime = FALSE;

    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nWaitAfterStage;

    TCHAR strInt[2];
    itoa( m_nStage, strInt, 10 );
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    CString strTemp;
    strTemp.Format(_T( prj.GetTextColor(TID_COLOSSEUM_COLOSUCCESS01) ), strInt );//.GetText
    pUser->AddText( strTemp );


    if( m_nStage < CColosseumMng::GetInstance()->byMaxHardStage )
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }

    }
    }
    else
    {
    }
    }

    void CColosseumMatch::EndMatch( BOOL bWin )
    {
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, ( g_tmCurrent - m_nStartTime ) );

    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }

    BOOL CColosseumMatch::IsTeleported( u_long m_uPlayerID )
    {
    for( int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_vecPlayerID.at(i) == m_uPlayerID )
    return TRUE;
    return FALSE;
    }
    #endif //__COLOSSEUM


    Colosseum.h
    Spoiler:
    #ifndef TESTCLASS_H
    #define TESTCLASS_H

    #ifdef __COLOSSEUM

    struct __COLOSSEUM_MONSTER
    {
    int dwTrueId;
    int dwFakeId;
    int nProb;
    int dwId;
    int nTime;
    int nStage;
    int nDifficult;
    };

    class CColosseumMatch
    {
    public:
    CColosseumMatch();
    virtual ~CColosseumMatch();
    void Process();
    void CreateMover();
    void DestroyMover();
    void CreateRoomLayer();
    void EnterRoom( CUser* pUser );
    void EndMatch( BOOL bWin );
    CUser* GetUser( u_long uPlayerID );
    void EndWaitTime();
    void KickUser( u_long m_uPlayerID );
    BOOL IsTeleported( u_long m_uPlayerID );

    u_long m_uPartyID;
    BYTE m_nStage;
    int m_nStartTime;
    int m_nNextStage;
    BOOL m_bWaitTime;
    BYTE m_byDifficult;
    BYTE m_byMenu;
    vector<u_long> m_vecPlayerID;
    DWORD m_nMoverID;
    u_long m_uGuildID;
    BYTE m_byBossStage;
    };

    typedef map<u_long, CColosseumMatch*> COLOSSEUMMATCH;

    class CColosseumMng
    {
    public:
    CColosseumMng();
    virtual ~CColosseumMng();

    static CColosseumMng* GetInstance( void );
    BOOL CreateRoomLayer( int nPartyID );
    void DeleteRoomLayer( int nPartyID );
    BOOL CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu );
    void Process();
    BOOL LoadScript();
    void DestroyMatch( u_long m_uPartyID );
    CColosseumMatch* GetMatchByParty( CParty* pParty );
    CColosseumMatch* GetMatchByMoverID( DWORD dwMoverID );

    CLuaBase m_Lua;
    int nStartWaitTime;
    int nWaitAfterStage;
    BYTE byMaxLowStage;
    BYTE byMaxHardStage;
    COLOSSEUMMATCH m_mapMatch;

    vector<__COLOSSEUM_MONSTER> m_vecMonster;
    };

    #endif //__COLOSSEUM
    #endif //__COLOSSEUM_H__


    And this what my Colosseum.cpp and Colosseum.h looks like:

    Colosseum.cpp
    Spoiler:
    #include "stdafx.h"
    #include "Colosseum.h"

    #ifdef __COLOSSEUM

    #include "defineText.h"
    #include "User.h"
    #include "worldmng.h"

    extern CWorldMng g_WorldMng;
    extern CUserMng g_UserMng;
    extern CPartyMng g_PartyMng;


    CColosseumMng::CColosseumMng()
    {
    }

    CColosseumMng::~CColosseumMng()
    {
    }

    CColosseumMng* CColosseumMng::GetInstance( void )
    {
    static CColosseumMng sColosseum;
    return &sColosseum;
    }

    BOOL CColosseumMng::CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu )
    {
    CParty* pParty = g_PartyMng.GetParty( pUser->GetPartyId() );
    if( pParty && IsValidObj( pUser ) )
    {
    if( GetMatchByParty( pParty ) != 0 ) return FALSE;
    if( !pUser->GetGuild() && byMenu == 2 ) return FALSE;
    if( byDifficult != 1 && byDifficult != 2 ) byDifficult = 1;
    if( byMenu != 1 && byMenu != 2 ) byMenu = 1;
    if( byDifficult == 1 && pUser->m_nLevel > 200 ) return FALSE;

    CColosseumMatch* pMatch = new CColosseumMatch;
    pMatch->m_uPartyID = pParty->m_uPartyId;
    pMatch->m_byDifficult = byDifficult;
    pMatch->m_byMenu = byMenu;
    if( byMenu == 2 )
    pMatch->m_uGuildID = pUser->m_idGuild;

    if( byMenu == 1 )
    pMatch->m_byBossStage = (BYTE)xRandom( 1, (BYTE)byMaxLowStage );
    else
    pMatch->m_byBossStage = (BYTE)xRandom( 1, (BYTE)byMaxHardStage );

    pMatch->CreateRoomLayer();

    for( int i = 1; i < pParty->m_nSizeofMember; i++ )
    {
    CUser* pPartyUser = g_UserMng.GetUserByPlayerID( pParty->m_aMember[i].m_uPlayerId );
    if( pPartyUser )
    if( pMatch->m_byMenu == 2 )
    {
    if( pPartyUser->m_idGuild == pMatch->m_uGuildID )
    pPartyUser->SendColosseumEnter();
    }
    else
    pPartyUser->SendColosseumEnter();
    }

    m_mapMatch.insert( make_pair( pParty->m_uPartyId, pMatch ));
    return TRUE;
    }
    return FALSE;
    }

    BOOL CColosseumMng::LoadScript()
    {
    if( m_Lua.RunScript( "Colosseum.lua" ) != 0 )
    {
    Error( "Colosseum.lua Load Failed!!!" );
    exit(0);
    }

    nStartWaitTime = static_cast<int>( m_Lua.GetGlobalNumber( "StartWaitTime" ) );
    nWaitAfterStage = static_cast<int>( m_Lua.GetGlobalNumber( "WaitAfterStage" ) );
    byMaxLowStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "LowStages" ) );
    byMaxHardStage = static_cast<BYTE>( m_Lua.GetGlobalNumber( "HardStages" ) );

    m_Lua.GetGloabal( "tMonster" );
    m_Lua.PushNil();

    while( m_Lua.TableLoop( -2 ) )
    {
    __COLOSSEUM_MONSTER srMonster;
    srMonster.dwId = static_cast<int>( CScript::GetDefineNum( m_Lua.GetFieldToString( -1, "strMonsterId" ) ) );
    srMonster.nTime = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nTime" ) );
    srMonster.nStage = static_cast<int>( m_Lua.GetFieldToNumber( -1, "nStage" ) );
    srMonster.nDifficult = static_cast<int>( m_Lua.GetFieldToNumber(-1, "nType" ) );
    m_vecMonster.push_back( srMonster );
    m_Lua.Pop(1);
    }

    m_Lua.Pop(0);


    return TRUE;
    }

    void CColosseumMng::DestroyMatch( u_long m_uPartyID )
    {
    COLOSSEUMMATCH::iterator it=m_mapMatch.find( m_uPartyID );
    if( it == m_mapMatch.end() )
    return;

    safe_delete ( it->second );
    m_mapMatch.erase( it );
    }

    void CColosseumMng::Process()
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    u_long idParty = it->first;
    CColosseumMatch* pMatch = it->second;

    if( !pMatch ) return;

    CMover* pMover = prj.GetMover(pMatch->m_nMoverID);
    if( pMover )
    {
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    pMatch->EndMatch( FALSE );
    }
    else
    {
    //Kontrollieren ob letze Stage erreicht wurde
    if( pMatch->m_nNextStage < (int)g_tmCurrent )
    {
    if( pMatch->m_nStage == 0 )
    {
    for( unsigned int i = 0; i < pMatch->m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = pMatch->GetUser( pMatch->m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) && pMatch->m_bWaitTime )
    pUser->SendColosseumStart(0);
    }
    }
    if( pMatch->m_nStage >= byMaxLowStage )
    pMatch->EndMatch( TRUE );
    else
    {
    pMatch->m_bWaitTime = FALSE;
    pMatch->m_nStage++;
    pMatch->CreateMover();
    }
    }
    }
    }
    }

    CColosseumMatch* CColosseumMng::GetMatchByParty( CParty* pParty)
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    if( pParty->m_uPartyId == it->first )
    return it->second;

    return NULL;
    }

    CColosseumMatch* CColosseumMng::GetMatchByMoverID( DWORD dwMoverID )
    {
    for( COLOSSEUMMATCH::iterator it = m_mapMatch.begin(); it != m_mapMatch.end(); it++ )
    {
    CColosseumMatch* cMatch = it->second;
    if( cMatch->m_nMoverID == dwMoverID )
    return cMatch;
    }

    return NULL;
    }

    CColosseumMatch::CColosseumMatch()
    {
    m_bWaitTime = TRUE;
    m_nMoverID = NULL;
    m_nStartTime = g_tmCurrent;
    m_nStage = 0;
    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nStartWaitTime;
    }

    CColosseumMatch::~CColosseumMatch()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->Invalidate( m_uPartyID );
    }

    void CColosseumMatch::Process()
    {

    }

    void CColosseumMatch::CreateMover()
    {
    int nMoverID = 0;

    vector<__COLOSSEUM_MONSTER> m_vecMobInfo = CColosseumMng::GetInstance()->m_vecMonster;
    for( unsigned int i = 0; i < m_vecMobInfo.size(); i++ )
    {
    if( m_nStage == m_byBossStage && m_vecMobInfo.at(i).nDifficult == m_byDifficult )
    {
    nMoverID = m_vecMobInfo.at(i).dwId;
    m_nNextStage = g_tmCurrent + m_vecMobInfo.at(i).nTime;
    }
    else
    if( m_vecMobInfo.at(i).nDifficult == m_byDifficult && m_vecMobInfo.at(i).nStage == m_nStage )
    {
    nMoverID = m_vecMobInfo.at(i).dwId;
    m_nNextStage = g_tmCurrent + m_vecMobInfo.at(i).nTime;
    }
    }

    MoverProp* pMoverProp = prj.GetMoverPropEx( nMoverID );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
    {
    D3DXVECTOR3 vPos( 1296.0F, 100.0F, 1228.0F );
    CObj* pObj = CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
    pObj->SetPos( vPos );
    pObj->InitMotion( MTI_STAND );
    pObj->UpdateLocalMatrix();
    ((CMover*)pObj)->m_bActiveAttack = TRUE;
    ((CMover*)pObj)->AddItToGlobalId();
    pWorld->ADDOBJ( pObj, FALSE, m_uPartyID );

    m_nMoverID = ((CMover*)pObj)->GetId();
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->SendColosseumReady2( m_nNextStage );
    }
    }

    void CColosseumMatch::CreateRoomLayer()
    {
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld && !pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    pWorld->CreateLayer( static_cast<int>( m_uPartyID ) );
    }

    CUser* CColosseumMatch::GetUser( u_long uPlayerID )
    {
    return g_UserMng.GetUserByPlayerID( uPlayerID );
    }

    void CColosseumMatch::EnterRoom( CUser* pUser )
    {
    if( IsValidObj( pUser ) && m_bWaitTime && !IsTeleported( pUser->m_idPlayer ) )
    {
    m_vecPlayerID.push_back( pUser->m_idPlayer );
    CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_COLOSSEUM );
    if( pWorld )
    if( pWorld->m_linkMap.GetLinkMap( static_cast<int>( m_uPartyID ) ) )
    {
    pUser->SendColosseumStart( (int)(m_nNextStage) );
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_COLOSSEUM, D3DXVECTOR3( 1286.0F, 100.0F, 1087.0F ), REPLACE_NORMAL, static_cast<int>( m_uPartyID ) );
    }
    }
    }

    void CColosseumMatch::KickUser( u_long m_uPlayerID )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_uPlayerID == m_vecPlayerID.at(i) )
    {
    CUser* pUser = g_UserMng.GetUserByPlayerID( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    m_vecPlayerID.erase(m_vecPlayerID.begin()+i);
    }
    }

    void CColosseumMatch::EndWaitTime()
    {

    if( m_bWaitTime )
    {
    m_nNextStage = (int)g_tmCurrent + (int)CColosseumMng::GetInstance()->nWaitAfterStage;
    m_bWaitTime = FALSE;
    }

    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {

    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumStart(0);
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }
    }
    }

    void CColosseumMatch::DestroyMover()
    {
    m_nMoverID = NULL;
    m_bWaitTime = FALSE;

    m_nNextStage = (int)g_tmCurrent + CColosseumMng::GetInstance()->nWaitAfterStage;

    TCHAR strInt[2];
    itoa( m_nStage, strInt, 10 );
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    CString strTemp;
    strTemp.Format(_T( prj.GetText(TID_COLOSSEUM_COLOSUCCESS01) ), strInt );
    pUser->AddText( strTemp );

    if( m_nStage < CColosseumMng::GetInstance()->byMaxHardStage )
    pUser->SendColosseumReady1( m_nNextStage, m_nStage + 1 );
    }

    }
    }

    void CColosseumMatch::EndMatch( BOOL bWin )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    {
    CUser* pUser = GetUser( m_vecPlayerID.at(i) );
    if( IsValidObj( pUser ) )
    {
    pUser->SendColosseumEndMatch( bWin, ( g_tmCurrent - m_nStartTime ) );

    pUser->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, D3DXVECTOR3( 6971.984f, 99.8f, 3336.884f ), REPLACE_NORMAL, nDefaultLayer );
    }
    }
    CColosseumMng::GetInstance()->DestroyMatch( m_uPartyID );
    }

    BOOL CColosseumMatch::IsTeleported( u_long m_uPlayerID )
    {
    for( unsigned int i = 0; i < m_vecPlayerID.size(); i++ )
    if( m_vecPlayerID.at(i) == m_uPlayerID )
    return TRUE;
    return FALSE;
    }
    #endif //__COLOSSEUM


    Colosseum.h
    Spoiler:
    #ifndef TESTCLASS_H
    #define TESTCLASS_H

    #ifdef __COLOSSEUM

    struct __COLOSSEUM_MONSTER
    {
    int dwId;
    int nTime;
    int nStage;
    int nDifficult;
    };

    class CColosseumMatch
    {
    public:
    CColosseumMatch();
    virtual ~CColosseumMatch();
    void Process();
    void CreateMover();
    void DestroyMover();
    void CreateRoomLayer();
    void EnterRoom( CUser* pUser );
    void EndMatch( BOOL bWin );
    CUser* GetUser( u_long uPlayerID );
    void EndWaitTime();
    void KickUser( u_long m_uPlayerID );
    BOOL IsTeleported( u_long m_uPlayerID );

    u_long m_uPartyID;
    BYTE m_nStage;
    int m_nStartTime;
    int m_nNextStage;
    BOOL m_bWaitTime;
    BYTE m_byDifficult;
    BYTE m_byMenu;
    vector<u_long> m_vecPlayerID;
    DWORD m_nMoverID;
    u_long m_uGuildID;
    BYTE m_byBossStage;
    };

    typedef map<u_long, CColosseumMatch*> COLOSSEUMMATCH;

    class CColosseumMng
    {
    public:
    CColosseumMng();
    virtual ~CColosseumMng();

    static CColosseumMng* GetInstance( void );
    BOOL CreateRoomLayer( int nPartyID );
    void DeleteRoomLayer( int nPartyID );
    BOOL CreateNewMatch( CUser* pUser, BYTE byDifficult, BYTE byMenu );
    void Process();
    BOOL LoadScript();
    void DestroyMatch( u_long m_uPartyID );
    CColosseumMatch* GetMatchByParty( CParty* pParty );
    CColosseumMatch* GetMatchByMoverID( DWORD dwMoverID );

    CLuaBase m_Lua;
    int nStartWaitTime;
    int nWaitAfterStage;
    BYTE byMaxLowStage;
    BYTE byMaxHardStage;
    COLOSSEUMMATCH m_mapMatch;

    vector<__COLOSSEUM_MONSTER> m_vecMonster;
    };

    #endif //__COLOSSEUM
    #endif //__COLOSSEUM_H__


    There you go. You can compare those files with mine.
    I'll do that when I have time, thanks dude!!

  12. #522
    Member Equisol is offline
    MemberRank
    Apr 2011 Join Date
    FlyFF.CodesLocation
    95Posts

    Re: My v19 source + download

    Quote Originally Posted by audisbroder View Post
    I'll do that when I have time, thanks dude!!
    No problem. Just hit the Like Button.
    [STRIKE]Dexus[/STRIKE]

  13. #523
    Newbie domz1337 is offline
    MemberRank
    Jan 2008 Join Date
    3Posts

    Re: My v19 source + download

    Any fix for incompatibility with windows 8 ?

  14. #524
    Member Joren Reis is offline
    MemberRank
    Nov 2012 Join Date
    PhilippinesLocation
    49Posts

    Re: My v19 source + download

    Quote Originally Posted by domz1337 View Post
    Any fix for incompatibility with windows 8 ?
    What do you mean? Mine i'm using windows 8.1 and this files working fine and yea Visual Studio too, But vs is too dificult to install you need to bypass regsvr32 by installing some required components.

  15. #525
    Newbie domz1337 is offline
    MemberRank
    Jan 2008 Join Date
    3Posts

    Re: My v19 source + download

    Well I thought it was incompatible with win8 because it works just fine on my win7 and winXP but there is 3 computers which i can't seem to connect(Win8 and 2x Win7). It used to work on those computers and even if i copy the client im using on win7 thats working to one of those 3 machines it still won't load into the world. It crashes after i choose the character to log in and i get this in client's error log.
    Code:
    2013/10/ 9   15:48:31   g_pPlayer is ready
    
    2013/10/ 9   15:48:32   Apr  8 2013 18:41:29 1 rCnt=1
    Neuz.exe caused an EXCEPTION_ACCESS_VIOLATION in module Neuz.exe at 0023:004C28AF
     - Registers
    EAX=00000000  EBX=7FFDE000  ECX=00000000  EDX=00ADB60C  ESI=00000000EDI=75EF4B8B  EBP=0018FD00  ESP=0018F7A4  EIP=004C28AF  FLG=00010293CS=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B
    
    0023:004C28AF Neuz.exe
    0023:0060B022Neuz.exe
    0023:0051194C Neuz.exe
    0023:004C3DE3 Neuz.exe
    0023:0046E9EB Neuz.exe
    0023:0048D9C0 Neuz.exe
    0023:0048D801 Neuz.exe
    0023:004756AC Neuz.exe
    0023:00943B9C Neuz.exe
    0023:75EF850D KERNEL32.DLL, BaseThreadInitThunk()+0014 byte(s)
    0023:77C8BF39 ntdll.dll, RtlInitializeExceptionChain()+0133 byte(s)
    0023:77C8BF0C ntdll.dll, RtlInitializeExceptionChain()+0088 byte(s)
    as for the server I'm not getting anything so I'm 99% positive it's something to do with the computers but what? Since I'm using the exact same client thats working on my win7 and win XP as stated above, it should work. A little help would be appreciated.



Advertisement