// AtumApplication.cpp: implementation of the CAtumApplication class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Frustum.h"
#include "AtumApplication.h"
#include "time.h"
#include <stdio.h>
#include "AtumProtocol.h"
#include "ChatMoveData.h"
#include <fcntl.h>
#include "ObjectChild.h"
#include "RainData.h"
#include "shellapi.h"

#include <D3DUtil.h>
#include "D3DFont.h"
#include "DXUtil.h"
#include "dsutil.h"
#include "KeyBoardInput.h"
#include "Camera.h"
#include "UnitRender.h"
#include "CharacterRender.h"				// 2005-07-21 by ispark
#include "D3DHanFont.h"
// 2008-11-13 by bhsohn 조이스틱 작업
#include "JoyStickInput.h"					
#include "JoyStickFreedback.h"
// end 2008-11-13 by bhsohn 조이스틱 작업

// 2007-11-22 by bhsohn 아레나 통합서버
#include "FieldWinSocket.h"
#include "FieldWinSocketManager.h"
#include "IMSocket.h"
#include "IMSocketManager.h"

#include "ShuttleChild.h"
#include "CharacterChild.h"					// 2005-07-21 by ispark
#include "ChatRender.h"
#include "Chat.h"
#include "WeaponFastData.h"
#include "WeaponMissileData.h"
#include "WeaponRocketData.h"
//#include "WeaponMonsterData.h"
#include "WeaponMineData.h"
#include "WeaponFireData.h"
#include "AppEffectData.h"
//#include "WeaponBundleData.h"
#include "InitThread.h"
#include "MapInitThread.h"
//#include "TraceRender.h"
#include "ItemData.h"
#include "objectDefine.h"
#include "EffectRender.h"
#include "Interface.h"
#include "AbuseFilter.h"
#include "Weapon.h"
#include "Skill.h"
#include "SkillInfo.h"
#include "ClientParty.h"

// remodeling, 2004-03-19 by dhkwon
#include "AtumSound.h"
#include "SceneData.h"
#include "AtumDatabase.h"
#include "UnitData.h"	// shuttle, enemy 공통 파일
#include "INFStageEffect.h"


#include "INFWindow.h"
#include "INFGameMain.h"
#include "INFSelect.h"
#include "INFCityBase.h"
#include "MonsterData.h"
#include "EnemyData.h"
#include "StoreData.h"
#include "INFTrade.h"
#include "INFCommunity.h"
#include "INFCommunityParty.h"
#include "INFCityWarp.h"
#include "INFMapLoad.h"
// 2008-09-22 by bhsohn EP3 캐릭터 창
//#include "INFCharacterInfo.h"
#include "INFCharacterInfoExtend.h"
#include "INFCommunityGuild.h"
#include "INFChannelList.h"
#include "QuestData.h"
//#include "INFShop.h"
#include "INFCreateMenu.h"
#include "INFSelectBack.h"
#include "INFGameMainUnitInfoBar.h"
#include "RangeTime.h"
#include "INFUnitState.h"
//#include "INFNotice.h"
#include "INFCityShop.h"
#include "INFGameMainChat.h"
#include "Background.h"
#include "ETCRender.h"
#include "ItemInfo.h"
#include "RangeTime.h"
#include "INFInven.h"
#include "AtumError.h"
#include "INFCityLab.h"
#include "WeaponItemInfo.h"
#include "INFCityStore.h"
#include "VoipParam.h"
#include "VoipError.h"
#include "INFGameHelpDesk.h"
#include "INFCitySkillShop.h"
#include "TickTimeProcess.h"
#include "SkillEffect.h"
#include "INFCommunityFriend.h"
#include "INFCommunityReject.h"
#include "INFSkill.h"
#include "INFGameCountDown.h"
#include "Cinema.h"
#include "INFDamageView.h"
#include "INFFadeEffect.h"
#include "INFCityAuction.h"
#include "INFCityMission.h"
#include "FxSystem.h"
#include "INFUnitNameInfo.h"
#include "PkNormalTimer.h"
#include "INFCityOccupy.h"
#include "INFCityCashShop.h"
#include "INFOtherCharInfo.h"
#include "INFMp3Player.h"
#include "TutorialSystem.h"
#include "INFGameMainMiniMap.h"
#include "INFTarget.h"
#include "ImageManager.h"
#include "InputManager.h"
#include "CInput.h"
#include "GlobalImage.h"
#include "INFMissionInfo.h"
#include "INFCityBoard.h"
#include "INFCityBazaar.h"
#include "CharacterInfo.h"
#include "INFCityArena.h"
#include "INFGameArena.h"
#include "INFCityWarPointShop.h"

// 전진 기지.
#include "INFCityOutPost.h"
#include "INFGameMainOutPost.h"
#include "INFCityLeader.h"

#include "INFToolTip.h"
#include "INFOpMain.h"

#include "INFChangeCharactor.h"

// 2007-11-22 by bhsohn 아레나 통합서버
#include "ArenaManager.h"

// 2008-04-04 by bhsohn Ep3 커뮤니티 창
#include "INFCommunityLetter.h"
#include "INFCommuPartyCre.h"
#include "INFCommunityGuildManager.h"
#include "INFCommunityGuildSearch.h"
#include "INFCommuPartyInvite.h"
#include "INFCommunityChatRoom.h"

#include "INFListBox.h"

// 2008-08-11 by bhsohn 단독으로 실행 되게끔
#include "SinglePlayGame.h"
// 2008-11-04 by dgwoo LuckyMachine기획 추가.
#include "INFLuckyMachine.h"

// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
//#include "zwave_sdk_client.h"	// 2008-11-28 by bhsohn XignCode추가

#include "INFMissionMain.h"     // 2008-12-09 by dgwoo 미션마스터.



// 2009. 01. 12 by ckPark 선전 포고 시스템

#include "CalendarBuilder.h"
#include "INFMotherShipManager.h"

// end 2009. 01. 12 by ckPark 선전 포고 시스템

#include "WorldRankManager.h"		// 2009-02-13 by bhsohn 월드 랭킹 시스템


// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
#include "InfinityManager.h"
#include "INFInfinity.h"
#include "INFWindow.h"
#include "INFCityInfinityField.h"
#include "INFCityInfinityShop.h"
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

#include "INFOptionMachine.h"

// 2009. 11. 23 by jskim 리소스 로딩 구조 변경
#include "MeshInitThread.h"

#define LOAD_TIME_CHECK 5
// 0.005 초마다 로딩할 메쉬가 있는지 체크한다.
//end 2009. 11. 23 by jskim 리소스 로딩 구조 변경
// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 전송
#include "PetManager.h"
// end 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 전송

// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
#include "INFDissolution.h"
// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현

// 2010. 10. 05 by jskim 맵로딩 구조 변경
#include "MapLoad.h"
// end 2010. 10. 05 by jskim 맵로딩 구조 변경


#include "CustomOptimizer.h"

#include "textures.h"
#include "dshowtextures.h"

// 2011. 1. 18 by jskim 배트남 VTC가드
#include "VTCThread.h"
// end 2011. 1. 18 by jskim 배트남 VTC가드

#include "zwave_sdk_client.h"	  // 2012-10-13 by jhahn 핵쉴드->Xigncode변경

#include "INFMenuList.h"	// 2012-07-12 by isshin 아템미리보기 On / Off 기능 - 공개 여부
	  
// 2013-11-29 by ssjung 거래소 구현
#include "INFTradeItemCenter.h"
#include "INFTradeItemAdd.h"
#include "INFTradeItemBuy.h"
#include "INFTradeMyItemShow.h"	   
// end 2013-11-29 by ssjung 거래소 구현
// 2014-01-15 by ssjung 파괴 경매장 구현
#include "INFReturnAuctionCenter.h"
#include "INFReturnAuctionList.h"
#include "INFReturnMyAuctionList.h"	
// end 2014-01-15 by ssjung 파괴 경매장 구현

#include "Profiler.h"	// 2014-06-09 by ymjoo 프로파일러 구현

#define _TIMER_ALIVE (WM_USER_BASE + 5)
#define _TIMER_MOVE (WM_USER_BASE + 6)

#define REG_CHAT_VIEW_COUNT			37

//#define SLEEP_TIMER_TEMP					4.0f

// 2006-06-05 by ispark
int __stdcall HS_MainCallbackProc ( long lCode, long lParamSize, void* pParam );
// 2012-10-13 by jhahn 핵쉴드->Xigncode변경
xstatus XCALL MyUserInfoCallback(xuint iid,xstr buffer,xsize size, xpvoid context);
xbool CALLBACK AceOnlineXigncodeCallback(ULONG Code , ULONG W , PVOID L , PVOID Context); // 2012-10-17 by bhsohn XignCode작업
#define				GAME_GUARD_FOLDER		"Xigncode"
//end 2012-10-13 by jhahn 핵쉴드->Xigncode변경
//////////////////////////////////////////////////////////////////////
// 스크린샷 관련 암호와 코드
// ydkim 2004.06.12
//////////////////////////////////////////////////////////////////////

#define XOR_ENCODE_SCREENSHOT_60BYTE		"5%$#djfnskdnf%l10d5fn*^%$djfner20dn&^%fjesdas0$^&%sdwfvvskdi56*$%$#"

// 2012-03-21 by hskim, 핵쉴드 기능 추가 [자동 업데이트/옵션 추가/모니터링 시스템]
#include "ConfigHackShield.h"
// 2012-03-21 by hskim, 핵쉴드 기능 추가 [자동 업데이트/옵션 추가/모니터링 시스템]

// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
#if defined(LANGUAGE_VIETNAM)
		#define XTRAP_LICENCE_CODE					XTRAP_KEY_STRING
#endif
// 2010. 11. 05 by jskim 게임가드 적용 (아르헨티나)
#if defined(LANGUAGE_ARGENTINA)
		#define XTRAP_LICENCE_CODE					XTRAP_KEY_STRING
#endif
// end 2010. 11. 05 by jskim 게임가드 적용 (아르헨티나)
//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)

// 2007.04.24 by bhsohn China IME Working
#define IME_POS_SELECT_X						(g_pD3dApp->GetBackBufferDesc().Width /2 +165)
#define IME_POS_SELECT_Y						(g_pD3dApp->GetBackBufferDesc().Height - 127)

#define IME_POS_CREATE_X						(g_pD3dApp->GetBackBufferDesc().Width /2 + 112)
#define IME_POS_CREATE_Y						(g_pD3dApp->GetBackBufferDesc().Height - 127)

#define IME_POS_GAME_X							((g_pD3dApp->GetBackBufferDesc().Width - 254)/2)+26
#define IME_POS_GAME_Y							(g_pD3dApp->GetBackBufferDesc().Height - 70)

// 2007-05-21 by bhsohn China IME Working
#define IME_TYPE_SHOW_TIME						30

// 2008-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
#ifdef LANGUAGE_CHINA
	#define TIME_COMPULSION_CAP						30000.0f	// 60초*1000(ms) = 60000(ms)
#else
	#define TIME_COMPULSION_CAP						60000.0f	// 60초*1000(ms) = 60000(ms)
#endif


// 2008-01-16 by bhsohn 1초동안 강제로 클라이언트 멈추게했을시, 무브 패킷을 보냄
#define TIME_MOVE_CAP							1000.0f		// 1초*1000(ms) = 1000(ms)

// 2008-06-20 by bhsohn EP3 옵션관련 처리
#define WND_LOCK_PIXEL_CAP							10		// 윈도우 락 픽셀

// 2008-11-13 by bhsohn 조이스틱 작업
// 컨트롤 체크 시간
#define	JOYSTICK_CHECK_TIME							0.033f		// 1000/30(프레임) = 33(ms) = 0.033f
// 진동 시간
#define	JOYSTICK_FEED_TIME							2.50f		// 


// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
//////////////////////// 게임 가드 설정////////////////////////
//
// #define		USE_GAMEGUARD_NONE					0		//게임가드 사용안함
// #define		USE_GAMEGUARD_AHNLAB_HACKSHIELD		1		//핵쉴드 게임가드
// #define		USE_GAMEGUARD_XIGNCODE				2		//Xign 게임가드
// 
// #if defined(TAIWAN_RELEASE)	
// 	// XIGNCode
// 	#define		GAMEGUARD_TYPE					USE_GAMEGUARD_XIGNCODE
// // 2008-12-04 by bhsohn Japan Working
// #elif defined(LANGUAGE_RUSSIA) || defined(LANGUAGE_JAPAN) || defined(_DEBUG) || defined(GAMEFORGE_RELEASE)
// 	// 게임가드 사용안함
// 	#define		GAMEGUARD_TYPE 					USE_GAMEGUARD_NONE
// #else
// 	// 핵쉴드
// 	#define		GAMEGUARD_TYPE					USE_GAMEGUARD_AHNLAB_HACKSHIELD		
// #endif
// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)	
	#include "zwave_sdk_client.h"	// XignCode추가
#endif
// end 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가

// 2009-01-28 by bhsohn nProtector 게임 가드 추가
#define		GAME_GUARD_nPROTECTOR_CHECK_TIME		(10.0f)
// end 2009-01-28 by bhsohn nProtector 게임 가드 추가
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
#define		GAME_GUARD_XTRAP_CHECK_TIME				(60.0)   // 60초 
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)

// 2009-02-03 by bhsohn 스크린샷 폴더 생성
#define SCREENSHOT_FILE_PATH			".\\ScreenShot\\"	
// end 2009-02-03 by bhsohn 스크린샷 폴더 생성


// 2012-11-07 by bhsohn 베트남 패킷 처리
#define CLIENT_LIVE_CHECK_TIME			1.0f
#define MAX_CLIENT_LIVE_TIME			3.0f
// END 2012-11-07 by bhsohn 베트남 패킷 처리

#define  WAR_MONSTER_WARNING_TIME		600.0f							   // 2013-08-23 by ssjung 거점전 리뉴얼

#define PVP_BUFF_MIN_PERCENT			15								// 2014-06-18 by ymjoo 화면 상단에 세력 표시

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
LPDIRECT3DDEVICE9		g_pD3dDev = NULL;	// D3D디바이스객체 PTR
CAtumApplication    *	g_pD3dApp = NULL;
CAtumSJ				*	g_pAtumSJ = NULL;
sOPTION_SYSTEM		*	g_pSOption = NULL;
sOPTION_CHARACTER	*	g_pSOptionCharacter = NULL;
PROCESS_INFORMATION		g_infoAssistProcess;
// 2008-06-20 by bhsohn EP3 옵션관련 처리
sOPTION_ETC*			g_pSOptionEtc = NULL;
// 2008-11-13 by bhsohn 조이스틱 작업
structJoyStickOptionInfo*		g_pJoysticOp = NULL;

CSceneData				*g_pScene = NULL;
CShuttleChild			*g_pShuttleChild = NULL;
CCharacterChild			*g_pCharacterChild = NULL;
CAtumDatabase			*g_pDatabase = NULL;
CInterface				*g_pInterface = NULL;
CINFGameMain			*g_pGameMain = NULL;
CStoreData				*g_pStoreData = NULL;
CQuestData				*g_pQuestData = NULL;
CCamera					*g_pCamera = NULL;
CBackground				*g_pGround = NULL;
// 2007-11-22 by bhsohn 아레나 통합서버
//CFieldWinSocket			*g_pFieldWinSocket = NULL;
//CIMSocket				*g_pIMSocket = NULL;
CFieldWinSocketManager			*g_pFieldWinSocket = NULL;
CIMSocketManager				*g_pIMSocket = NULL;

CINFSelect				*g_pSelect = NULL;
CINFChannelList			*g_pChannelList = NULL;
CFrustum				*g_pFrustum = NULL;
CTutorialSystem			*g_pTutorial = NULL;
CImageManager			*g_pImgManager = NULL;
CInputManager			*g_pInputManager = NULL;
CInput					g_input;
CGlobalImage			*g_pGImage;

float					g_fSendMovePacket = 0;
BOOL					g_bDetailDrawFrame = FALSE;
BOOL					g_bEventRecovery = FALSE;
float					g_fEventRecoveryRate = 0;
ATUM_DATE_TIME			g_ServerDateTime;			// 2006-10-11 by ispark, 서버 시간
int						g_GameStartTime = 0;		// 2006-10-11 by ispark, 게임 시작 시간
// 2009. 08. 19 by jsKim 랜딩 중 메뉴 생성할 경우 커서가 변하지 않는 버그
// 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정
//int						g_INFCnt = 0;
// end 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정
// end 2009. 08. 19 by jsKim 랜딩 중 메뉴 생성할 경우 커서가 변하지 않는 버그
// 2009. 09. 10 by jsKim 아레나 진입시 시작 카운터 버그 수정
ATUM_DATE_TIME			g_ArenaServerDateTime;		
int						g_ArenaStartTime = 0;		
// end 2009. 09. 10 by jsKim 아레나 진입시 시작 카운터 버그 수정
#ifdef _DEBUG

int						g_nMoveCountPerRate;
int						g_nMoveCountPerPacket;
float					g_fMoveCountFrame;
DWORD					g_dwDebugFogColor = D3DCOLOR_ARGB(0,205,210,180);
float					g_pDebugFogStartDistance = 1000.0f;
float					g_pDebugFogEndDistance = 5000.0f;
D3DXVECTOR3				g_vDebugLightDirection = D3DXVECTOR3(1,-0.5,1);

int						g_nMissileCount = 0;
#endif // _DEBUG_endif
int						g_nRenderCandidate = SET_MAIN_CHAT_CANDIDATE;		// IME관련 후보리스트 출력 위치


LPDIRECT3DVERTEXBUFFER9 g_pVB        = NULL; // Buffer to hold vertices


CComPtr<IGraphBuilder>  g_pGB;          // GraphBuilder
CComPtr<IMediaControl>  g_pMC;          // Media Control
CComPtr<IMediaPosition> g_pMP;          // Media Position
CComPtr<IMediaEvent>    g_pME;          // Media Event
CComPtr<IBaseFilter>    g_pRenderer;    // our custom renderer



struct ArenaTeamInfo
{
	template<typename T>
		BOOL operator()(const T pPtr1, const T pPtr2)
	{
		if(pPtr1.ArenaMode < pPtr2.ArenaMode)
		{
			return TRUE;
		}
		else if(pPtr1.ArenaMode == pPtr2.ArenaMode)
		{
			if(pPtr1.Level < pPtr2.Level)
			{
				return TRUE;
			}
			else if(pPtr1.Level == pPtr2.Level)
			{
				if(pPtr1.MemberCount < pPtr2.MemberCount)
				{
					return TRUE;
				}
				else if(pPtr1.MemberCount == pPtr2.MemberCount)
				{
					if(pPtr1.TeamCount < pPtr2.Level)
					{
						return TRUE;
					}
				}
			}
		}
		
		return FALSE;
	}
};

CAtumApplication::CAtumApplication()
{
#ifdef _FUNCTION_LOG
	GInitFunctionLogSharedMemory();
	STARTUPINFO si = {sizeof(si)};
	CreateProcess(NULL,"atumassist.exe", NULL,NULL,0,0,NULL,NULL,&si,&g_infoAssistProcess);
	SetFocus(GetHwnd());
#endif //_FUNCTION_LOG_endif
	g_pD3dApp = this;
    srand( (unsigned)time( NULL ) );
	m_strWindowTitle	= _T(WINDOWTEXT_NAME_CLIENT);		// 어플리케이션 타이틀
    m_dwCreationWidth   = 800;
    m_dwCreationHeight  = 600;
	m_bUseDepthBuffer   = TRUE;						// 깊이버퍼 이용

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	m_pFontDebugFps = NULL;
	m_pFontDebugErr = NULL;
	m_pFontDebugDBG = NULL;
	m_pFontDebugServer = NULL;
	m_pFontDebugInfl = NULL;
	m_pFontDebugServerUserNum = NULL;
	m_pFontDebugMapUserNum = NULL;
	m_pFontDebugMem = NULL;
	m_pFontDebugObj = NULL;
	m_pFontDebugEffCnt = NULL;
	m_pFontDebugEnemyMovePacket = NULL;
	m_pFontDebugMissileCnt = NULL;
	m_pFontDebugCharacterPos = NULL;
	m_pFontInfl = NULL;
#else
	m_pFontDebug = NULL;
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

	m_pKeyBoard = NULL;

	// 2008-11-13 by bhsohn 조이스틱 작업
	m_pJoyStick = NULL;				// 조이스틱 제어	
	m_fJoyStickCheckTime = 0.0f;	

	m_pJoyStickFreedback = NULL;
	m_fJoyStickFeedbackPlayTime = 0.0f;

	m_nJoyStickFeedbackType =-1;
	m_nJoyContorlLen = 0;
	int nJoyCnt = 0;
	for(nJoyCnt = 0;nJoyCnt < MAX_JOYCTL_LIST;nJoyCnt++)
	{
		memset(m_chJoystickCtrlList[nJoyCnt], 0x00, MAX_PATH);
	}
	
	// end 2008-11-13 by bhsohn 조이스틱 작업

	m_pCamera = NULL;
	m_fElapsedTime = 0.0;
//	m_pShuttleRender = NULL;
	m_pUnitRender = NULL;
	m_pShuttleChild = NULL;
	memset(m_strChat,0x00,SIZE_MAX_CHAT_MESSAGE);

	m_pFontInput = NULL;
	m_pChat = NULL;
	m_bChatMode = FALSE;
	m_bFixUnitDirMode = FALSE;
	m_bMessageBox	= FALSE;
	m_pVBSleep = NULL;
// 2012-07-17 by jhahn, 셧다운 시간 표시
	FristSeting = FALSE;
	nCount = 1;

	nOldTime = NULL;	
	nNewTime = NULL;
//end 2012-07-17 by jhahn, 셧다운 시간 표시
	memset(m_strFieldIP,0x00,sizeof(m_strFieldIP));
	m_nFieldPort = 6003;

	m_pFieldWinSocket = NULL;
	m_bReconnectFieldServer = FALSE;
	m_pIMSocket = NULL;

	m_bOtherFieldWarping = FALSE;

	CFieldWinSocket::SocketInit();

//	m_pInitThread = NULL;
	m_pMapInitThread = NULL;
//	m_bInitializing = TRUE;
	//////////////// weapon ////////////////////
///	m_pWeaponData = NULL;

	InitializeCriticalSection(&m_cs);
	m_pData = NULL;

	m_dwCursor = IDC_CURSOR_YELLOW;
	m_dwIcon = IDI_ICON1;
	m_bShowCursorWhenFullscreen = TRUE;
	m_bShowCursor = FALSE;

	m_vClientOldPos = D3DXVECTOR3(0,0,0);
//	m_dwCurTickTime = 0;
	m_dwSpeedHackTimer = 0;
	m_nCheckRenderPos = 0;
	m_fRenderDeleteCheckTime = 10.0f;

//	m_pItemData = NULL;

	m_nItemStorage = ITEM_IN_CHARACTER;//아이템창,창고 구분

//	m_hWndAtumVoIPClient = NULL;
//	m_bReadyVoIP = FALSE;
//	m_bRinging = 0;
//	m_dwVOIPState = _VOIP_NOTLOGIN;
	memset( &m_VOIPState, 0x00, sizeof(m_VOIPState) );
	m_VOIPState.nVOIPState = _VOIP_ERRORSTATE; // 실행 완료시에 정상 상태로 변경

	m_pEffectRender = NULL;// by dhkwon 2003.5.16


	m_fCheckSocketTime = 10.0f;
	m_fOldTickTime = 0.1f;
	m_fReturnKeyTime = 0.2f;

	m_pEffectList = NULL;

	m_bDebugText = FALSE;

	m_bClientQuit = FALSE;
	// 2012-12-21 by bhsohn 베트남 게임 종료 안되는 문제 해결
	m_bClientLogOff = FALSE;
	// END 2012-12-21 by bhsohn 베트남 게임 종료 안되는 문제 해결

	m_bResCheck = FALSE;

	m_bReadyBeginScene = FALSE;

//	m_hHangulDC = NULL;
//	MakeArrayLevelExperience(m_ArrayLevelExperience);

	m_bDeleteItemSend = FALSE;

	m_pInterface = NULL;
//	m_pAtumIntro = NULL;
	m_IsFullMode = 0;
	m_pAbuseFilter = NULL;
	m_pAbuseFilterData = NULL;
//	m_pHelpData = NULL;
	m_nInvalidClientIndexCont = 0;
	m_fBattleCountCheckTime = -1.0f;
	m_nBattlePartyCount = 0;

	// 2007-04-05 by dgwoo 디테일정도를 High로 모두 그리도록한다.
	m_bDegree = 2;

	memset(m_strDebug,0x00,sizeof(m_strDebug));

	g_pSOption = NULL;
	g_pSOptionCharacter = NULL;
	m_pd3dxSprite= NULL;

	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	g_pSOptionEtc = NULL;

	// 2008-11-13 by bhsohn 조이스틱 작업
	g_pJoysticOp = NULL;
	// end 2008-11-13 by bhsohn 조이스틱 작업

//	m_fDebugCheckValue = 0.0f;

//	memset(m_strHelp,0x00,100*128);
//	m_nHelpNum = 0;
//	m_nHelpCurCont = 0;
//	m_pHelpData =NULL;

//	m_nCurrentUserNum = 0;
	m_fUserCheckTime = 10.0f;
	memset(m_strSeverUserNum,0x00,sizeof(m_strSeverUserNum));
	memset(m_strMapUserNum,0x00,sizeof(m_strMapUserNum));

	// 2012-11-07 by bhsohn 베트남 패킷 처리
	m_fServerLiveTime = 20.0f;
	// END 2012-11-07 by bhsohn 베트남 패킷 처리

	// remodeling, 2004-03-19 by dhkwon
	m_pSound = NULL;
	m_pScene = NULL;
	m_pDatabase = NULL;
	ChangeGameState(_INIT); // SLEEP 적용시 지워야 함
//	m_pTraceRender = NULL;

	m_bReadyToGetGuildInfo = FALSE;
	// 2007-01-07 by bhsohn 길드 정보 동기화 문제 관련 처리
	m_bReadyFieldGameStartOk = FALSE;

	m_pStageEffect = NULL;
	m_pQuestData = NULL;

	// 2004-11-11 by jschoi
	m_nCheckSpeedHackCount = 0;
	m_dwCheckSpeedHackTime = 0;
	m_nSendMovePacketCount = 0;

	m_pFxSystem = new CFxSystem;

	// 2005-02-21 by jschoi - 웹
	m_bWeb = FALSE;

	// 2007-11-27 by bhsohn 테스트 서버 디파인
	m_bTestServerDefine = FALSE;

#ifdef _TEST_SERVER
	m_bTestServer = FALSE;				// 캐쉬샵 사용
	// 2007-11-27 by bhsohn 테스트 서버 디파인
	m_bTestServerDefine = TRUE;
#else
	m_bTestServer = FALSE;				// 캐쉬샵 사용
#endif

	// 2005-02-18 by jschoi - Premium Card Info 
	// 2005-03-18 by jschoi - 수정
	memset(&m_PremiumCardInfo,0x00,sizeof(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO));

	m_bRequestEnable = TRUE;	// 서버로 요청 가능 상태인가?
	m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;


	// 2005-03-25 by jschoi
	m_dwTargetting = OLD2_TARGETTING;	
	
//	m_bLoading = TRUE;
	
//#ifdef _DEBUG
//	m_nDebugTimerMove = 0;
//	m_fDebugTimerCheckTime = 0;
//#endif

	// 2005-03-31 by jschoi
	m_pTutorial = new CTutorialSystem;
//	m_pImgManager = new CImageManager;

	// 2005-05-13 by jschoi
	m_pInputManager = new CInputManager;

	// 2005-05-12 by jschoi
	m_bDeadByP2PPK = FALSE;
	m_vecStingCandidate.clear();
	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
		m_pFontCandidate[i] = NULL;
	m_bCharacter = FALSE;						// 처음에는 기체로 초기 세팅을 한다.
	m_pCharacterChild = NULL;
	ZERO_MEMORY(m_strFont);

	// 2007.04.24 by bhsohn China IME Working
	m_pFontCompositon = NULL;
	m_pFontIMEType = NULL;

	m_nDephbias = -1;							// 초기화 -1은 사용못함
	m_nArmorNum = 0;
	m_nArmorNumMax = 0;

	m_dwHackCheckTime = 0;	// 2005-12-21 by ispark
	m_dwMoveCheckTime = 0;	// 2006-01-10 by ispark
	m_vShuttleOldPos = D3DXVECTOR3(0, 0, 0);

	m_bShutDown = FALSE;						// 2006-07-05 by ispark
	memset(m_strMsgLastError, 0x00, sizeof(m_strMsgLastError));
#ifdef _DEBUG
	m_bEventObjectRender = FALSE;
#endif

	m_bBazaar = FALSE;
	m_bGameShutDown	= FALSE;
	m_fGameShutDownTime = 0.0f;

	m_bCheckQuickSlotSave = FALSE;
	// 2007-02-12 by bhsohn 포커스 잃어 먹었을 떄의 문제 처리
	m_fCheckElapsedTime		= 0.0f;
	m_dwCurrentTime		= 0;
	// end 2007-02-12 by bhsohn 포커스 잃어 먹었을 떄의 문제 처리

	// 2007-02-12 by bhsohn Item 다중 선택 처리
	DelMultiItemList();	
	m_bCtrlBtnClick = FALSE;
	m_bStartMultiSell = FALSE;
	m_bStartMultiStore = FALSE;
	// end 2007-02-12 by bhsohn Item 다중 선택 처리

	// 2007-02-28 by bhsohn 다중 판매시 0 spi에 대한 처리
	memset(&m_struLastSelMultiItem, 0x00, sizeof(stMultiSelectItem));

	// 2007-04-09 by bhsohn 관리자 계정 표출 정보 처리
	memset(m_strConnectSeverName, 0x00, 1024);	
	
	// 2007.04.24 by bhsohn China IME Working
	memset(m_szReadingString, 0x00, 1024);	
	memset(m_szImeString, 0x00, 1024);	
	
	// 2007-05-21 by bhsohn China IME Working
	m_fIMETypeShowTime = IME_TYPE_SHOW_TIME;	

	// 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
	m_nPreComType = 0;
	m_nPreIMComType = 0;	
	m_bInputItemDone = FALSE;

	// 2007-07-24 by bhsohn 나레이션 mp3추가
	memset(&m_chNarrationSound, 0x00, 256);		
	// 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리
	memset(&m_chErNarrationSound, 0x00, 256);			

	m_bInfregular = TRUE;

	// 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
	m_vecSendCharacterOmiInfo.clear();

	// 2007-09-12 by bhsohn 2차 암호 시스템 구현
	m_bIsUseSecondaryPasswordSystem = FALSE;	// 시스템을 사용할지 여부
	m_bIsSetSecondaryPassword = FALSE;		// 암호를 설정했는지 여부
	// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

	// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
	m_bSecondPassLock = FALSE;
	// end 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함

	// 2007-10-30 by dgwoo 아이템 목록이 올경우는 마지막에 한번만 소팅해준다.
	m_bResortingItem = TRUE;

	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	memset(&m_struGameStartInfo, 0x00, sizeof(stGameStartInfo));
	m_bGameStartInfo = FALSE;		

	// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
	InitMultiLockInfo();

	// 2008-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
	m_dwLastestTickTime = 0;

	// 2007-11-22 by bhsohn 아레나 통합서버
	m_pArenaManager = new CArenaManager;

	// 2008-02-15 by bhsohn 네트워크 속도 체크
	memset(&m_stNetCheckInfo, 0x00, sizeof(structNetCheckInfo));

	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	m_fMouseLockTime = 0.0f;
	m_bWndMoving = FALSE;
	m_nOnFriendCount = 0;

	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	m_pSinglePlayGame = new CSinglePlayGame();	

	// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 	
	m_bSendTerm = FALSE;
	m_dwSendTermTime = 0;
	// 2009-01-28 by bhsohn nProtector 게임 가드 추가	
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	m_pNpgl = NULL;
	m_fnProtectorHackCheckTime = GAME_GUARD_nPROTECTOR_CHECK_TIME;
	// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
	m_bMsgHackError = 0;
	// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
#endif
	// end 2009-01-28 by bhsohn nProtector 게임 가드 추가	
	// 2015-01-07 by jwLee 게임포지 nProtector 적용
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR_AUTH3)
		m_pNpAuth3Data = NULL;
		m_pNpAuth3DataCnt = NULL;
#endif
	// end 2015-01-07 by jwLee 게임포지 nProtector 적용

	// 2009-02-13 by bhsohn 월드 랭킹 시스템
	m_pWorldRankManager = new CWorldRankManager();

	// 2009. 11. 24 by ckPark 월드랭킹 사용가능 하도록 변경
// #if defined(LANGUAGE_KOREA)
// 	#ifndef YEDANG_RELEASE
// 		m_pWorldRankManager->SetUseWorldRanking(TRUE);
// 	#endif
// #endif

	m_pWorldRankManager->SetUseWorldRanking( TRUE );
	// end 2009. 11. 24 by ckPark 월드랭킹 사용가능 하도록 변경


	// end 2009-02-13 by bhsohn 월드 랭킹 시스템

	// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	memset(&m_stMultiWarningSelItem, 0x00, sizeof(stMultiSelectItem));
	// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)

	// 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경
	memset( m_nOMICheckSum, 0, sizeof(m_nOMICheckSum) );
	m_nOMIFileSize = 0;
	// end 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경

	// 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	memset( m_nInterfaceCheckSum, 0, sizeof( m_nInterfaceCheckSum ) );
	m_nInterfaceFileSize	= 0;
	// end 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	
	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	m_pInfinityManager		= new CInfinityManager;
	m_ArenaSocketType		= ARENASOCKET_NONE;		// 아레나 소켓 타입
	m_bInfinityMapload		= FALSE;
	m_bEnterInfinityAllowed	= FALSE;				// 인피니티 입장 허가
	m_bInfinityRestart		= FALSE;
	m_bAddInfinityRestartMessageBox	= FALSE;
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템


	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	m_bWaitInfinityMapLoad	= FALSE;

	m_nInfinityMapLoadTime	= 0;

	memset( &m_ArenaStartPacket, 0, sizeof( MSG_FC_ARENA_POSSIBLE_GAMESTART ) );
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)


	// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
	m_bInfinityMapLoadedSendEnable	= FALSE;
	m_bInfinitySkillSetupOKDone		= FALSE;
	// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)


	// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
	#if defined( DEFINE_USE_GAMEGUARD_APEX )
	m_pApexfp_rec = NULL;
	#endif
	// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업

	// 2009. 11. 23 by jskim 리소스 로딩 구조 변경
 	m_dwTimeCheck		= timeGetTime();	
	m_pMeshInitThread	= new CMeshInitThread;
	// 2014-08-18 by ymjoo 싱글스레드로 변경
#ifndef C_GAME_SINGLE_THREAD_YMJOO
	m_pMeshInitThread->CreateThread();
#endif
	// END 2014-08-18 by ymjoo 싱글스레드로 변경
	m_pLoadingGameData = NULL;
	//end 2009. 11. 23 by jskim 리소스 로딩 구조 변경
    // 2010. 10. 05 by jskim 맵로딩 구조 변경
	m_pMaploading	   = new CMapLoad;		 
    // end 2010. 10. 05 by jskim 맵로딩 구조 변경
	// 2011. 10. 10 by jskim UI시스템 변경
	m_pImageList  = new CINFImageList;
	// end 2011. 10. 10 by jskim UI시스템 변경

	// 2011. 1. 18 by jskim 배트남 VTC가드
	m_fnVTCDLLInit		= NULL;
	m_fnVTCDLLGetStatus	= NULL;
	m_fnVTCDLLSetUser	= NULL;
	m_fnVTCDLLExit		= NULL;
	// end 2011. 1. 18 by jskim 배트남 VTC가드
   	m_vecWearDisplayInfo.clear();	// 2012-06-14 by isshin 아템미리보기
	// 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정
	m_nINFCnt = 0;
	// end 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정

	// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
	m_nItemNum = 0;
	// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
	m_bIsTestServerConnect = FALSE;	// 2012-11-28 by jhjang 테섭 접속 여부 처리 추가
	m_nDBSid = 0;

	//2013-04-11 by ssjung 모선전 준비상태일 때 맵 이동시 다시 뮤직플레이어 되는 상황수정
	m_bBossMonsterSummeryReady = FALSE;
	m_byInfluence = NULL;
	//end 2013-04-11 by ssjung 모선전 준비상태일 때 맵 이동시 다시 뮤직플레이어 되는 상황수정

	// 2013-05-07 by bhsohn 웹캐쉬 상점 인증키 추가
	memset(m_chAuthenticationKey, 0x00, SIZE_MAX_WEB_AUTHENTICATION_KEY);  
	// END 2013-05-07 by bhsohn 웹캐쉬 상점 인증키 추가

	// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
	memset(&m_structInflConVictorites, 0x00, sizeof(m_structInflConVictorites));  
	// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템

	m_bInitFlag = FALSE;		// 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정

	m_fServerLockTime = 0.0f;// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템

	m_fPVPBuffPercent = 0.0f;		// 2013-08-02 by ssjung 역전의 버프 툴팁표시

	m_bTradeCenterLock = FALSE;					 // 2013-11-29 by ssjung 거래소 구현

	m_bCityShopLock = FALSE;		// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정

	// 2014-01-06 by bhsohn Xtrap 테스트서버 키 다르게 처리	
	m_bArgcTestServer = FALSE;			// Launcher에서 알려주는 Test서버 여부
	// END 2014-01-06 by bhsohn Xtrap 테스트서버 키 다르게 처리	

	m_pProfiler = NULL;		// 2014-06-09 by ymjoo 프로파일러 구현

	m_SuperiorInfluenceType = NULL;		// 2014-06-18 by ymjoo 화면 상단에 세력 표시

	m_bDamageSysMessagePrint = FALSE;	// 2014-12-19 by jwLee "/데미지출력" 명령어 추가
}

CAtumApplication::~CAtumApplication()
{
	FLOG( "~CAtumApplication()" );
	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	SAFE_DELETE(m_pSinglePlayGame);

	// 2007-11-22 by bhsohn 아레나 통합서버
	SAFE_DELETE(m_pArenaManager);	 

	CFieldWinSocket::SocketClean();

	SAFE_DELETE( m_pFxSystem );
	SAFE_DELETE( m_pTutorial );
	SAFE_DELETE( m_pInputManager );
//	SAFE_DELETE( m_pImgManager );
	
	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
		SAFE_DELETE(m_pFontCandidate[i]);

	// 2007.04.24 by bhsohn China IME Working
	SAFE_DELETE(m_pFontCompositon);
	SAFE_DELETE(m_pFontIMEType);	 

	m_vecCharacterOtherInfo.clear();
	m_vecCharacterOtherInfoRequest.clear();
	m_vecCharacterOtherMove.clear();
	m_vecCharacterOtherRenderInfo.clear();
	m_vecCharacterOtherRenderInfoRequest.clear();
	m_vecMoveTarget.clear();

	m_vecMapObjectInfo.clear();
	m_vecMonsterInfo.clear();
	m_vecSimpleItemInfo.clear();
	m_vecItemInfo.clear();

	// 2012-06-14 by isshin 아템미리보기
	vector<CItemInfo*>::iterator itItem = m_vecWearDisplayInfo.begin();
	while(itItem != m_vecWearDisplayInfo.end())
	{
		SAFE_DELETE(itItem);
		itItem++;
	}
	m_vecWearDisplayInfo.clear();
	// end 2012-06-14 by isshin 아템미리보기

// 2009-01-28 by bhsohn nProtector 게임 가드 추가
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	SAFE_DELETE(m_pNpgl);
#endif

	// 2007-02-12 by bhsohn Item 다중 선택 처리
	m_bCtrlBtnClick = FALSE;
	DelMultiItemList();
	// end 2007-02-12 by bhsohn Item 다중 선택 처리

	// 2009-02-13 by bhsohn 월드 랭킹 시스템
	SAFE_DELETE(m_pWorldRankManager);
	// end 2009-02-13 by bhsohn 월드 랭킹 시스템

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	SAFE_DELETE( m_pInfinityManager );
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	
	// 2009. 11. 23 by jskim 리소스 로딩 구조 변경
	SAFE_DELETE( m_pMeshInitThread );
	//end 2009. 11. 23 by jskim 리소스 로딩 구조 변경

    // 2010. 10. 05 by jskim 맵로딩 구조 변경
	SAFE_DELETE( m_pMaploading );
    // end 2010. 10. 05 by jskim 맵로딩 구조 변경

#ifdef DEFINE_USE_GAMEGUARD_VTC
	// 2011. 1. 18 by jskim 배트남 VTC가드
	if(m_pVTCGuard)
	{
		SAFE_DELETE( m_pVTCGuard );
	}
	// end 2011. 1. 18 by jskim 배트남 VTC가드
#endif


	SAFE_DELETE(m_pProfiler); // 2014-06-09 by ymjoo 프로파일러 구현
}
#ifdef _DEBUG
const char *GetGameStateString(DWORD dwState)
{
	switch(dwState)
	{
	case _LOGO:
		return "_LOGO";
	case _INIT:
		return "_INIT";
	case _SELECT:
		return "_SELECT";
	case _CREATE:
		return "_CREATE";
	case _OPTION:
		return "_OPTION";
	case _MAPLOAD:
		return "_MAPLOAD";
	case _GAME:
		return "_GAME";
	case _SHOP:
		return "_SHOP";
	case _CITY:
		return "_CITY";
	case _WAITING:
		return "_WAITING";
	case _GAMEOVER:
		return "_GAMEOVER";
	case _COMPLETE:
		return "_COMPLETE";
	case _PROLOGUE:
		return "_PROLOGUE";
	case _ENDGAME:
		return "_ENDGAME";
	case _ENDCLIENT:
		return "_ENDCLIENT";
	default:
		return "_N_DEFINED_STATE";
	}
	return "_N_DEFINED_STATE";
}
#endif // _DEBUG_endif

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::ChangeGameState(DWORD dwType, BOOL bSet)
/// \brief		게임 상태 변경
/// \author		dhkwon
/// \date		2004-06-02 ~ 2004-06-02
/// \warning	bSet이 FALSE이면 SLEEP상태로 넘어가서 FrameMove에서 일정 시간 후에
///				m_nNextState로 Set하게 된다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::ChangeGameState(DWORD dwType, BOOL bUseThread/*=FALSE*/)
{
	FLOG("CAtumApplication::ChangeGameState(DWORD dwType)");
#ifdef _DEBUG
	DBGOUT( "--------------------Change Game State : %s --> %s------------------------\n",
		GetGameStateString(m_dwGameState), GetGameStateString(dwType) );
#endif //_DEBUG_endif

	// by bhsohn 2007-03-12 China Working
	// 2009-01-12 by bhsohn Japan Working
#ifdef IS_USE_ONOFF_IME
//#ifdef LANGUAGE_CHINA
	if(_CREATE == dwType 
		|| _SELECT == dwType )
	{
		// 2007.04.24 by bhsohn China IME Working
		g_pD3dApp->m_inputkey.EnableIMEControl(TRUE);
		
	}
	else if(_GAME == dwType )
	{		
		// 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
		//g_pD3dApp->m_inputkey.EnableIMEControl(FALSE);
		if(FALSE == bUseThread)
		{			
			// 맵로드 쓰레드에서 IME를 크면 문제가 발생한다.
			g_pD3dApp->m_inputkey.EnableIMEControl(FALSE);
		}
		// end 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
	}		
#endif
	// end by bhsohn 2007-03-12 China Working

	if( m_dwGameState != _GAME && 
		m_dwGameState != _SHOP && 
		m_dwGameState != _CITY && 
		(dwType == _GAME || 
		dwType == _SHOP ||
		dwType == _CITY))
	{
		m_pScene->SetObjectRenderList();
	}
	if(m_pSound)
	{
		if(g_pGameMain && g_pGameMain->m_pMp3Player)
		{
			 if( g_pGameMain->m_pMp3Player->m_bMp3Play == FALSE 
				 || dwType == _ENDGAME  || dwType == _ENDCLIENT
				 || dwType == _GAMEOVER || dwType == _SCRIPT
				 || dwType == _COMPLETE || dwType == _WAITING)
			 {
				 m_pSound->SetBackMusic(dwType);
			 }
		}
		else
		{
			m_pSound->SetBackMusic(dwType);
		}		
	}
	// 연출 관련 세팅
	switch(dwType)
	{
	case _CITY:
		{
			// 토글형 무기가 장착되어 있을 경우 무기 사용을 중지시킨다.
			if(m_pShuttleChild && m_pShuttleChild->m_pSecondaryWeapon)
			{ 
				m_pShuttleChild->m_pSecondaryWeapon->ReleaseAllUsingToggleWeapon();
			}	
			// 2004-11-19 by jschoi
			// 도시에 진입시에 사용중인 모든 스킬을 해제한다. --- 서버 요청
			if(m_pShuttleChild && m_pShuttleChild->m_pSkill)
			{
				m_pShuttleChild->m_pSkill->ReleaseAllUsingSkillWithOutPermanent();
				// 2007-04-05 by bhsohn 빅붐 버그 처리
				// 과거 스킬초기화
				g_pShuttleChild->m_pSkill->InitPreSkillItemNum();
			}
			StartFadeEffect(TRUE,1,D3DCOLOR_ARGB(0,0,0,0));
		}
		break;
	case _GAME:
		{
			// 2007-07-25 by bhsohn 유저가 튜토리얼맵에 있어서 마을로 갔을시, 첫번쨰 유저로 간주
			CHARACTER myShuttle = m_pShuttleChild->GetMyShuttleInfo();
			if(g_pTutorial->GetFirstUserIntoFreeSka() == TRUE	// 프리스카 맵에 처음 진출이냐?
				&&(FALSE == IS_TUTORIAL_MAP_INDEX(myShuttle.MapChannelIndex.MapIndex)))	// 현재 맵이 튜토리얼이 아니다.
			{
				g_pGameMain->FirstUserShowMissionTreeWnd();
				g_pTutorial->SetFirstUserIntoFreeSka(FALSE);
			}
			// 2007-09-07 by dgwoo 맵로딩이 끝나고 전진기지전 맵 & 전진기지전 전맵 일경우
			g_pGameMain->m_pOutPost->SetOutPostImgShow();

			InitSpeedHackTimer();
			if( m_dwGameState != _GAME &&
				m_dwGameState != _SHOP && 
				m_dwGameState != _SCRIPT)
			{
				StartFadeEffect(TRUE,1,D3DCOLOR_ARGB(0,0,0,0));
			}

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			// 맵 로딩이 다 끝났으면 쿨타임 정보 요청
			m_pFieldWinSocket->SendMsg( T_FC_ITEM_GET_COOLINGTIME_INFO, NULL, 0 );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템
		}
		break;
	case _WAITING:
		{
			EndFadeEffect();
			if(m_bClientQuit == TRUE)
			{
				InitStageEffect( STAGE_EFFECT_GAME_WAITING, 247 , TRUE );
			}
		}
		break;
	case _SELECT:
		{
			StartFadeEffect(TRUE,1,D3DCOLOR_ARGB(0,0,0,0));
			// 2008-07-09 by dgwoo 캐릭터 정보가 온 후 위치 셋팅.
			//g_pSelect->m_pSelectBack->ChangeMode(SELECT_MODE);
			
			// 2008-07-10 by bhsohn 셀렉트 화면 기체 높이 갱신
			// 2015-08-10 by jwlee g_pSelect->m_pSelectBack 익셉션 안전 코드 추가
			//g_pSelect->m_pSelectBack->RefreshUnitMatrix();
			if (g_pSelect && g_pSelect->m_pSelectBack)
			{
			g_pSelect->m_pSelectBack->RefreshUnitMatrix();
			}
			// end 2015-08-10 by jwlee g_pSelect->m_pSelectBack 익셉션 안전 코드 추가
			
			// 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
			ResetCharecterOmiInfo();
			// end 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
		}
		break;
		// 2007-07-04 by bhsohn 랜딩 모션중 포탈 탔을시 버그 수정
	case _MAPLOAD:
		{
			m_pShuttleChild->InitUnitState();
			// 2007-10-05 by dgwoo 맵로딩상태에선 FADE IN & OUT을 적용하지 않는다.
			EndFadeEffect();
			// 2007-07-25 by bhsohn 유저가 튜토리얼맵에 있어서 마을로 갔을시, 첫번쨰 유저로 간주
			g_pInterface->ShowOpUserHelper(FALSE, 0, NULL);	

			if ( g_pInterface->m_pBazaarShop )
			{
				g_pInterface->CloseVisitShop();
			}

		}
		break;
		// end 2007-07-04 by bhsohn 랜딩 모션중 포탈 탔을시 버그 수정
	default:
		{
			EndFadeEffect();
		}
		break;
	}
	m_dwGameState = dwType;
}
// 2007-07-20 by bhsohn 브리핑룸 수정
DWORD CAtumApplication::GetGameState()
{
	return m_dwGameState;
}

HRESULT CAtumApplication::FinalCleanup()
{
	FLOG( "CAtumApplication::FinalCleanup()" );

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	SAFE_DELETE(m_pFontDebugFps);
	SAFE_DELETE(m_pFontDebugErr);
	SAFE_DELETE(m_pFontDebugDBG);
	SAFE_DELETE(m_pFontDebugServer);
	SAFE_DELETE(m_pFontDebugInfl);
	SAFE_DELETE(m_pFontDebugServerUserNum);
	SAFE_DELETE(m_pFontDebugMapUserNum);
	SAFE_DELETE(m_pFontDebugMem);
	SAFE_DELETE(m_pFontDebugObj);
	SAFE_DELETE(m_pFontDebugEffCnt);
	SAFE_DELETE(m_pFontDebugEnemyMovePacket);
	SAFE_DELETE(m_pFontDebugMissileCnt);
	SAFE_DELETE(m_pFontDebugCharacterPos);
	SAFE_DELETE(m_pFontInfl);
#else
	SAFE_DELETE(m_pFontDebug);
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

	SAFE_DELETE(m_pKeyBoard);
	SAFE_DELETE(m_pCamera);
	// 2008-11-13 by bhsohn 조이스틱 작업
	SAFE_DELETE(m_pJoyStick);				// 조이스틱 제어
	SAFE_DELETE(m_pJoyStickFreedback);

	SAFE_DELETE( m_pFontInput );
	SAFE_DELETE( m_pChat);

	if(m_pFieldWinSocket)
	{
		m_pFieldWinSocket->CloseSocket();
		SAFE_DELETE( m_pFieldWinSocket );
	}

	if(m_pIMSocket)
	{
		m_pIMSocket->CloseSocket();
		SAFE_DELETE( m_pIMSocket );
	}
//	SAFE_DELETE( m_pInitThread );
	SAFE_DELETE( m_pMapInitThread );

	DeleteCriticalSection( &m_cs );
	SAFE_DELETE( m_pData );
// 	SAFE_DELETE( m_pItemData );
// 	SAFE_DELETE( m_pTraceRender );
	SAFE_DELETE( m_pCharacterChild );				// 2005-07-21 by ispark

	SAFE_DELETE(m_pEffectRender);
	SAFE_DELETE(m_pEffectList);

	KillTimer( m_hWnd, _TIMER_ALIVE);
	KillTimer( m_hWnd, _TIMER_MOVE);

//	if(m_hHangulDC)
//	{
//		DeleteObject(m_hHangulDC);
//	}
	SAFE_DELETE(g_pAtumSJ);
	SAFE_DELETE(g_pSOption);
	SAFE_DELETE(g_pSOptionCharacter);
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	SAFE_DELETE(g_pSOptionEtc);

	// 2008-11-13 by bhsohn 조이스틱 작업
	SAFE_DELETE(g_pJoysticOp);
	// end 2008-11-13 by bhsohn 조이스틱 작업

	// ysw 9_15
	SAFE_DELETE(m_pInterface );
//	SAFE_DELETE(m_pAtumIntro ) ;


//	SAFE_DELETE( m_pShuttleRender );
	SAFE_DELETE( m_pUnitRender );
	SAFE_DELETE( m_pCharacterRender );				// 2005-07-21 by ispark
	SAFE_DELETE( m_pShuttleChild );

	SAFE_DELETE(m_pAbuseFilter);

	SAFE_DELETE(m_pAbuseFilterData);
//	SAFE_DELETE(m_pHelpData);

	m_pDatabase->DeleteDeviceObjects();
	SAFE_RELEASE(m_pd3dxSprite);
	m_pd3dxSprite = NULL;
	// remodeling, 2004-03-19 by dhkwon
	if(m_pSound)
	{
		m_pSound->DeleteDeviceObjects();
		SAFE_DELETE(m_pSound);
	}
	if(m_pScene)
	{
		m_pScene->DeleteDeviceObjects();
		SAFE_DELETE(m_pScene);
	}
	if(m_pDatabase)
	{
		SAFE_DELETE(m_pDatabase);
	}

#ifdef _FUNCTION_LOG
	GCloseFunctionLogSharedMemory();

	DWORD dwExitCode;
	GetExitCodeProcess(g_infoAssistProcess.hProcess, &dwExitCode);
	TerminateProcess(g_infoAssistProcess.hProcess, dwExitCode);
#endif // _FUNCTION_LOG_endif

	SAFE_DELETE(m_pQuestData);
	return S_OK;
}

HRESULT CAtumApplication::OneTimeSceneInit()
{
	FLOG( "CAtumApplication::OneTimeSceneInit()" );

	D3DAdapterInfo* pAdapterInfo = &m_Adapters[m_dwAdapter];
	D3DDeviceInfo*  pDeviceInfo  = &pAdapterInfo->devices[pAdapterInfo->dwCurrentDevice];

	char buf[256];
/*	wsprintf(buf,"DeviceInfo.Inf");
	FILE *	fp;
	fp = fopen(buf,"w+b");
	if(fp)
	{
		fwrite(&pDeviceInfo->d3dCaps,1,sizeof(D3DCAPS8),fp);
		fclose(fp);
	}
*/	
//--------------------------------------------------------------------------//
// 2007-12-17 by dgwoo 릴리즈 모드에서도 창모드 지원.
// 기존 소스.
//#ifdef _DEBUG
//	if(m_IsFullMode)
//	{
//		// 풀화면으로 바꿈
//		m_bWindowed = FALSE;
//		pDeviceInfo->dwCurrentMode = m_dwCurrentMode;
//		pDeviceInfo->bWindowed = FALSE;
//	}
//#else
//	m_bWindowed = FALSE;
//	pDeviceInfo->dwCurrentMode = m_dwCurrentMode;
//	pDeviceInfo->bWindowed = FALSE;
//#endif
// 수정 소스.
// 2007-12-18 by dgwoo 창모드 구현.
	if(m_IsFullMode)
	{// 풀모드.
		m_bWindowed = FALSE;
		pDeviceInfo->dwCurrentMode = m_dwCurrentMode;
		pDeviceInfo->bWindowed = FALSE;
	}else
	{// 창모드.
		m_bWindowed = TRUE;
		pDeviceInfo->dwCurrentMode = m_dwCurrentMode;
		pDeviceInfo->bWindowed = TRUE;
	}
//--------------------------------------------------------------------------//

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	m_pFontDebugFps				= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugErr				= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugDBG				= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugServer			= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugInfl			= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugServerUserNum	= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugMapUserNum		= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugMem				= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugObj				= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugEffCnt			= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugEnemyMovePacket	= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugMissileCnt		= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontDebugCharacterPos	= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
	m_pFontInfl					= new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, TRUE, 1024, 32);
#else
	m_pFontDebug = new CD3DHanFont( _T(g_pD3dApp->GetFontStyle()), 9, D3DFONT_ZENABLE, FALSE, 1024, 32);
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
	m_pKeyBoard = new CKeyBoardInput();
    if( FAILED( m_pKeyBoard->OnCreateDevice(m_hWnd ) ) )
	{
        m_pKeyBoard->FreeDirectInput();
		MessageBox(NULL, STRMSG_C_DIRECTX_0003, WINDOWTEXT_NAME_CLIENT, MB_OK);//"DirectInput 초기화 실패. 키보드 사용을 할 수 없습니다."
	}
	m_pCamera = new CCamera();

//	m_pShuttleRender = new CShuttleRender();
	m_pUnitRender = new CUnitRender();
	m_pCharacterRender = new CCharacterRender();				// 2005-07-13 by ispark
	m_pShuttleChild = new CShuttleChild();
	m_pCharacterChild = new CCharacterChild();					// 2005-07-21 by ispark

//	m_pFontInput = new CD3DHanFont(_T(g_pD3dApp->GetFontStyle()),9, D3DFONT_ZENABLE, FALSE,1024,32,TRUE);
	m_pChat = new CChat();

	// 2007-11-22 by bhsohn 아레나 통합서버
	//m_pFieldWinSocket = new CFieldWinSocket(m_hWnd);	
	//m_pIMSocket = new CIMSocket(m_hWnd);
	m_pFieldWinSocket = new CFieldWinSocketManager(m_hWnd);		
	m_pIMSocket = new CIMSocketManager(m_hWnd);
	

	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	g_pSOptionEtc = new sOPTION_ETC;
	memset(g_pSOptionEtc,0x00,sizeof(sOPTION_ETC));
	InitOptionEtcInfo(g_pSOptionEtc);
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리

	// 2008-11-13 by bhsohn 조이스틱 작업	
	SAFE_DELETE(g_pJoysticOp);
	g_pJoysticOp = new structJoyStickOptionInfo;
	memset(g_pJoysticOp,0x00,sizeof(structJoyStickOptionInfo));		
	InitJoyStickOptionInfo(g_pJoysticOp);
	// end 2008-11-13 by bhsohn 조이스틱 작업

//	m_pInitThread = new CInitThread();

	g_pSOption = new sOPTION_SYSTEM;
	memset(g_pSOption,0x00,sizeof(sOPTION_SYSTEM));
	g_pSOptionCharacter = new sOPTION_CHARACTER;
	memset(g_pSOptionCharacter,0x00,sizeof(sOPTION_CHARACTER));
	m_pInterface = new CInterface;
	m_pInterface->LoadOptionFile();

	// 2008-11-13 by bhsohn 조이스틱 작업
	InitJoyStickDevice(TRUE, TRUE, g_pJoysticOp->chJoySelJoy);	// 조이스틱 장치 초기화
	// end 2008-11-13 by bhsohn 조이스틱 작업

//	m_pTraceRender = new CTraceRender();
	m_pEffectList = new CAtumNode;


	SetTimer( m_hWnd, _TIMER_ALIVE, 15000, NULL);
	SetTimer( m_hWnd, _TIMER_MOVE, 200, NULL);

	g_pAtumSJ = new CAtumSJ;

	m_pAbuseFilter = new CAbuseFilter();
	m_pAbuseFilterData = new CGameData;
	memset(buf,0x00,sizeof(buf));
	strcpy(buf, "asdfasveq45hnsdn");
	m_pAbuseFilterData->SetFile(".\\Res-Tex\\AFList.tex",TRUE,buf,strlen(buf));
//	m_pAbuseFilterData->SetFile(".\\Res-Tex\\AFList.tex",FALSE,NULL,0);
	DataHeader * pHeader = m_pAbuseFilterData->Find("AFList");
	char* p;
	if(pHeader)
	{
		p = pHeader->m_pData;
		int nCheckSize = 0;
		while(nCheckSize < pHeader->m_DataSize)
		{
			int nCheckByte = 0;
			char* p2 = p;
			memset(buf,0x00,sizeof(buf));
			while(1)
			{
				nCheckByte++;
				char bufTemp;
				memcpy(&bufTemp,p2,1);
				if(bufTemp == '\n' || bufTemp == '\r')
				{
					m_pAbuseFilter->AddAbuse(buf);
					break;
				}
				buf[nCheckByte-1] = bufTemp;
				p2 += 1;
			}
			p += nCheckByte;
			nCheckSize += nCheckByte;
		}
	}
/*
	m_pHelpData = new CGameData;
	memset(buf,0x00,sizeof(buf));
	strcpy(buf, "asvawevawe!23r23");
	m_pHelpData->SetFile(".\\Res-Tex\\helptext.tex",TRUE,buf,strlen(buf));
	pHeader = m_pHelpData->Find("help");
	if(pHeader)
	{
		p = pHeader->m_pData;
		int nCheckSize = 0;
		while(nCheckSize < pHeader->m_DataSize)
		{
			int nCheckByte = 0;
			char* p2 = p;
			memset(buf,0x00,sizeof(buf));
			while(1)
			{
				nCheckByte++;
				char bufTemp;
				memcpy(&bufTemp,p2,1);
				if(bufTemp == '\n' || bufTemp == '\r')
				{
					if(strlen(buf)>0)
					{
						strcpy(m_strHelp[m_nHelpNum],buf);
						m_nHelpNum++;
					}
					break;
				}
				buf[nCheckByte-1] = bufTemp;
				p2 += 1;
			}
			p += nCheckByte;
			nCheckSize += nCheckByte;
		}
	}
*/

	m_pDatabase = new CAtumDatabase;
	m_pDatabase->InitDeviceObjects();
	
	// 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경
	char chFullMapPath[MAX_PATH], chMapIdx[64];	
	
	memset(chFullMapPath, 0x00, MAX_PATH);		
	memset(chMapIdx, 0x00, 64);
	
	wsprintf(chMapIdx, "omi.tex");
	strncpy(chFullMapPath, chMapIdx, MAX_PATH);
	
	LoadPath( chFullMapPath, IDS_DIRECTORY_TEXTURE, chMapIdx);

	m_pDatabase->GetOMICheckSum( chFullMapPath, m_nOMICheckSum, &m_nOMIFileSize );
	// end 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경

	// 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	memset(chFullMapPath, 0x00, MAX_PATH);		
	memset(chMapIdx, 0x00, 64);
	
	wsprintf(chMapIdx, "interface.tex");
	strncpy(chFullMapPath, chMapIdx, MAX_PATH);
	
	LoadPath( chFullMapPath, IDS_DIRECTORY_TEXTURE, chMapIdx);
	
	m_pDatabase->GetOMICheckSum( chFullMapPath, m_nInterfaceCheckSum, &m_nInterfaceFileSize );
	// end 2010. 03. 12 by ckPark Interface.tex 체크섬 추가

	m_pSound = new CAtumSound;
	m_pSound->InitDeviceObjects();
	m_pScene = new CSceneData;
	m_pScene->InitDeviceObjects();
	return S_OK;
}

DWORD CAtumApplication::ResourceLoadThread()// by dhkwon, InitDeviceObjects()
{
	FLOG("CAtumApplication::ResourceLoadThread()");

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	if(m_pFontDebugFps)
		m_pFontDebugFps->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugErr)
		m_pFontDebugErr->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugDBG)
		m_pFontDebugDBG->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugServer)
		m_pFontDebugServer->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugInfl)
		m_pFontDebugInfl->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugServerUserNum)
		m_pFontDebugServerUserNum->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugMapUserNum)
		m_pFontDebugMapUserNum->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugMem)
		m_pFontDebugMem->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugObj)
		m_pFontDebugObj->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugEffCnt)
		m_pFontDebugEffCnt->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugEnemyMovePacket)
		m_pFontDebugEnemyMovePacket->InitDeviceObjects(g_pD3dDev);
	if(m_pFontDebugMissileCnt)
		m_pFontDebugCharacterPos->InitDeviceObjects(g_pD3dDev);
	if(m_pFontInfl)
		m_pFontInfl->InitDeviceObjects(g_pD3dDev);
#else
 	if(m_pFontDebug)
 		m_pFontDebug->InitDeviceObjects( g_pD3dDev );//m_nLoadCurrent+=1;
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

//	if(m_pShuttleRender)
//		m_pShuttleRender->InitDeviceObjects();//m_nLoadCurrent+=1;
	if(m_pUnitRender)
		m_pUnitRender->InitDeviceObjects();
	if(m_pCharacterRender)								// 2005-07-21 by ispark
		m_pCharacterRender->InitDeviceObjects();
	if(m_pShuttleChild)
		m_pShuttleChild->InitDeviceObjects();
	if(m_pCharacterChild)								// 2005-07-21 by ispark
		m_pCharacterChild->InitDeviceObjects();
	if(m_pInterface)
	{
		m_pInterface->InitSelectObjects();
//		m_pInterface->InitMapLoadObjects();
	}
	if(m_pChat)
		m_pChat->InitDeviceObjects();//m_nLoadCurrent+=1;
	m_pQuestData = new CQuestData;

	// 2008-11-11 by bhsohn 퀘스트 CheckSum추가
	m_pQuestData->RefreshQuestCheckSum();
	return 0;
}

DWORD CAtumApplication::ResourceRestoreThread()// by dhkwon
{
	FLOG("CAtumApplication::ResourceRestoreThread()");

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	if(m_pFontDebugFps)
		m_pFontDebugFps->RestoreDeviceObjects();
	if(m_pFontDebugErr)
		m_pFontDebugErr->RestoreDeviceObjects();
	if(m_pFontDebugDBG)
		m_pFontDebugDBG->RestoreDeviceObjects();
	if(m_pFontDebugServer)
		m_pFontDebugServer->RestoreDeviceObjects();
	if(m_pFontDebugInfl)
		m_pFontDebugInfl->RestoreDeviceObjects();
	if(m_pFontDebugServerUserNum)
		m_pFontDebugServerUserNum->RestoreDeviceObjects();
	if(m_pFontDebugMapUserNum)
		m_pFontDebugMapUserNum->RestoreDeviceObjects();
	if(m_pFontDebugMem)
		m_pFontDebugMem->RestoreDeviceObjects();
	if(m_pFontDebugObj)
		m_pFontDebugObj->RestoreDeviceObjects();
	if(m_pFontDebugEffCnt)
		m_pFontDebugEffCnt->RestoreDeviceObjects();
	if(m_pFontDebugEnemyMovePacket)
		m_pFontDebugEnemyMovePacket->RestoreDeviceObjects();
	if(m_pFontDebugMissileCnt)
		m_pFontDebugCharacterPos->RestoreDeviceObjects();
	if(m_pFontInfl)
		m_pFontInfl->RestoreDeviceObjects();
#else
	if(m_pFontDebug)
	 	m_pFontDebug->RestoreDeviceObjects();//m_nLoadCurrent+=1;
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

//	if(m_pShuttleRender)
//		m_pShuttleRender->RestoreDeviceObjects();//m_nLoadCurrent+=1;
	if(m_pUnitRender)
		m_pUnitRender->RestoreDeviceObjects();
	if(m_pCharacterRender)									// 2005-07-21 by ispark
		m_pCharacterRender->RestoreDeviceObjects();
	if(m_pShuttleChild)
		m_pShuttleChild->RestoreDeviceObjects();
	if(m_pCharacterChild)									// 2005-07-21 by ispark
		m_pCharacterChild->RestoreDeviceObjects();
//		m_pShuttleChild->RestoreChat();//m_nLoadCurrent+=1;
	if(m_dwGameState == _SELECT || m_dwGameState == _CREATE )
	{
		if(m_pInterface)
		{
			m_pInterface->RestoreSelectObjects();
		}
	}
	else if(m_dwGameState == _GAME || 
		m_dwGameState == _SHOP || 
		m_dwGameState == _CITY ||
		// 2010. 03. 05 by jskim 맵 로딩 중 윈도우 화면 전환시 튕기는 버그 수정
		//m_dwGameState == _SCRIPT)
		m_dwGameState == _SCRIPT ||
		m_dwGameState == _MAPLOAD)	
		//end 2010. 03. 05 by jskim 맵 로딩 중 윈도우 화면 전환시 튕기는 버그 수정
	{
		m_pInterface->RestoreGameObjects();
		m_pInterface->RestoreCityObjects();
		if(m_dwGameState == _SCRIPT)
		{
			m_pInterface->RestoreSoundScript();
		}
	}
	if(m_pChat)
		m_pChat->RestoreDeviceObjects();//m_nLoadCurrent+=1;
	return 0;
}

VOID CAtumApplication::NetworkErrorMsgBox( char* strMsg)
{
	FLOG("CAtumApplication::NetworkErrorMsgBox( char* strMsg)");
	DWORD dR = 0;
	m_bShutDown = TRUE;

	strncpy(m_strMsgLastError, strMsg, strlen(strMsg) + 1);

//	if(g_pD3dDev)
//	{
//		dR = g_pD3dDev->SetDialogBoxMode(TRUE);
//	}

//	if(dR)
//	{
//		MessageBox(m_hWnd, strMsg, "SpaceCowboy", MB_OK);
		DBGOUT("[WM_CLOSE]CAtumApplication::NetworkErrorMsgBox(%s) ", strMsg );
#ifdef C_CLIENT_FILE_LOG
		g_cCustomOptimizer.WriteLog("[WM_CLOSE]CAtumApplication::NetworkErrorMsgBox"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
		PostMessage(m_hWnd, WM_CLOSE, 0, 0);
//	}
//	else
//	{
//		MessageBox(NULL, strMsg, "SpaceCowboy", MB_OK);
//		SendMessage(m_hWnd,WM_CLOSE,0,0);
//	}


	// 2006-07-04 by ispark, 종료 메세지 처리
//	SendMessage(m_hWnd,WM_CLOSE,0,0);
//	if(m_pInterface)
//	{
//		CINFWindow* pWindow = NULL;
//		if(g_pGameMain)
//			pWindow = g_pGameMain->m_pInfWindow;
//		else if(g_pSelect)
//			pWindow = g_pSelect->m_pInfWindow;
//		if(pWindow)
//		{
//			pWindow->AddMsgBox(strMsg, _MESSAGE_ERROR_NETWORK);
//		}
//		else
//		{
//			g_pD3dDev->SetDialogBoxMode(TRUE);
//			MessageBox(m_hWnd, strMsg, "SpaceCowboy", MB_OK);
//		}
//	}
//	else
//	{
//		g_pD3dDev->SetDialogBoxMode(TRUE);
//		MessageBox(m_hWnd, strMsg, "SpaceCowboy", MB_OK);
//	}
//	
//	if(	m_dwGameState == _LOGO ||
//		m_dwGameState == _INIT )
//	{
//		g_pD3dDev->SetDialogBoxMode(TRUE);
//		MessageBox(m_hWnd, strMsg, "SpaceCowboy", MB_OK);
//		SendMessage(m_hWnd,WM_CLOSE,0,0);
//	}
}

void CAtumApplication::InitStageEffect( int nIndex, float fPlayTime, BOOL bEnableSkip )
{
	if(m_pStageEffect)
	{
		m_pStageEffect->InvalidateDeviceObjects();
		m_pStageEffect->DeleteDeviceObjects();
		SAFE_DELETE(m_pStageEffect);
	}
	m_pStageEffect = new CINFStageEffect( nIndex, fPlayTime, bEnableSkip );
	m_pStageEffect->InitDeviceObjects();
	m_pStageEffect->RestoreDeviceObjects();
}

HRESULT CAtumApplication::InitDeviceObjects()
{
	FLOG("CAtumApplication::InitDeviceObjects()");
	g_pD3dDev = m_pd3dDevice;
			

			
#ifdef _DEBUG
//	InitStageEffect( STAGE_EFFECT_MGAME, 2.0f, TRUE );
	InitStageEffect( STAGE_EFFECT_GAME_LOGO, 2.0f, TRUE );
#else
//	InitStageEffect( STAGE_EFFECT_MGAME, 2.0f, FALSE );
	InitStageEffect( STAGE_EFFECT_GAME_LOGO, 2.0f, FALSE );
#endif

	m_pEffectRender = new CEffectRender();
	m_pEffectRender->InitDeviceObjects();
	ResourceLoadThread();

	

	m_pInterface->InitDeviceObjects();


	g_pD3dDev->ShowCursor(FALSE);
	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	if(g_pD3dApp->IsSingletonMode())
	{
	}
	else
	{
		if(!m_pFieldWinSocket->Connect(m_strFieldIP,m_nFieldPort))
		{
			NetworkErrorMsgBox(STRMSG_C_SERVER_0005);//"필드서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			return E_FAIL; // 2005-03-25 by jschoi
		}
		if(!m_pIMSocket->Connect(m_strChatIP,m_nChatPort))
		{
			NetworkErrorMsgBox(STRMSG_C_SERVER_0006);//"IM서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			return E_FAIL; // 2005-03-25 by jschoi
		}
	}
	

//	if(!m_pFieldWinSocket->Connect(m_strFieldIP,m_nFieldPort))
//	{
//		NetworkErrorMsgBox(STRMSG_C_SERVER_0005);//"필드서버와 접속이 종료되었습니다. 게임이 종료됩니다."
//		return E_FAIL; // 2005-03-25 by jschoi
//	}
//	if(!m_pIMSocket->Connect(m_strChatIP,m_nChatPort))
//	{
//		NetworkErrorMsgBox(STRMSG_C_SERVER_0006);//"IM서버와 접속이 종료되었습니다. 게임이 종료됩니다."
//		return E_FAIL; // 2005-03-25 by jschoi
//	}
	// end 2008-08-11 by bhsohn 단독으로 실행 되게끔

	m_pFxSystem->InitDeviceObjects();
	if(m_pTutorial->IsTutorialMode() == TRUE)
	{
		m_pTutorial->InitDeviceObjects();
	}
	// 2005-05-02 by ydkim CImageManager
//	if(m_pImgManager)
//		m_pImgManager->InitDeviceObjects();

	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
	{
		m_pFontCandidate[i] = new CD3DHanFont(_T(g_pD3dApp->GetFontStyle()),9, D3DFONT_ZENABLE, TRUE,1024,32);
		m_pFontCandidate[i]->InitDeviceObjects(g_pD3dDev);
	}

	// 2007.04.24 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
	m_pFontCompositon = new CD3DHanFont(_T(g_pD3dApp->GetFontStyle()),9, D3DFONT_ZENABLE, TRUE,1024,32);
	m_pFontCompositon->InitDeviceObjects(g_pD3dDev);

	m_pFontIMEType = new CD3DHanFont(_T(g_pD3dApp->GetFontStyle()),9, D3DFONT_ZENABLE, TRUE,1024,32);
	m_pFontIMEType->InitDeviceObjects(g_pD3dDev);
#endif



	return S_OK;
}

HRESULT CAtumApplication::RestoreDeviceObjects()
{
	FLOG("CAtumApplication::RestoreDeviceObjects()");
	if(!m_pd3dxSprite)
		D3DXCreateSprite(g_pD3dDev , &m_pd3dxSprite);
	if(m_pStageEffect)
	{
		m_pStageEffect->RestoreDeviceObjects();
	}
  
//2012-01-05 by jhahn 동영상 플레이
	{
		HRESULT hr;
		
		// Create the vertex buffer.
		if( FAILED( hr = g_pD3dDev->CreateVertexBuffer( 2*2*sizeof(CUSTOMVERTEX),
			0, D3DFVF_CUSTOMVERTEX,
			D3DPOOL_DEFAULT, &g_pVB, NULL ) ) )
		{
			
			return E_FAIL;
		}
		
		// Fill the vertex buffer. We are setting the tu and tv texture
		// coordinates, which range from 0.0 to 1.0
		CUSTOMVERTEX* pVertices;
		if ( FAILED( hr = g_pVB->Lock( 0, 0, (void**)&pVertices, 0 ) ) )
		{
			
			return E_FAIL;
		}
		
		
		{  
			
			pVertices[0].position = D3DXVECTOR3(  -1.0f,  0.75f, 1.0f );
			pVertices[0].color    = 0xffffffff;
			pVertices[0].tu       = 0.0f;
			pVertices[0].tv       = 1.0f; 
			
			pVertices[1].position = D3DXVECTOR3(  1.0f,  0.75f, 1.0f );
			pVertices[1].color    = 0xffffffff;
			pVertices[1].tu       = 1.0f;
			pVertices[1].tv       = 1.0f; 
			
			pVertices[2].position = D3DXVECTOR3(  -1.0f,  -0.75f, 1.0f );
			pVertices[2].color    = 0xffffffff;
			pVertices[2].tu       = 0.0f;
			pVertices[2].tv       = 0.0f; 
			
			pVertices[3].position = D3DXVECTOR3(  1.0f,  -0.75f, 1.0f );
			pVertices[3].color    = 0xffffffff;
			pVertices[3].tu       = 1.0f;
			pVertices[3].tv       = 0.0f;
		}
		
		g_pVB->Unlock();
	}
	
	InitDShowTextureRenderer();	 
//end 2012-01-05 by jhahn 동영상 플레이
/*	g_pD3dDev->BeginStateBlock();
	g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
    g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
    g_pD3dDev->SetRenderState( D3DRS_ALPHATESTENABLE,  FALSE );
	g_pD3dDev->SetRenderState( D3DRS_ZENABLE, TRUE );
	g_pD3dDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
	g_pD3dDev->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
//	g_pD3dDev->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR );
	g_pD3dDev->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
	g_pD3dDev->SetRenderState( D3DRS_NORMALIZENORMALS, TRUE );	// 라이팅 엔진에서 사용하는 법선의 자동 표준화
	g_pD3dDev->SetRenderState( D3DRS_LIGHTING, TRUE );
	g_pD3dDev->SetRenderState( D3DRS_DITHERENABLE, TRUE );		// 16비트 렌더링 모드에서 나타날 수 있는 단색 대역을 줄인다(얼룩제거?)
    g_pD3dDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
	g_pD3dDev->EndStateBlock( &m_dwStateBlock );
*/
	m_pScene->SetupLights();

	if( FAILED( g_pD3dDev->CreateVertexBuffer( 4 * sizeof(NOSPRITE),
		0, D3DFVF_NOSPRITE, D3DPOOL_MANAGED, &m_pVBSleep ,NULL) ) )
		return E_FAIL;
	float hsx,hsy; 
	NOSPRITE* v;
	m_pVBSleep->Lock( 0, 0, (void**)&v, 0 );
	hsx = 1.5f;
	hsy = 1.5f;
	// 2008-06-27 by bhsohn 1600X900 에서 유닛 죽었을 시, 붉은 이미지 처리 짧게 나오는 현상처리
	if(g_pD3dApp->GetWidth() > 1440)
	{
		hsx = 1.7f;
	}
	// end 2008-06-27 by bhsohn 1600X900 에서 유닛 죽었을 시, 붉은 이미지 처리 짧게 나오는 현상처리
	v[0].p = D3DXVECTOR3(-hsx,-hsy,0);	v[0].color=0x77FF0000;
	v[1].p = D3DXVECTOR3(-hsx,hsy,0);	v[1].color=0x77FF0000;
	v[2].p = D3DXVECTOR3(hsx,-hsy,0);	v[2].color=0x77FF0000;
	v[3].p = D3DXVECTOR3(hsx,hsy,0); 	v[3].color=0x77FF0000;
	m_pVBSleep->Unlock();

	//ysw 9_15
//	if(m_pAtumIntro)
//		m_pAtumIntro->RestoreDeviceObjects() ;

//	if(!m_pAtumIntro && m_pEffectRender)
	if(m_pEffectRender)
		m_pEffectRender->RestoreDeviceObjects();
	//////////////////////////////////////////////////////////////////////////

	// For Alt+Tab
	if(m_pScene)
	{
		m_pScene->RestoreDeviceObjects();
	}
	ResourceRestoreThread();
	if(m_pDatabase)
		m_pDatabase->RestoreDeviceObjects();
	if(m_pInterface)
	{
		m_pInterface->RestoreDeviceObjects();
		// 2015-05-19 by jwlee 맵 로딩중 DeviceLost 상태가 될 때 생기는 익셉션 해결
		m_pInterface->RestoreMapLoadObjects();
		// end 2015-05-19 by jwlee 맵 로딩중 DeviceLost 상태가 될 때 생기는 익셉션 해결
	}

	m_bResCheck = TRUE;
	m_bReadyBeginScene = TRUE;

	m_pFxSystem->RestoreDeviceObjects();
	if(m_pTutorial->IsTutorialMode() == TRUE)
	{
		m_pTutorial->RestoreDeviceObjects();
	}
//	if(m_pImgManager)
//		m_pImgManager->RestoreDeviceObjects(m_dwGameState);

	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
		m_pFontCandidate[i]->RestoreDeviceObjects();

	// 2007.04.24 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
	if(m_pFontCompositon)
	{
		m_pFontCompositon->RestoreDeviceObjects();
	}
	if(m_pFontIMEType)
	{
		m_pFontIMEType->RestoreDeviceObjects();
	}	
#endif



	return S_OK;
}

HRESULT CAtumApplication::InvalidateDeviceObjects()
{
	FLOG("CAtumApplication::InvalidateDeviceObjects()");
	if(m_pStageEffect)
	{
		m_pStageEffect->InvalidateDeviceObjects();
	}
	if(g_pVB)
	{
		SAFE_RELEASE(g_pVB);
	}	
	if(g_pTextureMoviePlayer)
	{
		SAFE_RELEASE(g_pTextureMoviePlayer);
	}	
	CleanupDShow();
// 2010. 10. 05 by jskim 맵로딩 구조 변경
// 	while(m_pMapInitThread && m_pMapInitThread->m_bRunning)
// 	{
// 		Sleep(500);
// 	}									 
// end 2010. 10. 05 by jskim 맵로딩 구조 변경
	if(m_dwStateBlock)
	{
//		g_pD3dDev->DeleteStateBlock(m_dwStateBlock);
		m_dwStateBlock = 0;
	}

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	if(m_pFontDebugFps)
		m_pFontDebugFps->InvalidateDeviceObjects();
	if(m_pFontDebugErr)
		m_pFontDebugErr->InvalidateDeviceObjects();
	if(m_pFontDebugDBG)
		m_pFontDebugDBG->InvalidateDeviceObjects();
	if(m_pFontDebugServer)
		m_pFontDebugServer->InvalidateDeviceObjects();
	if(m_pFontDebugInfl)
		m_pFontDebugInfl->InvalidateDeviceObjects();
	if(m_pFontDebugServerUserNum)
		m_pFontDebugServerUserNum->InvalidateDeviceObjects();
	if(m_pFontDebugMapUserNum)
		m_pFontDebugMapUserNum->InvalidateDeviceObjects();
	if(m_pFontDebugMem)
		m_pFontDebugMem->InvalidateDeviceObjects();
	if(m_pFontDebugObj)
		m_pFontDebugObj->InvalidateDeviceObjects();
	if(m_pFontDebugEffCnt)
		m_pFontDebugEffCnt->InvalidateDeviceObjects();
	if(m_pFontDebugEnemyMovePacket)
		m_pFontDebugEnemyMovePacket->InvalidateDeviceObjects();
	if(m_pFontDebugMissileCnt)
		m_pFontDebugCharacterPos->InvalidateDeviceObjects();
	if(m_pFontInfl)
		m_pFontInfl->InvalidateDeviceObjects();
#else
	if(m_pFontDebug)
	 	m_pFontDebug->InvalidateDeviceObjects();
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

//	if(m_pShuttleRender)
//		m_pShuttleRender->InvalidateDeviceObjects();
	if(m_pUnitRender)
		m_pUnitRender->InvalidateDeviceObjects();
	if(m_pCharacterRender)										// 2005-07-21 by ispark
		m_pCharacterRender->InvalidateDeviceObjects();
	if(m_pShuttleChild)
		m_pShuttleChild->InvalidateDeviceObjects();
	if(m_pCharacterChild)										// 2005-07-21 by ispark
		m_pCharacterChild->InvalidateDeviceObjects();
//  		m_pShuttleChild->InvalidateChat();
	if(m_pChat)
		m_pChat->InvalidateDeviceObjects();
	SAFE_RELEASE( m_pVBSleep );
	if(m_pEffectRender)
		m_pEffectRender->InvalidateDeviceObjects();
	if(m_pScene)
	{
		m_pScene->InvalidateDeviceObjects();
	}
	m_bReadyBeginScene = FALSE;
	if(m_pInterface)
	{
		m_pInterface->InvalidateDeviceObjects();
		// 2015-05-19 by jwlee 맵 로딩중 DeviceLost 상태가 될 때 생기는 익셉션 해결
		m_pInterface->InvalidateMapLoadObjects();
		// end 2015-05-19 by jwlee 맵 로딩중 DeviceLost 상태가 될 때 생기는 익셉션 해결
	}
	if(m_pDatabase)
		m_pDatabase->InvalidateDeviceObjects();

//	if(m_pAtumIntro)
//		m_pAtumIntro->InvalidateDeviceObjects();

	SAFE_RELEASE(m_pd3dxSprite);
	m_pd3dxSprite = NULL;

	m_pFxSystem->InvalidateDeviceObjects();
	if(m_pTutorial->IsTutorialMode() == TRUE)
	{
		m_pTutorial->InvalidateDeviceObjects();
	}

//	if(m_pImgManager)
//		m_pImgManager->InvalidateDeviceObjects(m_dwGameState);
	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
		m_pFontCandidate[i]->InvalidateDeviceObjects();

	// 2007.04.24 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
	if(m_pFontCompositon)
	{
		m_pFontCompositon->InvalidateDeviceObjects();
	}
	if(m_pFontIMEType)
	{
		m_pFontIMEType->InvalidateDeviceObjects();
	}
#endif


	return S_OK;
}

HRESULT CAtumApplication::DeleteDeviceObjects()
{
	FLOG("CAtumApplication::DeleteDeviceObjects()");
	//*--------------------------------------------------------------------------*//
	// 저장
	if(m_bCheckQuickSlotSave == FALSE)
	{
		m_pInterface->SaveCharacterFile(SLOT_PURPOSE_MAIN);		// 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 파라미터 추가 ( 0 = 메인, 1 = 아레나 )
	}
	//*--------------------------------------------------------------------------*//
//2012-01-05 by jhahn 동영상 플레이	
	if(g_pVB)
	{
		SAFE_RELEASE(g_pVB);
	}	
	if(g_pTextureMoviePlayer)
	{
		SAFE_RELEASE(g_pTextureMoviePlayer);
	}	
	CleanupDShow();	
//end 2012-01-05 by jhahn 동영상 플레이
	if(m_pStageEffect)
	{
		m_pStageEffect->DeleteDeviceObjects();
		SAFE_DELETE(m_pStageEffect);
	}

	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	if(m_pFontDebugFps)
		m_pFontDebugFps->DeleteDeviceObjects();
	if(m_pFontDebugErr)
		m_pFontDebugErr->DeleteDeviceObjects();
	if(m_pFontDebugDBG)
		m_pFontDebugDBG->DeleteDeviceObjects();
	if(m_pFontDebugServer)
		m_pFontDebugServer->DeleteDeviceObjects();
	if(m_pFontDebugInfl)
		m_pFontDebugInfl->DeleteDeviceObjects();
	if(m_pFontDebugServerUserNum)
		m_pFontDebugServerUserNum->DeleteDeviceObjects();
	if(m_pFontDebugMapUserNum)
		m_pFontDebugMapUserNum->DeleteDeviceObjects();
	if(m_pFontDebugMem)
		m_pFontDebugMem->DeleteDeviceObjects();
	if(m_pFontDebugObj)
		m_pFontDebugObj->DeleteDeviceObjects();
	if(m_pFontDebugEffCnt)
		m_pFontDebugEffCnt->DeleteDeviceObjects();
	if(m_pFontDebugEnemyMovePacket)
		m_pFontDebugEnemyMovePacket->DeleteDeviceObjects();
	if(m_pFontDebugMissileCnt)
		m_pFontDebugCharacterPos->DeleteDeviceObjects();
	if(m_pFontInfl)
		m_pFontInfl->DeleteDeviceObjects();
#else
	m_pFontDebug->DeleteDeviceObjects();
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

//	if(m_pShuttleRender)
//	{
//		m_pShuttleRender->DeleteDeviceObjects();
//	}
	if(m_pUnitRender)
		m_pUnitRender->DeleteDeviceObjects();
	if(m_pCharacterRender)								// 2005-07-21 by ispark
		m_pCharacterRender->DeleteDeviceObjects();
	if(m_pCharacterChild)								// 2005-07-21 by ispark
		m_pCharacterChild->DeleteDeviceObjects();
	if(m_pShuttleChild)
	{
  		m_pShuttleChild->DeleteDeviceObjects();
	}

	if(m_pScene)
	{
		m_pScene->DeleteDeviceObjects();//DeleteRes();
		SAFE_DELETE(m_pScene);
	}
	
//	m_pFontInput->DeleteDeviceObjects();
	m_pChat->DeleteDeviceObjects();
//	if(m_VOIPState.nVOIPState != _VOIP_NOTLOGIN && m_VOIPState.nVOIPState != _VOIP_ERRORSTATE) 
//	{
		COPYDATASTRUCT	copyData;
		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
		AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_CLIENT_END, 0);
		copyData.dwData = (DWORD)voIP;
//		copyData.dwData = MAKELONG(AV_MT_CLIENT_END, 0);
		copyData.lpData = NULL;
		copyData.cbData = 0;
		::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
//	}
//	if(m_bReadyVoIP) 
//	{
//		COPYDATASTRUCT	copyData;
//		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
//		copyData.dwData = MAKELONG(AV_MT_CLIENT_END, 0);
//		copyData.lpData = NULL;
//		copyData.cbData = 0;
//		::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
//		m_bReadyVoIP = FALSE;
//	}
// 	SAFE_DELETE(m_pItemData);
	//ysw 9_20
	if(m_pInterface)
	{
		m_pInterface->DeleteDeviceObjects();
		SAFE_DELETE(m_pInterface);
	}
/*	if( m_dwGameState == _LOGO || 
		m_dwGameState == _INIT ||
		m_dwGameState == _SELECT || 
		m_dwGameState == _CREATE || 
		m_dwGameState == _OPTION )
	{
		if(m_pInterface) 
		{
			m_pInterface->DeleteSelectObjects();
		}
	}
	else if((m_dwGameState == _GAME || m_dwGameState == _SHOP) && m_pInterface)
	{
		m_pInterface->DeleteGameObjects();
	}
	SAFE_DELETE(m_pInterface );
*/
/*	if(m_pAtumIntro)
	{
		m_pAtumIntro->DeleteDeviceObjects();
		SAFE_DELETE(m_pAtumIntro);
	}
*/	if(m_pEffectRender)
	{
		m_pEffectRender->DeleteDeviceObjects();
		SAFE_DELETE(m_pEffectRender);
	}
	if(m_pSound)
	{
		m_pSound->DeleteDeviceObjects();
		SAFE_DELETE(m_pSound);
	}

	m_pFxSystem->DeleteDeviceObjects();
	if(m_pTutorial->IsTutorialMode() == TRUE)
	{
		m_pTutorial->DeleteDeviceObjects();
	}
//	if(m_pImgManager)
//	{
//		m_pImgManager->DeleteDeviceObjects(m_dwGameState);
//		SAFE_DELETE(m_pImgManager);
//	}
	for(int i=0; i<CHAR_INF_CANDIDATE; i++)
	{
		m_pFontCandidate[i]->DeleteDeviceObjects();
		SAFE_DELETE(m_pFontCandidate[i]);
	}
	// 2007.04.24 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
	if(m_pFontCompositon)
	{
		m_pFontCompositon->DeleteDeviceObjects();
		SAFE_DELETE(m_pFontCompositon);
	}
	if(m_pFontIMEType)
	{
		m_pFontIMEType->DeleteDeviceObjects();
		SAFE_DELETE(m_pFontIMEType);
	}
#endif


	return S_OK;
}

HRESULT CAtumApplication::Render()
{
	FLOG("CAtumApplication::Render()");
	if(!m_bReadyBeginScene)
		return S_OK;
	// 2009. 11. 23 by jskim 리소스 로딩 구조 변경
	LoadMeshPorcess();	
	//end 2009. 11. 23 by jskim 리소스 로딩 구조 변경
	EnterCriticalSection(&m_cs);
	if( m_dwGameState == _MAPLOAD || 
//		m_dwGameState == _SELECTCHANNEL || 
		m_dwGameState == _MOVIE || 
		m_dwGameState == _LOGO || 
		m_dwGameState == _INIT || 
		m_dwGameState == _SCRIPT || 
		m_dwGameState == _WAITING ||
		m_dwGameState == _PROLOGUE)			// 2006-09-18 by ispark
	{
		m_pScene->m_dwFogColor= D3DCOLOR_ARGB(0x00,(BYTE)0,(BYTE)0,(BYTE)0);
	}
	else if( m_dwGameState == _SELECTCHANNEL )
	{
		m_pScene->m_dwFogColor= D3DCOLOR_ARGB(0x00,(BYTE)22,(BYTE)22,(BYTE)22);
	}

	g_pD3dDev->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,m_pScene->m_dwFogColor, 1.0f, 0L );

			g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
			g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
			g_pD3dDev->SetRenderState( D3DRS_ALPHATESTENABLE,  FALSE );
			g_pD3dDev->SetRenderState( D3DRS_ZENABLE, TRUE );
			g_pD3dDev->SetRenderState( D3DRS_NORMALIZENORMALS, TRUE );	// 라이팅 엔진에서 사용하는 법선의 자동 표준화
			g_pD3dDev->SetRenderState( D3DRS_LIGHTING, TRUE );
			g_pD3dDev->SetRenderState( D3DRS_DITHERENABLE, TRUE );		// 16비트 렌더링 모드에서 나타날 수 있는 단색 대역을 줄인다(얼룩제거?)
			g_pD3dDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
			// 2005-01-03 by jschoi
//			g_pD3dDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
//			g_pD3dDev->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
			g_pD3dDev->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);
			g_pD3dDev->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);
			g_pD3dDev->SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR);


			g_pD3dDev->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );

			// 2005-01-04 by jschoi
//			g_pD3dDev->SetTextureStageState( 0, D3DTSS_ADDRESSU,  D3DTADDRESS_CLAMP );
//			g_pD3dDev->SetTextureStageState( 0, D3DTSS_ADDRESSV,  D3DTADDRESS_CLAMP );
			g_pD3dDev->SetSamplerState(0, D3DSAMP_ADDRESSU,D3DTADDRESS_CLAMP );
			g_pD3dDev->SetSamplerState(0, D3DSAMP_ADDRESSV,D3DTADDRESS_CLAMP );

			g_pD3dDev->SetTransform( D3DTS_VIEW,       &m_pCamera->GetViewMatrix() );
			g_pD3dDev->SetTransform( D3DTS_PROJECTION, &m_pCamera->GetProjMatrix() );

    if( SUCCEEDED( g_pD3dDev->BeginScene() ) )
    {
		switch(m_dwGameState)
		{
		case _MOVIE:
		case _LOGO:
		case _INIT:
			{
				if(m_pStageEffect)
				{
					m_pStageEffect->Render();
				}
				if( m_pInterface && 
					m_pInterface->m_pSelect &&
					m_pInterface->m_pSelect->m_pInfWindow)
				{
					m_pInterface->m_pSelect->m_pInfWindow->RenderMessaegBox();

				}
			}
			break;

		case _MOVIEPLAYER:
			{
				{
					g_pD3dDev->SetRenderState( D3DRS_LIGHTING, FALSE );			
					
					D3DXMATRIX matWorld;
					D3DXMatrixIdentity( &matWorld );				  
					g_pD3dDev->SetTransform( D3DTS_WORLD, &matWorld );				  
					D3DXMATRIX matView;
					D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, 0.0f,-1.5f ),
						&D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
						&D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
					g_pD3dDev->SetTransform( D3DTS_VIEW, &matView );		  
					
					D3DXMATRIX matProj;
					D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
					
					g_pD3dDev->SetTransform( D3DTS_PROJECTION, &matProj );
					
					g_pD3dDev->SetTexture( 0, g_pTextureMoviePlayer );
					
					// Render the vertex buffer contents
					g_pD3dDev->SetStreamSource( 0, g_pVB, 0, sizeof(CUSTOMVERTEX) );
					g_pD3dDev->SetVertexShader( NULL );
					g_pD3dDev->SetFVF( D3DFVF_CUSTOMVERTEX );
					g_pD3dDev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );

					HRESULT hr = CheckMovieStatus();
					if (hr == S_FALSE)
					{
						ChangeGameState(_SELECT);
					}
				}			

			}
			break;
		case _SELECT:
			{
				// 2010-06-07 by dgwoo 캐릭터선택창 리소스 변경에 따라 이펙트 버그 수정.
				m_pInterface->m_pSelect->m_pSelectBack->Render();
				g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
				m_pInterface->m_pSelect->m_pSelectBack->RenderSelectUnit();
				g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
				//end 2010-06-07 by dgwoo 캐릭터선택창 리소스 변경에 따라 이펙트 버그 수정.
				m_pEffectRender->Render();
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _CREATE:
			{
				// 2010-06-07 by dgwoo 캐릭터선택창 리소스 변경에 따라 이펙트 버그 수정.
				m_pInterface->m_pSelect->m_pSelectBack->Render();
				g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
				m_pInterface->m_pSelect->m_pSelectBack->RenderCreateUnit();
				g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE ); 
				//end 2010-06-07 by dgwoo 캐릭터선택창 리소스 변경에 따라 이펙트 버그 수정.
				m_pEffectRender->Render();
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _OPTION:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _MAPLOAD:
			{
				// 2011-10110 by jhahn EP4 맵로딩 스텟 초기화
				m_pFxSystem->SetingSandStromSurface(FALSE);	 
                //end 2011-10110 by jhahn EP4 맵로딩 스텟 초기화

				
				g_pD3dDev->SetRenderState(D3DRS_FOGENABLE, FALSE);
				if(m_pInterface)
					m_pInterface->Render();
				if( m_pInterface && 
					m_pInterface->m_pSelect &&
					m_pInterface->m_pSelect->m_pInfWindow)
				{
					m_pInterface->m_pSelect->m_pInfWindow->RenderMessaegBox();
				}
				else if( m_pInterface &&
					m_pInterface->m_pGameMain &&
					m_pInterface->m_pGameMain->m_pInfWindow)
				{
					m_pInterface->m_pGameMain->m_pInfWindow->RenderMessaegBox();
				}
			}
			break;
		case _GAME:
			{
				START_PROFILER("Game Render");
				RenderGame();				
				STOP_PROFILER("Game Render");

				START_PROFILER("Effect Render");
				m_pEffectRender->Render();				
				STOP_PROFILER("Effect Render");

				//*--------------------------------------------------------------------------*//
				// 2006-11-16 by ispark, 알파 렌더링
				RenderAlpha();
				//*--------------------------------------------------------------------------*//

				// 일반 필터
                if(m_pFxSystem->IsRenderBlurFilter() && g_pSOption->sContrast > 0)
				{
					m_pFxSystem->MakeTargetSurface();
					m_pFxSystem->DrawTargetSurface();
				}
				// 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정
				if((0 == g_pSOption->sContrast) && (g_pSOption->sFilter > 0))
				{
					g_pD3dDev->SetRenderState( D3DRS_ZENABLE, FALSE );					
				}
				// end 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정

				// 2005-01-17 by jschoi - 가우스필터 적용
				if(m_pFxSystem->IsRenderGaussBlur() && g_pSOption->sFilter > 0)
				{
					m_pFxSystem->MakeGaussFilterSurface();
					m_pFxSystem->DrawGaussFilterSurface();
				}
#ifdef C_EPSODE4_SETTING_JHAHN
				// 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가
				if (m_pFxSystem->GetingSandStromSurface() )
					m_pFxSystem->MakeSandStromSurface();					
#endif
				//end 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가

				m_pChat->Render();
//				if(m_pTutorial->IsTutorialMode() == TRUE)				// 2006-09-21 by ispark, 인터페이스 안으로 위치 변경
//					m_pTutorial->Render();

				START_PROFILER("Interface Render");
				if(m_pInterface)
					m_pInterface->Render();
				STOP_PROFILER("Interface Render");
			}
			break;
		case _SHOP:
			{
				START_PROFILER("Game Render");				
				RenderGame();				
				STOP_PROFILER("Game Render");

				START_PROFILER("Effect Render");				
				m_pEffectRender->Render();				
				STOP_PROFILER("Effect Render");

				// 일반 필터
                if(m_pFxSystem->IsRenderBlurFilter() && g_pSOption->sContrast > 0)
				{
					m_pFxSystem->MakeTargetSurface();
					m_pFxSystem->DrawTargetSurface();
				}
				// 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정
				if((0 == g_pSOption->sContrast) && (g_pSOption->sFilter > 0))
				{
					g_pD3dDev->SetRenderState( D3DRS_ZENABLE, FALSE );					
				}
				// end 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정

				// 2005-01-17 by jschoi - 가우스필터 적용
				if(m_pFxSystem->IsRenderGaussBlur() && g_pSOption->sFilter > 0)
				{
					m_pFxSystem->MakeGaussFilterSurface();
					m_pFxSystem->DrawGaussFilterSurface();
				}

				m_pChat->Render();

				START_PROFILER("Interface Render");
				if(m_pInterface)
					m_pInterface->Render();
				STOP_PROFILER("Interface Render");
			}
			break;
		case _CITY:
			{
				RenderCity();

				START_PROFILER("Effect Render");
				m_pEffectRender->Render();
				STOP_PROFILER("Effect Render");

				// 일반 필터
                if(m_pFxSystem->IsRenderBlurFilter() && g_pSOption->sContrast > 0)
				{
					m_pFxSystem->MakeTargetSurface();
					m_pFxSystem->DrawTargetSurface();
				}
				// 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정
				if((0 == g_pSOption->sContrast) && (g_pSOption->sFilter > 0))
				{
					g_pD3dDev->SetRenderState( D3DRS_ZENABLE, FALSE );					
				}
				// end 2009-03-18 by bhsohn 인벤에 기체 안나오는 버그 수정

				// 2005-01-17 by jschoi - 가우스필터 적용
				if(m_pFxSystem->IsRenderGaussBlur() && g_pSOption->sFilter > 0)
				{
					m_pFxSystem->MakeGaussFilterSurface();
					m_pFxSystem->DrawGaussFilterSurface();
				}


				m_pChat->Render();

				START_PROFILER("Interface Render");
				if(m_pInterface)
					m_pInterface->Render();
				STOP_PROFILER("Interface Render");
			}
			break;
		case _SCRIPT:
			{
				g_pD3dDev->SetRenderState(D3DRS_FOGENABLE, FALSE);
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _WAITING:
			{
				if(m_pStageEffect)
				{
					m_pStageEffect->Render();
				}
				if(m_pInterface)
					m_pInterface->Render();
				if( m_pInterface && 
					m_pInterface->m_pSelect &&
					m_pInterface->m_pSelect->m_pInfWindow)
				{
					m_pInterface->m_pSelect->m_pInfWindow->RenderMessaegBox();
				}
				else if( m_pInterface &&
					m_pInterface->m_pGameMain &&
					m_pInterface->m_pGameMain->m_pInfWindow)
				{
					m_pInterface->m_pGameMain->m_pInfWindow->RenderMessaegBox();
				}
			}
			break;
		case _GAMEOVER:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _COMPLETE:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _PROLOGUE:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _ENDGAME:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _ENDCLIENT:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		case _SELECTCHANNEL:
			{
				if(m_pInterface)
					m_pInterface->Render();
			}
			break;
		}

		// 2005-03-03 by jschoi
		RenderRequestEnable();
		
		FadeEffectRender();
		RenderDbg();
		g_pD3dDev->EndScene();
	}
	LeaveCriticalSection(&m_cs);	
    return S_OK;
}

void CAtumApplication::CheckRenderState()
{
	FLOG("CAtumApplication::CheckRenderState()");
	int temp = m_nCheckRenderPos;
	for(int i = 0 ; i < 1 ; i++)
	{
		// Shuttle
/*		if(temp < SHUTTLE_NUM)
		{
			if(m_pShuttleRender->m_pMeshNode[temp])
			{
				if(m_pShuttleRender->m_pMeshNode[temp]->m_nRenderCount > 2)//m_pRenderCount[temp] > 2)
					m_pShuttleRender->m_pMeshNode[temp]->m_nRenderCount = 2;//m_pRenderCount[temp] = 2;
				else
					m_pShuttleRender->ShuttleDeleteData(temp);
			}
		}
		// Monster
		else if(temp < SHUTTLE_NUM + MONSTER_NUM)
		{
			if(m_pMonsterRender->m_pMeshNode[temp-SHUTTLE_NUM])
			{
				if(m_pMonsterRender->m_pMeshNode[temp-SHUTTLE_NUM]->m_nRenderCount > 2)
					m_pMonsterRender->m_pMeshNode[temp-SHUTTLE_NUM]->m_nRenderCount = 2;
				else
					m_pMonsterRender->MonsterDeleteData(temp-SHUTTLE_NUM);
			}
		}
		// Object
		else if(temp < SHUTTLE_NUM + MONSTER_NUM + OBJECT_NUM )
		{
			if(m_pScene->m_pObjectRender->m_pMeshNode[temp-SHUTTLE_NUM-MONSTER_NUM])
			{
				if( m_pScene->m_pObjectRender->m_pMeshNode[temp-SHUTTLE_NUM-MONSTER_NUM]->m_nRenderCount > 2)
					m_pScene->m_pObjectRender->m_pMeshNode[temp-SHUTTLE_NUM-MONSTER_NUM]->m_nRenderCount = 2;
				else
					m_pScene->m_pObjectRender->ObjectDeleteData(temp-SHUTTLE_NUM-MONSTER_NUM);
			}
		}
		temp++;
		if(temp == SHUTTLE_NUM + MONSTER_NUM + OBJECT_NUM)
			temp = 0;
*/	}
	m_nCheckRenderPos = temp;
}
/*
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::TickSleep()
/// \brief		실제 GameState를 변경한다.
/// \author		dhkwon
/// \date		2004-06-02 ~ 2004-06-02
/// \warning	m_fSleepTime > 0
///				
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
HRESULT  CAtumApplication::TickSleep()
{
	m_fSleepTime -= m_fElapsedTime;
	if(m_fSleepTime <= 0)
	{
		m_fSleepTime = 0;
	}
	if(m_fSleepTime > 0) // 서서히 어두워짐
	{
		DWORD alpha = (DWORD)((m_fSleepTime/SLEEP_TIMER_TEMP*100));
		if( alpha > 100 )
			alpha = 100;
		if(m_pVBSleep)
		{
			NOSPRITE* v;
			m_pVBSleep->Lock( 0, 0, (BYTE**)&v, 0 );
			v[0].color=(DWORD)((alpha << 24) | 0x00000000);
			v[1].color=v[0].color;
			v[2].color=v[0].color;
			v[3].color=v[0].color;
			m_pVBSleep->Unlock();
		}
	}
	*/
/*	if(m_fSleepTime > SLEEP_TIMER_TEMP/2) // 서서히 어두워짐
	{
		DWORD alpha = (DWORD)((m_fSleepTime-SLEEP_TIMER_TEMP/2)/SLEEP_TIMER_TEMP*200);
		if( alpha > 100 )
			alpha = 100;
		if(m_pVBSleep)
		{
			NOSPRITE* v;
			m_pVBSleep->Lock( 0, 0, (BYTE**)&v, 0 );
			v[0].color=(DWORD)((alpha << 24) | 0x00FFFFFF);
			v[1].color=v[0].color;
			v[2].color=v[0].color;
			v[3].color=v[0].color;
			m_pVBSleep->Unlock();
		}
	}
	else // 서서히 밝아짐
	{
		DWORD alpha = (DWORD)((SLEEP_TIMER_TEMP/2-m_fSleepTime)/SLEEP_TIMER_TEMP*200);
		if( alpha > 100 )
			alpha = 100;
		if(m_pVBSleep)
		{
			NOSPRITE* v;
			m_pVBSleep->Lock( 0, 0, (BYTE**)&v, 0 );
			v[0].color=(DWORD)((alpha << 24) | 0x00FF0000);
			v[1].color=v[0].color;
			v[2].color=v[0].color;
			v[3].color=v[0].color;
			m_pVBSleep->Unlock();
		}
	}
	return S_OK;
}
*/
HRESULT CAtumApplication::FrameMove()
{
	FLOG("CAtumApplication::FrameMove()");
#ifdef _DEBUG
	g_fMoveCountFrame += GetElapsedTime();
#endif
	static float fDebugTextCheckTime = 0.0f;
	static float fCloudCheckTime = 600.0f;

	if(fDebugTextCheckTime >= 0.0f)
		fDebugTextCheckTime -= m_fElapsedTime;


	// 2007-02-12 by bhsohn 포커스 잃어 먹었을 떄의 문제 처리
	UpdateCheckTime();
	// end 2007-02-12 by bhsohn 포커스 잃어 먹었을 떄의 문제 처리

//	char message[512];
	/////////////////////////////// 이전 프레임과 현재의 프레임을 계산하여 평균 값 적용 ////////////////////////////

	// 초당 5프레임 이상의 PC에서만 정상 동작한다.
	if(m_fElapsedTime > 0.2f)
		m_fElapsedTime = 0.2f;
	float fTemp;
	fTemp = (m_fOldTickTime+m_fElapsedTime)/2.0f;
	m_fOldTickTime = m_fElapsedTime;
	m_fElapsedTime = fTemp;

	// 렌더링 리스트에서 일정시간 동안 사용 하지 않은 것은 삭제한다.
	if(m_fRenderDeleteCheckTime >= 0.0f)
		m_fRenderDeleteCheckTime -= GetElapsedTime();
	if(m_fRenderDeleteCheckTime <= 0.0f)
	{
		CheckRenderState();
		m_fRenderDeleteCheckTime = 60.0f;
	}


	if(m_fCheckSocketTime >= 0.0f)
		m_fCheckSocketTime -= GetElapsedTime();
	if(m_fCheckSocketTime <= 0.0f)
	{
	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	if(g_pD3dApp->IsSingletonMode())
	{
	}
	else
	{
		if(m_dwGameState != _MAPLOAD)// by dhkwon 2003.7.4
		{
			if(!m_pFieldWinSocket->IsConnected())
			{
				// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
#ifdef	C_SERVER_DOWN_ALARM
				g_pD3dApp->m_pSound->SetBackMusic(_SERVER_DOWN);
#else
				NetworkErrorMsgBox(STRMSG_C_SERVER_0005);//"필드서버와 접속이 종료되었습니다. 게임이 종료됩니다."
				return E_FAIL;// 2005-03-25 by jschoi - 리턴 필요				
#endif
				
			}
		}
		// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
#ifdef	C_SERVER_DOWN_ALARM
#else
		if(!m_pIMSocket->IsConnected())
		{
			NetworkErrorMsgBox(STRMSG_C_SERVER_0006);//"IM서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			return E_FAIL;// 2005-03-25 by jschoi - 리턴 필요
		}
#endif
		// END 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
	}

		m_fCheckSocketTime = 10.0f;
	}
	////////////////////////
	// 배경 사운드 플레이 //
	////////////////////////
	m_pSound->PlayBackSound();
	
	// 2007-07-24 by bhsohn 나레이션 mp3추가
	// 나레이션 mp3플레이
	PlayNarrationSound();

	////////////////////////
//	if(!m_bInitializing)
//	{
		if( FAILED( m_pKeyBoard->ReadImmediateData(m_hWnd ) ) )
			return E_FAIL;
#ifdef _DEBUG
		if( m_pShuttleChild && 
//			COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER) && 
			m_pKeyBoard->GetAsyncKeyState( DIK_LCONTROL) && 
			m_pKeyBoard->GetAsyncKeyState( DIK_LMENU) && 
			m_pKeyBoard->GetAsyncKeyState( DIK_SLASH))
		{
			if(fDebugTextCheckTime < 0.0f)
			{
				m_bDebugText = !m_bDebugText;
				fDebugTextCheckTime = 1.0f;
			}
		}
#endif
		// 2007-09-05 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
		TickImeChange();
#endif
		// 2008-11-13 by bhsohn 조이스틱 작업
		TickJoyStickInfo();	// 조이스틱 컨트롤 정보 
		
		// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
		TickItemSell();
		// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 


		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		TickInfinityStart();
		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)


		// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
		TickInfintyMapLoadedSend();
		// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)

		// 2010. 10. 05 by jskim 맵로딩 구조 변경
		m_pMaploading->TickMapLoad();
		// end 2010. 10. 05 by jskim 맵로딩 구조 변경
		
		// 2009-01-28 by bhsohn nProtector 게임 가드 추가
		#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)
			if(!TickGetCheckGameGuardNProtector())
			{
				// 게임을 강제적으로 접속 종료 시킬 상황이다.
				NetworkErrorMsgBox(STRMSG_C_SERVER_0010);
			}
		#endif
		// end 2009-01-28 by bhsohn nProtector 게임 가드 추가
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
		#if defined(DEFINE_USE_GAMEGUARD_XTRAP)
			TickGetCheckGameGuardXTrap();			
		#endif
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
		
		if(GetHwnd() == GetActiveWindow() && m_pKeyBoard->GetAsyncKeyState(DIK_F12))
		{
			if(fDebugTextCheckTime < 0.0f)
			{
				if(m_dwGameState == _SELECT || 
					m_dwGameState == _CREATE || 
					m_dwGameState == _MAPLOAD || 
					m_dwGameState == _GAME || 
					m_dwGameState == _CITY || 
					m_dwGameState == _SHOP)
				{
					int nNumber = GetScreenShotNumber();
					if(nNumber != -1)
					{
						char buf[64];
						wsprintf(buf, "ATM%05d.bmp", nNumber);
						TakeScreenShot(g_pD3dDev, buf, GetBackBufferDesc().Width, GetBackBufferDesc().Height);
					}
					fDebugTextCheckTime = 0.5f;
				}
			}
		}

		// 2005-04-07 by jschoi
		if( m_dwGameState != _GAME ||
			m_pTutorial->IsTutorialMode() == FALSE)
		{
			if(m_pInterface)
				m_pInterface->Tick();
		}
		else if(m_pTutorial->IsTutorialMode() == TRUE)
		{
			if(g_pGameMain && g_pGameMain->m_pMiniMap)
			{
				g_pGameMain->m_pMiniMap->Tick();
			}
// 2007-07-27 by dgwoo 튜토리얼 Tick에서 돌림.
//			if(m_pInterface && m_pInterface->m_pTarget)
//			{
//				m_pInterface->m_pTarget->Tick();
//			}
		}
		
		switch(m_dwGameState)
		{
		case _MOVIE:
			{
				if(m_pStageEffect)
				{
					m_pStageEffect->Tick();
					if(!m_pStageEffect->IsRuning())
					{
						BOOL bWork = m_pStageEffect->GetEndWork();
#ifdef _DEBUG
						InitStageEffect( STAGE_EFFECT_MASANGSOFT, 2.0f, TRUE );
#else
						InitStageEffect( STAGE_EFFECT_MASANGSOFT, 2.0f, FALSE );
#endif
						m_pStageEffect->SetEndWork( bWork );
						ChangeGameState(_LOGO);

					}
				}
			}
			break;
		case _LOGO:
			{
				if(m_pStageEffect)
				{
					m_pStageEffect->Tick();
					if(!m_pStageEffect->IsRuning())
					{
						BOOL bWork = m_pStageEffect->GetEndWork();
						InitStageEffect( STAGE_EFFECT_GAME_LOGO );
						m_pStageEffect->SetEndWork( bWork );
						ChangeGameState(_INIT);
					}
				}
			}
			break;
		case _INIT:
			{
				ShotDownGameTime();
				if(m_pStageEffect)
				{
					m_pStageEffect->Tick();
					if(!m_pStageEffect->IsRuning())
					{
						m_pStageEffect->InvalidateDeviceObjects();
						m_pStageEffect->DeleteDeviceObjects();
						SAFE_DELETE(m_pStageEffect);

						if (0)
						{
							ChangeGameState(_MOVIEPLAYER);					
						}
						else
						{
 							ChangeGameState(_SELECT);
 						}


						m_pInterface->RestoreSelectObjects();	// 2004-06-03 by dhkwon 연출, LOGO->SELECT
						
					}

					// 2008-08-11 by bhsohn 단독으로 실행 되게끔
					if(IsSingletonMode())
					{
						SetTempCharcaterInfo();	// 임시로 캐릭터 정보 얻어옴						
					}
					// end 2008-08-11 by bhsohn 단독으로 실행 되게끔
				}
			}
			break;
		case _MOVIEPLAYER:
			if( !m_bDeviceLost )
			{
			MovieRender();
			}
			break;
		case _SELECT:
		case _CREATE:
		case _OPTION:
			{
				if(g_pCamera)
				{
					g_pCamera->SetViewPlane();
				}
				if(m_pEffectList)
					m_pEffectList->Tick();
				if(m_pUnitRender)
					m_pUnitRender->Tick(m_fElapsedTime);
				if(m_pEffectRender)
					m_pEffectRender->Tick(m_fElapsedTime);

				ShotDownGameTime();
			}
			break;
		case _MAPLOAD:
			break;
		case _SELECTCHANNEL:
			break;
		case _GAME:
		case _SHOP:
		{
			if(m_pShuttleChild && 
				COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{
				if(m_fUserCheckTime >= 0.0f)
				{
					m_fUserCheckTime -= m_fElapsedTime;
				}
// 2012-11-07 by bhsohn 베트남 패킷 처리
#ifdef C_CLIENT_LIVE_TIME
				if(m_fServerLiveTime >= 0.0f)
				{
					m_fServerLiveTime -= m_fElapsedTime;
				}
#endif
// END 2012-11-07 by bhsohn 베트남 패킷 처리
				if(m_fUserCheckTime <= 0.0f)
				{
					m_pFieldWinSocket->SendMsg(T_FC_ADMIN_GET_SERVER_STAT, NULL, 0);
					m_pIMSocket->SendMsg(T_IC_ADMIN_GET_SERVER_STAT, NULL, 0);
					
					m_fUserCheckTime = 15.0f;					
// 2012-11-07 by bhsohn 베트남 패킷 처리
#ifdef C_CLIENT_LIVE_TIME
					m_fUserCheckTime = CLIENT_LIVE_CHECK_TIME;					
#endif
// END 2012-11-07 by bhsohn 베트남 패킷 처리
				}

// 2012-11-07 by bhsohn 베트남 패킷 처리
#ifdef C_CLIENT_LIVE_TIME
				if(m_fServerLiveTime <= 0.0f)
				{
//					NetworkErrorMsgBox(STRMSG_C_SERVER_0005);
					// Lock
					if(GetEnterLock())
					{
						EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock
					}
				}
#endif
// END 2012-11-07 by bhsohn 베트남 패킷 처리
			}
			if( m_pShuttleChild &&
				COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER) && 
				m_pKeyBoard->GetAsyncKeyState( DIK_LCONTROL) && 
				m_pKeyBoard->GetAsyncKeyState( DIK_LMENU) && 
				// 2008-11-13 by bhsohn 조이스틱 작업
				//m_pKeyBoard->GetAsyncKeyState( DIK_C))
				GetAsyncKeyState_DIK_DIJ( DIK_C))				
			{
				if(fDebugTextCheckTime < 0.0f)
				{
					m_pCamera->ChangeCamCollType();
					fDebugTextCheckTime = 1.0f;
				}
			}

			// 2006-02-27 by ispark
			// 캐릭터를 우선 Tick을 실행한다. 그후 카메라
			if(m_pTutorial->IsTutorialMode() == TRUE)
			{
				m_pTutorial->Tick(m_fElapsedTime);
			}
			else if(m_bCharacter)						// 2005-07-21 by ispark
			{
				m_pCharacterChild->Tick(m_fElapsedTime);			// 캐릭터
			}
			else
			{
				START_PROFILER("Shuttle Tick");
				m_pShuttleChild->Tick(m_fElapsedTime);				// 기어
				STOP_PROFILER("Shuttle Tick");
			}

//			if(m_pShuttleChild && m_bLoading == FALSE)
			//////////////////////////////////////////////////////////////////////////////////////////////////
//			if(m_pCamera && m_bLoading == FALSE && !m_pShuttleChild->m_bIsCameraPattern)
			// 2005-08-16 by ispark
			if(m_pCamera && !m_pShuttleChild->m_bIsCameraPattern && m_bCharacter == FALSE)
			{
				if(m_pShuttleChild->IsObserverMode())
				{
					m_pCamera->ObserveTick();
				}
				else
				{
					m_pCamera->Tick();
				}
			}
			else if(m_bCharacter == TRUE)
			{
				m_pCamera->CharacterCamTick();
			}

			// 2006-05-17 by ispark
			if(g_pCamera)
			{
				g_pCamera->SetViewPlane();
			}
			g_pFrustum->Construct( g_pD3dDev );

			START_PROFILER("Scene Tick");
			if(m_pScene)
			{
				m_pScene->Tick();
			}

			if(m_pScene)
				m_pScene->CheckObjectRenderList();
			STOP_PROFILER("Scene Tick");

//			if(m_bLoading == TRUE)
//			{
//				m_bLoading = FALSE;
//			}
//			if(g_pCamera)
//			{
//				g_pCamera->SetViewPlane();
//			}
//			g_pFrustum->Construct( g_pD3dDev );

//			if(m_pShuttleChild)
//			{
//				m_pShuttleChild->Tick(m_fElapsedTime);
//			}

			if(m_pUnitRender)
				m_pUnitRender->Tick(m_fElapsedTime);

			if(m_pCharacterRender)							// 2005-07-13 by ispark
				m_pCharacterRender->Tick(m_fElapsedTime);

			if(	m_pTutorial->IsTutorialMode() == FALSE ||
				m_pTutorial->IsUseShuttleTick() == TRUE )
			{
				if(m_pEffectList)
				{
					m_pEffectList->Tick();
				}
			}

			if(m_pChat)
				m_pChat->Tick();

			if(	m_pTutorial->IsTutorialMode() == FALSE ||
				m_pTutorial->IsUseShuttleTick() == TRUE )
			{
				if(m_pEffectRender)
				{
					m_pEffectRender->Tick(m_fElapsedTime);
				}
			}
			
			// 2004-11-08 by jschoi
			m_dwSpeedHackTimer += m_fElapsedTime*1000;
			// 2006-06-15 by ispark, 일정시간에 패킷을 보내는 부분 
			if(m_dwSpeedHackTimer > 200)
			{
				SendOtherPacket();
			}

			// 스피드 핵 체크
			if( m_pShuttleChild &&
				//m_bActive == TRUE && // 2009-01-14 by bhsohn 창모드에서 윈도우 최소화시 MovePacket안보내는 버그 수정
				m_dwSpeedHackTimer > 200 &&
				m_pScene->m_byMapType != MAP_TYPE_TUTORIAL &&
				(m_bCharacter || UNIT_STATE_MOVE(m_pShuttleChild->m_dwState) || g_fSendMovePacket > 0) )
			{
//				DBGOUT("Send Move Packet %f\n", (float)m_dwSpeedHackTimer / 1000.0f);
				SendMovePacket(TRUE);
				m_nSendMovePacketCount++;
				m_dwSpeedHackTimer -= 200;
				if(m_dwSpeedHackTimer > 200)
				{
					m_dwSpeedHackTimer = 0;
				}
//				m_dwSpeedHackTimer = 0;
			}

			// 2005-12-22 by ispark, 1분당 핵 체크
			int nCheckTime = 1000 * 60;		// 1분
#ifdef _DEBUG
			nCheckTime = 1000 * 10;			// 10초
#endif
			m_dwHackCheckTime += m_fElapsedTime*1000;
			if(m_pTutorial->IsTutorialMode() == FALSE &&
				//m_bActive == TRUE &&// 2009-01-14 by bhsohn 창모드에서 윈도우 최소화시 MovePacket안보내는 버그 수정
				m_dwHackCheckTime > nCheckTime)
			{
				SendHackTime_WeaponInfo();
				SendHackTime_EngineInfo();
				SendHackTime_TotalWeight();

				m_dwHackCheckTime = 0;
			}

			// 2005-12-22 by ispark, 거리 핵 체크
			// 캐릭터 상태에서 거리 핵 체크 제외(문제되면... 나중에 만들 것)
			// 10.0f는 최대 허용 범위
			// 2006-01-04 by ispark, 1차 수정
			m_dwMoveCheckTime += m_fElapsedTime * 1000;			
			float fShuttleMoveLength = D3DXVec3Length(&(m_pShuttleChild->m_vPos - m_vShuttleOldPos));
			float fShuttleMoveCheck;
			if(m_pShuttleChild->m_nBooster == BOOSTER_TYPE_MAX)
			{
				fShuttleMoveCheck = (m_pShuttleChild->m_fRealShuttleSpeedBoosterOn - m_pShuttleChild->m_fTempGravity) * m_fElapsedTime + 7.0f;
//				DBGOUT("B_Move %f(%f),", 
//						fShuttleMoveCheck, 
//						m_pShuttleChild->m_fRealShuttleSpeedBoosterOn);
			}
			else
			{
				fShuttleMoveCheck = (m_pShuttleChild->m_fRealShuttleSpeedMax - m_pShuttleChild->m_fTempGravity) * m_fElapsedTime + 7.0f;
//				DBGOUT("M_Move %f(%f),", 
//						fShuttleMoveCheck, 
//						m_pShuttleChild->m_fRealShuttleSpeedMax);
			}
//			DBGOUT(" Current %f(%f)\n", 
//					fShuttleMoveLength, 
//					m_pShuttleChild->m_fShuttleSpeed);
//			DBGOUT("AdvanceTime %f\n", m_pShuttleChild->m_fAdvanceTime);

			if(m_pShuttleChild &&
				!m_pShuttleChild->m_bSkillMoveIsUse &&							// 스킬 제외
				m_bCharacter == FALSE &&										// 캐릭터 제외
				m_pTutorial->IsTutorialMode() == FALSE &&						// 튜토리얼 모드 제외
				m_pShuttleChild->m_dwState == _NORMAL &&						// 비행 상태가 _NORMAL만 가능
				m_pShuttleChild->m_fAdvanceTime <= 0.0f &&						// Advace 적용 (10초) 
				!m_pShuttleChild->m_pClientParty->IsFormationFlightMove() &&	// 편대이동은 제외
				fShuttleMoveCheck < fShuttleMoveLength &&						// 허용범위보다 크다(핵심)
				m_dwMoveCheckTime > nCheckTime)									// 체크시간 1분을 넘겼다
			{
				// 현재 셔틀 스피드 보다 움직인 거리가 크다면 핵 쓰고 있다.
				SendHackTime_MemoryCheck(fShuttleMoveCheck, fShuttleMoveLength, m_fElapsedTime);
				m_dwMoveCheckTime = 0;
				DBGOUT("안돼겠네~~! 허용(%f) 실제(%f)\n", fShuttleMoveCheck, fShuttleMoveLength);
			}
			m_vShuttleOldPos = m_pShuttleChild->m_vPos;

			// 2006-01-10 by ispark, 30분 동안 이상이 없다면 초기화(자료형 오버플러를 막기 위해서)
			if(m_dwMoveCheckTime > 1000 * 60 * 30)
				m_dwMoveCheckTime = 0;
//			if(m_pInterface)
//				m_pInterface->Tick();

			/*
			if(m_fBattleCountCheckTime > -1.0f)
			{
				m_fBattleCountCheckTime -= m_fElapsedTime;
//				if(!m_pShuttleChild->m_bPKMode && 
				if(m_fBattleCountCheckTime <= -1.0f)
				{
					m_fBattleCountCheckTime = -1.0f;
//					m_pShuttleChild->m_bPKMode = TRUE;
//					wsprintf(message,"결투 시작 : Go~!!");
//					m_pChat->CreateChatChild(message,COLOR_VOIP);
					ASSERT_ASSERT(m_pSound);
					m_pSound->PlayD3DSound(SOUND_PVP_START,m_pShuttleChild->m_vPos);
				}
				//if(!m_pShuttleChild->m_bPKMode && 
				else if(m_nBattlePartyCount != (int)m_fBattleCountCheckTime)
				{
					m_nBattlePartyCount = (int)m_fBattleCountCheckTime;
					wsprintf(message,"카운트 : %d",m_nBattlePartyCount);
					m_pChat->CreateChatChild(message,COLOR_VOIP);
					if(m_nBattlePartyCount < 10)
					{
						ASSERT_ASSERT(m_pSound);
						m_pSound->PlayD3DSound(SOUND_PVP_COUNT+m_nBattlePartyCount+35,m_pShuttleChild->m_vPos);
					}
				}
			}
			*/

			ShotDownGameTime();
			break;
		}
		case _CITY:
			{
				ShotDownGameTime();
				if(g_pCamera)
				{
					g_pCamera->SetViewPlane();
				}
				//if(m_pCamera)
					//m_pCamera->Tick();
				//////////////////////////////////////////////////////////////////////////////////////////////////
				g_pFrustum->Construct( g_pD3dDev );
				if(m_pShuttleChild)
				{
					m_pShuttleChild->Tick(m_fElapsedTime);
				}
				if(m_pScene)// 렌더링 오브젝트 선택
				{
					m_pScene->CheckObjectRenderList();
					m_pScene->m_pGround->Tick( m_fElapsedTime );// 그림자 위한 코드 들어감
				}
				if(m_pEffectList)// 장착 아이템
					m_pEffectList->Tick();
				if(m_pEffectRender)// 맵 오브젝트 이펙트
					m_pEffectRender->Tick(m_fElapsedTime);
				if(m_pUnitRender)
					m_pUnitRender->Tick(m_fElapsedTime);
				if(m_pChat)
					m_pChat->Tick();
//				if(m_pInterface)
//					m_pInterface->Tick();
			}
			break;
		case _SCRIPT:
			{
			}
			break;
		case _WAITING:
			{
				if(m_bClientQuit)
				{
					if(m_pStageEffect)
					{
#ifdef C_CLIENT_FILE_LOG
						g_cCustomOptimizer.WriteLog("_WAITING #1");	// 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif

						m_pStageEffect->Tick();
#ifdef C_CLIENT_FILE_LOG
						g_cCustomOptimizer.WriteLog("_WAITING #2");	// 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif

#ifdef C_END_GAME_STATE_FADE_OUT_AUTO_CANCEL_YMJOO
						m_pStageEffect->AutoSkipTickCount(180);	// 2013-11-27 by ymjoo 게임 종료 시 봐야 하는 스크린 자동 스킵
#endif
						if( !m_pStageEffect->IsRuning() )
						{
#ifdef C_CLIENT_FILE_LOG
							g_cCustomOptimizer.WriteLog("_WAITING #3");	// 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
							m_pStageEffect->InvalidateDeviceObjects();
#ifdef C_CLIENT_FILE_LOG
							g_cCustomOptimizer.WriteLog("_WAITING #4"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
							m_pStageEffect->DeleteDeviceObjects();
#ifdef C_CLIENT_FILE_LOG
							g_cCustomOptimizer.WriteLog("_WAITING #5"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
							SAFE_DELETE(m_pStageEffect);
#ifdef C_CLIENT_FILE_LOG
							g_cCustomOptimizer.WriteLog("_WAITING #6"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
//							if(m_bClientQuit)
//							{
								ChangeGameState(_ENDGAME);
#ifdef C_CLIENT_FILE_LOG
								g_cCustomOptimizer.WriteLog("_WAITING #7"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
								DBGOUT("Field Server State : T_FC_CHARACTER_GAMEEND_OK, Exit Client Program..\n");
#ifdef C_CLIENT_FILE_LOG
								g_cCustomOptimizer.WriteLog("_WAITING #8"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
//							}
//							else
//							{
//								ChangeGameState(_SELECT);
//								DBGOUT("필드서버 상황 : T_FC_CHARACTER_GAMEEND_OK, 게임 종료 --> SELECT창\n");
//							}

						}
					}
				}
//				else
//				{
//					ChangeGameState(_SELECT);
//					DBGOUT("필드서버 상황 : T_FC_CHARACTER_GAMEEND_OK, 게임 종료 --> SELECT창\n");
//				}
			}
			break;
		case _GAMEOVER:
			{
				if(m_pShuttleChild)
				{
					m_bClientQuit = TRUE;
					MSG_FC_CHARACTER_GAMEEND_OK sMsg;
					sMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex;
					FieldSocketCharacterGameEndOk(WM_PACKET_NOTIFY, &sMsg);
				}
				else
				{
					return E_FAIL;
				}
			}
			break;
		case _COMPLETE:
			break;
		case _PROLOGUE:
			break;
		case _ENDGAME:
			{
				return E_FAIL;
			}
			break;
		}
//	}
/*	else
	{
		if( m_pAtumIntro)
		{
			m_pAtumIntro->Tick(m_fElapsedTime) ;
		}
	}
*/	
//#ifdef _DEBUG
//	m_fDebugTimerCheckTime += m_fElapsedTime;
//	if(m_fDebugTimerCheckTime > 10)
//	{
//		DBGOUT("Send_MOVE_Packet/10sec(Timer):%d\n",m_nDebugTimerMove );
//		m_nDebugTimerMove = 0;
//		m_fDebugTimerCheckTime = 0;
//	}
//#endif

	// 2004-12-13 by jschoi - "Fade-In & Fade-Out"
	FadeEffectTick();

#ifdef _DEBUG
	m_pFxSystem->Tick(m_fElapsedTime);
#endif
	RequestEnableTick(m_fElapsedTime);

	// 2014-12-03 by jwLee 메모리 출력 코드 추가
	if(m_pProfiler)
		m_pProfiler->MemoryCheck();
	// end 2014-12-03 by jwLee 메모리 출력 코드 추가

	return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-09-05 by bhsohn China IME Working
/// \date		2007-09-05 ~ 2007-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::TickImeChange()
{
	// 2007-12-18 by bhsohn Tawan IME Working
#ifdef TAIWAN_RELEASE
	return;
#endif
	// end 2007-12-18 by bhsohn Tawan IME Working
#ifdef LANGUAGE_CHINA
	DWORD dwImeChangeTime = g_input.GetImeChangeTime();
	if(0 == dwImeChangeTime)
	{
		return;
	}

	DWORD dwCurrentTime = timeGetTime();
	if(dwCurrentTime < dwImeChangeTime)
	{
		return;
	}
	DWORD dwTimeCap = dwCurrentTime - dwImeChangeTime;
	if(dwTimeCap < 1000)
	{
		return;
	}		
	m_inputkey.NextImeSelect();		
#endif
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			HRESULT CAtumApplication::InActiveFrameMove() 
/// \brief		창이 비활성시 쓰는 Tick
/// \author		ispark
/// \date		2006-07-06 ~ 2006-07-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
HRESULT CAtumApplication::InActiveFrameMove() 
{
	// 2004-11-08 by jschoi
	m_dwSpeedHackTimer += m_fElapsedTime*1000;
	
	if(m_pShuttleChild &&
		m_dwSpeedHackTimer > 200 &&
		m_pScene->m_byMapType != MAP_TYPE_TUTORIAL &&
		(m_bCharacter || UNIT_STATE_MOVE(m_pShuttleChild->m_dwState) || g_fSendMovePacket > 0) )
	{
		SendMovePacket(FALSE);
		m_nSendMovePacketCount++;
		if(m_dwSpeedHackTimer > 200)
		{
			m_dwSpeedHackTimer = 0;
		}
	}

	return S_OK;
}

void CAtumApplication::RenderCity() 
{
	FLOG("CAtumApplication::RenderCity()");
	g_pD3dDev->SetTransform( D3DTS_VIEW,       &m_pCamera->GetViewMatrix() );
	g_pD3dDev->SetTransform( D3DTS_PROJECTION, &m_pCamera->GetProjMatrix() );
 	g_pD3dDev->SetLight( 0, &m_pScene->m_light0 );

	if(m_pScene)// object render
	{
		m_pScene->RenderCity();
	}
//	m_pShuttleChild->Render();
//	if(g_pSOption->sReflactive)
//	{
		g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
		m_pShuttleChild->Render();
		g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
//	}
//	else
//	{
//		m_pShuttleChild->Render();
//	}

 	g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
    g_pD3dDev->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
	g_pD3dDev->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
	g_pD3dDev->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	g_pD3dDev->SetRenderState( D3DRS_LIGHTING, FALSE );
	g_pD3dDev->SetFVF( D3DFVF_SPRITEVERTEX );
    g_pD3dDev->SetRenderState( D3DRS_FOGENABLE, FALSE );

}
/*
void CAtumApplication::RenderSleep()
{
	D3DXVECTOR3 vTemp,vTemppos;
	D3DXMATRIX mat;
	D3DXVec3Normalize(&vTemp,&(m_pCamera->GetLookatPt() - m_pCamera->GetEyePt()));
	vTemppos = m_pCamera->GetEyePt()+1.5f*vTemp;

	g_pD3dDev->SetRenderState( D3DRS_LIGHTING, FALSE );
	g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE,  TRUE );
	g_pD3dDev->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
	g_pD3dDev->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR );
	g_pD3dDev->SetRenderState( D3DRS_ZENABLE, FALSE );
	D3DXMatrixIdentity(&mat);
	mat = m_pCamera->GetBillboardMatrix();
	mat._41 = vTemppos.x;
	mat._42 = vTemppos.y;
	mat._43 = vTemppos.z;
	g_pD3dDev->SetTexture(0, NULL);
	g_pD3dDev->SetVertexShader(D3DFVF_NOSPRITE);
	g_pD3dDev->SetTransform(D3DTS_WORLD, &mat);
	g_pD3dDev->SetStreamSource(0, m_pVBSleep, sizeof(NOSPRITE));
	g_pD3dDev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
*/
void CAtumApplication::RenderGame() 
{
	FLOG("CAtumApplication::RenderGame()");
	// 현재 뷰&프로젝션 트랜스폼을 적용한다.
	g_pD3dDev->SetTransform( D3DTS_VIEW,       &m_pCamera->GetViewMatrix() );
	g_pD3dDev->SetTransform( D3DTS_PROJECTION, &m_pCamera->GetProjMatrix() );
 	g_pD3dDev->SetLight( 0, &m_pScene->m_light0 );

	// Ground Render
//	if(m_pScene->m_byMapType != MAP_TYPE_TUTORIAL && m_pScene->m_pETCRender)
//	{
//		m_pScene->m_pETCRender->SkyRender();
//	}
	if(IsSkyRenderEnable( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex ))
	{
		m_pScene->m_pETCRender->SkyRender();
	}

//#ifdef _DEBUG
	// 2005-07-28 by ispark
	// 캐릭터인 경우 라이트를 사용 안함
	if( m_bCharacter == FALSE && 
		g_pStoreData->FindItemInInventoryByWindowPos(POS_PROW) != NULL &&
		(g_pScene->m_bNight == TRUE ||
		IsTileMapRenderEnable(g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex) == FALSE))
	{
		g_pScene->m_light1.Position		= g_pShuttleChild->m_vPos;
		g_pScene->m_light1.Direction	= g_pShuttleChild->m_vVel;
		g_pScene->m_light1.Range		= RANGE_OF_VISION;
		g_pD3dDev->SetLight( 1, &g_pScene->m_light1 );
		g_pD3dDev->LightEnable( 1, TRUE );
	}
	else
	{
		g_pD3dDev->LightEnable( 1, FALSE );
	}
//#else
//	g_pD3dDev->LightEnable( 1, FALSE );
//#endif
	g_pD3dDev->LightEnable( 2, FALSE );
	g_pD3dDev->LightEnable( 3, FALSE );
	
	if(g_pGround)
	{
		g_pGround->Render();
	}
	
	if(m_pScene)
	{
		m_pScene->Render();
	}	
//	if( //m_pScene->m_byMapType != MAP_TYPE_TUTORIAL && 
//		m_pScene->m_byMapType != MAP_TYPE_CITY && 
//		m_pScene->m_byWeatherType != WEATHER_FOGGY)// &&
//		//IsSunRenderEnable(m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex))//임시 코드
//	{
//		if(m_pEffectRender)
//			m_pEffectRender->RenderSun();
//	}

	// 2004-12-16 by jschoi - ShuttleChild는 UnitRenderList에 포함.
//	if(m_pShuttleChild)
//	{
//		m_pShuttleChild->Render();
//		if( (m_pCamera->GetCamType() == CAMERA_TYPE_NORMAL && 
//			m_pShuttleChild->m_bAttackMode != 2 ) ||
//			m_pShuttleChild->m_bIsCameraPattern == TRUE)// 1인칭인 경우, 시즈모드인 경우 렌더링 안함
//		{
//			if(g_pSOption->sReflactive)
//			{
//			g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
//			m_pShuttleChild->Render();
//			g_pD3dDev->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
//			}
//			else
//			{
//				
//			}
//		}
//	}

	// 2004-03-19 by dhkwon
	//if(m_pShuttleChild)
	//	m_pShuttleChild->RenderTrace();

	///////////////////////////////////////////////////////////////////////////////////////////////////////////
	if(m_pShuttleChild)
	{
		if(m_pShuttleChild->m_dwState == _EXPLODING || 
			m_pShuttleChild->m_dwState == _EXPLODED	|| 
			m_pShuttleChild->m_dwState == _FALLING || 
			m_pShuttleChild->m_dwState == _FALLEN)
		{
			D3DXVECTOR3 vTemp,vTemppos;
			D3DXMATRIX mat;
			D3DXVec3Normalize(&vTemp,&(m_pCamera->GetLookatPt() - m_pCamera->GetEyePt()));
			vTemppos = m_pCamera->GetEyePt()+1.5f*vTemp;

			g_pD3dDev->SetRenderState( D3DRS_LIGHTING, FALSE );
			g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE,  TRUE );
			g_pD3dDev->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
			g_pD3dDev->SetRenderState( D3DRS_DESTBLEND,  D3DBLEND_DESTALPHA );
			g_pD3dDev->SetRenderState( D3DRS_ZENABLE, FALSE );
			D3DXMatrixIdentity(&mat);
			mat = m_pCamera->GetBillboardMatrix();
			mat._41 = vTemppos.x;
			mat._42 = vTemppos.y;
			mat._43 = vTemppos.z;
			g_pD3dDev->SetTexture(0, NULL);
			g_pD3dDev->SetFVF(D3DFVF_NOSPRITE);
			g_pD3dDev->SetTransform(D3DTS_WORLD, &mat);
			g_pD3dDev->SetStreamSource(0, m_pVBSleep,0, sizeof(NOSPRITE));
			g_pD3dDev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
		}
	}

	D3DXVECTOR3 vDir = m_pCamera->GetViewDir();
	D3DXVec3Normalize(&vDir,&vDir);

	D3DXMATRIX mBillboard,mScale,m;
	D3DXVECTOR3 v,v1,vPos,vSide,vUp, vView;
	vView = m_pCamera->GetEyePt();
	vPos = vView + 100.0f*vDir;
	D3DXVec3Normalize(&vSide,&m_pCamera->GetCross());
	D3DXVec3Cross(&vUp,&vSide,&vDir);

	vPos += vUp*10.0f;
	mBillboard = m_pCamera->GetBillboardMatrix();
 	g_pD3dDev->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
    g_pD3dDev->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
	g_pD3dDev->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
	g_pD3dDev->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	g_pD3dDev->SetRenderState( D3DRS_ZENABLE,   FALSE );
	g_pD3dDev->SetRenderState( D3DRS_LIGHTING, FALSE );
	g_pD3dDev->SetFVF( D3DFVF_SPRITEVERTEX );
    g_pD3dDev->SetRenderState( D3DRS_FOGENABLE, FALSE );
}

// iCoordW가 0보다 클경우 스크린 안쪽에 있으며, 좌표는 iCoordX, iCoordY가 된다.
void CAtumApplication::CalcObjectSourceScreenCoords( D3DXVECTOR3 vObjPos, 
													int iScreenWidth, 
													int iScreenHeight, 
													int &iCoordX, 
													int &iCoordY, 
													int &iCoordW )
{
	FLOG("CAtumApplication::CalcObjectSourceScreenCoords");
	D3DXMATRIX matWorld, matView, matConcat, matViewportScale, matProj;
	D3DXVECTOR4 vResult;
	matViewportScale = D3DXMATRIX(iScreenWidth/2.0f, 0, 0, 0,
									0, -iScreenHeight/2.0f, 0, 0,
									0, 0, 1, 0,
									iScreenWidth/2.0f, iScreenHeight/2.0f, 0, 1);
	matView = m_pCamera->GetViewMatrix();
	D3DXMatrixIdentity(&matWorld); // no need for a world xform
	matConcat = matWorld;
	matConcat *= matView;
	matConcat *= m_pCamera->GetProjMatrix();
	matConcat *= matViewportScale;
	D3DXVec3Transform(&vResult, &vObjPos, &matConcat);
	iCoordX = (int)(vResult.x/vResult.w);
	iCoordY = (int)(vResult.y/vResult.w);
	iCoordW = (int)vResult.w;	
	// 2005-07-29 by ispark
	// 정확하지 않은 2D좌표로 인해 수정중
//	D3DXMATRIX matWorld, matView, matConcat, matViewportScale, matScreen;
//	D3DXVECTOR4 vResult;
//
////  m_pd3dDevice->GetTransform( D3DTS_PROJECTION, &matViewportScale );
//	matViewportScale = m_pCamera->GetProjMatrix();
//
//	matScreen = D3DXMATRIX(iScreenWidth/2.0f, 0, 0, 0,
//							0, -iScreenHeight/2.0f, 0, 0,
//							0, 0, 1, 0,
//							iScreenWidth/2.0f, iScreenHeight/2.0f, 0, 1);
//	matView = m_pCamera->GetViewMatrix();
////	D3DXMatrixIdentity(&matWorld); // no need for a world xform
//	D3DXMatrixIdentity(&matConcat); // no need for a world xform
////	m_pd3dDevice->GetTransform( D3DTS_VIEW, &matView );
////	m_pd3dDevice->GetTransform( D3DTS_WORLD, &matWorld );
////	matConcat = matWorld;
////	matConcat = m_pCharacterChild->m_mMatrix;
//	matConcat = matConcat * matView;
////	matConcat *= m_pCamera->GetProjMatrix();
//	matConcat = matConcat * matViewportScale;
//	matConcat = matConcat * matScreen;
////	D3DXMatrixInverse( &matConcat, NULL, &matConcat );
//	D3DXVec3Transform(&vResult, &vObjPos, &matConcat);
//	iCoordX = (int)(vResult.x/vResult.w);
//	iCoordY = (int)(vResult.y/vResult.w);
//	iCoordW = (int)vResult.w;

//	D3DXVec4Transform(&vResult, &vResult, &matScreen);
}

// 반드시 IME를 Disable하기 전에 이 함수를 호출해야한다.
VOID CAtumApplication::CleanText()
{
	FLOG("CAtumApplication::CleanText()");
	// 2009-01-28 by bhsohn 포커스 변경시 IME 초기화 되게 수정
	DBGOUT("VOID CAtumApplication::CleanText() \n");
	char text[SIZE_MAX_STRING_1024];
	ZERO_MEMORY(text);
	int strlenComp = g_input.GetComp(text, sizeof(text));
	
	if(strlenComp >0)
	{
		// 압출중일떄만 클리어
		HIMC hIMC = ::ImmGetContext( GetHwnd() );
		ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
		ImmSetCompositionString( hIMC, SCS_SETSTR, NULL, 0, NULL, 0 );
		ImmNotifyIME(hIMC, NI_CLOSECANDIDATE, 0, 0);
		ImmReleaseContext( GetHwnd(), hIMC );
	}
	// end 2009-01-28 by bhsohn 포커스 변경시 IME 초기화 되게 수정

	memset(m_inputkey.m_full_str,0x00,sizeof(m_inputkey.m_full_str));
	memset(m_strChat,0x00,sizeof(m_strChat));
	m_inputkey.m_str_pos=0;
	m_inputkey.m_ime_composing=FALSE;
	g_input.ResetFontBuffer();
//	g_input.SetChangeEnterState(TRUE);	
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-26 by bhsohn Japan IME
/// \date		2009-02-26 ~ 2009-02-26
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CleanIMEControl()
{
	HIMC hIMC = ::ImmGetContext( GetHwnd() );
	ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
	ImmSetCompositionString( hIMC, SCS_SETSTR, NULL, 0, NULL, 0 );
	ImmNotifyIME(hIMC, NI_CLOSECANDIDATE, 0, 0);
	ImmReleaseContext( GetHwnd(), hIMC );
}

void CAtumApplication::SetCamPosInit()
{
	FLOG("CAtumApplication::SetCamPosInit()");
    FLOAT fAspect = ((FLOAT)m_d3dsdBackBuffer.Width) / m_d3dsdBackBuffer.Height;
	// Camera Setting
	if(m_pScene->m_byMapType == MAP_TYPE_CITY)
	{
		m_pCamera->SetCityCamera();
		//m_pCamera->Init(m_pShuttleChild->m_vPos,(MAP_TYPE_CITY_UNIT_POS+D3DXVECTOR3(0.0f, 85.0f, -198.0f))-m_pShuttleChild->m_vPos,D3DX_PI/15.0f, 60.0f);
		//m_pCamera->SetProjParams( D3DX_PI*(93.0f/180.0f), fAspect, 1.0f, 10000.0f );		// 60 도
	}
	else
	{
		D3DXVECTOR3 vCamStartPos = m_pShuttleChild->m_vPos-50.0f*m_pShuttleChild->m_vVel+30.0f*m_pShuttleChild->m_vUp;//D3DXVECTOR3(0.0f, 0.0f, 0.0f);
		D3DXVECTOR3 vCamEndPos = m_pShuttleChild->m_vVel*10000.0f + vCamStartPos;
//		m_pCamera->Init(m_pShuttleChild->m_vPos,m_pShuttleChild-m_vVel, 3.14f/13.0f, 60.0f);//3.14f/13.0f : 유닛과 카메라 높이가 15가 되는 것을 만듬
		// 2005-08-10 by ispark
		// 캐릭터일 때와 기어일 때 판단
		if(g_pD3dApp->m_bCharacter == TRUE)
		{
			D3DXVECTOR3 vPos = g_pCharacterChild->m_vPos;
			vPos.y += GetCharacterHeight(g_pCharacterChild->m_nUnitNum);
			m_pCamera->Init(vPos, g_pCharacterChild->m_vVel);
		}
		else
		{
			m_pCamera->Init(m_pShuttleChild->m_vPos,m_pShuttleChild->m_vVel, 3.14f/13.0f, 60.0f);		// 2014-02-06 by ymjoo 카메라가 지나치게 가까워지는 현상 수정
			//m_pCamera->Init(m_pShuttleChild->m_vPos,m_pShuttleChild->m_vVel, 3.14f/13.0f, 30.0f);//3.14f/13.0f : 유닛과 카메라 높이가 15가 되는 것을 만듬 // 2005.6.13 by dhkwon
		}
		m_pCamera->SetProjParams( D3DX_PI/3, fAspect, 1.0f, 100000.0f );		// 60 도
	}
}

int CAtumApplication::MsgProcGame( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
//	static int nCheckObjectList = 0;
	
	// 2004-11-11 by jschoi
	if(m_dwCheckSpeedHackTime == 0)
	{
		m_dwCheckSpeedHackTime = timeGetTime();	// 시간 초기화
	}

	switch( uMsg )
	{
	case WM_TIMER:
		{
			switch(wParam)
			{
			case _TIMER_MOVE:
				{
					// 2004-11-11 by jschoi 윈도우가 활성화 상태에서만 스피드 핵을 체크한다.
//					if(m_bActive == TRUE)
					{
						if(m_nCheckSpeedHackCount >= 50)
						{
							DWORD dwCheckCurrentTime = timeGetTime();
							if(m_nSendMovePacketCount > 60)
							{
								MSG_FC_CHARACTER_SPEED_HACK_USER sMsg;
								memset(&sMsg,0x00,sizeof(sMsg)); 
								sMsg.dwTimeGap = dwCheckCurrentTime - m_dwCheckSpeedHackTime;
								sMsg.nSendMoveCounts = m_nSendMovePacketCount;
								m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SPEED_HACK_USER, (char*)&sMsg, sizeof(sMsg)); 
								DBGOUT("Send to Server SpeedHack User.(Gap:%d,Count:%d)\n",
									sMsg.dwTimeGap,sMsg.nSendMoveCounts);
							}
//							DBGOUT("m_nSendMovePacketCount : %d , sMsg.dwTimeGap : %d\n",m_nSendMovePacketCount,dwCheckCurrentTime - m_dwCheckSpeedHackTime);
							m_nSendMovePacketCount = 0;
							m_nCheckSpeedHackCount = 0;
							m_dwCheckSpeedHackTime = dwCheckCurrentTime;
						}
						m_nCheckSpeedHackCount++;
					}
					
					// 2008-01-16 by bhsohn 1초동안 강제로 클라이언트 멈추게했을시, 무브 패킷을 보냄					
					if(IsCompultionGame(TIME_MOVE_CAP))
					{
						SendMovePacket(FALSE);
					}
					
					// 2008-01-16 by bhsohn 1초동안 강제로 클라이언트 멈추게했을시, 무브 패킷을 보냄
					// 2004-11-08 by jschoi , cmkwon
					// 이곳에서는 윈도우가 비활성화(포커스를 잃었을때 에만 T_FC_MOVE를 보낸다.
					// 2006-07-06 by ispark, SendMovePacket은 비활성화 일때도 보낸다. m_bActive 버그가 있다.
//					if( m_bActive == FALSE && 
//						m_pScene->m_byMapType != MAP_TYPE_TUTORIAL &&
//						UNIT_STATE_MOVE(m_pShuttleChild->m_dwState) )
//					{
//						// 2008-01-15 by bhsohn 프로그램 응답없음에 대한 처리
//						DBGOUT("SendMovePacket(FALSE); \n");
//
//						SendMovePacket(FALSE);
//						g_fSendMovePacket -= m_fElapsedTime;
//						m_dwCurTickTime = timeGetTime();
//						//float fDistance = D3DXVec3Length(&(m_pShuttleChild->m_vPos-m_vClientOldPos));
//						USHORT		sTimeGap = m_dwCurTickTime - m_dwLastTickTime;
//						MSG_FC_MOVE sMsg;
//						memset(&sMsg,0x00,sizeof(sMsg));
//						sMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex;
//
//						// 2004-11-01 by jschoi with cmkwon
//						// Window가 포커스를 잃었을 때(Alt+Tab) FrameMove(Tick)이 돌지 않으므로,
//						// m_dwSpeedHackTimer 가 항상 0이 된다. 따라서 이 경우에는 강제로 200미리세컨드로 시간을 준다.
//
//						sMsg.TimeGap = 200;
//						if(m_dwSpeedHackTimer == 0)
//						{
//							sMsg.TimeGap = 200;
//						}
//						else
//						{
//							sMsg.TimeGap = m_dwSpeedHackTimer;
//						}
//
//						//if(fDistance > 255)
//						//	fDistance = 255.0f;
//						//sMsg.DistanceGap = (BYTE)fDistance;
//						sMsg.PositionVector = m_pShuttleChild->m_vPos;
//						sMsg.TargetVector = m_pShuttleChild->m_vVel*1000.0f;
//						D3DXVECTOR3 vUp;
//						vUp.x = m_pShuttleChild->m_mMatrix._21;
//						vUp.y = m_pShuttleChild->m_mMatrix._22;
//						vUp.z = m_pShuttleChild->m_mMatrix._23;
//						sMsg.UpVector = vUp*1000.0f;
//						//sMsg.UpVector = m_pShuttleChild->m_vUp*1000.0f;
//						m_pFieldWinSocket->SendMsg( T_FC_MOVE, (char*)&sMsg, sizeof(sMsg));
//						m_vClientOldPos = m_pShuttleChild->m_vPos;
//						m_dwLastTickTime = m_dwCurTickTime;
//						m_dwSpeedHackTimer = 0;
//						if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
//						{
//							m_pShuttleChild->SendMoveWeaponVel();
//						}
//#ifdef _DEBUG
//						m_nDebugTimerMove++;
//#endif
//					}
				}
				break;
			}
		}
		break;
	case WM_MOUSEWHEEL:
		{
			// 2005-08-17 by ispark
			if((m_pCamera->m_bIsCamControl ||
				g_pShuttleChild->m_dwState == _LANDED) &&
				m_bCharacter == FALSE)
			{
				m_pCamera->SetControlCamPos((int)wParam);
			}
		}
		break;
	case WM_LBUTTONUP:
		{
			if(m_bDeleteItemSend && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{// - 키를 누르면 아이템 지움 프로토콜 보낼 준비를 하게 된다.
				m_bDeleteItemSend = FALSE;
				m_pScene->SendItemDeleteItemAdmin( LOWORD(lParam), HIWORD(lParam) );
			}
		}
		break;
	case WM_KEYDOWN:
		{
#ifdef _DEBUG
			// 2005-11-16 by ispark
			// 관리자 모드시에만 '*'키를 누르면 이벤트 오브젝트 보이게 함
			if(wParam == 106 && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))
			{
				m_bEventObjectRender = !m_bEventObjectRender;
			}
#endif

			if(wParam == 109 && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{// - 키를 누르면 아이템 지움 프로토콜 보낼 준비를 하게 된다.
				m_bDeleteItemSend = TRUE;
			}

			if(m_bChatMode && wParam == 38 && m_strChat[0] == '"')
			{// Up
				if(m_pShuttleChild->m_bOldPToPPos != 200)
				{
					if(strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]))
					{
						if(m_pShuttleChild->m_bOldPToPPos == MAX_CHAT_PTOP_CONT - 1)
							m_pShuttleChild->m_bOldPToPPos = 0;
						else
							m_pShuttleChild->m_bOldPToPPos++;
						if(strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]))
						{
							memset(m_strChat,0x00,SIZE_MAX_CHAT_MESSAGE);
							m_strChat[0] = '"';
							strncpy(m_strChat+1,m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos],strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]));
							m_strChat[strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos])+1] = ' ';
							memset(m_inputkey.m_full_str,0x00,sizeof(m_inputkey.m_full_str));
							strncpy(m_inputkey.m_full_str,m_strChat,strlen(m_strChat));
							m_inputkey.m_str_pos = strlen(m_strChat);
						}
						else
						{
							if(m_pShuttleChild->m_bOldPToPPos == 0)
								m_pShuttleChild->m_bOldPToPPos = MAX_CHAT_PTOP_CONT-1;
							else
								m_pShuttleChild->m_bOldPToPPos--;
						}
						return 0;
					}
				}
			}
			if(m_bChatMode && wParam == 40 && m_strChat[0] == '"')
			{// Down
				if(m_pShuttleChild->m_bOldPToPPos != 200)
				{
					if(strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]))
					{
						if(m_pShuttleChild->m_bOldPToPPos == 0)
							m_pShuttleChild->m_bOldPToPPos = MAX_CHAT_PTOP_CONT-1;
						else
							m_pShuttleChild->m_bOldPToPPos--;
						if(strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]))
						{
							memset(m_strChat,0x00,SIZE_MAX_CHAT_MESSAGE);
							m_strChat[0] = '"';
							strncpy(m_strChat+1,m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos],strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos]));
							m_strChat[strlen(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bOldPToPPos])+1] = ' ';
							memset(m_inputkey.m_full_str,0x00,sizeof(m_inputkey.m_full_str));
							strncpy(m_inputkey.m_full_str,m_strChat,strlen(m_strChat));
							m_inputkey.m_str_pos = strlen(m_strChat);
						}
						else
						{
							if(m_pShuttleChild->m_bOldPToPPos == MAX_CHAT_PTOP_CONT - 1)
								m_pShuttleChild->m_bOldPToPPos = 0;
							else
								m_pShuttleChild->m_bOldPToPPos++;
						}
					}
				}
			}
		}
		break;
	}

	if(m_bCharacter)
	{
		if(m_pCharacterChild)
		{
			m_pCharacterChild->WndProc(uMsg, wParam, lParam);
		}
	}
	else
	{
		// 2006-09-20 by ispark, 튜토리얼 체크
		if((g_pTutorial->IsTutorialMode() == FALSE ||
			g_pTutorial->IsUseShuttleTick() == TRUE ) &&
			m_pShuttleChild)
		{
			m_pShuttleChild->WndProc(uMsg,wParam,lParam);
		}
	}

	if(m_pTutorial->IsTutorialMode() == TRUE)
		m_pTutorial->WndProc(uMsg,wParam,lParam);

	return INF_MSGPROC_NORMAL;
}
int CAtumApplication::MsgProcCity( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	static BOOL bRbuttonDown = FALSE;// camera control
	static POINT ptOld;// camera control
	switch(uMsg)
	{
	case WM_MOUSEWHEEL:
		{
			if(!g_pInterface->m_pCityBase->GetCurrentBuildingNPC())
			{
				m_pCamera->SetCameraZoomInOut( (int)wParam );// camera control
			}
		}
		break;
	case WM_RBUTTONDOWN:
		{
			bRbuttonDown = TRUE;// camera control

			ptOld.x = LOWORD(lParam);
			ptOld.y = HIWORD(lParam);

			CheckMouseReverse(&ptOld);
		}
		break;
	case WM_RBUTTONUP:
		{
			bRbuttonDown = FALSE;// camera control
		}
		break;
	case WM_MOUSEMOVE:
		{
			if(bRbuttonDown && !g_pInterface->m_pCityBase->GetCurrentBuildingNPC())// camera control
			{
				POINT pt;
				pt.x = LOWORD(lParam);
				pt.y = HIWORD(lParam);

				CheckMouseReverse(&pt);
				m_pCamera->SetCameraRotate( (int)pt.x - (int)ptOld.x, (int)pt.y - (int)ptOld.y );
				ptOld = pt;
			}
		}
		break;
//	case WM_KEYDOWN:
//		{
//			const int nKeyMove = 1; // 키보드 감도
//			switch(wParam)
//			{
//			case VK_LEFT:
//				m_pCamera->SetCameraRotate(nKeyMove,0);
//				break;
//			case VK_RIGHT:
//				m_pCamera->SetCameraRotate(-nKeyMove,0);
//				break;
//			case VK_UP:
//				m_pCamera->SetCameraRotate(0,nKeyMove);
//				break;
//			case VK_DOWN:
//				m_pCamera->SetCameraRotate(0,-nKeyMove);
//				break;
//			case VK_PRIOR:
//				m_pCamera->SetCameraZoomInOut(nKeyMove);
//				break;
//			case VK_NEXT:
//				m_pCamera->SetCameraZoomInOut(-nKeyMove);
//				break;
//			}
//		}
//		break;
	}
	// 2005-07-21 by ispark
	// 캐릭터 추가
	if(m_bCharacter)
	{
		if(m_pCharacterChild)
			m_pCharacterChild->WndProc(uMsg, wParam, lParam);
	}
	else
	{
	if(m_pShuttleChild)
		m_pShuttleChild->WndProc(uMsg,wParam,lParam);
	}
	return INF_MSGPROC_NORMAL;
}
int CAtumApplication::MsgProcCreate( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	switch(uMsg)
	{
		// 2008-12-15 by bhsohn 비스타에서 IME시스템 동작 안되는 문제 해결
	case WM_IME_STARTCOMPOSITION:
		{
			g_input.SetImeRtnValue(TRUE);
			return INF_MSGPROC_BREAK;
		}
		break;
		// end 2008-12-15 by bhsohn 비스타에서 IME시스템 동작 안되는 문제 해결
	case WM_IME_NOTIFY:
	case WM_IME_COMPOSITION:
	case WM_INPUTLANGCHANGE:
	case WM_IME_ENDCOMPOSITION:
	case WM_IME_SETCONTEXT:	
	case WM_CHAR:
		{
			g_nRenderCandidate = SET_CREATEMENU_CANDIDATE;
			int bFlag = FALSE;
			int nLanguageChoice = 0;
			
#ifdef LANGUAGE_VIETNAM
			if(m_dwGameState == _SELECT || m_dwGameState == _CREATE)
				g_pD3dApp->m_inputkey.SetInputLanguage(INPUT_LANGUAGE_ENG);
#endif
			if(INF_MSGPROC_BREAK == g_pD3dApp->m_inputkey.KeyMapping(g_pD3dApp->GetHwnd(), uMsg, wParam, lParam))
				bFlag = TRUE;			

			//////////////////////////////////////////////////////////////////////////
			char text[256];
			char stringtext[512];
			ZERO_MEMORY(text);
			ZERO_MEMORY(stringtext);

			// 2007-11-06 by bhsohn 베트남 바자상점에서  입력키 안되는 문제 처리
			//int strlenInput = g_input.GetInput(text, sizeof(text));
			int nLanguageConversion = g_pD3dApp->m_inputkey.GetInputLanguage();					
			int strlenInput = g_input.GetInput(text, sizeof(text), nLanguageConversion);
			
			strcpy(stringtext, text);
			ZERO_MEMORY(text);
			int strlenComp = g_input.GetComp(text, sizeof(text));
			strcat(stringtext, text);
			
			// 2008-10-10 by bhsohn Tawan IME Working
//#ifdef TAIWAN_RELEASE
			// 2008-12-10 by bhsohn JAPAN IME Working
#if defined(TAIWAN_RELEASE)
			if(strlenComp>=20)
			{
				keybd_event(VK_SPACE, 0, KEYEVENTF_EXTENDEDKEY, 0);
			}
			// 2009-02-11 by bhsohn Japan IME Fix
#elif defined(LANGUAGE_JAPAN)

#else
			if(strlenComp>=8)
			{
				keybd_event(VK_SPACE, 0, KEYEVENTF_EXTENDEDKEY, 0);
			}
#endif
			// end 2008-10-10 by bhsohn Tawan IME Working

			// 2009-02-10 by bhsohn Japan Charcter Create
#if defined(LANGUAGE_JAPAN)
			if( strlenInput+strlenComp >= (24))
			{
				keybd_event(VK_BACK, 0, KEYEVENTF_EXTENDEDKEY, 0);
 			}
#else
			if( strlenInput+strlenComp >= SIZE_MAXUSE_CHARACTER_NAME )	// 2006-05-20 by ispark
			{
				keybd_event(VK_BACK, 0, KEYEVENTF_EXTENDEDKEY, 0);
 			}
#endif			
			// end 2009-02-10 by bhsohn Japan Charcter Create

			if(g_pSelect && g_pSelect->m_pCreateMenu)
			{
				if(strlen(stringtext)>0)
				{
					vector<string> vecTemp;
					// 2009-02-10 by bhsohn Japan Charcter Create
#if defined(LANGUAGE_JAPAN)
					::StringCullingUserData(stringtext, MAX_PATH, &vecTemp);
					strncpy(g_pSelect->m_pCreateMenu->m_strCharacterName, (char*)vecTemp[0].c_str(),MAX_PATH);
#else
					::StringCullingUserData(stringtext, SIZE_MAXUSE_CHARACTER_NAME, &vecTemp);
					strncpy(g_pSelect->m_pCreateMenu->m_strCharacterName, (char*)vecTemp[0].c_str(),SIZE_MAXUSE_CHARACTER_NAME);
#endif
					
					m_inputkey.m_str_pos  = strlen(g_pSelect->m_pCreateMenu->m_strCharacterName)+1;
				}
				else
				{
					ZERO_MEMORY(g_pSelect->m_pCreateMenu->m_strCharacterName);
				}
			}
			//////////////////////////////////////////////////////////////////////////
			if(bFlag == TRUE)
				return INF_MSGPROC_BREAK;

		}
		break;
		// 2007-06-11 by bhsohn China IME Working
	case WM_KEYDOWN:
		{
			#ifdef LANGUAGE_CHINA
				return g_pD3dApp->m_inputkey.OnIMEKeyDown(g_pD3dApp->GetHwnd(), uMsg, wParam, lParam);
			#endif

		}
		break;
	}
	return INF_MSGPROC_NORMAL;
}

LRESULT CAtumApplication::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	FLOG("CAtumApplication::MsgProc()");
	// 2008-11-06 by bhsohn 마우스 가두기 모드 보완
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
//	if(IsWindowMode())
//	{		
//		// 윈도우 모드시 마우스 잠금기능
//		if(g_pD3dApp->IsOptionEtc(OPTION_RADIO_MOUSE_LOCK))
//		{
//			ForceMousePos(uMsg, wParam, lParam);
//		}
//	}
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리
	// end 2008-11-06 by bhsohn 마우스 가두기 모드 보완

	// 2008-12-15 by bhsohn 비스타에서 IME시스템 동작 안되는 문제 해결
	g_input.SetImeRtnValue(FALSE);

	if(m_pStageEffect)
	{
		m_pStageEffect->WndProc( uMsg, wParam, lParam );
	}
	if(m_pInterface)
	{
		if(m_pInterface->WndProc(uMsg,wParam,lParam) == INF_MSGPROC_BREAK)
			return S_OK;
	}
	switch(uMsg)
	{	
	case 78:// ! ?
		{
			return S_OK;
		}
		break;
	case WM_CREATE:
		{			
			g_input.OnInputLanguageChange(hWnd, 0, (LPARAM)GetKeyboardLayout(0));			
			SetHanFontLang(lParam);

//#ifdef LANGUAGE_KOREA
#if defined(KOR_HANGEUL_START_HSSON)
			// 한글 모드로 시작
			// 2006-09-27 by ispark, 한국만 포함
			g_pD3dApp->m_inputkey.ChangeInputLanguage(hWnd);
#elif defined(LANGUAGE_CHINA)			
			// 2007.04.24 by bhsohn China IME Working
			//g_pD3dApp->m_inputkey.SetInputLanguage(INPUT_LANGUAGE_CHINA);	
			// 2007-06-21 by bhsohn China IME Working
			//g_pD3dApp->m_inputkey.SetMSPYIME();
#endif			
		}
		break;
	case WM_ASYNC_EVENT:
		{
			m_pFieldWinSocket->OnAsyncEvent(lParam);
			return S_OK;
		}
		break;
	case WM_PACKET_NOTIFY:
		{
			// 2007-11-22 by bhsohn 아레나 통합서버
			//OnRecvFieldSocketMessage(wParam);
			OnRecvFieldSocketMessage(wParam, uMsg);
			return S_OK;
		}
		// 2007-11-22 by bhsohn 아레나 통합서버
	case WM_ASYNC_ARENA_EVENT:
		{
			m_pFieldWinSocket->OnArenaAsyncEvent(lParam);
			return S_OK;
		}		
		break;	
	case WM_PACKET_ARENA_NOTIFY:
		{			
			OnRecvFieldSocketMessage(wParam, uMsg);
			return S_OK;
		}
		break;
		// end 2007-11-22 by bhsohn 아레나 통합서버
	case WM_IM_ASYNC:
		{
			m_pIMSocket->OnAsyncEvent(lParam);
			return S_OK;
		}
		break;
	case WM_IM_NOTIFY:
		{
			// 2007-11-22 by bhsohn 아레나 통합서버
			//OnRecvIMSocketMessage(wParam);
			OnRecvIMSocketMessage(wParam, uMsg);
			return S_OK;
		}		
		break;
	// 2007-11-22 by bhsohn 아레나 통합서버
	case WM_IM_ARENA_ASYNC:
		{
			m_pIMSocket->OnArenaAsyncEvent(lParam);
			return S_OK;
		}		
		break;
	case WM_IM_ARENA_NOTIFY:
		{
			OnRecvIMSocketMessage(wParam, uMsg);
			return S_OK;
		}		
		break;
	// end 2007-11-22 by bhsohn 아레나 통합서버
	
	case WM_COPYDATA:
		{
			OnRecvCopyData( wParam, (COPYDATASTRUCT*)lParam );
		}
		break;
	case WM_TIMER:
		{
			if( wParam == _TIMER_ALIVE)
			{
				// 2007-11-22 by bhsohn 아레나 통합서버
				//char buffer[SIZE_MAX_PACKET];
				int nType = T_FC_CONNECT_ALIVE;
				if( m_pFieldWinSocket && 
					m_pFieldWinSocket->IsConnected())
				{
					// 2007-11-22 by bhsohn 아레나 통합서버
//					memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
//					m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER);					
					m_pFieldWinSocket->SendMsg(nType, NULL, NULL);
					// end 2007-11-22 by bhsohn 아레나 통합서버
				}
				if( m_pIMSocket &&
					m_pIMSocket->IsConnected())
				{
					nType = T_IC_CONNECT_ALIVE;
					// 2007-11-22 by bhsohn 아레나 통합서버
//					memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
//					m_pIMSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER);
					m_pIMSocket->SendMsg(nType, NULL, NULL);
					// end 2007-11-22 by bhsohn 아레나 통합서버
				}
#ifndef _DEBUG
				// 2008-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
				//if(IsCompultionGame(TIME_COMPULSION_CAP))
				// 2009-02-02 by bhsohn 게임 종료중에는 강제 체크종료 체크 안함
				if((!m_bClientQuit) && (_WAITING != GetGameState())
#ifdef C_BAZZER_NOT_EXIT// 2013-01-08 by jhjang 개인상점을 연 상태에서 클라이언트 멈춰있을때 강제 종료 막기 추가
					&& !((_SHOP == GetGameState()) && g_pInterface->m_pBazaarShop)
#endif					// end 2013-01-08 by jhjang 개인상점을 연 상태에서 클라이언트 멈춰있을때 강제 종료 막기 추가
					&& IsCompultionGame(TIME_COMPULSION_CAP))					
				{
					// 게임을 강제적으로 접속 종료 시킬 상황이다.
					NetworkErrorMsgBox(STRMSG_C_080111_0201);
					
				}
				// end 2007-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
#endif
			}
			
		break;
		}
	// 2008-01-11 by bhsohn 포커스 없을시, 키보드 처리 안되게 함
	case WM_KILLFOCUS:
		{
			if(m_pKeyBoard)
			{				
				m_pKeyBoard->SetKeyBoardFocus(FALSE);			
			}
			// 2008-11-06 by bhsohn 마우스 가두기 모드 보완			
			{
				SetClipCursor(FALSE);
			}
		}
		break;
	case WM_SETFOCUS:
		{
			if(m_pKeyBoard)
			{				
				m_pKeyBoard->SetKeyBoardFocus(TRUE);			
			}
			// 2008-11-06 by bhsohn 마우스 가두기 모드 보완			
			{
				RefreshMouseMode();
			}		
			// 2008-11-13 by bhsohn 조이스틱 작업
			CJoyStickFreedback *pJoyStickFreedback = GetJoyStickFeedback();
			if((IsUseJoyStick()) && pJoyStickFreedback)
			{
				// 진동이 꺼져있으면 안들어온다.
				if(pJoyStickFreedback->IsEffectStarted())
				{
					pJoyStickFreedback->DeviceAcquire();
				}
				else
				{
					pJoyStickFreedback->RqEffectStarted(TRUE);
				}
			}
			

			// end 2008-11-13 by bhsohn 조이스틱 작업
		}
		break;
	// end 2008-01-11 by bhsohn 포커스 없을시, 키보드 처리 안되게 함
	//case WM_IME_STARTCOMPOSITION:
		// 2008-12-15 by bhsohn 비스타에서 IME시스템 동작 안되는 문제 해결
	case WM_IME_STARTCOMPOSITION:
		{			
			g_input.SetImeRtnValue(TRUE);			
			if(m_bChatMode == FALSE && m_dwGameState != _CREATE)
				return 0L;
		}
		break;
	case WM_IME_SETCONTEXT:
		{
			lParam = 0;
			return DefWindowProc( hWnd, uMsg, wParam, lParam );
		}
		break;
		// end 2008-12-15 by bhsohn 비스타에서 IME시스템 동작 안되는 문제 해결
	case WM_IME_NOTIFY:
	case WM_IME_COMPOSITION:
	case WM_INPUTLANGCHANGE:	
	case WM_IME_ENDCOMPOSITION:
	//case WM_IME_SETCONTEXT:
		{
			if(m_bChatMode == FALSE && m_dwGameState != _CREATE)
				return 0L;
		}
		break;

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	case WM_ADDMSGBOX:
		{
			g_pGameMain->m_pInfWindow->AddMsgBox( reinterpret_cast<char*>(lParam), wParam );
		}
		break;

		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	}

	switch(m_dwGameState)
	{
	case _LOGO:
		{
		}
		break;
	case _INIT:
		{
		}
		break;
	case _SELECT:
		{
		}
		break;
	case _CREATE:
		{
			if( MsgProcCreate( uMsg, wParam, lParam ) == INF_MSGPROC_BREAK)
			{
				return S_OK;
			}
		}
		break;
	case _OPTION:
		{
		}
		break;
	case _MAPLOAD:
		{
		}
		break;
	case _GAME:
	case _SHOP:
		{
			if( MsgProcGame( uMsg, wParam, lParam ) == INF_MSGPROC_BREAK)
			{
				return S_OK;
			}
		}
		break;
//	case _SHOP:
//		{
//			if( MsgProcShop( uMsg, wParam, lParam ) == INF_MSGPROC_BREAK)
//			{
//				return S_OK;
//			}
//		}
//		break;
	case _CITY:
		{
			if(MsgProcCity( uMsg, wParam, lParam ) == INF_MSGPROC_BREAK)
			{
				return S_OK;
			}
		}
		break;
	case _SCRIPT:
		{
		}
		break;
	case _WAITING:
		{
		}
		break;
	case _GAMEOVER:
		{
		}
		break;
	case _COMPLETE:
		{
		}
		break;
	case _PROLOGUE:
		{
		}
		break;
	case _ENDGAME:
		{
		}
		break;
	case _ENDCLIENT:
		{
		}
		break;
	}
	// Framework의 기본 메세지 처리를 함
	return CD3DApplication::MsgProc( hWnd, uMsg, wParam, lParam );
}

HRESULT CAtumApplication::ConfirmDevice( D3DCAPS9* pCaps, DWORD dwBehavior,
                                          D3DFORMAT Format )
{
    // This sample wants mixed ver0tex processing rather than hardware
    // vertex processing so it can fallback to sw processing if the
    // device supports fewer than three matrices when skinning.
    if( dwBehavior & D3DCREATE_HARDWARE_VERTEXPROCESSING || dwBehavior & D3DCREATE_MIXED_VERTEXPROCESSING)
        return E_FAIL;

	return S_OK;
}

VOID CAtumApplication::CheckError(DWORD err)
{
	FLOG("CAtumApplication::CheckError(DWORD err)");
	char buf[256];
	switch(err)
	{
	case APP_ERR_MAPLOAD:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0003);//"Map 파일을 로딩(일반) 하는데 실패 하였습니다. 프로그램을 종료합니다!"
		}
		break;
	case CLIENT_ERR_MESHLOAD:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0004);//"Mesh 파일을 로딩(일반) 하는데 실패 하였습니다. 리소스를 확인해 주십시오!"
		}
		break;
	case CLIENT_ERR_TEXINIT:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0005);//"Texture 파일을 초기화 하는데 실패 하였습니다. 리소스를 확인해 주십시오!"
		}
		break;
	case CLIENT_ERR_SHUTTLE_MESHLORD:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0006);//"셔틀의 Mesh 파일을 로딩하는데 실패 하였습니다. 리소스를 확인해 주십시오!"
		}
		break;
	case CLIENT_ERR_SHUTTLE_EFFECTINIT:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0007);//"셔틀의 Effect 파일을 초기화 하는데 실패 하였습니다. 리소스를 확인해 주십시오!"
		}
		break;
	case CLIENT_ERR_SHUTTLE_EFFECTRESTORE:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0008);//"셔틀의 Effect 파일을 Restore 하는중 오류가 발생하였습니다. 프로그램을 종료합니다."
		}
		break;
	case CLIENT_ERR_WEAPON_TEXINIT:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0009);//"Weapon Texture 파일을 초기화 하는데 실패 하였습니다. 리소스를 확인해 주십시오!"
		}
		break;
	case CLIENT_ERR_WEAPON_VBRESTORE:
		{
			wsprintf(buf,STRERR_C_RESOURCE_0010);//"Weapon VertexBuffer를 Restore 하는중 오류가 발생하였습니다. 프로그램을 종료합니다."
		}
		break;
	}
	NetworkErrorMsgBox(buf);
}

void CAtumApplication::LoadPath( char* strPath, UINT nType, char * strFileName )
{
	FLOG("CAtumApplication::LoadPath( char* strPath, UINT nType, char * strFileName )");
	char buf[256];
	if(LoadString(m_hInstance, nType, buf, sizeof(buf)) == 0)
		strPath[0] = NULL;
	else
		wsprintf(strPath, "%s%s", buf, strFileName );
}

FLOAT CAtumApplication::Distance3DTo2D(D3DXVECTOR3 vPos1
									   , D3DXVECTOR3 vPos2)
{
	FLOG("CAtumApplication::Distance3DTo2D(D3DXVECTOR3 vPos1, D3DXVECTOR3 vPos2)");
	D3DXVECTOR2 v1, v2;
	v1.x = vPos1.x;
	v1.y = vPos1.z;
	v2.x = vPos2.x;
	v2.y = vPos2.z;
	return D3DXVec2Length(&(v1-v2));
}

VOID CAtumApplication::ChangeEffectTexture(CAtumNode * pNode,char * str)
{
	FLOG("CAtumApplication::ChangeEffectTexture(CAtumNode * pNode,char * str)");
	CAppEffectData * pEff = (CAppEffectData *)pNode;
	if(pEff->m_pCharacterInfo)
	{
		map<BodyCond_t,CBodyConditionInfo*>::iterator it = pEff->m_pCharacterInfo->m_mapBodyCondition.find(pEff->m_bodyCondition);
		if(it != pEff->m_pCharacterInfo->m_mapBodyCondition.end())
		{
			CBodyConditionInfo* pBody = it->second;
			vector<CEffectInfo*>::iterator itEffect = pBody->m_vecEffect.begin();
			while(itEffect != pBody->m_vecEffect.end())
			{
				CEffectInfo* pEffect = *itEffect;
				pEffect->SetTexture(str);
				itEffect++;
			}
		}
	}
}

int CAtumApplication::GetScreenShotNumber()
{
	FLOG("CAtumApplication::GetScreenShotNumber()");
	WIN32_FIND_DATA FindFileData;
	HANDLE hFind;

	static int nNumber = 1;
	while(TRUE)
	{
		char buf[64];
//		wsprintf(buf, "ATM%05d.jpg", nNumber);
		// 2009-02-03 by bhsohn 스크린샷 폴더 생성
		//wsprintf(buf, "ATM%05d.bmp", nNumber);
		wsprintf(buf, "%sATM%05d.bmp", SCREENSHOT_FILE_PATH, nNumber);
		// end 2009-02-03 by bhsohn 스크린샷 폴더 생성
		DBGOUT("CAtumApplication::GetScreenShotNumber(),Target file is %s.\n", buf);
		hFind = FindFirstFile(buf, &FindFileData);

		if (hFind == INVALID_HANDLE_VALUE) 
		{
			DBGOUT ("CAtumApplication::GetScreenShotNumber(),file number founded %d\n", nNumber);
			return nNumber;
		} 
		else 
		{
			DBGOUT ("CAtumApplication::GetScreenShotNumber(),file [%s] exists.\n", FindFileData.cFileName);
			FindClose(hFind);
		}
		nNumber++;
		if(nNumber > 99999)
			break;
	}
	return -1;
}

void CAtumApplication::TakeScreenShot(IDirect3DDevice9* device
									  , char* file_name
									  , int screenx
									  , int screeny)
{
	FLOG("CAtumApplication::TakeScreenShot");
	IDirect3DSurface9* frontbuf; //this is our pointer to the memory location containing our copy of the
								//front buffer

	//now we create the image that our screen shot will be copied into
	//NOTE: Surface format of the front buffer is D3DFMT_A8R8G8B8 when it is returned
	// 2005-01-04 by jschoi
//	device->CreateImageSurface(screenx, screeny, D3DFMT_A8R8G8B8, &frontbuf);
	// 2015-03-12 by jwLee 스크린샷시 메모리릭 수정
	//device->CreateOffscreenPlainSurface(screenx, screeny, D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT , &frontbuf,NULL);
	// end 2015-03-12 by jwLee 스크린샷시 메모리릭 수정

	//now we copy the front buffer into our surface
	//HRESULT hr = device->GetFrontBuffer(frontbuf);
	// 2005-01-04 by jschoi
//	HRESULT hr = device->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&frontbuf);
	HRESULT hr = device->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&frontbuf);

	//error checking
	if(hr != D3D_OK)
	{
		//do error handling etc...
		frontbuf->Release(); //release the surface so there is no memory leak
		return;
	}

	// 2009-02-03 by bhsohn 스크린샷 폴더 생성	
	CreateDirectory(SCREENSHOT_FILE_PATH, NULL);	

	char szScreenShotPath[MAX_PATH];
	ZERO_MEMORY(szScreenShotPath);
	wsprintf(szScreenShotPath, "%s%s", SCREENSHOT_FILE_PATH, file_name);	
	// end 2009-02-03 by bhsohn 스크린샷 폴더 생성

	//now write our screen shot to a bitmap file
	//the last 2 params are NULL because we want the entire front buffer and no palette
	// 2009-02-03 by bhsohn 스크린샷 폴더 생성
	//D3DXSaveSurfaceToFile(file_name, D3DXIFF_BMP, frontbuf, NULL, NULL);
	D3DXSaveSurfaceToFile(szScreenShotPath, D3DXIFF_BMP, frontbuf, NULL, NULL);
	// end 2009-02-03 by bhsohn 스크린샷 폴더 생성

	char buf[256];
	wsprintf(buf, STRMSG_C_ETC_0005, file_name);//"%s 파일에 스크린샷이 저장 되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
	//release the surface so there is no memory leak
	frontbuf->Release();

// by cmkwon
	//HANDLE fhandle = CreateFile(file_name,GENERIC_WRITE,0,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	// 2009-02-03 by bhsohn 스크린샷 폴더 생성
	//HANDLE fhandle = CreateFile(file_name,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	HANDLE fhandle = CreateFile(szScreenShotPath,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	// end 2009-02-03 by bhsohn 스크린샷 폴더 생성

	// 2007-06-04 by bhsohn 현재 저장된 시간 스크린 샷
	ATUM_DATE_TIME time = GetServerDateTime();
	if(fhandle != INVALID_HANDLE_VALUE)
	{
		DrawBMPText(time, &fhandle);
	}

	if(fhandle == INVALID_HANDLE_VALUE)
	{
//		DBGOUT ("현재 스크롤된 버퍼의 시작점 %d, 현재 버퍼의 시작점 %d\n", g_pGameMain->m_pChat->m_nCurrentBufferIndex[CHAT_TAB_NUMBER], 
//			g_pGameMain->m_pChat->m_nStartBufferIndex[CHAT_TAB_NUMBER]);
	}
	else if(g_pGameMain && g_pGameMain->m_pChat)
	{
		DWORD dwWritten;
		SetFilePointer(fhandle, 0, 0, FILE_END);
		CINFGameMainChat * pTmChat = g_pGameMain->m_pChat;
				
//		int  index = pTmChat->m_nStartBufferIndex[pTmChat->m_nCurrentTab]-pTmChat->m_nCurrentBufferIndex[pTmChat->m_nCurrentTab]-1;
		int  index = pTmChat->m_ArrChatTab.m_nStoreStartIndex - 
			         pTmChat->m_ArrChatTab.m_nRenderStartIndex-1;
		int  i=0, j=0;
		char strSecuryBuffer[SIZE_MAX_CHAT_MESSAGE]; // 암호화 코드
		
//		strncpy(strSecuryBuffer, ATUM_SECURITY_60_BYTE, SIZE_MAX_CHAT_MESSAGE);	

		char bufTime[128], bufDate[128];
		_strtime( bufTime );
		_strdate( bufDate );
		wsprintf(strSecuryBuffer, "%s %s %s", STRMSG_WINDOW_TEXT, bufDate, bufTime );

		char *szXORString = XOR_ENCODE_SCREENSHOT_60BYTE;
		for(j = 0; j < SIZE_MAX_CHAT_MESSAGE; j++)
		{
			strSecuryBuffer[j] = strSecuryBuffer[j] ^ szXORString[j];					
		}
		WriteFile(fhandle, strSecuryBuffer, SIZE_MAX_CHAT_MESSAGE, &dwWritten, NULL);

		while(pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString != NULL)
		{
//			if(index<0) index = CHAT_BUFFER_NUMBER + index;	
			if(index<0)	break;	
			
			if(CHAT_MENUBOX_START_Y - pTmChat->m_nChatBoxHeight + 2 > CHAT_FONT_START_Y-CHAT_FONT_LINE_HEIGHT*i)
				break;

//			strncpy(strSecuryBuffer, pTmChat->m_ArrChatTab.m_ArrChatLine[index].szChatString, 
//				SIZE_MAX_CHAT_MESSAGE);
			// 2006-04-26 by isparkm, 수정
			int nMax = strlen(pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString);
			if(SIZE_MAX_CHAT_MESSAGE < strlen(pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString))
			{
				nMax = SIZE_MAX_CHAT_MESSAGE;
			}
//			strncpy(strSecuryBuffer, pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString, 
//				strlen(pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString));
			memset(strSecuryBuffer, 0x00, SIZE_MAX_CHAT_MESSAGE);
			strncpy(strSecuryBuffer, pTmChat->m_ArrChatTab.m_ArrChatLine[index].pszChatString, 
				nMax);
			
			szXORString = XOR_ENCODE_SCREENSHOT_60BYTE;
			for(j = 0; j < SIZE_MAX_CHAT_MESSAGE; j++)
			{
				strSecuryBuffer[j] = strSecuryBuffer[j] ^ szXORString[j];					
			}
			WriteFile(fhandle, strSecuryBuffer, SIZE_MAX_CHAT_MESSAGE, &dwWritten, NULL);

			i++;
			index = pTmChat->m_ArrChatTab.m_nRenderStartIndex
				- pTmChat->m_ArrChatTab.m_nStoreEndIndex-i-1;
		}

		CloseHandle(fhandle);
		fhandle = NULL;
	}
/*
	char buf[256];
	char buf2[256];
	memset(buf,0x00,256);
	memset(buf2,0x00,256);
	strncpy(buf,file_name,8);
	wsprintf(buf2,"%s.jpg",buf);
	BMP_To_JPG(file_name, buf2);
	DeleteFile(file_name);
*/
}


HRESULT CAtumApplication::DrawBMPText(ATUM_DATE_TIME time, HANDLE *pfFilehandle)
{	
	SetFilePointer((*pfFilehandle), 0, 0, FILE_BEGIN);		
	DWORD dwRead;
	DWORD FileSize=GetFileSize((*pfFilehandle),NULL);

	// 파일 에서 로드
	BITMAPFILEHEADER *fh =(BITMAPFILEHEADER *)malloc(FileSize);	
	BITMAPINFOHEADER *ih;
	LPBITMAPINFOHEADER lpbi = NULL;
	{
		
		FileSize=GetFileSize((*pfFilehandle),NULL);					
		ReadFile((*pfFilehandle), fh, FileSize,&dwRead,NULL);
		ih=(BITMAPINFOHEADER *)((PBYTE)fh+sizeof(BITMAPFILEHEADER));
		lpbi = ih;
		
	}

	BITMAPINFO bmi;
	ZeroMemory( &bmi.bmiHeader,  sizeof(BITMAPINFOHEADER) );
	bmi.bmiHeader.biSize        = sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth       = lpbi->biWidth;
	bmi.bmiHeader.biHeight      = lpbi->biHeight;
	bmi.bmiHeader.biPlanes      = lpbi->biPlanes;
	bmi.bmiHeader.biCompression = lpbi->biCompression;
	bmi.bmiHeader.biBitCount    = lpbi->biBitCount;


	// Prepare to create a bitmap
	HDC hdc = CreateCompatibleDC(NULL);
	DWORD*      pBitmapBits;
	
	// Create a DC and a bitmap for the font
	HBITMAP hbmBitmap = CreateDIBSection( hdc, &bmi, DIB_RGB_COLORS,
		(VOID**)&pBitmapBits, NULL, 0 );
	if(!hbmBitmap || !pBitmapBits)
	{	
		free(fh);
		return E_FAIL;
	}
	SetMapMode( hdc, MM_TEXT);	
	
	// Create a font.  By specifying ANTIALIASED_QUALITY, we might get an
	// antialiased font, but this is not guaranteed.
	INT nHeight    = 15;
	DWORD dwBold   = FW_BOLD;
	DWORD dwItalic = FALSE;

	// 글씨의 싸이즈 측정.
	char strText[256];
	memset(strText, 0x00, 256);
	
	wsprintf(strText, "%04d/%02d/%02d %02d:%02d", 
						time.Year, 
						time.Month,
						time.Day,
						time.Hour,
						time.Minute);


	DWORD dwCharset = DEFAULT_CHARSET;
#ifdef LANGUAGE_VIETNAM
	dwCharset = VIETNAMESE_CHARSET;
#endif
	
	HFONT hFont    = CreateFont( nHeight, 0, 0, 0, dwBold, dwItalic,
		FALSE, FALSE, dwCharset, OUT_DEFAULT_PRECIS,
		CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		FIXED_PITCH , GetFontStyle() );
	if( NULL==hFont )
	{
		free(fh);
		return E_FAIL;
	}
	
	HGDIOBJ hOldBitmap = SelectObject( hdc, hbmBitmap );
	HGDIOBJ hOldFont = SelectObject( hdc, hFont );
	
	int nPosX, nPosY;
	nPosX = nPosY = 0;		

	// 버퍼에 있는 값을 DC에 쓴다. 
	StretchDIBits(hdc,
			0, 0,
			lpbi->biWidth, lpbi->biHeight,
			0, 0,
			lpbi->biWidth,
			lpbi->biHeight,
			//m_pOutBuff, 
			(LPBYTE)lpbi +(lpbi->biSize),
			(LPBITMAPINFO)lpbi,
			DIB_RGB_COLORS,
			SRCCOPY);

	SIZE size;
	int  iStringLength = lstrlen(strText);	
	GetTextExtentPoint32( hdc, strText, iStringLength, &size );

	SetBkColor(   hdc, 0xff000000 );	
	SetBkMode(hdc, TRANSPARENT);
	SetTextAlign( hdc, TA_TOP|TA_LEFT );
	SetTextColor( hdc, GUI_FONT_COLOR_Y);

	nPosX = (lpbi->biWidth - size.cx) - 10;
	nPosY = 10;

	ExtTextOut( hdc, 
				nPosX, 
				nPosY, 
				ETO_CLIPPED, 
				NULL, 
				strText, 
				strlen(strText), NULL );
	
	int xCharSize = size.cx / iStringLength;
	
	size.cx+=10;
	size.cy+=10;		
	

	// 파일 저장
	{				
		GetDIBits(hdc, 
			hbmBitmap, 
			0, 
			(DWORD)lpbi->biHeight,
			(LPBYTE)lpbi +(lpbi->biSize), 
			(LPBITMAPINFO)lpbi, 
			(DWORD)DIB_RGB_COLORS);		
		
		SetFilePointer((*pfFilehandle), 0, 0, FILE_BEGIN);
		
		DWORD len;
		if(!WriteFile((*pfFilehandle),fh,FileSize,&len,NULL))
		{		
			free(fh);
			return E_FAIL;
		}			
	}
	free(fh);

	SelectObject( hdc, hOldBitmap );
	SelectObject( hdc, hOldFont );
	DeleteObject( hbmBitmap );
	DeleteObject( hFont );

	DeleteDC(hdc);	

	return D3D_OK;
}

void CAtumApplication::DeleteEffectList()
{
	FLOG("CAtumApplication::DeleteEffectList()");
	DBGOUT("CAtumApplication::DeleteEffectList\n");
	if(m_pEffectList)
	{
		CAtumNode * pEff = m_pEffectList->m_pChild;
		while(pEff)
		{
			pEff->m_bUsing = FALSE;
			pEff = pEff->m_pNext;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::OnRecvFieldSocketMessage( DWORD wParam )
/// \brief		OnRecv FieldSocket Message
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2007-11-22 by bhsohn 아레나 통합서버
//int CAtumApplication::OnRecvFieldSocketMessage( DWORD wParam )
int CAtumApplication::OnRecvFieldSocketMessage( DWORD wParam, UINT nSocketNotifyType)
{
	FLOG("CAtumApplication::OnRecvFieldSocketMessage( DWORD wParam )");
	
	// 2007-11-22 by bhsohn 아레나 통합서버
	CFieldWinSocket* pFieldSocket = GetFieldWinSocket(nSocketNotifyType);
	if(NULL == pFieldSocket)
	{
		// 소켓에러다
		return 0;
	}

	switch(LOWORD(wParam))
	{
	case CFieldWinSocket::WS_ERROR:
		{
			DBGOUT("ERROR : CAtumApplication::MsgProc(), CFieldWinSocket::WS_ERROR wParam(%x)\n",HIWORD(wParam));
		}
		break;
	case CFieldWinSocket::WS_CONNECTED:
		{
			// 2007-11-22 by bhsohn 아레나 통합서버
			//OnRecvFieldSocketWS_CONNECTED( HIWORD(wParam) );
			if(WM_PACKET_ARENA_NOTIFY == nSocketNotifyType)
			{
				EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
			}
			OnRecvFieldSocketWS_CONNECTED( HIWORD(wParam), pFieldSocket);
		}
		break;
	case CFieldWinSocket::WS_CLOSED:
		{
			// 2007-11-22 by bhsohn 아레나 통합서버
			//OnRecvFieldSocketWS_CLOSED();
			if(WM_PACKET_ARENA_NOTIFY == nSocketNotifyType)
			{
				// 아레나 게임중에 소켓이 끊기면 아레나 종료로 판단
				if(FALSE == m_pFieldWinSocket->IsRequestArenaSocketClose() 
					&& (ARENA_STATE_ARENA_GAMING == GetArenaState()))
				{
					// 아레나 서버가 종료 되었다.
					ArenaFinishWarp(FALSE);
				}
				else if(FALSE == m_pFieldWinSocket->IsRequestArenaSocketClose() 
					&& (ARENA_STATE_ARENA_GAMING != GetArenaState())
					&& (TRUE == g_pInterface->IsArenaGameState(ARENA_GAME_STATE_TEAMINFO))
					&& g_pInterface && g_pInterface->m_pGameArena)
				{
					// 아레나 대기중 아레나 서버가 내려가면 아레나 대기를 취소시킨다.
					g_pInterface->m_pGameArena->ReaveArena();
				}
			}
			else
			{
				OnRecvFieldSocketWS_CLOSED();
			}
			
		}
		break;
	case CFieldWinSocket::WS_RECEIVED:
		{
            // 2010. 10. 05 by jskim 맵로딩 구조 변경
			// 2009. 09. 10 by ckPark 맵로딩중 패킷오면 큐에 쌓아두도록 변경
			// 2010. 10. 05 by jskim 맵로딩 구조 변경  
			//if( m_pMapInitThread && m_pMapInitThread->m_bRunning )
            // end 2010. 10. 05 by jskim 맵로딩 구조 변경
			//{
			//	pFieldSocket->m_bSendNotify = FALSE;
			//	return 0;
			//}
			// end 2009. 09. 10 by ckPark 맵로딩중 패킷오면 큐에 쌓아두도록 변경
			// end 2010. 10. 05 by jskim 맵로딩 구조 변경
			
			
			char * pPacket = NULL;
			int len,nType;
			// 2007-11-22 by bhsohn 아레나 통합서버
			//m_pFieldWinSocket->Read(&pPacket, len);
			pFieldSocket->Read(&pPacket, len);
			
//			if(pPacket)
#ifdef _DEBUG
			int nCharacterMoveCount = 0;
#endif // _DEBUG_endif
			// 2007-11-22 by bhsohn 아레나 통합서버
			//while(pPacket && m_pFieldWinSocket && m_pFieldWinSocket->IsConnected())// 2004-04-20 by dhkwon
			while(pPacket && pFieldSocket && pFieldSocket->IsConnected())// 2004-04-20 by dhkwon
			{
				nType = *(MessageType_t*)pPacket;
#ifdef _DEBUG
				PrintExchangeMsg(RECV_TYPE, nType, NULL, ST_FIELD_SERVER);
//				PrintExchangeMsg(RECV_TYPE, nType, NULL, ST_INVALID_TYPE, PRINTLEVEL_WO_MOVE_BATTLE);//,ST_FIELD_SERVER);
//				PrintExchangeMsg(RECV_TYPE, nType, NULL, ST_FIELD_SERVER, PRINTLEVEL_ALL);
#endif
				// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
				// 다중 락 체크 
				CheckMultiLock(TRUE, nType);

				g_cCustomOptimizer.ViewDebugString(nType, CCustomOptimizer::E_FL_SERVER_TO_CLIENT);

				switch((nType))
				{
				case T_FC_CONNECT_LOGIN_OK:
					{
						FieldSocketConnectLoginOk((MSG_FC_CONNECT_LOGIN_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_CHARACTER_OK:
					{
						FieldSocketCharacterGetCharacterOk((MSG_FC_CHARACTER_GET_CHARACTER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CREATE_OK:
					{
						FieldSocketCharacterCreateOk((MSG_FC_CHARACTER_CREATE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_DELETE_OK:
					{
						FieldSocketCharacterDeleteOk();
					}
					break;
				case T_FC_CHARACTER_REPAIR_OK:
					{
					}
					break;
				case T_FC_CHARACTER_REPAIR_ERR:
					{
					}
					break;
				case T_FC_CHARACTER_DOCKING_ERR:
					{
					}
					break;
				case T_FC_CHARACTER_GET_OTHER_INFO_OK:
					{
						FieldSocketCharacterGetOtherInfoOk((MSG_FC_CHARACTER_GET_OTHER_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_MONSTER_INFO_OK:
					{
						FieldSocketCharacterGetMonsterInfoOk((MSG_FC_CHARACTER_GET_MONSTER_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GAMESTART_OK:
					{
						FieldSocketCharacterGameStartOk((MSG_FC_CHARACTER_GAMESTART_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CONNECT_GAMESTART_OK:
					{
						FieldSocketCharacterConnectGameStartOk((MSG_FC_CHARACTER_CONNECT_GAMESTART_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GAMEEND_OK	:
					{
						// 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
						//FieldSocketCharacterGameEndOk((MSG_FC_CHARACTER_GAMEEND_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
						FieldSocketCharacterGameEndOk(nSocketNotifyType, (MSG_FC_CHARACTER_GAMEEND_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_OK:
					{
						FieldSocketMoveOk((MSG_FC_MOVE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
#ifdef _DEBUG
						nCharacterMoveCount++;
#endif
					}
					break;
				case T_FC_MONSTER_MOVE_OK:
					{
						FieldSocketMonsterMoveOk((MSG_FC_MONSTER_MOVE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
/*				case T_FC_BATTLE_ATTACK_RESULT_PRIMARY:
					{
						FieldSocketBattleAttackResultPrimary((MSG_FC_BATTLE_ATTACK_RESULT_PRIMARY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_RESULT_SECONDARY:
					{
						FieldSocketBattleAttackResultSecondary((MSG_FC_BATTLE_ATTACK_RESULT_SECONDARY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_FIND_RESULT:
					{
						FieldSocketBattleAttackFindResult((MSG_FC_BATTLE_ATTACK_FIND_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_CHARACTER_CHANGE_HPDPSPEP:
					{
						FieldSocketCharacterChangeHPDPSPEP((MSG_FC_CHARACTER_CHANGE_HPDPSPEP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP:
					{
						FieldSocketCharacterChangeCurrentHPDPSPEP((MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CURRENTHP:
					{
						FieldSocketCharacterChangeCurrentHP((MSG_FC_CHARACTER_CHANGE_CURRENTHP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CURRENTDP:
					{
						FieldSocketCharacterChangeCurrentDP((MSG_FC_CHARACTER_CHANGE_CURRENTDP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CURRENTSP:
					{
						FieldSocketCharacterChangeCurrentSP((MSG_FC_CHARACTER_CHANGE_CURRENTSP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CURRENTEP:
					{
						FieldSocketCharacterChangeCurrentEP((MSG_FC_CHARACTER_CHANGE_CURRENTEP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_BODYCONDITION:
					{
						FieldSocketCharacterChangeBodycondition((MSG_FC_CHARACTER_CHANGE_BODYCONDITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_UNITKIND:
					{
						FieldSocketCharacterChangeUnitkind((MSG_FC_CHARACTER_CHANGE_UNITKIND*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼
				case T_FC_CHARACTER_KILLCOUNT:
					{
						FieldSocketCharacterKillCount((MSG_FC_CHARACTER_KILLCOUNT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_RESTCOUNT:
					{
						FieldSocketCharacterRestCount((MSG_FC_CHARACTER_RESTCOUNT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_BONUS_EXP_RATE:
					{
						FieldSocketCharacterBonusExpRate((MSG_FC_CHARACTER_BONUS_EXP_RATE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼
				case T_FC_PARTY_CREATE_OK:
					{
						FieldSocketPartyCreateOk((MSG_FC_PARTY_CREATE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_REQUEST_INVITE_QUESTION:
					{
						FieldSocketPartyRequestInviteQuestion((MSG_FC_PARTY_REQUEST_INVITE_QUESTION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_REQUEST_INVITE_QUESTION_THE_ARENA:		/// 2012-04-12 by jhseol, 아레나 추가개발 - 자동파티 : 파티 가입 준비
					{
						FieldSocketPartyRequestInviteQuestion_THE_ARENA((MSG_FC_PARTY_REQUEST_INVITE_QUESTION_THE_ARENA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_AUTO_CREATED_THE_ARENA:		/// 2012-04-12 by jhseol, 아레나 추가개발 - 자동파티 : 자동으로 파티를 만들라는 패킷.
					{
						FieldSocketPartyAutoCreated_THE_ARENA((MSG_FC_PARTY_AUTO_CREATED_THE_ARENA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_REJECT_INVITE_OK:
					{
						FieldSocketPartyRejectInviteOk((MSG_FC_PARTY_REJECT_INVITE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_PUT_MEMBER:
					{
						FieldSocketPartyPutMember((MSG_FC_PARTY_PUT_MEMBER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_ALL:
					{
						FieldSocketPartyUpdateMemberInfoAll((MSG_FC_PARTY_UPDATE_MEMBER_INFO_ALL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_LEVEL:
					{
						FieldSocketPartyUpdateMemberInfoLevel((MSG_FC_PARTY_UPDATE_MEMBER_INFO_LEVEL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_HP:
					{
						FieldSocketPartyUpdateMemberInfoHP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_HP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_HP:
					{
						FieldSocketPartyUpdateMemberInfoCurrentHP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_HP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_DP:
					{
						FieldSocketPartyUpdateMemberInfoDP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_DP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_DP:
					{
						FieldSocketPartyUpdateMemberInfoCurrentDP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_DP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_SP:
					{
						FieldSocketPartyUpdateMemberInfoSP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_SP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_SP:
					{
						FieldSocketPartyUpdateMemberInfoCurrentSP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_SP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_EP:
					{
						FieldSocketPartyUpdateMemberInfoEP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_EP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_EP:
					{
						FieldSocketPartyUpdateMemberInfoCurrentEP((MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_EP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_UPDATE_MEMBER_INFO_BODYCONDITION:
					{
						FieldSocketPartyUpdateMemberInfoBodyCondition((MSG_FC_PARTY_UPDATE_MEMBER_INFO_BODYCONDITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_CHECK_WARP_STATE_OK:
					{
						FieldSocketCityCheckWarpStateOk((MSG_FC_CITY_CHECK_WARP_STATE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_WARP:
					{
						FieldSocketEventWarpOtherFieldServer((MSG_FC_EVENT_WARP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_WARP_SAME_MAP:
					{
						FieldSocketEventWarpSameMap((MSG_FC_EVENT_WARP_SAME_MAP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_WARP_SAME_FIELD_SERVER:
					{
						FieldSocketEventWarpSameFieldServer((MSG_FC_EVENT_WARP_SAME_FIELD_SERVER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_OTHER_WARPED:
					{
						FieldSocketEventOtherWarped((MSG_FC_EVENT_OTHER_WARPED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_WARP_CONNECT_OK:
					{
						FieldSocketEventWarpConnectOk((MSG_FC_EVENT_WARP_CONNECT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_PUT_ITEM_HEADER:
					{
						FieldSocketStorePutItemHeader((MSG_FC_STORE_PUT_ITEM_HEADER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_PUT_ITEM:
					{
						FieldSocketStorePutItem((MSG_FC_STORE_PUT_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_PUT_ITEM_DONE:
					{
						FieldSocketStorePutItemDone((MSG_FC_STORE_PUT_ITEM_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_LEVEL:
					{
						FieldSocketCharacterChangeLevel((MSG_FC_CHARACTER_CHANGE_LEVEL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_EXP:
					{
						FieldSocketCharacterChangeExp((MSG_FC_CHARACTER_CHANGE_EXP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_STAT:
					{
						FieldSocketCharacterChangeStat((MSG_FC_CHARACTER_CHANGE_STAT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_TOTALGEAR_STAT:
					{
						FieldSocketCharacterChangeTotalGearStat((MSG_FC_CHARACTER_CHANGE_TOTALGEAR_STAT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_STATUS:
					{
						FieldSocketCharacterChangeStatus((MSG_FC_CHARACTER_CHANGE_STATUS*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_PROPENSITY:
					{
						FieldSocketCharacterChangePropensity((MSG_FC_CHARACTER_CHANGE_PROPENSITY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_CHANGE_WINDOW_POSITION_OK:
					{
						FieldSocketItemChangeWindowPositionOk((MSG_FC_ITEM_CHANGE_WINDOW_POSITION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_LANDING_OK:
					{
						FieldSocketMoveLandingOk((MSG_FC_MOVE_LANDING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_TAKEOFF_OK:
					{
						FieldSocketMoveTakeOffOk((MSG_FC_MOVE_TAKEOFF_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_ROLLING_OK:
					{
						FieldSocketMoveRolling((MSG_FC_MOVE_ROLLING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_SHOW_ITEM:
					{
						FieldSocketItemShowItem((MSG_FC_ITEM_SHOW_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_GET_ITEM_OK:
					{
						FieldSocketItemGetItemOk((MSG_FC_ITEM_GET_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_HIDE_ITEM:
					{
						FieldSocketItemHideItem((MSG_FC_ITEM_HIDE_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_PUT_ITEM_OTHER:
					{
						FieldSocketPartyPutItemOther((MSG_FC_PARTY_PUT_ITEM_OTHER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_GET_ITEM_FAIL:
					{
						FieldSocketItemGetItemFail((MSG_FC_ITEM_GET_ITEM_FAIL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITYWAR_GET_OCCUPYINFO_OK:
					{
						FieldSocketCitywarGetOccupyinfoOk((MSG_FC_CITYWAR_GET_OCCUPYINFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITYWAR_BRING_SUMOFTEX_OK:
					{
						FieldSocketCitywarBringSumoftexOk((MSG_FC_CITYWAR_BRING_SUMOFTEX_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITYWAR_START_WAR:
					{
						FieldSocketCitywarStartWar((MSG_FC_CITYWAR_START_WAR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITYWAR_END_WAR:
					{
						FieldSocketCitywarEndWar((MSG_FC_CITYWAR_END_WAR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_CASH_MONEY_COUNT_OK:
					{
						FieldSocketCharacterGetCashMoneyCountOk((MSG_FC_CHARACTER_GET_CASH_MONEY_COUNT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CHARACTER_MODE_OK:
					{
						FieldSocketCharacterChangeCharacterModeOk((MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
/*				case T_FC_BATTLE_MINE_ATTACK_RESULT:
					{
						FieldSocketBattleMineAttackResult((MSG_FC_BATTLE_MINE_ATTACK_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_MINE_ATTACK_FIND_RESULT:
					{
						FieldSocketBattleMineAttackFindResult((MSG_FC_BATTLE_MINE_ATTACK_FIND_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_MINE_ATTACK_ITEM_FIND_RESULT:
					{
						FieldSocketBattleMineAttackItemFindResult((MSG_FC_BATTLE_MINE_ATTACK_ITEM_FIND_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_MISSILE_MOVE_OK:
					{
						FieldSocketMissileMoveOk((MSG_FC_MISSILE_MOVE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_REQUEST_ENTER_BUILDING_OK:
					{	// 상점으로 들어감
						FieldSocketCityRequestEnterBuildingOk((MSG_FC_CITY_REQUEST_ENTER_BUILDING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_ENTER_BUILDING:
					{	// 상점으로 들어감
						FieldSocketEventEnterBuilding((MSG_FC_EVENT_ENTER_BUILDING*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_LEAVE_BUILDING_OK:
					{	// 상점에서 나옴
						FieldSocketEventLeaveBuildingOk((MSG_FC_EVENT_LEAVE_BUILDING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_PUT_ITEM_HEADER:
					{	//
						FieldSocketShopPutItemHeader((MSG_FC_SHOP_PUT_ITEM_HEADER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_PUT_ITEM:
					{	//
						FieldSocketShopPutItem((MSG_FC_SHOP_PUT_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_PUT_ITEM_DONE:
					{	//
						FieldSocketShopPutItemDone((MSG_FC_SHOP_PUT_ITEM_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_GET_ITEMINFO_OK:
					{	//
						FieldSocketShopGetItemInfoOk((MSG_FC_SHOP_GET_ITEMINFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_BUY_ITEM_OK:
					{	//
						FieldSocketShopBuyItemOk((MSG_FC_SHOP_BUY_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_SELL_ITEM_OK:
					{	//
						FieldSocketShopSellItemOk((MSG_FC_SHOP_SELL_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_GET_USED_ITEM_PRICE_OK:
					{	//
						FieldSocketShopGetUsedItemPriceOk((MSG_FC_SHOP_GET_USED_ITEM_PRICE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));

					}
					break;
				case T_FC_ITEM_THROW_AWAY_ITEM_OK:
					{	//
						FieldSocketItemThrowAwayItemOk((MSG_FC_ITEM_THROW_AWAY_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_ENERGY_OK:
					{
						FieldSocketItemUseEnergyOk((MSG_FC_ITEM_USE_ENERGY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_ITEM_OK:
					{
						FieldSocketItemUseItemOk((MSG_FC_ITEM_USE_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY:
					{
						FieldSocketItemUseCarditemGuildNotify((MSG_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_DELETE_ALL_ENCHANT:
					{
						FieldSocketItemUseCarditemDeleteAllEnchant((MSG_FC_ITEM_DELETE_ALL_ENCHANT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY:
					{
						FieldSocketItemUseCardItemMonstersummonNotify((MSG_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY:
					{
						FieldSocketItemUseCardItemChangecharacternameNotify((MSG_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY:
					{
						FieldSocketItemUseCardItemSkillinitializeNotify((MSG_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY:
					{
						FieldSocketItemUseCardItemChangepilotfaceNotify((MSG_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_REGION:
					{
						FieldSocketChatRegion((MSG_FC_CHAT_REGION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_CASH_ALL:
					{
						FieldSocketChatCashAll((MSG_FC_CHAT_CASH_ALL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_MAP:
					{
						FieldSocketChatMap((MSG_FC_CHAT_MAP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_ARENA:
					{
						FieldSocketChatArena((MSG_FC_CHAT_ARENA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				case T_FC_CHAT_INFINITY:
					{
						FieldSocketChatInfinity( (MSG_FC_CHAT_INFINITY*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

				case T_FC_TRADE_REQUEST_TRADE_OK:
					{
						FieldSocketTradeRequestTradeOk((MSG_FC_TRADE_REQUEST_TRADE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_ACCEPT_TRADE_OK:
					{
						FieldSocketTradeAcceptTradeOk((MSG_FC_TRADE_ACCEPT_TRADE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_REJECT_TRADE_OK:
					{
						FieldSocketTradeRejectTradeOk((MSG_FC_TRADE_REJECT_TRADE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_REJECT_TRADING:
					{
						FieldSocketTradeRejectTrading((MSG_FC_TRADE_REJECT_TRADING*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_SHOW_TRADE_WINDOW:
					{
						FieldSocketTradeShowTradeWindow((MSG_FC_TRADE_SHOW_TRADE_WINDOW*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_OK_TRADE_OK:
					{
						FieldSocketTradeOkTradeOk((MSG_FC_TRADE_OK_TRADE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_CANCEL_TRADE_OK:
					{
						FieldSocketTradeCancelTradeOk((MSG_FC_TRADE_CANCEL_TRADE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_DELETE_ITEM:
				case T_FC_TRADE_DELETE_ITEM:
					{
						FieldSocketTradeDeleteItem((MSG_FC_TRADE_DELETE_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_ITEM_COUNT:
				case T_FC_TRADE_UPDATE_ITEM_COUNT:
					{
						FieldSocketTradeUpdateItemCount((MSG_FC_TRADE_UPDATE_ITEM_COUNT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_INSERT_ITEM:
				case T_FC_TRADE_INSERT_ITEM:
					{
						FieldSocketTradeInsertItem((MSG_FC_TRADE_INSERT_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_ENDURANCE:
					{
						FieldSocketStoreUpdateEndurance((MSG_FC_STORE_UPDATE_ENDURANCE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_POSSESS:
					{
						FieldSocketStoreUpdatePossess((MSG_FC_STORE_UPDATE_POSSESS*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_RARE_FIX:
					{
						FieldSocketStoreUpdateRareFix((MSG_FC_STORE_UPDATE_RARE_FIX*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_TRANS_ITEM_OK:// 상대방 물품 리스트에 넣는다.
					{
						FieldSocketTradeTransItemOk((MSG_FC_TRADE_TRANS_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_SEE_ITEM_OK:
					{
						FieldSocketTradeSeeItemOk((MSG_FC_TRADE_SEE_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 recv
				case T_FC_TRADE_SEE_PET_DATA:
					{
						FieldSocketTradeSeePetData((MSG_TRADE_PET_DATA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_DELETE_CURRENT_PET_DATA:
					{
						FieldSocketTradeDeletePetData((MSG_TRADE_PET_DATA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TRADE_INSERT_CURRENT_PET_DATA:
					{
						FieldSocketTradeInsertPetData((MSG_FC_ITEM_PET_BASEDATA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 recv
//2011-10-06 by jhahn 파트너 성장형 시스템
				case T_FC_ITEM_NOTIFY_WINDOW_POSITION:
					{
						FieldSocketInvenItempHidePetData((MSG_FC_ITEM_NOTIFY_WINDOW_POSITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

				case T_FC_ITEM_USE_PET_SOCKET_ITEM_OK:
					{
						_asm nop
					}
					break;

				case T_FC_ITEM_CANCEL_PET_SOCKET_ITEM_OK:
					{
						_asm nop
					}
					break;
//end 2011-10-06 by jhahn 파트너 성장형 시스템
				case T_FC_SKILL_USE_SKILL_OK:
					{
						FieldSocketSkillUseSkill((MSG_FC_SKILL_USE_SKILL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_INVALIDATE_SKILL:
					{
						FieldSocketInvalidateSkill((MSG_FC_SKILL_INVALIDATE_SKILL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK:
					{
						FieldSocketCharacterGetAccountUniqueNumberOk((MSG_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_REQUEST_PK_OK:
					{
						FieldSocketBattleRequestPkOk((MSG_FC_BATTLE_REQUEST_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_CANCEL_PK:
					{
						FieldSocketBattleCancelPK();
					}
					break;
				case T_FC_MONSTER_CHANGE_HP:
					{
						FieldSocketCharacterChangeMonsterHP((MSG_FC_MONSTER_CHANGE_HP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

/*				case T_FC_BATTLE_DROP_BUNDLE_OK:
					{
						FieldSocketBattleDropBundleOk((MSG_FC_BATTLE_DROP_BUNDLE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_BUNDLE_ATTACK_RESULT:
					{
						FieldSocketBattleBundleAttackResult((MSG_FC_BATTLE_BUNDLE_ATTACK_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_CHARACTER_DELETE_OTHER_INFO:
					{
						FieldSocketCharacterDeleteOtherInfo((MSG_FC_CHARACTER_DELETE_OTHER_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_CREATED:
					{
						FieldSocketCharacterMonsterCreated((MSG_FC_MONSTER_CREATED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_REQUEST_P2P_PK_OK:
					{
						FieldSocketBattleRequestP2PPkOk((MSG_FC_BATTLE_REQUEST_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK:
					{
						FieldSocketBattleAcceptRequestP2PPkOk((MSG_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK:
					{
						FieldSocketBattleRejectRequestP2PPkOk((MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_SURRENDER_P2P_PK_OK:
					{
						FieldSocketBattleSurrenderP2PPkOk((MSG_FC_BATTLE_SURRENDER_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_CHARACTER_MENT:
					{
						FieldSocketCharacterChangeCharacterMent((MSG_FC_CHARACTER_CHANGE_CHARACTER_MENT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
/*					case T_FC_BATTLE_ACCEPT_SURRENDER_P2P_PK_OK:
					{
						MSG_FC_BATTLE_ACCEPT_SURRENDER_P2P_PK_OK *pMsg;
						pMsg = (MSG_FC_BATTLE_ACCEPT_SURRENDER_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER);
						m_pChat->CreateChatChild("결투에서 패배하였습니다.",COLOR_TRADE);
						m_pShuttleChild->m_bPKMode = FALSE;
					}
					break;
*/					case T_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK:
					{
						FieldSocketBattleRejectSurrenderP2PPkOk((MSG_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_END_P2P_PK:
					{
						FieldSocketBattleEndP2PPk((MSG_FC_BATTLE_END_P2P_PK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_PKPOINT:
					{
						FieldSocketCharacterChangePKPoint((MSG_FC_CHARACTER_CHANGE_PKPOINT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_DROP_DUMMY_OK:
					{
						FieldSocketBattleDropDummyOk((MSG_FC_BATTLE_DROP_DUMMY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
/*				case T_FC_BATTLE_ATTACK_ITEM_RESULT_PRIMARY:
					{
						FieldSocketBattleAttackItemResultPrimary((MSG_FC_BATTLE_ATTACK_ITEM_RESULT_PRIMARY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_ITEM_RESULT_SECONDARY:
					{
						FieldSocketBattleAttackItemResultSecondary((MSG_FC_BATTLE_ATTACK_ITEM_RESULT_SECONDARY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_ITEM_FIND_RESULT:
					{
						FieldSocketBattleAttackItemFindResult((MSG_FC_BATTLE_ATTACK_ITEM_FIND_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_BATTLE_ATTACK_HIDE_ITEM:
					{
						FieldSocketBattleAttackHideItem((MSG_FC_BATTLE_ATTACK_HIDE_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_EXPLODE_ITEM:
					{
						FieldSocketBattleAttackExplodeItem((MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
/*				case T_FC_BATTLE_BUNDLE_ATTACK_ITEM_RESULT:
					{
						FieldSocketBattleBundleAttackItemResult((MSG_FC_BATTLE_BUNDLE_ATTACK_ITEM_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_MINE_ATTACK_ITEM_RESULT:
					{
						FieldSocketBattleMineAttackItemResult((MSG_FC_BATTLE_MINE_ATTACK_ITEM_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_MONSTER_HIDE:
					{
						FieldSocketMonsterHide((MSG_FC_MONSTER_HIDE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_SHOW:
					{
						FieldSocketMonsterShow((MSG_FC_MONSTER_SHOW*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_CHANGE_BODYCONDITION:
					{
						FieldSocketMonsterChangeBodycondition((MSG_FC_MONSTER_CHANGE_BODYCONDITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_DROP_FIXER_OK:
					{
						FieldSocketBattleDropFixerOk((MSG_FC_BATTLE_DROP_FIXER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_ITEM_INFO_OK:
					{
						FieldSocketInfoGetItemInfoOk(((MSG_FC_INFO_GET_ITEM_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER))->ItemInfo);
					}
					break;
				case T_FC_INFO_GET_SIMPLE_ITEM_INFO_OK:
					{
						FieldSocketInfoGetSimpleItemInfoOk(((MSG_FC_INFO_GET_SIMPLE_ITEM_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER))->ItemInfo);
					}
					break;
				case T_FC_INFO_GET_ENCHANT_COST_OK:
					{
						FieldSocketInfoGetEnchantCostOk(((MSG_FC_INFO_GET_ENCHANT_COST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER)));
					}
					break;
				case T_FC_INFO_GET_RARE_ITEM_INFO_OK:
					{
						FieldSocketInfoGetRareItemInfoOk(((MSG_FC_INFO_GET_RARE_ITEM_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER))->RareItemInfo);
					}
					break;
				case T_FC_INFO_GET_MONSTER_INFO_OK:
					{
						FieldSocketInfoGetMonsterInfoOk((MSG_FC_INFO_GET_MONSTER_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_MAPOBJECT_INFO_OK:
					{
						FieldSocketInfoGetMapObjectInfoOk(((MSG_FC_INFO_GET_MAPOBJECT_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER))->MapObjectInfo);
					}
					break;
				case T_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND:
					{
						FieldSocketBattleAttackHideItemWKind((MSG_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND:
					{
						FieldSocketBattleAttackExplodeItemWKind((MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CONNECT_SYNC_TIME:
					{
						FieldSocketConnectSyncTime((MSG_FC_CONNECT_SYNC_TIME*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_RELOAD_ITEM_INFO:
					{
						FieldSocketItemReloadItemInfo();
					}
					break;
				case T_FC_ITEM_USE_ENCHANT_OK:
					{
						FieldSocketItemUseEnchantOk((MSG_FC_ITEM_USE_ENCHANT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_PUT_ENCHANT:
					{
						FieldSocketItemPutEnchant((MSG_FC_ITEM_PUT_ENCHANT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_REQUEST_START_RESULT:
					{
						FieldSocketQuestRequestStartResult((MSG_FC_QUEST_REQUEST_START_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_REQUEST_SUCCESS_RESULT:
					{
						FieldSocketQuestRequestSuccessResult((MSG_FC_QUEST_REQUEST_SUCCESS_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_REQUEST_SUCCESS_CHECK_RESULT:
					{
						FieldSocketQuestRequestSuccessCheckResult((MSG_FC_QUEST_REQUEST_SUCCESS_CHECK_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST:
					{
						FieldSocketQuestPutAllQuest((MSG_FC_QUEST_PUT_ALL_QUEST*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_SETUP_SKILL_OK:
					{
						FieldSocketSkillSetupSkillOk((MSG_FC_SKILL_SETUP_SKILL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_REQUEST_REQUEST_OK:
					{
						FieldSocketRequestRequestOk((MSG_FC_REQUEST_REQUEST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_REQUEST_REJECT_REQUEST_OK:
					{
						FieldSocketRequestRejectRequestOk((MSG_FC_REQUEST_REJECT_REQUEST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_REQUEST_CANCEL_REQUEST:
					{
						FieldSocketRequestCancelRequest((MSG_FC_REQUEST_CANCEL_REQUEST*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_REQUEST_ACCEPT_REQUEST_OK:
					{
						FieldSocketRequestAcceptRequestOk((MSG_FC_REQUEST_ACCEPT_REQUEST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_BATTLE_START:	
					{
						FieldSocketPartyBattleStart((MSG_FC_PARTY_BATTLE_START*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_PARTY_BATTLE_END:	
					{
						FieldSocketPartyBattleEnd((MSG_FC_PARTY_BATTLE_END*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT:
					{
						FieldSocketQuestPutAllQuestMonsterCount((MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_UPDATE_MONSTER_COUNT:
					{
						FieldSocketQuestUpdateMonsterCount((MSG_FC_QUEST_UPDATE_MONSTER_COUNT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2004-11-24 by jschoi "T_FC_ITEM_RESET_SKILL_ENCHANT_TO_LOADED_ITEM" 사용안함.
//				case T_FC_ITEM_RESET_SKILL_ENCHANT_TO_LOADED_ITEM:
//					{
//						FieldSocketItemResetSkillEnchantToLoadedItem();
//					}
//					break;
/*				case T_FC_BATTLE_CHANGE_TARGET_OK:
					{// 서버에서 종료
						FieldSocketBattleChangeTargetOk((MSG_FC_BATTLE_CHANGE_TARGET_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
*/				case T_FC_BATTLE_TOGGLE_SHIELD_RESULT:
					{// 서버에서 종료
						FieldSocketBattleToggleShieldResult((MSG_FC_BATTLE_TOGGLE_SHIELD_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_TOGGLE_DECOY_OK:
					{// 서버에서 종료
						FieldSocketBattleToggleDecoyOk((MSG_FC_BATTLE_TOGGLE_DECOY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_PRI_BULLET_RELOADED:	
					{
						FieldSocketBattlePriBulletReloaded((MSG_FC_BATTLE_PRI_BULLET_RELOADED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_SEC_BULLET_RELOADED:	
					{
						FieldSocketBattleSecBulletReloaded((MSG_FC_BATTLE_SEC_BULLET_RELOADED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
//				case T_FC_BATTLE_SHIELD_DAMAGE:	
//					{
//						FieldSocketBattleShieldDamage((MSG_FC_BATTLE_SHIELD_DAMAGE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
//					}
//					break;
				case T_FC_EVENT_CHANGE_WEATHER:
					{// 날씨적용
						FieldSocketEventChangeWeather((MSG_FC_EVENT_CHANGE_WEATHER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_UPDATE_ITEM_POS:
					{// 타캐릭터 아이템 교체정보
						FieldSocketItemUpdateItemPos((MSG_FC_ITEM_UPDATE_ITEM_POS*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK:
					{// 타캐릭터 아이템 교체정보
						FieldSocketCharacterGetOtherRenderInfoOk((MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_BUILDINGNPC_INFO_OK:	
					{
						FieldSocketInfoGetBuildingNPCInfoOk((MSG_FC_INFO_GET_BUILDINGNPC_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_SUGGEST_CHANNELS:
					{
						FieldSocketEventSuggestChannels((MSG_FC_EVENT_SUGGEST_CHANNELS*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_GET_BUILDING_LIST_OK:	
					{
						FieldSocketCityGetBuildingListOk((MSG_FC_CITY_GET_BUILDING_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST_OK:	
					{
						FieldSocketGetShopWarpTargetMapListOk((MSG_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ADMIN_GET_SERVER_STAT_OK:	
					{
						FieldSocketAdminGetServerStatOk((MSG_FC_ADMIN_GET_SERVER_STAT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_SHOW_EFFECT_OK:
					{
						FieldSocketCharacterShowEffectOk((MSG_FC_CHARACTER_SHOW_EFFECT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2007-04-19 by bhsohn 서치아이 아이템 추가
				case T_FC_CHARACTER_SHOW_MAP_EFFECT_OK:
					{
						FieldSocketCharacterMapEffectOk((MSG_FC_CHARACTER_SHOW_MAP_EFFECT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2007-04-19 by bhsohn 서치아이 아이템 추가
				case T_FC_CONNECT_CLOSE:
					{// 서버에서 종료
						FieldSocketConnectClose((MSG_FC_CONNECT_CLOSE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STRING_128:
					{
						FieldSocketString128((MSG_FC_STRING_128*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STRING_256:
					{
						FieldSocketString256((MSG_FC_STRING_256*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STRING_512:
					{
						FieldSocketString512((MSG_FC_STRING_512*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_SKILL_USE_SKILL:
					{
						FieldSocketMonsterSkillUseSkill((MSG_FC_MONSTER_SKILL_USE_SKILL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_SKILL_END_SKILL:
					{
						FieldSocketMonsterSkillEndSkill((MSG_FC_MONSTER_SKILL_END_SKILL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_MIX_ITEMS_RESULT:
					{
						FieldSocketItemMixItemsResult((MSG_FC_ITEM_MIX_ITEMS_RESULT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_GUILD_GET_WAR_INFO_OK:
					{
						FieldSocketGuildGetWarInfoOk((MSG_FC_GUILD_GET_WAR_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_MOVE_ITEM_OK:
					{
						FieldSocketStoreMoveItemOk((MSG_FC_STORE_MOVE_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_GET_OTHER_PARAMFACTOR_OK:
					{
						FieldSocketCharacterGetOtherParamfactorOk((MSG_FC_CHARACTER_GET_OTHER_PARAMFACTOR_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_DISCARD_QUEST_OK:
					{
						FieldSocketQuestDiscardQuestOk((MSG_FC_QUEST_DISCARD_QUEST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_OK:
					{
						FieldSocketBattleAttackOk((MSG_FC_BATTLE_ATTACK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_FIND_OK:
					{
						FieldSocketBattleAttackFindOk((MSG_FC_BATTLE_ATTACK_FIND_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_DROP_MINE_OK:
					{
						FieldSocketBattleDropMineOk((MSG_FC_BATTLE_DROP_MINE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_MINE_ATTACK_OK:
					{
						FieldSocketBattleMineAttackOk((MSG_FC_BATTLE_MINE_ATTACK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_MINE_ATTACK_FIND_OK:
					{
						FieldSocketBattleMineAttackFindOk((MSG_FC_BATTLE_MINE_ATTACK_FIND_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TIMER_START_TIMER:
					{
						FieldSocketTimerStartTimer((MSG_FC_TIMER_START_TIMER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TIMER_STOP_TIMER:
					{
						FieldSocketTimerStopTimer((MSG_FC_TIMER_STOP_TIMER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TIMER_UPDATE_TIMER:
					{
						FieldSocketTimerUpdateTimer((MSG_FC_TIMER_UPDATE_TIMER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TIMER_PAUSE_TIMER:
					{
						FieldSocketTimerPauseTimer((MSG_FC_TIMER_PAUSE_TIMER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TIMER_CONTINUE_TIMER:
					{
						FieldSocketTimerContinueTimer((MSG_FC_TIMER_CONTINUE_TIMER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_PREPARE_USE_OK:
					{
						FieldSocketSKillPrepareUseOk((MSG_FC_SKILL_PREPARE_USE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_CANCEL_PREPARE_OK:
					{
						FieldSocketCancelPrepareOk((MSG_FC_SKILL_CANCEL_PREPARE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_WEAPON_VEL_OK:
					{
						FieldSocketMoveWeaponVelOk((MSG_FC_MOVE_WEAPON_VEL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_COUNTDOWN_START:
					{
						FieldSocketCountdownStart((MSG_FC_COUNTDOWN_START*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_SHOW_DAMAGE:
					{
						FieldSocketBattleShowDamage((MSG_FC_BATTLE_SHOW_DAMAGE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OBJECT_CHANGE_BODYCONDITION_OK:
					{
						FieldSocketObjectChangeBodyConditionOk((MSG_FC_OBJECT_CHANGE_BODYCONDITION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_AUCTION_INSERT_ITEM:
					{
						FieldSocketAuctionInsertItem((MSG_FC_AUCTION_INSERT_ITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_AUCTION_REGISTER_ITEM_OK:
					{
						FieldSocketAuctionRegisterItemOk((MSG_FC_AUCTION_REGISTER_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_AUCTION_CANCEL_REGISTER_OK:
					{
						FieldSocketAuctionCancerRegisterOk((MSG_FC_AUCTION_CANCEL_REGISTER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_AUCTION_BUY_ITEM_OK:
					{
						FieldSocketAuctionBuyItemOk((MSG_FC_AUCTION_BUY_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_AUCTION_PUT_ENCHANT:
					{
						FieldSocketAuctionPutEnchant((MSG_FC_AUCTION_PUT_ENCHANT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_LOCKON_OK:
					{
						FieldSocketMoveLockonOk((MSG_FC_MOVE_LOCKON_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_UNLOCKON_OK:
					{
						FieldSocketMoveUnlockonOk((MSG_FC_MOVE_UNLOCKON_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_CURRENT_MAP_INFO_OK:
					{
						FieldSocketInfoGetCurrentMapInfoOk((MSG_FC_INFO_GET_CURRENT_MAP_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CASH_PREMIUM_CARD_INFO:
					{
						FieldSocketCharacterCashPremiumCardInfo((MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_INSERT_USINGITEM:
					{
						FieldSocketStoreInsertUsingItem((MSG_FC_STORE_INSERT_USINGITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_DELETE_USINGITEM:
					{
						FieldSocketStoreDeleteUsingItem((MSG_FC_STORE_DELETE_USINGITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_GUILD_SUMMON_MEMBER:
					{
						FieldSocketGuildSummonMember((MSG_FC_GUILD_SUMMON_MEMBER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_RESTORE_NOTIFY:
					{
						FieldSocketItemUseCarditemRestoreNotify((MSG_FC_ITEM_USE_CARDITEM_RESTORE_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_CARDITEM_GUILDSUMMON_NOTIFY:
					{
						FieldSocketItemUseCarditemGuildsummonNotify((MSG_FC_ITEM_USE_CARDITEM_GUILDSUMMON_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_OK:
					{
						FieldSocketInfoGetHappyHourEventInfoOk(FALSE, (MSG_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_GAME_EVENT_INFO_OK:
					{
						FieldSocketInfoGetGameEventInfoOk((MSG_FC_INFO_GET_GAME_EVENT_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MONSTER_TUTORIAL_MONSTER_DEAD_NOTIFY:
					{
						FieldSocketMonsterTutorialMonsterDeadNotify((MSG_FC_MONSTER_TUTORIAL_MONSTER_DEAD_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2009. 09. 18 by ckPark 인피니티 필드 HP에 따른 몬스터 대화
				case T_FC_MONSTER_HPTALK:
					{
						FieldSocketMonsterHPTalk( (MSG_FC_MONSTER_HPTALK*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;
				// end 2009. 09. 18 by ckPark 인피니티 필드 HP에 따른 몬스터 대화

				// 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현
				case T_FC_MONSTER_SKILL:
					{
						FieldSocketMonsterSkill( (MSG_FC_MONSTER_SKILL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

				//2011-10-24 by jhahn 트리거 시스템  
				case T_FC_TRIGGER_MAP_BUFF_SKILL:
					{
						FieldSocketTriggerMapBuffSkill(( MSG_FC_TRIGGER_MAP_BUFF_SKILL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;		 
				//end 2011-10-24 by jhahn 트리거 시스템 	
// 2011-02-08 by jhahn EP4 트리거  시스템 오브젝트 변경			
				case T_FC_OBJECT_CHANGE	:
					{
						FieldObjectChangeOK( (MSG_FC_OBJECT_CHANGE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
//end 2011-02-08 by jhahn EP4 트리거  시스템 오브젝트 변경			
				
// 2011-10-24 by jhahn EP4 트리거 시스템 	
				case T_FC_SHOP_CLOSE:					
					{						
						FieldSocketShopClose( (MSG_FC_SHOP_CLOSE*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;
//end 2011-10-24 by jhahn EP4 트리거 시스템 
//2011-10-24 by jhahn EP4 트리거 시스템 
				case T_FC_SET_LIMITTIME:
					{						
						FieldSocketSetLimitTime( (MSG_FC_SET_LIMITTIME*)(pPacket+SIZE_FIELD_TYPE_HEADER) );

					}
					break;
//end 2011-10-24 by jhahn EP4 트리거 시스템 
				case T_FC_BATTLE_MONSTER_BARRIER_USING:
					{
						FieldSocketMonsterMonsterBarrierUsing( (MSG_FC_BATTLE_MONSTER_BARRIER_USING*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_BATTLE_MONSTER_BARRIER_USE:
					{
						FieldSocketMonsterMonsterBarrierUse( (MSG_FC_BATTLE_MONSTER_BARRIER_USE*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_CHARACTER_DEBUFF_DOT_INFO_OK:
					{
						FieldSocketCharacterDebuffDotInfo( (MSG_FC_CHARACTER_DEBUFF_DOT_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_CHARACTER_DEBUFF_DOT_APPLYING:
					{
						FieldSocketCharacterDebuffDotApply( (MSG_FC_CHARACTER_DEBUFF_DOT_APPLYING*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

				case T_FC_CHARACTER_DEBUFF_DOT_RELEASE:
					{
						FieldSocketCharacterDebuffDotRelease( (MSG_FC_CHARACTER_DEBUFF_DOT_RELEASE*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
					}
					break;
				// end 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현

				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				case T_FC_INFINITY_MODE_LIST_OK:
					{
						// 인피니티 모드 리스트
						FieldSocketInfinityModeListOK( (MSG_FC_INFINITY_MODE_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_READY_LIST_OK:
					{
						// 인피니티 대기방 리스트
						FieldSocketInfinityReadyListOK( (MSG_FC_INFINITY_READY_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_CREATE_OK:
					{
						// 인피니티방 생성 완료
						FieldSocketInfinityCreateOK( (MSG_FC_INFINITY_CREATE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_MEMBER_INFO_LIST_OK:
					{
						// 인피니티 대기인원 리스트
						FieldSocketInfinityMemberInfoList( (MSG_FC_INFINITY_MEMBER_INFO_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_LEAVE_OK:
					{
						// 인피니티 방 나오기
						FieldSocketInfinityLeaveOK( (MSG_FC_INFINITY_LEAVE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_BAN_OK:
					{
						// 인피니티 강퇴
						FieldSocketInfinityBanOK( (MSG_FC_INFINITY_BAN_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_INFINITY_JOIN_REQUEST_MASTERUSER:
					{
						// 인피니티 가입 요청
						FieldSocketInfinityJoinRequest( (MSG_FC_INFINITY_JOIN_REQUEST_MASTERUSER*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_JOIN_OK:
					{
						// 인피니티 방 조인
						FieldSocketInfinityJoinOK( (MSG_FC_INFINITY_JOIN_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_ENTER:
					{
						// 인피니티 던젼에 입장
						FieldSocketInfinityEnter( (MSG_FC_INFINITY_ENTER*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_READY_OK:
					{
						// 멤버 레디
						FieldSocketInfinityReadyOK( (MSG_FC_INFINITY_READY_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_READY_CANCEL_OK:
					{
						// 멤버 레디 취소
						FieldSocketInfinityReadyCancelOK( (MSG_FC_INFINITY_READY_CANCEL_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_CHANGE_MASTER_OK:
					{
						// 방장 변경
						FieldSocketInfinityChangeMaster( (MSG_FC_INFINITY_CHANGE_MASTER_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_CINEMA:
					{
						// 연출
						FieldSocketInfinityCinema( (MSG_FC_INFINITY_CINEMA*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_SUCCESS_FIN:
					{
						// 인피니티 성공
						FieldSocketInfinitySuccessFIN();
					}
					break;

				case T_FC_INFINITY_FAIL_FIN:
					{
						// 인피니티 실패
						FieldSocketInfinityFailFIN();
					}
					break;

				case T_FC_INFINITY_READY_FINISH_MAINSVR_START:
					{
						// 인피니티 종료, 메인 필드서버로 복귀 시작
						FieldSocketInfinityReadyFinishMainSvrStart();
					}
					break;

				case T_FC_INFINITY_TENDER_DROPITEM_INFO	:
					{
						// 입찰아이템 추가
						FieldSocketInfinityTenderDropItemInfo( (MSG_FC_INFINITY_TENDER_DROPITEM_INFO*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_TENDER_START:
					{
						// 입찰 시작
						FieldSocketInfinityTenderStart( (MSG_FC_INFINITY_TENDER_START*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_TENDER_PUT_IN_TENDER_OK:
					{
						// 주사위 결과
						FieldSocketInfinityPutInTenderOK( (MSG_FC_INFINITY_TENDER_PUT_IN_TENDER_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_TENDER_RESULT:
					{
						// 입찰 최종결과
						FieldSocketInfinityTenderResult( (MSG_FC_INFINITY_TENDER_RESULT*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_TENDER_RESULT_TIMEOVER:
					{
						// 입찰 시간 제한
						FieldSocketInfinityTenderResultTimeOver( (MSG_FC_INFINITY_TENDER_RESULT_TIMEOVER*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_TENDER_RESULT_ALLGIVEUP:
					{
						// 입찰 전부 포기
						FieldSocketInfinityTenderResultAllGiveUp( (MSG_FC_INFINITY_TENDER_RESULT_ALLGIVEUP*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFO_APPLY_RESISTANCE_ITEM:
					{
						// 스킬 저항
						FieldSocketInfinityApplyResistanceItem( (MSG_FC_INFO_APPLY_RESISTANCE_ITEM*)( pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;

				case T_FC_SHOP_INFINITY_ITEM_HEADER:
					{
						FieldSocketInfinityShopItemHeader();
					}
					break;

				case T_FC_SHOP_INFINITY_ITEM:
					{
						// 인피니티 구매 상점 아이템 추가
						FieldSocketInfinityShopItem( (MSG_FC_SHOP_INFINITY_ITEM*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_SHOP_INFINITY_ITEM_DONE:
					{
						FieldSocketInfinityShopItemDone();
					}
					break;

				case T_FC_INFINITY_CHANGE_LIMITTIME:
					{
						// 인피니티 사망시 제한 시간 페널티
						FieldSocketInfinityChangeLimitTime( (MSG_FC_INFINITY_CHANGE_LIMITTIME*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_JOIN_CANCEL_REQUEST_MASTERUSER:
					{
						// 인피니티 방 가입도중 취소
						FieldSocketInfinityJoinCancelRequestMaster( (MSG_FC_INFINITY_JOIN_CANCEL_REQUEST_MASTERUSER*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case  T_FC_INFINITY_REQUEST_RESTART_BY_DISCONNECT:
					{
						// 인피니티 튕겼을때 알림
						FieldSocketInfinityRequestRestartByDisconnect();
					}
					break;

				case T_FC_INFINITY_DELETED_CINEMA_HEADER:
					{

					}
					break;

				case T_FC_INFINITY_DELETED_CINEMA:
					{
						// 인피니티 튕긴 유저에게 주는 이전 cinema정보
						FieldSocketInfinityDeletedCinema( (MSG_FC_INFINITY_DELETED_CINEMA*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_DELETED_CINEMA_DONE:
					{
						
					}
					break;

				case T_FC_INFINITY_ENTER_BY_DISCONNECT:
					{
						// 인피니티 튕겼을때 재접속
						FieldSocketInfinityEnterByDisConnect( (MSG_FC_INFINITY_ENTER_BY_DISCONNECT*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_PARTY_AUTO_CREATED:
					{
						FieldSocketInfinityPartyAutoCreated( (MSG_FC_PARTY_AUTO_CREATED*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

				// 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )

				case T_FC_INFINITY_DIFFICULTY_LIST_OK :
					{
						FieldSocketInfinityRegsiterDifficultyBonusInfoListData ( (MSG_INFINITY_DIFFICULTY_LIST_OK *)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFINITY_CHANGE_DIFFICULTY_LEVEL_OK :
					{
						FieldSocketInfinityChangeRoomDifficultyLevelOK ( (MSG_FC_INFINITY_CHANGE_DIFFICULTY_LEVEL_OK *)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// End 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )

				// 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)
				case T_FC_INFINITY_READY_CANCEL_ALL_OK :
					{
						FieldSocketInfinityReadyCancelAllOK ( (MSG_FC_INFINITY_READY_CANCEL_ALL_OK *)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// End 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)

				// 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.
				case T_FC_INFINITY_SKIP_ENDING_CINEMA_OK :
					{
						FieldSocketInfinityCinemaSkip ( ( MSG_FC_INFINITY_SKIP_ENDING_CINEMA_OK *)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// End 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.

				// 2010. 02. 11 by ckPark 발동류 장착아이템
				case T_FC_INFO_APPLY_DESTPARAM:
					{
						FieldSocketInfoApplyDestParam( (MSG_FC_INFO_APPLY_DESTPARAM*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_INFO_APPLY_DESTPARAM_LIST:
					{
						FieldSocketInfoApplyDestParamList( (MSG_FC_INFO_APPLY_DESTPARAM_LIST*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_ITEM_END_COOLINGTIME_ITEM_OK:
					{
						FieldSocketItemEndCoolItemOK( (MSG_FC_ITEM_END_COOLINGTIME_ITEM_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_ITEM_GET_COOLINGTIME_INFO_OK:
					{
						FieldSocketItemGetCoolTimeInfoOK( (MSG_FC_ITEM_GET_COOLINGTIME_INFO_OK*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_ITEM_USE_INVOKING_WEAR_ITEM_BUFF:
					{
						FieldSocketItemUseInvokingWearItemBuff( (MSG_FC_ITEM_USE_INVOKING_WEAR_ITEM_BUFF*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// end 2010. 02. 11 by ckPark 발동류 장착아이템

				// 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)
				case T_FC_INFINITY_CHANGE_ALIVE_FOR_GAMECLEAR_MONSTERHP:
					{
						FieldSocketInfinityChangeAliveForGameClearMonsterHP( (MSG_FC_INFINITY_CHANGE_ALIVE_FOR_GAMECLEAR_MONSTERHP*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_MONSTER_CREATED_ALIVE_FOR_GAMECLEAR:
					{
						FieldSocketMonsterCreatedAliveForGameClear( (MSG_FC_MONSTER_CREATED_ALIVE_FOR_GAMECLEAR*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// end 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)

				// 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)
				case T_FC_MONSTER_SKILL_CANCEL:
					{
						FieldSocketMonsterCancelSkill( (MSG_FC_MONSTER_SKILL_CANCEL*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// end 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)

				case T_FC_CHARACTER_TUTORIAL_SKIP_OK:
					{
						FieldSocketCharacterTutorialSkipOk((MSG_FC_CHARACTER_TUTORIAL_SKIP_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_DEAD_NOTIFY:
					{
						FieldSocketCharacterDeadNotify((MSG_FC_CHARACTER_DEAD_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITYWAR_MONSTER_DEAD:
					{
						FieldSocketCitywarMonsterDead((MSG_FC_CITYWAR_MONSTER_DEAD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_CHANGE_INFLUENCE_TYPE:
					{
						FieldSocketCharacterChangeInfluenceType((MSG_FC_CHARACTER_CHANGE_INFLUENCE_TYPE*)(pPacket+SIZE_FIELD_TYPE_HEADER));						
					}
					break;
				case T_FC_SHOP_REQUEST_REPAIR_OK:
					{
						FieldSocketRequestRepairOk((MSG_FC_SHOP_REQUEST_REPAIR_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_CONFIRM_USE_ACK:
					{
						FieldSocketSkillConfirmUseAck((MSG_FC_SKILL_CONFIRM_USE_ACK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_CONFIRM_USE:
					{
						FieldSocketSkillConfirmUse((MSG_FC_SKILL_CONFIRM_USE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_ITEMSTORAGE:
					{
						FieldSocketStoreUpdateItemStorage((MSG_FC_STORE_UPDATE_ITEMSTORAGE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_BUY_COLOR_ITEM_OK:
					{
						FieldSocketShopBuyColorItemOk((MSG_FC_SHOP_BUY_COLOR_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_ATTACK_EVASION_OK:
					{
						FieldSocketBattleAttackEvasionOk((MSG_FC_BATTLE_ATTACK_EVASION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_NOTIFY_INVASION:
					{
						FieldSocketWarNotifyInvasion((MSG_FC_WAR_NOTIFY_INVASION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD:
					{
						FieldSocketWarNotifyInfluenceMonsterDead((MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2007-02-15 by bhsohn 모선 자동 소멸시 이벤트 받음.
				case T_FC_WAR_NOTIFY_INFLUENCE_MONSTER_AUTO_DESTROYED:
					{
						FieldSocketWarNotifyInfluenceAutoMonsterDead((MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2007-02-15 by bhsohn 모선 자동 소멸시 이벤트 받음.
				case T_FC_WAR_NOTIFY_INFLUENCE_MONSTER_INVASION:
					{
						FieldSocketWarNotifyInfluenceMonsterIvasion((MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_INVASION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_USINGITEM:
					{
						FieldSocketStoreUpdateUsingItem((MSG_FC_STORE_UPDATE_USINGITEM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_BOSS_MONSTER_SUMMON_DATA:
					{
						FieldSocketWarBossMonsterSummonDataInvasion((MSG_FC_WAR_BOSS_MONSTER_SUMMON_DATA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2007-07-04 by bhsohn 오퍼레이터 추가
				case T_FC_WAR_STRATEGYPOINT_MONSTER_SUMMON:
					{
						FieldSocketWarStrategypointMonsterSummon(((MSG_FC_WAR_STRATEGYPOINT_MONSTER_SUMMON*)(pPacket+SIZE_FIELD_TYPE_HEADER)));
					}
					break;
					// end 2007-07-04 by bhsohn 오퍼레이터 추가
				case T_FC_WAR_SIGN_BOARD_INSERT_STRING:
					{
						FieldSocketWarSignBoardInsertString((MSG_FC_WAR_SIGN_BOARD_INSERT_STRING*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_REQ_SIGN_BOARD_STRING_LIST_OK:
					{
						FieldSocketWarReqSignBoardStringListOk((MSG_FC_WAR_REQ_SIGN_BOARD_STRING_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_SIGN_BOARD_DELETE_STRING:
					{
						FieldSocketWarSignBoardDeleteString((MSG_FC_WAR_SIGN_BOARD_DELETE_STRING*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_UPDATE_CONTRIBUTION_POINT_OK:
					{
						FieldSocketWarUpdateContributionPointOk((MSG_FC_WAR_UPDATE_CONTRIBUTION_POINT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_JACO_MONSTER_SUMMON:
					{
						FieldSocketWarJacoMonsterSummon((MSG_FC_WAR_JACO_MONSTER_SUMMON*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_INFLUENCE_DATA:
					{
						FieldSocketWarInfluenceData((MSG_FC_WAR_INFLUENCE_DATA*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_INFLUENCE_BUFF_OK:
					{
						FieldSocketItemUseBuffOk((MSG_FC_ITEM_USE_INFLUENCE_BUFF_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_USE_INFLUENCE_GAMEEVENT_OK:
					{
						FieldSocketItemUseInfluenceGameEventOk((MSG_FC_ITEM_USE_INFLUENCE_GAMEEVENT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2008-04-04 by bhsohn 핵쉴드 방식 변경
//				case T_FC_MOVE_HACKSHIELD_GuidReqMsg:
//					{
//						FieldSocketMoveHackShield_GuidReqMsg((MSG_FC_MOVE_HACKSHIELD_GuidReqMsg*)(pPacket+SIZE_FIELD_TYPE_HEADER));
//					}
//					break;
					// end 2008-04-04 by bhsohn 핵쉴드 방식 변경
				case T_FC_MOVE_HACKSHIELD_CRCReqMsg:
					{
						FieldSocketMoveHackShield_CRCReqMsg((MSG_FC_MOVE_HACKSHIELD_CRCReqMsg*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_UPDATE_ITEMNUM:
					{
						FieldSocketStoreUpdateItemNum((MSG_FC_STORE_UPDATE_ITEMNUM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_CALL_WARP_EVENT_REQUEST:
					{
						FieldSocketEventCallWarpEventReqeust((MSG_FC_EVENT_CALL_WARP_EVENT_REQUEST*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_PUT_ITEM_OK:
					{
						FieldSocketBazaarSellPutItemOK((MSG_FC_BAZAAR_SELL_PUT_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_BUY_PUT_ITEM_OK:
					{
						FieldSocketBazaarBuyPutItemOK((MSG_FC_BAZAAR_BUY_PUT_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_CANCEL_ITEM_OK:
					{
						FieldSocketBazaarSellCancelItemOK((MSG_FC_BAZAAR_SELL_CANCEL_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_BUY_CANCEL_ITEM_OK:
					{
						FieldSocketBazaarBuyCancelItemOK((MSG_FC_BAZAAR_BUY_CANCEL_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_START_OK:
					{
						FieldSocketBazaarSellStartOK();
					}
					break;
				case T_FC_BAZAAR_BUY_START_OK:
					{
						FieldSocketBazaarBuyStartOK();
					}
					break;
				case T_FC_BAZAAR_INFO_OK:
					{
						FieldSocketBazaarInfoOK((MSG_FC_BAZAAR_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_REQUEST_ITEMLIST_OK:
					{
						FieldSocketBazaarSellReQuestItemListOK((MSG_FC_BAZAAR_SELL_REQUEST_ITEMLIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_BUY_REQUEST_ITEMLIST_OK:
					{
						FieldSocketBazaarBuyReQuestItemListOK((MSG_FC_BAZAAR_BUY_REQUEST_ITEMLIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_CUSTOMER_INFO_OK:
					{
						FieldSocketBazaarCustomerInfoOK((MSG_FC_BAZAAR_CUSTOMER_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_ITEM_ENCHANTLIST_OK:
					{
						FieldSocketBazaarSellItemEnchantlistOK((MSG_FC_BAZAAR_SELL_ITEM_ENCHANTLIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_SELL_BUY_ITEM_OK:
					{
						FieldSocketBazaarSellBuyItemOK((MSG_FC_BAZAAR_SELL_BUY_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BAZAAR_BUY_SELL_ITEM_OK:
					{
						FieldSocketBazaarBuySellItemOK((MSG_FC_BAZAAR_BUY_SELL_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CONNECT_NOTIFY_SERVER_SHUTDOWN:
					{
						FieldSocketNotifyServerShutdown();
					}
					break;
				case T_FC_ITEM_USE_RANDOMBOX_OK:
					{
						FieldSocketItemUseRandomBoxOk((MSG_FC_ITEM_USE_RANDOMBOX_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2008-08-26 by bhsohn 랜덤박스 시스템 변경
				case T_FC_ITEM_USE_RANDOMBOX_OK_DONE:
					{
						FieldSocketItemUseRandomBoxOkDone();
					}
					break;
					// end 2008-08-26 by bhsohn 랜덤박스 시스템 변경
				case T_FC_STORE_REQUEST_QUICKSLOT_OK:
					{
						FieldSocketStoreRequestQuickslotOK((MSG_FC_STORE_REQUEST_QUICKSLOT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_USE_BONUSSTAT_OK:
					{
						FieldSocketCharacterUseBonusstatOK((MSG_FC_CHARACTER_USE_BONUSSTAT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_LOG_GUILD_ITEM_OK:
					{
						FieldSocketStoreLogGuildItemOK((MSG_FC_STORE_LOG_GUILD_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_STORE_LOG_GUILD_ITEM_OK_HEADER:
					{
						FieldSocketStoreLogGuildItemOKHeader();
					}
					break;
				case T_FC_STORE_LOG_GUILD_ITEM_OK_DONE:
					{
						FieldSocketStoreLogGuildItemOKDone();						
					}
					break;
				case T_FC_ITEM_USE_SKILL_SUPPORT_ITEM_OK:
					{
						FieldSocketUseSkillSupportItemOK((MSG_FC_ITEM_USE_SKILL_SUPPORT_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_SERVER_DATE_TIME_OK:
					{
						FieldSocketGetServerDataTimeOK((MSG_FC_INFO_GET_SERVER_DATE_TIME_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_REQUEST_PARTY_WARP:
					{
						FieldSocketRequestPartyWarp((MSG_FC_QUEST_REQUEST_PARTY_WARP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_MONSTER_CREATED:
					{
						FieldSocketWarMonsterCreated((MSG_FC_WAR_MONSTER_CREATED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_MONSTER_AUTO_DESTROYED:
					{
						FieldSocketWarMonsterAutoDestroyed((MSG_FC_WAR_MONSTER_AUTO_DESTROYED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_WAR_MONSTER_DEAD:
					{
						FieldSocketWarMonsterDead((MSG_FC_WAR_MONSTER_DEAD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SKILL_CANCEL_SKILL_OK:
					{
						FieldSocketSkillCancelSkillOK((MSG_FC_SKILL_CANCEL_SKILL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_DELETE_DUMMY_OK:
					{
						FieldSocketBattleDeleteDummyOK((MSG_FC_BATTLE_DELETE_DUMMY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_BATTLE_EXPLODE_DUMMY_OK:
					{
						FieldSocketBattleExplodeDummyOK((MSG_FC_BATTLE_EXPLODE_DUMMY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_OBSERVER_START_OK:
					{
						FieldSocketCharacterObserverStartOK((MSG_FC_CHARACTER_OBSERVER_START*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_OBSERVER_END_OK:
					{
						FieldSocketCharacterObserverEndOK((MSG_FC_CHARACTER_OBSERVER_END*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_OBSERVER_REG:
					{
						FieldSocketCharacterObserverRegOK((MSG_FC_CHARACTER_OBSERVER_REG*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_OBSERVER_INFO:
					{
						FieldSocketCharacterObserverInfoOK((MSG_FC_CHARACTER_OBSERVER_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_REQUEST_TEAM_OK:
					{
						FieldSocketArenaRequestTeamOK((MSG_FC_ARENA_REQUEST_TEAM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_CREATE_TEAM_OK:
					{
						FieldSocketArenaCreateTeamOK((MSG_FC_ARENA_CREATE_TEAM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ENTER_TEAM_OK:
					{
						FieldSocketArenaEnterTeamOK((MSG_FC_ARENA_ENTER_TEAM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_TEAM_MEMBER_LIST:
					{
						FieldSocketArenaTeamMemberList((MSG_FC_ARENA_TEAM_MEMBER_LIST*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_REAVE_TEAM_OK:
					{
						FieldSocketArenaReaveTeamOK();
					}
					break;
				case T_FC_ARENA_TEAM_READY:
					{
						FieldSocketArenaTeamReady((MSG_FC_ARENA_TEAM_READY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ENTER_ROOM:
					{
						FieldSocketArenaEnterRoom((MSG_FC_ARENA_ENTER_ROOM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ROOM_WAR_START:
					{
						FieldSocketArenaRoomWarStart();
					}
					break;
				case T_FC_ARENA_ROOM_WAR_INFO:
					{
						FieldSocketArenaRoomWarInfo((MSG_FC_ARENA_ROOM_WAR_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ROOM_WAR_FINISH_HEADER:
					{
						FieldSocketArenaRoomWarFinishHeader((MSG_FC_ARENA_ROOM_WAR_FINISH_HEADER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ROOM_WAR_FINISH:
					{
						FieldSocketArenaRoomWarFinish((MSG_FC_ARENA_ROOM_WAR_FINISH*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ROOM_WAR_FINISH_DONE:
					{
						FieldSocketArenaRoomWarFinishDone((MSG_FC_ARENA_ROOM_WAR_FINISH_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_ROOM_WAR_FINISH_DRAW:
					{
						FieldSocketArenaRoomWarFinishDraw((MSG_FC_ARENA_ROOM_WAR_FINISH_DRAW*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_FINISH_WARP_OK:
					{
						FieldSocketArenaFinishWarpOK((MSG_FC_ARENA_FINISH_WARP_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_BEFORE_ROOM_WAR_FINISH:
					{
						FieldSocketArenaBeforRoomWarFinish();
					}
					break;
				case T_FC_ARENA_REQUEST_CREATE_TEAMINFO_OK:
					{
						FieldSocketArenaRequestCreateTeamInfoOK((MSG_FC_ARENA_REQUEST_CREATE_TEAMINFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_TEAM_MATCHING:
					{
						FieldSocketArenaTeamMatching();
					}
					break;
				case T_FC_CHARACTER_PAY_WARPOINT:
					{
						FieldSocketCharacterPayWarPoint((MSG_FC_CHARACTER_PAY_WARPOINT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_REQUEST_OTHER_TEAM_INFO_OK:
					{
						FieldSocketArenaRequestOtherTeamInfoOK((MSG_FC_ARENA_REQUEST_OTHER_TEAM_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_GM_COMMAND_INFO_HEADER:
					{
						FieldSocketArenaGMCommandInfoHeader();
					}
					break;
				case T_FC_ARENA_GM_COMMAND_INFO:
					{
						FieldSocketArenaGMCommandInfo((MSG_FC_ARENA_GM_COMMAND_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_GM_COMMAND_INFO_DONE:
					{
						FieldSocketArenaGMCommandInfoDone((MSG_FC_ARENA_GM_COMMAND_INFO_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_BUY_WARPOINT_ITEM_OK:
					{
						FieldSocketShopBuyWarPointItemOK((MSG_FC_SHOP_BUY_WARPOINT_ITEM_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_WATCH_READY:
					{
						FieldSocketArenaWatchReady((MSG_FC_ARENA_WATCH_READY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_WATCH_START:
					{
						FieldSocketArenaWatchStart((MSG_FC_ARENA_WATCH_START*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ARENA_WATCH_END:
					{
						FieldSocketArenaWatchEnd();
					}
					break;
				case T_FC_ARENA_WATCH_REMOVE_USER:
					{
						FieldSocketArenaWatchRemoveUser((MSG_FC_ARENA_WATCH_REMOVE_USER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHARACTER_WATCH_INFO:	
					{
						FieldSocketCharacterWatchInfo((MSG_FC_CHARACTER_WATCH_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TUTORIAL_START_OK:
					{
						FieldSocketTutorialStartOK((MSG_FC_TUTORIAL_START_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_TUTORIAL_COMPLETE_OK:
					{
						FieldSocketTutorialCompleteOK((MSG_FC_TUTORIAL_COMPLETE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));;
					}
					break;
				case T_FC_TUTORIAL_END_OK:
					{
						FieldSocketTutorialEndOK();
					}
					break;
					// 2007-08-07 by bhsohn 스피커 아이템 추가
				case T_FC_CHAT_ALL_INFLUENCE:
					{
						FieldSocketChatAllInfluenceOK((MSG_FC_CHAT_ALL_INFLUENCE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2007-08-07 by bhsohn 스피커 아이템 추가
				case T_FC_CHAT_OUTPOST_GUILD:
					{
						FieldSocketChatOutPostGuild((MSG_FC_CHAT_OUTPOST_GUILD*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_WAR_BEFORE:
					{
						FieldSocketOutPostWarBefore((MSG_FC_OUTPOST_WAR_BEFORE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_WAR_START:
					{
						FieldSocketOutPostWarStart((MSG_FC_OUTPOST_WAR_START*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_PROTECTOR_DESTROY:
					{
						FieldSocketOutPostProtectorDestroy((MSG_FC_OUTPOST_PROTECTOR_DESTROY*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_RESET_START_OK:
					{
						FieldSocketOutPostResetStartOk((MSG_FC_OUTPOST_RESET_START_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_RESET_DESTROY:
					{
						FieldSocketOutPostResetDestroy((MSG_FC_OUTPOST_RESET_DESTROY*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_RESET_SUCCESS:
					{
						FieldSocketOutPostResetSuccess((MSG_FC_OUTPOST_RESET_SUCCESS*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_WAR_END:
					{
						FieldSocketOutPostWarEnd((MSG_FC_OUTPOST_WAR_END*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_NOTICE_REQUEST_OK:
					{
						FieldSocketInfoNoticeRequestOk((MSG_FC_INFO_NOTICE_REQUEST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_NOTICE_REG_OK:
					{
						FieldSocketInfoNoticeRegOk();
					}
					break;
				case T_FC_INFO_NOTICE_MODIFY_OK:
					{
						FieldSocketInfoNoticeModifyOk();
					}
					break;
				case T_FC_INFO_EXPEDIENCYFUND_PAYBACK_OK:
					{
						FieldSocketInfoExpediencyfundPayBackOk((MSG_FC_INFO_EXPEDIENCYFUND_PAYBACK_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_EXPEDIENCYFUND_REQUEST_OK:
					{
						FieldSocketInfoExpediencyfundRequestOk((MSG_FC_INFO_EXPEDIENCYFUND_REQUEST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK:
					{
						FieldSocketOutPostNextWarInfoRequestOk((MSG_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_NEXTWAR_SET_TIME_OK:
					{
						FieldSocketOutPostNextWarSetTimeOk((MSG_FC_OUTPOST_NEXTWAR_SET_TIME_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_OUTPOST_WAR_INFO:
					{
						FieldSocketOutPostWarInfo((MSG_FC_OUTPOST_WAR_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case T_FC_INFO_SECONDARYPASSWORD_LOCK_OK:
					{
						FieldSecondLockOk((MSG_FC_INFO_SECONDARYPASSWORD_LOCK_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_SECONDARYPASSWORD_CHECK_PASSWORD_OK:
					{
						FieldSocketInfoSecondarypasswordCheckPassword(TRUE);
					}
					break;
				case T_FC_INFO_SECONDARYPASSWORD_UPDATE_PASSWORD_OK:
					{
						FieldSocketSecondPasswordUpdateOk(TRUE);
					}
					break;				
					// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case T_FC_EVENT_TELEPORT_BUILDCOMPLETE:
					{
						FieldSocketEventTeleportBuildComplete((MSG_FC_EVENT_TELEPORT_BUILDCOMPLETE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_TELEPORT_DESTROY:
					{
						FieldSocketEventTeleportDestroy((MSG_FC_EVENT_TELEPORT_DESTROY*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;					
				case T_FC_CHARACTER_UPDATE_SUBLEADER_OK:
					{
						FieldSocketCharacterUpdateSubleaderOk((MSG_FC_CHARACTER_UPDATE_SUBLEADER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK_HEADER:
					{
						FieldSocketCityPollRequestLeaderCandidateListOKHeader((MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK_HEADER*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK:
					{
						FieldSocketCityPollRequestLeaderCandidateListOK((MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK_DONE:
					{
						FieldSocketCityPollRequestLeaderCandidateListOKDone();
					}
					break;
				case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK:
					{
						FieldSocketCityPollRequestLeaderCandidateInfoOK((MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK_GUILDMARK:
					{
						FieldSocketCityPollRequestLeaderCandidateInfoOkGuildMark((MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK_GUILDMARK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_REG_LEADER_CANDIDATE_OK:
					{
						FieldSocketCityPollRegLeaderCandidateOK((MSG_FC_CITY_POLL_REG_LEADER_CANDIDATE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_DELETE_LEADER_CANDIDATE_OK:
					{
						FieldSocketCityPollDeleteLeaderCandidateOK();
					}
					break;
				case T_FC_CITY_POLL_REQUEST_POLL_DATE_OK:
					{
						FieldSocketCityPollRequestPollDateOK((MSG_FC_CITY_POLL_REQUEST_POLL_DATE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_POLL_VOTE_OK:
					{
						FieldSocketCityPollVoteOK();
					}
					break;
				case T_FC_SHOP_CHECK_GIVE_TARGET_OK:
					{
						FieldSocketShopCheckGiveTargetOK((MSG_FC_SHOP_CHECK_GIVE_TARGET_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_BUY_CASH_ITEM_OK:
					{
						FieldSocketShopBuyCashItemOK((MSG_FC_SHOP_BUY_CASH_ITEM_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
						
#ifdef C_EPSODE4_UI_CHANGE_JSKIM					        // 2011. 10. 10 by jskim UI시스템 변경
                case T_FC_SHOP_BUY_ITEM_UPDATE:
					{
						FieldSocketShopBuyItemUpdate((MSG_FC_SHOP_BUY_ITEM_UPDATE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				
#endif
				case T_FC_CITY_POLL_LEADER_ELECTION_INFO:
					{
						FieldSocketCityPollLeaderElectionInfo((MSG_FC_CITY_POLL_LEADER_ELECTION_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_NOTIFY_MSG_GET_OK:
					{
						FieldSocketEventNotifyMsgGetOK((MSG_FC_EVENT_NOTIFY_MSG_GET_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_WARINFO_INFLUENCE_OK:
					{
						FieldSocketCityWarInfoInfluenceOK((MSG_FC_CITY_WARINFO_INFLUENCE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CITY_WARINFO_OUTPOST_OK:
					{
						FieldSocketCityWarInfoOutPostOK((MSG_FC_CITY_WARINFO_OUTPOST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_GET_GUILDMARK_OK:
					{
						FieldSocketInfoGetGuildMarkOK((MSG_FC_INFO_GET_GUILDMARK_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2007-11-22 by bhsohn 아레나 통합서버
				case T_FC_CONNECT_ARENASERVER_INFO:
					{
						// 아레나 서버 정보 받음 
						FieldSocketConnectArenaServerInfo((MSG_FC_CONNECT_ARENASERVER_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CONNECT_ARENASERVER_LOGIN_OK:
					{
						// 아레나 필드 서버 로그인 성공						
						FieldSocketConnectArenaServerLoginOk((MSG_FC_CONNECT_ARENASERVER_LOGIN_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;					
				case T_FC_ARENA_POSSIBLE_GAMESTART:
					{

						// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 						// 아레나 게임 성공 가능
// 						FieldSocketArenaPossibleGameStart((MSG_FC_ARENA_POSSIBLE_GAMESTART*)(pPacket+SIZE_FIELD_TYPE_HEADER));

						if( m_ArenaSocketType != ARENASOCKET_INFINITY )
							FieldSocketArenaPossibleGameStart((MSG_FC_ARENA_POSSIBLE_GAMESTART*)(pPacket+SIZE_FIELD_TYPE_HEADER));
						else
						{
							// 인피니티 시작시
							if( m_ArenaSocketType == ARENASOCKET_INFINITY )
							{

								// 2011-07-21 by jhahn	인피3차  인피니티 입장시 메세지 인피 메세지 창에 렌더
								if( m_pInterface && m_pInterface->m_pInfinityPopup )			
									m_pInterface->m_pInfinityPopup->AddChat( STRMSG_C_100310_0306 );

								//	m_pChat->CreateChatChild( STRMSG_C_100310_0306, COLOR_SYSTEM );		// "\\y인피니티 필드로 진입합니다.\\y"
								//end 2011-07-21 by jhahn	인피3차  인피니티 입장시 메세지 인피 메세지 창에 렌더					
							

								// 인피니티 맵로딩 대기
								m_bWaitInfinityMapLoad	= TRUE;

								// 인피니티 맵로딩 대기 시간
								m_nInfinityMapLoadTime	= timeGetTime() + 1000;

								// 아레나 시작 패킷
								memcpy( &m_ArenaStartPacket,
										(MSG_FC_ARENA_POSSIBLE_GAMESTART*)(pPacket+SIZE_FIELD_TYPE_HEADER),
										sizeof( MSG_FC_ARENA_POSSIBLE_GAMESTART ) );
							}
						}
						// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

					}
					break;					
				case T_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER_OK:
					{
						FieldSocketCharacterReadyGamestartFromArenaToMainserver((MSG_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;					
					// end 2007-11-22 by bhsohn 아레나 통합서버
					
					// 2007-12-17 by bhsohn 아이템 정보가 다 안오면 게임 대기상태로
				case T_FC_SKILL_SETUP_SKILL_OK_HEADER:
					{
						
					}
					break;
				case T_FC_SKILL_SETUP_SKILL_OK_DONE:
					{			
						// 2007-11-22 by bhsohn 아레나 통합서버
						if(ARENA_STATE_ARENA_GAMING == GetArenaState())
						{
							if(g_pGameMain && g_pGameMain->m_pQuickSlot)
							{
								g_pGameMain->m_pQuickSlot->RefreshQSlotInfo();
							}
						}
						// end 2007-11-22 by bhsohn 아레나 통합서버

						// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
						m_bInfinitySkillSetupOKDone	= TRUE;
						// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST_HEADER:
					{
						
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST_DONE:
					{
						// 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결

						FieldSocketPutAllQuestDone();

						// end 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT_HEADER:
					{						
					}
					break;
				case T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT_DONE:
					{
						// 2009-02-03 by bhsohn 미션 시작시 완료 체크 체크
						FieldSocketQuestPutAllQuestMonsterCountDone();
						// end 2009-02-03 by bhsohn 미션 시작시 완료 체크 체크
					}
					break;
				case T_FC_ITEM_PUT_ENCHANT_HEADER:
					{						
					}
					break;
				case T_FC_ITEM_PUT_ENCHANT_DONE:
					{
						// 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)
						FieldSocketPutEnchantDone();
						// end 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)
					}
					break;
					// end 2007-12-17 by bhsohn 아이템 정보가 다 안오면 게임 대기상태로
				case T_FC_EVENT_COUPON_EVENT_INFO:
					{
						FieldSocketEventCouponEventInfo((MSG_FC_EVENT_COUPON_EVENT_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_COUPON_EVENT_USE_COUPON_OK:
					{
						FieldSocketEventCouponEventUseCouponOK((MSG_FC_EVENT_COUPON_EVENT_USE_COUPON_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2008-02-15 by bhsohn 네트워크 속도 체크
				case T_FC_CONNECT_NETWORK_CHECK_OK:
					{
						FieldSocketConnectNetWorkCheckOk((MSG_FC_CONNECT_NETWORK_CHECK_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2008-02-15 by bhsohn 네트워크 속도 체크
					// 2008-02-25 by bhsohn 아레나 유저 정보 서버도 표시하게 변경
				case T_FC_CONNECT_ARENASERVER_SSERVER_GROUP_FOR_CLIENT:
					{
						FieldSocketArenaServerSServerGroupForClient((MSG_FC_CONNECT_ARENASERVER_SSERVER_GROUP_FOR_CLIENT*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2008-02-25 by bhsohn 아레나 유저 정보 서버도 표시하게 변경
				// 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
				case T_FC_ARENA_USE_CITYWARPITEM:
					{
						FieldSocketArenaUseCityWarpItem();
					}
					break;
					// end 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
					// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
				case T_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_BY_LEVEL:
					{
						FieldSocketInfoGetHappyHourEventInfoOk(TRUE, (MSG_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
					// 2008-03-19 by bhsohn 모선전, 거점전 정보창
				case T_FC_INFO_MSWARINFO_RESULT_OK:
					{
						FieldSocketInfoMsWarInfoResultOk((MSG_FC_INFO_MSWARINFO_RESULT_OK*) (pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_SPWARINFO_RESULT_OK_HEADER:
					{
						// 거점전 정보 시작						
						FieldSocketInfoSpWarInfoResultOkHeader();
					}
					break;
				case T_FC_INFO_SPWARINFO_RESULT_OK:
					{
						FieldSocketInfoSpWarInfoResultOk((MSG_FC_INFO_SPWARINFO_RESULT_OK*) (pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_SPWARINFO_RESULT_OK_DONE:
					{	
						// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경
						// 현재 진행중인 거점정보 업데이트
						FieldSocketInfoSpWarInfoResultOkDone();
					}
					break;					
					// end 2008-03-19 by bhsohn 모선전, 거점전 정보창
				case T_FC_INFO_MSWARINFO_DISPLAY:
					{
						FieldSocketInfoMSWarInfoDisplay((MSG_FC_INFO_MSWARINFO_DISPLAY*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_MSWARINFO_DISPLAY_OPTION_OK:
					{
						FieldSocketInfoMSWarInfoDisplayOptionOK((MSG_FC_INFO_MSWARINFO_DISPLAY_OPTION_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_CLICK_TELEPORT_OK:
					{
						FieldSocketEventClickTeleportOK((MSG_FC_EVENT_CLICK_TELEPORT_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2008-04-04 by bhsohn Ep3 커뮤니티 창
					// 편지 리스트
				case T_FC_CHAT_LETTER_REQUEST_TITLE_OK_HEADER:
					{
						FieldSocketChatLetterRqTitleHeader();
					}
					break;
				case T_FC_CHAT_LETTER_REQUEST_TITLE_OK:
					{
						FieldSocketChatLetterRqTitle((MSG_FC_CHAT_LETTER_REQUEST_TITLE_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_LETTER_REQUEST_TITLE_OK_DONE:
					{
						FieldSocketChatLetterRqTitleOkDone();
					}
					break;
					// 편지 내용
				case T_FC_CHAT_LETTER_READ_OK:
					{
						FieldSocketLetterReadOk((MSG_FC_CHAT_LETTER_READ_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 편지 삭제
				case T_FC_CHAT_LETTER_DELETE_OK:
					{
						FieldSocketChatLetterDelOk();
					}
					break;
					// 편지 보내기
				case T_FC_CHAT_LETTER_SEND_OK:
					{
						FieldSocketChatSendOk();
					}
					break;
				case T_FC_CHAT_LETTER_RECEIVE:
					{
						// 편지 받음.
						FiedldSocketChatLetterReceive((MSG_FC_CHAT_LETTER_RECEIVE*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 전체 편지 리스
				case T_FC_CHAT_ALLLETTER_REQUEST_TITLE_OK_HEADER:
					{
					}
					break;
				case T_FC_CHAT_ALLLETTER_REQUEST_TITLE_OK:
					{
						FieldSocketChatALLLetterRqTitle((MSG_FC_CHAT_ALLLETTER_REQUEST_TITLE_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_CHAT_ALLLETTER_REQUEST_TITLE_OK_DONE:
					{
						FieldSocketChatALLLetterRqTitleOkDone();						
					}
					break;
					// 전체 편지 내용
				case T_FC_CHAT_ALLLETTER_READ_OK:
					{
						FieldSocketAllLetterReadOk((MSG_FC_CHAT_ALLLETTER_READ_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 전체 편지 삭제
				case T_FC_CHAT_ALLLETTER_DELETE_OK:
					{
						FieldSocketChatLetterDelOk();
					}
					break;
					// 전체 편지 보내기
				case T_FC_CHAT_ALLLETTER_SEND_OK:
					{
						FieldSocketChatSendOk();
					}
					break;
				case T_FC_CHAT_ALLLETTER_RECEIVE:
					{
						// 전체편지 받음.						
						FiedldSocketChatAllLetterReceive((MSG_FC_CHAT_ALLLETTER_RECEIVE*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//유저 정보 처리
				case T_FC_CHARACTER_GET_USER_INFO_OK:
					{
						FieldSocketCharacterGetUserInfoOk((MSG_FC_CHARACTER_GET_USER_INFO_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// 2012-06-14 by isshin 아템미리보기
				case T_FC_CHARACTER_GET_USER_ITEM_INFO_SECRET_OK:
					{
						FieldSocketCharacterGetUserItemInfoSecretOk((MSG_FC_CHARACTER_GET_USER_ITEM_INFO_SECRET_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));												
					}
					break;				
				case T_FC_CHARACTER_GET_USER_ITEM_INFO_OK:
					{
						FieldSocketCharacterGetUserItemInfoOk((MSG_FC_ENEMY_ITEM_INFO*) (pPacket + SIZE_FIELD_TYPE_HEADER));												
					}
					break;
				case T_FC_CHARACTER_GET_USER_ITEM_INFO_OK_DONE:
					{
						FieldSocketCharacterGetUserItemInfoDone((MSG_FC_CHARACTER_GET_USER_ITEM_INFO_OK_DONE*) (pPacket + SIZE_FIELD_TYPE_HEADER));												
					}
					break;
					// end 2012-06-14 by isshin 아템미리보기
				case T_FC_CHARACTER_CHANGE_INFO_OPTION_SECRET_OK:
					{
						FieldSocketCharacterChangeInfoOptionSecetOk();
					}
					break;
					// end 2008-04-04 by bhsohn Ep3 커뮤니티 창
					// 2008-08-19 by bhsohn 세력 마크 시스템 추가
				case T_FC_EVENT_INFLUENCEMARK:
					{
						FieldSocketEventInfluenceMark((MSG_FC_EVENT_INFLUENCEMARK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_EVENT_INFLUENCEMARKEND:
					{
						FieldSocketEventInfluenceMarkEnd();
					}
					break;
					// end 2008-08-19 by bhsohn 세력 마크 시스템 추가
                    // 2008-11-21 by bhsohn 거래 완료 시스템 처리
				case T_FC_TRADE_OK_TRADE_NOTIFY:
					{
						FieldSocketTradeOkTradeNotify((MSG_FC_TRADE_OK_TRADE_NOTIFY*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2008-11-21 by bhsohn 거래 완료 시스템 처리
					
				case T_FC_ITEM_USE_LUCKY_ITEM_OK:
					{
						FieldSocketItemUseRuckyItemOK((MSG_FC_ITEM_USE_LUCKY_ITEM_OK*) (pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
				case T_FC_ITEM_CHANGED_SHAPEITEMNUM:
					{
						FieldSocketItemChangedShapeItemNum( (MSG_FC_ITEM_CHANGED_SHAPEITEMNUM*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;

				case T_FC_ITEM_CHANGED_EFFECTITEMNUM:
					{
						FieldSocketItemChangedEffectItemNum( (MSG_FC_ITEM_CHANGED_EFFECTITEMNUM*)( pPacket + SIZE_FIELD_TYPE_HEADER ) );
					}
					break;
				// end 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현

					// 2008-11-28 by bhsohn XignCode추가
				case T_FC_MOVE_XIGNCODE_REQ_SCAN_INIT:
					{
						FieldSocketMoveXignCodeReqScanInit(nSocketNotifyType, (MSG_FC_MOVE_XIGNCODE_REQ_SCAN_INIT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK:
					{
						FieldSocketMoveXignCodeReqScanCheck(nSocketNotifyType, (MSG_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2008-11-28 by bhsohn XignCode추가
// 2008-12-09 by dgwoo 미션마스터.
				case T_FC_QUEST_REQUEST_MISSIONMASTER_HELP_INVITE:
					{
						FieldSocketQuestRequestMissionMasterHelpInvite((MSG_FC_QUEST_REQUEST_MISSIONMASTER_HELP_INVITE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_MISSIONMASTER_HELP_INVITE_OK:
					{
						FieldSocketQuestMissionMasterHelpInviteOK((MSG_FC_QUEST_MISSIONMASTER_HELP_INVITE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_MISSIONMASTER_HELP_REJECT_OK:
					{
						FieldSocketQuestMissionMasterHelpRejectOK((MSG_FC_QUEST_MISSIONMASTER_HELP_REJECT_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;		  
// end 2008-12-09 by dgwoo 미션마스터.
					// 2008-12-30 by bhsohn 전쟁보상추가 기획안
				case T_FC_WAR_BOSS_CONTRIBUTION_GUILD:
					{
						FieldSocketBossContributionGuild((MSG_FC_WAR_BOSS_CONTRIBUTION_GUILD*)(pPacket + SIZE_FIELD_TYPE_HEADER));						
					}
					break;
					// end 2008-12-30 by bhsohn 전쟁보상추가 기획안

					// 2009. 01. 12 by ckPark 선전 포고 시스템
				case T_FC_INFO_DECLARATION_MSWAR_INFO_OK:
					{
						g_pD3dApp->EnterLock(TRUE);

						FieldSocketWarDeclareInfoOK((MSG_FC_INFO_DECLARATION_MSWAR_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2009. 01. 12 by ckPark 선전 포고 시스템
					// 2009-02-13 by bhsohn 월드 랭킹 시스템
				case T_FC_INFO_WRK_GET_SERVICE_INFO_OK:
					{						
						FieldSocketInfoWRKGetServiceInfoOk((MSG_FC_INFO_WRK_GET_SERVICE_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_WRK_GET_SERVICE_INFO_OK_IMAGE:
					{						
						FieldSocketInfoWRKGetServiceInfoOkImage((MSG_FC_INFO_WRK_GET_SERVICE_INFO_OK_IMAGE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_WRK_GET_SERVICE_INFO_OK_DONE:
					{						
						FieldSocketInfoWRKGetServiceInfoOkDone();
					}
					break;
				case T_FC_INFO_WRK_GET_LEVEL_RANKER_LIST_OK:
					{
						FieldSocketInfoWRKGetLevelRankerListOk((MSG_FC_INFO_WRK_GET_LEVEL_RANKER_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_WRK_GET_FAME_RANKER_LIST_OK:
					{
						FieldSocketInfoWRKGetFameRankerListOk((MSG_FC_INFO_WRK_GET_FAME_RANKER_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_WRK_GET_PVP_RANKER_LIST_OK:
					{
						FieldSocketInfoWRKGetPVPRankerListOk((MSG_FC_INFO_WRK_GET_PVP_RANKER_LIST_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;				
				case T_FC_CHARACTER_CHANGE_NICKNAME_OK:
					{
						FieldSocketCharacterChangeNickNameOk((MSG_FC_CHARACTER_CHANGE_NICKNAME_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_INFO_WRK_GET_SELF_RANKING_OK:
					{
						FieldSocketInfoWrkGetSelfRankingOk((MSG_FC_INFO_WRK_GET_SELF_RANKING_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2009-02-13 by bhsohn 월드 랭킹 시스템
					// 2009-03-10 by bhsohn nProtector CS모듈 추가
				case T_FC_MOVE_NPROTECT_REQ_AUTH_DATA:
					{
						FieldSocketMoveNProtectReqAuthData((MSG_FC_MOVE_NPROTECT_REQ_AUTH_DATA*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2009-03-10 by bhsohn nProtector CS모듈 추가
					// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
					// 2015-01-07 by jwLee 게임포지 nProtector 적용
				case T_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA:
					{
						FieldSocketMoveNProtectNewReqAuthData((MSG_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2015-01-07 by jwLee 게임포지 nProtector 적용
				case T_FC_MOVE_XTRAP_REQ_STEP:
					{
						FieldSocketMoveXTrapReqStep((MSG_FC_MOVE_XTRAP_REQ_STEP*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)

					// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
				case T_FC_MOVE_APEX_REQ_APEXDATA:
					{
						FieldSocketApexReqApexData( (MSG_FC_MOVE_APEX_REQ_APEXDATA*)(pPacket + SIZE_FIELD_TYPE_HEADER) );
					}
					break;
					// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업

					// 2009. 10. 14 by jskim 프리스카 제거
				case T_FC_CHARACTER_CHANGE_START_CITY_MAPINDEX_OK:
					{
						FieldSocketCharacterChangeStart((MSG_FC_CHARACTER_CHANGE_START_CITY_MAPINDEX_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//end 2009. 10. 14 by jskim 프리스카 제거
					// 2009. 11. 3 by jskim 캐쉬(인벤/창고 확장) 아이템 추가 구현
				case T_FC_CHARACTER_CHANGE_ADDED_INVENTORY_COUNT:
					{
						FieldSocketChangeAddedInventoryCount((MSG_FC_CHARACTER_CHANGE_ADDED_INVENTORY_COUNT*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//end 2009. 11. 3 by jskim 캐쉬(인벤/창고 확장) 아이템 추가 구현
					// 2010. 03. 18 by jskim 몬스터변신 카드
				case T_FC_ITEM_UPDATE_TRANSFORMER_OK:
					{
						FieldSocketItemUpdateTransformerOk((MSG_FC_ITEM_UPDATE_TRANSFORMER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//end 2010. 03. 18 by jskim 몬스터변신 카드

				case T_FC_QUEST_INSERT_QUEST:
					{
						FieldSocketQuestInserQuest((MSG_FC_QUEST_INSERT_QUEST*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_QUEST_DELETE_QUEST:
					{
						FieldSocketQuestDeleteQuest((MSG_FC_QUEST_DELETE_QUEST*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// end 2009-04-01 by bhsohn 세력 불균형, 세력 초기화 시스템
					// 2010. 06. 08 by jskim 홈프리미엄 프로토콜 처리
				case T_FC_ITEM_HOMEPREMIUM_INFO:
					{
						FieldSocketHomePremium((MSG_FC_ITEM_HOMEPREMIUM_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
					//end 2010. 06. 08 by jskim 홈프리미엄 프로토콜 처리
					// 2010-06-15 by shcho&hslee 펫시스템 - 펫 아이템 프로토콜 처리
				case T_FC_ITEM_PET_HEADER:
					{

					}
					break;
				case T_FC_ITEM_PET_BASEDATA_OK:
					{
						//함수로 맴버에 추가한다.
						FieldSocketCurrentPetBaseData((MSG_FC_ITEM_PET_BASEDATA*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
//2011-10-06 by jhahn 파트너 성장형 시스템
// 				case T_FC_ITEM_PET_SKILLDATA_OK:
// 					{
// 						//함수로 맴버에 추가한다.
// 						FieldSocketCurrentPetSkillData((MSG_FC_ITEM_PET_SKILLDATA*)(pPacket + SIZE_FIELD_TYPE_HEADER));
// 					}
// 					break;
// 				case T_FC_ITEM_PET_SOCKETDATA_OK:
// 					{
// 						//함수로 맴버에 추가한다.
// 						FieldSocketCurrentPetSocketData((MSG_FC_ITEM_PET_SOCKETDATA*)(pPacket + SIZE_FIELD_TYPE_HEADER));
// 					}
// 					break;				  
                //2011-10-06 by jhahn 파트너 성장형 시스템
				case T_FC_ITEM_PET_DONE:
					{
						
					}
					break;
					// End 2010-06-15 by shcho&hslee 펫시스템 - 펫 아이템 프로토콜 처리
				
				// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
				case T_FC_DISSOLVED_ITEM_OK:
					{
						FieldSocketDissolDissolutionPutItem((MSG_FC_DISSOLVED_SUCCESS_AND_FAILED*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현
			
				// 2011-05-18 by jhahn, 인피3차 몬스터 교체 
				case T_FC_MONSTER_CHANGE_INDEX:
					{
  						FieldMonsterChangeOK((MSG_FC_MONSTER_CHANGE_INDEX*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2011-05-18 by jhahn, 인피3차 몬스터 교체 
				
//2011-10-06 by jhahn 파트너 성장형 시스템					
				case T_FC_ITEM_PET_SET_SOCKET_OK:
					{
						FieldPetSetSocket((MSG_FC_ITEM_PET_SET_SOCKET_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));					
					}
					break;
				case T_FC_ITEM_PET_SET_KIT_SLOT_OK:
					{
						FieldPetSetKitSlot((MSG_FC_ITEM_PET_SET_KIT_SLOT_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));		
					}
					break;

				case T_FC_ITEM_PET_SET_AUTOSKILL_SLOT_OK:
					{
						FieldPetSetAutoSkillSlot((MSG_FC_ITEM_PET_SET_AUTOSKILL_SLOT_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));		
					}
					break;

				case T_FC_ITEM_PET_SET_NAME_OK:
					{
						FieldPetNameChangeOK((MSG_FC_ITEM_PET_SET_NAME_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_ITEM_PET_SET_EXP_RATIO_OK:
					{					
						FieldPetExpRationOK((MSG_FC_ITEM_PET_SET_EXP_RATIO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;

				case T_FC_ITEM_PET_CHANGE_LEVEL:
					{					
						FieldPetLevelChangeOK((MSG_FC_ITEM_PET_CHANGE_LEVEL*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;

				case T_FC_ITEM_PET_CHANGE_EXP:				
					{					
						FieldPetExpChangeOK((MSG_FC_ITEM_PET_CHANGE_EXP*)(pPacket + SIZE_FIELD_TYPE_HEADER));						
					}
					break;
//end 2011-10-06 by jhahn 파트너 성장형 시스템				
				// 2011-05-30 by jhahn, 인피3차 몬스터 삭제
				case T_FC_MONSTER_CINEMA_DELETE_NOTIFY:
					{
						FieldMonsterDeleteOK((MSG_FC_MONSTER_CINEMA_DELETE_NOTIFY*)(pPacket + SIZE_FIELD_TYPE_HEADER));						
					}
					break;
				// end 2011-05-30 by jhahn, 인피3차 몬스터 삭제	
 					
 				// 2011-05-30 by jhahn, 인피3차 시간 셋팅
				case T_FC_INFINITY_SET_LIMITTIME:
					{						
						FieldSocketInfinityResetTime((MSG_FC_INFINITY_SET_LIMITTIME*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2011-05-30 by jhahn, 인피3차 시간 셋팅		

				// 2011-05-31 by jhahn, 인피3차시네마 변경
				case T_FC_INFINITY_MOVIE:
					{
						FieldInfinityCinemaOK((MSG_FC_INFINITY_MOVIE*)(pPacket + SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2011-05-31 by jhahn, 인피3차시네마 변경

				// START 2011-11-03 by shcho, yedang 셧다운제 구현
				case T_FC_SHUTDOWNMINS_USER_ALTER:
					{
#ifdef SC_SHUT_DOWNMIN_SHCHO
						// 청소년 보호법에 의거하여 만 16세 미만 유저는 00시부터 06시까지 게임 이용이 불가합니다.
						m_pChat->CreateChatChild( STRMSG_C_111109_0001, COLOR_CHAT_ALL, CHAT_TAB_SYSTEM );
#endif
					}
					break;
				case T_FC_SHUTDOWNMINS_USER_ENDGAME:
					{
						if(g_pD3dApp->GetArenaState() == ARENA_STATE_ARENA_GAMING )
						{			
							if( g_pD3dApp->m_ArenaSocketType == CAtumApplication::ARENASOCKET_ARENA )
							{
								g_pGameMain->m_pSystem->m_bQuitGameMessage = TRUE;
							}
							else if( g_pD3dApp->m_ArenaSocketType == CAtumApplication::ARENASOCKET_INFINITY )
							{
								g_pFieldWinSocket->SendMsg( T_FC_INFINITY_LEAVE, 0, 0 );
							}			
						}
						else
						{
							// normal exit
							g_pGameMain->m_pSystem->m_bQuitGameMessage = TRUE;
						}									
					}
					break;
				//  END 2011-11-03 by shcho, yedang 셧다운제 구현
				// 2012-10-16 by bhsohn NPlay PC방 모듈
				case T_FC_CHARACTER_PCBANG_PREMIUN_APPLY:
					{
						FieldSocketCharacterPCBangPremiumApply((MSG_FC_CHARACTER_PCBANG_PREMIUN_APPLY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// END 2012-10-16 by bhsohn NPlay PC방 모듈
				// 2012-10-17 by bhsohn XignCode작업		
				case T_FC_CHARACTER_XIGNCODE_S_ACK_PACKET:
					{
						FieldSocketCharacterXignCodeAckPacket((MSG_FC_CHARACTER_XIGNCODE_ACK_PACKET*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					
				// end 2012-10-17 by bhsohn XignCode작업
				// 2013-05-07 by bhsohn 웹캐쉬 상점 인증키 추가
				case T_FC_SHOP_AUTH_KEY:
					{
						FieldSocketShopAuthKey((MSG_FC_SHOP_AUTH_KEY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// END 2013-05-07 by bhsohn 웹캐쉬 상점 인증키 추가
					// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
				case T_FC_WAR_INFLUENCE_CONSECUTIVE_VICTORITES:
					{
						FieldSocketWarInflConseVictites((MSG_FC_WAR_INFLUENCE_CONSECUTIVE_VICTORITES*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_SHOP_INFLUENCE_BUFF_OK: // 상점에서 버프 받기
					{
						FieldSocketShopInflBuffOk((MSG_FC_SHOP_INFLUENCE_BUFF_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
					// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
				
				// 2013-05-15 by ssjung 이달의 아머 - 이달의 아머 변경 사항 패킷 관련 
				case T_FC_STORE_UPDATE_ARMOR_ITEM_EVENT_INFO:
					{
						FieldSocketStoreUpdateArmorItemEventInfo((MSG_FC_STORE_UPDATE_ARMOR_ITEM_EVENT_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2013-05-15 by ssjung 이달의 아머 - 이달의 아머 변경 사항 패킷 관련 
				// 2013-05-28 by bhsohn 아머 컬렉션 시스템
				case T_FC_COLLECTION_INFO:
					{
						FieldSocketCollectionInfo((MSG_FC_COLLECTION_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_COLLECTION_SHAPE_CHANGE:
					{
						FieldSocketCollectionShapeChange((MSG_FC_COLLECTION_SHAPE_CHANGE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// END 2013-05-28 by bhsohn 아머 컬렉션 시스템
				// 2013-06-14 by ssjung 아머 컬렉션 시스템 이달의 아머
				case T_FC_COLLECTION_MONTHLY_AROMOR_EVENT_INIT:
					{
						FieldSocketCollectionMontylyAromorInit();
					}
					break;
				case T_FC_COLLECTION_MONTHLY_AROMOR_EVENT_INFO:
					{
						FieldSocketCollectionMontylyAromorInfo((MSG_FC_COLLECTION_MONTHLY_AROMOR_EVENT_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2013-06-14 by ssjung 아머 컬렉션 시스템 이달의 아머
				// 2013-08-02 by ssjung 역전의 버프 툴팁표시
				case T_FC_WAR_INFLUENCE_CONSECUTIVE_POINT:
					{
						FieldSocketWarInfluenceConsecutivePoint((MSG_FC_WAR_INFLUENCE_CONSECUTIVE_POINT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2013-08-02 by ssjung 역전의 버프 툴팁표시
				// 2014-06-18 by ymjoo 화면 상단에 세력 표시
				case T_FC_INFLUENCE_SHOW_INFO:
					{
						FieldSocketInfluenceShowInfo((MSG_FC_INFLUENCE_SHOW_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// END 2014-06-18 by ymjoo 화면 상단에 세력 표시
				// 2013-08-28 by ssjung 거점전 리뉴얼(NGC)
				case T_FC_INFO_NGCSPWAR_DISPLAY :
					{
						FieldSocketNGCWarDisplay((MSG_NGCSPWAR_DISPLAY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// end 2013-08-28 by ssjung 거점전 리뉴얼(NGC)
				// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
				case T_FC_CHARACTER_PAY_CONTRIBUTIONPOINT:
					{
						FieldSocketChracterPayContributionPoint((MSG_FC_CHARACTER_PAY_CONTRIBUTIONPOINT*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
// 2013-11-29 by ssjung 거래소 구현
				case T_FC_MARKET_SELL_OK :
					{
						FieldSocketMarketRegOK((MSG_FC_MARKET_SELL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_BUY_OK :
					{
						FieldSocketMarketBuyOK((MSG_FC_MARKET_BUY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_BASE_INFO_HEADER :
					{
						FieldSocketMarkeBaseHeader((MSG_FC_MARKET_BASE_INFO_HEAD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_BASE_INFO_OK :
					{
						FieldSocketMarketBaseOK((MSG_FC_MARKET_BASE_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_BASE_INFO_DONE:
					{
						FieldSocketMarketBaseDone((MSG_FC_MARKET_BASE_INFO_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_MY_LIST_HEADER : 
					{
						FieldSocketMarkeMyListHeader();
					}
					break;
				case T_FC_MARKET_MY_LIST_OK	: 
					{
						FieldSocketMarketListOK((MSG_FC_MARKET_MY_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));	
					}
					break;
				case T_FC_MARKET_MY_LIST_DONE : 
					{
						FieldSocketMarketListOKDone((MSG_FC_MARKET_MY_LIST_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_GET_OK :
					{
						FieldSocketMarketGetOk((MSG_FC_MARKET_GET_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));	
					}
					break;
				case T_FC_MARKET_PAGING_HEADER :
					{
						FieldSocketMarketPaginHeader();
					}
					break;
				case T_FC_MARKET_PAGING_OK :
					{
						FieldSocketMarketPaginOK((MSG_FC_MARKET_PAGING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_PAGING_DONE :
					{
						FieldSocketMarketPaginDone((MSG_FC_MARKET_PAGING_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_SEARCH_HEADER :
					{
						FieldSocketMarkeSerchHeader();
					}
					break;
				case T_FC_MARKET_SEARCH_OK :
					{
						FieldSocketMarkeSerchOK((MSG_FC_MARKET_SEARCH_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_SEARCH_DONE :
					{
						FieldSocketMarkeSerchDone((MSG_FC_MARKET_SEARCH_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_SORT_HEADER :
					{
						FieldSocketMarkeSortHeader();
					}
					break;
				case T_FC_MARKET_SORT_OK :
					{
						FieldSocketMarkeSortOK((MSG_FC_MARKET_SORT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_MARKET_SORT_DONE :
					{
						FieldSocketMarkeSortDone((MSG_FC_MARKET_SORT_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;

// end 2013-11-29 by ssjung 거래소 구현
// 2014-01-15 by ssjung 파괴 경매장 구현
				case T_FC_DESTROY_AUCTION_BASE_INFO_HEADER :
					{
						FieldSocketDestroyAuctionBaseHeader((MSG_FC_DESTROY_AUCTION_BASE_INFO_HEADER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_DESTROY_AUCTION_BASE_INFO_OK : 
					{
						FieldSocketDestroyAuctionBaseOk((MSG_FC_DESTROY_AUCTION_BASE_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_DESTROY_AUCTION_BASE_INFO_DONE : 
					{
						FieldSocketDestroyAuctionBaseDone();
					}
					break;
				case T_FC_DESTROY_AUCTION_TENDER_OK:
					{
						FieldSocketDestroyAuctionTenderOk((MSG_FC_DESTROY_AUCTION_TENDER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_DESTROY_AUCTION_MY_LIST_HEADER :
					{
						FieldSocketDestroyAuctionMyListHeader();
					}
					break;
				case T_FC_DESTROY_AUCTION_MY_LIST_OK :
					{
						FieldSocketDestroyAuctionMyListOk((MSG_FC_DESTROY_AUCTION_MY_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_DESTROY_AUCTION_MY_LIST_DONE :
					{
						FieldSocketDestroyAuctionMyListDone();
					}
					break;
				case T_FC_DESTROY_AUCTION_GET_OK :
					{
						FieldSocketDestroyAuctionGetOk((MSG_FC_DESTROY_AUCTION_GET_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
				case T_FC_DESTROY_AUCTION_NOTI_START :
					{
						// 2014-06-12 by ymjoo 파괴 경매장 추가작업
						FieldSocketDestroyAuctionNotiStart();
						// END 2014-06-12 by ymjoo 파괴 경매장 추가작업
					}
					break;
				case T_FC_DESTROY_AUCTION_NOTI_END : 
					{
						FieldSocketDestroyAuctionNotiEnd();
					}
					break;				
// end 2014-01-15 by ssjung 파괴 경매장 구현
// 2014-02-10 by ssjung, 버그 트랩					
				case T_FC_CONNECT_BUGTRAPSERVER_INFO :
					{
						FieldSocketBugtrapSeverInfo((SBUGTRAP_SERVER_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
// end 2014-02-10 by ssjung, 버그 트랩
// 2014-06-10 by ymjoo 세력 변경 아이템
				case T_FC_ITEM_USE_CARDITEM_CHANGE_INFLUENCE_NOTIFY :
					{
						FieldSocketItemUseCardItemChangeInfluenceNotify((MSG_FC_ITEM_USE_CARDITEM_CHANGE_INFLUENCE_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;
// END 2014-06-10 by ymjoo 세력 변경 아이템
				case T_ERROR:
					{
						FieldSocketError((MSG_ERROR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					}
					break;				

				default:
					{
						FieldSocketInvalidPacket(pPacket);
					}
					break;
				}

				// 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
				m_nPreComType = nType;

				if(pPacket != NULL)
				{
					SAFE_DELETE(pPacket);
				}
				// 2007-11-22 by bhsohn 아레나 통합서버
//				if(m_pFieldWinSocket)
//				{
//					m_pFieldWinSocket->Read(&pPacket, len);// 2004-04-20 by dhkwon
//				}
				if(pFieldSocket)
				{																	
                    // 2010. 10. 05 by jskim 맵로딩 구조 변경  
					// 2009. 09. 10 by ckPark 맵로딩중 패킷오면 큐에 쌓아두도록 변경
					//if( m_pMapInitThread && m_pMapInitThread->m_bRunning )
					//{
					//	pFieldSocket->m_bSendNotify = FALSE;
					//	return 0;
					//}
					// end 2009. 09. 10 by ckPark 맵로딩중 패킷오면 큐에 쌓아두도록 변경
                    // end 2010. 10. 05 by jskim 맵로딩 구조 변경

					pFieldSocket->Read(&pPacket, len);// 2004-04-20 by dhkwon
				}
				// end 2007-11-22 by bhsohn 아레나 통합서버
			}
#ifdef _DEBUG
			g_nMoveCountPerPacket = nCharacterMoveCount;
#endif // _DEBUG_endif
		}
	}
	return 0;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::OnRecvFieldSocketWS_CONNECTED( USHORT nConnect )
/// \brief		Field socket의 WS_CONNECTED를 받았을때
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		USHORT nConnect : 접속 여부
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2007-11-22 by bhsohn 아레나 통합서버
//void CAtumApplication::OnRecvFieldSocketWS_CONNECTED( USHORT nConnect )
void CAtumApplication::OnRecvFieldSocketWS_CONNECTED( USHORT nConnect, CFieldWinSocket* pFieldSocket)
{
	FLOG("CAtumApplication::OnRecvFieldSocketWS_CONNECTED( USHORT nConnect )");
	if(nConnect)
	{
		if(m_bReconnectFieldServer)
		{
			m_bReconnectFieldServer = FALSE;
			MSG_FC_CHARACTER_CONNECT_GAMESTART sMsg;
			memset(&sMsg,0x00,sizeof(sMsg));
			char buffer[SIZE_MAX_PACKET];
			strcpy(sMsg.AccountName, m_strUserID);
			strcpy(sMsg.Password,m_strUserPassword);

			char	host[100];
			HOSTENT	*p;
			char	ip[SIZE_MAX_IPADDRESS];
			gethostname(host, 100);
			if(p = gethostbyname(host))
			{
				sprintf(ip, "%d.%d.%d.%d", (BYTE)p->h_addr_list[0][0], (BYTE)p->h_addr_list[0][1],(BYTE)p->h_addr_list[0][2], (BYTE)p->h_addr_list[0][3]);
				strncpy(sMsg.PrivateIP, ip, SIZE_MAX_IPADDRESS);
			}

			sMsg.AccountUniqueNumber = ((CShuttleChild *)m_pShuttleChild)->m_myShuttleInfo.AccountUniqueNumber;
			sMsg.CharacterUniqueNumber = ((CShuttleChild *)m_pShuttleChild)->m_myShuttleInfo.CharacterUniqueNumber;
			int nType = T_FC_CHARACTER_CONNECT_GAMESTART;
			memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
			memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
			m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
		}
		else
		{
			// 2007-11-22 by bhsohn 아레나 통합서버
			//SendFieldSocketConnectLogin();
			SendFieldSocketConnectLogin(pFieldSocket);		
		}
	}
	else
	{
		// 2007-11-22 by bhsohn 아레나 통합서버
		//NetworkErrorMsgBox(STRMSG_C_SERVER_0007);//"필드서버에 접속 실패 게임이 종료됩니다."
		CFieldWinSocket* pArenaFieldSocket = m_pFieldWinSocket->GetArenaFieldWinSocket();
		if(pArenaFieldSocket && pArenaFieldSocket == pFieldSocket)
		{
			char szNotice[1024];
			memset(szNotice,0x00,1024);		
			sprintf(szNotice, STRMSG_C_080129_0201);		//"아레나 서버와의 접속이 실패하였습니다."
			m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);

			g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_080129_0201, _MESSAGE);

			// 현재 창을 닫는다.
			g_pInterface->m_pCityBase->CloseCurrentEnterBuilding();

			// 아레나 소켓과의 에러
			CloseArenaSocket();
		}
		else
		{
			NetworkErrorMsgBox(STRMSG_C_SERVER_0007);//"필드서버에 접속 실패 게임이 종료됩니다."
		}		
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::OnRecvFieldSocketWS_CLOSED(void)
/// \brief		Field socket의 WS_CLOSED 받았을때
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	m_dwGameState != _MAPLOAD 이면 비정상 종료이다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::OnRecvFieldSocketWS_CLOSED(void)
{
	FLOG("CAtumApplication::OnRecvFieldSocketWS_CLOSED(void)");
//	if(!m_bReconnectFieldServer || !m_bOtherFieldWarping)
	if(m_dwGameState != _MAPLOAD)
	{
		// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
#ifdef	C_SERVER_DOWN_ALARM
		g_pD3dApp->m_pSound->SetBackMusic(_SERVER_DOWN);		
#else
		NetworkErrorMsgBox(STRMSG_C_SERVER_0008);//"서버와의 접속이 종료되었습니다. 클라이언트를 종료합니다. (FieldWinSocket WS_CLOSED)"
#endif		
	}
#ifdef _DEBUG // by dhkwon 2003.7.4
	else
	{
		DBGOUT("case CFieldWinSocket::WS_CLOSED: close\n");
	}
#endif
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketConnectLoginOk(MSG_FC_CONNECT_LOGIN_OK *pMsg)
/// \brief		MSG_FC_CONNECT_LOGIN_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketConnectLoginOk(MSG_FC_CONNECT_LOGIN_OK *pMsg)
{
	FLOG("CAtumApplication::FieldSocketConnectLoginOk(MSG_FC_CONNECT_LOGIN_OK *pMsg)");
	int i;
	// 2007-09-12 by bhsohn 2차 암호 시스템 구현
	// 시스템을 사용할지 여부
	m_bIsUseSecondaryPasswordSystem = pMsg->bIsUseSecondaryPasswordSystem;
	// 암호를 설정했는지 여부
	m_bIsSetSecondaryPassword= pMsg->bIsSetSecondaryPassword;
	// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
	
	// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
	m_bSecondPassLock = FALSE;
	if(m_bIsUseSecondaryPasswordSystem)
	{
		//2차 패스워드 사용시에만 변수에 넣어줌
		m_bSecondPassLock = m_bIsSetSecondaryPassword;
	}
	// end 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함

	m_accountUniqueNumber = pMsg->AccountUniqueNumber;
	g_pSelect->m_pSelectBack->m_bInitEffectItem = false;
	DeleteEffectList();
	if(pMsg->NumCharacters>0)
	{
		for(i=0;i<pMsg->NumCharacters;i++)
		{
//			m_pGUIGame->m_pSelect->SetUnitRenderInfo(i, pMsg->Characters[i]);
			if(m_pInterface && g_pSelect)
			{
				g_pSelect->SetUnitRenderInfo(i, pMsg->Characters[i]);
			}
		}

		MSG_FC_CHARACTER_GET_CHARACTER sMsg;
		memset(&sMsg,0x00,sizeof(sMsg));
		char buffer[SIZE_MAX_PACKET];
		sMsg.AccountUniqueNumber = m_accountUniqueNumber;
		sMsg.CharacterUniqueNumber = pMsg->Characters[0].CharacterUniqueNumber;

		// START 2011-11-03 by shcho, yedang 셧다운제 구현
		sMsg.ShutDownMINS = pMsg->Characters[0].ShutDownMINS;
		// END 2011-11-03 by shcho, yedang 셧다운제 구현

		int nType = T_FC_CHARACTER_GET_CHARACTER;
		memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
		memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
		m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));

		g_pD3dApp->m_bRequestEnable = FALSE;
	
	}
	strcpy(m_VOIPState.szVoIP1to1ServerIP, pMsg->VoIP1to1ServerIP);
	m_VOIPState.nVoIP1to1ServerPort = pMsg->VoIP1to1ServerPort;
	strcpy(m_VOIPState.szVoIPNtoNServerIP, pMsg->VoIPNtoNServerIP);
	m_VOIPState.nVoIPNtoNServerPort = pMsg->VoIPNtoNServerPort;

	if(m_pStageEffect) // 2004-06-07 by dhkwon 연출, LOGO->INIT,SELECT
	{
		m_pStageEffect->SetEndWork(TRUE);
	}

	// 서버 시간 요청 // 2008-04-02 by dgwoo 시간정보를 GameStartOK에서 요청하던걸 로긴에서 처리.
	g_pFieldWinSocket->SendMsg(T_FC_INFO_GET_SERVER_DATE_TIME, NULL, 0);
//	m_bInitializing = FALSE;
	DBGOUT("Field Server State : Login Done (MSG_FC_CONNECT_LOGIN_OK)\n");

	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	SetLoginOkInfo(pMsg);
	// end 2008-08-11 by bhsohn 단독으로 실행 되게끔

	// 2008-11-06 by bhsohn 마우스 가두기 모드 보완
	{
		// 마우스 가두기 영역 갱신
		RefreshMouseMode();
	}
	SetTestServerConnect(pMsg->BIsTestServer); // 2012-11-28 by jhjang 테섭 접속 여부 처리 추가
	SetDBSid(pMsg->DBNum);// 2012-11-28 by jhjang 테섭 접속 여부 처리 추가
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterGetCharacterOk(MSG_FC_CHARACTER_GET_CHARACTER_OK * pMsg)
/// \brief		MSG_FC_CHARACTER_GET_CHARACTER_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetCharacterOk(MSG_FC_CHARACTER_GET_CHARACTER_OK * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGetCharacterOk(MSG_FC_CHARACTER_GET_CHARACTER_OK * pMsg)");

	// 2015-06-02 by jwlee AccountBlockUser 처리
	if (pMsg->Character.bIsBlockedUser)
	{
		char ErrMsg[512];
		wsprintf(ErrMsg,"\'%s\'s account is blocked presently.",pMsg->Character.AccountName);
		NetworkErrorMsgBox(ErrMsg);
	}
	// end 2015-06-02 by jwlee AccountBlockUser 처리
	if(m_pInterface && g_pSelect)
	{
		g_pSelect->SetUnitDetailInfo(pMsg->Character);
	}
//	if(m_dwGameState == _CREATE)
//	{
//		// 캐릭생성시 Select 화면 전환 없이 게임 시작
//		m_pInterface->m_pSelect->m_pCreateMenu->m_bBlocking = FALSE;// create시에 블럭시키는 변수를 풀어준다.
//		memcpy(&m_pShuttleChild->m_myShuttleInfo,&pMsg->Character,sizeof(CHARACTER));
//		memcpy(&m_pIMSocket->m_character,&pMsg->Character,sizeof(CHARACTER));
//		strcpy(((CChatMoveData *)m_pShuttleChild->m_pIDChat->m_pChild)->m_szString,pMsg->Character.CharacterName);
//		m_pInterface->InitMapLoadObjects();
//		m_pInterface->RestoreMapLoadObjects();
//		SAFE_DELETE(m_pMapInitThread );
//		m_pMapInitThread = new CMapInitThread();
//		m_pMapInitThread->CreateThread();
//		ChangeGameState(_MAPLOAD);
//		DBGOUT("필드서버 : 생성창 --> 게임으로 바로 시작, 맵로딩 시작\n");
//	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterCreateOk(MSG_FC_CHARACTER_CREATE_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_CREATE_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterCreateOk(MSG_FC_CHARACTER_CREATE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterCreateOk(MSG_FC_CHARACTER_CREATE_OK* pMsg)");
	int nEmpty = g_pSelect->GetEmptySlot();
	FC_CONNECT_LOGIN_INFO info;
	memset(&info, 0x00, sizeof(FC_CONNECT_LOGIN_INFO));
	strcpy(info.CharacterName,pMsg->Character.CharacterName);
	info.CharacterUniqueNumber = pMsg->Character.CharacterUniqueNumber;
	info.Gender = pMsg->Character.Gender;
	info.PilotFace = pMsg->Character.PilotFace;
	info.Race = pMsg->Character.Race;
	info.UnitKind = pMsg->Character.UnitKind;
//	info.CharacterRenderInfo.RI_ProwOut = GetCreateUnitWeapon11(pMsg->Character.UnitKind);
//	info.CharacterRenderInfo.RI_Rear = GetCreateUnitEngine(pMsg->Character.UnitKind);
	info.CharacterRenderInfo = pMsg->CharacterRenderInfo;
	g_pSelect->SetUnitRenderInfo(nEmpty, info);

	MSG_FC_CHARACTER_GET_CHARACTER sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	char buffer[SIZE_MAX_PACKET];
	sMsg.AccountUniqueNumber = m_accountUniqueNumber;
	sMsg.CharacterUniqueNumber = info.CharacterUniqueNumber;
	int nType = T_FC_CHARACTER_GET_CHARACTER;
	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
	m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
	
	g_pD3dApp->m_bRequestEnable = FALSE;

	g_pSelect->m_pSelectBack->ChangeMode(SELECT_MODE);
	g_pSelect->m_pSelectBack->m_bInitEffectItem = false;
	m_pInterface->m_pSelect->m_pCreateMenu->m_bBlocking = FALSE;
	DeleteEffectList();

	ChangeGameState(_SELECT);
	DBGOUT("Field Server State : Create Character (MSG_FC_CHARACTER_CREATE_OK), Try Game Start(T_FC_CHARACTER_GET_CHARACTER)\n");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterDeleteOk(void)
/// \brief		DeleteOk
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterDeleteOk(void)
{
	FLOG("CAtumApplication::FieldSocketCharacterDeleteOk(void)");
	FC_CONNECT_LOGIN_INFO info;
	memset(&info, 0x00, sizeof(info));
	int select = g_pSelect->GetCurrentSelectIndex();
	g_pSelect->SetUnitRenderInfo(select, info);
	g_pSelect->SetUnitDetailInfoNULL(select);
	int valid = g_pSelect->GetValidIndex();
	if(valid>=0 && valid <3)
	{
		g_pSelect->MoveSelect(valid);
	}
	DeleteEffectList();
	g_pSelect->m_pSelectBack->m_bInitEffectItem = FALSE;
	
	g_pD3dApp->m_bRequestEnable = TRUE;
	g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;

	// 2007-09-12 by bhsohn 2차 암호 시스템 구현
	g_pSelect->ShowSecutiryWnd(FALSE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterGetOtherInfoOk(MSG_FC_CHARACTER_GET_OTHER_INFO_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_GET_OTHER_INFO_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	길드가 존재하고, 길드문장이 없으면 길드 문장 정보 요청
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetOtherInfoOk(MSG_FC_CHARACTER_GET_OTHER_INFO_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGetOtherInfoOk(MSG_FC_CHARACTER_GET_OTHER_INFO_OK* pMsg)");
	if(m_dwGameState == _CITY)
	{
		DBGOUT("MSG_FC_CHARACTER_GET_OTHER_INFO_OK in _CITY \n");
		return;
	}
	if(m_pShuttleChild)
	{
		// 2006-01-10 by ispark, Enemy 정보를 찾는다.
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->CharacterInfo.ClientIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			if(m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.ChannelIndex != pMsg->CharacterInfo.MapChannelIndex.ChannelIndex ||
				m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex != pMsg->CharacterInfo.MapChannelIndex.MapIndex)
			{
				// 같은 맵이 아니므로 지운다.
//				DBGOUT("%s Enemy Other Map[%d(%d)]\n", 
//					itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName, 
//					pMsg->CharacterInfo.MapChannelIndex.MapIndex, 
//					m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex);
				
				itEnemy->second->m_bUsing = FALSE;
				return;
			}
		}
		// Enemy가 없거나 같은 맵이라면 정보 입력
		m_pShuttleChild->CheckIndexList(pMsg);
		if(pMsg->CharacterInfo.GuildUniqueNumber != 0 )
		{
			m_pDatabase->GetOtherGuildInfo( pMsg->CharacterInfo.GuildUniqueNumber );
		}


	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCharacterGetOtherParamfactorOk(MSG_FC_CHARACTER_GET_OTHER_PARAMFACTOR_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_GET_OTHER_PARAMFACTOR_OK
/// \author		dhkwon
/// \date		2004-07-31 ~ 2004-07-31
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetOtherParamfactorOk(MSG_FC_CHARACTER_GET_OTHER_PARAMFACTOR_OK* pMsg)
{
	CUnitData* pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
	if(pUnit && pUnit->m_dwPartType == _ENEMY)
	{
		((CEnemyData*)pUnit)->SetItemParamFactor(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterGetMonsterInfoOk(MSG_FC_CHARACTER_GET_MONSTER_INFO_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_GET_MONSTER_INFO_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetMonsterInfoOk(MSG_FC_CHARACTER_GET_MONSTER_INFO_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGetMonsterInfoOk(MSG_FC_CHARACTER_GET_MONSTER_INFO_OK* pMsg)");
	if(pMsg->MonsterUnitKind < 2000000 || pMsg->MonsterUnitKind >= 3000000)
		return;
	if(m_pShuttleChild)
	{
		m_pShuttleChild->CheckIndexList(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterGameStartOk(MSG_FC_CHARACTER_GAMESTART_OK * pMsg)
/// \brief		MSG_FC_CHARACTER_GAMESTART_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGameStartOk(MSG_FC_CHARACTER_GAMESTART_OK * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGameStartOk(MSG_FC_CHARACTER_GAMESTART_OK * pMsg)");
	
	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	// 로드에선 완료
	{
		// 맵 정보 갱신
		g_pShuttleChild->m_myShuttleInfo.MapChannelIndex = pMsg->MapInfo;
		m_pInterface->m_pMapLoad->MapLoadComplete();	
	}

	// 2008-04-01 by bhsohn 게임스타트에서 기체 바디 컨디션을 새로 받게 변경
	{
		g_pShuttleChild->m_myShuttleInfo.BodyCondition = pMsg->BodyCondition;
		
		g_pShuttleChild->m_myShuttleInfo.CurrentHP	= pMsg->CurrentHP;
		m_pShuttleChild->m_fNextHP = pMsg->CurrentHP;

		g_pShuttleChild->m_myShuttleInfo.CurrentDP = pMsg->CurrentDP;
		m_pShuttleChild->m_fNextDP = pMsg->CurrentDP;

		g_pShuttleChild->m_myShuttleInfo.CurrentSP = pMsg->CurrentSP;
		m_pShuttleChild->m_fNextSP = pMsg->CurrentSP;

		g_pShuttleChild->m_myShuttleInfo.CurrentEP = pMsg->CurrentEP;		
		m_pShuttleChild->m_fNextEP = pMsg->CurrentEP;
	}
	// end 2008-04-01 by bhsohn 게임스타트에서 기체 바디 컨디션을 새로 받게 변경

	// 2007-04-09 by bhsohn 관리자 계정 표출 정보 처리	
	wsprintf(m_strConnectSeverName, "%s[%s] %s", pMsg->GamePublisher, pMsg->MainORTestServerName, pMsg->ServerGroupName0);
	// 2007-07-16 by dgwoo 아이템 정보를 아직 받지 못한 상태.

	m_bInputItemDone = FALSE;

	// 2006-06-07 by ispark,  유료화 아이템 관리자, 운영자만 쓰게 한다.
	if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
		m_bTestServer = FALSE;
	}
//////////////////////////////////////////////////////////////////////////
// 2006-05-08 by ispark, 필드서버가 두개 이상일 경우 필요한 사항이다.
// 2006-05-08 by ispark, 그러나 지금은 한개 이므로 필요가 없다.
//	strcpy(m_strFieldIPCurrent,pMsg->FieldServerIP);
//	int re = strcmp(m_strFieldIPCurrent,m_strFieldIP);
//	strcpy(m_strFieldIP,m_strFieldIPCurrent);
//	if(re != 0 || pMsg->FieldServerPort != m_nFieldPort)
//	{
//		m_bReconnectFieldServer = TRUE;
//		m_pFieldWinSocket->CloseSocket();
//		if(!m_pFieldWinSocket->Connect(m_strFieldIP,m_nFieldPort))
//		{
//			NetworkErrorMsgBox(STRMSG_C_SERVER_0009);//"서버에 접속할 수 없음 (Game Start OK Error)"
//			return;
//		}
//		Sleep(500);
//		DBGOUT("Field Server State : MSG_FC_CHARACTER_GAMESTART_OK, Try Connect Other Field Server(m_pFieldWinSocket->Connect(%s,%d))\n",m_strFieldIP,m_nFieldPort);
//	}
//	else
//////////////////////////////////////////////////////////////////////////
	{
		// 2005-07-21 by ispark
		// 캐릭터 모드 입력 (0 : 유닛(기체), 그외는 캐릭터)
		if(pMsg->CharacterMode0 > 0)
			m_bCharacter = TRUE;
		else
			m_bCharacter = FALSE;		

		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
		//InitCharacterGameStartOk( pMsg->PositionVector, pMsg->MapWeather );
		InitOnlyGameStartOk( pMsg->PositionVector, pMsg->MapWeather, FALSE );

		DBGOUT("Field Server State : MSG_FC_CHARACTER_GAMESTART_OK, init Game Infomation \n");
	}
	
	// 2007-01-07 by bhsohn 길드 정보 동기화 문제 관련 처리
	m_bReadyFieldGameStartOk = TRUE;

	// 캐릭터 최초 접속시 미션창 보이기
	if(g_pTutorial->GetTutorialEd() == TRUE)							// 2005-10-14 by ispark
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		g_pGameMain->m_pMissionInfo->SetFirstMissionSelect(TRUE);
//		g_pGameMain->m_pMissionInfo->MissionProcFlag(TRUE);
		
		g_pGameMain->FirstUserShowMissionTreeWnd();

		// 2005-12-20 by ispark
		// 처음 미션창 보이는 조건은 튜토리얼이나 스킵으로 들어올 때이다. 그러므로 미션창을 보이고 난 후
		// 조건 검색을 FALSE로 변경한다.
		g_pTutorial->SetTutorialEd(FALSE);		
	}
	
	//가맹 PC방인지 체크.
	if(pMsg->bMemberPCBang && g_pGameMain->m_pUnitInfoBar)
	{
		char szNotice[1024];
		memset(szNotice,0x00,1024);
		g_pGameMain->m_pUnitInfoBar->SetHappyHourEventIconPos();
		g_pGameMain->m_pUnitInfoBar->m_bMemberPCBang = TRUE;
		sprintf(szNotice, STRMSG_C_060830_0101);					//"가맹PC방입니다."
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);		

	}

	// 숨겨진 미션 검사
	CQuest* pQuest = g_pQuestData->FindMapHideQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		g_pGameMain->m_pMissionInfo->SetPosMissionSearchStart(TRUE);
//		g_pGameMain->m_pMissionInfo->SetPosMissionInfo(pQuest);
		g_pGameMain->SetMissionPosMissionSearchStart(TRUE);
		g_pGameMain->SetMissionPosMissionInfo(pQuest);
	}

	// 특정 포지션 완료 미션 검사
	CQuest* pQuest2 = g_pQuestData->FindPosCompleteQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest2)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
		//g_pGameMain->m_pMissionInfo->SetPosMissionComplete(TRUE);
		g_pGameMain->SetMissionPosMissionComplete(TRUE);
	}

	// 2007-12-27 by bhsohn 게임 시작에 관련 부분 수정
	// 2005-03-28 by jschoi - 게임 시작 시 바디컨디션 체크 추가
//	if(	COMPARE_BODYCON_BIT(g_pShuttleChild->m_myShuttleInfo.BodyCondition,BODYCON_DEAD_MASK) )
//	{
//		if( !COMPARE_BODYCON_BIT(g_pShuttleChild->GetCurrentBodyCondition(),BODYCON_EXPLOSION_MASK) )
//		{
//			g_pShuttleChild->m_myShuttleInfo.CurrentHP = 0.0f;
//			g_pShuttleChild->m_pOrderTarget = NULL;
//			g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_EXPLOSION_MASK);
//			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, FALSE );
//			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, FALSE );
//			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, TRUE );
//			g_pShuttleChild->ChangeUnitStateDead();
//			g_pShuttleChild->m_fCurrentTime = 186.0f;
//		}	
//	}
	// end 2007-12-27 by bhsohn 게임 시작에 관련 부분 수정

	// 2007-07-11 by bhsohn omi 체크섬 추가
	SendOMICheckSum();

	// 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	SendInterfaceCheckSum();
	// end 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	
	SendAtmCheckSum();	// 2008-09-17 by bhsohn 게임 실행파일명 체크섬 추가

	SendQuestCheckSum();	// 2008-11-11 by bhsohn 퀘스트 CheckSum추가

	// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
	// 서버에 해피 아워 정보요청
	RequestHappyHourInfo();
	// 2007-11-28 by dgwoo 최초 접속시 받을 메시지가 있는지 서버로 요청.
	// 2008-02-17 by bhsohn 맵로딩이 완료 하여지만 게임 정보를 받을수 있는 상태이다.
	// 여기서 요청하지 안는다.
	//RequestNotifyMsg();	  

	// 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
	// 2009-01-12 by bhsohn Japan Working
#ifdef IS_USE_ONOFF_IME
//#ifdef LANGUAGE_CHINA
	// IME종료는 Main쓰레드에서함
	g_pD3dApp->m_inputkey.EnableIMEControl(FALSE);
#endif
	// end 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
	
	// 2007-11-22 by bhsohn 아레나 통합서버
	// 메인서버 ClientIndex 저장
	SetMFSMyShuttleInfo(&m_pShuttleChild->m_myShuttleInfo);
	// end 2007-11-22 by bhsohn 아레나 통합서버

	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	SetGameStartOkInfo(pMsg);	
	// end 2008-08-11 by bhsohn 단독으로 실행 되게끔

	// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
#if defined( DEFINE_USE_GAMEGUARD_APEX )
	StartApexClient();
#endif
	// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업

	// 2008-12-23 by bhsohn 조이스틱 추가 요청 처리
	CJoyStickInput *pJoyStickInput = GetJoystickControl();
	if(pJoyStickInput && IsUseJoyStick())
	{
		char chBufTmp[256];
		memset(chBufTmp, 0x00, 256);
		wsprintf(chBufTmp, STRMSG_C_081223_0201);//"\\y컨트롤러가 설정된 상태에서 마우스를 사용하기 위해서는 기어가 정지상태가 되어야 합니다."
		g_pD3dApp->m_pChat->CreateChatChild(chBufTmp,COLOR_SYSTEM);	
	}
	// end 2008-12-23 by bhsohn 조이스틱 추가 요청 처리

	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	{
		//
		m_pInterface->m_pMapLoad->MapLoadComplete();

//		m_pInterface->InitMapLoadObjects();
//		m_pInterface->RestoreMapLoadObjects();
        // 2010. 10. 05 by jskim 맵로딩 구조 변경
		//SAFE_DELETE(m_pMapInitThread );
		//m_pMapInitThread = new CMapInitThread();
		//m_pMapInitThread->CreateThread();
        m_pMaploading->SetMapStep(_MAP_LOADING_STEP1);
		// end 2010. 10. 05 by jskim 맵로딩 구조 변경
	}
	// end 2007-11-20 by bhsohn 맵로딩 하는 방식 변경


	g_cCustomOptimizer.InitOptionSeting();
// 2012. 01. 04 by jskim 월드 랭킹 버그 수정
	// 2009-02-13 by bhsohn 월드 랭킹 시스템
	{
		CWorldRankManager*	pWorldRankManager = g_pD3dApp->GetWorldRankManager();
		pWorldRankManager->RqInitWorldRank();
		pWorldRankManager->InitMyRankInfo();			// 2014-05-26 by ssjung 나의 랭킹 정보 요청 수정
	}
	// end 2009-02-13 by bhsohn 월드 랭킹 시스템
// end 2012. 01. 04 by jskim 월드 랭킹 버그 수정

	// 2012-12-21 by bhsohn 베트남 게임 종료 안되는 문제 해결
	g_pD3dApp->SetClientLogOff(FALSE);
	// END 2012-12-21 by bhsohn 베트남 게임 종료 안되는 문제 해결
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
/// \date		2007-11-20 ~ 2007-11-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::InitOnlyGameStartOk(AVECTOR3 vPos, BitFlag16_t MapWeather, BOOL bArenaRestart)
{
	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	{
		m_bInitFlag = TRUE;		// 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정
		m_bGameStartInfo = TRUE;
		m_struGameStartInfo.vPos = vPos;
		m_struGameStartInfo.MapWeather = MapWeather;
	}
	// end 2007-11-20 by bhsohn 맵로딩 하는 방식 변경

	FLOG("CAtumApplication::InitOnlyGameStartOk(AVECTOR3 vPos, BitFlag16_t MapWeather)");	
	g_pD3dDev->EvictManagedResources();
	
	DeleteEffectList();
	
	m_pCharacterChild->m_vPos = m_pShuttleChild->m_vPos = A2DX(vPos);
	m_vClientOldPos = m_pShuttleChild->m_vPos;
	m_pShuttleChild->m_myShuttleInfo.PositionVector = A2DX(vPos);//by dhkwon 2002.12.16
		
	m_dwSpeedHackTimer = 0;
	m_dwHackCheckTime = 0;	// 2005-12-21 by ispark
	m_dwMoveCheckTime = 0;	// 2006-01-10 by ispark

	if(m_pInterface)
	{
		// 2007-11-22 by bhsohn 아레나 통합서버
		if(FALSE == bArenaRestart)
		{
			m_pInterface->InvalidateSelectObjects();
		}
		m_pInterface->InitGameObjects();
		m_pInterface->RestoreGameObjects();

		// 2008-02-27 by bhsohn 아레나 이동시 채팅정보 뺵업
		if(bArenaRestart)
		{			
			// 채팅창 정보를 갱신
			m_pInterface->RefreshChatInfo();
		}
		// end 2008-02-27 by bhsohn 아레나 이동시 채팅정보 뺵업
		
		m_pInterface->InitCityObjects();
		m_pInterface->RestoreCityObjects();

		m_pShuttleChild->m_fNextHP = m_pShuttleChild->m_myShuttleInfo.CurrentHP;
		m_pShuttleChild->m_fNextEP = m_pShuttleChild->m_myShuttleInfo.CurrentEP;
		m_pShuttleChild->m_fNextSP = m_pShuttleChild->m_myShuttleInfo.CurrentSP;
		m_pShuttleChild->m_fNextDP = m_pShuttleChild->m_myShuttleInfo.CurrentDP;
		
		if(g_pGameMain->m_pUnitInfoBar)
		{
			g_pGameMain->m_pUnitInfoBar->UpdateAllGage();
		}		
		// 2007-11-22 by bhsohn 아레나 통합서버
		m_pInterface->LoadCharacterFile(bArenaRestart);
	}	
		
//	m_pInterface->InvalidateMapLoadObjects();
//	m_pInterface->DeleteMapLoadObjects();
	m_pShuttleChild->SetShuttleData(0);
		
	m_pShuttleChild->InitMissileWarning();

	// 2009-02-02 by bhsohn 옵션에서 1인칭 시점으로 시작 안되는 버그 수정
	//m_pCamera->SetCamType(CAMERA_TYPE_NORMAL);
	m_pCamera->SetCamType( g_pSOption->sEyePt );
	
	// 2007-11-22 by bhsohn 아레나 통합서버
	//if(FALSE == bArenaRestart)
	{
		char buf[256];
		//////////////////////////////////////////////////////////////////////
		// EXEFile param1 param2 param3 param4 param5 param6
		//   param1 : VoIP Agent WindowText  <== ex> ACEonlineVoIP_R
		//   param2 : VoIP Client WindowText <== ex> ACEonline_R
		//   param3 : PCCallAgent IP
		//   param4 : PCCallAgent Port
		//   param5 : VDServer IP
		//   param6 : VDServer Port
		wsprintf(buf,".\\Res-VoIP\\SCVoIP.exe %s %s %s %d %s %d",
			WINDOWTEXT_NAME_VOIP,
			WINDOWTEXT_NAME_CLIENT,
			m_VOIPState.szVoIP1to1ServerIP, m_VOIPState.nVoIP1to1ServerPort,
			m_VOIPState.szVoIPNtoNServerIP, m_VOIPState.nVoIPNtoNServerPort );
		DBGOUT( "******VOIP[%s]******\n", buf );
		WinExec( buf, SW_HIDE );
		DBGOUT( "********************\n" );
	}	
	
	
	// 초보퀘스트 진행 했는지 체크	
	// 길드 정보 요청
	// 2008-04-08 by bhsohn 팅기는 문제
	//if(m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber != 0 && m_bReadyToGetGuildInfo)
	if(m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber != 0 && m_bReadyToGetGuildInfo && !bArenaRestart)
	{
		MSG_IC_GUILD_GET_GUILD_INFO sMsg;
		sMsg.GuildUniqueNumber = m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber;
		m_pIMSocket->SendMsg( T_IC_GUILD_GET_GUILD_INFO, (char*)&sMsg, sizeof(sMsg));
		DBGOUT("Request T_IC_GUILD_GET_GUILD_INFO in GAME_START_OK \n");
	}
	
	////////////////////////////////////////////////////////////////////////////////////
	// 친구, 거부 리스트 요청
	DBGOUT("---------- FriendList RejectList Loading ----------\n");
	g_pIMSocket->WriteMessageType(T_IC_CHAT_FRIENDLIST_AND_REJECTLIST_LOADING);
	
	// 초보 도우미 시작
	DBGOUT("---------- Help system ----------\n");
	g_pGameMain->InitHelpSystem(TRUE);
	// 2004-11-15 by jschoi
	DBGOUT("---------- SpeedHackTimer ----------\n");
	InitSpeedHackTimer();		// 스피드핵타이머 초기화
		
	//g_pInterface->m_pMapLoad->SendServerMapLoad();
	
	// 2006-07-05 by ispark, 프리미엄 개념 변경
	DBGOUT("---------- PrimiumCard Check ----------\n");
	if(GetPrimiumCardInfo()->nCardItemNum1)
	{
		m_pChat->CreateChatChild(STRMSG_C_CARD_0010,COLOR_ERROR);//"멤버쉽 서비스 계정입니다."
		char buf[MAX_PATH];
		wsprintf(buf,STRMSG_C_CARD_0011,GetPrimiumCardInfo()->atumTimeExpireTime1.GetLocalDateTimeString(string(),GetLanguageType(),TRUE));	//"만료시간 : %s"
		m_pChat->CreateChatChild(buf,COLOR_ERROR);
	}
	
	DBGOUT("---------- Set Render MapNameImg ----------\n");
	g_pInterface->m_pMapLoad->SetRenderMapNameImg(TRUE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
/// \date		2007-11-20 ~ 2007-11-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::UpdateGameStartMapInfo()
{
	// 2008-01-24 by bhsohn 클라이언트 강제 종료 부분 보강
	// 맵로딩이 끝났으니 틱시간을 갱신해준다.
	// 맵로딩 시간이 오래 걸리는 PC는 마지막Tick과의 시간이 1분이 넘게 걸리는 피씨를 위해갱신한다.
	DBGOUT("CAtumApplication::UpdateGameStartMapInfo Update\n");
	m_dwLastestTickTime = timeGetTime();
	// end 2008-01-24 by bhsohn 클라이언트 강제 종료 부분 보강

	// 2008-11-06 by bhsohn 마우스 가두기 모드 보완
	RefreshMouseMode();

// 2012. 01. 04 by jskim 월드 랭킹 버그 수정
	if(FALSE == m_bGameStartInfo )
	{
		// 2009-02-13 by bhsohn 월드 랭킹 시스템
		{
			CWorldRankManager*	pWorldRankManager = g_pD3dApp->GetWorldRankManager();
			pWorldRankManager->RqInitWorldRank();
		}
		// end 2009-02-13 by bhsohn 월드 랭킹 시스템
		return;
	}
// end 2012. 01. 04 by jskim 월드 랭킹 버그 수정

	// 2007-11-22 by bhsohn 아레나 통합서버
	// 아레나 다음 Step으로
	int nOldArenaStep = NextStepArenaState();	
	// end 2007-11-22 by bhsohn 아레나 통합서버

	m_bGameStartInfo = FALSE;	
	
	if(m_pScene->m_byMapType == MAP_TYPE_CITY)
	{
		// 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
		//ChangeGameState(_CITY);		
		// 현재 내가 쓰레드에서 게임 상태를 변경할려고 한다.
		ChangeGameState(_CITY,TRUE);		
		// end 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결

		if(m_bCharacter)
		{
			m_pCharacterChild->InitCharacterData();
		}
		else
		{
			m_pShuttleChild->InitShuttleData();
		}
		SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, TRUE );
		m_pScene->m_byWeatherType = WEATHER_DEFAULT;
		m_pScene->SetupLights();
		
		SendFieldSocketCityGetBuildingList( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex );
				
		MSG_FC_MOVE_LANDING_DONE sMsg;
		sMsg.Position = MAP_TYPE_CITY_UNIT_POS;
		g_pFieldWinSocket->SendMsg( T_FC_MOVE_LANDING_DONE, (char*)&sMsg, sizeof(sMsg) );
		DBGOUT("T_FC_MOVE_LANDING_DONE\n");
		g_pShuttleChild->ChangeUnitState( _LANDED );
		g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_LANDED_MASK);
		// 2007-01-02 by bhsohn A기어 b+Enter로 멈춘 후, 착륙하면 안 움직여지는 현상 처리								
		if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
		{
			// A기어 라면 움직임 초기화
			m_pShuttleChild->InitUnitStop();
		}				
		// end 2007-01-02 by bhsohn A기어 b+Enter로 멈춘 후, 착륙하면 안 움직여지는 현상 처리
		
	}
	else
	{
		DBGOUT("---------- Change Game Start ----------\n");
		// 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
		//ChangeGameState(_GAME);
		// 현재 내가 쓰레드에서 게임 상태를 변경할려고 한다.

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		//ChangeGameState(_GAME, TRUE);

		// 인피니티 모드일 경우는 맵로딩을 바로 끝내지 않고 T_FC_INFINITY_ENTER에 오면 맵로딩을 종료한다
		if( !m_bInfinityMapload )
			ChangeGameState(_GAME, TRUE);
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

		// end 2008-01-18 by bhsohn 중국 클라이언트 죽는 문제 해결
		
		if(m_bCharacter)
		{
			m_pCharacterChild->InitCharacterData();
		}
		else
		{
			m_pShuttleChild->InitShuttleData();
		}
		SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, TRUE );
		//m_pScene->m_byWeatherType = MapWeather;
		m_pScene->m_byWeatherType = m_struGameStartInfo.MapWeather;
		m_pScene->m_bChangeWeather = TRUE;
		// 시네마
		if( g_pShuttleChild->InitCinemaCamera(PATTERN_CAMERA_GAME_START) == TRUE )
		{
			g_pShuttleChild->m_nEventType = EVENT_GAME_START;
			
			DBGOUT("---------- Change Warp Start ----------\n");
			g_pShuttleChild->ChangeUnitState( _WARP );
		}
	}
	
	{
		g_pInterface->m_pMapLoad->SendServerMapLoad();
	}

	// 2007-12-27 by bhsohn 게임 시작에 관련 부분 수정	
	if(	COMPARE_BODYCON_BIT(g_pShuttleChild->m_myShuttleInfo.BodyCondition,BODYCON_DEAD_MASK) )
	{
		if( !COMPARE_BODYCON_BIT(g_pShuttleChild->GetCurrentBodyCondition(),BODYCON_EXPLOSION_MASK) )
		{
			g_pShuttleChild->m_myShuttleInfo.CurrentHP = 0.0f;
			g_pShuttleChild->m_pOrderTarget = NULL;
			g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_EXPLOSION_MASK);
			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, FALSE );
			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, FALSE );
			g_pD3dApp->SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, TRUE );
			g_pShuttleChild->ChangeUnitStateDead();
			g_pShuttleChild->m_fCurrentTime = 186.0f;
		}	
	}
	// end 2007-12-27 by bhsohn 게임 시작에 관련 부분 수정

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	// 인피니티모드일 경우 맵 로딩을 바로 끝내지 않는다. T_FC_INFINITY_ENTER가 도착할때 까지 대기
	if( !m_bInfinityMapload )
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	// 맵객체 삭제	
	{
		m_pInterface->InvalidateMapLoadObjects();
		m_pInterface->DeleteMapLoadObjects();
	}	

	// 2009-02-05 by bhsohn 카메라 깨지는 현상 처리
	if(m_bCharacter)
	{
		// 캐릭터 모드일때 카메라 정보 초기화
		g_pCamera->SetCamDistance(CHARACTER_CAMERA_DISTANCE);		// 카메라와의 초기 거리
		g_pD3dApp->SetCamPosInit();
	}
	// end 2009-02-05 by bhsohn 카메라 깨지는 현상 처리

	// 2007-11-22 by bhsohn 아레나 통합서버
	switch(nOldArenaStep)
	{
	case ARENA_STATE_ARENA_LOAD_GAME_INFO:
		{
			
			SendFCArenaCharacterGameStart();

			// 현재는 아레나 처음 들어온 상태다.
			// 그러므로 워프 패턴이 동작시킨다.
			g_pShuttleChild->DeletePattern();
			g_pShuttleChild->PatternWarpOut(TRUE);	
		}
		break;
	case ARENA_STATE_ARENA_ARENA_TO_MAIN:
		{
			// 아레나 서버에서 메인 서버로 간다.
			SendFCCharacterGameStartFromArenaToMainServer();
		}
		break;
	}		
	
	
	// end 2007-11-22 by bhsohn 아레나 통합서버		  

	// 2008-02-17 by bhsohn 맵로딩이 완료 하여지만 게임 정보를 받을수 있는 상태이다.
	{
		// 맵로딩이 완료 되었다.
		RequestNotifyMsg();		
	}
// 2012. 01. 04 by jskim 월드 랭킹 버그 수정
	// 2009-02-13 by bhsohn 월드 랭킹 시스템
// 	{
// 		CWorldRankManager*	pWorldRankManager = g_pD3dApp->GetWorldRankManager();
// 		pWorldRankManager->RqInitWorldRank();
// 	}
// 	// end 2009-02-13 by bhsohn 월드 랭킹 시스템
// end 2012. 01. 04 by jskim 월드 랭킹 버그 수정

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	// 맵 로딩이 다 끝났을때 인피니티 튕긴 유저 재시작 메세지 박스 추가
	if( m_bAddInfinityRestartMessageBox )
	{
		g_pGameMain->m_pInfWindow->AddMsgBox( STRMSG_C_091103_0339, _Q_RETURN_TO_PROGRESS_INFINITY );
		m_bAddInfinityRestartMessageBox = FALSE;
	}
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
}

	
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::RequestHappyHourInfo()
/// \brief		// 서버에 해피 아워 정보요청 T_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO
/// \author		// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
/// \date		2007-11-01 ~ 2007-11-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::RequestHappyHourInfo()
{
	if(g_pGameMain && g_pGameMain->m_pUnitInfoBar)
	{
		// 해피 아워 정보 초기화
		g_pGameMain->m_pUnitInfoBar->InitHappyHourInfo();
	}	
	m_pFieldWinSocket->SendMsg(T_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO, NULL, 0);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::RequestNotifyMsg()
/// \brief		최초 접속시 받을 메시지가 있는지 서버로 부터 요청.
/// \author		dgwoo
/// \date		2007-11-28 ~ 2007-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::RequestNotifyMsg()
{
	m_pFieldWinSocket->SendMsg(T_FC_EVENT_NOTIFY_MSG_GET,NULL,0);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterConnectGameStartOk(MSG_FC_CHARACTER_CONNECT_GAMESTART_OK * pMsg)
/// \brief		MSG_FC_CHARACTER_CONNECT_GAMESTART_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterConnectGameStartOk(MSG_FC_CHARACTER_CONNECT_GAMESTART_OK * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterConnectGameStartOk(MSG_FC_CHARACTER_CONNECT_GAMESTART_OK * pMsg)");
	m_pShuttleChild->m_myShuttleInfo.ClientIndex = pMsg->ClientIndex;

	InitCharacterGameStartOk( pMsg->PositionVector, pMsg->MapWeather );
	DBGOUT("Field Server State : MSG_FC_CHARACTER_CONNECT_GAMESTART_OK, Init Game Information\n");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::InitCharacterGameStartOk(AVECTOR3 vPos, BitFlag16_t MapWeather)
/// \brief		FieldSocketCharacterGameStartOk, FieldSocketCharacterConnectGameStartOk함수 공통 부분
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	m_pShuttleChild->m_vPos세팅이 ChangeGameState(_CITY|_GAME이전에 실행해야 한다.rendering object선택)
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::InitCharacterGameStartOk(AVECTOR3 vPos, BitFlag16_t MapWeather)
{
	FLOG("CAtumApplication::InitCharacterGameStartOk(AVECTOR3 vPos, BitFlag16_t MapWeather)");
	// 2005-01-04 by jschoi
//	g_pD3dDev->ResourceManagerDiscardBytes(0);
	g_pD3dDev->EvictManagedResources();

	DeleteEffectList();
	// 2005-07-21 by ispark
	m_pCharacterChild->m_vPos = m_pShuttleChild->m_vPos = A2DX(vPos);
	m_vClientOldPos = m_pShuttleChild->m_vPos;
	m_pShuttleChild->m_myShuttleInfo.PositionVector = A2DX(vPos);//by dhkwon 2002.12.16

//	m_dwLastTickTime = GetTickCount();
	m_dwSpeedHackTimer = 0;
	m_dwHackCheckTime = 0;	// 2005-12-21 by ispark
	m_dwMoveCheckTime = 0;	// 2006-01-10 by ispark

//	m_pShuttleChild->InitShuttleData();
	m_pInterface->InvalidateMapLoadObjects();
	m_pInterface->DeleteMapLoadObjects();
	m_pShuttleChild->SetShuttleData(0);
//	m_pScene->SetShuttleLandState(m_pShuttleChild);

	// 2006-02-13 by ispark
	m_pShuttleChild->InitMissileWarning();
	m_pCamera->SetCamType(CAMERA_TYPE_NORMAL);

	char buf[256];
	//////////////////////////////////////////////////////////////////////
	// EXEFile param1 param2 param3 param4 param5 param6
	//   param1 : VoIP Agent WindowText  <== ex> ACEonlineVoIP_R
	//   param2 : VoIP Client WindowText <== ex> ACEonline_R
	//   param3 : PCCallAgent IP
	//   param4 : PCCallAgent Port
	//   param5 : VDServer IP
	//   param6 : VDServer Port
	wsprintf(buf,".\\Res-VoIP\\SCVoIP.exe %s %s %s %d %s %d",
		WINDOWTEXT_NAME_VOIP,
		WINDOWTEXT_NAME_CLIENT,
		m_VOIPState.szVoIP1to1ServerIP, m_VOIPState.nVoIP1to1ServerPort,
		m_VOIPState.szVoIPNtoNServerIP, m_VOIPState.nVoIPNtoNServerPort );
	DBGOUT( "******VOIP[%s]******\n", buf );
	WinExec( buf, SW_HIDE );
	DBGOUT( "********************\n" );
	if(m_pInterface)
	{
		m_pInterface->InvalidateSelectObjects();
		m_pInterface->InitGameObjects();
		m_pInterface->RestoreGameObjects();
//		if( m_pScene->m_byMapType == MAP_TYPE_CITY )
//		{
			m_pInterface->InitCityObjects();
			m_pInterface->RestoreCityObjects();
//		}
		m_pShuttleChild->m_fNextHP = m_pShuttleChild->m_myShuttleInfo.CurrentHP;
		m_pShuttleChild->m_fNextEP = m_pShuttleChild->m_myShuttleInfo.CurrentEP;
		m_pShuttleChild->m_fNextSP = m_pShuttleChild->m_myShuttleInfo.CurrentSP;
		m_pShuttleChild->m_fNextDP = m_pShuttleChild->m_myShuttleInfo.CurrentDP;

		if(g_pGameMain->m_pUnitInfoBar)
		{
			g_pGameMain->m_pUnitInfoBar->UpdateAllGage();
		}

		// 2007-11-22 by bhsohn 아레나 통합서버
		m_pInterface->LoadCharacterFile(TRUE);
	}
	if(m_pScene->m_byMapType == MAP_TYPE_CITY)
	{
		ChangeGameState(_CITY);
		// 2005-07-21 by ispark
		if(m_bCharacter)
		{
			m_pCharacterChild->InitCharacterData();
		}
		else
		{
	         m_pShuttleChild->InitShuttleData();
		}
		SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, TRUE );
		m_pScene->m_byWeatherType = WEATHER_DEFAULT;
		m_pScene->SetupLights();
//		m_pScene->m_bChangeWeather = TRUE;
		SendFieldSocketCityGetBuildingList( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex );
//		if (g_pShuttleChild->InitCinemaUnit(PATTERN_UNIT_CITY_IN) == TRUE) // 게임 시작시 도시에서 착륙 패턴 보여줌
//		{
//			m_pSound->PlayD3DSound( SOUND_LANDING_IN_CITY, g_pShuttleChild->m_vPos );
//			g_pShuttleChild->ChangeUnitState( _LANDING );
//			g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_LANDING_MASK);
//			CAppEffectData * pEffect = new CAppEffectData(RC_EFF_LANDING_TAKEOFF,MAP_TYPE_CITY_UNIT_POS);
//			m_pEffectList->AddChild(pEffect);
//		}
//		else
//		{

			MSG_FC_MOVE_LANDING_DONE sMsg;
			sMsg.Position = MAP_TYPE_CITY_UNIT_POS;
			g_pFieldWinSocket->SendMsg( T_FC_MOVE_LANDING_DONE, (char*)&sMsg, sizeof(sMsg) );
			DBGOUT("T_FC_MOVE_LANDING_DONE\n");
			g_pShuttleChild->ChangeUnitState( _LANDED );
			g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_LANDED_MASK);
			// 2007-01-02 by bhsohn A기어 b+Enter로 멈춘 후, 착륙하면 안 움직여지는 현상 처리								
			if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
			{
				// A기어 라면 움직임 초기화
				m_pShuttleChild->InitUnitStop();
			}				
			// end 2007-01-02 by bhsohn A기어 b+Enter로 멈춘 후, 착륙하면 안 움직여지는 현상 처리

//		}
	}
	else
	{
		DBGOUT("---------- Change Game Start ----------\n");
		ChangeGameState(_GAME);
		// 2005-07-21 by ispark
		if(m_bCharacter)
		{
			m_pCharacterChild->InitCharacterData();
		}
		else
		{
			m_pShuttleChild->InitShuttleData();
		}
		SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, TRUE );
		m_pScene->m_byWeatherType = MapWeather;
		m_pScene->m_bChangeWeather = TRUE;
		// 시네마
		if( g_pShuttleChild->InitCinemaCamera(PATTERN_CAMERA_GAME_START) == TRUE )
		{
			g_pShuttleChild->m_nEventType = EVENT_GAME_START;
//			g_pShuttleChild->m_bEventReady = TRUE;
//			g_pShuttleChild->m_fEventCheckTime = 2.0f;
			DBGOUT("---------- Change Warp Start ----------\n");
			g_pShuttleChild->ChangeUnitState( _WARP );
		}
	}

	// 초보퀘스트 진행 했는지 체크
//	if(m_pScene->m_byMapType == MAP_TYPE_TUTORIAL)
//		m_pShuttleChild->CheckBeginnerQuest();
	// 길드 정보 요청
	if(m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber != 0 && m_bReadyToGetGuildInfo)
	{
		MSG_IC_GUILD_GET_GUILD_INFO sMsg;
		sMsg.GuildUniqueNumber = m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber;
		m_pIMSocket->SendMsg( T_IC_GUILD_GET_GUILD_INFO, (char*)&sMsg, sizeof(sMsg));
		DBGOUT("Request T_IC_GUILD_GET_GUILD_INFO in GAME_START_OK \n");
	}

	////////////////////////////////////////////////////////////////////////////////////
	// 친구, 거부 리스트 요청
	DBGOUT("---------- FriendList RejectList Loading ----------\n");
	g_pIMSocket->WriteMessageType(T_IC_CHAT_FRIENDLIST_AND_REJECTLIST_LOADING);

	// 초보 도우미 시작
	DBGOUT("---------- Help system ----------\n");
	g_pGameMain->InitHelpSystem(TRUE);
	// 2004-11-15 by jschoi
	DBGOUT("---------- SpeedHackTimer ----------\n");
	InitSpeedHackTimer();		// 스피드핵타이머 초기화

	// 2007-04-05 by bhsohn 맵로드시, 체크섬 추가
	//g_pFieldWinSocket->WriteMessageType(T_FC_INFO_GET_CURRENT_MAP_INFO);
	g_pInterface->m_pMapLoad->SendServerMapLoad();

	// 2006-07-05 by ispark, 프리미엄 개념 변경
	DBGOUT("---------- PrimiumCard Check ----------\n");
	if(GetPrimiumCardInfo()->nCardItemNum1)
	{
		m_pChat->CreateChatChild(STRMSG_C_CARD_0010,COLOR_ERROR);//"멤버쉽 서비스 계정입니다."
		char buf[MAX_PATH];
		wsprintf(buf,STRMSG_C_CARD_0011,GetPrimiumCardInfo()->atumTimeExpireTime1.GetLocalDateTimeString(string(),GetLanguageType(),TRUE));	//"만료시간 : %s"
		m_pChat->CreateChatChild(buf,COLOR_ERROR);
	}
//	else if(GetPrimiumCardInfo()->nCardItemNum1 == ITEM_NUM_CASH_SUPER_PREMIUM_CARD )
//	{
//		m_pChat->CreateChatChild(STRMSG_C_CARD_0012,COLOR_ERROR);//"멤버쉽 서비스 계정입니다."
//		char buf[MAX_PATH];
//		wsprintf(buf,STRMSG_C_CARD_0011,GetPrimiumCardInfo()->atumTimeExpireTime1.GetDateTimeString(STRNBUF(SIZE_MAX_SQL_DATETIME_STRING),TRUE));	
//		m_pChat->CreateChatChild(buf,COLOR_ERROR);
//	}	
	DBGOUT("---------- Set Render MapNameImg ----------\n");
	g_pInterface->m_pMapLoad->SetRenderMapNameImg(TRUE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketCharacterGameEndOk(MSG_FC_CHARACTER_GAMEEND_OK * pMsg)
/// \brief		MSG_FC_CHARACTER_GAMEEND_OK
/// \author		dhkwon
/// \date		2004-03-17 ~ 2004-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
//VOID CAtumApplication::FieldSocketCharacterGameEndOk(MSG_FC_CHARACTER_GAMEEND_OK * pMsg)
VOID CAtumApplication::FieldSocketCharacterGameEndOk(UINT nSocketNotifyType, MSG_FC_CHARACTER_GAMEEND_OK * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGameEndOk(MSG_FC_CHARACTER_GAMEEND_OK * pMsg)");

	// 2007-11-22 by bhsohn 아레나 통합서버
	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();
	ClientIndex_t myClientIndex = pMainInfo->ClientIndex;	
	// 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
	if(WM_PACKET_ARENA_NOTIFY == nSocketNotifyType)
	{		
		// 아레나필드서버에서 게임 앤드가 왔다.
		CHARACTER*	pArenaCharacter = g_pD3dApp->GetArenaCharacterInfo();
		myClientIndex = pArenaCharacter->ClientIndex;
	}
	// end 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리

	//if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	if(pMsg->ClientIndex == myClientIndex)
	{
		// 2008-10-30 by bhsohn 게임 종료 페이드 아웃시 락시스템 적용
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock	
		// end 2008-10-30 by bhsohn 게임 종료 페이드 아웃시 락시스템 적용

		g_pD3dApp->m_bCharacter = FALSE;
		m_pQuestData->Init();
		if(m_pInterface )
		{
			g_pSelect->m_pSelectBack->ChangeMode(SELECT_MODE);
			m_pInterface->InvalidateCityObjects();
			m_pInterface->DeleteCityObjects();
			m_pInterface->InvalidateGameObjects();
			// 2007-11-22 by bhsohn 아레나 통합서버
			//m_pInterface->DeleteGameObjects();
			
			g_pDatabase->InvalidateDeviceObjects();
			m_pInterface->DeleteGameObjects(FALSE);
			g_pDatabase->DeleteGuildInfo();

			m_pImageList->DeleteDeviceObjects();
			m_pInterface->ResetMapNameList();
			if(!m_bClientQuit)
			{
				m_pInterface->RestoreSelectObjects();
				g_pSelect->GameEnd();
			}
		}
		// 2005-01-04 by jschoi
//		g_pD3dDev->ResourceManagerDiscardBytes(0);
		g_pD3dDev->EvictManagedResources();

		// 마인드 컨트롤 매크로 정보를 기록한다.
		// ShuttleChild(이)가 갖고 있는 아이템 정보를 서버로 전송하고 지운다.
		// ShuttleChild 지운다.
		if(m_pShuttleChild)
		{
//			g_pStoreData->SendFieldSocketItemIndexInfo();
			m_pShuttleChild->InvalidateDeviceObjects();
//			m_pShuttleChild->InvalidateChat();
			m_pShuttleChild->DeleteDeviceObjects();
			SAFE_DELETE(m_pShuttleChild);
		}
		// 2005-07-25 by ispark
		// 캐릭터
		if(m_pCharacterChild)
		{
			m_pCharacterChild->InvalidateDeviceObjects();
			m_pCharacterChild->DeleteDeviceObjects();
			SAFE_DELETE(m_pCharacterChild);
		}
		// Chat 을 지운다.
		CAtumNode* pChat = (CAtumNode *)m_pChat->m_pChild;
		while(pChat)
		{
			pChat->m_bUsing = FALSE;
			pChat = pChat->m_pNext;
		}
		m_pChat->Tick();
		// Effect(App의) 을 지운다.
		// Effect(ZEnableEffect) 을 지운다.
		m_pEffectRender->m_vecZEnableEffect.clear();
		
		EnterCriticalSection(&m_cs);
		m_pUnitRender->InvalidateDeviceObjects();
		m_pUnitRender->DeleteDeviceObjects();
		m_pUnitRender->InitDeviceObjects();
		m_pUnitRender->RestoreDeviceObjects();
		if(m_pScene)
		{
			m_pScene->InvalidateRes();
			m_pScene->DeleteRes();
		}
		DeleteEffectList();
		m_pEffectList->Tick();
		// 이펙트의 삭제는 신중해야 한다. 다른 유닛이나 
		// 몬스터의 장착정보가 레퍼런스로 가지고 
		// 있을 수 있기 때문이다.
		LeaveCriticalSection(&m_cs);
		if(!m_bClientQuit)
		{
			g_pSelect->m_pSelectBack->m_bInitEffectItem = false;
//			ChangeGameState(_SELECT); //  연출 FrameMove로 옮김
			m_pShuttleChild = new CShuttleChild();
			m_pShuttleChild->InitDeviceObjects();
//			m_pShuttleChild->RestoreChat();
			m_pShuttleChild->RestoreDeviceObjects();
			// 2005-07-25 by ispark
			// 캐릭터
			m_pCharacterChild = new CCharacterChild();
			m_pCharacterChild->InitDeviceObjects();
			m_pCharacterChild->RestoreDeviceObjects();
			
			// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
			//m_pInterface->m_pMapLoad->m_bLoginChat = IM_SERVER_STATE_NOT_LOGIN;
			m_pInterface->m_pMapLoad->SetLoginChatMode(IM_SERVER_STATE_NOT_LOGIN);
			DBGOUT("IM Server State : Change Not Ready --> Receive MSG_FC_CHARACTER_GAMEEND_OK, Move select Window, m_bLoginChat = IM_SERVER_STATE_NOT_LOGIN)\n");
		}
//		if(m_VOIPState.nVOIPState != _VOIP_NOTLOGIN)
//		{
			COPYDATASTRUCT	copyData;
			memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
			AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_CLIENT_END, 0);
			copyData.dwData = (DWORD)voIP;
//			copyData.dwData = MAKELONG(AV_MT_CLIENT_END, 0);
			copyData.lpData = NULL;
			copyData.cbData = 0;
			::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)GetHwnd(), (LPARAM)&copyData);
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
//		}

		CleanText();
		m_bReadyToGetGuildInfo = FALSE;
		// 2007-01-07 by bhsohn 길드 정보 동기화 문제 관련 처리
		m_bReadyFieldGameStartOk = FALSE;

		if(m_bClientQuit ) // 2004-06-07 by dhkwon 연출, WAITING->ENDGAME,SELECT
		{
			if(m_pStageEffect)
			{
				m_pStageEffect->SetEndWork(TRUE);
			}
		}
		else
		{
			ChangeGameState(_SELECT );

			// 2007-11-22 by bhsohn 아레나 통합서버
			// 셀렉트 화면으로 갈시 아레나 소켓과의 접속 종료
			CloseArenaSocket();
		}

	}
	else
	{
		// 타 캐릭터 처리
		if(pMsg->ClientIndex < 10000)
		{
			// 2007-06-13 by bhsohn 메모리 버그 디버깅
			// 랜더링 정보 
			m_pScene->DeleteRenderEnemy(pMsg->ClientIndex);

			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				if(	m_pShuttleChild &&
					m_pShuttleChild->m_pOrderTarget && 
					m_pShuttleChild->m_pOrderTarget == itEnemy->second)
					m_pShuttleChild->m_pOrderTarget = NULL;
				// 아이템중 이캐릭의 것들(더미류와 같은것)
				// 2006-08-03 by ispark, 상대편의 개인상점을 이용시 강제로 닫는다.
				if(m_pCharacterChild->m_ShopEnemyClientIndex == pMsg->ClientIndex)
				{
					m_pInterface->ReadyCloseBazaarShop(TRUE);
					m_pChat->CreateChatChild(STRMSG_C_060801_0000, COLOR_ERROR);	// "개인상점이 종료 되었습니다."
				}
				// 2007-04-03 by dgwoo 옵저버 모드시 종료된 유저처리.
				if(itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex == g_pShuttleChild->m_stObserve.ClientIndex)
				{
					g_pShuttleChild->ObserveCancelUpdateInfo();
					g_pShuttleChild->ObserveEnd();
				}
				m_pScene->DeleteFieldItemOfUnitData( itEnemy->second );
				m_pScene->DeleteToBlockData(itEnemy->second);
				// 2015-03-13 by jwLee EnemyData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
				itEnemy->second->InvalidateDeviceObjects();
				// end 2015-03-13 by jwLee EnemyData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
				// 2014-12-02 by jwLee 클라 메모리릭 관련 추가 및 수정
				itEnemy->second->DeleteDeviceObjects();
				// end 2014-12-02 by jwLee 클라 메모리릭 관련 추가 및 수정
				SAFE_DELETE(itEnemy->second);
				m_pScene->m_mapEnemyList.erase(itEnemy);
//				if(itEnemy->second->m_nPartyID == 0)
//				{
//					SAFE_DELETE(itEnemy->second);
//					m_pScene->m_mapEnemyList.erase(itEnemy);
//				}
//				else
//				{
//					itEnemy->second->m_bIsRender = FALSE;
////					itEnemy->second->m_infoParty.bPartyType = _PARTYRESTARTMEMBER;
//					itEnemy->second->m_infoCharacter.ClientIndex = INVALID_CLIENT_INDEX;
//					itEnemy->second->DeleteItemPoint();
//					ChangeEnemyIndexForParty(itEnemy->first,itEnemy->second);
//				}
			}
		}
		else
		{
			// 몬스터 처리
			CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->ClientIndex);
			if(itMonster != m_pScene->m_mapMonsterList.end())
			{
				m_pScene->DeleteToBlockData(itMonster->second);
//				if(m_pShuttleChild->m_pOrderTarget && m_pShuttleChild->m_pOrderTarget == itMonster->second)
//					m_pShuttleChild->m_pOrderTarget = NULL;
				// 2015-03-13 by jwLee MonsterData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
				itMonster->second->InvalidateDeviceObjects();
				itMonster->second->DeleteDeviceObjects();
				// end 2015-03-13 by jwLee MonsterData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
				SAFE_DELETE(itMonster->second);
				m_pScene->m_mapMonsterList.erase(itMonster);
			}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMoveOk( MSG_FC_MOVE_OK* pMsg)
/// \brief		MSG_FC_MOVE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveOk( MSG_FC_MOVE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMoveOk( MSG_FC_MOVE_OK* pMsg)");
#ifdef _DEBUG
	static int nMoveCount=0;
 	nMoveCount++;
	if(g_fMoveCountFrame>1.0f)
	{
		g_fMoveCountFrame = 0.0f;
		g_nMoveCountPerRate = nMoveCount;
		nMoveCount = 0;
	}
#endif // _DEBUG_endif
	if(m_dwGameState == _GAME || m_dwGameState == _SHOP)
	{
		if(m_pShuttleChild)
			m_pShuttleChild->CheckMove(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterMoveOk(MSG_FC_MONSTER_MOVE_OK* pMsg)
/// \brief		MSG_FC_MONSTER_MOVE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterMoveOk(MSG_FC_MONSTER_MOVE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterMoveOk(MSG_FC_MONSTER_MOVE_OK* pMsg)");
	if(!(m_dwGameState == _GAME || m_dwGameState == _SHOP))
	{
		return ;
	}
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->SetMonPosition(pMsg);
	}
	else
	{
		// 리스트에 없으면 클라이언트 정보 요청
//		if(!m_pShuttleChild->m_bGetOtherInfo)
//		{
//			DBGOUT("MONSTER[%d] MONSTER_MOVE_OK Distance[%d]\n",pMsg->ClientIndex,
//					(int)Distance3DTo2D(g_pShuttleChild->m_vPos, A2DX(pMsg->PositionVector)));
//			m_pShuttleChild->m_bGetOtherInfo = TRUE;
			m_pShuttleChild->m_fGetOtherInfoCheckTime = 0.5f;
			m_pShuttleChild->m_nGetOtherIndex = pMsg->MonsterIndex;

			// 2006-06-15 by ispark, 일정시간에 패킷을 보내는 것으로 변경
//			MSG_FC_CHARACTER_GET_OTHER_INFO sMsg;
//			memset(&sMsg,0x00,sizeof(sMsg));
//			sMsg.ClientIndex = pMsg->MonsterIndex;
//			m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_GET_OTHER_INFO, (char*)&sMsg, sizeof(sMsg) );
//		}
	
			SetClientIndexDataByVector(m_vecCharacterOtherInfo, pMsg->MonsterIndex);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendFieldSocketConnectLogin()
/// \brief		MSG_FC_CONNECT_LOGIN 전송
/// \author		dhkwon
/// \date		2004-06-03 ~ 2004-06-03
/// \warning	WS_CONNECT 후에 실행
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2007-11-22 by bhsohn 아레나 통합서버
//VOID CAtumApplication::SendFieldSocketConnectLogin()
VOID CAtumApplication::SendFieldSocketConnectLogin(CFieldWinSocket* pFieldSocket)
{
	MSG_FC_CONNECT_LOGIN sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	strcpy(sMsg.AccountName, m_strUserID);
	strcpy(sMsg.Password, m_strUserPassword);
	char	host[100];
	HOSTENT	*p;
	char	ip[SIZE_MAX_IPADDRESS];
	gethostname(host, 100);
	if(p = gethostbyname(host))
	{
		sprintf(ip, "%d.%d.%d.%d", (BYTE)p->h_addr_list[0][0], 
			(BYTE)p->h_addr_list[0][1], (BYTE)p->h_addr_list[0][2], (BYTE)p->h_addr_list[0][3]);
		strncpy(sMsg.PrivateIP, ip, SIZE_MAX_IPADDRESS);
	}	
#ifdef _DEBUG	

	// 2010. 01. 18 by ckPark 분당 사무실 IP추가
// 	if( strncmp(sMsg.PrivateIP, MASANG_PREFIX_IP1, 11) != 0 &&		// 2007-01-03 by dgwoo 회사이전(남부터미널)으로 아이피변경.
// 		strncmp(sMsg.PrivateIP, "210.93.214", 10) != 0 &&
// 		strncmp(sMsg.PrivateIP, "61.37.75.140", 12) != 0 &&
// 		strncmp(sMsg.PrivateIP, "211.215.163", 11) != 0 &&
// 		strncmp(sMsg.PrivateIP, "172.20.105", 10) != 0 &&
// 		strncmp(sMsg.PrivateIP, "172.20.2.117", 12) != 0 &&	// 2005-07-01 by ispark, 엠게임 IP추가
// 		strncmp(sMsg.PrivateIP, "203.252.180", 11) != 0)	// 2006-02-10 by ispark, 건대

	if( !IS_MASANG_IP( sMsg.PrivateIP ) )
	// end 2010. 01. 18 by ckPark 분당 사무실 IP추가
	{
		m_pFieldWinSocket->CloseSocket();
		NetworkErrorMsgBox( STRMSG_C_SERVER_0010 );//"프로그램 삭제 요망"
		return;
	}
#endif
	// 2007-11-22 by bhsohn 아레나 통합서버	
	//m_pFieldWinSocket->SendMsg(T_FC_CONNECT_LOGIN, (char*)&sMsg, sizeof(sMsg));
	CFieldWinSocket* pArenaFieldSocket = m_pFieldWinSocket->GetArenaFieldWinSocket();
	int nMsgType = T_FC_CONNECT_LOGIN;
	if(pArenaFieldSocket &&  pFieldSocket == pArenaFieldSocket)
	{
		SendArenaLoginOk();		
	}	
	else
	{
		m_pFieldWinSocket->SendMsg(nMsgType, (char*)&sMsg, sizeof(sMsg));
	}	
	
	
	DBGOUT("Send MSG_FC_CONNECT_LOGIN(%s, %s)\n", m_strUserID, sMsg.PrivateIP );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendFieldSocketCityGetBuildingList( MAP_CHANNEL_INDEX mapChannelIndex )
/// \brief		도시에 진입시 도시 상점 리스트를 요청한다.
/// \author		dhkwon
/// \date		2004-04-12 ~ 2004-04-12
/// \warning	게임시작시(InitCharacterGameStartOk), 워프완료시(CINFMapLoad::Tick())함수를 호출한다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::SendFieldSocketCityGetBuildingList( MAP_CHANNEL_INDEX mapChannelIndex )
{
	FLOG("CAtumApplication::SendFieldSocketCityGetBuildingList( MAP_CHANNEL_INDEX mapChannelIndex )");
	DBGOUT("Request City Shop List [index:%d][channel:%d]\n",mapChannelIndex.MapIndex, mapChannelIndex.ChannelIndex);
	MSG_FC_CITY_GET_BUILDING_LIST sMsg;
	sMsg.MapChannelIndex = mapChannelIndex;
	m_pFieldWinSocket->SendMsg( T_FC_CITY_GET_BUILDING_LIST, (char*)&sMsg, sizeof(sMsg) );

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendFieldSocketGetShopWarpTargetMapList( MAP_CHANNEL_INDEX mapChannelIndex )
/// \brief		도시 진입시 워프 리스트를 요청한다.
/// \author		dhkwon
/// \date		2004-04-12 ~ 2004-04-12
/// \warning	도시 상점 리스트를 받은 후 요청한다.(FieldSocketCityGetBuildingListOk)
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::SendFieldSocketGetShopWarpTargetMapList( MAP_CHANNEL_INDEX mapChannelIndex )
{
	FLOG("CAtumApplication::SendFieldSocketGetShopWarpTargetMapList( MAP_CHANNEL_INDEX mapChannelIndex )");
	DBGOUT("Request City Warp Target List [index:%d][channel:%d]\n",mapChannelIndex.MapIndex, mapChannelIndex.ChannelIndex);
	MSG_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST sMsg;
	sMsg.MapChannelIndex = mapChannelIndex;
	m_pFieldWinSocket->SendMsg( T_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST, (char*)&sMsg, sizeof(sMsg) );

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendFieldSocketChangeCharacterBodyCondition(BodyCond_t hySingleBodyCondition, BOOL bSet)
/// \brief		FieldSocketCharacterChangeCurrentHPDPSPEP,FieldSocketCharacterChangeCurrentHP에서 Bodycondition교체에 사용
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		BodyCond_t hySingleBodyCondition, BOOL bSet:TRUE면 바디컨디션이 발동하고, FALSE면 발동 정지한다.
///				가속 부스터인 경우 셋하면 안된다.
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::SendFieldSocketChangeCharacterBodyCondition(BodyCond_t hySingleBodyCondition, BOOL bSet)
{
	FLOG("CAtumApplication::SendFieldSocketChangeCharacterBodyCondition(BodyCond_t hySingleBodyCondition, BOOL bSet)");
	// [bSet=TRUE, COMPARE=FALSE : new] [bSet=FALSE, COMPARE=TRUE : delete]
	if(bSet == !COMPARE_BODYCON_BIT(m_pShuttleChild->GetCurrentBodyCondition(),hySingleBodyCondition))
	{
		MSG_FC_CHARACTER_CHANGE_BODYCONDITION sMsg;
		sMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex;
		sMsg.BodyCondition = bSet ? (hySingleBodyCondition|BODYCON_SET_OR_CLEAR_MASK) : hySingleBodyCondition;
		m_pShuttleChild->TurnSingleBodyCondition(hySingleBodyCondition, bSet);
		m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_CHANGE_BODYCONDITION, (char*)&sMsg, sizeof(sMsg) );
	}
}

VOID CAtumApplication::FieldSocketCharacterChangeStatus(MSG_FC_CHARACTER_CHANGE_STATUS* pMsg)
{
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		g_pShuttleChild->m_myShuttleInfo.Status = pMsg->Status;
		if(m_pEffectList)
		{
			CAppEffectData *pData = NULL;
			if(IS_BT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
				pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_BT,m_pShuttleChild->m_vPos);
			else if(IS_OT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
				pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_OT,m_pShuttleChild->m_vPos);
			else if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
				pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_DT,m_pShuttleChild->m_vPos);
			else if(IS_ST(m_pShuttleChild->m_myShuttleInfo.UnitKind))
				pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_ST,m_pShuttleChild->m_vPos);
			if(pData)
			{
				pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
			}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeHPDPSPEP(MSG_FC_CHARACTER_CHANGE_HPDPSPEP * pMsg)
/// \brief		레벨업시에 HP, DP, SP, EP 변화
/// \author		dhkwon
/// \date		2004-06-23 ~ 2004-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeHPDPSPEP(MSG_FC_CHARACTER_CHANGE_HPDPSPEP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentHPDPSPEP(MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	g_pShuttleChild->m_myShuttleInfo.HP = pMsg->HP;
	g_pShuttleChild->m_myShuttleInfo.DP = pMsg->DP;
	g_pShuttleChild->m_myShuttleInfo.SP = pMsg->SP;
	g_pShuttleChild->m_myShuttleInfo.EP = pMsg->EP;
	CharacterChangeCurrentHPAndDamageBodyCondition( pMsg->CurrentHP );
	CharacterChangeCurrentDP( pMsg->CurrentDP );
	CharacterChangeCurrentSP( pMsg->CurrentSP );
	CharacterChangeCurrentEP( pMsg->CurrentEP );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCurrentHPDPSPEP(MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCurrentHPDPSPEP(MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentHPDPSPEP(MSG_FC_CHARACTER_CHANGE_CURRENTHPDPSPEP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	CharacterChangeCurrentHPAndDamageBodyCondition( pMsg->CurrentHP );
	CharacterChangeCurrentDP( pMsg->CurrentDP );
	CharacterChangeCurrentSP( pMsg->CurrentSP );
	CharacterChangeCurrentEP( pMsg->CurrentEP );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCurrentHP(MSG_FC_CHARACTER_CHANGE_CURRENTHP * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CURRENTHP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCurrentHP(MSG_FC_CHARACTER_CHANGE_CURRENTHP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentHP(MSG_FC_CHARACTER_CHANGE_CURRENTHP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	CharacterChangeCurrentHPAndDamageBodyCondition(pMsg->CurrentHP);

	// 2010-06-15 by shcho&hslee 펫시스템 - 오퍼레이터 구현	
	if( g_pStoreData->FindItemInInventoryByWindowPos( POS_PET ) &&
		pMsg->CurrentHP / m_pShuttleChild->m_myShuttleInfo.HP < 
		g_pInterface->m_pINFOpMain->GetOpInfo()->GetOperatorAction(1,3)->spOperatorInfo->FunctionValue )
	{
		g_pInterface->m_pINFOpMain->GetOpInfo()->SetOperatorAction(1,3);
	}
	// end 2010-06-15 by shcho&hslee 펫시스템 - 오퍼레이터 구현
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::CharacterChangeCurrentHPAndDamageBodyCondition(float CurrentHP)
/// \brief		FieldSocketCharacterChangeCurrentHP,FieldSocketCharacterChangeCurrentHPDPSPEP함수에서 HP변경시 Bodycondition변경
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CharacterChangeCurrentHPAndDamageBodyCondition(float fCurrentHP)
{
	FLOG("CAtumApplication::CharacterChangeCurrentHPAndDamageBodyCondition(float CurrentHP)");
	if(m_pShuttleChild->m_myShuttleInfo.CurrentHP > fCurrentHP)
	{
		m_pShuttleChild->m_fShuttleSpeed *= 0.9f;
		m_pShuttleChild->m_myShuttleInfo.CurrentHP = fCurrentHP;
		m_pShuttleChild->m_fNextHP = fCurrentHP;
		m_pCamera->ChangeCamCollType();

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(FALSE);
	}
	else
	{
		m_pShuttleChild->m_fNextHP = fCurrentHP;
		m_pShuttleChild->m_fNextHPRate = m_pShuttleChild->m_fNextHP - m_pShuttleChild->m_myShuttleInfo.CurrentHP;

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(TRUE);
	}
//	if(m_pInterface->m_pGageBox)
//	{
//		m_pInterface->m_pGageBox->UpdateHPGage();
//	}
	if(g_pGameMain->m_pUnitInfoBar)
	{
		g_pGameMain->m_pUnitInfoBar->SetHP(m_pShuttleChild->m_myShuttleInfo.CurrentHP, (float)m_pShuttleChild->m_myShuttleInfo.HP);
	}
	// damage bodycondition 세팅
	if(m_pShuttleChild->m_fNextHP/m_pShuttleChild->m_myShuttleInfo.HP < CHARACTER_DAMAGE_STATE_05)
	{
		// 데미지 1,2,3번 모두 활성화
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, TRUE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, TRUE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, TRUE );
		g_pGameMain->m_pUnitState->InsertState(INF_UW_DANGER_MASK);
		if(m_bCharacter == FALSE)
			m_pSound->PlayD3DSound(SOUND_WARNING_HP, D3DXVECTOR3(0,0,0), FALSE);
	}
	else if(m_pShuttleChild->m_fNextHP/m_pShuttleChild->m_myShuttleInfo.HP < CHARACTER_DAMAGE_STATE_10)
	{
		// 데미지 1,2번 활성화
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, TRUE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, TRUE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, FALSE );
		g_pGameMain->m_pUnitState->InsertState(INF_UW_DANGER_MASK);
		if(m_bCharacter == FALSE)
			m_pSound->PlayD3DSound(SOUND_WARNING, D3DXVECTOR3(0,0,0), FALSE);
	}
	else if(m_pShuttleChild->m_fNextHP/m_pShuttleChild->m_myShuttleInfo.HP < CHARACTER_DAMAGE_STATE_15)
	{
		// 데미지 1번 활성화
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, TRUE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, FALSE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, FALSE );
		g_pGameMain->m_pUnitState->OffState(INF_UW_DANGER_MASK);
	}
	else
	{
		// 데미지 비활성화
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE1_MASK, FALSE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE2_MASK, FALSE );
		SendFieldSocketChangeCharacterBodyCondition( BODYCON_DAMAGE3_MASK, FALSE );
		g_pGameMain->m_pUnitState->OffState(INF_UW_DANGER_MASK);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::CharacterChangeCurrentDP(float CurrentDP)
/// \brief		FieldSocketCharacterChangeCurrentDP, FieldSocketCharacterChangeCurrentHPDPSPEP함수에서 SP변경시 사용
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CharacterChangeCurrentDP(float sCurrentDP)
{
	FLOG("CAtumApplication::CharacterChangeCurrentDP(float sCurrentDP)");
	if(m_pShuttleChild->m_myShuttleInfo.CurrentDP > sCurrentDP)
	{
		m_pShuttleChild->m_myShuttleInfo.CurrentDP = sCurrentDP;
		m_pShuttleChild->m_fNextDP = sCurrentDP;
//		m_pCamera->ChangeCamCollType();

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(FALSE);	
	}
	else
	{
		m_pShuttleChild->m_fNextDP = sCurrentDP;
		m_pShuttleChild->m_fNextDPRate = m_pShuttleChild->m_fNextDP - m_pShuttleChild->m_myShuttleInfo.CurrentDP;

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(TRUE);	
	}
	if(sCurrentDP > 0)
	{
		g_pGameMain->m_pUnitState->OffState(INF_UW_LOWSHIELD_MASK);
		m_pShuttleChild->m_bShielding = TRUE;
	}
	else
	{
		g_pGameMain->m_pUnitState->InsertState(INF_UW_LOWSHIELD_MASK);
		m_pShuttleChild->m_bShielding = FALSE;
	}
	if(g_pGameMain->m_pUnitInfoBar)
	{
		g_pGameMain->m_pUnitInfoBar->SetDP( m_pShuttleChild->m_myShuttleInfo.CurrentDP, (float)m_pShuttleChild->m_myShuttleInfo.DP );
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCurrentDP(MSG_FC_CHARACTER_CHANGE_CURRENTDP * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CURRENTDP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCurrentDP(MSG_FC_CHARACTER_CHANGE_CURRENTDP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentDP(MSG_FC_CHARACTER_CHANGE_CURRENTDP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	CharacterChangeCurrentDP(pMsg->CurrentDP);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::CharacterChangeCurrentSP(SHORT CurrentSP)
/// \brief		FieldSocketCharacterChangeCurrentSP, FieldSocketCharacterChangeCurrentHPDPSPEP함수에서 SP변경시 사용
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CharacterChangeCurrentSP(SHORT sCurrentSP)
{
	FLOG("CAtumApplication::CharacterChangeCurrentSP(SHORT sCurrentSP)");
	if(m_pShuttleChild->m_myShuttleInfo.CurrentSP > sCurrentSP)
	{
		m_pShuttleChild->m_myShuttleInfo.CurrentSP = sCurrentSP;
		m_pShuttleChild->m_fNextSP = sCurrentSP;

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(FALSE);	
	}
	else
	{
		m_pShuttleChild->m_fNextSP = sCurrentSP;
		m_pShuttleChild->m_fNextSPRate = m_pShuttleChild->m_fNextSP - m_pShuttleChild->m_myShuttleInfo.CurrentSP;

		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(TRUE);	
	}
	if(g_pGameMain->m_pUnitInfoBar)
	{
		g_pGameMain->m_pUnitInfoBar->SetSP((float)m_pShuttleChild->m_myShuttleInfo.CurrentSP, (float)m_pShuttleChild->m_myShuttleInfo.SP);
	}
	if(sCurrentSP <= 0)
	{ // SP가 부족하여 토글스킬을 해제한다. // 2004-10-08 by jschoi
		m_pShuttleChild->m_pSkill->ReleaseAllUsingToggleSkill();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCurrentSP(MSG_FC_CHARACTER_CHANGE_CURRENTSP * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CURRENTSP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCurrentSP(MSG_FC_CHARACTER_CHANGE_CURRENTSP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentSP(MSG_FC_CHARACTER_CHANGE_CURRENTSP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	CharacterChangeCurrentSP(pMsg->CurrentSP);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::CharacterChangeCurrentEP(float fCurrentEP)
/// \brief		CharacterChangeCurrentEP, FieldSocketCharacterChangeCurrentHPDPSPEP함수에서 EP변경시 사용
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
/////////////////////////////////////////////////////////////////////////////// 
VOID CAtumApplication::CharacterChangeCurrentEP(float fCurrentEP)
{
	FLOG("CAtumApplication::CharacterChangeCurrentEP(float fCurrentEP)");
	if(m_pShuttleChild->m_myShuttleInfo.CurrentEP > fCurrentEP)
	{
		m_pShuttleChild->m_myShuttleInfo.CurrentEP = fCurrentEP;
		m_pShuttleChild->m_fNextEP = fCurrentEP;
		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(FALSE);	
	}
	else
	{
		m_pShuttleChild->m_fNextEP = fCurrentEP;
		m_pShuttleChild->m_fNextEPRate = m_pShuttleChild->m_fNextEP - m_pShuttleChild->m_myShuttleInfo.CurrentEP;
		// 2005-11-08 by ispark
		// 보급 상점에 데이타 갱신
		g_pInterface->m_pCityBase->RecvRequestRepair(TRUE);	
	}
	if(g_pGameMain->m_pUnitInfoBar)
	{
		g_pGameMain->m_pUnitInfoBar->SetEP(m_pShuttleChild->m_myShuttleInfo.CurrentEP, (float)m_pShuttleChild->m_myShuttleInfo.EP);
	}
	// damage bodycondition 세팅
	if(m_pShuttleChild->m_fNextEP/m_pShuttleChild->m_myShuttleInfo.EP < CHARACTER_LOWFUEL_STATE)
	{
		g_pGameMain->m_pUnitState->InsertState(INF_UW_LOWFUEL_MASK);
	}
	else
	{
		g_pGameMain->m_pUnitState->OffState(INF_UW_LOWFUEL_MASK);
	}

	// 2005-12-30 by ispark, 데미지 바디컨디션 상태 체크
	g_pShuttleChild->CheckDamageBodyCondition();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCurrentEP(MSG_FC_CHARACTER_CHANGE_CURRENTEP * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CURRENTEP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCurrentEP(MSG_FC_CHARACTER_CHANGE_CURRENTEP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeCurrentEP(MSG_FC_CHARACTER_CHANGE_CURRENTEP * pMsg)");
	ASSERT_ASSERT(m_pShuttleChild && pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex);
	CharacterChangeCurrentEP(pMsg->CurrentEP);

	// 2010-06-15 by shcho&hslee 펫시스템 - 오퍼레이터 구현	
	if(((float)m_pShuttleChild->m_myShuttleInfo.CurrentEP / (float)m_pShuttleChild->m_myShuttleInfo.EP ) <= 
	g_pInterface->m_pINFOpMain->GetOpInfo()->GetOperatorAction(1,1)->spOperatorInfo->FunctionValue )
	{
		g_pInterface->m_pINFOpMain->GetOpInfo()->SetOperatorAction(1,1);
	}
	// end 2010-06-15 by shcho&hslee 펫시스템 - 오퍼레이터 구현
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeBodycondition(MSG_FC_CHARACTER_CHANGE_BODYCONDITION * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_BODYCONDITION
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeBodycondition(MSG_FC_CHARACTER_CHANGE_BODYCONDITION * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeBodycondition(MSG_FC_CHARACTER_CHANGE_BODYCONDITION * pMsg)");
  	if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pShuttleChild->ChangeBodyConditionFromServer( pMsg->BodyCondition );
	}
	else if(pMsg->ClientIndex < 10000)
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			BodyCond_t oldBodyCondition = ((CEnemyData*)itEnemy->second)->GetCurrentBodyCondition();
			itEnemy->second->ChangeBodyConditionFromServer( pMsg->BodyCondition );
			// 2007-03-20 by dgwoo 옵저버 모드(다른기어의 부스터 이펙트를 삭제 및 생성)
			//--------------------------------------------------------------------------//
			if(g_pShuttleChild->IsObserverMode()
				&& g_pShuttleChild->m_stObserve.ClientIndex == itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex)
			{
				DbgOut("BodyCondition = %x\n",pMsg->BodyCondition);
				if(!COMPARE_BODYCON_BIT(oldBodyCondition,BODYCON_BOOSTER3_MASK) &&
					COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_BOOSTER3_MASK) &&
					!COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_DEAD_MASK))
				{
					// 스크린 이펙트
					if(g_pD3dApp->m_pEffectList)
					{
						CAppEffectData* pEffect = g_pScene->FindEffect( RC_EFF_BOOSTER );
						if(pEffect == NULL)
						{
							pEffect = new CAppEffectData(g_pCamera,RC_EFF_BOOSTER,100);
							g_pD3dApp->m_pEffectList->AddChild(pEffect);
						}
					}
				}
				// 2007-03-28 by dgwoo 부스터 이펙트가 남는 버그.
//				else if((COMPARE_BODYCON_BIT(oldBodyCondition,BODYCON_BOOSTER3_MASK) &&
//					!COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_BOOSTER3_MASK)) ||
//					COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_DEAD_MASK))
					else if(!COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_BOOSTER3_MASK)
						|| COMPARE_BODYCON_BIT(pMsg->BodyCondition,BODYCON_DEAD_MASK))
				{
					// 스크린 이펙트
					if(g_pD3dApp->m_pEffectList)
					{
						CAppEffectData* pEffect = g_pScene->FindEffect( RC_EFF_BOOSTER );
						if(pEffect != NULL)
						{
							pEffect->ChangeBodyCondition(BODYCON_LANDED_MASK); // BODYCON_BOOSTER_OFF
						}
					}
				}
			}
			//--------------------------------------------------------------------------//
			
		}
	}
	else
	{
		CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->ClientIndex);
		if(itMonster != m_pScene->m_mapMonsterList.end())
		{
			itMonster->second->ChangeBodyConditionFromServer(pMsg->BodyCondition);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeUnitkind(MSG_FC_CHARACTER_CHANGE_UNITKIND * pMsg)
/// \brief		
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeUnitkind(MSG_FC_CHARACTER_CHANGE_UNITKIND * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeUnitkind(MSG_FC_CHARACTER_CHANGE_UNITKIND * pMsg)");
	CAppEffectData * pData = NULL;
	D3DXVECTOR3 vPos = D3DXVECTOR3(0,1,0);
	if(m_pShuttleChild)
	{
		if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			if(pMsg->UnitKind != m_pShuttleChild->m_myShuttleInfo.UnitKind)
			{
				// Effect 추가 할것
				m_pShuttleChild->m_myShuttleInfo.UnitKind = pMsg->UnitKind;
				if(m_pEffectList)
				{
					if(IS_BT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
						pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_BT,vPos);
					else if(IS_OT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
						pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_OT,vPos);
					else if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
						pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_DT,vPos);
					else if(IS_ST(m_pShuttleChild->m_myShuttleInfo.UnitKind))
						pData = new CAppEffectData(m_pShuttleChild,RC_EFF_LEVELUP_ST,vPos);
					if(pData)
					{
						pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
					}
				}
//				if(m_pShuttleChild->m_pCharacterInfo)
///				{
//					m_pShuttleChild->m_pCharacterInfo->InvalidateDeviceObjects();
//					m_pShuttleChild->m_pCharacterInfo->DeleteDeviceObjects();
//					SAFE_DELETE(m_pShuttleChild->m_pCharacterInfo);
//					char strFileName[128];
//					wsprintf( strFileName, "1%d00%02d00", m_bDegree,
//						m_pShuttleRender->GetRenderType(m_pShuttleChild->m_myShuttleInfo.UnitKind));
//					m_pShuttleChild->LoadCharacterEffect(strFileName);
//					if(m_pShuttleChild->m_pCharacterInfo)
//					{
//						m_pShuttleChild->m_pCharacterInfo->SetAllBodyConditionMatrix(m_pShuttleChild->m_mMatrix);
//						m_pShuttleChild->m_pCharacterInfo->SetBodyCondition(m_pShuttleChild->m_myShuttleInfo.BodyCondition);
//					}
//				}
			}
		}
		else
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				if(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind != pMsg->UnitKind)
				{
					itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind = pMsg->UnitKind;
					// Effect 추가 할것
					if(m_pEffectList)
					{
						if(IS_BT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
							pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_BT,vPos);
						else if(IS_OT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
							pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_OT,vPos);
						else if(IS_DT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
							pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_DT,vPos);
						else if(IS_ST(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
							pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_ST,vPos);
						if(pData)
						{
							pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
						}
					}
//					if(itEnemy->second->m_pCharacterInfo)
//					{
//						itEnemy->second->m_pCharacterInfo->InvalidateDeviceObjects();
//						itEnemy->second->m_pCharacterInfo->DeleteDeviceObjects();
//						SAFE_DELETE(itEnemy->second->m_pCharacterInfo);
//						char strFileName[128];
//						wsprintf( strFileName, "1%d00%02d00", m_bDegree,m_pShuttleRender->GetRenderType(itEnemy->second->m_infoCharacter.UnitKind));
//						itEnemy->second->LoadCharacterEffect(strFileName);
//						if(itEnemy->second->m_pCharacterInfo)
//						{
//							itEnemy->second->m_pCharacterInfo->SetAllBodyConditionMatrix(itEnemy->second->m_mMatrix);
//							itEnemy->second->m_pCharacterInfo->SetBodyCondition(itEnemy->second->m_infoCharacter.BodyCondition);
//						}
//					}
				}
			}
		}
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangePropensity(MSG_FC_CHARACTER_CHANGE_PROPENSITY* pMsg)
/// \brief		명성치 깍임
/// \author		ispark
/// \date		2005-08-22 ~ 2005-08-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangePropensity(MSG_FC_CHARACTER_CHANGE_PROPENSITY* pMsg)
{
	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		if(pMsg->byUpdateType == IUT_PENALTY_ON_DEAD)
		{
			char Fame[128];
			wsprintf(Fame, STRMSG_C_050822_0100, m_pShuttleChild->m_myShuttleInfo.Propensity - pMsg->Propensity);
			m_pChat->CreateChatChild(Fame, COLOR_SYSTEM); 
			m_pShuttleChild->m_myShuttleInfo.Propensity = pMsg->Propensity;
		}
		else if(pMsg->byUpdateType == IUT_PENALTY_AGEAR_FUEL_ALLIN)
		{
			char Fame[128];
			wsprintf(Fame, STRMSG_C_050822_0100, m_pShuttleChild->m_myShuttleInfo.Propensity - pMsg->Propensity);
			m_pChat->CreateChatChild(Fame, COLOR_SYSTEM); 
			m_pShuttleChild->m_myShuttleInfo.Propensity = pMsg->Propensity;
		}

	}
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyCreateOk(MSG_FC_PARTY_CREATE_OK* pMsg)
/// \brief		MSG_FC_PARTY_CREATE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyCreateOk(MSG_FC_PARTY_CREATE_OK* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyCreateOk(pMsg);

	// 2008-04-04 by bhsohn Ep3 커뮤니티 창	
	if(g_pGameMain && g_pGameMain->m_pCommunity)
	{
		// 옵션창에서 얻어옴
		SPARTY_INFO* pSPartyInfo = g_pGameMain->m_pCommunity->GetPartyCreate()->GetSPartyCreateInfo();
		// 설정 정보 저장 파티 정보
		g_pShuttleChild->m_pClientParty->SetSPartyInfo(pSPartyInfo);
		g_pShuttleChild->m_pClientParty->ChagePartyFormation(pSPartyInfo->FormationType);	// 편대 진형 변경 

		CINFCommuPartyCre*	pPartyCre = g_pGameMain->m_pCommunity->GetPartyCreate();	// 편대생성
		if(pPartyCre)
		{
			// 윈도우를 숨기고
			pPartyCre->ShowWindow(FALSE);			

		}
		CINFCommunityParty*	pParty = g_pGameMain->m_pCommunity->GetParty();	// 편대
		if(pParty)
		{
			// 
			pParty->ChangePartySubMode(WND_PARTYMODE_OPTION);
		}
		// 2008-12-15 by dgwoo 미션 마스터.
		g_pInterface->m_pGameMain->m_pMissionMain->UpdateMissionMasterButton();
		if(pPartyCre->IsMissionMaster())
		{
			MSG_FC_QUEST_REQUEST_MISSIONMASTER_HELP sMsg;
			sMsg.QuestIdx = g_pInterface->m_pGameMain->m_pMissionMain->GetMissionMasterQuestIdx();
			m_pFieldWinSocket->SendMsg(T_FC_QUEST_REQUEST_MISSIONMASTER_HELP,(char*)&sMsg,sizeof(MSG_FC_QUEST_REQUEST_MISSIONMASTER_HELP));
			pPartyCre->SetMissionMaster(FALSE);
		}
	}
	// end 2008-04-04 by bhsohn Ep3 커뮤니티 창
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyRequestInviteQuestion(MSG_FC_PARTY_REQUEST_INVITE_QUESTION* pMsg)
/// \brief		MSG_FC_PARTY_REQUEST_INVITE_QUESTION
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyRequestInviteQuestion(MSG_FC_PARTY_REQUEST_INVITE_QUESTION* pMsg)
{
	// 2008-07-14 by bhsohn EP3 관련 처리
	// 이미 파티 초대 창이 떠있다.
	if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_PARTY_INVITE))
	{		
		char szCharName[SIZE_MAX_ARENA_FULL_NAME];
		STRNCPY_MEMSET(szCharName, pMsg->MasterCharacterName, SIZE_MAX_ARENA_FULL_NAME);	
		g_pD3dApp->ConevertArenaRenderUserName(g_pD3dApp->GetArenaState(), szCharName);

		if(g_pGameMain->m_pInfWindow->IsExistMsgBoxString(_Q_PARTY_INVITE, szCharName))
		{
			return;			
		}		
	}
	// end 2008-07-14 by bhsohn EP3 관련 처리


	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyRequestInviteQuestion(pMsg);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyRequestInviteQuestion_THE_ARENA(MSG_FC_PARTY_REQUEST_INVITE_QUESTION_THE_ARENA* pMsg)
/// \brief		MSG_FC_PARTY_REQUEST_INVITE_QUESTION_THE_ARENA
/// \author		jhseol
/// \date		2012-04-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyRequestInviteQuestion_THE_ARENA(MSG_FC_PARTY_REQUEST_INVITE_QUESTION_THE_ARENA* pMsg)
{/// 2012-04-12 by jhseol, 아레나 추가개발 - 자동파티 : 파티 가입 준비
	g_pShuttleChild->m_pClientParty->SetFirstPartySetupInfo(TRUE);
	g_pShuttleChild->m_pClientParty->FSendPartyAcceptInvite( pMsg->PartyID );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyAutoCreated_THE_ARENA(MSG_FC_PARTY_AUTO_CREATED_THE_ARENA* pMsg)
/// \brief		MSG_FC_PARTY_AUTO_CREATED_THE_ARENA
/// \author		jhseol
/// \date		2012-04-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyAutoCreated_THE_ARENA(MSG_FC_PARTY_AUTO_CREATED_THE_ARENA* pMsg)
{/// 2012-04-12 by jhseol, 아레나 추가개발 - 자동파티 : 자동으로 파티만들기.
	g_pGameMain->m_pCommunity->SetAutoCreateParty(pMsg->PartyInfo);
	g_pGameMain->m_pCommunity->GetParty()->PartySendCreate();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyRejectInviteOk(MSG_FC_PARTY_REJECT_INVITE_OK* pMsg)
/// \brief		MSG_FC_PARTY_REJECT_INVITE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyRejectInviteOk(MSG_FC_PARTY_REJECT_INVITE_OK* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyRejectInviteOk(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyPutMember(MSG_FC_PARTY_PUT_MEMBER* pMsg)
/// \brief		MSG_FC_PARTY_PUT_MEMBER
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyPutMember(MSG_FC_PARTY_PUT_MEMBER* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyPutMember(pMsg);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoAll(MSG_FC_PARTY_UPDATE_MEMBER_INFO_ALL* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_ALL
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoAll(MSG_FC_PARTY_UPDATE_MEMBER_INFO_ALL* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoAll(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoLevel(MSG_FC_PARTY_UPDATE_MEMBER_INFO_LEVEL* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_LEVEL
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoLevel(MSG_FC_PARTY_UPDATE_MEMBER_INFO_LEVEL* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoLevel(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoHP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_HP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_HP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoHP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_HP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoHP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentHP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_HP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_HP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentHP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_HP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoCurrentHP(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoDP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_DP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_DP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoDP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_DP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoDP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentDP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_DP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_DP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentDP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_DP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoCurrentDP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoSP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_SP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_SP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoSP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_SP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoSP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentSP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_SP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_SP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentSP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_SP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoCurrentSP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoEP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_EP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_EP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoEP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_EP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoEP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentEP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_EP* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_EP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoCurrentEP(MSG_FC_PARTY_UPDATE_MEMBER_INFO_CURRENT_EP* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoCurrentEP(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyUpdateMemberInfoBodyCondition(MSG_FC_PARTY_UPDATE_MEMBER_INFO_BODYCONDITION* pMsg)
/// \brief		MSG_FC_PARTY_UPDATE_MEMBER_INFO_BODYCONDITION
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyUpdateMemberInfoBodyCondition(MSG_FC_PARTY_UPDATE_MEMBER_INFO_BODYCONDITION* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoBodyCondition(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventWarpOtherFieldServer(MSG_FC_EVENT_WARP * pMsg)
/// \brief		MSG_FC_EVENT_WARP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	현재 지원되지 않음,지원될 경우 코드 수정해야 함
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventWarpOtherFieldServer(MSG_FC_EVENT_WARP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventWarpOtherFieldServer(MSG_FC_EVENT_WARP * pMsg)");
	strcpy(m_strFieldIPCurrent,pMsg->FieldServerID.IP);
	int re = strcmp(m_strFieldIPCurrent,m_strFieldIP);
	if(re != 0)
	{
		strcpy(m_strFieldIP,m_strFieldIPCurrent);
		m_nFieldPort = pMsg->FieldServerID.port;
		m_pFieldWinSocket->CloseSocket();
		if(!m_pFieldWinSocket->Connect(m_strFieldIP,m_nFieldPort))
		{
			// 서버에 접속할수 없음
			NetworkErrorMsgBox(STRMSG_C_SERVER_0011);//"워프중 IP가 다른 서버에 접속 할 수 없음"
			return;
		}
		m_bOtherFieldWarping = TRUE;
		m_sWarpAreaIndex = pMsg->WarpAreaIndex;
	}
	// 2006-11-02 by ispark, 편대 비행 해제
	m_pShuttleChild->CheckFormationMoveDelete();
	
	EventWarpOtherMap(pMsg->MapChannelIndex);
	DBGOUT("Map Channel Information : Warp At other Field server [MapIndex:%d][ChannelIndex:%d]\n", pMsg->MapChannelIndex.MapIndex, pMsg->MapChannelIndex.ChannelIndex);
//	EventWarpOtherMap(pMsg->MapName);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventWarpSameFieldServer(MSG_FC_EVENT_WARP_SAME_FIELD_SERVER * pMsg)
/// \brief		MSG_FC_EVENT_WARP_SAME_FIELD_SERVER
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventWarpSameFieldServer(MSG_FC_EVENT_WARP_SAME_FIELD_SERVER * pMsg)
{
	FLOG("CAtumApplication::EventWarpSameFieldServer(MSG_FC_EVENT_WARP_SAME_FIELD_SERVER * pMsg)");
	m_pShuttleChild->m_vPos = A2DX(pMsg->PositionVector);
	m_pShuttleChild->m_myShuttleInfo.PositionVector = A2DX(pMsg->PositionVector);
//	if(m_pShuttleChild->m_bFormationFlight)// 편대 대형일 경우 초기화
//	{
//		m_pShuttleChild->m_bFormationFlight = FALSE;
//		m_pShuttleChild->m_infoParty.bFormationFlyingPositionType = 0;
//		memset( m_pShuttleChild->m_nCharactUniqueNumber, 0x00, sizeof(UINT)*(MAX_PARTY_NUMBER-1));
//	}
	SetFogLevel( pMsg->MapChannelIndex.MapIndex, !m_pScene->m_bNight );
	m_pScene->m_byWeatherType = pMsg->MapWeather;
	m_pScene->m_bChangeWeather = TRUE;

	EventWarpOtherMap(pMsg->MapChannelIndex);

	// 아레나 맵에서 다른 맵으로 이동시 
	if(g_pInterface->m_pGameArena->IsArenaGameState(ARENA_GAME_STATE_RESULT))
	{
		g_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_TEAMINFO);
	}

	// 2006-11-02 by ispark, 편대 비행 해제
	m_pShuttleChild->CheckFormationMoveDelete();

	// 2005-07-29 by ispark
	// 캐릭터는 - > 기어로 기어 -> 캐릭터로
	// 2005-08-02 by ispark
	// 맵 인덱스를 먼저 입력후 캐릭터와 유닛을 초기화 해야 한다.
	if(pMsg->CharacterMode0 == FALSE)
	{
		m_bCharacter = FALSE;
//		m_pShuttleChild->InitShuttleData();				// 2005-08-03 by ispark
		m_pShuttleChild->m_nBooster = BOOSTER_TYPE_MIN;	// 2005-08-04 by ispark
	}
	else
	{
		m_pCharacterChild->m_vPos = A2DX(pMsg->PositionVector);
		m_bCharacter = TRUE;
		m_pCharacterChild->InitCharacterData();
	}
//	SendMissionComplete();								// 2006-12-18 by ispark, 한번 더 체크하기 위한 것이므로 일단 주석처리
	
	// 2009. 10. 14 by jskim 프리스카 제거 - 처음 튜토리얼 종료시 프롤로그 안나오는 현상 처리
	// 캐릭터 최초 접속시 미션창 보이기
	// 2005-10-17 by ispark
	//if(g_pTutorial->GetTutorialEd() == TRUE)
	//{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		g_pGameMain->m_pMissionInfo->SetFirstMissionSelect(TRUE);
//		g_pGameMain->m_pMissionInfo->MissionProcFlag(TRUE);
		// 2007-12-26 by bhsohn 게임 시작에 관련 부분 수정
		//g_pGameMain->ShowMissionTreeWnd(TRUE, FALSE);
		//g_pTutorial->SetTutorialEd(FALSE);

		// 2007-07-20 by bhsohn 튜토리얼 끝내고 오퍼레이터 안뜨는 현상 처리
//		g_pGameMain->FirstUserShowMissionTreeWnd();
		// 2007-07-26 by bhsohn 나레이션 mp3추가
		//g_pTutorial->SetTutorialEd(FALSE);
		// end 2007-07-20 by bhsohn 튜토리얼 끝내고 오퍼레이터 안뜨는 현상 처리
	//}
	//end 2009. 10. 14 by jskim 프리스카 제거 - 처음 튜토리얼 종료시 프롤로그 안나오는 현상 처리
	// 숨겨진 미션 검사
	CQuest* pQuest = g_pQuestData->FindMapHideQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		g_pGameMain->m_pMissionInfo->SetPosMissionSearchStart(TRUE);
//		g_pGameMain->m_pMissionInfo->SetPosMissionInfo(pQuest);
		g_pGameMain->SetMissionPosMissionSearchStart(TRUE);
		g_pGameMain->SetMissionPosMissionInfo(pQuest);
	}
	// 특정 포지션 완료 미션 검사
	CQuest* pQuest2 = g_pQuestData->FindPosCompleteQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest2)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
		//g_pGameMain->m_pMissionInfo->SetPosMissionComplete(TRUE);
		g_pGameMain->SetMissionPosMissionComplete(TRUE);
	}

	// 2010. 03. 25 by ckPark 사망시 5초이상 추락하면 부활메세지 추가
	m_pShuttleChild->SetDeadMessageEnable( TRUE );
	// end 2010. 03. 25 by ckPark 사망시 5초이상 추락하면 부활메세지 추가

	// 2012-12-17 by bhsohn A기어 배리어 이펙트 워프후 사라지는 오류 처리
	if(!IsMyShuttleCharacter())// TRUE : 캐릭터모드, FLASE: 기어모드		
	{
		// 
		//m_pShuttleChild->UpdateSkillEffectInfo();
		// 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정
		m_pShuttleChild->UpdateSkillEffectInfo(AGEAR_SKILL_BASENUM_BARIAL);
		// end 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정
	}
	// END 2012-12-17 by bhsohn A기어 배리어 이펙트 워프후 사라지는 오류 처리

	// 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정
	if(!IsMyShuttleCharacter())// TRUE : 캐릭터모드, FLASE: 기어모드		
	{		
		m_pShuttleChild->UpdateSkillEffectInfo(MGEAR_STATE_INVINCIBLE);	
	}
	// end 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정
	
// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
#ifdef SC_SEARCHEYE_SHUTTLE_POSITION_JHSEOL_MSPARK
	if(m_nItemNum == RC_ITEM_SEARCHEYE_NUM)
	{
		SetPlaySearchEyeEffect(g_pShuttleChild, RC_EFF_SEARCHEYE_SHUTTLE_POSITION, 0);
	}
	else if(m_nItemNum == RC_ITEM_SEARCHEYE2_NUM)
	{
		SetPlaySearchEyeEffect(g_pShuttleChild, RC_EFF_SEARCHEYE_SHUTTLE_POSITION2, 0);
	}
#endif
// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정

	// 2013-03-21 by bhsohn 강제 전송시, 부활 물어보는창 제거
	if(g_pGameMain && g_pGameMain->m_pInfWindow /*&& ( 0 < m_pShuttleChild->m_myShuttleInfo.CurrentHP )*/)
	{
		if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_DEAD_RETURN))
		{
			g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_DEAD_RETURN);
		}
		if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_SUPER_RESTORE))
		{
			g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_SUPER_RESTORE);
		}
		if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_USE_SUPER_RESTORE))
		{
			g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_USE_SUPER_RESTORE);
		}
		if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_USE_NORMAL_RESTORE))
		{
			g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_USE_NORMAL_RESTORE);
		}			
	}
	// END 2013-03-21 by bhsohn 강제 전송시, 부활 물어보는창 제거

	// 2013-04-05 by bhsohn 지옥맵 5분 부활 시스템 추가
	if(g_pGameMain && g_pGameMain->m_pInfWindow)
	{
		g_pGameMain->m_pInfWindow->InitHellMapLiveTime();
	}
	// END 2013-04-05 by bhsohn 지옥맵 5분 부활 시스템 추가
	
	DBGOUT("Map Channel Information : Warp at Same Field Server [MapIndex:%d][ChannelIndex:%d]\n", pMsg->MapChannelIndex.MapIndex, pMsg->MapChannelIndex.ChannelIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::EventWarpOtherMap(MAP_CHANNEL_INDEX &channelIndex)
/// \brief		FieldSocketEventWarpOtherFieldServer, FieldSocketEventWarpSameFieldServer에서 맵이동시 초기화 함수
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	EnemyData중 파티원 정보만 남기기 위해 여기서 처리한다.
///				m_pScene->DeleteRes()에서 m_mapEnemyList는 이미 비어있다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::EventWarpOtherMap(MAP_CHANNEL_INDEX &channelIndex)
{
	FLOG("CAtumApplication::EventWarpOtherMap(MAP_CHANNEL_INDEX &channelIndex)");
	// 2006-08-21 by dgwoo 워프시 게임이 종료중인것을 중단한다.
	g_pShuttleChild->m_nEventType = EVENT_GAME_START;

	m_pSound->StopD3DSound( SOUND_FLYING_M_A_GEAR );
	m_pSound->StopD3DSound( SOUND_HIGH_BOOSTER );
	m_pSound->StopD3DSound( SOUND_FLYING_B_I_GEAR );
	m_pSound->StopD3DSound( SOUND_LOW_BOOSTER );
	g_pInterface->InvalidateChannelListObjects();
	g_pInterface->DeleteChannelListObjects();

	// 2006-05-29 by ispark, ShuttleChild에서 워프 초기화 함수를 쓴다.
	g_pShuttleChild->InitWarpShuttle(channelIndex);
	
////	사용중인 모든 토글 스킬을 해제한다.
//	g_pShuttleChild->m_pSkill->ReleaseAllUsingToggleSkill();
//	m_pShuttleChild->DeleteItemPoint();// Effect로 생성한 아이템포인터를 지운다
////	m_mapObjectList.clear();
//	m_pShuttleChild->m_bSkillMoveIsUse = FALSE;
//	// 2006-02-13 by ispark
//	m_pShuttleChild->InitMissileWarning();
//	m_pShuttleChild->SetBackView(FALSE);		// 2006-05-29 by ispark, 백뷰 초기화
	// 2005-01-04 by jschoi
//	g_pD3dDev->ResourceManagerDiscardBytes(0);
	g_pD3dDev->EvictManagedResources();


//	CMapEnemyList mapParty;
//	int cont = 60000;
//	m_nInvalidClientIndexCont = 0;
//	// EnemyData중 파티원 정보만 남기기 위해 여기서 처리한다.
//	// m_pScene->DeleteRes()에서 m_mapEnemyList는 이미 비어있다.
//	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.begin();
//	while(itEnemy != m_pScene->m_mapEnemyList.end())
//	{
//		if(itEnemy->second->m_infoParty.bPartyType == _NOPARTY)
//		if(itEnemy->second->m_nPartyID == 0)
//		{
//			SAFE_DELETE(itEnemy->second);
//		}
//		else
//		{
//			itEnemy->second->m_infoCharacter.ClientIndex = INVALID_CLIENT_INDEX;
//			mapParty[cont + m_nInvalidClientIndexCont] = itEnemy->second;
//			itEnemy->second->DeleteItemPoint();
//			m_nInvalidClientIndexCont++;
//		}
//		itEnemy++;
//	}
	// 2014-05-20 by ymjoo 아레나 맵에서 다른 맵으로 이동시 익셉션 예외 처리 추가
	if(m_pScene)
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.begin();
		while(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			// 2007-04-03 by dgwoo 옵저버한 유저가 종료시.
			if(itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex == g_pShuttleChild->m_stObserve.ClientIndex)
			{
				g_pShuttleChild->ObserveCancelUpdateInfo();
				g_pShuttleChild->ObserveEnd();
			}
			// 2015-03-13 by jwLee EnemyData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
			itEnemy->second->InvalidateDeviceObjects();
			itEnemy->second->DeleteDeviceObjects();
			// end 2015-03-13 by jwLee EnemyData 삭제시  InvalidateDeviceObjects DeleteDeviceObjects 함수 호출 추가
			SAFE_DELETE(itEnemy->second);
			itEnemy = m_pScene->m_mapEnemyList.erase(itEnemy);
		}
		// Chat 을 지운다.
		if(m_pChat)
		{
			CAtumNode* pChat = (CAtumNode *)m_pChat->m_pChild;
			while(pChat)
			{
				pChat->m_bUsing = FALSE;
				pChat = pChat->m_pNext;
			}
			m_pChat->Tick();
		}
		// Effect(App의) 을 지운다.
		if(m_pEffectList)
		{
			DeleteEffectList();
			m_pEffectList->Tick();
		}
		if(m_pEffectRender)
			m_pEffectRender->m_vecZEnableEffect.clear();

		if(m_pScene)
		{
			m_pScene->InvalidateRes();
			m_pScene->DeleteRes();
	// 		m_pScene->m_mapEnemyList = mapParty;	// enemy중 파티원들만 남긴다.
		}
	}
	// END 2014-05-20 by ymjoo 아레나 맵에서 다른 맵으로 이동시 익셉션 예외 처리 추가

	m_pShuttleChild->m_nOldMapIndex = m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex;
	m_pShuttleChild->m_myShuttleInfo.MapChannelIndex = channelIndex;

	// 편대원들의 맵채널 인덱스 업데이트 - 나중에 다시 확인 할 것.
//	vector<PARTYENEMYINFO*>::iterator itParty = m_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.begin();
//	while(itParty != m_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.end())
//	{
//		if((*itParty)->m_bPartyType == _PARTYMEMBER || (*itParty)->m_bPartyType == _PARTYMASTER)
//		{
//			if((*itParty)->m_bFormationFlight)
//			{
//				(*itParty)->m_ImPartyMemberInfo.MapChannelIndex = channelIndex;
//			}
//		}
//		itParty++;
//	}

	if(m_pShuttleChild->m_pClientParty->IsFormationFlight())
	{
		m_pShuttleChild->m_pClientParty->FormationFlightClear();
		// 2008-03-05 by bhsohn 같은 워프 이동시, 편대장은 편대비행을 자유비행으로 강제로 변경
		// 다른 맵으로 이동하였떄 편대 해체
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMASTER)
		{
			// 2008-06-17 by bhsohn 편대 관련 처리			
			// 편대장			
			g_pShuttleChild->m_pClientParty->RefreshFormationType();	// 과거 편대로 갱신
		}		
		else if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMEMBER)
		{
			// 편대원
			g_pShuttleChild->SendPacket(T_IC_PARTY_CANCEL_FLIGHT_POSITION);			
		}
		// end 2008-03-05 by bhsohn 같은 워프 이동시, 편대장은 편대비행을 자유비행으로 강제로 변경
	}
	// 2008-06-17 by bhsohn 편대 관련 처리			
	else if(g_pShuttleChild->m_pClientParty->GetOldFormationFlyingType() != -1)
	{
		// 과거 편대 대형이 있었다.
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMASTER)
		{
			g_pShuttleChild->m_pClientParty->RefreshFormationType();	// 과거 편대로 갱신
		}
	}
	// end 2008-06-17 by bhsohn 편대 관련 처리			

//	MSG_IC_PARTY_GET_ALL_MEMBER sMsg;
//	memset(&sMsg,0x00,sizeof(sMsg));
//	char buffer[SIZE_MAX_PACKET];
//	int nType = T_IC_PARTY_GET_ALL_MEMBER;
//	sMsg.PartyID = g_pShuttleChild->m_pClientParty->GetPartyInfo().PartyID;
//	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
//	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
//	g_pIMSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));

	DBGOUT("Map Channel Info : Set Unit Map Info [MapIndex:%d][ChannelIndex:%d]\n",
		channelIndex.MapIndex, channelIndex.ChannelIndex);
	//strcpy(m_pShuttleChild->m_myShuttleInfo.MapName,szMapName);
	m_pInterface->InitMapLoadObjects();
	m_pInterface->RestoreMapLoadObjects();
    
    // 2010. 10. 05 by jskim 맵로딩 구조 변경
	//SAFE_DELETE(m_pMapInitThread );
	//m_pMapInitThread = new CMapInitThread();
	//m_pMapInitThread->CreateThread();
    m_pMaploading->SetMapStep(_MAP_LOADING_STEP1);
    // end 2010. 10. 05 by jskim 맵로딩 구조 변경
	ChangeGameState(_MAPLOAD);

	// 2007-11-22 by bhsohn 아레나 통합서버
	// 아레나 대기중에 마을을 벗어났을 시, 소켓을 끊는다.
	// 아레나 레뒤 상태면 클로우즈 할 필요 없다.
	BOOL bArenaTeamNotLoad = (ARENA_STATE_ARENA_GAMING != GetArenaState()) 
								&&(FALSE == g_pInterface->IsArenaGameState(ARENA_GAME_STATE_TEAMINFO))
								// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
								// 인피니티 팝업 창이 떠있으면 안끊는다
								&& ( !m_pInterface->m_pInfinityPopup || !m_pInterface->m_pInfinityPopup->IsShowWnd() )
								// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
								&& !IS_CITY_MAP_INDEX(channelIndex.MapIndex);
	BOOL bGmMode = (ARENA_STATE_ARENA_GAMING != GetArenaState()) 
					&&(TRUE == IsGmModeConnect());
	if(bArenaTeamNotLoad|| bGmMode)	// GM 커넥트 모드는 소켓을 끊는다.
	{			
		CloseArenaSocket();		
	}	
	
	// end 2007-11-22 by bhsohn 아레나 통합서버
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketEventWarpSameMap(MSG_FC_EVENT_WARP_SAME_MAP * pMsg)
/// \brief		MSG_FC_EVENT_WARP_SAME_MAP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventWarpSameMap(MSG_FC_EVENT_WARP_SAME_MAP * pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventWarpSameMap(MSG_FC_EVENT_WARP_SAME_MAP * pMsg)");
	m_pShuttleChild->m_vPos = A2DX(pMsg->PositionVector);
	ChangeGameState(_GAME);
//	if(m_pShuttleChild->m_bFormationFlight)// 편대 대형일 경우 초기화
//	{
//		m_pShuttleChild->m_bFormationFlight = FALSE;
//		m_pShuttleChild->m_infoParty.bFormationFlyingPositionType = 0;
//		memset( m_pShuttleChild->m_nCharactUniqueNumber, 0x00, sizeof(UINT)*(MAX_PARTY_NUMBER-1));
//	}
	// 2006-11-02 by ispark, 편대 비행 해제
	m_pShuttleChild->CheckFormationMoveDelete();
	// 2006-05-29 by ispark, ShuttleChild에서 워프 초기화 함수를 쓴다.
	g_pShuttleChild->InitWarpShuttle();
	if(m_pShuttleChild->m_pClientParty->IsFormationFlight())
	{
		m_pShuttleChild->m_pClientParty->FormationFlightClear();
		// 2008-03-05 by bhsohn 같은 워프 이동시, 편대장은 편대비행을 자유비행으로 강제로 변경
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMASTER)
		{
			// 2008-06-17 by bhsohn 편대 관련 처리
			// 편대장이 죽었다가 다시 살아났다.
			// 편대장
			//g_pShuttleChild->m_pClientParty->ISendPartyChangeFlightFormation(FLIGHT_FORM_NONE);
			g_pShuttleChild->m_pClientParty->RefreshFormationType();	// 과거 편대로 갱신
		}		
		else if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMEMBER)
		{
			// 편대원
			g_pShuttleChild->SendPacket(T_IC_PARTY_CANCEL_FLIGHT_POSITION);			
		}

		// end 2008-03-05 by bhsohn 같은 워프 이동시, 편대장은 편대비행을 자유비행으로 강제로 변경
	}
	// 2008-06-17 by bhsohn 편대 관련 처리			
	else if(g_pShuttleChild->m_pClientParty->GetOldFormationFlyingType() != -1)
	{
		// 과거 편대 대형이 있었다.
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMASTER)
		{
			g_pShuttleChild->m_pClientParty->RefreshFormationType();	// 과거 편대로 갱신
		}
	}
	// end 2008-06-17 by bhsohn 편대 관련 처리			
	m_pShuttleChild->ChangeUnitState( _NORMAL );

	// 2005-07-29 by ispark
	// 캐릭터는 - > 기어로 기어 -> 캐릭터로
	if(pMsg->CharacterMode0 == FALSE)
	{
		g_pD3dApp->m_bCharacter = FALSE;
		g_pShuttleChild->InitShuttleData(TRUE);		
		INIT_MSG_WITH_BUFFER(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE,
			T_FC_CHARACTER_CHANGE_CHARACTER_MODE, pSMode, SendBuf);
		pSMode->CharacterMode0 = FALSE;
		pSMode->PositionAVec3 = A2DX(pMsg->PositionVector);
		pSMode->TargetAVec3 = m_pShuttleChild->m_vVel*1000.0f;
		g_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE));
		m_pShuttleChild->SendFieldSocketChangeBodyCondition(m_pShuttleChild->m_myShuttleInfo.ClientIndex, BODYCON_SET_OR_CLEAR_MASK);
	}
	else
	{
		m_pCharacterChild->m_vPos = A2DX(pMsg->PositionVector);
		m_bCharacter = TRUE;
		m_pCharacterChild->InitCharacterData();

		// 2005-08-09 by ispark
		// 서버로 부터 캐릭터 변환을 알려주지만은 서버 자신은 변환 하지 않는다.
		// 서버로 캐릭터 모드 전환을 알린다.
		// 메세지 처리
		INIT_MSG_WITH_BUFFER(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE,
			T_FC_CHARACTER_CHANGE_CHARACTER_MODE, pSMode, SendBuf);
		pSMode->CharacterMode0 = TRUE;
		pSMode->PositionAVec3 = A2DX(pMsg->PositionVector);
		pSMode->TargetAVec3 = m_pShuttleChild->m_vVel*1000.0f;
		g_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE));
		// 2005-07-28 by ispark
		// 캐릭터 초기 바디 컨디션 보냄. 그 이후는 보내지 않는다. Client가 스스로 바디컨디션을 판단한다.
		m_pShuttleChild->SendFieldSocketChangeBodyCondition(m_pShuttleChild->m_myShuttleInfo.ClientIndex, BODYCON_SET_OR_CLEAR_MASK);
	}
	
	/////////////////////////////// 워프 완료 전송 ////////////////////////////
	char buffer[SIZE_MAX_PACKET];
	int nType = T_FC_EVENT_WARP_SAME_MAP_DONE;
	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
	m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER);
	m_pScene->SetObjectRenderList();

	// 2004-11-26 by jschoi - 위프아웃 시 패턴 적용
	// 2006-08-01 by ispark, 패턴삭제
	g_pShuttleChild->DeletePattern();
	m_pShuttleChild->PatternWarpOut(TRUE);
//	SendMissionComplete();									// 2006-12-18 by ispark, 한번 더 체크하기 위한 것이므로 일단 주석처리

	// 2010. 03. 25 by ckPark 사망시 5초이상 추락하면 부활메세지 추가
	m_pShuttleChild->SetDeadMessageEnable( TRUE );
	// end 2010. 03. 25 by ckPark 사망시 5초이상 추락하면 부활메세지 추가

	// 2013-04-05 by bhsohn 지옥맵 5분 부활 시스템 추가
	if(g_pGameMain && g_pGameMain->m_pInfWindow)
	{
		g_pGameMain->m_pInfWindow->InitHellMapLiveTime();
	}
	// END 2013-04-05 by bhsohn 지옥맵 5분 부활 시스템 추가 // 변수 초기화
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventOtherWarped(MSG_FC_EVENT_OTHER_WARPED * pMsg)
/// \brief		MSG_FC_EVENT_OTHER_WARPED
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventOtherWarped(MSG_FC_EVENT_OTHER_WARPED * pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventOtherWarped(MSG_FC_EVENT_OTHER_WARPED * pMsg)");
	if(m_dwGameState == _CITY)
	{
		DBGOUT("MSG_FC_EVENT_OTHER_WARPED in _CITY \n");
		return;
	}
	if(pMsg->ClientIndex < 10000)
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			// 워프 파티클 생성
			if(m_pEffectList)
			{
				CAppEffectData *pData = new CAppEffectData(NULL,RC_EFF_OTHER_WARP,itEnemy->second->m_vPos);
				pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
			}
//			m_pSound->PlayD3DSound(SOUND_WARP, itEnemy->second->m_vPos);
//			CObjectChild* pWarpgate = m_pScene->FindWarpGateByPosition( itEnemy->second->m_vPos );
//			if( pWarpgate )
//			{
//				pWarpgate->ChangeBodycondition( BODYCON_WARP_MASK );
//			}

			// 2005-11-01 by ispark
			// 같은 맵이 아니면 삭제
			// 2007-05-07 by bhsohn 적 유닛 위치 관련 버그 수정
			// 같은 맵에서도 적 유닛을 지운다. 
			//if(pMsg->WarpMapIndex != m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex)
			{
				itEnemy->second->m_bIsRender = FALSE;
				// 아이템중 이캐릭의 것들(더미류와 같은것)
				itEnemy->second->m_bUsing = FALSE;
			}
//			m_pScene->DeleteFieldItemOfUnitData( itEnemy->second );
//			m_pScene->DeleteToBlockData(itEnemy->second);
//			SAFE_DELETE(itEnemy->second);
//			m_pScene->m_mapEnemyList.erase(itEnemy);
		}
	}
	else
	{
		CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->ClientIndex);
		if(itMonster != m_pScene->m_mapMonsterList.end())
		{
			itMonster->second->m_bUsing = FALSE;
//			m_pScene->DeleteFieldItemOfUnitData( itMonster->second );
//			m_pScene->DeleteToBlockData(itMonster->second);
//			itMonster->second->DeleteItemPoint();
//			SAFE_DELETE(itMonster->second);
//			m_pScene->m_mapMonsterList.erase(itMonster);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventWarpConnectOk(MSG_FC_EVENT_WARP_CONNECT_OK* pMsg)
/// \brief		MSG_FC_EVENT_WARP_CONNECT_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventWarpConnectOk(MSG_FC_EVENT_WARP_CONNECT_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventWarpConnectOk(MSG_FC_EVENT_WARP_CONNECT_OK* pMsg)");
	m_pShuttleChild->m_myShuttleInfo.ClientIndex = pMsg->ClientIndex;
	m_pShuttleChild->m_vPos = A2DX(pMsg->PositionVector);
//	if(m_pShuttleChild->m_bFormationFlight)// 편대 대형일 경우 초기화
//	{
//		m_pShuttleChild->m_bFormationFlight = FALSE;
//		m_pShuttleChild->m_infoParty.bFormationFlyingPositionType = 0;
//		memset( m_pShuttleChild->m_nCharactUniqueNumber, 0x00, sizeof(UINT)*(MAX_PARTY_NUMBER-1));
//	}
	if(m_pShuttleChild->m_pClientParty->IsFormationFlight())
	{
		m_pShuttleChild->m_pClientParty->FormationFlightClear();
	}
	m_bOtherFieldWarping = FALSE;
	if( m_pScene->m_byMapType == MAP_TYPE_CITY )
	{
		ChangeGameState(_CITY);
	}
	else
	{
		ChangeGameState(_GAME);
	}

	// 2005-07-21 by ispark
	// 캐릭터 모드 입력 (0 : 유닛(기체), 그외는 캐릭터)
//	if(pMsg->CharacterMode0 > 0)
//	{
//		m_bCharacter = TRUE;
//		m_pCharacterChild->InitCharacterData();
//	}
//	else
//	{
//	m_bCharacter = FALSE;		
//	m_pShuttleChild->InitShuttleData();
//	}

	m_pInterface->InvalidateMapLoadObjects();
	m_pInterface->DeleteMapLoadObjects();
	SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, !m_pScene->m_bNight );
	m_pScene->m_byWeatherType = pMsg->MapWeather;
	m_pScene->m_bChangeWeather = TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStorePutItemHeader(MSG_FC_STORE_PUT_ITEM_HEADER* pMsg)
/// \brief		MSG_FC_STORE_PUT_ITEM_HEADER
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketStorePutItemHeader(MSG_FC_STORE_PUT_ITEM_HEADER* pMsg)
{
	FLOG("CAtumApplication::FieldSocketStorePutItemHeader(MSG_FC_STORE_PUT_ITEM_HEADER* pMsg)");
	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	InitItemList();
	// end 2008-08-11 by bhsohn 단독으로 실행 되게끔

	// 시작시 아이템 정보 받기 시작
	m_nItemStorage = pMsg->ItemStorage0;
	// 2007-10-30 by dgwoo 아이템 목록이 올경우는 마지막에 한번만 소팅해준다.
	m_bResortingItem = FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketStorePutItem(MSG_FC_STORE_PUT_ITEM* pMsg)
/// \brief		MSG_FC_STORE_PUT_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketStorePutItem(MSG_FC_STORE_PUT_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketStorePutItem(MSG_FC_STORE_PUT_ITEM* pMsg)");
	// 아이템 정보 받기
	int size = pMsg->BytesToRead;
	char * p = (char *)pMsg;
	p += sizeof(int);
//	if(m_nStorePacketPossess != 0)
	if(m_nItemStorage == ITEM_IN_CHARACTER)
	{
		while(size)
		{
			int usebyte = 0;
			usebyte = g_pStoreData->PutItem(p);
			p += usebyte;
			size -= usebyte;
			if(size < 0)
			{
				m_pChat->CreateChatChild(STRMSG_C_STORE_0007,COLOR_ERROR);//"Store Item 받는 중 Size(-) 오류"
				break;//err;
			}
		}
	}
	else // 창고
	{
		ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
		CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
		ASSERT_ASSERT(pStore);
		while(size)
		{
			int usebyte = 0;
			usebyte = pStore->PutItem(p);
			p += usebyte;
			size -= usebyte;
			if(size < 0)
			{
				m_pChat->CreateChatChild(STRMSG_C_STORE_0007,COLOR_ERROR);
				break;//err;
			}
		}
//		while(size)
//		{
//			int usebyte = 0;
//			usebyte = g_pStoreData->PutItemStore(p);
//			p += usebyte;
//			size -= usebyte;
//			if(size < 0)
//			{
//				m_pChat->CreateChatChild("Store Item 받는중 Size(-) 오류",COLOR_ERROR);
//				break;//err;
//			}
//		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStorePutItemDone(MSG_FC_STORE_PUT_ITEM_DONE* pMsg)
/// \brief		MSG_FC_STORE_PUT_ITEM_DONE
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketStorePutItemDone(MSG_FC_STORE_PUT_ITEM_DONE* pMsg)
{
	FLOG("CAtumApplication::FieldSocketStorePutItemDone(MSG_FC_STORE_PUT_ITEM_DONE* pMsg)");
	// 아이템 정보 받기 완료

	// 2005-03-07 by jschoi
	g_pD3dApp->m_bRequestEnable = TRUE;
	g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
	m_bInputItemDone = TRUE;
	//DBGOUT("FieldSocketStorePutItemDone\n");

	// 2007-10-30 by dgwoo 아이템 목록이 올경우는 마지막에 한번만 소팅해준다.
	m_bResortingItem = TRUE;
// 2006-01-05 by ispark, 변경
//	if(m_nStorePacketPossess != 0)
	if(pMsg->ItemStorage0 == ITEM_IN_CHARACTER)
	{
		m_pShuttleChild->ResortingItem();
		m_pShuttleChild->SetShuttleData(1);
		m_pShuttleChild->SetShuttleData(5);
		if(g_pGameMain)
		{
			if(g_pGameMain->m_pInven)
				g_pGameMain->m_pInven->SetAllIconInfo();
			if(g_pGameMain->m_pCharacterInfo)
				g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();
			if(g_pGameMain->m_pQuickSlot)
				g_pGameMain->m_pQuickSlot->SetAllQSlotInfo();
		}

		// 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)
// 		float fWeight = g_pStoreData->GetTotalWeight() / CAtumSJ::GetTransport(&g_pShuttleChild->m_myShuttleInfo);
// 		if(fWeight >= 0.9f)
// 		{
// 			m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0044,COLOR_SYSTEM);//"기어 적재량의 90%를 초과 하였습니다."
// 			m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0045,COLOR_SYSTEM);//"최소 속도로만 이동가능하며, 연료소모량이 증가합니다."
// 		}
// 		else if(fWeight > WEIGHT_RATE_VERY_HEAVY)
// 		{
// 			m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0046,COLOR_SYSTEM);//"기어 적재량의 80%를 초과 하였습니다."
// 			m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0047,COLOR_SYSTEM);//"부스터의 사용이 제한되며, 연료소모량이 증가합니다."
// 		}
// 		else if(fWeight >= WEIGHT_RATE_HEAVY)
// 		{
// 			m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0048,COLOR_SYSTEM);//"기어 적재량의 70%를 초과하여 연료소모량이 증가합니다."
// 		}
		// end 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)
	}
	else
	{
		ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
		CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
		ASSERT_ASSERT(pStore);
		pStore->InputItemDone();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		dhkwon
/// \date		2004-07-30 ~ 2004-07-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketStoreMoveItemOk(MSG_FC_STORE_MOVE_ITEM_OK* pMsg)
{
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeLevel(MSG_FC_CHARACTER_CHANGE_LEVEL* pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_LEVEL
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeLevel(MSG_FC_CHARACTER_CHANGE_LEVEL* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeLevel(MSG_FC_CHARACTER_CHANGE_LEVEL* pMsg)");
	CAppEffectData * pData = NULL;
	D3DXVECTOR3 vPos = D3DXVECTOR3(0,1,0);
	CQuest *pQuestInfo = g_pQuestData->GetProgressMission();
	if(pQuestInfo && pQuestInfo->QuestEndType == QUEST_END_TYPE_LEVEL_UP)
	{
		// 미션 완료 보내기
		// 2006-03-27 by ispark, 파티미션 추가
		if(pQuestInfo->IsPartyQuest())
		{
			g_pQuestData->SendFieldSocketQuestRequestSuccessCheck(pQuestInfo->QuestIndex);
		}
		else
		{
			g_pGImage->SetImageInfo(MISSION_SUC, TRUE);
		}
	}
	
	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		// 2006-08-22 by ispark, 스탯 도움말
		if(m_pShuttleChild->m_myShuttleInfo.BonusStat < pMsg->BonusStat)
		{
			// 2007-07-27 by bhsohn 스탯 추가 된 도움말 오퍼레이터에 통합
			g_pGameMain->ShowOpStatChange(pMsg->BonusStat - m_pShuttleChild->m_myShuttleInfo.BonusStat);
//			g_pGameMain->m_bKnowON[LOW_LEVEL_STAT_HELP] = TRUE;
//			g_pGameMain->m_pHelpDesk->SetLowLevelStringbyType(LOW_LEVEL_STAT_HELP, pMsg->BonusStat - m_pShuttleChild->m_myShuttleInfo.BonusStat);
		}

		m_pShuttleChild->m_myShuttleInfo.Level = pMsg->Level;
		m_pShuttleChild->m_myShuttleInfo.BonusStat = pMsg->BonusStat;
//		m_pShuttleChild->m_myShuttleInfo.BonusSkillPoint = pMsg->BonusSkillPoint; // 2005-11-16 by ispark
		// Level Up Effect Create
		if(m_pEffectList)
		{
			// 2005-11-25 by ispark
			// 캐릭터 상에서 레벨업 이펙트가 보이지 않아 보이게 하기 위해서 추가
			// 구현상 때문에 CCharacterChild에서 CAtumNode 추가하였음
			CAtumNode * pEffectParent;
			if(g_pD3dApp->m_bCharacter)
				pEffectParent = m_pCharacterChild;
			else
				pEffectParent = m_pShuttleChild;

			if(IS_BT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
			{
				pData = new CAppEffectData(pEffectParent,RC_EFF_LEVELUP_BT,vPos);
			}
			else if(IS_OT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
			{
				pData = new CAppEffectData(pEffectParent,RC_EFF_LEVELUP_OT,vPos);
			}
			else if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
			{
				pData = new CAppEffectData(pEffectParent,RC_EFF_LEVELUP_DT,vPos);
			}
			else if(IS_ST(m_pShuttleChild->m_myShuttleInfo.UnitKind))
			{
				pData = new CAppEffectData(pEffectParent,RC_EFF_LEVELUP_ST,vPos);
			}
			if(pData)
			{
				pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
			}
		}
//		if(g_pGameMain->m_nRightWindowInfo != RIGHT_WINDOW_INFO)
//			g_pGameMain->RightWindowShow( TRUE, RIGHT_WINDOW_INFO );
//		m_pShuttleChild->CheckQuest();
		if(pMsg->Level < 5)
		{
//			g_pGameMain->m_pNotice->SetNotice("정보창(F5)을 열어 '스탯'을 분배하시기 바랍니다.");
			g_pGameMain->SetNotice( 17 );
		}
		else if(pMsg->Level == 5)
		{
			// 1형 아이템
			// '플라이씨드의 진주' 미션을 수행하시면 새로운 1형 무기를 얻을 수 있습니다. 반드시 수행하여 새로운 무기를 장착하시기 바랍니다.
			g_pGameMain->SetNotice( 23 );
		}
		else if(pMsg->Level == 6)
		{
			// 레벨 5 이상부터는 '연료'가 소모됩니다. 연료는 '기체수리'파트에서 구입가능합니다.
			g_pGameMain->SetNotice( 43 );
		}
		else if(pMsg->Level == 7)
		{
			// 1형 아이템
			// '블랙박스 회수' 미션을 수행하시면 새로운 2형 무기를 얻을 수 있습니다.
			g_pGameMain->SetNotice( 24 );
		}
		else if(pMsg->Level == 8)
		{
			// 격납고에서 '보관소'를 이용하여 물건을 맏길 수 있는 레벨이 되었습니다.
			g_pGameMain->SetNotice( 40 );
		}
		else if(pMsg->Level == 9)
		{
			// 격납고에서 '스킬 파트'를 이용하여 자신에 맞는 스킬을 구입할 수 있습니다.
			g_pGameMain->SetNotice( 41 );
		}
		else if(pMsg->Level == 10)
		{
			// 레벨 10부터는 몬스터에 의해 격추당하면 일정확률로 경험치가 떨어집니다.
			g_pGameMain->SetNotice( 56 );
		}
		if(g_pInterface->m_pCityBase)
		{
			g_pInterface->m_pCityBase->SetButtonEnableByLevel(pMsg->Level);
		}
		g_pQuestData->NotifyStartQuest();

		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
		// 레벨업시 팝업 윈도우 Show
		CQuest *pProgressQuestInfo = g_pQuestData->GetProgressMission();
		if(NULL == pProgressQuestInfo)
		{
			// 현재 하고있는 퀘스트가 없을떄만 
			g_pGameMain->UpdateMissionPopWnd(pMsg->Level, -1);
		}
		
		// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리		
		if(g_pGameMain && g_pGameMain->m_pUnitInfoBar)
		{
			// Levlup상태면 해피아우어 정보 초기화
			g_pGameMain->m_pUnitInfoBar->InitHappyHourInfo();
		}		
		// end 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
	}
	else
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			// Level Up Effect Create
			if(m_pEffectList)
			{
				if(IS_BT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
					pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_BT,vPos);
				else if(IS_OT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
					pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_OT,vPos);
				else if(IS_DT(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
					pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_DT,vPos);
				else if(IS_ST(itEnemy->second->m_infoCharacter.CharacterInfo.UnitKind))
					pData = new CAppEffectData(itEnemy->second,RC_EFF_LEVELUP_ST,vPos);
				if(pData)
				{
					pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
				}
			}
		}
	}

	// 2007-01-29 by bhsohn 신규유저 미션 인터페이스
	// 랩이 바뀌면 도움말 재 요청
	if(g_pShuttleChild->GetShuttleInfo()->InfluenceType & INFLUENCE_TYPE_NORMAL)
		g_pGameMain->m_pHelpDesk->ReShowHelpDesk();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeExp(MSG_FC_CHARACTER_CHANGE_EXP* pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_EXP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeExp(MSG_FC_CHARACTER_CHANGE_EXP* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeExp(MSG_FC_CHARACTER_CHANGE_EXP* pMsg)");
	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		Experience_t oldExperience = m_pShuttleChild->m_myShuttleInfo.Experience;
		m_pShuttleChild->m_myShuttleInfo.Experience = pMsg->Experience;
		m_pShuttleChild->m_fExpPer = (float)((((double)m_pShuttleChild->m_myShuttleInfo.Experience
									- (double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level))
									/((double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level+1)
									- (double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level)))
									* 100);
// 2008-05-30 by dgwoo 경험치도 시스템 메시지창에 찍힘.
//#ifdef _DEBUG
		char buf[128];
		float fExperience = (float)m_pShuttleChild->m_myShuttleInfo.Experience - oldExperience;
		if(fExperience != 0)
		{
			sprintf(buf, STRMSG_C_060721_0000,fExperience);
			m_pChat->CreateChatChild(buf, COLOR_SKILL_USE,CHAT_TAB_SYSTEM);
		}
//#endif
		if(g_pGameMain->m_pUnitInfoBar)
		{
			g_pGameMain->m_pUnitInfoBar->SetEXP(m_pShuttleChild->m_fExpPer);
		}
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeStat(MSG_FC_CHARACTER_CHANGE_STAT * pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_STAT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeStat(MSG_FC_CHARACTER_CHANGE_STAT * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeStat(MSG_FC_CHARACTER_CHANGE_STAT * pMsg)");
	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		m_pShuttleChild->m_myShuttleInfo.GearStat = pMsg->GearStat1;
		if(m_pShuttleChild->m_myShuttleInfo.BonusStat != pMsg->BonusStat)
		{
			// 2006-08-22 by ispark, 스탯 도움말
			if(m_pShuttleChild->m_myShuttleInfo.BonusStat < pMsg->BonusStat)
			{
				// 2007-07-27 by bhsohn 스탯 추가 된 도움말 오퍼레이터에 통합
				g_pGameMain->ShowOpStatChange(pMsg->BonusStat - m_pShuttleChild->m_myShuttleInfo.BonusStat);
//				g_pGameMain->m_bKnowON[LOW_LEVEL_STAT_HELP] = TRUE;
//				g_pGameMain->m_pHelpDesk->SetLowLevelStringbyType(LOW_LEVEL_STAT_HELP, pMsg->BonusStat - m_pShuttleChild->m_myShuttleInfo.BonusStat);
			}
			m_pShuttleChild->m_myShuttleInfo.BonusStat = pMsg->BonusStat;
			m_pSound->PlayD3DSound(SOUND_STAT_UP, g_pShuttleChild->m_vPos, FALSE);
		}
//		// 엔진 아이템 검사
//		CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByWindowPos( POS_REAR );
//		if( pItemInfo )
//		{
//			if( pItemInfo->GetRealItemInfo()->ReqGearStat.DodgePart > m_pShuttleChild->m_myShuttleInfo.TotalGearStat.DodgePart )
//			{
//				// 엔진을 내린다.
//				// send item windowNumber (socket)
//				MSG_FC_ITEM_CHANGE_WINDOW_POSITION sMsg;
//				sMsg.CharacterUniqueNumber = g_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber;
//				sMsg.FromItemUniqueNumber = pItemInfo->UniqueNumber;
//				sMsg.FromItemWindowIndex = pItemInfo->ItemWindowIndex;
//				sMsg.ToItemUniqueNumber = 0;
//				sMsg.ToItemWindowIndex = 9999;
//				g_pFieldWinSocket->SendMsg( T_FC_ITEM_CHANGE_WINDOW_POSITION, (char*)&sMsg, sizeof(sMsg) );
//			}
//		}
	}
/*	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		switch(pMsg->KindOfStat)
		{
			case STAT_ATTACK_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.AttackPart = pMsg->ChangeValue_2;
				break;
			}
			case STAT_DEFENSE_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.DefensePart = pMsg->ChangeValue_2;
				break;
			}
			case STAT_FUEL_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.FuelPart = pMsg->ChangeValue_2;
				if(pMsg->ChangeValue_1)
					m_pShuttleChild->m_myShuttleInfo.EP = pMsg->ChangeValue_1;
				if(g_pGameMain->m_pUnitInfoBar)
				{
					g_pGameMain->m_pUnitInfoBar->SetEP(m_pShuttleChild->m_myShuttleInfo.CurrentEP, (float)m_pShuttleChild->m_myShuttleInfo.EP);
				}
				break;
			}
			case STAT_SOUL_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.SoulPart = pMsg->ChangeValue_2;
				if(pMsg->ChangeValue_1)
					m_pShuttleChild->m_myShuttleInfo.SP = pMsg->ChangeValue_1;
				if(g_pGameMain->m_pUnitInfoBar)
				{
					g_pGameMain->m_pUnitInfoBar->SetSP( (float)m_pShuttleChild->m_myShuttleInfo.CurrentSP, (float)m_pShuttleChild->m_myShuttleInfo.SP );
				}
				break;
			}
			case STAT_SHIELD_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.ShieldPart = pMsg->ChangeValue_2;
				if(pMsg->ChangeValue_1)
					m_pShuttleChild->m_myShuttleInfo.DP = pMsg->ChangeValue_1;
				if(g_pGameMain->m_pUnitInfoBar)
				{
					g_pGameMain->m_pUnitInfoBar->SetDP( (float)m_pShuttleChild->m_myShuttleInfo.CurrentDP, (float)m_pShuttleChild->m_myShuttleInfo.DP );
				}
				break;
			}
			case STAT_DODGE_PART:
			{
				m_pShuttleChild->m_myShuttleInfo.GearStat.DodgePart = pMsg->ChangeValue_2;
				break;
			}
		}
		m_pShuttleChild->m_myShuttleInfo.BonusStat = pMsg->RemainedAmountOfStat;
		m_pSound->PlayD3DSound(SOUND_STAT_UP, g_pShuttleChild->m_vPos, FALSE);
	}
*/
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeTotalGearStat(MSG_FC_CHARACTER_CHANGE_TOTALGEAR_STAT * pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-03-04 ~ 2005-03-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeTotalGearStat(MSG_FC_CHARACTER_CHANGE_TOTALGEAR_STAT * pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeStat(MSG_FC_CHARACTER_CHANGE_STAT * pMsg)");
	if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		m_pShuttleChild->m_myShuttleInfo.TotalGearStat = pMsg->GearStat1;

		// 2007-05-15 by bhsohn 기어 스탯 관련 처리
		// 실제 유닛 풀 스탯 
		m_pShuttleChild->SetMyShuttleFullStatInfo(pMsg->GearStat1);
		// 최대치 COUNT_MAX_STAT_POINT 못 넘게 변경
		m_pShuttleChild->ReformMyShuttleStatInfo(&m_pShuttleChild->m_myShuttleInfo.TotalGearStat);

		// 엔진 아이템 검사
		CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByWindowPos( POS_REAR );
		if( pItemInfo )
		{
			if( pItemInfo->GetRealItemInfo()->ReqGearStat.DodgePart > m_pShuttleChild->m_myShuttleInfo.TotalGearStat.DodgePart )
			{
				// 엔진을 내린다.
				// send item windowNumber (socket)
				MSG_FC_ITEM_CHANGE_WINDOW_POSITION sMsg;
				sMsg.CharacterUniqueNumber = g_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber;
				sMsg.FromItemUniqueNumber = pItemInfo->UniqueNumber;
				sMsg.FromItemWindowIndex = pItemInfo->ItemWindowIndex;
				sMsg.ToItemUniqueNumber = 0;
				sMsg.ToItemWindowIndex = 9999;
				g_pFieldWinSocket->SendMsg( T_FC_ITEM_CHANGE_WINDOW_POSITION, (char*)&sMsg, sizeof(sMsg) );
//				g_pD3dApp->m_bRequestEnable = FALSE;			// 2006-06-19 by ispark, 메세지 응답을 기다린다.
			}
		}
	}

}



///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemChangeWindowPositionOk(MSG_FC_ITEM_CHANGE_WINDOW_POSITION_OK * pMsg)
/// \brief		MSG_FC_ITEM_CHANGE_WINDOW_POSITION_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketItemChangeWindowPositionOk(MSG_FC_ITEM_CHANGE_WINDOW_POSITION_OK * pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemChangeWindowPositionOk(MSG_FC_ITEM_CHANGE_WINDOW_POSITION_OK * pMsg)");
	g_pStoreData->ItemChangeWindowPosition( pMsg );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMoveLandingOk(MSG_FC_MOVE_LANDING_OK* pMsg)
/// \brief		MSG_FC_MOVE_LANDING_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveLandingOk(MSG_FC_MOVE_LANDING_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMoveLandingOk(MSG_FC_MOVE_LANDING_OK* pMsg)");
	BOOL bObjectLanging = 
		(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind)==FALSE ||
		IsTileMapRenderEnable(g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex) == FALSE) ? TRUE : FALSE;
	if(m_pShuttleChild->SetOrderMoveTargetPos(bObjectLanging) == FALSE)// 유닛의 착륙지점 좌표 계산
	{
		m_pShuttleChild->ChangeUnitState( _TAKINGOFF );
		return;
	}
		
	m_pShuttleChild->m_vNextPos = A2DX(pMsg->Position);
	m_pShuttleChild->ChangeUnitState( _LANDING );
	m_pShuttleChild->ChangeSingleBodyCondition( BODYCON_LANDING_MASK);
	//m_pShuttleChild->m_dwState = _LANDING;
	m_pShuttleChild->m_bOrderMove = TRUE;
	m_pShuttleChild->m_fLandingCheckTime = 4.0f;
	m_pShuttleChild->m_fLandingDist = m_pShuttleChild->m_vPos.y - m_pShuttleChild->m_vTargetPos.y;
	if(m_pShuttleChild->m_fLandingDist < 200.0f)
		m_pShuttleChild->m_bOrderMoveType = 1;//직선 착륙
	else
		m_pShuttleChild->m_bOrderMoveType = 2;// 회전 착륙

	// 카메라 패턴 생성 2004.06.30 jschoi
	g_pShuttleChild->InitCinemaCamera(PATTERN_CAMERA_LANDING);	// PATTERN_CAMERA_LANDING
	m_pSound->PlayD3DSound( SOUND_LANDING, g_pShuttleChild->m_vPos, FALSE);

	DBGOUT("*****MSG_FC_MOVE_LANDING_OK\n");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMoveTakeOffOk(MSG_FC_MOVE_TAKEOFF_OK* pMsg)
/// \brief		MSG_FC_MOVE_TAKEOFF_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveTakeOffOk(MSG_FC_MOVE_TAKEOFF_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMoveTakeOffOk(MSG_FC_MOVE_TAKEOFF_OK* pMsg)");
	// 2006-06-29 by ispark 상점 상태로 되어 있다면 상점을 닫는다.
	if(g_pD3dApp->m_dwGameState == _SHOP)
	{
		g_pInterface->m_pCityBase->OnCityNPCButtonDown(CITY_NPC_BUTTON_CLOSE);
	}

	m_pShuttleChild->m_vNextPos = A2DX(pMsg->Position);
	m_pShuttleChild->ChangeUnitState( _TAKINGOFF );
	//m_pShuttleChild->m_dwState = _TAKINGOFF;
	m_pShuttleChild->m_bOrderMove = FALSE;
	m_pShuttleChild->m_nShuttleStopState = 0;
	
	// 2007-05-15 by bhsohn A기어 보완
	//m_pShuttleChild->m_fRasingCheckTime = 1.0f;
	m_pShuttleChild->m_fRasingCheckTime = m_pShuttleChild->GetRasingCheckTime();

//	if(m_dwGameState == _SHOP)
//	{
//		g_pInterface->m_pCityBase->OnCityNPCButtonDown(CITY_NPC_BUTTON_CLOSE);
//	}
	if( IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind) )
	{
		g_pShuttleChild->m_pSkill->ReleaseGroundSkill();
	}
	DBGOUT("T_FC_MOVE_TAKEOFF_OK\n");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemShowItem(MSG_FC_ITEM_SHOW_ITEM* pMsg)
/// \brief		MSG_FC_ITEM_SHOW_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemShowItem(MSG_FC_ITEM_SHOW_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemShowItem(MSG_FC_ITEM_SHOW_ITEM* pMsg)");
	if(pMsg->DropItemType == DROP_ITEM_TYPE_PICKUP)
	{
		m_pScene->AddFieldItemItemSHowItem( pMsg );
	}
	else
	{
		if(m_pScene->m_pWeaponData)
		{
			CAtumNode * pWeapon = m_pScene->m_pWeaponData->m_pChild;
			while(pWeapon)
			{
				if( pWeapon->m_dwPartType == _MINE && 
					((CWeaponMineData *)pWeapon)->m_nFieldItemIndex == pMsg->ItemFieldIndex)
				{
					DBGOUT("\nERROR:MSG_FC_ITEM_SHOW_ITEM\n");
					return ;
				}
				pWeapon = (CWeaponMineData *)pWeapon->m_pNext;
			}
			pWeapon = new CWeaponMineData(pMsg);
			pWeapon = (CWeaponMineData *)m_pScene->m_pWeaponData->AddChild(pWeapon);
		}
	}
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemGetItemOk(MSG_FC_ITEM_GET_ITEM_OK* pMsg)
/// \brief		MSG_FC_ITEM_GET_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemGetItemOk(MSG_FC_ITEM_GET_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemGetItemOk(MSG_FC_ITEM_GET_ITEM_OK* pMsg)");
	CItemData *pItem = m_pScene->FindFieldItemByFieldIndex( pMsg->ItemFieldIndex );
	if(pItem)
	{
		// Effect 추가해야함
		if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			char * p = (char *)(pMsg);
			p+=sizeof(MSG_FC_ITEM_GET_ITEM_OK);

			ITEM *item = m_pDatabase->GetServerItemInfo(pMsg->ItemNum);
			char buf[256];
			if(item)
			{
				if(IS_COUNTABLE_ITEM(item->Kind))// == ITEMKIND_ENERGY)
				{
					wsprintf(buf,STRMSG_C_ITEM_0059,item->ItemName,pMsg->Amount);//"%s(%d)을 습득 하였습니다."
					m_pChat->CreateChatChild(buf,COLOR_ITEM);
				}
				else
				{
					wsprintf(buf,STRMSG_C_ITEM_0060,item->ItemName);//"%s을 습득 하였습니다."
					m_pChat->CreateChatChild(buf,COLOR_ITEM);
				}				
			}
			g_pStoreData->PutItem(p);
			g_pGameMain->m_pInven->SetAllIconInfo();
			g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();
			pItem->m_pTarget = m_pShuttleChild;
			pItem->m_dwState = _EXPLODING;

			m_pSound->PlayD3DSound(SOUND_GET_ITEM, m_pShuttleChild->m_vPos, FALSE);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemHideItem(MSG_FC_ITEM_HIDE_ITEM* pMsg)
/// \brief		MSG_FC_ITEM_HIDE_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemHideItem(MSG_FC_ITEM_HIDE_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemHideItem(MSG_FC_ITEM_HIDE_ITEM* pMsg)");

	if(!m_pScene)
		return;					//2013-05-22 by ssjung 캐나다 익셉션 오류 예방 코드 추가
	
	CItemData *pItem = m_pScene->FindFieldItemByFieldIndex( pMsg->ItemFieldIndex );
	if(pItem)
	{
		// Effect 추가해야함
		if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			pItem->m_pTarget = g_pShuttleChild;
			pItem->m_dwState = _EXPLODING;
			// 2007-06-18 by dgwoo, 습득한 아이템의 ItemFieldIndex를 0으로 초기화 한다. 같은 ItemFieldIndex가 할당되었을때 해결을 위해서
			pItem->m_nItemIndex		= 0;		
			return ;
		}
		else if(IS_VALID_CLIENT_INDEX(pMsg->ClientIndex))
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				pItem->m_pTarget = itEnemy->second;
				pItem->m_dwState = _EXPLODING;
				return ;
			}
		}
		// 아이템 습득한 클라이언트가 없으면 아이템만 삭제
		pItem->m_bUsing = FALSE;
	}
/*	if(m_pItemData)
	{
		CItemData * pItem = (CItemData *)m_pItemData->m_pChild;
		while(pItem)
		{
			if(pItem->m_nItemIndex == pMsg->ItemFieldIndex)
			{
				// Effect 추가해야함
				if(IS_VALID_CLIENT_INDEX(pMsg->ClientIndex))
				{
					CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
					if(itEnemy != m_pScene->m_mapEnemyList.end())
					{
						pItem->m_pTarget = itEnemy->second;
						pItem->m_dwState = _EXPLODING;
						return ;
					}
				}
				// 아이템 습득한 클라이언트가 없으면 아이템만 삭제
				pItem->m_bUsing = FALSE;
				return ;
			}
			pItem = (CItemData *)pItem->m_pNext;
		}
	}
*/	
	if(m_pScene->m_pWeaponData)
	{
		CAtumNode * pWeapon = m_pScene->m_pWeaponData->m_pChild;
		while(pWeapon)
		{
			if( pWeapon->m_dwPartType == _MINE && 
				((CWeaponMineData *)pWeapon)->m_nFieldItemIndex == pMsg->ItemFieldIndex)
			{
				pWeapon->m_bUsing = FALSE;
				((CWeaponMineData *)pWeapon)->m_nFieldItemIndex = 0xFFFFFFFF;
				break;
			}
			pWeapon = (CWeaponMineData *)pWeapon->m_pNext;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyPutItemOther(MSG_FC_PARTY_PUT_ITEM_OTHER* pMsg)
/// \brief		MSG_FC_PARTY_PUT_ITEM_OTHER
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyPutItemOther(MSG_FC_PARTY_PUT_ITEM_OTHER* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyPutItemOther(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemGetItemFail(MSG_FC_ITEM_GET_ITEM_FAIL* pMsg)
/// \brief		MSG_FC_ITEM_GET_ITEM_FAIL
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemGetItemFail(MSG_FC_ITEM_GET_ITEM_FAIL* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemGetItemFail(MSG_FC_ITEM_GET_ITEM_FAIL* pMsg)");
	char strbuf[256];
	wsprintf(strbuf,STRMSG_C_ITEM_0061);//"해당 아이템을 습득 할 수 없습니다."
	m_pChat->CreateChatChild(strbuf,COLOR_ERROR);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMissileMoveOk(MSG_FC_MISSILE_MOVE_OK* pMsg)
/// \brief		MSG_FC_MISSILE_MOVE_OK, 사용하지 않음
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMissileMoveOk(MSG_FC_MISSILE_MOVE_OK* pMsg)
{

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCityRequestEnterBuildingOk(MSG_FC_CITY_REQUEST_ENTER_BUILDING_OK* pMsg)
/// \brief		건물(상점)으로 들어감(간소화 버전, 도시에서 간소하게 보냄)
/// \author		dhkwon
/// \date		2004-06-25 ~ 2004-06-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityRequestEnterBuildingOk(MSG_FC_CITY_REQUEST_ENTER_BUILDING_OK* pMsg)
{
	if(m_dwGameState == _CITY || pMsg->BuildingIndex == CASH_SHOP_BUILDING_INDEX)
	{
		// 2007-08-10 by dgwoo 캐쉬 상점에서도 아이템을 백업한다.
		if(g_pGameMain)
		{
			g_pGameMain->BackUpWearItem();
		}
//		m_pInterface->m_pCityBase->RecvCityRequestEnterBuildingOk(pMsg->BuildingIndex, pMsg->fCityWarTexRate);
		m_pInterface->m_pCityBase->RecvCityRequestEnterBuildingOk(pMsg->BuildingIndex, pMsg->fInflDistributionTexPercent);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventEnterBuilding(MSG_FC_EVENT_ENTER_BUILDING* pMsg)
/// \brief		MSG_FC_EVENT_ENTER_BUILDING
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventEnterBuilding(MSG_FC_EVENT_ENTER_BUILDING* pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventEnterBuilding(MSG_FC_EVENT_ENTER_BUILDING* pMsg)");
	MSG_FC_EVENT_ENTER_BUILDING_OK sMsg;
	sMsg.BuildingIndex = pMsg->BuildingNPCInfo.BuildingIndex;
	sMsg.SendShopItemList = FALSE;

	// 기존아이템 백업
	if( IS_PRIMARY_WEAPON(pMsg->BuildingNPCInfo.BuildingKind)	||
		IS_SECONDARY_WEAPON(pMsg->BuildingNPCInfo.BuildingKind) ||
		pMsg->BuildingNPCInfo.BuildingKind == BUILDINGKIND_TUNING_COLOR ||

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		pMsg->BuildingNPCInfo.BuildingKind == BUILDINGKIND_INFINITY_SHOP ||
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

		// 2007-06-28 by dgwoo 장착 아이템이 있는 상점에선 BackUp을 받아야한다.
		pMsg->BuildingNPCInfo.BuildingKind == BUILDINGKIND_WARPOINT_SHOP ||
		
		// 2013-11-29 by ymjoo 상점에서 클릭했던 아이템의 정보가 적용되는 현상 수정
		IS_ITEM_SHOP_TYPE(pMsg->BuildingNPCInfo.BuildingKind)
		)
	{
		g_pGameMain->BackUpWearItem();
	}
	
	// 2004-04-20 by dhkwon
	if(m_dwGameState == _CITY)
	{
		DBGOUT("MSG_FC_EVENT_ENTER_BUILDING : Can Not Use In City.\n");
	}
	else if(m_pTutorial->GetTutorialEd() == FALSE)	// 2005-11-14 by ispark 튜토리얼 끝난 상태라면 창을 열지 않는다.
	{
//		m_pShuttleChild->m_bEventReady = FALSE;
		if( m_pShuttleChild->m_dwState == _LANDING ||
			m_pShuttleChild->m_dwState == _LANDED ||
			// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
			//IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind)) 
		//{
			//m_pShuttleChild->ChangeUnitState( _LANDED );
			IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind) ||
			pMsg->BuildingNPCInfo.BuildingIndex == FIELD_STORE_SHOP_BUILDING_INDEX ||
			m_pShuttleChild->m_dwState==_NORMAL)				// 2011-11-01 by jhahn EP4 필드맵 상점 클릭
		{						
			if(pMsg->BuildingNPCInfo.BuildingIndex != FIELD_STORE_SHOP_BUILDING_INDEX)
			{
				if (m_pShuttleChild->m_bUnitStop == FALSE )		  // 2011-11-01 by jhahn EP4 필드맵 상점 클릭
				m_pShuttleChild->ChangeUnitState( _LANDED );			
			}
			//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템			
			// 2006-02-10 by ispark, 현재 세력선택 미션창이 떠 있다면 상점 열지 마세요
			// 2007-06-12 by bhsohn 미션 인터페이스 수정안
			//if(g_pGameMain->m_pMissionInfo->GetInfluenceMission() == TRUE)
			if(g_pGameMain->GetInfluenceMission() == TRUE)
			{
				return;
			}
			// 2007-07-20 by bhsohn 브리핑룸 수정
			//ChangeGameState(_SHOP);
			// 상점 초기화
			m_pInterface->m_pCityBase->RecvEventEnterBuilding(pMsg);
	//		m_pShuttleChild->ChangeUnitState( _NORMAL );				// 2011-11-01 by jhahn EP4 필드맵 상점 클릭
				
		}
		else
		{
			m_pInterface->m_pCityBase->SendLeaveEnterBuilding(pMsg->BuildingNPCInfo.BuildingIndex, -1);
		}
//		if(g_pGameMain && g_pGameMain->m_pShop)
//		{
//			g_pGameMain->m_pShop->InitData(pMsg/*pMsg->NPCTalkIndex*/);
//			if(g_pGameMain->m_nLeftWindowInfo != LEFT_WINDOW_SHOP)
//			{
//				g_pGameMain->LeftWindowShow( TRUE, LEFT_WINDOW_SHOP );
//			}
//		}
	}
	else if(m_pTutorial->GetTutorialEd() == TRUE)	// 2005-11-14 by ispark 튜토리얼이 끝난 상태였다면
	{
		// 2005-11-14 by ispark
		// 튜토리얼 끝난 후 보급 상점을 한번 막은 후 튜토리얼 끝난 상태를 푼다. 
		// 이유는 튜토리얼 끝난 후 보급 상점이 뜨는 것을 막았다. 이후에는 쓰도록 하기 위해서
		// 다음 코드를 작성한 것이다.
		g_pTutorial->SetTutorialEd(FALSE);
	}
	//MSG_FC_EVENT_ENTER_BUILDING_OK
//	m_pFieldWinSocket->SendMsg(T_FC_EVENT_ENTER_BUILDING_OK, (char*)&sMsg,sizeof(sMsg));
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventLeaveBuildingOk(MSG_FC_EVENT_LEAVE_BUILDING_OK* pMsg)
/// \brief		MSG_FC_EVENT_LEAVE_BUILDING_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventLeaveBuildingOk(MSG_FC_EVENT_LEAVE_BUILDING_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventLeaveBuildingOk(MSG_FC_EVENT_LEAVE_BUILDING_OK* pMsg)");
	// 2007-06-28 by dgwoo 장착 아이템이 있는 상점에선 BackUp을 받아야한다.
	if(g_pGameMain->m_bUseShopItem)
	{
		g_pInterface->SetShopItemUseSerch();
	}
	if(m_dwGameState == _CITY)
	{
		//g_pInterface->m_pCityBase->OnCityNPCButtonDown(CITY_NPC_BUTTON_CLOSE);
		g_pInterface->m_pCityBase->RecvLeaveBuildingOk();
	}
	else if(m_dwGameState != _GAME)
	{
//		if(m_dwGameState == _SHOP && g_pGameMain->m_pShop)
//		{
//			g_pGameMain->LeftWindowShow( TRUE, LEFT_WINDOW_WEAPON );
//		}
		g_pInterface->m_pCityBase->RecvLeaveBuildingOk();
		// 2007-07-20 by bhsohn 브리핑룸 수정
		if(_MAPLOAD != GetGameState())
		{
			ChangeGameState(_GAME);
		}
		// 상점에 다시 들어가지 않게 조절 한다.
//		m_pShuttleChild->m_fEventCheckTime = 2.0f;
//		m_pShuttleChild->m_bEventReady = TRUE;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopPutItemHeader(MSG_FC_SHOP_PUT_ITEM_HEADER* pMsg)
/// \brief		MSG_FC_SHOP_PUT_ITEM_HEADER, 아무일도 안함
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopPutItemHeader(MSG_FC_SHOP_PUT_ITEM_HEADER* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopPutItemHeader(MSG_FC_SHOP_PUT_ITEM_HEADER* pMsg)");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopPutItem(MSG_FC_SHOP_PUT_ITEM* pMsg)
/// \brief		MSG_FC_SHOP_PUT_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopPutItem(MSG_FC_SHOP_PUT_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopPutItem(MSG_FC_SHOP_PUT_ITEM* pMsg)");
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();

	// 2014-02-07 by ymjoo 캡슐형 캐시 아이템 경고 메세지
#if defined C_CAPSULE_CASH_ITEM_MESSAGE_YMJOO
	int nBuildingKind;
	if(_MAPLOAD == GetGameState())
	{
		
		int size = pMsg->BytesToRead;
		char * p = (char *)pMsg;
		p += sizeof(MSG_FC_SHOP_PUT_ITEM);
		while(size)
		{
			int usebyte = g_pStoreData->InputCashItem(p);
			p += usebyte;
			size -= usebyte;
			if(size < 0)
			{
				DBGOUT("ERROR : CAtumApplication::MsgProc(), Shop Item \n");
				break;//err;
			}
		}
		return;
	}
	else
	{
		if(pBuilding == NULL)
		{
			return;
		}
		nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	}
#else
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
#endif
	// END 2014-02-07 by ymjoo 캡슐형 캐시 아이템 경고 메세지

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}

	int size = pMsg->BytesToRead;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_SHOP_PUT_ITEM);
	while(size)
	{
		int usebyte = 0;
		if(IS_ITEM_SHOP_TYPE(nBuildingKind))
		{
			usebyte = ((CINFCityShop*)it->second)->InputItem(p);
		}
		else if(IS_SKILL_SHOP_TYPE(nBuildingKind))
		{
			usebyte = ((CINFCitySkillShop*)it->second)->InputItem(p);
		}
		else if(IS_CASH_SHOP_TYPE(nBuildingKind))
		{
			usebyte = ((CINFCityCashShop*)it->second)->InputItem(p);
		}
		else if(IS_WARPOINT_SHOP_TYPE(nBuildingKind))
		{
			usebyte = ((CINFCityWarPointShop*)it->second)->InputItem(p);
		}
		else
		{
			DBGOUT("ERROR : CAtumApplication::MsgProc(), Shop Item \n");
		}
		p += usebyte;
		size -= usebyte;
		if(size < 0)
		{
			DBGOUT("ERROR : CAtumApplication::MsgProc(), Shop Item \n");
			break;//err;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopPutItemDone(MSG_FC_SHOP_PUT_ITEM_DONE* pMsg)
/// \brief		MSG_FC_SHOP_PUT_ITEM_DONE
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopPutItemDone(MSG_FC_SHOP_PUT_ITEM_DONE* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopPutItemDone(MSG_FC_SHOP_PUT_ITEM_DONE* pMsg)");
//	if(m_dwGameState == _CITY)
//	{
		if(g_pInterface->m_pCityBase->GetCurrentBuildingNPC())
		{
			int nBuildingKind = g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind;
			CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
			if(it != g_pInterface->m_pCityBase->m_mapCityShop.end())
			{
				if(IS_ITEM_SHOP_TYPE(nBuildingKind))
				{
					((CINFCityShop*)it->second)->InputItemDone();
				}
				else if(IS_SKILL_SHOP_TYPE(nBuildingKind))
				{
					((CINFCitySkillShop*)it->second)->InputItemDone();
				}
				else if(IS_CASH_SHOP_TYPE(nBuildingKind))
				{
					((CINFCityCashShop*)it->second)->InputItemDone();
					// 2009-01-28 by bhsohn 캐쉬샵 처리
					((CINFCityCashShop*)it->second)->InputCashColorShopItem();
					// end 2009-01-28 by bhsohn 캐쉬샵 처리

// 2013-09-25 by ssjung 캐쉬샾 추천탭 과 일반탭의 순서 관련 사항 수정
					((CINFCityCashShop*)it->second)->RecommendItemSort();	//추천탭 정렬 
// end 2013-09-25 by ssjung 캐쉬샾 추천탭 과 일반탭의 순서 관련 사항 수정
				}
				else if(IS_WARPOINT_SHOP_TYPE(nBuildingKind))
				{
					((CINFCityWarPointShop*)it->second)->InputItemDone();
				}
				else
				{
					DBGOUT("ERROR : CAtumApplication::MsgProc(), Shop Item \n");
				}
				
				DBGOUT("Request Shop Item Info Done(%d)\n",pMsg->NumOfItem);
			}
			else
			{
				DBGOUT("ERROR : CAtumApplication::FieldSocketShopPutItemDone(%d)\n", nBuildingKind);
			}

			// 2007-08-10 by dgwoo 캐쉬상점에서 컬러아이템 셋팅.
			// 2009-01-28 by bhsohn 캐쉬샵 처리
// 			if(IS_CASH_SHOP_TYPE(nBuildingKind))
// 			{
// 				((CINFCityCashShop*)it->second)->InputCashColorShopItem();
// 			}
			// end 2009-01-28 by bhsohn 캐쉬샵 처리
		}
//	}
//	else
//	{
//		g_pGameMain->m_pShop->InputItemDone();
//	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopGetItemInfoOk(MSG_FC_SHOP_GET_ITEMINFO_OK* pMsg)
/// \brief		MSG_FC_SHOP_GET_ITEMINFO_OK, 아무일도 안함
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopGetItemInfoOk(MSG_FC_SHOP_GET_ITEMINFO_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopGetItemInfoOk(MSG_FC_SHOP_GET_ITEMINFO_OK* pMsg)");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopBuyItemOk(MSG_FC_SHOP_BUY_ITEM_OK* pMsg)
/// \brief		MSG_FC_SHOP_BUY_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopBuyItemOk(MSG_FC_SHOP_BUY_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopBuyItemOk(MSG_FC_SHOP_BUY_ITEM_OK* pMsg)");
	// 2002.10.14, 아이템창(돈)
	g_pGameMain->m_pInven->SetItemSpi(pMsg->RemainedMoney);

	// 2005-03-07 by jschoi
	g_pD3dApp->m_bRequestEnable = TRUE;
	g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
	CityShopLock(FALSE);		// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정

	char* p = (char*)pMsg;
	p += sizeof(MSG_FC_SHOP_BUY_ITEM_OK);
	int size = pMsg->SizeOfItem;
	while(size > 0)
	{
		int temp = g_pStoreData->PutItem(p);
		if(IS_SKILL_ITEM(((ITEM_BASE*)p)->Kind))
		{
			CAppEffectData * pEff = new CAppEffectData(m_pShuttleChild,RC_EFF_GET_SKILL,D3DXVECTOR3(0,0,0));
			m_pEffectList->AddChild(pEff);
			CINFCitySkillShop * pShop = (CINFCitySkillShop*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_SKILL_SHOP);
			if(pShop)
			{
				pShop->ReloadSkillItemList();
			}
		}
		size -= temp;
		p += temp;
		if(size < 0)
		{
			m_pChat->CreateChatChild(STRMSG_C_ITEM_0062,COLOR_ERROR);//"Buy Item 받는 중 Size(-) 오류"
			break;//err;
		}
	}
	// 2003.10.10
	g_pGameMain->m_pInven->SetAllIconInfo();
	g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopSellItemOk(MSG_FC_SHOP_SELL_ITEM_OK* pMsg)
/// \brief		MSG_FC_SHOP_SELL_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopSellItemOk(MSG_FC_SHOP_SELL_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopSellItemOk(MSG_FC_SHOP_SELL_ITEM_OK* pMsg)");
//	g_pStoreData->SetItemNumber( pMsg->ItemUniqueNumber, pMsg->RemainedNumOfItem);
	g_pStoreData->UpdateItemCount( pMsg->ItemUniqueNumber, pMsg->RemainedNumOfItem);

	// 2002.10.14, 아이템창(돈)
	g_pGameMain->m_pInven->SetItemSpi(pMsg->RemainedMoney);

	//m_pShuttleChild->ResortingItem();
	//m_pShuttleChild->SetShuttleData(5);
	// 2003.10.10
	//g_pGameMain->m_pInven->SetAllIconInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopGetUsedItemPriceOk(MSG_FC_SHOP_GET_USED_ITEM_PRICE_OK* pMsg)
/// \brief		MSG_FC_SHOP_GET_USED_ITEM_PRICE_OK, 아무일도 안함
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopGetUsedItemPriceOk(MSG_FC_SHOP_GET_USED_ITEM_PRICE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketShopGetUsedItemPriceOk(MSG_FC_SHOP_GET_USED_ITEM_PRICE_OK* pMsg)");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseEnergyOk(MSG_FC_ITEM_USE_ENERGY_OK*)
/// \brief		MSG_FC_ITEM_USE_ENERGY_OK
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseEnergyOk(MSG_FC_ITEM_USE_ENERGY_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseEnergyOk(MSG_FC_ITEM_USE_ENERGY_OK* pMsg)");

	ITEM * pIteminfo = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
	if(pIteminfo->Kind == ITEMKIND_ENERGY)
	{
		// 2009-04-21 by bhsohn 아이템 DesParam추가
		//switch(pIteminfo->DestParameter1)
		switch(pIteminfo->ArrDestParameter[0])
		{
		case DES_IMMEDIATE_HP_UP:
			{
				if(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.HP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentHP)
				{
					CAppEffectData * pEff = NULL; 
					int nEffNum = RC_EFF_USEITEM_REPAIR_HP;
					switch(pMsg->ItemNum)
					{
					case  ITEM_NUM_APLUS_GRADE_HP_KIT:		nEffNum = RC_EFF_USEITEM_REPAIR_HPA;	break;
					case  ITEM_NUM_S_GRADE_HP_KIT:			nEffNum = RC_EFF_USEITEM_REPAIR_HPS;	break;
					// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKIII:
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKII:
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKI:
						nEffNum = RC_EFF_USEITEM_REPAIR_HPS;
						break;
					case ITEM_NUM_DEUS_EX_MACHINA_MKIII:
					case ITEM_NUM_DEUS_EX_MACHINA_MKII:
					case ITEM_NUM_DEUS_EX_MACHINA_MKI:
						nEffNum = RC_EFF_USEITEM_REPAIR_DPS;
						break;
					// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					}

					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_HP, g_pShuttleChild->m_vPos, FALSE);
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = nEffNum;
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}
				// 2008-08-27 by bhsohn HP/DP동시에 차는 아이템 추가
				// 2009-04-21 by bhsohn 아이템 DesParam추가
				//if((DES_IMMEDIATE_DP_UP == pIteminfo->DestParameter2) 
				if((DES_IMMEDIATE_DP_UP == pIteminfo->ArrDestParameter[1]) 
					&& (g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.DP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentDP)
					&& (!g_pShuttleChild->m_pSkill->IsShieldParalyze())) // 쉴드 마비 안걸렸을떄만
				{
					CAppEffectData * pEff = NULL;
					int nEffNum = RC_EFF_USEITEM_REPAIR_DP;
					switch(pMsg->ItemNum)
					{
						case  ITEM_NUM_APLUS_GRADE_DP_KIT:		nEffNum = RC_EFF_USEITEM_REPAIR_DPA;	break;
						case  ITEM_NUM_S_GRADE_DP_KIT:			nEffNum = RC_EFF_USEITEM_REPAIR_DPS;	break;
						// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKIII:
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKII:
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKI:
							nEffNum = RC_EFF_USEITEM_REPAIR_HPS;
							break;
						case ITEM_NUM_DEUS_EX_MACHINA_MKIII:
						case ITEM_NUM_DEUS_EX_MACHINA_MKII:
						case ITEM_NUM_DEUS_EX_MACHINA_MKI:
							nEffNum = RC_EFF_USEITEM_REPAIR_DPS;
							break;
						// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					}

					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_DP, g_pShuttleChild->m_vPos, FALSE);
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = nEffNum;
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}				
				// end 2008-08-27 by bhsohn HP/DP동시에 차는 아이템 추가
			}
			break;
		case DES_IMMEDIATE_DP_UP:
			{
				if(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.DP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentDP)
				{
					CAppEffectData * pEff = NULL;
					int nEffNum = RC_EFF_USEITEM_REPAIR_DP;
					switch(pMsg->ItemNum)
					{
						case  ITEM_NUM_APLUS_GRADE_DP_KIT:		nEffNum = RC_EFF_USEITEM_REPAIR_DPA;	break;
						case  ITEM_NUM_S_GRADE_DP_KIT:			nEffNum = RC_EFF_USEITEM_REPAIR_DPS;	break;
						// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKIII:
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKII:
						case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKI:
							nEffNum = RC_EFF_USEITEM_REPAIR_HPS;
							break;
						case ITEM_NUM_DEUS_EX_MACHINA_MKIII:
						case ITEM_NUM_DEUS_EX_MACHINA_MKII:
						case ITEM_NUM_DEUS_EX_MACHINA_MKI:
							nEffNum = RC_EFF_USEITEM_REPAIR_DPS;
							break;
						// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					}

					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_DP, g_pShuttleChild->m_vPos, FALSE);
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = nEffNum;
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}
				// 2008-08-27 by bhsohn HP/DP동시에 차는 아이템 추가
				// 2009-04-21 by bhsohn 아이템 DesParam추가
				//if((DES_IMMEDIATE_HP_UP == pIteminfo->DestParameter2)
				if((DES_IMMEDIATE_HP_UP == pIteminfo->ArrDestParameter[1])
					&&(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.HP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentHP))
				{
					CAppEffectData * pEff = NULL; 
					int nEffNum = RC_EFF_USEITEM_REPAIR_HP;
					switch(pMsg->ItemNum)
					{
					case  ITEM_NUM_APLUS_GRADE_HP_KIT:		nEffNum = RC_EFF_USEITEM_REPAIR_HPA;	break;
					case  ITEM_NUM_S_GRADE_HP_KIT:			nEffNum = RC_EFF_USEITEM_REPAIR_HPS;	break;
						// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKIII:
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKII:
					case ITEM_NUM_NEUTRON_RECHARGEABLE_BATTERY_MKI:
						nEffNum = RC_EFF_USEITEM_REPAIR_HPS;
						break;
					case ITEM_NUM_DEUS_EX_MACHINA_MKIII:
					case ITEM_NUM_DEUS_EX_MACHINA_MKII:
					case ITEM_NUM_DEUS_EX_MACHINA_MKI:
						nEffNum = RC_EFF_USEITEM_REPAIR_DPS;
						break;
					// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					}

					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_HP, g_pShuttleChild->m_vPos, FALSE);
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = nEffNum;
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}
				// end 2008-08-27 by bhsohn HP/DP동시에 차는 아이템 추가
				
			}
			break;
		case DES_IMMEDIATE_EP_UP:
			{
				if(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.EP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentEP)
				{
					// 현재 사운드 없음
					CAppEffectData * pEff = NULL;
					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_HP, g_pShuttleChild->m_vPos, FALSE);
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,RC_EFF_USEITEM_REPAIR_EP,D3DXVECTOR3(0,0,0));
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = RC_EFF_USEITEM_REPAIR_EP;
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}
			}
			break;
			// 2006-01-17 by ispark, SP 이펙트 추가
		case DES_IMMEDIATE_SP_UP:
			{
				if(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.HP > g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CurrentHP)
				{
					CAppEffectData * pEff = NULL; 
					MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
					sMsg.EffectIndex = pMsg->ItemNum;
//					sMsg.EffectIndex = RC_EFF_USEITEM_REPAIR_SP;
//					switch(pMsg->ItemNum)
//					{
//					case  ITEM_NUM_APLUS_GRADE_HP_KIT:		nEffNum = RC_EFF_USEITEM_REPAIR_HPA;	break;
//					case  ITEM_NUM_S_GRADE_HP_KIT:			nEffNum = RC_EFF_USEITEM_REPAIR_HPS;	break;
//					}
					g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_HP, g_pShuttleChild->m_vPos, FALSE);

					// 2012-02-23 by jhahn  SP키트 이팩트 버그 수정
					//pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,pMsg->so,D3DXVECTOR3(0,0,0));
					ITEM*	pShapeItem	= g_pDatabase->GetServerItemInfo( pMsg->ItemNum );
					pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,pShapeItem->SourceIndex,D3DXVECTOR3(0,0,0));
					// end 2012-02-23 by jhahn  SP키트 이팩트 버그 수정
					
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
				}
			}
			break;
		case DES_CASH_CRACKER_CARD:
			{
				CAppEffectData * pEff = NULL;
				int nEffNum = RC_EFF_USEITEM_REPAIR_EP;

//				g_pD3dApp->m_pSound->PlayD3DSound(SOUND_USEITEM_REPAIR_DP, g_pShuttleChild->m_vPos, FALSE);
				pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
				pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
				MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
				sMsg.EffectIndex = nEffNum;
				g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
			}
			break;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseItemOk(MSG_FC_ITEM_USE_ITEM_OK*)
/// \brief		MSG_FC_ITEM_USE_ITEM_OK
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseItemOk(MSG_FC_ITEM_USE_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseItemOk(MSG_FC_ITEM_USE_ITEM_OK* pMsg)");

	PopupGetCollectionInfo(pMsg->ItemNum); // 얻은 아머 컬렉션 정보 // 2013-06-26 by bhsohn 아머 컬렉션 추가 개발

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseCarditemGuildNotify(MSG_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY*)
/// \brief		MSG_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCarditemGuildNotify(MSG_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCarditemGuildNotify(MSG_FC_ITEM_USE_CARDITEM_GUILD_NOTIFY* pMsg)");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseCarditemDeleteAllEnchant(MSG_FC_ITEM_DELETE_ALL_ENCHANT* pMsg)
/// \brief		MSG_FC_ITEM_DELETE_ALL_ENCHANT
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCarditemDeleteAllEnchant(MSG_FC_ITEM_DELETE_ALL_ENCHANT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCarditemDeleteAllEnchant(MSG_FC_ITEM_DELETE_ALL_ENCHANT* pMsg)");
	CINFCityLab* pBuidling = (CINFCityLab*)g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
	if(pBuidling)
	{
		CItemInfo *pInfo = pBuidling->GetTargetItemInfo();
		// 2015-05-29 by jwlee 연구소 UI 변경
// 		if(pInfo)
// 		{
// 			pInfo->DeleteEnchantInfo();
// 		}
// 		else
// 		{
// 			CItemInfo *pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUniqueNumber);
// 			if(pItemInfo)
// 			{
// 				pItemInfo->DeleteEnchantInfo();
// 			}
// 		}
#if defined(C_LABORATORY_UI_CHANGE_JWLEE)
		CItemInfo *pInfo2 = pBuidling->GetSTargetItemInfo();
		if(pInfo2)
		{
			pInfo2->DeleteEnchantInfo();
		}
		else if (pInfo)
		{
			pInfo->DeleteEnchantInfo();
		}
		else
		{
			CItemInfo *pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUniqueNumber);
			if(pItemInfo)
			{
				pItemInfo->DeleteEnchantInfo();
			}
		}
#else
		if(pInfo)
		{
			pInfo->DeleteEnchantInfo();
		}
		else
		{
			CItemInfo *pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUniqueNumber);
			if(pItemInfo)
			{
				pItemInfo->DeleteEnchantInfo();
			}
		}
#endif
		// end 2015-05-29 by jwlee 연구소 UI 변경
	}


//	CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUniqueNumber);
//	if(pItemInfo)
//	{
//		pItemInfo->DeleteEnchantInfo();		
//	}
	DBGOUT("Delete Item Enchant\n");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketItemUseCardItemMonstersummonNotify(MSG_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY*)
/// \brief		MSG_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCardItemMonstersummonNotify(MSG_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCardItemMonstersummonNotify(MSG_FC_ITEM_USE_CARDITEM_MONSTERSUMMON_NOTIFY* pMsg)");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketItemUseCardItemChangecharacternameNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY*)
/// \brief		MSG_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCardItemChangecharacternameNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCardItemChangecharacternameNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME_NOTIFY* pMsg)");

	if(pMsg->notifyClientIdx == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		memset(g_pShuttleChild->m_myShuttleInfo.CharacterName, 0x00, strlen(g_pShuttleChild->m_myShuttleInfo.CharacterName));
		strcpy(g_pShuttleChild->m_myShuttleInfo.CharacterName, pMsg->szChangedCharacterName);
		ZERO_MEMORY(((CChatMoveData *)g_pShuttleChild->m_pIDChat->m_pChild)->m_szString);
		strcpy(((CChatMoveData *)g_pShuttleChild->m_pIDChat->m_pChild)->m_szString, pMsg->szChangedCharacterName);

		g_pGameMain->m_pSystem->m_bLogOffGameMessage	= TRUE;
		g_pGameMain->m_pSystem->m_bQuitGameMessage		= TRUE;
		g_pGameMain->m_pSystem->m_fLastTickSecTime		= 20.0f;
	}
	else
	{
		// 내캐릭터 이름 변경이 아니라면....
		MSG_IC_GUILD_GET_GUILD_INFO_OK * GuildTemp = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
		if(GuildTemp)
		{
			vector<structGuildInfo*>::iterator it = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberList()->begin();
			while(it != g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberList()->end())
			{
				if(0 == strcmp((*it)->MemberName,pMsg->szOriginCharacterName))
				{
					strcpy((*it)->MemberName,pMsg->szChangedCharacterName);
					char buf[256];
					ZERO_MEMORY(buf);

					wsprintf(buf, STRMSG_C_CARD_0013, pMsg->szOriginCharacterName, pMsg->szChangedCharacterName);//"여단원 \'%s\'님이 \'%s\'으로 캐릭명을 변경하였습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
				}
				it++;
			}
		}

	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketItemUseCardItemSkillinitializeNotify(MSG_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY*)
/// \brief		MSG_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCardItemSkillinitializeNotify(MSG_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCardItemSkillinitializeNotify(MSG_FC_ITEM_USE_CARDITEM_SKILLINITIALIZE_NOTIFY* pMsg)");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketItemUseCardItemChangepilotfaceNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY*)
/// \brief		MSG_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY
/// \author		ydkim
/// \date		2005-04-6
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCardItemChangepilotfaceNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseCardItemChangepilotfaceNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE_NOTIFY* pMsg)");
	if(pMsg->notifyClientIdx == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_bRequestEnable = TRUE;
		if(g_pShuttleChild)
		{
			g_pShuttleChild->m_myShuttleInfo.PilotFace = pMsg->pilotFace;	
		}
		if(m_pCharacterChild)
		{
			m_pCharacterChild->InitCharacterData();
		}
		g_pGameMain->m_pChangeCharactor->SetActive(FALSE);
		m_pChat->CreateChatChild(STRMSG_C_071121_0101,COLOR_SYSTEM);
	}
	else
	{
		CEnemyData * pEnemy;
		CMapEnemyIterator itEnemy = g_pScene->m_mapEnemyList.find(pMsg->notifyClientIdx);
		pEnemy = itEnemy->second;
		if(pEnemy)
		{
			pEnemy->m_infoCharacter.CharacterInfo.PilotFace = pMsg->pilotFace;
			pEnemy->SetPilotNumber(pMsg->pilotFace);
		}

	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemThrowAwayItemOk(MSG_FC_ITEM_THROW_AWAY_ITEM_OK* pMsg)
/// \brief		MSG_FC_ITEM_THROW_AWAY_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemThrowAwayItemOk(MSG_FC_ITEM_THROW_AWAY_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemThrowAwayItemOk(MSG_FC_ITEM_THROW_AWAY_ITEM_OK* pMsg)");
//	g_pStoreData->SetItemNumber( pMsg->ItemUniqueNumber, pMsg->RemainedNumOfItem);
	g_pStoreData->UpdateItemCount( pMsg->ItemUniqueNumber, pMsg->RemainedNumOfItem);
	//m_pShuttleChild->ResortingItem();
	//m_pShuttleChild->SetShuttleData(5);
	// 2003.10.10
	//g_pGameMain->m_pInven->SetAllIconInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseBuffOk(MSG_FC_ITEM_USE_INFLUENCE_BUFF_OK* pMsg)
/// \brief		아이템 버프 사용 OK
/// \author		ispark
/// \date		2006-04-24 ~ 2006-04-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseBuffOk(MSG_FC_ITEM_USE_INFLUENCE_BUFF_OK* pMsg)
{
	// 2008-01-05 by bhsohn 미션 보상 수정안
//	char buff[128] = {0,};	
// 	wsprintf(buff,STRMSG_C_060424_0000);		
// 	m_pChat->CreateChatChild(buff, COLOR_INFLUENCE);
	ITEM *pItem = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
	if(NULL == pItem)
	{
		return;
	}
	char buff[256] = {0,};
	memset(buff, 0x00, 256);
	// 2009-04-21 by bhsohn 아이템 DesParam추가
	//switch(pItem->DestParameter1)
	switch(pItem->ArrDestParameter[0])
	{
	case DES_ITEM_BUFF_INFLUENCE:
		{
			// "지도자가 < 버프아이템 > 을 사용하였습니다."
			wsprintf(buff,STRMSG_C_060424_0000);
		}
		break;
	case DES_ITEM_BUFF_PARTY:
		{
			// "\\y%s님이 편대 버프 아이템을 사용하였습니다."
			wsprintf(buff,STRMSG_C_090105_0201, pMsg->ItemUseCharacterName);
		}
		break;
	}
	if(strlen(buff) > 0)
	{
		m_pChat->CreateChatChild(buff, COLOR_INFLUENCE);
	}	
	// end 2008-01-05 by bhsohn 미션 보상 수정안
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseInfluenceGameEventOk(MSG_FC_ITEM_USE_INFLUENCE_GAMEEVENT_OK* pMsg);
/// \brief		아이템 세력 이벤트 OK
/// \author		ispark
/// \date		2006-04-24 ~ 2006-04-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseInfluenceGameEventOk(MSG_FC_ITEM_USE_INFLUENCE_GAMEEVENT_OK* pMsg)
{
	char buff[128] = {0,};
	wsprintf(buff,STRMSG_C_060424_0001);		
	m_pChat->CreateChatChild(buff, COLOR_INFLUENCE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketChatRegion(MSG_FC_CHAT_REGION* pMsg)
/// \brief		MSG_FC_CHAT_REGION
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketChatRegion(MSG_FC_CHAT_REGION* pMsg)
{
	FLOG("CAtumApplication::FieldSocketChatRegion(MSG_FC_CHAT_REGION* pMsg)");
	char strChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	memset(strChat, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4);
	char textbuf[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	memset(textbuf, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4);

	// 거부자 지역채팅 보이지 않기
	vector<Reject_t>::iterator it = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
	while(it != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
	{
		if(0 == stricmp(pMsg->FromCharacterName, it->szRejectName))
		{
			return;
		}
		it++;			
	}

	// 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정
	if(m_bInitFlag)
	{
		if(m_dwGameState == _MAPLOAD)			
	 	{
			return;
	 	}
	}
   // end 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정

	///////////////////////////////////////////////////////////
	//
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_CHAT_REGION);
	memcpy(strChat,p,size);
	//
	//////////////////////////////////////////////////////////

	int temp,temp2;
	CheckReadyStringFiltering(strChat,&temp,&temp2);
//	m_pAbuseFilter->AbuseFiltering(strChat,&temp,&temp2);
	wsprintf(textbuf,"[%s]:%s",pMsg->FromCharacterName,strChat);

	g_pGameMain->m_pUnitNameInfo->ChatCreateInfo( pMsg->MessageLength, strChat, pMsg->FromCharacterName);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketChatCashAll(MSG_FC_CHAT_CASH_ALL* pMsg)
/// \brief		MSG_FC_CHAT_CASH_ALL
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketChatCashAll(MSG_FC_CHAT_CASH_ALL* pMsg)
{
	FLOG("CAtumApplication::FieldSocketChatCashAll(MSG_FC_CHAT_CASH_ALL* pMsg)");
	
	char str[512];
	char strChat[512];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_CHAT_MAP);
	memcpy(strChat,p,size);
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(strChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(strChat,&temp,&temp2);
	wsprintf(str,"&[%s] %s",pMsg->FromCharacterName,strChat);//현재 맵 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_CASH, CHAT_TAB_CASH);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketChatMap(MSG_FC_CHAT_MAP* pMsg)
/// \brief		MSG_FC_CHAT_MAP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketChatMap(MSG_FC_CHAT_MAP* pMsg)
{
	FLOG("CAtumApplication::FieldSocketChatMap(MSG_FC_CHAT_MAP* pMsg)");

	// 거부자 지역채팅 보이지 않기
	vector<Reject_t>::iterator it = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
	while(it != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
	{
		if(0 == stricmp(pMsg->FromCharacterName, it->szRejectName))//(pMsg->FromCharacterName == it->szRejectName)
		{
			return;
		}
		it++;			
	}

	// 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정
	if(m_bInitFlag)
	{
		if(m_dwGameState == _MAPLOAD)			
		{
			return;
		}
	}
   // end 2013-07-02 유저가 처음 로딩 시 거부자 채팅 보이는 문제 수정

	char str[512];
	char strChat[512];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_CHAT_MAP);
	memcpy(strChat,p,size);
	int temp,temp2;
	CheckReadyStringFiltering(strChat,&temp,&temp2);
//	m_pAbuseFilter->AbuseFiltering(strChat,&temp,&temp2);
	wsprintf(str,"![%s] %s",pMsg->FromCharacterName,strChat);//현재 맵 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_MAP, CHAT_TAB_MAP);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketChatArena(MSG_FC_CHAT_ARENA* pMsg)
/// \brief		아레나 채팅.
/// \author		dgwoo
/// \date		2007-05-08 ~ 2007-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketChatArena(MSG_FC_CHAT_ARENA* pMsg)
{
	char str[512];
	char strChat[512];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_CHAT_ARENA);
	memcpy(strChat,p,size);
	int temp,temp2;
	CheckReadyStringFiltering(strChat,&temp,&temp2);

	// 2007-11-22 by bhsohn 아레나 통합서버	
	//wsprintf(str,"%[%s] %s",pMsg->FromCharacterName,strChat);//현재 맵 채팅	
	char szCharacterName[SIZE_MAX_ARENA_FULL_NAME];
	memset(szCharacterName, 0x00, SIZE_MAX_ARENA_FULL_NAME);
	strncpy(szCharacterName, pMsg->FromCharacterName, SIZE_MAX_CHARACTER_NAME);
	ConevertArenaRenderUserName(ARENA_STATE_ARENA_GAMING, szCharacterName);
	wsprintf(str,"%[%s] %s",szCharacterName,strChat);//현재 맵 채팅	
	// end 2007-11-22 by bhsohn 아레나 통합서버

	m_pChat->CreateChatChild(str,COLOR_ARENA, CHAT_TAB_ARENA);
}

// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
// 인피니티 입장 상점 채팅
VOID	CAtumApplication::FieldSocketChatInfinity( MSG_FC_CHAT_INFINITY* pMsg )
{
	char str[512];
	char strChat[512];
	BYTE size = pMsg->MessageLength;
	char* p = (char*)pMsg;
	p += sizeof(MSG_FC_CHAT_INFINITY);
	memcpy(strChat,p,size);
	int temp,temp2;
	CheckReadyStringFiltering(strChat,&temp,&temp2);

	char szCharacterName[SIZE_MAX_ARENA_FULL_NAME];
	memset(szCharacterName, 0x00, SIZE_MAX_ARENA_FULL_NAME);
	strncpy(szCharacterName, pMsg->FromCharacterName, SIZE_MAX_CHARACTER_NAME);
	ConevertArenaRenderUserName(ARENA_STATE_ARENA_GAMING, szCharacterName);
	wsprintf(str,"%[%s] %s",szCharacterName,strChat);

	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		((CINFCityInfinityField*)((*it).second))->AddChat( str );

	if( m_pInterface && m_pInterface->m_pInfinityPopup )
		m_pInterface->m_pInfinityPopup->AddChat( str );
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeRequestTradeOk(MSG_FC_TRADE_REQUEST_TRADE_OK* pMsg)
/// \brief		MSG_FC_TRADE_REQUEST_TRADE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeRequestTradeOk(MSG_FC_TRADE_REQUEST_TRADE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeRequestTradeOk(MSG_FC_TRADE_REQUEST_TRADE_OK* pMsg)");
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	BOOL bTradeFlag = g_pGameMain->m_pChat->m_bTradeFlag;
	if(bTradeFlag)
	{
		if(!g_pD3dApp->IsOptionEtc(OPTION_RADIO_EXCHANGE))
		{
			bTradeFlag = FALSE;
		}
	}
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리
	// 2003.10.14 거래
	//if(g_pGameMain->m_pChat->m_bTradeFlag == TRUE)
	if(bTradeFlag == TRUE)
	{
		// 거래 거부상태가 아니면
		// 2006-11-07 by ispark, 거절 리스트 체크
		vector<Reject_t>::iterator itReject = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
		while(itReject != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
		{
			if(0 == stricmp(pMsg->TradeSource, itReject->szRejectName))
			{
				g_pGameMain->m_pTrade->m_nTradeCharacterUniqueNumber = pMsg->TradeSourceCharacterUniqueNumber;
				g_pGameMain->m_pTrade->SendTradeReject();
				return;
			}
			itReject++;			
		}
	

		g_pGameMain->m_pTrade->RequestTrade(pMsg->TradeSource, pMsg->TradeSourceCharacterUniqueNumber);
	}
	else
	{
		// 거래 거부상태이면
		MSG_FC_TRADE_REJECT_TRADE sMsg;
		memset(&sMsg,0x00,sizeof(sMsg));
		char buffer[SIZE_MAX_PACKET];
		int nType = T_FC_TRADE_REJECT_TRADE;
		sMsg.TradeSourceCharacterUniqueNumber = pMsg->TradeSourceCharacterUniqueNumber;
		memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
		memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
		g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
		
		char buf[128];
		wsprintf(buf,STRMSG_C_TRADE_0010,pMsg->TradeSource);//"\\y거래거부상태 \\y%s님과 거래를 거부 하였습니다."
		m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeAcceptTradeOk(MSG_FC_TRADE_ACCEPT_TRADE_OK* pMsg)
/// \brief		MSG_FC_TRADE_ACCEPT_TRADE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeAcceptTradeOk(MSG_FC_TRADE_ACCEPT_TRADE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeAcceptTradeOk(MSG_FC_TRADE_ACCEPT_TRADE_OK* pMsg)");
	m_pChat->CreateChatChild(STRMSG_C_TRADE_0011,COLOR_TRADE);//"상대방이 거래를 수락 하였습니다."
	// 2003.10.14 거래
	g_pGameMain->m_pTrade->RecvTradeAccept(pMsg->TradeTarget, pMsg->TradeTargetCharacterUniqueNumber);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeRejectTradeOk(MSG_FC_TRADE_REJECT_TRADE_OK* pMsg)
/// \brief		MSG_FC_TRADE_REJECT_TRADE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeRejectTradeOk(MSG_FC_TRADE_REJECT_TRADE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeRejectTradeOk(MSG_FC_TRADE_REJECT_TRADE_OK* pMsg)");
	m_pChat->CreateChatChild(STRMSG_C_TRADE_0012,COLOR_TRADE);//"상대방이 거래를 거절 하였습니다."
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeRejectTrading(MSG_FC_TRADE_REJECT_TRADING* pMsg)
/// \brief		MSG_FC_TRADE_REJECT_TRADING
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeRejectTrading(MSG_FC_TRADE_REJECT_TRADING* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeRejectTrading(MSG_FC_TRADE_REJECT_TRADING* pMsg)");
	char message[256];
	wsprintf(message,STRMSG_C_TRADE_0013,pMsg->TradeTarget);//"%s 님은 현재 거래중입니다."
	m_pChat->CreateChatChild(message,COLOR_TRADE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeShowTradeWindow(MSG_FC_TRADE_SHOW_TRADE_WINDOW* pMsg)
/// \brief		MSG_FC_TRADE_SHOW_TRADE_WINDOW
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeShowTradeWindow(MSG_FC_TRADE_SHOW_TRADE_WINDOW* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeShowTradeWindow(MSG_FC_TRADE_SHOW_TRADE_WINDOW* pMsg)");
	// 2003.10.14, 거래
	if(g_pGameMain->m_nLeftWindowInfo != LEFT_WINDOW_TRANS)
		g_pGameMain->LeftWindowShow(TRUE, LEFT_WINDOW_TRANS);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeOkTradeOk(MSG_FC_TRADE_OK_TRADE_OK* pMsg)
/// \brief		MSG_FC_TRADE_OK_TRADE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeOkTradeOk(MSG_FC_TRADE_OK_TRADE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeOkTradeOk(MSG_FC_TRADE_OK_TRADE_OK* pMsg)");
	// 거래 성사
	m_pChat->CreateChatChild(STRMSG_C_TRADE_0014,COLOR_TRADE);//"거래가 완료 되었습니다."
	// 2003.10.14, 거래
	g_pGameMain->m_pTrade->EndTrade();

	// 2008-10-20 by bhsohn 거래시 창버그 수정
	g_pGameMain->m_pInven->ShowInven(NULL, NULL);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeCancelTradeOk(MSG_FC_TRADE_CANCEL_TRADE_OK* pMsg)
/// \brief		MSG_FC_TRADE_CANCEL_TRADE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeCancelTradeOk(MSG_FC_TRADE_CANCEL_TRADE_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeCancelTradeOk(MSG_FC_TRADE_CANCEL_TRADE_OK* pMsg)");
	// 거래창에 있는 아이템을 아이템창으로 이동한다.
	// 2003.20.14 거래
//	vector<CItemInfo*>::iterator it = g_pGameMain->m_pTrade->m_vecMyStore.begin();
//	while(it != g_pGameMain->m_pTrade->m_vecMyStore.end())
//	{
//		ITEM_GENERAL* pItem = (ITEM_GENERAL*)(*it);
//		g_pStoreData->PutItem((char *)pItem, TRUE);//update
//		it++;
//	}
//	g_pGameMain->m_pInven->SetItemSpi(g_pGameMain->m_pInven->GetItemSpi() +
//		g_pGameMain->m_pTrade->m_nMyStoreSpi);
//	m_pShuttleChild->ResortingItem();
//	m_pShuttleChild->SetShuttleData(5);
//	g_pGameMain->m_pInven->SetAllIconInfo();
//	g_pGameMain->m_pTrade->EndTrade();

	// 거래 취소
	g_pGameMain->m_pTrade->CancelTrade();
	m_pChat->CreateChatChild(STRMSG_C_TRADE_0015,COLOR_TRADE);//"거래가 취소 되었습니다."

	// 2008-10-20 by bhsohn 거래시 창버그 수정
	g_pGameMain->m_pInven->ShowInven(NULL, NULL);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeDeleteItem(MSG_FC_TRADE_DELETE_ITEM* pMsg)
/// \brief		MSG_FC_TRADE_DELETE_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeDeleteItem(MSG_FC_TRADE_DELETE_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeDeleteItem(MSG_FC_TRADE_DELETE_ITEM* pMsg)");
///	g_pStoreData->DeleteItemAndEnchant( pMsg->ItemUniqueNumber );
	DBGOUT("MSG_FC_TRADE_DELETE_ITEM\n");

	// 2006-07-31 by ispark, 개인 상점
	//if(pMsg->ItemDeletionType != g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
	// 잘못된 비교문 수정. 2010. 08. 02. by hsLee.
	if( pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber() )
	{
		CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
//		if(pItem && pMsg->ItemDeletionType == IUT_BAZAAR_SELL)
		if(pMsg->ItemDeletionType == IUT_BAZAAR_SELL)
		{
			g_pD3dApp->m_bRequestEnable = TRUE;
			g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
			char ShopResult[128] = {0,};
			if(g_pInterface->m_pBazaarShop)
			{
				// 오픈
				if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
				{
					// 2006-09-04 by ispark, 오픈은 인벤에 존재하지 않고 개인 상점 아이템 리스트에 있다.
					CItemInfo* pOpenItem = g_pInterface->m_pBazaarShop->GetShopItemInfo(pMsg->ItemUniqueNumber);
					if(IS_COUNTABLE_ITEM(pOpenItem->ItemInfo->Kind))
					{
						wsprintf(ShopResult, STRMSG_C_060803_0003, pOpenItem->ItemInfo->ItemName, pOpenItem->CurrentCount);
					}
					else
					{
						wsprintf(ShopResult, STRMSG_C_060803_0003, pOpenItem->ItemInfo->ItemName, 1);
					}

					m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM); 
				}
			}
		}
		else if(pItem && pMsg->ItemDeletionType == IUT_BAZAAR_BUY)
		{
			g_pD3dApp->m_bRequestEnable = TRUE;
			g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
			char ShopResult[128] = {0,};
			if(g_pInterface->m_pBazaarShop)
			{
				// 방문자
				if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
				{
					// 2006-09-01 by dgwoo 카운터블 아이템일땐 수량을 찍어준다.
					if(IS_COUNTABLE_ITEM(pItem->ItemInfo->Kind))
					{
						wsprintf(ShopResult, STRMSG_C_060803_0003, pItem->ItemInfo->ItemName, pItem->CurrentCount);
					}
					else
					{
						wsprintf(ShopResult, STRMSG_C_060803_0003, pItem->ItemInfo->ItemName, 1);
					}
					
					m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM); 
				}
			}
		}
		else if(pItem && pMsg->ItemDeletionType == IUT_ARENA_ITEM)
		{
			char buf[128];
			wsprintf(buf, STRMSG_C_070604_0101, pItem->ItemInfo->ItemName);
			m_pChat->CreateChatChild(buf, COLOR_SYSTEM); 
		}
	}

	// 2005-03-07 by jschoi
	if(pMsg->ItemDeletionType == IUT_SHOP)
	{
		g_pD3dApp->m_bRequestEnable = TRUE;
		g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
	}

	// 2010. 08. 02 by hsLee. 럭키 머신 카운터블 아이템 안 겹쳐지는 문제 수정.
	if ( pMsg->ItemDeletionType == IUT_LUCKY_ITEM )
	{
		CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);
		if ( pStore ) 
			pStore->SetDeletePrizeItem ( pMsg->ItemUniqueNumber );
	}

	// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
	if ( pMsg->ItemDeletionType == IUT_DISSOLUTION_ITEM )
	{
		CINFDissolution* pStore = (CINFDissolution*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_DISSOLUTION);
//  		if ( pStore ) 
//  			pStore->SetDeleteItem ( pMsg->ItemUniqueNumber );
	}
	// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현

	if(pMsg->ItemDeletionType == IUT_SKILL)
	{
		g_pShuttleChild->m_pSkill->DeleteSkill(pMsg->ItemUniqueNumber);
		if(g_pGameMain && g_pGameMain->m_pCharacterInfo)
		{
			g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();
		}
	}
	else
	{
		if( g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber ) != NULL )
		{
			if(pMsg->ItemDeletionType == IUT_QUEST)
			{
				CItemInfo* pItemInfo = 
					g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
				g_pStoreData->CreateChatOfItemUpdate( pItemInfo->ItemNum, 1, 0 ); // 삭제
			}
			g_pStoreData->DeleteItem( pMsg->ItemUniqueNumber );
			g_pGameMain->m_pInven->SetAllIconInfo();
		}
//		else if(m_dwGameState == _CITY)
		else
		{
			// 창고
			ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
			CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
			if(pStore)
			{
				if(pMsg->ItemUniqueNumber == pStore->GetItemSpiUniqueNumber() )
				{
					pStore->SetItemSpi( 0 );
				}
				else if( pStore->FindItemInfo( pMsg->ItemUniqueNumber ) != NULL )
				{
					pStore->DeleteItem( pMsg->ItemUniqueNumber ); // InputItemDone();
				}
			}
//			else
//			{
			// 인챈트
			CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
			if(pCityLab)
			{
				DBGOUT("Delete Enchant Item\n");
				pCityLab->DeleteTargetItem( pMsg->ItemUniqueNumber );
			}
			// 팩토리(조합)
			pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
			if(pCityLab)
			{
				pCityLab->DeleteTargetItem( pMsg->ItemUniqueNumber );
			}
//			}			
		}
		// 2007-02-28 by bhsohn 다중 판매시 0 spi에 대한 처리
		// 0원인 Item 은 삭제 한다. 
		UpdateMultiSellZeroSPIItem(pMsg->ItemUniqueNumber);		
	}
	

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeUpdateItemCount(MSG_FC_TRADE_UPDATE_ITEM_COUNT* pMsg)
/// \brief		MSG_FC_TRADE_UPDATE_ITEM_COUNT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeUpdateItemCount(MSG_FC_TRADE_UPDATE_ITEM_COUNT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeUpdateItemCount(MSG_FC_TRADE_UPDATE_ITEM_COUNT* pMsg)");
	// 2007-07-24 by dgwoo 튜토리얼 모드시 백업을 받은 상태라면 받아오는 아이템은 따로 처리.
	//if(g_pTutorial->IsTutorialMode())
	if(g_pStoreData->IsTutorialItemBackUp())
	{		
		m_vecTutorialUpdateItem.push_back(*pMsg);
		return;
	}
	switch(pMsg->ItemUpdateType)
	{
	case IUT_ENCHANT:
		{
			CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(  pMsg->ItemUniqueNumber );
// 2010. 04. 21 by jskim 신규 럭키 머신 구현
// 			if(pItemInfo)
// 			{
// 				CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
// 				if(pCityLab)
// 				{
// 					if(pMsg->NewCount == pItemInfo->CurrentCount)
// 					{
// 						pCityLab->DeleteTargetItem( pMsg->ItemUniqueNumber );
// 					}
// 					else
// 					{
// 						DBGOUT("ERROR\n");
// 					}
// 				}
// 			}
// 			else if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
// 			{
// 				g_pGameMain->m_pInven->SetItemSpi(pMsg->NewCount);
// 			}
// 			else // 아이템을 전부 올린 경우
// 			{
// 			}
			if(g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind == BUILDINGKIND_LUCKY_OPTION_MACHINE)
			{
				if(pItemInfo)
				{
					CINFOptionMachine * pOptionMachine = (CINFOptionMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY_OPTION_MACHINE);
					if(pOptionMachine)
					{
						if(pMsg->NewCount == pItemInfo->CurrentCount)
						{
							pOptionMachine->DeleteTargetItem( pMsg->ItemUniqueNumber );
						}

					}
				}
			}
			else if(g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind == BUILDINGKIND_LABORATORY)
			{
				if(pItemInfo)
				{
					CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
					if(pCityLab)
					{
						if(pMsg->NewCount == pItemInfo->CurrentCount)
						{
							pCityLab->DeleteTargetItem( pMsg->ItemUniqueNumber );
						}
						else
						{
							DBGOUT("ERROR\n");
						}
					}
				}
				else if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
				{
					g_pGameMain->m_pInven->SetItemSpi(pMsg->NewCount);
				}
				else // 아이템을 전부 올린 경우
				{
				}
			}
//end 2010. 04. 21 by jskim 신규 럭키 머신 구현
		}
		break;
	case IUT_MIXING:
		{
			CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(  pMsg->ItemUniqueNumber );
			if(pItemInfo)
			{
				CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
				if(pCityLab)
				{
					if(pMsg->NewCount - pItemInfo->CurrentCount > 0)
					{
						ITEM_GENERAL item;
						item = (ITEM_GENERAL)(*pItemInfo);
						item.CurrentCount = pMsg->NewCount - pItemInfo->CurrentCount;
						// 2013-04-08 by bhsohn 인게임 조합창 추가 구현
#ifdef C_INGAME_MIX_ITEM
						pCityLab->PutTargetItem(&item, TRUE);
#else			
						pCityLab->PutTargetItem(&item);
#endif
						DBGOUT("Mix Result : (MSG_FC_TRADE_UPDATE_ITEM_COUNT):ItemNum[%d],NewCount[%d]-CurrentCount[%d]\n",pItemInfo->ItemNum, pMsg->NewCount, pItemInfo->CurrentCount);
					}
					else if(pMsg->NewCount - pItemInfo->CurrentCount == 0)
					{
						pCityLab->DeleteTargetItem( pMsg->ItemUniqueNumber );
					}
				}
			}
			else if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
			{
				g_pGameMain->m_pInven->SetItemSpi(pMsg->NewCount);
			}
		}
		break;
	case IUT_TUTORIAL_PAY_ITEM:
	case IUT_GENERAL:
	case IUT_DROP_ITEM:
	case IUT_TRADE:
	case IUT_SHOP:
	case IUT_QUEST:
	case IUT_ADMIN:
	case IUT_BULLET:
	case IUT_LOADING:
	case IUT_AUCTION:	
// 	case IUT_ENCHANT:	
	case IUT_USE_ITEM:
	case IUT_INFLUENCEWAR_KILLER_BONUS:
	case IUT_BONUS_ITEM:
	case IUT_BAZAAR_SELL:
	case IUT_BAZAAR_BUY:
	default:
		{
			// 2005-08-19 by ispark
			if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
			{
				if(pMsg->ItemUpdateType == IUT_PENALTY_ON_DEAD)
				{
					// 수리비용
					char RepairPay[128];
					wsprintf(RepairPay, STRMSG_C_050819_0102, g_pGameMain->m_pInven->GetItemSpi() - pMsg->NewCount);
					m_pChat->CreateChatChild(RepairPay, COLOR_SYSTEM,CHAT_TAB_SYSTEM);
				}
				else if(pMsg->ItemUpdateType == IUT_PENALTY_AGEAR_FUEL_ALLIN)
				{
					// 이동비용
					char MovePay[128];
					wsprintf(MovePay, STRMSG_C_050819_0103, g_pGameMain->m_pInven->GetItemSpi() - pMsg->NewCount);
					m_pChat->CreateChatChild(MovePay, COLOR_SYSTEM,CHAT_TAB_SYSTEM); 
				}
				// 2006-08-03 by ispark, 개인상점
				else if(pMsg->ItemUpdateType == IUT_BAZAAR_SELL)
				{
					char SellPay[128];
					if(g_pInterface->m_pBazaarShop)
					{
						// 오픈
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							wsprintf(SellPay, STRMSG_C_060803_0002, pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi());	// "%d스피가 입금되었습니다."
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							wsprintf(SellPay, STRMSG_C_060803_0001, g_pGameMain->m_pInven->GetItemSpi() - pMsg->NewCount);	// "%d스피를 지불하였습니다."
						}
					}
					m_pChat->CreateChatChild(SellPay, COLOR_SYSTEM,CHAT_TAB_SYSTEM); 
				}
				else if(pMsg->ItemUpdateType == IUT_BAZAAR_BUY)
				{
					char BuyPay[128];
					if(g_pInterface->m_pBazaarShop)
					{
						// 오픈
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							wsprintf(BuyPay, STRMSG_C_060803_0001, g_pGameMain->m_pInven->GetItemSpi() - pMsg->NewCount);	// "%d스피를 지불하였습니다."
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							wsprintf(BuyPay, STRMSG_C_060803_0002, pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi());	// "%d스피가 입금되었습니다."
						}
					}
					m_pChat->CreateChatChild(BuyPay, COLOR_SYSTEM,CHAT_TAB_SYSTEM); 
				}
				else if(pMsg->ItemUpdateType == IUT_TUTORIAL_PAY_ITEM)
				{
					char buf[128];
					wsprintf(buf,STRMSG_C_QUEST_0039,STRMSG_C_QUEST_0019,pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi() );
					m_pChat->CreateChatChild(buf, COLOR_SKILL_USE,CHAT_TAB_SYSTEM); 
				}
				// 2008-08-27 by bhsohn 레벨업 이벤트시, 카운터블 아이템 스트링 안찍혔던 문제 수정
				// 2009-04-21 by bhsohn 인벤에 아이템 이벤트 지급시 메시지창 안찍히는 문제해결
				// 여기서 처리 안하고 TradeUpdateItemAddChat(pMsg)에서 일괄 처리하게 수정
//				else if(pMsg->ItemUpdateType == IUT_GIVEEVENTITEM)
// 				{
// 					char buff[128] = {0,};
// 					CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(  pMsg->ItemUniqueNumber );					
// 					int nCount = pMsg->NewCount;
// 					
// 					if(NULL == pItemInfo )
// 					{
// 						// SPI관리 
// 						int nUpdateSPI = pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi();
// 
// 						if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber()
// 							&&(nUpdateSPI > 0))
// 						{
// 							wsprintf(buff,STRMSG_C_ITEM_0002,nUpdateSPI);
// 							m_pChat->CreateChatChild(buff, COLOR_ITEM);		
// 						}
// 					}
// 					else
// 					{	
// 						nCount = pMsg->NewCount - pItemInfo->CurrentCount;						
// 						if(IS_COUNTABLE_ITEM(pItemInfo->ItemInfo->Kind))
// 						{
// 							wsprintf(buff,STRMSG_C_060904_0100,pItemInfo->ItemInfo->ItemName,
// 								nCount);
// 						}
// 						else
// 						{
// 							wsprintf(buff,STRMSG_C_060904_0100,pItemInfo->ItemInfo->ItemName,1);
// 						}
// 						m_pChat->CreateChatChild(buff, COLOR_ITEM);		
// 					}				
// 				}
				// end 2009-04-21 by bhsohn 인벤에 아이템 이벤트 지급시 메시지창 안찍히는 문제해결
				// end 2008-08-27 by bhsohn 레벨업 이벤트시, 카운터블 아이템 스트링 안찍혔던 문제 수정

		// 2013-11-29 by ssjung 거래소 구현
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
				else if(pMsg->ItemUpdateType == IUT_AUCTION)
				{
					char BuyPay[128] = {0,};
					if(g_pGameMain->m_pInven->GetItemSpi() > pMsg->NewCount)
						wsprintf(BuyPay, STRMSG_C_060803_0001, g_pGameMain->m_pInven->GetItemSpi() - pMsg->NewCount);	// "%d스피를 지불하였습니다."
					else
						wsprintf(BuyPay, STRMSG_C_060803_0002, pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi());	// "%d스피가 입금되었습니다."
					m_pChat->CreateChatChild(BuyPay, COLOR_SKILL_USE,CHAT_TAB_SYSTEM); 
				}
#endif
		// end 2013-11-29 by ssjung 거래소 구현
			}

			// 2006-07-31 by ispark, 개인 상점
			if(pMsg->ItemUpdateType == IUT_BAZAAR_SELL)
			{
				g_pD3dApp->m_bRequestEnable = TRUE;
				g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
				if(pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
				{
					char ShopResult[128] = {0,};
					CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
					if(g_pInterface->m_pBazaarShop && pItem)
					{
						// 오픈
						int nCount = 0;
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							int nBazaarShopItemCount = g_pInterface->m_pBazaarShop->GetShopItemCount(pMsg->ItemUniqueNumber);
							nCount = (pItem->CurrentCount + nBazaarShopItemCount) - pMsg->NewCount;
							wsprintf(ShopResult, STRMSG_C_060803_0003, pItem->ItemInfo->ItemName, nCount);
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							nCount = pMsg->NewCount - pItem->CurrentCount;
							wsprintf(ShopResult, STRMSG_C_060519_0000, pItem->ItemInfo->ItemName, nCount);
						}
						
						m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM,CHAT_TAB_SYSTEM);
					}
				}
			}
			else if(pMsg->ItemUpdateType == IUT_BAZAAR_BUY)
			{
				g_pD3dApp->m_bRequestEnable = TRUE;
				g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
				if(pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
				{
					char ShopResult[128] = {0,};
					CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
					if(g_pInterface->m_pBazaarShop && pItem)
					{
						// 오픈
						int nCount = 0;
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							nCount = pMsg->NewCount - pItem->CurrentCount;
							wsprintf(ShopResult, STRMSG_C_060519_0000, pItem->ItemInfo->ItemName, nCount);
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							nCount = pItem->CurrentCount - pMsg->NewCount;
							wsprintf(ShopResult, STRMSG_C_060803_0003, pItem->ItemInfo->ItemName, nCount);
						}

						m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM,CHAT_TAB_SYSTEM); 
					}
				}
			}
			
			// 2005-03-07 by jschoi
			if(pMsg->ItemUpdateType == IUT_SHOP)
			{
				g_pD3dApp->m_bRequestEnable = TRUE;
				g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;

				// 2006-05-19 by ispark, 구입
				if(pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
				{
					CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
					int nCount = pMsg->NewCount;
					if(pItem)
						nCount = pMsg->NewCount - pItem->CurrentCount;
					char ShopResult[128];
					if(nCount > 0)
					{
						wsprintf(ShopResult, STRMSG_C_060519_0000, pItem->ItemInfo->ItemName, nCount);
						m_pChat->CreateChatChild(ShopResult, COLOR_ITEM,CHAT_TAB_SYSTEM);	
					}
				}
			}

			// 2006-04-26 by ispark, 보너스 아이템
			// 2006-07-25 by ispark, 스피 처리 추가
			if(pMsg->ItemUpdateType == IUT_BONUS_ITEM)
			{
				if(pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber())	
				{
					char buff[128];
					ZERO_MEMORY(buff);
					CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
					if(pItem)
					{
						int nCount = pMsg->NewCount - pItem->CurrentCount;
						wsprintf(buff,STRMSG_C_ITEM_0006, pItem->ItemInfo->ItemName, nCount);
						m_pChat->CreateChatChild(buff, COLOR_ITEM,CHAT_TAB_SYSTEM);		
					}
				}
			}
			// 2008-11-25 by dgwoo 럭키 머신.
			if(pMsg->ItemUpdateType == IUT_LUCKY_ITEM)
			{
				CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);					
				pStore->SetPrizeItem(pMsg);
				break;
			}
			
			// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
			if(pMsg->ItemUpdateType == IUT_DISSOLUTION_ITEM)
			{
				CINFDissolution* pStore = (CINFDissolution*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_DISSOLUTION);					
				pStore->SetTakeItem(pMsg);
				break;
			}
			// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현

			// 2009-04-21 by bhsohn 인벤에 아이템 이벤트 지급시 메시지창 안찍히는 문제해결
			// 여기서 아이템 지급 스트링을 찍어주자
			TradeUpdateItemAddChat(pMsg);				
			// end 2009-04-21 by bhsohn 인벤에 아이템 이벤트 지급시 메시지창 안찍히는 문제해결

			if(pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber())
			{
				if( pMsg->ItemUpdateType == IUT_QUEST ||
					pMsg->ItemUpdateType == IUT_DROP_ITEM ||
					pMsg->ItemUpdateType == IUT_INFLUENCEWAR_KILLER_BONUS ||
					pMsg->ItemUpdateType == IUT_BONUS_ITEM)									// 2006-07-25 by ispark
				{
					g_pStoreData->CreateChatOfItemUpdate( MONEY_ITEM_NUMBER, 
						g_pGameMain->m_pInven->GetItemSpi(), pMsg->NewCount );
				}
				// 2008-12-30 by bhsohn 전쟁보상추가 기획안
				else if((pMsg->ItemUpdateType == IUT_WAR_CONTRIBUTION)
					||(pMsg->ItemUpdateType == IUT_WAR_CONTRIBUTION_LEADER))
				{
					CreateChatWarContribution(pMsg->ItemUpdateType, g_pGameMain->m_pInven->GetItemSpi(), pMsg->NewCount);
				}				
				// end 2008-12-30 by bhsohn 전쟁보상추가 기획안

				g_pGameMain->m_pInven->SetItemSpi(pMsg->NewCount);

				if(pMsg->ItemUpdateType == IUT_GUILD_STORE ||
					pMsg->ItemUpdateType == IUT_STORE ||
					pMsg->ItemUpdateType == IUT_STORE_FEE)
				{
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
				}
				// 2007-02-12 by bhsohn Item 다중 선택 처리
				// 아이템 판매 완료
				//UpdateMultiResponseOK();
				// end 2007-02-12 by bhsohn Item 다중 선택 처리

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				IntervalSellMutltiOneItem();
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
			}
			else if(g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber ) != NULL)
			{
				if( pMsg->ItemUpdateType == IUT_QUEST ||
					pMsg->ItemUpdateType == IUT_DROP_ITEM ||
					pMsg->ItemUpdateType == IUT_INFLUENCEWAR_KILLER_BONUS)
				{
					CItemInfo* pItemInfo = 
						g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
					if( pMsg->ItemUpdateType == IUT_QUEST )
					{
						g_pQuestData->NoticeQuestTargetItem( pItemInfo->ItemInfo->ItemNum, pMsg->NewCount );
					}
					g_pStoreData->CreateChatOfItemUpdate( pItemInfo->ItemNum, 
						pItemInfo->CurrentCount, pMsg->NewCount );
				}

				g_pStoreData->UpdateItemCount( pMsg->ItemUniqueNumber, pMsg->NewCount );
				// 2009-04-02 by bhsohn 럭키 머신 추가 기획안
				g_pStoreData->UpdateCoinItemCount(pMsg->ItemUniqueNumber);
				// end 2009-04-02 by bhsohn 럭키 머신 추가 기획안

				if(pMsg->ItemUpdateType == IUT_GUILD_STORE ||
					pMsg->ItemUpdateType == IUT_STORE ||
					pMsg->ItemUpdateType == IUT_STORE_FEE)
				{
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
				}
				// 2007-02-12 by bhsohn Item 다중 선택 처리
				FromStoreMultiResponseOK();
			}
//			else if(m_dwGameState == _CITY) // 창고
			else
			{
				ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
				CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
//				ASSERT_ASSERT(pStore);
				if(pStore==NULL)
				{
					// 2006-05-15 by isparkm, 거래시 인벤토리에 없으므로 거래 인터페이스에서 아이템 정보를 가져온다.
					if(pMsg->ItemUpdateType == IUT_TRADE)
					{
						CItemInfo* pItemInfo = g_pGameMain->m_pTrade->FindTradeMyItem(pMsg->ItemUniqueNumber);
						if(pItemInfo)
						{
							g_pStoreData->PutItem((char*)((ITEM_GENERAL*)pItemInfo));
							m_pShuttleChild->ResortingItem();
							m_pShuttleChild->SetShuttleData(5);
							g_pGameMain->m_pInven->SetAllIconInfo();
						}
						return;
					}
					DBGOUT("Error : Change ItemNum\n");
					return;
				}
				if(pMsg->ItemUniqueNumber == pStore->GetItemSpiUniqueNumber() )
				{
					pStore->SetItemSpi( pMsg->NewCount );
				}
				else
				{
					ASSERT_ASSERT( pStore->FindItemInfo( pMsg->ItemUniqueNumber ) != NULL );
					pStore->UpdateItemCount( pMsg->ItemUniqueNumber, pMsg->NewCount );
				}

				// 2006-10-26 by ispark, 상황 해제
				g_pD3dApp->m_bRequestEnable = TRUE;
				g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
			}
		}
		break;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeInsertItem(MSG_FC_TRADE_INSERT_ITEM* pMsg)
/// \brief		MSG_FC_TRADE_INSERT_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeInsertItem(MSG_FC_TRADE_INSERT_ITEM* pMsg)
{
	// 2008-08-11 by bhsohn 단독으로 실행 되게끔
	AddItemList(pMsg);
	// end 2008-08-11 by bhsohn 단독으로 실행 되게끔

	FLOG("CAtumApplication::FieldSocketTradeInsertItem(MSG_FC_TRADE_INSERT_ITEM* pMsg)");
	// 2007-07-24 by dgwoo 튜토리얼 모드시 백업을 받은 상태라면 받아오는 아이템은 따로 처리.
	//if(g_pTutorial->IsTutorialMode())
	if(g_pStoreData->IsTutorialItemBackUp())
	{
		m_vecTutorialInsertItem.push_back(*pMsg);
		return;
	}

	// 2006-07-25 by ispark, 현 ItemInfo는 클라이언트 주소값이 아니다. 그러므로, 미리 주소 값을 넣어준다.
	pMsg->ItemGeneral.ItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemGeneral.ItemNum);

	if(ITEM_IN_CHARACTER == pMsg->ItemGeneral.ItemStorage)
	{
		switch(pMsg->ItemInsertionType)
		{
		case IUT_MIXING:
			{
				CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
				if(pCityLab)
				{
					pCityLab->PutTargetItem((ITEM_GENERAL*)&(pMsg->ItemGeneral));
					DBGOUT("Mix Result : (MSG_FC_TRADE_INSERT_ITEM):ItemNum[%d]\n",pMsg->ItemGeneral.ItemNum);
				}
			}
			break;
		case IUT_SKILL: // 사용되지 않음. SETUP_SKILL에서 처리된다.
			{
				g_pStoreData->PutItem((char*)&(pMsg->ItemGeneral));
				g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();
				//CAppEffectData * pEff = new CAppEffectData(m_pShuttleChild,RC_EFF_GET_SKILL,D3DXVECTOR3(0,0,0));
				//m_pEffectList->AddChild(pEff);
				//CINFCitySkillShop * pShop = (CINFCitySkillShop*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_SKILL_SHOP);
				//if(pShop)
				//{
				//	pShop->ReloadSkillItemList();
				//}
			}
			break;
		case IUT_TUTORIAL_PAY_ITEM:
		case IUT_GENERAL:
		case IUT_DROP_ITEM:
		case IUT_TRADE:
		case IUT_SHOP:
		case IUT_QUEST:
		case IUT_ADMIN:
		case IUT_BULLET:
		case IUT_LOADING:
		case IUT_AUCTION:	
		case IUT_ENCHANT:	
		case IUT_USE_ITEM:
		case IUT_BONUS_ITEM:
		case IUT_BAZAAR_SELL:
		case IUT_BAZAAR_BUY:
		default:
			{
				// 2006-07-31 by ispark, 개인 상점
				if(pMsg->ItemInsertionType == IUT_BAZAAR_SELL)
				{
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
					char ShopResult[128] = {0,};
					if(g_pInterface->m_pBazaarShop)
					{
						// 오픈
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
							{
								wsprintf(ShopResult, STRMSG_C_060803_0003, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
							}
							else
							{
								wsprintf(ShopResult, STRMSG_C_060803_0003, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
							}
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
							{
								wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
							}
							else
							{
								wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
							}
						}
					}
					m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM); 
				}
				else if(pMsg->ItemInsertionType == IUT_BAZAAR_BUY)
				{
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
					char ShopResult[128] = {0,};
					if(g_pInterface->m_pBazaarShop)
					{
						// 오픈
						if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 1)
						{
							if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
							{
								wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
							}
							else
							{
								wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
							}
						}
						// 방문자
						else if(g_pInterface->m_pBazaarShop->GetbBazaarShopTypeState() == 2)
						{
							if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
							{
								wsprintf(ShopResult, STRMSG_C_060803_0003, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
							}
							else
							{
								wsprintf(ShopResult, STRMSG_C_060803_0003, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
							}
						}
					}
					m_pChat->CreateChatChild(ShopResult, COLOR_SYSTEM); 
				}

				// 2005-03-07 by jschoi
				// 2006-07-31 by ispark, 판매 상점에서 구입한것은 일반상점과 같다.
				if(pMsg->ItemInsertionType == IUT_SHOP)
				{
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;

					// 2006-05-19 by ispark, 구입
					char ShopResult[128] = {0,};
//					ITEM* ItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemGeneral.ItemNum);
					if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
					{
						wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
					}
					else
					{
						wsprintf(ShopResult, STRMSG_C_060519_0000, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
					}
					m_pChat->CreateChatChild(ShopResult, COLOR_ITEM);	
				}
				// 2006-04-26 by ispark, 보너스 아이템
				// 2006-07-24 by ispark, 수정
				if(pMsg->ItemInsertionType == IUT_BONUS_ITEM)
				{
					char buff[128] = {0,};
//					ITEM* ItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemGeneral.ItemNum);
					if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
					{
						wsprintf(buff,STRMSG_C_ITEM_0006, pMsg->ItemGeneral.ItemInfo->ItemName, pMsg->ItemGeneral.CurrentCount);
					}
					else
					{
						wsprintf(buff,STRMSG_C_ITEM_0006, pMsg->ItemGeneral.ItemInfo->ItemName, 1);
					}
					m_pChat->CreateChatChild(buff, COLOR_ITEM,CHAT_TAB_SYSTEM);		
				}
				// 2006-09-04 by dgwoo 이벤트 아이템 추가.
				if(pMsg->ItemInsertionType == IUT_GIVEEVENTITEM)
				{
					char buff[128] = {0,};
					if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
					{
						wsprintf(buff,STRMSG_C_060904_0100,pMsg->ItemGeneral.ItemInfo->ItemName,pMsg->ItemGeneral.CurrentCount);
					}
					else
					{
						wsprintf(buff,STRMSG_C_060904_0100,pMsg->ItemGeneral.ItemInfo->ItemName,1);
					}
					// 2013-04-08 by jhseol, 이벤트 아이템 지급 알림방법 변경
#ifdef C_ITEM_EVENT_NOTIFY_MSG_CHANGE_JHSEOL
					if(g_pInterface != NULL &&
						g_pInterface->m_pGameMain != NULL)
					{
						CINFGameMainUnitInfoBar* pInfoBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
						if(pInfoBar == NULL)
							break;
						pInfoBar->AddGiftMsg(0,m_pShuttleChild->GetCharacterUniqueNumber(),buff);
					}
#else
					m_pChat->CreateChatChild(buff, COLOR_ITEM);
#endif
					// end 2013-04-08 by jhseol, 이벤트 아이템 지급 알림방법 변경
				}
				// 2007-06-04 by dgwoo
				if(pMsg->ItemInsertionType == IUT_ARENA_ITEM
					|| pMsg->ItemInsertionType == IUT_GIVEEVENTITEM_COUPONEVENT)		// 2008-01-17 by dgwoo 쿠폰 관련 스트링도 추가.
				{
					char buff[128] = {0,};
					if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
					{
						wsprintf(buff,STRMSG_C_ITEM_0006,pMsg->ItemGeneral.ItemInfo->ItemName,pMsg->ItemGeneral.CurrentCount);
					}
					else
					{
						wsprintf(buff,STRMSG_C_ITEM_0006,pMsg->ItemGeneral.ItemInfo->ItemName,1);
					}
					m_pChat->CreateChatChild(buff, COLOR_ITEM,CHAT_TAB_SYSTEM);		
				}
				// 2008-11-25 by dgwoo 럭키 머신.
				if(pMsg->ItemInsertionType == IUT_LUCKY_ITEM)
				{
					CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);					
					pStore->SetPrizeItem(pMsg->ItemGeneral);
				}

				// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
				else if(pMsg->ItemInsertionType == IUT_DISSOLUTION_ITEM)
				{
					CINFDissolution* pStore = (CINFDissolution*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_DISSOLUTION);					
					pStore->SetTakeItem(pMsg->ItemGeneral);
				}
				// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현
				else
				{
					g_pStoreData->PutItem((char*)&(pMsg->ItemGeneral));
				}
				// 2007-10-30 by dgwoo 아이템 목록이 올경우는 마지막에 한번만 소팅해준다.
				if(m_bResortingItem)
				{
					m_pShuttleChild->ResortingItem();
				}
				m_pShuttleChild->SetShuttleData(5);
				g_pGameMain->m_pInven->SetScrollEndLine();						// 2006-06-21 by ispark
				g_pGameMain->m_pInven->SetAllIconInfo();

				if( pMsg->ItemInsertionType == IUT_QUEST )
				{
					g_pQuestData->NoticeQuestTargetItem( pMsg->ItemGeneral.ItemNum, pMsg->ItemGeneral.CurrentCount );
				}
				if( pMsg->ItemInsertionType == IUT_QUEST ||
					pMsg->ItemInsertionType == IUT_DROP_ITEM ||
					pMsg->ItemInsertionType == IUT_INFLUENCEWAR_KILLER_BONUS)
				{
					CItemInfo* pItemInfo = 
						g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemGeneral.UniqueNumber );

					if(pItemInfo)
					{
						if(IS_COUNTABLE_ITEM(pMsg->ItemGeneral.ItemInfo->Kind))
						{
							g_pStoreData->CreateChatOfItemUpdate(pItemInfo->ItemNum,0,pMsg->ItemGeneral.CurrentCount);
						}
						else
						{// 2007-03-15 by dgwoo 무기같은 경우 CurrentCount가 총알수량을 표시하기때문에 카운터을 제외한것들은 
							// 1개로 표시해준다.
							g_pStoreData->CreateChatOfItemUpdate( pItemInfo->ItemNum, 0, 1 );
						}
					}
				}

				// 2006-10-26 by ispark
				if(pMsg->ItemInsertionType == IUT_GUILD_STORE ||
					pMsg->ItemInsertionType == IUT_STORE ||
					pMsg->ItemInsertionType == IUT_STORE_FEE)
				{
					// 동기화 해제
					g_pD3dApp->m_bRequestEnable = TRUE;
					g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
				}
				// 2007-02-12 by bhsohn Item 다중 선택 처리
				FromStoreMultiResponseOK();
			}
			break;		
		}
	}
	else // 창고
	{
		ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
		CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
		ASSERT_ASSERT(pStore);
		pStore->PutItem((char*)&(pMsg->ItemGeneral));

		// 창고에 들어갔을 때(IUT_LOADING)는 PUT_ITEM_DONE에서 InputItemDone을 호출
		if(pMsg->ItemInsertionType != IUT_LOADING) 
		{
			pStore->InputItemDone();
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStoreUpdatePossess(MSG_FC_STORE_UPDATE_POSSESS* pMsg)
/// \brief		창고에서 아이템을 옮길때
/// \author		dhkwon
/// \date		2004-08-02 ~ 2004-08-02
/// \warning	돈은 안한다.( 이 프로토콜은 절대로 IS_COUNTABLE_ITEM이 오지 않는다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdatePossess(MSG_FC_STORE_UPDATE_POSSESS* pMsg)
{
	ASSERT_IMPLIES(pMsg->FromPossess != pMsg->ToPossess, pMsg->FromPossess != 0 || pMsg->ToPossess != 0);
	ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
	
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	ASSERT_ASSERT(pStore);
	if(pStore)
	{
		if(pMsg->FromPossess == 0)	// 창고 -> 아이템창
		{
			CItemInfo* pItemInfo = pStore->FindItemInfo( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);
			pNewItemInfo->ItemWindowIndex = POS_INVALID_POSITION;

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->DeleteItem( pMsg->ItemUniqueNumber ); // InputItemDone();
			g_pStoreData->AddItemDataToUniqueNumberAndWindowPosition( pNewItemInfo );
			g_pGameMain->m_pInven->SetAllIconInfo();
		}
		else if(pMsg->ToPossess == 0) // 아이템창 -> 창고
		{
			CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->AddItem( pNewItemInfo );
			pStore->InputItemDone();
			g_pStoreData->DeleteItem( pMsg->ItemUniqueNumber );
		}
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStoreUpdateRareFix(MSG_FC_STORE_UPDATE_RARE_FIX* pMsg)
/// \brief		갬블 아이템을 성공했을때 붙는 옵션
/// \author		ydkim
/// \date		2004-12-03 by ydkim
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdateRareFix(MSG_FC_STORE_UPDATE_RARE_FIX* pMsg)
{
//	if( g_pStoreData->PutEnchant(pMsg) == FALSE )
//	{
//		if( m_dwGameState == _CITY )
//		{
//			ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
//			CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
//			if(pStore)
//			{
//				pStore->AddEnchantItem( pMsg->Enchant.TargetItemUniqueNumber, pMsg->Enchant.EnchantItemNum );
//			}
//			CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
//			if(pCityLab)
//			{
//				pCityLab->PutEnchant( pMsg );
//			}
//		}
//	}
	ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);

	if( g_pStoreData->PutRareInfo(pMsg) == FALSE )
	{
// 2010. 04. 21 by jskim 신규 럭키 머신 구현
// 		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
// 		if(pCityLab)
// 		{
// 			pCityLab->PutRareInfo( pMsg );
// 		}
		if(g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind == BUILDINGKIND_LUCKY_OPTION_MACHINE)
		{
			CINFOptionMachine * pOptionMachine = (CINFOptionMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY_OPTION_MACHINE);
			if(pOptionMachine)
			{
				pOptionMachine->PutRareInfo( pMsg );
			}
		}
		else if(g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind == BUILDINGKIND_LABORATORY)
		{
			CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
			if(pCityLab)
			{
				pCityLab->PutRareInfo( pMsg );
			}
		}
//end 2010. 04. 21 by jskim 신규 럭키 머신 구현
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStoreUpdateEndurance(MSG_FC_STORE_UPDATE_ENDURANCE* pMsg)
/// \brief		아이템의 내구도가 사용되는 경우
/// \author		dhkwon
/// \date		2004-05-14 ~ 2004-05-14
/// \warning	아직 적용되지 않음
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdateEndurance(MSG_FC_STORE_UPDATE_ENDURANCE* pMsg)
{
	//DBGOUT("\n",pMsg->ItemUniqueNumber, pMsg->Endurance);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeTransItemOk(MSG_FC_TRADE_TRANS_ITEM_OK* pMsg)
/// \brief		MSG_FC_TRADE_TRANS_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeTransItemOk(MSG_FC_TRADE_TRANS_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeTransItemOk(MSG_FC_TRADE_TRANS_ITEM_OK* pMsg)");
	CItemInfo* pItem = new CItemInfo(&pMsg->TradeItem);
	if(g_pGameMain->m_pTrade)
	{
		g_pGameMain->m_pTrade->AddItem(pItem, 0);
		for(int i=0;i<pMsg->NumOfEnchants;i++)
		{
			INT nEnchantItemNum = 
				*(INT*)(((char*)pMsg)+sizeof(MSG_FC_TRADE_TRANS_ITEM_OK)+sizeof(INT)*i);
			g_pGameMain->m_pTrade->AddEnchantItem( pMsg->TradeItem.UniqueNumber, nEnchantItemNum );

//			TRADE_ENCHANT_INFO* pEnchant = 
//				(TRADE_ENCHANT_INFO*)(((char*)pMsg)+sizeof(MSG_FC_TRADE_TRANS_ITEM_OK)+sizeof(TRADE_ENCHANT_INFO)*i);
//			g_pGameMain->m_pTrade->AddEnchantItem(pMsg->TradeItem.UniqueNumber, pEnchant->DestParam, pEnchant->ParamValue);
		}
		MSG_FC_TRADE_SEE_ITEM sMsg;
		memset(&sMsg,0x00,sizeof(sMsg));
		char buffer[SIZE_MAX_PACKET];
		sMsg.CharacterUniqueNumber = pMsg->CharacterUniqueNumber;
		sMsg.ItemNum = pMsg->TradeItem.ItemNum;
		sMsg.ItemUniqueNumber = pMsg->TradeItem.UniqueNumber;
		sMsg.Amount = pMsg->TradeItem.CurrentCount;
		int nType = T_FC_TRADE_SEE_ITEM;
		memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
		memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
		m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeSeeItemOk(MSG_FC_TRADE_SEE_ITEM_OK* pMsg)
/// \brief		MSG_FC_TRADE_SEE_ITEM_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeSeeItemOk(MSG_FC_TRADE_SEE_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeSeeItemOk(MSG_FC_TRADE_SEE_ITEM_OK* pMsg)");
	// 내 아이템 리스트에서 Trade물품리스트로 이동한다.
//	CItemInfo* pItemInfo = new CItemInfo((ITEM_GENERAL*)((char*)pMsg+sizeof(MSG_FC_TRADE_SEE_ITEM_OK)));
	if(((ITEM_GENERAL*)((char*)pMsg+sizeof(MSG_FC_TRADE_SEE_ITEM_OK)))->ItemNum == MONEY_ITEM_NUMBER )
	{
		CItemInfo* pTradeItem = new CItemInfo(((ITEM_GENERAL*)((char*)pMsg+sizeof(MSG_FC_TRADE_SEE_ITEM_OK))));
		if(g_pGameMain->m_pTrade)
		{
			g_pGameMain->m_pTrade->AddItem(pTradeItem, 1);
		}
	}
	else
	{
		CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( ((ITEM_GENERAL*)((char*)pMsg+sizeof(MSG_FC_TRADE_SEE_ITEM_OK)))->UniqueNumber );
		ASSERT_ASSERT( pItemInfo != NULL );
		if( pItemInfo )
		{
			CItemInfo* pTradeItem = new CItemInfo((ITEM_GENERAL*)pItemInfo);

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pTradeItem->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pTradeItem->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			// 2003.10.14, 거래
			pTradeItem->CurrentCount = ((ITEM_GENERAL*)((char*)pMsg+sizeof(MSG_FC_TRADE_SEE_ITEM_OK)))->CurrentCount;
			if(g_pGameMain->m_pTrade)
			{
				g_pGameMain->m_pTrade->AddItem(pTradeItem, 1);
			}
		}
	}
}
// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 recv
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeSeePetData(MSG_TRADE_PET_DATA* pMsg)
/// \brief		MSG_TRADE_PET_DATA (commandMsg : T_FC_TRADE_SEE_PET_DATA)
/// \author		shcho&hslee				// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 전송
/// \date		2010-08-09 ~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeSeePetData(MSG_TRADE_PET_DATA* pMsg)
{
	FLOG("CAtumApplication::FieldSocketTradeSeeItemOk(MSG_TRADE_PET_DATA* pMsg)");
	vector<CItemInfo*>::iterator it = g_pGameMain->m_pTrade->m_vecOtherStore.begin();
	while(it != g_pGameMain->m_pTrade->m_vecOtherStore.end())
	{
		CItemInfo* pItem = (*it);
		pItem->SetPetExp(pMsg->PetExp);
//		pItem->SetPetEnableLevelUp(pMsg->EnableLevelUp);				//2011-10-06 by jhahn 파트너 성장형 시스템
//		pItem->SetReName(pMsg->EnableEditPetName);						//2011-10-06 by jhahn 파트너 성장형 시스템
		pItem->SetPetLevel(pMsg->PetLevel);
		it++;
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeSeePetData(MSG_TRADE_PET_DATA* pMsg)
/// \brief		MSG_TRADE_PET_DATA (commandMsg : T_FC_TRADE_DELETE_CURRENT_PET_DATA)
/// \author		shcho&hslee				// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 전송
/// \date		2010-08-09 ~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeDeletePetData(MSG_TRADE_PET_DATA* pMsg)
{	// 삭제 함수 추가
	g_pShuttleChild->GetPetManager()->DeletePetCurrentData(pMsg->CreatedPetUID);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketTradeSeePetData(MSG_TRADE_PET_DATA* pMsg)
/// \brief		MSG_TRADE_PET_DATA (commandMsg : T_FC_TRADE_INSERT_CURRENT_PET_DATA)
/// \author		shcho&hslee				// 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 전송
/// \date		2010-08-09 ~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTradeInsertPetData(MSG_FC_ITEM_PET_BASEDATA* pMsg)
{
	g_pShuttleChild->PutPetInfo(pMsg);
}
// ends 2010-06-15 by shcho&hslee 펫시스템 - 거래 시 펫 정보 recv

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketSkillUseSkill(MSG_FC_SKILL_USE_SKILL_OK *pMsg)
/// \brief		MSG_FC_SKILL_USE_SKILL_OK
/// \author		jschoi
/// \date		2004-11-01 ~ 2004-11-01
/// \warning	1. 내가 사용한 스킬을 내가 적용하는 경우에는 
///				   우선 동일한 스킬타입(SKILL_BASE_NUM)의 스킬이 사용중이라면 우선 전부 지운다.
///				2. 모두 지운후 스킬을 새롭제 재 적용한다.
///				3. 이미 생성된 이펙트가 없는 경우에만 이펙트를 생성한다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSkillUseSkill(MSG_FC_SKILL_USE_SKILL_OK *pMsg)
{
	FLOG("CAtumApplication::FieldSocketSkillUseSkill(MSG_FC_SKILL_USE_SKILL_OK *pMsg)");
	
	// 2007-04-05 by bhsohn 빅붐 버그 처리
	// 과거 스킬초기화
	g_pShuttleChild->m_pSkill->InitPreSkillItemNum();

 	if(pMsg->TargetIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		BOOL bDeleteUsingSkill			= FALSE;
		BOOL bDeleteEnemyUsingSkill		= FALSE;

		ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);

		if(SKILLTYPE_TIMELIMIT == pItem->SkillType)
		{// 2007-01-04 by dgwoo 시간제한 스킬은 다 삭제한다.
			bDeleteUsingSkill			= TRUE;
			bDeleteEnemyUsingSkill		= TRUE;
		}
		else if(pMsg->AttackIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			bDeleteUsingSkill			= TRUE;
		}
		else
		{
			bDeleteEnemyUsingSkill		= TRUE;
		}
		
		if(bDeleteUsingSkill)
		{// 2007-01-04 by dgwoo 내가 사용한 스킬중에서 검색하여 지운다.
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindUsingSkillInfoByBaseNum(pMsg->SkillItemID.ItemNum);
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo(pSkillInfo);
				pSkillInfo->ReleaseParamFactor();
// 2007-01-16 by dgwoo 내가 쓴 스킬을 삭제하면 리어택 타임까지 삭제 되어 문제를 일을킬수 있다.
//				g_pShuttleChild->m_pSkill->EraseUsingSkill(pSkillInfo);
				// 2008-12-26 by bhsohn 엠기어 편대 버그 수정
				if(bDeleteEnemyUsingSkill)
				{
					// 내 버프 보다 높은 레벨의 스킬이 들어온다면 내 버프를 지운다.
					g_pShuttleChild->m_pSkill->EraseLowLVUsingSkill(pMsg->AttackIndex, pMsg->SkillItemID.ItemNum);
				}
				// end 2008-12-26 by bhsohn 엠기어 편대 버그 수정
			}
		}
		if(bDeleteEnemyUsingSkill)
		{// 2007-01-04 by dgwoo 다른유저가 사용한 스킬중에 검색하여 지운다.
			// 이때 같은 BASENUM의 스킬을 내가 이미 사용하고 있는 경우는 기존에 스킬을 완전히 지운다.
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfoByBaseNum(pMsg->SkillItemID.ItemNum);
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo(pSkillInfo);
				pSkillInfo->ReleaseParamFactor();
				g_pShuttleChild->m_pSkill->EraseUsingSkill(pSkillInfo,TRUE);
			}
		}

		if(pMsg->AttackIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{	// 내가 사용한 스킬을 내가 적용하는 경우
			// 동일한 스킬타입(SKILL_BASE_NUM)의 스킬이 사용중이라면 우선 전부 지운다.

			// 2009-03-31 by bhsohn 1인칭 시점 에어 시즈시, 버그 수정
			if(SKILL_BASE_NUM(pMsg->SkillItemID.ItemNum) == AGEAR_SKILL_BASENUM_AIRSIEGEMODE)
			{
				// 1인칭 시점이면 에어시즈시, 3인칭으로 잠시 변경
				if(CAMERA_TYPE_FPS == g_pSOption->sEyePt)
				{
					g_pD3dApp->m_pCamera->SetCamType( CAMERA_TYPE_NORMAL);
				}
			}
			// end 2009-03-31 by bhsohn 1인칭 시점 에어 시즈시, 버그 수정
			
			// 스킬을 새롭게 적용한다.
			CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindItemSkill(pMsg->SkillItemID.ItemNum);
			if(pSkillInfo)
			{
				pSkillInfo->Init();
				// 2005-11-25 by ispark, 컨트롤 스킬이면 이전 모든 컨트롤 스킬을 지운다.
				if(pSkillInfo->ItemInfo->SkillType == SKILLTYPE_CLICK &&
					SKILL_KIND(pSkillInfo->ItemNum) == SKILL_KIND_CONTROL)
				{
					g_pShuttleChild->m_pSkill->ReleaseAllUsingControlSkill(pSkillInfo->ItemNum);
				}

				// 2007-01-09 by dgwoo 현재 사용중인 스킬이 있을경우만 스킬을 적용한다.
				// 엑셀레이터 스킬을 사용과 동시에 이륙시 이미 스킬이 vecUsingSkill에 없기 때문에 
				// sp소모없이 스킬을 사용할수 있다.
				CSkillInfo* pUsingSkillInfo = g_pShuttleChild->m_pSkill->FindUsingSkillInfo(pMsg->SkillItemID.ItemNum);
				if(NULL == pUsingSkillInfo)
				{
					return;
				}
				pSkillInfo->SetClientIndex(pMsg->AttackIndex, pMsg->TargetIndex);
				pSkillInfo->UseSkillFromServer();
// 2007-01-10 by dgwoo UseSkillFromServer()함수내에서 처리.
//				pSkillInfo->SetCheckEnableTime();
//				pSkillInfo->SetCheckReattackTime();
				//g_pShuttleChild->m_pSkill->m_vecUsingSkill.push_back(pSkillInfo);
			}

			// 2006-07-28 by ispark, 바자맵에서 개인상점
			if(IS_BAZAAR_SKILL(pSkillInfo->ItemInfo))
			{
				g_pInterface->OpenBazaarShop(pSkillInfo->ItemInfo);
			}
		}
		else
		{ // 타인이 나에게 사용한 스킬인 경우 스킬을 생성하고 추가한다.

			CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfo(pMsg->SkillItemID.ItemNum);
			if(NULL == pSkillInfo)
			{
				// 다른놈이 쓴 스킬의 경우 스킬의 정보(ITEM_SKILL*)를 가져온다.
				ITEM_SKILL itemSkill;
				memset(&itemSkill, 0x00, sizeof(ITEM_SKILL));
				itemSkill.ItemInfo		= g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
				itemSkill.ItemNum		= itemSkill.ItemInfo->ItemNum;
				itemSkill.Kind			= itemSkill.ItemInfo->Kind;
				itemSkill.UniqueNumber	= pMsg->SkillItemID.ItemUID;
				
				// 가져온 정보를 바탕으로 스킬을 생성하고 적용한다.
				pSkillInfo	= g_pShuttleChild->m_pSkill->FindItemEnemySkillInfo(pMsg->SkillItemID.ItemNum);
				if(NULL == pSkillInfo)
				{
					pSkillInfo = new CSkillInfo(&itemSkill);
					g_pShuttleChild->m_pSkill->m_mapEnemySkillInfo[pMsg->SkillItemID.ItemNum] = pSkillInfo;
				}

				pSkillInfo->SetClientIndex(pMsg->AttackIndex, pMsg->TargetIndex);
				pSkillInfo->UseSkillFromServer();
// 2007-01-10 by dgwoo UseSkillFromServer() 함수내에서 처리.
//				pSkillInfo->SetCheckEnableTime();
//				pSkillInfo->SetCheckReattackTime();	// 2005-11-24 by ispark
				g_pShuttleChild->m_pSkill->m_vecEnemyUsingSkillForMe.push_back(pSkillInfo);
			}
			else
			{
				pSkillInfo->Init();
				pSkillInfo->SetClientIndex(pMsg->AttackIndex, pMsg->TargetIndex);
				pSkillInfo->UseSkillFromServer();
// 2007-01-10 by dgwoo UseSkillFromServer() 함수내에서 처리.
//				pSkillInfo->SetCheckEnableTime();
//				pSkillInfo->SetCheckReattackTime();	// 2005-11-24 by ispark
			}
		}

		// effect
		if(	g_pShuttleChild->m_pSkillEffect)
		{
			if(g_pShuttleChild->m_pSkillEffect->FindSkillEffect(pMsg->SkillItemID.ItemNum))
			{ // 이미 생성된 스킬이 있다면..
				g_pShuttleChild->m_pSkillEffect->ChangeBodyCondition(pMsg->SkillItemID.ItemNum,BODYCON_USE_SKILL_MASK);
			}
			// 2009-04-07 by bhsohn 차징샷 관련 버그 수정
			else if(BGEAR_STATE_CHARINGSHOT == SKILL_BASE_NUM(pMsg->SkillItemID.ItemNum))
			{
				g_pShuttleChild->m_pSkillEffect->CreateSkillEffect(pMsg->SkillItemID.ItemNum, BODYCON_USE_SKILL_MASK);
			}
			// end 2009-04-07 by bhsohn 차징샷 관련 버그 수정
			else
			{ // 생성된 스킬이 없다면 생성한다.
				// 순간이펙트 - 나중에 바꾸자..
				// 2005-08-23 by ispark
				ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
				// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//				CAppEffectData* pEff = new CAppEffectData(g_pShuttleChild,SKILL_BASE_NUM(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
				CAppEffectData* pEff = new CAppEffectData(g_pShuttleChild,SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
				if(pEff->m_bUsing == TRUE )
				{
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
				}
				else
				{
					delete pEff;
				}
			}			
		}
	}
	else
	{
		// Enemy skill 발동시
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->TargetIndex );
		if(pUnit)
		{
			// 2006-11-21 by ispark, 상대방 스킬 정보에 대한 처리 추가
			((CEnemyData *)pUnit)->UseSkillFromServer(pMsg->SkillItemID.ItemNum);
			ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
			
			// 2007-04-02 by bhsohn Move패킷으로 적기 상태 체크
			UpdateEnemySkillState(true, pUnit, pMsg->TargetIndex, pMsg->SkillItemID.ItemNum);
						
			if(pUnit->m_pSkillEffect)
			{
				if(pUnit->m_pSkillEffect->FindSkillEffect(pMsg->SkillItemID.ItemNum))
				{ 
					// 이미 생성된 스킬이 있다면..
					pUnit->m_pSkillEffect->ChangeBodyCondition(pMsg->SkillItemID.ItemNum,BODYCON_USE_SKILL_MASK);
				}
				else
				{ // 생성된 스킬이 없다면 생성한다.

					// 순간이펙트 - 나중에 바꾸자..
					// 2005-08-23 by ispark
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					CAppEffectData* pEff = new CAppEffectData(pUnit,SKILL_BASE_NUM(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					CAppEffectData* pEff = new CAppEffectData(pUnit,SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					if(pEff->m_bUsing)
					{
						pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					}
					else
					{
						delete pEff;
					}
				}
			}

			// 2006-12-08 by ispark, 상대방이 쓴 스킬이 나에게도 보여줘야 하는 이펙트라면
			if(g_pShuttleChild->m_pSkillEffect
				&& g_pShuttleChild->m_pSkillEffect->CheckTargetSkillEffect(pMsg->SkillItemID.ItemNum)
				&& !IsInfluenceCharacter(g_pShuttleChild->m_myShuttleInfo.InfluenceType,((CEnemyData *)pUnit)->m_infoCharacter.CharacterInfo.InfluenceType)	//적기일때.
				&& D3DXVec3Length(&(g_pShuttleChild->m_vPos - pUnit->m_vPos)) < pItem->Range			//스캔스킬 범위에 있을시에만 이펙트 발생.
				&& g_pShuttleChild->GetUnitAlphaState() != CL_SKILL_NONE)						//투명스킬을 사용중인 적유저만.
			{
				if(g_pShuttleChild->m_pSkillEffect->FindSkillEffect(pMsg->SkillItemID.ItemNum))
				{ // 이미 생성된 스킬이 있다면..
					g_pShuttleChild->m_pSkillEffect->ChangeBodyCondition(pMsg->SkillItemID.ItemNum, BODYCON_TARGET_USE_SKILL_MASK);
				}
				else
				{ 
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					CAppEffectData* pEff = new CAppEffectData(g_pShuttleChild,SKILL_BASE_NUM(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					CAppEffectData* pEff = new CAppEffectData(g_pShuttleChild,SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					pEff->ChangeBodyCondition(BODYCON_TARGET_USE_SKILL_MASK);
					if(pEff->m_bUsing)
					{
						pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					}
					else
					{
						SAFE_DELETE(pEff);
					}
				}			
			}
		}
	}
}
//2011-10-06 by jhahn 파트너 성장형 시스템
VOID	CAtumApplication::FieldSocketInvenItempHidePetData(MSG_FC_ITEM_NOTIFY_WINDOW_POSITION* pMsg)
{

	CItemInfo* temp  = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->UniqueNumber);
	temp->GetItemInfo()->Position = pMsg->ItemWindowIndex;
	temp->ItemWindowIndex = pMsg->ItemWindowIndex;


	CMapItemWindowInventoryIterator it = g_pStoreData->m_mapItemWindowPosition.begin();
	while(it != g_pStoreData->m_mapItemWindowPosition.end())
	{
		CItemInfo* pItemInfo = it->second;
		if(pItemInfo->UniqueNumber == pMsg->UniqueNumber)
		{
			pItemInfo->GetItemInfo()->Position = POS_HIDDEN_ITEM;			
			pItemInfo->ItemWindowIndex = POS_HIDDEN_ITEM;			
		//	g_pStoreData->m_mapItemWindowPosition[POS_HIDDEN_ITEM] = pSelectItem;
			g_pGameMain->m_pInven->SetSingleInvenIconInfo(pItemInfo);
			
		}		
		it++;
	}
	
	g_pShuttleChild->ResortingItem();
	g_pShuttleChild->SetShuttleData(5);
	g_pGameMain->m_pInven->SetScrollEndLine();						// 2006-06-21 by ispark
	g_pGameMain->m_pInven->SetAllIconInfo();
}	  
//end 2011-10-06 by jhahn 파트너 성장형 시스템
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketSkillCancelSkillOK(MSG_FC_SKILL_CANCEL_SKILL_OK * pMsg)
/// \brief		스킬 취소 요청이 완료됐다.
/// \author		dgwoo
/// \date		2006-11-28 ~ 2006-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSkillCancelSkillOK(MSG_FC_SKILL_CANCEL_SKILL_OK * pMsg)
{
	if(g_pShuttleChild->m_myShuttleInfo.ClientIndex != pMsg->ClientIndex)
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex(pMsg->ClientIndex);
		if(pUnit)
		{
			CEnemyData* pEnemy = ((CEnemyData *)pUnit);
			pEnemy->CancelUsingSkill(pMsg->SkillItemID.ItemNum);

			// 2007-04-02 by bhsohn Move패킷으로 적기 상태 체크
			UpdateEnemySkillState(false, pUnit, pMsg->ClientIndex, pMsg->SkillItemID.ItemNum);

			// 2006-12-08 by ispark, 취소시 보여줘야 하는 이펙트
			// 2006-12-12 by ispark, 공격당한 스킬 이펙트이다.
			if(pEnemy->m_pSkillEffect && pMsg->AttackSkillItemNum0)
			{
				if(pEnemy->m_pSkillEffect->FindSkillEffect(pMsg->AttackSkillItemNum0))
				{ // 이미 생성된 스킬이 있다면..
					pEnemy->m_pSkillEffect->ChangeBodyCondition(pMsg->AttackSkillItemNum0, BODYCON_TARGET_USE_SKILL_MASK);
				}
				else
				{ 
					ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->AttackSkillItemNum0);
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					CAppEffectData* pEff = new CAppEffectData(pUnit,SKILL_BASE_NUM(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					CAppEffectData* pEff = new CAppEffectData(pUnit,SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),D3DXVECTOR3(0,0,0));
					pEff->ChangeBodyCondition(BODYCON_TARGET_USE_SKILL_MASK);
					if(pEff->m_bUsing == TRUE )
					{
						pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					}
					else
					{
						SAFE_DELETE(pEff);
					}			
				}
			}
		}
	}else if(g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
	{
		
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInvalidateSkill(MSG_FC_SKILL_INVALIDATE_SKILL *pMsg)
/// \brief		MSG_FC_SKILL_INVALIDATE_SKILL
/// \author		jschoi
/// \date		2004-11-01 ~ 2004-11-01
/// \warning	1. CancelSkill에 대한 응답으로 받는 프로토콜이다. 
///				2. 시간형과 토글형은 반드시 클라이언트가 스킬해제시 CancelSkill을 서버로 보내야한다.
///				3. 차징형 스킬은 총알의 발사로 스킬이 해제됨을 알려준다.
///				4. 패시브 스킬은 해제가 없다.
///				5. 나머지 클릭형 스킬은 사용과 동시에 해제되므로 해제가 없다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInvalidateSkill(MSG_FC_SKILL_INVALIDATE_SKILL *pMsg)
{
	FLOG("CAtumApplication::FieldSocketInvalidateSkill(MSG_FC_SKILL_INVALIDATE_SKILL *pMsg)");
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		if(g_pShuttleChild->m_pSkillEffect)
		{
			g_pShuttleChild->m_pSkillEffect->DeleteSkillEffect(pMsg->SkillItemID.ItemNum);
		}

		// 2009. 08. 11 by ckPark 편대 대형 스킬
		// 편대 대형 스킬 해제
		char	strMessage[256];
		char*	strSkillName;
		strSkillName = g_pShuttleChild->m_pSkill->GetSkillName(pMsg->SkillItemID.ItemNum);
		CSkillInfo* pSkill	= g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfo( pMsg->SkillItemID.ItemNum );
		if(	pSkill && COMPARE_BIT_FLAG( pSkill->ItemInfo->ItemAttribute, SKILL_ATTR_PARTY_FORMATION_SKILL ) )
		{ 
			g_pGameMain->m_pInfSkill->DeleteSkillInfo( pSkill, pSkill->Possess );
			wsprintf( strMessage, STRMSG_C_SKILL_0003, strSkillName );//"스킬 [%s] 을 해제합니다."
			g_pD3dApp->m_pChat->CreateChatChild( strMessage, COLOR_SKILL_CANCEL,CHAT_TAB_SYSTEM );
			pSkill->ReleaseParamFactor();
		}
		// end 2009. 08. 11 by ckPark 편대 대형 스킬

		// 2012-12-17 by bhsohn A기어 배리어 이펙트 워프후 사라지는 오류 처리
		ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
		if(pItem)
		{
			if(SKILL_BASE_NUM(pMsg->SkillItemID.ItemNum) == AGEAR_SKILL_BASENUM_BARIAL)		
			{
				// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//				ClearPlaySearchEyeEffect(g_pShuttleChild, SKILL_BASE_NUM(pItem->SourceIndex));
				ClearPlaySearchEyeEffect(g_pShuttleChild, SKILL_BASE_SOURCEINDEX(pItem->SourceIndex));
			}
		}
		// END 2012-12-17 by bhsohn A기어 배리어 이펙트 워프후 사라지는 오류 처리

		// 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정
		if(pItem)
		{
			if(SKILL_BASE_NUM(pMsg->SkillItemID.ItemNum) == MGEAR_STATE_INVINCIBLE)		
			{
				// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//				ClearPlaySearchEyeEffect(g_pShuttleChild, SKILL_BASE_NUM(pItem->SourceIndex));
				ClearPlaySearchEyeEffect(g_pShuttleChild, SKILL_BASE_SOURCEINDEX(pItem->SourceIndex));
			}
		}
		// end 2013-02-14 by mspark, M기어 무적 스킬 워프후에 상대방에게 보이지 않는 문제 수정

		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
		if(g_pShuttleChild && g_pShuttleChild->m_pSkill)
		{
			g_pShuttleChild->m_pSkill->DisableTimeLimitSkill(pMsg->SkillItemID.ItemNum);
		}
#endif
		// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
	}
	else
	{
		// Enemy skill
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
		if(pUnit && pUnit->m_pSkillEffect)
		{
			ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
			// 2006-07-31 by ispark, 개인상점 스킬인 경우 말풍선 삭제
			if(IS_BAZAAR_SKILL(pItem) && ((CEnemyData*)pUnit)->m_pMoveChatShop)
			{
				// 상대방 개인상점을 사용 중이면 강제 종료
				((CEnemyData*)pUnit)->DeleteChatMoveShop();
				if(g_pInterface->m_pBazaarShop && g_pInterface->m_pBazaarShop->GetBazaarClientIndex() == pMsg->ClientIndex)
				{
					g_pInterface->m_pBazaarShop->SetbBazaarShopEnd(TRUE);
					g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_060801_0000, COLOR_ERROR);
				}
			}
			pUnit->m_pSkillEffect->DeleteSkillEffect(pMsg->SkillItemID.ItemNum);
// 2007-01-19 by dgwoo 이펙트 넘버는 SourceIndex를 기본으로 한다.
//			g_pShuttleChild->m_pSkill->DisableSkillEffect(pUnit,SKILL_BASE_NUM(pMsg->SkillItemID.ItemNum));
			// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//			g_pShuttleChild->m_pSkill->DisableSkillEffect(pUnit,SKILL_BASE_NUM(pItem->SourceIndex));
			g_pShuttleChild->m_pSkill->DisableSkillEffect(pUnit,SKILL_BASE_SOURCEINDEX(pItem->SourceIndex));
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterGetAccountUniqueNumberOk(MSG_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterGetAccountUniqueNumberOk(MSG_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGetAccountUniqueNumberOk(MSG_FC_CHARACTER_GET_ACCOUNTUNIQUENUMBER_OK* pMsg)");
	MSG_MT_DIAL		msgMTDial;
	msgMTDial.nCalleeAccountUniqueNumber = pMsg->AccountUniqueNumber;

	COPYDATASTRUCT	copyData;
	memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
	AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_DIAL, 0);
	copyData.dwData = (DWORD)voIP;
	copyData.lpData = &msgMTDial;
	copyData.cbData = sizeof(MSG_MT_DIAL);
	::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleRequestPkOk(MSG_FC_BATTLE_REQUEST_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_REQUEST_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	현재 아무일도 안함
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleRequestPkOk(MSG_FC_BATTLE_REQUEST_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleRequestPkOk(MSG_FC_BATTLE_REQUEST_PK_OK* pMsg)");
	if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleCancelPK(void)
/// \brief		
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	아무일도 안함
///
/// \param		void
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleCancelPK(void)
{
	FLOG("CAtumApplication::FieldSocketBattleCancelPK(void)");
//	m_pShuttleChild->m_bPKMode = FALSE;
//	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.begin();
//	while(itEnemy != m_pScene->m_mapEnemyList.end())
//	{
//		itEnemy->second->SetPkState( PK_PVP, FALSE );
//		itEnemy++;
//	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeMonsterHP(MSG_FC_MONSTER_CHANGE_HP* pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_MONSTER_HP
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeMonsterHP(MSG_FC_MONSTER_CHANGE_HP* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangeMonsterHP(MSG_FC_MONSTER_CHANGE_HP* pMsg)");
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->MonsterChangeHPFromServer(pMsg->CurrentHP);
	}

	// 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)
	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetKeyMonsterHP( pMsg->MonsterIndex, pMsg->CurrentHP );
	// end 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterShowEffectOk(MSG_FC_CHARACTER_SHOW_EFFECT_OK* pMsg)
/// \brief		순간 이펙트 발생
/// \author		dhkwon
/// \date		2004-06-28 ~ 2004-06-28
/// \warning	나의 이펙트는 없다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterShowEffectOk(MSG_FC_CHARACTER_SHOW_EFFECT_OK* pMsg)
{
#ifdef C_TERRAIN_EFFECT_DETAIL_ON_OFF_YMJOO		// 2014-07-04 by ymjoo 지형 이펙트 디테일 옵션 변경 (ON/OFF)
	if(g_pSOption->sTerrainEffectRender == FALSE)
	{
		return;
	}
#elif defined C_USER_EFFECT_CONTROL	// 2012-10-23 by jhahn, 이펙트 옵션 조절
	if(g_pSOption->sTerrainEffectRender <= 0)
	{
		return;
	}
#endif
	CUnitData * pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
	if(pUnit)
	{
		CAppEffectData* pEffect = new CAppEffectData( pUnit, pMsg->EffectIndex, D3DXVECTOR3(0,0,0) );			
			m_pEffectList->AddChild( pEffect );
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterMapEffectOk(MSG_FC_CHARACTER_SHOW_MAP_EFFECT_OK* pMsg)
/// \brief		
/// \author		// 2007-04-19 by bhsohn 서치아이 아이템 추가
/// \date		2007-04-20 ~ 2007-04-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterMapEffectOk(MSG_FC_CHARACTER_SHOW_MAP_EFFECT_OK* pMsg)
{	
	ClientIndex_t  ClientIdx  = pMsg->ClientIdx;
	if(ClientIdx  == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		// 나 자신의 이펙트를 뿌릴 필요가 없다. 
		return;
	}
	
	CUnitData *pUnit = g_pScene->FindUnitDataByClientIndex(ClientIdx);
	if(NULL == pUnit)
	{
		return;
	}	
	D3DXVECTOR3	vPos, vVel, vUp;
	vPos = A2DX(pMsg->avec3Position);
	vVel = A2DX(pMsg->avec3Target);
	vUp = A2DX(pMsg->avec3Up);	
	
	// Vel(방향),Up 벡터는 1000.0f를 곱했기 때문에 노말라이즈 한다. 
	D3DXVec3Normalize(&vVel, &vVel);
	D3DXVec3Normalize(&vUp, &vUp);

	// 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가
	// 이펙트만 생성
	//g_pShuttleChild->CreateScanItemEffect(pUnit, vPos, vVel, vUp, pMsg->nLifetime, pMsg->EffectIndex);
	switch(pMsg->EffectIndex)
	{
// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
#ifdef SC_SEARCHEYE_SHUTTLE_POSITION_JHSEOL_MSPARK
	case RC_EFF_SEARCHEYE_SHUTTLE_POSITION:
		{						
			g_pD3dApp->SetPlaySearchEyeEffect(pUnit, pMsg->EffectIndex, 0);
		}
		break;
	case RC_EFF_SEARCHEYE_SHUTTLE_POSITION2:
		{
			g_pD3dApp->SetPlaySearchEyeEffect(pUnit, pMsg->EffectIndex, 0);
		}
		break;
#else
	case RC_EFF_SCAN_ITEM:
		{
			// 서치아이
			g_pShuttleChild->CreateScanItemEffect(pUnit, vPos, vVel, vUp, pMsg->nLifetime, pMsg->EffectIndex);
		}
		break;
	case RC_EFF_SCAN_ITEM2:
		{
			// 서치아이
			g_pShuttleChild->CreateScanItemEffect(pUnit, vPos, vVel, vUp, pMsg->nLifetime, pMsg->EffectIndex);
		}
		break;
#endif
// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
	default:
		{			
			float fVelLength = D3DXVec3Length(&vVel);
			if(fVelLength <= 0)
			{
				// 방향벡터 크기가 0이면, 내가 볼수 있게 방향 벡터를 한다.
				vVel = m_pCamera->GetViewDir();
				vVel.y = 0;
				D3DXVec3Normalize(&vVel,&vVel);			
			}

			// 서치 아이가 아닌 이펙트 표현 (현재, 럭키머신 이펙트 구현)
			CreateMyAppEffectData(pMsg->EffectIndex, vPos, vVel, vUp);
		}
		break;
	}
	// end 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가

	
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleDropBundleOk(MSG_FC_BATTLE_DROP_BUNDLE_OK* pMsg)
/// \brief		MSG_FC_BATTLE_DROP_BUNDLE_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	사용하지 않음
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleDropBundleOk(MSG_FC_BATTLE_DROP_BUNDLE_OK* pMsg)
{
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterDeleteOtherInfo(MSG_FC_CHARACTER_DELETE_OTHER_INFO* pMsg)
/// \brief		MSG_FC_CHARACTER_DELETE_OTHER_INFO
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterDeleteOtherInfo(MSG_FC_CHARACTER_DELETE_OTHER_INFO* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterDeleteOtherInfo(MSG_FC_CHARACTER_DELETE_OTHER_INFO* pMsg)");
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->OtherClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{
		DBGOUT("!!! %s Enemy Delete Other Info !!!\n", itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);
		itEnemy->second->m_bUsing = FALSE;
//		m_pScene->DeleteFieldItemOfUnitData( itEnemy->second );
//		m_pScene->DeleteToBlockData(itEnemy->second);
//		SAFE_DELETE(itEnemy->second);
//		m_pScene->m_mapEnemyList.erase(itEnemy);
//		DBGOUT("이런것도 보내나? MSG_FC_CHARACTER_DELETE_OTHER_INFO\n");
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterMonsterCreated(MSG_FC_MONSTER_CREATED* pMsg)
/// \brief		MSG_FC_MONSTER_CREATED
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterMonsterCreated(MSG_FC_MONSTER_CREATED* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterMonsterCreated(MSG_FC_MONSTER_CREATED* pMsg)");
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster == m_pScene->m_mapMonsterList.end())
	{
		CMonsterData * pMonster = new CMonsterData(pMsg);
		m_pScene->InsertToBlockData(pMonster);
		m_pScene->m_mapMonsterList[pMsg->MonsterIndex] = pMonster;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleRequestP2PPkOk(MSG_FC_BATTLE_REQUEST_P2P_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_REQUEST_P2P_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleRequestP2PPkOk(MSG_FC_BATTLE_REQUEST_P2P_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleRequestP2PPkOk(MSG_FC_BATTLE_REQUEST_P2P_PK_OK* pMsg)");
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->SourceClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{
		BOOL bRejectCheck = TRUE;
		// 2006-11-07 by ispark, 거절 리스트에 있는 사람이 나한테 걸었을 때
		vector<Reject_t>::iterator itReject = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
		while(itReject != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
		{
			if(0 == stricmp(itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName, itReject->szRejectName))
			{
				bRejectCheck = FALSE;
				break;
			}
			itReject++;			
		}
		// 2008-06-20 by bhsohn EP3 옵션관련 처리
		// 옵션에서 1:1 결투 끄기
		if(bRejectCheck)
		{
			if(!g_pD3dApp->IsOptionEtc(OPTION_RADIO_MAN_TO_MAN))
			{
				bRejectCheck = FALSE;
			}
			// 2015-01-06 by jwLee hp가 0이하면 1:1 결투 무조껀 거부하도록 설정
			else if (g_pShuttleChild->GetMyShuttleInfo().CurrentHP <= 0)
			{
				bRejectCheck = FALSE;
			}
			// end 2015-01-06 by jwLee hp가 0이하면 1:1 결투 무조껀 거부하도록 설정
		}		
		// end 2008-06-20 by bhsohn EP3 옵션관련 처리

		if(g_pGameMain->m_pChat->m_bPKOptionFlag && bRejectCheck)
		{
			char buf[128];
			wsprintf(buf,STRMSG_C_PK_0007,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);//"%s님과 결투를 하시겠습니까?"
			g_pGameMain->m_pInfWindow->AddMsgBox(buf, _Q_PK_REQUEST, pMsg->SourceClientIndex,0,0,0,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);
			g_fSendMovePacket = max(g_fSendMovePacket,20.0f);
			// 2008-07-14 by bhsohn EP3 관련 처리
			//g_pGameMain->m_pOtherCharInfo->GetOtherCharInfo(itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName,TRUE);
			g_pGameMain->m_pCommunity->RqCharacterUserInfo(itEnemy->second->m_infoCharacter.CharacterInfo.CharacterUniqueNumber);
		}
		else
		{
			MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK sMsg;
			memset(&sMsg,0x00,sizeof(sMsg));
			char buffer[SIZE_MAX_PACKET];
			int nType = T_FC_BATTLE_REJECT_REQUEST_P2P_PK;
			sMsg.SourceClientIndex = itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex;
			memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
			memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
			g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
			
			char buf[128];
			wsprintf(buf,STRMSG_C_PK_0008,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);//"\\y결투거부상태 \\y%s님과 결투를 거부 하였습니다."
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);			
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAcceptRequestP2PPkOk(MSG_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAcceptRequestP2PPkOk(MSG_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleAcceptRequestP2PPkOk(MSG_FC_BATTLE_ACCEPT_REQUEST_P2P_PK_OK* pMsg)");

	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->PeerClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{
		itEnemy->second->SetPkState(PK_PVP, TRUE);
		g_pShuttleChild->SetPkState(PK_PVP, TRUE);
		// 2007-01-30 by dgwoo PVP시 1:1하는 유저의 인덱스값을 저장한다.
		g_pShuttleChild->SetPVPClientIndex(pMsg->PeerClientIndex);

		// 2005-05-18 by jschoi - 1:1 수락 시 강제 락온
		g_pShuttleChild->m_pOrderTarget = itEnemy->second;

		m_pChat->CreateChatChild(STRMSG_C_PK_0009,COLOR_PARTY);//"결투가 시작 되었습니다."
	}
	else
	{
		m_pChat->CreateChatChild(STRMSG_C_PK_0010,COLOR_PARTY);//"결투상대를 찾지 못하였습니다."
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleRejectRequestP2PPkOk(MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleRejectRequestP2PPkOk(MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleRejectRequestP2PPkOk(MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK_OK* pMsg)");
	m_pChat->CreateChatChild(STRMSG_C_PK_0011,COLOR_TRADE);//"상대방이 결투를 취소 하였습니다."
	vector<CINFMessageBox*>::iterator it = g_pGameMain->m_pInfWindow->m_vecMessageBox.begin();
	while(it != g_pGameMain->m_pInfWindow->m_vecMessageBox.end())
	{
		CINFMessageBox* pMsgBox = *it;		

		//  1:1 대결 지우기
		if(_Q_PK_REQUEST == pMsgBox->m_nMsgType)
		{
			MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK sMsg;
			memset(&sMsg,0x00,sizeof(sMsg));
			char buffer[SIZE_MAX_PACKET];
			int nType = T_FC_BATTLE_REJECT_REQUEST_P2P_PK;
			sMsg.SourceClientIndex = pMsgBox->m_dwData;
			memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
			memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
			g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
			pMsgBox->m_dwData = 0;
			g_pGameMain->m_pInfWindow->m_vecMessageBox.erase(it);
			delete pMsgBox;
			pMsgBox = NULL;
			continue;			
		}		
		it++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleSurrenderP2PPkOk(MSG_FC_BATTLE_SURRENDER_P2P_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_SURRENDER_P2P_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleSurrenderP2PPkOk(MSG_FC_BATTLE_SURRENDER_P2P_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleSurrenderP2PPkOk(MSG_FC_BATTLE_SURRENDER_P2P_PK_OK* pMsg)");
	if(m_pChat)
		m_pChat->CreateChatChild(STRMSG_C_PK_0012,COLOR_TRADE);//"상대방이 항복을 요청 하였습니다."
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->SourceClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{
		char buf[128];
		wsprintf(buf,STRMSG_C_PK_0013,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);//"%s님의 항복을 받아들이시겠습니까?"
		g_pGameMain->m_pInfWindow->AddMsgBox(buf, _Q_PK_LOSE_REQUEST_OK, pMsg->SourceClientIndex,0,0,0,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangeCharacterMent(MSG_FC_CHARACTER_CHANGE_CHARACTER_MENT* pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_CHARACTER_MENT
/// \author		ydkim
/// \date		
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeCharacterMent(MSG_FC_CHARACTER_CHANGE_CHARACTER_MENT* pMsg)
{
	int temp,temp2;
	char buf[2][512];
	memset(buf, 0x00, 512*2);

	strncpy( buf[0], pMsg->szCharacterMent1, sizeof(pMsg->szCharacterMent1));
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(buf[0], &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(buf[0],&temp,&temp2);
	strncpy( buf[1], buf[0], sizeof(buf[0]));

	if(pMsg->ClientIdx == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		// 내캐릭터의 멘트 이면
		memset(&g_pGameMain->m_pChat->m_strMyMent,0x00,sizeof(g_pGameMain->m_pChat->m_strMyMent));
		strncpy( g_pGameMain->m_pChat->m_strMyMent, buf[1], sizeof(buf[1]));
	}
	else
	{
		// 다른 캐릭터의 멘트 이면

		CEnemyData * pEnemy = (CEnemyData*)g_pScene->FindUnitDataByClientIndex(pMsg->ClientIdx);
		// 2006-05-03 by ispark, 다른 세력이면 보이지 않게 한다.
		if(pEnemy && IsInfluenceCharacter(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pEnemy->m_infoCharacter.CharacterInfo.InfluenceType))
		{
				memset(pEnemy->m_infoCharacter.CharacterInfo.szCharacterMent,0x00,SIZE_STRING_32);
				strncpy( pEnemy->m_infoCharacter.CharacterInfo.szCharacterMent, buf[1], strlen(buf[1]));			
	//		CVecEnemyIterator itEnemy = g_pD3dApp->m_pScene->m_vecEnemyRenderList.begin();
	//		while(itEnemy != g_pD3dApp->m_pScene->m_vecEnemyRenderList.end())
	//		{
	//			if((*itEnemy)->m_infoCharacter.CharacterInfo.ClientIndex == pMsg->ClientIdx)
	//			{
	//				memset((*itEnemy)->m_infoCharacter.CharacterInfo.szCharacterMent,0x00,SIZE_STRING_32);
	//				strncpy( (*itEnemy)->m_infoCharacter.CharacterInfo.szCharacterMent, buf[1], strlen(buf[1]));			
	//			}
	//			
	//			itEnemy++;
	//		}		
		}
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleRejectSurrenderP2PPkOk(MSG_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK* pMsg)
/// \brief		MSG_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleRejectSurrenderP2PPkOk(MSG_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleRejectSurrenderP2PPkOk(MSG_FC_BATTLE_REJECT_SURRENDER_P2P_PK_OK* pMsg)");
	if(m_pChat)
	{
		m_pChat->CreateChatChild(STRMSG_C_PK_0014,COLOR_TRADE);//"상대방이 항복을 거절 하였습니다."
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleEndP2PPk(MSG_FC_BATTLE_END_P2P_PK* pMsg)
/// \brief		MSG_FC_BATTLE_END_P2P_PK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleEndP2PPk(MSG_FC_BATTLE_END_P2P_PK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleEndP2PPk(MSG_FC_BATTLE_END_P2P_PK* pMsg)");
	switch(pMsg->EndType)
	{
	case BATTLE_END_WIN:
		{
			if(m_pChat)
				m_pChat->CreateChatChild(STRMSG_C_PK_0015,COLOR_TRADE);//"[승리]결투에서 승리 하였습니다."
		}
		break;
	case BATTLE_END_DEFEAT:
		{
			if(m_pChat)
				m_pChat->CreateChatChild(STRMSG_C_PK_0016,COLOR_TRADE);//"[패배]결투에서 패배 하였습니다."
		}
		break;
	case BATTLE_END_TIE:
		{
			if(m_pChat)
				m_pChat->CreateChatChild(STRMSG_C_PK_0017,COLOR_TRADE);//"[무승부]결투에서 승부를 내지 못하였습니다."
		}
		break;
	case BATTLE_END_END:
		{
			if(m_pChat)
				m_pChat->CreateChatChild(STRMSG_C_PK_0018,COLOR_TRADE);//"[결투종료]결투가 종료 되었습니다."
		}
		break;
	}
	m_pShuttleChild->SetPkState( PK_PVP, FALSE );
	m_pShuttleChild->SetPVPClientIndex(NULL);
//	m_pShuttleChild->m_bPKMode = FALSE;
//	m_pShuttleChild->m_pOrderTarget = NULL;
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->PeerClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{
		itEnemy->second->SetPkState( PK_PVP, FALSE );
		if(m_pShuttleChild->m_pOrderTarget == itEnemy->second )
		{
			m_pShuttleChild->m_pOrderTarget = NULL;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterChangePKPoint(MSG_FC_CHARACTER_CHANGE_PKPOINT* pMsg)
/// \brief		MSG_FC_CHARACTER_CHANGE_PKPOINT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangePKPoint(MSG_FC_CHARACTER_CHANGE_PKPOINT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterChangePKPoint(MSG_FC_CHARACTER_CHANGE_PKPOINT* pMsg)");
	if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pShuttleChild->m_myShuttleInfo.Propensity = pMsg->Propensity;
		m_pShuttleChild->m_myShuttleInfo.PKWinPoint = pMsg->PKWinPoint;
		m_pShuttleChild->m_myShuttleInfo.PKLossPoint = pMsg->PKLossPoint;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleDropDummyOk(MSG_FC_BATTLE_DROP_DUMMY_OK* pMsg)
/// \brief		MSG_FC_BATTLE_DROP_DUMMY_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleDropDummyOk(MSG_FC_BATTLE_DROP_DUMMY_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleDropDummyOk(MSG_FC_BATTLE_DROP_DUMMY_OK* pMsg)");
// 2006-12-04 by ispark, 개별 관리로 변경
	if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pShuttleChild->DelChaffDataAll();		
		m_pShuttleChild->AddChaffData(m_pShuttleChild, pMsg);
//		m_pScene->AddFieldItemBattleDropDummyOk( m_pShuttleChild, pMsg );
	}
	else
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			itEnemy->second->DelChaffDataAll();
			itEnemy->second->AddChaffData(itEnemy->second, pMsg);
//			m_pScene->AddFieldItemBattleDropDummyOk( itEnemy->second, pMsg );
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBattleDeleteDummyOK(MSG_FC_BATTLE_DELETE_DUMMY_OK* pMsg)
/// \brief		더미 삭제
/// \author		ispark
/// \date		2006-12-04 ~ 2006-12-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleDeleteDummyOK(MSG_FC_BATTLE_DELETE_DUMMY_OK* pMsg)
{
	if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pShuttleChild->DelChaffData(pMsg->ItemFieldIndex);
	}
	else
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			itEnemy->second->DelChaffData(pMsg->ItemFieldIndex);
		}
	}
}
	
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBattleExplodeDummyOK(MSG_FC_BATTLE_EXPLODE_DUMMY_OK* pMsg)
/// \brief		더미 폭파
/// \author		ispark
/// \date		2006-12-04 ~ 2006-12-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleExplodeDummyOK(MSG_FC_BATTLE_EXPLODE_DUMMY_OK* pMsg)
{
	if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pShuttleChild->DelChaffData(pMsg->ItemFieldIndex);
		if(g_pShuttleChild->m_pChaffData.size() <= 0)
		{
			vector<CSkillInfo*>::iterator itSkillInfo = g_pShuttleChild->m_pSkill->m_vecUsingSkill.begin();
			while(itSkillInfo != g_pShuttleChild->m_pSkill->m_vecUsingSkill.end())
			{
				// 2009-04-21 by bhsohn 아이템 DesParam추가
				//if(IS_EXIST_DES_PARAM((*itSkillInfo)->ItemInfo, DES_SKILL_HALLUCINATION))
				if((*itSkillInfo)->ItemInfo->IsExistDesParam(DES_SKILL_HALLUCINATION))
				{
					(*itSkillInfo)->ChangeSkillState(SKILL_STATE_WAIT_REATTACK);
				}
				itSkillInfo++;
			}
		}
	}
	else
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end())
		{
			itEnemy->second->DelChaffData(pMsg->ItemFieldIndex);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackHideItem(MSG_FC_BATTLE_ATTACK_HIDE_ITEM* pMsg)
/// \brief		MSG_FC_BATTLE_ATTACK_HIDE_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackHideItem(MSG_FC_BATTLE_ATTACK_HIDE_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleAttackHideItem(MSG_FC_BATTLE_ATTACK_HIDE_ITEM* pMsg)");
	m_pScene->DeleteFieldItemOfFieldIndex( pMsg->TargetItemFieldIndex );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackExplodeItem(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM* pMsg)
/// \brief		MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackExplodeItem(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleAttackExplodeItem(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM* pMsg)");
	m_pScene->ExplodingFieldItemOfFieldIndex( pMsg->TargetItemFieldIndex );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterHide(MSG_FC_MONSTER_HIDE* pMsg)
/// \brief		MSG_FC_MONSTER_HIDE
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterHide(MSG_FC_MONSTER_HIDE* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterHide(MSG_FC_MONSTER_HIDE* pMsg)");
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->m_bRenderState = FALSE;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterShow(MSG_FC_MONSTER_SHOW* pMsg)
/// \brief		MSG_FC_MONSTER_SHOW
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterShow(MSG_FC_MONSTER_SHOW* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterShow(MSG_FC_MONSTER_SHOW* pMsg)");
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->m_bRenderState = TRUE;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterChangeBodycondition(MSG_FC_MONSTER_CHANGE_BODYCONDITION* pMsg)
/// \brief		MSG_FC_MONSTER_CHANGE_BODYCONDITION
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterChangeBodycondition(MSG_FC_MONSTER_CHANGE_BODYCONDITION* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterChangeBodycondition(MSG_FC_MONSTER_CHANGE_BODYCONDITION* pMsg)");
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->ChangeBodyConditionFromServer(pMsg->BodyCondition);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleDropFixerOk(MSG_FC_BATTLE_DROP_FIXER_OK* pMsg)
/// \brief		MSG_FC_BATTLE_DROP_FIXER_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleDropFixerOk(MSG_FC_BATTLE_DROP_FIXER_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleDropFixerOk(MSG_FC_BATTLE_DROP_FIXER_OK* pMsg)");
	CItemData* pItem = m_pScene->FindFieldItemByFieldIndex( pMsg->ItemFieldIndex );
	if( pItem )//&& pItem->m_dwPartType == _FIXER)
	{
		return;
	}
	CAtumData * pAttack = m_pScene->FindUnitDataByClientIndex(pMsg->AttackIndex);
	CAtumData * pTarget = m_pScene->FindUnitDataByClientIndex(pMsg->TargetIndex);
	if(pAttack && pTarget)
	{
		m_pScene->AddFieldItemBattleDropFixerOk(pTarget,pAttack,pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetItemInfoOk(ITEM & item)
/// \brief		MSG_FC_INFO_GET_ITEM_INFO_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		ITEM & item
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetItemInfoOk(ITEM & item)
{
	FLOG("CAtumApplication::FieldSocketInfoGetItemInfoOk(ITEM & item)");
	EnterCriticalSection(&m_cs);
	ITEM * pInfo = m_pDatabase->UpdateItemInfo(item);
	if(pInfo)
	{
		g_pStoreData->UpdateItemInfo( item.ItemNum );
	}
//	if(pInfo)
//	{
//		g_pStoreData->UpdateUnitInfoByUpdateItemInfo( pInfo );
//	}
	// 중량의 변화등은 영향을 주게 된다면 새로 셋팅되어야한다.

	LeaveCriticalSection(&m_cs);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetSimpleItemInfoOk(MEX_ITEM_INFO & pMsg)
/// \brief		MSG_FC_INFO_GET_SIMPLE_ITEM_INFO_OK
/// \author		dhkwon
/// \date		2004-07-01 ~ 2004-07-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetSimpleItemInfoOk(MEX_ITEM_INFO	& ItemInfo)
{
	g_pDatabase->UpdateSimpleItemInfo( ItemInfo );
	g_pStoreData->UpdateItemInfo( ItemInfo.ItemNum );
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetEnchantCostOk(MSG_FC_INFO_GET_ENCHANT_COST_OK* pMsg)
/// \brief		MSG_FC_INFO_GET_ENCHANT_COST_OK
/// \author		dhkwon
/// \date		2004-07-01 ~ 2004-07-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetEnchantCostOk(MSG_FC_INFO_GET_ENCHANT_COST_OK* pMsg)
{
	CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
	if(pCityLab)
	{
		pCityLab->SetPrice(pMsg->Cost);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetRareItemInfoOk(RARE_ITEM_INFO & item)
/// \brief		MSG_FC_INFO_GET_ITEM_INFO_OK
/// \author		dhkwon
/// \date		2004-04-2 ~ 2004-04-2
/// \warning	
///
/// \param		RARE_ITEM_INFO & rareItem
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetRareItemInfoOk(RARE_ITEM_INFO & rareItem)
{
	FLOG("CAtumApplication::FieldSocketInfoGetRareItemInfoOk(RARE_ITEM_INFO & item)");
	EnterCriticalSection(&m_cs);
	RARE_ITEM_INFO * pRareItem = m_pDatabase->UpdateRareItemInfo(rareItem);
	//g_pStoreData->UpdateUnitInfoByUpdateItemInfo( pInfo );
	// 중량의 변화등은 영향을 주게 된다면 새로 셋팅되어야한다.

	LeaveCriticalSection(&m_cs);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetMonsterInfoOk(MSG_FC_INFO_GET_MONSTER_INFO_OK *mon)
/// \brief		MSG_FC_INFO_GET_MONSTER_INFO_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetMonsterInfoOk(MSG_FC_INFO_GET_MONSTER_INFO_OK *mon)
{
	FLOG("CAtumApplication::FieldSocketInfoGetMonsterInfoOk(MSG_FC_INFO_GET_MONSTER_INFO_OK *mon)");
	EnterCriticalSection(&m_cs);
	m_pDatabase->UpdateMonsterInfo( &mon->MonsterInfo );
	LeaveCriticalSection(&m_cs);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetMapObjectInfoOk(MAPOBJECTINFO & obj)
/// \brief		MSG_FC_INFO_GET_MAPOBJECT_INFO_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		MAPOBJECTINFO
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetMapObjectInfoOk(MAPOBJECTINFO & obj)
{
	FLOG("CAtumApplication::FieldSocketInfoGetMapObjectInfoOk(MAPOBJECTINFO & obj)");
	EnterCriticalSection(&m_cs);
	MAPOBJECTINFO * pInfo = m_pDatabase->UpdateObjectInfo( obj );
	if(g_pGround)
	{
		CObjectChild * pBigObj = NULL;
		CObjectChild * pObj = NULL;
		if(g_pGround->m_ppObjectList)
		{// 지형 오브젝트 정보 갱신
// 수정 해야함			
//			for(int i = 0;i<g_pGround->m_projectInfo.sXSize;i++)
//			{
//				for(int j = 0;j<g_pGround->m_projectInfo.sXSize;j++)
//				{
//					pObj = (CObjectChild *)g_pGround->m_pObject[i*g_pGround->m_projectInfo.sYSize + j].m_pChild;
//					while(pObj)
//					{
//						if(pObj->m_nCode == pInfo->Code)
//						{
//							pObj->m_pObjectInfo = pInfo;
//						}
//						pObj = (CObjectChild *)pObj->m_pNext;
//					}
//					pBigObj = (CObjectChild *)g_pGround->m_pBigObject; 
//					while( pBigObj ) 
//					{ 
//						if(pBigObj->m_nCode == pInfo->Code) 
//						{ 
//							pBigObj->m_pObjectInfo = pInfo; 
//						} 
//						pBigObj = (CObjectChild *)pBigObj->m_pNext; 
//					} 
//
//				}
//			}
		}
		if(g_pGround->m_pObjectEvent)
		{// 이벤트 오브젝트 정보 갱신
			pObj = (CObjectChild *)g_pGround->m_pObjectEvent->m_pChild;
			while(pObj)
			{
				if(pObj->m_nCode == pInfo->Code)
				{
					pObj->m_pObjectInfo = pInfo;
				}
				pObj = (CObjectChild *)pObj->m_pNext;
			}
		}
	}

	LeaveCriticalSection(&m_cs);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackHideItemWKind(MSG_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND* pMsg)
/// \brief		MSG_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackHideItemWKind(MSG_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleAttackHideItemWKind(MSG_FC_BATTLE_ATTACK_HIDE_ITEM_W_KIND* pMsg)");
	m_pScene->DeleteFieldItemOfFieldIndex( pMsg->TargetItemFieldIndex );
	if(	pMsg->ItemKind == ITEMKIND_FIXER &&
		m_pShuttleChild &&
		pMsg->TargetIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pScene->DeleteFieldItemBattleDropFixerOk(pMsg->TargetItemFieldIndex);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackExplodeItemWKind(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND* pMsg)
/// \brief		MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackExplodeItemWKind(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleAttackExplodeItemWKind(MSG_FC_BATTLE_ATTACK_EXPLODE_ITEM_W_KIND* pMsg)");
	m_pScene->ExplodingFieldItemOfFieldIndex( pMsg->TargetItemFieldIndex );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketConnectSyncTime(MSG_FC_CONNECT_SYNC_TIME* pMsg)
/// \brief		MSG_FC_CONNECT_SYNC_TIME
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketConnectSyncTime(MSG_FC_CONNECT_SYNC_TIME* pMsg)
{
	FLOG("CAtumApplication::FieldSocketConnectSyncTime(MSG_FC_CONNECT_SYNC_TIME* pMsg)");
	m_pScene->m_dwStartTime = GetTickCount();
	m_pScene->m_nBaseTime = pMsg->CurrentTime;
#ifdef _DEBUG_MAPSETTING
	m_pScene->SetDay();
#endif
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemReloadItemInfo(void)
/// \brief		
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		void
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemReloadItemInfo(void)
{
	FLOG("CAtumApplication::FieldSocketItemReloadItemInfo(void)");
	m_pDatabase->ReloadDatabase();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUseEnchantOk(MSG_FC_ITEM_USE_ENCHANT_OK* pMsg)
/// \brief		MSG_FC_ITEM_USE_ENCHANT_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseEnchantOk(MSG_FC_ITEM_USE_ENCHANT_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUseEnchantOk(MSG_FC_ITEM_USE_ENCHANT_OK* pMsg)");
//	CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
//	if(pCityLab)
//	{
//		pCityLab->InitData();
//	}
	// 2015-05-29 by jwlee 연구소 UI 변경
// 	// 2010. 05. 27 by jskim 신규 럭키 머신 구현 - 버그 수정
// 	if(pMsg->bSuccessFlag)
// 	{
// 		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_100421_0417, COLOR_SYSTEM);
// 	}
// 	else
// 	{
// 		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_100421_0418, COLOR_SYSTEM);
// 	}
// 	//end 2010. 05. 27 by jskim 신규 럭키 머신 구현 - 버그 수정
#if defined(C_LABORATORY_UI_CHANGE_JWLEE)
	CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
	if (pCityLab)
	{
		pCityLab->FieldSocketItemUseEnchantOk(pMsg);
	}
#else
	if(pMsg->bSuccessFlag)
	{
		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_100421_0417, COLOR_SYSTEM);
	}
	else
	{
		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_100421_0418, COLOR_SYSTEM);
	}
#endif
	// end 2015-05-29 by jwlee 연구소 UI 변경
	
	DBGOUT("MSG_FC_ITEM_USE_ENCHANT_OK\n");
//	g_pGameMain->m_pInven->DeleteEnchantItem(pMsg->ItemNum);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemPutEnchant(MSG_FC_ITEM_PUT_ENCHANT* pMsg)
/// \brief		MSG_FC_ITEM_PUT_ENCHANT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemPutEnchant(MSG_FC_ITEM_PUT_ENCHANT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemPutEnchant(MSG_FC_ITEM_PUT_ENCHANT* pMsg)");
	if( g_pStoreData->PutEnchant(pMsg) == FALSE )
	{
		DBGOUT("MSG_FC_ITEM_PUT_ENCHANT\n");
//		if( m_dwGameState == _CITY )
//		{
			ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
			CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
			if(pStore)
			{
				pStore->AddEnchantItem( pMsg->Enchant.TargetItemUniqueNumber, pMsg->Enchant.EnchantItemNum );
			}
			CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
			if(pCityLab)
			{
				pCityLab->PutEnchant( pMsg );
			}
//		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestRequestStartResult(MSG_FC_QUEST_REQUEST_START_RESULT* pMsg)
/// \brief		MSG_FC_QUEST_REQUEST_START_RESULT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestRequestStartResult(MSG_FC_QUEST_REQUEST_START_RESULT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketQuestRequestStartResult(MSG_FC_QUEST_REQUEST_START_RESULT* pMsg)");
	ASSERT_ASSERT(g_pQuestData);
	if(pMsg->MexQuestInfo.QuestState == QUEST_STATE_IN_PROGRESS)
	{
		DBGOUT("Quest(%d) is Start.\n",pMsg->MexQuestInfo.QuestIndex);
		CQuest* pQuest = g_pQuestData->FindQuest(pMsg->MexQuestInfo.QuestIndex);
		if(pQuest)
		{
			MEX_QUEST_INFO* pCharacterQuest = g_pQuestData->FindCharacterQuest(pMsg->MexQuestInfo.QuestIndex);
			if(!pCharacterQuest)
			{
				pCharacterQuest = new MEX_QUEST_INFO;
				pCharacterQuest->QuestIndex = pQuest->QuestIndex;
				pCharacterQuest->QuestState = QUEST_STATE_IN_PROGRESS;
				if(pQuest->IsCityWar)
				{
					strcpy( pCharacterQuest->szCityWarServerGroupName, pMsg->MexQuestInfo.szCityWarServerGroupName );
				}
				g_pQuestData->AddCharacterQuest(pCharacterQuest->QuestIndex, pCharacterQuest);
				if( m_dwGameState == _CITY ||
					m_dwGameState == _SHOP)	// 도시상점 방문 중이라면 퀘스트 리스트를 다시 세팅한다.
				{
					#ifdef _DEBUG
					ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
					#else
					if( m_pInterface == NULL) return;
					if( m_pInterface->m_pCityBase == NULL ) return;
					#endif
					GUI_BUILDINGNPC* pShop = m_pInterface->m_pCityBase->GetCurrentBuildingNPC();
					if(pShop)
					{
						g_pQuestData->GetQuestList(pShop->buildingInfo.NPCIndex);
					}
				}
				if(pQuest->QuestEndType == QUEST_END_TYPE_IMMEDIATE)
				{
					// success
					g_pQuestData->SendFieldSocketQuestRequestSuccess( pQuest->QuestIndex );
				}
				else if(pQuest->QuestEndType == QUEST_END_TYPE_SELECT_INFLUENCE)
				{
					// 2007-06-12 by bhsohn 미션 인터페이스 수정안
					//g_pGameMain->m_pMissionInfo->SetInfluenceMission(TRUE, pMsg->fANIInflDistributionPercent, pMsg->fVCNInflDistributionPercent);
					g_pGameMain->SetInfluenceMission(TRUE, pMsg->fANIInflDistributionPercent, pMsg->fVCNInflDistributionPercent);
				}

				if(pQuest->TimeLimitInMinutes != 0)
				{
					g_pGameMain->SetQuestLimitTime( pQuest->TimeLimitInMinutes, 0, pQuest->QuestName);
				}
				if(m_pShuttleChild->m_myShuttleInfo.Level < 6)
				{
					// 미션은 기어정보창에서 확인하실수 있습니다.
					g_pGameMain->SetNotice( 25 );
				}

			}
			else
			{
				pCharacterQuest->QuestIndex = pQuest->QuestIndex;
				pCharacterQuest->QuestState = QUEST_STATE_IN_PROGRESS;
				if(pQuest->TimeLimitInMinutes != 0)
				{
					g_pGameMain->SetQuestLimitTime( pQuest->TimeLimitInMinutes, 
						pCharacterQuest->QuestPlayTimeStamp, pQuest->QuestName);
				}

				DBGOUT("Already Start Quest .(QuestIndex:%d)\n",pQuest->QuestIndex);
			}
		}
	}
	else if(pMsg->MexQuestInfo.QuestState == QUEST_STATE_NONE)
	{
		DBGOUT("Can't Start Quest.(QuestIndex:%d)\n",pMsg->MexQuestInfo.QuestIndex);
	}

	// 2009-02-03 by bhsohn 미션 시작시 완료 체크 체크
	{
		int nMissionIndex = g_pD3dApp->SerchMissionCondition();
		if(nMissionIndex != NULL && g_pGImage)
		{
			g_pGImage->SetImageInfo(MISSION_SUC, TRUE);
		}
	}
	// end 2009-02-03 by bhsohn 미션 시작시 완료 체크 체크
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestRequestSuccessResult(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT* pMsg)
/// \brief		MSG_FC_QUEST_REQUEST_SUCCESS_RESULT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestRequestSuccessResult(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketQuestRequestSuccessResult(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT* pMsg)");
	ASSERT_ASSERT(g_pQuestData);
	#ifdef _DEBUG
	ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
	#else
	if( m_pInterface == NULL) return;
	if( m_pInterface->m_pCityBase == NULL ) return;
	#endif
	if(pMsg->IsSuccessful)
	{
		DBGOUT("Quest(%d)is Done.\n",pMsg->QuestIndex);
		// 미션창 색바꾸기
		if(g_pInterface->m_pCityBase->m_pMission->m_nCancerSelect < CITY_MISSION_MAX_NUMBER)
				g_pInterface->m_pCityBase->m_pMission->m_bProgressMission[g_pInterface->m_pCityBase->m_pMission->m_nCancerSelect] = FALSE;
		CQuest *pQuest = g_pQuestData->FindQuest( pMsg->QuestIndex );
		ASSERT_ASSERT(pQuest);
		if(pQuest->TimeLimitInMinutes != 0)
		{
			g_pGameMain->m_bQuestLimitTimeView = FALSE;
		}
		if(pQuest->QuestType == QUEST_TYPE_REPEATABLE)
		{
			g_pQuestData->DeleteCharacterQuest(pMsg->QuestIndex);
		}		
		else
		{
			MEX_QUEST_INFO* pCharacterQuest = g_pQuestData->FindCharacterQuest(pMsg->QuestIndex);
			if(!pCharacterQuest)
			{
				pCharacterQuest = new MEX_QUEST_INFO;
				pCharacterQuest->QuestIndex = pMsg->QuestIndex;
				pCharacterQuest->QuestState = QUEST_STATE_COMPLETED;
				g_pQuestData->AddCharacterQuest(pCharacterQuest->QuestIndex, pCharacterQuest);
				DBGOUT("Exit Quest Not Started Quest (QuestIndex:%d)\n",pMsg->QuestIndex);
			}
			else
			{
				pCharacterQuest->QuestIndex = pMsg->QuestIndex;
				pCharacterQuest->QuestState = QUEST_STATE_COMPLETED;
			}

			if(pQuest->QuestEndType == QUEST_END_TYPE_SELECT_INFLUENCE)
			{
				// 2006-02-08 by ispark FALSE라면... 뒤 인자 값이 필요가 없다.
				// 2007-06-12 by bhsohn 미션 인터페이스 수정안
				//g_pGameMain->m_pMissionInfo->SetInfluenceMission(FALSE, 0.0f, 0.0f);			
				g_pGameMain->SetInfluenceMission(FALSE, 0.0f, 0.0f);			
			}
			else if(pQuest->TargetMeetObjectMapArea.MapIndex != 0 && pQuest->TargetMeetObjectIndex != 0)
			{
				g_pGImage->SetImageInfo(MISSION_SUC);
			}
			else if(0 != pQuest->TargetDeadByMonsterUniquenumber)
			{
				g_pGImage->SetImageInfo(MISSION_SUC);
			}
		}
//		if(m_dwGameState == _CITY)	// 도시상점 방문 중이라면 퀘스트 리스트를 다시 세팅한다.
		GUI_BUILDINGNPC* pShop = m_pInterface->m_pCityBase->GetCurrentBuildingNPC();
		if(pShop)
		{
			g_pQuestData->GetQuestList(pShop->buildingInfo.NPCIndex);
		}

		// 2007-03-06 by bhsohn 퀘스트 완료시 경험치 처리 방식 변경
		//g_pQuestData->SetQuestEndNPCTalk( TRUE, pMsg->QuestIndex);
		g_pQuestData->SetQuestEndNPCTalk( TRUE, pMsg->QuestIndex, pMsg->ExpOfCompensation);
		// end 2007-03-06 by bhsohn 퀘스트 완료시 경험치 처리 방식 변경

		g_pGameMain->m_pCharacterInfo->SetQuestDesc( -1 ); // reset
		if(pQuest->QuestType == QUEST_TYPE_SERIES && pQuest->NextQuestIndex != 0)
		{
			g_pQuestData->NotifyStartQuest();
		}
		char buf[256];
		if( pQuest->EndCinemaNum == 0 )
		{
//			wsprintf( buf, STRMSG_C_QUEST_0062, pQuest->QuestName );//"미션 %s를 완료하였습니다."
//			g_pGameMain->m_pInfWindow->AddMsgBox( buf, _MESSAGE );
		}
		else
		{
			wsprintf( buf, "%d.tex", pQuest->EndCinemaNum );
			g_pInterface->InitSoundScript( buf );
			g_pInterface->RestoreSoundScript();
		}
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		int nSelect = g_pGameMain->m_pMissionInfo->GetSelectIndexCurrent();
//		g_pGameMain->m_pMissionInfo->RefreshMission();
//		if(pQuest->QuestEndType == QUEST_END_TYPE_IMMEDIATE)
//		{
//			nSelect++;
//			
//			g_pGameMain->m_pMissionInfo->SetSelectIndexCurrent(nSelect);
//			g_pGameMain->m_pMissionInfo->SetFirstMissionSelect(TRUE);
//		}
		// 시작과 동시 시작인 퀘스트는 다음퀘스를 바로 선택하게끔
		if(pQuest->QuestEndType == QUEST_END_TYPE_IMMEDIATE)
		{
			INT dwNextQuest = pQuest->QuestIndex+1;
			g_pGameMain->ShowMissionTreeWnd(TRUE, FALSE);
			g_pGameMain->SelectNextMission(dwNextQuest);
			
		}

		vector<Quest_MonsterInfo>::iterator it = g_pQuestData->m_vecQuestMonsterCount.begin();
		while(it != g_pQuestData->m_vecQuestMonsterCount.end())
		{
			if(pMsg->QuestIndex == (*it).nQuestIndex)
			{
				it = g_pQuestData->m_vecQuestMonsterCount.erase(it);
				DBGOUT("FieldSocketQuestRequestSuccessResult, MonsterQuestInfo Delete QuestIndex %d\n", pMsg->QuestIndex);
				continue;
			}
			it++;
		}

		// 2007-07-04 by bhsohn 오퍼레이터 추가
		// 미션 성공 
		ShowOpMissionComplete(pMsg);
	}
	else
	{
		DBGOUT("Failed Quest(QuestIndex:%d)", pMsg->QuestIndex);
		CQuest *pQuest = g_pQuestData->FindQuest( pMsg->QuestIndex );
		ASSERT_ASSERT(pQuest);
		// 2007-03-06 by bhsohn 퀘스트 완료시 경험치 처리 방식 변경
		//g_pQuestData->SetQuestEndNPCTalk( FALSE, pMsg->QuestIndex );
		g_pQuestData->SetQuestEndNPCTalk( FALSE, pMsg->QuestIndex, pMsg->ExpOfCompensation);
		// end 2007-03-06 by bhsohn 퀘스트 완료시 경험치 처리 방식 변경
	}
	
	g_pQuestData->NotifyStartQuest();

	// 2007-06-12 by bhsohn 미션 인터페이스 수정안
	// 2009-04-08 by bhsohn 세력 불균형, 세력 초기화 시스템 추가 수정
	if(pMsg->IsSuccessful)
	{
		// 미션 정보 갱신
		g_pGameMain->RefreshMission(FALSE);	
		// 레벨업시 팝업 윈도우 Show
		CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();
		g_pGameMain->UpdateMissionPopWnd(myShuttleInfo.Level, pMsg->QuestIndex);
	}

//	if( (m_pScene->m_byMapType == MAP_TYPE_TUTORIAL) && 
//		(pMsg->QuestIndex == 1 || 
//		pMsg->QuestIndex == 2 || 
//		pMsg->QuestIndex == 3 || 
//		pMsg->QuestIndex == 11) )
//	{// 초보 퀘스트진행중일때만 체크
//		m_pShuttleChild->CheckBeginnerQuest();
//	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::ShowOpMissionComplete(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT* pMsg)
/// \brief		
/// \author		// 2007-07-04 by bhsohn 오퍼레이터 추가
/// \date		2007-07-16 ~ 2007-07-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::ShowOpMissionComplete(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT* pMsg)
{
	vector<QUEST_PAY_ITEM_INFO> vecQuestPay;
	vecQuestPay.clear();

	for(int i=0;i<pMsg->QuestPayInfoListCount;i++)
	{
		QUEST_PAY_ITEM_INFO* pRecvQuestPayItem = (QUEST_PAY_ITEM_INFO*)(((char*)pMsg) 
										+ sizeof(MSG_FC_QUEST_REQUEST_SUCCESS_RESULT)
										+ sizeof(QUEST_PAY_ITEM_INFO)*i);
		QUEST_PAY_ITEM_INFO tmpQuest;

		memcpy(&tmpQuest, pRecvQuestPayItem, sizeof(QUEST_PAY_ITEM_INFO));

		vecQuestPay.push_back(tmpQuest);
	}
	g_pInterface->ShowOpMissionComplete(pMsg->ExpOfCompensation, pMsg->BonusStatOfCompensation, vecQuestPay);
	// 2008-12-16 by dgwoo 미션 마스터 
	CQuest * pQuest = g_pQuestData->FindQuest(pMsg->QuestIndex);
	if(pQuest && (pQuest->QuestPartyType == QUEST_PARTYTYPE_PARTY)
		&& !(g_pShuttleChild->GetMyShuttleInfo().SecretInfoOption & USER_INFO_OPTION_MISSIONMASTER)
		&& (g_pQuestData->GetMissionMasterQuestCompletedCount() == 1))		
	{//미션 마스터 등록하는 창을 띄운다.
		g_pGameMain->m_pMissionMain->SetMissionMasterWindowShow(TRUE);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestRequestSuccessCheckResult(MSG_FC_QUEST_REQUEST_SUCCESS_CHECK_RESULT* pMsg)
/// \brief		파티미션 성공 결과물
/// \author		ispark
/// \date		2006-03-24 ~ 2006-03-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestRequestSuccessCheckResult(MSG_FC_QUEST_REQUEST_SUCCESS_CHECK_RESULT* pMsg)
{
	g_pGImage->SetImageInfo(MISSION_SUC, TRUE, pMsg->QuestIndex);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestPutAllQuest(MSG_FC_QUEST_PUT_ALL_QUEST* pMsg)
/// \brief		MSG_FC_QUEST_PUT_ALL_QUEST
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestPutAllQuest(MSG_FC_QUEST_PUT_ALL_QUEST* pMsg)
{
	FLOG("CAtumApplication::FieldSocketQuestPutAllQuest(MSG_FC_QUEST_PUT_ALL_QUEST* pMsg)");
	for(int i=0;i<pMsg->NumOfQuest;i++)
	{
		MEX_QUEST_INFO* pRecvCharacterQuest = (MEX_QUEST_INFO*)(((char*)pMsg) + sizeof(MSG_FC_QUEST_PUT_ALL_QUEST)
										+ sizeof(MEX_QUEST_INFO)*i);
		DBGOUT("Quest(%d:state:%d) Received.\n", pRecvCharacterQuest->QuestIndex,pRecvCharacterQuest->QuestState);
		MEX_QUEST_INFO* pCharacterQuest = new MEX_QUEST_INFO;
		memcpy(pCharacterQuest, pRecvCharacterQuest, sizeof(MEX_QUEST_INFO));
		g_pQuestData->AddCharacterQuest( pCharacterQuest->QuestIndex, pCharacterQuest );

		CQuest *pQuest = g_pQuestData->FindQuest( pCharacterQuest->QuestIndex );
		if( pQuest == NULL )
		{
			DBGOUT("Quest File is NULL(%d).\n\n\n\n", pCharacterQuest->QuestIndex);
			continue;
		}
		if( pQuest->TimeLimitInMinutes != 0 &&
			pCharacterQuest->QuestState == QUEST_STATE_IN_PROGRESS)
		{
			g_pGameMain->SetQuestLimitTime( pQuest->TimeLimitInMinutes, pRecvCharacterQuest->QuestPlayTimeStamp, pQuest->QuestName);
		}
	}
	
	SendMissionComplete();
	CQuest *pQuestInfo = g_pQuestData->GetProgressMission();
	if(pQuestInfo)
	{
		if(pQuestInfo->QuestEndType == QUEST_END_TYPE_SELECT_INFLUENCE)
		{
			// 2006-02-08 by ispark
			// 2007-06-12 by bhsohn 미션 인터페이스 수정안
			//g_pGameMain->m_pMissionInfo->SetInfluenceMission(TRUE, pMsg->fANIInflDistributionPercent, pMsg->fVCNInflDistributionPercent);
			g_pGameMain->SetInfluenceMission(TRUE, pMsg->fANIInflDistributionPercent, pMsg->fVCNInflDistributionPercent);
		}		
	}
	// 2007-01-26 by bhsohn 신규유저 미션 인터페이스
	// 신규 유저 도움말을 띠운다.
		g_pGameMain->UpdateNoviceUserHelper();		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestDiscardQuestOk(MSG_FC_QUEST_DISCARD_QUEST_OK* pMsg)
/// \brief		MSG_FC_QUEST_DISCARD_QUEST_OK, 진행중인 퀘스트 취소
/// \author		dhkwon
/// \date		2004-08-09 ~ 2004-08-09
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestDiscardQuestOk(MSG_FC_QUEST_DISCARD_QUEST_OK* pMsg)
{
	if( pMsg->IsDiscarded == 1 ) // 퀘스트 취소 성공
	{
		CQuest *pQuest = g_pQuestData->FindQuest( pMsg->QuestIndex );
		if( pQuest )
		{
			char buf[256];
			wsprintf( buf, STRMSG_C_QUEST_0063, pQuest->QuestName );//"[%s]미션이 취소 되었습니다."
			m_pChat->CreateChatChild( buf, COLOR_SYSTEM );

			// 2007-06-12 by bhsohn 미션 인터페이스 수정안
			//g_pGameMain->m_pMissionInfo->RefreshMission();			

			if(pQuest->TimeLimitInMinutes)
			{
				g_pGameMain->m_bQuestLimitTimeView = FALSE;
			}
		}
		g_pQuestData->DeleteCharacterQuest( pMsg->QuestIndex );
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
		g_pGameMain->RefreshMission(FALSE);

		#ifdef _DEBUG
		ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
		#else
		if( m_pInterface == NULL) return;
		if( m_pInterface->m_pCityBase == NULL ) return;
		#endif
		GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
		if(pBuilding)
		{
			g_pQuestData->GetQuestList( pBuilding->buildingInfo.NPCIndex );
		}
		g_pGameMain->m_pCharacterInfo->SetQuestDesc( -1 ); // reset

		// 퀘스트 몬스터 정보 지우기
		vector<Quest_MonsterInfo>::iterator it = g_pQuestData->m_vecQuestMonsterCount.begin();
		while(it != g_pQuestData->m_vecQuestMonsterCount.end())
		{
			if(pMsg->QuestIndex == (*it).nQuestIndex)
			{
				// 2006-04-10 by ispark, 버그 수정
				it = g_pQuestData->m_vecQuestMonsterCount.erase(it);
				DBGOUT("FieldSocketQuestDiscardQuestOk, MonsterQuestInfo Delete QuestIndex %d\n", pMsg->QuestIndex);
				continue;
			}
			it++;
		}
		
	}
	else
	{
		DBGOUT("CAtumApplication::FieldSocketQuestDiscardQuestOk, Quest(%d),pMsg->IsDiscarded != 1\n", pMsg->QuestIndex);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketSkillSetupSkillOk(MSG_FC_SKILL_SETUP_SKILL_OK* pMsg)
/// \brief		MSG_FC_SKILL_SETUP_SKILL_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSkillSetupSkillOk(MSG_FC_SKILL_SETUP_SKILL_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketSkillSetupSkillOk(MSG_FC_SKILL_SETUP_SKILL_OK* pMsg)");
	pMsg->ItemSkill.ItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemSkill.ItemNum);
	CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->PutSkill(&(pMsg->ItemSkill));		// 2004-07-23 jschoi
	g_pGameMain->m_pCharacterInfo->SetAllUTCInfo();

	//--------------------------------------------------------------------------//
	// 2006-12-14 by dgwoo ReAttackTime 10분 이상일 경우 서버와의 시간을 체크해서 
	// 스킬 사용시간을 클라이언트에 저장한다.
	UINT fReAttackTime = pSkillInfo->ItemInfo->ReAttacktime;

	// 2010. 08. 18. by hsLee. 관리자여도 스킬 재사용 시간 적용되도록 수정.
	// 2009. 04. 06 by ckPark 재사용 스킬 저장 속성 추가
// 	if(fReAttackTime >= TERM_TICK_MUST_SERVER_CHECK_SKILL_REATTACK_TIME &&							//5분 이상일 경우
// 		!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	// 관리자가 아니라면
	if(COMPARE_BIT_FLAG(pSkillInfo->ItemInfo->ItemAttribute, SKILL_ATTR_STORE_USING_TIME) /*&&		//5분 이상일 경우
		!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION)*/ )	// 관리자가 아니라면
	// end 2009. 04. 06 by ckPark 재사용 스킬 저장 속성 추가
	{
		ATUM_DATE_TIME curServerTime = GetServerDateTime();
		int nSeconds = curServerTime.GetTimeInSeconds() - pMsg->ItemSkill.UseTime.GetTimeInSeconds();
		if(fReAttackTime > (nSeconds * 1000))
		{//fReAttackTime - (nSeconds*1000) 음수일 경우는 시간이 많이 흐른뒤다 스킬을 그냥 사용할수 있도록한다.
			
			// 2009-02-17 by bhsohn 스캔 버그 수정
			pSkillInfo->SetSkillEnable(TRUE);
			// end 2009-02-17 by bhsohn 스캔 버그 수정

			pSkillInfo->SetClientIndex (	g_pShuttleChild->GetShuttleInfo()->ClientIndex ,
											g_pShuttleChild->GetShuttleInfo()->ClientIndex );

			g_pShuttleChild->m_pSkill->m_vecUsingSkill.push_back(pSkillInfo);
			pSkillInfo->SetSkillState(SKILL_STATE_WAIT_REATTACK);
			pSkillInfo->SetReattackTime(fReAttackTime - (nSeconds*1000));
		}
		
	}
	//--------------------------------------------------------------------------//
	
	if(pMsg->ItemUpdateType==IUT_SHOP)
	{
		// 2005-12-09 by ispark
		CAtumNode * pEffectParent;
		if(g_pD3dApp->m_bCharacter)
			pEffectParent = m_pCharacterChild;
		else
			pEffectParent = m_pShuttleChild;

//		CAppEffectData * pEff = new CAppEffectData(m_pShuttleChild,RC_EFF_GET_SKILL,D3DXVECTOR3(0,0,0));
		CAppEffectData * pEff = new CAppEffectData(pEffectParent,RC_EFF_GET_SKILL,D3DXVECTOR3(0,0,0));
		m_pEffectList->AddChild(pEff);
		CINFCitySkillShop * pShop = (CINFCitySkillShop*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_SKILL_SHOP);
		if(pShop)
		{
			pShop->ReloadSkillItemList();
		}

		char ShopResult[128];
		wsprintf(ShopResult, STRMSG_C_060519_0001, pMsg->ItemSkill.ItemInfo->ItemName, pMsg->ItemSkill.ItemInfo->SkillLevel);
		m_pChat->CreateChatChild(ShopResult, COLOR_ITEM);

		m_bRequestEnable = TRUE;
		g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketRequestRequestOk(MSG_FC_REQUEST_REQUEST_OK* pMsg)
/// \brief		MSG_FC_REQUEST_REQUEST_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestRequestOk(MSG_FC_REQUEST_REQUEST_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketRequestRequestOk(MSG_FC_REQUEST_REQUEST_OK* pMsg)");
	BYTE bType = pMsg->RequestType;
	int nMsgType = 0;
	char buf[256];
	switch(bType)
	{
	case REQUEST_TYPE_PARTY_BATTLE:
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->SourceClientIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				nMsgType = _Q_REQUEST_PARTY_BATTLE;
				wsprintf(buf,STRMSG_C_PARTY_0048,itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName);//"%s님의 편대와 편대 결투를 하시겠습니까?"

				// 2008-07-14 by bhsohn EP3 관련 처리
				// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
				if(g_pGameMain && g_pGameMain->IsRejectUser(itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName))
				{	
					g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_080714_0207,COLOR_ERROR);//"\\y거부 목록에 등록된 대상입니다."					
				}
				// end 2008-07-14 by bhsohn EP3 관련 처리

				// 2008-06-20 by bhsohn EP3 옵션관련 처리
				//if(!g_pGameMain->m_pInfWindow->IsExistMsgBox(nMsgType))
				// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
				if(g_pGameMain && !g_pGameMain->m_pInfWindow->IsExistMsgBox(nMsgType) 
					&& IsOptionEtc(OPTION_RADIO_FORMATIONWAR)// 편대 전투 옵션을 켜야한다.
					&&!g_pGameMain->IsRejectUser(itEnemy->second->m_infoCharacter.CharacterInfo.CharacterName)) // 거부 리스트에 없는 유저만 보낸다.	// 2008-07-14 by bhsohn EP3 관련 처리
				{
					// 편대전 요청시 메뉴 사용 불가 세팅
					g_pGameMain->m_pCommunity->GetParty()->SetEnablePartyMenu(FALSE);
					g_pGameMain->m_pInfWindow->AddMsgBox(buf,nMsgType,pMsg->SourceClientIndex);
					break;
				}
				else
				{
					MSG_FC_REQUEST_REJECT_REQUEST sMsg;
					memset(&sMsg,0x00,sizeof(sMsg));
					char buffer[SIZE_MAX_PACKET];
					int nType = T_FC_REQUEST_REJECT_REQUEST;
					sMsg.SourceClientIndex = pMsg->SourceClientIndex;
					sMsg.RequestType = bType;
					memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
					memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
					m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
				}
			}
		}
		break;
	case REQUEST_TYPE_GUILD_WAR:
		{
			nMsgType = _Q_REQUEST_GUILD_WAR;
			wsprintf(buf,STRMSG_C_GUILD_0035,pMsg->SourceCharacterName);//"%s님의 여단과 여단전을 하시겠습니까?"
			// 2008-06-20 by bhsohn EP3 옵션관련 처리
			// 2008-07-14 by bhsohn EP3 관련 처리
			// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
			if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->SourceCharacterName))
			{	
				g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_080714_0207,COLOR_ERROR);//"\\y거부 목록에 등록된 대상입니다."					
			}
			// end 2008-07-14 by bhsohn EP3 관련 처리

//			if( !g_pGameMain->m_pInfWindow->IsExistMsgBox(nMsgType) && 
//				g_pShuttleChild->m_pGuildWarInfo == NULL)
			// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
			if( g_pGameMain && !g_pGameMain->m_pInfWindow->IsExistMsgBox(nMsgType) 
				&& g_pShuttleChild->m_pGuildWarInfo == NULL
				&& IsOptionEtc(OPTION_RADIO_GUILD_WAR)	// 여단전투를 켜야한다.
				&&!g_pGameMain->IsRejectUser(pMsg->SourceCharacterName)) // 거부 리스트에 없는 유저만 보낸다.	// 2008-07-14 by bhsohn EP3 관련 처리
			{
				// 편대전 요청시 메뉴 사용 불가 세팅
				g_pGameMain->m_pInfWindow->AddMsgBox(buf,nMsgType,pMsg->SourceClientIndex);
				break;
			}
			else
			{
				MSG_FC_REQUEST_REJECT_REQUEST sMsg;
				memset(&sMsg,0x00,sizeof(sMsg));
				sMsg.SourceClientIndex = pMsg->SourceClientIndex;
				sMsg.RequestType = bType;
				m_pFieldWinSocket->SendMsg( T_FC_REQUEST_REJECT_REQUEST, (char*)&sMsg, sizeof(sMsg) );
			}
		}
		break;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketRequestRejectRequestOk(MSG_FC_REQUEST_REJECT_REQUEST_OK* pMsg)
/// \brief		MSG_FC_REQUEST_REJECT_REQUEST_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestRejectRequestOk(MSG_FC_REQUEST_REJECT_REQUEST_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketRequestRejectRequestOk(MSG_FC_REQUEST_REJECT_REQUEST_OK* pMsg)");
	switch(pMsg->RequestType)
	{
	case REQUEST_TYPE_PARTY_BATTLE:
		{
			m_pChat->CreateChatChild(STRMSG_C_PARTY_0049,COLOR_SYSTEM);//"상대방이 편대 전투를 거절 하였습니다."
			// 편대전 메뉴 사용 가 세팅
			g_pGameMain->m_pCommunity->GetParty()->SetEnablePartyMenu(TRUE);
		}
		break;
	case REQUEST_TYPE_GUILD_WAR:
		{
			m_pChat->CreateChatChild(STRMSG_C_GUILD_0036,COLOR_SYSTEM);//"상대방이 여단전을 거절 하였습니다."
		}
		break;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketRequestCancelRequest(MSG_FC_REQUEST_CANCEL_REQUEST* pMsg)
/// \brief		MSG_FC_REQUEST_CANCEL_REQUEST
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestCancelRequest(MSG_FC_REQUEST_CANCEL_REQUEST* pMsg)
{
	FLOG("CAtumApplication::FieldSocketRequestCancelRequest(MSG_FC_REQUEST_CANCEL_REQUEST* pMsg)");
	switch(pMsg->RequestType)
	{
	case REQUEST_TYPE_PARTY_BATTLE:
		{
			m_pChat->CreateChatChild(STRMSG_C_PARTY_0050,COLOR_PARTY);//"편대전투 요청이 취소 되었습니다."
			if(g_pGameMain->m_pInfWindow->IsExistMsgBox(_Q_REQUEST_PARTY_BATTLE))
			{
				g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_REQUEST_PARTY_BATTLE);
			}
			// 편대전 메뉴 사용 가 세팅
			g_pGameMain->m_pCommunity->GetParty()->SetEnablePartyMenu(TRUE);
		}
		break;
	case REQUEST_TYPE_GUILD_WAR:
		{
			m_pChat->CreateChatChild(STRMSG_C_GUILD_0037,COLOR_SYSTEM);//"여단전 요청이 취소 되었습니다."
		}
		break;
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketRequestAcceptRequestOk(MSG_FC_REQUEST_ACCEPT_REQUEST_OK* pMsg)
/// \brief		MSG_FC_REQUEST_ACCEPT_REQUEST_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestAcceptRequestOk(MSG_FC_REQUEST_ACCEPT_REQUEST_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketRequestAcceptRequestOk(MSG_FC_REQUEST_ACCEPT_REQUEST_OK* pMsg)");
	switch(pMsg->RequestType)
	{
	case REQUEST_TYPE_PARTY_BATTLE:
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->PeerClientIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				char message[256];
				wsprintf(message,STRMSG_C_PARTY_0051,((CEnemyData *)itEnemy->second)->m_infoCharacter.CharacterInfo.CharacterName);//"%s 님이 편대전투를 승낙 하였습니다."
				m_pChat->CreateChatChild(message,COLOR_SYSTEM);
			}
		}
		break;
	case REQUEST_TYPE_GUILD_WAR:
		{
			char message[256];
			wsprintf(message,STRMSG_C_GUILD_0038,pMsg->PeerCharacterName);//"%s 님이 여단전을 승낙 하였습니다."
			m_pChat->CreateChatChild(message,COLOR_SYSTEM);
		}
		break;
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketRequestRepairOk(MSG_FC_SHOP_REQUEST_REPAIR_OK* pMsg)
/// \brief		MSG_FC_SHOP_REQUEST_REPAIR_OK 보급 OK
/// \author		ispark
/// \date		2005-11-08 ~ 2005-11-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestRepairOk(MSG_FC_SHOP_REQUEST_REPAIR_OK* pMsg)
{
	char message[256];
	switch(pMsg->DesParam)
	{
	// 2015-05-14 by jwlee STRMSG_C_051108_0002, STRMSG_C_051108_0003, STRMSG_C_051108_0004 수정
// 2006-03-07 by ispark, 언어에 따라 위치 수정
// #if defined(LANGUAGE_ENGLISH) || defined(LANGUAGE_VIETNAM)|| defined(LANGUAGE_THAI)|| defined(LANGUAGE_RUSSIA)// 2008-04-30 by bhsohn 태국 버전 추가
// 	// 2005-11-10 by ispark
// 	// 글로벌에서는 메세지 입력 순서가 다르다.
// 	case DES_HP:
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->Count, "HP", pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_DP:
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->Count, "Shield", pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_EP:
// 		wsprintf(message,STRMSG_C_051108_0003, pMsg->Count, "EP", pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 보급하였습니다."
// 		break;
// 	case DES_SP:
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->Count, "SP", pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_BULLET_01:
// 		wsprintf(message,STRMSG_C_051108_0004, g_pShuttleChild->m_pPrimaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count, pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
// 		break;
// 	case DES_BULLET_02:
// 		wsprintf(message,STRMSG_C_051108_0004, g_pShuttleChild->m_pSecondaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count, pMsg->RepairCost);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
// 		break;
// #elif defined(LANGUAGE_CHINA)
// 		case DES_HP:
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "HP");
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_DP:
// 		//wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "Shield");
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, STRMSG_C_070425_0200);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_EP:
// 		//wsprintf(message,STRMSG_C_051108_0003, pMsg->RepairCost, pMsg->Count, "EP");
// 		wsprintf(message,STRMSG_C_051108_0003, pMsg->RepairCost, pMsg->Count, STRMSG_C_070425_0201);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 보급하였습니다."
// 		break;
// 	case DES_SP:
// 		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "SP");
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
// 		break;
// 	case DES_BULLET_01:
// 		wsprintf(message,STRMSG_C_051108_0004, pMsg->RepairCost, g_pShuttleChild->m_pPrimaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
// 		break;
// 	case DES_BULLET_02:
// 		wsprintf(message,STRMSG_C_051108_0004, pMsg->RepairCost, g_pShuttleChild->m_pSecondaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count);
// 		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
// 		break;
// #else
	// end 2015-05-14 by jwlee STRMSG_C_051108_0002, STRMSG_C_051108_0003, STRMSG_C_051108_0004 수정
	case DES_HP:
		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "HP");
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
		break;
	case DES_DP:
		//wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "쉴드");
		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, STRMSG_C_070425_0200);
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
		break;
	case DES_EP:
		//wsprintf(message,STRMSG_C_051108_0003, pMsg->RepairCost, pMsg->Count, "EP");
		wsprintf(message,STRMSG_C_051108_0003, pMsg->RepairCost, pMsg->Count, STRMSG_C_070425_0201);
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 보급하였습니다."
		break;
	case DES_SP:
		wsprintf(message,STRMSG_C_051108_0002, pMsg->RepairCost, pMsg->Count, "SP");
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%d][%s] 회복하였습니다."
		break;
	case DES_BULLET_01:
		wsprintf(message,STRMSG_C_051108_0004, pMsg->RepairCost, g_pShuttleChild->m_pPrimaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count);
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
		break;
	case DES_BULLET_02:
		wsprintf(message,STRMSG_C_051108_0004, pMsg->RepairCost, g_pShuttleChild->m_pSecondaryWeapon->GetRealItemInfo()->ItemName, pMsg->Count);
		m_pChat->CreateChatChild(message, COLOR_ERROR);//"[%d] SPI(스피)로 [%s][%d]발을 보급하였습니다."
		break;
// 2015-05-14 by jwlee STRMSG_C_051108_0002, STRMSG_C_051108_0003, STRMSG_C_051108_0004 수정
//#endif
// end 2015-05-14 by jwlee STRMSG_C_051108_0002, STRMSG_C_051108_0003, STRMSG_C_051108_0004 수정
	default:
		{
			return;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketShopBuyColorItemOk(MSG_FC_SHOP_BUY_COLOR_ITEM_OK* pMsg)
/// \brief		MSG_FC_SHOP_BUY_COLOR_ITEM_OK
/// \author		ydkim
/// \date		2005-12-8
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopBuyColorItemOk(MSG_FC_SHOP_BUY_COLOR_ITEM_OK* pMsg)
{
	CItemInfo*  pItemArmor = NULL;
	pItemArmor = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUID64);
	if(pItemArmor)
	{
		pItemArmor->ColorCode		= pMsg->ColorCode;		
		// 2006-02-17 by ispark
//		g_pGameMain->m_nArmorColor	= max(1, pMsg->ColorCode%100);
		g_pShuttleChild->SetAmorColor(max(1, pMsg->ColorCode%100));
		// 2006-05-19 by ispark, 구입
		char ShopResult[128];
// 2007-08-10 by cmkwon, 아래와 같이 수정함, 상점을 검색 할 필요가 없음
//		CINFCityShop * pCityShop = (CINFCityShop*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_TUNING_COLOR);
//		SHOP_ITEM* pShopItem = pCityShop->FindCityShopDataByColor(pMsg->ColorCode);
//		if(pShopItem)
//		{
//			wsprintf(ShopResult, STRMSG_C_060519_0002, pShopItem->ItemName);
//			m_pChat->CreateChatChild(ShopResult, COLOR_ITEM);	
//		}
		ITEM* item = g_pDatabase->GetServerItemInfo(pMsg->ColorCode);
		if(item)
		{
			wsprintf(ShopResult, STRMSG_C_060519_0002, item->ItemName);
			m_pChat->CreateChatChild(ShopResult, COLOR_ITEM);	
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyBattleStart(MSG_FC_PARTY_BATTLE_READY* pMsg)
/// \brief		MSG_FC_PARTY_BATTLE_READY
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyBattleStart(MSG_FC_PARTY_BATTLE_START* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyBattleReady(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestUpdateMonsterCount(MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT* pMsg)
/// \brief		MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT
/// \author		ydkim
/// \date		2005-10-26~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestUpdateMonsterCount(MSG_FC_QUEST_UPDATE_MONSTER_COUNT* pMsg)
{
	Quest_MonsterInfo pTempMonsterCount;
	int nMissionIndex = 0;
	
	vector<Quest_MonsterInfo>::iterator it = g_pQuestData->m_vecQuestMonsterCount.begin();
	while(it != g_pQuestData->m_vecQuestMonsterCount.end())
	{
		if( (*it).nMonsterUnitkind == pMsg->MonsterUniqueNumber && (*it).nQuestIndex == pMsg->QuestIndex)
		{
			// 기존 퀘스트에 퀘스트 몬스터가 있을 때
			(*it).nMonsterCount =  pMsg->Count;
			// 미션 완료 체크
			nMissionIndex = SerchMissionCondition();
			if(nMissionIndex != NULL)
			{
				// 2006-03-27 by ispark, 파티미션 추가
				CQuest *pQuest = g_pQuestData->GetProgressMission();
				if(pQuest->IsPartyQuest())
				{
					g_pQuestData->SendFieldSocketQuestRequestSuccessCheck(nMissionIndex);
				}
				else
				{
					g_pGImage->SetImageInfo(MISSION_SUC, TRUE);
				}
			}	
			return;
		}
		it++;
	}
	
	// 퀘스트 몬스터 추가 (기존에 퀘스트 몬스터가 없을때)
	pTempMonsterCount.nMonsterCount			= pMsg->Count;
	pTempMonsterCount.nMonsterUnitkind		= pMsg->MonsterUniqueNumber;
	pTempMonsterCount.nQuestIndex			= pMsg->QuestIndex;

	g_pQuestData->m_vecQuestMonsterCount.push_back(pTempMonsterCount);

	// 미션 완료 체크
	nMissionIndex = SerchMissionCondition();
	if(nMissionIndex != NULL)
	{
		// 2006-03-27 by ispark, 파티미션 추가
		CQuest *pQuest = g_pQuestData->GetProgressMission();
		if(pQuest->IsPartyQuest())
		{
			g_pQuestData->SendFieldSocketQuestRequestSuccessCheck(nMissionIndex);
		}
		else
		{
			g_pGImage->SetImageInfo(MISSION_SUC, TRUE);
		}
	}	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketQuestPutAllQuestMonsterCount(MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT* pMsg)
/// \brief		MSG_FC_QUEST_UPDATE_MONSTER_COUNT
/// \author		ydkim
/// \date		2005-10-26~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestPutAllQuestMonsterCount(MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT* pMsg)
{
	for(int i=0;i<pMsg->NumOfMonsterCount;i++)
	{
		MEX_QUEST_MONSTER_COUNT* pRecvMonsterCount = (MEX_QUEST_MONSTER_COUNT*)(((char*)pMsg) + sizeof(MSG_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT)
										+ sizeof(MEX_QUEST_MONSTER_COUNT)*i);

		Quest_MonsterInfo pTempMonsterCount;
		pTempMonsterCount.nMonsterCount		= pRecvMonsterCount->Count;
		pTempMonsterCount.nMonsterUnitkind	= pRecvMonsterCount->MonsterUniqueNumber;
		pTempMonsterCount.nQuestIndex		= pRecvMonsterCount->QuestIndex;

		g_pQuestData->m_vecQuestMonsterCount.push_back(pTempMonsterCount);
		DBGOUT("QuestMonsterCount(%d:state:%d) Received.\n", pRecvMonsterCount->MonsterUniqueNumber,pRecvMonsterCount->QuestIndex);
	}

	SendMissionComplete();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketPartyBattleEnd(MSG_FC_PARTY_BATTLE_END* pMsg)
/// \brief		MSG_FC_PARTY_BATTLE_END
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketPartyBattleEnd(MSG_FC_PARTY_BATTLE_END* pMsg)
{
	if(g_pShuttleChild)
		g_pShuttleChild->m_pClientParty->FPartyBattleEnd(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemResetSkillEnchantToLoadedItem(void)
/// \brief		
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	SKILL 파람이 적용되는 코드는 다시 구현해야 한다.
///
/// \param		void
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemResetSkillEnchantToLoadedItem(void)
{
	FLOG("CAtumApplication::FieldSocketItemResetSkillEnchantToLoadedItem(void)");
//	static BOOL bSet = TRUE;
//	if(bSet)
//	{
//		m_pShuttleChild->SetWeaponData(0,TRUE);//,TRUE);
//	}
//	else
//	{
//		m_pShuttleChild->SetWeaponData(1,TRUE);//,TRUE);
//	}
//	bSet = !bSet;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleToggleShieldResult(MSG_FC_BATTLE_TOGGLE_SHIELD_RESULT* pMsg)
/// \brief		MSG_FC_BATTLE_TOGGLE_SHIELD_RESULT
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleToggleShieldResult(MSG_FC_BATTLE_TOGGLE_SHIELD_RESULT* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleToggleShieldResult(MSG_FC_BATTLE_TOGGLE_SHIELD_RESULT* pMsg)");
	if(pMsg->IsOn)
	{
		if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			if(m_pShuttleChild && m_pShuttleChild->m_pSecondaryWeapon)
			{
//				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(WEAPON_BODYCON_START);
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING);
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING, FALSE);
				m_pShuttleChild->m_pSecondaryWeapon->SetUseToggleWeapon(TRUE);
			}

#ifdef _DEBUG
			char strMessage[256];
			wsprintf(strMessage,STRMSG_C_ITEM_0063);//"쉴드 아이템을 사용합니다."
			m_pChat->CreateChatChild(strMessage,COLOR_DEBUG);
#endif
//			m_pShuttleChild->m_bShielding = TRUE; // DP 변화로 세팅
		}
		else
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING);
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING, FALSE);
				itEnemy->second->m_bShielding = TRUE;
			}
		}
	}
	else
	{
		if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			if(m_pShuttleChild && m_pShuttleChild->m_pSecondaryWeapon)
			{
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL);
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL, FALSE);
				m_pShuttleChild->m_pSecondaryWeapon->SetUseToggleWeapon(FALSE);
			}

#ifdef _DEBUG
			char strMessage[256];
			wsprintf(strMessage,STRMSG_C_ITEM_0064);//"쉴드 아이템을 해제합니다."
			m_pChat->CreateChatChild(strMessage,COLOR_DEBUG);
#endif
//			m_pShuttleChild->m_bShielding = FALSE; // DP 변화로 세팅
		}
		else
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL);
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL, FALSE);
				itEnemy->second->m_bShielding = FALSE;
			}
		}

	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleToggleDecoyOk(MSG_FC_BATTLE_TOGGLE_DECOY_OK* pMsg)
/// \brief		디코이 무기 적용/해제
/// \author		jschoi
/// \date		2004-10-13 ~ 2004-10-13
/// \warning	이곳에서 디코이 이펙트의 생성 및 해제를 처리한다.
///				디코이 사용/해제 시 SetParamFactor, ReleaseParamFactor 적용
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleToggleDecoyOk(MSG_FC_BATTLE_TOGGLE_DECOY_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleToggleDecoyOk(MSG_FC_BATTLE_TOGGLE_DECOY_OK* pMsg)");
	if(pMsg->IsOn)
	{
		if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			if(m_pShuttleChild && m_pShuttleChild->m_pSecondaryWeapon)
			{
				m_pShuttleChild->m_pSecondaryWeapon->SetUseToggleWeapon(TRUE);
				// 2004-10-13 by jschoi 이곳에서 디코이 이펙트를 생성해야함.
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING);
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING, FALSE);

				ITEM *pItem = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
				if(pItem)
				{
					// 2009-04-21 by bhsohn 아이템 DesParam추가
// 					m_pShuttleChild->SetParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter1,pItem->ParameterValue1);
// 					m_pShuttleChild->SetParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter2,pItem->ParameterValue2);
// 					m_pShuttleChild->SetParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter3,pItem->ParameterValue3);
// 					m_pShuttleChild->SetParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter4,pItem->ParameterValue4);
					int nArrParamCnt = 0;
					for(nArrParamCnt = 0; nArrParamCnt < SIZE_MAX_DESPARAM_COUNT_IN_ITEM; nArrParamCnt++)
					{
						m_pShuttleChild->SetParamFactorDesParam(m_pShuttleChild->m_paramFactor,
																pItem->ArrDestParameter[nArrParamCnt],
																pItem->ArrParameterValue[nArrParamCnt]);

					}					
					// end 2009-04-21 by bhsohn 아이템 DesParam추가
				}
			}

#ifdef _DEBUG
			char strMessage[256];
			wsprintf(strMessage,STRMSG_C_ITEM_0065);//"디코이 아이템을 사용합니다."
			m_pChat->CreateChatChild(strMessage,COLOR_DEBUG);
#endif
		}
		else
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				// 2004-10-13 by jschoi 이곳에서 디코이 이펙트를 생성해야함.
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING);
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_USE|TOGGLE_WEAPON_BODYCON_USING, FALSE);

			}
		}
	}
	else
	{
		if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			if(m_pShuttleChild && m_pShuttleChild->m_pSecondaryWeapon)
			{
				m_pShuttleChild->m_pSecondaryWeapon->SetUseToggleWeapon(FALSE);
				// 2004-10-13 by jschoi 이곳에서 디코이 이펙트를 해제해야함.
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL);
				m_pShuttleChild->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL, FALSE);

				ITEM *pItem = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
				if(pItem)
				{
					// 2009-04-21 by bhsohn 아이템 DesParam추가
// 					m_pShuttleChild->ReleaseParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter1,pItem->ParameterValue1);
// 					m_pShuttleChild->ReleaseParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter2,pItem->ParameterValue2);
// 					m_pShuttleChild->ReleaseParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter3,pItem->ParameterValue3);
// 					m_pShuttleChild->ReleaseParamFactorDesParam(m_pShuttleChild->m_paramFactor,pItem->DestParameter4,pItem->ParameterValue4);
					int nArrParamCnt = 0;
					for(nArrParamCnt = 0; nArrParamCnt < SIZE_MAX_DESPARAM_COUNT_IN_ITEM; nArrParamCnt++)
					{
						m_pShuttleChild->ReleaseParamFactorDesParam(m_pShuttleChild->m_paramFactor,
																	pItem->ArrDestParameter[nArrParamCnt],
																	pItem->ArrParameterValue[nArrParamCnt]);
					}					
					// end 2009-04-21 by bhsohn 아이템 DesParam추가
				}
			}
			
			
#ifdef _DEBUG
			char strMessage[256];
			wsprintf(strMessage,STRMSG_C_ITEM_0066);//"디코이 아이템을 해제합니다."
			m_pChat->CreateChatChild(strMessage,COLOR_DEBUG);
#endif
		}
		else
		{
			CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
			if(itEnemy != m_pScene->m_mapEnemyList.end())
			{
				// 2004-10-13 by jschoi 이곳에서 디코이 이펙트를 해제해야함.
				// 해제하는 프로토콜이 와서 이미 생성된 디코이 이펙트가 없으면 그냥 리턴해야함.
				// Enemy가 지워지면 알아서 이펙트가 지워져야 한다.
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL);
				itEnemy->second->ResetSecondaryWeaponBodyCondition(TOGGLE_WEAPON_BODYCON_END|TOGGLE_WEAPON_BODYCON_NORMAL, FALSE);
				
			}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattlePriBulletReloaded(MSG_FC_BATTLE_PRI_BULLET_RELOADED* pMsg)
/// \brief		MSG_FC_BATTLE_PRI_BULLET_RELOADED
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattlePriBulletReloaded(MSG_FC_BATTLE_PRI_BULLET_RELOADED* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattlePriBulletReloaded(MSG_FC_BATTLE_PRI_BULLET_RELOADED* pMsg)");
	m_pShuttleChild->PrimaryBulletReloaded( pMsg );

	// 2005-11-08 by ispark
	// 보급 상점에 데이타 갱신
	g_pInterface->m_pCityBase->RecvRequestRepair();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleSecBulletReloaded(MSG_FC_BATTLE_SEC_BULLET_RELOADED* pMsg)
/// \brief		MSG_FC_BATTLE_SEC_BULLET_RELOADED
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleSecBulletReloaded(MSG_FC_BATTLE_SEC_BULLET_RELOADED* pMsg)
{
	FLOG("CAtumApplication::FieldSocketBattleSecBulletReloaded(MSG_FC_BATTLE_SEC_BULLET_RELOADED* pMsg)");
	m_pShuttleChild->SecondaryBulletReloaded( pMsg );

	// 2005-11-08 by ispark
	// 보급 상점에 데이타 갱신
	g_pInterface->m_pCityBase->RecvRequestRepair();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketEventChangeWeather(MSG_FC_EVENT_CHANGE_WEATHER* pMsg)
/// \brief		MSG_FC_EVENT_CHANGE_WEATHER
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventChangeWeather(MSG_FC_EVENT_CHANGE_WEATHER* pMsg)
{
	FLOG("CAtumApplication::FieldSocketEventChangeWeather(MSG_FC_EVENT_CHANGE_WEATHER* pMsg)");
	SetFogLevel( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, !m_pScene->m_bNight );
	m_pScene->m_byWeatherType = pMsg->MapWeather;
	m_pScene->m_bChangeWeather = TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUpdateItemPos(MSG_FC_ITEM_UPDATE_ITEM_POS* pMsg)
/// \brief		MSG_FC_ITEM_UPDATE_ITEM_POS, 타캐릭터 아이템 교체정보
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUpdateItemPos(MSG_FC_ITEM_UPDATE_ITEM_POS* pMsg)
{
	FLOG("CAtumApplication::FieldSocketItemUpdateItemPos(MSG_FC_ITEM_UPDATE_ITEM_POS* pMsg)");
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{

		// 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
		//itEnemy->second->ChangeItemPoint(pMsg->ItemPosition,pMsg->ItemNum, pMsg->ColorCode);

// 2012-07-19 by isshin, 아템미리보기
#ifdef SC_ENEMY_INFO_JHSEOL_ISSHIN
		g_pGameMain->m_pCommunity->UpdateEnemyItemInfo(TRUE, pMsg->ClientIndex);
#endif
// end 2012-07-19 by isshin, 아템미리보기

		// 2012-11-29 by bhsohn 파트너 외형 변경 시트템 변경
//		itEnemy->second->ChangeItemPoint( pMsg->ItemPosition,pMsg->ItemNum, pMsg->nShapeItemNum, pMsg->nEffectItemNum );
#ifdef	SC_PARTNER_SHAPE_CHANGE_HSKIM
		itEnemy->second->ChangeItemPoint( pMsg->ItemPosition,pMsg->ItemNum, pMsg->nShapeItemNum, pMsg->nEffectItemNum, pMsg->nPetLevel);
#else
		itEnemy->second->ChangeItemPoint( pMsg->ItemPosition,pMsg->ItemNum, pMsg->nShapeItemNum, pMsg->nEffectItemNum );
#endif		
		// END 2012-11-29 by bhsohn 파트너 외형 변경 시트템 변경
		itEnemy->second->m_infoCharacter.CharacterRenderInfo.SetRenderInfoWithPOS( pMsg->ItemPosition,pMsg->ItemNum, pMsg->nShapeItemNum, pMsg->nEffectItemNum );
		// end 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현

	}
	else
	{// 캐릭터가 없음-Error
		DBGOUT("CAtumApplication::FieldSocketItemUpdateItemPos(MSG_FC_ITEM_UPDATE_ITEM_POS* pMsg) \n");
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCharacterGetOtherRenderInfoOk(MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK* pMsg)
/// \brief		MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterGetOtherRenderInfoOk(MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketCharacterGetOtherRenderInfoOk(MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK* pMsg)");
	// 타캐릭터 아이템 교체정보
	if(m_dwGameState == _CITY)
	{
		DBGOUT("MSG_FC_CHARACTER_GET_OTHER_RENDER_INFO_OK in CITY \n");
		return;
	}
	CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
	if(itEnemy != m_pScene->m_mapEnemyList.end())
	{//
		memcpy(&(itEnemy->second->m_infoCharacter.CharacterRenderInfo),&pMsg->CharacterRenderInfo,sizeof(CHARACTER_RENDER_INFO));
		itEnemy->second->InitItemPoint();
		// 길드 
	}
	else
	{// 캐릭터가 없음-Error
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInfoGetBuildingNPCInfoOk(MSG_FC_INFO_GET_BUILDINGNPC_INFO_OK* pMsg)
/// \brief		MSG_FC_INFO_GET_BUILDINGNPC_INFO_OK
/// \author		dhkwon
/// \date		2004-04-12 ~ 2004-04-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetBuildingNPCInfoOk(MSG_FC_INFO_GET_BUILDINGNPC_INFO_OK* pMsg)
{
	EnterCriticalSection(&m_cs);
	BUILDINGNPC * pInfo = m_pDatabase->UpdateBuildingNPCInfo(pMsg->BuildingNPCInfo);
	LeaveCriticalSection(&m_cs);
	m_pInterface->m_pCityBase->SetDetailBuildingInfo( pMsg->BuildingNPCInfo );
	DBGOUT("RECV GET_BUILDINGNPC_INFO_OK, Building(%s),NPC(%d,%s)\n",pMsg->BuildingNPCInfo.BuildingName, pMsg->BuildingNPCInfo.NPCIndex, pMsg->BuildingNPCInfo.NPCName);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketConnectClose(MSG_FC_CONNECT_CLOSE* pMsg)
/// \brief		MSG_FC_CONNECT_CLOSE
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketConnectClose(MSG_FC_CONNECT_CLOSE* pMsg)
{
	FLOG("CAtumApplication::FieldSocketConnectClose(MSG_FC_CONNECT_CLOSE* pMsg)");
	char message[256];
	wsprintf(message,STRMSG_C_SERVER_0012,pMsg->reason);//"서버가 종료되었습니다. 게임이 종료됩니다.  [%d]"
	NetworkErrorMsgBox(message);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketEventSuggestChannels(MSG_FC_EVENT_SUGGEST_CHANNELS* pMsg)
/// \brief		MSG_FC_EVENT_SUGGEST_CHANNELS
/// \author		dhkwon
/// \date		2004-03-29 ~ 2004-03-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventSuggestChannels(MSG_FC_EVENT_SUGGEST_CHANNELS* pMsg)
{
	char *p = (char *)pMsg;
	p += sizeof(MSG_FC_EVENT_SUGGEST_CHANNELS);

	ChangeGameState(_SELECTCHANNEL);
	m_pInterface->InitChannelListObjects();//g_pChannelList생성
	m_pInterface->RestoreChannelListObjects();
	ASSERT_ASSERT(g_pChannelList);

	g_pChannelList->RecvStartChannelList(pMsg->MapIndex, pMsg->WarpTargetIndex);
	
	DBGOUT("-------------------Channel Information------------------\n");
	for(int i=0;i<pMsg->NumOfChannels;i++)
	{
		g_pChannelList->RecvChannelList((MEX_CHANNEL_INFO*)p);
		DBGOUT("    Channel Number : %d, Crowdedness : %d%%\n", ((MEX_CHANNEL_INFO*)p)->ChannelIndex, ((MEX_CHANNEL_INFO*)p)->Crowdedness );
		p += sizeof(MEX_CHANNEL_INFO);
	}
	g_pChannelList->RecvDoneChannelList();
	DBGOUT("-------------------Channel Information Done-------------\n", COLOR_SKILL_USE);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCityGetBuildingListOk(MSG_FC_CITY_GET_BUILDING_LIST_OK* pMsg)
/// \brief		MSG_FC_CITY_GET_BUILDING_LIST_OK
/// \author		dhkwon
/// \date		2004-04-12 ~ 2004-04-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityGetBuildingListOk(MSG_FC_CITY_GET_BUILDING_LIST_OK* pMsg)
{
	char *p = (char *)pMsg;
	p += sizeof(MSG_FC_CITY_GET_BUILDING_LIST_OK);

	DBGOUT("-----------------Shop Information----------------------\n");
	for(int i=0;i<pMsg->NumOfBuildings;i++)
	{
		CITY_BUILDING_INFO_4_EXCHANGE briefBuildingInfo;
		memcpy(&briefBuildingInfo, p, sizeof(CITY_BUILDING_INFO_4_EXCHANGE));
		//////////////////////////////////////////////////////////////////////
		DBGOUT("Shop Information :[Index:%d][Kind:%d]\n", briefBuildingInfo.BuildingIndex, briefBuildingInfo.BuildingKind );

		if(briefBuildingInfo.BuildingKind != 100 || !m_bTestServer)
		{
			m_pInterface->m_pCityBase->AddBuildingIndexList( briefBuildingInfo );
		}
		//////////////////////////////////////////////////////////////////////
		p += sizeof(CITY_BUILDING_INFO_4_EXCHANGE);
	}
	DBGOUT("----------------Shop Information End---------------------\n");
	if(g_pInterface->m_pCityBase)
	{
		g_pInterface->m_pCityBase->SetButtonEnableByLevel(g_pShuttleChild->m_myShuttleInfo.Level);
	}
//	SendFieldSocketGetShopWarpTargetMapList( m_pShuttleChild->m_myShuttleInfo.MapChannelIndex );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketGetShopWarpTargetMapListOk(MSG_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST_OK* pMsg)
/// \brief		MSG_FC_CITY_GET_WARP_TARGET_MAP_LIST_OK
/// \author		dhkwon
/// \date		2004-04-12 ~ 2004-04-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketGetShopWarpTargetMapListOk(MSG_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST_OK* pMsg)
{
	char *p = (char *)pMsg;
	p += sizeof(MSG_FC_EVENT_GET_SHOP_WARP_TARGET_MAP_LIST_OK);

	ASSERT_ASSERT(g_pInterface->m_pCityBase);
	CINFCityWarp* pCityWarp = g_pInterface->m_pCityBase->GetCityWarp();
	DBGOUT("-----------------City Warp Information----------------------\n");
	if(pCityWarp)
	{
		pCityWarp->Reset();
		for(int i=0;i<pMsg->NumOfTargetMaps;i++)
		{
			pCityWarp->AddWarpTargetInfoList((WARP_TARGET_MAP_INFO_4_EXCHANGE*)p);
			DBGOUT("City Warp Information :[Index:%d]\n", ((WARP_TARGET_MAP_INFO_4_EXCHANGE*)p)->MapIndex );
			p += sizeof(WARP_TARGET_MAP_INFO_4_EXCHANGE);
		}
		pCityWarp->RecvWarpListDone();
	}
	DBGOUT("----------------City Warp Information End---------------------\n");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketAdminGetServerStatOk(MSG_FC_ADMIN_GET_SERVER_STAT_OK* pMsg)
/// \brief		서버의 전체 사용수 수
/// \author		dhkwon
/// \date		2004-05-13 ~ 2004-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAdminGetServerStatOk(MSG_FC_ADMIN_GET_SERVER_STAT_OK* pMsg)
{
// 2012-11-07 by bhsohn 베트남 패킷 처리
#ifdef C_CLIENT_LIVE_TIME
	m_fServerLiveTime = MAX_CLIENT_LIVE_TIME;
	if(!GetEnterLock())
	{
		//if(!m_bTradeCenterLock)													   // 2013-11-29 by ssjung 거래소 구현
		if(!m_bTradeCenterLock && !m_bCityShopLock)		// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정
			EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
	}
#endif
// END 2012-11-07 by bhsohn 베트남 패킷 처리

	wsprintf(m_strMapUserNum, "MAP USER [ %d ] [%d(%d)]", 
		pMsg->CurrentUserCount,
		pMsg->CurrentMapChannelIndex.MapIndex,
		pMsg->CurrentMapChannelIndex.ChannelIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketString128(MSG_FC_STRING_128* pMsg)
/// \brief		MSG_FC_STRING_128
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketString128(MSG_FC_STRING_128* pMsg)
{
	FLOG("CAtumApplication::FieldSocketString128(MSG_FC_STRING_128* pMsg)");
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
		{	
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
			m_pChat->SetNumField(pMsg->SecurityNumber);				// 2011-11-01 by jhahn 암호화 처리
// 2011-06-30 by jhahn  사설서버 패스워드
#ifdef C_SECURITY_COMMAND_JHAHN
			char buf[256];
			wsprintf(buf, "FieldSocket128 %0d", pMsg->SecurityNumber);
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
			// 2012-06-19 by jhseol, 아레나 추가개발part2 무적 : 리스폰 후 서버로 부터 받은 스크링을 비교하여 투명 상태 적용
			if( 0 == strncmp(pMsg->String, STRMSG_S_F2NOTIFY_0107, strlen(STRMSG_S_F2NOTIFY_0107)))
			{
				g_pShuttleChild->SetUnitAlpha(CL_SKILL_CAMOUFLAGE, SKILL_OBJECT_ALPHA_DEFAULT);
			}
			else if( 0 == strncmp(pMsg->String, STRMSG_S_F2NOTIFY_0108, strlen(STRMSG_S_F2NOTIFY_0108)))
			{
				g_pShuttleChild->SetUnitAlpha(CL_SKILL_NONE, SKILL_OBJECT_ALPHA_NONE);
			}
			// end 2012-06-19 by jhseol, 아레나 추가개발part2 무적 : 리스폰 후 서버로 부터 받은 스크링을 비교하여 투명 상태 적용
		}



	}
	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_DBGOUT)
	{	
		DbgOut("%s\n", pMsg->String);	
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_NOTICE)
	{
		
		DbgOut("%s\n", pMsg->String);	
		AddSpeakerGMString(pMsg->String, FALSE);   // 2012-04-18 by jhahn  트리거 시스템 알림 
	}
	// 2013-06-26 by bhsohn 아머 컬렉션 추가 개발
	else if(STR128_PRINT_TYPE_POPUP == pMsg->PrintType)
	{
		// 메시지 박스 타입
		if(g_pGameMain && g_pGameMain->m_pInfWindow)
		{			
			char strText[256] = {0,};				
			ZERO_MEMORY(strText);			
			strncpy(strText, pMsg->String, 128);
			
			g_pGameMain->m_pInfWindow->AddMsgBox(strText, _MESSAGE, 0, 0, 0,0, NULL, TRUE);		
		}
	}
	// END 2013-06-26 by bhsohn 아머 컬렉션 추가 개발
	// 2013-10-07 by ssjung 보스 몬스터 보상강화
	else if(STR128_PRINT_TYPE_OPERATOR == pMsg->PrintType)
	{
		if(g_pInterface && g_pInterface->m_pINFOpMain)
		{			
			char strText[128] = {0,};				
			ZERO_MEMORY(strText);			
			strncpy(strText, pMsg->String, 128);
			g_pInterface->m_pINFOpMain->BosMonsterRenewalOP(strText);
		}
	}
	// end 2013-10-07 by ssjung 보스 몬스터 보상강화

	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketString256(MSG_FC_STRING_256* pMsg)
/// \brief		MSG_FC_STRING_256
/// \author		
/// \date		
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketString256(MSG_FC_STRING_256* pMsg)
{
	FLOG("CAtumApplication::FieldSocketString128(MSG_FC_STRING_128* pMsg)");
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
		{
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
			m_pChat->SetNumField(pMsg->SecurityNumber);				// 2011-11-01 by jhahn 암호화 처리
//2011-06-30 by jhahn  사설서버 패스워드
#ifdef C_SECURITY_COMMAND_JHAHN
			char buf[256];
			wsprintf(buf, "FieldSocket256 %0d", pMsg->SecurityNumber);
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
		}
	}

	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_DBGOUT)
	{
		
		DbgOut("%s\n", pMsg->String);	
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_NOTICE)
	{
		
		DbgOut("%s\n", pMsg->String);	
		AddSpeakerGMString(pMsg->String, FALSE);   // 2012-04-18 by jhahn  트리거 시스템 알림 
	}

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketString512(MSG_FC_STRING_512* pMsg)
/// \brief		MSG_FC_STRING_128
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketString512(MSG_FC_STRING_512* pMsg)
{
	FLOG("CAtumApplication::FieldSocketString128(MSG_FC_STRING_128* pMsg)");
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
		{
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
			m_pChat->SetNumField(pMsg->SecurityNumber);				// 2011-11-01 by jhahn 암호화 처리
//2011-06-30 by jhahn  사설서버 패스워드
#ifdef C_SECURITY_COMMAND_JHAHN
			char buf[256];
			wsprintf(buf, "FieldSocket512 %0d", pMsg->SecurityNumber);
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
		}
	}

	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_DBGOUT)
	{		
		DbgOut("%s\n", pMsg->String);	
	}
	else if (pMsg->PrintType == STR128_PRINT_TYPE_NOTICE)
	{
		
		DbgOut("%s\n", pMsg->String);	
		AddSpeakerGMString(pMsg->String, FALSE);   // 2012-04-18 by jhahn  트리거 시스템 알림 
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterSkillUseSkill(MSG_FC_MONSTER_SKILL_USE_SKILL* pMsg)
/// \brief		Monster Skill - Use Skill
/// \author		jschoi
/// \date		2004-06-25 ~ 2004-06-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterSkillUseSkill(MSG_FC_MONSTER_SKILL_USE_SKILL* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterSkillUseSkill(MSG_FC_MONSTER_SKILL_USE_SKILL* pMsg)");

	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);

	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		if(g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex)
		{
			itMonster->second->m_bSkillEnd = TRUE;	// 내가 몬스터의 스킬 종료를 알려줘야한다.
		}
		itMonster->second->m_nMonsterSkillState = MONSTER_SKILL_ON;
		itMonster->second->InitMonsterMovePattern(pMsg->SkillItemNum);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketMonsterSkillEndSkill(MSG_FC_MONSTER_SKILL_END_SKILL* pMsg)
/// \brief		Monster Skill - End Skill
/// \author		jschoi
/// \date		2004-06-25 ~ 2004-06-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterSkillEndSkill(MSG_FC_MONSTER_SKILL_END_SKILL* pMsg)
{
	FLOG("CAtumApplication::FieldSocketMonsterSkillEndSkill(MSG_FC_MONSTER_SKILL_END_SKILL* pMsg)");	
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);

	if(itMonster != m_pScene->m_mapMonsterList.end())
	{
		itMonster->second->m_nMonsterSkillState = MONSTER_SKILL_OFF;
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketObjectChangeBodyConditionOk(MSG_FC_OBJECT_CHANGE_BODYCONDITION_OK* pMsg)
/// \brief		맵 오브젝트의 바디컨디션을 변경한다.
/// \author		jschoi
/// \date		2004-11-27 ~ 2004-11-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketObjectChangeBodyConditionOk(MSG_FC_OBJECT_CHANGE_BODYCONDITION_OK* pMsg)
{
	CObjectChild* pObj = g_pScene->FindMapObjectByCodeAndPosition(pMsg->nObjectCodeNum,A2DX(pMsg->AVec3Position));
	if(pObj)
	{
		// 2008-06-24 by dgwoo 워프 사운드 추가.
		//m_pSound->PlayD3DSound(SOUND_WARP, A2DX(pMsg->AVec3Position));
		if(pObj->m_pObjectInfo->Code == WARP_GATE_OBJECT_NUM_2||pObj->m_pObjectInfo->Code == WARP_GATE_OBJECT_NUM_3)// 2012-06-13 by jhahn 워프 게이트 추가2.
		{
			m_pSound->PlayD3DSound(SOUND_WARP_2,A2DX(pMsg->AVec3Position));
		}
		else
		{
			m_pSound->PlayD3DSound(SOUND_WARP,A2DX(pMsg->AVec3Position));
		}

		
		pObj->ChangeBodycondition(pMsg->bodyCondition);
		
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketObjectChangeBodyConditionOk(MSG_FC_AUCTION_INSERT_ITEM* pMsg)
/// \brief		서버에서 아이템 정보를 받아서 아이템 구조체에 저장 한다
/// \author		ydkim
/// \date		2004-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAuctionInsertItem(MSG_FC_AUCTION_INSERT_ITEM* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}
	
	if(IS_AUCTION_SHOP_TYPE(nBuildingKind))
	{
		((CINFCityAuction*)it->second)->InputItem(pMsg);
	}

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketAuctionRegisterItemOk(MSG_FC_AUCTION_REGISTER_ITEM_OK* pMsg)
/// \brief		경매 아이템 등록 결과
/// \author		ydkim
/// \date		2004-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAuctionRegisterItemOk(MSG_FC_AUCTION_REGISTER_ITEM_OK* pMsg)
{	
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}

	if(IS_AUCTION_SHOP_TYPE(nBuildingKind))
	{
		((CINFCityAuction*)it->second)->m_vecAuctionItem[((CINFCityAuction*)it->second)->m_nCurrentTab].clear();
		((CINFCityAuction*)it->second)->AuctionItemInfoView(((CINFCityAuction*)it->second)->m_nCurrentTab);
		CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUID);
		if(pItemInfo)
		{
			g_pStoreData->DeleteItem(pItemInfo->UniqueNumber);
		}
		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_AUCTION_0011,COLOR_SYSTEM);//"아이템이 경매 목록에 등록 되었습니다"
	}	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketAuctionCancerRegisterOk(MSG_FC_AUCTION_REGISTER_ITEM_OK* pMsg)
/// \brief		경매 아이템 등록 취소 결과
/// \author		ydkim
/// \date		2004-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAuctionCancerRegisterOk(MSG_FC_AUCTION_CANCEL_REGISTER_OK* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}

	if(IS_AUCTION_SHOP_TYPE(nBuildingKind))
	{
		((CINFCityAuction*)it->second)->m_vecAuctionItem[((CINFCityAuction*)it->second)->m_nCurrentTab].clear();
		((CINFCityAuction*)it->second)->AuctionItemInfoView(((CINFCityAuction*)it->second)->m_nCurrentTab);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketAuctionBuyItemOk(MSG_FC_AUCTION_BUY_ITEM_OK* pMsg)
/// \brief		경매 아이템 구매 결과
/// \author		ydkim
/// \date		2004-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAuctionBuyItemOk(MSG_FC_AUCTION_BUY_ITEM_OK* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}

	if(IS_AUCTION_SHOP_TYPE(nBuildingKind))
	{
		((CINFCityAuction*)it->second)->m_vecAuctionItem[((CINFCityAuction*)it->second)->m_nCurrentTab].clear();
		((CINFCityAuction*)it->second)->AuctionItemInfoView(((CINFCityAuction*)it->second)->m_nCurrentTab);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketAuctionPutEnchant(MSG_FC_AUCTION_PUT_ENCHANT* pMsg)
/// \brief		경매 아이템 인챈트 정보
/// \author		ydkim
/// \date		2004-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketAuctionPutEnchant(MSG_FC_AUCTION_PUT_ENCHANT* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		return;
	}

	if(IS_AUCTION_SHOP_TYPE(nBuildingKind))
	{		
		((CINFCityAuction*)it->second)->AddEnchantItem(pMsg->AuctionKind, pMsg->AuctionItemEnchant.TargetItemUniqueNumber, pMsg->AuctionItemEnchant.EnchantItemNum);
	}
}

//	CINFCityAuction * pCityAuction = (CINFCityAuction*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
//	if(pCityAuction)
//	{
//		AuctionItem_t pAuctionItem;
//		memset(&pAuctionItem, 0x00, sizeof(AuctionItem_t));
//		pAuctionItem.AuctionItemGeneral		= pMsg->AuctionItemGeneral;
//		pAuctionItem.AuctionKind			= pMsg->AuctionKind;
//		pAuctionItem.AuctionPrice			= pMsg->AuctionPrice;
//		pAuctionItem.AuctionStartDate		= pMsg->AuctionStartDate;
//		strncpy(pAuctionItem.SellerCharacterName, pMsg->SellerCharacterName, sizeof(pMsg->SellerCharacterName));
//		
////		pCityAuction->m_vecAuctionItem.push_back(&pAuctionItem);
//	}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketItemMixItemsResult(MSG_FC_ITEM_MIX_ITEMS_RESULT* pMsg)
/// \brief		MSG_FC_ITEM_MIX_ITEMS_RESULT
/// \author		dhkwon
/// \date		2004-07-19 ~ 2004-07-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemMixItemsResult(MSG_FC_ITEM_MIX_ITEMS_RESULT* pMsg)
{
	// 2013-03-18 by bhsohn 팩토리 조합 추가
#ifdef C_INGAME_MIX_ITEM
	{
		// 조합 성공
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
		if(pCityLab)
		{
			pCityLab->ItemMixItemsResult(pMsg);
		}
		if( pMsg->Err != ERR_NO_ERROR )
		{			
			g_pGameMain->m_pInfWindow->AddMsgBox( STRERR_C_MIX_0002, _MESSAGE );  // "아이템 조합에 실패하여 아이템이 파괴 되었습니다."
		}
		
	}
#else
	if( pMsg->Err != ERR_NO_ERROR )
	{
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
		if(pCityLab)
		{
			pCityLab->InitData();
		}
		g_pGameMain->m_pInfWindow->AddMsgBox( STRERR_C_MIX_0002, _MESSAGE );
	}	
#endif
	
	// END 2013-03-18 by bhsohn 팩토리 조합 추가
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketGuildGetWarInfoOk(MSG_FC_GUILD_GET_WAR_INFO_OK* pMsg)
/// \brief		MSG_FC_GUILD_GET_WAR_INFO_OK
/// \author		dhkwon
/// \date		2004-07-26 ~ 2004-07-26
/// \warning	길드전 시작후 이 메시지를 받아야 정보가 세팅된다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketGuildGetWarInfoOk(MSG_FC_GUILD_GET_WAR_INFO_OK* pMsg)
{
	MSG_IC_GUILD_GET_GUILD_INFO_OK* pGuild = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	if(pGuild)
	{
		g_pShuttleChild->m_pGuildWarInfo = new MSG_FC_GUILD_GET_WAR_INFO_OK;
		g_pShuttleChild->m_pGuildWarInfo->MapChannel = pMsg->MapChannel;
		g_pShuttleChild->m_pGuildWarInfo->PeerGuildUID = pMsg->PeerGuildUID;
	}
	m_pScene->SetPKSettingGuildWar( pMsg->PeerGuildUID, TRUE );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		jschoi
/// \date		2005-03-25 ~ 2005-03-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketGuildSummonMember(MSG_FC_GUILD_SUMMON_MEMBER* pMsg)
{
	// 편대 해체 요청
	if(	g_pShuttleChild &&
		g_pShuttleChild->m_pClientParty )
	{
		if(g_pShuttleChild->m_pClientParty->IsFormationFlightMove() )
		{
			g_pShuttleChild->SendPacket(T_IC_PARTY_CANCEL_FLIGHT_POSITION);
			g_pShuttleChild->m_pClientParty->FormationFlightClear();
		}
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMASTER)
		{
			g_pShuttleChild->m_pClientParty->ISendPartyChangeFlightFormation(0);
		}
	}

	MSG_FC_GUILD_SUMMON_MEMBER_OK sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	sMsg.uidGuildUID = pMsg->uidGuildUID;
	sMsg.MapChannel = pMsg->MapChannel;
	sMsg.PositionVector = pMsg->PositionVector;
	g_pFieldWinSocket->SendMsg( T_FC_GUILD_SUMMON_MEMBER_OK, (char*)&sMsg, sizeof(sMsg) );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ydkim
/// \date		2005-03-28 ~ 2005-03-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCarditemRestoreNotify(MSG_FC_ITEM_USE_CARDITEM_RESTORE_NOTIFY* pMsg)
{
	if(g_pShuttleChild->m_myShuttleInfo.ClientIndex != pMsg->restoreClientIdx)
	{
		return;
	}
	
	vector<CINFMessageBox*>::iterator it = g_pGameMain->m_pInfWindow->m_vecMessageBox.begin();
	while(it != g_pGameMain->m_pInfWindow->m_vecMessageBox.end())
	{
		CINFMessageBox* pMsgBox = *it;
		// 메세지 박스 지우기(교환)
		if(_Q_TRADE_REQUEST == pMsgBox->m_nMsgType)
		{
			g_pGameMain->m_pTrade->SendTradeReject();
		}

		//  1:1 통화 지우기
		if(_Q_VOIP_OK == pMsgBox->m_nMsgType)
		{
			MSG_IC_VOIP_ERROR sMsg;
			sMsg.nErrorNum = VOIPERR_1to1_REJECT;
			sMsg.nSend2AccountUniqueNumber = g_pD3dApp->m_VOIPState.nCalledAccountUniqueNumber;
			g_pIMSocket->SendMsg( T_IC_VOIP_ERROR, (char*)&sMsg, sizeof(sMsg) );
			// State 초기화
			//memset(&g_pD3dApp->m_VOIPState, 0x00, sizeof(g_pD3dApp->m_VOIPState));
			g_pD3dApp->m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
			g_pD3dApp->m_VOIPState.bCaller = FALSE;
		}

		//  1:1 대결 지우기
		if(_Q_PK_REQUEST == pMsgBox->m_nMsgType)
		{
			MSG_FC_BATTLE_REJECT_REQUEST_P2P_PK sMsg;
			memset(&sMsg,0x00,sizeof(sMsg));
			char buffer[SIZE_MAX_PACKET];
			int nType = T_FC_BATTLE_REJECT_REQUEST_P2P_PK;
			sMsg.SourceClientIndex = pMsgBox->m_dwData;
			memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
			memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
			g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
			pMsgBox->m_dwData = 0;
		}

		g_pGameMain->m_pInfWindow->m_vecMessageBox.erase(it);		
		delete pMsgBox;
		pMsgBox = NULL;
		continue;
		
		it++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ydkim
/// \date		2005-03-28 ~ 2005-03-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseCarditemGuildsummonNotify(MSG_FC_ITEM_USE_CARDITEM_GUILDSUMMON_NOTIFY* pMsg)
{
}


///////////////////////////////////////////////////////////////////////////////
/// \class		FieldSocketInfoGetHappyHourEventInfoOk(MSG_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_OK* pMsg)
/// \brief		해피아워 이벤트 및 PC방 이벤트 관련 채팅창에 출력
///
/// \author		dgwoo
/// \version	
/// \date		2006-09-01 ~ 2006-09-01
/// \warning	
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetHappyHourEventInfoOk(BOOL bLevelUp, MSG_FC_INFO_GET_HAPPY_HOUR_EVENT_INFO_OK* pMsg)
{	
	char szNotice[1024];
	memset(szNotice, 0x00, 1024);
	if(g_pGameMain != NULL && g_pGameMain->m_pUnitInfoBar != NULL)
		g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.clear();
	else
		return;	

	// 2007-01-25 by dgwoo byStateType 0(종료됨), 1(시작됨), 2(진행중)
	if(pMsg->byStateType%10)
		g_pGameMain->m_pUnitInfoBar->SetHappyHourEventIconPos();
	
	switch(pMsg->byStateType) 
	{
	case HAPPYEV_STATE_TYPE_END:
		{
			// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
			char chInfluence[256];
			memset(chInfluence, 0x00, 256);			
			// 세력글씨
			wsprintf(chInfluence, CAtumSJ::GetInfluenceTypeString(pMsg->byInfluenceType4));			

			//sprintf(szNotice, STRMSG_C_EVENT_0001);//"해피아워 이벤트가 종료되었습니다."
			sprintf(szNotice, STRMSG_C_071101_0203, chInfluence);//%s의 해피아워 이벤트가 종료되었습니다.
			// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
			}

			g_pGameMain->m_pUnitInfoBar->SetHappyHourInfluence(bLevelUp, FALSE, pMsg);
			
			//g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent &= 0x10;
//			memset(&g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo,0x00,sizeof(EVENT_INFO));
//			sprintf(szNotice, STRMSG_C_EVENT_0001);//"해피아워 이벤트가 종료되었습니다."
//			m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);		
//
//			// 지금 피씨방이 유효햐나?
//			//if(0x10 | g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent)
//			if(g_pGameMain->m_pUnitInfoBar->IsHappyHourEvent())
//			{//피씨방 이벤트가 유효하면
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0003,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate)*100);//"몬스터 경험치 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0004,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate)*100);//"레어옵션 드롭율 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0005,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate)*100);//"죽었을 경우 패널티 %.0f%% 감소"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0006,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate)*100);//"아이템 드롭율 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0007,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate)*100);//"스피량 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate > 0.0f)
//				{// 2007-06-26 by dgwoo 전쟁 포인트 추가.
//					sprintf(szNotice, STRMSG_C_070626_0100,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate)*100);//"스피량 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//			}
		}
		break;
	case HAPPYEV_STATE_TYPE_STARTING:
	case HAPPYEV_STATE_TYPE_START:
		{
			// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
			char chInfluence[256];
			memset(chInfluence, 0x00, 256);			

			// 세력글씨
			wsprintf(chInfluence, CAtumSJ::GetInfluenceTypeString(pMsg->byInfluenceType4));			

			// 해피 아우어 시작 
			if(pMsg->byStateType == HAPPYEV_STATE_TYPE_START)
			{
//			sprintf(szNotice, STRMSG_C_EVENT_0002	//"해피아워 이벤트가 %d시부터 %d시까지 진행됩니다."
//				, pMsg->StartATime.Hour
//				, pMsg->EndATime.Hour);
				sprintf(szNotice, STRMSG_C_071101_0201	//"해피아워 이벤트가 %d시부터 %d시까지 진행됩니다."
				,chInfluence
				, pMsg->StartATime.Hour
				, pMsg->EndATime.Hour);

			
			}
			else
			{
//			sprintf(szNotice, STRMSG_C_EVENT_0009		//"%\s의 해피아워 이벤트가 %d시부터 %d시까지 진행 중입니다."
//				, pMsg->StartATime.Hour
//				, pMsg->EndATime.Hour);
			sprintf(szNotice, STRMSG_C_071101_0202		//"%\s의 해피아워 이벤트가 %d시부터 %d시까지 진행 중입니다."
				,chInfluence
				, pMsg->StartATime.Hour
				, pMsg->EndATime.Hour);		
			}
			// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourInfluence(bLevelUp, TRUE, pMsg);
			
//			//g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent |= 0x01;
//			if(pMsg->byStateType == HAPPYEV_STATE_TYPE_START)
//			{
//			sprintf(szNotice, STRMSG_C_EVENT_0002	//"해피아워 이벤트가 %d시부터 %d시까지 진행됩니다."
//				, pMsg->StartATime.Hour
//				, pMsg->EndATime.Hour);
//			}
//			else
//			{
//			sprintf(szNotice, STRMSG_C_EVENT_0009		//"해피아워 이벤트가 %d시부터 %d시까지 진행 중입니다."
//				, pMsg->StartATime.Hour
//				, pMsg->EndATime.Hour);
//			}
//			m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);			
			

//			if(pMsg->fEXPRate2 > 1.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0003,(pMsg->fEXPRate2-1.0f)*100);//"몬스터 경험치 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate = (pMsg->fEXPRate2-1.f);
//				sprintf(szNotice, STRMSG_C_EVENT_0003,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate+
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate)*100);//"몬스터 경험치 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fDropRareRate2 > 1.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0004,(pMsg->fDropRareRate2-1.0f)*100);//"레어옵션 드롭율 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate = (pMsg->fDropRareRate2-1.f) ;
//				sprintf(szNotice, STRMSG_C_EVENT_0004,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate +
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate)*100);//"레어옵션 드롭율 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fEXPRepairRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0005,(pMsg->fEXPRepairRate2)*100);//"죽었을 경우 패널티 %.0f%% 감소"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate = (pMsg->fEXPRepairRate2) ;
//				sprintf(szNotice, STRMSG_C_EVENT_0005,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate +
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate)*100);//"죽었을 경우 패널티 %.0f%% 감소"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fDropItemRate2 > 1.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0006,(pMsg->fDropItemRate2-1.f)*100);//"아이템 드롭율 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropItemRate = (pMsg->fDropItemRate2-1.f);
//				sprintf(szNotice, STRMSG_C_EVENT_0006,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropItemRate +
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate)*100);//"아이템 드롭율 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fSPIRate2 > 1.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0007,(pMsg->fSPIRate2-1.f)*100);//"스피량 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate = (pMsg->fSPIRate2-1.f);
//				sprintf(szNotice, STRMSG_C_EVENT_0007,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate +
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate)*100);//"스피량 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fWarPointRate2 > 1.0f || g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate > 0.0f)
//			{// 전쟁 포인트.
//				sprintf(szNotice, STRMSG_C_070626_0100,(pMsg->fWarPointRate2-1.f)*100);//"전쟁 포인트 %d%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate = (pMsg->fWarPointRate2-1.f);
//				sprintf(szNotice, STRMSG_C_070626_0100,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate +
//											g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate)*100);//"스피량 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}			
			//m_pChat->CreateChatChild(STRMSG_C_EVENT_0008 ,COLOR_SYSTEM);//"좋은 시간 되시기 바랍니다. ^^"
			// end 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
		}
			break;
	case PCBANG_HAPPYEV_STATE_TYPE_END:
		{
			// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경			
			sprintf(szNotice, STRMSG_C_060830_0100);		//"가맹PC방 해피아워 이벤트가 종료되었습니다."			

			// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourPcBang(bLevelUp, FALSE,pMsg);		
			
			//g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent &= 0x01;
//			memset(&g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo,0x00,sizeof(EVENT_INFO));
//			sprintf(szNotice, STRMSG_C_060830_0100);		//"가맹PC방 해피아워 이벤트가 종료되었습니다."
//			m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
//
//			//// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
//			//if(0x01 | g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent)
//			if(g_pGameMain->m_pUnitInfoBar->IsHappyHourEvent())
//			{//해피아워 이벤트가 유효하면
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0003,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate)*100);//"몬스터 경험치 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0004,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate)*100);//"레어옵션 드롭율 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0005,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate)*100);//"죽었을 경우 패널티 %.0f%% 감소"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate > 0.0f)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0006,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate)*100);//"아이템 드롭율 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate)
//				{
//					sprintf(szNotice, STRMSG_C_EVENT_0007,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate)*100);//"스피량 %.0f%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//				if(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate)
//				{// 전쟁 포인트.
//					sprintf(szNotice, STRMSG_C_070626_0100,(g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate)*100);//"전쟁 포인트 %d%% 증가"
//					g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//				}
//			}
		}
		break;
	case PCBANG_HAPPYEV_STATE_TYPE_STARTING:
	case PCBANG_HAPPYEV_STATE_TYPE_START:
		{
			// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
			if(pMsg->byStateType == PCBANG_HAPPYEV_STATE_TYPE_START)
			{
				sprintf(szNotice, STRMSG_C_060830_0101);	//"가맹PC방 해피아워 이벤트가 진행됩니다."
			}
			else
			{
				sprintf(szNotice, STRMSG_C_060830_0102);	//"가맹PC방 해피아워 이벤트가 진행중입니다."
			}
			// 2008-03-14 by bhsohn 레벨업에 따른 해피아우어 처리
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);			
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourPcBang(bLevelUp, TRUE, pMsg);

//			g_pGameMain->m_pUnitInfoBar->m_BHappyHourEvent |= 0x10;
//			if(pMsg->byStateType == HAPPYEV_STATE_TYPE_START)
//			{
//				sprintf(szNotice, STRMSG_C_060830_0101);	//"가맹PC방 해피아워 이벤트가 진행됩니다."
//			}
//			else
//			{
//				sprintf(szNotice, STRMSG_C_060830_0102);	//"가맹PC방 해피아워 이벤트가 진행중입니다."
//			}
//			m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
//			if(pMsg->fEXPRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0003,pMsg->fEXPRate2*100);//"몬스터 경험치 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate = pMsg->fEXPRate2;
//				sprintf(szNotice, STRMSG_C_EVENT_0003,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRate +
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRate)*100);//"몬스터 경험치 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fDropRareRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0004,pMsg->fDropRareRate2*100);//"레어옵션 드롭율 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate = pMsg->fDropRareRate2;
//				sprintf(szNotice, STRMSG_C_EVENT_0004,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropRareRate +
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropRareRate)*100);//"레어옵션 드롭율 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fEXPRepairRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0005,pMsg->fEXPRepairRate2*100);//"죽었을 경우 패널티 %.0f%% 감소"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate = pMsg->fEXPRepairRate2;
//				sprintf(szNotice, STRMSG_C_EVENT_0005,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fEXPRepairRate +
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fEXPRepairRate)*100);//"죽었을 경우 패널티 %.0f%% 감소"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fDropItemRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropItemRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0006,pMsg->fDropItemRate2*100);//"아이템 드롭율 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate = pMsg->fDropItemRate2;
//				sprintf(szNotice, STRMSG_C_EVENT_0006,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fDropItemRate+
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fDropItemRate)*100);//"아이템 드롭율 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fSPIRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate > 0.0f)
//			{
//				sprintf(szNotice, STRMSG_C_EVENT_0007,pMsg->fSPIRate2*100);//"스피량 %.0f%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate = pMsg->fSPIRate2;
//				sprintf(szNotice, STRMSG_C_EVENT_0007,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fSPIRate + 
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fSPIRate)*100);//"스피량 %.0f%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			if(pMsg->fWarPointRate2 > 0.0f || g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate > 0.0f)
//			{// 전쟁 포인트.
//				sprintf(szNotice, STRMSG_C_070626_0100,pMsg->fWarPointRate2*100);//"전쟁 포인트 %d%% 증가"
//				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);	
//				
//				g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate = pMsg->fWarPointRate2;
//				sprintf(szNotice, STRMSG_C_070626_0100,(g_pGameMain->m_pUnitInfoBar->m_PCHappyEventInfo.fWarPointRate + 
//					g_pGameMain->m_pUnitInfoBar->m_HappyEventInfo.fWarPointRate)*100);//"전쟁 포인트 %d%% 증가"
//				g_pGameMain->m_pUnitInfoBar->m_vecEventHappyHour.push_back(szNotice);
//			}
//			m_pChat->CreateChatChild(STRMSG_C_EVENT_0008 ,COLOR_SYSTEM);//"좋은 시간 되시기 바랍니다. ^^"
		}
		break;
	// 2008-05-21 by bhsohn 모선전, 아이템 해피 아우어 추가
		/////////////////// 모선전 해피 아우어 /////////////////// 
	case GAME_EVENT_GROUP_MOTHERSHIP_END:
		{			
			sprintf(szNotice, STRMSG_C_080521_0202);		//"모선전 승리 세력 이벤트 해피아워가 종료 됩니다."
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourMotherShip(bLevelUp, FALSE,pMsg);					
		}
		break;
	case GAME_EVENT_GROUP_MOTHERSHIP_START:
	case GAME_EVENT_GROUP_MOTHERSHIP_STARTING:
		{			
			if(pMsg->byStateType == GAME_EVENT_GROUP_MOTHERSHIP_START)
			{
				sprintf(szNotice, STRMSG_C_080521_0200);	//"모선전 승리 세력 이벤트 해피아워가 진행 됩니다"
			}
			else
			{
				sprintf(szNotice, STRMSG_C_080521_0201);	//"모선전 승리 세력 이벤트 해피아워가 진행 중입니다."
			}			
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);			
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourMotherShip(bLevelUp, TRUE, pMsg);
		}
		break;
		/////////////////// 아이템 해피 아우어 /////////////////// 
	case GAME_EVENT_GROUP_ITEM_END:
		{
			sprintf(szNotice, STRMSG_C_080521_0205);		//"성장의 시간 세력 이벤트 해피아워가 종료 됩니다."
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourItem(bLevelUp, FALSE,pMsg);		
		}
		break;
	case GAME_EVENT_GROUP_ITEM_START:
	case GAME_EVENT_GROUP_ITEM_STARTING:
		{
			if(pMsg->byStateType == GAME_EVENT_GROUP_ITEM_START)
			{
				sprintf(szNotice, STRMSG_C_080521_0203);	//"성장의 시간 세력 이벤트 해피아워가 진행 됩니다."
			}
			else
			{
				sprintf(szNotice, STRMSG_C_080521_0204);	//"성장의 시간 세력 이벤트 해피아워가 진행 중입니다."
			}			
			if(!bLevelUp)
			{
				m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);			
			}
			g_pGameMain->m_pUnitInfoBar->SetHappyHourItem(bLevelUp, TRUE, pMsg);
		}
		break;
	// end 2008-05-21 by bhsohn 모선전, 아이템 해피 아우어 추가	
	}	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ydkim
/// \date		2005-04-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetGameEventInfoOk(MSG_FC_INFO_GET_GAME_EVENT_INFO_OK* pMsg)
{
	m_pChat->CreateChatChild(STRMSG_C_EVENT_0010,COLOR_SYSTEM);//"그냥 이벤트 중 테스트 코드"
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketMonsterTutorialMonsterDeadNotify(MSG_FC_MONSTER_TUTORIAL_MONSTER_DEAD_NOTIFY* pMsg)
/// \brief		튜토리얼 맵에서 몬스터가 죽엇음을 클라이언트에 알려줌
/// \author		jschoi
/// \date		2005-04-21 ~ 2005-04-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMonsterTutorialMonsterDeadNotify(MSG_FC_MONSTER_TUTORIAL_MONSTER_DEAD_NOTIFY* pMsg)
{
	g_pTutorial->MonsterDeadNotify(pMsg->monsterIdx);
}


// 2009. 09. 18 by ckPark 인피니티 필드 HP에 따른 몬스터 대화
VOID	CAtumApplication::FieldSocketMonsterHPTalk( MSG_FC_MONSTER_HPTALK* pMsg )
{
	if( pMsg->TargetIndex )
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->TargetIndex );
		if( pUnit )
		{
			char szStr[ SIZE_MAX_HPTALK_DESCRIPTION + SIZE_MAX_CHARACTER_NAME ];
			char szName[ SIZE_MAX_CHARACTER_NAME ];

			if( pUnit->m_dwPartType == _ENEMY )
				strcpy( szName, ((CEnemyData*)(pUnit))->GetEnemyInfo().CharacterInfo.CharacterName );
			else if( pUnit->m_dwPartType == _SHUTTLE )
				strcpy( szName, ((CShuttleChild*)(pUnit))->GetMyShuttleInfo().CharacterName );
			else
				strcpy( szName, "null\\0" );

			char* p = strrchr( szName, '\\');
			if( p )
				*p = '\0';

			sprintf( szStr, pMsg->HPTalk, szName );

			g_pD3dApp->m_pChat->CreateChatChild( szStr, COLOR_CHAT_REGION, CHAT_TAB_SYSTEM );
		}
	}
	else if( pMsg->MonsterUnitKind )
	{
		// 몬스터 카인드로 정보를 얻어온다
		MEX_MONSTER_INFO* pMonster = g_pDatabase->CheckMonsterInfo( pMsg->MonsterUnitKind );
		if( pMonster )
		{
			char szStr[ SIZE_MAX_HPTALK_DESCRIPTION + SIZE_MAX_MONSTER_NAME ];
			sprintf( szStr, "%s : %s", pMonster->MonsterName, pMsg->HPTalk );
			
			// 대화 종류별 처리
			switch( pMsg->HPTalkImportance )
			{
			case HPACTION_TALK_IMPORTANCE_ALL:
				g_pD3dApp->m_pChat->CreateChatChild( szStr, COLOR_CHAT_REGION, CHAT_TAB_NORMAL );
				g_pGameMain->m_pUnitNameInfo->MonsterChatCreateInfo( strlen( szStr ), szStr, pMsg->MonsterIndex );
				break;
			case HPACTION_TALK_IMPORTANCE_INFL:
				g_pD3dApp->m_pChat->CreateChatChild( szStr, COLOR_CHAT_REGION, CHAT_TAB_NORMAL );
				g_pGameMain->m_pUnitNameInfo->MonsterChatCreateInfo( strlen( szStr ), szStr, pMsg->MonsterIndex );
				break;
			case HPACTION_TALK_IMPORTANCE_CHANNEL:
				g_pD3dApp->m_pChat->CreateChatChild( szStr, COLOR_CHAT_REGION, CHAT_TAB_NORMAL );
				g_pGameMain->m_pUnitNameInfo->MonsterChatCreateInfo( strlen( szStr ), szStr, pMsg->MonsterIndex );
				break;
			default:
				::DbgOut( "UnDefined MSG_FC_MONSTER_HPTALK::HPTalkImportance\n");
				break;
			}
		}
	}

	if( pMsg->HPCameraTremble )
		m_pCamera->ChangeCamCollType( 1, pMsg->HPCameraTremble / 100 );
}
// end 2009. 09. 18 by ckPark 인피니티 필드 HP에 따른 몬스터 대화
//2011-10-24 by jhahn 트리거 시스템 
VOID	CAtumApplication::FieldSocketTriggerMapBuffSkill(MSG_FC_TRIGGER_MAP_BUFF_SKILL* pMsg )
{
		// 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.) - 포인터 사용 NULL 체크 추가.
	if ( NULL == g_pShuttleChild )
		return;
	
	if ( NULL != g_pShuttleChild->m_pSkill )
		g_pShuttleChild->m_pSkill->InitPreSkillItemNum();
	// End 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)

	// 나한테 쓰는 스킬
	if( g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex )
	{
		BOOL bDeleteUsingSkill			= FALSE;
		BOOL bDeleteEnemyUsingSkill		= FALSE;

		ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
		// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
		if( !pItem )
			return;
		// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

		if(SKILLTYPE_TIMELIMIT == pItem->SkillType)
		{
			bDeleteUsingSkill			= TRUE;
			bDeleteEnemyUsingSkill		= TRUE;
		}
		else if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			bDeleteUsingSkill			= TRUE;
		}
		else
		{
			bDeleteEnemyUsingSkill		= TRUE;
		}

		if(bDeleteUsingSkill)
		{
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindUsingSkillInfoByBaseNum( pMsg->SkillItemNum );
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo( pSkillInfo );
				pSkillInfo->ReleaseParamFactor();
				if(bDeleteEnemyUsingSkill)
				{
					g_pShuttleChild->m_pSkill->EraseLowLVUsingSkill( NULL, pMsg->SkillItemNum );
				}
			}
		}

		if(bDeleteEnemyUsingSkill)
		{
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfoByBaseNum( pMsg->SkillItemNum );
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo(pSkillInfo);
				pSkillInfo->ReleaseParamFactor();
				g_pShuttleChild->m_pSkill->EraseUsingSkill(pSkillInfo,TRUE);
			}
		}

		CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfo( pMsg->SkillItemNum );
		if(NULL == pSkillInfo)
		{
			// 스킬 새로 사용
			ITEM_SKILL itemSkill;
			memset( &itemSkill, 0x00, sizeof( ITEM_SKILL ) );

			// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
			itemSkill.ItemInfo		= pItem;
			itemSkill.ItemNum		= pItem->ItemNum;
			itemSkill.Kind			= pItem->Kind;
			// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

			pSkillInfo	= g_pShuttleChild->m_pSkill->FindItemEnemySkillInfo( pMsg->SkillItemNum );
			if( NULL == pSkillInfo )
			{
				pSkillInfo = new CSkillInfo( &itemSkill );
				g_pShuttleChild->m_pSkill->m_mapEnemySkillInfo[ pMsg->SkillItemNum ] = pSkillInfo;
			}	
			

			// 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가

 			
 			{
				if(pMsg->SkillItemNum == 7514630 )
				{
// 					CAppEffectData * pData = new CAppEffectData(g_pCamera,RC_EFF_SANDSTROM_TRIGER,/*m_pShuttleChild->m_vPos*/100);
// 					if(pData)
// 					{
// 						pData = (CAppEffectData *)m_pEffectList->AddChild(pData);							
// 						pData->SetRepeat( TRUE, pItem->Time / 1000.0f, 99 );
// 						
// 					}			
				}
				else if(pMsg->SkillItemNum == 7514620)
				{
					m_pFxSystem->SetingSandStromSurface(TRUE);	
					
// 					CAppEffectData * pData = new CAppEffectData(g_pD3dApp->m_pShuttleChild,RC_EFF_MAGMA_TRIGER,m_pShuttleChild->m_vPos);
// 					if(pData)
// 					{
// 						pData = (CAppEffectData *)m_pEffectList->AddChild(pData);						
// 						pData->SetRepeat( TRUE, pItem->Time / 1000.0f, 99 );// 	
// 						m_pFxSystem->SetingSandStromSurface(TRUE);	
// 					}			
				}
				pSkillInfo->UseSkillFromServer(NULL, TRUE);	

			}

			g_pShuttleChild->m_pSkill->m_vecEnemyUsingSkillForMe.push_back( pSkillInfo );
			
		//end 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가
		}
		else 
		{
			// 기존 스킬 갱신
			pSkillInfo->Init();
			pSkillInfo->SetClientIndex( NULL, pMsg->ClientIndex );
			// 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
			//pSkillInfo->UseSkillFromServer();
		
			pSkillInfo->UseSkillFromServer(NULL, FALSE);
			//end 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
		}

		if(	g_pShuttleChild->m_pSkillEffect )
		{
			if( g_pShuttleChild->m_pSkillEffect->FindSkillEffect( pMsg->SkillItemNum ) )
			{
				g_pShuttleChild->m_pSkillEffect->ChangeBodyCondition( pMsg->SkillItemNum, BODYCON_USE_SKILL_MASK );
			}
			else
			{
				// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
				//ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
				// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
				CAppEffectData* pEff = new CAppEffectData( g_pShuttleChild,
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					SKILL_BASE_NUM(pItem->SourceIndex),
					SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),
					D3DXVECTOR3(0,0,0) );
				if(pEff->m_bUsing == TRUE )
				{
					// 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가		
					pEff = (CAppEffectData*)g_pD3dApp->m_pEffectList->AddChild(pEff);
					if (pMsg->SkillItemNum == 7514630 )
						m_pFxSystem->SetingSandStromSurface(TRUE);
					if (pMsg->SkillItemNum == 7514620 || pMsg->SkillItemNum == 7514630)
						pEff->SetRepeat(1,/*pMsg->AddTime*/10,1);
					//end 2011-10-10 by jhahn EP4 트리거 시스템	화산재 이펙트 추가						
				}						
				else
					delete pEff;
			}
		}
	}
	else
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
		if(pUnit)
		{
			ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );

			// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
			if( !pItem )
				return;
			// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

			// 남(몬스터)이 사용한 것중에 무적은 스킬은 이펙트를 재생하지 않는다
			if( pItem->IsExistDesParam( DES_SKILL_INVINCIBLE )
				|| pItem->IsExistDesParam( DES_SKILL_BARRIER ) )
				return;

			// 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)
			if( pItem->SkillType == SKILLTYPE_TIMELIMIT )
			{
				((CMonsterData*)(pUnit))->InsertMonsterBuffSkill( pMsg->SkillItemNum, pItem );
			}
			// end 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)

			if(pUnit->m_pSkillEffect)
			{
				if( pUnit->m_pSkillEffect->FindSkillEffect( pMsg->SkillItemNum ) )
				{ 
					pUnit->m_pSkillEffect->ChangeBodyCondition( pMsg->SkillItemNum, BODYCON_USE_SKILL_MASK );
				}
			
				else
				{
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_NUM(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
					CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_SOURCEINDEX(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
					if(pEff->m_bUsing)
					{
						pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					}
					else
					{
						delete pEff;
					}
				}


			}
		}
	}

}
//end 2011-10-24 by jhahn 트리거 시스템 
// 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현
VOID	CAtumApplication::FieldSocketMonsterSkill( MSG_FC_MONSTER_SKILL* pMsg )
{

	// 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.) - 포인터 사용 NULL 체크 추가.
	if ( NULL == g_pShuttleChild )
		return;
	
	if ( NULL != g_pShuttleChild->m_pSkill )
		g_pShuttleChild->m_pSkill->InitPreSkillItemNum();
	// End 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)

	// 나한테 쓰는 스킬
	if( g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIndex )
	{
		BOOL bDeleteUsingSkill			= FALSE;
		BOOL bDeleteEnemyUsingSkill		= FALSE;

		ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
		// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
		if( !pItem )
			return;
		// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

		if(SKILLTYPE_TIMELIMIT == pItem->SkillType)
		{
			bDeleteUsingSkill			= TRUE;
			bDeleteEnemyUsingSkill		= TRUE;
		}
		else if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
		{
			bDeleteUsingSkill			= TRUE;
		}
		else
		{
			bDeleteEnemyUsingSkill		= TRUE;
		}

		if(bDeleteUsingSkill)
		{
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindUsingSkillInfoByBaseNum( pMsg->SkillItemNum );
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo( pSkillInfo );
				pSkillInfo->ReleaseParamFactor();
				if(bDeleteEnemyUsingSkill)
				{
					g_pShuttleChild->m_pSkill->EraseLowLVUsingSkill( pMsg->MonsterIndex, pMsg->SkillItemNum );
				}
			}
		}

		if(bDeleteEnemyUsingSkill)
		{
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfoByBaseNum( pMsg->SkillItemNum );
			if(pSkillInfo)
			{
				g_pGameMain->m_pInfSkill->DeleteSkillInfo(pSkillInfo);
				pSkillInfo->ReleaseParamFactor();
				g_pShuttleChild->m_pSkill->EraseUsingSkill(pSkillInfo,TRUE);
			}
		}

		CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindEnemyUsingSkillForMeInfo( pMsg->SkillItemNum );
		if(NULL == pSkillInfo)
		{
			// 스킬 새로 사용
			ITEM_SKILL itemSkill;
			memset( &itemSkill, 0x00, sizeof( ITEM_SKILL ) );

			// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
// 			itemSkill.ItemInfo		= g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
// 			itemSkill.ItemNum		= itemSkill.ItemInfo->ItemNum;
// 			itemSkill.Kind			= itemSkill.ItemInfo->Kind;
			itemSkill.ItemInfo		= pItem;
			itemSkill.ItemNum		= pItem->ItemNum;
			itemSkill.Kind			= pItem->Kind;
			// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

			pSkillInfo	= g_pShuttleChild->m_pSkill->FindItemEnemySkillInfo( pMsg->SkillItemNum );
			if( NULL == pSkillInfo )
			{
				pSkillInfo = new CSkillInfo( &itemSkill );
				g_pShuttleChild->m_pSkill->m_mapEnemySkillInfo[ pMsg->SkillItemNum ] = pSkillInfo;
			}

			pSkillInfo->SetClientIndex( pMsg->MonsterIndex, pMsg->ClientIndex );
			// 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
			//pSkillInfo->UseSkillFromServer();
			CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
			pSkillInfo->UseSkillFromServer(((CMonsterData*)itMonster->second)->m_pMonsterInfo->MonsterName, FALSE);

			//end 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
			g_pShuttleChild->m_pSkill->m_vecEnemyUsingSkillForMe.push_back( pSkillInfo );
		}
		else
		{
			// 기존 스킬 갱신
			pSkillInfo->Init();
			pSkillInfo->SetClientIndex( pMsg->MonsterIndex, pMsg->ClientIndex );
			// 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
			//pSkillInfo->UseSkillFromServer();
			CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
			pSkillInfo->UseSkillFromServer(((CMonsterData*)itMonster->second)->m_pMonsterInfo->MonsterName, FALSE);
			//end 2010. 06. 18 by jskim 몬스터 사용 스킬 스트링 변경
		}

		if(	g_pShuttleChild->m_pSkillEffect )
		{
			if( g_pShuttleChild->m_pSkillEffect->FindSkillEffect( pMsg->SkillItemNum ) )
			{
				g_pShuttleChild->m_pSkillEffect->ChangeBodyCondition( pMsg->SkillItemNum, BODYCON_USE_SKILL_MASK );
			}
			else
			{
				// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
				//ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
				// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
				CAppEffectData* pEff = new CAppEffectData( g_pShuttleChild,
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					SKILL_BASE_NUM(pItem->SourceIndex),
					SKILL_BASE_SOURCEINDEX(pItem->SourceIndex),
					D3DXVECTOR3(0,0,0) );
				if(pEff->m_bUsing == TRUE )
					pEff = (CAppEffectData*)g_pD3dApp->m_pEffectList->AddChild(pEff);
				else
					delete pEff;
			}
		}
	}
	else
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
		if(pUnit)
		{
			ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );

			// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
			if( !pItem )
				return;
			// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

			// 남(몬스터)이 사용한 것중에 무적은 스킬은 이펙트를 재생하지 않는다
			if( pItem->IsExistDesParam( DES_SKILL_INVINCIBLE )
				|| pItem->IsExistDesParam( DES_SKILL_BARRIER ) )
				return;

			// 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)
			if( pItem->SkillType == SKILLTYPE_TIMELIMIT 
				&& pMsg->ClientIndex == pMsg->MonsterIndex )
			{
				((CMonsterData*)(pUnit))->InsertMonsterBuffSkill( pMsg->SkillItemNum, pItem );
			}
			// end 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)

			if(pUnit->m_pSkillEffect)
			{
				if( pUnit->m_pSkillEffect->FindSkillEffect( pMsg->SkillItemNum ) )
				{ 
					pUnit->m_pSkillEffect->ChangeBodyCondition( pMsg->SkillItemNum, BODYCON_USE_SKILL_MASK );
				}
				else
				{
					// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//					CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_NUM(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
					CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_SOURCEINDEX(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
					if(pEff->m_bUsing)
					{
						pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					}
					else
					{
						delete pEff;
					}
				}


			}
		}
	}
}
// 2011-02-08 by jhahn EP4 트리거 시스템 오브젝트 변경			
void	CAtumApplication::FieldObjectChangeOK(MSG_FC_OBJECT_CHANGE* pMsg)
{
	if( pMsg->ObjectIdx )
		ChangeMapObject( pMsg->ObjectIdx, pMsg->ChangeObjectIdx );

	
}
//end 2011-02-08 by jhahn EP4 트리거 시스템 오브젝트 변경			

// 2011-02-08 by jhahn EP4 트리거  시스템
VOID	CAtumApplication::FieldSocketShopClose(MSG_FC_SHOP_CLOSE* pMsg)
{
	// 2013-03-22 by bhsohn 트리거 상점 닫혔을때 현재 보고 있는 상점 닫고 수정
// 	MSG_FC_EVENT_LEAVE_BUILDING sMsg;
// 	sMsg.BuildingIndex = pMsg->BuildingIndex;
// 	g_pFieldWinSocket->SendMsg( T_FC_EVENT_LEAVE_BUILDING, (char*)&sMsg, sizeof(sMsg) );	
	if(g_pInterface && g_pInterface->m_pCityBase && g_pInterface->m_pCityBase->GetCurrentBuildingNPC())
	{
		g_pInterface->m_pCityBase->CloseCurrentEnterBuilding(FALSE);
	}
	// END 2013-03-22 by bhsohn 트리거 상점 닫혔을때 현재 보고 있는 상점 닫고 수정

}
//end 2011-02-08 by jhahn EP4 트리거  시스템  
//2011-02-08 by jhahn EP4 트리거  시스템
VOID	CAtumApplication::FieldSocketSetLimitTime( MSG_FC_SET_LIMITTIME* pMsg)
{

	m_pInterface->m_pInfinity->SetHellMap();
	ATUM_DATE_TIME curServerTime = GetServerDateTime();
	if( m_pInterface && m_pInterface->m_pInfinity )
	{
		m_pInterface->m_pInfinity->SetInfinityLimitTime(&curServerTime,pMsg->LimitTime);
		//m_pInterface->m_pInfinity->SetInfinityLimitTimeReset( pMsg->LimitTime );
	}

} 
//end 2011-02-08 by jhahn EP4 트리거  시스템
VOID	CAtumApplication::FieldSocketMonsterMonsterBarrierUsing( MSG_FC_BATTLE_MONSTER_BARRIER_USING* pMsg )
{

}

VOID	CAtumApplication::FieldSocketMonsterMonsterBarrierUse( MSG_FC_BATTLE_MONSTER_BARRIER_USE* pMsg )
{
	CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->MonsterIndex );
	if(pUnit)
	{
		ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->SkillItemNum );
		if(pUnit->m_pSkillEffect)
		{
			if( pUnit->m_pSkillEffect->FindSkillEffect( pMsg->SkillItemNum ) )
				pUnit->m_pSkillEffect->ChangeBodyCondition( pMsg->SkillItemNum, BODYCON_USE_SKILL_MASK );
			else
			{
				// 2013-03-13 by bhsohn 스킬 번호 구조 수정
//				CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_NUM(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
				CAppEffectData* pEff = new CAppEffectData( pUnit, SKILL_BASE_SOURCEINDEX(pItem->SourceIndex), D3DXVECTOR3(0,0,0) );
				if( !pEff->m_bUsing )
					delete pEff;
				else
				{
					pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
					pEff->SetRepeat( TRUE, pItem->Time / 1000.0f, 99 );
				}
			}
		}
	}
}

VOID	CAtumApplication::FieldSocketCharacterDebuffDotInfo( MSG_FC_CHARACTER_DEBUFF_DOT_INFO_OK* pMsg )
{
	if( g_pShuttleChild )
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoDebuffDotInfo( pMsg );
}

VOID	CAtumApplication::FieldSocketCharacterDebuffDotApply( MSG_FC_CHARACTER_DEBUFF_DOT_APPLYING* pMsg )
{
	if( g_pShuttleChild )
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoDebuffDotApply( pMsg );
}

VOID	CAtumApplication::FieldSocketCharacterDebuffDotRelease( MSG_FC_CHARACTER_DEBUFF_DOT_RELEASE* pMsg )
{
	if( g_pShuttleChild )
		g_pShuttleChild->m_pClientParty->FPartyUpdateMemberInfoDebuffDotRelease( pMsg );
}
// end 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현


// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
VOID	CAtumApplication::FieldSocketInfinityModeListOK( MSG_FC_INFINITY_MODE_LIST_OK* pMsg )
{
	// 저장된 모드 정보 초기화
	m_pInfinityManager->ClearModeInfo();

	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 	// 인피니티 모드 선택 화면으로 전환
// 	CINFCityInfinityField* pINFInfinityField = NULL;
// 	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		pINFInfinityField = ((CINFCityInfinityField*)((*it).second));
// 
// 	if( pMsg )
// 	{
// 		char* pTemp = (char*)(pMsg) + sizeof( MSG_FC_INFINITY_MODE_LIST_OK );
// 
// 		// 모드 갯수만큼 모드 추가
// 		for( int i=0; i<pMsg->InfinityModeListCount; ++i )
// 		{
// 			INFINITY_MODE_INFO* p = (INFINITY_MODE_INFO*)(pTemp + i * sizeof( INFINITY_MODE_INFO ));
// 			m_pInfinityManager->AddModeInfo( p );
// 
// 			pINFInfinityField->AddInfinityMapImg( p->InfinityMapIdx );
// 		}
// 	}
// 
// 	// 인피니티 모드 선택 화면으로 전환
// 	if( pINFInfinityField )
// 		pINFInfinityField->ShowWndEx( CINFCityInfinityField::INFINITY_ZONESEL, TRUE );

	// 인피니티 모드 선택 화면으로 전환
	if( m_pInterface )
	{
		if( m_pInterface->m_pCityBase )
		{
			if( m_pInterface->m_pCityBase->GetRefCurrentBuildingNPCState() == BUILDINGNPC_RENDER_INFINITYFIELD )
				m_pInterface->m_pCityBase->OnCityNPCButtonDown( CITY_NPC_BUTTON_CLOSE );
		}

		CINFCityInfinityFieldPopUp*	pInfinityPopUp	= m_pInterface->m_pInfinityPopup;

		if( pInfinityPopUp )
		{
			if( pMsg )
			{
				char* pTemp = (char*)(pMsg) + sizeof( MSG_FC_INFINITY_MODE_LIST_OK );

				// 모드 갯수만큼 모드 추가
				for( int i=0; i<pMsg->InfinityModeListCount; ++i )
				{
					INFINITY_MODE_INFO* p = (INFINITY_MODE_INFO*)(pTemp + i * sizeof( INFINITY_MODE_INFO ));
					m_pInfinityManager->AddModeInfo( p );

					pInfinityPopUp->AddInfinityMapImg( p->InfinityMapIdx );
				}
			}

			// 인피니티 모드 선택 화면으로 전환
			if( pInfinityPopUp )
				pInfinityPopUp->ShowWndEx( CINFCityInfinityFieldPopUp::INFINITY_ZONESEL, TRUE );
		}
	}
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
}

VOID	CAtumApplication::FieldSocketInfinityReadyListOK( MSG_FC_INFINITY_READY_LIST_OK* pMsg )
{
	// 저장중인 인피니티 대기방 정보를 초기화 한다
	m_pInfinityManager->ClearReadyInfo();

	if( pMsg )
	{
		char* pTemp = (char*)(pMsg) + sizeof( MSG_FC_INFINITY_READY_LIST_OK );

		// 방 갯수만큼 방 추가
		for( int i=0; i<pMsg->InfinityPlayingListCount; ++i )
		{
			INFINITY_READY_LIST* p = (INFINITY_READY_LIST*)(pTemp + i * sizeof( INFINITY_READY_LIST ));
			m_pInfinityManager->AddReadyInfo( p );
		}
	}

	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 	// 방 선택화면으로 전환
// 	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_ROOMSEL, TRUE );

	if( m_pInterface && m_pInterface->m_pInfinityPopup )
		m_pInterface->m_pInfinityPopup->ShowWndEx( CINFCityInfinityFieldPopUp::INFINITY_ROOMSEL, TRUE );

	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
}

VOID	CAtumApplication::FieldSocketInfinityCreateOK( MSG_FC_INFINITY_CREATE_OK* pMsg )
{
	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 	// 방 생성이 완료 됬을 경우, 대기방화면으로 전환
// 	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_INROOM, TRUE );

	if( m_pInterface && m_pInterface->m_pInfinityPopup )
		m_pInterface->m_pInfinityPopup->ShowWndEx( CINFCityInfinityFieldPopUp::INFINITY_INROOM, TRUE );

	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

	// 생성된 방의 UID 셋팅
	m_pInfinityManager->SetMyRoomInfo( 0, pMsg->InfinityCreateUID, NULL );

	// 생성된 방의 난이도 레벨 셋팅.
	m_pInfinityManager->SetMyRoomInfo_Difficult ( pMsg->IntinityDifficultyLevel );

	// 방안의 멤버 리스트 요청
	g_pFieldWinSocket->SendMsg( T_FC_INFINITY_MEMBER_INFO_LIST, 0, 0 );
}

VOID	CAtumApplication::FieldSocketInfinityMemberInfoList( MSG_FC_INFINITY_MEMBER_INFO_LIST_OK* pMsg )
{
	// 저장된 방 멤버 리스트 초기화
	m_pInfinityManager->ClearMemberInfo();

	if( pMsg )
	{
		// 방장 ClientIdx저장
		m_pInfinityManager->SetMyRoomInfo( pMsg->MasterClientIdx, 0, NULL );

		char* pTemp = (char*)(pMsg) + sizeof( MSG_FC_INFINITY_MEMBER_INFO_LIST_OK );

		// 인피니티 멤버수만큼 추가
		for( int i=0; i<pMsg->InfinityMemberListCount; ++i )
		{
			INFINITY_MEMBER_INFO_LIST* p = (INFINITY_MEMBER_INFO_LIST*)(pTemp + i * sizeof( INFINITY_MEMBER_INFO_LIST ));
			m_pInfinityManager->AddMemberInfo( p );
		}
	}
}

VOID	CAtumApplication::FieldSocketInfinityLeaveOK( MSG_FC_INFINITY_LEAVE_OK* pMsg )
{
	// 다른 멤버가 나간 것이라면 멤버리스트에서 제거
	if( m_pArenaManager->GetArenaCharacterInfo()->ClientIndex != pMsg->LeaveClientIdx )

	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	//m_pInfinityManager->RemoveMemberInfo( pMsg->LeaveClientIdx );
	{
		INFINITY_MEMBER_INFO_LIST* pMember = m_pInfinityManager->GetMemberInfoByClientIdx( pMsg->LeaveClientIdx );
		if( pMember )
		{
			char szTemp[ SIZE_MAX_CHAT_MESSAGE ];
			sprintf( szTemp, STRMSG_C_100310_0301, pMember->CharacterName );	// "\\y인피니티 필드 대기방에서 %s님이 나갔습니다.\\y"
			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
		}

		m_pInfinityManager->RemoveMemberInfo( pMsg->LeaveClientIdx );
	}
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

	else
	{
		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 		// 내가 나간 것이라면
// 		CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 		if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		{
// 			((CINFCityInfinityField*)((*it).second))->DisableChatControl();
// 			((CINFCityInfinityField*)((*it).second))->ClearChatList();
// 		}

		// 내가 나간 것이라면
		if( m_pInterface && m_pInterface->m_pInfinityPopup )
		{
			m_pInterface->m_pInfinityPopup->DisableChatControl();
			m_pInterface->m_pInfinityPopup->ClearChatList();

			if( !m_pInterface->m_pInfinityPopup->IsShowWnd() )
				return;
		}
		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

		// 대기방 리스트 요청
		if( g_pD3dApp->GetInfinityManager()->GetInfinityModeIdx() != -1 )
		{
			INFINITY_MODE_INFO* pMapInfo	= g_pD3dApp->GetInfinityManager()->GetInfinityModeByIndex( g_pD3dApp->GetInfinityManager()->GetInfinityModeIdx() );

			MSG_FC_INFINITY_READY_LIST msg;
			msg.InfinityMapIdx	= pMapInfo->InfinityMapIdx;
			msg.InfinityMode	= pMapInfo->InfinityMode;

			g_pD3dApp->GetInfinityManager()->ClearMemberInfo();
			g_pD3dApp->GetInfinityManager()->ClearMyRoomInfo();
			g_pD3dApp->GetInfinityManager()->ClearReadyInfo();
			g_pD3dApp->GetInfinityManager()->ClearJoinRequest();
			g_pD3dApp->GetInfinityManager()->ClearRejectClientIdx();

			g_pFieldWinSocket->SendMsg( T_FC_INFINITY_READY_LIST, (char*)(&msg), sizeof(MSG_FC_INFINITY_READY_LIST) );
		}
	}
}

VOID	CAtumApplication::FieldSocketInfinityBanOK( MSG_FC_INFINITY_BAN_OK* pMsg )
{
	// 다른 멤버가 강퇴 당한것이라면 멤버 리스트에서 제거
	if( m_pArenaManager->GetArenaCharacterInfo()->ClientIndex != pMsg->BanClientIdx )
	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	//m_pInfinityManager->RemoveMemberInfo( pMsg->BanClientIdx );
	{
		INFINITY_MEMBER_INFO_LIST* pMember = m_pInfinityManager->GetMemberInfoByClientIdx( pMsg->BanClientIdx );
		if( pMember )
		{
			char szTemp[ SIZE_MAX_CHAT_MESSAGE ];
			sprintf( szTemp, STRMSG_C_100310_0301, pMember->CharacterName );	// "\\y인피니티 필드 대기방에서 %s님이 나갔습니다.\\y"
			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
		}

		m_pInfinityManager->RemoveMemberInfo( pMsg->BanClientIdx );
	}
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	else
	{
		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 		// 내가 강퇴당한 것이라면
// 		CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 		if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		{
// 			((CINFCityInfinityField*)((*it).second))->DisableChatControl();
// 			((CINFCityInfinityField*)((*it).second))->ClearChatList();
// 		}

		// 내가 강퇴당한 것이라면
		if( m_pInterface && m_pInterface->m_pInfinityPopup )
		{
			m_pInterface->m_pInfinityPopup->DisableChatControl();
			m_pInterface->m_pInfinityPopup->ClearChatList();

			if( !m_pInterface->m_pInfinityPopup->IsShowWnd() )
				return;
		}

		char szTemp[ SIZE_MAX_CHAT_MESSAGE ];
		strcpy( szTemp, STRMSG_C_100310_0305 );	// "\\y인피니티 필드 대기방에서 추방 당하였습니다.\\y"
		g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

		//  대기방 리스트 요청
		if( g_pD3dApp->GetInfinityManager()->GetInfinityModeIdx() != -1 )
		{
			INFINITY_MODE_INFO* pMapInfo	= g_pD3dApp->GetInfinityManager()->GetInfinityModeByIndex( g_pD3dApp->GetInfinityManager()->GetInfinityModeIdx() );

			MSG_FC_INFINITY_READY_LIST msg;
			msg.InfinityMapIdx	= pMapInfo->InfinityMapIdx;
			msg.InfinityMode	= pMapInfo->InfinityMode;

			g_pD3dApp->GetInfinityManager()->ClearMemberInfo();
			g_pD3dApp->GetInfinityManager()->ClearMyRoomInfo();
			g_pD3dApp->GetInfinityManager()->ClearReadyInfo();

			g_pFieldWinSocket->SendMsg( T_FC_INFINITY_READY_LIST, (char*)(&msg), sizeof(MSG_FC_INFINITY_READY_LIST) );
		}
	}
}

VOID	CAtumApplication::FieldSocketInfinityJoinRequest( MSG_FC_INFINITY_JOIN_REQUEST_MASTERUSER* pMsg )
{
	// 방 입장 요청 추가
	m_pInfinityManager->AddJoinRequest( pMsg );
}

VOID	CAtumApplication::FieldSocketInfinityJoinOK( MSG_FC_INFINITY_JOIN_OK* pMsg )
{
	// 방 입장 요청에 대한 응답(내가 아닌 다른 클라이언트일경우)
	if( m_pArenaManager->GetArenaCharacterInfo()->ClientIndex != pMsg->JoinClientIdx )
	{
		// 허가 됬을 경우만
		if( pMsg->bAccept )
		{
			INFINITY_MEMBER_INFO_LIST memberinfo;
			strcpy(memberinfo.CharacterName, pMsg->JoinCharacterName);
			memberinfo.ClientIdx	= pMsg->JoinClientIdx;
			memberinfo.Gear			= pMsg->Gear;
			memberinfo.Lv			= pMsg->Lv;
			memberinfo.State		= INFINITY_STATE_NONE;

			// 멤버 추가
			m_pInfinityManager->AddMemberInfo( &memberinfo );

			// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
			char szTemp[ SIZE_MAX_CHAT_MESSAGE ];

			char* p = strrchr( pMsg->JoinCharacterName, '\\' );
			if( p )
				*p = '\0';

			sprintf( szTemp, STRMSG_C_100310_0303, pMsg->JoinCharacterName );	// "\\y인피니티 필드 대기방에 %s님이 진입 하였습니다.\\y"
			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
			// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		}
	}
	else
	{

		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 		CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 		if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		{
// 			// 허가 됬을 경우만
// 			if( pMsg->bAccept )
// 			{
// 				((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_INROOM, TRUE );
// 				
// 				g_pFieldWinSocket->SendMsg( T_FC_INFINITY_MEMBER_INFO_LIST, 0, 0 );
// 			}
// 
// 			((CINFCityInfinityField*)((*it).second))->SetRoomJoinWait( FALSE );
// 		}

		if( m_pInterface && m_pInterface->m_pInfinityPopup )
		{
			// 허가 됬을 경우만
			if( pMsg->bAccept )
			{
				m_pInterface->m_pInfinityPopup->ShowWndEx( CINFCityInfinityFieldPopUp::INFINITY_INROOM, TRUE );

				g_pFieldWinSocket->SendMsg( T_FC_INFINITY_MEMBER_INFO_LIST, 0, 0 );
			}

			m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );
		}
		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	}
}

VOID	CAtumApplication::FieldSocketInfinityEnter( MSG_FC_INFINITY_ENTER* pMsg )
{
	// 채널 인덱스
	m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.ChannelIndex = pMsg->InfinityChannelIdx;
	// 포지션
	m_pShuttleChild->m_vPos	= pMsg->CharacterPosition;

	// 맵 로딩 종료
	m_pInterface->InvalidateMapLoadObjects();
	m_pInterface->DeleteMapLoadObjects();
	ChangeGameState( _GAME );

	// 페널티 관련 정보
	int nPenaltyTime = m_pInfinityManager->GetMyRoomInfo()->ModeInfo.TimePenaltyValue;
	char szTemp[ 256 ];

	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo( m_pInfinityManager->GetMyRoomInfo()->ModeInfo.InfinityMapIdx );
	if( pMapInfo )
	{
		
		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 		if( nPenaltyTime > 0 )
// 		{
// 			sprintf( szTemp, STRMSG_C_091103_0334, pMapInfo->MapName, nPenaltyTime );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 증가 됩니다.\\y"
// 			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
// 		}
// 		else if( nPenaltyTime < 0 )
// 		{
// 			sprintf( szTemp, STRMSG_C_091103_0333, pMapInfo->MapName, abs(nPenaltyTime) );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 감소 됩니다.\\y"
// 			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
// 		}

		switch( m_pInfinityManager->GetMyRoomInfo()->ModeInfo.InfinityMode )
		{
		case INFINITY_MODE_BOSSRUSH:
			{
				if( nPenaltyTime > 0 )
				{
					sprintf( szTemp, STRMSG_C_091103_0334, pMapInfo->MapName, nPenaltyTime );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 증가 됩니다.\\y"
					g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
				}
				else if( nPenaltyTime < 0 )
				{
					sprintf( szTemp, STRMSG_C_091103_0333, pMapInfo->MapName, abs(nPenaltyTime) );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 감소 됩니다.\\y"
					g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
				}
			}
			break;

		case INFINITY_MODE_DEFENCE:
			{
				sprintf( szTemp, STRMSG_C_100310_0308, pMapInfo->MapName, nPenaltyTime );	// "\\y[%s]은(는) 사망 시 기지의 HP가 현재 HP의 [%d]%%만큼 감소 합니다.\\y"
				g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
			}
			break;
		}

		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	}

	// 인피니티는 좌표값이 이 때 날라오므로 워프 패턴을 이 때 생성한다
	m_pShuttleChild->DeletePattern();
	m_pShuttleChild->PatternWarpOut(TRUE);

	g_ArenaServerDateTime	= pMsg->StartTime;	
	g_ArenaStartTime		= timeGetTime();

	// 인피니티 종료시간
	// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
// 	if( m_pInterface->m_pInfinity )
// 		m_pInterface->m_pInfinity->SetInfinityLimitTime( &(pMsg->StartTime), pMsg->LimitTime );
	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetInfinityLimitTime( &(pMsg->StartTime), pMsg->LimitTime );
	// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

	// 인피니티 맵 로딩이 다 됬다
	m_bInfinityMapload	= FALSE;

	// 인피니티 입장 허가
	m_bEnterInfinityAllowed	= TRUE;

	// 로그오프창 막음
	g_pGameMain->m_pSystem->EnableLogOffBtn( FALSE );
}

VOID	CAtumApplication::FieldSocketInfinityReadyOK( MSG_FC_INFINITY_READY_OK* pMsg )
{
	// 해당 멤버의 상태를 레디로
	INFINITY_MEMBER_INFO_LIST* pMember = m_pInfinityManager->GetMemberInfoByClientIdx( pMsg->ReadyClientIdx );
	if( pMember )
		pMember->State = INFINITY_STATE_READY;

	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	if( m_pInfinityManager->IsAllReady()
		&& m_pInfinityManager->GetMemberCount() == m_pInfinityManager->GetMyRoomInfo()->ModeInfo.MaxMemberCount )
	{
		char szTemp[ SIZE_MAX_CHAT_MESSAGE ];
		strcpy( szTemp, STRMSG_C_100310_0304 );	// "\\y인피니티 필드 대기방의 모든 인원이 준비완료 상태입니다.\\y"
		g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
	}
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
}

VOID	CAtumApplication::FieldSocketInfinityReadyCancelOK( MSG_FC_INFINITY_READY_CANCEL_OK* pMsg )
{
	// 해당 멤버의 상태를 레디 취소로
	INFINITY_MEMBER_INFO_LIST* pMember = m_pInfinityManager->GetMemberInfoByClientIdx( pMsg->ReadyCancelClientIdx );
	if( pMember )
		pMember->State = INFINITY_STATE_UNPREPARED;
}

VOID	CAtumApplication::FieldSocketInfinityChangeMaster( MSG_FC_INFINITY_CHANGE_MASTER_OK* pMsg )
{
	// 방장을 해당 멤버로
	INFINITY_MEMBER_INFO_LIST* pMember = m_pInfinityManager->GetMemberInfoByClientIdx( pMsg->ChangeMasterClientIdx );
	if( pMember )
	// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	//m_pInfinityManager->GetMyRoomInfo()->MasterIndex	= pMsg->ChangeMasterClientIdx;
	{
		m_pInfinityManager->GetMyRoomInfo()->MasterIndex	= pMsg->ChangeMasterClientIdx;
		char szTemp[ SIZE_MAX_CHAT_MESSAGE ];
		sprintf( szTemp, STRMSG_C_100310_0302, pMember->CharacterName );	// "\\y인피니티 필드 대기방의 방장이 %s님으로 변경 되었습니다.\\y"
		g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
	}
	// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
}

VOID	CAtumApplication::FieldSocketInfinityCinema( MSG_FC_INFINITY_CINEMA* pMsg )
{
	// 인피니티 이펙트일 경우
	if( pMsg->EffectIdx / 100000 == 60 )
	{
		// 해당 번호, 위치로 이펙트 추가
		CAppEffectData* pEff = new CAppEffectData( pMsg->EffectIdx,
												   D3DXVECTOR3( pMsg->EffectPosition_X, pMsg->EffectPosition_Y, pMsg->EffectPosition_Z ));

		if( !pEff->m_bUsing )
		{
			SAFE_DELETE( pEff );
		}
		else
		{
			m_pEffectList->AddChild( pEff );
			pEff->SetRepeat( TRUE, pMsg->EffectPlayTime / 1000.0f, pMsg->EffectPlayCount );
		}
	}

	// 오브젝트 변경
	if( pMsg->ObjectIdx )
		ChangeMapObject( pMsg->ObjectIdx, pMsg->ChangeObjectIdx );

	// 대사 처리
	if( strlen( pMsg->CinemaTalk ) > 0 )
		m_pChat->CreateChatChild( pMsg->CinemaTalk, COLOR_CHAT_REGION, CHAT_TAB_NORMAL );

	// 카메라 떨림
	if( pMsg->CameraTremble )
		m_pCamera->ChangeCamCollType( 1, pMsg->CameraTremble / 100 );

	// 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)
	// 팁
	if ( strlen( pMsg->TipFileName ) > 0 && m_pInterface && m_pInterface->m_pInfinity )
	{
		// 2010. 05. 17 by hsLee 인피니티 필드 2차 UI 추가 수정. 단계 표시 버그 수정.
		if ( m_pInterface->m_pInfinity->IsEvent_AlarmDefenseStep ( pMsg->TipFileName ) )
			m_pInterface->m_pInfinity->SetAlarm_DefenseStep ( pMsg->TipFileName );
		else
		{
// 2011-07-22 by jhahn 인피3차 (연출 처리) 시간단축
			m_pInterface->m_pInfinity->SerchTipImg(pMsg->TipFileName);
			m_pInterface->m_pInfinity->SetTipImg( pMsg->TipFileName );
//end 2011-07-22 by jhahn 인피3차 (연출 처리) 시간단축
		}
		// End 2010. 05. 17 by hsLee 인피니티 필드 2차 UI 추가 수정. 단계 표시 버그 수정.
	}

	// 스카이박스
	if( strlen( pMsg->SkyFileName ) > 0 && m_pScene )
		m_pScene->ChangeSkyBox( pMsg->SkyFileName );

	// 오브젝트 애니메이션
	if( pMsg->ObjectBodyConditionIdx && m_pScene )
		m_pScene->ChangeEventObjectBodyCondition( pMsg->ObjectBodyConditionIdx, pMsg->BodyCondition );

	if( strlen( pMsg->SoundFileName ) && m_pSound)
		m_pSound->PlayD3DSound( pMsg->SoundFileName, D3DXVECTOR3(0,0,0), TRUE );
	// end 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)

	// 2011. 03. 08 by jskim 인피3차 구현 - 퀘스트 시스템
	if( pMsg->QuestIndex )
	{
		CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();
		g_pGameMain->m_pMissionMain->ShowMissionPopWnd(TRUE, pMsg->QuestIndex);	
	}
	// end 2011. 03. 08 by jskim 인피3차 구현 - 퀘스트 시스템
}

VOID	CAtumApplication::FieldSocketInfinitySuccessFIN( void )
{
	// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
	//m_pInterface->m_pInfinity->SetResult( TRUE );
	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetResult( TRUE );
	// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
	// 2010. 05. 27 by jskim 시네마 적용 카메라 구현
	g_pShuttleChild->InfinityCinema(TRUE);
	//end 2010. 05. 27 by jskim 시네마 적용 카메라 구현
}

VOID	CAtumApplication::FieldSocketInfinityFailFIN( void )
{
	// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
	//m_pInterface->m_pInfinity->SetResult( FALSE );
	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetResult( FALSE );
	// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
	// 2010. 05. 27 by jskim 시네마 적용 카메라 구현
	g_pShuttleChild->InfinityCinema(FALSE);
	//end 2010. 05. 27 by jskim 시네마 적용 카메라 구현
}

VOID	CAtumApplication::FieldSocketInfinityReadyFinishMainSvrStart( void )
{
	g_pGameMain->m_pSystem->EnableLogOffBtn( TRUE );

	// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
	//m_pInterface->m_pInfinity->SetInfinityEnd();
	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetInfinityEnd();
	// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

	ArenaFinishWarp( FALSE );
}

VOID	CAtumApplication::FieldSocketInfinityTenderDropItemInfo( MSG_FC_INFINITY_TENDER_DROPITEM_INFO* pMsg )
{
	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
	//m_pInfinityManager->AddTenderItem( pMsg );

	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->AddTenderItem( pMsg );
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
}

VOID	CAtumApplication::FieldSocketInfinityTenderStart( MSG_FC_INFINITY_TENDER_START* pMsg )
{
	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
// 	ITEM* pItem = m_pDatabase->GetServerItemInfo( pMsg->TenderItemNum );
// 	if( !pItem )
// 		m_pInterface->m_pInfinity->SetTenderItemBigIcon( NULL );
// 	else
// 	{
// 		m_pInfinityManager->SetCurTenderItem( pMsg->ItemFieldIndex );
// 
// 		m_pInfinityManager->SetCurTenderItemInfo( pItem,
// 												  m_pInfinityManager->GetCurTenderItem()->PrefixCodeNum, 
// 												  m_pInfinityManager->GetCurTenderItem()->SuffixCodeNum );
// 
// 		m_pInterface->m_pInfinity->SetTenderItemBigIcon( g_pGameMain->FindBigIcon( pItem->SourceIndex ) );
// 	}
// 
// 	m_pInterface->m_pInfinity->SetTenderEndTime( timeGetTime() + TICK_TENDER_PROCESSING_TERM );
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
}

VOID	CAtumApplication::FieldSocketInfinityPutInTenderOK( MSG_FC_INFINITY_TENDER_PUT_IN_TENDER_OK* pMsg )
{
	// 주사위 결과
	CUnitData* pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->DiceUserIdx );
	if( !pUnit )
		return;

	// 캐릭터 이름
	char szCharName[ SIZE_MAX_CHARACTER_NAME ] = {0, };

	switch( pUnit->m_dwPartType )
	{
		case _SHUTTLE:
			strcpy( szCharName, ((CShuttleChild*)(pUnit))->GetShuttleInfo()->CharacterName );
		break;

		case _ENEMY:
			strcpy( szCharName, ((CEnemyData*)(pUnit))->m_infoCharacter.CharacterInfo.CharacterName );
		break;

		default:
			return;
	}

	char* p = strrchr( szCharName, '\\');
	if( p )
		*p = '\0';

	char szBuff[256];

	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
// 	if( pMsg->DiceCount != 0 )
// 		sprintf( szBuff, STRMSG_C_091103_0315, szCharName, pMsg->DiceCount );
// 	else
// 	{
// 		MSG_FC_INFINITY_TENDER_DROPITEM_INFO* pTenderItem = m_pInfinityManager->GetTenderItem( pMsg->ItemFieldIndex );
// 		if( !pTenderItem )
// 			return;
// 
// 		ITEM* pItem = m_pDatabase->GetServerItemInfo( pTenderItem->TenderDropItemNum );
// 		if( !pItem )
// 			return;
// 
// 		sprintf( szBuff, STRMSG_C_091103_0314, szCharName, pItem->ItemName );
// 	}
	
	if( !(m_pInterface && m_pInterface->m_pInfinity) )
		return;

	TenderItem* pTenderItem = m_pInterface->m_pInfinity->GetTenderItem( pMsg->ItemFieldIndex );
	if( !pTenderItem )
		return;

	if( pMsg->DiceCount != 0 )
		sprintf( szBuff, STRMSG_C_100310_0321, pTenderItem->m_pItem->ItemName, szCharName, pMsg->DiceCount );	// "[%s]에 대한 [%s]님의 입찰 값[%d]가 나왔습니다."
	else
		sprintf( szBuff, STRMSG_C_091103_0314, szCharName, pTenderItem->m_pItem->ItemName );	// "[%s]님이 [%s]아이템?입찰포기 하였습니다."
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)

	m_pChat->CreateChatChild( szBuff, COLOR_ITEM );
}

VOID	CAtumApplication::FieldSocketInfinityTenderResult( MSG_FC_INFINITY_TENDER_RESULT* pMsg )
{
	CUnitData* pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->DiceUserIdx );
	if( !pUnit )
		return;

	char szCharName[ SIZE_MAX_CHARACTER_NAME ] = {0, };
	
	switch( pUnit->m_dwPartType )
	{
	case _SHUTTLE:
		strcpy( szCharName, ((CShuttleChild*)(pUnit))->GetShuttleInfo()->CharacterName );
		break;

	case _ENEMY:
		strcpy( szCharName, ((CEnemyData*)(pUnit))->m_infoCharacter.CharacterInfo.CharacterName );
		break;

	default:
		return;
	}

	char* p = strrchr( szCharName, '\\');
	if( p )
		*p = '\0';

	ITEM* pItem = m_pDatabase->GetServerItemInfo( pMsg->TenderItemNum );
	if( !pItem )
		return;

	char szBuff[256];

	// "%s님이 입찰값 [%d]로 %s아이템을 획득합니다."
	sprintf( szBuff, STRMSG_C_091103_0316, szCharName, pMsg->DiceCount, pItem->ItemName );

	m_pChat->CreateChatChild( szBuff, COLOR_ITEM );

	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
	//m_pInfinityManager->RemoveTenderItem( pMsg->ItemFieldIndex );

	//m_pInfinityManager->SetCurTenderItem( 0 );

	//m_pInterface->m_pInfinity->SetTenderItemBigIcon( NULL );

	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->RemoveTenderItem( pMsg->ItemFieldIndex );
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
}

VOID	CAtumApplication::FieldSocketInfinityTenderResultTimeOver( MSG_FC_INFINITY_TENDER_RESULT_TIMEOVER* pMsg )
{
	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
// 	m_pInfinityManager->RemoveTenderItem( pMsg->ItemFieldIndex );
// 
// 	m_pInfinityManager->SetCurTenderItem( 0 );
// 
// 	m_pInterface->m_pInfinity->SetTenderItemBigIcon( NULL );

	if( m_pInterface && m_pInterface->m_pInfinity )
	{
		TenderItem* pItem = m_pInterface->m_pInfinity->GetTenderItem( pMsg->ItemFieldIndex );
		if( pItem )
		{
			pItem->m_bTendered = TRUE;
			if( m_pInterface && m_pInterface->m_pInfinity )
				m_pInterface->m_pInfinity->ReArrangeTenderItemPosition();
		}
	}
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)

	g_pGameMain->SetItemInfoNormal( NULL, 0, 0 );
}

VOID	CAtumApplication::FieldSocketInfinityTenderResultAllGiveUp( MSG_FC_INFINITY_TENDER_RESULT_ALLGIVEUP* pMsg )
{
	// 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
// 	m_pInfinityManager->RemoveTenderItem( pMsg->ItemFieldIndex );
// 
// 	m_pInfinityManager->SetCurTenderItem( 0 );
// 
// 	m_pInterface->m_pInfinity->SetTenderItemBigIcon( NULL );
// 
// 	m_pChat->CreateChatChild( STRMSG_C_091103_0317, COLOR_ITEM );

	TenderItem* pTenderItem = m_pInterface->m_pInfinity->GetTenderItem( pMsg->ItemFieldIndex );
	if( pTenderItem )
	{
		char szBuff[ 256 ];
		sprintf( szBuff, STRMSG_C_100310_0322, pTenderItem->m_pItem->ItemName );	// "모든 인원이[%s]의 입찰을 포기하였습니다."
		m_pChat->CreateChatChild( szBuff, COLOR_ITEM );

		if( m_pInterface && m_pInterface->m_pInfinity )
			m_pInterface->m_pInfinity->RemoveTenderItem( pMsg->ItemFieldIndex );
	}
	// end 2010. 04. 13 by ckPark 인피니티 필드 2차(입찰 보상관련 변경)
}

VOID	CAtumApplication::FieldSocketInfinityApplyResistanceItem( MSG_FC_INFO_APPLY_RESISTANCE_ITEM* pMsg )
{
	if( pMsg->SkillNum )
	{
		ITEM* pItem = m_pDatabase->GetServerItemInfo( pMsg->SkillNum );
		if( pItem )
		{
			// Find Keyword : 2013-03-19 by jmahn %s공격을 저항 하였습니다. %s로 출력 되던 버그 수정
			char szbuf [ 256 ] = {0,};
			sprintf( szbuf , STRMSG_C_091103_0341 , pItem->ItemName );//"\\y%s공격을 저항 하였습니다."
			// end, 2013-03-19 by jmahn
			m_pChat->CreateChatChild( szbuf, COLOR_ITEM );
		}
	}
}

VOID	CAtumApplication::FieldSocketInfinityShopItemHeader( void )
{
	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY_SHOP );
	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		((CINFCityInfinityShop*)((*it).second))->ClearItemInfo( );
}

VOID	CAtumApplication::FieldSocketInfinityShopItem( MSG_FC_SHOP_INFINITY_ITEM* pMsg )
{
	// 인피니티 구매 상점 아이템 리스트 추가
	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY_SHOP );
	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		((CINFCityInfinityShop*)((*it).second))->AddItemInfo( pMsg );
}

VOID	CAtumApplication::FieldSocketInfinityShopItemDone( void )
{
	CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY_SHOP );
	if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		((CINFCityInfinityShop*)((*it).second))->ItemInputDone();
}

VOID	CAtumApplication::FieldSocketInfinityChangeLimitTime( MSG_FC_INFINITY_CHANGE_LIMITTIME* pMsg )
{
	// 인피니티 제한 시간 변경
	m_pInterface->m_pInfinity->SetInfinityChangeLimitTime( pMsg );
}

VOID	CAtumApplication::FieldSocketInfinityJoinCancelRequestMaster( MSG_FC_INFINITY_JOIN_CANCEL_REQUEST_MASTERUSER* pMsg )
{
	// 인피니티 방 가입 요청중인 유저 입장 취소
	GetInfinityManager()->RemoveJoinRequest( pMsg->JoinCancelClientIdx );
}

VOID	CAtumApplication::FieldSocketInfinityRequestRestartByDisconnect( void )
{
	// 인피니티 재입장 여부 알려줌
	m_bInfinityRestart	= TRUE;
	m_bAddInfinityRestartMessageBox	= TRUE;
}

VOID	CAtumApplication::FieldSocketInfinityDeletedCinema( MSG_FC_INFINITY_DELETED_CINEMA* pMsg )
{
	// 오브젝트 변경
	if( pMsg->ObjectIdx )
		ChangeMapObject( pMsg->ObjectIdx, pMsg->ChangeObjectIdx );
}

VOID	CAtumApplication::FieldSocketInfinityEnterByDisConnect( MSG_FC_INFINITY_ENTER_BY_DISCONNECT* pMsg )
{
	// 채널 인덱스
	m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.ChannelIndex = pMsg->InfinityChannelIdx;
	// 포지션
	m_pShuttleChild->m_vPos	= pMsg->CharacterPosition;

	// 내 방 정보 셋팅
	INFINITY_MODE_INFO info;
	info.InfinityMapIdx		= m_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex;
	info.InfinityMode		= pMsg->InfinityMode;
	info.InfinityModeUID	= 0;
	info.Join				= TRUE;
	info.MinLv				= 0;
	info.MaxLv				= 0;
	info.TimePenaltyValue	= pMsg->TimePenaltyValue;

	GetInfinityManager()->SetMyRoomInfo( pMsg->MasterClientIdx, pMsg->InfinityCreateUID, &info );

	// 맵 로딩 종료
	m_pInterface->InvalidateMapLoadObjects();
	m_pInterface->DeleteMapLoadObjects();
	ChangeGameState( _GAME );

	// 페널티 관련 정보
	int nPenaltyTime = m_pInfinityManager->GetMyRoomInfo()->ModeInfo.TimePenaltyValue;
	char szTemp[ 256 ];

	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo( m_pInfinityManager->GetMyRoomInfo()->ModeInfo.InfinityMapIdx );
	if( pMapInfo )
	{
		if( nPenaltyTime > 0 )
		{
			sprintf( szTemp, STRMSG_C_091103_0334, pMapInfo->MapName, nPenaltyTime );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 증가 됩니다.\\y"
			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
		}
		else if( nPenaltyTime < 0 )
		{
			sprintf( szTemp, STRMSG_C_091103_0333, pMapInfo->MapName, abs(nPenaltyTime) );	// "\\y[%s]은(는) 사망 시 인피니티 필드 진행 시간이 [%d]분 감소 됩니다.\\y"
			g_pGameMain->CreateChatChild( szTemp, COLOR_SYSTEM );
		}
	}

	// 인피니티는 좌표값이 이 때 날라오므로 워프 패턴을 이 때 생성한다
	m_pShuttleChild->DeletePattern();
	m_pShuttleChild->PatternWarpOut(TRUE);

	// 재접속시에는 FieldSocketConnectArenaServerLoginOk 동기화한 시간으로 사용한다
	//g_ArenaServerDateTime	= pMsg->StartTime;
	//g_ArenaStartTime		= timeGetTime();

	// 인피니티 종료시간
	// 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)
// 	m_pInterface->m_pInfinity->SetInfinityLimitTime( &(pMsg->StartTime), pMsg->LimitTime );
// 
// 	m_pInterface->m_pInfinity->SetInfinityPenaltyTime( pMsg->DecreaseTimeByDead );

	if( m_pInterface && m_pInterface->m_pInfinity )
	{
		m_pInterface->m_pInfinity->SetInfinityLimitTime( &(pMsg->StartTime), pMsg->LimitTime );

		m_pInterface->m_pInfinity->SetInfinityPenaltyTime( pMsg->DecreaseTimeByDead );
	}
	// end 2010. 04. 16 by ckPark 인피니티 필드 2차(버그 수정)

	// 인피니티 맵 로딩이 다 됬다
	m_bInfinityMapload	= FALSE;

	// 인피니티 입장 허가
	m_bEnterInfinityAllowed	= TRUE;

	// 로그오프창 막음
	g_pGameMain->m_pSystem->EnableLogOffBtn( FALSE );

	// Restart False
	m_bInfinityRestart	 = FALSE;
}

VOID	CAtumApplication::FieldSocketInfinityPartyAutoCreated( MSG_FC_PARTY_AUTO_CREATED* pMsg )
{
	m_pShuttleChild->m_pClientParty->FPartyAutoCreateOK( pMsg );
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

/*****************************************************************************************************
**
**	인피니티 난이도 정보 목록 받기.
**
**	Create Info :	2010. 05. 26. by hsLee.
**
******************************************************************************************************/
VOID	CAtumApplication :: FieldSocketInfinityRegsiterDifficultyBonusInfoListData ( MSG_INFINITY_DIFFICULTY_LIST_OK* pMsg )
{
	if ( NULL == pMsg )
		return;
	
	m_pInfinityManager->ClearInfinityDifficultyBonusInfo_ListData();

	char* pTemp = (char*)(pMsg) + sizeof( MSG_INFINITY_DIFFICULTY_LIST_OK );
	
	// 모드 갯수만큼 모드 추가
	for( int i=0; i<pMsg->Difficulty_List_count; ++i )
	{
		INFINITY_DIFFICULTY_BONUS_INFO* p = (INFINITY_DIFFICULTY_BONUS_INFO*)(pTemp + i * sizeof( INFINITY_DIFFICULTY_BONUS_INFO ));
		m_pInfinityManager->Register_InfinityDifficultyBonusInfo_ListData ( p );
	}

}

// 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )
/********************************************************************************************************
**
**	인피니티 방 난이도 레벨 변경 정보 받기.
**
**	Create Info :	2010. 05. 26.	by hsLee.
**
*********************************************************************************************************/
VOID	CAtumApplication :: FieldSocketInfinityChangeRoomDifficultyLevelOK( MSG_FC_INFINITY_CHANGE_DIFFICULTY_LEVEL_OK* pMsg )
{
	if ( NULL == pMsg )
		return;

	if ( g_pD3dApp->GetInfinityManager()->SetMyRoomInfo_Difficult ( pMsg->InfinityDifficultyLevel ) )
	{
		if ( TRUE == pMsg->bUpdate )
		{
			char szMsgBuff[256] = {0, };
				sprintf ( szMsgBuff ,  STRMSG_C_100601_0501 , pMsg->InfinityDifficultyLevel );
				
			m_pChat->CreateChatChild ( szMsgBuff , COLOR_SYSTEM );
		}
	}

}
// End 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )


// 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)
/****************************************************************************
**
**	인피니티 - 방의 모든 맴버 래디 해제.
**
**	Create Info :	2010. 05. 31. by hsLee.
**
*****************************************************************************/
VOID CAtumApplication :: FieldSocketInfinityReadyCancelAllOK ( MSG_FC_INFINITY_READY_CANCEL_ALL_OK* pMsg )
{

	if ( NULL == pMsg )
		return;

	const MyInfinityRoomInfo *a_psInfinityMyRoomInfo = g_pD3dApp->GetInfinityManager()->GetMyRoomInfo();

	if ( a_psInfinityMyRoomInfo->InfinityCreateUID != pMsg->InfinityCreateUID )
		return;

	UINT ui = 0;

	for ( ui = 0; ui < g_pD3dApp->GetInfinityManager()->GetMemberCount(); ++ui )
	{

		INFINITY_MEMBER_INFO_LIST *pMemberInfo = g_pD3dApp->GetInfinityManager()->GetMemberInfoByIndex( ui );
			if ( NULL == pMemberInfo || pMemberInfo->ClientIdx == a_psInfinityMyRoomInfo->MasterIndex )
				continue;

		pMemberInfo->State = INFINITY_STATE_UNPREPARED;
	}

}
// End 2010. 05. 31 by hsLee 인피니티 필드 2차 난이도 조절. (오브젝트 몬스터 밸런스 적용 문제 수정.)


// 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.
VOID	CAtumApplication :: FieldSocketInfinityCinemaSkip ( MSG_FC_INFINITY_SKIP_ENDING_CINEMA_OK * pMsg )
{
	if ( NULL == pMsg || TRUE != pMsg->EnableSkip )
		return;

	g_pInterface->m_pInfinity->SkipEndingCinema( pMsg->szCharName , pMsg->NormalEnding == TRUE ? true : false );

	g_pInterface->m_pInfinity->UpdateTenderAllItemInfo_TenderStartTime ( pMsg->sUpdateTenderItemStartTime );

}
// End 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.


// 2010. 02. 11 by ckPark 발동류 장착아이템
VOID	CAtumApplication::FieldSocketInfoApplyDestParam( MSG_FC_INFO_APPLY_DESTPARAM* pMsg )
{
	// 나한테 적용 됬을 경우
	if( m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ApplyClientIdx )
	{
		CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ApplyItemUID );
		if( pItem )
		{
			char szTemp[ 256 ];
			sprintf( szTemp, STRMSG_C_100218_0308, pItem->ItemInfo->ItemName );	// "\\g[%s]이 발동 되었습니다.\\g"
			m_pChat->CreateChatChild( szTemp, COLOR_SYSTEM );

			if( g_pGameMain )
			{
				// 쿨타임 시작
				g_pGameMain->SetItemCoolStart( pMsg->ApplyItemUID );
			}
		}
	}

	// 이펙트
	CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ApplyClientIdx );
	if( pUnit )
	{
		CAppEffectData* pEff = new CAppEffectData( pUnit, pMsg->ApplyEffectIdx, D3DXVECTOR3(0.0f, 0.0f, 0.0f) );

		if( !pEff->m_bUsing )
		{
			SAFE_DELETE( pEff );
		}
		else
		{
			m_pEffectList->AddChild( pEff );
		}
	}
}

VOID	CAtumApplication::FieldSocketInfoApplyDestParamList( MSG_FC_INFO_APPLY_DESTPARAM_LIST* pMsg )
{
	if( m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ApplyClientIdx )
	{
		CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ApplyItemUID );

		if( pItem )
		{
			char szTemp[ 256 ];
			sprintf( szTemp, STRMSG_C_100218_0308, pItem->ItemInfo->ItemName );	// "\\g[%s]이 발동 되었습니다.\\g"
			m_pChat->CreateChatChild( szTemp, COLOR_SYSTEM );

			if( g_pGameMain )
			{
				// 쿨타임 시작
				g_pGameMain->SetItemCoolStart( pMsg->ApplyItemUID );
			}
		}
	}

	// 이펙트
	CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ApplyClientIdx );
	if( pUnit )
	{
		for( int i=0; i<pMsg->ApplyDestParamCnt; ++i )
		{
			APPLY_DESTPARAM_INFO* pDesParam = (APPLY_DESTPARAM_INFO*)(((char*)(pMsg))
											  + sizeof( MSG_FC_INFO_APPLY_DESTPARAM_LIST )
											  + sizeof( APPLY_DESTPARAM_INFO ) * i);

			if( pDesParam->ApplyEffectIdx )
			{
				// 해당 번호, 위치로 이펙트 추가
				CAppEffectData* pEff = new CAppEffectData( pUnit, pDesParam->ApplyEffectIdx, D3DXVECTOR3(0.0f, 0.0f, 0.0f) );

				if( !pEff->m_bUsing )
				{
					SAFE_DELETE( pEff );
				}
				else
				{
					m_pEffectList->AddChild( pEff );
				}
			}
		}
	}
}

VOID	CAtumApplication::FieldSocketItemEndCoolItemOK( MSG_FC_ITEM_END_COOLINGTIME_ITEM_OK* pMsg )
{
	// 쿨타임 종료
	if( g_pGameMain )
		g_pGameMain->SetItemCoolEnd( pMsg->ItemUID );
}

VOID	CAtumApplication::FieldSocketItemGetCoolTimeInfoOK( MSG_FC_ITEM_GET_COOLINGTIME_INFO_OK* pMsg )
{
	CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUID );
	if( pItemInfo )
	{
		// 쿨타임 시간 설정
		pItemInfo->SetCoolElapsedTime( pMsg->CoolingTimeStamp * 1000 );

		if( g_pGameMain )
		{
			if( pMsg->CoolingTimeStamp <= 0 )
				// 쿨타임이 0이하일 경우 쿨타임 리스트에서 삭제
				g_pGameMain->PopInvokeWearItem( pMsg->ItemUID );
			else
				// 쿨타임 계산 시간 재설정
				g_pGameMain->RefreshInvokeItemTickTime( pMsg->ItemUID );
		}
	}
}

VOID	CAtumApplication::FieldSocketItemUseInvokingWearItemBuff( MSG_FC_ITEM_USE_INVOKING_WEAR_ITEM_BUFF* pMsg )
{
	CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUID );
	if( pItem && g_pGameMain )
		g_pGameMain->m_pInfSkill->InsertItemBuff( pItem->ItemInfo, pMsg->ItemUID, pItem->ItemInfo->Time );
}
// end 2010. 02. 11 by ckPark 발동류 장착아이템

// 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)
VOID	CAtumApplication::FieldSocketInfinityChangeAliveForGameClearMonsterHP( MSG_FC_INFINITY_CHANGE_ALIVE_FOR_GAMECLEAR_MONSTERHP* pMsg )
{
	if( m_pInterface && m_pInterface->m_pInfinity )
	{
		KeyMonsterInfo* pKeyMon = m_pInterface->m_pInfinity->GetKeyMonsterInfo( pMsg->MonsterIdx );
		if( pKeyMon )
		{
			char szBuff[ 256 ];
			char* p = strrchr( pMsg->DeadCharactarName, '\\' );
			if( p )
				*p = '\0';
			
#if defined(LANGUAGE_JAPAN)
		sprintf( szBuff, STRMSG_C_100618_0405,	// "유저가 사망하여 %s의 HP가 %d만큼 감소 하였습니다."
			pKeyMon->m_pMonsterInfo->MonsterName,
			pKeyMon->m_nCurHP - (INT)(pMsg->CurrentHP) );
#else
		sprintf( szBuff, STRMSG_C_100310_0307,	// "%s님이 사망하여 %s의 HP가 %d만큼 감소 하였습니다."
			pMsg->DeadCharactarName,
			pKeyMon->m_pMonsterInfo->MonsterName,
			pKeyMon->m_nCurHP - (INT)(pMsg->CurrentHP) );
#endif			
			m_pChat->CreateChatChild( szBuff, COLOR_SYSTEM );
			
			// 키몬스터 체력 셋팅
			m_pInterface->m_pInfinity->SetKeyMonsterHP( pMsg->MonsterIdx, (INT)(pMsg->CurrentHP) );
		}
	}
}

VOID	CAtumApplication::FieldSocketMonsterCreatedAliveForGameClear( MSG_FC_MONSTER_CREATED_ALIVE_FOR_GAMECLEAR* pMsg )
{
	MEX_MONSTER_INFO* pMon = m_pDatabase->CheckMonsterInfo( pMsg->MonsterNum );
	if( pMon && m_pInterface && m_pInterface->m_pInfinity )
		// 2010. 06. 08 by hsLee 인피니티 필드 2차 난이도 조절. (아군 동일 밸런스 적용.) - 키 몬스터 등록시 MaxHP 대입 추가.
		m_pInterface->m_pInfinity->AddKeyMonster( pMon, pMsg->MonsterIdx, pMsg->CurrentHP , pMsg->MaxHP );
		/*m_pInterface->m_pInfinity->AddKeyMonster( pMon, pMsg->MonsterIdx, pMsg->CurrentHP );*/
}
// end 2010. 03. 15 by ckPark 인피니티 필드 2차(연출 처리)

// 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)
VOID	CAtumApplication::FieldSocketMonsterCancelSkill( MSG_FC_MONSTER_SKILL_CANCEL* pMsg )
{
	if( m_pScene )
	{
		CUnitData* pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->MonsterIndex );
		if( pUnit && pUnit->m_dwPartType == _MONSTER )
			((CMonsterData*)(pUnit))->RemoveMonsterBuffSkill( pMsg->SkillItemNum );
	}
}
// end 2010. 03. 18 by ckPark 인피니티 필드 2차(몬스터 스킬 추가)

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCharacterTutorialSkipOk(MSG_FC_CHARACTER_TUTORIAL_SKIP_OK* pMsg)
/// \brief		튜토리얼을 스킵할 경우 그에 대한 응답
/// \author		jschoi
/// \date		2005-04-21 ~ 2005-04-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterTutorialSkipOk(MSG_FC_CHARACTER_TUTORIAL_SKIP_OK* pMsg)
{
	m_bRequestEnable = TRUE;
	g_pShuttleChild->m_myShuttleInfo.MapChannelIndex = pMsg->mapChannelIdx;

	g_pInterface->InitMapLoadObjects();
	g_pInterface->RestoreMapLoadObjects();
	// 2007-12-26 by bhsohn 게임 시작에 관련 부분 수정
//	SAFE_DELETE(m_pMapInitThread );
//	m_pMapInitThread = new CMapInitThread();
//	m_pMapInitThread->CreateThread();
	ChangeGameState(_MAPLOAD);	
	
	{
		// IM Server  연결시도
		g_pD3dApp->ConnectLoginIMServer(g_pD3dApp->m_strUserID,
			((CShuttleChild *)(g_pD3dApp->m_pShuttleChild))->m_myShuttleInfo.CharacterName,
			g_pD3dApp->m_strUserPassword);											
	}
	// end 2007-12-26 by bhsohn 게임 시작에 관련 부분 수정
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketMoveHackShield_GuidReqMsg(MSG_FC_MOVE_HACKSHIELD_GuidReqMsg* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2008-04-04 by bhsohn 핵쉴드 방식 변경
//VOID CAtumApplication::FieldSocketMoveHackShield_GuidReqMsg(MSG_FC_MOVE_HACKSHIELD_GuidReqMsg* pMsg)
//{
//	MSG_FC_MOVE_HACKSHIELD_GuidAckMsg sMsg;
//	memset(&sMsg,0x00,sizeof(sMsg));
//
//	HS_MakeGuidAckMsg(pMsg->pbyGuidReqMsg, sMsg.pbyGuidAckMsg);
//
//	m_pFieldWinSocket->SendMsg(T_FC_MOVE_HACKSHIELD_GuidAckMsg, (char*)&sMsg, sizeof(sMsg));
//
//	// 다시 연결
//	MSG_FC_CHARACTER_GAMESTART sGameStartMsg;
//	memset(&sMsg,0x00,sizeof(sGameStartMsg));
//	char buffer[SIZE_MAX_PACKET];
//	sGameStartMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex;
//	sGameStartMsg.CharacterUniqueNumber = m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber;
//	int nType = T_FC_CHARACTER_GAMESTART;
//	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
//	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sGameStartMsg, sizeof(sGameStartMsg));
//	g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sGameStartMsg));
//	DBGOUT("MoveHackShield_GuidReqMsg : Ready, Send GameStart(T_FC_CHARACTER_GAMESTART, m_bMapLoad = TRUE; m_bLoginChat = IM_SERVER_STATE_READY_FOR_GAMESTART);\n");	
//}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketMoveHackShield_CRCReqMsg(MSG_FC_MOVE_HACKSHIELD_CRCReqMsg* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveHackShield_CRCReqMsg(MSG_FC_MOVE_HACKSHIELD_CRCReqMsg* pMsg)
{

	if (b_CanadaMutex) //2012-09-17 by jhahn	캐나다 핵쉴드 제거 버전
	{
		// 2008-04-04 by bhsohn 핵쉴드 방식 변경
		MSG_FC_MOVE_HACKSHIELD_CRCAckMsg sMsg;
		memset(&sMsg,0x00,sizeof(sMsg));
		
		//	HS_MakeCRCAckMsg(pMsg->pbyReqMsg, sMsg.pbyAckMsg);		
		int nRet = _AhnHS_MakeResponse(pMsg->stRequestBuf.byBuffer, pMsg->stRequestBuf.nLength, &sMsg.stResponseBuf);
		if(ERROR_SUCCESS != nRet)
		{
			char szMessage[256];
			//wsprintf(szMessage,STRMSG_C_060608_0000);//"서버가 종료되었습니다. 게임이 종료됩니다.  [%d]"
			wsprintf ( szMessage , "%s\n[%d]" , STRMSG_C_060608_0000 , nRet );
			
			NetworkErrorMsgBox(szMessage);
			return;
		}
		// end 2008-04-04 by bhsohn 핵쉴드 방식 변경
		
		m_pFieldWinSocket->SendMsg(T_FC_MOVE_HACKSHIELD_CRCAckMsg, (char*)&sMsg, sizeof(sMsg));

	
	}
	
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketError(MSG_ERROR* pMsg)
/// \brief		MSG_ERROR 처리
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketError(MSG_ERROR* pMsg)
{
	FLOG("CAtumApplication::FieldSocketError(MSG_ERROR* pMsg)");
	char errMsg[1024];
	memset(errMsg, 0x00, sizeof(errMsg));
	wsprintf(errMsg, "ERROR, FieldSocket, ErrCode : [%s]%#04x, ErrParam1:%d, ErrParam2:%d\n",
		GetErrorString(pMsg->ErrorCode), pMsg->ErrorCode, pMsg->ErrParam1, pMsg->ErrParam2);

	// 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정
	char* chErrorString = NULL;
	// end 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정

	if(pMsg->StringLength > 0)
	{
		memcpy(errMsg+strlen(errMsg), ((char*)pMsg) + sizeof(MSG_ERROR), pMsg->StringLength);

		// 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정
		chErrorString = (char*)malloc(pMsg->StringLength+1);
		memset(chErrorString, 0x00, pMsg->StringLength+1);
		strncpy(chErrorString, ((char*)pMsg) + sizeof(MSG_ERROR), pMsg->StringLength);
		// end 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정
	}

	DBGOUT(errMsg);
	DBGOUT("\n");

	CheckMultiLock(TRUE, pMsg->MsgType);

	// 2005-03-17 by jschoi
	// 1. 클라이언트에서의 렉 처리
	// 2006-07-28 by ispark, 수정
	switch(pMsg->MsgType)
	{
	case T_FC_SHOP_BUY_ITEM:
	case T_FC_SHOP_BUY_CASH_ITEM:
	case T_FC_STORE_MOVE_ITEM:
	case T_FC_SHOP_SELL_ITEM:			// 아이템 구입 관련 에러
	case T_FC_STORE_GET_ITEM:
	case T_FC_ITEM_USE_ENCHANT:
	case T_FC_ITEM_MIX_ITEMS:
	case T_FC_BAZAAR_SELL_PUT_ITEM:
	case T_FC_BAZAAR_SELL_CANCEL_ITEM:
	case T_FC_BAZAAR_BUY_PUT_ITEM:
	case T_FC_BAZAAR_BUY_CANCEL_ITEM:
	case T_FC_BAZAAR_SELL_START:
	case T_FC_BAZAAR_BUY_START:
	case T_FC_BAZAAR_SELL_BUY_ITEM:
	case T_FC_BAZAAR_BUY_SELL_ITEM:
	case T_FC_BAZAAR_SELL_REQUEST_ITEMLIST:
	case T_FC_BAZAAR_BUY_REQUEST_ITEMLIST:
	case T_FC_EVENT_CHARACTERMODE_ENTER_BUILDING:
	case T_FC_EVENT_ENTER_BUILDING:
	case T_FC_ITEM_USE_RANDOMBOX:
	case T_FC_STORE_LOG_GUILD_ITEM:
	case T_FC_CHARACTER_USE_BONUSSTAT:					// 2006-09-18 by ispark, 보너스 스탯 사용 동기화
	case T_FC_CHARACTER_GET_CASH_MONEY_COUNT:			// 2006-09-21 by ispark, 캐쉬 포인트 가져오기
	case T_FC_CHARACTER_CREATE:							// 2008-01-15 by dgwoo 에러 처리.
	case T_FC_CHARACTER_DELETE:
	case T_FC_SHOP_CHECK_GIVE_TARGET:
	case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST:
	case T_FC_EVENT_COUPON_EVENT_USE_COUPON:
		{
			m_bRequestEnable = TRUE;
			m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
			CityShopLock(FALSE);		// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정
		}
		break;
	}	
	// 2. 잘못된 스킬의 사용 처리	
	if(pMsg->MsgType == T_FC_SKILL_PREPARE_USE ||		// 2006-12-20 by ispark
		pMsg->MsgType == T_FC_SKILL_USE_SKILL)
	{
		if(g_pShuttleChild && g_pShuttleChild->m_pSkill)
		{
			g_pShuttleChild->m_pSkill->CancelSkill(pMsg->ErrParam1, FALSE);

			// 2007-07-09 by bhsohn 바자 상점과 상점 동시 오픈시에 대한 처리
			CancelBazzarSkill(pMsg->ErrParam1);			
			// end 2007-07-09 by bhsohn 바자 상점과 상점 동시 오픈시에 대한 처리
		}
	}

	// 3. 조합 및 인챈트 관련 에러 초기화
	if( pMsg->MsgType == T_FC_ITEM_USE_ENCHANT )
	{
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
		if(pCityLab)
		{
			pCityLab->InitData();
		}
	}
	else if( pMsg->MsgType == T_FC_ITEM_MIX_ITEMS )
	{
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
		if(pCityLab)
		{
			pCityLab->InitData();
		}
	}

	// 2013-09-26 by jekim, 계정 블락시 메세지 뿌려주기.
	if(ERR_PROTOCOL_ACCOUNT_BLOCKED == pMsg->ErrorCode)
	{
		g_pFieldWinSocket->CloseSocket();
		NetworkErrorMsgBox(chErrorString);
		free(chErrorString);
		return;
	}
	// end 2013-09-26 by jekim, 계정 블락시 메세지 뿌려주기.

	// 4. 워프 실패시 처리
	if(pMsg->MsgType == T_FC_EVENT_REQUEST_OBJECT_EVENT || pMsg->MsgType == T_FC_PARTY_REQUEST_PARTY_OBJECT_EVENT)
//		&& pMsg->ErrorCode == ERR_PROTOCOL_REQ_WARP_REQUIREMENTS_NOT_MATCHED)	// 2005-12-29 by ispark, 필요없는 관계로 지움
	{// 워프 실패 
		g_pShuttleChild->m_nCurrentPatternNumber = PATTERN_UNIT_WARP_OUT;
		g_pShuttleChild->DeletePattern();
		
		// 2007-10-19 by bhsohn 캐릭터 모드에서 워프 실패시에 대한 처리
		//g_pShuttleChild->m_dwState = _NORMAL;
		if(FALSE == IsMyShuttleCharacter())
		{
			g_pShuttleChild->m_dwState = _NORMAL;
		}
		// end 2007-10-19 by bhsohn 캐릭터 모드에서 워프 실패시에 대한 처리

		g_pShuttleChild->m_bOrderMove = FALSE;

		// 편대 비행중이라면 해제
		if(	g_pShuttleChild->m_pClientParty &&
			g_pShuttleChild->m_pClientParty->IsFormationFlightMove())
		{
			char message [256];
			g_pShuttleChild->SendPacket(T_IC_PARTY_CANCEL_FLIGHT_POSITION);
			g_pShuttleChild->m_pClientParty->FormationFlightClear();
//			m_infoParty.bFormationFlyingPositionType = 0;
//			m_bFormationFlight = FALSE; // 편대 비행을 켄슬하고 본인의 의지대로 비행한다.
			wsprintf(message,STRMSG_C_PARTY_0001);//"편대비행에서 벗어났습니다."
			g_pD3dApp->m_pChat->CreateChatChild(message,COLOR_SYSTEM);
		}
	}

	// 5. 롤링 실패시 처리
	if(pMsg->MsgType == T_FC_MOVE_ROLLING &&
		pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_ELAPSE_TIME)
	{
		// 롤링 초기화
		g_pShuttleChild->InitRolling();
	}

	// 6. 에러 프로토콜 출력
	char errStr[512];
#ifndef _DEBUG
	if(m_pShuttleChild && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
#endif
	{
		// 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정
		//wsprintf(errStr,"ERR:(%s),(%s)",GetProtocolTypeString(pMsg->MsgType),GetErrorString(pMsg->ErrorCode));
		if(chErrorString)
		{
			// 2007-10-23 by bhsohn 관리자 에러 코드 추가
			//wsprintf(errStr,"ERR:(%s),(%s) (%s)",GetProtocolTypeString(pMsg->MsgType),GetErrorString(pMsg->ErrorCode), chErrorString);
			wsprintf(errStr,"ERR:(%s),(%s) (%s) [%d][%d]",
					GetProtocolTypeString(pMsg->MsgType),
					GetErrorString(pMsg->ErrorCode), 
					chErrorString,
					pMsg->ErrParam1, pMsg->ErrParam2);

			
			free(chErrorString);
		}
		else
		{
			// 2007-10-23 by bhsohn 관리자 에러 코드 추가
			//wsprintf(errStr,"ERR:(%s),(%s)",GetProtocolTypeString(pMsg->MsgType),GetErrorString(pMsg->ErrorCode));
			wsprintf(errStr,"ERR:(%s),(%s) [%d][%d]",
					GetProtocolTypeString(pMsg->MsgType),
					GetErrorString(pMsg->ErrorCode),
					pMsg->ErrParam1, pMsg->ErrParam2);
		}		
		// end 2007-08-14 by bhsohn 에러 스트링 관리자가 볼수 있게끔 수정
		m_pChat->CreateChatChild(errStr,COLOR_SYSTEM);
	}
	// 2008-04-08 by dgwoo 아레나에서 부활아이템 사용시 도시로 귀환.
	if(pMsg->MsgType == T_FC_ITEM_USE_CARDITEM_RESTORE)
	{
		
		// 2007-10-23 by dgwoo 죽었을 경우에는 T_FC_ITEM_USE_CARDITEM_RESTORE 에러 발생시 SendDeadMsg()를 발생.
		if(g_pShuttleChild->CheckUnitState() == BREAKDOWN)
			g_pShuttleChild->SendDeadMsg();
	}

	// 2012-12-20 by bhsohn 아이템 이동시 락 걸리는 문제 해결
	if( T_FC_ITEM_CHANGE_WINDOW_POSITION == pMsg->MsgType )
	{
		g_pD3dApp->EnterLock(TRUE);		// FALSE :Lock  TRUE : UnLock				
	}
	// END 2012-12-20 by bhsohn 아이템 이동시 락 걸리는 문제 해결

// 2013-11-29 by ssjung 거래소 구현
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	switch(pMsg->MsgType)
	{
	case T_FC_MARKET_BASE_INFO_REQUEST:
	case T_FC_MARKET_SEARCH_REQUEST:
		{
			if( ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode){}	//잠시후에 다시 시도 하십시오 
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_SORT_REQUEST :
		{
			if( ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				//잠시후에 다시 시도 하십시오 
				CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
				CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
				pTradeBuyView->SortError(); 
			}
			else if(ERR_PROTOCOL_NO_SUCH_REQUEST_TYPE == pMsg->ErrorCode){}		//중복 정렬 요청 
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_PAGING_REQUEST :
		{
			if(ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
				CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
				pTradeBuyView->PaingError(); 
			}
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_SELL_REQUEST :
		{
			if( ERR_OVER_COUNT == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0001, _Q_MARKET_NORMAL_MESSAGE);		//"등록 가능한 물품 개수를 초과하였습니다."
			}
			// 2014-06-17 거래소 추가작업
			else if( ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131205_0050, _Q_MARKET_NORMAL_MESSAGE);		// "잠시 후 다시 시도 하세요. "
			}
			else if(ERR_REQ_CHOOSE_INFLUENCE_TYPE == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060613_0000, _Q_MARKET_NORMAL_MESSAGE);		// "세력 선택전까지는 거래를 할 수 없습니다."
			}
			// END 2014-06-17 거래소 추가작업
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_BUY_REQUEST :
		{
			if(ERR_PROTOCOL_NO_SUCH_SHOP_ITEM == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0002, _Q_MARKET_NORMAL_MESSAGE);		//"이미 판매된 상품입니다."
			}
			else if(ERR_PROTOCOL_NO_SUCH_ITEM_INFO == pMsg->ErrorCode || ERR_PROTOCOL_NOT_ENOUGH_MONEY == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0003, _Q_MARKET_NORMAL_MESSAGE);			//"금액이 부족하여 구매할 수 없습니다."
			}
			else if(ERR_PROTOCOL_MAX_ITEM_COUNTS_OVER == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0004, _Q_MARKET_NORMAL_MESSAGE);		//"최대수량이 초과되어 구매할 수 없습니다."
			}
			else if(ERR_PROTOCOL_INVENTORY_FULL_ITEM == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0005, _Q_MARKET_NORMAL_MESSAGE);			//"인벤토리가 초과되어 구매할 수 없습니다."
			}
			// 2014-06-17 거래소 추가작업
			else if( ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131205_0050, _Q_MARKET_NORMAL_MESSAGE);		// "잠시 후 다시 시도 하세요. "
			}
			else if(ERR_REQ_CHOOSE_INFLUENCE_TYPE == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060613_0000, _Q_MARKET_NORMAL_MESSAGE);		// "세력 선택전까지는 거래를 할 수 없습니다."
			}
			else if(ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_050825_0011, _Q_MARKET_NORMAL_MESSAGE);		// "세력이 맞지않습니다."
			}
			// END 2014-06-17 거래소 추가작업
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_GET_REQUEST :
		{
			if( ERR_PROTOCOL_MAX_ITEM_COUNTS_OVER == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0006, _Q_MARKET_NORMAL_MESSAGE);				//"최대수량이 초과되어 회수할 수 없습니다."
			}
			else if(ERR_PROTOCOL_INVENTORY_FULL_ITEM == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0007, _Q_MARKET_NORMAL_MESSAGE);				//"인벤토리가 초과되어 회수할 수 없습니다."
			}
			// 2014-06-17 거래소 추가작업
			else if( ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131205_0050, _Q_MARKET_NORMAL_MESSAGE);		// "잠시 후 다시 시도 하세요. "
			}
			// END 2014-06-17 거래소 추가작업
			else if(ERR_PROTOCOL_STATUS_INFORMATION_NOT_CORRECT == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131217_0009, _Q_MARKET_NORMAL_MESSAGE);		// "거래소 목록 리스트를 갱신하여 주십시오."
			}
			// 2014-07-25 by ymjoo 거래소 SPI회수시 20억이 넘었을 때 SPI가 소멸하는 현상 수정
			else if(ERR_PROTOCOL_NOTIFY_MAX_ITEM_COUNTS_OVER == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060802_0005, _Q_MARKET_NORMAL_MESSAGE);		// "SPI의 최대유효개수를 초과하였습니다.(최대유효개수 20억)"
			}
			// END 2014-07-25 by ymjoo 거래소 SPI회수시 20억이 넘었을 때 SPI가 소멸하는 현상 수정
			TradeItemCenterLockFree();
		}
		break;
	case T_FC_MARKET_MY_LIST_REQUEST : 
		{
			// 2014-06-17 거래소 추가작업
			if(ERR_INTERVAL_SYSTEM_SECOND == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_131205_0050, _Q_MARKET_NORMAL_MESSAGE);		// "잠시 후 다시 시도 하세요. "
			}
			// END 2014-06-17 거래소 추가작업
			TradeItemCenterLockFree();
		}
		break;
	}
#endif
// end 2013-11-29 by ssjung 거래소 구현

// 2014-01-15 by ssjung 파괴 경매장 구현
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	switch(pMsg->MsgType)
	{
	case T_FC_DESTROY_AUCTION_BASE_INFO_REQUEST :
		{
			if( ERR_COUNTDOWN_NOT_ENOUGH_TIME == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0011, _Q_MARKET_NORMAL_MESSAGE);//"진행중인 경매가 없습니다. "
				CMapCityShopList::iterator it = g_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_DESTROY_AUCTION );
				if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() )
				{
					((CINFReturnAuctionCenter*)(it->second))->m_DAuctionEndTime = GetServerDateTime();
					((CINFReturnAuctionCenter*)(it->second))->VecItemInfoClear();
				}
			}
		}
		break;
	case T_FC_DESTROY_AUCTION_TENDER_REQUEST:
		{
			if( ERR_COUNTDOWN_NOT_ENOUGH_TIME == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0011, _Q_MARKET_NORMAL_MESSAGE);  //"진행중인 경매가 없습니다. "
			}
			else if(ERR_PROTOCOL_NO_SUCH_ITEM_INFO == pMsg->ErrorCode || ERR_PROTOCOL_NOT_ENOUGH_MONEY == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0012, _Q_MARKET_NORMAL_MESSAGE);//"금액이 부족하여 입찰 할 수 없습니다. "
			}
			else if(ERR_CANNOT_BUY_ITEM == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0013, _Q_MARKET_NORMAL_MESSAGE);//"남은 입찰 횟수가 없어 경매에 참여할 수 없습니다. "
			}
			// 2014-06-12 by ymjoo 파괴 경매장 추가작업
			else if(ERR_PROTOCOL_TRADE_ERROR == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140612_0003, _Q_MARKET_NORMAL_MESSAGE);	// "정보가 갱신되지 않았습니다. 새로고침 버튼을 눌러주세요."
			}
			// END 2014-06-12 by ymjoo 파괴 경매장 추가작업
		}
		break;
	case T_FC_DESTROY_AUCTION_GET_REQUEST :
		{
			if( ERR_PROTOCOL_TIME_LIMIT_ERROR == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0014, _Q_MARKET_NORMAL_MESSAGE);//"회수 기간이 경과하여 회수 할 수 없습니다. "
			}
			else if(ERR_PROTOCOL_NO_SUCH_ITEM_INFO == pMsg->ErrorCode || ERR_PROTOCOL_NOT_ENOUGH_MONEY == pMsg->ErrorCode)
			{
				g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_140121_0015, _Q_MARKET_NORMAL_MESSAGE);//"인벤토리의 금액이 부족하여 물품을 회수 할 수 없습니다. "
			}
		}
		break;
	}
#endif
 // end 2014-01-15 by ssjung 파괴 경매장 구현

// 2014-06-10 by ymjoo 세력 변경 아이템
	switch(pMsg->MsgType)
	{
	case T_FC_ITEM_USE_CARDITEM_CHANGE_INFLUENCE :
		{
			if(ERR_PROTOCOL_GUILD_MEMBER_ALREADY_EXISTS == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0002, COLOR_SYSTEM);	// "여단에 소속되어 있는 유저는 사용할 수 없습니다."
			}
			else if(ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0003, COLOR_SYSTEM);	// "열세 세력 유저는 사용이 불가능합니다."
			}
			else if(ERR_PROTOCOL_REQ_INFLUENCE_BALANCED == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0004, COLOR_SYSTEM);	// "세력 간 균형이 치우치지 않아 사용이 불가능합니다."
			}
			else if(ERR_PROTOCOL_REQ_NOT_CITY_MAP_CHANNEL == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0005, COLOR_SYSTEM);	// "도시 외부에서는 사용이 불가능합니다."
			}
			else if(ERR_CANNOT_CHOOSE_INFLUENCE_TYPE == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0006, COLOR_SYSTEM);	// "다음 세력 포인트 초기화 전까지 세력을 변경할 수 없습니다."
			}
			else if(ERR_PROTOCOL_REQ_ACCOUNT_REQUIREMENTS_NOT_MATCHED == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0007, COLOR_SYSTEM);	// "계정 내에 사용 조건을 만족하지 못한 기어가 존재합니다."
			}
			else if(ERR_PROTOCOL_CHARACTER_MODE_NOT_MATCHED == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_071121_0100, COLOR_SYSTEM);	// "해당 아이템은 캐릭터 상태에서만 사용할 수 있습니다."
			}
			else if(ERR_INFINITY_CANNOT_USE_ITEM == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_100618_0406, COLOR_SYSTEM);	// "해당 아이템은 인피니티 필드내에서 사용이 불가능 합니다."
			}
			else if(ERR_INVALID_CHARACTER == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_091015_0401, COLOR_SYSTEM);	// "캐릭터 정보가 유효하지 않습니다."
			}
			else if(ERR_DB_INVALID_PARAMETER == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_091015_0401, COLOR_SYSTEM);	// "캐릭터 정보가 유효하지 않습니다."
			}
			else if(ERR_ITEM_TRADING == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0008, COLOR_SYSTEM);	// "거래중입니다."
			}
			else if(ERR_PROTOCOL_NO_SUCH_ITEM == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRERR_ERROR_0025, COLOR_SYSTEM);		// "해당 아이템이 없습니다."
			}
			else if(ERR_PROTOCOL_ITEM_KIND_NOT_MATCHED == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRERR_ERROR_0062, COLOR_SYSTEM);		// "아이템 사용 관련 오류입니다."
			}
			else if(ERR_PROTOCOL_NO_SUCH_DES_PARAM == pMsg->ErrorCode)
			{
 				m_pChat->CreateChatChild(STRERR_ERROR_0035, COLOR_ERROR);		// "사용 할 수 없는 아이템 입니다."
				m_pChat->CreateChatChild(STRERR_ERROR_0036, COLOR_ERROR);		// "고객 센터로 문의 바랍니다."
			}
			else if(ERR_REQ_CHOOSE_INFLUENCE_TYPE == pMsg->ErrorCode)
			{
				m_pChat->CreateChatChild(STRMSG_C_140610_0009, COLOR_SYSTEM);	// "일반 세력은 사용할 수 없습니다."
			}
		}
	}
// END 2014-06-10 by ymjoo 세력 변경 아이템

	// 7. 메시지 타입에 관계없는 일반적인 예외처리
	if(FieldSocketErrorByErrorCode(pMsg))
	{
		if(pMsg->CloseConnection)
		{
			g_pFieldWinSocket->CloseSocket();

			char message[256];
				wsprintf(message,STRERR_ERROR_0001,pMsg->ErrorCode);//"서버와 접속을 종료 합니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(FC) 에서 종료"
			
			/*
			if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{
				wsprintf(message,STRERR_ERROR_0001,pMsg->ErrorCode);//"서버와 접속을 종료 합니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(FC) 에서 종료"
			}
			else
			{
				wsprintf(message,STRMSG_C_060608_0000);//"서버가 종료되었습니다. 게임이 종료됩니다.  [%d]"
			}
			*/
			NetworkErrorMsgBox(message);
		}
		return;
	}

	// 8. 메시지 타입별로 에러메시지 처리
	FieldSocketErrorByMsgType(pMsg);

	if(pMsg->CloseConnection)
	{
		g_pFieldWinSocket->CloseSocket();

		char message[256];
		// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
		if (m_bMsgHackError)
		{
			wsprintf(message,"%s",m_strMsgHackError);
		}
		else
		{
			wsprintf(message,STRERR_ERROR_0002,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(FC) 에서 종료"
		}
#else
		wsprintf(message,STRERR_ERROR_0002,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(FC) 에서 종료"
#endif
		// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력

		/*
		if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
		{
			wsprintf(message,STRERR_ERROR_0002,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(FC) 에서 종료"
		}
		else
		{
			wsprintf(message,STRMSG_C_060608_0000);//"서버가 종료되었습니다. 게임이 종료됩니다.  [%d]"
		}
		*/
		NetworkErrorMsgBox(message);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::CancelBazzarSkill()
/// \brief		패킷이 정의되지 않은 프로토콜로 옴
/// \author		// 2007-07-09 by bhsohn 바자 상점과 상점 동시 오픈시에 대한 처리
/// \date		2007-07-09 ~ 2007-07-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CancelBazzarSkill(int nSkillItemNum)
{
	ITEM* pItem = g_pDatabase->GetServerItemInfo(nSkillItemNum);			
	if(pItem && IS_BAZAAR_SKILL(pItem))
	{
		char strMessage[256];
		char* strSkillName;
		strSkillName = g_pShuttleChild->m_pSkill->GetSkillName(nSkillItemNum);
		if(strSkillName)
		{
			wsprintf(strMessage,STRMSG_C_SKILL_0003,strSkillName);//"스킬 [%s] 을 해제합니다."
			g_pD3dApp->m_pChat->CreateChatChild(strMessage, COLOR_SKILL_CANCEL,CHAT_TAB_SYSTEM);		
		}		
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketInvalidPacket(char* pPacket)
/// \brief		패킷이 정의되지 않은 프로토콜로 옴
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInvalidPacket(char* pPacket)
{
	FLOG("CAtumApplication::FieldSocketInvalidPacket(char* pPacket)");
	char * p = pPacket;
	MessageType_t	nType = 0;
	memcpy(&nType,p,sizeof(MessageType_t));
	char message[256];
	g_pFieldWinSocket->CloseSocket();
#ifdef _DEBUG
		wsprintf(message,STRMSG_C_SERVER_0013,nType,GetProtocolTypeString(nType));
#else
	wsprintf(message,STRMSG_C_SERVER_0013,nType,"FUnknown");//"존재하지 않은 메세지 타입 클라이언트를 종료"
#endif
	
	// 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
	// 전에 패킷
	char chTmp[128];
	wsprintf(chTmp, "PreType[%04x]:%s", m_nPreComType, GetProtocolTypeString(m_nPreComType));
	if((strlen(message)+strlen(chTmp)) < 256)
	{
		strcat(message, chTmp);
	}
	// end 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
	
	NetworkErrorMsgBox(message);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketMoveRolling(MSG_FC_MOVE_ROLLING_OK *pMsg)
/// \brief		롤링 메세지
/// \author		ispark
/// \date		2005-07-07 ~ 2005-07-07
/// \warning	
///
/// \param		
/// \return		VOID
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveRolling(MSG_FC_MOVE_ROLLING_OK *pMsg)
{
	if(m_pShuttleChild == NULL)
	{
		return;
	}
	if(pMsg->ClientIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		// 소켓 메세지가 자기 자신이면
		g_pShuttleChild->CheckRoll(pMsg->byLeftDirectionFlag);
	}
	else
	{
		// 적기 롤링 메세지
		CEnemyData *pEnemy = NULL;
		CMapEnemyIterator itEnemy = g_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
		if(itEnemy == g_pScene->m_mapEnemyList.end())
			return;

		pEnemy = itEnemy->second;		// 2005-07-07 by ispark
		pEnemy->CheckRoll(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::OnRecvIMSocketMessage(DWORD wParam)
/// \brief		
/// \author		dhkwon
/// \date		2004-03-18 ~ 2004-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::OnRecvIMSocketMessage(DWORD wParam, UINT nSocketNotifyType)
{
	FLOG("CAtumApplication::OnRecvIMSocketMessage(DWORD wParam)");

	// 2007-11-22 by bhsohn 아레나 통합서버
	CIMSocket* pIMSocket = GetIMWinSocket(nSocketNotifyType);
	if(NULL == pIMSocket)
	{
		// 소켓에러다
		return 0;
	}
	// end 2007-11-22 by bhsohn 아레나 통합서버

	
	switch(LOWORD(wParam))
	{
	case CIMSocket::WS_ERROR:
		{
		}
		break;
	case CIMSocket::WS_CONNECTED:
		{
			if(WM_IM_NOTIFY == nSocketNotifyType )
			{
				if(HIWORD(wParam) == FALSE)
				{
					NetworkErrorMsgBox(STRMSG_C_SERVER_0015);//"IM서버에 접속 실패 게임이 종료됩니다."
				}
			}			
			// 2007-11-22 by bhsohn 아레나 통합서버
			// 아레나 IM서버에 연결 성공
			else if(WM_IM_ARENA_NOTIFY == nSocketNotifyType )
			{
				EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock

				if(HIWORD(wParam) == FALSE)
				{
					char szNotice[1024];
					memset(szNotice,0x00,1024);		
					sprintf(szNotice, STRMSG_C_080129_0201);		//"아레나 서버와의 접속이 실패하였습니다."
					m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);

					// 에러 발생 소켓을 끊는다.
					CloseArenaSocket();
				}
				else
				{
					// 아레나 IM서버에 연결성공 
					SendArenaIMLogin();
				}			
			}

		}
		break;
	case CIMSocket::WS_CLOSED:
		{
			DBGOUT("CIMSocket::WS_CLOSED: bArena[%d] \n", WM_IM_ARENA_NOTIFY == nSocketNotifyType);
		}
		break;
	case CIMSocket::WS_RECEIVED:
		{
		char * pPacket = NULL;
		int len;
		MessageType_t nType = 0;
		// 2007-11-22 by bhsohn 아레나 통합서버
		//m_pIMSocket->Read(&pPacket,len);
		pIMSocket->Read(&pPacket,len);

		if(pPacket)
		{
			nType = 0;
			memcpy(&nType, pPacket,SIZE_FIELD_TYPE_HEADER);

			g_cCustomOptimizer.ViewDebugString(nType, CCustomOptimizer::E_IM_SERVER_TO_CLIENT);

#ifdef _DEBUG
			PrintExchangeMsg(RECV_TYPE, nType, NULL, ST_FIELD_SERVER);
//			PrintExchangeMsg(RECV_TYPE, nType, NULL, ST_INVALID_TYPE, PRINTLEVEL_ALL);//,ST_FIELD_SERVER);
#endif
			// 2007-11-22 by bhsohn 아레나 통합서버
			// 다중 락 체크 
			CheckMultiLock(FALSE, nType);
			// end 2007-11-22 by bhsohn 아레나 통합서버
			
			switch(nType)
			{
			case T_IC_CONNECT_LOGIN_OK://로그인 결과
				{
					// 2007-11-22 by bhsohn 아레나 통합서버
					// IMSocketConnectLoginOk();					
					
					if(WM_IM_NOTIFY == nSocketNotifyType )
					{
						IMSocketConnectLoginOk();
					}
					else if(WM_IM_ARENA_NOTIFY == nSocketNotifyType)
					{		
						// Arena필드서버에 IM서버와의 접속이 완료 되었음을 알려준다.
						ArenaIMSocketConnectLoginOk();						
					}					
				}
				break;
			case T_IC_CHAT_PTOP: // 1:1 채팅을 받은 경우
				{
					IMSocketChatPtoP((MSG_IC_CHAT_PTOP*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_PARTY:
				{
					IMSocketChatParty((MSG_IC_CHAT_PARTY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_GUILD:
				{
					IMSocketChatGuild((MSG_IC_CHAT_GUILD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_SELL_ALL:
				{
					IMSocketChatSellAll((MSG_IC_CHAT_SELL_ALL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_CASH_ALL:
				{
					IMSocketChatCashAll((MSG_IC_CHAT_CASH_ALL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_ALL:
				{
					IMSocketChatAll(pPacket);
				}
				break;
			case T_IC_CHAT_WAR:
				{
					IMSocketChatWar((MSG_IC_CHAT_WAR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_CHATROOM:
				{
					IMSocketChatChatRoom((MSG_IC_CHAT_CHATROOM*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_GET_GUILD_OK:// 길드원 정보 요청 결과
				{
					// 2007-11-22 by bhsohn 아레나 통합서버
					//IMSocketChatGetGuildOk((MSG_IC_CHAT_GET_GUILD_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					IMSocketChatGetGuildOk((MSG_IC_CHAT_GET_GUILD_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER), nSocketNotifyType);
				}
				break;
			case T_IC_CHAT_CHANGE_GUILD://길드원 정보 바뀜
				{
					// 2007-11-22 by bhsohn 아레나 통합서버
					//IMSocketChatChangeGuild((MSG_IC_CHAT_CHANGE_GUILD*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					IMSocketChatChangeGuild((MSG_IC_CHAT_CHANGE_GUILD*)(pPacket+SIZE_FIELD_TYPE_HEADER), nSocketNotifyType);
				}
				break;
/*				case T_IC_CHAT_GET_PARTY_OK:// 편대원 정보 요청 결과
				{
					m_pIMSocket->OnRecvdGetPartyOK((MSG_IC_CHAT_GET_PARTY_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
*/				case T_IC_CHAT_CHANGE_PARTY:// 편대원 정보 바뀜
				{
					// 2007-11-22 by bhsohn 아레나 통합서버
					//IMSocketChatChangeParty((MSG_IC_CHAT_CHANGE_PARTY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
					IMSocketChatChangeParty((MSG_IC_CHAT_CHANGE_PARTY*)(pPacket+SIZE_FIELD_TYPE_HEADER), nSocketNotifyType);
				}
				break;
			case T_IC_CHAT_FRIENDLIST_LOADING_OK:// 친구리스트 받기
				{
					IMSocketChatFriendlistAll((MSG_IC_CHAT_FRIENDLIST_LOADING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_FRIENDLIST_INSERT_OK:// 친구리스트 추가 성공
				{
					IMSocketChatFriendlistInsertOk((MSG_IC_CHAT_FRIENDLIST_INSERT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_REJECTLIST_LOADING_OK:// 거부리스트 받기
				{
					IMSocketChatRejectlistAll((MSG_IC_CHAT_REJECTLIST_LOADING_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_REJECTLIST_INSERT_OK:// 거부리스트 추가 성공 
				{
					IMSocketChatRejectlistInsertOk((MSG_IC_CHAT_REJECTLIST_INSERT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_FRIENDLIST_REFRESH_OK:// Refresh 
				{
					IMSocketChatFriendlistRefreshOk((MSG_IC_CHAT_FRIENDLIST_REFRESH_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_FRIENDLIST_DELETE_OK:// DeletelistOK
				{
					IMSocketChatFriendlistDeleteOk((MSG_IC_CHAT_FRIENDLIST_DELETE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_REJECTLIST_DELETE_OK:// RejectDeletelistOK
				{
					IMSocketChatRejectlistDeleteOk((MSG_IC_CHAT_REJECTLIST_DELETE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;			
			case T_IC_PARTY_ACCEPT_INVITE_OK:
				{
					IMSocketPartyAcceptInviteOk((MSG_IC_PARTY_ACCEPT_INVITE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_PUT_MEMBER:
				{
					IMSocketPartyPutMember((MSG_IC_PARTY_PUT_MEMBER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_LEAVE_OK:
				{
					IMSocketPartyLeaveOk((MSG_IC_PARTY_LEAVE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_BAN_MEMBER_OK:
				{
					IMSocketPartyBanMemberOk((MSG_IC_PARTY_BAN_MEMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_DISMEMBER_OK:
				{
					IMSocketPartyDismemberOk((MSG_IC_PARTY_DISMEMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_TRANSFER_MASTER_OK:
				{
					IMSocketPartyTransferMasterOk((MSG_IC_PARTY_TRANSFER_MASTER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_PUT_ALL_MEMBER:
				{
					IMSocketPartyPutAllMember((MSG_IC_PARTY_PUT_ALL_MEMBER*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_CHANGE_FLIGHT_FORMATION_OK:
				{
					IMSocketPartyChangeFlightFormationOk((MSG_IC_PARTY_CHANGE_FLIGHT_FORMATION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_GET_FLIGHT_POSITION:
				{
					IMSocketPartyGetFlightPosition((MSG_IC_PARTY_GET_FLIGHT_POSITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_CHANGE_FLIGHT_POSITION:
				{
					IMSocketPartyChangeFlightPosition((MSG_IC_PARTY_CHANGE_FLIGHT_POSITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_CANCEL_FLIGHT_POSITION:
				{
					IMSocketPartyCancelFlightPosition((MSG_IC_PARTY_CANCEL_FLIGHT_POSITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;

			case T_IC_PARTY_ALL_FLIGHT_POSITION:
				{
					IMSocketPartyAllFlightPosition((MSG_IC_PARTY_ALL_FLIGHT_POSITION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;

			case T_IC_PARTY_PUT_LAST_PARTY_INFO:
				{
					IMSocketPartyPutLastPartyInfo((MSG_IC_PARTY_PUT_LAST_PARTY_INFO*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_UPDATE_MEMBER_INFO_MAPNAME:
				{
					IMSocketPartyUpdateMemberInfoMapName((MSG_IC_PARTY_UPDATE_MEMBER_INFO_MAPNAME*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_MEMBER_INVALIDATED:
				{
					IMSocketPartyMemberInvalidated((MSG_IC_PARTY_MEMBER_INVALIDATED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_MEMBER_REJOINED:
				{
					IMSocketPartyMemberRejoined((MSG_IC_PARTY_MEMBER_REJOINED*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_UPDATE_ITEM_POS:
				{
					IMSocketPartyUpdateItemPos((MSG_IC_PARTY_UPDATE_ITEM_POS*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
			case T_IC_PARTY_GET_AUTO_PARTY_INFO_OK:
				{
					IMSocketPartyGetAutoInfoOK( (MSG_IC_PARTY_GET_AUTO_PARTY_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER) );
				}
				break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
			case T_IC_GUILD_CREATE_OK:
				{
					IMSocketGuildCreateOk((MSG_IC_GUILD_CREATE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_GUILD_INFO_OK:
				{
					IMSocketGuildGetGuildInfoOk((MSG_IC_GUILD_GET_GUILD_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_REQUEST_INVITE_QUESTION:
				{
					IMSocketGuildRequestInviteQuestion((MSG_IC_GUILD_REQUEST_INVITE_QUESTION*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_ACCEPT_INVITE_OK:
				{
					IMSocketGuildAcceptInviteOk((MSG_IC_GUILD_ACCEPT_INVITE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_REJECT_INVITE_OK:
				{
					IMSocketGuildRejectInviteOk((MSG_IC_GUILD_REJECT_INVITE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_BAN_MEMBER_OK:
				{
					IMSocketGuildBanMemberOk((MSG_IC_GUILD_BAN_MEMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_LEAVE_OK:
				{
					IMSocketGuildLeaveOk((MSG_IC_GUILD_LEAVE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_DISMEMBER_OK:
				{
					IMSocketGuildDismemberOk((MSG_IC_GUILD_DISMEMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_CANCEL_DISMEMBER_OK:
				{
					IMSocketGuildCancelDismemberOk((MSG_IC_GUILD_CANCEL_DISMEMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_DISMEMBER_DATE_OK:
				{
					IMSocketGuildGetDismemberDateOk((MSG_IC_GUILD_GET_DISMEMBER_DATE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_CHANGE_GUILD_NAME_OK:
				{
					IMSocketGuildChangeGuildNameOk((MSG_IC_GUILD_CHANGE_GUILD_NAME_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_SET_GUILD_MARK_OK:
				{
					IMSocketGuildSetGuildMarkOk((MSG_IC_GUILD_SET_GUILD_MARK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_GUILD_MARK_OK:
				{
					IMSocketGuildGetGuildMarkOk((MSG_IC_GUILD_GET_GUILD_MARK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_SET_RANK_OK:
				{
					IMSocketGuildSetRankOk((MSG_IC_GUILD_SET_RANK_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_SET_MEMBER_STATE:
				{
					IMSocketGuildSetMemberState((MSG_IC_GUILD_SET_MEMBER_STATE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_CHANGE_GUILD_STATE:
				{
					IMSocketGuildChangeGuildState((MSG_IC_GUILD_CHANGE_GUILD_STATE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_LOADING_GUILD_DONE:
				{
					IMSocketGuildLoadingGuildDone((MSG_IC_GUILD_LOADING_GUILD_DONE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_OTHER_GUILD_INFO_OK:
				{
					IMSocketGuildGetOtherGuildInfoOk((MSG_IC_GUILD_GET_OTHER_GUILD_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_WAR_READY:
				{
					IMSocketGuildWarReady((MSG_IC_GUILD_WAR_READY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_START_WAR:
				{
					IMSocketGuildStartWar((MSG_IC_GUILD_START_WAR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_END_WAR:
				{
					IMSocketGuildEndWar((MSG_IC_GUILD_END_WAR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_ADMIN_GET_SERVER_STAT_OK:
				{
					IMSocketAdminGetServerStatOk((MSG_IC_ADMIN_GET_SERVER_STAT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CONNECT_CLOSE:
				{
					IMSocketConnectClose((MSG_IC_CONNECT_CLOSE*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_STRING_128:
				{
					IMSocketString128((MSG_IC_STRING_128*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_STRING_256:
				{
					IMSocketString256((MSG_IC_STRING_256*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_STRING_512:
				{
					IMSocketString512((MSG_IC_STRING_512*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_GET_ACCOUNTUNIQUENUMBER_OK:
				{
					IMSocketVoipGetAccountUniquenumberOk((MSG_IC_VOIP_GET_ACCOUNTUNIQUENUMBER_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_1to1_DIAL:
				{
					IMSocketVoip1to1Dial((MSG_IC_VOIP_1to1_DIAL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_1to1_DIAL_OK:
				{
					IMSocketVoip1to1DialOk((MSG_IC_VOIP_1to1_DIAL_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_ERROR:
				{
					IMSocketVoipError((MSG_IC_VOIP_ERROR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_1to1_END:
				{
					IMSocketVoip1to1End((MSG_IC_VOIP_1to1_END*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_NtoN_CREATEROOM_REQUEST_OK:
				{
					IMSocketVoipNtoNCreateRoomRequestOk((MSG_IC_VOIP_NtoN_CREATEROOM_REQUEST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_NtoN_INVITE_YOU:
				{
					IMSocketVoipNtoNInviteYou((MSG_IC_VOIP_NtoN_INVITE_YOU*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_VOIP_NtoN_GOOUT_ALL:
				{
					IMSocketVoipNtoNGooutAll((MSG_IC_VOIP_NtoN_GOOUT_ALL*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_COUNTDOWN_START:
				{
					IMSocketCountdownStart((MSG_IC_COUNTDOWN_START*)(pPacket+SIZE_FIELD_TYPE_HEADER));					
				}
				break;
			case T_IC_GUILD_CHANGE_MEMBER_CAPACITY:
				{
					IMSocketItemUseCarditemGuildChangeMemberCapacity((MSG_IC_GUILD_CHANGE_MEMBER_CAPACITY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_GUILD_MEMBER_LIST_OK:
				{
					IMSocketGuildGetGuildMemberListOk((MSG_IC_GUILD_GET_GUILD_MEMBER_LIST_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHAT_INFLUENCE_ALL:
				{
					IMSocketChatInfluenceAll(pPacket);
				}
				break;
			case T_IC_ADMIN_CALLGM_INFO_OK:
				{
					IMSocketAdminCallGMInfoOk((MSG_IC_ADMIN_CALLGM_INFO_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_ADMIN_CALLGM_VIEW_OK:
				{
					IMSocketAdminCallGMViewOk(pPacket);
				}
				break;
			case T_IC_ADMIN_CALLGM_BRING_OK:
				{
					IMSocketAdminCallGMBringOk(pPacket);
				}
				break;
			case T_IC_GUILD_END_WAR_ADMIN_NOTIFY:
				{
					IMSocketGuildEndWarAdminNotify((MSG_IC_GUILD_END_WAR_ADMIN_NOTIFY*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
			case T_IC_CONNECT_FM_TO_IM_OK:
				{
					IMSocketConnectFmToImOk();
				}
				break;
				// end 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
				// 2008-06-03 by bhsohn EP3 여단 관련 처리
			case T_IC_GUILD_NOTICE_WRITE_OK:	// 여단 공지 사항 등록
				{				
					IMSocketNoticeWriteOk((MSG_IC_GUILD_NOTICE_WRITE_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 지원자 관리
			case T_IC_GUILD_GET_APPLICANT_OK_HEADER:
				{
					IMSocketGetApplicantOkHeader();
				}
				break;
			case T_IC_GUILD_GET_APPLICANT_OK:
				{
					IMSocketGetApplicantOk((MSG_IC_GUILD_GET_APPLICANT_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_GET_APPLICANT_OK_DONE:
				{
					IMSocketGetApplicantOKDone();
				}
				break;
				// 여단 소개를 얻어옴
			case T_IC_GUILD_GET_INTRODUCTION_OK:
				{
					IMSocketGetIntroducitonOk((MSG_IC_GUILD_GET_INTRODUCTION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 여단 소개를 업데이트
			case T_IC_GUILD_UPDATE_INTRODUCTION_OK:
				{
					IMSocketGuildUpdateIntroductionOk();
				}
				break;
				// 여단 소개취소
			case T_IC_GUILD_DELETE_INTRODUCTION_OK:
				{
					IMSocketGuildDelIntroductionOk();
				}
				break;
				// 선택한 지원자 소개서를 가져온다.
			case T_IC_GUILD_GET_SELF_INTRODUCTION_OK:
				{
					IMSocketGetSelfIntroductionOK((MSG_IC_GUILD_GET_SELF_INTRODUCTION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 여단 리스트 검색
			case T_IC_GUILD_SEARCH_INTRODUCTION_OK_HEADER:
				{

				}
				break;				
			case T_IC_GUILD_SEARCH_INTRODUCTION_OK:
				{
					IMSocketGuildSearchIntroOk((MSG_IC_GUILD_SEARCH_INTRODUCTION_OK*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_SEARCH_INTRODUCTION_OK_DONE:
				{
					IMSocketGuildSearchIntroDone();
				}
				break;
				// 자기 소개 업데이트 			
			case T_IC_GUILD_UPDATE_SELFINTRODUCTION_OK:
				{
					IMSocketUpdateSelfIntroOk();
				}
				break;		
				// 자기 소개 취소
			case T_IC_GUILD_DELETE_SELFINTRODUCTION_OK:
				{
					IMSocketDelSelfIntroOk();
				}
				break;
				// end 2008-05-29 by bhsohn EP3 여단 관련 처리
				// 2008-06-03 by bhsohn EP3 편대 관련 처리
			case T_IC_PARTY_LIST_INFO_OK:	// 리스트 요청
				{
					IMSocketPartyListInfoOk((MSG_IC_PARTY_LIST_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_CHANGE_INFO_OK:				// 파티 정보 변경
				{
					IMSocketPartyChangeInfoOk();
				}
				break;
			case T_IC_PARTY_RECOMMENDATION_MEMBER_OK:	// 추천 인원
				{
					IMSocketPartyReCommandMemberOk((MSG_IC_PARTY_RECOMMENDATION_MEMBER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_PARTY_JOIN_FREE_OK:				// 자유 참가
				{
				}
				break;
			case T_IC_PARTY_INFO:						// 편대 설정 정보
				{
					IMSocketPartyInfo((MSG_IC_PARTY_INFO*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_GUILD_APPLICANT_INVITE_OK :
				{

				}
				break;
			case T_IC_GUILD_APPLICANT_REJECT_INVITE_OK:
				{

				}
				break;
			case T_IC_GUILD_MEMBER_LEVEL_UP:
				{
					// 길드원 레벨변경 
					IMSocketGuildMemerLevelUp((MSG_IC_GUILD_MEMBER_LEVEL_UP*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// end 2008-06-03 by bhsohn EP3 편대 관련 처리
				// 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
			case T_IC_GUILD_CHANGE_MEMBERSHIP:
				{
					// 여단 관련 정보 변경
					IMSocketGuildChangeMemberShip((MSG_IC_GUILD_CHANGE_MEMBERSHIP*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// end 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
				// 2008-06-24 by dgwoo 채팅방. 
			case T_IC_CHATROOM_CREATE_OK:
				{
					IMSocketChatRoomCreateOK((MSG_IC_CHATROOM_CREATE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_LIST_INFO_OK:
				{
					IMSocketChatRoomListInfoOK((MSG_IC_CHATROOM_LIST_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_REQUEST_INVITE_QUESTION:
				{
					IMSocketChatRoomRequestInviteQuestion((MSG_IC_CHATROOM_REQUEST_INVITE_QUESTION*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_JOIN_OK:
				{
					IMSocketChatRoomJoinOK();
				}
				break;
			case T_IC_CHATROOM_ACCEPT_INVITE_OK:
				{
					IMSocketChatRoomAcceptInviteOK((MSG_IC_CHATROOM_ACCEPT_INVITE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_REJECT_INVITE_OK:
				{
					IMSocketChatRoomRejectInviteOK();
				}
				break;
			case T_IC_CHATROOM_LEAVE_OK:
				{
					IMSocketChatRoomLeaveOK((MSG_IC_CHATROOM_LEAVE_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_BAN_OK:
				{
					IMSocketChatRoomBanOK((MSG_IC_CHATROOM_BAN_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_CHANGE_NAME_OK:
				{
					IMSocketChatRoomChangeNameOK((MSG_IC_CHATROOM_CHANGE_NAME_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_CHANGE_MASTER_OK:
				{
					IMSocketChatroomChangeMasterOK((MSG_IC_CHATROOM_CHANGE_MASTER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_CHANGE_LOCK_PW_OK:
				{
					IMSocketChatRoomChangeLockPWOK((MSG_IC_CHATROOM_CHANGE_LOCK_PW_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_CHANGE_MAX_MEMBER_OK:
				{
					IMSocketChatRoomChangeMaxMemberOK((MSG_IC_CHATROOM_CHANGE_MAX_MEMBER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			case T_IC_CHATROOM_MEMBER_INFO_OK:
				{
					IMSocketChatRoomMemberInfoOK((MSG_IC_CHATROOM_MEMBER_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;

			case T_IC_CHATROOM_OTHER_MEMBER_INFO_OK:
				{
					IMSocketChatRoomOtherMemberInfoOK((MSG_IC_CHATROOM_MEMBER_INFO_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 2008-07-11 by bhsohn 접속한 친구 리스트 시스템 추가
			case T_IC_CHAT_ONLINE_EACHOTHER_FRIEND_COUNT:
				{
					IMSocketChatOnlineEachOtherFriendCount((MSG_IC_CHAT_ONLINE_EACHOTHER_FRIEND_COUNT*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// end 2008-07-11 by bhsohn 접속한 친구 리스트 시스템 추가
			case T_IC_VOIP_SET_OK:
				{
					IMSocketVoIPSetOK((MSG_IC_VOIP_SET_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// 2008-07-17 by bhsohn 길드원 랭크 갱신시 팅기는 문제 해결
			case T_IC_GUILD_CHANGE_FAME_RANK:
				{
					IMGuildChangeFameRank((MSG_IC_GUILD_CHANGE_FAME_RANK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// end 2008-07-17 by bhsohn 길드원 랭크 갱신시 팅기는 문제 해결
				// 2009-01-12 by bhsohn 친구 등록 당하는 유저 메시지창 기능 추가
			case T_IC_CHAT_FRIENDLIST_INSERT_NOTIFY:
				{
					IMChatFriendListInsertNotify((MSG_IC_CHAT_FRIENDLIST_INSERT_NOTIFY*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
				// end 2009-01-12 by bhsohn 친구 등록 당하는 유저 메시지창 기능 추가
			// 2009. 01. 12 by ckPark 선전 포고 시스템
			case T_IC_INFO_DECLARATION_MSWAR_SET_OK:
				{
					g_pD3dApp->EnterLock(TRUE);
					
					IMSocketWarDeclareSetOK((MSG_IC_INFO_DECLARATION_MSWAR_SET_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			// end 2009. 01. 12 by ckPark 선전 포고 시스템
			// 2010. 03. 18 by jskim 몬스터변신 카드
			case T_IC_PARTY_UPDATE_ITEM_TRANSFORMER_OK:
				{
					IMSocketPartyUpdateItemTransformerOk((MSG_IC_PARTY_UPDATE_ITEM_TRANSFORMER_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER));
				}
				break;
			//end 2010. 03. 18 by jskim 몬스터변신 카드

			case T_ERROR:
				{
					IMSocketError((MSG_ERROR*)(pPacket+SIZE_FIELD_TYPE_HEADER));
				}
				break;
			default:
				{
					IMSocketInvalidPacket(pPacket);
				}
				break;
			}
			// 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
			m_nPreIMComType = nType;
			
			if(pPacket != NULL)
			{
				SAFE_DELETE(pPacket);
			}
		}
		break;
		}
	}
	return 0;
}

VOID CAtumApplication::IMSocketConnectLoginOk(void)
{
	FLOG("CAtumApplication::IMSocketConnectLoginOk(void)");

	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	//m_pInterface->m_pMapLoad->m_bLoginChat = IM_SERVER_STATE_SUCCESS_LOGIN;
	m_pInterface->m_pMapLoad->SetLoginChatMode(IM_SERVER_STATE_SUCCESS_LOGIN);
	m_pInterface->m_pMapLoad->MapLoadNextStep();

	// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
	{
		g_pD3dApp->SendGameStart(((CShuttleChild *)(g_pD3dApp->m_pShuttleChild))->m_myShuttleInfo.ClientIndex,
												((CShuttleChild *)(g_pD3dApp->m_pShuttleChild))->m_myShuttleInfo.CharacterUniqueNumber);
		m_pInterface->m_pMapLoad->SetLoginChatMode(IM_SERVER_STATE_READY_FOR_GAMESTART);
		m_pInterface->m_pMapLoad->MapLoadNextStep();
	}	
	// end 2007-11-20 by bhsohn 맵로딩 하는 방식 변경

	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)	
#if defined(DEFINE_USE_GAMEGUARD_XTRAP)
	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();
    XTrap_C_KeepAlive();
	XTrap_C_SetUserInfoEx((LPCSTR)pMainInfo->AccountName, (LPCSTR)NULL, (LPCSTR)pMainInfo->CharacterName, (LPCSTR)NULL,0,m_pFieldWinSocket->GetFieldWinSocket(WM_PACKET_NOTIFY)->GetSocketHandle());
#endif
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)	

// 2011. 1. 18 by jskim 배트남 VTC가드
#if defined(DEFINE_USE_GAMEGUARD_VTC)
	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();
	m_fnVTCDLLSetUser(pMainInfo->AccountName);	
#endif
// end 2011. 1. 18 by jskim 배트남 VTC가드
	DBGOUT("IM Server State : Connect Done (T_IC_CONNECT_LOGIN_OK, m_bLoginChat = IM_SERVER_STATE_SUCCESS_LOGIN)\n");
}

VOID CAtumApplication::IMSocketChatPtoP(MSG_IC_CHAT_PTOP* pMsg)
{
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	if(!g_pD3dApp->IsOptionEtc(OPTION_RADIO_WHISPER))
	{
		// 귓속말 사용안함.
		return;
	}
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리
	FLOG("CAtumApplication::IMSocketChatPtoP(MSG_IC_CHAT_PTOP* pMsg)");
	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_PTOP);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"\"[%s] %s",pMsg->FromCharacterName,bufChat);//귓속말
//	m_pChat->CreateChatChild(str,COLOR_CHAT_PTOP);
	m_pChat->CreateChatChild(str,COLOR_CHAT_PTOP,CHAT_TAB_PTOP, pMsg->ToCharacterName, pMsg->FromCharacterName);
	if(strcmp(m_pShuttleChild->m_myShuttleInfo.CharacterName,pMsg->FromCharacterName))
	{
		bool bChatCheckPToP = false;
		for(int i=0;i<MAX_CHAT_PTOP_CONT;i++)
		{
			if(!strcmp(m_pShuttleChild->m_strChatPToP[i],pMsg->FromCharacterName))
			{
				m_pShuttleChild->m_bOldPToPPos = i;
				bChatCheckPToP = true;
				break;
			}
		}
		if(!bChatCheckPToP)
		{
			memset(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bCurPToPPos],0x00,SIZE_MAX_CHARACTER_NAME);
			strncpy(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bCurPToPPos],pMsg->FromCharacterName,strlen(pMsg->FromCharacterName));
			m_pShuttleChild->m_bOldPToPPos = m_pShuttleChild->m_bCurPToPPos;
			m_pShuttleChild->m_bCurPToPPos++;
			if(m_pShuttleChild->m_bCurPToPPos == MAX_CHAT_PTOP_CONT)
				m_pShuttleChild->m_bCurPToPPos = 0;
		}
	}
}

VOID CAtumApplication::IMSocketChatParty(MSG_IC_CHAT_PARTY* pMsg)
{
	// 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리
	// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
	if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->FromCharacterName))
	{
		return;
	}
	// end 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리

	FLOG("CAtumApplication::IMSocketChatParty(MSG_IC_CHAT_PARTY* pMsg)");
	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_PARTY);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);

	// 2007-11-22 by bhsohn 아레나 통합서버
	//wsprintf(str,"#[%s] %s",pMsg->FromCharacterName,bufChat);//편대채팅
	char szCharacterName[SIZE_MAX_ARENA_FULL_NAME];
	memset(szCharacterName, 0x00, SIZE_MAX_ARENA_FULL_NAME);
	strncpy(szCharacterName, pMsg->FromCharacterName, SIZE_MAX_CHARACTER_NAME);
	ConevertArenaRenderUserName(GetArenaState(), szCharacterName);

	wsprintf(str,"#[%s] %s",szCharacterName,bufChat);//편대채팅
	// end 2007-11-22 by bhsohn 아레나 통합서버

	
	//	m_pChat->CreateChatChild(str,COLOR_PARTY);
	m_pChat->CreateChatChild(str,COLOR_PARTY,CHAT_TAB_PARTY);
}

VOID CAtumApplication::IMSocketChatGuild(MSG_IC_CHAT_GUILD* pMsg)
{
	// 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리
	// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
	if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->FromCharacterName))
	{
		return;
	}
	// end 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리

	FLOG("CAtumApplication::IMSocketChatGuild(MSG_IC_CHAT_GUILD* pMsg)");
	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_GUILD);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"@[%s] %s",pMsg->FromCharacterName,bufChat);// 길드채팅
//	m_pChat->CreateChatChild(str,COLOR_CHAT_GUILD);
	m_pChat->CreateChatChild(str,COLOR_CHAT_GUILD, CHAT_TAB_GUILD);
}
VOID CAtumApplication::IMSocketChatWar(MSG_IC_CHAT_WAR* pMsg)
{
	// 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리
	// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
	if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->FromCharacterName))
	{
		return;
	}
	// end 2008-11-06 by bhsohn 거부 유저의 채팅이 전투/파티/여단 채팅에서 보였던 현상 처리

	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_WAR);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"^[%s] %s",pMsg->FromCharacterName,bufChat);// 유료 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_WAR, CHAT_TAB_WAR);

}
VOID CAtumApplication::IMSocketChatChatRoom(MSG_IC_CHAT_CHATROOM* pMsg)
{
	// 2013-04-10 by bhsohn 차단 유저 채팅방에서 안 보이도록 처리
	if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->FromCharacterName))
	{
		// 거부 리스트 유저 채팅 안보이게
		return;
	}
	// END 2013-04-10 by bhsohn 차단 유저 채팅방에서 안 보이도록 처리
	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_CHATROOM);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"&[%s] %s",pMsg->FromCharacterName,bufChat);// 유료 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_CHATROOM, CHAT_TAB_CHATROOM);
}
VOID CAtumApplication::IMSocketChatSellAll(MSG_IC_CHAT_SELL_ALL* pMsg)
{
	FLOG("CAtumApplication::IMSocketChatSellAll(MSG_IC_CHAT_SELL_ALL* pMsg)");
	// 2013-04-15 by bhsohn 캐나다 Exception 오류 요소 안전코드 추가
	if(!g_pGameMain || !g_pGameMain->m_pCommunity || !g_pGameMain->m_pCommunity->GetReject())
	{
		return;
	}
	// END 2013-04-15 by bhsohn 캐나다 Exception 오류 요소 안전코드 추가

	// 2006-11-07 by ispark, 거절 리스트에 있는 사람이 나한테 걸었을 때
	vector<Reject_t>::iterator itReject = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
	while(itReject != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
	{
		if(0 == stricmp(pMsg->FromCharacterName, itReject->szRejectName))
		{
			return;
		}
		itReject++;			
	}

	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_SELL_ALL);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"$[%s] %s",pMsg->FromCharacterName,bufChat);// 장사 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_SELL, CHAT_TAB_TRADE);
}
VOID CAtumApplication::IMSocketChatCashAll(MSG_IC_CHAT_CASH_ALL* pMsg)
{
	FLOG("CAtumApplication::IMSocketChatCashAll(MSG_IC_CHAT_CASH_ALL* pMsg)");

	char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_IC_CHAT_CASH_ALL);
	memcpy(bufChat,p,size);
	char str[512];
	int temp,temp2;
	// 2006-04-13 by ispark
	CheckReadyStringFiltering(bufChat, &temp, &temp2);
//	m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);
	wsprintf(str,"&[%s] %s",pMsg->FromCharacterName,bufChat);// 유료 채팅
	m_pChat->CreateChatChild(str,COLOR_CHAT_CASH, CHAT_TAB_CASH);
}

VOID CAtumApplication::IMSocketChatAll(char* pPacket)
{
	FLOG("CAtumApplication::IMSocketChatAll(char* pPacket)");
	if(m_dwGameState == _GAME || m_dwGameState == _SHOP || m_dwGameState == _CITY)
	{
		MSG_IC_CHAT_ALL	*pChatAll = NULL;
		char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
		memset(bufChat, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4);

		pChatAll = (MSG_IC_CHAT_ALL*)(pPacket + SIZE_FIELD_TYPE_HEADER);
//		wsprintf(bufChat, "공지사항 [%s] ", pChatAll->FromCharacterName);
		// nType이 채팅 종류,bufCharacterName이 상대방 캐릭터 이름, bufChat가 채팅 내용
		// 글자를 생성
//		for(int i=0;i<4;i++)
//			m_pChat->CreateChatChild(bufChat,COLOR_CHAT_ALL);
		int temp,temp2;
		// 2006-04-13 by ispark
		CheckReadyStringFiltering(bufChat, &temp, &temp2);
//		m_pAbuseFilter->AbuseFiltering(bufChat,&temp,&temp2);


		// 2007-08-07 by bhsohn 스피커 아이템 추가
		wsprintf(bufChat, STRMSG_C_INTERFACE_0049, pPacket+SIZE_FIELD_TYPE_HEADER+sizeof(MSG_IC_CHAT_ALL));//"[공지사항] %s"		
		m_pChat->CreateChatChild(bufChat,COLOR_CHAT_ALL, CHAT_TAB_GAMEMASTER);
		AddSpeakerGMString(bufChat, TRUE);		
		// end 2007-08-07 by bhsohn 스피커 아이템 추가
		
//		if(m_pInterface && g_pGameMain)
//		{
//			char bufOrder[256];
//			wsprintf(bufOrder,"공지사항:%s",bufChat);
//			g_pGameMain->SetNotice(bufOrder);
//		}
	}
}

VOID CAtumApplication::IMSocketChatInfluenceAll(char *pPacket)
{
	FLOG("CAtumApplication::IMSocketChatInfluenceAll(MSG_IC_CHAT_INFLUENCE_ALL* pMsg)");
	if(m_dwGameState == _GAME || m_dwGameState == _SHOP || m_dwGameState == _CITY)
	{
		MSG_IC_CHAT_INFLUENCE_ALL	*pChatAll = NULL;
		char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
		memset(bufChat, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4);

		pChatAll = (MSG_IC_CHAT_INFLUENCE_ALL*)(pPacket + SIZE_FIELD_TYPE_HEADER);
		int temp,temp2;
		// 2006-12-13 by dgwoo 수정본(지도자 & 부지도자추가.)
		//wsprintf(bufChat, STRMSG_C_060421_0000, pPacket+SIZE_FIELD_TYPE_HEADER+sizeof(MSG_IC_CHAT_INFLUENCE_ALL));//"[지도자] %s"
		wsprintf(bufChat, "[%s] %s", pChatAll->FromCharacterName, pPacket+SIZE_FIELD_TYPE_HEADER+sizeof(MSG_IC_CHAT_INFLUENCE_ALL));//"[지도자] %s"
		CheckReadyStringFiltering(bufChat, &temp, &temp2);
		m_pChat->CreateChatChild(bufChat,COLOR_INFLUENCE, CHAT_TAB_INFLUENCE_LEADER);
	}
}
// 2007-11-22 by bhsohn 아레나 통합서버
VOID CAtumApplication::IMSocketChatGetGuildOk(MSG_IC_CHAT_GET_GUILD_OK* pMsg, UINT nSocketNotifyType)
{
	FLOG("CAtumApplication::IMSocketChatGetGuildOk(MSG_IC_CHAT_GET_GUILD_OK* pMsg)");
	m_pIMSocket->OnRecvdGetGuildOK(pMsg, nSocketNotifyType);
}
VOID CAtumApplication::IMSocketChatChangeGuild(MSG_IC_CHAT_CHANGE_GUILD* pMsg, UINT nSocketNotifyType)
{
	FLOG("CAtumApplication::IMSocketChatChangeGuild(MSG_IC_CHAT_CHANGE_GUILD* pMsg)");
	m_pIMSocket->OnRecvdChangeGuild(pMsg, nSocketNotifyType);
}
VOID CAtumApplication::IMSocketChatChangeParty(MSG_IC_CHAT_CHANGE_PARTY* pMsg, UINT nSocketNotifyType)
{
	FLOG("CAtumApplication::IMSocketChatChangeParty(MSG_IC_CHAT_CHANGE_PARTY* pMsg)");
	m_pIMSocket->OnRecvdChangeParty(pMsg, nSocketNotifyType);
}
// end 2007-11-22 by bhsohn 아레나 통합서버

VOID CAtumApplication::IMSocketPartyAcceptInviteOk(MSG_IC_PARTY_ACCEPT_INVITE_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyAcceptInviteOk(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyPutMember(MSG_IC_PARTY_PUT_MEMBER* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _SHOP		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyPutMember(pMsg);
	}

}

VOID CAtumApplication::IMSocketPartyLeaveOk(MSG_IC_PARTY_LEAVE_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _SHOP		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyLeaveOk(pMsg);
	}

// 2008-12-09 by dgwoo 미션마스터.
	if(NULL == g_pGameMain)
	{
		return;
	}
	CINFCommuPartyCre*	pPartyCre = g_pGameMain->m_pCommunity->GetPartyCreate();
	if(pPartyCre == NULL)
		return;
	if(pPartyCre->IsMissionMaster())
	{
		MSG_FC_QUEST_MISSIONMASTER_HELP_INVITE sMsg;
		sMsg.CharacterUID = pPartyCre->GetMissionMasterUID();
		g_pFieldWinSocket->SendMsg(T_FC_QUEST_MISSIONMASTER_HELP_INVITE,(char*)&sMsg,sizeof(sMsg));
	}
	pPartyCre->SetMissionMaster(FALSE);
// end 2008-12-09 by dgwoo 미션마스터.

}

VOID CAtumApplication::IMSocketPartyBanMemberOk(MSG_IC_PARTY_BAN_MEMBER_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyBanMemberOk(pMsg);
	}

}

VOID CAtumApplication::IMSocketPartyDismemberOk(MSG_IC_PARTY_DISMEMBER_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyDismemberOk(pMsg);
	}	
// 2008-12-09 by dgwoo 미션마스터.
	if(NULL == g_pGameMain)
	{
		return;
	}
	CINFCommuPartyCre*	pPartyCre = g_pGameMain->m_pCommunity->GetPartyCreate();
	if(pPartyCre == NULL)
		return;
	if(pPartyCre->IsMissionMaster())
	{
		MSG_FC_QUEST_MISSIONMASTER_HELP_INVITE sMsg;
		sMsg.CharacterUID = pPartyCre->GetMissionMasterUID();
		g_pFieldWinSocket->SendMsg(T_FC_QUEST_MISSIONMASTER_HELP_INVITE,(char*)&sMsg,sizeof(sMsg));
	}
	pPartyCre->SetMissionMaster(FALSE);
// end 2008-12-09 by dgwoo 미션마스터.
}
VOID CAtumApplication::IMSocketPartyTransferMasterOk(MSG_IC_PARTY_TRANSFER_MASTER_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyTransferMasterOk(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyPutAllMember(MSG_IC_PARTY_PUT_ALL_MEMBER* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyPutAllMember(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyChangeFlightFormationOk(MSG_IC_PARTY_CHANGE_FLIGHT_FORMATION_OK* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyChangeFlightFormationOk(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyGetFlightPosition(MSG_IC_PARTY_GET_FLIGHT_POSITION* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyGetFlightPosition(pMsg);
	} 
}

VOID CAtumApplication::IMSocketPartyChangeFlightPosition(MSG_IC_PARTY_CHANGE_FLIGHT_POSITION* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyChangeFlightPosition(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyCancelFlightPosition(MSG_IC_PARTY_CANCEL_FLIGHT_POSITION* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyCancelFlightPosition(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyAllFlightPosition(MSG_IC_PARTY_ALL_FLIGHT_POSITION* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyAllFlightPosition(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyPutLastPartyInfo(MSG_IC_PARTY_PUT_LAST_PARTY_INFO* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyPutLastPartyInfo(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyUpdateMemberInfoMapName(MSG_IC_PARTY_UPDATE_MEMBER_INFO_MAPNAME* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyUpdateMemberInfoMapname(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyMemberInvalidated(MSG_IC_PARTY_MEMBER_INVALIDATED* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyMemberInvalidated(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyMemberRejoined(MSG_IC_PARTY_MEMBER_REJOINED* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyMemberRejoined(pMsg);
	}
}

VOID CAtumApplication::IMSocketPartyUpdateItemPos(MSG_IC_PARTY_UPDATE_ITEM_POS* pMsg)
{
	if((m_dwGameState == _GAME		||
		m_dwGameState == _CITY		||
		m_dwGameState == _MAPLOAD	||
		m_dwGameState == _SHOP		||
		m_dwGameState == _SELECTCHANNEL ) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_pClientParty->IPartyUpdateItemPos(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildCreateOk(MSG_IC_GUILD_CREATE_OK* pMsg)
/// \brief		길드 생성 결과
/// \author		dhkwon
/// \date		2004-05-19 ~ 2004-05-19
/// \warning	Release시에 MSG_IC_GUILD_CREATE_OK 와 MSG_IC_GUILD_GET_GUILD_INFO_OK가 같다는 가정
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildCreateOk(MSG_IC_GUILD_CREATE_OK* pMsg)
{
	char buf[256];
	wsprintf( buf, STRMSG_C_GUILD_0002, pMsg->GuildName );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	g_pGameMain->m_pCommunity->GetGuild()->IMSocketSendGetGuildInfo(pMsg->GuildUniqueNumber);
	DBGOUT("Guild [%s] Create Done.\n", pMsg->GuildName);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildGetGuildInfoOk(MSG_IC_GUILD_GET_GUILD_INFO_OK* pMsg)
/// \brief		길드 정보와 길드원 리스트를 받음
/// \author		dhkwon
/// \date		2004-05-20 ~ 2004-05-20
/// \warning	게임시작시는 서버에서 일방적으로 보내고,
///				그외(길드창설,길드가입)시에는 클라이언트에서 MSG_IC_GUILD_GET_GUILD_INFO를 요청한다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildGetGuildInfoOk(MSG_IC_GUILD_GET_GUILD_INFO_OK* pMsg)
{
#ifdef _DEBUG
	if(g_pGameMain)
	{
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo(pMsg, TRUE);
	}
	else
	{
		NetworkErrorMsgBox(STRMSG_C_SERVER_0016);//"길드 정보가 GAMESTART_OK 이전에 도착하였습니다."
		return; // 2005-03-25 by jschoi
	}
#else
	g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo(pMsg, TRUE);
#endif
	char *p = (char *)pMsg;
	p += sizeof(MSG_IC_GUILD_GET_GUILD_INFO_OK);
	DBGOUT("---------------Guild List Receive---------------\n");
	for(int i = 0; i < pMsg->NumOfGuildMemberInfo; i++)
	{
		DBGOUT("	[%s][%d]\n",((MEX_GUILD_MEMBER_INFO*)p)->MemberName, ((MEX_GUILD_MEMBER_INFO*)p)->IsOnline);
		g_pGameMain->m_pCommunity->GetGuild()->AddGuildMember((MEX_GUILD_MEMBER_INFO*)p);
		p += sizeof(MEX_GUILD_MEMBER_INFO);
	}
	DBGOUT("------------------------------------------------\n");
	if(pMsg->GuildUniqueNumber != 0 )
	{
		m_pDatabase->CheckGuildMarkVersion( pMsg->GuildUniqueNumber, pMsg->GuildMarkVersion );
	}
	if(pMsg->GuildState == GUILD_STATE_DISMEMBER_READY)
	{
		// 길드 해산 시기 요청
		MSG_IC_GUILD_GET_DISMEMBER_DATE sMsg;
		sMsg.GuildUniqueNumber = pMsg->GuildUniqueNumber;
		m_pIMSocket->SendMsg( T_IC_GUILD_GET_DISMEMBER_DATE, (char*)&sMsg, sizeof(sMsg));
	}
	g_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber = pMsg->GuildUniqueNumber;
	strcpy( g_pShuttleChild->m_myShuttleInfo.GuildName, pMsg->GuildName );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildRequestInviteQuestion(MSG_IC_GUILD_REQUEST_INVITE_QUESTION* pMsg)
/// \brief		비행단 가입 권유
/// \author		dhkwon
/// \date		2004-05-19 ~ 2004-05-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildRequestInviteQuestion(MSG_IC_GUILD_REQUEST_INVITE_QUESTION* pMsg)
{
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	if(!g_pD3dApp->IsOptionEtc(OPTION_RADIO_GUILD_INVITE))		
	{
		// 여단 거절
		MSG_IC_GUILD_REJECT_INVITE sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_IC_GUILD_REJECT_INVITE));
		sMsg.GuildUniqueNumber = pMsg->GuildUniqueNumber;
		g_pIMSocket->SendMsg( T_IC_GUILD_REJECT_INVITE, (char*)&sMsg, sizeof(sMsg));
		return;
	}	
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리

	char buf[256];
	wsprintf( buf, STRMSG_C_GUILD_0007, pMsg->GuildCommanderCharacterName, pMsg->GuildName );
	g_pGameMain->m_pInfWindow->AddMsgBox( buf, _Q_GUILD_INVITE_QUESTION, (DWORD)pMsg->GuildUniqueNumber );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildAcceptInviteOk(MSG_IC_GUILD_ACCEPT_INVITE_OK* pMsg)
/// \brief		길드 가입 통보
/// \author		dhkwon
/// \date		2004-05-19 ~ 2004-05-19
/// \warning	내가 가입된 경우 길드 정보를 요청해야 한다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildAcceptInviteOk(MSG_IC_GUILD_ACCEPT_INVITE_OK* pMsg)
{
	char buf[256];
	wsprintf( buf, STRMSG_C_GUILD_0008, pMsg->MemberInfo.MemberName );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	if(pMsg->MemberInfo.MemberUniqueNumber != m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber)
	{
		g_pGameMain->m_pCommunity->GetGuild()->AddGuildMember(&pMsg->MemberInfo);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildRejectInviteOk(MSG_IC_GUILD_REJECT_INVITE_OK* pMsg)
/// \brief		길드 가입 거절 통보(길드장에게만 전송)
/// \author		dhkwon
/// \date		2004-05-19 ~ 2004-05-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildRejectInviteOk(MSG_IC_GUILD_REJECT_INVITE_OK* pMsg)
{
	char buf[256];
	wsprintf( buf, STRMSG_C_GUILD_0009, pMsg->CharacterName );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildBanMemberOk(MSG_IC_GUILD_BAN_MEMBER_OK* pMsg)
/// \brief		멤버를 추방한 결과.(멤버 전원에게 전송)
/// \author		dhkwon
/// \date		2004-05-20 ~ 2004-05-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildBanMemberOk(MSG_IC_GUILD_BAN_MEMBER_OK* pMsg)
{
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	//MEX_GUILD_MEMBER_INFO* pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
	structGuildInfo* pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);

	char buf[256];
	if(pMsg->MemberUniqueNumber != m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber)
	{
		wsprintf( buf, STRMSG_C_GUILD_0010, pInfo->MemberName );
	}
	else
	{
		wsprintf( buf, STRMSG_C_080716_0202);
	}
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	if(pMsg->MemberUniqueNumber != m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber)
	{
		g_pGameMain->m_pCommunity->GetGuild()->DeleteGuildMember(pMsg->MemberUniqueNumber);
	}
	else
	{
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo(NULL, TRUE);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildLeaveOk(MSG_IC_GUILD_LEAVE_OK* pMsg)
/// \brief		길드를 탈퇴한 결과.(멤버 전원에게 전송)
/// \author		dhkwon
/// \date		2004-05-20 ~ 2004-05-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildLeaveOk(MSG_IC_GUILD_LEAVE_OK* pMsg)
{
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	//MEX_GUILD_MEMBER_INFO* pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
	structGuildInfo* pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);

	char buf[256];
	wsprintf( buf, STRMSG_C_GUILD_0011, pInfo->MemberName );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	if(pMsg->MemberUniqueNumber != m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber)
	{
		g_pGameMain->m_pCommunity->GetGuild()->DeleteGuildMember(pMsg->MemberUniqueNumber);
	}
	else
	{
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo(NULL, TRUE);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildDismemberOk(MSG_IC_GUILD_DISMEMBER_OK* pMsg)
/// \brief		길드 해체 요청
/// \author		dhkwon
/// \date		2004-05-21 ~ 2004-05-21
/// \warning	길드 해체 상태로 바뀐다.
///				GuildInfo를 객체 생성한 이유는 ResetGuildInfo에서 pInfo를 삭제하기 때문이다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildDismemberOk(MSG_IC_GUILD_DISMEMBER_OK* pMsg)
{
	m_pChat->CreateChatChild( STRMSG_C_GUILD_0012, COLOR_CHAT_GUILD );
	MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	if(pInfo)
	{
//		MSG_IC_GUILD_GET_GUILD_INFO_OK GuildInfo;
//		memcpy( &GuildInfo, pInfo, sizeof(MSG_IC_GUILD_GET_GUILD_INFO_OK));
//		GuildInfo.GuildState = GUILD_STATE_DISMEMBER_READY;
//		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo( &GuildInfo, TRUE );
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo( NULL, TRUE );
		// 길드 해산 시기 요청
//		MSG_IC_GUILD_GET_DISMEMBER_DATE sMsg;
//		sMsg.GuildUniqueNumber = GuildInfo.GuildUniqueNumber;
//		m_pIMSocket->SendMsg( T_IC_GUILD_GET_DISMEMBER_DATE, (char*)&sMsg, sizeof(sMsg));
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildCancelDismemberOk(MSG_IC_GUILD_CANCEL_DISMEMBER_OK*) pMsg)
/// \brief		해체 취소
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	GuildInfo를 객체 생성한 이유는 ResetGuildInfo에서 pInfo를 삭제하기 때문이다.
///				
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildCancelDismemberOk(MSG_IC_GUILD_CANCEL_DISMEMBER_OK* pMsg)
{
	m_pChat->CreateChatChild( STRMSG_C_GUILD_0013, COLOR_CHAT_GUILD );
	MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	if(pInfo)
	{
		MSG_IC_GUILD_GET_GUILD_INFO_OK GuildInfo;
		memcpy( &GuildInfo, pInfo, sizeof(MSG_IC_GUILD_GET_GUILD_INFO_OK));
		GuildInfo.GuildState = pMsg->GuildState;
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo( &GuildInfo, FALSE );
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildSetGuildMarkOk(MSG_IC_GUILD_SET_GUILD_MARK_OK* pMsg)
/// \brief		문장 정보 바꿈
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildSetGuildMarkOk(MSG_IC_GUILD_SET_GUILD_MARK_OK* pMsg)
{
	m_pChat->CreateChatChild( STRMSG_C_GUILD_0019, COLOR_CHAT_GUILD );
	MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	m_pDatabase->UpdateGuildMark(pInfo->GuildUniqueNumber, 
								pMsg->GuildMarkVersion,
								((char*)pMsg + sizeof(MSG_IC_GUILD_SET_GUILD_MARK_OK)), 
								pMsg->SizeOfGuildMark);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildGetGuildMarkOk(MSG_IC_GUILD_GET_GUILD_MARK_OK* pMsg)
/// \brief		길드 마크 정보 요청, 주변에 길드마크가 변경된 경우도 도착
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildGetGuildMarkOk(MSG_IC_GUILD_GET_GUILD_MARK_OK* pMsg)
{
	m_pDatabase->UpdateGuildMark(pMsg->GuildUniqueNumber,
								pMsg->GuildMarkVersion,
								((char*)pMsg + sizeof(MSG_IC_GUILD_GET_GUILD_MARK_OK)), 
								pMsg->SizeOfGuildMark);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildSetRankOk(MSG_IC_GUILD_SET_RANK_OK* pMsg)
/// \brief		GuildRank 세팅
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildSetRankOk(MSG_IC_GUILD_SET_RANK_OK* pMsg)
{
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	//MEX_GUILD_MEMBER_INFO *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
	structGuildInfo *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
	
	if(pInfo)
	{
		//pInfo->GuildRank = pMsg->GuildRank;		
		g_pGameMain->m_pCommunity->GetGuild()->SetGuildDSetRank(pMsg->MemberUniqueNumber, pMsg->GuildRank);

		char buf[256];
		wsprintf( buf, STRMSG_C_GUILD_0020, pInfo->MemberName, GetGuildRankName(pInfo->GuildRank) );
		m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildGetDismemberDateOk(MSG_IC_GUILD_GET_DISMEMBER_DATE_OK* pMsg)
/// \brief		길드 해산 시기
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildGetDismemberDateOk(MSG_IC_GUILD_GET_DISMEMBER_DATE_OK* pMsg)
{
	char buf[256];
	string date;
	date = pMsg->DismemberDateTime.GetLocalDateTimeString(string(),GetLanguageType());
	wsprintf(buf, STRMSG_C_GUILD_0016, date.c_str() );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildChangeGuildNameOk(MSG_IC_GUILD_CHANGE_GUILD_NAME_OK* pMsg)
/// \brief		길드 이름을 바꾼다.
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	아직 클라이언트에서 구현 안됨. 차후에 NPC를 통해 지원
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildChangeGuildNameOk(MSG_IC_GUILD_CHANGE_GUILD_NAME_OK* pMsg)
{
	char buf[256];
	wsprintf(buf, STRMSG_C_GUILD_0017, pMsg->NewGuildName );
	m_pChat->CreateChatChild( buf, COLOR_CHAT_GUILD );
	MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	if(pInfo)
	{
		MSG_IC_GUILD_GET_GUILD_INFO_OK GuildInfo;
		memcpy( &GuildInfo, pInfo, sizeof(MSG_IC_GUILD_GET_GUILD_INFO_OK));
		strcpy(GuildInfo.GuildName, pMsg->NewGuildName );
		g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo( &GuildInfo,FALSE );
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildSetMemberState(MSG_IC_GUILD_SET_MEMBER_STATE* pMsg)
/// \brief		멤버의 온라인/오프라인 상태 변화
/// \author		dhkwon
/// \date		2004-05-21 ~ 2004-05-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildSetMemberState(MSG_IC_GUILD_SET_MEMBER_STATE* pMsg)
{
	ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityGuild* pGuild = g_pGameMain->m_pCommunity->GetGuild();

	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	//MEX_GUILD_MEMBER_INFO* pInfo = pGuild->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
	structGuildInfo *pInfo = pGuild->GetGuildMemberInfo(pMsg->MemberUniqueNumber);
		
	if(pInfo)
	{		
		//pInfo->IsOnline = pMsg->GuildMemberState;
		g_pGameMain->m_pCommunity->GetGuild()->SetGuildOnOffInfo(pMsg->MemberUniqueNumber, pMsg->GuildMemberState);

		if( pInfo->IsOnline == TRUE &&
			pGuild->GetNtoNCallState() == TRUE &&
			pGuild->GetMyGuildRank() == GUILD_RANK_COMMANDER)
		{
			pGuild->IMSocketSendVoipNtoNInviteUser( pMsg->MemberUniqueNumber );
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildChangeGuildState(MSG_IC_GUILD_CHANGE_GUILD_STATE* pMsg)
/// \brief		길드 해체 대기상태, 정상상태 전송
/// \author		dhkwon
/// \date		2004-05-22 ~ 2004-05-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildChangeGuildState(MSG_IC_GUILD_CHANGE_GUILD_STATE* pMsg)
{
	if(pMsg->GuildState == GUILD_STATE_DISMEMBER_READY)
	{
		m_pChat->CreateChatChild( STRMSG_C_GUILD_0015, COLOR_CHAT_GUILD );
		DBGOUT("GUILD_STATE_DISMEMBER_READY.\n");
		MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
		if(pInfo)
		{
			MSG_IC_GUILD_GET_GUILD_INFO_OK GuildInfo;
			memcpy( &GuildInfo, pInfo, sizeof(MSG_IC_GUILD_GET_GUILD_INFO_OK));
			GuildInfo.GuildState = GUILD_STATE_DISMEMBER_READY;
			g_pGameMain->m_pCommunity->GetGuild()->ResetGuildInfo( &GuildInfo, FALSE );
			// 길드 해산 시기 요청
			MSG_IC_GUILD_GET_DISMEMBER_DATE sMsg;
			sMsg.GuildUniqueNumber = GuildInfo.GuildUniqueNumber;
			m_pIMSocket->SendMsg( T_IC_GUILD_GET_DISMEMBER_DATE, (char*)&sMsg, sizeof(sMsg));
		}
	}
#ifdef _DEBUG
	else
	{
		DBGOUT("GUILD_STATE_NORMAL\n");
	}
#endif
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildLoadingGuildDone(MSG_IC_GUILD_LOADING_GUILD_DONE* pMsg)
/// \brief		길드 정보를 요청할 준비가 됨(IM)
/// \author		dhkwon
/// \date		2004-05-31 ~ 2004-05-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildLoadingGuildDone(MSG_IC_GUILD_LOADING_GUILD_DONE* pMsg)
{
	m_bReadyToGetGuildInfo = TRUE;
	if( m_dwGameState == _GAME || 
		m_dwGameState == _CITY || 
		m_dwGameState == _SHOP || 
		(m_bReadyFieldGameStartOk))// 2007-01-07 by bhsohn 길드 정보 동기화 문제 관련 처리
	{
		MSG_IC_GUILD_GET_GUILD_INFO sMsg;
		sMsg.GuildUniqueNumber = m_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber;
		m_pIMSocket->SendMsg( T_IC_GUILD_GET_GUILD_INFO, (char*)&sMsg, sizeof(sMsg));
	}
#ifdef _DEBUG
	else
	{
		DBGOUT("ERROR : m_dwGameState != _GAME,_CITY,_SHOP, MSG_IC_GUILD_GET_GUILD_INFO\n");
	}
#endif
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketGuildGetOtherGuildInfoOk(MSG_IC_GUILD_GET_OTHER_GUILD_INFO_OK* pMsg)
/// \brief		다른 캐릭터의 길드 정보
/// \author		dhkwon
/// \date		2004-06-01 ~ 2004-06-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildGetOtherGuildInfoOk(MSG_IC_GUILD_GET_OTHER_GUILD_INFO_OK* pMsg)
{
	m_pDatabase->UpdateOtherGuildInfo( &pMsg->OtherGuildMemberInfo );
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketAdminGetServerStatOk(MSG_IC_ADMIN_GET_SERVER_STAT_OK* pMsg)
/// \brief		서버의 현재맵(채널) 사용자 수
/// \author		dhkwon
/// \date		2004-05-13 ~ 2004-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketAdminGetServerStatOk(MSG_IC_ADMIN_GET_SERVER_STAT_OK* pMsg)
{
	wsprintf(m_strSeverUserNum, "ALL USER [ %d ]", pMsg->TotalUserCount);
}
VOID CAtumApplication::IMSocketConnectClose(MSG_IC_CONNECT_CLOSE* pMsg)
{
	FLOG("CAtumApplication::IMSocketConnectClose(MSG_IC_CONNECT_CLOSE* pMsg)");
	char message[256];
	wsprintf(message,STRMSG_C_SERVER_0017,pMsg->reason);//"채팅 서버가 종료되었습니다. 게임이 종료됩니다. [%d] T_IC_CONNECT_CLOSE 에서 종료"
	NetworkErrorMsgBox(message);
}

VOID CAtumApplication::IMSocketString128(MSG_IC_STRING_128* pMsg)
{
	FLOG("CAtumApplication::IMSocketString128(MSG_IC_STRING_128* pMsg)");
/*	
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
	}
	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{// 윤원씨용 텍스트 찍기
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
*/
	m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
	m_pChat->SetNumIme(pMsg->SecurityNumber);			// 2011-11-01 by jhahn 암호화 처리

//2011-06-30 by jhahn  사설서버 패스워드	
#ifdef C_SECURITY_COMMAND_JHAHN
	char buf[256];
	wsprintf(buf, "IMSocket128 %0d", pMsg->SecurityNumber);
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
}
VOID CAtumApplication::IMSocketString256(MSG_IC_STRING_256* pMsg)
{
	FLOG("CAtumApplication::IMSocketString128(MSG_IC_STRING_128* pMsg)");
/*	
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
	}
	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{// 윤원씨용 텍스트 찍기
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
*/
	m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
	m_pChat->SetNumIme(pMsg->SecurityNumber);						// 2011-11-01 by jhahn 암호화 처리
//2011-06-30 by jhahn  사설서버 패스워드
#ifdef C_SECURITY_COMMAND_JHAHN
	char buf[256];
	wsprintf(buf, "IMSocket256 %0d", pMsg->SecurityNumber);
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
}
VOID CAtumApplication::IMSocketString512(MSG_IC_STRING_512* pMsg)
{
	FLOG("CAtumApplication::IMSocketString128(MSG_IC_STRING_128* pMsg)");
/*	
	if(pMsg->PrintType == STR128_PRINT_TYPE_CHAT)
	{// 채팅 창에 찍기
		if(m_pChat)
			m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
	}
	else if(pMsg->PrintType == STR128_PRINT_TYPE_STATIC)
	{// 윤원씨용 텍스트 찍기
		memset(m_strDebug,0x00,sizeof(m_strDebug));
		memcpy(m_strDebug,pMsg->String,strlen(pMsg->String));
	}
*/
	m_pChat->CreateChatChild(pMsg->String,COLOR_SYSTEM);
		m_pChat->SetNumIme(pMsg->SecurityNumber);						// 2011-11-01 by jhahn 암호화 처리
//2011-06-30 by jhahn  사설서버 패스워드
#ifdef C_SECURITY_COMMAND_JHAHN
	char buf[256];
	wsprintf(buf, "IMSocket512 %0d", pMsg->SecurityNumber);
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
#endif	
//end 2011-06-30 by jhahn  사설서버 패스워드
}

VOID CAtumApplication::IMSocketError(MSG_ERROR* pMsg)
{
	FLOG("CAtumApplication::IMSocketError(MSG_ERROR* pMsg)");
	// 에러 처리 코드
	char errMsg[1024];
	memset(errMsg, 0x00, sizeof(errMsg));
	wsprintf(errMsg, "ERROR, ISocket, ErrCode : [%s]%#04x, ErrParam1:%d, ErrParam2:%d\n",
		GetErrorString(pMsg->ErrorCode), pMsg->ErrorCode, pMsg->ErrParam1, pMsg->ErrParam2);
	if(pMsg->StringLength>0)
	{
		memcpy(errMsg+strlen(errMsg), (char*)pMsg + sizeof(MSG_ERROR), pMsg->StringLength);
	}
	DBGOUT(errMsg);

	// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
	// 다중 락 체크 
	CheckMultiLock(FALSE, pMsg->MsgType);

	// 2005-03-18 by jschoi
	// 1. 에러 프로토콜 출력
	char errStr[512];
#ifndef _DEBUG
	if(m_pShuttleChild && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
#endif
	{
		wsprintf(errStr,"ERR:(%s),(%s)",GetProtocolTypeString(pMsg->MsgType),GetErrorString(pMsg->ErrorCode));
		m_pChat->CreateChatChild(errStr,COLOR_SYSTEM);
	}

	// 2. ErrorCode에 의한 에러(예외)처리
	if(IMSocketErrorByErrorCode(pMsg))
	{
		if(pMsg->CloseConnection)
		{
			g_pIMSocket->CloseSocket();

			char message[256];
				wsprintf(message,STRMSG_C_SERVER_0020,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(IM) 에서 종료"

			/*
			if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{
				wsprintf(message,STRMSG_C_SERVER_0020,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(IM) 에서 종료"
			}
			else
			{
				wsprintf(message,STRMSG_C_060608_0000,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			}
			*/
			NetworkErrorMsgBox(message);
		}
		return;
	}

	// 3. 메시지 타입별로 에러(예외)처리
	IMSocketErrorByMsgType(pMsg);

	if(pMsg->CloseConnection)
	{
		if(pMsg->CloseConnection)
		{
			g_pIMSocket->CloseSocket();

			char message[256];
				wsprintf(message,STRMSG_C_SERVER_0020,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(IM) 에서 종료"

			/*
			if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{
				wsprintf(message,STRMSG_C_SERVER_0020,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다. [0x%x] case T_ERROR:(IM) 에서 종료"
			}
			else
			{
				wsprintf(message,STRMSG_C_060608_0000,pMsg->ErrorCode);//"서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			}
			*/
			NetworkErrorMsgBox(message);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketGuildWarReady(MSG_IC_GUILD_WAR_READY* pMsg)
/// \brief		MSG_IC_GUILD_WAR_READY
/// \author		dhkwon
/// \date		2004-07-27 ~ 2004-07-27
/// \warning	pMsg->WaitingTime 초 후에 여단전 시작
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildWarReady(MSG_IC_GUILD_WAR_READY* pMsg)
{
	// ydkim 2004.10.20
	//char message[256];
	//wsprintf( message, "%d초후에 여단전이 시작됩니다.", pMsg->WaitingTime);
	////m_fBattleCountCheckTime = (float)pMsg->WaitingTime;
	//m_pChat->CreateChatChild(message, COLOR_SYSTEM);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketCountdownStart(MSG_IC_COUNTDOWN_START* pMsg)
/// \brief		길드전 카운트 시작
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketCountdownStart(MSG_IC_COUNTDOWN_START* pMsg)
{
	g_pGameMain->m_pGameCountDown->SetCountDown(pMsg->byCountdownType, pMsg->nWaitingSecond, COLOR_VOIP);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketItemUseCarditemGuildChangeMemberCapacity(MSG_IC_GUILD_CHANGE_MEMBER_CAPACITY* pMsg)
/// \brief		길드 멤버 수정(카드아이템 사용)
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketItemUseCarditemGuildChangeMemberCapacity(MSG_IC_GUILD_CHANGE_MEMBER_CAPACITY* pMsg)
{	
	if(g_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber == pMsg->guildUID)
	{
		g_pGameMain->m_pCommunity->GetGuild()->SetMaxGuildMember(pMsg->nMemberCapacity);
		// 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
		char ErrorMsgMissionList[256];
		wsprintf(ErrorMsgMissionList, STRMSG_C_080619_0202, pMsg->IncreaseCapacity, pMsg->nMemberCapacity);
		m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_SYSTEM); //"\\y여단 최대 제한인원 %d명이 증가 하였습니다. 현재 여단 최대 제한 인원은 %d명입니다."
		// end 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
	}	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketGuildStartWar(MSG_IC_GUILD_START_WAR* pMsg)
/// \brief		MSG_IC_GUILD_START_WAR
/// \author		dhkwon
/// \date		2004-07-27 ~ 2004-07-27
/// \warning	클라이언트는 T_FC_GUILD_GET_WAR_INFO_OK 받은 후에 진짜 시작이다.
///				
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildStartWar(MSG_IC_GUILD_START_WAR* pMsg)
{
	m_pChat->CreateChatChild(STRMSG_C_GUILD_0039, COLOR_SYSTEM);//"여단전이 시작되었습니다."
	MSG_FC_GUILD_GET_WAR_INFO sMsg;
	sMsg.GuildUID = g_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber;
	m_pFieldWinSocket->SendMsg( T_FC_GUILD_GET_WAR_INFO, (char*)&sMsg, sizeof(sMsg) );
	//g_pShuttleChild->m_bPKMode = TRUE;
	g_pShuttleChild->SetPkState( PK_GVG, TRUE );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketGuildEndWar(MSG_IC_GUILD_END_WAR* pMsg)
/// \brief		MSG_IC_GUILD_END_WAR
/// \author		dhkwon
/// \date		2004-07-27 ~ 2004-07-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildEndWar(MSG_IC_GUILD_END_WAR* pMsg)
{
	MSG_IC_GUILD_GET_GUILD_INFO_OK* pGuild = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
	if( pGuild)
	{
		char message[256];
		memset(message, 0x00, sizeof(message) );
		switch(pMsg->WarEndType)
		{
		case BATTLE_END_WIN:
			{// 승리
				wsprintf(message,STRMSG_C_GUILD_0040, pMsg->PeerGuildName);//"%s 여단과의 전쟁에서 승리하였습니다."
				MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
				if(pInfo)
				{
					pInfo->WarWinPoint++;
				}
			}
			break;
		case BATTLE_END_DEFEAT:
			{// 패배
				wsprintf(message,STRMSG_C_GUILD_0041, pMsg->PeerGuildName);//"%s 여단과의 전쟁에서 패배하였습니다."
				MSG_IC_GUILD_GET_GUILD_INFO_OK *pInfo = g_pGameMain->m_pCommunity->GetGuild()->GetGuildInfo();
				if(pInfo)
				{
					pInfo->WarLossPoint++;
				}
			}
			break;
		case BATTLE_END_TIE:
			{// 무승부
				wsprintf(message,STRMSG_C_GUILD_0042, pMsg->PeerGuildName);//"%s 여단과의 전쟁에서 승부를 가리지 못하였습니다."
			}
			break;
		case BATTLE_END_END:
			{// 그냥 종료되었습니다(이유불문)
				wsprintf(message,STRMSG_C_GUILD_0043, pMsg->PeerGuildName);//"%s 여단과의 전쟁이 종료되었습니다."
			}
			break;
		default:
			{
				DBGOUT("ERROR:MSG_IC_GUILD_END_WAR(%d)\n", pMsg->WarEndType);
			}
			break;
		}
		m_pChat->CreateChatChild(message, COLOR_SYSTEM);
	}
	if(g_pShuttleChild->m_pGuildWarInfo)
	{
		m_pScene->SetPKSettingGuildWar( g_pShuttleChild->m_pGuildWarInfo->PeerGuildUID, FALSE );
		SAFE_DELETE(g_pShuttleChild->m_pGuildWarInfo);
	}
	//g_pShuttleChild->m_bPKMode = FALSE;
	g_pShuttleChild->SetPkState( PK_GVG, FALSE );
}

VOID CAtumApplication::IMSocketInvalidPacket(char* pPacket)
{
	FLOG("CAtumApplication::IMSocketInvalidPacket(char* pPacket)");
	char * p = pPacket;
	MessageType_t	nType = 0;
	memcpy(&nType,p,sizeof(MessageType_t));
	char message[256];
	g_pIMSocket->CloseSocket();
#ifdef _DEBUG
	wsprintf(message,STRMSG_C_SERVER_0013,nType,GetProtocolTypeString(nType));//"존재하지 않은 메세지 타입 클라이언트를 종료 TYPE[%#04x] : %s"
#else
	wsprintf(message,STRMSG_C_SERVER_0013,nType,"IUnknown");//"존재하지 않은 메세지 타입 클라이언트를 종료"
#endif
	
	// 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리
	char chTmp[128];
	wsprintf(chTmp, "PreType[%04x]:%s", m_nPreIMComType, GetProtocolTypeString(m_nPreIMComType));
	if((strlen(message)+strlen(chTmp)) < 256)
	{
		strcat(message, chTmp);
	}
	// end 2007-07-10 by bhsohn 통신 타입 에러에 대한 처리

	NetworkErrorMsgBox(message);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoipGetAccountUniquenumberOk(MSG_IC_VOIP_GET_ACCOUNTUNIQUENUMBER_OK* pMsg)
/// \brief		음성 교신할 상대방 유니크 넘버 요청 결과, VOIP.exe에 REGISTER를 한다.(AV_MT_REGISTER)
/// \author		dhkwon
/// \date		2004-07-03 ~ 2004-07-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoipGetAccountUniquenumberOk(MSG_IC_VOIP_GET_ACCOUNTUNIQUENUMBER_OK* pMsg)
{
	m_VOIPState.nCalledAccountUniqueNumber = pMsg->nCalledAccountUniqueNumber;
	MSG_MT_REGISTER sMsg;
	sMsg.nAccountUniqueNumber = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
	strncpy( sMsg.szCharacterName, g_pShuttleChild->m_myShuttleInfo.CharacterName, SIZE_MAX_CHARACTER_NAME );
	COPYDATASTRUCT	copyData;
	memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
	AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_REGISTER, 0);
	copyData.dwData = (DWORD)voIP;
	copyData.lpData = &sMsg;
	copyData.cbData = sizeof(sMsg);
	::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoip1to1Dial(MSG_IC_VOIP_1to1_DIAL* pMsg)
/// \brief		통화 요청 받음, REGISTER 후에 통화 수락 여부를 물어본다.
/// \author		dhkwon
/// \date		2004-07-03 ~ 2004-07-03
/// \warning	MSG_IC_VOIP_1to1_DIAL는 통화 요청시 양쪽 클라이언트에서 사용한다.
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoip1to1Dial(MSG_IC_VOIP_1to1_DIAL* pMsg)
{
	if( m_VOIPState.nVOIPState == _VOIP_NOTLOGIN )
	{
		MSG_MT_REGISTER sMsg;
		sMsg.nAccountUniqueNumber = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
		strncpy( sMsg.szCharacterName, g_pShuttleChild->m_myShuttleInfo.CharacterName, SIZE_MAX_CHARACTER_NAME );
		COPYDATASTRUCT	copyData;
		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
		AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_REGISTER, 0);
		copyData.dwData = (DWORD)voIP;
//		copyData.dwData = MAKELONG(AV_MT_REGISTER, 0);
		copyData.lpData = &sMsg;
		copyData.cbData = sizeof(sMsg);
		strncpy( m_VOIPState.szName, pMsg->szCallerCharacterName, SIZE_MAX_CHARACTER_NAME );
		::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
		m_VOIPState.bCaller = FALSE;
		m_VOIPState.nVOIPState = _VOIP_TRY_REGISTER;
		m_VOIPState.nCalledAccountUniqueNumber = pMsg->nCallerAccountUniqueNumber;
	}
	else
	{
		MSG_IC_VOIP_ERROR sMsg;
		sMsg.nErrorNum = VOIPERR_1to1_CANNOT_CALL;
		sMsg.nSend2AccountUniqueNumber = pMsg->nCallerAccountUniqueNumber;
		g_pIMSocket->SendMsg( T_IC_VOIP_ERROR, (char*)&sMsg, sizeof(sMsg) );
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoip1to1DialOk(MSG_IC_VOIP_1to1_DIAL_OK* pMsg)
/// \brief		
/// \author		dhkwon
/// \date		2004-07-03 ~ 2004-07-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoip1to1DialOk(MSG_IC_VOIP_1to1_DIAL_OK* pMsg)
{
	// 통화 시작
	m_VOIPState.nVOIPState = _VOIP_DIALINGSTATE;
	MSG_MT_DIAL		msgMTDial;
	msgMTDial.nCalleeAccountUniqueNumber = pMsg->nCalledAccountUniqueNumber;
	g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_ONE);
	COPYDATASTRUCT	copyData;
	memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
	AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_DIAL, 0);
	copyData.dwData = (DWORD)voIP;
	copyData.lpData = &msgMTDial;
	copyData.cbData = sizeof(MSG_MT_DIAL);
	::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);


}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoip1to1End(MSG_IC_VOIP_1to1_END* pMsg)
/// \brief		통화 종료
/// \author		dhkwon
/// \date		2004-07-06 ~ 2004-07-06
/// \warning	내가 받은 경우 UNREGISTER호출
///				통화 종료버튼에서 MSG_IC_VOIP_END 호출
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoip1to1End(MSG_IC_VOIP_1to1_END* pMsg)
{
	// 2008-07-14 by dgwoo 음성통화 타잎셋팅.
	g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_NONE);
	COPYDATASTRUCT	copyData;
	memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
	AV_MSG_WM_COPYDATA voIP(_BothCall, AV_MT_UNREGISTER, 0);
	copyData.dwData = (DWORD)voIP;
	copyData.lpData = NULL;
	copyData.cbData = 0;
	::SendMessage( m_VOIPState.m_hWndAtumVoIPClient,
					WM_COPYDATA, (WPARAM)GetHwnd(),
					(LPARAM)&copyData);
	m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
	m_VOIPState.bCaller = FALSE;
	DBGOUT("IMSocketVoip1to1End by other \n");
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoipNtoNCreateRoomRequestOk(MSG_IC_VOIP_NtoN_CREATEROOM_REQUEST_OK* pMsg)
/// \brief		T_IC_VOIP_NtoN_CREATEROOM_REQUEST_OK
/// \author		dhkwon
/// \date		2004-08-30 ~ 2004-08-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoipNtoNCreateRoomRequestOk(MSG_IC_VOIP_NtoN_CREATEROOM_REQUEST_OK* pMsg)
{
	ASSERT_ASSERT(m_VOIPState.nVOIPState == _VOIP_TRY_REGISTER);
	if(pMsg->byIsPartyCall == TRUE) // 편대 통화
	{
		COPYDATASTRUCT	copyData;
		MSG_MT_PARTY_CREATE_ROOM sMsg;
		sMsg.llPartyID = g_pShuttleChild->m_pClientParty->GetPartyInfo().PartyID;
		sMsg.nAccountUniqueNumber = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
		// 2008-10-14 by bhsohn VOIP개선
		//sMsg.nConcurrentTalkingCount = g_pD3dApp->m_VOIPState.nConnectCount;
		sMsg.nConcurrentTalkingCount = SIZE_NORMAL_TALKING_USER_COUNT;

		strcpy( sMsg.szCharacterName, g_pShuttleChild->m_myShuttleInfo.CharacterName );

		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
		AV_MSG_WM_COPYDATA voIP(_NtoNCall, AV_MT_PARTY_CREATE_ROOM, 0);
		copyData.dwData = (DWORD)voIP;
		copyData.lpData = &sMsg;
		copyData.cbData = sizeof(sMsg);
		::SendMessage( m_VOIPState.m_hWndAtumVoIPClient,
						WM_COPYDATA, (WPARAM)GetHwnd(),
						(LPARAM)&copyData);
		g_pShuttleChild->m_pClientParty->SetNtoNCallState(TRUE);
		m_VOIPState.nCallState = _CALLSTATE_PARTY;
	}
	else // 여단 통화
	{
		COPYDATASTRUCT	copyData;
		MSG_MT_GUILD_CREATE_ROOM sMsg;
		sMsg.uiGuildUniqueNumber = g_pShuttleChild->m_myShuttleInfo.GuildUniqueNumber;
		sMsg.nAccountUniqueNumber = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
		// 2008-10-14 by bhsohn VOIP개선
		//sMsg.nConcurrentTalkingCount = g_pD3dApp->m_VOIPState.nConnectCount;
		sMsg.nConcurrentTalkingCount = SIZE_NORMAL_TALKING_USER_COUNT;
		
		strcpy( sMsg.szCharacterName, g_pShuttleChild->m_myShuttleInfo.CharacterName );

		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
		AV_MSG_WM_COPYDATA voIP(_NtoNCall, AV_MT_GUILD_CREATE_ROOM, 0);
		copyData.dwData = (DWORD)voIP;
		copyData.lpData = &sMsg;
		copyData.cbData = sizeof(sMsg);
		::SendMessage( m_VOIPState.m_hWndAtumVoIPClient,
						WM_COPYDATA, (WPARAM)GetHwnd(),
						(LPARAM)&copyData);
		g_pGameMain->m_pCommunity->GetGuild()->SetNtoNCallState(TRUE);
		//g_pShuttleChild->m_pClientParty->SetNtoNCallState(TRUE);
		m_VOIPState.nCallState = _CALLSTATE_GUILD;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoipNtoNInviteYou(MSG_IC_VOIP_NtoN_INVITE_YOU* pMsg)
/// \brief		T_IC_VOIP_NtoN_INVITE_YOU
/// \author		dhkwon
/// \date		2004-08-30 ~ 2004-08-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoipNtoNInviteYou(MSG_IC_VOIP_NtoN_INVITE_YOU* pMsg)
{
	if( pMsg->byIsPartyCall == TRUE ) // 편대 통화
	{
		if(m_VOIPState.nVOIPState == _VOIP_NOTLOGIN)
		{
			g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_VOIP_0003, _Q_JOIN_PARTY_VOIP);
		}
		else
		{
			m_pChat->CreateChatChild(STRERR_C_VOIP_0005,COLOR_VOIP);
		}
	}
	else // 여단 통화
	{
		if(m_VOIPState.nVOIPState == _VOIP_NOTLOGIN)
		{
			g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_VOIP_0005, _Q_JOIN_GUILD_VOIP);
		}
		else
		{
			m_pChat->CreateChatChild(STRERR_C_VOIP_0006,COLOR_VOIP);
		}
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketVoipNtoNGooutAll(MSG_IC_VOIP_NtoN_GOOUT_ALL* pMsg)
/// \brief		편대장/여단장에 의한 NtoN 통화 종료
/// \author		dhkwon
/// \date		2004-10-05 ~ 2004-10-05
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketVoipNtoNGooutAll(MSG_IC_VOIP_NtoN_GOOUT_ALL* pMsg)
{
	COPYDATASTRUCT	copyData;
	memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
	copyData.dwData = MAKELONG(AV_MT_UNREGISTER, 0);
	copyData.lpData = NULL;
	copyData.cbData = 0;
	::SendMessage( m_VOIPState.m_hWndAtumVoIPClient,
					WM_COPYDATA, (WPARAM)GetHwnd(),
					(LPARAM)&copyData);
	m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
	m_VOIPState.bCaller = FALSE;
	g_pShuttleChild->m_pClientParty->SetNtoNCallState(FALSE);
	g_pGameMain->m_pCommunity->GetGuild()->SetNtoNCallState(FALSE);

	if( pMsg->byIsPartyCall == TRUE ) // 편대 통화
	{
		m_pChat->CreateChatChild(STRMSG_C_VOIP_0020,COLOR_VOIP);
	}
	else // 여단 통화
	{
		m_pChat->CreateChatChild(STRMSG_C_VOIP_0019,COLOR_VOIP);
	}
}
VOID CAtumApplication::IMSocketVoIPSetOK(MSG_IC_VOIP_SET_OK* pMsg)
{
	if( pMsg->VoipType == CHECK_TYPE_VOIP_PARTY)
	{
		g_pShuttleChild->m_pClientParty->SetVoiceParty(pMsg->CharacterUID);
	}
	else if( pMsg->VoipType == CHECK_TYPE_VOIP_GUILD)
	{
		g_pGameMain->m_pCommunity->GetGuild()->SetVoiceGuild(pMsg->CharacterUID);
	}
	else if(pMsg->VoipType == CHECK_TYPE_VOIP_NONE)
	{
		g_pShuttleChild->m_pClientParty->NoneVoiceParty(pMsg->CharacterUID);
		g_pGameMain->m_pCommunity->GetGuild()->NoneVoiceGuild(pMsg->CharacterUID);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatFriendlistAll(MSG_IC_CHAT_FRIENDLIST_LOADING_OK* pMsg)
/// \brief		친구리스트 받기
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatFriendlistAll(MSG_IC_CHAT_FRIENDLIST_LOADING_OK* pMsg)
{
	Friend_t temp_friend;
	// 2008-10-24 by bhsohn 친구, 거부 리스트 49명만 되는 현상 처리
	//g_pGameMain->m_pCommunity->GetFriend()->ResetFriendList();	

	FRIENDINFO *pfriendinfo = (FRIENDINFO *)((char *)pMsg + sizeof(MSG_IC_CHAT_FRIENDLIST_LOADING_OK));
	for(int i=0; i<pMsg->nFriendListCounts; i++)
	{
		memset(&temp_friend, 0x00, sizeof(Friend_t));
		strncpy(temp_friend.szFriendName, pfriendinfo->szCharacterName, SIZE_MAX_CHARACTER_NAME);
		temp_friend.bOnline			= pfriendinfo->byIsOnline;
		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
		//g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.push_back(temp_friend);
		g_pGameMain->m_pCommunity->GetFriend()->AddFriendList(temp_friend);
		pfriendinfo++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatFriendlistInsertOk(MSG_IC_CHAT_FRIENDLIST_INSERT_OK* pMsg);
/// \brief		친구리스트 삽입 OK
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatFriendlistInsertOk(MSG_IC_CHAT_FRIENDLIST_INSERT_OK* pMsg)
{
	Friend_t temp_friend;
	memset(&temp_friend, 0x00, sizeof(Friend_t));

	strncpy(temp_friend.szFriendName, pMsg->szCharacterName, SIZE_MAX_CHARACTER_NAME);
	temp_friend.bOnline = pMsg->byIsOnline;
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	//g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.push_back(temp_friend);
	g_pGameMain->m_pCommunity->GetFriend()->AddFriendList(temp_friend);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatRejectlistAll(MSG_IC_CHAT_REJECTLIST_LOADING_OK* pMsg);
/// \brief		거부 리스트 받기
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatRejectlistAll(MSG_IC_CHAT_REJECTLIST_LOADING_OK* pMsg)
{
	Reject_t temp_reject;
	
	// 2008-10-24 by bhsohn 친구, 거부 리스트 49명만 되는 현상 처리
	//g_pGameMain->m_pCommunity->GetReject()->InitRejectList();

	FRIENDINFO *prejectinfo = (FRIENDINFO *)((char *)pMsg + sizeof(MSG_IC_CHAT_REJECTLIST_LOADING_OK));
	for(int i=0; i<pMsg->nRejectListCounts; i++)
	{
		memset(&temp_reject, 0x00, sizeof(Reject_t));
		strncpy(temp_reject.szRejectName, prejectinfo->szCharacterName, SIZE_MAX_CHARACTER_NAME);
		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
		temp_reject.atimeRegTime = prejectinfo->RegDate;
		//g_pGameMain->m_pCommunity->GetReject()->m_vecReject.push_back(temp_reject);
		g_pGameMain->m_pCommunity->GetReject()->AddRejectList(temp_reject);
		prejectinfo++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatRejectlistInsertOk(MSG_IC_CHAT_REJECTLIST_INSERT_OK* pMsg)
/// \brief		거부 리스트 받기 OK
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatRejectlistInsertOk(MSG_IC_CHAT_REJECTLIST_INSERT_OK* pMsg)
{
	Reject_t temp_reject;
	memset(&temp_reject, 0x00, sizeof(Reject_t));

	strncpy(temp_reject.szRejectName, pMsg->szCharacterName, SIZE_MAX_CHARACTER_NAME);
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
	temp_reject.atimeRegTime = pMsg->RegDate;

	//g_pGameMain->m_pCommunity->GetReject()->m_vecReject.push_back(temp_reject);
	g_pGameMain->m_pCommunity->GetReject()->AddRejectList(temp_reject);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatFriendlistRefreshOk(MSG_IC_CHAT_FRIENDLIST_REFRESH_OK* pMsg)
/// \brief		갱신
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatFriendlistRefreshOk(MSG_IC_CHAT_FRIENDLIST_REFRESH_OK* pMsg)
{
	FRIENDINFO *pfriendinfo = (FRIENDINFO *)((char *)pMsg + sizeof(MSG_IC_CHAT_FRIENDLIST_REFRESH_OK));
	for(int i=0; i<pMsg->nFriendListCounts; i++)
	{
		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
//		vector<Friend_t>::iterator it = g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.begin();
//		while(it != g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.end())
//		{
//			if(0 == strncmp(pfriendinfo->szCharacterName, it->szFriendName, SIZE_MAX_CHARACTER_NAME))
//			{
//				it->bOnline			= pfriendinfo->byIsOnline;
//			}
//			it++;
//		}		
		g_pGameMain->m_pCommunity->GetFriend()->FriendListRefresh(pfriendinfo->szCharacterName, pfriendinfo->byIsOnline);
		pfriendinfo++;
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatFriendlistDeleteOk(MSG_IC_CHAT_FRIENDLIST_DELETE_OK* pMsg)
/// \brief		프렌드 리스트 지우기
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatFriendlistDeleteOk(MSG_IC_CHAT_FRIENDLIST_DELETE_OK* pMsg)
{
	// 2008-04-04 by bhsohn Ep3 커뮤니티 창
//	vector<Friend_t>::iterator it = g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.begin();
//	while(it != g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.end())
//	{
//		if(0 == strncmp(pMsg->szCharacterName, it->szFriendName, SIZE_MAX_CHARACTER_NAME))
//		{
//			g_pGameMain->m_pCommunity->GetFriend()->m_vecFriend.erase(it);
//			break;
//		}
//		it++;
//	}
	g_pGameMain->m_pCommunity->GetFriend()->DeleteFriendList(pMsg->szCharacterName);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketChatRejectlistDeleteOk(MSG_IC_CHAT_REJECTLIST_DELETE_OK* pMsg)
/// \brief		거부리스트 지우기
/// \author		ydkim
/// \date		
///////////////////////////////////////////////////////////////////////////////
VOID	CAtumApplication::IMSocketChatRejectlistDeleteOk(MSG_IC_CHAT_REJECTLIST_DELETE_OK* pMsg)
{
	vector<Reject_t>::iterator it = g_pGameMain->m_pCommunity->GetReject()->m_vecReject.begin();
	while(it != g_pGameMain->m_pCommunity->GetReject()->m_vecReject.end())
	{
		if(0 == stricmp(pMsg->szCharacterName, it->szRejectName))
		{
			g_pGameMain->m_pCommunity->GetReject()->m_vecReject.erase(it);
			break;
		}
		it++;
	}	
}

void CAtumApplication::IMSocketVoipError(MSG_IC_VOIP_ERROR* pMsg)
{

	// 2008-07-17 by dgwoo 에러시 보이스 컨트롤러 창을 새로 띄우진 않는다.
	//g_pGameMain->m_pChat->ShowVoiceChatControl(TRUE); 
	switch(pMsg->nErrorNum)
	{
	case VOIPERR_1to1_NO_SUCH_CHARACTER:
		{
			// 2009-01-12 by bhsohn 일본 추가 수정사항
			//m_pChat->CreateChatChild(STRERR_C_VOIP_0001,COLOR_VOIP);
			m_pChat->CreateChatChild(STRMSG_C_090112_0204,COLOR_VOIP);
			// end 2009-01-12 by bhsohn 일본 추가 수정사항

			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
			m_VOIPState.bCaller = FALSE;
		}
		break;
	case VOIPERR_1to1_NO_SUCH_ACCOUNTUNIQUENUMBER:
		{
			m_pChat->CreateChatChild(STRERR_C_VOIP_0002,COLOR_VOIP);
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
			m_VOIPState.bCaller = FALSE;
		}
		break;
	case VOIPERR_1to1_CANNOT_CALL:
		{
			m_pChat->CreateChatChild(STRERR_C_VOIP_0003,COLOR_VOIP);
			// UNREGISTER
			COPYDATASTRUCT	copyData;
			memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
			AV_MSG_WM_COPYDATA voIP(_BothCall, AV_MT_UNREGISTER, 0);
			copyData.dwData = (DWORD)voIP;
			copyData.lpData = NULL;
			copyData.cbData = 0;
			::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
			// State 초기화
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
			m_VOIPState.bCaller = FALSE;
		}
		break;
	case VOIPERR_1to1_REJECT:
		{
			m_pChat->CreateChatChild(STRERR_C_VOIP_0004,COLOR_VOIP);
			// UNREGISTER
			COPYDATASTRUCT	copyData;
			memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
			AV_MSG_WM_COPYDATA voIP(_BothCall, AV_MT_UNREGISTER, 0);
			copyData.dwData = (DWORD)voIP;
			copyData.lpData = NULL;
			copyData.cbData = 0;
			::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copyData);
			// State 초기화
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
			m_VOIPState.bCaller = FALSE;

		}
		break;
//	case VOIPERR_NtoN_NO_SUCH_CHARACTER:
//		{
//		}
//		break;
	default:
		{
		}
		break;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketAdminCallGMInfoOk(MSG_IC_ADMIN_CALLGM_INFO_OK* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-05-08 ~ 2006-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketAdminCallGMInfoOk(MSG_IC_ADMIN_CALLGM_INFO_OK* pMsg)
{
	char str[64] = {0,};
	wsprintf(str,STRMSG_C_060509_0000,pMsg->nCallGMTotalCount);		// "현재 미처리 문의가 %d개 있습니다."
	m_pChat->CreateChatChild(str,COLOR_CHAT_ALL, CHAT_TAB_NORMAL);
}
	
///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketAdminCallGMViewOk(char* pPacket)
/// \brief		
/// \author		ispark
/// \date		2006-05-08 ~ 2006-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketAdminCallGMViewOk(char* pPacket)
{
	if(m_dwGameState == _GAME || m_dwGameState == _SHOP || m_dwGameState == _CITY)
	{
		MSG_IC_ADMIN_CALLGM_VIEW_OK	*pCallGM_View = NULL;
		char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+36];
		memset(bufChat, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+36);
		pCallGM_View = (MSG_IC_ADMIN_CALLGM_VIEW_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER);
		for(int i = 0; i < pCallGM_View->nCallGMCount; i++)
		{
			int temp,temp2;
			SCALLGM *pScallGM = (SCALLGM*)(pPacket + SIZE_FIELD_TYPE_HEADER + sizeof(MSG_IC_ADMIN_CALLGM_VIEW_OK) + sizeof(SCALLGM)*i);
			char strDescription[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME];
			memset(strDescription, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME);
			memcpy(strDescription, pScallGM->szCallGMDescription, SIZE_MAX_CHAT_MESSAGE);

			CheckReadyStringFiltering(strDescription, &temp, &temp2);

			wsprintf(bufChat, STRMSG_C_060509_0001, 
						pScallGM->szCallerCharacterName, 
						pScallGM->atimeCallTime.GetLocalDateTimeString(string(),GetLanguageType()), 
						strDescription);	// "[%s][%s][%s]" // [캐릭터명][시간][내용]
			m_pChat->CreateChatChild(bufChat,COLOR_CHAT_ALL, CHAT_TAB_NORMAL);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::IMSocketAdminCallGMBringOk(char* pPacket)
/// \brief		
/// \author		ispark
/// \date		2006-05-08 ~ 2006-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketAdminCallGMBringOk(char* pPacket)
{
	if(m_dwGameState == _GAME || m_dwGameState == _SHOP || m_dwGameState == _CITY)
	{
		MSG_IC_ADMIN_CALLGM_BRING_OK	*pCallGM_Bring = NULL;
		// 2009-02-05 by bhsohn /bringCallgm 죽는 문제 해결
		//char bufChat[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4];
		char bufChat[MAX_PATH];
		// end 2009-02-05 by bhsohn /bringCallgm 죽는 문제 해결

		char bufCallerInfl[SIZE_MAX_CHAT_MESSAGE];					// CallerInflTy
		char bufCallerInflTemp[SIZE_MAX_CHAT_MESSAGE];					// CallerInflTy
		// 2009-02-05 by bhsohn /bringCallgm 죽는 문제 해결
		//memset(bufChat, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME+4);
		ZERO_MEMORY(bufChat);
		// end 2009-02-05 by bhsohn /bringCallgm 죽는 문제 해결

		pCallGM_Bring = (MSG_IC_ADMIN_CALLGM_BRING_OK*)(pPacket + SIZE_FIELD_TYPE_HEADER);
		for(int i = 0; i < pCallGM_Bring->nCallGMCount; i++)
		{
			int temp,temp2;
			SCALLGM *pScallGM = (SCALLGM*)(pPacket + SIZE_FIELD_TYPE_HEADER + sizeof(MSG_IC_ADMIN_CALLGM_BRING_OK) + sizeof(SCALLGM)*i);
			char strDescription[SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME];
			memset(strDescription, 0x00, SIZE_MAX_CHAT_MESSAGE + SIZE_MAX_CHARACTER_NAME);
			memcpy(strDescription, pScallGM->szCallGMDescription, SIZE_MAX_CHAT_MESSAGE);

			// 2007-11-19 by dgwoo 진정 시스템 수정안.
			memset(bufCallerInfl,0x00,SIZE_MAX_CHAT_MESSAGE);
			memset(bufCallerInflTemp,0x00,SIZE_MAX_CHAT_MESSAGE);
			GetInfluenceString(bufCallerInflTemp,pScallGM->CallerInflTy);
			wsprintf(bufCallerInfl ,STRMSG_C_071119_0100,pScallGM->szCallerCharacterName,bufCallerInflTemp);

			CheckReadyStringFiltering(strDescription, &temp, &temp2);

			wsprintf(bufChat, STRMSG_C_060509_0001, 
						bufCallerInfl, 
						pScallGM->atimeCallTime.GetLocalDateTimeString(string(),GetLanguageType()),
						strDescription);		// "[%s][%s][%s]" // [캐릭터명][시간][내용]
			m_pChat->CreateChatChild(bufChat,COLOR_CHAT_ALL,CHAT_TAB_PTOP, g_pShuttleChild->m_myShuttleInfo.CharacterName, bufCallerInfl);

			if(strcmp(m_pShuttleChild->m_myShuttleInfo.CharacterName,pScallGM->szCallerCharacterName))
			{
				bool bChatCheckPToP = false;
				for(int i=0;i<MAX_CHAT_PTOP_CONT;i++)
				{
					if(!strcmp(m_pShuttleChild->m_strChatPToP[i],pScallGM->szCallerCharacterName))
					{
						m_pShuttleChild->m_bOldPToPPos = i;
						bChatCheckPToP = true;
						break;
					}
				}
				if(!bChatCheckPToP)
				{
					memset(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bCurPToPPos],0x00,SIZE_MAX_CHARACTER_NAME);
					strncpy(m_pShuttleChild->m_strChatPToP[m_pShuttleChild->m_bCurPToPPos],pScallGM->szCallerCharacterName,strlen(pScallGM->szCallerCharacterName));
					m_pShuttleChild->m_bOldPToPPos = m_pShuttleChild->m_bCurPToPPos;
					m_pShuttleChild->m_bCurPToPPos++;
					if(m_pShuttleChild->m_bCurPToPPos == MAX_CHAT_PTOP_CONT)
						m_pShuttleChild->m_bCurPToPPos = 0;
				}
			}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \class		IMSocketGuildEndWarAdminNotify((MSG_IC_GUILD_END_WAR_ADMIN_NOTIFY*)
/// \brief		길드전 결과를 관리자는 운영자에게만 보여준다.(채팅창)
///
/// \author		dgwoo
/// \version	
/// \date		2006-08-09 ~ 2006-08-09
/// \warning	
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildEndWarAdminNotify(MSG_IC_GUILD_END_WAR_ADMIN_NOTIFY* pMsg)
{
	char buf[512];
	if(pMsg->WarEndType)
	{
		wsprintf(buf,STRMSG_C_060809_0101,pMsg->WinerGuildName,pMsg->LoserGuildName);
		m_pChat->CreateChatChild(buf,COLOR_TRADE);
	}
	else
	{
		wsprintf(buf,STRMSG_C_060809_0100,pMsg->WinerGuildName,pMsg->LoserGuildName);
		m_pChat->CreateChatChild(buf,COLOR_TRADE);
	}
}

VOID CAtumApplication::IMSocketChatRoomCreateOK(MSG_IC_CHATROOM_CREATE_OK* pMsg)
{
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	pChatRoom->CreateMyRoomOK(pMsg);
	g_pGameMain->m_pChat->SetChatRoomAct(TRUE);

}
VOID CAtumApplication::IMSocketChatRoomListInfoOK(MSG_IC_CHATROOM_LIST_INFO_OK* pMsg)
{
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom(); 
	pChatRoom->AddRoomList(pMsg);
}
VOID CAtumApplication::IMSocketChatRoomRequestInviteQuestion(MSG_IC_CHATROOM_REQUEST_INVITE_QUESTION *pMsg)
{
	// 2008-07-14 by bhsohn EP3 관련 처리
	// 2013-07-22 by bhsohn 거부리스트 안전코드 추가
	if(g_pGameMain && g_pGameMain->IsRejectUser(pMsg->ChatRoomMasterName))
	{
		
		return;
	}
	// end 2008-07-14 by bhsohn EP3 관련 처리

	char buf[128];
	memset(buf,0x00,128);
	wsprintf(buf,STRMSG_C_080625_0104,pMsg->ChatRoomMasterName);
	g_pGameMain->m_pInfWindow->AddMsgBox(buf, _Q_CHATROOM_INVITE_FROM,0,0,0,pMsg->ChatRoomNum);
	
}
VOID CAtumApplication::IMSocketChatRoomJoinOK()
{
}
VOID CAtumApplication::IMSocketChatRoomAcceptInviteOK(MSG_IC_CHATROOM_ACCEPT_INVITE_OK* pMsg)
{
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom(); 
	pChatRoom->AddMyRoomInvite(pMsg);
	g_pGameMain->m_pChat->SetChatRoomAct(TRUE);

}
VOID CAtumApplication::IMSocketChatRoomRejectInviteOK()
{
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::IMSocketChatRoomLeaveOK(MSG_IC_CHATROOM_LEAVE_OK* pMsg)
/// \brief		같은 방에 있는 유저가 채팅방을 나갔을때.
/// \author		dgwoo
/// \date		2008-06-30 ~ 2008-06-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketChatRoomLeaveOK(MSG_IC_CHATROOM_LEAVE_OK* pMsg)
{
	if(g_pGameMain)
	{
		CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom(); 
		pChatRoom->ChatRoomLeaveOK(pMsg);
	}
	
}
VOID CAtumApplication::IMSocketChatRoomBanOK(MSG_IC_CHATROOM_BAN_OK* pMsg)
{
	if(g_pGameMain)
	{

		CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
		//m_pChat->CreateChatChild(STRMSG_C_080625_0108,COLOR_ITEM);
		pChatRoom->ChatRoomBan(pMsg);

		//pChatRoom->InitMyChatRoom();
	}
}
VOID CAtumApplication::IMSocketChatRoomChangeNameOK(MSG_IC_CHATROOM_CHANGE_NAME_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		memcpy(pChatRoom->m_stMyRoomInfo.ChatRoomName,pMsg->ChatRoomName,SIZE_MAX_CHATROOM_NAME);
		pChatRoom->m_pEBChatRoomCS->SetString(pChatRoom->m_stMyRoomInfo.ChatRoomName,SIZE_MAX_CHATROOM_NAME);
	}
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정

}
VOID CAtumApplication::IMSocketChatroomChangeMasterOK(MSG_IC_CHATROOM_CHANGE_MASTER_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		pChatRoom->m_stMyRoomInfo.MasterCharacterUID = pMsg->NewCharacterUID;
		pChatRoom->SetButtonActive();
	}
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정
}
VOID CAtumApplication::IMSocketChatRoomChangeLockPWOK(MSG_IC_CHATROOM_CHANGE_LOCK_PW_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		pChatRoom->ChangeLockPWOK(pMsg);
	
	}	
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::IMSocketChatRoomMemberInfoOK(MSG_IC_CHATROOM_MEMBER_INFO_OK* pMsg)
/// \brief		내방 정보를 보내준다. (입장 버튼.)
/// \author		dgwoo
/// \date		2008-06-30 ~ 2008-06-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketChatRoomMemberInfoOK(MSG_IC_CHATROOM_MEMBER_INFO_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		pChatRoom->AddMyRoomInfo(pMsg);
		g_pGameMain->m_pChat->SetChatRoomAct(TRUE);
	}
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::IMSocketChatRoomOtherMemberInfoOK(MSG_IC_CHATROOM_MEMBER_INFO_OK* pMsg)
/// \brief		다른 방 유저 정보를 보내주는 프로토콜.
/// \author		dgwoo
/// \date		2008-06-30 ~ 2008-06-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketChatRoomOtherMemberInfoOK(MSG_IC_CHATROOM_MEMBER_INFO_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		pChatRoom->AddOtherRoomInfo(pMsg);
	}
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정
}
VOID CAtumApplication::IMSocketChatRoomChangeMaxMemberOK(MSG_IC_CHATROOM_CHANGE_MAX_MEMBER_OK* pMsg)
{
	// 2009-04-13 by bhsohn 채팅 방 버그 수정
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}	
	CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
	if(pChatRoom)
	{
		pChatRoom->m_stMyRoomInfo.ChatRoomMaxCount = pMsg->ChatRoomMaxMember;
		pChatRoom->m_pLBChatRoom->SetSelectItem(pChatRoom->GetListBoxSelectItem(pMsg->ChatRoomMaxMember));
	}
	// end 2009-04-13 by bhsohn 채팅 방 버그 수정
}

VOID CAtumApplication::OnRecvCopyData(WPARAM wParam, COPYDATASTRUCT* pCopyDataStruct)
{
	FLOG("CAtumApplication::OnRecvCopyData(WPARAM wParam, COPYDATASTRUCT* pCopyDataStruct)");
	AV_MSG_WM_COPYDATA voIP(pCopyDataStruct->dwData);
	char buf[256];


	switch(voIP.nMsgType)
	{
	case AV_EV_CLIENT_ERROR:
		{
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;// 에러 state로 두지 않는다. 차후에 다시 시도할때 정상으로 돌아 올수 있기 때문
			g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_NONE);
			short nErrCode = voIP.nMsgParam;
			if(voIP.nCallType == _1to1Call)
			{
				switch(nErrCode)
				{
				case 1:
					wsprintf(buf,STRERR_C_VOIP_0007);//"[음성 에러] Invalid product"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 2:
					wsprintf(buf,STRERR_C_VOIP_0008);//"[음성 에러] Invalid PCN"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 3:
					wsprintf(buf,STRERR_C_VOIP_0009);//"[음성 에러] Invalid Number"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 4:
					wsprintf(buf,STRERR_C_VOIP_0010);//"[음성 에러] Server Error"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 5:
					wsprintf(buf,STRERR_C_VOIP_0011);//"[음성 에러] No Free Channel"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 6:
					wsprintf(buf,STRERR_C_VOIP_0012);//"[음성 에러] Network Error"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 7:
					wsprintf(buf,STRERR_C_VOIP_0013);//"[음성 에러] No bandwidth"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 12:
					wsprintf(buf,STRERR_C_VOIP_0014);//"[음성 에러] No Permission"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 17:
					wsprintf(buf,STRERR_C_VOIP_0015);//"[음성 에러] Busy.. Try again"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 30:
					wsprintf(buf,STRERR_C_VOIP_0016);//"[음성 에러] No Answer"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 31:
					wsprintf(buf,STRERR_C_VOIP_0017);//"[음성 에러] Already login"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 32:
					wsprintf(buf,STRERR_C_VOIP_0018);//"[음성 에러] Incorrect pwd"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 35:
					wsprintf(buf,STRERR_C_VOIP_0019);//"[음성 에러] Not Login"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 36:
					wsprintf(buf,STRERR_C_VOIP_0020);//"[음성 에러] [  ]"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 50:
					wsprintf(buf,STRERR_C_VOIP_0021);//"[음성 에러] Using Serial Port"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				case 51:
					wsprintf(buf,STRERR_C_VOIP_0022);//"[음성 에러] Invalid Serial Port"
					m_pChat->CreateChatChild(buf,COLOR_VOIP,CHAT_TAB_SOUND);
					break;
				}
			}
			else // NtoN
			{
				m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;// 에러 state로 두지 않는다. 차후에 다시 시도할때 정상으로 돌아 올수 있기 때문
				m_VOIPState.bCaller = FALSE;
				m_VOIPState.nCallState = _CALLSTATE_1TO1;
				ASSERT_IMPLIES(g_pShuttleChild, g_pShuttleChild->m_pClientParty);
				g_pShuttleChild->m_pClientParty->SetNtoNCallState(FALSE);
				ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
				g_pGameMain->m_pCommunity->GetGuild()->SetNtoNCallState(FALSE);
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_NONE);
				switch(nErrCode)
				{
				case _SC2_NO_ERROR:
					{
					}
					break;
				case _SC2_NORMAL_ERROR:
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0023,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 알수없는 에러입니다."
					}
					break;
				case _SC2_INVALID_STATUS_ERROR://상태
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0024,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 상태 에러입니다."
					}
					break;
				case _SC2_INVALID_PARAM_ERROR://인자
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0025,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 파라미터 에러입니다."
					}
					break;
				case _SC2_INVALID_ROOMID_ERROR://방아이디
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0026,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 편대통화 생성 에러입니다."
					}
					break;
				case _SC2_CONNECT_VDSERVER_ERROR://연결에러
				case _SC2_CONNECT_VCSERVER_ERROR:
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0027,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 서버 연결 에러입니다.",
					}
					break;
				case _SC2_VOIP_SERVER_ERROR://프로토콜 에러
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0028,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화 에러] 프로토콜 에러입니다."
					}
					break;
				default:
					{
						m_pChat->CreateChatChild(STRERR_C_VOIP_0029,COLOR_VOIP,CHAT_TAB_SOUND);//"[편대/여단통화] 알수 없는 에러입니다."
					}
					break;
				}
			}
		}
		break;
	case AV_EV_CLIENT_STATUS:
		{
			short	nStatus= voIP.nMsgParam;
			if(voIP.nCallType == _1to1Call)
			{
				switch(nStatus)
				{
				case -1:
					wsprintf(buf,STRERR_C_VOIP_0030);//"음성교신 서버 점검중입니다."
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
					break;
				case 0:
					wsprintf(buf,STRMSG_C_VOIP_0021);//"음성교신 서비스 [ Ready ]"
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					m_VOIPState.nVOIPState = _VOIP_REGISTERED;
					
					// 창끄기 옵션에 의한 설정
					if((g_pGameMain != NULL) && (TRUE == g_pGameMain->m_pInfWindow->m_bMessageBoxFlag))
					{
						// UNREGISTER
						COPYDATASTRUCT	copyData;
						memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
						AV_MSG_WM_COPYDATA voIP(_BothCall, AV_MT_UNREGISTER, 0);
						copyData.dwData = (DWORD)voIP;
						copyData.lpData = NULL;
						copyData.cbData = 0;
						::SendMessage( m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA,
										(WPARAM)g_pD3dApp->GetHwnd(), 
										(LPARAM)&copyData);

						MSG_IC_VOIP_ERROR sMsg;
						sMsg.nErrorNum = VOIPERR_1to1_REJECT;
						sMsg.nSend2AccountUniqueNumber = m_VOIPState.nCalledAccountUniqueNumber;
						g_pIMSocket->SendMsg( T_IC_VOIP_ERROR, (char*)&sMsg, sizeof(sMsg) );
						m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
						m_VOIPState.bCaller = FALSE;
					}
					break;
				case 1:
					wsprintf(buf,STRMSG_C_VOIP_0022);//"음성교신 서비스 [ Connecting ]"
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					break;
				case 2:
					wsprintf(buf,STRMSG_C_VOIP_0023);//"음성교신 서비스 [ Ringing ]"
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					m_VOIPState.nVOIPState = _VOIP_ALERTINGSTATE;
					break;
				case 3:
					wsprintf(buf,STRMSG_C_VOIP_0024);//"통화가 시작되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					m_VOIPState.nVOIPState = _VOIP_DIALINGSTATE;
					
					break;
				case 4:
					wsprintf(buf,STRMSG_C_VOIP_0025);//"음성교신 서비스 [ Error ]"//
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					break;
				default:
					wsprintf(buf,STRMSG_C_VOIP_0026);//"음성교신 서비스 [ Unknown Status ]"
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
					break;
				}
			}
			else // NtoN
			{
				switch(nStatus)
				{
				case _SC2_ERROR_STATUS:
					{
						m_pChat->CreateChatChild(STRMSG_C_VOIP_0027,COLOR_VOIP);//"[편대/여단통화] 서버 점검중입니다."
						m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
					}
					break;
				case _SC2_READY_STATUS: // not login
					{
						m_pChat->CreateChatChild(STRMSG_C_VOIP_0028,COLOR_VOIP);//"[편대/여단통화] 접속중..."
						m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
					}
					break;
				case _SC2_CONNECTING_VDSERVER_STATUS: // connecting
				case _SC2_CONNECTED_VDSERVER_STATUS: // connecting
					{
						m_VOIPState.nVOIPState = _VOIP_TRY_REGISTER;
					}
					break;
				case _SC2_CONNECTING_VCSERVER_STATUS:
				case _SC2_CONNECTED_VCSERVER_STATUS:
					{
						m_pChat->CreateChatChild(STRMSG_C_VOIP_0029,COLOR_VOIP);//"[편대/여단통화] 연결중..."
						m_VOIPState.nVOIPState = _VOIP_TRY_REGISTER;
					}
					break;
				case _SC2_CREATED_ROOM_STATUS:// registered
				case _SC2_JOINED_ROOM_STATUS:// registered
					{
						m_pChat->CreateChatChild(STRMSG_C_VOIP_0030, COLOR_VOIP);//"[편대/여단통화] 통화가 시작되었습니다. 말하기 단축키는 'Z' 입니다."
						m_VOIPState.nVOIPState = _VOIP_DIALINGSTATE;
						
					}
					break;
				}
			}
		}
		break;
	case AV_EV_EXECUTE_OK:
		{
			m_VOIPState.m_hWndAtumVoIPClient = (HWND)wParam;
			m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
		}
		break;
	case AV_EV_REGISTERED:
		{
			if(m_VOIPState.bCaller == TRUE)
			{
				MSG_IC_VOIP_1to1_DIAL sMsg;
				sMsg.nCallerAccountUniqueNumber = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
				sMsg.nCalledAccountUniqueNumber = m_VOIPState.nCalledAccountUniqueNumber;
				strncpy(sMsg.szCallerCharacterName, m_pShuttleChild->m_myShuttleInfo.CharacterName, SIZE_MAX_CHARACTER_NAME );
				m_pIMSocket->SendMsg( T_IC_VOIP_1to1_DIAL, (char*)&sMsg, sizeof(sMsg) );
				m_VOIPState.nVOIPState = _VOIP_DIALBLOCK;
			}
			else
			{
				wsprintf(buf,STRMSG_C_VOIP_0001,m_VOIPState.szName);
				g_pGameMain->m_pInfWindow->AddMsgBox(buf, _Q_VOIP_OK,0,0,DELETE_MASSAGEBOX_TIME,0,m_VOIPState.szName);
				m_VOIPState.nVOIPState = _VOIP_REGISTERED;
			}
		}
		break;
	case AV_EV_CREATE_ROOM_OK:
		{
			MSG_IC_VOIP_NtoN_INVITE_ALL sMsg;
			if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
			{
				m_pChat->CreateChatChild(STRMSG_C_VOIP_0031,COLOR_VOIP);//"편대간 통화가 시작되었습니다. 말하기 단축키는 'Z' 입니다."
				sMsg.byIsPartyCall = TRUE;
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_PARTY);
				
			}
			else
			{
				m_pChat->CreateChatChild(STRMSG_C_VOIP_0032,COLOR_VOIP);//"여단 통화가 시작되었습니다. 말하기 단축키는 'Z' 입니다."
				sMsg.byIsPartyCall = FALSE;
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_GUILD);
			}
			m_pIMSocket->SendMsg( T_IC_VOIP_NtoN_INVITE_ALL, (char*)&sMsg, sizeof(sMsg) );
//			g_pIMSocket->WriteMessageType( T_IC_VOIP_NtoN_INVITE_ALL );
		}
		break;
	case AV_EV_JOIN_ROOM_OK:
		{
			g_pShuttleChild->m_pClientParty->SetNtoNCallState(TRUE);
			m_VOIPState.nVOIPState = _VOIP_DIALINGSTATE;
			if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
			{
				m_pChat->CreateChatChild(STRMSG_C_VOIP_0031,COLOR_VOIP);//"편대간 통화가 시작되었습니다. 말하기 단축키는 'Z' 입니다."
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_PARTY);
			}
			else
			{
				m_pChat->CreateChatChild(STRMSG_C_VOIP_0032,COLOR_VOIP);//"여단 통화가 시작되었습니다. 말하기 단축키는 'Z' 입니다."
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_GUILD);
			}
		}
		break;
	case AV_EV_JOIN_USER:
		{
			// 2008-10-14 by bhsohn VOIP개선
			// 신규로 접속함
//			MSG_EV_JOIN_USER * pMsg = (MSG_EV_JOIN_USER*)pCopyDataStruct->lpData;
//			if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
//			{
//				wsprintf(buf, STRMSG_C_VOIP_0033, pMsg->szCharacterName);//"%s님이 편대간 통화에 참여하였습니다"
//			}
//			else
//			{
//				wsprintf(buf, STRMSG_C_VOIP_0034, pMsg->szCharacterName);//"%s님이 여단 통화에 참여하였습니다"
//			}
//			m_pChat->CreateChatChild(buf,COLOR_VOIP);
			MSG_EV_JOIN_USER * pMsg = (MSG_EV_JOIN_USER*)pCopyDataStruct->lpData;
			if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
			{
				wsprintf(buf, STRMSG_C_VOIP_0033, pMsg->szCharacterName);//"%s님이 편대간 통화에 참여하였습니다"
				if(pMsg->EnableTalking)
				{
					// 권한만 획득
					g_pShuttleChild->m_pClientParty->SetSpekeAuth(pMsg->szCharacterName);
				}
				else
				{
					// 권한만 취소
					g_pShuttleChild->m_pClientParty->ReleaseSpekeAuth(pMsg->szCharacterName);
				}
			}
			else if(m_VOIPState.nCallState == _CALLSTATE_GUILD)
			{
				BOOL bStartTalking = FALSE;
				switch(pMsg->EnableTalking)
				{
				case TRUE:
					{
						// 말하기 시작
						bStartTalking = TRUE;
					}
					break;
				case FALSE:
					{
						// 말하기 종료
						bStartTalking = FALSE;
					}
					break;
				}
				
				if(g_pGameMain && g_pGameMain->m_pCommunity)
				{
					g_pGameMain->m_pCommunity->GetGuild()->SetVOIPSpeaking(pMsg->szCharacterName, bStartTalking);
				}

				wsprintf(buf, STRMSG_C_VOIP_0034, pMsg->szCharacterName);//"%s님이 여단 통화에 참여하였습니다"				
			}
			else
			{
				wsprintf(buf, STRMSG_C_VOIP_0034, pMsg->szCharacterName);//"%s님이 여단 통화에 참여하였습니다"				
			}
			
			CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();		
			if(g_pGameMain && !stricmp(myShuttleInfo.CharacterName, pMsg->szCharacterName))
			{				
				DBGOUT("My Speaker Auth [%d]\n", pMsg->EnableTalking);
				// 내 케릭이면 정보 갱신
				g_pGameMain->SetVOIPSpeaking(pMsg->EnableTalking);
			}
			
			m_pChat->CreateChatChild(buf,COLOR_VOIP);
			// end 2008-10-14 by bhsohn VOIP개선
		}
		break;
	case AV_EV_GOOUT_USER:
		{
			MSG_EV_GOOUT_USER * pMsg = (MSG_EV_GOOUT_USER*)pCopyDataStruct->lpData;
			if(voIP.nCallType == _1to1Call)
			{
				wsprintf(buf, STRMSG_C_VOIP_0035);//"1:1통화가 종료되었습니다."
				m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
				m_VOIPState.bCaller = FALSE;
			}
			else 
			{
				if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
				{
					// 2008-10-14 by bhsohn VOIP개선
					// 권한만 취소
					g_pShuttleChild->m_pClientParty->ReleaseAllSpeeakeInfo(pMsg->szCharacterName);
					// end 2008-10-14 by bhsohn VOIP개선

					wsprintf(buf, STRMSG_C_VOIP_0036, pMsg->szCharacterName);//"%s님이 편대간 통화에서 나갔습니다."
				}
				else
				{
					// 2008-10-14 by bhsohn VOIP개선
					g_pGameMain->m_pCommunity->GetGuild()->ReleaseVOIPInfo(pMsg->szCharacterName);					
					
					wsprintf(buf, STRMSG_C_VOIP_0037, pMsg->szCharacterName);//"%s님이 여단 통화에서 나갔습니다."
				}
			}
			// 2008-10-14 by bhsohn VOIP개선
			//g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_NONE);
			CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();		
			if(g_pGameMain && !stricmp(myShuttleInfo.CharacterName, pMsg->szCharacterName))
			{
				g_pGameMain->m_pChat->UpdateVoiceChatType(VOICE_NONE);
			}			
			m_pChat->CreateChatChild(buf,COLOR_VOIP);
		}
		break;
		// 2008-10-14 by bhsohn VOIP개선
	case AV_EV_TALK_USER:
		{
			// 접속된 상태에서 유지정보들 갱신
			MSG_EV_TALK_USER * pMsg = (MSG_EV_TALK_USER*)pCopyDataStruct->lpData;
			CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();		
			if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
			{
				wsprintf(buf, STRMSG_C_VOIP_0033, pMsg->szCharacterName);//"%s님이 편대간 통화에 참여하였습니다"
				if(pMsg->bTalkFlag)
				{
					// 말하기 권한만 획득
					g_pShuttleChild->m_pClientParty->SetSpekeAuth(pMsg->szCharacterName);
				}
				else
				{
					// 권한잃음
					g_pShuttleChild->m_pClientParty->ReleaseSpekeAuth(pMsg->szCharacterName);
				}
			}
			else if(m_VOIPState.nCallState == _CALLSTATE_GUILD)
			{
				BOOL bStartTalking = FALSE;
				switch(pMsg->bTalkFlag)
				{
				case TRUE:
					{
						// 말하기 시작
						bStartTalking = TRUE;
					}
					break;
				case FALSE:
					{
						// 말하기 종료
						bStartTalking = FALSE;
					}
					break;
				}
				
				if(g_pGameMain && g_pGameMain->m_pCommunity)
				{
					g_pGameMain->m_pCommunity->GetGuild()->SetVOIPSpeaking(pMsg->szCharacterName, bStartTalking);
				}

				wsprintf(buf, STRMSG_C_VOIP_0034, pMsg->szCharacterName);//"%s님이 여단 통화에 참여하였습니다"				
			}
			
			if(g_pGameMain && !stricmp(myShuttleInfo.CharacterName, pMsg->szCharacterName))
			{				
				DBGOUT("My Speaker Auth [%d]\n", pMsg->bTalkFlag);
				// 내 케릭이면 정보 갱신
				g_pGameMain->SetVOIPSpeaking(pMsg->bTalkFlag);
			}
			
			if(COMPARE_RACE(myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
			{
				switch(pMsg->bTalkFlag)
				{
				case TRUE:
					{
						//wsprintf(buf, "%s님이 말하기 권한을 획득", pMsg->szCharacterName);//"%s님이 음성 송신 시작"
					}
					break;				
				default:
					{
						//wsprintf(buf, "%s님이 말하기 권한을 잃음", pMsg->szCharacterName);//"%s님이 음성 송신 종료"
					}
					break;
				}					
				
				if(strlen(buf) > 0)
				{
					m_pChat->CreateChatChild(buf,COLOR_VOIP);
				}		
				
			}
		}
		break;
//		{
//			MSG_EV_TALK_USER * pMsg = (MSG_EV_TALK_USER*)pCopyDataStruct->lpData;
//			if(voIP.nCallType == _NtoNCall)
//			{
//				if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
//				{
//					if(pMsg->bTalkFlag)
//					{
//						// 스피커 아이콘 깜박이기
//						g_pShuttleChild->m_pClientParty->SetSpekerIcon(pMsg->szCharacterName);
//					}
//					else
//					{
//						// 스피커 아이콘 해제하기
//						g_pShuttleChild->m_pClientParty->ReleaseSpekerIcon(pMsg->szCharacterName);
//					}
//				}
//				else
//				{
//					if(pMsg->bTalkFlag)
//					{
//						wsprintf(buf, STRMSG_C_VOIP_0038, pMsg->szCharacterName);//"%s님이 음성 송신 시작"
//					}
//					else
//					{
//						wsprintf(buf, STRMSG_C_VOIP_0039, pMsg->szCharacterName);//"%s님이 음성 송신 종료"
//					}
//					m_pChat->CreateChatChild(buf,COLOR_VOIP);
//				}
//			}
//		}
		// end 2008-10-14 by bhsohn VOIP개선
//		break;
		// 2008-10-14 by bhsohn VOIP개선
	case AV_EV_CHANGED_TALKING_STATE:
		{
			MSG_EV_CHANGED_TALKING_STATE * pMsg = (MSG_EV_CHANGED_TALKING_STATE*)pCopyDataStruct->lpData;
			if(voIP.nCallType == _NtoNCall)
			{
				CHARACTER myShuttleInfo = g_pShuttleChild->GetMyShuttleInfo();		
				if(m_VOIPState.nCallState == _CALLSTATE_PARTY)
				{
					switch(pMsg->nTakingState)
					{
					case TALKING_STATE_START_TALKING:
						{
							// 스피커 아이콘 깜박이기
							g_pShuttleChild->m_pClientParty->SetSpekerIcon(pMsg->szCharacterName);
						}
						break;
					case TALKING_STATE_END_TALKING:
						{
							// 스피커 아이콘 해제하기
							g_pShuttleChild->m_pClientParty->ReleaseSpekerIcon(pMsg->szCharacterName);
						}
						break;
					}					
				}
				else if(m_VOIPState.nCallState == _CALLSTATE_GUILD)
				{
					
				}
				if(COMPARE_RACE(myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
				{					
					switch(pMsg->nTakingState)
					{
					case TALKING_STATE_START_TALKING:
						{
							wsprintf(buf, STRMSG_C_VOIP_0038, pMsg->szCharacterName);//"%s님이 음성 송신 시작"
						}
						break;
					case TALKING_STATE_END_TALKING:
						{
							wsprintf(buf, STRMSG_C_VOIP_0039, pMsg->szCharacterName);//"%s님이 음성 송신 종료"
						}
						break;
					default:
						{
							wsprintf(buf, "");
						}
						break;
					}					
					
					if(strlen(buf) > 0)
					{
						m_pChat->CreateChatChild(buf,COLOR_VOIP);
					}					
				}
			}
		}
		break;
		// end 2008-10-14 by bhsohn VOIP개선
	case AV_EV_NOTIFY:
		{		
			switch(voIP.nMsgParam) 
			{
			case VOIPERR_NtoN_FAIL_REQUEST_TOKEN:
				{
					wsprintf(buf, STRMSG_C_051006_0001);	// "말하기 권한 요청 실패!! 잠시 후 다시 시도하세요"
				}
				break;
			case VOIPERR_NtoN_LOST_TOKEN:
				{
					wsprintf(buf, STRMSG_C_051006_0002);	// "말하기 권한 취소됨. 잠시 후 다시 시도하세요"
				}
				break;
			default:
				{
					wsprintf(buf, "Unknown VoIP Notify");
				}
			}
			// 2008-10-14 by bhsohn VOIP개선
			//m_pChat->CreateChatChild(buf,COLOR_VOIP, CHAT_TAB_SOUND);
			m_pChat->CreateChatChild(buf,COLOR_VOIP);
		}
		break;
	case AV_EV_GET_SPK_VOLUME_OK:
		{
			// 2008-10-20 by bhsohn VOIP 버그 수정
			// 볼륨 조절
			USHORT Volum = voIP.nMsgParam;
			if(g_pGameMain)
			{
				g_pGameMain->InitSetVoiceVolum(Volum);
			}
		}
		break;
	default:
		{
		}
		break;
	}
}
#define DEBUG_COLOR		RGB(222, 222, 222)
void CAtumApplication::RenderDbg()
{
	FLOG("CAtumApplication::RenderDbg()");
	char buff[1024];



// 	static UINT		nFrameTime	= timeGetTime();
// 	UINT			nCurTime	= timeGetTime();
// 	
// 	if(nCurTime > nFrameTime + 5000)
// 	{
// 		::DbgOut("FPS : %.1f\n", m_fFPS);
// 		nFrameTime = nCurTime;
// 	}
	// 2011-07-29 by jhahn 프레임 항상 표시
	int linePixel = 14;
	int lineNumber = 0;
#ifdef TEST140
	sprintf(buff,"FPS : [ %.1f ]",m_fFPS);
	// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
	m_pFontDebugFps->DrawText(100, linePixel*lineNumber++, DEBUG_COLOR, buff, 0);
#else
	m_pFontDebug->DrawText(100, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
	// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#endif
	//end 2011-07-29 by jhahn 프레임 항상 표시

#ifndef _DEBUG
	if( (m_dwGameState == _GAME || m_dwGameState == _CITY || m_dwGameState == _SHOP) &&
		g_pInterface->m_bShowInterface == TRUE &&
		COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
#else
	if( (m_dwGameState == _GAME || m_dwGameState == _CITY || m_dwGameState == _SHOP) &&
		g_pInterface->m_bShowInterface == TRUE )
	{
#endif
		
#ifndef _DBGOUT_EFFECT

		if(strlen(m_strDebug))
		{
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			m_pFontDebugErr->DrawText(256, linePixel * lineNumber++, DEBUG_COLOR, m_strDebug, 0);
#else
			m_pFontDebug->DrawText( 256, linePixel*lineNumber++, DEBUG_COLOR, m_strDebug,0 );
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
		}
		if(!m_bDebugText)
		{
#ifdef _DEBUG
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			m_pFontDebugDBG->DrawText(256, linePixel * lineNumber++, DEBUG_COLOR, "DEBUG : CTRL+ALT+'/'", 0);
#else
			m_pFontDebug->DrawText( 256, linePixel*lineNumber++, DEBUG_COLOR, "DEBUG : CTRL+ALT+'/'", 0);
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#endif
			// 2007-03-28 by bhsohn 관리자가 세력만 볼수 있게 끔 변경
			/*
			if(strlen(m_strSeverUserNum))
			{
				sprintf(buff,"%s",m_strSeverUserNum);
				m_pFontDebug->DrawText(256, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
			}
			if(strlen(m_strMapUserNum))
			{
				sprintf(buff,"%s",m_strMapUserNum);
				m_pFontDebug->DrawText(256, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
			}
			*/
			
			// 2007-04-09 by bhsohn 관리자 계정 표출 정보 처리
			if(strlen(m_strConnectSeverName))
			{
				sprintf(buff,"%s",m_strConnectSeverName);
				// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
				m_pFontDebugServer->DrawText(256, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
				m_pFontDebug->DrawText(256, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
				// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
			}			
			// end 2007-04-09 by bhsohn 관리자 계정 표출 정보 처리			
			// end 2007-03-28 by bhsohn 관리자가 세력만 볼수 있게 끔 변경

			// 2006-05-24 by ispark
			GetInfluenceString(buff, m_pShuttleChild->m_myShuttleInfo.InfluenceType);
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			m_pFontDebugInfl->DrawText(256, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
			m_pFontDebug->DrawText(256, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
//			// 2006-11-02 by ispark, 캐릭터 움직이는 거리 체크(나중에 필요할지 모르니 지우지 말고 필요시 주석 삭제)
//			sprintf(buff, "CHARACTER MOVE RATE\\e(%.1f)\\e", m_pCharacterChild->GetCharacterSpeed());
//			m_pFontDebug->DrawText(256, linePixel*lineNumber++, DEBUG_COLOR, buff, 0);
		}
		else
		{
			lineNumber = 10;
			if(strlen(m_strSeverUserNum))
			{
				sprintf(buff,"%s",m_strSeverUserNum);
				// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
				m_pFontDebugServerUserNum->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
				// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
			}
			if(strlen(m_strMapUserNum))
			{
				sprintf(buff,"%s",m_strMapUserNum);
				// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
				m_pFontDebugMapUserNum->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
				// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
			}

			sprintf(buff,"MEM : [ %d ]",g_pD3dDev->GetAvailableTextureMem());
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			m_pFontDebugMem->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
			m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
			sprintf(buff,"OBJ : [ %d ]",g_pScene->m_vectorCulledObjectPtrList.size());
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			m_pFontDebugObj->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
			m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
/*			if(m_pScene)
			{
				sprintf(buff,"Monster Render Count : %d",m_pScene->m_mapMonsterRenderList.size());
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);

				sprintf(buff,"Monster Data Count : %d",m_pScene->m_mapMonsterList.size());
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);

				sprintf(buff,"Enemy Render Count : %d",m_pScene->m_mapEnemyRenderList.size());
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);

				sprintf(buff,"Enemy Data Count : %d",m_pScene->m_mapEnemyList.size());
				m_pFontDebug->DrawText(10, linePixel*lineNumber++, DEBUG_COLOR, buff,0);

				sprintf( buff, "Render Distance : %d", (int)(m_pScene->m_fFogEndValue + m_pCamera->m_fRenderDistance) );
				m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
			}
			if(m_pCamera)
			{
				sprintf( buff, "Detail Rate : %d%", (int)(m_pCamera->m_fDetailRateGround * 100.0f) );
				m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
			}
*/

			if(m_pEffectRender)
			{
				sprintf( buff, "Effect count : P[%d], S[%d], O[%d], T[%d]", 
					m_pEffectRender->m_nParticleEffectCountPerSecond,
					m_pEffectRender->m_nSpriteEffectCountPerSecond,
					m_pEffectRender->m_nObjectEffectCountPerSecond,
					m_pEffectRender->m_nTraceEffectCountPerSecond );
				// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
				m_pFontDebugEffCnt->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
				m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
#endif
				// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
			}

#ifdef _DEBUG
			// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
			sprintf( buff, "ENEMY Move packet/sec:[%d], count/packet:[%d]", g_nMoveCountPerRate, g_nMoveCountPerPacket );
			m_pFontDebugEnemyMovePacket->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);

			sprintf( buff, "MISSILE COUNT:[%d]", g_nMissileCount );
			m_pFontDebugMissileCnt->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
			
			sprintf( buff, "Character Pos [X:%d Y:%d Z:%d]", (int)g_pShuttleChild->m_vPos.x, (int)g_pShuttleChild->m_vPos.y, (int)g_pShuttleChild->m_vPos.z);
			m_pFontDebugCharacterPos->DrawText(10, linePixel * lineNumber++, DEBUG_COLOR, buff, 0);
#else
			sprintf( buff, "ENEMY Move packet/sec:[%d], count/packet:[%d]", g_nMoveCountPerRate, g_nMoveCountPerPacket );
			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
			sprintf( buff, "MISSILE COUNT:[%d]", g_nMissileCount );
			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
			sprintf( buff, "Character Pos [X:%d Y:%d Z:%d]", (int)g_pShuttleChild->m_vPos.x, (int)g_pShuttleChild->m_vPos.y, (int)g_pShuttleChild->m_vPos.z);
			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
#endif
			// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)

//			sprintf(buff, "FOG[%.2f,%.2f,%.2f],S[%.1f],E[%.1f]",
//				g_pScene->m_fSkyRedColor, g_pScene->m_fSkyGreenColor, g_pScene->m_fSkyBlueColor,
//				g_pScene->m_fFogStartValue, g_pScene->m_fFogEndValue );
//			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff, 0 );
//			sprintf(buff, "FOG[%.2f,%.2f,%.2f],S[%.1f],E[%.1f]",
//				m_pScene->m_fSkyRedColor, m_pScene->m_fSkyGreenColor, m_pScene->m_fSkyBlueColor,
//				m_pScene->m_fFogDestStartValue, m_pScene->m_fFogDestEndValue );
//			m_pFont->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff,0 );
//			sprintf( buff, "POS[ %.1f, %.1f, %.1f ]", m_pShuttleChild->m_vPos.x, m_pShuttleChild->m_vPos.y, m_pShuttleChild->m_vPos.z);
//			m_pFont->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff,0 );
//			sprintf( buff, "FOG Distance, Start[%.1f] End[%.1f]",g_pScene->m_fFogDestStartValue, g_pScene->m_fFogDestEndValue );
//			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff,0 );
//			sprintf( buff, "1's weapon side position = (%.2f,%.2f,%.2f)", 
//							g_pShuttleChild->m_vPrimarySidePos.x,
//							g_pShuttleChild->m_vPrimarySidePos.y,
//							g_pShuttleChild->m_vPrimarySidePos.z);
//			m_pFontDebug->DrawText( 10, linePixel*lineNumber++, DEBUG_COLOR, buff,0 );
#endif // _DEBUG_endif
		}

#endif // !_DBGOUT_EFFECT_endif
	}
	
	// 2014-06-18 by ymjoo 화면 상단에 세력 표시
#ifdef SC_UNBALANCED_FORCES_ADJUST_SHOW_INFLUNCE_INFO
	if((m_dwGameState == _GAME || m_dwGameState == _CITY || m_dwGameState == _SHOP)
		&& g_pInterface->m_bShowInterface == TRUE)
	{
		//GetInfluenceString(buff, m_pShuttleChild->m_myShuttleInfo.InfluenceType);
		BYTE myInflType = m_pShuttleChild->m_myShuttleInfo.InfluenceType;
		if(IS_NORMAL_INFLUENCE_TYPE(myInflType))
		{
			wsprintf(buff, "%s", STRMSG_C_140619_0000);		// "일반세력"
		}
		else
		{
			if(IS_ANI_INFLUENCE_TYPE(myInflType))
			{
				wsprintf(buff, "%s", STRMSG_C_060210_0001);		// "알링턴"
			}
			else
			{
				wsprintf(buff, "%s", STRMSG_C_060210_0000);		// "바이제니유"
			}

			if(COMPARE_INFLUENCE(myInflType, m_SuperiorInfluenceType))
			{
				wsprintf(buff, "%s(%s)", buff, STRMSG_C_140619_0001);	// "우세"
			}
			else if(m_SuperiorInfluenceType != NULL)
			{
				wsprintf(buff, "%s(%s)", buff, STRMSG_C_140619_0002);	// "열세"
			}
		}
		UINT nInflEndX = GetBackBufferDesc().Width - 140;
		// 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
#ifdef C_DRAWTEXT_UPGRADE_YMJOO
		SIZE size = m_pFontInfl->GetStringSize(buff);
		m_pFontInfl->DrawText(nInflEndX - size.cx, 29, DEBUG_COLOR, buff, 0);
#else
		SIZE size = m_pFontDebug->GetStringSize(buff);
		m_pFontDebug->DrawText(nInflEndX - size.cx, 29, DEBUG_COLOR, buff,0);
#endif
		// END 2014-06-27 by ymjoo DrawText 성능 개선 작업 (DBG 텍스트)
	}
#endif
	// END 2014-06-18 by ymjoo 화면 상단에 세력 표시
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackOk(MSG_FC_BATTLE_ATTACK_OK* pMsg)
/// \brief		Attack 결과 처리(화면에 총알 이펙트 생성)
///				1. Attack index로 공격자 판별 ( this function )
///				2. 1,2형 구분   :  CUnitData::CreateWeaponByFieldServer
///				3. AttackType으로 공격방법 판별 : CUnitData::CheckAttack
///				4. Target 처리(아이템,유닛) : Weapon constructor
/// \author		dhkwon
/// \date		2004-09-07 ~ 2004-09-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackOk(MSG_FC_BATTLE_ATTACK_OK* pMsg)
{
	ASSERT_ASSERT(m_pShuttleChild);
	if(m_pShuttleChild == NULL)
	{
		return;
	}
	if(pMsg->AttackIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		if(IS_PRIMARY_ATT_TYPE(pMsg->AttackType))
		{
			if(m_pShuttleChild->m_pPrimaryWeapon &&
				ATT_TYPE_SPLASH_PRI != pMsg->AttackType)
			{
				m_pShuttleChild->m_pPrimaryWeapon->SetWeaponCount(pMsg->RemainedBulletFuel);
			}
		}
		// 2010-06-15 by shcho&hslee 펫시스템 - 펫 무기 생성
        //else	  
		else if(IS_SECONDARY_ATT_TYPE(pMsg->AttackType))	
        // end 2010-06-15 by shcho&hslee 펫시스템 - 펫 무기 생성
		{
			if(m_pShuttleChild->m_pSecondaryWeapon)
			{
				m_pShuttleChild->m_pSecondaryWeapon->SetWeaponCount(pMsg->RemainedBulletFuel);
			}
		}
		g_pShuttleChild->CreateWeaponByFieldServer(pMsg);
	}
//	else if(pMsg->TargetInfo.TargetIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
//	{
//		// 2005-07-07 by ispark
//		// 상대방이 나를 공격시
//		// 2형 공격시
//		if(IS_SECONDARY_ATT_TYPE(pMsg->AttackType))
//		{
//			m_pShuttleChild->SetMissileWarning(TRUE);
//			m_pShuttleChild->SetMissileCount(m_pShuttleChild->GetMissileCount() + 1);
//		}
//	}

	if(pMsg->AttackIndex < 10000) // Enemy
	{
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(itEnemy != m_pScene->m_mapEnemyList.end() )
		{
			itEnemy->second->CreateWeaponByFieldServer(pMsg);
		}
	}
	else // Monster
	{
		CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->AttackIndex);
		if(itMonster != m_pScene->m_mapMonsterList.end() )
		{
			itMonster->second->CreateWeaponByFieldServer(pMsg);
		}

	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketBattleAttackEvasionOk(MSG_FC_BATTLE_ATTACK_EVASION_OK *pMsg)
/// \brief		회피했음
/// \author		ispark
/// \date		2005-12-12 ~ 2005-12-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleAttackEvasionOk(MSG_FC_BATTLE_ATTACK_EVASION_OK *pMsg)
{
	if(!m_pScene->m_pWeaponData)
		return;
	CWeapon * pNode = (CWeapon *)m_pScene->m_pWeaponData->m_pChild;
	while(pNode)
	{
		if( (pNode->m_dwPartType == _MISSILE || pNode->m_dwPartType == _ROCKET ) &&
			pMsg->AttackIndex == ((CWSlowData*)pNode)->m_nClientIndex && 
			pMsg->WeaponIndex == ((CWSlowData*)pNode)->m_nWeaponIndex)
		{
			((CWSlowData*)pNode)->m_bEvasion = TRUE;
			break;
		}

		pNode = (CWeapon *)pNode->m_pNext;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarNotifyInvasion(MSG_FC_BATTLE_ATTACK_EVASION_OK *pMsg)
/// \brief		적들의 침투
/// \author		ydkim
/// \date		
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarNotifyInvasion(MSG_FC_WAR_NOTIFY_INVASION *pMsg)
{
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapChannelIndex0.MapIndex);
	char buff[256];
	ZERO_MEMORY(buff);
	
	if(pMapinfo)
	{
// 2006-03-07 by ispark, 언어에 따라 위치 수정
#if defined(LANGUAGE_ENGLISH) || defined(LANGUAGE_VIETNAM)|| defined(LANGUAGE_THAI)|| defined(LANGUAGE_RUSSIA)// 2008-04-30 by bhsohn 태국 버전 추가
		// 2006-01-04 by ispark, 글로벌은 맵 이름의 쓰이는 위치가 다르다.
		wsprintf(buff,"%s %s[%d].",  STRMSG_C_051228_0001, pMapinfo->MapName,pMsg->MapChannelIndex0.ChannelIndex);
#else
		wsprintf(buff,"%s[%d] %s", pMapinfo->MapName,pMsg->MapChannelIndex0.ChannelIndex,  STRMSG_C_051228_0001);
#endif
		m_pChat->CreateChatChild(buff, COLOR_ITEM);//"지역에 적들이 출현하였습니다."
	}
	else
	{
		m_pChat->CreateChatChild(STRMSG_C_051228_0001, COLOR_ITEM);//"지역에 적들이 출현하였습니다."
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarNotifyInfluenceMonsterDead(MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD *pMsg)
/// \brief		세력몬스터 파괴
/// \author		ydkim
/// \date		
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarNotifyInfluenceMonsterDead(MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD *pMsg)
{
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->MonsterUnitkind);
	char buff[1024];
	ZERO_MEMORY(buff);
	if(pMonsterInfo == NULL)
	{
		DbgOut("Monster Info Error : %d\n",pMsg->MonsterUnitkind);
		return;
	}
	if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType,
			pMonsterInfo->Belligerence))
	{
		// 세력 몬스터 파괴
		wsprintf(buff,"%s %s", pMonsterInfo->MonsterName,  STRMSG_C_051228_0002);		
	}
	else
	{
		// 적 세력 몬스터 파괴 시키다 
		wsprintf(buff,"%s %s", pMonsterInfo->MonsterName,  STRMSG_C_051228_0003);		
	}

	m_pChat->CreateChatChild(buff, COLOR_ITEM);//"전함을 침몰 시켰습니다."
	// 2007-02-06 by bhsohn 모선전 진행 사항 체크
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
	//CINFGameMainUnitInfoBar* pBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
	g_pGameMain->DestroyMotherShipInfo(pMonsterInfo->Belligerence);

	// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	
	g_pInterface->RefreshWarMotherWarInfo();	// 모선전 갱신
	// end 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	

	// end 2007-02-06 by bhsohn 모선전 진행 사항 체크
	// 2007-08-23 by bhsohn 세력전시 기여도가 큰 유저에 대한 메시지 처리
	AlertMsgWarMonsterInfo(pMonsterInfo, pMsg->szBestGuildName);
	// end 2007-08-23 by bhsohn 세력전시 기여도가 큰 유저에 대한 메시지 처리

	// 2013-06-17 by bhsohn 세력포인트 표시 변경	
	//if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
// 	if(!IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
// 	{
// 		ZERO_MEMORY(buff);
// 		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// #ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN			
// 		wsprintf(buff, STRMSG_C_061121_0002,  CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."
// #else
// 		wsprintf(buff, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_BOSS_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
// #endif		
// 		// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// 		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
// 	}
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
	#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG				 // 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
		ZERO_MEMORY(buff);		
		if(!IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{
			// 모선 파괴 승리		
			wsprintf(buff, STRMSG_C_061121_0002,  CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."		
		}
		else
		{
			// 모선 파괴 패배
			wsprintf(buff, STRMSG_C_061121_0002,  CONTRIBUTIONPOINT_BOSS_MONSTER_LOSER);	// "세력 포인트 %d점이 추가 되었습니다."		
		}
		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
	#endif
#else
	if(!IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
	{
		ZERO_MEMORY(buff);		
		wsprintf(buff, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_BOSS_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
	}
#endif
	// end 2013-06-17 by bhsohn 세력포인트 표시 변경
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::AlertMsgWarMonsterInfo(MEX_MONSTER_INFO* pMonsterInfo, char* pBestGuildName)
/// \brief		
/// \author		// 2007-08-23 by bhsohn 세력전시 기여도가 큰 유저에 대한 메시지 처리
/// \date		
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::AlertMsgWarMonsterInfo(MEX_MONSTER_INFO* pMonsterInfo, char* pBestGuildName)
{
	if((NULL == pMonsterInfo) || strlen(pBestGuildName) == 0)
	{
		return;
	}
	char buff[128];
	ZERO_MEMORY(buff);
	wsprintf(buff, STRMSG_C_070823_0201, pBestGuildName, pMonsterInfo->MonsterName);
	AddSpeakerGMString(buff, FALSE);

	// 2008-07-11 by bhsohn 세력전 승리에 대한 메시지 시스템 메시지에도 추가
	m_pChat->CreateChatChild(buff, COLOR_ITEM);//"전함을 침몰 시켰습니다."
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID FieldSocketWarNotifyInfluenceAutoMonsterDead(MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD *pMsg)
/// \brief		모선전에서 몬스터 자동 소멸
/// \author		// 2007-02-15 by bhsohn 모선 자동 소멸시 이벤트 받음.
/// \date		2007-02-15 ~ 2007-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarNotifyInfluenceAutoMonsterDead(MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_DEAD *pMsg)
{
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->MonsterUnitkind);
	if(NULL == pMonsterInfo)
	{
		return;
	}
	
	// 모선 자동 소멸 
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
	//CINFGameMainUnitInfoBar* pBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
	g_pGameMain->DestroyMotherShipInfo(pMonsterInfo->Belligerence);

	// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	
	g_pInterface->RefreshWarMotherWarInfo();	// 모선전 갱신
	// end 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	
	
	// 2013-06-17 by bhsohn 세력포인트 표시 변경	
// 	if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
// 	{
// 		char buff[1024];
// 		ZERO_MEMORY(buff);
// 		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// #ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN			
// 		wsprintf(buff, STRMSG_C_061121_0002,  CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."
// #else
// 		wsprintf(buff, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_BOSS_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
// #endif
// 		//		
// 		// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// 		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
// 	}
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
	#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG				// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
		char buff[1024];
		ZERO_MEMORY(buff);		
		if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{	
			// 모선  지키기 성공
			wsprintf(buff, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."			
		}
		else
		{
			// 모선 지키기 실패
			wsprintf(buff, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_BOSS_MONSTER_LOSER);	// "세력 포인트 %d점이 추가 되었습니다."			

		}
		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
	#endif
#else
	if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
	{
		char buff[1024];
		ZERO_MEMORY(buff);		
		wsprintf(buff, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_BOSS_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."	
		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
	}

#endif
	// END 2013-06-17 by bhsohn 세력포인트 표시 변경


	DBGOUT("CAtumApplication::FieldSocketWarNotifyInfluenceAutoMonsterDead[%d] \n", pMonsterInfo->Belligerence);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarNotifyInfluenceMonsterIvasion((MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_INVASION*)(pPacket+SIZE_FIELD_TYPE_HEADER))
/// \brief		세력 몬스터 공격 메세지
/// \author		ispark
/// \date		2006-01-20 ~ 2006-01-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarNotifyInfluenceMonsterIvasion(MSG_FC_WAR_NOTIFY_INFLUENCE_MONSTER_INVASION *pMsg)
{
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->MonsterUnitkind);
	if(pMonsterInfo)
	{
		char buff[128];
		ZERO_MEMORY(buff);
		// (이)가 공격을 받고 있습니다.
		wsprintf(buff,STRMSG_C_060120_0000, pMonsterInfo->MonsterName);		
		m_pChat->CreateChatChild(buff, COLOR_ITEM);//"전함을 침몰 시켰습니다."
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarBossMonsterSummonDataInvasion(MSG_FC_WAR_BOSS_MONSTER_SUMMON_DATA* pMsg)
/// \brief		전함 출항 메세지
/// \author		ispark
/// \date		2006-04-14 ~ 2006-04-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarBossMonsterSummonDataInvasion(MSG_FC_WAR_BOSS_MONSTER_SUMMON_DATA* pMsg)
{
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->SummonMonsterUnitkind);
	if(pMonsterInfo)
	{
		// 2009-01-28 by bhsohn 세력전시, 스트링 짤리는 버그 수정
		//char buffInfluence[12];
		//char buff[128];
		char buffInfluence[64];
		char buff[256];
		// end 2009-01-28 by bhsohn 일본 요청 사항
		ZERO_MEMORY(buff);
		ZERO_MEMORY(buffInfluence);

		if(pMonsterInfo->Belligerence == BELL_INFLUENCE_VCN)
		{
			wsprintf(buffInfluence, STRMSG_C_060210_0000);
		}
		else
		{
			wsprintf(buffInfluence, STRMSG_C_060210_0001);
		}

		if(pMsg->RemainMinute <= 0)
		{
			// "%s의 전함 %s(이)가 출현하였습니다."
			wsprintf(buff,STRMSG_C_060414_0001, buffInfluence, pMonsterInfo->MonsterName);
			m_pSound->SetBackMusic(_BOSSMONSTERSUMMON);
	
		//2013-04-11 by ssjung 모선전 준비상태일 때 맵 이동시 다시 뮤직플레이어 되는 상황수정
			m_bBossMonsterSummeryReady = FALSE;
			m_byInfluence = NULL;
		}
		else
		{
			// "%s의 전함 %s(이)가 출항하기 까지 %d분 남았습니다."
			wsprintf(buff,STRMSG_C_060414_0000, buffInfluence, pMonsterInfo->MonsterName, pMsg->RemainMinute);
			if(!m_bBossMonsterSummeryReady || (m_byInfluence != pMonsterInfo->Belligerence))
			{
				g_pGameMain->m_pMp3Player->SetStopButton(FALSE);
				m_bBossMonsterSummeryReady = TRUE;
				m_byInfluence = pMonsterInfo->Belligerence;
			}
			m_pSound->SetBackMusic(_BOSSMONSTERSUMMONREADY);

		//end 2013-04-11 by ssjung 모선전 준비상태일 때 맵 이동시 다시 뮤직플레이어 되는 상황수정

		}

		m_pChat->CreateChatChild(buff, COLOR_ITEM);	
		
		// 2007-02-06 by bhsohn 모선전 진행 사항 체크		
		if(pMsg->RemainMinute <= 0)
		{
			// 모선 출항
			// 2009-03-17 by bhsohn 단계별 모선시스템 추가			
			switch(pMsg->BeforeWinCheck)
			{
			case MSBOSSSTEP_UNKNOWN_BEFOREWAR:
				{
					// 전 주기에 모선전 정보가 없거나 첫 주기 모선					
				}
				break;
			case MSBOSSSTEP_WIN_BEFOREWAR:
				{
					// 전 주기에 모선전 승리					
					//"%s세력의 모선이 지난 모선전의 승리로 자만심에 빠져 방어 태세를 해제한 상태입니다."
					wsprintf(buff,STRMSG_C_090317_0201, buffInfluence);
					m_pChat->CreateChatChild(buff, COLOR_ITEM);	
				}
				break;
			case MSBOSSSTEP_LOSS_BEFOREWAR:
				{
					// 전 주기에 모선전 패배					
					//"000세력의 모선이 지난 모선전의 패배로 승리에 대한 갈망이 높아져 전투 준비를 강화 하였습니다."
					wsprintf(buff,STRMSG_C_090317_0202, buffInfluence);
					m_pChat->CreateChatChild(buff, COLOR_ITEM);	
				}
				break;
			}			
			// end 2009-03-17 by bhsohn 단계별 모선시스템 추가

			// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
			//CINFGameMainUnitInfoBar* pBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
			// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경
			g_pGameMain->SummonMotherShipInfo(pMonsterInfo->Belligerence, &pMsg->SummonMonsterTime, pMsg->ContributionPoint, pMsg->SummonMonsterUnitkind);
			
		}		
		// 2009-03-17 by bhsohn 단계별 모선시스템 추가
		if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race, RACE_OPERATION|RACE_GAMEMASTER))
		{
			// 관리자만 모선 단계 표시 

			// 2009. 06. 04 by ckPark 단계별 모선 문자열 버그 수정
			//wsprintf(buff,"MotionShip LV[%d] ", pMsg->BossStep);
			wsprintf(buff,"MotherShip LV[%d] ", pMsg->BossStep);
			// end 2009. 06. 04 by ckPark 단계별 모선 문자열 버그 수정

			m_pChat->CreateChatChild(buff, COLOR_ITEM);	
		}
		// end 2009-03-17 by bhsohn 단계별 모선시스템 추가
		// end end 2007-02-06 by bhsohn 모선전 진행 사항 체크		
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketWarStrategypointMonsterSummon(SSUMMON_STRATEGYPOINT_INFO* pMsg)
/// \brief		거점 생성
/// \author		// 2007-07-04 by bhsohn 오퍼레이터 추가
/// \date		2007-07-04 ~ 2007-07-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarStrategypointMonsterSummon(MSG_FC_WAR_STRATEGYPOINT_MONSTER_SUMMON* pMsg)
{
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	char buf[1024] = {0,};
	char bufTime[1024] = {0,};
	char bufInfluence[64] = {0,};

	if(IS_MAP_INFLUENCE_VCN(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0000);
	}
	else if(IS_MAP_INFLUENCE_ANI(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0001);
	}
	
	wsprintf(buf, STRMSG_C_061121_0000, bufInfluence, pMapinfo->MapName);	// "\\c%s측\\c %s 지역에 전략 포인트가 생성되었습니다."

	// 시간 정보
	wsprintf(bufTime, STRMSG_C_070712_0209, pMsg->SummonStrategyPointTime.Hour, pMsg->SummonStrategyPointTime.Minute);
	// 2007-12-27 by dgwoo
	g_pInterface->AddInflWarMonster(buf, pMsg->MapIndex, pMapinfo->MapInfluenceType, pMsg->SummonStrategyPointTime);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarJacoMonsterSummon(MSG_FC_WAR_JACO_MONSTER_SUMMON* pMsg)
/// \brief		자코 몬스터 출현	
/// \author		ispark
/// \date		2006-04-20 ~ 2006-04-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarJacoMonsterSummon(MSG_FC_WAR_JACO_MONSTER_SUMMON* pMsg)
{
	// 2009-04-09 by bhsohn 자코 몬스터 소환시, 스트링 짤리는 버그 수정
	//char buffInfluence[12];
	//char buff[128];
	char buffInfluence[64];
	char buff[256];
	// end 2009-04-09 by bhsohn 자코 몬스터 소환시, 스트링 짤리는 버그 수정
	
	ZERO_MEMORY(buff);
	ZERO_MEMORY(buffInfluence);

	if(pMsg->nBelligerence0 == BELL_INFLUENCE_VCN)
	{
		wsprintf(buffInfluence, STRMSG_C_060210_0001);
	}
	else
	{
		wsprintf(buffInfluence, STRMSG_C_060210_0000);
	}

	wsprintf(buff,STRMSG_C_060420_0000, buffInfluence);	//"%s 영역에 알 수 없는 몬스터가 자주 출몰한다. 전쟁의 기운이 충만해져서 인듯하다."

	m_pChat->CreateChatChild(buff, COLOR_ITEM);		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarInfluenceData(MSG_FC_WAR_INFLUENCE_DATA* pMsg)
/// \brief		이벤트 회복율 
/// \author		ispark
/// \date		2006-04-21 ~ 2006-04-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarInfluenceData(MSG_FC_WAR_INFLUENCE_DATA* pMsg)
{
	// 2009-03-31 by bhsohn 이벤트 회복률 버그 수정
// 	if(COMPARE_INFLUENCE(pMsg->byInfluenceType, g_pShuttleChild->m_myShuttleInfo.InfluenceType) && 
// 		pMsg->fDPRepairRate > 0.0f)
// 	{
// 		 g_bEventRecovery = TRUE;
// 		 g_fEventRecoveryRate = pMsg->fDPRepairRate;		
// 	}
	if(COMPARE_INFLUENCE(pMsg->byInfluenceType, g_pShuttleChild->m_myShuttleInfo.InfluenceType))
	{
		if(pMsg->fDPRepairRate > 0.0f)
		{
			g_bEventRecovery = TRUE;
			g_fEventRecoveryRate = pMsg->fDPRepairRate;		
		}
		else
		{
			g_bEventRecovery = FALSE;
			g_fEventRecoveryRate = 0.0f;		
		}
		
	}
	// end 2009-03-31 by bhsohn 이벤트 회복률 버그 수정
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarSignBoardInsertString(MSG_FC_WAR_SIGN_BOARD_INSERT_STRING* pMsg)
/// \brief		세력 전광판 스트링 입력
/// \author		ispark
/// \date		2006-04-18 ~ 2006-04-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarSignBoardInsertString(MSG_FC_WAR_SIGN_BOARD_INSERT_STRING* pMsg)
{
	if(g_pGameMain->m_pCityBoard &&
		!COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_NORMAL))
	{
		int temp = 0, temp2 = 0;
		CheckReadyStringFiltering(pMsg->SingBoardString, &temp, &temp2);
		g_pGameMain->m_pCityBoard->SetString(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarReqSignBoardStringListOk(MSG_FC_WAR_REQ_SIGN_BOARD_STRING_LIST_OK* pMsg)
/// \brief		세력 전광판 전체 내용
/// \author		ispark
/// \date		2006-04-18 ~ 2006-04-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarReqSignBoardStringListOk(MSG_FC_WAR_REQ_SIGN_BOARD_STRING_LIST_OK* pMsg)
{
	if(g_pGameMain->m_pCityBoard &&
		!COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_NORMAL))
	{
		MSG_FC_WAR_SIGN_BOARD_INSERT_STRING *pSignBoardInsertString = (MSG_FC_WAR_SIGN_BOARD_INSERT_STRING *)((char *)pMsg + sizeof(MSG_FC_WAR_REQ_SIGN_BOARD_STRING_LIST_OK));
		for(int i=0; i < pMsg->nStringCount; i++)
		{
			int temp = 0, temp2 = 0;
			CheckReadyStringFiltering(pSignBoardInsertString->SingBoardString, &temp, &temp2);
			g_pGameMain->m_pCityBoard->SetString(pSignBoardInsertString);
			pSignBoardInsertString++;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarSignBoardDeleteString(MSG_FC_WAR_SIGN_BOARD_DELETE_STRING* pMsg)
/// \brief		세력 전광판 메세지 삭제
/// \author		ispark
/// \date		2006-04-18 ~ 2006-04-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarSignBoardDeleteString(MSG_FC_WAR_SIGN_BOARD_DELETE_STRING* pMsg)
{
	if(g_pGameMain->m_pCityBoard &&
		!COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_NORMAL))
	{
		g_pGameMain->m_pCityBoard->DelString(pMsg->DeleteStringIndex);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketWarUpdateContributionPointOk(MSG_FC_WAR_UPDATE_CONTRIBUTION_POINT_OK* pMsg)
/// \brief		세력 포인트
/// \author		ispark
/// \date		2006-04-19 ~ 2006-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarUpdateContributionPointOk(MSG_FC_WAR_UPDATE_CONTRIBUTION_POINT_OK* pMsg)
{
	if(g_pGameMain->m_pCityBoard &&
		!COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_NORMAL))
	{
		g_pGameMain->m_pCityBoard->SetContributionPoint(pMsg);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketItemUpdateUsingItem(MSG_FC_STORE_UPDATE_USINGITEM *pMsg)
/// \brief		유료화 아이템 업데이트
/// \author		ispark
/// \date		2006-03-31 ~ 2006-03-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdateUsingItem(MSG_FC_STORE_UPDATE_USINGITEM *pMsg)
{
	CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUID0 );
	ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
	pItemInfo->SetItemPassTime(pMsg->UsingTimeStamp0);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketStoreUpdateItemNum(MSG_FC_STORE_UPDATE_ITEMNUM* pMsg)
/// \brief		조합시 아이템 넘버 변경
/// \author		ispark
/// \date		2006-06-15 ~ 2006-06-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdateItemNum(MSG_FC_STORE_UPDATE_ITEMNUM* pMsg)
{
	CINFCityLab* pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
	if(pCityLab)
	{
		pCityLab->ReSetTargetItemNum(pMsg->ItemUniqueNumber, pMsg->ItemNum);
	}
	// 2009-04-08 by bhsohn 세력 불균형, 세력 초기화 시스템 추가 수정
	else
	{
		CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUniqueNumber);
		ITEM* pItem = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
		
		if(pItem == NULL || pItemInfo == NULL)
		{
			return;
		}		
		pItemInfo->ItemInfo = pItem;
		pItemInfo->ItemNum = pMsg->ItemNum;
		pItemInfo->ResetRealItemInfo();
	}
	// end 2009-04-08 by bhsohn 세력 불균형, 세력 초기화 시스템 추가 수정
}

VOID CAtumApplication::FieldSocketStoreLogGuildItemOK(MSG_FC_STORE_LOG_GUILD_ITEM_OK* pMsg)
{
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	pStore->StringInOrderBound(pMsg);

}
VOID CAtumApplication::FieldSocketStoreLogGuildItemOKHeader()
{
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	pStore->HeaderGuildLog();
}
VOID CAtumApplication::FieldSocketStoreLogGuildItemOKDone()
{
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	pStore->DoneGuildLog();

}
VOID CAtumApplication::FieldSocketBattleAttackFindOk(MSG_FC_BATTLE_ATTACK_FIND_OK* pMsg)
{
	// 2005-08-05 by ispark
	// 미사일 버그 대대적인 공사 - 기존 소스 검색 방법에 문제가 있었다.
	if(!m_pScene->m_pWeaponData)
		return;
	CWeapon * pNode = (CWeapon *)m_pScene->m_pWeaponData->m_pChild;
	while(pNode)
	{
		if( (pNode->m_dwPartType == _MISSILE || pNode->m_dwPartType == _ROCKET ) &&
			pMsg->AttackIndex == ((CWSlowData*)pNode)->m_nClientIndex && 
			pMsg->WeaponIndex == ((CWSlowData*)pNode)->m_nWeaponIndex)
		{
			((CWSlowData*)pNode)->m_dwWeaponState = _EXPLODING;

			if(pMsg->TargetIndex >= MONSTER_CLIENT_INDEX_START_NUM)
			{
				CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->TargetIndex);
				if(itMonster != m_pScene->m_mapMonsterList.end())
				{
					D3DXVec3Normalize(&itMonster->second->m_vAttackVel,&(itMonster->second->m_vPos - ((CWSlowData*)pNode)->m_vPos));
					itMonster->second->m_bAniColl = TRUE;
					itMonster->second->m_fAniCollTime = 1.0f;
				}
			}
			break;
		}

		pNode = (CWeapon *)pNode->m_pNext;
	}
}

VOID CAtumApplication::FieldSocketBattleDropMineOk(MSG_FC_BATTLE_DROP_MINE_OK* pMsg)
{
	if(m_pScene->m_pWeaponData)
	{
		CAtumNode * pWeapon = NULL;
#ifdef _DEBUG
		pWeapon = m_pScene->m_pWeaponData->m_pChild;
		while(pWeapon)
		{
			if( pWeapon->m_dwPartType == _MINE && 
				((CWeaponMineData *)pWeapon)->m_nFieldItemIndex == pMsg->ItemFieldIndex)
			{
				DWORD dwState = ((CWeaponMineData *)pWeapon)->m_dwWeaponState;
				DBGOUT( "MSG_FC_BATTLE_DROP_MINE_OK, Mine DUPLICATE[ItemFieldIndex == %d]\n",pMsg->ItemFieldIndex);
//				return ;
			}
			pWeapon = (CWeaponMineData *)pWeapon->m_pNext;
		}
#endif
		pWeapon = new CWeaponMineData(pMsg);
		pWeapon = (CWeaponMineData *)m_pScene->m_pWeaponData->AddChild(pWeapon);
		if(m_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->AttackIndex)
		{
			m_pShuttleChild->ResetSecondaryWeaponBodyCondition(WEAPON_BODYCON_FIRE_1);
			m_pShuttleChild->ResetSecondaryWeaponBodyCondition(WEAPON_BODYCON_FIRE_1, FALSE);
			m_pShuttleChild->m_pSecondaryWeapon->SetWeaponCount(pMsg->RemainedBulletFuel);
			if(m_pShuttleChild->m_pSecondaryWeapon)
			{
				m_pShuttleChild->m_pSecondaryWeapon->AddMine( (CWeaponMineData *)pWeapon );
			}
		}
	}
}

VOID CAtumApplication::FieldSocketBattleMineAttackOk(MSG_FC_BATTLE_MINE_ATTACK_OK* pMsg)
{
//	DBGOUT("MSG_FC_BATTLE_MINE_ATTACK_OK\n");
	if(!m_pScene->m_pWeaponData)
		return ;
	CWeapon * pWeapon = (CWeapon *)m_pScene->m_pWeaponData->m_pChild;
	while(pWeapon)
	{
		if( pWeapon->m_dwPartType == _MINE && 
			((CWeaponMineData *)pWeapon)->m_nFieldItemIndex == pMsg->ItemFieldIndex &&
			((CWeaponMineData *)pWeapon)->m_dwWeaponState == _NORMAL)
		{
			// Effect 추가해야함
			if(IS_VALID_CLIENT_INDEX(pMsg->TargetInfo.TargetIndex))
			{
				if(pMsg->TargetInfo.TargetIndex == m_pShuttleChild->m_myShuttleInfo.ClientIndex)
				{
					pWeapon->m_pTarget = m_pShuttleChild;
					((CWeaponMineData *)pWeapon)->m_nTargetItemFieldIndex = pMsg->TargetInfo.TargetItemFieldIndex;
					pWeapon->m_dwWeaponState = _EXPLODING;
				}
				else
				{
					CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->TargetInfo.TargetIndex);
					if(itEnemy != m_pScene->m_mapEnemyList.end())
					{
						pWeapon->m_pTarget = itEnemy->second;
						((CWeaponMineData *)pWeapon)->m_nTargetItemFieldIndex = pMsg->TargetInfo.TargetItemFieldIndex;
						pWeapon->m_dwWeaponState = _EXPLODING;
					}
				}
				return;
			}
			else
			{
				CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->TargetInfo.TargetIndex);
				if(itMonster != m_pScene->m_mapMonsterList.end())
				{
					pWeapon->m_pTarget = itMonster->second;
					((CWeaponMineData *)pWeapon)->m_nTargetItemFieldIndex = pMsg->TargetInfo.TargetItemFieldIndex;
					pWeapon->m_dwWeaponState = _EXPLODING;
					return;
				}
			}
			// 아이템 습득한 클라이언트가 없으면 아이템만 삭제
			pWeapon->m_bUsing = FALSE;
			return;
		}
		pWeapon = (CWeapon *)pWeapon->m_pNext;
	}
}

VOID CAtumApplication::FieldSocketBattleMineAttackFindOk(MSG_FC_BATTLE_MINE_ATTACK_FIND_OK* pMsg)
{
	ASSERT_ASSERT(m_pScene->m_pWeaponData);
	CWeapon * pWeapon = (CWeapon *)m_pScene->m_pWeaponData->m_pChild;
	while(pWeapon)
	{
		if( pWeapon->m_dwPartType == _MINE &&
			((CWeaponMineData *)pWeapon)->m_nFieldItemIndex == pMsg->ItemFieldIndex)
		{
			if(!COMPARE_BODYCON_BIT(pWeapon->m_bodyCondition,BODYCON_HIT_MASK))
			{
				pWeapon->m_bodyCondition = BODYCON_HIT_MASK;
				if(pWeapon->m_pCharacterInfo)
					pWeapon->m_pCharacterInfo->ChangeBodyCondition(pWeapon->m_bodyCondition);
			}
			pWeapon->m_dwWeaponState = _EXPLODED;
			((CWeaponMineData *)pWeapon)->m_nFieldItemIndex = 0xFFFFFFFF;
			return;
		}
		pWeapon = (CWeapon *)pWeapon->m_pNext;
	}
}

VOID CAtumApplication::FieldSocketTimerStartTimer(MSG_FC_TIMER_START_TIMER* pMsg)
{	
	m_pShuttleChild->m_timeProcess.StartTimer(pMsg);
}

VOID CAtumApplication::FieldSocketTimerStopTimer(MSG_FC_TIMER_STOP_TIMER* pMsg)
{
	m_pShuttleChild->m_timeProcess.StopTimer(pMsg);	
}

VOID CAtumApplication::FieldSocketTimerUpdateTimer(MSG_FC_TIMER_UPDATE_TIMER* pMsg)
{
	m_pShuttleChild->m_timeProcess.UpdateTimer(pMsg);
}

VOID CAtumApplication::FieldSocketTimerPauseTimer(MSG_FC_TIMER_PAUSE_TIMER* pMsg)
{
	m_pShuttleChild->m_timeProcess.PauseTimer(pMsg);
}

VOID CAtumApplication::FieldSocketTimerContinueTimer(MSG_FC_TIMER_CONTINUE_TIMER* pMsg)
{
	m_pShuttleChild->m_timeProcess.ContinueTimer(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketSKillPrepareUseOk(MSG_FC_SKILL_PREPARE_USE_OK* pMsg)
/// \brief		발동된 스킬 이펙트를 추가한다.
/// \author		jschoi
/// \date		2004-10-12 ~ 2004-10-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSKillPrepareUseOk(MSG_FC_SKILL_PREPARE_USE_OK* pMsg)
{
	ITEM* pSkill = g_pDatabase->GetServerItemInfo(pMsg->SkillItemID.ItemNum);
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindItemSkill(pSkill->ItemNum);
		pSkillInfo->PrepareSkillFromServer();

		// 이펙트
			g_pShuttleChild->m_pSkillEffect->CreateSkillEffect(pMsg->SkillItemID.ItemNum,BODYCON_CHARGING_MASK);
	}
	else // Enemy or Monster
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
		if(pUnit)
		{
//			if(IS_EXIST_DES_PARAM(pSkill,DES_SKILL_HYPERSHOT))
//			{//하이퍼샷.
//			}
//			else if(IS_EXIST_DES_PARAM(pSkill,DES_SKILL_BIG_BOOM))
//			{// 빅붐.
//			}
//			else 
//			{// 차징샷
//			}
		
			// 이펙트
			pUnit->m_pSkillEffect->CreateSkillEffect(pMsg->SkillItemID.ItemNum,BODYCON_CHARGING_MASK);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketCancelPrepareOk(MSG_FC_SKILL_CANCEL_PREPARE_OK* pMsg)
/// \brief		발동된 스킬 이펙트를 추가한다.
/// \author		jschoi
/// \date		2004-10-12 ~ 2004-10-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCancelPrepareOk(MSG_FC_SKILL_CANCEL_PREPARE_OK* pMsg)
{
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		g_pShuttleChild->m_pSkillEffect->DeleteSkillEffect(pMsg->SkillItemID.ItemNum);
	}
	else // Enemy or Monster
	{
		CUnitData* pUnit = g_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
		if(pUnit)
		{
		    pUnit->m_pSkillEffect->DeleteSkillEffect(pMsg->SkillItemID.ItemNum);	
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketMoveWeaponVelOk(MSG_FC_MOVE_WEAPON_VEL_OK* pMsg)
/// \brief		MSG_FC_MOVE_WEAPON_VEL_OK, Enemy,(Monster)의 WeaponVel처리
/// \author		dhkwon
/// \date		2004-10-18 ~ 2004-10-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveWeaponVelOk(MSG_FC_MOVE_WEAPON_VEL_OK* pMsg)
{
	CUnitData* pUnit = m_pScene->FindUnitDataByClientIndex( pMsg->ClientIndex );
	if( pUnit && pUnit != m_pShuttleChild )
	{
		pUnit->SetWeaponVelFromServer( (D3DXVECTOR3)pMsg->WeaponVel );
		// 2010-06-15 by shcho&hslee 펫시스템 - 시즈 모드
		pUnit->SetPetVelFromServer( pMsg->PetLeftVel, pMsg->PetRightVel );
		// end 2010-06-15 by shcho&hslee 펫시스템 - 시즈 모드
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCountdownStart(MSG_FC_COUNTDOWN_START* pMsg)
/// \brief		카운트 다운 처리(카운트 시작)
/// \author		ydkim
/// \date		2004-10-20 ~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCountdownStart(MSG_FC_COUNTDOWN_START* pMsg)
{
	g_pGameMain->m_pGameCountDown->SetCountDown(pMsg->byCountdownType,pMsg->nWaitingSecond, COLOR_VOIP);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCityCheckWarpStateOk(MSG_FC_CITY_CHECK_WARP_STATE_OK* pMsg)
/// \brief		도시에서 출격이 가능한가에 대한 요청에 대한 답변 처리
/// \author		jschoi
/// \date		2004-10-25 ~ 2004-10-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityCheckWarpStateOk(MSG_FC_CITY_CHECK_WARP_STATE_OK* pMsg)
{
	if(pMsg->Err == NOERROR)
	{
		SAFE_DELETE(g_pShuttleChild->m_pCinemaCamera);
		if( m_dwGameState==_CITY &&
			g_pShuttleChild->InitCinemaUnit(PATTERN_UNIT_CITY_OUT, TRUE) == TRUE)
		{
			g_pShuttleChild->m_nCurrentPatternNumber = PATTERN_UNIT_CITY_OUT;
			StartFadeEffect(FALSE,2,D3DCOLOR_ARGB(0,0,0,0));
			g_pD3dApp->m_pSound->PlayD3DSound( SOUND_TAKEINGOFF_IN_CITY, g_pShuttleChild->m_vPos, FALSE);
			g_pShuttleChild->ChangeSingleBodyCondition(BODYCON_TAKEOFF_MASK);

			g_pShuttleChild->ChangeUnitState( _TAKINGOFF );

			CAppEffectData * pEffect = new CAppEffectData(RC_EFF_LANDING_TAKEOFF,MAP_TYPE_CITY_UNIT_POS);
			pEffect->ChangeBodyCondition(BODYCON_LANDED_MASK);
			g_pD3dApp->m_pEffectList->AddChild(pEffect);
		}
		else
		{
			if(g_pShuttleChild->m_nEventType == EVENT_CITY_OUTDOOR)
			{
				g_pInterface->m_pCityBase->SendEventRequestWarpToOutdoor();
			}
			else if(g_pShuttleChild->m_nEventType == EVENT_CITY_OUT_MOVE)
			{
				CINFCityWarp* pCityWarp = g_pInterface->m_pCityBase->GetCityWarp();
				ASSERT_ASSERT(pCityWarp);
				pCityWarp->SendFieldSocketRequestShopWarp();
			}
		}
	}
	else if(pMsg->Err == ERR_PROTOCOL_ALREADY_PARTY_BATTLE)
	{
		m_pChat->CreateChatChild(STRMSG_C_PARTY_0052,COLOR_PARTY);//"편대전이 종료되지 않아 출격이 불가능합니다."
	}
	else
	{

	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCitywarGetOccupyinfoOk(MSG_FC_CITYWAR_GET_OCCUPYINFO_OK* pMsg)
/// \brief		점령 도시 정보를 가져온다
/// \author		ydkim
/// \date		2005-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCitywarGetOccupyinfoOk(MSG_FC_CITYWAR_GET_OCCUPYINFO_OK* pMsg)
{
	CINFCityOccupy* pCityOccupy = NULL;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITY_OCCUPY_INFO);
	if(it != g_pInterface->m_pCityBase->m_mapCityShop.end())
	{
		pCityOccupy = ((CINFCityOccupy*)it->second);		
	}
	if(pCityOccupy == NULL)
		return;
	pCityOccupy->m_vecInfoOccupy.clear();
	pCityOccupy->m_pTimeDef	= pMsg->CityWarOccupyInfo3.CityWarDefaultTime;

	if(pMsg->CityWarOccupyInfo3.OccupyGuildUID != INVALID_GUILD_UID)
	{
		wsprintf( pCityOccupy->strOccupyGuild, STRMSG_C_OCCUPY_0024, pMsg->CityWarOccupyInfo3.OccupyGuildName);//"[점령여단 : %s]"
		pCityOccupy->m_nOccupyGuildMasterUID = pMsg->CityWarOccupyInfo3.OccupyGuildMasterCharacterUID;
		pCityOccupy->m_nOccupyGuildUID			= pMsg->CityWarOccupyInfo3.OccupyGuildUID;
		wsprintf( g_pInterface->m_pCityBase->m_strGuildMasterGr, 
			"\\g[%s]\\g%s",
			pMsg->CityWarOccupyInfo3.OccupyGuildName,
			pMsg->CityWarOccupyInfo3.szBriefing);
	}
	
	char strtemp[SIZE_MAX_CITY_BRIEFING_LENGTH];
	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);

	SCITY_OCCUPY_INFO	CityWarOccupyInfo3 = pMsg->CityWarOccupyInfo3;							// 도시점령전 점령 정보
	pCityOccupy->m_vecInfoOccupy.push_back(STRMSG_C_OCCUPY_0025);				// index 0//"\\g   *미입력시 초기값이 설정*"

	wsprintf( strtemp, STRMSG_C_OCCUPY_0026, (int)(CityWarOccupyInfo3.fTexPercent));//"[%d%% 세율이 적용되었습니다]"
	pCityOccupy->m_vecInfoOccupy.push_back(strtemp);											// index 1	세율 설정
	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);

	wsprintf( strtemp, STRMSG_C_OCCUPY_0027, //"[%d년 %d월 %d일 %d시%d분]"
		(int)CityWarOccupyInfo3.CityWarSettingTime.Year,
		(int)CityWarOccupyInfo3.CityWarSettingTime.Month,
		(int)CityWarOccupyInfo3.CityWarSettingTime.Day,
		(int)CityWarOccupyInfo3.CityWarSettingTime.Hour,
		(int)CityWarOccupyInfo3.CityWarSettingTime.Second);
	pCityOccupy->m_vecInfoOccupy.push_back(strtemp);											// index 2	OCCUPY_DATE_WAR
	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);

//	m_vecInfoOccupy.push_back("[사용, 미사용]");												// index 3	OCCUPY_USE_STORE
//	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);
	
	///////////////////////////////////////////////////////////
	//
	vector<BUILDINGNPC*> VecBuildingNPC;
//	vector<int> vecNotOccupy;
//	vector<int> vecOccupy;

	VecBuildingNPC.clear();
	pCityOccupy->vecNotOccupy.clear();
	pCityOccupy->vecOccupy.clear();

	g_pDatabase->FindBuildingNPCListOccupyShop(g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, 
		&VecBuildingNPC);
	pCityOccupy->SortStoreOccupyByVecBuildingNPC(&VecBuildingNPC);

	vector<BUILDINGNPC*>::iterator buildit = VecBuildingNPC.begin();
	while (buildit != VecBuildingNPC.end()) 
	{
		if((*buildit)->OwnerOrderNumber <= CityWarOccupyInfo3.nDefenseCounts)
		{
			// 점령된 상점			
			pCityOccupy->vecOccupy.push_back((int)(*buildit)->MapIndex);
		}
		else 
		{
			// 점령되지 않은 상점
			pCityOccupy->vecNotOccupy.push_back((int)(*buildit)->MapIndex);
		}
			
		buildit++;
	}
	//
	///////////////////////////////////////////////////////////

	if((int)pCityOccupy->vecOccupy.size() == 0)
	{
		pCityOccupy->m_vecInfoOccupy.push_back(STRMSG_C_OCCUPY_0028);	//"[점령된 상점이 없습니다]"
	}
	else
	{
		wsprintf( strtemp, STRMSG_C_OCCUPY_0029, (int)pCityOccupy->vecOccupy.size());//"%d개의 상점이 점령 되었습니다."
		pCityOccupy->m_vecInfoOccupy.push_back(strtemp);										// index 4	OCCUPY_OCCUPY_SHOP
		memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);
	}
	wsprintf( strtemp, STRMSG_C_OCCUPY_0030, (int)CityWarOccupyInfo3.nDefenseCounts);//"%d회 방어 성공."
	pCityOccupy->m_vecInfoOccupy.push_back(strtemp);										// index 4	OCCUPY_OCCUPY_SHOP
	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);

	wsprintf( strtemp, STRMSG_C_OCCUPY_0031, (int)CityWarOccupyInfo3.nSumOfTex);//"[현재 \\r%d\\r(SPI)]."
	pCityOccupy->m_vecInfoOccupy.push_back(strtemp);										// index 7	OCCUPY_TEX_INFO	
	memset(strtemp, 0x00, SIZE_MAX_CITY_BRIEFING_LENGTH);
	
	wsprintf( strtemp, "%s", CityWarOccupyInfo3.szBriefing);
	pCityOccupy->m_vecInfoOccupy.push_back(strtemp);													// index 5	OCCUPY_GREATING
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCitywarBringSumoftexOk(MSG_FC_CITYWAR_BRING_SUMOFTEX_OK* pMsg)
/// \brief		점령 도시 세금을 가져온다
/// \author		ydkim
/// \date		2005-02-15~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCitywarBringSumoftexOk(MSG_FC_CITYWAR_BRING_SUMOFTEX_OK* pMsg)
{
	char buf[128];
	memset(buf, 0x00, 128);
	wsprintf( buf, STRMSG_C_OCCUPY_0032, (int)pMsg->nBroughtSumOfTex);//"%d(스피)를 가져왔습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCitywarStartWar(MSG_FC_CITYWAR_START_WAR* pMsg)
/// \brief		도시 점령전 시작을 알린다
/// \author		ydkim
/// \date		2005-02-15~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCitywarStartWar(MSG_FC_CITYWAR_START_WAR* pMsg)
{
	if(NULL == g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3))
	{
		return;
	}
	char buf[256];
	memset(buf, 0x00, 256);
	wsprintf(buf, g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3));
	
	char szNotice[1024];
	sprintf(szNotice, STRMSG_C_OCCUPY_0033, buf); //"\"%s\" 도시점령전이 시작 되었습니다."
	m_pChat->CreateChatChild(szNotice, COLOR_SYSTEM);	

	// 현재 점령 여단	
	if(INVALID_GUILD_UID == pMsg->OccupyGuildUID3)
	{		
		wsprintf(szNotice, STRMSG_C_OCCUPY_0034);//"현재 NPC가 점령중입니다."
	}
	else
	{
		wsprintf(szNotice, STRMSG_C_OCCUPY_0035, pMsg->szOccupyGuildName3);//"현재 %s여단이 점령중입니다."
	}
	m_pChat->CreateChatChild(szNotice, COLOR_SYSTEM);

	sprintf(szNotice, STRMSG_C_OCCUPY_0036, buf); //"\"%s\" 맵에 모든 유저(점령 여단 제외)는"
	m_pChat->CreateChatChild(szNotice, COLOR_SYSTEM);
	m_pChat->CreateChatChild(STRMSG_C_OCCUPY_0037, COLOR_SYSTEM);//"    도시로 워프 됩니다.",

	if(	g_pShuttleChild && 
		g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex == pMsg->CityWarMapIndex3)
	{
		g_pShuttleChild->m_byCityWarTeamType = CITYWAR_TEAM_TYPE_DEFENSER;
		g_pShuttleChild->m_pPkNormalTimer->SetCityWar();

		if(g_pScene)
		{
			g_pScene->ChangeAllEnemyCityWarTeamType(CITYWAR_TEAM_TYPE_DEFENSER); // 모두 방어측으로 설정한다.
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCitywarEndWar(MSG_FC_CITYWAR_END_WAR* pMsg)
/// \brief		도시 점령전 끝을 알린다
/// \author		ydkim
/// \date		2005-02-15~
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCitywarEndWar(MSG_FC_CITYWAR_END_WAR* pMsg)
{	
	if(NULL == g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3))
	{
		return;
	}
	char buf[256];
	memset(buf, 0x00, 256);
	wsprintf(buf, g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3));

	char szNotice[1024];
	sprintf(szNotice, STRMSG_C_OCCUPY_0038, buf);//"\"%s\" 도시점령전이 종료 되었습니다."
	m_pChat->CreateChatChild(szNotice,COLOR_SYSTEM);

	if(INVALID_GUILD_UID == pMsg->OccupyGuildUID3)
	{
		sprintf(szNotice, STRMSG_C_OCCUPY_0039, buf);//"\"NPC\"가 \"%s\"을 점령하였습니다."
	}
	else
	{
		sprintf(szNotice, STRMSG_C_OCCUPY_0040, pMsg->szOccupyGuildName3, buf); //"\"%s\"여단이 \"%s\"을 점령하였습니다."
	}
	m_pChat->CreateChatChild(szNotice,COLOR_SYSTEM);
	
	ATUM_DATE_TIME tmTime = pMsg->atimeNextCityWarDefaultTime;
	tmTime.AddDateTime(0, 0, 0, TIMEGAP_CITYWAR_CHANGEABLE_TERM_HOUR, 0, 0);
	sprintf(szNotice, STRMSG_C_OCCUPY_0041			//"다음 \"%s\" 도시점령전 예정시간은"
		, buf);
	m_pChat->CreateChatChild(szNotice,COLOR_SYSTEM);
	//%s ~ %s에 진행됩니다.
	sprintf(szNotice, STRMSG_C_OCCUPY_0042			//"%s ~ %s에 진행되며 "
		, pMsg->atimeNextCityWarDefaultTime.GetLocalDateTimeString(string(),GetLanguageType(), TRUE)
		, tmTime.GetLocalDateTimeString(string(),GetLanguageType(), TRUE));
	m_pChat->CreateChatChild(szNotice,COLOR_SYSTEM);

	sprintf(szNotice, STRMSG_C_OCCUPY_0043);//"점령여단장에 따라 시간이 변경될 수 있습니다."
	m_pChat->CreateChatChild(szNotice,COLOR_SYSTEM);

	if(	g_pShuttleChild &&
		g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex == pMsg->CityWarMapIndex3)
	{
		if(g_pShuttleChild->m_pPkNormalTimer)
		{
			g_pShuttleChild->m_pPkNormalTimer->ReleaseCityWar();
		}
		
		g_pShuttleChild->m_byCityWarTeamType = CITYWAR_TEAM_TYPE_NORMAL;

		if(g_pScene)
		{
			g_pScene->ChangeAllEnemyCityWarTeamType(CITYWAR_TEAM_TYPE_NORMAL); // 도시점령전 진행전으로 설정한다
		}
	}
}



/////////////////////////////////////////////////////////////////////////////// 
/// \fn			FieldSocketCharacterGetCashMoneyCountOk(MSG_FC_CHARACTER_GET_CASH_MONEY_COUNT_OK* pMsg) 
/// \brief		나의 캐쉬 머니를 가져온다(상점에 들어가면 한번만 신청 한다) 
/// \author		ydkim 
/// \date		2005-02-15~ 
/// \warning	 
/// 
/// \param		 
/// \return		 
/////////////////////////////////////////////////////////////////////////////// 
VOID CAtumApplication::FieldSocketCharacterGetCashMoneyCountOk(MSG_FC_CHARACTER_GET_CASH_MONEY_COUNT_OK* pMsg) 
{ 
	CINFCityCashShop* pCityCash = NULL; 
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CASH_SHOP); 
	if(it != g_pInterface->m_pCityBase->m_mapCityShop.end()) 
	{ 
		pCityCash = ((CINFCityCashShop*)it->second);		 
	} 
	if(pCityCash == NULL) 
		return; 
	 
	pCityCash->SetCashMoney(pMsg->nMCash); 
	pCityCash->SetGiftCardCashPoint(pMsg->nGiftCard);
	if(pCityCash->IsInputItemDone())
	{
		g_pD3dApp->m_bRequestEnable = TRUE;			// 2006-07-07 by ispark, 메세지 응답 완료. 캐쉬상점은 항상 서버로 부터 캐쉬 머니를 받는다.
	}
} 

/////////////////////////////////////////////////////////////////////////////// 
/// \fn			FieldSocketCharacterChangeCharacterModeOk(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE_OK* pMsg)
/// \brief		캐릭터 모드로 전환
/// \author		ydkim 
/// \date		2005-07-26~ 
/// \warning	 
/// 
/// \param		 
/// \return		 
/////////////////////////////////////////////////////////////////////////////// 
VOID CAtumApplication::FieldSocketCharacterChangeCharacterModeOk(MSG_FC_CHARACTER_CHANGE_CHARACTER_MODE_OK* pMsg)
{
	if(pMsg->ClientIndex != m_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_pScene->ChangeEnemyCharacterMode(pMsg);
	}
} 



///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketSkillUseAck(MSG_FC_SKILL_CONFIRM_USE_ACK* pMsg)
/// \brief		스킬 사용 허가 응답
/// \author		ispark
/// \date		2005-12-03 ~ 2005-12-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSkillConfirmUseAck(MSG_FC_SKILL_CONFIRM_USE_ACK* pMsg)
{
	char szNotice[1024] = {0, };
	vector<PARTYENEMYINFO*>::iterator itParty = g_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.begin();
	while(itParty != g_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.end())
	{
		if((*itParty)->m_ImPartyMemberInfo.CharacterUniqueNumber == pMsg->TargetCharacterUID)
		{
			wsprintf(szNotice, "%s", (*itParty)->m_ImPartyMemberInfo.CharacterName);
			break;
		}

		itParty++;
	}

	ITEM* pItem = g_pShuttleChild->m_pSkill->FindItem(pMsg->UsingSkillItemNum);
	if(pItem)
	{
		if(pMsg->bYesOrNo)
		{
			// 승인
			g_pShuttleChild->m_pSkill->SetTargetIndex(0);
			g_pShuttleChild->m_pSkill->SetCharacterUID(pMsg->TargetCharacterUID);

			CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindItemSkill(pMsg->UsingSkillItemNum);
			pSkillInfo->SetCheckAckWaitingTime(0);

			// 2008-02-26 by bhsohn 통합 아레나 관련 버그 수정
			// 서버 이름 제거
			g_pD3dApp->ConevertArenaRenderUserName(g_pD3dApp->GetArenaState(), szNotice);

			wsprintf(szNotice, STRMSG_C_051203_0004, szNotice, pItem->ItemName);//"%s님이 [%s] 스킬을 승인 하셨습니다."
			m_pChat->CreateChatChild(szNotice,COLOR_ERROR);
		}
		else
		{			
			// 2008-02-26 by bhsohn 통합 아레나 관련 버그 수정
			// 서버 이름 제거
			g_pD3dApp->ConevertArenaRenderUserName(g_pD3dApp->GetArenaState(), szNotice);

			// 거부
			wsprintf(szNotice, STRMSG_C_051203_0003, szNotice, pItem->ItemName);//"%s님이 [%s] 스킬을 거부 하셨습니다."
			m_pChat->CreateChatChild(szNotice,COLOR_ERROR);

			// 스킬 삭제
			CSkillInfo* pSkillInfo = g_pShuttleChild->m_pSkill->FindItemSkill(pMsg->UsingSkillItemNum);
			g_pGameMain->m_pInfSkill->DeleteSkillInfo(pSkillInfo);
			pSkillInfo->ReleaseParamFactor();
			g_pShuttleChild->m_pSkill->EraseUsingSkill(pSkillInfo);
		}

		// 2009. 04. 22 by ckPark 콜오브히어로시 같은 타겟에만 나가던 문제 해결

		g_pShuttleChild->m_pSkill->SetCharacterUID( 0 );

		// end 2009. 04. 22 by ckPark 콜오브히어로시 같은 타겟에만 나가던 문제 해결
	}
	else
	{
		DBGOUT("%d 스킬이 존재하지 않음\n", pMsg->UsingSkillItemNum);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ispark
/// \date		2005-12-03 ~ 2005-12-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketSkillConfirmUse(MSG_FC_SKILL_CONFIRM_USE* pMsg)
{
	// 2006-08-02 by ispark, 개인상점중이면 콜오브히어로  응답 메세지 불가


	// 2009. 04. 06 by ckPark 콜오브히어로시 다른 타겟팅 스킬 못쓰는 문제
// 	if(g_pInterface->m_pBazaarShop)
// 	{
// 		return;
// 	}
	
	if( g_pInterface->m_pBazaarShop
		|| g_pShuttleChild->m_pSkill->GetSkillConfirm().AttackCharacterUID
		|| g_pShuttleChild->m_pSkill->GetSkillConfirm().TargetCharacterUID )
	{
		MSG_FC_SKILL_CONFIRM_USE_ACK sMsg;
		sMsg.bYesOrNo = FALSE;				// 거부
		sMsg.AttackCharacterUID		= pMsg->AttackCharacterUID;		// 스킬 사용자 CharacterUID
		sMsg.TargetCharacterUID		= pMsg->TargetCharacterUID;		// 스킬 타겟 CharacterUID
		sMsg.UsingSkillItemNum		= pMsg->UsingSkillItemNum;		// 사용 스킬 ItemNum
		sMsg.SkillConfirmUseUID		= pMsg->SkillConfirmUseUID;
		g_pFieldWinSocket->SendMsg(T_FC_SKILL_CONFIRM_USE_ACK, (char*)&sMsg, sizeof(sMsg));
		return;
	}
	// end 2009. 04. 06 by ckPark 콜오브히어로시 다른 타겟팅 스킬 못쓰는 문제



	// 데이타 입력
	g_pShuttleChild->m_pSkill->SetSkillConfirmData(pMsg);

	char chMsg[128];
	// 2008-02-26 by bhsohn 통합 아레나 관련 버그 수정
	//wsprintf(chMsg, STRMSG_C_051203_0002, pMsg->szAttackCharacterName); //"%s님이 콜오브히어로를 쓰셨습니다. 허락하시겠습니까?"
	char szCharName[SIZE_MAX_ARENA_FULL_NAME];
	STRNCPY_MEMSET(szCharName, pMsg->szAttackCharacterName, SIZE_MAX_ARENA_FULL_NAME);	
	// 서버 이름 제거
	g_pD3dApp->ConevertArenaRenderUserName(g_pD3dApp->GetArenaState(), szCharName);
	wsprintf(chMsg, STRMSG_C_051203_0002, szCharName); //"%s님이 콜오브히어로를 쓰셨습니다. 허락하시겠습니까?"
	
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(chMsg, _Q_SKILL_CALLOFHERO,10,STRMSG_C_060724_0000); // 10초를 기다린다.
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCityCheckWarpStateOk(MSG_FC_CITY_CHECK_WARP_STATE_OK* pMsg)
/// \brief		도시에서 출격이 가능한가에 대한 요청에 대한 답변 처리
/// \author		jschoi
/// \date		2004-10-25 ~ 2004-10-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBattleShowDamage(MSG_FC_BATTLE_SHOW_DAMAGE* pMsg)
{
// 2014-12-19 by jwLee "/데미지출력" 명령어 추가
//#ifdef _DEBUG
//	if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER) && m_bDamageSysMessagePrint)
// end 2014-12-19 by jwLee "/데미지출력" 명령어 추가
	{
		char msg[MAX_PATH];
		CUnitData* pTarget = m_pScene->FindUnitDataByClientIndex(pMsg->TargetIndex);
		if( pTarget )
		{
			if(pTarget->m_dwPartType == _ENEMY)
			{
				wsprintf( msg, STRMSG_C_INTERFACE_0050, //"%s님이 %d 데미지를 입었습니다.(DamageKind:%d)"
					((CEnemyData*)pTarget)->m_infoCharacter.CharacterInfo.CharacterName,
  					pMsg->AmountDamage, pMsg->DamageKind );
			}
			else if(pTarget->m_dwPartType == _SHUTTLE)
			{
				wsprintf( msg, STRMSG_C_INTERFACE_0050, 
					m_pShuttleChild->m_myShuttleInfo.CharacterName,
					pMsg->AmountDamage, pMsg->DamageKind );
			}
			else if(pTarget->m_dwPartType == _MONSTER)
			{
				wsprintf( msg, STRMSG_C_MONSTER_0003, //"%s이(가) %d 데미지를 입었습니다.(DamageKind:%d)"
					((CMonsterData*)pTarget)->m_pMonsterInfo->MonsterName,
					pMsg->AmountDamage, pMsg->DamageKind );
			}
			else if(pTarget->m_dwPartType == _ADMIN)	// 2005-10-25 by ispark
			{
				wsprintf( msg, STRMSG_C_MONSTER_0003, //"%s이(가) %d 데미지를 입었습니다.(DamageKind:%d)"
					"GM",
					pMsg->AmountDamage, pMsg->DamageKind );
			}			
			
			m_pChat->CreateChatChild(msg,COLOR_VOIP);
		}
	}
// 2014-12-19 by jwLee "/데미지출력" 명령어 추가
//#endif
// end 2014-12-19 by jwLee "/데미지출력" 명령어 추가
	// ShuttleChild인 경우 Critical Damage로 대체한다.
	if(g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->TargetIndex)
	{
		pMsg->DamageKind = DAMAGEKIND_CRITICAL;

		// 2008-11-13 by bhsohn 조이스틱 작업
		// 무기충돌 진동
		if(pMsg->byIsPrimaryWeapon)
		{
			g_pD3dApp->SetJoyStickFeedback(TRUE, JOY_FEED_WEAPON1_DAMAGE);
		}
		else
		{
			g_pD3dApp->SetJoyStickFeedback(TRUE, JOY_FEED_WEAPON2_DAMAGE);
		}
		// end 2008-11-13 by bhsohn 조이스틱 작업
	}

//  2005-06-02 by ydkim
//  데미지 보이기 ShowInterface에서도 보이게 한다 
//	if(g_pInterface->m_bShowInterface)
//	{
    // 2011. 03. 08 by jskim 인피3차 구현
	g_pGameMain->m_pDamageView->RecvBattleShowDamage( pMsg->TargetIndex, pMsg->AmountDamage, pMsg->DamageKind, pMsg->MultiTargetIndex );
    // end 2011. 03. 08 by jskim 인피3차 구현
//	}
//	else
//	{
//		g_pGameMain->m_pDamageView->vecDamage.clear();
//	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketEventCallWarpEventReqeust(MSG_FC_EVENT_CALL_WARP_EVENT_REQUEST* pMsg)
/// \brief		이벤트 맵
/// \author		ispark
/// \date		2006-07-24 ~ 2006-07-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventCallWarpEventReqeust(MSG_FC_EVENT_CALL_WARP_EVENT_REQUEST* pMsg)
{
	// 2006-08-02 by ispark, 개인상점중이면 이벤트 응답 메세지 불가
	if(g_pInterface->m_pBazaarShop)
	{
		return;
	}
	// 2007-05-15 by dgwoo 시간은 아래와 같은 함수로 변경.
	//g_pGameMain->m_pInfWindow->AddMsgBox(pMsg->szUserMessage, _Q_EVENT_CALL_WARP_REQUEST, pMsg->dwCallWarpEventID0, 0, (pMsg->dwSupportTermTick0 / 1000));
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(pMsg->szUserMessage, _Q_EVENT_CALL_WARP_REQUEST,(pMsg->dwSupportTermTick0 / 1000),STRMSG_C_060724_0000, pMsg->dwCallWarpEventID0,0);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellPutItemOK(MSG_FC_BAZAAR_SELL_PUT_ITEM_OK* pMsg)
/// \brief		아이템 등록 승인
/// \author		ispark
/// \date		2006-07-28 ~ 2006-07-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellPutItemOK(MSG_FC_BAZAAR_SELL_PUT_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_RegSellItemOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ispark
/// \date		2006-07-31 ~ 2006-07-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarBuyPutItemOK(MSG_FC_BAZAAR_BUY_PUT_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_RegBuyItemOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellCancelItemOK(MSG_FC_BAZAAR_SELL_CANCEL_ITEM_OK* pMsg)
/// \brief		아이템 삭제 승인
/// \author		ispark
/// \date		2006-07-28 ~ 2006-07-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellCancelItemOK(MSG_FC_BAZAAR_SELL_CANCEL_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_DelSellItemOK(pMsg);
}
	
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarBuyCancelItemOK(MSG_FC_BAZAAR_BUY_CANCEL_ITEM_OK* pMsg)
/// \brief		아이템 삭제 승인
/// \author		ispark
/// \date		2006-07-31 ~ 2006-07-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarBuyCancelItemOK(MSG_FC_BAZAAR_BUY_CANCEL_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_DelBuyItemOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellStartOK()
/// \brief		개인 판매 상점 시작
/// \author		ispark
/// \date		2006-07-28 ~ 2006-07-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellStartOK()
{
	g_pInterface->m_pBazaarShop->Recv_OpenShopOK();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarBuyStartOK()
/// \brief		개인 판매 상점 시작
/// \author		ispark
/// \date		2006-07-28 ~ 2006-07-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarBuyStartOK()
{
	g_pInterface->m_pBazaarShop->Recv_OpenShopOK();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarInfoOK(MSG_FC_BAZAAR_INFO_OK* pMsg)
/// \brief		개인 상점 정보
/// \author		ispark
/// \date		2006-07-28 ~ 2006-07-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarInfoOK(MSG_FC_BAZAAR_INFO_OK* pMsg)
{
	g_pShuttleChild->CheckBazaarInfo(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellReQuestItemListOK(MSG_FC_BAZAAR_SELL_REQUEST_ITEMLIST_OK* pMsg)
/// \brief		개인 상점 아이템 리스트 전송
/// \author		ispark
/// \date		2006-07-29 ~ 2006-07-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellReQuestItemListOK(MSG_FC_BAZAAR_SELL_REQUEST_ITEMLIST_OK* pMsg)
{
	// 상점 생성
	g_pInterface->VisitBazaarShop();

	// 아이템 등록
	SBAZAAR_SELL_ITEM * pSellItemInfo = (SBAZAAR_SELL_ITEM *)((char *)pMsg + sizeof(MSG_FC_BAZAAR_SELL_REQUEST_ITEMLIST_OK));
	for(int i = 0; i < pMsg->nItemListCnts0; i++)
	{
		g_pInterface->m_pBazaarShop->Recv_SetSellItem(pSellItemInfo);
		pSellItemInfo++;
	}

	m_bRequestEnable = TRUE;			// 응답 메세지 완료
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarBuyReQuestItemListOK(MSG_FC_BAZAAR_BUY_REQUEST_ITEMLIST_OK* pMsg)
/// \brief		개인 상점 리스트 전송
/// \author		ispark
/// \date		2006-07-31 ~ 2006-07-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarBuyReQuestItemListOK(MSG_FC_BAZAAR_BUY_REQUEST_ITEMLIST_OK* pMsg)
{
	// 상점 생성
	g_pInterface->VisitBazaarShop();

	// 아이템 등록
	SBAZAAR_BUY_ITEM * pBuyItemInfo = (SBAZAAR_BUY_ITEM *)((char *)pMsg + sizeof(MSG_FC_BAZAAR_BUY_REQUEST_ITEMLIST_OK));
	for(int i = 0; i < pMsg->nItemListCnts0; i++)
	{
		g_pInterface->m_pBazaarShop->Recv_SetBuyItem(pBuyItemInfo);
		pBuyItemInfo++;
	}

	m_bRequestEnable = TRUE;			// 응답 메세지 완료
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellItemEnchantlistOK(MSG_FC_BAZAAR_SELL_ITEM_ENCHANTLIST_OK* pMsg)
/// \brief		개인 상점 아이템 인첸트 리스트 전송
/// \author		ispark
/// \date		2006-07-29 ~ 2006-07-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellItemEnchantlistOK(MSG_FC_BAZAAR_SELL_ITEM_ENCHANTLIST_OK* pMsg)
{

	for(int i = 0; i < pMsg->nEnchatCnts; i++)
	{
		int EnchantItemNum = *(INT*)(((char*)pMsg)+sizeof(MSG_FC_BAZAAR_SELL_ITEM_ENCHANTLIST_OK)+sizeof(INT)*i);
		g_pInterface->m_pBazaarShop->Recv_SetSellEnchantItem(pMsg->itemUID, EnchantItemNum);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarCustomerInfoOK(MSG_FC_BAZAAR_CUSTOMER_INFO_OK* pMsg)
/// \brief		상점에 들어온 유저 로그
/// \author		ispark
/// \date		2006-07-29 ~ 2006-07-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarCustomerInfoOK(MSG_FC_BAZAAR_CUSTOMER_INFO_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_CustomerInfoOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarSellBuyItemOK(MSG_FC_BAZAAR_SELL_BUY_ITEM_OK* pMsg)
/// \brief		아이템 판매 승인
/// \author		ispark
/// \date		2006-07-29 ~ 2006-07-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarSellBuyItemOK(MSG_FC_BAZAAR_SELL_BUY_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_SellBuyItemOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketBazaarBuySellItemOK(MSG_FC_BAZAAR_BUY_SELL_ITEM_OK* pMsg)
/// \brief		아이템 구매 승인
/// \author		ispark
/// \date		2006-07-31 ~ 2006-07-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBazaarBuySellItemOK(MSG_FC_BAZAAR_BUY_SELL_ITEM_OK* pMsg)
{
	g_pInterface->m_pBazaarShop->Recv_BuySellItemOK(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketNotifyServerShutdown()
/// \brief		게임 30초 후 자동 종료
/// \author		ispark
/// \date		2006-08-04 ~ 2006-08-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketNotifyServerShutdown()
{
	if(m_bGameShutDown == FALSE)
	{
		g_pInterface->SetShutDownStart();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \class		VOID CAtumApplication::
/// \brief		판도라 상자 이벤트에서 얻은 결과.
///
/// \author		dgwoo
/// \version	
/// \date		2006-08-10 ~ 2006-08-10
/// \warning	
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseRandomBoxOk(MSG_FC_ITEM_USE_RANDOMBOX_OK* pMsg)
{
	char buf[512];

	// 2008-08-26 by bhsohn 랜덤박스 시스템 변경
	//g_pD3dApp->m_bRequestEnable = TRUE;			// 응답 메세지 완료

	//다른 유저의 이벤트 결과인지 체크.
	if(0 != strcmp(m_pShuttleChild->m_myShuttleInfo.CharacterName,pMsg->szCharacterName0))
	{
		// 2007-07-20 by bhsohn 고대의 얼음 오픈시 다른 유저 팅김 현상 처리
		char itemname[ITEMINFO_ITEM_FULL_NAME];
		memset(itemname, 0x00, ITEMINFO_ITEM_FULL_NAME);
		g_pDatabase->GetItemNameRareString(itemname, pMsg->nResultItemNum0, pMsg->nPrefixCodeNum0, pMsg->nSuffixCodeNum0);

		wsprintf(buf,STRMSG_C_PARTY_0021,pMsg->szCharacterName0, itemname);
		m_pChat->CreateChatChild(buf,COLOR_SKILL_USE);
		// end 2007-07-20 by bhsohn 고대의 얼음 오픈시 다른 유저 팅김 현상 처리
		return;
	}

	//랜덤박스 결과 
	switch(pMsg->nRandomBoxResult)
	{
	case RANDOMBOX_RESULT_FAIL://아이템을 얻지 못한경우.
		
		m_pChat->CreateChatChild(STRMSG_C_060810_0100,COLOR_SKILL_USE);
		break;
	case RANDOMBOX_RESULT_ITEM://아이템을 얻은 경우 
		{
			char itemname[ITEMINFO_ITEM_FULL_NAME];
			memset(itemname, 0x00, ITEMINFO_ITEM_FULL_NAME);
			g_pDatabase->GetItemNameRareString(itemname, pMsg->nResultItemNum0, pMsg->nPrefixCodeNum0, pMsg->nSuffixCodeNum0);
			
			wsprintf(buf, STRMSG_C_060810_0101, itemname);
			m_pChat->CreateChatChild(buf, COLOR_ITEM);
			wsprintf(buf, STRMSG_C_ITEM_0006, itemname,pMsg->n64ResultCounts);
			m_pChat->CreateChatChild(buf, COLOR_SKILL_USE,CHAT_TAB_SYSTEM);

			// 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리

			// 필드 창고 아이템 알림메세지
			ITEM* pItem = g_pDatabase->GetServerItemInfo( pMsg->nResultItemNum0 );
			if( pItem && pItem->IsExistDesParam( DES_FIELD_STORE ) )
			{
				sprintf( buf, STRMSG_C_091008_0301, pItem->ItemName );	// "%s 아이템은 인벤토리에 들어오는 즉시 사용 시간이 적용 됩니다."
				m_pChat->CreateChatChild( buf, COLOR_ITEM );
			}

			// end 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리

			// 2013-06-26 by bhsohn 아머 컬렉션 추가 개발
			PopupUseRandomBoxOk(pMsg->nResultItemNum0);
			// END 2013-06-26 by bhsohn 아머 컬렉션 추가 개발
		}
		break;
	case RANDOMBOX_RESULT_EXP://경험치가 오른 경우.
		wsprintf(buf,STRMSG_C_060810_0102,pMsg->n64ResultCounts);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		wsprintf(buf,STRMSG_C_QUEST_0006,pMsg->n64ResultCounts);
		m_pChat->CreateChatChild(buf,COLOR_SKILL_USE);
		break;
	case RANDOMBOX_RESULT_SPI://SPI를 얻은 경우.
		wsprintf(buf,STRMSG_C_060810_0103,pMsg->n64ResultCounts);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		wsprintf(buf,STRMSG_C_ITEM_0002,pMsg->n64ResultCounts);
		m_pChat->CreateChatChild(buf,COLOR_SKILL_USE);
		break;
	default:
		break;
	}

}
///////////////////////////////////////////////////////////////////////////////
/// \class		
/// \brief		
///
/// \author		// 2008-08-26 by bhsohn 랜덤박스 시스템 변경
/// \version	
/// \date		2008-08-26 ~ 2008-08-26
/// \warning	
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketItemUseRandomBoxOkDone()
{
	// Done이 완료 후, 락을 푼다.
	g_pD3dApp->m_bRequestEnable = TRUE;			// 응답 메세지 완료
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketStoreRequestQuickslotOK(MSG_FC_STORE_REQUEST_QUICKSLOT_OK* pMsg)
/// \brief		퀵 슬롯 정보 요청 OK
/// \author		ispark
/// \date		2006-09-05 ~ 2006-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreRequestQuickslotOK(MSG_FC_STORE_REQUEST_QUICKSLOT_OK* pMsg)
{
	for(int i = 0; i < QUICKTABCOUNT; i++)
	{
		for(int j = 0; j < QUICKSLOTCOUNT; j++)
		{
			CItemInfo *pItemInfo = g_pStoreData->FindItemInInventoryByItemNum(pMsg->POS[i].arrItemNum_[j]);
			CSkillInfo *pSkillInfo = g_pShuttleChild->m_pSkill->FindItemSkill(pMsg->POS[i].arrItemNum_[j]);
			if(pItemInfo)
			{
				// 아이템
				g_pSOptionCharacter->UniqueNumber[i][j] = pItemInfo->UniqueNumber;
			}
			else if(pSkillInfo)
			{
				// 스킬
				g_pSOptionCharacter->UniqueNumber[i][j] = pSkillInfo->UniqueNumber;
			}

			g_pSOptionCharacter->ItemNum[i][j] = pMsg->POS[i].arrItemNum_[j];
		}
	}

	if(g_pGameMain->m_pQuickSlot)
		g_pGameMain->m_pQuickSlot->SetAllQSlotInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterUseBonusstatOK(MSG_FC_CHARACTER_USE_BONUSSTAT_OK* pMsg)\
/// \brief		보너스 스탯에 대한 응답
/// \author		ispark
/// \date		2006-09-18 ~ 2006-09-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterUseBonusstatOK(MSG_FC_CHARACTER_USE_BONUSSTAT_OK* pMsg)
{
	m_bRequestEnable = TRUE;			// 2006-09-18 by ispark, 메세지 응답
	m_pShuttleChild->m_myShuttleInfo.BonusStat = pMsg->byReaminBonusStat;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketUseSkillSupportItemOK(MSG_FC_ITEM_USE_SKILL_SUPPORT_ITEM_OK* pMsg)
/// \brief		스킬 보조 아이템
/// \author		ispark
/// \date		2006-10-02 ~ 2006-10-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketUseSkillSupportItemOK(MSG_FC_ITEM_USE_SKILL_SUPPORT_ITEM_OK* pMsg)
{
	FLOG("CAtumApplication::FieldSocketUseSkillSupportItemOK(MSG_FC_ITEM_USE_SKILL_SUPPORT_ITEM_OK* pMsg)");

	ITEM* pItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
	SetEffectUseItem(pItemInfo);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketGetServerDataTimeOK(MSG_FC_INFO_GET_SERVER_DATE_TIME_OK* pMsg)
/// \brief		서버 시간 가져오기
/// \author		ispark
/// \date		2006-10-11 ~ 2006-10-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketGetServerDataTimeOK(MSG_FC_INFO_GET_SERVER_DATE_TIME_OK* pMsg)
{
	g_ServerDateTime = pMsg->atimeCurServerTime;

	g_GameStartTime = timeGetTime();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketRequestPartyWarp(MSG_FC_QUEST_REQUEST_PARTY_WARP* pMsg)
/// \brief		퀘스트 승인 확인 메세지
/// \author		ispark
/// \date		2006-10-16 ~ 2006-10-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketRequestPartyWarp(MSG_FC_QUEST_REQUEST_PARTY_WARP* pMsg)
{
	// 상점중이면 응답 메세지 불가
	if(g_pInterface->m_pBazaarShop)
	{
		return;
	}
	
	char strMessage[1024] = {0,};
	char strCallUserName[SIZE_MAX_CHARACTER_NAME] = {0,};
	vector<PARTYENEMYINFO*>::iterator itParty = g_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.begin();
	while(itParty != g_pShuttleChild->m_pClientParty->m_vecPartyEnemyInfo.end())
	{
		if(pMsg->callerCharacterUID == (*itParty)->m_ImPartyMemberInfo.CharacterUniqueNumber)
		{
			strcpy(strCallUserName, (*itParty)->m_ImPartyMemberInfo.CharacterName);
			break;
		}
		
		itParty++;
	}

	wsprintf(strMessage, STRMSG_C_061016_0000, strCallUserName);
	//g_pGameMain->m_pInfWindow->AddMsgBox(strMessage, _Q_QUEST_REQUEST_PARTY_WARP, pMsg->warpMapChannIndex.MapIndex, pMsg->warpMapChannIndex.ChannelIndex, (pMsg->dwRemainTime / 1000), pMsg->callerCharacterUID);
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(strMessage, _Q_QUEST_REQUEST_PARTY_WARP,(pMsg->dwRemainTime / 1000),STRMSG_C_060724_0000, pMsg->warpMapChannIndex.MapIndex, pMsg->warpMapChannIndex.ChannelIndex,pMsg->callerCharacterUID);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketWarMonsterCreated(MSG_FC_WAR_MONSTER_CREATED* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-11-21 ~ 2006-11-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarMonsterCreated(MSG_FC_WAR_MONSTER_CREATED* pMsg)
{
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapChannIdx.MapIndex);
	
	char buf[1024] = {0,};
	char bufInfluence[64] = {0,};

	if(IS_MAP_INFLUENCE_VCN(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0000);
	}
	else if(IS_MAP_INFLUENCE_ANI(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0001);
	}
	else
	{
		// 맵에 대한 세력 내용이 없다.
		DBGOUT("@@ Not Map Data InfluenceType (FieldSocketWarMonsterCreated) @@\n");
		return;
	}
	wsprintf(buf, STRMSG_C_061121_0000, bufInfluence, pMapinfo->MapName);	// "\\c%s측\\c %s 지역에 전략 포인트가 생성되었습니다."
	m_pChat->CreateChatChild(buf, COLOR_ITEM);

	// 2007-07-04 by bhsohn 오퍼레이터 추가
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
	//CINFGameMainUnitInfoBar* pBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
	if(g_pGameMain->GetSummonMotherShipCnt() == 0)
	{
		// 모선이 없을떄만 띠운다. 
		// 시간 정보
		char bufTime[1024] = {0,};
		//wsprintf(bufTime, STRMSG_C_070712_0209, pMsg->CreateTime.Hour, pMsg->CreateTime.Minute);
		g_pInterface->AddInflWarMonster(buf, pMsg->MapChannIdx.MapIndex, pMapinfo->MapInfluenceType, pMsg->CreateTime);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketWarMonsterAutoDestroyed(MSG_FC_WAR_MONSTER_AUTO_DESTROYED* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-11-21 ~ 2006-11-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarMonsterAutoDestroyed(MSG_FC_WAR_MONSTER_AUTO_DESTROYED* pMsg)
{
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapChannIdx.MapIndex);
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->MonsterUnitKind);

	char buf[1024] = {0,};
	char bufInfluence[64] = {0,};

	if(IS_MAP_INFLUENCE_VCN(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0000);
	}
	else if(IS_MAP_INFLUENCE_ANI(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0001);
	}
	else
	{
		// 맵에 대한 세력 내용이 없다.
		DBGOUT("@@ Not Map Data InfluenceType (FieldSocketWarMonsterAutoDestroyed) @@\n");
		return;
	}
	
	wsprintf(buf, STRMSG_C_061121_0003, bufInfluence, pMapinfo->MapName);	// "\\c%s측\\c %s 지역 전략 포인트가 사라졌스니다."
	m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);

	// 2013-06-17 by bhsohn 세력포인트 표시 변경
// 	if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
// 	{
// 		memset(buf, 0x00, 1024);
// 		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// #ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN	
// 		wsprintf(buf, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."
// #else
// 		wsprintf(buf, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
// #endif
// //		
// 		
// 		// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// 		m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
// 	}
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
	memset(buf, 0x00, 1024);
	INT nInflPoint = 0;
	if(IS_MOTHERSHIPWAR_MONSTER(pMonsterInfo->Belligerence))
	{
		// 모선관련 처리
		if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{	
			// 모선 지키기 성공
			nInflPoint = CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER;			
		}
		else
		{
			// 모선 지키기 실패
			nInflPoint = CONTRIBUTIONPOINT_BOSS_MONSTER_LOSER;			
		}		
	}
	else if(g_pGameMain->GetSummonMotherShipCnt() == 0 && IS_STRATEGYPOINT_MONSTER(pMonsterInfo->Belligerence)) 
	{
		// 모선중이 아니다 && 거점 몬스터
		// 거점점수는 모선이 없어야만 거점 점수를 준다.
		if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{	
			// 거점 지키기 성공
			nInflPoint = CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER_WINNER  ;			
		}
		else
		{
			// 거점 지키기 실패
			nInflPoint = CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER_LOSER;			
		}
	// 2013-08-23 by ssjung 거점전 리뉴얼	
	#ifdef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG
			g_pGameMain->DestroyBaseWarInfo(pMsg->MapChannIdx.MapIndex, pMapinfo->MapInfluenceType);
	#endif
	// end 2013-08-23 by ssjung 거점전 리뉴얼	
	}	
	#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG			// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
		if(nInflPoint > 0)
		{
			wsprintf(buf, STRMSG_C_061121_0002, nInflPoint);	// "세력 포인트 %d점이 추가 되었습니다."				
			m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
		}
	#endif
	
#else
	if(IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
	{
		memset(buf, 0x00, 1024);		
		wsprintf(buf, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
		m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
	}
#endif
	// END 2013-06-17 by bhsohn 세력포인트 표시 변경

}
	
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketWarMonsterDead(MSG_FC_WAR_MONSTER_DEAD* pMsg)
/// \brief		
/// \author		ispark
/// \date		2006-11-21 ~ 2006-11-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketWarMonsterDead(MSG_FC_WAR_MONSTER_DEAD* pMsg)
{
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapChannIdx.MapIndex);
	MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsg->MonsterUnitKind);
	
	char		buf[1024] = {0,};
	char		bufInfluence[64] = {0,};
	BYTE		bMapInf = 0;

	if(IS_MAP_INFLUENCE_VCN(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0000);
		bMapInf = INFLUENCE_TYPE_VCN;
	}
	else if(IS_MAP_INFLUENCE_ANI(pMapinfo->MapInfluenceType))
	{
		wsprintf(bufInfluence, "%s", STRMSG_C_060210_0001);
		bMapInf = INFLUENCE_TYPE_ANI;
	}
	else
	{
		// 맵에 대한 세력 내용이 없다.
		DBGOUT("@@ Not Map Data InfluenceType (FieldSocketWarMonsterDead) @@\n");
		return;
	}

	wsprintf(buf, STRMSG_C_061121_0001, bufInfluence, pMapinfo->MapName);	// "\\c%s측\\c %s 지역에 전략 포인트가 폭파되었습니다."
	m_pChat->CreateChatChild(buf, COLOR_ITEM);

	// 2007-10-02 by dgwoo 
	if(IsWarMotherShip()																						// 모선전 진행중
		&& !COMPARE_INFLUENCE(bMapInf,g_pShuttleChild->GetMyShuttleInfo().InfluenceType)					// 맵과 같은 세력이 아니고
		&& (COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER) ||					// 지도자.
					COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_SUBLEADER_MASK)))			// 부지도자
	{//
		wsprintf(buf, STRMSG_C_071002_0102);	// "Alt + Click으로 텔레포트를 클릭하여 활성화를 시작하세요."
		m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
	}

	memset(buf, 0x00, 1024);

	// 2013-06-17 by bhsohn 세력포인트 표시 변경
	// 폭파된 전략 포인트 세력에 따른 메세지 출력
// 	if(FALSE == IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
// 	{
// 		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// #ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
// 		wsprintf(buf, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."
// #else
// 		wsprintf(buf, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
// #endif
// //				
// 		// END 2013-05-07 by bhsohn 세력포인트 개선안 시스템
// 		m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
// 	}
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
	INT nInflPoint = 0;
	if(IS_MOTHERSHIPWAR_MONSTER(pMonsterInfo->Belligerence))
	{
		if(FALSE == IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{		
			// 모선파괴 성공
			nInflPoint = CONTRIBUTIONPOINT_BOSS_MONSTER_WINNER; // "세력 포인트 %d점이 추가 되었습니다."		
			
		}
		else
		{
			// 모선파괴 실패
			nInflPoint = CONTRIBUTIONPOINT_BOSS_MONSTER_LOSER; // "세력 포인트 %d점이 추가 되었습니다."					
		}
	}
	else if(g_pGameMain->GetSummonMotherShipCnt() == 0 && IS_STRATEGYPOINT_MONSTER(pMonsterInfo->Belligerence)) 
	{
		// 모선중이 아니다 && 거점 몬스터
		// 거점점수는 모선이 없어야만 거점 점수를 준다.
		if(FALSE == IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
		{	
			// 거점 파괴  성공
			nInflPoint = CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER_WINNER  ;			
		}
		else
		{
			// 거점 파괴 실패
			nInflPoint = CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER_LOSER;			
		}							 
		
	// 2013-08-23 by ssjung 거점전 리뉴얼
	#ifdef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG
			g_pGameMain->DestroyBaseWarInfo(pMsg->MapChannIdx.MapIndex, pMapinfo->MapInfluenceType);
	#endif
	// end 2013-08-23 by ssjung 거점전 리뉴얼
		}
	#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG				// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
		if( nInflPoint > 0)
		{
			wsprintf(buf, STRMSG_C_061121_0002, nInflPoint);	// "세력 포인트 %d점이 추가 되었습니다."				
			m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
		}
	#endif
#else
	if(FALSE == IS_SAME_CHARACTER_MONSTER_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMonsterInfo->Belligerence))
	{
		wsprintf(buf, STRMSG_C_061121_0002, ADD_CONTRIBUTIONPOINT_STRATEGYPOINT_MONSTER);	// "세력 포인트 %d점이 추가 되었습니다."
		m_pChat->CreateChatChild(buf, COLOR_CHAT_GUILD);
	}
#endif
	// END 2013-06-17 by bhsohn 세력포인트 표시 변경

	// 2007-07-23 by bhsohn 오퍼레이터 추가작업
	g_pInterface->DetroySummonMonster(pMsg->MapChannIdx.MapIndex);

	// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	
	g_pInterface->RefreshWarSPWarInfo();	// 갱신
	// end 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경	
	
}

VOID CAtumApplication::SendMovePacket(BOOL bActive) 
{ 
	g_fSendMovePacket -= 0.2f; 
	MSG_FC_MOVE sMsg; 
	memset(&sMsg,0x00,sizeof(sMsg)); 
	sMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex; 
	if(bActive == TRUE) 
	{ 
		sMsg.TimeGap = m_dwSpeedHackTimer; 
	} 
	else 
	{ 
		sMsg.TimeGap = 200; 
		m_dwSpeedHackTimer = 0; 
	} 
	sMsg.PositionVector = m_pShuttleChild->m_vPos; 
	sMsg.TargetVector = m_pShuttleChild->m_vVel*1000.0f; 
	D3DXVECTOR3 vUp; 
	vUp.x = m_pShuttleChild->m_mMatrix._21; 
	vUp.y = m_pShuttleChild->m_mMatrix._22; 
	vUp.z = m_pShuttleChild->m_mMatrix._23; 
	sMsg.UpVector = vUp*1000.0f; 
	// 2008-02-17 by bhsohn 맵로딩이 완료 하여지만 게임 정보를 받을수 있는 상태이다.
	//m_pFieldWinSocket->SendMsg( T_FC_MOVE, (char*)&sMsg, sizeof(sMsg)); 
	if(TRUE == IsLockMode())
	{
		//맵로딩이 완료된 상태에서만 MOVE를 보낸다.
		m_pFieldWinSocket->SendMsg( T_FC_MOVE, (char*)&sMsg, sizeof(sMsg)); 
	}
	
	m_vClientOldPos = m_pShuttleChild->m_vPos; 
	// 2008-02-17 by bhsohn 맵로딩이 완료 하여지만 게임 정보를 받을수 있는 상태이다.
	//if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind))
	if(IS_DT(m_pShuttleChild->m_myShuttleInfo.UnitKind) && (TRUE == IsLockMode())) 
	{ 			 
		//맵로딩이 완료된 상태에서만 MOVE를 보낸다.
		m_pShuttleChild->SendMoveWeaponVel(); 
	}
//#ifdef _DEBUG 
//	m_nDebugTimerMove++; 
//#endif 
}

void CAtumApplication::InitSpeedHackTimer()
{
	m_nCheckSpeedHackCount = 0;
	m_dwCheckSpeedHackTime = 0;
	m_nSendMovePacketCount = 0;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FadeEffectRender()
/// \brief		Fade-In&Out 시스템
/// \author		jschoi
/// \date		2004-12-13 ~ 2004-12-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FadeEffectRender()
{
	if(	m_pInterface && m_pInterface->m_pFadeEffect)
	{
		m_pInterface->m_pFadeEffect->Render();
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::StartFadeEffect(BOOL bFadeIn,int nTime,D3DCOLOR dwColor)
/// \brief		Fade-In&Out 을 시작한다.
/// \author		jschoi
/// \date		2004-12-13 ~ 2004-12-13
/// \warning	
///
/// \param		bFadeIn : TRUE(Fade In)/FALSE(Fade Out)
///				nTime	: 지속시간
///				dwColor : 색깔
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartFadeEffect(BOOL bFadeIn,int nTime,D3DCOLOR dwColor)
{
	if(	m_pInterface && m_pInterface->m_pFadeEffect)
	{
		m_pInterface->m_pFadeEffect->SetFadeEffect(bFadeIn,nTime,dwColor);
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication:EndFadeEffect()
/// \brief		Fade-In&Out 을 종료한다.
/// \author		jschoi
/// \date		2004-12-13 ~ 2004-12-13
/// \warning	Fade-In은 자동으로 종료되므로 할 필요없다.(Fade-Out만 이 함수를 호출할 필요가 있다.)
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::EndFadeEffect()
{
	if(	m_pInterface &&	m_pInterface->m_pFadeEffect)
	{
		m_pInterface->m_pFadeEffect->ReleaseFadeEffect();
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FadeEffectTick()
/// \brief		
/// \author		jschoi
/// \date		2004-12-13 ~ 2004-12-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FadeEffectTick()
{
	if(	m_pInterface &&	m_pInterface->m_pFadeEffect)
	{
		m_pInterface->m_pFadeEffect->Tick(m_fElapsedTime);
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		jschoi
/// \date		2005-04-26 ~ 2005-04-26
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
float CAtumApplication::GetFadeAlpha()
{
	if(	m_pInterface &&	m_pInterface->m_pFadeEffect)
	{
		return m_pInterface->m_pFadeEffect->GetCurrentAlpha();
	}
	return 0.0f;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketMoveLockonOk(MSG_FC_MOVE_LOCKON_OK* pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-02-15 ~ 2005-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveLockonOk(MSG_FC_MOVE_LOCKON_OK* pMsg)
{
	if( pMsg->TargetIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex )
	{
		// 2006-01-07 by ispark, 삭제
//		char msg[MAX_PATH];
//		wsprintf(msg, STRMSG_C_INTERFACE_0051, pMsg->AttackCharacterName);//"경고:[%s]님이 당신을 타겟으로 잡았습니다."
//		m_pChat->CreateChatChild(msg,COLOR_VOIP);

		// 2005-11-03 by ispark
		// 타겟 잡은거 셋팅
		CMapEnemyIterator it = g_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(it != g_pScene->m_mapEnemyList.end())
		{
			if(pMsg->TargetIndex != it->second->m_nTargetIndex)
			{
				it->second->m_nTargetIndex = pMsg->TargetIndex;
				if(g_pShuttleChild->m_pOrderTarget == NULL)
				{
					// 2014-01-20 by ymjoo 격추된 기체를 타게팅 하는 현상 수정
//#ifdef C_TARGET_DEAD_SHUTTLE_YMJOO
					CEnemyData* pEnemyData = (CEnemyData*)it->second;
					if(!COMPARE_BODYCON_BIT(pEnemyData->m_infoCharacter.CharacterInfo.BodyCondition,BODYCON_DEAD_MASK))
					{
						// OrderTarget이 없다면 지정한다.
						g_pShuttleChild->m_pOrderTarget = (CEnemyData*)it->second;
						
						// 그리고 상대편한테 알린다. "나, 너 잡았어~~"
						MSG_FC_MOVE_LOCKON sMsg;
						sMsg.AttackIndex = g_pShuttleChild->m_myShuttleInfo.ClientIndex;
						sMsg.TargetIndex = ((CEnemyData*)g_pShuttleChild->m_pOrderTarget)->m_infoCharacter.CharacterInfo.ClientIndex;	
						g_pFieldWinSocket->SendMsg( T_FC_MOVE_LOCKON, (char*)&sMsg, sizeof(sMsg) );		
					}
// #else
// 					// OrderTarget이 없다면 지정한다.
// 					g_pShuttleChild->m_pOrderTarget = (CEnemyData*)it->second;
// 
// 					// 그리고 상대편한테 알린다. "나, 너 잡았어~~"
// 					MSG_FC_MOVE_LOCKON sMsg;
// 					sMsg.AttackIndex = g_pShuttleChild->m_myShuttleInfo.ClientIndex;
// 					sMsg.TargetIndex = ((CEnemyData*)g_pShuttleChild->m_pOrderTarget)->m_infoCharacter.CharacterInfo.ClientIndex;	
// 					g_pFieldWinSocket->SendMsg( T_FC_MOVE_LOCKON, (char*)&sMsg, sizeof(sMsg) );				
// #endif
					// END 2014-01-20 by ymjoo 격추된 기체를 타게팅 하는 현상 수정
				}

//				if(it->second->m_pPkNormalTimer->IsCityWar() == FALSE)
//				{
//					it->second->SetbPkAttack(TRUE);
//					it->second->m_pPkNormalTimer->SetPkDelay();			// 5초 시간 체크 // 2006-01-07 by ispark, 지움
//				}	
			}
		}
	}
	else // 내 경우
	{
//		CMapEnemyIterator it = g_pScene->m_mapEnemyList.find(pMsg->TargetIndex);
//		if(it != g_pScene->m_mapEnemyList.end())
//		{
//			if(it->second->m_nTargetIndex != pMsg->AttackIndex)
//			{
//				it->second->m_nTargetIndex = pMsg->AttackIndex;
//
//				if(it->second->m_pPkNormalTimer->IsCityWar() == FALSE)
//				{
//					it->second->SetbPkAttack(TRUE);
//					it->second->m_pPkNormalTimer->SetPkDelay();			// 5초 시간 체크 // 2006-01-07 by ispark, 지움
//				}	
//			}
//		}
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketMoveUnlockonOk(MSG_FC_MOVE_UNLOCKON_OK* pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-02-15 ~ 2005-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveUnlockonOk(MSG_FC_MOVE_UNLOCKON_OK* pMsg)
{
	if( pMsg->TargetIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex )
	{
		// 2006-01-07 by ispark, 삭제
//		char msg[MAX_PATH];
//		wsprintf(msg, STRMSG_C_INTERFACE_0052, pMsg->AttackCharacterName);//"[%s]님이 타겟을 해제했습니다."
//		m_pChat->CreateChatChild(msg,COLOR_VOIP);

		CMapEnemyIterator it = g_pScene->m_mapEnemyList.find(pMsg->AttackIndex);
		if(it != g_pScene->m_mapEnemyList.end())
		{
//			if(!it->second->m_pPkNormalTimer->IsPkEnableNormalOrderTarget())
//			{
//				// 5초 시간이 지나지 않아서 해제 할 경우 OrderTaget 해제
//				g_pShuttleChild->m_pOrderTarget = NULL;
//				it->second->m_pPkNormalTimer->ReleasePkDelay();
//			}
//			DBGOUT("%s(이)가 공격 해제\n", pMsg->AttackCharacterName);
			it->second->m_nTargetIndex = 0;
		}
	}
	else // 내 경우
	{
		CMapEnemyIterator it = g_pScene->m_mapEnemyList.find(pMsg->TargetIndex);
		if(it != g_pScene->m_mapEnemyList.end())
		{
//			if(!it->second->m_pPkNormalTimer->IsPkEnableNormalOrderTarget())
//			{
//				// 5초 시간이 지나지 않아서 해제 할 경우 Taget 해제
//				it->second->m_nTargetIndex = 0;
//				it->second->m_pPkNormalTimer->ReleasePkDelay();
//			}
			// 2006-01-09 by ispark, 타겟이 내가 아니라면 인덱스를 지움
//			DBGOUT("%s(을)를 공격 해제\n", (CEnemyData*)it->second->m_infoCharacter.CharacterInfo.CharacterName);
			if(it->second->m_nTargetIndex != g_pShuttleChild->m_myShuttleInfo.ClientIndex)
				it->second->m_nTargetIndex = 0;
		}
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketInfoGetCurrentMapInfoOk(MSG_FC_INFO_GET_CURRENT_MAP_INFO_OK* pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-02-16 ~ 2005-02-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoGetCurrentMapInfoOk(MSG_FC_INFO_GET_CURRENT_MAP_INFO_OK* pMsg)
{
	if(g_pShuttleChild && g_pShuttleChild->m_pPkNormalTimer)
	{
		if(pMsg->IsCityWarStarted == 0)
		{
			g_pShuttleChild->m_pPkNormalTimer->ReleaseCityWar();
		}
		else
		{
			g_pShuttleChild->m_pPkNormalTimer->SetCityWar();
		}		

		g_pShuttleChild->m_byCityWarTeamType = pMsg->byCityWarTeamType;
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCharacterCashPremiumCardInfo(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO* pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-02-18 ~ 2005-02-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterCashPremiumCardInfo(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO* pMsg)
{
	// 2005-03-18 by jschoi
	g_pD3dApp->m_bRequestEnable = TRUE;

	if(g_pShuttleChild)
	{
		SetPremiumCardInfo(pMsg);
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::FieldSocketStoreUpdateItemStorage(MSG_FC_STORE_UPDATE_ITEMSTORAGE* pMsg)
/// \brief		
/// \author		ispark
/// \date		2005-12-07 ~ 2005-12-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketStoreUpdateItemStorage(MSG_FC_STORE_UPDATE_ITEMSTORAGE* pMsg)
{
//	ASSERT_IMPLIES(pMsg->FromPossess != pMsg->ToPossess, pMsg->FromPossess != 0 || pMsg->ToPossess != 0);
//	ASSERT_IMPLIES(m_pInterface, m_pInterface->m_pCityBase);
	
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	ASSERT_ASSERT(pStore);
	if(pStore)
	{
		if(ITEM_IN_STORE == pMsg->FromItemStorage)	// 창고 -> 아이템창
		{
			CItemInfo* pItemInfo = pStore->FindItemInfo( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);
			pNewItemInfo->ItemWindowIndex = POS_INVALID_POSITION;

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->DeleteItem( pMsg->ItemUniqueNumber ); // InputItemDone();
			g_pStoreData->AddItemDataToUniqueNumberAndWindowPosition( pNewItemInfo );
			g_pGameMain->m_pInven->SetAllIconInfo();
		}
		else if(ITEM_IN_STORE == pMsg->ToItemStorage) // 아이템창 -> 창고
		{
			CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->AddItem( pNewItemInfo );
			pStore->InputItemDone();
			g_pStoreData->DeleteItem( pMsg->ItemUniqueNumber );
		}
		else if(ITEM_IN_GUILD_STORE == pMsg->FromItemStorage)
		{// 여단창고 -> 인벤토리로.
			CItemInfo* pItemInfo = pStore->FindItemInfo( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);
			pNewItemInfo->ItemWindowIndex = POS_INVALID_POSITION;

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->DeleteItem( pMsg->ItemUniqueNumber ); // InputItemDone();
			g_pStoreData->AddItemDataToUniqueNumberAndWindowPosition( pNewItemInfo );
			g_pGameMain->m_pInven->SetAllIconInfo();

		}
		else if(ITEM_IN_GUILD_STORE == pMsg->ToItemStorage)
		{// 인벤토리 -> 여단창고로
			CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber );
			ASSERT_ASSERT( IS_COUNTABLE_ITEM(pItemInfo->Kind) == FALSE );
			CItemInfo* pNewItemInfo = new CItemInfo((ITEM_GENERAL*)pItemInfo);

			// 2010. 02. 11 by ckPark 발동류 장착아이템
			//pNewItemInfo->SetEnchantParam( pItemInfo->GetEnchantParamFactor(), pItemInfo->GetEnchantNumber() );
			// 발동류 인챈트 정보, 쿨타임 정보 추가 복사
			pNewItemInfo->CopyItemInfo( pItemInfo );
			// end 2010. 02. 11 by ckPark 발동류 장착아이템

			pStore->AddItem( pNewItemInfo );
			pStore->InputItemDone();
			g_pStoreData->DeleteItem( pMsg->ItemUniqueNumber );
		}
		// 2006-10-25 by dgwoo
		g_pD3dApp->m_bRequestEnable = TRUE;
		g_pD3dApp->m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;

		// 2007-02-12 by bhsohn Item 다중 선택 처리
		FromStoreMultiResponseOK();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	CAtumApplication::FieldSocketCharacterObserverStartOK(MSG_FC_CHARACTER_OBSERVER_START* pMsg)
/// \brief		옵저버 모두 준비가 완료되어 붙어도 된다는 패킷.
/// \author		dgwoo
/// \date		2007-03-29 ~ 2007-03-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterObserverStartOK(MSG_FC_CHARACTER_OBSERVER_START* pMsg)
{
	g_pShuttleChild->m_bMouseLock = FALSE;
	g_pShuttleChild->m_bObserve = FALSE;
	g_pShuttleChild->m_nAlphaValue = 255;

	if(COMPARE_RACE(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION) 
		|| COMPARE_RACE(g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.Race,RACE_GAMEMASTER))
	{
		CMapEnemyIterator itEnemy = g_pD3dApp->m_pScene->m_mapEnemyList.begin();
		while(itEnemy != g_pD3dApp->m_pScene->m_mapEnemyList.end())
		{
			if(itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex == pMsg->TargetClientIndex)
			{

				g_pShuttleChild->m_stObserve.ClientIndex = itEnemy->second->m_infoCharacter.CharacterInfo.ClientIndex;
				g_pShuttleChild->m_stObserve.pEnemyData = itEnemy->second;
				g_pShuttleChild->m_bObserve = TRUE;
				g_pShuttleChild->m_bMouseLock = TRUE;
				g_pShuttleChild->m_nAlphaValue = 0;
				g_pD3dApp->m_bFixUnitDirMode = FALSE;
				g_pGameMain->m_pUnitInfoBar->UpdateAllGage();
				return;
			}
			itEnemy++;
		}
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterObserverEndOK(MSG_FC_CHARACTER_OBSERVER_END* pMsg)
/// \brief		옵저버 모드 종료.
/// \author		dgwoo
/// \date		2007-03-29 ~ 2007-03-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterObserverEndOK(MSG_FC_CHARACTER_OBSERVER_END* pMsg)
{

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterObserverRegOK(MSG_FC_CHARACTER_OBSERVER_REG* pMsg);
/// \brief		옵저버 단축키 등록 완료.
/// \author		dgwoo
/// \date		2007-03-29 ~ 2007-03-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterObserverRegOK(MSG_FC_CHARACTER_OBSERVER_REG* pMsg)
{	
	DbgOut("FieldSocketCharacterObserverRegOK\n");
	g_pShuttleChild->m_ObserveQuick[pMsg->nRegNum] = pMsg->ClientIndex;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterObserverInfoOK(MSG_FC_CHARACTER_OBSERVER_INFO* pMsg);
/// \brief		옵저버할 유저의 정보를 받는다.
/// \author		dgwoo
/// \date		2007-03-29 ~ 2007-03-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterObserverInfoOK(MSG_FC_CHARACTER_OBSERVER_INFO* pMsg)
{
	//memcpy(&g_pShuttleChild->m_stObserve.ClientInfo,pMsg,sizeof(MSG_FC_CHARACTER_OBSERVER_INFO));
	g_pShuttleChild->ObserveUpdateGage(pMsg);
	g_pGameMain->m_pUnitInfoBar->UpdateAllGage();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketArenaWatchReady()
/// \brief		/관전시작 이라는 명령어를 입력했을경우.
/// \author		dgwoo
/// \date		2007-06-18 ~ 2007-06-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaWatchReady(MSG_FC_ARENA_WATCH_READY* pMsg)
{
	if(pMsg->ArenaState >= ARENA_STATE_FIGHTING_WARING)
	{
		m_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_SCORE);
		g_pScene->ChangeObjectBodyCondition(ARENA_MAP_01_DOOR_OBJECT,BODYCON_DOOR_OPENING_MASK);
// 2012-05-29 by mspark, 아레나 2번 맵(라그나로크) 문
#ifdef SC_ARENA_EX_1ST_JHSEOL_MSPARK
		g_pScene->ChangeObjectBodyCondition(ARENA_MAP_02_DOOR_OBJECT,BODYCON_DOOR_OPENING_MASK);
#endif
// end 2012-05-29 by mspark, 아레나 2번 맵(라그나로크) 문
	}else
	{
		m_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_TIMER);
	}
	g_pShuttleChild->SetOperation(TRUE);
	g_pShuttleChild->m_nAlphaValue = SKILL_OBJECT_ALPHA_OTHER_INFLUENCE;
	g_pD3dApp->m_pChat->CreateChatChild( STRMSG_C_070618_0100, COLOR_ERROR);	//"관전이 시작되었습니다."
	// 2007-04-04 by dgwoo 시작시 셔틀의 정보를 저장해둔다.
	g_pShuttleChild->m_stObserve.ClientInfo.DP = g_pShuttleChild->m_myShuttleInfo.DP;
	g_pShuttleChild->m_stObserve.ClientInfo.HP = g_pShuttleChild->m_myShuttleInfo.HP;
	g_pShuttleChild->m_stObserve.ClientInfo.EP = g_pShuttleChild->m_myShuttleInfo.EP;
	g_pShuttleChild->m_stObserve.ClientInfo.SP = g_pShuttleChild->m_myShuttleInfo.SP;
	g_pShuttleChild->m_stObserve.ClientInfo.CurrentDP = g_pShuttleChild->m_myShuttleInfo.CurrentDP;
	g_pShuttleChild->m_stObserve.ClientInfo.CurrentHP = g_pShuttleChild->m_myShuttleInfo.CurrentHP;
	g_pShuttleChild->m_stObserve.ClientInfo.CurrentEP = g_pShuttleChild->m_myShuttleInfo.CurrentEP;
	g_pShuttleChild->m_stObserve.ClientInfo.CurrentSP = g_pShuttleChild->m_myShuttleInfo.CurrentSP;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketArenaWatchStart(MSG_FC_ARENA_WATCH_START* pMsg)
/// \brief		관전할수있는 유저 정보를 구조체로 보내준다.
/// \author		dgwoo
/// \date		2007-06-18 ~ 2007-06-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaWatchStart(MSG_FC_ARENA_WATCH_START* pMsg)
{
	m_pInterface->m_pGameArena->AddEnemyOperation(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketArenaWatchEnd()
/// \brief		관전 모드 해제.
/// \author		dgwoo
/// \date		2007-06-18 ~ 2007-06-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaWatchEnd()
{
	g_pShuttleChild->SetOperation(FALSE);
	g_pShuttleChild->m_bObserve = FALSE;
	g_pShuttleChild->m_nAlphaValue = SKILL_OBJECT_ALPHA_NONE;
	g_pShuttleChild->ObserveCancelUpdateInfo();
	g_pD3dApp->m_pChat->CreateChatChild( STRMSG_C_070618_0101, COLOR_ERROR);	//"관전이 종료되었습니다."

	g_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_NORMAL,TRUE);
	g_pInterface->m_pGameArena->ClearEnemyOperation();							// 유저정보를 삭제한다.
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketArenaWatchRemoveUser(MSG_FC_ARENA_WATCH_REMOVE_USER* pMsg)
/// \brief		아레나에서 나간유저는 정보를 삭제한다.
/// \author		dgwoo
/// \date		2007-06-19 ~ 2007-06-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaWatchRemoveUser(MSG_FC_ARENA_WATCH_REMOVE_USER* pMsg)
{
	m_pInterface->m_pGameArena->DeleteOperationUser(pMsg->ClientIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterWatchInfo(MSG_FC_CHARACTER_WATCH_INFO* pMsg)
/// \brief		관전 모드시 유저(ALL)의 정보(피,쉴드)를 보내준다
/// \author		dgwoo
/// \date		2007-06-19 ~ 2007-06-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterWatchInfo(MSG_FC_CHARACTER_WATCH_INFO* pMsg)
{
	m_pInterface->m_pGameArena->ChangeWatchInfo(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaRequestTeamOK(MSG_FC_ARENA_REQUEST_TEAM_OK* pMsg);
/// \brief		아레나 방 목록
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRequestTeamOK(MSG_FC_ARENA_REQUEST_TEAM_OK* pMsg)
{
	CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
	if(pCityArena != NULL)
	{
		pCityArena->ArenaTeamListInput(pMsg);
	}
	m_bRequestEnable = TRUE;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaCreateTeamOK(MSG_FC_ARENA_CREATE_TEAM_OK* pMsg);
/// \brief		아레나 방 생성.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaCreateTeamOK(MSG_FC_ARENA_CREATE_TEAM_OK* pMsg)
{
	CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
	if(pCityArena != NULL)
	{
		pCityArena->ReFresh();
	}
	m_pInterface->m_pGameArena->CreateTeamOK(pMsg);
	// 2008-11-24 by dgwoo 아레나 채팅 탭 활성화 안되는 문제
	g_pGameMain->m_pChat->SetChatArenaAct(TRUE);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaEnterTeamOK(MSG_FC_ARENA_ENTER_TEAM_OK* pMsg);
/// \brief		아레나 방에 입장.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaEnterTeamOK(MSG_FC_ARENA_ENTER_TEAM_OK* pMsg)
{
	m_pInterface->m_pGameArena->EnterTeamOK(pMsg);
	// 2008-11-24 by dgwoo 아레나 채팅 탭 활성화 안되는 문제
	g_pGameMain->m_pChat->SetChatArenaAct(TRUE);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaTeamMemberList(MSG_FC_ARENA_TEAM_MEMBER_LIST* pMsg);
/// \brief		방에 있는 유저 리스트.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaTeamMemberList(MSG_FC_ARENA_TEAM_MEMBER_LIST* pMsg)
{
	g_pInterface->m_pGameArena->AddTeamUserInfo(pMsg);
	// 2007-11-22 by bhsohn 아레나 통합서버
	if(TRUE == g_pInterface->IsArenaReady())
	{		
		// 팀요청 상태
		SetArenaState(ARENA_STATE_ARENA_WAIT);
	}
	// end 2007-11-22 by bhsohn 아레나 통합서버
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaReaveTeamOK();
/// \brief		입장 취소 완료.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaReaveTeamOK()
{
	g_pInterface->m_pGameArena->ReaveArena();
	// 2008-11-24 by dgwoo 아레나 채팅 탭 활성화 안되는 문제
	g_pGameMain->m_pChat->SetChatArenaAct(FALSE);

	BOOL bArenaTeamNotLoad = (ARENA_STATE_ARENA_GAMING != g_pD3dApp->GetArenaState()) 								
								&& !IS_CITY_MAP_INDEX(g_pD3dApp->GetMyShuttleMapChannelIndex().MapIndex);
	if(bArenaTeamNotLoad)	
	{			
		// 마을이 아니면서 팀을 떠날떄는 아레나 소켓을 끊는다.
		g_pD3dApp->CloseArenaSocket();		
		return;
	}

	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{
		return;
	}
	if(BUILDINGKIND_ARENA != pBuilding->buildingInfo.BuildingKind)
	{
		return;
	}

	// 입장 취소 프로토콜이 오면 방목록을 갱신한다.
	CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
	if(pCityArena != NULL)
	{
		pCityArena->ReFresh();
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaTeamReady(MSG_FC_ARENA_TEAM_READY* pMsg);
/// \brief		팀 매칭 대기
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaTeamReady(MSG_FC_ARENA_TEAM_READY* pMsg)
{
	g_pInterface->m_pGameArena->TeamReady();
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaEnterRoom(MSG_FC_ARENA_ENTER_ROOM* pMsg);
/// \brief		아레나 맵으로 입장.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaEnterRoom(MSG_FC_ARENA_ENTER_ROOM* pMsg)
{	
	g_pInterface->m_pGameArena->m_pINFArenaScore->SetArenaScoreEx(pMsg->VCNDeathCount,pMsg->ANIDeathCount);	
	g_pInterface->m_pGameArena->EnterRoom(pMsg->StartRoomTime,pMsg->PlayLimitedTime);	
	// 2009. 09. 10 by jsKim 아레나 진입시 시작 카운터 버그 수정
	g_ArenaServerDateTime = pMsg->ArenaServerTime;
	g_ArenaStartTime = timeGetTime();
	// end 2009. 09. 10 by jsKim 아레나 진입시 시작 카운터 버그 수정

	// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
	//g_pGameMain->m_pInfWindow->AddTimeMsgBox(STRMSG_C_070504_0100, _Q_ARENA_WARP,30,STRMSG_C_060724_0000);	
	// 연결되어있으면 메시지 창을 띠운다.
	DoModalAreanQuestion();	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaRoomWarStart();
/// \brief		전투 시작.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarStart()
{
	// 2013-09-06 by bhsohn 아레나에서 게임종료시, exception오류 처리
	if(!g_pInterface)
	{
		return;
	}
	else if(!g_pInterface->m_pGameArena)
	{
		return;
	}
	// END 2013-09-06 by bhsohn 아레나에서 게임종료시, exception오류 처리
	// 2007-11-22 by bhsohn 아레나 통합서버
	// 늦게 들어온 유저들을 위해 변수를 초기화한다.
	g_pInterface->m_pGameArena->SetAlreadyArenaStart(TRUE);

	g_pInterface->m_pGameArena->StartCountWar();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaRoomWarInfo(MSG_FC_ARENA_ROOM_WAR_INFO* pMsg);
/// \brief		포인트 변환 처리.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarInfo(MSG_FC_ARENA_ROOM_WAR_INFO* pMsg)
{
	g_pInterface->m_pGameArena->SetArenaScore(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketArenaRoomWarFinishHeader(MSG_FC_ARENA_ROOM_WAR_FINISH_HEADER* pMsg);
/// \brief		아레나 결과 정보를 주기 시작.
/// \author		dgwoo
/// \date		2007-05-08 ~ 2007-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarFinishHeader(MSG_FC_ARENA_ROOM_WAR_FINISH_HEADER* pMsg)
{
	m_pInterface->m_pGameArena->FinishHeader(pMsg);
	m_bRequestEnable = FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaRoomWarFinish(MSG_FC_ARENA_ROOM_WAR_FINISH_DEATHMATCH* pMsg);
/// \brief		아레나 결과 정보를 주는 프로토콜 
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarFinish(MSG_FC_ARENA_ROOM_WAR_FINISH* pMsg)
{
	g_pInterface->m_pGameArena->AddResult(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketArenaRoomWarFinishDone(MSG_FC_ARENA_ROOM_WAR_FINISH_DONE* pMsg);
/// \brief		아레나 결과 정보를 다 보내줌
/// \author		dgwoo
/// \date		2007-05-08 ~ 2007-05-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarFinishDone(MSG_FC_ARENA_ROOM_WAR_FINISH_DONE* pMsg)
{	
	g_pInterface->m_pGameArena->EndWar(pMsg);
	// 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경
	// 세력포인트 설정
	m_pArenaManager->SetInflPoint(pMsg->InflPoint);

	m_bRequestEnable = TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		dgwoo
/// \date		2007-05-10 ~ 2007-05-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRoomWarFinishDraw(MSG_FC_ARENA_ROOM_WAR_FINISH_DRAW* pMsg)
{
	g_pInterface->m_pGameArena->EndWarDraw(pMsg);

	// 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경
	// 세력포인트 설정
	m_pArenaManager->SetInflPoint(pMsg->InflPoint);
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaFinishWarpOK(MSG_FC_ARENA_FINISH_WARP_OK* pMsg);
/// \brief		아레나 종료로 마을로 워프.
/// \author		dgwoo
/// \date		2007-04-19 ~ 2007-04-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaFinishWarpOK(MSG_FC_ARENA_FINISH_WARP_OK* pMsg)
{
	EventWarpOtherMap(pMsg->MapChannelIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID FieldSocketArenaBeforRoomWarFinish()
/// \brief		아레나 종료 1분전에 오는 메시지.
/// \author		dgwoo
/// \date		2007-05-15 ~ 2007-05-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaBeforRoomWarFinish()
{
	m_pChat->CreateChatChild(STRMSG_C_070515_0100,COLOR_VOIP);
	g_pInterface->m_pGameArena->m_pINFArenaScore->SetArenaTime(60);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketArenaRequestCreateTeamInfoOK(MSG_FC_ARENA_REQUEST_CREATE_TEAMINFO_OK* pMsg)
/// \brief		아레나 모드에 따라 인원이 달라질수있다 그 정보를 줌.
/// \author		dgwoo
/// \date		2007-04-26 ~ 2007-04-26
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRequestCreateTeamInfoOK(MSG_FC_ARENA_REQUEST_CREATE_TEAMINFO_OK* pMsg)
{
	CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
	if(pCityArena != NULL)
	{
			pCityArena->AllModePersonInfo(pMsg);
	}
	m_bRequestEnable = TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketArenaTeamMatching();
/// \brief		아레나 매칭 작업.
/// \author		dgwoo
/// \date		2007-05-03 ~ 2007-05-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaTeamMatching()
{
	g_pInterface->m_pGameArena->TeamMatching();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID FieldSocketCharacterPayWarPoint(MSG_FC_CHARACTER_PAY_WARPOINT* pMsg)
/// \brief		워포인트가 증가하였을경우.
/// \author		dgwoo
/// \date		2007-05-16 ~ 2007-05-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterPayWarPoint(MSG_FC_CHARACTER_PAY_WARPOINT* pMsg)
{
	g_pShuttleChild->m_myShuttleInfo.WarPoint = pMsg->TotalWarPoint;
	g_pShuttleChild->m_myShuttleInfo.CumulativeWarPoint = pMsg->CumulativeWarPoint;
	char buf[256];
	if (pMsg->WarPoint > 0)
		wsprintf(buf,STRMSG_C_070514_0101,pMsg->WarPoint);
	else
		wsprintf(buf,STRMSG_C_131206_0002,-(pMsg->WarPoint));	

	m_pChat->CreateChatChild(buf,COLOR_ITEM,CHAT_TAB_SYSTEM);
}
VOID CAtumApplication::FieldSocketCharacterUpdateSubleaderOk(MSG_FC_CHARACTER_UPDATE_SUBLEADER_OK * pMsg)
{
	char buf[256] = {0,};
	if(IS_ANI_INFLUENCE_TYPE(g_pShuttleChild->m_myShuttleInfo.InfluenceType))
	{
		if(pMsg->SubLeaderRank == 1)
		{
			if(IsMyShuttleLeader())
			{
				wsprintf(buf,STRMSG_C_071006_0107,pMsg->CharacterName,STRCMD_ANI_INFLUENCE_SUBLEADER_1);
			}
			else
			{
				wsprintf(buf,STRMSG_C_071006_0106,STRCMD_ANI_INFLUENCE_SUBLEADER_1);
			}
			
		}
		else if(pMsg->SubLeaderRank == 2)
		{
			if(IsMyShuttleLeader())
			{
				wsprintf(buf,STRMSG_C_071006_0107,pMsg->CharacterName,STRCMD_ANI_INFLUENCE_SUBLEADER_2);
			}
			else
			{
				wsprintf(buf,STRMSG_C_071006_0106,STRCMD_ANI_INFLUENCE_SUBLEADER_2);
			}
		}
	}
	else
	{
		if(pMsg->SubLeaderRank == 1)
		{
			if(IsMyShuttleLeader())
			{
				wsprintf(buf,STRMSG_C_071006_0107,pMsg->CharacterName,STRCMD_VCN_INFLUENCE_SUBLEADER_1);
			}
			else
			{			
				wsprintf(buf,STRMSG_C_071006_0106,STRCMD_VCN_INFLUENCE_SUBLEADER_1);
			}
		}
		else if(pMsg->SubLeaderRank == 2)
		{
			if(IsMyShuttleLeader())
			{
				wsprintf(buf,STRMSG_C_071006_0107,pMsg->CharacterName,STRCMD_VCN_INFLUENCE_SUBLEADER_2);
			}
			else
			{
				wsprintf(buf,STRMSG_C_071006_0106,STRCMD_VCN_INFLUENCE_SUBLEADER_2);
			}
		}
	}
	m_pChat->CreateChatChild(buf,COLOR_ITEM);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID FieldSocketArenaRequestOtherTeamInfoOK(MSG_FC_ARENA_REQUEST_OTHER_TEAM_INFO_OK* pMsg)
/// \brief		상대팀 정보 리스트
/// \author		dgwoo
/// \date		2007-05-25 ~ 2007-05-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaRequestOtherTeamInfoOK(MSG_FC_ARENA_REQUEST_OTHER_TEAM_INFO_OK* pMsg)
{
	SARENA_REQUEST_OTHER_TEAM_INFO_OK *pTeamInfo = (SARENA_REQUEST_OTHER_TEAM_INFO_OK *)((char *)pMsg + sizeof(MSG_FC_ARENA_REQUEST_OTHER_TEAM_INFO_OK));
	int i = 0;
	char buf[256];
	char sArenaMode[256];
	for(i = 0 ; i < pMsg->ArenaOtherTeamListCount ; i++)
	{
		if(pMsg->ArenaMode == ARENAMODE_DEATHMATCH)
			wsprintf(sArenaMode,"%s",STRMSG_C_070427_0100);
		else
			wsprintf(sArenaMode,"%s",STRMSG_C_070427_0101);

		wsprintf(buf,STRMSG_C_070525_0100,sArenaMode,pTeamInfo->MemberCount,pTeamInfo->TeamCount);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		pTeamInfo++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketTutorialStartOK(MSG_FC_TUTORIAL_START_OK * pMsg)
/// \brief		시작과 동시에 완료한 튜토리얼 목록을 받아온다.
/// \author		dgwoo
/// \date		2007-07-16 ~ 2007-07-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTutorialStartOK(MSG_FC_TUTORIAL_START_OK * pMsg)
{
	STUTORIAL_LIST_INFO *pTutorialInfo = (STUTORIAL_LIST_INFO *)((char *)pMsg + sizeof(MSG_FC_TUTORIAL_START_OK));
	int i = 0;
	for(i = 0 ; i < pMsg->TutorialInfoListCount ; i++)
	{
		g_pTutorial->SetCompleteLesson(pTutorialInfo->TutorialNum,pTutorialInfo->TutorialComplete);
		pTutorialInfo++;
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketTutorialCompleteOK()
/// \brief		
/// \author		dgwoo
/// \date		2007-07-16 ~ 2007-07-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTutorialCompleteOK(MSG_FC_TUTORIAL_COMPLETE_OK * pMsg)
{
	g_pTutorial->SetCompleteLesson(pMsg->TutorialNum);
}


/**********************************************************************************************
**
**	스피커 아이템 (전체 공지) 처리.
**
**	Create Info :	2007. 08. 07. by bhsohn.		// 2007-08-07 by bhsohn 스피커 아이템 추가
**
**
***********************************************************************************************/
VOID CAtumApplication::FieldSocketChatAllInfluenceOK(MSG_FC_CHAT_ALL_INFLUENCE * pMsg)
{	
	if(g_pGameMain)
	{
		// 2007-11-07 by bhsohn 스피커 아이템 욕설 필터
		char szChatMsg[SIZE_MAX_STRING_256];
		memset(szChatMsg, 0x00, SIZE_MAX_STRING_256);
		strncpy(szChatMsg, pMsg->str256ChatMsg, SIZE_MAX_STRING_256);
		int temp,temp2;
		CheckReadyStringFiltering(szChatMsg,&temp,&temp2);
		// end 2007-11-07 by bhsohn 스피커 아이템 욕설 필터

		char chTxt[SIZE_MAX_CHARACTER_NAME+SIZE_MAX_STRING_256+8];
		// 2007-11-07 by bhsohn 스피커 아이템 욕설 필터
		//wsprintf(chTxt, STRMSG_C_070810_0202, pMsg->FromCharacterName, pMsg->str256ChatMsg);
		wsprintf ( chTxt , STRMSG_C_070810_0202 , pMsg->FromCharacterName , szChatMsg );
		g_pGameMain->AddSpeakerMsgString ( chTxt , FALSE , FALSE );
	}
}
VOID CAtumApplication::FieldSocketChatOutPostGuild(MSG_FC_CHAT_OUTPOST_GUILD* pMsg)
{
	char str[512];
	char strChat[SIZE_MAX_CHAT_MESSAGE];
	BYTE size = pMsg->MessageLength;
	char * p = (char *)pMsg;
	p += sizeof(MSG_FC_CHAT_OUTPOST_GUILD);
	memcpy(strChat,p,size);
	int temp,temp2;
	CheckReadyStringFiltering(strChat,&temp,&temp2);
	wsprintf(str,"[%s] %s",pMsg->FromCharacterName,strChat);//현재 맵 채팅
	m_pChat->CreateChatChild(str,COLOR_INFLUENCE, CHAT_TAB_INFLUENCE_LEADER);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostWarBefore(MSG_FC_OUTPOST_WAR_BEFORE* pMsg)
/// \brief		전진기지 발발전(몇분전)
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostWarBefore(MSG_FC_OUTPOST_WAR_BEFORE* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	// 2007-10-01 by bhsohn 전진 기지 스트링 변경  
	//wsprintf(buf,STRMSG_C_070816_0103,pMsg->RemainTime,pMapInfo->MapName);
	wsprintf(buf,STRMSG_C_070816_0103,pMapInfo->MapName, pMsg->RemainTime);
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_BEFORE,pMsg->MapIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostWarStart(MSG_FC_OUTPOST_WAR_START* pMsg)
/// \brief		전진 기지 발발.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostWarStart(MSG_FC_OUTPOST_WAR_START* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	// 2008-10-14 by dgwoo 전진기지 시간선택하는 부분 없어짐
	//wsprintf(buf,STRMSG_C_070816_0109,pMapInfo->MapName);
	wsprintf(buf,STRMSG_C_070816_0118,pMapInfo->MapName);
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
//	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_WAR_START);
//	g_pGameMain->m_pOutPost->AddOutPostMapIndex(pMsg->MapIndex);
//	g_pGameMain->m_pOutPost->SetWarTime(pMsg->WarStartTime,pMsg->WarEndTime);
	g_pGameMain->m_pOutPost->AddOutPost(pMsg->MapIndex,OUTPOST_STATE_WAR_START,pMsg->Influence,pMsg->WarStartTime,pMsg->WarEndTime);
	// 2008-10-14 by dgwoo 전진기지 시간선택하는 부분 없어짐
	//wsprintf(buf,STRMSG_C_070816_0118,pMapInfo->MapName);
	g_pInterface->ShowOpWndTxt(STRMSG_C_081014_0100);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostProtectorDestroy(MSG_FC_OUTPOST_PROTECTOR_DESTROY* pMsg)
/// \brief		전진기지 보호막 파괴.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostProtectorDestroy(MSG_FC_OUTPOST_PROTECTOR_DESTROY* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	// 2008-10-16 by dgwoo 스트링 변경
	//wsprintf(buf,STRMSG_C_070816_0105);
	wsprintf(buf,"\\c[%s]\\c%s",pMapInfo->MapName,STRMSG_C_070816_0105);
	m_pChat->CreateChatChild(buf,COLOR_ITEM);

	// 2007-10-05 by dgwoo 지도자나 세력이 없는 유저가 폭파시켰을 경우.
	if(pMsg->GuildUID == 0)
	{
		g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_WAR_START,pMsg->MapIndex);
		// 2008-10-16 by dgwoo 스트링 변경
		wsprintf(buf,"\\c[%s]\\c%s",pMapInfo->MapName,STRMSG_C_071005_0100);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		return;
	}
	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_PROTECT_DESTROY,pMsg->MapIndex);
	if(COMPARE_INFLUENCE(INFLUENCE_TYPE_VCN, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_070816_0106,STRMSG_C_060210_0000,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
	}
	else if(COMPARE_INFLUENCE(INFLUENCE_TYPE_ANI, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_070816_0106,STRMSG_C_060210_0001,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
	}
	if(COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_071002_0103);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
	}
	
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostResetStartOk(MSG_FC_OUTPOST_RESET_START_OK* pMsg)
/// \brief		각인 시작.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostResetStartOk(MSG_FC_OUTPOST_RESET_START_OK* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
//	m_pChat->CreateChatChild(buf,COLOR_ITEM);
	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_RESET_START,pMsg->MapIndex);
	if(COMPARE_INFLUENCE(INFLUENCE_TYPE_VCN, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_070816_0107,STRMSG_C_060210_0000,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
	}
	else if(COMPARE_INFLUENCE(INFLUENCE_TYPE_ANI, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_070816_0107,STRMSG_C_060210_0001,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
	}

	// 2007-10-02 by dgwoo 추가사항.
	if(!COMPARE_INFLUENCE(INFLUENCE_TYPE_NORMAL,g_pShuttleChild->m_myShuttleInfo.InfluenceType))
	{// 알링턴, 바이제니유.
		//g_pGameMain->m_pOutPost->m_bAttackerInf = pMsg->Influence;
		g_pGameMain->m_pOutPost->SetAttInfluence(pMsg->MapIndex,pMsg->Influence);
		if(COMPARE_INFLUENCE(pMsg->Influence,g_pShuttleChild->m_myShuttleInfo.InfluenceType))
		{// 공격자.
			if(pMsg->GuildUID == g_pShuttleChild->GetMyShuttleInfo().GuildUniqueNumber					// 파괴 길드면서.
				&& (COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER) ||		// 지도자.
					COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_SUBLEADER_MASK)))		// 부지도자.
			{
				wsprintf(buf,STRMSG_C_071002_0100);				//"시스템 교체중인 적의 중앙처리장치를 파괴하세요."
				m_pChat->CreateChatChild(buf,COLOR_ITEM);
			}
		}
		else
		{// 방어자.
			wsprintf(buf,STRMSG_C_071002_0101);				//"교체가 완료 될 때까지 중앙처리장치를 파괴하려는 적들을 섬멸 하시오."
			m_pChat->CreateChatChild(buf,COLOR_ITEM);
		}
	}
	wsprintf(buf,STRMSG_C_070816_0111,OUTPOST_RESET);
	m_pChat->CreateChatChild(buf,COLOR_VOIP);

	g_pGameMain->m_pOutPost->SetResetTime(pMsg->MapIndex,pMsg->ResetStartTime,pMsg->ResetEndTime);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostResetDestroy(MSG_FC_OUTPOST_RESET_DESTROY* pMsg)
/// \brief		각인중인데 파괴되었을때.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostResetDestroy(MSG_FC_OUTPOST_RESET_DESTROY* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	wsprintf(buf,STRMSG_C_070816_0114);
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_RESET_DESTROY,pMsg->MapIndex);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostResetSuccess(MSG_FC_OUTPOST_RESET_SUCCESS* pMsg)
/// \brief		각인 성공.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostResetSuccess(MSG_FC_OUTPOST_RESET_SUCCESS* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
// 2007-09-06 by dgwoo 각인 성공시 소유 세력을 제외한 모든 유저를 마을로 워프시킨다.
//	if(g_pShuttleChild->GetMyShuttleInfo().GuildUniqueNumber != pMsg->Influence
//		pMsg->GuildUID)
	wsprintf(buf,STRMSG_C_070816_0115);
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);

	if(COMPARE_INFLUENCE(INFLUENCE_TYPE_VCN, pMsg->Influence))	
	{
		wsprintf(buf,STRMSG_C_070816_0112,STRMSG_C_060210_0000,pMsg->GuildName,pMapInfo->MapName);

	}
	else if(COMPARE_INFLUENCE(INFLUENCE_TYPE_ANI, pMsg->Influence))	
	{
		wsprintf(buf,STRMSG_C_070816_0112,STRMSG_C_060210_0001,pMsg->GuildName,pMapInfo->MapName);
	}
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);

	wsprintf(buf,STRMSG_C_070816_0113);
	m_pChat->CreateChatChild(buf,COLOR_ITEM);

	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_RESET_SUCCESS,pMsg->MapIndex);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostWarEnd(MSG_FC_OUTPOST_WAR_END* pMsg)
/// \brief		전진기지 전쟁시간 종료.
/// \author		dgwoo
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostWarEnd(MSG_FC_OUTPOST_WAR_END* pMsg)
{
	char buf[512];
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_WAR_END,pMsg->MapIndex);
	g_pGameMain->m_pOutPost->DeleteOutPostMapIndex(pMsg->MapIndex);

	wsprintf(buf,STRMSG_C_070816_0110,pMapInfo->MapName);							// "%s 전진기지전이 종료되었습니다."
	g_pInterface->ShowOpWndTxt(buf);
	m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);

	if(COMPARE_INFLUENCE(INFLUENCE_TYPE_VCN, pMsg->Influence))	
	{
		wsprintf(buf,STRMSG_C_070816_0119,STRMSG_C_060210_0000,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
	}
	else if(COMPARE_INFLUENCE(INFLUENCE_TYPE_ANI, pMsg->Influence))
	{
		wsprintf(buf,STRMSG_C_070816_0119,STRMSG_C_060210_0001,pMsg->GuildName,pMapInfo->MapName);
		m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
	}
	
	// 2013-06-17 by bhsohn 세력포인트 표시 변경
#ifdef SC_UPGRADE_INFLUENCE_POINT_HSKIM_BHSOHN
	#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG				// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
		char buff[1024];
		ZERO_MEMORY(buff);		
		if(COMPARE_INFLUENCE(g_pShuttleChild->m_myShuttleInfo.InfluenceType, pMsg->Influence))
		{
			//  전진기지전에서 이긴 세력임				
			wsprintf(buff, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_OUTPOST_WAR_WINNER);	// "세력 포인트 %d점이 추가 되었습니다."				
		}	
		else
		{
			//  전진기지전에서 진 세력임				
			wsprintf(buff, STRMSG_C_061121_0002, CONTRIBUTIONPOINT_OUTPOST_WAR_LOSER);	// "세력 포인트 %d점이 추가 되었습니다."		
		}
		m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
	#endif
#endif
	// END 2013-06-17 by bhsohn 세력포인트 표시 변경
}
VOID CAtumApplication::FieldSocketInfoNoticeRequestOk(MSG_FC_INFO_NOTICE_REQUEST_OK* pMsg)
{	
	int nBuildIdx = BUILDINGKIND_CITYLEADER_OUTPOST;
	if(TRUE == IsLeaderOutPost())
	{
		nBuildIdx = BUILDINGKIND_CITYLEADER_LEADER;
	}

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildIdx);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildIdx)
	{		
		CINFCityOutPost * pCityOutPost = ((CINFCityOutPost*)it->second);
		pCityOutPost->SetNotice(pMsg->NoticeString);
	}
	else if(BUILDINGKIND_CITYLEADER_LEADER == nBuildIdx)
	{		
		CINFCityLeader * pCityOutPost = ((CINFCityLeader*)it->second);
		pCityOutPost->SetNotice(pMsg->NoticeString);
	}
	
}
VOID CAtumApplication::FieldSocketInfoNoticeRegOk()
{
}
VOID CAtumApplication::FieldSocketInfoNoticeModifyOk()
{
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketInfoExpediencyfundPayBackOk(MSG_FC_INFO_EXPEDIENCYFUND_PAYBACK_OK* pMsg)
/// \brief		수령 액 관련 정보 갱신
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-10 ~ 2007-09-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoExpediencyfundPayBackOk(MSG_FC_INFO_EXPEDIENCYFUND_PAYBACK_OK* pMsg)
{	
	int nBuildIdx = BUILDINGKIND_CITYLEADER_OUTPOST;
	if(TRUE == IsLeaderOutPost())
	{
		nBuildIdx = BUILDINGKIND_CITYLEADER_LEADER;
	}

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildIdx);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	
	char buf[1024] = {0,};
	wsprintf(buf, STRMSG_C_070910_0208, pMsg->ExpediencyFundPayBackCount);
	m_pChat->CreateChatChild(buf, COLOR_ITEM);	
	
	if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildIdx)
	{		
		CINFCityOutPost * pCityOutPost = ((CINFCityOutPost*)it->second);
		pCityOutPost->SetExpenceInfo((float)pMsg->ExpediencyFundRate, pMsg->CumulativeExpediencyFund, pMsg->ExpediencyFund);
	}
	else if(BUILDINGKIND_CITYLEADER_LEADER == nBuildIdx)
	{		
		CINFCityLeader * pCityOutPost = ((CINFCityLeader*)it->second);
		pCityOutPost->SetExpenceInfo((float)pMsg->ExpediencyFundRate, pMsg->CumulativeExpediencyFund, pMsg->ExpediencyFund);		 
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketInfoExpediencyfundRequestOk(MSG_FC_INFO_EXPEDIENCYFUND_REQUEST_OK* pMsg)
/// \brief		// 세금 관련 정보 
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-10 ~ 2007-09-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketInfoExpediencyfundRequestOk(MSG_FC_INFO_EXPEDIENCYFUND_REQUEST_OK* pMsg)
{
	int nBuildIdx = BUILDINGKIND_CITYLEADER_OUTPOST;
	if(TRUE == IsLeaderOutPost())
	{
		nBuildIdx = BUILDINGKIND_CITYLEADER_LEADER;
	}

	// 세금 관련 정보 
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildIdx);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildIdx)
	{		
		CINFCityOutPost * pCityOutPost = ((CINFCityOutPost*)it->second);
		pCityOutPost->SetExpenceInfo((float)pMsg->ExpediencyFundRate, pMsg->CumulativeExpediencyFund, pMsg->ExpediencyFund);
	}
	else if(BUILDINGKIND_CITYLEADER_LEADER == nBuildIdx)
	{		
		CINFCityLeader * pCityOutPost = ((CINFCityLeader*)it->second);
		pCityOutPost->SetExpenceInfo((float)pMsg->ExpediencyFundRate, pMsg->CumulativeExpediencyFund, pMsg->ExpediencyFund);		 
	}	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostNextWarInfoRequestOk(MSG_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK* pMsg)
/// \brief		// 전진 기지전 시간 
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-10 ~ 2007-09-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostNextWarInfoRequestOk(MSG_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK* pMsg)
{
	int nBuildIdx = BUILDINGKIND_CITYLEADER_OUTPOST;
	if(TRUE == IsLeaderOutPost())
	{
		nBuildIdx = BUILDINGKIND_CITYLEADER_LEADER;
	}
	
	// 세금 관련 정보 
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildIdx);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	
	ATUM_DATE_TIME *pTimeList = (ATUM_DATE_TIME*)((char *)pMsg + sizeof(MSG_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK));
	vector<ATUM_DATE_TIME>	vectmpTimeList;
	
	int i = 0;
	for(i = 0 ; i < pMsg->OutPostNextWarTimeListCount ; i++)
	{		
		ATUM_DATE_TIME tmpTimeList;
		memcpy(&tmpTimeList, pTimeList, sizeof(ATUM_DATE_TIME));
	
		// 2007-10-31 by bhsohn 전진기지전 시간 설정 잘못 나오는 문제 처리
		tmpTimeList.Year = 2007;
		tmpTimeList.Month = 1;
		tmpTimeList.Day = 1;
		// end 2007-10-31 by bhsohn 전진기지전 시간 설정 잘못 나오는 문제 처리

		vectmpTimeList.push_back(tmpTimeList);
		pTimeList++;
	}
	if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildIdx )
	{		
		CINFCityOutPost * pCityOutPost = ((CINFCityOutPost*)it->second);
		pCityOutPost->SetNextWarInfo(pMsg->OutPostNextWarTime, pMsg->OutPostNextWarSelectTimeChoice, vectmpTimeList);
	}
	else if(BUILDINGKIND_CITYLEADER_LEADER == nBuildIdx )
	{		
		CINFCityLeader * pCityOutPost = ((CINFCityLeader*)it->second);
		pCityOutPost->SetNextWarInfo(pMsg->OutPostNextWarTime, pMsg->OutPostNextWarSelectTimeChoice, vectmpTimeList);
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketOutPostNextWarInfoRequestOk(MSG_FC_OUTPOST_NEXTWAR_INFO_REQUEST_OK* pMsg)
/// \brief		// 전진 기지전 시간 
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-10 ~ 2007-09-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketOutPostNextWarSetTimeOk(MSG_FC_OUTPOST_NEXTWAR_SET_TIME_OK* pMsg)
{	
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	if(NULL == pMapinfo)
	{
		return;
	}
	char buf[1024] = {0,};
	// 2007-10-05 by bhsohn 시,분,초 스트링 시스템 추가
//	wsprintf(buf, STRMSG_C_070910_0204, pMapinfo->MapName, 
//										pMsg->OutPostNextWarTime.Month, pMsg->OutPostNextWarTime.Day,
//										pMsg->OutPostNextWarTime.Hour, pMsg->OutPostNextWarTime.Minute);
	string szStrBuf;
	ATUM_DATE_TIME timeTmp;
	timeTmp.GetLocalString_MMDD(pMsg->OutPostNextWarTime.Month, pMsg->OutPostNextWarTime.Day, szStrBuf,GetLanguageType());

	wsprintf(buf, STRMSG_C_070910_0204, pMapinfo->MapName, 
										szStrBuf.c_str(),
										pMsg->OutPostNextWarTime.Hour, pMsg->OutPostNextWarTime.Minute);
	// end 2007-10-05 by bhsohn 시,분,초 스트링 시스템 추가

	m_pChat->CreateChatChild(buf, COLOR_ITEM);	

}

VOID CAtumApplication::FieldSocketOutPostWarInfo(MSG_FC_OUTPOST_WAR_INFO* pMsg)
{
	// 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정	
	int nOutPosMapIdx = -1;
	// end 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정

	SOUTPOST_WAR_INFO *pOutPost = (SOUTPOST_WAR_INFO*)((char *)pMsg + sizeof(MSG_FC_OUTPOST_WAR_INFO));
	for(int i = 0; i < pMsg->OutPostWarInfoListCount ; i++)
	{
//		g_pGameMain->m_pOutPost->AddOutPostMapIndex(pOutPost->MapIndex);
//		g_pGameMain->m_pOutPost->m_bAttackerInf = pOutPost->OutPostResetIngInfluence;
//		if(IS_OUTPOST_RESETING(pOutPost->OutPostState))
//		{
//			g_pGameMain->m_pOutPost->SetOutPostState(OUTPOST_STATE_RESET_START);
//		}
//		g_pGameMain->m_pOutPost->SetWarTime(pOutPost->OutPostWarStartTime,pOutPost->OutPostWarEndTime);
//		g_pGameMain->m_pOutPost->SetResetTime(pOutPost->OutPostWarResetRamainSecondTime );
		if(IS_OUTPOST_RESETING(pOutPost->OutPostState))
		{
			g_pGameMain->m_pOutPost->AddOutPost(pOutPost->MapIndex,OUTPOST_STATE_RESET_START,pOutPost->OutPostResetIngInfluence,pOutPost->OutPostWarStartTime,pOutPost->OutPostWarEndTime,pOutPost->OutPostWarResetRamainSecondTime);
		}
		else
		{
			// 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정
			nOutPosMapIdx = pOutPost->MapIndex;
			// end 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정
			g_pGameMain->m_pOutPost->AddOutPost(pOutPost->MapIndex,OUTPOST_STATE_WAR_START,pOutPost->OutPostResetIngInfluence,pOutPost->OutPostWarStartTime,pOutPost->OutPostWarEndTime,pOutPost->OutPostWarResetRamainSecondTime);
		}
		
		pOutPost++;
	}
	// 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정
	if(nOutPosMapIdx != -1 && m_pChat)
	{
		char buf[512];
		MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(nOutPosMapIdx);		
		if(pMapInfo)
		{
			wsprintf(buf,STRMSG_C_070816_0118,pMapInfo->MapName);
			m_pChat->CreateChatChild(buf,COLOR_MONSTER_ID04);
		}		
		g_pInterface->ShowOpWndTxt(STRMSG_C_081014_0100);

	}
	// end 2008-12-31 by bhsohn 전진기지전 오퍼레이터 안뜨는 버그 수정

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::AddSpeakerGMString(char* pGmChat)
/// \brief		
/// \author		// 2007-08-07 by bhsohn 스피커 아이템 추가
/// \date		2007-08-07 ~ 2007-08-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::AddSpeakerGMString(char* pGmChat, BOOL bGmColor)
{
	if(g_pGameMain)
	{	
		g_pGameMain->AddSpeakerMsgString(pGmChat, TRUE, bGmColor);
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketTutorialEndOK()
/// \brief		튜토리얼 종료.
/// \author		dgwoo
/// \date		2007-07-16 ~ 2007-07-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketTutorialEndOK()
{
	// 2009. 10. 14 by jskim 프리스카 제거 - 처음 튜토리얼 종료시 프롤로그 안나오는 현상 처리
	m_pTutorial->SetTutorialEd(TRUE);
	//end 2009. 10. 14 by jskim 프리스카 제거 - 처음 튜토리얼 종료시 프롤로그 안나오는 현상 처리
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketEventTeleportBuildComplete(MSG_FC_EVENT_TELEPORT_BUILDCOMPLETE* pMsg)
/// \brief		텔레포트 설치 완료.
/// \author		dgwoo
/// \date		2007-09-19 ~ 2007-09-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventTeleportBuildComplete(MSG_FC_EVENT_TELEPORT_BUILDCOMPLETE* pMsg)
{
	char buf[1024] = {0,};
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	wsprintf(buf, STRMSG_C_070816_0120,pMapinfo->MapName);
	m_pChat->CreateChatChild(buf, COLOR_ITEM);	
	// 인터페이스 출력.
	m_pInterface->m_pToolTip->SetImgType(TOOLTIP_IMGTYPE_TELEPORT_SUC);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketEventTeleportDestroy(MSG_FC_EVENT_TELEPORT_DESTROY* pMsg)
/// \brief		텔레포트 파괴
/// \author		dgwoo
/// \date		2007-09-19 ~ 2007-09-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventTeleportDestroy(MSG_FC_EVENT_TELEPORT_DESTROY* pMsg)
{
	char buf[1024] = {0,};
	MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
	if(pMsg->bInactivateByOtherTeleport)
	{// 텔레포트 비활성화.
		wsprintf(buf,STRMSG_C_070816_0123,pMapinfo->MapName);					//"\\y%s\\c지역 텔레포트가 비활성화 되었습니다."
	}
	else
	{// 텔레포트 파괴.
		wsprintf(buf, STRMSG_C_070816_0121,pMapinfo->MapName);					//"\\y%s\\c지역 \\y텔레포트\\c가 파괴되었습니다."
		// 인터페이스 출력.
		m_pInterface->m_pToolTip->SetImgType(TOOLTIP_IMGTYPE_TELEPORT_DESTROY);

	}
	m_pChat->CreateChatChild(buf, COLOR_ITEM);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketArenaGMCommandInfoHeader();
/// \brief		GM명령어 요청으로 세력의 방정보들을 한번에 보여준다.(아래의 패킷)
///				FieldSocketArenaGMCommandInfo,FieldSocketArenaGMCommandInfoDone
/// \author		dgwoo
/// \date		2007-05-28 ~ 2007-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketArenaGMCommandInfoHeader()
{
	m_vecTeamInfo.clear();
	m_bRequestEnable = FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCharacterBuyWarPointItem(MSG_FC_CHARACTER_BUY_WARPOINT_ITEM* pMsg)
/// \brief		워포인트샾에서 아이템을 구매시 차감된 포인터를 적용시키는 함수.
/// \author		dgwoo
/// \date		2007-06-13 ~ 2007-06-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopBuyWarPointItemOK(MSG_FC_SHOP_BUY_WARPOINT_ITEM_OK* pMsg)
{
	g_pShuttleChild->m_myShuttleInfo.WarPoint = pMsg->WarPoint;
}
VOID CAtumApplication::FieldSocketArenaGMCommandInfo(MSG_FC_ARENA_GM_COMMAND_INFO* pMsg)
{
	MSG_FC_ARENA_GM_COMMAND_INFO sTeamInfo;
	memset(&sTeamInfo,0x00,sizeof(MSG_FC_ARENA_GM_COMMAND_INFO));
	sTeamInfo.ArenaMode			= pMsg->ArenaMode;
	sTeamInfo.Level				= pMsg->Level;
	sTeamInfo.MemberCount		= pMsg->MemberCount;
	sTeamInfo.TeamCount			= pMsg->TeamCount;
	m_vecTeamInfo.push_back(sTeamInfo);
}
VOID CAtumApplication::FieldSocketArenaGMCommandInfoDone(MSG_FC_ARENA_GM_COMMAND_INFO_DONE* pMsg)
{
	char buf[256];
	char cLevel;
	char sArenaMode[256];
	sort(m_vecTeamInfo.begin(),m_vecTeamInfo.end(),ArenaTeamInfo());
	vector<MSG_FC_ARENA_GM_COMMAND_INFO>::iterator it = m_vecTeamInfo.begin();
	while(m_vecTeamInfo.end() != it)
	{
		if(it->ArenaMode == ARENAMODE_DEATHMATCH)
			wsprintf(sArenaMode,"%s",STRMSG_C_070427_0100);
		else
			wsprintf(sArenaMode,"%s",STRMSG_C_070427_0101);

		if(it->Level >= ARENA_STAGE_A_START_LEVEL)
			cLevel = STRMSG_C_070528_0102;
		else if(it->Level >= ARENA_STAGE_B_START_LEVEL)
			cLevel = STRMSG_C_070528_0103;
		else if(it->Level >= ARENA_STAGE_C_START_LEVEL)
			cLevel = STRMSG_C_070528_0104;
		else if(it->Level >= ARENA_STAGE_D_START_LEVEL)
			cLevel = STRMSG_C_070528_0105;
	
		wsprintf(buf,STRMSG_C_070528_0100,sArenaMode,cLevel,it->MemberCount,it->TeamCount);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		it++;
	}
	wsprintf(buf,STRMSG_C_070528_0101,pMsg->ReadyUserTotalCount,pMsg->MatchIngUserTotalCount,pMsg->ArenaFightIngUserTotalCount);
	m_pChat->CreateChatChild(buf,COLOR_ITEM);
	m_bRequestEnable = TRUE;
}

// 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)
void	CAtumApplication::FieldSocketPutEnchantDone( void )
{
	
	// 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결

// 	float fWeight = g_pStoreData->GetTotalWeight() / CAtumSJ::GetTransport(&g_pShuttleChild->m_myShuttleInfo);
// 	if(fWeight >= 0.9f)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0044,COLOR_SYSTEM);//"기어 적재량의 90%를 초과 하였습니다."
// 		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0045,COLOR_SYSTEM);//"최소 속도로만 이동가능하며, 연료소모량이 증가합니다."
// 	}
// 	else if(fWeight > WEIGHT_RATE_VERY_HEAVY)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0046,COLOR_SYSTEM);//"기어 적재량의 80%를 초과 하였습니다."
// 		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0047,COLOR_SYSTEM);//"부스터의 사용이 제한되며, 연료소모량이 증가합니다."
// 	}
// 	else if(fWeight >= WEIGHT_RATE_HEAVY)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0048,COLOR_SYSTEM);//"기어 적재량의 70%를 초과하여 연료소모량이 증가합니다."
// 	}

	// end 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결

}
// end 2009. 04. 06 by ckPark 게임시작시 중량 인챈트 적용 안된상태로 나오던 버그(0001388)

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		dgwoo
/// \date		2008-01-15 ~ 2008-01-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventCouponEventUseCouponOK(MSG_FC_EVENT_COUPON_EVENT_USE_COUPON_OK* pMsg)
{
	m_bRequestEnable = TRUE;
	g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_080115_0100, _Q_COUPON);//"아이템이 지급 되었습니다."
	g_pGameMain->ShowCouponWindow(FALSE);
	g_pGameMain->m_pCouponBtn->EnableBtn(FALSE);
	g_pGameMain->m_pCouponBtn->ShowWindow(FALSE);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		dgwoo
/// \date		2008-01-15 ~ 2008-01-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventCouponEventInfo(MSG_FC_EVENT_COUPON_EVENT_INFO* pMsg)
{
	g_pGameMain->SetCouponActive(pMsg);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::RenderRequestEnable()
/// \brief		서버로 요청 불가능한 상태 메시지 출력
/// \author		jschoi
/// \date		2005-03-03 ~ 2005-03-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RenderRequestEnable()
{
	// 2007-12-17 by bhsohn 아이템 정보가 다 안오면 게임 대기상태로
	//if(m_bRequestEnable == TRUE)
	if(IsLockMode() == TRUE)
	{
		// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
		m_fServerLockTime = 0.0f;// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
		return;
	}
	
	if(m_dwGameState == _SELECT)
	{
		if(g_pSelect)
		{
			g_pSelect->RenderRequestEnable(m_fRequestEnableTime);
		}
	}
	else
	{
		if(g_pGameMain)
		{
			g_pGameMain->RenderRequestEnable(m_fRequestEnableTime);
		}
	}
	// 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
#ifdef	C_SERVER_DOWN_ALARM	
	DWORD dwGameState = GetGameState();
	switch(dwGameState)
	{
	case _GAME:
		{
			m_fServerLockTime += GetCheckElapsedTime();
			if(m_fServerLockTime > 10.0f)
			{
				g_pD3dApp->m_pSound->SetBackMusic(_SERVER_DOWN);
			}
		}
		break;
	}	
#endif
	// END 2013-07-05 by bhsohn 서버종료시, 경고음 시스템
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::RequestEnableTick(float fElapsedTime)
/// \brief		
/// \author		jschoi
/// \date		2005-03-03 ~ 2005-03-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RequestEnableTick(float fElapsedTime)
{	
	// 2008-01-17 by bhsohn Lock시스템 추가변경
	//if(m_bRequestEnable == FALSE)
	if(IsLockMode()== FALSE)
	{
		m_fRequestEnableTime += fElapsedTime;
		if(m_fRequestEnableTime > REQUEST_ENABLE_TIME)	
		{
			m_fRequestEnableTime -= REQUEST_ENABLE_TIME;
		}
	}
	else
	{
		m_fRequestEnableTime = REQUEST_ENABLE_INIT_TIME;
	}
}


// 2005-03-16 by jschoi
VOID CAtumApplication::FieldSocketStoreInsertUsingItem(MSG_FC_STORE_INSERT_USINGITEM* pMsg)
{
	ITEM* pItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
	g_pGameMain->m_pInfSkill->InsertItemInfo(pItemInfo, pMsg->ItemUID, pMsg->nRemainSecond);
	
// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
#ifdef SC_SEARCHEYE_SHUTTLE_POSITION_JHSEOL_MSPARK
	m_nItemNum = pItemInfo->ItemNum;
#endif
// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정

	if(ITEMKIND_CARD == pItemInfo->Kind
		&& COMPARE_BIT_FLAG(pItemInfo->ItemAttribute, ITEM_ATTR_TIME_LIMITE)
		&& 0 < pItemInfo->ReAttacktime)
	{// 2007-06-21 by dgwoo 시간제 아이템일 경우 퀵슬롯에 표시.
		g_pGameMain->m_pQuickSlot->StartReattackTime(pItemInfo);
	}
	// 2008-11-26 by bhsohn 절대시간 제한 아이템 구현
	else if(ITEMKIND_CARD == pItemInfo->Kind
		&& COMPARE_BIT_FLAG(pItemInfo->ItemAttribute, ITEM_ATTR_DELETED_TIME_LIMITE_AFTER_USED)
		&& 0 < pItemInfo->ReAttacktime)
	{
		g_pGameMain->m_pQuickSlot->StartReattackTime(pItemInfo);
	}
	// end 2008-11-26 by bhsohn 절대시간 제한 아이템 구현
	// 2010. 04. 14 by jskim 아이템 사용시 부스터 기능 추가
	g_pShuttleChild->RecalculateSpeedAndAngle();
	g_pShuttleChild->SetShuttleSpeed();
	//end 2010. 04. 14 by jskim 아이템 사용시 부스터 기능 추가
}

// 2005-03-16 by jschoi
VOID CAtumApplication::FieldSocketStoreDeleteUsingItem(MSG_FC_STORE_DELETE_USINGITEM* pMsg)
{
	ITEM* pItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemNum);
	g_pGameMain->m_pInfSkill->DeleteItemInfo(pItemInfo);

	// 2010. 04. 14 by jskim 아이템 사용시 부스터 기능 추가
	g_pShuttleChild->RecalculateSpeedAndAngle();
	g_pShuttleChild->SetShuttleSpeed();
	//end 2010. 04. 14 by jskim 아이템 사용시 부스터 기능 추가
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketErrorByErrorCode(MSG_ERROR* pMsg)
/// \brief		ErrorCode로 에러 검색 우선
/// \author		jschoi
/// \date		2005-03-17 ~ 2005-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::FieldSocketErrorByErrorCode(MSG_ERROR* pMsg)
{
	char errStr[512];
	if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_EP)							// EP 부족(부스터 작동 불가)
	{
		wsprintf(errStr,STRERR_ERROR_0003);//"연료가 부족합니다. 연료를 채우세요."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_TOO_LONG_DISTANCE)						// 거리가 너무 멀다(ex. SIZE_VISIBLERECT_X이상임)
	{
		wsprintf(errStr,STRERR_ERROR_0004);//"거리가 너무 멀리 떨어져 있습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_P2P_PK)							// 이미 일대일 PK 중임
	{
		wsprintf(errStr,STRERR_ERROR_0005);//"이미 결투중입니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_TOO_FAR_TO_P2P_PK)						// 너무 멀어서 일대일 PK 불가
	{
		wsprintf(errStr,STRERR_ERROR_0006);//"거리가 너무 멀리 떨어져 있어서 결투신청을 할 수 없습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_HIGH_LEVEL_GAP_TO_P2P_PK)				// 레벨 차가 많이 나서 PK 불가
	{
		wsprintf(errStr,STRERR_ERROR_0007);//"레벨 차이가 10이상 나면 1:1대결을 할 수가 없습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_DOING_P2P_PK)						// PK 중이 아님
	{
		wsprintf(errStr,STRERR_ERROR_0008);//"결투 중이 아닙니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_CANNOT_USE_ITEM)
	{
		wsprintf(errStr,STRERR_ERROR_0009);//"해당 아이템을 사용 할 수 있는 상태가 아닙니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_RACE_NOT_MATCHED)
//	{
//		wsprintf(errStr,"해당 종족이 아닙니다. 한번 더 확인해 주시기 바랍니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_ATTACK_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"공격 파트 포인트가 부족합니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_DEFENSE_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"방어 파트 포인트가 부족합니다.");//내구-->방어
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_FUEL_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"연료 파트 포인트가 부족합니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_SOUL_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"정신 파트 포인트가 부족합니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_UNITKIND_NOT_MATCHED)
//	{
//		wsprintf(errStr,"현재 기어가 사용 할 수 없는 아이템입니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED)
//	{
//		wsprintf(errStr,"레벨이 부족합니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_SHIELD_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"쉴드 파트 포인트가 부족합니다.");//방어->쉴드
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_DODGE_PART_NOT_MATCHED)
//	{
//		wsprintf(errStr,"회피 파트 포인트가 부족합니다.");
//		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
//	}
	
	// 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리
	
	// T_FC_ITEM_USE_RANDOMBOX 에러 처리로 옮김
// 	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_HAVE_ITEM)
// 	{
// 		wsprintf(errStr,STRERR_ERROR_0010);// "이미 아이템을 가지고 있습니다."
// 		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
// 	}

	// end 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리

	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_HAVE_SKILL)
	{
		wsprintf(errStr,STRERR_ERROR_0011);// "이미 스킬을 가지고 있습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_EXPERIENCE_NOT_MATCHED)
	{
		wsprintf(errStr,STRERR_ERROR_0012);// "경험치가 부족합니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_MAX_PARTY_MEMBER)
	{
		wsprintf(errStr,STRERR_ERROR_0013);// "편대 인원수가 최대수를 넘었습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_MIN_TRADE_QUANTITY_ERROR)
	{
		wsprintf(errStr,STRERR_ERROR_0014,pMsg->ErrParam1);// "%d개 단위로 거래하십시오."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_TOO_FAR_TO_TRADE)
	{
		wsprintf(errStr,STRERR_ERROR_0015);// "멀리 떨어져 있어 거래가 되지 않습니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_TRADING)
	{
		wsprintf(errStr,STRERR_ERROR_0016);// "이미 거래중입니다."
		m_pChat->CreateChatChild(errStr,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_LOGINED)
	{
		NetworkErrorMsgBox(STRERR_ERROR_0017);// "비정상 접근경로입니다. 클라이언트를 종료합니다."
	}
	else if (pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_SP)
	{ 
		m_pChat->CreateChatChild(STRERR_ERROR_0018,COLOR_SKILL_CANCEL);// "스킬포인트가 부족합니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ITEM_CANNOT_TRANSFER)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0019,COLOR_ERROR);// "이동 할 수 없는 아이템입니다."		
		
		// 이동할 수 없는 아이템입니다.
		//UpdateMutltiItemError();
		// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
		IntervalSellMutltiOneItem();
		// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ITEM_OVER_WEIGHT)
	{
		m_pChat->CreateChatChild(STRMSG_C_050927_0001,COLOR_ERROR);// "적재량을 초과하여 아이템을 장착 할 수 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_DO_NOT_HAVE_LINK_ITEM )
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0021,COLOR_ERROR);// "스킬을 구입 할 때 필요한 아이템이 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_INVENTORY_FULL_ITEM)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0022,COLOR_ERROR,CHAT_TAB_SYSTEM);// "인벤토리 공간이 부족합니다."
		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		DelMultiItemList();	
		// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안

		// 2009-05-18 by bhsohn 럭키상점에서 인벤풀일떄의 아이템 처리
		if(pMsg->MsgType == T_FC_ITEM_USE_LUCKY_ITEM)
		{
			GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
			if(pBuilding)
			{
				if(BUILDINGKIND_LUCKY == pBuilding->buildingInfo.BuildingKind)
				{
					CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);			
					if(pStore)
					{
						pStore->ErrorLuckyMechineInvenFull();
						pStore->ResetLuckyMachineInfo();
					}	
				}

			}
			
		}
		// end 2009-05-18 by bhsohn 럭키상점에서 인벤풀일떄의 아이템 처리

	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_STORE_FULL_ITEM)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0023,COLOR_ERROR);// "창고 저장 공간이 부족합니다."
		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		DelMultiItemList();	
		// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_ITEM_NOT_MATCHED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0024,COLOR_ERROR);// "필요 아이템이 없어서 미션을 시작 할 수 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NO_SUCH_ITEM)
	{// 2006-10-17 by dgwoo 창고 아이템을 새로 갱신 시켜준다.
		if(pMsg->MsgType == T_FC_STORE_MOVE_ITEM)
		{
			CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
			pStore->SetStoreItemSPI();
		}
		// 2008-02-12 by bhsohn 상점에서 해당아이템이 없다는 메시지 제거
		//m_pChat->CreateChatChild(STRERR_ERROR_0025,COLOR_ERROR);// "해당 아이템이 없습니다."

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		if( pMsg->ErrorCode == ERR_PROTOCOL_NO_SUCH_ITEM )
 			m_pChat->CreateChatChild( STRMSG_C_091103_0324, COLOR_ERROR );	// "아이템을 구매 하기 위해 필요한 아이템이 부족합니다."
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_MONEY)
//	{
//		m_pChat->CreateChatChild("스피가 부족합니다.",COLOR_ERROR);
//	}
//	else if(pMsg->ErrorCode == ERR_COMMON_NO_SUCH_CHARACTER)		// 2006-05-08 by ispark, 메세지 타입별로 분류, 삭제
//	{
//		m_pChat->CreateChatChild(STRERR_ERROR_0026,COLOR_ERROR);// "캐릭터를 찾을 수 없습니다."
//	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_INVALID_CITYWAR_QUEST_INDEX)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0027,COLOR_ERROR);// "도시점령전 정보 에러입니다. 고객센타에 신고해 주십시요."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_NOT_GUILD_MASTER)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0028,COLOR_ERROR);// "도시점령전 미션은 여단장만 받을 수 있습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_ALREADY_EXIST_CITYWAR)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0029,COLOR_ERROR);// "이미 다른 도시점령전 미션을 받은 상태입니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_CITYWAR_MGAMESERVERID_NOT_MATCHED )
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0030,COLOR_ERROR);// "도시점령전 미션은 해당 서버에서만 취소 할 수 있습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_COUPON_INVALID_NUMBER)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0031,COLOR_ERROR);// "사용 할 수 있는 쿠폰번호가 아닙니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_COUPON_ALREADY_USED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0032,COLOR_ERROR);// "이미 사용된 쿠폰번호입니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_QUEST_COUPON_EXPIRED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0033,COLOR_ERROR);// "유효기간이 경과된 쿠폰번호입니다."
	}
	else if(pMsg->ErrorCode == ERR_COMMON_INVALID_BUILDINGKIND)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0034,COLOR_ERROR);// "유효한 상점이 아닙니다."
	}
	// 2014-09-18 by ymjoo 인피니티에서 랜덤박스 개봉불가
	//else if(pMsg->ErrorCode == ERR_PROTOCOL_INVALID_ITEM_KIND)
	else if(pMsg->ErrorCode == ERR_PROTOCOL_INVALID_ITEM_KIND &&
			pMsg->MsgType != T_FC_ITEM_USE_RANDOMBOX)
	// END 2014-09-18 by ymjoo 인피니티에서 랜덤박스 개봉불가
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0035,COLOR_ERROR);// "사용 할 수 없는 아이템 입니다.",
		m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NO_SUCH_ITEM_INFO)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0037,COLOR_ERROR);// "아이템 사용 오류 입니다."
		m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ITEM_KIND_NOT_MATCHED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0038,COLOR_ERROR);// "잘못된 아이템 구성 입니다."
//		m_pChat->CreateChatChild("고객 센터로 문의 바랍니다.",COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOTIFY_MAX_ITEM_COUNTS_OVER)
	{
		m_pChat->CreateChatChild(STRMSG_C_050913_0001, COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_MAX_ITEM_COUNTS_OVER)
	{
		m_pChat->CreateChatChild(STRMSG_C_050913_0002, COLOR_ERROR);
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_CANNOT_INVITE_USER) // 2005-12-02 by ispark
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0136,COLOR_ERROR);// "상대방을 초대 할 수 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_DOING_PARTY_BATTLE)
	{
		g_pShuttleChild->SendDeadMsg();
	}
	else if(pMsg->ErrorCode == ERR_DOING_SERVER_SHUTDOWN)
	{
		// 무조건 종료처리
		char szTemp[256] = {0, };
			sprintf ( szTemp , "%s\n[%s]" , STRMSG_C_060608_0000 , "ERR_DOING_SERVER_SHUTDOWN" );

		NetworkErrorMsgBox ( szTemp );
		//NetworkErrorMsgBox(STRMSG_C_060608_0000);					// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
	}


	// 2009. 01. 12 by ckPark 선전 포고 시스템
// 	else if(pMsg->ErrorCode == ERR_NO_SUCH_DECLARATION_MSWAR_INFO)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_090113_0323, COLOR_ERROR);// "\\y선전포고 정보를 찾을 수 없습니다.\\y"
// 		g_pD3dApp->EnterLock(TRUE);
// 	}
// 	else if(pMsg->ErrorCode == ERR_NO_MORE_DECLARATION_MSWAR_SET)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_090113_0324, COLOR_ERROR);// "\\y더 이상 선전포고를 할 수 없습니다.\\y"
// 		g_pD3dApp->EnterLock(TRUE);
// 	}
// 	else if(pMsg->ErrorCode == ERR_INVALID_DECLARATION_MSWAR_TIME)
// 	{
// 		m_pChat->CreateChatChild(STRMSG_C_090113_0325, COLOR_ERROR);// "\\y선전포고 시간이 잘못 입력되었습니다. 입력형식이 잘못되었거나, 현재 시간으로부터 12시간 이내는 선전포고를 할 수 없습니다.\\y"
// 		g_pD3dApp->EnterLock(TRUE);
// 	}
	// end 2009. 01. 12 by ckPark 선전 포고 시스템


	// 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현

	else if( pMsg->ErrorCode == ERR_DEBUFF_SKILL_APPLYING_SLIENCE )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_RELEASE_SKILL_NOT_FIND )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_DEBUFF_SKILL_APPLYING_NOT_HP_RECOVERY )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_DEBUFF_SKILL_APPLYING_NOT_DP_RECOVERY )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_DEBUFF_SKILL_APPLYING_NOT_SP_RECOVERY )
	{
		_asm nop
	}

	// end 2009. 09. 21 by ckPark 인피니티 필드 몬스터 스킬 구현
	
	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	else if( pMsg->ErrorCode == ERR_INFINITY_OVER_ENTRANCECOUNT )
	{
		
		// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 		CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 		if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 		{
// 			((CINFCityInfinityField*)((*it).second))->SetRoomJoinWait( FALSE );
// 			
// 			GetInfinityManager()->ClearMyRoomInfo();
// 		}
		// 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력
		m_pChat->CreateChatChild(STRMSG_C_101201_0401, COLOR_ERROR);// "\\y입장 제한 회수가 초과되었습니다.\\y"
		// end 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력 
		if( m_pInterface && m_pInterface->m_pInfinityPopup )
		{
			m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );

			GetInfinityManager()->ClearMyRoomInfo();
		}
		// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_MODE )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_CREATEUID )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_NO_SUCH_MASTER_USER )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_NO_SUCH_MEMBER_LIST )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_SAME_MASTER )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_MASTER )
	{
		_asm nop
	}
	else if( pMsg->ErrorCode == ERR_INFINITY_CREATE_MAPCHANNEL )
	{
		_asm nop
	}

	// 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )
	else if ( pMsg->ErrorCode == ERR_INFINITY_DIFFICLUTY_NOT_FIND )
	{	// 난이도 정보 못 찾음.
		m_pChat->CreateChatChild ( STRERR_ERROR_0151 , COLOR_ERROR );	//"인피니티 난이도 정보를 찾을 수 없습니다."
	}
	else if ( pMsg->ErrorCode == ERR_INFINITY_DIFFICULTY_LEVEL_SAME )
	{	// 동일한 난이도 레벨값 변경 요청. - 무시.	
		m_pChat->CreateChatChild ( STRERR_ERROR_0153 , COLOR_ERROR );
	}
	else if ( pMsg->ErrorCode == ERR_INFINITY_DIFFICULTY_LEVEL_INVALID )
	{	// 난이도 정보 못 찾음. - 레벨값 기준.
		m_pChat->CreateChatChild ( STRERR_ERROR_0152 , COLOR_ERROR );	//"인피니티 레벨 정보가 올바르지 않습니다."
	}
	// End 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )

	// 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.
	else if ( pMsg->ErrorCode == ERR_INFINITY_MISMATCH_CREATEUID )
	{
		_asm nop
	}
		// 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력 
	else if ( pMsg->ErrorCode == ERR_INFINITY_MISMATCH_LEVEL )
	{
		//_asm nop
		if( m_pInterface && m_pInterface->m_pInfinityPopup )
		{
			m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );
			GetInfinityManager()->ClearMyRoomInfo();
		}
		m_pChat->CreateChatChild ( STRMSG_C_101201_0402 , COLOR_ERROR );	//"레벨 제한으로 방생성 및 입장이 불가능합니다.\\y"		 
	}
	// end 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력 
	else if ( pMsg->ErrorCode == ERR_INFINITY_PLAYING_STATE )
	{
		_asm nop
	}
	else if ( pMsg->ErrorCode == ERR_INFINITY_ALWAYS_SKIP_ENDINGCINEMA )
	{
		_asm nop
	}
	// End 2010. 07. 27 by hsLee 인피니티 2차 거점 방어 시네마 연출 스킵 처리.

	// 2010. 03. 29 by ckPark 인피니티 파티원이 레디를 하지 않은 상태에서 시작버튼을 눌렀을 때 버그 수정
// 	else if( pMsg->ErrorCode == ERR_INFINITY_NOT_ALL_READY )
// 	{
// 		_asm nop
// 	}
	// end 2010. 03. 29 by ckPark 인피니티 파티원이 레디를 하지 않은 상태에서 시작버튼을 눌렀을 때 버그 수정
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템



	// 2006-05-08 by ispark, DBG에서만 작동
	else if(pMsg->ErrorCode == ERR_COMMON_BAD_NETWORK)
	{
		DBGOUT("\n<--------------------[BAD NETWORK!!!!!]-------------------->\n");
	}
	else
	{
		// ErrorCode으로 검색되지 않은 에러입니다.
		return FALSE;
	}
	return TRUE;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketErrorByMsgType(MSG_ERROR* pMsg)
/// \brief		MsgType으로 에러 검색 우선
/// \author		jschoi
/// \date		2005-03-17 ~ 2005-03-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::FieldSocketErrorByMsgType(MSG_ERROR* pMsg)
{
	char szBuf[512];


	// 2010. 05. 19 by hsLee 인피니티 필드 2차 난이도 조절. (신호처리 + 몬스터 처리(서버) )
	switch ( pMsg->MsgType )
	{

		case T_FC_CHARACTER_CREATE :

			switch (pMsg->ErrorCode )
			{
				case ERR_COMMON_CHARACTER_ALREADY_EXISTS :
					
					if(g_pSelect/* && !g_pSelect->m_pInfWindow->IsExistMsgBox(_MESSAGE_ERROR_CREATE)*/)
					{
						// 같은 이름이 존재 인덱스 3
						g_pSelect->m_pCreateMenu->m_nFocus = 3;
						//g_pSelect->m_pInfWindow->AddMsgBox(STRERR_ERROR_0039, _MESSAGE_ERROR_CREATE);// "이미 존재하는 이름입니다."
					}
					break;

				case ERR_PROTOCOL_INVALID_AUTOSTAT_TYPE :
				
					if(g_pSelect && !g_pSelect->m_pInfWindow->IsExistMsgBox(_MESSAGE_ERROR_CREATE))
					{
						g_pSelect->m_pInfWindow->AddMsgBox(STRERR_ERROR_0040, _MESSAGE_ERROR_CREATE);// "스탯타입 오류입니다. 고객센타로 문의 바랍니다."
					}
					break;
				
				default :

					g_pSelect->m_pInfWindow->AddMsgBox(STRERR_ERROR_0041, _MESSAGE_ERROR_CREATE);// "캐릭터 생성에 실패하였습니다."
					break;
			}
			break;
			
		case T_FC_CHARACTER_DELETE :

			g_pSelect->ShowSecutiryWnd(FALSE);

			// 2007-09-12 by bhsohn 2차 암호 시스템 구현		
			switch ( pMsg->ErrorCode ) 
			{
				case ERR_SECPASS_PASSWORD_NOT_MATCHED :
					
					g_pSelect->m_pInfWindow->AddMsgBox( STRMSG_C_070917_0203, _MESSAGE );
					break;

				case ERR_WARING_OUTPOST_TO_OWNMAP :
			
					g_pSelect->m_pInfWindow->AddMsgBox(STRMSG_C_071112_0101,_MESSAGE);		//"전진기지전 진행 중 소유 여단장은 캐릭터를 삭제 할 수 없습니다."	
					break;

				// 2008-10-20 by bhsohn VOIP 여단을 해체해야만 캐릭터를 삭제할 수 있게 변경
				case ERR_DELETE_CHARACTER_GUILDCOMMANDER :
	
					g_pSelect->m_pInfWindow->AddMsgBox(STRMSG_C_081021_0200, _MESSAGE); //"여단을 해체해야만 캐릭터를 삭제할 수 있습니다."
					break;
				// end 2008-10-20 by bhsohn VOIP 여단을 해체해야만 캐릭터를 삭제할 수 있게 변경
			}
			break;
// 2005-11-22 by ispark
// 이전 함수에서 처리를 하므로 삭제
//	else if(pMsg->MsgType == T_FC_ITEM_USE_ENCHANT)
//	{
//		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);
//		if(pCityLab)
//		{
//			pCityLab->InitData();
//		}
//		m_pChat->CreateChatChild(STRERR_C_ENCHANT_0001,COLOR_ERROR);
//	}
		case T_FC_ITEM_MIX_ITEMS :
			{
				CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);

				if(pCityLab)
				{					
					// 2013-04-08 by bhsohn 인게임 조합창 추가 구현
//					pCityLab->InitData();
#ifdef C_INGAME_MIX_ITEM
					pCityLab->ErrorMixItem(pMsg->ErrorCode);
#else 
					pCityLab->InitData();
#endif
					// END 2013-04-08 by bhsohn 인게임 조합창 추가 구현
				}
				
				
				switch ( pMsg->ErrorCode ) 
				{
					case ERR_PROTOCOL_NO_SUCH_MIXING_INFO :

						m_pChat->CreateChatChild(STRERR_C_MIX_0001,COLOR_ERROR);// "아이템 조합을 할 수 없는 아이템 구성입니다."
						break;

					case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

						m_pChat->CreateChatChild(STRERR_ERROR_0105,COLOR_ERROR);// "스피가 부족하여 조합을 할 수 없습니다."
						break;

					// 2007-09-12 by bhsohn 2차 암호 시스템 구현
					case ERR_SECPASS_LOCKED :
						{
							char ErrorMsgMissionList[256];
							wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
							m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
						}
						break;
					// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

					case ERR_PROTOCOL_ALREADY_USE_ITEM :
				
						m_pChat->CreateChatChild(STRMSG_C_071212_0100,COLOR_ERROR);// "해당 아이템은 조합 할 수 있는 상태가 아닙니다."
						break;

					// 2008-03-14 by bhsohn 조합식 개선안
					case ERR_PROTOCOL_REQ_MIX_ITEM_NOT_MATCHED :
						//한번 조합으로 1개의 결과물만 제조할 수 있는 아이템입니다.
						m_pChat->CreateChatChild(STRMSG_C_080318_0200,COLOR_ERROR);// "수량이 맞지 않아 아이템을 제조할 수 없습니다."
						break;

					case ERR_PROTOCOL_INVALID_ITEM_COUNT :
						//개수 오류
						m_pChat->CreateChatChild(STRMSG_C_080318_0200,COLOR_ERROR);// "수량이 맞지 않아 아이템을 제조할 수 없습니다."
						break;
				}
					// end 2008-03-14 by bhsohn 조합식 개선안
			//		else
			//		{
			//			m_pChat->CreateChatChild(STRERR_ERROR_0106,COLOR_ERROR);// "조합을 할 수 없습니다."
			//		}
			}
			break;

		case T_FC_SKILL_USE_SKILL :
			{
				switch ( pMsg->ErrorCode )
				{
					case ERR_PROTOCOL_CANNOT_USE_SKILL :
				
						m_pChat->CreateChatChild(STRMSG_C_060720_0000, COLOR_ERROR);	// "스킬 사용이 취소 되었습니다."
						break;
				
					case ERR_INVISIBLE_STATE :

						m_pChat->CreateChatChild(STRERR_C_SKILL_0002, COLOR_ERROR);		// "스킬을 사용할 수 없는 상태입니다."
						break;

					case ERR_PROTOCOL_QUEST_IS_IN_PROGRESS :
				
						m_pChat->CreateChatChild(STRMSG_C_060807_0000, COLOR_ERROR);	// "미션진행중입니다. 이동안은 해당스킬을 사용할 수 없습니다."
						break;

					case ERR_NO_MEMBERSHIP_USER :
				
						m_pChat->CreateChatChild(STRMSG_C_060920_0103, COLOR_ERROR);	// "멤버쉽 유저가 아닙니다."
						break;

					case ERR_ARENA_STATE :
						
						m_pChat->CreateChatChild(STRMSG_C_070509_0100,COLOR_ERROR);
						break;

					case ERR_USING_SHOP :
				
						m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."	
						break;

					// 2007-09-12 by bhsohn 2차 암호 시스템 구현
					case ERR_SECPASS_LOCKED :
						{
							char ErrorMsgMissionList[256];
							wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
							m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
						}
						break;
					// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

					// 2010. 11. 24. by hsLee. 시전자가 버닝타임 맵일 경우 타겟의 버닝타임 맵 진입 조건 체크.
					case ERR_PROTOCOL_NOT_WARP_BURNING_MAP :
						
						m_pChat->CreateChatChild ( STRERR_C_VOIP_0002 , COLOR_ERROR );		// "잘못된 유저입니다."
						break;
					// End. 2010. 11. 24. by hsLee. 시전자가 버닝타임 맵일 경우 타겟의 버닝타임 맵 진입 조건 체크.
				}

				DBGOUT("ERROR : USE SKILL --> You Need Check Code \n");
			}
			break;

		case T_FC_CHARACTER_USE_BONUSSTAT :	// 보너스 포인트가 없거나 Stat의 종류가 유효하지 않다.

			switch ( pMsg->ErrorCode )
			{	
				case ERR_PROTOCOL_LIMIT_STAT_POINT :
			
					m_pChat->CreateChatChild(STRERR_ERROR_0042,COLOR_ERROR);// "해당 스탯은 더 이상 올릴 수 없습니다."
					break;

				case ERR_PROTOCOL_INVALID_STAT_VALUE_OR_KIND :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0043,COLOR_ERROR);// "보너스 스탯이 없거나 스탯 종류가 유효하지 않습니다."
					break;

				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0044,COLOR_ERROR);// "보너스 스탯 사용 오류입니다."
					break;
			}
			break;
	
		case T_FC_SHOP_BUY_CASH_ITEM :
	
			switch ( pMsg->ErrorCode )
			{
				case ERR_CASH_mgQueryMall_ERROR :
				case ERR_CASH_mgQueryMall_RESULT_CANNOT_PAYMENT :
				case ERR_CASH_mgQueryMall_RESULT_NO_ACCOUNT :

					m_pChat->CreateChatChild(STRERR_ERROR_0045,COLOR_ERROR);// "유료화 아이템 구입 에러입니다. 고객센터로 문의하시기 바랍니다."
					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					m_pChat->CreateChatChild(STRERR_ERROR_0047,COLOR_ERROR);// "캐쉬가 부족합니다."
					break;

				case ERR_CASH_PREMIUM_CARD_ALREADY_USING :
				
					m_pChat->CreateChatChild(STRMSG_C_050603_0001,COLOR_ERROR); // "이미 멤버쉽 서비스 카드가 사용 중입니다"
					break;

				case ERR_CASH_PREMIUM_CARD_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_050603_0002,COLOR_ERROR); //"멤버쉽 서비스 업그레이드 카드를 구입 할 수 없습니다."
					break;
		
				case ERR_CASH_PREMIUM_CARD_NOT_YET_BUY_STATE :

					m_pChat->CreateChatChild(STRMSG_C_050603_0003,COLOR_ERROR); //"더이상 멤버쉽 서비스 카드를 구입 할 수 없습니다."
					break;

				/*case ERR_CASH_PREMIUM_CARD_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_050603_0004,COLOR_ERROR); //"멤버쉽 서비스 업그레이드 카드를 구입 할 수 없습니다."
					break;*/

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템
		
				// 2009. 08. 21 by ckPark 캐쉬아이템 선물하기에 블럭계정 체크
				case ERR_CASH_INVALID_GIVE_TARGET_ACCOUNT :
					{
						char ErrorMsg[256];
						g_pGameMain->GetCashGiftSendCharacterName( ErrorMsg );
						wsprintf( ErrorMsg, STRMSG_C_090821_0301, ErrorMsg );
						m_pChat->CreateChatChild( ErrorMsg, COLOR_ERROR ); //"%s 회원님은 블럭중인 상태로, 선물을 보내실 수 없습니다."
					}
					break;
				// end 2009. 08. 21 by ckPark 캐쉬아이템 선물하기에 블럭계정 체크

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_BUY_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0110,COLOR_ERROR);		// "아이템을 구입 할 수 없습니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템

				// 2010. 01. 27 by ckPark 캐쉬 아이템 한정 판매 시스템
				case ERR_SOLD_OUT_SHOP_ITEM :

					m_pChat->CreateChatChild( STRMSG_C_100127_0302, COLOR_ERROR );		// "해당 아이템의 판매 개수가 모두 소진되어 구매 할 수 없습니다."
					break;
				// end 2010. 01. 27 by ckPark 캐쉬 아이템 한정 판매 시스템
				// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
				case ERR_NOT_DISSOLVED_ITEM:
					{
						m_pChat->CreateChatChild( STRMSG_C_100901_0406, COLOR_ERROR );		// "\\y용해할 아이템이 아닙니다.\\y"
						break;
					}
				case ERR_NOT_INSERT_DISSOLVED_ITEMS:
					{
						m_pChat->CreateChatChild( STRMSG_C_100901_0407, COLOR_ERROR );		// "\\y아이템 삽입에 실패하였습니다.\\y"
						break;
					}
				// end 2010-08-31 by shcho&&jskim, 용해 시스템 구현
			}
			break;

		case T_FC_CHARACTER_GET_CASH_MONEY_COUNT :

			switch ( pMsg->ErrorCode )
			{
				case ERR_CASH_CASH_SHOP_NO_SERVICE :
					
					g_pInterface->m_pCityBase->OnCityNPCButtonDown(CITY_NPC_BUTTON_CLOSE);
					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_070110_0100, _MESSAGE);	// "아이템샾이 오픈되지 않았습니다."
					break;

				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0046,COLOR_ERROR);// "캐쉬 관련 오류입니다. 고객센터로 문의하시기 바랍니다."
					break;
			}
			break;

		case T_FC_ITEM_USE_ENERGY :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_INVALID_ITEM_COUNT : 

					m_pChat->CreateChatChild(STRERR_ERROR_0037,COLOR_ERROR);// "아이템 사용 오류 입니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;

				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :
	
					m_pChat->CreateChatChild(STRERR_ERROR_0048,COLOR_ERROR);// "유닛의 레벨이 사용 가능한 최소 레벨 보다 작다."
					break;

				case ERR_PROTOCOL_REQ_MAXLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0049,COLOR_ERROR);// "유닛의 레벨이 사용 가능한 최대 레벨 보다 크다."
					break;

				case ERR_PROTOCOL_REQ_NOT_CITY_MAP_CHANNEL :

					m_pChat->CreateChatChild(STRERR_ERROR_0050,COLOR_ERROR);// "격납고에서만 스탯 초기화가 가능합니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0051,COLOR_ERROR);// "스탯 초기화를 실패하였습니다."
					break;
				
				case ERR_PROTOCOL_REQ_MUST_RELEASE_ALL_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0052,COLOR_ERROR);// "스탯 초기화를 위해 모든 아이템을 장착 해제하세요."
					m_pChat->CreateChatChild(STRERR_ERROR_0051,COLOR_ERROR);// "스탯 초기화를 실패하였습니다."
					break;

				case ERR_PROTOCOL_STAT_ERROR_STATE :

					m_pChat->CreateChatChild(STRERR_ERROR_0053,COLOR_ERROR);// "초기화하려는 스탯이 오류 상태입니다. "
					m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;

				case ERR_PROTOCOL_STAT_INITIALIZE_STATE :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0054,COLOR_ERROR);// "초기화하려는 스탯은 이미 초기화된 상태입니다."
					break;

				case ERR_PROTOCOL_NO_SUCH_DES_PARAM :

					m_pChat->CreateChatChild(STRERR_ERROR_0035,COLOR_ERROR);// "사용 할 수 없는 아이템 입니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;
					
				case ERR_PROTOCOL_AREADY_USING_HP_UP_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0055,COLOR_ERROR);// "이미 수리키트를 사용중입니다."
					break;
				
				case ERR_PROTOCOL_AREADY_USING_DP_UP_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0056,COLOR_ERROR);// "이미 쉴드키트를 사용중입니다."
					break;

				case ERR_PROTOCOL_AREADY_USING_SP_UP_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0057,COLOR_ERROR);// "이미 SP UP 아이템을 사용중임."
					break;
						
				case ERR_PROTOCOL_AREADY_USING_EP_UP_ITEM :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0058,COLOR_ERROR);// "이미 연료를 사용중입니다."
					break;

				case ERR_PROTOCOL_AREADY_FULL_HP :

					//			m_pChat->CreateChatChild("이미 HP 가 만땅임.",COLOR_ERROR);
					break;

				case ERR_PROTOCOL_AREADY_FULL_DP :
					//			m_pChat->CreateChatChild("이미 DP 가 만땅임.",COLOR_ERROR);
					break;

				case ERR_PROTOCOL_AREADY_FULL_SP :

					//			m_pChat->CreateChatChild("이미 SP 가 만땅임.",COLOR_ERROR);
					break;

				case ERR_PROTOCOL_AREADY_FULL_EP :

					//			m_pChat->CreateChatChild("이미 EP 가 만땅임.",COLOR_ERROR);
					break;

				case ERR_USING_BAZAAR :

					m_pChat->CreateChatChild(STRMSG_C_060802_0001,COLOR_ERROR);// "개인상점에서는 아이템을 사용 할 수 없습니다."
					break;

				case ERR_PROTOCOL_CANNOT_USE_ITEM_IN_ARENA :

					m_pChat->CreateChatChild(STRMSG_C_070604_0100,COLOR_ERROR);// "아레나 맵에서 사용할 수 없는 아이템 입니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				case ERR_CANNOT_SEARCH_OUTPOST :
				
					m_pChat->CreateChatChild(STRMSG_C_070816_0117,COLOR_ERROR);	//전진기지전이 진행 중이거나, 소유 여단원만 진입할 수 있습니다.
					break;

				// 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
				case ERR_ALREADY_USE_ITEMPARAM :

					m_pChat->CreateChatChild( STRMSG_C_100118_0301, COLOR_ERROR );
					break;
				// end 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리

				default : 
					
					m_pChat->CreateChatChild(STRERR_ERROR_0059,COLOR_ERROR);// "에너지류 아이템 사용 관련 오류입니다."
					break;
			}
			break;
		
		case T_FC_ITEM_USE_ITEM :
	
			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0048,COLOR_ERROR);// "유닛의 레벨이 사용 가능한 최소 레벨 보다 작다."
					break;
				
				case ERR_PROTOCOL_REQ_MAXLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0049,COLOR_ERROR);// "유닛의 레벨이 사용 가능한 최대 레벨 보다 크다."
					break;

				case ERR_PROTOCOL_ALREADY_USE_ITEM :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0060,COLOR_ERROR);// "사용하려는 아이템이 이미 사용 중입니다."
					break;

				case ERR_PROTOCOL_ALREADY_USE_OTHER_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0061,COLOR_ERROR);// "사용하려는 아이템과 같은 종류의 아이템이 이미 사용 중입니다."
					break;

				case ERR_PROTOCOL_NO_SUCH_DES_PARAM :

					m_pChat->CreateChatChild(STRERR_ERROR_0035,COLOR_ERROR);// "사용 할 수 없는 아이템 입니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;

				// 2007-08-24 by bhsohn 스피커 아이템 사용 못하게 하는 명령어 추가모해
				case ERR_CANNOT_USE_SPEAKER_ITEM :
				
					m_pChat->CreateChatChild(STRMSG_C_070824_0201,COLOR_ERROR); //"[스피커] 아이템을 사용할 수 없는 상태입니다."
					break;
				// end 2007-08-24 by bhsohn 스피커 아이템 사용 못하게 하는 명령어 추가

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_INVALID_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_090925_0404,COLOR_ERROR); //"필드 창고에서 사용한 캐릭터가 존재하지 않습니다."
					break;
					
				/*case ERR_PROTOCOL_ALREADY_USE_ITEM :
	
					m_pChat->CreateChatChild(STRERR_ERROR_0060,COLOR_ERROR); //"사용하려는 아이템이 이미 사용 중입니다."
					break;*/

				case ERR_ALREADY_USING_BUILDING :
					
					m_pChat->CreateChatChild(STRMSG_C_090925_0405,COLOR_ERROR); //"사용하려는 상점은 이미 이용 중입니다."
					break;
		
				case ERR_PROTOCOL_CANNOT_USE_ITEM :
					
					m_pChat->CreateChatChild(STRMSG_C_090925_0406,COLOR_ERROR); //"필드 창고에서 사용할 수 없는 아이템 입니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템

				// 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
				case ERR_ALREADY_USE_ITEMPARAM :
	
					m_pChat->CreateChatChild( STRMSG_C_100118_0301, COLOR_ERROR );
					break;
				// end 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리

				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				case ERR_INFINITY_ONLY_USE_ITEM :

					m_pChat->CreateChatChild( STRMSG_C_091103_0340, COLOR_ERROR );
					break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				// 2010. 06. 18 by jskim 인피니티내에서 아이템 사용 관련 스트링 수정
				case ERR_INFINITY_CANNOT_USE_ITEM :
					m_pChat->CreateChatChild( STRMSG_C_100618_0406, COLOR_ERROR ); //"해당 아이템은 인피니티 필드내에서 사용이 불가능 합니다."
					break;
				//end 2010. 06. 18 by jskim 인피니티내에서 아이템 사용 관련 스트링 수정
				// 2013-08-27 by bhsohn 미션 프리 패스 시스템
				case ERR_PROTOCOL_QUEST_FREEPASS_CANNOT_BE_USED:		// 아이템을 사용할수 없는 퀘스트.
					{
						m_pChat->CreateChatChild( STRMSG_C_130827_0003, COLOR_ERROR ); 
					}
					break;
				case ERR_PROTOCOL_QUEST_FREEPASS_NOT_LEVEL_IN_RANGE:	// 아이템을 사용할수 있는 퀘스트 레벨이 아님. 
					{
						m_pChat->CreateChatChild( STRMSG_C_130827_0002, COLOR_ERROR ); 
					}
					break;
				// END 2013-08-27 by bhsohn 미션 프리 패스 시스템

				default :
					m_pChat->CreateChatChild(STRERR_ERROR_0062,COLOR_ERROR);// "아이템 사용 관련 오류입니다."
					break;
			}
			break;

		case T_FC_REQUEST_REQUEST :

			if( pMsg->ErrParam1 == REQUEST_TYPE_PARTY_BATTLE )
			{
				g_pGameMain->m_pCommunity->GetParty()->SetEnablePartyMenu( TRUE );
				break;
			}
			
			switch ( pMsg->ErrorCode )
			{
				case ERR_COMMON_NO_SUCH_CHARACTER :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0063,COLOR_ERROR);// "상대방 유닛을 찾을 수 없습니다."
					break;

				case ERR_COMMON_NOT_ALLOWED_TO_MYSELF :

					m_pChat->CreateChatChild(STRERR_ERROR_0064,COLOR_ERROR);// "자기 자신에게는 요청 할 수 없습니다."
					break;
					
				case ERR_PROTOCOL_TOO_FAR_TO_DO :

					m_pChat->CreateChatChild(STRERR_ERROR_0065,COLOR_ERROR);// "상대방과의 거리가 멀어서 요청 할 수 없습니다."
					break;

				case ERR_PROTOCOL_NO_SUCH_PARTY :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0066,COLOR_ERROR);// "자신 혹은 상대방이 파티에 속해 있지 않기 때문에 요청 할 수 없습니다."
					break;

				case ERR_PROTOCOL_PARTY_PERMISSION_DENIED :

					m_pChat->CreateChatChild(STRERR_ERROR_0067,COLOR_ERROR);// "자신 혹은 상대방이 파티장이 아니기 때문에 요청 할 수 없습니다."
					break;

				case ERR_PROTOCOL_ALREADY_REQUESTING_PARTY_BATTLE :

					m_pChat->CreateChatChild(STRERR_ERROR_0068,COLOR_ERROR);// "자신 혹은 상대방이 이미 파티전 요청중입니다."
					break;

				case ERR_PROTOCOL_ALREADY_PARTY_BATTLE :

					m_pChat->CreateChatChild(STRERR_ERROR_0068,COLOR_ERROR);// "자신 혹은 상대방이 이미 파티전 요청중입니다."
					break;
					
				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0069,COLOR_ERROR);// "레벨이 맞지 않아 편대결투를 할 수 없습니다."
					break;
				
				case ERR_PROTOCOL_MAP_CHANNEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0070,COLOR_ERROR);// "모든 편대원들이 같은 맵에 있지 않습니다."
					break;
				
				case ERR_PROTOCOL_NO_SUCH_REQUEST_TYPE :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0071,COLOR_ERROR);// "유효하지 않은 요청입니다."
					break;

				// 2009-02-05 by bhsohn 전쟁중 도시 귀환 불능 문제 해결
				case ERR_WARING_OUTPOST_TO_OWNMAP :

					m_pChat->CreateChatChild(STRMSG_C_090205_0201, COLOR_ERROR);// "유효하지 않은 요청입니다."
					break;
				// end 2009-02-05 by bhsohn 전쟁중 도시 귀환 불능 문제 해결
				// 2014-04-15 by ssjung 버닝맵에서는 결투 불가
				case ERR_PROTOCOL_NOT_WARP_BURNING_MAP :
					m_pChat->CreateChatChild( STRERR_C_VOIP_0002, COLOR_ERROR);// "// "잘못된 유저입니다."
					break;
				// end 2014-04-15 by ssjung 버닝맵에서는 결투 불가
				default :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0072,COLOR_ERROR);// "편대결투 신청이 실패했습니다."
					break;
			}
			break;

		case T_FC_QUEST_DISCARD_QUEST :

			switch ( pMsg->ErrorCode )
			{
				
				case ERR_PROTOCOL_QUEST_CANNOT_CITYWAR_QUEST :
								
					m_pChat->CreateChatChild ( STRERR_ERROR_0073 , COLOR_ERROR );	// "도시점령전이 진행중일 때는 취소 할 수 없습니다."
					break;

				case ERR_PROTOCOL_QUEST_IMPOSSIBLE_GIVEUP :

					g_pGameMain->AddMsgBox( STRMSG_C_060720_0001 , _MESSAGE );		// "해당 미션은 포기 할 수 없습니다."
					break;

				default :
					break;
			}
			break;

		case T_FC_QUEST_REQUEST_START :

			switch ( pMsg->ErrorCode )
			{	
				case ERR_PROTOCOL_QUEST_CANNOT_CITYWAR_QUEST :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0074,COLOR_ERROR);// "도시점령전이 진행중일 때는 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0075,COLOR_ERROR);// "레벨이 맞지 않아 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_ATTACK_PART_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0076,COLOR_ERROR);// "공격파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_DEFENSE_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0077,COLOR_ERROR);// "방어파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_FUEL_PART_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0078,COLOR_ERROR);// "연료파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_SOUL_PART_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0079,COLOR_ERROR);// "정신파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_SHIELD_PART_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0080,COLOR_ERROR);// "쉴드파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_DODGE_PART_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0081,COLOR_ERROR);// "회피파트 스탯이 부족하여 퀘스트를 시작 할 수 없습니다."
					break;

		//		else if(pMsg->ErrorCode == )// 2006-03-24 by ispark
				// 2006-03-28 by ispark, 편대 미션

				case ERR_PROTOCOL_MAP_CHANNEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0070,COLOR_ERROR);// "모든 편대원들이 같은 맵에 있지 않습니다."
					break;
				
				case ERR_PROTOCOL_NO_SUCH_PARTY :

					m_pChat->CreateChatChild(STRMSG_C_060328_0001, COLOR_ERROR); // "편대상태에서만 할 수 있는 미션입니다."
					break;

				case ERR_PROTOCOL_REQ_PARTYMEMBERS_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_060328_0002, COLOR_ERROR); // "편대원 수가 부족합니다."
					break;
					
				case ERR_PROTOCOL_REQ_PARTYMEMBERS_LEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_060328_0003, COLOR_ERROR); // "편대원의 최고레벨과 최저레벨이 10이상 차이가 납니다."
					break;

				case ERR_PROTOCOL_REQ_PARTYMEMBERS_SOMEONE_CANNOT_WARP :

					m_pChat->CreateChatChild(STRMSG_C_060328_0004, COLOR_ERROR); // "워프를 할 수 없는 편대원이 있습니다."
					break;

				case ERR_ARENA_STATE :

					break;
			
				// 2010. 02. 02 by ckPark 거래중 미션시작 워프 관련 에러처리
				case ERR_PROTOCOL_CANNOT_WARP :
					{
						_asm nop
					}
					break;
				// end 2010. 02. 02 by ckPark 거래중 미션시작 워프 관련 에러처리

				default :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0082,COLOR_ERROR);// "퀘스트를 시작 할 수 없습니다."
					break;
			}
			break;

		case T_FC_BATTLE_REQUEST_P2P_PK :

			switch ( pMsg->ErrorCode )
			{
				
				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0083,COLOR_ERROR);// "레벨이 맞지 않아 결투를 할 수 없습니다."
					break;
				
				case ERR_USING_BAZAAR :					// 2006-08-01 by ispark
	
					m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."
					break;
	
				case ERR_PROTOCOL_CANNOT_IN_CITY_MAP_CHANNEL :
					
					m_pChat->CreateChatChild(STRMSG_C_061010_0001, COLOR_ERROR); // 2006-10-10 by ispark, "도시에서는 PVP를 할 수 없습니다."
					break;
		
				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_050825_0011,COLOR_ERROR);	// "세력이 맞지않습니다."
					break;

				case ERR_ARENA_STATE :

					m_pChat->CreateChatChild(STRMSG_C_070514_0100,COLOR_ERROR); //"아레나가 진행 중이므로 신청할 수 없습니다."
					break;
// 2014-04-15 by ssjung 버닝맵에서는 결투 불가
				case ERR_PROTOCOL_NOT_WARP_BURNING_MAP :
					m_pChat->CreateChatChild( STRERR_C_VOIP_0002, COLOR_ERROR);  // "잘못된 유저입니다."
					break;
// end 2014-04-15 by ssjung 버닝맵에서는 결투 불가
			}
			break;

		case T_FC_BATTLE_ACCEPT_REQUEST_P2P_PK :			// 2006-08-01 by ispark

			switch ( pMsg->ErrorCode )
			{
				case ERR_USING_BAZAAR :
				
					m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."
					break;

				default :
					break;
			}
			break;

		case T_FC_ITEM_CHANGE_WINDOW_POSITION :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_INVALID_ITEM_WINDOW_POSITION :

					m_pChat->CreateChatChild(STRERR_ERROR_0084,COLOR_ERROR);// "아이템 이동이 잘못되었습니다."
					break;

				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0085,COLOR_ERROR);// "레벨이 낮아서 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_MAXLEVEL_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0086,COLOR_ERROR);// "레벨이 높아서 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_UNITKIND_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0087,COLOR_ERROR);// "해당 아이템을 장착 할 수 있는 기어가 아닙니다."
					break;

				case ERR_PROTOCOL_REQ_RACE_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0088,COLOR_ERROR);// "해당 아이템을 장착 할 수 있는 종족이 아닙니다."
					break;

				case ERR_PROTOCOL_REQ_ATTACK_PART_NOT_MATCHED :
					m_pChat->CreateChatChild(STRERR_ERROR_0089,COLOR_ERROR);// "공격파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_DEFENSE_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0090,COLOR_ERROR);// "방어파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_FUEL_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0091,COLOR_ERROR);// "연료파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_SOUL_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0092,COLOR_ERROR);// "정신파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_SHIELD_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0093,COLOR_ERROR);// "쉴드파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_DODGE_PART_NOT_MATCHED :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0094,COLOR_ERROR);// "회피파트 스탯이 부족하여 아이템을 장착 할 수 없습니다."
					break;

				case ERR_CANNOT_ATTACHED_USING_PREMIUM_CARD :
				
					m_pChat->CreateChatChild(STRMSG_C_060331_0003,COLOR_ERROR);// "멤버쉽 서비스 사용중에는 장착 할 수 없는 아이템입니다."
					break;

				case ERR_EXPIRED_ITEM :
				
					m_pChat->CreateChatChild(STRMSG_C_060331_0004,COLOR_ERROR);// 사용 시간이 만료 되었습니다. 아이템이 삭제 됩니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
					{
						// 2012-12-18 by bhsohn 빠르게 아이템 탈/착용시, Lock걸리는 문제 수정
						g_pD3dApp->EnterLock(TRUE);		// FALSE :Lock  TRUE : UnLock		
						// END 2012-12-18 by bhsohn 빠르게 아이템 탈/착용시, Lock걸리는 문제 수정
					}
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 

				// 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
				case ERR_ALREADY_USE_ITEMPARAM :

					m_pChat->CreateChatChild( STRMSG_C_100118_0301, COLOR_ERROR );
					break;
				// end 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리

				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0095,COLOR_ERROR);// "아이템을 장착 할 수 없습니다."
					break;
			}
			break;

		case T_FC_SHOP_BUY_ITEM :

			switch ( pMsg->ErrorCode )
			{	
				case ERR_PROTOCOL_REQ_RACE_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0096,COLOR_ERROR);// "스킬을 구입 할 수 있는 종족이 아닙니다."
					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					m_pChat->CreateChatChild(STRERR_ERROR_0109,COLOR_ERROR);// "스피가 부족하여 아이템을 구입 할 수 없습니다."
					break;
					
				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_BUY_ITEM :
				
					m_pChat->CreateChatChild(STRERR_ERROR_0110, COLOR_ERROR);// "아이템을 구입 할 수 없습니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				// 2011-10-24 by jhahn 트리거 시스템 		
				case ERR_INSUFFICIENT_NUMBER_SHOP_ITEM:					
					m_pChat->CreateChatChild( STRMSG_C_111114_0001, COLOR_ERROR );
					break;
					
					
				case ERR_NOT_OWNER_SHOP:				
					m_pChat->CreateChatChild( STRMSG_C_111114_0002, COLOR_ERROR );
					break;
                //end 2011-10-24 by jhahn 트리거 시스템 	

				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0110,COLOR_ERROR);// "아이템을 구입 할 수 없습니다."
					break;
			}
			CityShopLock(FALSE);		// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정
			break;
		
		case T_FC_ITEM_USE_ENCHANT :


			switch ( pMsg->ErrorCode ) 
			{
				case ERR_PROTOCOL_REQ_UNITKIND_NOT_MATCHED :

					m_pChat->CreateChatChild(STRERR_ERROR_0097,COLOR_ERROR);// "기어가 맞지않아 인챈트/갬블을 할 수 없습니다."
					break;
			
				case ERR_PROTOCOL_ALREADY_MAX_ENCHANT_PER_ITEM :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0098,COLOR_ERROR);// "더 이상 인챈트/갬블을 할 수 없습니다."
					break;

				case ERR_PROTOCOL_ALREADY_HAVE_RARE_FIX :

					m_pChat->CreateChatChild(STRERR_ERROR_0099,COLOR_ERROR);// "인챈트/갬블을 할 수 없습니다."
					break;
				
				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0100,COLOR_ERROR);// "스피가 부족하여 인챈트/갬블을 할 수 없습니다."
					break;
				
				case ERR_PROTOCOL_ALREADY_INITIALIZE_RARE_FIX :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0101,COLOR_ERROR);// "해당하는 아이템에 레어 옵션이 없습니다."
					break;
					
				case ERR_PROTOCOL_CANNOT_USE_ITEMKIND_PREVENTION_DELETE_ITEM :
		
					m_pChat->CreateChatChild(STRMSG_C_050927_0002, COLOR_ERROR);// "인챈트 파괴 방지 카드를 사용할 수 없습니다."
					break;
					
				// 2009. 01. 21 by ckPark 인챈트 확률 증가 카드
				case ERR_PROTOCOL_CANNOT_USE_ITEMKIND_PREVENTION_DELETE_ITEM_BY_STARTCOUNT :
					{
						// 파괴방지만 이 에러
						// 5인챈 미만에서 확률증가를 썼을 경우 인챈은 되지만 확률증가카드는 소모 되지 않음
						char szTemp[MAX_PATH];
						sprintf(szTemp, STRMSG_C_090121_0301, pMsg->ErrParam1);
						m_pChat->CreateChatChild(szTemp, COLOR_ERROR);//"\\y%d인챈트 미만에서는 해당 아이템을 사용할 수 없습니다.\\y"
					}
					break;
				// end 2009. 01. 21 by ckPark 인챈트 확률 증가 카드

				case ERR_PROTOCOL_CANNOT_ENCHANT_ITEM : // 2005-11-22 by ispark

					m_pChat->CreateChatChild(STRMSG_C_051122_0005, COLOR_ERROR);//"인첸트 할 수 없는 아이템입니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
		
				// 2011-10-20 by jhahn	인챈트 제한 
				case ERR_PROTOCOL_CANNOT_ENCHANT_MORE_THEN_10:
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_111020_0001);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); 
					}
					break;
				case ERR_PROTOCOL_CANNOT_ENCHANT_DIFFERENCE_ATTRIBUTE:
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_111020_0002);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); 
					}
					break;
				//end 2011-10-20 by jhahn	인챈트 제한 
					
		
				default :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0102,COLOR_ERROR);// "인챈트/갬블을 할 수 없습니다."
					break;
			}
			break;
			
		case T_FC_STORE_MOVE_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0103,COLOR_ERROR);// "스피가 부족하여 창고를 이용 할 수 없습니다."
					break;

		
				case ERR_NO_SEARCH_CHARACTER :
					// 2006-09-19 by dgwoo
					m_pChat->CreateChatChild(STRMSG_C_060920_0102,COLOR_ERROR);
					break;

				case ERR_PROTOCOL_ITEM_AMOUNT_EXCEED :
					{
						CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
						//pStore->GetGuildItem();
						pStore->SetStoreItemSPI();
						m_pChat->CreateChatChild(STRERR_ERROR_0025,COLOR_ERROR);// "해당 아이템이 없습니다."
					}
					break;

				case ERR_NOT_RANK_DRAW_GUILD_STORE :

					m_pChat->CreateChatChild(STRMSG_C_061011_0101,COLOR_ERROR);// "대대원 이상만 찾기가 가능합니다."
					break;

				case ERR_PROTOCOL_GUILD_STORE_FULL_ITEM :

					m_pChat->CreateChatChild(STRMSG_C_061018_0100,COLOR_ERROR);// "아이템의 보관 개수가 초과 되었습니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현


				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
			
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_USE_GUILD_STORE :
				
					m_pChat->CreateChatChild(STRMSG_C_090925_0401,COLOR_ERROR);	//"필드에서 여단 창고를 이용 할 수 없습니다."
					break;

				case ERR_CANNOT_USE_FIELD_STORE :

					m_pChat->CreateChatChild(STRMSG_C_090925_0402,COLOR_ERROR); //"필드 창고를 이용 할 수 없습니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템

				default :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0104,COLOR_ERROR);// "창고를 이용 할 수 없습니다."
					break;
			}
			break;
			
		case T_FC_EVENT_REQUEST_SHOP_WARP :


			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					m_pChat->CreateChatChild(STRERR_ERROR_0107,COLOR_ERROR,CHAT_TAB_SYSTEM);// "스피가 부족하여 워프를 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_WARP_REQUIREMENTS_NOT_MATCHED :
					{
						// 2005-12-12 by ispark
						// 워프실패시 워프미션조건 보여주기
						CQuest* pQuest = NULL;
						char ErrorMsgMissionList[256];
						MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->ErrParam2);
						if(pMapInfo)
						{
							pQuest = g_pQuestData->FindQuest(pMapInfo->QuestIndexForWarp);
							if(pQuest)
							{
								wsprintf(ErrorMsgMissionList, STRMSG_C_050811_0001, pQuest->QuestName);
								m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR,CHAT_TAB_SYSTEM); //"%s 미션 미해결로 워프를 할 수 없습니다."
							}
						}
						else
						{
							m_pChat->CreateChatChild(STRERR_ERROR_0108, COLOR_ERROR,CHAT_TAB_SYSTEM); //"워프를 할 수 없습니다."
						}
					}
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2007-09-20 by dgwoo 에러 스트링 추가.
				case ERR_CANNOT_WARP_TO_OUTPOST_CITY_MAP :

					g_pInterface->m_pCityBase->CloseCurrentEnterBuilding();
					wsprintf(szBuf,STRMSG_C_070816_0122);
					m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				//"전진기지 소유 여단원만 진입할 수 있습니다."
					break;

				// 2007-10-05 by dgwoo 에러시 워프 상점을 닫는다.
				case ERR_PROTOCOL_NOT_HAVE_GUILD :

					g_pInterface->m_pCityBase->CloseCurrentEnterBuilding();
					m_pChat->CreateChatChild(STRERR_ERROR_0108,COLOR_ERROR,CHAT_TAB_SYSTEM);// "워프를 할 수 없습니다."
					break;
				
				// 2008-07-21 by bhsohn 워프 할 수 없는 상황에 대한 처리 추가
				case ERR_CANNOT_WARP_BY_TRADING :

					m_pChat->CreateChatChild(STRMSG_C_080721_0200,COLOR_ERROR,CHAT_TAB_SYSTEM);// "거래중에는 워프를 할 수 없습니다."
					break;
		
				case ERR_CANNOT_WARP_BY_SHOPPING :

					m_pChat->CreateChatChild(STRMSG_C_080721_0201,COLOR_ERROR,CHAT_TAB_SYSTEM);// "상점 이용 중에는 워프를 할 수 없습니다."
					break;
					
				case ERR_USING_BAZAAR :
			
					m_pChat->CreateChatChild(STRMSG_C_080721_0202,COLOR_ERROR,CHAT_TAB_SYSTEM);// "개인 상점 이용 중에는 워프를 할 수 없습니다."
					break;
				// end 2008-07-21 by bhsohn 워프 할 수 없는 상황에 대한 처리 추가

				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0108,COLOR_ERROR,CHAT_TAB_SYSTEM);// "워프를 할 수 없습니다."
					break;
			}
			break;
			
		case T_FC_SHOP_REQUEST_REPAIR :

			switch ( pMsg->ErrorCode )
			{

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0111,COLOR_ERROR);// "스피가 부족하여 수리를 할 수 없습니다."
					break;


				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
		
					
				default :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0112,COLOR_ERROR);// "수리를 할 수 없습니다."
					break;
			}
			break;

		case T_FC_ITEM_USE_CARDITEM_GUILD :

			switch ( pMsg->ErrorCode )
			{

				case ERR_PROTOCOL_NOT_GUILD_MASTER :
					
					// 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
					//m_pChat->CreateChatChild(STRERR_ERROR_0113,COLOR_ERROR);// "여단장만 사용 할 수 있습니다."
					m_pChat->CreateChatChild(STRMSG_C_080619_0201,COLOR_ERROR);// "\\y해당 아이템은 여단장만 사용 할 수 있습니다."			
					break;

				case ERR_PROTOCOL_GUILD_CARD_ALREADY_USING :

					m_pChat->CreateChatChild(STRERR_ERROR_0114,COLOR_ERROR);// "이미 여단카드가 사용중 입니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
				case ERR_PROTOCOL_OVER_MEMBERCOUNT :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_080619_0200);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y더 이상 여단 가입 최대 제한인원을 증가 시킬 수 없습니다."
					}
					break;
				// end 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
		
				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0115,COLOR_ERROR);// "여단 카드를 사용 할 수 없습니다."
					break;
			}
			break;
			
		case T_FC_ITEM_USE_CARDITEM_MONSTERSUMMON :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_NO_SUCH_MONSTER_INFO :

					m_pChat->CreateChatChild(STRERR_ERROR_0116,COLOR_ERROR);// "몬스터 정보 오류 입니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0117,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;
				
				case ERR_PROTOCOL_INVALID_SOCKET_FORNPC :

					m_pChat->CreateChatChild(STRERR_ERROR_0118,COLOR_ERROR);// "NPC 서버 오류 입니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0119,COLOR_ERROR);// "잠시 후 사용하시기 바랍니다."
					break;

				case ERR_PROTOCOL_INVALID_POSITION :
				case ERR_PROTOCOL_CANNOT_IN_CITY_MAP_CHANNEL :
		
					m_pChat->CreateChatChild(STRERR_ERROR_0120,COLOR_ERROR);// "이곳에서는 몬스터 소환카드를 사용 할 수 없습니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
		
				default :

					m_pChat->CreateChatChild(STRERR_ERROR_0121,COLOR_ERROR);// "몬스터 소환 카드를 사용 할 수 없습니다."
					break;
			}
			break;
			
		case T_FC_ITEM_USE_CARDITEM_CHANGECHARACTERNAME :

			switch ( pMsg->ErrorCode )
			{

				case ERR_PROTOCOL_CANNOT_USEITEM_IN_PARTY :

					m_pChat->CreateChatChild(STRERR_ERROR_0122,COLOR_ERROR);// "파티시 사용 불가능한 아이템 입니다."	
					break;
				
				case ERR_PROTOCOL_INVALID_CHARACTER_NAME :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0123,COLOR_ERROR);// "캐릭터명이 유효하지 않습니다."
					break;
						
				case ERR_COMMON_CHARACTER_ALREADY_EXISTS :

					m_pChat->CreateChatChild(STRERR_ERROR_0124,COLOR_ERROR);// "이미 존재하는 이름 입니다."
					break;

				case ERR_DB_EXECUTION_FAILED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0125,COLOR_ERROR);// "아이템을 사용 할 수 없습니다."
					m_pChat->CreateChatChild(STRERR_ERROR_0036,COLOR_ERROR);// "고객 센터로 문의 바랍니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2007-11-20 by dgwoo 에러 코드 추가.

				case ERR_REQ_REG_LEADER_CANDIDATE :
			
					m_pChat->CreateChatChild(STRMSG_C_071120_0100,COLOR_ERROR);		//"후보 등록중인 유저는 이름 변경카드를 사용할 수 없습니다."
					break;

				default :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0125,COLOR_ERROR);// "아이템을 사용 할 수 없습니다."
					break;
			}
			break;

		// 2005-11-14 by ispark - 워프 실패 처리
		case T_FC_EVENT_REQUEST_OBJECT_EVENT :
		case T_FC_PARTY_REQUEST_PARTY_OBJECT_EVENT :

			switch ( pMsg->ErrorCode )
			{

				// 2005-12-29 by ispark, 변경
		//		if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_WARP_REQUIREMENTS_NOT_MATCHED)
				case ERR_REQ_WARP_COMPLETIONQUEST_NOT_MATCHED :
					{// 워프 실패 
						// 2005-08-11 by ispark	
						// 워프실패시 워프미션조건 보여주기
						CQuest* pQuest = NULL;
						char ErrorMsgMissionList[256];
						MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(pMsg->ErrParam2);
						if(pMapInfo)
						{
							pQuest = g_pQuestData->FindQuest(pMapInfo->QuestIndexForWarp);
							if(pQuest)
							{
								wsprintf(ErrorMsgMissionList, STRMSG_C_050811_0001, pQuest->QuestName);
								m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR,CHAT_TAB_SYSTEM); //"%s 미션 미해결로 워프를 할 수 없습니다."
							}
							else
							{
								wsprintf(ErrorMsgMissionList, STRMSG_C_051114_0001);
								m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR,CHAT_TAB_SYSTEM); //"현재 준비중입니다."
							}
						}
						else
						{
							m_pChat->CreateChatChild(STRERR_ERROR_0108, COLOR_ERROR,CHAT_TAB_SYSTEM); //"워프를 할 수 없습니다."
						}
					}
					break;

				// 2008-07-21 by bhsohn 워프 할 수 없는 상황에 대한 처리 추가
				case ERR_CANNOT_WARP_BY_TRADING :
					
					m_pChat->CreateChatChild(STRMSG_C_080721_0200,COLOR_ERROR,CHAT_TAB_SYSTEM);// "거래중에는 워프를 할 수 없습니다."
					break;
					
				case ERR_CANNOT_WARP_BY_SHOPPING :
					
					m_pChat->CreateChatChild(STRMSG_C_080721_0201,COLOR_ERROR,CHAT_TAB_SYSTEM);// "상점 이용 중에는 워프를 할 수 없습니다."
					break;
					
				case ERR_USING_BAZAAR :
					
					m_pChat->CreateChatChild(STRMSG_C_080721_0202,COLOR_ERROR,CHAT_TAB_SYSTEM);// "개인 상점 이용 중에는 워프를 할 수 없습니다."
					break;

				// end 2008-07-21 by bhsohn 워프 할 수 없는 상황에 대한 처리 추가

				case ERR_PROTOCOL_CANNOT_WARP :
					{
						// 2005-12-29 by ispark, 다른 세력의 도시로 이동 실패
						char ErrorMsg[256];
						wsprintf(ErrorMsg, STRMSG_C_051229_0102);
						m_pChat->CreateChatChild(ErrorMsg, COLOR_ERROR); //"다른 세력의 도시로 이동 할 수 없습니다."
					}
					break;

				// 2007-05-22 by bhsohn 워프 실패에 대한 메시지 추가
				case ERR_CANNOT_WARP_TO_CITY :
					{			
						char ErrorMsg[256];
						wsprintf(ErrorMsg, STRMSG_C_051229_0102);
						m_pChat->CreateChatChild(ErrorMsg, COLOR_ERROR); //"다른 세력의 도시로 이동 할 수 없습니다."
					}
					break;
				// end 2007-05-22 by bhsohn 워프 실패에 대한 메시지 추가

				case ERR_CANNOT_WARP_CONNFLICT_AREA :
					{
						// 2006-02-14 by ispark
						char ErrorMsg[256];
						wsprintf(ErrorMsg, STRMSG_C_060214_0001);
						m_pChat->CreateChatChild(ErrorMsg, COLOR_ERROR); //"분쟁지역에 들어갈 수 없습니다."
					}
					break;

			
				case ERR_CANNOT_WARP_POSSESSED_CONNFLICT_AREA :
					{
						// 2006-02-14 by ispark
						char ErrorMsg[256];
						wsprintf(ErrorMsg, STRMSG_C_060214_0002);
						m_pChat->CreateChatChild(ErrorMsg, COLOR_ERROR); //"해당 세력에 속하지 않아 분쟁지역에 들어갈 수 없습니다."
					}
					break;

				// 2007-08-29 by bhsohn 바자 상점 용도 회의룸으로 변경
				case ERR_CONFERENCEROOM_PERMISSION_DENIED :

					if ( pMsg->MsgType != T_FC_EVENT_REQUEST_OBJECT_EVENT )
						 break;
					
					{
						char ErrorMsg[256];
						// 2007-10-06 by dgwoo 명칭 변경.
						if(IS_VCN_INFLUENCE_TYPE(g_pShuttleChild->m_myShuttleInfo.InfluenceType))
						{
							wsprintf(ErrorMsg, STRMSG_C_070831_0201,STRCMD_VCN_INFLUENCE_LEADER);
						}
						else
						{
							wsprintf(ErrorMsg, STRMSG_C_070831_0201,STRCMD_ANI_INFLUENCE_LEADER);
						}
						m_pChat->CreateChatChild(ErrorMsg, COLOR_ERROR); //"\\y%s에게 입장 권한을 부여 받은 유저만 입장할 수 있습니다."
					}
					break;
				// end 2007-08-29 by bhsohn 바자 상점 용도 회의룸으로 변경

				// 2007-09-14 dgwoo 전진기지 상공에서 전쟁중 마을로 진입할 경우. 발생.
				
#ifdef C_EPSODE4_UI_CHANGE_JSKIM					        // 2011. 10. 10 by jskim UI시스템 변경
                    case ERR_CANNOT_WARP_TO_OUTPOST :	 
// 2011. 12. 23 by jskim 전진기지 상공 진입시 메시지 에러 메시지 수정 
// 					switch ( pMsg->ErrorCode )
// 					{
// 						case T_FC_EVENT_REQUEST_OBJECT_EVENT :
// 							{
// 								wsprintf(szBuf,STRMSG_C_070816_0100);
// 								m_pChat->CreateChatChild(szBuf,COLOR_ERROR);			//"\\y전진기지 소유 여단원이 아닙니다."
// 							}
// 							break;
// 
// 						case T_FC_PARTY_REQUEST_PARTY_OBJECT_EVENT :
// 							{
// 								wsprintf(szBuf,STRMSG_C_070816_0117);
// 								m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"전투가 진행 중입니다. 진입 불가능 합니다."
// 							}
// 							break;
//					}																			  
#else		  
					case ERR_CANNOT_WARP_TO_OUTPOST :	 
					
					switch ( pMsg->ErrorCode )
					{
						case T_FC_EVENT_REQUEST_OBJECT_EVENT :
							{
								wsprintf(szBuf,STRMSG_C_070816_0100);
								m_pChat->CreateChatChild(szBuf,COLOR_ERROR);			//"\\y전진기지 소유 여단원이 아닙니다."
							}
							break;

#endif
						case T_FC_PARTY_REQUEST_PARTY_OBJECT_EVENT :
							{
								wsprintf(szBuf,STRMSG_C_070816_0117);
								m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"전투가 진행 중입니다. 진입 불가능 합니다."
							}
// end 2011. 12. 23 by jskim 전진기지 상공 진입시 메시지 에러 메시지 수정 
					break;
// 2011-11-01 by jhahn EP4 트리거 시스템 
				case ERR_REQ_WARP_ONE_TIME_LIMITED:
					{
						wsprintf(szBuf,STRMSG_C_111114_0003);
						m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"1번만 입장 할 수있음"
					}
					break;
				case ERR_REQ_WARP_GUILD_NOT_MATCHED:
					{
						wsprintf(szBuf,STRMSG_C_111114_0004);
						m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"현재 입장할 수 있는 길드가 아님"
					}
					break;
				case ERR_REQ_WARP_MAXIMUM_USER_LIMITED:
					{
						wsprintf(szBuf,STRMSG_C_111114_0005);
						m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"최대 접속할 수 있는 인원을 넘었음"

					}
					break;
				case ERR_REQ_WARP_NO_QUEST_ITEM:
					{
						wsprintf(szBuf,STRMSG_C_111114_0006);
						m_pChat->CreateChatChild(szBuf, COLOR_ERROR);			//"입장에 필요한 퀘스트 아이템이 없음"
					}
					break;				 
//end 2011-11-01 by jhahn EP4 트리거 시스템 

				case ERR_CANNOT_WARP_TO_OUTPOST_CITY_MAP :

					wsprintf(szBuf,STRMSG_C_070816_0117);
					m_pChat->CreateChatChild(szBuf, COLOR_ERROR); //"전투가 진행 중입니다. 진입 불가능 합니다."
					break;

				// 2012-07-02 by hskim, 모선전 개선 - 모선전 진행시 스톤즈 루인 진입 불가
				case ERR_CANNOT_WARP_DURING_MSWAR :
					
					wsprintf(szBuf,STRMSG_C_120702_0001);
					m_pChat->CreateChatChild(szBuf, COLOR_ERROR); //"모선전 진행 시 입장이 불가능 합니다."
					break;
				// end 2012-07-02 by hskim, 모선전 개선 - 모선전 진행시 스톤즈 루인 진입 불가
			}
			break;


		// 2005-06-29 by ispark - 워프 채널 선택창에서 에러 처리
		case T_FC_EVENT_SELECT_CHANNEL :

			switch ( pMsg->ErrorCode )
			{
				
				case ERR_PROTOCOL_REQ_WARP_REQUIREMENTS_NOT_MATCHED :

		//			m_pChat->CreateChatChild(STRMSG_C_050627_0001,COLOR_ERROR); //"워프를 할 수 없습니다."
					g_pD3dDev->SetDialogBoxMode(TRUE);
					MessageBox(m_hWnd,STRMSG_C_060510_0000,"Error", MB_OK);
					g_pD3dDev->SetDialogBoxMode(FALSE);
					break;

				default :

					break;
			}
			break;
		// 2005-11-15 by ispark - 롤링 사용 가능 시간 에러 처리 (5초 : 서버에서 처리)

		case T_FC_MOVE_ROLLING :

			switch ( pMsg->ErrorCode )
			{
	
				case ERR_PROTOCOL_NOT_ENOUGH_ELAPSE_TIME :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_051115_0001, ROLLING_USE_INTERVAL_TICK / 1000);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"롤링 사용 가능 시간 %d초 안 지났습니다."
					}
					break;

				default :
					break;
			}
			break;


		// 2005-12-06 by ispark, 상대방이 승인 요청시 죽었을 때
		case T_FC_SKILL_CONFIRM_USE :
		
			switch ( pMsg->ErrorCode )
			{
			
				case ERR_INVALID_PEER_CHARACTER :
				case ERR_REQ_WARP_COMPLETIONQUEST_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_051205_0004, COLOR_ERROR); //"상대방이 워프 할 수 없는 상태입니다."

					// 2007-10-22 by bhsohn 타켓형 스킬 오류에 대한 처리
					g_pShuttleChild->m_pSkill->ReleasePrePareSkill();
					break;
			}
			break;

		// 2005-12-06 by ispark, 시킬 사용자가 죽었을 때
		case T_FC_SKILL_CONFIRM_USE_ACK :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_PEER_CHARACTER :
				case ERR_REQ_WARP_COMPLETIONQUEST_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_051206_0002, COLOR_ERROR); //"스킬을 사용 할 수 없는 상태입니다."
					break;
			}
			break;

		// 2005-12-08 by ispark, 귀속말 
		case T_IC_CHAT_PTOP :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_051208_0100, COLOR_ERROR); // "서로 다른 세력이므로 귓말을 사용 할 수 없습니다."
					break;
					
				case ERR_COMMON_NO_SUCH_CHARACTER :

					m_pChat->CreateChatChild(STRERR_ERROR_0145, COLOR_ERROR); // "현재 게임에 접속중이지 않습니다."
					break;
			}
			break;

		// 2005-12-08 by ispark, 퀘스트 완료 요청
		case T_FC_QUEST_REQUEST_SUCCESS :
		
			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_DOING_PARTY_BATTLE :

					m_pChat->CreateChatChild(STRMSG_C_051207_0001, COLOR_ERROR); // "편대상태에서는 세력을 선택할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :
					{
						char ErrorMsgInfluence[256];
						m_pChat->CreateChatChild(STRMSG_C_051208_0104, COLOR_ERROR);	// "한 계정에 하나의 세력만 선택할 수 있습니다."
						wsprintf(ErrorMsgInfluence, STRMSG_C_051220_0100, CAtumSJ::GetInfluenceTypeString(pMsg->ErrParam2));
						m_pChat->CreateChatChild(ErrorMsgInfluence, COLOR_ERROR);		// "이 계정은 %s 세력으로 선택되었습니다."
					}
					break;

				// 2009-04-08 by bhsohn 세력 불균형, 세력 초기화 시스템 추가 수정
				case ERR_CANNOT_CHOOSE_INFLUENCE_TYPE :
				
					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_090408_0104, _MESSAGE);	
					break;
				// end 2009-04-08 by bhsohn 세력 불균형, 세력 초기화 시스템 추가 수정
			}
			break;

		// 2005-12-08 by ispark, 칼라 상점
		case T_FC_SHOP_BUY_COLOR_ITEM :
	
			switch ( pMsg->ErrorCode ) 
			{	
				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :
		
					m_pChat->CreateChatChild(STRMSG_C_051118_0001, COLOR_ERROR); // "레벨이 낮아 구입을 할 수 없습니다."
					break;
				
				case ERR_PROTOCOL_REQ_MAXLEVEL_NOT_MATCHED :
	
					m_pChat->CreateChatChild(STRMSG_C_051118_0001, COLOR_ERROR); // "레벨이 낮아 구입을 할 수 없습니다."
					break;

				case ERR_PROTOCOL_BUILDING_KIND_NOT_MATCHED :
		
					m_pChat->CreateChatChild(STRMSG_C_051208_0106, COLOR_ERROR); // "칼라상점이 아닙니다."
					break;
				
				case ERR_INVALID_ARMOR_ITEM :
		
					m_pChat->CreateChatChild(STRMSG_C_051208_0107, COLOR_ERROR); // "칼라 Item Number 오류입니다."
					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :
					
					m_pChat->CreateChatChild(STRMSG_C_SHOP_0011, COLOR_ERROR); // "아이템을 구입하기 위한 스피가 부족합니다"
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :

					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
			}
			break;

		// 2006-03-28 by ispark, 퀘스트 성공 체크
		case T_FC_QUEST_REQUEST_SUCCESS_CHECK :

			switch ( pMsg->ErrorCode )
			{
	
				case ERR_PROTOCOL_REQ_PARTYMEMBERS_SOMEONE_NOT_COMPLETION :

					// 그냥 흘려 보낸다.
					break;

				default :

					break;
			}
			break;
	
		// 2006-04-10 by ispark, 부활 카드
		case T_FC_ITEM_USE_CARDITEM_RESTORE :

			switch ( pMsg->ErrorCode )
			{
	
				case ERR_FAILURE_USE_RESTORE_ITEM :
			
					m_pChat->CreateChatChild(STRMSG_C_060410_0004, COLOR_ERROR);	// "부활에 실패 하였습니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
			}

			// 2007-10-23 by dgwoo 죽었을 경우에는 T_FC_ITEM_USE_CARDITEM_RESTORE 에러 발생시 SendDeadMsg()를 발생.
			if(g_pShuttleChild->CheckUnitState() == BREAKDOWN)
				g_pShuttleChild->SendDeadMsg();

			break;


		// 2006-05-12 by ispark, 거래시 에러 체크
		case T_FC_TRADE_OK_TRADE :
	
			
			// 여기에 들어가는 코드 몇개는 에러체크에서 한다.
			// ERR_PROTOCOL_MAX_ITEM_COUNTS_OVER
			// ERR_PROTOCOL_NO_SUCH_ITEM
			// ERR_PROTOCOL_INVENTORY_FULL_ITEM
			switch ( pMsg->MsgType )
			{
				case ERR_PROTOCOL_INVALID_ITEM_COUNT :
				
					m_pChat->CreateChatChild(STRMSG_C_060512_0000,COLOR_ERROR);// "아이템 개수 오류입니다."		
					break;

				default :
					break;
			}
			break;

		// 2006-05-12 by ispark, 거래 응답 에러
		case T_FC_TRADE_REQUEST_TRADE :

			switch ( pMsg->ErrorCode )
			{
				case ERR_USING_SHOP :

					m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."	
					break;

				case ERR_USING_BAZAAR :

					m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."	
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현


				// 2008-02-26 by bhsohn 통합 아레나 관련 버그 수정
				case ERR_CANNOT_USE_ARENASERVER :
					{
						char ErrorMsgMissionList[256];

						// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

						//wsprintf(ErrorMsgMissionList, STRMSG_C_080225_0203);
						if( g_pD3dApp->m_ArenaSocketType == CAtumApplication::ARENASOCKET_ARENA )
							wsprintf(ErrorMsgMissionList, STRMSG_C_080225_0203);
						else if( g_pD3dApp->m_ArenaSocketType == CAtumApplication::ARENASOCKET_INFINITY )
							wsprintf(ErrorMsgMissionList, STRMSG_C_091103_0322);

						// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2008-02-26 by bhsohn 통합 아레나 관련 버그 수정
			}
			break;

		// 2006-05-15 by ispark
		case T_FC_STORE_GET_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_ITEM_TRADING :

					m_pChat->CreateChatChild(STRERR_ERROR_0016,COLOR_ERROR);// "이미 거래중입니다."
					break;

				case ERR_NO_SEARCH_CHARACTER :
					// 2006-09-19 by dgwoo
					m_pChat->CreateChatChild(STRMSG_C_060920_0102,COLOR_ERROR);
					break;

				case ERR_NO_MEMBERSHIP_USER :

					m_pChat->CreateChatChild(STRMSG_C_060920_0103,COLOR_ERROR);
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_USE_GUILD_STORE :

					m_pChat->CreateChatChild(STRMSG_C_090925_0401,COLOR_ERROR);	//"필드에서 여단 창고를 이용 할 수 없습니다."	
					break;

				case ERR_CANNOT_USE_FIELD_STORE :
				
					m_pChat->CreateChatChild(STRMSG_C_090925_0402,COLOR_ERROR);	//"필드 창고를 이용 할 수 없습니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
					// 2012-12-11 by bhsohn 아이템 창고 이동 에러 추가
				default :
					{
						m_pChat->CreateChatChild(STRERR_ERROR_0104,COLOR_ERROR);// "창고를 이용 할 수 없습니다."
					}
					break;
				// END 2012-12-11 by bhsohn 아이템 창고 이동 에러 추가
			}
			break;
		
		// 2006-07-31 by ispark, 바자맵
		case T_FC_BAZAAR_SELL_PUT_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER  :

					m_pChat->CreateChatChild(STRMSG_C_060801_0006,COLOR_ERROR);// "판매상점스킬을 사용한 캐릭터가 존재하지 않습니다."
					break;

				case ERR_PROTOCOL_ITEM_CANNOT_TRANSFER :

					m_pChat->CreateChatChild(STRMSG_C_060801_0001,COLOR_ERROR);// "아이템 등록을 실패하였습니다."
					break;
				
				case ERR_PROTOCOL_ITEM_AMOUNT_EXCEED :

					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060802_0005, _MESSAGE);	// "스피의 최대유효개수를 초과하였습니다.(최대유효개수 20억)"
					break;
			}
			break;
				
		case T_FC_BAZAAR_SELL_CANCEL_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER :
			
					m_pChat->CreateChatChild(STRMSG_C_060801_0006,COLOR_ERROR);// "판매상점스킬을 사용한 캐릭터가 존재하지 않습니다."
					break;

				case ERR_PROTOCOL_INVALID_CHARACTER_STATE :

					break;
			}
			break;

		case T_FC_BAZAAR_SELL_START :
			
			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_060801_0006,COLOR_ERROR);// "판매상점스킬을 사용한 캐릭터가 존재하지 않습니다."
					break;

				case ERR_PROTOCOL_INVALID_CHARACTER_STATE :

					break;
			}
			break;

		case T_FC_BAZAAR_SELL_REQUEST_ITEMLIST :

			switch ( pMsg->ErrorCode )
			{
				
				case ERR_INVALID_CHARACTER :
			
					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _MESSAGE);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_INVALID_PEER_CHARACTER :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _MESSAGE);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_INVALID_BAZAAR :

					m_pChat->CreateChatChild(STRERR_ERROR_0034,COLOR_ERROR);				// "유효한 상점이 아닙니다."
					g_pInterface->ReadyCloseBazaarShop(TRUE);								// 상점 종료 체크
					break;
			}
			break;

		case T_FC_BAZAAR_SELL_BUY_ITEM :

			switch ( pMsg->ErrorCode )
			{

				case ERR_INVALID_CHARACTER :

		//			wsprintf(errStr,STRERR_ERROR_0003);
					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _Q_BAZAAR_INVALID_SHOP_END);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_INVALID_PEER_CHARACTER :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _Q_BAZAAR_INVALID_SHOP_END);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRERR_ERROR_0109, _MESSAGE);
					break;
					
				case ERR_PROTOCOL_BAZAAR_NO_SUCH_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0025,COLOR_ERROR);// "해당 아이템이 없습니다."
					g_pInterface->ErrBazaarItemList();
					break;

				case ERR_PROTOCOL_ITEM_AMOUNT_EXCEED :

					break;
					
				case ERR_PROTOCOL_INVENTORY_FULL_ITEM :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRERR_ERROR_0022, _MESSAGE);
					break;
			}
			break;
			
		case T_FC_BAZAAR_BUY_PUT_ITEM :

			switch (pMsg->ErrorCode )
			{
				case ERR_DB_INVALID_PARAMETER :
					break;
					
				case ERR_INVALID_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_060801_0007,COLOR_ERROR);// "구매상점스킬을 사용한 캐릭터가 존재하지 않습니다."
					break;

				case ERR_PROTOCOL_ITEM_CANNOT_TRANSFER :

					m_pChat->CreateChatChild(STRMSG_C_060801_0001,COLOR_ERROR);// "아이템 등록을 실패하였습니다."
					break;

				case ERR_PROTOCOL_ITEM_AMOUNT_EXCEED :

					break;

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0004, _MESSAGE);	// "구매 할 스피가 부족합니다."
					break;
			}
			break;
			
		case T_FC_BAZAAR_BUY_CANCEL_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_060801_0007,COLOR_ERROR);// "구매상점스킬을 사용한 캐릭터가 존재하지 않습니다."
					break;

				case ERR_PROTOCOL_INVALID_CHARACTER_STATE :

					break;
			}
			break;
		
		case T_FC_BAZAAR_BUY_REQUEST_ITEMLIST :

			switch ( pMsg->ErrorCode )
			{

				case ERR_INVALID_CHARACTER :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _MESSAGE);	// "개인상점이 종료 되었습니다."
					break;
					
				case ERR_INVALID_PEER_CHARACTER :
			
					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _MESSAGE);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_INVALID_BAZAAR :

					m_pChat->CreateChatChild(STRERR_ERROR_0034,COLOR_ERROR);				// "유효한 상점이 아닙니다."
					g_pInterface->ReadyCloseBazaarShop(TRUE);								// 상점 종료 체크
					break;
			}
			break;

		case T_FC_BAZAAR_BUY_SELL_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _Q_BAZAAR_INVALID_SHOP_END);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_INVALID_PEER_CHARACTER :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0000, _Q_BAZAAR_INVALID_SHOP_END);	// "개인상점이 종료 되었습니다."
					break;

				case ERR_PROTOCOL_BAZAAR_NO_SUCH_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0025,COLOR_ERROR);// "해당 아이템이 없습니다."
					g_pInterface->ErrBazaarItemList();
					break;

				case ERR_PROTOCOL_ITEM_CANNOT_TRANSFER :

					break;

				case ERR_PROTOCOL_ITEM_AMOUNT_EXCEED :

					break;

				case ERR_PROTOCOL_INVENTORY_FULL_ITEM :

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_060801_0003, _MESSAGE);	// "구매자의 인벤토리가 꽉 차 있습니다."
					break;
			}
			break;

			
		case T_FC_PARTY_REQUEST_INVITE :

			switch ( pMsg->ErrorCode )
			{
				case ERR_USING_BAZAAR :

					m_pChat->CreateChatChild(STRMSG_C_060512_0001,COLOR_ERROR);// "상대방이 상점 이용 중입니다."
					break;

				// 2009-01-12 by bhsohn 일본 추가 수정사항
				case ERR_COMMON_NO_SUCH_CHARACTER :
				
					m_pChat->CreateChatChild(STRMSG_C_090112_0204, COLOR_ERROR);// "상대를 초대할 수 없습니다."
					break;
				// end 2009-01-12 by bhsohn 일본 추가 수정사항
			}
			break;

		// 2006-10-09 by dgwoo 길드 로그 추가.
		case T_FC_STORE_LOG_GUILD_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_NO_MEMBERSHIP_USER :

					m_pChat->CreateChatChild(STRMSG_C_060920_0103,COLOR_ERROR);
					break;

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_USE_GUILD_STORE :

					m_pChat->CreateChatChild(STRMSG_C_090925_0401,COLOR_ERROR);	//"필드에서 여단 창고를 이용 할 수 없습니다."	
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이
			}
			break;
			
		// 2006-10-12 by ispark, 보조스킬아이템
		case T_FC_ITEM_USE_SKILL_SUPPORT_ITEM :

			switch ( pMsg->ErrorCode )	
			{
				case ERR_PROTOCOL_ALREADY_USE_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0060,COLOR_ERROR);// "사용하려는 아이템이 이미 사용 중입니다."
					break;

				case ERR_PROTOCOL_ALREADY_USE_OTHER_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0061,COLOR_ERROR);// "사용하려는 아이템과 같은 종류의 아이템이 이미 사용 중입니다."
					break;
			
				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
			}
			break;
		
		case T_FC_QUEST_REQUEST_PARTY_WARP_ACK :

			switch ( pMsg->ErrorCode )
			{
				case ERR_EXPIRED_ITEM :

					m_pChat->CreateChatChild(STRMSG_C_061016_0001,COLOR_ERROR);// "시간 초과로 워프 할 수 없습니다."
					break;

				default :
	
					m_pChat->CreateChatChild(STRERR_ERROR_0108,COLOR_ERROR,CHAT_TAB_SYSTEM);// "워프를 할 수 없습니다."
					break;
			}
			break;

		// 2006-10-19 by ispark, 멘트
		case T_FIELD_IOCP :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_061019_0000,COLOR_ERROR);// "레?이 30 이상이 되어야 멘트를 사용 할 수 있습니다."
					break;

				default :

					break;
			}
			break;

		// 2006-11-20 by dgwoo, 이벤트 맵으로 이동시 인원 초과로 워프가 안될때 
		case T_FC_EVENT_CALL_WARP_EVENT_REQUEST_ACK :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_CHANNEL_USER_OVERFLOW :
			
					m_pChat->CreateChatChild(STRMSG_C_061120_0100,COLOR_ERROR);
					break;

				default :
					break;
			}
			break;

		case T_FC_CHARACTER_OBSERVER_START :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_PEER_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_070403_0100,COLOR_ERROR);
					break;

				default :
					break;
			}
			break;

		case T_FC_CONNECT_LOGIN :

			
			switch ( pMsg->ErrorCode )
			{
				case ERR_JAMBOREE_NO_SUCH_CHARACTER :

					NetworkErrorMsgBox(STRMSG_C_070409_0100);	// "대회 신청자만 입장할 수 있습니다."
					break;

				default :

					break;
			}
			break;

		case T_FC_ARENA_REQUEST_TEAM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_ARENA_NO_SUCH_TEAM :
					{
						CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
						pCityArena->m_nSelectIndex = -1;
						pCityArena->m_vecTeamList.clear();
						m_pChat->CreateChatChild(STRMSG_C_070509_0101,COLOR_ERROR); //"현재 대기중인 팀이 없습니다."
					}
					break;

				default :
					break;
			}
			break;
			
		case T_FC_ARENA_CREATE_TEAM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_ARENA_CREATE_TEAM :

					m_pChat->CreateChatChild(STRMSG_C_070509_0102,COLOR_ERROR);	//"팀 생성에 실패하였습니다. 잠시 후 다시 시도하세요."
					break;
				
				case ERR_ARENA_STATE :
					break;

				case ERR_PROTOCOL_QUEST_IS_IN_PROGRESS :

					m_pChat->CreateChatChild(STRMSG_C_070427_0103,COLOR_ERROR);	//"미션이 진행 중이므로 참가할 수 없습니다."
					break;
				
				case ERR_INVALID_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_070427_0102,COLOR_ERROR);	//"세력을 선택하지 않아 참가할 수 없습니다."
					break;

				case ERR_REQ_CHOOSE_INFLUENCE_TYPE :
				
					m_pChat->CreateChatChild(STRMSG_C_070427_0102,COLOR_ERROR); //"세력을 선택하지 않아 참가할 수 없습니다."
					break;

				case ERR_PROTOCOL_INVALID_ITEM_WINDOW_POSITION :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0105,COLOR_ERROR); //"지도자의 광휘를 해제해야 합니다."
					break;

				case ERR_BOSS_STRATEGYPOINT_STATE_SUMMON :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0104,COLOR_ERROR); //"세력전이 진행 중이므로 참가할 수 없습니다."
		
				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				case ERR_INFINITY_STATE :
					{
						_asm nop
					}
					break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
			}
			break;

		case T_FC_ARENA_ENTER_TEAM :

			switch ( pMsg->ErrorCode )
			{

				case ERR_ARENA_NOT_MATCH_PW :
					
					m_pChat->CreateChatChild(STRMSG_C_070430_0101,COLOR_ERROR);	//"비밀번호가 틀립니다."
					break;

				case ERR_ARENA_FULL_TEAMLIST :
					
					m_pChat->CreateChatChild(STRMSG_C_070509_0103,COLOR_ERROR);	//"정원이 초과되었습니다."
					break;

				case ERR_PROTOCOL_QUEST_IS_IN_PROGRESS :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0103,COLOR_ERROR);	//"미션이 진행 중이므로 참가할 수 없습니다."
					break;

				case ERR_REQ_CHOOSE_INFLUENCE_TYPE :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0102,COLOR_ERROR);	//"세력을 선택하지 않아 참가할 수 없습니다."
					break;

				case ERR_BOSS_STRATEGYPOINT_STATE_SUMMON :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0104,COLOR_ERROR); //"세력전이 진행 중이므로 참가할 수 없습니다."
					break;

				case ERR_PROTOCOL_INVALID_ITEM_WINDOW_POSITION :
					
					m_pChat->CreateChatChild(STRMSG_C_070427_0105,COLOR_ERROR); //"지도자의 광휘를 해제해야 합니다."
					break;

				// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
				case ERR_INFINITY_STATE :
					{
						_asm nop
					}
					break;
				// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
			}
			break;

		case T_FC_ARENA_REQUEST_OTHER_TEAM_INFO :

			switch ( pMsg->ErrorCode )
			{
	
				case ERR_ARENA_NO_SUCH_TEAM :

					m_pChat->CreateChatChild(STRMSG_C_070525_0101,COLOR_ERROR); //"현재 대기중인 상대팀이 없습니다."
					break;

				default :
					break;
			}
			break;
			
		case T_FC_ARENA_TEAM_READY_FINISH :

			switch ( pMsg->ErrorCode )
			{

				case ERR_BOSS_STRATEGYPOINT_STATE_SUMMON :

					m_pChat->CreateChatChild(STRMSG_C_070427_0104,COLOR_ERROR); //"세력전이 진행 중이므로 참가할 수 없습니다."
					break;
					
				// 2007-07-11 by bhsohn 아레나 금지 관련 처리
				case ERR_ARENA_BLOCKED :
					{			
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070710_0201, pMsg->ErrParam1);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"롤링 사용 가능 시간 %d초 안 지났습니다."
					}
					break;
			}
			break;
			
		case T_FC_ARENA_QUICK_ENTER_TEAM :

			switch ( pMsg->ErrorCode )
			{

				case ERR_ARENA_NO_SUCH_TEAM :

					m_pChat->CreateChatChild(STRMSG_C_070525_0101,COLOR_ERROR); //"현재 대기중인 상대팀이 없습니다."
					break;

				default :

					break;
			}
			break;

		case T_FC_ITEM_THROW_AWAY_ITEM :

			switch ( pMsg->ErrorCode )
			{
				
				// 2007-06-20 by dgwoo 
				case ERR_PROTOCOL_ITEM_CANNOT_TRANSFER :

					m_pChat->CreateChatChild(STRMSG_C_ITEM_0008, COLOR_ERROR);  //"장착된 아이템은 버릴 수 없습니다."
					break;

				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
				
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
			}
			break;

		case T_FC_SHOP_BUY_WARPOINT_ITEM :

			switch ( pMsg->ErrorCode )
			{

				case ERR_PROTOCOL_NOT_ENOUGH_MONEY :

					m_pChat->CreateChatChild(STRMSG_C_070622_0100,COLOR_ERROR);  //"전쟁 포인트가 부족합니다."
					break;
				
				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 

				// 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
				case ERR_CANNOT_BUY_ITEM :

					m_pChat->CreateChatChild(STRERR_ERROR_0110,COLOR_ERROR);		// "아이템을 구입 할 수 없습니다."
					break;
				//end 2009. 09. 24 by jskim 필드 창고 캐쉬 아이템
			}
			break;

		
		// 2007-07-11 by bhsohn 아레나 금지 관련 처리
		case T_FC_EVENT_CHARACTERMODE_ENTER_BUILDING :

			switch ( pMsg->ErrorCode ) 
			{
				case ERR_ARENA_BLOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070710_0201, pMsg->ErrParam1);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\r 아레나 이용 금지 상태입니다.(남은시간 : %d분)"	

					}
					break;
		
				// 2007-09-12 by bhsohn 2차 암호 시스템 구현
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}
					break;
				// end 2007-09-12 by bhsohn 2차 암호 시스템 구현

				// 2008-03-07 by bhsohn 세력전시, 아레나 이용 못하게 변경
		
				case ERR_NOT_CONNECT_TO_ARENASERVER :
				//case ERR_NOT_CONNECT_TO_ARENASERVER :
					{
						// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

						//m_pChat->CreateChatChild(STRMSG_C_080225_0204,COLOR_ERROR);//"아레나에서는 이용할 수 없습니다."

						if( m_ArenaSocketType == ARENASOCKET_ARENA || m_ArenaSocketType == ARENASOCKET_NONE)	// 2014-03-10 by ssjung 아레나 서버가 없을 때 에러메시지 추가 
							m_pChat->CreateChatChild(STRMSG_C_080225_0204,COLOR_ERROR);//"아레나를 이용할 수 없습니다."
						else if( m_ArenaSocketType == ARENASOCKET_INFINITY )
							m_pChat->CreateChatChild(STRMSG_C_091103_0335,COLOR_ERROR);//"인피니티 필드를 이용할 수 없습니다."
						// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
					}
					break;

				// end 2008-03-07 by bhsohn 세력전시, 아레나 이용 못하게 변경
			}
			break;

		// 2007-08-29 by bhsohn 바자 상점 용도 회의룸으로 변경
		case T_FC_INFO_EXPEDIENCYFUND_PAYBACK :

			switch ( pMsg->ErrorCode )
			{
				case ERR_OVER_COUNT :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070910_0207);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\r수령 가능한 SPI가 부족합니다.\\r"
					}
					break;

				default :
					break;

			}
			break;
		// end 2007-08-29 by bhsohn 바자 상점 용도 회의룸으로 변경

		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
		case T_FC_INFO_SECONDARYPASSWORD_CHECK_PASSWORD :
			{
				// UnLock
				EnterLock(TRUE);

				switch ( pMsg->ErrorCode )
				{
					case ERR_SECPASS_PASSWORD_NOT_MATCHED :
						{			
							wsprintf(szBuf,STRMSG_C_070917_0203);
							m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y비밀번호가 잘못되었습니다."
							FieldSocketInfoSecondarypasswordCheckPassword(FALSE);
						}		
						break;

					case ERR_SECPASS_NOT_USE_SYSTEM :
						{
							wsprintf(szBuf,STRMSG_C_070917_0208);
							m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y보안 시스템을 지원하지 사용하지 않습니다."			
						}
						break;
					
					case ERR_SECPASS_PASSWORD_NOT_SETTING :
						{
							wsprintf(szBuf,STRMSG_C_070917_0204);
							m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y비밀번호를 먼저 설정하셔야 합니다."
						}
						break;
				}
			}
			break;

		case T_FC_INFO_SECONDARYPASSWORD_LOCK :
			{
				// UnLock
				EnterLock(TRUE);

				switch ( pMsg->ErrorCode )
				{	
					case ERR_SECPASS_PASSWORD_NOT_MATCHED :
						
						wsprintf(szBuf,STRMSG_C_070917_0203);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y비밀번호가 잘못되었습니다."
						g_pGameMain->FieldSecondLockOk(FALSE, FALSE);
						break;
						
					case ERR_INVALID_CHARACTER :

						wsprintf(szBuf,STRMSG_C_070917_0209);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y존재 하지 않는 케릭터입니다."
						break;

					case ERR_SECPASS_NOT_USE_SYSTEM :

						wsprintf(szBuf,STRMSG_C_070917_0208);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y보안 시스템을 지원하지 사용하지 않습니다."
						break;

					case ERR_SECPASS_PASSWORD_NOT_SETTING :
				
						wsprintf(szBuf,STRMSG_C_070917_0204);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y비밀번호를 먼저 설정하셔야 합니다."
						break;
							
					case ERR_SECPASS_ALREADY_LOCK :
				
						wsprintf(szBuf,STRMSG_C_070917_0211);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y이미 보안 시스템이 활성화 중입니다."
						break;

					case ERR_SECPASS_ALREADY_UNLOCK :

						wsprintf(szBuf,STRMSG_C_070917_0212);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				//"\\y이미 보안 시스템이 비활성화 중입니다."
						break;
				}

			}
			break;

		case T_FC_INFO_SECONDARYPASSWORD_UPDATE_PASSWORD :
			{
				// UnLock
				EnterLock(TRUE);
				
				switch ( pMsg->ErrorCode )
				{
					case ERR_SECPASS_PASSWORD_NOT_MATCHED :

						wsprintf(szBuf,STRMSG_C_070917_0203);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y보안 비밀번호를 잘못 입력하셨습니다."
						FieldSocketSecondPasswordUpdateOk(FALSE);
						break;
					
					case ERR_INVALID_CHARACTER :

						wsprintf(szBuf,STRMSG_C_070917_0209);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y존재 하지 않는 케릭터입니다."
						break;
					
					case ERR_SECPASS_NOT_USE_SYSTEM :

						wsprintf(szBuf,STRMSG_C_070917_0208);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y보안 시스템을 지원하지 사용하지 않습니다."
						break;

					case ERR_SECPASS_NEW_PASSWORD_NOT_SETTING :

						wsprintf(szBuf,STRMSG_C_070917_0210);
						m_pChat->CreateChatChild(szBuf,COLOR_ERROR);				// "\\y보안 시스템의 비밀번호 설정이 실패하였습니다."
						break;
				}
			}	
			break;

		case T_FC_SHOP_SELL_ITEM :
		case T_FC_ITEM_USE_CARDITEM_GUILDSUMMON :
		case T_FC_ITEM_USE_CARDITEM_CHANGEPILOTFACE :
		case T_FC_ITEM_USE_INFLUENCE_BUFF :
		case T_FC_ITEM_USE_INFLUENCE_GAMEEVENT :
		case T_FC_ITEM_USE_RANDOMBOX :
		case T_FC_TRADE_TRANS_ITEM :
		case T_FC_SKILL_PREPARE_USE :

			switch ( pMsg->ErrorCode )
			{
				case ERR_SECPASS_LOCKED :
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_070917_0213);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y보안 시스템이 활성화 되었습니다."
					}	
					break;


				// 2007-11-22 by dgwoo 캐릭터 변경 카드
				case ERR_DB_INVALID_PARAMETER :
					{
						m_bRequestEnable = TRUE;
						m_pChat->CreateChatChild(STRMSG_C_071122_0100,COLOR_ERROR);   //"자신의 캐릭터와 같은 캐릭터로는 변경이 불가능 합니다."
					}
					break;
				
				// 2008-02-19 by bhsohn 장착한 아이템 팔수 없게 함
				case ERR_PROTOCOL_CANNOT_UNWEAR_ARMOR :

					if ( pMsg->MsgType == T_FC_SHOP_SELL_ITEM )
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_SHOP_0010);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //""장착된 아이템은 팔 수 없습니다."
					}			
					break;
				// end 2008-02-19 by bhsohn 장착한 아이템 팔수 없게 함

				// 2008-05-20 by bhsohn 지도자 아이템 2번 사용시, 오류 메시지 추가
				case ERR_DOING_GAMEEVENT :
				
					if ( pMsg->MsgType == T_FC_ITEM_USE_INFLUENCE_GAMEEVENT )
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_080520_0200);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y<세력이벤트>아이템이 발동 중이므로 사용 할 수 없습니다. "
					}
					break;
				// end 2008-05-20 by bhsohn 지도자 아이템 2번 사용시, 오류 메시지 추가

				// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
				case ERR_INTERVAL_SYSTEM_SECOND :
				
					break;
				// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 

				// 2008-11-21 by bhsohn 거래 완료 시스템 처리
				case ERR_CANNOT_PUT_ITEM :

					if ( pMsg->MsgType == T_FC_TRADE_TRANS_ITEM )
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_081121_0200);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); //"\\y<세력이벤트>아이템이 발동 중이므로 사용 할 수 없습니다. "
					}			
					break;
				// end 2008-11-21 by bhsohn 거래 완료 시스템 처리

				// 2008-01-05 by bhsohn 미션 보상 수정안
				case ERR_PROTOCOL_NO_SUCH_PARTY :

					if ( pMsg->MsgType == T_FC_ITEM_USE_INFLUENCE_BUFF)
					{
						char ErrorMsgMissionList[256];
						wsprintf(ErrorMsgMissionList, STRMSG_C_090105_0200);
						m_pChat->CreateChatChild(ErrorMsgMissionList, COLOR_ERROR); // "\\y편대에 가입해야지만 사용 할 수 있는 아이템 입니다."
					}
					break;
				// end 2008-01-05 by bhsohn 미션 보상 수정안
		
				// 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리
				case ERR_PROTOCOL_ALREADY_HAVE_ITEM :
					
					g_pGameMain->m_pInfWindow->AddMsgBox( STRMSG_C_091008_0302, _Q_ALREADY_HAVE_ITEM );	// "같은 종류 아이템의 사용기간이 만료 되지 않아 아이템을 사용할 수 없습니다. 사용기간이 만료된 후 사용해 주세요."
					break;
				// end 2009. 10. 08 by ckPark 필드 창고 아이템 중복 불가 처리

				// 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
				case ERR_ALREADY_USE_ITEMPARAM :
					
					m_pChat->CreateChatChild( STRMSG_C_100118_0301, COLOR_ERROR );
					break;
				// end 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리

				// 2010. 02. 10 by ckPark 랜덤박스아이템에 레벨 제한 추가, 킬마크 레벨제한툴팁 삭제
				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild( STRERR_ERROR_0048, COLOR_ERROR );		// "유닛의 레벨이 사용 가능한 최소 레벨 보다 작습니다."
					break;

				case ERR_PROTOCOL_REQ_MAXLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild( STRERR_ERROR_0049, COLOR_ERROR );		// "유닛의 레벨이 사용 가능한 최대 레벨 보다 큽니다."
					break;
				// end 2010. 02. 10 by ckPark 랜덤박스아이템에 레벨 제한 추가, 킬마크 레벨제한툴팁 삭제
					
				// 2013-11-26 by ymjoo 맴버쉽 추가 Error 스트링 출력
				case ERR_CASH_PREMIUM_CARD_NOT_YET_BUY_STATE :
					
					m_pChat->CreateChatChild( STRMSG_C_050603_0003, COLOR_ERROR );	//"더이상 멤버쉽 서비스 카드를 구입 할 수 없습니다."
					break;
				// end 2013-11-26 by ymjoo 맴버쉽 추가 Error 스트링 출력

				// 2014-09-18 by ymjoo 인피니티에서 랜덤박스 개봉불가
				case ERR_PROTOCOL_INVALID_ITEM_KIND :
					if(T_FC_ITEM_USE_RANDOMBOX == pMsg->MsgType)
					{
						m_pChat->CreateChatChild(STRMSG_C_100618_0406, COLOR_ERROR);	// "해당 아이템은 인피니티 필드내에서 사용이 불가능 합니다."
					}
					break;
				// END 2014-09-18 by ymjoo 인피니티에서 랜덤박스 개봉불가
			}
			break;
	// end 2007-09-12 by bhsohn 2차 암호 시스템 구현
	
		// 2007-10-12 by dgwoo 부지도자 선출 에러 메시지.
		case T_FC_CHARACTER_UPDATE_SUBLEADER_OK :
		
			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_SUBLEADER_SET_FAIL :

					wsprintf(szBuf,STRMSG_C_071012_0102);
					m_pChat->CreateChatChild(szBuf,COLOR_ERROR);					//"직위를 부여할 수 없는 대상입니다."
					break;

				case ERR_PROTOCOL_SUBLEADER_SET_ALEADY :

					wsprintf(szBuf,STRMSG_C_071012_0101);
					m_pChat->CreateChatChild(szBuf,COLOR_ERROR);					//"이미 직위를 부여받은 대상입니다."
					break;
			}
			break;
	
		case T_FC_CITY_POLL_REG_LEADER_CANDIDATE :
		
	//		if(pMsg->ErrorCode == ERR_FAIL_REG_LEADER_CANDIDATE_BY_REQ)	
			switch ( pMsg->ErrorCode )
			{
				case ERR_REQ_NOT_POLLDATE_APPLICATION :
					
					m_pChat->CreateChatChild(STRMSG_C_071108_0101,COLOR_ERROR);		//"후보 등록 기간이 아닙니다.선거일정을 참조 하세요."
					break;
					
				default :

					wsprintf(szBuf,STRMSG_C_071029_0104);							//"후보 등록 조건이 맞지 않습니다."
					m_pChat->CreateChatChild(szBuf,COLOR_ERROR);
					break;
			}
			break;

		case T_FC_CITY_POLL_VOTE :
			
			switch ( pMsg->ErrorCode )
			{
				case ERR_ALREADY_VOTE :

					m_pChat->CreateChatChild(STRMSG_C_071029_0106,COLOR_ERROR);		//"이미 투표에 참여하셨습니다."
					break;

				case ERR_REQ_NOT_VOTE :

					m_pChat->CreateChatChild(STRMSG_C_071029_0107,COLOR_ERROR);		//"투표권이 없으므로 투표에 참여할 수 없습니다."
					break;

				case ERR_REQ_NOT_POLLDATE_VOTE :

					m_pChat->CreateChatChild(STRMSG_C_071029_0102,COLOR_ERROR);		//"선거 기간이 아닙니다. 선거 일정을 참조하세요."
					break;
			}
			break;
			
		case T_FC_CITY_POLL_DELETE_LEADER_CANDIDATE :

			switch ( pMsg->ErrorCode )
			{
				case ERR_REQ_NOT_POLLDATE_APPLICATION :

					m_pChat->CreateChatChild(STRMSG_C_071108_0100,COLOR_ERROR);		//"후보 탈퇴는 후보 신청기간에 가능합니다."
					break;

				case ERR_ALREADY_DELETE_LEADER_CANDIDATE :

					m_pChat->CreateChatChild(STRMSG_C_071106_0100,COLOR_ERROR);		//"이미 탈퇴처리 되었습니다."
					break;
			}
			break;

		case T_FC_GUILD_DISMEMBER :

			switch ( pMsg->ErrorCode )
			{

			// 2009. 06. 30 by ckPark 전진기지 점령중이거나 각인중인 여단 해제 불가
	// 		if(pMsg->ErrorCode == ERR_WARING_OUTPOST_TO_OWNMAP)
	// 		{
	// 			m_pChat->CreateChatChild(STRMSG_C_071112_0100,COLOR_ERROR);		//"전진기지전 진행 중 소유 여단은 해체 할 수 없습니다."
	// 		}

				case ERR_WARING_OUTPOST_TO_OWNMAP :

					m_pChat->CreateChatChild(STRMSG_C_090630_0301,COLOR_ERROR);		//"전진기지전 진행 중 소유 여단은 해체 할 수 없습니다."
					break;
				
				case ERR_POSSESS_OUTPOST :
		
					m_pChat->CreateChatChild(STRMSG_C_090630_0301,COLOR_ERROR);		//"전진기지전 진행 중 소유 여단은 해체 할 수 없습니다."
					break;

				// 2014-03-04 by ymjoo 입후보자, 지도자, 전진기지 여단장 여단 해체 안되는 스트링 추가
				case ERR_CANNOT_USE_NEW_COMMANDER_BY_POLL :
					
					m_pChat->CreateChatChild(STRMSG_C_140210_0001,COLOR_ERROR);// "입후보자는 여단을 해체하거나 위임할 수 없습니다."
					break;
					
				case ERR_CANNOT_USE_NEW_COMMANDER_BY_CITYLEADER :
					
					m_pChat->CreateChatChild(STRMSG_C_140210_0002,COLOR_ERROR);// "지도자나 전진기지 여단장은 여단을 해체하거나 위임할 수 없습니다."
					break;
				// END 2014-03-04 by ymjoo 입후보자, 지도자, 전진기지 여단장 여단 해체 안되는 스트링 추가
			}
			break;
			// end 2009. 06. 30 by ckPark 전진기지 점령중이거나 각인중인 여단 해제 불가

		// 2007-11-15 by dgwoo 선물하려는 캐릭터 오류.
		case T_FC_SHOP_CHECK_GIVE_TARGET :

			switch ( pMsg->ErrorCode )
			{
				case ERR_DB_EXECUTION_FAILED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0045,COLOR_ERROR);
					break;

				case ERR_INVALID_PEER_CHARACTER :

					m_pChat->CreateChatChild(STRMSG_C_071115_0102,COLOR_ERROR);
					break;

				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_071115_0103,COLOR_ERROR);
					break;

				// 2008-12-09 by dgwoo 존재하지 않는 캐릭터일경우의 에러처리.
				case ERR_PROTOCOL_EMPTY_CHARACTERNAME :

					m_pChat->CreateChatChild(STRMSG_C_071115_0102,COLOR_ERROR);
					break;

				// 2009-03-27 by bhsohn 자신에게 선물하기 시, 에러 스트링 추가
				case ERR_COMMON_NOT_ALLOWED_TO_MYSELF :

					m_pChat->CreateChatChild(STRMSG_C_090324_0202,COLOR_ERROR);
					break;
				// end 2009-03-27 by bhsohn 자신에게 선물하기 시, 에러 스트링 추가
			}
			break;
	
	// 2007-11-20 by dgwoo 에러 코드 추가.
		case T_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST :
	
			switch ( pMsg->ErrorCode )
			{
				case ERR_REQ_NOT_POLLDATE_ALL_RANGE :

					m_pChat->CreateChatChild(STRMSG_C_071029_0102,COLOR_ERROR);		//"선거 기간이 아닙니다. 선거 일정을 참조하세요."
					break;

				default :
					break;
			}
			break;

		case T_FC_EVENT_COUPON_EVENT_USE_COUPON :

			switch ( pMsg->ErrorCode )
			{
				case ERR_DB_EXECUTION_FAILED :
				case ERR_DB_INVALID_PARAMETER :

					g_pGameMain->AddMsgBox(STRERR_ERROR_0036,_Q_COUPON);
					break;
				
				default :

					g_pGameMain->AddMsgBox(STRMSG_C_080115_0101,_Q_COUPON);
					break;
			}
			break;

	// 2007-11-22 by bhsohn 아레나 통합서버
		case T_FC_CONNECT_ARENASERVER_LOGIN :

			switch ( pMsg->ErrorCode )
			{

				// 아레나 서버에 로그인 실패
				case ERR_COMMON_NO_SUCH_CHARACTER :
				case ERR_INVALID_ARENASERVER :
				case ERR_NO_SUCH_FIELDSERVER :

					// 아레나 실패
					CloseArenaSocket();

					m_pChat->CreateChatChild(STRMSG_C_080129_0202,COLOR_ERROR);		// "아레나 서버와의 접속이 끊겼습니다."

					g_pGameMain->m_pInfWindow->AddMsgBox(STRMSG_C_080129_0201, _MESSAGE);

					// 현재 창을 닫는다.
					g_pInterface->m_pCityBase->CloseCurrentEnterBuilding();
					break;
			}
			break;

		case T_FC_ARENA_CHARACTER_GAMESTART :

			NetworkErrorMsgBox(STRMSG_C_080129_0201);	// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			break;

		case T_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER :

			NetworkErrorMsgBox(STRMSG_C_080129_0201);	// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
			break;		
	// end 2007-11-22 by bhsohn 아레나 통합서버

		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
		case T_FC_CHAT_LETTER_SEND :

			switch ( pMsg->ErrorCode )
			{
				case ERR_FRIEND_INVALID_CHARACTER_NAME :
					{
						char buf[256];
						wsprintf(buf, STRMSG_C_080513_0204);//"\\y받는 사람이 잘못되었습니다. 다시 입력하세요."
						m_pChat->CreateChatChild(buf,COLOR_ERROR);
					}
					break;

				case ERR_FRIEND_REGISTERED_PEER_REJECTLIST :
					{
						// 2008-07-03 by bhsohn EP3 버그 리포트 수정
						char buf[256];
						//wsprintf(buf, STRERR_ERROR_0139);// "상대방의 거부목록에 등록되어 있습니다."
						wsprintf(buf, STRMSG_C_080703_0201);// "거부 목록에 등록된 대상입니다."
						// end 2008-07-03 by bhsohn EP3 버그 리포트 수정
						
						m_pChat->CreateChatChild(buf, COLOR_ERROR);
					}
					break;

				// 2008-07-03 by bhsohn EP3 버그 리포트 수정
				case ERR_DB_EXECUTION_FAILED :
					{
						char buf[256];
						wsprintf(buf, STRERR_ERROR_0123);// "캐릭터명이 유효하지 않습니다."
						m_pChat->CreateChatChild(buf, COLOR_ERROR);
					}
					break;
				// end 2008-07-03 by bhsohn EP3 버그 리포트 수정

				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :
					{
						char buf[256];
						wsprintf(buf, STRMSG_C_080716_0200);// "서로 다른 세력이므로 편지를 보낼 수 없습니다."
						m_pChat->CreateChatChild(buf, COLOR_ERROR);
					}
					break;
			}
			break;
	// end 2008-04-04 by bhsohn Ep3 커뮤니티 창

		// 2008-12-22 by dgwoo 미션 마스터가 아무도없을경우 에러 메시지.
		case T_FC_QUEST_REQUEST_MISSIONMASTER_HELP :
	
			switch ( pMsg->ErrorCode )
			{
				case ERR_NO_SEARCH_CHARACTER :
					{
						char buf[256];
						wsprintf(buf,STRMSG_C_081222_0100);//"도움을 요청할 미션 마스터가 존재 하지 않습니다."
						m_pChat->CreateChatChild(buf,COLOR_ERROR);
					}
					break;

				default :
					break;
			}
			break;
		// 2008-12-22 by dgwoo 미션 마스터가 아무도없을경우 에러 메시지.

		// 2009. 01. 12 by ckPark 선전 포고 시스템
		case T_FC_INFO_DECLARATION_MSWAR_SET :
			{
				g_pD3dApp->EnterLock(TRUE);

				switch ( pMsg->ErrorCode )
				{
					case ERR_NO_SUCH_DECLARATION_MSWAR_INFO :

						m_pChat->CreateChatChild(STRMSG_C_090113_0323, COLOR_ERROR);// "\\y선전포고 정보를 찾을 수 없습니다.\\y"
						break;

					case ERR_NO_MORE_DECLARATION_MSWAR_SET :

						m_pChat->CreateChatChild(STRMSG_C_090113_0324, COLOR_ERROR);// "\\y더 이상 선전포고를 할 수 없습니다.\\y"
						break;

					case ERR_INVALID_DECLARATION_MSWAR_TIME :
							
						m_pChat->CreateChatChild(STRMSG_C_090113_0325, COLOR_ERROR);// "\\y선전포고 시간이 잘못 입력되었습니다. 입력형식이 잘못되었거나, 현재 시간으로부터 12시간 이내는 선전포고를 할 수 없습니다.\\y"
						break;
				}
			}
			break;
		// end 2009. 01. 12 by ckPark 선전 포고 시스템

		// 2009-03-04 by bhsohn 럭키 머신 수정안
		case T_FC_ITEM_USE_LUCKY_ITEM :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_NO_SUCH_SHOP_ITEM :
					{
						CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);			
						if ( pStore )
						{
							pStore->ResetLuckyMachineInfo();
						}	
					}
					break;

				// 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
				case ERR_ALREADY_USE_ITEMPARAM :
				
					m_pChat->CreateChatChild( STRMSG_C_100118_0301, COLOR_ERROR );
					break;
				// end 2010. 01. 18 by ckPark 양립할 수 없는 아이템 파라메터 처리
			}
			break;
		// end 2009-03-04 by bhsohn 럭키 머신 수정안

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		case T_FC_INFINITY_MODE_LIST :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INFINITY_NO_SUCH_MODE_LIST :

					FieldSocketInfinityModeListOK( NULL );
					break;

				default :
					break;
			}
			break;

		case T_FC_INFINITY_READY_LIST :

			switch ( pMsg->ErrorCode ) 
			{ 
				case ERR_INFINITY_NO_SUCH_READY_LIST :

					FieldSocketInfinityReadyListOK( NULL );
					break;

				default :
					break;
			}
			break;

		case T_FC_INFINITY_CREATE :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_CREATE_FAIL )
					_asm nop

				if( pMsg->ErrorCode	== ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_BAN :
			{
				if( pMsg->ErrorCode == ERR_INVALID_PEER_CHARACTER )
					_asm nop

				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;
		
		case T_FC_INFINITY_JOIN :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_JOIN_FAIL_SOCKET )
					_asm nop

				if( pMsg->ErrorCode == ERR_INFINITY_MAX_ADMISSIONCNT )
				{
					// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		// 			CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
		// 			if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		// 			{
		// 				((CINFCityInfinityField*)((*it).second))->SetRoomJoinWait( FALSE );
		// 
		// 				GetInfinityManager()->ClearMyRoomInfo();
		// 			}

					if( m_pInterface && m_pInterface->m_pInfinityPopup )
					{
						m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );

						GetInfinityManager()->ClearMyRoomInfo();
					}
					// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

					m_pChat->CreateChatChild( STRMSG_C_091103_0318, COLOR_SYSTEM );	// "\\y인원이 가득 차 있으므로 입장 할 수 없습니다.\\y"
				}

				if( pMsg->ErrorCode == ERR_INFINITY_MISMATCH_LEVEL )
				{
					// 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력 
					//_asm nop
					if( m_pInterface && m_pInterface->m_pInfinityPopup )
					{
						m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );
						GetInfinityManager()->ClearMyRoomInfo();
					}
					m_pChat->CreateChatChild ( STRMSG_C_101201_0402 , COLOR_ERROR );	//\\y레벨 제한으로 방생성 및 입장이 불가능합니다.\\y"
					// end 2010. 12. 01 by jskim 인피방 생성 또는 입장시 메시지 출력 
				}

				if( pMsg->ErrorCode == ERR_INFINITY_JOIN_FAIL_ENTRANCECOUNT )
					_asm nop

				if( pMsg->ErrorCode	== ERR_INFINITY_CREATEUID )
					_asm nop

				if( pMsg->ErrorCode	== ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_JOIN_REQUEST_MASTERUSER_OK :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop

				if( pMsg->ErrorCode == ERR_INFINITY_JOIN_FAIL_MASTERUSER_REJECT )
				{
					// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		// 			CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
		// 			if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		// 			{
		// 				((CINFCityInfinityField*)((*it).second))->SetRoomJoinWait( FALSE );
		// 
		// 				GetInfinityManager()->ClearMyRoomInfo();
		// 			}
					
					if( m_pInterface && m_pInterface->m_pInfinityPopup )
					{
						m_pInterface->m_pInfinityPopup->SetRoomJoinWait( FALSE );

						GetInfinityManager()->ClearMyRoomInfo();
					}
					// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
				}
			}
			break;

		case T_FC_INFINITY_MEMBER_INFO_LIST :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_CHANGE_MASTER :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_LEAVE :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_READY :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;
		
		case T_FC_INFINITY_START :
			{
				// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		// 		CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
		// 		if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
		// 			((CINFCityInfinityField*)((*it).second))->SetStartEnable( TRUE );

				if( m_pInterface && m_pInterface->m_pInfinityPopup )
					m_pInterface->m_pInfinityPopup->SetStartEnable( TRUE );

				if( pMsg->ErrorCode == ERR_INFINITY_CANNOT_ALL_START )
					m_pChat->CreateChatChild( STRMSG_C_100310_0310, COLOR_SYSTEM );	// "인피니티 필드로 입장이 불가능한 멤버가 있습니다."
				// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

				// 2010. 03. 29 by ckPark 인피니티 파티원이 레디를 하지 않은 상태에서 시작버튼을 눌렀을 때 버그 수정
				if( pMsg->ErrorCode == ERR_INFINITY_NOT_ALL_READY )
					m_pChat->CreateChatChild( STRMSG_C_100831_0004 , COLOR_SYSTEM ); // "모든 파티원이 '준비'상태일 때 진입 가능합니다."
					/*_asm nop*/
				// end 2010. 03. 29 by ckPark 인피니티 파티원이 레디를 하지 않은 상태에서 시작버튼을 눌렀을 때 버그 수정

				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					m_pChat->CreateChatChild( STRMSG_C_091103_0320, COLOR_SYSTEM );

				if( pMsg->ErrorCode == ERR_INFINITY_MIN_ADMISSIONCNT )
				{
					char szTemp[256];
					sprintf( szTemp, STRMSG_C_091103_0346, GetInfinityManager()->GetMyRoomInfo()->ModeInfo.MinMemberCount );
					m_pChat->CreateChatChild( szTemp, COLOR_SYSTEM );	// "\\y최소 %d인 이상일 때 인피니티 필드를 시작 할 수 있습니다.\\y"
				}
			}
			break;

		case T_FC_INFINITY_MAP_LOADED :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_FIN_OK :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_TENDER_PUT_IN_TENDER :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_INFINITY_RESTART_BY_DISCONNECT :
			{
				// Restart 실패
				if( pMsg->ErrorCode == ERR_INFINITY_CANNOT_SUCH_TEAM )
					m_bInfinityRestart	= FALSE;
			}	
			break;

		case T_FC_INFINITY_MAP_LOADED_RESTART_BY_DISCONNECT :
			{
				if( pMsg->ErrorCode == ERR_INFINITY_STATE )
					_asm nop
			}
			break;

		case T_FC_SHOP_INFINITY_BUY_ITEM :
			{
 				if( pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_MONEY )
 					m_pChat->CreateChatChild( STRMSG_C_091103_0324, COLOR_ERROR );	// "아이템을 구매 하기 위해 필요한 아이템이 부족합니다."
			}
			break;
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

		default :
			{
		#ifdef _DEBUG
				char strError[512];
		// // 2006-12-19 by dgwoo, wsprintf(strError,STRERR_ERROR_0126,pMsg->MsgType,pMsg->ErrorCode);// "F_DBG용 미확인 에러메시지 : MsgType(0X%X), ErrorCode(0X%X)"
				wsprintf(strError, "F_DBG Unknown Error message !!, ProtocolType(%s:0x%X), ErrorCode(0x%X)"
					, GetProtocolTypeString(pMsg->MsgType), pMsg->MsgType, pMsg->ErrorCode);// "F_DBG용 미확인 에러메시지 : MsgType(0X%X), ErrorCode(0X%X)"
				m_pChat->CreateChatChild(strError,COLOR_ERROR);
		#endif
			}
			break;
	}

	return FALSE;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketErrorByErrorCode(MSG_ERROR* pMsg)
/// \brief		ErrorCode로 에러 검색 우선
/// \author		jschoi
/// \date		2005-03-18 ~ 2005-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IMSocketErrorByErrorCode(MSG_ERROR* pMsg)
{
//	char errStr[512];

	if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_ENOUGH_PARTY_MEMBER)
	{// 길드를 만들기 위한 최소한 파티원 수가 부족함
		m_pChat->CreateChatChild(STRERR_ERROR_0127,COLOR_ERROR);// "여단을 만들기 위한 최소한의 편대원 수가 부족합니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_GUILD_NAME_ALREADY_EXISTS)
	{// 같은 이름의 길드가 존재함
		m_pChat->CreateChatChild(STRERR_ERROR_0128,COLOR_ERROR);// "같은 이름의 여단이 존재합니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_GUILD_MEMBER_ALREADY_EXISTS)
	{// 이미 가입했음
		m_pChat->CreateChatChild(STRERR_ERROR_0129,COLOR_ERROR);// "이미 여단에 가입되어 있습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_GUILD_PERMISSION_DENIED)
	{// 권한이 없음
		m_pChat->CreateChatChild(STRERR_ERROR_0130,COLOR_ERROR);// "권한이 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_HAVE_GUILD)
	{// 길드에 가입하지 않았음
		m_pChat->CreateChatChild(STRERR_ERROR_0131,COLOR_ERROR);// "여단에 가입되지 않았습니다."
	}
	else if(pMsg->ErrorCode ==  ERR_PROTOCOL_GUILD_NOT_MATCHED)
	{// 속한 길드가 일치하지 않음
		m_pChat->CreateChatChild(STRERR_ERROR_0132,COLOR_ERROR);// "속한 여단이 일치하지 않습니다."
	}
	else if(pMsg->ErrorCode ==  ERR_PROTOCOL_NO_SUCH_GUILD_MEMBER)
	{// 해당 파티원 없음
		m_pChat->CreateChatChild(STRERR_ERROR_0133,COLOR_ERROR);// "여단원이 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NOT_HAVE_PARTY)
	{// 파티에 가입하지 않았음
		if(pMsg->MsgType == T_IC_GUILD_CREATE)
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0134,COLOR_ERROR);// "편대를 생성하지 않아 여단을 창설할 수 없습니다."
		}
		else
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0135,COLOR_ERROR);// "편대 비행 상태가 아닙니다."
		}
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_CANNOT_INVITE_USER)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0136,COLOR_ERROR);// "상대방을 초대 할 수 없습니다."
	}
	else if(pMsg->ErrorCode == ERR_PROTOCOL_NO_SUCH_GUILD)
	{// 해당 길드가 없음
		m_pChat->CreateChatChild(STRERR_ERROR_0137,COLOR_ERROR);// "해당 여단이 없습니다."
	}
//	else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED)
//	{
//		if(pMsg->MsgType == T_IC_CHAT_SELL_ALL)
//		{
//			m_pChat->CreateChatChild("레벨이 20 이상이 되어야 매매채팅이 가능합니다.",COLOR_ERROR);
//		}
//		else if(pMsg->MsgType == T_IC_GUILD_CREATE)
//		{
//			m_pChat->CreateChatChild("레벨이 20 이상이 되어야 여단을 창설할 수 있습니다.",COLOR_ERROR);
//		}
//		else
//		{
//			m_pChat->CreateChatChild("레벨이 부족합니다",COLOR_ERROR);
//		}
//	}
	else if(pMsg->ErrorCode == ERR_FRIEND_INVALID_CHARACTER_NAME)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0138,COLOR_ERROR);// "캐릭터명이 유효하지 않습니다."
	}
	else if(pMsg->ErrorCode == ERR_FRIEND_REGISTERED_PEER_REJECTLIST)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0139,COLOR_ERROR);// "상대방의 거부목록에 등록되어 있습니다."
	}
	else if(pMsg->ErrorCode == ERR_FRIEND_ALREADY_REGISTERED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0140,COLOR_ERROR);// "목록에 이미 등록되어 있습니다."
	}
	else if(pMsg->ErrorCode == ERR_FRIEND_ALREADY_MAX_LIST)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0141,COLOR_ERROR);// "목록에 등록 가능한 최대 인원입니다."
	}
	else if(pMsg->ErrorCode == ERR_FRIEND_NO_SUCH_CHARACTER_IN_LIST)
	{
		if(pMsg->MsgType == T_IC_CHAT_FRIENDLIST_DELETE)
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0142,COLOR_ERROR);// "친구 목록에 존재하지 않는 이름입니다."
		}
		else
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0143,COLOR_ERROR);// "거부 목록에 존재하지 않는 이름입니다."
		}
	}
	else if(pMsg->ErrorCode == ERR_COMMON_NO_SUCH_CHARACTER)
	{
		if(pMsg->MsgType == T_IC_CHAT_FRIENDLIST_INSERT)
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0144,COLOR_ERROR);// "현재 게임에 접속중이지 않습니다."
		}
		else if(pMsg->MsgType == T_IC_CHAT_REJECTLIST_INSERT)		
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0145,COLOR_ERROR);// "현재 게임에 접속중이지 않습니다."
		}
	}
	else if(pMsg->ErrorCode ==  ERR_CHAT_CHAT_NOT_TRANSFERED)
	{
		m_pChat->CreateChatChild(STRERR_ERROR_0146,COLOR_ERROR);// "상대방이 귓말 끔 상태입니다."
	}
	// 2008-12-30 by bhsohn 지도자 채팅 제한 카드 기획안
	else if(pMsg->ErrorCode ==  ERR_CHAT_CHAT_BLOCKED)
	{
		m_pChat->CreateChatChild(STRMSG_C_081230_0210,COLOR_ERROR);// "\\y채팅 제한 상태입니다."
	}
	// end 2008-12-30 by bhsohn 지도자 채팅 제한 카드 기획안
	// 2009-01-12 by bhsohn 일본 추가 수정사항
	else if(pMsg->ErrorCode == ERR_PROTOCOL_ALREADY_MAX_PARTY_MEMBER)
	{		
		char chErrStr[512];
		// "편대 인원수가 최대수를 넘었습니다."
		wsprintf(chErrStr,STRERR_ERROR_0013);// "편대 인원수가 최대수를 넘었습니다."
		m_pChat->CreateChatChild(chErrStr, COLOR_ERROR);
	}
	// end 2009-01-12 by bhsohn 일본 추가 수정사항
	else
	{
		// ErrorCode으로 검색되지 않은 에러입니다.
		return FALSE;
	}
	return TRUE;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketErrorByMsgType(MSG_ERROR* pMsg)
/// \brief		MsgType으로 에러검색 우선
/// \author		jschoi
/// \date		2005-03-18 ~ 2005-03-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IMSocketErrorByMsgType(MSG_ERROR* pMsg)
{

	switch ( pMsg->MsgType )
	{
		case T_IC_CHAT_SELL_ALL :

			switch ( pMsg->ErrorCode )
			{		
				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0147,COLOR_ERROR);// "레벨이 20 이상이 되어야 매매채팅이 가능합니다."
					break;
				
				case ERR_REQ_CHOOSE_INFLUENCE_TYPE :
					
					m_pChat->CreateChatChild(STRMSG_C_061012_0001, COLOR_ERROR); // "세력 선택전까지는 전체 채팅을 할 수 없습니다."
					break;
			}
			break;
			
		case T_IC_GUILD_CREATE :

			switch ( pMsg->ErrorCode )
			{

				case ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRERR_ERROR_0148,COLOR_ERROR);// "레벨이 20 이상이 되어야 여단을 창설할 수 있습니다."
					break;

				case ERR_REQ_CHOOSE_INFLUENCE_TYPE :
					
					m_pChat->CreateChatChild(STRMSG_C_051208_0101,COLOR_ERROR);// "세력 선택 이전에는 여단을 창설 할 수 없습니다."
					break;
					
				case ERR_PROTOCOL_INVLID_GUILDNAME :

					m_pChat->CreateChatChild(STRMSG_C_060412_0001, COLOR_ERROR);
					break;
				
				default :

					m_pChat->CreateChatChild(STRMSG_C_060412_0002, COLOR_ERROR);
					break;
			}
			break;

		case T_IC_CHAT_FRIENDLIST_INSERT :

			switch ( pMsg->ErrorCode ) 
			{
				case ERR_REQ_CHOOSE_INFLUENCE_TYPE :
					
					m_pChat->CreateChatChild(STRMSG_C_061014_0000,COLOR_ERROR);// "세력 선택전까지는 친구 추가를 사용 할 수 없습니다."
					break;

				case ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED :
					
					// 2008-07-03 by bhsohn EP3 버그 리포트 수정
					//m_pChat->CreateChatChild(STRMSG_C_061017_0000,COLOR_ERROR);// "서로 다른 세력이므로 친구 추가를 사용 할 수 없습니다."
					m_pChat->CreateChatChild(STRMSG_C_080703_0200,COLOR_ERROR);// "서로 다른 세력이므로 목록에 추가 할 수 없습니다."
					break;
			}
			break;

		// 2007-10-24 by bhsohn 다른 맵에 있는 유저에게 편대장 위임시 에러메시지 추가
		case T_IC_PARTY_TRANSFER_MASTER :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_MAP_CHANNEL_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRMSG_C_PARTY_0032,COLOR_ERROR);
					break;

				default :
					break;
			}
			break;
		// end 2007-10-24 by bhsohn 다른 맵에 있는 유저에게 편대장 위임시 에러메시지 추가

		// 2008-06-03 by bhsohn EP3 편대 관련 처리
		case T_IC_PARTY_JOIN_FREE :
		
			switch ( pMsg->ErrorCode ) 
			{
				case ERR_PROTOCOL_REQ_PW_NOT_MATCHED :
					
					m_pChat->CreateChatChild(STRMSG_C_070430_0101,COLOR_ERROR);	//"비밀번호가 틀립니다."
					break;


				// 2008-11-06 by bhsohn 유효하지 않은 파티 참가 에러 추가
				case ERR_PROTOCOL_NO_SUCH_PARTY :
					
					m_pChat->CreateChatChild(STRMSG_C_081106_0200,COLOR_ERROR);	//"유효하지 않은 편대입니다."
					break;
				// end 2008-11-06 by bhsohn 유효하지 않은 파티 참가 에러 추가
			}
			break;

		case T_IC_PARTY_LIST_INFO :
			{
				// 편대 리스트 요청
				CINFCommunityParty* pInfParty = g_pGameMain->m_pCommunity->GetParty();
				if( pInfParty && pInfParty->GetRefreshClickState() )
				{
					pInfParty->SetRefreshClickState(FALSE);
					m_pChat->CreateChatChild(STRMSG_C_080703_0202,COLOR_ERROR);	//"\\y생성된 편대가 없습니다."
				}
			}
			break;

		case T_IC_GUILD_DELETE_SELFINTRODUCTION :
		
			// 여단 신청 취소 에러
			switch ( pMsg->ErrorCode )
			{
				case ERR_DB_NO_SUCH_DATA :
					break;
				
				default :
					break;
			}
			break;

		case T_IC_PARTY_RECOMMENDATION_MEMBER :
		
			// 파티 리스트 에러
			switch ( pMsg->ErrorCode )
			{
				case ERR_NO_SEARCH_CHARACTER :
					break;
			
				default :
					break;	
			}
			break;
		// end 2008-06-03 by bhsohn EP3 편대 관련 처리

		case T_IC_CHATROOM_BAN :

			switch ( pMsg->ErrorCode )
			{
				case ERR_INVALID_CHARACTER :
					
					m_pChat->CreateChatChild(STRMSG_C_080711_0100,COLOR_ERROR);	//"자신을 추방 할 수 없습니다."
					break;

				default :
					break;
			}
			break;

		case T_IC_CHATROOM_JOIN :
			
			switch ( pMsg->ErrorCode )
			{
				case ERR_NOT_MATCH_PW :

					m_pChat->CreateChatChild(STRMSG_C_070430_0101,COLOR_ERROR);	//"비밀번호가 틀립니다."
					break;

				// 2009-01-12 by bhsohn 일본 추가 수정사항
				case ERR_CHATROOM_FULL_MEMBER :
					
					m_pChat->CreateChatChild(STRMSG_C_090112_0202, COLOR_ERROR);	//"\\y제한인원 초과로 입장 할 수 없습니다."
					break;
				// end 2009-01-12 by bhsohn 일본 추가 수정사항
			}
			break;

		// 2008-09-08 by bhsohn IM서버 로그인 실패에 대한 처리
		case T_IC_CONNECT_LOGIN :
		
			switch ( pMsg->ErrorCode )
			{
				case ERR_NO_SEARCH_CHARACTER :
					{

						char szTemp[256] = {0, };
							sprintf ( szTemp , "%s\n[%s]" , STRMSG_C_060608_0000 , "ERR_NO_SEARCH_CHARACTER" );
						
						NetworkErrorMsgBox( szTemp );	// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
						//NetworkErrorMsgBox(STRMSG_C_060608_0000);	// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
					}
					break;

				default :
					break;
			}
			break;

		// end 2008-09-08 by bhsohn IM서버 로그인 실패에 대한 처리
		// 2008-10-13 by bhsohn 20레벨 미만 케릭터 여단장 위임 안되는 스트링 추가
		case T_IC_GUILD_NEW_COMMANDER :
		
			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED :

					m_pChat->CreateChatChild(STRMSG_C_081013_0200,COLOR_ERROR);// "20레벨 미만인 케릭터에게 여단장을 위임할 수 없습니다."
					break;

				// 2014-02-10 by ymjoo 입후보자, 지도자, 전진기지 여단장 여단 위임 안되는 스트링 추가
				case ERR_CANNOT_USE_NEW_COMMANDER_BY_POLL :

					m_pChat->CreateChatChild(STRMSG_C_140210_0001,COLOR_ERROR);// "입후보자는 여단을 해체하거나 위임할 수 없습니다."
					break;

				case ERR_CANNOT_USE_NEW_COMMANDER_BY_CITYLEADER :

					m_pChat->CreateChatChild(STRMSG_C_140210_0002,COLOR_ERROR);// "지도자나 전진기지 여단장은 여단을 해체하거나 위임할 수 없습니다."
					break;
				// END 2014-02-10 by ymjoo 입후보자, 지도자, 전진기지 여단장 여단 위임 안되는 스트링 추가

				default :
					break;
			}
			break;
					
		// end 2008-10-13 by bhsohn 20레벨 미만 케릭터 여단장 위임 안되는 스트링 추가
		// 2009. 10. 14 by jskim 프리스카 제거
		case T_FC_CHARACTER_GAMESTART :

			switch ( pMsg->ErrorCode )
			{
				case ERR_REQ_CHOOSE_START_CIIY_MAP_INDEX :
					break;
				
				default :
					break;
			}
			break;

		case T_FC_CHARACTER_CHANGE_START_CITY_MAPINDEX :

			switch ( pMsg->ErrorCode )
			{
				case ERR_PROTOCOL_INVALID_CHARACTER_UNIQUENUMBER :
					
					m_pChat->CreateChatChild(STRMSG_C_091015_0401,COLOR_ERROR);// "캐릭터 정보가 유효하지 않습니다."
					break;

				case ERR_DB_EXECUTION_FAILED :

					m_pChat->CreateChatChild(STRMSG_C_091015_0402,COLOR_ERROR);// "시작 도시맵을 설정 할 수 없습니다."
					break;
			}
			break;
		//end 2009. 10. 14 by jskim 프리스카 제거

		default :
			{
		#if defined(_DEBUG)
				char strError[512];
				wsprintf(strError,STRERR_ERROR_0149,pMsg->MsgType,pMsg->ErrorCode);// "IM_DBG용 미확인 에러메시지 : MsgType(0X%X), ErrorCode(0X%X)"
				m_pChat->CreateChatChild(strError,COLOR_ERROR);
		#endif
			}
			break;
	}

	/*
	if(pMsg->MsgType == T_IC_CHAT_SELL_ALL)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED)
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0147,COLOR_ERROR);// "레벨이 20 이상이 되어야 매매채팅이 가능합니다."
		}
		else if(pMsg->ErrorCode == ERR_REQ_CHOOSE_INFLUENCE_TYPE)
		{
			m_pChat->CreateChatChild(STRMSG_C_061012_0001, COLOR_ERROR); // "세력 선택전까지는 전체 채팅을 할 수 없습니다."
		}
	}
	else if(pMsg->MsgType == T_IC_GUILD_CREATE)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_LEVEL_NOT_MATCHED)
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0148,COLOR_ERROR);// "레벨이 20 이상이 되어야 여단을 창설할 수 있습니다."
		}
		else if(pMsg->ErrorCode == ERR_REQ_CHOOSE_INFLUENCE_TYPE)
		{
			m_pChat->CreateChatChild(STRMSG_C_051208_0101,COLOR_ERROR);// "세력 선택 이전에는 여단을 창설 할 수 없습니다."
		}
		else if(pMsg->ErrorCode == ERR_PROTOCOL_INVLID_GUILDNAME)
		{
			m_pChat->CreateChatChild(STRMSG_C_060412_0001, COLOR_ERROR);
		}
		else
		{
			m_pChat->CreateChatChild(STRMSG_C_060412_0002, COLOR_ERROR);
		}
	}
	else if(pMsg->MsgType == T_IC_CHAT_FRIENDLIST_INSERT)
	{
		if(pMsg->ErrorCode == ERR_REQ_CHOOSE_INFLUENCE_TYPE)
		{
			m_pChat->CreateChatChild(STRMSG_C_061014_0000,COLOR_ERROR);// "세력 선택전까지는 친구 추가를 사용 할 수 없습니다."
		}
		else if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_INFLUENCE_NOT_MATCHED)
		{	
			// 2008-07-03 by bhsohn EP3 버그 리포트 수정
			//m_pChat->CreateChatChild(STRMSG_C_061017_0000,COLOR_ERROR);// "서로 다른 세력이므로 친구 추가를 사용 할 수 없습니다."
			m_pChat->CreateChatChild(STRMSG_C_080703_0200,COLOR_ERROR);// "서로 다른 세력이므로 목록에 추가 할 수 없습니다."
		}
	}
	// 2007-10-24 by bhsohn 다른 맵에 있는 유저에게 편대장 위임시 에러메시지 추가
	else if(pMsg->MsgType == T_IC_PARTY_TRANSFER_MASTER)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_MAP_CHANNEL_NOT_MATCHED)
		{			
			m_pChat->CreateChatChild(STRMSG_C_PARTY_0032,COLOR_ERROR);
		}		
	}
	// end 2007-10-24 by bhsohn 다른 맵에 있는 유저에게 편대장 위임시 에러메시지 추가
	// 2008-06-03 by bhsohn EP3 편대 관련 처리
	else if(pMsg->MsgType == T_IC_PARTY_JOIN_FREE)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_PW_NOT_MATCHED)
		{			
			m_pChat->CreateChatChild(STRMSG_C_070430_0101,COLOR_ERROR);	//"비밀번호가 틀립니다."
		}
		// 2008-11-06 by bhsohn 유효하지 않은 파티 참가 에러 추가
		else if(pMsg->ErrorCode == ERR_PROTOCOL_NO_SUCH_PARTY)
		{			
			m_pChat->CreateChatChild(STRMSG_C_081106_0200,COLOR_ERROR);	//"유효하지 않은 편대입니다."
		}
		// end 2008-11-06 by bhsohn 유효하지 않은 파티 참가 에러 추가
	}
	else if(pMsg->MsgType == T_IC_PARTY_LIST_INFO)
	{
		// 편대 리스트 요청
		CINFCommunityParty* pInfParty = g_pGameMain->m_pCommunity->GetParty();
		if(pInfParty)
		{
			if(pInfParty->GetRefreshClickState())
			{
				pInfParty->SetRefreshClickState(FALSE);
				m_pChat->CreateChatChild(STRMSG_C_080703_0202,COLOR_ERROR);	//"\\y생성된 편대가 없습니다."
			}

		}
	}
	else if(pMsg->MsgType == T_IC_GUILD_DELETE_SELFINTRODUCTION)
	{
		// 여단 신청 취소 에러
		if(pMsg->ErrorCode == ERR_DB_NO_SUCH_DATA)
		{				
		}
	}
	else if(pMsg->MsgType == T_IC_PARTY_RECOMMENDATION_MEMBER)
	{
		// 파티 리스트 에러
		if(pMsg->ErrorCode == ERR_NO_SEARCH_CHARACTER)
		{				
		}
	}
	// end 2008-06-03 by bhsohn EP3 편대 관련 처리
	else if(pMsg->MsgType == T_IC_CHATROOM_BAN)
	{
		if(pMsg->ErrorCode == ERR_INVALID_CHARACTER)
		{
			m_pChat->CreateChatChild(STRMSG_C_080711_0100,COLOR_ERROR);	//"자신을 추방 할 수 없습니다."
		}
	}
	else if(pMsg->MsgType == T_IC_CHATROOM_JOIN)
	{
		if(pMsg->ErrorCode == ERR_NOT_MATCH_PW)
		{
			m_pChat->CreateChatChild(STRMSG_C_070430_0101,COLOR_ERROR);	//"비밀번호가 틀립니다."
		}
		// 2009-01-12 by bhsohn 일본 추가 수정사항
		if(pMsg->ErrorCode == ERR_CHATROOM_FULL_MEMBER)
		{
			m_pChat->CreateChatChild(STRMSG_C_090112_0202, COLOR_ERROR);	//"\\y제한인원 초과로 입장 할 수 없습니다."
		}
		// end 2009-01-12 by bhsohn 일본 추가 수정사항
	}
	// 2008-09-08 by bhsohn IM서버 로그인 실패에 대한 처리
	else if(pMsg->MsgType == T_IC_CONNECT_LOGIN)
	{
		if(pMsg->ErrorCode == ERR_NO_SEARCH_CHARACTER)
		{
			NetworkErrorMsgBox(STRMSG_C_060608_0000);	// "서버와 접속이 종료되었습니다. 게임이 종료됩니다."
		}
	}
	// end 2008-09-08 by bhsohn IM서버 로그인 실패에 대한 처리
	// 2008-10-13 by bhsohn 20레벨 미만 케릭터 여단장 위임 안되는 스트링 추가
	else if(pMsg->MsgType ==  T_IC_GUILD_NEW_COMMANDER)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_REQ_MINLEVEL_NOT_MATCHED)
		{
			m_pChat->CreateChatChild(STRMSG_C_081013_0200,COLOR_ERROR);// "20레벨 미만인 케릭터에게 여단장을 위임할 수 없습니다."
		}		
	}
	// end 2008-10-13 by bhsohn 20레벨 미만 케릭터 여단장 위임 안되는 스트링 추가
	// 2009. 10. 14 by jskim 프리스카 제거
	else if(pMsg->MsgType ==  T_FC_CHARACTER_GAMESTART)
	{
		if(pMsg->ErrorCode == ERR_REQ_CHOOSE_START_CIIY_MAP_INDEX)
		{
		}	
	}
	else if(pMsg->MsgType ==  T_FC_CHARACTER_CHANGE_START_CITY_MAPINDEX)
	{
		if(pMsg->ErrorCode == ERR_PROTOCOL_INVALID_CHARACTER_UNIQUENUMBER)
		{
			m_pChat->CreateChatChild(STRMSG_C_091015_0401,COLOR_ERROR);// "캐릭터 정보가 유효하지 않습니다."
		}
		if(pMsg->ErrorCode == ERR_DB_EXECUTION_FAILED)
		{
			m_pChat->CreateChatChild(STRMSG_C_091015_0402,COLOR_ERROR);// "시작 도시맵을 설정 할 수 없습니다."
		}
	}		
	//end 2009. 10. 14 by jskim 프리스카 제거				
	else
	{
#ifdef _DEBUG
		char strError[512];
		wsprintf(strError,STRERR_ERROR_0149,pMsg->MsgType,pMsg->ErrorCode);// "IM_DBG용 미확인 에러메시지 : MsgType(0X%X), ErrorCode(0X%X)"
		m_pChat->CreateChatChild(strError,COLOR_ERROR);
#endif
	}
	*/
	
	return FALSE;
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			SetPremiumCardInfo(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO* sMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-02-18 ~ 2005-03-18
/// \warning	수정
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetPremiumCardInfo(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO* sMsg)
{
	memcpy(&m_PremiumCardInfo,sMsg,sizeof(MSG_FC_CHARACTER_CASH_PREMIUM_CARD_INFO));
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			IMSocketGuildGetGuildMemberListOk(MSG_IC_GUILD_GET_GUILD_MEMBER_LIST_OK* pMsg)
/// \brief		
/// \author		jschoi
/// \date		2005-05-03 ~ 2005-05-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMSocketGuildGetGuildMemberListOk(MSG_IC_GUILD_GET_GUILD_MEMBER_LIST_OK* pMsg)
{
	char *p = (char *)pMsg;
	p += sizeof(MSG_IC_GUILD_GET_GUILD_MEMBER_LIST_OK);	
	for(int i = 0; i < pMsg->NumOfGuildMemberInfo; i++)
	{
		g_pGameMain->m_pCommunity->GetGuild()->AddGuildMember((MEX_GUILD_MEMBER_INFO*)p);
		p += sizeof(MEX_GUILD_MEMBER_INFO);
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCharacterDeadNotify(MSG_FC_CHARACTER_DEAD_NOTIFY* pMsg)
/// \brief		캐릭터가 죽었을때 서버로부터 다음을 받는다.
/// \author		jschoi
/// \date		2005-05-12 ~ 2005-05-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterDeadNotify(MSG_FC_CHARACTER_DEAD_NOTIFY* pMsg)
{
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		m_bDeadByP2PPK = pMsg->bDeadByP2PPK;
	}
	g_pShuttleChild->m_myShuttleInfo.CurrentHP = 0.0f;
	g_pShuttleChild->m_pOrderTarget = NULL;
	g_pShuttleChild->ChangeUnitStateDead();
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCitywarMonsterDead(MSG_FC_CITYWAR_MONSTER_DEAD* pMsg)
/// \brief		도시점령전중 점령전몬스터가 죽었을때 받는다.
/// \author		jschoi
/// \date		2005-05-16 ~ 2005-05-16
/// \warning	도시점령전이 진행중인 맵에 있는 모든 유저는 자신을 포함하여 모두 방어측으로 설정한다.
///				방어측이 아닌 모든 유저는 자동으로 워프된다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCitywarMonsterDead(MSG_FC_CITYWAR_MONSTER_DEAD* pMsg)
{
	if(NULL == g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3))
	{
		return;
	}
	
	char strMapName[256],strNotice[1024];
	memset(strMapName, 0x00, 256);
	memset(strNotice, 0x00, 1024);
	wsprintf(strMapName, g_pGameMain->GetMapNameByIndex(pMsg->CityWarMapIndex3));
	
	if( INVALID_GUILD_UID == pMsg->OccupyGuildUID3 )
	{
		wsprintf(strNotice,STRMSG_C_050516_0001,strMapName); // "\"NPC\"가 \"%s\"을 현재 점령 하였습니다."
	}
	else
	{
		wsprintf(strNotice,STRMSG_C_050516_0002,pMsg->szOccupyGuildName3,strMapName); // "\"%s\"여단이 \"%s\"을 현재 점령 하였습니다."
	}

	m_pChat->CreateChatChild(strNotice, COLOR_SYSTEM);

	if(	g_pShuttleChild && 
		g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex == pMsg->CityWarMapIndex3)
	{
		g_pShuttleChild->m_byCityWarTeamType = CITYWAR_TEAM_TYPE_DEFENSER;

		if(g_pScene)
		{
			g_pScene->ChangeAllEnemyCityWarTeamType(CITYWAR_TEAM_TYPE_DEFENSER);// 모두 방어측으로 설정
		}
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			FieldSocketCharacterChangeInfluenceType(MSG_FC_CHARACTER_CHANGE_INFLUENCE_TYPE* pMsg)
/// \brief		세력 선택 완료
/// \author		ydkim
/// \date		2005-08-17 ~ 	// 2006-04-18 by ispark, 수정
/// \warning	세력을 선택한 상태 (확인)
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCharacterChangeInfluenceType(MSG_FC_CHARACTER_CHANGE_INFLUENCE_TYPE* pMsg)
{
	if(pMsg->ClientIndex == g_pShuttleChild->m_myShuttleInfo.ClientIndex)
	{
		g_pShuttleChild->m_myShuttleInfo.InfluenceType = pMsg->InfluenceType0;
		// 2007-07-27 by dgwoo 세력 선택을 한 유저인가?
		if(FALSE == IS_NORMAL_INFLUENCE_TYPE(pMsg->InfluenceType0))
		{
			m_bInfregular = TRUE;
		}
		else
		{
			m_bInfregular = FALSE;
		}


		// 모든 다른 유닛들과 세력 비교
		CMapEnemyIterator itEnemy = g_pScene->m_mapEnemyList.begin();
		while(itEnemy != g_pScene->m_mapEnemyList.end())
		{
			// 세력전
			if(!IsInfluenceCharacter(g_pShuttleChild->m_myShuttleInfo.InfluenceType, itEnemy->second->m_infoCharacter.CharacterInfo.InfluenceType))
			{
				itEnemy->second->SetPkState( PK_WAR, TRUE );
			}
			else
			{
				itEnemy->second->SetPkState( PK_WAR, FALSE);
			}
			// 2006-11-27 by ispark, 알파와 관련된 렌더링 중이면
			if(itEnemy->second->m_infoCharacter.CharacterRenderInfo.RI_Invisible)
			{
				itEnemy->second->SetAlphaData();
			}
			if(g_pShuttleChild->m_pOrderTarget == (CAtumData*)itEnemy->second)
			{
				g_pShuttleChild->SetUnLockOn();
			}
			itEnemy++;
		}

		// 2006-05-03 by ispark, 세력변겨응로 인해 전광판 내용 요청
		g_pGameMain->InitChangeInfluenceBoard();

		// 2007-11-01 by bhsohn 해피 아우어 이벤트 처리 방식 변경
		// 서버에 해피 아워 정보요청
		RequestHappyHourInfo();

	}
	else
	{
		CMapEnemyIterator itEnemy = g_pScene->m_mapEnemyList.find(pMsg->ClientIndex);
		if(itEnemy != g_pScene->m_mapEnemyList.end())
		{
			itEnemy->second->m_infoCharacter.CharacterInfo.InfluenceType = pMsg->InfluenceType0;
			// 세력전
			if(!IsInfluenceCharacter(g_pShuttleChild->m_myShuttleInfo.InfluenceType, itEnemy->second->m_infoCharacter.CharacterInfo.InfluenceType))
			{
				itEnemy->second->SetPkState( PK_WAR, TRUE );
			}
			else
			{
				itEnemy->second->SetPkState( PK_WAR, FALSE);
			}
			// 2006-11-27 by ispark, 알파와 관련된 렌더링 중이면
			if(itEnemy->second->m_infoCharacter.CharacterRenderInfo.RI_Invisible)
			{
				itEnemy->second->SetAlphaData();
			}
			if(g_pShuttleChild->m_pOrderTarget == (CAtumData*)itEnemy->second)
			{
				g_pShuttleChild->m_pOrderTarget = NULL;
			}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn
/// \brief		IME 관련 설정 (생성창 설정문제로 이곳에 만든다)
/// \author		ydkim
/// \date		
/// \warnin
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RenderCandidate(int x, int y)
{
	// 2007.04.24 by bhsohn China IME Working	
#ifdef LANGUAGE_CHINA
	BOOL bRtn = RenderReadingText(x, y);
	if(bRtn)
	{
		return;
	}
	
#endif	

	if(m_vecStingCandidate.size() <= 0)
	{
		return;
	}

	char strTemp[128];	
	int cnt = 0;
	
	vector<string>::iterator it = m_vecStingCandidate.begin();
	while(it != m_vecStingCandidate.end())
	{
		if(cnt>CHAR_INF_CANDIDATE)
			break;

		ZERO_MEMORY(strTemp);
		wsprintf(strTemp, "%d. %s", cnt+1, (char*)(*it).c_str());
		int nToolTipWidth = strlen(strTemp)*6.5;		
		if(SET_CREATEMENU_CANDIDATE == g_nRenderCandidate || SET_DELETEMENU_CANDIDATE == g_nRenderCandidate)
		{
			g_pSelect->m_pCreateMenu->RenderPopUpWindowImage(x, y-(cnt*CHAT_FONT_LINE_HEIGHT)-3,
				nToolTipWidth, 1);
		}
		else
		{
			g_pGameMain->RenderPopUpWindowImage(x, y-(cnt*CHAT_FONT_LINE_HEIGHT)-3,
				nToolTipWidth, 1);
		}

		m_pFontCandidate[cnt]->DrawText(x, y-(cnt*CHAT_FONT_LINE_HEIGHT)-3,
			GUI_FONT_COLOR, strTemp);
		
		it++;
		cnt++;
	}
}

// 2007.04.24 by bhsohn China IME Working
BOOL CAtumApplication::RenderReadingText(int x, int y)
{
	BOOL bBreak = FALSE;	
#ifdef LANGUAGE_CHINA
	if(strlen(m_szReadingString) > 0)
	{
		m_pFontCompositon->DrawText(x, y-3,
			GUI_FONT_COLOR, m_szReadingString);

		bBreak = TRUE;
	}				 
#endif
	return bBreak;

}

// 2007-05-21 by bhsohn China IME Working
void CAtumApplication::RenderIMEType(int x, int y)
{	
#ifdef LANGUAGE_CHINA
	if(m_fIMETypeShowTime <= 0)
	{		
		return;
	}
	m_fIMETypeShowTime -= GetCheckElapsedTime();
	float fX = x;
	float fY = y;	
	
	switch(m_dwGameState)
	{
	case _SELECT:
		{
			fX = IME_POS_SELECT_X;
			fY = IME_POS_SELECT_Y;
		}
		break;
	case _CREATE:
		{
			fX = IME_POS_CREATE_X;
			fY = IME_POS_CREATE_Y;
		}
		break;
	default:
		{
			fX = IME_POS_GAME_X;
			fY = IME_POS_GAME_Y;
		}
		break;
	}	
	m_pFontIMEType->DrawText(fX, fY,
		GUI_FONT_COLOR, m_szImeString);		
#endif	
}


void CAtumApplication::UpdateReadingString(char* pText, int nTextLen)
{
	if(nTextLen >= 256)
	{
		return;
	}
	strncpy(m_szReadingString, pText, nTextLen+1);
}
void CAtumApplication::UpdateIMEType(char* pText, int nTextLen)
{
	if(nTextLen >= 256)
	{
		return;
	}
	m_fIMETypeShowTime = IME_TYPE_SHOW_TIME;
	strncpy(m_szImeString, pText, nTextLen+1);
}

int CAtumApplication::SerchMissionCondition(int nNewItemCount)
{
	//////////////////////////////////////////////////////////////////////////
	// 2005-07-15 by ydkim  미션 수정부분	
	CQuest *pQuestInfo = g_pQuestData->GetProgressMission();
	if(pQuestInfo == NULL)
		return NULL;
	MEX_QUEST_INFO* pCharacterQuest = g_pQuestData->FindCharacterQuest(pQuestInfo->QuestIndex);
	MapIndex_t		i_nMapIndex = g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex;
	// 2008-04-07 by bhsohn 퀘스트 시간 지연되는 문제 처리
	//int nRemainTimeInSeconds = g_pGameMain->m_nTimeSecond;
	int nRemainTimeInSeconds = (int)g_pGameMain->GetQuestTimeElapse();

	switch(pQuestInfo->QuestEndType)
	{
//	case QUEST_END_TYPE_LEVEL_UP:
//		{
//			if(g_pShuttleChild->m_myShuttleInfo.Level <= pQuestInfo->QuestParam1)
//			{
//				return NULL;
//			}
//		}
//		return pQuestInfo->QuestIndex;
	case QUEST_END_TYPE_TIME_OVER:
		{
 			if(nRemainTimeInSeconds > 0)
			{
				return NULL;
			}
		}		
		return pQuestInfo->QuestIndex;
	case QUEST_END_TYPE_SELECT_INFLUENCE:
		{
			return NULL;
		}
		break;
	}
	// 2007-04-06 by dgwoo 퀘스트 조합 아이템이 필요할경우(조합 아이템이 있을시엔 다른 아이템을 비교하지 않고 바로 완료하는조건)
	if(pQuestInfo->TargetMixItemTarget.ItemNum != 0)
	{
		ITEM_GENERAL* pTargetMonsterItem = g_pStoreData->FindItemInInventoryByItemNum(pQuestInfo->TargetMixItemTarget.ItemNum);
		
		if (pQuestInfo->TargetMixItemTarget.Count > 0)
		{
			// 해당 아이템을 가지지 않은 경우
			if (pTargetMonsterItem == NULL)
			{
				return NULL;
			}
			
			// 해당 아이템의 개수가 부족한 경우
			int nCount = pQuestInfo->TargetMixItemTarget.Count;
			if (IS_COUNTABLE_ITEM(pTargetMonsterItem->ItemInfo->Kind)
				&& pTargetMonsterItem->CurrentCount + nNewItemCount < nCount)
			{
				return NULL;
			}
		}
	}
	else
	{
	// 필요 몬스터 아이템 확인
	for (int j = 0; j < pQuestInfo->TargetMonsterItemVector.size(); j++)
	{
		if (pQuestInfo->TargetMonsterItemVector[j].ItemWithCount.ItemNum != 0)
		{		
			ITEM_GENERAL* pTargetMonsterItem = g_pStoreData->FindItemInInventoryByItemNum(pQuestInfo->TargetMonsterItemVector[j].ItemWithCount.ItemNum);
			
			// Count가 0이면 꼭 있지 않아도 되는 아이템임
			if (pQuestInfo->TargetMonsterItemVector[j].ItemWithCount.Count == 0)
			{
				continue;
			}
			
			// 해당 아이템을 가지지 않은 경우
			if (pTargetMonsterItem == NULL)
			{
				return NULL;
			}
			
			// 해당 아이템의 개수가 부족한 경우
			int nCount = pQuestInfo->TargetMonsterItemVector[j].ItemWithCount.Count;
			if (IS_COUNTABLE_ITEM(pTargetMonsterItem->ItemInfo->Kind)
				&& pTargetMonsterItem->CurrentCount + nNewItemCount < nCount)		// 2006-12-17 by ispark
			{
				return NULL;
			}
		}
	}

	// 2014-02-19 by ymjoo 퀘스트 스크립트 추가 - 아이템 사용
	// 사용 아이템이 있을 경우
	if(!pQuestInfo->TargetUseItemVector.empty())
	{
		return NULL;
	}
	// END 2014-02-19 by ymjoo 퀘스트 스크립트 추가 - 아이템 사용
	
	// 필요 아이템 확인
	for (int i = 0; i < pQuestInfo->TargetItemVector.size(); i++)
	{
		ITEM_W_COUNT tmpItemWCount = pQuestInfo->TargetItemVector[i];
		// 2007-03-15 by dgwoo 퀘스트 좌표만을 위한 리스트정보. 
		if(0 >= tmpItemWCount.ItemNum 
			|| 0 > tmpItemWCount.Count)
		{
			continue;
		}
		
		ITEM_GENERAL *pItem = g_pStoreData->FindItemInInventoryByItemNum(tmpItemWCount.ItemNum);
		if (pItem == NULL || (IS_GENERAL_ITEM(pItem->ItemInfo->Kind) && pItem->CurrentCount < tmpItemWCount.Count))
		{
			return NULL;
		}
	}
	}
	

	
	// 필요 무게 확인
	float m_fTransportTotal = g_pAtumSJ->GetTransport(&g_pShuttleChild->m_myShuttleInfo);
	if (pQuestInfo->EndPayItemWeight > m_fTransportTotal)
	{
		return NULL;
	}
	
	// 시간 제한 확인
	if (pQuestInfo->TimeLimitInMinutes != 0
		&& nRemainTimeInSeconds <= 0)
	{
		return NULL;
	}

	// 미션 완료 지역 체크
	int X = (int)(g_pD3dApp->m_pShuttleChild->m_vPos.x);
	int Z = (int)(g_pD3dApp->m_pShuttleChild->m_vPos.z);

	if (pQuestInfo->TargetMeetMapArea.MapIndex &&
		FALSE == pQuestInfo->TargetMeetMapArea.IsPositionInArea(g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex, X,Z))	// 히든 퀘스트
	{
		return NULL;
	}

	// 필요 몬스터 수 체크

	vector<MONSTER_W_COUNT>::iterator itMon = pQuestInfo->TargetMonsterVector.begin();
	for(;itMon != pQuestInfo->TargetMonsterVector.end(); itMon++)
	{
		if(0 >= itMon->MonsterUniqueNumber
			|| 0 > itMon->Count)
		{
			continue;
		}

		Quest_MonsterInfo* pQMonInfo = g_pQuestData->FindQuestMonsterCountInfo(itMon->MonsterUniqueNumber);
		if(NULL == pQMonInfo
			|| pQMonInfo->nMonsterCount < itMon->Count)
		{
			return NULL;
		}
	}
// 2007-03-15 by dgwoo 수정.(효율적이지 않음)
//	vector<BOOL> vecMonQuest;
//	vecMonQuest.clear();
//	vector<MONSTER_W_COUNT>::iterator itMon = pQuestInfo->TargetMonsterVector.begin();
//	while(itMon != pQuestInfo->TargetMonsterVector.end())
//	{
//		BOOL bMonCount = TRUE;
//		vector<Quest_MonsterInfo>::iterator it = g_pQuestData->m_vecQuestMonsterCount.begin();
//		while(it != g_pQuestData->m_vecQuestMonsterCount.end())
//		{
//			if((*itMon).MonsterUniqueNumber == (*it).nMonsterUnitkind 
//				&& (*itMon).Count <= (*it).nMonsterCount)
//			{
//				bMonCount = FALSE;
//			}
//			it++;
//		}
//		
//		vecMonQuest.push_back(bMonCount);
//		itMon++;
//	}
//
//	vector<BOOL>::iterator itCount = vecMonQuest.begin();
//	while(itCount != vecMonQuest.end())
//	{
//		if((*itCount) == TRUE)
//			return NULL;
//		itCount++;
//	}

	if(pQuestInfo->TargetMeetObjectIndex && pQuestInfo->TargetMeetObjectMapArea.MapIndex)
		return NULL;
	
	// 2006-03-24 by ispark, 완료는 파티상태 일때
	if(pQuestInfo->IsPartyQuest() && g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _NOPARTY)
	{
		// 파티상태가 아니다.
		return NULL;
	}

	return pQuestInfo->QuestIndex;
}

void CAtumApplication::SetHanFontLang(LPARAM lParam)
{
//	switch (PRIMARYLANGID(g_input.GetLangId()))
//	{
//	case LANG_KOREAN:
//		//한국어
//		{
//			strcpy(m_strFont, "굴림체");
//		}
//		break;
//	case LANG_JAPANESE:
//		//일어
//		{
//			strcpy(m_strFont, "굴림체");
//		}
//		break;
//	case LANG_CHINESE:
//		//중국어
//		{
//			strcpy(m_strFont, "굴림체");
//		}
//		break;
//	case LANG_ENGLISH:
//		{
//			strcpy(m_strFont, "Arial");
//		}
//		break;
//	default:
//		strcpy(m_strFont, "굴림체");
//	}
// 2006-03-07 by ispark, 언어에 따라 위치 수정
// 기본은 한국 폰트이다.
	strcpy(m_strFont, KOREAN_FONT);

#ifdef LANGUAGE_ENGLISH
	strcpy(m_strFont, ENGLISH_FONT);
#endif
#ifdef LANGUAGE_VIETNAM
	strcpy(m_strFont, VIETNAM_FONT);
#endif
// 2007.04.24 by bhsohn China IME Working
#ifdef LANGUAGE_CHINA
	strcpy(m_strFont, CHINA_FONT);
#endif
	// 2008-04-30 by bhsohn 태국 버전 추가
#ifdef LANGUAGE_THAI
	strcpy(m_strFont, ENGLISH_FONT);
#endif
	// end 2008-04-30 by bhsohn 태국 버전 추가

	// 2008-12-04 by bhsohn Japan Working
#ifdef LANGUAGE_JAPAN
	strcpy(m_strFont, ENGLISH_FONT);
#endif
	// end 2008-12-04 by bhsohn Japan Working
	
}

void CAtumApplication::SendMissionComplete(int nPartyMissionIndex)
{
	int nMissionIndex = SerchMissionCondition();
	// 2006-03-28 by ispark, 위에서 NULL 경우, 그리고 nPartyMissionIndex를 가지고 있는 경우 Success를 보낸다.
	if(nMissionIndex != NULL)
	{
		g_pQuestData->SendFieldSocketQuestRequestSuccess(nMissionIndex);
	}
	else if(nMissionIndex == NULL && nPartyMissionIndex)
	{
		g_pQuestData->SendFieldSocketQuestRequestSuccess(nPartyMissionIndex);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendHeckTime_WeaponInfo()
/// \brief		핵 체크 타임 (무기)
/// \author		ispark
/// \date		2005-12-21 ~ 2005-12-21
/// \warning	
/// 2006-04-04 by ispark
/// 상점에서 아이템 임시 착용시 자신 아이템이 아닌 임시 아이템이 보내는 버그 수정 
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendHackTime_WeaponInfo()
{
	// 1형 무기
	MSG_FC_CHARACTER_GET_REAL_WEAPON_INFO_OK msg_Weapon;
	CItemInfo* pItemPrimary = g_pStoreData->FindItemInInventoryByWindowPos(POS_PROWOUT);
	CItemInfo* pItemSecondary = g_pStoreData->FindItemInInventoryByWindowPos(POS_WINGOUT);
//	ITEM_GENERAL* pItemPrimary = g_pStoreData->FindItemInInventoryByWindowPos(POS_PROWOUT);
//	ITEM_GENERAL* pItemSecondary = g_pStoreData->FindItemInInventoryByWindowPos(POS_WINGOUT);

//	if(m_pShuttleChild->m_pPrimaryWeapon)
	if(pItemPrimary)
	{
		ITEM* pItemPrimaryInfo = pItemPrimary->GetRealItemInfo();
		if(pItemPrimary)
		{
			msg_Weapon.ItemUID0			= pItemPrimary->UniqueNumber;
			msg_Weapon.BoosterAngle0	= pItemPrimaryInfo->BoosterAngle;
			msg_Weapon.MultiNum0		= 1.0f;
			msg_Weapon.OrbitType0		= pItemPrimary->ItemInfo->OrbitType;
			msg_Weapon.RangeAngle0		= CAtumSJ::GetAttackRangeAngle(pItemPrimaryInfo, &m_pShuttleChild->m_paramFactor);
			// 2013-10-18 by bhsohn 핵체크 재공시간 처리
//			msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pItemPrimaryInfo, &m_pShuttleChild->m_paramFactor);
			{
				ITEM* pPureItem = g_pDatabase->GetServerItemInfo(pItemPrimary->ItemNum);
				if(pPureItem)

				{
					CParamFactor* pItemParamFactor = pItemPrimary->GetParamFactor(); // m_pPrefixRareInfo,m_pSuffixRareInfo,m_pEnchantParamFactor 가 모두 적용된 결과값
					CParamFactor AllParamFactor = m_pShuttleChild->m_paramFactor;
					if(pItemParamFactor)
					{
						AllParamFactor += (*pItemParamFactor);
					}
					msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pPureItem, &AllParamFactor);				
				}
				else
				{
					msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pItemPrimaryInfo, &m_pShuttleChild->m_paramFactor);
				}	
			}
			// END 2013-10-18 by bhsohn 핵체크 재공시간 재시정 처리
			msg_Weapon.RepeatTime0		= pItemPrimaryInfo->RepeatTime;
			msg_Weapon.ShotNum0			= CAtumSJ::GetTotalPrimaryShotNumPerReattackTime(pItemPrimaryInfo, &m_pShuttleChild->m_paramFactor);
			msg_Weapon.Time0			= CAtumSJ::GetOverheatTime(pItemPrimaryInfo, &m_pShuttleChild->m_paramFactor);

			m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_GET_REAL_WEAPON_INFO_OK, (char*)&msg_Weapon, sizeof(msg_Weapon)); 
		}
	}

	// 2형 무기
//	if(m_pShuttleChild->m_pSecondaryWeapon)
	if(pItemSecondary)
	{
		ITEM* pItemSecondaryInfo = pItemSecondary->GetRealItemInfo();
		if(pItemSecondary)
		{
			msg_Weapon.ItemUID0			= pItemSecondary->UniqueNumber;
			msg_Weapon.BoosterAngle0	= pItemSecondaryInfo->BoosterAngle;
			msg_Weapon.MultiNum0		= CAtumSJ::GetSecondaryMultiNumCount(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);
			msg_Weapon.OrbitType0		= pItemSecondaryInfo->OrbitType;
			msg_Weapon.RangeAngle0		= CAtumSJ::GetAttackRangeAngle(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);

			// 2013-10-18 by bhsohn 핵체크 재공시간 처리
//			msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);			
			{
				ITEM* pPureItem = g_pDatabase->GetServerItemInfo(pItemSecondary->ItemNum);
				if(pPureItem)
				{
					CParamFactor* pItemParamFactor = pItemSecondary->GetParamFactor(); // m_pPrefixRareInfo,m_pSuffixRareInfo,m_pEnchantParamFactor 가 모두 적용된 결과값
					CParamFactor AllParamFactor = m_pShuttleChild->m_paramFactor;
					if(pItemParamFactor)
					{
						AllParamFactor += (*pItemParamFactor);
					}
					msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pPureItem, &AllParamFactor);				
				}
				else
				{
					msg_Weapon.ReattackTime0	= CAtumSJ::GetShotCountReattackTime(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);
				}
			}
			// END 2013-10-18 by bhsohn 핵체크 재공시간 재시정 처리

			
			msg_Weapon.RepeatTime0		= pItemSecondaryInfo->RepeatTime;

			msg_Weapon.ShotNum0			= CAtumSJ::GetTotalSecondaryShotNumPerReattackTime(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);
			msg_Weapon.Time0			= CAtumSJ::GetOverheatTime(pItemSecondaryInfo, &m_pShuttleChild->m_paramFactor);

			m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_GET_REAL_WEAPON_INFO_OK, (char*)&msg_Weapon, sizeof(msg_Weapon)); 
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendHeckTime_EngineInfo()
/// \brief		핵 체크 타임 (엔진)
/// \author		ispark
/// \date		2005-12-21 ~ 2005-12-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendHackTime_EngineInfo()
{
	// 엔진
	MSG_FC_CHARACTER_GET_REAL_ENGINE_INFO_OK msg_Engine;

	CItemInfo* pItemEngine = g_pStoreData->FindItemInInventoryByWindowPos(POS_REAR);
	if(pItemEngine)
	{
		msg_Engine.ItemUID0			= pItemEngine->UniqueNumber;
		msg_Engine.AbilityMax0		= pItemEngine->ItemInfo->AbilityMax;
		msg_Engine.AbilityMin0		= pItemEngine->ItemInfo->AbilityMin;
		msg_Engine.BoosterAngle0	= CAtumSJ::GetEngineBoosterRangeAngle(pItemEngine->ItemInfo, &m_pShuttleChild->m_paramFactor);
		msg_Engine.Range0			= pItemEngine->ItemInfo->Range;
		msg_Engine.RangeAngle0		= CAtumSJ::GetEngineRangeAngle(pItemEngine->ItemInfo, &m_pShuttleChild->m_paramFactor);
		msg_Engine.SpeedPenalty0	= CAtumSJ::GetCircularAngle(pItemEngine->ItemInfo, &m_pShuttleChild->m_paramFactor);
		msg_Engine.Time0			= pItemEngine->ItemInfo->Time;

		m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_GET_REAL_ENGINE_INFO_OK, (char*)&msg_Engine, sizeof(msg_Engine)); 
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendHeckTime_TotalWeight()
/// \brief		핵 체크 타임 (무게)
/// \author		ispark
/// \date		2005-12-21 ~ 2005-12-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendHackTime_TotalWeight()
{
	// 무게
	MSG_FC_CHARACTER_GET_REAL_TOTAL_WEIGHT_OK msg_Weight;

	CItemInfo* pItemArmor = g_pStoreData->FindItemInInventoryByWindowPos(POS_CENTER);
	if(pItemArmor)
	{
		msg_Weight.ItemUID0		= pItemArmor->UniqueNumber;
	}
	else
	{
		msg_Weight.ItemUID0		= 0;
	}
	msg_Weight.TotalWeight0		= g_pStoreData->GetTotalWeight();
	msg_Weight.Transport0		= CAtumSJ::GetTransport(&m_pShuttleChild->m_myShuttleInfo);
	m_pFieldWinSocket->SendMsg( T_FC_CHARACTER_GET_REAL_TOTAL_WEIGHT_OK, (char*)&msg_Weight, sizeof(msg_Weight)); 
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::SendHackTime_MoveCheck()
/// \brief		핵 체크 타임 (이동) 
/// \author		ispark
/// \date		2005-12-22 ~ 2005-12-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendHackTime_MemoryCheck(float ValidDistance, float CurrentDistance, float fElapsedTime)
{
	MSG_FC_CHARACTER_MEMORY_HACK_USER msg_Memory;

	CItemInfo* pItemEngine = g_pStoreData->FindItemInInventoryByWindowPos(POS_REAR);
	if(pItemEngine)
	{
		msg_Memory.ItemUID0			= pItemEngine->UniqueNumber;
	}
	else
	{
		msg_Memory.ItemUID0			= 0;
	}
	msg_Memory.ValidMoveDistance	= ValidDistance;
	msg_Memory.CurrentMoveDistance	= CurrentDistance;
	msg_Memory.TickGap				= fElapsedTime * 1000;
	m_pFieldWinSocket->SendMsg(T_FC_CHARACTER_MEMORY_HACK_USER, (char*)&msg_Memory, sizeof(msg_Memory)); 
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			CAtumApplication::CheckReadyStringFiltering(char *szChat, int *nFTWordCounts, int *nFTTotalBytes)
/// \brief		필터링 하기 전에 색깔 빼기
/// \author		ispark
/// \date		2006-04-13 ~ 2006-04-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::CheckReadyStringFiltering(char *szChat, int *nFTWordCounts, int *nFTTotalBytes)
{
	// 2008-06-20 by bhsohn EP3 옵션관련 처리
	if(!IsOptionEtc(OPTION_RADIO_CHAT_FILTER))
	{
		(*nFTWordCounts) = 0;
		(*nFTTotalBytes) = 0;
		return;
	}
	// end 2008-06-20 by bhsohn EP3 옵션관련 처리

	int nStrLen = strlen(szChat);
	char pSubChatTemp[200] = {0,};
	int nInCount = 0;
	// 색깔 빼기
	for(int i = 0; i < nStrLen; i++)
	{
		if(*(szChat+i) != '\\')
		{
			pSubChatTemp[nInCount] = *(szChat+i);
			nInCount++;
		}
		else if(i+1 < nStrLen)
		{
			DWORD dwColor = GetFontColor(*(szChat+i+1));
			if(dwColor > 0)
				i++;
		}
	}
	
	m_pAbuseFilter->AbuseFiltering(pSubChatTemp,nFTWordCounts,nFTTotalBytes);

	if(*nFTTotalBytes > 0)
	{
		memset(szChat, 0x00, nStrLen);
		strncpy(szChat,pSubChatTemp, nStrLen);
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL	HS_Init()
/// \brief		핵쉴드 초기화 함수
/// \author		ispark
/// \date		2006-06-02 ~ 2006-06-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::HS_Init()
{
	int		nRet = 0;
	TCHAR	szFullFilePath[MAX_PATH] = {0,};
	TCHAR	szMsg[MAX_PATH];
	DWORD	dwOption = 0;
	
	// ① 핵쉴드 폴더의 EhSvc.dll 위치를 지정합니다.
	char path_buffer[_MAX_PATH] = {0,};

#ifdef _DEBUG
	GetCurrentDirectory(MAX_PATH, path_buffer);
	wsprintf(szFullFilePath, "%s%s", path_buffer, HACKSHIELD_FILE_PATH_DBG);
#else
	char drive[_MAX_DRIVE];
	char dir[_MAX_DIR];
	char fname[_MAX_FNAME];
	char ext[_MAX_EXT];

	GetModuleFileName(NULL, path_buffer, MAX_PATH);
	_splitpath(path_buffer, drive, dir, fname, ext);
	wsprintf(szFullFilePath, "%s%s%s", drive, dir, HACKSHIELD_FILE_PATH);
#endif

	DBGOUT("Hack Shield Path (%s)\n", szFullFilePath);

	// 2008-12-17 by bhsohn 핵쉴드 모니터링 시스템 
	char chMonitorSerIP[MAX_PATH];
	memset(chMonitorSerIP, 0x00, MAX_PATH);
	wsprintf(chMonitorSerIP, GAME_GUARD_MONITORING_SERVER_IP);
	if(strlen(chMonitorSerIP) > 0)
	{
		
		AHNHS_EXT_ERRORINFO HsExtError;
		memset(&HsExtError, 0x00, sizeof(AHNHS_EXT_ERRORINFO));
		
		strncpy( HsExtError.szServer, chMonitorSerIP, MAX_PATH-1 );	// Monitoring Server Address
		strncpy( HsExtError.szUserId, m_strUserID, SIZE_MAX_ACCOUNT_NAME);	// UserID
		// sprintf( HsExtError.szUserId, "%s", "" ); 
		strncpy( HsExtError.szGameVersion, m_strFieldIP, SIZE_MAX_IPADDRESS);	// Game Version
		
		int nMonitor = _AhnHS_StartMonitor( HsExtError, szFullFilePath );
		DBGOUT("_AhnHS_StartMonitor [%d] 0x%x \n", HACKSHIELD_GAME_CODE, nMonitor);
		
	}
	// end 2008-12-17 by bhsohn 핵쉴드 모니터링 시스템 
	// ② _AhnHS_Initialize 함수 호출에 쓰일 옵션 플래그를 정의합니다
	// 2006-06-05 by ispark, 디버그 모드와 릴리즈 모드는 서로 옵션이 다르다.
#ifdef _DEBUG
	dwOption = AHNHS_CHKOPT_SPEEDHACK |
		AHNHS_CHKOPT_AUTOMOUSE |
		AHNHS_CHKOPT_PROCESSSCAN |
		AHNHS_USE_LOG_FILE |
		// 2013-07-08 by bhsohn NEW HackShiled Working
// 		AHNHS_ALLOW_SVCHOST_OPENPROCESS |
// 		AHNHS_ALLOW_LSASS_OPENPROCESS |
// 		AHNHS_ALLOW_CSRSS_OPENPROCESS |
		AHNHS_DONOT_TERMINATE_PROCESS;
#else
	dwOption = AHNHS_CHKOPT_ALL |
		AHNHS_USE_LOG_FILE |
		// 2013-07-08 by bhsohn NEW HackShiled Working
// 		AHNHS_ALLOW_SVCHOST_OPENPROCESS |
// 		AHNHS_ALLOW_LSASS_OPENPROCESS |
// 		AHNHS_ALLOW_CSRSS_OPENPROCESS |
		AHNHS_DONOT_TERMINATE_PROCESS |
		AHNHS_DISPLAY_HACKSHIELD_TRAYICON;		// 2012-10-23 by mspark, 핵쉴드 트레이 아이콘 나오도록 추가
#endif
	// 2009-03-11 by bhsohn AhnHackShield 647 업데이트
	dwOption |= AHNHS_CHKOPT_LOCAL_MEMORY_PROTECTION;	// LMP(Local Memory Protection) 2.0추가

	// 2009. 07. 16 by ckPark 핵쉴드 자체 종료 기능 추가
	dwOption |= AHNHS_CHKOPT_SELF_DESTRUCTION;
	// end 2009. 07. 16 by ckPark 핵쉴드 자체 종료 기능 추가

	// start 2012-03-21 by hskim, 핵쉴드 기능 추가 [자동 업데이트/옵션 추가/모니터링 시스템]
	dwOption |= AHNHS_CHKOPT_PROTECT_D3DX;				

#ifdef S_HACK_SHIELD_AUTO_UPDATE_HSKIM
	dwOption |= AHNHS_CHKOPT_UPDATED_FILE_CHECK;		// 주의 - 핵쉴드 서버를 HTTP 사용하도록 퍼블리셔에게 공지 (FTP 사용시 에러 발생)
#endif
	// end 2012-03-21 by hskim, 핵쉴드 기능 추가 [자동 업데이트/옵션 추가/모니터링 시스템]

	if(m_IsFullMode)
	{// 풀모드.
//		창모드가 지원되지 않는 게임에 적용하는 추가 기능입니다.
// 		AHNHS_ALLOW_SWITCH_WINDOW 옵션의 사용 여부			
// 		1.     사용 : [Alt + Tab]을 허용			
// 		2.     사용 안함 : [Alt + Tab]을 금지
		dwOption |= AHNHS_ALLOW_SWITCH_WINDOW;
		DbgOut("AHNHS_ALLOW_SWITCH_WINDOW \r\n");		
	}
	else
	{// 창모드.
// 		단, 창모드가 지원되는 게임에서는 
// 		AHNHS_ENGINE_DETECT_WINDOWED_HACK (0x01503)을 무시해야 하기 때문에 
// 		AHNHS_ALLOW_SWITCH_WINDOW 옵션을 사용하면 안됩니다.		
	}
	// end 2009-03-11 by bhsohn AhnHackShield 647 업데이트
	// ③ _AhnHS_Initialize 함수를 호출하여 핵쉴드 서비스를 초기화 합니다.
	nRet = _AhnHS_Initialize ( szFullFilePath, 
		HS_MainCallbackProc,				// 콜백함수
		HACKSHIELD_GAME_CODE, 			// 게임코드
		HACKSHIELD_LICENCE_CODE,		// 라이센스 키
		dwOption, 						// 옵션 플래그
		AHNHS_SPEEDHACK_SENSING_RATIO_NORMAL );
	DbgOut("%s GameCode = %d Li = %s, option = 0x%X return =%d\r\n",
		szFullFilePath,HACKSHIELD_GAME_CODE,HACKSHIELD_LICENCE_CODE,dwOption,nRet);
	// ④ _AhnHS_Initialize 함수의 리턴 값을 검사하여 에러 처리합니다.
	if ( nRet != HS_ERR_OK )
	{
		switch( nRet )
		{
		case HS_ERR_COMPATIBILITY_MODE_RUNNING:
		case HS_ERR_NEED_ADMIN_RIGHTS:
		case HS_ERR_INVALID_FILES:
		case HS_ERR_INIT_DRV_FAILED:
		case HS_ERR_DEBUGGER_DETECT:
		default:
			{
				DBGOUT("HS_Init Error(%x)\n", nRet);
			}
			wsprintf( szMsg, "HShield Error.(%x)", nRet );
			break;
		}
		MessageBox( NULL, szMsg, "Error", MB_OK );
		return FALSE;
	}

	DBGOUT("HS Init ---> Success\n");
	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL	HS_UnInit()
/// \brief		핵쉴드 서비스
/// \author		ispark
/// \date		2006-06-02 ~ 2006-06-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::HS_UnInit()
{
	int	nRet = 0;
	
	// ① _AhnHS_Uninitialize 함수를 호출하여 핵쉴드 서비스를 종료합니다.
	nRet = _AhnHS_Uninitialize();
	
	if ( nRet != HS_ERR_OK ) 
	{
		return FALSE;
	}

	DBGOUT("HS UnInit ---> Success\n");
	return TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL	HS_StartService()
/// \brief		핵쉴드 서비스 시작 함수
/// \author		ispark
/// \date		2006-06-02 ~ 2006-06-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::HS_StartService()
{
	int		nRet = 0;
//	TCHAR	szMsg[MAX_PATH];
	
	// ① _AhnHS_StartService 함수를 호출하여 핵쉴드 서비스를 시작합니다.
	nRet = _AhnHS_StartService();
	
	// ② _AhnHS_StartService 함수의 리턴 값을 검사하여 에러 처리합니다.
	if ( nRet != HS_ERR_OK )
	{
		switch ( nRet )
		{
		case HS_ERR_START_ENGINE_FAILED:
		case HS_ERR_DRV_FILE_CREATE_FAILED:
		case HS_ERR_REG_DRV_FILE_FAILED:
		case HS_ERR_START_DRV_FAILED:
		default:
			{
				DBGOUT("HS_StartService Error(%x)\n", nRet);
			}
//			wsprintf ( szMsg, "해킹 방지 기능에 문제가 발생 하였습니다(%x)", nRet );
			break;
		}
//		MessageBox( NULL, szMsg, "에러", MB_OK );
		return FALSE;
	}
	DBGOUT("---------- AhnHS Service Start ----------\n");
	return TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL	HS_StopService()
/// \brief		핵쉴드 서비스 정지 함수
/// \author		ispark
/// \date		2006-06-02 ~ 2006-06-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::HS_StopService()
{
	int	nRet = 0;
	
	// ① _AhnHS_StopService 함수를 호출하여 핵쉴드 서비스를 정지합니다.
	nRet = _AhnHS_StopService();
	
	if ( nRet != HS_ERR_OK ) 
	{
		return FALSE;
	}
	return TRUE;
}

int __stdcall HS_MainCallbackProc ( long lCode, long lParamSize, void* pParam )
{
	if(g_pD3dApp)
	{
		g_pD3dApp->HS_CallbackProc(lCode, lParamSize, pParam);
	}
	return 1;
}
// 2012-10-13 by jhahn 핵쉴드->Xigncode변경
xstatus XCALL MyUserInfoCallback(xuint iid,xstr buffer,xsize size, xpvoid context)
{

	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();	
    
	if (strlen(pMainInfo->AccountName) != 0)
	{
		if (iid == XUID_USER_ACCOUNT)
		{
			// 2012-10-13 by jhahn 핵쉴드->Xigncode변경
			memset(buffer,0,size);
			sprintf(buffer,"%s,%s",pMainInfo->AccountName,pMainInfo->CharacterName);
			// 2012-10-13 by jhahn 핵쉴드->Xigncode변경

			return ZCWAVE_OK;
		}
		else
		{
			return ZCWAVE_E_USER_INFO_ACCESS_DENIED;
		}
	}

	return ZCWAVE_E_USER_INFO_IS_NOT_READY;

}										   
//end 2012-10-13 by jhahn 핵쉴드->Xigncode변경


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2012-10-17 by bhsohn XignCode작업
/// \date		2012-10-17 ~ 2012-10-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
xbool CALLBACK AceOnlineXigncodeCallback(ULONG Code , ULONG W , PVOID L , PVOID Context)
{
	MSG_FC_CHARACTER_XIGNCODE_C_ACK_CODE msg;
	memset(&msg, 0x00, sizeof(MSG_FC_CHARACTER_XIGNCODE_C_ACK_CODE));		
	msg.Code  = Code;	

//	DbgOut("AceOnlineXigncodeCallback [%d] \n", Code);

	g_pFieldWinSocket->SendMsg(T_FC_CHARACTER_XIGNCODE_C_ACK_CODE, (char*)&msg, sizeof(MSG_FC_CHARACTER_XIGNCODE_C_ACK_CODE)); 

	return 1;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		ispark
/// \date		2006-06-02 ~ 2006-06-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int __stdcall CAtumApplication::HS_CallbackProc ( long lCode, long lParamSize, void* pParam )
{
//	TCHAR	szMsg[MAX_PATH];
	
	// ① 각 경우에 대하여 알맞은 에러 메시지를 출력합니다
	switch ( lCode )
	{
		// ② Engine Callback, 별도의 처리를 하지 않음
	case AHNHS_ENGINE_DETECT_GAME_HACK:
//		wsprintf( szMsg, "다음의 프로그램과 게임이 함께 실행될 수 없습니다 (%x) \n [%s]", 
//			lCode, (LPTSTR)pParam );
//		MessageBox( NULL, szMsg, "에러", MB_OK );
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ENGINE_DETECT_GAME_HACK, (LPTSTR)pParam);
		break;
		// 2013-07-08 by bhsohn NEW HackShiled Working
		// ③ 오토마우스
// 	case AHNHS_ACTAPC_DETECT_AUTOMOUSE:
// 		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_AUTOMOUSE);
// 		break;
// 	case AHNHS_ACTAPC_DETECT_ALREADYHOOKED:
// //		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_ALREADYHOOKED);
// 		break;
		// ④ Speed 관련, "스피드핵으로 의심되는 동작이 감지되었습니다 "
	case AHNHS_ACTAPC_DETECT_SPEEDHACK:
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_SPEEDHACK);
		break;
		// 2009-04-28 by bhsohn 핵쉴드 업데이트(708버전)
// 	case AHNHS_ACTAPC_DETECT_SPEEDHACK_APP:
// 		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_SPEEDHACK_APP);
// 		break;
		// end 2009-04-28 by bhsohn 핵쉴드 업데이트(708버전)
		// ⑤ 디버깅 방지, "게임에 대하여 디버깅 시도가 감지되었습니다"
	case AHNHS_ACTAPC_DETECT_KDTRACE:
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_KDTRACE);
		break;
		// 2013-07-08 by bhsohn NEW HackShiled Working
//	case AHNHS_ACTAPC_DETECT_KDTRACE_CHANGED:
// 		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_KDTRACE_CHANGED);
// 		break;
		// ⑥ 그 외 해킹 방지 기능 이상, "해킹 방어 기능에 이상이 발생하였습니다"
	case AHNHS_ACTAPC_DETECT_DRIVERFAILED:
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_DRIVERFAILED);
		break;
	case AHNHS_ACTAPC_DETECT_HOOKFUNCTION:
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_HOOKFUNCTION);
		break;
		// 2013-07-08 by bhsohn NEW HackShiled Working
// 	case AHNHS_ACTAPC_DETECT_MESSAGEHOOK:
// 		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_MESSAGEHOOK);
// 		break;
// 	case AHNHS_ACTAPC_DETECT_MODULE_CHANGE:
// 		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_MODULE_CHANGE);
// 		break;
	// 2007-04-09 by bhsohn 핵쉴드 업데이트(148)
	case AHNHS_ACTAPC_DETECT_ABNORMAL_MEMORY_ACCESS:
		HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_ABNORMAL_MEMORY_ACCESS);
		break;
	// end 2007-04-09 by bhsohn 핵쉴드 업데이트(148)
	// 2008-03-24 by bhsohn 핵쉴드 업데이트(270버전)
	case AHNHS_ACTAPC_DETECT_ENGINEFAILED:
		{
			HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_ENGINEFAILED);
		}
		break;
	// end 2008-03-24 by bhsohn 핵쉴드 업데이트(270버전)
		// 2009-03-11 by bhsohn AhnHackShield 647 업데이트
	case AHNHS_ACTAPC_DETECT_MEM_MODIFY_FROM_LMP:
		{
			// LMP Callback
			// 참조: LMP 콜백에서는 변조된 모듈 이름과 페이지상의 주소값도
			// 함께 넘어오지만 이를 사용자에게 직접 노출할 필요는
			// 없습니다.
			char szHackMsg[256] = { 0 };
			wsprintf(szHackMsg, "AHNHS_ACTAPC_DETECT_MEM_MODIFY_FROM_LMP");
			HS_SendHackShieldErrorMsg(lCode, szHackMsg);
		}
		break;
		// end 2009-03-11 by bhsohn AhnHackShield 647 업데이트

	// 2009. 07. 16 by ckPark 핵쉴드 자체 종료 기능 추가
	case AHNHS_ACTAPC_DETECT_AUTOMACRO:
		{
			HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_AUTOMACRO);
		}
		break;

	case AHNHS_ACTAPC_DETECT_CODEMISMATCH:
		{
			HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_CODEMISMATCH);
		}
		break;
		
	case AHNHS_ACTAPC_DETECT_ABNORMAL_HACKSHIELD_STATUS:
		{
			HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_ABNORMAL_HACKSHIELD_STATUS);
		}
		break;

	case AHNHS_ACTAPC_DETECT_LMP_FAILED:
		{
			HS_SendHackShieldErrorMsg(ERR_AHNHS_ACTAPC_DETECT_LMP_FAILED);
		}
		break;

	// end 2009. 07. 16 by ckPark 핵쉴드 자체 종료 기능 추가
	}
	return 1;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::HS_SaveFuncAdress(int *pF1)
/// \brief		
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::HS_SaveFuncAdress()
{
// 	int nResult = _AhnHS_SaveFuncAddress(3, HS_CallbackProc, HS_Init, SetParamFactor_DesParam);
// 
// 	if(nResult != ERROR_SUCCESS)
// 	{
// 		// 에러처리
// 		DBGOUT("_AhnHS_SaveFuncAddress Error (%x)\n", nResult);
// 	}
// 
// 	DBGOUT("_AhnHS_SaveFuncAddress Success\n");	return TRUE;
	return TRUE;
}

BOOL CAtumApplication::HS_Start()
{
	// 2006-07-04 by ispark, 갈라넷도 핵쉴드 적용
//#if defined(LANGUAGE_KOREA) || defined(LANGUAGE_VIETNAM)//
	/*--------------------------------------------------------------------------*/
	// 2006-06-05 by ispark
	// 핵쉴드
	if(!HS_Init())
	{
		HS_UnInit();
		return FALSE;
	}

	if(!HS_StartService())
	{
		HS_StopService();
		HS_UnInit();
		return FALSE;
	}

	//HS_SaveFuncAdress();
	return TRUE;

	/*--------------------------------------------------------------------------*/
// #endif
}

void CAtumApplication::HS_Close()
{
	// 2006-07-04 by ispark, 갈라넷도 핵쉴드 적용
//#if defined(LANGUAGE_KOREA) || defined(LANGUAGE_VIETNAM)
	/*--------------------------------------------------------------------------*/
	// 2006-06-05 by ispark
	HS_StopService();
	HS_UnInit();
	DBGOUT("HS_Close Complete\n");
	/*--------------------------------------------------------------------------*/
//#endif
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::HS_MakeGuidAckMsg(unsigned char *pbyReqMsg, unsigned char *pbyAckMsg)
/// \brief		클라이언트와의 통신을 처리하는 스레드 함수 내에 GUID 요구 메시지를 생성
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2008-04-04 by bhsohn 핵쉴드 방식 변경
//void CAtumApplication::HS_MakeGuidAckMsg(unsigned char *pbyReqMsg, unsigned char *pbyAckMsg)
//{
//	DWORD dwRet = _AhnHS_MakeGuidAckMsg(pbyReqMsg, pbyAckMsg);
//	if(dwRet != ERROR_SUCCESS)
//	{
//		// 에러처리
//		DBGOUT("MakeGuidAckMsg Error (%x)\n", dwRet);
//	}
//}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::HS_MakeCRCAckMsg(unsigned char *pbyReqMsg, unsigned char *pbyAckMsg)
/// \brief		서버와의 통신을 처리하는 스레드 함수 내에 CRC 요구 메시지에 대한 Ack 메시지 처리
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
//void CAtumApplication::HS_MakeCRCAckMsg(unsigned char *pbyReqMsg, unsigned char *pbyAckMsg)
//{
//	DWORD dwRet = _AhnHS_MakeAckMsg(pbyReqMsg, pbyAckMsg);
//	if(dwRet != ERROR_SUCCESS)
//	{
//		// 에러처리
//		DBGOUT("MakeAckMsg Error (%x)\n", dwRet);
//	}
//}
// end 2008-04-04 by bhsohn 핵쉴드 방식 변경

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::HS_SendErrorMsg(long lHackClientCode)
/// \brief		핵 쉴드 에러 코드 보내기
/// \author		ispark
/// \date		2006-06-05 ~ 2006-06-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::HS_SendHackShieldErrorMsg(long lHackClientCode, char * pMsg)
{
	MSG_FC_MOVE_HACKSHIELD_HACKING_CLIENT sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	sMsg.lHackingClinetCode = lHackClientCode;
	// 2007-05-07 by bhsohn 스피드 핵 체크 버그 수정
	//strncpy(sMsg.szErrString, pMsg, SIZE_STRING_128);
	if(pMsg)
	{
		strncpy(sMsg.szErrString, pMsg, SIZE_STRING_128);
	}	

	m_pFieldWinSocket->SendMsg(T_FC_MOVE_HACKSHIELD_HACKING_CLIENT, (char*)&sMsg, sizeof(sMsg));

	DbgOut("Error HackShield Hacking Client (%s[%x])(%s)\n", GetErrorString(lHackClientCode), lHackClientCode, sMsg.szErrString);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::SendOtherPacket()
/// \brief		일정시간동안에 보내는 패킷들
/// \author		ispark
/// \date		2006-06-15 ~ 2006-06-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendOtherPacket()
{
	SendPacketDataByVector(T_FC_CHARACTER_GET_OTHER_INFO, m_vecCharacterOtherInfo);
	SendPacketDataByVector(T_FC_CHARACTER_GET_OTHER_MOVE, m_vecCharacterOtherMove);
	SendPacketDataByVector(T_FC_CHARACTER_GET_OTHER_RENDER_INFO, m_vecCharacterOtherRenderInfo);
	SendPacketDataByVector(T_FC_MOVE_TARGET, m_vecMoveTarget);

	SendPacketDataByVector(T_FC_INFO_GET_MAPOBJECT_INFO, m_vecMapObjectInfo);
	SendPacketDataByVector(T_FC_INFO_GET_MONSTER_INFO, m_vecMonsterInfo);
	SendPacketDataByVector(T_FC_INFO_GET_SIMPLE_ITEM_INFO, m_vecSimpleItemInfo);
	SendPacketDataByVector(T_FC_INFO_GET_ITEM_INFO, m_vecItemInfo);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::LostDeviceTick()
/// \brief		장치를 잃었을 때 돌아야 하는 루프
/// \author		ispark
/// \date		2006-09-27 ~ 2006-09-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::LostDeviceTick()
{
    // Get the app's time, in seconds. Skip rendering if no time elapsed
    FLOAT fAppTime        = DXUtil_Timer( TIMER_GETAPPTIME );
    FLOAT fElapsedAppTime = DXUtil_Timer( TIMER_GETELAPSEDTIME );
    if( ( 0.0f == fElapsedAppTime ) && m_bFrameMoving )
        return;
	
	//DBGOUT("시간 %f(%d)\n", fElapsedAppTime, timeGetTime());

	if((m_dwGameState == _GAME || m_dwGameState ==  _SHOP) &&
		g_pShuttleChild)
	{
		g_pShuttleChild->m_timeProcess.Tick(fElapsedAppTime);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CINFSkill::SetEffectUseItem(ITEM* pItemInfo)
/// \brief		이펙트 발생
/// \author		ispark
/// \date		2006-10-11 ~ 2006-10-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetEffectUseItem(ITEM* pItemInfo)
{
	CAppEffectData * pEff = NULL; 
	BOOL bEffUse = FALSE;
	int nEffNum = 0;
	int nSoundNum = 0;
	
	switch(pItemInfo->ItemNum)
	{
	case 7004820:	// 파워 에너지 캡슐
		{
			nEffNum = RC_EFF_POWER_ENERGY_CAPSULE;
			nSoundNum = SOUND_POWER_ENERGY_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	case 7004830:	// 파워 쉴드 캡슐
		{
			nEffNum = RC_EFF_POWER_SHIELD_CAPSULE;
			nSoundNum = SOUND_POWER_SHIELD_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	case 7004840:	// 파워 SP 캡슐
		{
			nEffNum = RC_EFF_POWER_SP_CAPSULE;
			nSoundNum = SOUND_POWER_SP_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	case 7004850:	// 아드레날린 캡슐
		{
			nEffNum = RC_EFF_ADRENALIN_CAPSULE;
			nSoundNum = SOUND_ADRENALIN_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	case 7004860:	// 브레이브 캡슐
		{
			nEffNum = RC_EFF_BRAVE_CAPSULE;
			nSoundNum = SOUND_BRAVE_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	case 7004870:	// 하이퍼부스터
		{
			nEffNum = RC_EFF_HYPER_BOOSTER_CAPSULE;
			nSoundNum = SOUND_HYPER_BOOSTER_CAPSULE;
			bEffUse = TRUE;
		}
		break;
	}

	if(bEffUse)
	{
		g_pD3dApp->m_pSound->PlayD3DSound(nSoundNum, g_pShuttleChild->m_vPos, FALSE);
		pEff = new CAppEffectData(g_pD3dApp->m_pShuttleChild,nEffNum,D3DXVECTOR3(0,0,0));
		pEff = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pEff);
		MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
		sMsg.EffectIndex = nEffNum;
		g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
	}
}
// 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼
void CAtumApplication::SetPlayEffect(INT nEffectNum,INT nSoundNum) // 해당 이펙트 번호를 범위 내의 모든 플레이어가 볼수 있게 재생
{
	CAppEffectData * pEff = NULL; 
	if(nSoundNum != 0)
	{
		g_pD3dApp->m_pSound->PlayD3DSound(nSoundNum, g_pShuttleChild->m_vPos, FALSE);
	}
	if(nEffectNum)
	{
		pEff = new CAppEffectData(m_pShuttleChild,nEffectNum,D3DXVECTOR3(0,0,0));
		pEff = (CAppEffectData *)m_pEffectList->AddChild(pEff);
		MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
		sMsg.EffectIndex = nEffectNum;
		g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
	}
}
// end 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼

// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
void CAtumApplication::SetPlaySearchEyeEffect(CUnitData * pUnit, INT nEffectNum, INT nSoundNum, bool bMoveCheck /* = true */)
{
	CAppEffectData * pEff = NULL; 
	if(nSoundNum != 0)
	{
		g_pD3dApp->m_pSound->PlayD3DSound(nSoundNum, g_pShuttleChild->m_vPos, FALSE);
	}
	if(nEffectNum)
	{
		pEff = new CAppEffectData(pUnit,nEffectNum,D3DXVECTOR3(0,0,0));
		pEff = (CAppEffectData *)m_pEffectList->AddChild(pEff);
		MSG_FC_CHARACTER_SHOW_EFFECT sMsg;
		sMsg.EffectIndex = nEffectNum;
		if(bMoveCheck)
		{
		g_pFieldWinSocket->SendMsg( T_FC_CHARACTER_SHOW_EFFECT, (char*)&sMsg, sizeof(sMsg) );
		}		
	}
}

// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
void CAtumApplication::ClearPlaySearchEyeEffect(CUnitData * pUnit, INT nEffectNum)
{	
	CAppEffectData* pEffect = (CAppEffectData*)g_pD3dApp->m_pEffectList->m_pChild;
	while(pEffect)
	{
		if(!pUnit)
		{
			pEffect = (CAppEffectData*)pEffect->m_pNext;
			continue;
		}
				
		if((pEffect->m_pParent == pUnit) && (nEffectNum == pEffect->m_nType))
		{
			pEffect->m_bUsing = FALSE;
		}
		pEffect = (CAppEffectData*)pEffect->m_pNext;
	}
}
// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::RenderAlpha()
/// \brief		알파 렌더링
/// \author		ispark
/// \date		2006-11-16 ~ 2006-11-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RenderAlpha()
{
	//*--------------------------------------------------------------------------*//
	// 유닛 렌더링
	vector<CUnitData*>::iterator itUnit = g_pScene->m_vecAlphaUnitRender.begin();
	while(itUnit != g_pScene->m_vecAlphaUnitRender.end())
	{
		if(g_pCharacterChild->GetPickingBazaar() == (*itUnit))
		{
			g_pD3dDev->LightEnable( 2, TRUE );
			g_pD3dDev->LightEnable( 3, TRUE );
		}		
		(*itUnit)->Render();
		itUnit++;

		g_pD3dDev->LightEnable( 2, FALSE );
		g_pD3dDev->LightEnable( 3, FALSE );
	}

	//*--------------------------------------------------------------------------*//
	// 이펙트
	vector<ALPHA_CHARACTERINFO>::iterator itAlphaInfo = g_pScene->m_vecAlphaEffectRender.begin();
	while(itAlphaInfo != g_pScene->m_vecAlphaEffectRender.end())
	{
		m_pEffectRender->DevideCharacterEffect((*itAlphaInfo).pCharInfo, TRUE, (*itAlphaInfo).nAlphaValue);

		itAlphaInfo++;
	}

	if(m_pEffectRender->m_vecZEnableEffect.size() > 0)
	{
		m_pEffectRender->RenderZEnable();
	}

 	InitAlphaRenderState();

	// 2006-11-16 by ispark, 포그를 꺼야 2D 이미지에서 영향을 받지 않는다.
	g_pD3dDev->SetRenderState(D3DRS_FOGENABLE, FALSE);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void UpdateCheckTime()
/// \brief		실제 시간 체크 업데이트
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::UpdateCheckTime()
{
	DWORD dwTime = timeGetTime();
	
	// 2008-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
	m_dwLastestTickTime = dwTime;

	if((m_dwCurrentTime == 0) || (dwTime < m_dwCurrentTime))
	{
		m_dwCurrentTime = dwTime;
		m_fCheckElapsedTime = 0;
		return;
	}	
	DWORD dwDiff = (dwTime - m_dwCurrentTime);
	m_fCheckElapsedTime = (float)dwDiff/(float)1000.0f;

	if(m_fCheckElapsedTime < 0)
	{
		m_fCheckElapsedTime = 0;
	}
	m_dwCurrentTime = dwTime;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			int CAtumApplication::GetCheckElapsedTime()
/// \brief		전에 시간과 시간 간격을 얻어온다.
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
FLOAT CAtumApplication::GetCheckElapsedTime()
{
	return m_fCheckElapsedTime;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void SetMultiSelectItem(INVEN_DISPLAY_INFO *pDisplayInfo, POINT pt, BYTE byType)
/// \brief		인벤에서 다중 아이템을 선택하한다.
/// \author		bhsohn
/// \date		2007-02-12 ~ 2007-02-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::SetMultiSelectItem(INVEN_DISPLAY_INFO *pDisplayInfo, INVEN_DISPLAY_INFO	*pSelectItem, POINT ptIcon, BYTE bySelectType)
{
	if(pDisplayInfo && pSelectItem)
	{
		return FALSE;
	}
	
	// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	if(g_pGameMain->m_pInfWindow->IsExistMsgBox( _Q_MULTI_SEL_WARNING) )
	{
		return FALSE;
	}
	// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)

	stMultiSelectItem stSelItem;	
	memset(&stSelItem, 0x00, sizeof(stMultiSelectItem));
	
	if(NULL == pDisplayInfo)
	{
		DelMultiItemList();
		return FALSE;
	}	
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{		
		return FALSE;
	}
	CItemInfo* pItemInfo = (CItemInfo*)pDisplayInfo->pItem;
	deque<stMultiSelectItem>* pVector = NULL;

	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;

	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecSellMultiSelectItem;
		// 이미 있는 것을 선택하면 선택 해제 
		if(CheckMultItemSel(pDisplayInfo->pItem->UniqueNumber))
		{
			DelMultiItem(pVector, pDisplayInfo);
			return FALSE;
		}	
		// 상점이면 팔수 있는지 없는지 판단해야한다. 바자 상점에 올릴수 없는 아이템을 다중 아이템 선택안됨
		//if(!COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_BAZAAR_ITEM))
		if(COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_NO_TRANSFER))
		{
			char buff[MAX_PATH];
			wsprintf(buff, STRMSG_C_070212_0203, pDisplayInfo->Name);
			m_pChat->CreateChatChild(buff, COLOR_ERROR);
			return FALSE;
		}
		
	}	
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{		
		pVector = &m_vecInvenStoreMultiSelectItem;
		// 이미 있는 것을 선택하면 선택 해제 
		if(CheckMultItemSel(pDisplayInfo->pItem->UniqueNumber))
		{
			DelMultiItem(pVector, pDisplayInfo);
			return FALSE;
		}	

		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		// 인벤에서 창고로
		// 창고가 비워있는 공간을 체크한다.
//		if(IsCheckCityStoreFull())
//		{
//			m_pChat->CreateChatChild(STRERR_ERROR_0023,COLOR_ERROR);// "창고 저장 공간이 부족합니다."
//			return FALSE;
//		}	
		// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		// 남은돈도 체크한다. 
		if(IsCheckSPIEmpty())
		{
			m_pChat->CreateChatChild(STRERR_ERROR_0103,COLOR_ERROR);// "스피가 부족하여 창고를 이용 할 수 없습니다."
			return FALSE;
		}
		
		if(COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_NO_TRANSFER))
		{
			char buff[MAX_PATH];
			wsprintf(buff, STRMSG_C_070212_0204, pDisplayInfo->Name);
			m_pChat->CreateChatChild(buff, COLOR_ERROR);
			return FALSE;
		}			
		if(pItemInfo->Wear != WEAR_NOT_ATTACHED )
		{
			m_pChat->CreateChatChild(STRMSG_C_STORE_0006,COLOR_ERROR);	// "장착된 아이템은 맡길 수 없습니다."
			return FALSE;
		}	
		if(false == m_vecCityStoreMultiSelectItem.empty())
		{
			m_vecCityStoreMultiSelectItem.clear();
		}
		
	}
	else
	{
		return FALSE;
	}
	// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	BOOL bShowWarningMsg = FALSE;
	char chItenName[256], chBuff[256];
	ZERO_MEMORY(chItenName);
	ZERO_MEMORY(chBuff);

	if(!IS_COUNTABLE_ITEM(pItemInfo->Kind) && !IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		//카운터 아이템 아닌것만 체크
		
		pItemInfo->GetItemFullName(chItenName);

		if(COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_UNIQUE_ITEM))
		{
			//"%s 아이템은 \\y유니크\\y 아이템입니다. 정말로 선택 하시겠습니까?"
			bShowWarningMsg = TRUE;
			wsprintf(chBuff, STRMSG_C_090408_0101, chItenName);						
			
		}	
		else if(COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_LEGEND_ITEM))
		{
			// "%s 아이템은 \\m레전드\\m 아이템입니다. 정말로 선택 하시겠습니까?"			
			bShowWarningMsg = TRUE;
			wsprintf(chBuff, STRMSG_C_090408_0103, chItenName);									
		}	
		else if(pItemInfo->GetEnchantNumber() > 0)
		{
			// "%s 아이템은 \\e인챈트\\e 아이템입니다. 정말로 선택 하시겠습니까?"			
			bShowWarningMsg = TRUE;
			wsprintf(chBuff, STRMSG_C_090408_0102, chItenName);	
		}
		
	}
	// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)

	UINT uSellPrice = CAtumSJ::GetItemSellingPriceAtShop(pDisplayInfo->pItem->ItemInfo);	
	
	stSelItem.uSellingPrice	 = uSellPrice;
	stSelItem.byItemKind	= pDisplayInfo->pItem->Kind;
	stSelItem.nUniqueNumber	= pDisplayInfo->pItem->UniqueNumber;
	stSelItem.SourceIndex = pItemInfo->ItemInfo->SourceIndex;
	stSelItem.ptIcon = ptIcon;
	stSelItem.bySelectType = bySelectType;	
	// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	stSelItem.ItemNum = pItemInfo->ItemNum;
	// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안

	BOOL bfrontAdd = FALSE;
	
	if( IS_COUNTABLE_ITEM(pItemInfo->Kind))
	{
		stSelItem.nAmount		= pItemInfo->CurrentCount;

		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		// 카운터블 아이템은 앞쪽에 애드 될수 있다. (왜냐하면 파는 순서가 가장 처음 부터 팔기 떄문에)
		if(IS_STORE_SHOP_TYPE(nBuildingKind))
		{
			bfrontAdd = IsStoreHave(stSelItem.ItemNum);
		}		
		// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	}
	else
	{
		stSelItem.nAmount		= 1;
	}
	
	stSelItem.nBuildingIndex = pBuilding->buildingInfo.BuildingIndex;
	
	
	strncpy(stSelItem.szName, pDisplayInfo->Name, 50);	
	strncpy(stSelItem.szIconName, pDisplayInfo->IconName, 20);	

	// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	//AddMultiItemList(pVector, &stSelItem, bfrontAdd);		
	if(!bShowWarningMsg)
	{
		memset(&m_stMultiWarningSelItem, 0x00, sizeof(stMultiSelectItem));
		AddMultiItemList(pVector, &stSelItem, bfrontAdd);
	}
	else
	{		
		memcpy(&m_stMultiWarningSelItem, &stSelItem, sizeof(stMultiSelectItem));	
		g_pGameMain->m_pInfWindow->AddMsgBox(chBuff, _Q_MULTI_SEL_WARNING,0,0,0,pDisplayInfo->pItem->UniqueNumber);
	}			
	// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	return TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		다중선택 경고창에서 추가한다.
/// \author		// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
/// \date		2009-04-08 ~ 2009-04-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::AddMultiSelWarningMsg(UID64_t	UniqueNumber)
{
	if(m_stMultiWarningSelItem.nUniqueNumber != UniqueNumber)
	{
		return;
	}
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{		
		return ;
	}
	CItemInfo* pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(UniqueNumber);
	if(NULL == pItemInfo)
	{
		return;
	}

	if(m_stMultiWarningSelItem.nBuildingIndex != pBuilding->buildingInfo.BuildingIndex)
	{
		return;
	}

	deque<stMultiSelectItem>* pVector = NULL;
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;

	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecSellMultiSelectItem;	
		
	}	
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{		
		pVector = &m_vecInvenStoreMultiSelectItem;		
	}
	else
	{
		return ;
	}
	stMultiSelectItem stSelItem;	
	memcpy(&stSelItem, &m_stMultiWarningSelItem, sizeof(stMultiSelectItem));	
	BOOL bfrontAdd = FALSE;
	
	if( IS_COUNTABLE_ITEM(pItemInfo->Kind))
	{		
		// 카운터블 아이템은 앞쪽에 애드 될수 있다. (왜냐하면 파는 순서가 가장 처음 부터 팔기 떄문에)
		if(IS_STORE_SHOP_TYPE(nBuildingKind))
		{
			bfrontAdd = IsStoreHave(stSelItem.ItemNum);
		}				
	}	
	AddMultiItemList(pVector, &stSelItem, bfrontAdd);	
}


// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
CInfinityManager*	CAtumApplication::GetInfinityManager( void )
{
	return m_pInfinityManager;
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템


///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL IsItemAddStror(UID64_t		nUniqueNumber)
/// \brief		다중 아이템을 선택하한다.
/// \author		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
/// \date		2007-03-09 ~ 2007-03-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsStoreHave(int nItemNum)
{	
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	if(NULL == pStore)
	{
		return FALSE;
	}
	return pStore->IsStoreHave(nItemNum);
}

// 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
//BOOL CAtumApplication::SetMultiSelectCityStoreItem(CItemInfo* pItemInfo, INVEN_DISPLAY_INFO	*pSelectItem, POINT ptIcon, BYTE bySelectType)
BOOL CAtumApplication::SetMultiSelectCityStoreItem(CItemInfo* pItemInfo, INVEN_DISPLAY_INFO *pSelectItem, POINT ptIcon, BYTE bySelectType, INVEN_DISPLAY_INFO *pDisSelectItem)
// end 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
{
	if(pItemInfo && pSelectItem)
	{
		return FALSE;
	}
	if(NULL == pItemInfo)
	{
		DelMultiItemList();
		return FALSE;
	}	
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{		
		return FALSE;
	}

	if(false == m_vecInvenStoreMultiSelectItem.empty())
	{
		m_vecInvenStoreMultiSelectItem.clear();		
	}

	if(CheckCityStoreMultItemSel(pItemInfo->UniqueNumber))
	{
		DelCityStoreMultiItem(pItemInfo->UniqueNumber);
		return FALSE;
	}

	if(!IsCheckGuildStore())
	{
		m_pChat->CreateChatChild(STRMSG_C_061011_0101,COLOR_ERROR);// "대대원 이상만 찾기가 가능합니다."
		return FALSE;
	}
	// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
//	if(IsCheckInvenFull())
//	{
//		m_pChat->CreateChatChild(STRERR_ERROR_0022,COLOR_ERROR);// "인벤토리 공간이 부족합니다."
//		return FALSE;
//	}
	// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안

	// 이동 불가 아이템 다시 판단.
	if(COMPARE_BIT_FLAG(pItemInfo->ItemInfo->ItemAttribute, ITEM_ATTR_NO_TRANSFER))
	{
		char buff[MAX_PATH];
		wsprintf(buff, STRMSG_C_070212_0204, pItemInfo->ItemInfo->ItemName);
		m_pChat->CreateChatChild(buff, COLOR_ERROR);
		return FALSE;
	}
	
	deque<stMultiSelectItem>* pVector = &m_vecCityStoreMultiSelectItem;
	stMultiSelectItem stSelItem;	
	memset(&stSelItem, 0x00, sizeof(stMultiSelectItem));	

	// 창고에서 사용자에게 가져올때는 ID와 갯수만 있으면 된다.	
	stSelItem.nUniqueNumber	= pItemInfo->UniqueNumber;	
	stSelItem.SourceIndex = pItemInfo->ItemInfo->SourceIndex;
	stSelItem.ptIcon = ptIcon;
	stSelItem.bySelectType = bySelectType;	

	// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	stSelItem.ItemNum = pItemInfo->ItemNum;
	// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안


	// 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
	strcpy( stSelItem.szIconName, pDisSelectItem->IconName );
	// end 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현


	// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	BOOL bfrontAdd = FALSE;	

	if( IS_COUNTABLE_ITEM(pItemInfo->Kind))
	{
		stSelItem.nAmount		= pItemInfo->CurrentCount;
		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
		// 카운터블 아이템은 앞쪽에 애드 될수 있다. (왜냐하면 파는 순서가 가장 처음 부터 팔기 떄문에)
		bfrontAdd = IsInvenHave(stSelItem.ItemNum);
				
		// end 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
	}
	else
	{
		stSelItem.nAmount		= 1;
	}	
	AddMultiItemList(pVector, &stSelItem, bfrontAdd);	

	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL IsItemAddStror(UID64_t		nUniqueNumber)
/// \brief		다중 아이템을 선택하한다.
/// \author		// 2007-03-09 by bhsohn 다중 선택 창고 부분 보안
/// \date		2007-03-09 ~ 2007-03-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsInvenHave(int nItemNum)
{	
	if(NULL == g_pGameMain)
	{
		if(NULL == g_pGameMain->m_pInven)
		{
			return FALSE;
		}
	}	
	
	return g_pGameMain->m_pInven->IsInvenHave(nItemNum);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void AddMultiItemList(deque<stMultiSelectItem>* pVector, const stMultiSelectItem* pSelItem)
/// \brief		아이템 선택 리스트 추가
/// \author		bhsohn
/// \date		2007-02-12 ~ 2007-02-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::AddMultiItemList(deque<stMultiSelectItem>* pVector, const stMultiSelectItem* pSelItem, BOOL bfrontAdd)
{
	stMultiSelectItem stDstSelItem;	
	memcpy(&stDstSelItem, pSelItem, sizeof(stMultiSelectItem));
	if(bfrontAdd)
	{
		pVector->push_front(stDstSelItem);
	}
	else
	{
		pVector->push_back(stDstSelItem);	
	}

}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템 삭제한다. 
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::DelMultiItem(deque<stMultiSelectItem>* pVector, INVEN_DISPLAY_INFO *pDisplayInfo)
{
	deque<stMultiSelectItem>::iterator it = pVector->begin();
	while(it != pVector->end())
	{		
		if(pDisplayInfo->pItem->UniqueNumber == it->nUniqueNumber)
		{
			pVector->erase(it);
			break;
		}
		it++;
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		창고에서 아이템 선택 취소
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::DelCityStoreMultiItem(UID64_t nUniqueNumber)
{
	deque<stMultiSelectItem>::iterator it = m_vecCityStoreMultiSelectItem.begin();
	while(it != m_vecCityStoreMultiSelectItem.end())
	{		
		if(nUniqueNumber == it->nUniqueNumber)
		{
			m_vecCityStoreMultiSelectItem.erase(it);
			break;
		}
		it++;
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void DelMultiItemList()
/// \brief		다중 선택 아이템 전체 삭제
/// \author		bhsohn
/// \date		2007-02-12 ~ 2007-02-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::DelMultiItemList(BOOL bInitCtlBtn)
{
	if(g_pGameMain)
	{
		g_pGameMain->ClearMultiSelectItem();
		// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
		if(g_pGameMain->m_pInfWindow && g_pGameMain->m_pInfWindow->IsExistMsgBox( _Q_MULTI_SEL_WARNING) )
		{
			g_pGameMain->m_pInfWindow->DeleteMsgBox(_Q_MULTI_SEL_WARNING);			
		}
		// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	}	
	if(bInitCtlBtn)
	{
		m_bCtrlBtnClick = FALSE;
	}
	
	m_bStartMultiSell = FALSE;
	m_bStartMultiStore = FALSE;
	memset(&m_struLastSelMultiItem, 0x00, sizeof(stMultiSelectItem));
	m_vecSellMultiSelectItem.clear();	
	m_vecInvenStoreMultiSelectItem.clear();
	m_vecCityStoreMultiSelectItem.clear();	

	// 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
	memset(&m_stMultiWarningSelItem, 0x00, sizeof(stMultiSelectItem));
	// end 2009-04-08 by bhsohn 다중 선택시, 유니크 및 인챈트 된 아이템 판매시 경고 메시지 출력 기획 문서(K0000174)
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void RenderMultItemSel()
/// \brief		다중 선택 랜더링 처리 
/// \author		bhsohn
/// \date		2007-02-12 ~ 2007-02-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::CheckMultItemSel(UID64_t	 nUniqueNumber)
{
	deque<stMultiSelectItem>* pVector = NULL;
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return FALSE;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecSellMultiSelectItem;
	}
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecInvenStoreMultiSelectItem;		
	}
	else
	{
		return FALSE;
	}
	BOOL bHaveItem = FALSE;
	int nMutlSelItemLen = pVector->size();
	if(0 >= nMutlSelItemLen)
	{
		return bHaveItem;		
	}
	deque<stMultiSelectItem>::iterator it = pVector->begin();
	while(it != pVector->end())
	{		
		//if(pInvenInfo->pItem->UniqueNumber == it->nUniqueNumber)
		if(nUniqueNumber == it->nUniqueNumber)
		{
			bHaveItem = TRUE;
			break;
		}
		it++;
	}
	return bHaveItem;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		창고에서 아이템 체크 여부 판단
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::CheckCityStoreMultItemSel(UID64_t	 nUniqueNumber)
{
	BOOL bHaveItem = FALSE;
	int nMutlSelItemLen = m_vecCityStoreMultiSelectItem.size();
	if(0 >= nMutlSelItemLen)
	{
		return bHaveItem;		
	}
	deque<stMultiSelectItem>::iterator it = m_vecCityStoreMultiSelectItem.begin();
	while(it != m_vecCityStoreMultiSelectItem.end())
	{		
		//if(pInvenInfo->pItem->UniqueNumber == it->nUniqueNumber)
		if(nUniqueNumber == it->nUniqueNumber)
		{
			bHaveItem = TRUE;
			break;
		}
		it++;
	}
	return bHaveItem;
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		다중 선택 Item 갯수
/// \author		bhsohn
/// \date		2007-02-12 ~ 2007-02-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::GetMultiSelectItem()
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return 0;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		||IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		return m_vecSellMultiSelectItem.size();
	}
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		return m_vecInvenStoreMultiSelectItem.size();
	}
	return 0;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		창고에서 다중 선택 아이템 갯수 
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::GetCityStoreMultiSelectItem()
{
	return m_vecCityStoreMultiSelectItem.size();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void StartSellMultiItem()
/// \brief		다중 아이템 팔기 시작 
/// \author		bhsohn
/// \date		2007-02-13 ~ 2007-02-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartSellMultiItem()
{	
	if(true == m_vecSellMultiSelectItem.empty())
	{
		// Lock 해제 		
		return;
	}	
	m_bStartMultiSell = TRUE;

	// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
	//SellMutltiOneItem();
	IntervalSellMutltiOneItem();
	
	// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		다중 판매에서 한가지 아이템씩 팔기
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SellMutltiOneItem()
{	
	if(true == m_vecSellMultiSelectItem.empty())
	{		
		return;
	}	
	deque<stMultiSelectItem>::iterator it = m_vecSellMultiSelectItem.begin();	

	// Lock 
	m_bRequestEnable = FALSE;

	// 2007-02-28 by bhsohn 다중 판매시 0 spi에 대한 처리
	m_struLastSelMultiItem = (*it);

	{
		MSG_FC_SHOP_SELL_ITEM sMsg;
		memset(&sMsg,0x00,sizeof(sMsg));
		char buffer[SIZE_MAX_PACKET];
		sMsg.Amount				= max(1, it->nAmount);
		sMsg.ItemKind			= it->byItemKind;
		sMsg.ItemUniqueNumber	= it->nUniqueNumber;
		sMsg.BuildingIndex		= it->nBuildingIndex;
		int nType = T_FC_SHOP_SELL_ITEM;
		memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
		memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
		m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
	}

	// 가장 첫 대상을 제거한다.
	m_vecSellMultiSelectItem.pop_front();	

	if(true == m_vecSellMultiSelectItem.empty())
	{
		// 더이상 팔 물건이 없어서 락 해제 		
		m_bStartMultiSell = FALSE;		
	}
			
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void SellMultiResponseOK()
/// \brief		팔기 성공
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SellMultiResponseOK()
{
	if(true == m_vecSellMultiSelectItem.empty())
	{
		// 더이상 팔 물건이 없어서 락 해제 		
		return;
	}		
	SellMutltiOneItem();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		bhsohn
/// \date		2007-02-15 ~ 2007-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SellMutltiItemError()
{	
	if(true == m_vecSellMultiSelectItem.empty())
	{			
		return;
	}	
	SellMutltiOneItem();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void GetMultiItemSPI(char* pDstSpi)
/// \brief		현재 다중으로 팔 아이템들 가격
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::GetMultiItemSPI(int nShopId, char* pDstSpi)
{
	DWORD dwSpi = 0;
	int nItemCnt = 0;		
	wsprintf(pDstSpi, "0");

	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}
	deque<stMultiSelectItem>* pVector = NULL;
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecSellMultiSelectItem;
	}
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		pVector = &m_vecInvenStoreMultiSelectItem;		
	}
	else
	{
		return;
	}
	
	deque<stMultiSelectItem>::iterator it = pVector->begin();
	while(it != pVector->end())
	{			
		ULONG uSell = it->uSellingPrice;
		int nAmount = it->nAmount;
		switch(nShopId)
		{			
		case _Q_SHOP_MULTI_SELL_ITEM:
			{				
				// 상점 
				dwSpi += (it->uSellingPrice*it->nAmount);
			}
			break;
		case _Q_STORE_MULTI_PUT_ITEM :
			{
				// 창고 
				dwSpi += (STORE_KEEPING_COST);
			}
			break;
		}		
		it++;
	}	
	Convert_DWORD_To_String(dwSpi, pDstSpi);		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void Convert_DWORD_To_String(DWORD dwNum, char* pDstSpi)
/// \brief		숫자를 문자로 변경
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::Convert_DWORD_To_String(DWORD dwNum, char* pDstSpi)
{
	char szSpiTmp[80], szSpiReverse[80];
	
	memset(szSpiTmp, 0x00, 80);
	memset(szSpiReverse, 0x00, 80);
	wsprintf(szSpiTmp, "%ld", dwNum);	
	int nIdx = strlen(szSpiTmp)-1;
	int nReversePos = 0;
	for(int nCnt = 0;nCnt < strlen(szSpiTmp);nCnt++)
	{
		if(nIdx < 0 || nReversePos >= 70)
		{
			break;
		}
		if((nCnt != 0)
			&&(0 == (nCnt %3)) )
		{
			szSpiReverse[nReversePos] = ',';
			nReversePos++;
		}
		szSpiReverse[nReversePos] = szSpiTmp[nIdx];
		nReversePos++;
		nIdx--;		
	}	
	
	nReversePos = strlen(szSpiReverse) - 1;
	for(nCnt = 0; nCnt < strlen(szSpiReverse); nCnt++)
	{
		if(nReversePos < 0)
		{
			break;
		}
		pDstSpi[nCnt] = szSpiReverse[nReversePos];
		nReversePos--;		
	}
	pDstSpi[nCnt] = '\0';	
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::OnCtrlBtnClick(BOOL bCtrlBtnClick)
/// \brief		컨트롤 키 클릭
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::OnCtrlBtnClick(BOOL bCtrlBtnClick)
{
	m_bCtrlBtnClick = bCtrlBtnClick;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::GetCtrlBtnClick()
/// \brief		컨트롤 키 버튼 클릭 여부 판단.
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::GetCtrlBtnClick()
{
	return m_bCtrlBtnClick;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템을 맡긴다. 
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartToStoreMultiItem()
{
	if(true == m_vecInvenStoreMultiSelectItem.empty())
	{			
		return;
	}	
	m_bStartMultiSell = TRUE;
	// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
	//ToStoreMultiOneItem();
	IntervalSellMutltiOneItem();
	// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템을 한개 씩 맡긴다. 
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ToStoreMultiOneItem()
{	
	if(true == m_vecInvenStoreMultiSelectItem.empty())
	{			
		return;
	}
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	if(NULL == pStore)
	{
		return;
	}
	deque<stMultiSelectItem>::iterator it = m_vecInvenStoreMultiSelectItem.begin();	

	// Lock 
	m_bRequestEnable = FALSE;

	// 2014-01-13 by ymjoo 외형 변경 컬렉션 예외처리 추가(외형 적용이 안되야 할 부분에 외형 적용이 안될 수 있도록)
//#ifdef C_STORE_COLLECTION_SHAPE_CHANGE_YMJOO
	CItemInfo* pItem = g_pStoreData->FindItemInInventoryByUniqueNumber(it->nUniqueNumber);
	if(pItem->FixedTermShape.nStatShapeItemNum && pItem->FixedTermShape.nStatLevel)
	{
		g_pStoreData->RqCollectionShapeChange(pItem->UniqueNumber, 0);
	}
//#endif
	// END 2014-01-13 by ymjoo 외형 변경 컬렉션 예외처리 추가(외형 적용이 안되야 할 부분에 외형 적용이 안될 수 있도록)

	{
		MSG_FC_STORE_MOVE_ITEM sMsg;
		sMsg.ItemUniqueNumber	= it->nUniqueNumber;
		sMsg.FromItemStorage	= ITEM_IN_CHARACTER;
		// 2006-09-14 by dgwoo 여단 창고 
		if(pStore->GetActTab() < SELECT_MODE)
		{
			//캐릭터 창고로 아이템 이동.			
			sMsg.ToItemStorage		= ITEM_IN_STORE;
		}
		else
		{
			// 여단 창고로 아이템 이동.			
			sMsg.ToItemStorage		= ITEM_IN_GUILD_STORE;
		}
		
		sMsg.Count = it->nAmount;
		g_pFieldWinSocket->SendMsg( T_FC_STORE_MOVE_ITEM, (char*)&sMsg, sizeof(sMsg) );			
	}

	// 가장 첫 대상을 제거한다.
	m_vecInvenStoreMultiSelectItem.pop_front();	

	if(true == m_vecInvenStoreMultiSelectItem.empty())
	{			
		// 더이상 팔 맡길 물건이 없을시 
		m_bStartMultiSell = FALSE;
		return;
	}
			
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void StoreMultiResponseOK()
/// \brief		맡기기 성공
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ToStoreMultiResponseOK()
{
	if(true == m_vecInvenStoreMultiSelectItem.empty())
	{
		// 더이상 팔 물건이 없어서 락 해제 		
		return;
	}	
	ToStoreMultiOneItem();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		bhsohn
/// \date		2007-02-15 ~ 2007-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ToStoreMultiItemError()
{	
	if(true == m_vecInvenStoreMultiSelectItem.empty())
	{			
		return;
	}	
	ToStoreMultiOneItem();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		bhsohn
/// \date		2007-02-15 ~ 2007-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::UpdateMutltiItemError()
{	
	if(FALSE == m_bStartMultiSell)
	{
		return;
	}
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}	
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		SellMutltiItemError();
	}
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		ToStoreMultiItemError();
	}	
}

void CAtumApplication::UpdateMultiResponseOK()
{		
	if(FALSE == m_bStartMultiSell)
	{		
		return;
	}

	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return;
	}	
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		SellMultiResponseOK();
	}
	else if(IS_STORE_SHOP_TYPE(nBuildingKind))
	{
		ToStoreMultiResponseOK();
	}	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템을 찾아온다.
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartFromStoreMultiItem()
{
	if(true == m_vecCityStoreMultiSelectItem.empty())
	{			
		return;
	}	
	m_bStartMultiStore = TRUE;
	// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
	//FromStoreMultiOneItem();
	IntervalSellMutltiOneItem();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템을 한개 씩 가져온다.
/// \author		bhsohn
/// \date		2007-02-21 ~ 2007-02-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FromStoreMultiOneItem()
{	
	if(true == m_vecCityStoreMultiSelectItem.empty())
	{		
		return;
	}
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	if(NULL == pStore)
	{
		return;
	}
	deque<stMultiSelectItem>::iterator it = m_vecCityStoreMultiSelectItem.begin();	

	// Lock 
	m_bRequestEnable = FALSE;
	
	{
		MSG_FC_STORE_MOVE_ITEM sMsg;
		sMsg.ItemUniqueNumber = it->nUniqueNumber;
		sMsg.ToItemStorage = ITEM_IN_CHARACTER;
		// 2006-09-14 by dgwoo 여단 창고.
		
		if(pStore->GetActTab() < SELECT_MODE)
		{// 창고에서 캐릭터로 아이템 이동.
			sMsg.FromItemStorage	= ITEM_IN_STORE;
			
		}else
		{// 여단 창고에서 캐릭터로 아이템 이동.
			sMsg.FromItemStorage		= ITEM_IN_GUILD_STORE;
		}
		sMsg.Count = it->nAmount;
		g_pFieldWinSocket->SendMsg( T_FC_STORE_MOVE_ITEM, (char*)&sMsg, sizeof(sMsg) );
	}

	// 가장 첫 대상을 제거한다.
	m_vecCityStoreMultiSelectItem.pop_front();	

	if(true == m_vecCityStoreMultiSelectItem.empty())
	{
		// 더이상 가져올 물건이 없을시 
		m_bStartMultiStore = FALSE;
		return;
	}
			
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void StoreMultiResponseOK()
/// \brief		가져오기 성공 성공
/// \author		bhsohn
/// \date		2007-02-14 ~ 2007-02-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FromStoreMultiResponseOK()
{
	if(true == m_vecCityStoreMultiSelectItem.empty())
	{
		// 더이상 팔 물건이 없어서 락 해제 		
		return;
	}	
	if(FALSE == m_bStartMultiStore)
	{
		return;
	}
	// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
	//FromStoreMultiOneItem();
	IntervalSellMutltiOneItem();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		bhsohn
/// \date		2007-02-15 ~ 2007-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FromStoreMultiItemError()
{	
	if(true == m_vecCityStoreMultiSelectItem.empty())
	{			
		return;
	}	
	if(FALSE == m_bStartMultiStore)
	{
		return;
	}
	FromStoreMultiOneItem();
	
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		선택한 창고가 꽉찼는지 체크한다.
/// \author		bhsohn
/// \date		2007-02-22 ~ 2007-02-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsCheckCityStoreFull()
{
	BOOL bFull = TRUE;

	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	if(NULL == pStore)
	{
		return bFull;
	}
	// 현재 창고의 남은 양
	int nFreeStroe = pStore->GetStoreFreeSize() - m_vecInvenStoreMultiSelectItem.size();
	if(nFreeStroe > 0)
	{
		bFull = FALSE;
	}
	return bFull;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		인벤이 꽉찼는지 체크
/// \author		bhsohn
/// \date		2007-02-22 ~ 2007-02-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsCheckInvenFull()
{
	BOOL bFull = TRUE;
	
	// 현재 창고의 남은 양
	int nFreeStroe = g_pGameMain->m_pInven->GetInvenFreeSize() - m_vecCityStoreMultiSelectItem.size();
	if(nFreeStroe > 0)
	{
		bFull = FALSE;
	}
	return bFull;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템을 맡길떄 사용 되는 돈 보다 현재 돈이 적냐?
/// \author		bhsohn
/// \date		2007-02-22 ~ 2007-02-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsCheckSPIEmpty()
{
	BOOL bEmpty = TRUE;	
	int nSpi = g_pGameMain->m_pInven->GetItemSpi();
	int nItemSelSize = m_vecInvenStoreMultiSelectItem.size() + 1;
	int nFreeSpi = 	nSpi - (nItemSelSize*STORE_KEEPING_COST);
	if(nFreeSpi >= 0)
	{
		bEmpty = FALSE;
	}
	return bEmpty;
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		길드 창고 시 대대원 이상만 창고에서 가져올수 있다.
/// \author		bhsohn
/// \date		2007-02-22 ~ 2007-02-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsCheckGuildStore()
{
	BOOL bStore = TRUE;
	CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
	if(NULL == pStore)
	{
		bStore = FALSE;
		return bStore;
	}
	if(pStore->GetActTab() >= SELECT_MODE)
	{	
		// 여단 창고로 아이템 이동.
		if(g_pGameMain->m_pCommunity->GetGuild()->GetMyGuildRank() == GUILD_RANK_PRIVATE_NULL)
		{
			bStore = FALSE;
		}		
	}	
	return bStore;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		다중 판매 0원인 Item은 삭제에서 이벤트를 날린다.
/// \author		// 2007-02-28 by bhsohn 다중 판매시 0 spi에 대한 처리
/// \date		2007-02-27 ~ 2007-02-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::UpdateMultiSellZeroSPIItem(UID64_t nUniqueNumber)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{		
		return;
	}			
	
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	
	if(IS_ITEM_SHOP_TYPE(nBuildingKind)
		|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
	{
		if(0 == m_struLastSelMultiItem.uSellingPrice
			&& nUniqueNumber == m_struLastSelMultiItem.nUniqueNumber)
		{
			// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
			//UpdateMultiResponseOK();										
			IntervalSellMutltiOneItem();
			// end 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
		}
	}
}

deque<stMultiSelectItem>* CAtumApplication::GetMultiSelVector(BYTE byType)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(pBuilding == NULL)
	{
		return NULL;
	}	
	if(ITEM_INVEN_POS == byType)
	{
		int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
		if(IS_ITEM_SHOP_TYPE(nBuildingKind)
			|| IS_WARPOINT_SHOP_TYPE(nBuildingKind))
		{
			return &m_vecSellMultiSelectItem;
		}
		else if(IS_STORE_SHOP_TYPE(nBuildingKind))
		{
			return &m_vecInvenStoreMultiSelectItem;		
		}
	}
	else if(ITEM_STORE_POS == byType)
	{
		return &m_vecCityStoreMultiSelectItem;
	}

	return NULL;
}

// by bhsohn 2007-03-12 China Working
void CAtumApplication::DxSetDialogBoxMode(BOOL bEnable)
{
	if(NULL == m_pd3dDevice)
	{
		return;
	}
	//m_pd3dDevice->SetDialogBoxMode(bEnable);
}

// 2007-04-02 by bhsohn Move패킷으로 적기 상태 체크
void CAtumApplication::UpdateEnemySkillState(bool bUseSkill, CUnitData* pUnit, ClientIndex_t	ClientIndex, INT ItemNum)
{
	if(NULL == pUnit)
	{
		return;
	}
	// 적기가 아니다. 
	if (!IS_CHARACTER_CLIENT_INDEX(ClientIndex))
	{
		return;
	}	
	int nIdx = -1;
	if(SKILL_BASE_NUM(ItemNum) == BGEAR_SKILL_BASENUM_INVISIBLE )
	{
		nIdx = UNIT_STATE_INVISIBLE;		
	}

	// 차징 샷 
	if(SKILL_BASE_NUM(ItemNum) == BGEAR_STATE_CHARINGSHOT)
	{
		nIdx = UNIT_STATE_CHARINGSHOT;		
	}

	if(SKILL_BASE_NUM(ItemNum) == AGEAR_STATE_HYPERSHOT)
	{
		nIdx = UNIT_STATE_HYPERSHOT;		
	}
	if(nIdx >= 0)
	{
		pUnit->SetUnitSkillState(nIdx, bUseSkill);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		맵 인덱스를 얻어온다. 
/// \author		// 2007-04-05 by bhsohn 맵로드시, 체크섬 추가
/// \date		2007-04-05 ~ 2007-04-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
MAP_CHANNEL_INDEX CAtumApplication::GetMyShuttleMapChannelIndex()
{
	return m_pShuttleChild->m_myShuttleInfo.MapChannelIndex;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		현재 있는 맵에 대한 정보
/// \author		// 2007-05-21 by bhsohn 아레나 맵에선 미션창 클릭 안되게 변경
/// \date		2007-05-21 ~ 2007-05-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
MAP_INFO* CAtumApplication::GetMyShuttleMapInfo()
{
	MAP_INFO* pMapInfo = g_pDatabase->GetMapInfo(g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex);

	return pMapInfo;
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::IsWarMotherShip()
/// \brief		
/// \author		dgwoo
/// \date		2007-10-08 ~ 2007-10-08
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsWarMotherShip()
{
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
//	if(g_pInterface->m_pGameMain->m_pUnitInfoBar->GetMotherShipInfl(MOTHERSHIP_INFLUENCE_VCN)
//		|| g_pInterface->m_pGameMain->m_pUnitInfoBar->GetMotherShipInfl(MOTHERSHIP_INFLUENCE_ANI))
	if(g_pGameMain->GetMotherShipInfl(MOTHERSHIP_INFLUENCE_VCN)
		|| g_pGameMain->GetMotherShipInfl(MOTHERSHIP_INFLUENCE_ANI))		
	{
		return TRUE;
	}
	return FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		현재 있는 맵에 대한 정보
/// \author		// 2007-05-17 by bhsohn 오브젝트 뒤에 숨었을시 에 대한 처 검사 처리
/// \date		2007-06-04 ~ 2007-06-04
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsMyShuttleCharacter()
{
	return m_bCharacter;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		알트텝 관련 버그 처리
/// \author		// 2007-06-18 by bhsohn 알트텝 관련 버그 처리
/// \date		2007-06-18 ~ 2007-06-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetKeyBoardLostDevice(BOOL bLostDevice)
{
	m_pKeyBoard->SetKeyBoardLostDevice(bLostDevice);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		알트텝 관련 버그 처리
/// \author		// 2007-07-11 by bhsohn omi 체크섬 추가
/// \date		2007-07-11 ~ 2007-07-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendOMICheckSum()
{
	char chFullMapPath[MAX_PATH], chMapIdx[64];	

	memset(chFullMapPath, 0x00, MAX_PATH);		
	memset(chMapIdx, 0x00, 64);
	
	wsprintf(chMapIdx, "omi.tex");
	strncpy(chFullMapPath, chMapIdx, MAX_PATH);

	g_pD3dApp->LoadPath( chFullMapPath, IDS_DIRECTORY_TEXTURE, chMapIdx);			
	
	
	// 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경
	int nFileSize = 0;

	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
//// 	UINT uiCheckSum = 0;
//// 	if(FALSE == g_pShuttleChild->GetCheckSum(&uiCheckSum, &nFileSize, chFullMapPath))
// 
// 	BYTE checkSum[32];
// 	if(FALSE == g_pShuttleChild->GetCheckSum(checkSum, &nFileSize, chFullMapPath))
// 	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 
// 	{
// 		SendMessage( g_pD3dApp->GetHwnd(), WM_CLOSE, 0, 0 );
// 		return;
// 	}	
	// end 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경

#ifdef CHECK_SUM_ON
	INIT_MSG_WITH_BUFFER(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM, T_FC_INFO_CHECK_RESOBJ_CHECKSUM, pSMsg, SendBuf);
	
	pSMsg->nItemNum0	= 0;
	strncpy(pSMsg->szObjFileName, chMapIdx, SIZE_MAX_RESOBJ_FILE_NAME);

	// 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경

// 	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 	//pSMsg->uiCheckSum0 = uiCheckSum;
// 	memcpy(pSMsg->byDigest, checkSum, sizeof(checkSum));
// 	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 
// 	pSMsg->nFileSize0 = nFileSize;

	memcpy(pSMsg->byDigest, m_nOMICheckSum, sizeof(m_nOMICheckSum));
	pSMsg->nFileSize0	= m_nOMIFileSize;

	// end 2009. 06. 09 by ckPark OMI 게임 시작시 체크섬 계산하도록 변경

	m_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM));	
#endif
}

// 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
void	CAtumApplication::SendInterfaceCheckSum( void )
{
#ifdef CHECK_SUM_ON
	INIT_MSG_WITH_BUFFER(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM, T_FC_INFO_CHECK_RESOBJ_CHECKSUM, pSMsg, SendBuf);

	pSMsg->nItemNum0	= 0;
	strncpy(pSMsg->szObjFileName, "interface.tex", SIZE_MAX_RESOBJ_FILE_NAME);

	memcpy(pSMsg->byDigest, m_nInterfaceCheckSum, sizeof(m_nInterfaceCheckSum));
	pSMsg->nFileSize0	= m_nInterfaceFileSize;

	m_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM));
#endif
}
// end 2010. 03. 12 by ckPark Interface.tex 체크섬 추가

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 나레이션 mp3플레이
/// \author		// 2007-07-24 by bhsohn 나레이션 mp3추가
/// \date		2007-07-24 ~ 2007-07-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::PlayNarrationSound()
{
	// 2009-05-06 by bhsohn 나레이션 시스템 변경
    // 2010. 10. 05 by jskim 맵로딩 구조 변경
	//if((GetGameState() == _MAPLOAD) || (m_pMapInitThread && m_pMapInitThread->m_bRunning))
    if((GetGameState() == _MAPLOAD)  || (m_pMaploading && m_pMaploading->GetMapRunning()))
    // end 2010. 10. 05 by jskim 맵로딩 구조 변경 
	{
		// 맵쓰레드 중이다.
		return;
	}
	// end 2009-05-06 by bhsohn 나레이션 시스템 변경
	if(strlen(m_chNarrationSound) > 1)
	{
		// 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리
		//m_pSound->PlayNarrationSound(m_chNarrationSound);
		if(!m_pSound->PlayNarrationSound(m_chNarrationSound))
		{
			if(strlen(m_chErNarrationSound) > 1)
			{
				// 사운드 오픈 실패스 처리
				strncpy(m_chNarrationSound, m_chErNarrationSound, strlen(m_chErNarrationSound)+1);
				m_pSound->PlayNarrationSound(m_chNarrationSound);				
				ZERO_MEMORY(m_chErNarrationSound);
			}			
		}
		
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 나레이션 mp3플레이 정보 변경 
/// \author		// 2007-07-24 by bhsohn 나레이션 mp3추가
/// \date		2007-07-24 ~ 2007-07-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartNarrationSound(char* pNarrationSound, char* pErNarrationSound/*=NULL*/)
{
	memset(&m_chNarrationSound, 0x00, 256);	
	// 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리
	memset(&m_chErNarrationSound, 0x00, 256);	
	
	if(strlen(pNarrationSound) > 1)
	{
		strncpy(m_chNarrationSound, pNarrationSound, strlen(pNarrationSound)+1);
		// 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리
		if(pErNarrationSound)
		{
			strncpy(m_chErNarrationSound, pErNarrationSound, strlen(pErNarrationSound)+1);
		}
		// end 2009-01-23 by bhsohn 나레이션 에러시 대한 처리
	}
}

void CAtumApplication::EndNarrationSound()
{
	// 프리스카 맵 설명 완료후 	
	CompleteNarrationSound(m_chNarrationSound);	

	memset(&m_chNarrationSound, 0x00, 256);	
	// 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리
	memset(&m_chErNarrationSound, 0x00, 256);			
	// end 2009. 01. 22 by ckPark 각 세력별 오퍼레이터 MP3 분리

	m_pSound->EndNarrationSound();	
}

void CAtumApplication::CompleteNarrationSound(char* pNarrationMusic)
{
	// 프리스카 맵 설명 완료후 
	if(0 == strncmp(pNarrationMusic, "op_map_free6", strlen(pNarrationMusic)+1))
	{
		g_pInterface->CloseFirstUserExplain();
	}		
}
void CAtumApplication::SetFirstUserIntoFreeSka(BOOL bTake)
{
	if(NULL == g_pTutorial)
	{
		return;
	}
	g_pTutorial->SetFirstUserIntoFreeSka(bTake);	
}
BOOL CAtumApplication::GetFirstUserIntoFreeSka()
{
	if(NULL == g_pTutorial)
	{
		return FALSE;
	}
	return g_pTutorial->GetFirstUserIntoFreeSka();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
/// \date		2007-08-03 ~ 2007-08-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::SendMeshObjectCheckSum(int nMeshIndex)
{
	BOOL bCharcter = FALSE;
	switch(nMeshIndex)
	{
	case 20000000:						// 여자		
	case 20000100:		
	case 20000200:		
	case 20000300:		
	case 20000400:		
	case 20010000:						// 남자		
	case 20010100:		
	case 20010200:								
	case 20010300:								
	case 20010400:						
		{
			bCharcter = TRUE;
		}
		break;
		// 2007-11-05 by bhsohn 몬스터 오브젝트 체크섬 처리
//	default:
//		{
//			return FALSE;
//		}
//		break;
		// end 2007-11-05 by bhsohn 몬스터 오브젝트 체크섬 처리
	}
	if(FALSE == bCharcter 
		&& (FALSE == IsMeshMonsterObject(nMeshIndex)))
	{
		return FALSE;
	}
// 2008-07-02 by dgwoo 맵 이동시마다 체크섬으로 체크(한번갔다온후 몬스터 오브젝트 교체 가능)
//	vector<int>::iterator itCharacter = m_vecSendCharacterOmiInfo.begin();
//	if(itCharacter != m_vecSendCharacterOmiInfo.end())
//	{
//		if((*itCharacter) == nMeshIndex)
//		{
//			// 이미 보낸 메시다.
//			return TRUE;
//		}
//		itCharacter++;
//	}
//	m_vecSendCharacterOmiInfo.push_back(nMeshIndex);
// 2008-07-02 by dgwoo 맵 이동시마다 체크섬으로 체크(한번갔다온후 몬스터 오브젝트 교체 가능)

	char buf[16];
	char strPath[MAX_PATH];
	wsprintf(buf,"%08d.obj",nMeshIndex);
	g_pD3dApp->LoadPath(strPath, IDS_DIRECTORY_OBJECT, buf);

	int nFileSize = 0;

	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 	UINT uiCheckSum = 0;
// 	if(FALSE == g_pShuttleChild->GetCheckSum(&uiCheckSum, &nFileSize, strPath))
	
	BYTE checkSum[32];
	if(FALSE == g_pShuttleChild->GetCheckSum(checkSum, &nFileSize, strPath))
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템

	{		
		return TRUE;
	}	
	
#ifdef CHECK_SUM_ON
	INIT_MSG_WITH_BUFFER(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM, T_FC_INFO_CHECK_RESOBJ_CHECKSUM, pSMsg, SendBuf);
	
	pSMsg->nItemNum0	= 0;
	strncpy(pSMsg->szObjFileName, buf, SIZE_MAX_RESOBJ_FILE_NAME);

	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
	memcpy(pSMsg->byDigest, checkSum, sizeof(checkSum));
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템

	pSMsg->nFileSize0 = nFileSize;	

	m_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM));	
#endif 
	return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-05 by bhsohn 몬스터 오브젝트 체크섬 처리
/// \date		2007-11-05 ~ 2007-11-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::IsMeshMonsterObject(int nMeshIndex)
{
	if(nMeshIndex >= 2000000 && nMeshIndex < 3000000)
	{
		return TRUE;
	}
	return FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
/// \date		2007-08-03 ~ 2007-08-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::ResetCharecterOmiInfo()
{	
	m_vecSendCharacterOmiInfo.clear();
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			g_pScene->ReLoadEnemyRenderList();
/// \brief		
/// \author		// 2007-08-03 by bhsohn 캐릭터 오브젝트 체크썸 보냄
/// \date		2007-08-03 ~ 2007-08-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::ReLoadEnemyRenderList()
{
	g_pScene->ReLoadEnemyRenderList();		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::IsPrimiumUser()
/// \brief		프리미엄 유저인지 체크
/// \author		// 2007-09-06 by bhsohn 프리미엄 유저는 총알수 2배
/// \date		2007-09-06 ~ 2007-09-06
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::IsPrimiumUser()
{
	// 프리미엄 유저인지 체크
	if(0 == g_pD3dApp->GetPrimiumCardInfo()->nCardItemNum1)	
	{
		return FALSE;
	}
	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-05 ~ 2007-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::EnableChatMode(BOOL bChat, BOOL bUpdatIMEDevice)
{
	m_bChatMode = bChat;
	// 2009-01-12 by bhsohn Japan Working
#ifdef IS_USE_ONOFF_IME
//#ifdef LANGUAGE_CHINA
	if(bUpdatIMEDevice)
	{
		m_inputkey.EnableIMEControl(m_bChatMode);	
	}
#endif
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::IsMyShuttleLeader()
/// \brief		내가 지도자냐?
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-05 ~ 2007-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::IsMyShuttleLeader()
{
	BOOL bLeader = FALSE;
	if(COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER))
	{
		bLeader = TRUE;
	}
	return bLeader;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::IsMyShuttleGuildMaster()
/// \brief		내가 길드 마스트터냐?
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-05 ~ 2007-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::IsMyShuttleGuildMaster()
{
	BOOL bGuildMaster = FALSE;
	CINFCommunityGuild* pGuild = g_pGameMain->m_pCommunity->GetGuild();	
	if(NULL == pGuild)
	{
		return bGuildMaster;
	}

	if(pGuild->GetMyGuildRank() == GUILD_RANK_COMMANDER)
	{
		bGuildMaster = TRUE;
	}
	return bGuildMaster;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::IsLeaderOutPost()
/// \brief		지도자 공지사항이냐?
/// \author		// 2007-09-05 by bhsohn 전진 기지전
/// \date		2007-09-05 ~ 2007-09-05
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::IsLeaderOutPost()
{
	// 맵번호로 지도자 공지사항인지 아닌지 판단한다.
	CHARACTER myShuttle = m_pShuttleChild->GetMyShuttleInfo();
	if(IS_OUTPOST_CITY_MAP_INDEX(myShuttle.MapChannelIndex.MapIndex))
	{
		return FALSE;
	}
	return TRUE;

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			BYTE CAtumApplication::IsUseSecondaryPasswordSystem()
/// \brief		
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BYTE CAtumApplication::IsUseSecondaryPasswordSystem()
{
	return m_bIsUseSecondaryPasswordSystem;	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BYTE CAtumApplication::IsSetSecondaryPassword()
/// \brief		
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BYTE CAtumApplication::IsSetSecondaryPassword()
{
	return m_bIsSetSecondaryPassword;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BYTE CAtumApplication::IsSecondPassLock()
/// \brief		
/// \author		// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
/// \date		2008-07-07 ~ 2008-07-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BYTE CAtumApplication::IsSecondPassLock()
{
	return m_bSecondPassLock;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BYTE CAtumApplication::IsSecondPassLock()
/// \brief		
/// \author		// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
/// \date		2008-07-07 ~ 2008-07-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::SetSecondPassLock(BYTE bySecondPassLock)
{
	m_bSecondPassLock = bySecondPassLock;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::EnterLock(BOOL bUnLock)
/// \brief		통신 락 관련 처리
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::EnterLock(BOOL bUnLock)
{
	// FALSE :Lock  TRUE : UnLock
	m_bRequestEnable = bUnLock;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CAtumApplication::EnterLock(BOOL bUnLock)
/// \brief		통신 락 관련 처리
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
BOOL CAtumApplication::GetEnterLock()
{
	return m_bRequestEnable;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		2차 패스 워드 맞음.
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
VOID CAtumApplication::FieldSocketInfoSecondarypasswordCheckPassword(BOOL bSuccess)
{
	// UnLock
	EnterLock(TRUE);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		케릭터 삭제 요청
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
void CAtumApplication::SendDeleteCharcter(char* pEncordPassWord)
{
	MSG_FC_CHARACTER_DELETE sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	char buffer[SIZE_MAX_PACKET];
	sMsg.AccountUniqueNumber = g_pD3dApp->m_accountUniqueNumber;
	int select = g_pSelect->GetCurrentSelectIndex();
	sMsg.CharacterUniqueNumber = g_pD3dApp->m_pInterface->m_pSelect->m_character[select].CharacterUniqueNumber;

	strncpy(sMsg.CurrentSecPassword, pEncordPassWord, SIZE_MAX_PASSWORD_MD5_STRING);

	int nType = T_FC_CHARACTER_DELETE;
	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
	m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));
	
	// Lock
	EnterLock(FALSE);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSecondLockOk(MSG_FC_INFO_SECONDARYPASSWORD_LOCK_OK* pMsg)
/// \brief		2차 패스 워드 락 
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
VOID CAtumApplication::FieldSecondLockOk(MSG_FC_INFO_SECONDARYPASSWORD_LOCK_OK* pMsg)
{
	g_pGameMain->FieldSecondLockOk(pMsg->bIsUnlockFlag, TRUE);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketSecondPasswordUpdateOk(BOOL bSuccess)
/// \brief		2차 패스 워드 업데이트
/// \author		// 2007-09-12 by bhsohn 2차 암호 시스템 구현
/// \date		2007-09-12 ~ 2007-09-12
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////	
VOID CAtumApplication::FieldSocketSecondPasswordUpdateOk(BOOL bSuccess)
{
	BOOL bFirstUseSecondPassword = FALSE;
	// 패스워드업데이트 성공이면 
	if(bSuccess )
	{
		if(FALSE == IsSetSecondaryPassword())
		{
			// 처음으로 2차 패스워드 모드 사용
			m_bIsSetSecondaryPassword = TRUE;
			bFirstUseSecondPassword = TRUE;

			// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
			m_bSecondPassLock = m_bIsSetSecondaryPassword;
		}
		else if(SECURITY_MODE_PASS_SENCOND_CANCEL == g_pGameMain->GetPassChangeMode())
		{
			m_bIsSetSecondaryPassword = FALSE;
			
			// 2008-07-07 by bhsohn 2차 패스워드 활성화시, 인벤 안열리게 함
			m_bSecondPassLock = m_bIsSetSecondaryPassword;
		}		
	}	
	g_pGameMain->FieldSocketSecondPasswordUpdateOk(bSuccess, bFirstUseSecondPassword);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOKHeader(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK_HEADER* pMsg)
/// \brief		
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOKHeader(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK_HEADER* pMsg)
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	g_pD3dApp->m_bRequestEnable = FALSE;
	pCityLeader->ClearCandidateList();
	pCityLeader->SetCandidate(pMsg->RegLeaderCandidate);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOK(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK* pMsg);
/// \brief		요청 리스트가 안전히 전달되었을경우.
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOK(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_LIST_OK* pMsg)
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->AddCandidateList(pMsg);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOKDone()
/// \brief		
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateListOKDone()
{
	g_pD3dApp->m_bRequestEnable = TRUE;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->AddCandidateListDone();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateInfoOK(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK* pMsg);
/// \brief		후보 정보 
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateInfoOK(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK* pMsg)
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->SetCandidateInfo(pMsg);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateInfoOkGuildMark(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK_GUILDMARK* pMsg)
/// \brief		여단 마크의 용량이 크므로 프로토콜을 따로 받는다.
/// \author		dgwoo
/// \date		2007-11-01 ~ 2007-11-01
/// \warning	여단의 유저가 없을경우에도 여단 마크를 받아오는 프로토콜로 사용시 셋팅하는 함수를 꼭 
///             호출하여 갱신된 여단마크로 변경해줘야한다.
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestLeaderCandidateInfoOkGuildMark(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK_GUILDMARK* pMsg)
{
	char *p = (char*)pMsg;
	p += sizeof(MSG_FC_CITY_POLL_REQUEST_LEADER_CANDIDATE_INFO_OK_GUILDMARK);
	g_pDatabase->UpdateGuildMark(pMsg->GuildUID,0,p,pMsg->GuildMarkSize);
//	g_pInterface->SetGuildMark(pMsg->GuildUID);
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->SetCandidateInfoGuildMark(pMsg->GuildUID);

}

VOID CAtumApplication::FieldSocketInfoGetGuildMarkOK(MSG_FC_INFO_GET_GUILDMARK_OK*pMsg)
{
	char *p = (char*)pMsg;
	p += sizeof(MSG_FC_INFO_GET_GUILDMARK_OK);
	g_pDatabase->UpdateGuildMark(pMsg->GuildUID,0,p,pMsg->GuildMarkSize);
	g_pInterface->SetGuildMark(pMsg->GuildUID);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRegLeaderCandidateOK();
/// \brief		후보 등록.
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRegLeaderCandidateOK(MSG_FC_CITY_POLL_REG_LEADER_CANDIDATE_OK * pMsg)
{
	char strbuf[256];
	if(IS_ANI_INFLUENCE_TYPE(g_pShuttleChild->GetMyShuttleInfo().InfluenceType))
	{
		wsprintf(strbuf,STRCMD_ANI_INFLUENCE_LEADER);
	}
	else if(IS_VCN_INFLUENCE_TYPE(g_pShuttleChild->GetMyShuttleInfo().InfluenceType))
	{
		wsprintf(strbuf,STRCMD_VCN_INFLUENCE_LEADER);
	}
	else
	{
		return;
	}
	wsprintf(strbuf,STRMSG_C_071029_0103,strbuf);//"%s 후보 출마 신청이 완료되었습니다."
	m_pChat->CreateChatChild(strbuf,COLOR_ITEM);

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->PollRegLeaderCandidateOk(pMsg->LeaderCandidateNum);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollDeleteLeaderCandidateOK();
/// \brief		후보 탈퇴.
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollDeleteLeaderCandidateOK()
{	char strbuf[256];
	if(IS_ANI_INFLUENCE_TYPE(g_pShuttleChild->GetMyShuttleInfo().InfluenceType))
	{
		wsprintf(strbuf,STRCMD_ANI_INFLUENCE_LEADER);
	}
	else if(IS_VCN_INFLUENCE_TYPE(g_pShuttleChild->GetMyShuttleInfo().InfluenceType))
	{
		wsprintf(strbuf,STRCMD_VCN_INFLUENCE_LEADER);
	}
	else
	{
		return;
	}
	wsprintf(strbuf,STRMSG_C_071029_0105,strbuf);//"%s 후보 탈퇴가 완료되었습니다."
	m_pChat->CreateChatChild(strbuf,COLOR_ITEM);
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->DeleteCandidateOk();
	
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollRequestPollDateOK(MSG_FC_CITY_POLL_REQUEST_POLL_DATE_OK* pMsg)
/// \brief		선거 일정.
/// \author		dgwoo
/// \date		2007-10-29 ~ 2007-10-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollRequestPollDateOK(MSG_FC_CITY_POLL_REQUEST_POLL_DATE_OK* pMsg)
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	pCityLeader->SetPollDate(pMsg);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketCityPollVoteOK()
/// \brief		투표가 완료되었습니다.
/// \author		dgwoo
/// \date		2007-11-02 ~ 2007-11-02
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollVoteOK()
{
	m_pChat->CreateChatChild(STRMSG_C_071029_0109,COLOR_ITEM);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketShopCheckGiveTargetOK(MSG_FC_SHOP_CHECK_GIVE_TARGET_OK* pMsg)
/// \brief		선물하기 준비 완료.
/// \author		dgwoo
/// \date		2007-11-15 ~ 2007-11-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketShopCheckGiveTargetOK(MSG_FC_SHOP_CHECK_GIVE_TARGET_OK* pMsg)
{
	m_bRequestEnable = TRUE;
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CASH_SHOP);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	CINFCityCashShop* pCityLeader = ((CINFCityCashShop*)it->second);
	pCityLeader->SendMsgGift(pMsg);
}

VOID CAtumApplication::FieldSocketShopBuyCashItemOK(MSG_FC_SHOP_BUY_CASH_ITEM_OK* pMsg)
{
	m_bRequestEnable =TRUE;

	// 2010. 01. 27 by ckPark 캐쉬 아이템 한정 판매 시스템
 	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CASH_SHOP);
	if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() )
	{
		((CINFCityCashShop*)((*it).second))->UpdateCashItemRemainCount( pMsg->ItemNum, pMsg->RemainCountForLimitedEdition );
	}
	// end 2010. 01. 27 by ckPark 캐쉬 아이템 한정 판매 시스템
}
#ifdef C_EPSODE4_UI_CHANGE_JSKIM					        // 2011. 10. 10 by jskim UI시스템 변경
VOID	CAtumApplication::FieldSocketShopBuyItemUpdate(MSG_FC_SHOP_BUY_ITEM_UPDATE* pMsg)
{

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_TRIGGER_CRYSTAL);
	
	if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() )
	{
	
		((CINFCityShop*)((*it).second))->UpdateItemRemainCount(pMsg->ItemNum, pMsg->RemainCountForLimitedEdition );
	}

}

#endif

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketCityPollLeaderElectionInfo(MSG_FC_CITY_POLL_LEADER_ELECTION_INFO* pMsg);
/// \brief		투표가 끝나고 결과정보를 프로토콜.
/// \author		dgwoo
/// \date		2007-11-16 ~ 2007-11-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityPollLeaderElectionInfo(MSG_FC_CITY_POLL_LEADER_ELECTION_INFO* pMsg)
{
	if(g_pInterface)
	{
		vector<string> vecStr;
		char buf[SIZE_MAX_STRING_512];
		wsprintf(buf,STRMSG_C_071116_0100);
		m_pChat->CreateChatChild(buf,COLOR_VOIP);
		vecStr.push_back(buf);

		memset(buf,0x00,SIZE_MAX_STRING_512);
		
		wsprintf(buf,STRMSG_C_071116_0101,pMsg->LeaderCandidateNum,pMsg->GuildName,pMsg->CharacterName,pMsg->Percent);
		m_pChat->CreateChatChild(buf,COLOR_ITEM);
		vecStr.push_back(buf);

		g_pInterface->ShowOpWndMultiTxt(&vecStr);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketEventNotifyMsgGetOK(MSG_FC_EVENT_NOTIFY_MSG_GET_OK* pMsg)
/// \brief		
/// \author		dgwoo
/// \date		2007-11-28 ~ 2007-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketEventNotifyMsgGetOK(MSG_FC_EVENT_NOTIFY_MSG_GET_OK* pMsg)
{
	switch(pMsg->NotifyMsgType)
	{
	case NOTIFY_MSG_TYPE_TEXT:
		{
			if(m_pChat)
			{
				m_pChat->CreateChatChild(pMsg->NotifyMsgString,COLOR_ITEM);
			}
			if(IS_VALID_UNIQUE_NUMBER(pMsg->CharacterUID))
			{
				MSG_FC_EVENT_NOTIFY_MSG_DELETE sMsg;
				sMsg.NotifyMsgUID = pMsg->NotifyMsgUID;
				g_pFieldWinSocket->SendMsg(T_FC_EVENT_NOTIFY_MSG_DELETE,(char*)&sMsg,sizeof(sMsg));
			}
		}
		break;
	case NOTIFY_MSG_TYPE_RECV_GIFT:
		{// 선물이 있을경우.
			if(g_pInterface != NULL &&
				g_pInterface->m_pGameMain != NULL)
			{
				CINFGameMainUnitInfoBar* pInfoBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
				if(pInfoBar == NULL)
					break;
				pInfoBar->AddGiftMsg(pMsg->NotifyMsgUID,pMsg->CharacterUID,pMsg->NotifyMsgString);
			}
			


		}
		break;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketCityWarInfoInfluenceOK(MSG_FC_CITY_WARINFO_INFLUENCE_OK* pMsg);
/// \brief		세력전의 정보.
/// \author		dgwoo
/// \date		2007-12-03 ~ 2007-12-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityWarInfoInfluenceOK(MSG_FC_CITY_WARINFO_INFLUENCE_OK* pMsg)
{
	CMapCityShopIterator it = NULL;
	if(IS_OUTPOST_CITY_MAP_INDEX(g_pShuttleChild->GetMyShuttleInfo().MapChannelIndex.MapIndex))
		it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_OUTPOST);
	else
		it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}

	if(IS_OUTPOST_CITY_MAP_INDEX(g_pShuttleChild->GetMyShuttleInfo().MapChannelIndex.MapIndex))
	{
		CINFCityOutPost * pCityLeader = ((CINFCityOutPost*)it->second);
		pCityLeader->SetWarInfoInfluence(pMsg);
	}
	else
	{
		CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
		pCityLeader->SetWarInfoInfluence(pMsg);
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID	FieldSocketCityWarInfoOutPostOK(MSG_FC_CITY_WARINFO_OUTPOST_OK * pMsg);
/// \brief		전진기지전의 정보.
/// \author		dgwoo
/// \date		2007-12-03 ~ 2007-12-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketCityWarInfoOutPostOK(MSG_FC_CITY_WARINFO_OUTPOST_OK * pMsg)
{
	CMapCityShopIterator it = NULL;
	if(IS_OUTPOST_CITY_MAP_INDEX(g_pShuttleChild->GetMyShuttleInfo().MapChannelIndex.MapIndex))
		it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_OUTPOST);
	else
		it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CITYLEADER_LEADER);
	
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() ||
		it->second == NULL)
	{
		return;
	}
	if(IS_OUTPOST_CITY_MAP_INDEX(g_pShuttleChild->GetMyShuttleInfo().MapChannelIndex.MapIndex))
	{
		CINFCityOutPost * pCityLeader = ((CINFCityOutPost*)it->second);
		pCityLeader->ClearOutPostInfo();
		SCITY_WARINFO_OUTPOST *pOutPost = (SCITY_WARINFO_OUTPOST*)((char*)pMsg + sizeof(MSG_FC_CITY_WARINFO_OUTPOST_OK));
		for(int i = 0; i < pMsg->CityWarInfoOutpostListCount; i++)
		{
			pCityLeader->AddOutPostInfo(pOutPost);
			pOutPost++;
		}
	}
	else
	{
		CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
		pCityLeader->ClearOutPostInfo();
		SCITY_WARINFO_OUTPOST *pOutPost = (SCITY_WARINFO_OUTPOST*)((char*)pMsg + sizeof(MSG_FC_CITY_WARINFO_OUTPOST_OK));
		for(int i = 0; i < pMsg->CityWarInfoOutpostListCount; i++)
		{
			pCityLeader->AddOutPostInfo(pOutPost);
			pOutPost++;
		}
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketQuestRequestMissionMasterHelpInvite(MSG_FC_QUEST_REQUEST_MISSIONMASTER_HELP_INVITE* pMsg)
/// \brief		미션마스터가 헬프자로부터 요청을 수락했을경우.
/// \author		dgwoo
/// \date		2008-12-09 ~ 2008-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestRequestMissionMasterHelpInvite(MSG_FC_QUEST_REQUEST_MISSIONMASTER_HELP_INVITE* pMsg)
{
	char Buff[512];
	wsprintf(Buff,STRMSG_C_081202_0105,pMsg->CharacterName);

	g_pShuttleChild->m_pClientParty->SetMissionMasterPartyID(pMsg->PartyID);
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(Buff,_Q_MISSION_MASTER_HELPER,10,STRMSG_C_060724_0000,0,0,pMsg->CharacterUID);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketQuestMissionMasterHelpInviteOK(MSG_FC_QUEST_MISSIONMASTER_HELP_INVITE_OK* pMsg)
/// \brief		헬프자의 요청에 미션마스터가 수락했다고 헬프자에게 정보를 줌.
/// \author		dgwoo
/// \date		2008-12-09 ~ 2008-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestMissionMasterHelpInviteOK(MSG_FC_QUEST_MISSIONMASTER_HELP_INVITE_OK* pMsg)
{
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			VOID CAtumApplication::FieldSocketQuestMissionMasterHelpRejectOK(MSG_FC_QUEST_MISSIONMASTER_HELP_REJECT_OK* pMsg)
/// \brief		미션 마스터가 헬프자의 요청에 거절.
/// \author		dgwoo
/// \date		2008-12-09 ~ 2008-12-09
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketQuestMissionMasterHelpRejectOK(MSG_FC_QUEST_MISSIONMASTER_HELP_REJECT_OK* pMsg)
{
	char Buff[512];
	wsprintf(Buff,STRMSG_C_081202_0106,pMsg->CharacterName);
	m_pChat->CreateChatChild(Buff ,COLOR_SYSTEM);		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
/// \date		2007-11-20 ~ 2007-11-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ConnectLoginIMServer(char* pUserId,char* pCharacterName, char* pUserPassWord)
{
	if(m_pInterface->m_pMapLoad->GetLoginChatMode() != IM_SERVER_STATE_NOT_LOGIN)
	{
		// Error 이다.
		 return;		
	}
	MSG_IC_CONNECT_LOGIN iMsg;
	memset(&iMsg,0x00,sizeof(iMsg));
	char buffer[SIZE_MAX_PACKET];
	strcpy(iMsg.AccountName,pUserId);
	strcpy(iMsg.CharacterName, pCharacterName);
	iMsg.LoginType = CHAT_LOGIN_TYPE_GAME;
	strcpy(iMsg.Password,pUserPassWord);
	memset(iMsg.ServerName,0x00,SIZE_MAX_SERVER_NAME);
	int nType = T_IC_CONNECT_LOGIN;
	memcpy(buffer,&nType,SIZE_FIELD_TYPE_HEADER);
	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &iMsg, sizeof(iMsg));
	m_pIMSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(iMsg));

	m_pInterface->m_pMapLoad->SetLoginChatMode(IM_SERVER_STATE_TRY_LOGIN);
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
/// \date		2007-11-20 ~ 2007-11-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendGameStart(ClientIndex_t	ClientIndex, UID32_t CharacterUniqueNumber)
{
	if((m_pInterface->m_pMapLoad->GetLoginChatMode() != IM_SERVER_STATE_SUCCESS_LOGIN)
		||(TRUE == m_pInterface->m_pMapLoad->IsMapLoad()))
	{
		// Error 이다.
		 return;		
	}

	MSG_FC_CHARACTER_GAMESTART sMsg;
	memset(&sMsg,0x00,sizeof(sMsg));
	char buffer[SIZE_MAX_PACKET];
	sMsg.ClientIndex = ClientIndex;
	sMsg.CharacterUniqueNumber = CharacterUniqueNumber;
	int nType = T_FC_CHARACTER_GAMESTART;
	memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sMsg, sizeof(sMsg));
	g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sMsg));

//	서버 시간 요청 // 2008-04-02 by dgwoo 시간정보를 GameStartOK에서 요청하던걸 로긴에서 처리.
//	g_pFieldWinSocket->SendMsg(T_FC_INFO_GET_SERVER_DATE_TIME, NULL, 0);

	m_pInterface->m_pMapLoad->SetLoginChatMode(IM_SERVER_STATE_READY_FOR_GAMESTART);	
	m_pInterface->m_pMapLoad->SetMapLoad(TRUE);	

	// Lock을 건다. 
	EnterLock(FALSE);// FALSE :Lock  	

	// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성	
	
	// 기본 게임정보 초기화
	InitMultiLockInfo();
	{
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();
		vecUnLockMsg.push_back(T_FC_SKILL_SETUP_SKILL_OK_DONE);
		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_DONE);
		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT_DONE);
		vecUnLockMsg.push_back(T_FC_ITEM_PUT_ENCHANT_DONE);
		// 모두다 매칭 되어야 락이 풀린다. 
		EnterMultiLock(TRUE, T_FC_CHARACTER_GAMESTART, vecUnLockMsg, MULTI_LOCK_ALL_MATCHING);
	}	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
/// \date		2007-12-21 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::InitMultiLockInfo()
{
	//memset(&m_struBasicGameInfo, 0x00, sizeof(stBasicGameInfo));
	m_vecLockProtocol.bFiledServer = FALSE;
	m_vecLockProtocol.nLockMsg = 0;
	m_vecLockProtocol.nLockType = 0;
	m_vecLockProtocol.vecUnLockMsg.clear();
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		Lock을 할지 말지 여부 판단.
/// \author		// 2007-12-17 by bhsohn 아이템 정보가 다 안오면 게임 대기상태로
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsLockMode()
{
	BOOL bLock = TRUE;
	// FALSE :Lock  TRUE : UnLock
	BOOL bEnterLock = GetEnterLock();
	DWORD dwGameState = GetGameState();
	switch(dwGameState)
	{
	case _GAME:
	case _SHOP:
		{
			// 게임 시작 프로토콜
			if(!bEnterLock || (0 != m_vecLockProtocol.nLockMsg))
			{
				bLock = FALSE;
			}			
		}
		break;
	default:
		{
			bLock = bEnterLock;
		}
		break;
	}	
	return bLock;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		프로그램 다중 락에 들어감
/// \author		// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
/// \date		2007-12-21 ~ 2007-12-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::EnterMultiLock(BOOL bFiledServer, MessageType_t nLockMsg, vector<MessageType_t> vecUnLockMsg, int nLockType)
{
	if(0 != m_vecLockProtocol.nLockMsg)
	{
		// 현재 락이 걸려있는 상태이므로 치명적이다.
		char chLock[1024];
		wsprintf(chLock, "Pre[%s] Lock[%s]", GetProtocolTypeString(m_vecLockProtocol.nLockMsg), GetProtocolTypeString(nLockMsg));
		DbgOut(chLock);
		g_pD3dApp->NetworkErrorMsgBox(STRMSG_C_071221_0201);
		return;
	}	
	char chMultiLock[512];
	memset(chMultiLock, 0x00,512);
	sprintf(chMultiLock, "MultiLock:[%s]\n", GetProtocolTypeString(nLockMsg));
	DBGOUT(chMultiLock);

	// 2007-11-22 by bhsohn 아레나 통합서버
	// 필드 서버 여부
	m_vecLockProtocol.bFiledServer = bFiledServer;
	// end 2007-11-22 by bhsohn 아레나 통합서버
	// Lock메시지
	m_vecLockProtocol.nLockMsg = nLockMsg;
	// UnLock 메시지
	m_vecLockProtocol.vecUnLockMsg = vecUnLockMsg;
	// Lock타입
	m_vecLockProtocol.nLockType = nLockType;
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		락을 풀지 말지 결정
/// \author		// 2007-12-21 by bhsohn 프로그램 다중 락 구조 생성
/// \date		2007-12-21 ~ 2007-12-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::CheckMultiLock(BOOL bFiledServer, MessageType_t msgUnLockMsg)
{
	if(0 == m_vecLockProtocol.nLockMsg)
	{
		return;
	}
	// 2007-11-22 by bhsohn 아레나 통합서버
	// IM서버와 필드 서버는 다르게 처리
	if(bFiledServer != m_vecLockProtocol.bFiledServer)
	{
		return;
	}
	// end 2007-11-22 by bhsohn 아레나 통합서버
	BOOL bAllClear = FALSE;
	vector<MessageType_t>::iterator it = m_vecLockProtocol.vecUnLockMsg.begin();
	while(it != m_vecLockProtocol.vecUnLockMsg.end())
	{
		MessageType_t msgUnLockTmp = (*it);
		if(msgUnLockTmp == msgUnLockMsg)
		{
			if(MULTI_LOCK_ONE_MATCHING == m_vecLockProtocol.nLockType)
			{
				bAllClear = TRUE;
			}
			else if(MULTI_LOCK_ALL_MATCHING == m_vecLockProtocol.nLockType)
			{
				it = m_vecLockProtocol.vecUnLockMsg.erase(it);
			}
			break;
		}
		it++;
	}

	if(bAllClear || m_vecLockProtocol.vecUnLockMsg.empty())
	{
		MessageType_t	nPreLockMsg = m_vecLockProtocol.nLockMsg;
		// 모든 정보 초기화
		InitMultiLockInfo();

		// 2008-05-28 by bhsohn Multi Lock끝나고 요청할 사항 있을시에 대한 처리
		MultiLockFinished(nPreLockMsg);
	}	
	
}


/******************************************************************************
**
**	해당 메시지 Lock중 인지 확인.
**
**	Create Info : 2010. 08. 26. by hsLee.
**
*******************************************************************************/
bool CAtumApplication :: IsEnableMultiLock ( MessageType_t nLockMsg )
{
	if ( nLockMsg == 0 )
		return false;

	if ( m_vecLockProtocol.nLockMsg == nLockMsg )
		return true;

	return false;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-01-11 by bhsohn 1분동안 강제로 클라이언트 멈추게 하면 클라이언트 강제 종료
/// \date		2008-01-11 ~ 2008-01-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsCompultionGame(DWORD dwCapTime)
{
	DWORD dwLastestTickTime = m_dwLastestTickTime;
	DWORD dwTime = timeGetTime();
	if(0 == dwLastestTickTime || (dwTime < dwLastestTickTime))
	{
		return FALSE;
	}

// 2013-06-28 by ssjung 포커스를 잃었을 시 1분후 클라이언트가 종료되는 현상 캐나다 예외처리
#ifdef C_FOCUS_MISS_CLIENT_NO_CLOSE
	if(m_bDeviceLost)
	{	
		m_dwLastestTickTime = dwTime;
	}
#endif
// end 2013-06-28 by ssjung 포커스를 잃었을 시 1분후 클라이언트가 종료되는 현상 캐나다 예외처리

	DWORD dwDiff = dwTime - dwLastestTickTime;

	if(dwDiff > dwCapTime)
	{
		// 시간 초과다
		return TRUE;
	}
	return FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CFieldWinSocket* CAtumApplication::GetFieldWinSocket(UINT nSocketNotifyType)
{
	if(NULL == m_pFieldWinSocket)
	{
		return NULL;
	}
	return m_pFieldWinSocket->GetFieldWinSocket(nSocketNotifyType);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CIMSocket* CAtumApplication::GetIMWinSocket(UINT nSocketNotifyType)
{
	if(NULL == m_pIMSocket)
	{
		return NULL;
	}
	return m_pIMSocket->GetIMWinSocket(nSocketNotifyType);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 상점 클릭시 이벤트
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::OnClickArenaShop()
{	
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();

	BOOL bAlreadyConnect = FALSE;	// 	
	BOOL bConnect = m_pFieldWinSocket->ConnectArena(pArenaInfo->AFS_IP, pArenaInfo->AFS_Port, &bAlreadyConnect);	
	if(FALSE == bConnect)
	{
		m_pFieldWinSocket->CloseSocketArena();
		return;
	}
	// Lock
	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	m_ArenaSocketType	= ARENASOCKET_ARENA;
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

	// 강제 소켓 닫는 모드 초기화
	m_pArenaManager->SetForceCloseArenaSocket(FALSE);

	// 일반 모드로 접속시도
	SetGmModeConnect(FALSE);

	// 이미 연결되어있으면 방 목록 요청
	if(bAlreadyConnect)
	{
		// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정		
		//RequestArenaTeamList();// 이미 연결되어있으면 팀정보 요청
		// 일반 유저는 이미 연결되어있으면 IM서버와의 접속을 시도한다.
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
		UserConnectAenenaIMServer();				
	}
	else
	{
		// 아레나 필드 서버와 연결중
		SetArenaState(ARENA_STATE_CONNECTING_FS);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 방요청 
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RequestArenaTeamList()
{
	CINFCityArena * pCityArena = (CINFCityArena*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_ARENA);
	if(NULL == pCityArena)
	{
		return;		
	}		
	// 방목록 요청 	
	pCityArena->ReFresh();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버정보를 얻어옴.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketConnectArenaServerInfo(MSG_FC_CONNECT_ARENASERVER_INFO* pMsg)
{
	m_pArenaManager->SetArenaServerInfo(pMsg);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버 로그인 성공
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketConnectArenaServerLoginOk(MSG_FC_CONNECT_ARENASERVER_LOGIN_OK* pMsg)
{
	// 아레나 서버에 클라이언트 정보 갱신	
	m_pArenaManager->SetArenaCharacterInfo(&pMsg->AFSCharacter);	

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	g_ArenaServerDateTime	= pMsg->atimeCurServerTime;
	g_ArenaStartTime		= timeGetTime();
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

	EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock

	// 일반 유저가 접속 시도냐?
	if(FALSE == IsGmModeConnect())
	{
		// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정		
		//RequestArenaTeamList();// 일반 유저 연결 성공시, 팀정보 요청
		// 아레나 필드 서버연결 성공시 아레나 IM서버에 연결시도
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
		UserConnectAenenaIMServer();		
	}
	else
	{
 		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		if( m_ArenaSocketType == ARENASOCKET_INFINITY )
		{
			EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
			UserConnectAenenaIMServer();
			return;
		}
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

		// GM은 IM서버에 연결을 시도한다.
		GmConnectAenenaIMServer();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버 로그인 성공
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketArenaPossibleGameStart(MSG_FC_ARENA_POSSIBLE_GAMESTART* pMsg)
{	
	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

	if( m_ArenaSocketType == ARENASOCKET_INFINITY )
	{
		g_pInterface->m_pCityBase->CloseCurrentEnterBuilding();
		SendAreneEnterRoomWarp();

		m_bInfinityMapload		= TRUE;		// 인피니티 맵 로드
		m_bEnterInfinityAllowed = FALSE;	// 인피니티 입장 허가

		// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
		m_bInfinityMapLoadedSendEnable	= FALSE;
		m_bInfinitySkillSetupOKDone		= FALSE;
		// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
	}

	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	
	SetArenaState(ARENA_STATE_ARENA_LOAD_GAME_INFO);
	
	// 2008-09-26 by bhsohn 신규 인첸트 처리
	structInvenPosInfo	struInfo;
	BOOL bInvenPosInfo = FALSE;
	memset(&struInfo, 0x00, sizeof(structInvenPosInfo));
	if(g_pGameMain && g_pGameMain->m_pInven)
	{
		struInfo = g_pGameMain->m_pInven->GetInvenPosInfo();		
		bInvenPosInfo = TRUE;

	}
	// end 2008-09-26 by bhsohn 신규 인첸트 처리

	// 2009-04-14 by bhsohn 채팅 방중 아레나 갔을시, 문제점 수정
	if(g_pGameMain && g_pGameMain->m_pCommunity)
	{
		CINFCommunityChatRoom* pChatRoom = g_pGameMain->m_pCommunity->GetChatRoom();
		if(pChatRoom)
		{
			pChatRoom->OutChatRoom();
		}
	}
	// end 2009-04-14 by bhsohn 채팅 방중 아레나 갔을시, 문제점 수정
	{
		// 메인서버 ClientIndex 저장
		SetMFSMyShuttleInfo(&m_pShuttleChild->m_myShuttleInfo);
		// 게임객체 제거
		ReCreateAllGameObject();

		// Arena서버의 클라이언트 값으로 변경		
		SetMyShuttleInfo(&pMsg->AFSCharacter);		
		// IM서버에 아레나 캐릭명 갱신
		m_pIMSocket->SetArenaChaterInfo(&pMsg->AFSCharacter);
		
	}	
	
	// 캐릭터 이름 갱신
	{
		STRNCPY_MEMSET(((CChatMoveData *)g_pD3dApp->m_pShuttleChild->m_pIDChat->m_pChild)->m_szString,
			pMsg->AFSCharacter.CharacterName, SIZE_MAX_CHARACTER_NAME);
		// 2007-11-22 by bhsohn 아레나 통합서버
		// 아레나 맵에서는 '\'뒤는 서버이름이므로 빠릴 필요가없다.
		g_pD3dApp->ConevertArenaRenderUserName(GetArenaState(), ((CChatMoveData *)g_pD3dApp->m_pShuttleChild->m_pIDChat->m_pChild)->m_szString);
	}

	
	// 게임 시작에 완료로 객체 다시 생성 
	{
		structGameStartOkInfo struGameStartOkInfo;
		memset(&struGameStartOkInfo, 0x00, sizeof(structGameStartOkInfo));

		strncpy(struGameStartOkInfo.ServerGroupName0, pMsg->ServerGroupName0, SIZE_MAX_SERVER_NAME);
		strncpy(struGameStartOkInfo.MainORTestServerName, pMsg->MainORTestServerName, SIZE_MAX_SERVER_NAME);
		strncpy(struGameStartOkInfo.GamePublisher, pMsg->GamePublisher, SIZE_MAX_GAME_PUBLISHER_NAME);

		struGameStartOkInfo.MapChannelIndex = pMsg->AFSCharacter.MapChannelIndex;
		struGameStartOkInfo.CharacterMode0	= FALSE;
		struGameStartOkInfo.PositionVector	= pMsg->AFSCharacter.PositionVector;
		struGameStartOkInfo.MapWeather		= pMsg->MapWeather;


		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		//struGameStartOkInfo.bMemberPCBang	= FALSE;
		struGameStartOkInfo.bMemberPCBang	= pMsg->IsPCBangUser;
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

		ArenaGameStarOk(&struGameStartOkInfo, TRUE);
	}	

	// 경험치 정보 갱신 
	{		
		float fExpPer = (float)((((double)m_pShuttleChild->m_myShuttleInfo.Experience
									- (double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level))
									/((double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level+1)
									- (double)CAtumSJ::GetInitialExperienceOfLevel(m_pShuttleChild->m_myShuttleInfo.Level)))
									* 100);
		if(g_pGameMain->m_pUnitInfoBar)
		{
			g_pGameMain->m_pUnitInfoBar->SetEXP(fExpPer);
		}
	}		

	// 2008-09-26 by bhsohn 신규 인첸트 처리
	if(bInvenPosInfo && g_pGameMain && g_pGameMain->m_pInven)
	{
		g_pGameMain->m_pInven->SetInvenPosInfo(&struInfo);		
	}
	// end 2008-09-26 by bhsohn 신규 인첸트 처리
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 아레나 게임 시작
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetMyShuttleInfo(CHARACTER* pCharacter)
{
	memcpy(&m_pShuttleChild->m_myShuttleInfo, pCharacter, sizeof(CHARACTER));
	
	// 2008-04-21 by bhsohn 아레나 에서 복귀시, 스탯 잘못 나왔던 버그 수정
	// 실제 유닛 풀 스탯 
	m_pShuttleChild->SetMyShuttleFullStatInfo(m_pShuttleChild->m_myShuttleInfo.TotalGearStat);
	// 최대치 COUNT_MAX_STAT_POINT 못 넘게 변경
	m_pShuttleChild->ReformMyShuttleStatInfo(&m_pShuttleChild->m_myShuttleInfo.TotalGearStat);
	// end 2008-04-21 by bhsohn 아레나 에서 복귀시, 스탯 잘못 나왔던 버그 수정
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버 로그인 성공
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetArenaState(int nState)
{
	m_pArenaManager->SetArenaState(nState);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버 로그인 성공
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::GetArenaState()
{
	return m_pArenaManager->GetArenaState();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::DoModalAreanQuestion()
/// \brief		아레나 창 띠운다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::DoModalAreanQuestion()
{
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(STRMSG_C_070504_0100, _Q_ARENA_WARP,30,STRMSG_C_060724_0000);
}



///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::ReCreateAllGameObject()
/// \brief		게임객체 다 지운 후 다시 생성
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ReCreateAllGameObject()
{
	DBGOUT("void CAtumApplication::ReCreateAllGameObject() Start\n");
	g_pD3dApp->m_bCharacter = FALSE;
	m_pQuestData->Init();
	if(m_pInterface )
	{		
		// 채널정보를 뺵업받음 정보 얻어옴
		// 2008-02-27 by bhsohn 아레나 이동시 채팅정보 뺵업
		m_pInterface->BackupChatInfo();

		m_pInterface->InvalidateCityObjects();
#ifdef C_EPSODE4_UI_CHANGE_JSKIM					        // 2011. 10. 10 by jskim UI시스템 변경
//m_pInterface->DeleteCityObjects();
#else  
m_pInterface->DeleteCityObjects();
#endif
		
		m_pInterface->InvalidateGameObjects();
		// 2007-11-22 by bhsohn 아레나 통합서버
		m_pInterface->DeleteGameObjects(TRUE);
		//if(!m_bClientQuit)
		{
			//m_pInterface->RestoreSelectObjects();
			//g_pSelect->GameEnd();
		}
	}	
	g_pD3dDev->EvictManagedResources();

	EnterCriticalSection(&m_cs);
	
	// 마인드 컨트롤 매크로 정보를 기록한다.
	// ShuttleChild(이)가 갖고 있는 아이템 정보를 서버로 전송하고 지운다.
	// ShuttleChild 지운다.
	if(m_pShuttleChild)
	{
		//			g_pStoreData->SendFieldSocketItemIndexInfo();
		m_pShuttleChild->InvalidateDeviceObjects();
		//			m_pShuttleChild->InvalidateChat();
		m_pShuttleChild->DeleteDeviceObjects();
		SAFE_DELETE(m_pShuttleChild);
	}
	
	// 캐릭터
	if(m_pCharacterChild)
	{
		m_pCharacterChild->InvalidateDeviceObjects();
		m_pCharacterChild->DeleteDeviceObjects();
		SAFE_DELETE(m_pCharacterChild);
	}
	// Chat 을 지운다.
	CAtumNode* pChat = (CAtumNode *)m_pChat->m_pChild;
	while(pChat)
	{
		pChat->m_bUsing = FALSE;
		pChat = pChat->m_pNext;
	}
	m_pChat->Tick();
	// Effect(App의) 을 지운다.
	// Effect(ZEnableEffect) 을 지운다.
	m_pEffectRender->m_vecZEnableEffect.clear();
	
	
	m_pUnitRender->InvalidateDeviceObjects();
	m_pUnitRender->DeleteDeviceObjects();
	m_pUnitRender->InitDeviceObjects();
	m_pUnitRender->RestoreDeviceObjects();
	if(m_pScene)
	{
		m_pScene->InvalidateRes();
		m_pScene->DeleteRes();
	}
	DeleteEffectList();
	m_pEffectList->Tick();
	// 이펙트의 삭제는 신중해야 한다. 다른 유닛이나 
	// 몬스터의 장착정보가 레퍼런스로 가지고 
	// 있을 수 있기 때문이다.

	{
		g_pSelect->m_pSelectBack->m_bInitEffectItem = false;		
		m_pShuttleChild = new CShuttleChild();
		m_pShuttleChild->InitDeviceObjects();		
		m_pShuttleChild->RestoreDeviceObjects();
		
		// 캐릭터
		m_pCharacterChild = new CCharacterChild();
		m_pCharacterChild->InitDeviceObjects();
		m_pCharacterChild->RestoreDeviceObjects();	
	}

	LeaveCriticalSection(&m_cs);	
	
	
	{
		// 음성 채팅 관련 처리
		COPYDATASTRUCT	copyData;
		memset(&copyData, 0x00, sizeof(COPYDATASTRUCT));
		AV_MSG_WM_COPYDATA voIP(_1to1Call, AV_MT_CLIENT_END, 0);
		copyData.dwData = (DWORD)voIP;
		
		copyData.lpData = NULL;
		copyData.cbData = 0;
		::SendMessage(m_VOIPState.m_hWndAtumVoIPClient, WM_COPYDATA, (WPARAM)GetHwnd(), (LPARAM)&copyData);
		m_VOIPState.nVOIPState = _VOIP_NOTLOGIN;
	}
	
	// IME초기화
	CleanText();	

	//m_bReadyToGetGuildInfo = FALSE;

	// 길드 정보 동기화 문제 관련 처리
	//m_bReadyFieldGameStartOk = FALSE;
//	if(m_bClientQuit ) 
//	{
//		if(m_pStageEffect)
//		{
//			m_pStageEffect->SetEndWork(TRUE);
//		}
//	}
//	else
//	{
//		ChangeGameState(_SELECT );
//	}	
	DBGOUT("void CAtumApplication::ReCreateAllGameObject() End\n");
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 종료 
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterReadyGamestartFromArenaToMainserver(MSG_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER_OK* pMsg)
{	
	DBGOUT("T_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER_OK\n");

	// 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 파라미터 추가 ( 0 = 메인, 1 = 아레나 )
#ifdef SC_ARENA_EX_1ST_JHSEOL_MSPARK
	if( ARENASOCKET_ARENA == m_ArenaSocketType )
	{
		g_pInterface->SaveCharacterFile(SLOT_PURPOSE_ARENA);
	}
#endif
	// end 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 파라미터 추가 ( 0 = 메인, 1 = 아레나 )

	// 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경
	int nWarPoint= 0;	// 전쟁포인트	
	{
		CHARACTER* pMainInfo = m_pArenaManager->GetMFSMyShuttleInfo();
		// 과거 메인누적 WP와 현재 WP이 차이로 추가된 WP를 계산한다.
		nWarPoint = pMsg->Character.CumulativeWarPoint - pMainInfo->CumulativeWarPoint;
		if(nWarPoint < 0)
		{
			nWarPoint = 0;
		}
	}
	// end 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경

	// 2008-09-26 by bhsohn 신규 인첸트 처리
	structInvenPosInfo	struInfo;
	BOOL bInvenPosInfo = FALSE;
	memset(&struInfo, 0x00, sizeof(structInvenPosInfo));
	if(g_pGameMain && g_pGameMain->m_pInven)
	{
		struInfo = g_pGameMain->m_pInven->GetInvenPosInfo();		
		bInvenPosInfo = TRUE;

	}
	// end 2008-09-26 by bhsohn 신규 인첸트 처리

	

	// 실제 게임 객체 제거및 종료	
	ReCreateAllGameObject();		
	
	{
		// 메인서버 ClientIndex 저장
		SetMFSMyShuttleInfo(&pMsg->Character);

		// 메인서버의 클라이언트 정보 값으로 변경		
		SetMyShuttleInfo(&pMsg->Character);		

		// 내 정보값다시 갱신 
		m_pIMSocket->SetChaterInfo(&pMsg->Character);

		// 캐릭터 이름 갱신
		STRNCPY_MEMSET(((CChatMoveData *)g_pD3dApp->m_pShuttleChild->m_pIDChat->m_pChild)->m_szString,
			pMsg->Character.CharacterName, SIZE_MAX_CHARACTER_NAME);		
	}
	
	// 게임 스타트와 동일한 프로토콜
	// 게임 시작에 완료로 객체 다시 생성 
	{
		structGameStartOkInfo struGameStartOkInfo;
		memset(&struGameStartOkInfo, 0x00, sizeof(structGameStartOkInfo));

		strncpy(struGameStartOkInfo.ServerGroupName0, pMsg->ServerGroupName0, SIZE_MAX_SERVER_NAME);
		strncpy(struGameStartOkInfo.MainORTestServerName, pMsg->MainORTestServerName, SIZE_MAX_SERVER_NAME);
		strncpy(struGameStartOkInfo.GamePublisher, pMsg->GamePublisher, SIZE_MAX_GAME_PUBLISHER_NAME);		

		struGameStartOkInfo.MapChannelIndex = pMsg->Character.MapChannelIndex;
		struGameStartOkInfo.CharacterMode0	= pMsg->CharacterMode0;
		struGameStartOkInfo.PositionVector	= pMsg->Character.PositionVector;
		struGameStartOkInfo.MapWeather		= pMsg->MapWeather;
		struGameStartOkInfo.bMemberPCBang	= pMsg->bMemberPCBang;

		ArenaGameStarOk(&struGameStartOkInfo, FALSE);
	}	
	// 2008-08-25 by bhsohn 아레나 이용시, 2차 패스워드 문제 해결
	if(IsUseSecondaryPasswordSystem())
	{
		//2차 패스워드를 사용하면 갱신
		SetSecondPassLock(pMsg->bIsLockSecondPW);
	}
	// end 2008-08-25 by bhsohn 아레나 이용시, 2차 패스워드 문제 해결

	// 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경
	{
		int nInfPoint = m_pArenaManager->GetInflPoint();
		if(nInfPoint > 0)
		{
			char buf[256];		
#ifndef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG					// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
			wsprintf(buf,STRMSG_C_061121_0002,nInfPoint);
			g_pD3dApp->m_pChat->CreateChatChild(buf,COLOR_ITEM,CHAT_TAB_SYSTEM);		//"세력 포인트 %d점이 추가 되었습니다."
#endif
			wsprintf(buf,STRMSG_C_070514_0101, nWarPoint);
			g_pD3dApp->m_pChat->CreateChatChild(buf,COLOR_ITEM,CHAT_TAB_SYSTEM);		//"전쟁 포인트 %d점을 획득하였습니다."
			m_pArenaManager->SetInflPoint(0);	// 0점으로 다시 초기화
		}
	}
	// end 2008-04-15 by bhsohn 아레나 워포인트 찍는 시스템 변경

	// 2008-09-26 by bhsohn 신규 인첸트 처리
	if(bInvenPosInfo && g_pGameMain && g_pGameMain->m_pInven)
	{
		g_pGameMain->m_pInven->SetInvenPosInfo(&struInfo);		
	}
	// end 2008-09-26 by bhsohn 신규 인첸트 처리
	
	// 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 : 메인서버로 메인 퀵슬롯 요청
#ifdef SC_ARENA_EX_1ST_JHSEOL_MSPARK
	g_pD3dApp->m_pFieldWinSocket->SendMsg(T_FC_STORE_REQUEST_QUICKSLOT, NULL, 0);
#endif
	// end 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 : 메인서버로 메인 퀵슬롯 요청

}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::ArenaFinishWarp()
/// \brief		아레나가 완료되서 종료해라
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ArenaFinishWarp(BOOL bForceCloseArenaSocket)
{		
	// 강제 소켓 닫는 모드 사용
	m_pArenaManager->SetForceCloseArenaSocket(bForceCloseArenaSocket);
	
	// 편대 탈퇴요청
	{
		if(g_pGameMain && g_pGameMain->m_pCommunity)
		{
			CINFCommunityParty* pInfParty = g_pGameMain->m_pCommunity->GetParty();
			if(pInfParty)
			{
				pInfParty->ISendPartyLeaveArena();
			}
		}
	}
	// 2008-04-16 by bhsohn 아레나 관전모드 버그 수정
	{
		// 관전 모드중이냐?
		if(g_pShuttleChild->IsOperation())
		{		
			// 아레나 관전모드 종료시킴
			FieldSocketArenaWatchEnd();
		}
		
	}

	// 아레나 끝나고 메인서버로 이동
	SetArenaState(ARENA_STATE_ARENA_ARENA_TO_MAIN);	
	

	// 맵로드 시작
	{
		m_pInterface->InitMapLoadObjects();
		m_pInterface->RestoreMapLoadObjects();
		ChangeGameState(_MAPLOAD);
	}
	// 아레나 복귀 요청
	{
		// 메인서버 ClientIndex 저장
		CHARACTER* pMainInfo = m_pArenaManager->GetMFSMyShuttleInfo();

		MSG_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER));		

		sMsg.ClientIndex = pMainInfo->ClientIndex;

		g_pFieldWinSocket->SendMsg(T_FC_CHARACTER_READY_GAMESTART_FROM_ARENA_TO_MAINSERVER, (char*)&sMsg, sizeof(sMsg) );				
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::ArenaGameStarOk()
/// \brief		아레나가 완료됐다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ArenaGameStarOk(structGameStartOkInfo *pMsg, BOOL bGotoArena)
{
	// 2007-04-09 by bhsohn 관리자 계정 표출 정보 처리	
	wsprintf(m_strConnectSeverName, "%s[%s] %s", pMsg->GamePublisher, pMsg->MainORTestServerName, pMsg->ServerGroupName0);

	// 로드에선 완료
	{
		// 맵 정보 갱신
		g_pShuttleChild->m_myShuttleInfo.MapChannelIndex = pMsg->MapChannelIndex;
		m_pInterface->m_pMapLoad->MapLoadComplete();	
	}

	// 2006-06-07 by ispark,  유료화 아이템 관리자, 운영자만 쓰게 한다.
	if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
		m_bTestServer = FALSE;
	}

	// 2007-07-16 by dgwoo 아이템 정보를 아직 받지 못한 상태.
	m_bInputItemDone = FALSE;
	
	{		
		// 캐릭터 모드 입력 (0 : 유닛(기체), 그외는 캐릭터)
		if(pMsg->CharacterMode0 > 0)
			m_bCharacter = TRUE;
		else
			m_bCharacter = FALSE;		

		// 2007-11-20 by bhsohn 맵로딩 하는 방식 변경
		//InitCharacterGameStartOk( pMsg->PositionVector, pMsg->MapWeather );
		InitOnlyGameStartOk( pMsg->PositionVector, pMsg->MapWeather, TRUE);

		DBGOUT("Field Server State : MSG_FC_CHARACTER_GAMESTART_OK, init Game Infomation \n");
	}	
	
	// 길드 정보 동기화 문제 관련 처리
	m_bReadyFieldGameStartOk = TRUE;
	
	//가맹 PC방인지 체크.
	if(pMsg->bMemberPCBang && g_pGameMain->m_pUnitInfoBar)
	{
		char szNotice[1024];
		memset(szNotice,0x00,1024);
		g_pGameMain->m_pUnitInfoBar->SetHappyHourEventIconPos();
		g_pGameMain->m_pUnitInfoBar->m_bMemberPCBang = TRUE;
		sprintf(szNotice, STRMSG_C_060830_0101);					//"가맹PC방입니다."
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);		

	}

	// 숨겨진 미션 검사
	CQuest* pQuest = g_pQuestData->FindMapHideQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
//		g_pGameMain->m_pMissionInfo->SetPosMissionSearchStart(TRUE);
//		g_pGameMain->m_pMissionInfo->SetPosMissionInfo(pQuest);
		g_pGameMain->SetMissionPosMissionSearchStart(TRUE);
		g_pGameMain->SetMissionPosMissionInfo(pQuest);
	}

	// 특정 포지션 완료 미션 검사
	CQuest* pQuest2 = g_pQuestData->FindPosCompleteQuest( g_pShuttleChild->m_myShuttleInfo.MapChannelIndex.MapIndex );
	if(pQuest2)
	{
		// 2007-06-12 by bhsohn 미션 인터페이스 수정안
		//g_pGameMain->m_pMissionInfo->SetPosMissionComplete(TRUE);
		g_pGameMain->SetMissionPosMissionComplete(TRUE);
	}	
	
	// omi 체크섬
	SendOMICheckSum();

	// 2010. 03. 12 by ckPark Interface.tex 체크섬 추가
	SendInterfaceCheckSum();
	// end 2010. 03. 12 by ckPark Interface.tex 체크섬 추가

	SendAtmCheckSum();	// 2008-09-17 by bhsohn 게임 실행파일명 체크섬 추가

	SendQuestCheckSum();	// 2008-11-11 by bhsohn 퀘스트 CheckSum추가

	// 서버에 해피 아워 정보요청
	RequestHappyHourInfo();	
	
//	if(!bGotoArena)
//	{
//		// 최초 접속시 받을 메시지가 있는지 서버로 요청.
//		RequestNotifyMsg();	  
//	}
	
	{
		//
		//m_pInterface->InitMapLoadObjects();
		//m_pInterface->RestoreMapLoadObjects();
		
		// 2010. 10. 05 by jskim 맵로딩 구조 변경
		// 2011-07-06 by hsson 인피니티에서 마을로 로딩시 멈추는 현상 수정
		//SAFE_DELETE(m_pMapInitThread );
  		//m_pMapInitThread = new CMapInitThread();
  		//m_pMapInitThread->CreateThread();		
		SAFE_DELETE(m_pMapInitThread );
		m_pMaploading->SetMapStep(_MAP_LOADING_STEP1);
		// end 2011-07-06 by hsson 인피니티에서 마을로 로딩시 멈추는 현상 수정
		// end 2010. 10. 05 by jskim 맵로딩 구조 변경
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::CloseArenaSocket()
/// \brief		아레나 소켓을 끊는다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::CloseArenaSocket()
{
	DBGOUT("void CAtumApplication::CloseArenaSocket()\n");

	// 강제 소켓 닫는 모드 초기화
	m_pArenaManager->SetForceCloseArenaSocket(FALSE);

	// None상태로
	SetArenaState(ARENA_STATE_NONE);

	// 일반모드 접속
	SetGmModeConnect(FALSE);

	// 필드 소켓
	m_pFieldWinSocket->CloseSocketArena();
	
	// IM 서버 소켓 
	m_pIMSocket->CloseArenaIMSocket();		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버에 로그인 시도
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendArenaLoginOk()
{
	DBGOUT("void CAtumApplication::SendArenaLoginOk() \n");	

	int nMsgType = T_FC_CONNECT_ARENASERVER_LOGIN;			
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();
	
	MSG_FC_CONNECT_ARENASERVER_LOGIN sArenaMsg;
	memset(&sArenaMsg,0x00,sizeof(MSG_FC_CONNECT_ARENASERVER_LOGIN));
	
	sArenaMsg.AccountUID = g_pShuttleChild->m_myShuttleInfo.AccountUniqueNumber;
	sArenaMsg.MFSCharacterUID = g_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber;
	sArenaMsg.MFSClientIdx = g_pShuttleChild->m_myShuttleInfo.ClientIndex;
	sArenaMsg.MFS_ID = pArenaInfo->MainServer_ID;			
	
	m_pFieldWinSocket->SendMsg( nMsgType, (char*)&sArenaMsg, sizeof(sArenaMsg) );
	
	// Lock
	{
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();
		vecUnLockMsg.push_back(T_FC_CONNECT_ARENASERVER_LOGIN);		
		vecUnLockMsg.push_back(T_FC_CONNECT_ARENASERVER_LOGIN_OK);		
		// 하나만 매칭 되어도 락이 풀린다. 
		EnterMultiLock(TRUE, T_FC_CONNECT_ARENASERVER_LOGIN, vecUnLockMsg, MULTI_LOCK_ONE_MATCHING);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 서버에 로그인 시도
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CHARACTER*	CAtumApplication::GetArenaCharacterInfo()
{
	return m_pArenaManager->GetArenaCharacterInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::SendArenaIMLogin()
/// \brief		아레나 IM서버에 로그인 신청
/// \author		// 2007-11-22 by bhsohn 아 레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendArenaIMLogin()
{
	MSG_IC_CONNECT_LOGIN iMsg;
	memset(&iMsg,0x00,sizeof(iMsg));
	char buffer[SIZE_MAX_PACKET];
	
	CHARACTER* pArenaCharacterInfo = m_pArenaManager->GetArenaCharacterInfo();

	// IM서버에 아레나 캐릭명 갱신
	m_pIMSocket->SetArenaChaterInfo(pArenaCharacterInfo);

	char* pUserId = g_pD3dApp->m_strUserID;		
	char* pUserPassWord = g_pD3dApp->m_strUserPassword;
	
	strncpy(iMsg.AccountName,pUserId, SIZE_MAX_ACCOUNT_NAME);
	strncpy(iMsg.Password,pUserPassWord, SIZE_MAX_PASSWORD_MD5_STRING);
	iMsg.LoginType = CHAT_LOGIN_TYPE_GAME;

	strncpy(iMsg.CharacterName, pArenaCharacterInfo->CharacterName, SIZE_MAX_CHARACTER_NAME);	
	memset(iMsg.ServerName,0x00,SIZE_MAX_SERVER_NAME);

	int nType = T_IC_CONNECT_LOGIN;
	memcpy(buffer,&nType,SIZE_FIELD_TYPE_HEADER);
	memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &iMsg, sizeof(iMsg));
	m_pIMSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(iMsg), TRUE);		

	// Lock
	{
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();
		vecUnLockMsg.push_back(T_IC_CONNECT_LOGIN);		
		vecUnLockMsg.push_back(T_IC_CONNECT_LOGIN_OK);		
		// 하나만 매칭 되어도 락이 풀린다. 
		EnterMultiLock(FALSE, T_IC_CONNECT_LOGIN, vecUnLockMsg, MULTI_LOCK_ONE_MATCHING);
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::SendArenaIMLogin()
/// \brief		아레나 IM서버에 로그인 신청
/// \author		// 2007-11-22 by bhsohn 아 레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendAreneEnterRoomWarp()
{
	// 퀵슬롯 정보 저장
	g_pInterface->SaveCharacterFile(SLOT_PURPOSE_MAIN);		// 2012-06-21 by jhseol, 아레나 추가개발part2 - 아레나 전용 퀵슬롯 파라미터 추가 ( 0 = 메인, 1 = 아레나 )

	// 아레나 게임 레뒤
	SetArenaState(ARENA_STATE_ARENA_MAIN_TO_ARENA);

	// 메인서버에서 아레나 서버로의 이동을 메인 IM서버에 알려준다.
	m_pIMSocket->SendMsg(T_IC_PARTY_LEAVE_FROM_M_TO_A, NULL, NULL);	
	
	// 맵로드 시작
	{
		m_pInterface->InitMapLoadObjects();
		m_pInterface->RestoreMapLoadObjects();
		ChangeGameState(_MAPLOAD);
	}

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	if( m_ArenaSocketType != ARENASOCKET_INFINITY )
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	{
		MSG_FC_ARENA_ENTER_ROOM_WARP sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_FC_ARENA_ENTER_ROOM_WARP));		
		sMsg.CheckCommand=IsGmModeConnect();

		g_pFieldWinSocket->SendMsg(T_FC_ARENA_ENTER_ROOM_WARP, (char*)&sMsg, sizeof(sMsg) );						
	}

	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::NextStepArenaState()
/// \brief		아레나 상태를 다음 상태로 갱신
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-17 ~ 2007-12-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::NextStepArenaState()
{
	int nOldStep = GetArenaState();
	switch(GetArenaState())
	{
	case ARENA_STATE_ARENA_LOAD_GAME_INFO:
		{
			// 아레나 게임 중인 상태로
			SetArenaState(ARENA_STATE_ARENA_GAMING);				
		}
		break;
	case ARENA_STATE_ARENA_ARENA_TO_MAIN:
		{
			// 아레나 끝나고 메인서버로 이동하면 아레나 대기상태로
			SetArenaState(ARENA_STATE_ARENA_WAIT);				
		}
		break;
	
	}		
	return nOldStep;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::ConevertArenaRenderUserName()
/// \brief		실제로 아레나맵에서 랜더링할 맵 이름 결정
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ConevertArenaRenderUserName(int nArenaState, char* pSrcDst)
{
	m_pArenaManager->ConevertArenaRenderUserName(nArenaState, pSrcDst);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 완료 허용되고 리소스도 로드가 끝났다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendFCArenaCharacterGameStart()
{
	DBGOUT("void CAtumApplication::SendFCArenaCharacterGameStart() \n");
	// 아레나 게임 시작
	m_pFieldWinSocket->SendMsg(T_FC_ARENA_CHARACTER_GAMESTART, NULL, 0);

	// 다중 락
	{
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();
		vecUnLockMsg.push_back(T_FC_SKILL_SETUP_SKILL_OK_DONE);
//		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_DONE);
//		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT_DONE);
		vecUnLockMsg.push_back(T_FC_ITEM_PUT_ENCHANT_DONE);
		// 모두다 매칭 되어야 락이 풀린다. 
		EnterMultiLock(TRUE, T_FC_ARENA_CHARACTER_GAMESTART, vecUnLockMsg, MULTI_LOCK_ALL_MATCHING);
	}

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

// 	if(g_pInterface->m_pGameArena->IsAlreadyArenaStart())
// 	{
// 		// 이미 게임 시작을 받았으면 카운트를 시작한다.
// 		g_pInterface->m_pGameArena->StartCountWar();	
// 		
// 		// 2008-03-04 by bhsohn 아레나 시간 동기화 관련 처리
// 		// Lack걸렸을때 시간 정보 다시 갱신
// 		g_pInterface->m_pGameArena->RefreshArenaGameTime();
// 
// 	}
// 	else
// 	{
// 		// 2008-04-17 by bhsohn 아레나 진입시, 자신의 팀 설정
// 		// 내 팀로그 표시
// 		g_pInterface->m_pGameArena->ShowMyTeamLogo(g_pShuttleChild->m_myShuttleInfo.InfluenceType);
// 		// end 2008-04-17 by bhsohn 아레나 진입시, 자신의 팀 설정		
// 	}


	// 아래나 맵 로딩이 다 됬다
	if( m_ArenaSocketType == ARENASOCKET_ARENA )
	{
		if(g_pInterface->m_pGameArena->IsAlreadyArenaStart())
		{
			// 이미 게임 시작을 받았으면 카운트를 시작한다.
			g_pInterface->m_pGameArena->StartCountWar();	
			
			// 2008-03-04 by bhsohn 아레나 시간 동기화 관련 처리
			// Lack걸렸을때 시간 정보 다시 갱신
			g_pInterface->m_pGameArena->RefreshArenaGameTime();
			
		}
		else
		{
			// 2008-04-17 by bhsohn 아레나 진입시, 자신의 팀 설정
			// 내 팀로그 표시
			g_pInterface->m_pGameArena->ShowMyTeamLogo(g_pShuttleChild->m_myShuttleInfo.InfluenceType);
			// end 2008-04-17 by bhsohn 아레나 진입시, 자신의 팀 설정		
		}
	}
	else if( m_ArenaSocketType == ARENASOCKET_INFINITY )
	{	
		// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)

// 		if( m_bInfinityRestart )
// 			m_pFieldWinSocket->SendMsg( T_FC_INFINITY_MAP_LOADED_RESTART_BY_DISCONNECT, NULL, 0 );
// 		else
// 			m_pFieldWinSocket->SendMsg( T_FC_INFINITY_MAP_LOADED, NULL, 0 );
		m_bInfinityMapLoadedSendEnable	= TRUE;

		// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
	}

	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		로드 완료가 된 상황이다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendFCCharacterGameStartFromArenaToMainServer()
{
	DBGOUT("void CAtumApplication::SendFCCharacterGameStartFromArenaToMainServer \n");

	// 메인서버 ClientIndex 저장
	CHARACTER* pMainInfo = m_pArenaManager->GetMFSMyShuttleInfo();
	
	{
		MSG_FC_CHARACTER_GAMESTART_FROM_ARENA_TO_MAINSERVER sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_FC_CHARACTER_GAMESTART_FROM_ARENA_TO_MAINSERVER));		
		sMsg.ClientIndex = pMainInfo->ClientIndex;		
		g_pFieldWinSocket->SendMsg(T_FC_CHARACTER_GAMESTART_FROM_ARENA_TO_MAINSERVER, (char*)&sMsg, sizeof(sMsg) );				
	}

	if(pMainInfo->GuildUniqueNumber)
	{
		//길드 정보 요청
		MSG_IC_GUILD_GET_GUILD_INFO sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_IC_GUILD_GET_GUILD_INFO));
		
		sMsg.GuildUniqueNumber = pMainInfo->GuildUniqueNumber;
		m_pIMSocket->SendMsg( T_IC_GUILD_GET_GUILD_INFO, (char*)&sMsg, sizeof(sMsg));
	}	
	
	
	// 아레나 서버가 띠워져있다.
	// 일반 유저가 접속 시도냐?	
	if(g_pFieldWinSocket->IsFCConnectedArenaServer() 
		&& (FALSE == IsGmModeConnect()) 
		&& (FALSE == m_pArenaManager->IsForceCloseArenaSocket())) // 강제 접속 종료면 팀정보를 요청할 필요가없다. 
	{
		// 아레나 맵에서 다른 맵으로 이동시 맵정보 재요청
		g_pFieldWinSocket->SendMsg(T_FC_ARENA_FINISH_WARP,NULL,NULL);	// 팀정보 요청		

		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		
		//g_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_TEAMINFO);

		if( m_ArenaSocketType != ARENASOCKET_INFINITY )
			g_pInterface->m_pGameArena->SetArenaGameState(ARENA_GAME_STATE_TEAMINFO);

		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	}	
	else
	{
		// 아레나 서버가 내려갔다.
		g_pInterface->m_pGameArena->ReaveArena(); // 아레나 정보 초기화
		CloseArenaSocket();							// 2014-01-02 by ssjung 아레나 서버 크래쉬 났을 때 처리 추가
	}
	
	
	if(TRUE == IsGmModeConnect() // GM모드면 아레나 서버와의 종료
		|| m_pArenaManager->IsForceCloseArenaSocket()) // 포탈사용해도 소켓을 닫는다
	{		
		CloseArenaSocket();		
	}

	// 아레나에서 메인 서버로 복귀함을 알려준다.
	{
		m_pIMSocket->SendMsg(T_IC_PARTY_REQUEST_PARTYINFO_FROM_A_TO_M, NULL, NULL);	
	}
	
	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	if( m_ArenaSocketType == ARENASOCKET_INFINITY )
		m_ArenaSocketType = ARENASOCKET_NONE;
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	

	{
		// 메인 서버로 이동하기 위한 락구조
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();
		vecUnLockMsg.push_back(T_FC_SKILL_SETUP_SKILL_OK_DONE);
		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_DONE);
		vecUnLockMsg.push_back(T_FC_QUEST_PUT_ALL_QUEST_MONSTER_COUNT_DONE);
		vecUnLockMsg.push_back(T_FC_ITEM_PUT_ENCHANT_DONE);
		// 모두다 매칭 되어야 락이 풀린다. 
		EnterMultiLock(TRUE, T_FC_CHARACTER_GAMESTART_FROM_ARENA_TO_MAINSERVER, vecUnLockMsg, MULTI_LOCK_ALL_MATCHING);
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		MainServer 정보를 얻어온다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CHARACTER* CAtumApplication::GetMFSMyShuttleInfo()
{
	return m_pArenaManager->GetMFSMyShuttleInfo();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		MainServer 정보를 업데이트한다.
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetMFSMyShuttleInfo(CHARACTER *pMyShuttleInfo)
{
	m_pArenaManager->SetMFSMyShuttleInfo(pMyShuttleInfo);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-02-15 by bhsohn 네트워크 속도 체크
/// \date		2008-02-15 ~ 2008-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketConnectNetWorkCheckOk(MSG_FC_CONNECT_NETWORK_CHECK_OK* pMsg)
{
	DWORD dwCurrentTime = timeGetTime();
	DWORD dwDiff = 0;
	if(m_stNetCheckInfo.dwLastCheckTime < dwCurrentTime)
	{
		dwDiff = dwCurrentTime - m_stNetCheckInfo.dwLastCheckTime;		
	}
	m_stNetCheckInfo.dwSumCheckTime += dwDiff;

	char szNotice[1024];
	memset(szNotice,0x00,1024);		
	// 2008-10-31 by bhsohn 네트워크 체크시, 버퍼크기도 체크
	//sprintf(szNotice, STRMSG_C_080215_0202, pMsg->nCheckCount, dwDiff, m_stNetCheckInfo.dwSumCheckTime);					//"가맹PC방입니다."
	sprintf(szNotice, STRMSG_C_081031_0200, 
				pMsg->nCheckCount, 
				dwDiff, 
				m_stNetCheckInfo.dwSumCheckTime, 
				pMsg->nWriteBufferSize);
	// end 2008-10-31 by bhsohn 네트워크 체크시, 버퍼크기도 체크
	
	m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);		
	

	m_stNetCheckInfo.nCurruntRepeatCnt++;
	if(m_stNetCheckInfo.nCurruntRepeatCnt < m_stNetCheckInfo.nMaxRepeatCnt)
	{
		SendCheckNetState();
	}
	else
	{
		// 최대값이끝났다.
		sprintf(szNotice, STRMSG_C_080215_0203, m_stNetCheckInfo.nCurruntRepeatCnt, 
													m_stNetCheckInfo.dwSumCheckTime, 
													m_stNetCheckInfo.dwSumCheckTime/m_stNetCheckInfo.nCurruntRepeatCnt);	
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);		
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		네트워크 체크 시작
/// \author		// 2008-02-15 by bhsohn 네트워크 속도 체크
/// \date		2008-02-15 ~ 2008-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::StartNetCheck(char* pCmd)
{	
	if(strlen(pCmd) > 4)
	{
		// 100을 넘어간다.
		return;
	}
	int nCnt = 0;
	for(nCnt = 0;nCnt <strlen(pCmd);nCnt++)
	{
		if(FALSE == isdigit(pCmd[nCnt]))
		{
			// 숫자가 아닌게 있으면 리턴
			return;
		}
	}
	int nRepeatCnt = atoi(pCmd);
	if(nRepeatCnt <=0 || nRepeatCnt > 100)
	{
		//100번 초과
		return;
	}

	memset(&m_stNetCheckInfo, 0x00, sizeof(structNetCheckInfo));
	
	m_stNetCheckInfo.nCurruntRepeatCnt = 0;
	m_stNetCheckInfo.nMaxRepeatCnt = nRepeatCnt;	// 최대 반복수 
	m_stNetCheckInfo.dwLastCheckTime = 0;// 마지막 틱시간	
	m_stNetCheckInfo.dwSumCheckTime = 0;
	
	SendCheckNetState();
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		네트워크 체크 시작
/// \author		// 2008-02-15 by bhsohn 네트워크 속도 체크
/// \date		2008-02-15 ~ 2008-02-15
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::SendCheckNetState()
{
	m_stNetCheckInfo.dwLastCheckTime = timeGetTime();// 마지막 틱시간	

	MSG_FC_CONNECT_NETWORK_CHECK sMsg;
	memset(&sMsg, 0x00, sizeof(MSG_FC_CONNECT_NETWORK_CHECK));

	sMsg.nCheckCount	= m_stNetCheckInfo.nCurruntRepeatCnt;
	sMsg.dwClientTick	= 0;	

	g_pFieldWinSocket->SendMsg(T_FC_CONNECT_NETWORK_CHECK, (char*)&sMsg, sizeof(sMsg));

}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 상점 클릭시 이벤트
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::StartGmConnectAenenaServer()
{	
	if(FALSE == IsLockMode())
	{
		// Lock이 걸려있는 상태다.
		return;
	}

	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock

	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();

	BOOL bAlreadyConnect = FALSE;	// 	
	BOOL bConnect = m_pFieldWinSocket->ConnectArena(pArenaInfo->AFS_IP, pArenaInfo->AFS_Port, &bAlreadyConnect);	
	if(FALSE == bConnect)
	{
		m_pFieldWinSocket->CloseSocketArena();
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
		return;
	}
	// 강제 소켓 닫는 모드 초기화
	m_pArenaManager->SetForceCloseArenaSocket(FALSE);

	// Gm모드로 접속시도
	SetGmModeConnect(TRUE);

	// 이미 연결되어있으면 아레나 IM서버에 연결
	if(bAlreadyConnect)
	{
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock

		GmConnectAenenaIMServer();
	}
		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 상점 클릭시 이벤트
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::GmConnectAenenaIMServer()
{
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();
	
	char* pArenaIMSerIp = pArenaInfo->AIS_IP;		// 아레나 필드 서버
	int nArenaIMSerPort = pArenaInfo->AIS_Port;		// 아레나 필드 포트
	BOOL bAlreadyConnect = FALSE;	// 	
	BOOL bConnect = m_pIMSocket->ConnectArena(pArenaIMSerIp, nArenaIMSerPort, &bAlreadyConnect);	

	if(!bConnect)
	{
		char szNotice[1024];
		memset(szNotice,0x00,1024);		
		sprintf(szNotice, STRMSG_C_080129_0201);		//"아레나 서버와의 접속이 실패하였습니다."
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
		CloseArenaSocket();

		return;
	}

	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock

	if(bAlreadyConnect)
	{
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock

		// 이미 연결되어있으면 메시지 창을 띠운다.
		DoModalAreanQuestion();
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CArenaManager::SetGmModeConnect(BOOL bGmModeConnect)
/// \brief		GM이 아레나 서버에 접속시도냐?
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetGmModeConnect(BOOL bGmModeConnect)
{
	m_pArenaManager->SetGmModeConnect(bGmModeConnect);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL CArenaManager::IsGmModeConnect()
/// \brief		GM이 아레나 서버에 접속시도냐?
/// \author		// 2007-11-22 by bhsohn 아레나 통합서버
/// \date		2008-01-30 ~ 2008-01-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsGmModeConnect()
{
	return m_pArenaManager->IsGmModeConnect();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketArenaServerSServerGroupForClient(MSG_FC_CONNECT_ARENASERVER_SSERVER_GROUP_FOR_CLIENT* pMsg)
/// \brief		아레나 서버 목록을 알려준다.
/// \author		// 2008-02-25 by bhsohn 아레나 유저 정보 서버도 표시하게 변경
/// \date		2008-02-25 ~ 2008-02-25
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketArenaServerSServerGroupForClient(MSG_FC_CONNECT_ARENASERVER_SSERVER_GROUP_FOR_CLIENT* pMsg)
{
	m_pArenaManager->FieldSocketArenaServerSServerGroupForClient(pMsg);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 IM서버와의 연결을 시도한다.
/// \author		// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::UserConnectAenenaIMServer()
{
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();
	
	char* pArenaIMSerIp = pArenaInfo->AIS_IP;		// 아레나 필드 서버
	int nArenaIMSerPort = pArenaInfo->AIS_Port;		// 아레나 필드 포트
	BOOL bAlreadyConnect = FALSE;	// 	
	BOOL bConnect = m_pIMSocket->ConnectArena(pArenaIMSerIp, nArenaIMSerPort, &bAlreadyConnect);	
	if(!bConnect)
	{
		char szNotice[1024];
		memset(szNotice,0x00,1024);		
		sprintf(szNotice, STRMSG_C_080129_0201);		//"아레나 서버와의 접속이 실패하였습니다."
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
		CloseArenaSocket();
		return;
	}

	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	//if(bAlreadyConnect)
	if(bAlreadyConnect && m_ArenaSocketType == ARENASOCKET_ARENA)
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	{		
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock

		// 유저는 Login Ok가 떨어진후 팀정보를 요청한다
		RequestArenaTeamList();
	}
}


// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
void	CAtumApplication::OnClickInfinityField( void )
{
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();

	BOOL bAlreadyConnect = FALSE;
	BOOL bConnect = m_pFieldWinSocket->ConnectArena(pArenaInfo->AFS_IP, pArenaInfo->AFS_Port, &bAlreadyConnect);	
	if(FALSE == bConnect)
	{
		m_pFieldWinSocket->CloseSocketArena();
		return;
	}
	// Lock
	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock

	// 인피니티 소켓 모드로 설정
	m_ArenaSocketType	= ARENASOCKET_INFINITY;

	// 강제 소켓 닫는 모드 초기화
	m_pArenaManager->SetForceCloseArenaSocket(FALSE);

	// 일반 모드로 접속시도
	SetGmModeConnect(FALSE);

	// 이미 연결되어있으면 방 목록 요청
	if(bAlreadyConnect)
	{
		// 일반 유저는 이미 연결되어있으면 IM서버와의 접속을 시도한다.
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
		UserConnectInfinityIMServer();
	}
	else
	{
		// 아레나 필드 서버와 연결중
		SetArenaState(ARENA_STATE_CONNECTING_FS);
	}
}

void	CAtumApplication::UserConnectInfinityIMServer( void )
{
	MSG_FC_CONNECT_ARENASERVER_INFO* pArenaInfo = m_pArenaManager->GetArenaServerInfo();

	char* pArenaIMSerIp = pArenaInfo->AIS_IP;		// 아레나 필드 서버
	int nArenaIMSerPort = pArenaInfo->AIS_Port;		// 아레나 필드 포트
	BOOL bAlreadyConnect = FALSE;
	BOOL bConnect = m_pIMSocket->ConnectArena(pArenaIMSerIp, nArenaIMSerPort, &bAlreadyConnect);	
	if(!bConnect)
	{
		char szNotice[1024];
		memset(szNotice,0x00,1024);		
		sprintf(szNotice, STRMSG_C_080129_0201);		//"아레나 서버와의 접속이 실패하였습니다."
		m_pChat->CreateChatChild(szNotice ,COLOR_SYSTEM);
		CloseArenaSocket();
		return;
	}

	// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
	// 이미 접속 되어 있을 경우 바로 인피니티 루틴으로
	if( bAlreadyConnect && m_ArenaSocketType == ARENASOCKET_INFINITY )
	{
		if( m_bInfinityRestart )
			m_pFieldWinSocket->SendMsg( T_FC_INFINITY_RESTART_BY_DISCONNECT, NULL, 0 );
		else
		{
			// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 			// 설명 화면으로 전환
// 			CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 			if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 				((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_DESC, TRUE );

			// 설명 화면으로 전환
			CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
			if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
				((CINFCityInfinityField*)((*it).second))->ShowWndEx( TRUE );
			// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
		}

		return;
	}
	// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

	EnterLock(FALSE);	// FALSE :Lock  TRUE : UnLock
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아레나 IM서버와의 연결이 완료된 상태다.
/// \author		// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ArenaIMSocketConnectLoginOk()
{	
	DBGOUT("void CAtumApplication::ArenaIMSocketConnectLoginOk() \n");
	// IM서버와의 연결이 완료된 상태를 메인 서버에 알려준다.
	// T_IC_CONNECT_FM_TO_IM_OK 올떄까지 기다린다.
	g_pFieldWinSocket->SendMsg(T_FC_CONNECT_ARENASERVER_TO_IMSERVER, NULL, NULL);				

	// Lock
	{
		vector<MessageType_t> vecUnLockMsg;
		vecUnLockMsg.clear();		
		vecUnLockMsg.push_back(T_IC_CONNECT_FM_TO_IM_OK);		
		// 하나만 매칭 되어도 락이 풀린다. 
		EnterMultiLock(FALSE, T_FC_CONNECT_ARENASERVER_TO_IMSERVER, vecUnLockMsg, MULTI_LOCK_ONE_MATCHING);
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-03-03 by bhsohn 통합 아레나 IM서버 연결과정 수정
/// \date		2007-12-14 ~ 2007-12-14
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////						
void CAtumApplication::IMSocketConnectFmToImOk()
{
	DBGOUT("void CAtumApplication::IMSocketConnectFmToImOk() \n");

	if(FALSE == IsGmModeConnect())
	{
		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		if( m_ArenaSocketType == ARENASOCKET_INFINITY )
		{
			// 튕긴유저 재접속시
			if( m_bInfinityRestart )
				m_pFieldWinSocket->SendMsg( T_FC_INFINITY_RESTART_BY_DISCONNECT, NULL, 0 );
			else
			{
				// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)

// 				// 설명 화면으로 전환
// 				CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 				if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 					((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_DESC, TRUE );

				// 설명 화면으로 전환
				CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
				if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
					((CINFCityInfinityField*)((*it).second))->ShowWndEx( TRUE );

				// END 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
			}

			return;
		}
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		
		// 유저는 Login Ok가 떨어진후 팀정보를 요청한다
		RequestArenaTeamList();
	}
	else
	{
		// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		if( m_ArenaSocketType == ARENASOCKET_INFINITY )
		{
			// 튕긴 유저 재접속시
			if( m_bInfinityRestart )
				m_pFieldWinSocket->SendMsg( T_FC_INFINITY_RESTART_BY_DISCONNECT, NULL, 0 );
			else
			{
				// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
// 				// 설명 화면으로 전환
// 				CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
// 				if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
// 					((CINFCityInfinityField*)((*it).second))->ShowWndEx( CINFCityInfinityField::INFINITY_DESC, TRUE );

				// 설명 화면으로 전환
				CMapCityShopList::iterator it = m_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_INFINITY );
				if( it != m_pInterface->m_pCityBase->m_mapCityShop.end() )
					((CINFCityInfinityField*)((*it).second))->ShowWndEx( TRUE );
				// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
			}

			return;
		}
		// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
		
		EnterLock(TRUE);	// FALSE :Lock  TRUE : UnLock
		
		// GM은 Login Ok가 떨어진후 창을 띠운다.
		DoModalAreanQuestion();
	}						
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			BOOL IsDoingStrategyWar()
/// \brief		거점전 또는 모선전 중이냐?
/// \author		// 2008-03-07 by bhsohn 세력전시, 아레나 이용 못하게 변경
/// \date		2008-03-07 ~ 2008-03-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsDoingInfluenceWar()
{
	//m_pUnitInfoBar->GetSummonMotherShipCnt()
	if(NULL == g_pInterface
		||NULL == g_pGameMain 
		||(g_pGameMain && NULL == g_pGameMain->m_pUnitInfoBar))
	{
		return FALSE;
	}
	BOOL bDoingStrategyWar = g_pInterface->IsDoingStrategyWar();// 거점전이냐?
	BOOL bMothershipWar = TRUE;
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
	if(0 == g_pGameMain->GetSummonMotherShipCnt()) 
	{
		bMothershipWar = FALSE;
	}
	// 2012-11-22 by jhseol, 전쟁 시스템 리뉴얼 - 전진기지전(OutPost)때 인피 입장 제한
#ifdef C_WAR_SYSTEM_RENEWAL_STRATEGYPOINT_JHSEOL
	BOOL bOutPostWar = FALSE;
	if( NULL != g_pGameMain->m_pOutPost )
	{
		if( TRUE == g_pGameMain->m_pOutPost->IsOutPosting() )
		{
			bOutPostWar = TRUE;
		}
	}
	if(bDoingStrategyWar || bMothershipWar || bOutPostWar)
	{
		return TRUE;
	}
#else
	if(bDoingStrategyWar || bMothershipWar)
	{
		return TRUE;
	}
#endif
	// end 2012-11-22 by jhseol, 전쟁 시스템 리뉴얼 - 전진기지전(OutPost)때 인피 입장 제한
	return FALSE;

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketArenaUseCityWarpItem(MSG_FC_CONNECT_ARENASERVER_SSERVER_GROUP_FOR_CLIENT* pMsg)
/// \brief		아레나에서 귀환 포탈 처리
/// \author		// 2008-03-10 by bhsohn 아레나에서 귀환 포탈 처리
/// \date		2008-03-10 ~ 2008-03-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketArenaUseCityWarpItem()
{	
	ArenaFinishWarp(TRUE);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			void CAtumApplication::FieldSocketInfoMSWarInfoDisplay(MSG_FC_INFO_MSWARINFO_DISPLAY* pMsg)
/// \brief		모선전 진행중 거점정보값.
/// \author		dgwoo
/// \date		2008-03-27 ~ 2008-03-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoMSWarInfoDisplay(MSG_FC_INFO_MSWARINFO_DISPLAY* pMsg)
{
	SMSWARINFO_DISPLAY* pWarInfo= (SMSWARINFO_DISPLAY *)((char *)pMsg + sizeof(MSG_FC_INFO_MSWARINFO_DISPLAY));
	int i;
	for(i = 0 ; i < pMsg->MSWarInfoDisPlayListCount ; i++)
	{
		// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
		g_pGameMain->SetWarPointMapInfo(pWarInfo);
		//pWarInfo += sizeof(SMSWARINFO_DISPLAY);
		pWarInfo++;
	}
}
void CAtumApplication::FieldSocketInfoMSWarInfoDisplayOptionOK(MSG_FC_INFO_MSWARINFO_DISPLAY_OPTION_OK* pMsg)
{
	// 2008-04-04 by bhsohn 모선전 관리 클래스 추가
	g_pGameMain->SetMSWarInfoDisplayOption(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-03-17 by bhsohn 윈도우 이동시 Tick안들어오는 문제 처리
/// \date		2008-03-17 ~ 2007-11-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsPossibleWindowMove()
{
	DWORD dwGameState = GetGameState();
	switch(dwGameState)
	{
	case _GAME:
		{
			// 2014-02-05 by ymjoo 윈도우 모드에서 마우스 조작 버그 수정
// 			if(m_bCharacter 
// 				|| (NULL == m_pShuttleChild)
// 				||(!m_pShuttleChild->IsAir()))
			if(m_bCharacter
				|| (NULL == m_pShuttleChild)
				|| (!(m_pShuttleChild->GetCurrentBodyCondition() & BODYCON_FLY_MASK)))
			// END 2014-02-05 by ymjoo 윈도우 모드에서 마우스 조작 버그 수정
			{
				// 땅에 있거나 캐릭터 모드면 움직일수 있다.
				return TRUE;
			}		
			return m_pShuttleChild->IsUnitStop();			
		}
		break;		
	}				
	return TRUE;	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-03-27 by bhsohn 미션성공창이 떠있는 상태에서는 상점이 안열리게 변경
/// \date		2008-03-27 ~ 2008-03-27
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsPossibleShopOpen()
{	
	if(g_pGImage->GetRenderFlag() && (MISSION_SUC == g_pGImage->GetSelectImageIndex()))		
	{
		return FALSE;
	}
	// 2008-06-24 by bhsohn 바자상점과 캐쉬상점 동시에 뜨우기 불가능하게 함
	else if(g_pInterface->IsBazarOpen())
	{		
		return FALSE;		
	}	
	// end 2008-06-24 by bhsohn 바자상점과 캐쉬상점 동시에 뜨우기 불가능하게 함
	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		모선전 정보 요청에 대한 응답
/// \author		// 2008-03-19 by bhsohn 모선전, 거점전 정보창
/// \date		2008-03-19 ~ 2008-03-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoMsWarInfoResultOk(MSG_FC_INFO_MSWARINFO_RESULT_OK* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
//	if(BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
//	{
//		return;
//	}
	if((BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
		&&(BUILDINGKIND_CITYLEADER_OUTPOST != nBuildingKind))	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
	{
		return;
	}

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() || NULL == it->second)
	{
		return;
	}
	//CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);

	char szMonsterName[SIZE_MAX_MONSTER_NAME];	// 몬스터 이름
	memset(szMonsterName, 0x00, SIZE_MAX_MONSTER_NAME);

	// 초기화 
	//pCityLeader->InitWarInfoMothership();
	if(BUILDINGKIND_CITYLEADER_LEADER == nBuildingKind)
	{
		CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
		pCityLeader->InitWarInfoMothership();

	}
	else if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildingKind)
	{
		CINFCityOutPost * pOutPost = ((CINFCityOutPost*)it->second);
		pOutPost->InitWarInfoMothership();
	}


	// 아이템 등록
	SMSWAR_INFO_RESULT * pMsgItem = (SMSWAR_INFO_RESULT *)((char *)pMsg + sizeof(MSG_FC_INFO_MSWARINFO_RESULT_OK));
	for(int i = 0; i < pMsg->MSWarInfoResultListCount; i++)
	{
		MEX_MONSTER_INFO* pMonsterInfo = g_pDatabase->CheckMonsterInfo(pMsgItem->MonsterUID);
		if(pMonsterInfo)
		{
			STRNCPY_MEMSET(szMonsterName,pMonsterInfo->MonsterName,SIZE_MAX_MONSTER_NAME);
		}
		else
		{
			memset(szMonsterName, 0x00, SIZE_MAX_MONSTER_NAME);
		}
		// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
//		pCityLeader->AddWarInfoMothership(pMsgItem->AttInfluence,	// 공격세력
//								pMsgItem->WinInfluence,		// 승리세력
//								szMonsterName,				// 모선이름
//								pMsgItem->ContributionPoint,				// 세력포인트
//								pMsgItem->MSWarStartTime,	// 시작시간
//								pMsgItem->MSWarEndTime);	//종료시간	

		
		if(BUILDINGKIND_CITYLEADER_LEADER == nBuildingKind)
		{
			CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
			pCityLeader->AddWarInfoMothership(pMsgItem->AttInfluence,	// 공격세력
								pMsgItem->WinInfluence,		// 승리세력
								szMonsterName,				// 모선이름
								pMsgItem->ContributionPoint,				// 세력포인트
								pMsgItem->MSWarStartTime,	// 시작시간
								pMsgItem->MSWarEndTime);	//종료시간	
		}
		else if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildingKind)
		{
			CINFCityOutPost * pOutPost = ((CINFCityOutPost*)it->second);
			pOutPost->AddWarInfoMothership(pMsgItem->AttInfluence,	// 공격세력
								pMsgItem->WinInfluence,		// 승리세력
								szMonsterName,				// 모선이름
								pMsgItem->ContributionPoint,				// 세력포인트
								pMsgItem->MSWarStartTime,	// 시작시간
								pMsgItem->MSWarEndTime);	//종료시간	
			
		}
		// end 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창

		pMsgItem++;
	}
	// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경
	// 현재 진행중인 거점전 
	g_pGameMain->UpdatePlayingMotherShipInfo();
	
	// end 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		거점전 정보 요청에 대한 응답
/// \author		// 2008-03-19 by bhsohn 모선전, 거점전 정보창
/// \date		2008-03-19 ~ 2008-03-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoSpWarInfoResultOkHeader()
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
//	if(BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
//	{
//		return;
//	}
	if((BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
		&&(BUILDINGKIND_CITYLEADER_OUTPOST != nBuildingKind))	
	{
		return;
	}
	// end 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창

	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() || NULL == it->second)
	{
		return;
	}	

	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
	//CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
	// 초기화
	//pCityLeader->InitWarInfoPointWar();	
	if(BUILDINGKIND_CITYLEADER_LEADER == nBuildingKind)
	{
		CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
		pCityLeader->InitWarInfoPointWar();

	}
	else if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildingKind)
	{
		CINFCityOutPost * pOutPost = ((CINFCityOutPost*)it->second);
		pOutPost->InitWarInfoPointWar();
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		거점전 정보 요청에 대한 응답
/// \author		// 2008-03-19 by bhsohn 모선전, 거점전 정보창
/// \date		2008-03-19 ~ 2008-03-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoSpWarInfoResultOk(MSG_FC_INFO_SPWARINFO_RESULT_OK* pMsg)
{
	GUI_BUILDINGNPC* pBuilding = g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
	if(NULL == pBuilding)
	{
		return;
	}
	int nBuildingKind = pBuilding->buildingInfo.BuildingKind;
	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
//	if(BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
//	{
//		return;
//	}
	if((BUILDINGKIND_CITYLEADER_LEADER != nBuildingKind)
		&&(BUILDINGKIND_CITYLEADER_OUTPOST != nBuildingKind))	
	{
		return;
	}
	
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(nBuildingKind);
	if(it == g_pInterface->m_pCityBase->m_mapCityShop.end() || NULL == it->second)
	{
		return;
	}
	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
	//CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);

	char buf[256];
	memset(buf, 0x00, 256);
	char* pMapName = g_pGameMain->GetMapNameByIndex(pMsg->SPSummonMapIndex);	
	if(pMapName)
	{		
		STRNCPY_MEMSET(buf,pMapName,SIZE_MAX_MAP_NAME);

	}
	// 2008-10-16 by bhsohn 전진기지 모선전, 거점전 정보창
//	pCityLeader->AddWarInfoPointWar(pMsg->AttInfluence,	// 공격세력
//						pMsg->WinInfluence,		// 승리세력
//						buf,				// 맵이름											
//						pMsg->SPWarStartTime,	// 시작시간
//						pMsg->SPWarEndTime);	//종료시간	
	if(BUILDINGKIND_CITYLEADER_LEADER == nBuildingKind)
	{
		CINFCityLeader * pCityLeader = ((CINFCityLeader*)it->second);
		pCityLeader->AddWarInfoPointWar(pMsg->AttInfluence,	// 공격세력
						pMsg->WinInfluence,		// 승리세력
						buf,				// 맵이름											
						pMsg->SPWarStartTime,	// 시작시간
						pMsg->SPWarEndTime);	//종료시간	
	}
	else if(BUILDINGKIND_CITYLEADER_OUTPOST == nBuildingKind)
	{
		CINFCityOutPost * pOutPost = ((CINFCityOutPost*)it->second);
		pOutPost->AddWarInfoPointWar(pMsg->AttInfluence,	// 공격세력
						pMsg->WinInfluence,		// 승리세력
						buf,				// 맵이름											
						pMsg->SPWarStartTime,	// 시작시간
						pMsg->SPWarEndTime);	//종료시간	

	}


}
void CAtumApplication::FieldSocketEventClickTeleportOK(MSG_FC_EVENT_CLICK_TELEPORT_OK* pMsg)
{
	g_pGameMain->SetMotherShipTeleportTime(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-07 by bhsohn 시스템키 걸러내는 시스템 추가
/// \date		2008-04-07 ~ 2008-04-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsSysKeyDownPermisiion(WPARAM wParam, LPARAM lParam)
{
	switch(wParam)
	{
	case 18:		// 알트키만 눌렀음
	case VK_F10:	// 알트+ F10조합	
		{
			return TRUE;
		}
	}
	return FALSE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-22 by bhsohn 모선/거점전 진행중인 정보도 표시 하게 변경
/// \date		2008-04-22 ~ 2008-04-22
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoSpWarInfoResultOkDone()
{
	g_pInterface->UpdateShoptPlayingSPWarInfo();

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatLetterRqTitleHeader()
{

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatLetterRqTitle(MSG_FC_CHAT_LETTER_REQUEST_TITLE_OK* pMsg)
{
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();

	pLetter->AddReadLetter(FALSE, pMsg->CheckRead, pMsg->LetterUID, pMsg->SendCharacterName, pMsg->Title, pMsg->SendDate);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatLetterRqTitleOkDone()
{
	// 일반 편지를 다 받으면 전체 편지를 요청한다.
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();

	pLetter->RqAllLetterTitle();

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketLetterReadOk(MSG_FC_CHAT_LETTER_READ_OK* pMsg)
{
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();

	pLetter->SetLetterInfo(FALSE, pMsg->LetterUID, pMsg->Content);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketAllLetterReadOk(MSG_FC_CHAT_ALLLETTER_READ_OK* pMsg)
{
//	ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();

	pLetter->SetLetterInfo(TRUE, pMsg->LetterUID, pMsg->Content);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatLetterDelOk()
{
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();
	pLetter->FieldSocketChatLetterDelOk();	// 리스트 재요청 

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatSendOk()
{
	char buf[256];
	wsprintf(buf, STRMSG_C_080513_0200);//"\\y편지가 발송되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		편지 받음.
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FiedldSocketChatLetterReceive(MSG_FC_CHAT_LETTER_RECEIVE* pMsg)
{
	char buf[256];
	wsprintf(buf, STRMSG_C_080513_0206, pMsg->SendCharacterName);//"%s님으로부터 편지가 왔습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatALLLetterRqTitle(MSG_FC_CHAT_ALLLETTER_REQUEST_TITLE_OK* pMsg)
{
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();

	pLetter->AddReadLetter(TRUE, pMsg->CheckRead, pMsg->LetterUID, pMsg->SendCharacterName, pMsg->Title, pMsg->SendDate);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketChatALLLetterRqTitleOkDone()
{
	//ASSERT_IMPLIES(g_pGameMain, g_pGameMain->m_pCommunity);
	CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();
	pLetter->CheckNotReadMail();
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		전체편지 받음.						
/// \author		// 2008-04-04 by bhsohn Ep3 커뮤니티 창
/// \date		2008-05-13 ~ 2008-05-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FiedldSocketChatAllLetterReceive(MSG_FC_CHAT_ALLLETTER_RECEIVE* pMsg)
{
	char buf[256];
	wsprintf(buf, STRMSG_C_080513_0206, pMsg->SendCharacterName);//"%s님으로부터 편지가 왔습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		Multi Lock끝나고 요청할 사항 있을시에 대한 처리
/// \author		// 2008-05-28 by bhsohn Multi Lock끝나고 요청할 사항 있을시에 대한 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::MultiLockFinished(MessageType_t	nPreLockMsg)
{
	switch(nPreLockMsg)
	{
	case T_FC_CHARACTER_GAMESTART:
		{			
			// 처음 게임 들어왔을시편지항목이 있는지 알기 위해 편지리스트를 요청한다.
			if(g_pGameMain && g_pGameMain->m_pCommunity)
			{
				CINFCommunityLetter* pLetter = g_pGameMain->m_pCommunity->GetLetter();
				if(pLetter)
				{
					pLetter->RqLetterTitle(TRUE);			
				}
			}
		}
		break;
	}
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 공지 사항 등록
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketNoticeWriteOk(MSG_IC_GUILD_NOTICE_WRITE_OK* pMsg)
{
	CINFCommunityGuild* pGuild = g_pGameMain->m_pCommunity->GetGuild();	
	pGuild->SetNoticeWrite(pMsg->Notice);

	char buf[256];
	wsprintf(buf, STRMSG_C_080616_0204); //"\\y여단 공지가 등록되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	



}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 지원자 관리
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGetApplicantOkHeader()
{

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 지원자 관리 추가
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGetApplicantOk(MSG_IC_GUILD_GET_APPLICANT_OK *pMsg)
{	
	// 지원자를 다 정보를 얻어옴
	CINFCommunityGuildManager* pManager = g_pGameMain->m_pCommunity->GetGuildManager();
	pManager->AddMemberList(pMsg->CharacterUID, pMsg->CharacterName, pMsg->UnitKind, pMsg->Level);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 지원자 관리
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGetApplicantOKDone()
{
	// 지원자를 다 얻어왔으면 여단 소개를 얻어온다.
	CINFCommunityGuildManager* pManager = g_pGameMain->m_pCommunity->GetGuildManager();
	pManager->RqGuildGetIntodution();	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 소개를얻어옴
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGetIntroducitonOk(MSG_IC_GUILD_GET_INTRODUCTION_OK* pMsg)
{
	CINFCommunityGuildManager* pManager = g_pGameMain->m_pCommunity->GetGuildManager();
	pManager->UpdateGuildIntoduce(pMsg->GuildIntroduction);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 소개를얻어옴
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildSearchIntroOk(MSG_IC_GUILD_SEARCH_INTRODUCTION_OK* pMsg)
{	
	CINFCommunityGuildSearch* pSearch = g_pGameMain->m_pCommunity->GetGuildSearch();
	pSearch->AddGuildList(pMsg->GuildUID, 
							pMsg->GuildName, 
							pMsg->CharacterName, 
							pMsg->WriteDate,
							pMsg->GuildIntroduction);	

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 여단 소개를 왐료
/// \author		// 2008-06-03 by bhsohn EP3 여단 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildSearchIntroDone()
{
	CINFCommunityGuildSearch* pSearch = g_pGameMain->m_pCommunity->GetGuildSearch();
	pSearch->IMSocketGuildSearchIntroDone();

}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 편대 리스트를 얻어온다.
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketPartyListInfoOk(MSG_IC_PARTY_LIST_INFO_OK* pMsg)
{
	CINFCommunityParty*	pParty = g_pGameMain->m_pCommunity->GetParty();	// 편대
	SPARTY_LIST_INFO* pListInfo= (SPARTY_LIST_INFO*)((char *)pMsg + sizeof(MSG_IC_PARTY_LIST_INFO_OK));

	pParty->SetTotalPartyCnt(pMsg->PartyInfoTotalCount); // 최대 파티수 

	int i;
	for(i = 0 ; i < pMsg->PartyInfoListCount; i++)
	{	
		pParty->AddPartyList(pListInfo);
		pListInfo++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 추천 인원을 알려준다.
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketPartyReCommandMemberOk(MSG_IC_PARTY_RECOMMENDATION_MEMBER_OK* pMsg)
{	
	CINFCommuPartyInvite* pParty = g_pGameMain->m_pCommunity->GetPartyInvite(); // 편대 초대
	SRECOMMENDATION_MEMBER_INFO* pListInfo= (SRECOMMENDATION_MEMBER_INFO*)((char *)pMsg + sizeof(MSG_IC_PARTY_RECOMMENDATION_MEMBER_OK));
	int i;
	for(i = 0 ; i < pMsg->Count; i++)
	{			
		pParty->AddInvitePartyInfo(pListInfo);
		pListInfo++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 편대 옵션 변경
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketPartyChangeInfoOk()
{	
	CINFCommunityParty* pParty = g_pGameMain->m_pCommunity->GetParty();		// 편대옵션
	SPARTY_INFO* pSetupInfo = pParty->GetSPartyInfoSetup();

	ShowPartyChangeInfo(pSetupInfo);	

	// Setup 정보 저장
	g_pShuttleChild->m_pClientParty->SetSPartyInfo(pSetupInfo);

}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 편대 옵션 변경
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketPartyInfo(MSG_IC_PARTY_INFO* pMsg)
{
	if(g_pShuttleChild && g_pShuttleChild->m_pClientParty)
	{
		if(g_pShuttleChild->m_pClientParty->GetPartyInfo().bPartyType == _PARTYMEMBER)
		{
			if(!g_pShuttleChild->m_pClientParty->GetFirstPartySetupInfo())
			{
				// 처음엔 표시하지 않는다.
				ShowPartyChangeInfo(&pMsg->PartyInfo);
			}			
		}
		g_pShuttleChild->m_pClientParty->SetFirstPartySetupInfo(FALSE);

		g_pShuttleChild->m_pClientParty->SetSPartyInfo(&pMsg->PartyInfo);
	}
	if(g_pGameMain && g_pGameMain->m_pCommunity)
	{
		CINFCommunityParty* pParty = g_pGameMain->m_pCommunity->GetParty();		
		pParty->UpdateSetupInfo(&pMsg->PartyInfo);
	}	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 편대 옵션 변경
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGetSelfIntroductionOK(MSG_IC_GUILD_GET_SELF_INTRODUCTION_OK* pMsg)
{
	CINFCommunity* pCommu = g_pGameMain->m_pCommunity;
	pCommu->IMSocketGetSelfIntroductionOK(pMsg);
		
}

// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
void CAtumApplication::IMSocketPartyGetAutoInfoOK( MSG_IC_PARTY_GET_AUTO_PARTY_INFO_OK* pMsg )
{
	m_pShuttleChild->m_pClientParty->IPartyGetAutoPartyInfoOK( pMsg );
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 편대 옵션 변경
/// \author		// 2008-06-03 by bhsohn EP3 편대 관련 처리
/// \date		2008-05-28 ~ 2008-05-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildMemerLevelUp(MSG_IC_GUILD_MEMBER_LEVEL_UP* pMsg)
{
	g_pGameMain->m_pCommunity->GetGuild()->SetLevelInfo(pMsg->CharacterUID, pMsg->Level);
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		태국 게임 종료후 웹페이지 뜨우게 함
/// \author		// 2008-06-16 by bhsohn 태국 게임 종료후 웹페이지 뜨우게 함
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::ExcuteExplore()
{		
#ifdef LANGUAGE_THAI
	// 게임종료후 웹싸이트 접속
	ShellExecute(NULL, _T("open"), _T("explorer.exe"), CLOSE_WEBSTIE, NULL, SW_NORMAL);
#endif

	return TRUE;
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-16 by bhsohn EP3관련 버그수정
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildUpdateIntroductionOk()
{
	char buf[256];
	wsprintf(buf, STRMSG_C_080616_0200); //"\\y여단 홍보가 등록되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-16 by bhsohn EP3관련 버그수정
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildDelIntroductionOk()
{	
	char buf[256];
	wsprintf(buf, STRMSG_C_080616_0201); //"\\y여단 홍보가 해제 되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-16 by bhsohn EP3관련 버그수정
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketUpdateSelfIntroOk()
{	
	char buf[256];
	wsprintf(buf, STRMSG_C_080616_0202); //"\\y가입신청이 완료되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-16 by bhsohn EP3관련 버그수정
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketDelSelfIntroOk()
{	
	char buf[256];
	wsprintf(buf, STRMSG_C_080616_0203); //"\\y가입신청이 취소 되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
}
FLOAT CAtumApplication::GetFPS()
{
	// 2013-05-03 by bhsohn 인피니티 이동시, Exception 안전코드 추가
	if(!m_pShuttleChild)
	{
		return m_fFPS;
	}
	// END 2013-05-03 by bhsohn 인피니티 이동시, Exception 안전코드 추가

	if(COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
		return 30.f;
	}
	return m_fFPS; 
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-16 by bhsohn EP3관련 버그수정
/// \date		2008-06-16 ~ 2008-06-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::InitOptionEtcInfo(sOPTION_ETC* pEtc)
{
	pEtc->bRadioInfo[OPTION_RADIO_MAN_TO_MAN] = TRUE;			// 1:1전투	
	pEtc->bRadioInfo[OPTION_RADIO_FORMATIONWAR] = TRUE;		// 편대전투
	pEtc->bRadioInfo[OPTION_RADIO_GUILD_WAR] = TRUE;			// 여단전투
	pEtc->bRadioInfo[OPTION_RADIO_WHISPER] = TRUE;			// 귓속말
	pEtc->bRadioInfo[OPTION_RADIO_FORMATION_INVITE] = TRUE;	// 편대초대
	pEtc->bRadioInfo[OPTION_RADIO_GUILD_INVITE] = TRUE;		// 여단초대
	pEtc->bRadioInfo[OPTION_RADIO_EXCHANGE] = TRUE;			// 교환
	pEtc->bRadioInfo[OPTION_RADIO_INTERFACE_POS] = FALSE;	// 인터페이스 위치 저장
	pEtc->bRadioInfo[OPTION_RADIO_INTERFACE_HIDE] = FALSE;	// 인터페이스 모두 감추기
	pEtc->bRadioInfo[OPTION_RADIO_FRIEND_ID_HIDE] = FALSE;	// 같은 세력 아이디 감추기
	pEtc->bRadioInfo[OPTION_RADIO_ENEMY_ID_HIDE] = FALSE;	// 다른 세력 아이디 감추기
	pEtc->bRadioInfo[OPTION_RADIO_MOUSE_LOCK] = FALSE;	// 마우스 가두기(윈도우 모드시)
	pEtc->bRadioInfo[OPTION_RADIO_CHAT_FILTER] = TRUE;	// 욕필터

	// 인터페이스 위치 
	pEtc->stRateRect.fRateX = pEtc->stRateRect.fRateY = pEtc->stRateRect.fRateWidth = pEtc->stRateRect.fRateHeight = 0;

	// 2009. 02. 03 by ckPark 채팅창 인터페이스 크기 저장
// 	pEtc->stRateRect.fGameWidth = g_pD3dApp->GetBackBufferDesc().Width;
// 	pEtc->stRateRect.fGameHeight = g_pD3dApp->GetBackBufferDesc().Height;

	memset(&(pEtc->stChatRect), 0, sizeof(stcuctRateRect));

	pEtc->stRateRect.fGameWidth = g_pD3dApp->GetWidth();
	pEtc->stRateRect.fGameHeight = g_pD3dApp->GetHeight();
	// end 2009. 02. 03 by ckPark 채팅창 인터페이스 크기 저장
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-18 by bhsohn 여단원증가 카드 관련 처리
/// \date		2008-06-18 ~ 2008-06-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketGuildChangeMemberShip(MSG_IC_GUILD_CHANGE_MEMBERSHIP* pMsg)
{
	if(NULL == g_pGameMain || NULL == g_pGameMain->m_pCommunity)
	{
		return;
	}
	CINFCommunityGuild* pGuild = g_pGameMain->m_pCommunity->GetGuild();
	pGuild->SetGuildChangeMemberShip(pMsg);

}



// 2009. 01. 12 by ckPark 선전 포고 시스템
void	CAtumApplication::IMSocketWarDeclareSetOK(MSG_IC_INFO_DECLARATION_MSWAR_SET_OK* pMsg)
{
	// 지도자, GM, 관리자만 표시
	if(COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER|RACE_GAMEMASTER|RACE_OPERATION))
	{
		char szTemp[MAX_PATH];
		sprintf(szTemp, STRMSG_C_090113_0318, pMsg->SelectCount);
		m_pChat->CreateChatChild(szTemp, COLOR_ERROR);// "\\y선전포고 정보가 변경 되었습니다. 앞으로 정보 수정은 %d번 가능합니다.\\y"
	}

	GUI_BUILDINGNPC*	pCurBuilding	= g_pInterface->m_pCityBase->GetCurrentBuildingNPC();

	CINFCityLeader*		pCityLeader		= 0;
	CINFCityOutPost*	pOutPost		= 0;
	CINFWarDeclare*		pWarDeclare		= 0;

	// 관제탑, 전진기지 얻어오기
	if( !pCurBuilding )
		return;
	else if( pCurBuilding->buildingInfo.BuildingKind == BUILDINGKIND_CITYLEADER_LEADER )
		pCityLeader	= static_cast<CINFCityLeader*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_LEADER));
	else if( pCurBuilding->buildingInfo.BuildingKind = BUILDINGKIND_CITYLEADER_OUTPOST )
		pOutPost	= static_cast<CINFCityOutPost*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_OUTPOST));

	// 관리자일 경우 선전포고 창도 얻어오기
	if(COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER|RACE_GAMEMASTER|RACE_OPERATION))
		pWarDeclare	= g_pGameMain->GetINFMotherShipManager()->GetWarDeclareWindow();

	// 포기 일경우 년도 0으로 셋팅
	if(pMsg->GiveUp)
		pMsg->MSWarStartTime.Year	= 0;

	// 자신의 세력일 경우
	if(pMsg->Influence == g_pShuttleChild->m_myShuttleInfo.InfluenceType)
	{
		// 다음주 아군 모선 시간 업데이트
		if(pCityLeader)
			pCityLeader->SetWarDeclareTime(pMsg->MSWarStartTime, pCityLeader->GetOurNextTakeOffTime());
		
		// 다음주 아군 모선 시간 업데이트
		if(pOutPost)
			pOutPost->SetWarDeclareTime(pMsg->MSWarStartTime, pOutPost->GetOurNextTakeOffTime());
		
		// 지도자일경우
		if(pWarDeclare)
		{
			// 선전포고 시간, 설정 가능 횟수셋팅
			pWarDeclare->SetWarDeclareDate(&pMsg->MSWarStartTime);
			pWarDeclare->SetWarDeclareLeftChance(pMsg->SelectCount);
		}
	}
	else
	{	// 적군일 경우
		// 다음주 적군 모선 시간 업데이트
		if(pCityLeader)
			pCityLeader->SetWarDeclareTime(pMsg->MSWarStartTime, pCityLeader->GetEnemyNextTakeOffTime());
		
		// 다음주 아군 모선 시간 업데이트
		if(pOutPost)
			pOutPost->SetWarDeclareTime(pMsg->MSWarStartTime, pOutPost->GetEnemyNextTakeOffTime());
	}

	// 오퍼레이터
	g_pInterface->ShowOpWarDeclare(pMsg->Influence, pMsg->MSWarStartTime, pMsg->GiveUp, pMsg->SelectCount);



	// 일반 세력일 경우 아무것도 안함
	if( COMPARE_INFLUENCE( g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_NORMAL ) )
		return;
	
	char	chBufTmp[MAX_PATH]; 
	memset(chBufTmp, 0x00, MAX_PATH);
	
	// 각자 세력 이름 설정
	char	*szOurInflName, *szEnemyInflName;
	if( COMPARE_INFLUENCE( g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_ANI ) )
	{
		szOurInflName	= STRMSG_C_060210_0001;
		szEnemyInflName	= STRMSG_C_060210_0000;
	}
	
	else if( COMPARE_INFLUENCE( g_pShuttleChild->m_myShuttleInfo.InfluenceType, INFLUENCE_TYPE_VCN ) )
	{
		szOurInflName	= STRMSG_C_060210_0000;
		szEnemyInflName	= STRMSG_C_060210_0001;
	}
	else 
	{
		return;
	}

	// 포기여부에 따라 스트링 변경
	if(pMsg->GiveUp)	// "\\y세력(%s)에서 세력(%s)에게 선전포고를 포기하였습니다. (정보수정%d번 남음)\\y"
		sprintf(chBufTmp, STRMSG_C_090113_0326, szOurInflName, szEnemyInflName, pMsg->SelectCount);
	else		// "\\y세력(%s)에서 세력(%s)에게 %s %02d:%02d에 선전포고를 하였습니다.(정보수정%d번 남음)\\y"
	{
		std::string strYYYYMMDD;
		pMsg->MSWarStartTime.GetLocalString_YYYYMMDD(pMsg->MSWarStartTime.Year, pMsg->MSWarStartTime.Month, pMsg->MSWarStartTime.Day, strYYYYMMDD, GetLanguageType());
		sprintf(chBufTmp, STRMSG_C_090113_0319, szOurInflName, szEnemyInflName, strYYYYMMDD.c_str(), pMsg->MSWarStartTime.Hour, pMsg->MSWarStartTime.Minute, pMsg->SelectCount); // "\\y세력(%s)에서 세력(%s)에게 %d년 %d월 %d일 %d:%d에 선전포고를 하였습니다.(정보수정%d번 남음)\\y"
	}

	m_pChat->CreateChatChild(chBufTmp, COLOR_ERROR);
}
// end 2009. 01. 12 by ckPark 선전 포고 시스템
// 2010. 03. 18 by jskim 몬스터변신 카드
void CAtumApplication::IMSocketPartyUpdateItemTransformerOk(MSG_IC_PARTY_UPDATE_ITEM_TRANSFORMER_OK* pMsg)
{

}
//end 2010. 03. 18 by jskim 몬스터변신 카드
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		강제로 마우스 위치 지정하게 만든다.
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::ForceMousePos(UINT uMsg, WPARAM wParam, LPARAM lParam)
{	
	m_fMouseLockTime += GetCheckElapsedTime();
	float fOldTime = m_fMouseLockTime;
	if((WM_MOUSEMOVE != uMsg) && m_fMouseLockTime > 0.2f )
	{		
		m_fMouseLockTime = 0.0f;
		return FALSE;				
	}			
	m_fMouseLockTime = 0.0f;
	
	if(m_pKeyBoard && !m_pKeyBoard->GetKeyBoardFocus())
	{			
		// 포커스가 없어도 동작안함
		return FALSE;		
	}
	else if(WM_ENTERSIZEMOVE == uMsg)
	{
		// 윈도우 이동 이벤트도 무시
		m_bWndMoving = TRUE;		
		return FALSE;
	}	
	else if(WM_EXITSIZEMOVE == uMsg)
	{
		// 윈도우 이동 종료
		if(m_bWndMoving)
		{
			m_bWndMoving = FALSE;			
			return FALSE;
		}

	}
	if(m_bWndMoving)
	{		
		return FALSE;
	}
	
	BOOL bForse = FALSE;
	RECT rtClient,rtWindow;
	POINT pt;
	GetCursorPos(&pt);
	ScreenToClient(g_pD3dApp->GetHwnd(),&pt);
	GetClientRect(g_pD3dApp->GetHwnd(),&rtClient);
	GetClientRect(g_pD3dApp->GetHwnd(),&rtWindow);

	int nWndHeight = g_pD3dApp->GetBackBufferDesc().Height;
	int nCliHeight = g_pD3dApp->GetHeight();
	int nCapHeight = abs(nWndHeight-nCliHeight);

	rtClient.top -= nCapHeight;	// 캡션바 크기떄문에	

	
	if(PtInRect(&rtClient,pt))
	{
		// 나의 클라이안이다.
		bForse = TRUE;
	}
	else
	{	
		bForse = FALSE;

		rtClient.left += WND_LOCK_PIXEL_CAP;	
		rtClient.top += (nCapHeight+WND_LOCK_PIXEL_CAP);	

		rtClient.right -= WND_LOCK_PIXEL_CAP;	
		rtClient.bottom -= WND_LOCK_PIXEL_CAP;	
		
		if(pt.x < rtClient.left)
		{
			pt.x = rtClient.left;
		}
		else if(pt.x > rtClient.right)
		{
			pt.x = rtClient.right;
		}

		if(pt.y < rtClient.top)
		{
			pt.y = rtClient.top;
		}
		else if(pt.y > rtClient.bottom)
		{
			pt.y = rtClient.bottom;
		}
		CheckMouseReverse(&pt);
		ClientToScreen(g_pD3dApp->GetHwnd(),&pt);
		SetCursorPos(pt.x, pt.y);
	}	
	return bForse;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		옵션정보를 얻어온다.
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsOptionEtc(int nOptionIdx)
{
	if(!g_pSOptionEtc || nOptionIdx < 0 || nOptionIdx >= MAX_OPTION_RADIO)
	{
		return FALSE;
	}
	return g_pSOptionEtc->bRadioInfo[nOptionIdx];
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		옵션정보를 얻어온다.
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
stcuctRateRect CAtumApplication::GetOptionInterfacePOS()
{
	stcuctRateRect stRtn; 
	memset(&stRtn, 0x00, sizeof(stcuctRateRect));

	if(!g_pSOptionEtc)
	{
		return stRtn;
	}
	memcpy(&stRtn, &g_pSOptionEtc->stRateRect, sizeof(stcuctRateRect));
	return stRtn;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		옵션정보를 저장한다.
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetOptionInterfacePOS(stcuctRateRect* pRect)
{
	if(!g_pSOptionEtc)
	{
		return;
	}
	memcpy(&g_pSOptionEtc->stRateRect, pRect, sizeof(stcuctRateRect));

}

// 2009. 02. 03 by ckPark 채팅창 인터페이스 크기 저장
stcuctRateRect CAtumApplication::GetChatInterfacePOS(void)
{
	stcuctRateRect stRtn; 
	memset(&stRtn, 0x00, sizeof(stcuctRateRect));
	
	if(!g_pSOptionEtc)
	{
		return stRtn;
	}
	memcpy(&stRtn, &g_pSOptionEtc->stChatRect, sizeof(stcuctRateRect));
	return stRtn;
}

void	CAtumApplication::SetChatInterfacePOS(stcuctRateRect* pRect)
{
	if(!g_pSOptionEtc)
		return;

	memcpy(&g_pSOptionEtc->stChatRect, pRect, sizeof(stcuctRateRect));
}
// 2009. 02. 03 by ckPark 채팅창 인터페이스 크기 저장

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		유저의 정보요청에 대한 응답값
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetUserInfoOk(MSG_FC_CHARACTER_GET_USER_INFO_OK* pMsg)						
{
	g_pGameMain->m_pCommunity->ShowUserInfo(pMsg);
}

// 2012-06-14 by isshin 아템미리보기
///////////////////////////////////////////////////////////////////////////////
/// \brief		타유저의 아이템 정보요청에 대한 응답값
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterGetUserItemInfoSecretOk(MSG_FC_CHARACTER_GET_USER_ITEM_INFO_SECRET_OK* pMsg)
{	
	g_pGameMain->m_pMenuList->SetItemInfoSecret(pMsg->bItemInfoSecret);
	g_pGameMain->m_pMenuList->SetItemInfoSecretDone(TRUE);
}

void CAtumApplication::FieldSocketCharacterGetUserItemInfoOk(MSG_FC_ENEMY_ITEM_INFO* pMsg)						
{
	FLOG("CAtumApplication::FieldSocketCharacterGetUserItemInfoOk(MSG_FC_ENEMY_ITEM_INFO* pMsg)");
	pMsg->ItemGeneral.ItemInfo = g_pDatabase->GetServerItemInfo(pMsg->ItemGeneral.ItemNum);
	
	CItemInfo* EnemyItemInfo = new CItemInfo(&pMsg->ItemGeneral);
	m_vecWearDisplayInfo.push_back(EnemyItemInfo);
}

void CAtumApplication::FieldSocketCharacterGetUserItemInfoDone(MSG_FC_CHARACTER_GET_USER_ITEM_INFO_OK_DONE* pMsg)
{
	g_pGameMain->m_pCommunity->ShowEnemyItemInfo(pMsg);
}// end 2012-06-14 by isshin 아템미리보기

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		유저의 정보요청에 대한 응답값
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeInfoOptionSecetOk()
{	  
// 2008-12-16 by dgwoo 미션 마스터 
//	char buf[256];
//	wsprintf(buf, STRMSG_C_080609_0200); //"\\y옵션이 변경되었습니다."
//	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
	
	g_pGameMain->m_pCommunity->FieldSocketCharacterChangeInfoOptionSecetOk();
}
// 2008-11-04 by dgwoo LuckyMachine기획 추가.
void CAtumApplication::FieldSocketItemUseRuckyItemOK(MSG_FC_ITEM_USE_LUCKY_ITEM_OK* pMsg)
{
	CINFLuckyMachine* pStore = (CINFLuckyMachine*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LUCKY);
	// 2009-03-04 by bhsohn 럭키 머신 수정안
	if(NULL == pStore)
	{
		return;
	}
	// end 2009-03-04 by bhsohn 럭키 머신 수정안
	pStore->ClearSearchItem();
	pStore->TakeItem(pMsg->LuckyItemSimpleInfo[0]);
	pStore->TakeItem(pMsg->LuckyItemSimpleInfo[1]);
	pStore->TakeItem(pMsg->LuckyItemSimpleInfo[2]);
	pStore->ChangeState(LUCKY_STATE_RULLET);
}


// 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현
void	CAtumApplication::FieldSocketItemChangedShapeItemNum( MSG_FC_ITEM_CHANGED_SHAPEITEMNUM* pMsg )
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_FACTORY);

	if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() ) 
	{
		CINFCityLab*	pCityLab	= ( (CINFCityLab*)it->second );
		CItemInfo*		pTargetItem	= pCityLab->FindItemFromTarget( pMsg->nItemUID );
		// 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결

// 		if( pTargetItem )
// 			pTargetItem->ShapeItemNum = pMsg->nShapeItemNum;
		if( pTargetItem )
		{
			pTargetItem->ShapeItemNum = pMsg->nShapeItemNum;
			pTargetItem->FixedTermShape = pMsg->FixedTermShape; 


		// 2012-10-11 by jhahn	기간제 아이템 
			//g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
			g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
			g_pStoreData->UpdateWearItemData( pTargetItem );
		//end 2012-10-11 by jhahn	기간제 아이템 

// 			g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
// 			g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
		}
		else
		{
			pTargetItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->nItemUID );
			if( pTargetItem )
			{
				pTargetItem->ShapeItemNum = pMsg->nShapeItemNum;
				pTargetItem->FixedTermShape = pMsg->FixedTermShape; 

				// 2012-10-11 by jhahn	기간제 아이템 
				//g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
				g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
				g_pStoreData->UpdateWearItemData( pTargetItem );
				//end 2012-10-11 by jhahn	기간제 아이템 


// 				g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
// 				g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
			}
		}
		// 2013-04-11 by bhsohn 인게임 조합창 외형 변경 인첸트 시스템 검색
#ifdef C_INGAME_MIX_ITEM
		pCityLab->FieldSocketItemChangedShapeItemNum(pMsg);
#endif
		// END 2013-04-11 by bhsohn 인게임 조합창 외형 변경 인첸트 시스템 검색

		// end 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
	}
	// 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
	else
	{
		CItemInfo*		pTargetItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->nItemUID );
		if( pTargetItem )
		{
			pTargetItem->ShapeItemNum = pMsg->nShapeItemNum;
			pTargetItem->FixedTermShape = pMsg->FixedTermShape; 

			// 2012-10-11 by jhahn	기간제 아이템 
			//g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
			g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
			g_pStoreData->UpdateWearItemData( pTargetItem );
			//end 2012-10-11 by jhahn	기간제 아이템 

			if(g_pGameMain && g_pGameMain->m_pInven)
				g_pGameMain->m_pInven->UpdateIcon(pTargetItem);	//2013-06-19 by ssjung 컬렉션에서 인벤토리에 아머 아이콘이 실시간 반영 되도록 수정  

			//end 2012-10-11 by jhahn	기간제 아이템 
// 			g_pGameMain->m_pInven->UpdateIcon( pTargetItem );
// 			g_pGameMain->m_pQuickSlot->UpdateIconName( pTargetItem );
		}
	}
	// end 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결

	// 2013-05-28 by bhsohn 아머 컬렉션 시스템
	UpdateStoreShapeItemNum(pMsg);	
	// END 2013-05-28 by bhsohn 아머 컬렉션 시스템
}

void	CAtumApplication::FieldSocketItemChangedEffectItemNum( MSG_FC_ITEM_CHANGED_EFFECTITEMNUM* pMsg )
{
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_FACTORY);

	if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() ) 
	{
		CINFCityLab*	pCityLab	= ( (CINFCityLab*)it->second );
		CItemInfo*		pTargetItem	= pCityLab->FindItemFromTarget( pMsg->nItemUID );
		if( pTargetItem )
			pTargetItem->ColorCode	= pMsg->nEffectItemNum;
		// 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
		else
		{
			pTargetItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->nItemUID );
			if( pTargetItem )
				pTargetItem->ColorCode = pMsg->nEffectItemNum;
		}
		// end 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
	}
	// 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
	else
	{
		CItemInfo*		pTargetItem = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->nItemUID );
		if( pTargetItem )
			pTargetItem->ColorCode = pMsg->nEffectItemNum;
	}
	// end 2010. 04. 01 by ckPark 리소스 변경 시스템시 팩토리나 연구소에서 아이템 회수한 후 변경이 안되는 문제 해결
}
// end 2009. 08. 27 by ckPark 그래픽 리소스 변경 시스템 구현

// 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결
void	CAtumApplication::FieldSocketPutAllQuestDone( void )
{
	float fWeight = g_pStoreData->GetTotalWeight() / CAtumSJ::GetTransport(&g_pShuttleChild->m_myShuttleInfo);
	if(fWeight >= 0.9f)
	{
		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0044,COLOR_SYSTEM);//"기어 적재량의 90%를 초과 하였습니다."
		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0045,COLOR_SYSTEM);//"최소 속도로만 이동가능하며, 연료소모량이 증가합니다."
	}
	else if(fWeight > WEIGHT_RATE_VERY_HEAVY)
	{
		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0046,COLOR_SYSTEM);//"기어 적재량의 80%를 초과 하였습니다."
		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0047,COLOR_SYSTEM);//"부스터의 사용이 제한되며, 연료소모량이 증가합니다."
	}
	else if(fWeight >= WEIGHT_RATE_HEAVY)
	{
		m_pChat->CreateChatChild(STRMSG_C_INTERFACE_0048,COLOR_SYSTEM);//"기어 적재량의 70%를 초과하여 연료소모량이 증가합니다."
	}
}
// end 2010. 01. 12 by ckPark 무게 게이지 계산시 아이템 스텟이 아닌 원본 스텟으로 계산하던 문제 해결


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		On한 친구수 
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMSocketChatOnlineEachOtherFriendCount(MSG_IC_CHAT_ONLINE_EACHOTHER_FRIEND_COUNT* pMsg)
{
	m_nOnFriendCount = pMsg->OnlineFriendCnts;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		On한 친구수 
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::GetFriendListOnCount()
{
	return m_nOnFriendCount;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-06-20 by bhsohn EP3 옵션관련 처리
/// \date		2008-06-23 ~ 2008-06-23
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::ShowPartyChangeInfo(SPARTY_INFO* pNewSetupInfo)
{
	if(NULL == m_pChat)
	{
		return;
	}
	SPARTY_INFO* pPartyInfo = g_pShuttleChild->m_pClientParty->GetSPartyInfo();
	char buf[512];
	memset(buf, 0x00, 512);
	{
		if(0 != strcmp(pNewSetupInfo->PartyPW, pPartyInfo->PartyPW))
		{
			wsprintf(buf, STRMSG_C_080714_0200); //"\\y편대 비밀 번호가 변경되었습니다."
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
		}
		
		if((pNewSetupInfo->MinLevel != pPartyInfo->MinLevel)
			||(pNewSetupInfo->MaxLevel != pPartyInfo->MaxLevel))
		{
			wsprintf(buf, STRMSG_C_080714_0201); //"\\y편대 허용 레벨이 변경 되었습니다."
			m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
		}
		if(pNewSetupInfo->ExpDistributeType != pPartyInfo->ExpDistributeType)		
		{
			switch(pNewSetupInfo->ExpDistributeType)
			{
			case EXP_DISTRIBUTE_TYPE_DAMAGE:		// 몬스터에 준 데미지에 따른 경험치 분배
				{
					wsprintf(buf, STRMSG_C_080714_0202); // "\\y경험치 분배 방식이 개인 습득 방식으로 변경되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
				}
				break;
			case EXP_DISTRIBUTE_TYPE_EQUALITY:		// 균등 분배
				{
					wsprintf(buf, STRMSG_C_080714_0203); // "\\y경험치 분배 방식이 공동 분배 방식으로 변경되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
				}
				break;
			}			
		}
		if(pNewSetupInfo->ItemDistributeType != pPartyInfo->ItemDistributeType)		
		{
			switch(pNewSetupInfo->ItemDistributeType)
			{
			case ITEM_DISTRIBUTE_TYPE_DAMAGE:		// 편대 수정 - 개인 습득	
				{
					wsprintf(buf, STRMSG_C_080714_0204); // "\\y아이템 습득 방식이 개인 습득 방식으로 변경 되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
				}
				break;
			case ITEM_DISTRIBUTE_TYPE_ORDER:		// EP3 편대 수정 - 순차 습득 
				{
					wsprintf(buf, STRMSG_C_080714_0205); // "\\y아이템 습득 방식이 순차 습득 방식으로 변경 되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
				}
				break;
			case ITEM_DISTRIBUTE_TYPE_RANDOM:		// EP3 편대 수정 - 랜덤 습득
				{
					wsprintf(buf, STRMSG_C_080714_0206); // "\\y아이템 습득 방식이 랜덤 습득 방식으로 변경 되었습니다."
					m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
				}
				break;
			}			
		}
	}
	wsprintf(buf, STRMSG_C_080609_0200); // "\\y옵션이 변경되었습니다."
	m_pChat->CreateChatChild(buf,COLOR_SYSTEM);	
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-07-17 by bhsohn 길드원 랭크 갱신시 팅기는 문제 해결
/// \date		2008-07-17 ~ 2008-07-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IMGuildChangeFameRank(MSG_IC_GUILD_CHANGE_FAME_RANK* pMsg)
{
	if(g_pGameMain && g_pGameMain->m_pCommunity)
	{
		CINFCommunityGuild* pGuild = g_pGameMain->m_pCommunity->GetGuild();
		if(pGuild)
		{
			pGuild->SetGuildRank(pMsg->GuildTotalFameRank, pMsg->GuildMonthlyFameRank);
		}

	}	
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsSingletonMode()
{
	return FALSE;
	//return TRUE; // 서버 연결 없이 실행
	//return FALSE; // 서버 연결 하고 실행
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::SetTempCharcaterInfo()	
{		
	if(!IsSingletonMode())
	{
		return FALSE;
	}
	// 전체 캐릭터 리스트
	{
		MSG_FC_CONNECT_LOGIN_OK sMsg;	
		memset(&sMsg, 0x00, sizeof(MSG_FC_CONNECT_LOGIN_OK));
		// 캐릭터 정보 저장
		char buf[256];
		wsprintf(buf,"characterinfo.Inf");
		FILE *	fp;
		fp = fopen(buf,"r+b");
		if(fp)
		{
			fread(&sMsg, 1, sizeof(MSG_FC_CONNECT_LOGIN_OK),fp);
			fclose(fp);
		}						
		FieldSocketConnectLoginOk(&sMsg);
	}

	// 각 케릭터의 세부 사항
	{
		CHARACTER sCharcter;
		memset(&sCharcter, 0x00, sizeof(CHARACTER));

		if(m_pInterface && g_pSelect)
		{
			char buf[256];
			int nSelUnit = 0;

			for(nSelUnit = 0;nSelUnit < SELECT_MODE;nSelUnit++)
			{
				wsprintf(buf,"characterinfo[%d].Inf", nSelUnit);

				FILE *	fp;
				fp = fopen(buf,"r+b");
				if(fp)
				{
					fread(&sCharcter, 1, sizeof(CHARACTER),fp);
					fclose(fp);
					g_pSelect->SetUnitDetailInfo(sCharcter);
				}		
				
			}			
		}
	}	
	
	// FALSE :Lock  TRUE : UnLock
	EnterLock(TRUE);	// Lock 해제
	
	return TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SingPlayGameStartOk(MSG_FC_CHARACTER_GAMESTART_OK * pMsg)
{
	FieldSocketCharacterGameStartOk(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::InitItemList()
{
	m_pSinglePlayGame->InitItemList();	
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::AddItemList(MSG_FC_TRADE_INSERT_ITEM* pMsg)
{	
	if(!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	
	{
		return;
	}
	m_pSinglePlayGame->AddItemList(pMsg);
	

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SaveItemList()
{
	if(!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	
	{
		return;
	}
	m_pSinglePlayGame->SaveItemList();	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetUnitDetailInfo(CHARACTER* pCharac)
{	
	m_pSinglePlayGame->SetUnitDetailInfo(pCharac);
	
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SaveUnitDetailInfo()
{
	if(!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	
	{
		return;
	}
	m_pSinglePlayGame->SaveUnitDetailInfo();
	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetLoginOkInfo(MSG_FC_CONNECT_LOGIN_OK* pLoginInfo)
{	
	m_pSinglePlayGame->SetLoginOkInfo(pLoginInfo);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SaveLoginOkInfo()
{
	if(!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	
	{
		return;
	}
	m_pSinglePlayGame->SaveLoginOkInfo();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetGameStartOkInfo(MSG_FC_CHARACTER_GAMESTART_OK* pGamestartInfo)
{	
	m_pSinglePlayGame->SetGameStartOkInfo(pGamestartInfo);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 임시로 캐릭터 정보 얻어옴
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SaveGameStartOkInfo()
{
	if(!COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION))	
	{
		return;
	}
	m_pSinglePlayGame->SaveGameStartOkInfo();	
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		뺵업 받아놓은 정보를 저장한다.
/// \author		// 2008-08-11 by bhsohn 단독으로 실행 되게끔
/// \date		2008-08-11 ~ 2008-08-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SaveSinglePlayInfo()
{
	SaveItemList();
	SaveUnitDetailInfo();
	SaveLoginOkInfo();
	SaveGameStartOkInfo();
}


// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
#if defined( DEFINE_USE_GAMEGUARD_APEX )
inline long SendApexData( const char* pBuffer, int nLen )
{
	MSG_FC_MOVE_APEX_REQ_APEXDATA_OK packet;

	packet.cMsgType			= SECURITY_APEX_Cmd_ApexData;
	memcpy( packet.szApexData, pBuffer, nLen );
	packet.nApexDataLen		= nLen;

	return g_pFieldWinSocket->SendMsg( T_FC_MOVE_APEX_REQ_APEXDATA_OK, (char*)(&packet), sizeof(packet) );
}
#endif

void CAtumApplication::StartApexClient()
{
	#if defined( DEFINE_USE_GAMEGUARD_APEX )

	long ret = CHCStart( SendApexData, m_pApexfp_rec );

	MSG_FC_MOVE_APEX_REQ_APEXDATA_OK packet;
	packet.cMsgType			= SECURITY_APEX_Cmd_ClientRet;
	memcpy( packet.szApexData, &ret, sizeof(ret) );
	packet.nApexDataLen		= sizeof(ret);

	m_pFieldWinSocket->SendMsg( T_FC_MOVE_APEX_REQ_APEXDATA_OK, (char*)(&packet), sizeof(packet) );

	#endif
}
// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업

// 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템
void	CAtumApplication::ChangeMapObject( ObjectIdx_t nOrigObjIndex, ObjectNum_t nChangeObjIndex )
{
	// 해당 오브젝트를 찾고
	CObjectChild* pObject = g_pScene->FindMapObjectByIndex( nOrigObjIndex );
	
	// 해당 오브젝트를 찾았을 경우
	if( pObject )
	{
		// 원 오브젝트에서 새로 변경할 오브젝트로 정보를 복사한다
		OBJECTINFOCLIENT objInfo;
		OBJECTSCALEINFO		objscaleInfo;							// 2012-05-02 by isshin 맵툴 개선 오브젝트 스케일 정보
		memset( &objInfo, 0, sizeof( OBJECTINFOCLIENT ) );
		memset( &objscaleInfo, 0, sizeof( OBJECTSCALEINFO ) );		// 2012-05-02 by isshin 맵툴 개선 오브젝트 스케일 정보

		objInfo.nObjCount					= pObject->m_nObjectCont;
		objInfo.vPos						= pObject->m_vPos;
		objInfo.vUp				     			= pObject->m_vUp;
		objInfo.vVel						= pObject->m_vVel;
		objInfo.dwObjType					= nChangeObjIndex;
		objInfo.dwObjectMonsterUniqueNumber	= pObject->m_dwObjectMonsterUniqueNumber;
		objInfo.bObjectTexIndex				= pObject->m_bObjectTexIndex;
		objInfo.nObjectSrcIndex				= pObject->m_nNextEventIndex;
		objscaleInfo.vObjScale				= pObject->m_vScale;	// 2012-05-02 by isshin 맵툴 개선 오브젝트 스케일 정보		
		
		// 바디 컨디션 복사
		for( int i=0; i<64; ++i )
		{
			if( (pObject->m_BodyCondition >> i) == 1 )
			{
				objInfo.bBodyCondition = i;
				break;
			}
		}
		
		objInfo.bIsEvent					= pObject->m_bIsEvent;
		objInfo.bEventType					= pObject->m_bEventType;
		objInfo.sEventIndexFrom				= pObject->m_sEventIndexFrom;
		objInfo.sEventIndexTo				= pObject->m_sEventIndexTo;
		objInfo.sEventIndex3				= pObject->m_sEventIndex3;
		strcpy(objInfo.strEventParam, pObject->m_strEventParam);
		
		CObjectChild* pNode = new CObjectChild( objInfo, objscaleInfo);	 // 2012-05-02 by isshin 맵툴 개선 오브젝트 스케일 정보		
		if(g_pD3dApp->m_bShutDown)
		{
			SAFE_DELETE( pNode );
			return;
		}
		
		pNode->InitDeviceObjects();
		
		// 원 오브젝트 링크를 다 끊는다
		if( pObject->m_pPrev )
		{
			pObject->m_pPrev->m_pNext	= pNode;
			pNode->m_pPrev				= pObject->m_pPrev;
		}
		
		if( pObject->m_pNext )
		{
			pObject->m_pNext->m_pPrev	= pNode;
			pNode->m_pNext				= pObject->m_pNext;
		}
		
		// 트리 개념으로 생각하면 메모리가 뻑난다
		// Parent to Child 연결은 되있지만
		// Child To Parent 연결은 되어있지 않아서 이 루틴을 사용하지 않는다
		// 			if( pObject->m_pParent )
		// 			{
		// 				if( pObject->m_pParent->m_pChild == pObject )
		// 				{
		// 					pObject->m_pParent->m_pChild	= pNode;
		// 					pNode->m_pParent				= pObject->m_pParent;
		// 				}
		// 			}
		
 		if( pObject == g_pGround->m_pBigObject->m_pChild )
 		{
 			g_pGround->m_pBigObject->m_pChild = pNode;
 		}
		
		// 참조하는 부분도 삭제한다
		vectorCObjectChildPtr::iterator it = std::find( g_pScene->m_vectorRangeObjectPtrList.begin(), g_pScene->m_vectorRangeObjectPtrList.end(), pObject );
		if( it != g_pScene->m_vectorRangeObjectPtrList.end() )
			g_pScene->m_vectorRangeObjectPtrList.erase( it );
		
		it = std::find( g_pScene->m_vectorCulledObjectPtrList.begin(), g_pScene->m_vectorCulledObjectPtrList.end(), pObject );
		if( it != g_pScene->m_vectorCulledObjectPtrList.end() )
			g_pScene->m_vectorCulledObjectPtrList.erase( it );
		
		it = std::find( g_pScene->m_vectorCollisionObjectPtrList.begin(), g_pScene->m_vectorCollisionObjectPtrList.end(), pObject );
		if( it != g_pScene->m_vectorCollisionObjectPtrList.end() )
			g_pScene->m_vectorCollisionObjectPtrList.erase( it );
		
		// 실제 오브젝트 삭제
		pObject->m_pNext = NULL;
		SAFE_DELETE( pObject );
	}
}
// end 2009. 11. 02 by ckPark 인피니티 필드 인스턴스 던젼 시스템

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		1초 간격 아이템 이동 시스템 
/// \author		// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
/// \date		2008-08-18 ~ 2008-08-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::TickItemSell()
{
	if(m_bSendTerm == FALSE || 0 == m_dwSendTermTime)
	{
		return;
	}

	DWORD dwCurrentTime = timeGetTime();
	DWORD dwCap = dwCurrentTime - m_dwSendTermTime;	

	if(dwCap > INTERVAL_SYSTEM_MS)
	{
		if(TRUE == m_bStartMultiSell)
		{				
			UpdateMultiResponseOK();
		}
		else if(TRUE == m_bStartMultiStore)
		{
			FromStoreMultiOneItem();
		}
		m_bSendTerm = FALSE;
		m_dwSendTermTime = 0;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 간격을 주고 판매
/// \author		// 2008-08-18 by bhsohn 1초 간격 아이템 이동 시스템 
/// \date		2008-08-18 ~ 2008-08-18
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::IntervalSellMutltiOneItem()
{
	// 아이템 판매 시작 간격
	m_dwSendTermTime = timeGetTime();
	m_bSendTerm = TRUE;	
}



// 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)
void	CAtumApplication::TickInfinityStart( void )
{
	// 맵로딩대기중일때만 틱
	if( !m_bWaitInfinityMapLoad )
		return;

	// 맵로딩할 시간이면 시작
	if( timeGetTime() > m_nInfinityMapLoadTime )
	{
		FieldSocketArenaPossibleGameStart( &m_ArenaStartPacket );
		m_bWaitInfinityMapLoad	= FALSE;
	}
}
// end 2010. 03. 03 by ckPark 인피니티 필드 2차(입장 UI변경)


// 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)
void	CAtumApplication::TickInfintyMapLoadedSend( void )
{
	if( m_bInfinityMapLoadedSendEnable && m_bInfinitySkillSetupOKDone )
	{
		if( m_bInfinityRestart )
			m_pFieldWinSocket->SendMsg( T_FC_INFINITY_MAP_LOADED_RESTART_BY_DISCONNECT, NULL, 0 );
		else
			m_pFieldWinSocket->SendMsg( T_FC_INFINITY_MAP_LOADED, NULL, 0 );

		m_bInfinityMapLoadedSendEnable	= FALSE;
		m_bInfinitySkillSetupOKDone		= FALSE;
	}
}
// end 2010. 03. 23 by ckPark 인피니티 필드 2차(인피니티 필드 입장 캐쉬아이템)




///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		세력마크 전 시작
/// \author		// 2008-08-19 by bhsohn 세력 마크 시스템 추가
/// \date		2008-08-19 ~ 2008-08-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventInfluenceMark(MSG_FC_EVENT_INFLUENCEMARK* pMsg)
{
	if(g_pStoreData)
	{
		g_pStoreData->ChangeInfluenceMark(pMsg->Influence);
		// 모선이 떠져있으면 마크 시스템 바로 적용
		g_pStoreData->SetInfluenceMarkInfo(TRUE);
		g_pStoreData->UpdateInfluenceMark();	// 본인 기체
		g_pStoreData->UpdateEnemyInfluenceMark();  // 적기체
	}
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		세력마크 전 종료 
/// \author		// 2008-08-19 by bhsohn 세력 마크 시스템 추가
/// \date		2008-08-19 ~ 2008-08-19
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketEventInfluenceMarkEnd()
{
	if(g_pStoreData)
	{
		g_pStoreData->SetInfluenceMarkInfo(FALSE);
		g_pStoreData->RestoreInfluenceMark();
		g_pStoreData->UpdateEnemyInfluenceMark(); // 적기체
	}

}



///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		게임 실행파일명 체크섬 추가
/// \author		// 2008-09-17 by bhsohn 게임 실행파일명 체크섬 추가
/// \date		2008-09-17 ~ 2008-09-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendAtmCheckSum()
{	
	char drive[_MAX_DRIVE];
	char dir[_MAX_DIR];
	char fname[_MAX_FNAME];
	char ext[_MAX_EXT];
	char path_buffer[_MAX_PATH] = {0,};
	char chMapIdx[64] = {0,};	

	GetModuleFileName(NULL, path_buffer, MAX_PATH);
	_splitpath(path_buffer, drive, dir, fname, ext);	

	sprintf(chMapIdx, "%s%s", fname, ext);

	int nFileSize = 0;

	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 	UINT uiCheckSum = 0;
// 	if(FALSE == g_pShuttleChild->GetCheckSum(&uiCheckSum, &nFileSize, path_buffer))
#ifdef CHECK_SUM_ON
	
	BYTE checkSum[32];
	if(FALSE == g_pShuttleChild->GetCheckSum(checkSum, &nFileSize, path_buffer))
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템

	{
#ifdef C_CLIENT_FILE_LOG
		g_cCustomOptimizer.WriteLog("[WM_CLOSE][CheckSum error] AtumApplication.cpp"); // 2013-05-23 by bhsohn 클라이언트 파일로그(LOG) 시스템 추가
#endif
		DBGOUT("[WM_CLOSE][CheckSum error] AtumApplication.cpp, g_pShuttleChild->GetCheckSum(%s) ", path_buffer );
		SendMessage( g_pD3dApp->GetHwnd(), WM_CLOSE, 0, 0 );
		return;
	}	

	INIT_MSG_WITH_BUFFER(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM, T_FC_INFO_CHECK_RESOBJ_CHECKSUM, pSMsg, SendBuf);
	
	pSMsg->nItemNum0	= 0;
	strncpy(pSMsg->szObjFileName, chMapIdx, SIZE_MAX_RESOBJ_FILE_NAME);

	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
	memcpy(pSMsg->byDigest, checkSum, sizeof(checkSum));
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템

	pSMsg->nFileSize0 = nFileSize;	

	m_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM));	
#endif

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		퀘스트 파일 체크섬 
/// \author		// 2008-11-11 by bhsohn 퀘스트 CheckSum추가
/// \date		2008-11-11 ~ 2008-11-11
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendQuestCheckSum()
{
	char chMapIdx[64];	
	int nFileSize = 0;
	
	memset(chMapIdx, 0x00, 64);

	
	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
// 	UINT uiCheckSum = 0;
// 	m_pQuestData->GetQuestCheckSum(&uiCheckSum, &nFileSize, chMapIdx);

	BYTE checkSum[32];
	m_pQuestData->GetQuestCheckSum(checkSum, &nFileSize, chMapIdx);
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템
	

#ifdef CHECK_SUM_ON
	INIT_MSG_WITH_BUFFER(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM, T_FC_INFO_CHECK_RESOBJ_CHECKSUM, pSMsg, SendBuf);
	
	pSMsg->nItemNum0	= 0;
	strncpy(pSMsg->szObjFileName, chMapIdx, SIZE_MAX_RESOBJ_FILE_NAME);
	
	// 2009. 05. 29 by ckPark SHA256 체크섬 시스템
	//pSMsg->uiCheckSum0 = uiCheckSum;
	memcpy(pSMsg->byDigest, checkSum, sizeof(checkSum));
	// end 2009. 05. 29 by ckPark SHA256 체크섬 시스템
	
	pSMsg->nFileSize0 = nFileSize;	
	
	m_pFieldWinSocket->Write(SendBuf, MSG_SIZE(MSG_FC_INFO_CHECK_RESOBJ_CHECKSUM));		


#endif	
	
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::TickJoyStickInfo()
{
	if(!IsUseJoyStick() )
	{
		if(g_pGameMain && g_pGameMain->IsShowOpJoystick())
		{

		}
		else
		{
			return;
		}		
	}
	// 컨트롤 패드
	if(m_pJoyStick)
	{
		m_fJoyStickCheckTime += GetCheckElapsedTime();
		
		// Set a timer to go off 30 times a second. At every timer message
		// the input device will be read
		if(m_fJoyStickCheckTime >= JOYSTICK_CHECK_TIME)
		{
			m_fJoyStickCheckTime = 0.0f;
			m_pJoyStick->UpdateInputState();
		}
		else
		{
			m_pJoyStick->InitChangeDIJ();
		}
	}
	// 진동 패드
	if(m_pJoyStickFreedback && m_pJoyStickFreedback->IsEffectStarted())
	{
		m_fJoyStickFeedbackPlayTime -= GetCheckElapsedTime();
		if(m_fJoyStickFeedbackPlayTime < 0)
		{			
			SetJoyStickFeedback(FALSE, FALSE);
			m_fJoyStickFeedbackPlayTime =0.0f;
		}
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CJoyStickInput *CAtumApplication::GetJoystickControl()
{
	return m_pJoyStick;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::GetAsyncKeyState_DIK_DIJ(int code)
{
	if((TRUE == m_pKeyBoard->GetKeyBoardLostDevice())
		||(FALSE == m_pKeyBoard->GetKeyBoardFocus()) // 포커스 없을시, 키보드 처리 안되게 함
		|| (g_pGameMain && TRUE == g_pGameMain->GetChatModeState()))	// 2013-11-14 by ssjung 비행 중 채팅 할시 조작키가 작동하는 문제 수정
	{
		return FALSE;
	}
	BOOL bKeyDown = m_pKeyBoard->GetAsyncKeyState(code);
	
	if(!IsUseJoyStick())
	{
		// 조이스틱 안쓴다.
		return bKeyDown;
	}
	if(!bKeyDown && m_pJoyStick && g_pInterface)
	{		
		bKeyDown = g_pInterface->GetJostickStats(code);		
	}
	return bKeyDown;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CJoyStickFreedback *CAtumApplication::GetJoyStickFeedback()
{	
	return m_pJoyStickFreedback;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetJoyStickFeedback(BOOL bSetFeedBack, int nPowerIndex)
{
	if(bSetFeedBack)
	{
		if(!IsUseJoyStick() || !IsUseJoyFeedBack())
		{
			return;
		}
	}
	CJoyStickFreedback *pJoyStickFreedback = GetJoyStickFeedback();
	if(NULL == pJoyStickFreedback)
	{
		return;
	}	
	BOOL bEffectStarted = pJoyStickFreedback->IsEffectStarted();
	if(bSetFeedBack)
	{
		float fJoyStickFeedbackPlayTime = JOYSTICK_FEED_TIME;
		int nForceX = 100;
		int nForceY = 100;			

		switch(nPowerIndex)
		{
		case JOY_FEED_COLLISION_DAMAGE:
			{
				nForceX = -DI_FFNOMINALMAX;
				nForceY = -DI_FFNOMINALMAX;				
				fJoyStickFeedbackPlayTime = 2.5f;
			}
			break;
		case JOY_FEED_WEAPON1_DAMAGE:
			{				
				nForceX = +DI_FFNOMINALMAX-(+DI_FFNOMINALMAX/5);
				nForceY = +DI_FFNOMINALMAX-(+DI_FFNOMINALMAX/5);
				fJoyStickFeedbackPlayTime = 1.5f;
			}
			break;
		case JOY_FEED_WEAPON2_DAMAGE:
			{
				nForceX = +DI_FFNOMINALMAX-(+DI_FFNOMINALMAX/10);
				nForceY = +DI_FFNOMINALMAX-(+DI_FFNOMINALMAX/10);				
				fJoyStickFeedbackPlayTime = 1.5f;
			}
			break;
		case JOY_FEED_SHUTTLE_EXPLODED:
			{
				nForceX = +DI_FFNOMINALMAX;
				nForceY = +DI_FFNOMINALMAX;
				fJoyStickFeedbackPlayTime = 3.0f;
			}
			break;
		}

		BOOL bStartDeviceForce = FALSE;// 새로운 진동 시작유무

		if(bEffectStarted)
		{
			if(m_nJoyStickFeedbackType < nPowerIndex)
			{
				// 새로운게 더 쎄다
				m_fJoyStickFeedbackPlayTime = fJoyStickFeedbackPlayTime;
				bStartDeviceForce = TRUE;
				pJoyStickFreedback->StopDeviceForce();	// 일단 장치 스톱
			}
			else if(nPowerIndex == m_nJoyStickFeedbackType)
			{
				// 같은 계열이면 시간만 갱신
				m_fJoyStickFeedbackPlayTime = fJoyStickFeedbackPlayTime;
			}
		}
		else
		{
			// 진동이 꺼진 상태면 무조건 시작
			m_fJoyStickFeedbackPlayTime = fJoyStickFeedbackPlayTime;	// 진동 플레이 시간
			bStartDeviceForce = TRUE;			
		}
		m_nJoyStickFeedbackType = nPowerIndex;		

		if(bStartDeviceForce)
		{
			pJoyStickFreedback->SetDeviceForcesXY(nForceX, nForceY);
		}
	}
	else if(bEffectStarted)
	{
		pJoyStickFreedback->StopDeviceForce();
		m_fJoyStickFeedbackPlayTime =0.0f;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 조이스틱 사용유무
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsUseJoyStick()
{
	if(NULL == g_pJoysticOp)
	{
		return FALSE;
	}
	return g_pJoysticOp->bUseJoystick;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 조이스틱 사용유무
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::IsUseJoyFeedBack()
{
	if(NULL == g_pJoysticOp)
	{
		return FALSE;
	}
	return g_pJoysticOp->bUseFeedJoyStick;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 조이스틱 사용유무
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetUseJoyStick(BOOL bUse)
{
	if(NULL == g_pJoysticOp)
	{
		return;
	}
	g_pJoysticOp->bUseJoystick = bUse;		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		// 조이스틱 사용유무
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SetUseJoyFeedBack(BOOL bUse)
{
	if(NULL == g_pJoysticOp)
	{
		return;
	}
	g_pJoysticOp->bUseFeedJoyStick = bUse;
	CJoyStickFreedback *pJoyStickFreedback = GetJoyStickFeedback();
	if(pJoyStickFreedback && bUse)
	{
		// 진동 장비
		pJoyStickFreedback->RqEffectStarted(TRUE);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-21 by bhsohn 거래 완료 시스템 처리
/// \date		2008-11-21 ~ 2008-11-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketTradeOkTradeNotify(MSG_FC_TRADE_OK_TRADE_NOTIFY* pMsg)
{
	if(NULL == g_pGameMain 
		|| NULL == g_pGameMain->m_pTrade)
	{
		return;
	}
	
	g_pGameMain->m_pTrade->SetTradeOkTradeNotify(pMsg->CharacterUniqueNumber);
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2010-08-31 by shcho&&jskim, 용해 시스템 구현
/// \date		2008-08-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketDissolDissolutionPutItem(MSG_FC_DISSOLVED_SUCCESS_AND_FAILED* pMsg)
{
	CINFDissolution * pDissolution = (CINFDissolution*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_DISSOLUTION);
				
	if(!pMsg->Dissolved_success)
	{
		g_pD3dApp->m_pChat->CreateChatChild(STRMSG_C_100421_0401,COLOR_ERROR);//"\\y올려 놓을 수 없습니다.\\y"
		pDissolution->ResetInfo();
		return;
	}	
	if(pMsg->Item_Success == TRUE)
	{
		pDissolution->SetBoom(FALSE);
	}
	else
	{
		pDissolution->SetBoom(TRUE);
	}
	pDissolution->SetState( DIS_ING );
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-17 by jhahn	인피3차 몬스터 교체
/// \date		2011-05-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldMonsterChangeOK(MSG_FC_MONSTER_CHANGE_INDEX* pMsg)
{
	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIndex);
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{ 
	
     	itMonster->second->ChangeMonster(pMsg->ChangeMonsterUnitKind);	
	}	
}	
//2011-10-06 by jhahn 파트너 성장형 시스템	
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-17 by jhahn	
/// \date		2011-08-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldPetNameChangeOK(MSG_FC_ITEM_PET_SET_NAME_OK* pMsg )
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );

	int temp,temp2;
	CheckReadyStringFiltering(pMsg->PetName,&temp,&temp2);

	strcpy(tempCurrentInfo->PetName ,pMsg->PetName);

	g_pShuttleChild->GetPetManager()->InsertPetCurrentData( tempCurrentInfo );

}

void	CAtumApplication::FieldPetExpRationOK(MSG_FC_ITEM_PET_SET_EXP_RATIO_OK* pMsg)
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );

	tempCurrentInfo->PetExpRatio = pMsg->ExpRatio;

	g_pShuttleChild->GetPetManager()->InsertPetCurrentData( tempCurrentInfo );

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-17 by jhahn	펫 이름 변경
/// \date		2011-08-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldPetLevelChangeOK(MSG_FC_ITEM_PET_CHANGE_LEVEL* pMsg)
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );
	tempCurrentInfo->PetLevel = pMsg->Level;
	
	g_pShuttleChild->GetPetManager()->InsertPetCurrentData( tempCurrentInfo );

	CAppEffectData * pData = NULL;
	D3DXVECTOR3 vPos = D3DXVECTOR3(0,1,0);
	if(m_pEffectList)
	{
		CAtumNode * pEffectParent;
		if(g_pD3dApp->m_bCharacter)
			pEffectParent = m_pCharacterChild;
		else
			pEffectParent = m_pShuttleChild;
		
		pData = new CAppEffectData(pEffectParent,RC_EFF_PET_LEVEL_CHANGE,vPos);
		if(pData)
		{
			pData = (CAppEffectData *)m_pEffectList->AddChild(pData);
		}
	}

	if( g_pStoreData->FindItemInInventoryByWindowPos( POS_PET ) )
	{
		g_pInterface->m_pINFOpMain->GetOpInfo()->SetOperatorAction(1,5);
	}
}
void	CAtumApplication::FieldPetExpChangeOK(MSG_FC_ITEM_PET_CHANGE_EXP* pMsg)
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );

	char buf[128];

	Experience_t PetExp;	
	PetExp =  pMsg->Experience - tempCurrentInfo->PetExp;
	tempCurrentInfo->PetExp = pMsg->Experience ;
	
	sprintf(buf, STRMSG_C_120109_0001,PetExp);
	m_pChat->CreateChatChild(buf, COLOR_SKILL_USE,CHAT_TAB_SYSTEM);
	
	
	g_pShuttleChild->GetPetManager()->InsertPetCurrentData( tempCurrentInfo );

}
void	CAtumApplication::FieldPetSetSocket(MSG_FC_ITEM_PET_SET_SOCKET_OK* pMsg)
{

	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );	
	CItemInfo *temp = g_pShuttleChild->m_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->PetSocketItemUID);
	tempCurrentInfo->pItemPetSocket[pMsg->SocketIndex] = temp->GetItemInfo();
	tempCurrentInfo->PetSocketItemUID[pMsg->SocketIndex] = pMsg->PetSocketItemUID;	

	CMapItemWindowInventoryIterator it = g_pStoreData->m_mapItemWindowPosition.begin();
	while(it != g_pStoreData->m_mapItemWindowPosition.end())
	{
		CItemInfo* pItemInfo = it->second;
		if(pItemInfo->UniqueNumber == pMsg->PetSocketItemUID)
		{
			pItemInfo->GetItemInfo()->Position = POS_HIDDEN_ITEM;
			pItemInfo->ItemWindowIndex = POS_HIDDEN_ITEM;
		}	
		it++;
	}
	g_pGameMain->m_pInven->SetAllIconInfo();	
	
						
 	
}
void	CAtumApplication::FieldPetSetKitSlot(MSG_FC_ITEM_PET_SET_KIT_SLOT_OK* pMsg)
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );	
	tempCurrentInfo->PetKitHP.ItemNum = pMsg->PetKitHP.ItemNum;
	tempCurrentInfo->PetKitHP.TriggerValue = pMsg->PetKitHP.TriggerValue;

	tempCurrentInfo->PetKitShield.ItemNum = pMsg->PetKitShield.ItemNum;
	tempCurrentInfo->PetKitShield.TriggerValue = pMsg->PetKitShield.TriggerValue;

	tempCurrentInfo->PetKitSP.ItemNum = pMsg->PetKitSP.ItemNum;
	tempCurrentInfo->PetKitSP.TriggerValue = pMsg->PetKitSP.TriggerValue;


}

void	CAtumApplication::FieldPetSetAutoSkillSlot(MSG_FC_ITEM_PET_SET_AUTOSKILL_SLOT_OK* pMsg)
{
	tPET_CURRENTINFO * tempCurrentInfo = g_pShuttleChild->GetPetManager()->GetPtr_PetCurrentData( pMsg->ItemUniqueNumber );	

	memcpy(&tempCurrentInfo->PetAutoSkill,&pMsg->PetAutoSkill,sizeof(SPET_AUTOSKILL_SLOT_DATA));	
}
//end 2011-10-06 by jhahn 파트너 성장형 시스템
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-30 by jhahn	인피3차 몬스터 삭제
/// \date		2011-05-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldMonsterDeleteOK(MSG_FC_MONSTER_CINEMA_DELETE_NOTIFY* pMsg)
{

	CMapMonsterIterator itMonster = m_pScene->m_mapMonsterList.find(pMsg->MonsterIdx);		
	if(itMonster != m_pScene->m_mapMonsterList.end())
	{ 
   		itMonster->second->DeleteMonster();
	}	

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-30 by jhahn	인피3차 시간 셋팅
/// \date		2011-05-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldSocketInfinityResetTime( MSG_FC_INFINITY_SET_LIMITTIME* pMsg )
{

	if( m_pInterface && m_pInterface->m_pInfinity )
		m_pInterface->m_pInfinity->SetInfinityLimitTimeReset( pMsg->LimitTime );
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2011-05-31 by jhahn	인피3차시네마 변경
/// \date		2011-05-31
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void	CAtumApplication::FieldInfinityCinemaOK(MSG_FC_INFINITY_MOVIE* pMsg)
{
	if(pMsg->Command == 1)
	{
		// 2011-07-12 by jhahn  인피3차 시네마 타캐릭터 안보이기
		CAppEffectData* pEffect = g_pScene->FindEffect( RC_EFF_BOOSTER );
		if(pEffect)
		{
			pEffect->ChangeBodyCondition(BODYCON_LANDED_MASK);
			}
			
		g_pShuttleChild->Infinity3Cinema(pMsg->UniqueNumber);		

		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.begin();	
		while(itEnemy != m_pScene->m_mapEnemyList.end())
		{ 
		
			itEnemy->second->m_bRender = FALSE;		
			itEnemy->second->SetHideData();
			
			
			itEnemy++;
		}		
		//end 2011-07-12 by jhahn  인피3차 시네마 타캐릭터 안보이기
	}

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		게임가드 시작
/// \author		// 2008-11-28 by bhsohn XignCode추가
/// \date		2008-11-28 ~ 2008-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::StartGameGuard()
{
	int nGameGuard = GAMEGUARD_TYPE;
//	DbgOut("nGameGuard [%d] \n", nGameGuard);
	
	switch(nGameGuard)
	{
	case USE_GAMEGUARD_AHNLAB_HACKSHIELD:
		{
			//핵쉴드 게임가드
			if(!HS_Start())
			{			
				return FALSE;
			}

		}
		break;
	case USE_GAMEGUARD_XIGNCODE:	
		{
			// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
		#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)	
// 2012-10-13 by jhahn 핵쉴드->Xigncode변경

			if (!ZCWAVE_SysInit())
			{
				ULONG ErrorCode = GetLastError();
				return FALSE;
			}

			
			TCHAR	szFullFilePath[MAX_PATH] = {0,};
			char path_buffer[_MAX_PATH] = {0,};
#ifdef _DEBUG
			// 2011-12-15 by jhjang XignCode 디버그 모드 추가
			GetCurrentDirectory(MAX_PATH, path_buffer);
			wsprintf(szFullFilePath, "%s\\%s", path_buffer, GAME_GUARD_FOLDER_DEBUG);
			// end 2011-12-15 by jhjang XignCode 디버그 모드 추가
#else
		
			GetCurrentDirectory(MAX_PATH, path_buffer);
			wsprintf(szFullFilePath, "%s\\%s", path_buffer, GAME_GUARD_FOLDER);
#endif
			char chLicense[256];
			sprintf(chLicense, GAME_GUARD_LICENSE);
					
			if (!ZCWAVE_SysEnter(chLicense,szFullFilePath,ZSOPT_SHOWSPLASH | ZSOPT_USESYSGUARD | ZSOPT_SHOWTRAY ))
			{
				ULONG ErrorCode = GetLastError();			
				return FALSE;
			}
			// end 2009-05-12 by bhsohn XignCode 실시간 종료 기능 추가
			// end 2009-01-20 by bhsohn Xign코드 추가 요청

 			if(!ZCWAVE_SendCommand(ZCMD_SET_USER_INFO_CALLBACKA,MyUserInfoCallback,NULL))
 			{
 				ULONG ErrorCode = GetLastError();
 				return FALSE; 
 			}
			// 2012-10-17 by bhsohn XignCode작업
			if(!ZCWAVE_RegisterCallback(AceOnlineXigncodeCallback,NULL))
			{
				DbgOut("[Xign Client] ZCWAVE_RegisterCallback GetLastError[%08x] \n", GetLastError());
				return FALSE;
			}
			// 2012-10-17 by bhsohn XignCode작업

//end 2012-10-13 by jhahn 핵쉴드->Xigncode변경
			//Xign 게임가드
			if(!ZCWAVE_Init())
			{
				DBGOUT("CAtumApplication::StartGameGuard [FALSE] \n");
				return FALSE;
			}
			DBGOUT("CAtumApplication::StartGameGuard [TRUE] \n");
			
		#endif
			// end 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
		}
		break;
		// 2009-01-28 by bhsohn nProtector 게임 가드 추가	
	case USE_GAMEGUARD_NPROTECTOR:
		{
		#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)
			if(!InitGameGuardNProtector())
			{
				return FALSE;
			}			
		#endif
		}
		break;
	// end 2009-01-28 by bhsohn nProtector 게임 가드 추가


		// 2009. 06. 17 by ckPark Frost System
	case USE_GAMEGUARD_FROST:
		{
			#if defined( DEFINE_USE_GAMEGUARD_FROST )
			 frostInitialize( ".\\Frost\\gameShieldDll.dll" );
			 frostSetUserName( m_strUserID );
			#endif
		}
		break;
		// end 2009. 06. 17 by ckPark Frost System
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남) 
	case USE_GAMEGUARD_XTRAP:
		{
			#if defined( DEFINE_USE_GAMEGUARD_XTRAP )

				char szXtrapArg[] = XTRAP_LICENCE_CODE;
				XTrap_C_Start((LPCSTR)szXtrapArg, NULL);
			#endif
		}
		break;
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남) 

	// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
	case USE_GAMEGUARD_APEX:
		{
			#if defined( DEFINE_USE_GAMEGUARD_APEX )

			#endif
		}
		break;
	// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
	// 2011. 1. 18 by jskim 배트남 VTC가드
	case USE_GAMEGUARD_VTC:
		{
			// 2011. 1. 18 by jskim 배트남 VTC가드
			m_hGuardLibrary = LoadLibrary("./vtguard.pl");
			if (m_hGuardLibrary == NULL)
			{
				MessageBox(NULL,"vtguard.pl Load Error","Error",MB_OK);
				return FALSE;
			}	
			m_fnVTCDLLInit		= (func1)GetProcAddress(m_hGuardLibrary,"func1");
			m_fnVTCDLLGetStatus	= (func2)GetProcAddress(m_hGuardLibrary,"func2");
			m_fnVTCDLLSetUser	= (func3)GetProcAddress(m_hGuardLibrary,"func3");
			m_fnVTCDLLExit		= (func4)GetProcAddress(m_hGuardLibrary,"func4");
			if(!m_fnVTCDLLInit || !m_fnVTCDLLGetStatus || !m_fnVTCDLLSetUser || !m_fnVTCDLLExit)
			{
				MessageBox(NULL,"VTC func Error","Error",MB_OK);
				return FALSE;
			}
			m_fnVTCDLLInit();
			m_pVTCGuard = new CVTCThread;
			m_pVTCGuard->CreateThread();
		}
		break;
	// end 2011. 1. 18 by jskim 배트남 VTC가드
		// 2013-10-11 by bhsohn XTrap&VTC 연동 작업
	case USE_GAMEGUARD_XTRAP_N_VTC:		//XTrap+VTC가드
		{
			// VTC가드 초기화
			{
				m_hGuardLibrary = LoadLibrary("./vtguard.pl");
				if (m_hGuardLibrary == NULL)
				{
					MessageBox(NULL,"vtguard.pl Load Error","Error",MB_OK);
					return FALSE;
				}	
				m_fnVTCDLLInit		= (func1)GetProcAddress(m_hGuardLibrary,"func1");
				m_fnVTCDLLGetStatus	= (func2)GetProcAddress(m_hGuardLibrary,"func2");
				m_fnVTCDLLSetUser	= (func3)GetProcAddress(m_hGuardLibrary,"func3");
				m_fnVTCDLLExit		= (func4)GetProcAddress(m_hGuardLibrary,"func4");
				if(!m_fnVTCDLLInit || !m_fnVTCDLLGetStatus || !m_fnVTCDLLSetUser || !m_fnVTCDLLExit)
				{
					MessageBox(NULL,"VTC func Error","Error",MB_OK);
					return FALSE;
				}
				m_fnVTCDLLInit();
				m_pVTCGuard = new CVTCThread;
				m_pVTCGuard->CreateThread();

				DbgOut("VTC Init \n");
			}
			// XTrap초기화
			{
			#if defined( DEFINE_USE_GAMEGUARD_XTRAP )&& defined(SC_XTRAP_VTC_GAMEGUARD_BHSOHN_JHSEOL) 
				// 2014-01-06 by bhsohn Xtrap 테스트서버 키 다르게 처리
				if(!m_bArgcTestServer)
				{
					char szXtrapArg[] = XTRAP_KEY_STRING_LIVE;					
					XTrap_C_Start((LPCSTR)szXtrapArg, NULL);					
				}
				else
				{
					char szXtrapArg[] = XTRAP_KEY_STRING_TEST;
					XTrap_C_Start((LPCSTR)szXtrapArg, NULL);					
				}	
				DbgOut("XTrap_Start m_bArgcTestServer[%d] \n", m_bArgcTestServer);
				
			#endif
			}

		}
		break;
		// END 2013-10-11 by bhsohn XTrap&VTC 연동 작업
	case USE_GAMEGUARD_NONE:
		{

		}
		break;
	}
	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		게임가드 종료
/// \author		// 2008-11-28 by bhsohn XignCode추가
/// \date		2008-11-28 ~ 2008-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::CloseGameGuard()
{
	int nGameGuard = GAMEGUARD_TYPE;
	switch(nGameGuard)
	{
	case USE_GAMEGUARD_AHNLAB_HACKSHIELD:
		{
			//핵쉴드 게임가드
			HS_Close();	
		}
		break;
	case USE_GAMEGUARD_XIGNCODE:	
		{		
			// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
		#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)		
			// 2009-01-20 by bhsohn Xign코드 추가 요청
			//Xign 게임가드
// 			if(!ZCWAVE_Cleanup())
// 			{
// 				DBGOUT("CAtumApplication::CloseGameGuard [FALSE] \n");
// 				return FALSE;			
// 			}						
			//ZCWAVE_Cleanup();
			//ZCWAVE_SysExit();
			ZCWAVE_SysExit();
			ZCWAVE_SysCleanup();
			// end 2009-01-20 by bhsohn Xign코드 추가 요청

			DBGOUT("CAtumApplication::CloseGameGuard [TRUE] \n");
		#endif
			// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
		}
		break;
		// 2009-01-28 by bhsohn nProtector 게임 가드 추가	
	case USE_GAMEGUARD_NPROTECTOR:
		{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)
			SAFE_DELETE(m_pNpgl);
#endif
		}
		break;
	// end 2009-01-28 by bhsohn nProtector 게임 가드 추가
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
	case USE_GAMEGUARD_XTRAP:
		{
			#if defined( DEFINE_USE_GAMEGUARD_XTRAP )
			#endif
		}
		break;
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
	
	// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
	case USE_GAMEGUARD_APEX:
		{
			#if defined( DEFINE_USE_GAMEGUARD_APEX )
			CHCEnd();
			#endif
		}
		break;
	// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업


	// 2010. 01. 13 by ckPark Frost게임가드 2009.11.10일자 업데이트
	case USE_GAMEGUARD_FROST:
		{
			#if defined( DEFINE_USE_GAMEGUARD_FROST )
			frostFinalize();
			#endif
		}
		break;
	// end 2010. 01. 13 by ckPark Frost게임가드 2009.11.10일자 업데이트
		// 2011. 1. 18 by jskim 배트남 VTC가드
	case USE_GAMEGUARD_VTC:
		{
			m_fnVTCDLLExit();
		}
		break;
	// end 2011. 1. 18 by jskim 배트남 VTC가드
	// 2013-10-11 by bhsohn XTrap&VTC 연동 작업
	case USE_GAMEGUARD_XTRAP_N_VTC:		//XTrap+VTC가드
		{
			#if defined( DEFINE_USE_GAMEGUARD_XTRAP )
			#endif
			m_fnVTCDLLExit();
		}
		break;
	// END 2013-10-11 by bhsohn XTrap&VTC 연동 작업
	case USE_GAMEGUARD_NONE:
		{

		}
		break;
	}
	return TRUE;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		처음 초기화 함수
/// \author		// 2008-11-28 by bhsohn XignCode추가
/// \date		2008-11-28 ~ 2008-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveXignCodeReqScanInit(UINT nSocketNotifyType, MSG_FC_MOVE_XIGNCODE_REQ_SCAN_INIT* pMsg)
{
	if(WM_PACKET_ARENA_NOTIFY == nSocketNotifyType)		
	{
		// 아레나 소켓이면 무시
		return;
	}
	// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)		
	MSG_FC_MOVE_XIGNCODE_REQ_SCAN_INIT_OK sRtnMsg;
	memset(&sRtnMsg, 0x00, sizeof(MSG_FC_MOVE_XIGNCODE_REQ_SCAN_INIT_OK));
	
	BOOL bProbe = ZCWAVE_Probe((CPACKETDATA)pMsg->byCheckData, (PACKETDATA)sRtnMsg.byResultData, MAX_PACKET_SIZE_FOR_XIGNCODE);
	// 서버로 부터 전송받은 데이터를 입력합니다. 
	if(bProbe) 
	{ 
		// szReturn에 저장된 실행 결과 데이터를 
		// 서버로 전송합니다. 		
		m_pFieldWinSocket->SendMsg(T_FC_MOVE_XIGNCODE_REQ_SCAN_INIT_OK, (char*)&sRtnMsg, sizeof(sRtnMsg)); 	
		
		// 다시 연결
		// 서버로부터 전달받은 일회용 실행 코드
		// 케릭터에 대한 첫번쨰로 ZCWAVE_Probe가 TRUE를 리턴시,
		// T_FC_CHARACTER_GAMESTART 를 보내 첫번쨰 ZCWAVE_Probe함수 TRUE임을 알려주어야한다.
		{
			MSG_FC_CHARACTER_GAMESTART sGameStartMsg;
			memset(&sGameStartMsg,0x00,sizeof(sGameStartMsg));
			char buffer[SIZE_MAX_PACKET];
			sGameStartMsg.ClientIndex = m_pShuttleChild->m_myShuttleInfo.ClientIndex;
			sGameStartMsg.CharacterUniqueNumber = m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber;
			int nType = T_FC_CHARACTER_GAMESTART;
			memcpy(buffer, &nType, SIZE_FIELD_TYPE_HEADER);
			memcpy(buffer+SIZE_FIELD_TYPE_HEADER, &sGameStartMsg, sizeof(sGameStartMsg));
			g_pD3dApp->m_pFieldWinSocket->Write(buffer, SIZE_FIELD_TYPE_HEADER + sizeof(sGameStartMsg));
			DBGOUT("MoveHackShield_GuidReqMsg : Ready, Send GameStart(T_FC_CHARACTER_GAMESTART, m_bMapLoad = TRUE; m_bLoginChat = IM_SERVER_STATE_READY_FOR_GAMESTART);\n");	
		}
	}	

	DBGOUT("CAtumApplication::FieldSocketMoveXignCodeReqScanInit [%d] \n", bProbe);
#endif // 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-28 by bhsohn XignCode추가
/// \date		2008-11-28 ~ 2008-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketMoveXignCodeReqScanCheck(UINT nSocketNotifyType, MSG_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK* pMsg)
{
	
	if(WM_PACKET_ARENA_NOTIFY == nSocketNotifyType)
	{
		// 아레나 소켓이면 무시
		return;
	}
	// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)			
	MSG_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK_OK sRtnMsg;
	memset(&sRtnMsg, 0x00, sizeof(MSG_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK_OK));
	
	BOOL bProbe = ZCWAVE_Probe((CPACKETDATA)pMsg->byCheckData, (PACKETDATA)sRtnMsg.byResultData, MAX_PACKET_SIZE_FOR_XIGNCODE);
	// 서버로 부터 전송받은 데이터를 입력합니다. 
	if(bProbe) 
	{ 
		// szReturn에 저장된 실행 결과 데이터를 
		// 서버로 전송합니다. 		
		m_pFieldWinSocket->SendMsg(T_FC_MOVE_XIGNCODE_REQ_SCAN_CHECK_OK, (char*)&sRtnMsg, sizeof(sRtnMsg)); 		
				
	}	
	DBGOUT("CAtumApplication::FieldSocketMoveXignCodeReqScanCheck [%d] \n", bProbe);
#endif// 2009-01-22 by bhsohn Xign Code 사용하는 나라만 모듈 추가
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::InitJoyStickOptionInfo(structJoyStickOptionInfo* pJoysticOp)
{
	memset(pJoysticOp, 0x00, sizeof(structJoyStickOptionInfo));

	pJoysticOp->bUseJoystick = TRUE;		// 조이스틱 사용 여부
	pJoysticOp->bUseFeedJoyStick = TRUE;	// 진동 사용 여부
	// 2008-12-23 by bhsohn 조이스틱 추가 요청 처리
	pJoysticOp->nJoysticSense	= MAX_JOYSTICK_DEFAULTSENSITY;		// 기본감도

	wsprintf(pJoysticOp->chJoyKeyFile, "joystick.joy");

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		조이스틱 장치 초기화
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::InitJoyStickDevice(BOOL bJoyControl, BOOL bJoyFeed, char* o_pDevice)
{
	int nJoyContorlLen = 0;
	if(NULL == g_pJoysticOp)
	{
		return nJoyContorlLen;
	}
	
	if(bJoyControl)
	{
		SAFE_DELETE(m_pJoyStick);
		if(NULL == m_pJoyStick)
		{
			// 조이스틱 클릭
			m_pJoyStick = new CJoyStickInput;
			if( FAILED( m_pJoyStick->InitDirectInput(m_hWnd, o_pDevice ) ) )
			{
				int nJoyCnt = 0;
				nJoyContorlLen = m_pJoyStick->GetJoystickCtrlDeviceListLen(); // 조이스틱 갯수
				for(nJoyCnt = 0;nJoyCnt < nJoyContorlLen;nJoyCnt++)
				{
					char* pJoyList = m_pJoyStick->GetJoystickCtrlDeviceList(nJoyCnt);
					if(pJoyList)
					{
						strncpy(m_chJoystickCtrlList[nJoyCnt], pJoyList, MAX_PATH);
					}
				}
				m_pJoyStick->FreeDirectInput();
				SAFE_DELETE(m_pJoyStick);				// 조이스틱 제어 제거
			}			
			else
			{
				// 장치 성공
				int nJoyCnt = 0;
				nJoyContorlLen = m_pJoyStick->GetJoystickCtrlDeviceListLen(); // 조이스틱 갯수
				for(nJoyCnt = 0;nJoyCnt < nJoyContorlLen;nJoyCnt++)
				{
					char* pJoyList = m_pJoyStick->GetJoystickCtrlDeviceList(nJoyCnt);
					if(pJoyList)
					{
						strncpy(m_chJoystickCtrlList[nJoyCnt], pJoyList, MAX_PATH);
					}
				}
			}
		}
	}

	if(bJoyFeed && (NULL != m_pJoyStick)) // 컨트롤러가 있어야 진동도 가능하다.
	{
		SAFE_DELETE(m_pJoyStickFreedback);
		if(NULL == m_pJoyStickFreedback)
		{
			// 진동 조이스틱 
			m_pJoyStickFreedback = new CJoyStickFreedback;
			if( FAILED( m_pJoyStickFreedback->InitDirectInput(m_hWnd, o_pDevice) ) )
			{
				m_pJoyStickFreedback->FreeDirectInput();
				SAFE_DELETE(m_pJoyStickFreedback);				// 조이스틱 제어
			}
			else
			{		
				// 성공시 성공한 정보를 가져온다.				
				m_pJoyStickFreedback->DeviceAcquire();						
			}
		}
	}

	m_nJoyContorlLen = nJoyContorlLen;
	return nJoyContorlLen;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		조이스틱 장치 초기화
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
int CAtumApplication::GetJoystickCtrlDeviceListLen()
{
	return m_nJoyContorlLen;

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		조이스틱 장치 초기화
/// \author		// 2008-11-13 by bhsohn 조이스틱 작업
/// \date		2008-11-13 ~ 2008-11-13
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
char* CAtumApplication::GetJoystickCtrlDeviceList(int i_nIdx)
{
	if(i_nIdx >= MAX_JOYCTL_LIST || i_nIdx < 0)
	{
		return NULL;
	}
	return m_chJoystickCtrlList[i_nIdx];	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		내 위치에 이펙트 보이게 한다.
/// \author		// 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가
/// \date		2008-12-29 ~ 2008-12-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::CreateMyAppEffectData(int i_nType, D3DXVECTOR3	i_vPos, D3DXVECTOR3	i_vVel, D3DXVECTOR3	i_vUp)
{
	if(NULL == m_pEffectList)			
	{
		return;
	}	
	
// 	- 오브젝트 타입 이펙트 제작시, 주의사항
// 		오브젝트 타입 이펙트 제작시에는 Alpha를 이용해서 사라지게 해야지만, 
// 		실제 이펙트가 메모리에서 사라진다.
	CAppEffectData *pData = new CAppEffectData(NULL, i_nType, i_vPos);
	if(pData->m_bUsing)
	{
		pData->SetAffDataMaxtrix(i_vPos, i_vVel, i_vUp);	// 매트릭스 위치 조종
		pData = (CAppEffectData *)g_pD3dApp->m_pEffectList->AddChild(pData);	
	}
	else
	{
		// 리소스가 없을시 메모리에서 제거
		SAFE_DELETE(pData);
	}
	
		
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		내 위치에 이펙트 보이게 한다.
/// \author		// 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가
/// \date		2008-12-29 ~ 2008-12-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendCharcterShowMapEffect(MSG_FC_CHARACTER_SHOW_MAP_EFFECT* i_pMsg)
{
	MSG_FC_CHARACTER_SHOW_MAP_EFFECT sMsg;
	memcpy(&sMsg, i_pMsg, sizeof(sMsg)); 
	m_pFieldWinSocket->SendMsg(T_FC_CHARACTER_SHOW_MAP_EFFECT, (char*)&sMsg, sizeof(sMsg)); 	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		내 위치에 이펙트 보이게 한다.
/// \author		// 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가
/// \date		2008-12-29 ~ 2008-12-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
D3DXVECTOR3 CAtumApplication::GetMyShuttleCharacterPos()
{
	D3DXVECTOR3	vPos;
	if(IsMyShuttleCharacter())
	{
		vPos = m_pCharacterChild->m_vPos;	// 캐릭터
	}
	else
	{
		vPos = m_pShuttleChild->m_vPos;		// 기어
	}	
	return vPos;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		내 위치에 이펙트 보이게 한다.
/// \author		// 2008-12-29 by bhsohn 럭키 머신 성공 이펙트 추가
/// \date		2008-12-29 ~ 2008-12-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
D3DXVECTOR3 CAtumApplication::GetViewDirVel()
{
	return m_pCamera->GetViewDir();
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-12-30 by bhsohn 전쟁보상추가 기획안
/// \date		2008-12-29 ~ 2008-12-29
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::CreateChatWarContribution(BYTE i_ItemUpdateType, int i_nOrgItemCount, int i_nNewItemCount)
{
	if(g_pTutorial->IsTutorialMode() == TRUE)
	{
		return;
	}
	
	int nUpdate = i_nNewItemCount - i_nOrgItemCount;

	if( nUpdate <= 0 || (NULL == m_pChat))
	{
		return;		
	}	
	char chTmpbuf[256];
	memset(chTmpbuf, 0x00, 256);
	
	// 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)
	char chTmp1[256], chTmp2[256];
	memset(chTmp1, 0x00, 256);
	memset(chTmp2, 0x00, 256);
	wsprintf(chTmp1, "%d", nUpdate);
	MakeCurrencySeparator(chTmp2,chTmp1,3,',');
	// end 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)

	switch(i_ItemUpdateType)
	{
	case IUT_WAR_CONTRIBUTION:
		{
			wsprintf(chTmpbuf, STRMSG_C_081230_0201, chTmp2); //"\\y개인 전쟁 기여 보상으로 [%s]SPI를 지급하였습니다."
		}
		break;
	case IUT_WAR_CONTRIBUTION_LEADER:
		{
			wsprintf(chTmpbuf, STRMSG_C_081230_0202, chTmp2);	//"\\y지도자 전쟁 기여 보상 [%s]SPI를 지급하였습니다."
		}
		break;
	default:
		{
			return;
		}
		break;
	}
	m_pChat->CreateChatChild( chTmpbuf, COLOR_SYSTEM, CHAT_TAB_SYSTEM);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2008-12-30 by bhsohn 전쟁보상추가 기획안
/// \date		2008-12-30 ~ 2008-12-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::FieldSocketBossContributionGuild(MSG_FC_WAR_BOSS_CONTRIBUTION_GUILD* pMsg)
{
	if(NULL == m_pChat)
	{
		return;
	}
	char chTmpbuf[256];
	memset(chTmpbuf, 0x00, 256);
	

	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();
	UID32_t	myGuildUniqueNumber = pMainInfo->GuildUniqueNumber;
	
	// 내여단 지급 정보 출력
	int nCnt = 0;
	if(myGuildUniqueNumber != 0)
	{
		memset(chTmpbuf, 0x00, 256);
		for(nCnt = 0;nCnt < 3;nCnt++)
		{
			if((myGuildUniqueNumber == pMsg->ContributionGuldInfo[nCnt].GuildUID)
				&&(pMsg->ContributionGuldInfo[nCnt].GuildPay > 0))
			{
				// 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)
				char chTmp1[256], chTmp2[256];
				memset(chTmp1, 0x00, 256);
				memset(chTmp2, 0x00, 256);
				wsprintf(chTmp1, "%d", pMsg->ContributionGuldInfo[nCnt].GuildPay);
				MakeCurrencySeparator(chTmp2,chTmp1,3,',');
				// end 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)

				//"\\y여단 창고에 보상 %dSPI가 지급 되었습니다."
				wsprintf(chTmpbuf, STRMSG_C_081230_0203, chTmp2);
				break;
			}			
		}	
		
		if(strlen(chTmpbuf) > 1)
		{
			m_pChat->CreateChatChild( chTmpbuf, COLOR_SYSTEM, CHAT_TAB_SYSTEM);
		}
	}

	// 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)
	if(myGuildUniqueNumber != 0)
	{
		// 지급 여단
		wsprintf(chTmpbuf, STRMSG_C_081230_0204);
		m_pChat->CreateChatChild( chTmpbuf, COLOR_SYSTEM, CHAT_TAB_SYSTEM);
		memset(chTmpbuf, 0x00, 256);
		for(nCnt = 0;nCnt < 3;nCnt++)
		{
			// 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)
			if(0 ==pMsg->ContributionGuldInfo[nCnt].order)
			{
				continue;
			}
			// end 2009-01-07 by bhsohn 전쟁보상추가 기획안(2)

			if(1 == pMsg->ContributionGuldInfo[nCnt].order)				
			{
				// "\\c%d등여단 : %s여단"
				wsprintf(chTmpbuf, STRMSG_C_081230_0205, pMsg->ContributionGuldInfo[nCnt].order, 
									pMsg->ContributionGuldInfo[nCnt].GuildName);
			}
			else
			{
				// "\\c%d등여단 : %s여단"
				wsprintf(chTmpbuf, STRMSG_C_081230_0206, pMsg->ContributionGuldInfo[nCnt].order, 
					pMsg->ContributionGuldInfo[nCnt].GuildName);
			}
			m_pChat->CreateChatChild( chTmpbuf, COLOR_SYSTEM, CHAT_TAB_SYSTEM);			
		}	
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-01-12 by bhsohn 친구 등록 당하는 유저 메시지창 기능 추가
/// \date		2008-12-30 ~ 2008-12-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
VOID CAtumApplication::IMChatFriendListInsertNotify(MSG_IC_CHAT_FRIENDLIST_INSERT_NOTIFY* pMsg)
{
	if(!g_pGameMain || !g_pGameMain->m_pCommunity)
	{
		return;
	}
	CINFCommunityFriend*  pFriend = g_pGameMain->m_pCommunity->GetFriend();
	if(!pFriend)
	{
		return;
	}

	char szCharName[SIZE_MAX_ARENA_FULL_NAME];
	char chMsg[128];
	STRNCPY_MEMSET(szCharName, pMsg->szDoerCharacName, SIZE_MAX_CHARACTER_NAME);	
	// 서버 이름 제거
	g_pD3dApp->ConevertArenaRenderUserName(g_pD3dApp->GetArenaState(), szCharName);


	if(pFriend->IsMyFriend(szCharName))
	{
		// 이미 친구의 등록된 유저는 창이 뜰 필요없다.
		return;
	}	
	// 2008-07-14 by bhsohn EP3 관련 처리
	else if(g_pGameMain && g_pGameMain->IsRejectUser(szCharName)) // 2013-07-22 by bhsohn 거부리스트 안전코드 추가
	{
		//"\\y거부 목록에 등록된 대상입니다."
		return;
	}
	
	wsprintf(chMsg, STRMSG_C_090112_0206, szCharName); //"%s님이 친구 요청을 하였습니다. 수락 하시겠습니까?"

	pFriend->SetRqFriend(szCharName);
	g_pGameMain->m_pInfWindow->AddTimeMsgBox(chMsg, _Q_FRIEND_LIST_INSERT,30,STRMSG_C_060724_0000); // 30초를 기다린다.
	
}

// 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정
VOID	CAtumApplication::SetWarDeclareInfo(SDECLARATION_OF_WAR* pWarInfo, SDECLARATION_OF_WAR_FORBID_TIME* pForbidTime, BOOL bSetDisable)
{
	GUI_BUILDINGNPC*	pCurBuilding	= g_pInterface->m_pCityBase->GetCurrentBuildingNPC();

	CINFCityLeader*		pCityLeader		= 0;
	CINFCityOutPost*	pOutPost		= 0;
	CINFWarDeclare*		pWarDeclare		= 0;

	// 관제탑, 전진기지 얻어오기
	if( !pCurBuilding )
		return;
	else if( pCurBuilding->buildingInfo.BuildingKind == BUILDINGKIND_CITYLEADER_LEADER )
		pCityLeader	= static_cast<CINFCityLeader*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_LEADER));
	else if( pCurBuilding->buildingInfo.BuildingKind = BUILDINGKIND_CITYLEADER_OUTPOST )
		pOutPost	= static_cast<CINFCityOutPost*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_OUTPOST));	

	// 관리자면 선전포고창 까지
	if(COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER|RACE_GAMEMASTER|RACE_OPERATION))
		pWarDeclare	= g_pGameMain->GetINFMotherShipManager()->GetWarDeclareWindow();

	// 현재 시간 얻어오기
	ATUM_DATE_TIME	curTime		= GetServerDateTime();

	// 자신의 세력일 경우
	if(pWarInfo->Influence == g_pShuttleChild->m_myShuttleInfo.InfluenceType)
	{
		// 관제탑
		if(pCityLeader)
		{
			// 이번주 아군 모선 시간
			// 포기일 경우 업데이트 안함(기본값 포기)
			if(!pWarInfo->GiveUp)
				pCityLeader->SetWarDeclareTime(pWarInfo->MSWarStartTime, pCityLeader->GetOurThisTakeOffTime());

			// 다음주 아군 모선 시간
			if(!((pWarInfo+1)->GiveUp))
			pCityLeader->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pCityLeader->GetOurNextTakeOffTime());

			// 설정 불가능할 경우 모선전 진행 불가
			if(bSetDisable)
			{
				strcpy(pCityLeader->GetOurThisTakeOffTime(), STRMSG_C_090210_0301);
				//strcpy(pCityLeader->GetOurNextTakeOffTime(), STRMSG_C_090210_0301);
			}
		}
		
		// 전진기지
		if(pOutPost)
		{
			// 이번주 아군 모선 시간
			if(!pWarInfo->GiveUp)
				pOutPost->SetWarDeclareTime(pWarInfo->MSWarStartTime, pOutPost->GetOurThisTakeOffTime());
			
			// 다음주 아군 모선 시간
			if(!((pWarInfo+1)->GiveUp))
				pOutPost->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pOutPost->GetOurNextTakeOffTime());

			// 설정 불가능할 경우 모선전 진행 불가
			if(bSetDisable)
			{
				strcpy(pOutPost->GetOurThisTakeOffTime(), STRMSG_C_090210_0301);
				//strcpy(pOutPost->GetOurNextTakeOffTime(), STRMSG_C_090210_0301);
			}
		}
		
		// 지도자일 경우, 다음주 것만 업데이트
		if(pWarDeclare)
		{
			SDECLARATION_OF_WAR* pWarDeclareInfo;
			if(!bSetDisable)
				pWarDeclareInfo = (pWarInfo+1);
			else
				pWarDeclareInfo	= pWarInfo;

			// 포기일 경우 업데이트 안함 기본값(포기)
			if(!( pWarDeclareInfo->GiveUp ) )
				pWarDeclare->SetWarDeclareDate( &( pWarDeclareInfo->MSWarStartTime) );

			// 제한기간, 가능기간, 남은 횟수, 주기 설정
			pWarDeclare->SetWarDeclareForbidPeriod(pForbidTime->DayOfWeek, &(pForbidTime->ForbidStartTime), &(pForbidTime->ForbidEndTime));
			pWarDeclare->SetWarDecalreEnablePeriod(&(pWarDeclareInfo->MSWarStepStartTime), &(pWarDeclareInfo->MSWarStepEndTime));

			// 설정 불가능할 경우 남은 횟수 0으로 셋팅
			if(bSetDisable)
				pWarDeclare->SetWarDeclareLeftChance(0);
			else
				pWarDeclare->SetWarDeclareLeftChance(pWarDeclareInfo->SelectCount);

			pWarDeclare->SetMSWarStep(pWarDeclareInfo->MSWarStep);
			pWarDeclare->SetDisableWarDeclare(bSetDisable);
		}
	}
	else
	{// 적군일 경우
		// 관제탑
		if(pCityLeader)
		{
			// 적군 이번주 모선 시간
			if(!pWarInfo->GiveUp)
				pCityLeader->SetWarDeclareTime(pWarInfo->MSWarStartTime, pCityLeader->GetEnemyThisTakeOffTime());
			
			// 적군 다음주 모선 시간
			if(!((pWarInfo+1)->GiveUp))
				pCityLeader->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pCityLeader->GetEnemyNextTakeOffTime());

			// 설정 불가능할 경우 모선전 진행 불가
			if(bSetDisable)
			{
				strcpy(pCityLeader->GetEnemyThisTakeOffTime(), STRMSG_C_090210_0301);
				//strcpy(pCityLeader->GetEnemyNextTakeOffTime(), STRMSG_C_090210_0301);
			}
		}
		
		// 전진기지
		if(pOutPost)
		{
			// 적군 이번주 모선 시간
			if(!pWarInfo->GiveUp)
				pOutPost->SetWarDeclareTime(pWarInfo->MSWarStartTime, pOutPost->GetEnemyThisTakeOffTime());
			
			// 적군 다음주 모선 시간
			if(!((pWarInfo+1)->GiveUp))
				pOutPost->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pOutPost->GetEnemyNextTakeOffTime());

			// 설정 불가능할 경우 모선전 진행 불가
			if(bSetDisable)
			{
				strcpy(pOutPost->GetEnemyThisTakeOffTime(), STRMSG_C_090210_0301);
				//strcpy(pOutPost->GetEnemyNextTakeOffTime(), STRMSG_C_090210_0301);
			}
		}
	}
}
// end 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정


// 2009. 01. 12 by ckPark 선전 포고 시스템
VOID CAtumApplication::FieldSocketWarDeclareInfoOK(MSG_FC_INFO_DECLARATION_MSWAR_INFO_OK* pMsg)
{
	SDECLARATION_OF_WAR* pWarInfo	= (SDECLARATION_OF_WAR*)( (char*)pMsg + sizeof(MSG_FC_INFO_DECLARATION_MSWAR_INFO_OK) );

	// 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정
// 	GUI_BUILDINGNPC*	pCurBuilding	= g_pInterface->m_pCityBase->GetCurrentBuildingNPC();
// 
// 	CINFCityLeader*		pCityLeader		= 0;
// 	CINFCityOutPost*	pOutPost		= 0;
// 	CINFWarDeclare*		pWarDeclare		= 0;
// 
// 	// 관제탑, 전진기지 얻어오기
// 	if( !pCurBuilding )
// 		return;
// 	else if( pCurBuilding->buildingInfo.BuildingKind == BUILDINGKIND_CITYLEADER_LEADER )
// 		pCityLeader	= static_cast<CINFCityLeader*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_LEADER));
// 	else if( pCurBuilding->buildingInfo.BuildingKind = BUILDINGKIND_CITYLEADER_OUTPOST )
// 		pOutPost	= static_cast<CINFCityOutPost*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_OUTPOST));
// 
// 	// 관리자면 선전포고창 까지
// 	if(COMPARE_RACE(g_pShuttleChild->m_myShuttleInfo.Race,RACE_INFLUENCE_LEADER|RACE_GAMEMASTER|RACE_OPERATION))
// 		pWarDeclare	= g_pGameMain->GetINFMotherShipManager()->GetWarDeclareWindow();
	// end 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정

	// 현재 시간 얻어오기
	ATUM_DATE_TIME	curTime		= GetServerDateTime();

	// 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정
	BOOL bFindPeriod = FALSE;
	// end 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정

	// 아군 6개, 적군 6개 루프
	int i;
	for(i = 0; i < pMsg->DeclarationOfWarListCount; i++)
	{
		// 현재시간이 주기에 포함될 경우
		if(curTime >= pWarInfo->MSWarStepStartTime && curTime <= pWarInfo->MSWarStepEndTime)
		{
			// 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정
// 			// 자신의 세력일 경우
// 			if(pWarInfo->Influence == g_pShuttleChild->m_myShuttleInfo.InfluenceType)
// 			{
// 				// 관제탑
// 				if(pCityLeader)
// 				{
// 					// 이번주 아군 모선 시간
// 					// 포기일 경우 업데이트 안함(기본값 포기)
// 					if(!pWarInfo->GiveUp)
// 						pCityLeader->SetWarDeclareTime(pWarInfo->MSWarStartTime, pCityLeader->GetOurThisTakeOffTime());
// 					
// 					// 다음주 아군 모선 시간
// 					if(!((pWarInfo+1)->GiveUp))
// 						pCityLeader->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pCityLeader->GetOurNextTakeOffTime());
// 				}
// 				
// 				// 전진기지
// 				if(pOutPost)
// 				{
// 					// 이번주 아군 모선 시간
// 					if(!pWarInfo->GiveUp)
// 						pOutPost->SetWarDeclareTime(pWarInfo->MSWarStartTime, pOutPost->GetOurThisTakeOffTime());
// 					
// 					// 다음주 아군 모선 시간
// 					if(!((pWarInfo+1)->GiveUp))
// 						pOutPost->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pOutPost->GetOurNextTakeOffTime());
// 				}
// 				
// 				// 지도자일 경우, 다음주 것만 업데이트
// 				if(pWarDeclare)
// 				{
// 					// 포기일 경우 업데이트 안함 기본값(포기)
// 					if(!( (pWarInfo+1)->GiveUp ) )
// 						pWarDeclare->SetWarDeclareDate( &( (pWarInfo+1)->MSWarStartTime) );
// 					
// 					// 제한기간, 가능기간, 남은 횟수, 주기 설정
// 					pWarDeclare->SetWarDeclareForbidPeriod(pMsg->ForbidTime.DayOfWeek, &(pMsg->ForbidTime.ForbidStartTime), &(pMsg->ForbidTime.ForbidEndTime));
// 					pWarDeclare->SetWarDecalreEnablePeriod(&((pWarInfo+1)->MSWarStepStartTime), &((pWarInfo+1)->MSWarStepEndTime));
// 					pWarDeclare->SetWarDeclareLeftChance((pWarInfo+1)->SelectCount);
// 					pWarDeclare->SetMSWarStep((pWarInfo+1)->MSWarStep);
// 				}
// 			}
// 			else
// 			{// 적군일 경우
// 				// 관제탑
// 				if(pCityLeader)
// 				{
// 					// 적군 이번주 모선 시간
// 					if(!pWarInfo->GiveUp)
// 						pCityLeader->SetWarDeclareTime(pWarInfo->MSWarStartTime, pCityLeader->GetEnemyThisTakeOffTime());
// 					
// 					// 적군 다음주 모선 시간
// 					if(!((pWarInfo+1)->GiveUp))
// 						pCityLeader->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pCityLeader->GetEnemyNextTakeOffTime());
// 				}
// 				
// 				// 전진기지
// 				if(pOutPost)
// 				{
// 					// 적군 이번주 모선 시간
// 					if(!pWarInfo->GiveUp)
// 						pOutPost->SetWarDeclareTime(pWarInfo->MSWarStartTime, pOutPost->GetEnemyThisTakeOffTime());
// 					
// 					// 적군 다음주 모선 시간
// 					if(!((pWarInfo+1)->GiveUp))
// 						pOutPost->SetWarDeclareTime((pWarInfo+1)->MSWarStartTime, pOutPost->GetEnemyNextTakeOffTime());
// 				}
// 			}

			bFindPeriod = TRUE;

			SetWarDeclareInfo(pWarInfo, &(pMsg->ForbidTime), FALSE );
			// end 2009. 02. 10 by ckPark 선전 포고 시스템 추가 수정
			// 2009. 08. 10 by jsKim 모선전 설정주기 이탈 생기는 문자열 버그 수정
			CINFCityLeader*		pCityLeader	= 0;
			pCityLeader	= static_cast<CINFCityLeader*>(g_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_CITYLEADER_LEADER));
			
			// 2013-09-05 by bhsohn 메모리 오류 수정
			if(pCityLeader	)
			{
				if(i == pMsg->DeclarationOfWarListCount / 2 - 1)
				{
					strcpy(pCityLeader->GetEnemyNextTakeOffTime(), STRMSG_C_090810_0401);				
				}
				else if(i == pMsg->DeclarationOfWarListCount - 1)
				{
					strcpy(pCityLeader->GetOurNextTakeOffTime(), STRMSG_C_090810_0401);
				}
			}			
			// end 2009. 08. 10 by jsKim 모선전 설정주기 이탈시 생기는 문자열 버그 수정
		}

		++pWarInfo;
	}

	// 설정주기를 못찾았을 경우 첫번째 주기를 셋팅하고 선택불가로 한다
	if(!bFindPeriod)
	{
		pWarInfo	= (SDECLARATION_OF_WAR*)( (char*)pMsg + sizeof(MSG_FC_INFO_DECLARATION_MSWAR_INFO_OK) );

		SetWarDeclareInfo(pWarInfo, &(pMsg->ForbidTime), TRUE);
		SetWarDeclareInfo(pWarInfo + 6, &(pMsg->ForbidTime), TRUE);
	}
}

// end 2009. 01. 12 by ckPark 선전 포고 시스템

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-01-28 by bhsohn nProtector 게임 가드 추가
/// \date		2008-12-30 ~ 2008-12-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::InitGameGuardNProtector()
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	SAFE_DELETE(m_pNpgl);

	char chGameName[256];
	ZERO_MEMORY(chGameName);
// 2015-01-07 by jwLee 게임포지 nProtector 적용
#if defined(GAMEFORGE_RELEASE)
	if(g_pD3dApp->m_bArgcTestServer)
	{
		wsprintf(chGameName, "AirRivalsEUTest");
	}
	else
	{
		wsprintf(chGameName, "AirRivalsEU");
	}
#else
	wsprintf(chGameName, "ACEJP");
#endif
// end 2015-01-07 by jwLee 게임포지 nProtector 적용

	// 전역 변수로 객체 생성
	m_pNpgl = new CNPGameLib(chGameName);
	// 게임 초기화 루틴(WinMain 등)에서 Init() 호출, 리턴값 처리
	// 가능한 디스플레이 모드 전환이 있기 전에 최대한 일찍 처리
	DWORD dwResult = m_pNpgl->Init();
	if (dwResult != NPGAMEMON_SUCCESS)
	{
		// 2009-03-10 by bhsohn nProtector 에러 메시지 창 추가
		TCHAR msg[256];
		char chMsgStr[1024];
		chMsgStr[0] = NULL;
		//LPCSTR lpszMsg;
		// ‘6. 주요에러코드’를 참조하여 상황에 맞는 메시지를 출력해줍니다.
		switch (dwResult)
		{
		case NPGAMEMON_ERROR_EXIST:
			//lpszMsg = TEXT(“게임가드가 실행 중 입니다. 잠시 후나 재부팅 후에 다시 실행해보시기바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0201);
			break;
		case NPGAMEMON_ERROR_GAME_EXIST:
			//lpszMsg = TEXT(“게임이 중복 실행되었거나 게임가드가 이미 실행 중 입니다. 게임 종료 후 다시 실행해보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0202);
			break;
		case NPGAMEMON_ERROR_INIT:
			//lpszMsg = TEXT(“게임가드 초기화 에러입니다. 재부팅 후 다시 실행해보거나 충돌할 수있는 다른 프로그램들을 종료한 후 실행해 보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0203);
			break;
		case NPGAMEMON_ERROR_AUTH_GAMEGUARD:
		case NPGAMEMON_ERROR_NFOUND_GG:
		case NPGAMEMON_ERROR_AUTH_INI:
		case NPGAMEMON_ERROR_NFOUND_INI:
			//lpszMsg = TEXT(“게임가드 파일이 없거나 변조되었습니다. 게임가드 셋업 파일을 설치해 보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0204);
			break;
		case NPGAMEMON_ERROR_CRYPTOAPI:
			//lpszMsg = TEXT(“윈도우의 일부 시스템 파일이 손상되었습니다. 인터넷 익스플로러(IE)를다시 설치해보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0205);
			break;
		case NPGAMEMON_ERROR_EXECUTE:
			//lpszMsg = TEXT(“게임가드 실행에 실패했습니다. 게임가드 셋업 파일을 다시 설치해보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0206);			
			break;
		case NPGAMEMON_ERROR_ILLEGAL_PRG:
			//lpszMsg = TEXT(“불법 프로그램이 발견되었습니다. 불필요한 프로그램을 종료한 후 다시 실행해보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0207);			
			break;
		case NPGMUP_ERROR_ABORT:
			//lpszMsg = TEXT(“게임가드 업데이트를 취소하셨습니다. 접속이 계속 되지 않을 경우 인터넷 및 개인 방화벽 설정을 조정해 보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0208);			
			break;
		case NPGMUP_ERROR_CONNECT:
			//lpszMsg = TEXT(“게임가드 업데이트 서버 접속에 실패하였습니다. 잠시 후 다시 접속하거나, 네트웍 상태를 점검해봅니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0209);			
			break;
		case NPGAMEMON_ERROR_GAMEGUARD:
			//lpszMsg = TEXT(“게임가드 초기화 에러 또는 구버젼의 게임가드 파일입니다. 게임가드 셋업파일을 다시 설치하고 게임을 실행해봅니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0210);			
			break;
		case NPGMUP_ERROR_PARAM:
			//lpszMsg = TEXT( “ini 파일이 없거나 변조되었습니다. 게임가드 셋업 파일을 설치하면 해결할 수 있습니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0211);
			break;
		case NPGMUP_ERROR_INIT:
			//lpszMsg = TEXT(“npgmup.des 초기화 에러입니다. 게임가드폴더를 삭제후 다시 게임실행을 해봅니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0212);
			break;
		case NPGMUP_ERROR_DOWNCFG:
			//lpszMsg = TEXT(“게임가드 업데이트 서버 접속에 실패하였습니다. 잠시 후 재시도 해보거나, 개인 방화벽이 있다면 설정을 조정해 보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0213);
			break;
		case NPGMUP_ERROR_AUTH:
			//lpszMsg = TEXT(“게임가드 업데이트를 완료하지 못 했습니다. 바이러스 백신을 일시 중시시킨 후 재시도 해보시거나, PC 관리 프로그램을 사용하시면 설정을 조정해 보시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0214);
			break;
		case NPGAMEMON_ERROR_NPSCAN:
			//lpszMsg = TEXT(“바이러스 및 해킹툴 검사 모듈 로딩에 실패 했습니다. 메모리 부족이거나 바이러스에 의한 감염일 수 있습니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0215);
			break;
		case NPGG_ERROR_COLLISION:
			//lpszMsg = TEXT(“게임가드와 충돌 프로그램이 발견되었습니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0216);
			break;
		default:
			// 적절한 종료 메시지 출력
			//lpszMsg = TEXT("게임가드 실행 중 에러가 발생하였습니다. 게임 폴더 안의 GameGuard폴더에 있는 *.erl 파일들을 Game1@inca.co.kr로 첨부하여 메일 보내주시기 바랍니다.”);
			wsprintf(chMsgStr, STRMSG_C_090310_0217);
			break;
		}
		
		wsprintf(msg, STRMSG_C_090310_0218, dwResult);
 		MessageBox(NULL, chMsgStr, msg, MB_OK);
		// end 2009-03-10 by bhsohn nProtector 에러 메시지 창 추가
// 		wsprintf(msg, TEXT("게임가드 에러 : %lu"), dwResult);
// 		MessageBox(NULL, lpszMsg, msg, MB_OK);
// 		// 게임에 맞게 종료 코드
// 		bAppExit = true;
		return FALSE;
	}

	// 윈도우 핸들이 생성된 후, 그리고 모든 그래픽, UI 관련 초기화가 끝난 후 SetHwnd() 호출
	// 이 함수 호출 이후부터, CallBack 함수가 호출되기 시작함
	//m_pNpgl->SetHwnd(GetHwnd());

	// 사용자 로그인시 ID를 GameMon에 통보
	//m_pNpgl->Send(m_strUserID); // 반드시 문자열 끝에 종료(NULL) 를 포함시켜서 전달해야 합니다.
	
#endif
	return TRUE;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		게임가드 시작
/// \author		// 2008-11-28 by bhsohn XignCode추가
/// \date		2008-11-28 ~ 2008-11-28
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::SetGameGuardHWND()
{
	int nGameGuard = GAMEGUARD_TYPE;
	switch(nGameGuard)
	{	
		// 2009-01-28 by bhsohn nProtector 게임 가드 추가	
	case USE_GAMEGUARD_NPROTECTOR:
		{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)
			// 윈도우 핸들이 생성된 후, 그리고 모든 그래픽, UI 관련 초기화가 끝난 후 SetHwnd() 호출
			// 이 함수 호출 이후부터, CallBack 함수가 호출되기 시작함
			m_pNpgl->SetHwnd(GetHwnd());
			
			// 사용자 로그인시 ID를 GameMon에 통보
			m_pNpgl->Send(m_strUserID); // 반드시 문자열 끝에 종료(NULL) 를 포함시켜서 전달해야 합니다.
#endif
		}
		break;
		// end 2009-01-28 by bhsohn nProtector 게임 가드 추가	
	}
	return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-01-28 by bhsohn nProtector 게임 가드 추가
/// \date		2008-12-30 ~ 2008-12-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
BOOL CAtumApplication::TickGetCheckGameGuardNProtector()
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	if(NULL == m_pNpgl)
	{
		return FALSE;
	}
	m_fnProtectorHackCheckTime -= GetCheckElapsedTime();
	if(m_fnProtectorHackCheckTime >=0 )
	{
		return TRUE;
	}
	m_fnProtectorHackCheckTime = GAME_GUARD_nPROTECTOR_CHECK_TIME;
	
	// 게임 곳곳에서 또는 타이머에서 게임가드가 실행 중인지 확인
	if (m_pNpgl->Check() != NPGAMEMON_SUCCESS)
	{
		MessageBox(NULL,"TickGetCheckGameGuardNProtector Error", "Error",MB_OK);
		return FALSE; // 게임에 맞게 적절히 종료시킴
	}
#endif
	return TRUE;
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-01-28 by bhsohn nProtector 게임 가드 추가
/// \date		2008-12-30 ~ 2008-12-30
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 메시지 처리 Callback 함수
// 게임 종료시에는 false를 return 해주고, 종료하지 않는 경우는 true를 return 합니다.
BOOL CALLBACK NPGameMonCallback(DWORD dwMsg, DWORD dwArg)
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	char szHackMsg[256] = { 0 };
	ZERO_MEMORY(szHackMsg);

	BOOL bAppExit = false;
	switch (dwMsg)
	{
		// 2009-03-10 by bhsohn nProtector CS모듈 추가
	case NPGAMEMON_CHECK_CSAUTH2:
		{
			// 서버로 인증 패킷을 전송. 이때 Callback 함수는 게임가드 프로세서가 호출하므로 동기화가 필수
// 			memcpy(&m_AuthData, (PVOID)dwArg, sizeof(GG_AUTH_DATA));			
// 			SendToServer(&m_AuthData);
			if(g_pD3dApp)
			{
				g_pD3dApp->SendNpGameMonCheckCSAuth2((PVOID)dwArg);
			}
			return true;
		}
		break;
		// end 2009-03-10 by bhsohn nProtector CS모듈 추가
		// 2015-01-07 by jwLee 게임포지 nProtector 적용
	case NPGAMEMON_CHECK_CSAUTH3:
		{
			if(g_pD3dApp)
			{
				g_pD3dApp->SendNpGameMonCheckCSAuth3((PVOID)dwArg);
			}
			return true;
		}
		break;
		// end 2015-01-07 by jwLee 게임포지 nProtector 적용
	case NPGAMEMON_COMM_ERROR:
		{
			wsprintf(szHackMsg, "NPGAMEMON_COMM_ERROR");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_COMM_ERROR");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_COMM_ERROR;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드						
		}
		break;
	case NPGAMEMON_COMM_CLOSE:
		{
			wsprintf(szHackMsg, "NPGAMEMON_COMM_CLOSE");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_COMM_CLOSE");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_COMM_CLOSE;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	case NPGAMEMON_INIT_ERROR:
		{
			wsprintf(szHackMsg, "NPGAMEMON_INIT_ERROR");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_INIT_ERROR");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_INIT_ERROR;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	case NPGAMEMON_SPEEDHACK:
		{
			wsprintf(szHackMsg, "NPGAMEMON_SPEEDHACK");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_SPEEDHACK");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_SPEEDHACK;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	case NPGAMEMON_GAMEHACK_KILLED:
		{
			wsprintf(szHackMsg, "NPGAMEMON_GAMEHACK_KILLED");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_GAMEHACK_KILLED");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_GAMEHACK_KILLED;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	case NPGAMEMON_GAMEHACK_DETECT:
		{
			wsprintf(szHackMsg, "NPGAMEMON_GAMEHACK_DETECT");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_GAMEHACK_DETECT");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_GAMEHACK_DETECT;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드
		}
		break;
	case NPGAMEMON_GAMEHACK_DOUBT:
		{
			wsprintf(szHackMsg, "NPGAMEMON_GAMEHACK_DOUBT");
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_GAMEHACK_DOUBT");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_GAMEHACK_DOUBT;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	case NPGAMEMON_GAMEHACK_REPORT:
		{
			DWORD dwHackInfoSize = 0;
			LPBYTE pHackInfo = NULL;
			pHackInfo = GetHackInfoFromGameMon(&dwHackInfoSize);
			// pHackInfo = npgl.GetHackInfo(&dwHackInfoSize); // C++ 일 경우.
			if (pHackInfo && dwHackInfoSize > 0)
			{
				// 아래 함수는 게임가드에서 제공하는 함수가 아닙니다.
				//SendToHackLog(pHackInfo, dwHackInfoSize); // 서버로 데이터 전송.
			}
			// 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			wsprintf(szHackMsg, "NPGAMEMON_GAMEHACK_REPORT");
			strcpy(g_pD3dApp->m_strMsgHackError,"NPGAMEMON_GAMEHACK_REPORT");
			g_pD3dApp->m_bMsgHackError = NPGAMEMON_GAMEHACK_REPORT;
			// end 2015-02-03 by jwLee nProtect 메세지 에러메세지 출력
			bAppExit = true; // 종료 코드			
		}
		break;
	}
	if(bAppExit)
	{
		if(g_pD3dApp)
		{
			g_pD3dApp->HS_SendHackShieldErrorMsg(dwMsg, szHackMsg);
		}
		return false;
	}
#endif	//#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	return true; // 계속 진행
}


///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-03 by bhsohn 미션 시작시 완료 체크 체크
/// \date		2009-02-03 ~ 2009-02-03
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketQuestPutAllQuestMonsterCountDone()
{
	int nMissionIndex = g_pD3dApp->SerchMissionCondition();
	if(nMissionIndex != NULL)
	{
		g_pD3dApp->SendMissionComplete(nMissionIndex);
	}
}
						

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
CWorldRankManager*	CAtumApplication::GetWorldRankManager()
{
	return m_pWorldRankManager;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetServiceInfoOk(MSG_FC_INFO_WRK_GET_SERVICE_INFO_OK* pMsg)
{
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();
	pWorldRankManager->AddServiceInfo(pMsg);

}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetServiceInfoOkImage(MSG_FC_INFO_WRK_GET_SERVICE_INFO_OK_IMAGE* pMsg)
{
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();
	pWorldRankManager->AddServiceInfoImage(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetServiceInfoOkDone()
{	
	// 전체 1순위 랭커들이 정보를 요청한다.
	RqAllWorldRankInfo();
}
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetLevelRankerListOk(MSG_FC_INFO_WRK_GET_LEVEL_RANKER_LIST_OK* pMsg)
{	
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();	

	int nStartRank = pMsg->byStartRank;
	SWRK_LEVEL* pSwrk = (SWRK_LEVEL*)((char *)pMsg + sizeof(MSG_FC_INFO_WRK_GET_LEVEL_RANKER_LIST_OK));
	int i;
	for(i = 0 ; i < pMsg->byRankerCnt; i++)
	{		
		pWorldRankManager->AddWorldRank_Lv(nStartRank, pSwrk);	
		pSwrk++;
	}
	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetFameRankerListOk(MSG_FC_INFO_WRK_GET_FAME_RANKER_LIST_OK* pMsg)
{
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();	

	int nStartRank = pMsg->byStartRank;
	SWRK_FAME* pSwrk = (SWRK_FAME*)((char *)pMsg + sizeof(MSG_FC_INFO_WRK_GET_FAME_RANKER_LIST_OK));
	int i;
	for(i = 0 ; i < pMsg->byRankerCnt; i++)
	{		
		pWorldRankManager->AddWorldRank_Fame(nStartRank, pSwrk);	
		pSwrk++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWRKGetPVPRankerListOk(MSG_FC_INFO_WRK_GET_PVP_RANKER_LIST_OK* pMsg)
{
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();	

	int nStartRank = pMsg->byStartRank;
	SWRK_PVP* pSwrk = (SWRK_PVP*)((char *)pMsg + sizeof(MSG_FC_INFO_WRK_GET_PVP_RANKER_LIST_OK));
	int i;
	for(i = 0 ; i < pMsg->byRankerCnt; i++)
	{		
		pWorldRankManager->AddWorldRank_PVP(nStartRank, pSwrk);	
		pSwrk++;
	}
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterChangeNickNameOk(MSG_FC_CHARACTER_CHANGE_NICKNAME_OK* pMsg)
{
	// 아레나 캐릭터 정보	
	CHARACTER*	pArenaInfo = m_pArenaManager->GetArenaCharacterInfo();	
	strncpy(pArenaInfo->NickName, pMsg->NickName, SIZE_MAX_CHARACTER_NAME);

	CHARACTER*	pMainInfo = m_pArenaManager->GetMFSMyShuttleInfo();
	strncpy(pMainInfo->NickName, pMsg->NickName, SIZE_MAX_CHARACTER_NAME);
	
	// 메인 서버 정보 갱신
	CHARACTER myShuttle = m_pShuttleChild->GetMyShuttleInfo();
	strncpy(myShuttle.NickName, pMsg->NickName, SIZE_MAX_CHARACTER_NAME);
	// 게임정보를 다시 갱신 
	SetMyShuttleInfo(&myShuttle);	
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketInfoWrkGetSelfRankingOk(MSG_FC_INFO_WRK_GET_SELF_RANKING_OK* pMsg)
{
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();
	pWorldRankManager->SetMyRankInfo(pMsg);

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		전체 월드 랭커들을 얻어온다.
/// \author		// 2009-02-13 by bhsohn 월드 랭킹 시스템
/// \date		2009-02-20 ~ 2009-02-20
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::RqAllWorldRankInfo()
{
	int nCnt = 0;
	int nInfoIdx[MAX_WORLDRANK_INFO] = 
	{
		WORLDRANK_INFO_LV,
		WORLDRANK_INFO_HONOR,
		WORLDRANK_INFO_PVP
	};
	int nRank = 1;
	CWorldRankManager*	pWorldRankManager = GetWorldRankManager();
	for(nCnt = 0;nCnt < MAX_WORLDRANK_INFO;nCnt++)
	{
		pWorldRankManager->RqWorldRankInfo(WORLDRANK_SERVICE_WORLD,			// 지역이냐? 월드냐?
											nInfoIdx[nCnt],			// 레벨, 명성치, PVP
											WORLDRANK_GEAR_ALL,			// 기어 인덱스
											nRank,
											MAX_WORLDRANK_ONEPAGE,
											FALSE);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-02-24 by bhsohn 캐쉬샵 충전 웹페이지 추가
/// \date		2009-02-24 ~ 2009-02-24
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
// 2012-11-28 by jhjang 게임포지 웹 상점 통합 추가 작업
//void CAtumApplication::PopupWebWindow(BOOL i_bPopup)
void CAtumApplication::PopupWebWindow(BOOL i_bPopup,char* strWebSite,char* strWebParameter,int nWebPosX,int nWebPosY,int nWebWidth,int nWebHeight)// 2012-11-22 by jhjang 웹 상점을 위한 더미 클래스 제작
{
	// 2013-05-23 by bhsohn 익스폴로워 모드로 업그레이드
	// 2013-05-31 by ssjung 웹캐쉬 상점 창모드는 IE8로 풀모드는 IE7으로 띄움
#ifdef C_MASANG_WEB_CASHSHOP
// 	if(IsWindowMode())
// 	{
// 		if(i_bPopup)
// 		{
// 			PopupExplore(strWebSite, strWebParameter, nWebPosX, nWebPosY, nWebWidth,nWebHeight);
// 		}
// 		else
// 		{
// 			ReleaseExplore();
// 		}
// 	}
// 	else
	{
		if(i_bPopup)
		{
			// 2012-11-28 by jhjang 게임포지 웹 상점 통합 추가 작업
			// 2012-11-22 by jhjang 웹 상점을 위한 더미 클래스 제작
			CreateWebWindow(strWebSite,strWebParameter,nWebPosX,nWebPosY,nWebWidth,nWebHeight);
//			ShowWebWindow(nWebPosX,nWebPosY);
			ShowWebWindow(nWebPosX,nWebPosY, nWebWidth,nWebHeight);				   // 2013-07-18 by ssjung 신규 웹 캐쉬 상점 적용
		}
		else
		{
			HideWebWindow();
			DestroyWebWindow();	// IME가 깨지기 때문에 webWindow를 삭제해야한다.
		}
	}
	// end 2013-05-31 by ssjung 웹캐쉬 상점 창모드는 IE8로 풀모드는 IE7으로 띄움
	
#else
	
	if(i_bPopup)
	{
		// 2012-11-28 by jhjang 게임포지 웹 상점 통합 추가 작업
		// 2012-11-22 by jhjang 웹 상점을 위한 더미 클래스 제작
#ifdef SC_WEB_CASHSHOP_SSJUNG_JHSEOL
		//CreateWebWindow();
		CreateWebWindow(strWebSite,strWebParameter,nWebPosX,nWebPosY,nWebWidth,nWebHeight);
		ShowWebWindow(nWebPosX,nWebPosY);
#else
		CreateWebWindow();
		ShowWebWindow();
#endif

	}
	else
	{
		HideWebWindow();
		DestroyWebWindow();	// IME가 깨지기 때문에 webWindow를 삭제해야한다.
	}
#endif
// END 2013-05-23 by bhsohn 익스폴로워 모드로 업그레이드
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		NPGAMEMON_CHECK_CSAUTH2에 대한 처리
/// \author		// 2009-03-10 by bhsohn nProtector CS모듈 추가
/// \date		2009-03-10 ~ 2009-03-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::SendNpGameMonCheckCSAuth2(PVOID dwArg)
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	//DbgOut("SendNpGameMonCheckCSAuth2 \n");

	GG_AUTH_DATA AuthData;
	memcpy(&AuthData, (PVOID)dwArg, sizeof(GG_AUTH_DATA));
	
	MSG_FC_MOVE_NPROTECT_REQ_AUTH_DATA_OK sMsg;
	memset(&sMsg, 0x00, sizeof(MSG_FC_MOVE_NPROTECT_REQ_AUTH_DATA_OK));

	memcpy(sMsg.resAuthData, &AuthData, sizeof(GG_AUTH_DATA));	
	m_pFieldWinSocket->SendMsg( T_FC_MOVE_NPROTECT_REQ_AUTH_DATA_OK, (char*)&sMsg, sizeof(sMsg)); 	
#endif
}
// 2015-01-07 by jwLee 게임포지 nProtector 적용
void CAtumApplication::SendNpGameMonCheckCSAuth3(PVOID dwArg)
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)
	CSAuth3Data Auth3Data;
	memcpy(&Auth3Data, (PVOID)dwArg, sizeof(CSAuth3Data));
	
	for (int i = 0 ; i < 11 ; i++)
	{
		MSG_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA_OK sMsg;
		memset(&sMsg, 0x00, sizeof(MSG_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA_OK));

		if (Auth3Data.dwPacketSize > i * MAX_PACKET_SIZE_FOR_NPROTECT_NEW)
		{	
			memcpy(sMsg.resAuthData, Auth3Data.bPacket + (i * MAX_PACKET_SIZE_FOR_NPROTECT_NEW), MAX_PACKET_SIZE_FOR_NPROTECT_NEW);	
			m_pFieldWinSocket->SendMsg( T_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA_OK, (char*)&sMsg, sizeof(sMsg)); 	
		}
		else
		{
			memcpy(sMsg.resAuthData, Auth3Data.bPacket + (i * MAX_PACKET_SIZE_FOR_NPROTECT_NEW), MAX_PACKET_SIZE_FOR_NPROTECT_NEW);	
			sMsg.datasize = Auth3Data.dwPacketSize;
			m_pFieldWinSocket->SendMsg( T_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA_OK, (char*)&sMsg, sizeof(sMsg)); 	
			break;
		}
	}
#endif
}
// end 2015-01-07 by jwLee 게임포지 nProtector 적용

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		NPGAMEMON_CHECK_CSAUTH2에 대한 처리
/// \author		// 2009-03-10 by bhsohn nProtector CS모듈 추가
/// \date		2009-03-10 ~ 2009-03-10
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketMoveNProtectReqAuthData(MSG_FC_MOVE_NPROTECT_REQ_AUTH_DATA* pMsg)
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR)	
	//DbgOut("FieldSocketMoveNProtectReqAuthData \n");

	GG_AUTH_DATA AuthData;
	memcpy(&AuthData, (PVOID)pMsg->reqAuthData, sizeof(GG_AUTH_DATA));
	m_pNpgl->Auth2(&AuthData);
#endif
}
// 2015-01-07 by jwLee 게임포지 nProtector 적용
void CAtumApplication::FieldSocketMoveNProtectNewReqAuthData(MSG_FC_MOVE_NPROTECT_NEW_REQ_AUTH_DATA* pMsg)
{
#if defined(DEFINE_USE_GAMEGUARD_NPROTECTOR_AUTH3)	
	if(m_pNpAuth3Data == NULL)
	{
		m_pNpAuth3Data = new BYTE[4400];
		memset(m_pNpAuth3Data,0x00, 4400);
		m_pNpAuth3DataCnt = 0;
	}
	if (m_pNpAuth3DataCnt < 11)
	{
		memcpy(m_pNpAuth3Data + (400 * m_pNpAuth3DataCnt), pMsg->reqAuthData, MAX_PACKET_SIZE_FOR_NPROTECT_NEW);
		m_pNpAuth3DataCnt++;
	}
	if ( pMsg->datasize)
	{
		CSAuth3Data Auth3Data;
		memcpy(&Auth3Data.bPacket, (PVOID)m_pNpAuth3Data, pMsg->datasize);
		m_pNpgl->Auth3(Auth3Data.bPacket,pMsg->datasize,0);

		delete[] m_pNpAuth3Data;
		m_pNpAuth3Data = NULL;
		m_pNpAuth3DataCnt = 0;
	}
#endif
}
// end 2015-01-07 by jwLee 게임포지 nProtector 적용
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
void CAtumApplication::FieldSocketMoveXTrapReqStep(MSG_FC_MOVE_XTRAP_REQ_STEP* pMsg)
{	
 	MSG_FC_MOVE_XTRAP_REQ_STEP_OK sMsg;
 	memset(&sMsg, 0x00, sizeof(MSG_FC_MOVE_XTRAP_REQ_STEP_OK));

#if defined(DEFINE_USE_GAMEGUARD_XTRAP)	 	
	XTrap_CS_Step2((LPCVOID)pMsg->reqCSStepData, (LPVOID)sMsg.resCSStepData, XTRAP_PROTECT_PE | XTRAP_PROTECT_TEXT | XTRAP_PROTECT_EXCEPT_VIRUS);
#endif 
	m_pFieldWinSocket->SendMsg( T_FC_MOVE_XTRAP_REQ_STEP_OK, (char*)&sMsg, sizeof(sMsg) );	
}
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)

// 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업
void	CAtumApplication::FieldSocketApexReqApexData( MSG_FC_MOVE_APEX_REQ_APEXDATA* pMsg )
{
	#if defined( DEFINE_USE_GAMEGUARD_APEX )
	switch( pMsg->cMsgType )
	{
	case SECURITY_APEX_Cmd_ApexData:
		if( m_pApexfp_rec )
			m_pApexfp_rec( pMsg->szApexData, pMsg->nApexDataLen );
		break;
	}
	#endif
}
// end 2009. 11. 03 by ckPark 태국 APEX 게임가드 작업

// 2009. 10. 14 by jskim 프리스카 제거 
void CAtumApplication::FieldSocketCharacterChangeStart(MSG_FC_CHARACTER_CHANGE_START_CITY_MAPINDEX_OK* pMsg)
{
	g_pInterface->m_pSelect->GameStart(pMsg->nStartCityMapIdx);
}
//end 2009. 10. 14 by jskim 프리스카 제거 
// 2009. 11. 3 by jskim 캐쉬(인벤/창고 확장) 아이템 추가 구현
void CAtumApplication::FieldSocketChangeAddedInventoryCount(MSG_FC_CHARACTER_CHANGE_ADDED_INVENTORY_COUNT* pMsg)
{
	// 2009. 12. 17 by jskim 캐쉬(인벤/창고 확장) 재수정
// 	CHARACTER* pMainInfo = g_pD3dApp->GetMFSMyShuttleInfo();
// 	pMainInfo->RacingPoint = pMsg->nRacingPoint;
// 	
// 	// 게임정보를 다시 갱신 
// 	SetMyShuttleInfo(pMainInfo);
	g_pShuttleChild->m_myShuttleInfo.RacingPoint = pMsg->nRacingPoint;
	//end 2009. 12. 17 by jskim 캐쉬(인벤/창고 확장) 재수정
}
//end 2009. 11. 3 by jskim 캐쉬(인벤/창고 확장) 아이템 추가 구현
// 2010. 03. 18 by jskim 몬스터변신 카드
void CAtumApplication::FieldSocketItemUpdateTransformerOk(MSG_FC_ITEM_UPDATE_TRANSFORMER_OK* pMsg)
{
	if(g_pShuttleChild->m_myShuttleInfo.ClientIndex == pMsg->ClientIdx)
	{
		g_pShuttleChild->SetMonsterTransformer(pMsg->MonsterUnitKind);
 		ITEM *temp = g_pDatabase->GetServerMonsterTransItemInfo(pMsg->MonsterUnitKind);
  		if(temp)
 			g_pShuttleChild->SetMonsterTransScale(temp->AbilityMin);

		CItemInfo* pInfo;
 		pInfo = g_pShuttleChild->m_pStoreData->FindItemInInventoryByWindowPos(POS_CENTER);
		if(pInfo)
		{ 			
			g_pShuttleChild->m_pStoreData->UpdateWearItemData(pInfo);
		}
	}	
	else
	{	
		CMapEnemyIterator itEnemy = m_pScene->m_mapEnemyList.find(pMsg->ClientIdx);
		if(itEnemy->second)
		{
 			itEnemy->second->SetMonsterTransformer(pMsg->MonsterUnitKind);
 			ITEM *temp = g_pDatabase->GetServerMonsterTransItemInfo(pMsg->MonsterUnitKind);
 			if(temp)
				itEnemy->second->SetMonsterTransScale(temp->AbilityMin);		

			itEnemy->second->ChangeItemPoint( POS_CENTER,itEnemy->second->m_infoCharacter.CharacterRenderInfo.RI_Center, 
										itEnemy->second->m_infoCharacter.CharacterRenderInfo.RI_Center_ShapeItemNum, 0 );
		}
	}
}
//end 2010. 03. 18 by jskim 몬스터변신 카드
// 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼
void CAtumApplication::FieldSocketCharacterKillCount(MSG_FC_CHARACTER_KILLCOUNT* pMsg)
{
	if(g_pGameMain)
	{
		g_pGameMain->SetKillCount(pMsg->nCount);
	}
}
void CAtumApplication::FieldSocketCharacterRestCount(MSG_FC_CHARACTER_RESTCOUNT* pMsg)
{
	if(g_pGameMain)
	{
		g_pGameMain->SetKillCount(pMsg->nKillCount);
		g_pGameMain->SetRestCount(pMsg->nRestCount);
	}
}
void CAtumApplication::FieldSocketCharacterBonusExpRate(MSG_FC_CHARACTER_BONUS_EXP_RATE* pMsg)
{
	if(g_pGameMain)
	{
		g_pGameMain->SetBonusExpRate(pMsg->nPartyRate,pMsg->nFriendRate,pMsg->nGuildRate);
		
	}
}
// end 2012-10-12 by jhjang 해피 아워 경험치 보너스 시스템 리뉴얼
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		현재 시간 리턴 
/// \author		// 2009-03-16 by bhsohn A기어 포대 방향 프로토콜 최소화
/// \date		2009-03-16 ~ 2009-03-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
DWORD CAtumApplication::GetCurrentGameTime()
{
	return m_dwLastestTickTime;
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-04-01 by bhsohn 세력 불균형, 세력 초기화 시스템
/// \date		2009-04-01 ~ 2009-04-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketQuestInserQuest(MSG_FC_QUEST_INSERT_QUEST* pMsg)
{
	MEX_QUEST_INFO* pCharacterQuest = g_pQuestData->FindCharacterQuest(pMsg->QuestIndex);
	if(!pCharacterQuest)
	{
		pCharacterQuest = new MEX_QUEST_INFO;
		memset(pCharacterQuest, 0x00, sizeof(MEX_QUEST_INFO));
		pCharacterQuest->QuestIndex = pMsg->QuestIndex;
		pCharacterQuest->QuestState = pMsg->QuestState;
		pCharacterQuest->QuestPlayTimeStamp = 0;
		memset(pCharacterQuest->szCityWarServerGroupName,0x00, SIZE_MAX_SERVER_NAME);

		g_pQuestData->AddCharacterQuest(pCharacterQuest->QuestIndex, pCharacterQuest);
	}

}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2009-04-01 by bhsohn 세력 불균형, 세력 초기화 시스템
/// \date		2009-04-01 ~ 2009-04-01
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketQuestDeleteQuest(MSG_FC_QUEST_DELETE_QUEST* pMsg)
{
	MEX_QUEST_INFO* pCharacterQuest = g_pQuestData->FindCharacterQuest(pMsg->QuestIndex);
	if(pCharacterQuest)
	{	
		g_pQuestData->DeleteCharacterQuest(pMsg->QuestIndex);
	}
}

// 2010. 06. 08 by jskim 홈프리미엄 프로토콜 처리
void CAtumApplication::FieldSocketHomePremium(MSG_FC_ITEM_HOMEPREMIUM_INFO* pMsg)
{
	g_pGameMain->m_pUnitInfoBar->SetHappyHourEventIconPos();
	g_pGameMain->m_pUnitInfoBar->m_pMemberPremiumEvent = pMsg->bUse;
}
//end 2010. 06. 08 by jskim 홈프리미엄 프로토콜 처리

// 2010-06-15 by shcho&hslee 펫시스템 - 프로토콜 처리
void CAtumApplication::FieldSocketCurrentPetBaseData(MSG_FC_ITEM_PET_BASEDATA* pMsg)
{
	g_pShuttleChild->PutPetInfo ( pMsg );
}
//2011-10-06 by jhahn 파트너 성장형 시스템
// void CAtumApplication::FieldSocketCurrentPetSkillData(MSG_FC_ITEM_PET_SKILLDATA* pMsg)
// {
// 		
// }
// void CAtumApplication::FieldSocketCurrentPetSocketData(MSG_FC_ITEM_PET_SOCKETDATA* pMsg)
// {
// 		
// }									  
//end 2011-10-06 by jhahn 파트너 성장형 시스템
// End 2010-06-15 by shcho&hslee 펫시스템 - 프로토콜 처리

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		아이템 먹었을시, 스트링을 여기다 추가하자
/// \author		// 2009-04-21 by bhsohn 인벤에 아이템 이벤트 지급시 메시지창 안찍히는 문제해결
/// \date		2009-04-21 ~ 2009-04-21
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::TradeUpdateItemAddChat(MSG_FC_TRADE_UPDATE_ITEM_COUNT* pMsg)
{
	switch(pMsg->ItemUpdateType)
	{
	case IUT_GIVEEVENTITEM:
		{
			char buff[128] = {0,};
			CItemInfo* pItemInfoInven = g_pStoreData->FindItemInInventoryByUniqueNumber( pMsg->ItemUniqueNumber);					
			if(pItemInfoInven && (pMsg->ItemUniqueNumber != g_pGameMain->m_pInven->GetItemSpiUniqueNumber()))
			{
				int nCount = pMsg->NewCount - pItemInfoInven->CurrentCount;						
				if(IS_COUNTABLE_ITEM(pItemInfoInven->ItemInfo->Kind))
				{
					wsprintf(buff,STRMSG_C_060904_0100,pItemInfoInven->ItemInfo->ItemName,
						nCount);
				}
				else
				{
					wsprintf(buff,STRMSG_C_060904_0100,pItemInfoInven->ItemInfo->ItemName,1);
				}
				// 2013-04-08 by jhseol, 이벤트 아이템 지급 알림방법 변경
#ifdef C_ITEM_EVENT_NOTIFY_MSG_CHANGE_JHSEOL
				if(g_pInterface != NULL &&
					g_pInterface->m_pGameMain != NULL)
				{
					CINFGameMainUnitInfoBar* pInfoBar = g_pInterface->m_pGameMain->m_pUnitInfoBar;
					if(pInfoBar == NULL)
						break;
					pInfoBar->AddGiftMsg(0,m_pShuttleChild->GetCharacterUniqueNumber(),buff);
				}
#else
				m_pChat->CreateChatChild(buff, COLOR_ITEM);
#endif
				// end 2013-04-08 by jhseol, 이벤트 아이템 지급 알림방법 변경
			}
			else if((NULL == pItemInfoInven) && (pMsg->ItemUniqueNumber == g_pGameMain->m_pInven->GetItemSpiUniqueNumber()))
			{
				// SPI지급
				int nUpdateSPI = pMsg->NewCount - g_pGameMain->m_pInven->GetItemSpi();				
				if(nUpdateSPI > 0)
				{
					wsprintf(buff,STRMSG_C_ITEM_0002,nUpdateSPI);
					m_pChat->CreateChatChild(buff, COLOR_ITEM);		
				}
			}
		}
		break;
	}
}
	// 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)
void CAtumApplication::TickGetCheckGameGuardXTrap()
{
#if defined(DEFINE_USE_GAMEGUARD_XTRAP)
	m_fXTrapHackCheckTime -= GetCheckElapsedTime();
	if(m_fXTrapHackCheckTime >=0 )
	{
		return;
	}
	m_fXTrapHackCheckTime = GAME_GUARD_XTRAP_CHECK_TIME;
	// 2009. 10. 12 by jskim 게임가드 XTRAP 수정
	//XTrap_C_CallbackAlive(NULL);	
	XTrap_C_CallbackAlive( GAME_GUARD_XTRAP_CHECK_TIME * TIME_MOVE_CAP);
	//end 2009. 10. 12 by jskim 게임가드 XTRAP 수정
#endif	
}
	//end 2009. 09. 21 by jskim 게임가드 XTRAP 적용(배트남)

// 2009. 11. 23 by jskim 리소스 로딩 구조 변경
void CAtumApplication::LoadMeshPorcess()
{
	EnterCriticalSection(&m_cs);
	// 현재 로딩 중인 데이터

     if( !ObjectLoadingTimeChack() || IsEmptyLoadingGameDataList() && m_pLoadingGameData == NULL)
	{
		LeaveCriticalSection(&m_cs);
		return;
	}	
	if(m_pLoadingGameData == NULL)
	{
		m_pLoadingGameData = vecFrontGameData();

		if( m_pLoadingGameData->Step == _RESOURCE_LOADING_START )
		{
			DeleteIsLoadingGameData(m_pLoadingGameData);
		}
	}		
		
	if(NULL == m_pLoadingGameData)
	{
		LeaveCriticalSection(&m_cs);
		return;
	}
	m_pLoadingGameData->pSkinnedMesh->LoadMeshHierarchyFromMemLoadStart( m_pLoadingGameData, m_pLoadingGameData->MeshIndex);
	if(m_pLoadingGameData->Step == _RESOURCE_LOADING_END)
	{	
		m_pLoadingGameData->pSkinnedMesh->SetIsLoadingFlag( FALSE );
		m_pLoadingGameData->pSkinnedMesh->m_nRenderCount = 2;		
		SAFE_DELETE( m_pLoadingGameData->pGameData );
		SAFE_DELETE( m_pLoadingGameData );
		m_pLoadingGameData = NULL;
	}	
	LeaveCriticalSection(&m_cs);
}

BOOL CAtumApplication::ObjectLoadingTimeChack()
{
	DWORD dwTime = timeGetTime();
	if(dwTime - m_dwTimeCheck < LOAD_TIME_CHECK)		
	{		
		m_dwTimeCheck = dwTime;
		return FALSE;
	}	
	else
	{
		m_dwTimeCheck = dwTime;
		return TRUE;
	}	
}

structLoadingGameData* CAtumApplication::vecFrontGameData()
{
	if(m_vecLoadingGameData.empty())
	{
		return NULL;
	}

	return m_vecLoadingGameData.front();
}

struct find_if_structLoadingGameData_By_structLoadingGameData
{
	find_if_structLoadingGameData_By_structLoadingGameData(structLoadingGameData *i_pstructLoadingGameData):m_pstructLoadingGameData(i_pstructLoadingGameData){};	
	bool operator()(structLoadingGameData *i_pstructLoadingGameData)
	{
		return i_pstructLoadingGameData == m_pstructLoadingGameData;
	};	
	structLoadingGameData *m_pstructLoadingGameData;
};

void CAtumApplication::DeleteIsLoadingGameData(structLoadingGameData* nGameData )
{
	vector<structLoadingGameData*>::iterator it = find_if(m_vecLoadingGameData.begin(), m_vecLoadingGameData.end(), find_if_structLoadingGameData_By_structLoadingGameData(nGameData));
	m_vecLoadingGameData.erase(it);
}

BOOL CAtumApplication::IsEmptyLoadingGameDataList()
{
	return m_vecLoadingGameData.empty();
}

void CAtumApplication::vecPushBackGameData(structLoadingGameData* nGameData)
{
	m_vecLoadingGameData.push_back( nGameData );	
}

struct sort_LoadingGameData
{
	bool operator()(structLoadingGameData* op1, structLoadingGameData* op2)
	{
		return op1->LoadingPriority < op2->LoadingPriority;
	}
};	

void CAtumApplication::vecPushGameData(structLoadingGameData* i_pGameData)
{	
	vecPushBackGameData( i_pGameData );	
	LoadingGameDataSort();
}

void CAtumApplication::LoadingGameDataSort()
{
	sort( m_vecLoadingGameData.begin(), m_vecLoadingGameData.end(), sort_LoadingGameData() );
}
 
struct find_if_structLoadingGameData_By_CSkinnedMesh
{
	find_if_structLoadingGameData_By_CSkinnedMesh(CSkinnedMesh *i_pSkinnedMesh):m_pSkinnedMesh(i_pSkinnedMesh){};	
	bool operator()(structLoadingGameData *i_pLoadingData)
	{
		return i_pLoadingData->pSkinnedMesh == m_pSkinnedMesh;
	};

	CSkinnedMesh *m_pSkinnedMesh;
};
BOOL CAtumApplication::DeleteLoadingGameData(CSkinnedMesh *i_pSkinnedMesh)
{
	vector<structLoadingGameData*>::iterator it = find_if(m_vecLoadingGameData.begin(), m_vecLoadingGameData.end(), find_if_structLoadingGameData_By_CSkinnedMesh(i_pSkinnedMesh));
	if(it == m_vecLoadingGameData.end())
	{
		return FALSE;
	}
	m_vecLoadingGameData.erase(it);
	return TRUE;
}
//end 2009. 11. 23 by jskim 리소스 로딩 구조 변경

// 2012-01-05 by jhahn 동영상 플레이
//-----------------------------------------------------------------------------
// InitDShowTextureRenderer : Create DirectShow filter graph and run the graph
//-----------------------------------------------------------------------------
HRESULT CAtumApplication::InitDShowTextureRenderer()
{
    HRESULT hr = S_OK;
    CComPtr<IBaseFilter>    pFSrc;          // Source Filter
    CComPtr<IPin>           pFSrcPinOut;    // Source Filter Output Pin   
    CTextureRenderer        *pCTR=0;        // DirectShow Texture renderer
    
    // Create the filter graph
    if (FAILED(g_pGB.CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC)))
        return E_FAIL;
	
	
    // Register the graph in the Running Object Table (for debug purposes)
	
	AddToROT(g_pGB);
	
    
	// Create the Texture Renderer object
    pCTR = new CTextureRenderer(NULL, &hr);
	if (FAILED(hr) || !pCTR)
	{
		return E_FAIL;
	}
		     
	// Get a pointer to the IBaseFilter on the TextureRenderer, add it to graph
	g_pRenderer = pCTR;
	if (FAILED(hr = g_pGB->AddFilter(g_pRenderer, L"TEXTURERENDERER")))
	{
		return hr;
	}
	
	// Determine the file to load based on DirectX Media path (from SDK)
	// Use a helper function included in DXUtils.cpp

	

	hr = g_pGB->AddSourceFilter (L"Opening.dat\0", L"SOURCE", &pFSrc);
	if (pFSrc == NULL)
	{
	
		return hr;
	}
    // If the media file was not found, inform the user.
    if (hr == VFW_E_NOT_FOUND)
    {
        return hr;
    }
    else if(FAILED(hr))
    {
		
        return hr;
    }
	
	if (FAILED(hr = pFSrc->FindPin(L"Output", &pFSrcPinOut)))
	{ 
		return hr;
	}
	
	if (FAILED(hr = g_pGB->Render(pFSrcPinOut)))
	{		
		return hr;
	}
	
	// Get the graph's media control, event & position interfaces
    g_pGB.QueryInterface(&g_pMC);
    g_pGB.QueryInterface(&g_pMP);
    g_pGB.QueryInterface(&g_pME);
	
	
	
    return S_OK;
}
HRESULT CAtumApplication::MovieRender()
{
	HRESULT hr;

	// Start the graph running;
     if (FAILED(hr = g_pMC->Run()))
     {
         return hr;
     }
	return S_FALSE;
}
//-----------------------------------------------------------------------------
// CheckMovieStatus: If the movie has ended, rewind to beginning
//-----------------------------------------------------------------------------
HRESULT CAtumApplication::CheckMovieStatus(void)
{
    long lEventCode;
    long lParam1;
    long lParam2;
    HRESULT hr;

    if (!g_pME)
        return S_FALSE;
        
    // Check for completion events
    hr = g_pME->GetEvent(&lEventCode, (LONG_PTR *) &lParam1, (LONG_PTR *) &lParam2, 0);
    if (SUCCEEDED(hr))
    {
        // If we have reached the end of the media file, reset to beginning
        if (EC_COMPLETE == lEventCode) 
        {
            hr = g_pMP->put_CurrentPosition(0);
			g_pMC->Stop();			
			return S_FALSE;			
        }

        // Free any memory associated with this event
        hr = g_pME->FreeEventParams(lEventCode, lParam1, lParam2);
		
    }
	return S_OK;
}

//-----------------------------------------------------------------------------
// Running Object Table functions: Used to debug. By registering the graph
// in the running object table, GraphEdit is able to connect to the running
// graph. This code should be removed before the application is shipped in
// order to avoid third parties from spying on your graph.
//-----------------------------------------------------------------------------


HRESULT CAtumApplication::AddToROT(IUnknown *pUnkGraph) 
{
	DWORD dwROTReg = 0xfedcba98;
    IMoniker * pmk;
    IRunningObjectTable *pROT;
    if (FAILED(GetRunningObjectTable(0, &pROT)))
	{
        return E_FAIL;
    }
	
    WCHAR wsz[256];
    wsprintfW(wsz, L"FilterGraph %08x  pid %08x\0", (DWORD_PTR) 0, GetCurrentProcessId());
	
    HRESULT hr = CreateItemMoniker(L"!", wsz, &pmk);
    if (SUCCEEDED(hr)) 
    {
        // Use the ROTFLAGS_REGISTRATIONKEEPSALIVE to ensure a strong reference
        // to the object.  Using this flag will cause the object to remain
        // registered until it is explicitly revoked with the Revoke() method.
        //
        // Not using this flag means that if GraphEdit remotely connects
        // to this graph and then GraphEdit exits, this object registration 
        // will be deleted, causing future attempts by GraphEdit to fail until
        // this application is restarted or until the graph is registered again.
        hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, pUnkGraph, 
			pmk, &dwROTReg);
        pmk->Release();
    }
	
    pROT->Release();
    return hr;
}


void CAtumApplication::RemoveFromROT(void)
{
	DWORD dwROTReg = 0xfedcba98;
    IRunningObjectTable *pirot=0;
	
    if (SUCCEEDED(GetRunningObjectTable(0, &pirot))) 
    {
        pirot->Revoke(dwROTReg);
        pirot->Release();
    }
}

//-----------------------------------------------------------------------------
// CleanupDShow
//-----------------------------------------------------------------------------
void CAtumApplication::CleanupDShow(void)
{

    // Pull graph from Running Object Table (Debug)
    RemoveFromROT();


    // Shut down the graph
    if (!(!g_pMC)) g_pMC->Stop();

    if (!(!g_pMC)) g_pMC.Release();
    if (!(!g_pME)) g_pME.Release();
    if (!(!g_pMP)) g_pMP.Release();
    if (!(!g_pGB)) g_pGB.Release();
    if (!(!g_pRenderer)) g_pRenderer.Release();
}	 

//end 2012-01-05 by jhahn 동영상 플레이
// 2012-07-17 by jhahn, 셧다운 시간 표시
VOID CAtumApplication::ShotDownGameTime()
{
#ifdef SC_SHUT_DOWNMIN_JHAHN


	if (FristSeting == FALSE)
	{
	
		nOldTime = timeGetTime() / 1000;
		FristSeting = TRUE;
	}

	nNewTime = timeGetTime() / 1000;

	
	int ShutDownTime = (nNewTime - nOldTime) / 3600;
	

	if (ShutDownTime == nCount)
	{

		char buf[256];
		
		wsprintf(buf, "회원님은 게임을 시작한지 %d시간이 지났습니다.", nCount);
		m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
		nCount++;
		
		wsprintf(buf, "과도한 게임이용은 정상적인 일상 생활에 지장을 줄 수 있습니다.");
		m_pChat->CreateChatChild(buf,COLOR_SYSTEM);
		

	}
#endif
}

//end 2012-07-17 by jhahn, 셧다운 시간 표시

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		NPlay PC방 모듈
/// \author		// 2012-10-16 by bhsohn NPlay PC방 모듈
/// \date		2012-10-16 ~ 2012-10-16
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCharacterPCBangPremiumApply(MSG_FC_CHARACTER_PCBANG_PREMIUN_APPLY* pMsg)
{	
	//가맹 PC방인지 체크.
	if(g_pGameMain && g_pGameMain->m_pUnitInfoBar)
	{
		g_pGameMain->m_pUnitInfoBar->SetHappyHourEventIconPos();
		if(pMsg->PremiumApply)
		{
			g_pGameMain->m_pUnitInfoBar->m_bMemberPCBang = TRUE;		
		}
		else
		{			
			g_pGameMain->m_pUnitInfoBar->m_bMemberPCBang = FALSE;
		}

		FieldSocketInfoGetHappyHourEventInfoOk(TRUE, &pMsg->msg);
	}	
}
	
// 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정
int CAtumApplication::AddINFCnt()
{
	//인터페이스 창 중복 누적수를 더하고, 최종값을 계산하여 리턴
	m_nINFCnt++;
	return m_nINFCnt;
}
int CAtumApplication::RemoveINFCnt()
{
	//인터페이스 창 중복 누적수를 빼고, 최종값을 계산하여 리턴
	m_nINFCnt = max(m_nINFCnt--,0);
	return m_nINFCnt;
}
int CAtumApplication::GetINFCnt()
{
	//인터페이스 창 중복 누적수를 리턴
	return m_nINFCnt;
}
void CAtumApplication::SetINFCnt(int nINFCnt)
{
	//인터페이스 창 중복 누적수를 리턴
	m_nINFCnt = nINFCnt;
}
// end 2012-12-17 by jhjang 비행중 마우스 커서가 제대로 동작하지 않는 버그 수정

// 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
void CAtumApplication::SetItemNum(INT nItemNum)
{
	m_nItemNum = nItemNum;
}
// end 2012-11-29 by mspark, 서치아이 위치가 이동하는 캐릭터의 위치와 동일하도록 수정
	
// 2013-05-09 by ssjung 외형 변경 기간만료 경고 메시지 구현
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM
void CAtumApplication::LookChangeLimitTimeMSG()					
{
	char buffer[128] = {0,};
	wsprintf(buffer,STRMSG_C_130502_0001);
	m_pChat->CreateChatChild(buffer,COLOR_MONSTER_ID04);
}
#endif
// end 2013-05-09 by ssjung 외형 변경 기간만료 경고 메시지 구현

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2012-10-17 by bhsohn XignCode작업
/// \date		2012-10-17 ~ 2012-10-17
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CALLBACK OnProbeComplete(HANDLE CodeBox
							  , CPACKETDATA RPacket
							  , PACKETDATA Buffer
							  , SIZE_T BufferSize
							  , PVOID Context)
{
#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)	// 2012-10-22 by bhsohn Xigncode 디파인 빠져있는 부분 추가
	MSG_FC_CHARACTER_XIGNCODE_ACK_PACKET msg;
	memset(&msg, 0x00, sizeof(MSG_FC_CHARACTER_XIGNCODE_ACK_PACKET));			
	memcpy(msg.byXigndAckMsg, Buffer, XC_PACKET_SIZE);

//	DbgOut("OnProbeComplete  \n");

	g_pFieldWinSocket->SendMsg(T_FC_CHARACTER_XIGNCODE_C_ACK_PACKET, (char*)&msg, sizeof(MSG_FC_CHARACTER_XIGNCODE_ACK_PACKET)); 
#endif
}

void CAtumApplication::FieldSocketCharacterXignCodeAckPacket(MSG_FC_CHARACTER_XIGNCODE_ACK_PACKET* pMsg)
{
#if defined(DEFINE_USE_GAMEGUARD_XIGNCODE)	// 2012-10-22 by bhsohn Xigncode 디파인 빠져있는 부분 추가
	int nRetCode = ZCWAVE_ProbeEx((const char *) pMsg->byXigndAckMsg, XC_PACKET_SIZE, OnProbeComplete, NULL);

//	DbgOut("ZCWAVE_ProbeEx [%d] \n", nRetCode);
#endif
	
	
}
	
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2013-05-07 by bhsohn 웹캐쉬 상점 인증키 추가
/// \date		2013-05-07 ~ 2013-05-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketShopAuthKey(MSG_FC_SHOP_AUTH_KEY* pMsg)
{	
	DBGOUT("MSG_FC_SHOP_AUTH_KEY[%s] \n", pMsg->AuthenticationKey);
	SetAuthenticationKey(pMsg->AuthenticationKey);	
	
	CINFCityCashShop* pCityCash = NULL; 
	CMapCityShopIterator it = g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_CASH_SHOP); 
	if(it != g_pInterface->m_pCityBase->m_mapCityShop.end()) 
	{ 
		pCityCash = ((CINFCityCashShop*)it->second);		 
	} 
	if(pCityCash == NULL) 
	{
		return; 
	}
	pCityCash->ShowMasangWebCashShop(GetAuthenticationKey(), pMsg->ServerID);
}

///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2013-05-07 by bhsohn 세력포인트 개선안 시스템
/// \date		2013-05-07 ~ 2013-05-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketWarInflConseVictites(MSG_FC_WAR_INFLUENCE_CONSECUTIVE_VICTORITES* pMsg)
{
	SetInflConVictorites(pMsg);
	DBGOUT("FieldSocketWarInflConseVictites PointBCU[%d] PointANI[%d] \n", pMsg->PointBCU, pMsg->PointANI);
	if(g_pScene)
	{
		g_pScene->UpdateInflBuffNPCObject();
	}	
	
	if(m_pChat && m_pShuttleChild && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
		char buffer[256] = {0,};		
		wsprintf(buffer,"MSG_FC_WAR_INFLUENCE_CONSECUTIVE_VICTORITES PointBCU[%d] PointANI[%d] \n", 
					pMsg->PointBCU, pMsg->PointANI);
		m_pChat->CreateChatChild(buffer,COLOR_SYSTEM);

	}

}

void CAtumApplication::FieldSocketShopInflBuffOk(MSG_FC_SHOP_INFLUENCE_BUFF_OK* pMsg)
{
	DBGOUT("FieldSocketShopInflBuffOk nLastSkillNum[%d] \n", pMsg->nLastSkillNum);
	if(m_pChat && m_pShuttleChild && COMPARE_RACE(m_pShuttleChild->m_myShuttleInfo.Race,RACE_OPERATION|RACE_GAMEMASTER))
	{
		char buffer[256] = {0,};		
		wsprintf(buffer,"MSG_FC_SHOP_INFLUENCE_BUFF_OK nConsecu[%d] \n", pMsg->nLastSkillNum);
		m_pChat->CreateChatChild(buffer,COLOR_SYSTEM);		
	}
	
}
// 2013-05-15 by ssjung 이달의 아머 - 이달의 아머 변경 사항 패킷 관련 
void CAtumApplication::FieldSocketStoreUpdateArmorItemEventInfo(MSG_FC_STORE_UPDATE_ARMOR_ITEM_EVENT_INFO* pMsg)
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM
	CItemInfo* pItemInfo = NULL;	
	pItemInfo = g_pStoreData->FindItemInInventoryByUniqueNumber(pMsg->ItemUID);
	if(pItemInfo)
	{
		pItemInfo->nMonthlyOptionItemNum = pMsg->nOptionItemNum;
		pItemInfo->atMonthlyEventEndDate = pMsg->atEndDate;
	}	

	CINFCityLab* pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
	if(pCityLab)
	{
		vector<CItemInfo*>  *pVecTarget = pCityLab->GetvecTarget();
		vector<CItemInfo*>::iterator it=pVecTarget->begin();

		for(; it!= pVecTarget->end(); it++)
		{
			CItemInfo* pTempItem = *(it);
			if(pTempItem)
			{
				if(pTempItem->GetUniqueNumber() == pMsg->ItemUID)
				{
					pTempItem->nMonthlyOptionItemNum = pMsg->nOptionItemNum;
					pTempItem->atMonthlyEventEndDate = pMsg->atEndDate;
				}
			}
		}
	}
#endif
}
// end 2013-05-15 by ssjung 이달의 아머 - 이달의 아머 변경 사항 패킷 관련 
///////////////////////////////////////////////////////////////////////////////
/// \fn			
/// \brief		
/// \author		// 2013-05-28 by bhsohn 아머 컬렉션 시스템
/// \date		2013-05-07 ~ 2013-05-07
/// \warning	
///
/// \param		
/// \return		
///////////////////////////////////////////////////////////////////////////////
void CAtumApplication::FieldSocketCollectionInfo(MSG_FC_COLLECTION_INFO* pMsg)
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM
	if(!g_pStoreData)
	{
		return;
	}
	g_pStoreData->SetArmorCollectInfo(pMsg);
#endif
}

void CAtumApplication::FieldSocketCollectionShapeChange(MSG_FC_COLLECTION_SHAPE_CHANGE* pMsg)
{

}

// 2013-06-14 by ssjung 아머 컬렉션 시스템 이달의 아머 
void CAtumApplication::FieldSocketCollectionMontylyAromorInit()
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM
	if(!g_pStoreData)
	{
		return;
	}
	g_pStoreData->SetMontylyArmorCollectInit();
#endif
}
void CAtumApplication::FieldSocketCollectionMontylyAromorInfo(MSG_FC_COLLECTION_MONTHLY_AROMOR_EVENT_INFO* pMsg)
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM
	if(!g_pStoreData)
	{
		return;
	}
	g_pStoreData->SetMontylyArmorCollectInfo(pMsg);
#endif
}
// end 2013-06-14 by ssjung 아머 컬렉션 시스템 이달의 아머 

// 2013-05-28 by bhsohn 아머 컬렉션 시스템
// 외형정보 갱신
void CAtumApplication::UpdateStoreShapeItemNum(MSG_FC_ITEM_CHANGED_SHAPEITEMNUM* pMsg )
{
	// 창고/길드창고 관리 처리
	if(m_pInterface && m_pInterface->m_pCityBase)
	{
		CINFCityStore* pStore = (CINFCityStore*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_STORE);
		if(pStore)
		{
			CItemInfo* pItemInfo = pStore->FindItemInfo( pMsg->nItemUID );
			if(pItemInfo)
			{
				pItemInfo->ShapeItemNum = pMsg->nShapeItemNum;				
				memcpy(&pItemInfo->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
				// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
			}			
		}
	}

	// 거래 관련 처리
	if(g_pGameMain && g_pGameMain->m_pTrade)
	{
		CItemInfo* pItemInfo = g_pGameMain->m_pTrade->FindTradeMyItem(pMsg->nItemUID);
		if(pItemInfo)
		{
			pItemInfo->ShapeItemNum = pMsg->nShapeItemNum;				
			memcpy(&pItemInfo->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
			// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
		}
	}
	// 팩토리
	if(m_pInterface && m_pInterface->m_pCityBase)
	{		
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_FACTORY);
		
		if(pCityLab) 
		{			
			CItemInfo*		pItemInfo	= pCityLab->FindItemFromSource( pMsg->nItemUID );
			if(pItemInfo)
			{
				pItemInfo->ShapeItemNum = pMsg->nShapeItemNum;				
				memcpy(&pItemInfo->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
				// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
			}
		}
	}
	
	// 	연구파트
	if(m_pInterface && m_pInterface->m_pCityBase)
	{		
		CINFCityLab * pCityLab = (CINFCityLab*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_LABORATORY);		
		if(pCityLab) 
		{			
			CItemInfo*		pItemInfo	= pCityLab->FindItemFromSource( pMsg->nItemUID );
			if(pItemInfo)
			{
				pItemInfo->ShapeItemNum = pMsg->nShapeItemNum;				
				memcpy(&pItemInfo->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
				// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
			}
		}
	}
	// 개인상점
	if(g_pInterface && g_pInterface->m_pBazaarShop)
	{		
		CItemInfo *	pItemInfo  = g_pInterface->m_pBazaarShop->GetShopItemInfo(pMsg->nItemUID );
		if(pItemInfo)
		{
			pItemInfo->ShapeItemNum = pMsg->nShapeItemNum;				
// 			pItemInfo->FixedTermShape.nStatShapeItemNum = pMsg->FixedTermShape.nStatShapeItemNum;				// 외변킷 아템 번호
// 			pItemInfo->FixedTermShape.nStatLevel = pMsg->FixedTermShape.nStatLevel;								// 레벨	
			memcpy(&pItemInfo->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
			// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
		}
	}

// 2013-11-29 by ssjung 거래소 구현
	//거래소 
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	if(m_pInterface && m_pInterface->m_pCityBase)
	{
		CINFTradeItemCenter* pStore = (CINFTradeItemCenter*)m_pInterface->m_pCityBase->FindBuildingShop(BUILDINGKIND_AUCTION);
		if(pStore)
		{
			CINFTradeItemAdd* pTradeAddView = ((CINFTradeItemAdd*)(pStore->GetCurrentView()));
			
			if(pTradeAddView && pTradeAddView->m_pSourceItem && pTradeAddView->m_pSourceItem->UniqueNumber == pMsg->nItemUID)
			{
				pTradeAddView->m_pSourceItem->ShapeItemNum = pMsg->nShapeItemNum;
				memcpy(&pTradeAddView->m_pSourceItem->FixedTermShape, &pMsg->FixedTermShape , sizeof(FIXED_TERM_INFO));
				// 2013-06-20 by ssjung 외형 정보가 변경 되어야 할때 모든 정보를 반영하도록 수정 
			}			
		}
	} 
#endif
// end 2013-11-29 by ssjung 거래소 구현
}
// END 2013-05-28 by bhsohn 아머 컬렉션 시스템

// 2013-06-26 by bhsohn 아머 컬렉션 추가 개발
void CAtumApplication::PopupUseRandomBoxOk(INT nResultItemNum0)	// 생성된 ItemNum
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM

	ITEM* pItem = g_pDatabase->GetServerItemInfo( nResultItemNum0 );
	if(!pItem || !g_pInterface)
	{
		return;
	}	

	{
		char* pUserId = g_pD3dApp->m_strUserID;
		
		char chOption[256];
		char chTxt[256];
		
		ZERO_MEMORY(chOption);
		ZERO_MEMORY(chTxt);
		sprintf(chOption, "%s_1", pUserId); 
		
		
		if(g_pInterface->GetSetupInfo(chOption, chTxt))
		{// 계정별로 한번띄우자	
			return;
		}
		sprintf(chTxt, "1");				// 계정별로 한번띄우자
		
		g_pInterface->SetSetupInfo(chOption, chTxt);
	}

	char strText[512] = {0,};	
	if(pItem->IsExistDesParam(DES_COLLECTION_ARMOR_INDEX))
	{
		sprintf(strText, STRMSG_C_130626_0101, pItem->ItemName);
		g_pGameMain->m_pInfWindow->AddMsgBox(strText, _MESSAGE, 0, 0, 0,0, NULL, TRUE);		
	}
#endif
}

void CAtumApplication::PopupGetCollectionInfo(INT nResultItemNum0)// 얻은 아머 컬렉션 정보
{
#ifdef SC_COLLECTION_ARMOR_JHSEOL_BCKIM


	ITEM* pItem = g_pDatabase->GetServerItemInfo( nResultItemNum0 );
	if(!pItem || !g_pInterface)
	{
		return;
	}	
	{
		char* pUserId = g_pD3dApp->m_strUserID;
		
		char chOption[256];
		char chTxt[256];
		
		ZERO_MEMORY(chOption);
		ZERO_MEMORY(chTxt);
		sprintf(chOption, "%s_2", pUserId); 
		
		
		if(g_pInterface->GetSetupInfo(chOption, chTxt))
		{// 계정별로 한번띄우자	
			return;
		}
		sprintf(chTxt, "1");				
		
		g_pInterface->SetSetupInfo(chOption, chTxt);
	}

	
	{
		char strTmp[4096] = {0,};	
		char strText[1024] = {0,};	
		ZERO_MEMORY(strTmp);
		ZERO_MEMORY(strText);

		sprintf(strTmp, STRMSG_C_130626_0102, pItem->ItemName);
		strncpy(strText, strTmp, 1023);		

		g_pGameMain->m_pInfWindow->AddMsgBox(strText, _MESSAGE, 0, 0, 0,0, NULL, TRUE);		
	}
#endif
}
// 2013-08-02 by ssjung 역전의 버프 툴팁표시
void CAtumApplication::FieldSocketWarInfluenceConsecutivePoint(MSG_FC_WAR_INFLUENCE_CONSECUTIVE_POINT* pMsg)
{
	m_fPVPBuffPercent = pMsg->PVPBuffPercent;
}
// end 2013-08-02 by ssjung 역전의 버프 툴팁표시	

// 2014-06-18 by ymjoo 화면 상단에 세력 표시
void CAtumApplication::FieldSocketInfluenceShowInfo(MSG_FC_INFLUENCE_SHOW_INFO *pMsg)
{
	if(pMsg->TurnAroundPoint < -PVP_BUFF_MIN_PERCENT)
	{
		m_SuperiorInfluenceType = INFLUENCE_TYPE_VCN;
	}
	else if(PVP_BUFF_MIN_PERCENT < pMsg->TurnAroundPoint)
	{
		m_SuperiorInfluenceType = INFLUENCE_TYPE_ANI;
	}
	else
	{
		m_SuperiorInfluenceType = NULL;
	}
}
// END 2014-06-18 by ymjoo 화면 상단에 세력 표시

// 2013-08-28 by ssjung 거점전 리뉴얼(NGC)
void CAtumApplication::FieldSocketNGCWarDisplay(MSG_NGCSPWAR_DISPLAY* pMsg)
{
#ifdef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG
	if(!g_pGameMain && g_pInterface)
		return;

	if(pMsg->State == NGCSP_START)
	{
		BOOL bPopUp = FALSE;
		char chTime[128];
		char buf[256];
		memset(chTime, 0x00, 128);
		memset(buf, 0x00, 256);
		ATUM_DATE_TIME curServerTime = GetServerDateTime();
		
		ATUM_DATE_TIME curEndTime = pMsg->StartTime; //(*pSummonMonsterTime);	
		curEndTime.AddDateTime(0, 0, 0, WAR_MONSTER_LIVETIME_HOUR, 0, 0);	
		
		int nSecondRemainMonster = curEndTime.GetTimeInSeconds() - curServerTime.GetTimeInSeconds();
		if(nSecondRemainMonster < 0)
		{
			return;
		}

		int nWarMonsterLive = (3600*WAR_MONSTER_LIVETIME_HOUR);
		if(nSecondRemainMonster > nWarMonsterLive)
		{
			nSecondRemainMonster = nWarMonsterLive;
		}

		MAP_INFO* pMapinfo = g_pDatabase->GetMapInfo(pMsg->MapIndex);
		wsprintf(buf, STRMSG_C_061121_0000, STRMSG_C_130828_0001, pMapinfo->MapName);	// "\\c%s측\\c %s 지역에 전략 포인트가 생성되었습니다."
		m_pChat->CreateChatChild(buf, COLOR_ITEM);

		g_pInterface->NGCBaseWarOp(buf, nSecondRemainMonster);
		g_pGameMain->AddBaseWarInfo(pMsg->MapIndex,nSecondRemainMonster,MAP_INFLUENCE_NEUTRALITY);
		
		(nSecondRemainMonster > WAR_MONSTER_WARNING_TIME) ? bPopUp = TRUE : bPopUp = FALSE;
		g_pGameMain->SetNgcBaseWarInfo(pMsg, bPopUp);
	}
	else if(pMsg->State == NGCSP_PLAYING)
	{
		g_pGameMain->SetNgcBaseWarInfo(pMsg);
	}
	else if(pMsg->State == NGCSP_FINISHED)
	{
		g_pGameMain->DestroyBaseWarInfo(pMsg->MapIndex, MAP_INFLUENCE_NEUTRALITY);
	}
#endif
}	
// end 2013-08-28 by ssjung 거점전 리뉴얼(NGC)

// 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경
void CAtumApplication::FieldSocketChracterPayContributionPoint(MSG_FC_CHARACTER_PAY_CONTRIBUTIONPOINT* pMsg)
{
#ifdef SC_STRATEGYPOINTWAR_RENEWAL_JHSEOL_SSJUNG
	char buff[1024];
	ZERO_MEMORY(buff);		
	if(0 < pMsg->AddPoint)
	{	
		wsprintf(buff, STRMSG_C_061121_0002, pMsg->AddPoint);	// "세력 포인트 %d점이 추가 되었습니다."			
	}
	m_pChat->CreateChatChild(buff, COLOR_CHAT_GUILD);
#endif
}
// end 2013-10-10 by ssjung, 거점전 리뉴얼 - 세력포인트 비율 변경

// 2013-11-29 by ssjung 거래소 구현
void CAtumApplication::FieldSocketMarketRegOK(MSG_FC_MARKET_SELL_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemAdd* pTradeAddView = ((CINFTradeItemAdd*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeAddView->ADDItemOk(pMsg->ItemUID);
#endif
}
void CAtumApplication::FieldSocketMarketBuyOK(MSG_FC_MARKET_BUY_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemButOk(pMsg->MarketUID);
#endif
}
void CAtumApplication::FieldSocketMarkeBaseHeader(MSG_FC_MARKET_BASE_INFO_HEAD* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	((CINFTradeItemCenter*)pINFbase)->SetSellingTime(pMsg->nSellingTime);
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketMarketBaseOK(MSG_FC_MARKET_BASE_INFO_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarketBaseDone(MSG_FC_MARKET_BASE_INFO_DONE* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemBuyBaseDone(pMsg,TIMETITLE);
#endif
}
void CAtumApplication::FieldSocketMarkeMyListHeader()
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeMyItemShow* pTradeMyitemView = ((CINFTradeMyItemShow*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeMyitemView->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketMarketListOK(MSG_FC_MARKET_MY_LIST_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeMyItemShow* pTradeMyitemView = ((CINFTradeMyItemShow*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeMyitemView->MyItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarketListOKDone(MSG_FC_MARKET_MY_LIST_DONE* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeMyItemShow* pTradeMyitemView = ((CINFTradeMyItemShow*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeMyitemView->SetMyListCount(pMsg->MyListItemCount);
#endif
}

void CAtumApplication::FieldSocketMarketGetOk(MSG_FC_MARKET_GET_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeMyItemShow* pTradeMyitemView = ((CINFTradeMyItemShow*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeMyitemView->MarketGetOk(pMsg);
#endif
}

void CAtumApplication::FieldSocketMarketPaginHeader()
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketMarketPaginOK(MSG_FC_MARKET_PAGING_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarketPaginDone(MSG_FC_MARKET_PAGING_DONE* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemBuyBaseDone(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarkeSerchHeader()
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketMarkeSerchOK(MSG_FC_MARKET_SEARCH_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarkeSerchDone(MSG_FC_MARKET_SEARCH_DONE* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemBuyBaseDone(pMsg, MONEYTITLE);
#endif
}
void CAtumApplication::FieldSocketMarkeSortHeader()
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketMarkeSortOK(MSG_FC_MARKET_SORT_OK* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketMarkeSortDone(MSG_FC_MARKET_SORT_DONE* pMsg)
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_AUCTION];
	CINFTradeItemBuy* pTradeBuyView = ((CINFTradeItemBuy*)((CINFTradeItemCenter*)pINFbase)->GetCurrentView());
	pTradeBuyView->ItemBuyBaseDone(pMsg);
#endif
}

void CAtumApplication::TradeItemCenterLockFree()
{
#ifdef SC_MARKET_JHSEOL_BCKIM_SSJUNG
	if(m_bTradeCenterLock)
	{
		m_bRequestEnable = TRUE;
		m_bTradeCenterLock = FALSE;
	}
#endif
}
// end 2013-11-29 by ssjung 거래소 구현

// 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정
void CAtumApplication::CityShopLock(BOOL bState)
{
	m_bCityShopLock = bState;
}
// END 2014-07-04 by ymjoo 상점 아이템이 여러번 구입되는 현상 수정

// 2014-01-15 by ssjung 파괴 경매장 구현
void CAtumApplication:: FieldSocketDestroyAuctionBaseHeader(MSG_FC_DESTROY_AUCTION_BASE_INFO_HEADER* pMsg)
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	((CINFReturnAuctionCenter*)pINFbase)->VecItemInfoClear(pMsg);
#endif
}
void CAtumApplication::FieldSocketDestroyAuctionBaseOk(MSG_FC_DESTROY_AUCTION_BASE_INFO_OK* pMsg)
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	((CINFReturnAuctionCenter*)pINFbase)->ItemVecAdd(pMsg);
	CINFReturnAuctionList* pAuctionList = ((CINFReturnAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_AUCTION_LIST]);
 	pAuctionList->SortList();
#endif
}
void CAtumApplication::FieldSocketDestroyAuctionBaseDone()
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	CINFReturnAuctionList* pAuctionList = ((CINFReturnAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_AUCTION_LIST]);
	pAuctionList->ItemVecDone();
#endif
}

void CAtumApplication::FieldSocketDestroyAuctionTenderOk(MSG_FC_DESTROY_AUCTION_TENDER_OK* pMsg)
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	((CINFReturnAuctionCenter*)pINFbase)->UpdateDataInfo(pMsg);
	CINFReturnMyAuctionList* pMyAuctionList = ((CINFReturnMyAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_MY_AUCTION_LIST]);

	if(pMsg->CharacterUID == g_pD3dApp->m_pShuttleChild->m_myShuttleInfo.CharacterUniqueNumber)
	{
		pMyAuctionList->PushMyList(pMsg);
	}
	
	//입찰 카운트를 까야됨 
	//부모의 거에서 검색 한다음에 그걸 푸쉬 백 함 
	//바뀐 값으로 패킷을 받음 ??
#endif
}

void CAtumApplication::FieldSocketDestroyAuctionMyListHeader()
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	CINFReturnMyAuctionList* pMyAuctionList = ((CINFReturnMyAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_MY_AUCTION_LIST]);
	pMyAuctionList->VecItemInfoClear();
#endif
}
void CAtumApplication::FieldSocketDestroyAuctionMyListOk(MSG_FC_DESTROY_AUCTION_MY_LIST_OK* pMsg)
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	CINFReturnMyAuctionList* pMyAuctionList = ((CINFReturnMyAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_MY_AUCTION_LIST]);
 	pMyAuctionList->ItemVecAdd(pMsg);
#endif
}
void CAtumApplication::FieldSocketDestroyAuctionMyListDone()
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	CINFReturnMyAuctionList* pMyAuctionList = ((CINFReturnMyAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_MY_AUCTION_LIST]);
	pMyAuctionList->MyItemListDone();
#endif
}

void CAtumApplication::FieldSocketDestroyAuctionGetOk(MSG_FC_DESTROY_AUCTION_GET_OK* pMsg)
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CINFBase* pINFbase = g_pInterface->m_pCityBase->m_mapCityShop[BUILDINGKIND_DESTROY_AUCTION];
	CINFReturnMyAuctionList* pAuctionMyList = ((CINFReturnMyAuctionList*)((CINFReturnAuctionCenter*)pINFbase)->m_pAuctionView[_RETURN_MY_AUCTION_LIST]);
	pAuctionMyList->MyAuctionGetOk(pMsg);
#endif
}  

// 2014-06-12 by ymjoo 파괴 경매장 추가작업
void CAtumApplication::FieldSocketDestroyAuctionNotiStart()
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	if(g_pInterface
		&& g_pInterface->m_pCityBase
		&& g_pInterface->m_pCityBase->GetCurrentBuildingNPC()
		&& BUILDINGKIND_DESTROY_AUCTION == g_pInterface->m_pCityBase->GetCurrentBuildingNPC()->buildingInfo.BuildingKind)
	{
		CINFReturnAuctionCenter* returnAuctionCenter = (CINFReturnAuctionCenter*)(g_pInterface->m_pCityBase->m_mapCityShop.find(BUILDINGKIND_DESTROY_AUCTION)->second);
		if(_RETURN_AUCTION_LIST == returnAuctionCenter->GetState())
		{
			returnAuctionCenter->RestartWnd();
		}
		else
		{
			returnAuctionCenter->SetNeedRestartWnd(TRUE);
		}
	}
	m_pChat->CreateChatChild(STRMSG_C_140612_0001, COLOR_SYSTEM);		// "경매가 시작되었습니다."
#endif
}
// END 2014-06-12 by ymjoo 파괴 경매장 추가작업

void CAtumApplication::FieldSocketDestroyAuctionNotiEnd()
{
#ifdef SC_DESTROY_AUCTION_JHSEOL_BCKIM_SSJUNG
	CMapCityShopList::iterator it = g_pInterface->m_pCityBase->m_mapCityShop.find( BUILDINGKIND_DESTROY_AUCTION );
	if( it != g_pInterface->m_pCityBase->m_mapCityShop.end() )
	{
		((CINFReturnAuctionCenter*)(it->second))->m_DAuctionEndTime = GetServerDateTime();
		((CINFReturnAuctionCenter*)(it->second))->VecItemStateEnd();
		g_pFieldWinSocket->SendMsg( T_FC_DESTROY_AUCTION_MY_LIST_REQUEST, NULL , 0);
		// 2014-06-12 by ymjoo 파괴 경매장 추가작업
		((CINFReturnAuctionCenter*)(it->second))->SetNeedRestartWnd(FALSE);
		// END 2014-06-12 by ymjoo 파괴 경매장 추가작업
	}
	// 2014-06-12 by ymjoo 파괴 경매장 추가작업
	m_pChat->CreateChatChild(STRMSG_C_140612_0002, COLOR_SYSTEM);		// "경매가 종료되었습니다."
	// END 2014-06-12 by ymjoo 파괴 경매장 추가작업
#endif
}
// end 2014-01-15 by ssjung 파괴 경매장 구현

// 2014-02-10 by ssjung, 버그 트랩
void CAtumApplication::FieldSocketBugtrapSeverInfo(SBUGTRAP_SERVER_INFO* pMsg)
{
#ifdef SC_BUGTRAP_BCKIM_SSJUNG
	memset(&m_strBugtrapSeverInfo, 0x00, sizeof(SBUGTRAP_SERVER_INFO));
	memcpy(&m_strBugtrapSeverInfo, pMsg, sizeof(SBUGTRAP_SERVER_INFO));
#endif
}
// 2014-02-10 by ssjung, 버그 트랩

// 2014-06-10 by ymjoo 세력 변경 아이템
void CAtumApplication::FieldSocketItemUseCardItemChangeInfluenceNotify(MSG_FC_ITEM_USE_CARDITEM_CHANGE_INFLUENCE_NOTIFY* pMsg)
{
	g_pSelect->SetInfluenceChange(TRUE);
	g_pSelect->SetInfluenceChangeCharacterIndex(g_pSelect->m_pSelectBack->GetCurrentSelectIndex());
	g_pGameMain->m_pSystem->SendFieldSocketCharacterGameEnd();
}
// END 2014-06-10 by ymjoo 세력 변경 아이템
