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!

My v19 source + download

Initiate Mage
Joined
Sep 7, 2012
Messages
2
Reaction score
1
My v19 systems, consignment Market 90%,Flyff Coupon, Exchange is Complete.


adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums


in consignment tabs work 100%, tooltip, bla bla.
and in update 4, pets and others bugs fixed :D

obs:The taskbar bugged is because my PC is a crap.
 
Last edited:
Skilled Illusionist
Joined
Jun 22, 2011
Messages
337
Reaction score
13
realy nice done! are you gone make server or release it?
 
Newbie Spellweaver
Joined
Jul 3, 2013
Messages
18
Reaction score
0
why i cant tele to azria using the ticket?

how can i go to madrigal marketplace?
 
Initiate Mage
Joined
Jul 13, 2013
Messages
2
Reaction score
0
Please Help!!! After Pressing Retry The Neuz is not Responding
adeilson12 - My v19 source + download - RaGEZONE Forums

 
Joined
Nov 16, 2012
Messages
2
Reaction score
0
Please Help!!! After Pressing Retry The Neuz is not Responding
adeilson12 - My v19 source + download - RaGEZONE Forums


The error is probably due to a written NULL terminator to the array of chars. Try to either change the declaration of the variable and remove the array operators or check if the access to the array is out of boundary. To resolve the problem increase the array size to the desired value.
 
Newbie Spellweaver
Joined
Jul 31, 2013
Messages
6
Reaction score
0
HI how do i run it ?

how do i install the source ,

pleas sombody help me ?
 
Newbie Spellweaver
Joined
Dec 12, 2011
Messages
13
Reaction score
16
My v19 systems, consignment Market 90%,FlyffPiece, Exchange is Complete.


adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums


in consignment tabs work 100%, tooltip, bla bla.
and in update 4, pets and others bugs fixed :D

obs:The taskbar bugged is because my PC is a crap.
Wont give credits for Coupon?
 
Newbie Spellweaver
Joined
Jul 31, 2013
Messages
6
Reaction score
0
hi thank you for uploading files and i love it
buth i wanna make my own pserver for me and my friends
buth i got all your files buth i dont know what to do with it/wehere to place everything

i hope you can/would help mehe has:

-V19 buttons
-V19 colors
-Title of the windows in the center
-size of items in inventory (was lopsided if someone can help me)
-and various other little things

*change the theme for v19 theme
*do not forget to use my resource

Source


update 1:
- Fixed login
- Radius and check buttons fixed colors
- Environment effect now functional
- Pet filter was removed
- Fixed fast job change
- Resource no errors

Source


Update 1 imagens
adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums


update 2:
- NPC dialog crash fixed(when get quest- error in buttons)
- V19 buttons fixed
- Login buttton V19 style added (becomes clickable after writing something in the area of password)
- Status v19 bars added
- Messenger colors fixed
- Guild window buttons fixed
- Title of window v19 changed to flyff v19 USA
- Etc...

Source


Update 2 imagens
adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

UPDATE 3

-added new v19 parameters;
-treasure chest;
-new ticket system
-v19 new notice;
-v19 new adv buttons;
-loading screens v18/19 added;
-combobox adjusted size;
-resdata v19 color system;
-new reading spec_item;
-new reading propmover;
-v19 taskbar fixes( alt and f10 );
-v19 taskbar position of click to move fixed
-v19 taskbar slide fixed
-fixed many bugs;
-etc...;

*OBS:many things are set to see "__VER >= 19";

DOWNLOAD:



DOWNLOAD OF UPDATE 3 did contain:

-Source
-Dates
-Resource (no Models / no Worlds)
-Program Folder


SOME IMAGES:

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

adeilson12 - My v19 source + download - RaGEZONE Forums

sorry for my bad english





OTHER DOWNLOADs

RESOURCE:




*OBS:The resource is divided into 3 parts, join parties with hjsplit.exe;


THEME:


hi thank you for uploading files and i love it
buth i wanna make my own pserver for me and my friends
buth i got all your files buth i dont know what to do with it/wehere to place everything

i hope you can/would help me
 
Joined
Oct 6, 2008
Messages
471
Reaction score
73
hi thank you for uploading files and i love it
buth i wanna make my own pserver for me and my friends
buth i got all your files buth i dont know what to do with it/wehere to place everything

i hope you can/would help me

He isn't active, if you don't know what to do please read the guides we have available in the Flyff Tutorials section before asking in a release thread.
 
Newbie Spellweaver
Joined
Jul 31, 2013
Messages
6
Reaction score
0
He isn't active, if you don't know what to do please read the guides we have available in the Flyff Tutorials section before asking in a release thread.

i do buth every tutorial is diffrent and they chage files that i dont have ? :/
 
Newbie Spellweaver
Joined
Nov 29, 2012
Messages
49
Reaction score
0
Which database should i use? Is the database is included of this post? @_@​
 
Newbie Spellweaver
Joined
Nov 29, 2012
Messages
49
Reaction score
0
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?​
 
Newbie Spellweaver
Joined
Apr 29, 2011
Messages
97
Reaction score
10
@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. :)
 
Newbie Spellweaver
Joined
Nov 29, 2012
Messages
49
Reaction score
0
@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.​
 
Newbie Spellweaver
Joined
Apr 29, 2011
Messages
97
Reaction score
10
@Joren - just edit the navigator thru source or you can make it small so that it could fit in the Circle Navigator.
 
Newbie Spellweaver
Joined
Nov 29, 2012
Messages
49
Reaction score
0
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. :blushing:
pm me or reply for this thread. thanks appreciate it:)
 
Loyal Member
Joined
Aug 1, 2011
Messages
1,122
Reaction score
153
@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). ^^
 
Newbie Spellweaver
Joined
Apr 29, 2011
Messages
97
Reaction score
10
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:
#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.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
#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
#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.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
#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. :thumbup1:
 
Back
Top