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

Project1

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

[已经过期] 请教各位大佬这个脚本怎么用

[复制链接]

Lv4.逐梦者

梦石
2
星屑
3024
在线时间
398 小时
注册时间
2016-8-16
帖子
123

开拓者

跳转到指定楼层
1
发表于 2017-10-25 22:34:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
最近在某个地方找了个脚本,想向各位请教一下这个脚本怎么用。现在除了改几个中文名称外就完全捉瞎了。在线等,急。
RUBY 代码复制
  1. #==============================================================================
  2. #    Quest Journal [VXA]
  3. #    Version: 1.0d
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: February 27, 2012
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script provides a graphical interface for showing quest progress. It
  10. #   is objective-based, meaning that you choose when to reveal objectives and
  11. #   you can set it so that they show up as complete or failed. That said, this
  12. #   script does not build quests for you; it is only a supplementary scene for
  13. #   showing them. As such, you need to event all of the quests yourself and
  14. #   update quest progress via script call. Therefore, pay close attention to
  15. #   the instructions here and in the Editable Regions at lines 232 and 612.
  16. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. #  Instructions:
  18. #
  19. #    Paste this script into its own slot or slots, above Main and below
  20. #   Materials. If you are using the menu access feature, you should put any
  21. #   other menu scripts above this one.
  22. #
  23. #    All of the configuration is done in the QuestData module. While it is not
  24. #   necessary, it is recommended that you separate the configuration module
  25. #   from the rest of the script by cutting and pasting it into its own slot in
  26. #   the Script Editor (as you will see if you have the demo). The reason for
  27. #   this is that, if and when this script gets updated, you can preserve the
  28. #   configuration section and only replace the other parts of the script. If
  29. #   you wish to do that, you must cut everything from the first line down to
  30. #   the final end of the module. The first lines of the body script should be
  31. #   the equals bar right above # ** Game_Quest. Again, it's up to you whether
  32. #   you do it.
  33. #
  34. #    You can go to EDITABLE REGION A at line 232 to configure the default
  35. #   settings for the script. All of these will work fine without modification,
  36. #   of course, but even if do not want to configure now, you should familiarize
  37. #   yourself with all the settings so that you can make the best use of your
  38. #   script. I have included tons of settings so that you can make the Quest
  39. #   Journal unique for your game, even down to the order in which each section
  40. #   of the info window is drawn. A brief description of each setting is
  41. #   included either to the right or directly above each constant.
  42. #
  43. #    EDITABLE REGION B is the real heart of the script however - this is where
  44. #   you fill in all of the details for the quests. Read the instructions at
  45. #   line 612 very carefully!
  46. #
  47. #    You can activate and access a quest with this code in the Script event
  48. #   command:
  49. #
  50. #        quest(quest_id)
  51. #          quest_id : the integer ID of the quest you want to access
  52. #
  53. #   From that, you can access or alter any relevant data stored in the quest,
  54. #   like name, description, objectives, etc... Example:
  55. #         quest(1).name = "Rest in Pieces"
  56. #
  57. #    More relevantly, when it comes to controlling the progress of quests the
  58. #   following codes can be used in a Script event command. The arguments are
  59. #   the same for each command so I only explain them once. All of them are
  60. #   pretty self-explanatory and using any of them will activate the quest
  61. #   (unless you are using the MANUAL REVEAL setting at line 267).
  62. #   
  63. #        reveal_objective(quest_id, objective_id_1, ..., objective_id_n)
  64. #            quest_id : the integer ID of the quest you want to access.
  65. #            objective_id_1, ..., objective_id_n : a list of the IDs of the
  66. #              objectives you want to operate on. It can be as few as one or as
  67. #              many as all of them.
  68. #          Will show the listed objectives in the Quest's information
  69. #
  70. #        conceal_objective(quest_id, objective_id_1, ..., objective_id_n)
  71. #          Will hide the listed objectives in the Quest's information
  72. #
  73. #        complete_objective(quest_id, objective_id_1, ..., objective_id_n)
  74. #          Changes the colour of the listed objectives to the completed colour.
  75. #          The quest is completed once all prime objectives are.
  76. #
  77. #        uncomplete_objective (quest_id, objective_id_1, ..., objective_id_n)
  78. #          Changes the status of the listed complete objectives back to active
  79. #
  80. #        fail_objective(quest_id, objective_id_1, ..., objective_id_n)
  81. #          Changes the colour of the listed objectives to the failed colour.
  82. #          The quest is failed once one prime objective is.
  83. #
  84. #        unfail_objective(quest_id, objective_id_1, ..., objective_id_n)
  85. #          Changes the status of the listed failed objectives back to active
  86. #
  87. #        change_reward_status(quest_id, value)
  88. #            value : either true or false. If excluded, defaults to true.
  89. #          Totally optional, but this is just a personal switch which you can
  90. #          turn on when the reward is given. You can then make it a condition
  91. #          so you don't reward the players more than once. (see line 180)
  92. #
  93. #  EXAMPLES:
  94. #    reveal_objective(1, 0)
  95. #      This would reveal the first objective of the quest with ID 1
  96. #    complete_objective(6, 2, 3)
  97. #      This would complete the third & fourth objectives of the quest with ID 6
  98. #    change_reward_status(8)
  99. #      This would set the reward switch to true for the quest with ID 8.
  100. #
  101. #   Another new feature is the ability to set rewards that will show up in the
  102. #  menu (see EDITABLE REGION B). In addition to that, you can use the following
  103. #  code to automatically distribute the specified rewards for a quest if the
  104. #  quest is complete and no reward has yet been given:
  105. #
  106. #        distribute_quest_rewards(quest_id)
  107. #          quest_id : the ID of the quest whose rewards you want to distribute
  108. #
  109. #   Of course, it can only distribute the material rewards (items, weapons,
  110. #   armors, gold, or exp). It won't distribute rewards you specify by string.
  111. #   To that end though, you can also use this code in a conditional branch and
  112. #   it will be satisfied only if it distributes the rewards. Thus, if you
  113. #   wanted to add some special rewards or do things like that, you can just put
  114. #   that in the branch for when it is true. This feature is not really
  115. #   recommended, since I think it is better to do it by events.
  116. #
  117. #    Other codes for the Script event command that can be useful are:
  118. #   
  119. #        reset_quest(quest_id)
  120. #            quest_id : the integer ID of the quest you want to access.
  121. #          This will re-initialize the quest, meaning all quest progress to
  122. #          date will be lost
  123. #
  124. #        remove_quest(quest_id)
  125. #          Deactivates the quest and resets it
  126. #
  127. #        conceal_quest(quest_id)
  128. #          Deactivates the quest so it won't show up in the scene, but progress
  129. #          is saved
  130. #
  131. #        reveal_quest(quest_id)
  132. #          Activates or reactivates the quest. This command is NECESSARY if
  133. #          MANUAL_REVEAL at line 284 is true or it has previously been
  134. #          concealed. Otherwise, it is sufficient just to operate on the quest
  135. #
  136. #        change_quest_access(:symbol)
  137. #          :symbol must be one of six options (include the colon!):
  138. #            :disable - prevents access to the quest scene (greys out in menu)
  139. #            :enable - enables access to the quest scene
  140. #            :disable_menu - this removes the quest option from the menu
  141. #            :enable_menu - this adds the quest option to the menu
  142. #            :disable_map - this prevents access by key from the map
  143. #            :enable_map - this allows access by key to the map
  144. #
  145. #        change_quest_background("bg_filename", bg_opacity, bg_blend_type)
  146. #            bg_filename   : the filename of the picture for the background in  
  147. #              the Pictures folder
  148. #            bg_opacity    : the opacity of the background graphic. If
  149. #              excluded, this defaults to the value of the setting at line 434.
  150. #            bg_blend_type : the blend type of the background graphic. If
  151. #              excluded, this defaults to the value of the setting at line 437.
  152. #
  153. #        change_quest_windows ("windowskin_filename", tone, opacity)
  154. #            windowskin_filename : the name of the Window graphic in the
  155. #              System folder of Graphics
  156. #            opacity             : the opacity of the windows. If excluded,
  157. #              this defaults to the value of the setting at line 423.
  158. #            blend_type          : the blend_type of the windows. If excluded,
  159. #              this defaults to the value of the setting at line 426.
  160. #
  161. #    Also, there are a few codes that can be used in the Script command of a
  162. #   conditional branch. I note here that all of these are optional. You could
  163. #   use switch and variable checks and monitor quest progress solely through
  164. #   events. However, these commands make it a little easier and they are:
  165. #
  166. #        quest_revealed?(quest_id)
  167. #            quest_id : the integer ID of the quest you want to access.
  168. #          This is satisfied if the quest has been activated.
  169. #
  170. #        quest_complete?(quest_id)
  171. #          This is satisfied if all prime objectives of the quest are complete
  172. #
  173. #        quest_failed?(quest_id)
  174. #          This is satisfied if any prime objective of the quest is failed
  175. #
  176. #        quest_rewarded?(quest_id)
  177. #          This is satisfied if you have changed the reward status to true.
  178. #
  179. #        objective_revealed?(quest_id, objective_id_1, ... objective_id_n)
  180. #            objective_id_1, ..., objective_id_n : a list of the IDs of the
  181. #              objectives you want to operate on. It can be as few as one or as
  182. #              many as all of them.
  183. #          This is satisfied if the listed objectives have been revealed
  184. #
  185. #        objective_active?(quest_id, objective_id_1, ... objective_id_n)
  186. #          This is satisfied if all the listed objectives are revealed and
  187. #          neither complete nor failed.
  188. #
  189. #        objective_complete?(quest_id, objective_id_1, ... objective_id_n)
  190. #          This is satisfied if all the listed objectives have been completed
  191. #
  192. #        objective_failed?(quest_id, objective_id_1, ... objective_id_n)
  193. #          This is satisfied if all the listed objectives have been failed
  194. #
  195. #    If you want to call the Quest scene from an event, you use the following
  196. #   code in a call script:
  197. #
  198. #        call_quest_journal
  199. #        call_quest_journal(quest_id)
  200. #          quest_id : ID of the quest you want to open the scene on
  201. #
  202. #  If you do not specify a quest_id (line 198) then it will simply open the
  203. #  scene as it would normally. If you do specify a quest_id (line 199) then it
  204. #  will open the scene on that quest so long as it has been revealed and it is
  205. #  normally accessible through the quest menu.
  206. #
  207. #   Finally, the default way this script operates is that quests automatically
  208. #  complete or fail based on the status of the prime objectives. However, you
  209. #  can set it so that there are no prime objectives, in which case you can only
  210. #  complete, fail, or (re)activate a quest manually through the following code
  211. #  in a script call:
  212. #
  213. #        manually_complete_quest(quest_id)
  214. #          quest_id : ID of the quest you want to manually complete
  215. #        manually_fail_quest(quest_id)
  216. #          quest_id : ID of the quest you want to manually fail
  217. #        manually_activate_quest(quest_id)
  218. #          quest_id : ID of the quest you want to manually activate
  219. #==============================================================================
  220.  
  221. $imported ||= {}
  222. $imported[:"MA_QuestJournal_1.0"] = true
  223.  
  224. #==============================================================================
  225. # *** QuestData
  226. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  227. #  This module contains all the configuration data for the quest journal
  228. #==============================================================================
  229.  
  230. module QuestData
  231.   #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  232.   #  BEGIN Editable Region A
  233.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  234.   #  MENU_ACCESS - If true, you can access the quest journal through a command
  235.   # in the menu. If false, there will be no such command.
  236.   MENU_ACCESS = true
  237.   #  MENU_INDEX - If MENU_ACCESS is true, this determines where it appears
  238.   MENU_INDEX = 4
  239.   #  MAP_ACCESS - If true, this allows you to access the quest journal by
  240.   # pressing a key on the map.
  241.   MAP_ACCESS = true
  242.   #  MAP_BUTTON - If MAP_ACCESS is true, this determines which button calls the
  243.   # Quest Journal
  244.   MAP_BUTTON = :L
  245.   #  OPEN_TO_LAST_REVEALED_QUEST - If true, then the first time you open the
  246.   # quest journal after revealing a new quest, it will open to the new quest.
  247.   OPEN_TO_LAST_REVEALED_QUEST = true
  248.   #  OPEN_TO_LAST_CHANGED_QUEST - If true, then the Quest Journal will open to
  249.   # the last quest whose objective status has changed.
  250.   OPEN_TO_LAST_CHANGED_QUEST = false
  251.   #  LIST_WINDOW_WIDTH - The width, in pixels, of the List Window
  252.   LIST_WINDOW_WIDTH = 192
  253.   #  BASIC_DATA_TYPES  - This lets you set up additional types of data. Just
  254.   # include an identifying signal in the Array. Then, you will need to give
  255.   # each signal an icon (in the ICONS hash at line 322) and a signal text (in
  256.   # the VOCAB array at line 333, though it can be an empty string). Then, you
  257.   # can set the data itself when setting up quests by simply adding a:
  258.   #    q[:symbol] = ""
  259.   # line to the quest. You will also need to include the data type somewhere in
  260.   # the DATA_LAYOUT at line 306. As an example of this, I have included :client
  261.   # and :location by default. You can CTRL+F for anything in this section with
  262.   # one of those symbols (excluding :) and you will there need to add something
  263.   # for any new data types you add.
  264.   BASIC_DATA_TYPES = [:client, :location]
  265.   #  BASIC_DATA_WIDTH - This determines how much room, in pixels, is given to  
  266.   # any basic data types you set up in the data window.
  267.   BASIC_DATA_WIDTH = 240
  268.   #  CONCURRENT_ACTIVITY - If true, then when in the Quest Journal scene, you
  269.   # can switch categories or scroll down the quest list at the same time. If
  270.   # false, you will first need to select a category before you can start
  271.   # scrolling through the quest list.
  272.   CONCURRENT_ACTIVITY = true
  273.   #  HIDE_CATEGORY_CURSOR - If true, then the Category Window will not have a
  274.   # cursor and will instead just highlight the currently selected category.
  275.   # This is best when CONCURRENT_ACTIVITY is true.
  276.   HIDE_CATEGORY_CURSOR = true
  277.   #  SHOW_QUEST_ICONS - If true, then the icon you choose for each quest will
  278.   # be displayed to the left of its name in the Quest List window
  279.   SHOW_QUEST_ICONS = false#true
  280.   #  MANUAL_REVEAL - If false, then quests will be revealed the moment you
  281.   # first reveal, complete, or fail an objective. If this is true, you will
  282.   # need to specifically reveal each quest via a separate script call:
  283.   #    reveal_quest(quest_id)
  284.   MANUAL_REVEAL = false
  285.   #  DATA_LAYOUT - This controls the way that the quest window lays out all of
  286.   # the relevant data. If you set one of the entries to be an array, then any
  287.   # of the commands there will be drawn at the same y. With exception to :line,
  288.   # none of the commands will be drawn if the quest is not set to have that
  289.   # particular data. The symbols are:
  290.   #    :line        - Draws a horizontal line across the window.
  291.   #    :name        - Draws the name of the quest
  292.   #    :level       - Draws the level of the quest
  293.   #    :banner      - Draws the banner for the quest
  294.   #    :client      - Draws the client set in the quest   (basic data)
  295.   #    :location    - Draws the location set in the quest (basic data)
  296.   #    :description - Draws the quest's description
  297.   #    :objectives  - Draws all the quest's objectives that have been revealed
  298.   #    :rewards     - Draws whatever rewards have been set
  299.   #
  300.   # You will also need to add an entry for any new BASIC_DATA that you place
  301.   # in BASIC_DATA_TYPES at line 264.
  302.   #
  303.   # Remember to place a comma after each entry. Also note that this is only the
  304.   # default layout. You can set a different layout for any quest, and when
  305.   # viewing that quest, it will be the custom layout that is shown.
  306.   DATA_LAYOUT = [
  307.     [:line, :name, :level],
  308.     :banner,
  309.     :client,
  310.     :location,
  311.     :description,
  312.     :objectives,
  313.     [:line, :rewards],
  314.     :line,
  315.   ] # <= Do not touch.
  316.   #  ICONS - This is where you setup many of the icons used in the script. The
  317.   # purpose of each is listed next to it. Also, if you make any custom
  318.   # categories, you NEED to give them an icon by placing a line like the
  319.   # others. So, if the new custom category is :romance then you would need to
  320.   # set it like this:
  321.   #    romance:     107,
  322.   ICONS = {
  323.     all:         226, # The icon for the All Quests category
  324.     active:      236, # The icon for the Active Quests category
  325.     complete:    238, # The icon for the Complete Quests category
  326.     failed:      227, # The icon for the Failed Quests category
  327.     client:      121, # The icon for client data. If none wanted, set to 0
  328.     location:    231, # The icon for location data. If none wanted, set to 0
  329.     reward_gold: 361, # The icon for gold rewards. If none wanted, set to 0
  330.     reward_exp:  117, # The icon for exp rewards. If none wanted, set to 0
  331.   } # <= Do not touch.
  332.   #  VOCAB - This lets you choose some of the words used in the quest scene
  333.   VOCAB = {
  334.     # menu_label:  The command name in the menu if MENU_ACCESS is true
  335.     menu_label:       "任务",
  336.     # scene_label: The label at the top of the scene. If empty, no window
  337.     scene_label:      " ",
  338.     # description: The heading to identify the description
  339.     description:      "任务描述",
  340.     # objectives: The heading to identify the objectives
  341.     objectives:       "记录",
  342.     # objective_bullet: The bullet which shows up to the left of every
  343.     #  objective. If %d is included, it shows the objective's ID.
  344.     objective_bullet: "·",
  345.     # rewards: The heading to identify the rewards.
  346.     rewards:          "任务奖励",
  347.     # reward_amount: For item rewards, this is the text to show the amount.
  348.     #  It should include %d to show the amount.
  349.     reward_amount:    "x%d",
  350.     # reward_gold: Text to identify gold rewards
  351.     reward_gold:      "Giro",
  352.     # reward_exp: Text to identify exp rewards
  353.     reward_exp:       "经验",
  354.     # level: If LEVEL_ICON is 0, this is the text which precedes the level
  355.     level:            "等级: ",
  356.     # location: The text label for quest location
  357.     location:         "",
  358.     # location: The text label for quest client
  359.     client:           "",
  360.   } # <= Do not touch.
  361.   #  CATEGORIES - This array allows you to set which categories are available
  362.   # in the Quest scene. The default categories are :all, :active, :complete,
  363.   # and :failed, and their names are self-explanatory. You can add custom
  364.   # categories as well, but note that you will need to make sure that each new
  365.   # category has an icon set in the ICONS hash, as well as a label set in the
  366.   # CATEGORY_VOCAB hash (if you are using SHOW_CATEGORY_LABEL). It is also
  367.   # advisable to give it a sort type, unless you are fine with it being sorted
  368.   # by ID, as is default.
  369.   CATEGORIES = [:all, :active, :complete, :failed]
  370.   #  SHOW_CATEGORY_LABEL - This allows you to choose whether to show the name
  371.   # of the currently selected category. If true, it will choose the name out
  372.   # of the CATEGORY_VOCAB hash.
  373.   SHOW_CATEGORY_LABEL = true
  374.   #  CATEGORY_LABEL_IN_SAME_WINDOW - If SHOW_CATEGORY_LABEL is true, then this
  375.   # options lets you choose whether the label is shown in the same window as
  376.   # the category icons or in a separate window below. true = same window.
  377.   CATEGORY_LABEL_IN_SAME_WINDOW = true
  378.   #  CATEGORY_VOCAB - If SHOW_CATEGORY_LABEL is true, this hash lets you set the
  379.   # label for each category. For any custom categories you create, you will
  380.   # need to add a line for each below and in the same format:
  381.   #    :category => "Label",
  382.   # Don't forget to add the comma at the end of each line.
  383.   CATEGORY_VOCAB = {
  384.     :all =>      "全部任务",      # The label for the :all category
  385.     :active =>   "进行中",   # The label for the :active category
  386.     :complete => "已完成", # The label for the :complete category
  387.     :failed =>   "已过期",   # The label for the :failed category
  388.   } # <= Do not touch.
  389.   #  SORT_TYPE - This hash allows you to choose how each category is sorted.
  390.   # For each category, default or custom, you can set a different sort method
  391.   # There are seven options to choose from:
  392.   #    :id - The quests are sorted from lowest to highest ID
  393.   #    :alphabet - The quests are sorted in alphabetical order
  394.   #    :level - The quests are sorted from the lowest to highest level
  395.   #    :reveal - The quests are sorted from most recently revealed on.
  396.   #            Every time a new quest is revealed, it will be at the top.
  397.   #    :change - The quests are sorted from the one whose status most recently
  398.   #            changed on. So, every time an objective is modified, that quest
  399.   #            will be thrown to the top.
  400.   #    :complete - The quests are sorted from the most recently completed on.
  401.   #            Every time a quest is completed, it will be thrown to the top.
  402.   #    :failed - The quests are sorted from the most recently failed on.
  403.   #            Every time a quest is failed, it will be thrown to the top.
  404.   #
  405.   # Additionally, you can put _r at the end of any of the sort options and it
  406.   # will reverse the order. So, for instance, if the sort method for a category
  407.   # is :alphabet_r, then the quests will show up from Z-A
  408.   SORT_TYPE = {
  409.     :all =>      :id,       # Sort type for the All Quests category
  410.     :active =>   :change,   # Sort type for the Active Quests category
  411.     :complete => :complete, # Sort type for the Complete Quests category
  412.     :failed =>   :failed,   # Sort type for the Failed Quests category
  413.   } # <= Do not touch.
  414.   #  WINDOWSKIN - The windowskin for each window in the Quest scene. It must
  415.   # refer to a graphic in the System folder of Graphics. If set to false, then
  416.   # it will use whatever windowskin is default. If you are using a script which
  417.   # lets the player choose the windowskin, false is the recommended value.
  418.   WINDOWSKIN = false
  419.   #  WINDOW_TONE - The tone for each window. It must be an array in the form:
  420.   #      WINDOW_TONE = [red, green, blue, gray]
  421.   # gray can be excluded, but the other three must be present. If you set this
  422.   # value to false, then the windows will have whatever tone is default.
  423.   WINDOW_TONE = false
  424.   #  WINDOW_OPACITY - The opacity of the windows in the Quest scene. If set to
  425.   # false, it will use the default opacity for windows.
  426.   WINDOW_OPACITY = false
  427.   #  BG_PICTURE - This is a string referring to a picture in the Picture folder
  428.   # of Graphics. If set to "", then there will be no picture. Otherwise, it
  429.   # will display the selected picture below the windows but above the map in
  430.   # the Quest scene.
  431.   BG_PICTURE = "task_back"
  432.   #  BG_OPACITY - This allows you to set the opacity of the background picture,
  433.   # if you have selected one.
  434.   BG_OPACITY = 255
  435.   #  BG_BLEND_TYPE - This allows you to set the blend type of the background
  436.   # picture, if you have selected one.
  437.   BG_BLEND_TYPE = 0
  438.   #  DESCRIPTION_IN_BOX - This is a graphical option, and it allows you to
  439.   # choose whether the description should be shown in a box.
  440.   DESCRIPTION_IN_BOX = true
  441.   #  LEVEL_ICON - This sets how levels are shown. If set to an integer, then it
  442.   # will draw the same icon numerous times up to the level of the quest. Ie. If
  443.   # the level's quest is 1, then the icon will only be drawn once, but if the
  444.   # level's quest is 4, it will be drawn 4 times. LEVEL_ICONS_SPACE determines
  445.   # the space between them. If you set LEVEL_ICON to 0, however, then it will
  446.   # instead draw a signal for the level, corresponding to that index in the
  447.   # LEVEL_SIGNALS array. If the LEVEL_SIGNALS array is empty, then it will just
  448.   # draw the integer for the level. Finally, LEVEL_ICON can also be an array of
  449.   # integers, in which case the level will be represented only by the icon set
  450.   # which corresponds to it in the array.
  451.   LEVEL_ICON = 125
  452.   #  LEVEL_ICONS_SPACE - If LEVEL_ICON is an integer, this is the amount of
  453.   # space between each time the icon is drawn.
  454.   LEVEL_ICONS_SPACE = 16
  455.   #  LEVEL_SIGNALS - If LEVEL_ICON is 0, this allows you to set what string
  456.   # should be the signal for each level. If this array is empty, then it will
  457.   # just draw the level integer. Ie. if the Quest is Level 4, it will draw 4.
  458.   LEVEL_SIGNALS = ["F", "E", "D", "C", "B", "A", "S"]
  459.   #  COLOURS - This lets you change the colour for various aspects of the
  460.   # quest scene. Each can be set in one of three ways:
  461.   #    :symbol - If you use a symbol, the colour will be the result of calling
  462.   #      the method of the same name. For instance, if you set something to
  463.   #      :system_color, it will set the colour to the result of the Window_Base
  464.   #      system_color method.
  465.   #    Integer - If you set the colour to an integer, then it will take its
  466.   #      colour from the windowskin palette, just like using \c[x] in messages.
  467.   #    Array - You can also set the rgba values directly with an array in the
  468.   #      format: [red, green, blue, alpha]. alpha can be excluded, but you must
  469.   #      have values for red, green, and blue.
  470.   COLOURS = {
  471.     # active: This sets the colour for active quests in the list and the name
  472.     #  of the active quest when shown in the data window.
  473.     active:           :normal_color,
  474.     # complete: This sets the colour for complete quests in the list and the
  475.     #  name of the complete quest when shown in the data window.
  476.     complete:         4,
  477.     # failed: This sets the colour for failed quests in the list and the name
  478.     #  of the failed quest when shown in the data window.
  479.     failed:           8,
  480.     # line:  This sets the colour for lines or boxes drawn in the quest scene
  481.     line:             :normal_color,
  482.     # line_shadow:  This sets the colour of the shadow for lines or boxes drawn
  483.     #  in the quest scene
  484.     line_shadow: [0, 0, 0, 128],
  485.     # scene_label: This sets the colour for the scene label, if shown
  486.     scene_label:      6,#:system_color,
  487.     # category_label: This sets the colour for the category label, if shown
  488.     category_label:   :normal_color,
  489.     # level_signal: This sets the colour for the level signal, if shown
  490.     level_signal:     :normal_color,
  491.     # objective_bullet: This sets the colour for objectives; if set to
  492.     #  :maqj_objective_color, it will reflect the completion status of the
  493.     #  objective, but you can change it to something else if you prefer
  494.     objective_bullet: :maqj_objective_color,
  495.     # reward_amount: The colour of the item amount, when shown
  496.     reward_amount:    :normal_color,
  497.     # heading: The colour of any headings in the script, like "Description"
  498.     heading:          6,#:system_color,
  499.     # basic_label: For basic data, like client, the colour of the label
  500.     basic_label:      6,#:system_color,
  501.     # basic_value: For basic data, like client, the colour of the value
  502.     basic_value:      :normal_color,
  503.   } # <= Do not touch.
  504.   #  HEADING_ALIGN - This sets the alignment for the aspects listed. 0 is Left;
  505.   # 1 is Centre; 2 is Right
  506.   HEADING_ALIGN = {
  507.     description: 0, # Alignment for the Description heading
  508.     objectives:  0, # Alignment for the Objectives heading
  509.     rewards:     1, # Alignment for the Rewards heading
  510.     level:       2  # Alignment when showing the level
  511.   } # <= Do not touch.
  512.   #````````````````````````````````````````````````````````````````````````````
  513.   #    Font Aspects
  514.   #
  515.   #  All of the following options (FONTNAMES, FONTSIZES, FONTBOLDS, and
  516.   # FONTITALICS) allow you to alter the fonts used for various aspects of the
  517.   # scene. The only one listed there by default is normal:, which is the
  518.   # font used by default for the entire scene. However, you can change the  
  519.   # fonts for almost any aspect - all you need to do is add a line like so:
  520.   #
  521.   #    description: value,
  522.   #
  523.   # and that will change that font aspect when drawing the description. The
  524.   # following symbols are available for changing:
  525.   #
  526.   #   normal:         The default font used for every part of the scene
  527.   #   list:           The font used in the List Window
  528.   #   scene_label:    The font used when drawing the Scene Label, if shown
  529.   #   category_label: The font used when drawing the Category Label, if shown
  530.   #   heading:        The font used when drawing any headings, like "Description"
  531.   #   name:           The font used when drawing the quest name in data window
  532.   #   description:    The font used when drawing the Description
  533.   #   objectives:     The font used when drawing the objectives
  534.   #   rewards:        The font used when drawing the rewards
  535.   #   client:         The font used when drawing the client
  536.   #   location:       The font used when drawing the location
  537.   #
  538.   # For any of them, you need to set a value. What the value can be depends
  539.   # on which font aspect you are changing and is described below, but for any
  540.   # of them setting it to the false will mean it will simply use the default
  541.   #
  542.   # For any that you add, remember that you must put a comma after the value.
  543.   #````````````````````````````````````````````````````````````````````````````
  544.   #  FONTNAMES - Here you can change the font used for any of the various
  545.   # options. It can take any of the following types of values:
  546.   #     false    - The default font will be used
  547.   #     "String" - The font with the name "String" will be used.
  548.   #     [Array]  - The array must be in the form: ["String1", "String2", ...]
  549.   #               The font used will be the first one in the array that the
  550.   #               player has installed.
  551.   #
  552.   #  EXAMPLES:
  553.   #
  554.   #    normal:      false,
  555.   #      The font used for unaltered aspects of the scene is the default font
  556.   #    scene_label: "Algerian",
  557.   #      The font used for the Scene Label will be Algerian.
  558.   #    description: ["Cambria", "Times New Roman"],
  559.   #      The font used when drawing the description will be Cambria if the
  560.   #      player has Cambria installed. If the player does not have Cambria
  561.   #      installed, then the font used will be Times New Roman
  562.   FONTNAMES = {
  563.     normal: false, # normal: the default font name
  564.   } # <= Do not touch.
  565.   #  FONTSIZES - Here you can change the size of the font. There are two types
  566.   # of values you can set:
  567.   #    false   - The default fontsize will be used
  568.   #    Integer - The fontsize will be equal to the value of the Integer.
  569.   #  
  570.   # For everything but the label windows, this shouldn't exceed 24, since that
  571.   # is the line_height. However, for scene_label: and category_label:, the size
  572.   # of the window will be adjusted to whatever size you set the font.
  573.   FONTSIZES = {
  574.     normal:         false, # normal: default font size
  575.     scene_label:    16,#28,    # scene_label: fontsize for the Scene Label window
  576.     category_label: 16,#24,    # category_label: fontsize for Category Label window
  577.   } # <= Do not touch.
  578.   #  FONTBOLDS - Here you can set whether the font will be bolded. You can set
  579.   # it to either false, in which case it will not be bolded, or true, in which
  580.   # case it will be bolded.
  581.   FONTBOLDS = {
  582.     scene_label:  true, # scene_label: whether font is bold for Scene Label
  583.     heading:      true, # heading: whether font is bold for the headings
  584.     level_signal: true, # level_signal: whether font is bold for level
  585.   } # <= Do not touch.
  586.   #  FONTITALICS - Here you can set whether the font will be italicized. You
  587.   # can set it to either false, in which case it will not be italicized, or
  588.   # true, in which case it will be italicized.
  589.   FONTITALICS = {
  590.   }
  591.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  592.   #  END Editable Region A
  593.   #//////////////////////////////////////////////////////////////////////////
  594.   CATEGORIES = [:all] if !CATEGORIES || CATEGORIES.empty?
  595.   VOCAB.default = ""
  596.   ICONS.default = 0
  597.   CATEGORY_VOCAB.default = ""
  598.   SORT_TYPE.default = :id
  599.   COLOURS.default = :normal_color
  600.   HEADING_ALIGN.default = 0
  601.   FONTNAMES.default = false
  602.   FONTSIZES.default = false
  603.   FONTBOLDS.default = false
  604.   FONTITALICS.default = false
  605.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  606.   # * Setup Quest
  607.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  608.   def self.setup_quest(quest_id)
  609.     q = { objectives: [] }
  610.       q[:name]              = MissionInfo::AllMission[quest_id + 1]["name"]
  611.       q[:level]             = MissionInfo::AllMission[quest_id + 1]["level"]
  612.       q[:icon_index]        = MissionInfo::AllMission[quest_id + 1]["icon_index"]
  613.       q[:description]       = MissionInfo::AllMission[quest_id + 1]["description"]
  614.       for i in 0..15
  615.         obj_name = "objectives" + i.to_s
  616.         q[:objectives][i]     = MissionInfo::AllMission[quest_id + 1][obj_name]
  617.       end
  618.       q[:prime_objectives]  = MissionInfo::AllMission[quest_id + 1]["prime_objectives"]
  619.       q[:custom_categories] = MissionInfo::AllMission[quest_id + 1]["custom_categories"]
  620.       q[:banner]            = MissionInfo::AllMission[quest_id + 1]["banner"]
  621.       q[:banner_hue]        = MissionInfo::AllMission[quest_id + 1]["banner_hue"]
  622.       q[:client]            = MissionInfo::AllMission[quest_id + 1]["client"]
  623.       q[:location]          = MissionInfo::AllMission[quest_id + 1]["location"]
  624.       q[:common_event_id]   = MissionInfo::AllMission[quest_id + 1]["common_event_id"]
  625.       q[:rewards]           = MissionInfo::AllMission[quest_id + 1]["rewards"]
  626.       q[:layout]            = MissionInfo::AllMission[quest_id + 1]["layout"]
  627.     q
  628.   end
  629. end
  630.  
  631. #==============================================================================
  632. # *** DataManager
  633. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  634. #  Summary of Changes:
  635. #    aliased method - self.extract_save_contents
  636. #==============================================================================
  637.  
  638. class << DataManager
  639.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  640.   # * Extract Save Contents
  641.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  642.   alias maqj_extractsavecons_2kw5 extract_save_contents
  643.   def extract_save_contents(*args, &block)
  644.     maqj_extractsavecons_2kw5(*args, &block) # Call Original Method
  645.     if $game_party.quests.nil?
  646.       $game_party.init_maqj_data
  647.       $game_system.init_maqj_data
  648.     end
  649.   end
  650. end
  651.  
  652. #==============================================================================
  653. # ** MAQJ_SortedArray
  654. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  655. #  This module mixes in to an array to maintain the sorted order when inserting
  656. #==============================================================================
  657.  
  658. module MAQJ_SortedArray
  659.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  660.   # * Insert to Array
  661.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  662.   def maqj_insert_sort(el, &block)
  663.     index = bsearch_index(el, 0, size, &block)
  664.     index ? insert(index, el) : push(el)
  665.   end
  666.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  667.   # * Retrieve Index from Binary Search
  668.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  669.   def bsearch_index(el, b = 0, e = size, &block)
  670.     return bsearch_index(el, b, e) { |a,b| a <=> b } if block.nil?
  671.     return b if b == e # Return the discovered insertion index
  672.     return if b > e
  673.     m = (b + e) / 2    # Get Middle
  674.     block.call(el, self[m]) > 0 ? b = m + 1 : e = m
  675.     bsearch_index(el, b, e, &block)
  676.   end
  677. end
  678.  
  679. #==============================================================================
  680. # ** Game_Quest
  681. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  682. #  This class holds all instance data for a quest
  683. #==============================================================================
  684.  
  685. class Game_Quest
  686.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  687.   # * Public Instance Variables
  688.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  689.   attr_reader   :id                  # Unique identifier for this quest
  690.   attr_reader   :name                # The name to be shown for the quest
  691.   attr_reader   :level               # The level of difficulty of the quest
  692.   attr_reader   :objectives          # An array of objective strings
  693.   attr_reader   :prime_objectives    # An array of crucial objective IDs
  694.   attr_reader   :revealed_objectives # An array of revealed objective IDs
  695.   attr_reader   :complete_objectives # An array of completed objective IDs
  696.   attr_reader   :failed_objectives   # An array of failed objective IDs
  697.   attr_reader   :custom_categories   # An array of category symbols
  698.   attr_accessor :icon_index          # Icon associated with this quest
  699.   attr_accessor :common_event_id     # ID of common event to call upon complete
  700.   attr_accessor :description         # The description for the quest
  701.   attr_accessor :banner              # Picture shown to represent the quest
  702.   attr_accessor :banner_hue          # The hue of the banner
  703.   attr_accessor :layout              # The layout of this quest in scene
  704.   attr_accessor :rewards             # An array of rewards to show
  705.   attr_accessor :reward_given        # Boolean tracking if quest was rewarded
  706.   attr_accessor :concealed           # Whether or not the quest is visible
  707.   attr_accessor :manual_status       # Quest status if not using prime objectives
  708.   QuestData::BASIC_DATA_TYPES.each { |data_type| attr_accessor(data_type) }
  709.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  710.   # * Object Initialization
  711.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  712.   def initialize(quest_id)
  713.     @id = quest_id
  714.     @concealed = default_value_for(:concealed)
  715.     @reward_given = default_value_for(:reward_given)
  716.     reset
  717.   end
  718.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  719.   # * Reset
  720.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  721.   def reset
  722.     data = QuestData.setup_quest(@id)
  723.     data_symbol_array.each { |meth| instance_variable_set(:"@#{meth}",
  724.       data[meth] ? data[meth] : default_value_for(meth)) }
  725.     @revealed_objectives = [].send(:extend, MAQJ_SortedArray)
  726.     @complete_objectives = [].send(:extend, MAQJ_SortedArray)
  727.     @failed_objectives =   [].send(:extend, MAQJ_SortedArray)
  728.     @manual_status = default_value_for(:manual_status)
  729.   end
  730.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  731.   # * Data Symbol Array
  732.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  733.   def data_symbol_array
  734.     [:name, :level, :objectives, :prime_objectives, :custom_categories,
  735.       :icon_index, :description, :banner, :banner_hue, :common_event_id,
  736.       :layout, :rewards] + QuestData::BASIC_DATA_TYPES
  737.   end
  738.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  739.   # * Default Value
  740.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  741.   def default_value_for(method)
  742.     case method
  743.     when :name then "??????"
  744.     when :description, :banner then ""
  745.     when :level, :banner_hue, :icon_index, :common_event_id then 0
  746.     when :objectives, :rewards, :custom_categories then []
  747.     when :prime_objectives then Array.new(objectives.size) { |x| x }
  748.     when :concealed then QuestData::MANUAL_REVEAL
  749.     when :manual_status then :active
  750.     when :layout, :reward_given then false
  751.     else ""
  752.     end
  753.   end
  754.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  755.   # * Reveal/Conceal Objective
  756.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  757.   def reveal_objective(*obj)
  758.     valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }
  759.     valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }
  760.     quest_status_changed unless valid_obj.empty?
  761.   end
  762.   def conceal_objective(*obj)
  763.     quest_status_changed unless (obj & @revealed_objectives).empty?
  764.     obj.each { |obj_id| @revealed_objectives.delete(obj_id) }
  765.   end
  766.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  767.   # * Complete/Uncomplete Objective
  768.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  769.   def complete_objective(*obj)
  770.     valid_obj = obj.select {|x| x < objectives.size && !@complete_objectives.include?(x) }
  771.     reveal_objective(*valid_obj)
  772.     unfail_objective(*valid_obj)
  773.     was_complete = status?(:complete)
  774.     valid_obj.each {|i| @complete_objectives.maqj_insert_sort(i) }
  775.     quest_status_changed unless valid_obj.empty?
  776.     # If just completed
  777.     if status?(:complete) && !was_complete
  778.       $game_temp.reserve_common_event(common_event_id)
  779.       $game_party.quests.add_to_sort_array(:complete, @id)
  780.     end
  781.   end
  782.   def uncomplete_objective(*obj)
  783.     quest_status_changed unless (obj & @complete_objectives).empty?
  784.     obj.each { |obj_id| @complete_objectives.delete(obj_id) }
  785.   end
  786.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  787.   # * Fail/Unfail Objective
  788.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  789.   def fail_objective(*obj)
  790.     valid_obj = obj.select {|x| x < objectives.size && !@failed_objectives.include?(x) }
  791.     reveal_objective(*valid_obj)
  792.     uncomplete_objective(*valid_obj)
  793.     was_failed = status?(:failed)
  794.     valid_obj.each {|i| @failed_objectives.maqj_insert_sort(i) }
  795.     quest_status_changed unless valid_obj.empty?
  796.     $game_party.quests.add_to_sort_array(:failed, @id) if status?(:failed) && !was_failed
  797.   end
  798.   def unfail_objective(*obj)
  799.     quest_status_changed unless (obj & @failed_objectives).empty?
  800.     obj.each { |obj_id| @failed_objectives.delete(obj_id) }
  801.   end
  802.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  803.   # * Updates when the quest status has been changed
  804.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  805.   def quest_status_changed
  806.     $game_party.quests.add_to_sort_array(:change, @id)
  807.     $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST
  808.   end
  809.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  810.   # * Objective Status?
  811.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  812.   def objective_status?(status_check, *obj)
  813.     return false if obj.empty?
  814.     case status_check
  815.     when :failed   then !(obj & @failed_objectives).empty?
  816.     when :complete then obj.size == (obj & @complete_objectives).size
  817.     when :revealed then obj.size == (obj & @revealed_objectives).size
  818.     when :active then objective_status?(:revealed, *obj) &&
  819.       !objective_status?(:complete, *obj) && !objective_status?(:failed, *obj)
  820.     end
  821.   end
  822.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  823.   # * Status?
  824.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  825.   def status?(status_check)
  826.     case status_check
  827.     when :failed  
  828.       @prime_objectives.empty? ? @manual_status == :failed :
  829.         !(@failed_objectives & @prime_objectives).empty?
  830.     when :complete
  831.       @prime_objectives.empty? ? @manual_status == :complete : !status?(:failed) &&
  832.         ((@prime_objectives & @complete_objectives) == @prime_objectives)
  833.     when :active then !concealed && !status?(:complete) && !status?(:failed)
  834.     when :reward then @reward_given
  835.     end
  836.   end
  837.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  838.   # * Set Name
  839.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  840.   def name=(new_name)
  841.     @name = new_name
  842.     $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party &&
  843.       $game_party.quests
  844.   end
  845.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  846.   # * Set Level
  847.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  848.   def level=(new_lvl)
  849.     @level = new_lvl
  850.     $game_party.quests.add_to_sort_array(:level, @id) if $game_party &&
  851.       $game_party.quests
  852.   end
  853. end
  854.  
  855. #==============================================================================
  856. # ** Game_Quests
  857. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  858. #  This is a wrapper for an array holding Game_Quest objects
  859. #==============================================================================
  860.  
  861. class Game_Quests
  862.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  863.   # * Object Initialization
  864.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  865.   def initialize
  866.     @data = {}
  867.     @sort_arrays = {
  868.       reveal: [], change: [], complete: [], failed: [],
  869.       id:       [].send(:extend, MAQJ_SortedArray),
  870.       alphabet: [].send(:extend, MAQJ_SortedArray),
  871.       level:    [].send(:extend, MAQJ_SortedArray)
  872.     }
  873.   end
  874.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  875.   # * Get Quest
  876.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  877.   def [](quest_id)
  878.     reset_quest(quest_id) if !@data[quest_id]
  879.     @data[quest_id]
  880.   end
  881.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  882.   # * Set Quest <- Not sure when this would ever be useful.
  883.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  884.   def []=(quest_id, value)
  885.     @data[quest_id] = value
  886.   end
  887.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  888.   # * List
  889.   #    list_type : the type of list to return
  890.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  891.   def list(list_type = :all, sort_type = $game_system.quest_sort_type[list_type])
  892.     sort_type_s = sort_type.to_s
  893.     reverse = !(sort_type_s.sub!(/_r$/, "")).nil?
  894.     sort_type = sort_type_s.to_sym
  895.     list = @sort_arrays[sort_type].select { |quest_id| include?(quest_id, list_type) }
  896.     list.reverse! if reverse
  897.     list.collect { |quest_id| @data[quest_id] }
  898.   end
  899.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  900.   # * Include?
  901.   #    determines whether to include a particular quest depending on list type
  902.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  903.   def include?(quest_id, list_type = :all)
  904.     return false if !revealed?(quest_id)
  905.     case list_type
  906.     when :all then true
  907.     when :complete, :failed, :active then @data[quest_id].status?(list_type)
  908.     else
  909.       @data[quest_id].custom_categories.include?(list_type)
  910.     end
  911.   end
  912.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  913.   # * Revealed?
  914.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  915.   def revealed?(quest_id)
  916.     (!@data[quest_id].nil? && !@data[quest_id].concealed)
  917.   end
  918.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919.   # * Setup Quest
  920.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  921.   def setup_quest(quest_id)
  922.     return if @data[quest_id]
  923.     @data[quest_id] = Game_Quest.new(quest_id)
  924.     # Open to this quest next time the QJ is opened
  925.     $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST
  926.     # Save sorting order in separate arrays to avoid re-sorting every time
  927.     @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }
  928.   end
  929.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  930.   # * Delete Quest
  931.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932.   def delete_quest(quest_id)
  933.     @data.delete(quest_id)
  934.     @sort_arrays.values.each { |ary| ary.delete(quest_id) }
  935.   end
  936.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  937.   # * Reset Quest
  938.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  939.   def reset_quest(quest_id)
  940.     delete_quest(quest_id)
  941.     setup_quest(quest_id)
  942.   end
  943.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  944.   # * Add to Sorted Array
  945.   #    sort_type : array to alter
  946.   #    quest_id  : ID of the quest to add.
  947.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  948.   def add_to_sort_array(sort_type, quest_id)
  949.     @sort_arrays[sort_type].delete(quest_id) # Make sure always unique
  950.     case sort_type
  951.     when :reveal, :change, :complete, :failed
  952.       @sort_arrays[sort_type].unshift(quest_id)
  953.     when :id
  954.       @sort_arrays[sort_type].maqj_insert_sort(quest_id)
  955.     when :alphabet
  956.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].name.downcase <=> @data[b].name.downcase }
  957.     when :level
  958.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].level <=> self[b].level }
  959.     end
  960.   end
  961.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  962.   # * Find Location
  963.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  964.   def find_location(quest_id, cat = nil)
  965.     if revealed?(quest_id)
  966.       categories = $game_system.quest_categories.dup
  967.       # If cat specified, check in that category first.
  968.       if cat && categories.include?(cat)
  969.         categories.delete(cat)
  970.         categories.unshift(cat)
  971.       end
  972.       for category in categories # Check all categories
  973.         index = list(category).index(@data[quest_id])
  974.         return category, index if index != nil
  975.       end
  976.     end
  977.     return nil, nil
  978.   end
  979.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  980.   # * Clear
  981.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  982.   def clear
  983.     @data.clear
  984.   end
  985. end
  986.  
  987. #==============================================================================
  988. # ** Game System
  989. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  990. #  Summary of Changes:
  991. #    new attr_accessor - quest_menu_access; quest_map_access; quest_sort_type;
  992. #      quest_bg_picture; quest_bg_opacity; quest_windowskin;
  993. #      quest_window_opacity; quest_access_disabled; last_quest_cat;
  994. #      last_quest_id
  995. #    aliased methods - initialize
  996. #    new methods - init_maqj_data
  997. #==============================================================================
  998.  
  999. class Game_System
  1000.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1001.   # * Public Instance Variables
  1002.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1003.   attr_reader   :quest_menu_access     # Whether the scene is called from menu
  1004.   attr_accessor :quest_map_access      # Whether the scene is called from map
  1005.   attr_accessor :quest_sort_type       # The sort types for each category
  1006.   attr_accessor :quest_bg_picture      # The filename of the background picture
  1007.   attr_accessor :quest_bg_opacity      # The opacity of the background picture
  1008.   attr_accessor :quest_bg_blend_type   # The blend type of the background pic
  1009.   attr_accessor :quest_windowskin      # The windowskin used for the scene
  1010.   attr_accessor :quest_window_tone     # The tone of windows in the scene
  1011.   attr_accessor :quest_window_opacity  # The opacity of windows in the scene
  1012.   attr_accessor :quest_access_disabled # Whether access to Quests is disabled
  1013.   attr_accessor :quest_categories      # The categories to show in the scene
  1014.   attr_accessor :quest_scene_label     # The label to show in the scene
  1015.   attr_accessor :last_quest_cat        # The category to open to
  1016.   attr_accessor :last_quest_id         # The ID to open to
  1017.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1018.   # * Object Initialization
  1019.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1020.   alias maqj_initialze_2cy9 initialize
  1021.   def initialize(*args, &block)
  1022.     maqj_initialze_2cy9(*args, &block)
  1023.     init_maqj_data
  1024.   end
  1025.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1026.   # * Initialize Quest Data
  1027.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1028.   def init_maqj_data
  1029.     # Initialize new variables
  1030.     self.quest_menu_access = QuestData::MENU_ACCESS
  1031.     @quest_map_access = QuestData::MAP_ACCESS
  1032.     @quest_sort_type = QuestData::SORT_TYPE
  1033.     @quest_bg_picture = QuestData::BG_PICTURE
  1034.     @quest_bg_opacity = QuestData::BG_OPACITY
  1035.     @quest_bg_blend_type = QuestData::BG_BLEND_TYPE
  1036.     @quest_windowskin = QuestData::WINDOWSKIN
  1037.     @quest_window_tone = QuestData::WINDOW_TONE
  1038.     @quest_window_opacity = QuestData::WINDOW_OPACITY
  1039.     @quest_access_disabled = false
  1040.     @quest_categories = QuestData::CATEGORIES
  1041.     @quest_scene_label = QuestData::VOCAB[:scene_label]
  1042.     @last_quest_cat = @quest_categories[0]
  1043.     @last_quest_id = 0
  1044.   end
  1045.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1046.   # * Set Quest Menu Access
  1047.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1048.   def quest_menu_access=(boolean)
  1049.     @quest_menu_access = boolean
  1050.     maic_inserted_menu_commands.delete(:quest_journal)
  1051.     maic_inserted_menu_commands.push(:quest_journal) if @quest_menu_access
  1052.     maic_inserted_menu_commands.sort!
  1053.   end
  1054. end
  1055.  
  1056. #==============================================================================
  1057. # ** Game_Party
  1058. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1059. #  Summary of Changes:
  1060. #    new attr_reader - quests
  1061. #    aliased method - initialize
  1062. #    new method - init_maqj_data
  1063. #==============================================================================
  1064.  
  1065. class Game_Party
  1066.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1067.   # * Public Instance Variables
  1068.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1069.   attr_reader :quests
  1070.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1071.   # * Object Initialization
  1072.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1073.   alias maqj_intiaze_2si9 initialize
  1074.   def initialize(*args, &block)
  1075.     maqj_intiaze_2si9(*args, &block) # Call Original Method
  1076.     init_maqj_data
  1077.   end
  1078.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1079.   # * Initialize Quests
  1080.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1081.   def init_maqj_data
  1082.     @quests = Game_Quests.new # Initialize @quests
  1083.   end
  1084. end
  1085.  
  1086. #==============================================================================
  1087. # ** Game_Interpreter
  1088. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1089. #  Summary of Changes:
  1090. #    new methods - change_quest_access; change_quest_background;
  1091. #      change_quest_windows; setup_quest; delete_quest; reset_quest; quest;
  1092. #      reveal_quest; conceal_quest; manually_complete_quest;
  1093. #      manually_fail_quest; reveal_objective; conceal_objective;
  1094. #      complete_objective; uncomplete_objective; fail_objective;
  1095. #      unfail_objective; quest_revealed?; quest_complete?; quest_active?;
  1096. #      quest_failed?; objective_complete?; objective_active?;
  1097. #      objective_failed?; distribute_quest_rewards; distribute_quest_reward;
  1098. #      call_quest_journal
  1099. #==============================================================================
  1100.  
  1101. class Game_Interpreter
  1102.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1103.   # * Change Quest Access
  1104.   #    sym : symbol representing what aspect of access is being changed
  1105.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1106.   def change_quest_access(sym)
  1107.     case sym
  1108.     when :enable then $game_system.quest_access_disabled = false
  1109.     when :disable then $game_system.quest_access_disabled = true
  1110.     when :enable_menu then $game_system.quest_menu_access = true
  1111.     when :disable_menu then $game_system.quest_menu_access = false
  1112.     when :enable_map then $game_system.quest_map_access = true
  1113.     when :disable_map then $game_system.quest_map_access = false
  1114.     end
  1115.   end
  1116.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1117.   # * Change Quest Background
  1118.   #    picture : picture to show in the scene's background
  1119.   #    opacity : opacity of the picture shown in the scene's background
  1120.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1121.   def change_quest_background(picture, opacity = $game_system.quest_bg_opacity,
  1122.       blend_type = $game_system.quest_bg_blend_type)
  1123.     $game_system.quest_bg_picture = picture
  1124.     $game_system.quest_bg_opacity = opacity
  1125.     $game_system.quest_bg_blend_type = blend_type
  1126.   end
  1127.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1128.   # * Change Quest Windows
  1129.   #    skin    : windowskin name to use in the scene
  1130.   #    tone    : tone for the windowskin
  1131.   #    opacity : opacity of windows in the scene
  1132.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1133.   def change_quest_windows(skin, tone = $game_system.quest_window_tone,
  1134.       opacity = $game_system.quest_window_opacity)
  1135.     $game_system.quest_windowskin = skin
  1136.     $game_system.quest_window_tone = tone
  1137.     $game_system.quest_window_opacity = opacity
  1138.   end
  1139.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1140.   # * Setup/Delete/Reset Quest
  1141.   #    quest_id : ID of the quest to be setup or deleted or reset
  1142.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1143.   [:setup_quest, :delete_quest, :reset_quest].each { |method|
  1144.     define_method(:"quest_#{method}") do |quest_id|
  1145.       $game_party.quests.send(method, quest_id)
  1146.     end
  1147.   }
  1148.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1149.   # * Retrieve Quest
  1150.   #    quest_id : ID of the quest to retrieve
  1151.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1152.   def quest(quest_id);         $game_party.quests[quest_id];      end
  1153.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1154.   # * Reveal/Conceal Quest
  1155.   #    quest_id : ID of the quest to be revealed or concealed
  1156.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1157.   def reveal_quest(quest_id);  quest(quest_id).concealed = false; end
  1158.   def conceal_quest(quest_id); quest(quest_id).concealed = true;  end
  1159.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1160.   # * Manually Complete/Fail Quest
  1161.   #    quest_id : ID of the quest to be revealed or concealed
  1162.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1163.   def manually_complete_quest(quest_id)
  1164.     quest(quest_id).prime_objectives.clear
  1165.     quest(quest_id).manual_status = :complete
  1166.   end
  1167.   def manually_fail_quest(quest_id)
  1168.     quest(quest_id).prime_objectives.clear
  1169.     quest(quest_id).manual_status = :failed
  1170.   end
  1171.   def manually_activate_quest(quest_id)
  1172.     quest(quest_id).manual_status = :active
  1173.   end
  1174.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1175.   # * Reveal/Complete/Fail/Conceal/Uncomplete/Unfail Objective
  1176.   #    quest_id : ID of the quest whose objectives will be modified
  1177.   #    *obj     : IDs of objectives to reveal or complete or fail (or opposite)
  1178.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1179.   [:reveal_objective, :complete_objective, :fail_objective, :conceal_objective,
  1180.   :uncomplete_objective, :unfail_objective].each { |method|
  1181.     define_method(method) do |quest_id, *obj|
  1182.       quest(quest_id).send(method, *obj)
  1183.     end
  1184.   }
  1185.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1186.   # * Quest Revealed?
  1187.   #    quest_id : ID of the quest you are checking is revealed
  1188.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1189.   def quest_revealed?(quest_id)
  1190.     $game_party.quests.revealed?(quest_id)
  1191.   end
  1192.   [:complete, :failed, :active].each { |method|
  1193.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1194.     # * Quest Complete/Failed/Active?
  1195.     #    quest_id : ID of the quest whose completion status is being checked
  1196.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1197.     define_method(:"quest_#{method}?") do |quest_id|
  1198.       quest_revealed?(quest_id) && quest(quest_id).status?(method)
  1199.     end
  1200.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1201.     # * Objective Complete/Failed/Active?
  1202.     #    quest_id : ID of the quest whose objectives are being checked
  1203.     #    *obj     : IDs of objectives to check completion status
  1204.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1205.     define_method(:"objective_#{method}?") do |quest_id, *obj|
  1206.       quest_revealed?(quest_id) && quest(quest_id).objective_status?(method, *obj)
  1207.     end
  1208.   }
  1209.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1210.   # * Objective Revealed?
  1211.   #    quest_id : ID of the quest you are checking is revealed
  1212.   #    *obj     : IDs of objectives to check completion status
  1213.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1214.   def objective_revealed?(quest_id, *obj)
  1215.     quest_revealed?(quest_id) && quest(quest_id).objective_status?(:revealed, *obj)
  1216.   end
  1217.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1218.   # * Quest Rewarded?
  1219.   #    quest_id : ID of the quest you are checking is revealed
  1220.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1221.   def quest_rewarded?(quest_id)
  1222.     quest_revealed?(quest_id) && quest(quest_id).status?(:reward)
  1223.   end
  1224.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1225.   # * Change Reward Status
  1226.   #    quest_id : ID of the quest you are checking is revealed
  1227.   #    value    : true or false
  1228.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1229.   def change_reward_status(quest_id, value = true)
  1230.     quest(quest_id).reward_given = value
  1231.   end
  1232.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1233.   # * Distribute Rewards
  1234.   #    quest_id : ID of the quest whose rewards are to be distributed
  1235.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1236.   def distribute_quest_rewards(quest_id)
  1237.     if quest_revealed?(quest_id) && !quest_rewarded?(quest_id)
  1238.       params = @params.dup
  1239.       change_reward_status(quest_id, true)
  1240.       quest(quest_id).rewards.each { |reward| distribute_quest_reward(reward) }
  1241.       @params = params
  1242.       true
  1243.     else
  1244.       false
  1245.     end
  1246.   end
  1247.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1248.   # * Distribute Reward
  1249.   #    reward : an array identifying the reward
  1250.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1251.   def distribute_quest_reward(reward)
  1252.     @params = [reward[1], 0, 0, (reward[2] ? reward[2] : 1)]
  1253.     case reward[0]
  1254.     when :item, 0 then   command_126 # Item
  1255.     when :weapon, 1 then command_127 # Weapon
  1256.     when :armor, 2 then  command_128 # Armor
  1257.     when :gold, 3   # Gold
  1258.       @params = [0, 0, reward[1] ? reward[1] : 0]
  1259.       command_125
  1260.     when :exp, 4    # Exp
  1261.       @params = [0, 0, 0, 0, reward[1] ? reward[1] : 0, true]
  1262.       command_315
  1263.     end
  1264.   end
  1265.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1266.   # * Call Quest Journal
  1267.   #    quest_id : ID of the quest to open the journal to
  1268.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1269.   def call_quest_journal(quest_id = nil)
  1270.     return if $game_party.in_battle
  1271.     $game_system.last_quest_id = quest_id if quest_id
  1272.     SceneManager.call(Scene_Quest)
  1273.     Fiber.yield
  1274.   end
  1275. end
  1276.  
  1277. unless $imported[:"MA_ParagraphFormat_1.0"]
  1278. #==============================================================================
  1279. # ** MA_Window_ParagraphFormat
  1280. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1281. #  This module inserts into Window_Base and provides a method to format the
  1282. # strings so as to go to the next line if it exceeds a set limit. This is
  1283. # designed to work with draw_text_ex, and a string formatted by this method
  1284. # should go through that, not draw_text.
  1285. #==============================================================================
  1286.  
  1287. module MA_Window_ParagraphFormat
  1288.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1289.   # * Calc Line Width
  1290.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1291.   def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
  1292.     return tw if line.nil?
  1293.     line = line.clone
  1294.     unless contents_dummy
  1295.       real_contents = contents # Preserve Real Contents
  1296.       # Create a dummy contents
  1297.       self.contents = Bitmap.new(contents_width, 24)
  1298.       reset_font_settings
  1299.     end
  1300.     pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
  1301.     while line[/^(.*?)\e(.*)/]
  1302.       tw += text_size($1).width
  1303.       line = $2
  1304.       # Remove all ancillaries to the code, like parameters
  1305.       code = obtain_escape_code(line)
  1306.       # If direct setting of x, reset tw.
  1307.       tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
  1308.         ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
  1309.       #  If I need to do something special on the basis that it is testing,
  1310.       # alias process_escape_character and differentiate using @atsf_testing
  1311.       process_escape_character(code, line, pos)
  1312.     end
  1313.     #  Add width of remaining text, as well as the value of pos[:x] under the
  1314.     # assumption that any additions to it are because the special code is
  1315.     # replaced by something which requires space (like icons)
  1316.     tw += text_size(line).width + pos[:x]
  1317.     unless contents_dummy
  1318.       contents.dispose # Dispose dummy contents
  1319.       self.contents = real_contents # Restore real contents
  1320.     end
  1321.     return tw
  1322.   end
  1323.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1324.   # * Format Paragraph
  1325.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1326.   def mapf_format_paragraph(text, max_width = contents_width)
  1327.     text = text.clone
  1328.     #  Create a Dummy Contents - I wanted to boost compatibility by using the
  1329.     # default process method for escape codes. It may have the opposite effect,
  1330.     # for some :(
  1331.     real_contents = contents # Preserve Real Contents
  1332.     self.contents = Bitmap.new(contents_width, 24)
  1333.     reset_font_settings
  1334.     paragraph = ""
  1335.     while !text.empty?
  1336.       text.lstrip!
  1337.       oline, nline, tw = mapf_format_by_line(text.clone, max_width)
  1338.       # Replace old line with the new one
  1339.       text.sub!(/#{Regexp.escape(oline)}/m, nline)
  1340.       paragraph += text.slice!(/.*?(\n|$)/)
  1341.     end
  1342.     contents.dispose # Dispose dummy contents
  1343.     self.contents = real_contents # Restore real contents
  1344.     return paragraph
  1345.   end
  1346.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1347.   # * Format By Line
  1348.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1349.   def mapf_format_by_line(text, max_width = contents_width)
  1350.     oline, nline, tw = "", "", 0
  1351.     loop do
  1352.       #  Format each word until reach the width limit
  1353.       oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
  1354.       return oline, nline, tw if done
  1355.     end
  1356.   end
  1357.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1358.   # * Format By Word
  1359.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1360.   def mapf_format_by_word(text, line, tw, max_width)
  1361.     return line, line, tw, true if text.nil? || text.empty?
  1362.     # Extract next word
  1363.     if text.sub!(/(\s*)([^\s\n\f]*)([\n\f]?)/, "") != nil
  1364.       prespace, word, line_end = $1, $2, $3
  1365.       ntw = mapf_calc_line_width(word, tw, true)
  1366.       pw = contents.text_size(prespace).width
  1367.       if (pw + ntw >= max_width)
  1368.         # Insert
  1369.         if line.empty?
  1370.           # If one word takes entire line
  1371.           return prespace + word, word + "\n", ntw, true
  1372.         else
  1373.           return line + prespace + word, line + "\n" + word, tw, true
  1374.         end
  1375.       else
  1376.         line += prespace + word
  1377.         tw = pw + ntw
  1378.         # If the line is force ended, then end
  1379.         return line, line, tw, true if !line_end.empty?
  1380.       end
  1381.     else
  1382.       return line, line, tw, true
  1383.     end
  1384.     return line, line, tw, false
  1385.   end
  1386. end
  1387.  
  1388. class Window_Base
  1389.   include MA_Window_ParagraphFormat
  1390. end
  1391.  
  1392. $imported[:"MA_ParagraphFormat_1.0"] = true
  1393. end
  1394.  
  1395. #==============================================================================
  1396. # *** MAQJ Window_QuestBase
  1397. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1398. #  This module mixes in with all quest windows
  1399. #==============================================================================
  1400.  
  1401. module MAQJ_Window_QuestBase
  1402.   attr_reader :maqj_objective_color
  1403.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1404.   # * Object Initialization
  1405.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1406.   def initialize(*args, &block)
  1407.     super(*args, &block)
  1408.     reset_font_settings
  1409.     set_data_font(:normal)
  1410.     @maqj_default_font = contents.font.dup
  1411.     # Change the windowskin, tone if they are set to be changed
  1412.     self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin
  1413.     self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity
  1414.     self.opacity = 0 ####SR
  1415.   end
  1416.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1417.   # * Reset Font Settings
  1418.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1419.   def reset_font_settings(*args, &block)
  1420.     super(*args, &block)
  1421.     set_data_font(@maqj_font_data_type) if @maqj_font_data_type
  1422.   end
  1423.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1424.   # * Set Data Font
  1425.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1426.   def set_data_font(data_type)
  1427.     @maqj_default_font = contents.font.dup unless @maqj_default_font
  1428.     contents.font.name = QuestData::FONTNAMES[data_type] ?
  1429.       QuestData::FONTNAMES[data_type] : @maqj_default_font.name
  1430.     contents.font.size = QuestData::FONTSIZES[data_type] ?
  1431.       QuestData::FONTSIZES[data_type] : @maqj_default_font.size
  1432.     contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ?
  1433.       QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold
  1434.     contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?
  1435.       QuestData::FONTITALICS[data_type] : @maqj_default_font.italic
  1436.     case data_type
  1437.     when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color
  1438.     when :name then change_color(quest_name_colour(@quest)) if @quest
  1439.     else
  1440.       change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)
  1441.     end
  1442.   end
  1443.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1444.   # * Draw Horizontal Line
  1445.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1446.   def draw_horizontal_line(y, h = 2)
  1447.     contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))
  1448.     contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))
  1449.   end
  1450.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1451.   # * MA Text Color
  1452.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1453.   def text_color(param)
  1454.     begin
  1455.       colour = case param
  1456.       when Integer then super(param) rescue normal_color
  1457.       when Symbol then send(param) rescue normal_color
  1458.       when Array then Color.new(*param) rescue normal_color
  1459.       else
  1460.         normal_color
  1461.       end
  1462.     end
  1463.     colour.is_a?(Color) ? colour : normal_color
  1464.   end
  1465.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1466.   # * Quest Name Colour
  1467.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1468.   def quest_name_colour(quest = @quest)
  1469.     return if !quest
  1470.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1471.     s = [:failed, :complete, :active].find { |status| quest.status?(status) }
  1472.     text_color(QuestData::COLOURS[s])
  1473.   end
  1474.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1475.   # * Quest Objective Colour
  1476.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1477.   def quest_objective_colour(quest, obj_id)
  1478.     return if !quest
  1479.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1480.     s = [:failed, :complete, :active].find { |status| quest.objective_status?(status, obj_id) }
  1481.     text_color(QuestData::COLOURS[s])
  1482.   end
  1483.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1484.   # * Update Tone
  1485.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1486.   def update_tone
  1487.     $game_system.quest_window_tone ?
  1488.       self.tone.set(*$game_system.quest_window_tone) : super
  1489.   end
  1490. end
  1491.  
  1492. unless $imported[:"MA_IconHorzCommand_1.0"]
  1493. #==============================================================================
  1494. # ** Window_MA_IconHorzCommand
  1495. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1496. #  This window is a base window to show a horizontal command window populated
  1497. # with icons.
  1498. #==============================================================================
  1499.  
  1500. class Window_MA_IconHorzCommand < Window_HorzCommand
  1501.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1502.   # * Public Instance Variable
  1503.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1504.   attr_reader   :observing_procs
  1505.   attr_accessor :cursor_hide
  1506.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1507.   # * Object Initialization
  1508.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1509.   def initialize(*args, &block)
  1510.     @observing_procs = {}
  1511.     super(*args, &block)
  1512.   end
  1513.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1514.   # * Column Max
  1515.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1516.   def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end
  1517.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1518.   # * Item
  1519.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1520.   def item
  1521.     @list[index] ? @list[index][:symbol] : nil
  1522.   end
  1523.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1524.   # * Enabled? / Current Item Enabled?
  1525.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1526.   def enable?(index); self.index == index; end
  1527.   def current_item_enabled?; !current_data.nil?; end
  1528.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1529.   # * Draw Item
  1530.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1531.   def draw_item(index)
  1532.     rect = item_rect(index)
  1533.     contents.clear_rect(rect)
  1534.     draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  1535.   end
  1536.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1537.   # * Set Index
  1538.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1539.   def index=(index)
  1540.     old_index = self.index
  1541.     super(index)
  1542.     draw_item(old_index)
  1543.     draw_item(self.index)
  1544.   end
  1545.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1546.   # * Frame Update
  1547.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1548.   def update
  1549.     super
  1550.     @observing_procs.values.each { |block| block.call(item) }
  1551.   end
  1552.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1553.   # * Add/Remove Observing Window
  1554.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1555.   def add_observing_proc(id, &block)
  1556.     @observing_procs[id] = block
  1557.     update
  1558.   end
  1559.   def remove_observing_proc(id)     ; @observing_procs.delete(id) ; end
  1560.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1561.   # * Update Cursor
  1562.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1563.   def update_cursor
  1564.     super
  1565.     cursor_rect.empty if @cursor_hide
  1566.   end
  1567. end
  1568. $imported[:"MA_IconHorzCommand_1.0"] = true
  1569. end
  1570.  
  1571. #==============================================================================
  1572. # ** Window_QuestCategory
  1573. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1574. #  This window allows the player to switch between quest categories.
  1575. #==============================================================================
  1576.  
  1577. class Window_QuestCategory < Window_MA_IconHorzCommand
  1578.   include MAQJ_Window_QuestBase
  1579.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1580.   # * Object Initialization
  1581.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1582.   def initialize(x, y, categories = $game_system.quest_categories)
  1583.     @cursor_hide = QuestData::HIDE_CATEGORY_CURSOR
  1584.     @categories = categories
  1585.     super(x, y)
  1586.     #self.opacity = 0 ####SR
  1587.   end
  1588.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1589.   # * Window Width
  1590.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1591.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1592.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1593.   # * Category=
  1594.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1595.   def category=(category)
  1596.     self.index = @categories.index(category) if @categories.include?(category)
  1597.   end
  1598.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1599.   # * Make Command List
  1600.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1601.   def make_command_list
  1602.     @categories.each { |cat|
  1603.       add_command("", cat, false, QuestData::ICONS[cat]) }
  1604.   end
  1605. end
  1606.  
  1607. #==============================================================================
  1608. # ** Window QuestLabel
  1609. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1610. #  This window simply shows a label for the Quests scene
  1611. #==============================================================================
  1612.  
  1613. class Window_QuestLabel < Window_Base
  1614.   include MAQJ_Window_QuestBase
  1615.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1616.   # * Object Initialization
  1617.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1618.   def initialize(x, y, label = "")
  1619.     super(x, y, window_width, window_height)
  1620.     #self.opacity = 0 ####SR
  1621.     refresh(label)
  1622.   end
  1623.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1624.   # * Reset Font Settings
  1625.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1626.   def reset_font_settings; set_data_font(:scene_label); end
  1627.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1628.   # * Window Attributes
  1629.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1630.   def window_width
  1631.     w = ($game_system.quest_categories.size > 1 || QuestData::SHOW_CATEGORY_LABEL) ?
  1632.       Graphics.width - QuestData::LIST_WINDOW_WIDTH : QuestData::LIST_WINDOW_WIDTH
  1633.   end
  1634.   def window_height; line_height + (standard_padding*2); end
  1635.   def line_height(*args)
  1636.     line_h = super(*args)
  1637.     QuestData::FONTSIZES[:scene_label] ?
  1638.       [QuestData::FONTSIZES[:scene_label], line_h].max : line_h
  1639.   end
  1640.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1641.   # * Refresh
  1642.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1643.   def refresh(label = @label)
  1644.     @label = label.is_a?(String) ? convert_escape_characters(label) : ""
  1645.     contents.clear
  1646.     reset_font_settings
  1647.     tw = mapf_calc_line_width(@label)
  1648.     draw_text_ex((contents_width - tw) / 2, 0, @label)
  1649.   end
  1650. end
  1651.  
  1652. #==============================================================================
  1653. # ** Window QuestLabel
  1654. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1655. #  This window simply shows a label for category currently selected
  1656. #==============================================================================
  1657.  
  1658. class Window_QuestCategoryLabel < Window_QuestLabel
  1659.   include MAQJ_Window_QuestBase
  1660.   #
  1661.   def initialize(x, y, label = "")
  1662.     super(x, y, label)
  1663.     #self.opacity = 0 ####SR
  1664.   end
  1665.   #
  1666.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1667.   # * Reset Font Settings
  1668.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1669.   def reset_font_settings; set_data_font(:category_label); end
  1670.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1671.   # * Window Attributes
  1672.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1673.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1674.   def line_height(*args)
  1675.     line_h = super(*args)
  1676.     QuestData::FONTSIZES[:category_label] ?
  1677.       [QuestData::FONTSIZES[:category_label], line_h].max : line_h
  1678.   end
  1679.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1680.   # * Set Category
  1681.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1682.   def category=(category)
  1683.     return if @category == category
  1684.     @category = category
  1685.     refresh(QuestData::CATEGORY_VOCAB[category])
  1686.   end
  1687. end
  1688.  
  1689. #==============================================================================
  1690. # ** Window_QuestCategoryDummy
  1691. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1692. #  This window shows up behind the category and category label window
  1693. #==============================================================================
  1694.  
  1695. class Window_QuestCategoryDummy < Window_Base
  1696.   include MAQJ_Window_QuestBase
  1697. end
  1698.  
  1699. #==============================================================================
  1700. # ** Window_QuestList
  1701. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1702. #  This window shows all quests in a selected category.
  1703. #==============================================================================
  1704.  
  1705. class Window_QuestList < Window_Selectable
  1706.   include MAQJ_Window_QuestBase
  1707.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1708.   # * Object Initialization
  1709.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1710.   def initialize(x, y, width, height)
  1711.     super
  1712.     @data = []
  1713.     self.index = 0
  1714.     self.opacity = 0 #####SR2
  1715.     activate
  1716.   end
  1717.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1718.   # * Set Category
  1719.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1720.   def category=(category)
  1721.     return if @category == category
  1722.     @category = category
  1723.     refresh
  1724.     self.index = 0
  1725.     update_help if @help_window
  1726.   end
  1727.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1728.   # * Get Quest
  1729.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1730.   def item; @data && index >= 0 ? @data[index] : nil; end
  1731.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1732.   # * Column/Item Max
  1733.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1734.   def col_max; 1; end
  1735.   def item_max; @data ? @data.size : 1; end
  1736.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1737.   # * Whether it should be drawn enabled
  1738.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1739.   def enable?(item); true; end
  1740.   def current_item_enabled?
  1741.     (@help_window && @help_window.maqj_visible_height < @help_window.contents_height)
  1742.   end
  1743.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1744.   # * Make Item List
  1745.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1746.   def make_item_list
  1747.     @data = @category ? $game_party.quests.list(@category) : []
  1748.   end
  1749.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1750.   # * Draw Item
  1751.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1752.   def draw_item(index)
  1753.     quest = @data[index]
  1754.     if quest
  1755.       rect = item_rect_for_text(index)
  1756.       if QuestData::SHOW_QUEST_ICONS
  1757.         draw_icon(quest.icon_index, rect.x, rect.y, enable?(quest))
  1758.         rect.x += 24
  1759.         rect.width -= 24
  1760.       end
  1761.       change_color(quest_name_colour(quest), enable?(quest))
  1762.       draw_text(rect, quest.name)
  1763.     end
  1764.   end
  1765.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1766.   # * Refresh
  1767.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1768.   def refresh
  1769.     make_item_list
  1770.     create_contents
  1771.     set_data_font(:list)
  1772.     draw_all_items
  1773.   end
  1774.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1775.   # * Update Help
  1776.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1777.   def update_help
  1778.     @help_window.quest = item
  1779.   end
  1780. end
  1781.  
  1782. #==============================================================================
  1783. # ** Window_QuestData
  1784. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1785. #  This window shows all quest data
  1786. #==============================================================================
  1787.  
  1788. class Window_QuestData < Window_Selectable
  1789.   include MAQJ_Window_QuestBase
  1790.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1791.   # * Object Initialization
  1792.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1793.   def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)
  1794.     @dest_scroll_oy = 0
  1795.     super(x, y, w, h)
  1796.     @dest_scroll_oy = self.oy
  1797.     self.layout = layout
  1798.     self.opacity = 0 #####SR2
  1799.   end
  1800.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1801.   # * Contents Height
  1802.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1803.   alias maqj_visible_height contents_height
  1804.   def contents_height
  1805.     @q_contents_height ? [@q_contents_height, maqj_visible_height].max : maqj_visible_height
  1806.   end
  1807.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1808.   # * Calculate Contents Height
  1809.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1810.   def calc_contents_height
  1811.     @q_contents_height = 0
  1812.     @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest
  1813.   end
  1814.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1815.   # * Draw Data?
  1816.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1817.   def draw_data?(data_type)
  1818.     case data_type
  1819.     when :line then true
  1820.     when :level then @quest.level > 0
  1821.     when :objectives then !@quest.revealed_objectives.empty?
  1822.     when Array then (data_type - [:line]).any? { |dt| draw_data?(dt) }
  1823.     else !@quest.send(data_type).empty? # :description, :name, etc...
  1824.     end
  1825.   end
  1826.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1827.   # * Get Data Height
  1828.   #    This method calculates the height required for a specified element of
  1829.   #   the current quest. This is to calculate the needed space in contents,
  1830.   #   as well as advance the @draw_y variable.
  1831.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1832.   def data_height(data_type)
  1833.     return 0 unless draw_data?(data_type)
  1834.     return line_height if QuestData::BASIC_DATA_TYPES.include?(data_type)
  1835.     @maqj_font_data_type = data_type
  1836.     reset_font_settings
  1837.     return case data_type
  1838.     when :line, :level, :name then line_height
  1839.     when :banner
  1840.       bmp = Cache.picture(@quest.banner)
  1841.       hght = bmp.rect.height
  1842.       bmp.dispose
  1843.       hght
  1844.     when :description
  1845.       buff = description_x*2
  1846.       paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  1847.       line_num = paragraph.scan(/\n/).size + 1
  1848.       line_num += (QuestData::DESCRIPTION_IN_BOX ? 2 :
  1849.         !QuestData::VOCAB[:description].empty? ? 1 : 0)
  1850.       line_num*line_height
  1851.     when :objectives
  1852.       objectives = @quest.revealed_objectives.collect { |obj_id|
  1853.         @quest.objectives[obj_id] }
  1854.       line_num = QuestData::VOCAB[:objectives].empty? ? 0 : 1
  1855.       buff = (objective_x*2) + text_size(QuestData::VOCAB[:objective_bullet]).width
  1856.       objectives.each { |obj|
  1857.         paragraph = mapf_format_paragraph(obj, contents_width - buff)
  1858.         line_num += paragraph.scan(/\n/).size + 1 }
  1859.       line_num*line_height
  1860.     when :rewards
  1861.       line_num = QuestData::VOCAB[:rewards].empty? ? 0 : 1
  1862.       (line_num + @quest.rewards.size)*line_height
  1863.     when Array then data_height(data_type.max_by { |dt| data_height(dt) })
  1864.     else 0
  1865.     end
  1866.   end
  1867.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1868.   # * Set Quest
  1869.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1870.   def quest=(value)
  1871.     return if @quest == value
  1872.     @quest = value
  1873.     @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout
  1874.     refresh
  1875.   end
  1876.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1877.   # * Set Layout
  1878.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1879.   def layout=(value)
  1880.     return if @default_layout == value && @layout == value
  1881.     @default_layout = value
  1882.     @layout = value
  1883.     refresh
  1884.   end
  1885.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1886.   # * Refresh
  1887.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1888.   def refresh
  1889.     contents.clear
  1890.     calc_contents_height
  1891.     create_contents
  1892.     return unless @quest && @layout
  1893.     self.oy = 0
  1894.     @dest_scroll_oy = 0
  1895.     #  The basic idea here is that each draw_ method will rely on and advance
  1896.     # the @draw_y variable. Where they are an array, the elements will be
  1897.     # drawn at the same @draw_y.
  1898.     @draw_y = 0
  1899.     @layout.each {|dt|
  1900.       next unless draw_data?(dt)
  1901.       dt.is_a?(Array) ? draw_data_array(dt) : draw_data(dt)
  1902.     }
  1903.   end
  1904.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1905.   # * Draw Data
  1906.   #    data_type : the data block to draw next
  1907.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1908.   def draw_data(data_type)
  1909.     @maqj_font_data_type = data_type
  1910.     reset_font_settings
  1911.     send(:"draw_#{data_type}") if self.class.method_defined?(:"draw_#{data_type}")
  1912.     @draw_y += data_height(data_type)
  1913.   end
  1914.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1915.   # * Draw Data Array
  1916.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1917.   def draw_data_array(layout_array)
  1918.     y, max_y = @draw_y, @draw_y
  1919.     # Draw each data aspect at the same starting @draw_y
  1920.     layout_array.each { |dt|
  1921.       @draw_y = y
  1922.       draw_data(dt)
  1923.       max_y = @draw_y if @draw_y > max_y
  1924.     }
  1925.     @draw_y = max_y
  1926.   end
  1927.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1928.   # * Draw Line
  1929.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1930.   def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end
  1931.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1932.   # * Draw Name
  1933.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1934.   def draw_name
  1935.     set_data_font(:name)
  1936.     clear_and_draw_text(0, @draw_y, contents_width, line_height, @quest.name, 1)
  1937.   end
  1938.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1939.   # * Draw Level
  1940.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1941.   def draw_level
  1942.     case QuestData::LEVEL_ICON
  1943.     when Array then QuestData::LEVEL_ICON.empty? ? draw_level_text : draw_level_array
  1944.     when 0 then draw_level_text
  1945.     else
  1946.       draw_level_stacked
  1947.     end
  1948.   end
  1949.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1950.   # * Draw Stacked Level
  1951.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1952.   def draw_level_stacked(icon_index = QuestData::LEVEL_ICON)
  1953.     align = QuestData::HEADING_ALIGN[:level]
  1954.     es = QuestData::LEVEL_ICONS_SPACE*(@quest.level - 1)
  1955.     x = align == 2 ? contents_width - 24 : align == 1 ?
  1956.       (contents_width - 24 - (es)) / 2 : es
  1957.     @quest.level.times do
  1958.       draw_icon(icon_index, x, @draw_y)
  1959.       x -= QuestData::LEVEL_ICONS_SPACE
  1960.     end
  1961.   end
  1962.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1963.   # * Draw Array Level
  1964.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1965.   def draw_level_array(icon_index = QuestData::LEVEL_ICON)
  1966.     return if icon_index.empty?
  1967.     icon_index = icon_index[@quest.level - 1] ? icon_index[@quest.level - 1] : icon_index[-1]
  1968.     align = QuestData::HEADING_ALIGN[:level]
  1969.     x = align == 2 ? contents_width - 24 : align == 1 ? (contents_width-24)/2 : 0
  1970.     draw_icon(icon_index, x, @draw_y)
  1971.   end
  1972.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1973.   # * Draw Text Level
  1974.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1975.   def draw_level_text
  1976.     reset_font_settings
  1977.     level = QuestData::LEVEL_SIGNALS && QuestData::LEVEL_SIGNALS[@quest.level - 1] ?
  1978.       QuestData::LEVEL_SIGNALS[@quest.level - 1] : @quest.level.to_s
  1979.     align = QuestData::HEADING_ALIGN[:level]
  1980.     tw = text_size(QuestData::VOCAB[:level]).width + 4
  1981.     tw2 = text_size(level).width + 2
  1982.     space = contents_width - tw - tw2
  1983.     x = align == 2 ? space : align == 1 ? space / 2 : 0
  1984.     clear_and_draw_text(x, @draw_y, tw, line_height, QuestData::VOCAB[:level])
  1985.     set_data_font(:level_signal)
  1986.     clear_and_draw_text(x + tw, @draw_y, tw2, line_height, level, 2)
  1987.   end
  1988.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1989.   # * Draw Banner
  1990.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1991.   def draw_banner
  1992.     bmp = Cache.picture(@quest.banner) # Get Picture
  1993.     # Shift the hue if requested
  1994.     bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0
  1995.     x = (contents_width - bmp.rect.width) / 2
  1996.     if x < 0 # Stretch horizontally if the banner is too wide
  1997.       dest_rect = bmp.rect.dup
  1998.       dest_rect.width = contents_width
  1999.       contents.stretch_blt(dest_rect, bmp, bmp.rect)
  2000.     else
  2001.       contents.blt(x, @draw_y, bmp, bmp.rect)
  2002.     end
  2003.     bmp.dispose
  2004.   end
  2005.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2006.   # * Draw Description
  2007.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2008.   def draw_description
  2009.     buff = description_x*2
  2010.     paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  2011.     y = @draw_y
  2012.     # Draw Rect
  2013.     draw_box(paragraph.scan(/\n/).size + 1) if QuestData::DESCRIPTION_IN_BOX
  2014.     # Draw Description Label
  2015.     draw_heading(:description, y) unless QuestData::VOCAB[:description].empty?
  2016.     # Draw Description
  2017.     y += line_height if !QuestData::VOCAB[:description].empty? || QuestData::DESCRIPTION_IN_BOX
  2018.     draw_text_ex(description_x, y, paragraph)
  2019.   end
  2020.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2021.   # * Draw Objectives
  2022.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2023.   def draw_objectives
  2024.     y = @draw_y
  2025.     unless QuestData::VOCAB[:objectives].empty?
  2026.       draw_heading(:objectives, y)
  2027.       y += line_height
  2028.     end
  2029.     @quest.revealed_objectives.each { |obj_id| y = draw_objective(obj_id, y) }
  2030.   end
  2031.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2032.   # * Draw Objective
  2033.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2034.   def draw_objective(obj_id, y)
  2035.     bullet = QuestData::VOCAB[:objective_bullet]
  2036.     bullet_tw = text_size(bullet).width + 2
  2037.     buff = (objective_x*2) + bullet_tw
  2038.     paragraph = mapf_format_paragraph(@quest.objectives[obj_id], contents_width - buff)
  2039.     line_num = 1 + paragraph.scan(/\n/).size
  2040.     # Since draw_text_ex resets the font, set colour here
  2041.     @maqj_objective_color = quest_objective_colour(@quest, obj_id)
  2042.     change_color(text_color(QuestData::COLOURS[:objective_bullet]))
  2043.     draw_text(objective_x, y, bullet_tw, line_height, sprintf(bullet, obj_id + 1))
  2044.     draw_text_ex(objective_x + bullet_tw, y, paragraph)
  2045.     @maqj_objective_color = false
  2046.     y += (line_num*line_height)
  2047.   end
  2048.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2049.   # * Draw Rewards
  2050.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2051.   def draw_rewards
  2052.     y = @draw_y
  2053.     unless QuestData::VOCAB[:rewards].empty?
  2054.       draw_heading(:rewards, y)
  2055.       y += line_height
  2056.     end
  2057.     for i in [email]0...@quest.rewards.size[/email] do draw_reward(i, y + i*line_height) end
  2058.   end
  2059.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2060.   # * Draw Reward
  2061.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2062.   def draw_reward(r_id, y)
  2063.     reward = @quest.rewards[r_id]
  2064.     case reward[0]
  2065.     when :item, 0   # Item
  2066.       draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
  2067.     when :weapon, 1 # Weapon
  2068.       draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
  2069.     when :armor, 2  # Armor
  2070.       draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
  2071.     when :gold, 3   # Gold
  2072.       draw_basic_data(y, QuestData::ICONS[:reward_gold],
  2073.         QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
  2074.     when :exp, 4    # Exp
  2075.       draw_basic_data(y, QuestData::ICONS[:reward_exp],
  2076.         QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
  2077.     when :string, 5 # String
  2078.       draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3] : "",
  2079.         reward[2] ? reward[2] : "")
  2080.     end
  2081.   end
  2082.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2083.   # * Draw Item Reward
  2084.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2085.   def draw_item_reward(y, item, amount = 1)
  2086.     w = contents_width
  2087.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2088.     x = (contents_width - w) / 2
  2089.     draw_item_name(item, x, y, true, w - 40)
  2090.     if amount > 1
  2091.       change_color(text_color(QuestData::COLOURS[:reward_amount]))
  2092.       draw_text(x + w - 40, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
  2093.     end
  2094.   end
  2095.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2096.   # * Draw Basic Data Methods
  2097.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2098.   QuestData::BASIC_DATA_TYPES.each { |data_type|
  2099.     define_method(:"draw_#{data_type}") {
  2100.       draw_basic_data(@draw_y, QuestData::ICONS[data_type],
  2101.         QuestData::VOCAB[data_type], @quest.send(data_type))
  2102.     }
  2103.   }
  2104.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2105.   # * Draw Basic Data
  2106.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2107.   def draw_basic_data(y, icon_index, vocab, value)
  2108.     w = contents_width
  2109.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2110.     x = (contents_width - w) / 2
  2111.     unless icon_index == 0
  2112.       draw_icon(icon_index, x, y)
  2113.       x += 24
  2114.       w -= 24
  2115.     end
  2116.     tw = text_size(vocab).width
  2117.     #change_color(text_color(QuestData::COLOURS[:basic_label]))
  2118.     draw_text(x, y, tw + 16, line_height, vocab)
  2119.     change_color(text_color(QuestData::COLOURS[:basic_value]))
  2120.     draw_text(x + tw, y, w - tw, line_height, value, 2)
  2121.   end
  2122.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2123.   # * Draw Heading
  2124.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2125.   def draw_heading(data_type, y)
  2126.     set_data_font(:heading)
  2127.     clear_and_draw_text(40, y, contents_width - 80, line_height,
  2128.       QuestData::VOCAB[data_type], QuestData::HEADING_ALIGN[data_type])
  2129.     reset_font_settings
  2130.   end
  2131.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2132.   # * Clear and Draw Text
  2133.   #    Clear the field before drawing the text
  2134.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2135.   def clear_and_draw_text(*args)
  2136.     rect = []
  2137.     while !args[0].is_a?(String) do rect.push(args.shift) end
  2138.     rect[0].is_a?(Rect) ? rect = rect[0] : rect = Rect.new(*rect)
  2139.     align = args[1] ? args[1] : 0
  2140.     ts = text_size(args[0])
  2141.     ts.width = [ts.width + 4, rect.width].min
  2142.     align == 1 ? ts.x = rect.x + ((rect.width - ts.width) / 2) :
  2143.       align == 2 ? ts.x = rect.x + rect.width - ts.width : ts.x = rect.x
  2144.     ts.y = rect.y
  2145.     contents.clear_rect(ts)
  2146.     ts.x += 2
  2147.     draw_text(ts, args[0], align)
  2148.   end
  2149.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2150.   # * Draw Description Box
  2151.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2152.   def draw_box(line_num)
  2153.     return if line_num < 1
  2154.     x = (line_height / 2) - 1
  2155.     y = @draw_y + (line_height / 2) - 1
  2156.     w = contents_width - 2*x
  2157.     h = (1 + line_num)*line_height
  2158.     draw_rect_outline_with_shadow(x, y, w, h)
  2159.   end
  2160.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2161.   # * Draw Rect Outline
  2162.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2163.   def draw_rect_outline(x, y, w, h, colour)
  2164.     # Horizontal Lines
  2165.     contents.fill_rect(x, y, w, 2, colour)
  2166.     contents.fill_rect(x, y + h - 2, w, 2, colour)
  2167.     # Vertical Lines
  2168.     contents.fill_rect(x, y, 2, h, colour)
  2169.     contents.fill_rect(x + w - 2, y, 2, h, colour)
  2170.   end
  2171.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2172.   # * Draw Rect Outline with Shadow
  2173.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2174.   def draw_rect_outline_with_shadow(x, y, w, h)
  2175.     draw_rect_outline(x + 1, y + 1, w, h, text_color(QuestData::COLOURS[:line_shadow]))
  2176.     draw_rect_outline(x, y, w, h, text_color(QuestData::COLOURS[:line]))
  2177.   end
  2178.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2179.   # * Objective/Description X
  2180.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2181.   def objective_x; line_height / 2; end
  2182.   def description_x; QuestData::DESCRIPTION_IN_BOX ? line_height : (line_height/2); end
  2183.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2184.   # * Update
  2185.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2186.   def update(*args, &block)
  2187.     super(*args, &block)
  2188.     if open? && active && @dest_scroll_oy == self.oy
  2189.       scroll_down if Input.press?(:DOWN)
  2190.       scroll_up if Input.press?(:UP)
  2191.     end
  2192.     if self.oy != @dest_scroll_oy
  2193.       mod = (@dest_scroll_oy <=> self.oy)
  2194.       self.oy += 3*mod
  2195.       self.oy = @dest_scroll_oy if (@dest_scroll_oy <=> self.oy) != mod
  2196.     end
  2197.   end
  2198.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2199.   # * Scroll Down
  2200.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2201.   def scroll_down(*args, &block)
  2202.     max_oy = contents_height - maqj_visible_height
  2203.     dest = ((@dest_scroll_oy / line_height) + 1)*line_height
  2204.     @dest_scroll_oy = [dest, max_oy].min
  2205.   end
  2206.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2207.   # * Scroll Up
  2208.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2209.   def scroll_up(*args, &block)
  2210.     dest = ((@dest_scroll_oy / line_height) - 1)*line_height
  2211.     @dest_scroll_oy = [dest, 0].max
  2212.   end
  2213. end
  2214.  
  2215. #==============================================================================
  2216. # ** Scene_Quest
  2217. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2218. #  This class handles processing for the Quest scene
  2219. #==============================================================================
  2220.  
  2221. class Scene_Quest < Scene_MenuBase
  2222.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2223.   # * Start Scene Processing
  2224.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2225.   def start
  2226.     super
  2227.     @init_category, @init_quest_index = $game_party.quests.find_location($game_system.last_quest_id, $game_system.last_quest_cat)
  2228.     create_maqj_picture unless $game_system.quest_bg_picture.empty?
  2229.     create_all_windows
  2230.     adjust_window_positions
  2231.   end
  2232.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2233.   # * Terminate Scene
  2234.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2235.   def terminate
  2236.     $game_system.quest_categories = QuestData::CATEGORIES
  2237.     $game_system.quest_scene_label = QuestData::VOCAB[:scene_label]
  2238.     $game_system.last_quest_id = @quest_list_window.item ? @quest_list_window.item.id : 0
  2239.     $game_system.last_quest_cat = @quest_category_window.item
  2240.     super
  2241.     dispose_maqj_picture
  2242.   end
  2243.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2244.   # * Create Background Picture
  2245.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2246.   def create_maqj_picture
  2247.     @maqj_picture_sprite = Sprite.new
  2248.     @maqj_picture_sprite.bitmap = Cache.picture($game_system.quest_bg_picture)
  2249.     @maqj_picture_sprite.opacity = $game_system.quest_bg_opacity
  2250.     @maqj_picture_sprite.blend_type = $game_system.quest_bg_blend_type
  2251.     @maqj_picture_sprite.z = @background_sprite.z + 1 if @background_sprite
  2252.   end
  2253.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2254.   # * Create All Windows
  2255.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2256.   def create_all_windows
  2257.     create_quest_label_window unless $game_system.quest_scene_label.empty?
  2258.     create_quest_category_window if $game_system.quest_categories.size > 1
  2259.     create_quest_category_label_window if QuestData::SHOW_CATEGORY_LABEL
  2260.     create_dummy_category_window if QuestData::CATEGORY_LABEL_IN_SAME_WINDOW &&
  2261.       @quest_category_window && @quest_category_label_window
  2262.     create_quest_list_window
  2263.     create_quest_data_window
  2264.   end
  2265.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2266.   # * Create QuestLabel Window
  2267.   #    This window shows the name of the scene
  2268.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2269.   def create_quest_label_window
  2270.     @quest_label_window = Window_QuestLabel.new(0, 0, $game_system.quest_scene_label)
  2271.   end
  2272.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2273.   # * Create QuestCategory Window
  2274.   #    This window allows the player to switch categories.
  2275.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2276.   def create_quest_category_window
  2277.     @quest_category_window = Window_QuestCategory.new(0, 0, $game_system.quest_categories)
  2278.     @quest_category_window.category = @init_category if @init_category
  2279.     @quest_category_window.set_handler(:cancel, method(:on_category_cancel))
  2280.     @quest_category_window.set_handler(:ok, method(:on_category_ok))
  2281.   end
  2282.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2283.   # * Create QuestCategoryLabel Window
  2284.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2285.   def create_quest_category_label_window
  2286.     if @quest_category_window
  2287.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, @quest_category_window.height)
  2288.       @quest_category_window.add_observing_proc(:label) { |category|
  2289.         @quest_category_label_window.category = category }
  2290.     else
  2291.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, 0)
  2292.       @quest_category_label_window.category = $game_system.quest_categories ? $game_system.quest_categories[0] : :all
  2293.     end
  2294.   end
  2295.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2296.   # * Create Dummy Category Label Window
  2297.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2298.   def create_dummy_category_window
  2299.     @quest_category_label_window.y -= 12
  2300.     @quest_category_label_window.opacity = 0
  2301.     @quest_category_window.opacity = 0
  2302.     w = [@quest_category_window.width, @quest_category_label_window.width].max
  2303.     h = @quest_category_window.height + @quest_category_label_window.height - 12
  2304.     @category_dummy_window = Window_QuestCategoryDummy.new(0, 0, w, h)
  2305.     @category_dummy_window.z = [@quest_category_window.z, @quest_category_label_window.z].min - 1
  2306.     # Draw Horz Line
  2307.     @category_dummy_window.draw_horizontal_line(@quest_category_window.height - @quest_category_window.padding - 7, 2)
  2308.   end
  2309.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2310.   # * Create QuestList Window
  2311.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2312.   def create_quest_list_window
  2313.     if @category_dummy_window
  2314.       y = @category_dummy_window.height
  2315.     else
  2316.       y = @quest_category_window ? @quest_category_window.height : 0
  2317.       y += @quest_category_label_window ? @quest_category_label_window.height : 0
  2318.       y = @quest_label_window.height if y == 0
  2319.     end
  2320.     @quest_list_window = Window_QuestList.new(0, y, QuestData::LIST_WINDOW_WIDTH,
  2321.       Graphics.height - y)
  2322.     @quest_list_window.set_handler(:ok, method(:on_list_ok))
  2323.     if !QuestData::CONCURRENT_ACTIVITY
  2324.       @quest_list_window.deactivate
  2325.       @quest_list_window.set_handler(:cancel, method(:on_list_cancel))
  2326.     end
  2327.     if @quest_category_window
  2328.       @quest_category_window.add_observing_proc(:list) { |category|
  2329.         @quest_list_window.category = category }
  2330.     else
  2331.       @quest_list_window.category = $game_system.quest_categories[0]
  2332.     end
  2333.     @quest_list_window.index = @init_quest_index if @init_quest_index
  2334.   end
  2335.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2336.   # * Create QuestData Window
  2337.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2338.   def create_quest_data_window
  2339.     x = @quest_list_window.width
  2340.     y = (@quest_label_window && (@quest_category_window ||
  2341.       @quest_category_label_window)) ? @quest_label_window.height : 0
  2342.     @quest_data_window = Window_QuestData.new(x, y, Graphics.width - x,
  2343.       Graphics.height - y)
  2344.     @quest_list_window.help_window = @quest_data_window
  2345.     @quest_data_window.quest = @quest_list_window.item
  2346.     @quest_data_window.set_handler(:ok, method(:on_data_ok))
  2347.     @quest_data_window.set_handler(:cancel, method(:on_data_cancel))
  2348.   end
  2349.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2350.   # * Dispose Background Picture
  2351.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2352.   def dispose_maqj_picture
  2353.     @maqj_picture_sprite.dispose if @maqj_picture_sprite
  2354.   end
  2355.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2356.   # * Adjust Window Positions
  2357.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2358.   def adjust_window_positions
  2359.     if @quest_label_window && (@quest_category_window || @quest_category_label_window)
  2360.       @quest_label_window.x = QuestData::LIST_WINDOW_WIDTH
  2361.     end
  2362.   end
  2363.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2364.   # * Category OK
  2365.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2366.   def on_category_ok; @quest_list_window.activate; end
  2367.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2368.   # * Category Cancel
  2369.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2370.   def on_category_cancel; return_scene; end
  2371.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2372.   # * List OK
  2373.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2374.   def on_list_ok
  2375.     @quest_category_window.deactivate
  2376.     @quest_data_window.activate
  2377.   end
  2378.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2379.   # * List Cancel
  2380.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2381.   def on_list_cancel; @quest_category_window.activate; end
  2382.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2383.   # * Data OK
  2384.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2385.   def on_data_ok; on_data_cancel; end
  2386.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2387.   # * Data Cancel
  2388.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2389.   def on_data_cancel
  2390.     @quest_list_window.activate
  2391.     @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY
  2392.   end
  2393.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2394.   # * Update All Windows
  2395.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2396.   def update_all_windows(*args, &block)
  2397.     # To accomodate for concurrent activity, must deactivate category
  2398.     @quest_category_window.deactivate if QuestData::CONCURRENT_ACTIVITY &&
  2399.       @quest_list_window.active && Input.trigger?(:C)
  2400.     super(*args, &block)
  2401.     @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY &&
  2402.       @quest_list_window.active
  2403.   end
  2404. end
  2405.  
  2406. #==============================================================================
  2407. # ** Scene_Map
  2408. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2409. #  Summary of Changes:
  2410. #    aliased method - update_scene
  2411. #    new methods - update_call_quest_journal; call_quest_journal
  2412. #==============================================================================
  2413.  
  2414. class Scene_Map
  2415.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2416.   # * Update Scene
  2417.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2418.   alias maqj_updascne_9kh4 update_scene
  2419.   def update_scene(*args, &block)
  2420.     maqj_updascne_9kh4(*args, &block)
  2421.     update_call_quest_journal if $game_system.quest_map_access && !scene_changing?
  2422.   end
  2423.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2424.   # * Update Call Quest Journal
  2425.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2426.   def update_call_quest_journal
  2427.     if $game_map.interpreter.running?
  2428.       @quest_journal_calling = false
  2429.     else
  2430.       if Input.trigger?(QuestData::MAP_BUTTON)
  2431.         $game_system.quest_access_disabled || $game_party.quests.list.empty? ?
  2432.           Sound.play_buzzer : @quest_journal_calling = true
  2433.       end
  2434.       call_quest_journal if @quest_journal_calling && !$game_player.moving?
  2435.     end
  2436.   end
  2437.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2438.   # * Call Quest Journal
  2439.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2440.   def call_quest_journal
  2441.     @quest_journal_calling = false
  2442.     Sound.play_ok
  2443.     SceneManager.call(Scene_Quest)
  2444.   end
  2445. end
  2446.  
  2447. # Menu Access
  2448. if !$imported[:MA_InsertCommand]
  2449. # Initialize the Insertion Hash
  2450. MA_COMMAND_INSERTS = {}
  2451. MA_InsertableMenuCommand = Struct.new(:name, :index, :enable, :scene, :other)
  2452.  
  2453. #==============================================================================
  2454. # ** Game_System
  2455. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2456. #  Summary of Changes:
  2457. #    new public instance variable - maic_menu_commands
  2458. #    aliased method - initialize
  2459. #==============================================================================
  2460.  
  2461. class Game_System
  2462.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2463.   # * Inserted Menu Commands
  2464.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2465.   def maic_inserted_menu_commands
  2466.     # Lazy Instantiation so that old save files are not corrupted
  2467.     if !@maic_inserted_menu_commands
  2468.       @maic_inserted_menu_commands = MA_COMMAND_INSERTS.keys
  2469.       # Sort by index
  2470.       @maic_inserted_menu_commands.sort! { |a, b| MA_COMMAND_INSERTS[a].index <=> MA_COMMAND_INSERTS[b].index }
  2471.     end
  2472.     @maic_inserted_menu_commands
  2473.   end
  2474. end
  2475.  
  2476. #==============================================================================
  2477. # ** Window_MenuCommand
  2478. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2479. #  Summary of Changes:
  2480. #    aliased method - make_command_list; maic_insert_command
  2481. #==============================================================================
  2482.  
  2483. class Window_MenuCommand
  2484.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2485.   # * Make Command List
  2486.   #``````````````````````````````````````````````````````````````````````````
  2487.   #  I alias this method instead of add_original_commands because I need to
  2488.   # have all commands created before I can insert at the correct index
  2489.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2490.   alias maic_mkcmmndl_6yd2 make_command_list
  2491.   def make_command_list(*args, &block)
  2492.     maic_mkcmmndl_6yd2(*args, &block) # Run Original Method
  2493.     # Insert new commands
  2494.     $game_system.maic_inserted_menu_commands.each { |sym| maic_insert_command(sym) }
  2495.   end
  2496.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2497.   # * Insert Command
  2498.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2499.   def maic_insert_command(symbol)
  2500.     command = MA_COMMAND_INSERTS[symbol]
  2501.     # Get the command name
  2502.     name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
  2503.     # Check whether enabled
  2504.     enabled = case command.enable
  2505.     when Integer then command.enable == 0 ? true : $game_switches[command.enable]
  2506.     when String then eval(command.enable)
  2507.     when Symbol then self.send(command.enable)
  2508.     else
  2509.       enabled = true
  2510.     end
  2511.     # Add the command to the list
  2512.     add_command(name, symbol, enabled)
  2513.     added = @list.pop
  2514.     @list.insert([command.index, @list.size].min, added) # Insert at specific index
  2515.   end
  2516. end
  2517.  
  2518. #==============================================================================
  2519. # ** Scene_Menu
  2520. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2521. #  Summary of Changes:
  2522. #    aliased method - create_command_window; on_personal_ok
  2523. #    new methods - maic_set_insert_handler; maic_command_insert
  2524. #==============================================================================
  2525.  
  2526. class Scene_Menu
  2527.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2528.   # * Create Command Window
  2529.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2530.   alias maic_createcndwin_3ey7 create_command_window
  2531.   def create_command_window(*args, &block)
  2532.     maic_createcndwin_3ey7(*args, &block) # Run Original Method
  2533.     # Add handlers for all custom commands
  2534.     $game_system.maic_inserted_menu_commands.each { |symbol| maic_set_insert_handler(symbol) }
  2535.   end
  2536.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2537.   # * Set Inserted Handler
  2538.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2539.   def maic_set_insert_handler(symbol)
  2540.     other = MA_COMMAND_INSERTS[symbol].other
  2541.     handler = case other
  2542.     when Symbol then method(other)
  2543.     when String then lambda { eval(other) }
  2544.     when TrueClass then method(:command_personal)
  2545.     else
  2546.       handler = method(:maic_command_insert)
  2547.     end
  2548.     @command_window.set_handler(symbol, handler)
  2549.   end
  2550.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2551.   # * Custom Command
  2552.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2553.   def maic_command_insert
  2554.     SceneManager.call(Kernel.const_get(MA_COMMAND_INSERTS[@command_window.current_symbol].scene))
  2555.   end
  2556.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2557.   # * Personal OK
  2558.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2559.   alias maic_onpok_3ek9 on_personal_ok
  2560.   def on_personal_ok(*args, &block)
  2561.     if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
  2562.       maic_command_insert
  2563.     else
  2564.       maic_onpok_3ek9(*args, &block) # Run Original Method
  2565.     end
  2566.   end
  2567. end
  2568.  
  2569. $imported[:MA_InsertCommand] = true
  2570. end
  2571.  
  2572. MA_COMMAND_INSERTS[:quest_journal] =
  2573.   MA_InsertableMenuCommand.new(QuestData::VOCAB[:menu_label], QuestData::MENU_INDEX,
  2574.   "!$game_system.quest_access_disabled && !$game_party.quests.list.empty?",
  2575.   :Scene_Quest, false)




Lv4.逐梦者

梦石
2
星屑
3024
在线时间
398 小时
注册时间
2016-8-16
帖子
123

开拓者

2
 楼主| 发表于 2017-10-25 22:38:42 | 只看该作者
  1. module MissionInfo
  2.   AllMissionNum = 99
  3.   AllMission = Array.new
  4.   AllMission[1] = {
  5.       "icon_index" =>      0,
  6.       "name" => "",
  7.       "description" =>     "",
  8.       "level" => 3,
  9.       "objectives0" =>   "objectives",
  10.       "objectives1" =>   "objectives",
  11.       "objectives2" =>   "objectives",
  12.       "prime_objectives" => [0, 1, 2],
  13.       "client" =>          "",
  14.       "location" =>        "",
  15.       "common_event_id" => 0,
  16.       "custom_categories" => [],
  17.       "banner" => "",
  18.       "banner_hue" => 0,
  19.       "rewards" =>         [
  20.         [:item, 1, 3],
  21.         [:item, 4, 2],
  22.         [:gold, 150],
  23.         [:weapon, 1, 1]
  24.       ],
  25.       "layout" =>          false,
  26.       "haveget" =>         false,
  27.   }
复制代码

还有一个设定任务的,这个脚本靠翻译倒是可以看懂。另外,这个脚本还需要在Pictures文件夹下添加一个名为task_back的背景文件才可以正常使用。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
2
星屑
3024
在线时间
398 小时
注册时间
2016-8-16
帖子
123

开拓者

3
 楼主| 发表于 2017-10-25 22:44:02 | 只看该作者
emmmmmm……我能够申请管理员删帖么,我已经找到这个脚本的使用方法了……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 14:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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