#include "../../mainproc/GameMain.h"
#include "Net_GSrvConnectChild.h"
#include "../net_channel/NetCli_Channel.h"
#include "../../Interface/maintain/Maintain.h"

//-----------------------------------------------------------------------------
bool Net_GSrvConnectChild::_Init()
{	
	if (This)
		return false;

	This = new Net_GSrvConnectChild;
	return Net_GSrvConnect::_Init();
}

//-----------------------------------------------------------------------------
bool Net_GSrvConnectChild::_Release()
{
	Net_GSrvConnect::_Release();

	if (This)
	{
		delete This;
		This = NULL;
	}

	return true;
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::PlayerItemID ( int GItemID )
{
	g_pGameMain->SetPlayerID(GItemID);
	g_pError->AddMessage(1, 0, "PlayerItemID %d", GItemID);
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::ZoneInfo ( int GSrvNetID , int ZoneID , int GSrvID , int MapID )
{
	g_pGameMain->SetZoneID( ZoneID );
	g_pGameMain->SetMapID( MapID );
	RoleDataEx::G_ZoneID = ZoneID;
	NetCli_Channel::S_ChannelZoneID(ZoneID);
	g_pError->AddMessage(1, 0, "ZoneInfo ZoneID %d MapID %d", ZoneID, MapID);
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::PlayerData ( BaseRoleData *BaseRole )
{
	RoleDataEx* roleData = CNetGlobal::RoleData();
	if (roleData)
	{
		roleData->BaseData = *BaseRole;
		roleData->InitCal();
		roleData->TempData.UpdateInfo._Event = 0xffffffff;


		// 初始化人物的暫時任務結構
			/*
			QuestTempDataStruct	*pQuestTempData = &( roleData->TempData.QuestTempData );
			ZeroMemory( pQuestTempData, sizeof( QuestTempDataStruct ) );
			int	iTempIndex = 0;

			for( int index = 0; index < _MAX_QUEST_COUNT_; index++ )
			{
				int iQuestID =  roleData->BaseData.Quest.iQuest[ index ];
				if( iQuestID != 0 )
				{
					GameObjDbStruct* pObj = g_ObjectData->GetObj( iQuestID );

					if( pObj )
					{
						GameObjectQuestDetail *pQuest = &( g_ObjectData->GetObj( iQuestID )->QuestDetail );

						pQuestTempData->QuestKillIndexTable[ iTempIndex ] = index;
						roleData->CheckQuest_RequestKill_SetTempData		( index, pQuest );
						roleData->CheckQuest_ClickToGetItem_SetTempData	( index, pQuest );
					}
				}
				else
					break;
			}
			*/
	}
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::PrepareChangeZone ()
{
	g_pError->AddMessage(1, 0, "PrepareChangeZone");
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::ChangeZoneOK ()
{	
	g_pError->AddMessage(1, 0, "ChangeZoneOK");
}

//-----------------------------------------------------------------------------
void Net_GSrvConnectChild::R_ModyNPC ( ModifyNPCInfo*  Info )
{
	g_pMaintain->ModifyOpen( Info );
}
//-----------------------------------------------------------------------------
//回應 npc 路徑資訊
void Net_GSrvConnectChild::R_GetNPCMoveInfoResult	( int GItemID , vector<NPC_MoveBaseStruct>& List )
{
	
}