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