예제 #1
0
        /// <summary>
        /// The TonyAI 2.3+ sets bits of data by reading it directly from
        /// Spells.2da - such data is no longer stored in HenchSpells.2da. This
        /// funct clears those bits auto right after HenchSpells.2da loads.
        /// </summary>
        /// <remarks>The controls are disabled on the tabpage.
        ///
        ///
        /// Is based on
        /// <c><see cref="SetInfoVersion_spells()">SetInfoVersion_spells()</see></c>.
        /// This funct, however, ASSUMES that nothing in the spell-list has
        /// changed yet; this funct bypasses a bunch of differ-stuff that
        /// <c>SetInfoVersion_spells()</c> doesn't.</remarks>
        void UpdateSpellInfo()
        {
            Spell        spell;
            SpellChanged spellchanged;

            int spellinfo0, spellinfo;

            int total = Spells.Count;

            for (int id = 0; id != total; ++id)
            {
                spell = Spells[id];

                spellinfo0 = spell.spellinfo;

                spellinfo = spellinfo0 & ~(hc.HENCH_SPELL_INFO_CONCENTRATION_FLAG
                                           | hc.HENCH_SPELL_INFO_SPELL_LEVEL_MASK);

                if (spellinfo != spellinfo0)
                {
                    if (id == Id)
                    {
                        HenchControl.SetMasterText(spellinfo.ToString());                         // firing the TextChanged event takes care of it.
                    }
                    else
                    {
                        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;

                        // check it
                        spell.differ = control_Spells.SpellDiffer(spell, spellchanged);
                        Spells[id]   = spell;

                        Tree.Nodes[id].ForeColor = Color.Crimson;
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// This funct is used only for
        /// <c><see cref="Click_clearCoreAiVersion()">Click_clearCoreAiVersion()</see></c>.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="all"><c>true</c> to apply version to all classes else
        /// apply to changed classes only</param>
        /// <remarks>Used to be a helper for <c>Click_setCoreAiVersion()</c>.</remarks>
        void SetInfoVersion_classes(string str, bool all)
        {
            Class        @class;
            ClassChanged classchanged;

            int  classflags0, classflags, differ;
            bool dirty;

            int ver = (Int32.Parse(str) << HENCH_SPELL_INFO_VERSION_SHIFT);                     // the return from the dialog.


            int total = Classes.Count;

            for (int id = 0; id != total; ++id)
            {
                @class = Classes[id];

                if (dirty = ((@class.differ & control_Classes.bit_flags) != 0))
                {
                    classflags0 = ClassesChanged[id].flags;
                }
                else if (all || @class.isChanged)
                {
                    classflags0 = @class.flags;
                }
                else
                {
                    continue;                                                                                                                           // ignore clean class-structs if !all
                }
                if ((classflags0 & hc.HENCH_SPELL_INFO_VERSION_MASK) != ver)
                {
                    if (!BypassInfoVersion)
                    {
                        classflags = ((classflags0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK) | ver);
                    }
                    else
                    {
                        classflags = (classflags0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK);                          // wipe version info for TonyAI 2.3+
                    }
                    if (id == Id)
                    {
                        HenchControl.SetMasterText(classflags.ToString());                                      // firing the TextChanged event takes care of it.
                    }
                    else
                    {
                        if (dirty)
                        {
                            classchanged = ClassesChanged[id];
                        }
                        else
                        {
                            classchanged = new ClassChanged();

                            classchanged.feat1  = @class.feat1;
                            classchanged.feat2  = @class.feat2;
                            classchanged.feat3  = @class.feat3;
                            classchanged.feat4  = @class.feat4;
                            classchanged.feat5  = @class.feat5;
                            classchanged.feat6  = @class.feat6;
                            classchanged.feat7  = @class.feat7;
                            classchanged.feat8  = @class.feat8;
                            classchanged.feat9  = @class.feat9;
                            classchanged.feat10 = @class.feat10;
                            classchanged.feat11 = @class.feat11;
                        }

                        classchanged.flags = classflags;

                        // check it
                        differ        = control_Classes.ClassDiffer(@class, classchanged);
                        @class.differ = differ;
                        Classes[id]   = @class;

                        Color color;
                        if (differ != control_Classes.bit_clean)
                        {
                            ClassesChanged[id] = classchanged;
                            color = Color.Crimson;
                        }
                        else
                        {
                            ClassesChanged.Remove(id);

                            if (@class.isChanged)
                            {
                                color = Color.Blue;
                            }
                            else
                            {
                                color = DefaultForeColor;
                            }
                        }
                        Tree.Nodes[id].ForeColor = color;
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// This funct is used only for
        /// <c><see cref="Click_clearCoreAiVersion()">Click_clearCoreAiVersion()</see></c>.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="all"></param>
        /// <remarks>Used to be a helper for <c>Click_setCoreAiVersion()</c>.</remarks>
        void SetInfoVersion_spells(string str, bool all)
        {
            Spell        spell;
            SpellChanged spellchanged;

            int  spellinfo0, spellinfo, differ;
            bool dirty;

            int ver = Int32.Parse(str) << HENCH_SPELL_INFO_VERSION_SHIFT;                       // the return from the dialog.


            int total = Spells.Count;

            for (int id = 0; id != total; ++id)
            {
                spell = Spells[id];

                if (dirty = ((spell.differ & control_Spells.bit_spellinfo) != 0))
                {
                    spellinfo0 = SpellsChanged[id].spellinfo;
                }
                else if (all || spell.isChanged)
                {
                    spellinfo0 = spell.spellinfo;
                }
                else
                {
                    continue;                                                                                                                           // ignore clean spell-structs if !all
                }
                if (spellinfo0 == 0)
                {
                    continue;                                                                                                                           // if spellinfo is blank leave it blank
                }


                if ((spellinfo0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK) == 0)                              // force-clear the version if the rest of spellinfo is blank
                {
                    spellinfo = 0;
                }
                else
                {
                    spellinfo = ((spellinfo0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK) | ver);
                }


                if (spellinfo != spellinfo0)
                {
                    if (id == Id)
                    {
                        HenchControl.SetMasterText(spellinfo.ToString());                                       // firing the TextChanged event takes care of it.
                    }
                    else
                    {
                        if (dirty)
                        {
                            spellchanged = SpellsChanged[id];
                        }
                        else
                        {
                            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;

                        // check it
                        differ       = control_Spells.SpellDiffer(spell, spellchanged);
                        spell.differ = differ;
                        Spells[id]   = spell;

                        Color color;
                        if (differ != control_Spells.bit_clean)
                        {
                            SpellsChanged[id] = spellchanged;
                            color             = Color.Crimson;
                        }
                        else
                        {
                            SpellsChanged.Remove(id);

                            if (spell.isChanged)
                            {
                                color = Color.Blue;
                            }
                            else
                            {
                                color = DefaultForeColor;
                            }
                        }
                        Tree.Nodes[id].ForeColor = color;
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// This funct is used only for
        /// <c><see cref="Click_clearCoreAiVersion()">Click_clearCoreAiVersion()</see></c>.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="all"></param>
        /// <remarks>Used to be a helper for <c>Click_setCoreAiVersion()</c>.</remarks>
        void SetInfoVersion_racial(string str, bool all)
        {
            // NOTE: This will iterate through all changed races even
            // if an invalid version # is input via the dialog since it
            // inserts the default version even if there is no other
            // data in the racialflags-int.

            Race        race;
            RaceChanged racechanged;

            int  racialflags0, racialflags, differ;
            bool dirty;

            int ver = (Int32.Parse(str) << HENCH_SPELL_INFO_VERSION_SHIFT);                     // the return from the dialog.


            int total = Races.Count;

            for (int id = 0; id != total; ++id)
            {
                race = Races[id];

                if (dirty = ((race.differ & control_Racial.bit_flags) != 0))
                {
                    racialflags0 = RacesChanged[id].flags;
                }
                else if (all || race.isChanged)
                {
                    racialflags0 = race.flags;
                }
                else
                {
                    continue;                                                                                                                           // ignore clean racial-structs if !all
                }
                if ((racialflags0 & hc.HENCH_SPELL_INFO_VERSION_MASK) != ver)
                {
                    if (!BypassInfoVersion)
                    {
                        racialflags = ((racialflags0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK) | ver);
                    }
                    else
                    {
                        racialflags = (racialflags0 & ~hc.HENCH_SPELL_INFO_VERSION_MASK);                          // wipe version info for TonyAI 2.3+
                    }
                    if (id == Id)
                    {
                        HenchControl.SetMasterText(racialflags.ToString());                                     // firing the TextChanged event takes care of it.
                    }
                    else
                    {
                        if (dirty)
                        {
                            racechanged = RacesChanged[id];
                        }
                        else
                        {
                            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 = racialflags;

                        // check it
                        differ      = control_Racial.RaceDiffer(race, racechanged);
                        race.differ = differ;
                        Races[id]   = race;

                        Color color;
                        if (differ != control_Racial.bit_clean)
                        {
                            RacesChanged[id] = racechanged;
                            color            = Color.Crimson;
                        }
                        else
                        {
                            RacesChanged.Remove(id);

                            if (race.isChanged)
                            {
                                color = Color.Blue;
                            }
                            else
                            {
                                color = DefaultForeColor;
                            }
                        }
                        Tree.Nodes[id].ForeColor = color;
                    }
                }
            }
        }