// Modifications to YEP_ItemSynthesis.js by SeaPhoenix
// Place in plug-in list anywhere BELOW YEP_ItemSynthesis.js
// Can change the number 20 in the two functions below to a bigger number (e.g., 24) for more white space between ingredient columns,
// or to a smaller number (e.g., 16) for less white space between ingredient columns
// (may be needed if you have a synthesis cost of more than 9,999 money units so that the text doesn't get shrunk)
Window_SynthesisIngredients.prototype.ingredientSpacing = function() {
return this.textPadding() * 20;
};
Window_SynthesisNumber.prototype.ingredientSpacing = function() {
return this.textPadding() * 20;
};
////////////////////////////////////////////////////////////////////////
// Window_SynthesisIngredients
Window_SynthesisIngredients.prototype.drawItemIngredients = function(item, wy) {
var ww = this.contents.width;
this.changeTextColor(this.systemColor());
this.drawText(Yanfly.Param.ISIngredientsList, 0, 0, ww, 'center');
this.changeTextColor(this.normalColor());
var cell = 0;
for (var i = 0; i < item.synthIngredients.length; ++i) {
cell = this.drawItemDetails(i, cell, wy);
if (cell > 0 && cell % 3 === 0) wy += this.lineHeight()
if (wy + this.lineheight > this.contents.height) break;
}
this.drawItemSynthCost(item, cell, wy);
};
Window_SynthesisIngredients.prototype.drawItemDetails = function(index, cell, wy) {
var ingredient = DataManager.getSynthesisIngredient(this._item, index);
var quantity = DataManager.getSynthesisQuantity(this._item, index);
var ww = (this.contents.width - this.ingredientSpacing()) / 3;
var wx = (ww + (this.ingredientSpacing() / 2)) * (cell % 3);
if (!ingredient) return cell;
this.resetFontSettings();
this.drawIcon(ingredient.iconIndex, wx + 2, wy + 2);
if (Yanfly.Param.ISAmountFmt) {
this.drawItemQuantity(index, wx, wy, ww);
} else {
this.drawItemQuantity2(index, wx, wy, ww);
}
return cell + 1;
};
Window_SynthesisIngredients.prototype.drawItemQuantity = function(index, wx, wy, ww) {
var ingredient = DataManager.getSynthesisIngredient(this._item, index);
var quantity = DataManager.getSynthesisQuantity(this._item, index);
this.contents.fontSize = Yanfly.Param.ISQuantitySize;
this.changeTextColor(this.normalColor());
var num = '/' + Yanfly.Util.toGroup($gameParty.numItems(ingredient));
this.drawText(num, wx, wy, ww, 'right');
ww -= this.textWidth(num);
if ($gameParty.numItems(ingredient) >= quantity) {
this.changeTextColor(this.powerUpColor());
} else {
this.changeTextColor(this.powerDownColor());
}
var text = String(Yanfly.Util.toGroup(quantity));
this.drawText(text, wx, wy, ww, 'right');
}
Window_SynthesisIngredients.prototype.drawItemQuantity2 = function(index, wx, wy, ww) {
var ingredient = DataManager.getSynthesisIngredient(this._item, index);
var quantity = DataManager.getSynthesisQuantity(this._item, index);
var owned = $gameParty.numItems(ingredient);
this.contents.fontSize = Yanfly.Param.ISQuantitySize;
this.changeTextColor(this.normalColor());
var num = '/' + Yanfly.Util.toGroup(quantity);
this.drawText(num, wx, wy, ww, 'right');
ww -= this.textWidth(num);
if ($gameParty.numItems(ingredient) >= quantity) {
this.changeTextColor(this.powerUpColor());
} else {
this.changeTextColor(this.powerDownColor());
}
var text = String(Yanfly.Util.toGroup(owned));
this.drawText(text, wx, wy, ww, 'right');
}
Window_SynthesisIngredients.prototype.drawItemSynthCost = function(item, cell, wy) {
if (item.synthCost <= 0) return;
this.resetFontSettings();
var value = item.synthCost;
var ww = (this.contents.width - this.ingredientSpacing()) / 3;
var wx = (ww + (this.ingredientSpacing() / 2)) * (cell % 3);
this.drawCurrencyValue(value, TextManager.currencyUnit, wx, wy, ww)
};
// Window_SynthesisNumber
Window_SynthesisNumber.prototype.drawIngredients = function() {
var wy = this.lineHeight();
var cell = 0;
for (var i = 0; i < this._item.synthIngredients.length; ++i) {
cell = this.drawItemDetails(i, cell, wy);
if (cell > 0 && cell % 3 === 0) wy += this.lineHeight()
if (wy + this.lineHeight() > this.contents.height) break;
}
this.drawItemSynthCost(this._item, cell, wy);
};
Window_SynthesisNumber.prototype.drawItemDetails = function(index, cell, wy) {
var ingredient = DataManager.getSynthesisIngredient(this._item, index);
var quantity = DataManager.getSynthesisQuantity(this._item, index);
var ww = (this.contents.width - this.ingredientSpacing()) / 3;
var wx = (ww + (this.ingredientSpacing() / 2)) * (cell % 3);
if (!ingredient) return wy;
this.resetFontSettings();
this.drawIcon(ingredient.iconIndex, wx + 2, wy + 2);
this.drawItemQuantity(index, wx, wy, ww);
return cell + 1;
};
Window_SynthesisNumber.prototype.drawItemQuantity = function(index, wx, wy, ww) {
var ingredient = DataManager.getSynthesisIngredient(this._item, index);
var quantity = DataManager.getSynthesisQuantity(this._item, index);
quantity *= this.number();
this.contents.fontSize = Yanfly.Param.ISQuantitySize;
this.changeTextColor(this.normalColor());
var num = '/' + Yanfly.Util.toGroup($gameParty.numItems(ingredient));
this.drawText(num, wx, wy, ww, 'right');
ww -= this.textWidth(num);
if ($gameParty.numItems(ingredient) >= quantity) {
this.changeTextColor(this.powerUpColor());
} else {
this.changeTextColor(this.powerDownColor());
}
var text = String(Yanfly.Util.toGroup(quantity));
this.drawText(text, wx, wy, ww, 'right');
}
Window_SynthesisNumber.prototype.drawItemSynthCost = function(item, cell, wy) {
if (item.synthCost <= 0) return;
this.resetFontSettings();
var value = item.synthCost * this.number();
var ww = (this.contents.width - this.ingredientSpacing()) / 3;
var wx = (ww + (this.ingredientSpacing() / 2)) * (cell % 3);
this.drawCurrencyValue(value, TextManager.currencyUnit, wx, wy, ww)
};
Window_SynthesisNumber.prototype.buttonY = function() {
return Math.round(this.priceY() + this.lineHeight() * 2);
};