Merge pull request #820 from nolt/feature-bots

(cherry picked from commit b10de0645a869485fbb5771a739abd06b5708c2d)
This commit is contained in:
sven-n
2026-07-16 22:01:57 +02:00
committed by Acentech Dev
parent 8baf329654
commit d04cbecae3
58 changed files with 14856 additions and 62 deletions

View File

@@ -29,8 +29,13 @@ public abstract class UnlockCharacterAtLevelBase : ICharacterLevelUpPlugIn
/// <inheritdoc />
public void CharacterLeveledUp(Player player)
{
// Server-side bots are excluded: they never create new characters, and animating several
// characters of one account concurrently (each with its own persistence context and thus its
// own stale copy of the account) lets two siblings pass the duplicate check below at the same
// time - both insert the same unlock row and the account's saves keep failing with a duplicate
// key of "PK_AccountCharacterClass" until the next restart.
if (player.Level >= this._minimumLevel
&& player.Account is { } account
&& player.Account is { IsBot: false } account
&& account.UnlockedCharacterClasses.All(c => c.Number != this._classNumber))
{
var unlockedClass = player.GameContext.Configuration.CharacterClasses.FirstOrDefault(c => c.Number == this._classNumber);