Пример #1
0
        public void UpdateView(
            AllPropositions props)
        {
            ignoreChanges = true;
            allProps      = props;

            propTypeBonuses        = props.PropositionTypeBonuses;
            propTypeBonusesDefault = props.Default.PropositionTypeBonuses;

            bfnBonuses        = props.BraveFaithBonuses;
            bfnBonusesDefault = props.Default.BraveFaithBonuses;

            UpdateRowHeaders(FFTPatch.Context);

            foreach (PropositionClass clas in (PropositionClass[])Enum.GetValues(typeof(PropositionClass)))
            {
                foreach (PropositionType type in (PropositionType[])Enum.GetValues(typeof(PropositionType)))
                {
                    if (propTypeBonuses.ContainsKey(Tuple.From(type, clas)))
                    {
                        dataGridView1[(int)type, (int)clas].Value = propTypeBonuses[type, clas];
                    }
                }

                foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues(typeof(BraveFaithNeutral)))
                {
                    if (bfnBonuses.ContainsKey(Tuple.From(bfn, clas)))
                    {
                        dataGridView1[(int)bfn - 1 + braveColumn.Index, (int)clas].Value = bfnBonuses[bfn, clas];
                    }
                }
            }
            ignoreChanges = false;
        }
Пример #2
0
        public void UpdateView( 
            AllPropositions props )
        {
            ignoreChanges = true;
            allProps = props;

            propTypeBonuses = props.PropositionTypeBonuses;
            propTypeBonusesDefault = props.Default.PropositionTypeBonuses;

            bfnBonuses = props.BraveFaithBonuses;
            bfnBonusesDefault = props.Default.BraveFaithBonuses;

            UpdateRowHeaders( FFTPatch.Context );

            foreach (PropositionClass clas in (PropositionClass[])Enum.GetValues( typeof( PropositionClass ) ))
            {
                foreach (PropositionType type in (PropositionType[])Enum.GetValues( typeof( PropositionType ) ))
                {
                    if (propTypeBonuses.ContainsKey( Tuple.From( type, clas ) ))
                    {
                        dataGridView1[(int)type, (int)clas].Value = propTypeBonuses[type, clas];
                    }
                }

                foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues( typeof( BraveFaithNeutral ) ))
                {
                    if (bfnBonuses.ContainsKey( Tuple.From( bfn, clas ) ))
                    {
                        dataGridView1[(int)bfn - 1 + braveColumn.Index, (int)clas].Value = bfnBonuses[bfn, clas];
                    }
                }
            }
            ignoreChanges = false;
        }
Пример #3
0
        private void UpdateBonusCashDict(ComboBoxWithDefault sender, TupleDictionary <PropositionType, BonusPercent, BonusIndex> dict)
        {
            string changed = sender.Tag.ToString();

            string[] sides      = changed.Split('.');
            string   errandType = sides[0];
            string   percentage = sides[1];

            BonusPercent    percent = (BonusPercent)Enum.Parse(typeof(BonusPercent), percentage);
            PropositionType type    = (PropositionType)Enum.Parse(typeof(PropositionType), errandType);

            dict[type, percent] = (BonusIndex)(sender.SelectedIndex);
        }
Пример #4
0
        private void SetValuesBonusCashComboBoxes(
            TupleDictionary <PropositionType, BonusPercent, BonusIndex> dict,
            TupleDictionary <PropositionType, BonusPercent, BonusIndex> def,
            IList <ComboBoxWithDefault> boxes)
        {
            foreach (var box in boxes)
            {
                string tag = box.Tag.ToString();

                string[] sides      = tag.Split('.');
                string   errandType = sides[0];
                string   percentage = sides[1];

                PropositionType type    = (PropositionType)Enum.Parse(typeof(PropositionType), errandType);
                BonusPercent    percent = (BonusPercent)Enum.Parse(typeof(BonusPercent), percentage);

                box.SetIndexAndDefault((int)dict[type, percent], (int)def[type, percent]);
            }
        }
Пример #5
0
        public void UpdateView(
            AllPropositions props)
        {
            ignoreChanges       = true;
            this.props          = props;
            levelBonuses        = props.LevelBonuses;
            levelBonusesDefault = props.Default.LevelBonuses;

            braveBonuses        = props.BraveStatBonuses;
            braveBonusesDefault = props.Default.BraveStatBonuses;

            faithBonuses        = props.FaithStatBonuses;
            faithBonusesDefault = props.Default.FaithStatBonuses;

            UpdateRowHeaders(FFTPatch.Context);

            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues(typeof(BraveFaithNeutral)))
            {
                foreach (BraveFaithRange bfr in (BraveFaithRange[])Enum.GetValues(typeof(BraveFaithRange)))
                {
                    var thisTuple = Tuple.From(bfn, bfr);
                    if (braveBonuses.ContainsKey(thisTuple))
                    {
                        dataGridView1[(int)bfn, (int)bfr + braveBonusesFirstRow].Value = braveBonuses[bfn, bfr];
                    }

                    if (faithBonuses.ContainsKey(thisTuple))
                    {
                        dataGridView1[(int)bfn, (int)bfr + faithBonusesFirstRow].Value = faithBonuses[bfn, bfr];
                    }
                }

                foreach (LevelRange lr in (LevelRange[])Enum.GetValues(typeof(LevelRange)))
                {
                    if (levelBonuses.ContainsKey(Tuple.From(bfn, lr)))
                    {
                        dataGridView1[(int)bfn, (int)lr + levelBonusesFirstRow].Value = levelBonuses[bfn, lr];
                    }
                }
            }

            ignoreChanges = false;
        }
Пример #6
0
        public AllPropositions( IList<byte> bytes, AllPropositions defaults, bool brokenLevelBonuses )
        {
            Default = defaults;
            var names = FFTPatch.Context == Context.US_PSP ? PSPResources.Lists.Propositions : PSXResources.Lists.Propositions;

            List<Proposition> props = new List<Proposition>();
            if (defaults != null)
            {
                for (int i = 0; i < NumPropositions; i++)
                {
                    props.Add( new Proposition( names[i], bytes.Sub( i * propLength, (i + 1) * propLength - 1 ), defaults.Propositions[i] ) );
                }
            }
            else
            {
                for (int i = 0; i < NumPropositions; i++)
                {
                    props.Add( new Proposition( names[i], bytes.Sub( i * propLength, (i + 1) * propLength - 1 ) ) );
                }
            }

            Prices = new UInt16[8];
            for (int i = 0; i < 8; i++)
            {
                var b = bytes.Sub( propLength * NumPropositions + i * 2 + 2, propLength * NumPropositions + i * 2 + 2 + 1 );
                Prices[i] = Utilities.BytesToUShort( b[0], b[1] );
            }

            unknownBytes = bytes.Sub( 0x8b2, 0x8bf ).ToArray();

            propTypeBonuses = new TupleDictionary<PropositionType, PropositionClass, byte>();

            foreach (PropositionType type in (PropositionType[])Enum.GetValues( typeof( PropositionType ) ))
            {
                foreach (PropositionClass _class in (PropositionClass[])Enum.GetValues( typeof( PropositionClass ) ))
                {
                    propTypeBonuses[type, _class] = bytes[0x8C0 + ((int)type - 1) * 22 + (int)_class];
                }
            }
            propTypeBonuses = new TupleDictionary<PropositionType, PropositionClass, byte>( propTypeBonuses, false, true );

            bfBonuses = new TupleDictionary<BraveFaithNeutral, PropositionClass, byte>();
            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues( typeof( BraveFaithNeutral ) ))
            {
                foreach (PropositionClass _class in (PropositionClass[])Enum.GetValues( typeof( PropositionClass ) ))
                {
                    bfBonuses[bfn, _class] = bytes[0x970 + ((int)bfn - 1) * 22 + (int)_class];
                }
            }
            bfBonuses = new TupleDictionary<BraveFaithNeutral, PropositionClass, byte>( bfBonuses, false, true );

            braveBonuses = new TupleDictionary<BraveFaithNeutral, BraveFaithRange, byte>();
            faithBonuses = new TupleDictionary<BraveFaithNeutral, BraveFaithRange, byte>();
            levelBonuses = new TupleDictionary<BraveFaithNeutral, LevelRange, byte>();

            int levelBonusesOffset = brokenLevelBonuses ? 0x9B4 : 0x9D4;
            //int levelBonusesOffset = 0x9D4;

            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues( typeof( BraveFaithNeutral ) ))
            {
                foreach (BraveFaithRange range in (BraveFaithRange[])Enum.GetValues( typeof( BraveFaithRange ) ))
                {
                    braveBonuses[bfn, range] = bytes[0x9B4 + ((int)bfn - 1) * 5 + (int)range];
                    faithBonuses[bfn, range] = bytes[0x9C4 + ((int)bfn - 1) * 5 + (int)range];
                }

                foreach (LevelRange range in (LevelRange[])Enum.GetValues( typeof( LevelRange ) ))
                {
                    levelBonuses[bfn, range] = bytes[levelBonusesOffset + ((int)bfn - 1) * 10 + (int)range];
                }
            }

            braveBonuses = new TupleDictionary<BraveFaithNeutral, BraveFaithRange, byte>( braveBonuses, false, true );
            faithBonuses = new TupleDictionary<BraveFaithNeutral, BraveFaithRange, byte>( faithBonuses, false, true );
            levelBonuses = new TupleDictionary<BraveFaithNeutral, LevelRange, byte>( levelBonuses, false, true );

            treasureLandJpBonuses = new Dictionary<PropositionType, BonusIndex>();
            treasureLandGilBonuses = new Dictionary<PropositionType, BonusIndex>();
            bonusCashGilBonuses = new TupleDictionary<PropositionType, BonusPercent, BonusIndex>();
            bonusCashJpBonuses = new TupleDictionary<PropositionType, BonusPercent, BonusIndex>();

            foreach (PropositionType type in (PropositionType[])Enum.GetValues( typeof( PropositionType ) ))
            {
                treasureLandGilBonuses[type] = (BonusIndex)bytes[0x9F4 + 2 * ((int)type - 1)];
                treasureLandJpBonuses[type] = (BonusIndex)bytes[0x9F4 + 2 * ((int)type - 1) + 1];

                bonusCashGilBonuses[type, BonusPercent._10Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 2];
                bonusCashGilBonuses[type, BonusPercent._40Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 1];
                bonusCashGilBonuses[type, BonusPercent._50Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 0];

                bonusCashJpBonuses[type, BonusPercent._10Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 2 + 1];
                bonusCashJpBonuses[type, BonusPercent._40Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 1 + 1];
                bonusCashJpBonuses[type, BonusPercent._50Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 0 + 1];
            }
            bonusCashGilBonuses = new TupleDictionary<PropositionType, BonusPercent, BonusIndex>( bonusCashGilBonuses, false, true );
            bonusCashJpBonuses = new TupleDictionary<PropositionType, BonusPercent, BonusIndex>( bonusCashJpBonuses, false, true );

            SmallBonuses = new UInt16[8];
            LargeBonuses = new UInt16[8];
            for (int i = 0; i < 8; i++)
            {
                SmallBonuses[i] = Utilities.BytesToUShort( bytes[0xA34 + i * 2], bytes[0xA34 + i * 2 + 1] );
                LargeBonuses[i] = Utilities.BytesToUShort( bytes[0xA44 + i * 2], bytes[0xA44 + i * 2 + 1] );
            }

            JPMultipliers = new UInt16[10];
            GilMultipliers = new UInt16[10];

            for (int i = 0; i < 10; i++)
            {
                JPMultipliers[i] = Utilities.BytesToUShort( bytes[0xA54 + i * 2], bytes[0xA54 + i * 2 + 1] );
                GilMultipliers[i] = Utilities.BytesToUShort( bytes[0xA68 + i * 2], bytes[0xA68 + i * 2 + 1] );
            }

            Propositions = props.AsReadOnly();
        }
Пример #7
0
        public AllPropositions(IList <byte> bytes, AllPropositions defaults, bool brokenLevelBonuses)
        {
            Default = defaults;
            var names = FFTPatch.Context == Context.US_PSP ? PSPResources.Lists.Propositions : PSXResources.Lists.Propositions;

            List <Proposition> props = new List <Proposition>();

            if (defaults != null)
            {
                for (int i = 0; i < NumPropositions; i++)
                {
                    props.Add(new Proposition(names[i], bytes.Sub(i * propLength, (i + 1) * propLength - 1), defaults.Propositions[i]));
                }
            }
            else
            {
                for (int i = 0; i < NumPropositions; i++)
                {
                    props.Add(new Proposition(names[i], bytes.Sub(i * propLength, (i + 1) * propLength - 1)));
                }
            }

            Prices = new UInt16[8];
            for (int i = 0; i < 8; i++)
            {
                var b = bytes.Sub(propLength * NumPropositions + i * 2 + 2, propLength * NumPropositions + i * 2 + 2 + 1);
                Prices[i] = Utilities.BytesToUShort(b[0], b[1]);
            }

            unknownBytes = bytes.Sub(0x8b2, 0x8bf).ToArray();

            propTypeBonuses = new TupleDictionary <PropositionType, PropositionClass, byte>();

            foreach (PropositionType type in (PropositionType[])Enum.GetValues(typeof(PropositionType)))
            {
                foreach (PropositionClass _class in (PropositionClass[])Enum.GetValues(typeof(PropositionClass)))
                {
                    propTypeBonuses[type, _class] = bytes[0x8C0 + ((int)type - 1) * 22 + (int)_class];
                }
            }
            propTypeBonuses = new TupleDictionary <PropositionType, PropositionClass, byte>(propTypeBonuses, false, true);

            bfBonuses = new TupleDictionary <BraveFaithNeutral, PropositionClass, byte>();
            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues(typeof(BraveFaithNeutral)))
            {
                foreach (PropositionClass _class in (PropositionClass[])Enum.GetValues(typeof(PropositionClass)))
                {
                    bfBonuses[bfn, _class] = bytes[0x970 + ((int)bfn - 1) * 22 + (int)_class];
                }
            }
            bfBonuses = new TupleDictionary <BraveFaithNeutral, PropositionClass, byte>(bfBonuses, false, true);

            braveBonuses = new TupleDictionary <BraveFaithNeutral, BraveFaithRange, byte>();
            faithBonuses = new TupleDictionary <BraveFaithNeutral, BraveFaithRange, byte>();
            levelBonuses = new TupleDictionary <BraveFaithNeutral, LevelRange, byte>();

            int levelBonusesOffset = brokenLevelBonuses ? 0x9B4 : 0x9D4;

            //int levelBonusesOffset = 0x9D4;

            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues(typeof(BraveFaithNeutral)))
            {
                foreach (BraveFaithRange range in (BraveFaithRange[])Enum.GetValues(typeof(BraveFaithRange)))
                {
                    braveBonuses[bfn, range] = bytes[0x9B4 + ((int)bfn - 1) * 5 + (int)range];
                    faithBonuses[bfn, range] = bytes[0x9C4 + ((int)bfn - 1) * 5 + (int)range];
                }

                foreach (LevelRange range in (LevelRange[])Enum.GetValues(typeof(LevelRange)))
                {
                    levelBonuses[bfn, range] = bytes[levelBonusesOffset + ((int)bfn - 1) * 10 + (int)range];
                }
            }


            braveBonuses = new TupleDictionary <BraveFaithNeutral, BraveFaithRange, byte>(braveBonuses, false, true);
            faithBonuses = new TupleDictionary <BraveFaithNeutral, BraveFaithRange, byte>(faithBonuses, false, true);
            levelBonuses = new TupleDictionary <BraveFaithNeutral, LevelRange, byte>(levelBonuses, false, true);

            treasureLandJpBonuses  = new Dictionary <PropositionType, BonusIndex>();
            treasureLandGilBonuses = new Dictionary <PropositionType, BonusIndex>();
            bonusCashGilBonuses    = new TupleDictionary <PropositionType, BonusPercent, BonusIndex>();
            bonusCashJpBonuses     = new TupleDictionary <PropositionType, BonusPercent, BonusIndex>();

            foreach (PropositionType type in (PropositionType[])Enum.GetValues(typeof(PropositionType)))
            {
                treasureLandGilBonuses[type] = (BonusIndex)bytes[0x9F4 + 2 * ((int)type - 1)];
                treasureLandJpBonuses[type]  = (BonusIndex)bytes[0x9F4 + 2 * ((int)type - 1) + 1];

                bonusCashGilBonuses[type, BonusPercent._10Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 2];
                bonusCashGilBonuses[type, BonusPercent._40Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 1];
                bonusCashGilBonuses[type, BonusPercent._50Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 0];

                bonusCashJpBonuses[type, BonusPercent._10Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 2 + 1];
                bonusCashJpBonuses[type, BonusPercent._40Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 1 + 1];
                bonusCashJpBonuses[type, BonusPercent._50Percent] = (BonusIndex)bytes[0xA04 + ((int)type - 1) * 6 + 2 * 0 + 1];
            }
            bonusCashGilBonuses = new TupleDictionary <PropositionType, BonusPercent, BonusIndex>(bonusCashGilBonuses, false, true);
            bonusCashJpBonuses  = new TupleDictionary <PropositionType, BonusPercent, BonusIndex>(bonusCashJpBonuses, false, true);

            SmallBonuses = new UInt16[8];
            LargeBonuses = new UInt16[8];
            for (int i = 0; i < 8; i++)
            {
                SmallBonuses[i] = Utilities.BytesToUShort(bytes[0xA34 + i * 2], bytes[0xA34 + i * 2 + 1]);
                LargeBonuses[i] = Utilities.BytesToUShort(bytes[0xA44 + i * 2], bytes[0xA44 + i * 2 + 1]);
            }

            JPMultipliers  = new UInt16[10];
            GilMultipliers = new UInt16[10];

            for (int i = 0; i < 10; i++)
            {
                JPMultipliers[i]  = Utilities.BytesToUShort(bytes[0xA54 + i * 2], bytes[0xA54 + i * 2 + 1]);
                GilMultipliers[i] = Utilities.BytesToUShort(bytes[0xA68 + i * 2], bytes[0xA68 + i * 2 + 1]);
            }


            Propositions = props.AsReadOnly();
        }
Пример #8
0
        private void UpdateBonusCashDict( ComboBoxWithDefault sender, TupleDictionary<PropositionType, BonusPercent, BonusIndex> dict )
        {
            string changed = sender.Tag.ToString();

            string[] sides = changed.Split( '.' );
            string errandType = sides[0];
            string percentage = sides[1];

            BonusPercent percent = (BonusPercent)Enum.Parse( typeof( BonusPercent ), percentage );
            PropositionType type = (PropositionType)Enum.Parse( typeof( PropositionType ), errandType );

            dict[type, percent] = (BonusIndex)(sender.SelectedIndex);
        }
Пример #9
0
        private void SetValuesBonusCashComboBoxes(
            TupleDictionary<PropositionType, BonusPercent, BonusIndex> dict, 
            TupleDictionary<PropositionType, BonusPercent, BonusIndex> def, 
            IList<ComboBoxWithDefault> boxes )
        {
            foreach (var box in boxes)
            {
                string tag = box.Tag.ToString();

                string[] sides = tag.Split( '.' );
                string errandType = sides[0];
                string percentage = sides[1];

                PropositionType type = (PropositionType)Enum.Parse( typeof( PropositionType ), errandType );
                BonusPercent percent = (BonusPercent)Enum.Parse( typeof( BonusPercent ), percentage );

                box.SetIndexAndDefault( (int)dict[type, percent], (int)def[type, percent] );
            }
        }
Пример #10
0
        public void UpdateView(
            AllPropositions props )
        {
            ignoreChanges = true;
            this.props = props;
            levelBonuses = props.LevelBonuses;
            levelBonusesDefault = props.Default.LevelBonuses;

            braveBonuses = props.BraveStatBonuses;
            braveBonusesDefault = props.Default.BraveStatBonuses;

            faithBonuses = props.FaithStatBonuses;
            faithBonusesDefault = props.Default.FaithStatBonuses;

            UpdateRowHeaders( FFTPatch.Context );

            foreach (BraveFaithNeutral bfn in (BraveFaithNeutral[])Enum.GetValues( typeof( BraveFaithNeutral ) ))
            {
                foreach (BraveFaithRange bfr in (BraveFaithRange[])Enum.GetValues( typeof( BraveFaithRange ) ))
                {
                    var thisTuple = Tuple.From( bfn, bfr );
                    if (braveBonuses.ContainsKey( thisTuple ))
                    {
                        dataGridView1[(int)bfn, (int)bfr + braveBonusesFirstRow].Value = braveBonuses[bfn, bfr];
                    }

                    if (faithBonuses.ContainsKey( thisTuple ))
                    {
                        dataGridView1[(int)bfn, (int)bfr + faithBonusesFirstRow].Value = faithBonuses[bfn, bfr];
                    }
                }

                foreach (LevelRange lr in (LevelRange[])Enum.GetValues( typeof( LevelRange ) ))
                {
                    if (levelBonuses.ContainsKey( Tuple.From( bfn, lr ) ))
                    {
                        dataGridView1[(int)bfn, (int)lr + levelBonusesFirstRow].Value = levelBonuses[bfn, lr];
                    }
                }
            }

            ignoreChanges = false;
        }