Ejemplo n.º 1
0
 public CorpseCell(Item src)
 {
     this.m_Serial    = src.Serial;
     this.m_Z         = (sbyte)src.Z;
     this.m_Body      = src.Amount;
     this.m_Action    = Engine.m_Animations.ConvertAction(this.m_Body, src.CorpseSerial, this.m_X, this.m_Y, src.Direction, GenericAction.Die, null);
     this.m_Direction = Engine.GetAnimDirection(src.Direction);
     this.m_Frame     = Engine.m_Animations.GetFrameCount(this.m_Body, this.m_Action, this.m_Direction) - 1;
     if (this.m_Frame < 0)
     {
         this.m_Frame = 0;
     }
     this.m_X    = src.X;
     this.m_Y    = src.Y;
     this.m_Hue  = src.Hue;
     this.m_Hue ^= 0x8000;
 }
Ejemplo n.º 2
0
        public void GetPackage(ref int Body, ref int Action, ref int Direction, ref int Frame, ref int Hue)
        {
            Mobile m = this.m_Mobile;

            Body = m.Body;
            if (m.Ghost)
            {
                Body = 970;
            }
            Hue  = m.Hue;
            Hue ^= 0x8000;
            ArrayList equip = m.Equip;

            if (m.Walking.Count > 0)
            {
                GenericAction action;
                Direction = Engine.GetAnimDirection((byte)((WalkAnimation)m.Walking.Peek()).NewDir);
                int num = 0;
                if ((equip.Count > 0) && (((EquipEntry)equip[0]).m_Layer == Layer.Mount))
                {
                    action = ((Direction & 0x80) == 0) ? GenericAction.MountedWalk : GenericAction.MountedRun;
                    num    = ((Direction & 0x80) == 0) ? 2 : 1;
                }
                else
                {
                    action = ((Direction & 0x80) == 0) ? GenericAction.Walk : GenericAction.Run;
                    num    = ((Direction & 0x80) == 0) ? 4 : 2;
                }
                Action = Engine.m_Animations.ConvertAction(Body, m.Serial, m.X, m.Y, Direction, action, m);
                int num2 = Engine.m_Animations.GetFrameCount(Body, Action, Direction & 7);
                if (num2 == 0)
                {
                    Frame = 0;
                }
                else
                {
                    Frame = (m.MovedTiles * num) % num2;
                }
            }
            else
            {
                Direction = Engine.GetAnimDirection(m.Direction);
                if ((m.Animation == null) || !m.Animation.Running)
                {
                    GenericAction mountedStand;
                    if ((equip.Count > 0) && (((EquipEntry)equip[0]).m_Layer == Layer.Mount))
                    {
                        mountedStand = GenericAction.MountedStand;
                    }
                    else
                    {
                        mountedStand = GenericAction.Stand;
                    }
                    Action = Engine.m_Animations.ConvertAction(Body, m.Serial, m.X, m.Y, Direction, mountedStand, m);
                    Frame  = 0;
                }
                else
                {
                    int frames = Renderer.m_Frames;
                    Action     = m.Animation.Action;
                    Direction  = Engine.GetAnimDirection((byte)(m.Direction & 7));
                    Action     = Action % 0x23;
                    Direction &= 7;
                    int num4 = Engine.m_Animations.GetFrameCount(Body, Action, Direction);
                    if (num4 == 0)
                    {
                        num4 = 1;
                    }
                    int num5 = (m.Animation.Delay * 2) + 4;
                    if (num5 < 1)
                    {
                        num5 = 1;
                    }
                    Frame = ((frames - m.Animation.Start) / num5) % num4;
                    if (!m.Animation.Forward)
                    {
                        Frame = (num4 - 1) - Frame;
                    }
                    if ((m.Animation.Repeat && (m.Animation.RepeatCount != 0)) && (frames >= ((m.Animation.Start + ((m.Animation.RepeatCount * num4) * num5)) - 1)))
                    {
                        if (m.Animation.OnAnimationEnd != null)
                        {
                            m.Animation.OnAnimationEnd(m.Animation, m);
                        }
                    }
                    else if ((!m.Animation.Repeat && (frames >= ((m.Animation.Start + (num4 * num5)) - 1))) && (m.Animation.OnAnimationEnd != null))
                    {
                        m.Animation.OnAnimationEnd(m.Animation, m);
                    }
                    if ((m.Animation.Repeat && (m.Animation.RepeatCount != 0)) && (frames >= (m.Animation.Start + ((m.Animation.RepeatCount * num4) * num5))))
                    {
                        GenericAction stand;
                        m.Animation.Stop();
                        if ((equip.Count > 0) && (((EquipEntry)equip[0]).m_Layer == Layer.Mount))
                        {
                            stand = GenericAction.MountedStand;
                        }
                        else
                        {
                            stand = GenericAction.Stand;
                        }
                        Action      = Engine.m_Animations.ConvertAction(Body, m.Serial, m.X, m.Y, Direction, stand, m);
                        Frame       = 0;
                        Direction   = Engine.GetAnimDirection(m.Direction);
                        Direction   = Direction % 8;
                        m.Animation = null;
                    }
                    else if (!m.Animation.Repeat && (frames >= (m.Animation.Start + (num4 * num5))))
                    {
                        GenericAction action4;
                        m.Animation.Stop();
                        if ((equip.Count > 0) && (((EquipEntry)equip[0]).m_Layer == Layer.Mount))
                        {
                            action4 = GenericAction.MountedStand;
                        }
                        else
                        {
                            action4 = GenericAction.Stand;
                        }
                        Action      = Engine.m_Animations.ConvertAction(Body, m.Serial, m.X, m.Y, Direction, action4, m);
                        Frame       = 0;
                        Direction   = Engine.GetAnimDirection(m.Direction);
                        Direction   = Direction % 8;
                        m.Animation = null;
                    }
                }
            }
        }