设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
123
返回列表 发新帖
楼主: id400200
打印 上一主题 下一主题

[已经解决] 新人- -搬运一个合成插件,求测试并指导使用方法。

[复制链接]

Lv4.逐梦者

世界坑化协会

梦石
0
星屑
7640
在线时间
1554 小时
注册时间
2007-3-13
帖子
5541

极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

21
发表于 2015-12-2 09:59:47 | 只看该作者
id400200 发表于 2015-12-2 09:17
不- -这个道具只是用来提供让你设置的地方,其实不用出现在你的游戏世界里面的。当你需要用到这个5号配方 ...

不行吧?配方不带在身上不起作用啊
而且,我试了下,出现不能读取未定义的配方的错误……
你的肩膀上有肩周炎~♪  秒懂  ☚   \没有
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
130 小时
注册时间
2015-8-7
帖子
31
22
 楼主| 发表于 2015-12-2 12:14:30 | 只看该作者
v2sam 发表于 2015-12-2 09:59
不行吧?配方不带在身上不起作用啊
而且,我试了下,出现不能读取未定义的配方的错误…… ...

哎?是这样子么??
- -等我晚上下班回去试一下。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
130 小时
注册时间
2015-8-7
帖子
31
23
 楼主| 发表于 2015-12-3 09:05:41 | 只看该作者
v2sam 发表于 2015-12-2 09:59
不行吧?配方不带在身上不起作用啊
而且,我试了下,出现不能读取未定义的配方的错误…… ...

- -呃,昨晚试了一下...没带配方书的话,打开配方,显示是空的。。。
只好,把配方书设置成隐藏物品了...这可以是一个暂时的解决方法。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
327 小时
注册时间
2011-9-29
帖子
315
24
发表于 2016-2-24 00:58:34 | 只看该作者
楼主已经弄好了吗?请问具体是怎么设置的
按照4楼的设置是空白,不知道哪里有问题
能不能把你设置截图传上来看看,感谢
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
637
在线时间
164 小时
注册时间
2012-4-18
帖子
264
25
发表于 2016-2-24 13:45:43 | 只看该作者
本帖最后由 salvareless 于 2016-2-24 14:01 编辑

额。实在不行,大家就换一个吧,我找到一个,我也不知道是在哪儿找到的,使用方法比较简单,而且和YEP_ItemCore没有冲突。以下是使用方法:
1·首先在文件夹(Project1\data)里面新建一个Recipes.txt文件,用文本编辑器打开,在里面写配方书,记住最好用UTF-8格式写。
2·配方书书写方式如下: * 合成公式完全范例
*   <recipe1>  //例子:recipe后面紧跟数字,为配方ID,这个ID是唯一的,不受制作类型影响
*    result:{type:"armor", id:3, amount:1}        //定义生成物品:type:"armor(护甲)/weapon(武器)/item(道具)", id:(物品对应id), amount:(一次制造的数量)
*    <materials>
*    {type:"weapon", id:3, amount:3, cons:false}        //定义消耗的物品:其他同上,cons:true(消耗掉)/false(不消耗)
*    {type:"armor", id:2, amount:3, cons:false}
*          <materials>
*          category:锻造           //定义配方的类别 这条一下不能不写,中文字对应脚本230行中设定的制作类型
*          goldCost:10             //金币消耗
*          success:80                //成功率
*          level:1                        //需要人物等级
*          xp:10                        //获得的生活职业经验
*          craftLevel:1                //需要的生活职业技能等级
*          pxp:5                        //获得的人物经验
*        <recipe1>
3·在游戏中使用插件命令来学习配方:crafting learn 1
4·在查建中可以设置多种不同的制作技能类型,但是ID却不能重复使用,也就是说,配方ID是不能区分制作技能的。
5·插件我自己有一些修改,扩大了最上方的详情栏,道具详情可以显示4行文字,每行77个字符。因为在数据库中输入时只能输入两行,所以建议比较长的说明文字,最好加上自动换行插件。这样77字符的时候就会自动换行了。
6·这个插件正文中我屏蔽了在主菜单中增加制造命令的调用方式,大家要用的话,恢复1086-1092行的屏蔽即可。
7·这个插件我自己调试了比较长的时间,如果有问题,可以问我。

以下是代码:
  1. //==
  2. // Recipe Crafting MV Version 1.3b
  3. // 由Salvareless根据自用需要重新编辑完毕
  4. //==

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

  217. var $gameRecipes = null;

  218. function Scene_Crafting() {
  219.                 this.initialize.apply(this, arguments);
  220.         }
  221. Scene_Crafting.prototype = Object.create(Scene_MenuBase.prototype);
  222. Scene_Crafting.prototype.constructor = Scene_Crafting;

  223. (function() {

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

  1147.        
  1148.        
  1149. })();
复制代码
以下是Recipes.txt 文件的样板:
<recipe1>  
result:{type:"armor", id:1, amount:1}
<materials>
{type:"item", id:1, amount:1, cons:true}
{type:"item", id:2, amount:1, cons:true}
{type:"item", id:3, amount:1, cons:true}
{type:"item", id:4, amount:1, cons:true}
{type:"item", id:5, amount:1, cons:true}
<materials>
category:装备
goldCost:10
success:80
level:1
xp:10
craftLevel:1
pxp:5
<recipe1>

这个样板的意思是:
{
配方ID:1
生成物品:物品类别:装甲,ID:1,数量:1
消耗物品
道具类型,ID:1,数量:1,是否消耗掉:是
道具类型,ID:2,数量:1,是否消耗掉:是
道具类型,ID:3,数量:1,是否消耗掉:是
道具类型,ID:4,数量:1,是否消耗掉:是
道具类型,ID:5,数量:1,是否消耗掉:是
就要这些东西
制作类别:装备
消耗金币:10
成功率:80%
需要人物等级:1
获得对应的制作技能熟练度:10
需要对应的制作技能等级:1
获得任务经验:5
配方ID:1就这么些内容
}

点评

把脚本1086行前面的/*删掉,1091行前面的*/删掉,就能取消屏蔽,这样就能在主菜单中增加一个叫做制作的命令,进入后能够看到所有制作种类。  发表于 2016-2-24 23:11
对,没取消屏蔽。具体怎么命令 -0  发表于 2016-2-24 22:34
已经换成了Blacksmith,还是错误。合成界面怎么打开的。。。  发表于 2016-2-24 21:24
看26楼,新建了个工程,一样错误  发表于 2016-2-24 19:57
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
327 小时
注册时间
2011-9-29
帖子
315
26
发表于 2016-2-24 18:29:26 | 只看该作者
本帖最后由 summer依恋 于 2016-2-24 20:42 编辑
salvareless 发表于 2016-2-24 13:45
额。实在不行,大家就换一个吧,我找到一个,我也不知道是在哪儿找到的,使用方法比较简单,而且和YEP_Item ...


感谢大大的支援,请问这是怎么回事


新建了个工程,一样错误


这是我的设置

点评

还有= =Recipes.txt里面你也得改一改,这里,呼出语句,脚本230里的设定,三者需要一致才行。而且要用UTF-8编码格式(如果是中文)  发表于 2016-2-24 22:46
另外说明一下,我修改过脚本,所以请无视默认情况,我基本上都改了, 只是怕将来出问题,留着没删而已,插件管理器里面也无需设置,设置了没用  发表于 2016-2-24 22:43
并不是= =你这里是插件指令错误,crafting call Alcheny,这句错了,你应该也没有取消我原始脚本的屏蔽,依旧用插件命令调用制作界面,那这里必须用中文  发表于 2016-2-24 22:30
这个插件默认的category是"Alchemy","Blacksmith","Tailor"  发表于 2016-2-24 21:13
你的Recipes.txt里面,category用了中文的装备,这个不行的,你得参照插件说明用对应的英文表示  发表于 2016-2-24 21:11
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
637
在线时间
164 小时
注册时间
2012-4-18
帖子
264
27
发表于 2016-2-24 22:39:56 | 只看该作者
本帖最后由 salvareless 于 2016-2-24 23:12 编辑

回复楼上
如我在上一楼的点评,呼出制作界面的插件指令错误了。
首先,js是支持中文变量名的,所以这样命名没有什么问题,而且必须这样命名才能在打开所有制作界面的时候,对应每种制作类型显示的都是中文。
其次,我修改过脚本,不存在输入中文会导致错误的问题。
最后,正确的呼出语句是"crafting call 装备",注意,要呼出什么类型的制作界面,直接替换‘装备’二字。在我贴的脚本第230,可以按照格式随意增加制作类别的种类,只要你的呼出语句和制作类别使用的词是一样的,就行了。




你的配方文件里的类别,呼出语句里的类别,和脚本230行定义的类别必须三者统一。
还有,配方文件里面除了的标点符号都必须是英文状态下的,我刚才看截图好像是中文的(逗号,)而不是英文的(逗号,)这也是会报错的,你最好看看,不知道是不是我屏幕的问题。而中文则要用文本编辑器先把文件转成UTF-8,再写如中文,直接用txt写字本打开写也许会报错,但我不确定是不是这个原因。推荐你个工具吧:Notepad++

点评

原来刚才钱不够 - - 麻烦再看下28楼  发表于 2016-2-24 23:15
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
327 小时
注册时间
2011-9-29
帖子
315
28
发表于 2016-2-24 23:11:28 | 只看该作者
本帖最后由 summer依恋 于 2016-2-24 23:19 编辑
salvareless 发表于 2016-2-24 22:39
回复楼上
如我在上一楼的点评,呼出制作界面的插件指令错误了。
首先,js是支持中文变量名的,所以这样命名 ...


感谢大大的耐心回复,界面终于出来了,但新问题又来了,,,(Recipes文件是我直接复制你的,再修改数据来的)
crafting learn 1指令有什么用呢,,,貌似没感觉有什么用,没使用crafting learn 1指令,直接就能合成了 - -
有个疑问,要合成某装备。比如剑,那么必须先在数据库里设置一把剑(会显示在道具里),既然都有1把了,再合成有什么意思
或者说应该要隐藏剑,没合成前不显示,合成成功后才出现在道具里面

点评

这个功能你到了哪里都无法实现啊,怎么可能数据库里没有的东西= =,除非你使用YEP_ItemCore,然后专门把那个要合成的道具的随机属性范围调到极高  发表于 2016-2-24 23:31
其实我新开工程的时候也发现了这个问题,你等我开工程测试一下看看  发表于 2016-2-24 23:13
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
637
在线时间
164 小时
注册时间
2012-4-18
帖子
264
29
发表于 2016-2-24 23:26:20 | 只看该作者
本帖最后由 salvareless 于 2016-2-24 23:27 编辑

回复楼上,是我的成品系统有一些奇异的BUG的问题,我是默认不会自动学会任何配方的,而新工程的话是默认不标注就天生会某个配方,
你在配方中加入一行这个,加在category:装备这行下面:known:false   然后就不会天生会某个配方了,一些都要靠插件学习,
至于你为什么不能制作,我看截图,目测是= =没……没钱了吧= =
另外,你把脚本1086行前面的/*删掉,1091行前面的*/删掉,就能取消屏蔽,这样就能在主菜单中看到一个叫做制作的命令,进入后能够进行所有制作种类的操作。

点评

嗯,晚安  发表于 2016-2-25 00:03
都解决了,是我白了一下,原来在宝箱里加入了武器 - - 这贴收藏了,以后有问题再来看。。。。  发表于 2016-2-24 23:37
碎觉了,问题都积累着吧,明天来回复~~~~~~  发表于 2016-2-24 23:32
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 14:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表