Project1

标题: 赏金名单具体使用 [打印本页]

作者: j296196585    时间: 2020-11-14 23:48
标题: 赏金名单具体使用
本帖最后由 j296196585 于 2020-11-14 23:51 编辑

有路过的大佬指导小弟这个具体是怎么用的呢
不显示
以下数据呢
<bountyRequest:悬赏单委托内容>
<bountyWhere:悬赏单出现场所>
<bountyReward:悬赏单讨伐报酬>
<bountyDifficulty:悬赏单讨伐难度>
<bountyDescription:悬赏单简述说明>

以下是原版插件
RUBY 代码复制
  1. // DarkPlasma_BountyList 2.0.2
  2. // Copyright (c) 2020 DarkPlasma
  3. // This software is released under the MIT license.
  4. // [url]http://opensource.org/licenses/mit-license.php[/url]
  5.  
  6. /**
  7. * 2020/10/10 2.0.2 リファクタ
  8. * 2020/09/29 2.0.1 プラグインコマンドの説明を追加
  9. * 2020/09/08 2.0.0 パラメータ名変更
  10. * 2020/08/24 1.0.1 URL修正
  11. *            1.0.0 MZ版公開
  12. */
  13.  
  14. /*:zh
  15. * @plugindesc 賞金首リストを表示する
  16. * @author DarkPlasma
  17. * @license MIT
  18. *
  19. * @target MZ
  20. * @url [url]https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release[/url]
  21. *
  22. * @param bountyInformations
  23. * @desc 賞金首リストに表示する情報。このリストの順番どおりに表示します
  24. * @text 賞金首情報
  25. * @type struct<BountyInformation>[]
  26. * @default ["{\"metaTag\":\"bountyRequest\",\"text\":\"依頼内容\"}","{\"metaTag\":\"bountyWhere\",\"text\":\"出現場所\"}","{\"metaTag\":\"bountyReward\",\"text\":\"討伐報酬\"}","{\"metaTag\":\"bountyDifficulty\",\"text\":\"討伐難度\"}","{\"metaTag\":\"bountyDescription\",\"text\":\"\"}"]
  27. *
  28. * @param unknownName
  29. * @desc 表示条件を満たさないエネミーの表示名
  30. * @text 未表示名
  31. * @type string
  32. * @default ??????
  33. *
  34. * @param showKilledBounty
  35. * @desc 撃破した賞金首を自動的に表示する
  36. * @text 撃破後自動表示
  37. * @type boolean
  38. * @default true
  39. *
  40. * @param textOffsetX
  41. * @desc 横方向のオフセット
  42. * @text テキストオフセットX
  43. * @type number
  44. * @default 0
  45. *
  46. * @param textOffsetY
  47. * @desc 縦方向のオフセット
  48. * @text テキストオフセットY
  49. * @type number
  50. * @default 0
  51. *
  52. * @param textColorNormal
  53. * @desc リスト内の倒していない敵の文字色
  54. * @text 倒してない敵の色
  55. * @type number
  56. * @default 0
  57. *
  58. * @param textColorKilled
  59. * @desc リスト内の倒した敵の文字色
  60. * @text 倒した敵の色
  61. * @type number
  62. * @default 7
  63. *
  64. * @command BountyList open
  65. * @text 賞金首シーンを開く
  66. * @desc 賞金首シーンを開きます。
  67. *
  68. * @command BountyList add
  69. * @text 敵キャラを賞金首リストに表示
  70. * @desc 指定した敵キャラを賞金首リスト内で開示します。
  71. * @arg id
  72. * @text 敵キャラID
  73. * @type enemy
  74. *
  75. * @command BountyList remove
  76. * @text 敵キャラを賞金首リストから非表示
  77. * @desc 指定した敵キャラを賞金首リストで非表示にします。
  78. * @arg id
  79. * @text 敵キャラID
  80. * @type enemy
  81. *
  82. * @command BountyList complete
  83. * @text 賞金首リストを全開示
  84. * @desc 賞金首リストを全開示します。
  85. *
  86. * @command BountyList clear
  87. * @text 賞金首リストを初期化
  88. * @desc 賞金首リストを初期化します。
  89. *
  90. * @help
  91. * 賞金首に指定したいエネミーのメモ欄に以下の記述をしてください。
  92. *
  93. * <isBounty>
  94. * <bountyShowSwitch:xx> スイッチxx番がONなら表示する
  95. *
  96. * 賞金首リストには、<isBounty>が設定されており、
  97. * なおかつ以下のいずれかを満たす敵キャラが表示されます。
  98. * - 倒したことがある
  99. * - <bountyShowSwitch:xx>を指定しており、スイッチxx番がONである
  100. *
  101. * また、表示したい情報があれば、
  102. * 賞金首情報を設定した上で、以下のように記述してください。
  103. *
  104. * <bountyRequest:賞金首の依頼内容>
  105. * <bountyWhere:賞金首の出現場所>
  106. * <bountyReward:賞金首の報酬>
  107. * <bountyDifficulty:賞金首の討伐難度>
  108. * <bountyDescription:賞金首の説明>
  109. *
  110. * これはデフォルトの設定例であり、
  111. * 賞金首情報の設定次第でお好みの要素を追加できます。
  112. *
  113. * 賞金首リストをプログラムから開く:
  114. * SceneManager.push(Scene_BountyList);
  115. */
  116. /*~struct~BountyInformation:
  117. * @param metaTag
  118. * @desc メタタグ。<(指定した名前):hoge> をエネミーのメモ欄に記入する
  119. * @text メタタグ
  120. * @type string
  121. *
  122. * @param text
  123. * @desc 表示上のテキスト
  124. * @text テキスト
  125. * @type string
  126. */
  127. (() => {
  128.   'use strict';
  129.  
  130.   const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () {
  131.     return arguments[1];
  132.   });
  133.  
  134.   const pluginParameters = PluginManager.parameters(pluginName);
  135.  
  136.   const settings = {
  137.     bountyInformations: JSON.parse(
  138.       pluginParameters.bountyInformations ||
  139.         '[{"metaTag":"bountyRequest","text":"依頼内容"},{"metaTag":"bountyWhere","text":"出現場所"},{"metaTag":"bountyReward","text":"討伐報酬"},{"metaTag":"bountyDifficulty","text":"討伐難度"},{"metaTag":"bountyDescription","text":""}]'
  140.     ).map((e) => {
  141.       return ((parameter) => {
  142.         const parsed = JSON.parse(parameter);
  143.         return {
  144.           metaTag: String(parsed.metaTag || ''),
  145.           text: String(parsed.text || ''),
  146.         };
  147.       })(e || '{}');
  148.     }),
  149.     unknownName: String(pluginParameters.unknownName || '??????'),
  150.     showKilledBounty: String(pluginParameters.showKilledBounty || true) === 'true',
  151.     textOffsetX: Number(pluginParameters.textOffsetX || 0),
  152.     textOffsetY: Number(pluginParameters.textOffsetY || 0),
  153.     textColorNormal: Number(pluginParameters.textColorNormal || 0),
  154.     textColorKilled: Number(pluginParameters.textColorKilled || 7),
  155.   };
  156.  
  157.   const _extractMetadata = DataManager.extractMetadata;
  158.   DataManager.extractMetadata = function (data) {
  159.     _extractMetadata.call(this, data);
  160.     if (data.meta.isBounty) {
  161.       data.isBounty = true;
  162.       if (data.meta.bountyShowSwitch) {
  163.         data.bountyShowSwitch = Number(data.meta.bountyShowSwitch);
  164.       }
  165.       settings.bountyInformations.forEach((info) => {
  166.         if (data.meta[info.tag]) {
  167.           data[info.tag] = String(data.meta[info.tag]);
  168.         }
  169.       });
  170.     }
  171.   };
  172.  
  173.   PluginManager.registerCommand(pluginName, 'BountyList open', function () {
  174.     SceneManager.push(Scene_BountyList);
  175.   });
  176.  
  177.   PluginManager.registerCommand(pluginName, 'BountyList add', function (args) {
  178.     $gameSystem.addToBountyList(Number(args.id));
  179.   });
  180.  
  181.   PluginManager.registerCommand(pluginName, 'BountyList remove', function (args) {
  182.     $gameSystem.removeFromBountyList(Number(args.id));
  183.   });
  184.  
  185.   PluginManager.registerCommand(pluginName, 'BountyList complete', function () {
  186.     $gameSystem.completeBountyList();
  187.   });
  188.  
  189.   PluginManager.registerCommand(pluginName, 'BountyList clear', function () {
  190.     $gameSystem.clearBountyList();
  191.   });
  192.  
  193.   Game_System.prototype.addToBountyList = function (enemyId) {
  194.     if (!this._bountyKillFlags) {
  195.       this.clearBountyList();
  196.     }
  197.     if ($dataEnemies[enemyId].isBounty) {
  198.       this._bountyKillFlags[enemyId] = true;
  199.     }
  200.   };
  201.  
  202.   Game_System.prototype.removeFromBountyList = function (enemyId) {
  203.     if (this._bountyKillFlags) {
  204.       this._bountyKillFlags[enemyId] = false;
  205.     }
  206.   };
  207.  
  208.   Game_System.prototype.completeBountyList = function () {
  209.     this.clearBountyList();
  210.     $dataEnemies
  211.       .filter((enemy) => enemy && enemy.isBounty)
  212.       .forEach(function (enemy) {
  213.         this._bountyKillFlags[enemy.id] = true;
  214.       }, this);
  215.   };
  216.  
  217.   Game_System.prototype.clearBountyList = function () {
  218.     this._bountyKillFlags = [];
  219.   };
  220.  
  221.   Game_System.prototype.isInBountyList = function (enemy) {
  222.     if (!this._bountyKillFlags) {
  223.       this.clearBountyList();
  224.     }
  225.     // そもそもバウンティではない
  226.     if (!enemy.isBounty) {
  227.       return false;
  228.     }
  229.     // すでに撃破済み
  230.     if (this._bountyKillFlags[enemy.id]) {
  231.       return true;
  232.     }
  233.     // スイッチが立っている
  234.     if (enemy.bountyShowSwitch && $gameSwitches.value(enemy.bountyShowSwitch)) {
  235.       return true;
  236.     }
  237.     return false;
  238.   };
  239.  
  240.   Game_System.prototype.isKilledBounty = function (enemy) {
  241.     if (!this._bountyKillFlags) {
  242.       this.clearBountyList();
  243.     }
  244.     if (!enemy.isBounty) {
  245.       return false;
  246.     }
  247.     if (this._bountyKillFlags[enemy.id]) {
  248.       return true;
  249.     }
  250.     return false;
  251.   };
  252.  
  253.   const _Game_Enemy_performCollapse = Game_Enemy.prototype.performCollapse;
  254.   Game_Enemy.prototype.performCollapse = function () {
  255.     _Game_Enemy_performCollapse.call(this);
  256.     $gameSystem.addToBountyList(this.enemy().id);
  257.   };
  258.  
  259.   /**
  260.    *  賞金首シーン
  261.    */
  262.   class Scene_BountyList extends Scene_MenuBase {
  263.     constructor() {
  264.       super();
  265.       this.initialize();
  266.     }
  267.  
  268.     initialize() {
  269.       super.initialize();
  270.     }
  271.  
  272.     create() {
  273.       super.create();
  274.       this._indexWindow = new Window_BountyListIndex(this.bountyListIndexWindowRect());
  275.       this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  276.       const detailsWindowY = this._indexWindow.height;
  277.       this._detailsWindow = new Window_BountyListDetails(this.bountyListDetailsWindowRect());
  278.       this.addWindow(this._indexWindow);
  279.       this.addWindow(this._detailsWindow);
  280.       this._indexWindow.setDetailsWindow(this._detailsWindow);
  281.     }
  282.  
  283.     /**
  284.      * @return {Rectangle}
  285.      */
  286.     bountyListIndexWindowRect() {
  287.       return new Rectangle(0, 0, Graphics.boxWidth, this.calcWindowHeight(6, true));
  288.     }
  289.  
  290.     /**
  291.      * @return {Rectangle}
  292.      */
  293.     bountyListDetailsWindowRect() {
  294.       const y = this._indexWindow.height;
  295.       return new Rectangle(0, y, Graphics.boxWidth, Graphics.boxHeight - y);
  296.     }
  297.   }
  298.  
  299.   window[Scene_BountyList.name] = Scene_BountyList;
  300.  
  301.   /**
  302.    * 賞金首リスト表示
  303.    */
  304.   class Window_BountyListIndex extends Window_Selectable {
  305.     constructor(rect) {
  306.       super(rect);
  307.       this.initialize.apply(this, arguments);
  308.     }
  309.  
  310.     initialize(rect) {
  311.       super.initialize(rect);
  312.       this.refresh();
  313.       this.setTopRow(Window_BountyListIndex.lastTopRow);
  314.       this.select(Window_BountyListIndex.lastIndex);
  315.       this.activate();
  316.     }
  317.  
  318.     maxCols() {
  319.       return 3;
  320.     }
  321.  
  322.     maxItems() {
  323.       return this._list ? this._list.length : 0;
  324.     }
  325.  
  326.     /**
  327.      * @param {Window_BountyListDetails} detailsWindow 詳細ウィンドウ
  328.      */
  329.     setDetailsWindow(detailsWindow) {
  330.       this._detailsWindow = detailsWindow;
  331.       this.updateDetails();
  332.     }
  333.  
  334.     update() {
  335.       super.update();
  336.       this.updateDetails();
  337.     }
  338.  
  339.     updateDetails() {
  340.       if (this._detailsWindow) {
  341.         const enemy = this._list[this.index()];
  342.         this._detailsWindow.setEnemy(enemy);
  343.       }
  344.     }
  345.  
  346.     refresh() {
  347.       this._list = $dataEnemies.filter((enemy) => enemy && enemy.isBounty);
  348.       this.createContents();
  349.       this.drawAllItems();
  350.     }
  351.  
  352.     /**
  353.      * @param {number} index インデックス
  354.      */
  355.     drawItem(index) {
  356.       const enemy = this._list[index];
  357.       const rect = this.itemRect(index);
  358.       const name = $gameSystem.isInBountyList(enemy) ? enemy.name : settings.unknownName;
  359.       if ($gameSystem.isKilledBounty(enemy)) {
  360.         this.changeTextColor(ColorManager.textColor(settings.textColorKilled));
  361.       } else {
  362.         this.changeTextColor(ColorManager.textColor(settings.textColorNormal));
  363.       }
  364.       this.drawText(name, rect.x, rect.y, rect.width);
  365.       this.resetTextColor();
  366.     }
  367.  
  368.     processCancel() {
  369.       super.processCancel();
  370.       Window_BountyListIndex.lastTopRow = this.topRow();
  371.       Window_BountyListIndex.lastIndex = this.index();
  372.     }
  373.   }
  374.  
  375.   Window_BountyListIndex.lastTopRow = 0;
  376.   Window_BountyListIndex.lastIndex = 0;
  377.  
  378.   /**
  379.    * 賞金首詳細表示
  380.    */
  381.   class Window_BountyListDetails extends Window_Base {
  382.     constructor(rect) {
  383.       super(rect);
  384.       this.initialize.apply(this, arguments);
  385.     }
  386.  
  387.     initialize(rect) {
  388.       super.initialize(rect);
  389.       this._enemy = null;
  390.       this._enemySprite = new Sprite();
  391.       this._enemySprite.anchor.x = 0.5;
  392.       this._enemySprite.anchor.y = 0.5;
  393.       this._enemySprite.x = rect.width / 4 - 20;
  394.       this._enemySprite.y = rect.height / 2;
  395.       this.addChildToBack(this._enemySprite);
  396.       this.refresh();
  397.     }
  398.  
  399.     /**
  400.      * @param {MZ.Enemy} enemy 敵データ
  401.      */
  402.     setEnemy(enemy) {
  403.       if (this._enemy !== enemy) {
  404.         this._enemy = enemy;
  405.         this.refresh();
  406.       }
  407.     }
  408.  
  409.     update() {
  410.       super.update();
  411.       if (this._enemySprite.bitmap) {
  412.         const bitmapHeight = this._enemySprite.bitmap.height;
  413.         const contentsHeight = this.contents.height;
  414.         const scale = bitmapHeight > contentsHeight ? contentsHeight / bitmapHeight : 1;
  415.         this._enemySprite.scale.x = scale;
  416.         this._enemySprite.scale.y = scale;
  417.       }
  418.     }
  419.  
  420.     refresh() {
  421.       const enemy = this._enemy;
  422.       const lineHeight = this.lineHeight();
  423.       const NAME_X = 0;
  424.       const NAME_Y = 0;
  425.  
  426.       this.contents.clear();
  427.  
  428.       if (!enemy || !$gameSystem.isInBountyList(enemy)) {
  429.         this._enemySprite.bitmap = null;
  430.         return;
  431.       }
  432.  
  433.       const name = enemy.battlerName;
  434.       const hue = enemy.battlerHue;
  435.       this._enemySprite.bitmap = $gameSystem.isSideView()
  436.         ? ImageManager.loadSvEnemy(name, hue)
  437.         : ImageManager.loadEnemy(name, hue);
  438.  
  439.       this.resetTextColor();
  440.       this.drawText(enemy.name, NAME_X, NAME_Y);
  441.  
  442.       const detailsWidth = 480;
  443.       const x = this.contents.width - detailsWidth + settings.textOffsetX;
  444.       const y = lineHeight + $gameSystem.windowPadding() + settings.textOffsetY;
  445.  
  446.       let lineCount = 0;
  447.  
  448.       settings.bountyInformations.forEach((info) => {
  449.         if (enemy[info.tag]) {
  450.           this.drawTextEx(
  451.             info.text ? `${info.text}:${enemy[info.tag]}` : enemy[info.tag],
  452.             x,
  453.             y + lineHeight * lineCount,
  454.             detailsWidth
  455.           );
  456.           lineCount++;
  457.         }
  458.       });
  459.     }
  460.   }
  461. })();

035741ufqjjwzbztqt3bjk.jpg (59.24 KB, 下载次数: 2)

035741ufqjjwzbztqt3bjk.jpg

035744t8mjitglgj89hicg.jpg (23.62 KB, 下载次数: 2)

035744t8mjitglgj89hicg.jpg

作者: 明智光秀    时间: 2020-11-15 15:20
看了下有帮助说明,我翻译了下。。。
请在想要指定为悬赏目标的敌人备注下输入
<isBounty>
<bountyShowSwitch:xx>X开关开启时显示
指定过<isBounty>,并且满足以下任一条件后悬赏目标会在列表中被显示
- 有打败过
- 指定了<bountyShowSwitch:xx>,并且开关开启
另外如果有想要显示的情报,请在设定完悬赏情报的基础上设定如下内容。
<bountyRequest:悬赏目标的委托内容>
<bountyWhere:悬赏目标的出现场所>
<bountyReward:悬赏目标的报酬>
<bountyDifficulty:悬赏目标的讨伐难度>
<bountyDescription:悬赏目标的介绍>
这是默认设定示例,你可以根据悬赏目标情报设定添加自己喜欢的要素。
从脚本中打开悬赏目标列表:
SceneManager.push(Scene_BountyList);
作者: j296196585    时间: 2020-11-15 15:44
明智光秀 发表于 2020-11-15 15:20
看了下有帮助说明,我翻译了下。。。
请在想要指定为悬赏目标的敌人备注下输入


谢谢回顾  
不过 大兄弟真的有、看我的帖子 ???

我已经截图我所遇见的 问题 希望大兄弟 能认真对待

234933n5k5olyavxho5bwo.jpg (59.24 KB, 下载次数: 2)

234933n5k5olyavxho5bwo.jpg





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1