Add DungeonMapRandomizer
This commit is contained in:
@@ -10,4 +10,4 @@ ALttPRandomizer/[Bb]in
|
||||
*/DR_*
|
||||
*/ER_*
|
||||
*/OR_*
|
||||
BaseRandomizer/data/base2current.json
|
||||
*/data/base2current.json
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -7,3 +7,6 @@
|
||||
[submodule "Apr2025Randomizer"]
|
||||
path = Apr2025Randomizer
|
||||
url = https://github.com/ardnaxelarak/ALttPDoorRandomizer
|
||||
[submodule "DungeonMapRandomizer"]
|
||||
path = DungeonMapRandomizer
|
||||
url = git@github.com:ardnaxelarak/ALttPDoorRandomizer
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
public BookSettings Book { get; set; } = BookSettings.Normal;
|
||||
|
||||
[SettingName("door_shuffle")]
|
||||
[RequiredSetting([Apr2025], DoorShuffle.Vanilla)]
|
||||
[RequiredSetting([Apr2025, DungeonMap], DoorShuffle.Vanilla)]
|
||||
[NoSettingName([Apr2025])]
|
||||
public DoorShuffle DoorShuffle { get; set; } = DoorShuffle.Vanilla;
|
||||
|
||||
@@ -145,6 +145,14 @@
|
||||
[RequiredSetting([Apr2025], FollowerShuffle.Vanilla)]
|
||||
public FollowerShuffle FollowerShuffle { get; set; } = FollowerShuffle.Vanilla;
|
||||
|
||||
[SettingName("ow_fluteshuffle")]
|
||||
[NoSettingName([Apr2025])]
|
||||
public FluteShuffle FluteShuffle { get; set; } = FluteShuffle.Vanilla;
|
||||
|
||||
[NoSettingName]
|
||||
[RequiredSetting([Apr2025], TileSwap.Vanilla)]
|
||||
public TileSwap TileSwap { get; set; } = TileSwap.Vanilla;
|
||||
|
||||
[SettingName("damage_challenge")]
|
||||
[NoSettingName([Apr2025])]
|
||||
public DamageChallengeMode DamageChallenge { get; set; } = DamageChallengeMode.Normal;
|
||||
@@ -153,9 +161,11 @@
|
||||
public Hints Hints { get; set; } = Hints.Off;
|
||||
}
|
||||
|
||||
public enum RandomizerInstance {
|
||||
public enum RandomizerInstance
|
||||
{
|
||||
[RandomizerName(BaseRandomizer.Name)] Base,
|
||||
[RandomizerName(Apr2025Randomizer.Name)] Apr2025,
|
||||
[RandomizerName(BaseRandomizer.DungeonMapName)] DungeonMap,
|
||||
}
|
||||
|
||||
public enum RaceMode {
|
||||
@@ -359,11 +369,22 @@
|
||||
[SettingName("oneway")] RemoveAll,
|
||||
}
|
||||
|
||||
public enum FluteShuffle {
|
||||
Vanilla,
|
||||
Random,
|
||||
Balanced,
|
||||
}
|
||||
|
||||
public enum FollowerShuffle {
|
||||
Vanilla,
|
||||
[AdditionalSetting("--shuffle_followers")] Shuffled,
|
||||
}
|
||||
|
||||
public enum TileSwap {
|
||||
Vanilla,
|
||||
[AdditionalSetting("--ow_mixed")] TileSwap,
|
||||
}
|
||||
|
||||
public enum DamageChallengeMode {
|
||||
Normal,
|
||||
OHKO,
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
builder.Services.AddSingleton<CommonSettingsProcessor>();
|
||||
|
||||
builder.Services.AddKeyedScoped<IRandomizer, BaseRandomizer>(BaseRandomizer.Name);
|
||||
builder.Services.AddKeyedScoped<IRandomizer, BaseRandomizer>(BaseRandomizer.DungeonMapName);
|
||||
builder.Services.AddKeyedScoped<IRandomizer, Apr2025Randomizer>(Apr2025Randomizer.Name);
|
||||
builder.Services.AddScoped<BaseRandomizer>();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public class BaseRandomizer : IRandomizer {
|
||||
public const string Name = "base";
|
||||
public const RandomizerInstance Instance = RandomizerInstance.Base;
|
||||
public const string DungeonMapName = "dungeon_map";
|
||||
|
||||
public BaseRandomizer(
|
||||
AzureStorage azureStorage,
|
||||
@@ -39,7 +39,7 @@
|
||||
private ServiceOptions Configuration => OptionsMonitor.CurrentValue;
|
||||
|
||||
public void Validate(SeedSettings settings) {
|
||||
this.SettingsProcessor.ValidateSettings(Instance, settings);
|
||||
this.SettingsProcessor.ValidateSettings(settings.Randomizer, settings);
|
||||
}
|
||||
|
||||
public void ValidateAll(IList<SeedSettings> settings) {
|
||||
@@ -63,7 +63,7 @@
|
||||
settings.DoorTypeMode = DoorTypeMode.Original;
|
||||
}
|
||||
|
||||
foreach (var arg in SettingsProcessor.GetSettings(Instance, settings)) {
|
||||
foreach (var arg in SettingsProcessor.GetSettings(settings.Randomizer, settings)) {
|
||||
args.Add(arg);
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@
|
||||
return args;
|
||||
}
|
||||
|
||||
private async Task StartProcess(string id, IEnumerable<string> settings, Func<int, Task> completed) {
|
||||
private async Task StartProcess(string randomizerName, string id, IEnumerable<string> settings, Func<int, Task> completed) {
|
||||
var start = new ProcessStartInfo() {
|
||||
FileName = Configuration.PythonPath,
|
||||
WorkingDirectory = Configuration.RandomizerPaths[Name],
|
||||
WorkingDirectory = Configuration.RandomizerPaths[randomizerName],
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
};
|
||||
@@ -127,7 +127,7 @@
|
||||
public async Task Randomize(string id, SeedSettings settings) {
|
||||
Logger.LogDebug("Recieved request for id {id} to randomize settings {@settings}", id, settings);
|
||||
|
||||
await StartProcess(id, this.GetArgs(settings), async exitcode => {
|
||||
await StartProcess(this.SettingsProcessor.GetRandomizerName(settings.Randomizer), id, this.GetArgs(settings), async exitcode => {
|
||||
if (exitcode != 0) {
|
||||
await GenerationFailed(id, exitcode);
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@
|
||||
.Append(string.Format("--names={0}", string.Join(",", names)))
|
||||
.Append(string.Format("--multi={0}", settings.Count));
|
||||
|
||||
await StartProcess(id, args, async exitcode => {
|
||||
await StartProcess(Name, id, args, async exitcode => {
|
||||
if (exitcode != 0) {
|
||||
await GenerationFailed(id, exitcode);
|
||||
} else {
|
||||
|
||||
@@ -64,6 +64,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetRandomizerName(RandomizerInstance randomizer)
|
||||
{
|
||||
var fi = typeof(RandomizerInstance).GetField(randomizer.ToString(), BindingFlags.Static | BindingFlags.Public);
|
||||
|
||||
var randomizerKey = fi?.GetCustomAttribute<RandomizerNameAttribute>()?.Name;
|
||||
|
||||
if (randomizerKey == null) {
|
||||
throw new InvalidSettingsException("Invalid randomizer: {0}", randomizerKey);
|
||||
}
|
||||
|
||||
return randomizerKey;
|
||||
}
|
||||
}
|
||||
|
||||
public class SettingsLookupException : Exception {
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
},
|
||||
"randomizerPaths": {
|
||||
"base": "/randomizer",
|
||||
"apr2025": "/apr2025_randomizer"
|
||||
"apr2025": "/apr2025_randomizer",
|
||||
"dungeon_map": "/dungeon_map_randomizer"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
@@ -25,4 +26,4 @@
|
||||
],
|
||||
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Submodule BaseRandomizer updated: 37823134db...7bec1f899c
@@ -28,6 +28,10 @@ RUN mkdir -p /randomizer/data
|
||||
RUN touch /randomizer/data/base2current.json
|
||||
RUN chown $APP_UID:$APP_UID /randomizer/data/base2current.json
|
||||
|
||||
RUN mkdir -p /dungeon_map_randomizer/data
|
||||
RUN touch /dungeon_map_randomizer/data/base2current.json
|
||||
RUN chown $APP_UID:$APP_UID /dungeon_map_randomizer/data/base2current.json
|
||||
|
||||
USER $APP_UID
|
||||
|
||||
RUN python3 -m ensurepip --upgrade
|
||||
@@ -43,6 +47,10 @@ COPY BaseRandomizer/ .
|
||||
WORKDIR /apr2025_randomizer
|
||||
COPY Apr2025Randomizer/ .
|
||||
|
||||
WORKDIR /dungeon_map_randomizer
|
||||
|
||||
COPY DungeonMapRandomizer/ .
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
COPY ALttPRandomizer/appsettings.Docker.json appsettings.json
|
||||
|
||||
1
DungeonMapRandomizer
Submodule
1
DungeonMapRandomizer
Submodule
Submodule DungeonMapRandomizer added at 507f4170c8
Reference in New Issue
Block a user