//宠物改名字 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; }