Skip to content

Commit

Permalink
Fix morph command (#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
LtRipley36706 authored Dec 9, 2024
1 parent edcc7cd commit 989b8c6
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Source/ACE.Server/Command/Handlers/AdminCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3541,12 +3541,25 @@ public static void HandleMorph(Session session, params string[] parameters)
foreach (var possession in possessions)
possessedBiotas.Add((possession.Biota, possession.BiotaDatabaseLock));

DatabaseManager.Shard.AddCharacterInParallel(player.Biota, player.BiotaDatabaseLock, possessedBiotas, player.Character, player.CharacterDatabaseLock, null);
// We must await here --
DatabaseManager.Shard.AddCharacterInParallel(player.Biota, player.BiotaDatabaseLock, possessedBiotas, player.Character, player.CharacterDatabaseLock, saveSuccess =>
{
if (!saveSuccess)
{
CommandHandlerHelper.WriteOutputInfo(session, $"Failed to create a morph based on {weenie.ClassName} to a new character \"{player.Name}\" for the account \"{player.Account.AccountName}\"!", ChatMessageType.Broadcast);
return;
}

PlayerManager.AddOfflinePlayer(player);
session.Characters.Add(player.Character);
PlayerManager.AddOfflinePlayer(player);

session.LogOffPlayer();
session.Characters.Add(player.Character);

var msg = $"Successfully created a morph based on {weenie.ClassName} to a new character \"{player.Name}\" for the account \"{player.Account.AccountName}\".";
CommandHandlerHelper.WriteOutputInfo(session, msg, ChatMessageType.Broadcast);
PlayerManager.BroadcastToAuditChannel(session.Player, msg);

session.LogOffPlayer();
});
});
}

Expand Down

0 comments on commit 989b8c6

Please sign in to comment.