Пример #1
0
 private AnimationFrame getFrame(Body body, int facing, int frameIndex, int hue)
 {
     AnimationFrame[] iFrames = Animations.GetAnimation(body, IO.BodyConverter.DeathAnimationIndex(body), facing, hue);
     if (iFrames == null)
         return null;
     if (iFrames[frameIndex].Texture == null)
         return null;
     return iFrames[frameIndex];
 }
Пример #2
0
 private IAnimationFrame getFrame(Body body, int facing, int frameIndex, int hue)
 {
     // get the resource provider
     IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
     IAnimationFrame[] frames = provider.GetAnimation(body, BodyConverter.DeathAnimationIndex(body), facing, hue);
     if (frames == null)
         return null;
     if (frames[frameIndex].Texture == null)
         return null;
     return frames[frameIndex];
 }
Пример #3
0
 public static int DeathAnimationIndex(Body body)
 {
     switch (body.Type)
     {
         case BodyType.Human:
             return 21;
         case BodyType.Monster:
             return 2;
         case BodyType.Animal:
             return 8;
         default:
             return 2;
     }
 }
Пример #4
0
 public static int DeathAnimationFrameCount(Body body)
 {
     switch (body.Type)
     {
         case BodyType.Human:
             return 6;
         case BodyType.Monster:
             return 4;
         case BodyType.Animal:
             return 4;
         default:
             return 4;
     }
 }
Пример #5
0
        public static MobileAction GetActionFromIndex(Body body, int index)
        {
            if (body.IsHumanoid)
            {
                switch ((ActionIndexHumanoid)index)
                {
                    case ActionIndexHumanoid.Walk:
                    case ActionIndexHumanoid.Walk_Armed:
                    case ActionIndexHumanoid.Walk_Warmode:
                    case ActionIndexHumanoid.Mounted_RideSlow:
                        return MobileAction.Walk;

                    case ActionIndexHumanoid.Mounted_RideFast:
                    case ActionIndexHumanoid.Run:
                    case ActionIndexHumanoid.Run_Armed:
                        return MobileAction.Run;

                    case ActionIndexHumanoid.Stand:
                    case ActionIndexHumanoid.Stand_Warmode1H:
                    case ActionIndexHumanoid.Stand_Warmode2H:
                    case ActionIndexHumanoid.Mounted_Stand:
                        return MobileAction.Stand;

                    case ActionIndexHumanoid.Fidget_1:
                        return MobileAction.Emote_Fidget_1;

                    case ActionIndexHumanoid.Fidget_2:
                        return MobileAction.Emote_Fidget_2;

                    case ActionIndexHumanoid.Attack_1H:
                    case ActionIndexHumanoid.Attack_Unarmed1:
                    case ActionIndexHumanoid.Attack_Unarmed2:
                    case ActionIndexHumanoid.Attack_2H_Down:
                    case ActionIndexHumanoid.Attack_2H_Across:
                    case ActionIndexHumanoid.Attack_2H_Jab:
                    case ActionIndexHumanoid.Attack_Bow:
                    case ActionIndexHumanoid.Attack_BowX:
                    case ActionIndexHumanoid.Mounted_Attack_1H:
                    case ActionIndexHumanoid.Mounted_Attack_Bow:
                    case ActionIndexHumanoid.Mounted_Attack_BowX:
                    case ActionIndexHumanoid.Attack_Unarmed3:
                        return MobileAction.Attack;

                    case ActionIndexHumanoid.Cast_Directed:
                        return MobileAction.Cast_Directed;

                    case ActionIndexHumanoid.Cast_Area:
                        return MobileAction.Cast_Area;

                    case ActionIndexHumanoid.Hit:
                        return MobileAction.GetHit;

                    case ActionIndexHumanoid.Die_Backwards:
                    case ActionIndexHumanoid.Die_Forwards:
                        return MobileAction.Death;

                    case ActionIndexHumanoid.Mounted_SlapHorse: // not coded or used?
                        return MobileAction.Stand;

                    case ActionIndexHumanoid.Block_WithShield:
                        return MobileAction.Block;

                    case ActionIndexHumanoid.Emote_Bow:
                        return MobileAction.Emote_Bow;

                    case ActionIndexHumanoid.Emote_Salute:
                        return MobileAction.Emote_Salute;

                    case ActionIndexHumanoid.Emote_Eat:
                        return MobileAction.Emote_Eat;
                }

                // special case animations. When casting a spell, the server will send animation indexes over 200,
                // which all seem to correspond to Cast_Directed. Example indexes are:
                // 200, 201, 203, 206, 209, 212, 215, 218, 221, 227, 230, 239, 245, 260, 266 and doubtless others.
                if (index >= 200)
                    return MobileAction.Cast_Directed;

                Tracer.Warn("Unknown action index {0}", index);
                return MobileAction.None;
            }
            else if (body.IsAnimal)
            {
                switch ((ActionIndexAnimal)index)
                {
                    case ActionIndexAnimal.Stand:
                        return MobileAction.Stand;
                    case ActionIndexAnimal.Walk:
                        return MobileAction.Walk;
                    case ActionIndexAnimal.Run:
                        return MobileAction.Run;
                    default:
                        return MobileAction.MonsterAction;
                }
            }
            else if (body.IsMonster)
            {
                switch ((ActionIndexMonster)index)
                {
                    case ActionIndexMonster.Stand:
                        return MobileAction.Stand;
                    case ActionIndexMonster.Walk:
                        return MobileAction.Walk;
                    case ActionIndexMonster.Run:
                        return MobileAction.Run;
                    default:
                        return MobileAction.MonsterAction;
                }
            }
            return MobileAction.None;
        }