Esempio n. 1
0
//发送技能开始消息
void COpSendMsg::CreateSkillBeginMsg()
{
	//发送锁定物品信息
	if (m_pParam->lContainerID!=0)
	{
		SendLockGoodsMsg();	
	}
	if (m_pParam->pUser->GetState()==CShape::STATE_PEACE && m_pParam->eAddSubType==eSub_Type)
	{
		m_pParam->pUser->ChangeStateTo(CShape::STATE_FIGHT);
	}
	CMessage msg(MSG_S2C_SKILL_USE);
	msg.Add((CHAR)SKILL_USE_RESULT_BEGIN);//"##表示条件满足,开始使用技能"
	msg.Add( m_pParam->pUser -> GetExID() );
	msg.Add( m_pParam->pUser->GetDirEx());
	//全局id
	msg.Add(m_pParam->dwGlobleID);
	//id和等级
	msg.Add((long)m_pParam->nID);
	msg.Add((BYTE)m_pParam->nLvl );
	//当前技能执行到的阶段
	msg.Add((BYTE)(m_pParam->nProceNum+1));
	//阶段耗时
	msg.Add((long)m_pParam->lUseTime);
	//冷却时间
	msg.Add((long)m_pParam->lCoolDownTime);

	//添加鼠标点位置
	if (m_pParam->pMouseShape)
	{
		msg.Add((short)m_pParam->pMouseShape->GetTileX());
		msg.Add((short)m_pParam->pMouseShape->GetTileY());	
	}
	else
	{
		msg.Add((short)m_pParam->nMouseX);
		msg.Add((short)m_pParam->nMouseY);	

	}

	//添加作用目标对象集合
	DWORD dwSize = (DWORD)m_pParam->OperObjs.size();
	msg.Add((BYTE)dwSize);
	itDestObj it = m_pParam->OperObjs.begin();
	for(;it != m_pParam->OperObjs.end();it++)
	{
		msg.Add((*it)->nDestType);
		msg.Add((*it)->DestID);
	}
	if(m_eRange == MsgRange_Single )
		msg.SendToPlayer(m_pParam->pUser -> GetExID(),false);
	else if(m_eRange == MsgRange_Around)
	{
		CServerRegion* pRegion = dynamic_cast<CServerRegion*>(m_pParam->pUser->GetFather());
		if(pRegion)
		{
			pRegion->FindLimitPlayersAround(m_pParam->pUser,GlobalSetup::GetSetup()->lSendSkillMsgLimitPlayerNum,m_pParam->SendMsgPlayers,NULL_GUID);
			GetGame()->RemoveTransferCongPlayerID(m_pParam->SendMsgPlayers);
		}
		msg.SendToPlayers(m_pParam->SendMsgPlayers);
	}
#ifdef _DEBUG
	long lTime = timeGetTime();
	Log4c::Trace(ROOT_MODULE, "发送技能开始消息:技能ID:%6d,全局ID:%6d,时间%d,阶段号:%d",m_pParam->nID,m_pParam->dwGlobleID,timeGetTime(),m_pParam->nProceNum);
#endif

}