コード例 #1
0
/*		/// <summary>
 *              /// Updates any InfoVersion for the spells when the 2da loads. Ensures
 *              /// that spell-info does not have a CoreAI version if there's no other
 *              /// data and that it does have a CoreAI version if there is.
 *              /// NOTE: There won't be any SpellChanged structs at this point although
 *              /// this can create such changed-structs - which is the point.
 *              /// </summary>
 *              void InfoVersionLoad_spells()
 *              {
 *                      Spell spell;
 *
 *                      int spellinfo, ver;
 *
 *                      int total = Spells.Count;
 *                      for (int id = 0; id != total; ++id)
 *                      {
 *                              spell = Spells[id];
 *                              spellinfo = spell.spellinfo;
 *
 *                              if (spellinfo != 0)
 *                              {
 *                                      ver = (spellinfo & HENCH_SPELL_INFO_VERSION_MASK);
 *
 *                                      if (ver == 0) // insert the default spell-version if it doesn't exist
 *                                      {
 *                                              ver = HENCH_SPELL_INFO_VERSION;
 *                                      }
 *                                      else if (ver == spellinfo) // clear the spell-version if that's the only data in spellinfo
 *                                      {
 *                                              ver = 0;
 *                                      }
 *                                      else
 *                                              continue;
 *
 *
 *                                      spellinfo &= ~HENCH_SPELL_INFO_VERSION_MASK;
 *                                      spellinfo |= ver;
 *
 *                                      var spellchanged = new SpellChanged();
 *
 *                                      spellchanged.targetinfo   = spell.targetinfo;
 *                                      spellchanged.effectweight = spell.effectweight;
 *                                      spellchanged.effecttypes  = spell.effecttypes;
 *                                      spellchanged.damageinfo   = spell.damageinfo;
 *                                      spellchanged.savetype     = spell.savetype;
 *                                      spellchanged.savedctype   = spell.savedctype;
 *
 *                                      spellchanged.spellinfo = spellinfo;
 *
 *                                      SpellsChanged[id] = spellchanged;
 *
 *                                      spell.differ = bit_spellinfo;
 *                                      Spells[id] = spell;
 *
 *                                      Tree.Nodes[id].ForeColor = Color.Crimson;
 *                              }
 *                      }
 *
 *                      InfoVersionUpdate       =
 *                      applyGlobal    .Enabled =
 *                      gotoNextChanged.Enabled = (SpellsChanged.Count != 0);
 *              } */


        /// <summary>
        /// Loads a HenchRacial.2da file.
        /// </summary>
        /// <param name="rows"></param>
        /// <remarks>If the file is not a valid HenchRacial.2da then this should
        /// hopefully throw an exception at the user. If it doesn't all bets are
        /// off.</remarks>
        void Load_HenchRacial(string[] rows)
        {
            if (HenchControl != null)
            {
                HenchControl.Dispose();                 // <- also removes the control from its collection
            }
            HenchControl = new control_Racial(this);
            panel2width  = HenchControl.Width;              // cache that
            panel2height = HenchControl.Height;             // cache that
            splitContainer.Panel2.Controls.Add(HenchControl);

            Type = Type2da.Racial;

            ClearData();


            string[] fields;
            string   field;

            foreach (string row in rows)
            {
                if (!String.IsNullOrEmpty(row))
                {
                    fields = row.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                    int id;
                    if (Int32.TryParse(fields[0], out id))                     // is a valid 2da row
                    {
                        var race = new Race();

                        race.id        = id;
                        race.isChanged = false;
                        race.differ    = control_Racial.bit_clean;

                        int col = 0;

                        if (hasLabels && (field = fields[++col]) != stars)
                        {
                            race.label = field;
                        }
                        else
                        {
                            race.label = String.Empty;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.flags = Int32.Parse(field);
                        }
                        else
                        {
                            race.flags = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.feat1 = Int32.Parse(field);
                        }
                        else
                        {
                            race.feat1 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.feat2 = Int32.Parse(field);
                        }
                        else
                        {
                            race.feat2 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.feat3 = Int32.Parse(field);
                        }
                        else
                        {
                            race.feat3 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.feat4 = Int32.Parse(field);
                        }
                        else
                        {
                            race.feat4 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            race.feat5 = Int32.Parse(field);
                        }
                        else
                        {
                            race.feat5 = 0;
                        }

                        Races.Add(race);                                // race-structs can now be referenced in the 'Races' list by their
                    }                                                   // - Races[id]
                }                                                       // - HenchRacial.2da row#
            }                                                           // - SubRaceID (RacialSubtypes.2da row#)

            GrowTree(true);

            // check if any info-version(s) need to be updated in flags-int.
//			InfoVersionLoad_racial();

            bu_Apply.Text       = "apply this race\'s data";
            tree_Highlight.Text = "highlight blank Racial flags nodes";
        }
コード例 #2
0
/*		/// <summary>
 *              /// Updates any InfoVersion for the races when the 2da loads. Ensures
 *              /// that racial-flags has a CoreAI version - RacialFlags always has a
 *              /// Version (unlike spellinfo).
 *              /// NOTE: There won't be any RaceChanged structs at this point although
 *              /// this can create such changed-structs - which is the point.
 *              /// </summary>
 *              void InfoVersionLoad_racial()
 *              {
 *                      Race race;
 *
 *                      int total = Races.Count;
 *                      for (int id = 0; id != total; ++id)
 *                      {
 *                              race = Races[id];
 *                              if ((race.flags & HENCH_SPELL_INFO_VERSION_MASK) == 0)
 *                              {
 *                                      var racechanged = new RaceChanged();
 *
 *                                      racechanged.feat1 = race.feat1;
 *                                      racechanged.feat2 = race.feat2;
 *                                      racechanged.feat3 = race.feat3;
 *                                      racechanged.feat4 = race.feat4;
 *                                      racechanged.feat5 = race.feat5;
 *
 *                                      racechanged.flags = (race.flags | HENCH_SPELL_INFO_VERSION); // insert the default version #
 *
 *                                      RacesChanged[id] = racechanged;
 *
 *                                      race.differ = bit_flags;
 *                                      Races[id] = race;
 *
 *                                      Tree.Nodes[id].ForeColor = Color.Crimson;
 *                              }
 *                      }
 *
 *                      InfoVersionUpdate       =
 *                      applyGlobal    .Enabled =
 *                      gotoNextChanged.Enabled = (RacesChanged.Count != 0);
 *              } */


        /// <summary>
        /// Loads a HenchClasses.2da file.
        /// </summary>
        /// <param name="rows"></param>
        /// <remarks>If the file is not a valid HenchClasses.2da then this
        /// should hopefully throw an exception at the user. If it doesn't all
        /// bets are off.</remarks>
        void Load_HenchClasses(string[] rows)
        {
            if (HenchControl != null)
            {
                HenchControl.Dispose();                 // <- also removes the control from its collection
            }
            HenchControl = new control_Classes(this);
            panel2width  = HenchControl.Width;              // cache that
            panel2height = HenchControl.Height;             // cache that
            splitContainer.Panel2.Controls.Add(HenchControl);

            Type = Type2da.Classes;

            ClearData();


            string[] fields;
            string   field;

            foreach (string row in rows)
            {
                if (!String.IsNullOrEmpty(row))
                {
                    fields = row.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                    int id;
                    if (Int32.TryParse(fields[0], out id))                     // is a valid 2da row
                    {
                        var @class = new Class();

                        @class.id        = id;
                        @class.isChanged = false;
                        @class.differ    = control_Classes.bit_clean;

                        int col = 0;

                        if (hasLabels && (field = fields[++col]) != stars)
                        {
                            @class.label = field;
                        }
                        else
                        {
                            @class.label = String.Empty;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.flags = Int32.Parse(field);
                        }
                        else
                        {
                            @class.flags = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat1 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat1 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat2 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat2 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat3 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat3 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat4 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat4 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat5 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat5 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat6 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat6 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat7 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat7 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat8 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat8 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat9 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat9 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat10 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat10 = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            @class.feat11 = Int32.Parse(field);
                        }
                        else
                        {
                            @class.feat11 = 0;
                        }

                        Classes.Add(@class);                            // class-structs can now be referenced in the 'Classes' list by their
                    }                                                   // - Classes[id]
                }                                                       // - HenchClasses.2da row#
            }                                                           // - ClassID (Classes.2da row#)

            GrowTree(true);

            // check if any info-version(s) need to be updated in flags-int.
//			InfoVersionLoad_classes();

            bu_Apply.Text       = "apply this class\' data";
            tree_Highlight.Text = "highlight blank Class flags nodes";
        }
コード例 #3
0
        /// <summary>
        /// Loads a HenchSpells.2da file.
        /// </summary>
        /// <param name="rows"></param>
        /// <remarks>If the file is not a valid HenchSpells.2da then this should
        /// hopefully throw an exception at the user. If it doesn't all bets are
        /// off.</remarks>
        void Load_HenchSpells(string[] rows)
        {
            if (HenchControl != null)
            {
                HenchControl.Dispose();                 // <- also removes the control from its collection
            }
            HenchControl = new control_Spells(this);
            panel2width  = HenchControl.Width;              // cache that
            panel2height = HenchControl.Height;             // cache that
            splitContainer.Panel2.Controls.Add(HenchControl);

            Type = Type2da.Spells;

            ClearData();


            string[] fields;
            string   field;

            foreach (string row in rows)
            {
                if (!String.IsNullOrEmpty(row))
                {
                    fields = row.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                    int id;
                    if (Int32.TryParse(fields[0], out id))                     // is a valid 2da row
                    {
                        var spell = new Spell();

                        spell.id        = id;
                        spell.isChanged = false;
                        spell.differ    = control_Spells.bit_clean;

                        int col = 0;

                        if (hasLabels && (field = fields[++col]) != stars)
                        {
                            spell.label = field;
                        }
                        else
                        {
                            spell.label = String.Empty;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.spellinfo = Int32.Parse(field);
                        }
                        else
                        {
                            spell.spellinfo = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.targetinfo = Int32.Parse(field);
                        }
                        else
                        {
                            spell.targetinfo = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.effectweight = Single.Parse(field);
                        }
                        else
                        {
                            spell.effectweight = 0.0f;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.effecttypes = Int32.Parse(field);
                        }
                        else
                        {
                            spell.effecttypes = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.damageinfo = Int32.Parse(field);
                        }
                        else
                        {
                            spell.damageinfo = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.savetype = Int32.Parse(field);
                        }
                        else
                        {
                            spell.savetype = 0;
                        }

                        if ((field = fields[++col]) != stars)
                        {
                            spell.savedctype = Int32.Parse(field);
                        }
                        else
                        {
                            spell.savedctype = 0;
                        }

                        Spells.Add(spell);                              // spell-structs can now be referenced in the 'Spells' list by their
                    }                                                   // - Spells[id]
                }                                                       // - HenchSpells.2da row#
            }                                                           // - SpellID (Spells.2da row#)

            GrowTree(true);

            // check if any info-version(s) need to be updated in spellinfo-int.
//			InfoVersionLoad_spells();

            bu_Apply.Text       = "apply this spell\'s data";
            tree_Highlight.Text = "highlight blank SpellInfo nodes";
        }