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

Project1

 找回密码
 注册会员
搜索
查看: 1114|回复: 2

[有事请教] 关于日站的游戏内用语辞典

[复制链接]

Lv2.观梦者

梦石
0
星屑
872
在线时间
39 小时
注册时间
2013-9-13
帖子
4
发表于 2020-9-19 03:45:25 | 显示全部楼层 |阅读模式

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

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

x
不知道有没有大佬用过
我按照说明一步一步做,但是测试的时候呼出来永远提醒Glossary is empty,但是我明明设置了(挠头)
有没有大佬能帮帮我
  1. //=============================================================================
  2. // SceneGlossary.js
  3. // ----------------------------------------------------------------------------
  4. // (C)2016 Triacontane
  5. // This software is released under the MIT License.
  6. // http://opensource.org/licenses/mit-license.php
  7. // ----------------------------------------------------------------------------
  8. // Version
  9. // 2.17.3 2020/08/05 複数ページ表示した状態でカテゴリ表示に戻ったとき、ページ切り替え矢印が表示されたままになる問題を修正
  10. //                   クリックによるページ切り替えの場合でもページ折り返しができるよう仕様変更
  11. // 2.17.2 2020/06/06 未入手のアイテムを???で表示するとき、アイコンも非表示にするよう仕様変更
  12. // 2.17.1 2020/05/08 画像のロードに時間が掛かる環境で高速でページを切り替えたとき、前のページの画像が表示されることがある問題を修正
  13. // 2.17.0 2020/05/04 辞典表示でスクリプトを使用できる制御文字と、使用効果の種別を表示できる制御文字を追加
  14. // 2.16.0 2020/04/24 ヘルプテキストに「\n」と記入することで改行できる機能を追加
  15. // 2.15.0 2019/12/05 ウィンドウの枠と背景を非表示にできる機能を追加
  16. // 2.14.3 2019/12/05 2.4.0以降、用語の自動登録時にONになるスイッチおよび変数が機能していなかった問題を修正
  17. // 2.14.2 2019/12/04 プラグインコマンド「GLOSSARY_ITEM_CHANGE_CATEGORY」のヘルプの凡例が間違っていたので修正
  18. // 2.14.1 2019/11/04 2.14.0の修正で、リストの一番上のカテゴリを指定して辞書を開くと正常に表示されない問題を修正
  19. // 2.14.0 2019/11/03 コマンドから用語辞典を開くときに、カテゴリおよびリスト番号を指定して開ける機能を追加
  20. // 2.13.2 2019/09/08 2.13.1の修正に加えて収集率の表示を正常化
  21. // 2.13.1 2018/09/08 YEP_ItemCore.jsとの競合を解消
  22. // 2.13.0 2019/06/08 全ての用語アイテムを破棄するプラグインコマンドを追加
  23. // 2.12.0 2019/04/07 用語ページの出現条件をスイッチで制御できる機能を追加
  24. // 2.11.3 2019/02/07 FacePicture.jsとの競合を解消
  25. // 2.11.2 2019/01/04 2.11.0の対応でピクチャの拡大率が機能しなくなっていた問題を修正
  26. // 2.11.1 2018/12/07 収集率を取得できるスクリプトをヘルプに記載
  27. // 2.11.0 2018/11/24 カテゴリ選択中でも収集率が表示されるよう修正
  28. //                   一部の処理を軽量化
  29. // 2.10.0 2018/09/13 説明文に対象アイテムデータの説明や価格を埋め込める制御文字を追加
  30. // 2.9.2 2018/09/02 ピクチャを指定していると敵キャラデータの取得が行われない問題を修正
  31. // 2.9.1 2018/08/31 敵キャラのパラメータ出力機能を使う際、敵キャラの画像を表示したページでないとパラメータ表示できない問題を修正
  32. // 2.9.0 2018/08/12 スイッチにより特定の用語の文字色を変更できる機能を追加
  33. // 2.8.1 2018/07/11 文章の最後の自動改行位置が正しく判定されないケースがある問題を修正
  34. // 2.8.0 2018/06/14 収集率算出の対象から外せる用語を指定できる機能を追加
  35. // 2.7.0 2018/04/30 ひとつの用語に対して複数の画像を表示できる機能を追加
  36. // 2.6.2 2018/04/19 ヘルプの一部を英語化
  37. // 2.6.1 2018/04/07 用語選択からカテゴリ選択に戻ったときに、最後に選択していた用語の情報が残ってしまう問題を修正
  38. // 2.6.0 2018/03/17 テキストのY座標を数値指定できる機能を追加
  39. // 2.5.0 2018/03/11 画像の表示位置と表示優先度のパラメータを分けました。
  40. //                  モンスターの報酬情報を記入できる制御文字を追加
  41. // 2.4.0 2018/03/11 モンスター辞典を作成するための各種支援機能を追加しました。
  42. // 2.3.2 2018/03/03 画面起動時のパフォーマンスを改善
  43. //                  コモンイベントを実行するアイテムの使用時に内容次第でエラーになっていた問題を修正
  44. // 2.3.1 2018/02/24 用語情報を設定していない場合のエラーメッセージを言語別に表示するよう修正。ヘルプを分かりやすく修正。
  45. // 2.3.0 2018/02/17 未入手の用語を???等で表記できる機能を追加
  46. // 2.2.1 2018/01/20 setMaxItem.jsとの競合を解消。他のプラグインから用語辞典ウィンドウを改変できるように定義をグローバル領域に移動
  47. // 2.2.0 2018/01/14 複数のカテゴリに属する用語を作成できる機能を追加
  48. // 2.1.0 2017/12/12 入手履歴使用有無と用語リストウィンドウの横幅を、辞書ごとに別々に設定できるようになりました。
  49. // 2.0.1 2017/12/10 2.0.0においてYEP_MainMenuManager.jsとの連携時、ヘルプに示している登録内容で実行するとエラーになっていた問題を修正
  50. // 2.0.0 2017/12/09 用語辞典を好きなだけ追加し、各辞典ごとに仕様や表示内容をカスタマイズできる機能を追加
  51. //                  用語カテゴリを変更できるコマンドを追加、アイテムごとに使用可否を設定できる機能を追加
  52. //                  アイテム使用時に使用したアイテムIDを変数に格納する機能と、任意のスイッチを変更できる機能を追加
  53. // 1.18.1 2017/10/15 1.16.0の機能追加により、カテゴリ数が10以上かつ並び順を指定しない場合の並び順がおかしくなる問題を修正
  54. // 1.18.0 2017/09/01 カテゴリごとにアイテム使用可否を設定できる機能を追加
  55. // 1.17.0 2017/08/21 用語に制御文字が使われた場合は自動変換する機能を追加
  56. // 1.16.1 2017/08/04 セーブとロードを繰り返すと用語辞典の初期位置が最後に選択していたものになってしまう問題を修正
  57. //                   コマンド「GLOSSARY_GAIN_ALL」で隠しアイテム以外も辞書に追加されるよう仕様変更
  58. // 1.16.0 2017/08/03 カテゴリの並び順を自由に指定できる機能を追加
  59. // 1.15.1 2017/07/22 1.15.0でパラメータのブール変数項目が全て効かなくなっていた問題を修正
  60. // 1.15.0 2017/07/13 最後に選択していた項目を記憶した状態で辞書画面に戻る機能を追加
  61. //                   パラメータの型指定機能に対応
  62. // 1.14.1 2017/06/22 カテゴリ表示が有効な場合に、対象用語を一つも所持していない場合はカテゴリリストに表示しないよう修正
  63. // 1.14.0 2017/06/08 所持数表示機能を追加
  64. // 1.13.0 2017/04/19 自動翻訳プラグインに一部対応
  65. // 1.12.0 2017/04/09 用語集リストの表示順を個別に設定する機能を追加
  66. // 1.11.3 2017/03/31 用語リストをスクロールしたときに確認ウィンドウの位置がおかしくなる問題を修正
  67. // 1.11.2 2017/03/08 カテゴリウィンドウで制御文字を使っていない場合は、ウィンドウ幅に応じて文字を縮めるように修正
  68. // 1.11.1 2017/02/09 ピクチャが空の状態でもページ表示できるよう修正
  69. // 1.11.0 2017/02/09 「武器」と「防具」を専用のカテゴリで表示しようとすると表示できない問題を修正
  70. //                   変数などで動的に表示内容を変化させる場合に、表示内容が空の場合はページを表示しないよう修正
  71. // 1.10.0 2017/01/10 辞書画面ごとに別々の背景を指定できる機能を追加
  72. // 1.9.0 2017/01/03 メニュー画面の辞書コマンドに出現条件を指定できる機能を追加
  73. // 1.8.0 2016/12/23 説明文の自動改行機能を追加
  74. // 1.7.1 2016/12/09 1.7.0で収集率が正しく表示されない問題を修正
  75. // 1.7.0 2016/12/09 隠しアイテムでない「アイテム」「武器」「防具」も辞書画面に登録できる機能を追加
  76. // 1.6.0 2016/10/26 背景ピクチャを設定したときに、もともとマップ背景を透過表示できる機能を追加
  77. // 1.5.0 2016/08/06 まだ確認していない用語の文字色を変えられる機能を追加
  78. // 1.4.1 2016/07/03 戦闘画面のアイテム選択ウィンドウに用語集アイテムが表示されていた問題を修正
  79. // 1.4.0 2016/05/31 テキストと画像を重ねて表示する設定を追加
  80. //                  新語が自動登録された場合にスイッチや変数を操作する機能を追加
  81. //                  アイテムを使用する際に確認ウィンドウを表示する機能を追加
  82. //                  新語の自動登録に制御文字を使えるよう修正
  83. //                  収集率を画面左下に表示できる機能を追加
  84. // 1.3.1 2016/04/26 ピクチャ名を変数で指定できる機能を追加
  85. // 1.3.0 2016/04/23 用語の種別ごとに、複数の用語画面を作成できる機能を追加
  86. //                  用語をアイテムとして使用できる機能を追加
  87. // 1.2.1 2016/04/21 複数ページ送りをタッチ操作に対応
  88. //                  アイテムタイプの判定が無条件で有効になってしまう不具合を修正
  89. // 1.2.0 2016/04/20 自動登録の対象外にするタグを追加
  90. //                  ひとつの用語に対して複数のページを表示できる機能を追加
  91. //                  用語が存在しない状態で決定ボタンを押すとフリーズする問題を修正
  92. // 1.1.0 2016/04/20 カテゴリごとに分類して表示できる機能を追加
  93. // 1.0.0 2016/04/17 初版
  94. // ----------------------------------------------------------------------------
  95. // [Blog]   : https://triacontane.blogspot.jp/
  96. // [Twitter]: https://twitter.com/triacontane/
  97. // [GitHub] : https://github.com/triacontane/
  98. //=============================================================================

  99. /*:
  100. * @plugindesc SceneGlossaryPlugin
  101. * @author triacontane
  102. *
  103. * @param GlossaryInfo
  104. * @desc 用語辞典情報です。任意の用語辞典を追加できます。必ず1件以上の用語を登録してください。
  105. * @type struct<GlossaryData>[]
  106. *
  107. * @param Layout
  108. * @desc レイアウト設定関連項目です。まとめ用の項目なのでここには何も入力しないでください。
  109. *
  110. * @param FontSize
  111. * @desc 用語集のフォントサイズです。
  112. * @default 22
  113. * @type number
  114. * @parent Layout
  115. *
  116. * @param AutoResizePicture
  117. * @desc ウィンドウ内にピクチャを表示する際、表示可能なように自動で縮小されます。テキスト位置を指定した場合は無効です。
  118. * @default true
  119. * @type boolean
  120. * @parent Layout
  121. *
  122. * @param PicturePosition
  123. * @desc 画像の表示位置です。(top:ウィンドウの先頭 bottom:ウィンドウの下部 text:テキストの末尾)
  124. * @default top
  125. * @type select
  126. * @option top
  127. * @option bottom
  128. * @option text
  129. * @parent Layout
  130. *
  131. * @param TextPosition
  132. * @desc テキストの表示Y座標です。0の場合は画像の表示位置によって自動設定されます。
  133. * @default 0
  134. * @type number
  135. *
  136. * @param PictureAlign
  137. * @desc 画像の揃えです。(left:左揃え center:中央揃え right:右揃え)
  138. * @default center
  139. * @type select
  140. * @option left
  141. * @option center
  142. * @option right
  143. * @parent Layout
  144. *
  145. * @param PicturePriority
  146. * @desc 画像の表示プライオリティです。(top:テキストの上 bottom:テキストの下)
  147. * @default top
  148. * @type select
  149. * @option top
  150. * @option bottom
  151. * @parent Layout
  152. *
  153. * @param ThroughBackPicture
  154. * @desc 背景ピクチャの背後に通常の背景(マップ画面)を表示します。
  155. * @default false
  156. * @type boolean
  157. * @parent Layout
  158. *
  159. * @param FramelessDesign
  160. * @desc 各種ウィンドウの枠と背景を非表示にします。
  161. * @default false
  162. * @type boolean
  163. * @parent Layout
  164. *
  165. * @param NewGlossaryColor
  166. * @desc 新着用語を明示するためのカラーです。システムカラーから選択してください。
  167. * @default 2
  168. * @type number
  169. * @parent Layout
  170. *
  171. * @param PageWrap
  172. * @desc 複数のページが存在する場合、最後のページまで到達していたら最初のページに戻します。
  173. * @default true
  174. * @type boolean
  175. * @parent Layout
  176. *
  177. * @param AutoAddition
  178. * @desc 文章の表示の命令中に同一単語が出現した場合に自動登録します。(ON/OFF)
  179. * @default false
  180. * @type boolean
  181. *
  182. * @param AutoAdditionEnemy
  183. * @desc 敵キャラを撃破したときに敵キャラと同名の単語を自動登録します。(ON/OFF)
  184. * @default false
  185. * @type boolean
  186. *
  187. * @param SwitchAutoAdd
  188. * @desc 用語アイテムの自動登録が行われた際に指定した番号のスイッチがONになります。何らかの通知を行いたい場合に指定します。
  189. * @default 0
  190. * @type switch
  191. * @parent AutoAddition
  192. *
  193. * @param VariableAutoAdd
  194. * @desc 用語アイテムの自動登録が行われた際に指定した番号の変数にアイテムIDが設定されます。
  195. * @default 0
  196. * @type variable
  197. * @parent AutoAddition
  198. *
  199. * @param CategoryOrder
  200. * @desc カテゴリ並び順を任意に変更したい場合はカテゴリ名を指定してください。
  201. * @default
  202. * @type string[]
  203. *
  204. * @param CategoryUnusable
  205. * @desc ここで指定したカテゴリは「アイテム使用」が有効でも使用できなくなります。
  206. * @default
  207. * @type string[]
  208. *
  209. * @noteParam SGピクチャ
  210. * @noteRequire 1
  211. * @noteDir img/pictures/
  212. * @noteType file
  213. * @noteData items
  214. *
  215. * @noteParam SGPicture
  216. * @noteRequire 1
  217. * @noteDir img/pictures/
  218. * @noteType file
  219. * @noteData items
  220. *
  221. * @help Add a screen that allows you to view the terms that appear in the game.
  222. * Images and text descriptions describing the terms are displayed in the window.
  223. *
  224. * How to use
  225. * 1. Register items to be treated as terms from the database.
  226. *
  227. * 2. Set the parameter "GlossaryInfo".
  228. *
  229. * Terms can be browsed by acquiring the target item, and there is
  230. * also a function to register automatically
  231. * when the same word appears in the command of displaying sentences.
  232. * (It is also possible to specify a specific term outside the scope
  233. * of automatic registration)
  234. *
  235. * You can switch from menu scene and plugin command to
  236. * glossary scene.
  237. *
  238. * How to register data
  239. * 1. Register new data in item database and
  240. * set "item type" to "hidden item A" or "hidden item B"
  241. *
  242. * 2. Set note param
  243. * <SGDescription:xxx> // Description of Glossary *1
  244. * <SGCategory:xxx>    // Category of Glossary
  245. * <SGManual>          // Exclude terms from automatic registration
  246. * <SGPicture:filename> // Filename of the term picture
  247. * <SGEnemy:1>          // Enemy instead of the picture
  248. * <SGPicturePosition:text> // Picture position
  249. *  top, bottom, text
  250. * <SGTextPosition:100>      // Text position
  251. * <SGPicturePriority:top>   // Picture priority
  252. *  top, bottom
  253. * <SGPictureScale:0.5>     // Picture scale
  254. * <SGPictureAlign:right>   // Picture align
  255. *  left, center, right
  256. * <SGNoCollect>            // Glossary No Collect
  257. * <SGTextColorChange:1,10> // If switch[1] ON. Change color[10]
  258. *
  259. * *1 Escape Characters
  260. * \COMMON[1]  // It is replaced by aaa(<CommonDescription:aaa>)
  261. * \mhp[3]     // Enemy Max HP(Zero padding 3)
  262. * \mmp[3]     // Max MP
  263. * \atk[3]     // Atk
  264. * \def[3]     // Def
  265. * \mag[3]     // Mag
  266. * \mdf[3]     // Mdf
  267. * \agi[3]     // Agi
  268. * \luk[3]     // Luk
  269. * \exp[3]     // Exp
  270. * \money[3]   // Gold
  271. * \drop[1]    // Drop item 1
  272. * \DATA[prop] // 対象データのプロパティ「prop」に置き換えられます。(下記参照)
  273. * \DATA[description] // 対象データの説明
  274. * \DATA[price]       // 対象データの価格
  275. *
  276. * you can use multiple pages with one term.
  277. * The pages are switched with the direction keys.
  278. * <SGDescription2:xxx>
  279. * <SGPicture2:filename>
  280. * <SGPicturePosition2:text>
  281. *
  282. * The same is true for the third and subsequent pages, up to 99 pages can be specified.
  283. * Do not attach "1" to the first page when displaying multiple pages.
  284. * NG:<SGDescription1:xxx>
  285. *
  286. * The following tags are required when displaying terms in different type of dictionary.
  287. * <SGType:2>   // Type of Glossary
  288. *
  289. * Plugin Command
  290. *
  291. * GLOSSARY_GAIN_ALL
  292. *  All terms registered in the database will be in acquisition state.
  293. *
  294. * GLOSSARY_LOSE_ALL
  295. *
  296. * GLOSSARY_CALL [Type] [Category] [ListIndex]
  297. *  Call the glossary screen.
  298. *  If the type is omitted, it will be automatically set to "1".
  299. * ex:GLOSSARY_CALL 1 Character 0
  300. *
  301. * GLOSSARY_BACK
  302. *  Call up the glossary screen with reselecting the last selected item.
  303. * ex:GLOSSARY_BACK
  304. *
  305. * GLOSSARY_ITEM_CHANGE_CATEGORY [Item id] [new category]
  306. *  Change the category of the item with the specified ID to another one.
  307. * ex:GLOSSARY_ITEM_CHANGE_CATEGORY 10 AAA
  308. * Only items can be changed. Weapons and armors can not be changed.
  309. *
  310. * GLOSSARY_ITEM_CHANGE_USABLE [Item id] [ON or OFF]
  311. *  Change prohibition of items with the specified ID.
  312. *  (ON: Possible OFF: Prohibited)
  313. * ex:GLOSSARY_ITEM_CHANGE_USABLE 10 ON
  314. * Only items can be changed. Weapons and armors can not be changed.
  315. *
  316. * This software is released under the MIT License. Check header.
  317. */

  318. /*~struct~GlossaryData:
  319. *
  320. * @param GlossaryType
  321. * @desc 用語種別です。<SG種別:n>で指定した用語が表示されます。
  322. * @default 1
  323. * @type number
  324. * @min 1
  325. *
  326. * @param CommandName
  327. * @desc メニュー画面に表示されるコマンド名です。空にするとメニュー画面に表示されなくなります。
  328. * @default 用語辞典
  329. *
  330. * @param UseCategory
  331. * @desc 用語をカテゴリごとに分けて表示します。
  332. * @default false
  333. * @type boolean
  334. *
  335. * @param CommandSwitchId
  336. * @desc 辞書コマンドの出現条件スイッチ番号です。0にすると無条件で表示されます。
  337. * @default 0
  338. * @type switch
  339. *
  340. * @param BackPicture
  341. * @desc 背景として表示するピクチャ(/img/pictures/)を指定できます。
  342. * サイズは画面サイズに合わせて拡縮されます。拡張子、パス不要。
  343. * @default
  344. * @require 1
  345. * @dir img/pictures/
  346. * @type file
  347. *
  348. * @param SelectAction
  349. * @desc 用語を選択したときの動作です。
  350. * @default 0
  351. * @type select
  352. * @option 使用不可
  353. * @value 0
  354. * @option アイテム使用
  355. * @value 1
  356. * @option スイッチ設定
  357. * @value 2
  358. *
  359. * @param SelectSwitchId
  360. * @desc 用語アイテムの選択時の動作がスイッチ設定の場合にONになるスイッチ番号です。キャンセルでOFFが設定されます。
  361. * @default 0
  362. * @type switch
  363. * @parent SelectAction
  364. *
  365. * @param SelectVariableId
  366. * @desc 用語アイテムの選択時の動作がアイテム使用の場合にアイテムIDが設定される変数番号です。キャンセルで-1が設定されます。
  367. * @default 0
  368. * @type variable
  369. * @parent SelectAction
  370. *
  371. * @param ConfirmMessage
  372. * @desc 用語アイテムを使用する際に確認メッセージが表示されるようになります。
  373. * @default false
  374. * @type boolean
  375. *
  376. * @param ConfirmUse
  377. * @desc 確認メッセージで使う場合のメッセージです。
  378. * @default 使う
  379. * @parent ConfirmMessage
  380. *
  381. * @param ConfirmNoUse
  382. * @desc 確認メッセージで使わない場合のメッセージです。
  383. * @default やめる
  384. * @parent ConfirmMessage
  385. *
  386. * @param GlossaryHelp
  387. * @desc 用語リスト選択時のヘルプ画面に表示するテキストです。未指定の場合、ヘルプウィンドウは非表示になります。
  388. * @default ゲーム中に登場する用語を解説しています。
  389. *
  390. * @param CategoryHelp
  391. * @desc 用語カテゴリ選択時のヘルプ画面に表示するテキストです。
  392. * @default カテゴリを選択してください。
  393. * @parent GlossaryHelp
  394. *
  395. * @param ConfirmHelp
  396. * @desc 用語アイテムの選択確認時に表示するテキストです。指定しなかった場合、何も表示されません。
  397. * @default
  398. * @parent GlossaryHelp
  399. *
  400. * @param UsingHelp
  401. * @desc 用語アイテムの使用後に表示するテキストです。指定しなかった場合、何も表示されません。
  402. * @default
  403. * @parent GlossaryHelp
  404. *
  405. * @param CompleteView
  406. * @desc カテゴリごとの収集率を表示します。コンプリートの目安です。
  407. * @default false
  408. * @type boolean
  409. *
  410. * @param CompleteMessage
  411. * @desc 収集率を表示する文言です。「%1」が収集率に変換されます。
  412. * @default 収集率 \c[2]%1\c[0] %
  413. * @parent CompleteView
  414. *
  415. * @param ShowingItemNumber
  416. * @desc 用語集アイテムの所持数を表示します。
  417. * @default false
  418. * @type boolean
  419. *
  420. * @param UsableDefault
  421. * @desc 用語集アイテムの初期状態での使用可否です。プラグインコマンドから個別に使用可否を変更できます。
  422. * @default true
  423. * @type boolean
  424. *
  425. * @param UseItemHistory
  426. * @desc ONにすると一度入手した用語アイテムを失っても辞書には表示されたままになります。
  427. * @default false
  428. * @type boolean
  429. *
  430. * @param GlossaryListWidth
  431. * @desc 用語集リストのウィンドウ横幅です。
  432. * @default 240
  433. * @type number
  434. * @parent Layout
  435. *
  436. * @param VisibleItemNotYet
  437. * @text 未入手アイテムの表示
  438. * @desc 未入手アイテムを指定した名前(???等)で表示します。指定しない場合この機能は無効になります。
  439. * @default
  440. */

  441. /*:ja
  442. * @plugindesc ゲーム内用語辞典プラグイン
  443. * @author トリアコンタン
  444. *
  445. * @param GlossaryInfo
  446. * @text 用語情報(設定必須)
  447. * @desc 用語辞典情報です。任意の用語辞典を追加できます。必ず1件以上の用語を登録してください。
  448. * @default ["{\"GlossaryType\":\"1\",\"CommandName\":\"用語辞典\",\"UseCategory\":\"false\",\"CommandSwitchId\":\"0\",\"BackPicture\":\"\",\"SelectAction\":\"0\",\"SelectSwitchId\":\"0\",\"SelectVariableId\":\"0\",\"ConfirmMessage\":\"false\",\"ConfirmUse\":\"使う\",\"ConfirmNoUse\":\"やめる\",\"GlossaryHelp\":\"ゲーム中に登場する用語を解説しています。\",\"CategoryHelp\":\"カテゴリを選択してください。\",\"ConfirmHelp\":\"\",\"UsingHelp\":\"\",\"CompleteView\":\"false\",\"CompleteMessage\":\"収集率 \\\\c[2]%1\\\\c[0] %\",\"ShowingItemNumber\":\"false\",\"UsableDefault\":\"true\",\"UseItemHistory\":\"false\",\"GlossaryListWidth\":\"240\",\"VisibleItemNotYet\":\"\"}"]
  449. * @type struct<GlossaryData>[]
  450. *
  451. * @param Layout
  452. * @text レイアウト
  453. * @desc レイアウト設定関連項目です。まとめ用の項目なのでここには何も入力しないでください。
  454. *
  455. * @param FontSize
  456. * @text フォントサイズ
  457. * @desc 用語集のフォントサイズです。
  458. * @default 22
  459. * @type number
  460. * @parent Layout
  461. *
  462. * @param AutoResizePicture
  463. * @text 画像の自動縮小
  464. * @desc ウィンドウ内にピクチャを表示する際、表示可能なように自動で縮小されます。テキスト位置を指定した場合は無効です。
  465. * @default true
  466. * @type boolean
  467. * @parent Layout
  468. *
  469. * @param PicturePosition
  470. * @text 画像の表示位置
  471. * @desc 画像の表示位置です。(top:ウィンドウの先頭 bottom:ウィンドウの下部 text:テキストの末尾)
  472. * @default top
  473. * @type select
  474. * @option top
  475. * @option bottom
  476. * @option text
  477. * @parent Layout
  478. *
  479. * @param TextPosition
  480. * @text テキストの表示位置
  481. * @desc テキストの表示Y座標です。0の場合は画像の表示位置によって自動設定されます。
  482. * @default 0
  483. * @type number
  484. *
  485. * @param PictureAlign
  486. * @text 画像の揃え
  487. * @desc 画像の揃えです。(left:左揃え center:中央揃え right:右揃え)
  488. * @default center
  489. * @type select
  490. * @option left
  491. * @option center
  492. * @option right
  493. * @parent Layout
  494. *
  495. * @param PicturePriority
  496. * @text 画像の優先度
  497. * @desc 画像の表示プライオリティです。(top:テキストの上 bottom:テキストの下)
  498. * @default top
  499. * @type select
  500. * @option top
  501. * @option bottom
  502. * @parent Layout
  503. *
  504. * @param ThroughBackPicture
  505. * @text 背景ピクチャ透過
  506. * @desc 背景ピクチャの背後に通常の背景(マップ画面)を表示します。
  507. * @default false
  508. * @type boolean
  509. * @parent Layout
  510. *
  511. * @param FramelessDesign
  512. * @text 枠なしデザイン
  513. * @desc 各種ウィンドウの枠と背景を非表示にします。
  514. * @default false
  515. * @type boolean
  516. * @parent Layout
  517. *
  518. * @param NewGlossaryColor
  519. * @text 新着用語カラー
  520. * @desc 新着用語を明示するためのカラーです。システムカラーから選択してください。
  521. * @default 2
  522. * @type number
  523. * @parent Layout
  524. *
  525. * @param PageWrap
  526. * @text ページ折り返し
  527. * @desc 複数のページが存在する場合、最後のページまで到達していたら最初のページに戻します。
  528. * @default true
  529. * @type boolean
  530. * @parent Layout
  531. *
  532. * @param AutoAddition
  533. * @text 自動登録
  534. * @desc 文章の表示の命令中に同一単語が出現した場合に自動登録します。(ON/OFF)
  535. * @default false
  536. * @type boolean
  537. *
  538. * @param AutoAdditionEnemy
  539. * @text 敵キャラ自動登録
  540. * @desc 敵キャラを撃破したときに敵キャラと同名の単語を自動登録します。(ON/OFF)
  541. * @default false
  542. * @type boolean
  543. *
  544. * @param SwitchAutoAdd
  545. * @text 自動登録IDスイッチ
  546. * @desc 用語アイテムの自動登録が行われた際に指定した番号のスイッチがONになります。何らかの通知を行いたい場合に指定します。
  547. * @default 0
  548. * @type switch
  549. * @parent AutoAddition
  550. *
  551. * @param VariableAutoAdd
  552. * @text 自動登録ID変数
  553. * @desc 用語アイテムの自動登録が行われた際に指定した番号の変数にアイテムIDが設定されます。
  554. * @default 0
  555. * @type variable
  556. * @parent AutoAddition
  557. *
  558. * @param CategoryOrder
  559. * @text カテゴリ並び順
  560. * @desc カテゴリ並び順を任意に変更したい場合はカテゴリ名を指定してください。
  561. * @default
  562. * @type string[]
  563. *
  564. * @param CategoryUnusable
  565. * @text 使用禁止カテゴリ
  566. * @desc ここで指定したカテゴリは「アイテム使用」が有効でも使用できなくなります。
  567. * @default
  568. * @type string[]
  569. *
  570. * @noteParam SGピクチャ
  571. * @noteRequire 1
  572. * @noteDir img/pictures/
  573. * @noteType file
  574. * @noteData items
  575. *
  576. * @noteParam SGPicture
  577. * @noteRequire 1
  578. * @noteDir img/pictures/
  579. * @noteType file
  580. * @noteData items
  581. *
  582. * @help ゲームに登場する用語を閲覧できる画面を追加します。
  583. * 用語を解説する画像およびテキスト説明がウィンドウに表示されます。
  584. *
  585. * ・使い方
  586. * 1. 用語として扱うアイテムをデータベースから登録してください。
  587. * 詳細な登録方法は、後述の「データ登録方法」をご参照ください。
  588. *
  589. * 2. パラメータの「用語情報」を設定してください。(項目をダブルクリック)
  590. * 当該パラメータを設定せずにプラグインコマンドから用語辞典を起動すると
  591. * エラーになるので注意してください。
  592. *
  593. * 用語は対象アイテムを取得することで閲覧可能になるほか、文章の表示の命令中で
  594. * 同一単語が出現した場合に自動的に登録する機能もあります。
  595. * (特定の用語を自動登録の対象外に指定することも可能です)
  596. *
  597. * 用語はすべてを一つのウィンドウで表示する方式と
  598. * カテゴリごとに分類して表示する方式が選択できます。
  599. * パラメータから表示方法を選択してください。
  600. * カテゴリごとに表示する場合はメモ欄に「<SGカテゴリ:XXX>」を指定してください。
  601. * カテゴリをカンマ区切りで指定すると、複数のカテゴリに所属できます。
  602. *
  603. * 例:<SGカテゴリ:XXX,YYY>
  604. *
  605. * メニュー画面およびプラグインコマンドから用語集画面に遷移できます。
  606. *
  607. * ・データ登録方法
  608. * 1.アイテムデータベースに新規データを登録して
  609. * 「アイテムタイプ」を「隠しアイテムA」もしくは「隠しアイテムB」に設定
  610. *
  611. * 2.「名前」に用語の名称を設定
  612. *
  613. * 3.「メモ欄」に以下の通り記述(不要な項目は省略可能)
  614. * <SG説明:説明文>           // 用語の説明文(※1)
  615. * <SG共通説明:説明文>       // 用語の共通説明文(使い回し用)
  616. * <SGカテゴリ:カテゴリ名>   // 用語の属するカテゴリの名称
  617. * <SG手動>                  // 用語を自動登録の対象から除外する
  618. * <SGピクチャ:ファイル名>   // 用語のピクチャのファイル名
  619. * <SG敵キャラ:敵キャラID>   // ピクチャの代わりに敵キャラの画像を表示(※2)
  620. * <SGピクチャ位置:text>     // ピクチャの表示位置
  621. * <SGテキスト位置:100>      // テキストの表示位置
  622. *  top:ウィンドウの先頭 bottom:ウィンドウの下部 text:テキストの末尾
  623. * <SGピクチャ優先度:top>    // ピクチャの表示プライオリティ
  624. *  top:テキストの上 bottom:テキストの下
  625. * <SGピクチャ拡大率:0.5>    // ピクチャの拡大率
  626. * <SGピクチャ揃え:right>    // ピクチャの揃え
  627. *  left:左揃え center:中央揃え right:右揃え
  628. * <SG収集対象外>            // 用語を収集率算出の対象外に設定
  629. * <SGテキスト色変化:1,10>   // スイッチ[1]がONのとき文字色を[10]に変更
  630. *
  631. * ※1 以下の特殊な制御文字が使用できます。
  632. * \COMMON[1]  // ID[1]のアイテムの<SG共通説明:aaa>に置き換えられます。
  633. * \mhp[3]     // 対象敵キャラの最大HP(3桁でゼロ埋め)
  634. * \mmp[3]     // 対象敵キャラの最大MP(3桁でゼロ埋め)
  635. * \atk[3]     // 対象敵キャラの攻撃力(3桁でゼロ埋め)
  636. * \def[3]     // 対象敵キャラの防御力(3桁でゼロ埋め)
  637. * \mag[3]     // 対象敵キャラの魔法力(3桁でゼロ埋め)
  638. * \mdf[3]     // 対象敵キャラの魔法防御(3桁でゼロ埋め)
  639. * \agi[3]     // 対象敵キャラの敏捷性(3桁でゼロ埋め)
  640. * \luk[3]     // 対象敵キャラの運(3桁でゼロ埋め)
  641. * \exp[3]     // 対象敵キャラの獲得経験値(3桁でゼロ埋め)
  642. * \money[3]   // 対象敵キャラの獲得ゴールド(3桁でゼロ埋め)
  643. * \drop[1]    // 対象敵キャラの[1]番目のドロップアイテム
  644. *
  645. * ※2 敵キャラIDを省略すると用語アイテムと同名の敵キャラ自動で設定されます。
  646. *
  647. * \DATA[prop] // 対象データのプロパティ「prop」に置き換えられます。(下記参照)
  648. * \DATA[description] // 対象データの説明
  649. * \DATA[price]       // 対象データの価格
  650. * \EFFECT_TYPE[0] // 対象データの[0]番目の使用効果の種別
  651. * \SCRIPT{aaa}  // スクリプト[aaa]を評価した結果。
  652. *               // ローカル変数[data]で対象データを参照できます。
  653. *
  654. * ・使用例1(0番目の使用効果の効果量(%))
  655. * \SCRIPT{data.effects[0].value1 * 100 + '%'}
  656. *
  657. * ・使用例2(0番目の使用効果の効果量)
  658. * \SCRIPT{data.effects[0].value2}
  659. *
  660. * さらに、一つの用語で複数のページを使用することができます。
  661. * ページは方向キーの左右で切り替えます。
  662. * <SG説明2:説明文>          // 2ページ目の用語の説明文
  663. * <SGピクチャ2:ファイル名>  // 2ページ目の用語のピクチャのファイル名
  664. * <SGピクチャ位置2:text>    // 2ページ目のピクチャの表示位置
  665. * <SG表示スイッチ2:1>       // スイッチ[1]がONのときのみ2ページ目以降表示(※)
  666. * ※2ページ目を非表示にすると自動的に3ページ目以降も非表示になります。
  667. *
  668. * 3ページ目以降も同様で、最大99ページまで指定できます。
  669. * 複数ページ表示する場合の1ページ目には「1」をつけないでください。
  670. * NG:<SG説明1:説明文>
  671. *
  672. * 種別の異なる用語辞典に用語を表示する場合は以下のタグが必要です。
  673. * <SG種別:2>   // 用語の属する種別番号
  674. *
  675. * 「YEP_MainMenuManager.js」と連携して、コマンドの表示制御を行うには
  676. * 「コマンド名称」の項目を空にした上で「YEP_MainMenuManager.js」の
  677. * パラメータを以下の通り設定してください。
  678. *
  679. * Menu X Name      : '用語辞典1'
  680. * Menu X Symbol    : glossary1
  681. * Menu X Main Bind : this.commandGlossary.bind(this, 1)
  682. *
  683. * ・追加機能1
  684. * 隠しアイテムでない「アイテム」「武器」「防具」も辞書画面に
  685. * 表示できるようになりました。隠しアイテムと同じ内容をメモ欄に記入します。
  686. * アイテム図鑑、武器図鑑、防具図鑑も作成できます。
  687. * この機能を利用する場合はパラメータ「入手履歴を使用」を有効にします。
  688. *
  689. * ・追加機能2
  690. * 用語リストはデフォルトではアイテムID順に表示されますが、
  691. * 以下のタグで表示順を個別に設定することができます。
  692. * 同一の表示順が重複した場合はIDの小さい方が先に表示されます。
  693. * <SG表示順:5> // ID[5]と同じ並び順で表示されます。
  694. * <SGOrder:5>  // 同上
  695. *
  696. * ・追加機能3
  697. * モンスター辞典の作成を支援します。
  698. * 1. パラメータ「敵キャラ自動登録」で戦闘した敵キャラと同名の用語を取得
  699. * 2. メモ欄<SG敵キャラ>で対象敵キャラの画像を表示
  700. * 3. \mhp[3]等の制御文字で対象敵キャラのパラメータを表示
  701. *
  702. * ・追加機能4
  703. * ひとつの用語に対して複数のピクチャを表示することができます。
  704. * メモ欄に以下のタグを記述し、ファイル名、X座標、Y座標をカンマ区切りで
  705. * 指定してください。
  706. * <SG追加1ピクチャ:aaa,1,2> // ピクチャ「aaa」をX[1] Y[2]に表示
  707. *
  708. * さらに追加で表示させたい場合は以下のように記述してください。
  709. * <SG追加2ピクチャ:bbb,2,3>
  710. *
  711. * プラグインコマンド詳細
  712. *  イベントコマンド「プラグインコマンド」から実行。
  713. *  (パラメータの間は半角スペースで区切る)
  714. *
  715. * GLOSSARY_GAIN_ALL or 用語集全取得
  716. *  データベースに登録している全ての用語を取得状態にします。
  717. *  対象は「隠しアイテム」扱いの用語のみですが、パラメータ「入手履歴を使用」が
  718. *  有効な場合は全てのアイテムを解禁します。(アイテム自体は取得しません)
  719. *
  720. * GLOSSARY_LOSE_ALL or 用語集全破棄
  721. *  データベースに登録している全ての用語アイテムが失われます。
  722. *
  723. * GLOSSARY_CALL or 用語集画面の呼び出し [種別] [カテゴリ] [リスト番号]
  724. *  用語集画面を呼び出します。
  725. *  種別を省略すると、自動で「1」になります。
  726. * 例:GLOSSARY_CALL 2
  727. *  カテゴリを指定すると指定した名称のカテゴリおよびリスト番号が指定された
  728. *  状態で用語辞典が開きます。
  729. * 例:GLOSSARY_CALL 2 人物 1
  730. *
  731. * GLOSSARY_BACK or 用語集画面に戻る
  732. *  最後に選択していた項目を再選択した状態で用語集画面を呼び出します。
  733. * 例:GLOSSARY_BACK
  734. *
  735. * GLOSSARY_ITEM_CHANGE_CATEGORY [アイテムID] [新カテゴリ]
  736. * 用語アイテムのカテゴリ変更 [アイテムID] [新カテゴリ]
  737. *  指定したIDのアイテムのカテゴリを別のものに変更します。 
  738. * 例:GLOSSARY_ITEM_CHANGE_CATEGORY 10 AAA
  739. * ※ 変更可能なのはアイテムのみです。武器と防具は変更できません。
  740. *
  741. * GLOSSARY_ITEM_CHANGE_USABLE [アイテムID] [ON or OFF]
  742. * 用語アイテムの使用禁止 [アイテムID] [ON or OFF]
  743. *  指定したIDのアイテムの使用禁止を変更します。(ON:可能 OFF:禁止)
  744. * 例:GLOSSARY_ITEM_CHANGE_USABLE 10 ON
  745. * ※ 変更可能なのはアイテムのみです。武器と防具は変更できません。
  746. *
  747. * ・スクリプト詳細
  748. * itemIdが用語アイテムとして使用可能なときにtrueを返します。
  749. * $gameParty.isUsableGlossaryItem(itemId);
  750. *
  751. * 指定したカテゴリ名および用語種別名に対応する収集率を返します。
  752. * 用語種別を省略した場合は[1]が設定されます。
  753. * $gameParty.getCompleteRate(categoryName, typeName);
  754. *
  755. * 利用規約:
  756. *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
  757. *  についても制限はありません。
  758. *  このプラグインはもうあなたのものです。
  759. */

  760. /*~struct~GlossaryData:ja
  761. *
  762. * @param GlossaryType
  763. * @text 用語種別
  764. * @desc 用語種別です。<SG種別:n>で指定した用語が表示されます。
  765. * @default 1
  766. * @type number
  767. * @min 1
  768. *
  769. * @param CommandName
  770. * @text コマンド名称
  771. * @desc メニュー画面に表示されるコマンド名です。空にするとメニュー画面に表示されなくなります。
  772. * @default 用語辞典
  773. *
  774. * @param UseCategory
  775. * @text カテゴリ分類
  776. * @desc 用語をカテゴリごとに分けて表示します。
  777. * @default false
  778. * @type boolean
  779. *
  780. * @param CommandSwitchId
  781. * @text 出現条件スイッチ
  782. * @desc 辞書コマンドの出現条件スイッチ番号です。0にすると無条件で表示されます。
  783. * @default 0
  784. * @type switch
  785. *
  786. * @param BackPicture
  787. * @text 背景ピクチャ
  788. * @desc 背景として表示するピクチャ(/img/pictures/)を指定できます。
  789. * サイズは画面サイズに合わせて拡縮されます。拡張子、パス不要。
  790. * @default
  791. * @require 1
  792. * @dir img/pictures/
  793. * @type file
  794. *
  795. * @param SelectAction
  796. * @text 選択時の動作
  797. * @desc 用語を選択したときの動作です。
  798. * @default 0
  799. * @type select
  800. * @option 使用不可
  801. * @value 0
  802. * @option アイテム使用
  803. * @value 1
  804. * @option スイッチ設定
  805. * @value 2
  806. *
  807. * @param SelectSwitchId
  808. * @text 選択スイッチ番号
  809. * @desc 用語アイテムの選択時の動作がスイッチ設定の場合にONになるスイッチ番号です。キャンセルでOFFが設定されます。
  810. * @default 0
  811. * @type switch
  812. * @parent SelectAction
  813. *
  814. * @param SelectVariableId
  815. * @text 選択用語変数番号
  816. * @desc 用語アイテムの選択時の動作がアイテム使用の場合にアイテムIDが設定される変数番号です。キャンセルで-1が設定されます。
  817. * @default 0
  818. * @type variable
  819. * @parent SelectAction
  820. *
  821. * @param ConfirmMessage
  822. * @text 確認メッセージ使用要否
  823. * @desc 用語アイテムを使用する際に確認メッセージが表示されるようになります。
  824. * @default false
  825. * @type boolean
  826. *
  827. * @param ConfirmUse
  828. * @text 確認_使う
  829. * @desc 確認メッセージで使う場合のメッセージです。
  830. * @default 使う
  831. * @parent ConfirmMessage
  832. *
  833. * @param ConfirmNoUse
  834. * @text 確認_使わない
  835. * @desc 確認メッセージで使わない場合のメッセージです。
  836. * @default やめる
  837. * @parent ConfirmMessage
  838. *
  839. * @param GlossaryHelp
  840. * @text 用語ヘルプ
  841. * @desc 用語リスト選択時のヘルプ画面に表示するテキストです。未指定の場合、ヘルプウィンドウは非表示になります。(改行コード:\n)
  842. * @default ゲーム中に登場する用語を解説しています。
  843. *
  844. * @param CategoryHelp
  845. * @text カテゴリヘルプ
  846. * @desc 用語カテゴリ選択時のヘルプ画面に表示するテキストです。(改行コード:\n)
  847. * @default カテゴリを選択してください。
  848. * @parent GlossaryHelp
  849. *
  850. * @param ConfirmHelp
  851. * @text 確認ヘルプ
  852. * @desc 用語アイテムの選択確認時に表示するテキストです。指定しなかった場合、何も表示されません。(改行コード:\n)
  853. * @default
  854. * @parent GlossaryHelp
  855. *
  856. * @param UsingHelp
  857. * @text 使用後ヘルプ
  858. * @desc 用語アイテムの使用後に表示するテキストです。指定しなかった場合、何も表示されません。(改行コード:\n)
  859. * @default
  860. * @parent GlossaryHelp
  861. *
  862. * @param CompleteView
  863. * @text 収集率表示
  864. * @desc カテゴリごとの収集率を表示します。コンプリートの目安です。
  865. * @default false
  866. * @type boolean
  867. *
  868. * @param CompleteMessage
  869. * @text 収集率メッセージ
  870. * @desc 収集率を表示する文言です。「%1」が収集率に変換されます。
  871. * @default 収集率 \c[2]%1\c[0] %
  872. * @parent CompleteView
  873. *
  874. * @param ShowingItemNumber
  875. * @text 所持数表示
  876. * @desc 用語集アイテムの所持数を表示します。
  877. * @default false
  878. * @type boolean
  879. *
  880. * @param UsableDefault
  881. * @text デフォルト使用可否
  882. * @desc 用語集アイテムの初期状態での使用可否です。プラグインコマンドから個別に使用可否を変更できます。
  883. * @default true
  884. * @type boolean
  885. *
  886. * @param UseItemHistory
  887. * @text 入手履歴を使用
  888. * @desc ONにすると一度入手した用語アイテムを失っても辞書には表示されたままになります。
  889. * @default false
  890. * @type boolean
  891. *
  892. * @param GlossaryListWidth
  893. * @text 用語集リスト横幅
  894. * @desc 用語集リストのウィンドウ横幅です。
  895. * @default 240
  896. * @type number
  897. *
  898. * @param VisibleItemNotYet
  899. * @text 未入手アイテムの表示
  900. * @desc 未入手アイテムを指定した名前(???等)で表示します。指定しない場合この機能は無効になります。
  901. * @default
  902. */

  903. /**
  904. * 用語集画面です。
  905. * @constructor
  906. */
  907. function Scene_Glossary() {
  908.     this.initialize.apply(this, arguments);
  909. }

  910. /**
  911. * 用語集カテゴリウィンドウです。
  912. * @constructor
  913. */
  914. function Window_GlossaryCategory() {
  915.     this.initialize.apply(this, arguments);
  916. }

  917. /**
  918. * 用語集リストウィンドウです。
  919. * @constructor
  920. */
  921. function Window_GlossaryList() {
  922.     this.initialize.apply(this, arguments);
  923. }

  924. /**
  925. * 用語集確認ウィンドウです。
  926. * @constructor
  927. */
  928. function Window_GlossaryConfirm() {
  929.     this.initialize.apply(this, arguments);
  930. }

  931. /**
  932. * 用語集ウィンドウです。
  933. * @constructor
  934. */
  935. function Window_Glossary() {
  936.     this.initialize.apply(this, arguments);
  937. }

  938. /**
  939. * 用語集収集率ウィンドウです。
  940. * @constructor
  941. */
  942. function Window_GlossaryComplete() {
  943.     this.initialize.apply(this, arguments);
  944. }

  945. (function() {
  946.     'use strict';
  947.     var metaTagPrefix = 'SG';

  948.     var getMetaValue = function(object, name) {
  949.         var metaTagName = metaTagPrefix + (name ? name : '');
  950.         return object.meta.hasOwnProperty(metaTagName) ? object.meta[metaTagName] : undefined;
  951.     };

  952.     var getMetaValues = function(object, names, index) {
  953.         var footer = index > 0 ? String(index + 1) : '';
  954.         if (!Array.isArray(names)) return getMetaValue(object, names + footer);
  955.         for (var i = 0, n = names.length; i < n; i++) {
  956.             var value = getMetaValue(object, names[i] + footer);
  957.             if (value !== undefined) return value;
  958.         }
  959.         return undefined;
  960.     };

  961.     var getArgNumber = function(arg, min, max) {
  962.         if (arguments.length < 2) min = -Infinity;
  963.         if (arguments.length < 3) max = Infinity;
  964.         return convertEscapeCharactersAndParse(arg, true).clamp(min, max);
  965.     };

  966.     var getArgBoolean = function(arg) {
  967.         return arg.toUpperCase() === 'ON' || arg.toUpperCase() === 'TRUE';
  968.     };

  969.     var getArgString = function(arg, upperFlg) {
  970.         if (arg !== String(arg)) {
  971.             return arg;
  972.         }
  973.         arg = convertEscapeCharactersAndParse(arg, false);
  974.         return upperFlg ? arg.toUpperCase() : arg;
  975.     };

  976.     var convertEscapeCharactersAndParse = function(text, toNumber) {
  977.         if (text === null || text === undefined) {
  978.             text = toNumber ? '0' : '';
  979.         }
  980.         if (SceneManager._scene._windowLayer) {
  981.             var winObj = SceneManager._scene._windowLayer.children[0];
  982.             text       = winObj.convertEscapeCharacters(text);
  983.         } else {
  984.             text = convertEscapeCharacters(text);
  985.         }
  986.         return toNumber ? parseFloat(text) : text;
  987.     };

  988.     var convertEscapeCharacters = function(text) {
  989.         text = text.replace(/\\/g, '\x1b');
  990.         text = text.replace(/\x1b\x1b/g, '\\');
  991.         text = text.replace(/\x1bV\[(\d+)]/gi, function() {
  992.             return $gameVariables.value(parseInt(arguments[1]));
  993.         }.bind(this));
  994.         text = text.replace(/\x1bV\[(\d+)]/gi, function() {
  995.             return $gameVariables.value(parseInt(arguments[1]));
  996.         }.bind(this));
  997.         text = text.replace(/\x1bN\[(\d+)]/gi, function() {
  998.             return this.actorName(parseInt(arguments[1]));
  999.         }.bind(this));
  1000.         text = text.replace(/\x1bP\[(\d+)]/gi, function() {
  1001.             return this.partyMemberName(parseInt(arguments[1]));
  1002.         }.bind(this));
  1003.         text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
  1004.         return text;
  1005.     };

  1006.     //=============================================================================
  1007.     // パラメータの取得と整形
  1008.     //=============================================================================
  1009.     var createPluginParameter = function(pluginName) {
  1010.         var paramReplacer = function(key, value) {
  1011.             if (value === 'null') {
  1012.                 return value;
  1013.             }
  1014.             if (value[0] === '"' && value[value.length - 1] === '"') {
  1015.                 return value;
  1016.             }
  1017.             try {
  1018.                 return JSON.parse(value);
  1019.             } catch (e) {
  1020.                 return value;
  1021.             }
  1022.         };
  1023.         var parameter     = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
  1024.         PluginManager.setParameters(pluginName, parameter);
  1025.         return parameter;
  1026.     };

  1027.     var param = createPluginParameter('SceneGlossary');
  1028.     if (!param.GlossaryInfo) {
  1029.         param.GlossaryInfo = [];
  1030.     }

  1031.     //=============================================================================
  1032.     // Game_Interpreter
  1033.     //  プラグインコマンドを追加定義します。
  1034.     //=============================================================================
  1035.     var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;
  1036.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  1037.         _Game_Interpreter_pluginCommand.apply(this, arguments);
  1038.         this.pluginCommandSceneGlossary(command, args);
  1039.     };

  1040.     Game_Interpreter.prototype.pluginCommandSceneGlossary = function(command, args) {
  1041.         switch (command.toUpperCase()) {
  1042.             case 'GLOSSARY_CALL' :
  1043.             case '用語集画面の呼び出し' :
  1044.                 $gameParty.clearGlossaryIndex();
  1045.                 $gameParty.setSelectedGlossaryType(getArgNumber(args[0], 1));
  1046.                 if (args[1]) {
  1047.                     var index = $gameParty.setGlossaryCategoryIndexByName(args[1]);
  1048.                     if (index >= 0) {
  1049.                         $gameParty.setGlossaryListIndex(getArgNumber(args[2]) || 0);
  1050.                     }
  1051.                 }
  1052.                 SceneManager.push(Scene_Glossary);
  1053.                 break;
  1054.             case 'GLOSSARY_GAIN_ALL' :
  1055.             case '用語集全取得' :
  1056.                 $gameParty.gainGlossaryAll();
  1057.                 break;
  1058.             case 'GLOSSARY_LOSE_ALL' :
  1059.             case '用語集全破棄' :
  1060.                 $gameParty.loseGlossaryAll();
  1061.                 break;
  1062.             case 'GLOSSARY_BACK' :
  1063.             case '用語集画面に戻る' :
  1064.                 if (args[0]) {
  1065.                     $gameParty.setSelectedGlossaryType(getArgNumber(args[0], 1));
  1066.                 }
  1067.                 SceneManager.push(Scene_Glossary);
  1068.                 break;
  1069.             case 'GLOSSARY_ITEM_CHANGE_CATEGORY' :
  1070.             case '用語アイテムのカテゴリ変更' :
  1071.                 $gameParty.changeGlossaryCategory(getArgNumber(args[0], 1), args[1]);
  1072.                 break;
  1073.             case 'GLOSSARY_ITEM_CHANGE_USABLE' :
  1074.             case '用語アイテムの使用禁止' :
  1075.                 $gameParty.changeGlossaryItemUsable(getArgNumber(args[0], 1), getArgBoolean(args[1]));
  1076.                 break;
  1077.         }
  1078.     };

  1079.     //=============================================================================
  1080.     // DataManager
  1081.     //  種別コードを返します。
  1082.     //=============================================================================
  1083.     DataManager.getItemTypeCode = function(item) {
  1084.         if (this.isItem(item)) {
  1085.             return 0;
  1086.         } else if (this.isWeapon(item)) {
  1087.             return 1;
  1088.         } else if (this.isArmor(item)) {
  1089.             return 2;
  1090.         } else {
  1091.             return 3;
  1092.         }
  1093.     };

  1094.     //=============================================================================
  1095.     // Game_System
  1096.     //  ロード完了時に履歴情報フィールドを必要に応じて初期化します。
  1097.     //=============================================================================
  1098.     var _Game_System_onAfterLoad      = Game_System.prototype.onAfterLoad;
  1099.     Game_System.prototype.onAfterLoad = function() {
  1100.         _Game_System_onAfterLoad.apply(this, arguments);
  1101.         $gameParty.initAllItemHistory();
  1102.     };

  1103.     //=============================================================================
  1104.     // Game_Party
  1105.     //  用語集アイテムの管理を追加定義します。
  1106.     //=============================================================================
  1107.     var _Game_Party_initAllItems      = Game_Party.prototype.initAllItems;
  1108.     Game_Party.prototype.initAllItems = function() {
  1109.         _Game_Party_initAllItems.apply(this, arguments);
  1110.         this.initAllItemHistory();
  1111.     };

  1112.     Game_Party.prototype.initAllItemHistory = function() {
  1113.         this._itemHistory   = this._itemHistory || {};
  1114.         this._weaponHistory = this._weaponHistory || {};
  1115.         this._armorHistory  = this._armorHistory || {};
  1116.         this.items().concat(this.weapons()).concat(this.armors()).forEach(function(item) {
  1117.             this.gainItemHistory(item);
  1118.         }, this);
  1119.     };

  1120.     Game_Party.prototype.isGlossaryItem = function(item) {
  1121.         return item && getMetaValues(item, ['説明', 'Description']) !== undefined;
  1122.     };

  1123.     Game_Party.prototype.isGlossaryHiddenItem = function(item) {
  1124.         return this.isGlossaryItem(item) && item.itypeId > 2;
  1125.     };

  1126.     Game_Party.prototype.isSameGlossaryType = function(item) {
  1127.         var type     = this.getSelectedGlossaryType();
  1128.         var itemType = getArgNumber(getMetaValues(item, ['種別', 'Type']));
  1129.         return type > 1 ? itemType === type : !itemType || itemType === type;
  1130.     };

  1131.     Game_Party.prototype.getGlossaryCategory = function(item) {
  1132.         var customCategory = this._customGlossaryCategoryList ? this._customGlossaryCategoryList[item.id] : undefined;
  1133.         return customCategory ? customCategory : getMetaValues(item, ['カテゴリ', 'Category']) || '';
  1134.     };

  1135.     Game_Party.prototype.getGlossaryCategoryList = function(item) {
  1136.         return this.getGlossaryCategory(item).split(',');
  1137.     };

  1138.     Game_Party.prototype.hasGlossary = function(item) {
  1139.         return this._glossarySetting.UseItemHistory ? this.hasItemHistory(item) : this.hasItem(item);
  1140.     };

  1141.     Game_Party.prototype.hasItemHistory = function(item) {
  1142.         return this.swapItemHash(this.hasItem.bind(this), [item]);
  1143.     };

  1144.     Game_Party.prototype.getAllGlossaryList = function(needTypeCheck, needHavingCheck, categoryName) {
  1145.         return $dataItems.concat($dataWeapons).concat($dataArmors).filter(function(item) {
  1146.             return item && this.isGlossaryItem(item) &&
  1147.                 (!needTypeCheck || this.isSameGlossaryType(item)) &&
  1148.                 (!needHavingCheck || this.hasGlossary(item)) &&
  1149.                 (!categoryName || this.hasGlossaryCategory(item, categoryName));
  1150.         }.bind(this));
  1151.     };

  1152.     Game_Party.prototype.getAllHiddenGlossaryList = function() {
  1153.         return $dataItems.filter(function(item) {
  1154.             return item && this.isGlossaryHiddenItem(item);
  1155.         }.bind(this));
  1156.     };

  1157.     Game_Party.prototype.getHasGlossaryPercent = function(categoryName) {
  1158.         var hasCount = 0, allCount = 0;
  1159.         this.getAllGlossaryList(true, false, categoryName).forEach(function(item) {
  1160.             if (this.isNoCollect(item)) {
  1161.                 return;
  1162.             }
  1163.             if (this.hasGlossary(item)) {
  1164.                 hasCount++;
  1165.             }
  1166.             allCount++;
  1167.         }.bind(this));
  1168.         return allCount > 0 ? Math.floor(hasCount / allCount * 100) : 0;
  1169.     };

  1170.     Game_Party.prototype.isNoCollect = function(item) {
  1171.         return getMetaValues(item, ['収集対象外', 'NoCollect']) || this.isIndependentItem(item);
  1172.     };

  1173.     Game_Party.prototype.isIndependentItem = function(item) {
  1174.         return typeof Yanfly !== 'undefined' && Yanfly.Param && Yanfly.Param.ItemStartingId <= item.id;
  1175.     };

  1176.     Game_Party.prototype.getCompleteRate = function(categoryName, typeName) {
  1177.         if (!typeName) {
  1178.             typeName = 1;
  1179.         }
  1180.         this.setSelectedGlossaryType(typeName);
  1181.         return this.getHasGlossaryPercent(categoryName);
  1182.     };

  1183.     Game_Party.prototype.hasGlossaryCategory = function(item, categoryName) {
  1184.         return this.getGlossaryCategoryList(item).contains(categoryName);
  1185.     };

  1186.     Game_Party.prototype.getAllGlossaryCategory = function() {
  1187.         var list          = [];
  1188.         var visibleNotYet = this.isUseGlossaryVisibleItemNotYet();
  1189.         this.getAllGlossaryList(true, !visibleNotYet, '').forEach(function(item) {
  1190.             this.getGlossaryCategoryList(item).forEach(function(category) {
  1191.                 if (category && !list.contains(category)) {
  1192.                     list.push(category);
  1193.                 }
  1194.             }, this);
  1195.         }, this);
  1196.         return param.CategoryOrder.length > 0 ? list.sort(this._compareOrderGlossaryCategory.bind(this)) : list;
  1197.     };

  1198.     /**
  1199.      * @private
  1200.      */
  1201.     Game_Party.prototype._compareOrderGlossaryCategory = function(a, b) {
  1202.         var order       = param.CategoryOrder;
  1203.         var orderLength = order.length + 1;
  1204.         var orderA      = order.indexOf(a) + 1 || orderLength;
  1205.         var orderB      = order.indexOf(b) + 1 || orderLength;
  1206.         return orderA - orderB;
  1207.     };

  1208.     Game_Party.prototype.gainGlossaryFromText = function(text) {
  1209.         this.getAllHiddenGlossaryList().forEach(function(item) {
  1210.             if (!this.hasItem(item) && this.isAutoGlossaryWord(item) && text.contains(item.name)) {
  1211.                 this.setAutoAdditionTrigger(item);
  1212.                 this.gainGlossary(item);
  1213.             }
  1214.         }.bind(this));
  1215.     };

  1216.     Game_Party.prototype.setAutoAdditionTrigger = function(item) {
  1217.         if (param.SwitchAutoAdd > 0) {
  1218.             $gameSwitches.setValue(param.SwitchAutoAdd, true);
  1219.         }
  1220.         if (param.VariableAutoAdd > 0) {
  1221.             $gameVariables.setValue(param.VariableAutoAdd, item.id);
  1222.         }
  1223.     };

  1224.     Game_Party.prototype.isAutoGlossaryWord = function(item) {
  1225.         return !getMetaValues(item, ['手動', 'Manual']);
  1226.     };

  1227.     Game_Party.prototype.gainGlossaryAll = function() {
  1228.         this.getAllGlossaryList(false, false, '').forEach(function(item) {
  1229.             if (this.hasItem(item)) {
  1230.                 return;
  1231.             }
  1232.             if (this.isGlossaryHiddenItem(item)) {
  1233.                 this.gainGlossary(item);
  1234.             } else {
  1235.                 this.gainItemHistory(item);
  1236.             }
  1237.         }.bind(this));
  1238.     };

  1239.     Game_Party.prototype.loseGlossaryAll = function() {
  1240.         this.getAllGlossaryList(false, false, '').forEach(function(item) {
  1241.             if (this.hasItem(item)) {
  1242.                 this.loseGlossary(item);
  1243.             }
  1244.         }.bind(this));
  1245.     };

  1246.     Game_Party.prototype.gainGlossary = function(item) {
  1247.         this.gainItem(item, 1, false);
  1248.     };

  1249.     Game_Party.prototype.loseGlossary = function(item) {
  1250.         this.loseItem(item, this.maxItems(), false);
  1251.     };

  1252.     var _Game_Party_gainItem      = Game_Party.prototype.gainItem;
  1253.     Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
  1254.         _Game_Party_gainItem.apply(this, arguments);
  1255.         if (amount > 0) this.gainItemHistory(item);
  1256.     };

  1257.     Game_Party.prototype.gainItemHistory = function(item) {
  1258.         var container = this.itemHistoryContainer(item);
  1259.         if (container) {
  1260.             container[item.id] = true;
  1261.         }
  1262.     };

  1263.     Game_Party.prototype.itemHistoryContainer = function(item) {
  1264.         return this.swapItemHash(this.itemContainer.bind(this), [item]);
  1265.     };

  1266.     Game_Party.prototype.swapItemHash = function(caller, args) {
  1267.         var prevItems   = this._items;
  1268.         var prevWeapons = this._weapons;
  1269.         var prevArmor   = this._armors;
  1270.         this._items     = this._itemHistory;
  1271.         this._weapons   = this._weaponHistory;
  1272.         this._armors    = this._armorHistory;
  1273.         var result      = caller.apply(this, args);
  1274.         this._items     = prevItems;
  1275.         this._weapons   = prevWeapons;
  1276.         this._armors    = prevArmor;
  1277.         return result;
  1278.     };

  1279.     Game_Party.prototype.setConfirmedGlossaryItem = function(item) {
  1280.         if (!this._confirmedGlossaryItems) {
  1281.             this._confirmedGlossaryItems = [];
  1282.         }
  1283.         if (!this.hasGlossary(item)) {
  1284.             return false;
  1285.         }
  1286.         if (!this._confirmedGlossaryItems.contains(item.id)) {
  1287.             this._confirmedGlossaryItems.push(item.id);
  1288.             return true;
  1289.         }
  1290.         return false;
  1291.     };

  1292.     Game_Party.prototype.isConfirmedGlossaryItem = function(item) {
  1293.         if (!this.hasGlossary(item)) {
  1294.             return true;
  1295.         }
  1296.         return this._confirmedGlossaryItems ? this._confirmedGlossaryItems.contains(item.id) : false;
  1297.     };

  1298.     Game_Party.prototype.setGlossaryCategoryIndex = function(index) {
  1299.         this.initGlossaryIndex();
  1300.         this._glossaryCategoryIndex[this.getSelectedGlossaryType()] = index;
  1301.     };

  1302.     Game_Party.prototype.setGlossaryCategoryIndexByName = function(name) {
  1303.         var list  = this.getAllGlossaryCategory();
  1304.         var index = list.indexOf(name);
  1305.         if (index >= 0) {
  1306.             this.setGlossaryCategoryIndex(index);
  1307.         }
  1308.         return index;
  1309.     };

  1310.     Game_Party.prototype.getGlossaryCategoryIndex = function() {
  1311.         this.initGlossaryIndex();
  1312.         return this._glossaryCategoryIndex[this.getSelectedGlossaryType()];
  1313.     };

  1314.     Game_Party.prototype.setGlossaryListIndex = function(index) {
  1315.         this.initGlossaryIndex();
  1316.         this._glossaryListIndex[this.getSelectedGlossaryType()] = index;
  1317.     };

  1318.     Game_Party.prototype.getGlossaryListIndex = function() {
  1319.         this.initGlossaryIndex();
  1320.         return this._glossaryListIndex[this.getSelectedGlossaryType()];
  1321.     };

  1322.     Game_Party.prototype.clearGlossaryIndex = function() {
  1323.         var type = this.getSelectedGlossaryType();
  1324.         this.initGlossaryIndex();
  1325.         this._glossaryListIndex[type]     = -1;
  1326.         this._glossaryCategoryIndex[type] = -1;
  1327.     };

  1328.     Game_Party.prototype.initGlossaryIndex = function() {
  1329.         if (!this._glossaryCategoryIndex) {
  1330.             this._glossaryCategoryIndex = {};
  1331.         }
  1332.         if (!this._glossaryListIndex) {
  1333.             this._glossaryListIndex = {};
  1334.         }
  1335.     };

  1336.     Game_Party.prototype.setSelectedGlossaryType = function(type, index) {
  1337.         this._selectedGlossaryType = this.setupGlossary(type, index);
  1338.     };

  1339.     Game_Party.prototype.setupGlossary = function(type, index) {
  1340.         var glossary = param.GlossaryInfo;
  1341.         if (glossary.length === 0) {
  1342.             var errMes = $gameSystem.isJapanese() ? '用語情報が設定されていません。パラメータで設定してください。' :
  1343.                 'Glossary Info is empty. Please set plugin parameter.';
  1344.             throw new Error(errMes);
  1345.         }
  1346.         this._glossarySetting = glossary.filter(function(glossaryItem) {
  1347.             return glossaryItem.GlossaryType === type;
  1348.         })[0];
  1349.         if (!this._glossarySetting) {
  1350.             this._glossarySetting = glossary[index] || glossary[0];
  1351.         }
  1352.         return this._glossarySetting.GlossaryType;
  1353.     };

  1354.     Game_Party.prototype.getSelectedGlossaryType = function() {
  1355.         return this._selectedGlossaryType || 0;
  1356.     };

  1357.     Game_Party.prototype.isUseGlossaryCategory = function() {
  1358.         return this._glossarySetting.UseCategory;
  1359.     };

  1360.     Game_Party.prototype.getGlossaryBackPicture = function() {
  1361.         return this._glossarySetting.BackPicture;
  1362.     };

  1363.     Game_Party.prototype.getGlossarySelectAction = function() {
  1364.         return this._glossarySetting.SelectAction;
  1365.     };

  1366.     Game_Party.prototype.setGlossarySelectSwitchValue = function(value) {
  1367.         $gameSwitches.setValue(this._glossarySetting.SelectSwitchId, value);
  1368.     };

  1369.     Game_Party.prototype.setGlossarySelectVariableValue = function(itemId) {
  1370.         $gameVariables.setValue(this._glossarySetting.SelectVariableId, itemId);
  1371.     };

  1372.     Game_Party.prototype.isUseGlossaryConfirm = function() {
  1373.         return this._glossarySetting.ConfirmMessage;
  1374.     };

  1375.     Game_Party.prototype.getGlossaryConfirmMessages = function() {
  1376.         return [this._glossarySetting.ConfirmUse, this._glossarySetting.ConfirmNoUse];
  1377.     };

  1378.     Game_Party.prototype.getGlossaryHelpMessages = function() {
  1379.         var setting = this._glossarySetting;
  1380.         return [setting.GlossaryHelp, setting.CategoryHelp, setting.ConfirmHelp, setting.UsingHelp];
  1381.     };

  1382.     Game_Party.prototype.isUseGlossaryComplete = function() {
  1383.         return this._glossarySetting.CompleteView;
  1384.     };

  1385.     Game_Party.prototype.getGlossaryCompleteMessage = function() {
  1386.         return this._glossarySetting.CompleteMessage;
  1387.     };

  1388.     Game_Party.prototype.isUseGlossaryItemNumber = function() {
  1389.         return this._glossarySetting.ShowingItemNumber;
  1390.     };

  1391.     Game_Party.prototype.isUseGlossaryVisibleItemNotYet = function() {
  1392.         return !!this._glossarySetting.VisibleItemNotYet;
  1393.     };

  1394.     Game_Party.prototype.getTextItemNotYet = function() {
  1395.         return this._glossarySetting.VisibleItemNotYet;
  1396.     };

  1397.     Game_Party.prototype.changeGlossaryCategory = function(itemId, newCategory) {
  1398.         if (!this._customGlossaryCategoryList) {
  1399.             this._customGlossaryCategoryList = [];
  1400.         }
  1401.         this._customGlossaryCategoryList[itemId] = newCategory;
  1402.     };

  1403.     Game_Party.prototype.changeGlossaryItemUsable = function(itemId, usable) {
  1404.         if (!this._customGlossaryUsableList) {
  1405.             this._customGlossaryUsableList = [];
  1406.         }
  1407.         this._customGlossaryUsableList[itemId] = usable;
  1408.     };

  1409.     Game_Party.prototype.isUsableGlossaryItem = function(itemId) {
  1410.         var usable = this._customGlossaryUsableList ? this._customGlossaryUsableList[itemId] : undefined;
  1411.         return usable !== undefined ? usable : this._glossarySetting.UsableDefault;
  1412.     };

  1413.     Game_Party.prototype.getGlossaryListWidth = function() {
  1414.         return this._glossarySetting.GlossaryListWidth || 160;
  1415.     };

  1416.     //=============================================================================
  1417.     // Game_Troop
  1418.     //  敵キャラの名前を自動登録します。
  1419.     //=============================================================================
  1420.     var _Game_Troop_setup      = Game_Troop.prototype.setup;
  1421.     Game_Troop.prototype.setup = function(troopId) {
  1422.         _Game_Troop_setup.apply(this, arguments);
  1423.         if (param.AutoAdditionEnemy) {
  1424.             this.addEnemyGlossary();
  1425.         }
  1426.     };

  1427.     Game_Troop.prototype.addEnemyGlossary = function() {
  1428.         this.members().forEach(function(enemy) {
  1429.             $gameParty.gainGlossaryFromText(enemy.originalName());
  1430.         });
  1431.     };

  1432.     //=============================================================================
  1433.     // Scene_Menu
  1434.     //  用語集画面の呼び出しを追加します。
  1435.     //=============================================================================
  1436.     Scene_Menu.isVisibleGlossaryCommand = function(index) {
  1437.         var glossaryItem = param.GlossaryInfo[index];
  1438.         if (!glossaryItem || !glossaryItem.CommandName) {
  1439.             return false;
  1440.         }
  1441.         return !glossaryItem.CommandSwitchId || $gameSwitches.value(glossaryItem.CommandSwitchId);
  1442.     };

  1443.     var _Scene_Menu_createCommandWindow      = Scene_Menu.prototype.createCommandWindow;
  1444.     Scene_Menu.prototype.createCommandWindow = function() {
  1445.         _Scene_Menu_createCommandWindow.apply(this, arguments);
  1446.         for (var i = 0; i < param.GlossaryInfo.length; i++) {
  1447.             if (Scene_Menu.isVisibleGlossaryCommand(i)) {
  1448.                 this._commandWindow.setHandler('glossary' + String(i + 1), this.commandGlossary.bind(this, null, i));
  1449.             }
  1450.         }
  1451.     };

  1452.     Scene_Menu.prototype.commandGlossary = function(type, typeIndex) {
  1453.         $gameParty.clearGlossaryIndex();
  1454.         $gameParty.setSelectedGlossaryType(type, typeIndex);
  1455.         SceneManager.push(Scene_Glossary);
  1456.     };

  1457.     //=============================================================================
  1458.     // Window_MenuCommand
  1459.     //  用語集画面の呼び出しの選択肢を追加定義します。
  1460.     //=============================================================================
  1461.     var _Window_MenuCommand_addOriginalCommands      = Window_MenuCommand.prototype.addOriginalCommands;
  1462.     Window_MenuCommand.prototype.addOriginalCommands = function() {
  1463.         _Window_MenuCommand_addOriginalCommands.apply(this, arguments);
  1464.         param.GlossaryInfo.forEach(function(glossaryInfo, index) {
  1465.             var glossaryName = glossaryInfo.CommandName;
  1466.             if (Scene_Menu.isVisibleGlossaryCommand(index)) {
  1467.                 if (typeof TranslationManager !== 'undefined') {
  1468.                     TranslationManager.translateIfNeed(glossaryName, function(translatedText) {
  1469.                         glossaryName = translatedText;
  1470.                     });
  1471.                 }
  1472.                 this.addCommand(glossaryName, 'glossary' + String(index + 1), this.isGlossaryEnabled(index));
  1473.             }
  1474.         }, this);
  1475.     };

  1476.     Window_MenuCommand.prototype.isGlossaryEnabled = function() {
  1477.         return true;
  1478.     };

  1479.     //=============================================================================
  1480.     // Window_EventItem
  1481.     //  用語集アイテムをアイテム選択の候補から除外します。
  1482.     //=============================================================================
  1483.     var _Window_EventItem_includes      = Window_EventItem.prototype.includes;
  1484.     Window_EventItem.prototype.includes = function(item) {
  1485.         return _Window_EventItem_includes.apply(this, arguments) && !$gameParty.isGlossaryHiddenItem(item);
  1486.     };

  1487.     //=============================================================================
  1488.     // Window_BattleItem
  1489.     //  用語集アイテムをアイテム選択の候補から除外します。
  1490.     //=============================================================================
  1491.     var _Window_BattleItem_includes      = Window_BattleItem.prototype.includes;
  1492.     Window_BattleItem.prototype.includes = function(item) {
  1493.         return _Window_BattleItem_includes.apply(this, arguments) && !$gameParty.isGlossaryHiddenItem(item);
  1494.     };

  1495.     //=============================================================================
  1496.     // Window_Message
  1497.     //  メッセージに登場した単語を用語集に加えます。
  1498.     //=============================================================================
  1499.     var _Window_Message_startMessage      = Window_Message.prototype.startMessage;
  1500.     Window_Message.prototype.startMessage = function() {
  1501.         _Window_Message_startMessage.apply(this, arguments);
  1502.         if (param.AutoAddition) $gameParty.gainGlossaryFromText(this.convertEscapeCharacters(this._textState.text));
  1503.     };

  1504.     //=============================================================================
  1505.     // Window_ScrollText
  1506.     //  メッセージに登場した単語を用語集に加えます。
  1507.     //=============================================================================
  1508.     var _Window_ScrollText_startMessage      = Window_ScrollText.prototype.startMessage;
  1509.     Window_ScrollText.prototype.startMessage = function() {
  1510.         _Window_ScrollText_startMessage.apply(this, arguments);
  1511.         if (param.AutoAddition) $gameParty.gainGlossaryFromText(this.convertEscapeCharacters(this._text));
  1512.     };

  1513.     //=============================================================================
  1514.     // Scene_Glossary
  1515.     //  用語集画面を扱うクラスです。
  1516.     //=============================================================================
  1517.     Scene_Glossary.prototype             = Object.create(Scene_ItemBase.prototype);
  1518.     Scene_Glossary.prototype.constructor = Scene_Glossary;

  1519.     Scene_Glossary.prototype.create = function() {
  1520.         Scene_ItemBase.prototype.create.call(this);
  1521.         this.createHelpWindow();
  1522.         this.createGlossaryWindow();
  1523.         this.createGlossaryListWindow();
  1524.         this.createGlossaryCategoryWindow();
  1525.         this.createGlossaryCompleteWindow();
  1526.         this.createConfirmWindow();
  1527.         this.createActorWindow();
  1528.         this.setInitActivateWindow();
  1529.     };

  1530.     Scene_Glossary.prototype.createHelpWindow = function() {
  1531.         Scene_MenuBase.prototype.createHelpWindow.apply(this, arguments);
  1532.         this._helpTexts = $gameParty.getGlossaryHelpMessages();
  1533.         this.updateHelp('');
  1534.         this._helpWindow.setFramelessDesign();
  1535.     };

  1536.     Scene_Glossary.prototype.createGlossaryWindow = function() {
  1537.         this._glossaryWindow = new Window_Glossary($gameParty.getGlossaryListWidth(), this._helpWindow.height);
  1538.         this.addWindow(this._glossaryWindow);
  1539.     };

  1540.     Scene_Glossary.prototype.createGlossaryListWindow = function() {
  1541.         this._glossaryListWindow = new Window_GlossaryList(this._glossaryWindow);
  1542.         this._glossaryListWindow.setHandler('cancel', this.onCancelGlossaryList.bind(this));
  1543.         this._itemWindow = this._glossaryListWindow;
  1544.         this.addWindow(this._glossaryListWindow);
  1545.     };

  1546.     Scene_Glossary.prototype.createGlossaryCategoryWindow = function() {
  1547.         this._glossaryCategoryWindow = new Window_GlossaryCategory(this._glossaryListWindow);
  1548.         this._glossaryCategoryWindow.setHandler('cancel', this.escapeScene.bind(this));
  1549.         this._glossaryCategoryWindow.setHandler('select', this.refreshCompleteWindow.bind(this));
  1550.         this._glossaryCategoryWindow.setHandler('ok', this.onOkGlossaryCategory.bind(this));
  1551.         this.addWindow(this._glossaryCategoryWindow);
  1552.     };

  1553.     Scene_Glossary.prototype.createConfirmWindow = function() {
  1554.         this._confirmWindow = new Window_GlossaryConfirm(this._glossaryListWindow);
  1555.         this._confirmWindow.setHandler('cancel', this.onItemCancel.bind(this));
  1556.         this._confirmWindow.setHandler('use', this.onItemOk.bind(this));
  1557.         this._confirmWindow.setHandler('noUse', this.onItemCancel.bind(this));
  1558.         this.addChild(this._confirmWindow);
  1559.     };

  1560.     Scene_Glossary.prototype.createGlossaryCompleteWindow = function() {
  1561.         this._glossaryCompleteWindow = new Window_GlossaryComplete(this._glossaryListWindow);
  1562.         if (!$gameParty.isUseGlossaryComplete()) this._glossaryCompleteWindow.hide();
  1563.         this.addWindow(this._glossaryCompleteWindow);
  1564.     };

  1565.     Scene_Glossary.prototype.createBackground = function() {
  1566.         var pictureName = this.getBackPictureName();
  1567.         if (pictureName) {
  1568.             if (param.ThroughBackPicture) {
  1569.                 Scene_ItemBase.prototype.createBackground.apply(this, arguments);
  1570.             }
  1571.             var sprite    = new Sprite();
  1572.             sprite.bitmap = ImageManager.loadPicture(pictureName, 0);
  1573.             sprite.bitmap.addLoadListener(function() {
  1574.                 sprite.scale.x = Graphics.boxWidth / sprite.width;
  1575.                 sprite.scale.y = Graphics.boxHeight / sprite.height;
  1576.             }.bind(this));
  1577.             this._backgroundSprite = sprite;
  1578.             this.addChild(this._backgroundSprite);
  1579.         } else {
  1580.             Scene_ItemBase.prototype.createBackground.apply(this, arguments);
  1581.         }
  1582.     };

  1583.     Scene_Glossary.prototype.getBackPictureName = function() {
  1584.         return $gameParty.getGlossaryBackPicture();
  1585.     };

  1586.     Scene_Glossary.prototype.updateHelp = function(helpText) {
  1587.         if (this._helpTexts[0]) {
  1588.             if (typeof TranslationManager !== 'undefined') {
  1589.                 TranslationManager.getTranslatePromise(helpText).then(function(translatedText) {
  1590.                     this._helpWindow.setText(translatedText.replace(/\\n/g, '\n'));
  1591.                 }.bind(this));
  1592.             } else {
  1593.                 this._helpWindow.setText(helpText.replace(/\\n/g, '\n'));
  1594.             }
  1595.         } else {
  1596.             this._helpWindow.visible = false;
  1597.             this._helpWindow.height  = 0;
  1598.         }
  1599.     };

  1600.     Scene_Glossary.prototype.setInitActivateWindow = function() {
  1601.         var clearIndex = !($gameParty.getGlossaryListIndex() >= 0);
  1602.         if ($gameParty.isUseGlossaryCategory() && clearIndex) {
  1603.             this.activateCategoryWindow(clearIndex);
  1604.         } else {
  1605.             this.activateListWindow(clearIndex);
  1606.             this._glossaryListWindow.selectLastIndex();
  1607.         }
  1608.     };

  1609.     Scene_Glossary.prototype.onOkGlossaryCategory = function() {
  1610.         this.activateListWindow(true);
  1611.     };

  1612.     Scene_Glossary.prototype.onOkGlossaryList = function() {
  1613.         if ($gameParty.isUseGlossaryConfirm()) {
  1614.             this.activateConfirmWindow();
  1615.         } else {
  1616.             this.onItemOk();
  1617.         }
  1618.     };

  1619.     Scene_Glossary.prototype.onItemOk = function() {
  1620.         this._confirmWindow.hide();
  1621.         this._confirmWindow.deactivate();
  1622.         var action = $gameParty.getGlossarySelectAction();
  1623.         $gameParty.setGlossarySelectVariableValue(this.item().id);
  1624.         $gameParty.setGlossarySelectSwitchValue(true);
  1625.         if (action === 1) {
  1626.             $gameParty.setLastItem(this.item());
  1627.             this.determineItem();
  1628.         } else {
  1629.             this.activateListWindow();
  1630.         }
  1631.         if (this._helpTexts[3]) {
  1632.             this.updateHelp(this._helpTexts[3]);
  1633.         }
  1634.     };

  1635.     Scene_Glossary.prototype.onItemCancel = function() {
  1636.         $gameParty.setGlossarySelectVariableValue(-1);
  1637.         $gameParty.setGlossarySelectSwitchValue(false);
  1638.         this.updateHelp(this._helpTexts[0]);
  1639.         this.activateListWindow();
  1640.     };

  1641.     Scene_Glossary.prototype.playSeForItem = function() {
  1642.         SoundManager.playUseItem();
  1643.     };

  1644.     Scene_Glossary.prototype.isCursorLeft = function() {
  1645.         return true;
  1646.     };

  1647.     Scene_Glossary.prototype.user = Scene_Item.prototype.user;

  1648.     Scene_Glossary.prototype.onCancelGlossaryList = function() {
  1649.         if ($gameParty.isUseGlossaryCategory()) {
  1650.             this.activateCategoryWindow(false);
  1651.         } else {
  1652.             this.escapeScene();
  1653.         }
  1654.     };

  1655.     Scene_Glossary.prototype.activateCategoryWindow = function(indexInit) {
  1656.         this._glossaryCategoryWindow.activateAndShow();
  1657.         if (indexInit) {
  1658.             this._glossaryCategoryWindow.select(0);
  1659.         }
  1660.         this._glossaryListWindow.deactivateAndHide();
  1661.         this._glossaryListWindow.deselect();
  1662.         this.refreshCompleteWindow();
  1663.         this._confirmWindow.deactivateAndHide();
  1664.         this.updateHelp(this._helpTexts[1]);
  1665.     };

  1666.     Scene_Glossary.prototype.activateListWindow = function(indexInit) {
  1667.         this._glossaryListWindow.setItemHandler(this.onOkGlossaryList.bind(this));
  1668.         this._glossaryListWindow.refresh();
  1669.         this._glossaryListWindow.activateAndShow();
  1670.         if (indexInit) {
  1671.             this._glossaryListWindow.select(0);
  1672.         }
  1673.         this._glossaryCategoryWindow.deactivateAndHide();
  1674.         this.refreshCompleteWindow();
  1675.         this._confirmWindow.deactivateAndHide();
  1676.         this.updateHelp(this._helpTexts[0]);
  1677.     };

  1678.     Scene_Glossary.prototype.activateConfirmWindow = function() {
  1679.         this._glossaryListWindow.deactivate();
  1680.         this._confirmWindow.updatePlacement();
  1681.         this._confirmWindow.select(0);
  1682.         this._confirmWindow.activateAndShow();
  1683.         if (this._helpTexts[2]) {
  1684.             this.updateHelp(this._helpTexts[2]);
  1685.         }
  1686.     };

  1687.     Scene_Glossary.prototype.escapeScene = function() {
  1688.         this.popScene();
  1689.     };

  1690.     Scene_Glossary.prototype.refreshCompleteWindow = function() {
  1691.         if (this._glossaryCompleteWindow.visible) {
  1692.             this._glossaryCompleteWindow.refresh();
  1693.         }
  1694.     };

  1695.     //=============================================================================
  1696.     // Window_Base
  1697.     //  必要なら制御文字変換を行ってテキストを表示します。
  1698.     //=============================================================================
  1699.     Window_Base.prototype.drawTextExIfNeed = function(text, x, y, maxWidth, align) {
  1700.         if (text.match(/\\/)) {
  1701.             if (align && align !== 'left') {
  1702.                 var width = this.drawTextEx(text, x, -this.lineHeight());
  1703.                 x += maxWidth - width / (align === 'center' ? 2 : 1);
  1704.             }
  1705.             this.drawTextEx(text, x, y);
  1706.         } else {
  1707.             this.drawText(text, x, y, maxWidth, align);
  1708.         }
  1709.     };

  1710.     Window_Base.prototype.setFramelessDesign = function() {
  1711.         if (param.FramelessDesign) {
  1712.             this.backOpacity = 0;
  1713.             this.opacity     = 0;
  1714.         }
  1715.     };

  1716.     //=============================================================================
  1717.     // Window_Selectable
  1718.     //  アクティブウィンドウを切り替えます。
  1719.     //=============================================================================
  1720.     Window_Selectable.prototype.activateAndShow = function() {
  1721.         this.activate();
  1722.         this.show();
  1723.     };

  1724.     Window_Selectable.prototype.deactivateAndHide = function() {
  1725.         this.deactivate();
  1726.         this.hide();
  1727.     };

  1728.     //=============================================================================
  1729.     // Window_GlossaryCategory
  1730.     //  用語集カテゴリウィンドウです。
  1731.     //=============================================================================
  1732.     Window_GlossaryCategory.prototype             = Object.create(Window_Selectable.prototype);
  1733.     Window_GlossaryCategory.prototype.constructor = Window_GlossaryCategory;

  1734.     Window_GlossaryCategory.prototype.initialize = function(glWindow) {
  1735.         this._glossaryListWindow = glWindow;
  1736.         Window_Selectable.prototype.initialize.call(this, glWindow.x, glWindow.y, glWindow.width, glWindow.height);
  1737.         this._data = null;
  1738.         this.refresh();
  1739.         this.selectLastIndex();
  1740.         this.setFramelessDesign();
  1741.     };

  1742.     Window_GlossaryCategory.prototype.selectLastIndex = function() {
  1743.         var lastIndex = $gameParty.getGlossaryCategoryIndex();
  1744.         if (lastIndex >= 0) {
  1745.             this.select(Math.min(lastIndex, this.maxItems() - 1));
  1746.         }
  1747.     };

  1748.     Window_GlossaryCategory.prototype.maxItems = function() {
  1749.         return this._data ? this._data.length : 1;
  1750.     };

  1751.     Window_GlossaryCategory.prototype.item = function() {
  1752.         var index = this.index();
  1753.         return this._data && index >= 0 ? this._data[index] : null;
  1754.     };

  1755.     Window_GlossaryCategory.prototype.isCurrentItemEnabled = function() {
  1756.         return !!this.item();
  1757.     };

  1758.     Window_GlossaryCategory.prototype.makeItemList = function() {
  1759.         this._data = $gameParty.getAllGlossaryCategory();
  1760.     };

  1761.     Window_GlossaryCategory.prototype.select = function(index) {
  1762.         Window_Selectable.prototype.select.apply(this, arguments);
  1763.         this._glossaryListWindow.setGlossaryOnly(this.item());
  1764.         if (index >= 0) {
  1765.             $gameParty.setGlossaryCategoryIndex(index);
  1766.             this.callHandler('select');
  1767.         }
  1768.     };

  1769.     Window_GlossaryCategory.prototype.refresh = function() {
  1770.         this.makeItemList();
  1771.         this.createContents();
  1772.         this.drawAllItems();
  1773.     };

  1774.     Window_GlossaryCategory.prototype.drawItem = function(index) {
  1775.         var text = this._data[index];
  1776.         if (text) {
  1777.             var rect = this.itemRect(index);
  1778.             this.drawTextExIfNeed(text, rect.x + this.textPadding(), rect.y, rect.width - this.textPadding());
  1779.         }
  1780.     };

  1781.     //=============================================================================
  1782.     // Window_GlossaryList
  1783.     //  用語集リストウィンドウです。
  1784.     //=============================================================================
  1785.     Window_GlossaryList.prototype             = Object.create(Window_ItemList.prototype);
  1786.     Window_GlossaryList.prototype.constructor = Window_GlossaryList;

  1787.     Window_GlossaryList.prototype.initialize = function(gWindow) {
  1788.         this._glossaryWindow = gWindow;
  1789.         var height           = gWindow.height;
  1790.         if ($gameParty.isUseGlossaryComplete()) {
  1791.             height -= this.lineHeight() + this.standardPadding() * 2;
  1792.         }
  1793.         var width = $gameParty.getGlossaryListWidth();
  1794.         Window_ItemList.prototype.initialize.call(this, 0, gWindow.y, width, height);
  1795.         this.refresh();
  1796.         this.selectLastIndex();
  1797.         this.setFramelessDesign();
  1798.     };

  1799.     Window_GlossaryList.prototype.selectLastIndex = function() {
  1800.         var lastIndex = $gameParty.getGlossaryListIndex();
  1801.         if (lastIndex >= 0) {
  1802.             this.select(Math.min(lastIndex, this.maxItems() - 1));
  1803.         }
  1804.     };

  1805.     Window_GlossaryList.prototype.maxCols = function() {
  1806.         return 1;
  1807.     };

  1808.     Window_GlossaryList.prototype.numberWidth = function() {
  1809.         return this.needsNumber() ? Window_ItemList.prototype.numberWidth.apply(this, arguments) : 0;
  1810.     };

  1811.     Window_GlossaryList.prototype.needsNumber = function() {
  1812.         return $gameParty.isUseGlossaryItemNumber();
  1813.     };

  1814.     Window_GlossaryList.prototype.drawItemName = function(item, x, y, width) {
  1815.         if (item) {
  1816.             var iconBoxWidth = item.iconIndex > 0 ? Window_Base._iconWidth + 4 : 0;
  1817.             if ($gameParty.hasGlossary(item)) {
  1818.                 this.drawIcon(item.iconIndex, x + 2, y + 2);
  1819.             }
  1820.             this.setGlossaryColor(item);
  1821.             var notYetName = $gameParty.getTextItemNotYet();
  1822.             var name       = $gameParty.hasGlossary(item) ? item.name : notYetName;
  1823.             this.drawTextExIfNeed(name, x + iconBoxWidth, y, width - iconBoxWidth);
  1824.             this.changePaintOpacity(1);
  1825.             this.resetTextColor();
  1826.         }
  1827.     };

  1828.     Window_GlossaryList.prototype.setGlossaryColor = function(item) {
  1829.         this.changePaintOpacity(this.isEnabled(item));
  1830.         this.changeTextColor(this.textColor(this.getGlossaryColorIndex(item)));
  1831.     };

  1832.     Window_GlossaryList.prototype.getGlossaryColorIndex = function(item) {
  1833.         if (!$gameParty.isConfirmedGlossaryItem(item)) {
  1834.             return param.NewGlossaryColor;
  1835.         }
  1836.         var colorChange = getMetaValues(item, ['TextColorChange', 'テキスト色変化']);
  1837.         if (colorChange) {
  1838.             var switchId = getArgNumber(colorChange.split(',')[0], 0);
  1839.             if ($gameSwitches.value(switchId)) {
  1840.                 return getArgNumber(colorChange.split(',')[1], 0);
  1841.             }
  1842.         }
  1843.         return 0;
  1844.     };

  1845.     Window_GlossaryList.prototype.isEnabled = function(item) {
  1846.         if (!$gameParty.hasGlossary(item)) {
  1847.             return false;
  1848.         }
  1849.         if (!this.canItemUse()) {
  1850.             return true;
  1851.         }
  1852.         if (!$gameParty.isUsableGlossaryItem(item.id)) {
  1853.             return false;
  1854.         }
  1855.         var action = $gameParty.getGlossarySelectAction();
  1856.         return action === 1 ? Window_ItemList.prototype.isEnabled.call(this, item) : true;
  1857.     };

  1858.     Window_GlossaryList.prototype.includes = function(item) {
  1859.         // Resolve conflict for YEP_ItemCore.js
  1860.         if ($gameParty.isIndependentItem(item)) {
  1861.             return false;
  1862.         }
  1863.         return $gameParty.isGlossaryItem(item) && this.isCategoryMatch(item) && $gameParty.isSameGlossaryType(item);
  1864.     };

  1865.     Window_GlossaryList.prototype.isCategoryMatch = function(item) {
  1866.         return !$gameParty.isUseGlossaryCategory() || $gameParty.hasGlossaryCategory(item, this._category);
  1867.     };

  1868.     Window_GlossaryList.prototype.select = function(index) {
  1869.         var prevItem = this.item();
  1870.         if (prevItem) {
  1871.             var result = $gameParty.setConfirmedGlossaryItem(prevItem);
  1872.             if (result) {
  1873.                 this.drawItem(this._index);
  1874.             }
  1875.         }
  1876.         Window_ItemList.prototype.select.apply(this, arguments);
  1877.         if (this.item() && prevItem !== this.item()) {
  1878.             this._glossaryWindow.refresh(this.item(), this.index());
  1879.         } else if (!this.item()) {
  1880.             this._glossaryWindow.clearItem();
  1881.         }
  1882.         if (index >= 0) {
  1883.             $gameParty.setGlossaryListIndex(index);
  1884.         }
  1885.     };

  1886.     Window_GlossaryList.prototype.cursorRight = function(wrap) {
  1887.         this._glossaryWindow.cursorRight(wrap);
  1888.     };

  1889.     Window_GlossaryList.prototype.cursorLeft = function(wrap) {
  1890.         this._glossaryWindow.cursorLeft(wrap);
  1891.     };

  1892.     Window_GlossaryList.prototype.getCategory = function() {
  1893.         return this._category !== 'none' ? this._category : null;
  1894.     };

  1895.     Window_GlossaryList.prototype.makeItemList = function() {
  1896.         this._data = this.getItemList().filter(function(item) {
  1897.             var isInclude = this.includes(item);
  1898.             if (isInclude) {
  1899.                 item.sortOrder = getMetaValues(item, ['Order', '表示順']) || item.id;
  1900.             }
  1901.             return isInclude;
  1902.         }, this).sort(this.compareOrder);
  1903.     };

  1904.     Window_GlossaryList.prototype.compareOrder = function(itemA, itemB) {
  1905.         return DataManager.getItemTypeCode(itemA) - DataManager.getItemTypeCode(itemB) ||
  1906.             itemA.sortOrder - itemB.sortOrder || itemA.id - itemB.id;
  1907.     };

  1908.     Window_GlossaryList.prototype.getItemList = function() {
  1909.         var visibleNotYet = $gameParty.isUseGlossaryVisibleItemNotYet();
  1910.         return $gameParty.getAllGlossaryList(true, !visibleNotYet, this._category);
  1911.     };

  1912.     Window_GlossaryList.prototype.canItemUse = function() {
  1913.         var action = $gameParty.getGlossarySelectAction();
  1914.         return action > 0 && !param.CategoryUnusable.contains(this._category);
  1915.     };

  1916.     Window_GlossaryList.prototype.removeHandler = function(symbol) {
  1917.         delete this._handlers[symbol];
  1918.     };

  1919.     Window_GlossaryList.prototype.setItemHandler = function(handler) {
  1920.         if (this.canItemUse()) {
  1921.             this.setHandler('ok', handler);
  1922.         } else {
  1923.             this.removeHandler('ok');
  1924.         }
  1925.     };

  1926.     Window_GlossaryList.prototype.setGlossaryOnly = function(category) {
  1927.         this._category = category;
  1928.     };

  1929.     // Resolve conflict for YEP_ItemCore.js
  1930.     Window_GlossaryList.prototype.drawEquippedActor = function() {
  1931.     };

  1932.     //=============================================================================
  1933.     // Window_GlossaryConfirm
  1934.     //  用語集確認ウィンドウです。
  1935.     //=============================================================================
  1936.     Window_GlossaryConfirm.prototype             = Object.create(Window_Command.prototype);
  1937.     Window_GlossaryConfirm.prototype.constructor = Window_GlossaryConfirm;

  1938.     Window_GlossaryConfirm.prototype.initialize = function(listWindow) {
  1939.         this._listWindow = listWindow;
  1940.         Window_Command.prototype.initialize.call(this, 0, 0);
  1941.     };

  1942.     Window_GlossaryConfirm.prototype.windowWidth = function() {
  1943.         return 120;
  1944.     };

  1945.     Window_GlossaryConfirm.prototype.updatePlacement = function() {
  1946.         this.x   = this._listWindow.x + 64;
  1947.         var line = this._listWindow.index() - this._listWindow.topRow();
  1948.         if (line >= this._listWindow.maxPageRows() - 2) {
  1949.             line -= 3;
  1950.         }
  1951.         this.y = this._listWindow.y + line * this._listWindow.itemHeight() + 32;
  1952.     };

  1953.     Window_GlossaryConfirm.prototype.makeCommandList = function() {
  1954.         var confirmMessages = $gameParty.getGlossaryConfirmMessages();
  1955.         this.addCommand(confirmMessages[0], 'use');
  1956.         this.addCommand(confirmMessages[1], 'noUse');
  1957.     };

  1958.     //=============================================================================
  1959.     // Window_GlossaryComplete
  1960.     //  用語集収集率ウィンドウです。
  1961.     //=============================================================================
  1962.     Window_GlossaryComplete.prototype             = Object.create(Window_Base.prototype);
  1963.     Window_GlossaryComplete.prototype.constructor = Window_GlossaryComplete;

  1964.     Window_GlossaryComplete.prototype.initialize = function(listWindow) {
  1965.         var x            = listWindow.x;
  1966.         var y            = listWindow.y + listWindow.height;
  1967.         var width        = listWindow.width;
  1968.         var height       = Graphics.boxHeight - y;
  1969.         this._listWindow = listWindow;
  1970.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  1971.         this.setFramelessDesign();
  1972.     };

  1973.     Window_GlossaryComplete.prototype.clear = function() {
  1974.         this.contents.clear();
  1975.     };

  1976.     Window_GlossaryComplete.prototype.refresh = function() {
  1977.         this.clear();
  1978.         var percent = $gameParty.getHasGlossaryPercent(this._listWindow.getCategory());
  1979.         this.drawTextEx($gameParty.getGlossaryCompleteMessage().format(percent.padZero(3)), 0, 0);
  1980.     };

  1981.     //=============================================================================
  1982.     // Window_Glossary
  1983.     //  用語集ウィンドウです。
  1984.     //=============================================================================
  1985.     Window_Glossary.prototype             = Object.create(Window_Base.prototype);
  1986.     Window_Glossary.prototype.constructor = Window_Glossary;

  1987.     Window_Glossary.prototype.initialize = function(x, y) {
  1988.         var height      = Graphics.boxHeight - y;
  1989.         var width       = Graphics.boxWidth - x;
  1990.         this._maxPages  = 1;
  1991.         this._itemData  = null;
  1992.         this._pageIndex = 0;
  1993.         this._enemy     = null;
  1994.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  1995.         this.setFramelessDesign();
  1996.     };

  1997.     Window_Glossary.prototype.standardFontSize = function() {
  1998.         return param.FontSize ? param.FontSize : Window_Base.prototype.standardFontFace();
  1999.     };

  2000.     Window_Glossary.prototype.calcMaxPages = function(index) {
  2001.         var exist = this.isViewablePage(index) && (!!this.getPictureName(index) || !!this.getDescription(index));
  2002.         return (exist && index < 100) ? this.calcMaxPages(index + 1) : index;
  2003.     };

  2004.     Window_Glossary.prototype.getPictureName = function(index) {
  2005.         return this.getMetaContents(['ピクチャ', 'Picture'], index);
  2006.     };

  2007.     Window_Glossary.prototype.getEnemyData = function(index) {
  2008.         var id = this.getMetaContents(['敵キャラ', 'Enemy'], index);
  2009.         var enemy;
  2010.         if (id === true) {
  2011.             var optEnemy = $dataEnemies.filter(function(enemy) {
  2012.                 return enemy && enemy.name === this._itemData.name;
  2013.             }, this);
  2014.             enemy        = optEnemy.length > 0 ? optEnemy[0] : null;
  2015.         } else {
  2016.             enemy = $dataEnemies[parseInt(id)] || null;
  2017.         }
  2018.         if (!this._enemy) {
  2019.             this._enemy = enemy;
  2020.         }
  2021.         return enemy;
  2022.     };

  2023.     Window_Glossary.prototype.getPlusPictureData = function(imageIndex, index) {
  2024.         return this.getMetaContents([`追加${imageIndex}ピクチャ`, `Plus${imageIndex}Picture`], index);
  2025.     };

  2026.     Window_Glossary.prototype.getDescription = function(index) {
  2027.         var description = this.getMetaContents(['説明', 'Description'], index);
  2028.         if (!description) {
  2029.             return '';
  2030.         }
  2031.         var data       = this._itemData;
  2032.         description    = description.replace(/\x1bEFFECT_TYPE\[(\d+)]/gi, function() {
  2033.             var code = data.effects[parseInt(arguments[1])].code;
  2034.             return Window_Glossary.effectCodeDesc[code];
  2035.         }.bind(this));
  2036.         description    = description.replace(/\x1bDATA\[(\w+)]/gi, function() {
  2037.             return data[arguments[1]];
  2038.         }.bind(this));
  2039.         description    = description.replace(/\x1bSCRIPT{(.+)}/gi, function() {
  2040.             return eval(arguments[1]);
  2041.         }.bind(this));
  2042.         description    = description.replace(/\x1bCOMMON\[(\d+)]/gi, function() {
  2043.             this._itemData = $dataItems[parseInt(arguments[1])];
  2044.             return this.getCommonDescription();
  2045.         }.bind(this));
  2046.         this._itemData = data;
  2047.         if (this._enemy) {
  2048.             description = this.convertEnemyData(description);
  2049.         }
  2050.         return description;
  2051.     };

  2052.     Window_Glossary.effectCodeDesc = {
  2053.         11: 'HP回復',
  2054.         12: 'MP回復',
  2055.         13: 'TP回復',
  2056.         21: 'ステート付与',
  2057.         22: 'ステート解除',
  2058.         31: '強化',
  2059.         32: '弱体',
  2060.         33: '強化の解除',
  2061.         34: '弱体の解除',
  2062.         41: '特殊効果',
  2063.         42: '成長',
  2064.         43: 'スキル習得',
  2065.         44: 'コモンイベント'
  2066.     };

  2067.     Window_Glossary.prototype.isViewablePage = function(index) {
  2068.         var switchId = parseInt(getMetaValues(this._itemData, ['VisibleSwitch', '表示スイッチ'], index)) || 0;
  2069.         return switchId > 0 ? $gameSwitches.value(switchId) : true;
  2070.     };

  2071.     Window_Glossary.prototype.getCommonDescription = function() {
  2072.         return this.getMetaContents(['共通説明', 'CommonDescription'], 0);
  2073.     };

  2074.     Window_Glossary.prototype.getMetaContents = function(names, index) {
  2075.         var item  = this._itemData;
  2076.         var value = getMetaValues(item, names, index);
  2077.         if (!value) return null;
  2078.         var contents = getArgString(value);
  2079.         return contents && contents !== '0' ? contents : null;
  2080.     };

  2081.     Window_Glossary.prototype.refresh = function(item, index) {
  2082.         this._listIndex = index;
  2083.         this._itemData  = item;
  2084.         this._enemy     = null;
  2085.         this._maxPages  = item && $gameParty.hasGlossary(item) ? this.calcMaxPages(0) : 1;
  2086.         this.drawItem(0, true);
  2087.     };

  2088.     Window_Glossary.prototype.cursorRight = function(wrap) {
  2089.         if (this._maxPages === 1) return;
  2090.         if (this.canMoveRight()) {
  2091.             this.drawItem(this._pageIndex + 1);
  2092.         } else if (wrap && param.PageWrap) {
  2093.             this.drawItem(0);
  2094.         }
  2095.     };

  2096.     Window_Glossary.prototype.cursorLeft = function(wrap) {
  2097.         if (this._maxPages === 1) return;
  2098.         if (this.canMoveLeft()) {
  2099.             this.drawItem(this._pageIndex - 1);
  2100.         } else if (wrap && param.PageWrap) {
  2101.             this.drawItem(this._maxPages - 1);
  2102.         }
  2103.     };

  2104.     Window_Glossary.prototype.canMoveLeft = function() {
  2105.         return this._pageIndex > 0;
  2106.     };

  2107.     Window_Glossary.prototype.canMoveRight = function() {
  2108.         return this._pageIndex < this._maxPages - 1;
  2109.     };

  2110.     Window_Glossary.prototype.drawItem = function(pageIndex, noSound) {
  2111.         this.contents.clear();
  2112.         this._pageIndex = pageIndex;
  2113.         this.updateArrows();
  2114.         if (!this._itemData || !$gameParty.hasGlossary(this._itemData)) {
  2115.             return;
  2116.         }
  2117.         var bitmap    = this.getGlossaryBitmap(pageIndex);
  2118.         var listIndex = this._listIndex;
  2119.         if (bitmap) {
  2120.             bitmap.addLoadListener(this.drawItemSub.bind(this, bitmap, listIndex, pageIndex));
  2121.         } else {
  2122.             this.drawItemSub(null, listIndex, pageIndex);
  2123.         }
  2124.         if (!noSound) SoundManager.playCursor();
  2125.     };

  2126.     Window_Glossary.prototype.clearItem = function() {
  2127.         this._listIndex = -1;
  2128.         this.contents.clear();
  2129.         this.hiddenArrows();
  2130.     };

  2131.     Window_Glossary.prototype.getGlossaryBitmap = function(index) {
  2132.         var pictureName = this.getPictureName(index);
  2133.         var enemy       = this.getEnemyData(index);
  2134.         if (pictureName) {
  2135.             return ImageManager.loadPicture(pictureName, 0);
  2136.         } else {
  2137.             if (enemy) {
  2138.                 var methodName = $gameSystem.isSideView() ? 'loadSvEnemy' : 'loadEnemy';
  2139.                 return ImageManager[methodName](enemy.battlerName, enemy.battlerHue);
  2140.             } else {
  2141.                 return null;
  2142.             }
  2143.         }
  2144.     };

  2145.     Window_Glossary.prototype.updateArrows = function() {
  2146.         this.downArrowVisible = this.canMoveLeft();
  2147.         this.upArrowVisible   = this.canMoveRight();
  2148.     };

  2149.     Window_Glossary.prototype.hiddenArrows = function() {
  2150.         this.downArrowVisible = false;
  2151.         this.upArrowVisible   = false;
  2152.     };

  2153.     Window_Glossary.prototype.drawItemSub = function(bitmap, listIndex, pageIndex) {
  2154.         // for async draw
  2155.         if (this._listIndex !== listIndex || this._pageIndex !== pageIndex) {
  2156.             return;
  2157.         }
  2158.         var text    = this.getDescription(this._pageIndex);
  2159.         var textPos = this.getTextPosition();
  2160.         var textHandler;
  2161.         var pictureHandler;
  2162.         var y;
  2163.         switch (this.getPicturePosition()) {
  2164.             case 'top':
  2165.                 if (!textPos) {
  2166.                     textPos = this.calcItemPictureHeight(bitmap, text);
  2167.                 }
  2168.                 textHandler    = this.drawItemText.bind(this, text, textPos);
  2169.                 pictureHandler = this.drawPicture.bind(this, bitmap, text, 0);
  2170.                 break;
  2171.             case 'bottom':
  2172.                 textHandler    = this.drawItemText.bind(this, text, textPos);
  2173.                 y              = this.contentsHeight() - this.calcItemPictureHeight(bitmap, text);
  2174.                 pictureHandler = this.drawPicture.bind(this, bitmap, text, y);
  2175.                 break;
  2176.             case 'text':
  2177.             default :
  2178.                 textHandler    = this.drawItemText.bind(this, text, textPos);
  2179.                 y              = this.calcItemTextHeight(text) + textPos;
  2180.                 pictureHandler = this.drawPicture.bind(this, bitmap, text, y);
  2181.                 break;
  2182.         }
  2183.         if (this.getPicturePriority() === 'bottom') {
  2184.             pictureHandler();
  2185.             textHandler();
  2186.         } else {
  2187.             textHandler();
  2188.             pictureHandler();
  2189.         }
  2190.         this.drawPlusPictures();
  2191.     };

  2192.     Window_Glossary.prototype.drawPlusPictures = function() {
  2193.         var pictureData = null;
  2194.         var imageIndex  = 1;
  2195.         do {
  2196.             pictureData = this.getPlusPictureData(imageIndex, this._pageIndex);
  2197.             if (pictureData) {
  2198.                 imageIndex++;
  2199.                 this.drawPlusPicture.apply(this, pictureData.split(','));
  2200.             }
  2201.         } while (pictureData);
  2202.     };

  2203.     Window_Glossary.prototype.drawPlusPicture = function(pictureName, xText, yText) {
  2204.         if (!pictureName) {
  2205.             pictureName = '';
  2206.         }
  2207.         var bitmap = ImageManager.loadPicture(pictureName);
  2208.         if (!bitmap) {
  2209.             return;
  2210.         }
  2211.         bitmap.addLoadListener(function() {
  2212.             var x = parseInt(xText) || 0;
  2213.             var y = parseInt(yText) || 0;
  2214.             this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x, y);
  2215.         }.bind(this));
  2216.     };

  2217.     Window_Glossary.prototype.getPicturePosition = function() {
  2218.         var position = getMetaValues(this._itemData, ['ピクチャ位置', 'PicturePosition'], this._pageIndex);
  2219.         return position ? position.toLowerCase() : param.PicturePosition;
  2220.     };

  2221.     Window_Glossary.prototype.getTextPosition = function() {
  2222.         var position = getMetaValues(this._itemData, ['テキスト位置', 'TextPosition'], this._pageIndex);
  2223.         return position ? parseInt(position) : param.TextPosition || 0;
  2224.     };

  2225.     Window_Glossary.prototype.getPictureAlign = function() {
  2226.         var align = getMetaValues(this._itemData, ['ピクチャ揃え', 'PictureAlign'], this._pageIndex);
  2227.         return align ? align.toLowerCase() : param.PictureAlign;
  2228.     };

  2229.     Window_Glossary.prototype.getPicturePriority = function() {
  2230.         var align = getMetaValues(this._itemData, ['ピクチャ優先度', 'PicturePriority'], this._pageIndex);
  2231.         return align ? align.toLowerCase() : param.PicturePriority;
  2232.     };

  2233.     Window_Glossary.prototype.calcItemTextHeight = function(text) {
  2234.         var textState = {index: 0, x: 0, y: 0, left: 0, text: text};
  2235.         return this.calcTextHeight(textState, true) + 4;
  2236.     };

  2237.     Window_Glossary.prototype.calcItemPictureHeight = function(bitmap, text) {
  2238.         return bitmap ? bitmap.height * this.getPictureScale(this._itemData, bitmap, text) + 4 : 0;
  2239.     };

  2240.     Window_Glossary.prototype.drawItemText = function(text, y) {
  2241.         if (typeof TranslationManager !== 'undefined') {
  2242.             TranslationManager.getTranslatePromise(text).then(function(translatedText) {
  2243.                 this.drawTextEx(translatedText, 0, y);
  2244.             }.bind(this));
  2245.         } else {
  2246.             this.drawTextEx(text, 0, y);
  2247.         }
  2248.     };

  2249.     Window_Glossary._paramNames = [
  2250.         'MHP', 'MMP', 'ATK', 'DEF', 'MAG', 'MDF', 'AGI', 'LUK'
  2251.     ];

  2252.     Window_Glossary.prototype.convertEnemyData = function(text) {
  2253.         var enemy     = this._enemy;
  2254.         var gameEnemy = new Game_Enemy(enemy.id, 0, 0);
  2255.         text          = text.replace(/\x1b(MHP|MMP|ATK|DEF|MAG|MDF|AGI|LUK)\[(\d+)]/gi, function() {
  2256.             var index = Window_Glossary._paramNames.indexOf(arguments[1].toUpperCase());
  2257.             var param = enemy.params[index];
  2258.             return param.padZero(parseInt(arguments[2]));
  2259.         });
  2260.         text          = text.replace(/\x1bEXP\[(\d+)]/gi, function() {
  2261.             return enemy.exp.padZero(parseInt(arguments[1]));
  2262.         });
  2263.         text          = text.replace(/\x1bMONEY\[(\d+)]/gi, function() {
  2264.             return enemy.gold.padZero(parseInt(arguments[1]));
  2265.         });
  2266.         text          = text.replace(/\x1bDROP\[(\d+)]/gi, function() {
  2267.             var drop = enemy.dropItems[parseInt(arguments[1]) - 1];
  2268.             if (drop) {
  2269.                 var item = gameEnemy.itemObject(drop.kind, drop.dataId);
  2270.                 return item ? `\\i[${item.iconIndex}]${item.name}` : '';
  2271.             }
  2272.             return '';
  2273.         });
  2274.         text          = text.replace(/\x1bSCRIPT{(\s+)}/gi, function() {
  2275.             return eval(arguments[1]);
  2276.         });
  2277.         return text;
  2278.     };

  2279.     Window_Glossary.prototype.processNormalCharacter = function(textState) {
  2280.         var c = textState.text[textState.index];
  2281.         var w = this.textWidth(c);
  2282.         if (textState.x + w > this.contentsWidth()) {
  2283.             this.processNewLine(textState);
  2284.             textState.index--;
  2285.         }
  2286.         Window_Base.prototype.processNormalCharacter.apply(this, arguments);
  2287.     };

  2288.     Window_Glossary.prototype.drawPicture = function(bitmap, text, y) {
  2289.         if (!bitmap) return;
  2290.         var item  = this._itemData;
  2291.         var scale = this.getPictureScale(item, bitmap, text);
  2292.         var dw    = bitmap.width * scale;
  2293.         var dy    = bitmap.height * scale;
  2294.         var x     = 0;
  2295.         switch (this.getPictureAlign(item)) {
  2296.             case 'left':
  2297.                 x = 0;
  2298.                 break;
  2299.             case 'center':
  2300.                 x = this.contentsWidth() / 2 - dw / 2;
  2301.                 break;
  2302.             case 'right':
  2303.                 x = this.contentsWidth() - dw;
  2304.                 break;
  2305.         }
  2306.         this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x, y, dw, dy);
  2307.         this.drawPlusPicture();
  2308.     };

  2309.     Window_Glossary.prototype.getPictureScale = function(item, bitmap, text) {
  2310.         var scale     = 1;
  2311.         var metaValue = getMetaValues(item, ['ピクチャ拡大率', 'PictureScale'], this._pageIndex);
  2312.         if (metaValue) {
  2313.             scale = getArgNumber(metaValue);
  2314.         } else if (param.AutoResizePicture && this.getTextPosition() === 0) {
  2315.             var mw = this.contentsWidth();
  2316.             var mh = this.contentsHeight() - this.calcItemTextHeight(text);
  2317.             scale  = Math.min(mw / bitmap.width, mh / bitmap.height, 1);
  2318.         }
  2319.         return scale;
  2320.     };

  2321.     Window_Glossary.prototype.update = function() {
  2322.         Window_Base.prototype.update.call(this);
  2323.         this.processTouch();
  2324.     };

  2325.     Window_Glossary.prototype.processTouch = function() {
  2326.         if (this._listIndex < 0 || !TouchInput.isTriggered()) {
  2327.             return;
  2328.         }
  2329.         var x = this.canvasToLocalX(TouchInput.x);
  2330.         var y = this.canvasToLocalY(TouchInput.y);
  2331.         if (y >= 0 && y <= this.height) {
  2332.             if (x >= 0 && x < this.width / 2) this.cursorLeft(true);
  2333.             if (x >= this.width / 2 && x < this.width) this.cursorRight(true);
  2334.         }
  2335.     };

  2336.     Window_Glossary.prototype._refreshArrows = function() {
  2337.         Window.prototype._refreshArrows.call(this);
  2338.         var w = this._width;
  2339.         var h = this._height;
  2340.         var p = 24;
  2341.         var q = p / 2;

  2342.         this._downArrowSprite.rotation = 90 * Math.PI / 180;
  2343.         this._downArrowSprite.move(q, h / 2);
  2344.         this._upArrowSprite.rotation = 90 * Math.PI / 180;
  2345.         this._upArrowSprite.move(w - q, h / 2);
  2346.     };
  2347. })();
复制代码


Lv2.观梦者

梦石
0
星屑
872
在线时间
39 小时
注册时间
2013-9-13
帖子
4
 楼主| 发表于 2020-9-19 14:06:21 | 显示全部楼层
没有人么、、
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-28 23:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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