查看: 2470|回复: 2

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

[复制链接]
梦石
0
星屑
33
在线时间
19 小时
注册时间
2022-11-21
回帖
13
发表于 2022-11-24 21:40:17 | 显示全部楼层 |阅读模式

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

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

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

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

恳请大佬们帮一帮忙,文字说明或者教学视频、示例啥的都可以,让我明白明白这东西咋用......
梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2022-11-24 22:15:44 | 显示全部楼层
没听说过rmmz有这样的插件,倒是在rmmv里找到了一个同名的官方插件。
用法也很简单,可以在事件中使用「插件指令」将还未获得的道具提前显示在图鉴里、或者将图鉴里的某项消除(变回未解锁的状态)、或者一键全解锁/清空。
即使不使用上述指令,游戏中也会自动将新获得的道具加入图鉴。不过它好像并不原生支持为道具添加额外的文字描述,而是依然用的数据库里的那两行字。
最下面可以看到「this.drawTextEx(item.description, x, y);」这一句,可以试着改成其他的文字(通过道具的note/meta属性或者通过外部json文件指定)。
  1. //=============================================================================
  2. // ItemBook.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc Displays detailed statuses of items.
  6. * @author Yoji Ojima
  7. *
  8. * @param Unknown Data
  9. * @desc The index name for an unknown item.
  10. * @default ??????
  11. *
  12. * @param Price Text
  13. * @desc The text for "Price".
  14. * @default Price
  15. *
  16. * @param Equip Text
  17. * @desc The text for "Equip".
  18. * @default Equip
  19. *
  20. * @param Type Text
  21. * @desc The text for "Type".
  22. * @default Type
  23. *
  24. * @help
  25. *
  26. * Plugin Command:
  27. *   ItemBook open            # Open the item book screen
  28. *   ItemBook add weapon 3    # Add weapon #3 to the item book
  29. *   ItemBook add armor 4     # Add armor #4 to the item book
  30. *   ItemBook remove armor 5  # Remove armor #5 from the item book
  31. *   ItemBook remove item 6   # Remove item #6 from the item book
  32. *   ItemBook complete        # Complete the item book
  33. *   ItemBook clear           # Clear the item book
  34. *
  35. * Item (Weapon, Armor) Note:
  36. *   <book:no>                # This item does not appear in the item book
  37. */

  38. /*:ja
  39. * @plugindesc アイテム図鑑です。アイテムの詳細なステータスを表示します。
  40. * @author Yoji Ojima
  41. *
  42. * @param Unknown Data
  43. * @desc 未確認のアイテムの索引名です。
  44. * @default ??????
  45. *
  46. * @param Price Text
  47. * @desc 「価格」の文字列です。
  48. * @default 価格
  49. *
  50. * @param Equip Text
  51. * @desc 「装備」の文字列です。
  52. * @default 装備
  53. *
  54. * @param Type Text
  55. * @desc 「タイプ」の文字列です。
  56. * @default タイプ
  57. *
  58. * @help
  59. *
  60. * プラグインコマンド:
  61. *   ItemBook open            # 図鑑画面を開く
  62. *   ItemBook add weapon 3    # 武器3番を図鑑に追加
  63. *   ItemBook add armor 4     # 防具4番を図鑑に追加
  64. *   ItemBook remove armor 5  # 防具5番を図鑑から削除
  65. *   ItemBook remove item 6   # アイテム6番を図鑑から削除
  66. *   ItemBook complete        # 図鑑を完成させる
  67. *   ItemBook clear           # 図鑑をクリアする
  68. *
  69. * アイテム(武器、防具)のメモ:
  70. *   <book:no>                # 図鑑に載せない場合
  71. */

  72. (function() {

  73.     var parameters = PluginManager.parameters('ItemBook');
  74.     var unknownData = String(parameters['Unknown Data'] || '??????');
  75.     var priceText = String(parameters['Price Text'] || 'Price');
  76.     var equipText = String(parameters['Equip Text'] || 'Equip');
  77.     var typeText = String(parameters['Type Text'] || 'Type');

  78.     var _Game_Interpreter_pluginCommand =
  79.             Game_Interpreter.prototype.pluginCommand;
  80.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  81.         _Game_Interpreter_pluginCommand.call(this, command, args);
  82.         if (command === 'ItemBook') {
  83.             switch (args[0]) {
  84.             case 'open':
  85.                 SceneManager.push(Scene_ItemBook);
  86.                 break;
  87.             case 'add':
  88.                 $gameSystem.addToItemBook(args[1], Number(args[2]));
  89.                 break;
  90.             case 'remove':
  91.                 $gameSystem.removeFromItemBook(args[1], Number(args[2]));
  92.                 break;
  93.             case 'complete':
  94.                 $gameSystem.completeItemBook();
  95.                 break;
  96.             case 'clear':
  97.                 $gameSystem.clearItemBook();
  98.                 break;
  99.             }
  100.         }
  101.     };

  102.     Game_System.prototype.addToItemBook = function(type, dataId) {
  103.         if (!this._ItemBookFlags) {
  104.             this.clearItemBook();
  105.         }
  106.         var typeIndex = this.itemBookTypeToIndex(type);
  107.         if (typeIndex >= 0) {
  108.             this._ItemBookFlags[typeIndex][dataId] = true;
  109.         }
  110.     };

  111.     Game_System.prototype.removeFromItemBook = function(type, dataId) {
  112.         if (this._ItemBookFlags) {
  113.             var typeIndex = this.itemBookTypeToIndex(type);
  114.             if (typeIndex >= 0) {
  115.                 this._ItemBookFlags[typeIndex][dataId] = false;
  116.             }
  117.         }
  118.     };

  119.     Game_System.prototype.itemBookTypeToIndex = function(type) {
  120.         switch (type) {
  121.         case 'item':
  122.             return 0;
  123.         case 'weapon':
  124.             return 1;
  125.         case 'armor':
  126.             return 2;
  127.         default:
  128.             return -1;
  129.         }
  130.     };

  131.     Game_System.prototype.completeItemBook = function() {
  132.         var i;
  133.         this.clearItemBook();
  134.         for (i = 1; i < $dataItems.length; i++) {
  135.             this._ItemBookFlags[0][i] = true;
  136.         }
  137.         for (i = 1; i < $dataWeapons.length; i++) {
  138.             this._ItemBookFlags[1][i] = true;
  139.         }
  140.         for (i = 1; i < $dataArmors.length; i++) {
  141.             this._ItemBookFlags[2][i] = true;
  142.         }
  143.     };

  144.     Game_System.prototype.clearItemBook = function() {
  145.         this._ItemBookFlags = [[], [], []];
  146.     };

  147.     Game_System.prototype.isInItemBook = function(item) {
  148.         if (this._ItemBookFlags && item) {
  149.             var typeIndex = -1;
  150.             if (DataManager.isItem(item)) {
  151.                 typeIndex = 0;
  152.             } else if (DataManager.isWeapon(item)) {
  153.                 typeIndex = 1;
  154.             } else if (DataManager.isArmor(item)) {
  155.                 typeIndex = 2;
  156.             }
  157.             if (typeIndex >= 0) {
  158.                 return !!this._ItemBookFlags[typeIndex][item.id];
  159.             } else {
  160.                 return false;
  161.             }
  162.         } else {
  163.             return false;
  164.         }
  165.     };

  166.     var _Game_Party_gainItem = Game_Party.prototype.gainItem;
  167.     Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
  168.         _Game_Party_gainItem.call(this, item, amount, includeEquip);
  169.         if (item && amount > 0) {
  170.             var type;
  171.             if (DataManager.isItem(item)) {
  172.                 type = 'item';
  173.             } else if (DataManager.isWeapon(item)) {
  174.                 type = 'weapon';
  175.             } else if (DataManager.isArmor(item)) {
  176.                 type = 'armor';
  177.             }
  178.             $gameSystem.addToItemBook(type, item.id);
  179.         }
  180.     };

  181.     function Scene_ItemBook() {
  182.         this.initialize.apply(this, arguments);
  183.     }

  184.     Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
  185.     Scene_ItemBook.prototype.constructor = Scene_ItemBook;

  186.     Scene_ItemBook.prototype.initialize = function() {
  187.         Scene_MenuBase.prototype.initialize.call(this);
  188.     };

  189.     Scene_ItemBook.prototype.create = function() {
  190.         Scene_MenuBase.prototype.create.call(this);
  191.         this._indexWindow = new Window_ItemBookIndex(0, 0);
  192.         this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  193.         var wy = this._indexWindow.height;
  194.         var ww = Graphics.boxWidth;
  195.         var wh = Graphics.boxHeight - wy;
  196.         this._statusWindow = new Window_ItemBookStatus(0, wy, ww, wh);
  197.         this.addWindow(this._indexWindow);
  198.         this.addWindow(this._statusWindow);
  199.         this._indexWindow.setStatusWindow(this._statusWindow);
  200.     };

  201.     function Window_ItemBookIndex() {
  202.         this.initialize.apply(this, arguments);
  203.     }

  204.     Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype);
  205.     Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;

  206.     Window_ItemBookIndex.lastTopRow = 0;
  207.     Window_ItemBookIndex.lastIndex  = 0;

  208.     Window_ItemBookIndex.prototype.initialize = function(x, y) {
  209.         var width = Graphics.boxWidth;
  210.         var height = this.fittingHeight(6);
  211.         Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  212.         this.refresh();
  213.         this.setTopRow(Window_ItemBookIndex.lastTopRow);
  214.         this.select(Window_ItemBookIndex.lastIndex);
  215.         this.activate();
  216.     };

  217.     Window_ItemBookIndex.prototype.maxCols = function() {
  218.         return 3;
  219.     };

  220.     Window_ItemBookIndex.prototype.maxItems = function() {
  221.         return this._list ? this._list.length : 0;
  222.     };

  223.     Window_ItemBookIndex.prototype.setStatusWindow = function(statusWindow) {
  224.         this._statusWindow = statusWindow;
  225.         this.updateStatus();
  226.     };

  227.     Window_ItemBookIndex.prototype.update = function() {
  228.         Window_Selectable.prototype.update.call(this);
  229.         this.updateStatus();
  230.     };

  231.     Window_ItemBookIndex.prototype.updateStatus = function() {
  232.         if (this._statusWindow) {
  233.             var item = this._list[this.index()];
  234.             this._statusWindow.setItem(item);
  235.         }
  236.     };

  237.     Window_ItemBookIndex.prototype.refresh = function() {
  238.         var i, item;
  239.         this._list = [];
  240.         for (i = 1; i < $dataItems.length; i++) {
  241.             item = $dataItems[i];
  242.             if (item.name && item.itypeId === 1 && item.meta.book !== 'no') {
  243.                 this._list.push(item);
  244.             }
  245.         }
  246.         for (i = 1; i < $dataWeapons.length; i++) {
  247.             item = $dataWeapons[i];
  248.             if (item.name && item.meta.book !== 'no') {
  249.                 this._list.push(item);
  250.             }
  251.         }
  252.         for (i = 1; i < $dataArmors.length; i++) {
  253.             item = $dataArmors[i];
  254.             if (item.name && item.meta.book !== 'no') {
  255.                 this._list.push(item);
  256.             }
  257.         }
  258.         this.createContents();
  259.         this.drawAllItems();
  260.     };

  261.     Window_ItemBookIndex.prototype.drawItem = function(index) {
  262.         var item = this._list[index];
  263.         var rect = this.itemRect(index);
  264.         var width = rect.width - this.textPadding();
  265.         if ($gameSystem.isInItemBook(item)) {
  266.             this.drawItemName(item, rect.x, rect.y, width);
  267.         } else {
  268.             var iw = Window_Base._iconWidth + 4;
  269.             this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
  270.         }
  271.     };

  272.     Window_ItemBookIndex.prototype.processCancel = function() {
  273.         Window_Selectable.prototype.processCancel.call(this);
  274.         Window_ItemBookIndex.lastTopRow = this.topRow();
  275.         Window_ItemBookIndex.lastIndex = this.index();
  276.     };

  277.     function Window_ItemBookStatus() {
  278.         this.initialize.apply(this, arguments);
  279.     }

  280.     Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
  281.     Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;

  282.     Window_ItemBookStatus.prototype.initialize = function(x, y, width, height) {
  283.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  284.     };

  285.     Window_ItemBookStatus.prototype.setItem = function(item) {
  286.         if (this._item !== item) {
  287.             this._item = item;
  288.             this.refresh();
  289.         }
  290.     };

  291.     Window_ItemBookStatus.prototype.refresh = function() {
  292.         var item = this._item;
  293.         var x = 0;
  294.         var y = 0;
  295.         var lineHeight = this.lineHeight();

  296.         this.contents.clear();

  297.         if (!item || !$gameSystem.isInItemBook(item)) {
  298.             return;
  299.         }

  300.         this.drawItemName(item, x, y);

  301.         x = this.textPadding();
  302.         y = lineHeight + this.textPadding();

  303.         var price = item.price > 0 ? item.price : '-';
  304.         this.changeTextColor(this.systemColor());
  305.         this.drawText(priceText, x, y, 120);
  306.         this.resetTextColor();
  307.         this.drawText(price, x + 120, y, 120, 'right');
  308.         y += lineHeight;

  309.         if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
  310.             var etype = $dataSystem.equipTypes[item.etypeId];
  311.             this.changeTextColor(this.systemColor());
  312.             this.drawText(equipText, x, y, 120);
  313.             this.resetTextColor();
  314.             this.drawText(etype, x + 120, y, 120, 'right');
  315.             y += lineHeight;

  316.             var type;
  317.             if (DataManager.isWeapon(item)) {
  318.                 type = $dataSystem.weaponTypes[item.wtypeId];
  319.             } else {
  320.                 type = $dataSystem.armorTypes[item.atypeId];
  321.             }
  322.             this.changeTextColor(this.systemColor());
  323.             this.drawText(typeText, x, y, 120);
  324.             this.resetTextColor();
  325.             this.drawText(type, x + 120, y, 120, 'right');

  326.             x = this.textPadding() + 300;
  327.             y = lineHeight + this.textPadding();
  328.             for (var i = 2; i < 8; i++) {
  329.                 this.changeTextColor(this.systemColor());
  330.                 this.drawText(TextManager.param(i), x, y, 160);
  331.                 this.resetTextColor();
  332.                 this.drawText(item.params[i], x + 160, y, 60, 'right');
  333.                 y += lineHeight;
  334.             }
  335.         }

  336.         x = 0;
  337.         y = this.textPadding() * 2 + lineHeight * 7;
  338.         this.drawTextEx(item.description, x, y);
  339.     };

  340. })();
复制代码
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
发表于 2022-11-24 22:31:16 | 显示全部楼层
本帖最后由 dabaxhei 于 2022-11-24 23:28 编辑

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

NUUN_ItemBook.rar

15.47 KB, 下载次数: 13

回复 2 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部