Merge pull request #841 from nolt/bot-behaviour

Make the server-side bots hold up as a population

(cherry picked from commit 88535b63a958fee9803d5fc3a4bdac5a3318d221)
This commit is contained in:
sven-n
2026-07-22 21:56:51 +02:00
committed by Acentech Dev
parent eb4c05eda2
commit e910845383
21 changed files with 1691 additions and 287 deletions

View File

@@ -31,6 +31,15 @@ public class BotConfiguration
[Display(Name = "Reset bots", Description = "Deletes all bot accounts and characters on the next start, then regenerates them. Clears itself afterwards.")]
public bool ResetBots { get; set; }
/// <summary>
/// Gets or sets a value indicating whether all bot accounts and characters should be deleted
/// WITHOUT being regenerated. Unlike <see cref="ResetBots"/> this also turns <see cref="Enabled"/>
/// off - otherwise the very same pass would generate the population again - so it is the single
/// switch for "I do not want bots on this server anymore". Clears itself afterwards.
/// </summary>
[Display(Name = "Purge bots", Description = "Deletes all bot accounts and characters and turns the bot feature off, without generating new ones. Clears itself afterwards.")]
public bool PurgeBots { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the bot population rotates its presence over the day:
/// fewer bots are online at night, most in the evening, with bots smoothly logging in and out -
@@ -83,6 +92,26 @@ public class BotConfiguration
[Display(Name = "Bots pay reset costs", Description = "If enabled, bots consume the configured zen/item costs for their resets like human players (default: free bot resets).")]
public bool BotsPayResetCosts { get; set; }
/// <summary>
/// Gets or sets how many Jewels of Bless, Soul and Life a bot keeps of each kind. Bots only pick up
/// the jewels they can actually spend on their own gear (see <c>BotJewelHandler</c>) and stop
/// collecting a kind once they hold this many; whatever they carry above it is sold on the next
/// merchant visit. The sensible value depends entirely on the server's drop rates - on a high rate
/// server a bot refills a big stock within hours, so a low limit keeps its backpack usable.
/// </summary>
[Display(Name = "Jewel stock per kind", Description = "How many Jewels of Bless/Soul/Life a bot keeps of each kind; above this it stops picking them up and sells the surplus.")]
[Range(0, 100)]
public int JewelStockPerKind { get; set; } = 10;
/// <summary>
/// Gets or sets the number of potion charges (per healing and per mana potions) a bot stocks up to
/// at a merchant. Merchants sell potions in stacks of different sizes, so this is the target the bot
/// buys towards, not a stack count.
/// </summary>
[Display(Name = "Potion stock (charges)", Description = "How many healing and mana potion charges a bot buys up to at a merchant.")]
[Range(10, 255)]
public int PotionStockCharges { get; set; } = 60;
/// <summary>
/// Gets or sets a comma separated list of login names of existing accounts to animate as bots.
/// This is an optional extra hook alongside the generated population (see
@@ -109,6 +138,22 @@ public class BotConfiguration
public int GetEffectiveBotCapacityPercent()
=> Math.Clamp(this.BotCapacityPercent, 1, 100);
/// <summary>
/// Gets the effective, clamped jewel stock a bot keeps of each usable kind.
/// </summary>
/// <returns>A value between 0 and 100.</returns>
/// <remarks>Deliberately a method, like <see cref="GetEffectiveCharactersPerAccount"/>.</remarks>
public int GetEffectiveJewelStockPerKind()
=> Math.Clamp(this.JewelStockPerKind, 0, 100);
/// <summary>
/// Gets the effective, clamped potion charges a bot stocks up to.
/// </summary>
/// <returns>A value between 10 and 255.</returns>
/// <remarks>Deliberately a method, like <see cref="GetEffectiveCharactersPerAccount"/>.</remarks>
public int GetEffectivePotionStockCharges()
=> Math.Clamp(this.PotionStockCharges, 10, 255);
/// <summary>
/// Parses <see cref="ProofOfConceptAccounts"/> into the distinct, trimmed login names.
/// </summary>