当前位置: 首页>>代码示例>>C++>>正文


C++ Obj_Human类代码示例

本文整理汇总了C++中Obj_Human的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Human类的具体用法?C++ Obj_Human怎么用?C++ Obj_Human使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Obj_Human类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Assert

UINT CGBankMoneyHandler::Execute( CGBankMoney* 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 ) ;

    BYTE    IsSave = pPacket->GetSaveType();
    INT        Amount = pPacket->GetAmount();
    INT        AmountRMB = pPacket->GetAmountRMB();

    INT CurMoney = pHuman->__GetBankMoney();
    INT CurRMB = pHuman->GetBankRMB();

    if(IsSave & CGBankMoney::SAVE_MONEY)
    {
        if( Amount>(INT)(pHuman->GetMoney()) )
        {
            Amount = pHuman->GetMoney();
        }
        CurMoney += Amount;
        //将来要判一下是否大于银行能存的最大上限
        if(CurMoney>MAX_BANK_MONEY)
            CurMoney = MAX_BANK_MONEY;

        pHuman->__SetBankMoney(CurMoney);
        pHuman->SetMoney(pHuman->GetMoney() - Amount);

        MONEY_LOG_PARAM    MoneyLogParam;
        MoneyLogParam.CharGUID    =    pHuman->GetGUID();
        MoneyLogParam.OPType    =    MONEY_BANK_SAVE;
        MoneyLogParam.Count        =    Amount;
        MoneyLogParam.SceneID    =    pHuman->getScene()->SceneID();
        MoneyLogParam.XPos        =    pHuman->getWorldPos()->m_fX;
        MoneyLogParam.ZPos        =    pHuman->getWorldPos()->m_fZ;
        SaveMoneyLog(&MoneyLogParam);

    }
    else if(IsSave & CGBankMoney::PUTOUT_MONEY)
    {
        if(CurMoney - Amount < 0)
            Amount = CurMoney;

        pHuman->__SetBankMoney(CurMoney - Amount);
        pHuman->SetMoney(pHuman->GetMoney() + Amount);
        MONEY_LOG_PARAM    MoneyLogParam;
        MoneyLogParam.CharGUID    =    pHuman->GetGUID();
        MoneyLogParam.OPType    =    MONEY_BANK_WITHDRAW;
        MoneyLogParam.Count        =    Amount;
        MoneyLogParam.SceneID    =    pHuman->getScene()->SceneID();
        MoneyLogParam.XPos        =    pHuman->getWorldPos()->m_fX;
        MoneyLogParam.ZPos        =    pHuman->getWorldPos()->m_fZ;
        SaveMoneyLog(&MoneyLogParam);

    }
    else if(IsSave & CGBankMoney::UPDATE_MONEY)
    {
        Amount = CurMoney;
    }

    if( IsSave & CGBankMoney::SAVE_RMB )
    {
        if( AmountRMB > pHuman->GetRMB() )
        {
            AmountRMB = pHuman->GetRMB();
        }

        CurRMB += AmountRMB;
        if(CurRMB>MAX_BANK_RMB)
            CurRMB = MAX_BANK_RMB;

        pHuman->SetBankRMB(CurRMB);
        pHuman->SetRMB( pHuman->GetRMB() - AmountRMB );

        MONEY_LOG_PARAM    MoneyLogParam;
        MoneyLogParam.CharGUID    =    pHuman->GetGUID();
        MoneyLogParam.OPType    =    MONEY_BANK_SAVERMB;
        MoneyLogParam.Count        =    Amount;
        MoneyLogParam.SceneID    =    pHuman->getScene()->SceneID();
        MoneyLogParam.XPos        =    pHuman->getWorldPos()->m_fX;
        MoneyLogParam.ZPos        =    pHuman->getWorldPos()->m_fZ;
        SaveMoneyLog(&MoneyLogParam);
    }
    else if( IsSave & CGBankMoney::PUTOUT_RMB )
    {
        if(CurRMB - AmountRMB < 0)
            AmountRMB = CurRMB;
//.........这里部分代码省略.........
开发者ID:gangzi4494,项目名称:web-pap,代码行数:101,代码来源:CGBankMoneyHandler.cpp

示例2: Assert

uint CGExchangeApplyIHandler::Execute( CGExchangeApplyI* 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 ) ;

	ObjID_t		TargetID = pPacket->GetObjID();
	Obj_Human* pSourceHuman = pHuman;//交易发起者
	Obj_Human* pDestHuman = pScene->GetHumanManager()->GetHuman( TargetID );//交易对象

    if (pSourceHuman->IsInLoginProtectTime() || pDestHuman->IsInLoginProtectTime())
    {//在上线保护时间内,不可操作
        GCExchangeError Msg;
        Msg.SetID(EXCHANGE_MSG::ERR_IN_PROTECT_TIME);
        pGamePlayer->SendPacket(&Msg);
        g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeApplyIHandler: ID = %d or ID = %d ERR_IN_PROTECT_TIME", pSourceHuman->GetID(), pDestHuman->GetID()) ;

        return PACKET_EXE_CONTINUE;
    }

	//验证
	if( pDestHuman == NULL )
	{
		Assert(FALSE);
		return PACKET_EXE_CONTINUE;
	}
	INT iSettingData = pDestHuman->GetDB()->GetSetting(SETTING_TYPE_GAME)->m_SettingData;
	if(SETTINGFLAGISTRUE(iSettingData, GSF_REFUSE_TRADE))
	{
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_REFUSE_TRADE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeApplyIHandler: ID = %d ERR_REFUSE_TRADE", pSourceHuman->GetID()) ;
		return PACKET_EXE_CONTINUE;
	}
	if(pSourceHuman->m_ExchangBox.m_Status >= ServerExchangeBox::EXCHANGE_SYNCH_DATA)
	{//发起者正在交易中
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_SELF_IN_EXCHANGE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeApplyIHandler: ID = %d status = %d", pSourceHuman->GetID(), pSourceHuman->m_ExchangBox.m_Status) ;
		return PACKET_EXE_CONTINUE;
	}
	if(pDestHuman->m_ExchangBox.m_Status >= ServerExchangeBox::EXCHANGE_SYNCH_DATA)
	{//目标正在交易中
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_TARGET_IN_EXCHANGE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeApplyIHandler: ID = %d status = %d", pDestHuman->GetID(),	pDestHuman->m_ExchangBox.m_Status ) ;
		return PACKET_EXE_CONTINUE;
	}
	//在使用战斗技能时不能交易
	//在使用生活技能时不能交易 
	//战斗中不能交易add by gh 2010/04/28
	if(pSourceHuman->GetCharacterLogic() == CHARACTER_LOGIC_USE_SKILL || pSourceHuman->GetCharacterLogic() == CHARACTER_LOGIC_USE_ABILITY)
	{
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_SELF_USE_SKILL);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskChangeSceneHandler::使用技能中") ;
		return PACKET_EXE_CONTINUE ;
	}
	if(pDestHuman->GetCharacterLogic() == CHARACTER_LOGIC_USE_SKILL || pDestHuman->GetCharacterLogic() == CHARACTER_LOGIC_USE_ABILITY)
	{
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_TARGET_USE_SKILL);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskChangeSceneHandler::目标使用技能中") ;
		return PACKET_EXE_CONTINUE ;
	}
	//行走中不能交易
	if(pSourceHuman->IsMoving())
	{
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_SELF_MOVE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskChangeSceneHandler::移动中") ;
		return PACKET_EXE_CONTINUE ;
	}
	if(pDestHuman->IsMoving())
	{
		GCExchangeError Msg;
		Msg.SetID(EXCHANGE_MSG::ERR_TARGET_MOVE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskChangeSceneHandler::目标移动中") ;
		return PACKET_EXE_CONTINUE ;
	}
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: Assert

uint WGUpdateTitleHandler::Execute( WGUpdateTitle* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	PlayerID_t PlayerID = pPacket->GetPlayerID();
	GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
	if( pGamePlayer==NULL )
	{
		Assert(FALSE);
		return PACKET_EXE_CONTINUE;
	}

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

	Scene* pScene = pHuman->getScene();
	if( pScene==NULL ) return PACKET_EXE_CONTINUE ;

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

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

        //更新称号
        INT iType = pPacket->GetTitleType();

        switch (iType)
        {
        case _TITLE::GUOJIA_TITLE:
            {
                pHuman->SetCurCountryTitle(pPacket->GetTitleID());
                pHuman->UpdateTitlesToClient(GCCharAllTitles::UPDATE_CUR_GUOJIA_TITLE);

                if (pPacket->GetTitleSize() > 0)
                {
                    pHuman->SetCountryTitleName(pPacket->GetTitle(), pPacket->GetTitleSize());
                    pHuman->UpdateTitlesToClient(GCCharAllTitles::UPDATE_CUR_GUOJIA_TITLE);
                }
                break;
            }
        case _TITLE::BANGPAI_TITLE:
            {
                //这里只处理修改玩家帮会称号名字
                pHuman->SetCurGuildTitle(pPacket->GetTitleID());
                if (pPacket->GetTitleSize() > 0)
                {
                    pHuman->SetGuildTitleName(pPacket->GetTitle(), pPacket->GetTitleSize());
                    pHuman->UpdateTitlesToClient(GCCharAllTitles::UPDATE_BANGPAI_TITLE_NAME);
                    
                    //保存自定义称号
                    if (GUANZHI_TITLE_ID == pPacket->GetTitleID())
                    {
                        pHuman->GetDB()->SetOfficalTitleName(pPacket->GetTitle(), pPacket->GetTitleSize());
                    }
                }
                break;
            }
        case _TITLE::WANFA_TITLE:
            {
                pHuman->SetCurNormalTitle(pPacket->GetTitleID());
                pHuman->UpdateTitlesToClient(GCCharAllTitles::UPDATE_CUR_WANFA_TITLE);

                if (pPacket->GetTitleSize() > 0)
                {
                    pHuman->SetNormalTitleName(pPacket->GetTitle(), pPacket->GetTitleSize());
                    pHuman->UpdateTitlesToClient(GCCharAllTitles::UPDATE_CUR_WANFA_TITLE);
                }
                break;
            }
        }

		g_pLog->FastSaveLog( LOG_FILE_1, "WGUpdateTitleHandler Scuess! : GamePlayer (Guid=%d) ",
			pHuman->GetGUID());
	}
	else
	{
		Assert(FALSE);
	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:91,代码来源:WGUpdateTitleHandler.cpp

示例4: Assert

UINT CGPlayerShopEstablishHandler::Execute( CGPlayerShopEstablish* 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 ) ;

	CHAR* pszShopName		=	pPacket->GetShopName();
	BYTE  nShopNameSize		=	pPacket->GetShopNameSize();
	BYTE  nShopType			=	pPacket->GetType();
	SceneID_t sceneid		=	pScene->SceneID();
	GCPlayerShopError	MsgError;

	PlayerShopManager*	pPlayerShopManager = pScene->GetPlayerShopManager();
	pPlayerShopManager->ClampComFactor();
	FLOAT CommercialFactor = pPlayerShopManager->GetComFactor();
	UINT uCost = (UINT)(300000*CommercialFactor*2*1.03);

	//金钱验证
	if(uCost>pHuman->GetMoney())
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGPlayerShopApplyHandler::Name=%s Cost = %d Money = %d ", pHuman->GetName(), uCost, pHuman->GetMoney() ) ;
		MsgError.SetID(PLAYERSHOP_MSG::ERR_NOT_ENOUGH_MONEY_TO_NEW);
		pGamePlayer->SendPacket(&MsgError);
		return PACKET_EXE_CONTINUE ;
	}

	//需要再验证是不是已经建立满了商店了
	if(nShopType == PLAYERSHOP_MSG::TYPE_ITEM)
	{
		if( !pHuman->GetShopGuid(0).isNull() )
		{
			PlayerShop* pCurShop = pPlayerShopManager->GetPlayerShopByGUID(pHuman->GetShopGuid(0));
			if(!pCurShop)
			{
				pHuman->GetShopGuid(0).Reset();
			}
			else if(pCurShop->GetOwnerGuid() == pHuman->GetGUID())
			{
				g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGPlayerShopApplyHandler::Name=%s Can not create shop", pHuman->GetName()) ;
				MsgError.SetID(PLAYERSHOP_MSG::ERR_SHOP_ALREADY_EXIST);
				pGamePlayer->SendPacket(&MsgError);
				return PACKET_EXE_CONTINUE ;
			}
			else
			{
				pHuman->GetShopGuid(0).Reset();
			}
		}
	}
	else if(nShopType == PLAYERSHOP_MSG::TYPE_PET)
	{
		if( !pHuman->GetShopGuid(1).isNull() )
		{
			PlayerShop* pCurShop = pPlayerShopManager->GetPlayerShopByGUID(pHuman->GetShopGuid(1));
			if(!pCurShop)
			{
				pHuman->GetShopGuid(1).Reset();
			}
            else if(pCurShop->GetOwnerGuid() == pHuman->GetGUID())
			{
				g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGPlayerShopApplyHandler::Name=%s Can not create shop", pHuman->GetName()) ;
				MsgError.SetID(PLAYERSHOP_MSG::ERR_SHOP_ALREADY_EXIST);
				pGamePlayer->SendPacket(&MsgError);
				return PACKET_EXE_CONTINUE ;
			}
			else
			{
				pHuman->GetShopGuid(1).Reset();
			}
		}
	}
	else
	{
		Assert(0);
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGPlayerShopApplyHandler::Name=%s Can not create shop", pHuman->GetName(), uCost, pHuman->GetMoney() ) ;
		MsgError.SetID(PLAYERSHOP_MSG::ERR_SHOP_ALREADY_EXIST);
		pGamePlayer->SendPacket(&MsgError);
		return PACKET_EXE_CONTINUE ;
	}
	//...

	//重名验证
	for(UINT i =0; i<MAX_SHOP_NUM_PER_SCENE; i++)
	{
		PlayerShop* pTempShop = pPlayerShopManager->GetPlayerShopByIndex(i);
		if(!pTempShop)
		{
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:CGPlayerShopEstablishHandler.cpp

示例5: Assert

uint CGBBSApplyHandler::Execute( CGBBSApply* 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 ) ;
	ObjID_t ObjId	= pPacket->GetObjID();
	UINT Serial		= pPacket->GetSerial();

	Obj_Human* pTargetHuman = pScene->GetHumanManager()->GetHuman( ObjId );
	if( pTargetHuman == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGBBSApplyHandler::ObjID=%d, ObjId = %d"
			,pHuman->GetID(), ObjId) ;
		return PACKET_EXE_CONTINUE ;
	}
	
	if(pTargetHuman->m_StallBox.GetStallStatus() != ServerStallBox::STALL_OPEN)
	{
		GCStallError	Msg;
		Msg.SetID(STALL_MSG::ERR_CLOSE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGStallOpenHandler::ObjID=%d, ERR_CLOSE"
			,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE;
	}

	//从留言板中取出留言,并更新到客户端
	//摊主BBS
	ServerBBS*	pBBS			= pTargetHuman->m_StallBox.GetBBS();
	MessageEntry_t* pEntry		= NULL;
	GCBBSMessages::_MESSAGE_T	MessageList[MAX_BBS_MESSAGE_NUM];
	UINT k						= 0;
	GCBBSMessages	MsgBBS;

	
	if(Serial == pBBS->GetSerial())
	{//版本号相同,不用发新的了
		MsgBBS.SetObjID(pTargetHuman->GetID());
		MsgBBS.SetSerial(Serial);
	}
	else
	{//版本号不同发新的
		UINT	CurIndex = pBBS->GetFinalIndex();
		for(UINT i = 0; i<MAX_BBS_MESSAGE_NUM; i++)
		{
			pEntry = pBBS->GetMessageByIndex(CurIndex);
			if(pEntry)
			{
				MessageList[k].bHasReply		=	pEntry->bHasReply;
				MessageList[k].nID				=	pEntry->nID;
				MessageList[k].nHour			=	pEntry->nHour;
				MessageList[k].nMin				=	pEntry->nMin;
				MessageList[k].nMsgLength		=	pEntry->nMsgLength;
				MessageList[k].nReplyMsgLength	=	pEntry->nReplyMsgLength;
				MessageList[k].nReHour			=	pEntry->nReHour;
				MessageList[k].nReMin			=	pEntry->nReMin;

				memcpy(MessageList[k].AuthorName, pEntry->szAuthorName, MAX_BBS_MESSAGE_AUTHORLENGTH);
				memcpy(MessageList[k].szMessage, pEntry->szMessage, pEntry->nMsgLength);
				memcpy(MessageList[k].szReplyMessage, pEntry->szReplyMessage, pEntry->nReplyMsgLength);
				k++;
			}
			CurIndex++;
			if(CurIndex == MAX_BBS_MESSAGE_NUM)
				CurIndex = 0;
		}

		INT titleLength = 0;
		CHAR*	pszTitle = pBBS->GetBBSTitle(titleLength);

		MsgBBS.SetObjID(pTargetHuman->GetID());
		MsgBBS.SetSerial(pBBS->GetSerial());
		MsgBBS.SetTitleLength(titleLength);
		MsgBBS.SetTitle(pszTitle);
		MsgBBS.SetMessageNum(k);
		MsgBBS.SetMessageData(MessageList);
	}

	pGamePlayer->SendPacket(&MsgBBS);
	g_pLog->FastSaveLog( LOG_FILE_1, "CGStallOpenHandler::ObjID=%d"
		,pHuman->GetID()) ;
	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:100,代码来源:CGBBSApplyHandler.cpp

示例6: Execute

uint WGNotifyUserHandler::Execute( WGNotifyUser* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GUID_t sGuid = pPacket->GetGUID() ;
	Obj_Human* pHuman = (Obj_Human*)(g_pGUIDManager->Get(sGuid)) ;
	if( pHuman==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: pHuman==NULL GUID=%X",
			sGuid ) ;
		goto CHECK_RECYCLE_GUID;
	}

	GamePlayer* pGamePlayer = (GamePlayer*)(pHuman->GetPlayer()) ;
	if( pGamePlayer==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: pGamePlayer==NULL GUID=%X",
			sGuid ) ;
		goto CHECK_RECYCLE_GUID;
	}

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: pScene==NULL GUID=%X",
			sGuid ) ;
		goto CHECK_RECYCLE_GUID;
	}

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

		PlayerID_t PlayerID = pHuman->GetPlayerID() ;
		pScene->SendPacket( pPacket, PlayerID ) ;

		g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: ServerPlayer GUID=%X",
			sGuid ) ;

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

		if( pPacket->GetStatus() == WGNotifyUser::NUS_WORLD_KICK_REQUEST||
			pPacket->GetStatus() == WGNotifyUser::NUS_REMOVE)
		{
			GWNotifyUser* pGMsg = (GWNotifyUser*)(g_pPacketFactoryManager->CreatePacket(PACKET_GW_NOTIFYUSER)) ;
			pGMsg->SetGUID(pPacket->GetGUID());
			pGMsg->SetPlayerID(-1);
			pGMsg->SetStatus(GWNotifyUser::NUS_NEED_WORLD_KICK);
			g_pServerManager->SendPacket( pGMsg, INVALID_ID ) ;

			g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: GamePlayer GUID=%X WGNotifyUser::NUS_WORLD_KICK_REQUEST kick receive!",
				sGuid ) ;
			return PACKET_EXE_ERROR ;
		}
		else if( pPacket->GetStatus() == WGNotifyUser::NUS_CANNOTSAY )
		{//禁言
			//pHuman->CannotSay( pPacket->GetTime() ) ;

			//CHAR szNotify[MAX_CHAT_SIZE] ;
			//if( pPacket->GetTime() > 0 )
			//{
			//	// 10级(含)以下玩家禁言不在世界频道发公告....
			//	if ( pHuman->GetLevel() > 10 )
			//	{
			//		sprintf( szNotify, _TXT2((148),"#{_INFOUSR%s}玩家由于违反游戏规则,已经被禁言%d分钟"), 
			//			pHuman->GetName(), pPacket->GetTime()/60000 );
			//		GWChat* pChatPacket = (GWChat*)(g_pPacketFactoryManager->CreatePacket(PACKET_GW_CHAT)) ;
			//		pChatPacket->SetSourGUID( pGamePlayer->m_HumanGUID ) ;
			//		pChatPacket->SetChatType( CHAT_TYPE_SYSTEM ) ;
			//		pChatPacket->SetContexSize( (BYTE)(strlen(szNotify)) ) ;
			//		pChatPacket->SetContex( szNotify ) ;
			//		g_pServerManager->SendPacket( pChatPacket, INVALID_ID ) ;
			//		g_pLog->FastSaveLog( LOG_FILE_12, "ChatType=4 4 Contex=%s", szNotify ) ;
			//	}
		//	}
			//else
			//{
			//	sprintf( szNotify, _TXT2((149),"角色发言功能已经回复,请自觉遵守游戏规则,祝您游戏愉快!"));
			//	GCChat* pChatPacket = (GCChat*)(g_pPacketFactoryManager->CreatePacket(PACKET_GC_CHAT)) ;
			//	pChatPacket->SetChatType( CHAT_TYPE_SYSTEM ) ;
			//	pChatPacket->SetContexSize( (BYTE)(strlen(szNotify)) ) ;
			//	pChatPacket->SetContex( szNotify ) ;
			//	pChatPacket->SetSourNameSize( 0 ) ;
			//	pGamePlayer->SendPacket( pChatPacket ) ;
			//}
			//g_pLog->FastSaveLog( LOG_FILE_1, "WGNotifyUserHandler: GamePlayer GUID=%X WGNotifyUser::NUS_CANNOTSAY!",
			//	sGuid ) ;
	}
	}

	return PACKET_EXE_CONTINUE ;

CHECK_RECYCLE_GUID:
	//向World 发送一个踢人的回应包,仅能依靠GUIDManager
	GWNotifyUser* nGMsg = (GWNotifyUser*)(g_pPacketFactoryManager->CreatePacket(PACKET_GW_NOTIFYUSER)) ;
	nGMsg->SetGUID(pPacket->GetGUID());
//.........这里部分代码省略.........
开发者ID:gitrider,项目名称:wxsj2,代码行数:101,代码来源:WGNotifyUserHandler.cpp


注:本文中的Obj_Human类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。