public CTripperObject_ItemBox NewTripperItemBox(int idServer) { CTripperObject_ItemBox newItemBox = new CTripperObject_ItemBox(); add(newItemBox, idServer); mLogicalObject.AddChild(newItemBox); return(newItemBox); }
public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase packet, ref Peer pPlayer) { GCNewItemBox pPacket = (GCNewItemBox)packet; //当前流程是主流程 if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain) { CObjectManager pObjectManager = CObjectManager.Instance; //检查位置是否合法 fVector2 pos = new fVector2(pPacket.Position.m_fX, pPacket.Position.m_fZ); if (!WorldManager.Instance.ActiveScene.IsValidPosition(ref pos)) { LogManager.LogError("Valid Position @GCNewItemBoxHandler.Execute"); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_ERROR); } if ((int)ITEMBOX_TYPE.ITYPE_DROPBOX == pPacket.ObjectType) { bool bMustCreater = true; CObject pObj = (CObject)(pObjectManager.FindServerObject((int)pPacket.MonsterID)); if (pObj != null && pObj is CObject_Character) { CObject_Character pCharacter = (CObject_Character)pObj; if (!pCharacter.IsDie()) { uint idItemBox = (uint)pPacket.ObjectID; uint idOwner = (uint)pPacket.OwnerID; WORLD_POS posCreate = pPacket.Position; pCharacter.AddDropBoxEvent(idItemBox, idOwner, ref posCreate); bMustCreater = false; } } if (bMustCreater) { //创建ItemBox CTripperObject_ItemBox pBox = (CTripperObject_ItemBox)CObjectManager.Instance.NewTripperItemBox((int)pPacket.ObjectID); pBox.Initial(null); //设置位置 pBox.SetMapPosition(pPacket.Position.m_fX, pPacket.Position.m_fZ); //设置掉落箱的归属 pBox.SetOwnerGUID((uint)pPacket.OwnerID); CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_DROP_ITEMBOX); } } else { //创建矿物生长点 CTripperObject_Resource pResource = (CTripperObject_Resource)CObjectManager.Instance.NewTripperResource((int)pPacket.ObjectID); if (!(pResource.SetResourceID((int)pPacket.ObjectType))) { //非法的资源ID CObjectManager.Instance.DestroyObject(pResource); return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); } pResource.Initial(null); //设置位置 pResource.SetMapPosition(pPacket.Position.m_fX, pPacket.Position.m_fZ); jhCount++; } } return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE); }
private void DoLogicEvent_Damage(_LOGIC_EVENT pLogicEvent) { _DAMAGE_INFO pDamageInfo = pLogicEvent.m_damage; switch (pDamageInfo.m_nType) { case _DAMAGE_INFO.DAMAGETYPE.TYPE_INVALID: break; case _DAMAGE_INFO.DAMAGETYPE.TYPE_EFFECT: { LogManager.Log("_DAMAGE_INFO.DAMAGETYPE.TYPE_EFFECT " + m_Character.ServerID); if (pDamageInfo.m_nImpactID != MacroDefine.INVALID_ID) { _DBC_DIRECT_IMPACT pDirectImpact = CDirectlyImpactMgr.Instance.GetDirectlyImpact((uint)pDamageInfo.m_nImpactID); if (pDirectImpact != null) { Vector3 fvPos = new Vector3(); if (m_Character.GetRenderInterface() != null && pDirectImpact.m_pszEffectLocator.Length != 0) { m_Character.GetRenderInterface().GetLocator(pDirectImpact.m_pszEffectLocator, ref fvPos); } else { fvPos = m_Character.GetPosition(); } if (pDirectImpact.m_pszEffect.Length > 0) { CObject_Effect pObjEffect = CObjectManager.Instance.NewEffect(-1); if (pObjEffect != null) { SObject_EffectInit initEffect = new SObject_EffectInit(); initEffect.m_fvPos = fvPos; initEffect.m_fvRot = new Vector3(0.0f, 0.0f, 0.0f); initEffect.m_pszEffectName = pDirectImpact.m_pszEffect; initEffect.m_bLoopEffect = false; pObjEffect.Initial(initEffect); } } if (pDirectImpact.m_pszSound.Length > 0) { fvPos = m_Character.GetPosition(); // Vector3 fvGame = new Vector3(); //if(!CGameProcedure::s_pGfxSystem.Axis_Trans(CRenderSystem::AX_GAME, fvPos, // CRenderSystem::AX_GFX, fvGame)) //{ // return; //} //CSoundSystemFMod::_PlaySoundFunc( pDirectlyImpact.m_pszSound, &fvGame.x, false ); } } } } break; case _DAMAGE_INFO.DAMAGETYPE.TYPE_HEAL_AND_DAMAGE: { LogManager.Log("_DAMAGE_INFO.DAMAGETYPE.TYPE_HEAL_AND_DAMAGE " + this.m_Character.ServerID + " pDamageInfo.m_nHealthIncrement " + pDamageInfo.m_nHealthIncrement); if (pDamageInfo.m_nHealthIncrement < 0) { this.m_Character.SetFightState(true); LogManager.Log("pDamageInfo.m_nHealthIncrement " + this.m_Character.ServerID + " CharacterLogic_Get " + m_Character.CharacterLogic_Get()); if (m_Character.CharacterLogic_Get() == ENUM_CHARACTER_LOGIC.CHARACTER_LOGIC_IDLE) { LogManager.Log("pDamageInfo.BASE_ACTION_F_BE_HIT " + this.m_Character.ServerID); m_Character.ChangeAction((int)ENUM_BASE_ACTION.BASE_ACTION_F_BE_HIT, 1.0f, false, CObject_Character.sDefaultActionFuseTime); } } // 显示伤血信息 DisplayDamageBoard(pDamageInfo); } break; case _DAMAGE_INFO.DAMAGETYPE.TYPE_DROP_BOX: { uint ObjID = (uint)pDamageInfo.m_aAttachedParams[0]; int idOwner = pDamageInfo.m_aAttachedParams[1]; float fX = pDamageInfo.m_aAttachedParams[2] / 1000.0f; float fZ = pDamageInfo.m_aAttachedParams[3] / 1000.0f; //创建ItemBox CTripperObject_ItemBox pBox = CObjectManager.Instance.NewTripperItemBox((int)ObjID); pBox.Initial(null); //设置位置 pBox.SetMapPosition(fX, fZ); //设置掉落箱的归属 pBox.SetOwnerGUID((uint)idOwner); } break; case _DAMAGE_INFO.DAMAGETYPE.TYPE_SKILL_TEXT: { // 显示未击中和免疫信息 DisplayMissImmuAndSoOn(pDamageInfo); } break; case _DAMAGE_INFO.DAMAGETYPE.TYPE_DIE: { m_Character.OnDead(true); } break; default: break; } }