Skip to content

Commit

Permalink
load preset
Browse files Browse the repository at this point in the history
  • Loading branch information
Entroper committed Nov 10, 2018
1 parent fffd3f4 commit d793fee
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 22 deletions.
9 changes: 9 additions & 0 deletions FF1Blazorizer/FF1Blazorizer.csproj
Expand Up @@ -19,4 +19,13 @@
<ProjectReference Include="..\FF1Lib\FF1Lib.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="wwwroot\presets\default.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(OutDir)version.txt" DestinationFolder="$(OutDir)dist" />
</Target>

</Project>
8 changes: 7 additions & 1 deletion FF1Blazorizer/Pages/Randomize.cshtml
Expand Up @@ -3,6 +3,7 @@
@using System.IO
@using FF1Lib
@using RomUtilities
@inject HttpClient Http

<div>
<div><input type="file" id="fileInput" onchange="@OnFileChanged"/></div>
Expand Down Expand Up @@ -284,9 +285,14 @@
StateHasChanged();
}

protected override void OnInit()
protected override async Task OnInitAsync()
{
MyFlags.PropertyChanged += (sender, args) => StateHasChanged();

var defaultJson = await Http.GetStringAsync("presets/default.json");
Console.WriteLine(defaultJson);

MyFlags.Flags = Microsoft.JSInterop.Json.Deserialize<Flags.Preset>(defaultJson).Flags;
}

async Task OnFileChanged(UIChangeEventArgs e)
Expand Down
17 changes: 1 addition & 16 deletions FF1Blazorizer/Properties/launchSettings.json
@@ -1,20 +1,5 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:62669/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"FF1Blazorizer": {
"commandName": "Project",
"launchBrowser": true,
Expand All @@ -24,4 +9,4 @@
"applicationUrl": "http://localhost:62670/"
}
}
}
}
2 changes: 1 addition & 1 deletion FF1Blazorizer/Shared/CheckBox.cshtml
Expand Up @@ -3,7 +3,7 @@
{
<span class="indent"></span>
}
<input type="checkbox" id="@Id" value="@Value" onchange="@onchange" disabled="@(!IsEnabled)"/> <label for="@Id" class="@DisabledClass">@ChildContent</label>
<input type="checkbox" id="@Id" checked="@Value" onchange="@onchange" disabled="@(!IsEnabled)"/> <label for="@Id" class="@DisabledClass">@ChildContent</label>
</div>

@functions
Expand Down
135 changes: 135 additions & 0 deletions FF1Blazorizer/wwwroot/presets/default.json
@@ -0,0 +1,135 @@
{
"Name": "Default",

"Flags": {

"Shops": true,
"Treasures": true,
"NPCItems": true,
"NPCFetchItems": false,
"RandomWares": false,
"RandomWaresIncludesSpecialGear": false,
"RandomLoot": false,
"WeaponPermissions": false,
"ArmorPermissions": false,

"ShardHunt": false,
"ExtraShards": false,
"TransformFinalFormation": false,
"ChaosRush": false,
"ShortToFR": false,
"PreserveFiendRefights": false,

"MagicShops": false,
"MagicLevels": true,
"MagicPermissions": false,
"ItemMagic": false,

"Rng": true,
"FormationShuffleMode": 0,
"EnemyFormationsUnrunnable": false,
"EnemyFormationsSurprise": false,
"EnemyTrapTiles": false,
"RandomTrapFormations": false,

"EnemyScripts": false,
"EnemySkillsSpells": true,
"EnemyStatusAttacks": true,
"AllowUnsafePirates": false,

"WarMECHMode": 1,
"OrdealsPillars": true,
"SkyCastle4FTeleporters": false,
"TitansTrove": true,
"ConfusedOldMen": true,
"AllowUnsafeMelmond": false,

"MapOpenProgression": false,
"MapOpenProgressionExtended": false,
"Entrances": false,
"Floors": false,
"AllowDeepCastles": false,
"Towns": false,

"IncentivizeFreeNPCs": true,
"IncentivizeFetchNPCs": false,
"IncentivizeTail": true,
"IncentivizeFetchItems": true,

"IncentivizeMarsh": true,
"IncentivizeEarth": true,
"IncentivizeVolcano": false,
"IncentivizeIceCave": true,
"IncentivizeOrdeals": true,
"IncentivizeSeaShrine": false,

"IncentivizeConeria": true,
"IncentivizeMarshKeyLocked": false,
"IncentivizeSkyPalace": false,

"IncentivizeMasamune": true,
"IncentivizeOpal": true,
"IncentivizeRibbon": true,
"IncentivizeRibbon2": false,
"Incentivize65K": false,
"IncentivizeBad": false,

"IncentivizeDefCastArmor": false,
"IncentivizeOffCastArmor": false,
"IncentivizeOtherCastArmor": false,
"IncentivizeDefCastWeapon": false,
"IncentivizeOffCastWeapon": false,
"IncentivizeOtherCastWeapon": false,

"EarlySarda": true,
"EarlySage": true,
"CrownlessOrdeals": true,
"OnlyRequireGameIsBeatable": false,

"FreeBridge": false,
"FreeAirship": false,
"FreeOrbs": false,
"StartingGold": false,
"WrapStatOverflow": false,
"WrapPriceOverflow": false,
"IncludeMorale": false,
"EasyMode": false,
"NoDanMode": false,

"SpeedHacks": true,
"NoPartyShuffle": true,
"Dash": true,
"BuyTen": true,
"EnableCritNumberDisplay": true,

"IdentifyTreasures": true,
"WaitWhenUnrunnable": true,

"HouseMPRestoration": true,
"WeaponStats": true,
"ChanceToRun": true,
"SpellBugs": true,
"BlackBeltAbsorb": true,

"EnemyStatusAttackBug": true,
"EnemySpellsTargetingAllies": true,
"EnemyElementalResistancesBug": true,
"ImproveTurnOrderRandomization": true,

"ClampMinimumStatScale": false,
"ClampMinimumBossStatScale": false,
"ClampMinimumPriceScale": false,
"EnemyScaleFactor": 1.5,
"BossScaleFactor": 1.5,
"PriceScaleFactor": 3.0,
"ExpMultiplier": 2.5,
"ExpBonus": 250,
"ProgressiveScaleMode": 0,
"EncounterRate": 30.0,
"DungeonEncounterRate": 30.0,
"ForcedPartyMembers": 0,
"WorldWealth": 1

}

}
9 changes: 6 additions & 3 deletions FF1Lib/FF1Lib.csproj
Expand Up @@ -31,9 +31,6 @@
</ItemGroup>

<ItemGroup>
<Content Include="DTETable.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="presets\debug.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -65,4 +62,10 @@
<PackageReference Include="RomUtilities" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<None Update="DTETable.txt">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion FF1Lib/Flags.cs
Expand Up @@ -491,7 +491,7 @@ public static Flags DecodeFlagsText(string text)
return result;
}

private class Preset
public class Preset
{
public string Name { get; set; }
public Flags Flags { get; set; }
Expand Down

0 comments on commit d793fee

Please sign in to comment.