Checking or force-removing Attached Augment (Yanfly)

This is about @Yanfly Attached Augment plugin.


I have a system where players can trade-in certain pieces of equipment for other pieces, but if the piece traded in has augments attached, those augments are also gone forever. Ideally I would want the game to automatically detach all the Augments and place them back into the inventory, but if that doesn't work, to at least setup a conditional check where the game will tell the player to remove all augments on the piece they want to trade in if the game detects any augment attached to the piece in question.


So I'm wondering how to go about either of these two methods with scripts.
 


1. To check if a certain Augment is being equipped and return a value that I can use for conditional processing.


2. To force detach all the Augments that the player has put onto their equipment. 


Thanks for the help!
I dug through the augments code and found this:


ItemManager.removeAllAugments = function(item) {
var augments = [];
this.checkAugmentSlots(item);
var length = item.augmentSlotItems.length;
for (var i = 0; i < length; ++i) {
var augment = this.removeAugmentFromSlot(item, i);
augments.push(augment);
}
return augments;
};




This is the key, I wager, I just don't quite know how with my expertise. Ostensibly, you'd script your shop events to call this function when an item is sold, but unfortunately you'd have to ask someone else how to do that. I'm such a JavaScript newbie. :|

(If you already knew this then I'm afraid I have no answers at all, haha. I wish I knew how to alter shop event script, but alas...)

Edit: Whoops, I misread a bit. If it's not a matter of SELLING the item, it might be a bit more doable. Perhaps working the above function into the trade-in code somewhere might work. But even that's a long shot, as I'm rather JavaScript illiterate.
Hi there!
Did either of you end up figuring out an answer for this?
I'm having a similar problem where I have a trading system (not selling) and need to force-remove augments through a script call or something so they aren't permanently lost during the trade.
I wish Yanfly added a plugin command for this, it seems like something many people would like to use honestly...

Original thread: https://forums.rpgmakerweb.com/threads/checking-or-force-removing-attached-augment-yanfly.72996/