Use high-level clean swap for ReplaceOutfit
This commit is contained in:
parent
27cf89c736
commit
681d6b915b
1 changed files with 6 additions and 15 deletions
|
|
@ -522,21 +522,12 @@ namespace SecondBotEvents.Services
|
||||||
AddLink(item);
|
AddLink(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-implementing ReplaceOutfit logic manually to ensure a clean swap without toggling.
|
// Clean swap: Remove everything current, then add everything new.
|
||||||
var wearables = outfit.OfType<InventoryWearable>().ToList();
|
// This ensures proper link folder sync and avoids toggling.
|
||||||
var attachments = outfit.Where(item => item is InventoryAttachment || item is InventoryObject).ToList();
|
var current = ContentLinks().Select(RealInventoryItem).ToList();
|
||||||
|
RemoveFromOutfit(current);
|
||||||
// 1. Replace wearables (this is usually safe and doesn't toggle)
|
|
||||||
GetClient().Appearance.ReplaceOutfit(wearables.Cast<InventoryItem>().ToList());
|
AddToOutfit(outfit, false);
|
||||||
|
|
||||||
// 2. Replace attachments with FirstDetachAll=true and replace=true to prevent toggling
|
|
||||||
GetClient().Appearance.AddAttachments(attachments, true, true);
|
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(sync =>
|
|
||||||
{
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
GetClient().Appearance.RequestSetAppearance(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue