Files
Leviathan/Client/Game/game/GameSystem/SMessengerMgr.cpp
T
2026-06-01 12:46:52 +02:00

6253 lines
173 KiB
C++

#include "stdafx.h"
#include "SGame.h"
#include "SMessengerMgr.h"
//#include "SGameMessageUI.h"
#include "SStringDB.h"
#include "SGameManager.h"
#include "SGameSystem.h"
#include "SGameAvatarFx.h"
#include "Party/SUIPartyTypes.h"
#include <internet/XInternet.h>
#include <toolkit/XStringUtil.h>
#include "KResourceManager.h"
#include "KUITextureManager.h"
#include "KResource.h"
#include <toolkit/nsl.h>
#include <toolkit/nsluni.h>
#include <process.h>
#include <toolkit/XEnv.h> //웹서버 주소를 알기위해 추가한 것 -N4-
#include <kfile/XOREn.h>
#include "SDebug_Util.h"
#include "SLog.h"
#include "CInput.h"
#include "Arena\\ArenaJoinSituationChecker.h"
#include "Arena\\ArenaSystem.h"
extern SGameSystem* g_pCurrentGameSystem;
extern const char * g_pGuildDir;
extern std::string g_strGuildFullDir;
extern void MsgSplit( const char* szMsg, STR_LIST& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false );
extern void MsgSplit_Ex( const char* szMsg, std::vector<std::string>& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false );
#define _GUILD_ICON_ENC_
CPartyListMgr* g_pPartyListMgr = NULL; // 2011.11.30 - servantes : 파티리스트 매니저
SRaidMgr* g_pRaidMgr = NULL; // 2011.12.06 - servantes : 레이드 정보 매니저
const int CONST_RAID_INFO_GAP = 5; // 레이드 정보 개수
const int CONST_RAID_INFO_COUNT = 6; // 레이드 정보 개수
const int CONST_PARTY_MEMBER_INFO_COUNT = 4; // 파티원 정보 개수
namespace
{
enum
{
DIVISION_PERSONAL = 0,
DIVISION_SHARE,
DIVISION_TURN,
};
const int c_BufSize = 512;
};
extern bool ilSaveAsType( char* c_szFileName, char* c_szSaveAsFileName );
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// SAllianceGuild
//////////////////////////////////////////////////////////////////////////
// 연합길드정보 //
int SAllianceGuild::nAllianceID; // 연합SID
std::string SAllianceGuild::strAllianceName; // 연합명
int SAllianceGuild::nAllianceMemberCount; // 연합길드 맴버수.
int SAllianceGuild::nAllianceMasterGuildSID; // 연합장 길드 SID
std::string SAllianceGuild::strAllianceLeaderName; // 연합장 이름.
//////////////////////////////////////////////////////////////////////////
// SMessengerMgr
SMessengerMgr::~SMessengerMgr()
{
Free();
}
void SMessengerMgr::Free()
{
if( m_vecMemberList.empty() ) return;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
SAFE_DELETE(pSlot);
it = m_vecMemberList.erase(it);
}
m_vecMemberList.clear();
m_bCreate = FALSE;
}
void SMessengerMgr::Clear()
{
m_strMsg = m_strCommunityName;
m_nPartyType = 0; // 2011.10.26 :servantes : 변수 초기화
m_bIsExist = false;
m_nMaxLevel = 0;
m_nMinLevel = 0;
m_nCommunityID = 0;
m_nCommunityPassword = 0;
/*m_strSelectMember.clear();
m_strCommunityName.clear();
m_strLeaderName.clear();*/
m_strGuildName.clear();
m_strGulidLeaderName.clear();
m_strBattleCommanderName.clear(); // sonador 3.5.1 던전 시즈 레벨 제한
Free();
}
void SMessengerMgr::SetPartyMemberHpBar( std::string &str )
{
// 2012. 6. 19 - marine
// 파티원이 로그인했을 때, EnterMsg 가 먼저오고 PINFO/M가 나중에 날라오는데
// EnterMsg 가 올때 게이지바를 셋팅을 할때, 파티원의 핸들을 알 수가 없기 때문에
// PINFO가 날라온 시점에 게이지바 생성
char * strstoper;
AR_HANDLE handle = ::strtoul( str.c_str(), &strstoper, 10 );
m_pGame->GetGameManager()->PostMsgAtDynamic( new SIMSG_UI_NAMEPANEL_PARTY_HP( handle ) );
}
//int SMessengerMgr::AddMessage( const char* szMsg )
int SMessengerMgr::AddMessage( const char* szMsg, bool & bSelf ) // 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
m_bParsing = false;
STR_LIST vecText;
MsgSplit( szMsg, vecText, L"|" );
size_t nTextSize = vecText.size();
if( nTextSize <= 0 ) return 0;//false;
if( ::_stricmp( vecText[0].c_str(), "INVITE" ) == 0 ||
::_stricmp(vecText[0].c_str(), "ARENA_MEMBER_INVITE") == 0 ||
::_stricmp(vecText[0].c_str(), "ARENA_OPPONENT_INVITE") == 0) // INVITE|파티장이름|[파튀,길드]이름|파티ID|파티PW|
{
if( nTextSize < 5 )
{
vecText.clear();
return 0;//false;
}
/// 2011.12.26 보통 서버에서 파티중인지 체크를 하나, 시간차로 체크가 안되는 경우가 있다,
/// 원래는 초대 메세지 박스가 나오지 않아야 되는 상황이므로 특별하게 에러 메세지는 출력해 주지 않는다. - prodongi
if (IsExist())
{
return 0;
}
m_strMsg = vecText[1];
m_strCommunityName = vecText[2];
m_nCommunityID = ::atoi( vecText[3].c_str() );
m_nCommunityPassword = ::atoi( vecText[4].c_str() );
char const* token;
if (::_stricmp(vecText[0].c_str(), "ARENA_OPPONENT_INVITE") == 0)
token = "RequestPartyArenaOpponentJoinAccept";
else if (::_stricmp(vecText[0].c_str(), "ARENA_MEMBER_INVITE") == 0)
token = "RequestPartyArenaMemberJoinAccept";
else
token = "RequestPartyJoinAccept";
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, token));
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "KICK" ) == 0 ) // KICK|[파튀,길드]이름|캐릭이름
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
LeaveMember( vecText[2].c_str() );
vecText.clear();
return 1;//true;
}
//else if( ::_stricmp( vecText[0].c_str(), "LOGIN" ) == 0 ) // LOGIN|[파튀,길드]이름|캐릭이름
//{
// if( nTextSize < 3 )
// {
// vecText.clear();
// return 0;//false;
// }
// LoginMember( vecText[2].c_str() );
// vecText.clear();
// return 1;//true;
//}
if( ::_stricmp( vecText[0].c_str(), "CREATE" ) == 0 ) // CREATE|[파튀,길드]이름|파튀장
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
CreateCommunity( vecText[1].c_str() );
vecText.clear();
return 100; //true; // 2011.10.20 : servantes : 부모 클래스에서 메세지 처리하기 위해 100을 리턴한다
}
else if( ::_stricmp( vecText[0].c_str(), "JOIN" ) == 0 ) // JOIN|[파튀,길드]이름| // 새 멤버(=자기자신)에게
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
JoinMember( m_strLocalPlayerName.c_str(), vecText[1].c_str() );
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "NEW" ) == 0 ) // NEW|캐릭이름| // 기존 멤버에게만
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//return false;
}
JoinMember( vecText[1].c_str(), m_strCommunityName.c_str() );
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "LEAVE" ) == 0 ) // LEAVE|캐릭이름
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
LeaveMember( vecText[1].c_str() );
vecText.clear();
return 1;//true;
}
//else if( ::_stricmp( vecText[0].c_str(), "LOGOUT" ) == 0 ) // LOGOUT|캐릭이름
//{
// if( nTextSize < 2 )
// {
// vecText.clear();
// return 0;//false;
// }
// LogoutMember( vecText[1].c_str() );
// vecText.clear();
// return 1;//true;
//}
else if( ::_stricmp( vecText[0].c_str(), "PROMOTE" ) == 0 ) // PROMOTE|캐릭이름 // 파튀장 변경
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
// "PROMOTE|파티ID|캐릭이름" 으로 변경됨
ChangeLeader( vecText[2].c_str() );
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "ASSIST" ) == 0 ) // ASSIST|handle|
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
char * strstoper;
AR_HANDLE hassist = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
if( m_pGame )
{
m_pGame->AssistTarget( hassist );
}
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "MINFO" ) == 0 ) // MINFO|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|소환수플래그|
{
RefreshMember( vecText );
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "DESTROY" ) == 0 ) // DESTROY|[파튀,길드]이름
{
int k=0;
k=0;
Clear();
vecText.clear();
return 1;//true;
}
vecText.clear();
return 0;//false;
}
//-----------------------------------------------------------------------------------------------------------------
// 커뮤니티 생성
//-----------------------------------------------------------------------------------------------------------------
bool SMessengerMgr::CreateCommunity( const char* szCommunityName )
{
m_bIsExist = true;
m_bParsing = true;
m_strCommunityName = szCommunityName;
m_strLeaderName = m_strLocalPlayerName;
m_strGuildName = szCommunityName;
m_strGulidLeaderName = m_strLocalPlayerName;
return AddMember( m_strLeaderName.c_str() );
}
//-----------------------------------------------------------------------------------------------------------------
// 커뮤니티 생성
//-----------------------------------------------------------------------------------------------------------------
bool SMessengerMgr::CreateCommunity( const char* szCommunityName, char const* leaderName )
{
m_bIsExist = true;
m_bParsing = true;
m_strCommunityName = szCommunityName;
m_strLeaderName = leaderName;
m_strGuildName = szCommunityName;
m_strGulidLeaderName = leaderName;
return AddMember( m_strLeaderName.c_str() );
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::RefreshMember( STR_LIST& vecText )
{
size_t nTextSize = vecText.size();
if( nTextSize <= 9 )
return false;
_oprint( "PARTY %s : %d\n", vecText[2].c_str(), ::atoi( vecText[5].c_str() ) );
// MINFO|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|소환수플래그|
m_bParsing = true;
if( !IsExistMember(vecText[2].c_str()) )
{
SPlayerSlot* pSlot = new SPlayerSlot;
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
pSlot->SetHandle( handle );
pSlot->SetName( vecText[2].c_str() );
pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
pSlot->SetHP( ::atoi( vecText[5].c_str() ) );
pSlot->SetMP( ::atoi( vecText[6].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[7].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[8].c_str() ) );
pSlot->SetCreature( ::atoi( vecText[9].c_str() ), 0 );
if( pSlot->GetHandle() == NULL )
pSlot->SetLogin( false );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 )
pSlot->SetLeader( true );
pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
m_vecMemberList.push_back(pSlot);
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
}
else
{
SPlayerSlot* pSlot = FindMember( vecText[2].c_str() );
if( pSlot == NULL )
return false;
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
pSlot->SetHandle( handle );
pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
pSlot->SetHP( ::atoi( vecText[5].c_str() ) );
pSlot->SetMP( ::atoi( vecText[6].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[7].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[8].c_str() ) );
pSlot->SetCreature( ::atoi( vecText[9].c_str() ), 0 );
if( pSlot->GetHandle() == NULL )
pSlot->SetLogin( false );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 )
pSlot->SetLeader( true );
pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
}
// 2012. 6. 19 - marine
SetPartyMemberHpBar(vecText[1]);
return true;
}
//// 수정. 2010.06.10 bintitle.
//void SMessengerMgr::RefreshMember( STR_LIST& vecText )
//{
// size_t nTextSize = vecText.size();
// if( nTextSize < 11 ) return;
//
// // MINFO|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|온/오프라인|
// char * strstoper;
// AR_HANDLE nHandle = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
// m_bParsing = true;
// if( !IsExistMember( vecText[2].c_str() ) )
// {
// SPlayerSlot* pSlot = new SPlayerSlot;
//
// pSlot->SetHandle( nHandle );
// pSlot->SetName( vecText[2].c_str() );
// pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[5].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[6].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[7].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[8].c_str() ) );
// pSlot->SetLogin( ::atoi( vecText[9].c_str() ) );
// //if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
//
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
// pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
//
// m_vecMemberList.push_back(pSlot);
// }
// else
// {
// SPlayerSlot* pSlot = FindMember( vecText[2].c_str() );
// if( pSlot == NULL ) return;
//
// pSlot->SetHandle( nHandle );
// pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[5].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[6].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[7].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[8].c_str() ) );
// pSlot->SetLogin( ::atoi( vecText[9].c_str() ) );
//
// //if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
// pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
// }
//}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::JoinMember( const char* szPlayerName, const char* szCommunityName )
{
// JOIN|파티이름| // 새 멤버(=자기자신)에게
// NEW|캐릭이름| // 기존 멤버에게만
m_bParsing = true;
// join
if( ::_stricmp(szPlayerName, m_strLocalPlayerName.c_str()) == 0 )
{
m_bIsExist = true;
m_strCommunityName = szCommunityName;
m_strGuildName = szCommunityName;
m_strMsg = szCommunityName;
}
else
m_strMsg = szPlayerName;
return AddMember( szPlayerName );
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::LeaveMember( const char* szPlayerName )
{
m_bParsing = true;
m_strMsg = szPlayerName;
return DeleteMember( szPlayerName );
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::LoginMember( const char* szPlayerName )
{
m_bParsing = true;
m_strMsg = szPlayerName;
if( ::_stricmp( szPlayerName, m_strLocalPlayerName.c_str() ) == 0 )
m_bIsExist = true;
SPlayerSlot* pSlot = FindMember( szPlayerName );
if( pSlot == NULL )
return false;
pSlot->SetLogin( true );
pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
return true;
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::LogoutMember( const char* szPlayerName )
{
m_bParsing = true;
m_strMsg = szPlayerName;
if( ::_stricmp(szPlayerName, m_strLocalPlayerName.c_str()) == 0 )
{
Clear();
return false;
}
SPlayerSlot* pSlot = FindMember( szPlayerName );
if( pSlot == NULL )
return false;
pSlot->SetHandle( 0 );
pSlot->SetLogin( false );
pSlot->SetNear( false );
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
return true;
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::ChangeLeader( const char* szPlayerName )
{
m_bParsing = true;
m_strMsg = szPlayerName;
if( !m_bIsExist ) // 존재하지 않으면
return false;
if( !_stricmp( m_strLeaderName.c_str(), szPlayerName ) ) // 리더가 아니면
return false;
// 새멤버에게 권한준다
SPlayerSlot* pSlot = FindMember( szPlayerName );
if( pSlot )
pSlot->SetLeader( true );
// 이전 멤버에게 권한빼앗는다
pSlot = FindMember( m_strLeaderName.c_str() );
if( pSlot )
pSlot->SetLeader( false );
m_strLeaderName = szPlayerName;
sArenaSystem* arenaSystem = g_pCurrentGameSystem->getArenaSystem();
if (arenaSystem->isExercise())
{
ProcMsgAtStatic( &SMSG_BATTLE_ARENA_PROMOTE());
}
return true;
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::AddMember( const char* szName )
{
if( IsExistMember(szName) )
return false;
SPlayerSlot* pSlot = new SPlayerSlot;
pSlot->SetName(szName);
if( ::_stricmp(pSlot->GetName(), m_strLeaderName.c_str() ) == 0 )
pSlot->SetLeader( true );
m_vecMemberList.push_back(pSlot);
return true;
}
bool SMessengerMgr::AddMember( SPlayerSlot* pSlot )
{
if(pSlot == NULL)
return false;
m_vecMemberList.push_back(pSlot);
return true;
}
// 2011.11.23 - servantes : 리턴형 변경
bool SMessengerMgr::DeleteMember( const char* szName )
{
if( ::_stricmp( szName, m_strLocalPlayerName.c_str() ) == 0 ) // 자기 자신이라면.. 파티 파괴후 리턴
{
Clear();
return true;
}
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( ::_stricmp(pSlot->GetName(), szName) == 0 )
{
SAFE_DELETE(pSlot);
m_vecMemberList.erase(it);
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
return true;
}
it++;
}
return false;
}
SPlayerSlot* SMessengerMgr::FindMember( AR_HANDLE hPlayer )
{
if( m_vecMemberList.empty() ) return NULL;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->GetHandle() == hPlayer )
return (*it);
it++;
}
return NULL;
}
SPlayerSlot* SMessengerMgr::FindMember( const char* szName )
{
if( m_vecMemberList.empty() ) return NULL;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( ::_stricmp(pSlot->GetName(), szName) == 0 )
return (*it);
it++;
}
return NULL;
}
int SMessengerMgr::FindMemberIndex( AR_HANDLE hPlayer )
{
if( m_vecMemberList.empty() ) return -1;
int id=0;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->GetHandle() == hPlayer )
{
return id;
}
it++;
id++;
}
return -1;
}
SPlayerSlot* SMessengerMgr::FindMemberByID( int id )
{
if( m_vecMemberList.empty() )
return NULL;
int i=0;
std::vector<SPlayerSlot*>::iterator itE = m_vecMemberList.end();
std::vector<SPlayerSlot*>::iterator itS = m_vecMemberList.begin();
for(; itS != itE; itS++, i++)
{
if(i == id)
{
SPlayerSlot* pSlot = (*itS);
return pSlot;
}
}
return NULL;
}
SPlayerSlot* SMessengerMgr::FindMemberHandle( AR_HANDLE hPlayer )
{
if( m_vecMemberList.empty() )
return NULL;
int i=0;
std::vector<SPlayerSlot*>::iterator itE = m_vecMemberList.end();
std::vector<SPlayerSlot*>::iterator itS = m_vecMemberList.begin();
for(; itS != itE; itS++, i++)
{
SPlayerSlot* pSlot = (*itS);
if(pSlot->GetHandle() == hPlayer)
{
return pSlot;
}
}
return NULL;
}
SPlayerSlot* SMessengerMgr::FindMemberByCreature(AR_HANDLE hCreature)
{
int i = 0;
std::vector<SPlayerSlot*>::iterator itE = m_vecMemberList.end();
std::vector<SPlayerSlot*>::iterator itS = m_vecMemberList.begin();
for(; itS != itE; itS++, i++)
{
SPlayerSlot* pSlot = (*itS);
if(pSlot->GetMainCreatureHandle() == hCreature || pSlot->GetSubCreatureHandle() == hCreature)
{
return pSlot;
}
}
return NULL;
}
SPlayerSlot* SMessengerMgr::GetLeaderInfo()
{
return FindMember( m_strLeaderName.c_str() );
}
const AR_HANDLE SMessengerMgr::GetMemberHandle( const char* szName )
{
SPlayerSlot* pSlot = FindMember( szName );
if( pSlot == NULL ) return NULL;
return pSlot->GetHandle();
}
const int SMessengerMgr::GetLoginMemberCount()
{
int nCount = 0;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->IsLogin() ) nCount++;
it++;
}
return nCount;
}
const bool SMessengerMgr::IsFar( AR_HANDLE hPlayer ) const
{
if( m_pGame == NULL ) return false;
return m_pGame->GetGameObject( hPlayer ) ? false : true;
}
const bool SMessengerMgr::IsExistMember( AR_HANDLE hPlayer ) const
{
if( m_vecMemberList.empty() ) return false;
std::vector<SPlayerSlot*>::const_iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->GetHandle() == hPlayer ) return true;
it++;
}
return false;
}
// 2010.07.27 - prodongi
const bool SMessengerMgr::IsExistLoginMember(AR_HANDLE hPlayer) const
{
if( m_vecMemberList.empty() ) return false;
std::vector<SPlayerSlot*>::const_iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->GetHandle() == hPlayer && pSlot->IsLogin() )
return true;
it++;
}
return false;
}
const bool SMessengerMgr::IsExistMember( const char* szName ) const
{
if( m_vecMemberList.empty() ) return false;
std::vector<SPlayerSlot*>::const_iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( ::_stricmp(pSlot->GetName(), szName) == 0 ) return true;
it++;
}
return false;
}
const int SMessengerMgr::GetMemberIndex( AR_HANDLE hPlayer ) const
{
if( m_vecMemberList.empty() ) return -1;
//파티장이 멘위로 올라가는 문제 수정
//2009-07-09 : hunee
/*
int nIndex( GetLeaderIndex() );
for( int i(0); i<(int)m_vecMemberList.size(); ++i )
{
if( m_vecMemberList[i]->GetHandle() == hPlayer )
{
if( !m_vecMemberList[i]->IsLeader() )
{
if( nIndex>i ) return i;
else return i+1;
}
else return 0;
}
}
*/
for( int i(0); i<(int)m_vecMemberList.size(); ++i )
{
if( m_vecMemberList[i]->GetHandle() == hPlayer )
return i;
}
return -1;
}
const int SMessengerMgr::GetLeaderIndex() const
{
if( m_vecMemberList.empty() ) return -1;
for( int i(0); i<(int)m_vecMemberList.size(); ++i )
{
if( m_vecMemberList[i]->IsLeader() )
return i;
}
return -1;
}
//////////////////////////////////////////////////////////////////////////
// SPartyMgr
SPartyMgr::SPartyMgr()
: SMessengerMgr() // 2011.03.29 - servantes
{
Clear();
m_bCreate = FALSE;
}
void SPartyMgr::Clear()
{
m_strSelectMember.clear();
m_strCommunityName.clear();
m_strLeaderName.clear();
m_nDivisionMode = 0;
SMessengerMgr::Clear();
}
void SPartyMgr::ResetInfo()
{
Clear();
}
const bool SPartyMgr::IsPartyLeader()
{
return ( ::_stricmp(m_strLocalPlayerName.c_str(), GetPartyLeaderName()) == 0 );
}
const char* SPartyMgr::GetPartyLeaderName()
{
SPlayerSlot* pLeader = GetLeaderInfo();
if( pLeader )
{
return pLeader->GetName();
}
return "NotFoundLeader";
}
bool SPartyMgr::IsMyParty()
{
const char* pName = g_pCurrentGameSystem->getLocalPlayerName();
if( pName == NULL )
return false;
SPlayerSlot * pPlayerSlot = FindMember( pName );
if( pPlayerSlot )
return true;
return false;
}
//int SPartyMgr::AddMessage( const char* szMsg )
int SPartyMgr::AddMessage( const char* szMsg, bool & bSelf ) // 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
int bRet = SMessengerMgr::AddMessage(szMsg, m_bSelf);
if( m_bParsing ) return bRet;
STR_LIST vecText;
MsgSplit( szMsg, vecText, L"|" );
size_t nTextSize = vecText.size();
if( nTextSize <= 0 ) return 0;//false;
if( ::_stricmp( vecText[0].c_str(), "CHANGE_NAME" ) == 0 ) //CHANGE_NAME|old_name|new_name|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
#ifdef _DEBUG
const char * pOldName = vecText[1].c_str();
const char * pNewName = vecText[2].c_str();
#endif
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetName( vecText[2].c_str() );
pPlayerSlot->GetHandle();
}
}
else if( ::_stricmp( vecText[0].c_str(), "CHANGE_LEVEL" ) == 0 ) //CHANGE_NAME|캐릭터이름|레벨|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetLevel( ::atoi( vecText[2].c_str() ) );
}
}
else if( ::_stricmp( vecText[0].c_str(), "CHANGE_JOB" ) == 0 ) //CHANGE_NAME|캐릭터이름|직업|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetJobID( ::atoi( vecText[2].c_str() ) );
}
}
else if( ::_stricmp( vecText[0].c_str(), "MODE" ) == 0 ) // MODE|모드 0:각자, 1:랜덤, 2:순차
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
ChangePartyDivision( vecText[1].c_str() );
vecText.clear();
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "PINFO" ) == 0 ) // PINFO|파티이름|파티장이름|분배방식|최고렙|최저렙|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|소환수플래그|
{
InfoMember( vecText );
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) ); // 2011.12.21 - servantes : InfoMember에서 파티창으로 메세지 보내고 있음 그래서 주석처리
vecText.clear();
return 200;//true; // "PINFO" 밖에서 처리하기 위해 // 2011.10.24 : servantes
}
else if( ::_stricmp( vecText[0].c_str(), "LIST" ) == 0 ) // LIST|캐릭이름|분배방|최고렙|최저
{
ChangePartyInfo( vecText );
return 1;//true;
}
// sonador 3.12.1 파티원 좌표 갱신 기능 추가
else if( ::_stricmp( vecText[0].c_str(), "PPOS" ) == 0 ) // PPOS|파티원1_핸들|X좌표|Y좌표|파티원2_핸들|X좌표|Y좌표|...
{
UpdatePartyPosition( vecText );
vecText.clear();
return 1;//true;
}
vecText.clear();
return bRet;
}
bool SPartyMgr::JoinMember( const char* szPlayerName, const char* szCommunityName )
{
int k=0;
k=0;
k=1;
// JOIN|파티이름| // 새 멤버(=자기자신)에게
// NEW|캐릭이름| // 기존 멤버에게만
m_bParsing = true;
// join
if (g_pCurrentGameSystem->isLocalPlayerName(szPlayerName))
{
m_bIsExist = true;
m_strCommunityName = szCommunityName;
m_strGuildName = szCommunityName;
m_strMsg = szCommunityName;
}
else
m_strMsg = szPlayerName;
return AddMember( szPlayerName );
}
//-----------------------------------------------------------------------------------------------------------------
// 파티 멤버 추가
//-----------------------------------------------------------------------------------------------------------------
bool SPartyMgr::AddMember( const char* szName )
{
if( IsExistMember( szName ) )
return true;
if( m_vecMemberList.size() >= SLOT_MAXLINE )
{
SLOG( "[SPartyMgr] 파티원의 수가 최대 파티원을 넘어섰습니다 - 파티추가 무시 [ %s ]", szName );
assert( NULL );
return false;
}
SPlayerSlot* pSlot( new SPlayerSlot );
if( pSlot )
{
pSlot->SetName( szName );
if( ::_stricmp(pSlot->GetName(), m_strLeaderName.c_str() ) == 0 )
pSlot->SetLeader( true );
m_vecMemberList.push_back( pSlot );
g_pRaidMgr->setPartyCount( m_strCommunityName, m_vecMemberList.size() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 파티 멤버 추가
//-----------------------------------------------------------------------------------------------------------------
bool SPartyMgr::AddMember( SPlayerSlot* pSlot )
{
if( pSlot == NULL )
return false;
if( m_vecMemberList.size() >= SLOT_MAXLINE )
{
SLOG( "[SPartyMgr] 파티원의 수가 최대 파티원을 넘어섰습니다 - 파티추가 무시 [ %s ]", pSlot->GetName() );
assert( NULL );
return false;
}
m_vecMemberList.push_back( pSlot );
g_pRaidMgr->setPartyCount(m_strCommunityName, m_vecMemberList.size());
return true;
}
bool SPartyMgr::DeleteMember( const char* szPlayerName )
{
if(szPlayerName == NULL)
return false;
if (g_pCurrentGameSystem->isLocalPlayerName(szPlayerName)) // 자기 자신이라면.. 파티 파괴후 리턴
{
Clear();
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
// 2011.11.07 - servantes : 내가 추방 당함
/// 2012.07.13 메세지 처리는 모았다가 한꺼번에 하기 때문에, leave가 날라오고 create가 바로 날라오는 경우, leave 메세지 때문에 파티창이 안 보이는 경우가 있다.
/// 그래서 PostMsgAtDynamic을 안 쓰고 ProcMsgAtStatic를 씀 - prodongi
ProcMsgAtStatic(&SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "leave_party_me", m_strCommunityName.c_str()));
return true;
}
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( ::_stricmp(pSlot->GetName(), szPlayerName) == 0 )
{
m_pGame->GetGameManager()->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_STATE, "remove_player", pSlot->GetHandle()));
SAFE_DELETE(pSlot);
m_vecMemberList.erase(it);
g_pRaidMgr->setPartyCount(m_strCommunityName,m_vecMemberList.size()); //2011. 12. 20 - marine 파티원수 레이드에 갱신
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
return true;
}
it++;
}
return false;
}
// 2011.11.23 - servantes : 리턴형 변경
// sonador 3.12.1 파티원 좌표 갱신 기능 추가
bool SPartyMgr::UpdatePartyPosition( STR_LIST& data )
{
int dataSize = data.size();
if( dataSize < 2 )
return false; // there is information for no one.
if( ( ( dataSize - 1 ) % 3 ) != 0 )
return false; // wrong data!!!
int infoSize = ( dataSize - 1 ) / 3;
for( int index = 0; index < infoSize; ++index )
{
const char* handleData = data[ 1 + index * 3 + 0 ].c_str();
const char* xPosData = data[ 1 + index * 3 + 1 ].c_str();
const char* yPosData = data[ 1 + index * 3 + 2 ].c_str();
char* strToOper;
AR_HANDLE handle = ::strtoul( handleData, &strToOper, 10 );
int xPos = ::atoi( xPosData );
int yPos = ::atoi( yPosData );
SPlayerSlot* slot = FindMember( handle );
if( !slot )
continue; // not our party member
slot->SetXPos( xPos );
slot->SetYPos( yPos );
slot->SetNear( !IsFar( handle ) );
}
return true;
}
void SPartyMgr::InfoMember( STR_LIST& vecText, int nStartTap )
{
int n=0;
if(nStartTap != -1)
n = nStartTap;
m_bParsing = true;
m_bIsExist = true;
if( vecText.size() < 8 )
{
assert(0);
return;
}
m_nPartyType = ::atoi( vecText[7+n].c_str() ); // 2011.10.20 - servantes : 파티타입
if(m_bCreate == FALSE)
{
m_nCommunityID = ::atoi( vecText[1+n].c_str() );
m_strCommunityName = vecText[2+n];
m_strLeaderName = vecText[3+n];
m_nDivisionMode = ::atoi( vecText[4+n].c_str() );
m_nMaxLevel = ::atoi( vecText[5+n].c_str() );
m_nMinLevel = ::atoi( vecText[6+n].c_str() );
// 1 : 던전 레이드
// 2 : 공격대
if(m_nPartyType == PARTY_DUNGEON_RAID || m_nPartyType == PARTY_SIEGE || m_nPartyType == PARTY_ARENA)
{
char strCommunityName[256]={0};
std::string::size_type offset = 0;
offset = m_strCommunityName.find( "_", offset );
if( std::string::npos != offset ) // '_'가 있으면 그 앞까지 이름만 넣는다
strncpy(strCommunityName, m_strCommunityName.c_str(), (int)offset);
else
strcpy(strCommunityName, m_strCommunityName.c_str());
g_pRaidMgr->setAttackUnitName(strCommunityName); // 2011.12.07 - servantes '_'가 없는 공격대 이름만 넣는다
}
}
bool bMyParty=false; // 2011.12.05 - servantes
int nLine = static_cast<int>(vecText.size()) - 8;
int nCount = nLine / 9;
int nPos = 0;
for( int i = 0; i < nCount; i++ )
{
if( i > 0 )
nPos = (9 * i);
SPlayerSlot* pSlot = FindMember( vecText[9 +n+ nPos].c_str() );
if(pSlot == NULL)
{
pSlot = new SPlayerSlot;
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[8+n+nPos].c_str(), &strstoper, 10 );
pSlot->SetHandle( handle );
pSlot->SetName ( vecText[9 +n+ nPos].c_str() );
pSlot->SetLevel ( ::atoi( vecText[10 +n+ nPos].c_str() ) );
pSlot->SetJobID ( ::atoi( vecText[11 +n+ nPos].c_str() ) );
pSlot->SetHP ( ::atoi( vecText[12 +n+ nPos].c_str() ) );
pSlot->SetMP ( ::atoi( vecText[13 +n+ nPos].c_str() ) );
pSlot->SetXPos ( ::atoi( vecText[14 +n+ nPos].c_str() ) );
pSlot->SetYPos ( ::atoi( vecText[15 +n+ nPos].c_str() ) );
pSlot->SetCreature( ::atoi( vecText[16 +n+ nPos].c_str() ), 0 );
// 2011.10.11 - servantes : 가독성 높임
if( pSlot->GetHandle() == NULL )
pSlot->SetLogin( false );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 )
pSlot->SetLeader( true );
pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
m_vecMemberList.push_back(pSlot);
}
else
{
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[8+n+nPos].c_str(), &strstoper, 10 );
pSlot->SetHandle( handle );
pSlot->SetLevel ( ::atoi( vecText[10 +n+ nPos].c_str() ) );
pSlot->SetJobID ( ::atoi( vecText[11 +n+ nPos].c_str() ) );
pSlot->SetHP ( ::atoi( vecText[12 +n+ nPos].c_str() ) );
pSlot->SetMP ( ::atoi( vecText[13 +n+ nPos].c_str() ) );
pSlot->SetXPos ( ::atoi( vecText[14 +n+ nPos].c_str() ) );
pSlot->SetYPos ( ::atoi( vecText[15 +n+ nPos].c_str() ) );
pSlot->SetCreature( ::atoi( vecText[16 +n+ nPos].c_str() ), 0 );
}
// 2011.12.05 - servantes
// 파티원 정보 중에 내가 있는지 검사
const char* pName = g_pCurrentGameSystem->getLocalPlayerName();
std::string strName = pSlot->GetName();
if( strName.compare( pName ) == 0 )
{
bMyParty = true;
}
SetPartyMemberHpBar(vecText[8+n+nPos]);
}
if( static_cast<int>(m_vecMemberList.size()) == 1 )
m_nMinLevel = m_nMaxLevel;
// 1 : 던전 레이드
// 2 : 공격대
if(m_nPartyType == PARTY_DUNGEON_RAID || m_nPartyType == PARTY_SIEGE || m_nPartyType == PARTY_ARENA)
{
bool bExist = ( NULL != g_pRaidMgr->GetRaidInfo(m_strCommunityName.c_str()) ); // 레이드가 존재하는가?
SPlayerSlot* pSlot = FindMember(m_strLeaderName.c_str()); // 멤버가 존재하는가?
if(pSlot && bExist == false)
{
// 레이드 정보
SRaidInfo* pRaidInfo = new SRaidInfo;
pRaidInfo->SetPartyID ( m_nCommunityID ); // party_id
pRaidInfo->SetPartyName ( m_strCommunityName.c_str() ); // party_name 2011. 10. 18 - marine
pRaidInfo->SetLeaderName ( m_strLeaderName.c_str() ); // leader_name
pRaidInfo->SetLeaderLv ( pSlot->GetLevel() ); // leader_lv
pRaidInfo->SetLeaderJob_id( pSlot->GetJobID() ); // leader_job_id
pRaidInfo->SetMemberCount ( m_vecMemberList.size() ); // member_count
pRaidInfo->SetGguildParty ( false ); // 현재 사용하지 않는 데이타
//g_pRaidMgr->GetRaidInfoList().push_back( pRaidInfo ); // 레이드 정보 리스트에 추가
g_pRaidMgr->pushRaidInfo(pRaidInfo); // 2011. 12. 21 - marine
}
}
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_party_type", m_strCommunityName.c_str(), unsigned int(m_nPartyType) ) );
m_bCreate = TRUE;
}
void SPartyMgr::ChangePartyInfo( STR_LIST& vecText )
{
m_bParsing = true;
if( !m_bIsExist ) return;
m_nDivisionMode = ::atoi( vecText[2].c_str() );
m_nMaxLevel = ::atoi( vecText[3].c_str() );
m_nMinLevel = ::atoi( vecText[4].c_str() );
}
void SPartyMgr::ChangePartyDivision( const char* szMode )
{
m_nDivisionMode = ::atoi( szMode );
}
void SPartyMgr::checkValidArenaJoinSituation()
{
sArenaJoinSituationCondition situationCondition;
/// way
situationCondition.m_notificationWays = cArenaJoinSituationChecker::WAY_NOTIFICATION_WND;
/// situation
situationCondition.add(cArenaJoinSituationChecker::SITUATION_ARENA_WAITING, S(2433));
situationCondition.add(cArenaJoinSituationChecker::SITUATION_ARENA_WAITING_COUNT, S(2433));
g_pCurrentGameSystem->isValidArenaJoinSituation(situationCondition);
}
//===============================================================================================================================================
// CPartyListMgr
//===============================================================================================================================================
// 2011.10.18 : servantes : 파티정보 PINFO 에 파티 ID 추가
CPartyListMgr::CPartyListMgr()
: SPartyMgr()
{
g_pPartyListMgr = this;
m_bRecvJoinOrLogin = false;
m_nMyPartyID = -1;
m_isArenaParty = false;
Clear();
// m_nMyPartyID = -1;
// SPartyMgr* pPartyList = new SPartyMgr;
// Add(pPartyList);
}
CPartyListMgr::~CPartyListMgr()
{
Clear();
}
///< 파티 찾기
SPartyMgr* CPartyListMgr::GetParty(std::string* pstrPartyName)
{
std::string strPartyName;
if(pstrPartyName == NULL)
{
if(m_strCommunityName.size())
{
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.find(m_strCommunityName);
if(it != m_mapPartyInfoList.end())
return it->second;
return (SPartyMgr*)this;
}
else
{
return (SPartyMgr*)this;
}
}
else
strPartyName = *pstrPartyName;
if(m_strCommunityName == strPartyName)
return (SPartyMgr*)this;
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.find(strPartyName);
if(it == m_mapPartyInfoList.end())
return NULL;
return it->second;
}
bool CPartyListMgr::IsLeader(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::IsLeader();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::IsLeader();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return false;
return pPartyList->IsLeader();
}
bool CPartyListMgr::IsPartyLeader(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::IsPartyLeader();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::IsPartyLeader();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return false;
return pPartyList->IsPartyLeader();
}
bool CPartyListMgr::IsLocalPlayer( AR_HANDLE hPlayer, std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::IsLocalPlayer(hPlayer);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::IsLocalPlayer(hPlayer);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return false;
return pPartyList->IsLocalPlayer(hPlayer);
}
bool CPartyListMgr::IsExist(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::IsExist();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::IsExist();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return false;
return pPartyList->IsExist();
}
void CPartyListMgr::SetPlayerInfo( AR_HANDLE hPlayer, const char* szName, std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::SetPlayerInfo(hPlayer, szName);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::SetPlayerInfo(hPlayer, szName);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return ;
return pPartyList->SetPlayerInfo(hPlayer, szName);
}
void CPartyListMgr::SetSelectMember( const char* szName, std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::SetSelectMember(szName);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::SetSelectMember(szName);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return ;
pPartyList->SetSelectMember( szName );
}
///< 선택 된 파티원 핸들 설정.
void CPartyListMgr::SetSelectMemberHandle( AR_HANDLE hTarget, std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::SetSelectMemberHandle(hTarget);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::SetSelectMemberHandle(hTarget);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return ;
pPartyList->SetSelectMemberHandle( hTarget );
}
void CPartyListMgr::ChangePartyInfo( STR_LIST& vecPartyText, std::string* pstrPartyName) // list
{
if(pstrPartyName == NULL)
return SPartyMgr::ChangePartyInfo(vecPartyText);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::ChangePartyInfo(vecPartyText);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return ;
pPartyList->ChangePartyInfo(vecPartyText);
}
void CPartyListMgr::ChangePartyDivision( const char* szMode, std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::ChangePartyDivision(szMode);
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::ChangePartyDivision(szMode);
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return ;
pPartyList->ChangePartyDivision(szMode);
}
int CPartyListMgr::GetPartyType(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::GetPartyType();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::GetPartyType();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return -1;
return pPartyList->GetPartyType();
}
const char* CPartyListMgr::GetMessage(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::GetMessage();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::GetMessage();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return NULL;
return pPartyList->GetMessage();
}
int CPartyListMgr::GetPartyPass(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::GetPartyPass();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::GetPartyPass();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return 0;
return pPartyList->GetPartyPass();
}
const char* CPartyListMgr::GetPartyLeaderName(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::GetPartyLeaderName();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::GetPartyLeaderName();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return NULL;
return pPartyList->GetPartyLeaderName();
}
int CPartyListMgr::GetDivision(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::GetDivision();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::GetDivision();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return 0;
return pPartyList->GetDivision();
}
const char* CPartyListMgr::GetSelectMember(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::GetSelectMember();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::GetSelectMember();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return NULL;
return pPartyList->GetSelectMember();
}
int CPartyListMgr::GetPartyID(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::GetPartyID();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::GetPartyID();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return 0;
return pPartyList->GetPartyID();
}
std::vector<SPlayerSlot*>& CPartyListMgr::GetMemberList(std::string* pstrPartyName)
{
static std::vector<SPlayerSlot*> nullList; // 기존 구조가 벡터 주소값을 넘겨 주는 형태라 구조에 맞추느라 static으로 처리 한다
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return nullList;
return pPartyList->GetMemberList();
}
int CPartyListMgr::GetMemberCount(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::GetMemberCount();
int nCount = SMessengerMgr::GetMemberCount();
if(nCount)
return nCount;
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return 0;
return pPartyList->GetMemberCount();
}
const char* CPartyListMgr::GetPartyName(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SPartyMgr::GetPartyName();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SPartyMgr::GetPartyName();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return "";
return pPartyList->GetPartyName();
}
///< 선택 된 파티원 핸들 불러오기.
AR_HANDLE CPartyListMgr::GetSelectMemberHandle(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return SMessengerMgr::GetSelectMemberHandle();
if(m_strCommunityName.compare( *pstrPartyName ) == 0)
return SMessengerMgr::GetSelectMemberHandle();
SPartyMgr* pPartyList = GetParty(pstrPartyName);
if(pPartyList == NULL)
return 0;
return pPartyList->GetSelectMemberHandle();
}
void CPartyListMgr::Clear()
{
SPartyMgr::Clear();
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* p = itS->second;
SAFE_DELETE(p);
}
m_mapPartyInfoList.clear();
}
// 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
int CPartyListMgr::AddMessage( const char* szMsg, bool & bSelf )
{
STR_LIST vecText;
MsgSplit( szMsg, vecText, L"|" );
size_t nTextSize = vecText.size();
if( nTextSize <= 0 )
return 0;//false;
int bRet = 0;
// 내가 만든 파티일 때만 "CREATE" 가 온다
// 남이 만든 파티는 "PINFO"
if( ::_stricmp( vecText[0].c_str(), "CREATE" ) == 0 ) // 2011.10.20 : servantes
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
/// 2012.01.16 함수로 뺌 - prodongi
int partyType;
if(vecText.size() > 3)
partyType = ::atoi( vecText[3].c_str() ); // 파티 타입을 얻는다
else
partyType = PARTY_NORMAL;
createParty(vecText[1], vecText[2], partyType);
vecText.clear();
return bRet;
}
else if( ::_stricmp( vecText[0].c_str(), "LOGIN" ) == 0 ) // LOGIN|[파튀,길드]이름|캐릭이름
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
SPartyMgr* pParty = FindIncludeSlef(&vecText[1]);
if(pParty == NULL) // 파티가 만들어지지 않았다면 만든다
{
bool isLocalPlayer = g_pCurrentGameSystem->isLocalPlayerName(vecText[2].c_str());
if (isLocalPlayer)
{
SMessengerMgr::SetLocalPlayerName(vecText[2].c_str());
SMessengerMgr::CreateCommunity( vecText[1].c_str(), vecText[2].c_str() ); // 파티 이름
if (isLocalPlayer)
SMessengerMgr::SetExist( true );
// 내 파티 이름으로 내 파티 아이디를 찾아 놓는다
std::string sPartyName( m_strCommunityName.c_str() );
size_t nPos = sPartyName.find_first_of("_") + 1;
size_t nEndPos = sPartyName.size();
std::string strNumber = sPartyName.substr(nPos, nEndPos);
m_nMyPartyID = atoi( strNumber.c_str() ) + 2;
// 2011.12.21 - servantes : 내 파티이고 내가 로그인 했다면 파티창 보이라고 알림
m_bRecvJoinOrLogin = true; // ui refresh가 필요하므로..
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", vecText[1].c_str(), number_t( -1 ), number_t( 0 ) ) );
}
else
{
pParty = new SPartyMgr;
pParty->SetLocalPlayerName(vecText[2].c_str());
pParty->CreateCommunity( vecText[1].c_str() ); // 파티 이름
pParty->SetGame(m_pGame);
g_pPartyListMgr->Add(pParty); // 파티 매니저 리스트에 파티 매니저 추가
m_bRecvJoinOrLogin = true; // ui refresh가 필요하므로..
if( vecText[2].compare( pParty->GetLocalPlayerName() ) == 0 )
pParty->SetExist( true );
m_bRecvJoinOrLogin = true; // ui refresh가 필요하므로..
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", vecText[1].c_str(), number_t( 0 ), number_t( 4 ) ) );
}
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[2].c_str(), NULL );
if( pPlayerSlot )
{
pPlayerSlot->SetLogin( true );
pPlayerSlot->SetNear( !(IsFar(pPlayerSlot->GetHandle())) );
}
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "LOGOUT" ) == 0 ) // LOGOUT|캐릭이름 // 2011.12.09 - servantes : logout
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
const char* pName = g_pCurrentGameSystem->getLocalPlayerName();
if( vecText[1].compare(pName) == 0 ) // 내 캐릭터 이름이면
{
Clear();
return false;
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str(), NULL );
if( pPlayerSlot )
{
pPlayerSlot->SetHandle( 0 );
pPlayerSlot->SetLogin( false );
pPlayerSlot->SetNear( false );
}
/// 2011.12.26 유효하지 않은 팝업 메뉴가 될 수 있으므로 hide 시켜 준다 - prodongi
SendGameInterfaceMsg(&SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CHARACTER, false));
SendGameInterfaceMsg(&SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CREATURE, false));
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "deselect", m_strCommunityName.c_str() ) );
return 1;//true;
}
// 2011.10.24 : servantes : 자기 파티일 경우
else if( ::_stricmp( vecText[0].c_str(), "PINFO" ) == 0 ) // PINFO|파티이름|파티장이름|분배방식|최고렙|최저렙|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|소환수플래그|
{
/// 2012.01.16 CREATE가 날라오지 않고, PINFO가 날라왔을 경우는 우선 베어로드라고 생각한다..... CREATE이 날라오도록 서버에 요청해야 될 것 같음 - prodongi
SPartyMgr* party = FindIncludeSlef(&vecText[2]);
if (!party)
createParty(vecText[2], vecText[3], atoi(vecText[7].c_str()));
else
{
int nMyParty = -1;
const char* pName = g_pCurrentGameSystem->getLocalPlayerName();
if(party->FindMember(pName) == NULL)
{
party->SetPartyType(PARTY_SIEGE_OTHER);
nMyParty = 0;
}
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", party->GetPartyName(), number_t( nMyParty ), number_t( party->GetPartyType() ) ) );
}
InfoMember(vecText);
// bRet = SPartyMgr::AddMessage(szMsg, m_bSelf);
return 1;//true;
}
else if( ::_stricmp( vecText[0].c_str(), "RMINFO" ) == 0 ) // RMINFO | -2147483648 | 재봉짱1 | 200 | 1 |
{
InfoRaidMember(vecText);
}
else if( ::_stricmp( vecText[0].c_str(), "DESTROY" ) == 0 ) // DESTROY|[파튀,길드]이름 // 2011.10.20 : servantes
{
SPartyMgr* pParty = GetParty(&vecText[1]);
if(pParty)
{
pParty->Clear();
// 파티창을 숨긴다
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "delete_party_wnd", vecText[1].c_str() ) );
}
if (1 == atoi(vecText[2].c_str()))
{
checkValidArenaJoinSituationByLeaveAtArena();
}
}
else if( ::_stricmp( vecText[0].c_str(), "JOIN" ) == 0 ) // JOIN|파티명|캐릭터명
{
/// 2012.06.08 2021.06.08 " // JOIN|파티명|캐릭터명" 공대 파티와 일반 파티와 통일됨 - prodongi
JoinMember(vecText[2].c_str(), &vecText[1]);
}
else if( ::_stricmp( vecText[0].c_str(), "LEAVE" ) == 0 ) // LEAVE|캐릭이름
{
LeaveMember(vecText[1].c_str(), NULL, vecText[2].c_str());
}
else if( ::_stricmp( vecText[0].c_str(), "KICK" ) == 0 ) // KICK|파티명|캐릭이름
{
LeaveMember(vecText[2].c_str(), &vecText[1]);
}
else if( ::_stricmp( vecText[0].c_str(), "SINFO" ) == 0 ) // SINFO | 목록개수| (플레이어 핸들 | 주크리처 핸들 | 부 크리처 핸들) X 목록개수
{
SummonInfo(vecText);
}
else if( ::_stricmp( vecText[0].c_str(), "MSINFO" ) == 0 ) // MSINFO | 플레이어 핸들 | 주크리처 핸들 | 부 크리처 핸들
{
MemberSummonInfo(vecText);
}
else
{
bRet = SPartyMgr::AddMessage(szMsg, m_bSelf);
}
vecText.clear();
return bRet;
}
void CPartyListMgr::InfoMember( STR_LIST& vecText )
{
if( vecText.size() < 7 )
{
assert(0);
return;
}
SPartyMgr* pParty = FindPartyByPartyName( &vecText[2] );
if(NULL == pParty)
{
return ;
}
/// 자신의 파티일 경우에는 파티 id를 설정해 준다
if (::_stricmp(GetPartyName(), vecText[2].c_str()) == 0)
{
SetPartyID(atoi(vecText[1].c_str()));
}
int nStartTap = 0;
int partyType = ::atoi( vecText[7+nStartTap].c_str() );
m_isArenaParty = (PARTY_ARENA == partyType) ? true : false;
pParty->InfoMember( vecText, nStartTap );
if(m_bRecvJoinOrLogin == true )
{
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "refresh_title", pParty->GetPartyName(), unsigned int(pParty->GetPartyType()) ) );
m_bRecvJoinOrLogin = false;
}
}
void CPartyListMgr::InfoRaidMember( STR_LIST& vecText )
{
if( vecText.size() < 5 )
{
assert(0);
return;
}
int nPos = 1;
// int nCount = ( ((int)vecText.size()) - 1 ) / CONST_PARTY_MEMBER_INFO_COUNT;
// for( int i = 0; i < nCount; i++ )
// {
SPartyMgr* pPartyMgr = FindPartyByPlayerName( &vecText[1 + nPos] );
// SPlayerSlot* pSlot = FindMember( vecText[1 + nPos].c_str() );
if(pPartyMgr)
{
SPlayerSlot* pSlot = pPartyMgr->FindMember(vecText[1 + nPos].c_str());
if( pSlot == NULL )
{
pSlot = new SPlayerSlot;
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[0 + nPos].c_str(), &strstoper, 10 );
pSlot->SetHandle ( handle );
pSlot->SetName ( vecText[1 + nPos].c_str() );
pSlot->SetJobID ( ::atoi( vecText[2 + nPos].c_str() ) );
if( ::atoi( vecText[3 + nPos].c_str() ) )
{
pSlot->SetHP (100); // 정보가 없어서 기본 100으로 넣어준다
pSlot->SetMP (100); // 정보가 없어서 기본 100으로 넣어준다
}
else
{
pSlot->SetHP (0); // 정보가 없어서 기본 100으로 넣어준다
pSlot->SetMP (0); // 정보가 없어서 기본 100으로 넣어준다
}
pPartyMgr->AddMember(pSlot);
g_pRaidMgr->setPartyCount( std::string( pPartyMgr->GetPartyName() ), pPartyMgr->GetMemberCount()); // 2011. 12. 20 - marine 파티원수 레이드 매니저에 갱신
}
else
{
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[0 + nPos].c_str(), &strstoper, 10 );
pSlot->SetHandle ( handle );
pSlot->SetName ( vecText[1 + nPos].c_str() );
pSlot->SetJobID ( ::atoi( vecText[2 + nPos].c_str() ) );
if( ::atoi( vecText[3 + nPos].c_str() ) )
{
pSlot->SetHP (100); // 정보가 없어서 기본 100으로 넣어준다
pSlot->SetMP (100); // 정보가 없어서 기본 100으로 넣어준다
}
else
{
pSlot->SetHP (0); // 정보가 없어서 기본 100으로 넣어준다
pSlot->SetMP (0); // 정보가 없어서 기본 100으로 넣어준다
}
}
/// 2011.12.20 효곤씨 확인요, 파티장일 때만 설정 - prodongi
if (::strcmp(pPartyMgr->GetPartyLeaderName(), vecText[1+nPos].c_str()) == 0)
{
// 2011. 12. 15 - marine Rain_Mgr에는 파티이름만 들어가 있으므로 나머지 정보를 채워준다.
STR_LIST str_raid;
std::string strPartyName = pPartyMgr->GetPartyName();
str_raid.push_back(strPartyName); // 파티 이름
str_raid.push_back(vecText[1+nPos]); // 파티장 이름
str_raid.push_back(vecText[2+nPos]); // 파티장 레벨
g_pRaidMgr->setJoinPartyData(str_raid);
}
}
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "refresh_ui", vecText[1 + nPos].c_str() ) );
// nPos += CONST_PARTY_MEMBER_INFO_COUNT;
// }
if(g_pRaidMgr->GetPartyCount() != 0 )
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DUNGEONUNIT_UPDATE() );
}
SPartyMgr* CPartyListMgr::FindPartyByID(int nPartyID)
{
if(nPartyID <= 0)
return NULL;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
if( pParty->GetPartyID() == nPartyID )
return pParty;
}
if( GetPartyID() == nPartyID )
return (SPartyMgr*)this;
return NULL;
}
void CPartyListMgr::SummonInfo( STR_LIST& vecText )
{
if( vecText.size() < 4 )
{
assert(0);
return;
}
int nMsgCount = vecText.size();
int nMsgReadCount = 0;
int nPos = 2;
while( nMsgCount > nPos )
{
SPartyMgr* pParty;
std::string strMseeage = "";
std::string strCount = vecText[ nPos ];
int nCount = atoi(vecText[ nPos ].c_str());
if(nCount <= 0)
{
strMseeage = "empty";
strMseeage += "|";
strMseeage += strCount;
strMseeage += "|";
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "creature_info", strMseeage.c_str() ) );
return ;
}
nPos += 1;
for(int i=0; i<nCount; i++, nPos+=3)
{
char * strstoper;
AR_HANDLE hMaster = ::strtoul( vecText[ nPos + 0 ].c_str(), &strstoper, 10 );
AR_HANDLE hMain = ::strtoul( vecText[ nPos + 1 ].c_str(), &strstoper, 10 );
AR_HANDLE hSub = ::strtoul( vecText[ nPos + 2 ].c_str(), &strstoper, 10 );
if(i == 0)
{
pParty = FindPartyByPlayerHandle( hMaster );
if( pParty == NULL )
return ;
strMseeage = pParty->GetPartyName();
strMseeage += "|";
// 개수 추가
strMseeage += strCount;
strMseeage += "|";
}
SPlayerSlot* pPlayer = pParty->FindMemberHandle( hMaster );
if(pPlayer == NULL)
continue ;
pPlayer->SetMainCreatureHandle( hMain );
pPlayer->SetSubCreatureHandle( hSub );
// 핸들(주인, 주크리처, 부크리처) 추가
strMseeage += vecText[ nPos + 0 ];
strMseeage += "|";
strMseeage += vecText[ nPos + 1 ];
strMseeage += "|";
strMseeage += vecText[ nPos + 2 ];
strMseeage += "|";
}
nPos += 1; // 파티 아이디를 사용하지 않기 위함
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "creature_info", strMseeage.c_str() ) );
}
}
void CPartyListMgr::MemberSummonInfo( STR_LIST& vecText )
{
if( vecText.size() < 3 )
{
assert(0);
return;
}
char * strstoper;
AR_HANDLE hMaster = ::strtoul( vecText[ 2 ].c_str(), &strstoper, 10 );
AR_HANDLE hMain = ::strtoul( vecText[ 3 ].c_str(), &strstoper, 10 );
AR_HANDLE hSub = ::strtoul( vecText[ 4 ].c_str(), &strstoper, 10 );
SPartyMgr* pParty = FindPartyByPlayerHandle( hMaster );
if( pParty == NULL )
return ;
SPlayerSlot* pPlayer = pParty->FindMemberHandle( hMaster );
if(pPlayer == NULL)
return ;
pPlayer->SetMainCreatureHandle( hMain );
pPlayer->SetSubCreatureHandle( hSub );
// 파티 이름 추가
std::string strMseeage = pParty->GetPartyName();
strMseeage += "|";
// 핸들(주인, 주크리처, 부크리처) 추가
strMseeage += vecText[ 2 ];
strMseeage += "|";
strMseeage += vecText[ 3 ];
strMseeage += "|";
strMseeage += vecText[ 4 ];
strMseeage += "|";
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY, "member_creature_info", strMseeage.c_str() ) );
ProcMsgAtStatic (&SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_PARTY_STATE, "member_creature_info", strMseeage.c_str() ) );
}
void CPartyListMgr::Add(SPartyMgr* pSPartyMgr)
{
if(NULL == pSPartyMgr)
return ;
std::string strPartyName = pSPartyMgr->GetPartyName();
m_mapPartyInfoList.insert(std::make_pair(strPartyName, pSPartyMgr));
}
void CPartyListMgr::Delete(std::string* pstrPartyName)
{
if(NULL == pstrPartyName)
return ;
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.find(*pstrPartyName);
if(it == m_mapPartyInfoList.end())
return ;
SPartyMgr* p = it->second;
SAFE_DELETE(p);
m_mapPartyInfoList.erase(it);
}
SPartyMgr* CPartyListMgr::Find(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return (SPartyMgr*)this;
if(m_strCommunityName == *pstrPartyName)
return (SPartyMgr*)this;
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.find(*pstrPartyName);
if(it == m_mapPartyInfoList.end())
return NULL;
return it->second;
}
SPartyMgr* CPartyListMgr::Find(int partyId)
{
if (m_nCommunityID == partyId)
return this;
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.begin();
for (; it != m_mapPartyInfoList.end(); ++it)
{
if (it->second->GetPartyID() == partyId)
return it->second;
}
return NULL;
}
SPartyMgr* CPartyListMgr::FindIncludeSlef(std::string* pstrPartyName)
{
std::map<std::string, SPartyMgr*>::iterator it = m_mapPartyInfoList.find(*pstrPartyName);
if(it != m_mapPartyInfoList.end())
return it->second;
if(m_strCommunityName == *pstrPartyName)
return (SPartyMgr*)this;
return NULL;
}
// 해당 이름의 캐릭터가 소속된 파티를 찾는다
SPartyMgr* CPartyListMgr::FindPartyByPlayerName(std::string* pstrPlayerName)
{
if(pstrPlayerName == NULL)
return NULL;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
if( pParty->FindMember(pstrPlayerName->c_str()) )
return pParty;
}
if( FindMember(pstrPlayerName->c_str()) )
return (SPartyMgr*)this;
return NULL;
}
SPartyMgr* CPartyListMgr::FindPartyByPlayerHandle(AR_HANDLE hPlayer)
{
if(hPlayer <= 0)
return NULL;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
if( pParty->FindMemberIndex( hPlayer ) > -1 )
return pParty;
}
if( FindMemberIndex( hPlayer ) > -1 )
return (SPartyMgr*)this;
return NULL;
}
SPlayerSlot* CPartyListMgr::FindMemberByCreature(AR_HANDLE hCreature, std::string& partyName)
{
/// 자기 파티
SPlayerSlot* slot = SMessengerMgr::FindMemberByCreature(hCreature);
if (slot)
{
partyName = GetPartyName();
return slot;
}
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
slot = pParty->FindMemberByCreature(hCreature);
if (slot)
{
partyName = pParty->GetPartyName();
return slot;
}
}
return NULL;
}
SPartyMgr* CPartyListMgr::FindPartyByPartyName(std::string* pstrPartyName)
{
if(pstrPartyName == NULL)
return NULL;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
if(pstrPartyName->compare( pParty->GetPartyName() ) == 0)
return pParty;
}
if(pstrPartyName->compare( GetPartyName() ) == 0)
return (SPartyMgr*)this;
return NULL;
}
SPartyMgr* CPartyListMgr::FindPartyByLeaderName(std::string* pstrLeaderName)
{
if(pstrLeaderName == NULL)
return NULL;
SPlayerSlot* pLeader = SMessengerMgr::GetLeaderInfo();
if(pLeader == NULL)
return NULL;
if(pstrLeaderName->compare( pLeader->GetName() ) == 0)
return this;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
SPlayerSlot* pLeader2 = pParty->GetLeaderInfo();
if(pLeader2 == NULL)
return NULL;
if(pstrLeaderName->compare( pLeader2->GetName() ) == 0)
return pParty;
}
return NULL;
}
int CPartyListMgr::FindPartyID(std::string* pPartyName)
{
if(pPartyName == NULL)
return -1;
if( pPartyName->compare( GetPartyName() ) == 0)
return 0; // 0 번은 내 파티
else
{
size_t nPos = pPartyName->find_first_of("_") + 1;
size_t nEndPos = pPartyName->size();
if(nPos < 2)
return 1;
std::string strNumber = pPartyName->substr(nPos, nEndPos);
int reID = atoi( strNumber.c_str() ) + 2;
// 내 파티의 이름으로 뽑은 아이디보다 크면 1을 빼준다. 아니면 그냥 아이디 리턴
if(m_nMyPartyID <= reID)
return reID - 1;
else
return reID;
}
return -1;
}
// 2011.11.23 - servantes : 리턴형 변경
bool CPartyListMgr::UpdatePartyPosition( STR_LIST& data, std::string* pstrPartyName) ///< sonador 3.12.1 파티원 좌표 갱신 기능 추가
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->UpdatePartyPosition(data);
}
else
{
bool bUpdate = SPartyMgr::UpdatePartyPosition(data);
if(bUpdate == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bUpdate = pParty->UpdatePartyPosition(data);
if(bUpdate)
break ;
}
}
}
return true;
}
bool CPartyListMgr::CreateCommunity( const char* szCommunityName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->CreateCommunity(szCommunityName);
}
else
{
bool bCreate = SMessengerMgr::CreateCommunity(szCommunityName);
if(bCreate == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bCreate = pParty->CreateCommunity(szCommunityName);
if(bCreate)
break ;
}
}
}
return true;
}
bool CPartyListMgr::RefreshMember( STR_LIST& vecText, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->RefreshMember(vecText);
}
else
{
bool bRefresh = SMessengerMgr::RefreshMember(vecText);
if(bRefresh == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bRefresh = pParty->RefreshMember(vecText);
if(bRefresh)
break ;
}
}
}
return true;
}
bool CPartyListMgr::JoinMember( const char* szPlayerName, std::string* pszCommunityName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pszCommunityName == NULL)
return false;
/// 2012.07.10 초대 메세지를 받을 때, m_strCommunityName 이름(파티 이름)을 저장해 놓는데, 아레나 같은 경우에 초대 메세지를 안 받을 경우가 있다.
/// 그런 경우를 대비해서 szPlayerName이 자신일 경우에는 m_strCommunityName을 설정한다.
if (g_pCurrentGameSystem->isLocalPlayerName(szPlayerName))
m_strCommunityName = *pszCommunityName;
/*
SGameAvatarEx* localPlayer = g_pCurrentGameSystem->GetLocalPlayer();
if (::_stricmp(szPlayerName, localPlayer->GetName()) == 0)
m_strCommunityName = *pszCommunityName;
*/
SPartyMgr* pParty = GetParty(pszCommunityName);
if(pParty == NULL)
return false;
if( pParty->JoinMember(szPlayerName, pszCommunityName->c_str()) == false)
return false;
m_bRecvJoinOrLogin = true;
if(pParty->FindMember( szPlayerName ) != NULL)
{
int nMyParty = 4;
if (g_pCurrentGameSystem->isLocalPlayerName(szPlayerName))
nMyParty = -1;
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", pszCommunityName->c_str(), number_t( nMyParty ), number_t( pParty->GetPartyType() ) ) );
}
return true;
}
bool CPartyListMgr::LeaveMember( const char* szPlayerName, std::string* pstrPartyName, char const* leaveType)
{
/// 2011.12.26 유효하지 않은 팝업 메뉴가 될 수 있으므로 hide 시켜 준다 - prodongi
SendGameInterfaceMsg(&SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CHARACTER, false));
SendGameInterfaceMsg(&SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CREATURE, false));
/// 2012.07.19 자기 자신이 파티에서 탈퇴할 때, 파티 이름이 삭제가 되어서, 탈퇴했다는 메세지가 출력될 때,
/// 파티 이름이 나오지 않는다, 그래서 자신이 탈퇴했을 경우에는 파티 이름을 저장해 놓는다.
if (g_pCurrentGameSystem->isLocalPlayerName(szPlayerName))
{
m_oldCommunityName = m_strCommunityName;
}
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->LeaveMember(szPlayerName);
}
else
{
bool bLeave = SMessengerMgr::LeaveMember(szPlayerName);
if(bLeave == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bLeave = pParty->LeaveMember(szPlayerName);
if(bLeave)
break ;
}
}
}
if (leaveType)
{
if (1 == atoi(leaveType))
{
checkValidArenaJoinSituationByLeaveAtArena();
}
}
return true;
}
bool CPartyListMgr::LoginMember( const char* szPlayerName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->LoginMember(szPlayerName);
}
else
{
bool bLogIn = SMessengerMgr::LoginMember(szPlayerName);
if(bLogIn == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bLogIn = pParty->LoginMember(szPlayerName);
if(bLogIn)
break ;
}
}
}
return true;
}
bool CPartyListMgr::LogoutMember( const char* szPlayerName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->LogoutMember(szPlayerName);
}
else
{
bool bOut = SMessengerMgr::LogoutMember(szPlayerName);
if(bOut == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bOut = pParty->LogoutMember(szPlayerName);
if(bOut)
break ;
}
}
}
return true;
}
bool CPartyListMgr::ChangeLeader( const char* szPlayerName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->ChangeLeader(szPlayerName);
}
else
{
bool bChange = SMessengerMgr::ChangeLeader(szPlayerName);
if(bChange == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bChange = pParty->ChangeLeader(szPlayerName);
if(bChange)
break ;
}
}
}
return true;
}
bool CPartyListMgr::AddMember( SPlayerSlot* pSlot, std::string* pstrPartyName )
{
if(pSlot == NULL)
return false;
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->AddMember(pSlot);
}
else
{
bool bAdd = SPartyMgr::AddMember(pSlot);
// lenahyang 12.11.27 - 위험한 코드라 주석 처리
//if(bAdd == false)
//{
// std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
// std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
// for(; itS != itE; itS++)
// {
// SPartyMgr* pParty = itS->second;
// bAdd = pParty->AddMember(pSlot);
// if(bAdd)
// return true;
// }
//}
}
return false;
}
bool CPartyListMgr::AddMember( const char* szName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->AddMember(szName);
}
else
{
bool bAdd = SPartyMgr::AddMember(szName);
// lenahyang 12.11.27 - 위험한 코드라 주석 처리
//if(bAdd == false)
//{
// std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
// std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
// for(; itS != itE; itS++)
// {
// SPartyMgr* pParty = itS->second;
// bAdd = pParty->AddMember(szName);
// if(bAdd)
// break ;
// }
//}
}
return true;
}
bool CPartyListMgr::DeleteMember( const char* szName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return false;
return pParty->DeleteMember(szName);
}
else
{
bool bDelete = SPartyMgr::DeleteMember(szName);
if(bDelete == false)
{
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bDelete = pParty->DeleteMember(szName);
if(bDelete)
break ;
}
}
}
return true;
}
SPlayerSlot* CPartyListMgr::FindMember( AR_HANDLE hPlayer, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->FindMember(hPlayer);
}
else
{
SPlayerSlot* pSlot = SMessengerMgr::FindMember(hPlayer);
if(pSlot)
return pSlot;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
SPlayerSlot* pSlot = pParty->FindMember(hPlayer);
if(pSlot)
return pSlot;
}
}
return NULL;
}
SPlayerSlot* CPartyListMgr::FindMember( const char* szName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->FindMember(szName);
}
else
{
SPlayerSlot* pSlot = SMessengerMgr::FindMember(szName);
if(pSlot)
return pSlot;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
SPlayerSlot* pSlot = pParty->FindMember(szName);
if(pSlot)
return pSlot;
}
}
return NULL;
}
SPlayerSlot* CPartyListMgr::GetLeaderInfo(std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->GetLeaderInfo();
}
else
{
SPlayerSlot* pSlot = SMessengerMgr::GetLeaderInfo();
if(pSlot)
return pSlot;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
SPlayerSlot* pSlot = pParty->GetLeaderInfo();
if(pSlot)
return pSlot;
}
}
return NULL;
}
AR_HANDLE CPartyListMgr::GetMemberHandle( const char* szName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->GetMemberHandle(szName);
}
else
{
AR_HANDLE hHandle = SMessengerMgr::GetMemberHandle(szName);
if(hHandle)
return hHandle;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
hHandle = pParty->GetMemberHandle(szName);
if(hHandle)
return hHandle;
}
}
return NULL;
}
// 2011.11.11 - servantes : 파티 전체에서 캐릭터 이름으로 핸들을 찾는다
AR_HANDLE CPartyListMgr::GetMemberHandleSearchAllParty( const char* szName )
{
AR_HANDLE hHandle = SMessengerMgr::GetMemberHandle(szName);
if(hHandle)
return hHandle;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
hHandle = pParty->GetMemberHandle(szName);
if(hHandle)
return hHandle;
}
return NULL;
}
int CPartyListMgr::GetLoginMemberCount(std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->GetLoginMemberCount();
}
else
{
int nCount = SMessengerMgr::GetLoginMemberCount();
if(nCount)
return nCount;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
int nCount = pParty->GetLoginMemberCount();
if(nCount)
return nCount;
}
}
return 0;
}
bool CPartyListMgr::IsFar( AR_HANDLE hPlayer, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->IsFar(hPlayer);
}
else
{
SPlayerSlot* pMember = SMessengerMgr::FindMember(hPlayer);
if(pMember)
return SMessengerMgr::IsFar(hPlayer);
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
SPlayerSlot* pMember = pParty->FindMember(hPlayer);
if(pMember)
return pParty->IsFar(hPlayer);
}
}
return false;
}
bool CPartyListMgr::IsExistMember( AR_HANDLE hPlayer, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->IsExistMember(hPlayer);
}
else
{
bool bExist = SMessengerMgr::IsExistMember(hPlayer);
if(bExist)
return bExist;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bExist = pParty->IsExistMember(hPlayer);
if(bExist)
return bExist;
}
}
return false;
}
bool CPartyListMgr::IsExistLoginMember(AR_HANDLE hPlayer, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->IsExistLoginMember(hPlayer);
}
else
{
bool bExist = SMessengerMgr::IsExistLoginMember(hPlayer);
if(bExist)
return bExist;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bExist = pParty->IsExistLoginMember(hPlayer);
if(bExist)
return bExist;
}
}
return false;
}
bool CPartyListMgr::IsExistMember( const char* szName, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->IsExistMember(szName);
}
else
{
bool bExist = SMessengerMgr::IsExistMember(szName);
if(bExist)
return bExist;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
bExist = pParty->IsExistMember(szName);
if(bExist)
return bExist;
}
}
return false;
}
int CPartyListMgr::GetMemberIndex( AR_HANDLE hPlayer, std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->GetMemberIndex(hPlayer);
}
else
{
int nIndex = SMessengerMgr::GetMemberIndex(hPlayer);
if(nIndex > -1)
return nIndex;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
nIndex = pParty->GetMemberIndex(hPlayer);
if(nIndex > -1)
return nIndex;
}
}
return -1;
}
int CPartyListMgr::GetLeaderIndex(std::string* pstrPartyName)
{
// 2011.11.23 - servantes : 찾는 순서 변경
if(pstrPartyName)
{
SPartyMgr* pParty = GetParty(pstrPartyName);
if(pParty == NULL)
return NULL;
return pParty->GetLeaderIndex();
}
else
{
int nIndex = SMessengerMgr::GetLeaderIndex();
if(nIndex > -1)
return nIndex;
std::map<std::string, SPartyMgr*>::iterator itE = m_mapPartyInfoList.end();
std::map<std::string, SPartyMgr*>::iterator itS = m_mapPartyInfoList.begin();
for(; itS != itE; itS++)
{
SPartyMgr* pParty = itS->second;
nIndex = pParty->GetLeaderIndex();
if(nIndex > -1)
return nIndex;
}
}
return -1;
}
void CPartyListMgr::createParty(std::string& partyName, std::string& partyLeaderName, int partyType)
{
m_nPartyType = partyType;
m_isArenaParty = (PARTY_ARENA == partyType) ? true : false;
// 파티원 정보 중에 내가 있는지 검사
bool bMyParty=false;
if (g_pCurrentGameSystem->isLocalPlayerName(partyLeaderName.c_str()))
bMyParty = true;
if(bMyParty) // 내가 있다면 내 파티
{
SPartyMgr* pParty = FindIncludeSlef(&partyName);
if(pParty == NULL) // 파티가 만들어지지 않았다면 만든다
{
// 1 : 던전레이드, 2 : 공격대
if(m_nPartyType == PARTY_DUNGEON_RAID || m_nPartyType == PARTY_SIEGE || m_nPartyType == PARTY_ARENA)
{
// 레이드 정보
SRaidInfo* pRaidInfo = new SRaidInfo;
pRaidInfo->SetPartyName(partyName.c_str()); // party_name
pRaidInfo->SetLeaderName(partyLeaderName.c_str()); // leader_name
pRaidInfo->SetParytNum(1); // 지금 만들었으니까 파티원수는 1개.. 아래 CreateCommunity 안에 멤버 셋팅다시 해줌
g_pRaidMgr->pushRaidInfo( pRaidInfo ); // 2011. 12. 21 - marine 파티번호 부여하기 위해 함수로 뺌..
}
SMessengerMgr::CreateCommunity(partyName.c_str(), partyLeaderName.c_str());
}
// 내 파티 이름으로 내 파티 아이디를 찾아 놓는다
size_t nPos = partyName.find_first_of("_") + 1;
size_t nEndPos = partyName.size();
std::string strNumber = partyName.substr(nPos, nEndPos);
m_nMyPartyID = atoi( strNumber.c_str() ) + 2;
// 내 파티를 보이라고 메세지를 보냄
// 명령어 : "show_party_wnd"
// 파티이름 : vecText[2].c_str()
// 내파티 : -1
// 파티타입 : vecText[7].c_str()
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", m_strCommunityName.c_str(), number_t( -1 ), number_t( m_nPartyType ) ) );
}
else // 내가 없다면 다른 파티
{
SPartyMgr* pParty = FindIncludeSlef(&partyName);
if(pParty) // 파티가 있다면 지운다
{
Delete(&partyName);
g_pRaidMgr->DeleteParty(partyName.c_str());
}
if(m_nPartyType == PARTY_DUNGEON_RAID || m_nPartyType == PARTY_SIEGE || m_nPartyType == PARTY_ARENA)
{
// 레이드 정보
SRaidInfo* pRaidInfo = new SRaidInfo;
pRaidInfo->SetPartyName(partyName.c_str()); // party_name
pRaidInfo->SetLeaderName(partyLeaderName.c_str()); // leader_name
pRaidInfo->SetParytNum(1); // 지금 만들었으니까 파티원수는 1개.. 아래 CreateCommunity 안에 멤버 셋팅다시 해줌
g_pRaidMgr->pushRaidInfo( pRaidInfo ); // 2011. 12. 21 - marine 파티번호 부여하기 위해 함수로 뺌..
}
else if(m_nPartyType == PARTY_BEARROAD) // 3 : PARTY_BEARROAD
{
SMessengerMgr::CreateCommunity(partyName.c_str());
}
SPartyMgr* pPartyMgr = new SPartyMgr;
int nPartyType = m_nPartyType;
// 1 : PARTY_DUNGEON_RAID
// 2 : PARTY_SIEGE
if((m_nPartyType == PARTY_DUNGEON_RAID || m_nPartyType == PARTY_SIEGE || m_nPartyType == PARTY_ARENA) && g_pRaidMgr->GetPartyCount())
{
nPartyType = PARTY_SIEGE_OTHER;
pPartyMgr->SetPartyType(nPartyType);
}
else
pPartyMgr->SetPartyType(nPartyType);
pPartyMgr->SetLeaderName (partyLeaderName.c_str());
pPartyMgr->SetLocalPlayerName(partyLeaderName.c_str());
pPartyMgr->CreateCommunity (partyName.c_str());
pPartyMgr->SetGame(m_pGame);
Add(pPartyMgr);
// 남의 파티를 보이라고 메세지를 보냄
// 명령어 : "show_party_wnd"
// 파티이름 : vecText[2].c_str()
// 남의파티 : 0
// 파티타입 : m_nPartyType
SendGameInterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, true ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", partyName.c_str(), number_t( 0 ), number_t( nPartyType ) ) );
}
/// 2012.06.21 - prodongi
if (PARTY_NORMAL == m_nPartyType && bMyParty)
checkValidArenaJoinSituation();
}
void CPartyListMgr::checkValidArenaJoinSituationByLeaveAtArena()
{
sArenaJoinSituationCondition situationCondition;
situationCondition.m_notificationWays = cArenaJoinSituationChecker::WAY_NOTIFICATION_WND;
situationCondition.addNone(S(2436)); /// 일반 파티 중에 아레나 참여
g_pCurrentGameSystem->isValidArenaJoinSituation(situationCondition);
}
//////////////////////////////////////////////////////////////////////////
// SRaidMgr
SRaidMgr::SRaidMgr()
: SGameUIMgr(), m_nMainPartyID(0), m_nMaxGuildPartyNum(0), m_nMaxMercenaryPartyNum(0), nRaidPartyID(0) // 2011.03.29 - servantes
, nRaidPartyPass(0), nMercenaryRaidPartyID(0), nMercenaryRaidPartyPass(0)
{
g_pRaidMgr = this;
m_pRaidInfoList.clear();
}
SRaidMgr::~SRaidMgr()
{
Clear();
}
void SRaidMgr::ResetInfo()
{
Clear();
strPartyManagerName.clear();
strPartyName.clear();
nRaidPartyID = 0;
nRaidPartyPass = 0;
//Mercenary Invite
strMercenaryPartyManagerName.clear();
strMercenaryPartyName.clear();
nMercenaryRaidPartyID = 0;
nMercenaryRaidPartyPass = 0;
}
const char* SRaidMgr::getAttackUnitLeaderName()
{
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
if(m_pRaidInfoList[i]->GetPartyID() == m_nMainPartyID)
{
return m_pRaidInfoList[i]->GetLeaderName();
}
}
return "";
}
const std::string SRaidMgr::getAttackUnitPartyName(int nPartyID)
{
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
if(m_pRaidInfoList[i]->GetPartyID() == nPartyID)
{
return S(12000+i+1);
}
}
return "";
}
// 2011. 12, 15 - marine
// 원래 다른파티가 JOIN 할 때 Raid정보를 RAID_INFO 에서 가져왔는데
// RMINFO에서 오도록 변경되면서 추가된 함수..
void SRaidMgr::setJoinPartyData(STR_LIST &raid_inf )
{
size_t nCount = m_pRaidInfoList.size();
assert(raid_inf.size() == 4 || "str_list size invalid");
if(raid_inf.size() != 4)
return;
std::string strName = raid_inf.at(0);
for(size_t i(0) ; i< nCount ; ++i)
{
std::string strPartyName = m_pRaidInfoList[i]->GetPartyName();
if(strPartyName == strName)
{
m_pRaidInfoList[i]->SetLeaderName( raid_inf[1].c_str() );
m_pRaidInfoList[i]->SetLeaderJob_id( atoi(raid_inf[2].c_str()) );
m_pRaidInfoList[i]->SetLeaderLv(0); // 2011. 12. 15 - marine 쓰레기 값이 들어있는데 혹시 몰라서... 현재 사용은 안하는듯..
break;
}
}
}
void SRaidMgr::setPartyCount( std::string &strPartyName, int nMemberCount )
{
size_t nCount= m_pRaidInfoList.size();
for(size_t i(0) ; i<nCount ; ++i)
{
if( strPartyName.compare(m_pRaidInfoList[i]->GetPartyName()) == 0 )
{
m_pRaidInfoList[i]->SetMemberCount(nMemberCount);
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DUNGEONUNIT_UPDATE() );
break;
}
}
}
// 2011.11.16 - servantes : 이름으로 레이드의 지정된 이름( 제1공대, 제2공대... 로 디비에 저장되어 있는 이름 ) 을 찾는다
const std::string SRaidMgr::getAttackUnitPartyName(const char* pPartyName)
{
if(pPartyName == NULL)
return "";
int nPartyNum = 0;
std::string strPartyName = pPartyName;
size_t nPos = strPartyName.find_first_of("_") + 1;
size_t nEndPos = strPartyName.size();
if(nPos == 0)
nPartyNum = 0;
else
{
std::string strSub = strPartyName.substr(nPos,nEndPos);
nPartyNum = atoi(strSub.c_str())+1;
}
return S(12001 +nPartyNum);
//size_t nCount = m_pRaidInfoList.size();
//for(size_t i(0) ; i< nCount ; ++i)
//{
// if(strcmp(m_pRaidInfoList[i]->GetPartyName(), pPartyName) == 0)
// {
// return S(12000+i+1);
// }
//}
//return "";
}
bool SRaidMgr::isPartyLeaderPlayer(char const* playerName)
{
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
if (::strcmp(m_pRaidInfoList[i]->GetLeaderName(), playerName) == 0)
{
return true;
}
}
return false;
}
void SRaidMgr::Clear()
{
for( unsigned int i(0); m_pRaidInfoList.size()>i; i++ )
delete m_pRaidInfoList[i];
m_pRaidInfoList.clear();
m_nMainPartyID = 0;
m_nMaxGuildPartyNum = 0;
m_nMaxMercenaryPartyNum = 0;
}
int SRaidMgr::AddMessage( const char* szMsg )
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
STR_LIST vecText;
MsgSplit( szMsg, vecText, L"|" );
if( vecText.size() < 1 ) return 0;//false;
if( ::_stricmp( vecText[0].c_str(), "RAID_INFO" ) == 0 ) // RAID_INFO|main_party_id|max_guild_party_num|max_mercenary_party_num|
{ // max_guild_party_num + max_mercenary_party_num 만큼 파티 정보 옴
InfoRaid( vecText ); // party_id|leader_name|leader_job_id|member_count|is_guild_party|
vecText.clear();
return 1;//true;
}
/// 2012.06.08 - prodongi
else if (::_stricmp(vecText[0].c_str(), "LPINFO") == 0)
{
InfoArena(vecText);
vecText.clear();
return 1;
}
else if( ::_stricmp( vecText[0].c_str(), "RAID_GUILD_INVITE" ) == 0 )//RAID_GUILD_INVITE|raid_party_manager_name|raid_party_name|raid_party_id|raid_party_password|: 레이드 길드 파티장 초대 메시지
{
if( vecText.size() < 5 )
{
vecText.clear();
return 0;//false;
}
strPartyManagerName = vecText[1].c_str();
strPartyName = vecText[2].c_str();
nRaidPartyID = atoi(vecText[3].c_str());
nRaidPartyPass = atoi(vecText[4].c_str());
vecText.clear();
return 0;//false;
}
else if( ::_stricmp( vecText[0].c_str(), "RAID_MERCENARY_INVITE" ) == 0 )//RAID_MERCENARY_INVITE|raid_party_manager_name|raid_party_name|raid_party_id|raid_party_password|: 레이드 용병 파티장 초대 메시지
{
if( vecText.size() < 5 )
{
vecText.clear();
return 0;//false;
}
strMercenaryPartyManagerName = vecText[1].c_str();
strMercenaryPartyName = vecText[2].c_str();;
nMercenaryRaidPartyID = atoi(vecText[3].c_str());
nMercenaryRaidPartyPass = atoi(vecText[4].c_str());
vecText.clear();
return 0;//false;
}
else if( ::_stricmp( vecText[0].c_str(), "RAID_CANCEL" ) == 0 ) // 2011. 10. 24 - marine
{
vecText.clear();
ResetInfo();
m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DUNGEONUNIT_UPDATE() );
}
/// 2011.10.18 - prodongi
else if (::_stricmp(vecText[0].c_str(), "RAID_RESULT") == 0)
{
if (vecText[1] == "SUCC")
{
number_t h(atoi(vecText[2].c_str()));
number_t m(atoi(vecText[3].c_str()));
number_t s(atoi(vecText[4].c_str()));
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "RAID_RESULT", vecText[1].c_str(), 0, h, m, s));
}
else
{
number_t zero(0);
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "RAID_RESULT", vecText[1].c_str(), 0, zero, zero, zero));
}
}
else if (::_stricmp(vecText[0].c_str(), "RAID_ENTER") == 0)
{
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "RAID_ENTER", vecText[1].c_str()));
}
else if (::_stricmp(vecText[0].c_str(), "SIEGE_STATUS") == 0)
{
number_t defenseteHp(atoi(vecText[1].c_str()));
number_t offenseHp(atoi(vecText[2].c_str()));
number_t ownerType(atoi(vecText[3].c_str()));
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "SIEGE_STATUS", "", 0, defenseteHp, offenseHp, ownerType));
}
else if (::_stricmp(vecText[0].c_str(), "SIEGE_OPPONENT") == 0)
{
char const* opponentName = (vecText.size() >1) ? vecText[1].c_str() : "";
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "SIEGE_OPPONENT", opponentName));
}
else if (::stricmp(vecText[0].c_str(), "SIEGE_RESULT") == 0)
{
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, "SIEGE_RESULT", szMsg));
}
else if (::_stricmp(vecText[0].c_str(), "RAID_END") == 0 || ::_stricmp(vecText[0].c_str(), "SIEGE_END") == 0)
{
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_RAID_SIEGE_STATUS, vecText[0].c_str()));
}
else if (::_stricmp(vecText[0].c_str(), "ERROR_IN_BATTLE_ARENA") == 0)
{
sArenaJoinSituationCondition situationCondition;
situationCondition.m_notificationWays = cArenaJoinSituationChecker::WAY_NOTIFICATION_WND;
situationCondition.addNone(S(2431));
g_pCurrentGameSystem->isValidArenaJoinSituation(situationCondition);
}
else if (::_stricmp(vecText[0].c_str(), "ERROR_TARGET_IN_BATTLE_ARENA") == 0)
{
g_pCurrentGameSystem->GetGame()->AddChatMessage(S(2432));
}
vecText.clear();
return 0;//false;
}
// 2011.12.13 - servantes : 함수내용이 없어 구현
void SRaidMgr::DeleteParty( const char* lpPartyName )
{
if (lpPartyName == NULL)
return ;
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
if(strcmp(m_pRaidInfoList[i]->GetPartyName(), lpPartyName) != 0)
continue;
SRaidInfo* pRaidInfo = m_pRaidInfoList[i];
if(pRaidInfo)
{
SAFE_DELETE(pRaidInfo);
m_pRaidInfoList.erase( m_pRaidInfoList.begin() + i );
return ;
}
}
}
void SRaidMgr::pushRaidInfo(SRaidInfo* pInfo)
{
if(!pInfo)
return;
// 파티이름으로 파티 번호를 결정하고..
int PartyNumber;
std::string strPartyName = pInfo->GetPartyName();
size_t nPos = strPartyName.find_first_of("_") + 2; // +2를 하는 이유... 공대이름_0x 에서 x의 스트링만 얻기위해서
size_t nEndPos = strPartyName.size() - 1;
if(nPos < 2) // 공대장파티
PartyNumber = 0;
else
{
std::string strNumber = strPartyName.substr(nPos,nEndPos);
PartyNumber = atoi(strNumber.c_str())+1;
}
pInfo->SetParytNum(PartyNumber);
m_pRaidInfoList.push_back(pInfo);
// 파티번호 순으로 소팅
if(m_pRaidInfoList.size() > 1)
std::sort(m_pRaidInfoList.begin(),m_pRaidInfoList.end(),PartyNumCompare());
}
int SRaidMgr::getNumUseAttackUnit(std::string &strPartyName)
{
//공대UI상에서의 순번을 리턴해준다. 0베이스
int partNum = 0;
int curCount = m_pRaidInfoList.size();
for(int i=0 ; i<curCount ; ++i)
{
if(strPartyName.compare(m_pRaidInfoList[i]->GetPartyName()) == 0)
{
partNum = i;
break;
}
}
return partNum;
}
int SRaidMgr::getNumberAtPartyName(std::string partyName)
{
// 이름에서 번호를 뽑아내준다.
// ex) 팔미르공대 -->0, 팔미르공대_00 ->1 .... 팔미르공대_06->7
int PartyNumber;
std::string strPartyName = partyName;
size_t nPos = strPartyName.find_first_of("_") + 2; // +2를 하는 이유... 공대이름_0x 에서 x의 스트링만 얻기위해서
size_t nEndPos = strPartyName.size() - 1;
if(nPos < 2) // 공대장파티
PartyNumber = 0;
else
{
std::string strNumber = strPartyName.substr(nPos,nEndPos);
PartyNumber = atoi(strNumber.c_str())+1;
}
return PartyNumber;
}
void SRaidMgr::InfoRaid( STR_LIST& vecText )
{
// 2011.12.06 - servantes
if( vecText.size() < 6 ) // 처음 공격대 만들었을 경우
{
m_nMainPartyID = atoi( vecText[1].c_str() );
m_nMaxGuildPartyNum = atoi( vecText[2].c_str() );
m_nAimDungeonID = atoi( vecText[3].c_str() ); /// 2012.06.08 4->3으로 바뀜 - prodongi
return;
}
m_nMainPartyID = atoi( vecText[1].c_str() );
m_nMaxGuildPartyNum = atoi( vecText[2].c_str() );
m_nAimDungeonID = atoi( vecText[3].c_str() ); /// 2012.06.08 4->3으로 바뀜 - prodongi
int nIsGuildParty = atoi( vecText[4].c_str()); // is_guild_party, 2012.06.08 파티마다 있는 정보였는데 최 상단으로 옮겨졌다 - prodongi
int nPos = CONST_RAID_INFO_GAP;
int totalCount = CONST_RAID_INFO_GAP;
int textCount = (int)vecText.size();
while (totalCount < textCount)
{
if(g_pPartyListMgr->FindIncludeSlef( &vecText[1 + nPos] ) != NULL)
continue ;
std::string strLeaderName;
// 2011.12.05 - servantes : 파티와 레이드 정보를 설정한다
SPartyMgr* pPartyMgr = new SPartyMgr;
if(pPartyMgr)
{
pPartyMgr->SetPartyID( ::atoi(vecText[0 + nPos].c_str()) );
pPartyMgr->CreateCommunity( vecText[1 + nPos].c_str(), vecText[2 + nPos].c_str() );
pPartyMgr->SetLocalPlayerName( g_pCurrentGameSystem->getLocalPlayerName() );
pPartyMgr->SetGame( m_pGame );
g_pPartyListMgr->Add(pPartyMgr); // 파티 매니저 리스트에 파티 매니저 추가
// 레이드 정보
SRaidInfo* pRaidInfo = new SRaidInfo;
pRaidInfo->SetPartyID ( atoi( vecText[0 + nPos].c_str() ) ); // party_id
pRaidInfo->SetPartyName ( vecText[1 + nPos].c_str() ); // party_name 2011. 10. 18 - marine
pRaidInfo->SetLeaderName ( vecText[2 + nPos].c_str() ); // leader_name
pRaidInfo->SetLeaderLv ( atoi( vecText[3 + nPos].c_str() ) ); // leader_lv
pRaidInfo->SetLeaderJob_id( atoi( vecText[4 + nPos].c_str() ) ); // leader_job_id
pRaidInfo->SetMemberCount ( atoi( vecText[5 + nPos].c_str() ) ); // member_count
pRaidInfo->SetGguildParty( nIsGuildParty > 0 ? true : false );
//PARTY_NORMAL : 0 PARTY_SIEGE_OTHER :4
(nIsGuildParty) ? pPartyMgr->SetPartyType(PARTY_SIEGE_OTHER) : pPartyMgr->SetPartyType(PARTY_NORMAL);
strLeaderName = vecText[2 + nPos].c_str(); // leader_name
int nRaidMemberCount = atoi( vecText[5 + nPos].c_str() );
//m_pRaidInfoList.push_back( pRaidInfo ); // 레이드 정보 리스트에 추가
pushRaidInfo( pRaidInfo ); // 2011. 12. 21 - marine 파티번호 부여하기 위해 함수로 뺌..
// 1 : 공격대
if(nIsGuildParty == 1)
{
std::string strCommunityName = vecText[1 + nPos];
std::string::size_type offset = 0;
offset = strCommunityName.find( "_", offset );
if( std::string::npos == offset )
g_pRaidMgr->setAttackUnitName(strCommunityName.c_str()); // 2011.12.07 - servantes '_'가 없는 공격대 이름만 넣는다
}
nPos += CONST_RAID_INFO_COUNT; // 레이드 정보 개수
totalCount += CONST_RAID_INFO_COUNT;
// 파티원 정보들
for(int x=0; x < nRaidMemberCount; x++)
{
SPlayerSlot* pSlot = pPartyMgr->FindMember( vecText[1 + nPos].c_str() );
if(pSlot == NULL)
{
pSlot = new SPlayerSlot;
pPartyMgr->AddMember( pSlot ); // 새로운 멤버 추가
}
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[0+nPos].c_str(), &strstoper, 10 );
pSlot->SetHandle ( handle );
pSlot->SetName ( vecText[1 + nPos].c_str() );
pSlot->SetJobID ( ::atoi( vecText[2 + nPos].c_str() ) );
if( ::atoi( vecText[3 + nPos].c_str() ) )
{
pSlot->SetHP ( 100 );
pSlot->SetMP ( 100 );
}
else
{
pSlot->SetHP ( 0 );
pSlot->SetMP ( 0 );
}
if(strLeaderName.compare(vecText[1 + nPos].c_str()) == 0) // 리더인지 이름 비교 검사
pSlot->SetLeader(true);
else
pSlot->SetLeader(false);
nPos += CONST_PARTY_MEMBER_INFO_COUNT; // 파티원 정보 개수
totalCount += CONST_PARTY_MEMBER_INFO_COUNT;
}
SDEBUGLOG( "-@파티 정보 출력(레이드)------------------------------------------------------------------------------------------" );
SDEBUGLOG( "[파티 아이디] - [%u]" , pPartyMgr->GetPartyID() );
SDEBUGLOG( "[파티 이름] - [%s]" , pPartyMgr->GetPartyName() );
SDEBUGLOG( "[파티 리더 이름] - [%s]" , pPartyMgr->GetPartyLeaderName() );
SDEBUGLOG( "[파티 멤버 수] - [%u]" , pPartyMgr->GetMemberCount() );
std::vector<SPlayerSlot*> vecTempPartyMemberList = pPartyMgr->GetMemberList();
SDEBUGLOG( "################ 파티 멤버 정보 ######################" );
for( UINT nCount = 0 ; nCount < vecTempPartyMemberList.size(); nCount++ )
{
SPlayerSlot* pMember( vecTempPartyMemberList[nCount] );
{
SDEBUGLOG( "[파티 멤버 카운트] - [%u]", nCount );
SDEBUGLOG( "[파티 멤버 이름] - [%s]", pMember->GetName() );
SDEBUGLOG( "[파티 멤버 핸들] - [%u]", pMember->GetHandle() );
}
}
SDEBUGLOG( "################ 파티 멤버 정보 끝 ######################" );
SDEBUGLOG( "-@파티 정보 출력 끝(레이드)----------------------------------------------------------------------------------------" );
}
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", pPartyMgr->GetPartyName(), number_t( 0 ), number_t( pPartyMgr->GetPartyType() ) ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "refresh_all_ui", pPartyMgr->GetPartyName() ) );
}
}
//-----------------------------------------------------------------------------------------------------------------
// 2012.06.08 InfoRaid함수를 변형함,
// 상당이 안 좋은 함수다!!!!!,
// 하지만 기존 코드를 바꿀 수가 없어서 비슷하게 함 -_- prodongi
//
// 2012.11.19 BattleArena에서 죽는다.. 버그 잡기 위해 코드 수정... 코드 보소 ㅠㅠ... - lenahyang
//-----------------------------------------------------------------------------------------------------------------
void SRaidMgr::InfoArena( STR_LIST& vecText )
{
m_nMainPartyID = atoi( vecText[1].c_str() ); // 리드 파티 아이디
m_nMaxGuildPartyNum = atoi( vecText[2].c_str() ); // 최대 길드 파티 개수
m_arenaType = atoi( vecText[3].c_str() ); // 파티 타입
// 처음 공격대 만들었을 경우 : 누가 이런식으로 코딩하나...
if( vecText.size() < 6 )
return ;
int LPINFO_GAP( 4 );
int LPINFO_PARTY_TOKEN_COUNT( 6 );
int LPINFO_MEMBER_TOKEN_COUNT( 4 );
int nPos( LPINFO_GAP );
int totalCount( LPINFO_GAP );
int textCount( (int)vecText.size() );
while (totalCount < textCount)
{
int nIsGuildParty( 1 ); /// 고정?
int nPartyID( atoi( vecText[0 + nPos].c_str() ) ); // 파티 아이디
std::string strPartyName( vecText[1 + nPos] ); // 파티 이름
std::string strLeaderName( vecText[2 + nPos] ); // 파티 리더 이름
int nLeaderLevel( atoi( vecText[3 + nPos].c_str() ) ); // 파티 리더 레벨
int nLeaderJobID( atoi( vecText[4 + nPos].c_str() ) ); // 파티 리더 직업 ID
int nRaidMemberCount( atoi( vecText[5 + nPos].c_str() ) ); // 파티 맴버 수
if(g_pPartyListMgr->FindIncludeSlef( &strPartyName ) != NULL)
continue ;
SPartyMgr* pPartyMgr( new SPartyMgr );
if( NULL == pPartyMgr )
{
SDEBUGLOG( "[SRaidMgr] Memory Alloc Failed. Critical Error ");
assert( pPartyMgr );
return;
}
// 파티 정보
pPartyMgr->SetPartyID ( nPartyID );
pPartyMgr->CreateCommunity ( strPartyName.c_str(), strLeaderName.c_str() );
pPartyMgr->SetLocalPlayerName ( g_pCurrentGameSystem->getLocalPlayerName() );
pPartyMgr->SetGame( m_pGame );
g_pPartyListMgr->Add( pPartyMgr );
// 레이드 정보
SRaidInfo* pRaidInfo( new SRaidInfo );
if( pRaidInfo )
{
pRaidInfo->SetPartyID ( nPartyID );
pRaidInfo->SetPartyName ( strPartyName.c_str() );
pRaidInfo->SetLeaderName ( strLeaderName.c_str() );
pRaidInfo->SetLeaderLv ( nLeaderLevel );
pRaidInfo->SetLeaderJob_id ( nLeaderJobID );
pRaidInfo->SetMemberCount ( nRaidMemberCount );
pRaidInfo->SetGguildParty ( nIsGuildParty > 0 ? true : false ); // 길드 파티 인가?
}
(nIsGuildParty) ? pPartyMgr->SetPartyType(PARTY_SIEGE_OTHER) : pPartyMgr->SetPartyType(PARTY_NORMAL);
pushRaidInfo( pRaidInfo ); // 2011. 12. 21 - marine 파티번호 부여하기 위해 함수로 뺌..
// 1 : 공격대
if( nIsGuildParty == 1 )
{
std::string strCommunityName = vecText[1 + nPos];
std::string::size_type offset = 0;
offset = strCommunityName.find( "_", offset );
if( std::string::npos == offset )
g_pRaidMgr->setAttackUnitName(strCommunityName.c_str()); // 2011.12.07 - servantes '_'가 없는 공격대 이름만 넣는다
}
nPos += LPINFO_PARTY_TOKEN_COUNT;
totalCount += LPINFO_PARTY_TOKEN_COUNT;
// 파티원 정보들
for(int x=0; x < nRaidMemberCount; x++)
{
std::string strPlayerName( vecText[1 + nPos] );
int nJobID( atoi( vecText[2 + nPos].c_str() ) );
if( g_pCurrentGameSystem->isLocalPlayerName( strPlayerName.c_str() ) )
strPlayerName = g_pCurrentGameSystem->getLocalPlayerName();
SPlayerSlot* pSlot = pPartyMgr->FindMember( strPlayerName.c_str() );
if( pSlot == NULL )
{
pSlot = new SPlayerSlot;
if( NULL == pSlot )
{
SDEBUGLOG( "[SRaidMgr] Memory Alloc Failed. Critical Error ");
assert( pSlot );
continue;
}
else
pPartyMgr->AddMember( pSlot );
}
char* strstoper( NULL );
AR_HANDLE handle( ::strtoul( vecText[0+nPos].c_str(), &strstoper, 10 ) );
pSlot->SetHandle ( handle );
pSlot->SetName ( strPlayerName.c_str() );
pSlot->SetJobID ( nJobID );
if( atoi( vecText[3 + nPos].c_str() ) )
{
pSlot->SetHP ( 100 );
pSlot->SetMP ( 100 );
}
else
{
pSlot->SetHP ( 0 );
pSlot->SetMP ( 0 );
}
if( strLeaderName.compare(vecText[1 + nPos].c_str()) == NULL ) // 리더인지 이름 비교 검사
pSlot->SetLeader(true);
else
pSlot->SetLeader(false);
nPos += LPINFO_MEMBER_TOKEN_COUNT;
totalCount += LPINFO_MEMBER_TOKEN_COUNT;
}
SDEBUGLOG( "-@파티 정보 출력(아레나)------------------------------------------------------------------------------------------" );
SDEBUGLOG( "[파티 아이디] - [%u]" , pPartyMgr->GetPartyID() );
SDEBUGLOG( "[파티 이름] - [%s]" , pPartyMgr->GetPartyName() );
SDEBUGLOG( "[파티 리더 이름] - [%s]" , pPartyMgr->GetPartyLeaderName() );
SDEBUGLOG( "[파티 멤버 수] - [%u]" , pPartyMgr->GetMemberCount() );
std::vector<SPlayerSlot*> vecTempPartyMemberList = pPartyMgr->GetMemberList();
SDEBUGLOG( "################ 파티 멤버 정보 ######################" );
for( UINT nCount = 0 ; nCount < vecTempPartyMemberList.size(); nCount++ )
{
SPlayerSlot* pMember( vecTempPartyMemberList[nCount] );
{
SDEBUGLOG( "[파티 멤버 카운트] - [%u]", nCount );
SDEBUGLOG( "[파티 멤버 이름] - [%s]", pMember->GetName() );
SDEBUGLOG( "[파티 멤버 핸들] - [%u]", pMember->GetHandle() );
}
}
SDEBUGLOG( "################ 파티 멤버 정보 끝 ######################" );
SDEBUGLOG( "-@파티 정보 출력 끝(아레나)----------------------------------------------------------------------------------------" );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_party_wnd", pPartyMgr->GetPartyName(), number_t( 0 ), number_t( pPartyMgr->GetPartyType() ) ) );
SendGameInterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "refresh_all_ui", pPartyMgr->GetPartyName() ) );
}
}
char const* SRaidMgr::getLeaderName(int index)
{
if (0 > index || index >= (int)m_pRaidInfoList.size())
return "";
return m_pRaidInfoList[index]->GetLeaderName();
}
SRaidInfo* SRaidMgr::GetRaidInfo(int index)
{
if (0 > index || index >= (int)m_pRaidInfoList.size())
return NULL;
return m_pRaidInfoList[index];
}
SRaidInfo* SRaidMgr::GetTopRaidInfo()
{
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
std::string strCommunityName = m_pRaidInfoList[i]->GetPartyName();
std::string::size_type offset = 0;
offset = strCommunityName.find( "_", offset );
if( std::string::npos == offset ) // '_'가 없다
{
return m_pRaidInfoList[i];
}
}
return NULL;
}
SRaidInfo* SRaidMgr::GetRaidInfo(const char* pPartyName)
{
if (pPartyName == NULL)
return NULL;
size_t nCount = m_pRaidInfoList.size();
for(size_t i(0) ; i< nCount ; ++i)
{
if(strcmp(m_pRaidInfoList[i]->GetPartyName(), pPartyName) == 0)
{
return m_pRaidInfoList[i];
}
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////
// SGuildMgr
//----------------------------------
// SRaidSiege
//
#include <time.h>
void SRaidSiege::SetInfo( int _nType, int _nTime, std::string & _strGuildName, std::string & _strGuildMaster, int _nGuildCount, int _nGuildDungeon )
{
nType = _nType; strGuildName = _strGuildName; strGuildMaster = _strGuildMaster, nGuildCount = _nGuildCount; nGuildDungeon = _nGuildDungeon;
//if( _nTime == 0 )
//{
// nTime_hour = 0; // 타임어택 시.
// nTime_min = 0; // 분.
// nTime_sec = 0; // 초.
//}
//else
//{
// time_t lTime = _nTime;
// struct tm * _time;
// _time = localtime( &lTime );
// nTime_hour = _time->tm_hour; // 타임어택 시.
// nTime_min = _time->tm_min; // 분.
// nTime_sec = _time->tm_sec; // 초.
//}
if( _nTime == 0 )
{
nTime_hour = 0; // 타임어택 시.
nTime_min = 0; // 분.
nTime_sec = 0; // 초.
}
else
{
int hour(0);
int min(0);
int sec(0);
float f_Time = (float)_nTime * 0.01f;
if( f_Time >= 3600 )
{
hour = f_Time/3600;
f_Time -= 3600*hour;
}
if( f_Time >= 60 )
{
min = f_Time/60;
f_Time = f_Time -= 60*min;
}
sec = f_Time;
nTime_hour = hour; // 타임어택 시.
nTime_min = min; // 분.
nTime_sec = sec; // 초.
}
}
//----------------------------------
int SGuildMgr::m_arrRank[11] = { 0, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 640000, 1280000, -1 };
SGuildMgr::SGuildMgr()
: SMessengerMgr() // 2011.03.29 - servantes
{
Clear();
}
void SGuildMgr::Clear()
{
SMessengerMgr::Clear();
m_nMemberCount = 0; // bintitle. 2010.12.07.
m_strMsg = m_strCommunityName;
// bintitle. 2010.04.20
// 연합길드정보 제거.
ClearAlliance();
// 길드 권한등급 비트플래그(권한세트).
for( int i=0; i<E_AUTHORITY::AUTHORITY_MAX; i++ )
m_arrAuthorityClass[ i ] = 0;
// 길드등급명.
m_arrAuthorityClassName.resize( E_AUTHORITY::AUTHORITY_MAX );
}
// 연합길드정보 제거.
void SGuildMgr::ClearAlliance()
{
int size = m_arrAllianceGuild.size();
for( int i=0; i<size; ++i )
SAFE_DELETE( m_arrAllianceGuild[ i ] );
m_arrAllianceGuild.clear();
}
// 수정. 2010.06.10 bintitle.
// 권한등급 추가.
bool SGuildMgr::RefreshMember( STR_LIST& vecText )
{
size_t nTextSize = vecText.size();
if( nTextSize < 13 )
return false;
// MINFO|AR_HANDLE|이름|레벨|직업CODE|권한등급|HP%|MP%|X|Y|온/오프라인|
char * strstoper;
AR_HANDLE nHandle = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
m_bParsing = true;
if( !IsExistMember( vecText[2].c_str() ) )
{
SPlayerSlot* pSlot = new SPlayerSlot;
pSlot->SetHandle( nHandle );
pSlot->SetName( vecText[2].c_str() );
pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
pSlot->SetAuthority( ::atoi( vecText[5].c_str() ) ); // 권한등급.
pSlot->SetHP( ::atoi( vecText[6].c_str() ) );
pSlot->SetMP( ::atoi( vecText[7].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[8].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[9].c_str() ) );
pSlot->SetLogin( ::atoi( vecText[10].c_str() ) );
pSlot->SetPoint( ::atoi( vecText[11].c_str() ) );
pSlot->SetTotalPoint( ::atoi( vecText[12].c_str() ) );
//if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
m_vecMemberList.push_back(pSlot);
}
else
{
SPlayerSlot* pSlot = FindMember( vecText[2].c_str() );
if( pSlot == NULL )
return false;
pSlot->SetHandle( nHandle );
pSlot->SetLevel( ::atoi( vecText[3].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[4].c_str() ) );
pSlot->SetAuthority( ::atoi( vecText[5].c_str() ) ); // 권한등급.
pSlot->SetHP( ::atoi( vecText[6].c_str() ) );
pSlot->SetMP( ::atoi( vecText[7].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[8].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[9].c_str() ) );
pSlot->SetLogin( ::atoi( vecText[10].c_str() ) );
pSlot->SetPoint( ::atoi( vecText[11].c_str() ) );
pSlot->SetTotalPoint( ::atoi( vecText[12].c_str() ) );
//if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
pSlot->SetNear( !(IsFar(pSlot->GetHandle())) );
}
return true;
}
const int SGuildMgr::GetLoginMemberCount()
{
int nCount = 0;
std::vector<SPlayerSlot*>::iterator it = m_vecMemberList.begin();
while( it != m_vecMemberList.end() )
{
SPlayerSlot* pSlot = (*it);
if( pSlot->IsLogin() || pSlot->IsDenial() ) nCount++;
it++;
}
return nCount;
}
void SGuildMgr::ResetInfo()
{
m_strMsg.clear();
m_strCommunityName.clear();
SMessengerMgr::Clear();
///////////////////////////
// bintitle. 2010.05.24
// 연합길드정보 제거.
ClearAlliance();
// 길드 권한등급 비트플래그(권한세트).
for( int i=0; i<E_AUTHORITY::AUTHORITY_MAX; i++ )
m_arrAuthorityClass[ i ] = 0;
// 길드등급명.
m_arrAuthorityClassName.clear();
m_arrAuthorityClassName.resize( E_AUTHORITY::AUTHORITY_MAX );
m_nMemberCount = 0; // 길드 맴버 수.
m_strNotice = ""; // 길드공지
m_bRecruitment = false; // 길드원 모집 여부.
m_nDungeonID = 0; // 소유던전ID
m_URL = ""; // 길드 URL
m_RaidSiege.Reset(); // 던전 레이드/시즈 관련정보.
}
void SGuildMgr::GetMemberHandle( std::vector<AR_HANDLE>& vMemberlist )
{
for( unsigned int i(0); m_vecMemberList.size()>i; i++ )
{
vMemberlist.push_back( m_vecMemberList[i]->GetHandle() );
}
}
// 길드 던전 레이드/시즈 관련 정보설정.
void SGuildMgr::SetRaidInfo( STR_LIST& vecRaid )
{
m_RaidSiege.Reset();
m_RaidSiege.SetInfo( ::atoi( vecRaid[ 1 ].c_str() ), ::atoi( vecRaid[ 2 ].c_str() ), vecRaid[ 3 ], vecRaid[ 4 ], ::atoi( vecRaid[ 5 ].c_str() ), ::atoi( vecRaid[ 6 ].c_str() ) );
}
// 길드원 이름으로 길드원 얻기.
SPlayerSlot * SGuildMgr::GetPlayerByName( const char * strName )
{
for( std::vector< SPlayerSlot * >::iterator it=m_vecMemberList.begin(); it!=m_vecMemberList.end(); ++it )
{
if( !::_stricmp( (*it)->GetName(), strName ) )
{
return (*it);
}
}
return NULL;
}
// 수정 2010.04.14 bintitle.
// token 변경. 길드 관련 추가( MEMO, AINFO )
//int SGuildMgr::AddMessage( const char* szMsg, int& nNewGuilID )
int SGuildMgr::AddMessage( const char* szMsg, int& nNewGuilID, bool & bSelf ) // 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
STR_LIST vecText;
MsgSplit_Ex( szMsg, vecText, L"|" );
size_t nTextSize = vecText.size();
if( nTextSize < 1 ) return 0;//false;
const char * pStrToken = vecText[0].c_str();
if( ::_stricmp( pStrToken, "CHANGE_PERMISSION_NAME" ) == 0 ) // 권한이름. CHANGE_PERMISSION_NAME|권한번호|변경 후 권한이름
{
SetAuthorityClassName( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_NAME;
}
else if( ::_stricmp( pStrToken, "INVITE" ) == 0 ) // INVITE|파티장이름|[파튀,길드]이름|파티ID|파티PW|
{
if( nTextSize < 5 )
{
vecText.clear();
return 0;//false;
}
m_strMsg = vecText[1];
m_strCommunityName = vecText[2];
m_nCommunityID = ::atoi( vecText[3].c_str() );
m_nCommunityPassword = ::atoi( vecText[4].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_INVITE;
}
else if( ::_stricmp( pStrToken, "KICK" ) == 0 ) // KICK|[파튀,길드]이름|캐릭이름
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
LeaveMember( vecText[2].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_KICK;
}
else if( ::_stricmp( pStrToken, "LOGIN" ) == 0 ) // LOGIN|[파튀,길드]이름|캐릭이름
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
LoginMember( vecText[2].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_LOGIN;
}
else if( ::_stricmp( pStrToken, "CHANGE_NAME" ) == 0 ) //CHANGE_NAME|old_name|new_name|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
#ifdef _DEBUG
const char * pOldName = vecText[1].c_str();
const char * pNewName = vecText[2].c_str();
#endif
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetName( vecText[2].c_str() );
pPlayerSlot->GetHandle();
//지역 방송 되므로 따로 이름 바꿀 필요 없음
}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_NAME;
}
else if( ::_stricmp( pStrToken, "CHANGE_GUILD_NAME" ) == 0 ) //CHANGE_GUILD_NAME|guild_id|guild_name|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
//길드 아이콘 메니저에서도 한번 더 처리
int nGuilID = atoi( vecText[1].c_str() );
if( m_nCommunityID == nGuilID )
{ //내 길드 이면, 이름 변경
m_strCommunityName = vecText[2];
m_strGuildName = vecText[2];
}
//UI 길드 이름 변경
SIMSG_UI_CHANGE_GUILD_NAME msg;
msg.m_nGuildID = nGuilID;
msg.m_strNewGuildName = vecText[2];
SendGameInterfaceMsg( &msg );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_GUILD_NAME;
}
else if( ::_stricmp( pStrToken, "CHANGE_LEVEL" ) == 0 ) //CHANGE_NAME|캐릭터이름|레벨|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetLevel( ::atoi( vecText[2].c_str() ) );
}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_LEVEL;
}
else if( ::_stricmp( pStrToken, "CHANGE_JOB" ) == 0 ) //CHANGE_NAME|캐릭터이름|직업|
{
if( nTextSize < 3 )
{
vecText.clear();
return 0;//false;
}
SPlayerSlot * pPlayerSlot = FindMember( vecText[1].c_str() );
if( pPlayerSlot )
{
pPlayerSlot->SetJobID( ::atoi( vecText[2].c_str() ) );
}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_JOB;
}
else if( ::_stricmp( pStrToken, "CREATE" ) == 0 ) // CREATE|[파튀,길드]이름|파튀장
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
CreateCommunity( vecText[1].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CREATE;
}
else if( ::_stricmp( pStrToken, "JOIN" ) == 0 ) // JOIN|[파튀,길드]이름| // 새 멤버(=자기자신)에게
{
int k=0;
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
JoinMember( m_strLocalPlayerName.c_str(), vecText[1].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_JOIN;
}
else if( ::_stricmp( pStrToken, "NEW" ) == 0 ) // NEW|캐릭이름| // 기존 멤버에게만
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
JoinMember( vecText[1].c_str(), m_strCommunityName.c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_NEW;
}
else if( ::_stricmp( pStrToken, "LEAVE" ) == 0 ) // LEAVE|캐릭이름
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
SPlayerSlot* pPlayerSlot = FindMember( vecText[1].c_str() );
//캐릭터 창 길드 정보 숨긴다.
if( pPlayerSlot )
{
SendGameInterfaceMsg( &SIMSG_UI_GUILDICON_LEAVE(pPlayerSlot->GetHandle()) );
}
LeaveMember( vecText[1].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_LEAVE;
}
else if( ::_stricmp( pStrToken, "LOGOUT" ) == 0 ) // LOGOUT|캐릭이름
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
LogoutMember( vecText[1].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_LOGOUT;
}
else if( ::_stricmp( pStrToken, "PROMOTE" ) == 0 ) // PROMOTE|캐릭이름 // 파티장 변경
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
// "PROMOTE|파티ID|캐릭이름" 으로 변경됨
ChangeLeader( vecText[2].c_str() );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_PROMOTE;
}
else if( ::_stricmp( pStrToken, "GINFO" ) == 0 ) // GINFO , 길드SID, 길드명, 길마이름, 멤버수, 길드공지, 멤버모집 중 여부, 소유던전ID
{
if( nTextSize < 2 )
{
vecText.clear();
return 0;//false;
}
nNewGuilID = atoi( vecText[1].c_str() );
InfoMember( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_GINFO;
}
else if( ::_stricmp( pStrToken, "MINFO" ) == 0 ) // MINFO|AR_HANDLE|이름|레벨|직업CODE|권한등급|HP%|MP%|X|Y|온/오프라인|
{
RefreshMember( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_MINFO;
}
else if( ::_stricmp( pStrToken, "DESTROY" ) == 0 ) // DESTROY|[파티,길드]이름
{
SIMSG_UI_GUILDICON_REFRESH msg;
msg.nGuild_id = m_nCommunityID;
msg.strGuildName = "#@DELETEGUILD@#";
msg.strIconAniName = "#@DELETEGUILD@#";
GetMemberHandle( msg.vHandleList );
SendGameInterfaceMsg( &msg );
Clear();
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_DESTROY;
}
else if( ::_stricmp( pStrToken, "GMEMBER" ) == 0 ) // GMEMBER|AR_HANDLE|이름|레벨|직업CODE|권한등급|HP%|MP%|X|Y|온/오프라인|
{
AddMember( vecText, bSelf );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_GMEMBER;
}
else if( ::_stricmp( pStrToken, "LIST" ) == 0 ) // LIST|캐릭이름|분배방|최고렙|최저
{
ChangeGuildInfo( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_LIST;
}
else if( ::_stricmp( pStrToken, "MEMO" ) == 0 ) // MEMO|유저명|메모 내용
{
SetMemo( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_MEMO;
}
else if( ::_stricmp( pStrToken, "AINFO" ) == 0 ) // 연합길드 정보.
// AINFO|연합SID|연합명|멤버수|연합장길드SID| <= 기본으로 들어오는 토큰.
// 이후 연합길드 수 만큼 4개 단위 [ 길드SID|길드명|길마이름|맴버수 ] 토큰이 뒤에 붙어 온다.
{
SetAllianceGuild( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_AINFO;
}
else if( ::_stricmp( pStrToken, "CHANGE_PERMISSION" ) == 0 ) // 권한등급변경. 캐릭터명|권한등급
{
ChangeAuthorityClass( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION;
}
else if( ::_stricmp( pStrToken, "CHANGE_PERMISSION_SET" ) == 0 )// 권한등급비트플래그(권한세트) 변경. 권한등급|권한_비트셋
{
ChangeAuthorityClassBitSet( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_SET;
}
else if( ::_stricmp( pStrToken, "GPERMISSION" ) == 0 ) // 권한등급 권한이름1|권한셋1|권한이름2|권한셋2|권한이름3|권한셋3|권한이름4|권한셋4|권한이름5|권한셋5|권한이름6|권한셋6
{
SetAuthorityClass( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_GPERMISSION;
}
else if( ::_stricmp( pStrToken, "NOTICE" ) == 0 ) // 길드공지 NOTICE|공지내용
{
SetNotice( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_NOTICE;
}
else if( ::_stricmp( pStrToken, "URL" ) == 0 ) // 길드 URL. URL|%s
{
if( vecText.size() >= 2 )
{
SetURL( vecText[ 1 ] );
}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_URL;
}
else if( ::_stricmp( pStrToken, "GBUFF" ) == 0 ||
::_stricmp( pStrToken, "GDONATE" ) == 0 ||
::_stricmp( pStrToken, "GUPGRADE" ) == 0 )
{
SetGuildMemberPoint( vecText );
SetGradePoint( vecText );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_DONATION;
}
else if( ::_stricmp( pStrToken, "GRAIDSIEGETIP" ) == 0 ) // 길드 던전 레이드/시즈. GRAIDSIEGETIP %d %d %s %s %d %d
// GRAIDSIEGETIP | 정보 타입 | 타임 레코드 | 길드 이름 | 길마 이름 | 길드원 수 | 던전 ID
{
if( vecText.size() >= 7 )
{
SetRaidInfo( vecText ); // 길드 던전 레이드/시즈 관련 정보설정.
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//this->ProcMsgAtStatic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MANAGE, "GUILD_RAID" ) );
this->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MANAGE, "GUILD_RAID" ) );
}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_GRAIDSIEGETIP;
}
else if( ::_stricmp( pStrToken, "ERROR_PERMISSION" ) == 0 ) // 길드원 추방시 추방대상이 등급이 높은경우.
// ERROR_PERMISSION
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//ProcMsgAtStatic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MANAGE_EXPULSION, "ERROR_PERMISSION" ) );
ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MANAGE_EXPULSION, "ERROR_PERMISSION" ) );
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_ERROR_PERMISSION;
}
else if( ::_stricmp( pStrToken, "ERROR_NOT_EXIST" ) == 0 ) // 길드원 초대시 없는 캐릭터 인경우.
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1920 ) ) ); // stringDB 필요.
ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1920 ) ) ); // stringDB 필요.
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_ERROR_NOT_EXIST;
}
//else if( ::_stricmp( pStrToken, "ASSIST" ) == 0 ) // ASSIST|handle|
//{
// char * strstoper;
// AR_HANDLE hassist = ::strtoul( vecText[1].c_str(), &strstoper, 10 );
// if( m_pGame ) m_pGame->AssistTarget( hassist );
// return true;
//}
vecText.clear();
return GUILD_UPDATE::GUILD_UPDATE_NONE;
}
void SGuildMgr::InfoMember( STR_LIST& vecText )
{
// GINFO , 길드SID, 길드명, 길마이름, 멤버수, 길드공지, 멤버모집 중 여부, 소유던전ID
m_bParsing = true;
m_bIsExist = true;
size_t nTextSize = vecText.size();
if( nTextSize >= 10 )
{
m_nCommunityID = atoi( vecText[1].c_str() ); // 길드 ID
m_strCommunityName = vecText[2]; // 길드명
m_strLeaderName = vecText[3]; // 길마명
m_strGuildName = m_strCommunityName;
m_strGulidLeaderName = m_strLeaderName;
m_nMemberCount = ::atoi( vecText[4].c_str() ); // 맴버수
m_strNotice = vecText[5]; // 길드공지
m_bRecruitment = ::atoi( vecText[6].c_str() ); // 길드원 모집 여부.
m_nDungeonID = ::atoi( vecText[7].c_str() ); // 소유던전ID
m_URL = vecText[8]; // URL
XStringUtil::Replace( m_URL, "http://", "" );
m_nGrade = ::atoi( vecText[9].c_str() );
m_nPoint = ::atoi( vecText[10].c_str() );
}
}
//
//void SGuildMgr::InfoMember( STR_LIST& vecText )
//{
// // GINFO|길드ID|길드이름|장이름||전투대장이름|최고렙|최저렙|AR_HANDLE|이름|레벨|직업CODE|HP%|MP%|X|Y|소환수플래그|
// m_bParsing = true;
// m_bIsExist = true;
//
// size_t nTextSize = vecText.size();
// if( nTextSize > 5 )
// {
// m_nCommunityID = atoi( vecText[1].c_str() );
//
// m_strCommunityName = vecText[2];
// m_strLeaderName = vecText[3];
//
// // sonador 3.5.1 던전 시즈 레벨 제한
// std::string& strBattleCommanderName = vecText[ 4 ];
// strBattleCommanderName.erase( std::remove( strBattleCommanderName.begin(), strBattleCommanderName.end(), ' ' ), strBattleCommanderName.end() );
//
// m_strGuildName = m_strCommunityName;
// m_strBattleCommanderName = strBattleCommanderName;
// m_strGulidLeaderName = m_strLeaderName;
//
// m_nMaxLevel = ::atoi( vecText[4].c_str() );
// m_nMinLevel = ::atoi( vecText[5].c_str() );
//
// //기존 멤버 리스트 초기화
// Free();
// }
///*
// int nLine = static_cast<int>(vecText.size()) - 6;
// int nCount = nLine / 9;
//
// int nPos = 0;
// for( int i = 0; i < nCount; i++ )
// {
// if( i > 0 ) nPos = (9*i);
// if( !IsExistMember(vecText[7+nPos].c_str()) )
// {
// SPlayerSlot* pSlot = new SPlayerSlot;
//
// char * strstoper;
// AR_HANDLE handle = ::strtoul( vecText[6+nPos].c_str(), &strstoper, 10 );
// pSlot->SetHandle( handle );
//
// pSlot->SetName( vecText[7+nPos].c_str() );
// pSlot->SetLevel( ::atoi( vecText[8+nPos].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[9+nPos].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[10+nPos].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[11+nPos].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[12+nPos].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[13+nPos].c_str() ) );
// pSlot->SetCreature( ::atoi( vecText[14+nPos].c_str() ), 0 );
//
// if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
// pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
//
// m_vecMemberList.push_back(pSlot);
//
// //Test Code
// //for( int t(0); 20>t; ++t )
// //{
// // SPlayerSlot* pSlot1 = new SPlayerSlot;
// // pSlot1->SetName( CStringUtil::StringFormat("TEST_%d",t).c_str() );
//
// // pSlot1->SetLevel( pSlot->GetLevel() );
// // pSlot1->SetJobID( pSlot->GetJobID() );
//
// // m_vecMemberList.push_back(pSlot1);
// //}
// }
// else
// {
// SPlayerSlot* pSlot = FindMember( vecText[7+nPos].c_str() );
// if( pSlot == NULL ) continue;
//
// char * strstoper;
// AR_HANDLE handle = ::strtoul( vecText[6+nPos].c_str(), &strstoper, 10 );
// pSlot->SetHandle( handle );
//
// pSlot->SetName( vecText[7+nPos].c_str() );
// pSlot->SetLevel( ::atoi( vecText[8+nPos].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[9+nPos].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[10+nPos].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[11+nPos].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[12+nPos].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[13+nPos].c_str() ) );
// pSlot->SetCreature( ::atoi( vecText[14+nPos].c_str() ), 0 );
//
// if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
// pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
// }
// }
//
//#ifdef _DEBUG
// unsigned int nMemBerCount = (unsigned int)m_vecMemberList.size();
//#endif
//
// if( static_cast<int>(m_vecMemberList.size()) == 1 )
// m_nMinLevel = m_nMaxLevel;
//*/
//}
// 연합정보. 2010.04.14 bintitle
void SGuildMgr::SetAllianceInfo( int nAllianceID, std::string & strAllianceName, int nAllianceMemberCount, int nAllianceMasterGuildSID, std::string & strAllianceLeaderName )
{
m_arrAllianceGuild[ 0 ]->SetAllianceGuild( nAllianceID, strAllianceName, nAllianceMemberCount, nAllianceMasterGuildSID, strAllianceLeaderName );
}
// 연합길드정보 설정. 2010.04.14 bintitle
void SGuildMgr::SetAllianceGuild( STR_LIST & vecText )
{
// AINFO|연합SID|연합명|멤버수|연합장길드SID| 길드SID|길드명|길마이름|맴버수| 길드SID|길드명|길마이름|맴버수| ...
int vSize = vecText.size();
// 연합정보(5) + 길드1정보(4) 는 최소한의 조건.
if( vSize < 9 )
return;
// 연합길드정보 제거. bintitle. 2010.11.02
ClearAlliance();
const int nGuildUnit = 4; // 개별 길드 토큰 단위.
//
// 연합정보.
//
const int nAID = 1;
const int nAName = 2;
const int nAMemberCnt = 3;
const int nAGuildID = 4;
int nAllianceID = ::atoi( vecText[ nAID ].c_str() ); // 연합SID
std::string strAllianceName = vecText[ nAName ]; // 연합명
int nAllianceMemberCount = 0; //::atoi( vecText[ nAMemberCnt ].c_str() ); // 연합길드 맴버수.
int nAllianceMasterGuildSID = ::atoi( vecText[ nAGuildID ].c_str() );// 연합장 길드 SID
std::string strAllianceLeaderName; // 연합길드장명.
//
// 개별 길드정보.
//
int nTokenIndex = nAGuildID + 1;
int allianceCount = ( vSize - nTokenIndex ) / nGuildUnit; // 연합길드 수.
for( int i=0; i<allianceCount; i++ )
{
int gID = ::atoi( vecText[ nTokenIndex ].c_str() );
int memberCount = ::atoi( vecText[ nTokenIndex + 3 ].c_str() );
m_arrAllianceGuild.push_back( new SAllianceGuild( gID,
vecText[ nTokenIndex + 1 ],
vecText[ nTokenIndex + 2 ],
memberCount )
);
nAllianceMemberCount += memberCount;
if( nAllianceMasterGuildSID == gID )
strAllianceLeaderName = vecText[ nTokenIndex + 2 ];
nTokenIndex += 4;
/*int gID = ::atoi( vecText[ nTokenIndex ].c_str() );
int gLeader = nTokenIndex + 2;
m_arrAllianceGuild.push_back( new SAllianceGuild( gID,
vecText[ ++nTokenIndex ],
vecText[ ++nTokenIndex ],
::atoi( vecText[ ++nTokenIndex ].c_str() ) )
);
nAllianceMemberCount += ::atoi( vecText[ nTokenIndex ].c_str() );
if( nAllianceMasterGuildSID == gID )
strAllianceLeaderName = vecText[ gLeader ];
++nTokenIndex;*/
}
// 연합정보.
SetAllianceInfo( nAllianceID, strAllianceName, nAllianceMemberCount, nAllianceMasterGuildSID, strAllianceLeaderName );
}
// 길드공지.
void SGuildMgr::SetNotice( STR_LIST & vecText )
{
int size = vecText.size();
if( size > 1 )
{
m_strNotice = vecText[ 1 ];
}
}
// 길드원 메모. 2010.04.14 bintitle
void SGuildMgr::SetMemo( STR_LIST& vecText )
{
/// 2012.07.20 메모가 있으면 서버로 부터 받은 메모가 있으면 설정하고 없으면 ""를 할려는 코드 같은데
/// 코드가 이상해서 수정함;; - prodongi
int size = vecText.size();
if (size < 2)
return ;
SPlayerSlot* pSlot = FindMember( vecText[1].c_str() );
if (!pSlot)
return ;
if (size >= 3)
{
pSlot->SetGuildMemo( vecText[2] );
}
else
{
pSlot->SetGuildMemo(std::string(""));
}
/*
int size = vecText.size();
if( size > 3 )
{
const int nName = 1;
const int nMemo = 2;
SPlayerSlot* pSlot = FindMember( vecText[ nName ].c_str() );
pSlot->SetGuildMemo( std::string("") );
if( pSlot )
{
pSlot->SetGuildMemo( vecText[ nMemo ] );
}
}
*/
}
// 권한등급변경. 2010.04.14 bintitle
void SGuildMgr::ChangeAuthorityClass( STR_LIST & vecText )
{
/*const int nName = 1;
const int nAuthorityClass = 2;
SPlayerSlot* pSlot = FindMember( vecText[ nName ].c_str() );
if( pSlot )
{
pSlot->SetAuthority( ::atoi( vecText[ nAuthorityClass ].c_str() ) );
}*/
const int nName = 1;
const int nAuthorityClass = 2;
SPlayerSlot* pSlot = FindMember( vecText[ nName ].c_str() );
if( pSlot )
{
pSlot->SetAuthority( ::atoi( vecText[ nAuthorityClass ].c_str() ) );
}
}
// 권한등급비트플래그(권한세트) 변경. 2010.04.14 bintitle
void SGuildMgr::ChangeAuthorityClassBitSet( STR_LIST & vecText )
{
if( vecText.size() < 3 )
return;
/*ChangeAuthorityClassBitSet( ( E_AUTHORITY )( ::atoi( vecText[ 1 ].c_str() - 1 ) ),
::atoi( vecText[ 2 ].c_str() ) ); */
int nClass = ::atoi( vecText[ 1 ].c_str() ) - 1;
int bitSet = ::atoi( vecText[ 2 ].c_str() );
//#ifdef _DEV
// // TEST. 권한설정 권한.
// bitSet |= _PERMIT_REQUIRED_ACTION::PRA_CLASS_AUTHORITY_SET;
//#endif
m_arrAuthorityClass[ nClass ] = bitSet;
}
// 권한등급 설정.
void SGuildMgr::SetAuthorityClass( STR_LIST & vecText )
{
// 권한이름1|권한셋1|권한이름2|권한셋2|권한이름3|권한셋3|권한이름4|권한셋4|권한이름5|권한셋5|권한이름6|권한셋6
if( vecText.size() > 13 )
{
int i = 1;
int size = E_AUTHORITY::AUTHORITY_MAX - 1;
for( int nIndex=0; nIndex<size; nIndex++, i+=2 )
{
m_arrAuthorityClassName[ nIndex ] = vecText[ i ];
m_arrAuthorityClass[ nIndex ] = ::atoi( vecText[ i+1 ].c_str() );
//#ifdef _DEV
// // TEST. 권한설정 권한.
// m_arrAuthorityClass[ nIndex ] |= _PERMIT_REQUIRED_ACTION::PRA_CLASS_AUTHORITY_SET;
//#endif
}
//std::vector< std::string > tempArrClassName;
//int i = 1;
//int size = E_AUTHORITY::AUTHORITY_MAX - 1;
//for( int nIndex=0; nIndex<size; nIndex++, i+=2 )
//{
// tempArrClassName.push_back( vecText[ i ] );
// m_arrAuthorityClass[ nIndex ] = ::atoi( vecText[ i+1 ].c_str() );
//}
//// 권한과 권한이름의 순서가 반대. 뒤집어준다.
//m_arrAuthorityClassName.clear();
//int rI = size - 1;
//for( int nIndex=0; nIndex<size; nIndex++, rI-- )
//{
// m_arrAuthorityClassName.push_back( tempArrClassName[ rI ] );
//}
}
}
// 길드 URL.
void SGuildMgr::SetURL( std::string & strURL )
{
if( strURL == "" || strURL.size() < 1 )
m_URL = "http://";
else
m_URL = strURL;
}
// 권한등급명 설정.
void SGuildMgr::SetAuthorityClassName( STR_LIST & vecText )
{
// 권한번호|변경 후 권한명
if( vecText.size() > 2 )
{
int nClass = ::atoi( vecText[ 1 ].c_str() );
std::string str = vecText[ 2 ];
ChangeAuthorityClassNameBitSet( --nClass, str ); // 권한비트셋 등급해당명 변경.
}
}
void SGuildMgr::SetGradePoint( STR_LIST & vecText )
{
if( vecText.size() > 5 )
{
int nGrade = ::atoi( vecText[ 1 ].c_str() );
int nPoint = ::atoi( vecText[ 2 ].c_str() );
m_nGrade = nGrade;
m_nPoint = nPoint;
}
}
void SGuildMgr::SetGuildMemberPoint( STR_LIST & vecText )
{
if( vecText.size() > 5 )
{
SPlayerSlot* pSlot = FindMember( vecText[ 3 ].c_str() );
if (pSlot == NULL) return;
int point = ::atoi( vecText[ 4 ].c_str() );
int total_point = ::atoi( vecText[ 5 ].c_str() );
pSlot->SetPoint( point );
pSlot->SetTotalPoint( total_point );
}
}
//
// 권한등급 추가. 2010.04.13 bintitle
// bool & bSelf 추가. 2010.11.29. bintitle. 해당 메세지가 자신에게만 해당되는 지 여부반환.
//
void SGuildMgr::AddMember( STR_LIST& vecText, bool & bSelf )
{
if( vecText.size() < 13 ) return;
static char c_nHandlePos = 1;
static char c_nNamePos = 2;
static char c_nLevelPos = 3;
static char c_nJobPos = 4;
static char c_nAuthority = 5; // 추가 - 권한등급
static char c_nHPPos = 6;
static char c_nMPPos = 7;
static char c_nXPos = 8;
static char c_nYPos = 9;
static char c_nLogin = 10;
static char c_nPointPos = 11;
static char c_nTotalPointPos = 12;
char * strstoper;
AR_HANDLE handle = ::strtoul( vecText[c_nHandlePos].c_str(), &strstoper, 10 );
if( IsExistMember( vecText[c_nNamePos].c_str() ) == false )
{
SPlayerSlot* pSlot = new SPlayerSlot;
pSlot->SetHandle( handle );
pSlot->SetName( vecText[c_nNamePos].c_str() );
pSlot->SetLevel( ::atoi( vecText[c_nLevelPos].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[c_nJobPos].c_str() ) );
pSlot->SetAuthority( ::atoi( vecText[ c_nAuthority ].c_str() ) ); // 권한등급
pSlot->SetHP( ::atoi( vecText[c_nHPPos].c_str() ) );
pSlot->SetMP( ::atoi( vecText[c_nMPPos].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[c_nXPos].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[c_nYPos].c_str() ) );
pSlot->SetLogin( ::atoi( vecText[c_nLogin].c_str() ) );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
pSlot->SetPoint( ::atoi( vecText[c_nPointPos].c_str() ) );
pSlot->SetTotalPoint( ::atoi( vecText[c_nTotalPointPos].c_str() ) );
m_vecMemberList.push_back(pSlot);
}
else
{
SPlayerSlot* pSlot = FindMember( vecText[c_nNamePos].c_str() );
if( pSlot == NULL ) return;
pSlot->SetHandle( handle );
pSlot->SetName( vecText[c_nNamePos].c_str() );
pSlot->SetLevel( ::atoi( vecText[c_nLevelPos].c_str() ) );
pSlot->SetJobID( ::atoi( vecText[c_nJobPos].c_str() ) );
pSlot->SetAuthority( ::atoi( vecText[ c_nAuthority ].c_str() ) ); // 권한등급
pSlot->SetHP( ::atoi( vecText[c_nHPPos].c_str() ) );
pSlot->SetMP( ::atoi( vecText[c_nMPPos].c_str() ) );
pSlot->SetXPos( ::atoi( vecText[c_nXPos].c_str() ) );
pSlot->SetYPos( ::atoi( vecText[c_nYPos].c_str() ) );
pSlot->SetLogin( ::atoi( vecText[c_nLogin].c_str() ) );
if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
pSlot->SetPoint( ::atoi( vecText[c_nPointPos].c_str() ) );
pSlot->SetTotalPoint( ::atoi( vecText[c_nTotalPointPos].c_str() ) );
}
bSelf = this->IsLocalPlayer( handle ); // 해당 메세지가 자신에게만 해당되는 지 여부반환.
}
//void SGuildMgr::AddMember( STR_LIST& vecText )
//{
// if( vecText.size() < 10 ) return;
//
// static char c_nHandlePos = 1;
// static char c_nNamePos = 2;
// static char c_nLevelPos = 3;
// static char c_nJobPos = 4;
// static char c_nHPPos = 5;
// static char c_nMPPos = 6;
// static char c_nXPos = 7;
// static char c_nYPos = 8;
// static char c_nSummonFlag = 9;
//
// if( IsExistMember( vecText[c_nNamePos].c_str() ) == false )
// {
// SPlayerSlot* pSlot = new SPlayerSlot;
//
// char * strstoper;
// AR_HANDLE handle = ::strtoul( vecText[c_nHandlePos].c_str(), &strstoper, 10 );
// pSlot->SetHandle( handle );
//
// pSlot->SetName( vecText[c_nNamePos].c_str() );
// pSlot->SetLevel( ::atoi( vecText[c_nLevelPos].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[c_nJobPos].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[c_nHPPos].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[c_nMPPos].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[c_nXPos].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[c_nYPos].c_str() ) );
// pSlot->SetCreature( ::atoi( vecText[c_nSummonFlag].c_str() ), 0 );
//
// if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
//
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
//
// pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
//
// m_vecMemberList.push_back(pSlot);
// }
// else
// {
// SPlayerSlot* pSlot = FindMember( vecText[c_nNamePos].c_str() );
// if( pSlot == NULL ) return;
//
// char * strstoper;
// AR_HANDLE handle = ::strtoul( vecText[c_nHandlePos].c_str(), &strstoper, 10 );
// pSlot->SetHandle( handle );
//
// pSlot->SetName( vecText[c_nNamePos].c_str() );
// pSlot->SetLevel( ::atoi( vecText[c_nLevelPos].c_str() ) );
// pSlot->SetJobID( ::atoi( vecText[c_nJobPos].c_str() ) );
// pSlot->SetHP( ::atoi( vecText[c_nHPPos].c_str() ) );
// pSlot->SetMP( ::atoi( vecText[c_nMPPos].c_str() ) );
// pSlot->SetXPos( ::atoi( vecText[c_nXPos].c_str() ) );
// pSlot->SetYPos( ::atoi( vecText[c_nYPos].c_str() ) );
// pSlot->SetCreature( ::atoi( vecText[c_nSummonFlag].c_str() ), 0 );
//
// if( pSlot->GetHandle() == NULL ) pSlot->SetLogin( false );
//
// if( ::_stricmp( m_strLeaderName.c_str(), pSlot->GetName() ) == 0 ) pSlot->SetLeader( true );
//
// pSlot->SetNear( !( IsFar(pSlot->GetHandle()) ) );
// }
//}
void SGuildMgr::ChangeGuildInfo( STR_LIST& vecText )
{
m_bParsing = true;
if( !m_bIsExist ) return;
if( vecText.size() > 3 )
{
m_nMaxLevel = ::atoi( vecText[2].c_str() );
m_nMinLevel = ::atoi( vecText[3].c_str() );
}
}
// 2011.11.23 - servantes : 리턴형 변경
bool SGuildMgr::ChangeLeader( const char* szPlayerName )
{
if( m_strGulidLeaderName == szPlayerName )
return false;
// 이전 길드장의 등급을 최하등급으로 강등.
SPlayerSlot* pSlot = FindMember( m_strLeaderName.c_str() );
if( pSlot )
pSlot->SetAuthority( _PERMISSION::PERMISSION_MEMBER_LEAST );
SMessengerMgr::ChangeLeader(szPlayerName);
m_strGulidLeaderName = szPlayerName;
// 새 길드장 등급변경.
pSlot = FindMember( szPlayerName );
if( pSlot )
pSlot->SetAuthority( _PERMISSION::PERMISSION_LEADER );
return true;
}
// 연합길드장 반환.
const char * SGuildMgr::GetAllianceGuildMaster( int nGID )
{
if( !m_arrAllianceGuild.empty() )
{
return m_arrAllianceGuild[ 0 ]->strAllianceLeaderName.c_str();
}
return NULL;
}
// 연합길드장 소속길드 반환.
const char * SGuildMgr::GetAllianceMasterToGuild()
{
if( !m_arrAllianceGuild.empty() )
{
int size = m_arrAllianceGuild.size();
for( int i=0; i<size; ++i )
{
if( m_arrAllianceGuild[ i ]->nID == m_arrAllianceGuild[ 0 ]->nAllianceMasterGuildSID )
return m_arrAllianceGuild[ i ]->strName.c_str();
}
}
return NULL;
}
// 연합에 속한 길드 반환.
SAllianceGuild * SGuildMgr::GetAllianceGuildByGID( int nGID )
{
for( std::vector< SAllianceGuild * >::iterator it=m_arrAllianceGuild.begin(); it!=m_arrAllianceGuild.end(); ++it )
{
if( (*it)->nID == nGID )
return (*it);
}
return NULL;
}
// 연합소속 길드원 멤버수 변경.
void SGuildMgr::ChangeAllianceMemberCount( int nGID, int memberCount )
{
SAllianceGuild * pAGuild = GetAllianceGuildByGID( nGID );
if( pAGuild )
{
int nPrevCount = pAGuild->nMemberCount; // 이전 맴버수.
pAGuild->nMemberCount = memberCount; // 맴버수 변경.
pAGuild->nAllianceMemberCount += ( nPrevCount - memberCount ); // 연합길드총 맴버수 변경.
}
}
// 연합소속 길드장 변경.
void SGuildMgr::ChangeAllianceMaster( int nGID, const std::string & strName )
{
SAllianceGuild * pAGuild = GetAllianceGuildByGID( nGID );
if( pAGuild )
{
// 이전 길드장이 연합길드장 인 경우에 연합길드장 변경.
if( pAGuild->nAllianceMasterGuildSID == nGID )
{
pAGuild->strAllianceLeaderName = strName;
}
pAGuild->strLeaderName = strName; // 길드장명 변경.
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
SGuildDataMgr::SGuildDataMgr()
: SGameUIMgr() // 2011.03.29 - servantes
{
m_nMode = MODE_NONE;
}
SGuildDataMgr::~SGuildDataMgr()
{
}
void SGuildDataMgr::ResetInfo()
{
m_hLocalPlayer = 0;
m_nMode = MODE_NONE;
m_vGuildDataList.clear();
m_vDownGuildDataList.clear();
m_vWaitGuildDataList.clear();
}
int SGuildDataMgr::AddMessage( const char * pMsg, int & nValue )
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
STR_LIST strList;
MsgSplit( pMsg, strList, L"|" );
size_t nTextSize = strList.size();
if( nTextSize <= 0 ) return 0;//false;
if( ::_stricmp( strList[0].c_str(), "GCHANGE") == 0 ) //GCHANGE|player_handle|guild_id
{
if( nTextSize < 3 )
{
strList.clear();
return 0;//false;
}
char * strstoper;
AR_HANDLE handle = ::strtoul( strList[1].c_str(), &strstoper, 10 );
SIMSG_UI_GUILDICON_REFRESH msg;
msg.nGuild_id = atoi( strList[2].c_str() );
const GUILD_ICON * pGdata = GetGuildData( msg.nGuild_id );
if( msg.nGuild_id == 0 )
{
msg.strGuildName = "#@DELETEGUILD@#";
msg.strIconAniName = "#@DELETEGUILD@#";
}
else
{
if( pGdata )
{
msg.strGuildName = pGdata->strGuildName;
msg.strIconAniName = pGdata->strIconAniName;
}
else
{ //아직 데이타 없음
msg.strGuildName = "NewGuild";
msg.strIconAniName = "";
}
}
msg.vHandleList.push_back( handle );
SendGameInterfaceMsg( &msg );
if( msg.nGuild_id !=0 && pGdata == NULL )
{
nValue = msg.nGuild_id;
strList.clear();
return REQ_GUILD_ICON;
}
strList.clear();
return REQ_NONE;
}
else if( ::_stricmp( strList[0].c_str(), "CHANGE_GUILD_NAME" ) == 0 ) //CHANGE_GUILD_NAME|guild_id|guild_name|
{
if( nTextSize < 3 )
{
strList.clear();
return 0;//false;
}
int nGuilID = atoi( strList[1].c_str() );
ChangeGuildName( nGuilID, strList[2].c_str() );
}
else if( ::_stricmp( strList[0].c_str(), "GDESTROY") == 0 ) //GDESTROY|guild_id
{
if( nTextSize < 2 )
{
strList.clear();
return 0;//false;
}
int nGuildID = atoi( strList[1].c_str() );
SIMSG_UI_GUILDICON_DESTROY msg( nGuildID );
SendGameInterfaceMsg( &msg );
strList.clear();
return REQ_NONE;
}
else if( ::_stricmp( strList[0].c_str(), "GICON" ) == 0 ) //GICON|guild_id|guild_name|guild_icon_file_name|guild_icon_file_size
{
if( nTextSize < 2 )
{
strList.clear();
return 0;//false;
}
if( !IsExistGuild( atoi( strList[1].c_str() ) ) )
{
AddGuildData( strList );
}
strList.clear();
return REQ_NONE;
}
else if( ::_stricmp( strList[0].c_str(), "GICON_UPDATE" ) == 0 ) //GICON_UPDATE|guild_id
{
if( nTextSize < 2 )
{
strList.clear();
return 0;//false;
}
//정보 갱신
int nGuild_id = atoi( strList[1].c_str() );
nValue = nGuild_id;
//삭제
if( IsExistGuild( atoi( strList[1].c_str() ) ) )
DelGuildData( nGuild_id );
strList.clear();
//길드 정보 다시 요청
return REQ_GUILD_ICON;
}
strList.clear();
return REQ_NONE;
}
void SGuildDataMgr::ChangeGuildName( int nGuild_id, const char * pNewName )
{
for( unsigned int i(0); m_vGuildDataList.size()>i; i++ )
{
if( m_vGuildDataList[i].nGuildID == nGuild_id )
{
if( pNewName != NULL && strlen(pNewName)>0 )
m_vGuildDataList[i].strGuildName = pNewName;
return;
}
}
}
void SGuildDataMgr::RegistGuildData( GUILD_ICON * pGuildData )
{
std::string strNewName = g_pGuildDir;
strNewName += pGuildData->strIconFileName.c_str();
GUILD_ICON GuildData;
GuildData.nGuildID = pGuildData->nGuildID ;
GuildData.strGuildName = pGuildData->strGuildName ;
GuildData.strIconFileName = pGuildData->strIconFileName;
GuildData.nIconFileSize = pGuildData->nIconFileSize ;
GuildData.bLoaded = pGuildData->bLoaded ;
bool bEncrypt = false;
#ifdef _GUILD_ICON_ENC_
bEncrypt = true;
#endif
//저 사양은 TGA로 변환
if( KUITextureManager::GetHWType() == KUITextureManager::NOTPOW_SUPPORT )
{
std::string strInFileName = strNewName;
std::string strSaveName = strInFileName;
nsl::replace( &strSaveName, ".jpg", ".tga" );
FILE* pFTGA = fopen( strSaveName.c_str(), "rb" );
if( pFTGA == NULL )
{
if( bEncrypt )
{
std::string strTemp = g_pGuildDir;
strTemp += "xxxx.jpg";
FILE *fp = fopen( strInFileName.c_str(), "rb" );
if( fp )
{
// 데이터 파일 크기 세팅
fseek( fp, 0, SEEK_END );
size_t fsize = ftell( fp );
fseek( fp, 0, SEEK_SET );
char *pBuf = new char[fsize];
fread( pBuf, sizeof(char)*fsize, 1, fp );
fclose( fp );
//XOR 풀고
for( size_t idx = 0; idx < fsize; idx++ ) pBuf[idx] ^= XOREn::GetEncodeKeyChar( idx );
//Temp 화일 생성
FILE *Outfp = fopen( strTemp.c_str(), "wb" );
if( Outfp )
{
if( fwrite( pBuf, sizeof(char)*fsize, 1, Outfp ) != 1 )
{
delete [] pBuf;
fclose( Outfp );
return;
}
fclose( Outfp );
}
delete [] pBuf;
strInFileName = strTemp;
}
}
//TGA 변환
if( ilSaveAsType( (char*)strInFileName.c_str(), (char*)strSaveName.c_str() ) )
{ //변환 성공시 추가
//TGA는 압축 안됨.
KSpriteManager::GetManager()->AddIconSprite( "ui_frame.spr", strSaveName.c_str(), false, true, KColor(255,0,255) );
}
if( bEncrypt )
{
DeleteFile( strInFileName.c_str() );
}
}
else //TGA 존재 함
{
fclose( pFTGA );
KSpriteManager::GetManager()->AddIconSprite( "ui_frame.spr", strSaveName.c_str(), false, true, KColor(255,0,255) );
}
}
else
{
KSpriteManager::GetManager()->AddIconSprite( "ui_frame.spr", strNewName.c_str(), bEncrypt, true, KColor(255,0,255) );
}
std::string strAniName;
if( CStringUtil::GetIconAniName( strNewName.c_str(), strAniName ) )
{
SIMSG_UI_GUILDICON msg;
msg.nGuild_id = GuildData.nGuildID;
msg.strGuildName = GuildData.strGuildName;
msg.strIconAniName = strAniName.c_str();
SendGameInterfaceMsg( &msg );
GuildData.strIconAniName = strAniName;
m_vGuildDataList.push_back( GuildData );
//KResSprite* pResSprite = KSpriteManager::GetManager()->GetResSprite( "ui_frame.spr", strAniName.c_str(), 0 );
//if( pResSprite )
//{
//}
}
}
void SGuildDataMgr::SendGuildData( int nGuild_ID )
{
const GUILD_ICON * pGdata = GetGuildData( nGuild_ID );
if( pGdata )
{
SIMSG_UI_GUILDICON msg;
msg.nGuild_id = nGuild_ID;
msg.strGuildName = pGdata->strGuildName;
msg.strIconAniName = pGdata->strIconAniName;
SendGameInterfaceMsg( &msg );
}
}
void SGuildDataMgr::Process( DWORD dwTime )
{
//5초에 한번 정도 시도 할까?
if( m_nMode == MODE_NONE )
{
if( !m_vDownGuildDataList.empty() )
{ //다운로드가 완료 되었으므로, 길드 아이콘 UI 에 등록
for( unsigned int i(0); m_vDownGuildDataList.size()>i; i++ )
RegistGuildData( &m_vDownGuildDataList[i] );
//기존 URL 삭제
m_vDownGuildDataList.clear();
}
//대기 리스트에 데이타 존재 할 경우
//대기 리스트 다운로드
if( !m_vWaitGuildDataList.empty() )
{
for( unsigned int i(0); m_vWaitGuildDataList.size()>i; i++ )
{
m_vDownGuildDataList.push_back( m_vWaitGuildDataList[i] );
}
m_vWaitGuildDataList.clear();
GuildIconDownLoad();
}
}
else if (m_nMode == MODE_DOWNLOADERROR )
{
if( !m_vDownGuildDataList.empty() )
{ //다운로드가 완료 되었으므로, 길드 아이콘 UI 에 등록
for( unsigned int i(0); m_vDownGuildDataList.size()>i; i++ )
{
SIMSG_UI_GUILDICON msg;
msg.nGuild_id = m_vDownGuildDataList[i].nGuildID;
msg.strGuildName = m_vDownGuildDataList[i].strGuildName;
msg.strIconAniName = "";
SendGameInterfaceMsg( &msg );
}
//기존 URL 삭제
m_vDownGuildDataList.clear();
}
}
}
bool SGuildDataMgr::IsExistGuildIconFile( const char * pGuildIconFileName )
{
const char *szJPG_Extension = ( pGuildIconFileName + strlen(pGuildIconFileName) - 4 );
const char *szJPEG_Extension = ( pGuildIconFileName + strlen(pGuildIconFileName) - 5 );
if( _stricmp( szJPG_Extension, ".jpg" ) != 0 && _stricmp( szJPEG_Extension, ".jpeg" ) != 0 )
{
//화일 포맷이 다르므로, 로딩을 시도 하지 않는다. 사용 할 수 없기 때문...
return true;
}
std::string strGuildIcon = g_strGuildFullDir + pGuildIconFileName;
FILE* fp = fopen( strGuildIcon.c_str(), "rb" );
if(fp)
{
#ifdef _GUILD_ICON_ENC_
char szJPG[32];
fread( szJPG, sizeof(szJPG), 1, fp );
fclose( fp );
if( !strnicmp( &szJPG[6], "JFIF", 4 ) )
{
DeleteFile( strGuildIcon.c_str() ); //삭제
return false;
}
return true;
#else
fclose( fp );
return true;
#endif
}
return false;
}
//길드 아이콘 관련 수정할 부분 <함수 인자로 add할 길드아이콘 이름이 들어와야한다>
void SGuildDataMgr::AddGuildData( std::vector< std::string > & strGuildData )
{
if( strGuildData.size() < 4 )
{
return;
}
if( strGuildData.size() == 4 )
{ //길드 이름만 있는 경우
SIMSG_UI_GUILDICON msg;
msg.nGuild_id = atoi( strGuildData[1].c_str() );
msg.strGuildName = strGuildData[2].c_str();
msg.strIconAniName = "";
SendGameInterfaceMsg( &msg );
return;
}
GUILD_ICON _guild_icon;
_guild_icon.nGuildID = atoi( strGuildData[1].c_str() );
_guild_icon.strGuildName = strGuildData[2].c_str();
_guild_icon.nIconFileSize = atoi( strGuildData[4].c_str() );
//앞부분 제거
std::string strFileName = strGuildData[3].c_str();
std::string::size_type pos = strFileName.rfind( '/' );
if( pos != std::string::npos )
{
//앞 부분 삭제, 화일 이름 생성
strFileName.erase( 0, pos+1 );
_guild_icon.strIconFileName = strFileName.c_str();
_guild_icon.bLoaded = IsExistGuildIconFile( _guild_icon.strIconFileName.c_str() );
}
else
{ //거짓 로드 안함.
_guild_icon.strIconFileName = "Invalid_FileName";
_guild_icon.bLoaded = true;
}
if( m_nMode == MODE_NONE )
{
if( _guild_icon.bLoaded )
{ //로드 안 함
RegistGuildData( &_guild_icon );
}
else
{
m_vDownGuildDataList.push_back( _guild_icon );
GuildIconDownLoad();
}
}
else if( m_nMode == MODE_DOWNLOAD )
{
if( _guild_icon.bLoaded )
RegistGuildData( &_guild_icon );
else
m_vWaitGuildDataList.push_back( _guild_icon );
}
}
void SGuildDataMgr::DelGuildData( int nGuild_id )
{
for( unsigned int i(0); m_vGuildDataList.size()>i; i++ )
{
if( m_vGuildDataList[i].nGuildID == nGuild_id )
{
m_vGuildDataList.erase( m_vGuildDataList.begin()+i );
return;
}
}
}
const GUILD_ICON * SGuildDataMgr::GetGuildData( int nGuild_id ) const
{
for( unsigned int i(0); m_vGuildDataList.size()>i; i++ )
{
if( m_vGuildDataList[i].nGuildID == nGuild_id )
return &m_vGuildDataList[i];
}
return NULL;
}
bool SGuildDataMgr::IsLoadedGuild( int nGuild_id )
{
for( unsigned int i(0); m_vGuildDataList.size()>i; i++ )
{
if( m_vGuildDataList[i].nGuildID == nGuild_id )
{
#ifndef NDEBUG
bool bLoaded = m_vGuildDataList[i].bLoaded;
#endif
return m_vGuildDataList[i].bLoaded;
}
}
return false;
}
bool SGuildDataMgr::IsExistGuild( int nGuild_id )
{
for( unsigned int i(0); m_vGuildDataList.size()>i; i++ )
{
if( m_vGuildDataList[i].nGuildID == nGuild_id )
return true;
}
return false;
}
//쓰레드로 빠져야 한다.
void SGuildDataMgr::GuildIconDownLoad()
{
m_nMode = MODE_DOWNLOAD;
unsigned tmp = 0;
HANDLE hThread = reinterpret_cast< HANDLE >( _beginthreadex( NULL, 0, download_file, this, 0, &tmp ) );
CloseHandle( hThread );
}
//#include "SLog.h"
unsigned __stdcall SGuildDataMgr::download_file( void* pArg )
{
SGuildDataMgr* pParent = reinterpret_cast< SGuildDataMgr* >( pArg );
struct myInternetFileWriter : XInternetFileWriter
{
myInternetFileWriter( std::string & _fn ) : checksum( 0 ), strFileName( _fn )
{
size = 0;
pQueue = IQueue::MakeQueue( 2*1024 );
}
virtual ~myInternetFileWriter()
{
delete pQueue;
}
bool Write( const char* pData, unsigned nSize )
{
unsigned char *p = reinterpret_cast< unsigned char * >( const_cast< char* >( pData ) );
for( unsigned i = 0; i < nSize; ++i )
{
checksum += *p;
p++;
}
size += nSize;
pQueue->Write( pData, nSize );
return true;
}
std::string getCheckSum()
{
char buf[9];
sprintf( buf, "%08X", checksum );
return buf;
}
IQueue *pQueue;
int size;
unsigned checksum;
std::string strFileName;
std::string strDirectory;
};
//쓰레드 빼고, 화일 저장 부분 정리
XInternetSession session;
// Fraun cleared galalab asscans
//session.SetServer( ENV().GetString( "web_download", "www.rappelz.com" ).c_str() , ENV().GetInt( "web_download_port", 0 ) );
session.SetServer( ENV().GetString( "web_download", "127.0.0.1" ).c_str() , ENV().GetInt( "web_download_port", 0 ) );
session.OpenSession();
std::vector<GUILD_ICON>::iterator it = pParent->m_vDownGuildDataList.begin();
std::string strURL;
if( ENV().IsExist( "guild_test_download.url" ) )
strURL = ENV().GetString( "guild_test_download.url", "upload/client/guild/" );
else
strURL = ENV().GetString( "guild_download.url", "upload/client/guild/" );
for( ; it != pParent->m_vDownGuildDataList.end(); ++it )
{
//DownLoad URL
std::string strDownURL = strURL;
strDownURL += (*it).strIconFileName;
//Local File
std::string strLocal = g_strGuildFullDir;
strLocal += (*it).strIconFileName;
myInternetFileWriter _fo( strLocal );
// 파일 읽다가 오류라면..
if( session.HttpQuery( strDownURL.c_str(), &_fo, NULL ) < 1 )
{
pParent->m_nMode = MODE_DOWNLOADERROR;
return 0;
}
else
{
if( _fo.pQueue->Size() != (*it).nIconFileSize )
{
assert(0 && "Error: Guild icon size is different" );
}
FILE *fp = fopen( strLocal.c_str(), "wb" );
if( fp )
{
#ifdef _GUILD_ICON_ENC_
char * pEnBuf = new char[_fo.pQueue->Size()];
memcpy( pEnBuf, _fo.pQueue->GetBuf(), _fo.pQueue->Size() );
//XOR
for( size_t idx = 0; idx < _fo.pQueue->Size(); idx++ ) pEnBuf[idx] ^= XOREn::GetEncodeKeyChar( idx );
if( fwrite( pEnBuf, _fo.pQueue->Size(), 1, fp ) != 1 )
#else
if( fwrite( _fo.pQueue->GetBuf(), _fo.pQueue->Size(), 1, fp ) != 1 )
#endif
{
#ifdef _GUILD_ICON_ENC_
delete [] pEnBuf;
#endif
fclose( fp );
continue; //다른 아이콘 다운 받자~
}
#ifdef _GUILD_ICON_ENC_
delete [] pEnBuf;
#endif
fclose( fp );
DWORD dwAttrs;
dwAttrs = GetFileAttributes(strLocal.c_str());
if (!(dwAttrs & FILE_ATTRIBUTE_HIDDEN))
SetFileAttributes(strLocal.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN);
}
}
}
pParent->m_nMode = MODE_NONE;
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//class CHttpQuery
//{
//public:
// LPCSTR m_html;
// bool GetServerName( LPCSTR *p, LPCSTR lpStart, LPCSTR lpEnd, LPCSTR lpGet, int maxcch );
// void Query( LPCSTR serverName, UINT CodePage, LPCSTR lpUrl, LPVOID lpOptional, DWORD dwOptionalLength );
//
//public:
// CHttpQuery( LPCSTR _serverName, LPCSTR lpUrl , LPVOID lpOptional = NULL , DWORD dwOptionalLength = 0 );
// CHttpQuery( LPCSTR _serverName, UINT CodePage, LPCSTR lpUrl , LPVOID lpOptional = NULL , DWORD dwOptionalLength = 0 );
//
// ~CHttpQuery();
//
// // operator LPWSTR();
// //operator bool();
//};
//
//CHttpQuery::CHttpQuery( LPCSTR _serverName, LPCSTR lpUrl , LPVOID lpOptional , DWORD dwOptionalLength )
//{
// Query( _serverName, CP_UTF8, lpUrl, lpOptional, dwOptionalLength );
//}
//CHttpQuery::CHttpQuery( LPCSTR _serverName, UINT CodePage, LPCSTR lpUrl , LPVOID lpOptional , DWORD dwOptionalLength )
//{
// Query( _serverName, CodePage, lpUrl, lpOptional, dwOptionalLength );
//}
//void CHttpQuery::Query( LPCSTR _serverName, UINT CodePage, LPCSTR lpUrl, LPVOID lpOptional, DWORD dwOptionalLength )
//{
// m_html = NULL;
//
// CHAR ServerName[1024]={NULL,};
// strcpy( ServerName, _serverName );
// /* if( !GetServerName( &lpUrl , "HTTP://", "/", ServerName, 1024 ) )
// {
// GetServerName( &lpUrl , "HTTPS://", "/", ServerName, 1024 );
// }*/
//
//
// DWORD_PTR dwContext = 0;
// if ( lpOptional && dwOptionalLength )dwContext = 1;
//
// HINTERNET hInternet = InternetOpen( "HTTP", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
//
// HINTERNET hConnect = InternetConnect( hInternet, ServerName, INTERNET_DEFAULT_HTTP_PORT,
// NULL, NULL, INTERNET_SERVICE_HTTP, 0, dwContext );
//
// LPCTSTR accept[2]={ "*/*", NULL };
// HINTERNET hRequest = HttpOpenRequest( hConnect, "POST",lpUrl, NULL, NULL, accept,
// INTERNET_FLAG_DONT_CACHE, dwContext );
//
// if ( dwContext )
// {
// CHAR hdrs[1024] = "Content-Type: application/x-www-form-urlencoded";
// sprintf( hdrs, "Content-Type: application/x-www-form-urlencoded\r\nContent-length: %d \r\n", dwOptionalLength);
// HttpSendRequest( hRequest, hdrs, strlen(hdrs), lpOptional, dwOptionalLength );
// }
// else
// {
// HttpSendRequest( hRequest, NULL, 0, NULL, 0 );
// }
//
// DWORD dwSize = 0;
// BOOL bQuery = InternetQueryDataAvailable( hRequest, &dwSize, 0, 0 );
// if ( bQuery && dwSize > 0 )
// {
// DWORD dwTotal = 0;
// char* pData = (char*)malloc( dwTotal + dwSize + 1 );
// while ( pData && dwSize )
// {
// DWORD dwRead = 0;
// InternetReadFile( hRequest, pData+dwTotal, dwSize, &dwRead );
// dwTotal += dwRead;
// pData[dwTotal] = NULL;
//
// InternetQueryDataAvailable( hRequest, &dwSize, 0, 0 );
// if ( dwSize > 0 )
// {
// pData = (char*)realloc( pData, dwTotal + dwSize+1 );
// }
// }
// if ( pData )
// {
// /* int len = MultiByteToWideChar( CodePage, 0, pData, dwTotal, NULL, NULL );
// m_html = (LPWSTR)calloc( len+1, sizeof(WCHAR) );
// if ( m_html )
// {
// MultiByteToWideChar( CodePage, 0, pData, dwTotal, m_html, len+1 );
// }*/
// free(pData);
// }
// ::MessageBox( NULL, pData, "pData", MB_OK );
// ::MessageBox( NULL, m_html, "m_html", MB_OK );
// }
// InternetCloseHandle( hRequest );
// InternetCloseHandle( hConnect );
// InternetCloseHandle( hInternet );
//}
//
//// 문자열을 비교 값을 얻어 낸다.
//bool CHttpQuery::GetServerName( LPCSTR *p, LPCSTR lpStart, LPCSTR lpEnd, LPCSTR lpstr3, int maxcch )
//{
// //int len = strlen( lpStart );
// //if ( wcsnicmp( *p, lpStart, len ) != 0 ) return FALSE;
//
// //*p += len ;
//
// //LPTSTR lpstr = wcsstr( (LPWSTR)*p, lpEnd );
// //if ( lpstr )
// //{
// // wcsncpy( (LPWSTR)lpstr3, *p, min( maxcch, (lpstr-*p) ) );
// // *p = lpstr + wcslen( lpEnd );
// //}
// //else
// //{
// // wcsncpy( (LPWSTR)lpstr3, *p, maxcch );
// // *p += wcslen(*p);
// //}
//
//
//
//
// return TRUE;
//}
//
//CHttpQuery::~CHttpQuery()
//{
// if ( m_html )
// free( (void *)m_html );
// m_html = NULL;
//}
////CHttpQuery::operator LPWSTR()
////{
//// return m_html;
////}
////CHttpQuery::operator bool()
////{
//// return ( m_html != NULL );
////}
//
#include <tchar.h>
#include "atlexcept.h"
#include "atlconv.h"
class CHttpQuery
{
public:
LPWSTR m_html;
bool GetServerName( LPCWSTR *p, LPCWSTR lpStart, LPCWSTR lpEnd, LPCWSTR lpGet, int maxcch );
void Query( LPCWSTR serverName, UINT CodePage, LPCWSTR lpUrl, LPVOID lpOptional, DWORD dwOptionalLength );
public:
CHttpQuery( LPCWSTR serverName, LPCWSTR lpUrl , LPVOID lpOptional = NULL , DWORD dwOptionalLength = 0 );
CHttpQuery( LPCWSTR serverName, UINT CodePage, LPCWSTR lpUrl , LPVOID lpOptional = NULL , DWORD dwOptionalLength = 0 );
~CHttpQuery();
operator LPWSTR();
operator bool();
};
CHttpQuery::CHttpQuery( LPCWSTR serverName, LPCWSTR lpUrl , LPVOID lpOptional , DWORD dwOptionalLength )
{
Query( serverName, CP_UTF8, lpUrl, lpOptional, dwOptionalLength );
}
CHttpQuery::CHttpQuery( LPCWSTR serverName, UINT CodePage, LPCWSTR lpUrl , LPVOID lpOptional , DWORD dwOptionalLength )
{
Query( serverName, CodePage, lpUrl, lpOptional, dwOptionalLength );
}
void CHttpQuery::Query( LPCWSTR _serverName, UINT CodePage, LPCWSTR lpUrl, LPVOID lpOptional, DWORD dwOptionalLength )
{
m_html = NULL;
//WCHAR ServerName[1024]={0};
LPCWSTR ServerName = _serverName;
/*if( !GetServerName( &lpUrl , ATL::CA2W( "HTTP://" ), ATL::CA2W("/"), ServerName, 1024 ) )
{
GetServerName( &lpUrl , ATL::CA2W("HTTPS://"), ATL::CA2W("/"), ServerName, 1024 );
}*/
DWORD_PTR dwContext = 0;
if ( lpOptional && dwOptionalLength )dwContext = 1;
HINTERNET hInternet = InternetOpenW( ATL::CA2W("HTTP"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
HINTERNET hConnect = InternetConnectW( hInternet, ServerName, INTERNET_DEFAULT_HTTP_PORT,
NULL, NULL, INTERNET_SERVICE_HTTP, 0, dwContext );
LPCWSTR accept[2]={ ATL::CA2W("*/*"), NULL };
HINTERNET hRequest = HttpOpenRequestW( hConnect, ATL::CA2W("POST"),lpUrl, NULL, NULL, accept,
INTERNET_FLAG_DONT_CACHE, dwContext );
if ( dwContext )
{
WCHAR hdrs[1024]={NULL,};// = ATL::CA2W("Content-Type: application/x-www-form-urlencoded");
//std::wstring hdrs( "Content-Type: application/x-www-form-urlencoded" );
wsprintfW( hdrs, ATL::CA2W("Content-Type: application/x-www-form-urlencoded\r\nContent-length: %d \r\n"), dwOptionalLength);
HttpSendRequestW( hRequest, hdrs, wcslen(hdrs), lpOptional, dwOptionalLength );
}
else
{
HttpSendRequest( hRequest, NULL, 0, NULL, 0 );
}
DWORD dwSize = 0;
BOOL bQuery = InternetQueryDataAvailable( hRequest, &dwSize, 0, 0 );
if ( bQuery && dwSize > 0 )
{
DWORD dwTotal = 0;
char* pData = (char*)malloc( dwTotal + dwSize + 1 );
while ( pData && dwSize )
{
DWORD dwRead = 0;
InternetReadFile( hRequest, pData+dwTotal, dwSize, &dwRead );
dwTotal += dwRead;
pData[dwTotal] = NULL;
InternetQueryDataAvailable( hRequest, &dwSize, 0, 0 );
if ( dwSize > 0 )
{
pData = (char*)realloc( pData, dwTotal + dwSize+1 );
}
}
if ( pData )
{
// AziaMafia CP_UTF8
//int len = MultiByteToWideChar( CodePage, 0, pData, dwTotal, NULL, NULL );
int len = MultiByteToWideChar(CodePage, 0, pData, dwTotal, NULL, NULL );
m_html = (LPWSTR)calloc( len+1, sizeof(WCHAR) );
if ( m_html )
{
// AziaMafia CP_UTF8
//MultiByteToWideChar( CodePage, 0, pData, dwTotal, m_html, len+1 );
MultiByteToWideChar(CodePage, 0, pData, dwTotal, m_html, len+1 );
}
free(pData);
}
}
InternetCloseHandle( hRequest );
InternetCloseHandle( hConnect );
InternetCloseHandle( hInternet );
}
// 문자열을 비교 값을 얻어 낸다.
bool CHttpQuery::GetServerName( LPCWSTR *p, LPCWSTR lpStart, LPCWSTR lpEnd, LPCWSTR lpstr3, int maxcch )
{
std::wstring wstr( lpStart );
int len = wstr.size();
//int len = _tcslen( lpStart );
if ( wcsnicmp( *p, lpStart, len ) != 0 ) return FALSE;
*p += len ;
LPWSTR lpstr = wcsstr( (LPWSTR)*p, lpEnd );
if ( lpstr )
{
wcsncpy( (LPWSTR)lpstr3, *p, min( maxcch, (lpstr-*p) ) );
*p = lpstr + wcslen( lpEnd );
}
else
{
wcsncpy( (LPWSTR)lpstr3, *p, maxcch );
*p += wcslen(*p);
}
return TRUE;
}
CHttpQuery::~CHttpQuery()
{
if ( m_html ) free( m_html );
m_html = NULL;
}
CHttpQuery::operator LPWSTR()
{
return m_html;
}
CHttpQuery::operator bool()
{
return ( m_html != NULL );
}
extern HWND g_hWnd;
//////////////////////////////////////////////////////////////////////////
// SFriendMgr
SFriendMgr::SFriendMgr()
: SMessengerMgr() // 2011.03.29 - servantes
{
Clear();
}
void SFriendMgr::Clear()
{
SMessengerMgr::Clear();
m_strMsg = m_strCommunityName;
}
void SFriendMgr::ResetInfo()
{
m_strMsg.clear();
m_strCommunityName.clear();
SMessengerMgr::Clear();
}
//int SFriendMgr::AddMessage( const char* szMsg )
int SFriendMgr::AddMessage( const char* szMsg, bool & bSelf ) // 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
STR_LIST strList;
MsgSplit( szMsg, strList, L"|" );
if( strList.size() < 1 ) return 0;//false;
if( ::_stricmp( strList[0].c_str(), "FLIST") == 0 ) //FLIST|name|online|name|online|.....
{
strList.erase( strList.begin() );
InfoMember(strList);
strList.clear();
return 1;//true;
}
else if( ::_stricmp( strList[0].c_str(), "FSTATUS") == 0 ) //FSTATUS|name|online
{
strList.erase( strList.begin() );
ChangeMemberStatus(strList);
strList.clear();
return 1;//true;
}
strList.clear();
return 0;//false;
}
void SFriendMgr::InfoMember( STR_LIST& vecText )
{
// 이름|online
// m_bParsing = true;
// m_bIsExist = true;
// m_nCommunityID = 0;
Free();
if( vecText.size() <= 0 ) return;
// m_strCommunityName = "";
// m_strLeaderName = "";
// m_strGuildName = "";
// m_strGulidLeaderName = "";
// m_nMaxLevel = 0;
// m_nMinLevel = 0;
int nLine = static_cast<int>(vecText.size());
int nCount = nLine / 2;
int nPos = 0;
for( int i = 0; i < nCount; i++ )
{
if( i > 0 ) nPos = (2*i); //4은 친구를 알려주는 정보에서 |를 기준으로 있는 개수(미정)
SPlayerSlot* pSlot(NULL);
if( !IsExistMember(vecText[0+nPos].c_str()) ) //아직 등록안된 플레이어니 new로 생성해서 push
{
pSlot = new SPlayerSlot;
m_vecMemberList.push_back(pSlot);
}
else
pSlot = FindMember( vecText[0+nPos].c_str() ); //이미 등록된 플레이어니 Find
if( pSlot )
{
pSlot->SetName( vecText[0+nPos].c_str() );
pSlot->SetLogin( ::atoi( vecText[1+nPos].c_str() ) );
}
}
// if( static_cast<int>(m_vecMemberList.size()) == 1 )
// m_nMinLevel = m_nMaxLevel;
}
void SFriendMgr::ChangeMemberStatus( STR_LIST& vecText )
{
if( vecText.size() < 2 ) return;
SPlayerSlot* pSlot = FindMember( vecText[0].c_str() );
if( pSlot )
{
pSlot->SetLogin( ::atoi( vecText[1].c_str() ) );
SIMSG_UI_FRIEND_UPDATE msg( vecText[0].c_str() );
SendGameInterfaceMsg( &msg );
}
}
//////////////////////////////////////////////////////////////////////////
// SCutMgr
SCutMgr::SCutMgr()
: SMessengerMgr() // 2011.03.29 - servantes
{
Clear();
}
void SCutMgr::Clear()
{
SMessengerMgr::Clear();
m_strMsg = m_strCommunityName;
}
void SCutMgr::ResetInfo()
{
m_strMsg.clear();
m_strCommunityName.clear();
SMessengerMgr::Clear();
}
//int SCutMgr::AddMessage( const char* szMsg )
int SCutMgr::AddMessage( const char* szMsg, bool & bSelf ) // 2010.11.29. bintitle. 메세지가 자신에게만 해당되는지 여부 반환.
{
/// 2011.01.19 bool형을 int로 바꿈 - prodongi
STR_LIST strList;
MsgSplit( szMsg, strList, L"|" );
if( strList.size() < 1 ) return 0;//false;
if( ::_stricmp( strList[0].c_str(), "DLIST") == 0 ) //DLIST|name|name|.....
{
strList.erase( strList.begin() );
InfoMember(strList);
strList.clear();
return 1;//true;
}
strList.clear();
return 0;//false;
}
void SCutMgr::InfoMember( STR_LIST& vecText )
{
// 이름|이름|이름|...
// m_bParsing = true;
// m_bIsExist = true;
// m_nCommunityID = 0;
Free();
if( vecText.size() <= 0 ) return;
// m_strCommunityName = "";
// m_strLeaderName = "";
// m_strGuildName = "";
// m_strGulidLeaderName = "";
// m_nMaxLevel = 0;
// m_nMinLevel = 0;
int nCount = static_cast<int>(vecText.size());
int nPos = 0;
for( int nPos = 0; nPos < nCount; nPos++ )
{
SPlayerSlot* pSlot(NULL);
if( !IsExistMember(vecText[nPos].c_str()) ) //아직 등록안된 플레이어니 new로 생성해서 push
{
pSlot = new SPlayerSlot;
m_vecMemberList.push_back(pSlot);
}
else return;
if( pSlot )
pSlot->SetName( vecText[nPos].c_str() );
}
// if( static_cast<int>(m_vecMemberList.size()) == 1 )
// m_nMinLevel = m_nMaxLevel;
}