Yanfly's Item Synth.- Ingredients Window Display

Djajapena

Villager
Member
Joined
Oct 28, 2017
Messages
17
Reaction score
5
First Language
Indonesia
Primarily Uses
RMMV
I need help about Yanfly's Item Synthesis plugin.

In this plugin's window, the ingredients window only show up to the 5th ingredient. The 6th ingredient onwards didn't show correctly.
My game is in default 816*624 Px resolution. It's intended to be played on windowed mode side-by-side with study material.

In the game, each synthesized item need 4 to the maximum of 9 ingredient materials. I want the Ingredients Window to show the ingredients in 3*3 grids, displaying only the ingredient items icon and amount like this:

It's obviously photoshoped

I'm not well versed with JS and only use the plugins in plug-and-play way with minimum edits.
Thank you in advance for the help.
 

Johnboy

Veteran
Veteran
Joined
Jan 13, 2016
Messages
344
Reaction score
124
First Language
English
Primarily Uses
You could give SRD's super tools plugin a shot. It allows you to modify window sizes and lines.
 

Djajapena

Villager
Member
Joined
Oct 28, 2017
Messages
17
Reaction score
5
First Language
Indonesia
Primarily Uses
RMMV
Johnboy Unfortunately SRD's Super Tools Plugin can only modify the Opacity, Widht, and Height of the Ingredients Window.
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
240
Reaction score
212
First Language
English
Primarily Uses
RMMV
@Djajapena Do you still need help with this or did you solve it? I can take a look if you still need help.
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
240
Reaction score
212
First Language
English
Primarily Uses
RMMV
Here's the plugin and some screenshots. Just copy-and-paste the plugin code into a new file, save it (I use the name SPX_ItemSynthesisMod.js but anything is fine) and place the plugin somewhere below YEP_ItemSynthesis.js.

synthesis1.png
synthesis2.png

Code:
// 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);
};
 

Djajapena

Villager
Member
Joined
Oct 28, 2017
Messages
17
Reaction score
5
First Language
Indonesia
Primarily Uses
RMMV
@SeaPhoenix This work perfectly! Thank you. What are the terms of use and credit?
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
240
Reaction score
212
First Language
English
Primarily Uses
RMMV
Feel free to use for commercial or non-commercial, no credit necessary (except to Yanfly, but I assume that's already going to happen :smile:) since it's a minor change.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Stream will be live shortly with a session of the interactive text adenture! Feel free to drop by!
I worked a lot more today and I am thinking about Youtube videos to make to my channel, but I am still looking for some content :D

But I am happy to be back at work :D

Forum statistics

Threads
104,363
Messages
1,005,858
Members
135,884
Latest member
Budiyasa
Top