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

Project1

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

[已经过期] rpg怎样制作接任务?截图最好!谢谢!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
15
在线时间
0 小时
注册时间
2018-4-28
帖子
1
跳转到指定楼层
1
发表于 2018-4-28 16:20:06 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
rpg怎样制作接任务?截图最好!谢谢!萌新求教!!1!!1
rpg怎样制作接任务?截图最好!谢谢!萌新求教!!1!!1

Lv3.寻梦者

梦石
0
星屑
2333
在线时间
275 小时
注册时间
2017-7-25
帖子
163
2
发表于 2018-4-28 17:03:23 | 只看该作者
有类似任务系统的脚本
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
549
在线时间
59 小时
注册时间
2017-11-19
帖子
71
3
发表于 2018-4-29 18:59:26 | 只看该作者
去看一下图书馆
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
382
在线时间
36 小时
注册时间
2018-4-14
帖子
51
4
发表于 2018-5-5 11:00:51 | 只看该作者

#任务Module by Harinlen

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

module MissionInfo
  AllMissionNum = 99
  AllMission = Array.new
  AllMission[1] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS一",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "试炼迷宫",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[2] = {
      "icon_index" =>      0,
      "name" => "寻找秘籍",
      "description" =>"首志师兄的秘籍不见了!",
      "level" => 6,
      "objectives0" =>   "帮师兄留意下吧!",
      "objectives1" =>   "首一师兄有点可疑!",
      "objectives2" =>   "首一师兄将秘籍买了?",
      "objectives3" =>   "正是无商不奸!",
      "objectives4" =>   "物归原主!",
      "objectives5" =>   "好心有好报!",
      "prime_objectives" => [0, 1, 2, 3, 4, 5],
      "client" =>          "首志",
      "location" =>        "天空之城",
      "common_event_id" => 0,
      "rewards" =>         [
        [:gold, 20000],
        [:armor, 160, 1]
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[3] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS二",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "森林沼泽",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[4] = {
      "icon_index" =>      0,
      "name" => "野猫野狗",
      "description" =>     "最近村里出现一些烦人的野猫野狗!",
      "level" => 2,
      "objectives0" =>   "赶走野猫野狗!",
      "objectives1" =>   "完成任务!",
      "prime_objectives" => [0, 1],
      "client" =>          "村民",
      "location" =>        "雾山村",
      "common_event_id" => 0,
      "rewards" =>         [
        [:item, 131, 5],
        [:item, 132, 5],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[5] = {
      "icon_index" =>      0,
      "name" => "捉迷藏",
      "description" =>     "陪小朋友们玩捉迷藏。",
      "level" => 2,
      "objectives0" =>   "找到藏起来的小朋友。",
      "objectives1" =>   "完成任务!",
      "prime_objectives" => [0, 1],
      "client" =>          "小女孩",
      "location" =>        "雾山村",
      "common_event_id" => 0,
      "rewards" =>         [
       [:armor, 75, 1],
       [:item, 314, 1],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[6] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS三",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "鬼阴山",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[7] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS四",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "迷幻森林",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[8] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS五",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "隐秘山洞",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[9] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS六",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "天罗山",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[10] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS七",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "封魔塔",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[11] = {
      "icon_index" =>      0,#任务编号
      "name" => "妖魔异动",#任务名称
      "description" =>     "封魔塔中妖魔受邪气滋扰蠢蠢欲动!",#任务说明
      "level" => 3,
      "objectives0" =>   "调查封魔塔!",#任务目标1
      "objectives1" =>   "成功封印妖魔!",#任务目标2
      "objectives2" =>   "完成任务!",#任务目标2
      "prime_objectives" => [0, 1, 2],#全部完成任务目标进度
      "client" =>          "素宁",#任务发布人
      "location" =>        "封魔塔",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 317, 5],#任务奖励(1号物品,3个)
        [:item, 314, 4],#任务奖励(4号物品,2个)
        [:gold, 15000],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[12] = {
      "icon_index" =>      0,
      "name" => "爱情故事",
      "description" =>     "无意中听到了一个爱情故事。",
      "level" => 5,
      "objectives0" =>   "有机会的话去看看那个男人是不是还在等着。",
      "objectives1" =>   "可怜的男人,就帮他寻找妻子吧",
      "objectives2" =>   "原来他的妻子被冰封了!想办法解除冰封。",
      "objectives3" =>   "打败妖魔。",
      "objectives4" =>   "有情人终成眷属!",
      "prime_objectives" => [0, 1, 2, 3, 4],
      "client" =>          "薛兰兰",
      "location" =>        "天女宫",
      "common_event_id" => 0,
      "rewards" =>         [
       [:weapon, 69, 1],
       [:armor, 69, 1],
       [:exp, 33500],
      ],
      "layout" =>          false,
      "haveget" =>         false,
}
  AllMission[13] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS八",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "神绛秘境",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[14] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS九",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "神绛秘境",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[15] = {
      "icon_index" =>      0,#任务编号
      "name" => "清音的思念",#任务名称
      "description" =>     "清音似乎有些秘密......",#任务说明
      "level" => 8,
      "objectives0" =>   "以后多留意一下清音。",#任务目标1
      "objectives1" =>   "清音不比我难过!",#任务目标2
      "objectives2" =>   "坚强的女孩!",#任务目标2
      "objectives3" =>   "以后多留意清音下。",#任务目标2
      "objectives4" =>   "以后多留意清音下。",#任务目标2
      "objectives5" =>   "以后多留意清音下。",#任务目标2
      "objectives6" =>   "以后多留意清音下。",#任务目标2
      "objectives7" =>   "以后多留意清音下。",#任务目标2
      "prime_objectives" => [0, 1, 2, 3, 4, 5, 6, 7],#全部完成任务目标进度
      "client" =>          "清音",#任务发布人
      "location" =>        "剧情",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 10],#任务奖励(1号物品,3个)
        [:item, 402, 10],#任务奖励(4号物品,2个)
        [:exp, 100000],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[16] = {
      "icon_index" =>      0,
      "name" => "神魔纠缠",
      "description" =>     "璇玉在思念着谁,魔?",
      "level" => 5,
      "objectives0" =>   "以后多留意一下吧!",
      "objectives1" =>   "..........",
      "objectives2" =>   "..........",
      "objectives3" =>   "..........",
      "objectives4" =>   "..........",
      "prime_objectives" => [0, 1, 2, 3, 4],
      "client" =>          "璇玉",
      "location" =>        "神绛秘境",
      "common_event_id" => 0,
      "rewards" =>         [
       [:armor, 161, 1],
      ],
      "layout" =>          false,
      "haveget" =>         false,
}
AllMission[17] = {
      "icon_index" =>      0,
      "name" => "收集火灵",
      "description" =>     "帮清影收集神火灵。",
      "level" => 3,
      "objectives0" =>   "帮清影收集30个神火灵。",
      "objectives1" =>   "已收集够30个神火灵!",
      "objectives2" =>   "任务完成!",
      "prime_objectives" => [0, 1, 2],
      "client" =>          "清影",
      "location" =>        "神绛秘境",
      "common_event_id" => 0,
      "rewards" =>         [
       [:armor, 78, 1],
       [:gold, 5000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
}
AllMission[18] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS十",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "神绛秘境",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[19] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS十一",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "神绛秘境",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[20] = {
      "icon_index" =>      0,#任务编号
      "name" => "隐藏BOSS十二",#任务名称
      "description" =>     "由于封印之剑力量减弱,被封印的妖魔逃往人间作乱!",#任务说明
      "level" => 2,
      "objectives0" =>   "前往击杀BOSS!",#任务目标1
      "objectives1" =>   "成功击杀妖魔!",#任务目标2
      "prime_objectives" => [0, 1],#全部完成任务目标进度
      "client" =>          "封印之剑",#任务发布人
      "location" =>        "神绛秘境",#任务地点
      "common_event_id" => 0,
      "custom_categories" => [],
      "banner" => "",
      "banner_hue" => 0,
      "rewards" =>         [
        [:item, 401, 1],#任务奖励(1号物品,3个)
        [:item, 402, 1],#任务奖励(4号物品,2个)
        [:gold, 1500],#任务奖励(金钱,150)
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[21] = {
      "icon_index" =>      0,
      "name" => "妖魔逃脱",
      "description" =>     "太真师伯看守的妖魔逃脱了!",
      "level" => 3,
      "objectives0" =>   "答应师伯抓回逃脱的妖魔!",
      "objectives1" =>   "抓回逃脱的妖魔!",
      "objectives2" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2],
      "client" =>          "凌霄台",
      "location" =>        "太真",
      "common_event_id" => 0,
      "rewards" =>         [
       [:armor, 79, 1],
       [:item, 314, 1],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
   AllMission[22] = {
      "icon_index" =>      0,
      "name" => "替鬼伸冤",
      "description" =>     "冤死鬼有冤难伸!",
      "level" => 4,
      "objectives0" =>   "答应冤死鬼去找判官!",
      "objectives1" =>   "贪腐的判官!",
      "objectives2" =>   "恶有恶报!",
      "objectives3" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2, 3],
      "client" =>          "鬼界",
      "location" =>        "冤死鬼",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 401, 5],
       [:item, 402, 5],
       [:exp, 20000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[23] = {
      "icon_index" =>      0,
      "name" => "指导修炼",
      "description" =>     "指导志清修炼法术技能",
      "level" => 3,
      "objectives0" =>   "指导志清修炼法术技能的方法!",
      "objectives1" =>   "学而有成!",
      "objectives2" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2],
      "client" =>          "志清",
      "location" =>        "天空之城",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 23, 5],
       [:item, 32, 5],
       [:exp, 1000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[24] = {
      "icon_index" =>      0,
      "name" => "炼制仙药",
      "description" =>     "苍明师叔又在研制新药",
      "level" => 4,
      "objectives0" =>   "师叔又要炼制新药!",
      "objectives1" =>   "给师叔3棵止血草!",
      "objectives2" =>   "新药炼制成功!",
      "objectives3" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2, 3],
      "client" =>          "苍明",
      "location" =>        "天空之城",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 51, 3],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[25] = {
      "icon_index" =>      0,
      "name" => "妖之执念",
      "description" =>     "妖也有自己的执念",
      "level" => 7,
      "objectives0" =>   "云仙居发现一只狐妖!",
      "objectives1" =>   "带狐妖离开!",
      "objectives2" =>   "与狐妖结下缘!",
      "objectives3" =>   "神秘的狗狗!",
      "objectives4" =>  "狐妖的宝藏?",
      "objectives5" =>   "狐妖报恩!",
      "objectives6" =>   "支线结束!",
      "prime_objectives" => [0, 1, 2, 3, 4, 5, 6],
      "client" =>          "狐妖",
      "location" =>        "天空之城",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 53, 3],
       [:armor, 86, 1],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
   AllMission[26] = {
      "icon_index" =>      0,
      "name" => "神秘剑侠",
      "description" =>     "神秘的剑侠隐藏惊天秘密!",
      "level" => 6,
      "objectives0" =>   "御剑峰有一位神秘剑侠!",
      "objectives1" =>   "奇怪的话语!",
      "objectives2" =>   "玄天霄有何秘密?!",
      "objectives3" =>   "玄天霄竟然是--!",
      "objectives4" =>  "亲人的思念?",
      "objectives5" =>   "支线结束!",
      "prime_objectives" => [0, 1, 2, 3, 4, 5],
      "client" =>          "神秘剑侠",
      "location" =>        "天空之城",
      "common_event_id" => 0,
      "rewards" =>         [
       [:weapon, 70, 1],
       [:armor, 70, 1],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[27] = {
      "icon_index" =>      0,
      "name" => "收集仙灵",
      "description" =>     "帮助志颖师弟收集土元之灵。",
      "level" => 4,
      "objectives0" =>   "志颖师弟奉命收集土元之灵!",
      "objectives1" =>   "帮师弟收集3个土元之灵!",
      "objectives2" =>   "土元之灵已收齐!",
      "objectives3" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2, 3],
      "client" =>          "志颖",
      "location" =>        "通天道",
      "common_event_id" => 0,
      "rewards" =>         [
      [:item, 23, 5],
       [:item, 32, 5],
       [:exp, 2000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  AllMission[28] = {
      "icon_index" =>      0,
      "name" => "打败精灵",
      "description" =>     "云仙居的妖怪受到精灵的欺负,想要报复他们!",
      "level" => 3,
      "objectives0" =>   "答应啸狼教训那些精灵!",
      "objectives1" =>   "已教训完那些精灵!",
      "objectives2" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2],
      "client" =>          "啸狼",
      "location" =>        "云仙居",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 403, 5],
       [:exp, 500],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  
   AllMission[29] = {
      "icon_index" =>      0,
      "name" => "山村巨变",
      "description" =>     "雾山村遭妖魔袭击后,村民误将村长一家当成了妖魔!",
      "level" => 4,
      "objectives0" =>   "答应救出小狗子!",
      "objectives1" =>   "教训无知的村民!",
      "objectives2" =>   "将小狗子安置在天空之城!",
      "objectives3" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2, 3],
      "client" =>          "花花",
      "location" =>        "雾山村",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 204, 1],
       [:exp, 5000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
  
  AllMission[30] = {
      "icon_index" =>      0,
      "name" => "姐妹情深",
      "description" =>     "天女宫侍女与天界侍女的姐妹深情!",
      "level" => 4,
      "objectives0" =>   "答应天女宫侍女送信给天界的侍女玄冰!",
      "objectives1" =>   "玄冰已在神魔大战中香消玉殒!",
      "objectives2" =>   "姐妹情深,唯有深深地思念!",
      "objectives3" =>   "完成任务!",
      "prime_objectives" => [0, 1, 2, 3],
      "client" =>          "侍女",
      "location" =>        "天女宫",
      "common_event_id" => 0,
      "rewards" =>         [
       [:item, 166, 10],
       [:exp, 50000],
      ],
      "layout" =>          false,
      "haveget" =>         false,
  }
end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
382
在线时间
36 小时
注册时间
2018-4-14
帖子
51
5
发表于 2018-5-5 11:01:38 | 只看该作者
#==============================================================================
#    任务向导 [VXA]
#    版本: 1.0.3
#    作者: modern algebra (rmrk.net)
#    日期: 24 September 2012
#   
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  描述:
#      该脚本为你提供了一个显示任务进度的图形化界面。它是基于目标的,这意味着你能够
#选择何时呈现任务目标,并能对它进行设置以便显示任务的成功或失败。也就是说,该脚本并
#不直接为你制作任务,它仅仅是一个显示任务的补充界面。因此,所有的任务事件都需要你自
#己制作,并通过脚本调用更新任务进度。所以,你要仔细阅读脚本介绍和介于代码第232行到第
#612行之间的可编辑区域。
#   
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  介绍:
#       把该脚本粘贴到位于Main上方,Materials下方的一个或多个槽位中。如果你已经使用
#了菜单修改脚本,你必须把其他所有菜单脚本放到该脚本上方。
#       所有的配置都是在QuestData模块中完成的。即便这不是必要的,但我仍建议你把配置
#模块从脚本中剪切出来并粘贴到脚本编辑器中的另一个槽位里。这么做的原因是,当该脚本被
#更新时,你能够保留配置部分,只替换脚本的其他部分。如果你愿意的话,你可以在位于第232
#行的可编辑区域A配置脚本的默认设置。即使你不更改配置,脚本也能正常运作。但是,即使你
#现在不打算进行配置,你也应该熟悉一下所有的设置项,只有这样你才能使脚本物尽其用。脚
#本中包含非常多的设置项,这使得你能把它配置成你游戏中独一无二的任务手册。这些设置项
#甚至细化到信息窗口的每个部分的绘制顺序。每个设置项或者常量旁边都有一个简短的描述。
#       可编辑区域B可以说是整个脚本的真正核心——你可以在这里填写任务的一切细节。一
#定要仔细阅读第612行的介绍!
#       你能通过脚本事件命令中的这些代码来激活并写入任务:
#
#        quest(quest_id)
#          quest_id:你想写入的任务的编号(整数)
#      
#       通过以上代码,你能够写入或改变任何存储在任务中的相应数据,比如任务名,描述,
#目标,等等。范例:
#
#        quest(1).name = "Rest in Pieces"
#
#       更贴切地说,你能通过下面的代码来控制任务的进度。每个命令的参数都是相同的,因
#此我只解释一次。它们都是不言自明的,使用它们中的任意一条代码都会激活任务。(除非你
#使用了位于第267行的MANUAL REVEAL(手动显示)设置)
#
#        reveal_objective(quest_id, objective_id_1, ..., objective_id_n)
#            quest_id:你想写入的任务的编号(整数)
#            objective_id_1, ..., objective_id_n :达成任务所需要的一系列目标的编
#号(整数)。可以只有一个,也可以是全部。它将会在任务信息中列出目标。
#
#        conceal_objective(quest_id, objective_id_1, ..., objective_id_n)
#          它会隐藏任务信息中的目标列表
#
#        complete_objective(quest_id, objective_id_1, ..., objective_id_n)
#          改变目标为已完成的颜色。所有主要目标完成后,任务将会完成。
#
#        uncomplete_objective (quest_id, objective_id_1, ..., objective_id_n)
#          将已完成目标变为未完成状态。  
#
#        fail_objective(quest_id, objective_id_1, ..., objective_id_n)
#          改变目标为失败的颜色。只要有一个目标失败,任务就会失败。
#
#        unfail_objective(quest_id, objective_id_1, ..., objective_id_n)
#          将失败的目标变为未失败状态。
#
#        change_reward_status(quest_id, value)
#          value:可以是true或者false。如果未填写,则默认为true。完全是可选的,但这
#只是个人开关,你可以在给予奖励时开启它。然后你可以把它作为条件,来避免玩家重复获得奖
#励。(见第180行)
#
#  范例:
#    reveal_objective(1, 0)
#      显示编号为1的任务的第一个目标
#    complete_objective(6, 2, 3)
#      完成编号为6的任务的第三和第四个目标。 (0号是第一个,以此类推)
#    change_reward_status(8)
#      把编号为8的任务的奖励开关设置为true(打开)
#
#      新特色:你能让奖励显示在菜单上(见可编辑区域 B)。补充说明:你可以用以下代码
#来自动给已完成并且尚未给予奖励的任务分配指定奖励。
#
#        distribute_quest_rewards(quest_id)
#           quest_id :你想为编号为多少的任务分配奖励

#
#   当然,它只能分配物质奖励(物品,武器,铠甲,金钱,或者经验)。它不会分配你通过字
#符串指定的奖励。为此,你可以在条件分支中使用这个代码。(我并不建议你使用这个功能,
#因为我觉得通过事件来指定奖励更好)
#
#   另外一些有用的代码:
#   
#        reset_quest(quest_id)
#          quest_id:你想写入的任务的编号(整数)
#          它会重新初始化任务,即任务到目前为止的所有进度都会丢失。
#
#        delete_quest(quest_id)
#        取消激活并重置任务
#
#        conceal_quest(quest_id)
#          取消激活并隐藏任务,但是任务进度会被保存
#
#        reveal_quest(quest_id)
#          激活或重新激活任务。注意,如果位于第284行的MANUAL_REVEAL(手动显示)选项
#为true(开启)或者该任务之前已经被隐藏,则该命令是必不可少的。否则的话,对于任务操
#作来说它已经足够了。
#
#        change_quest_access(:symbol)
#            “:symbol”必须是以下六个选项中的一个(一定不能漏掉“:”):
#            “:disable”不允许在任务菜单上进入该任务(菜单项变灰)
#            “:enable”允许在任务菜单上进入该任务
#            “:disable_menu”从任务菜单上移除该任务
#            “:enable_menu”在任务菜单上显示该任务
#            “:disable_map”不允许在地图上通过按键进入任务菜单
#            “:enable_map”允许在地图上通过按键进入任务菜单
#
#        change_quest_background("bg_filename", bg_opacity, bg_blend_type)
#            改变任务背景图片
#            bg_filename   背景图片的文件名,背景图片应放入游戏目录的Pictures文件
#                          夹内
#            bg_opacity    设置背景图片的不透明度。如果未包含该参数,则默认与位于
#                          第434行的设置项的值相同
#            bg_blend_type 设置背景图片的混合类型。如果未包含该参数,则默认与位于
#                          第437行的设置项的值相同
#
#        change_quest_windows ("windowskin_filename", tone, opacity)
#            改变任务窗口
#            windowskin_filename 窗口图片的文件名,窗口图片应放入游戏目录的
#                                Graphics文件夹内
#            opacity             设置窗口图片的不透明度。如果未包含该参数,则默认
#                                与位于第423行的设置项的值相同
#            blend_type          设置窗口图片的混合类型。如果未包含该参数,则默认
#                                与位于第426行的设置项的值相同
#
#    在脚本命令中,有一些代码能够用于条件分支。我在此提醒,所有这些都是可选的。
#    你也可以使用开关和变量检查,仅仅通过事件来监控任务的进度。不过,这些命令
#    比事件更易于使用,它们是:
#
#
#        quest_revealed?(quest_id)
#            quest_id :你想写入的任务的编号(整数)
#          它用于判断任务是否被激活
#          This is satisfied if the quest has been activated.
#
#        quest_complete?(quest_id)
#          它用于判断任务的所有主要目标是否都被完成
#          This is satisfied if all prime objectives of the quest are complete
#
#        quest_failed?(quest_id)
#          它用于判断任务的主要目标中是否有任意一个失败
#          This is satisfied if any prime objective of the quest is failed
#
#        quest_rewarded?(quest_id)
#          它用于判断任务奖励是否已被分配
#          This is satisfied if you have changed the reward status to true.
#
#        objective_revealed?(quest_id, objective_id_1, ... objective_id_n)
#          objective_id_1, ..., objective_id_n :达成任务所需要的一系列目标的编号
#                                               (整数)
#          可以只有一个,也可以是全部。
#          它用于判断目标列表是否已被显示
#
#        objective_active?(quest_id, objective_id_1, ... objective_id_n)
#          它用于判断所有被列出的目标是否已被显示并且它们既没有完成也没有失败
#
#        objective_complete?(quest_id, objective_id_1, ... objective_id_n)
#          它用于判断所有被列出的目标是否都已完成
#
#        objective_failed?(quest_id, objective_id_1, ... objective_id_n)
#          它用于判断所有被列出的目标是否已经失败
#
#          如果你想从事件中调用任务菜单,应在脚本中使用下面的代码:
#
#        call_quest_journal
#        call_quest_journal(quest_id)
#          quest_id : 你想打开任务窗口的任务所对应的编号
#
#      如果你没有指定任务编号(第198行),它只会按通常的情况打开任务窗口。如果你
#  指定了任务编号(第199行),只要该任务已经显示出来,并能通过菜单进入,它就会打开该
#  任务的窗口。
#
#      最后,在默认设置下,任务基于主要目标的完成情况而自动完成或失败。但是你也通过
#  设置使得任务没有主要目标,在这种情况下,你只能通过以下代码,在脚本调用中手动使得
#  任务完成、失败,或者(重)激活任务:
#
#        manually_complete_quest(quest_id)
#          quest_id : 你想手动完成的任务编号
#        manually_fail_quest(quest_id)
#          quest_id : 你想手动使其失败的任务编号
#        manually_activate_quest(quest_id)
#          quest_id : 你想手动激活的任务编号
#==============================================================================
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
382
在线时间
36 小时
注册时间
2018-4-14
帖子
51
6
发表于 2018-5-5 11:02:46 | 只看该作者
#==============================================================================
#    Quest Journal [VXA]
#    Version: 1.0d
#    Author: modern algebra (rmrk.net)
#    Date: February 27, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script provides a graphical interface for showing quest progress. It
#   is objective-based, meaning that you choose when to reveal objectives and
#   you can set it so that they show up as complete or failed. That said, this
#   script does not build quests for you; it is only a supplementary scene for
#   showing them. As such, you need to event all of the quests yourself and
#   update quest progress via script call. Therefore, pay close attention to
#   the instructions here and in the Editable Regions at lines 232 and 612.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot or slots, above Main and below
#   Materials. If you are using the menu access feature, you should put any
#   other menu scripts above this one.
#
#    All of the configuration is done in the QuestData module. While it is not
#   necessary, it is recommended that you separate the configuration module
#   from the rest of the script by cutting and pasting it into its own slot in
#   the Script Editor (as you will see if you have the demo). The reason for
#   this is that, if and when this script gets updated, you can preserve the
#   configuration section and only replace the other parts of the script. If
#   you wish to do that, you must cut everything from the first line down to
#   the final end of the module. The first lines of the body script should be
#   the equals bar right above # ** Game_Quest. Again, it's up to you whether
#   you do it.
#
#    You can go to EDITABLE REGION A at line 232 to configure the default
#   settings for the script. All of these will work fine without modification,
#   of course, but even if do not want to configure now, you should familiarize
#   yourself with all the settings so that you can make the best use of your
#   script. I have included tons of settings so that you can make the Quest
#   Journal unique for your game, even down to the order in which each section
#   of the info window is drawn. A brief description of each setting is
#   included either to the right or directly above each constant.
#
#    EDITABLE REGION B is the real heart of the script however - this is where
#   you fill in all of the details for the quests. Read the instructions at
#   line 612 very carefully!
#
#    You can activate and access a quest with this code in the Script event
#   command:
#
#        quest(quest_id)
#          quest_id : the integer ID of the quest you want to access
#
#   From that, you can access or alter any relevant data stored in the quest,
#   like name, description, objectives, etc... Example:
#         quest(1).name = "Rest in Pieces"
#
#    More relevantly, when it comes to controlling the progress of quests the
#   following codes can be used in a Script event command. The arguments are
#   the same for each command so I only explain them once. All of them are
#   pretty self-explanatory and using any of them will activate the quest
#   (unless you are using the MANUAL REVEAL setting at line 267).
#   
#        reveal_objective(quest_id, objective_id_1, ..., objective_id_n)
#            quest_id : the integer ID of the quest you want to access.
#            objective_id_1, ..., objective_id_n : a list of the IDs of the
#              objectives you want to operate on. It can be as few as one or as
#              many as all of them.
#          Will show the listed objectives in the Quest's information
#
#        conceal_objective(quest_id, objective_id_1, ..., objective_id_n)
#          Will hide the listed objectives in the Quest's information
#
#        complete_objective(quest_id, objective_id_1, ..., objective_id_n)
#          Changes the colour of the listed objectives to the completed colour.
#          The quest is completed once all prime objectives are.
#
#        uncomplete_objective (quest_id, objective_id_1, ..., objective_id_n)
#          Changes the status of the listed complete objectives back to active
#
#        fail_objective(quest_id, objective_id_1, ..., objective_id_n)
#          Changes the colour of the listed objectives to the failed colour.
#          The quest is failed once one prime objective is.
#
#        unfail_objective(quest_id, objective_id_1, ..., objective_id_n)
#          Changes the status of the listed failed objectives back to active
#
#        change_reward_status(quest_id, value)
#            value : either true or false. If excluded, defaults to true.
#          Totally optional, but this is just a personal switch which you can
#          turn on when the reward is given. You can then make it a condition
#          so you don't reward the players more than once. (see line 180)
#
#  EXAMPLES:
#    reveal_objective(1, 0)
#      This would reveal the first objective of the quest with ID 1
#    complete_objective(6, 2, 3)
#      This would complete the third & fourth objectives of the quest with ID 6
#    change_reward_status(8)
#      This would set the reward switch to true for the quest with ID 8.
#
#   Another new feature is the ability to set rewards that will show up in the
#  menu (see EDITABLE REGION B). In addition to that, you can use the following
#  code to automatically distribute the specified rewards for a quest if the
#  quest is complete and no reward has yet been given:
#
#        distribute_quest_rewards(quest_id)
#          quest_id : the ID of the quest whose rewards you want to distribute
#
#   Of course, it can only distribute the material rewards (items, weapons,
#   armors, gold, or exp). It won't distribute rewards you specify by string.
#   To that end though, you can also use this code in a conditional branch and
#   it will be satisfied only if it distributes the rewards. Thus, if you
#   wanted to add some special rewards or do things like that, you can just put
#   that in the branch for when it is true. This feature is not really
#   recommended, since I think it is better to do it by events.
#
#    Other codes for the Script event command that can be useful are:
#   
#        reset_quest(quest_id)
#            quest_id : the integer ID of the quest you want to access.
#          This will re-initialize the quest, meaning all quest progress to
#          date will be lost
#
#        remove_quest(quest_id)
#          Deactivates the quest and resets it
#
#        conceal_quest(quest_id)
#          Deactivates the quest so it won't show up in the scene, but progress
#          is saved
#
#        reveal_quest(quest_id)
#          Activates or reactivates the quest. This command is NECESSARY if
#          MANUAL_REVEAL at line 284 is true or it has previously been
#          concealed. Otherwise, it is sufficient just to operate on the quest
#
#        change_quest_access(:symbol)
#          :symbol must be one of six options (include the colon!):
#            :disable - prevents access to the quest scene (greys out in menu)
#            :enable - enables access to the quest scene
#            :disable_menu - this removes the quest option from the menu
#            :enable_menu - this adds the quest option to the menu
#            :disable_map - this prevents access by key from the map
#            :enable_map - this allows access by key to the map
#
#        change_quest_background("bg_filename", bg_opacity, bg_blend_type)
#            bg_filename   : the filename of the picture for the background in  
#              the Pictures folder
#            bg_opacity    : the opacity of the background graphic. If
#              excluded, this defaults to the value of the setting at line 434.
#            bg_blend_type : the blend type of the background graphic. If
#              excluded, this defaults to the value of the setting at line 437.
#
#        change_quest_windows ("windowskin_filename", tone, opacity)
#            windowskin_filename : the name of the Window graphic in the
#              System folder of Graphics
#            opacity             : the opacity of the windows. If excluded,
#              this defaults to the value of the setting at line 423.
#            blend_type          : the blend_type of the windows. If excluded,
#              this defaults to the value of the setting at line 426.
#
#    Also, there are a few codes that can be used in the Script command of a
#   conditional branch. I note here that all of these are optional. You could
#   use switch and variable checks and monitor quest progress solely through
#   events. However, these commands make it a little easier and they are:
#
#        quest_revealed?(quest_id)
#            quest_id : the integer ID of the quest you want to access.
#          This is satisfied if the quest has been activated.
#
#        quest_complete?(quest_id)
#          This is satisfied if all prime objectives of the quest are complete
#
#        quest_failed?(quest_id)
#          This is satisfied if any prime objective of the quest is failed
#
#        quest_rewarded?(quest_id)
#          This is satisfied if you have changed the reward status to true.
#
#        objective_revealed?(quest_id, objective_id_1, ... objective_id_n)
#            objective_id_1, ..., objective_id_n : a list of the IDs of the
#              objectives you want to operate on. It can be as few as one or as
#              many as all of them.
#          This is satisfied if the listed objectives have been revealed
#
#        objective_active?(quest_id, objective_id_1, ... objective_id_n)
#          This is satisfied if all the listed objectives are revealed and
#          neither complete nor failed.
#
#        objective_complete?(quest_id, objective_id_1, ... objective_id_n)
#          This is satisfied if all the listed objectives have been completed
#
#        objective_failed?(quest_id, objective_id_1, ... objective_id_n)
#          This is satisfied if all the listed objectives have been failed
#
#    If you want to call the Quest scene from an event, you use the following
#   code in a call script:
#
#        call_quest_journal
#        call_quest_journal(quest_id)
#          quest_id : ID of the quest you want to open the scene on
#
#  If you do not specify a quest_id (line 198) then it will simply open the
#  scene as it would normally. If you do specify a quest_id (line 199) then it
#  will open the scene on that quest so long as it has been revealed and it is
#  normally accessible through the quest menu.
#
#   Finally, the default way this script operates is that quests automatically
#  complete or fail based on the status of the prime objectives. However, you
#  can set it so that there are no prime objectives, in which case you can only
#  complete, fail, or (re)activate a quest manually through the following code
#  in a script call:
#
#        manually_complete_quest(quest_id)
#          quest_id : ID of the quest you want to manually complete
#        manually_fail_quest(quest_id)
#          quest_id : ID of the quest you want to manually fail
#        manually_activate_quest(quest_id)
#          quest_id : ID of the quest you want to manually activate
#==============================================================================

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

#==============================================================================
# *** QuestData
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This module contains all the configuration data for the quest journal
#==============================================================================

module QuestData
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  #  BEGIN Editable Region A
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  MENU_ACCESS - If true, you can access the quest journal through a command
  # in the menu. If false, there will be no such command.
  MENU_ACCESS = true
  #  MENU_INDEX - If MENU_ACCESS is true, this determines where it appears
  MENU_INDEX = 4
  #  MAP_ACCESS - If true, this allows you to access the quest journal by
  # pressing a key on the map.
  MAP_ACCESS = true
  #  MAP_BUTTON - If MAP_ACCESS is true, this determines which button calls the
  # Quest Journal
  MAP_BUTTON = :L
  #  OPEN_TO_LAST_REVEALED_QUEST - If true, then the first time you open the
  # quest journal after revealing a new quest, it will open to the new quest.
  OPEN_TO_LAST_REVEALED_QUEST = true
  #  OPEN_TO_LAST_CHANGED_QUEST - If true, then the Quest Journal will open to
  # the last quest whose objective status has changed.
  OPEN_TO_LAST_CHANGED_QUEST = false
  #  LIST_WINDOW_WIDTH - The width, in pixels, of the List Window
  LIST_WINDOW_WIDTH = 192
  #  BASIC_DATA_TYPES  - This lets you set up additional types of data. Just
  # include an identifying signal in the Array. Then, you will need to give
  # each signal an icon (in the ICONS hash at line 322) and a signal text (in
  # the VOCAB array at line 333, though it can be an empty string). Then, you
  # can set the data itself when setting up quests by simply adding a:
  #    q[:symbol] = ""
  # line to the quest. You will also need to include the data type somewhere in
  # the DATA_LAYOUT at line 306. As an example of this, I have included :client
  # and :location by default. You can CTRL+F for anything in this section with
  # one of those symbols (excluding :) and you will there need to add something
  # for any new data types you add.
  BASIC_DATA_TYPES = [:client, :location]
  #  BASIC_DATA_WIDTH - This determines how much room, in pixels, is given to  
  # any basic data types you set up in the data window.
  BASIC_DATA_WIDTH = 240
  #  CONCURRENT_ACTIVITY - If true, then when in the Quest Journal scene, you
  # can switch categories or scroll down the quest list at the same time. If
  # false, you will first need to select a category before you can start
  # scrolling through the quest list.
  CONCURRENT_ACTIVITY = true
  #  HIDE_CATEGORY_CURSOR - If true, then the Category Window will not have a
  # cursor and will instead just highlight the currently selected category.
  # This is best when CONCURRENT_ACTIVITY is true.
  HIDE_CATEGORY_CURSOR = true
  #  SHOW_QUEST_ICONS - If true, then the icon you choose for each quest will
  # be displayed to the left of its name in the Quest List window
  SHOW_QUEST_ICONS = false#true
  #  MANUAL_REVEAL - If false, then quests will be revealed the moment you
  # first reveal, complete, or fail an objective. If this is true, you will
  # need to specifically reveal each quest via a separate script call:
  #    reveal_quest(quest_id)
  MANUAL_REVEAL = false
  #  DATA_LAYOUT - This controls the way that the quest window lays out all of
  # the relevant data. If you set one of the entries to be an array, then any
  # of the commands there will be drawn at the same y. With exception to :line,
  # none of the commands will be drawn if the quest is not set to have that
  # particular data. The symbols are:
  #    :line        - Draws a horizontal line across the window.
  #    :name        - Draws the name of the quest
  #    :level       - Draws the level of the quest
  #    :banner      - Draws the banner for the quest
  #    :client      - Draws the client set in the quest   (basic data)
  #    :location    - Draws the location set in the quest (basic data)
  #    :description - Draws the quest's description
  #    :objectives  - Draws all the quest's objectives that have been revealed
  #    :rewards     - Draws whatever rewards have been set
  #
  # You will also need to add an entry for any new BASIC_DATA that you place
  # in BASIC_DATA_TYPES at line 264.
  #
  # Remember to place a comma after each entry. Also note that this is only the
  # default layout. You can set a different layout for any quest, and when
  # viewing that quest, it will be the custom layout that is shown.
  DATA_LAYOUT = [
    [:line, :name, :level],
    :banner,
    :client,
    :location,
    :description,
    :objectives,
    [:line, :rewards],
    :line,
  ] # <= Do not touch.
  #  ICONS - This is where you setup many of the icons used in the script. The
  # purpose of each is listed next to it. Also, if you make any custom
  # categories, you NEED to give them an icon by placing a line like the
  # others. So, if the new custom category is :romance then you would need to
  # set it like this:
  #    romance:     107,
  ICONS = {
    all:         226, # The icon for the All Quests category
    active:      236, # The icon for the Active Quests category
    complete:    238, # The icon for the Complete Quests category
    failed:      227, # The icon for the Failed Quests category
    client:      121, # The icon for client data. If none wanted, set to 0
    location:    231, # The icon for location data. If none wanted, set to 0
    reward_gold: 361, # The icon for gold rewards. If none wanted, set to 0
    reward_exp:  117, # The icon for exp rewards. If none wanted, set to 0
  } # <= Do not touch.
  #  VOCAB - This lets you choose some of the words used in the quest scene
  VOCAB = {
    # menu_label:  The command name in the menu if MENU_ACCESS is true
    menu_label:       "任务",
    # scene_label: The label at the top of the scene. If empty, no window
    scene_label:      " ",
    # description: The heading to identify the description
    description:      "委托描述",
    # objectives: The heading to identify the objectives
    objectives:       "记录",
    # objective_bullet: The bullet which shows up to the left of every
    #  objective. If %d is included, it shows the objective's ID.
    objective_bullet: "·",
    # rewards: The heading to identify the rewards.
    rewards:          "委托奖励",
    # reward_amount: For item rewards, this is the text to show the amount.
    #  It should include %d to show the amount.
    reward_amount:    "x%d",
    # reward_gold: Text to identify gold rewards
    reward_gold:      "金钱",
    # reward_exp: Text to identify exp rewards
    reward_exp:       "经验",
    # level: If LEVEL_ICON is 0, this is the text which precedes the level
    level:            "等级: ",
    # location: The text label for quest location
    location:         "",
    # location: The text label for quest client
    client:           "",
  } # <= Do not touch.
  #  CATEGORIES - This array allows you to set which categories are available
  # in the Quest scene. The default categories are :all, :active, :complete,
  # and :failed, and their names are self-explanatory. You can add custom
  # categories as well, but note that you will need to make sure that each new
  # category has an icon set in the ICONS hash, as well as a label set in the
  # CATEGORY_VOCAB hash (if you are using SHOW_CATEGORY_LABEL). It is also
  # advisable to give it a sort type, unless you are fine with it being sorted
  # by ID, as is default.
  CATEGORIES = [:all, :active, :complete, :failed]
  #  SHOW_CATEGORY_LABEL - This allows you to choose whether to show the name
  # of the currently selected category. If true, it will choose the name out
  # of the CATEGORY_VOCAB hash.
  SHOW_CATEGORY_LABEL = true
  #  CATEGORY_LABEL_IN_SAME_WINDOW - If SHOW_CATEGORY_LABEL is true, then this
  # options lets you choose whether the label is shown in the same window as
  # the category icons or in a separate window below. true = same window.
  CATEGORY_LABEL_IN_SAME_WINDOW = true
  #  CATEGORY_VOCAB - If SHOW_CATEGORY_LABEL is true, this hash lets you set the
  # label for each category. For any custom categories you create, you will
  # need to add a line for each below and in the same format:
  #    :category => "Label",
  # Don't forget to add the comma at the end of each line.
  CATEGORY_VOCAB = {
    :all =>      "全部委托",      # The label for the :all category
    :active =>   "进行中",   # The label for the :active category
    :complete => "已完成", # The label for the :complete category
    :failed =>   "已过期",   # The label for the :failed category
  } # <= Do not touch.
  #  SORT_TYPE - This hash allows you to choose how each category is sorted.
  # For each category, default or custom, you can set a different sort method
  # There are seven options to choose from:
  #    :id - The quests are sorted from lowest to highest ID
  #    :alphabet - The quests are sorted in alphabetical order
  #    :level - The quests are sorted from the lowest to highest level
  #    :reveal - The quests are sorted from most recently revealed on.
  #            Every time a new quest is revealed, it will be at the top.
  #    :change - The quests are sorted from the one whose status most recently
  #            changed on. So, every time an objective is modified, that quest
  #            will be thrown to the top.
  #    :complete - The quests are sorted from the most recently completed on.
  #            Every time a quest is completed, it will be thrown to the top.
  #    :failed - The quests are sorted from the most recently failed on.
  #            Every time a quest is failed, it will be thrown to the top.
  #
  # Additionally, you can put _r at the end of any of the sort options and it
  # will reverse the order. So, for instance, if the sort method for a category
  # is :alphabet_r, then the quests will show up from Z-A
  SORT_TYPE = {
    :all =>      :id,       # Sort type for the All Quests category
    :active =>   :change,   # Sort type for the Active Quests category
    :complete => :complete, # Sort type for the Complete Quests category
    :failed =>   :failed,   # Sort type for the Failed Quests category
  } # <= Do not touch.
  #  WINDOWSKIN - The windowskin for each window in the Quest scene. It must
  # refer to a graphic in the System folder of Graphics. If set to false, then
  # it will use whatever windowskin is default. If you are using a script which
  # lets the player choose the windowskin, false is the recommended value.
  WINDOWSKIN = false
  #  WINDOW_TONE - The tone for each window. It must be an array in the form:
  #      WINDOW_TONE = [red, green, blue, gray]
  # gray can be excluded, but the other three must be present. If you set this
  # value to false, then the windows will have whatever tone is default.
  WINDOW_TONE = false
  #  WINDOW_OPACITY - The opacity of the windows in the Quest scene. If set to
  # false, it will use the default opacity for windows.
  WINDOW_OPACITY = false
  #  BG_PICTURE - This is a string referring to a picture in the Picture folder
  # of Graphics. If set to "", then there will be no picture. Otherwise, it
  # will display the selected picture below the windows but above the map in
  # the Quest scene.
  BG_PICTURE = "task_back"
  #  BG_OPACITY - This allows you to set the opacity of the background picture,
  # if you have selected one.
  BG_OPACITY = 255
  #  BG_BLEND_TYPE - This allows you to set the blend type of the background
  # picture, if you have selected one.
  BG_BLEND_TYPE = 0
  #  DESCRIPTION_IN_BOX - This is a graphical option, and it allows you to
  # choose whether the description should be shown in a box.
  DESCRIPTION_IN_BOX = true
  #  LEVEL_ICON - This sets how levels are shown. If set to an integer, then it
  # will draw the same icon numerous times up to the level of the quest. Ie. If
  # the level's quest is 1, then the icon will only be drawn once, but if the
  # level's quest is 4, it will be drawn 4 times. LEVEL_ICONS_SPACE determines
  # the space between them. If you set LEVEL_ICON to 0, however, then it will
  # instead draw a signal for the level, corresponding to that index in the
  # LEVEL_SIGNALS array. If the LEVEL_SIGNALS array is empty, then it will just
  # draw the integer for the level. Finally, LEVEL_ICON can also be an array of
  # integers, in which case the level will be represented only by the icon set
  # which corresponds to it in the array.
  LEVEL_ICON = 125
  #  LEVEL_ICONS_SPACE - If LEVEL_ICON is an integer, this is the amount of
  # space between each time the icon is drawn.
  LEVEL_ICONS_SPACE = 16
  #  LEVEL_SIGNALS - If LEVEL_ICON is 0, this allows you to set what string
  # should be the signal for each level. If this array is empty, then it will
  # just draw the level integer. Ie. if the Quest is Level 4, it will draw 4.
  LEVEL_SIGNALS = ["F", "E", "D", "C", "B", "A", "S"]
  #  COLOURS - This lets you change the colour for various aspects of the
  # quest scene. Each can be set in one of three ways:
  #    :symbol - If you use a symbol, the colour will be the result of calling
  #      the method of the same name. For instance, if you set something to
  #      :system_color, it will set the colour to the result of the Window_Base
  #      system_color method.
  #    Integer - If you set the colour to an integer, then it will take its
  #      colour from the windowskin palette, just like using \c[x] in messages.
  #    Array - You can also set the rgba values directly with an array in the
  #      format: [red, green, blue, alpha]. alpha can be excluded, but you must
  #      have values for red, green, and blue.
  COLOURS = {
    # active: This sets the colour for active quests in the list and the name
    #  of the active quest when shown in the data window.
    active:           :normal_color,
    # complete: This sets the colour for complete quests in the list and the
    #  name of the complete quest when shown in the data window.
    complete:         2,
    # failed: This sets the colour for failed quests in the list and the name
    #  of the failed quest when shown in the data window.
    failed:           18,
    # line:  This sets the colour for lines or boxes drawn in the quest scene
    line:             :normal_color,
    # line_shadow:  This sets the colour of the shadow for lines or boxes drawn
    #  in the quest scene
    line_shadow: [0, 0, 0, 128],
    # scene_label: This sets the colour for the scene label, if shown
    scene_label:      19,#:system_color,
    # category_label: This sets the colour for the category label, if shown
    category_label:   :normal_color,
    # level_signal: This sets the colour for the level signal, if shown
    level_signal:     :normal_color,
    # objective_bullet: This sets the colour for objectives; if set to
    #  :maqj_objective_color, it will reflect the completion status of the
    #  objective, but you can change it to something else if you prefer
    objective_bullet: :maqj_objective_color,
    # reward_amount: The colour of the item amount, when shown
    reward_amount:    :normal_color,
    # heading: The colour of any headings in the script, like "Description"
    heading:          19,#:system_color,
    # basic_label: For basic data, like client, the colour of the label
    basic_label:      19,#:system_color,
    # basic_value: For basic data, like client, the colour of the value
    basic_value:      :normal_color,
  } # <= Do not touch.
  #  HEADING_ALIGN - This sets the alignment for the aspects listed. 0 is Left;
  # 1 is Centre; 2 is Right
  HEADING_ALIGN = {
    description: 0, # Alignment for the Description heading
    objectives:  0, # Alignment for the Objectives heading
    rewards:     1, # Alignment for the Rewards heading
    level:       2  # Alignment when showing the level
  } # <= Do not touch.
  #````````````````````````````````````````````````````````````````````````````
  #    Font Aspects
  #
  #  All of the following options (FONTNAMES, FONTSIZES, FONTBOLDS, and
  # FONTITALICS) allow you to alter the fonts used for various aspects of the
  # scene. The only one listed there by default is normal:, which is the
  # font used by default for the entire scene. However, you can change the  
  # fonts for almost any aspect - all you need to do is add a line like so:
  #
  #    description: value,
  #
  # and that will change that font aspect when drawing the description. The
  # following symbols are available for changing:
  #
  #   normal:         The default font used for every part of the scene
  #   list:           The font used in the List Window
  #   scene_label:    The font used when drawing the Scene Label, if shown
  #   category_label: The font used when drawing the Category Label, if shown
  #   heading:        The font used when drawing any headings, like "Description"
  #   name:           The font used when drawing the quest name in data window
  #   description:    The font used when drawing the Description
  #   objectives:     The font used when drawing the objectives
  #   rewards:        The font used when drawing the rewards
  #   client:         The font used when drawing the client
  #   location:       The font used when drawing the location
  #
  # For any of them, you need to set a value. What the value can be depends
  # on which font aspect you are changing and is described below, but for any
  # of them setting it to the false will mean it will simply use the default
  #
  # For any that you add, remember that you must put a comma after the value.
  #````````````````````````````````````````````````````````````````````````````
  #  FONTNAMES - Here you can change the font used for any of the various
  # options. It can take any of the following types of values:
  #     false    - The default font will be used
  #     "String" - The font with the name "String" will be used.
  #     [Array]  - The array must be in the form: ["String1", "String2", ...]
  #               The font used will be the first one in the array that the
  #               player has installed.
  #
  #  EXAMPLES:
  #
  #    normal:      false,
  #      The font used for unaltered aspects of the scene is the default font
  #    scene_label: "Algerian",
  #      The font used for the Scene Label will be Algerian.
  #    description: ["Cambria", "Times New Roman"],
  #      The font used when drawing the description will be Cambria if the
  #      player has Cambria installed. If the player does not have Cambria
  #      installed, then the font used will be Times New Roman
  FONTNAMES = {
    normal: false, # normal: the default font name
  } # <= Do not touch.
  #  FONTSIZES - Here you can change the size of the font. There are two types
  # of values you can set:
  #    false   - The default fontsize will be used
  #    Integer - The fontsize will be equal to the value of the Integer.
  #  
  # For everything but the label windows, this shouldn't exceed 24, since that
  # is the line_height. However, for scene_label: and category_label:, the size
  # of the window will be adjusted to whatever size you set the font.
  FONTSIZES = {
    normal:         false, # normal: default font size
    scene_label:    16,#28,    # scene_label: fontsize for the Scene Label window
    category_label: 16,#24,    # category_label: fontsize for Category Label window
  } # <= Do not touch.
  #  FONTBOLDS - Here you can set whether the font will be bolded. You can set
  # it to either false, in which case it will not be bolded, or true, in which
  # case it will be bolded.
  FONTBOLDS = {
    scene_label:  true, # scene_label: whether font is bold for Scene Label
    heading:      true, # heading: whether font is bold for the headings
    level_signal: true, # level_signal: whether font is bold for level
  } # <= Do not touch.
  #  FONTITALICS - Here you can set whether the font will be italicized. You
  # can set it to either false, in which case it will not be italicized, or
  # true, in which case it will be italicized.
  FONTITALICS = {
  }
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END Editable Region A
  #//////////////////////////////////////////////////////////////////////////
  CATEGORIES = [:all] if !CATEGORIES || CATEGORIES.empty?
  VOCAB.default = ""
  ICONS.default = 0
  CATEGORY_VOCAB.default = ""
  SORT_TYPE.default = :id
  COLOURS.default = :normal_color
  HEADING_ALIGN.default = 0
  FONTNAMES.default = false
  FONTSIZES.default = false
  FONTBOLDS.default = false
  FONTITALICS.default = false
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.setup_quest(quest_id)
    q = { objectives: [] }
      q[:name]              = MissionInfo::AllMission[quest_id + 1]["name"]
      q[:level]             = MissionInfo::AllMission[quest_id + 1]["level"]
      q[:icon_index]        = MissionInfo::AllMission[quest_id + 1]["icon_index"]
      q[:description]       = MissionInfo::AllMission[quest_id + 1]["description"]
      for i in 0..15
        obj_name = "objectives" + i.to_s
        q[:objectives]     = MissionInfo::AllMission[quest_id + 1][obj_name]
      end
      q[:prime_objectives]  = MissionInfo::AllMission[quest_id + 1]["prime_objectives"]
      q[:custom_categories] = MissionInfo::AllMission[quest_id + 1]["custom_categories"]
      q[:banner]            = MissionInfo::AllMission[quest_id + 1]["banner"]
      q[:banner_hue]        = MissionInfo::AllMission[quest_id + 1]["banner_hue"]
      q[:client]            = MissionInfo::AllMission[quest_id + 1]["client"]
      q[:location]          = MissionInfo::AllMission[quest_id + 1]["location"]
      q[:common_event_id]   = MissionInfo::AllMission[quest_id + 1]["common_event_id"]
      q[:rewards]           = MissionInfo::AllMission[quest_id + 1]["rewards"]
      q[:layout]            = MissionInfo::AllMission[quest_id + 1]["layout"]
    q
  end
end

#==============================================================================
# *** DataManager
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - self.extract_save_contents
#==============================================================================

class << DataManager
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Extract Save Contents
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maqj_extractsavecons_2kw5 extract_save_contents
  def extract_save_contents(*args, &block)
    maqj_extractsavecons_2kw5(*args, &block) # Call Original Method
    if $game_party.quests.nil?
      $game_party.init_maqj_data
      $game_system.init_maqj_data
    end
  end
end

#==============================================================================
# ** MAQJ_SortedArray
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This module mixes in to an array to maintain the sorted order when inserting
#==============================================================================

module MAQJ_SortedArray
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Insert to Array
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maqj_insert_sort(el, &block)
    index = bsearch_index(el, 0, size, &block)
    index ? insert(index, el) : push(el)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Retrieve Index from Binary Search
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def bsearch_index(el, b = 0, e = size, &block)
    return bsearch_index(el, b, e) { |a,b| a <=> b } if block.nil?
    return b if b == e # Return the discovered insertion index
    return if b > e
    m = (b + e) / 2    # Get Middle
    block.call(el, self[m]) > 0 ? b = m + 1 : e = m
    bsearch_index(el, b, e, &block)
  end
end

#==============================================================================
# ** Game_Quest
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class holds all instance data for a quest
#==============================================================================

class Game_Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :id                  # Unique identifier for this quest
  attr_reader   :name                # The name to be shown for the quest
  attr_reader   :level               # The level of difficulty of the quest
  attr_reader   :objectives          # An array of objective strings
  attr_reader   :prime_objectives    # An array of crucial objective IDs
  attr_reader   :revealed_objectives # An array of revealed objective IDs
  attr_reader   :complete_objectives # An array of completed objective IDs
  attr_reader   :failed_objectives   # An array of failed objective IDs
  attr_reader   :custom_categories   # An array of category symbols
  attr_accessor :icon_index          # Icon associated with this quest
  attr_accessor :common_event_id     # ID of common event to call upon complete
  attr_accessor :description         # The description for the quest
  attr_accessor :banner              # Picture shown to represent the quest
  attr_accessor :banner_hue          # The hue of the banner
  attr_accessor :layout              # The layout of this quest in scene
  attr_accessor :rewards             # An array of rewards to show
  attr_accessor :reward_given        # Boolean tracking if quest was rewarded
  attr_accessor :concealed           # Whether or not the quest is visible
  attr_accessor :manual_status       # Quest status if not using prime objectives
  QuestData::BASIC_DATA_TYPES.each { |data_type| attr_accessor(data_type) }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(quest_id)
    @id = quest_id
    @concealed = default_value_for(:concealed)
    @reward_given = default_value_for(:reward_given)
    reset
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset
    data = QuestData.setup_quest(@id)
    data_symbol_array.each { |meth| instance_variable_set(:"@#{meth}",
      data[meth] ? data[meth] : default_value_for(meth)) }
    @revealed_objectives = [].send(:extend, MAQJ_SortedArray)
    @complete_objectives = [].send(:extend, MAQJ_SortedArray)
    @failed_objectives =   [].send(:extend, MAQJ_SortedArray)
    @manual_status = default_value_for(:manual_status)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Data Symbol Array
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def data_symbol_array
    [:name, :level, :objectives, :prime_objectives, :custom_categories,
      :icon_index, :description, :banner, :banner_hue, :common_event_id,
      :layout, :rewards] + QuestData::BASIC_DATA_TYPES
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Default Value
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def default_value_for(method)
    case method
    when :name then "??????"
    when :description, :banner then ""
    when :level, :banner_hue, :icon_index, :common_event_id then 0
    when :objectives, :rewards, :custom_categories then []
    when :prime_objectives then Array.new(objectives.size) { |x| x }
    when :concealed then QuestData::MANUAL_REVEAL
    when :manual_status then :active
    when :layout, :reward_given then false
    else ""
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reveal/Conceal Objective
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reveal_objective(*obj)
    valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }
    valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }
    quest_status_changed unless valid_obj.empty?
  end
  def conceal_objective(*obj)
    quest_status_changed unless (obj & @revealed_objectives).empty?
    obj.each { |obj_id| @revealed_objectives.delete(obj_id) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Complete/Uncomplete Objective
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def complete_objective(*obj)
    valid_obj = obj.select {|x| x < objectives.size && !@complete_objectives.include?(x) }
    reveal_objective(*valid_obj)
    unfail_objective(*valid_obj)
    was_complete = status?(:complete)
    valid_obj.each {|i| @complete_objectives.maqj_insert_sort(i) }
    quest_status_changed unless valid_obj.empty?
    # If just completed
    if status?(:complete) && !was_complete
      $game_temp.reserve_common_event(common_event_id)
      $game_party.quests.add_to_sort_array(:complete, @id)
    end
  end
  def uncomplete_objective(*obj)
    quest_status_changed unless (obj & @complete_objectives).empty?
    obj.each { |obj_id| @complete_objectives.delete(obj_id) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fail/Unfail Objective
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def fail_objective(*obj)
    valid_obj = obj.select {|x| x < objectives.size && !@failed_objectives.include?(x) }
    reveal_objective(*valid_obj)
    uncomplete_objective(*valid_obj)
    was_failed = status?(:failed)
    valid_obj.each {|i| @failed_objectives.maqj_insert_sort(i) }
    quest_status_changed unless valid_obj.empty?
    $game_party.quests.add_to_sort_array(:failed, @id) if status?(:failed) && !was_failed
  end
  def unfail_objective(*obj)
    quest_status_changed unless (obj & @failed_objectives).empty?
    obj.each { |obj_id| @failed_objectives.delete(obj_id) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Updates when the quest status has been changed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_status_changed
    $game_party.quests.add_to_sort_array(:change, @id)
    $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Objective Status?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def objective_status?(status_check, *obj)
    return false if obj.empty?
    case status_check
    when :failed   then !(obj & @failed_objectives).empty?
    when :complete then obj.size == (obj & @complete_objectives).size
    when :revealed then obj.size == (obj & @revealed_objectives).size
    when :active then objective_status?(:revealed, *obj) &&
      !objective_status?(:complete, *obj) && !objective_status?(:failed, *obj)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Status?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def status?(status_check)
    case status_check
    when :failed  
      @prime_objectives.empty? ? @manual_status == :failed :
        !(@failed_objectives & @prime_objectives).empty?
    when :complete
      @prime_objectives.empty? ? @manual_status == :complete : !status?(:failed) &&
        ((@prime_objectives & @complete_objectives) == @prime_objectives)
    when :active then !concealed && !status?(:complete) && !status?(:failed)
    when :reward then @reward_given
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Name
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def name=(new_name)
    @name = new_name
    $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party &&
      $game_party.quests
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Level
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def level=(new_lvl)
    @level = new_lvl
    $game_party.quests.add_to_sort_array(:level, @id) if $game_party &&
      $game_party.quests
  end
end

#==============================================================================
# ** Game_Quests
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This is a wrapper for an array holding Game_Quest objects
#==============================================================================

class Game_Quests
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    @data = {}
    @sort_arrays = {
      reveal: [], change: [], complete: [], failed: [],
      id:       [].send(:extend, MAQJ_SortedArray),
      alphabet: [].send(:extend, MAQJ_SortedArray),
      level:    [].send(:extend, MAQJ_SortedArray)
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def [](quest_id)
    reset_quest(quest_id) if !@data[quest_id]
    @data[quest_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Quest <- Not sure when this would ever be useful.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def []=(quest_id, value)
    @data[quest_id] = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * List
  #    list_type : the type of list to return
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def list(list_type = :all, sort_type = $game_system.quest_sort_type[list_type])
    sort_type_s = sort_type.to_s
    reverse = !(sort_type_s.sub!(/_r$/, "")).nil?
    sort_type = sort_type_s.to_sym
    list = @sort_arrays[sort_type].select { |quest_id| include?(quest_id, list_type) }
    list.reverse! if reverse
    list.collect { |quest_id| @data[quest_id] }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Include?
  #    determines whether to include a particular quest depending on list type
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def include?(quest_id, list_type = :all)
    return false if !revealed?(quest_id)
    case list_type
    when :all then true
    when :complete, :failed, :active then @data[quest_id].status?(list_type)
    else
      @data[quest_id].custom_categories.include?(list_type)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Revealed?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def revealed?(quest_id)
    (!@data[quest_id].nil? && !@data[quest_id].concealed)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def setup_quest(quest_id)
    return if @data[quest_id]
    @data[quest_id] = Game_Quest.new(quest_id)
    # Open to this quest next time the QJ is opened
    $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST
    # Save sorting order in separate arrays to avoid re-sorting every time
    @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Delete Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def delete_quest(quest_id)
    @data.delete(quest_id)
    @sort_arrays.values.each { |ary| ary.delete(quest_id) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset_quest(quest_id)
    delete_quest(quest_id)
    setup_quest(quest_id)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add to Sorted Array
  #    sort_type : array to alter
  #    quest_id  : ID of the quest to add.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_to_sort_array(sort_type, quest_id)
    @sort_arrays[sort_type].delete(quest_id) # Make sure always unique
    case sort_type
    when :reveal, :change, :complete, :failed
      @sort_arrays[sort_type].unshift(quest_id)
    when :id
      @sort_arrays[sort_type].maqj_insert_sort(quest_id)
    when :alphabet
      @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].name.downcase <=> @data.name.downcase }
    when :level
      @sort_arrays[sort_type].maqj_insert_sort(quest_id) { |a, b| @data[a].level <=> self.level }
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Find Location
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def find_location(quest_id, cat = nil)
    if revealed?(quest_id)
      categories = $game_system.quest_categories.dup
      # If cat specified, check in that category first.
      if cat && categories.include?(cat)
        categories.delete(cat)
        categories.unshift(cat)
      end
      for category in categories # Check all categories
        index = list(category).index(@data[quest_id])
        return category, index if index != nil
      end
    end
    return nil, nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear
    @data.clear
  end
end

#==============================================================================
# ** Game System
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new attr_accessor - quest_menu_access; quest_map_access; quest_sort_type;
#      quest_bg_picture; quest_bg_opacity; quest_windowskin;
#      quest_window_opacity; quest_access_disabled; last_quest_cat;
#      last_quest_id
#    aliased methods - initialize
#    new methods - init_maqj_data
#==============================================================================

class Game_System
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :quest_menu_access     # Whether the scene is called from menu
  attr_accessor :quest_map_access      # Whether the scene is called from map
  attr_accessor :quest_sort_type       # The sort types for each category
  attr_accessor :quest_bg_picture      # The filename of the background picture
  attr_accessor :quest_bg_opacity      # The opacity of the background picture
  attr_accessor :quest_bg_blend_type   # The blend type of the background pic
  attr_accessor :quest_windowskin      # The windowskin used for the scene
  attr_accessor :quest_window_tone     # The tone of windows in the scene
  attr_accessor :quest_window_opacity  # The opacity of windows in the scene
  attr_accessor :quest_access_disabled # Whether access to Quests is disabled
  attr_accessor :quest_categories      # The categories to show in the scene
  attr_accessor :quest_scene_label     # The label to show in the scene
  attr_accessor :last_quest_cat        # The category to open to
  attr_accessor :last_quest_id         # The ID to open to
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maqj_initialze_2cy9 initialize
  def initialize(*args, &block)
    maqj_initialze_2cy9(*args, &block)
    init_maqj_data
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Initialize Quest Data
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def init_maqj_data
    # Initialize new variables
    self.quest_menu_access = QuestData::MENU_ACCESS
    @quest_map_access = QuestData::MAP_ACCESS
    @quest_sort_type = QuestData::SORT_TYPE
    @quest_bg_picture = QuestData::BG_PICTURE
    @quest_bg_opacity = QuestData::BG_OPACITY
    @quest_bg_blend_type = QuestData::BG_BLEND_TYPE
    @quest_windowskin = QuestData::WINDOWSKIN
    @quest_window_tone = QuestData::WINDOW_TONE
    @quest_window_opacity = QuestData::WINDOW_OPACITY
    @quest_access_disabled = false
    @quest_categories = QuestData::CATEGORIES
    @quest_scene_label = QuestData::VOCAB[:scene_label]
    @last_quest_cat = @quest_categories[0]
    @last_quest_id = 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Quest Menu Access
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_menu_access=(boolean)
    @quest_menu_access = boolean
    maic_inserted_menu_commands.delete(:quest_journal)
    maic_inserted_menu_commands.push(:quest_journal) if @quest_menu_access
    maic_inserted_menu_commands.sort!
  end
end

#==============================================================================
# ** Game_Party
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new attr_reader - quests
#    aliased method - initialize
#    new method - init_maqj_data
#==============================================================================

class Game_Party
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :quests
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maqj_intiaze_2si9 initialize
  def initialize(*args, &block)
    maqj_intiaze_2si9(*args, &block) # Call Original Method
    init_maqj_data
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Initialize Quests
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def init_maqj_data
    @quests = Game_Quests.new # Initialize @quests
  end
end

#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - change_quest_access; change_quest_background;
#      change_quest_windows; setup_quest; delete_quest; reset_quest; quest;
#      reveal_quest; conceal_quest; manually_complete_quest;
#      manually_fail_quest; reveal_objective; conceal_objective;
#      complete_objective; uncomplete_objective; fail_objective;
#      unfail_objective; quest_revealed?; quest_complete?; quest_active?;
#      quest_failed?; objective_complete?; objective_active?;
#      objective_failed?; distribute_quest_rewards; distribute_quest_reward;
#      call_quest_journal
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Quest Access
  #    sym : symbol representing what aspect of access is being changed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def change_quest_access(sym)
    case sym
    when :enable then $game_system.quest_access_disabled = false
    when :disable then $game_system.quest_access_disabled = true
    when :enable_menu then $game_system.quest_menu_access = true
    when :disable_menu then $game_system.quest_menu_access = false
    when :enable_map then $game_system.quest_map_access = true
    when :disable_map then $game_system.quest_map_access = false
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Quest Background
  #    picture : picture to show in the scene's background
  #    opacity : opacity of the picture shown in the scene's background
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def change_quest_background(picture, opacity = $game_system.quest_bg_opacity,
      blend_type = $game_system.quest_bg_blend_type)
    $game_system.quest_bg_picture = picture
    $game_system.quest_bg_opacity = opacity
    $game_system.quest_bg_blend_type = blend_type
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Quest Windows
  #    skin    : windowskin name to use in the scene
  #    tone    : tone for the windowskin
  #    opacity : opacity of windows in the scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def change_quest_windows(skin, tone = $game_system.quest_window_tone,
      opacity = $game_system.quest_window_opacity)
    $game_system.quest_windowskin = skin
    $game_system.quest_window_tone = tone
    $game_system.quest_window_opacity = opacity
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup/Delete/Reset Quest
  #    quest_id : ID of the quest to be setup or deleted or reset
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [:setup_quest, :delete_quest, :reset_quest].each { |method|
    define_method(:"quest_#{method}") do |quest_id|
      $game_party.quests.send(method, quest_id)
    end
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Retrieve Quest
  #    quest_id : ID of the quest to retrieve
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest(quest_id);         $game_party.quests[quest_id];      end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reveal/Conceal Quest
  #    quest_id : ID of the quest to be revealed or concealed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reveal_quest(quest_id);  quest(quest_id).concealed = false; end
  def conceal_quest(quest_id); quest(quest_id).concealed = true;  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Manually Complete/Fail Quest
  #    quest_id : ID of the quest to be revealed or concealed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def manually_complete_quest(quest_id)
    quest(quest_id).prime_objectives.clear
    quest(quest_id).manual_status = :complete
  end
  def manually_fail_quest(quest_id)
    quest(quest_id).prime_objectives.clear
    quest(quest_id).manual_status = :failed
  end
  def manually_activate_quest(quest_id)
    quest(quest_id).manual_status = :active
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reveal/Complete/Fail/Conceal/Uncomplete/Unfail Objective
  #    quest_id : ID of the quest whose objectives will be modified
  #    *obj     : IDs of objectives to reveal or complete or fail (or opposite)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [:reveal_objective, :complete_objective, :fail_objective, :conceal_objective,
  :uncomplete_objective, :unfail_objective].each { |method|
    define_method(method) do |quest_id, *obj|
      quest(quest_id).send(method, *obj)
    end
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest Revealed?
  #    quest_id : ID of the quest you are checking is revealed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_revealed?(quest_id)
    $game_party.quests.revealed?(quest_id)
  end
  [:complete, :failed, :active].each { |method|
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Quest Complete/Failed/Active?
    #    quest_id : ID of the quest whose completion status is being checked
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    define_method(:"quest_#{method}?") do |quest_id|
      quest_revealed?(quest_id) && quest(quest_id).status?(method)
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Objective Complete/Failed/Active?
    #    quest_id : ID of the quest whose objectives are being checked
    #    *obj     : IDs of objectives to check completion status
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    define_method(:"objective_#{method}?") do |quest_id, *obj|
      quest_revealed?(quest_id) && quest(quest_id).objective_status?(method, *obj)
    end
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Objective Revealed?
  #    quest_id : ID of the quest you are checking is revealed
  #    *obj     : IDs of objectives to check completion status
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def objective_revealed?(quest_id, *obj)
    quest_revealed?(quest_id) && quest(quest_id).objective_status?(:revealed, *obj)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest Rewarded?
  #    quest_id : ID of the quest you are checking is revealed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_rewarded?(quest_id)
    quest_revealed?(quest_id) && quest(quest_id).status?(:reward)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Reward Status
  #    quest_id : ID of the quest you are checking is revealed
  #    value    : true or false
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def change_reward_status(quest_id, value = true)
    quest(quest_id).reward_given = value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Distribute Rewards
  #    quest_id : ID of the quest whose rewards are to be distributed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def distribute_quest_rewards(quest_id)
    if quest_revealed?(quest_id) && !quest_rewarded?(quest_id)
      params = @params.dup
      change_reward_status(quest_id, true)
      quest(quest_id).rewards.each { |reward| distribute_quest_reward(reward) }
      @params = params
      true
    else
      false
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Distribute Reward
  #    reward : an array identifying the reward
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def distribute_quest_reward(reward)
    @params = [reward[1], 0, 0, (reward[2] ? reward[2] : 1)]
    case reward[0]
    when :item, 0 then   command_126 # Item
    when :weapon, 1 then command_127 # Weapon
    when :armor, 2 then  command_128 # Armor
    when :gold, 3   # Gold
      @params = [0, 0, reward[1] ? reward[1] : 0]
      command_125
    when :exp, 4    # Exp
      @params = [0, 0, 0, 0, reward[1] ? reward[1] : 0, true]
      command_315
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Call Quest Journal
  #    quest_id : ID of the quest to open the journal to
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def call_quest_journal(quest_id = nil)
    return if $game_party.in_battle
    $game_system.last_quest_id = quest_id if quest_id
    SceneManager.call(Scene_Quest)
    Fiber.yield
  end
end

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

module MA_Window_ParagraphFormat
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Calc Line Width
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
    return tw if line.nil?
    line = line.clone
    unless contents_dummy
      real_contents = contents # Preserve Real Contents
      # Create a dummy contents
      self.contents = Bitmap.new(contents_width, 24)
      reset_font_settings
    end
    pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
    while line[/^(.*?)\e(.*)/]
      tw += text_size($1).width
      line = $2
      # Remove all ancillaries to the code, like parameters
      code = obtain_escape_code(line)
      # If direct setting of x, reset tw.
      tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
        ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
      #  If I need to do something special on the basis that it is testing,
      # alias process_escape_character and differentiate using @atsf_testing
      process_escape_character(code, line, pos)
    end
    #  Add width of remaining text, as well as the value of pos[:x] under the
    # assumption that any additions to it are because the special code is
    # replaced by something which requires space (like icons)
    tw += text_size(line).width + pos[:x]
    unless contents_dummy
      contents.dispose # Dispose dummy contents
      self.contents = real_contents # Restore real contents
    end
    return tw
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Format Paragraph
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def mapf_format_paragraph(text, max_width = contents_width)
    text = text.clone
    #  Create a Dummy Contents - I wanted to boost compatibility by using the
    # default process method for escape codes. It may have the opposite effect,
    # for some :(
    real_contents = contents # Preserve Real Contents
    self.contents = Bitmap.new(contents_width, 24)
    reset_font_settings
    paragraph = ""
    while !text.empty?
      text.lstrip!
      oline, nline, tw = mapf_format_by_line(text.clone, max_width)
      # Replace old line with the new one
      text.sub!(/#{Regexp.escape(oline)}/m, nline)
      paragraph += text.slice!(/.*?(\n|$)/)
    end
    contents.dispose # Dispose dummy contents
    self.contents = real_contents # Restore real contents
    return paragraph
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Format By Line
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def mapf_format_by_line(text, max_width = contents_width)
    oline, nline, tw = "", "", 0
    loop do
      #  Format each word until reach the width limit
      oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
      return oline, nline, tw if done
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Format By Word
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def mapf_format_by_word(text, line, tw, max_width)
    return line, line, tw, true if text.nil? || text.empty?
    # Extract next word
    if text.sub!(/(\s*)([^\s\n\f]*)([\n\f]?)/, "") != nil
      prespace, word, line_end = $1, $2, $3
      ntw = mapf_calc_line_width(word, tw, true)
      pw = contents.text_size(prespace).width
      if (pw + ntw >= max_width)
        # Insert
        if line.empty?
          # If one word takes entire line
          return prespace + word, word + "\n", ntw, true
        else
          return line + prespace + word, line + "\n" + word, tw, true
        end
      else
        line += prespace + word
        tw = pw + ntw
        # If the line is force ended, then end
        return line, line, tw, true if !line_end.empty?
      end
    else
      return line, line, tw, true
    end
    return line, line, tw, false
  end
end

class Window_Base
  include MA_Window_ParagraphFormat
end

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

#==============================================================================
# *** MAQJ Window_QuestBase
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This module mixes in with all quest windows
#==============================================================================

module MAQJ_Window_QuestBase
  attr_reader :maqj_objective_color
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(*args, &block)
    super(*args, &block)
    reset_font_settings
    set_data_font(:normal)
    @maqj_default_font = contents.font.dup
    # Change the windowskin, tone if they are set to be changed
    self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin
    self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity
    self.opacity = 0 ####SR
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset Font Settings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset_font_settings(*args, &block)
    super(*args, &block)
    set_data_font(@maqj_font_data_type) if @maqj_font_data_type
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Data Font
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_data_font(data_type)
    @maqj_default_font = contents.font.dup unless @maqj_default_font
    contents.font.name = QuestData::FONTNAMES[data_type] ?
      QuestData::FONTNAMES[data_type] : @maqj_default_font.name
    contents.font.size = QuestData::FONTSIZES[data_type] ?
      QuestData::FONTSIZES[data_type] : @maqj_default_font.size
    contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ?
      QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold
    contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?
      QuestData::FONTITALICS[data_type] : @maqj_default_font.italic
    case data_type
    when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color
    when :name then change_color(quest_name_colour(@quest)) if @quest
    else
      change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Horizontal Line
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_horizontal_line(y, h = 2)
    contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))
    contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * MA Text Color
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def text_color(param)
    begin
      colour = case param
      when Integer then super(param) rescue normal_color
      when Symbol then send(param) rescue normal_color
      when Array then Color.new(*param) rescue normal_color
      else
        normal_color
      end
    end
    colour.is_a?(Color) ? colour : normal_color
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest Name Colour
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_name_colour(quest = @quest)
    return if !quest
    quest = $game_party.quests[quest] if quest.is_a?(Integer)
    s = [:failed, :complete, :active].find { |status| quest.status?(status) }
    text_color(QuestData::COLOURS)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest Objective Colour
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest_objective_colour(quest, obj_id)
    return if !quest
    quest = $game_party.quests[quest] if quest.is_a?(Integer)
    s = [:failed, :complete, :active].find { |status| quest.objective_status?(status, obj_id) }
    text_color(QuestData::COLOURS)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Tone
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_tone
    $game_system.quest_window_tone ?
      self.tone.set(*$game_system.quest_window_tone) : super
  end
end

unless $imported[:"MA_IconHorzCommand_1.0"]
#==============================================================================
# ** Window_MA_IconHorzCommand
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window is a base window to show a horizontal command window populated
# with icons.
#==============================================================================

class Window_MA_IconHorzCommand < Window_HorzCommand
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :observing_procs
  attr_accessor :cursor_hide
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(*args, &block)
    @observing_procs = {}
    super(*args, &block)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Column Max
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item
    @list[index] ? @list[index][:symbol] : nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Enabled? / Current Item Enabled?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def enable?(index); self.index == index; end
  def current_item_enabled?; !current_data.nil?; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_item(index)
    rect = item_rect(index)
    contents.clear_rect(rect)
    draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Index
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def index=(index)
    old_index = self.index
    super(index)
    draw_item(old_index)
    draw_item(self.index)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update
    super
    @observing_procs.values.each { |block| block.call(item) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add/Remove Observing Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_observing_proc(id, &block)
    @observing_procs[id] = block
    update
  end
  def remove_observing_proc(id)     ; @observing_procs.delete(id) ; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Cursor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_cursor
    super
    cursor_rect.empty if @cursor_hide
  end
end
$imported[:"MA_IconHorzCommand_1.0"] = true
end

#==============================================================================
# ** Window_QuestCategory
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window allows the player to switch between quest categories.
#==============================================================================

class Window_QuestCategory < Window_MA_IconHorzCommand
  include MAQJ_Window_QuestBase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(x, y, categories = $game_system.quest_categories)
    @cursor_hide = QuestData::HIDE_CATEGORY_CURSOR
    @categories = categories
    super(x, y)
    #self.opacity = 0 ####SR
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Window Width
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def window_width; QuestData::LIST_WINDOW_WIDTH; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Category=
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def category=(category)
    self.index = @categories.index(category) if @categories.include?(category)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Command List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def make_command_list
    @categories.each { |cat|
      add_command("", cat, false, QuestData::ICONS[cat]) }
  end
end

#==============================================================================
# ** Window QuestLabel
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window simply shows a label for the Quests scene
#==============================================================================

class Window_QuestLabel < Window_Base
  include MAQJ_Window_QuestBase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(x, y, label = "")
    super(x, y, window_width, window_height)
    #self.opacity = 0 ####SR
    refresh(label)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset Font Settings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset_font_settings; set_data_font(:scene_label); end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Window Attributes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def window_width
    w = ($game_system.quest_categories.size > 1 || QuestData::SHOW_CATEGORY_LABEL) ?
      Graphics.width - QuestData::LIST_WINDOW_WIDTH : QuestData::LIST_WINDOW_WIDTH
  end
  def window_height; line_height + (standard_padding*2); end
  def line_height(*args)
    line_h = super(*args)
    QuestData::FONTSIZES[:scene_label] ?
      [QuestData::FONTSIZES[:scene_label], line_h].max : line_h
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh(label = @label)
    @label = label.is_a?(String) ? convert_escape_characters(label) : ""
    contents.clear
    reset_font_settings
    tw = mapf_calc_line_width(@label)
    draw_text_ex((contents_width - tw) / 2, 0, @label)
  end
end

#==============================================================================
# ** Window QuestLabel
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window simply shows a label for category currently selected
#==============================================================================

class Window_QuestCategoryLabel < Window_QuestLabel
  include MAQJ_Window_QuestBase
  #
  def initialize(x, y, label = "")
    super(x, y, label)
    #self.opacity = 0 ####SR
  end
  #
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset Font Settings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset_font_settings; set_data_font(:category_label); end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Window Attributes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def window_width; QuestData::LIST_WINDOW_WIDTH; end
  def line_height(*args)
    line_h = super(*args)
    QuestData::FONTSIZES[:category_label] ?
      [QuestData::FONTSIZES[:category_label], line_h].max : line_h
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Category
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def category=(category)
    return if @category == category
    @category = category
    refresh(QuestData::CATEGORY_VOCAB[category])
  end
end

#==============================================================================
# ** Window_QuestCategoryDummy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window shows up behind the category and category label window
#==============================================================================

class Window_QuestCategoryDummy < Window_Base
  include MAQJ_Window_QuestBase
end

#==============================================================================
# ** Window_QuestList
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window shows all quests in a selected category.
#==============================================================================

class Window_QuestList < Window_Selectable
  include MAQJ_Window_QuestBase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(x, y, width, height)
    super
    @data = []
    self.index = 0
    self.opacity = 0 #####SR2
    activate
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Category
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def category=(category)
    return if @category == category
    @category = category
    refresh
    self.index = 0
    update_help if @help_window
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item; @data && index >= 0 ? @data[index] : nil; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Column/Item Max
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def col_max; 1; end
  def item_max; @data ? @data.size : 1; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Whether it should be drawn enabled
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def enable?(item); true; end
  def current_item_enabled?
    (@help_window && @help_window.maqj_visible_height < @help_window.contents_height)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Item List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def make_item_list
    @data = @category ? $game_party.quests.list(@category) : []
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_item(index)
    quest = @data[index]
    if quest
      rect = item_rect_for_text(index)
      if QuestData::SHOW_QUEST_ICONS
        draw_icon(quest.icon_index, rect.x, rect.y, enable?(quest))
        rect.x += 24
        rect.width -= 24
      end
      change_color(quest_name_colour(quest), enable?(quest))
      draw_text(rect, quest.name)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh
    make_item_list
    create_contents
    set_data_font(:list)
    draw_all_items
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_help
    @help_window.quest = item
  end
end

#==============================================================================
# ** Window_QuestData
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window shows all quest data
#==============================================================================

class Window_QuestData < Window_Selectable
  include MAQJ_Window_QuestBase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)
    @dest_scroll_oy = 0
    super(x, y, w, h)
    @dest_scroll_oy = self.oy
    self.layout = layout
    self.opacity = 0 #####SR2
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Contents Height
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maqj_visible_height contents_height
  def contents_height
    @q_contents_height ? [@q_contents_height, maqj_visible_height].max : maqj_visible_height
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Calculate Contents Height
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def calc_contents_height
    @q_contents_height = 0
    @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Data?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_data?(data_type)
    case data_type
    when :line then true
    when :level then @quest.level > 0
    when :objectives then [email protected]_objectives.empty?
    when Array then (data_type - [:line]).any? { |dt| draw_data?(dt) }
    else [email protected](data_type).empty? # :description, :name, etc...
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Data Height
  #    This method calculates the height required for a specified element of
  #   the current quest. This is to calculate the needed space in contents,
  #   as well as advance the @draw_y variable.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def data_height(data_type)
    return 0 unless draw_data?(data_type)
    return line_height if QuestData::BASIC_DATA_TYPES.include?(data_type)
    @maqj_font_data_type = data_type
    reset_font_settings
    return case data_type
    when :line, :level, :name then line_height
    when :banner
      bmp = Cache.picture(@quest.banner)
      hght = bmp.rect.height
      bmp.dispose
      hght
    when :description
      buff = description_x*2
      paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
      line_num = paragraph.scan(/\n/).size + 1
      line_num += (QuestData::DESCRIPTION_IN_BOX ? 2 :
        !QuestData::VOCAB[:description].empty? ? 1 : 0)
      line_num*line_height
    when :objectives
      objectives = @quest.revealed_objectives.collect { |obj_id|
        @quest.objectives[obj_id] }
      line_num = QuestData::VOCAB[:objectives].empty? ? 0 : 1
      buff = (objective_x*2) + text_size(QuestData::VOCAB[:objective_bullet]).width
      objectives.each { |obj|
        paragraph = mapf_format_paragraph(obj, contents_width - buff)
        line_num += paragraph.scan(/\n/).size + 1 }
      line_num*line_height
    when :rewards
      line_num = QuestData::VOCAB[:rewards].empty? ? 0 : 1
      (line_num + @quest.rewards.size)*line_height
    when Array then data_height(data_type.max_by { |dt| data_height(dt) })
    else 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest=(value)
    return if @quest == value
    @quest = value
    @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout
    refresh
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Layout
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def layout=(value)
    return if @default_layout == value && @layout == value
    @default_layout = value
    @layout = value
    refresh
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh
    contents.clear
    calc_contents_height
    create_contents
    return unless @quest && @layout
    self.oy = 0
    @dest_scroll_oy = 0
    #  The basic idea here is that each draw_ method will rely on and advance
    # the @draw_y variable. Where they are an array, the elements will be
    # drawn at the same @draw_y.
    @draw_y = 0
    @layout.each {|dt|
      next unless draw_data?(dt)
      dt.is_a?(Array) ? draw_data_array(dt) : draw_data(dt)
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Data
  #    data_type : the data block to draw next
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_data(data_type)
    @maqj_font_data_type = data_type
    reset_font_settings
    send(:"draw_#{data_type}") if self.class.method_defined?(:"draw_#{data_type}")
    @draw_y += data_height(data_type)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Data Array
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_data_array(layout_array)
    y, max_y = @draw_y, @draw_y
    # Draw each data aspect at the same starting @draw_y
    layout_array.each { |dt|
      @draw_y = y
      draw_data(dt)
      max_y = @draw_y if @draw_y > max_y
    }
    @draw_y = max_y
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Line
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Name
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_name
    set_data_font(:name)
    clear_and_draw_text(0, @draw_y, contents_width, line_height, @quest.name, 1)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Level
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_level
    case QuestData::LEVEL_ICON
    when Array then QuestData::LEVEL_ICON.empty? ? draw_level_text : draw_level_array
    when 0 then draw_level_text
    else
      draw_level_stacked
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Stacked Level
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_level_stacked(icon_index = QuestData::LEVEL_ICON)
    align = QuestData::HEADING_ALIGN[:level]
    es = QuestData::LEVEL_ICONS_SPACE*(@quest.level - 1)
    x = align == 2 ? contents_width - 24 : align == 1 ?
      (contents_width - 24 - (es)) / 2 : es
    @quest.level.times do
      draw_icon(icon_index, x, @draw_y)
      x -= QuestData::LEVEL_ICONS_SPACE
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Array Level
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_level_array(icon_index = QuestData::LEVEL_ICON)
    return if icon_index.empty?
    icon_index = icon_index[@quest.level - 1] ? icon_index[@quest.level - 1] : icon_index[-1]
    align = QuestData::HEADING_ALIGN[:level]
    x = align == 2 ? contents_width - 24 : align == 1 ? (contents_width-24)/2 : 0
    draw_icon(icon_index, x, @draw_y)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Text Level
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_level_text
    reset_font_settings
    level = QuestData::LEVEL_SIGNALS && QuestData::LEVEL_SIGNALS[@quest.level - 1] ?
      QuestData::LEVEL_SIGNALS[@quest.level - 1] : @quest.level.to_s
    align = QuestData::HEADING_ALIGN[:level]
    tw = text_size(QuestData::VOCAB[:level]).width + 4
    tw2 = text_size(level).width + 2
    space = contents_width - tw - tw2
    x = align == 2 ? space : align == 1 ? space / 2 : 0
    clear_and_draw_text(x, @draw_y, tw, line_height, QuestData::VOCAB[:level])
    set_data_font(:level_signal)
    clear_and_draw_text(x + tw, @draw_y, tw2, line_height, level, 2)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Banner
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_banner
    bmp = Cache.picture(@quest.banner) # Get Picture
    # Shift the hue if requested
    bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0
    x = (contents_width - bmp.rect.width) / 2
    if x < 0 # Stretch horizontally if the banner is too wide
      dest_rect = bmp.rect.dup
      dest_rect.width = contents_width
      contents.stretch_blt(dest_rect, bmp, bmp.rect)
    else
      contents.blt(x, @draw_y, bmp, bmp.rect)
    end
    bmp.dispose
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Description
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_description
    buff = description_x*2
    paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)
    y = @draw_y
    # Draw Rect
    draw_box(paragraph.scan(/\n/).size + 1) if QuestData::DESCRIPTION_IN_BOX
    # Draw Description Label
    draw_heading(:description, y) unless QuestData::VOCAB[:description].empty?
    # Draw Description
    y += line_height if !QuestData::VOCAB[:description].empty? || QuestData::DESCRIPTION_IN_BOX
    draw_text_ex(description_x, y, paragraph)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Objectives
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_objectives
    y = @draw_y
    unless QuestData::VOCAB[:objectives].empty?
      draw_heading(:objectives, y)
      y += line_height
    end
    @quest.revealed_objectives.each { |obj_id| y = draw_objective(obj_id, y) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Objective
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_objective(obj_id, y)
    bullet = QuestData::VOCAB[:objective_bullet]
    bullet_tw = text_size(bullet).width + 2
    buff = (objective_x*2) + bullet_tw
    paragraph = mapf_format_paragraph(@quest.objectives[obj_id], contents_width - buff)
    line_num = 1 + paragraph.scan(/\n/).size
    # Since draw_text_ex resets the font, set colour here
    @maqj_objective_color = quest_objective_colour(@quest, obj_id)
    change_color(text_color(QuestData::COLOURS[:objective_bullet]))
    draw_text(objective_x, y, bullet_tw, line_height, sprintf(bullet, obj_id + 1))
    draw_text_ex(objective_x + bullet_tw, y, paragraph)
    @maqj_objective_color = false
    y += (line_num*line_height)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Rewards
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_rewards
    y = @draw_y
    unless QuestData::VOCAB[:rewards].empty?
      draw_heading(:rewards, y)
      y += line_height
    end
    for i in [email protected] do draw_reward(i, y + i*line_height) end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Reward
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_reward(r_id, y)
    reward = @quest.rewards[r_id]
    case reward[0]
    when :item, 0   # Item
      draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
    when :weapon, 1 # Weapon
      draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
    when :armor, 2  # Armor
      draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
    when :gold, 3   # Gold
      draw_basic_data(y, QuestData::ICONS[:reward_gold],
        QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
    when :exp, 4    # Exp
      draw_basic_data(y, QuestData::ICONS[:reward_exp],
        QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
    when :string, 5 # String
      draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3] : "",
        reward[2] ? reward[2] : "")
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item Reward
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_item_reward(y, item, amount = 1)
    w = contents_width
    w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
    x = (contents_width - w) / 2
    draw_item_name(item, x, y, true, w - 40)
    if amount > 1
      change_color(text_color(QuestData::COLOURS[:reward_amount]))
      draw_text(x + w - 40, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Basic Data Methods
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  QuestData::BASIC_DATA_TYPES.each { |data_type|
    define_method(:"draw_#{data_type}") {
      draw_basic_data(@draw_y, QuestData::ICONS[data_type],
        QuestData::VOCAB[data_type], @quest.send(data_type))
    }
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Basic Data
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_basic_data(y, icon_index, vocab, value)
    w = contents_width
    w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
    x = (contents_width - w) / 2
    unless icon_index == 0
      draw_icon(icon_index, x, y)
      x += 24
      w -= 24
    end
    tw = text_size(vocab).width
    #change_color(text_color(QuestData::COLOURS[:basic_label]))
    draw_text(x, y, tw + 16, line_height, vocab)
    change_color(text_color(QuestData::COLOURS[:basic_value]))
    draw_text(x + tw, y, w - tw, line_height, value, 2)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Heading
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_heading(data_type, y)
    set_data_font(:heading)
    clear_and_draw_text(40, y, contents_width - 80, line_height,
      QuestData::VOCAB[data_type], QuestData::HEADING_ALIGN[data_type])
    reset_font_settings
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear and Draw Text
  #    Clear the field before drawing the text
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_and_draw_text(*args)
    rect = []
    while !args[0].is_a?(String) do rect.push(args.shift) end
    rect[0].is_a?(Rect) ? rect = rect[0] : rect = Rect.new(*rect)
    align = args[1] ? args[1] : 0
    ts = text_size(args[0])
    ts.width = [ts.width + 4, rect.width].min
    align == 1 ? ts.x = rect.x + ((rect.width - ts.width) / 2) :
      align == 2 ? ts.x = rect.x + rect.width - ts.width : ts.x = rect.x
    ts.y = rect.y
    contents.clear_rect(ts)
    ts.x += 2
    draw_text(ts, args[0], align)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Description Box
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_box(line_num)
    return if line_num < 1
    x = (line_height / 2) - 1
    y = @draw_y + (line_height / 2) - 1
    w = contents_width - 2*x
    h = (1 + line_num)*line_height
    draw_rect_outline_with_shadow(x, y, w, h)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Rect Outline
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_rect_outline(x, y, w, h, colour)
    # Horizontal Lines
    contents.fill_rect(x, y, w, 2, colour)
    contents.fill_rect(x, y + h - 2, w, 2, colour)
    # Vertical Lines
    contents.fill_rect(x, y, 2, h, colour)
    contents.fill_rect(x + w - 2, y, 2, h, colour)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Rect Outline with Shadow
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_rect_outline_with_shadow(x, y, w, h)
    draw_rect_outline(x + 1, y + 1, w, h, text_color(QuestData::COLOURS[:line_shadow]))
    draw_rect_outline(x, y, w, h, text_color(QuestData::COLOURS[:line]))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Objective/Description X
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def objective_x; line_height / 2; end
  def description_x; QuestData::DESCRIPTION_IN_BOX ? line_height : (line_height/2); end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update(*args, &block)
    super(*args, &block)
    if open? && active && @dest_scroll_oy == self.oy
      scroll_down if Input.press?(:DOWN)
      scroll_up if Input.press?(:UP)
    end
    if self.oy != @dest_scroll_oy
      mod = (@dest_scroll_oy <=> self.oy)
      self.oy += 3*mod
      self.oy = @dest_scroll_oy if (@dest_scroll_oy <=> self.oy) != mod
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Scroll Down
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def scroll_down(*args, &block)
    max_oy = contents_height - maqj_visible_height
    dest = ((@dest_scroll_oy / line_height) + 1)*line_height
    @dest_scroll_oy = [dest, max_oy].min
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Scroll Up
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def scroll_up(*args, &block)
    dest = ((@dest_scroll_oy / line_height) - 1)*line_height
    @dest_scroll_oy = [dest, 0].max
  end
end

#==============================================================================
# ** Scene_Quest
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class handles processing for the Quest scene
#==============================================================================

class Scene_Quest < Scene_MenuBase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Scene Processing
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start
    super
    @init_category, @init_quest_index = $game_party.quests.find_location($game_system.last_quest_id, $game_system.last_quest_cat)
    create_maqj_picture unless $game_system.quest_bg_picture.empty?
    create_all_windows
    adjust_window_positions
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Terminate Scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def terminate
    $game_system.quest_categories = QuestData::CATEGORIES
    $game_system.quest_scene_label = QuestData::VOCAB[:scene_label]
    $game_system.last_quest_id = @quest_list_window.item ? @quest_list_window.item.id : 0
    $game_system.last_quest_cat = @quest_category_window.item
    super
    dispose_maqj_picture
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Background Picture
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_maqj_picture
    @maqj_picture_sprite = Sprite.new
    @maqj_picture_sprite.bitmap = Cache.picture($game_system.quest_bg_picture)
    @maqj_picture_sprite.opacity = $game_system.quest_bg_opacity
    @maqj_picture_sprite.blend_type = $game_system.quest_bg_blend_type
    @maqj_picture_sprite.z = @background_sprite.z + 1 if @background_sprite
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create All Windows
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_all_windows
    create_quest_label_window unless $game_system.quest_scene_label.empty?
    create_quest_category_window if $game_system.quest_categories.size > 1
    create_quest_category_label_window if QuestData::SHOW_CATEGORY_LABEL
    create_dummy_category_window if QuestData::CATEGORY_LABEL_IN_SAME_WINDOW &&
      @quest_category_window && @quest_category_label_window
    create_quest_list_window
    create_quest_data_window
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create QuestLabel Window
  #    This window shows the name of the scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_quest_label_window
    @quest_label_window = Window_QuestLabel.new(0, 0, $game_system.quest_scene_label)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create QuestCategory Window
  #    This window allows the player to switch categories.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_quest_category_window
    @quest_category_window = Window_QuestCategory.new(0, 0, $game_system.quest_categories)
    @quest_category_window.category = @init_category if @init_category
    @quest_category_window.set_handler(:cancel, method(:on_category_cancel))
    @quest_category_window.set_handler(:ok, method(:on_category_ok))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create QuestCategoryLabel Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_quest_category_label_window
    if @quest_category_window
      @quest_category_label_window = Window_QuestCategoryLabel.new(0, @quest_category_window.height)
      @quest_category_window.add_observing_proc(:label) { |category|
        @quest_category_label_window.category = category }
    else
      @quest_category_label_window = Window_QuestCategoryLabel.new(0, 0)
      @quest_category_label_window.category = $game_system.quest_categories ? $game_system.quest_categories[0] : :all
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Dummy Category Label Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_dummy_category_window
    @quest_category_label_window.y -= 12
    @quest_category_label_window.opacity = 0
    @quest_category_window.opacity = 0
    w = [@quest_category_window.width, @quest_category_label_window.width].max
    h = @quest_category_window.height + @quest_category_label_window.height - 12
    @category_dummy_window = Window_QuestCategoryDummy.new(0, 0, w, h)
    @category_dummy_window.z = [@quest_category_window.z, @quest_category_label_window.z].min - 1
    # Draw Horz Line
    @category_dummy_window.draw_horizontal_line(@quest_category_window.height - @quest_category_window.padding - 7, 2)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create QuestList Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_quest_list_window
    if @category_dummy_window
      y = @category_dummy_window.height
    else
      y = @quest_category_window ? @quest_category_window.height : 0
      y += @quest_category_label_window ? @quest_category_label_window.height : 0
      y = @quest_label_window.height if y == 0
    end
    @quest_list_window = Window_QuestList.new(0, y, QuestData::LIST_WINDOW_WIDTH,
      Graphics.height - y)
    @quest_list_window.set_handler(:ok, method(:on_list_ok))
    if !QuestData::CONCURRENT_ACTIVITY
      @quest_list_window.deactivate
      @quest_list_window.set_handler(:cancel, method(:on_list_cancel))
    end
    if @quest_category_window
      @quest_category_window.add_observing_proc(:list) { |category|
        @quest_list_window.category = category }
    else
      @quest_list_window.category = $game_system.quest_categories[0]
    end
    @quest_list_window.index = @init_quest_index if @init_quest_index
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create QuestData Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_quest_data_window
    x = @quest_list_window.width
    y = (@quest_label_window && (@quest_category_window ||
      @quest_category_label_window)) ? @quest_label_window.height : 0
    @quest_data_window = Window_QuestData.new(x, y, Graphics.width - x,
      Graphics.height - y)
    @quest_list_window.help_window = @quest_data_window
    @quest_data_window.quest = @quest_list_window.item
    @quest_data_window.set_handler(:ok, method(:on_data_ok))
    @quest_data_window.set_handler(:cancel, method(:on_data_cancel))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose Background Picture
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose_maqj_picture
    @maqj_picture_sprite.dispose if @maqj_picture_sprite
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Adjust Window Positions
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def adjust_window_positions
    if @quest_label_window && (@quest_category_window || @quest_category_label_window)
      @quest_label_window.x = QuestData::LIST_WINDOW_WIDTH
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Category OK
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_category_ok; @quest_list_window.activate; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Category Cancel
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_category_cancel; return_scene; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * List OK
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_list_ok
    @quest_category_window.deactivate
    @quest_data_window.activate
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * List Cancel
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_list_cancel; @quest_category_window.activate; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Data OK
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_data_ok; on_data_cancel; end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Data Cancel
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def on_data_cancel
    @quest_list_window.activate
    @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update All Windows
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_all_windows(*args, &block)
    # To accomodate for concurrent activity, must deactivate category
    @quest_category_window.deactivate if QuestData::CONCURRENT_ACTIVITY &&
      @quest_list_window.active && Input.trigger?(:C)
    super(*args, &block)
    @quest_category_window.activate if QuestData::CONCURRENT_ACTIVITY &&
      @quest_list_window.active
  end
end

#==============================================================================
# ** Scene_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_scene
#    new methods - update_call_quest_journal; call_quest_journal
#==============================================================================

class Scene_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maqj_updascne_9kh4 update_scene
  def update_scene(*args, &block)
    maqj_updascne_9kh4(*args, &block)
    update_call_quest_journal if $game_system.quest_map_access && !scene_changing?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Call Quest Journal
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_call_quest_journal
    if $game_map.interpreter.running?
      @quest_journal_calling = false
    else
      if Input.trigger?(QuestData::MAP_BUTTON)
        $game_system.quest_access_disabled || $game_party.quests.list.empty? ?
          Sound.play_buzzer : @quest_journal_calling = true
      end
      call_quest_journal if @quest_journal_calling && !$game_player.moving?
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Call Quest Journal
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def call_quest_journal
    @quest_journal_calling = false
    Sound.play_ok
    SceneManager.call(Scene_Quest)
  end
end

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

#==============================================================================
# ** Game_System
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new public instance variable - maic_menu_commands
#    aliased method - initialize
#==============================================================================

class Game_System
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Inserted Menu Commands
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_inserted_menu_commands
    # Lazy Instantiation so that old save files are not corrupted
    if !@maic_inserted_menu_commands
      @maic_inserted_menu_commands = MA_COMMAND_INSERTS.keys
      # Sort by index
      @maic_inserted_menu_commands.sort! { |a, b| MA_COMMAND_INSERTS[a].index <=> MA_COMMAND_INSERTS.index }
    end
    @maic_inserted_menu_commands
  end
end

#==============================================================================
# ** Window_MenuCommand
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - make_command_list; maic_insert_command
#==============================================================================

class Window_MenuCommand
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Command List
  #``````````````````````````````````````````````````````````````````````````
  #  I alias this method instead of add_original_commands because I need to
  # have all commands created before I can insert at the correct index
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maic_mkcmmndl_6yd2 make_command_list
  def make_command_list(*args, &block)
    maic_mkcmmndl_6yd2(*args, &block) # Run Original Method
    # Insert new commands
    $game_system.maic_inserted_menu_commands.each { |sym| maic_insert_command(sym) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Insert Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_insert_command(symbol)
    command = MA_COMMAND_INSERTS[symbol]
    # Get the command name
    name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
    # Check whether enabled
    enabled = case command.enable
    when Integer then command.enable == 0 ? true : $game_switches[command.enable]
    when String then eval(command.enable)
    when Symbol then self.send(command.enable)
    else
      enabled = true
    end
    # Add the command to the list
    add_command(name, symbol, enabled)
    added = @list.pop
    @list.insert([command.index, @list.size].min, added) # Insert at specific index
  end
end

#==============================================================================
# ** Scene_Menu
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - create_command_window; on_personal_ok
#    new methods - maic_set_insert_handler; maic_command_insert
#==============================================================================

class Scene_Menu
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Command Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maic_createcndwin_3ey7 create_command_window
  def create_command_window(*args, &block)
    maic_createcndwin_3ey7(*args, &block) # Run Original Method
    # Add handlers for all custom commands
    $game_system.maic_inserted_menu_commands.each { |symbol| maic_set_insert_handler(symbol) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Inserted Handler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_set_insert_handler(symbol)
    other = MA_COMMAND_INSERTS[symbol].other
    handler = case other
    when Symbol then method(other)
    when String then lambda { eval(other) }
    when TrueClass then method(:command_personal)
    else
      handler = method(:maic_command_insert)
    end
    @command_window.set_handler(symbol, handler)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Custom Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_command_insert
    SceneManager.call(Kernel.const_get(MA_COMMAND_INSERTS[@command_window.current_symbol].scene))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Personal OK
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maic_onpok_3ek9 on_personal_ok
  def on_personal_ok(*args, &block)
    if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
      maic_command_insert
    else
      maic_onpok_3ek9(*args, &block) # Run Original Method
    end
  end
end

$imported[:MA_InsertCommand] = true
end

MA_COMMAND_INSERTS[:quest_journal] =
  MA_InsertableMenuCommand.new(QuestData::VOCAB[:menu_label], QuestData::MENU_INDEX,
  "!$game_system.quest_access_disabled && !$game_party.quests.list.empty?",
  :Scene_Quest, false)
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
382
在线时间
36 小时
注册时间
2018-4-14
帖子
51
7
发表于 2018-5-5 11:03:25 | 只看该作者
#encoding:utf-8
#==============================================================================
# ■ Window_MissionBoard
#------------------------------------------------------------------------------
#  任务提示板
#   by Harinlen
#   暴力修改 by Azuneko
#==============================================================================

class Window_MissionBoard < Window_Command
  #--------------------------------------------------------------------------
  # ● 初始化指令选择位置(类方法)
  #--------------------------------------------------------------------------
  def self.init_command_position
    @@last_command_symbol = nil
  end
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(16, 100)
    self.height = 416
    self.opacity = 0
    @data = []
  end
  
  
  def make_command_list
    payload_all_mission
  end
  #--------------------------------------------------------------------------
  # ● 加载所有任务
  #--------------------------------------------------------------------------
  def payload_all_mission
    $task_index = [0]
    temp_task_enabled = true
    temp_num = 1..1
    case $game_variables[5]
    when 0..17
      temp_num = 5..6
    when 18..25
      temp_num = 5..9
    when 26..99
      temp_num = [8,10,11,12]
    #when 11..99
    #  temp_num = [1,2,4]
    end
    j = 0
    for i in temp_num#1..MissionInfo::AllMissionNum
      temp_task_enabled = !$game_party.quests.revealed?(i-1)
      add_command(MissionInfo::AllMission[i]["name"],   :item,   temp_task_enabled)
      $task_index[j] = i
      j = j+1
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 200
  end
  #--------------------------------------------------------------------------
  # ● 描绘图标
  #--------------------------------------------------------------------------
  def draw_item(index)
    enabled = command_enabled?(index)
    change_color(normal_color, enabled)
    rect = item_rect_for_text(index)
    text = command_name(index)
    draw_text_icon(rect.clone, text, alignment, enabled, index)
  end
  def draw_text_icon(rect, text, alignment, enabled, index)
    icon = $game_party.quests.revealed?($task_index[index]-1) ? 190 : 189
    cw = text_size(text).width
    draw_icon(icon, rect.x , rect.y, enabled)
    rect.x -= 16
    rect.width += 24
    draw_text(rect, text, alignment)
  end
  #--------------------------------------------------------------------------
  # ● 按下确定键时的处理
  #--------------------------------------------------------------------------
  def process_ok
    @@last_command_symbol = index
    super
  end
  #--------------------------------------------------------------------------
  # ● 返回最后一个选项的位置
  #--------------------------------------------------------------------------
  def select_last
    select(@@last_command_symbol)
  end
end


class Window_Yescheckuse < Window_Command
  def self.init_command_position
    @@last_command_symbol = nil
  end
  def initialize
    super(0, 0)
    self.visible = false
  end
  def window_width
      return 128
  end
  def make_command_list
    tmplist
  end
  def tmplist
    add_command("接受委托",   :getmission,   true)
    add_command("取消", :cancel,   true)
  end
end

class Window_MissionInfos < Window_QuestData #< Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(268, 24, 260, 414)#(160, 0, 384, 414)
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 技能、物品等
  #--------------------------------------------------------------------------
  def set_index(index)
    @text = MissionInfo::AllMission[1]["name"]
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
  end
  
  def draw_rewards(id,y)
    @rewards = MissionInfo::AllMission[id]["rewards"]
    for i in [email protected] do draw_reward(i, y + i*line_height) end
  end
  
  def draw_reward(r_id, y)
    reward = @rewards[r_id]
    case reward[0]
    when :item, 0   # Item
      draw_item_reward(y, $data_items[reward[1]], reward[2] ? reward[2] : 1)
    when :weapon, 1 # Weapon
      draw_item_reward(y, $data_weapons[reward[1]], reward[2] ? reward[2] : 1)
    when :armor, 2  # Armor
      draw_item_reward(y, $data_armors[reward[1]], reward[2] ? reward[2] : 1)
    when :gold, 3   # Gold
      draw_basic_data(y, QuestData::ICONS[:reward_gold],
        QuestData::VOCAB[:reward_gold], (reward[1] ? reward[1] : 0).to_s)
    when :exp, 4    # Exp
      draw_basic_data(y, QuestData::ICONS[:reward_exp],
        QuestData::VOCAB[:reward_exp], (reward[1] ? reward[1] : 0).to_s)
    when :string, 5 # String
      draw_basic_data(y, reward[1] ? reward[1] : 0, reward[3] ? reward[3] : "",
        reward[2] ? reward[2] : "")
    end
  end
  
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item Reward
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_item_reward(y, item, amount = 1)
    w = contents_width
    w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
    x = (contents_width - w) / 2
    draw_item_name(item, x, y, true, w - 40)
    if amount > 1
      change_color(text_color(QuestData::COLOURS[:reward_amount]))
      draw_text(x + w - 140, y, 40, line_height, sprintf(QuestData::VOCAB[:reward_amount], amount), 2)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Basic Data Methods
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  QuestData::BASIC_DATA_TYPES.each { |data_type|
    define_method(:"draw_#{data_type}") {
      draw_basic_data(@draw_y, QuestData::ICONS[data_type],
        QuestData::VOCAB[data_type], @quest.send(data_type))
    }
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Basic Data
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_basic_data(y, icon_index, vocab, value)
    w = contents_width
    w = QuestData::BASIC_DATA_WIDTH if QuestData::BASIC_DATA_WIDTH.between?(1, w)
    x = (contents_width - w) / 2
    unless icon_index == 0
      draw_icon(icon_index, x, y)
      x += 24
      w -= 24
    end
    tw = text_size(vocab).width
    #change_color(text_color(QuestData::COLOURS[:basic_label]))
    draw_text(x, y, tw + 16, line_height, vocab)
    change_color(text_color(QuestData::COLOURS[:basic_value]))
    draw_text(x + tw - 100, y, w - tw, line_height, value, 2)
  end
  
  def draw_mission_details(id)
    contents.clear
    change_color(text_color(6))
    draw_text(4, 0, self.width, line_height, MissionInfo::AllMission[id]["name"])
    change_color(text_color(6))
    draw_text(4, 30, self.width, line_height, "委托人:")
    change_color(normal_color)
    draw_text_ex(4, 55, MissionInfo::AllMission[id]["client"])
    change_color(text_color(6))
    draw_text(4, 80, self.width, line_height, "地点:")
    change_color(normal_color)
    draw_text_ex(4, 105, MissionInfo::AllMission[id]["location"])
    change_color(text_color(6))
    draw_text(4, 130, self.width, line_height, "委托描述:")
    change_color(normal_color)
    draw_text_ex(4, 155, MissionInfo::AllMission[id]["description"])
    change_color(text_color(6))
    draw_text(4, 226, self.width, line_height, "委托奖励:")
    change_color(normal_color)
    draw_rewards(id, 249)
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
end

class Scene_Mission < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_helpwin
    create_mission_board
    create_yeslist
    create_board_bg
    @last_mission_id = -1
  end
  #--------------------------------------------------------------------------
  # ☆ 生背景图形
  #--------------------------------------------------------------------------
  def create_board_bg
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = Cache.system("taskboard")
  end
  #--------------------------------------------------------------------------
  # ● 生成指令窗口
  #--------------------------------------------------------------------------
  def create_mission_board
    @mission_window = Window_MissionBoard.new
    @mission_window.help_window = @mission_window_help
    @mission_window.set_handler(:ok,    method(:on_personal_ok))
    @mission_window.set_handler(:cancel,    method(:return_scene))
  end
  def create_helpwin
    @mission_window_help = Window_MissionInfos.new
  end
  def create_yeslist
    @mission_yes = Window_Yescheckuse.new
    @mission_yes.x = 208#360
    @mission_yes.y = 192#300
    @mission_yes.set_handler(:ok,        method(:okpress))
    @mission_yes.set_handler(:cancel,    method(:quxiao))
  end
  def okpress
    $game_party.quests[@last_mission_id-1]
    @interpreter2 = Game_Interpreter.new
    @interpreter2.reveal_objective(@last_mission_id-1,0)
    @mission_yes.unselect
    @mission_yes.hide.deactivate
    @mission_window.activate
    @mission_window.select_last
    @mission_window.refresh
  end
  def quxiao
    @mission_yes.unselect
    @mission_yes.hide.deactivate
    @mission_window.activate
    @mission_window.select_last
  end
  def on_personal_ok
    @mission_window.unselect
    @mission_yes.show.activate
    @mission_yes.select(0)
  end
  def update
    super
    if @mission_window.index >= 0
      @mission_window_help.draw_mission_details($task_index[@mission_window.index])
      @last_mission_id = $task_index[@mission_window.index]#@mission_window.index
    end
  end
  #GSR 1.5
  alias gsr_terminate terminate
  def terminate
      super
      @menuback_sprite.dispose if @menuback_sprite
  end
end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
382
在线时间
36 小时
注册时间
2018-4-14
帖子
51
8
发表于 2018-5-5 11:23:15 | 只看该作者
具体怎么用我也没看懂,毕竟是其它地方找来的,要改任务的话应该是在第一个脚本里。
自己试了一下,complete_objective(1, 0)1是代表任务,1对应脚本里的任务2 0是代表提示具体如图,objectives0是代表任务提示为0是所出现的字:帮师兄留意下吧!
quest(2)是代表任务,2对应脚本里的任务2
貌似两个都要设置。
奖励的话要自己设置事件,比如说找NPC交任务时开启一个开关[暂时为1],然后在公共世界里设置一个并行处理的事件,当1开启时获得奖励物品[自己设置]
然后在关闭开关1,注意:“交任务时要设置一个独立开关,不然领取奖励时开关1最后会关闭,就可以一直刷奖励”

我说的不怎么彻底,可能有些地方听不懂,具体可以参考 沧溟剑誓 ,游戏还挺好玩的,作者寒枫也挺辛苦的。

TIM图片20180505112041.png (4.22 KB, 下载次数: 30)

TIM图片20180505112041.png
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5479
在线时间
1668 小时
注册时间
2016-8-1
帖子
413
9
发表于 2018-5-10 00:17:11 | 只看该作者
本帖最后由 穿越时空之剑 于 2018-5-10 00:26 编辑

根本就不需要脚本,以下是一个简单的具有分支选项的任务流程。

阳光下的真实
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-27 17:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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