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

Project1

 找回密码
 注册会员
搜索
查看: 1263|回复: 2
打印 上一主题 下一主题

[有事请教] 关于NUUN的Item_Book插件

[复制链接]

Lv1.梦旅人

梦石
0
星屑
33
在线时间
19 小时
注册时间
2022-11-21
帖子
25
跳转到指定楼层
1
发表于 2022-11-24 21:40:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这是一个物品图鉴插件,我把说明翻译了一遍,看懂了它的功能,就是在菜单里提供一个物品说明的选项,在里面可以查看物品信息。

但是萌新完全不会用啊 不知道在哪编辑文字

恳请大佬们帮一帮忙,文字说明或者教学视频、示例啥的都可以,让我明白明白这东西咋用......

Lv4.逐梦者

梦石
0
星屑
5537
在线时间
404 小时
注册时间
2021-12-4
帖子
431
2
发表于 2022-11-24 22:15:44 | 只看该作者
没听说过rmmz有这样的插件,倒是在rmmv里找到了一个同名的官方插件。
用法也很简单,可以在事件中使用「插件指令」将还未获得的道具提前显示在图鉴里、或者将图鉴里的某项消除(变回未解锁的状态)、或者一键全解锁/清空。
即使不使用上述指令,游戏中也会自动将新获得的道具加入图鉴。不过它好像并不原生支持为道具添加额外的文字描述,而是依然用的数据库里的那两行字。
最下面可以看到「this.drawTextEx(item.description, x, y);」这一句,可以试着改成其他的文字(通过道具的note/meta属性或者通过外部json文件指定)。
JS 代码复制下载
  1. //=============================================================================
  2. // ItemBook.js
  3. //=============================================================================
  4.  
  5. /*:
  6. * @plugindesc Displays detailed statuses of items.
  7. * @author Yoji Ojima
  8. *
  9. * @param Unknown Data
  10. * @desc The index name for an unknown item.
  11. * @default ??????
  12. *
  13. * @param Price Text
  14. * @desc The text for "Price".
  15. * @default Price
  16. *
  17. * @param Equip Text
  18. * @desc The text for "Equip".
  19. * @default Equip
  20. *
  21. * @param Type Text
  22. * @desc The text for "Type".
  23. * @default Type
  24. *
  25. * @help
  26. *
  27. * Plugin Command:
  28. *   ItemBook open            # Open the item book screen
  29. *   ItemBook add weapon 3    # Add weapon #3 to the item book
  30. *   ItemBook add armor 4     # Add armor #4 to the item book
  31. *   ItemBook remove armor 5  # Remove armor #5 from the item book
  32. *   ItemBook remove item 6   # Remove item #6 from the item book
  33. *   ItemBook complete        # Complete the item book
  34. *   ItemBook clear           # Clear the item book
  35. *
  36. * Item (Weapon, Armor) Note:
  37. *   <book:no>                # This item does not appear in the item book
  38. */
  39.  
  40. /*:ja
  41. * @plugindesc アイテム図鑑です。アイテムの詳細なステータスを表示します。
  42. * @author Yoji Ojima
  43. *
  44. * @param Unknown Data
  45. * @desc 未確認のアイテムの索引名です。
  46. * @default ??????
  47. *
  48. * @param Price Text
  49. * @desc 「価格」の文字列です。
  50. * @default 価格
  51. *
  52. * @param Equip Text
  53. * @desc 「装備」の文字列です。
  54. * @default 装備
  55. *
  56. * @param Type Text
  57. * @desc 「タイプ」の文字列です。
  58. * @default タイプ
  59. *
  60. * @help
  61. *
  62. * プラグインコマンド:
  63. *   ItemBook open            # 図鑑画面を開く
  64. *   ItemBook add weapon 3    # 武器3番を図鑑に追加
  65. *   ItemBook add armor 4     # 防具4番を図鑑に追加
  66. *   ItemBook remove armor 5  # 防具5番を図鑑から削除
  67. *   ItemBook remove item 6   # アイテム6番を図鑑から削除
  68. *   ItemBook complete        # 図鑑を完成させる
  69. *   ItemBook clear           # 図鑑をクリアする
  70. *
  71. * アイテム(武器、防具)のメモ:
  72. *   <book:no>                # 図鑑に載せない場合
  73. */
  74.  
  75. (function() {
  76.  
  77.     var parameters = PluginManager.parameters('ItemBook');
  78.     var unknownData = String(parameters['Unknown Data'] || '??????');
  79.     var priceText = String(parameters['Price Text'] || 'Price');
  80.     var equipText = String(parameters['Equip Text'] || 'Equip');
  81.     var typeText = String(parameters['Type Text'] || 'Type');
  82.  
  83.     var _Game_Interpreter_pluginCommand =
  84.             Game_Interpreter.prototype.pluginCommand;
  85.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  86.         _Game_Interpreter_pluginCommand.call(this, command, args);
  87.         if (command === 'ItemBook') {
  88.             switch (args[0]) {
  89.             case 'open':
  90.                 SceneManager.push(Scene_ItemBook);
  91.                 break;
  92.             case 'add':
  93.                 $gameSystem.addToItemBook(args[1], Number(args[2]));
  94.                 break;
  95.             case 'remove':
  96.                 $gameSystem.removeFromItemBook(args[1], Number(args[2]));
  97.                 break;
  98.             case 'complete':
  99.                 $gameSystem.completeItemBook();
  100.                 break;
  101.             case 'clear':
  102.                 $gameSystem.clearItemBook();
  103.                 break;
  104.             }
  105.         }
  106.     };
  107.  
  108.     Game_System.prototype.addToItemBook = function(type, dataId) {
  109.         if (!this._ItemBookFlags) {
  110.             this.clearItemBook();
  111.         }
  112.         var typeIndex = this.itemBookTypeToIndex(type);
  113.         if (typeIndex >= 0) {
  114.             this._ItemBookFlags[typeIndex][dataId] = true;
  115.         }
  116.     };
  117.  
  118.     Game_System.prototype.removeFromItemBook = function(type, dataId) {
  119.         if (this._ItemBookFlags) {
  120.             var typeIndex = this.itemBookTypeToIndex(type);
  121.             if (typeIndex >= 0) {
  122.                 this._ItemBookFlags[typeIndex][dataId] = false;
  123.             }
  124.         }
  125.     };
  126.  
  127.     Game_System.prototype.itemBookTypeToIndex = function(type) {
  128.         switch (type) {
  129.         case 'item':
  130.             return 0;
  131.         case 'weapon':
  132.             return 1;
  133.         case 'armor':
  134.             return 2;
  135.         default:
  136.             return -1;
  137.         }
  138.     };
  139.  
  140.     Game_System.prototype.completeItemBook = function() {
  141.         var i;
  142.         this.clearItemBook();
  143.         for (i = 1; i < $dataItems.length; i++) {
  144.             this._ItemBookFlags[0][i] = true;
  145.         }
  146.         for (i = 1; i < $dataWeapons.length; i++) {
  147.             this._ItemBookFlags[1][i] = true;
  148.         }
  149.         for (i = 1; i < $dataArmors.length; i++) {
  150.             this._ItemBookFlags[2][i] = true;
  151.         }
  152.     };
  153.  
  154.     Game_System.prototype.clearItemBook = function() {
  155.         this._ItemBookFlags = [[], [], []];
  156.     };
  157.  
  158.     Game_System.prototype.isInItemBook = function(item) {
  159.         if (this._ItemBookFlags && item) {
  160.             var typeIndex = -1;
  161.             if (DataManager.isItem(item)) {
  162.                 typeIndex = 0;
  163.             } else if (DataManager.isWeapon(item)) {
  164.                 typeIndex = 1;
  165.             } else if (DataManager.isArmor(item)) {
  166.                 typeIndex = 2;
  167.             }
  168.             if (typeIndex >= 0) {
  169.                 return !!this._ItemBookFlags[typeIndex][item.id];
  170.             } else {
  171.                 return false;
  172.             }
  173.         } else {
  174.             return false;
  175.         }
  176.     };
  177.  
  178.     var _Game_Party_gainItem = Game_Party.prototype.gainItem;
  179.     Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
  180.         _Game_Party_gainItem.call(this, item, amount, includeEquip);
  181.         if (item && amount > 0) {
  182.             var type;
  183.             if (DataManager.isItem(item)) {
  184.                 type = 'item';
  185.             } else if (DataManager.isWeapon(item)) {
  186.                 type = 'weapon';
  187.             } else if (DataManager.isArmor(item)) {
  188.                 type = 'armor';
  189.             }
  190.             $gameSystem.addToItemBook(type, item.id);
  191.         }
  192.     };
  193.  
  194.     function Scene_ItemBook() {
  195.         this.initialize.apply(this, arguments);
  196.     }
  197.  
  198.     Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
  199.     Scene_ItemBook.prototype.constructor = Scene_ItemBook;
  200.  
  201.     Scene_ItemBook.prototype.initialize = function() {
  202.         Scene_MenuBase.prototype.initialize.call(this);
  203.     };
  204.  
  205.     Scene_ItemBook.prototype.create = function() {
  206.         Scene_MenuBase.prototype.create.call(this);
  207.         this._indexWindow = new Window_ItemBookIndex(0, 0);
  208.         this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  209.         var wy = this._indexWindow.height;
  210.         var ww = Graphics.boxWidth;
  211.         var wh = Graphics.boxHeight - wy;
  212.         this._statusWindow = new Window_ItemBookStatus(0, wy, ww, wh);
  213.         this.addWindow(this._indexWindow);
  214.         this.addWindow(this._statusWindow);
  215.         this._indexWindow.setStatusWindow(this._statusWindow);
  216.     };
  217.  
  218.     function Window_ItemBookIndex() {
  219.         this.initialize.apply(this, arguments);
  220.     }
  221.  
  222.     Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype);
  223.     Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;
  224.  
  225.     Window_ItemBookIndex.lastTopRow = 0;
  226.     Window_ItemBookIndex.lastIndex  = 0;
  227.  
  228.     Window_ItemBookIndex.prototype.initialize = function(x, y) {
  229.         var width = Graphics.boxWidth;
  230.         var height = this.fittingHeight(6);
  231.         Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  232.         this.refresh();
  233.         this.setTopRow(Window_ItemBookIndex.lastTopRow);
  234.         this.select(Window_ItemBookIndex.lastIndex);
  235.         this.activate();
  236.     };
  237.  
  238.     Window_ItemBookIndex.prototype.maxCols = function() {
  239.         return 3;
  240.     };
  241.  
  242.     Window_ItemBookIndex.prototype.maxItems = function() {
  243.         return this._list ? this._list.length : 0;
  244.     };
  245.  
  246.     Window_ItemBookIndex.prototype.setStatusWindow = function(statusWindow) {
  247.         this._statusWindow = statusWindow;
  248.         this.updateStatus();
  249.     };
  250.  
  251.     Window_ItemBookIndex.prototype.update = function() {
  252.         Window_Selectable.prototype.update.call(this);
  253.         this.updateStatus();
  254.     };
  255.  
  256.     Window_ItemBookIndex.prototype.updateStatus = function() {
  257.         if (this._statusWindow) {
  258.             var item = this._list[this.index()];
  259.             this._statusWindow.setItem(item);
  260.         }
  261.     };
  262.  
  263.     Window_ItemBookIndex.prototype.refresh = function() {
  264.         var i, item;
  265.         this._list = [];
  266.         for (i = 1; i < $dataItems.length; i++) {
  267.             item = $dataItems[i];
  268.             if (item.name && item.itypeId === 1 && item.meta.book !== 'no') {
  269.                 this._list.push(item);
  270.             }
  271.         }
  272.         for (i = 1; i < $dataWeapons.length; i++) {
  273.             item = $dataWeapons[i];
  274.             if (item.name && item.meta.book !== 'no') {
  275.                 this._list.push(item);
  276.             }
  277.         }
  278.         for (i = 1; i < $dataArmors.length; i++) {
  279.             item = $dataArmors[i];
  280.             if (item.name && item.meta.book !== 'no') {
  281.                 this._list.push(item);
  282.             }
  283.         }
  284.         this.createContents();
  285.         this.drawAllItems();
  286.     };
  287.  
  288.     Window_ItemBookIndex.prototype.drawItem = function(index) {
  289.         var item = this._list[index];
  290.         var rect = this.itemRect(index);
  291.         var width = rect.width - this.textPadding();
  292.         if ($gameSystem.isInItemBook(item)) {
  293.             this.drawItemName(item, rect.x, rect.y, width);
  294.         } else {
  295.             var iw = Window_Base._iconWidth + 4;
  296.             this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
  297.         }
  298.     };
  299.  
  300.     Window_ItemBookIndex.prototype.processCancel = function() {
  301.         Window_Selectable.prototype.processCancel.call(this);
  302.         Window_ItemBookIndex.lastTopRow = this.topRow();
  303.         Window_ItemBookIndex.lastIndex = this.index();
  304.     };
  305.  
  306.     function Window_ItemBookStatus() {
  307.         this.initialize.apply(this, arguments);
  308.     }
  309.  
  310.     Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
  311.     Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;
  312.  
  313.     Window_ItemBookStatus.prototype.initialize = function(x, y, width, height) {
  314.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  315.     };
  316.  
  317.     Window_ItemBookStatus.prototype.setItem = function(item) {
  318.         if (this._item !== item) {
  319.             this._item = item;
  320.             this.refresh();
  321.         }
  322.     };
  323.  
  324.     Window_ItemBookStatus.prototype.refresh = function() {
  325.         var item = this._item;
  326.         var x = 0;
  327.         var y = 0;
  328.         var lineHeight = this.lineHeight();
  329.  
  330.         this.contents.clear();
  331.  
  332.         if (!item || !$gameSystem.isInItemBook(item)) {
  333.             return;
  334.         }
  335.  
  336.         this.drawItemName(item, x, y);
  337.  
  338.         x = this.textPadding();
  339.         y = lineHeight + this.textPadding();
  340.  
  341.         var price = item.price > 0 ? item.price : '-';
  342.         this.changeTextColor(this.systemColor());
  343.         this.drawText(priceText, x, y, 120);
  344.         this.resetTextColor();
  345.         this.drawText(price, x + 120, y, 120, 'right');
  346.         y += lineHeight;
  347.  
  348.         if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
  349.             var etype = $dataSystem.equipTypes[item.etypeId];
  350.             this.changeTextColor(this.systemColor());
  351.             this.drawText(equipText, x, y, 120);
  352.             this.resetTextColor();
  353.             this.drawText(etype, x + 120, y, 120, 'right');
  354.             y += lineHeight;
  355.  
  356.             var type;
  357.             if (DataManager.isWeapon(item)) {
  358.                 type = $dataSystem.weaponTypes[item.wtypeId];
  359.             } else {
  360.                 type = $dataSystem.armorTypes[item.atypeId];
  361.             }
  362.             this.changeTextColor(this.systemColor());
  363.             this.drawText(typeText, x, y, 120);
  364.             this.resetTextColor();
  365.             this.drawText(type, x + 120, y, 120, 'right');
  366.  
  367.             x = this.textPadding() + 300;
  368.             y = lineHeight + this.textPadding();
  369.             for (var i = 2; i < 8; i++) {
  370.                 this.changeTextColor(this.systemColor());
  371.                 this.drawText(TextManager.param(i), x, y, 160);
  372.                 this.resetTextColor();
  373.                 this.drawText(item.params[i], x + 160, y, 60, 'right');
  374.                 y += lineHeight;
  375.             }
  376.         }
  377.  
  378.         x = 0;
  379.         y = this.textPadding() * 2 + lineHeight * 7;
  380.         this.drawTextEx(item.description, x, y);
  381.     };
  382.  
  383. })();
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3066
在线时间
235 小时
注册时间
2021-4-22
帖子
217
3
发表于 2022-11-24 22:31:16 | 只看该作者
本帖最后由 dabaxhei 于 2022-11-24 23:28 编辑

不用编辑,直接扩充好你资料库的装备项目就行。
帮你机翻汉化了下,大部分应该都能看懂了,这个插件不需要设置什么东西

NUUN_ItemBook.rar

15.47 KB, 下载次数: 11

回复 支持 2 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-12 01:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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