Beispiel #1
0
 public override bool GetUrlElement()
 {
     m_UserId        = actionGetter.GetSession().UserId;
     m_RoomId        = (actionGetter.GetSession().User as RoomSessionUser).RoomId;
     m_RequestPacket = ProtoBufUtils.Deserialize <CREntityImpact>((byte[])actionGetter.GetMessage());
     return(true);
 }
Beispiel #2
0
 public override bool Verify(Message message)
 {
     m_OriginHero        = null;
     m_TargetHero        = null;
     m_Request           = message.Packet as CREntityImpact;
     m_Response.SerialId = m_Request.SerialId;
     if (DateTime.UtcNow.Ticks - m_Room.StartTime < GameConfigs.GetInt("Room_Battle_Start_Protection_Time", 3) * TimeSpan.TicksPerSecond)
     {
         return(false);
     }
     m_OriginHero = m_Room.Players[m_UserId].Heros.Find(t => t.EntityId == m_Request.OriginOwnerEntityId);
     foreach (var player in m_Room.Players)
     {
         if (player.Value.InBattleEntity == m_Request.TargetEntityId)
         {
             m_TargetHero = m_Room.Players[player.Key].Heros.Find(t => t.EntityId == m_Request.TargetEntityId);
         }
     }
     if (m_OriginHero == null || m_TargetHero == null)
     {
         return(false);
     }
     if (m_OriginHero.HP <= 0 || m_TargetHero.HP <= 0)
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
 public Action5103(ActionGetter actionGetter)
     : base((short)5103, actionGetter)
 {
     m_RequestPacket  = null;
     m_ResponsePacket = null;
     m_UserId         = 0;
 }
Beispiel #4
0
        private RCPushEntityImpact ToRCPushEntityImpact(CREntityImpact request)
        {
            RCPushEntityImpact response = new RCPushEntityImpact()
            {
                ImpactSourceType = request.ImpactSourceType,
                OriginTransform  = request.OriginTransform,
                TargetTransform  = request.TargetTransform,
                OriginPlayerId   = m_UserId,
                TargetPlayerId   = m_TargetPlayerId,
            };

            if (request.HasAIId)
            {
                response.AIId = request.AIId;
            }
            if (request.HasCurrentTime)
            {
                response.CurrentTime = request.CurrentTime;
            }
            if (request.HasOriginEntityId)
            {
                response.OriginEntityId = request.OriginEntityId;
            }
            if (request.HasSkillId)
            {
                response.SkillId = request.SkillId;
            }
            if (request.HasBuffId)
            {
                response.BuffId = request.BuffId;
            }
            if (request.HasTargetEntityId)
            {
                response.TargetEntityId = request.TargetEntityId;
            }
            response.BlownAwayImpacts.AddRange(request.BlownAwayImpacts);
            response.FloatImpacts.AddRange(request.FloatImpacts);
            response.HardHitImpacts.AddRange(request.HardHitImpacts);
            response.HPDamageImpacts.AddRange(request.HPDamageImpacts);
            response.HPRecoverImpacts.AddRange(request.HPRecoverImpacts);
            response.SoundAndEffectImpacts.AddRange(request.SoundAndEffectImpacts);
            response.SteadyDamageImpacts.AddRange(request.SteadyDamageImpacts);
            response.StiffnessImpacts.AddRange(request.StiffnessImpacts);
            response.StunImpacts.AddRange(request.StunImpacts);
            response.FreezeImpacts.AddRange(request.FreezeImpacts);
            response.BuffIdsAddedToTarget.AddRange(request.BuffIdsAddedToTarget);
            return(response);
        }