示例#1
0
		VOID StdImpact059_T::SendLayerChangeMsg( OWN_IMPACT& rImp, Obj_Character& rMe ) const
		{
			__ENTER_FUNCTION

			//通知客户端层数改变
			// Info Other Impact
			//通知其它客户端效果生效
			Scene * pScene = rMe.getScene();
			if(NULL==pScene||FALSE==rMe.IsActiveObj())
			{
				return;
			}
			GCCharBuff Msg2Other;
			Msg2Other.SetReceiverID(rImp.GetCasterObjID());
			Msg2Other.SetSenderID(rImp.GetCasterObjID());
			Msg2Other.SetEnable(TRUE);
			Msg2Other.SetSN(rImp.GetSN());
			Msg2Other.SetBuffID(Impact_GetImpactID(rImp));
			Msg2Other.SetSenderLogicCount(rImp.GetCasterLogicCount());
			Msg2Other.SetSkillID( rImp.GetSkillID() );
			Msg2Other.SetLayerCount( rImp.GetLayerCount() );

			// 设置技能效果的持续时间  20100531 BLL
			Msg2Other.SetContinuance( rImp.GetContinuance() );

			if(INVALID_ID!=Impact_GetImpactID(rImp))
			{
				pScene->BroadCast(&Msg2Other, &rMe, TRUE);
			}
			__LEAVE_FUNCTION
		}
示例#2
0
		VOID StdImpact059_T::BroadcastTargetListMessage( OWN_IMPACT& rImp, Obj_Character& rMe, OBJLIST& rTargets, HitFlagsForOBJLIST_T& rHitFlagsForObjList ) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
			GCTargetListAndHitFlags msg;
			GCTargetListAndHitFlags::HitFlagList_T& rHitFlags		= msg.GetHitFlagList();
			msg.SetDataType(msg.BUFF_ACTIVETE);
			msg.SetObjID(rMe.GetID());
			msg.SetUserPos(*(rMe.getWorldPos()));
			msg.SetLogicCount(rMe.GetLogicCount());
			msg.SetSkillOrSpecialObjDataID(rImp.GetSkillID());
			msg.SetTargetID(rParams.GetTargetObj());
			msg.SetTargetPos(rParams.GetTargetPosition());
			msg.SetDir(rParams.GetTargetDirection());
			BYTE nNum = rTargets.m_Count;
			if(msg.MAX_TARGET_LIST_SIZE<nNum)
			{
				nNum = msg.MAX_TARGET_LIST_SIZE;
			}
			msg.SetTargetNum(nNum);
			int iTemp = nNum;

			INT nIdx=0;
			for(nIdx=0; nNum>nIdx; ++nIdx)
			{
				Obj* pTarget = rTargets.m_aObj[nIdx];
				if(NULL!=pTarget)
				{
					msg.SetTargetObjIDByIndex(nIdx, pTarget->GetID());
					if(TRUE == rHitFlagsForObjList.GetFlagByIndex(nIdx))
					{
						rHitFlags.MarkFlagByIndex(nIdx);
						//msg.SetBallIDByIndex( nIdx, m_aBallUniqueID[nIdx].m_uUniqueID );
					}
				}
			}
			Scene* pScene = rMe.getScene();
			if(NULL!=pScene)
			{
				pScene->BroadCast(&msg, &rMe, TRUE);
			}
			__LEAVE_FUNCTION
		}
示例#3
0
UINT CGUnEquipHandler::Execute( CGUnEquip* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	HUMAN_EQUIP	EquipPoint = (HUMAN_EQUIP)pPacket->getEquipPoint();

	//Assert( pHuman->GetDB()->GetEquipDB()->IsSet(EquipPoint) ) ;



	Item*	pEquipItem = HumanItemLogic::GetEquip(pHuman,EquipPoint);
	
	if(!pEquipItem)
	{
		Assert(pEquipItem);
		return	PACKET_EXE_CONTINUE;
	}
	if(pEquipItem->IsEmpty())
	{
		return	PACKET_EXE_CONTINUE;
	}

	UCHAR	itemClass = pEquipItem->GetItemClass();
	if(itemClass ==	ICLASS_EQUIP)
	{
		INT		BagIndex;//	=	pHuman->GetFirstEmptyBagIndex();

		ItemContainer*	pEquipContainer = pHuman->GetEquipContain();
		ItemContainer*	pBaseContainer	= pHuman->GetBaseContain();

		if(!pEquipContainer)
		{
			Assert(pEquipItem);
			return	PACKET_EXE_CONTINUE;
		}
		
		BYTE	DeliverBagIndex = pPacket->getBagIndex();

		if(DeliverBagIndex<pBaseContainer->GetContainerSize())
		{
			BagIndex	=	g_ItemOperator.MoveItem(pEquipContainer,
				EquipPoint,
				pBaseContainer,DeliverBagIndex);
		}
		else
		{
			BagIndex	=	g_ItemOperator.MoveItem(pEquipContainer,
							EquipPoint,
							pBaseContainer);
		}
		

		GCUnEquipResult	 Msg;
		if(BagIndex>=0
			&& BagIndex<pBaseContainer->GetContainerSize())
		{
			Msg.setEquipPoint(EquipPoint);
			Msg.setBagIndex(BagIndex);
			Msg.setItemID(pEquipItem->GetGUID());
			Msg.setItemTableIndex(pEquipItem->GetItemTableIndex());
			Msg.setResult(UNEQUIP_SUCCESS);
			pHuman->SetEquipVer(pHuman->GetEquipVer()+1);
			pHuman->ItemEffectFlush();

			pGamePlayer->SendPacket( &Msg ) ;

			//如果可见
			if(pHuman->IsVisualPart(EquipPoint))
			{	
				GCCharEquipment OtherMsg;
				OtherMsg.setObjID(pHuman->GetID());
				//if(EquipPoint == HEQUIP_WEAPON)
				//{
				//	UINT uGemID = GetEquipmentMaxLevelGemID(pEquipItem);
				//	OtherMsg.setID(EquipPoint,pEquipItem->GetItemTableIndex(), uGemID);
				//}
				//else
				//{
					OtherMsg.setID(EquipPoint,pEquipItem->GetItemTableIndex(), -1);
				//}
				pScene->BroadCast(&OtherMsg,pHuman,TRUE);
			}
		}
		else
		{
			if(ITEMOE_DESTOPERATOR_HASITEM == BagIndex)
			{
				Msg.setResult(UNEQUIP_HAS_ITEM);
				pGamePlayer->SendPacket( &Msg ); 
			}
			else if(ITEMOE_DESTOPERATOR_FULL == BagIndex)
			{
				Msg.setResult(UNEQUIP_BAG_FULL);
				pGamePlayer->SendPacket( &Msg ); 
			}
		}
		
	}
	else
	{
		Assert(FALSE);
		//装备为什么不是 ICLASS_EQUIP
	}
	
	g_pLog->FastSaveLog( LOG_FILE_1, "CGUnEquipHandler EquipPoint=%d itemClass=%d",
		EquipPoint, itemClass  ) ;

	
	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
示例#4
0
uint CGEquipSuitExchangeHandler::Execute(CGEquipSuitExchange* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	//交易状态不可操作
	if(pHuman->m_ExchangBox.m_Status > 0)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ExchangBox::m_Status>0" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}
	//摆摊状态不可操作
	if(pHuman->m_StallBox.GetStallStatus() == ServerStallBox::STALL_OPEN)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ServerStallBox::STALL_OPEN" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}

	//切场景时丢弃换装消息
	if(pGamePlayer->GetPlayerStatus()!=PS_SERVER_NORMAL ||
		!pHuman->IsActiveObj() )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipSuitExchangeHandler: change scene") ;
		return PACKET_EXE_CONTINUE;
	}
	//摆摊不可操作
	if(pHuman->m_StallBox.GetStallStatus() == ServerStallBox::STALL_OPEN)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ServerStallBox::STALL_OPEN" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}

	UINT  nSuitNum = pPacket->getEquipSuitNum();

	if( nSuitNum > MAX_EQUIP_SUIT_NUM )
	{
		return PACKET_EXE_ERROR ;
	}

	ItemContainer* pEquipContainer = pHuman->GetEquipContain();
	
	Assert(pEquipContainer);
	_SUIT_SETTING suitSetting = pHuman->GetEquipSuitSetting(nSuitNum);

	GCEquipSuitExchangeResult Msg;
	GCDetailEquipList	SelfMsg;
	GCCharEquipment OtherMsg;
	SelfMsg.setObjID( pHuman->GetID() );
	BOOL bChange = FALSE;
	UINT RetPart = 0;

	//遍历所有套装
	for(INT i=0; i<HEQUIP_NUMBER; ++i)
	{
		//存在套装数据
		if(!suitSetting.m_EquipData[i].isNull())
		{
			//检查装备栏
			Item* pEquip = pEquipContainer->GetItem(i);
			Assert(pEquip);

			//装备有变化,装备栏数据与保存的对应位置套装信息不一致,需要到背包里找
			if(!(pEquip->GetGUID() == suitSetting.m_EquipData[i]))
			{
				INT nPos = INVALID_INDEX;
				ItemContainer* pBagContainer = HumanItemLogic::GetBagItemContain(pHuman, &suitSetting.m_EquipData[i], nPos);
				//背包里也找不到,需记录下来(卖掉了?丢掉了?。。)
				if(nPos == INVALID_INDEX)
				{
					EXCHANGE_EQUIP_INFO ExchangeInfo;
					ExchangeInfo.m_BagIndex = INVALID_ITEM_POS;
					ExchangeInfo.m_EquipPoint	= INVALID_ITEM_POS;
					Msg.setEquipInfo(ExchangeInfo, i);
					continue;
				}
				
				//找到了
				Item*	pExchangeItem = HumanItemLogic::GetBagItem(pHuman, nPos);
				
				Assert(pExchangeItem->GetItemClass() == ICLASS_EQUIP);
				if(pExchangeItem->GetEquipPoint() != i)
				{
					if(pExchangeItem->GetEquipPoint() == HEQUIP_RING1)
					{
						Assert(i == HEQUIP_RING2);
					}
					else if(pExchangeItem->GetEquipPoint() == HEQUIP_ADORN1)
					{
						Assert(i == HEQUIP_ADORN2);
					}
					else
						Assert(0);
				}
				//玩家可能等级变了
				if(pExchangeItem->GetRequireLevel() > pHuman->GetLevel() )
				{
					EXCHANGE_EQUIP_INFO ExchangeInfo;
					ExchangeInfo.m_BagIndex = INVALID_ITEM_POS;
					ExchangeInfo.m_EquipPoint	= i;
					Msg.setEquipInfo(ExchangeInfo, i);
					g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipSuitExchangeHandler: Equiplevel , pEquip->GetRequireLevel()=%d", pEquip->GetRequireLevel() ) ;
					continue;
				}
				
				//可能换职业了
				if(!pExchangeItem->IsWuMenPai())
				{
					if(!pExchangeItem->InReqJob(pHuman->GetMenPai()))
					{
						EXCHANGE_EQUIP_INFO ExchangeInfo;
						ExchangeInfo.m_BagIndex = INVALID_ITEM_POS;
						ExchangeInfo.m_EquipPoint	= i;
						Msg.setEquipInfo(ExchangeInfo, i);
						g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipSuitExchangeHandler: ReqJob") ;
						continue;
					}
				}
				if (pEquip->IsEmpty())
				{
					g_ItemOperator.MoveItem( pBagContainer,
						pBagContainer->BagIndex2ConIndex(nPos),
						pEquipContainer,
						i ) ;
				}
				
				else
				{
					if (pBagContainer->IsCanUse())
					{
						//与装备的物品进行交换
						g_ItemOperator.ExchangeItem(pBagContainer,
							pBagContainer->BagIndex2ConIndex(nPos),
							pEquipContainer,
							i);
					}
					else //背包已经过期
					{
						EXCHANGE_EQUIP_INFO ExchangeInfo;
						ExchangeInfo.m_BagIndex = INVALID_ITEM_POS;
						ExchangeInfo.m_EquipPoint	= INVALID_ITEM_POS;
						Msg.setEquipInfo(ExchangeInfo, i);
						continue;
					}
				}
				EXCHANGE_EQUIP_INFO ExchangeInfo;
				ExchangeInfo.m_BagIndex = nPos;
				ExchangeInfo.m_EquipPoint	= i;
				Msg.setEquipInfo(ExchangeInfo, i);

				//交换到人身上了,重新获取一下
				Item* pEquipItem = HumanItemLogic::GetEquip(pHuman, (HUMAN_EQUIP)i);
				if(!pEquipItem)
				{
					Assert(FALSE);
					return PACKET_EXE_CONTINUE;
				}
				Assert(!pEquipItem->IsEmpty()); 

				pEquipItem->SaveValueTo(SelfMsg.GetEquipData((HUMAN_EQUIP)i));
				RetPart|=(1<<((UINT)i));
				SelfMsg.SetAskPart(RetPart);
				RetPart = 0;
				//如果可见
				if(pHuman->IsVisualPart((HUMAN_EQUIP)i))
				{	
					OtherMsg.setObjID(pHuman->GetID());
					OtherMsg.setID((HUMAN_EQUIP)i, pEquipItem->GetItemTableIndex());
				}

				//换装了
				bChange = TRUE;
			}

			//装备正穿着呢,不需要通知
			continue;
		}
		else
		{
			//根本没有呀
			EXCHANGE_EQUIP_INFO ExchangeInfo;
			ExchangeInfo.m_BagIndex = INVALID_ITEM_POS;
			ExchangeInfo.m_EquipPoint	= i;
			Msg.setEquipInfo(ExchangeInfo, i);
		}
	}

	
	if(bChange)
	{
		Msg.setResult(EQUIPSUIT_SUCCESS);
		pGamePlayer->SendPacket(&Msg);
		pGamePlayer->SendPacket( &SelfMsg ) ;
		pScene->BroadCast(&OtherMsg,pHuman,TRUE);
		pHuman->SetEquipVer(pHuman->GetEquipVer()+1);
		//刷新装备对人物的属性影响

		pHuman->ItemEffectFlush();
	}
	else
	{
		Msg.setResult(EQUIPSUIT_SUCCESS);
		pGamePlayer->SendPacket(&Msg);
	}

	g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipSuitExchangeHandler: nSuitNum=%d", nSuitNum ) ;

	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR ;
}
示例#5
0
uint CGReturnTeamFollowHandler::Execute( CGReturnTeamFollow* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer;
	Assert( pGamePlayer );

	Obj_Human* pHuman = pGamePlayer->GetHuman();
	Assert( pHuman );
	
	Scene* pScene = pHuman->getScene();
	if( pScene==NULL )
	{
		Assert(FALSE);
		return PACKET_EXE_ERROR;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

	TeamInfo* pTeamInfo = pHuman->GetTeamInfo();
	if( pTeamInfo->HasTeam() == FALSE )
	{
		Assert(FALSE);
		return PACKET_EXE_CONTINUE;
	}

	const TEAMMEMBER* pLeaderInfo = pTeamInfo->Leader();
	// 这里不对自己是否队长进行检查

	if( pLeaderInfo->m_SceneID != pScene->SceneID() )
	{ // 不在同一个场景
		g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X is not in the same scene with team leader.", 
			pHuman->GetGUID() );
		return PACKET_EXE_CONTINUE;
	}

	Obj_Human* pLeader = pScene->GetHumanManager()->GetHuman( pLeaderInfo->m_ObjID );
	if( pLeader==NULL )
	{ // 没有找到队长
		g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X can't find team leader.", 
			pHuman->GetGUID() );
		return PACKET_EXE_CONTINUE;
	}

	// 如果自己正在摆摊,则不允许跟随
	if(pHuman->m_StallBox.GetStallStatus() == ServerStallBox::STALL_OPEN)
	{
		GCTeamFollowErr Msg;
		Msg.SetError( TF_ERROR_STALL_OPEN );

		pGamePlayer->SendPacket( &Msg );

		g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X can't follow when open stall.", 
			pHuman->GetGUID() );
		return PACKET_EXE_CONTINUE;
	}

	if( pPacket->GetReturn() )
	{ // 同意跟随
		// 检查跟队长之间的距离是否超过 10 米
		if( pHuman->IsInValidRadius(pLeader, (FLOAT)g_Config.m_ConfigInfo.m_nAvailableFollowDist) == FALSE )
		{ // 超过则返回错误信息
			GCTeamFollowErr Msg;
			Msg.SetError( TF_ERROR_TOO_FAR );

			pGamePlayer->SendPacket( &Msg );

			g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X can't follow for the distance.", 
				pHuman->GetGUID() );
			return PACKET_EXE_CONTINUE;
		}

		// 检查队长是否出于组队跟随状态
		if( pLeader->__GetTeamFollowFlag() == FALSE )
		{ // 队长不处于组队跟随状态,可能队长已经主动取消跟随了
			GCTeamFollowErr Msg;
			Msg.SetError( TF_ERROR_NOT_IN_FOLLOW_MODE );

			pGamePlayer->SendPacket( &Msg );

			g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X can't follow for not in follow mode.", 
				pHuman->GetGUID() );
			return PACKET_EXE_CONTINUE;
		}

		if ( pHuman->__GetTeamFollowFlag() )
		{ // 如果已经处于此状态,则返回
			return PACKET_EXE_CONTINUE;
		}

		pHuman->__SetTeamFollowFlag( TRUE );

		_FOLLOWEDMEMBER MyInfo;
		MyInfo.m_GUID = pHuman->GetGUID();
		MyInfo.m_pHuman = pHuman;

		// 将新的跟随列表发给可见范围内所有客户端
		// 只有队长有这个列表,这样可以进行优化
		GCTeamFollowList Msg;
		Msg.SetObjID( pLeader->GetID() );

		INT nMaxFollowedCount = pLeader->__GetFollowedMembersCount();

		for( INT i=0; i<nMaxFollowedCount; ++i )
		{ // 所有跟随者加上自己,自己加上每个跟随者
			Obj_Human* pMember;
			const _FOLLOWEDMEMBER* pFollowedMember;

			pFollowedMember = pLeader->__GetFollowedMember(i);

			pMember = pFollowedMember->m_pHuman;
			if( pMember!=NULL )
			{ // 没有断线并且在同一场景
				pMember->__AddFollowedMember( MyInfo );
			}

			pHuman->__AddFollowedMember( *pFollowedMember );
			Msg.AddFollowMember( pFollowedMember->m_GUID );
		}

		pHuman->__AddFollowedMember( MyInfo ); // 自己加上自己
		pHuman->GetHumanAI()->PushCommand_TeamFollow();

		Msg.AddFollowMember( MyInfo.m_GUID );

		//GCNotifyTeamInfo notifyMsg;
		//notifyMsg.SetObjID( pHuman->GetID() );
		//notifyMsg.SetHaveTeamFlag( pTeamInfo->HasTeam() );
		//notifyMsg.SetTeamLeaderFlag( pTeamInfo->IsLeader() );
		//notifyMsg.SetTeamFullFlag( pTeamInfo->IsFull() );
		//notifyMsg.SetTeamFollowFlag( pHuman->__GetTeamFollowFlag() );
		//pScene->BroadCast( &notifyMsg, pHuman );

		pScene->BroadCast( &Msg, pLeader, TRUE ); // 发送跟随列表给所有客户端,以供路线模拟

		GCReturnTeamFollow RetMsg;
		RetMsg.SetReturn( TF_RESULT_ENTER_FOLLOW );
		RetMsg.SetGUID( pHuman->GetGUID() );

		pGamePlayer->SendPacket( &RetMsg ); // 发给自己
		pLeader->GetPlayer()->SendPacket( &RetMsg ); // 发给队长

		// 这里需要通知 world GWEnterTeamFollow
		GWEnterTeamFollow* pMsg = (GWEnterTeamFollow*)g_pPacketFactoryManager->CreatePacket(PACKET_GW_ENTER_TEAMFOLLOW);

		pMsg->SetGUID( pHuman->GetGUID() );

		g_pServerManager->SendPacket( pMsg, INVALID_ID );

		g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X success.", 
			pHuman->GetGUID() );
		return PACKET_EXE_CONTINUE;
	}
	else
	{ // 不同意跟随
		GCReturnTeamFollow Msg;
		Msg.SetReturn( TF_RESULT_REFUSE_FOLLOW );
		Msg.SetGUID( pHuman->GetGUID() );

		pLeader->GetPlayer()->SendPacket( &Msg );

		g_pLog->FastSaveLog( LOG_FILE_1, "CGReturnTeamFollow: GUID=%X refuse to follow.", 
			pHuman->GetGUID() );
		return PACKET_EXE_CONTINUE;
	}
	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
uint CGDiscardEquipHandler::Execute(CGDiscardEquip* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION


	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;


	HUMAN_EQUIP		EquipPoint = (HUMAN_EQUIP)pPacket->GetEquipPoint();

	//Assert( pHuman->GetDB()->GetEquipDB()->IsSet(EquipPoint)) ;

	Item*		pEquip	=	HumanItemLogic::GetEquip(pHuman,EquipPoint);
	
	if(!pEquip)
	{
		Assert(pEquip);
		return PACKET_EXE_CONTINUE;
	}
	
	GCDiscardEquipResult	Msg;

	if(pEquip->IsEmpty())
	{
		Msg.SetResult(DISCARDEQUIP_NO_SUCH_EQUIP);

	}
	
	if(pEquip->IsRuler(IRL_DISCARD))
	{
		Msg.SetItemTableIndex(pEquip->GetItemTableIndex());
		ITEM_LOG_PARAM	ItemLogParam;
		ItemLogParam.OpType		=	ITEM_DISCARD_EQUIP;
		ItemLogParam.CharGUID	=	pHuman->GetGUID();
		ItemLogParam.BagPos		=	EquipPoint;
		ItemLogParam.XPos		=	pHuman->getWorldPos()->m_fX;
		ItemLogParam.ZPos		=	pHuman->getWorldPos()->m_fZ;
		ItemLogParam.SceneID	=	pHuman->getScene()->SceneID();	

		BOOL bRet =	g_ItemOperator.EraseItem(pHuman->GetEquipContain(),EquipPoint);

		if(bRet) SaveItemLog(&ItemLogParam);

		pHuman->SetEquipVer(pHuman->GetEquipVer()+1);
		pHuman->ItemEffectFlush();
		Msg.SetResult(DISCARDEQUIP_SUCCESS);
		Msg.SetEquipPoint(EquipPoint);
		//如果可见
		if(pHuman->IsVisualPart(EquipPoint))
		{	
			GCCharEquipment OtherMsg;
			OtherMsg.setObjID(pHuman->GetID());
			OtherMsg.setID(EquipPoint,-1, -1);
			pScene->BroadCast(&OtherMsg,pHuman,TRUE);
		}
		
	}
	else
	{
		Msg.SetResult(DISCARDEQUIP_CANNT_DISCARD);

	}
	

	pGamePlayer->SendPacket(&Msg);	

	g_pLog->FastSaveLog( LOG_FILE_1, "CGDiscardEquipHandler: ok EquipPoint=%d", 
		EquipPoint ) ;
	
	
	return PACKET_EXE_CONTINUE;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR;
}
示例#7
0
UINT CGUseEquipHandler::Execute(CGUseEquip* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION
	
	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;
	
	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	//切场景时丢弃换装消息
	if(pGamePlayer->GetPlayerStatus()!=PS_SERVER_NORMAL ||
		!pHuman->IsActiveObj() )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGUseEquipmentHandler: change scene") ;
		return PACKET_EXE_CONTINUE;
	}

	BYTE  BagIndex = pPacket->getBagIndex();

	if( BagIndex == INVALID_BAG_INDEX )
	{
		Assert(FALSE) ; //包发错了
		return PACKET_EXE_CONTINUE ;
	}
		
	Item* pUseItem = HumanItemLogic::GetItem(pHuman,BagIndex);
	
	GCUseEquipResult Msg;

	//////////////////////////////////////////////////////////////////////////
	//装配条件判断
	UCHAR	itemClass = pUseItem->GetItemClass();

	if(itemClass == ICLASS_EQUIP)
	{
		//需求等级判断
		if(pUseItem->GetRequireLevel()>pHuman->GetLevel())
		{
			Msg.setResult(USEEQUIP_IDENT_FAIL);
			pGamePlayer->SendPacket( &Msg ) ;
		}
		//鉴定判断
		else if(pUseItem->GetItemQual() == EQUALITY_BLUE && pUseItem->GetItemIdent() == FALSE)
		{
			Msg.setResult(USEEQUIP_LEVEL_FAIL);
			pGamePlayer->SendPacket( &Msg ) ;
		}
		else
		{
			
			HUMAN_EQUIP		Equip_Point =(HUMAN_EQUIP)pUseItem->GetEquipPoint();
			//const	_ITEM*			pEquip = pHuman->GetEquip(Equip_Point);
			ItemContainer*	pEquipContainer = pHuman->GetEquipContain();
			
			if(!pEquipContainer)
			{
				Assert(pEquipContainer);
				return PACKET_EXE_CONTINUE;
			}

			Item*	pEquipItem = pEquipContainer->GetItem((UINT)Equip_Point);

			if(!pEquipItem)
			{
				Assert(pEquipItem);
				return PACKET_EXE_CONTINUE;

			}
			
			BOOL			bEquipStatus = (!pEquipItem->IsEmpty());

			ItemContainer*	pBagContainer =
				HumanItemLogic::GetContainer(pHuman,BagIndex);

			if(bEquipStatus)
			{
				//装备上物品,替换下来装备点数据
				
				g_ItemOperator.ExchangeItem(pBagContainer,
											pBagContainer->BagIndex2ConIndex(BagIndex),
											pEquipContainer,
											(UINT)Equip_Point);


			}
			else
			{ 
				//pHuman->GetDB()->OverWriteBag2Equip(BagIndex,Equip_Point);
				g_ItemOperator.MoveItem(pBagContainer,
										pBagContainer->BagIndex2ConIndex(BagIndex),
										pEquipContainer,
										(UINT)Equip_Point);

							
			}
			
			Item* pEquip = pEquipContainer->GetItem((UINT)Equip_Point);
			
			if(pEquip&&pEquip->IsCanEquipBind())
			{
				g_ItemOperator.SetItemBind(pEquipContainer,(UINT)Equip_Point);	
			}

			

			Msg.setBagIndex(BagIndex);
			Msg.setEquipPoint(Equip_Point);
			Msg.setEquipID(pEquipItem->GetGUID());
			Msg.setEquipResID(pEquipItem->GetItemTableIndex());
			Msg.setItemResID(pUseItem->GetItemTableIndex());
			Msg.setBagItemId(pUseItem->GetGUID());
			Msg.setResult(USEEQUIP_SUCCESS);
			
			pGamePlayer->SendPacket( &Msg ) ;
			pHuman->SetEquipVer(pHuman->GetEquipVer()+1);
			//刷新装备对人物的属性影响

			pHuman->ItemEffectFlush();

			//如果可见
			if(pHuman->IsVisualPart(Equip_Point))
			{	
				GCCharEquipment OtherMsg;
				OtherMsg.setObjID(pHuman->GetID());
				if(Equip_Point == HEQUIP_WEAPON)
				{
					UINT uGemID = GetEquipmentMaxLevelGemID(pEquip);
					OtherMsg.setID(Equip_Point,pEquip->GetItemTableIndex(), uGemID);
				}
				else
				{
					OtherMsg.setID(Equip_Point,pEquip->GetItemTableIndex(), -1);
				}
				pScene->BroadCast(&OtherMsg,pHuman,TRUE);

			}


			WORD RetPart = 0;
			GCDetailEquipList	SelfMsg;
			SelfMsg.setObjID( pHuman->GetID() );
			pEquipItem = HumanItemLogic::GetEquip(pHuman,Equip_Point);
			if(!pEquipItem)
			{
				Assert(FALSE);
				return PACKET_EXE_CONTINUE;
			}
			if(pEquipItem->IsEmpty()) 
			{
				g_pLog->FastSaveLog( LOG_FILE_1, "CGUseEquipmentHandler: Equip_Point =%d Fail", Equip_Point ) ;
				return PACKET_EXE_CONTINUE;
			}
				
			pEquipItem->SaveValueTo(SelfMsg.GetEquipData(Equip_Point));
			RetPart|=(1<<((INT)Equip_Point));
			SelfMsg.SetAskPart(RetPart);
			pGamePlayer->SendPacket( &SelfMsg ) ;
		}
		
		
		
		
		
	}
	else
	{
		Msg.setResult(USEEQUIP_TYPE_FAIL);
		Msg.setBagIndex(0);
		Msg.setEquipPoint(0);
		pGamePlayer->SendPacket( &Msg ) ;
		
	}
	
	

	
	

	g_pLog->FastSaveLog( LOG_FILE_1, "CGUseEquipmentHandler: BagIndex=%d", BagIndex ) ;

	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR ;
}
UINT WGTeamFollowListHandler::Execute( WGTeamFollowList* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    PlayerID_t PlayerID = pPacket->GetPlayerID();
    GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
    if( pGamePlayer==NULL )
    {
        g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamFollowListHandler::Execute pGamePlayer==NULL" );
        return PACKET_EXE_CONTINUE;
    }

    if (pGamePlayer->m_HumanGUID != pPacket->GetGUID())
    {
        g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamFollowListHandler::Execute pGamePlayer->m_HumanGUID[%d] != pPacket->GetGUID()[%d]",pGamePlayer->m_HumanGUID, pPacket->GetGUID());
        return PACKET_EXE_CONTINUE;
    }

    Obj_Human* pHuman = pGamePlayer->GetHuman();
    Assert( pHuman );
    Scene* pScene = pHuman->getScene();
    if( !pScene )
    {
        g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamFollowListHandler::Execute pHuman->getScene() == NULL" );
        return PACKET_EXE_CONTINUE;
    }

    if( pPlayer->IsServerPlayer() )
    {//服务器收到世界服务器发来的数据
        Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );

        pScene->SendPacket( pPacket, PlayerID );

        g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamFollowListHandler: ServerPlayer (GUID=%X) ",
            pHuman->GetGUID() );

        return PACKET_EXE_NOTREMOVE;
    }
    else if( pPlayer->IsGamePlayer() )
    {//场景收到Cache里的消息
        Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

        TeamInfo* pTeamInfo = pHuman->GetTeamInfo();
        if( pTeamInfo->HasTeam() == FALSE )
        {
            Assert(FALSE);
            return PACKET_EXE_CONTINUE;
        }

        pHuman->__ClearFollowedMembers(); // 清空旧信息

        _FOLLOWEDMEMBER myInfo;
        myInfo.m_GUID = pHuman->GetGUID();
        myInfo.m_pHuman = pHuman;

        for( INT i=0; i<pPacket->GetMemberCount(); ++i )
        {
            _FOLLOWEDMEMBER info;
            const TEAMMEMBER* pMember;

            info.m_GUID = pPacket->GetFollowMember(i);
            info.m_pHuman = NULL;
            pMember = pTeamInfo->GetTeamMemberByGUID( info.m_GUID );

            if ( pMember->m_SceneID == pScene->SceneID() )
            {
                info.m_pHuman = pScene->GetHumanManager()->GetHuman( pMember->m_ObjID );

                if ( info.m_pHuman!=NULL )
                {
                    if ( info.m_pHuman->GetGUID()!=pMember->m_GUID )
                    { // 宁缺勿滥
                        info.m_pHuman = NULL;
                    }
                    else
                    { // 让跟随队友把自己加进去,以更新 pHuman 指针
                        info.m_pHuman->__AddFollowedMember( myInfo );
                    }
                }
            }

            pHuman->__AddFollowedMember( info );
        }

        if ( pPacket->GetMemberCount()>0 )
        {
            pHuman->__SetTeamFollowFlag( TRUE );

            GCReturnTeamFollow Msg; // 通知客户端进入跟随状态
            Msg.SetGUID( pHuman->GetGUID() );
            Msg.SetReturn( TF_RESULT_FOLLOW_FLAG );
            pGamePlayer->SendPacket( &Msg );
        }
        else
        { // 队长断线退出,World 可能发送一个空的列表过来
            pHuman->__SetTeamFollowFlag( FALSE );
            pHuman->GetHumanAI()->PushCommand_StopTeamFollow();

            GCReturnTeamFollow Msg; // 通知客户端进入跟随状态
            Msg.SetGUID( pHuman->GetGUID() );
            Msg.SetReturn( TF_RESULT_STOP_FOLLOW );
            pGamePlayer->SendPacket( &Msg );
        }

        if ( pTeamInfo->IsLeader() )
        { // 队长
            GCTeamFollowList Msg;
            Msg.SetObjID( pHuman->GetID() );

            for( INT i=1; i<pHuman->__GetFollowedMembersCount(); ++i )
            {
                Obj_Human* pMember;

                pMember = pHuman->__GetFollowedMember(i)->m_pHuman;
                Msg.AddFollowMember( pHuman->__GetFollowedMember(i)->m_GUID );

                if ( pMember!=NULL && pMember->getZoneID()!=INVALID_ID )
                { // 必须进入了场景才跟随
                    pMember->GetHumanAI()->PushCommand_TeamFollow();
                }
            }

            if ( pHuman->getZoneID() != INVALID_ID )
            {
                pScene->BroadCast( &Msg, pHuman, TRUE );
            }
        }
        else if ( pPacket->GetMemberCount()>0 )
        { // 是跟随者
            Obj_Human* pLeader = pHuman->__GetFollowedMember(0)->m_pHuman;

            if ( pLeader!=NULL && pLeader->getZoneID()!=INVALID_ID )
            { // 必须进入了场景才跟随
                pHuman->GetHumanAI()->PushCommand_TeamFollow();
            }
        }

        g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamFollowListHandler: GamePlayer (GUID=%X) ",
            pHuman->GetGUID() );
    }
    else
    {
        Assert(FALSE);
    }

    return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR;
}
示例#9
0
UINT WGTeamListHandler::Execute( WGTeamList* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	PlayerID_t PlayerID = pPacket->GetPlayerID();
	GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
	if( pGamePlayer==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamListHandler::Execute pGamePlayer==NULL" );
		return PACKET_EXE_CONTINUE;
	}

	if (pGamePlayer->m_HumanGUID != pPacket->GetGUID())
	{
		g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamListHandler::Execute pGamePlayer->m_HumanGUID[%d] != pPacket->GetGUID()[%d]",pGamePlayer->m_HumanGUID, pPacket->GetGUID());
		return PACKET_EXE_CONTINUE;
	}

	Obj_Human* pHuman = pGamePlayer->GetHuman();
	Assert( pHuman );
	Scene* pScene = pHuman->getScene();
	if( !pScene )
	{
		g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamListHandler::Execute pHuman->getScene() == NULL" );
		return PACKET_EXE_CONTINUE;
	}

	if( pPlayer->IsServerPlayer() )
	{//服务器收到世界服务器发来的数据
		Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );

		pScene->SendPacket( pPacket, PlayerID );

		g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamListHandler: ServerPlayer (GUID=%X, TeamID=%d) ",
			pHuman->GetGUID(), pPacket->GetTeamID() );

		return PACKET_EXE_NOTREMOVE;
	}
	else if( pPlayer->IsGamePlayer() )
	{//场景收到Cache里的消息
		Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

		TeamInfo* pTeamInfo = pHuman->GetTeamInfo();
		if ( pTeamInfo->HasTeam() )
		{ // 只要客户端请求完成的队伍信息,就清空服务器端的队伍列表
			pTeamInfo->DisMiss();
		}

		pTeamInfo->SetTeamID( pPacket->GetTeamID() );
		pHuman->GetDB()->SetDBTeamID( pPacket->GetTeamID() ) ;
		pTeamInfo->SetMySceneID( pScene->SceneID() );

		GCTeamList Msg;
		Msg.SetTeamID( pPacket->GetTeamID() );

		for( UINT i=0; i<pPacket->GetMemberCount(); ++i )
		{
			const TEAM_LIST_ENTRY& entry = pPacket->GetTeamMember( i );
			TEAM_LIST_ENTRY newEntry;

			TEAMMEMBER Member;
			Member.m_GUID = entry.GetGUID();
			Member.m_SceneID = entry.GetSceneID();
			if ( Member.m_GUID == pGamePlayer->m_HumanGUID )
			{
				Member.m_ObjID = pHuman->GetID();
			}
			else if ( Member.m_SceneID == pScene->SceneID() )
			{
				GamePlayer* ptempGamePlayer = g_pPlayerPool->GetPlayer( entry.GetExtraID() );
				Obj_Human* ptempHuman;

				if ( ptempGamePlayer == NULL )
				{
					Assert(FALSE && "队友失去了连接。");
					Member.m_ObjID = INVALID_ID;
				}
				else if ( (ptempHuman = ptempGamePlayer->GetHuman()) == NULL )
				{
					Assert(FALSE && "队友找不到了……");
					Member.m_ObjID = INVALID_ID;
				}
				else
				{
					Member.m_ObjID = ptempHuman->GetID();
				}
			}
			else
			{
				Member.m_ObjID = INVALID_ID;
			}

			newEntry = entry;
			newEntry.SetExtraID( Member.m_ObjID );

			pTeamInfo->AddMember( &Member );
			Msg.AddTeamMember( newEntry );
		}

		pGamePlayer->SendPacket( &Msg );

		GCNotifyTeamInfo notifyMsg;

		notifyMsg.SetObjID( pHuman->GetID() );
		notifyMsg.SetHaveTeamFlag( pTeamInfo->HasTeam() );

		if ( pTeamInfo->HasTeam() )
		{
			notifyMsg.SetTeamLeaderFlag( pTeamInfo->IsLeader() );
			notifyMsg.SetTeamFullFlag( pTeamInfo->IsFull() );
		}
		else
		{
			notifyMsg.SetTeamLeaderFlag( FALSE );
			notifyMsg.SetTeamFullFlag( FALSE );
		}

		if ( pHuman->getZoneID() != INVALID_ID )
		{
			pScene->BroadCast( &notifyMsg, pHuman );
		}

		g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamListHandler: GamePlayer (to:%d, GUID=%ld, TeamID=%d) ",
			pPacket->GetPlayerID(), pHuman->GetGUID(), pPacket->GetTeamID() );
	}
	else
	{
		Assert(FALSE);
	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
示例#10
0
UINT WGTeamResultHandler::Execute( WGTeamResult* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	PlayerID_t PlayerID = pPacket->GetPlayerID();
	GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
	if( pGamePlayer==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamResultHandler::Execute pGamePlayer==NULL" );
		return PACKET_EXE_CONTINUE;
	}

	Obj_Human* pHuman = pGamePlayer->GetHuman();
	Assert( pHuman );
	Scene* pScene = pHuman->getScene();
	if( !pScene )
	{
		g_pLog->FastSaveLog( LOG_FILE_3, "WGTeamResultHandler::Execute pHuman->getScene() == NULL" );
		return PACKET_EXE_CONTINUE;
	}

	if( pPlayer->IsServerPlayer() )
	{//服务器收到世界服务器发来的数据
		Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );

		pScene->SendPacket( pPacket, PlayerID );

		g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamResultHandler: ServerPlayer (Return=%d, GUID=%X, TeamID=%d) ",
			pPacket->GetReturn(), pPacket->GetGUID(), pPacket->GetTeamID() );

		return PACKET_EXE_NOTREMOVE;
	}
	else if( pPlayer->IsGamePlayer() )
	{//场景收到Cache里的消息
		Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

		TeamInfo* pTeamInfo = pHuman->GetTeamInfo();
		GCTeamResult tMsg;
		BOOL bNotifyTeamInfoFlag = FALSE;
		tMsg.SetReturn( pPacket->GetReturn() );
		tMsg.SetGUID( pPacket->GetGUID() );
		tMsg.SetTeamID( pPacket->GetTeamID() );
		tMsg.SetGUIDEx( pPacket->GetGUIDEx() );
		tMsg.SetSceneID( pPacket->GetSceneID() );
		tMsg.SetIcon( pPacket->GetIcon() );
		tMsg.SetName( pPacket->GetName() );
		tMsg.SetDataID( pPacket->GetDataID() );

		switch( pPacket->GetReturn() )
		{
		case TEAM_RESULT_TEAMREFRESH:
		case TEAM_RESULT_MEMBERENTERTEAM:
			{
				if( !pTeamInfo->HasTeam() )
				{
					pTeamInfo->SetTeamID( pPacket->GetTeamID() );
					pHuman->GetDB()->SetDBTeamID( pPacket->GetTeamID() ) ;
					pTeamInfo->SetMySceneID( pScene->SceneID() );
					bNotifyTeamInfoFlag = TRUE;
				}

				TEAMMEMBER Member;
				Member.m_GUID = pPacket->GetGUID();
				Member.m_SceneID = pPacket->GetSceneID();

				if ( Member.m_GUID == pGamePlayer->m_HumanGUID )
				{
					Member.m_ObjID = pHuman->GetID();
				}
				else if ( Member.m_SceneID == pScene->SceneID() )
				{
					GamePlayer* ptempGamePlayer = g_pPlayerPool->GetPlayer(pPacket->GetGUIDEx());
					Obj_Human* ptempHuman;

					if ( ptempGamePlayer == NULL )
					{
						Assert(FALSE && "队友失去了连接。");
					}
					else if ( (ptempHuman = ptempGamePlayer->GetHuman()) == NULL )
					{
						Assert(FALSE && "队友找不到了……");
					}
					else
					{
						Member.m_ObjID = ptempHuman->GetID();
					}
				}
				else
				{
					Member.m_ObjID = INVALID_ID;
				}

				tMsg.SetGUIDEx( Member.m_ObjID ); // 将队友的 ObjID 发出去
				pTeamInfo->AddMember( &Member );

				if ( pTeamInfo->IsFull() )
				{
					bNotifyTeamInfoFlag = TRUE;
				}
			}
			break;
		case TEAM_RESULT_MEMBERLEAVETEAM:
		case TEAM_RESULT_TEAMKICK:
		case TEAM_RESULT_LEADERLEAVETEAM:
			{
				if ( pTeamInfo->IsFull() )
				{ // 队伍不再满
					bNotifyTeamInfoFlag = TRUE;
				}

				if ( pGamePlayer->m_HumanGUID == pPacket->GetGUID() )
				{ // 自己主动离队
					if ( pHuman->__GetTeamFollowFlag() )
					{
						pHuman->__StopTeamFollow(FALSE);
					}

					pTeamInfo->DisMiss();
					pHuman->GetDB()->SetDBTeamID( INVALID_ID ) ;

					bNotifyTeamInfoFlag = TRUE;
				}
				else
				{
					pTeamInfo->DelMember( pPacket->GetGUID() );

					if ( pPacket->GetReturn() == TEAM_RESULT_LEADERLEAVETEAM
					  && pTeamInfo->IsLeader() // 队长退队后,自己变成新队长
					  )
					{
						GCReturnTeamFollow Msg;
						Msg.SetReturn(TF_RESULT_STOP_FOLLOW);
						Msg.SetGUID(pHuman->GetGUID());
						pGamePlayer->SendPacket(&Msg);

						bNotifyTeamInfoFlag = TRUE;
					}
				}
			}
			break;
		case TEAM_RESULT_TEAMDISMISS:
			{
				if ( pTeamInfo->IsLeader() )
				{ // 自己是队长
					if ( pHuman->__GetTeamFollowFlag() )
					{
						pHuman->__StopTeamFollow(FALSE);
					}
				}

				pTeamInfo->DisMiss();
				pHuman->GetDB()->SetDBTeamID( INVALID_ID ) ;
				bNotifyTeamInfoFlag = TRUE;
			}
			break;
		case TEAM_RESULT_TEAMAPPOINT:
			{
				if ( pTeamInfo->IsLeader() )
				{ // 自己是队长
					if ( pHuman->__GetTeamFollowFlag() )
					{
						pHuman->__StopTeamFollow();
					}

					bNotifyTeamInfoFlag = TRUE;
				}

				pTeamInfo->Appoint( pPacket->GetGUIDEx() );

				if ( pTeamInfo->IsLeader() )
				{ // 自己是队长了
					bNotifyTeamInfoFlag = TRUE;
				}
			}
			break;
		case TEAM_RESULT_STARTCHANGESCENE:
			{
				pTeamInfo->StartChangeScene( pPacket->GetGUID() );
			}
			break;
		case TEAM_RESULT_ENTERSCENE:
			{
				if ( pPacket->GetGUID() == pGamePlayer->m_HumanGUID )
				{ // 自己进入
					pTeamInfo->EnterScene( pGamePlayer->m_HumanGUID, pScene->SceneID(),
											pHuman->GetID() );

					if ( pHuman->__GetTeamFollowFlag() )
					{
						_FOLLOWEDMEMBER FollowedMember;

						FollowedMember.m_GUID = pHuman->GetGUID();
						FollowedMember.m_pHuman = pHuman;
						pHuman->__AddFollowedMember( FollowedMember );
					}
				}
				else
				{
					ObjID_t oid;

					if ( pPacket->GetSceneID() == pScene->SceneID() )
					{
						GamePlayer* ptempGamePlayer = g_pPlayerPool->GetPlayer(pPacket->GetGUIDEx());
						Obj_Human* ptempHuman;

						if ( ptempGamePlayer == NULL )
						{
							Assert(FALSE && "队友失去了连接。");
						}
						else if ( (ptempHuman = ptempGamePlayer->GetHuman()) == NULL )
						{
							Assert(FALSE && "队友找不到了……");
						}
						else
						{
							oid = ptempHuman->GetID();

							if ( ptempHuman->__GetTeamFollowFlag() )
							{
								_FOLLOWEDMEMBER FollowedMember;

								FollowedMember.m_GUID = ptempHuman->GetGUID();
								FollowedMember.m_pHuman = ptempHuman;
								pHuman->__AddFollowedMember( FollowedMember );
							}
						}
					}
					else
					{
						oid = INVALID_ID;
					}

					pTeamInfo->EnterScene( pPacket->GetGUID(), pPacket->GetSceneID(), oid );
					tMsg.SetGUIDEx( oid );
				}
			}
			break;
		case TEAM_RESULT_MEMBEROFFLINE:
			{
				pTeamInfo->MemberOffLine( pPacket->GetGUID() );

				GCTeamMemberInfo tmInfoMsg;
				tmInfoMsg.setGUID( pPacket->GetGUID() );
				tmInfoMsg.SetDeadLink( TRUE );

				pGamePlayer->SendPacket( &tmInfoMsg );

				g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamResultHandler: GUID=%X has lost connection.",
					pPacket->GetGUID() );
				return PACKET_EXE_CONTINUE;
			}
			break;
		default :
			{
				Assert(FALSE);
			}
			break;
		};

		pGamePlayer->SendPacket( &tMsg );

		if ( bNotifyTeamInfoFlag == TRUE )
		{
			GCNotifyTeamInfo notifyMsg;
			TeamInfo* pTeamInfo = pHuman->GetTeamInfo();

			notifyMsg.SetObjID( pHuman->GetID() );
			notifyMsg.SetHaveTeamFlag( pTeamInfo->HasTeam() );

			if ( pTeamInfo->HasTeam() )
			{
				notifyMsg.SetTeamLeaderFlag( pTeamInfo->IsLeader() );
				notifyMsg.SetTeamFullFlag( pTeamInfo->IsFull() );
			//	notifyMsg.SetTeamFollowFlag( pHuman->__GetTeamFollowFlag() );
			}
			else
			{
				notifyMsg.SetTeamLeaderFlag( FALSE );
				notifyMsg.SetTeamFullFlag( FALSE );
			//	notifyMsg.SetTeamFollowFlag( FALSE );
			}

			if ( pHuman->getZoneID() != INVALID_ID )
			{
				pScene->BroadCast( &notifyMsg, pHuman );
			}

			g_pLog->FastSaveLog( LOG_FILE_1, "BroadCast GCNotifyTeamInfo..............." );
		}

		g_pLog->FastSaveLog( LOG_FILE_1, "WGTeamResultHandler: GamePlayer (Return=%d, to:%d, GUID=%ld, TeamID=%d, GUIDEx=%X, SceneID=%d) ",
			pPacket->GetReturn(), pPacket->GetPlayerID(), pPacket->GetGUID(), pPacket->GetTeamID(), pPacket->GetGUIDEx(), pPacket->GetSceneID() );
	}
	else
	{
		Assert(FALSE);
	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}