示例#1
0
 private static void CalculateHight(ushort graphic, Mobile mobile, ANIMATION_FLAGS flags, bool isrun, bool iswalking, ref byte result)
 {
     if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_BY_PEOPLE_GROUP) != 0)
     {
         if (result == 0xFF)
         {
             result = 0;
         }
     }
     else if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_BY_LOW_GROUP) != 0)
     {
         if (!iswalking)
         {
             if (result == 0xFF)
             {
                 result = 2;
             }
         }
         else if (isrun)
         {
             result = 1;
         }
         else
         {
             result = 0;
         }
     }
     else
     {
         if (mobile.IsFlying)
         {
             result = 19;
         }
         else if (!iswalking)
         {
             if (result == 0xFF)
             {
                 if ((flags & ANIMATION_FLAGS.AF_IDLE_AT_8_FRAME) != 0 && FileManager.Animations.AnimationExists(graphic, 8))
                 {
                     result = 8;
                 }
                 else
                 {
                     if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0 && !mobile.InWarMode)
                     {
                         result = 25;
                     }
                     else
                     {
                         result = 1;
                     }
                 }
             }
         }
         else if (isrun)
         {
             if ((flags & ANIMATION_FLAGS.AF_CAN_FLYING) != 0 && FileManager.Animations.AnimationExists(graphic, 19))
             {
                 result = 19;
             }
             else
             {
                 if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0)
                 {
                     result = 24;
                 }
                 else
                 {
                     result = 0;
                 }
             }
         }
         else
         {
             if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0 && !mobile.InWarMode)
             {
                 result = 22;
             }
             else
             {
                 result = 0;
             }
         }
     }
 }
示例#2
0
        private static void LABEL_190(ANIMATION_FLAGS flags, ref ushort v13)
        {
            if ((flags & ANIMATION_FLAGS.AF_UNKNOWN_80) != 0 && v13 == 4)
            {
                v13 = 5;
            }

            if ((flags & ANIMATION_FLAGS.AF_UNKNOWN_200) != 0)
            {
                if (v13 - 7 > 9)
                {
                    if (v13 == 19)
                    {
                        //LABEL_196
                        v13 = 0;
                    }
                    else if (v13 > 19)
                    {
                        v13 = 1;
                    }

                    LABEL_222(flags, ref v13);

                    return;
                }
            }
            else
            {
                if ((flags & ANIMATION_FLAGS.AF_UNKNOWN_100) != 0)
                {
                    switch (v13)
                    {
                    case 10:
                    case 15:
                    case 16:
                        v13 = 1;
                        LABEL_222(flags, ref v13);

                        return;

                    case 11:
                        v13 = 17;
                        LABEL_222(flags, ref v13);

                        return;
                    }

                    LABEL_222(flags, ref v13);

                    return;
                }

                if ((flags & ANIMATION_FLAGS.AF_UNKNOWN_1) != 0)
                {
                    if (v13 == 21)
                    {
                        v13 = 10;
                    }

                    LABEL_222(flags, ref v13);

                    return;
                }

                if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_BY_PEOPLE_GROUP) == 0)
                {
                    //LABEL_222:
                    LABEL_222(flags, ref v13);

                    return;
                }

                switch (v13)
                {
                case 0:
                    v13 = 0;

                    break;

                case 2:
                    v13 = 21;
                    LABEL_222(flags, ref v13);

                    return;

                case 3:
                    v13 = 22;
                    LABEL_222(flags, ref v13);

                    return;

                case 4:
                case 9:
                    v13 = 9;
                    LABEL_222(flags, ref v13);

                    return;

                case 5:
                    v13 = 11;
                    LABEL_222(flags, ref v13);

                    return;

                case 6:
                    v13 = 13;
                    LABEL_222(flags, ref v13);

                    return;

                case 7:
                    v13 = 18;
                    LABEL_222(flags, ref v13);

                    return;

                case 8:
                    v13 = 19;
                    LABEL_222(flags, ref v13);

                    return;

                case 10:
                case 21:
                    v13 = 20;
                    LABEL_222(flags, ref v13);

                    return;

                case 11:
                    v13 = 3;
                    LABEL_222(flags, ref v13);

                    return;

                case 12:
                case 14:
                    v13 = 16;
                    LABEL_222(flags, ref v13);

                    return;

                case 13:
                    //LABEL_202:
                    v13 = 17;
                    LABEL_222(flags, ref v13);

                    return;

                case 15:
                case 16:
                    v13 = 30;
                    LABEL_222(flags, ref v13);

                    return;

                case 17:
                    v13 = 5;
                    LABEL_222(flags, ref v13);

                    return;

                case 18:
                    v13 = 6;
                    LABEL_222(flags, ref v13);

                    return;

                case 19:
                    //LABEL_201:
                    v13 = 1;
                    LABEL_222(flags, ref v13);

                    return;
                }
            }

            v13 = 4;

            LABEL_222(flags, ref v13);
        }
示例#3
0
        public static byte GetGroupForAnimation(Mobile mobile, ushort checkGraphic = 0, bool isParent = false)
        {
            Graphic graphic = checkGraphic;

            if (graphic == 0)
            {
                graphic = mobile.GetGraphicForAnimation();
            }

            if (graphic >= Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT)
            {
                return(0);
            }

            ANIMATION_GROUPS_TYPE type         = FileManager.Animations.DataIndex[graphic].Type;
            ANIMATION_GROUPS_TYPE originalType = ANIMATION_GROUPS_TYPE.UNKNOWN;

            if (FileManager.Animations.DataIndex[graphic].IsUOP && (isParent || !FileManager.Animations.DataIndex[graphic].IsValidMUL))
            {
                // do nothing ?
            }
            else
            {
                if (!FileManager.Animations.DataIndex[graphic].HasBodyConversion)
                {
                    ushort newGraphic = FileManager.Animations.DataIndex[graphic].Graphic;

                    if (graphic != newGraphic)
                    {
                        graphic = newGraphic;
                        ANIMATION_GROUPS_TYPE newType = FileManager.Animations.DataIndex[graphic].Type;

                        if (newType != type)
                        {
                            originalType = type;
                            type         = newType;
                        }
                    }
                }
            }


            ANIMATION_FLAGS flags = (ANIMATION_FLAGS)FileManager.Animations.DataIndex[graphic].Flags;

            if (mobile.AnimationFromServer && mobile.AnimationGroup != 0xFF)
            {
                ushort v13 = mobile.AnimationGroup;

                if (v13 == 12)
                {
                    if (!(type == ANIMATION_GROUPS_TYPE.HUMAN || type == ANIMATION_GROUPS_TYPE.EQUIPMENT || (flags & ANIMATION_FLAGS.AF_UNKNOWN_1000) != 0))
                    {
                        if (type != ANIMATION_GROUPS_TYPE.MONSTER)
                        {
                            if (type == ANIMATION_GROUPS_TYPE.HUMAN || type == ANIMATION_GROUPS_TYPE.EQUIPMENT)
                            {
                                v13 = 16;
                            }
                            else
                            {
                                v13 = 5;
                            }
                        }
                        else
                        {
                            v13 = 4;
                        }
                    }
                }

                if (type != ANIMATION_GROUPS_TYPE.MONSTER)
                {
                    if (type != ANIMATION_GROUPS_TYPE.SEA_MONSTER)
                    {
                        if (type == ANIMATION_GROUPS_TYPE.ANIMAL)
                        {
                            if (IsReplacedObjectAnimation(0, v13))
                            {
                                originalType = ANIMATION_GROUPS_TYPE.UNKNOWN;
                            }

                            if (v13 > 12)
                            {
                                switch (v13)
                                {
                                case 23:
                                    v13 = 0;

                                    break;

                                case 24:
                                    v13 = 1;

                                    break;

                                case 26:
                                    v13 = 9;

                                    break;

                                case 28:
                                    v13 = 10;

                                    break;

                                default:
                                    v13 = 2;

                                    break;
                                }
                            }

                            //if (v13 > 12)
                            //    v13 = 0; // 2
                        }
                        else
                        {
                            if (IsReplacedObjectAnimation(1, v13))
                            {
                                // LABEL_190:

                                LABEL_190(flags, ref v13);

                                return((byte)v13);
                            }
                        }
                    }
                    else
                    {
                        if (IsReplacedObjectAnimation(3, v13))
                        {
                            originalType = ANIMATION_GROUPS_TYPE.UNKNOWN;
                        }

                        if (v13 > 8)
                        {
                            v13 = 2;
                        }
                    }
                }
                else
                {
                    if (IsReplacedObjectAnimation(2, v13))
                    {
                        originalType = ANIMATION_GROUPS_TYPE.UNKNOWN;
                    }


                    if (!FileManager.Animations.AnimationExists(graphic, (byte)v13))
                    {
                        v13 = 1;
                    }

                    if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0)
                    {
                        // do nothing?
                    }
                    else if (v13 > 21)
                    {
                        v13 = 1;
                    }
                }


                if (originalType == ANIMATION_GROUPS_TYPE.UNKNOWN)
                {
                    LABEL_190(flags, ref v13);

                    return((byte)v13);
                }

                if (originalType != 0)
                {
                    if (originalType == ANIMATION_GROUPS_TYPE.ANIMAL && type == ANIMATION_GROUPS_TYPE.MONSTER)
                    {
                        switch (v13)
                        {
                        case 0:
                            v13 = 0;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 1:
                            v13 = 19;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 3:
                            v13 = 11;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 5:
                            v13 = 4;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 6:
                            v13 = 5;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 7:
                        case 11:
                            v13 = 10;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 8:
                            v13 = 2;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 9:
                            v13 = 17;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 10:
                            v13 = 18;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);

                        case 12:
                            v13 = 3;
                            LABEL_190(flags, ref v13);

                            return((byte)v13);
                        }

                        // LABEL_187
                        v13 = 1;
                    }

                    LABEL_190(flags, ref v13);

                    return((byte)v13);
                }

                switch (type)
                {
                case ANIMATION_GROUPS_TYPE.HUMAN:

                    switch (v13)
                    {
                    case 0:
                        v13 = 0;

                        goto LABEL_189;

                    case 2:
                        v13 = 21;

                        goto LABEL_189;

                    case 3:
                        v13 = 22;

                        goto LABEL_189;

                    case 4:
                    case 9:
                        v13 = 9;

                        goto LABEL_189;

                    case 5:
                        //LABEL_163:
                        v13 = 11;

                        goto LABEL_189;

                    case 6:
                        v13 = 13;

                        goto LABEL_189;

                    case 7:
                        //LABEL_165:
                        v13 = 18;

                        goto LABEL_189;

                    case 8:
                        //LABEL_172:
                        v13 = 19;

                        goto LABEL_189;

                    case 10:
                    case 21:
                        v13 = 20;

                        goto LABEL_189;

                    case 12:
                    case 14:
                        v13 = 16;

                        goto LABEL_189;

                    case 13:
                        //LABEL_164:
                        v13 = 17;

                        goto LABEL_189;

                    case 15:
                    case 16:
                        v13 = 30;

                        goto LABEL_189;

                    case 17:
                        v13 = 5;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 18:
                        v13 = 6;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 19:
                        v13 = 1;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);
                    }

                    //LABEL_161:
                    v13 = 4;

                    goto LABEL_189;

                case ANIMATION_GROUPS_TYPE.ANIMAL:

                    switch (v13)
                    {
                    case 0:
                        v13 = 0;

                        goto LABEL_189;

                    case 2:
                        v13 = 8;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 3:
                        v13 = 12;

                        goto LABEL_189;

                    case 4:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                    case 12:
                    case 13:
                    case 14:
                        v13 = 5;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 5:
                        v13 = 6;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 10:
                    case 21:
                        v13 = 7;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 11:
                        v13 = 3;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);

                    case 17:
                        //LABEL_170:
                        v13 = 9;

                        goto LABEL_189;

                    case 18:
                        //LABEL_162:
                        v13 = 10;

                        goto LABEL_189;

                    case 19:
                        v13 = 1;
                        LABEL_190(flags, ref v13);

                        return((byte)v13);
                    }

                    v13 = 2;
                    LABEL_190(flags, ref v13);

                    return((byte)v13);

                case ANIMATION_GROUPS_TYPE.SEA_MONSTER:

                    switch (v13)
                    {
                    case 0:
                        //LABEL_182:
                        v13 = 0;

                        goto LABEL_189;

                    case 2:
                    case 3:
                        //LABEL_178:
                        v13 = 8;

                        goto LABEL_189;

                    case 4:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                    case 12:
                    case 13:
                    case 14:
                        //LABEL_183:
                        v13 = 5;

                        goto LABEL_189;

                    case 5:
                        //LABEL_184:
                        v13 = 6;

                        goto LABEL_189;

                    case 10:
                    case 21:
                        //LABEL_185:
                        v13 = 7;

                        goto LABEL_189;

                    case 17:
                        //LABEL_186:
                        v13 = 3;

                        goto LABEL_189;

                    case 18:
                        v13 = 4;

                        goto LABEL_189;

                    case 19:
                        LABEL_190(flags, ref v13);

                        return((byte)v13);
                    }

                    v13 = 2;
                    LABEL_190(flags, ref v13);

                    return((byte)v13);

                default:
LABEL_189:

                    LABEL_190(flags, ref v13);

                    return((byte)v13);
                }

                // LABEL_188
                v13 = 2;

                LABEL_190(flags, ref v13);

                return((byte)v13);
            }


            byte result = mobile.AnimationGroup;


            bool isWalking = mobile.IsWalking;
            bool isRun     = mobile.IsRunning;

            if (mobile.Steps.Count != 0)
            {
                isWalking = true;
                isRun     = mobile.Steps.Front().Run;
            }

            switch (type)
            {
            case ANIMATION_GROUPS_TYPE.ANIMAL:

                if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_LOW_GROUP_EXTENDED) != 0)
                {
                    CalculateHight(graphic, mobile, flags, isRun, isWalking, ref result);
                }
                else
                {
                    if (!isWalking)
                    {
                        if (result == 0xFF)
                        {
                            if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0)
                            {
                                if (mobile.InWarMode)
                                {
                                    result = 1;
                                }
                                else
                                {
                                    result = 25;
                                }
                            }
                            else
                            {
                                result = 2;
                            }
                        }
                    }
                    else if (isRun)
                    {
                        if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0)
                        {
                            result = 24;
                        }
                        else
                        {
                            result = FileManager.Animations.AnimationExists(graphic, 1) ? (byte)1 : (byte)2;
                        }
                    }
                    else if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0 && !mobile.InWarMode)
                    {
                        result = 22;
                    }
                    else
                    {
                        result = 0;
                    }
                }

                break;

            case ANIMATION_GROUPS_TYPE.MONSTER:
                CalculateHight(graphic, mobile, flags, isRun, isWalking, ref result);

                break;

            case ANIMATION_GROUPS_TYPE.SEA_MONSTER:

                if (!isWalking)
                {
                    if (result == 0xFF)
                    {
                        result = 2;
                    }
                }
                else if (isRun)
                {
                    result = 1;
                }
                else
                {
                    result = 0;
                }

                break;

            default:

            {
                Item hand2 = mobile.HasEquipment ? mobile.Equipment[(int)Layer.TwoHanded] : null;

                if (!isWalking)
                {
                    if (result == 0xFF)
                    {
                        bool haveLightAtHand2 = hand2 != null && hand2.ItemData.IsLight && hand2.ItemData.AnimID == graphic;

                        if (mobile.IsMounted)
                        {
                            result = !haveLightAtHand2 ? (byte)25 : (byte)28;
                        }
                        else if (!mobile.InWarMode || mobile.IsDead)
                        {
                            result = !haveLightAtHand2 ? (byte)4 : (byte)0;
                        }
                        else if (haveLightAtHand2)
                        {
                            result = 2;
                        }
                        else
                        {
                            ushort[] handAnimIDs = { 0, 0 };
                            Item     hand1       = mobile.HasEquipment ? mobile.Equipment[(int)Layer.OneHanded] : null;

                            if (hand1 != null)
                            {
                                handAnimIDs[0] = hand1.ItemData.AnimID;
                            }

                            if (hand2 != null)
                            {
                                handAnimIDs[1] = hand2.ItemData.AnimID;
                            }


                            if (hand1 == null)
                            {
                                if (hand2 != null)
                                {
                                    result = handAnimIDs.Where(handAnimID => handAnimID >= 0x0263 && handAnimID <= 0x028B)
                                             .Any(handBaseGraphic => HANDS_BASE_ANIMID.Any(s => s == handBaseGraphic))
                                                     ? (byte)8
                                                     : (byte)7;
                                }
                                else
                                {
                                    result = 7;
                                }
                            }
                            else
                            {
                                result = 7;
                            }
                        }
                    }
                }
                else if (mobile.IsMounted)
                {
                    if (isRun)
                    {
                        result = 24;
                    }
                    else
                    {
                        result = 23;
                    }
                }
                //else if (EquippedGraphic0x3E96)
                //{

                //}
                else if (isRun || !mobile.InWarMode || mobile.IsDead)
                {
                    if ((flags & ANIMATION_FLAGS.AF_USE_UOP_ANIMATION) != 0 && isRun && FileManager.Animations.AnimationExists(graphic, 24))
                    {
                        result = 24;
                    }
                    else
                    {
                        result = (byte)(isRun ? 2 : 0);
                    }

                    if (hand2 != null)
                    {
                        ushort hand2Graphic = hand2.ItemData.AnimID;

                        if (hand2Graphic < 0x0240 || hand2Graphic > 0x03E1)
                        {
                            result = (byte)(isRun ? 3 : 1);
                        }
                        else
                        {
                            if (HAND2_BASE_ANIMID.Any(s => s == hand2Graphic))
                            {
                                result = (byte)(isRun ? 3 : 1);
                            }
                        }
                    }
                }
                else
                {
                    result = 15;
                }

                break;
            }
            }
            return(result);
        }
示例#4
0
        private static void LABEL_222(ANIMATION_FLAGS flags, ref ushort v13)
        {
            if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_LOW_GROUP_EXTENDED) != 0)
            {
                switch (v13)
                {
                case 0:
                    v13 = 0;

                    goto LABEL_243;

                case 1:
                    v13 = 19;

                    goto LABEL_243;

                case 5:
                case 6:

                    if ((flags & ANIMATION_FLAGS.AF_IDLE_AT_8_FRAME) != 0)
                    {
                        v13 = 4;
                    }
                    else
                    {
                        v13 = (ushort)(6 - (RandomHelper.GetValue() % 2 != 0 ? 1 : 0));
                    }

                    goto LABEL_243;

                case 8:
                    v13 = 2;

                    goto LABEL_243;

                case 9:
                    v13 = 17;

                    goto LABEL_243;

                case 10:
                    v13 = 18;

                    if ((flags & ANIMATION_FLAGS.AF_IDLE_AT_8_FRAME) != 0)
                    {
                        v13--;
                    }

                    goto LABEL_243;

                case 12:
                    v13 = 3;

                    goto LABEL_243;
                }

                // LABEL_241
                v13 = 1;
            }
            else
            {
                if ((flags & ANIMATION_FLAGS.AF_CALCULATE_OFFSET_BY_LOW_GROUP) != 0)
                {
                    switch (v13)
                    {
                    case 0:
                        // LABEL_232
                        v13 = 0;

                        break;

                    case 2:
                        v13 = 8;

                        break;

                    case 3:
                        v13 = 12;

                        break;

                    case 4:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                    case 12:
                    case 13:
                    case 14:
                        v13 = 5;

                        break;

                    case 5:
                        v13 = 6;

                        break;

                    case 10:
                    case 21:
                        v13 = 7;

                        break;

                    case 11:
                        //LABEL_238:
                        v13 = 3;

                        break;

                    case 17:
                        v13 = 9;

                        break;

                    case 18:
                        v13 = 10;

                        break;

                    case 19:

                        v13 = 1;

                        break;

                    default:
                        //LABEL_242:
                        v13 = 2;

                        break;
                    }
                }
            }

LABEL_243:
            v13 = (ushort)(v13 & 0x7F);

            if (v13 > 34)
            {
                v13 = 0;
            }

            //return (byte)v13;
        }