#===================================
# Â Leon's Mission Script v2.0
#----------------------------------------------------------------------
# Â 2006-09-22
#===================================
=begin
Description:
I did a drastic overhaul on this Mission/Quest script to make it much better and user friendly.
Â
Features:
There is 2 new features: Â
1. Â If the user doesn't know of the mission, it doesn'tappear in the list, nor does a slot for it.
2. Â Completed missions are in green.
3. Â Number of missions. Â (X/Y) Â X is completed missions, Y can be either known missions,
   or your game's total missions.  Set Mission_Setup to 'true' if you want known missions,
   false for total.
Â
Instructions:
Put it above main.
Â
The instructions have changed alot more than the features. Â Just go through
the short list below, and you'll know. Â Just remember, go in order, and if you have 10
different missions in 1 spot, you must have the same number in each other segment
of the module, with the exception of the lines of text. Â (Yes, i made that one all the easier.)
Â
Changing the status of the missions is different than before as well.
Â
You can use $game_party.mission[x] += y  to add to a mission's status, x = mission#, y = amount.
Â
or set it using $game_party.mission[x] = y, x being the mission id,
y being the status you want it set to.
Â
1 = they dont know the mission
2 = they know the mission, but it is incomplete
3 = the mission is complete.
Â
Do NOT post my work in any other forums without my permission, and NEVER take credit
for my work.
=end
Â
#==================================
# Â ** Mission_Menu
#==================================
module Mission_Menu
 #--------------------------------------------------------------------
 #  * Mission Name-  Write the mission number, and the name you want to appear.
 #  ~ mission_id => "mission name"
 #--------------------------------------------------------------------
 Mission_Name = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Mission_Sprite.  holds data on the name of the sprite, it's hue, name, locale, and
 #  * reward all in one.
 #  ~ mission_id => ["sprite name", hue, name, location, Reward]
 #--------------------------------------------------------------------
 Mission_Sprite = {
 0 => ["", 0, "", "", ""],
 1 => ["", 0, "", "", ""],
 2 => ["", 0, "", "", ""],
 3 => ["", 0, "", "", ""],
 4 => ["", 0, "", "", ""],
 5 => ["", 0, "", "", ""],
 6 => ["", 0, "", "", ""]
 }
 #--------------------------------------------------------------------
 #  * Defines the mission.  Remember, if it is too long for 1 line, you can drop it
 #  * down to line 2.
 #  ~ mission_id => "Line One"
 #--------------------------------------------------------------------
 Mission_L1 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Two"
 #--------------------------------------------------------------------
 Mission_L2 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Three"
 #--------------------------------------------------------------------
 Mission_L3 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Four"
 #--------------------------------------------------------------------
 Mission_L4 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Five"
 #--------------------------------------------------------------------
 Mission_L5 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Six"
 #--------------------------------------------------------------------
 Mission_L6 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Seven"
 #--------------------------------------------------------------------
 Mission_L7 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Same as the above one.
 #  ~ mission_id => "Line Eight"
 #--------------------------------------------------------------------
 Mission_L8 = {
 0 => "",
 1 => "",
 2 => "",
 3 => "",
 4 => "",
 5 => "",
 6 => ""
 }
 #--------------------------------------------------------------------
 #  * Mission Set-up
 #--------------------------------------------------------------------
 Mission_Setup = true
end
Â
#----------------------------------------------------------------------
# Â * Game_Party
#----------------------------------------------------------------------
class Game_Party
 #--------------------------------------------------------------------
 #  * Attributes
 #--------------------------------------------------------------------
 attr_accessor   :mission
 #--------------------------------------------------------------------
 #  * Alias Listings
 #--------------------------------------------------------------------
 alias leon_gp_mission_initialize initialize
 #--------------------------------------------------------------------
 #  * Object initialization
 #--------------------------------------------------------------------
 def initialize
  leon_gp_mission_initialize
  @mission = [[0, 2], [1, 3], [2, 1], [3, 3], [4, 4], [5,5], [6,6]]
 end
end
#--------------------------------------------------------------------
# Â * Ends Game_Party
#--------------------------------------------------------------------
Â
#----------------------------------------------------------------------
# Â * Window_Missionhelp
#----------------------------------------------------------------------
class Window_Missionhelp < Window_Base
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize
  super(0, 0, 400, 60)
  self.contents = Bitmap.new(width - 32, height - 32)
 end
 #--------------------------------------------------------------------
 #  * Update
 #--------------------------------------------------------------------
 def update(help_text)
  self.contents.clear
  self.contents.draw_text(0, 0, 440, 32, help_text)
 end
Â
end
#----------------------------------------------------------------------
# Â * End Window_Missionhelp
#----------------------------------------------------------------------
Â
#----------------------------------------------------------------------
# Â Window_MissionNum
#----------------------------------------------------------------------
class Window_MissionNum < Window_Base
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize
  super(400, 0, 240, 64)
  self.contents = Bitmap.new(width - 32, height - 32)
  refresh
 end
Â
 #--------------------------------------------------------------------
 #  * Refresh
 #--------------------------------------------------------------------
 def refresh
  self.contents.clear
  mis = Mission_Menu
  self.contents.font.color = system_color
  self.contents.draw_text(0, 0, 120, 32, "Missions:")
  self.contents.font.color = normal_color
  @mission_comp = []
  @mission_know = []
  #Calls Mission number of missions
  for i in 0...$game_party.mission.size
   if $game_party.mission[i][1] == 3
    @mission_comp.push(i)
   end
  end
  #Calls Mission number of missions
  for j in 0...$game_party.mission.size
   if $game_party.mission[j][1] > 1
    @mission_know.push(j)
   end
  end
  #if Mission_Setup is false...
  if mis::Mission_Setup == false
   if @mission_comp.size == $game_party.mission.size
    self.contents.font.color = Color.new(40, 250, 40, 255)
    self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
    "/" + $game_party.mission.size.to_s, 2)
    self.contents.font.color = normal_color
   else
    self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
    "/" + $game_party.mission.size.to_s, 2)
   end
   #if Mission_Setup is true...
  elsif mis::Mission_Setup == true
   if @mission_comp.size == @mission_know.size
    self.contents.font.color = Color.new(40, 250, 40, 255)
    self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
    "/" + @mission_know.size.to_s, 2)
    self.contents.font.color = normal_color
   else
    self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s +
    "/" + @mission_know.size.to_s, 2)
   end
  end
 end
end
#----------------------------------------------------------------------
# Â * End Window_Missionnum
#----------------------------------------------------------------------
Â
Â
#----------------------------------------------------------------------
# Â Window_Missionlist
#----------------------------------------------------------------------
class Window_Missionlist < Window_Selectable
 #--------------------------------------------------------------------
 #  * Attribute listings
 #--------------------------------------------------------------------
 attr_accessor   :mission
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize
  super(0, 60, 260, 420)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.index = 0
  refresh
 end
 #--------------------------------------------------------------------
 #  * Mission
 #--------------------------------------------------------------------
 def mission
  return @data[self.index]
 end
 #--------------------------------------------------------------------
 #  * Refresh
 #--------------------------------------------------------------------
 def refresh
  if self.contents != nil
   self.contents.dispose
   self.contents = nil
  end
  mis = Mission_Menu
  @data = []
  for i in 0...$game_party.mission.size
   mission1 = $game_party.mission[i][0]
   mission2 = $game_party.mission[i][1]
   if mission2 > 1
    @data.push(mission1)
   end
  end
  @item_max = @data.size
  if @item_max > 0
   self.contents = Bitmap.new(width - 32, row_max * 32)
   for i in 0...@item_max
    draw_item(i)
   end
  end
 end
 #--------------------------------------------------------------------
 #  * Draw_Item
 #--------------------------------------------------------------------
 def draw_item(index)
  mis = Mission_Menu
  mission3 = @data[index]
  x = 4
  y = index * 32
  rect = Rect.new(x, y, self.width - 32, 32)
  self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  if $game_party.mission[mission3][1] == 3
   self.contents.font.color = Color.new(40, 250, 40, 255)
   self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission3])
  else
   self.contents.font.color = normal_color
   self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission3])
  end
 end
Â
end
#----------------------------------------------------------------------
# Â * End Window_Missionlist
#----------------------------------------------------------------------
Â
#----------------------------------------------------------------------
# Â Window_Missioncomp
#----------------------------------------------------------------------
class  Window_Missioncomp < Window_Base
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize(mission)
  super(260, 365, 380, 115)
  self.contents = Bitmap.new(width - 32, height - 32)
  refresh(mission)
 end
 #--------------------------------------------------------------------
 #  * Refresh
 #--------------------------------------------------------------------
 def refresh(mission)
  self.contents.clear
  self.contents.font.color = system_color
  self.contents.draw_text(0, 52, 440, 32, "Status:")
  self.contents.draw_text(170, 52, 440, 32, "")
  self.contents.font.color = normal_color
  #person place status reward
  mis = Mission_Menu
  if mis::Mission_Sprite.has_key?(mission)
   if $game_party.mission[mission][1] > 1
    self.contents.draw_text(36, 6, 440, 32,
    mis::Mission_Sprite[mission][2] + ", " + mis::Mission_Sprite[mission][3])
    case $game_party.mission[mission][1]
    when 1
     self.contents.draw_text(62, 52, 400, 32, "")
    when 2
     self.contents.draw_text(62, 52, 400, 32, "    Incomplete")
     self.contents.draw_text(242, 52, 138, 32, "    ")
    when 3
     self.contents.font.color = Color.new(40, 250, 40, 255)
     self.contents.draw_text(62, 52, 400, 32, "    Complete")
     self.contents.draw_text(242, 52, 138, 32, mis::Mission_Sprite[mission][4])
    end
    bitmap = RPG::Cache.character(mis::Mission_Sprite[mission][0],
    mis::Mission_Sprite[mission][1])
    cw = bitmap.width / 4
    ch = bitmap.height / 4
    facing = 0
    src_rect = Rect.new(0, facing * ch, cw, ch)
    self.contents.blt(0, 0, bitmap, src_rect)
   end
  end
 end
Â
 def clear
  self.contents.clear
 end
Â
end
#--------------------------------------------------------------------
# Â * Ends Window_Missioncomp
#--------------------------------------------------------------------
Â
Â
#----------------------------------------------------------------------
# Â Window_Missiondesc
#----------------------------------------------------------------------
class Window_Missiondesc < Window_Base
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize(mission)
  super(260, 60, 380, 305)
  self.contents = Bitmap.new(width - 32, height - 32)
 end
 #--------------------------------------------------------------------
 #  * Refresh
 #--------------------------------------------------------------------
 def refresh(mission)
  self.contents.clear
  mis = Mission_Menu
  self.contents.draw_text(30, 0, 348, 32, mis::Mission_L1[mission].to_s)
  self.contents.draw_text(0, 32, 348, 32, mis::Mission_L2[mission].to_s)
  self.contents.draw_text(0, 64, 348, 32, mis::Mission_L3[mission].to_s)
  self.contents.draw_text(0, 96, 348, 32, mis::Mission_L4[mission].to_s)
  self.contents.draw_text(0, 128, 348, 32, mis::Mission_L5[mission].to_s)
  self.contents.draw_text(0, 160, 348, 32, mis::Mission_L6[mission].to_s)
  self.contents.draw_text(0, 192, 348, 32, mis::Mission_L7[mission].to_s)
  self.contents.draw_text(0, 224, 348, 32, mis::Mission_L8[mission].to_s)
 end
end
#--------------------------------------------------------------------
# Â * Ends Window_Missiondesc
#--------------------------------------------------------------------
Â
Â
#====================================
# Â Scene_MissionMenu
#====================================
class Scene_Missionmenu
 #--------------------------------------------------------------------
 #  * Object Initialization
 #--------------------------------------------------------------------
 def initialize(menu_index = 0)
  @menu_index = menu_index
 end
 #--------------------------------------------------------------------
 #  * Main
 #--------------------------------------------------------------------
 def main
 Â
  @missionhelp_window = Window_Missionhelp.new
  @missionlist_window = Window_Missionlist.new
  @missionnum_window = Window_MissionNum.new
  @missioncomp_window = Window_Missioncomp.new(@missionlist_window.mission)
  @missiondesc_window = Window_Missiondesc.new(@missionlist_window.mission)
  @mission = @missionlist_window.mission
 Â
 Â
  Graphics.transition
  loop do
   Graphics.update
   Input.update
   update
   if $scene != self
    break
   end
  end
  Graphics.freeze
  @missionhelp_window.dispose
  @missiondesc_window.dispose
  @missioncomp_window.dispose
  @missionlist_window.dispose
  @missionnum_window.dispose
 end
 #--------------------------------------------------------------------
 #  * Update
 #--------------------------------------------------------------------
 def update
  mis = Mission_Menu
  @missionhelp_window.update("Select a mission to see details.")
  @missiondesc_window.refresh(@missionlist_window.mission)
  @missioncomp_window.refresh(@missionlist_window.mission)
  @missionlist_window.update
  @missionnum_window.update
  if Input.trigger?(Input::B)
   $game_system.se_play($data_system.cancel_se)
   $scene = Scene_Menu.new
  end
  return
 end
Â
end
#--------------------------------------------------------------------
# Â * Ends Scene_Missionmenu
#--------------------------------------------------------------------
Â