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

Project1

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

[已经过期] 请问如何做到像是图片当中的任务栏?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
2070
在线时间
37 小时
注册时间
2013-6-4
帖子
1
跳转到指定楼层
1
发表于 2013-9-24 20:39:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x


我很想要做这种类型的任务栏,因为我想要开个支线和主线以及隐藏线!请说的简单一点拜托!

Lv1.梦旅人

梦石
0
星屑
49
在线时间
226 小时
注册时间
2012-8-19
帖子
518
2
发表于 2013-9-24 21:43:13 | 只看该作者
如果游戏没加密你直接复制过来不就OK了吗?
超级感动!换上了自画头像!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
80
在线时间
40 小时
注册时间
2012-7-3
帖子
98
3
发表于 2013-9-25 00:22:44 | 只看该作者
需要脚本系统,具体你应该去置顶帖找找。或者图书馆啊什么地方的,这属于烂大街的东西了。
楼上真新人,小心纯水被撸。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
367
在线时间
1292 小时
注册时间
2013-1-12
帖子
3590

贵宾

4
发表于 2013-9-25 06:31:48 | 只看该作者
http://rmrk.net/index.php/topic,45127.0.html
這是外站腳本  非常複雜也非常精制的腳本  需要翻牆(代理)
不推薦新手使用啦.......

点评

不照顾一下没有代理的孩纸们。。。  发表于 2013-9-25 07:02

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
367
在线时间
1292 小时
注册时间
2013-1-12
帖子
3590

贵宾

5
发表于 2013-9-25 07:31:02 | 只看该作者
@myownroc
這任務蔡單完全就是這个腳本
如果不給他這個需要代理的還要給他什麼....
P.S. 是不能转发的说

点评

代理很麻烦吗?直接开个在线代理或者下载个代理器就OK了啊,1分钟的事  发表于 2013-9-25 16:21
好吧…不过这里想代理也是很麻烦的。。。  发表于 2013-9-25 07:45

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
600
在线时间
924 小时
注册时间
2011-5-11
帖子
438
6
发表于 2013-9-25 07:33:39 | 只看该作者
  1. #==============================================================================
  2. #    Quest Journal [VXA]
  3. #    Version: 1.0.3
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: 24 September 2012
  6. #    Support: http://rmrk.net/index.php/topic,45127.0.html
  7. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  8. #  Description:
  9. #
  10. #    This script provides a graphical interface for showing quest progress. It
  11. #   is objective-based, meaning that you choose when to reveal objectives and
  12. #   you can set it so that they show up as complete or failed. That said, this
  13. #   script does not build quests for you; it is only a supplementary scene for
  14. #   showing them. As such, you need to event all of the quests yourself and
  15. #   update quest progress via script call. Therefore, pay close attention to
  16. #   the instructions here and in the Editable Regions at lines 232 and 612.
  17. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  18. #  Instructions:
  19. #
  20. #    Paste this script into its own slot or slots, above Main and below
  21. #   Materials. If you are using the menu access feature, you should put any
  22. #   other menu scripts above this one.
  23. #
  24. #    All of the configuration is done in the QuestData module. While it is not
  25. #   necessary, it is recommended that you separate the configuration module
  26. #   from the rest of the script by cutting and pasting it into its own slot in
  27. #   the Script Editor (as you will see if you have the demo). The reason for
  28. #   this is that, if and when this script gets updated, you can preserve the
  29. #   configuration section and only replace the other parts of the script. If
  30. #   you wish to do that, you must cut everything from the first line down to
  31. #   the final end of the module. The first lines of the body script should be
  32. #   the equals bar right above # ** Game_Quest. Again, it's up to you whether
  33. #   you do it.
  34. #
  35. #    You can go to EDITABLE REGION A at line 232 to configure the default
  36. #   settings for the script. All of these will work fine without modification,
  37. #   of course, but even if do not want to configure now, you should familiarize
  38. #   yourself with all the settings so that you can make the best use of your
  39. #   script. I have included tons of settings so that you can make the Quest
  40. #   Journal unique for your game, even down to the order in which each section
  41. #   of the info window is drawn. A brief description of each setting is
  42. #   included either to the right or directly above each constant.
  43. #
  44. #    EDITABLE REGION B is the real heart of the script however - this is where
  45. #   you fill in all of the details for the quests. Read the instructions at
  46. #   line 612 very carefully!
  47. #
  48. #    You can activate and access a quest with this code in the Script event
  49. #   command:
  50. #
  51. #        quest(quest_id)
  52. #          quest_id : the integer ID of the quest you want to access
  53. #
  54. #   From that, you can access or alter any relevant data stored in the quest,
  55. #   like name, description, objectives, etc... Example:
  56. #         quest(1).name = "Rest in Pieces"
  57. #
  58. #    More relevantly, when it comes to controlling the progress of quests the
  59. #   following codes can be used in a Script event command. The arguments are
  60. #   the same for each command so I only explain them once. All of them are
  61. #   pretty self-explanatory and using any of them will activate the quest
  62. #   (unless you are using the MANUAL REVEAL setting at line 267).
  63. #   
  64. #        reveal_objective(quest_id, objective_id_1, ..., objective_id_n)
  65. #            quest_id : the integer ID of the quest you want to access.
  66. #            objective_id_1, ..., objective_id_n : a list of the IDs of the
  67. #              objectives you want to operate on. It can be as few as one or as
  68. #              many as all of them.
  69. #          Will show the listed objectives in the Quest's information
  70. #
  71. #        conceal_objective(quest_id, objective_id_1, ..., objective_id_n)
  72. #          Will hide the listed objectives in the Quest's information
  73. #
  74. #        complete_objective(quest_id, objective_id_1, ..., objective_id_n)
  75. #          Changes the colour of the listed objectives to the completed colour.
  76. #          The quest is completed once all prime objectives are.
  77. #
  78. #        uncomplete_objective (quest_id, objective_id_1, ..., objective_id_n)
  79. #          Changes the status of the listed complete objectives back to active
  80. #
  81. #        fail_objective(quest_id, objective_id_1, ..., objective_id_n)
  82. #          Changes the colour of the listed objectives to the failed colour.
  83. #          The quest is failed once one prime objective is.
  84. #
  85. #        unfail_objective(quest_id, objective_id_1, ..., objective_id_n)
  86. #          Changes the status of the listed failed objectives back to active
  87. #
  88. #        change_reward_status(quest_id, value)
  89. #            value : either true or false. If excluded, defaults to true.
  90. #          Totally optional, but this is just a personal switch which you can
  91. #          turn on when the reward is given. You can then make it a condition
  92. #          so you don't reward the players more than once. (see line 180)
  93. #
  94. #  EXAMPLES:
  95. #    reveal_objective(1, 0)
  96. #      This would reveal the first objective of the quest with ID 1
  97. #    complete_objective(6, 2, 3)
  98. #      This would complete the third & fourth objectives of the quest with ID 6
  99. #    change_reward_status(8)
  100. #      This would set the reward switch to true for the quest with ID 8.
  101. #
  102. #   Another new feature is the ability to set rewards that will show up in the
  103. #  menu (see EDITABLE REGION B). In addition to that, you can use the following
  104. #  code to automatically distribute the specified rewards for a quest if the
  105. #  quest is complete and no reward has yet been given:
  106. #
  107. #        distribute_quest_rewards(quest_id)
  108. #          quest_id : the ID of the quest whose rewards you want to distribute
  109. #
  110. #   Of course, it can only distribute the material rewards (items, weapons,
  111. #   armors, gold, or exp). It won't distribute rewards you specify by string.
  112. #   To that end though, you can also use this code in a conditional branch and
  113. #   it will be satisfied only if it distributes the rewards. Thus, if you
  114. #   wanted to add some special rewards or do things like that, you can just put
  115. #   that in the branch for when it is true. This feature is not really
  116. #   recommended, since I think it is better to do it by events.
  117. #
  118. #    Other codes for the Script event command that can be useful are:
  119. #   
  120. #        reset_quest(quest_id)
  121. #            quest_id : the integer ID of the quest you want to access.
  122. #          This will re-initialize the quest, meaning all quest progress to
  123. #          date will be lost
  124. #
  125. #        delete_quest(quest_id)
  126. #          Deactivates the quest and resets it
  127. #
  128. #        conceal_quest(quest_id)
  129. #          Deactivates the quest so it won't show up in the scene, but progress
  130. #          is saved
  131. #
  132. #        reveal_quest(quest_id)
  133. #          Activates or reactivates the quest. This command is NECESSARY if
  134. #          MANUAL_REVEAL at line 284 is true or it has previously been
  135. #          concealed. Otherwise, it is sufficient just to operate on the quest
  136. #
  137. #        change_quest_access(:symbol)
  138. #          :symbol must be one of six options (include the colon!):
  139. #            :disable - prevents access to the quest scene (greys out in menu)
  140. #            :enable - enables access to the quest scene
  141. #            :disable_menu - this removes the quest option from the menu
  142. #            :enable_menu - this adds the quest option to the menu
  143. #            :disable_map - this prevents access by key from the map
  144. #            :enable_map - this allows access by key to the map
  145. #
  146. #        change_quest_background("bg_filename", bg_opacity, bg_blend_type)
  147. #            bg_filename   : the filename of the picture for the background in  
  148. #              the Pictures folder
  149. #            bg_opacity    : the opacity of the background graphic. If
  150. #              excluded, this defaults to the value of the setting at line 434.
  151. #            bg_blend_type : the blend type of the background graphic. If
  152. #              excluded, this defaults to the value of the setting at line 437.
  153. #
  154. #        change_quest_windows ("windowskin_filename", tone, opacity)
  155. #            windowskin_filename : the name of the Window graphic in the
  156. #              System folder of Graphics
  157. #            opacity             : the opacity of the windows. If excluded,
  158. #              this defaults to the value of the setting at line 423.
  159. #            blend_type          : the blend_type of the windows. If excluded,
  160. #              this defaults to the value of the setting at line 426.
  161. #
  162. #    Also, there are a few codes that can be used in the Script command of a
  163. #   conditional branch. I note here that all of these are optional. You could
  164. #   use switch and variable checks and monitor quest progress solely through
  165. #   events. However, these commands make it a little easier and they are:
  166. #
  167. #        quest_revealed?(quest_id)
  168. #            quest_id : the integer ID of the quest you want to access.
  169. #          This is satisfied if the quest has been activated.
  170. #
  171. #        quest_complete?(quest_id)
  172. #          This is satisfied if all prime objectives of the quest are complete
  173. #
  174. #        quest_failed?(quest_id)
  175. #          This is satisfied if any prime objective of the quest is failed
  176. #
  177. #        quest_rewarded?(quest_id)
  178. #          This is satisfied if you have changed the reward status to true.
  179. #
  180. #        objective_revealed?(quest_id, objective_id_1, ... objective_id_n)
  181. #            objective_id_1, ..., objective_id_n : a list of the IDs of the
  182. #              objectives you want to operate on. It can be as few as one or as
  183. #              many as all of them.
  184. #          This is satisfied if the listed objectives have been revealed
  185. #
  186. #        objective_active?(quest_id, objective_id_1, ... objective_id_n)
  187. #          This is satisfied if all the listed objectives are revealed and
  188. #          neither complete nor failed.
  189. #
  190. #        objective_complete?(quest_id, objective_id_1, ... objective_id_n)
  191. #          This is satisfied if all the listed objectives have been completed
  192. #
  193. #        objective_failed?(quest_id, objective_id_1, ... objective_id_n)
  194. #          This is satisfied if all the listed objectives have been failed
  195. #
  196. #    If you want to call the Quest scene from an event, you use the following
  197. #   code in a call script:
  198. #
  199. #        call_quest_journal
  200. #        call_quest_journal(quest_id)
  201. #          quest_id : ID of the quest you want to open the scene on
  202. #
  203. #  If you do not specify a quest_id (line 198) then it will simply open the
  204. #  scene as it would normally. If you do specify a quest_id (line 199) then it
  205. #  will open the scene on that quest so long as it has been revealed and it is
  206. #  normally accessible through the quest menu.
  207. #
  208. #   Finally, the default way this script operates is that quests automatically
  209. #  complete or fail based on the status of the prime objectives. However, you
  210. #  can set it so that there are no prime objectives, in which case you can only
  211. #  complete, fail, or (re)activate a quest manually through the following code
  212. #  in a script call:
  213. #
  214. #        manually_complete_quest(quest_id)
  215. #          quest_id : ID of the quest you want to manually complete
  216. #        manually_fail_quest(quest_id)
  217. #          quest_id : ID of the quest you want to manually fail
  218. #        manually_activate_quest(quest_id)
  219. #          quest_id : ID of the quest you want to manually activate
  220. #==============================================================================

  221. $imported ||= {}
  222. $imported[:"MA_QuestJournal_1.0"] = true
  223. $imported[:"MA_QuestJournal_1.0.1"] = true

  224. #==============================================================================
  225. # *** QuestData
  226. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  227. #  This module contains all the configuration data for the quest journal
  228. #==============================================================================

  229. module QuestData
  230.   #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  231.   #  BEGIN Editable Region A
  232.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  233.   #  MENU_ACCESS - If true, you can access the quest journal through a command
  234.   # in the menu. If false, there will be no such command.
  235.   MENU_ACCESS = true
  236.   #  MENU_INDEX - If MENU_ACCESS is true, this determines where it appears
  237.   MENU_INDEX = 4
  238.   #  MAP_ACCESS - If true, this allows you to access the quest journal by
  239.   # pressing a key on the map.
  240.   MAP_ACCESS = true
  241.   #  MAP_BUTTON - If MAP_ACCESS is true, this determines which button calls the
  242.   # Quest Journal
  243.   MAP_BUTTON = :L
  244.   #  OPEN_TO_LAST_REVEALED_QUEST - If true, then the first time you open the
  245.   # quest journal after revealing a new quest, it will open to the new quest.
  246.   OPEN_TO_LAST_REVEALED_QUEST = true
  247.   #  OPEN_TO_LAST_CHANGED_QUEST - If true, then the Quest Journal will open to
  248.   # the last quest whose objective status has changed.
  249.   OPEN_TO_LAST_CHANGED_QUEST = false
  250.   #  LIST_WINDOW_WIDTH - The width, in pixels, of the List Window
  251.   LIST_WINDOW_WIDTH = 192
  252.   #  BASIC_DATA_TYPES  - This lets you set up additional types of data. Just
  253.   # include an identifying signal in the Array. Then, you will need to give
  254.   # each signal an icon (in the ICONS hash at line 322) and a signal text (in
  255.   # the VOCAB array at line 333, though it can be an empty string). Then, you
  256.   # can set the data itself when setting up quests by simply adding a:
  257.   #    q[:symbol] = ""
  258.   # line to the quest. You will also need to include the data type somewhere in
  259.   # the DATA_LAYOUT at line 306. As an example of this, I have included :client
  260.   # and :location by default. You can CTRL+F for anything in this section with
  261.   # one of those symbols (excluding :) and you will there need to add something
  262.   # for any new data types you add.
  263.   BASIC_DATA_TYPES = [:client, :location]
  264.   #  BASIC_DATA_WIDTH - This determines how much room, in pixels, is given to  
  265.   # any basic data types you set up in the data window.
  266.   BASIC_DATA_WIDTH = 240
  267.   #  CONCURRENT_ACTIVITY - If true, then when in the Quest Journal scene, you
  268.   # can switch categories or scroll down the quest list at the same time. If
  269.   # false, you will first need to select a category before you can start
  270.   # scrolling through the quest list.
  271.   CONCURRENT_ACTIVITY = true
  272.   #  HIDE_CATEGORY_CURSOR - If true, then the Category Window will not have a
  273.   # cursor and will instead just highlight the currently selected category.
  274.   # This is best when CONCURRENT_ACTIVITY is true.
  275.   HIDE_CATEGORY_CURSOR = true
  276.   #  SHOW_QUEST_ICONS - If true, then the icon you choose for each quest will
  277.   # be displayed to the left of its name in the Quest List window
  278.   SHOW_QUEST_ICONS = true
  279.   #  MANUAL_REVEAL - If false, then quests will be revealed the moment you
  280.   # first reveal, complete, or fail an objective. If this is true, you will
  281.   # need to specifically reveal each quest via a separate script call:
  282.   #    reveal_quest(quest_id)
  283.   MANUAL_REVEAL = false
  284.   #  DATA_LAYOUT - This controls the way that the quest window lays out all of
  285.   # the relevant data. If you set one of the entries to be an array, then any
  286.   # of the commands there will be drawn at the same y. With exception to :line,
  287.   # none of the commands will be drawn if the quest is not set to have that
  288.   # particular data. The symbols are:
  289.   #    :line        - Draws a horizontal line across the window.
  290.   #    :name        - Draws the name of the quest
  291.   #    :level       - Draws the level of the quest
  292.   #    :banner      - Draws the banner for the quest
  293.   #    :client      - Draws the client set in the quest   (basic data)
  294.   #    :location    - Draws the location set in the quest (basic data)
  295.   #    :description - Draws the quest's description
  296.   #    :objectives  - Draws all the quest's objectives that have been revealed
  297.   #    :rewards     - Draws whatever rewards have been set
  298.   #
  299.   # You will also need to add an entry for any new BASIC_DATA that you place
  300.   # in BASIC_DATA_TYPES at line 264.
  301.   #
  302.   # Remember to place a comma after each entry. Also note that this is only the
  303.   # default layout. You can set a different layout for any quest, and when
  304.   # viewing that quest, it will be the custom layout that is shown.
  305.   DATA_LAYOUT = [
  306.     [:line, :name, :level],
  307.     :banner,
  308.     :client,
  309.     :location,
  310.     :description,
  311.     :objectives,
  312.     [:line, :rewards],
  313.     :line,
  314.   ] # <= Do not touch.
  315.   #  ICONS - This is where you setup many of the icons used in the script. The
  316.   # purpose of each is listed next to it. Also, if you make any custom
  317.   # categories, you NEED to give them an icon by placing a line like the
  318.   # others. So, if the new custom category is :romance then you would need to
  319.   # set it like this:
  320.   #    romance:     107,
  321.   ICONS = {
  322.     all:         226, # The icon for the All Quests category
  323.     active:      236, # The icon for the Active Quests category
  324.     complete:    238, # The icon for the Complete Quests category
  325.     failed:      227, # The icon for the Failed Quests category
  326.     client:      121, # The icon for client data. If none wanted, set to 0
  327.     location:    231, # The icon for location data. If none wanted, set to 0
  328.     reward_gold: 262, # The icon for gold rewards. If none wanted, set to 0
  329.     reward_exp:  117, # The icon for exp rewards. If none wanted, set to 0
  330.   } # <= Do not touch.
  331.   #  VOCAB - This lets you choose some of the words used in the quest scene
  332.   VOCAB = {
  333.     # menu_label:  The command name in the menu if MENU_ACCESS is true
  334.     menu_label:       "Quests",
  335.     # scene_label: The label at the top of the scene. If empty, no window
  336.     scene_label:      "Quest Journal",
  337.     # description: The heading to identify the description
  338.     description:      "Description",
  339.     # objectives: The heading to identify the objectives
  340.     objectives:       "Objectives",
  341.     # objective_bullet: The bullet which shows up to the left of every
  342.     #  objective. If %d is included, it shows the objective's ID.
  343.     objective_bullet: "♦",
  344.     # rewards: The heading to identify the rewards.
  345.     rewards:          "Rewards",
  346.     # reward_amount: For item rewards, this is the text to show the amount.
  347.     #  It should include %d to show the amount.
  348.     reward_amount:    "x%d",
  349.     # reward_gold: Text to identify gold rewards
  350.     reward_gold:      "",
  351.     # reward_exp: Text to identify exp rewards
  352.     reward_exp:       "",
  353.     # level: If LEVEL_ICON is 0, this is the text which precedes the level
  354.     level:            "Rank: ",
  355.     # location: The text label for quest location
  356.     location:         "",
  357.     # location: The text label for quest client
  358.     client:           "",
  359.   } # <= Do not touch.
  360.   #  CATEGORIES - This array allows you to set which categories are available
  361.   # in the Quest scene. The default categories are :all, :active, :complete,
  362.   # and :failed, and their names are self-explanatory. You can add custom
  363.   # categories as well, but note that you will need to make sure that each new
  364.   # category has an icon set in the ICONS hash, as well as a label set in the
  365.   # CATEGORY_VOCAB hash (if you are using SHOW_CATEGORY_LABEL). It is also
  366.   # advisable to give it a sort type, unless you are fine with it being sorted
  367.   # by ID, as is default.
  368.   CATEGORIES = [:all, :active, :complete, :failed]
  369.   #  SHOW_CATEGORY_LABEL - This allows you to choose whether to show the name
  370.   # of the currently selected category. If true, it will choose the name out
  371.   # of the CATEGORY_VOCAB hash.
  372.   SHOW_CATEGORY_LABEL = true
  373.   #  CATEGORY_LABEL_IN_SAME_WINDOW - If SHOW_CATEGORY_LABEL is true, then this
  374.   # options lets you choose whether the label is shown in the same window as
  375.   # the category icons or in a separate window below. true = same window.
  376.   CATEGORY_LABEL_IN_SAME_WINDOW = true
  377.   #  CATEGORY_VOCAB - If SHOW_CATEGORY_LABEL is true, this hash lets you set the
  378.   # label for each category. For any custom categories you create, you will
  379.   # need to add a line for each below and in the same format:
  380.   #    :category => "Label",
  381.   # Don't forget to add the comma at the end of each line.
  382.   CATEGORY_VOCAB = {
  383.     :all =>      "All Quests",      # The label for the :all category
  384.     :active =>   "Active Quests",   # The label for the :active category
  385.     :complete => "Complete Quests", # The label for the :complete category
  386.     :failed =>   "Failed Quests",   # The label for the :failed category
  387.   } # <= Do not touch.
  388.   #  SORT_TYPE - This hash allows you to choose how each category is sorted.
  389.   # For each category, default or custom, you can set a different sort method
  390.   # There are seven options to choose from:
  391.   #    :id - The quests are sorted from lowest to highest ID
  392.   #    :alphabet - The quests are sorted in alphabetical order
  393.   #    :level - The quests are sorted from the lowest to highest level
  394.   #    :reveal - The quests are sorted from most recently revealed on.
  395.   #            Every time a new quest is revealed, it will be at the top.
  396.   #    :change - The quests are sorted from the one whose status most recently
  397.   #            changed on. So, every time an objective is modified, that quest
  398.   #            will be thrown to the top.
  399.   #    :complete - The quests are sorted from the most recently completed on.
  400.   #            Every time a quest is completed, it will be thrown to the top.
  401.   #    :failed - The quests are sorted from the most recently failed on.
  402.   #            Every time a quest is failed, it will be thrown to the top.
  403.   #
  404.   # Additionally, you can put _r at the end of any of the sort options and it
  405.   # will reverse the order. So, for instance, if the sort method for a category
  406.   # is :alphabet_r, then the quests will show up from Z-A
  407.   SORT_TYPE = {
  408.     :all =>      :id,       # Sort type for the All Quests category
  409.     :active =>   :change,   # Sort type for the Active Quests category
  410.     :complete => :complete, # Sort type for the Complete Quests category
  411.     :failed =>   :failed,   # Sort type for the Failed Quests category
  412.   } # <= Do not touch.
  413.   #  WINDOWSKIN - The windowskin for each window in the Quest scene. It must
  414.   # refer to a graphic in the System folder of Graphics. If set to false, then
  415.   # it will use whatever windowskin is default. If you are using a script which
  416.   # lets the player choose the windowskin, false is the recommended value.
  417.   WINDOWSKIN = false
  418.   #  WINDOW_TONE - The tone for each window. It must be an array in the form:
  419.   #      WINDOW_TONE = [red, green, blue, gray]
  420.   # gray can be excluded, but the other three must be present. If you set this
  421.   # value to false, then the windows will have whatever tone is default.
  422.   WINDOW_TONE = false
  423.   #  WINDOW_OPACITY - The opacity of the windows in the Quest scene. If set to
  424.   # false, it will use the default opacity for windows.
  425.   WINDOW_OPACITY = false
  426.   #  BG_PICTURE - This is a string referring to a picture in the Picture folder
  427.   # of Graphics. If set to "", then there will be no picture. Otherwise, it
  428.   # will display the selected picture below the windows but above the map in
  429.   # the Quest scene.
  430.   BG_PICTURE = ""
  431.   #  BG_OPACITY - This allows you to set the opacity of the background picture,
  432.   # if you have selected one.
  433.   BG_OPACITY = 255
  434.   #  BG_BLEND_TYPE - This allows you to set the blend type of the background
  435.   # picture, if you have selected one.
  436.   BG_BLEND_TYPE = 0
  437.   #  DESCRIPTION_IN_BOX - This is a graphical option, and it allows you to
  438.   # choose whether the description should be shown in a box.
  439.   DESCRIPTION_IN_BOX = true
  440.   #  LEVEL_ICON - This sets how levels are shown. If set to an integer, then it
  441.   # will draw the same icon numerous times up to the level of the quest. Ie. If
  442.   # the level's quest is 1, then the icon will only be drawn once, but if the
  443.   # level's quest is 4, it will be drawn 4 times. LEVEL_ICONS_SPACE determines
  444.   # the space between them. If you set LEVEL_ICON to 0, however, then it will
  445.   # instead draw a signal for the level, corresponding to that index in the
  446.   # LEVEL_SIGNALS array. If the LEVEL_SIGNALS array is empty, then it will just
  447.   # draw the integer for the level. Finally, LEVEL_ICON can also be an array of
  448.   # integers, in which case the level will be represented only by the icon set
  449.   # which corresponds to it in the array.
  450.   LEVEL_ICON = 125
  451.   #  LEVEL_ICONS_SPACE - If LEVEL_ICON is an integer, this is the amount of
  452.   # space between each time the icon is drawn.
  453.   LEVEL_ICONS_SPACE = 16
  454.   #  LEVEL_SIGNALS - If LEVEL_ICON is 0, this allows you to set what string
  455.   # should be the signal for each level. If this array is empty, then it will
  456.   # just draw the level integer. Ie. if the Quest is Level 4, it will draw 4.
  457.   LEVEL_SIGNALS = ["F", "E", "D", "C", "B", "A", "S"]
  458.   #  COLOURS - This lets you change the colour for various aspects of the
  459.   # quest scene. Each can be set in one of three ways:
  460.   #    :symbol - If you use a symbol, the colour will be the result of calling
  461.   #      the method of the same name. For instance, if you set something to
  462.   #      :system_color, it will set the colour to the result of the Window_Base
  463.   #      system_color method.
  464.   #    Integer - If you set the colour to an integer, then it will take its
  465.   #      colour from the windowskin palette, just like using \c[x] in messages.
  466.   #    Array - You can also set the rgba values directly with an array in the
  467.   #      format: [red, green, blue, alpha]. alpha can be excluded, but you must
  468.   #      have values for red, green, and blue.
  469.   COLOURS = {
  470.     # active: This sets the colour for active quests in the list and the name
  471.     #  of the active quest when shown in the data window.
  472.     active:           :normal_color,
  473.     # complete: This sets the colour for complete quests in the list and the
  474.     #  name of the complete quest when shown in the data window.
  475.     complete:         3,
  476.     # failed: This sets the colour for failed quests in the list and the name
  477.     #  of the failed quest when shown in the data window.
  478.     failed:           10,
  479.     # line:  This sets the colour for lines or boxes drawn in the quest scene
  480.     line:             :system_color,
  481.     # line_shadow:  This sets the colour of the shadow for lines or boxes drawn
  482.     #  in the quest scene
  483.     line_shadow: [0, 0, 0, 128],
  484.     # scene_label: This sets the colour for the scene label, if shown
  485.     scene_label:      :system_color,
  486.     # category_label: This sets the colour for the category label, if shown
  487.     category_label:   :normal_color,
  488.     # level_signal: This sets the colour for the level signal, if shown
  489.     level_signal:     :normal_color,
  490.     # objective_bullet: This sets the colour for objectives; if set to
  491.     #  :maqj_objective_color, it will reflect the completion status of the
  492.     #  objective, but you can change it to something else if you prefer
  493.     objective_bullet: :maqj_objective_color,
  494.     # reward_amount: The colour of the item amount, when shown
  495.     reward_amount:    :normal_color,
  496.     # heading: The colour of any headings in the script, like "Description"
  497.     heading:          :system_color,
  498.     # basic_label: For basic data, like client, the colour of the label
  499.     basic_label:      :system_color,
  500.     # basic_value: For basic data, like client, the colour of the value
  501.     basic_value:      :normal_color,
  502.   } # <= Do not touch.
  503.   #  HEADING_ALIGN - This sets the alignment for the aspects listed. 0 is Left;
  504.   # 1 is Centre; 2 is Right
  505.   HEADING_ALIGN = {
  506.     description: 0, # Alignment for the Description heading
  507.     objectives:  0, # Alignment for the Objectives heading
  508.     rewards:     1, # Alignment for the Rewards heading
  509.     level:       2  # Alignment when showing the level
  510.   } # <= Do not touch.
  511.   #````````````````````````````````````````````````````````````````````````````
  512.   #    Font Aspects
  513.   #
  514.   #  All of the following options (FONTNAMES, FONTSIZES, FONTBOLDS, and
  515.   # FONTITALICS) allow you to alter the fonts used for various aspects of the
  516.   # scene. The only one listed there by default is normal:, which is the
  517.   # font used by default for the entire scene. However, you can change the  
  518.   # fonts for almost any aspect - all you need to do is add a line like so:
  519.   #
  520.   #    description: value,
  521.   #
  522.   # and that will change that font aspect when drawing the description. The
  523.   # following symbols are available for changing:
  524.   #
  525.   #   normal:         The default font used for every part of the scene
  526.   #   list:           The font used in the List Window
  527.   #   scene_label:    The font used when drawing the Scene Label, if shown
  528.   #   category_label: The font used when drawing the Category Label, if shown
  529.   #   heading:        The font used when drawing any headings, like "Description"
  530.   #   name:           The font used when drawing the quest name in data window
  531.   #   description:    The font used when drawing the Description
  532.   #   objectives:     The font used when drawing the objectives
  533.   #   rewards:        The font used when drawing the rewards
  534.   #   client:         The font used when drawing the client
  535.   #   location:       The font used when drawing the location
  536.   #
  537.   # For any of them, you need to set a value. What the value can be depends
  538.   # on which font aspect you are changing and is described below, but for any
  539.   # of them setting it to the false will mean it will simply use the default
  540.   #
  541.   # For any that you add, remember that you must put a comma after the value.
  542.   #````````````````````````````````````````````````````````````````````````````
  543.   #  FONTNAMES - Here you can change the font used for any of the various
  544.   # options. It can take any of the following types of values:
  545.   #     false    - The default font will be used
  546.   #     "String" - The font with the name "String" will be used.
  547.   #     [Array]  - The array must be in the form: ["String1", "String2", ...]
  548.   #               The font used will be the first one in the array that the
  549.   #               player has installed.
  550.   #
  551.   #  EXAMPLES:
  552.   #
  553.   #    normal:      false,
  554.   #      The font used for unaltered aspects of the scene is the default font
  555.   #    scene_label: "Algerian",
  556.   #      The font used for the Scene Label will be Algerian.
  557.   #    description: ["Cambria", "Times New Roman"],
  558.   #      The font used when drawing the description will be Cambria if the
  559.   #      player has Cambria installed. If the player does not have Cambria
  560.   #      installed, then the font used will be Times New Roman
  561.   FONTNAMES = {
  562.     normal: false, # normal: the default font name
  563.   } # <= Do not touch.
  564.   #  FONTSIZES - Here you can change the size of the font. There are two types
  565.   # of values you can set:
  566.   #    false   - The default fontsize will be used
  567.   #    Integer - The fontsize will be equal to the value of the Integer.
  568.   #  
  569.   # For everything but the label windows, this shouldn't exceed 24, since that
  570.   # is the line_height. However, for scene_label: and category_label:, the size
  571.   # of the window will be adjusted to whatever size you set the font.
  572.   FONTSIZES = {
  573.     normal:         false, # normal: default font size
  574.     scene_label:    28,    # scene_label: fontsize for the Scene Label window
  575.     category_label: 24,    # category_label: fontsize for Category Label window
  576.   } # <= Do not touch.
  577.   #  FONTBOLDS - Here you can set whether the font will be bolded. You can set
  578.   # it to either false, in which case it will not be bolded, or true, in which
  579.   # case it will be bolded.
  580.   FONTBOLDS = {
  581.     scene_label:  true, # scene_label: whether font is bold for Scene Label
  582.     heading:      true, # heading: whether font is bold for the headings
  583.     level_signal: true, # level_signal: whether font is bold for level
  584.   } # <= Do not touch.
  585.   #  FONTITALICS - Here you can set whether the font will be italicized. You
  586.   # can set it to either false, in which case it will not be italicized, or
  587.   # true, in which case it will be italicized.
  588.   FONTITALICS = {
  589.   }
  590.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  591.   #  END Editable Region A
  592.   #//////////////////////////////////////////////////////////////////////////
  593.   CATEGORIES = [:all] if !CATEGORIES || CATEGORIES.empty?
  594.   VOCAB.default = ""
  595.   ICONS.default = 0
  596.   CATEGORY_VOCAB.default = ""
  597.   SORT_TYPE.default = :id
  598.   COLOURS.default = :normal_color
  599.   HEADING_ALIGN.default = 0
  600.   FONTNAMES.default = false
  601.   FONTSIZES.default = false
  602.   FONTBOLDS.default = false
  603.   FONTITALICS.default = false
  604.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  605.   # * Setup Quest
  606.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  607.   def self.setup_quest(quest_id)
  608.     q = { objectives: [] }
  609.     case quest_id
  610.     #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  611.     #  BEGIN Editable Region B
  612.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  613.     #    Quest Setup
  614.     #
  615.     #  This is where you set up the data for every quest in the game. While
  616.     # it may seem complicated, I urge you to pay attention and, once you get
  617.     # the hang of it, I am sure it will quickly become second nature.
  618.     #
  619.     #  Every single quest should be set up in the following format, but note
  620.     # that if you are not setting anything for a particular aspect, you can
  621.     # delete that line. Anyway, this is what each quest should look like, with
  622.     # the values on the left being the default values if you don't set them:
  623.     #
  624.     #  when quest_id
  625.     #   q[:name]              = "??????"
  626.     #   q[:icon_index]        = 0
  627.     #   q[:level]             = 0
  628.     #   q[:description]       = ""
  629.     #   q[:banner]            = ""
  630.     #   q[:banner_hue]        = 0
  631.     #   q[:objectives][0]     = ""
  632.     #   q[:objectives][1]     = ""
  633.     #   q[:objectives][2]     = ""
  634.     #   q[:objectives][n]     = ""
  635.     #   q[:prime_objectives]  = [0, 1, 2, n]
  636.     #   q[:custom_categories] = []
  637.     #   q[:client]            = ""
  638.     #   q[:location]          = ""
  639.     #   q[:rewards]           = []
  640.     #   q[:common_event_id]   = 0
  641.     #   q[:layout]            = false
  642.     #
  643.     #  For each line, with the exception of objectives, it is only the value on
  644.     # the right of the equals sign that you will need to change. Now I will
  645.     # explain each line:
  646.     #
  647.     # when quest_id
  648.     #    quest_id - is an integer of your choosing, and this is how you
  649.     #        reference a quest in order to advance and do anything else. It
  650.     #        must be unique for every quest; if you use 1 for the first quest,
  651.     #        you cannot use 1 for any other quest.
  652.     #
  653.     #   q[:name]              = ""
  654.     #     "" - This line sets the name of the quest which shows in the Quest
  655.     #        List.
  656.     #   
  657.     #   q[:icon_index]        = 0
  658.     #     0  - This line sets the icon to be used for this quest. It will show
  659.     #        to the left of the quest's name in the Quest List.
  660.     #
  661.     #   q[:level]             = 0
  662.     #     0  - This line sets the level of the quest. If 0, no level will be
  663.     #        shown. See the level options at lines 441-458 for more detail.
  664.     #   
  665.     #   q[:description]       = ""
  666.     #     "" - This line sets the description of the quest. You can use message
  667.     #        codes in this string, but if you are using "" then you need to use
  668.     #        \\ to identify codes and not just \. Ie. It's \\v[x], not \v[x]
  669.     #
  670.     #   q[:objectives][0]     = ""
  671.     #   q[:objectives][1]     = ""
  672.     #   q[:objectives][2]     = ""
  673.     #   q[:objectives][n]     = ""
  674.     #  Objectives are slightly different. Notice that after q[:objectives] on
  675.     # each line there is an integer enclosed in square brackets:
  676.     #    [n] - This is the ID of the objective, and n MUST be an integer. No
  677.     #       quest can have more than one objective with the same ID. This is
  678.     #       how you identify which objective you want to reveal, complete or
  679.     #       fail. That said, you can make as many objectives as you want, as
  680.     #       long as you give them all distinct IDs. The IDs should be in
  681.     #       sequence as well, so there shouldn't be a q[:objectives][5] if
  682.     #       there is no q[:objectives][4].
  683.     #     "" - This is the text of the objective. You can use message codes in
  684.     #        this string, but if you are using "" then you will need to use
  685.     #        \\ to identify codes and not just \. Ie: It's \\v[x], not \v[x]
  686.     #
  687.     #   q[:prime_objectives]  = [0, 1, 2, n]
  688.     #     [0, 1, 2, n] - This array determines what objectives need to be
  689.     #        completed in order for the quest to be complete. In other words,
  690.     #        all of the objectives with the IDs in this array need to be
  691.     #        complete for the quest to be complete. If any one of them is
  692.     #        failed, the quest will be failed. If you remove this line
  693.     #        altogether, then all objectives are prime. If you set this to [],
  694.     #        then the quest will never be automatically completed or failed and
  695.     #        you need to use the manual options described at lines 208-219.
  696.     #
  697.     #   q[:custom_categories] = []
  698.     #     [] - This allows you to set an array of custom categories for this
  699.     #        quest, whiich means this quest will show up in each of those
  700.     #        categories if you add it to the CATEGORIES array at line 370.
  701.     #        Note that each category you make must be identified by a unique
  702.     #        :symbol, and you must set up all the category details for that
  703.     #        :symbol.
  704.     #
  705.     #   q[:banner]            = ""
  706.     #     "" - This line sets the banner to be used for a quest. It must be the
  707.     #        filename of an image in the Pictures folder of Graphics.
  708.     #
  709.     #   q[:banner_hue]        = 0
  710.     #     0 - The hue of the banner graphic, if used
  711.     #
  712.     #   q[:client]            = ""
  713.     #     "" - This line sets the client name for this quest. (basic data)
  714.     #
  715.     #   q[:location]          = ""
  716.     #     "" - This line sets the location of the quest. (basic data)
  717.     #
  718.     #   q[:rewards]           = []
  719.     #    [] - In this array, you can identify particular rewards that will
  720.     #       show up. Each reward should be in its own array and can be any of
  721.     #       the following:
  722.     #          [:item, ID, n],
  723.     #          [:weapon, ID, n],
  724.     #          [:armor, ID, n],
  725.     #          [:gold, n],
  726.     #          [:exp, n],
  727.     #       where ID is the ID of the item, weapon or armour you want
  728.     #       distributed and n is the amount of the item, weapon, armor, gold,
  729.     #       or experience you want distributed. Additionally, you can also set
  730.     #       some text to show up in the rewards format but which wouldn't be
  731.     #       automatically distributed. You would need to specify that type of
  732.     #       reward text in the following format:
  733.     #          [:string, icon_index, "string", "vocab"],
  734.     #       where icon_index is the icon to be shown, "string" is what you
  735.     #       would show up as the amount, and "vocab" is what would show up as a
  736.     #       label between the icon and the amount.
  737.     #      
  738.     #
  739.     #   q[:common_event_id]   = 0
  740.     #     0  - This allows you to call the identified common event immediately
  741.     #        and automatically once the quest is completed. It is generally
  742.     #        not recommended, as for most quests you should be controlling it
  743.     #        enough not to need this feature.
  744.     #
  745.     #   q[:layout]            = false
  746.     #     false - The default value for this is false, and when it is false the
  747.     #        layout for the quest will be inherited from the default you set at
  748.     #        302. However, you can also give the quest its own layout - the
  749.     #        format would be the same as you set for the default at line 307.
  750.     #  
  751.     # Template:
  752.     #
  753.     #  When making a new quest, I recommend that you copy and paste the
  754.     # following template, removing whichever lines you don't want to alter.
  755.     # Naturally, you need to remove the #~. You can do so by highlighting
  756.     # the entire thing and pressing CTRL+Q:
  757. #~     when 2 # <= REMINDER: The Quest ID MUST be unique
  758. #~       q[:name]              = "??????"
  759. #~       q[:icon_index]        = 0
  760. #~       q[:level]             = 0
  761. #~       q[:description]       = ""
  762. #~       # REMINDER: You can make as many objectives as you like, but each must
  763. #~       # have a unique ID.
  764. #~       q[:objectives][0]     = ""
  765. #~       q[:objectives][1]     = ""
  766. #~       q[:objectives][2]     = ""
  767. #~       q[:prime_objectives]  = [0, 1, 2]
  768. #~       q[:custom_categories] = []
  769. #~       q[:banner]            = ""
  770. #~       q[:banner_hue]        = 0
  771. #~       q[:client]            = ""
  772. #~       q[:location]          = ""
  773. #~       q[:rewards]           = []
  774. #~       q[:common_event_id]   = 0
  775.     when 1 # Quest 1 - SAMPLE QUEST
  776.       q[:name]              = "Runaway Bride"
  777.       q[:level]             = 3
  778.       q[:icon_index]        = 7
  779.       q[:description]       = "A local woman was abducted by bandits on the night of her wedding."
  780.       q[:objectives][0]     = "Talk to Boris"
  781.       q[:objectives][1]     = "Search the Haunted Woods for Boris' wife, Ladia"
  782.       q[:objectives][2]     = "Slay the Bandits"
  783.       q[:objectives][3]     = "Escort Ladia back to Boris"
  784.       q[:prime_objectives]  = [1, 2]
  785.       q[:custom_categories] = []
  786.       q[:banner]            = ""
  787.       q[:banner_hue]        = 0
  788.       q[:client]            = "Boris"
  789.       q[:location]          = "The Haunted Woods"
  790.       q[:common_event_id]   = 0
  791.       q[:rewards]           = [
  792.         [:item, 1, 3],
  793.         [:gold, 500],
  794.       ]
  795.       q[:layout]            = false
  796.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  797.     #  END Editable Region B
  798.     #//////////////////////////////////////////////////////////////////////
  799.     end
  800.     q
  801.   end
  802. end

  803. #==============================================================================
  804. # *** DataManager
  805. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  806. #  Summary of Changes:
  807. #    aliased method - self.extract_save_contents
  808. #==============================================================================

  809. class << DataManager
  810.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  811.   # * Extract Save Contents
  812.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  813.   alias maqj_extractsavecons_2kw5 extract_save_contents
  814.   def extract_save_contents(*args, &block)
  815.     maqj_extractsavecons_2kw5(*args, &block) # Call Original Method
  816.     if $game_party.quests.nil?
  817.       $game_party.init_maqj_data
  818.       $game_system.init_maqj_data
  819.     end
  820.   end
  821. end

  822. #==============================================================================
  823. # ** MAQJ_SortedArray
  824. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  825. #  This module mixes in to an array to maintain the sorted order when inserting
  826. #==============================================================================

  827. module MAQJ_SortedArray
  828.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  829.   # * Insert to Array
  830.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831.   def maqj_insert_sort(el, &block)
  832.     index = bsearch_index(el, 0, size, &block)
  833.     index ? insert(index, el) : push(el)
  834.   end
  835.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  836.   # * Retrieve Index from Binary Search
  837.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  838.   def bsearch_index(el, b = 0, e = size, &block)
  839.     return bsearch_index(el, b, e) { |a,b| a <=> b } if block.nil?
  840.     return b if b == e # Return the discovered insertion index
  841.     return if b > e
  842.     m = (b + e) / 2    # Get Middle
  843.     block.call(el, self[m]) > 0 ? b = m + 1 : e = m
  844.     bsearch_index(el, b, e, &block)
  845.   end
  846. end

  847. #==============================================================================
  848. # ** Game_Quest
  849. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  850. #  This class holds all instance data for a quest
  851. #==============================================================================

  852. class Game_Quest
  853.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  854.   # * Public Instance Variables
  855.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  856.   attr_reader   :id                  # Unique identifier for this quest
  857.   attr_reader   :name                # The name to be shown for the quest
  858.   attr_reader   :level               # The level of difficulty of the quest
  859.   attr_reader   :objectives          # An array of objective strings
  860.   attr_reader   :prime_objectives    # An array of crucial objective IDs
  861.   attr_reader   :revealed_objectives # An array of revealed objective IDs
  862.   attr_reader   :complete_objectives # An array of completed objective IDs
  863.   attr_reader   :failed_objectives   # An array of failed objective IDs
  864.   attr_reader   :custom_categories   # An array of category symbols
  865.   attr_accessor :icon_index          # Icon associated with this quest
  866.   attr_accessor :common_event_id     # ID of common event to call upon complete
  867.   attr_accessor :description         # The description for the quest
  868.   attr_accessor :banner              # Picture shown to represent the quest
  869.   attr_accessor :banner_hue          # The hue of the banner
  870.   attr_accessor :layout              # The layout of this quest in scene
  871.   attr_accessor :rewards             # An array of rewards to show
  872.   attr_accessor :reward_given        # Boolean tracking if quest was rewarded
  873.   attr_accessor :concealed           # Whether or not the quest is visible
  874.   attr_accessor :manual_status       # Quest status if not using prime objectives
  875.   QuestData::BASIC_DATA_TYPES.each { |data_type| attr_accessor(data_type) }
  876.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  877.   # * Object Initialization
  878.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  879.   def initialize(quest_id)
  880.     @id = quest_id
  881.     @concealed = default_value_for(:concealed)
  882.     @reward_given = default_value_for(:reward_given)
  883.     reset
  884.   end
  885.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  886.   # * Reset
  887.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  888.   def reset
  889.     data = QuestData.setup_quest(@id)
  890.     data_symbol_array.each { |meth| instance_variable_set(:"@#{meth}",
  891.       data[meth] ? data[meth] : default_value_for(meth)) }
  892.     @revealed_objectives = [].send(:extend, MAQJ_SortedArray)
  893.     @complete_objectives = [].send(:extend, MAQJ_SortedArray)
  894.     @failed_objectives =   [].send(:extend, MAQJ_SortedArray)
  895.     @manual_status = default_value_for(:manual_status)
  896.   end
  897.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  898.   # * Data Symbol Array
  899.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  900.   def data_symbol_array
  901.     [:name, :level, :objectives, :prime_objectives, :custom_categories,
  902.       :icon_index, :description, :banner, :banner_hue, :common_event_id,
  903.       :layout, :rewards] + QuestData::BASIC_DATA_TYPES
  904.   end
  905.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  906.   # * Default Value
  907.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  908.   def default_value_for(method)
  909.     case method
  910.     when :name then "??????"
  911.     when :description, :banner then ""
  912.     when :level, :banner_hue, :icon_index, :common_event_id then 0
  913.     when :objectives, :rewards, :custom_categories then []
  914.     when :prime_objectives then Array.new(objectives.size) { |x| x }
  915.     when :concealed then QuestData::MANUAL_REVEAL
  916.     when :manual_status then :active
  917.     when :layout, :reward_given then false
  918.     else ""
  919.     end
  920.   end
  921.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  922.   # * Reveal/Conceal Objective
  923.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  924.   def reveal_objective(*obj)
  925.     valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }
  926.     valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }
  927.     quest_status_changed unless valid_obj.empty?
  928.   end
  929.   def conceal_objective(*obj)
  930.     quest_status_changed unless (obj & @revealed_objectives).empty?
  931.     obj.each { |obj_id| @revealed_objectives.delete(obj_id) }
  932.   end
  933.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  934.   # * Complete/Uncomplete Objective
  935.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  936.   def complete_objective(*obj)
  937.     valid_obj = obj.select {|x| x < objectives.size && !@complete_objectives.include?(x) }
  938.     reveal_objective(*valid_obj)
  939.     unfail_objective(*valid_obj)
  940.     was_complete = status?(:complete)
  941.     valid_obj.each {|i| @complete_objectives.maqj_insert_sort(i) }
  942.     quest_status_changed unless valid_obj.empty?
  943.     # If just completed
  944.     if status?(:complete) && !was_complete
  945.       $game_temp.reserve_common_event(common_event_id)
  946.       $game_party.quests.add_to_sort_array(:complete, @id)
  947.     end
  948.   end
  949.   def uncomplete_objective(*obj)
  950.     quest_status_changed unless (obj & @complete_objectives).empty?
  951.     obj.each { |obj_id| @complete_objectives.delete(obj_id) }
  952.   end
  953.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  954.   # * Fail/Unfail Objective
  955.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  956.   def fail_objective(*obj)
  957.     valid_obj = obj.select {|x| x < objectives.size && !@failed_objectives.include?(x) }
  958.     reveal_objective(*valid_obj)
  959.     uncomplete_objective(*valid_obj)
  960.     was_failed = status?(:failed)
  961.     valid_obj.each {|i| @failed_objectives.maqj_insert_sort(i) }
  962.     quest_status_changed unless valid_obj.empty?
  963.     $game_party.quests.add_to_sort_array(:failed, @id) if status?(:failed) && !was_failed
  964.   end
  965.   def unfail_objective(*obj)
  966.     quest_status_changed unless (obj & @failed_objectives).empty?
  967.     obj.each { |obj_id| @failed_objectives.delete(obj_id) }
  968.   end
  969.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  970.   # * Updates when the quest status has been changed
  971.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972.   def quest_status_changed
  973.     $game_party.quests.add_to_sort_array(:change, @id)
  974.     $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST
  975.   end
  976.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  977.   # * Objective Status?
  978.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  979.   def objective_status?(status_check, *obj)
  980.     return false if obj.empty?
  981.     case status_check
  982.     when :failed   then !(obj & @failed_objectives).empty?
  983.     when :complete then obj.size == (obj & @complete_objectives).size
  984.     when :revealed then obj.size == (obj & @revealed_objectives).size
  985.     when :active then objective_status?(:revealed, *obj) &&
  986.       !objective_status?(:complete, *obj) && !objective_status?(:failed, *obj)
  987.     end
  988.   end
  989.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  990.   # * Status?
  991.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  992.   def status?(status_check)
  993.     case status_check
  994.     when :failed  
  995.       @prime_objectives.empty? ? @manual_status == :failed :
  996.         !(@failed_objectives & @prime_objectives).empty?
  997.     when :complete
  998.       @prime_objectives.empty? ? @manual_status == :complete : !status?(:failed) &&
  999.         ((@prime_objectives & @complete_objectives) == @prime_objectives)
  1000.     when :active then !concealed && !status?(:complete) && !status?(:failed)
  1001.     when :reward then @reward_given
  1002.     end
  1003.   end
  1004.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1005.   # * Set Name
  1006.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1007.   def name=(new_name)
  1008.     @name = new_name
  1009.     $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party &&
  1010.       $game_party.quests
  1011.   end
  1012.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1013.   # * Set Level
  1014.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1015.   def level=(new_lvl)
  1016.     [url=home.php?mod=space&uid=22147]@level[/url] = new_lvl
  1017.     $game_party.quests.add_to_sort_array(:level, @id) if $game_party &&
  1018.       $game_party.quests
  1019.   end
  1020. end

  1021. #==============================================================================
  1022. # ** Game_Quests
  1023. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1024. #  This is a wrapper for an array holding Game_Quest objects
  1025. #==============================================================================

  1026. class Game_Quests
  1027.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1028.   # * Object Initialization
  1029.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1030.   def initialize
  1031.     @data = {}
  1032.     @sort_arrays = {
  1033.       reveal: [], change: [], complete: [], failed: [],
  1034.       id:       [].send(:extend, MAQJ_SortedArray),
  1035.       alphabet: [].send(:extend, MAQJ_SortedArray),
  1036.       level:    [].send(:extend, MAQJ_SortedArray)
  1037.     }
  1038.   end
  1039.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1040.   # * Get Quest
  1041.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1042.   def [](quest_id)
  1043.     reset_quest(quest_id) if !@data[quest_id]
  1044.     @data[quest_id]
  1045.   end
  1046.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1047.   # * Set Quest <- Not sure when this would ever be useful.
  1048.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1049.   def []=(quest_id, value)
  1050.     @data[quest_id] = value
  1051.   end
  1052.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1053.   # * List
  1054.   #    list_type : the type of list to return
  1055.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1056.   def list(list_type = :all, sort_type = $game_system.quest_sort_type[list_type])
  1057.     sort_type_s = sort_type.to_s
  1058.     reverse = !(sort_type_s.sub!(/_r$/, "")).nil?
  1059.     sort_type = sort_type_s.to_sym
  1060.     list = @sort_arrays[sort_type].select { |quest_id| include?(quest_id, list_type) }
  1061.     list.reverse! if reverse
  1062.     list.collect { |quest_id| @data[quest_id] }
  1063.   end
  1064.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1065.   # * Include?
  1066.   #    determines whether to include a particular quest depending on list type
  1067.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1068.   def include?(quest_id, list_type = :all)
  1069.     return false if !revealed?(quest_id)
  1070.     case list_type
  1071.     when :all then true
  1072.     when :complete, :failed, :active then @data[quest_id].status?(list_type)
  1073.     else
  1074.       @data[quest_id].custom_categories.include?(list_type)
  1075.     end
  1076.   end
  1077.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1078.   # * Revealed?
  1079.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1080.   def revealed?(quest_id)
  1081.     (!@data[quest_id].nil? && !@data[quest_id].concealed)
  1082.   end
  1083.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1084.   # * Setup Quest
  1085.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1086.   def setup_quest(quest_id)
  1087.     return if @data[quest_id]
  1088.     @data[quest_id] = Game_Quest.new(quest_id)
  1089.     # Open to this quest next time the QJ is opened
  1090.     $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST
  1091.     # Save sorting order in separate arrays to avoid re-sorting every time
  1092.     @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }
  1093.   end
  1094.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1095.   # * Delete Quest
  1096.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1097.   def delete_quest(quest_id)
  1098.     @data.delete(quest_id)
  1099.     @sort_arrays.values.each { |ary| ary.delete(quest_id) }
  1100.   end
  1101.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1102.   # * Reset Quest
  1103.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1104.   def reset_quest(quest_id)
  1105.     delete_quest(quest_id)
  1106.     setup_quest(quest_id)
  1107.   end
  1108.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1109.   # * Add to Sorted Array
  1110.   #    sort_type : array to alter
  1111.   #    quest_id  : ID of the quest to add.
  1112.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1113.   def add_to_sort_array(sort_type, quest_id)
  1114.     @sort_arrays[sort_type].delete(quest_id) # Make sure always unique
  1115.     case sort_type
  1116.     when :reveal, :change, :complete, :failed
  1117.       @sort_arrays[sort_type].unshift(quest_id)
  1118.     when :id
  1119.       @sort_arrays[sort_type].maqj_insert_sort(quest_id)
  1120.     when :alphabet
  1121.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].name.downcase <=> @data[b].name.downcase }
  1122.     when :level
  1123.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].level <=> self[b].level }
  1124.     end
  1125.   end
  1126.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1127.   # * Find Location
  1128.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1129.   def find_location(quest_id, cat = nil)
  1130.     if revealed?(quest_id)
  1131.       categories = $game_system.quest_categories.dup
  1132.       # If cat specified, check in that category first.
  1133.       if cat && categories.include?(cat)
  1134.         categories.delete(cat)
  1135.         categories.unshift(cat)
  1136.       end
  1137.       for category in categories # Check all categories
  1138.         index = list(category).index(@data[quest_id])
  1139.         return category, index if index != nil
  1140.       end
  1141.     end
  1142.     return nil, nil
  1143.   end
  1144.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1145.   # * Clear
  1146.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1147.   def clear
  1148.     @data.clear
  1149.   end
  1150. end

  1151. #==============================================================================
  1152. # ** Game System
  1153. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1154. #  Summary of Changes:
  1155. #    new attr_accessor - quest_menu_access; quest_map_access; quest_sort_type;
  1156. #      quest_bg_picture; quest_bg_opacity; quest_windowskin;
  1157. #      quest_window_opacity; quest_access_disabled; last_quest_cat;
  1158. #      last_quest_id
  1159. #    aliased methods - initialize
  1160. #    new methods - init_maqj_data
  1161. #==============================================================================

  1162. class Game_System
  1163.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1164.   # * Public Instance Variables
  1165.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1166.   attr_reader   :quest_menu_access     # Whether the scene is called from menu
  1167.   attr_accessor :quest_map_access      # Whether the scene is called from map
  1168.   attr_accessor :quest_sort_type       # The sort types for each category
  1169.   attr_accessor :quest_bg_picture      # The filename of the background picture
  1170.   attr_accessor :quest_bg_opacity      # The opacity of the background picture
  1171.   attr_accessor :quest_bg_blend_type   # The blend type of the background pic
  1172.   attr_accessor :quest_windowskin      # The windowskin used for the scene
  1173.   attr_accessor :quest_window_tone     # The tone of windows in the scene
  1174.   attr_accessor :quest_window_opacity  # The opacity of windows in the scene
  1175.   attr_accessor :quest_access_disabled # Whether access to Quests is disabled
  1176.   attr_accessor :quest_categories      # The categories to show in the scene
  1177.   attr_accessor :quest_scene_label     # The label to show in the scene
  1178.   attr_accessor :last_quest_cat        # The category to open to
  1179.   attr_accessor :last_quest_id         # The ID to open to
  1180.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1181.   # * Object Initialization
  1182.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1183.   alias maqj_initialze_2cy9 initialize
  1184.   def initialize(*args, &block)
  1185.     maqj_initialze_2cy9(*args, &block)
  1186.     init_maqj_data
  1187.   end
  1188.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1189.   # * Initialize Quest Data
  1190.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1191.   def init_maqj_data
  1192.     # Initialize new variables
  1193.     self.quest_menu_access = QuestData::MENU_ACCESS
  1194.     @quest_map_access = QuestData::MAP_ACCESS
  1195.     @quest_sort_type = QuestData::SORT_TYPE
  1196.     @quest_bg_picture = QuestData::BG_PICTURE
  1197.     @quest_bg_opacity = QuestData::BG_OPACITY
  1198.     @quest_bg_blend_type = QuestData::BG_BLEND_TYPE
  1199.     @quest_windowskin = QuestData::WINDOWSKIN
  1200.     @quest_window_tone = QuestData::WINDOW_TONE
  1201.     @quest_window_opacity = QuestData::WINDOW_OPACITY
  1202.     @quest_access_disabled = false
  1203.     @quest_categories = QuestData::CATEGORIES
  1204.     @quest_scene_label = QuestData::VOCAB[:scene_label]
  1205.     @last_quest_cat = @quest_categories[0]
  1206.     @last_quest_id = 0
  1207.   end
  1208.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1209.   # * Set Quest Menu Access
  1210.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1211.   def quest_menu_access=(boolean)
  1212.     @quest_menu_access = boolean
  1213.     maic_inserted_menu_commands.delete(:quest_journal)
  1214.     maic_inserted_menu_commands.push(:quest_journal) if @quest_menu_access
  1215.     maic_inserted_menu_commands.sort!
  1216.   end
  1217. end

  1218. #==============================================================================
  1219. # ** Game_Party
  1220. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1221. #  Summary of Changes:
  1222. #    new attr_reader - quests
  1223. #    aliased method - initialize
  1224. #    new method - init_maqj_data
  1225. #==============================================================================

  1226. class Game_Party
  1227.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1228.   # * Public Instance Variables
  1229.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1230.   attr_reader :quests
  1231.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1232.   # * Object Initialization
  1233.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1234.   alias maqj_intiaze_2si9 initialize
  1235.   def initialize(*args, &block)
  1236.     maqj_intiaze_2si9(*args, &block) # Call Original Method
  1237.     init_maqj_data
  1238.   end
  1239.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1240.   # * Initialize Quests
  1241.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1242.   def init_maqj_data
  1243.     @quests = Game_Quests.new # Initialize @quests
  1244.   end
  1245. end

  1246. #==============================================================================
  1247. # ** Game_Interpreter
  1248. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1249. #  Summary of Changes:
  1250. #    new methods - change_quest_access; change_quest_background;
  1251. #      change_quest_windows; setup_quest; delete_quest; reset_quest; quest;
  1252. #      reveal_quest; conceal_quest; manually_complete_quest;
  1253. #      manually_fail_quest; reveal_objective; conceal_objective;
  1254. #      complete_objective; uncomplete_objective; fail_objective;
  1255. #      unfail_objective; quest_revealed?; quest_complete?; quest_active?;
  1256. #      quest_failed?; objective_complete?; objective_active?;
  1257. #      objective_failed?; distribute_quest_rewards; distribute_quest_reward;
  1258. #      call_quest_journal
  1259. #==============================================================================

  1260. class Game_Interpreter
  1261.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1262.   # * Change Quest Access
  1263.   #    sym : symbol representing what aspect of access is being changed
  1264.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1265.   def change_quest_access(sym)
  1266.     case sym
  1267.     when :enable then $game_system.quest_access_disabled = false
  1268.     when :disable then $game_system.quest_access_disabled = true
  1269.     when :enable_menu then $game_system.quest_menu_access = true
  1270.     when :disable_menu then $game_system.quest_menu_access = false
  1271.     when :enable_map then $game_system.quest_map_access = true
  1272.     when :disable_map then $game_system.quest_map_access = false
  1273.     end
  1274.   end
  1275.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1276.   # * Change Quest Background
  1277.   #    picture : picture to show in the scene's background
  1278.   #    opacity : opacity of the picture shown in the scene's background
  1279.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1280.   def change_quest_background(picture, opacity = $game_system.quest_bg_opacity,
  1281.       blend_type = $game_system.quest_bg_blend_type)
  1282.     $game_system.quest_bg_picture = picture
  1283.     $game_system.quest_bg_opacity = opacity
  1284.     $game_system.quest_bg_blend_type = blend_type
  1285.   end
  1286.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1287.   # * Change Quest Windows
  1288.   #    skin    : windowskin name to use in the scene
  1289.   #    tone    : tone for the windowskin
  1290.   #    opacity : opacity of windows in the scene
  1291.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1292.   def change_quest_windows(skin, tone = $game_system.quest_window_tone,
  1293.       opacity = $game_system.quest_window_opacity)
  1294.     $game_system.quest_windowskin = skin
  1295.     $game_system.quest_window_tone = tone
  1296.     $game_system.quest_window_opacity = opacity
  1297.   end
  1298.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1299.   # * Setup/Delete/Reset Quest
  1300.   #    quest_id : ID of the quest to be setup or deleted or reset
  1301.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1302.   [:setup_quest, :delete_quest, :reset_quest].each { |method|
  1303.     define_method(method) do |quest_id|
  1304.       $game_party.quests.send(method, quest_id)
  1305.     end
  1306.   }
  1307.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1308.   # * Retrieve Quest
  1309.   #    quest_id : ID of the quest to retrieve
  1310.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1311.   def quest(quest_id);         $game_party.quests[quest_id];      end
  1312.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1313.   # * Reveal/Conceal Quest
  1314.   #    quest_id : ID of the quest to be revealed or concealed
  1315.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1316.   def reveal_quest(quest_id);  quest(quest_id).concealed = false; end
  1317.   def conceal_quest(quest_id); quest(quest_id).concealed = true;  end
  1318.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1319.   # * Manually Complete/Fail Quest
  1320.   #    quest_id : ID of the quest to be revealed or concealed
  1321.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1322.   def manually_complete_quest(quest_id)
  1323.     quest(quest_id).prime_objectives.clear
  1324.     quest(quest_id).manual_status = :complete
  1325.   end
  1326.   def manually_fail_quest(quest_id)
  1327.     quest(quest_id).prime_objectives.clear
  1328.     quest(quest_id).manual_status = :failed
  1329.   end
  1330.   def manually_activate_quest(quest_id)
  1331.     quest(quest_id).manual_status = :active
  1332.   end
  1333.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1334.   # * Reveal/Complete/Fail/Conceal/Uncomplete/Unfail Objective
  1335.   #    quest_id : ID of the quest whose objectives will be modified
  1336.   #    *obj     : IDs of objectives to reveal or complete or fail (or opposite)
  1337.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1338.   [:reveal_objective, :complete_objective, :fail_objective, :conceal_objective,
  1339.   :uncomplete_objective, :unfail_objective].each { |method|
  1340.     define_method(method) do |quest_id, *obj|
  1341.       quest(quest_id).send(method, *obj)
  1342.     end
  1343.   }
  1344.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1345.   # * Quest Revealed?
  1346.   #    quest_id : ID of the quest you are checking is revealed
  1347.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1348.   def quest_revealed?(quest_id)
  1349.     $game_party.quests.revealed?(quest_id)
  1350.   end
  1351.   [:complete, :failed, :active].each { |method|
  1352.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1353.     # * Quest Complete/Failed/Active?
  1354.     #    quest_id : ID of the quest whose completion status is being checked
  1355.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1356.     define_method(:"quest_#{method}?") do |quest_id|
  1357.       quest_revealed?(quest_id) && quest(quest_id).status?(method)
  1358.     end
  1359.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1360.     # * Objective Complete/Failed/Active?
  1361.     #    quest_id : ID of the quest whose objectives are being checked
  1362.     #    *obj     : IDs of objectives to check completion status
  1363.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1364.     define_method(:"objective_#{method}?") do |quest_id, *obj|
  1365.       quest_revealed?(quest_id) && quest(quest_id).objective_status?(method, *obj)
  1366.     end
  1367.   }
  1368.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1369.   # * Objective Revealed?
  1370.   #    quest_id : ID of the quest you are checking is revealed
  1371.   #    *obj     : IDs of objectives to check completion status
  1372.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1373.   def objective_revealed?(quest_id, *obj)
  1374.     quest_revealed?(quest_id) && quest(quest_id).objective_status?(:revealed, *obj)
  1375.   end
  1376.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1377.   # * Quest Rewarded?
  1378.   #    quest_id : ID of the quest you are checking is revealed
  1379.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1380.   def quest_rewarded?(quest_id)
  1381.     quest_revealed?(quest_id) && quest(quest_id).status?(:reward)
  1382.   end
  1383.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1384.   # * Change Reward Status
  1385.   #    quest_id : ID of the quest you are checking is revealed
  1386.   #    value    : true or false
  1387.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1388.   def change_reward_status(quest_id, value = true)
  1389.     quest(quest_id).reward_given = value
  1390.   end
  1391.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1392.   # * Distribute Rewards
  1393.   #    quest_id : ID of the quest whose rewards are to be distributed
  1394.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1395.   def distribute_quest_rewards(quest_id)
  1396.     if quest_revealed?(quest_id) && !quest_rewarded?(quest_id)
  1397.       params = @params.dup
  1398.       change_reward_status(quest_id, true)
  1399.       quest(quest_id).rewards.each { |reward| distribute_quest_reward(reward) }
  1400.       @params = params
  1401.       true
  1402.     else
  1403.       false
  1404.     end
  1405.   end
  1406.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1407.   # * Distribute Reward
  1408.   #    reward : an array identifying the reward
  1409.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1410.   def distribute_quest_reward(reward)
  1411.     @params = [reward[1], 0, 0, (reward[2] ? reward[2] : 1)]
  1412.     case reward[0]
  1413.     when :item, 0 then   command_126 # Item
  1414.     when :weapon, 1 then command_127 # Weapon
  1415.     when :armor, 2 then  command_128 # Armor
  1416.     when :gold, 3   # Gold
  1417.       @params = [0, 0, reward[1] ? reward[1] : 0]
  1418.       command_125
  1419.     when :exp, 4    # Exp
  1420.       @params = [0, 0, 0, 0, reward[1] ? reward[1] : 0, true]
  1421.       command_315
  1422.     end
  1423.   end
  1424.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1425.   # * Call Quest Journal
  1426.   #    quest_id : ID of the quest to open the journal to
  1427.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1428.   def call_quest_journal(quest_id = nil)
  1429.     return if $game_party.in_battle
  1430.     $game_system.last_quest_id = quest_id if quest_id
  1431.     SceneManager.call(Scene_Quest)
  1432.     Fiber.yield
  1433.   end
  1434. end

  1435. unless $imported[:"MA_ParagraphFormat_1.0"]
  1436. #==============================================================================
  1437. # ** MA_Window_ParagraphFormat
  1438. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1439. #  This module inserts into Window_Base and provides a method to format the
  1440. # strings so as to go to the next line if it exceeds a set limit. This is
  1441. # designed to work with draw_text_ex, and a string formatted by this method
  1442. # should go through that, not draw_text.
  1443. #==============================================================================

  1444. module MA_Window_ParagraphFormat
  1445.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1446.   # * Calc Line Width
  1447.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1448.   def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
  1449.     return tw if line.nil?
  1450.     line = line.clone
  1451.     unless contents_dummy
  1452.       real_contents = contents # Preserve Real Contents
  1453.       # Create a dummy contents
  1454.       self.contents = Bitmap.new(contents_width, 24)
  1455.       reset_font_settings
  1456.     end
  1457.     pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
  1458.     while line[/^(.*?)\e(.*)/]
  1459.       tw += text_size($1).width
  1460.       line = $2
  1461.       # Remove all ancillaries to the code, like parameters
  1462.       code = obtain_escape_code(line)
  1463.       # If direct setting of x, reset tw.
  1464.       tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
  1465.         ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
  1466.       #  If I need to do something special on the basis that it is testing,
  1467.       # alias process_escape_character and differentiate using @atsf_testing
  1468.       process_escape_character(code, line, pos)
  1469.     end
  1470.     #  Add width of remaining text, as well as the value of pos[:x] under the
  1471.     # assumption that any additions to it are because the special code is
  1472.     # replaced by something which requires space (like icons)
  1473.     tw += text_size(line).width + pos[:x]
  1474.     unless contents_dummy
  1475.       contents.dispose # Dispose dummy contents
  1476.       self.contents = real_contents # Restore real contents
  1477.     end
  1478.     return tw
  1479.   end
  1480.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1481.   # * Format Paragraph
  1482.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1483.   def mapf_format_paragraph(text, max_width = contents_width)
  1484.     text = text.clone
  1485.     #  Create a Dummy Contents - I wanted to boost compatibility by using the
  1486.     # default process method for escape codes. It may have the opposite effect,
  1487.     # for some :(
  1488.     real_contents = contents # Preserve Real Contents
  1489.     self.contents = Bitmap.new(contents_width, 24)
  1490.     reset_font_settings
  1491.     paragraph = ""
  1492.     while !text.empty?
  1493.       text.lstrip!
  1494.       oline, nline, tw = mapf_format_by_line(text.clone, max_width)
  1495.       # Replace old line with the new one
  1496.       text.sub!(/#{Regexp.escape(oline)}/m, nline)
  1497.       paragraph += text.slice!(/.*?(\n|$)/)
  1498.     end
  1499.     contents.dispose # Dispose dummy contents
  1500.     self.contents = real_contents # Restore real contents
  1501.     return paragraph
  1502.   end
  1503.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1504.   # * Format By Line
  1505.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1506.   def mapf_format_by_line(text, max_width = contents_width)
  1507.     oline, nline, tw = "", "", 0
  1508.     loop do
  1509.       #  Format each word until reach the width limit
  1510.       oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
  1511.       return oline, nline, tw if done
  1512.     end
  1513.   end
  1514.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1515.   # * Format By Word
  1516.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1517.   def mapf_format_by_word(text, line, tw, max_width)
  1518.     return line, line, tw, true if text.nil? || text.empty?
  1519.     # Extract next word
  1520.     if text.sub!(/([ \t\r\f]*)(\S*)([\n\f]?)/, "") != nil
  1521.       prespace, word, line_end = $1, $2, $3
  1522.       ntw = mapf_calc_line_width(word, tw, true)
  1523.       pw = contents.text_size(prespace).width
  1524.       if (pw + ntw >= max_width)
  1525.         # Insert
  1526.         if line.empty?
  1527.           # If one word takes entire line
  1528.           return prespace + word, word + "\n", ntw, true
  1529.         else
  1530.           return line + prespace + word, line + "\n" + word, tw, true
  1531.         end
  1532.       else
  1533.         line += prespace + word
  1534.         tw = pw + ntw
  1535.         # If the line is force ended, then end
  1536.         return line, line, tw, true if !line_end.empty?
  1537.       end
  1538.     else
  1539.       return line, line, tw, true
  1540.     end
  1541.     return line, line, tw, false
  1542.   end
  1543. end

  1544. class Window_Base
  1545.   include MA_Window_ParagraphFormat
  1546. end

  1547. $imported[:"MA_ParagraphFormat_1.0"] = true
  1548. end

  1549. #==============================================================================
  1550. # *** MAQJ Window_QuestBase
  1551. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1552. #  This module mixes in with all quest windows
  1553. #==============================================================================

  1554. module MAQJ_Window_QuestBase
  1555.   attr_reader :maqj_objective_color
  1556.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1557.   # * Object Initialization
  1558.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1559.   def initialize(*args, &block)
  1560.     super(*args, &block)
  1561.     reset_font_settings
  1562.     set_data_font(:normal)
  1563.     @maqj_default_font = contents.font.dup
  1564.     # Change the windowskin, tone if they are set to be changed
  1565.     self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin
  1566.     self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity
  1567.   end
  1568.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1569.   # * Reset Font Settings
  1570.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1571.   def reset_font_settings(*args, &block)
  1572.     super(*args, &block)
  1573.     set_data_font(@maqj_font_data_type) if @maqj_font_data_type
  1574.   end
  1575.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1576.   # * Set Data Font
  1577.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1578.   def set_data_font(data_type)
  1579.     @maqj_default_font = contents.font.dup unless @maqj_default_font
  1580.     contents.font.name = QuestData::FONTNAMES[data_type] ?
  1581.       QuestData::FONTNAMES[data_type] : @maqj_default_font.name
  1582.     contents.font.size = QuestData::FONTSIZES[data_type] ?
  1583.       QuestData::FONTSIZES[data_type] : @maqj_default_font.size
  1584.     contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ?
  1585.       QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold
  1586.     contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?
  1587.       QuestData::FONTITALICS[data_type] : @maqj_default_font.italic
  1588.     case data_type
  1589.     when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color
  1590.     when :name then change_color(quest_name_colour(@quest)) if @quest
  1591.     else
  1592.       change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)
  1593.     end
  1594.   end
  1595.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1596.   # * Draw Horizontal Line
  1597.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1598.   def draw_horizontal_line(y, h = 2)
  1599.     contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))
  1600.     contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))
  1601.   end
  1602.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1603.   # * MA Text Color
  1604.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1605.   def text_color(param)
  1606.     begin
  1607.       colour = case param
  1608.       when Integer then super(param) rescue normal_color
  1609.       when Symbol then send(param) rescue normal_color
  1610.       when Array then Color.new(*param) rescue normal_color
  1611.       else
  1612.         normal_color
  1613.       end
  1614.     end
  1615.     colour.is_a?(Color) ? colour : normal_color
  1616.   end
  1617.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1618.   # * Quest Name Colour
  1619.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1620.   def quest_name_colour(quest = @quest)
  1621.     return if !quest
  1622.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1623.     s = [:failed, :complete, :active].find { |status| quest.status?(status) }
  1624.     text_color(QuestData::COLOURS[s])
  1625.   end
  1626.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1627.   # * Quest Objective Colour
  1628.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1629.   def quest_objective_colour(quest, obj_id)
  1630.     return if !quest
  1631.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1632.     s = [:failed, :complete, :active].find { |status| quest.objective_status?(status, obj_id) }
  1633.     text_color(QuestData::COLOURS[s])
  1634.   end
  1635.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1636.   # * Update Tone
  1637.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1638.   def update_tone
  1639.     $game_system.quest_window_tone ?
  1640.       self.tone.set(*$game_system.quest_window_tone) : super
  1641.   end
  1642. end

  1643. unless $imported[:"MA_IconHorzCommand_1.0"]
  1644. #==============================================================================
  1645. # ** Window_MA_IconHorzCommand
  1646. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1647. #  This window is a base window to show a horizontal command window populated
  1648. # with icons.
  1649. #==============================================================================

  1650. class Window_MA_IconHorzCommand < Window_HorzCommand
  1651.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1652.   # * Public Instance Variable
  1653.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1654.   attr_reader   :observing_procs
  1655.   attr_accessor :cursor_hide
  1656.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1657.   # * Object Initialization
  1658.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1659.   def initialize(*args, &block)
  1660.     @observing_procs = {}
  1661.     super(*args, &block)
  1662.   end
  1663.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1664.   # * Column Max
  1665.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1666.   def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end
  1667.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1668.   # * Item
  1669.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1670.   def item
  1671.     @list[index] ? @list[index][:symbol] : nil
  1672.   end
  1673.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1674.   # * Enabled? / Current Item Enabled?
  1675.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1676.   def enable?(index); self.index == index; end
  1677.   def current_item_enabled?; !current_data.nil?; end
  1678.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1679.   # * Draw Item
  1680.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1681.   def draw_item(index)
  1682.     rect = item_rect(index)
  1683.     contents.clear_rect(rect)
  1684.     draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  1685.   end
  1686.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1687.   # * Set Index
  1688.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1689.   def index=(index)
  1690.     old_index = self.index
  1691.     super(index)
  1692.     draw_item(old_index)
  1693.     draw_item(self.index)
  1694.   end
  1695.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1696.   # * Frame Update
  1697.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1698.   def update
  1699.     super
  1700.     @observing_procs.values.each { |block| block.call(item) }
  1701.   end
  1702.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1703.   # * Add/Remove Observing Window
  1704.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1705.   def add_observing_proc(id, &block)
  1706.     @observing_procs[id] = block
  1707.     update
  1708.   end
  1709.   def remove_observing_proc(id)     ; @observing_procs.delete(id) ; end
  1710.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1711.   # * Update Cursor
  1712.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1713.   def update_cursor
  1714.     super
  1715.     cursor_rect.empty if @cursor_hide
  1716.   end
  1717. end
  1718. $imported[:"MA_IconHorzCommand_1.0"] = true
  1719. end

  1720. #==============================================================================
  1721. # ** Window_QuestCategory
  1722. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1723. #  This window allows the player to switch between quest categories.
  1724. #==============================================================================

  1725. class Window_QuestCategory < Window_MA_IconHorzCommand
  1726.   include MAQJ_Window_QuestBase
  1727.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1728.   # * Object Initialization
  1729.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1730.   def initialize(x, y, categories = $game_system.quest_categories)
  1731.     @cursor_hide = QuestData::HIDE_CATEGORY_CURSOR
  1732.     @categories = categories
  1733.     super(x, y)
  1734.   end
  1735.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1736.   # * Window Width
  1737.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1738.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1739.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1740.   # * Category=
  1741.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1742.   def category=(category)
  1743.     self.index = @categories.index(category) if @categories.include?(category)
  1744.   end
  1745.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1746.   # * Make Command List
  1747.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1748.   def make_command_list
  1749.     @categories.each { |cat|
  1750.       add_command("", cat, false, QuestData::ICONS[cat]) }
  1751.   end
  1752. end

  1753. #==============================================================================
  1754. # ** Window QuestLabel
  1755. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1756. #  This window simply shows a label for the Quests scene
  1757. #==============================================================================

  1758. class Window_QuestLabel < Window_Base
  1759.   include MAQJ_Window_QuestBase
  1760.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1761.   # * Object Initialization
  1762.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1763.   def initialize(x, y, label = "")
  1764.     super(x, y, window_width, window_height)
  1765.     refresh(label)
  1766.   end
  1767.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1768.   # * Reset Font Settings
  1769.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1770.   def reset_font_settings; set_data_font(:scene_label); end
  1771.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1772.   # * Window Attributes
  1773.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1774.   def window_width
  1775.     w = ($game_system.quest_categories.size > 1 || QuestData::SHOW_CATEGORY_LABEL) ?
  1776.       Graphics.width - QuestData::LIST_WINDOW_WIDTH : QuestData::LIST_WINDOW_WIDTH
  1777.   end
  1778.   def window_height; line_height + (standard_padding*2); end
  1779.   def line_height(*args)
  1780.     line_h = super(*args)
  1781.     QuestData::FONTSIZES[:scene_label] ?
  1782.       [QuestData::FONTSIZES[:scene_label], line_h].max : line_h
  1783.   end
  1784.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1785.   # * Refresh
  1786.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1787.   def refresh(label = @label)
  1788.     @label = label.is_a?(String) ? convert_escape_characters(label) : ""
  1789.     contents.clear
  1790.     reset_font_settings
  1791.     tw = mapf_calc_line_width(@label)
  1792.     draw_text_ex((contents_width - tw) / 2, 0, @label)
  1793.   end
  1794. end

  1795. #==============================================================================
  1796. # ** Window QuestLabel
  1797. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1798. #  This window simply shows a label for category currently selected
  1799. #==============================================================================

  1800. class Window_QuestCategoryLabel < Window_QuestLabel
  1801.   include MAQJ_Window_QuestBase
  1802.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1803.   # * Reset Font Settings
  1804.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1805.   def reset_font_settings; set_data_font(:category_label); end
  1806.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1807.   # * Window Attributes
  1808.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1809.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1810.   def line_height(*args)
  1811.     line_h = super(*args)
  1812.     QuestData::FONTSIZES[:category_label] ?
  1813.       [QuestData::FONTSIZES[:category_label], line_h].max : line_h
  1814.   end
  1815.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1816.   # * Set Category
  1817.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1818.   def category=(category)
  1819.     return if @category == category
  1820.     @category = category
  1821.     refresh(QuestData::CATEGORY_VOCAB[category])
  1822.   end
  1823. end

  1824. #==============================================================================
  1825. # ** Window_QuestCategoryDummy
  1826. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1827. #  This window shows up behind the category and category label window
  1828. #==============================================================================

  1829. class Window_QuestCategoryDummy < Window_Base
  1830.   include MAQJ_Window_QuestBase
  1831. end

  1832. #==============================================================================
  1833. # ** Window_QuestList
  1834. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1835. #  This window shows all quests in a selected category.
  1836. #==============================================================================

  1837. class Window_QuestList < Window_Selectable
  1838.   include MAQJ_Window_QuestBase
  1839.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1840.   # * Object Initialization
  1841.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1842.   def initialize(x, y, width, height)
  1843.     super
  1844.     @data = []
  1845.     self.index = 0
  1846.     activate
  1847.   end
  1848.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1849.   # * Set Category
  1850.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1851.   def category=(category)
  1852.     return if @category == category
  1853.     @category = category
  1854.     refresh
  1855.     self.index = 0
  1856.     update_help if @help_window
  1857.   end
  1858.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1859.   # * Get Quest
  1860.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1861.   def item; @data && index >= 0 ? @data[index] : nil; end
  1862.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1863.   # * Column/Item Max
  1864.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1865.   def col_max; 1; end
  1866.   def item_max; @data ? @data.size : 1; end
  1867.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1868.   # * Whether it should be drawn enabled
  1869.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1870.   def enable?(item); true; end
  1871.   def current_item_enabled?
  1872.     (@help_window && @help_window.maqj_visible_height < @help_window.contents_height)
  1873.   end
  1874.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1875.   # * Make Item List
  1876.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1877.   def make_item_list
  1878.     @data = @category ? $game_party.quests.list(@category) : []
  1879.   end
  1880.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1881.   # * Draw Item
  1882.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1883.   def draw_item(index)
  1884.     quest = @data[index]
  1885.     if quest
  1886.       rect = item_rect_for_text(index)
  1887.       if QuestData::SHOW_QUEST_ICONS
  1888.         draw_icon(quest.icon_index, rect.x, rect.y, enable?(quest))
  1889.         rect.x += 24
  1890.         rect.width -= 24
  1891.       end
  1892.       change_color(quest_name_colour(quest), enable?(quest))
  1893.       draw_text(rect, quest.name)
  1894.     end
  1895.   end
  1896.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1897.   # * Refresh
  1898.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1899.   def refresh
  1900.     make_item_list
  1901.     create_contents
  1902.     set_data_font(:list)
  1903.     draw_all_items
  1904.   end
  1905.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1906.   # * Update Help
  1907.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1908.   def update_help
  1909.     @help_window.quest = item
  1910.   end
  1911. end

  1912. #==============================================================================
  1913. # ** Window_QuestData
  1914. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1915. #  This window shows all quest data
  1916. #==============================================================================

  1917. class Window_QuestData < Window_Selectable
  1918.   include MAQJ_Window_QuestBase
  1919.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1920.   # * Object Initialization
  1921.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1922.   def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)
  1923.     @dest_scroll_oy = 0
  1924.     super(x, y, w, h)
  1925.     @dest_scroll_oy = self.oy
  1926.     self.layout = layout
  1927.   end
  1928.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1929.   # * Contents Height
  1930.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1931.   alias maqj_visible_height contents_height
  1932.   def contents_height
  1933.     @q_contents_height ? [@q_contents_height, maqj_visible_height].max : maqj_visible_height
  1934.   end
  1935.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1936.   # * Calculate Contents Height
  1937.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1938.   def calc_contents_height
  1939.     @q_contents_height = 0
  1940.     @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest
  1941.   end
  1942.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1943.   # * Draw Data?
  1944.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1945.   def draw_data?(data_type)
  1946.     case data_type
  1947.     when :line then true
  1948.     when :level then @quest.level > 0
  1949.     when :objectives then [email protected]_objectives.empty?
  1950.     when Array then (data_type - [:line]).any? { |dt| draw_data?(dt) }
  1951.     else [email protected](data_type).empty? # :description, :name, etc...
  1952.     end
  1953.   end
  1954.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1955.   # * Get Data Height
  1956.   #    This method calculates the height required for a specified element of
  1957.   #   the current quest. This is to calculate the needed space in contents,
  1958.   #   as well as advance the @draw_y variable.
  1959.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1960.   def data_height(data_type)
  1961.     return 0 unless draw_data?(data_type)
  1962.     return line_height if QuestData::BASIC_DATA_TYPES.include?(data_type)
  1963.     @maqj_font_data_type = data_type
  1964.     reset_font_settings
  1965.     return case data_type
  1966.     when :line, :level, :name then line_height
  1967.     when :banner
  1968.       bmp = Cache.picture(@quest.banner)
  1969.       hght = bmp.rect.height
  1970.       bmp.dispose
  1971.       hght
  1972.     when :description
  1973.       buff = description_x*2
  1974.       paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  1975.       line_num = paragraph.scan(/\n/).size + 1
  1976.       line_num += (QuestData::DESCRIPTION_IN_BOX ? 2 :
  1977.         !QuestData::VOCAB[:description].empty? ? 1 : 0)
  1978.       line_num*line_height
  1979.     when :objectives
  1980.       objectives = @quest.revealed_objectives.collect { |obj_id|
  1981.         @quest.objectives[obj_id] }
  1982.       line_num = QuestData::VOCAB[:objectives].empty? ? 0 : 1
  1983.       buff = (objective_x*2) + text_size(QuestData::VOCAB[:objective_bullet]).width
  1984.       objectives.each { |obj|
  1985.         paragraph = mapf_format_paragraph(obj, contents_width - buff)
  1986.         line_num += paragraph.scan(/\n/).size + 1 }
  1987.       line_num*line_height
  1988.     when :rewards
  1989.       line_num = QuestData::VOCAB[:rewards].empty? ? 0 : 1
  1990.       (line_num + @quest.rewards.size)*line_height
  1991.     when Array then data_height(data_type.max_by { |dt| data_height(dt) })
  1992.     else 0
  1993.     end
  1994.   end
  1995.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1996.   # * Set Quest
  1997.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1998.   def quest=(value)
  1999.     return if [url=home.php?mod=space&uid=70400]@quest[/url] == value
  2000.     @quest = value
  2001.     @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout
  2002.     refresh
  2003.   end
  2004.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2005.   # * Set Layout
  2006.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2007.   def layout=(value)
  2008.     return if @default_layout == value && @layout == value
  2009.     @default_layout = value
  2010.     @layout = value
  2011.     refresh
  2012.   end
  2013.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2014.   # * Refresh
  2015.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2016.   def refresh
  2017.     contents.clear
  2018.     calc_contents_height
  2019.     create_contents
  2020.     return unless @quest && @layout
  2021.     self.oy = 0
  2022.     @dest_scroll_oy = 0
  2023.     #  The basic idea here is that each draw_ method will rely on and advance
  2024.     # the @draw_y variable. Where they are an array, the elements will be
  2025.     # drawn at the same @draw_y.
  2026.     @draw_y = 0
  2027.     @layout.each {|dt|
  2028.       next unless draw_data?(dt)
  2029.       dt.is_a?(Array) ? draw_data_array(dt) : draw_data(dt)
  2030.     }
  2031.   end
  2032.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2033.   # * Draw Data
  2034.   #    data_type : the data block to draw next
  2035.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2036.   def draw_data(data_type)
  2037.     @maqj_font_data_type = data_type
  2038.     reset_font_settings
  2039.     send(:"draw_#{data_type}") if self.class.method_defined?(:"draw_#{data_type}")
  2040.     @draw_y += data_height(data_type)
  2041.   end
  2042.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2043.   # * Draw Data Array
  2044.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2045.   def draw_data_array(layout_array)
  2046.     y, max_y = @draw_y, @draw_y
  2047.     # Draw each data aspect at the same starting @draw_y
  2048.     layout_array.each { |dt|
  2049.       @draw_y = y
  2050.       draw_data(dt)
  2051.       max_y = @draw_y if @draw_y > max_y
  2052.     }
  2053.     @draw_y = max_y
  2054.   end
  2055.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2056.   # * Draw Line
  2057.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2058.   def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end
  2059.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2060.   # * Draw Name
  2061.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2062.   def draw_name
  2063.     set_data_font(:name)
  2064.     clear_and_draw_text(0, @draw_y, contents_width, line_height, @quest.name, 1)
  2065.   end
  2066.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2067.   # * Draw Level
  2068.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2069.   def draw_level
  2070.     case QuestData::LEVEL_ICON
  2071.     when Array then QuestData::LEVEL_ICON.empty? ? draw_level_text : draw_level_array
  2072.     when 0 then draw_level_text
  2073.     else
  2074.       draw_level_stacked
  2075.     end
  2076.   end
  2077.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2078.   # * Draw Stacked Level
  2079.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2080.   def draw_level_stacked(icon_index = QuestData::LEVEL_ICON)
  2081.     align = QuestData::HEADING_ALIGN[:level]
  2082.     es = QuestData::LEVEL_ICONS_SPACE*(@quest.level - 1)
  2083.     x = align == 2 ? contents_width - 24 : align == 1 ?
  2084.       (contents_width - 24 - (es)) / 2 : es
  2085.     @quest.level.times do
  2086.       draw_icon(icon_index, x, @draw_y)
  2087.       x -= QuestData::LEVEL_ICONS_SPACE
  2088.     end
  2089.   end
  2090.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2091.   # * Draw Array Level
  2092.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2093.   def draw_level_array(icon_index = QuestData::LEVEL_ICON)
  2094.     return if icon_index.empty?
  2095.     icon_index = icon_index[@quest.level - 1] ? icon_index[@quest.level - 1] : icon_index[-1]
  2096.     align = QuestData::HEADING_ALIGN[:level]
  2097.     x = align == 2 ? contents_width - 24 : align == 1 ? (contents_width-24)/2 : 0
  2098.     draw_icon(icon_index, x, @draw_y)
  2099.   end
  2100.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2101.   # * Draw Text Level
  2102.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2103.   def draw_level_text
  2104.     reset_font_settings
  2105.     level = QuestData::LEVEL_SIGNALS && QuestData::LEVEL_SIGNALS[@quest.level - 1] ?
  2106.       QuestData::LEVEL_SIGNALS[@quest.level - 1] : @quest.level.to_s
  2107.     align = QuestData::HEADING_ALIGN[:level]
  2108.     tw = text_size(QuestData::VOCAB[:level]).width + 4
  2109.     tw2 = text_size(level).width + 2
  2110.     space = contents_width - tw - tw2
  2111.     x = align == 2 ? space : align == 1 ? space / 2 : 0
  2112.     clear_and_draw_text(x, @draw_y, tw, line_height, QuestData::VOCAB[:level])
  2113.     set_data_font(:level_signal)
  2114.     clear_and_draw_text(x + tw, @draw_y, tw2, line_height, level, 2)
  2115.   end
  2116.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2117.   # * Draw Banner
  2118.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2119.   def draw_banner
  2120.     bmp = Cache.picture(@quest.banner) # Get Picture
  2121.     # Shift the hue if requested
  2122.     bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0
  2123.     x = (contents_width - bmp.rect.width) / 2
  2124.     if x < 0 # Stretch horizontally if the banner is too wide
  2125.       dest_rect = bmp.rect.dup
  2126.       dest_rect.width = contents_width
  2127.       contents.stretch_blt(dest_rect, bmp, bmp.rect)
  2128.     else
  2129.       contents.blt(x, @draw_y, bmp, bmp.rect)
  2130.     end
  2131.     bmp.dispose
  2132.   end
  2133.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2134.   # * Draw Description
  2135.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2136.   def draw_description
  2137.     buff = description_x*2
  2138.     paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  2139.     y = @draw_y
  2140.     # Draw Rect
  2141.     draw_box(paragraph.scan(/\n/).size + 1) if QuestData::DESCRIPTION_IN_BOX
  2142.     # Draw Description Label
  2143.     draw_heading(:description, y) unless QuestData::VOCAB[:description].empty?
  2144.     # Draw Description
  2145.     y += line_height if !QuestData::VOCAB[:description].empty? || QuestData::DESCRIPTION_IN_BOX
  2146.     draw_text_ex(description_x, y, paragraph)
  2147.   end
  2148.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2149.   # * Draw Objectives
  2150.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2151.   def draw_objectives
  2152.     y = @draw_y
  2153.     unless QuestData::VOCAB[:objectives].empty?
  2154.       draw_heading(:objectives, y)
  2155.       y += line_height
  2156.     end
  2157.     @quest.revealed_objectives.each { |obj_id| y = draw_objective(obj_id, y) }
  2158.   end
  2159.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2160.   # * Draw Objective
  2161.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2162.   def draw_objective(obj_id, y)
  2163.     bullet = QuestData::VOCAB[:objective_bullet]
  2164.     bullet_tw = text_size(bullet).width + 2
  2165.     buff = (objective_x*2) + bullet_tw
  2166.     paragraph = mapf_format_paragraph(@quest.objectives[obj_id], contents_width - buff)
  2167.     line_num = 1 + paragraph.scan(/\n/).size
  2168.     # Since draw_text_ex resets the font, set colour here
  2169.     @maqj_objective_color = quest_objective_colour(@quest, obj_id)
  2170.     change_color(text_color(QuestData::COLOURS[:objective_bullet]))
  2171.     draw_text(objective_x, y, bullet_tw, line_height, sprintf(bullet, obj_id + 1))
  2172.     draw_text_ex(objective_x + bullet_tw, y, paragraph)
  2173.     @maqj_objective_color = false
  2174.     y += (line_num*line_height)
  2175.   end
  2176.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2177.   # * Draw Rewards
  2178.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2179.   def draw_rewards
  2180.     y = @draw_y
  2181.     unless QuestData::VOCAB[:rewards].empty?
  2182.       draw_heading(:rewards, y)
  2183.       y += line_height
  2184.     end
  2185.     for i in [email protected] do draw_reward(i, y + i*line_height) end
  2186.   end
  2187.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2188.   # * Draw Reward
  2189.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2190.   def draw_reward(r_id, y)
  2191.     reward = @quest.rewards[r_id]
  2192.     case reward[0]
  2193.     when :item, 0   # Item
  2194.       draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
  2195.     when :weapon, 1 # Weapon
  2196.       draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
  2197.     when :armor, 2  # Armor
  2198.       draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
  2199.     when :gold, 3   # Gold
  2200.       draw_basic_data(y, QuestData::ICONS[:reward_gold],
  2201.         QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
  2202.     when :exp, 4    # Exp
  2203.       draw_basic_data(y, QuestData::ICONS[:reward_exp],
  2204.         QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
  2205.     when :string, 5 # String
  2206.       draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3].to_s : "",
  2207.         reward[2] ? reward[2].to_s : "")
  2208.     end
  2209.   end
  2210.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2211.   # * Draw Item Reward
  2212.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2213.   def draw_item_reward(y, item, amount = 1)
  2214.     w = contents_width
  2215.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2216.     x = (contents_width - w) / 2
  2217.     draw_item_name(item, x, y, true, w - 40)
  2218.     if amount > 1
  2219.       change_color(text_color(QuestData::COLOURS[:reward_amount]))
  2220.       draw_text(x + w - 40, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
  2221.     end
  2222.   end
  2223.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2224.   # * Draw Basic Data Methods
  2225.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2226.   QuestData::BASIC_DATA_TYPES.each { |data_type|
  2227.     define_method(:"draw_#{data_type}") {
  2228.       draw_basic_data(@draw_y, QuestData::ICONS[data_type],
  2229.         QuestData::VOCAB[data_type], @quest.send(data_type))
  2230.     }
  2231.   }
  2232.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2233.   # * Draw Basic Data
  2234.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2235.   def draw_basic_data(y, icon_index, vocab, value)
  2236.     w = contents_width
  2237.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2238.     x = (contents_width - w) / 2
  2239.     unless icon_index == 0
  2240.       draw_icon(icon_index, x, y)
  2241.       x += 24
  2242.       w -= 24
  2243.     end
  2244.     tw = text_size(vocab).width
  2245.     change_color(text_color(QuestData::COLOURS[:basic_label]))
  2246.     draw_text(x, y, tw, line_height, vocab)
  2247.     change_color(text_color(QuestData::COLOURS[:basic_value]))
  2248.     draw_text(x + tw, y, w - tw, line_height, value, 2)
  2249.   end
  2250.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2251.   # * Draw Heading
  2252.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2253.   def draw_heading(data_type, y)
  2254.     set_data_font(:heading)
  2255.     clear_and_draw_text(40, y, contents_width - 80, line_height,
  2256.       QuestData::VOCAB[data_type], QuestData::HEADING_ALIGN[data_type])
  2257.     reset_font_settings
  2258.   end
  2259.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2260.   # * Clear and Draw Text
  2261.   #    Clear the field before drawing the text
  2262.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2263.   def clear_and_draw_text(*args)
  2264.     rect = []
  2265.     while !args[0].is_a?(String) do rect.push(args.shift) end
  2266.     rect[0].is_a?(Rect) ? rect = rect[0] : rect = Rect.new(*rect)
  2267.     align = args[1] ? args[1] : 0
  2268.     ts = text_size(args[0])
  2269.     ts.width = [ts.width + 4, rect.width].min
  2270.     align == 1 ? ts.x = rect.x + ((rect.width - ts.width) / 2) :
  2271.       align == 2 ? ts.x = rect.x + rect.width - ts.width : ts.x = rect.x
  2272.     ts.y = rect.y
  2273.     contents.clear_rect(ts)
  2274.     ts.x += 2
  2275.     draw_text(ts, args[0], align)
  2276.   end
  2277.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2278.   # * Draw Description Box
  2279.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2280.   def draw_box(line_num)
  2281.     return if line_num < 1
  2282.     x = (line_height / 2) - 1
  2283.     y = @draw_y + (line_height / 2) - 1
  2284.     w = contents_width - 2*x
  2285.     h = (1 + line_num)*line_height
  2286.     draw_rect_outline_with_shadow(x, y, w, h)
  2287.   end
  2288.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2289.   # * Draw Rect Outline
  2290.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2291.   def draw_rect_outline(x, y, w, h, colour)
  2292.     # Horizontal Lines
  2293.     contents.fill_rect(x, y, w, 2, colour)
  2294.     contents.fill_rect(x, y + h - 2, w, 2, colour)
  2295.     # Vertical Lines
  2296.     contents.fill_rect(x, y, 2, h, colour)
  2297.     contents.fill_rect(x + w - 2, y, 2, h, colour)
  2298.   end
  2299.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2300.   # * Draw Rect Outline with Shadow
  2301.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2302.   def draw_rect_outline_with_shadow(x, y, w, h)
  2303.     draw_rect_outline(x + 1, y + 1, w, h, text_color(QuestData::COLOURS[:line_shadow]))
  2304.     draw_rect_outline(x, y, w, h, text_color(QuestData::COLOURS[:line]))
  2305.   end
  2306.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2307.   # * Objective/Description X
  2308.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2309.   def objective_x; line_height / 2; end
  2310.   def description_x; QuestData::DESCRIPTION_IN_BOX ? line_height : (line_height/2); end
  2311.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2312.   # * Update
  2313.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2314.   def update(*args, &block)
  2315.     super(*args, &block)
  2316.     if open? && active && @dest_scroll_oy == self.oy
  2317.       scroll_down if Input.press?(:DOWN)
  2318.       scroll_up if Input.press?(:UP)
  2319.     end
  2320.     if self.oy != @dest_scroll_oy
  2321.       mod = (@dest_scroll_oy <=> self.oy)
  2322.       self.oy += 3*mod
  2323.       self.oy = @dest_scroll_oy if (@dest_scroll_oy <=> self.oy) != mod
  2324.     end
  2325.   end
  2326.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2327.   # * Scroll Down
  2328.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2329.   def scroll_down(*args, &block)
  2330.     max_oy = contents_height - maqj_visible_height
  2331.     dest = ((@dest_scroll_oy / line_height) + 1)*line_height
  2332.     @dest_scroll_oy = [dest, max_oy].min
  2333.   end
  2334.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2335.   # * Scroll Up
  2336.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2337.   def scroll_up(*args, &block)
  2338.     dest = ((@dest_scroll_oy / line_height) - 1)*line_height
  2339.     @dest_scroll_oy = [dest, 0].max
  2340.   end
  2341. end

  2342. #==============================================================================
  2343. # ** Scene_Quest
  2344. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2345. #  This class handles processing for the Quest scene
  2346. #==============================================================================

  2347. class Scene_Quest < Scene_MenuBase
  2348.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2349.   # * Start Scene Processing
  2350.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2351.   def start
  2352.     super
  2353.     @init_category, @init_quest_index = $game_party.quests.find_location($game_system.last_quest_id, $game_system.last_quest_cat)
  2354.     create_maqj_picture unless $game_system.quest_bg_picture.empty?
  2355.     create_all_windows
  2356.     adjust_window_positions
  2357.   end
  2358.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2359.   # * Terminate Scene
  2360.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2361.   def terminate
  2362.     $game_system.quest_categories = QuestData::CATEGORIES
  2363.     $game_system.quest_scene_label = QuestData::VOCAB[:scene_label]
  2364.     $game_system.last_quest_id = @quest_list_window.item ? @quest_list_window.item.id : 0
  2365.     $game_system.last_quest_cat = @quest_category_window ?
  2366.       @quest_category_window.item : $game_system.quest_categories[0]
  2367.     super
  2368.     dispose_maqj_picture
  2369.   end
  2370.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2371.   # * Create Background Picture
  2372.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2373.   def create_maqj_picture
  2374.     @maqj_picture_sprite = Sprite.new
  2375.     @maqj_picture_sprite.bitmap = Cache.picture($game_system.quest_bg_picture)
  2376.     @maqj_picture_sprite.opacity = $game_system.quest_bg_opacity
  2377.     @maqj_picture_sprite.blend_type = $game_system.quest_bg_blend_type
  2378.     @maqj_picture_sprite.z = @background_sprite.z + 1 if @background_sprite
  2379.   end
  2380.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2381.   # * Create All Windows
  2382.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2383.   def create_all_windows
  2384.     create_quest_label_window unless $game_system.quest_scene_label.empty?
  2385.     create_quest_category_window if $game_system.quest_categories.size > 1
  2386.     create_quest_category_label_window if QuestData::SHOW_CATEGORY_LABEL
  2387.     create_dummy_category_window if QuestData::CATEGORY_LABEL_IN_SAME_WINDOW &&
  2388.       @quest_category_window && @quest_category_label_window
  2389.     create_quest_list_window
  2390.     create_quest_data_window
  2391.   end
  2392.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2393.   # * Create QuestLabel Window
  2394.   #    This window shows the name of the scene
  2395.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2396.   def create_quest_label_window
  2397.     @quest_label_window = Window_QuestLabel.new(0, 0, $game_system.quest_scene_label)
  2398.   end
  2399.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2400.   # * Create QuestCategory Window
  2401.   #    This window allows the player to switch categories.
  2402.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2403.   def create_quest_category_window
  2404.     @quest_category_window = Window_QuestCategory.new(0, 0, $game_system.quest_categories)
  2405.     @quest_category_window.category = @init_category if @init_category
  2406.     @quest_category_window.set_handler(:cancel, method(:on_category_cancel))
  2407.     @quest_category_window.set_handler(:ok, method(:on_category_ok))
  2408.   end
  2409.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2410.   # * Create QuestCategoryLabel Window
  2411.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2412.   def create_quest_category_label_window
  2413.     if @quest_category_window
  2414.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, @quest_category_window.height)
  2415.       @quest_category_window.add_observing_proc(:label) { |category|
  2416.         @quest_category_label_window.category = category }
  2417.     else
  2418.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, 0)
  2419.       @quest_category_label_window.category = $game_system.quest_categories ? $game_system.quest_categories[0] : :all
  2420.     end
  2421.   end
  2422.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2423.   # * Create Dummy Category Label Window
  2424.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2425.   def create_dummy_category_window
  2426.     @quest_category_label_window.y -= 12
  2427.     @quest_category_label_window.opacity = 0
  2428.     @quest_category_window.opacity = 0
  2429.     w = [@quest_category_window.width, @quest_category_label_window.width].max
  2430.     h = @quest_category_window.height + @quest_category_label_window.height - 12
  2431.     @category_dummy_window = Window_QuestCategoryDummy.new(0, 0, w, h)
  2432.     @category_dummy_window.z = [@quest_category_window.z, @quest_category_label_window.z].min - 1
  2433.     # Draw Horz Line
  2434.     @category_dummy_window.draw_horizontal_line(@quest_category_window.height - @quest_category_window.padding - 7, 2)
  2435.   end
  2436.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2437.   # * Create QuestList Window
  2438.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2439.   def create_quest_list_window
  2440.     if @category_dummy_window
  2441.       y = @category_dummy_window.height
  2442.     else
  2443.       y = @quest_category_window ? @quest_category_window.height : 0
  2444.       y += @quest_category_label_window ? @quest_category_label_window.height : 0
  2445.       y = @quest_label_window.height if y == 0
  2446.     end
  2447.     @quest_list_window = Window_QuestList.new(0, y, QuestData::LIST_WINDOW_WIDTH,
  2448.       Graphics.height - y)
  2449.     @quest_list_window.set_handler(:ok, method(:on_list_ok))
  2450.     @quest_list_window.deactivate if !QuestData::CONCURRENT_ACTIVITY
  2451.     if !QuestData::CONCURRENT_ACTIVITY || !@quest_category_window
  2452.       @quest_list_window.set_handler(:cancel, method(:on_list_cancel))
  2453.     end
  2454.     if @quest_category_window
  2455.       @quest_category_window.add_observing_proc(:list) { |category|
  2456.         @quest_list_window.category = category }
  2457.     else
  2458.       @quest_list_window.category = $game_system.quest_categories[0]
  2459.     end
  2460.     @quest_list_window.index = @init_quest_index if @init_quest_index
  2461.   end
  2462.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2463.   # * Create QuestData Window
  2464.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2465.   def create_quest_data_window
  2466.     x = @quest_list_window.width
  2467.     y = (@quest_label_window && (@quest_category_window ||
  2468.       @quest_category_label_window)) ? @quest_label_window.height : 0
  2469.     @quest_data_window = Window_QuestData.new(x, y, Graphics.width - x,
  2470.       Graphics.height - y)
  2471.     @quest_list_window.help_window = @quest_data_window
  2472.     @quest_data_window.quest = @quest_list_window.item
  2473.     @quest_data_window.set_handler(:ok, method(:on_data_ok))
  2474.     @quest_data_window.set_handler(:cancel, method(:on_data_cancel))
  2475.   end
  2476.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2477.   # * Dispose Background Picture
  2478.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2479.   def dispose_maqj_picture
  2480.     @maqj_picture_sprite.dispose if @maqj_picture_sprite
  2481.   end
  2482.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2483.   # * Adjust Window Positions
  2484.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2485.   def adjust_window_positions
  2486.     if @quest_label_window && (@quest_category_window || @quest_category_label_window)
  2487.       @quest_label_window.x = QuestData::LIST_WINDOW_WIDTH
  2488.     end
  2489.   end
  2490.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2491.   # * Category OK
  2492.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2493.   def on_category_ok; @quest_list_window.activate; end
  2494.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2495.   # * Category Cancel
  2496.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2497.   def on_category_cancel; return_scene; end
  2498.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2499.   # * List OK
  2500.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2501.   def on_list_ok
  2502.     @quest_category_window.deactivate if @quest_category_window
  2503.     @quest_data_window.activate
  2504.   end
  2505.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2506.   # * List Cancel
  2507.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2508.   def on_list_cancel
  2509.     @quest_category_window ? @quest_category_window.activate : return_scene
  2510.   end
  2511.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2512.   # * Data OK
  2513.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2514.   def on_data_ok; on_data_cancel; end
  2515.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2516.   # * Data Cancel
  2517.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2518.   def on_data_cancel
  2519.     @quest_list_window.activate
  2520.     @quest_category_window.activate if @quest_category_window && QuestData::CONCURRENT_ACTIVITY
  2521.   end
  2522.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2523.   # * Update All Windows
  2524.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2525.   def update_all_windows(*args, &block)
  2526.     # To accomodate for concurrent activity, must deactivate category
  2527.     @quest_category_window.deactivate if @quest_category_window &&
  2528.       QuestData::CONCURRENT_ACTIVITY && @quest_list_window.active &&
  2529.       Input.trigger?(:C)
  2530.     super(*args, &block)
  2531.     @quest_category_window.activate if @quest_category_window &&
  2532.       QuestData::CONCURRENT_ACTIVITY && @quest_list_window.active
  2533.   end
  2534. end

  2535. #==============================================================================
  2536. # ** Scene_Map
  2537. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2538. #  Summary of Changes:
  2539. #    aliased method - update_scene
  2540. #    new methods - update_call_quest_journal; call_quest_journal
  2541. #==============================================================================

  2542. class Scene_Map
  2543.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2544.   # * Update Scene
  2545.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2546.   alias maqj_updascne_9kh4 update_scene
  2547.   def update_scene(*args, &block)
  2548.     maqj_updascne_9kh4(*args, &block)
  2549.     update_call_quest_journal if $game_system.quest_map_access && !scene_changing?
  2550.   end
  2551.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2552.   # * Update Call Quest Journal
  2553.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2554.   def update_call_quest_journal
  2555.     if $game_map.interpreter.running?
  2556.       @quest_journal_calling = false
  2557.     else
  2558.       if Input.trigger?(QuestData::MAP_BUTTON)
  2559.         $game_system.quest_access_disabled || $game_party.quests.list.empty? ?
  2560.           Sound.play_buzzer : @quest_journal_calling = true
  2561.       end
  2562.       call_quest_journal if @quest_journal_calling && !$game_player.moving?
  2563.     end
  2564.   end
  2565.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2566.   # * Call Quest Journal
  2567.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2568.   def call_quest_journal
  2569.     @quest_journal_calling = false
  2570.     Sound.play_ok
  2571.     SceneManager.call(Scene_Quest)
  2572.   end
  2573. end

  2574. # Menu Access
  2575. if !$imported[:MA_InsertCommand]
  2576. # Initialize the Insertion Hash
  2577. MA_COMMAND_INSERTS = {}
  2578. MA_InsertableMenuCommand = Struct.new(:name, :index, :enable, :scene, :other)

  2579. #==============================================================================
  2580. # ** Game_System
  2581. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2582. #  Summary of Changes:
  2583. #    new public instance variable - maic_menu_commands
  2584. #    aliased method - initialize
  2585. #==============================================================================

  2586. class Game_System
  2587.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2588.   # * Inserted Menu Commands
  2589.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2590.   def maic_inserted_menu_commands
  2591.     # Lazy Instantiation so that old save files are not corrupted
  2592.     if !@maic_inserted_menu_commands
  2593.       @maic_inserted_menu_commands = MA_COMMAND_INSERTS.keys
  2594.       # Sort by index
  2595.       @maic_inserted_menu_commands.sort! { |a, b| MA_COMMAND_INSERTS[a].index <=> MA_COMMAND_INSERTS[b].index }
  2596.     end
  2597.     @maic_inserted_menu_commands
  2598.   end
  2599. end

  2600. #==============================================================================
  2601. # ** Window_MenuCommand
  2602. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2603. #  Summary of Changes:
  2604. #    aliased method - make_command_list; maic_insert_command
  2605. #==============================================================================

  2606. class Window_MenuCommand
  2607.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2608.   # * Make Command List
  2609.   #``````````````````````````````````````````````````````````````````````````
  2610.   #  I alias this method instead of add_original_commands because I need to
  2611.   # have all commands created before I can insert at the correct index
  2612.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2613.   alias maic_mkcmmndl_6yd2 make_command_list
  2614.   def make_command_list(*args, &block)
  2615.     maic_mkcmmndl_6yd2(*args, &block) # Run Original Method
  2616.     # Insert new commands
  2617.     $game_system.maic_inserted_menu_commands.each { |sym| maic_insert_command(sym) }
  2618.   end
  2619.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2620.   # * Insert Command
  2621.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2622.   def maic_insert_command(symbol)
  2623.     command = MA_COMMAND_INSERTS[symbol]
  2624.     # Get the command name
  2625.     name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
  2626.     # Check whether enabled
  2627.     enabled = case command.enable
  2628.     when Integer then command.enable == 0 ? true : $game_switches[command.enable]
  2629.     when String then eval(command.enable)
  2630.     when Symbol then self.send(command.enable)
  2631.     else
  2632.       enabled = true
  2633.     end
  2634.     # Add the command to the list
  2635.     add_command(name, symbol, enabled)
  2636.     added = @list.pop
  2637.     @list.insert([command.index, @list.size].min, added) # Insert at specific index
  2638.   end
  2639. end

  2640. #==============================================================================
  2641. # ** Scene_Menu
  2642. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2643. #  Summary of Changes:
  2644. #    aliased method - create_command_window; on_personal_ok
  2645. #    new methods - maic_set_insert_handler; maic_command_insert
  2646. #==============================================================================

  2647. class Scene_Menu
  2648.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2649.   # * Create Command Window
  2650.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2651.   alias maic_createcndwin_3ey7 create_command_window
  2652.   def create_command_window(*args, &block)
  2653.     maic_createcndwin_3ey7(*args, &block) # Run Original Method
  2654.     # Add handlers for all custom commands
  2655.     $game_system.maic_inserted_menu_commands.each { |symbol| maic_set_insert_handler(symbol) }
  2656.   end
  2657.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2658.   # * Set Inserted Handler
  2659.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2660.   def maic_set_insert_handler(symbol)
  2661.     other = MA_COMMAND_INSERTS[symbol].other
  2662.     handler = case other
  2663.     when Symbol then method(other)
  2664.     when String then lambda { eval(other) }
  2665.     when TrueClass then method(:command_personal)
  2666.     else
  2667.       handler = method(:maic_command_insert)
  2668.     end
  2669.     @command_window.set_handler(symbol, handler)
  2670.   end
  2671.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2672.   # * Custom Command
  2673.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2674.   def maic_command_insert
  2675.     SceneManager.call(Kernel.const_get(MA_COMMAND_INSERTS[@command_window.current_symbol].scene))
  2676.   end
  2677.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2678.   # * Personal OK
  2679.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2680.   alias maic_onpok_3ek9 on_personal_ok
  2681.   def on_personal_ok(*args, &block)
  2682.     if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
  2683.       maic_command_insert
  2684.     else
  2685.       maic_onpok_3ek9(*args, &block) # Run Original Method
  2686.     end
  2687.   end
  2688. end

  2689. $imported[:MA_InsertCommand] = true
  2690. end

  2691. MA_COMMAND_INSERTS[:quest_journal] =
  2692.   MA_InsertableMenuCommand.new(QuestData::VOCAB[:menu_label], QuestData::MENU_INDEX,
  2693.   "!$game_system.quest_access_disabled && !$game_party.quests.list.empty?",
  2694.   :Scene_Quest, false)
复制代码
{:4_137:}{:4_137:}{:4_137:}{:4_137:}{:4_137:}

点评

这脚本直接复制过来会出错的  发表于 2013-9-25 16:20
這麼長竟然沒有用可捲動的代碼框........ 還有外站的腳本乱转載哪天找上你就完了......  发表于 2013-9-25 07:49
http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复 支持 反对

使用道具 举报

Lv2.观梦者

会吐槽的画师

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
帖子
6535
7
发表于 2013-9-25 07:47:19 | 只看该作者
如果你是一个新人,这种力量你是驾驭不了的。

评分

参与人数 1星屑 -5 收起 理由
Sion -5 我很赞同

查看全部评分

长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22968
在线时间
8639 小时
注册时间
2011-12-31
帖子
3367
8
发表于 2013-9-25 08:37:32 | 只看该作者
本帖最后由 tseyik 于 2013-9-25 08:53 编辑

若要求低的不用脚本也可做到


点评

才发现,VA的帮助窗口原来是2行的……  发表于 2013-9-25 15:43
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5279
在线时间
1444 小时
注册时间
2012-9-24
帖子
1032

开拓者

9
发表于 2013-9-25 09:20:43 | 只看该作者
敢问楼主放出的图片是什么游戏,是完整版游戏吗?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
362
在线时间
40 小时
注册时间
2023-1-31
帖子
38
10
发表于 2023-4-19 10:51:40 | 只看该作者
tseyik 发表于 2013-9-25 08:37
若要求低的不用脚本也可做到

牛啊!喜欢这个简陋创意!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-21 23:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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