Fix type casting in ReplaceOutfit
This commit is contained in:
parent
5d679b3c7c
commit
27cf89c736
1 changed files with 9 additions and 7 deletions
|
|
@ -522,14 +522,16 @@ namespace SecondBotEvents.Services
|
||||||
AddLink(item);
|
AddLink(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detach all current non-body-part items first to avoid toggling
|
// Re-implementing ReplaceOutfit logic manually to ensure a clean swap without toggling.
|
||||||
var currentWorn = ContentLinks().Select(RealInventoryItem).Where(i => !IsBodyPart(i)).ToList();
|
var wearables = outfit.OfType<InventoryWearable>().ToList();
|
||||||
if (currentWorn.Count > 0)
|
var attachments = outfit.Where(item => item is InventoryAttachment || item is InventoryObject).ToList();
|
||||||
{
|
|
||||||
GetClient().Appearance.RemoveFromOutfit(currentWorn);
|
// 1. Replace wearables (this is usually safe and doesn't toggle)
|
||||||
}
|
GetClient().Appearance.ReplaceOutfit(wearables.Cast<InventoryItem>().ToList());
|
||||||
|
|
||||||
|
// 2. Replace attachments with FirstDetachAll=true and replace=true to prevent toggling
|
||||||
|
GetClient().Appearance.AddAttachments(attachments, true, true);
|
||||||
|
|
||||||
GetClient().Appearance.ReplaceOutfit(outfit, false);
|
|
||||||
ThreadPool.QueueUserWorkItem(sync =>
|
ThreadPool.QueueUserWorkItem(sync =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue