Ejemplo n.º 1
0
        public CharacterParamManager(string file)
        {
            Reset();
            try
            {
                ParamFile param = new ParamFile(file);

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.X = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = (Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value) - 1).Clamp(0, int.MaxValue);
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.X1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.X2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }
Ejemplo n.º 2
0
        public CharacterParamManager(string file, string character = null)
        {
            Reset();

            try
            {
                param = new ParamFile(file);

                if (character != null)
                {
                    this.character = character;
                }
                else
                {
                    this.character = Path.GetFileNameWithoutExtension(file.Replace("fighter_param_vl_", ""));
                }

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //ECB

                for (int id = 0; id < ((ParamGroup)param.Groups[3]).Chunks.Length; id++)
                {
                    ECB ecb = new ECB();
                    ecb.ID   = id;
                    ecb.Bone = Convert.ToInt32(((ParamGroup)param.Groups[3])[id][0].Value);
                    ecb.X    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][1].Value);
                    ecb.Y    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][2].Value);
                    ecb.Z    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][3].Value);

                    ECBs.Add(id, ecb);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.ID = id;
                    hurtbox.X  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value);
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    if (hurtbox.X == hurtbox.X2 && hurtbox.Y == hurtbox.Y2 && hurtbox.Z == hurtbox.Z2)
                    {
                        // It can't be anything but a sphere. I think some part of the param might
                        // control this so this might be a crude detection method. This fixes Bowser Jr at least.
                        hurtbox.isSphere = true;
                    }

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.Z1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }

                //Special Bubbles, these are used in certain moves as trigger/reflect/absorb bubbles and shields such as counters or reflectors

                //Read the data from the csv file that contains the param group, entry and values as well as the character and animation
                foreach (csvSpecialBubble sb in SpecialBubbleData)
                {
                    if (sb.Character == this.character)
                    {
                        try
                        {
                            SpecialBubbles.Add(sb.ID, new SpecialBubble()
                            {
                                Animations = sb.Animation.ToLower().Split('|').ToList(),
                                Type       = (SpecialBubble.BubbleType)sb.Type,
                                X          = sb.X != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.X].Value) : 0,
                                Y          = sb.Y != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Y].Value) : 0,
                                Z          = sb.Z != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Z].Value) : 0,
                                X2         = sb.X2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.X2].Value) : 0,
                                Y2         = sb.Y2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Y2].Value) : 0,
                                Z2         = sb.Z2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Z2].Value) : 0,
                                Size       = sb.Size != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Size].Value) : 0,
                                Bone       = sb.SetBone ? sb.Bone :(sb.Bone != -1 ? Convert.ToInt32(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Bone].Value) : 0),
                                ID         = sb.ID,
                                StartFrame = sb.StartFrame,
                                EndFrame   = sb.EndFrame
                            });
                        }catch
                        {
                            //Probably wrong params, ignore it... also don't reset hurtboxes and other stuff if something goes wrong here
                        }
                    }
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }
Ejemplo n.º 3
0
        public CharacterParamManager(string file)
        {
            Reset();
            try
            {
                ParamFile param = new ParamFile(file);

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //ECB

                for (int id = 0; id < ((ParamGroup)param.Groups[3]).Chunks.Length; id++)
                {
                    ECB ecb = new ECB();
                    ecb.ID   = id;
                    ecb.Bone = VBN.applyBoneThunk(Convert.ToInt32(((ParamGroup)param.Groups[3])[id][0].Value));
                    ecb.X    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][1].Value);
                    ecb.Y    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][2].Value);
                    ecb.Z    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][3].Value);

                    ECBs.Add(id, ecb);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.X = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = VBN.applyBoneThunk(Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value));
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    if (hurtbox.X == hurtbox.X2 && hurtbox.Y == hurtbox.Y2 && hurtbox.Z == hurtbox.Z2)
                    {
                        // It can't be anything but a sphere. I think some part of the param might
                        // control this so this might be a crude detection method. This fixes Bowser Jr at least.
                        hurtbox.isSphere = true;
                    }

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.X1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.X2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }