private static KeyValuePair <CustomOption, Type> CreateNumberRoleOption <TRole>(string name, float value, float min, float max, float increment) where TRole : RoleGeneric <TRole>, new() { return(new KeyValuePair <CustomOption, Type>( CustomOption.AddNumber(Role.GetName <TRole>() + ": " + name, value, min, max, increment), typeof(TRole))); }
private static KeyValuePair <Type, CustomNumberOption> CreateRoleSpawnChanceOption(Role role, float value = 100F, float min = 0F, float max = 100F, float increment = 5F) { CustomNumberOption customNumberOption = CustomOption.AddNumber( $"({role.Faction.Name} {role.Alignment.Name}) {role.Name}", value, min, max, increment); return(new KeyValuePair <Type, CustomNumberOption>(role.GetType(), customNumberOption)); }
// public static string GetActionName<T>() // where T : RoleGeneric<T>, new() // { // return ActionNames.TryGetValue(typeof(T), out string actionName) ? actionName : ""; // } private static KeyValuePair <TypePair, CustomNumberOption> CreateRoleDurationOption <TRole, TAbility>( float value = 15F, float min = 5F, float max = 30F, float increment = 2.5F) where TRole : RoleGeneric <TRole>, new() where TAbility : Ability { return(new KeyValuePair <TypePair, CustomNumberOption>( new TypePair(typeof(TRole), typeof(TAbility)), CustomOption.AddNumber($"{Role.GetName<TRole>()} {typeof(TAbility).Name} Duration", value, min, max, increment))); }
/* * public static float GetRoleSpawnChance<T>() * where T : RoleGeneric<T>, new() * { * return RoleSpawnChances.TryGetValue(typeof(T), out CustomNumberOption value) ? value.GetValue() : 0F; * } */ private static KeyValuePair <TypePair, CustomNumberOption> CreateRoleCooldownOption <TRole, TAbility>( float value = 30F, float min = 10F, float max = 60F, float increment = 2.5F) where TRole : RoleGeneric <TRole>, new() where TAbility : Ability { // ActionNames.Add(typeof(T), actionName); return(new KeyValuePair <TypePair, CustomNumberOption>( new TypePair(typeof(TRole), typeof(TAbility)), CustomOption.AddNumber($"{Role.GetName<TRole>()} {typeof(TAbility).Name} Cooldown", value, min, max, increment))); }
private static KeyValuePair <Type, CustomNumberOption> CreateRoleSpawnChanceOption <T>(float value = 50F, float min = 0F, float max = 100F, float increment = 5F) where T : RoleGeneric <T>, new() { Type type = typeof(T); string name = Role.GetName <T>(); string faction = Role.GetFaction <T>().ShortHandle; string alignment = Role.GetAlignment <T>().ShortHandle; CustomNumberOption customNumberOption = CustomOption.AddNumber($"({faction}{alignment}) {name}", value, min, max, increment); return(new KeyValuePair <Type, CustomNumberOption>(type, customNumberOption)); }
public void CreateOptions() { CustomOption.AddHeader(Properties.Resources.HunterOptions); HunterSpawnChance = CustomOption.AddNumber("hunter-spawn-chance", Properties.Resources.SpawnChance, saveValue: true, 100, 0, 100, 10); HunterKillCooldown = CustomOption.AddNumber("hunter-kill-cooldown", Properties.Resources.HunterKillCooldown, saveValue: true, 30, 10, 60, 2.5f); CustomOption.AddHeader(Properties.Resources.EngineerOptions); EngineerSpawnChance = CustomOption.AddNumber("engineer-spawn-chance", Properties.Resources.SpawnChance, saveValue: true, 80, 0, 100, 10); CustomOption.AddHeader(Properties.Resources.ShapeShifterOptions); ShapeShifterSpawnChance = CustomOption.AddNumber("shape-shifter-spawn-chance", Properties.Resources.SpawnChance, saveValue: true, 80, 0, 100, 10); ShapeShifterSampleCooldown = CustomOption.AddNumber("shape-shifter-sample-cooldown", Properties.Resources.ShapeShifterSampleCooldown, saveValue: true, 0, 0, 30, 2.5f); ShapeShifterMorphCooldown = CustomOption.AddNumber("shape-shifter-morph-cooldown", Properties.Resources.ShapeShifterMorphCooldown, saveValue: true, 20, 0, 30, 2.5f); ShapeShifterMorphDuration = CustomOption.AddNumber("shape-shifter-morph-duration", Properties.Resources.ShapeShifterMorphDuration, saveValue: true, 10, 0, 30, 2.5f); CustomOption.AddHeader(Properties.Resources.JesterOptions); JesterSpawnChance = CustomOption.AddNumber("jester-spawn-chance", Properties.Resources.SpawnChance, saveValue: true, 80, 0, 100, 10); CustomOption.AddHeader(Properties.Resources.DetectiveOptions); DetectiveSpawnChance = CustomOption.AddNumber("detective-spawn-chance", Properties.Resources.SpawnChance, saveValue: true, 80, 0, 100, 10); DetectiveShieldedPlayerSeesShield = CustomOption.AddToggle("detective-shielded-player-sees-shield", Properties.Resources.ShieldedPlayerSeesShield, saveValue: true, true); //DetectiveDeathReportThreshold = CustomOption.AddNumber("detective-death-report-threshold", Properties.Resources.DetectiveDeathReportThreshold, saveValue: true, 20, 0, 30, 2.5f); }
protected CustomNumberOption MakeNumber(string Name, float Value, float Min, float Max, float Increment) { return(CustomOption.AddNumber(MakeOptionId(Name), Value, Min, Max, Increment)); }
public static CooldownController FromOption(string Prefix, string OptionName = "cooldown", float Value = 30f, float Min = 5f, float Max = 60f, float Increment = 2.5f) { return(new CooldownController(CustomOption.AddNumber( $"{Prefix}.{OptionName}", Value, Min, Max, Increment))); }