Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Quest Journal
- # Version: 2.0a
- # Author: modern algebra (rmrk.net)
- # Date: May 5, 2011
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # 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 use
- # update quest progress via script call. Therefore, pay close attention to
- # the instructions both here and in the EDITABLE REGIONS.
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Instructions:
- #
- # As with the previous version, 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 section (as you will see if you have the demo).
- # 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, that is only to make
- # things neater and has no functional relevance; it's up to you.
- #
- # That said, you can go to EDITABLE REGION A at line 217 to configure the
- # default settings for the script. This ranges from the functional settings
- # at line 219 (such as whether access is from the menu or the map or which
- # categories are shown in the scene) to the graphical settings at line 242
- # (such as which icons to use for categories and what names should be given
- # to various headings). 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 the script. A brief description of each setting is included either
- # to the left 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 328 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 Peace"
- #
- # 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.
- #
- # 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 143)
- #
- # 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.
- #
- # 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 238 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_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 244.
- # change_quest_windows ("windowskin_filename", window_opacity)
- # windowskin_filename : the name of the Window graphic in System folder
- # window_opacity : the opacity of the windows. If excluded, this
- # defaults to the value of the setting at line 246.
- #
- # 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.
- # 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
- # quest_complete? (quest_id)
- # This is satisfied if all prime objectives of the quest are complete
- # objective_complete? (quest_id, objective_id_1, ... objective_id_n)
- # This is satisfied if all the listed objectives have been completed
- # quest_failed? (quest_id)
- # This is satisfied if any prime objective of the quest is failed
- # objective_failed? (quest_id, objective_id_1, ... objective_id_n)
- # This is satisfied if all the listed objectives have been failed
- # quest_rewarded? (quest_id)
- # This is satisfied if you have changed the reward status to true.
- #
- # If you want to call the Quest scene from an event, you use the following
- # code in a call script:
- #
- # call_quest
- # call_quest (quest_id)
- # quest_id : ID of the quest you want to open the scene on
- #
- # If you do not specify a quest_id (line 149) then it will simply open the
- # scene as it would normally. If you do specify a quest_id (line 150) 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, a new feature in version 2.0 is the ability to have quest shops
- # where the player can pay money to have a quest revealed. Setting it up is a
- # little more complicated as it is all done in the script call and so you need
- # to be careful not to spill over lines. Essentially, to identify the
- # purchable quest you need to create an array like this:
- # [quest_ID, cost, [o1, o2, ..., on], switch_ID]
- # quest_ID : ID of the quest available for purchase
- # cost : the price to buy the quest
- # [o1, ..., on] : an array of the objectives revealed when the quest
- # is purchased. If you exclude this, all objectives are revealed.
- # switch_ID : this is the ID of a switch. When that switch is ON
- # the quest will be available for purchase. Otherwise it won't. If
- # excluded, the quest will always be available for sale at this shop
- # You need one of those for every quest available at the shop and you put
- # them all in another array and you pass it to the following code:
- #
- # call_quest_shop (quest_array, "ShopName")
- # quest_array : the array of the above elements
- # "ShopName" : the name of the shop. Allows you to differentiate
- # quest givers (defaults to the value at line 301 if excluded).
- #
- # All of that is further complicated by the line length limit in the script
- # command. In order to avoid this, it is better to create the array before
- # calling the shop. See the example for how this can be done.
- #
- # EXAMPLE:
- # a = []
- # a.push ([1, 50, [0]], [4, 80, 1])
- # a.push ([3, 100], [5, 75, [0,1], 1])
- # call_quest_shop (a, "Fighter's Guild")
- #
- # The first line creates the array. The second line adds two quests to it: the
- # quest with ID 1 will cost 50 Gold and, if purchased, will reveal the first
- # objective; the quest with ID 4 will cost 80 Gold but will only show up if
- # the switch with ID 1 is ON. It will reveal all objectives when purchased.
- # The third line adds two more quests: the quest with ID 3 will cost 100 Gold
- # and all objectives will be revealed when it is purchased; the quest with ID
- # 5 will cost 75 gold but will only show up when switch 1 is ON. If purchased,
- # it will reveal the first two objectives.
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Compatibility:
- #
- # This script automatically adds itself to the default menu if you turn that
- # feature on. It will also automatically add itself to the menu if you are
- # using Yanfly's YEM Main Menu Melody, my Full Status Custom Menu System, or
- # my Phantasia-esque Custom Menu System. It must be below them though!
- #==============================================================================
- $imported = {} unless $imported
- $imported["QuestJournal2"] = true
- #==============================================================================
- # *** Quest Data
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This is the configuration module for the Quest Journal
- #==============================================================================
- module QuestData
- #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- # EDITABLE REGION A
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- # Functional Configuration
- # CATEGORIES - this is an array describing which categories are available for
- # the Quest Journal and the order in which they appear. The options are
- # :all, :active, :complete, and :failed. You can also create custom
- # categories which include only quests that are specifically added. To do
- # so, just make up a symbol name (:name, so like :primary or :secondary or
- # :companion or etc...) and add it to the array. Then, go to line 248 and
- # associate an icon with the SAME symbol. Then, when you are setting up the
- # quests at line 323, all you need to do is add that SAME symbol to the
- # custom_categories attribute
- CATEGORIES = [:all, :active, :complete, :failed]
- # SORT_TYPE - This is how the quests are sorted. This value can be :id (sort
- # by ID), :revealed (sort by order they were revealed), :alphabet (sort
- # alphabetically by name), or :none
- SORT_TYPE = :revealed
- MENU_ACCESS = true # Can the script be accessed through the menu?
- MENU_INDEX = 4 # If above is true, where in the command window?
- KEY_ACCESS = false # Can the quest log be accessed by a key
- MAPKEY_BUTTON = Input::L # If above is true, which button?
- # MANUAL_REVEAL - whether you need to manually reveal every quest with the
- # reveal_quest command or whether they are automatically revealed as soon as
- # they are operated on (I.e. when you reveal, complete, etc.. objectives)
- MANUAL_REVEAL = false
- # Graphical Configuration
- BG_PICTURE = "" # The filename of the background picture
- BG_OPACITY = 255 # The opacity of the background picture, if used
- WINDOWS_SKIN = "Window" # The skin of the windows in the Quest Scene
- WINDOWS_OPACITY = 200 # The opacity of the windows in the Quest scene
- LIST_WIDTH = 184 # The width, in pixels, of the left-hand windows
- # ICONS - here is where you set up what icons are used for various things in
- # the script, like categories, gold, exp, or even for the menu option if you
- # are using one of the supported CMSes. If you have added custom categories
- # at line 220, then you should also add a line for each of the new categories
- # under the same format. Don't forget the comma at the end!
- ICONS = {
- :all => 0, # If 0, combines :active, :complete, and :failed
- :active => 149, # Icon representing active quest list
- :complete => 150, # Icon representing complete quest list
- :failed => 179, # Icon representing failed quest list
- :menu => 178, # Quests icon if using one of the supported CMSes
- :gold => 147, # Icon for gold if used as a reward
- :exp => 133, # Icon for exp if used as a reward
- }
- # For the following colours, you can use either an integer, in which case it
- # takes its colour from that index of the windowskin palette, or you can use
- # an array in the form [Red, Green, Blue, Alpha] (Alpha can be excluded)
- ACTIVE_COLOUR = 0 # The colour of a quest that is active
- COMPLETE_COLOUR = 3 # The colour of a quest that is complete
- FAILED_COLOUR = 10 # The colour of a quest that is failed
- VOCAB_QUESTS = "Quests" # What you want Quests to be called (eg. 'Missions')
- # LABEL_FONTNAME - The name of the font used for the label window. If "" or
- # [], then it just uses the default font.
- LABEL_FONTNAME = ""
- # LABEL_FONTSIZE - The size of the text in the label window. When 0, it will
- # be automatically fitted to the window size (since it is dynamic)
- LABEL_FONTSIZE = 0
- LABEL_BOLD = false # Whether the label should be bold
- INFO_SHOW_NAME = true # Whether to show the quest's name on info window
- # SUBTITLE FONTNAME - The font used for the subtitles in the info window
- # (The subtitles are: Description, Objectives, Rewards)
- SUBTITLE_FONTNAME = ""
- SUBTITLE_BOLD = true # Whether to embolden the subtitles
- SUBTITLE_COLOR = 16 # The color for the subtitles
- VOCAB_DESCRIPTION = "Description" # The word to identify the description text
- DESC_FONTSIZE = 20 # The size of the font used in the description
- VOCAB_OBJECTIVES = "Objectives" # The word to identify the objectives list
- OBJECTIVE_BULLET = "●" # The character used for listing objectives
- OBJ_FONTSIZE = 20 # The size of the font used for objectives
- VOCAB_REWARDS = "Rewards" # The word to identify the Rewards list
- REWARD_BULLET = "" # The character used for listing rewards
- REWARD_FONTSIZE = 20 # The size of the font for each reward
- ITEM_NUMBER_PREFACE = "x" # When reward amount > 1, this prefaces it.
- VOCAB_EXP = "EXP" # The word used for experience, if used in rewards
- DRAW_VOCAB_GOLD = true # Whether to draw the Gold vocab or only use icon
- # VOCAB_HELP_GENERAL - The phrase in the help window when the list is active
- VOCAB_HELP_GENERAL = "Use the horizontal directional keys to switch categories"
- # VOCAB_HELP_SELECTED - The phrase in the help window when info is active
- VOCAB_HELP_SELECTED = "Use the vertical directional keys to scroll up and down"
- # Alignment of text in the Help Window - 0 => Left; 1 => Centre; 2 => Right
- HELP_ALIGNMENT = 1
- JUSTIFY_PARAGRAPHS = true # Whether Description/objectives are justified.
- # Quest Shop Configuration
- VOCAB_PURCHASE = "Quest Shop" # What you want the shop to be called
- PURCHASE_USE_GOLD_ICON = true # Whether to use gold icon in Quest Shop
- PURCHASE_SHOW_OBJECTIVES = false # Whether to conceal the objectives or not
- PURCHASE_SE = ["Shop", 80] # The sound played when a quest is bought
- PURCHASE_LIST_WIDTH = 224 # The list width for the purchase scene
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- # END EDITABLE REGION A
- #////////////////////////////////////////////////////////////////////////////
- ICONS.default = 0
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Quest Data
- #````````````````````````````````````````````````````````````````````````````
- # Returns skeleton data for the quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def self.quest_data (id)
- # Set class variables to corresponding arguments
- banner = ""
- name = "??????"
- description = "??????????"
- objectives = []
- prime = nil
- rewards = []
- common_event = 0
- icon_index = 0
- custom_categories = []
- case id
- #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- # EDITABLE REGION B
- #````````````````````````````````````````````````````````````````````````
- # To set up a quest, first identify it with an ID - this can be anything
- # as long as it is not the same as another quest, but it is important to
- # remember this ID as it is the only way to access your quest.
- # In any case, the format for setting up a quest is:
- #
- # when <quest_id> # Give the quest an ID number
- # banner = "filename"
- # name = "quest_name"
- # description = "quest_description"
- # objectives[0] = "first_objective"
- # ...
- # objectives[n] = "(n - 1)th objective"
- # prime = [objective_id, ..., objective_id]
- # rewards = [ [type, id, amount], ..., [type, id], "text" ]
- # common_event = id
- # icon_index = quest_icon_index
- # custom_categories.push (:symbol_1, ..., :symbol_n)
- #
- # Each of these values have an importance.
- # banner is the name of a picture that can be shown at the top
- # name is the name of the quest
- # description is a small blurb explaining the overall goal of the quest
- # objective[0..n] are short-term goals that lead to the overall goal
- # primes are which objectives need to be complete before the quest is
- # considered to be complete
- # rewards will list the items you suggest. Note that there is no
- # automatic gain - it simply lists them in the scene - you will need
- # to give them out. The format is simple, [type, id, amount] where
- # type identifies whether it is an item (0), weapon (1), armor (2),
- # gold (3), or exp (4). id is the item ID (or the amount of gold or
- # exp). amount only applies if it is an item, weapon or armor and it
- # is how much of the item is given. If excluded, it won't draw it at
- # all but if it is included, it will draw even if only 1. You can
- # also just put a string ("text") and it will write that out.
- # common_event is the ID of a common event which is immediately called
- # when the quest is first completed.
- # icon_index is the icon that represents the quest
- # custom_categories is a new feature which allows you to define which
- # quests belong in special categories. All you need to do is add the
- # appropriate symbol (which corresponds to an included category at
- # line 229) and it will be added. Then, when the player scrolls over
- # to that category, this quest, if revealed, will be there.
- #
- # Note that any of the above values can be omitted without throwing an
- # error, but for the quest to work properly you should at least set the
- # name, description, and objectives. If you do omit these, the default
- # values are:
- #
- # banner = ""
- # name = "??????"
- # description = "??????????"
- # objectives = []
- # prime = [all objectives]
- # rewards = []
- # common_event = 0
- # icon_index = 0
- # custom_categories = []
- #
- # If you do want to require that all objectives must be satisfied before
- # the quest is complete, then do not bother defining it. Otherwise, be
- # sure to set it. If you are using the Special Codes Formatter, recall
- # that all codes must be prefaced with \\, not just \.
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- when 1 # Quest 1
- name = "Quest 1"
- banner = "" # If using, must be a file from the Pictures folder
- description = "This is the first quest the players receive. It probably involves playing fetch with lazy humans."
- objectives[0] = "The first objective (ID 0)"
- objectives[1] = "Do this next (ID 1)"
- objectives[2] = "Return to collect your reward"
- prime = [0, 1] # You only need to complete the first two objectives.
- rewards = [ [0, 1, 3], [3, 100] ] # A potion and 100 Gold
- common_event = 0
- icon_index = 212
- custom_categories = []
- when 4 # Quest 4 <- Remember: Quest IDs MUST be unique!
- name = "Lovely Lucy"
- description = "Pursue the affections of \\c[6]Lucy\\c[0]"
- objectives[0] = "Buy her a present from the vendor"
- objectives[1] = "Take her out to dinner"
- objectives[2] = "Walk her back to her home"
- rewards = [ [4, 50], "\\icon[137]A kiss from Lucy" ]
- icon_index = 77
- # Note that anything I don't want, like banner, prime, common_event, and
- # custom_categoris, I can exclude and it wll resort to default ("",
- # [0, 1, 2], 0, and [])
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- # END EDITABLE REGION B
- #////////////////////////////////////////////////////////////////////////
- end
- unless prime
- prime = []
- objectives.each_index { |i| prime.push (i) }
- end
- return banner, name, description, objectives, prime, rewards, common_event,
- icon_index, custom_categories
- end
- end
- #==============================================================================
- # ** Game_Quest
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Holds in-game data for a quest
- #==============================================================================
- class Game_Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variables
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_accessor :id # The ID in $game_party.quests
- attr_accessor :banner # Picture shown at top
- attr_accessor :name # The name of the quest
- attr_accessor :description # A blurb explaining the quest
- attr_accessor :objectives # An array of strings holding objectives
- attr_accessor :prime_objectives # An array of crucial objectives
- attr_accessor :rewards # An array of reward components
- attr_accessor :common_event_id # ID of common event called at completion
- attr_accessor :icon_index # The Icon associated with this quest
- attr_accessor :revealed_objectives # An array of revealed objectives
- attr_accessor :complete_objectives # An array of completed objectives
- attr_accessor :failed_objectives # An array of failed objectives
- attr_accessor :custom_categories # An array of category symbols
- attr_accessor :reward_given # A switch to ensure only one reward given
- attr_accessor :concealed # A switch to show or not show the quest
- attr_accessor :cost # The cost (if in a quest shop)
- # Rewarded?
- alias rewarded? reward_given
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (id, cost = -1)
- @id = id
- @cost = cost
- reset
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Reset
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def reset
- # Set variables to corresponding arguments
- @banner, @name, @description, @objectives, @prime_objectives, @rewards,
- @common_event_id, @icon_index, @custom_categories = QuestData.quest_data (id)
- # Initialize non-public arrays
- @revealed_objectives = []
- @complete_objectives = []
- @failed_objectives = []
- @reward_given = false
- @concealed = QuestData::MANUAL_REVEAL
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Reveal Objective
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def reveal_objective (*obj)
- for i in obj do obj.delete (i) if i >= @objectives.size end
- @revealed_objectives |= obj # Add to revealed objectives
- @revealed_objectives.sort! # Sort from lowest index to highest index
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Complete Objective
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def complete_objective (*obj)
- for i in obj
- # Can't complete if failed or non-existent
- obj.delete (i) if i >= @objectives.size || @failed_objectives.include? (i)
- # Reveal the objective if it was not previously revealed
- reveal_objective (i) unless @revealed_objectives.include? (i)
- end
- @complete_objectives |= obj # Add to complete objectives
- @complete_objectives.sort! # Sort from lowest index to highest index
- if complete?
- $game_temp.common_event_id = @common_event_id # Call common event
- @common_event_id = 0 # Don't call it again
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Fail Objective
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def fail_objective (*obj)
- for i in obj
- obj.delete (i) if i >= @objectives.size
- # Reveal the objective if it was not previously revealed
- reveal_objective (i) unless @revealed_objectives.include? (i)
- end
- @failed_objectives |= obj # Add to revealed objectives
- @failed_objectives.sort! # Sort from lowest index to highest index
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Undo Objective operations
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def conceal_objective (*obj)
- obj.each { |index| @revealed_objectives.delete (index) }
- end
- def uncomplete_objective (*obj)
- for i in obj do @complete_objectives.delete (i) end
- end
- def unfail_objective (*obj)
- for i in obj do @failed_objectives.delete (i) end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Objective Status Checks
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def objective_revealed? (*obj)
- return (obj - @revealed_objectives).empty?
- end
- def objective_complete? (*obj)
- return (obj - @complete_objectives).empty?
- end
- def objective_failed? (*obj)
- return (obj - @failed_objectives).empty?
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Complete?
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def complete?
- # Check if all prime objectives have been completed
- return (@complete_objectives & @prime_objectives) == @prime_objectives
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Failed?
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def failed?
- # Check if any prime objectives have been failed
- return !(@failed_objectives & @prime_objectives).empty?
- end
- end
- #==============================================================================
- # ** Game_Quests
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This class handles Quests. It is a wrapper for the built-in class "Hash".
- # The instance of this class is accessed by $game_party.quests
- #==============================================================================
- class Game_Quests
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize
- @data = {}
- @id_sort = []
- @revealed_sort = []
- @alphabet_sort = []
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Quest
- # quest_id : the ID of the quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def [] (quest_id)
- return Game_Quest.new (0) unless quest_id.is_a? (Integer)
- if @data[quest_id] == nil
- @data[quest_id] = Game_Quest.new (quest_id)
- $game_system.last_quest_id = quest_id # Open to this quest next time
- # Save sorting order in separate arrays to avoid resorting every time
- @revealed_sort.push (quest_id)
- sorted = false
- for i in 0...@id_sort.size
- if @id_sort[i] > quest_id
- @id_sort.insert (i, quest_id)
- sorted = true
- break
- end
- end
- @id_sort.push (quest_id) unless sorted
- sorted = false
- for i in 0...@alphabet_sort.size
- if @data[@alphabet_sort[i]].name.downcase > @data[quest_id].name.downcase
- @alphabet_sort.insert (i, quest_id)
- sorted = true
- break
- end
- end
- @alphabet_sort.push (quest_id) unless sorted
- end
- return @data[quest_id]
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Quest List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def list
- quest_list = []
- case QuestData::SORT_TYPE
- when :id
- @id_sort.each { |id| quest_list.push (@data[id]) }
- when :revealed
- @revealed_sort.each { |id| quest_list.push (@data[id]) }
- when :alphabet
- @alphabet_sort.each { |id| quest_list.push (@data[id]) }
- else
- quest_list = @data.values
- end
- quest_list.each { |i| quest_list.delete (i) if i.concealed }
- return quest_list
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Completed Quest List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def completed_list
- complete_quests = []
- list.each { |i| complete_quests.push (i) if i.complete? }
- return complete_quests
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Failed Quest List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def failed_list
- failed_quests = []
- list.each { |i| failed_quests.push (i) if i.failed? }
- return failed_quests
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Active Quest List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def active_list
- return list - failed_list - completed_list
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Category List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def category_list (category)
- case category
- when :all then return list
- when :active then return active_list
- when :complete then return completed_list
- when :failed then return failed_list
- else
- quest_list = []
- list.each { |quest| quest_list.push (quest) if quest.custom_categories.include? (category) }
- return quest_list
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Location
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def get_location (quest_id)
- return nil, nil unless @data[quest_id]
- # Check all categories
- for i in 0...QuestData::CATEGORIES.size
- index = category_list (QuestData::CATEGORIES[i]).index (@data[quest_id])
- return i, index if index != nil
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Revealed?
- # quest_id : the ID of a checked quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def revealed? (quest_id)
- return !@data[quest_id].nil? && !@data[quest_id].concealed
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Remove Quest
- # quest_id : the ID of the quest to delete
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def remove (quest_id)
- [@data, @id_sort, @revealed_sort, @alphabet_sort].each { |enum| enum.delete (quest_id) }
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Clear
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def clear
- @data.clear
- end
- end
- #==============================================================================
- # ** Game_Temp
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new instance variables - quest_shop_array, quest_shop_name
- #==============================================================================
- class Game_Temp
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variables
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_accessor :quest_shop_array
- attr_accessor :quest_shop_name
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias maba_qjrnl_iniz_5uv1 initialize
- def initialize (*args)
- maba_qjrnl_iniz_5uv1 (*args)
- @quest_shop_array = []
- @quest_shop_name = QuestData::VOCAB_PURCHASE
- end
- end
- #==============================================================================
- # ** Game_System
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new instance variables - quest_disabled; qj_bg_picture; qj_bg_opacity;
- # qj_windowskin; qj_window_opacity; last_quest_id
- # aliased method - initialize
- #==============================================================================
- class Game_System
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variables
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_accessor :quest_disabled # Can you access quest journal at this time
- attr_accessor :quest_keyaccess # Is it accessible by key?
- attr_reader :quest_menuaccess # Is it accessible through the menu
- attr_accessor :qj_bg_picture # The filename of the background graphic
- attr_accessor :qj_bg_opacity # The opacity of the background picture
- attr_accessor :qj_windowskin # The skin of the windows in the quest scene
- attr_accessor :qj_window_opacity # The opacity of windows in the quest scene
- attr_accessor :last_quest_cat # The last [category, index] of quest viewed
- attr_accessor :last_quest_id # The ID of the last quest viewed
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modlg_qstjrnl_iniz_4rd2 initialize
- def initialize (*args)
- # Run Original Method
- modlg_qstjrnl_iniz_4rd2 (*args)
- # Initialize new variables
- @quest_disabled = false
- @quest_keyaccess = QuestData::KEY_ACCESS
- @quest_menuaccess = QuestData::MENU_ACCESS
- @qj_bg_picture = QuestData::BG_PICTURE
- @qj_bg_opacity = QuestData::BG_OPACITY
- @qj_windowskin = QuestData::WINDOWS_SKIN
- @qj_window_opacity = QuestData::WINDOWS_OPACITY
- @last_quest_cat = 0
- @last_quest_id = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Set Quest Access
- # Not simply accessor so I could add in compatibility
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def quest_menuaccess= (value)
- @quest_menuaccess = value
- @fscms_command_list ? c = @fscms_command_list : (@tpcms_command_list ? c = @tpcms_command_list : return)
- value ? (c.insert (QuestData::MENU_INDEX, :quest2) unless c.include? (:quest2)) :
- c.delete (:quest2)
- end
- end
- #==============================================================================
- # ** Game_Party
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new instance variable - quests
- # aliased method - initialize
- #==============================================================================
- class Game_Party
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variables
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_reader :quests
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modalg_qst_jrnl_party_init_quests initialize
- def initialize
- # Run Original Method
- modalg_qst_jrnl_party_init_quests
- # Initialize @quests
- @quests = Game_Quests.new
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - change_quest_access; change_quest_background; remove_quest;
- # quest; reveal_objective; conceal_objective; complete_objective;
- # uncomplete_objective; fail_objective; unfail_objective; quest_revealed?;
- # quest_complete?; quest_failed?; change_reward_status
- #==============================================================================
- class Game_Interpreter
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Call Quest Scene
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def call_quest (quest_id = 0)
- Sound.play_decision
- $game_system.last_quest_id = quest_id if quest_id != 0 && quest_revealed? (quest_id)
- $game_temp.next_scene = "quest"
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Call Quest Shop
- # quest_array : a series of arrays in form [a, b, [c1, c2, ..., cn], d]
- # a is the Quest ID; b is the Purchase Cost; [c1, ..., cn] is a list
- # of which objectives are revealed when the quest is bought (it can be
- # excluded and if so, then it will reveal them all); d is the ID of an
- # enabling switch, meaning it will only show up if that switch is ON
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def call_quest_shop (quest_array, shop_name = QuestData::VOCAB_PURCHASE)
- $game_temp.next_scene = "quest shop"
- $game_temp.quest_shop_array = quest_array
- $game_temp.quest_shop_name = shop_name
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Change Quest Access
- # sym - :enable, :disable, :enable_menu, :disable_menu, :enable_map, or
- # :disable_map
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def change_quest_access (sym)
- case sym
- when :enable then $game_system.quest_disabled = false
- when :disable then $game_system.quest_disabled = true
- when :enable_menu then $game_system.quest_menuaccess = true
- when :disable_menu then $game_system.quest_menuaccess = false
- when :enable_map then $game_system.quest_keyaccess = true
- when :disable_map then $game_system.quest_keyaccess = false
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Change Quest Background
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def change_quest_background (picture, opacity = $game_system.qj_bg_opacity)
- $game_system.qj_bg_picture = picture
- $game_system.qj_bg_opacity = opacity
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Change Quest Windows
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def change_quest_windows (skin, opacity = $game_system.qj_window_opacity)
- $game_system.qj_windowskin = skin
- $game_system.qj_window_opacity = opacity
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Reset Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def reset_quest (id)
- quest (id).reset
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Remove Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def remove_quest (id)
- $game_party.quests.remove (id)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Reveal/Conceal Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def conceal_quest (id)
- $game_party.quests[id].concealed = true
- end
- def reveal_quest (id)
- $game_party.quests[id].concealed = false
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Quest
- # id : Returns the quest object with that ID
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def quest (id)
- return $game_party.quests[id]
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Quest Revealed?
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def quest_revealed? (id)
- return $game_party.quests.revealed? (id)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Facade for Quest methods:
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- [:reveal_objective, :conceal_objective, :complete_objective,
- :uncomplete_objective, :fail_objective, :unfail_objective].each { |method|
- define_method (method) { |id, *obj| quest (id).send (method, *obj) }
- }
- [:objective_revealed?, :objective_complete?, :objective_failed?].each { |method|
- define_method (method) { |id, *obj| quest_revealed? (id) && quest (id).send (method, *obj) }
- }
- [:reset, :complete?, :rewarded?, :failed?].each { |method|
- define_method ("quest_#{method}".to_sym) { |id| quest_revealed? (id) && quest (id).send (method) }
- }
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Change Reward Status
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def change_reward_status (id, value = true)
- quest (id).reward_given = value
- end
- end
- #==============================================================================
- # ** Window_Message
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - convert_special_characters
- #==============================================================================
- class Window_Message
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Convert Special Characters
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_qstjrnl_cnvrtspecnq_6yh2 convert_special_characters
- def convert_special_characters (*args)
- # Run Original Method
- ma_qstjrnl_cnvrtspecnq_6yh2 (*args)
- @text.gsub! (/\\NQ\[(\d+)\]/i) { $game_party.quests[$1.to_i].name } # Name Quest
- end
- end
- if Object.const_defined? (:Paragrapher) && Paragrapher.const_defined? (:Formatter_SpecialCodes)
- class Paragrapher::Formatter_SpecialCodes
- alias mlg_qstj_prfrmsub_5th2 perform_substitution
- def perform_substitution (*args)
- text = mlg_qstj_prfrmsub_5th2 (*args)
- text.gsub! (/\\NQ\[(\d+)\]/i) { $game_party.quests[$1.to_i].name } # Monster Name
- return text
- end
- end
- end
- #==============================================================================
- # ** Window_QuestLabel
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This window shows the quest label at the top of the scene
- #==============================================================================
- class Window_QuestLabel < Window_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (width = QuestData::LIST_WIDTH, height = 32 + WLH, text = QuestData::VOCAB_QUESTS)
- super (0, 0, width, height)
- self.windowskin = Cache.system ($game_system.qj_windowskin)
- self.opacity = $game_system.qj_window_opacity
- # Draw contents
- contents.font.color = system_color
- contents.font.name = QuestData::LABEL_FONTNAME unless QuestData::LABEL_FONTNAME.empty?
- if QuestData::LABEL_FONTSIZE == 0
- contents.font.size = [height - 36, 28].min
- # Fit it by width
- while (contents.text_size (text).width > contents.width) && contents.font.size > Font.default_size
- contents.font.size -= 1
- end
- else
- contents.font.size = QuestData::LABEL_FONTSIZE
- end
- contents.font.bold = QuestData::LABEL_BOLD
- contents.draw_text (contents.rect, text, 1)
- end
- end
- #==============================================================================
- # ** Window_QuestPurchaseGold
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This is the gold window for the Quest Purchase scene
- #==============================================================================
- class Window_QuestPurchaseGold < Window_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (y, width = QuestData::PURCHASE_LIST_WIDTH)
- super (0, y, width, 32 + WLH)
- self.windowskin = Cache.system ($game_system.qj_windowskin)
- self.opacity = $game_system.qj_window_opacity
- refresh
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Refresh
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def refresh
- self.contents.clear
- if QuestData::PURCHASE_USE_GOLD_ICON
- draw_icon (QuestData::ICONS[:gold], 0, 0)
- x = 28
- else
- x = 4
- end
- draw_currency_value ($game_party.gold, x, 0, contents.width - x)
- end
- end
- #==============================================================================
- # ** Window_QuestCategory
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This window allows you to select between which list to show
- #==============================================================================
- class Window_QuestCategory < Window_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (category_index = 0, width = QuestData::LIST_WIDTH)
- hght = 56
- @all_index = QuestData::CATEGORIES.index (:all)
- hght += 8 if @all_index && QuestData::ICONS[:all] == 0
- super (0, WLH + 32, width, hght)
- self.windowskin = Cache.system ($game_system.qj_windowskin)
- self.opacity = $game_system.qj_window_opacity
- total = 24*QuestData::CATEGORIES.size
- total += 16 if hght == 64
- @spacing = (contents.width - total) / (QuestData::CATEGORIES.size - 1)
- refresh (category_index)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Refresh
- # category_index : icon to highlight -
- # 0 => All, 1 => Active, 2 => Complete, 3 => Failed
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def refresh (category_index = 0)
- contents.clear
- for i in 0...QuestData::CATEGORIES.size
- draw_item (i, i == category_index)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Category
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_item (index, enabled = false)
- x = index*(24 + @spacing)
- x += 16 if @all_index && index > @all_index && contents.height == 32
- category = QuestData::CATEGORIES[index]
- if @all_index != index || contents.height == 24
- y = (contents.height == 32 ? 4 : 0)
- contents.clear_rect (x, y, 24, 24)
- draw_icon (QuestData::ICONS[category], x, y, enabled)
- else
- contents.clear_rect (x, 0, 40, 32)
- draw_icon (QuestData::ICONS[:complete], x, 0, enabled)
- draw_icon (QuestData::ICONS[:failed], x + 16, 0, enabled)
- draw_icon (QuestData::ICONS[:active], x + 8, 8, enabled)
- end
- end
- end
- #==============================================================================
- # ** Window_QuestList
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This window shows a list of quests
- #==============================================================================
- class Window_QuestList < Window_Command
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (free, width = QuestData::LIST_WIDTH, category = QuestData::CATEGORIES[0], quest_index = 0)
- super (width, [], 1, free / WLH)
- change_list (category)
- self.windowskin = Cache.system ($game_system.qj_windowskin)
- self.opacity = $game_system.qj_window_opacity
- self.index = quest_index
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Change List
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def change_list (list_type)
- if list_type.is_a? (Array)
- @commands = list_type # List passed directly
- else
- @commands = $game_party.quests.category_list (list_type)
- @commands = [] if @commands.nil?
- end
- @item_max = @commands.size
- self.contents = Bitmap.new (contents.width, [self.height - 32, @item_max*WLH].max)
- self.index = 0
- refresh
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def quest
- return @commands[self.index]
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Item
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.color.alpha = (enabled ? 255 : 128)
- quest = @commands[index]
- draw_icon (quest.icon_index, rect.x, rect.y, enabled)
- rect.x += 28
- rect.width -= 28
- if quest.cost > -1 # Draw the quest's cost if > -1
- tw =
- self.contents.font.color = normal_color
- self.contents.draw_text (rect, quest.cost.to_s, 2)
- rect.width -= (self.contents.text_size (quest.cost.to_s).width + 6)
- else
- if quest.complete?
- self.contents.font.color = QuestData::COMPLETE_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::COMPLETE_COLOUR) : text_color (QuestData::COMPLETE_COLOUR)
- elsif quest.failed?
- self.contents.font.color = QuestData::FAILED_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::FAILED_COLOUR) : text_color (QuestData::FAILED_COLOUR)
- else # Active
- self.contents.font.color = QuestData::ACTIVE_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::ACTIVE_COLOUR) : text_color (QuestData::ACTIVE_COLOUR)
- end
- end
- self.contents.draw_text(rect, quest.name)
- end
- end
- #==============================================================================
- # ** Window QuestInfo
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This window shows the details of each quest
- #==============================================================================
- class Window_QuestInfo < Window_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (height = Graphics.height - (32 + WLH), x = QuestData::LIST_WIDTH)
- super (x, 0, Graphics.width - x, height)
- self.windowskin = Cache.system ($game_system.qj_windowskin)
- self.opacity = $game_system.qj_window_opacity
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Refresh
- # quest : the Quest object to show
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def refresh (quest)
- contents.clear
- if quest.nil?
- create_contents
- return
- end
- y = 0
- @quest = quest
- @font_regular = contents.font.name
- @dummy = Bitmap.new (self.width - 32, 1000)
- # Draw Banner
- y = draw_banner (y) if !@quest.banner.empty? # Banner
- y = draw_name (y) if QuestData::INFO_SHOW_NAME # Name
- # Get the Paragrapher
- if !Object.const_defined? (:Paragrapher) || !Paragrapher.const_defined? (:Formatter)
- p "This script requires the Paragraph Formatter 2.0! You can get it at RMRK:",
- " http://rmrk.net/index.php/topic,25129.0.html", "The Special Codes Formatter is supported, but you still need the base script."
- else
- if Paragrapher.const_defined? (:Formatter_SpecialCodes)
- @paragrapher = Paragrapher.new (Paragrapher::Formatter_SpecialCodes.new, Paragrapher::Artist_SpecialCodes.new)
- else
- @paragrapher = Paragrapher.new (@dummy.paragraph_formatter, @dummy.paragraph_artist)
- end
- y = draw_description (y) if !@quest.description.empty? # Description
- y = draw_objectives (y) if !@quest.revealed_objectives.empty? # Objectives
- end
- total_height = y
- total_height += WLH*(@quest.rewards.size + 1) if !@quest.rewards.empty? # Calculate for rewards
- # Draw it all onto the window
- contents.dispose
- self.contents = Bitmap.new (self.width - 32, [self.height - 32, total_height - 4].max)
- contents.blt (0, 0, @dummy, @dummy.rect)
- @dummy.dispose
- draw_rewards (y) if !@quest.rewards.empty? # Rewards
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Banner
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_banner (y)
- banner = Cache.picture (@quest.banner)
- @dummy.blt ((@dummy.width - banner.width) / 2, y, banner, banner.rect)
- return y + banner.height
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Name
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_name (y)
- @dummy.font.bold = true
- @dummy.draw_text (0, y, @dummy.width, WLH, @quest.name, 1)
- @dummy.font.bold = false
- return y + WLH
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Description
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_description (y)
- bmp = Bitmap.new (@dummy.width - 16, WLH)
- bmp.font = @dummy.font.dup
- bmp.font.size = QuestData::DESC_FONTSIZE
- ft = @paragrapher.formatter.format (@quest.description, bmp)
- hght = ft.lines.size * ft.bitmap.font.size
- ft.bitmap = Bitmap.new (bmp.width, hght)
- ft.bitmap.font = bmp.font.dup
- bmp.dispose
- rect = Rect.new (2, y + (WLH / 2), @dummy.width - 4, hght + WLH)
- rect2 = Rect.new (4, y + (WLH / 2) + 2, @dummy.width - 8, hght + WLH - 4)
- # Make Box
- if Bitmap.method_defined? (:fill_rounded_rect) # Bitmap Addons
- @dummy.fill_rounded_rect (rect, system_color)
- @dummy.fill_rounded_rect (rect2, Color.new (0, 0, 0, 0))
- else
- @dummy.fill_rect (rect, system_color)
- @dummy.clear_rect (rect2)
- end
- # Draw Description Label
- @dummy.font.name = QuestData::SUBTITLE_FONTNAME unless QuestData::SUBTITLE_FONTNAME.empty?
- @dummy.font.bold = QuestData::SUBTITLE_BOLD
- tw = @dummy.text_size (QuestData::VOCAB_DESCRIPTION).width
- @dummy.clear_rect (32, y, tw + 4, WLH)
- @dummy.font.color = QuestData::SUBTITLE_COLOR.is_a? (Array) ? Color.new (*QuestData::SUBTITLE_COLOR) : text_color (QuestData::SUBTITLE_COLOR)
- @dummy.draw_text (34, y, tw + 2, WLH, QuestData::VOCAB_DESCRIPTION)
- @dummy.font.name = @font_regular
- @dummy.font.bold = false
- # Draw Description paragraph
- @paragrapher.artist.draw (ft, QuestData::JUSTIFY_PARAGRAPHS)
- @dummy.blt (8, y + WLH, ft.bitmap, ft.bitmap.rect)
- ft.bitmap.dispose
- return rect.y + rect.height + 4
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Objectives
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_objectives (y)
- @dummy.font.color = QuestData::SUBTITLE_COLOR.is_a? (Array) ? Color.new (*QuestData::SUBTITLE_COLOR) : text_color (QuestData::SUBTITLE_COLOR)
- @dummy.font.name = QuestData::SUBTITLE_FONTNAME unless QuestData::SUBTITLE_FONTNAME.empty?
- @dummy.font.bold = QuestData::SUBTITLE_BOLD
- @dummy.draw_text (32, y, contents.width - 32, WLH, QuestData::VOCAB_OBJECTIVES)
- @dummy.font.name = @font_regular
- @dummy.font.bold = false
- # Create second dummy bitmap
- tw = @dummy.text_size (QuestData::OBJECTIVE_BULLET).width
- bmp = Bitmap.new (@dummy.width - 12 - tw, WLH)
- bmp.font = @dummy.font.dup
- bmp.font.size = QuestData::OBJ_FONTSIZE
- y += WLH
- for i in @quest.revealed_objectives
- # Draw Bullet
- @dummy.draw_text (8, y, tw, WLH, QuestData::OBJECTIVE_BULLET)
- # Format & Draw Objective
- ft = @paragrapher.formatter.format (@quest.objectives[i], bmp)
- ft.bitmap = Bitmap.new (bmp.width, (bmp.font.size)*ft.lines.size)
- ft.bitmap.font = bmp.font.dup
- # Get the correct color
- if @quest.objective_complete? (i) # Complete?
- ft.bitmap.font.color = QuestData::COMPLETE_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::COMPLETE_COLOUR) : text_color (QuestData::COMPLETE_COLOUR)
- elsif @quest.objective_failed? (i) # Failed?
- ft.bitmap.font.color = QuestData::FAILED_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::FAILED_COLOUR) : text_color (QuestData::FAILED_COLOUR)
- else # Active
- ft.bitmap.font.color = QuestData::ACTIVE_COLOUR.is_a? (Array) ?
- Color.new (*QuestData::ACTIVE_COLOUR) : text_color (QuestData::ACTIVE_COLOUR)
- end
- @paragrapher.artist.draw (ft, QuestData::JUSTIFY_PARAGRAPHS)
- @dummy.blt (12 + tw, y + 2, ft.bitmap, ft.bitmap.rect)
- # Modify the Y accordingly
- y += 2 + ((ft.bitmap.font.size)*ft.lines.size)
- ft.bitmap.dispose
- end
- bmp.dispose
- return y + 2
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Rewards
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def draw_rewards (y)
- # Rewards done with contents and not @dummy since uses Window_Base methods
- contents.font.color = QuestData::SUBTITLE_COLOR.is_a? (Array) ? Color.new (*QuestData::SUBTITLE_COLOR) : text_color (QuestData::SUBTITLE_COLOR)
- contents.font.name = QuestData::SUBTITLE_FONTNAME unless QuestData::SUBTITLE_FONTNAME.empty?
- contents.font.bold = QuestData::SUBTITLE_BOLD
- contents.draw_text (32, y, contents.width - 32, WLH, QuestData::VOCAB_REWARDS)
- contents.font.name = @font_regular
- contents.font.bold = false
- x = QuestData::REWARD_BULLET.empty? ? 8 : 12 + (contents.text_size (QuestData::REWARD_BULLET).width)
- y += WLH
- contents.font.size = QuestData::REWARD_FONTSIZE
- for reward in @quest.rewards
- # Draw Bullet
- contents.font.color = system_color
- contents.draw_text (8, y, 100, WLH, QuestData::REWARD_BULLET)
- contents.font.color = normal_color
- if reward.is_a? (Array)
- item = nil
- case reward[0]
- when 0 then item = $data_items[reward[1]]
- when 1 then item = $data_weapons[reward[1]]
- when 2 then item = $data_armors[reward[1]]
- when 3 # Gold
- draw_icon (QuestData::ICONS[:gold], x, y)
- contents.font.color = normal_color
- contents.draw_text (x + 24, y, contents.width - x - 24, WLH, reward[1].to_s)
- if QuestData::DRAW_VOCAB_GOLD
- tw = contents.text_size(reward[1].to_s).width
- contents.font.color = system_color
- contents.draw_text(x + tw + 28, y, contents.width - x - 28 - tw, WLH, Vocab::gold)
- contents.font.color = normal_color
- end
- when 4 # Exp
- draw_icon (QuestData::ICONS[:exp], x, y)
- contents.font.color = normal_color
- contents.draw_text (x + 24, y, contents.width - x - 24, WLH, reward[1].to_s)
- tw = contents.text_size(reward[1].to_s).width
- contents.font.color = system_color
- contents.draw_text(x + tw + 28, y, contents.width - x - 28 - tw, WLH, QuestData::VOCAB_EXP)
- contents.font.color = normal_color
- end
- # Draw Item
- if item != nil
- draw_item_name (item, x, y)
- unless reward[2].nil? # Draw Number
- contents.font.color = system_color
- tw = contents.text_size (item.name).width + 28
- contents.draw_text (x + tw, y, 100, WLH, "#{QuestData::ITEM_NUMBER_PREFACE}#{reward[2]}")
- contents.font.color = normal_color
- end
- end
- else
- # Allow use of special codes if Special Codes Formatter available
- if Object.const_defined? (:Paragrapher) && Paragrapher.const_defined? (:Formatter_SpecialCodes)
- bmp = Bitmap.new (contents.width - x, WLH)
- bmp.font = contents.font.dup
- @paragrapher.paragraph (reward, bmp)
- contents.blt (x, y, bmp, bmp.rect)
- bmp.dispose
- else
- contents.font.color = normal_color
- contents.draw_text (x, y, contents.width - x, WLH, reward)
- end
- end
- y += WLH
- end
- return y
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Frame Update
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update
- if Input.press? (Input::DOWN)
- self.oy = [self.oy + 3, contents.height - self.height + 32].min
- elsif Input.press? (Input::UP)
- self.oy = [self.oy - 3, 0].max
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - update
- #==============================================================================
- class Scene_Map < Scene_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Frame Update
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_qj2_keyaces_upd_6yc1 update
- def update (*args)
- ma_qj2_keyaces_upd_6yc1 (*args)
- # If the quest log can be accessed by key and is not empty or disabled
- if $game_system.quest_keyaccess && Input.trigger? (QuestData::MAPKEY_BUTTON)
- if $game_system.quest_disabled || $game_party.quests.list.empty?
- Sound.play_buzzer
- else
- Sound.play_decision
- $game_temp.next_scene = "quest"
- end
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Execute Screen Switch
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malb_questj_updscene_5tg2 update_scene_change
- def update_scene_change (*args)
- scene_call = $game_temp.next_scene
- malb_questj_updscene_5tg2 (*args) # Run Original Method
- # This check first ensures that the scene call was not prevented by external
- # factors, like the player moving, then checks to see if it was quest. I
- # do it like this to ensure that it doesn't open at weird times (like while
- # the message box is open
- if $game_temp.next_scene.nil? && !scene_call.nil?
- case scene_call
- when "quest"
- $scene = Scene_Quest.new
- when "quest shop"
- $scene = Scene_QuestPurchase.new ($game_temp.quest_shop_array, $game_temp.quest_shop_name)
- end
- end
- end
- end
- #==============================================================================
- # ** Scene Quest
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This class handles the quest scene processing
- #==============================================================================
- class Scene_Quest < Scene_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (*args)
- if args.size == 0 # Last Quest ID
- cat_ind = $game_system.last_quest_cat
- cat = QuestData::CATEGORIES[cat_ind]
- ind = ($game_party.quests.category_list (cat)).index ($game_party.quests[$game_system.last_quest_id])
- if !ind.nil?
- @category_index, @quest_index = cat_ind, ind
- else
- @category_index, @quest_index = $game_party.quests.get_location ($game_system.last_quest_id)
- end
- else
- @category_index = args[0] < QuestData::CATEGORIES.size ? args[0] : 0
- @quest_index = args.size < 2 ? 0 : args[1]
- end
- @category_index = 0 if @category_index.nil?
- @quest_index = 0 if @quest_index.nil?
- @info_window_active = false
- @from_menu = $scene.is_a? (Scene_Menu)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Start Processing
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def start
- super
- create_menu_background
- # Create Background picture
- unless $game_system.qj_bg_picture.empty?
- @bg_sprite = Sprite.new
- @bg_sprite.bitmap = Cache.picture ($game_system.qj_bg_picture)
- @bg_sprite.opacity = $game_system.qj_bg_opacity
- end
- free_space = Graphics.height - 96 - 2*Window_Base::WLH
- if QuestData::CATEGORIES.size > 1
- @category_window = Window_QuestCategory.new (@category_index)
- free_space -= @category_window.height
- end
- @label_window = Window_QuestLabel.new (QuestData::LIST_WIDTH, 32 + Window_Base::WLH + (free_space % Window_Base::WLH))
- y = @label_window.height
- if @category_window
- @category_window.y = y
- y += @category_window.height
- end
- @list_window = Window_QuestList.new (free_space, QuestData::LIST_WIDTH, QuestData::CATEGORIES[@category_index], @quest_index)
- @list_window.y = y
- @list_window.active = true
- @info_window = Window_QuestInfo.new
- @info_window.refresh (@list_window.quest)
- # Create Help Window
- @help_window = Window_Help.new
- @help_window.windowskin = Cache.system ($game_system.qj_windowskin)
- @help_window.opacity = $game_system.qj_window_opacity
- @help_window.y = Graphics.height - @help_window.height
- @help_window.width = Graphics.width
- @help_window.create_contents
- @help_window.set_text (QuestData::VOCAB_HELP_GENERAL, QuestData::HELP_ALIGNMENT)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Terminate Process
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def terminate
- super
- dispose_menu_background
- if @bg_sprite # Dispose Background Sprite
- @bg_sprite.bitmap.dispose
- @bg_sprite.dispose
- end
- @label_window.dispose
- @category_window.dispose if @category_window
- @list_window.dispose
- @info_window.dispose
- @help_window.dispose
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Frame Update
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update
- super
- update_menu_background
- if @list_window.active
- update_list_window
- elsif @info_window_active
- update_info_window
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update List Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update_list_window
- @list_window.update
- update_category_window if @category_window
- if Input.trigger?(Input::B) # If Button B is pressed
- Sound.play_cancel
- return_scene
- elsif Input.trigger? (Input::C) # If C button is pressed
- action_pressed_from_list
- # If scrolling through quests
- elsif Input.press? (Input::DOWN) || Input.press? (Input::UP)
- # Refresh Info Window
- @info_window.refresh (@list_window.quest)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Category Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update_category_window
- # If category window exists and horizontal arrow triggered
- if (Input.trigger? (Input::LEFT) || Input.trigger? (Input::RIGHT))
- add_int = Input.trigger? (Input::LEFT) ? -1 : 1
- @category_index = (@category_index + add_int) % QuestData::CATEGORIES.size
- # Play Cursor SE
- Sound.play_cursor
- # Refresh Windows
- @category_window.refresh (@category_index)
- @list_window.change_list (QuestData::CATEGORIES[@category_index])
- @info_window.refresh (@list_window.quest)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Info Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update_info_window
- @info_window.update
- if Input.trigger? (Input::B) || Input.trigger? (Input::C)
- Sound.play_cancel
- @info_window_active = false
- @info_window.oy = 0
- @list_window.active = true
- @help_window.set_text (QuestData::VOCAB_HELP_GENERAL, QuestData::HELP_ALIGNMENT)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * C Button Pressed
- # I put this as its own method in case I want to write any patches which
- # modifies what happens when C is pressed
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def action_pressed_from_list
- if @info_window.contents.height > @info_window.height - 32
- Sound.play_decision
- @info_window_active = true
- @list_window.active = false
- @help_window.set_text (QuestData::VOCAB_HELP_SELECTED, QuestData::HELP_ALIGNMENT)
- else
- Sound.play_buzzer
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Return Scene
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def return_scene
- unless @list_window.quest.nil? # Save Position
- $game_system.last_quest_id = @list_window.quest.id
- $game_system.last_quest_cat = @category_index
- end
- # Exit Quest Scene
- $scene = @from_menu ? Scene_Menu.new (QuestData::MENU_INDEX) : Scene_Map.new
- end
- end
- #==============================================================================
- # ** Scene_QuestPurchase
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # This class handles processing for purchasing quests
- #==============================================================================
- class Scene_QuestPurchase < Scene_Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize (quest_array = [], shop_name = QuestData::VOCAB_PURCHASE)
- @quest_list, @quest_reveals = [], []
- quest_array.each { |quest_a|
- quest = Game_Quest.new (quest_a[0], (quest_a[1] ? quest_a[1] : 0))
- # Add if no switch condition or condition met and not already revealed
- if quest_a[3]
- reveals = quest_a[2]
- switch = quest_a[3]
- else
- if quest_a[2].is_a? (Array)
- reveals = quest_a[2]
- switch = nil
- else
- reveals = []
- quest.objectives.each_index { |i| reveals.push (i) }
- switch = quest_a[2]
- end
- end
- if (switch.nil? || $game_switches[switch]) && !$game_party.quests.revealed? (quest_a[0])
- # Reveal all objectives if want to show them
- quest.reveal_objective (*reveals) if QuestData::PURCHASE_SHOW_OBJECTIVES
- @quest_list.push (quest)
- @quest_reveals.push (reveals)
- end
- }
- @shop_name = shop_name
- @info_window_active = false
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Start Processing
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def start
- create_menu_background
- # Create Background picture
- unless $game_system.qj_bg_picture.empty?
- @bg_sprite = Sprite.new
- @bg_sprite.bitmap = Cache.picture ($game_system.qj_bg_picture)
- @bg_sprite.opacity = $game_system.qj_bg_opacity
- end
- wlh = Window_Base::WLH
- fs = Graphics.height - (96 + 2*wlh)
- @label_window = Window_QuestLabel.new (QuestData::PURCHASE_LIST_WIDTH, 32 + wlh + (fs % 24), @shop_name)
- @list_window = Window_QuestList.new (fs, QuestData::PURCHASE_LIST_WIDTH, @quest_list)
- @list_window.y = @label_window.height
- @list_window.active = true
- for i in 0...@quest_list.size
- @list_window.draw_item (i, false) if $game_party.gold < @quest_list[i].cost
- end
- @info_window = Window_QuestInfo.new (Graphics.height, QuestData::PURCHASE_LIST_WIDTH)
- @info_window.refresh (@list_window.quest)
- # Create Gold Window
- @gold_window = Window_QuestPurchaseGold.new (@list_window.y + @list_window.height)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Terminate Process
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def terminate
- dispose_menu_background
- if @bg_sprite # Dispose Background Sprite
- @bg_sprite.bitmap.dispose
- @bg_sprite.dispose
- end
- @label_window.dispose
- @list_window.dispose
- @info_window.dispose
- @gold_window.dispose
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Info Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update_info_window
- @info_window.update
- if Input.trigger? (Input::B)
- Sound.play_cancel
- @info_window_active = false
- @info_window.oy = 0
- @list_window.active = true
- elsif Input.trigger? (Input::C)
- purchase_quest
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * C Button Pressed
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def action_pressed_from_list
- if @info_window.contents.height > @info_window.height - 32
- Sound.play_decision
- @info_window_active = true
- @list_window.active = false
- else
- purchase_quest
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Purchase Quest
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def purchase_quest
- if $game_party.gold < @list_window.quest.cost
- Sound.play_buzzer
- else
- (RPG::SE.new (*QuestData::PURCHASE_SE)).play # Play Purchase SE
- $game_party.lose_gold (@list_window.quest.cost)
- quest = $game_party.quests[@list_window.quest.id]
- quest.reveal_objective (*@quest_reveals[@list_window.index])
- quest.concealed = false
- @quest_list.delete_at (@list_window.index)
- @quest_reveals.delete_at (@list_window.index)
- @list_window.change_list (@quest_list)
- for i in 0...@quest_list.size
- @list_window.draw_item (i, false) if $game_party.gold < @quest_list[i].cost
- end
- @info_window.refresh (@list_window.quest)
- @gold_window.refresh
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Return Scene
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def return_scene
- $scene = Scene_Map.new
- end
- end
- # YEM Main Menu Melody Compatibility
- if $imported && $imported["MainMenuMelody"]
- YEM::MENU::MENU_COMMANDS.insert (QuestData::MENU_INDEX, :quest2)
- YEM::MENU::MENU_ICONS[:quest2] = QuestData::ICONS[:menu]
- YEM::MENU::IMPORTED_COMMANDS[:quest2] = [:quest_access, :quest_disable, false, QuestData::ICONS[:menu], QuestData::VOCAB_QUESTS, "Scene_Quest"]
- class Game_Switches
- alias ma_yemmm_qustjrn_get_6yh1 []
- def [] (id, *args)
- return $game_system.quest_disabled || $game_party.quests.list.empty? if id == :quest_disable
- return !$game_system.quest_menuaccess if id == :quest_access
- return ma_yemmm_qustjrn_get_6yh1 (id, *args)
- end
- end
- # Full Status Menu System Compatibility
- elsif Game_System.method_defined? (:fscms_command_list)
- ModernAlgebra::FSCMS_CUSTOM_COMMANDS[:quest2] = [QuestData::VOCAB_QUESTS,
- QuestData::ICONS[:menu], "$game_system.quest_disabled || $game_party.quests.list.empty?",
- false, Scene_Quest]
- ModernAlgebra::FSCMS_COMMANDLIST.insert (QuestData::MENU_INDEX, :quest2) if QuestData::MENU_ACCESS
- # If Phantasia Esque Menu
- elsif Game_System.method_defined? (:tpcms_command_list)
- Phantasia_CMS::CUSTOM_COMMANDS[:quest2] = [QuestData::VOCAB_QUESTS,
- QuestData::ICONS[:menu], "$game_system.quest_disabled || $game_party.quests.list.empty?",
- false, Scene_Quest]
- Phantasia_CMS::COMMANDLIST.insert (QuestData::MENU_INDEX, :quest2) if QuestData::MENU_ACCESS
- else # Default Menu
- #============================================================================
- # ** Window_Command (unless already done by other script)
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new instance variable - ma_disabled_commands
- # aliased method - initialize, draw_item
- #============================================================================
- unless Window_Command.method_defined? (:ma_disabled_commands)
- class Window_Command
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variable
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_reader :ma_disabled_commands
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Initialize
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_quest2_initz_6tg2 initialize
- def initialize (*args)
- @ma_disabled_commands = [] # Initialize new instance variable
- malg_quest2_initz_6tg2 (*args) # Run Original Method
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Item
- # index : item number
- # enabled : enabled flag. When false, draw semi-transparently
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mab_qstj_itmdraw_8ic4 draw_item
- def draw_item (index, enabled = true, *args)
- # Run Original Method
- mab_qstj_itmdraw_8ic4 (index, enabled, *args)
- enabled ? @ma_disabled_commands.delete (index) :
- (@ma_disabled_commands.push (index) if !@ma_disabled_commands.include? (index))
- end
- end
- end
- #============================================================================
- # ** Scene Menu
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased methods - initialize; create_command_window;
- # update_command_selection; update_actor_selection
- #============================================================================
- class Scene_Menu
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias magba_questj_ini_5rc1 initialize
- def initialize (menu_index = 0, *args)
- magba_questj_ini_5rc1 (menu_index, *args) # Run Original Method
- if $game_system.quest_menuaccess
- # Set menu index if coming from the scene; adjust if not
- $scene.is_a? (Scene_Quest) ? @menu_index = QuestData::MENU_INDEX : (@menu_index += 1 if @menu_index >= QuestData::MENU_INDEX)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Create Command Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modrn_qusjrnl2_cmmndwin_5th9 create_command_window
- def create_command_window (*args)
- modrn_qusjrnl2_cmmndwin_5th9 (*args) # Run Original Method
- if $game_system.quest_menuaccess
- c = @command_window.commands
- c.insert (QuestData::MENU_INDEX, QuestData::VOCAB_QUESTS)
- width = @command_window.width
- disabled = @command_window.ma_disabled_commands
- @command_window.dispose
- @command_window = @command_window.class.new (width, c)
- @command_window.index = @menu_index
- # Disable all of the old commands as well
- disabled.each { |i|
- i += 1 if i >= QuestData::MENU_INDEX
- @command_window.draw_item (i, false)
- }
- @command_window.draw_item (QuestData::MENU_INDEX, false) if $game_system.quest_disabled || $game_party.quests.list.empty?
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Command Selection
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_questj_cmmndupd_4rn6 update_command_selection
- def update_command_selection (*args)
- if $game_system.quest_menuaccess
- # If the Quests command selected
- if @command_window.index == QuestData::MENU_INDEX && Input.trigger? (Input::C)
- if $game_system.quest_disabled || $game_party.quests.list.empty?
- Sound.play_buzzer
- else
- Sound.play_decision
- $scene = Scene_Quest.new
- end
- return
- end
- # Reduce command window index if over the states index
- change = @command_window.index > QuestData::MENU_INDEX
- @command_window.index -= 1 if change
- end
- malg_questj_cmmndupd_4rn6 (*args) # Run Original Method
- @command_window.index += 1 if $game_system.quest_menuaccess && change
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Actor Selection
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_journalqst_actorupd_3gb8 update_actor_selection
- def update_actor_selection (*args)
- if $game_system.quest_menuaccess
- # Reduce command window index if over the states index
- change = @command_window.index > QuestData::MENU_INDEX
- @command_window.index -= 1 if change
- end
- ma_journalqst_actorupd_3gb8 (*args) # Run Original Method
- @command_window.index += 1 if $game_system.quest_menuaccess && change
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement