Ejemplo n.º 1
0
        public void UpdateView(JobLevels levels)
        {
            this.levels = levels;
            foreach (Control c in Controls)
            {
                if (c is NumericUpDownWithDefault)
                {
                    NumericUpDownWithDefault spinner = c as NumericUpDownWithDefault;
                    spinner.ValueChanged -= spinner_ValueChanged;
                    spinner.SetValueAndDefault(
                        ReflectionHelpers.GetFieldOrProperty <UInt16>(levels, spinner.Tag.ToString()),
                        ReflectionHelpers.GetFieldOrProperty <UInt16>(levels.Default, spinner.Tag.ToString()));
                    spinner.ValueChanged += spinner_ValueChanged;
                }
            }

            List <Requirements> reqs = new List <Requirements>(new Requirements[] {
                levels.Chemist, levels.Knight, levels.Archer, levels.Monk,
                levels.WhiteMage, levels.BlackMage, levels.TimeMage, levels.Summoner,
                levels.Thief, levels.Orator, levels.Mystic, levels.Geomancer,
                levels.Dragoon, levels.Samurai, levels.Ninja, levels.Arithmetician,
                levels.Bard, levels.Dancer, levels.Mime
            });

            if (FFTPatch.Context == Context.US_PSP)
            {
                reqs.Add(levels.DarkKnight);
                reqs.Add(levels.OnionKnight);
                reqs.Add(levels.Unknown);
            }
            IList <string> names     = FFTPatch.Context == Context.US_PSP ? PSPResources.Lists.JobNames : PSXResources.Lists.JobNames;
            IList <string> sideNames = names.Sub(0x4B, 0x5D);
            IList <string> topNames  = names.Sub(0x4A, 0x5D);

            for (int i = 0; i < sideNames.Count; i++)
            {
                labels[i].Text         = sideNames[i];
                verticalLabels[i].Text = topNames[i];
            }
            verticalLabels[topNames.Count - 1].Text = topNames[topNames.Count - 1];

            bool psp = FFTPatch.Context == Context.US_PSP;

            if (psp)
            {
                darkKnightLabel.Text          = names[0xA0];
                darkKnightVerticalLabel.Text  = names[0xA0];
                onionKnightLabel.Text         = names[0xA4];
                onionKnightVerticalLabel.Text = names[0xA4];
            }
            darkKnightLabel.Visible          = psp;
            darkKnightVerticalLabel.Visible  = psp;
            unknown1VerticalLabel.Visible    = psp;
            unknown2VerticalLabel.Visible    = psp;
            unknownLabel.Visible             = psp;
            onionKnightLabel.Visible         = psp;
            onionKnightVerticalLabel.Visible = psp;

            requirementsEditor1.Requirements = reqs;
        }
Ejemplo n.º 2
0
        public void UpdateView( JobLevels levels )
        {
            this.levels = levels;
            foreach( Control c in Controls )
            {
                if( c is NumericUpDownWithDefault )
                {
                    NumericUpDownWithDefault spinner = c as NumericUpDownWithDefault;
                    spinner.ValueChanged -= spinner_ValueChanged;
                    spinner.SetValueAndDefault(
                        ReflectionHelpers.GetFieldOrProperty<UInt16>( levels, spinner.Tag.ToString() ),
                        ReflectionHelpers.GetFieldOrProperty<UInt16>( levels.Default, spinner.Tag.ToString() ) );
                    spinner.ValueChanged += spinner_ValueChanged;
                }
            }

            List<Requirements> reqs = new List<Requirements>( new Requirements[] {
                levels.Chemist, levels.Knight, levels.Archer, levels.Monk,
                levels.WhiteMage, levels.BlackMage, levels.TimeMage, levels.Summoner,
                levels.Thief, levels.Orator, levels.Mystic, levels.Geomancer,
                levels.Dragoon, levels.Samurai, levels.Ninja, levels.Arithmetician,
                levels.Bard, levels.Dancer, levels.Mime } );
            if( FFTPatch.Context == Context.US_PSP )
            {
                reqs.Add( levels.DarkKnight );
                reqs.Add( levels.OnionKnight );
                reqs.Add( levels.Unknown );
            }
            IList<string> names = FFTPatch.Context == Context.US_PSP ? PSPResources.Lists.JobNames : PSXResources.Lists.JobNames;
            IList<string> sideNames = names.Sub( 0x4B, 0x5D );
            IList<string> topNames = names.Sub( 0x4A, 0x5D );
            for ( int i = 0; i < sideNames.Count; i++ )
            {
                labels[i].Text = sideNames[i];
                verticalLabels[i].Text = topNames[i];
            }
            verticalLabels[topNames.Count - 1].Text = topNames[topNames.Count - 1];

            bool psp = FFTPatch.Context == Context.US_PSP;
            if ( psp )
            {
                darkKnightLabel.Text = names[0xA0];
                darkKnightVerticalLabel.Text = names[0xA0];
                onionKnightLabel.Text = names[0xA4];
                onionKnightVerticalLabel.Text = names[0xA4];
            }
            darkKnightLabel.Visible = psp;
            darkKnightVerticalLabel.Visible = psp;
            unknown1VerticalLabel.Visible = psp;
            unknown2VerticalLabel.Visible = psp;
            unknownLabel.Visible = psp;
            onionKnightLabel.Visible = psp;
            onionKnightVerticalLabel.Visible = psp;

            requirementsEditor1.Requirements = reqs;
        }
Ejemplo n.º 3
0
        protected override void LoadAllCommandCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(service.Fault))
                    {
                        return;
                    }

                    Models = new PagedCollectionView(service.Models);
                    if (service.Models != null && service.Models.Count > 0)
                    {
                        RecordCount = RecordCountLabel + service.Models.Count;
                        Models.MoveCurrentTo(null);
                        Models.CurrentChanged += (s, e) =>
                        {
                            Model = Models.CurrentItem as StaffLevel;
                            if (Model != null)
                            {
                                if (JobLevels != null)
                                {
                                    ObservableCollection <Level> levels = (ObservableCollection <Level>)JobLevels.SourceCollection;
                                    Level level = levels.Where(l => l.Id == Model.Level.Id).SingleOrDefault();
                                    JobLevels.MoveCurrentTo(level);
                                }

                                if (Staffs != null)
                                {
                                    ObservableCollection <Infrastructure.MangoService.Staff> staffs = (ObservableCollection <Infrastructure.MangoService.Staff>)Staffs.SourceCollection;
                                    Infrastructure.MangoService.Staff staff = staffs.Where(l => l.Id == Model.Staff.Id).SingleOrDefault();
                                    Staffs.MoveCurrentTo(staff);
                                }
                            }

                            UpdateViewState(Edit.Mode.Editing);
                            CanSaveItem = false;
                        };
                    }
                    else
                    {
                        RecordCount = RecordCountLabel + 0;
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Ejemplo n.º 4
0
        protected override void OnClearCommand()
        {
            try
            {
                UpdateViewState(Edit.Mode.Adding);
                Model = new StaffLevel();

                if (JobLevels != null)
                {
                    JobLevels.MoveCurrentToFirst();
                }
                if (Staffs != null)
                {
                    Staffs.MoveCurrentToFirst();
                }
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Ejemplo n.º 5
0
        public void UpdateView(JobLevels levels)
        {
            this.levels = levels;
            foreach (Control c in Controls)
            {
                if (c is NumericUpDownWithDefault)
                {
                    NumericUpDownWithDefault spinner = c as NumericUpDownWithDefault;
                    spinner.ValueChanged -= spinner_ValueChanged;
                    spinner.SetValueAndDefault(
                        ReflectionHelpers.GetFieldOrProperty <UInt16>(levels, spinner.Tag.ToString()),
                        ReflectionHelpers.GetFieldOrProperty <UInt16>(levels.Default, spinner.Tag.ToString()));
                    spinner.ValueChanged += spinner_ValueChanged;
                }
            }

            List <Requirements> reqs = new List <Requirements>(new Requirements[] {
                levels.Chemist, levels.Knight, levels.Archer, levels.Monk,
                levels.WhiteMage, levels.BlackMage, levels.TimeMage, levels.Summoner,
                levels.Thief, levels.Orator, levels.Mystic, levels.Geomancer,
                levels.Dragoon, levels.Samurai, levels.Ninja, levels.Arithmetician,
                levels.Bard, levels.Dancer, levels.Mime
            });

            if (FFTPatch.Context == Context.US_PSP)
            {
                reqs.Add(levels.DarkKnight);
                reqs.Add(levels.OnionKnight);
                reqs.Add(levels.Unknown);
            }
            darkKnightSideLabel.Visible  = FFTPatch.Context == Context.US_PSP;
            darkKnightTopLabel.Visible   = FFTPatch.Context == Context.US_PSP;
            unknown1TopLabel.Visible     = FFTPatch.Context == Context.US_PSP;
            unknown2TopLabel.Visible     = FFTPatch.Context == Context.US_PSP;
            unknownSideLabel.Visible     = FFTPatch.Context == Context.US_PSP;
            onionKnightSideLabel.Visible = FFTPatch.Context == Context.US_PSP;
            onionKnightTopLabel.Visible  = FFTPatch.Context == Context.US_PSP;

            requirementsEditor1.Requirements = reqs;
        }
Ejemplo n.º 6
0
        public void UpdateView( JobLevels levels )
        {
            this.levels = levels;
            foreach( Control c in Controls )
            {
                if( c is NumericUpDownWithDefault )
                {
                    NumericUpDownWithDefault spinner = c as NumericUpDownWithDefault;
                    spinner.ValueChanged -= spinner_ValueChanged;
                    spinner.SetValueAndDefault(
                        ReflectionHelpers.GetFieldOrProperty<UInt16>( levels, spinner.Tag.ToString() ),
                        ReflectionHelpers.GetFieldOrProperty<UInt16>( levels.Default, spinner.Tag.ToString() ) );
                    spinner.ValueChanged += spinner_ValueChanged;
                }
            }

            List<Requirements> reqs = new List<Requirements>( new Requirements[] {
                levels.Chemist, levels.Knight, levels.Archer, levels.Monk,
                levels.WhiteMage, levels.BlackMage, levels.TimeMage, levels.Summoner,
                levels.Thief, levels.Orator, levels.Mystic, levels.Geomancer,
                levels.Dragoon, levels.Samurai, levels.Ninja, levels.Arithmetician,
                levels.Bard, levels.Dancer, levels.Mime } );
            if( FFTPatch.Context == Context.US_PSP )
            {
                reqs.Add( levels.DarkKnight );
                reqs.Add( levels.OnionKnight );
                reqs.Add( levels.Unknown );
            }
            darkKnightSideLabel.Visible = FFTPatch.Context == Context.US_PSP;
            darkKnightTopLabel.Visible = FFTPatch.Context == Context.US_PSP;
            unknown1TopLabel.Visible = FFTPatch.Context == Context.US_PSP;
            unknown2TopLabel.Visible = FFTPatch.Context == Context.US_PSP;
            unknownSideLabel.Visible = FFTPatch.Context == Context.US_PSP;
            onionKnightSideLabel.Visible = FFTPatch.Context == Context.US_PSP;
            onionKnightTopLabel.Visible = FFTPatch.Context == Context.US_PSP;

            requirementsEditor1.Requirements = reqs;
        }
Ejemplo n.º 7
0
 private static void LoadDataFromBytes(
     IList<byte> abilities, IList<byte> abilityEffects,
     IList<byte> oldItems, IList<byte> oldItemAttributes,
     IList<byte> newItems, IList<byte> newItemAttributes,
     IList<byte> jobs, IList<byte> jobLevels,
     IList<byte> skillSets, IList<byte> monsterSkills,
     IList<byte> actionMenus,
     IList<byte> statusAttributes, IList<byte> inflictStatuses,
     IList<byte> poach,
     IList<byte> entd1, IList<byte> entd2, IList<byte> entd3, IList<byte> entd4, IList<byte> entd5,
     IList<byte> moveFind,
     IList<byte> inventories )
 {
     try
     {
         bool psp = Context == Context.US_PSP;
         var Abilities = new AllAbilities( abilities, abilityEffects );
         var Items = new AllItems( oldItems, newItems != null ? newItems : null );
         var ItemAttributes = new AllItemAttributes( oldItemAttributes, newItemAttributes != null ? newItemAttributes : null );
         var Jobs = new AllJobs( Context, jobs );
         var JobLevels = new JobLevels( Context, jobLevels,
             new JobLevels( Context, Context == Context.US_PSP ? PSPResources.JobLevelsBin : PSXResources.JobLevelsBin ) );
         var SkillSets = new AllSkillSets( Context, skillSets,
             Context == Context.US_PSP ? PSPResources.SkillSetsBin : PSXResources.SkillSetsBin );
         var MonsterSkills = new AllMonsterSkills( monsterSkills );
         var ActionMenus = new AllActionMenus( actionMenus, Context );
         var StatusAttributes = new AllStatusAttributes( statusAttributes );
         var InflictStatuses = new AllInflictStatuses( inflictStatuses );
         var PoachProbabilities = new AllPoachProbabilities( poach );
         var ENTDs = psp ? new AllENTDs( entd1, entd2, entd3, entd4, entd5 ) : new AllENTDs( entd1, entd2, entd3, entd4 );
         var MoveFind = new AllMoveFindItems( Context, moveFind, new AllMoveFindItems( Context, psp ? PSPResources.MoveFind : PSXResources.MoveFind ) );
         var StoreInventories = new AllStoreInventories( Context, inventories, psp ? PSPResources.StoreInventoriesBin : PSXResources.StoreInventoriesBin );
         FFTPatch.Abilities = Abilities;
         FFTPatch.Items = Items;
         FFTPatch.ItemAttributes = ItemAttributes;
         FFTPatch.Jobs = Jobs;
         FFTPatch.JobLevels = JobLevels;
         FFTPatch.SkillSets = SkillSets;
         FFTPatch.MonsterSkills = MonsterSkills;
         FFTPatch.ActionMenus = ActionMenus;
         FFTPatch.StatusAttributes = StatusAttributes;
         FFTPatch.InflictStatuses = InflictStatuses;
         FFTPatch.PoachProbabilities = PoachProbabilities;
         FFTPatch.ENTDs = ENTDs;
         FFTPatch.MoveFind = MoveFind;
         FFTPatch.StoreInventories = StoreInventories;
     }
     catch( Exception )
     {
         throw new LoadPatchException();
     }
 }
Ejemplo n.º 8
0
 private static void BuildFromContext()
 {
     switch( Context )
     {
         case Context.US_PSP:
             Abilities = new AllAbilities( PSPResources.AbilitiesBin, PSPResources.AbilityEffectsBin );
             Items = new AllItems(
                 PSPResources.OldItemsBin,
                 PSPResources.NewItemsBin );
             ItemAttributes = new AllItemAttributes(
                 PSPResources.OldItemAttributesBin,
                 PSPResources.NewItemAttributesBin );
             Jobs = new AllJobs( Context, PSPResources.JobsBin );
             JobLevels = new JobLevels( Context, PSPResources.JobLevelsBin,
                 new JobLevels( Context, PSPResources.JobLevelsBin ) );
             SkillSets = new AllSkillSets( Context, PSPResources.SkillSetsBin,
                 PSPResources.SkillSetsBin );
             MonsterSkills = new AllMonsterSkills( PSPResources.MonsterSkillsBin );
             ActionMenus = new AllActionMenus( PSPResources.ActionEventsBin, Context );
             StatusAttributes = new AllStatusAttributes( PSPResources.StatusAttributesBin );
             InflictStatuses = new AllInflictStatuses( PSPResources.InflictStatusesBin );
             PoachProbabilities = new AllPoachProbabilities( PSPResources.PoachProbabilitiesBin );
             ENTDs = new AllENTDs( PSPResources.ENTD1, PSPResources.ENTD2, PSPResources.ENTD3, PSPResources.ENTD4, PSPResources.ENTD5 );
             MoveFind = new AllMoveFindItems( Context, PSPResources.MoveFind, new AllMoveFindItems( Context, PSPResources.MoveFind ) );
             StoreInventories = new AllStoreInventories( Context, PSPResources.StoreInventoriesBin, PSPResources.StoreInventoriesBin );
             break;
         case Context.US_PSX:
             Abilities = new AllAbilities( PSXResources.AbilitiesBin, PSXResources.AbilityEffectsBin );
             Items = new AllItems( PSXResources.OldItemsBin, null );
             ItemAttributes = new AllItemAttributes( PSXResources.OldItemAttributesBin, null );
             Jobs = new AllJobs( Context, PSXResources.JobsBin );
             JobLevels = new JobLevels( Context, PSXResources.JobLevelsBin,
                 new JobLevels( Context, PSXResources.JobLevelsBin ) );
             SkillSets = new AllSkillSets( Context, PSXResources.SkillSetsBin,
                 PSXResources.SkillSetsBin );
             MonsterSkills = new AllMonsterSkills( PSXResources.MonsterSkillsBin );
             ActionMenus = new AllActionMenus( PSXResources.ActionEventsBin, Context );
             StatusAttributes = new AllStatusAttributes( PSXResources.StatusAttributesBin );
             InflictStatuses = new AllInflictStatuses( PSXResources.InflictStatusesBin );
             PoachProbabilities = new AllPoachProbabilities( PSXResources.PoachProbabilitiesBin );
             ENTDs = new AllENTDs( PSXResources.ENTD1, PSXResources.ENTD2, PSXResources.ENTD3, PSXResources.ENTD4 );
             MoveFind = new AllMoveFindItems( Context, PSXResources.MoveFind, new AllMoveFindItems( Context, PSXResources.MoveFind ) );
             StoreInventories = new AllStoreInventories( Context, PSXResources.StoreInventoriesBin, PSXResources.StoreInventoriesBin );
             break;
         default:
             throw new ArgumentException();
     }
 }
Ejemplo n.º 9
0
        public static void ConvertPsxPatchToPsp( string filename )
        {
            Dictionary<string, byte[]> fileList = new Dictionary<string, byte[]>();
            using( ZipFile zipFile = new ZipFile( filename ) )
            {
                foreach( ZipEntry entry in zipFile )
                {
                    byte[] bytes = new byte[entry.Size];
                    StreamUtils.ReadFully( zipFile.GetInputStream( entry ), bytes );
                    fileList[entry.Name] = bytes;
                }
            }

            File.Delete( filename );

            if( fileList["type"].ToUTF8String() == Context.US_PSX.ToString() )
            {
                List<byte> amBytes = new List<byte>( fileList["actionMenus"] );
                amBytes.AddRange( PSPResources.ActionEventsBin.Sub( 0xE0, 0xE2 ) );
                fileList["actionMenus"] = amBytes.ToArray();

                AllJobs aj = new AllJobs( Context.US_PSX, fileList["jobs"] );
                List<Job> jobs = new List<Job>( aj.Jobs );
                AllJobs defaultPspJobs = new AllJobs( Context.US_PSP, PSPResources.JobsBin );
                for( int i = 0; i < jobs.Count; i++ )
                {
                    jobs[i].Equipment.Unknown1 = defaultPspJobs.Jobs[i].Equipment.Unknown1;
                    jobs[i].Equipment.Unknown2 = defaultPspJobs.Jobs[i].Equipment.Unknown2;
                    jobs[i].Equipment.Unknown3 = defaultPspJobs.Jobs[i].Equipment.Unknown3;
                    jobs[i].Equipment.FellSword = defaultPspJobs.Jobs[i].Equipment.FellSword;
                    jobs[i].Equipment.LipRouge = defaultPspJobs.Jobs[i].Equipment.LipRouge;
                    jobs[i].Equipment.Unknown6 = defaultPspJobs.Jobs[i].Equipment.Unknown6;
                    jobs[i].Equipment.Unknown7 = defaultPspJobs.Jobs[i].Equipment.Unknown7;
                    jobs[i].Equipment.Unknown8 = defaultPspJobs.Jobs[i].Equipment.Unknown8;
                }
                for( int i = 160; i < 169; i++ )
                {
                    jobs.Add( defaultPspJobs.Jobs[i] );
                }
                ReflectionHelpers.SetFieldOrProperty( aj, "Jobs", jobs.ToArray() );
                fileList["jobs"] = aj.ToByteArray( Context.US_PSP );

                JobLevels jl = new JobLevels( Context.US_PSX, fileList["jobLevels"] );
                JobLevels pspJobLevels = new JobLevels( Context.US_PSP, PSPResources.JobLevelsBin );
                foreach( string jobName in new string[19] { "Archer", "Arithmetician", "Bard", "BlackMage", "Chemist", "Dancer", "Dragoon", "Geomancer",
                            "Knight", "Mime", "Monk", "Mystic", "Ninja", "Orator", "Samurai", "Summoner", "Thief", "TimeMage", "WhiteMage" } )
                {
                    Requirements psxR = ReflectionHelpers.GetFieldOrProperty<Requirements>( jl, jobName );
                    Requirements pspR = ReflectionHelpers.GetFieldOrProperty<Requirements>( pspJobLevels, jobName );
                    psxR.Unknown1 = pspR.Unknown1;
                    psxR.Unknown2 = pspR.Unknown2;
                    psxR.DarkKnight = pspR.DarkKnight;
                    psxR.OnionKnight = pspR.OnionKnight;
                }
                ReflectionHelpers.SetFieldOrProperty( jl, "OnionKnight", pspJobLevels.OnionKnight );
                ReflectionHelpers.SetFieldOrProperty( jl, "DarkKnight", pspJobLevels.DarkKnight );
                ReflectionHelpers.SetFieldOrProperty( jl, "Unknown", pspJobLevels.Unknown );
                fileList["jobLevels"] = jl.ToByteArray( Context.US_PSP );

                List<byte> ssBytes = new List<byte>( fileList["skillSets"] );
                ssBytes.AddRange( PSPResources.SkillSetsBin.Sub( ssBytes.Count ) );
                fileList["skillSets"] = ssBytes.ToArray();

                fileList["entd5"] = PSPResources.ENTD5;



                fileList["type"] = Encoding.UTF8.GetBytes( Context.US_PSP.ToString() );

                fileList["pspItemAttributes"] = PSPResources.NewItemAttributesBin;
                fileList["pspItems"] = PSPResources.NewItemsBin;
            }

            using( FileStream outFile = new FileStream( filename, FileMode.Create, FileAccess.ReadWrite ) )
            using( ZipOutputStream output = new ZipOutputStream( outFile ) )
            {
                foreach( KeyValuePair<string, byte[]> entry in fileList )
                {
                    WriteFileToZip( output, entry.Key, entry.Value );
                }
            }
        }