jonathann972

Journal des quête

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