查看: 1998|回复: 4

[已经解决] 请问下这个合成系统怎样从主菜单中移除

[复制链接]
梦石
0
星屑
128
在线时间
109 小时
注册时间
2013-8-10
回帖
27
发表于 2016-2-27 10:17:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
  1. //==
  2. // Recipe Crafting MV Version 1.3b
  3. //==

  4. /*:
  5. * @plugindesc 带一些东西. .,让他们到其他物品!这是制作~
  6. * @author Vlue (with additions from DragonPC and MuteDay)
  7. *
  8. * @param Categories
  9. * @desc 各种类别的制作
  10. * @default "Alchemy","Blacksmith","Tailor","Dismantle"  “炼金术”、“铁匠”,“裁缝”、“拆除”
  11. *
  12. * @param Dismantle Category
  13. * @desc 拆除对象类别名称(类别名称相同)
  14. * @default Dismantle
  15. *
  16. * @param User Definable Max Level
  17. * @desc 定义的最大级别的球员可以达到制作界面(默认- 99)
  18. * @default 99
  19. *
  20. * @param Category Icons
  21. * @desc 制作的图标(指数)使用类别
  22. * @default 219,223,225,242
  23. *
  24. * @param Player Level Icon
  25. * @desc 图标显示的球员水平(如适用)在制定菜单
  26. * @default 82
  27. *
  28. * @param Crafting XP Formula
  29. * @desc 实验需要确定当前工艺水平(级)
  30. * @default 100 * lvl
  31. *
  32. * @param Dismantling Base Rate
  33. * @desc 默认的拆除成功率(每材料)
  34. * @default 80
  35. *
  36. * @param Dismantling Base Return
  37. * @desc 违约率的材料返回拆除
  38. * @default 50
  39. *
  40. * @param Craft Multiple
  41. * @desc 允许制作多个项目
  42. * @default true
  43. *
  44. * @param Menu Craft Options
  45. * @desc 是否允许制作从菜单(,看来,工艺)
  46. * @default craft
  47. *
  48. * @param Display Parameters
  49. * @desc 从配方的窗口包括/排除各种细节
  50. * @default gold:true, chance:true, plevel:true, clevel:true
  51. *
  52. * @param Main Menu String
  53. * @desc 字符串显示在主菜单的制作
  54. * @default Crafting
  55. *
  56. * @param Required Level Text
  57. * @desc 改变文本要求的水平。(默认-要求的水平:)
  58. * @default Required level:
  59. *
  60. * @param Required Material Text
  61. * @desc 改变文本所需的材料。(默认-所需材料:)
  62. * @default Required materials:
  63. *
  64. * @param Returned Material Text
  65. * @desc 改变材料返回文本。反向制作(默认-材料:返回)
  66. * @default Returned materials:
  67. *
  68. * @param Reverse Recipe Prefix
  69. * @desc 字符串附加到反向食谱配方名称(defualt -拆除)
  70. * @default Dismantle
  71. *
  72. * @param Success Rate Text
  73. * @desc 改变文本的成功率。(默认-成功率:)
  74. * @default Success rate:
  75. *
  76. * @param Crafting Cost Text
  77. * @desc 改变文本的制作成本。(默认-制作成本:)
  78. * @default Crafting costs:
  79. *
  80. * @param Crafting Text
  81. * @desc 改变制作文本。(默认-工艺)
  82. * @default Craft
  83. *
  84. * @param Crafted Text
  85. * @desc 改变了文本。(默认——精心制作!)
  86. * @default Crafted!
  87. *
  88. * @param Crafting Failed
  89. * @desc 改变制作失败的文本。(默认-制作失败!)
  90. * @default Crafting failed!
  91. *
  92. * @param Dismantle Text
  93. * @desc 改变文本拆除。(默认-拆除)
  94. * @default Dismantle
  95. *
  96. * @param Dismantled Text
  97. * @desc 改变文本拆除。(默认——了!)
  98. * @default obtained!
  99. *
  100. * @param Dismantle Fail
  101. * @desc 改变拆除失败文本(默认——没有物品了!)
  102. * @default No items obtained!
  103. *
  104. * @param Max Level Test
  105. * @desc 文本显示,当达到最大水平的职业。
  106. * @default MAX LEVEL
  107. *
  108. * @param Success 0-20 Color
  109. * @desc 改变颜色的百分比(默认- 18)
  110. * @default 18
  111. *
  112. * @param Success 20-40 Color
  113. * @desc 改变颜色的百分比(默认- 20)
  114. * @default 20
  115. *
  116. * @param Success 40-60 Color
  117. * @desc 改变颜色的百分比(默认- 20)
  118. * @default 21
  119. *
  120. * @param Success 60-80 Color
  121. * @desc 改变颜色的百分比(默认- 20)
  122. * @default 17
  123. *
  124. * @param Success 80-100 Color
  125. * @desc 改变颜色的百分比(默认- 20)
  126. * @default 29
  127. *
  128. * @param Crafting Succeded Sound
  129. * @desc 改变制作成功的声音。(区分大小写)(默认- Item3)
  130. * @default Item3
  131. *
  132. * @param Success Sound Volume
  133. * @desc 改变制作成功了音量。(默认- 90)
  134. * @default 90
  135. *
  136. * @param Crafting Failed Sound
  137. * @desc 改变制作失败的声音。(区分大小写)(默认-尖叫)
  138. * @default Buzzer2
  139. *
  140. * @param Fail Sound Volume
  141. * @desc 改变制作失败的音量。(默认- 90)
  142. * @default 90
  143. *
  144. * @help 配方制作MV v1.3b !
  145. *在twitter上关注我:[url]https://twitter.com/DaimoniousTails[/url]
  146. *或facebook:[url]https://www.facebook.com/DaimoniousTailsGames/[/url]
  147. *为最近更新!
  148. *在这里找到我所有的工作:[url]http://daimonioustails.weebly.com/[/url]
  149. *
  150.   *插件命令:
  151. *  crafting call categoryName            (Example: crafting call Alchemy)(例子:制作调用炼金术)
  152. *  crafting learn recipeID               (Example: crafting learn 1)(例如:制定学习1)
  153. *  crafting forget recipeID     制作忘记recipeID
  154. *
  155. * Script Calls:
  156. *  $gameParty.recipeKnown(recipeId)          (检查是否一个特定的食谱已知或不)
  157. *  $gameparty.getCraftLevel(craftingName) (返回当前级别的具体工艺)
  158. *
  159. * 配方的设置
  160. *食谱中创建一个文本文件命名的食谱。txt和放置在
  161. *  /data 文件夹。如果你注意到你可能没有食谱
  162. *在错误的地方或者不正确命名!
  163. *
  164. *  <recipe#>
  165. *   result:{type:"itemtype", id:itemId, amount:numberCrafted}   
  166. *   <materials>                                 (itemtype is one of: "item","weapon",or "armor")
  167. *    {type:"itemtype", id:itemId, amount:numberRequired, cons:consumed?, rate:0-100, bonus:true/false}
  168. *    { + as many as you need }                          
  169. *   <materials>
  170. *   category:CategoryOfCraft                           (Name i.e. Blacksmith)
  171. *   goldCost:costInGold                                (Number)
  172. *   success:successRateBase                            (Number, 0 = 0%, 100 = 100%)
  173. *   successGain:successRateChangePerLevelDifference    (Number, %)
  174. *   level:levelRequired                                (Number)
  175. *   xp:craftingExpEarned                               (Number)
  176. *   xpDeprac:lossOfExpPerLevelDifference               (Number)
  177. *   craftLevel:craftingLevelRequired                   (Number)
  178. *   pxp:PlayerExpEarned                                (Number)
  179. *   reverse:whetherReverseRecipe                                                (Boolean i.e. true)
  180. *   craftMultiple:allowMultipleCrafts                  (Boolean i.e. true)
  181. *   known:whetherRecipeIsKnownFromStart                (Boolean i.e. true)
  182. *   returnRate:%ofMaterialsFromDismantle               (Number, 0 = 0%, 100 = 100%)
  183. *  <recipe#>
  184. *
  185. *  从goldCost craftMultiple是可选的(将被设置为默认值0 - 1)
  186. *反向食谱开关结果和材料价值(成本核算结果,返回材料)
  187. *反过来食谱的机会获得材料的速度值。
  188. *奖金材料是来自拆除的材料(不包括在制作)。
  189. *
  190. *  Simplest recipe (example):
  191. *   <recipe1>
  192. *    recipe:{type:"armor", id:3, amount:1}
  193. *    <materials>
  194. *     {type:"armor", id:1, amount:3, cons:false}
  195. *    <materials>
  196. *    category:Blacksmith
  197. *   <recipe1>
  198. *
  199. *  Full Recipe (example):
  200. *   <recipe1>
  201. *    result:{type:"armor", id:3, amount:1}
  202. *    <materials>
  203. *    {type:"weapon", id:3, amount:3, cons:false}
  204. *    {type:"armor", id:2, amount:3, cons:false}
  205. *    <materials>
  206. *    goldCost:0
  207. *    success:80
  208. *    successGain:2
  209. *    level:1
  210. *    category:Alchemy
  211. *    xp:10
  212. *    xpDeprac:2
  213. *    craftLevel:1
  214. *    pxp:5
  215. *    craftMultiple:true
  216. *    known:true
  217. *   <recipe1>
  218. *
  219. */

  220. var $gameRecipes = null;

  221. function Scene_Crafting() {
  222.                 this.initialize.apply(this, arguments);
  223.         }
  224. Scene_Crafting.prototype = Object.create(Scene_MenuBase.prototype);
  225. Scene_Crafting.prototype.constructor = Scene_Crafting;

  226. (function() {

  227.         var parameters = PluginManager.parameters('RecipeCrafting');
  228.         var categoryNames = eval("[" + (parameters['Categories'] || '"炼金","锻造","裁缝"') + "]");
  229.         var dismantleText = parameters['Dismantle Category'] || "Dismantle";
  230.         var categoryIcons = eval("[" + (parameters['Category Icons'] || "371,368,373,375") + "]");
  231.         var xpFormula = parameters['Crafting XP Formula'] || "20 * lvl";
  232.         var dsmBaseRate = Number(parameters['Dismantling Base Rate'] || 80);
  233.         var dsmBaseReturn = Number(parameters['Dismantling Base Return'] || 50);
  234.         var craftMultiple = (parameters['Craft Multiple'] || "true").toLowerCase() == "true";
  235.         var craftFromMenu = parameters['Menu Craft Options'] || "craft";
  236.         var craftingMenuString = parameters['Main Menu String'] || "制作技能"
  237.         var tempdParam = "gold:true, chance:true, plevel:true, clevel:true"
  238.         var displayParam = eval( "( { " + (parameters['Display Parameters'] || tempdParam) + " } )");
  239.         var playerLevelIcon = parameters['Player Level Icon'] || 82;
  240.         var reqlevel = parameters['Required Level Text'] || '制作级别:';
  241.     var reqmaterial = parameters['Required Material Text'] || '需要物品:';
  242.         var matreturn = parameters['Return Material Text'] || 'Returned materials:';
  243.         var reversePrefix = parameters['Reverse Recipe Prefix'] || 'Dismantle';
  244.     var sucRate = parameters['Success Rate Text'] || '成功率:';
  245.     var craCost = parameters['Crafting Cost Text'] || '制作成本:';
  246.     var craText = parameters['Crafting Text'] || '制作';
  247.         var dsmText = parameters['Dismantle Text'] || '拆除';
  248.     var craftedText = parameters['Crafted Text'] || '制作完成!';
  249.         var dismantledText = parameters['Dismantled Text'] || '得到!'
  250.     var craFailed = parameters['Crafting Failed'] || 'Crafting failed!';
  251.         var dsmFailed = parameters['Dismantle Fail'] || 'No items obtained!';
  252.     var MLT = parameters['Max Level Test'] || 'MAX LEVEL';
  253.     var success = parameters['Crafting Succeded Sound'] || 'Item3';
  254.     var failure = parameters['Crafting Failed Sound'] || 'Buzzer2';
  255.     var failureVol = Number(parameters['Fail Sound Volume'] || 90);
  256.     var successVol = Number(parameters['Success Sound Volume'] || 90);
  257.     var UDML = Number(parameters['User Definable Max Level'] || 99);
  258.     var colorCPV1 = Number(parameters['Success 0-20 Color'] || 18);
  259.     var colorCPV2 = Number(parameters['Success 20-40 Color'] || 20);
  260.     var colorCPV3 = Number(parameters['Success 40-60 Color'] || 21);
  261.     var colorCPV4 = Number(parameters['Success 60-80 Color'] || 17);
  262.     var colorCPV5 = Number(parameters['Success 80-100 Color'] || 29);
  263.        
  264.         var categoryEventName = "";
  265.         var craftingFromMenu = false;
  266.        
  267.         TextManager.getErrorDetails = function() {
  268.                 if($gameMap) {
  269.                         return "[Map: " + $gameMap._mapId + "] [Event: " + $gameMap._interpreter._eventId + "] : \n"
  270.                 }
  271.         }
  272.         DataManager.loadRecipeFile = function() {
  273.                 var xml = new XMLHttpRequest();
  274.                 var url = "data/Recipes.txt";
  275.                 xml.onload = function() {
  276.                         if(xml.status < 400) {
  277.                                 DataManager.createRecipes(xml.responseText);
  278.                         }
  279.                 }
  280.                 xml.open("GET",url,true);
  281.                 xml.send();
  282.         }
  283.         var crafting_DataManager_createGameObjects = DataManager.createGameObjects;
  284.         DataManager.createGameObjects = function() {
  285.                 crafting_DataManager_createGameObjects.call(this);
  286.                 this.loadRecipeFile();
  287.         }
  288.         DataManager.createRecipes = function(recipeData) {
  289.                 var recipes = [0];
  290.                 if(recipeData) {
  291.                         var numberOfRecipes = recipeData.match(/<recipe(\d+)>/g).length / 2;
  292.                         for(var i = 1;i <= numberOfRecipes;i++) {
  293.                                 var recipeString = recipeData.match(new RegExp("<recipe" + i + '>([^.]+)<recipe' + i + ">"));
  294.                                 if(recipeString) {
  295.                                         recipes.push(new Recipe(i,this.createRecipeStruct(i, recipeString)));
  296.                                 } else {
  297.                                         throw new Error("Recipe list: Could not get data for recipe ID# " + i + ". Check your setup.");
  298.                                 }
  299.                         }
  300.                 }
  301.                 $gameRecipes = recipes;
  302.         }
  303.         DataManager.createRecipeStruct = function(id, recipeData) {
  304.                 if(!recipeData[1].match(/result:/)) {
  305.                         throw new Error("Recipe List: Recipe ID# " + id + " does not have a result.")
  306.                 }
  307.                 if(recipeData[1].match(/result:/g).length > 1) {
  308.                         throw new Error("Recipe List: Possible repeated recipe ID. (ID #" + id + ")");
  309.                 }
  310.                 var recipeStruct = {};
  311.                 recipeStruct.result = recipeData[1].match(/result:(.+)/);
  312.                 recipeStruct.reverse = recipeData[1].match(/reverse:(.+)/);
  313.                 var materialData = recipeData[1].match(/<materials>([^.]+)<materials>/);
  314.                 if(materialData) {
  315.                         materialData = eval( "[" + materialData[1].split("}").join("},") + "]" );
  316.                 } else {
  317.                         throw new Error("Recipe List: Recipe ID# " + id + " does not have a proper material setup.")
  318.                 }
  319.                 recipeStruct.materials = materialData;
  320.                 recipeStruct.goldCost = recipeData[1].match(/goldCost:(.+)/);
  321.                 recipeStruct.success = recipeData[1].match(/success:(.+)/);
  322.                 recipeStruct.successGain = recipeData[1].match(/successGain:(.+)/);
  323.                 recipeStruct.level = recipeData[1].match(/level:(.+)/);
  324.                 recipeStruct.category = recipeData[1].match(/category:(.+)/);
  325.                 recipeStruct.xp = recipeData[1].match(/xp:(.+)/);
  326.                 recipeStruct.xpDeprac = recipeData[1].match(/xpDeprac:(.+)/);
  327.                 recipeStruct.craftLevel = recipeData[1].match(/craftLevel:(.+)/);
  328.                 recipeStruct.playerXp = recipeData[1].match(/pxp:(.+)/);
  329.                 recipeStruct.multiple = recipeData[1].match(/craftMultiple:(.+)/);
  330.                 recipeStruct.known = recipeData[1].match(/known:(.+)/);
  331.                 recipeStruct.returnRate = recipeData[1].match(/returnRate:(.+)/);
  332.                 return recipeStruct;
  333.         }
  334.        
  335.         function Recipe() {
  336.                 this.initialize.apply(this, arguments);
  337.         }
  338.         Recipe.prototype.initialize = function(id, recipe) {
  339.                 this._id = id;
  340.                 try {
  341.                         this._result = new Material(eval("("+recipe.result[1]+")"));
  342.                 } catch(e) {
  343.                         throw new Error("Recipe List: Recipe ID# " + id + " does not have a proper result set up.")
  344.                 }
  345.                 this._returnRate = recipe.returnRate ? Number(recipe.returnRate[1]) : dsmBaseReturn;
  346.                 this._materials = [];
  347.                 for(var i = 0;i < recipe.materials.length;i++) {
  348.                         this._materials.push(new Material(recipe.materials[i], this._returnRate));
  349.                 }
  350.                 if(this._materials.length == 0) {
  351.                         throw new Error("Recipe List: Recipe ID# " + id + " does not have any set materials.")
  352.                 }
  353.                 this._goldCost = recipe.goldCost ? Number(recipe.goldCost[1]) : 0;
  354.                 this._success = recipe.success ? Number(recipe.success[1]) : 100;
  355.                 this._successGain = recipe.successGain ? Number(recipe.successGain[1]) : 0;
  356.                 this._level = recipe.level ? Number(recipe.level[1]) : 0;
  357.                 this._category = recipe.category ? recipe.category[1] : categoryNames[0];
  358.                 this._xp = recipe.xp ? Number(recipe.xp[1]) : 100;
  359.                 this._xpDeprac = recipe.xpDeprac ?  Number(recipe.xpDeprac[1]) : 0;
  360.                 this._craftLevel = recipe.craftLevel ? Number(recipe.craftLevel[1]) : 1;
  361.                 this._pxp = recipe.playerXp ? Number(recipe.playerXp[1]) : 0;
  362.                 this._craftMultiple = (recipe.multiple ? recipe.multiple[1] : "true").toLowerCase() == "true";
  363.                 this._known = (recipe.known ? recipe.known[1] : "true").toLowerCase() == "true";
  364.                 this._reverse = (recipe.reverse ? recipe.reverse[1] : "true").toLowerCase() == "true";
  365.         }
  366.         Recipe.prototype.name = function(reverse) {
  367.                 return reverse ? reversePrefix + this._result.name() : this._result.name();
  368.         }
  369.         Recipe.prototype.hasMaterials = function(reverse) {
  370.                 if(reverse) {
  371.                         if($gameParty.numItemsCrafting(this._result._item) < 1) { return false; }
  372.                 } else {
  373.                         for(var i = 0;i < this._materials.length;i++) {
  374.                                 var material = this._materials[i];
  375.                                 if(material._bonus) { continue; }
  376.                                 if($gameParty.numItemsCrafting(material._item) < material._amount) {return false;}
  377.                         }
  378.                 }
  379.                 return true;
  380.         }
  381.         Recipe.prototype.hasGold = function() { return $gameParty.gold() >= this._goldCost;}
  382.         Recipe.prototype.hasCraftLevel = function() { return this._craftLevel <= $gameParty.craftLevel(this.categoryId());}
  383.         Recipe.prototype.hasLevel = function() { return this._level <= $gameParty.highestLevel() && this.hasCraftLevel();}
  384.         Recipe.prototype.craftable = function(reverse) { return this.hasGold() && this.hasMaterials(reverse) && this.hasLevel();}
  385.         Recipe.prototype.amountCraftable = function(reverse) {
  386.                 var amount = null;
  387.                 if(reverse) {
  388.                         return amount = $gameParty.numItemsCrafting(this._result._item);
  389.                 } else {
  390.                         for(var i = 0;i < this._materials.length;i++) {
  391.                                 var material = this._materials[i];
  392.                                 if(material._bonus) { continue; }
  393.                                 var amountNext = 0
  394.                                 if(material._consumed) {
  395.                                         amountNext = $gameParty.numItemsCrafting(material._item) / material._amount
  396.                                 } else {
  397.                                         amountNext = $gameParty.numItemsCrafting(material._item) >= material._amount ? 99 : 0
  398.                                 }
  399.                                 if(amount) {
  400.                                         if(amountNext < amount) {amount = amountNext;}
  401.                                 } else {
  402.                                         amount = amountNext;
  403.                                 }
  404.                         }
  405.                 }
  406.                 var amountGold = this._goldCost > 0 ? $gameParty.gold() / this._goldCost : 99;
  407.                 if(amountGold < amount) {amount = amountGold;}
  408.                 return Math.floor(amount);
  409.         }
  410.         Recipe.prototype.craft = function(failRate, reverse) {
  411.                 failRate = failRate || 0;
  412.                 if(reverse) { failRate = 0; }
  413.                 this.removeMaterials(reverse);
  414.                 if(failRate < this.successRate()) {
  415.                         return this.addResult(reverse);
  416.                 }
  417.                 return [];
  418.         }
  419.         Recipe.prototype.removeMaterials = function(reverse) {
  420.                 if(reverse) {
  421.                         $gameParty.gainItem(this._result._item,-1);
  422.                 } else {
  423.                         for(var i = 0;i < this._materials.length;i++) {
  424.                                 var material = this._materials[i];
  425.                                 if(material._bonus) { continue; }
  426.                                 if(material._consumed) {
  427.                                         $gameParty.gainItem(material._item, -material._amount);
  428.                                 }
  429.                         }
  430.                         $gameParty.gainGold(-this._goldCost);
  431.                 }
  432.         }
  433.         Recipe.prototype.addResult = function(reverse) {
  434.                 var newItem = [];
  435.                 if(reverse) {
  436.                         for(var i = 0;i < this._materials.length;i++) {
  437.                                 var material = this._materials[i];
  438.                                 if(Math.random() < material._rate / 100) {
  439.                                         $gameParty.gainItem(material._item, material.returnAmount());
  440.                                         newItem.push(material);
  441.                                 }
  442.                         }
  443.                 } else {
  444.                         $gameParty.gainItem(this._result._item,this._result._amount);
  445.                         newItem.push(this._result);
  446.                         $gameParty.gainCraftExp(this.categoryId(), this.xpGain());
  447.                         for(var i = 0;i < $gameParty.members().length;i++) {
  448.                                 $gameParty.members()[i].gainExp(this._pxp);
  449.                         }
  450.                 }
  451.                 return newItem;
  452.         }
  453.         Recipe.prototype.categoryId = function() { return categoryNames.indexOf(this._category);}
  454.         Recipe.prototype.xpGain = function() {
  455.                 if($gameParty.craftLevel(this.categoryId()) > UDML) { return 0; }
  456.                 var levelDiff = $gameParty.craftLevel(this.categoryId()) - this._craftLevel;
  457.                 return Math.max(this._xp - this._xpDeprac * levelDiff,0);
  458.         }
  459.         Recipe.prototype.successRate = function() {
  460.                 var levelDiff = $gameParty.craftLevel(this.categoryId()) - this._craftLevel;
  461.                 return Math.min(this._success + this._successGain * levelDiff,100);
  462.         }
  463.         Recipe.prototype.known = function() {
  464.                 return $gameParty.recipeKnown(this._id);
  465.         }
  466.        
  467.         function Material() {
  468.                 this.initialize.apply(this, arguments);
  469.         }
  470.         Material.prototype.initialize = function(material, rate) {
  471.                 if(material.type == "item") {this._item = $dataItems[material.id];}
  472.                 if(material.type == "weapon") {this._item = $dataWeapons[material.id];}
  473.                 if(material.type == "armor") {this._item = $dataArmors[material.id];}
  474.                 this._amount = material.amount;
  475.                 this._consumed = material.cons != null ? material.cons : true;
  476.                 this._rate = material.rate || dsmBaseRate;
  477.                 this._returnRate = rate || 100;
  478.                 this._bonus = material.bonus != null ? material.bonus : false;
  479.         }
  480.         Material.prototype.name = function() {
  481.                 return this._item.name;
  482.         }
  483.         Material.prototype.returnAmount = function() {
  484.                 return this._bonus ? this._amount : Math.round(Math.max(1,this._amount * (this._returnRate / 100)));
  485.         }
  486.        
  487.         var crafting_game_party_initialize = Game_Party.prototype.initialize;
  488.         Game_Party.prototype.initialize = function() {
  489.                 crafting_game_party_initialize.call(this);
  490.                 this.createRecipeData();
  491.         }
  492.         Game_Party.prototype.createRecipeData = function() {
  493.                 this._craftingLevel = new Array(categoryNames.length);
  494.                 this._craftingExp = new Array(categoryNames.length);
  495.                 for(var i = 0;i < categoryNames.length;i++) {
  496.                         this._craftingLevel[i] = 1;
  497.                         this._craftingExp[i] = 0;
  498.                 }
  499.                 this._recipesKnown = [];
  500.                 this.resetKnownRecipes();
  501.         }
  502.         Game_Party.prototype.checkRecipeVariables = function() {
  503.                 if(!this._recipesKnown) { this.createRecipeData(); }
  504.         }
  505.         Game_Party.prototype.learnRecipe = function(id) {
  506.                 this._recipesKnown[id] = true;
  507.         }
  508.         Game_Party.prototype.forgetRecipe = function(id) {
  509.                 this._recipesKnown[id] = false;
  510.         }
  511.         Game_Party.prototype.resetKnownRecipes = function() {
  512.                 if($gameRecipes) {
  513.                         for(var i = 1;i < $gameRecipes.length;i++) {
  514.                                 if($gameRecipes[i]._known) {
  515.                                         this.learnRecipe($gameRecipes[i]._id);
  516.                                 } else {
  517.                                         this.forgetRecipe($gameRecipes[i]._id);
  518.                                 }
  519.                         }
  520.                 }
  521.         }
  522.         Game_Party.prototype.recipeKnown = function(id) {
  523.                 return this._recipesKnown[id];
  524.         }
  525.         Game_Party.prototype.craftLevel = function(id) { return this._craftingLevel[id]; }
  526.         Game_Party.prototype.craftExp = function(id) { return this._craftingExp[id]; }
  527.         Game_Party.prototype.getCraftLevel = function(string) {
  528.                 var index = categoryNames.indexOf(string)
  529.                 if(index >= 0) {
  530.                         return this.craftLevel(categoryNames.indexOf(string));
  531.                 } else {
  532.                         throw new Error(TextManager.getErrorDetails() + string + " is not a valid crafting category!");
  533.                 }
  534.         }
  535.         Game_Party.prototype.craftExpNext = function(id) {
  536.                 var string = xpFormula.replace(/\lvl/g, this.craftLevel(id));
  537.                 return eval(string);
  538.         }
  539.         Game_Party.prototype.gainCraftExp = function(id, value) {
  540.                 this._craftingExp[id] += value;
  541.                 while(this.craftExp(id) >= this.craftExpNext(id)) {
  542.                         this._craftingExp[id] -= this.craftExpNext(id);
  543.                         this._craftingLevel[id]++;
  544.                 }
  545.         }
  546.         Game_Party.prototype.numItemsCrafting = function(item) {
  547.                 if(Object.keys(PluginManager.parameters('YEP_ItemCore')).length > 0) {
  548.                         return this.numIndependentItems(item);
  549.                 } else {
  550.                         return this.numItems(item);
  551.                 }
  552.         }
  553.        
  554.         function Window_RecipeList() {
  555.                 this.initialize.apply(this, arguments);
  556.         }
  557.         Window_RecipeList.prototype = Object.create(Window_Selectable.prototype);
  558.         Window_RecipeList.prototype.constructor = Window_RecipeList;
  559.         Window_RecipeList.prototype.initialize = function(x, y, w, h) {
  560.                 Window_Selectable.prototype.initialize.call(this, x, y, w, h);
  561.                 this.resetRecipes();
  562.         }
  563.         Window_RecipeList.prototype.maxItems = function() {
  564.                 return this._data ? this._data.length : 1;
  565.         }
  566.         Window_RecipeList.prototype.item = function() {
  567.                 return this._data && this._index >= 0 ? this._data[this._index] : null;
  568.         }
  569.         Window_RecipeList.prototype.currentItemEnabled = function() {
  570.                 return this.enable(this._data[this._index]);
  571.         }
  572.         Window_RecipeList.prototype.include = function(item) {
  573.                 if(item == 0) { return false; }
  574.                 if(!item.known()) { return false; }
  575.                 if(!item.hasCraftLevel()) { return false; }
  576.                 if(this._category == "all") {return true;}
  577.                 if(this._category == dismantleText && item._reverse) {
  578.                         return item.craftable(true); }
  579.                 return this._category == item._category;
  580.         }
  581.         Window_RecipeList.prototype.setCategory = function(category) {
  582.                 if(category == this._category) { return; }
  583.                 this._category = category;
  584.                 this.resetRecipes();
  585.         }
  586.         Window_RecipeList.prototype.isReverse = function() {
  587.                 return this._category == dismantleText;
  588.         }
  589.         Window_RecipeList.prototype.resetRecipes = function() {
  590.                 this._data = [];
  591.                 for(var i = 0;i < $gameRecipes.length;i++) {
  592.                         var recipe = $gameRecipes[i];
  593.                         if(this.include(recipe)) {this._data.push(recipe);}
  594.                 }
  595.                 this.refresh();
  596.         }
  597.         Window_RecipeList.prototype.isEnabled = function(item) {
  598.                 if(item) { return item.craftable(this.isReverse()); }
  599.                 return false;
  600.         }
  601.         Window_RecipeList.prototype.drawItem = function(index) {
  602.                 var item = this._data[index];
  603.                 if(item) {
  604.                         rect = this.itemRect(index);
  605.                         rect.width -= 4;
  606.                         this.changePaintOpacity(this.isEnabled(item));
  607.                         this.drawItemName(item, rect.x, rect.y);
  608.                         if(item.amountCraftable(this.isReverse()) > 0) {
  609.                                 this.drawText("x"+String(item.amountCraftable(this.isReverse())),rect.x,rect.y,this.contents.width,"right");
  610.                         }
  611.                 }
  612.         }
  613.         Window_RecipeList.prototype.currentItem = function() {
  614.                 return this._index >= 0 ? this._data[this._index] : null;
  615.         }
  616.         Window_RecipeList.prototype.processOk = function() {
  617.                 if (this.isCurrentItemEnabled() && this.craftMenuOk()) {
  618.                         this.playOkSound();
  619.                         this.updateInputData();
  620.                         this.callOkHandler();
  621.                 } else {
  622.                         this.playBuzzerSound();
  623.                 }
  624.         }
  625.         Window_RecipeList.prototype.craftMenuOk = function() {
  626.                 if(craftingFromMenu) {
  627.                         if(craftFromMenu == "view") { return false; }
  628.                 }
  629.                 return true;
  630.         }
  631.         Window_RecipeList.prototype.refresh = function() {
  632.                 this.createContents();
  633.                 Window_Selectable.prototype.refresh.call(this);
  634.         }
  635.         Window_RecipeList.prototype.contentsHeight = function() {
  636.                 return this.maxItems() * this.lineHeight();
  637.         }
  638.         Window_RecipeList.prototype.isCurrentItemEnabled = function() {
  639.                 return this.isEnabled(this.currentItem());
  640.         }
  641.         Window_RecipeList.prototype.drawItemName = function(recipe, x, y, width) {
  642.                 var amount = recipe._result._amount;
  643.                 item = recipe._result._item;
  644.                 width = width || 312;
  645.                 if (item) {
  646.                         var iconBoxWidth = Window_Base._iconWidth + 4;
  647.                         this.resetTextColor();
  648.                         this.drawIcon(item.iconIndex, x + 2, y + 2);
  649.                         var string = recipe.name();
  650.                         if(amount > 1) { string += " (x" + amount + ")" }
  651.                         this.drawText(string, x + iconBoxWidth, y, width - iconBoxWidth);
  652.                 }
  653.         };
  654.        
  655.         function Window_RecipeDetail() {
  656.                 this.initialize.apply(this, arguments);
  657.         }
  658.         Window_RecipeDetail.prototype = Object.create(Window_Base.prototype);
  659.         Window_RecipeDetail.prototype.constructor = Window_RecipeDetail;
  660.         Window_RecipeDetail.prototype.initialize = function(x, y, w, h) {
  661.                 Window_Base.prototype.initialize.call(this, x, y, w, h);
  662.                 this._recipe = null;
  663.         }
  664.         Window_RecipeDetail.prototype.setRecipe = function(recipe, reverse) {
  665.                 if(recipe == this._recipe) {return;}
  666.                 this._recipe = recipe;
  667.                 this._reverse = reverse || false;
  668.                 this.refresh();
  669.         }
  670.         Window_RecipeDetail.prototype.refresh = function() {
  671.                 this.contents.clear();
  672.                 if(this._recipe) {
  673.                         if(!this._reverse) {
  674.                                 if(displayParam.clevel || displayParam.plevel) {this.drawCraftLevel();}
  675.                                 if(displayParam.chance) { this.drawSuccessRate(); }
  676.                                 if(displayParam.gold) {this.drawGoldCost();}
  677.                         }
  678.                         this.drawMaterials();
  679.                 }
  680.         }
  681.         Window_RecipeDetail.prototype.drawCraftLevel = function() {
  682.                 this.changePaintOpacity(this._recipe.hasLevel());
  683.                 this.changeTextColor(this.systemColor());
  684.                 this.drawText(reqlevel,0,0,this.contents.width);
  685.                 this.changeTextColor(this.normalColor());
  686.                 var xx = 0;
  687.                 var text = "";
  688.                 if(displayParam.plevel) {
  689.                         this.drawText(String(this._recipe._level),0,0,this.contents.width,"right");
  690.                         this.drawIcon(playerLevelIcon,this.contents.width - 24 - Window_Base._iconWidth,0);
  691.                         xx += 68; //HERE
  692.                         text = String(this._recipe._craftLevel) + " |";
  693.                 } else {
  694.                         text = String(this._recipe._craftLevel);
  695.                 }
  696.                 if(displayParam.clevel) {
  697.                         this.drawText(text,0,0,this.contents.width - xx,"right");
  698.                         this.drawIcon(categoryIcons[this._recipe.categoryId()],this.contents.width - 75 - xx,0); //HERE
  699.                 }
  700.         }
  701.         Window_RecipeDetail.prototype.drawMaterials = function() {
  702.                 var yy = 20;
  703.                 if(displayParam.clevel || displayParam.plevel) {yy = this.contents.fontSize + 20;}
  704.                 if(this._reverse) { yy = 0; }
  705.                 this.changePaintOpacity(this._recipe.craftable(this._reverse));
  706.                 this.changeTextColor(this.systemColor());
  707.                 this.drawText(this._reverse ? matreturn : reqmaterial,0,yy,this.width);
  708.                 yy += this.contents.fontSize + this.textPadding();
  709.                 for(var i = 0;i < this._recipe._materials.length;i++) {
  710.                         var item = this._recipe._materials[i];
  711.                         if(!this._reverse && item._bonus) { continue; }
  712.                         if(!this._reverse) { this.changePaintOpacity($gameParty.numItemsCrafting(item._item) >= item._amount); }
  713.                         this.changeTextColor(this.normalColor());
  714.                         this.drawIcon(item._item.iconIndex,12,yy);
  715.                         this.drawText(item._item.name,12+Window_Base._iconWidth,yy,this.width);
  716.                         var string = ""
  717.                         if(this._reverse) {
  718.                                 string = "x" + String(item.returnAmount()) + " (" + String(item._rate) + "%)";
  719.                         } else {
  720.                                 var itemAmount = $gameParty.numItemsCrafting(item._item);
  721.                                 this.changeTextColor(this.textColor(itemAmount >= item._amount ? 3 : 18));
  722.                                 this.drawText(itemAmount,0,yy,this.contents.width-72,'right');
  723.                                 this.changeTextColor(this.normalColor());
  724.                                 string = " / " + String(item._amount);
  725.                         }
  726.                         this.drawText(string,0,yy,this.contents.width-12,"right");
  727.                         yy += this.contents.fontSize  + this.textPadding();
  728.                 }
  729.         }
  730.         Window_RecipeDetail.prototype.drawSuccessRate = function() {
  731.                 var successRate = this._recipe.successRate();
  732.                 this.changePaintOpacity(this._recipe.craftable(this._reverse));
  733.                 this.changeTextColor(this.systemColor());
  734.                 var yy = this.contents.height - this.contents.fontSize - this.textPadding() - 6;
  735.                 this.drawText(sucRate,0,yy,this.contents.width);
  736.                 var color = [colorCPV1,colorCPV2,colorCPV3,colorCPV4,colorCPV5,colorCPV5];
  737.                 this.changeTextColor(this.textColor(color[Math.floor(successRate/20)]));
  738.                 this.drawText(successRate + "%",0,yy,this.contents.width,"right");
  739.                 this.changeTextColor(this.normalColor());
  740.         }
  741.         Window_RecipeDetail.prototype.drawGoldCost = function() {
  742.                 if(this._recipe._goldCost > 0) {
  743.                         this.changePaintOpacity(this._recipe.hasGold());
  744.                         this.changeTextColor(this.systemColor());
  745.                         this.drawText(craCost,0,this.contents.height-this.contents.fontSize*2,this.contents.width);
  746.                         this.changeTextColor(this.normalColor());
  747.                         this.drawCurrencyValue(this._recipe._goldCost,TextManager.currencyUnit,0,this.contents.height-this.contents.fontSize*2,this.contents.width)
  748.                 }
  749.         }
  750.         Window_RecipeDetail.prototype.drawCurrencyValue = function(value, unit, x, y, width) {
  751.                 var unitWidth = Math.min(80, this.textWidth(unit));
  752.                 this.resetTextColor();
  753.                 this.changePaintOpacity(this._recipe.hasGold());
  754.                 this.drawText(value, x, y, width - unitWidth - 6, 'right');
  755.                 this.changeTextColor(this.systemColor());
  756.                 this.drawText(unit, x + width - unitWidth, y, unitWidth, 'right');
  757.         }
  758.        
  759.         function Window_RecipeConfirm() {
  760.                 this.initialize.apply(this, arguments);
  761.         }
  762.         Window_RecipeConfirm.prototype = Object.create(Window_Selectable.prototype);
  763.         Window_RecipeConfirm.prototype.constructor = Window_RecipeConfirm;
  764.         Window_RecipeConfirm.prototype.initialize = function(x, y, w, h) {
  765.                 Window_Selectable.prototype.initialize.call(this, x, y, w, h);
  766.                 this._amount = 1;
  767.                 this.refresh();
  768.         }
  769.         Window_RecipeConfirm.prototype.itemMax = function() {return 1;}
  770.         Window_RecipeConfirm.prototype.enable = function() {return true;}
  771.         Window_RecipeConfirm.prototype.refresh = function() {
  772.                 Window_Selectable.prototype.refresh.call(this);
  773.                 this.drawText(this._reverse ? dsmText : craText,0,0,this.contents.width,"center");
  774.                 if(this._recipe && this._recipe.craftable(this._reverse)) {
  775.                         this.drawText("x" + String(this._amount),0,0,this.contents.width,"right");
  776.                 }
  777.         }
  778.         Window_RecipeConfirm.prototype.activate = function() {
  779.                 Window_Selectable.prototype.activate.call(this);
  780.                 this.select(0);
  781.         }
  782.         Window_RecipeConfirm.prototype.deactivate = function() {
  783.                 Window_Selectable.prototype.deactivate.call(this);
  784.                 this.deselect();
  785.         }
  786.         Window_RecipeConfirm.prototype.setRecipe = function(recipe, reverse) {
  787.                 if(recipe == this._recipe) { return; }
  788.                 this._recipe = recipe;
  789.                 this._reverse = reverse || false;
  790.                 this._amount = 1;
  791.                 this.refresh();
  792.         }
  793.         Window_RecipeConfirm.prototype.isCursorMovable = function() {
  794.                 return this.isOpenAndActive() && craftMultiple && this._recipe._craftMultiple;
  795.         }
  796.         Window_RecipeConfirm.prototype.cursorDown = function(wrap) { this.changeAmount(-10);}
  797.         Window_RecipeConfirm.prototype.cursorUp = function(wrap) { this.changeAmount(10);}
  798.         Window_RecipeConfirm.prototype.cursorRight = function(wrap) { this.changeAmount(1);}
  799.         Window_RecipeConfirm.prototype.cursorLeft = function(wrap) { this.changeAmount(-1);}
  800.         Window_RecipeConfirm.prototype.changeAmount = function(value) {
  801.                 SoundManager.playCursor();
  802.                 this._amount += value;
  803.                 this._amount = Math.min(Math.max(this._amount,1),this._recipe.amountCraftable(this._reverse));
  804.                 this.refresh();
  805.         }
  806.         Window_RecipeConfirm.prototype.onTouch = function(triggered) {
  807.                 if (triggered && this.isTouchOkEnabled()) {
  808.                         this.processOk();
  809.                 }
  810.         };
  811.        
  812.         Scene_Crafting.prototype.initialize = function() {
  813.                 Scene_MenuBase.prototype.initialize.call(this);
  814.         }
  815.         Scene_Crafting.prototype.create = function() {
  816.                 Scene_MenuBase.prototype.create.call(this);
  817.                 this._helpWindow = new Window_Help();
  818.                 var width = Graphics.width / 2;
  819.                 var height = Graphics.height - this._helpWindow.height;
  820.                 this._listWindow = new Window_RecipeList(0,this._helpWindow.height+72,width,height-72*2);
  821.                 this._listWindow.setHandler('ok',this.listSuccess.bind(this));
  822.                 this._listWindow.setHandler('cancel',this.cancel.bind(this));
  823.                 if(!displayParam.clevel) { this._listWindow.height += this._listWindow.fittingHeight(1); }
  824.                 this._listWindow.createContents();
  825.                 this._detailWindow = new Window_RecipeDetail(width,this._listWindow.y,width,height-72*2);
  826.                 if(!displayParam.gold) { this._detailWindow.height += this._detailWindow.fittingHeight(1); }
  827.                 this._detailWindow.createContents();
  828.                 height = this._detailWindow.y + this._detailWindow.height;
  829.                 this._confirmWindow = new Window_RecipeConfirm(width,height,width,72);
  830.                 this._confirmWindow.setHandler('ok',this.craftSuccess.bind(this));
  831.                 this._confirmWindow.setHandler('cancel',this.confirmCancel.bind(this));
  832.                 if(displayParam.gold) {
  833.                         this._goldWindow = new Window_Gold();
  834.                         this._goldWindow.width = width;
  835.                         this._goldWindow.y = Graphics.height - 72;
  836.                         this._goldWindow.x = width;
  837.                 }
  838.                 this._popupWindow = new Window_RecPopup();
  839.                 this._popupWindow.setHandler('ok',this.popupOk.bind(this));
  840.                 this._popupWindow.setHandler('cancel',this.popupOk.bind(this));
  841.                 this._commandWindow = new Window_RecCategory();
  842.                 this._commandWindow.setHandler('ok',this.commandOk.bind(this));
  843.                 this._commandWindow.setHandler('cancel',this.commandCancel.bind(this));
  844.                 if(displayParam.clevel) {this._gaugeWindow = new Window_RecGauge();}
  845.                 this.addWindow(this._helpWindow);
  846.                 this.addWindow(this._listWindow);
  847.                 this.addWindow(this._detailWindow);
  848.                 this.addWindow(this._confirmWindow);
  849.                 if(this._goldWindow) {this.addWindow(this._goldWindow);}
  850.                 this.addWindow(this._popupWindow);
  851.                 this.addWindow(this._commandWindow);
  852.                 if(this._gaugeWindow) {this.addWindow(this._gaugeWindow);}
  853.         }
  854.         Scene_Crafting.prototype.popupOk = function() {
  855.                 this._popupWindow.deactivate();
  856.                 this._popupWindow.close();
  857.                 this._listWindow.activate();
  858.         }
  859.         Scene_Crafting.prototype.update = function() {
  860.                 Scene_Base.prototype.update.call(this);
  861.                 if(this._listWindow.currentItem()) {this._helpWindow.setText(this._listWindow.currentItem()._result._item.description);}
  862.                 if(this._commandWindow.isOpenAndActive()) {
  863.                         this._helpWindow.setText("");
  864.                 }
  865.                 this._detailWindow.setRecipe(this._listWindow.currentItem(),this._listWindow.isReverse());
  866.                 this._confirmWindow.setRecipe(this._listWindow.currentItem(),this._listWindow.isReverse());
  867.                 this._listWindow.setCategory(categoryNames[this._commandWindow._index]);
  868.                 if(this._gaugeWindow) { this._gaugeWindow.setCategory(categoryNames[this._commandWindow._index]);}
  869.                 if(this._listWindow.currentItem()) {
  870.                         if(this._listWindow.currentItem().craftable(this._listWindow.isReverse())) {
  871.                                 this._confirmWindow.opacity = 255;
  872.                                 this._confirmWindow.contentsOpacity = 255;
  873.                         } else {
  874.                                 this._confirmWindow.opacity = 75;
  875.                                 this._confirmWindow.contentsOpacity = 75;
  876.                         }
  877.                 }
  878.         }
  879.         Scene_Crafting.prototype.listSuccess = function() {
  880.                 this._listWindow.deactivate();
  881.                 if(this._goldWindow) {this._goldWindow.close();}
  882.                 this._confirmWindow.activate();
  883.         }
  884.         Scene_Crafting.prototype.craftSuccess = function() {
  885.                 var amount = 0;
  886.                 var items = [];
  887.                 for(var i = 0;i < this._confirmWindow._amount;i++) {
  888.                         Array.prototype.push.apply(items, this._listWindow.currentItem().craft(Math.random() * 100,this._listWindow.isReverse()));
  889.                 }
  890.                 if(items.length > 0) {
  891.                         this._popupWindow.setText(items, amount, this._listWindow.isReverse());
  892.                 } else {
  893.                         this._popupWindow.setTextFail(this._listWindow.isReverse());
  894.                 }
  895.                 this._confirmWindow.changeAmount(-1000);
  896.                 if(this._goldWindow) {this._goldWindow.refresh();}
  897.                 this._listWindow.resetRecipes();
  898.                 if(this._gaugeWindow) {this._gaugeWindow.refresh();}
  899.                 this._popupWindow.activate();
  900.                 this._detailWindow.refresh();
  901.         }
  902.         Scene_Crafting.prototype.confirmCancel = function() {
  903.                 this._confirmWindow.deactivate();
  904.                 if(this._goldWindow) {this._goldWindow.open();}
  905.                 this._listWindow.activate();
  906.         }
  907.         Scene_Crafting.prototype.commandCancel = function() {
  908.                 craftingFromMenu = false;
  909.                 this.popScene();
  910.         }
  911.         Scene_Crafting.prototype.cancel = function() {
  912.                 this._listWindow.select(-1);
  913.                 this._helpWindow.setText("");
  914.                 this._commandWindow.activate();
  915.         }
  916.         Scene_Crafting.prototype.commandOk = function() {
  917.                 this._listWindow.select(0);
  918.                 this._listWindow.activate();
  919.         }
  920.        
  921.         function Scene_CraftingSpecific() {
  922.                 this.initialize.apply(this, arguments);
  923.         }
  924.         Scene_CraftingSpecific.prototype = Object.create(Scene_Crafting.prototype);
  925.         Scene_CraftingSpecific.prototype.constructor = Scene_CraftingSpecific;
  926.         Scene_CraftingSpecific.prototype.initialize = function() {
  927.                 Scene_Crafting.prototype.initialize.call(this);
  928.         }
  929.         Scene_CraftingSpecific.prototype.create = function() {
  930.                 Scene_Crafting.prototype.create.call(this);
  931.                 this._commandWindow._index = categoryNames.indexOf(categoryEventName);
  932.                 this._commandWindow.deactivate();
  933.                 this._commandWindow.visible = false;
  934.                 this._listWindow.height += this._listWindow.fittingHeight(1);
  935.                 this._listWindow.y -= this._listWindow.fittingHeight(1);
  936.                 this._detailWindow.height += this._listWindow.fittingHeight(1);
  937.                 this._detailWindow.y -= this._listWindow.fittingHeight(1);
  938.                 this._listWindow.createContents();
  939.                 this._detailWindow.createContents();
  940.                 this._listWindow.select(0);
  941.                 this._listWindow.activate();
  942.         }
  943.         Scene_CraftingSpecific.prototype.cancel = function() { this.popScene(); }
  944.        
  945.        
  946.         function Window_RecCategory() {
  947.                 this.initialize.apply(this, arguments);
  948.         }
  949.         Window_RecCategory.prototype = Object.create(Window_HorzCommand.prototype);
  950.         Window_RecCategory.prototype.constructor = Window_RecCategory;
  951.         Window_RecCategory.prototype.initialize = function() {
  952.                 Window_HorzCommand.prototype.initialize.call(this, 0, this.fittingHeight(2));
  953.         }
  954.         Window_RecCategory.prototype.windowWidth = function() { return Graphics.width; }
  955.         Window_RecCategory.prototype.windowHeight = function() { return this.fittingHeight(1); }
  956.         Window_RecCategory.prototype.makeCommandList = function() {
  957.                 for(var i = 0;i < categoryNames.length;i++) {
  958.                         this.addCommand(categoryNames[i],categoryNames[i]);
  959.                 }
  960.         }
  961.         Window_RecCategory.prototype.itemWidth = function() {return this.width / 5;}
  962.         Window_RecCategory.prototype.drawItem = function(index) {
  963.                 this.changePaintOpacity(this.isCommandEnabled(index));
  964.                 var rect = this.itemRectForText(index);
  965.                 this.drawText(this.commandName(index),rect.x,rect.y,rect.width);
  966.                 this.drawIcon(categoryIcons[index],rect.x-Window_Base._iconWidth,rect.y+2);
  967.         }
  968.         Window_RecCategory.prototype.itemRectForText = function(index) {
  969.                 var rect = this.itemRect(index);
  970.                 rect.x += Window_Base._iconWidth;               
  971.                 rect.width -= Window_Base._iconWidth;
  972.                 return rect;
  973.         }
  974.        
  975.         function Window_RecPopup() {
  976.                 this.initialize.apply(this, arguments);
  977.         }
  978.         Window_RecPopup.prototype = Object.create(Window_Selectable.prototype);
  979.         Window_RecPopup.prototype.constructor = Window_RecPopup;
  980.         Window_RecPopup.prototype.initialize = function() {
  981.                 Window_Selectable.prototype.initialize.call(this, Graphics.width/2-this.windowWidth()/2,Graphics.height/2-this.windowHeight()/2,120,this.fittingHeight(1));
  982.                 this.openness = 0;
  983.                 this.deactivate();
  984.         }
  985.         Window_RecPopup.prototype.windowWidth = function() {return 120;}
  986.         Window_RecPopup.prototype.windowHeight = function() {return this.fittingHeight(1);}
  987.         Window_RecPopup.prototype.setText = function(results, amount, reverse) {
  988.                 this.contents.clear();
  989.                 AudioManager.playSe({name:success,volume:successVol,pitch:100,pan:0})
  990.                 var texts = [];
  991.                 var width = 0;
  992.                 var weapons = [];
  993.                 var armors = [];
  994.                 var items = [];
  995.                 for(var i = 0;i < results.length;i++) {
  996.                         var item = results[i];
  997.                         var container = item.type == "weapon" ? weapons : item.type == "armor" ? armors : items;
  998.                         if(!container[item._item.id]) { container[item._item.id] = [item._item,0]; }
  999.                         container[item._item.id][1] += item.returnAmount();
  1000.                 }
  1001.                 var containers = [weapons, armors, items];
  1002.                 for(var i = 0;i < containers.length;i++) {
  1003.                         for(var j = 0; j < containers[i].length;j++) {
  1004.                                 var item = containers[i][j];
  1005.                                 var widthNew = 0;
  1006.                                 if(item) {
  1007.                                         var string = String(item[1]) + "x " + item[0].name + " "
  1008.                                         string += reverse ? dismantledText : craftedText;
  1009.                                         texts.push([string,item[0].iconIndex]);
  1010.                                         widthNew = this.textWidth(string) + Window_Base._iconWidth;
  1011.                                         if(widthNew > width) { width = widthNew; }
  1012.                                 }
  1013.                         }
  1014.                 }
  1015.                 this.width = width + this.standardPadding() * 2;
  1016.                 this.height = this.fittingHeight(texts.length)
  1017.                 this.x = (Graphics.width-this.width)/2;
  1018.                 this.y = (Graphics.height-this.height)/2;
  1019.                 this.createContents();
  1020.                 for(var i = 0;i < texts.length;i++) {
  1021.                         this.drawText(texts[i][0],Window_Base._iconWidth,i*this.lineHeight(),this.contents.width);
  1022.                         this.drawIcon(texts[i][1],0,i*this.lineHeight());
  1023.                 }
  1024.                 this.open();
  1025.         }
  1026.         Window_RecPopup.prototype.setTextFail = function(reverse) {
  1027.                 this.contents.clear();
  1028.                 AudioManager.playSe({name:failure,volume:failureVol,pitch:100,pan:0})
  1029.                 var text = reverse ? dsmFailed : craFailed;
  1030.                 var width = this.textWidth(text);
  1031.                 this.width = width + this.standardPadding() * 2;
  1032.                 this.height = this.fittingHeight(1);
  1033.                 this.x = (Graphics.width-width)/2;
  1034.                 this.createContents();
  1035.                 this.drawText(text,0,0,this.contents.width);
  1036.                 this.open();
  1037.         }
  1038.         Window_RecPopup.prototype.processOk = function() {
  1039.                 if (this.isCurrentItemEnabled()) {
  1040.                         this.updateInputData();
  1041.                         this.deactivate();
  1042.                         this.callOkHandler();
  1043.                 } else {
  1044.                         this.playBuzzerSound();
  1045.                 }
  1046.         }
  1047.        
  1048.         function Window_RecGauge() {
  1049.                 this.initialize.apply(this, arguments);
  1050.         }
  1051.         Window_RecGauge.prototype = Object.create(Window_Base.prototype);
  1052.         Window_RecGauge.prototype.constructor = Window_RecGauge;
  1053.         Window_RecGauge.prototype.initialize = function() {
  1054.                 Window_Selectable.prototype.initialize.call(this, 0,Graphics.height-this.fittingHeight(1),Graphics.width/2,this.fittingHeight(1));
  1055.                 this._category = "all";
  1056.         }
  1057.         Window_RecGauge.prototype.refresh = function() {
  1058.                 this.contents.clear();
  1059.                 if(this._category == "all") {return;}
  1060.                 if(this._category == dismantleText) { return; }
  1061.                 this.drawIcon(categoryIcons[this.catIndex()],0,0);
  1062.                 this.drawText($gameParty.craftLevel(this.catIndex()),Window_Base._iconWidth,0,this.contents.width);
  1063.                 var rate = $gameParty.craftExp(this.catIndex()) / $gameParty.craftExpNext(this.catIndex());
  1064.                 if($gameParty.craftLevel(this.catIndex()) == UDML) {
  1065.                         this.changeTextColor(this.textColor(20));
  1066.                         this.drawText(MLT,0,0,this.contents.width,"right");
  1067.                         this.changeTextColor(this.normalColor());
  1068.                 } else {
  1069.                         this.drawGauge(96,-3,this.contents.width-96,rate,this.tpGaugeColor1(),this.tpGaugeColor2());
  1070.                         text = String($gameParty.craftExp(this.catIndex())) + "/" + String($gameParty.craftExpNext(this.catIndex()));
  1071.                         this.drawText(text,0,0,this.contents.width,"right");
  1072.                 }
  1073.         }
  1074.         Window_RecGauge.prototype.setCategory = function(cat) {
  1075.                 if(cat == this._category) {return;}
  1076.                 this._category = cat;
  1077.                 this.refresh();
  1078.         }
  1079.         Window_RecGauge.prototype.catIndex = function() {
  1080.                 return categoryNames.indexOf(this._category);
  1081.         }
  1082.        
  1083.         var crafting_window_menucommand_addoriginalcommands = Window_MenuCommand.prototype.addOriginalCommands;
  1084.         Window_MenuCommand.prototype.addOriginalCommands = function() {
  1085.                 crafting_window_menucommand_addoriginalcommands.call(this);
  1086.                 if(craftFromMenu != "off") { this.addCommand(craftingMenuString,"crafting"); }
  1087.         }
  1088.        
  1089.         var crafting_scene_menu_createcommandwindow = Scene_Menu.prototype.createCommandWindow;
  1090.         Scene_Menu.prototype.createCommandWindow = function() {
  1091.                 crafting_scene_menu_createcommandwindow.call(this);
  1092.                 this._commandWindow.setHandler("crafting",this.commandRecipe.bind(this));
  1093.         }
  1094.         Scene_Menu.prototype.commandRecipe = function() {
  1095.                 craftingFromMenu = true;
  1096.                 SceneManager.push(Scene_Crafting);
  1097.         }
  1098.        
  1099.         var RecipeCrafting_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  1100.         Game_Interpreter.prototype.pluginCommand = function(command, args) {
  1101.                 RecipeCrafting_Game_Interpreter_pluginCommand.call(this, command, args);
  1102.                 if(command === 'crafting') {
  1103.                         if(args[0] === 'call') {
  1104.                                 categoryEventName = args[1]
  1105.                                 if(categoryNames.indexOf(categoryEventName) >= 0) {
  1106.                                         SceneManager.push(Scene_CraftingSpecific);
  1107.                                 } else {
  1108.                                         throw new Error(TextManager.getErrorDetails() + "Incorrect category name");
  1109.                                 }
  1110.                         }
  1111.                         if(args[0] === 'learn') {
  1112.                                 $gameParty.learnRecipe(args[1]);
  1113.                         }
  1114.                         if(args[0] === 'forget') {
  1115.                                 $gameParty.forgetRecipe(args[1]);
  1116.                         }
  1117.                 }
  1118.         }
  1119.        
  1120.         var recipe_scene_load_onloadsuccess = Scene_Load.prototype.onLoadSuccess;
  1121.         Scene_Load.prototype.onLoadSuccess = function() {
  1122.                 recipe_scene_load_onloadsuccess.call(this);
  1123.                 $gameParty.checkRecipeVariables();
  1124.         };
  1125.                
  1126.         //YEP-ITEMCORE
  1127.         Game_Party.prototype.numIndependentItems = function(item) {
  1128.                 if(!item) return null;
  1129.                 if (DataManager.isIndependent(item)) {
  1130.                         if (DataManager.isItem(item)) var group = this.items();
  1131.                         if (DataManager.isWeapon(item)) var group = this.weapons();
  1132.                         if (DataManager.isArmor(item)) var group = this.armors();
  1133.                         var baseItemId = item.id;
  1134.                         var amount = 0;
  1135.                         for (var i = 0; i < group.length; ++i) {
  1136.                                 var item = group[i];
  1137.                                 if (!item) continue;
  1138.                                 if (!item.baseItemId) continue;
  1139.                                 if (item.baseItemId !== baseItemId) continue;
  1140.                                 if (this.checkItemIsEquipped(item)) continue;
  1141.                                 amount++;
  1142.                         }
  1143.                         return amount;
  1144.                 } else {
  1145.                         return this.numItems(item);
  1146.                 }
  1147.         }
  1148.        

  1149.        
  1150.        
  1151. })();
复制代码


使用了这个合成插件,但想在制定地方才能使用,制作事件通过插件命令呼出制作菜单,但主菜单的这个选项不知道该怎么取消,求大神赐教,感谢
梦石
0
星屑
647
在线时间
165 小时
注册时间
2012-4-18
回帖
237
发表于 2016-2-27 10:48:36 来自手机 | 显示全部楼层
在插件编辑器中把这个插件的 craftFromMenu这一条属性从 craft改成off
回复

使用道具 举报

梦石
0
星屑
647
在线时间
165 小时
注册时间
2012-4-18
回帖
237
发表于 2016-2-27 10:50:37 来自手机 | 显示全部楼层
输错了,是这一条: Menu Craft Options
回复

使用道具 举报

梦石
0
星屑
128
在线时间
109 小时
注册时间
2013-8-10
回帖
27
 楼主| 发表于 2016-2-27 11:27:04 | 显示全部楼层
salvareless 发表于 2016-2-27 10:50
输错了,是这一条: Menu Craft Options

感谢,已经可以了。
能请教你下,这个帖子的问题怎么处理呢。半身对话
回复

使用道具 举报

梦石
0
星屑
647
在线时间
165 小时
注册时间
2012-4-18
回帖
237
发表于 2016-2-27 11:34:38 来自手机 | 显示全部楼层
我看过你发的那个帖子,对于你说的那个插件,我也有没办法←_←不过,如果是我自己要用的话,可能我会去改window的消息函数里面关于显示脸图的函数,把这个函数显示的脸图的值调大一些,然后把做一套大号的脸图。反正对话时显示的脸图是直接指定的,和人物原来的脸图无关。不过具体就要看情况了,我用了fuki对话框,所以不需要这样的效果。如果楼主要做AVG式的对话,可能对这个效果的需求比较大吧。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部