Exemple #1
0
VOID CTeamOrGroup::FillMyInfo(TeamMemberInfo* member)
{
	Assert( member );

	CObject_PlayerMySelf* pMe = CObjectManager::GetMe()->GetMySelf();

	Assert( member->m_GUID == pMe->GetServerGUID() );

	CCharacterData* pMyData = pMe->GetCharacterData();

	if(NULL == pMyData)
	{
		return ;
	}
	strncpy(member->m_szNick, pMyData->Get_Name(), MAX_CHARACTER_NAME-1);
	std::string utfstr;
	StringConvert::mbcs_to_utf8(member->m_szNick,utfstr);
	strncpy(member->m_szUtf8Nick,utfstr.c_str(),MAX_CHARACTER_NAME*2-1);
	member->m_szNick[MAX_CHARACTER_NAME-1] = '\0';
	member->m_szUtf8Nick[MAX_CHARACTER_NAME*2-1];

	member->m_uFamily		= pMyData->Get_MenPai();
	member->m_uDataID		= pMyData->Get_RaceID();
	member->m_uLevel		= pMyData->Get_Level();
	member->m_nPortrait		= pMyData->Get_PortraitID();	// 头像
	member->m_WorldPos.m_fX = pMe->GetPosition().x;
	member->m_WorldPos.m_fZ = pMe->GetPosition().z;
	member->m_nHP			= pMyData->Get_HP();
	member->m_dwMaxHP		= pMyData->Get_MaxHP();
	member->m_nMP			= pMyData->Get_MP();
	member->m_dwMaxMP		= pMyData->Get_MaxMP();
	member->m_nAnger		= pMyData->Get_Rage();		// 怒气

	member->m_WeaponID		= pMyData->Get_Equip(HEQUIP_MAINHAND);
	member->m_AssiID		= pMyData->Get_Equip(HEQUIP_ASSIHAND);
	member->m_CapID			= pMyData->Get_Equip(HEQUIP_HEAD);
	member->m_ArmourID		= pMyData->Get_Equip(HEQUIP_BACK);
	member->m_ShoulderID	= pMyData->Get_Equip(HEQUIP_SHOULDER);
	member->m_CuffID		= pMyData->Get_Equip(HEQUIP_WRIST);
	member->m_FootID		= pMyData->Get_Equip(HEQUIP_FEET);

	member->m_uFaceMeshID = pMyData->Get_FaceMesh();
	member->m_uHairMeshID = pMyData->Get_HairMesh();
	member->m_uHairColor  = pMyData->Get_HairColor();

	member->m_bDead			= ( pMe->CharacterLogic_Get( CObject_Character::LOGIC_BASE ) == CObject_Character::CHARACTER_LOGIC_DEAD );
}
Exemple #2
0
VOID CSoundSystemFMod::Tick(VOID)
{
#if 0
	//------------------------------------
	//刷新听者位置
	CObject_PlayerMySelf* pMySelf = CObjectManager::GetMe()->GetMySelf();
	if(pMySelf)
	{
		Listener_SetPos(pMySelf->GetPosition());
	}

	//------------------------------------
	//更新声音源音量
	std::list< SOUND_SOURCE >::iterator it;
	std::list< SOUND_SOURCE >::iterator itNext;
	for(it = m_listSoundSource.begin(); it!=m_listSoundSource.end(); it=itNext)
	{
		itNext = it; itNext++;

		SOUND_SOURCE& theSnd = *it;

		//如果是自动销毁的声音源,自动销毁
		theSnd.pSoundSource->UpdateStatus();
		if(theSnd.bAutoDestroy && theSnd.pSoundSource->IsStopped())
		{
			delete theSnd.pSoundSource;
			m_listSoundSource.erase(it);
			continue;
		}

		//更新音量
		theSnd.pSoundSource->UpdateVolume();
	}

	//------------------------------------
	//如果窗口非激活,静音
	if(!CGameProcedure::IsWindowActive() && !m_bMuteAll)
	{
		MuteAll(TRUE);
	}
	else if(CGameProcedure::IsWindowActive() && m_bMuteAll)
	{
		MuteAll(FALSE);
	}
#endif
}
Exemple #3
0
VOID CTeamOrGroup::AddMember(TeamMemberInfo* member, TeamID_t TeamID, BYTE TeamIndex)
{
	TeamMemberInfo* pTMInfo = new TeamMemberInfo;
	//memcpy((VOID*)pTMInfo, member, sizeof(TeamMemberInfo));

	pTMInfo->m_GUID			= member->m_GUID;
	pTMInfo->m_OjbID		= member->m_OjbID;						//
	pTMInfo->m_SceneID		= member->m_SceneID;
	pTMInfo->m_uFamily		= member->m_uFamily;					// 2.职业
	pTMInfo->m_uDataID		= member->m_uDataID;					// 3.性别
	pTMInfo->m_nPortrait	= member->m_nPortrait;					// 5.头像
	memcpy(pTMInfo->m_szNick, member->m_szNick, sizeof(pTMInfo->m_szNick));
	
	std::string utfstr;
	StringConvert::mbcs_to_utf8(pTMInfo->m_szNick,utfstr);
	strncpy(pTMInfo->m_szUtf8Nick,utfstr.c_str(),MAX_CHARACTER_NAME*2-1);
	CObject_PlayerMySelf* pObj = CObjectManager::GetMe()->GetMySelf();

	if( pTMInfo->m_GUID != pObj->GetServerGUID() )
	{ // 需要加载队友的头像窗口
		// 请求该队友的数据
		CGAskTeamMemberInfo Msg;
		Msg.SetSceneID( pTMInfo->m_SceneID );
		Msg.setObjID( pTMInfo->m_OjbID );
		Msg.SetGUID( pTMInfo->m_GUID );

		CNetManager::GetMe()->SendPacket( &Msg );
	}
	else
	{
		FillMyInfo( pTMInfo );
	}

	switch(m_Type)
	{
	// 创建队伍
	case 0:
		{
			CreateTeam(pTMInfo, TeamID);
		}
		break;

	// 队伍加人的情况
	case TEAM_TYPE:
		{ 
			if( m_TeamMembers.size() >= MAX_TEAM_MEMBER )	// 最大的队伍人数
			{
				Assert(FALSE);
				return;
			}

			m_TeamMembers.push_back(pTMInfo);
		}
		break;

	// 团队加人的情况
	case GROUP_TYPE:
		{ 
			if( TeamIndex < 0 || TeamIndex >= MAX_TEAMS_IN_GROUP )	// 团队中最大队伍数量
			{
				Assert(FALSE);
				return;
			}

			++TeamIndex; // 默认传入的数字为 0 ~ MAX_TEAMS_IN_GROUP-1

			TeamInfo* pTeamInfo = GetTeam(TeamIndex);

			if(pTeamInfo != NULL)
			{
				if(pTeamInfo->m_TeamMembers.size() >= MAX_TEAM_MEMBER)
				{
					Assert(FALSE);
					return;
				}
			}
			// 如果该小组不存在,则创建,并添加入团队
			else
			{
				pTeamInfo = new TeamInfo;
				pTeamInfo->m_TeamID = TeamIndex;
				m_TeamInfo.push_back(pTeamInfo);

				//队伍满
				if(pTeamInfo->m_TeamMembers.size() >= MAX_TEAM_MEMBER)
				{
					CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_TeamFullFlag(TRUE);
				}
			}

			pTeamInfo->m_TeamMembers.push_back(pTMInfo);

			if( pTMInfo->m_GUID == pObj->GetServerGUID() )
			{
				m_MyTeamID = TeamIndex;
			}
		}
		break;

	default:
		Assert(FALSE);
		return;
	}



	// 创建一个界面的模型.
	pTMInfo->m_UIModel.CreateNewUIModel();
	
	// 设置ui模型

	// 设置职业
	pTMInfo->m_UIModel.m_pAvatar->GetCharacterData()->Set_MenPai( pTMInfo->m_uFamily );
	// 设置性别
	pTMInfo->m_UIModel.m_pAvatar->GetCharacterData()->Set_RaceID( pTMInfo->m_uDataID );
	
}
VOID CActionItem_Skill::DoAction( VOID )
{
	// 获取将使用的技能
	const SCLIENT_SKILL* pSkill = GetSkillImpl();
	if( !pSkill )
		return;

	INT idUser = -1;
	CObject_PlayerMySelf *pMySelf = CObjectManager::GetMe()->GetMySelf();
	if( !pMySelf )
		return; 

	idUser = pMySelf->GetID();	
	
	// 自动打怪,连续施放的技能
	if (TRUE == pSkill->m_pDefine->m_bAutoRedo)
	{
		tActionItem* pItem = CGameInterface::GetMe()->Skill_GetActive();
		// 有激活技能
		if (pItem)
		{
			// 当前技能正在激活中
			if (pItem->GetID() == GetID())
			{
				// 此次操作为关闭操作
				CGameInterface::GetMe()->Skill_SetActive( CActionSystem::GetMe()->GetMyDefaultSkillAtion() );
				
				// 关闭自动打怪
				CAI_MySelf* pMySelfAI = (CAI_MySelf*)( pMySelf->CharacterLogic_GetAI() );
				if( pMySelfAI )
					pMySelfAI->m_bCurrSkill  = FALSE;			

				return;
			}
			else
			{
				// 选中状态
				AutoKeepOn();
			}
		}
		// 没有激活技能
		else
		{
			// 选中状态
			AutoKeepOn();
		}
	}
	// 单次施放的技能
	else
	{
		// 瞬发技能不会打断自动技能
		if (FALSE == pSkill->m_pDefine->m_nImmediately)
		{
			CAI_MySelf* pMySelfAI = (CAI_MySelf*)( pMySelf->CharacterLogic_GetAI() );
			if( pMySelfAI )
				pMySelfAI->m_bCurrSkill  = FALSE;
		}		
	}

	// 进行技能使用的条件判断
	// 是否学会、冷却时间、消耗
	{

		ORESULT oResult;
		// 是否已经学会
		oResult = pSkill->IsCanUse_Leaned();
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

		// 检查冷却是否结束
		oResult = pSkill->IsCanUse_CheckCoolDown();
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

		// 消耗检测
		oResult = pSkill->IsCanUse_CheckDeplete( idUser );
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

	}


	//================
	// 根据鼠标选择操作类型
	switch( pSkill->m_pDefine->m_nSelectType )	// 此类型从表中读出
	{
	case SELECT_TYPE_NONE:	// 无需选择,直接施放(以自己为中心的范围自动攻击)
		{
			// id,位置,方向
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_CHARACTER:	// 选择角色
		{
			// 有无选择主目标
			if( CObjectManager::GetMe()->GetMainTarget() )
			{
				// id,目标id
				CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), CObjectManager::GetMe()->GetMainTarget()->GetServerID());
			}
			else
			{
				// 无选择目标提示信息
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( OR_NO_TARGET ) );
			}

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_POS:	// 以鼠标的位置为中心的范围攻击
		{
			// id,
			//CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(this);
		}
		break;

	case SELECT_TYPE_DIR:	// 方向(扇形)

		// 人物的方向技能使用
		//CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

		CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		break;

	case SELECT_TYPE_SELF:	// 对自己进行操作	
		{
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), CObjectManager::GetMe()->GetMySelf()->GetServerID());
			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_HUMAN_GUID:	// 其他玩家
		{
			// 当前是否已经选择了一个队友
			GUID_t guid;
			CObjectManager::GetMe()->GetMainTarget(guid);
			if(guid == (GUID_t)-1)
			{
				// 尚未选择合法的对象
				STRING strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_Invalidate_Target");
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				return;
			}

			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), (GUID_t)guid);
			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	}
}
VOID CActionItem_Skill::DoAction(VOID)
{
	const SCLIENT_SKILL* pSkill = GetSkillImpl();
	if(!pSkill) return;

	ORESULT oResult;
	// 
	oResult = pSkill->IsCanUse_Leaned();
	if ( OR_FAILED( oResult ) )
	{
		CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
		return ;
	}
	////检查冷却是否结束
	oResult = pSkill->IsCanUse_CheckCoolDown();
	if ( OR_FAILED( oResult ) )
	{
		CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
		return ;
	}

	// 消耗检测
	INT idUser;
	CObject_PlayerMySelf *pMySelf = CObjectManager::GetMe()->GetMySelf( );
	idUser = (pMySelf)?(pMySelf->GetID()):(INVALID_ID);

	oResult = pSkill->IsCanUse_CheckDeplete( idUser );
	if ( OR_FAILED( oResult ) )
	{
		CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
		return ;
	}

	//如果是连续的那么就换为选中状态。
	AutoKeepOn();
	//根据操作类型
	switch(pSkill->m_pDefine->m_nSelectType)
	{
	case SELECT_TYPE_NONE:	
		{
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID());
			//恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	case SELECT_TYPE_CHARACTER:	
		{
			if(CObjectManager::GetMe()->GetMainTarget())
			{

				CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), 
					CObjectManager::GetMe()->GetMainTarget()->GetServerID());
			}
			else
			{
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( OR_NO_TARGET ) );
			}
			//恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	case SELECT_TYPE_POS:
		CActionSystem::GetMe()->SetDefaultAction(this);
//		CGameProcedure::s_pGameInterface->Skill_SetActive(this);
		break;
	case SELECT_TYPE_DIR:
		CActionSystem::GetMe()->SetDefaultAction(this);
//		CGameProcedure::s_pGameInterface->Skill_SetActive(this);
		break;
	case SELECT_TYPE_SELF:		
		{
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), 
				CObjectManager::GetMe()->GetMySelf()->GetServerID());
			//恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	case SELECT_TYPE_HUMAN_GUID:
		{
			//当前是否已经选择了一个队友
			GUID_t guid;
			CObjectManager::GetMe()->GetMainTarget(guid);
			if(guid == (GUID_t)-1)
			{
				//尚未选择合法的对象
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, "无效目标");
				return;
			}

			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), (GUID_t)guid);
			//恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	}
}