MV [YEP_X_SkillCostItems]Only display item cost if more than 0?

I have a skill, but I want it to change what item is required based on the weapon class that the user is wielding. The issue is that it always displays all possible items it can cost, even if that cost is displayed as 0. Is there a way to make it only disply the relevant item cost?

<Custom Item 61 Cost>
if (user.isWtypeEquipped(1)) {
cost = 1;
}
</Custom Item 61 Cost>

<Custom Item 62 Cost>
if (user.isWtypeEquipped(2)) {
cost = 1;
}
</Custom Item 62 Cost>

1735612342076.png
try saving this as a .js file and loading it as a plugin after the item cost plugin
Spoiler
Code:
Window_SkillList.prototype.drawSkillItemCost = function(skill, wx, wy, dw) {
  if (Yanfly.Param.SCICostStyle === 0) return dw;
  var array = this._actor.skillItemCost(skill);
  var max = array.length;
  if (max <= 0) return dw;
  this.contents.fontSize = Yanfly.Param.SCIFontSize;
  dw -= 2;
  for (var i = 0; i < max; ++i) {
    var arr = array[max - i - 1];
    var item = arr[0];
    var cost = arr[1];
    if (arr[i]>0)
      dw = this.drawSoloItemCost(item, cost, wx, wy, dw);
    else
      dw+=2
  }
  var returnWidth = dw - Yanfly.Param.SCCCostPadding;
  this.resetFontSettings();
  return returnWidth;
};
Window_SkillList.prototype.drawSkillItemCost = function(skill, wx, wy, dw) { if (Yanfly.Param.SCICostStyle === 0) return dw; var array = this._actor.skillItemCost(skill); console.log(array) var max = array.length; if (max <= 0) return dw; this.contents.fontSize = Yanfly.Param.SCIFontSize; dw -= 2; for (var i = 0; i < max; ++i) { var arr = array[max - i - 1]; var item = arr[0]; var cost = arr[1]; if (arr>0) dw = this.drawSoloItemCost(item, cost, wx, wy, dw); else dw+=2 } var returnWidth = dw - Yanfly.Param.SCCCostPadding; this.resetFontSettings(); return returnWidth; };
1735617620461.png
It works! Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/yep_x_skillcostitems-only-display-item-cost-if-more-than-0.174314/