Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Crafting System Edit
- // by Unconnected42
- // edit by Adiktuzmiko
- // UNCO_Craft_Edit.js
- // Last Updated : 2020/01/19
- // Make sure this is inserted into your plugin list as the last file or at
- // least below the original
- //=============================================================================
- /*:
- * @plugindesc Edits to the display of UNCO Crafting.
- * <Unco Craft Edit>
- * @author Edited by Adiktuzmiko
- *
- * @param ProdAmount DX
- * @desc Adjust this value to set the distance between the product name and the amount text
- * @default 128
- *
- * @param Column Width
- * @desc Adjust this value to adjust the width of each column
- * @default 128
- *
- * @param Ingredient Columns
- * @desc Adjust this value to adjust how many columns will be used. Make sure the columns will fit the window width
- * @default 2
- *
- * @param Ingredient Per Column
- * @desc This is for code calculation purposes, if you're using the same window height as in your screenshot leave it at 3
- * @default 3
- *
- */
- Unco_edit.Parameters = $plugins.filter(function(p) {
- return p.description.contains('<Unco Craft Edit>');
- })[0].parameters; //Copied from Ellye, who thanks Iavra
- Unco_edit.Param = Unco_edit.Param || {};
- Unco_edit.Param.prodAmountDX = parseInt(String(Unco_edit.Parameters['ProdAmount DX']));
- Unco_edit.Param.columns = parseInt(String(Unco_edit.Parameters['Ingredient Columns']));
- Unco_edit.Param.columnWidth = parseInt(String(Unco_edit.Parameters['Column Width']));
- Unco_edit.Param.ingColumns = parseInt(String(Unco_edit.Parameters['Ingredient Per Column']));
- //Overwrites of original functions
- //To in-line the amount for the product
- Window_CraftInfo.prototype.drawProducts = function(dy) {
- var skill = this._item;
- var indent = 24;
- var stockIndent = indent*3;
- var dx = this.textPadding();
- var dw = this.contents.width - this.textPadding() * 2;
- this.resetFontSettings();
- var text = ( (typeof skill.craftProdText !== 'undefined') ? skill.craftProdText : Unco.Param.craftDefProdText);
- this.drawDarkRect(dx-indent, dy, dw+indent, this.lineHeight());
- this.drawText(text, dx, dy, dw, 'left');
- dy += this.lineHeight();
- dx += indent;
- this.contents.fontSize = Unco.Param.craftFontSize;
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- for (var makeId in skill.makeItem) {
- makeId = parseInt(makeId);
- if (!isNaN(makeId) && (makeId > 0)) {
- var makeAmount = parseInt(skill.makeItem[makeId]);
- if (!isNaN(makeAmount) && (makeAmount > 0)) {
- this.drawIcon($dataItems[makeId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataItems[makeId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- //dy += this.lineHeight();
- }
- text = 'x' + String(makeAmount);
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + 2, dy, dw, 'left');
- text = '(' + $gameParty.getItemAmount($dataItems[makeId]) + ' ' + Unco.Param.craftDefStocText + ')';
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + stockIndent, dy, dw, 'left');
- dy += this.lineHeight();
- }
- }
- }
- for (var makeId in skill.makeArmor) {
- makeId = parseInt(makeId);
- if (!isNaN(makeId) && (makeId > 0)) {
- var makeAmount = parseInt(skill.makeArmor[makeId]);
- if (!isNaN(makeAmount) && (makeAmount > 0)) {
- this.drawIcon($dataArmors[makeId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataArmors[makeId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- //dy += this.lineHeight();
- }
- text = 'x' + String(makeAmount);
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + 2, dy, dw, 'left');
- text = '(' + $gameParty.getItemAmount($dataArmors[makeId]) + ' ' + Unco.Param.craftDefStocText + ')';
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + stockIndent, dy, dw, 'left');
- dy += this.lineHeight();
- }
- }
- }
- for (var makeId in skill.makeWeapon) {
- makeId = parseInt(makeId);
- if (!isNaN(makeId) && (makeId > 0)) {
- var makeAmount = parseInt(skill.makeWeapon[makeId]);
- if (!isNaN(makeAmount) && (makeAmount > 0)) {
- this.drawIcon($dataWeapons[makeId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataWeapons[makeId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- //dy += this.lineHeight();
- }
- text = 'x' + String(makeAmount);
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + 2, dy, dw, 'left');
- text = '(' + $gameParty.getItemAmount($dataWeapons[makeId]) + ' ' + Unco.Param.craftDefStocText + ')';
- this.drawText(text, dx + Unco_edit.Param.prodAmountDX + stockIndent, dy, dw, 'left');
- dy += this.lineHeight();
- }
- }
- }
- this.resetFontSettings();
- return dy;
- };
- //Draw Components
- Window_CraftInfo.prototype.drawComponents = function(dy) {
- var skill = this._item;
- var indent = 24;
- var stockIndent = indent*3;
- var dx = this.textPadding();
- var dw = this.contents.width - this.textPadding() * 2;
- var count = 0;
- var dyOrig = 0;
- this.resetFontSettings();
- this.drawDarkRect(dx-indent, dy, dw+indent, this.lineHeight());
- var text = ( (typeof skill.craftCompText !== 'undefined') ? skill.craftCompText : Unco.Param.craftDefCompText);
- this.drawText(text, dx, dy, dw, 'left');
- dy += this.lineHeight();
- dx += indent;
- dyOrig = dy;
- this.contents.fontSize = Unco.Param.craftFontSize;
- var craftLineHeight = Math.max(Unco.Param.craftFontSize,Window_Base._iconHeight)+1;
- if (typeof skill.goldCost === 'number') {
- this.drawIcon(Unco.Param.goldAmmoIconId, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText(TextManager.currencyUnit, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- dy += craftLineHeight;
- }
- var text = 'x' + String(skill.goldCost);
- this.drawText(text, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- if (skill.goldCost > $gameParty.gold()) this.changeTextColor(this.textColor(Unco.Param.craftFontColorCris));
- text = '(' + $gameParty.gold() + ' ' + Unco.Param.craftDefStocText + ')';
- this.drawText(text, dx + Window_Base._iconWidth + stockIndent, dy, dw, 'left');
- dy += craftLineHeight;
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- this.resetFontSettings();
- count += 1;
- if (count === Unco_edit.Param.ingColumns) {
- count = 0;
- dy = dyOrig;
- dx += Unco_edit.Param.columnWidth;
- }
- }
- for (var ammoId in skill.itemAmmoCost) {
- ammoId = parseInt(ammoId);
- if (!isNaN(ammoId) && (ammoId > 0)) {
- var ammoAmount = parseInt(skill.itemAmmoCost[ammoId]);
- if (!isNaN(ammoAmount) && (ammoAmount > 0)) {
- this.drawIcon($dataItems[ammoId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataItems[ammoId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- dy += craftLineHeight;
- }
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- text = 'x' + String(ammoAmount);
- this.drawText(text, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- if (ammoAmount > $gameParty.getItemAmount($dataItems[ammoId])) this.changeTextColor(this.textColor(Unco.Param.craftFontColorCris));
- text = '(' + $gameParty.getItemAmount($dataItems[ammoId]) + ' ' + Unco.Param.craftDefStocText + ')';
- this.drawText(text, dx + Window_Base._iconWidth + stockIndent, dy, dw, 'left');
- dy += craftLineHeight;
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- count += 1;
- if (count === Unco_edit.Param.ingColumns) {
- count = 0;
- dy = dyOrig;
- dx += Unco_edit.Param.columnWidth;
- }
- }
- }
- }
- for (var ammoId in skill.equipAmmoCost) {
- ammoId = parseInt(ammoId);
- if (!isNaN(ammoId) && (ammoId > 0)) {
- ammoAmount = parseInt(skill.equipAmmoCost[ammoId]);
- if (!isNaN(ammoAmount) && (ammoAmount > 0)) {
- this.drawIcon($dataArmors[ammoId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataArmors[ammoId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- dy += craftLineHeight;
- }
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- text = 'x' + String(ammoAmount);
- this.drawText(text, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- text = '(' + $gameParty.getItemAmount($dataArmors[ammoId]) + ' ' + Unco.Param.craftDefStocText + ')';
- if (ammoAmount > $gameParty.getItemAmount($dataArmors[ammoId])) this.changeTextColor(this.textColor(Unco.Param.craftFontColorCris));
- this.drawText(text, dx + Window_Base._iconWidth + stockIndent, dy, dw, 'left');
- dy += craftLineHeight;
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- count += 1;
- if (count === Unco_edit.Param.ingColumns) {
- count = 0;
- dy = dyOrig;
- dx += Unco_edit.Param.columnWidth;
- }
- }
- }
- }
- for (var ammoId in skill.weaponAmmoCost) {
- ammoId = parseInt(ammoId);
- if (!isNaN(ammoId) && (ammoId > 0)) {
- ammoAmount = parseInt(skill.weaponAmmoCost[ammoId]);
- if (!isNaN(ammoAmount) && (ammoAmount > 0)) {
- this.drawIcon($dataWeapons[ammoId].iconIndex, dx, dy);
- if (Unco.Param.craftDispNames === 'true') {
- this.drawText($dataWeapons[ammoId].name, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- dy += craftLineHeight;
- }
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- text = 'x' + String(ammoAmount);
- this.drawText(text, dx + Window_Base._iconWidth + 2, dy, dw, 'left');
- text = '(' + $gameParty.getItemAmount($dataWeapons[ammoId]) + ' ' + Unco.Param.craftDefStocText + ')';
- if (ammoAmount > $gameParty.getItemAmount($dataWeapons[ammoId])) this.changeTextColor(this.textColor(Unco.Param.craftFontColorCris));
- this.drawText(text, dx + Window_Base._iconWidth + stockIndent, dy, dw, 'left');
- dy += craftLineHeight;
- this.changeTextColor(this.textColor(Unco.Param.craftFontColorNorm));
- count += 1;
- if (count === Unco_edit.Param.ingColumns) {
- count = 0;
- dy = dyOrig;
- dx += Unco_edit.Param.columnWidth;
- }
- }
- }
- }
- this.resetFontSettings();
- return dy;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement