查看: 4522|回复: 2

[有事请教] 赏金名单具体使用

[复制链接]
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2020-11-14 23:48:34 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 j296196585 于 2020-11-14 23:51 编辑

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

以下是原版插件
  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. * 2020/10/10 2.0.2 リファクタ
  7. * 2020/09/29 2.0.1 プラグインコマンドの説明を追加
  8. * 2020/09/08 2.0.0 パラメータ名変更
  9. * 2020/08/24 1.0.1 URL修正
  10. *            1.0.0 MZ版公開
  11. */

  12. /*:zh
  13. * @plugindesc 賞金首リストを表示する
  14. * @author DarkPlasma
  15. * @license MIT
  16. *
  17. * @target MZ
  18. * @url [url]https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release[/url]
  19. *
  20. * @param bountyInformations
  21. * @desc 賞金首リストに表示する情報。このリストの順番どおりに表示します
  22. * @text 賞金首情報
  23. * @type struct<BountyInformation>[]
  24. * @default ["{"metaTag":"bountyRequest","text":"依頼内容"}","{"metaTag":"bountyWhere","text":"出現場所"}","{"metaTag":"bountyReward","text":"討伐報酬"}","{"metaTag":"bountyDifficulty","text":"討伐難度"}","{"metaTag":"bountyDescription","text":""}"]
  25. *
  26. * @param unknownName
  27. * @desc 表示条件を満たさないエネミーの表示名
  28. * @text 未表示名
  29. * @type string
  30. * @default ??????
  31. *
  32. * @param showKilledBounty
  33. * @desc 撃破した賞金首を自動的に表示する
  34. * @text 撃破後自動表示
  35. * @type boolean
  36. * @default true
  37. *
  38. * @param textOffsetX
  39. * @desc 横方向のオフセット
  40. * @text テキストオフセットX
  41. * @type number
  42. * @default 0
  43. *
  44. * @param textOffsetY
  45. * @desc 縦方向のオフセット
  46. * @text テキストオフセットY
  47. * @type number
  48. * @default 0
  49. *
  50. * @param textColorNormal
  51. * @desc リスト内の倒していない敵の文字色
  52. * @text 倒してない敵の色
  53. * @type number
  54. * @default 0
  55. *
  56. * @param textColorKilled
  57. * @desc リスト内の倒した敵の文字色
  58. * @text 倒した敵の色
  59. * @type number
  60. * @default 7
  61. *
  62. * @command BountyList open
  63. * @text 賞金首シーンを開く
  64. * @desc 賞金首シーンを開きます。
  65. *
  66. * @command BountyList add
  67. * @text 敵キャラを賞金首リストに表示
  68. * @desc 指定した敵キャラを賞金首リスト内で開示します。
  69. * @arg id
  70. * @text 敵キャラID
  71. * @type enemy
  72. *
  73. * @command BountyList remove
  74. * @text 敵キャラを賞金首リストから非表示
  75. * @desc 指定した敵キャラを賞金首リストで非表示にします。
  76. * @arg id
  77. * @text 敵キャラID
  78. * @type enemy
  79. *
  80. * @command BountyList complete
  81. * @text 賞金首リストを全開示
  82. * @desc 賞金首リストを全開示します。
  83. *
  84. * @command BountyList clear
  85. * @text 賞金首リストを初期化
  86. * @desc 賞金首リストを初期化します。
  87. *
  88. * @help
  89. * 賞金首に指定したいエネミーのメモ欄に以下の記述をしてください。
  90. *
  91. * <isBounty>
  92. * <bountyShowSwitch:xx> スイッチxx番がONなら表示する
  93. *
  94. * 賞金首リストには、<isBounty>が設定されており、
  95. * なおかつ以下のいずれかを満たす敵キャラが表示されます。
  96. * - 倒したことがある
  97. * - <bountyShowSwitch:xx>を指定しており、スイッチxx番がONである
  98. *
  99. * また、表示したい情報があれば、
  100. * 賞金首情報を設定した上で、以下のように記述してください。
  101. *
  102. * <bountyRequest:賞金首の依頼内容>
  103. * <bountyWhere:賞金首の出現場所>
  104. * <bountyReward:賞金首の報酬>
  105. * <bountyDifficulty:賞金首の討伐難度>
  106. * <bountyDescription:賞金首の説明>
  107. *
  108. * これはデフォルトの設定例であり、
  109. * 賞金首情報の設定次第でお好みの要素を追加できます。
  110. *
  111. * 賞金首リストをプログラムから開く:
  112. * SceneManager.push(Scene_BountyList);
  113. */
  114. /*~struct~BountyInformation:
  115. * @param metaTag
  116. * @desc メタタグ。<(指定した名前):hoge> をエネミーのメモ欄に記入する
  117. * @text メタタグ
  118. * @type string
  119. *
  120. * @param text
  121. * @desc 表示上のテキスト
  122. * @text テキスト
  123. * @type string
  124. */
  125. (() => {
  126.   'use strict';

  127.   const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () {
  128.     return arguments[1];
  129.   });

  130.   const pluginParameters = PluginManager.parameters(pluginName);

  131.   const settings = {
  132.     bountyInformations: JSON.parse(
  133.       pluginParameters.bountyInformations ||
  134.         '[{"metaTag":"bountyRequest","text":"依頼内容"},{"metaTag":"bountyWhere","text":"出現場所"},{"metaTag":"bountyReward","text":"討伐報酬"},{"metaTag":"bountyDifficulty","text":"討伐難度"},{"metaTag":"bountyDescription","text":""}]'
  135.     ).map((e) => {
  136.       return ((parameter) => {
  137.         const parsed = JSON.parse(parameter);
  138.         return {
  139.           metaTag: String(parsed.metaTag || ''),
  140.           text: String(parsed.text || ''),
  141.         };
  142.       })(e || '{}');
  143.     }),
  144.     unknownName: String(pluginParameters.unknownName || '??????'),
  145.     showKilledBounty: String(pluginParameters.showKilledBounty || true) === 'true',
  146.     textOffsetX: Number(pluginParameters.textOffsetX || 0),
  147.     textOffsetY: Number(pluginParameters.textOffsetY || 0),
  148.     textColorNormal: Number(pluginParameters.textColorNormal || 0),
  149.     textColorKilled: Number(pluginParameters.textColorKilled || 7),
  150.   };

  151.   const _extractMetadata = DataManager.extractMetadata;
  152.   DataManager.extractMetadata = function (data) {
  153.     _extractMetadata.call(this, data);
  154.     if (data.meta.isBounty) {
  155.       data.isBounty = true;
  156.       if (data.meta.bountyShowSwitch) {
  157.         data.bountyShowSwitch = Number(data.meta.bountyShowSwitch);
  158.       }
  159.       settings.bountyInformations.forEach((info) => {
  160.         if (data.meta[info.tag]) {
  161.           data[info.tag] = String(data.meta[info.tag]);
  162.         }
  163.       });
  164.     }
  165.   };

  166.   PluginManager.registerCommand(pluginName, 'BountyList open', function () {
  167.     SceneManager.push(Scene_BountyList);
  168.   });

  169.   PluginManager.registerCommand(pluginName, 'BountyList add', function (args) {
  170.     $gameSystem.addToBountyList(Number(args.id));
  171.   });

  172.   PluginManager.registerCommand(pluginName, 'BountyList remove', function (args) {
  173.     $gameSystem.removeFromBountyList(Number(args.id));
  174.   });

  175.   PluginManager.registerCommand(pluginName, 'BountyList complete', function () {
  176.     $gameSystem.completeBountyList();
  177.   });

  178.   PluginManager.registerCommand(pluginName, 'BountyList clear', function () {
  179.     $gameSystem.clearBountyList();
  180.   });

  181.   Game_System.prototype.addToBountyList = function (enemyId) {
  182.     if (!this._bountyKillFlags) {
  183.       this.clearBountyList();
  184.     }
  185.     if ($dataEnemies[enemyId].isBounty) {
  186.       this._bountyKillFlags[enemyId] = true;
  187.     }
  188.   };

  189.   Game_System.prototype.removeFromBountyList = function (enemyId) {
  190.     if (this._bountyKillFlags) {
  191.       this._bountyKillFlags[enemyId] = false;
  192.     }
  193.   };

  194.   Game_System.prototype.completeBountyList = function () {
  195.     this.clearBountyList();
  196.     $dataEnemies
  197.       .filter((enemy) => enemy && enemy.isBounty)
  198.       .forEach(function (enemy) {
  199.         this._bountyKillFlags[enemy.id] = true;
  200.       }, this);
  201.   };

  202.   Game_System.prototype.clearBountyList = function () {
  203.     this._bountyKillFlags = [];
  204.   };

  205.   Game_System.prototype.isInBountyList = function (enemy) {
  206.     if (!this._bountyKillFlags) {
  207.       this.clearBountyList();
  208.     }
  209.     // そもそもバウンティではない
  210.     if (!enemy.isBounty) {
  211.       return false;
  212.     }
  213.     // すでに撃破済み
  214.     if (this._bountyKillFlags[enemy.id]) {
  215.       return true;
  216.     }
  217.     // スイッチが立っている
  218.     if (enemy.bountyShowSwitch && $gameSwitches.value(enemy.bountyShowSwitch)) {
  219.       return true;
  220.     }
  221.     return false;
  222.   };

  223.   Game_System.prototype.isKilledBounty = function (enemy) {
  224.     if (!this._bountyKillFlags) {
  225.       this.clearBountyList();
  226.     }
  227.     if (!enemy.isBounty) {
  228.       return false;
  229.     }
  230.     if (this._bountyKillFlags[enemy.id]) {
  231.       return true;
  232.     }
  233.     return false;
  234.   };

  235.   const _Game_Enemy_performCollapse = Game_Enemy.prototype.performCollapse;
  236.   Game_Enemy.prototype.performCollapse = function () {
  237.     _Game_Enemy_performCollapse.call(this);
  238.     $gameSystem.addToBountyList(this.enemy().id);
  239.   };

  240.   /**
  241.    *  賞金首シーン
  242.    */
  243.   class Scene_BountyList extends Scene_MenuBase {
  244.     constructor() {
  245.       super();
  246.       this.initialize();
  247.     }

  248.     initialize() {
  249.       super.initialize();
  250.     }

  251.     create() {
  252.       super.create();
  253.       this._indexWindow = new Window_BountyListIndex(this.bountyListIndexWindowRect());
  254.       this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  255.       const detailsWindowY = this._indexWindow.height;
  256.       this._detailsWindow = new Window_BountyListDetails(this.bountyListDetailsWindowRect());
  257.       this.addWindow(this._indexWindow);
  258.       this.addWindow(this._detailsWindow);
  259.       this._indexWindow.setDetailsWindow(this._detailsWindow);
  260.     }

  261.     /**
  262.      * @return {Rectangle}
  263.      */
  264.     bountyListIndexWindowRect() {
  265.       return new Rectangle(0, 0, Graphics.boxWidth, this.calcWindowHeight(6, true));
  266.     }

  267.     /**
  268.      * @return {Rectangle}
  269.      */
  270.     bountyListDetailsWindowRect() {
  271.       const y = this._indexWindow.height;
  272.       return new Rectangle(0, y, Graphics.boxWidth, Graphics.boxHeight - y);
  273.     }
  274.   }

  275.   window[Scene_BountyList.name] = Scene_BountyList;

  276.   /**
  277.    * 賞金首リスト表示
  278.    */
  279.   class Window_BountyListIndex extends Window_Selectable {
  280.     constructor(rect) {
  281.       super(rect);
  282.       this.initialize.apply(this, arguments);
  283.     }

  284.     initialize(rect) {
  285.       super.initialize(rect);
  286.       this.refresh();
  287.       this.setTopRow(Window_BountyListIndex.lastTopRow);
  288.       this.select(Window_BountyListIndex.lastIndex);
  289.       this.activate();
  290.     }

  291.     maxCols() {
  292.       return 3;
  293.     }

  294.     maxItems() {
  295.       return this._list ? this._list.length : 0;
  296.     }

  297.     /**
  298.      * @param {Window_BountyListDetails} detailsWindow 詳細ウィンドウ
  299.      */
  300.     setDetailsWindow(detailsWindow) {
  301.       this._detailsWindow = detailsWindow;
  302.       this.updateDetails();
  303.     }

  304.     update() {
  305.       super.update();
  306.       this.updateDetails();
  307.     }

  308.     updateDetails() {
  309.       if (this._detailsWindow) {
  310.         const enemy = this._list[this.index()];
  311.         this._detailsWindow.setEnemy(enemy);
  312.       }
  313.     }

  314.     refresh() {
  315.       this._list = $dataEnemies.filter((enemy) => enemy && enemy.isBounty);
  316.       this.createContents();
  317.       this.drawAllItems();
  318.     }

  319.     /**
  320.      * @param {number} index インデックス
  321.      */
  322.     drawItem(index) {
  323.       const enemy = this._list[index];
  324.       const rect = this.itemRect(index);
  325.       const name = $gameSystem.isInBountyList(enemy) ? enemy.name : settings.unknownName;
  326.       if ($gameSystem.isKilledBounty(enemy)) {
  327.         this.changeTextColor(ColorManager.textColor(settings.textColorKilled));
  328.       } else {
  329.         this.changeTextColor(ColorManager.textColor(settings.textColorNormal));
  330.       }
  331.       this.drawText(name, rect.x, rect.y, rect.width);
  332.       this.resetTextColor();
  333.     }

  334.     processCancel() {
  335.       super.processCancel();
  336.       Window_BountyListIndex.lastTopRow = this.topRow();
  337.       Window_BountyListIndex.lastIndex = this.index();
  338.     }
  339.   }

  340.   Window_BountyListIndex.lastTopRow = 0;
  341.   Window_BountyListIndex.lastIndex = 0;

  342.   /**
  343.    * 賞金首詳細表示
  344.    */
  345.   class Window_BountyListDetails extends Window_Base {
  346.     constructor(rect) {
  347.       super(rect);
  348.       this.initialize.apply(this, arguments);
  349.     }

  350.     initialize(rect) {
  351.       super.initialize(rect);
  352.       this._enemy = null;
  353.       this._enemySprite = new Sprite();
  354.       this._enemySprite.anchor.x = 0.5;
  355.       this._enemySprite.anchor.y = 0.5;
  356.       this._enemySprite.x = rect.width / 4 - 20;
  357.       this._enemySprite.y = rect.height / 2;
  358.       this.addChildToBack(this._enemySprite);
  359.       this.refresh();
  360.     }

  361.     /**
  362.      * @param {MZ.Enemy} enemy 敵データ
  363.      */
  364.     setEnemy(enemy) {
  365.       if (this._enemy !== enemy) {
  366.         this._enemy = enemy;
  367.         this.refresh();
  368.       }
  369.     }

  370.     update() {
  371.       super.update();
  372.       if (this._enemySprite.bitmap) {
  373.         const bitmapHeight = this._enemySprite.bitmap.height;
  374.         const contentsHeight = this.contents.height;
  375.         const scale = bitmapHeight > contentsHeight ? contentsHeight / bitmapHeight : 1;
  376.         this._enemySprite.scale.x = scale;
  377.         this._enemySprite.scale.y = scale;
  378.       }
  379.     }

  380.     refresh() {
  381.       const enemy = this._enemy;
  382.       const lineHeight = this.lineHeight();
  383.       const NAME_X = 0;
  384.       const NAME_Y = 0;

  385.       this.contents.clear();

  386.       if (!enemy || !$gameSystem.isInBountyList(enemy)) {
  387.         this._enemySprite.bitmap = null;
  388.         return;
  389.       }

  390.       const name = enemy.battlerName;
  391.       const hue = enemy.battlerHue;
  392.       this._enemySprite.bitmap = $gameSystem.isSideView()
  393.         ? ImageManager.loadSvEnemy(name, hue)
  394.         : ImageManager.loadEnemy(name, hue);

  395.       this.resetTextColor();
  396.       this.drawText(enemy.name, NAME_X, NAME_Y);

  397.       const detailsWidth = 480;
  398.       const x = this.contents.width - detailsWidth + settings.textOffsetX;
  399.       const y = lineHeight + $gameSystem.windowPadding() + settings.textOffsetY;

  400.       let lineCount = 0;

  401.       settings.bountyInformations.forEach((info) => {
  402.         if (enemy[info.tag]) {
  403.           this.drawTextEx(
  404.             info.text ? `${info.text}:${enemy[info.tag]}` : enemy[info.tag],
  405.             x,
  406.             y + lineHeight * lineCount,
  407.             detailsWidth
  408.           );
  409.           lineCount++;
  410.         }
  411.       });
  412.     }
  413.   }
  414. })();
复制代码
035741ufqjjwzbztqt3bjk.jpg
035744t8mjitglgj89hicg.jpg
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
梦石
0
星屑
1999
在线时间
219 小时
注册时间
2010-8-20
回帖
51
发表于 2020-11-15 15:20:20 | 显示全部楼层
看了下有帮助说明,我翻译了下。。。
请在想要指定为悬赏目标的敌人备注下输入
<isBounty>
<bountyShowSwitch:xx>X开关开启时显示
指定过<isBounty>,并且满足以下任一条件后悬赏目标会在列表中被显示
- 有打败过
- 指定了<bountyShowSwitch:xx>,并且开关开启
另外如果有想要显示的情报,请在设定完悬赏情报的基础上设定如下内容。
<bountyRequest:悬赏目标的委托内容>
<bountyWhere:悬赏目标的出现场所>
<bountyReward:悬赏目标的报酬>
<bountyDifficulty:悬赏目标的讨伐难度>
<bountyDescription:悬赏目标的介绍>
这是默认设定示例,你可以根据悬赏目标情报设定添加自己喜欢的要素。
从脚本中打开悬赏目标列表:
SceneManager.push(Scene_BountyList);
回复

使用道具 举报

梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

 楼主| 发表于 2020-11-15 15:44:03 | 显示全部楼层
明智光秀 发表于 2020-11-15 15:20
看了下有帮助说明,我翻译了下。。。
请在想要指定为悬赏目标的敌人备注下输入


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

我已经截图我所遇见的 问题 希望大兄弟 能认真对待
234933n5k5olyavxho5bwo.jpg
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部