public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { //检查位置是否合法 //const WORLD_POS* pTargetPos = pPacket->GetCurPos(); //if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pTargetPos->m_fX, pTargetPos->m_fZ))) //{ // TDThrow("ERROR POSITION @ GCBusStopMoveHandler target"); //} GCBusStopMove busPacket = pPacket as GCBusStopMove; if (busPacket == null) { LogManager.LogError("GCBusStopMove 收包错误。"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } CObject pBus = CObjectManager.Instance.FindServerObject((int)busPacket.ObjID); if (pBus == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_BUS_STOP_MOVE; cmdTemp.SetValue(0, busPacket.PosWorld.m_fX); cmdTemp.SetValue(1, -1.0f); cmdTemp.SetValue(2, busPacket.PosWorld.m_fZ); pBus.PushCommand(cmdTemp); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { LogManager.Log("Receive GCObjTeleport Packet"); GCObjTeleport Packet = (GCObjTeleport)pPacket; CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjID); if (pObj == null || !(pObj is CObject_Character)) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } //if(!GFX.GfxSystem.Instance.IsValidPosition(Packet.PosWorld.m_fX, Packet.PosWorld.m_fZ)) // { // LogManager.LogError("ERROR POSITION @ GCCharIdleHandler"); // } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_TELEPORT; cmdTemp.SetValue <float>(0, Packet.PosWorld.m_fX); cmdTemp.SetValue <float>(1, Packet.PosWorld.m_fZ); pObj.PushCommand(cmdTemp); // 瞬移时,清空寻路节点 [9/2/2011 Sun] //CWorldManager::GetMe()->SetPathNodesDirty(); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { GCAbilityAction packet = pPacket as GCAbilityAction; CObjectManager pObjectManager = CObjectManager.Instance; if (pObjectManager == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } CObject pObj = pObjectManager.FindServerObject((int)packet.ObjectID); if (pObj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } if (packet.BeginOrEnd == (byte)GCAbilityAction.ActionState.ABILITY_BEGIN) { SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_ABILITY; cmdTemp.SetValue(0, 0); cmdTemp.SetValue <int>(1, packet.LogicCount); cmdTemp.SetValue <short>(2, packet.AbilityID); cmdTemp.SetValue <int>(3, packet.PrescriptionID); cmdTemp.SetValue <uint>(4, packet.TargetID); pObj.PushCommand(cmdTemp); } } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase packet, ref Peer pPlayer) { //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { GCNewPet pPacket = (GCNewPet)packet; CObjectManager pObjectManager = CObjectManager.Instance; //检查位置是否合法 fVector2 pos = new fVector2(pPacket.getWorldPos().m_fX, pPacket.getWorldPos().m_fZ); if (!WorldManager.Instance.ActiveScene.IsValidPosition(ref pos)) { LogManager.LogError("Valid Position @GCNewPetHandler.Execute"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } //创建宠物 CObject_PlayerNPC pNPC = (CObject_PlayerNPC)pObjectManager.FindServerObject((int)pPacket.getObjID()); float fFaceDir = pPacket.getDir(); if (pNPC == null) { pNPC = pObjectManager.NewPlayerNPC((int)pPacket.getObjID()); SObjectInit initPlayerNPC = new SObjectInit(); initPlayerNPC.m_fvPos = new Vector3(pos.x, 0, pos.y); initPlayerNPC.m_fvRot = new Vector3(0.0f, fFaceDir, 0.0f); pNPC.Initial(initPlayerNPC); } else { pNPC.SetMapPosition(pos.x, pos.y); pNPC.SetFaceDir(fFaceDir); pNPC.Enable((uint)ObjectStatusFlags.OSF_VISIABLE); pNPC.Disalbe((uint)ObjectStatusFlags.OSF_OUT_VISUAL_FIELD); } pNPC.SetNpcType(ENUM_NPC_TYPE.NPC_TYPE_PET); pNPC.GetCharacterData().Set_MoveSpeed(pPacket.getMoveSpeed()); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_IDLE; cmdTemp.SetValue <float>(0, pos.x); cmdTemp.SetValue <float>(1, pos.y); cmdTemp.SetValue <bool>(2, false); pNPC.PushCommand(cmdTemp); //放入Ask队列 pObjectManager.LoadQueue.TryAddLoadTask(pNPC.ID); //同步渲染层 string szTemp = "GCNewPet(" + pos.x.ToString() + "," + pos.y.ToString() + ")"; pNPC.PushDebugString(szTemp); pNPC.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);; }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCCharSkillLead Packet = (GCCharSkillLead)pPacket; if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjectID); if (pObj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_MAGIC_CHANNEL; cmdTemp.SetValue <int>(0, 0); cmdTemp.SetValue <int>(1, Packet.LogicCount); cmdTemp.SetValue <short>(2, Packet.SkillDataID); cmdTemp.SetValue <int>(3, Packet.TargetID); cmdTemp.SetValue <float>(4, Packet.PosTarget.m_fX); cmdTemp.SetValue <float>(5, Packet.PosTarget.m_fZ); cmdTemp.SetValue <float>(6, Packet.Dir); cmdTemp.SetValue <int>(7, Packet.TotalTime); pObj.PushCommand(cmdTemp); //pObj->PushDebugString("GCCharSkill_Lead"); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); LogManager.Log("RECV GCCharSkillLead"); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { //LogManager.Log("Receive GCCharMoveResult Packet"); GCCharMoveResult charMovePacket = (GCCharMoveResult)pPacket; if (charMovePacket.Result < 0) { if (charMovePacket.Result == (int)OPERATE_RESULT.OR_CUT_PATHROUTE) { byte numPos = charMovePacket.NumTargetPos; WORLD_POS[] targetPos = charMovePacket.TargetPos; if (numPos > 0) { if (CObjectManager.Instance.getPlayerMySelf().ModifyMoveCommand(charMovePacket.HandleID, numPos, targetPos) == false) { CObjectManager.Instance.getPlayerMySelf().OnMoveStop(); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_TELEPORT; cmdTemp.SetValue <float>(0, targetPos[numPos - 1].m_fX); cmdTemp.SetValue <float>(1, targetPos[numPos - 1].m_fZ); CObjectManager.Instance.getPlayerMySelf().PushCommand(cmdTemp); ////////////////////////////////////////////////////////////////////////// // 注意,这里被强制传送了 [3/23/2012 Ivan] LogManager.LogWarning("强制传送 x:" + targetPos[numPos - 1].m_fX + " z:" + targetPos[numPos - 1].m_fZ); LogManager.LogWarning("注意!如果此时寻路不正常的话,很有可能是服务器和客户端的导航数据不一致,被强制传送了"); ////////////////////////////////////////////////////////////////////////// } CObjectManager.Instance.getPlayerMySelf().StopLogic(); } else { CObjectManager.Instance.getPlayerMySelf().OnMoveStop( ); } } else { CObjectManager.Instance.getPlayerMySelf().OnMoveStop( ); } } } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCCharDirectImpact Packet = (GCCharDirectImpact)pPacket; if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { CObject pObj = CObjectManager.Instance.FindServerObject(Packet.RecieverID); if (pObj != null) { _DAMAGE_INFO infoDamage = new _DAMAGE_INFO(); infoDamage.m_nSkillID = Packet.SkillID; infoDamage.m_nTargetID = (uint)Packet.RecieverID; infoDamage.m_nSenderID = (uint)Packet.SenderID; infoDamage.m_nSenderLogicCount = Packet.SenderLogicCount; infoDamage.m_nImpactID = Packet.ImpactID; infoDamage.m_nType = _DAMAGE_INFO.DAMAGETYPE.TYPE_EFFECT; _LOGIC_EVENT logicEvent = new _LOGIC_EVENT(); logicEvent.Init(infoDamage.m_nSenderID, infoDamage.m_nSenderLogicCount, infoDamage); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT; cmdTemp.SetValue <object>(0, logicEvent); pObj.PushCommand(cmdTemp); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } LogManager.Log("RECV GCCharDirectImpact"); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { LogManager.Log("Receive GCDetailHealsAndDamages Packet"); GCDetailHealsAndDamages Packet = (GCDetailHealsAndDamages)pPacket; CObject pObj = CObjectManager.Instance.FindServerObject((int)Packet.RecieverID); if (pObj != null) { _DAMAGE_INFO infoDamage = new _DAMAGE_INFO(); infoDamage.m_nSkillID = Packet.SkillID; if (infoDamage.m_nSkillID != MacroDefine.INVALID_ID) { _DBC_SKILL_DATA skillData = CSkillDataMgr.Instance.GetSkillData((uint)infoDamage.m_nSkillID); if (skillData != null) { infoDamage.m_nBulletID = skillData.m_nBulletID; } } infoDamage.m_nTargetID = (uint)Packet.RecieverID; infoDamage.m_nSenderID = (uint)Packet.SenderID; infoDamage.m_nSenderLogicCount = Packet.SenderLogicCount; infoDamage.m_nImpactID = MacroDefine.INVALID_ID; infoDamage.m_nType = _DAMAGE_INFO.DAMAGETYPE.TYPE_HEAL_AND_DAMAGE; if (Packet.IsHpModificationDirty()) { infoDamage.m_bHealthDirty = true; infoDamage.m_nHealthIncrement = Packet.HPModification; } if (Packet.IsMpModificationDirty()) { infoDamage.m_bManaDirty = true; infoDamage.m_nManaIncrement = Packet.MPModification; } if (Packet.IsRageModificationDirty()) { infoDamage.m_bRageDirty = true; infoDamage.m_nRageIncrement = Packet.RageModification; } if (Packet.IsStrikePointModificationDirty()) { infoDamage.m_bStrikePointDirty = true; infoDamage.m_nStrikePointIncrement = Packet.StrikePointModification; } infoDamage.m_bIsCriticalHit = Packet.CriticalHit; _LOGIC_EVENT logicEvent = new _LOGIC_EVENT(); logicEvent.Init((uint)Packet.SenderID, Packet.SenderLogicCount, infoDamage); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT; cmdTemp.SetValue <object>(0, logicEvent); pObj.PushCommand(cmdTemp); } } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { LogManager.LogWarning("RECV GCCharModifyAction"); if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { GCCharModifyAction packet = pPacket as GCCharModifyAction; CObject obj = CObjectManager.Instance.FindServerObject(packet.ObjectID); if (obj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_MODIFY_ACTION; cmdTemp.SetValue <int>(0, packet.LogicCount); cmdTemp.SetValue <int>(1, packet.ModifyTime); obj.PushCommand(cmdTemp); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { LogManager.Log("Receive GCCharBuff Packet"); GCCharBuff charBuffPacket = (GCCharBuff)pPacket; CObject pObj = CObjectManager.Instance.FindServerObject((int)charBuffPacket.RecieverID); if (pObj == null || !(pObj is CObject_Character)) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_UPDATE_IMPACT; cmdTemp.SetValue <short>(0, charBuffPacket.BuffID); cmdTemp.SetValue <int>(1, charBuffPacket.Enable); cmdTemp.SetValue <int>(2, charBuffPacket.SenderID); pObj.PushCommand(cmdTemp); //待实现 //CTeamOrGroup* pTeam = CUIDataPool::GetMe()->GetTeamOrGroup(); //if ( pTeam != NULL ) //{ // if ( pPacket->GetEnable() ) // { // pTeam->AddImpact( pPacket->GetReceiverID(), pPacket->GetBuffID() ); // } // else // { // pTeam->RemoveImpact( pPacket->GetReceiverID(), pPacket->GetBuffID() ); // } //} //pObj.PushDebugString("GCCharBuff"); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); // 广播更新buff [11/10/2011 Ivan edit] CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_BUFF_UPDATE); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { CObjectManager pObjectManager = CObjectManager.Instance; GCDelObject delObjPacket = (GCDelObject)pPacket; //判断是否是本场景 // 将场景ID和资源ID分开,不再使用资源ID代替场景ID [10/24/2011 Sun] if (WorldManager.Instance.GetActiveSceneID() != delObjPacket.getSceneID()) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } //寻找obj CObject pDelObj = pObjectManager.FindServerObject((int)delObjPacket.getObjID()); CObject_Character pObj = pDelObj as CObject_Character; LogManager.Log("GCDelObjectHandler ObjID:" + delObjPacket.getObjID()); if (pObj == null) { CObjectManager.Instance.DestroyObject(pDelObj); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } if (CObjectManager.Instance.GetMainTarget() != null && pObj == CObjectManager.Instance.GetMainTarget()) { CObjectManager.Instance.SetMainTarget(-1, CObjectManager.DESTROY_MAIN_TARGET_TYPE.DEL_OBJECT); } // 判断obj是否在载具上面,在的话需要删除掉 [8/29/2011 Ivan edit] //todo if (pObj.GetCharacterType() == CHARACTER_TYPE.CT_PLAYEROTHER || pObj.GetCharacterType() == CHARACTER_TYPE.CT_PLAYERMYSELF) { if (pObj.GetCharacterData().Get_BusObjID() != MacroDefine.UINT_MAX) { CObject pBus = CObjectManager.Instance.FindServerObject((int)pObj.GetCharacterData().Get_BusObjID()); if (pBus != null) { SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_BUS_REMOVE_PASSENGER; cmdTemp.SetValue <int>(0, pObj.ServerID); pBus.PushCommand(cmdTemp); } } } //删除对象 CObjectManager.Instance.DestroyObject(pObj); //之后不能执行任何代码 } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { GCNotifyTeamInfo packet = pPacket as GCNotifyTeamInfo; CObject pObj = CObjectManager.Instance.FindServerObject((int)packet.ObjectId); if (pObj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_UPDATE_TEAM_FLAG; cmdTemp.SetValue <byte>(0, packet.TeamFlag); cmdTemp.SetValue <byte>(1, packet.TeamLeaderFlag); cmdTemp.SetValue <byte>(2, packet.TeamFullFlag); pObj.PushCommand(cmdTemp); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCSpecialObjActNow Packet = (GCSpecialObjActNow)pPacket; if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { LogManager.Log("RECV GCSpecialObj_ActNowHandler"); CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjID); if (pObj != null) { _ObjID_List listObjID = Packet.ObjIDList; SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_SPECIAL_OBJ_TRIGGER; cmdTemp.SetValue <int>(0, Packet.LogicCount); cmdTemp.SetValue <int>(1, listObjID.m_nCount); cmdTemp.SetValue <object>(2, (object)(listObjID.m_aIDs)); pObj.PushCommand(cmdTemp); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { GCCharStopAction Packet = (GCCharStopAction)pPacket; CObjectManager pObjectManager = CObjectManager.Instance; CObject pObj = (CObject)(pObjectManager.FindServerObject((int)Packet.ObjectID)); if (pObj == null || !(pObj is CObject_Character)) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_STOP_ACTION; cmdTemp.SetValue(0, Packet.LogicCount); cmdTemp.SetValue(1, Packet.StopTime); pObj.PushCommand(cmdTemp); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { LogManager.Log("RECV GCArrive"); GCArrive Packet = (GCArrive)pPacket; CObject pObj = (CObject)(CObjectManager.Instance.FindServerObject(Packet.ObjectID)); if (pObj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_STOP_MOVE; cmdTemp.SetValue <int>(0, Packet.HandleID); cmdTemp.SetValue <int>(1, 0); cmdTemp.SetValue <float>(2, Packet.PosWorld.m_fX); cmdTemp.SetValue <float>(3, Packet.PosWorld.m_fZ); pObj.PushCommand(cmdTemp); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { GCBusAddPassenger busPacket = pPacket as GCBusAddPassenger; if (busPacket == null) { LogManager.LogError("GCBusAddPassenger 收包错误。"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } CObject pBus = CObjectManager.Instance.FindServerObject((int)busPacket.ObjID); if (pBus == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_BUS_ADD_PASSENGER; cmdTemp.SetValue(0, busPacket.Index); cmdTemp.SetValue(1, busPacket.PassengerID); pBus.PushCommand(cmdTemp); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCCharImpactListUpdate Packet = (GCCharImpactListUpdate)pPacket; if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { CObject pObj = CObjectManager.Instance.FindServerObject(Packet.OwnerID); if (pObj != null) { ////如果需要更新资源,尝试放入缓冲队列 //if(pObjectManager->GetLoadQueue()->TryAddLoadTask(pObj->GetID(), pPacket)) // return PACKET_EXE_NOTREMOVE; CObject_Character pChar = (CObject_Character)pObj; if (pChar != null) { pChar.RemoveAllImpact(); } SimpleImpactList ImpactList = new SimpleImpactList(); for (short i = 0; i < Packet.NumImpact; i++) { SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_UPDATE_IMPACT_EX; cmdTemp.SetValue <short>(0, Packet.ImpactID[i]); pObj.PushCommand(cmdTemp); ImpactList.AddImpact(Packet.ImpactID[i]); } //待实现 //CTeamOrGroup* pTeam = CUIDataPool::GetMe()->GetTeamOrGroup(); //if ( pTeam != NULL ) //{ // pTeam->UpdateImpactsList( pPacket->GetOwnerID(), &ImpactList ); //} //pObj->PushDebugString("GCCharImpactListUpdate"); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } LogManager.Log("RECV GCCharImpactListUpdate"); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { GCCharSkillGatherModify Packet = (GCCharSkillGatherModify)pPacket; if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjectID); if (pObj != null) { SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_SKILL_GATHER_MODIFY; cmdTemp.SetValue <float>(0, (float)Packet.SubTime / 1000.0f); pObj.PushCommand(cmdTemp); //pObj->PushDebugString("GCCharSkill_Gather_Modify"); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } } LogManager.Log("RECV GCCharSkillGatherModify"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { //LogManager.Log("Receive GCCharMove Packet"); GCCharMove charMovePacket = (GCCharMove)pPacket; CObjectManager pObjectManager = CObjectManager.Instance; CObject pObj = (CObject)(pObjectManager.FindServerObject((int)charMovePacket.ObjID)); if (pObj == null || !(pObj is CObject_Character)) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } SCommand_Object cmdTemp = new SCommand_Object(); if (charMovePacket.IsHaveStopInfo()) { cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_STOP_MOVE; cmdTemp.SetValue(0, charMovePacket.StopLogicCount); cmdTemp.SetValue(1, 0); cmdTemp.SetValue(2, pObj.GetPosition().x); cmdTemp.SetValue(3, pObj.GetPosition().z); pObj.PushCommand(cmdTemp); } WORLD_POS[] posTarget = new WORLD_POS[1]; posTarget[0].m_fX = charMovePacket.PosTarget.m_fX; posTarget[0].m_fZ = charMovePacket.PosTarget.m_fZ; cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_MOVE; cmdTemp.SetValue(0, charMovePacket.StartTime); cmdTemp.SetValue(1, charMovePacket.HandleID); cmdTemp.SetValue(2, 1); cmdTemp.SetValue(3, posTarget); pObj.PushCommand(cmdTemp); pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { //检查位置是否合法 //if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->GetCurPos()->m_fX, pPacket->GetCurPos()->m_fZ))) //{ // TDThrow("ERROR POSITION @ GCNewBusHandler"); //} GCNewBus busPacket = pPacket as GCNewBus; if (busPacket == null) { LogManager.LogError("GCNewBus 收包错误。"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } //创建玩家 CObject pBus = CObjectManager.Instance.FindServerObject((int)busPacket.ObjID); Vector3 fvGame = new Vector3(busPacket.PosWorld.m_fX, 0, busPacket.PosWorld.m_fZ); if (pBus == null) { pBus = CObjectManager.Instance.NewBus((int)busPacket.ObjID); SObject_BusInit tBusInit = new SObject_BusInit(); tBusInit.m_fvPos = fvGame; tBusInit.m_fvRot = new Vector3(0.0f, busPacket.Dir, 0.0f); tBusInit.m_nDataID = busPacket.DataID; pBus.Initial(tBusInit); pBus.SetMapPosition(busPacket.PosWorld.m_fX, busPacket.PosWorld.m_fZ); } else { if (pBus.isVisible()) { if (Math.Abs(pBus.GetPosition().x - fvGame.x) + Math.Abs(pBus.GetPosition().z - fvGame.z) > ObjectDef.DEF_CHARACTER_POS_ADJUST_DIST) { pBus.SetMapPosition(fvGame.x, fvGame.z); } } else { pBus.SetMapPosition(fvGame.x, fvGame.z); pBus.SetFaceDir(busPacket.Dir); //pBus->setVisible(true); } } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_BUS_ADD_PASSENGER; int i; for (i = 0; i < busPacket.PassengerCount; i++) { cmdTemp.SetValue(0, i); cmdTemp.SetValue(1, busPacket.PassengerIDs[i]); pBus.PushCommand(cmdTemp); } //放入Ask队列 GameProcedure.s_pObjectManager.LoadQueue.TryAddLoadTask(pBus.ID); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { GCNewMonster_Death newMonsterPacket = (GCNewMonster_Death)pPacket; CObjectManager pObjectManager = GameProcedure.s_pObjectManager; // //检查位置是否合法 // if(!CWorldManager::GetMe().GetActiveScene().IsValidPosition(fVector2(newMonsterPacket.getWorldPos().m_fX, newMonsterPacket.getWorldPos().m_fZ))) // { // TDThrow("ERROR POSITION @ GCNewMonsterHandler"); // } //创建玩家 CObject_PlayerNPC pNPC = (CObject_PlayerNPC)pObjectManager.FindServerObject((int)newMonsterPacket.ObjectID); if (pNPC == null) { pNPC = pObjectManager.NewPlayerNPC((int)newMonsterPacket.ObjectID); pNPC.Initial(null); } else { // pNPC.Enable( OSF_VISIABLE ); // pNPC.Disalbe( OSF_OUT_VISUAL_FIELD ); } //设置怪物位置和面向 pNPC.SetMapPosition(newMonsterPacket.Position.m_fX, newMonsterPacket.Position.m_fZ); pNPC.SetFaceDir(newMonsterPacket.Dir); if (newMonsterPacket.IsNpc != 0) { pNPC.SetNpcType(ENUM_NPC_TYPE.NPC_TYPE_NPC); } else { pNPC.SetNpcType(ENUM_NPC_TYPE.NPC_TYPE_MONSTER); } SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_DEATH; cmdTemp.SetValue <bool>(0, false); pNPC.PushCommand(cmdTemp); //清除界面选中NPC if (CObjectManager.Instance.GetMainTarget() != null && pNPC != null && (CObjectManager.Instance.GetMainTarget().ID == pNPC.ID)) { GameProcedure.s_pGameInterface.Object_SelectAsMainTarget(MacroDefine.INVALID_ID); } pNPC.GetCharacterData().Set_MoveSpeed(newMonsterPacket.MoveSpeed); //放入Ask队列 pObjectManager.LoadQueue.TryAddLoadTask(pNPC.ID); //此版不做服务器繁忙客户端延后发消息的处理 // CGCharAskBaseAttrib msgAskBaseAttrib = new CGCharAskBaseAttrib(); // msgAskBaseAttrib.setTargetID( (uint)newMonsterPacket.ObjectID); // GameProcedure.s_NetManager.SendPacket(msgAskBaseAttrib ); // char szTemp[MAX_PATH]; // _snprintf(szTemp, MAX_PATH, "GCNewMonster(%.1f,%.1f)", // newMonsterPacket.getWorldPos().m_fX, newMonsterPacket.getWorldPos().m_fZ); // pNPC.PushDebugString(szTemp); pNPC.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == GameProcedure.s_ProcMain) { LogManager.Log("RECV GCNewPlayer_Death"); } //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { GCNewPlayer_Death newPlayerPacket = (GCNewPlayer_Death)pPacket; CObjectManager pObjectManager = GameProcedure.s_pObjectManager; ////检查位置是否合法 //if(!CWorldManager::GetMe().GetActiveScene().IsValidPosition(fVector2(newPlayerPacket.getWorldPos().m_fX, newPlayerPacket.getWorldPos().m_fZ))) //{ // TDThrow("ERROR POSITION @ GCNewMonsterHandler"); //} //创建玩家 CObject_PlayerOther pOther = (CObject_PlayerOther)pObjectManager.FindServerObject((int)newPlayerPacket.ObjectID); if (pOther == null) { pOther = pObjectManager.NewPlayerOther((int)newPlayerPacket.ObjectID); pOther.Initial(null); } else { // pOther.Enable( OSF_VISIABLE ); // pOther.Disalbe( OSF_OUT_VISUAL_FIELD ); } //设置怪物位置和面向 pOther.SetMapPosition(newPlayerPacket.Position.m_fX, newPlayerPacket.Position.m_fZ); pOther.SetFaceDir(newPlayerPacket.Dir); //更新装备信息 pOther.GetCharacterData().Set_EquipVer(newPlayerPacket.EquipVer); pOther.GetCharacterData().Set_MoveSpeed(newPlayerPacket.MoveSpeed); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_DEATH; cmdTemp.SetValue <bool>(0, false); pOther.PushCommand(cmdTemp); //放入Ask队列 pObjectManager.LoadQueue.TryAddLoadTask(pOther.ID); //pObjectManager.GetLoadQueue().TryAddLoadTask(pOther.GetID(), CObject_Character::CT_MONSTER); //此版不做服务器繁忙客户端延后发消息的处理 // CGCharAskBaseAttrib msgAskBaseAttrib = new CGCharAskBaseAttrib(); // msgAskBaseAttrib.setTargetID( (uint)newPlayerPacket.ObjectID); // GameProcedure.s_NetManager.SendPacket(msgAskBaseAttrib ); // char szTemp[MAX_PATH]; // _snprintf(szTemp, MAX_PATH, "GCNewMonster(%.1f,%.1f)", // newPlayerPacket.getWorldPos().m_fX, newPlayerPacket.getWorldPos().m_fZ); // pOther.PushDebugString(szTemp); pOther.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { CObjectManager pObjectManager = CObjectManager.Instance; GCNewMonster_Move newMonsterMovPacket = (GCNewMonster_Move)pPacket; // //检查位置是否合法 // if(!CWorldManager::GetMe().GetActiveScene().IsValidPosition(fVector2(pPacket.getWorldPos().m_fX, pPacket.getWorldPos().m_fZ))) // { // TDThrow("ERROR POSITION @ GCNewMonster_MoveHandler"); // } // if(!CWorldManager::GetMe().GetActiveScene().IsValidPosition(fVector2(pPacket.getTargetPos().m_fX, pPacket.getTargetPos().m_fZ))) // { // TDThrow("ERROR POSITION @ GCNewMonster_MoveHandler target"); // } //创建玩家 CObject_PlayerNPC pNPC = (CObject_PlayerNPC)pObjectManager.FindServerObject((int)newMonsterMovPacket.getObjID()); if (pNPC == null) { pNPC = pObjectManager.NewPlayerNPC((int)newMonsterMovPacket.getObjID()); pNPC.Initial(null); } else { //pNPC.Enable( OSF_VISIABLE ); // pNPC.Disalbe( OSF_OUT_VISUAL_FIELD ); } //设置x z坐标 pNPC.SetMapPosition(newMonsterMovPacket.getWorldPos().m_fX, newMonsterMovPacket.getWorldPos().m_fZ); if (newMonsterMovPacket.getIsNPC()) { pNPC.SetNpcType(ENUM_NPC_TYPE.NPC_TYPE_NPC); } else { pNPC.SetNpcType(ENUM_NPC_TYPE.NPC_TYPE_MONSTER); } pNPC.GetCharacterData().Set_MoveSpeed(newMonsterMovPacket.getMoveSpeed()); // move to command { WORLD_POS[] posTarget = new WORLD_POS[1]; posTarget[0].m_fX = newMonsterMovPacket.getTargetPos().m_fX; posTarget[0].m_fZ = newMonsterMovPacket.getTargetPos().m_fZ; SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_MOVE; cmdTemp.SetValue <uint>(0, 0); cmdTemp.SetValue(1, newMonsterMovPacket.getHandleID()); cmdTemp.SetValue(2, 1); cmdTemp.SetValue <WORLD_POS[]>(3, posTarget); pNPC.PushCommand(cmdTemp); } //放入Ask队列 pObjectManager.LoadQueue.TryAddLoadTask(pNPC.ID); //tempcode // { // //此版不做服务器繁忙客户端延后发消息的处理 // CGCharAskBaseAttrib msgAskBaseAttrib = new CGCharAskBaseAttrib(); // msgAskBaseAttrib.setTargetID( (uint)(int)newMonsterMovPacket.getObjID()); // GameProcedure.s_NetManager.SendPacket(msgAskBaseAttrib ); // // } pNPC.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);; }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer) { if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { GCTargetListAndHitFlags Packet = (GCTargetListAndHitFlags)pPacket; CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjID); LogManager.Log("Receive GCTargetListAndHitFlags Packet " + Packet.ObjID + " BulletID: " + Packet.SkillOrSpecialObjDataID + " TargetID: " + Packet.TargetID); if (pObj == null) { return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } string pszSenderLocator = ""; bool bHitCharacter = false; int nBulletID = MacroDefine.INVALID_ID; if ((byte)GCTargetListAndHitFlags.TARGETTYPE.SPECIAL_OBJ_ACTIVATE == Packet.DataType) { _DBC_SPECIAL_OBJ_DATA pSpecialObjData = CDataBaseSystem.Instance.GetDataBase <_DBC_SPECIAL_OBJ_DATA>((int)DataBaseStruct.DBC_SPECIAL_OBJ_DATA).Search_Index_EQU((int)Packet.SkillOrSpecialObjDataID); if (pSpecialObjData != null) { nBulletID = pSpecialObjData.m_nBulletID; bHitCharacter = true; pszSenderLocator = ""; } } else { _DBC_SKILL_DATA skillData = CSkillDataMgr.Instance.GetSkillData((uint)Packet.SkillOrSpecialObjDataID); if (skillData != null) { nBulletID = skillData.m_nBulletID; pszSenderLocator = skillData.m_pszBulletSendLocator; switch ((ENUM_SELECT_TYPE)skillData.m_nSelectType) { case ENUM_SELECT_TYPE.SELECT_TYPE_POS: case ENUM_SELECT_TYPE.SELECT_TYPE_DIR: bHitCharacter = false; break; case ENUM_SELECT_TYPE.SELECT_TYPE_NONE: case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER: case ENUM_SELECT_TYPE.SELECT_TYPE_SELF: default: bHitCharacter = true; break; } } } if (nBulletID != MacroDefine.INVALID_ID) { _LOGIC_EVENT_BULLET infoBullet = null; if (bHitCharacter) { CObject_Character pCharacter = (CObject_Character)pObj; // CObject_Special pSpecial = (CObject_Special)pObj; if (pCharacter != null) { for (byte i = 0; i < Packet.TargetNum; i++) { infoBullet = new _LOGIC_EVENT_BULLET(); infoBullet.m_nBulletID = nBulletID; infoBullet.m_pszSenderLocator = pszSenderLocator; infoBullet.m_bHitTargetObj = bHitCharacter; _LOGIC_EVENT logicEvent = new _LOGIC_EVENT(); logicEvent.Init((uint)Packet.ObjID, Packet.LogicCount, infoBullet); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT; logicEvent.m_bullet.m_nTargetID = (uint)Packet.TargetList[i]; cmdTemp.SetValue <object>(0, (object)logicEvent); pCharacter.PushCommand(cmdTemp); } } //else if(pSpecial != null) //{ //} } else { infoBullet = new _LOGIC_EVENT_BULLET(); infoBullet.m_nBulletID = nBulletID; infoBullet.m_pszSenderLocator = pszSenderLocator; infoBullet.m_bHitTargetObj = bHitCharacter; infoBullet.m_fTargetX = Packet.PosTarget.m_fX; infoBullet.m_fTargetZ = Packet.PosTarget.m_fZ; _LOGIC_EVENT logicEvent = new _LOGIC_EVENT(); logicEvent.Init((uint)Packet.ObjID, Packet.LogicCount, infoBullet); SCommand_Object cmdTemp = new SCommand_Object(); cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT; cmdTemp.SetValue <object>(0, (object)logicEvent); CObject_Character pCharacter = (CObject_Character)pObj; // CObject_Special pSpecial = (CObject_Special)pObj; if (pCharacter != null) { pCharacter.PushCommand(cmdTemp); } // else if(pSpecial != null) // { // CObject_Special *pSpecial = (CObject_Special*)pObj; // } } } pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow()); } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }