Add player slot to settings object
This commit is contained in:
@@ -7,9 +7,12 @@
|
||||
[NoSettingName]
|
||||
public RandomizerInstance Randomizer { get; set; } = RandomizerInstance.Base;
|
||||
|
||||
[NoSettingName]
|
||||
[IgnoreSetting]
|
||||
public string PlayerName { get; set; } = string.Empty;
|
||||
|
||||
[IgnoreSetting]
|
||||
public int PlayerSlot { get; set; } = 1;
|
||||
|
||||
[NoSettingName]
|
||||
public RaceMode Race { get; set; } = RaceMode.Normal;
|
||||
|
||||
|
||||
@@ -149,6 +149,10 @@
|
||||
public async Task RandomizeMultiworld(string id, IList<SeedSettings> settings, bool uploadSettings = true) {
|
||||
var generatorSettings = this.SettingsProcessor.GetGeneratorSettings(settings[0].Randomizer);
|
||||
|
||||
for (var i = 0; i < settings.Count; i++) {
|
||||
settings[i].PlayerSlot = i + 1;
|
||||
}
|
||||
|
||||
Logger.LogDebug("Recieved request for id {id} to randomize multiworld settings {@settings}", id, settings);
|
||||
|
||||
var names = settings.Select(s => s.PlayerName.Replace(' ', '_')).ToList();
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
}
|
||||
|
||||
internal class IgnoreSettingAttribute : RandomizerSpecificAttribute {
|
||||
public IgnoreSettingAttribute() : base(null) { }
|
||||
public IgnoreSettingAttribute(params RandomizerInstance[] randomizers) : base(randomizers) { }
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
var props = typeof(SeedSettings).GetProperties(BindingFlags.Instance | BindingFlags.Public);
|
||||
var starting = new List<string>();
|
||||
foreach (var prop in props) {
|
||||
if (prop.Name == nameof(SeedSettings.PlayerName)) {
|
||||
if (prop.GetCustomAttributes<IgnoreSettingAttribute>().Any(att => att.HasRandomizer(randomizer))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
var fi = prop.PropertyType.GetField(valueFieldName, BindingFlags.Static | BindingFlags.Public)
|
||||
?? throw new SettingsLookupException("Could not get field info for value {0}.{1}", prop.PropertyType, valueFieldName);
|
||||
|
||||
if (prop.GetCustomAttributes<IgnoreSettingAttribute>().Any(att => att.HasRandomizer(randomizer))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!prop.GetCustomAttributes<NoSettingNameAttribute>().Any(att => att.HasRandomizer(randomizer))) {
|
||||
var settingName =
|
||||
prop.GetCustomAttributes<SettingNameAttribute>()
|
||||
|
||||
Reference in New Issue
Block a user