uint GCManualAttrResultHandler::Execute(GCManualAttrResult* pPacket,Player* pPlayer)
{
	__ENTER_FUNCTION
		
		ATTR_RESUlT res = pPacket->GetResult();
		switch(res)
		{
		case ATTR_RESUlT_SUCCESS:
			{
				CGameProcedure::s_pEventSystem->PushEvent( GE_MANUAL_ATTR_SUCCESS_EQUIP );

				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GCManualAttriResultHandler_Info_Addjust_Attr_Success");
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "调整属性成功." );
				break;
			}
		case ATTR_RESULT_NOT_ENOUGH_REMAIN_POINT:
			{

				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GCManualAttriResultHandler_Info_Addjust_Attr_Fail_No_Enough_point");
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "调整属性失败,没有足够的点数." );
				break;
			}
		case ATTR_RESULT_NO_SUCH_ATTR:
			{
				
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GCManualAttriResultHandler_Info_Addjust_Attr_Fail_No_This_Attri");
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "调整属性失败, 没有这个属性." );
				break;
			}
		case ATTR_RESUlT_NO_POINT:
			{

				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GCManualAttriResultHandler_Info_Addjust_Attr_Fail_No_Enough_point");
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "调整属性失败,没有足够的点数." );
				break;
			}

		default:
			{
				break;
			}
		}

		
		return PACKET_EXE_CONTINUE;

	__LEAVE_FUNCTION	

		return PACKET_EXE_ERROR;
}
	// 询问是否删除角色
	INT CGameProduce_Login::DelRole_YesNo(LuaPlus::LuaState* state)
	{

		LuaStack args(state);
		if (!(args[2].IsInteger()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");
		}

		int iRoleIndex = args[2].GetInteger();
		CGameProcedure::s_pProcCharSel->m_iCurSelRoleDel = iRoleIndex;
		std::vector< STRING > strParamInfo;

		if(CGameProcedure::s_pProcCharSel->IsValidIndex(iRoleIndex))
		{
			// 
			std::string strInfo = ""; 
			// 通过索引得到角色的信息
			const DB_CHAR_BASE_INFO* pInfo = CGameProcedure::s_pProcCharSel->GetRoleInfo(iRoleIndex);
			if(pInfo)
			{
				//if(pInfo->m_Level < 9)
				{
					TCHAR szBuf[128];
					STRING strTemp = "";
					strTemp = NOPARAMMSGFUNC("GMGameInterface_Script_GameLogin_Info_Del_Role_YesNo");
					_stprintf(szBuf, strTemp.c_str(), pInfo->m_Level, pInfo->m_Name);
					//_stprintf(szBuf, _T("你确定要将 %d级 的角色#c00ff00 %s #cffffff删除吗?"), pInfo->m_Level, pInfo->m_Name);
					strParamInfo.push_back(szBuf);
					strParamInfo.push_back("1");

					((CEventSystem*)CGameProcedure::s_pEventSystem)->PushEvent( GE_GAMELOGIN_SYSTEM_INFO_YESNO, strParamInfo);
				}
				//else
				//{
				//	STRING strTemp = "";
				//	strTemp = NOCOLORMSGFUNC("CGameProduce_Login_Can_Not_Del_Level_Over_9");
				//	CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
				//}//
			}
			else
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_GameLogin_Info_Sel_Del_Role");
				CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
				//CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, "请选择一个要删除的角色.");
			}//
		}
		else
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_GameLogin_Info_Sel_Del_Role");
			CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
			//CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, "请选择一个要删除的角色.");
		}
		
		return 0;
	}
	//宠物改名字
	INT	Pet::Change_Name(LuaPlus::LuaState* state)
	{
		LuaStack args(state);

		if ( !(args[2].IsInteger()) || !(args[3].IsString()) )
		{
			KLThrow("LUA:Pet Change_Name parameter error");
		}

		INT nPetNum = args[2].GetInteger();
		LPCTSTR szName = args[3].GetString();
		STRING szTemp="";

		SDATA_PET* My_Pet= CDataPool::GetMe()->Pet_GetPet(nPetNum);
		if( (!My_Pet) || ( !My_Pet->m_pModelData ) ) 
		{
			KLThrow("LUA:Pet Change_Name parameter error");
			return 0;
		}
		if(CGameProcedure::s_pUISystem->CheckStringFilter(szName, FT_NAME) == FALSE)
		{
			
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_Talk_Info_InvalidContent");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,strTemp.c_str());
			return 0;

		}
		else if(CGameProcedure::s_pUISystem->CheckStringCode(szName,szTemp) == FALSE)
		{

			return 0;

		}
		else if(KLU_CheckStringValid(szName) == FALSE)
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("ERRORSpecialString");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,strTemp.c_str());
			return 0;
		}
		//向服务器发送
		CGSetPetAttrib Msg;
		if(strcmp(szName, My_Pet->m_szName.c_str()) != 0)
		{
			Msg.SetGUID(My_Pet->m_GUID);
//			Msg.SetIndex(nPetNum);		
			Msg.SetName((CHAR*)szName);
			CNetManager::GetMe()->SendPacket(&Msg);
		}
		return 0;
	}
Exemple #4
0
// 得到宝石属性信息
LPCTSTR	CObject_Item_Gem::GetGemArribInfo()
{
	
	static TCHAR szAttribInfo[1024];
	TCHAR	szInfo[512];

	memset(szAttribInfo, 0, sizeof(szAttribInfo));
	STRING strAttrib = _T("");

	STRING strTemp = "";
		
	if(m_theBaseDef)
	{
		for(int i = 0; i < 60; i++)
		{
			memset(szInfo, 0, sizeof(szInfo));
			if(-1 != m_theBaseDef->nAttr[i])
			{
				strTemp = NOCOLORMSGFUNC(g_szGemAttName[i]);
				_stprintf(szInfo, _T("%s+%d\n"), strTemp.c_str(), m_theBaseDef->nAttr[i]);
				//_stprintf(szInfo, _T("%s:%d\n"), g_szGemAttName[i], m_theBaseDef->nAttr[i]);
				strAttrib += szInfo;
			}
		}

		_stprintf(szAttribInfo, _T("%s"), strAttrib.c_str());
		return szAttribInfo;
	}

	return szAttribInfo;


}
	//宠物参战
	INT	Pet::Go_Fight(LuaPlus::LuaState* state)
	{
		LuaStack args(state);

		if ( !args[2].IsInteger() )
		{
			KLThrow("LUA:Pet Go_Fight parameter error");
		}

		INT nPetNum = args[2].GetInteger();

		SDATA_PET* My_Pet= CDataPool::GetMe()->Pet_GetPet(nPetNum);
		if( (!My_Pet) || ( !My_Pet->m_pModelData ) ) 
		{
			KLThrow("LUA:Pet Go_Fight parameter error");
			return 0;
		}
		// 如果自己正在摆摊,不能出战
		if(TRUE == CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_IsInStall())
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("GMAI_Base_Info_You_Stalling");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
			//CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,"你正在摆摊……");
			return 0;
		}
		//向服务器发送
		CGManipulatePet Msg;

		Msg.SetGUID(My_Pet->m_GUID);
		Msg.SetManipulateType( MANIPULATE_CREATEPET );
		CNetManager::GetMe()->SendPacket(&Msg);
		return 0;
	}
	// 更改摊位名字
	INT StallSale::ModifStallName(LuaPlus::LuaState* state)
	{
		LuaPlus::LuaStack args(state);
		if (!(args[2].IsString()))
		{
			TDThrow("LUA:StallSale::ModifStallName[2] param parameter error");
			return 0;
		}
		std::string str	= args[2].GetString();

		//过虑不能使用的字
		//验证商店名称的合法性
		if(!CGameProcedure::s_pUISystem->CheckStringFilter(str))
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("ERRORSpecialString");
			CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
			return 0;
		}
		//验证商店名称的合法性
		if(!TDU_CheckStringValid(str.c_str()))
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("ERRORSpecialString");
			CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
			return 0;
		}


		if(str.size() > MAX_STALL_NAME)
		{
			str.resize(MAX_STALL_NAME);
		}
		CGStallShopName msg;
		msg.SetStallName((CHAR*)str.c_str());
		msg.SetStallNameSize((BYTE)str.size());
		CNetManager::GetMe()->SendPacket(&msg);
		
		return 0;
	}
	// 询问是否退到帐号输入界面
	INT CGameProduce_Login::ExitToAccountInput_YesNo(LuaPlus::LuaState* state)
	{
		std::vector< STRING > strParamInfo;
		STRING strTemp = "";
		strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_GameLogin_Info_Exit_To_Account_Input_YesNo");
		strParamInfo.push_back(strTemp.c_str());

		//strParamInfo.push_back("确定退到帐号输入界面吗?");
		strParamInfo.push_back("2");
		// 
		((CEventSystem*)CGameProcedure::s_pEventSystem)->PushEvent( GE_GAMELOGIN_SYSTEM_INFO_YESNO, strParamInfo);
		return 0;
	}
	// 从人物选择界面切换到人物创建界面
	INT CGameProduce_Login::ChangeToCreateRoleDlgFromSelectRole(LuaPlus::LuaState* state)
	{
		
		if(CGameProcedure::s_pProcCharSel)
		{
			if(CGameProcedure::s_pProcCharSel->GetCurRoleCount() >= 3)
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("LCRetCreateCharHandler_Info_Role_Is_Full");
				CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
				return 0;
			}
			CGameProcedure::s_pProcCharSel->ChangeToCreateRole();
		}
		return 0;
	}
VOID CTripperObject_ItemBox::Initial(VOID*)
{
	if( m_pRenderInterface == NULL )
	{
		// 创建渲染层实体
		m_pRenderInterface = CGameProcedure::s_pGfxSystem->New_EntityObject(tEntityNode::ETYPE_ACTOR);

		STRING strTemp = "";
		strTemp = NOCOLORMSGFUNC("Obj_ItemBox_Info_MuXiang");
		m_pRenderInterface->Actor_SetFile(strTemp.c_str());

		// 设置选择优先级
		m_pRenderInterface->RayQuery_SetLevel(tEntityNode::RL_ITEMBOX);

		m_pRenderInterface->SetData(GetID());
	}
}
	//宠物放生
	INT	Pet::Go_Free(LuaPlus::LuaState* state)
	{
		LuaStack args(state);

		if ( !args[2].IsInteger() )
		{
			KLThrow("LUA:Pet Go_Free parameter error");
		}

		INT nPetNum = args[2].GetInteger();

		SDATA_PET* My_Pet= CDataPool::GetMe()->Pet_GetPet(nPetNum);
		if( (!My_Pet) || ( !My_Pet->m_pModelData ) ) 
		{
			KLThrow("LUA:Pet Go_Free parameter error");
			return 0;
		}
		if( CGameProcedure::s_pUISystem->IsWindowShow("ProgressBar") )
		{
			STRING strMsg = COLORMSGFUNC("GMGameInterface_Script_Pet_CantFree");
			//ADDTALKMSG(strMsg);
			ADDNEWDEBUGMSG(strMsg);
			return 0;
			
		}
		// 如果自己正在摆摊,不能放生
		if(TRUE == CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_IsInStall())
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("GMAI_Base_Info_You_Stalling");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
			//CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,"你正在摆摊……");
			return 0;
		}

		//向服务器发送
		CGManipulatePet Msg;

		Msg.SetGUID(My_Pet->m_GUID);
		Msg.SetManipulateType( MANIPULATE_FREEPET );
		CNetManager::GetMe()->SendPacket(&Msg);
		return 0;
	}
Exemple #11
0
ORESULT SCLIENT_SKILL::IsCanUse_CheckTarget( INT idUser, INT idTargetObj, FLOAT fTargetX, FLOAT fTargetZ, FLOAT fDir )const
{
	// 对象数量
	INT objNum = 0;

	switch(m_pDefine->m_nSelectType)
	{
	case SELECT_TYPE_NONE:	
		break;

	case SELECT_TYPE_CHARACTER:	
		{
			if(idTargetObj==INVALID_ID)
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_No_Target");
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, "没有目标");
				return OR_NO_TARGET;
			}
			// m_nTargetMustInSpecialState--> 0:活的;1:死的; -1:没有要求
			INT nTargetMustAliveFlag = !(m_pDefine->m_nTargetMustInSpecialState);
			CObject_Character* pTargetObj = (CObject_Character*)(CObjectManager::GetMe()->FindServerObject(idTargetObj));
			if (!pTargetObj)
			{
				Assert(NULL=="[SCLIENT_SKILL::IsCanUse_CheckTarget]...pTargetObj = NULL...");
				return OR_ERROR;
			}
			CObject_Character* pThisObj = (CObject_Character*)(CObjectManager::GetMe()->FindObject(idUser));
			if (!pThisObj)
			{
				Assert(NULL=="[SCLIENT_SKILL::IsCanUse_CheckTarget]...pThisObj = NULL...");
				return OR_ERROR;
			}

			// 阵营判断
			ENUM_RELATION eCampType = CGameProcedure::s_pGameInterface->GetCampType( pThisObj, pTargetObj );

			if( m_pDefine->m_nFriendness < 0 && eCampType == RELATION_ENEMY )
				;
			else if ( m_pDefine->m_nFriendness > 0 && eCampType == RELATION_FRIEND)
				;
			else if ( m_pDefine->m_nFriendness == 0 )
				;
			else
			{
				return OR_INVALID_TARGET;
			}

			if( !(pTargetObj->IsDie()) && nTargetMustAliveFlag )
			{
				// 该技能只对活目标有效
			}
			else if( pTargetObj->IsDie() && !nTargetMustAliveFlag )
			{
				// 该技能只对死目标有效
			}
			else
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_Invalidate_Target");
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				return OR_INVALID_TARGET;
			}
		}
		break;

	case SELECT_TYPE_POS:
		{
			if( !(fTargetX>=0.f && fTargetZ>=0.f) )
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_Invalidate_Target");
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				//CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, "无效目标");
				return OR_INVALID_TARGET_POS;
			}
		}
		break;

	case SELECT_TYPE_DIR:
		break;

	case SELECT_TYPE_SELF:		
		break;

	case SELECT_TYPE_HUMAN_GUID:
		break;

	//case SELECT_TYPE_WILD_PET:	// 野生宠物
	//	{
	//		if(idTargetObj==INVALID_ID)
	//		{
	//			// 没有目标
	//			STRING strTemp = "";
	//			strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_No_Target");
	//			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
	//			return OR_NO_TARGET;
	//		}
	//		// 目标有效
	//		CObject_Character* pTargetObj = (CObject_Character*)(CObjectManager::GetMe()->FindServerObject(idTargetObj));
	//		if (!pTargetObj)
	//		{
	//			Assert(NULL=="[SCLIENT_SKILL::IsCanUse_CheckTarget]...pTargetObj = NULL...");
	//			return OR_ERROR;
	//		}
	//		// 使用者有效
	//		CObject_Character* pThisObj = (CObject_Character*)(CObjectManager::GetMe()->FindObject(idUser));
	//		if (!pThisObj)
	//		{
	//			Assert(NULL=="[SCLIENT_SKILL::IsCanUse_CheckTarget]...pThisObj = NULL...");
	//			return OR_ERROR;
	//		}

	//		// 目标是不是野宠
	//		if (g_theKernel.IsKindOf( pTargetObj->GetClass(), GETCLASS(CObject_PlayerNPC) ))
	//		{
	//			CObject_PlayerNPC* pNPC = (CObject_PlayerNPC*)pTargetObj;
	//			if (NPC_TYPE_PET != pNPC->GetNpcType())
	//			{
	//				return OR_INVALID_TARGET;
	//			}
	//		}
	//		else
	//			return OR_INVALID_TARGET;

	//		// 野宠必须是活的
	//		INT nTargetMustAliveFlag = !(m_pDefine->m_nTargetMustInSpecialState);
	//		if (pTargetObj->IsDie())
	//		{
	//			return OR_INVALID_TARGET;
	//		}
	//	}
	//	break;

	default:
		break;
	}

	return OR_OK;
}
	// 创建角色
	INT CGameProduce_Login::CreateRole(LuaPlus::LuaState* state)
	{

		LuaStack args(state);
		if (!(args[2].IsString()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");
		}

		if (!(args[3].IsInteger()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");
		}
		if (!(args[4].IsInteger()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");

		}

		if (!(args[5].IsInteger()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");

		}

		if (!(args[6].IsInteger()))
		{
			KLThrow("LUA:GetBuffIconNameByIndex param parameter error");

		}

		// 策划需求去掉发型 Nick 2007.11.24
		//if (!(args[7].IsInteger()))
		//{
		//	KLThrow("LUA:GetBuffIconNameByIndex param parameter error");

		//}


		if(CGameProcedure::s_pProcCharCreate)
		{
			const char* pChar = args[2].GetString();
			int iSex = args[3].GetInteger();
			int iCountry = args[4].GetInteger();
			int iProfression =args[5].GetInteger();
			int iFaceModelIndex = args[6].GetInteger();
			int iHairModelIndex = args[7].GetInteger();
			if(pChar)
			{
				int iStrLen = (int)::strlen(pChar);

				if(iStrLen > 12)
				{
					STRING strTemp = "";
					strTemp = NOCOLORMSGFUNC("Login_Create_Role_Info_Name_Too_Len");
					CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
					return 0;
				}

				CGameProcedure::s_pProcCharCreate->m_iSex = iSex;
				CGameProcedure::s_pProcCharCreate->m_iCountry1 =iCountry;
		     	CGameProcedure::s_pProcCharCreate->m_iProfession1 = iProfression;
				CGameProcedure::s_pProcCharCreate->m_iFaceModle1 = iFaceModelIndex;
				//策划需求去掉发型 Nick 2007.11.24
				CGameProcedure::s_pProcCharCreate->m_iHairModle1 = 0;	// iHairModelIndex;
				strcpy(CGameProcedure::s_pProcCharCreate->m_szCreateRoleName, pChar);
				CGameProcedure::s_pProcCharCreate->CreateRole();
			}
			else
			{
				STRING strTemp = "";
				strTemp = NOCOLORMSGFUNC("Login_Create_Role_Info_Name_Is_Empty");
				CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
				//strcpy(CGameProcedure::s_pProcCharCreate->m_szCreateRoleName, "");
				//CGameProcedure::s_pProcCharCreate->CreateRole();
			}
		}//	
		

		return 0;
	}
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;
	}
}
// 创建角色
int	CGamePro_CharCreate::CreateRole()
{
	const char* szInvalid = " #\\/`~!@~$%^&*()-_+=|{}[];:'\"<>,.?";
	const char* szHZBlank = " "; //中文空格

	CLAskCreateChar msg;
	
	std::string strName = m_szCreateRoleName;
	if(strName.empty())
	{
		STRING strTemp = "";
		strTemp = NOCOLORMSGFUNC("produce_change_scene_Info_Name_Not_Null");
		CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());	
		return 1;
	}

	// 查找是否有非法ascii字符
	STRING::size_type nInvalidPos = strName.find_first_of(szInvalid);
	STRING strInvalidChar;
	if(nInvalidPos == STRING::npos)
	{
		// 中文空格
		nInvalidPos = strName.find(szHZBlank);
		strInvalidChar = szHZBlank;
	}
	else
	{
		// 非法字符
		strInvalidChar = strName.substr(nInvalidPos, 1);
	}

	if(nInvalidPos != STRING::npos)
	{
		STRING strTemp = NOCOLORMSGFUNC("INVALID_CHARACTER_IN_NAME", strInvalidChar.c_str());
		CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());	
		return 0;
	}

	if(CGameProcedure::s_pUISystem)
	{
		if(!CGameProcedure::s_pUISystem->CheckStringFilter(strName, FT_ROLE)||(!CGameProcedure::s_pUISystem->CheckStringFullCompare(strName)))
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("INVALID_STRING_IN_NAME");
			CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());
			return 0;
		}
	}

	msg.SetAccount((CHAR*)CGameProcedure::s_pVariableSystem->GetAs_String("User_Account").c_str());
	msg.SetName		( m_szCreateRoleName );	//设置角色名称
	msg.SetFaceColor( m_iFaceColor1 );		//设置面部颜色
	msg.SetFaceModel( m_iFaceModle1 );		//设置面部模型
	msg.SetHairColor( m_iHairColor1 );		//设置头发颜色
	msg.SetHairModel( m_iHairModle1 );		//设置头发模型
	msg.SetSex		( m_iSex );				//设置性别
	msg.SetHeadID	( m_iFaceId );			//设置头像id
	msg.SetProfession( m_iProfession1 );	//设置职业
	msg.SetCountry	(m_iCountry1);			//设置国家

	CNetManager::GetMe()->SendPacket(&msg);

	STRING strTemp = "";
	strTemp = NOCOLORMSGFUNC("Login_Create_Role_Doing");
	//CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO, strTemp.c_str());	
	CGameProcedure::s_pEventSystem->PushEvent( GE_GAMELOGIN_SHOW_SYSTEM_INFO_NO_BUTTON, strTemp.c_str());	

	return 0;
}
uint GCMinorPasswdHandler::Execute( GCMinorPasswd* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GC_MINORPASSWD* pRecv;
	pRecv = pPacket->GetMinorPassword();

	switch( pRecv->m_Type )
	{
	// 密码是否已经设置
	case MRETT_PASSWDSETUP:
		{
			
			if(1 == pRecv->m_ReturnSetup.m_uFlag)
			{// 已经设置过的密码
				
				// 设置密码成功
				CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup(TRUE);
				// 设置未解锁密码状态。。
				CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(FALSE);
				CEventSystem::GetMe()->PushEvent( GE_UPDATE_BANK, "password", "True" );
			}
			else
			{// 没有设置过的密码
				
				CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup(FALSE);
				CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(FALSE);
				CEventSystem::GetMe()->PushEvent( GE_UPDATE_BANK, "password", "True" );
			}
			break;
		}

	// 二级密码解除剩余时间(或者不在解除阶段)
	case MRETT_DELETEPASSWDTIME:
		{
			
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Apply_Force_Unlock_Password");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	

			TCHAR bufInfo[512];
			memset(bufInfo, 0, sizeof(bufInfo));
			
			strTemp = NOPARAMMSGFUNC("MinorPassword_Apply_Force_Unlock_Password_Time");
			_stprintf(bufInfo, strTemp.c_str(), (pRecv->m_ReturnDeleteTime.m_uTime / (1000 * 60 *60)));
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, bufInfo);	
			break;
		}

	// 二级密码设置成功
	case MRETT_SETPASSWDSUCC:
		{
			// 设置密码成功
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup( TRUE );

			// 设置未解锁密码状态。。
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(FALSE);
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Set_Password_Ok");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			CEventSystem::GetMe()->PushEvent( GE_UPDATE_BANK, "password", "True" );
			
			break;
		}

	// 二级密码修改成功
	case MRETT_MODIFYPASSWDSUCC:
		{
			// 修改密码成功
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Modify_Password_OK");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 二级密码解锁成功
	case MRETT_UNLOCKPASSWDSUCC:
		{
			// 解锁密码成功
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(TRUE);
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Unlock_Password_Ok");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 设置保护类型成功
	case MRETT_SETPASSWDPROTECT:
		{
			INT flag = pRecv->m_ReturnSetup.GetSetupFlag();
			CDataPool::GetMe()->Rich_SetPasswordData( flag );

			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "设置保护类型成功" );
			break;
		}
	// 设置上线保护时间成功
	case MRETT_SETPROTECTTIMESUCC:
		{
			UINT time = pRecv->m_ReturnDeleteTime.GetDeleteTime();

			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "设置上线保护时间成功" );
			break;
		}


	// 强制解除二级密码失效
	case MRETT_DELETEPASSWDCANCEL:
		{
			break;
		}

	// 二级密码强制解除成功
	case MRETT_DELETEPASSWDSUCC:
		{
			// 强制接触密码成功。
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup(FALSE);
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Force_Unlock_Password_OK");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 二级密码设置失败
	case MRETT_ERR_SETPASSWDFAIL:
		{
			// 设置二级密码失败
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup(FALSE);
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Set_Password_Fail");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	

			break;
		}

	// 二级密码修改失败
	case MRETT_ERR_MODIFYPASSWDFAIL:
		{// 修改密码失败
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Modify_Password_Fail");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 二级密码解锁失败
	case MRETT_ERR_UNLOCKPASSWDFAIL:
		{
			// 解锁失败。
			//CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(FALSE);
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Unlock_Password_Fail");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 二级密码强制解除失败
	case MRETT_ERR_DELETEPASSWDFAIL:
		{
			// 强制接触密码失败。
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Force_Unlock_Password_Fail");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 清空二级密码成功
	case MRETT_CLEANPASSWDSUCC:
		{
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdSetup(FALSE);
			CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Set_SetMinorPwdUnlocked(FALSE);

			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "密码已经清除");	
			CEventSystem::GetMe()->PushEvent( GE_UPDATE_BANK, "password", "False" );
			break;
		}

	// 清空二级密码失败
	case MRETT_ERR_CLEANPASSWDFAIL:
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("MinorPassword_Modify_Password_Fail");
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, strTemp.c_str());	
			break;
		}

	// 校验密码失败 
	case MRETT_ERR_PASSWD:
		{
//			CDataPool::GetMe()->Rich_SetInputPasswdState( nType, FALSE );

			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "校验密码失败!");	
			break;
		}

	// 设置上线保护时间失败
	case MRETT_ERR_SETPROTECTTIMEFAIL:
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, "设置上线保护时间失败!");	
			break;
		}

	default :
		Assert(FALSE);
		return 0;
	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}