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

Project1

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

[已经过期] RPG Vx ace怎么设置任务系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
5 小时
注册时间
2017-7-28
帖子
8
跳转到指定楼层
1
发表于 2017-7-30 20:56:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求大神指点。就是那种到一个人接任务,比如杀几个怪,回去交任务,给东西那种。。急。。。谢谢{:2_249:}

点评

真的有心啊,东西真的不好发。我要走了,你再急要明天。除非现在我叫肉包大大来给你发  发表于 2017-7-30 21:10
我留言给你了,速度点行动。这边不好发,因为还得讲给你听怎么用。很麻烦,但很简单  发表于 2017-7-30 21:04
david_ng223 该用户已被删除
2
发表于 2017-7-30 21:10:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
3
发表于 2017-7-30 21:29:53 | 只看该作者
极度麻烦的做法,我这边有兼容性和画面很好的脚本,苦于他没有回应我,现在我请求肉包大大来发,不知道他有空没,肉包大大没空,那他得明天。有心发,脚本有一点难度,做个笔记秒记住。套一下就行。
先把注意点讲了,列表从0开始,但是召唤是1开始,0列表召唤用1来召唤
quest(1)接受0号任务。就是这样,皮肤画面可以游戏中随意改。他没有固定的
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
4
发表于 2017-7-31 09:47:10 | 只看该作者

  1. #任务Module by Harinlen

  2. =begin
  3. Notes:
  4. ·主线任务不会出现在任务板上
  5. ·出现在任务板上的任务描述超过14字的话记得换行~
  6. ·事件中调用任务时记得把任务编号-1
  7. ·在手册中的任务描述超过18字记得换行~
  8. =end

  9. module MissionInfo
  10.   AllMissionNum = 99
  11.   AllMission = Array.new
  12.   AllMission[1] = {
  13.       "icon_index" =>      0,
  14.       "name" => "饭粒任务",
  15.       "description" =>     "这是一个用来测试的范例任务请不要在意",
  16.       "level" => 3,
  17.       "objectives0" =>   "饭粒目标1",
  18.       "objectives1" =>   "饭粒目标2",
  19.       "objectives2" =>   "饭粒目标3",
  20.       "prime_objectives" => [0, 1, 2],
  21.       "client" =>          "不坑爹不舒服斯基",
  22.       "location" =>        "从前有座山",
  23.       "common_event_id" => 0,
  24.       "custom_categories" => [],
  25.       "banner" => "",
  26.       "banner_hue" => 0,
  27.       "rewards" =>         [
  28.         [:item, 1, 3],
  29.         [:item, 4, 2],
  30.         [:gold, 150],
  31.         [:weapon, 1, 1]
  32.       ],
  33.       "layout" =>          false,
  34.       "haveget" =>         false,
  35.   }
  36.   AllMission[2] = {
  37.       "icon_index" =>      0,
  38.       "name" => "消灭尸兽",
  39.       "description" =>     "消灭在沙尔顿山道上出现的狼型尸兽",
  40.       "level" => 3,
  41.       "objectives0" =>   "前往西北方向的山崖进行堵截",
  42.       "objectives1" =>   "消灭狼型尸兽",
  43.       "objectives2" =>   "向公会报告,领取委托奖励",
  44.       "prime_objectives" => [0, 1, 2],
  45.       "client" =>          "游侠公会",
  46.       "location" =>        "沙尔顿山道",
  47.       "common_event_id" => 0,
  48.       "rewards" =>         [
  49.         [:gold, 150],
  50.       ],
  51.       "layout" =>          false,
  52.       "haveget" =>         false,
  53.   }
  54.   AllMission[3] = {
  55.       "icon_index" =>      0,
  56.       "name" => "寻找斯卡雷特",
  57.       "description" =>     "在沙尔顿山上找到斯卡雷特",
  58.       "level" => 3,
  59.       "objectives0" =>   "从公会出发前往沙尔顿山道",
  60.       "objectives1" =>   "和维多利亚分头行动,去西边的崖底寻找
  61. 斯卡雷特",
  62.       "objectives2" =>   "前往艾维尼街道与维多利亚碰头",
  63.       "prime_objectives" => [0, 1, 2],
  64.       "client" =>          "无",
  65.       "location" =>        "沙尔顿山道",
  66.       "common_event_id" => 0,
  67.       "rewards" =>         [
  68.       ],
  69.       "layout" =>          false,
  70.       "haveget" =>         false,
  71.   }
  72.   AllMission[4] = {
  73.       "icon_index" =>      0,
  74.       "name" => "尸兽的调查",
  75.       "description" =>     "调查最近频繁涌现的尸兽事件",
  76.       "level" => 5,
  77.       "objectives0" =>   "前往瓦特哨岗询问目击尸兽的具体情况",
  78.       "objectives1" =>   "前往格林小村询问目击尸兽的具体情况",
  79.       "objectives2" =>   "前往瓦尔德森林进行调查",
  80.       "objectives3" =>   "前往兹伯莱古塔的守塔人小屋询问目击尸
  81. 兽的具体情况",
  82.       "objectives4" =>   "前往兹伯莱古塔塔顶进行调查",
  83.       "prime_objectives" => [0, 1, 2, 3, 4],
  84.       "client" =>          "游侠公会",
  85.       "location" =>        "斯坦因镇周边区域",
  86.       "common_event_id" => 0,
  87.       "rewards" =>         [
  88.       ],
  89.       "layout" =>          false,
  90.       "haveget" =>         false,
  91.   }
  92.   AllMission[5] = {
  93.       "icon_index" =>      0,
  94.       "name" => "冶锻素材的搜集",
  95.       "description" =>     "协助武器工房搜集冶锻素材",
  96.       "level" => 2,
  97.       "objectives0" =>   "前往武器工房询问委托详情",
  98.       "objectives1" =>   "搜集2枚野狼牙交给武器工房的斯塔尔",
  99.       "objectives2" =>   "向公会报告,领取委托奖励",
  100.       "prime_objectives" => [0, 1, 2],
  101.       "client" =>          "斯塔尔",
  102.       "location" =>        "斯坦因武器工房",
  103.       "common_event_id" => 0,
  104.       "rewards" =>         [
  105.        [:gold, 400],
  106.        [:exp, 200]
  107.       ],
  108.       "layout" =>          false,
  109.       "haveget" =>         false,
  110.   }
  111.   AllMission[6] = {
  112.       "icon_index" =>      0,
  113.       "name" => "制药素材的搜集",
  114.       "description" =>     "协助道具屋搜集制药素材",
  115.       "level" => 2,
  116.       "objectives0" =>   "前往道具屋询问委托详情",
  117.       "objectives1" =>   "搜集5份蜂蜡和1份甘草根交给道具屋的舒
  118. 皮尔",
  119.       "objectives2" =>   "向公会报告,领取委托奖励",
  120.       "prime_objectives" => [0, 1, 2],
  121.       "client" =>          "舒皮尔",
  122.       "location" =>        "斯坦因道具屋",
  123.       "common_event_id" => 0,
  124.       "rewards" =>         [
  125.        [:gold, 200],
  126.        [:exp, 250]
  127.       ],
  128.       "layout" =>          false,
  129.       "haveget" =>         false,
  130.   }
  131.   AllMission[7] = {
  132.       "icon_index" =>      0,
  133.       "name" => "采购的委托",
  134.       "description" =>     "前往格林小村采购一些食材",
  135.       "level" => 2,
  136.       "objectives0" =>   "前往斯坦因镇民居1芙劳处询问委托详情",
  137.       "objectives1" =>   "采购3份绿芹草和1份西兰鱼干交给芙劳",
  138.       "objectives2" =>   "向公会报告,领取委托奖励",
  139.       "prime_objectives" => [0, 1, 2],
  140.       "client" =>          "芙劳",
  141.       "location" =>        "斯坦因镇民居1",
  142.       "common_event_id" => 0,
  143.       "rewards" =>         [
  144.        [:gold, 200],
  145.        [:exp, 450]
  146.       ],
  147.       "layout" =>          false,
  148.       "haveget" =>         false,
  149.   }
  150.   AllMission[8] = {
  151.       "icon_index" =>      0,
  152.       "name" => "文件的递送",
  153.       "description" =>     "帮助斯坦因镇镇长递送文件",
  154.       "level" => 3,
  155.       "objectives0" =>   "前往斯坦因镇镇长思科勒处询问详情",
  156.       "objectives1" =>   "将纳税证明递送至斯坦因武器工房",
  157.       "objectives2" =>   "将纳税证明递送至斯坦因镇道具屋",
  158.       "objectives3" =>   "将纳税证明递送至斯坦旅馆",
  159.       "objectives4" =>   "将纳税证明递送至格林小村西兰杂货",
  160.       "objectives5" =>   "将纳税证明递送至格林小村湖滨栈",
  161.       "objectives6" =>   "返回斯坦因镇长思科勒处报告递送情况",
  162.       "objectives7" =>   "向公会报告,领取委托奖励",
  163.       "prime_objectives" => [0, 1, 2, 3, 4, 5, 6, 7],
  164.       "client" =>          "镇长思科勒",
  165.       "location" =>        "斯坦因镇镇长邸",
  166.       "common_event_id" => 0,
  167.       "rewards" =>         [
  168.        [:gold, 600],
  169.        [:exp, 750]
  170.       ],
  171.       "layout" =>          false,
  172.       "haveget" =>         false,
  173.   }
  174.   AllMission[9] = {
  175.       "icon_index" =>      0,
  176.       "name" => "失窃的宝石",
  177.       "description" =>     "寻找失窃的宝石",
  178.       "level" => 3,
  179.       "objectives0" =>   "前往格林小村村长鲍尔处询问委托详情",
  180.       "objectives1" =>   "根据犯人留下的提示找到宝石并交还给鲍
  181. 尔村长",
  182.       "objectives2" =>   "向公会报告,领取委托奖励",
  183.       "prime_objectives" => [0, 1, 2],
  184.       "client" =>          "村长鲍尔",
  185.       "location" =>        "格林小村村长家",
  186.       "common_event_id" => 0,
  187.       "rewards" =>         [
  188.        [:gold, 450],
  189.        [:exp, 600],
  190.        [:armor, 39, 1]
  191.       ],
  192.       "layout" =>          false,
  193.       "haveget" =>         false,
  194.   }
  195.   AllMission[10] = {
  196.       "icon_index" =>      0,
  197.       "name" => "古塔的调查",
  198.       "description" =>     "协助调查兹伯莱古塔的情况",
  199.       "level" => 2,
  200.       "objectives0" =>   "前往斯坦因镇镇长邸西泽金处询问详情",
  201.       "objectives1" =>   "前往兹伯莱古塔调查古塔内部的情况",
  202.       "objectives2" =>   "向西泽金汇报调查结果",
  203.       "objectives3" =>   "向公会报告,领取委托奖励",
  204.       "prime_objectives" => [0, 1, 2, 3],
  205.       "client" =>          "斯坦因镇镇长邸西泽金",
  206.       "location" =>        "斯坦因镇镇长邸",
  207.       "common_event_id" => 0,
  208.       "rewards" =>         [
  209.        [:gold, 750],
  210.        [:exp, 350],
  211.       ],
  212.       "layout" =>          false,
  213.       "haveget" =>         false,
  214.   }
  215.   AllMission[11] = {
  216.       "icon_index" =>      0,
  217.       "name" => "食材的收集",
  218.       "description" =>     "帮助斯坦因旅馆收集食材",
  219.       "level" => 3,
  220.       "objectives0" =>   "前往斯坦因旅馆前台询问委托详情",
  221.       "objectives1" =>   "收集红溶液,琥珀浆和苦麻叶各2份交给
  222. 旅馆老板",
  223.       "objectives2" =>   "向公会报告,领取委托奖励",
  224.       "prime_objectives" => [0, 1, 2],
  225.       "client" =>          "斯坦因旅馆",
  226.       "location" =>        "斯坦因旅馆",
  227.       "common_event_id" => 0,
  228.       "rewards" =>         [
  229.        [:gold, 1500],
  230.        [:exp, 650],
  231.       ],
  232.       "layout" =>          false,
  233.       "haveget" =>         false,
  234.   }
  235.   AllMission[12] = {
  236.       "icon_index" =>      0,
  237.       "name" => "通缉的野兽",
  238.       "description" =>     "消灭布拉特街道通缉的野兽",
  239.       "level" => 2,
  240.       "objectives0" =>   "消灭在布拉特街道北部聚集的野兽",
  241.       "objectives1" =>   "向公会报告,领取委托奖励",
  242.       "prime_objectives" => [0, 1],
  243.       "client" =>          "斯坦因游侠公会",
  244.       "location" =>        "斯坦因游侠公会",
  245.       "common_event_id" => 0,
  246.       "rewards" =>         [
  247.        [:gold, 800],
  248.        [:exp, 350],
  249.       ],
  250.       "layout" =>          false,
  251.       "haveget" =>         false,
  252.   }
  253.   AllMission[13] = {
  254.       "icon_index" =>      0,
  255.       "name" => "失踪的村民",
  256.       "description" =>     "寻找行踪不明的村民",
  257.       "level" => 5,
  258.       "objectives0" =>   "前往格林小村村长处询问详情",
  259.       "objectives1" =>   "在格林小村内收集失踪村民的情报",
  260.       "objectives2" =>   "前往沙尔顿山脉调查",
  261.       "prime_objectives" => [0, 1, 2],
  262.       "client" =>          "格林小村村长",
  263.       "location" =>        "格林小村",
  264.       "common_event_id" => 0,
  265.       "rewards" =>         [
  266.        [:gold, 1500],
  267.        [:exp, 1000],
  268.       ],
  269.       "layout" =>          false,
  270.       "haveget" =>         false,
  271.   }
  272. end
复制代码

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

  220. $imported ||= {}
  221. $imported[:"MA_QuestJournal_1.0"] = true

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

  227. module QuestData
  228.   #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  229.   #  BEGIN Editable Region A
  230.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  231.   #  MENU_ACCESS - If true, you can access the quest journal through a command
  232.   # in the menu. If false, there will be no such command.
  233.   MENU_ACCESS = true
  234.   #  MENU_INDEX - If MENU_ACCESS is true, this determines where it appears
  235.   MENU_INDEX = 4
  236.   #  MAP_ACCESS - If true, this allows you to access the quest journal by
  237.   # pressing a key on the map.
  238.   MAP_ACCESS = true
  239.   #  MAP_BUTTON - If MAP_ACCESS is true, this determines which button calls the
  240.   # Quest Journal
  241.   MAP_BUTTON = :L
  242.   #  OPEN_TO_LAST_REVEALED_QUEST - If true, then the first time you open the
  243.   # quest journal after revealing a new quest, it will open to the new quest.
  244.   OPEN_TO_LAST_REVEALED_QUEST = true
  245.   #  OPEN_TO_LAST_CHANGED_QUEST - If true, then the Quest Journal will open to
  246.   # the last quest whose objective status has changed.
  247.   OPEN_TO_LAST_CHANGED_QUEST = false
  248.   #  LIST_WINDOW_WIDTH - The width, in pixels, of the List Window
  249.   LIST_WINDOW_WIDTH = 192
  250.   #  BASIC_DATA_TYPES  - This lets you set up additional types of data. Just
  251.   # include an identifying signal in the Array. Then, you will need to give
  252.   # each signal an icon (in the ICONS hash at line 322) and a signal text (in
  253.   # the VOCAB array at line 333, though it can be an empty string). Then, you
  254.   # can set the data itself when setting up quests by simply adding a:
  255.   #    q[:symbol] = ""
  256.   # line to the quest. You will also need to include the data type somewhere in
  257.   # the DATA_LAYOUT at line 306. As an example of this, I have included :client
  258.   # and :location by default. You can CTRL+F for anything in this section with
  259.   # one of those symbols (excluding :) and you will there need to add something
  260.   # for any new data types you add.
  261.   BASIC_DATA_TYPES = [:client, :location]
  262.   #  BASIC_DATA_WIDTH - This determines how much room, in pixels, is given to  
  263.   # any basic data types you set up in the data window.
  264.   BASIC_DATA_WIDTH = 240
  265.   #  CONCURRENT_ACTIVITY - If true, then when in the Quest Journal scene, you
  266.   # can switch categories or scroll down the quest list at the same time. If
  267.   # false, you will first need to select a category before you can start
  268.   # scrolling through the quest list.
  269.   CONCURRENT_ACTIVITY = true
  270.   #  HIDE_CATEGORY_CURSOR - If true, then the Category Window will not have a
  271.   # cursor and will instead just highlight the currently selected category.
  272.   # This is best when CONCURRENT_ACTIVITY is true.
  273.   HIDE_CATEGORY_CURSOR = true
  274.   #  SHOW_QUEST_ICONS - If true, then the icon you choose for each quest will
  275.   # be displayed to the left of its name in the Quest List window
  276.   SHOW_QUEST_ICONS = false#true
  277.   #  MANUAL_REVEAL - If false, then quests will be revealed the moment you
  278.   # first reveal, complete, or fail an objective. If this is true, you will
  279.   # need to specifically reveal each quest via a separate script call:
  280.   #    reveal_quest(quest_id)
  281.   MANUAL_REVEAL = false
  282.   #  DATA_LAYOUT - This controls the way that the quest window lays out all of
  283.   # the relevant data. If you set one of the entries to be an array, then any
  284.   # of the commands there will be drawn at the same y. With exception to :line,
  285.   # none of the commands will be drawn if the quest is not set to have that
  286.   # particular data. The symbols are:
  287.   #    :line        - Draws a horizontal line across the window.
  288.   #    :name        - Draws the name of the quest
  289.   #    :level       - Draws the level of the quest
  290.   #    :banner      - Draws the banner for the quest
  291.   #    :client      - Draws the client set in the quest   (basic data)
  292.   #    :location    - Draws the location set in the quest (basic data)
  293.   #    :description - Draws the quest's description
  294.   #    :objectives  - Draws all the quest's objectives that have been revealed
  295.   #    :rewards     - Draws whatever rewards have been set
  296.   #
  297.   # You will also need to add an entry for any new BASIC_DATA that you place
  298.   # in BASIC_DATA_TYPES at line 264.
  299.   #
  300.   # Remember to place a comma after each entry. Also note that this is only the
  301.   # default layout. You can set a different layout for any quest, and when
  302.   # viewing that quest, it will be the custom layout that is shown.
  303.   DATA_LAYOUT = [
  304.     [:line, :name, :level],
  305.     :banner,
  306.     :client,
  307.     :location,
  308.     :description,
  309.     :objectives,
  310.     [:line, :rewards],
  311.     :line,
  312.   ] # <= Do not touch.
  313.   #  ICONS - This is where you setup many of the icons used in the script. The
  314.   # purpose of each is listed next to it. Also, if you make any custom
  315.   # categories, you NEED to give them an icon by placing a line like the
  316.   # others. So, if the new custom category is :romance then you would need to
  317.   # set it like this:
  318.   #    romance:     107,
  319.   ICONS = {
  320.     all:         319,
  321.     active:      381,
  322.     complete:    326,
  323.     failed:      383,
  324.     client:      396,
  325.     location:    314,
  326.     reward_gold: 323,
  327.     reward_exp:  322,
  328.   } # <= Do not touch.
  329.   #  VOCAB - This lets you choose some of the words used in the quest scene
  330.   VOCAB = {
  331.     # menu_label:  The command name in the menu if MENU_ACCESS is true
  332.     menu_label:       "手册",
  333.     # scene_label: The label at the top of the scene. If empty, no window
  334.     scene_label:      " ",
  335.     # description: The heading to identify the description
  336.     description:      "委托描述",
  337.     # objectives: The heading to identify the objectives
  338.     objectives:       "记录",
  339.     # objective_bullet: The bullet which shows up to the left of every
  340.     #  objective. If %d is included, it shows the objective's ID.
  341.     objective_bullet: "·",
  342.     # rewards: The heading to identify the rewards.
  343.     rewards:          "委托奖励",
  344.     # reward_amount: For item rewards, this is the text to show the amount.
  345.     #  It should include %d to show the amount.
  346.     reward_amount:    "x%d",
  347.     # reward_gold: Text to identify gold rewards
  348.     reward_gold:      "金",
  349.     # reward_exp: Text to identify exp rewards
  350.     reward_exp:       "经验",
  351.     # level: If LEVEL_ICON is 0, this is the text which precedes the level
  352.     level:            "等级: ",
  353.     # location: The text label for quest location
  354.     location:         "",
  355.     # location: The text label for quest client
  356.     client:           "",
  357.   } # <= Do not touch.
  358.   #  CATEGORIES - This array allows you to set which categories are available
  359.   # in the Quest scene. The default categories are :all, :active, :complete,
  360.   # and :failed, and their names are self-explanatory. You can add custom
  361.   # categories as well, but note that you will need to make sure that each new
  362.   # category has an icon set in the ICONS hash, as well as a label set in the
  363.   # CATEGORY_VOCAB hash (if you are using SHOW_CATEGORY_LABEL). It is also
  364.   # advisable to give it a sort type, unless you are fine with it being sorted
  365.   # by ID, as is default.
  366.   CATEGORIES = [:all, :active, :complete, :failed]
  367.   #  SHOW_CATEGORY_LABEL - This allows you to choose whether to show the name
  368.   # of the currently selected category. If true, it will choose the name out
  369.   # of the CATEGORY_VOCAB hash.
  370.   SHOW_CATEGORY_LABEL = true
  371.   #  CATEGORY_LABEL_IN_SAME_WINDOW - If SHOW_CATEGORY_LABEL is true, then this
  372.   # options lets you choose whether the label is shown in the same window as
  373.   # the category icons or in a separate window below. true = same window.
  374.   CATEGORY_LABEL_IN_SAME_WINDOW = true
  375.   #  CATEGORY_VOCAB - If SHOW_CATEGORY_LABEL is true, this hash lets you set the
  376.   # label for each category. For any custom categories you create, you will
  377.   # need to add a line for each below and in the same format:
  378.   #    :category => "Label",
  379.   # Don't forget to add the comma at the end of each line.
  380.   CATEGORY_VOCAB = {
  381.     :all =>      "全部委托",      # The label for the :all category
  382.     :active =>   "进行中",   # The label for the :active category
  383.     :complete => "已完成", # The label for the :complete category
  384.     :failed =>   "已过期",   # The label for the :failed category
  385.   } # <= Do not touch.
  386.   #  SORT_TYPE - This hash allows you to choose how each category is sorted.
  387.   # For each category, default or custom, you can set a different sort method
  388.   # There are seven options to choose from:
  389.   #    :id - The quests are sorted from lowest to highest ID
  390.   #    :alphabet - The quests are sorted in alphabetical order
  391.   #    :level - The quests are sorted from the lowest to highest level
  392.   #    :reveal - The quests are sorted from most recently revealed on.
  393.   #            Every time a new quest is revealed, it will be at the top.
  394.   #    :change - The quests are sorted from the one whose status most recently
  395.   #            changed on. So, every time an objective is modified, that quest
  396.   #            will be thrown to the top.
  397.   #    :complete - The quests are sorted from the most recently completed on.
  398.   #            Every time a quest is completed, it will be thrown to the top.
  399.   #    :failed - The quests are sorted from the most recently failed on.
  400.   #            Every time a quest is failed, it will be thrown to the top.
  401.   #
  402.   # Additionally, you can put _r at the end of any of the sort options and it
  403.   # will reverse the order. So, for instance, if the sort method for a category
  404.   # is :alphabet_r, then the quests will show up from Z-A
  405.   SORT_TYPE = {
  406.     :all =>      :id,       # Sort type for the All Quests category
  407.     :active =>   :change,   # Sort type for the Active Quests category
  408.     :complete => :complete, # Sort type for the Complete Quests category
  409.     :failed =>   :failed,   # Sort type for the Failed Quests category
  410.   } # <= Do not touch.
  411.   #  WINDOWSKIN - The windowskin for each window in the Quest scene. It must
  412.   # refer to a graphic in the System folder of Graphics. If set to false, then
  413.   # it will use whatever windowskin is default. If you are using a script which
  414.   # lets the player choose the windowskin, false is the recommended value.
  415.   WINDOWSKIN = false
  416.   #  WINDOW_TONE - The tone for each window. It must be an array in the form:
  417.   #      WINDOW_TONE = [red, green, blue, gray]
  418.   # gray can be excluded, but the other three must be present. If you set this
  419.   # value to false, then the windows will have whatever tone is default.
  420.   WINDOW_TONE = false
  421.   #  WINDOW_OPACITY - The opacity of the windows in the Quest scene. If set to
  422.   # false, it will use the default opacity for windows.
  423.   WINDOW_OPACITY = false
  424.   #  BG_PICTURE - This is a string referring to a picture in the Picture folder
  425.   # of Graphics. If set to "", then there will be no picture. Otherwise, it
  426.   # will display the selected picture below the windows but above the map in
  427.   # the Quest scene.
  428.   BG_PICTURE = "task_back"
  429.   #  BG_OPACITY - This allows you to set the opacity of the background picture,
  430.   # if you have selected one.
  431.   BG_OPACITY = 255
  432.   #  BG_BLEND_TYPE - This allows you to set the blend type of the background
  433.   # picture, if you have selected one.
  434.   BG_BLEND_TYPE = 0
  435.   #  DESCRIPTION_IN_BOX - This is a graphical option, and it allows you to
  436.   # choose whether the description should be shown in a box.
  437.   DESCRIPTION_IN_BOX = true
  438.   #  LEVEL_ICON - This sets how levels are shown. If set to an integer, then it
  439.   # will draw the same icon numerous times up to the level of the quest. Ie. If
  440.   # the level's quest is 1, then the icon will only be drawn once, but if the
  441.   # level's quest is 4, it will be drawn 4 times. LEVEL_ICONS_SPACE determines
  442.   # the space between them. If you set LEVEL_ICON to 0, however, then it will
  443.   # instead draw a signal for the level, corresponding to that index in the
  444.   # LEVEL_SIGNALS array. If the LEVEL_SIGNALS array is empty, then it will just
  445.   # draw the integer for the level. Finally, LEVEL_ICON can also be an array of
  446.   # integers, in which case the level will be represented only by the icon set
  447.   # which corresponds to it in the array.
  448.   LEVEL_ICON = 125
  449.   #  LEVEL_ICONS_SPACE - If LEVEL_ICON is an integer, this is the amount of
  450.   # space between each time the icon is drawn.
  451.   LEVEL_ICONS_SPACE = 16
  452.   #  LEVEL_SIGNALS - If LEVEL_ICON is 0, this allows you to set what string
  453.   # should be the signal for each level. If this array is empty, then it will
  454.   # just draw the level integer. Ie. if the Quest is Level 4, it will draw 4.
  455.   LEVEL_SIGNALS = ["F", "E", "D", "C", "B", "A", "S"]
  456.   #  COLOURS - This lets you change the colour for various aspects of the
  457.   # quest scene. Each can be set in one of three ways:
  458.   #    :symbol - If you use a symbol, the colour will be the result of calling
  459.   #      the method of the same name. For instance, if you set something to
  460.   #      :system_color, it will set the colour to the result of the Window_Base
  461.   #      system_color method.
  462.   #    Integer - If you set the colour to an integer, then it will take its
  463.   #      colour from the windowskin palette, just like using \c[x] in messages.
  464.   #    Array - You can also set the rgba values directly with an array in the
  465.   #      format: [red, green, blue, alpha]. alpha can be excluded, but you must
  466.   #      have values for red, green, and blue.
  467.   COLOURS = {
  468.     # active: This sets the colour for active quests in the list and the name
  469.     #  of the active quest when shown in the data window.
  470.     active:           :normal_color,
  471.     # complete: This sets the colour for complete quests in the list and the
  472.     #  name of the complete quest when shown in the data window.
  473.     complete:         4,
  474.     # failed: This sets the colour for failed quests in the list and the name
  475.     #  of the failed quest when shown in the data window.
  476.     failed:           8,
  477.     # line:  This sets the colour for lines or boxes drawn in the quest scene
  478.     line:             :normal_color,
  479.     # line_shadow:  This sets the colour of the shadow for lines or boxes drawn
  480.     #  in the quest scene
  481.     line_shadow: [0, 0, 0, 128],
  482.     # scene_label: This sets the colour for the scene label, if shown
  483.     scene_label:      6,#:system_color,
  484.     # category_label: This sets the colour for the category label, if shown
  485.     category_label:   :normal_color,
  486.     # level_signal: This sets the colour for the level signal, if shown
  487.     level_signal:     :normal_color,
  488.     # objective_bullet: This sets the colour for objectives; if set to
  489.     #  :maqj_objective_color, it will reflect the completion status of the
  490.     #  objective, but you can change it to something else if you prefer
  491.     objective_bullet: :maqj_objective_color,
  492.     # reward_amount: The colour of the item amount, when shown
  493.     reward_amount:    :normal_color,
  494.     # heading: The colour of any headings in the script, like "Description"
  495.     heading:          6,#:system_color,
  496.     # basic_label: For basic data, like client, the colour of the label
  497.     basic_label:      6,#:system_color,
  498.     # basic_value: For basic data, like client, the colour of the value
  499.     basic_value:      :normal_color,
  500.   } # <= Do not touch.
  501.   #  HEADING_ALIGN - This sets the alignment for the aspects listed. 0 is Left;
  502.   # 1 is Centre; 2 is Right
  503.   HEADING_ALIGN = {
  504.     description: 0, # Alignment for the Description heading
  505.     objectives:  0, # Alignment for the Objectives heading
  506.     rewards:     1, # Alignment for the Rewards heading
  507.     level:       2  # Alignment when showing the level
  508.   } # <= Do not touch.
  509.   #````````````````````````````````````````````````````````````````````````````
  510.   #    Font Aspects
  511.   #
  512.   #  All of the following options (FONTNAMES, FONTSIZES, FONTBOLDS, and
  513.   # FONTITALICS) allow you to alter the fonts used for various aspects of the
  514.   # scene. The only one listed there by default is normal:, which is the
  515.   # font used by default for the entire scene. However, you can change the  
  516.   # fonts for almost any aspect - all you need to do is add a line like so:
  517.   #
  518.   #    description: value,
  519.   #
  520.   # and that will change that font aspect when drawing the description. The
  521.   # following symbols are available for changing:
  522.   #
  523.   #   normal:         The default font used for every part of the scene
  524.   #   list:           The font used in the List Window
  525.   #   scene_label:    The font used when drawing the Scene Label, if shown
  526.   #   category_label: The font used when drawing the Category Label, if shown
  527.   #   heading:        The font used when drawing any headings, like "Description"
  528.   #   name:           The font used when drawing the quest name in data window
  529.   #   description:    The font used when drawing the Description
  530.   #   objectives:     The font used when drawing the objectives
  531.   #   rewards:        The font used when drawing the rewards
  532.   #   client:         The font used when drawing the client
  533.   #   location:       The font used when drawing the location
  534.   #
  535.   # For any of them, you need to set a value. What the value can be depends
  536.   # on which font aspect you are changing and is described below, but for any
  537.   # of them setting it to the false will mean it will simply use the default
  538.   #
  539.   # For any that you add, remember that you must put a comma after the value.
  540.   #````````````````````````````````````````````````````````````````````````````
  541.   #  FONTNAMES - Here you can change the font used for any of the various
  542.   # options. It can take any of the following types of values:
  543.   #     false    - The default font will be used
  544.   #     "String" - The font with the name "String" will be used.
  545.   #     [Array]  - The array must be in the form: ["String1", "String2", ...]
  546.   #               The font used will be the first one in the array that the
  547.   #               player has installed.
  548.   #
  549.   #  EXAMPLES:
  550.   #
  551.   #    normal:      false,
  552.   #      The font used for unaltered aspects of the scene is the default font
  553.   #    scene_label: "Algerian",
  554.   #      The font used for the Scene Label will be Algerian.
  555.   #    description: ["Cambria", "Times New Roman"],
  556.   #      The font used when drawing the description will be Cambria if the
  557.   #      player has Cambria installed. If the player does not have Cambria
  558.   #      installed, then the font used will be Times New Roman
  559.   FONTNAMES = {
  560.     normal: false, # normal: the default font name
  561.   } # <= Do not touch.
  562.   #  FONTSIZES - Here you can change the size of the font. There are two types
  563.   # of values you can set:
  564.   #    false   - The default fontsize will be used
  565.   #    Integer - The fontsize will be equal to the value of the Integer.
  566.   #  
  567.   # For everything but the label windows, this shouldn't exceed 24, since that
  568.   # is the line_height. However, for scene_label: and category_label:, the size
  569.   # of the window will be adjusted to whatever size you set the font.
  570.   FONTSIZES = {
  571.     normal:         false, # normal: default font size
  572.     scene_label:    16,#28,    # scene_label: fontsize for the Scene Label window
  573.     category_label: 16,#24,    # category_label: fontsize for Category Label window
  574.   } # <= Do not touch.
  575.   #  FONTBOLDS - Here you can set whether the font will be bolded. You can set
  576.   # it to either false, in which case it will not be bolded, or true, in which
  577.   # case it will be bolded.
  578.   FONTBOLDS = {
  579.     scene_label:  true, # scene_label: whether font is bold for Scene Label
  580.     heading:      true, # heading: whether font is bold for the headings
  581.     level_signal: true, # level_signal: whether font is bold for level
  582.   } # <= Do not touch.
  583.   #  FONTITALICS - Here you can set whether the font will be italicized. You
  584.   # can set it to either false, in which case it will not be italicized, or
  585.   # true, in which case it will be italicized.
  586.   FONTITALICS = {
  587.   }
  588.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  589.   #  END Editable Region A
  590.   #//////////////////////////////////////////////////////////////////////////
  591.   CATEGORIES = [:all] if !CATEGORIES || CATEGORIES.empty?
  592.   VOCAB.default = ""
  593.   ICONS.default = 0
  594.   CATEGORY_VOCAB.default = ""
  595.   SORT_TYPE.default = :id
  596.   COLOURS.default = :normal_color
  597.   HEADING_ALIGN.default = 0
  598.   FONTNAMES.default = false
  599.   FONTSIZES.default = false
  600.   FONTBOLDS.default = false
  601.   FONTITALICS.default = false
  602.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  603.   # * Setup Quest
  604.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  605.   def self.setup_quest(quest_id)
  606.     q = { objectives: [] }
  607.       q[:name]              = MissionInfo::AllMission[quest_id + 1]["name"]
  608.       q[:level]             = MissionInfo::AllMission[quest_id + 1]["level"]
  609.       q[:icon_index]        = MissionInfo::AllMission[quest_id + 1]["icon_index"]
  610.       q[:description]       = MissionInfo::AllMission[quest_id + 1]["description"]
  611.       for i in 0..15
  612.         obj_name = "objectives" + i.to_s
  613.         q[:objectives][i]     = MissionInfo::AllMission[quest_id + 1][obj_name]
  614.       end
  615.       q[:prime_objectives]  = MissionInfo::AllMission[quest_id + 1]["prime_objectives"]
  616.       q[:custom_categories] = MissionInfo::AllMission[quest_id + 1]["custom_categories"]
  617.       q[:banner]            = MissionInfo::AllMission[quest_id + 1]["banner"]
  618.       q[:banner_hue]        = MissionInfo::AllMission[quest_id + 1]["banner_hue"]
  619.       q[:client]            = MissionInfo::AllMission[quest_id + 1]["client"]
  620.       q[:location]          = MissionInfo::AllMission[quest_id + 1]["location"]
  621.       q[:common_event_id]   = MissionInfo::AllMission[quest_id + 1]["common_event_id"]
  622.       q[:rewards]           = MissionInfo::AllMission[quest_id + 1]["rewards"]
  623.       q[:layout]            = MissionInfo::AllMission[quest_id + 1]["layout"]
  624.     q
  625.   end
  626. end

  627. #==============================================================================
  628. # *** DataManager
  629. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  630. #  Summary of Changes:
  631. #    aliased method - self.extract_save_contents
  632. #==============================================================================

  633. class << DataManager
  634.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  635.   # * Extract Save Contents
  636.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  637.   alias maqj_extractsavecons_2kw5 extract_save_contents
  638.   def extract_save_contents(*args, &block)
  639.     maqj_extractsavecons_2kw5(*args, &block) # Call Original Method
  640.     if $game_party.quests.nil?
  641.       $game_party.init_maqj_data
  642.       $game_system.init_maqj_data
  643.     end
  644.   end
  645. end

  646. #==============================================================================
  647. # ** MAQJ_SortedArray
  648. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  649. #  This module mixes in to an array to maintain the sorted order when inserting
  650. #==============================================================================

  651. module MAQJ_SortedArray
  652.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  653.   # * Insert to Array
  654.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  655.   def maqj_insert_sort(el, &block)
  656.     index = bsearch_index(el, 0, size, &block)
  657.     index ? insert(index, el) : push(el)
  658.   end
  659.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  660.   # * Retrieve Index from Binary Search
  661.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  662.   def bsearch_index(el, b = 0, e = size, &block)
  663.     return bsearch_index(el, b, e) { |a,b| a <=> b } if block.nil?
  664.     return b if b == e # Return the discovered insertion index
  665.     return if b > e
  666.     m = (b + e) / 2    # Get Middle
  667.     block.call(el, self[m]) > 0 ? b = m + 1 : e = m
  668.     bsearch_index(el, b, e, &block)
  669.   end
  670. end

  671. #==============================================================================
  672. # ** Game_Quest
  673. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  674. #  This class holds all instance data for a quest
  675. #==============================================================================

  676. class Game_Quest
  677.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  678.   # * Public Instance Variables
  679.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  680.   attr_reader   :id                  # Unique identifier for this quest
  681.   attr_reader   :name                # The name to be shown for the quest
  682.   attr_reader   :level               # The level of difficulty of the quest
  683.   attr_reader   :objectives          # An array of objective strings
  684.   attr_reader   :prime_objectives    # An array of crucial objective IDs
  685.   attr_reader   :revealed_objectives # An array of revealed objective IDs
  686.   attr_reader   :complete_objectives # An array of completed objective IDs
  687.   attr_reader   :failed_objectives   # An array of failed objective IDs
  688.   attr_reader   :custom_categories   # An array of category symbols
  689.   attr_accessor :icon_index          # Icon associated with this quest
  690.   attr_accessor :common_event_id     # ID of common event to call upon complete
  691.   attr_accessor :description         # The description for the quest
  692.   attr_accessor :banner              # Picture shown to represent the quest
  693.   attr_accessor :banner_hue          # The hue of the banner
  694.   attr_accessor :layout              # The layout of this quest in scene
  695.   attr_accessor :rewards             # An array of rewards to show
  696.   attr_accessor :reward_given        # Boolean tracking if quest was rewarded
  697.   attr_accessor :concealed           # Whether or not the quest is visible
  698.   attr_accessor :manual_status       # Quest status if not using prime objectives
  699.   QuestData::BASIC_DATA_TYPES.each { |data_type| attr_accessor(data_type) }
  700.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  701.   # * Object Initialization
  702.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  703.   def initialize(quest_id)
  704.     @id = quest_id
  705.     @concealed = default_value_for(:concealed)
  706.     @reward_given = default_value_for(:reward_given)
  707.     reset
  708.   end
  709.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  710.   # * Reset
  711.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  712.   def reset
  713.     data = QuestData.setup_quest(@id)
  714.     data_symbol_array.each { |meth| instance_variable_set(:"@#{meth}",
  715.       data[meth] ? data[meth] : default_value_for(meth)) }
  716.     @revealed_objectives = [].send(:extend, MAQJ_SortedArray)
  717.     @complete_objectives = [].send(:extend, MAQJ_SortedArray)
  718.     @failed_objectives =   [].send(:extend, MAQJ_SortedArray)
  719.     @manual_status = default_value_for(:manual_status)
  720.   end
  721.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  722.   # * Data Symbol Array
  723.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  724.   def data_symbol_array
  725.     [:name, :level, :objectives, :prime_objectives, :custom_categories,
  726.       :icon_index, :description, :banner, :banner_hue, :common_event_id,
  727.       :layout, :rewards] + QuestData::BASIC_DATA_TYPES
  728.   end
  729.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  730.   # * Default Value
  731.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  732.   def default_value_for(method)
  733.     case method
  734.     when :name then "??????"
  735.     when :description, :banner then ""
  736.     when :level, :banner_hue, :icon_index, :common_event_id then 0
  737.     when :objectives, :rewards, :custom_categories then []
  738.     when :prime_objectives then Array.new(objectives.size) { |x| x }
  739.     when :concealed then QuestData::MANUAL_REVEAL
  740.     when :manual_status then :active
  741.     when :layout, :reward_given then false
  742.     else ""
  743.     end
  744.   end
  745.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  746.   # * Reveal/Conceal Objective
  747.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  748.   def reveal_objective(*obj)
  749.     valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }
  750.     valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }
  751.     quest_status_changed unless valid_obj.empty?
  752.   end
  753.   def conceal_objective(*obj)
  754.     quest_status_changed unless (obj & @revealed_objectives).empty?
  755.     obj.each { |obj_id| @revealed_objectives.delete(obj_id) }
  756.   end
  757.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  758.   # * Complete/Uncomplete Objective
  759.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  760.   def complete_objective(*obj)
  761.     valid_obj = obj.select {|x| x < objectives.size && !@complete_objectives.include?(x) }
  762.     reveal_objective(*valid_obj)
  763.     unfail_objective(*valid_obj)
  764.     was_complete = status?(:complete)
  765.     valid_obj.each {|i| @complete_objectives.maqj_insert_sort(i) }
  766.     quest_status_changed unless valid_obj.empty?
  767.     # If just completed
  768.     if status?(:complete) && !was_complete
  769.       $game_temp.reserve_common_event(common_event_id)
  770.       $game_party.quests.add_to_sort_array(:complete, @id)
  771.     end
  772.   end
  773.   def uncomplete_objective(*obj)
  774.     quest_status_changed unless (obj & @complete_objectives).empty?
  775.     obj.each { |obj_id| @complete_objectives.delete(obj_id) }
  776.   end
  777.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  778.   # * Fail/Unfail Objective
  779.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  780.   def fail_objective(*obj)
  781.     valid_obj = obj.select {|x| x < objectives.size && !@failed_objectives.include?(x) }
  782.     reveal_objective(*valid_obj)
  783.     uncomplete_objective(*valid_obj)
  784.     was_failed = status?(:failed)
  785.     valid_obj.each {|i| @failed_objectives.maqj_insert_sort(i) }
  786.     quest_status_changed unless valid_obj.empty?
  787.     $game_party.quests.add_to_sort_array(:failed, @id) if status?(:failed) && !was_failed
  788.   end
  789.   def unfail_objective(*obj)
  790.     quest_status_changed unless (obj & @failed_objectives).empty?
  791.     obj.each { |obj_id| @failed_objectives.delete(obj_id) }
  792.   end
  793.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  794.   # * Updates when the quest status has been changed
  795.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  796.   def quest_status_changed
  797.     $game_party.quests.add_to_sort_array(:change, @id)
  798.     $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST
  799.   end
  800.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  801.   # * Objective Status?
  802.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  803.   def objective_status?(status_check, *obj)
  804.     return false if obj.empty?
  805.     case status_check
  806.     when :failed   then !(obj & @failed_objectives).empty?
  807.     when :complete then obj.size == (obj & @complete_objectives).size
  808.     when :revealed then obj.size == (obj & @revealed_objectives).size
  809.     when :active then objective_status?(:revealed, *obj) &&
  810.       !objective_status?(:complete, *obj) && !objective_status?(:failed, *obj)
  811.     end
  812.   end
  813.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  814.   # * Status?
  815.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  816.   def status?(status_check)
  817.     case status_check
  818.     when :failed  
  819.       @prime_objectives.empty? ? @manual_status == :failed :
  820.         !(@failed_objectives & @prime_objectives).empty?
  821.     when :complete
  822.       @prime_objectives.empty? ? @manual_status == :complete : !status?(:failed) &&
  823.         ((@prime_objectives & @complete_objectives) == @prime_objectives)
  824.     when :active then !concealed && !status?(:complete) && !status?(:failed)
  825.     when :reward then @reward_given
  826.     end
  827.   end
  828.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  829.   # * Set Name
  830.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831.   def name=(new_name)
  832.     @name = new_name
  833.     $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party &&
  834.       $game_party.quests
  835.   end
  836.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  837.   # * Set Level
  838.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  839.   def level=(new_lvl)
  840.     @level = new_lvl
  841.     $game_party.quests.add_to_sort_array(:level, @id) if $game_party &&
  842.       $game_party.quests
  843.   end
  844. end

  845. #==============================================================================
  846. # ** Game_Quests
  847. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  848. #  This is a wrapper for an array holding Game_Quest objects
  849. #==============================================================================

  850. class Game_Quests
  851.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  852.   # * Object Initialization
  853.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  854.   def initialize
  855.     @data = {}
  856.     @sort_arrays = {
  857.       reveal: [], change: [], complete: [], failed: [],
  858.       id:       [].send(:extend, MAQJ_SortedArray),
  859.       alphabet: [].send(:extend, MAQJ_SortedArray),
  860.       level:    [].send(:extend, MAQJ_SortedArray)
  861.     }
  862.   end
  863.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  864.   # * Get Quest
  865.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  866.   def [](quest_id)
  867.     reset_quest(quest_id) if !@data[quest_id]
  868.     @data[quest_id]
  869.   end
  870.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  871.   # * Set Quest <- Not sure when this would ever be useful.
  872.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  873.   def []=(quest_id, value)
  874.     @data[quest_id] = value
  875.   end
  876.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  877.   # * List
  878.   #    list_type : the type of list to return
  879.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  880.   def list(list_type = :all, sort_type = $game_system.quest_sort_type[list_type])
  881.     sort_type_s = sort_type.to_s
  882.     reverse = !(sort_type_s.sub!(/_r$/, "")).nil?
  883.     sort_type = sort_type_s.to_sym
  884.     list = @sort_arrays[sort_type].select { |quest_id| include?(quest_id, list_type) }
  885.     list.reverse! if reverse
  886.     list.collect { |quest_id| @data[quest_id] }
  887.   end
  888.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  889.   # * Include?
  890.   #    determines whether to include a particular quest depending on list type
  891.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  892.   def include?(quest_id, list_type = :all)
  893.     return false if !revealed?(quest_id)
  894.     case list_type
  895.     when :all then true
  896.     when :complete, :failed, :active then @data[quest_id].status?(list_type)
  897.     else
  898.       @data[quest_id].custom_categories.include?(list_type)
  899.     end
  900.   end
  901.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  902.   # * Revealed?
  903.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  904.   def revealed?(quest_id)
  905.     (!@data[quest_id].nil? && !@data[quest_id].concealed)
  906.   end
  907.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  908.   # * Setup Quest
  909.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  910.   def setup_quest(quest_id)
  911.     return if @data[quest_id]
  912.     @data[quest_id] = Game_Quest.new(quest_id)
  913.     # Open to this quest next time the QJ is opened
  914.     $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST
  915.     # Save sorting order in separate arrays to avoid re-sorting every time
  916.     @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }
  917.   end
  918.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919.   # * Delete Quest
  920.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  921.   def delete_quest(quest_id)
  922.     @data.delete(quest_id)
  923.     @sort_arrays.values.each { |ary| ary.delete(quest_id) }
  924.   end
  925.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  926.   # * Reset Quest
  927.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  928.   def reset_quest(quest_id)
  929.     delete_quest(quest_id)
  930.     setup_quest(quest_id)
  931.   end
  932.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  933.   # * Add to Sorted Array
  934.   #    sort_type : array to alter
  935.   #    quest_id  : ID of the quest to add.
  936.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  937.   def add_to_sort_array(sort_type, quest_id)
  938.     @sort_arrays[sort_type].delete(quest_id) # Make sure always unique
  939.     case sort_type
  940.     when :reveal, :change, :complete, :failed
  941.       @sort_arrays[sort_type].unshift(quest_id)
  942.     when :id
  943.       @sort_arrays[sort_type].maqj_insert_sort(quest_id)
  944.     when :alphabet
  945.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].name.downcase <=> @data[b].name.downcase }
  946.     when :level
  947.       @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].level <=> self[b].level }
  948.     end
  949.   end
  950.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  951.   # * Find Location
  952.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  953.   def find_location(quest_id, cat = nil)
  954.     if revealed?(quest_id)
  955.       categories = $game_system.quest_categories.dup
  956.       # If cat specified, check in that category first.
  957.       if cat && categories.include?(cat)
  958.         categories.delete(cat)
  959.         categories.unshift(cat)
  960.       end
  961.       for category in categories # Check all categories
  962.         index = list(category).index(@data[quest_id])
  963.         return category, index if index != nil
  964.       end
  965.     end
  966.     return nil, nil
  967.   end
  968.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  969.   # * Clear
  970.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  971.   def clear
  972.     @data.clear
  973.   end
  974. end

  975. #==============================================================================
  976. # ** Game System
  977. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  978. #  Summary of Changes:
  979. #    new attr_accessor - quest_menu_access; quest_map_access; quest_sort_type;
  980. #      quest_bg_picture; quest_bg_opacity; quest_windowskin;
  981. #      quest_window_opacity; quest_access_disabled; last_quest_cat;
  982. #      last_quest_id
  983. #    aliased methods - initialize
  984. #    new methods - init_maqj_data
  985. #==============================================================================

  986. class Game_System
  987.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  988.   # * Public Instance Variables
  989.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  990.   attr_reader   :quest_menu_access     # Whether the scene is called from menu
  991.   attr_accessor :quest_map_access      # Whether the scene is called from map
  992.   attr_accessor :quest_sort_type       # The sort types for each category
  993.   attr_accessor :quest_bg_picture      # The filename of the background picture
  994.   attr_accessor :quest_bg_opacity      # The opacity of the background picture
  995.   attr_accessor :quest_bg_blend_type   # The blend type of the background pic
  996.   attr_accessor :quest_windowskin      # The windowskin used for the scene
  997.   attr_accessor :quest_window_tone     # The tone of windows in the scene
  998.   attr_accessor :quest_window_opacity  # The opacity of windows in the scene
  999.   attr_accessor :quest_access_disabled # Whether access to Quests is disabled
  1000.   attr_accessor :quest_categories      # The categories to show in the scene
  1001.   attr_accessor :quest_scene_label     # The label to show in the scene
  1002.   attr_accessor :last_quest_cat        # The category to open to
  1003.   attr_accessor :last_quest_id         # The ID to open to
  1004.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1005.   # * Object Initialization
  1006.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1007.   alias maqj_initialze_2cy9 initialize
  1008.   def initialize(*args, &block)
  1009.     maqj_initialze_2cy9(*args, &block)
  1010.     init_maqj_data
  1011.   end
  1012.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1013.   # * Initialize Quest Data
  1014.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1015.   def init_maqj_data
  1016.     # Initialize new variables
  1017.     self.quest_menu_access = QuestData::MENU_ACCESS
  1018.     @quest_map_access = QuestData::MAP_ACCESS
  1019.     @quest_sort_type = QuestData::SORT_TYPE
  1020.     @quest_bg_picture = QuestData::BG_PICTURE
  1021.     @quest_bg_opacity = QuestData::BG_OPACITY
  1022.     @quest_bg_blend_type = QuestData::BG_BLEND_TYPE
  1023.     @quest_windowskin = QuestData::WINDOWSKIN
  1024.     @quest_window_tone = QuestData::WINDOW_TONE
  1025.     @quest_window_opacity = QuestData::WINDOW_OPACITY
  1026.     @quest_access_disabled = false
  1027.     @quest_categories = QuestData::CATEGORIES
  1028.     @quest_scene_label = QuestData::VOCAB[:scene_label]
  1029.     @last_quest_cat = @quest_categories[0]
  1030.     @last_quest_id = 0
  1031.   end
  1032.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1033.   # * Set Quest Menu Access
  1034.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1035.   def quest_menu_access=(boolean)
  1036.     @quest_menu_access = boolean
  1037.     maic_inserted_menu_commands.delete(:quest_journal)
  1038.     maic_inserted_menu_commands.push(:quest_journal) if @quest_menu_access
  1039.     maic_inserted_menu_commands.sort!
  1040.   end
  1041. end

  1042. #==============================================================================
  1043. # ** Game_Party
  1044. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1045. #  Summary of Changes:
  1046. #    new attr_reader - quests
  1047. #    aliased method - initialize
  1048. #    new method - init_maqj_data
  1049. #==============================================================================

  1050. class Game_Party
  1051.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1052.   # * Public Instance Variables
  1053.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1054.   attr_reader :quests
  1055.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1056.   # * Object Initialization
  1057.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1058.   alias maqj_intiaze_2si9 initialize
  1059.   def initialize(*args, &block)
  1060.     maqj_intiaze_2si9(*args, &block) # Call Original Method
  1061.     init_maqj_data
  1062.   end
  1063.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1064.   # * Initialize Quests
  1065.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1066.   def init_maqj_data
  1067.     @quests = Game_Quests.new # Initialize @quests
  1068.   end
  1069. end

  1070. #==============================================================================
  1071. # ** Game_Interpreter
  1072. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1073. #  Summary of Changes:
  1074. #    new methods - change_quest_access; change_quest_background;
  1075. #      change_quest_windows; setup_quest; delete_quest; reset_quest; quest;
  1076. #      reveal_quest; conceal_quest; manually_complete_quest;
  1077. #      manually_fail_quest; reveal_objective; conceal_objective;
  1078. #      complete_objective; uncomplete_objective; fail_objective;
  1079. #      unfail_objective; quest_revealed?; quest_complete?; quest_active?;
  1080. #      quest_failed?; objective_complete?; objective_active?;
  1081. #      objective_failed?; distribute_quest_rewards; distribute_quest_reward;
  1082. #      call_quest_journal
  1083. #==============================================================================

  1084. class Game_Interpreter
  1085.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1086.   # * Change Quest Access
  1087.   #    sym : symbol representing what aspect of access is being changed
  1088.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1089.   def change_quest_access(sym)
  1090.     case sym
  1091.     when :enable then $game_system.quest_access_disabled = false
  1092.     when :disable then $game_system.quest_access_disabled = true
  1093.     when :enable_menu then $game_system.quest_menu_access = true
  1094.     when :disable_menu then $game_system.quest_menu_access = false
  1095.     when :enable_map then $game_system.quest_map_access = true
  1096.     when :disable_map then $game_system.quest_map_access = false
  1097.     end
  1098.   end
  1099.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1100.   # * Change Quest Background
  1101.   #    picture : picture to show in the scene's background
  1102.   #    opacity : opacity of the picture shown in the scene's background
  1103.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1104.   def change_quest_background(picture, opacity = $game_system.quest_bg_opacity,
  1105.       blend_type = $game_system.quest_bg_blend_type)
  1106.     $game_system.quest_bg_picture = picture
  1107.     $game_system.quest_bg_opacity = opacity
  1108.     $game_system.quest_bg_blend_type = blend_type
  1109.   end
  1110.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1111.   # * Change Quest Windows
  1112.   #    skin    : windowskin name to use in the scene
  1113.   #    tone    : tone for the windowskin
  1114.   #    opacity : opacity of windows in the scene
  1115.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1116.   def change_quest_windows(skin, tone = $game_system.quest_window_tone,
  1117.       opacity = $game_system.quest_window_opacity)
  1118.     $game_system.quest_windowskin = skin
  1119.     $game_system.quest_window_tone = tone
  1120.     $game_system.quest_window_opacity = opacity
  1121.   end
  1122.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1123.   # * Setup/Delete/Reset Quest
  1124.   #    quest_id : ID of the quest to be setup or deleted or reset
  1125.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1126.   [:setup_quest, :delete_quest, :reset_quest].each { |method|
  1127.     define_method(:"quest_#{method}") do |quest_id|
  1128.       $game_party.quests.send(method, quest_id)
  1129.     end
  1130.   }
  1131.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1132.   # * Retrieve Quest
  1133.   #    quest_id : ID of the quest to retrieve
  1134.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1135.   def quest(quest_id);         $game_party.quests[quest_id];      end
  1136.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1137.   # * Reveal/Conceal Quest
  1138.   #    quest_id : ID of the quest to be revealed or concealed
  1139.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1140.   def reveal_quest(quest_id);  quest(quest_id).concealed = false; end
  1141.   def conceal_quest(quest_id); quest(quest_id).concealed = true;  end
  1142.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1143.   # * Manually Complete/Fail Quest
  1144.   #    quest_id : ID of the quest to be revealed or concealed
  1145.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1146.   def manually_complete_quest(quest_id)
  1147.     quest(quest_id).prime_objectives.clear
  1148.     quest(quest_id).manual_status = :complete
  1149.   end
  1150.   def manually_fail_quest(quest_id)
  1151.     quest(quest_id).prime_objectives.clear
  1152.     quest(quest_id).manual_status = :failed
  1153.   end
  1154.   def manually_activate_quest(quest_id)
  1155.     quest(quest_id).manual_status = :active
  1156.   end
  1157.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1158.   # * Reveal/Complete/Fail/Conceal/Uncomplete/Unfail Objective
  1159.   #    quest_id : ID of the quest whose objectives will be modified
  1160.   #    *obj     : IDs of objectives to reveal or complete or fail (or opposite)
  1161.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1162.   [:reveal_objective, :complete_objective, :fail_objective, :conceal_objective,
  1163.   :uncomplete_objective, :unfail_objective].each { |method|
  1164.     define_method(method) do |quest_id, *obj|
  1165.       quest(quest_id).send(method, *obj)
  1166.     end
  1167.   }
  1168.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1169.   # * Quest Revealed?
  1170.   #    quest_id : ID of the quest you are checking is revealed
  1171.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1172.   def quest_revealed?(quest_id)
  1173.     $game_party.quests.revealed?(quest_id)
  1174.   end
  1175.   [:complete, :failed, :active].each { |method|
  1176.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1177.     # * Quest Complete/Failed/Active?
  1178.     #    quest_id : ID of the quest whose completion status is being checked
  1179.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1180.     define_method(:"quest_#{method}?") do |quest_id|
  1181.       quest_revealed?(quest_id) && quest(quest_id).status?(method)
  1182.     end
  1183.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1184.     # * Objective Complete/Failed/Active?
  1185.     #    quest_id : ID of the quest whose objectives are being checked
  1186.     #    *obj     : IDs of objectives to check completion status
  1187.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1188.     define_method(:"objective_#{method}?") do |quest_id, *obj|
  1189.       quest_revealed?(quest_id) && quest(quest_id).objective_status?(method, *obj)
  1190.     end
  1191.   }
  1192.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1193.   # * Objective Revealed?
  1194.   #    quest_id : ID of the quest you are checking is revealed
  1195.   #    *obj     : IDs of objectives to check completion status
  1196.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1197.   def objective_revealed?(quest_id, *obj)
  1198.     quest_revealed?(quest_id) && quest(quest_id).objective_status?(:revealed, *obj)
  1199.   end
  1200.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1201.   # * Quest Rewarded?
  1202.   #    quest_id : ID of the quest you are checking is revealed
  1203.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1204.   def quest_rewarded?(quest_id)
  1205.     quest_revealed?(quest_id) && quest(quest_id).status?(:reward)
  1206.   end
  1207.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1208.   # * Change Reward Status
  1209.   #    quest_id : ID of the quest you are checking is revealed
  1210.   #    value    : true or false
  1211.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1212.   def change_reward_status(quest_id, value = true)
  1213.     quest(quest_id).reward_given = value
  1214.   end
  1215.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1216.   # * Distribute Rewards
  1217.   #    quest_id : ID of the quest whose rewards are to be distributed
  1218.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1219.   def distribute_quest_rewards(quest_id)
  1220.     if quest_revealed?(quest_id) && !quest_rewarded?(quest_id)
  1221.       params = @params.dup
  1222.       change_reward_status(quest_id, true)
  1223.       quest(quest_id).rewards.each { |reward| distribute_quest_reward(reward) }
  1224.       @params = params
  1225.       true
  1226.     else
  1227.       false
  1228.     end
  1229.   end
  1230.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1231.   # * Distribute Reward
  1232.   #    reward : an array identifying the reward
  1233.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1234.   def distribute_quest_reward(reward)
  1235.     @params = [reward[1], 0, 0, (reward[2] ? reward[2] : 1)]
  1236.     case reward[0]
  1237.     when :item, 0 then   command_126 # Item
  1238.     when :weapon, 1 then command_127 # Weapon
  1239.     when :armor, 2 then  command_128 # Armor
  1240.     when :gold, 3   # Gold
  1241.       @params = [0, 0, reward[1] ? reward[1] : 0]
  1242.       command_125
  1243.     when :exp, 4    # Exp
  1244.       @params = [0, 0, 0, 0, reward[1] ? reward[1] : 0, true]
  1245.       command_315
  1246.     end
  1247.   end
  1248.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1249.   # * Call Quest Journal
  1250.   #    quest_id : ID of the quest to open the journal to
  1251.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1252.   def call_quest_journal(quest_id = nil)
  1253.     return if $game_party.in_battle
  1254.     $game_system.last_quest_id = quest_id if quest_id
  1255.     SceneManager.call(Scene_Quest)
  1256.     Fiber.yield
  1257.   end
  1258. end

  1259. unless $imported[:"MA_ParagraphFormat_1.0"]
  1260. #==============================================================================
  1261. # ** MA_Window_ParagraphFormat
  1262. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1263. #  This module inserts into Window_Base and provides a method to format the
  1264. # strings so as to go to the next line if it exceeds a set limit. This is
  1265. # designed to work with draw_text_ex, and a string formatted by this method
  1266. # should go through that, not draw_text.
  1267. #==============================================================================

  1268. module MA_Window_ParagraphFormat
  1269.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1270.   # * Calc Line Width
  1271.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1272.   def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
  1273.     return tw if line.nil?
  1274.     line = line.clone
  1275.     unless contents_dummy
  1276.       real_contents = contents # Preserve Real Contents
  1277.       # Create a dummy contents
  1278.       self.contents = Bitmap.new(contents_width, 24)
  1279.       reset_font_settings
  1280.     end
  1281.     pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
  1282.     while line[/^(.*?)\e(.*)/]
  1283.       tw += text_size($1).width
  1284.       line = $2
  1285.       # Remove all ancillaries to the code, like parameters
  1286.       code = obtain_escape_code(line)
  1287.       # If direct setting of x, reset tw.
  1288.       tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
  1289.         ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
  1290.       #  If I need to do something special on the basis that it is testing,
  1291.       # alias process_escape_character and differentiate using @atsf_testing
  1292.       process_escape_character(code, line, pos)
  1293.     end
  1294.     #  Add width of remaining text, as well as the value of pos[:x] under the
  1295.     # assumption that any additions to it are because the special code is
  1296.     # replaced by something which requires space (like icons)
  1297.     tw += text_size(line).width + pos[:x]
  1298.     unless contents_dummy
  1299.       contents.dispose # Dispose dummy contents
  1300.       self.contents = real_contents # Restore real contents
  1301.     end
  1302.     return tw
  1303.   end
  1304.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1305.   # * Format Paragraph
  1306.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1307.   def mapf_format_paragraph(text, max_width = contents_width)
  1308.     text = text.clone
  1309.     #  Create a Dummy Contents - I wanted to boost compatibility by using the
  1310.     # default process method for escape codes. It may have the opposite effect,
  1311.     # for some :(
  1312.     real_contents = contents # Preserve Real Contents
  1313.     self.contents = Bitmap.new(contents_width, 24)
  1314.     reset_font_settings
  1315.     paragraph = ""
  1316.     while !text.empty?
  1317.       text.lstrip!
  1318.       oline, nline, tw = mapf_format_by_line(text.clone, max_width)
  1319.       # Replace old line with the new one
  1320.       text.sub!(/#{Regexp.escape(oline)}/m, nline)
  1321.       paragraph += text.slice!(/.*?(\n|$)/)
  1322.     end
  1323.     contents.dispose # Dispose dummy contents
  1324.     self.contents = real_contents # Restore real contents
  1325.     return paragraph
  1326.   end
  1327.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1328.   # * Format By Line
  1329.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1330.   def mapf_format_by_line(text, max_width = contents_width)
  1331.     oline, nline, tw = "", "", 0
  1332.     loop do
  1333.       #  Format each word until reach the width limit
  1334.       oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
  1335.       return oline, nline, tw if done
  1336.     end
  1337.   end
  1338.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1339.   # * Format By Word
  1340.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1341.   def mapf_format_by_word(text, line, tw, max_width)
  1342.     return line, line, tw, true if text.nil? || text.empty?
  1343.     # Extract next word
  1344.     if text.sub!(/(\s*)([^\s\n\f]*)([\n\f]?)/, "") != nil
  1345.       prespace, word, line_end = $1, $2, $3
  1346.       ntw = mapf_calc_line_width(word, tw, true)
  1347.       pw = contents.text_size(prespace).width
  1348.       if (pw + ntw >= max_width)
  1349.         # Insert
  1350.         if line.empty?
  1351.           # If one word takes entire line
  1352.           return prespace + word, word + "\n", ntw, true
  1353.         else
  1354.           return line + prespace + word, line + "\n" + word, tw, true
  1355.         end
  1356.       else
  1357.         line += prespace + word
  1358.         tw = pw + ntw
  1359.         # If the line is force ended, then end
  1360.         return line, line, tw, true if !line_end.empty?
  1361.       end
  1362.     else
  1363.       return line, line, tw, true
  1364.     end
  1365.     return line, line, tw, false
  1366.   end
  1367. end

  1368. class Window_Base
  1369.   include MA_Window_ParagraphFormat
  1370. end

  1371. $imported[:"MA_ParagraphFormat_1.0"] = true
  1372. end

  1373. #==============================================================================
  1374. # *** MAQJ Window_QuestBase
  1375. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1376. #  This module mixes in with all quest windows
  1377. #==============================================================================

  1378. module MAQJ_Window_QuestBase
  1379.   attr_reader :maqj_objective_color
  1380.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1381.   # * Object Initialization
  1382.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1383.   def initialize(*args, &block)
  1384.     super(*args, &block)
  1385.     reset_font_settings
  1386.     set_data_font(:normal)
  1387.     @maqj_default_font = contents.font.dup
  1388.     # Change the windowskin, tone if they are set to be changed
  1389.     self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin
  1390.     self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity
  1391.     self.opacity = 0 ####SR
  1392.   end
  1393.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1394.   # * Reset Font Settings
  1395.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1396.   def reset_font_settings(*args, &block)
  1397.     super(*args, &block)
  1398.     set_data_font(@maqj_font_data_type) if @maqj_font_data_type
  1399.   end
  1400.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1401.   # * Set Data Font
  1402.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1403.   def set_data_font(data_type)
  1404.     @maqj_default_font = contents.font.dup unless @maqj_default_font
  1405.     contents.font.name = QuestData::FONTNAMES[data_type] ?
  1406.       QuestData::FONTNAMES[data_type] : @maqj_default_font.name
  1407.     contents.font.size = QuestData::FONTSIZES[data_type] ?
  1408.       QuestData::FONTSIZES[data_type] : @maqj_default_font.size
  1409.     contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ?
  1410.       QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold
  1411.     contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?
  1412.       QuestData::FONTITALICS[data_type] : @maqj_default_font.italic
  1413.     case data_type
  1414.     when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color
  1415.     when :name then change_color(quest_name_colour(@quest)) if @quest
  1416.     else
  1417.       change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)
  1418.     end
  1419.   end
  1420.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1421.   # * Draw Horizontal Line
  1422.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1423.   def draw_horizontal_line(y, h = 2)
  1424.     contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))
  1425.     contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))
  1426.   end
  1427.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1428.   # * MA Text Color
  1429.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1430.   def text_color(param)
  1431.     begin
  1432.       colour = case param
  1433.       when Integer then super(param) rescue normal_color
  1434.       when Symbol then send(param) rescue normal_color
  1435.       when Array then Color.new(*param) rescue normal_color
  1436.       else
  1437.         normal_color
  1438.       end
  1439.     end
  1440.     colour.is_a?(Color) ? colour : normal_color
  1441.   end
  1442.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1443.   # * Quest Name Colour
  1444.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1445.   def quest_name_colour(quest = @quest)
  1446.     return if !quest
  1447.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1448.     s = [:failed, :complete, :active].find { |status| quest.status?(status) }
  1449.     text_color(QuestData::COLOURS[s])
  1450.   end
  1451.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1452.   # * Quest Objective Colour
  1453.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1454.   def quest_objective_colour(quest, obj_id)
  1455.     return if !quest
  1456.     quest = $game_party.quests[quest] if quest.is_a?(Integer)
  1457.     s = [:failed, :complete, :active].find { |status| quest.objective_status?(status, obj_id) }
  1458.     text_color(QuestData::COLOURS[s])
  1459.   end
  1460.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1461.   # * Update Tone
  1462.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1463.   def update_tone
  1464.     $game_system.quest_window_tone ?
  1465.       self.tone.set(*$game_system.quest_window_tone) : super
  1466.   end
  1467. end

  1468. unless $imported[:"MA_IconHorzCommand_1.0"]
  1469. #==============================================================================
  1470. # ** Window_MA_IconHorzCommand
  1471. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1472. #  This window is a base window to show a horizontal command window populated
  1473. # with icons.
  1474. #==============================================================================

  1475. class Window_MA_IconHorzCommand < Window_HorzCommand
  1476.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1477.   # * Public Instance Variable
  1478.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1479.   attr_reader   :observing_procs
  1480.   attr_accessor :cursor_hide
  1481.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1482.   # * Object Initialization
  1483.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1484.   def initialize(*args, &block)
  1485.     @observing_procs = {}
  1486.     super(*args, &block)
  1487.   end
  1488.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1489.   # * Column Max
  1490.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1491.   def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end
  1492.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1493.   # * Item
  1494.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1495.   def item
  1496.     @list[index] ? @list[index][:symbol] : nil
  1497.   end
  1498.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1499.   # * Enabled? / Current Item Enabled?
  1500.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1501.   def enable?(index); self.index == index; end
  1502.   def current_item_enabled?; !current_data.nil?; end
  1503.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1504.   # * Draw Item
  1505.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1506.   def draw_item(index)
  1507.     rect = item_rect(index)
  1508.     contents.clear_rect(rect)
  1509.     draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  1510.   end
  1511.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1512.   # * Set Index
  1513.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1514.   def index=(index)
  1515.     old_index = self.index
  1516.     super(index)
  1517.     draw_item(old_index)
  1518.     draw_item(self.index)
  1519.   end
  1520.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1521.   # * Frame Update
  1522.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1523.   def update
  1524.     super
  1525.     @observing_procs.values.each { |block| block.call(item) }
  1526.   end
  1527.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1528.   # * Add/Remove Observing Window
  1529.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1530.   def add_observing_proc(id, &block)
  1531.     @observing_procs[id] = block
  1532.     update
  1533.   end
  1534.   def remove_observing_proc(id)     ; @observing_procs.delete(id) ; end
  1535.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1536.   # * Update Cursor
  1537.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1538.   def update_cursor
  1539.     super
  1540.     cursor_rect.empty if @cursor_hide
  1541.   end
  1542. end
  1543. $imported[:"MA_IconHorzCommand_1.0"] = true
  1544. end

  1545. #==============================================================================
  1546. # ** Window_QuestCategory
  1547. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1548. #  This window allows the player to switch between quest categories.
  1549. #==============================================================================

  1550. class Window_QuestCategory < Window_MA_IconHorzCommand
  1551.   include MAQJ_Window_QuestBase
  1552.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1553.   # * Object Initialization
  1554.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1555.   def initialize(x, y, categories = $game_system.quest_categories)
  1556.     @cursor_hide = QuestData::HIDE_CATEGORY_CURSOR
  1557.     @categories = categories
  1558.     super(x, y)
  1559.     #self.opacity = 0 ####SR
  1560.   end
  1561.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1562.   # * Window Width
  1563.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1564.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1565.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1566.   # * Category=
  1567.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1568.   def category=(category)
  1569.     self.index = @categories.index(category) if @categories.include?(category)
  1570.   end
  1571.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1572.   # * Make Command List
  1573.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1574.   def make_command_list
  1575.     @categories.each { |cat|
  1576.       add_command("", cat, false, QuestData::ICONS[cat]) }
  1577.   end
  1578. end

  1579. #==============================================================================
  1580. # ** Window QuestLabel
  1581. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1582. #  This window simply shows a label for the Quests scene
  1583. #==============================================================================

  1584. class Window_QuestLabel < Window_Base
  1585.   include MAQJ_Window_QuestBase
  1586.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1587.   # * Object Initialization
  1588.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1589.   def initialize(x, y, label = "")
  1590.     super(x, y, window_width, window_height)
  1591.     #self.opacity = 0 ####SR
  1592.     refresh(label)
  1593.   end
  1594.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1595.   # * Reset Font Settings
  1596.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1597.   def reset_font_settings; set_data_font(:scene_label); end
  1598.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1599.   # * Window Attributes
  1600.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1601.   def window_width
  1602.     w = ($game_system.quest_categories.size > 1 || QuestData::SHOW_CATEGORY_LABEL) ?
  1603.       Graphics.width - QuestData::LIST_WINDOW_WIDTH : QuestData::LIST_WINDOW_WIDTH
  1604.   end
  1605.   def window_height; line_height + (standard_padding*2); end
  1606.   def line_height(*args)
  1607.     line_h = super(*args)
  1608.     QuestData::FONTSIZES[:scene_label] ?
  1609.       [QuestData::FONTSIZES[:scene_label], line_h].max : line_h
  1610.   end
  1611.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1612.   # * Refresh
  1613.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1614.   def refresh(label = @label)
  1615.     @label = label.is_a?(String) ? convert_escape_characters(label) : ""
  1616.     contents.clear
  1617.     reset_font_settings
  1618.     tw = mapf_calc_line_width(@label)
  1619.     draw_text_ex((contents_width - tw) / 2, 0, @label)
  1620.   end
  1621. end

  1622. #==============================================================================
  1623. # ** Window QuestLabel
  1624. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1625. #  This window simply shows a label for category currently selected
  1626. #==============================================================================

  1627. class Window_QuestCategoryLabel < Window_QuestLabel
  1628.   include MAQJ_Window_QuestBase
  1629.   #
  1630.   def initialize(x, y, label = "")
  1631.     super(x, y, label)
  1632.     #self.opacity = 0 ####SR
  1633.   end
  1634.   #
  1635.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1636.   # * Reset Font Settings
  1637.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1638.   def reset_font_settings; set_data_font(:category_label); end
  1639.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1640.   # * Window Attributes
  1641.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1642.   def window_width; QuestData::LIST_WINDOW_WIDTH; end
  1643.   def line_height(*args)
  1644.     line_h = super(*args)
  1645.     QuestData::FONTSIZES[:category_label] ?
  1646.       [QuestData::FONTSIZES[:category_label], line_h].max : line_h
  1647.   end
  1648.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1649.   # * Set Category
  1650.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1651.   def category=(category)
  1652.     return if @category == category
  1653.     @category = category
  1654.     refresh(QuestData::CATEGORY_VOCAB[category])
  1655.   end
  1656. end

  1657. #==============================================================================
  1658. # ** Window_QuestCategoryDummy
  1659. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1660. #  This window shows up behind the category and category label window
  1661. #==============================================================================

  1662. class Window_QuestCategoryDummy < Window_Base
  1663.   include MAQJ_Window_QuestBase
  1664. end

  1665. #==============================================================================
  1666. # ** Window_QuestList
  1667. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1668. #  This window shows all quests in a selected category.
  1669. #==============================================================================

  1670. class Window_QuestList < Window_Selectable
  1671.   include MAQJ_Window_QuestBase
  1672.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1673.   # * Object Initialization
  1674.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1675.   def initialize(x, y, width, height)
  1676.     super
  1677.     @data = []
  1678.     self.index = 0
  1679.     self.opacity = 0 #####SR2
  1680.     activate
  1681.   end
  1682.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1683.   # * Set Category
  1684.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1685.   def category=(category)
  1686.     return if @category == category
  1687.     @category = category
  1688.     refresh
  1689.     self.index = 0
  1690.     update_help if @help_window
  1691.   end
  1692.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1693.   # * Get Quest
  1694.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1695.   def item; @data && index >= 0 ? @data[index] : nil; end
  1696.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1697.   # * Column/Item Max
  1698.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1699.   def col_max; 1; end
  1700.   def item_max; @data ? @data.size : 1; end
  1701.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1702.   # * Whether it should be drawn enabled
  1703.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1704.   def enable?(item); true; end
  1705.   def current_item_enabled?
  1706.     (@help_window && @help_window.maqj_visible_height < @help_window.contents_height)
  1707.   end
  1708.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1709.   # * Make Item List
  1710.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1711.   def make_item_list
  1712.     @data = @category ? $game_party.quests.list(@category) : []
  1713.   end
  1714.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1715.   # * Draw Item
  1716.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1717.   def draw_item(index)
  1718.     quest = @data[index]
  1719.     if quest
  1720.       rect = item_rect_for_text(index)
  1721.       if QuestData::SHOW_QUEST_ICONS
  1722.         draw_icon(quest.icon_index, rect.x, rect.y, enable?(quest))
  1723.         rect.x += 24
  1724.         rect.width -= 24
  1725.       end
  1726.       change_color(quest_name_colour(quest), enable?(quest))
  1727.       draw_text(rect, quest.name)
  1728.     end
  1729.   end
  1730.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1731.   # * Refresh
  1732.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1733.   def refresh
  1734.     make_item_list
  1735.     create_contents
  1736.     set_data_font(:list)
  1737.     draw_all_items
  1738.   end
  1739.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1740.   # * Update Help
  1741.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1742.   def update_help
  1743.     @help_window.quest = item
  1744.   end
  1745. end

  1746. #==============================================================================
  1747. # ** Window_QuestData
  1748. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1749. #  This window shows all quest data
  1750. #==============================================================================

  1751. class Window_QuestData < Window_Selectable
  1752.   include MAQJ_Window_QuestBase
  1753.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1754.   # * Object Initialization
  1755.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1756.   def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)
  1757.     @dest_scroll_oy = 0
  1758.     super(x, y, w, h)
  1759.     @dest_scroll_oy = self.oy
  1760.     self.layout = layout
  1761.     self.opacity = 0 #####SR2
  1762.   end
  1763.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1764.   # * Contents Height
  1765.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1766.   alias maqj_visible_height contents_height
  1767.   def contents_height
  1768.     @q_contents_height ? [@q_contents_height, maqj_visible_height].max : maqj_visible_height
  1769.   end
  1770.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1771.   # * Calculate Contents Height
  1772.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1773.   def calc_contents_height
  1774.     @q_contents_height = 0
  1775.     @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest
  1776.   end
  1777.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1778.   # * Draw Data?
  1779.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1780.   def draw_data?(data_type)
  1781.     case data_type
  1782.     when :line then true
  1783.     when :level then @quest.level > 0
  1784.     when :objectives then [email protected]_objectives.empty?
  1785.     when Array then (data_type - [:line]).any? { |dt| draw_data?(dt) }
  1786.     else [email protected](data_type).empty? # :description, :name, etc...
  1787.     end
  1788.   end
  1789.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1790.   # * Get Data Height
  1791.   #    This method calculates the height required for a specified element of
  1792.   #   the current quest. This is to calculate the needed space in contents,
  1793.   #   as well as advance the @draw_y variable.
  1794.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1795.   def data_height(data_type)
  1796.     return 0 unless draw_data?(data_type)
  1797.     return line_height if QuestData::BASIC_DATA_TYPES.include?(data_type)
  1798.     @maqj_font_data_type = data_type
  1799.     reset_font_settings
  1800.     return case data_type
  1801.     when :line, :level, :name then line_height
  1802.     when :banner
  1803.       bmp = Cache.picture(@quest.banner)
  1804.       hght = bmp.rect.height
  1805.       bmp.dispose
  1806.       hght
  1807.     when :description
  1808.       buff = description_x*2
  1809.       paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  1810.       line_num = paragraph.scan(/\n/).size + 1
  1811.       line_num += (QuestData::DESCRIPTION_IN_BOX ? 2 :
  1812.         !QuestData::VOCAB[:description].empty? ? 1 : 0)
  1813.       line_num*line_height
  1814.     when :objectives
  1815.       objectives = @quest.revealed_objectives.collect { |obj_id|
  1816.         @quest.objectives[obj_id] }
  1817.       line_num = QuestData::VOCAB[:objectives].empty? ? 0 : 1
  1818.       buff = (objective_x*2) + text_size(QuestData::VOCAB[:objective_bullet]).width
  1819.       objectives.each { |obj|
  1820.         paragraph = mapf_format_paragraph(obj, contents_width - buff)
  1821.         line_num += paragraph.scan(/\n/).size + 1 }
  1822.       line_num*line_height
  1823.     when :rewards
  1824.       line_num = QuestData::VOCAB[:rewards].empty? ? 0 : 1
  1825.       (line_num + @quest.rewards.size)*line_height
  1826.     when Array then data_height(data_type.max_by { |dt| data_height(dt) })
  1827.     else 0
  1828.     end
  1829.   end
  1830.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1831.   # * Set Quest
  1832.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1833.   def quest=(value)
  1834.     return if [url=home.php?mod=space&uid=70400]@quest[/url] == value
  1835.     @quest = value
  1836.     @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout
  1837.     refresh
  1838.   end
  1839.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1840.   # * Set Layout
  1841.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1842.   def layout=(value)
  1843.     return if @default_layout == value && @layout == value
  1844.     @default_layout = value
  1845.     @layout = value
  1846.     refresh
  1847.   end
  1848.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1849.   # * Refresh
  1850.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1851.   def refresh
  1852.     contents.clear
  1853.     calc_contents_height
  1854.     create_contents
  1855.     return unless @quest && @layout
  1856.     self.oy = 0
  1857.     @dest_scroll_oy = 0
  1858.     #  The basic idea here is that each draw_ method will rely on and advance
  1859.     # the @draw_y variable. Where they are an array, the elements will be
  1860.     # drawn at the same @draw_y.
  1861.     @draw_y = 0
  1862.     @layout.each {|dt|
  1863.       next unless draw_data?(dt)
  1864.       dt.is_a?(Array) ? draw_data_array(dt) : draw_data(dt)
  1865.     }
  1866.   end
  1867.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1868.   # * Draw Data
  1869.   #    data_type : the data block to draw next
  1870.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1871.   def draw_data(data_type)
  1872.     @maqj_font_data_type = data_type
  1873.     reset_font_settings
  1874.     send(:"draw_#{data_type}") if self.class.method_defined?(:"draw_#{data_type}")
  1875.     @draw_y += data_height(data_type)
  1876.   end
  1877.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1878.   # * Draw Data Array
  1879.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1880.   def draw_data_array(layout_array)
  1881.     y, max_y = @draw_y, @draw_y
  1882.     # Draw each data aspect at the same starting @draw_y
  1883.     layout_array.each { |dt|
  1884.       @draw_y = y
  1885.       draw_data(dt)
  1886.       max_y = @draw_y if @draw_y > max_y
  1887.     }
  1888.     @draw_y = max_y
  1889.   end
  1890.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1891.   # * Draw Line
  1892.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1893.   def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end
  1894.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1895.   # * Draw Name
  1896.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1897.   def draw_name
  1898.     set_data_font(:name)
  1899.     clear_and_draw_text(0, @draw_y, contents_width, line_height, @quest.name, 1)
  1900.   end
  1901.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1902.   # * Draw Level
  1903.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1904.   def draw_level
  1905.     case QuestData::LEVEL_ICON
  1906.     when Array then QuestData::LEVEL_ICON.empty? ? draw_level_text : draw_level_array
  1907.     when 0 then draw_level_text
  1908.     else
  1909.       draw_level_stacked
  1910.     end
  1911.   end
  1912.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1913.   # * Draw Stacked Level
  1914.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1915.   def draw_level_stacked(icon_index = QuestData::LEVEL_ICON)
  1916.     align = QuestData::HEADING_ALIGN[:level]
  1917.     es = QuestData::LEVEL_ICONS_SPACE*(@quest.level - 1)
  1918.     x = align == 2 ? contents_width - 24 : align == 1 ?
  1919.       (contents_width - 24 - (es)) / 2 : es
  1920.     @quest.level.times do
  1921.       draw_icon(icon_index, x, @draw_y)
  1922.       x -= QuestData::LEVEL_ICONS_SPACE
  1923.     end
  1924.   end
  1925.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1926.   # * Draw Array Level
  1927.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1928.   def draw_level_array(icon_index = QuestData::LEVEL_ICON)
  1929.     return if icon_index.empty?
  1930.     icon_index = icon_index[@quest.level - 1] ? icon_index[@quest.level - 1] : icon_index[-1]
  1931.     align = QuestData::HEADING_ALIGN[:level]
  1932.     x = align == 2 ? contents_width - 24 : align == 1 ? (contents_width-24)/2 : 0
  1933.     draw_icon(icon_index, x, @draw_y)
  1934.   end
  1935.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1936.   # * Draw Text Level
  1937.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1938.   def draw_level_text
  1939.     reset_font_settings
  1940.     level = QuestData::LEVEL_SIGNALS && QuestData::LEVEL_SIGNALS[@quest.level - 1] ?
  1941.       QuestData::LEVEL_SIGNALS[@quest.level - 1] : @quest.level.to_s
  1942.     align = QuestData::HEADING_ALIGN[:level]
  1943.     tw = text_size(QuestData::VOCAB[:level]).width + 4
  1944.     tw2 = text_size(level).width + 2
  1945.     space = contents_width - tw - tw2
  1946.     x = align == 2 ? space : align == 1 ? space / 2 : 0
  1947.     clear_and_draw_text(x, @draw_y, tw, line_height, QuestData::VOCAB[:level])
  1948.     set_data_font(:level_signal)
  1949.     clear_and_draw_text(x + tw, @draw_y, tw2, line_height, level, 2)
  1950.   end
  1951.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1952.   # * Draw Banner
  1953.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1954.   def draw_banner
  1955.     bmp = Cache.picture(@quest.banner) # Get Picture
  1956.     # Shift the hue if requested
  1957.     bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0
  1958.     x = (contents_width - bmp.rect.width) / 2
  1959.     if x < 0 # Stretch horizontally if the banner is too wide
  1960.       dest_rect = bmp.rect.dup
  1961.       dest_rect.width = contents_width
  1962.       contents.stretch_blt(dest_rect, bmp, bmp.rect)
  1963.     else
  1964.       contents.blt(x, @draw_y, bmp, bmp.rect)
  1965.     end
  1966.     bmp.dispose
  1967.   end
  1968.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1969.   # * Draw Description
  1970.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1971.   def draw_description
  1972.     buff = description_x*2
  1973.     paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
  1974.     y = @draw_y
  1975.     # Draw Rect
  1976.     draw_box(paragraph.scan(/\n/).size + 1) if QuestData::DESCRIPTION_IN_BOX
  1977.     # Draw Description Label
  1978.     draw_heading(:description, y) unless QuestData::VOCAB[:description].empty?
  1979.     # Draw Description
  1980.     y += line_height if !QuestData::VOCAB[:description].empty? || QuestData::DESCRIPTION_IN_BOX
  1981.     draw_text_ex(description_x, y, paragraph)
  1982.   end
  1983.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1984.   # * Draw Objectives
  1985.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1986.   def draw_objectives
  1987.     y = @draw_y
  1988.     unless QuestData::VOCAB[:objectives].empty?
  1989.       draw_heading(:objectives, y)
  1990.       y += line_height
  1991.     end
  1992.     @quest.revealed_objectives.each { |obj_id| y = draw_objective(obj_id, y) }
  1993.   end
  1994.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1995.   # * Draw Objective
  1996.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1997.   def draw_objective(obj_id, y)
  1998.     bullet = QuestData::VOCAB[:objective_bullet]
  1999.     bullet_tw = text_size(bullet).width + 2
  2000.     buff = (objective_x*2) + bullet_tw
  2001.     paragraph = mapf_format_paragraph(@quest.objectives[obj_id], contents_width - buff)
  2002.     line_num = 1 + paragraph.scan(/\n/).size
  2003.     # Since draw_text_ex resets the font, set colour here
  2004.     @maqj_objective_color = quest_objective_colour(@quest, obj_id)
  2005.     change_color(text_color(QuestData::COLOURS[:objective_bullet]))
  2006.     draw_text(objective_x, y, bullet_tw, line_height, sprintf(bullet, obj_id + 1))
  2007.     draw_text_ex(objective_x + bullet_tw, y, paragraph)
  2008.     @maqj_objective_color = false
  2009.     y += (line_num*line_height)
  2010.   end
  2011.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2012.   # * Draw Rewards
  2013.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2014.   def draw_rewards
  2015.     y = @draw_y
  2016.     unless QuestData::VOCAB[:rewards].empty?
  2017.       draw_heading(:rewards, y)
  2018.       y += line_height
  2019.     end
  2020.     for i in [email protected] do draw_reward(i, y + i*line_height) end
  2021.   end
  2022.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2023.   # * Draw Reward
  2024.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2025.   def draw_reward(r_id, y)
  2026.     reward = @quest.rewards[r_id]
  2027.     case reward[0]
  2028.     when :item, 0   # Item
  2029.       draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
  2030.     when :weapon, 1 # Weapon
  2031.       draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
  2032.     when :armor, 2  # Armor
  2033.       draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
  2034.     when :gold, 3   # Gold
  2035.       draw_basic_data(y, QuestData::ICONS[:reward_gold],
  2036.         QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
  2037.     when :exp, 4    # Exp
  2038.       draw_basic_data(y, QuestData::ICONS[:reward_exp],
  2039.         QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
  2040.     when :string, 5 # String
  2041.       draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3] : "",
  2042.         reward[2] ? reward[2] : "")
  2043.     end
  2044.   end
  2045.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2046.   # * Draw Item Reward
  2047.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2048.   def draw_item_reward(y, item, amount = 1)
  2049.     w = contents_width
  2050.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2051.     x = (contents_width - w) / 2
  2052.     draw_item_name(item, x, y, true, w - 40)
  2053.     if amount > 1
  2054.       change_color(text_color(QuestData::COLOURS[:reward_amount]))
  2055.       draw_text(x + w - 40, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
  2056.     end
  2057.   end
  2058.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2059.   # * Draw Basic Data Methods
  2060.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2061.   QuestData::BASIC_DATA_TYPES.each { |data_type|
  2062.     define_method(:"draw_#{data_type}") {
  2063.       draw_basic_data(@draw_y, QuestData::ICONS[data_type],
  2064.         QuestData::VOCAB[data_type], @quest.send(data_type))
  2065.     }
  2066.   }
  2067.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2068.   # * Draw Basic Data
  2069.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2070.   def draw_basic_data(y, icon_index, vocab, value)
  2071.     w = contents_width
  2072.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  2073.     x = (contents_width - w) / 2
  2074.     unless icon_index == 0
  2075.       draw_icon(icon_index, x, y)
  2076.       x += 24
  2077.       w -= 24
  2078.     end
  2079.     tw = text_size(vocab).width
  2080.     #change_color(text_color(QuestData::COLOURS[:basic_label]))
  2081.     draw_text(x, y, tw + 16, line_height, vocab)
  2082.     change_color(text_color(QuestData::COLOURS[:basic_value]))
  2083.     draw_text(x + tw, y, w - tw, line_height, value, 2)
  2084.   end
  2085.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2086.   # * Draw Heading
  2087.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2088.   def draw_heading(data_type, y)
  2089.     set_data_font(:heading)
  2090.     clear_and_draw_text(40, y, contents_width - 80, line_height,
  2091.       QuestData::VOCAB[data_type], QuestData::HEADING_ALIGN[data_type])
  2092.     reset_font_settings
  2093.   end
  2094.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2095.   # * Clear and Draw Text
  2096.   #    Clear the field before drawing the text
  2097.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2098.   def clear_and_draw_text(*args)
  2099.     rect = []
  2100.     while !args[0].is_a?(String) do rect.push(args.shift) end
  2101.     rect[0].is_a?(Rect) ? rect = rect[0] : rect = Rect.new(*rect)
  2102.     align = args[1] ? args[1] : 0
  2103.     ts = text_size(args[0])
  2104.     ts.width = [ts.width + 4, rect.width].min
  2105.     align == 1 ? ts.x = rect.x + ((rect.width - ts.width) / 2) :
  2106.       align == 2 ? ts.x = rect.x + rect.width - ts.width : ts.x = rect.x
  2107.     ts.y = rect.y
  2108.     contents.clear_rect(ts)
  2109.     ts.x += 2
  2110.     draw_text(ts, args[0], align)
  2111.   end
  2112.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2113.   # * Draw Description Box
  2114.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2115.   def draw_box(line_num)
  2116.     return if line_num < 1
  2117.     x = (line_height / 2) - 1
  2118.     y = @draw_y + (line_height / 2) - 1
  2119.     w = contents_width - 2*x
  2120.     h = (1 + line_num)*line_height
  2121.     draw_rect_outline_with_shadow(x, y, w, h)
  2122.   end
  2123.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2124.   # * Draw Rect Outline
  2125.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2126.   def draw_rect_outline(x, y, w, h, colour)
  2127.     # Horizontal Lines
  2128.     contents.fill_rect(x, y, w, 2, colour)
  2129.     contents.fill_rect(x, y + h - 2, w, 2, colour)
  2130.     # Vertical Lines
  2131.     contents.fill_rect(x, y, 2, h, colour)
  2132.     contents.fill_rect(x + w - 2, y, 2, h, colour)
  2133.   end
  2134.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2135.   # * Draw Rect Outline with Shadow
  2136.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2137.   def draw_rect_outline_with_shadow(x, y, w, h)
  2138.     draw_rect_outline(x + 1, y + 1, w, h, text_color(QuestData::COLOURS[:line_shadow]))
  2139.     draw_rect_outline(x, y, w, h, text_color(QuestData::COLOURS[:line]))
  2140.   end
  2141.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2142.   # * Objective/Description X
  2143.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2144.   def objective_x; line_height / 2; end
  2145.   def description_x; QuestData::DESCRIPTION_IN_BOX ? line_height : (line_height/2); end
  2146.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2147.   # * Update
  2148.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2149.   def update(*args, &block)
  2150.     super(*args, &block)
  2151.     if open? && active && @dest_scroll_oy == self.oy
  2152.       scroll_down if Input.press?(:DOWN)
  2153.       scroll_up if Input.press?(:UP)
  2154.     end
  2155.     if self.oy != @dest_scroll_oy
  2156.       mod = (@dest_scroll_oy <=> self.oy)
  2157.       self.oy += 3*mod
  2158.       self.oy = @dest_scroll_oy if (@dest_scroll_oy <=> self.oy) != mod
  2159.     end
  2160.   end
  2161.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2162.   # * Scroll Down
  2163.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2164.   def scroll_down(*args, &block)
  2165.     max_oy = contents_height - maqj_visible_height
  2166.     dest = ((@dest_scroll_oy / line_height) + 1)*line_height
  2167.     @dest_scroll_oy = [dest, max_oy].min
  2168.   end
  2169.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2170.   # * Scroll Up
  2171.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2172.   def scroll_up(*args, &block)
  2173.     dest = ((@dest_scroll_oy / line_height) - 1)*line_height
  2174.     @dest_scroll_oy = [dest, 0].max
  2175.   end
  2176. end

  2177. #==============================================================================
  2178. # ** Scene_Quest
  2179. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2180. #  This class handles processing for the Quest scene
  2181. #==============================================================================

  2182. class Scene_Quest < Scene_MenuBase
  2183.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2184.   # * Start Scene Processing
  2185.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2186.   def start
  2187.     super
  2188.     @init_category, @init_quest_index = $game_party.quests.find_location($game_system.last_quest_id, $game_system.last_quest_cat)
  2189.     create_maqj_picture unless $game_system.quest_bg_picture.empty?
  2190.     create_all_windows
  2191.     adjust_window_positions
  2192.   end
  2193.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2194.   # * Terminate Scene
  2195.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2196.   def terminate
  2197.     $game_system.quest_categories = QuestData::CATEGORIES
  2198.     $game_system.quest_scene_label = QuestData::VOCAB[:scene_label]
  2199.     $game_system.last_quest_id = @quest_list_window.item ? @quest_list_window.item.id : 0
  2200.     $game_system.last_quest_cat = @quest_category_window.item
  2201.     super
  2202.     dispose_maqj_picture
  2203.   end
  2204.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2205.   # * Create Background Picture
  2206.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2207.   def create_maqj_picture
  2208.     @maqj_picture_sprite = Sprite.new
  2209.     @maqj_picture_sprite.bitmap = Cache.picture($game_system.quest_bg_picture)
  2210.     @maqj_picture_sprite.opacity = $game_system.quest_bg_opacity
  2211.     @maqj_picture_sprite.blend_type = $game_system.quest_bg_blend_type
  2212.     @maqj_picture_sprite.z = @background_sprite.z + 1 if @background_sprite
  2213.   end
  2214.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2215.   # * Create All Windows
  2216.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2217.   def create_all_windows
  2218.     create_quest_label_window unless $game_system.quest_scene_label.empty?
  2219.     create_quest_category_window if $game_system.quest_categories.size > 1
  2220.     create_quest_category_label_window if QuestData::SHOW_CATEGORY_LABEL
  2221.     create_dummy_category_window if QuestData::CATEGORY_LABEL_IN_SAME_WINDOW &&
  2222.       @quest_category_window && @quest_category_label_window
  2223.     create_quest_list_window
  2224.     create_quest_data_window
  2225.   end
  2226.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2227.   # * Create QuestLabel Window
  2228.   #    This window shows the name of the scene
  2229.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2230.   def create_quest_label_window
  2231.     @quest_label_window = Window_QuestLabel.new(0, 0, $game_system.quest_scene_label)
  2232.   end
  2233.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2234.   # * Create QuestCategory Window
  2235.   #    This window allows the player to switch categories.
  2236.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2237.   def create_quest_category_window
  2238.     @quest_category_window = Window_QuestCategory.new(0, 0, $game_system.quest_categories)
  2239.     @quest_category_window.category = @init_category if @init_category
  2240.     @quest_category_window.set_handler(:cancel, method(:on_category_cancel))
  2241.     @quest_category_window.set_handler(:ok, method(:on_category_ok))
  2242.   end
  2243.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2244.   # * Create QuestCategoryLabel Window
  2245.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2246.   def create_quest_category_label_window
  2247.     if @quest_category_window
  2248.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, @quest_category_window.height)
  2249.       @quest_category_window.add_observing_proc(:label) { |category|
  2250.         @quest_category_label_window.category = category }
  2251.     else
  2252.       @quest_category_label_window = Window_QuestCategoryLabel.new(0, 0)
  2253.       @quest_category_label_window.category = $game_system.quest_categories ? $game_system.quest_categories[0] : :all
  2254.     end
  2255.   end
  2256.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2257.   # * Create Dummy Category Label Window
  2258.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2259.   def create_dummy_category_window
  2260.     @quest_category_label_window.y -= 12
  2261.     @quest_category_label_window.opacity = 0
  2262.     @quest_category_window.opacity = 0
  2263.     w = [@quest_category_window.width, @quest_category_label_window.width].max
  2264.     h = @quest_category_window.height + @quest_category_label_window.height - 12
  2265.     @category_dummy_window = Window_QuestCategoryDummy.new(0, 0, w, h)
  2266.     @category_dummy_window.z = [@quest_category_window.z, @quest_category_label_window.z].min - 1
  2267.     # Draw Horz Line
  2268.     @category_dummy_window.draw_horizontal_line(@quest_category_window.height - @quest_category_window.padding - 7, 2)
  2269.   end
  2270.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2271.   # * Create QuestList Window
  2272.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2273.   def create_quest_list_window
  2274.     if @category_dummy_window
  2275.       y = @category_dummy_window.height
  2276.     else
  2277.       y = @quest_category_window ? @quest_category_window.height : 0
  2278.       y += @quest_category_label_window ? @quest_category_label_window.height : 0
  2279.       y = @quest_label_window.height if y == 0
  2280.     end
  2281.     @quest_list_window = Window_QuestList.new(0, y, QuestData::LIST_WINDOW_WIDTH,
  2282.       Graphics.height - y)
  2283.     @quest_list_window.set_handler(:ok, method(:on_list_ok))
  2284.     if !QuestData::CONCURRENT_ACTIVITY
  2285.       @quest_list_window.deactivate
  2286.       @quest_list_window.set_handler(:cancel, method(:on_list_cancel))
  2287.     end
  2288.     if @quest_category_window
  2289.       @quest_category_window.add_observing_proc(:list) { |category|
  2290.         @quest_list_window.category = category }
  2291.     else
  2292.       @quest_list_window.category = $game_system.quest_categories[0]
  2293.     end
  2294.     @quest_list_window.index = @init_quest_index if @init_quest_index
  2295.   end
  2296.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2297.   # * Create QuestData Window
  2298.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2299.   def create_quest_data_window
  2300.     x = @quest_list_window.width
  2301.     y = (@quest_label_window && (@quest_category_window ||
  2302.       @quest_category_label_window)) ? @quest_label_window.height : 0
  2303.     @quest_data_window = Window_QuestData.new(x, y, Graphics.width - x,
  2304.       Graphics.height - y)
  2305.     @quest_list_window.help_window = @quest_data_window
  2306.     @quest_data_window.quest = @quest_list_window.item
  2307.     @quest_data_window.set_handler(:ok, method(:on_data_ok))
  2308.     @quest_data_window.set_handler(:cancel, method(:on_data_cancel))
  2309.   end
  2310.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2311.   # * Dispose Background Picture
  2312.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2313.   def dispose_maqj_picture
  2314.     @maqj_picture_sprite.dispose if @maqj_picture_sprite
  2315.   end
  2316.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2317.   # * Adjust Window Positions
  2318.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2319.   def adjust_window_positions
  2320.     if @quest_label_window && (@quest_category_window || @quest_category_label_window)
  2321.       @quest_label_window.x = QuestData::LIST_WINDOW_WIDTH
  2322.     end
  2323.   end
  2324.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2325.   # * Category OK
  2326.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2327.   def on_category_ok; @quest_list_window.activate; end
  2328.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2329.   # * Category Cancel
  2330.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2331.   def on_category_cancel; return_scene; end
  2332.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2333.   # * List OK
  2334.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2335.   def on_list_ok
  2336.     @quest_category_window.deactivate
  2337.     @quest_data_window.activate
  2338.   end
  2339.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2340.   # * List Cancel
  2341.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2342.   def on_list_cancel; @quest_category_window.activate; end
  2343.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2344.   # * Data OK
  2345.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2346.   def on_data_ok; on_data_cancel; end
  2347.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2348.   # * Data Cancel
  2349.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2350.   def on_data_cancel
  2351.     @quest_list_window.activate
  2352.     @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY
  2353.   end
  2354.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2355.   # * Update All Windows
  2356.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2357.   def update_all_windows(*args, &block)
  2358.     # To accomodate for concurrent activity, must deactivate category
  2359.     @quest_category_window.deactivate if QuestData::CONCURRENT_ACTIVITY &&
  2360.       @quest_list_window.active && Input.trigger?(:C)
  2361.     super(*args, &block)
  2362.     @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY &&
  2363.       @quest_list_window.active
  2364.   end
  2365. end

  2366. #==============================================================================
  2367. # ** Scene_Map
  2368. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2369. #  Summary of Changes:
  2370. #    aliased method - update_scene
  2371. #    new methods - update_call_quest_journal; call_quest_journal
  2372. #==============================================================================

  2373. class Scene_Map
  2374.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2375.   # * Update Scene
  2376.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2377.   alias maqj_updascne_9kh4 update_scene
  2378.   def update_scene(*args, &block)
  2379.     maqj_updascne_9kh4(*args, &block)
  2380.     update_call_quest_journal if $game_system.quest_map_access && !scene_changing?
  2381.   end
  2382.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2383.   # * Update Call Quest Journal
  2384.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2385.   def update_call_quest_journal
  2386.     if $game_map.interpreter.running?
  2387.       @quest_journal_calling = false
  2388.     else
  2389.       if Input.trigger?(QuestData::MAP_BUTTON)
  2390.         $game_system.quest_access_disabled || $game_party.quests.list.empty? ?
  2391.           Sound.play_buzzer : @quest_journal_calling = true
  2392.       end
  2393.       call_quest_journal if @quest_journal_calling && !$game_player.moving?
  2394.     end
  2395.   end
  2396.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2397.   # * Call Quest Journal
  2398.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2399.   def call_quest_journal
  2400.     @quest_journal_calling = false
  2401.     Sound.play_ok
  2402.     SceneManager.call(Scene_Quest)
  2403.   end
  2404. end

  2405. # Menu Access
  2406. if !$imported[:MA_InsertCommand]
  2407. # Initialize the Insertion Hash
  2408. MA_COMMAND_INSERTS = {}
  2409. MA_InsertableMenuCommand = Struct.new(:name, :index, :enable, :scene, :other)

  2410. #==============================================================================
  2411. # ** Game_System
  2412. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2413. #  Summary of Changes:
  2414. #    new public instance variable - maic_menu_commands
  2415. #    aliased method - initialize
  2416. #==============================================================================

  2417. class Game_System
  2418.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2419.   # * Inserted Menu Commands
  2420.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2421.   def maic_inserted_menu_commands
  2422.     # Lazy Instantiation so that old save files are not corrupted
  2423.     if !@maic_inserted_menu_commands
  2424.       @maic_inserted_menu_commands = MA_COMMAND_INSERTS.keys
  2425.       # Sort by index
  2426.       @maic_inserted_menu_commands.sort! { |a, b| MA_COMMAND_INSERTS[a].index <=> MA_COMMAND_INSERTS[b].index }
  2427.     end
  2428.     @maic_inserted_menu_commands
  2429.   end
  2430. end

  2431. #==============================================================================
  2432. # ** Window_MenuCommand
  2433. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2434. #  Summary of Changes:
  2435. #    aliased method - make_command_list; maic_insert_command
  2436. #==============================================================================

  2437. class Window_MenuCommand
  2438.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2439.   # * Make Command List
  2440.   #``````````````````````````````````````````````````````````````````````````
  2441.   #  I alias this method instead of add_original_commands because I need to
  2442.   # have all commands created before I can insert at the correct index
  2443.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2444.   alias maic_mkcmmndl_6yd2 make_command_list
  2445.   def make_command_list(*args, &block)
  2446.     maic_mkcmmndl_6yd2(*args, &block) # Run Original Method
  2447.     # Insert new commands
  2448.     $game_system.maic_inserted_menu_commands.each { |sym| maic_insert_command(sym) }
  2449.   end
  2450.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2451.   # * Insert Command
  2452.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2453.   def maic_insert_command(symbol)
  2454.     command = MA_COMMAND_INSERTS[symbol]
  2455.     # Get the command name
  2456.     name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
  2457.     # Check whether enabled
  2458.     enabled = case command.enable
  2459.     when Integer then command.enable == 0 ? true : $game_switches[command.enable]
  2460.     when String then eval(command.enable)
  2461.     when Symbol then self.send(command.enable)
  2462.     else
  2463.       enabled = true
  2464.     end
  2465.     # Add the command to the list
  2466.     add_command(name, symbol, enabled)
  2467.     added = @list.pop
  2468.     @list.insert([command.index, @list.size].min, added) # Insert at specific index
  2469.   end
  2470. end

  2471. #==============================================================================
  2472. # ** Scene_Menu
  2473. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2474. #  Summary of Changes:
  2475. #    aliased method - create_command_window; on_personal_ok
  2476. #    new methods - maic_set_insert_handler; maic_command_insert
  2477. #==============================================================================

  2478. class Scene_Menu
  2479.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2480.   # * Create Command Window
  2481.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2482.   alias maic_createcndwin_3ey7 create_command_window
  2483.   def create_command_window(*args, &block)
  2484.     maic_createcndwin_3ey7(*args, &block) # Run Original Method
  2485.     # Add handlers for all custom commands
  2486.     $game_system.maic_inserted_menu_commands.each { |symbol| maic_set_insert_handler(symbol) }
  2487.   end
  2488.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2489.   # * Set Inserted Handler
  2490.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2491.   def maic_set_insert_handler(symbol)
  2492.     other = MA_COMMAND_INSERTS[symbol].other
  2493.     handler = case other
  2494.     when Symbol then method(other)
  2495.     when String then lambda { eval(other) }
  2496.     when TrueClass then method(:command_personal)
  2497.     else
  2498.       handler = method(:maic_command_insert)
  2499.     end
  2500.     @command_window.set_handler(symbol, handler)
  2501.   end
  2502.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2503.   # * Custom Command
  2504.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2505.   def maic_command_insert
  2506.     SceneManager.call(Kernel.const_get(MA_COMMAND_INSERTS[@command_window.current_symbol].scene))
  2507.   end
  2508.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2509.   # * Personal OK
  2510.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2511.   alias maic_onpok_3ek9 on_personal_ok
  2512.   def on_personal_ok(*args, &block)
  2513.     if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
  2514.       maic_command_insert
  2515.     else
  2516.       maic_onpok_3ek9(*args, &block) # Run Original Method
  2517.     end
  2518.   end
  2519. end

  2520. $imported[:MA_InsertCommand] = true
  2521. end

  2522. MA_COMMAND_INSERTS[:quest_journal] =
  2523.   MA_InsertableMenuCommand.new(QuestData::VOCAB[:menu_label], QuestData::MENU_INDEX,
  2524.   "!$game_system.quest_access_disabled && !$game_party.quests.list.empty?",
  2525.   :Scene_Quest, false)
复制代码

  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_MissionBoard
  4. #------------------------------------------------------------------------------
  5. #  任务提示板
  6. #   by Harinlen
  7. #   暴力修改 by Azuneko
  8. #==============================================================================

  9. class Window_MissionBoard < Window_Command
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化指令选择位置(类方法)
  12.   #--------------------------------------------------------------------------
  13.   def self.init_command_position
  14.     @@last_command_symbol = nil
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 初始化对象
  18.   #--------------------------------------------------------------------------
  19.   def initialize
  20.     super(16, 100)
  21.     self.height = 416
  22.     self.opacity = 0
  23.     @data = []
  24.   end
  25.   
  26.   
  27.   def make_command_list
  28.     payload_all_mission
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 加载所有任务
  32.   #--------------------------------------------------------------------------
  33.   def payload_all_mission
  34.     $task_index = [0]
  35.     temp_task_enabled = true
  36.     temp_num = 1..1
  37.     case $game_variables[5]
  38.     when 0..17
  39.       temp_num = 5..6
  40.     when 18..25
  41.       temp_num = 5..9
  42.     when 26..99
  43.       temp_num = [8,10,11,12]
  44.     #when 11..99
  45.     #  temp_num = [1,2,4]
  46.     end
  47.     j = 0
  48.     for i in temp_num#1..MissionInfo::AllMissionNum
  49.       temp_task_enabled = !$game_party.quests.revealed?(i-1)
  50.       add_command(MissionInfo::AllMission[i]["name"],   :item,   temp_task_enabled)
  51.       $task_index[j] = i
  52.       j = j+1
  53.     end
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● 获取窗口的宽度
  57.   #--------------------------------------------------------------------------
  58.   def window_width
  59.     return 200
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 描绘图标
  63.   #--------------------------------------------------------------------------
  64.   def draw_item(index)
  65.     enabled = command_enabled?(index)
  66.     change_color(normal_color, enabled)
  67.     rect = item_rect_for_text(index)
  68.     text = command_name(index)
  69.     draw_text_icon(rect.clone, text, alignment, enabled, index)
  70.   end
  71.   def draw_text_icon(rect, text, alignment, enabled, index)
  72.     icon = $game_party.quests.revealed?($task_index[index]-1) ? 190 : 189
  73.     cw = text_size(text).width
  74.     draw_icon(icon, rect.x , rect.y, enabled)
  75.     rect.x -= 16
  76.     rect.width += 24
  77.     draw_text(rect, text, alignment)
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 按下确定键时的处理
  81.   #--------------------------------------------------------------------------
  82.   def process_ok
  83.     @@last_command_symbol = index
  84.     super
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 返回最后一个选项的位置
  88.   #--------------------------------------------------------------------------
  89.   def select_last
  90.     select(@@last_command_symbol)
  91.   end
  92. end


  93. class Window_Yescheckuse < Window_Command
  94.   def self.init_command_position
  95.     @@last_command_symbol = nil
  96.   end
  97.   def initialize
  98.     super(0, 0)
  99.     self.visible = false
  100.   end
  101.   def window_width
  102.       return 128
  103.   end
  104.   def make_command_list
  105.     tmplist
  106.   end
  107.   def tmplist
  108.     add_command("接受委托",   :getmission,   true)
  109.     add_command("取消", :cancel,   true)
  110.   end
  111. end

  112. class Window_MissionInfos < Window_QuestData #< Window_Base
  113.   #--------------------------------------------------------------------------
  114.   # ● 初始化对象
  115.   #--------------------------------------------------------------------------
  116.   def initialize
  117.     super(268, 24, 260, 414)#(160, 0, 384, 414)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 设置物品
  121.   #     item : 技能、物品等
  122.   #--------------------------------------------------------------------------
  123.   def set_index(index)
  124.     @text = MissionInfo::AllMission[1]["name"]
  125.     refresh
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 刷新
  129.   #--------------------------------------------------------------------------
  130.   def refresh
  131.     contents.clear
  132.     draw_text_ex(4, 0, @text)
  133.   end
  134.   
  135.   def draw_rewards(id,y)
  136.     @rewards = MissionInfo::AllMission[id]["rewards"]
  137.     for i in [email protected] do draw_reward(i, y + i*line_height) end
  138.   end
  139.   
  140.   def draw_reward(r_id, y)
  141.     reward = @rewards[r_id]
  142.     case reward[0]
  143.     when :item, 0   # Item
  144.       draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
  145.     when :weapon, 1 # Weapon
  146.       draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
  147.     when :armor, 2  # Armor
  148.       draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
  149.     when :gold, 3   # Gold
  150.       draw_basic_data(y, QuestData::ICONS[:reward_gold],
  151.         QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
  152.     when :exp, 4    # Exp
  153.       draw_basic_data(y, QuestData::ICONS[:reward_exp],
  154.         QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
  155.     when :string, 5 # String
  156.       draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3] : "",
  157.         reward[2] ? reward[2] : "")
  158.     end
  159.   end
  160.   
  161.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162.   # * Draw Item Reward
  163.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  164.   def draw_item_reward(y, item, amount = 1)
  165.     w = contents_width
  166.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  167.     x = (contents_width - w) / 2
  168.     draw_item_name(item, x, y, true, w - 40)
  169.     if amount > 1
  170.       change_color(text_color(QuestData::COLOURS[:reward_amount]))
  171.       draw_text(x + w - 140, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
  172.     end
  173.   end
  174.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175.   # * Draw Basic Data Methods
  176.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177.   QuestData::BASIC_DATA_TYPES.each { |data_type|
  178.     define_method(:"draw_#{data_type}") {
  179.       draw_basic_data(@draw_y, QuestData::ICONS[data_type],
  180.         QuestData::VOCAB[data_type], @quest.send(data_type))
  181.     }
  182.   }
  183.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  184.   # * Draw Basic Data
  185.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  186.   def draw_basic_data(y, icon_index, vocab, value)
  187.     w = contents_width
  188.     w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
  189.     x = (contents_width - w) / 2
  190.     unless icon_index == 0
  191.       draw_icon(icon_index, x, y)
  192.       x += 24
  193.       w -= 24
  194.     end
  195.     tw = text_size(vocab).width
  196.     #change_color(text_color(QuestData::COLOURS[:basic_label]))
  197.     draw_text(x, y, tw + 16, line_height, vocab)
  198.     change_color(text_color(QuestData::COLOURS[:basic_value]))
  199.     draw_text(x + tw - 100, y, w - tw, line_height, value, 2)
  200.   end
  201.   
  202.   def draw_mission_details(id)
  203.     contents.clear
  204.     change_color(text_color(6))
  205.     draw_text(4, 0, self.width, line_height, MissionInfo::AllMission[id]["name"])
  206.     change_color(text_color(6))
  207.     draw_text(4, 30, self.width, line_height, "委托人:")
  208.     change_color(normal_color)
  209.     draw_text_ex(4, 55, MissionInfo::AllMission[id]["client"])
  210.     change_color(text_color(6))
  211.     draw_text(4, 80, self.width, line_height, "地点:")
  212.     change_color(normal_color)
  213.     draw_text_ex(4, 105, MissionInfo::AllMission[id]["location"])
  214.     change_color(text_color(6))
  215.     draw_text(4, 130, self.width, line_height, "委托描述:")
  216.     change_color(normal_color)
  217.     draw_text_ex(4, 155, MissionInfo::AllMission[id]["description"])
  218.     change_color(text_color(6))
  219.     draw_text(4, 226, self.width, line_height, "委托奖励:")
  220.     change_color(normal_color)
  221.     draw_rewards(id, 249)
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 设置内容
  225.   #--------------------------------------------------------------------------
  226.   def set_text(text)
  227.     if text != @text
  228.       @text = text
  229.       refresh
  230.     end
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● 清除
  234.   #--------------------------------------------------------------------------
  235.   def clear
  236.     set_text("")
  237.   end
  238. end

  239. class Scene_Mission < Scene_MenuBase
  240.   #--------------------------------------------------------------------------
  241.   # ● 开始处理
  242.   #--------------------------------------------------------------------------
  243.   def start
  244.     super
  245.     create_helpwin
  246.     create_mission_board
  247.     create_yeslist
  248.     create_board_bg
  249.     @last_mission_id = -1
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ☆ 生背景图形
  253.   #--------------------------------------------------------------------------
  254.   def create_board_bg
  255.     @menuback_sprite = Sprite.new
  256.     @menuback_sprite.bitmap = Cache.system("taskboard")
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● 生成指令窗口
  260.   #--------------------------------------------------------------------------
  261.   def create_mission_board
  262.     @mission_window = Window_MissionBoard.new
  263.     @mission_window.help_window = @mission_window_help
  264.     @mission_window.set_handler(:ok,    method(:on_personal_ok))
  265.     @mission_window.set_handler(:cancel,    method(:return_scene))
  266.   end
  267.   def create_helpwin
  268.     @mission_window_help = Window_MissionInfos.new
  269.   end
  270.   def create_yeslist
  271.     @mission_yes = Window_Yescheckuse.new
  272.     @mission_yes.x = 208#360
  273.     @mission_yes.y = 192#300
  274.     @mission_yes.set_handler(:ok,        method(:okpress))
  275.     @mission_yes.set_handler(:cancel,    method(:quxiao))
  276.   end
  277.   def okpress
  278.     $game_party.quests[@last_mission_id-1]
  279.     @interpreter2 = Game_Interpreter.new
  280.     @interpreter2.reveal_objective(@last_mission_id-1,0)
  281.     @mission_yes.unselect
  282.     @mission_yes.hide.deactivate
  283.     @mission_window.activate
  284.     @mission_window.select_last
  285.     @mission_window.refresh
  286.   end
  287.   def quxiao
  288.     @mission_yes.unselect
  289.     @mission_yes.hide.deactivate
  290.     @mission_window.activate
  291.     @mission_window.select_last
  292.   end
  293.   def on_personal_ok
  294.     @mission_window.unselect
  295.     @mission_yes.show.activate
  296.     @mission_yes.select(0)
  297.   end
  298.   def update
  299.     super
  300.     if @mission_window.index >= 0
  301.       @mission_window_help.draw_mission_details($task_index[@mission_window.index])
  302.       @last_mission_id = $task_index[@mission_window.index]#@mission_window.index
  303.     end
  304.   end
  305.   #GSR 1.5
  306.   alias gsr_terminate terminate
  307.   def terminate
  308.       super
  309.       @menuback_sprite.dispose if @menuback_sprite
  310.   end
  311. end
复制代码
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
354
在线时间
127 小时
注册时间
2016-10-8
帖子
72
5
发表于 2017-7-31 22:30:15 | 只看该作者
先感謝提供腳本,不過大大…
您沒說鑲入腳本的順序呀,報錯了哦~

另外,想麻煩您點擊 <> 來寫入腳本,
這一大串看了眼好疼...

点评

看了一下啊顺序对的。还以为脚本真的顺序错了。报错是报了什么  发表于 2017-8-2 16:09
(´_ゝ`)...仍未命名的遊戲製作進度:0
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
18 小时
注册时间
2017-2-15
帖子
1
6
发表于 2017-8-2 16:07:32 | 只看该作者
图书馆里就有,去图书馆看看吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
5 小时
注册时间
2017-7-28
帖子
8
7
 楼主| 发表于 2017-8-18 21:20:32 | 只看该作者

额,那个300英雄大大,真不好意思,首先谢谢你愿意教我,我这段时间没有看,能现在教我吗?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 18:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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