1110 lines
27 KiB
C++
1110 lines
27 KiB
C++
#include "stdafx.h"
|
|
#include "SGame.h"
|
|
#include "SGameSystem.h"
|
|
#include "SStringDB.h"
|
|
#include <tchar.h>
|
|
//#include "Util.h"
|
|
#include "SGameAvatarEx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameOption.h"
|
|
#include "SGameMessage.h"
|
|
#include "SQuestMgr.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SGameOtherPlayer.h"
|
|
#include "SGameLocalPlayer.h"
|
|
#include "SMotionMgr.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUISysMsgDefine.h"
|
|
#include "SLocalCommandDB.h"
|
|
#include "SSummonSlotMgr.h"
|
|
#include <toolkit/XEnv.h>
|
|
//#include <string>
|
|
|
|
#ifdef _COUNTRY_ME_
|
|
#include "Localization/MiddleEast.h"
|
|
#endif
|
|
#include "KTextPhrase.h"
|
|
|
|
/// 2010.11.10 - prodongi
|
|
#include "SGameLobbyDefine.h"
|
|
|
|
std::string SGameSystem::OnGMCMDSysCommand( const char *pChat, std::vector < std::string >& vToken )
|
|
{
|
|
m_pGame->OnSysCommand( pChat, vToken );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDSendTown( const char *pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() > 2 )
|
|
{
|
|
int nIndex = atoi( vToken[2].c_str() ); //index
|
|
std::string strX, strY;
|
|
if( GetSendTownDB().GetSendTownPosition( nIndex, strX, strY ) )
|
|
return std::string("/run warp( ") + strX + "," + strY + ",'" + vToken[1] +"' )";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDTargetRecord( const char * pChat )
|
|
{
|
|
if( m_pFRecord )
|
|
{
|
|
fclose( m_pFRecord );
|
|
m_pFRecord = NULL;
|
|
}
|
|
|
|
SYSTEMTIME stSystemTime;
|
|
GetLocalTime( &stSystemTime );
|
|
|
|
|
|
TCHAR szFileName[ MAX_PATH ];
|
|
_tcscpy( szFileName, "Target_Record_" );
|
|
|
|
wsprintf( szFileName + strlen( szFileName ), " %04d-%02d-%02d %02d-%02d-%02d.txt",
|
|
stSystemTime.wYear, stSystemTime.wMonth, stSystemTime.wDay,
|
|
stSystemTime.wHour, stSystemTime.wMinute, stSystemTime.wSecond );
|
|
|
|
m_pFRecord = fopen( szFileName, "wt" ); //오늘 날짜와 Count로 기록
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDAddStatus( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() < 4 )
|
|
return "";
|
|
|
|
std::string strName;
|
|
if( vToken.size() < 5 )
|
|
GetTargetName( strName );
|
|
else
|
|
strName = vToken[4].c_str();
|
|
|
|
if( strName.empty() )
|
|
return "";
|
|
|
|
return CStringUtil::StringFormat( "/run add_state(%s,%s,%s,'%s')",vToken[1].c_str(),vToken[2].c_str(),vToken[3].c_str(), strName.c_str() );
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDLevelUp( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( strlen(pChat) == 8 )
|
|
{ //1씩 증가
|
|
char szShortTmp[32]; memset( szShortTmp, 0, sizeof(szShortTmp) );
|
|
itoa( GetLocalPlayer()->GetLevel()+1, szShortTmp, 10 );
|
|
|
|
return std::string("/lv ") + szShortTmp;
|
|
}
|
|
else
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
return std::string( "/lv " ) + vToken[1];
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDLevelDown( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( GetLocalPlayer()->GetLevel() <= 1 )
|
|
return "";
|
|
|
|
if( strlen(pChat) == 9 )
|
|
{
|
|
char szShortTmp[32]; memset( szShortTmp, 0, sizeof(szShortTmp) );
|
|
itoa( GetLocalPlayer()->GetLevel()-1, szShortTmp, 10 );
|
|
//나의 레벨보다 낮게 주자.
|
|
return std::string("/lv ") + szShortTmp;
|
|
}
|
|
else
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
return std::string( "/lv " ) + vToken[1];
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDEvolution( const char* pChat )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx * pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
XStringUtil::Format( strCheat, "/run creature_evolution(%u)", pAvatar->GetArID() );
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureSP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx* pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"sp\", %s )", pAvatar->GetArID(), vToken[1].c_str() );
|
|
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureHP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx* pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"hp\", %s )", pAvatar->GetArID(), vToken[1].c_str() );
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureMP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx* pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"mp\", %s )", pAvatar->GetArID(), vToken[1].c_str() );
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureEXP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx * pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"exp\", %s )", pAvatar->GetArID(), vToken[1].c_str() ) ;
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureBasicEXP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx * pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"ev_1_level\", %s )", pAvatar->GetArID(), vToken[1].c_str() ) ;
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCreatureGrowthEXP( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
SGameAvatarEx * pAvatar = GetTarget();
|
|
if( pAvatar && pAvatar->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pAvatar->GetArID() ) )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run set_creature_value( %u, \"ev_2_level\", %s )", pAvatar->GetArID(), vToken[1].c_str() ) ;
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDEvaluate( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/run ev( '%s' )", vToken[1].c_str() ) ;
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDAdjust( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 3 )
|
|
XStringUtil::Format( strCheat, "/run sv( '%s', %d )", vToken[1].c_str(), atoi( vToken[2].c_str() ) ) ;
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDSetAutoUser( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/set_auto_user %s", vToken[1].c_str() ) ;
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDUnsetAutoUser( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/unset_auto_user %s", vToken[1].c_str() ) ;
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDCheckAutoUser( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 2 )
|
|
XStringUtil::Format( strCheat, "/check_auto_user %s", vToken[1].c_str() ) ;
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDWarp( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 3 )
|
|
{
|
|
int nWidth = atoi(vToken[1].c_str());
|
|
int nHeight = atoi(vToken[2].c_str());
|
|
|
|
if ( nWidth <= 700000 && nHeight <= 1000000 )
|
|
{
|
|
strCheat = "/warp ";
|
|
strCheat += vToken[1].c_str();
|
|
strCheat += " ";
|
|
strCheat += vToken[2].c_str();
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDNotice( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
if( vToken.size() > 1 )
|
|
{
|
|
strCheat = "/notice ";
|
|
for( unsigned int i(0); (vToken.size()-1)>i; i++ )
|
|
{
|
|
strCheat += " ";
|
|
strCheat += vToken[i+1];
|
|
}
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
/// 2011.07.19
|
|
std::string SGameSystem::OnGMCMDAnnounce( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
if( vToken.size() > 1 )
|
|
{
|
|
strCheat = "/run announce( '";
|
|
for( unsigned int i(0); (vToken.size()-1)>i; i++ )
|
|
{
|
|
strCheat += " ";
|
|
strCheat += vToken[i+1];
|
|
}
|
|
strCheat += + "' )";
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDInvisible( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
strCheat = "/invisible ";
|
|
if( vToken.size() > 1 )
|
|
strCheat += vToken[1];
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDShowPlayer( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() > 1 )
|
|
{
|
|
GetGameOption().SetRenderOtherPlayer( atoi( vToken[1].c_str() ) );
|
|
m_pGame->SetRenderOtherPlayer( GetGameOption().GetRenderOtherPlayerType() );
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDRupi( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if ( vToken.size() > 2 ) return std::string( "/run sv( 'gold', " ) + vToken[1] + " )";
|
|
else if( vToken.size() == 2 ) return std::string( "/run av( 'gold', " ) + vToken[1] + " )";
|
|
else return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDDebug( const char * pChat )
|
|
{
|
|
/// 2010.11.10 - prodongi
|
|
//#ifdef _DEV
|
|
if (g_UserInfo.isMonkeyTail())
|
|
{
|
|
extern bool g_bDebugMode;
|
|
g_bDebugMode = !g_bDebugMode;
|
|
}
|
|
//#endif
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDCamera( const char * pChat )
|
|
{
|
|
// 2010.07.07 - prodongi
|
|
/// 2010.11.10 - prodongi
|
|
//#ifdef _DEV
|
|
if (g_UserInfo.isMonkeyTail())
|
|
{
|
|
extern bool g_bUserCamMode;
|
|
g_bUserCamMode = !g_bUserCamMode;
|
|
}
|
|
//#endif
|
|
|
|
|
|
extern unsigned g_userCamStates;
|
|
g_userCamStates = 0;
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDLevel( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() > 2 ) strCheat = "/run sv( 'lv', " + vToken[1] + " )";
|
|
else if( vToken.size() == 2 ) strCheat = "/run av( 'lv', " + vToken[1] + " )";
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDExp( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() > 2 ) strCheat = "/run sv( 'exp', " + vToken[1] + " )";
|
|
else if( vToken.size() == 2 ) strCheat = "/run av( 'exp', " + vToken[1] + " )";
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDJobPoint( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() > 2 ) strCheat = "/run sv( 'jp', " + vToken[1] + " )";
|
|
else if( vToken.size() == 2 ) strCheat = "/run av( 'jp', " + vToken[1] + " )";
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDJobLevel( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() > 2 ) strCheat = "/run sv( 'jlv', " + vToken[1] + " )";
|
|
else if( vToken.size() == 2 ) strCheat = "/run av( 'jlv', " + vToken[1] + " )";
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDProhibitChat( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 3 ) strCheat = "/block_chat " + vToken[1] + " " + vToken[2];
|
|
else if( vToken.size() == 2 ) strCheat = "/block_chat " + vToken[1];
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDRegenerate( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() >= 3 ) strCheat = "/regenerate " + vToken[1] + " " + vToken[2];
|
|
else if( vToken.size() == 2 ) strCheat = "/regenerate " + vToken[1];
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDNPCRotation( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
// TODO : 테스트 용 서버에서 완료되면 삭제하자
|
|
for( int x = 0; x < (int)m_ClickNpcList.size(); x++ )
|
|
{
|
|
SGameAvatarEx * pAvatar = (SGameAvatarEx*)m_pGame->GetGameObject( m_ClickNpcList[x] );
|
|
if( pAvatar )
|
|
{
|
|
if( vToken.size() >= 2 )
|
|
{
|
|
float fDir = atof( vToken[1].c_str() );
|
|
pAvatar->SetViewVectorAngle( fDir );
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDNPCRotationOff( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
// TODO : 테스트 용 서버에서 완료되면 삭제하자
|
|
for( int x = 0; x < (int)m_ClickNpcList.size(); x++ )
|
|
{
|
|
SGameAvatarEx * pAvatar = (SGameAvatarEx*)m_pGame->GetGameObject( m_ClickNpcList[x] );
|
|
if( pAvatar )
|
|
{
|
|
pAvatar->SetNpcTargetHandle(0);
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDAutoMove( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
// TODO : 테스트 용 서버에서 완료되면 삭제하자
|
|
//올라타는 중일때는 리턴
|
|
if( !GetLocalPlayer()->IsMount() )
|
|
{
|
|
//마운트 모드일때 자동이동 가능
|
|
if( GetLocalPlayer()->IsMountMode() )
|
|
{
|
|
int nWayPointID = atoi( vToken[1].c_str() );
|
|
K3DVector* pWayPointList = m_pGame->GetWayPoint( nWayPointID );
|
|
if( pWayPointList )
|
|
GetLocalPlayer()->SetWayPointList( pWayPointList, nWayPointID );
|
|
else
|
|
m_pGame->AddChatMessage( S(393) );
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDUI( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if ( vToken.size() > 2)
|
|
{
|
|
int nValue1 = atoi(vToken[1].c_str());
|
|
int nValue2 = atoi(vToken[2].c_str());
|
|
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGame->ProcMsgAtStatic( new SIMSG_SHOW_UIWINDOW( (SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE)nValue1, nValue2!=0) ); // C4800
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( (SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE)nValue1, nValue2!=0) ); // C4800
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnGMCMDQuest( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if ( vToken.size() > 2)
|
|
{
|
|
int nValue1 = atoi(vToken[1].c_str());
|
|
int nValue2 = atoi(vToken[2].c_str());
|
|
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
/*
|
|
SMSG_NPC_DIALOG* pMsg = new SMSG_NPC_DIALOG;
|
|
|
|
|
|
pMsg->nDialogType = TS_SC_DIALOG::TYPE_QUEST_INFO_AND_START;
|
|
pMsg->nQuestCode= nValue1;
|
|
pMsg->nQuestTextID = nValue2;
|
|
pMsg->strTitle = "TEST QUEST";
|
|
|
|
m_pGame->ProcMsgAtStatic( pMsg );
|
|
*/
|
|
SMSG_NPC_DIALOG msg;
|
|
|
|
|
|
msg.nDialogType = TS_SC_DIALOG::TYPE_QUEST_INFO_AND_START;
|
|
msg.nQuestCode= nValue1;
|
|
msg.nQuestTextID = nValue2;
|
|
msg.strTitle = "TEST QUEST";
|
|
|
|
m_pGame->ProcMsgAtStatic(&msg);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnGMCMDQuestAdd( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if ( vToken.size() > 2)
|
|
{
|
|
int nValue1 = atoi(vToken[1].c_str());
|
|
int nValue2 = atoi(vToken[2].c_str());
|
|
int nRand[6] = {0, };
|
|
int nStat[3] = {0, };
|
|
int nTimeLimit = 0;
|
|
|
|
SQuestMgr::GetInstance().InsertQuest( nValue1, nStat, nRand, nValue2, nTimeLimit, 0 );
|
|
}
|
|
return "";
|
|
}
|
|
|
|
#include "SAutoToolTip.h"
|
|
|
|
std::string SGameSystem::OnGMCMDAutoToolTip( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
rp::s_bApplyAutoToolTip = !rp::s_bApplyAutoToolTip;
|
|
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDHelp( const char * pChat )
|
|
{
|
|
m_pGame->ToggleHelpWindow();
|
|
return "";
|
|
}
|
|
std::string SGameSystem::OnCMDReturnLobby( const char * pChat )
|
|
{
|
|
ReturnToLobby();
|
|
return "";
|
|
}
|
|
std::string SGameSystem::OnCMDCreateSiegeRaidParty( const char * pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
strCheat = "/rpcreate ";
|
|
strCheat += vToken[ 1 ].c_str();
|
|
}
|
|
|
|
return strCheat;
|
|
}
|
|
std::string SGameSystem::OnCMDAppointBattleCommander( const char* pChat, std::vector< std::string >& vToken ) // sonador 3.5.1 던전 시즈 레벨 제한
|
|
{
|
|
if( vToken.empty() || !m_GuildMgr.IsLocalPlayerMaster() ) return "";
|
|
|
|
std::string strCheat = "/gappoint_raid_leader ";
|
|
if( vToken.size() > 1 )
|
|
strCheat += vToken[ 1 ].c_str();
|
|
|
|
return strCheat;
|
|
}
|
|
std::string SGameSystem::OnCMDDelegateBattleCommander( const char* pChat, std::vector< std::string >& vToken ) // sonador 3.5.1 던전 시즈 레벨 제한
|
|
{
|
|
if( vToken.empty() || !m_GuildMgr.IsLocalPlayerBattleCommander() ) return "";
|
|
|
|
std::string strCheat = "/gappoint_raid_leader ";
|
|
if( vToken.size() > 1 )
|
|
strCheat += vToken[ 1 ].c_str();
|
|
|
|
return strCheat;
|
|
}
|
|
std::string SGameSystem::OnCMDAssist( const char * pChat )
|
|
{
|
|
std::string strCheat;
|
|
std::string strName;
|
|
// 타겟 필요
|
|
SGameAvatarEx* pTarget = GetTarget();
|
|
if( NULL != pTarget && pTarget->GetObjType() == TS_ENTER::GAME_PLAYER )
|
|
{
|
|
if( !m_PartyMgr.IsExistMember( pTarget->GetArID() ) )
|
|
{
|
|
m_pGame->AddChatMessage( GetStringDB().GetString( 394 ) ); //어시스트는 자신의 파티원에게만 사용할 수 있는 기능입니다.
|
|
}
|
|
else
|
|
{
|
|
SGameAvatarEx* pLocal = GetLocalPlayer();
|
|
if( pLocal )
|
|
{
|
|
float len = GetDistance( *pLocal->GetPosition(), *pTarget->GetPosition() );
|
|
|
|
if( len <= GameRule::DEFAULT_UNIT_SIZE*25 ) //게임상 25m 이내여야 함
|
|
strCheat = CStringUtil::StringFormat( "/passist %u", pTarget->GetArID() );
|
|
else
|
|
{
|
|
//거리가 너무 멀다
|
|
m_pGame->AddChatMessage( GetStringDB().GetString( 395 ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//올바른 대상 이여야 함
|
|
m_pGame->AddChatMessage( GetStringDB().GetString( 394 ) );
|
|
}
|
|
|
|
return strCheat;
|
|
}
|
|
std::string SGameSystem::OnCMDChangeGuildName( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/change_guild_name ";
|
|
Cheat += vToken[ 1 ].c_str();
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDChangeName( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/change_name ";
|
|
Cheat += vToken[ 1 ].c_str();
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDCreateGuildAlliance( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/gacreate ";
|
|
Cheat += vToken[ 1 ];
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDInviteGuildAlliance( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/gainvite ";
|
|
Cheat += vToken[ 1 ];
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDKickGuildAlliance( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/gakick ";
|
|
Cheat += vToken[ 1 ];
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDJoinGuildAlliance( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 2 )
|
|
{
|
|
Cheat = "/gajoin ";
|
|
Cheat += vToken[ 1 ]; // alliance_id
|
|
Cheat += " ";
|
|
Cheat += vToken[ 2 ]; // password
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDChangeGuildAllianceName( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/change_alliance_name ";
|
|
Cheat += vToken[ 1 ];
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDAcceptBattle( const char* pChat, std::vector< std::string >& vToken )
|
|
{
|
|
std::string Cheat;
|
|
|
|
if( vToken.size() > 1 )
|
|
{
|
|
Cheat = "/battle_accept ";
|
|
Cheat += vToken[ 1 ]; // inviter_name
|
|
}
|
|
|
|
return Cheat;
|
|
}
|
|
std::string SGameSystem::OnCMDSit( const char * pChat )
|
|
{
|
|
SGameAvatarEx * pPlayer = GetLocalPlayer();
|
|
if( pPlayer && pPlayer->IsLive() )
|
|
{
|
|
if ( pPlayer->IsMountMode() )
|
|
{
|
|
// TODO : 메시지 추가해야함 임시로 추가
|
|
m_pGame->AddChatMessage( S(367) );
|
|
}
|
|
else if( !(pPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_SITDOWN) && pPlayer->GetCurrAnimationID() != ANI_SITUP )
|
|
{
|
|
SInputSit inputSit;
|
|
pPlayer->OnInput( &inputSit );
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDStandUp( const char * pChat )
|
|
{
|
|
SGameAvatarEx * pPlayer = GetLocalPlayer();
|
|
if ( pPlayer && pPlayer->IsLive() )
|
|
{
|
|
if( pPlayer->IsMountMode() )
|
|
{
|
|
// TODO : 메시지 추가해야함 임시로 추가
|
|
m_pGame->AddChatMessage( S(367) );
|
|
}
|
|
else if( pPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_SITDOWN )
|
|
{
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST, "stand_up" ) );
|
|
|
|
SInputSitUp inputSitUp;
|
|
pPlayer->OnInput( &inputSitUp );
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDTownPropLimit( const char * pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() > 1 )
|
|
{
|
|
int nValue = atoi(vToken[1].c_str());
|
|
GetGameOption().SetTownLimit( nValue == 1 ? nValue : 0 );
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDShopMode( const char * pChat )
|
|
{
|
|
int nType = SGameOtherPlayer::GetBoothRenderType();
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_BOOTH_OPTION_CHANGE( nType ) );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDRide( const char * pChat )
|
|
{
|
|
SGameAvatarEx* pPlayer = GetLocalPlayer();
|
|
if( pPlayer )
|
|
CheckPossibilityCreatureMount( pPlayer );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDMountCreature( const char * pChat )
|
|
{
|
|
std::string strCheat;
|
|
|
|
AR_HANDLE creature = 0;
|
|
SGameAvatarEx * pCreature = GetTarget();
|
|
if( pCreature && pCreature->GetObjType() == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
if( IsLocalCreature( pCreature->GetArID() ) )
|
|
creature = pCreature->GetArID();
|
|
}
|
|
|
|
if( creature == 0 )
|
|
{
|
|
creature = m_CreatureSlotMgr.GetSelectedCreature();
|
|
}
|
|
|
|
if( creature != 0 )
|
|
{
|
|
pCreature = (SGameAvatarEx*)m_pGame->GetGameObject( creature );
|
|
if( pCreature != NULL )
|
|
{
|
|
XStringUtil::Format( strCheat, "/ride %u", creature );
|
|
}
|
|
}
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDNormal( const char* pTargetName )
|
|
{
|
|
std::string strCheat;
|
|
|
|
AR_HANDLE handle = _atoi64( pTargetName );
|
|
SGameAvatarEx* pTarget = (SGameAvatarEx*)m_pGame->GetGameObject( handle );
|
|
if( pTarget )
|
|
XStringUtil::Format( strCheat, "/normal %u", pTarget->GetArID() );
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDBattle( const char* pTargetName )
|
|
{
|
|
std::string strCheat;
|
|
|
|
AR_HANDLE handle = _atoi64( pTargetName );
|
|
SGameAvatarEx* pTarget = (SGameAvatarEx*)m_pGame->GetGameObject( handle );
|
|
if( pTarget )
|
|
XStringUtil::Format( strCheat, "/battle %u", pTarget->GetArID() );
|
|
|
|
return strCheat;
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDShop( const char* pCommand )
|
|
{
|
|
m_MotionMgr.UseMotion( ID_BOOTH );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDUnion( const char* pChat )
|
|
{
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE) );
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDAddPartyWindow( const char* pChat )
|
|
{
|
|
SGameAvatarEx * pTarget = GetTarget();
|
|
if( pTarget )
|
|
{
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, pTarget->GetArID(), "add_creature" ) );
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_STATE, pTarget->GetArID(), "add_creature" ) );
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDDelPartyWindow( const char* pChat )
|
|
{
|
|
SGameAvatarEx * pTarget = GetTarget();
|
|
if( pTarget )
|
|
{
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, pTarget->GetArID(), "remove_creature" ) );
|
|
m_pGame->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_STATE, pTarget->GetArID(), "remove_creature" ) );
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDTrade( const char* pChat )
|
|
{
|
|
SGameAvatarEx * pTarget = GetTarget();
|
|
if( !pTarget )
|
|
{
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_TRADE_NOT_TRADETARGET ) );
|
|
}
|
|
else
|
|
{
|
|
SGameAvatarEx* pLocalPlayer = GetLocalPlayer();
|
|
if( pLocalPlayer )
|
|
{
|
|
if( pLocalPlayer->GetArID() == pTarget->GetArID() || pTarget->GetObjType() != TS_ENTER::GAME_PLAYER )
|
|
{
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_TRADE_NOT_TRADETARGET ) );
|
|
}
|
|
else
|
|
{
|
|
TS_TRADE msg;
|
|
msg.mode = TS_TRADE::REQUEST_TRADE;
|
|
msg.target_player = pTarget->GetArID();
|
|
m_pGame->SendMsg( &msg );
|
|
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_TRADE_REQUEST ) );
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
|
|
std::string SGameSystem::OnCMDMoveSoundOn( const char* pChat )
|
|
{
|
|
SGameAvatarEx::SetMoveSound( true );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDMoveSoundOff( const char* pChat )
|
|
{
|
|
SGameAvatarEx::SetMoveSound( false );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDPkOn( const char* pChat )
|
|
{
|
|
|
|
if (GetLocalPlayer()->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON)
|
|
{
|
|
TS_CS_TURN_OFF_PK_MODE msg;
|
|
m_pGame->SendMsg(&msg);
|
|
}
|
|
else
|
|
{
|
|
TS_CS_TURN_ON_PK_MODE msg;
|
|
m_pGame->SendMsg(&msg);
|
|
}
|
|
|
|
/*
|
|
if( GetLocalPlayer()->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON )
|
|
return "";
|
|
|
|
if( !m_pGame->Rq_ChagePKMode(true) )
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_PKMODE_IMPOSSIBLE ) );
|
|
*/
|
|
|
|
return "";
|
|
}
|
|
|
|
|
|
std::string SGameSystem::OnCMDPkOff( const char* pChat )
|
|
{
|
|
SGameLocalPlayer* pLocalPlayer = (SGameLocalPlayer*)GetLocalPlayer();
|
|
if( pLocalPlayer )
|
|
{
|
|
|
|
if (pLocalPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON)
|
|
{
|
|
TS_CS_TURN_OFF_PK_MODE msg;
|
|
m_pGame->SendMsg(&msg);
|
|
}
|
|
else
|
|
{
|
|
TS_CS_TURN_ON_PK_MODE msg;
|
|
m_pGame->SendMsg(&msg);
|
|
}
|
|
|
|
/*
|
|
if( pLocalPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON )
|
|
{
|
|
m_pGame->Rq_ChagePKMode(false);
|
|
}
|
|
else
|
|
{
|
|
if( pLocalPlayer->GetPKModeState() == SGameLocalPlayer::PK_MODE_ON_COUNT_DOWN )
|
|
{
|
|
m_pGame->Rq_ChagePKMode( true );
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDSetVolume( const char* pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() > 1 )
|
|
{
|
|
int nVol = atoi( vToken[1].c_str() );
|
|
if ( nVol < 0 )
|
|
nVol = 0;
|
|
if ( nVol > 100 )
|
|
nVol = 100;
|
|
m_pGame->Game_Sound_Set_Volume( atoi( vToken[1].c_str() ) );
|
|
}
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDMusicOff( const char* pChat )
|
|
{
|
|
m_pGame->Game_Music_Off( true );
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDGuildIcon( const char* pChat )
|
|
{
|
|
// m_GuildDataMgr.AddGuildData();
|
|
return "";
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDPartyShare( const char* pChat, std::vector < std::string >& vToken )
|
|
{
|
|
std::string strCheat;
|
|
if( vToken.size() > 1 )
|
|
{
|
|
strCheat = "/pshare ";
|
|
strCheat += GetLocalCommandDB().Convert( vToken[1].c_str() );
|
|
}
|
|
return strCheat;
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDRun( const char* pChat, std::vector < std::string >& vToken )
|
|
{
|
|
if( vToken.size() == 1 )
|
|
return "/walk off"; //스피드만 제어 한다.
|
|
else
|
|
return pChat; // /run add( ) 이것과 겹치는 문제로...
|
|
}
|
|
|
|
std::string SGameSystem::OnCMDCashItem( const char* pChat )
|
|
{
|
|
if( ENV().IsExist( "cash" ) )
|
|
m_pGame->SendGameInterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE) );
|
|
return "";
|
|
}
|
|
|
|
bool g_bURLTest = false;
|
|
|
|
std::string SGameSystem::OnCMDURLTest( const char* pChat )
|
|
{
|
|
g_bURLTest = !g_bURLTest;
|
|
return "";
|
|
}
|
|
|
|
|
|
#ifdef _COUNTRY_ME_
|
|
|
|
char* g_strText[] =
|
|
{"Test", "way", "to", "go", "alone", "in", "the", "dark", "rappelz", "some", "way", "hold", "on", "theseus", "babylon", "ocam", "razor", "mouse", NULL};
|
|
|
|
std::string SGameSystem::OnCMDPangoTest( const char* pChat )
|
|
{
|
|
int nFontSize;
|
|
int nstrIndex = 0;
|
|
|
|
for ( int i = 0; i < 20000; ++i )
|
|
{
|
|
nFontSize = (rand() % 100) + 10;
|
|
KTextLayout2 text( 400, 200, 1 );
|
|
|
|
std::string strText;
|
|
XStringUtil::Format( strText, "<size:%d><$%d>%s", nFontSize, i, g_strText[nstrIndex++] );
|
|
text.AddString( strText.c_str() );
|
|
|
|
KTextPhrase::GetStringSize( strText.c_str(), 1024 );
|
|
if ( g_strText[nstrIndex] == NULL )
|
|
nstrIndex = 0;
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
#endif
|