CyberForte

DoW menu Order

Oct 10th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 39.95 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine RD - Scene Menu ReDux + KGC Custom Menu Command
  4. # Last Date Updated: 2009.06.22
  5. # Level: Normal, Hard, Lunatic
  6. #
  7. # This is more or less a revision of the menu scene. Included in the script are
  8. # a couple of features. Note that I will NOT take credit for KGC's custom menu
  9. # command script as all I did was merely import it into this script and finished
  10. # up the excluded functions that he's left behind. Everything else I did add
  11. # to the script.
  12. #
  13. # COMMAND CONTROL - by KGC
  14. # Add, remove, and re-order commands akin to KGC's CustomMenuCommands. Akin to
  15. # this feature will include what KGC's original script was missing and that was
  16. # easy functionality to include custom menu commands without hassling the core
  17. # script itself. Also added is the ability to launch common events from the
  18. # main menu itself for those who wish to event unique commands.
  19. #
  20. # REDUX MENUS
  21. # The redux menus are completely optional and are mostly nothing other than
  22. # visual changes to the menu scene. You can add icons to the command window,
  23. # display more than just gold on the main menu screen, and added experience
  24. # bars to the party window.
  25. #
  26. #===============================================================================
  27. # Updates:
  28. # ----------------------------------------------------------------------------
  29. # o 2009.06.22 - Fixed time calculation.
  30. # o 2009.06.10 - Added Time, Steps, and Map Name to MultiVariable Window.
  31. # o 2009.06.06 - Finished script.
  32. # o 2009.06.05 - Started script.
  33. #===============================================================================
  34. # Instructions
  35. #===============================================================================
  36. #
  37. # Note that the placement of this script is extremely important.
  38. #
  39. # 1. Place all of the non-KGC and non-Yanfly scripts that have new scenes above
  40. #    this script. That way, they will not alter the menu.
  41. # 2. Place all KGC and Yanfly scripts below this script to develop compatibility
  42. #    amongst all of the scripts.
  43. #
  44. # Note that the special rules other scripts may use to disable their respective
  45. # commands will not follow those rules. You'll have to mimic them through usage
  46. # of switches. Make sure you understand how and when those scripts disable their
  47. # own commands before toggling your switches.
  48. #
  49. # Scroll down to MENU_COMMANDS to add/remove/reorder your own menu commands.
  50. # Adjust any of the ReDux menu options if desired.
  51. #
  52. #===============================================================================
  53. #
  54. # Compatibility
  55. # - Works With: KGC scripts, Yanfly scripts, etc.
  56. # - Alias: Game_Temp, initialize
  57. # - Overwrites: Scene_Menu: anything regarding command window
  58. # - Overwrites: Scene_Equip, Scene_Skill, and Scene_Status's return_scene
  59. #
  60. #===============================================================================
  61. # Credits:
  62. # All credits will go to KGC as I did not write the majority of this code.
  63. # KGC for Custom Menu Command base coding and pretty much everything.
  64. #===============================================================================
  65.  
  66. $imported = {} if $imported == nil
  67. $imported["SceneMenuReDux"] = true
  68.  
  69. module YE
  70.   module REDUX
  71.     module MENU
  72.      
  73.       #-----------------------------------------------------------------------
  74.       # BASIC MENU FUNCTIONS
  75.       #-----------------------------------------------------------------------
  76.      
  77.       # This adjusts the input button used to call the main menu. By default,
  78.       # the input command is Input::B.
  79.       MENU_BUTTON = Input::X
  80.      
  81.       # The following determines which option the menu will place the cursor
  82.       # at whenever launched.
  83.       START_INDEX = 0
  84.      
  85.       # This will place the command window on the right hand side and all the
  86.       # rest on the left hand side if set to true.
  87.       RIGHT_SIDE_COMMAND = false
  88.      
  89.       #-----------------------------------------------------------------------
  90.       # Instructions on how to set up the MENU_COMMANDS order.
  91.       #------------------------------------------------------------------------
  92.       # This array will let you determine how you want your menu command list
  93.       # to be ordered. Each command is assigned a number and these are the
  94.       # following numbers. The following are the default menu commands:
  95.       #
  96.       # 0..Items   1..Skills   2..Equipment   3..Status   4..Save   5..System
  97.       #
  98.       # The following are imports from KGC's original CustomMenuCommand.
  99.       #
  100.       # 10: Party .............. KGC_LargeParty
  101.       # 11: View AP ............ KGC_EquipLearnSkill
  102.       # 12: Skill Slots ........ KGC_SkillCPSystem
  103.       # 13: Difficulty ......... KGC_BattleDifficulty
  104.       # 14: Level Up ........... KGC_DistributeParameter
  105.       # 15: Bestiary ........... KGC_MonsterGuide
  106.       # 16: Outline ............ KGC_Outline
  107.       #
  108.       # The following are menu items for Yanfly Engine ReDux scripts.
  109.       #
  110.       # 51: Change Class ....... Yanfly's Subclass Selection System
  111.       # 52: Learn Skill ........ Yanfly's Subclass Selection System
  112.       # 53: Skill Slots ........ Yanfly's Equip Skill Slots
  113.       # 54: Bestiary ........... Yanfly's Bestiary + Display Scanned Enemy
  114.       #
  115.       # For commands 101 to 200, common events can be bound. Make sure you
  116.       # set up the COMMON_EVENTS hash to get the right common events you want.
  117.       #
  118.       # From command 201 and onward, custom scripted scenes can be launched.
  119.       # Already imported are a few rather popular scripts found throughout the
  120.       # RPG Maker VX community.
  121.       #
  122.       # 201: Quest Journal ..... Modern Algebra's Quest Journal
  123.       # 202: Factions .......... SojaBird's Factions
  124.       # 203: Rows .............. originalwij's Row Changer
  125.       # 204: Record Window ..... Stilleas' Record Window
  126.       # 205: Crafting .......... Cmpsr2000's Crafting Scene
  127.       #
  128.       # If you wish to add your own commands, you'll need to register them
  129.       # under the lunatic mode portion of the script.
  130.       #-----------------------------------------------------------------------
  131.       MENU_COMMANDS =[ # Make sure you've read the instructions above.
  132.          12, # Skill Slots
  133.          2, # Equipment
  134.          11, # View AP
  135.          0, # Items
  136.          1, # Skills
  137.          3, # Status
  138.          5, # System
  139.          4, # Save
  140.       ] # Do not remove this
  141.      
  142.       # The following determines the maximum number of displayed rows for the
  143.       # customized command window.
  144.       MAX_ROWS = 8
  145.      
  146.       #-----------------------------------------------------------------------
  147.       # How to Use: Lunatic Mode - Menu Command - Common Events
  148.       #-----------------------------------------------------------------------
  149.       # The following allows you to bind common events to the menu commands.
  150.       # When a common event is selected, it will exit the menu, go back to the
  151.       # map screen, and launch the common event there. Bind these ID's from
  152.       # 101 to 200. Here is what each of the categories mean:
  153.       #
  154.       # HideSw - Switch used to hide the command. Set to nil if not used.
  155.       # DisbSw - Switch used to disable the command. Set to nil if not used.
  156.       # Debug? - Only appears in test mode. Does not appear in normal play.
  157.       # CEvent - The ID of the common event that will be launched.
  158.       # Title  - The title text that appears for the event.
  159.       #
  160.       # After binding your common events to ID's, go back to MENU_COMMANDS
  161.       # and insert the proper command ID at the proper location.
  162.       #-----------------------------------------------------------------------
  163.       COMMON_EVENTS ={ # These can only be from 101 to 199.
  164.       # -ID => [HideSw, DisbSw, Debug?, CEvent, Title Name]
  165.         101 => [   nil,    nil,   true,      9, "Debug"],
  166.         102 => [   nil,    nil,  false,     10, "Camp"],
  167.       } # Do not remove this.
  168.      
  169.       #-----------------------------------------------------------------------
  170.       # How to Use: Lunatic Mode - Menu Command - Imported Scripts
  171.       #-----------------------------------------------------------------------
  172.       # The following is what KGC originally was going to have in his script
  173.       # but was actually missing it in his publicized script. This will regain
  174.       # functionality and also lift the "limit" of only 100 extra commands.
  175.       # The following will explain how to set up the individual options.
  176.       #
  177.       # HideSw - Switch used to hide the command. Set to nil if not used.
  178.       # DisbSw - Switch used to disable the command. Set to nil if not used.
  179.       # Actor? - Does this select an actor. Set to true if it does.
  180.       # Title  - The title text that appears for the event.
  181.       # Scene  - The scene used to launch the respective scene.
  182.       #
  183.       # Note that this does not automatically detect what will and will not
  184.       # disable the command ingame. You must understand and create a work
  185.       # around with them (if they do disable the commands) with switches.
  186.       # After binding your imported commands, go back to MENU_COMMANDS and
  187.       # insert the proper command ID at the proper location.
  188.       #-----------------------------------------------------------------------
  189.       IMPORTED_COMMANDS ={ # These can only be from 201 onward.
  190.       # -ID => [HideSw, DisbSw, Actor?, Title Name, Scene Name.new]
  191.         201 => [     8,      9,  false,   "Quests", "Scene_Quest"],
  192.         202 => [    10,     11,  false, "Factions", "Scene_Factions"],
  193.         203 => [   nil,    nil,  false,     "Rows", "Scene_Row"],
  194.         204 => [   nil,    nil,  false,  "Records", "Scene_Record"],
  195.         205 => [   nil,    nil,  false, "Crafting", "Scene_Crafting"],
  196.       } # Do not remove this.
  197.      
  198.       #-----------------------------------------------------------------------
  199.       # REDUX MENU FUNCTIONS
  200.       #-----------------------------------------------------------------------
  201.      
  202.       # For those who would like to add icons to their commands, set this to
  203.       # true, then go to ICON_SETS and bind text to the icon desired.
  204.       COMMAND_ICONS = false
  205.      
  206.       # Match the ingame command names with the icons. The reason this isn't
  207.       # implemented together with the index numbers is because this can allow
  208.       # for varying icons dependent on the command name (such as difficulty).
  209.       ICON_SETS ={ # "Unlisted" must exist for the unlisted commands.
  210.         "Unlisted"      => 176,
  211.       # -----Vocab----- => Icon
  212.         "Bestiary"      => 141,
  213.         "Camp"          => 77,
  214.         "Class Change"  => 131,
  215.         "Equip"         => 44,
  216.         "Item"          => 144,
  217.         "Learn Skills"  => 133,
  218.         "Quests"        => 193,
  219.         "Save"          => 149,
  220.         "Shutdown"      => 154,
  221.         "Slots"         => 103,
  222.         "Skill"         => 159,
  223.         "Status"        => 137,
  224.         "System"        => 134,
  225.       } # Do not remove this.
  226.      
  227.       # This part will trigger usage of the "new" party status window. Set it
  228.       # to false if you do not wish to use it. The "new" status window simply
  229.       # adds the experience bar to the menu and raises the coordinates of the
  230.       # various status items by a little bit.
  231.       USE_REDUX_STATUS = true
  232.      
  233.       # This part will adjust the font size for the text shown in the Redux
  234.       # Status Menu. Affects all text.
  235.       REDUX_FONT_SIZE = 20
  236.      
  237.       # The following determines how things are shown on the Redux Status Menu.
  238.       DRAWN_ACTOR_SETUP = 0      # 0 - Face only, 1 - Sprite only, 2 - Both
  239.       SPRITE_OFFSET = 32         # Sets the y offset for actor sprites
  240.       FACE_OPACITY  = 128        # Sets the face opacity for setting 2
  241.      
  242.       # The following adjusts the EXP bar. Fill out the info properly.
  243.       EXP_TEXT      = "EXP"      # Text used for EXP
  244.       PERCENT_EXP   = "%#.03g%%" # Text format used for EXP percentage
  245.       EXP_GAUGE_1   = 28         # Colour 1 for the EXP Gauge
  246.       EXP_GAUGE_2   = 29         # Colour 2 for the EXP Gauge
  247.      
  248.       # This part adjusts the multi-variable window. It will replace the gold
  249.       # window and allows you to display multiple variables (including gold) in
  250.       # the small bow at the bottom of the screen.
  251.       USE_MULTI_VARIABLE_WINDOW = true
  252.      
  253.       # Variables will be shown in this order. Use 0 to show gold. Adjust the
  254.       # following information as seen necessary.
  255.       VARIABLES_SHOWN = [-5, -1, 0]
  256.       VARIABLES_ICONS = true
  257.       VARIABLES_HASH  ={ # Note that value zero must exist.
  258.       # VarID => [Icon, Text]
  259.            -5 => [ 153, "Map"],
  260.            -1 => [ 188, "Time"],
  261.             0 => [ 205, "Gold"],
  262.       }# Do not remove this.
  263.      
  264.     end
  265.   end
  266. end
  267.  
  268. #===============================================================================
  269. # Editting anything past this point may potentially result in causing computer
  270. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  271. # Therefore, edit at your own risk.
  272. #===============================================================================
  273.  
  274. #===============================================================================
  275. # Scene_Menu
  276. #===============================================================================
  277.  
  278. class Scene_Menu < Scene_Base
  279.  
  280.   #--------------------------------------------------------------------------
  281.   # create_command_list
  282.   #--------------------------------------------------------------------------
  283.   def create_command_list
  284.     commands = []
  285.     @ex_cmds = {}
  286.     index_list = {}
  287.     YE::REDUX::MENU::MENU_COMMANDS.each_with_index { |c, i|
  288.       case c
  289.       when 0 # Items
  290.         index_list[:item] = commands.size
  291.         commands.push(Vocab.item)
  292.        
  293.       when 1 # Skills
  294.         index_list[:skill] = commands.size
  295.         commands.push(Vocab.skill)
  296.        
  297.       when 2 # Equip
  298.         index_list[:equip] = commands.size
  299.         commands.push(Vocab.equip)
  300.        
  301.       when 3 # Status
  302.         index_list[:status] = commands.size
  303.         commands.push(Vocab.status)
  304.        
  305.       when 4 # Save
  306.         index_list[:save] = commands.size
  307.         commands.push(Vocab.save)
  308.        
  309.       when 5 # System
  310.         index_list[:game_end] = commands.size
  311.         commands.push(Vocab.game_end)
  312.        
  313.       when 10 # KGC's Large Party
  314.         next unless $imported["LargeParty"]
  315.         index_list[:partyform] = commands.size
  316.         @__command_partyform_index = commands.size
  317.         commands.push(Vocab.partyform)
  318.        
  319.       when 11 # KGC's AP Viewer
  320.         next unless $imported["EquipLearnSkill"]
  321.         index_list[:ap_viewer] = commands.size
  322.         @__command_ap_viewer_index = commands.size
  323.         commands.push(Vocab.ap_viewer)
  324.        
  325.       when 12 # KGC's CP Skill System
  326.         next unless $imported["SkillCPSystem"]
  327.         index_list[:set_battle_skill] = commands.size
  328.         @__command_set_battle_skill_index = commands.size
  329.         commands.push(Vocab.set_battle_skill)
  330.        
  331.       when 13 # KGC's Battle Difficulty
  332.         next unless $imported["BattleDifficulty"]
  333.         index_list[:set_difficulty] = commands.size
  334.         @__command_set_difficulty_index = commands.size
  335.         commands.push(KGC::BattleDifficulty.get[:name])
  336.        
  337.       when 14 # KGC's Distribute Parameter
  338.         next unless $imported["DistributeParameter"]
  339.         index_list[:distribute_parameter] = commands.size
  340.         @__command_distribute_parameter_index = commands.size
  341.         commands.push(Vocab.distribute_parameter)
  342.        
  343.       when 15 # KGC's Enemy Guide
  344.         next unless $imported["EnemyGuide"]
  345.         index_list[:enemy_guide] = commands.size
  346.         @__command_enemy_guide_index = commands.size
  347.         commands.push(Vocab.enemy_guide)
  348.        
  349.       when 16 # KGC's Outline
  350.         next unless $imported["Outline"]
  351.         index_list[:outline] = commands.size
  352.         @__command_outline_index = commands.size
  353.         commands.push(Vocab.outline)
  354.        
  355.       when 51 # Yanfly Subclass Class Change
  356.         next unless $imported["SubclassSelectionSystem"]
  357.         next unless YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION
  358.         next unless $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
  359.         index_list[:classchange] = commands.size
  360.         @command_class_change = commands.size
  361.         commands.push(YE::SUBCLASS::MENU_CLASS_CHANGE_TITLE)
  362.  
  363.       when 52 # Yanfly Subclass Learn Skill
  364.         next unless $imported["SubclassSelectionSystem"]
  365.         next unless YE::SUBCLASS::USE_JP_SYSTEM and
  366.         YE::SUBCLASS::LEARN_SKILL_OPTION
  367.         next unless $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
  368.         index_list[:learnskill] = commands.size
  369.         @command_learn_skill = commands.size
  370.         commands.push(YE::SUBCLASS::LEARN_SKILL_TITLE)
  371.        
  372.       when 53 # Yanfly Equip Skill System
  373.         next unless $imported["EquipSkillSlots"]
  374.         next unless $game_switches[YE::EQUIPSKILL::ENABLE_SLOTS_SWITCH]
  375.         index_list[:equipskill] = commands.size
  376.         @command_equip_skill = commands.size
  377.         commands.push(YE::EQUIPSKILL::MENU_TITLE)
  378.        
  379.       when 54  # Yanfly Bestiary
  380.         next unless $imported["DisplayScannedEnemy"]
  381.         next unless $game_switches[YE::MENU::MONSTER::BESTIARY_SWITCH]
  382.         index_list[:bestiary] = commands.size
  383.         @command_bestiary = commands.size
  384.         commands.push(YE::MENU::MONSTER::BESTIARY_TITLE)
  385.        
  386.       when 101..200
  387.         next unless YE::REDUX::MENU::COMMON_EVENTS.include?(c)
  388.         common_event = YE::REDUX::MENU::COMMON_EVENTS[c]
  389.         next if !$TEST and common_event[2]
  390.         next if common_event[0] != nil and $game_switches[common_event[0]]
  391.         index_list[c] = commands.size
  392.         @ex_cmds[c] = commands.size
  393.         commands.push(common_event[4])
  394.        
  395.       else
  396.         next unless YE::REDUX::MENU::IMPORTED_COMMANDS.include?(c)
  397.         command_array = YE::REDUX::MENU::IMPORTED_COMMANDS[c]
  398.         next if command_array[0] != nil and $game_switches[command_array[0]]
  399.         index_list[c] = commands.size
  400.         @ex_cmds[c] = commands.size
  401.         commands.push(command_array[3])
  402.        
  403.       end
  404.     } # Do not remove this.
  405.     $game_temp.menu_command_index = index_list
  406.     return commands
  407.   end
  408.  
  409.   #--------------------------------------------------------------------------
  410.   # set_command_enabled
  411.   #--------------------------------------------------------------------------
  412.   def set_command_enabled
  413.     disable_items = []
  414.     @disabled_command_index = []
  415.     # If zero party members are present
  416.     if $game_party.members.size == 0
  417.       disable_items.push(:item, :skill, :equip, :status, :partyform,
  418.       :ap_viewer, :set_battle_skill, :distribute_parameter, :classchange,
  419.       :learnskill, :equipskill)
  420.     end
  421.     # If saving has been disabled
  422.     if $game_system.save_disabled
  423.       disable_items.push(:save)
  424.     end
  425.     # If party changing is disabled
  426.     if $imported["LargeParty"] and !$game_party.partyform_enable?
  427.       disable_items.push(:partyform)
  428.     end
  429.     for key in YE::REDUX::MENU::COMMON_EVENTS
  430.       next unless $game_temp.menu_command_index.has_key?(key[0])
  431.       next if key[1][1] == nil
  432.       disable_items.push(key[0]) if $game_switches[key[1][1]]
  433.     end
  434.     for key in YE::REDUX::MENU::IMPORTED_COMMANDS
  435.       next unless $game_temp.menu_command_index.has_key?(key[0])
  436.       next if key[1][1] == nil
  437.       disable_items.push(key[0]) if $game_switches[key[1][1]]
  438.     end
  439.     # Disable each of the items.
  440.     disable_items.each { |i|
  441.       if $game_temp.menu_command_index.has_key?(i)
  442.         index = $game_temp.menu_command_index[i]
  443.         @command_window.draw_item(index, false)
  444.         @disabled_command_index.push(index)
  445.       end
  446.     }
  447.   end
  448.  
  449.   #--------------------------------------------------------------------------
  450.   # overwrite update_command_selection
  451.   #--------------------------------------------------------------------------
  452.   def update_command_selection
  453.     if Input.trigger?(Input::B)
  454.       Sound.play_cancel
  455.       $scene = Scene_Map.new
  456.     elsif Input.trigger?(Input::C)
  457.       index = @command_window.index
  458.       unless command_enabled?(index)
  459.         Sound.play_buzzer
  460.         return
  461.       end
  462.       Sound.play_decision
  463.       case index
  464.       # Item Command
  465.       when $game_temp.menu_command_index[:item]
  466.         $scene = Scene_Item.new
  467.       # Skill, Equip, and Status Commands
  468.       when $game_temp.menu_command_index[:skill],
  469.       $game_temp.menu_command_index[:equip],
  470.       $game_temp.menu_command_index[:status]
  471.         start_actor_selection
  472.       # Save Command
  473.       when $game_temp.menu_command_index[:save]
  474.         $scene = Scene_File.new(true, false, false)
  475.       # System Command
  476.       when $game_temp.menu_command_index[:game_end]
  477.         $scene = Scene_End.new
  478.       else # Custom Commands
  479.         return_check = true
  480.         for key in @ex_cmds
  481.           if @ex_cmds[key[0]] == index
  482.             return_check = false
  483.             found_key = key[0]
  484.             break
  485.           end
  486.         end
  487.         return if return_check
  488.         if found_key >= 101 and found_key <= 200 # Play a common event
  489.           common_event = YE::REDUX::MENU::COMMON_EVENTS[found_key]
  490.           $game_temp.common_event_id = common_event[3]
  491.           $scene = Scene_Map.new
  492.         else # Play an imported scene
  493.           menu_command = YE::REDUX::MENU::IMPORTED_COMMANDS[found_key]
  494.           if menu_command[2]
  495.             start_actor_selection
  496.           else
  497.             $scene = eval(menu_command[4] + ".new")
  498.           end
  499.         end # End found_key
  500.       end # End case check
  501.     end
  502.   end
  503.  
  504.   #--------------------------------------------------------------------------
  505.   # overwrite update_actor_selection
  506.   #--------------------------------------------------------------------------
  507.   def update_actor_selection
  508.     if Input.trigger?(Input::B)
  509.       Sound.play_cancel
  510.       end_actor_selection
  511.     elsif Input.trigger?(Input::C)
  512.       $game_party.last_actor_index = @status_window.index
  513.       Sound.play_decision
  514.       case @command_window.index
  515.       when $game_temp.menu_command_index[:skill] # Skill Command
  516.         $scene = Scene_Skill.new(@status_window.index)
  517.       when $game_temp.menu_command_index[:equip] # Equip Command
  518.         $scene = Scene_Equip.new(@status_window.index)
  519.       when $game_temp.menu_command_index[:status] # Status Command
  520.         $scene = Scene_Status.new(@status_window.index)
  521.       else # Custom Commands
  522.         return_check = true
  523.         for key in @ex_cmds
  524.           if @ex_cmds[key[0]] == @command_window.index
  525.             return_check = false
  526.             found_key = key[0]
  527.             break
  528.           end
  529.         end
  530.         return if return_check
  531.         menu_command = YE::REDUX::MENU::IMPORTED_COMMANDS[found_key]
  532.         $scene = eval(menu_command[4] + ".new(@status_window.index)")
  533.       end
  534.     end
  535.   end
  536.  
  537.   #--------------------------------------------------------------------------
  538.   # command_enabled?
  539.   #--------------------------------------------------------------------------
  540.   def command_enabled?(index)
  541.     if $game_system.save_disabled and
  542.     index == $game_temp.menu_command_index[:save]
  543.       return false
  544.     end
  545.     if $game_party.members.size == 0 and
  546.     @disabled_command_index.include?(index)
  547.       return false
  548.     end
  549.     for key in @ex_cmds
  550.       if @ex_cmds[key[0]] == index
  551.         return false if @disabled_command_index.include?(index)
  552.       end
  553.     end
  554.     return true
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # overwrite initialize
  559.   #--------------------------------------------------------------------------
  560.   def initialize(menu_index = YE::REDUX::MENU::START_INDEX)
  561.     @menu_index = menu_index
  562.   end
  563.  
  564.   #--------------------------------------------------------------------------
  565.   # alias start
  566.   #--------------------------------------------------------------------------
  567.   alias start_menurd start unless $@
  568.   def start
  569.     start_menurd
  570.     if YE::REDUX::MENU::USE_REDUX_STATUS
  571.       @status_window.dispose
  572.       @status_window = Window_ReDuxMenuStatus.new(160, 0)
  573.     end
  574.     if YE::REDUX::MENU::USE_MULTI_VARIABLE_WINDOW
  575.       @gold_window.dispose
  576.       @gold_window = Window_MultiVariableWindow.new
  577.     end
  578.     if YE::REDUX::MENU::RIGHT_SIDE_COMMAND
  579.       @status_window.x = 0
  580.       @command_window.x = Graphics.width - 160
  581.       @gold_window.x = Graphics.width - 160
  582.     end
  583.   end
  584.  
  585.   #--------------------------------------------------------------------------
  586.   # overwrite create_command_window
  587.   #--------------------------------------------------------------------------
  588.   def create_command_window
  589.     commands = create_command_list
  590.     if YE::REDUX::MENU::COMMAND_ICONS
  591.       @command_window = Window_MenuCommand.new(160, commands)
  592.     else
  593.       @command_window = Window_Command.new(160, commands)
  594.     end
  595.     @command_window.height = [@command_window.height,
  596.       YE::REDUX::MENU::MAX_ROWS * 24 + 32].min
  597.     @command_window.index = [@menu_index, commands.size - 1].min
  598.     set_command_enabled
  599.   end
  600.  
  601. end # Scene_Menu
  602.  
  603. #===============================================================================
  604. # Scene_Map
  605. #===============================================================================
  606.  
  607. class Scene_Map < Scene_Base
  608.  
  609.   #--------------------------------------------------------------------------
  610.   # overwrite update_call_menu
  611.   #--------------------------------------------------------------------------
  612.   def update_call_menu
  613.     if Input.trigger?(YE::REDUX::MENU::MENU_BUTTON)
  614.       return if $game_map.interpreter.running?
  615.       return if $game_system.menu_disabled
  616.       $game_temp.menu_beep = true
  617.       $game_temp.next_scene = "menu"
  618.     end
  619.   end
  620.  
  621. end # Scene_Map
  622.  
  623. #==============================================================================
  624. # Imported from KGC's Custom Menu Command
  625. # to improve compatibility amongst KGC scripts
  626. #==============================================================================
  627. $imported["CustomMenuCommand"] = true
  628. class Game_Temp
  629.   attr_accessor :menu_command_index
  630.   attr_accessor :next_scene_actor_index
  631.  
  632.   alias initialize_KGC_CustomMenuCommand initialize unless $@
  633.   def initialize
  634.     initialize_KGC_CustomMenuCommand
  635.  
  636.     @menu_command_index = {}
  637.     @next_scene_actor_index = 0
  638.   end
  639. end
  640.  
  641. module KGC
  642. module Commands
  643.   module_function
  644.   def call_item
  645.     return if $game_temp.in_battle
  646.     $game_temp.next_scene = :menu_item
  647.     $game_temp.next_scene_actor_index = 0
  648.     $game_temp.menu_command_index = {}
  649.   end
  650.   def call_skill(actor_index = 0)
  651.     return if $game_temp.in_battle
  652.     $game_temp.next_scene = :menu_skill
  653.     $game_temp.next_scene_actor_index = actor_index
  654.     $game_temp.menu_command_index = {}
  655.   end
  656.   def call_equip(actor_index = 0)
  657.     return if $game_temp.in_battle
  658.     $game_temp.next_scene = :menu_equip
  659.     $game_temp.next_scene_actor_index = actor_index
  660.     $game_temp.menu_command_index = {}
  661.   end
  662.   def call_status(actor_index = 0)
  663.     return if $game_temp.in_battle
  664.     $game_temp.next_scene = :menu_status
  665.     $game_temp.next_scene_actor_index = actor_index
  666.     $game_temp.menu_command_index = {}
  667.   end
  668. end
  669. end
  670.  
  671. class Game_Interpreter
  672.   include KGC::Commands
  673. end
  674.  
  675. class Scene_Map < Scene_Base
  676.   alias update_scene_change_KGC_CustomMenuCommand update_scene_change unless $@
  677.   def update_scene_change
  678.     return if $game_player.moving?
  679.     case $game_temp.next_scene
  680.     when :menu_item
  681.       call_menu_item
  682.     when :menu_skill
  683.       call_menu_skill
  684.     when :menu_equip
  685.       call_menu_equip
  686.     when :menu_status
  687.       call_menu_status
  688.     else
  689.       update_scene_change_KGC_CustomMenuCommand
  690.     end
  691.   end
  692.   def call_menu_item
  693.     $game_temp.next_scene = nil
  694.     $scene = Scene_Item.new
  695.   end
  696.   def call_menu_skill
  697.     $game_temp.next_scene = nil
  698.     $scene = Scene_Skill.new($game_temp.next_scene_actor_index)
  699.     $game_temp.next_scene_actor_index = 0
  700.   end
  701.   def call_menu_equip
  702.     $game_temp.next_scene = nil
  703.     $scene = Scene_Equip.new($game_temp.next_scene_actor_index)
  704.     $game_temp.next_scene_actor_index = 0
  705.   end
  706.   def call_menu_status
  707.     $game_temp.next_scene = nil
  708.     $scene = Scene_Status.new($game_temp.next_scene_actor_index)
  709.     $game_temp.next_scene_actor_index = 0
  710.   end
  711. end
  712.  
  713. class Scene_Item < Scene_Base
  714.   def return_scene
  715.     if $game_temp.menu_command_index.has_key?(:item)
  716.       $scene = Scene_Menu.new($game_temp.menu_command_index[:item])
  717.     else
  718.       $scene = Scene_Map.new
  719.     end
  720.   end
  721. end
  722.  
  723. unless $imported["SceneSkillReDux"]
  724. class Scene_Skill < Scene_Base
  725.   def return_scene
  726.     if $game_temp.menu_command_index.has_key?(:skill)
  727.       $scene = Scene_Menu.new($game_temp.menu_command_index[:skill])
  728.     else
  729.       $scene = Scene_Map.new
  730.     end
  731.   end
  732. end
  733. end
  734.  
  735. unless $imported["SceneEquipReDux"]
  736. class Scene_Equip < Scene_Base
  737.   def return_scene
  738.     if $game_temp.menu_command_index.has_key?(:equip)
  739.       $scene = Scene_Menu.new($game_temp.menu_command_index[:equip])
  740.     else
  741.       $scene = Scene_Map.new
  742.     end
  743.   end
  744. end
  745. end
  746.  
  747. unless $imported["SceneStatusReDux"]
  748. class Scene_Status < Scene_Base
  749.   def return_scene
  750.     if $game_temp.menu_command_index.has_key?(:status)
  751.       $scene = Scene_Menu.new($game_temp.menu_command_index[:status])
  752.     else
  753.       $scene = Scene_Map.new
  754.     end
  755.   end
  756. end
  757. end
  758.  
  759. class Scene_File < Scene_Base
  760.   alias return_scene_KGC_CustomMenuCommand return_scene unless $@
  761.   def return_scene
  762.     if @from_title || @from_event
  763.       return_scene_KGC_CustomMenuCommand
  764.     elsif $game_temp.menu_command_index.has_key?(:save)
  765.       $scene = Scene_Menu.new($game_temp.menu_command_index[:save])
  766.     else
  767.       $scene = Scene_Map.new
  768.     end
  769.   end
  770. end
  771.  
  772. class Scene_End < Scene_Base
  773.   def return_scene
  774.     if $game_temp.menu_command_index.has_key?(:game_end)
  775.       $scene = Scene_Menu.new($game_temp.menu_command_index[:game_end])
  776.     else
  777.       $scene = Scene_Map.new
  778.     end
  779.   end
  780. end
  781.  
  782. #===============================================================================
  783. # Game_Map
  784. #===============================================================================
  785.  
  786. class Game_Map
  787.  
  788.   #--------------------------------------------------------------------------
  789.   # map name
  790.   #--------------------------------------------------------------------------
  791.   unless method_defined?(:map_name)
  792.   def map_name
  793.     data = load_data("Data/MapInfos.rvdata")
  794.     text = data[@map_id].name.gsub(/\[.*\]/) { "" }
  795.     return text
  796.   end
  797.   end
  798.  
  799. end # Game_Map
  800.  
  801. #===============================================================================
  802. # Game_Actor
  803. #===============================================================================
  804.  
  805. class Game_Actor < Game_Battler
  806.  
  807.   #--------------------------------------------------------------------------
  808.   # Now Exp - The experience gained for the current level.
  809.   #--------------------------------------------------------------------------
  810.   def now_exp
  811.     return @exp - @exp_list[@level]
  812.   end
  813.  
  814.   #--------------------------------------------------------------------------
  815.   # Next Exp - The experience needed for the next level.
  816.   #--------------------------------------------------------------------------
  817.   def next_exp
  818.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  819.   end
  820.  
  821. end # Game_Actor
  822.  
  823. #===============================================================================
  824. # Window_MenuCommand
  825. #===============================================================================
  826.  
  827. class Window_MenuCommand < Window_Command
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # draw_item
  831.   #--------------------------------------------------------------------------
  832.   def draw_item(index, enabled = true)
  833.     rect = item_rect(index)
  834.     rect.x += 4
  835.     rect.width -= 8
  836.     dx = rect.x
  837.     dy = rect.y
  838.     dw = rect.width
  839.     dh = rect.height
  840.     self.contents.clear_rect(rect)
  841.     self.contents.font.color = normal_color
  842.     if YE::REDUX::MENU::ICON_SETS.include?(@commands[index])
  843.       icon = YE::REDUX::MENU::ICON_SETS[@commands[index]]
  844.     else
  845.       icon = YE::REDUX::MENU::ICON_SETS["Unlisted"]
  846.     end
  847.     draw_icon(icon, dx, dy, enabled)
  848.     self.contents.font.color.alpha = enabled ? 255 : 128
  849.     self.contents.draw_text(dx+24, dy, dw-24, dh, @commands[index])
  850.   end
  851.  
  852. end # Window_MenuCommand
  853.  
  854. #===============================================================================
  855. # Window_ReDuxMenuStatus
  856. #===============================================================================
  857.  
  858. class Window_ReDuxMenuStatus < Window_MenuStatus
  859.  
  860.   #--------------------------------------------------------------------------
  861.   # refresh
  862.   #--------------------------------------------------------------------------
  863.   def refresh
  864.     @item_max = $game_party.members.size
  865.     create_contents
  866.     fill_stand_by_background if $imported["LargeParty"]
  867.     for actor in $game_party.members
  868.       draw_rd_menu_actor(actor)
  869.       x = 104
  870.       y = actor.index * 96
  871.       draw_actor_name(actor, x, y)
  872.       draw_actor_class(actor, x + 120, y)
  873.       draw_actor_level(actor, x, y + WLH * 1)
  874.       draw_actor_state(actor, x, y + WLH * 2)
  875.       draw_actor_hp(actor, x + 120, y + WLH * 1, 120)
  876.       draw_actor_mp(actor, x + 120, y + WLH * 2, 120)
  877.       draw_rd_menu_exp(actor, x + 120, y + WLH * 3, 120)
  878.     end
  879.   end
  880.  
  881.   #--------------------------------------------------------------------------
  882.   # draw_rd_menu_actor
  883.   #--------------------------------------------------------------------------
  884.   def draw_rd_menu_actor(actor)
  885.     case YE::REDUX::MENU::DRAWN_ACTOR_SETUP
  886.     when 0
  887.       draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
  888.     when 1
  889.       offset = YE::REDUX::MENU::SPRITE_OFFSET
  890.       draw_actor_graphic(actor, 49, (actor.index + 1) * 96 - offset)
  891.     when 2
  892.       offset = YE::REDUX::MENU::SPRITE_OFFSET
  893.       opacity = YE::REDUX::MENU::FACE_OPACITY
  894.       face_name = actor.face_name
  895.       face_index = actor.face_index
  896.       bitmap = Cache.face(face_name)
  897.       rect = Rect.new(0, 0, 0, 0)
  898.       rect.x = face_index % 4 * 96 + 4 / 2
  899.       rect.y = face_index / 4 * 96 + 4 / 2
  900.       rect.width = 92
  901.       rect.height = 92
  902.       self.contents.blt(2, actor.index * 96 + 2, bitmap, rect, opacity)
  903.       bitmap.dispose
  904.       draw_actor_graphic(actor, 49, (actor.index + 1) * 96 - offset)
  905.     end
  906.   end
  907.  
  908.   #--------------------------------------------------------------------------
  909.   # draw_rd_menu_exp
  910.   #--------------------------------------------------------------------------
  911.   def draw_rd_menu_exp(actor, x, y, size = 120)
  912.     if actor.next_exp != 0
  913.       gw = size * actor.now_exp
  914.       gw /= actor.next_exp
  915.     else
  916.       gw = size
  917.     end
  918.     gc1 = text_color(YE::REDUX::MENU::EXP_GAUGE_1)
  919.     gc2 = text_color(YE::REDUX::MENU::EXP_GAUGE_2)
  920.     self.contents.fill_rect(x, y + WLH - 8, size, 6, gauge_back_color)
  921.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  922.    
  923.     self.contents.font.color = system_color
  924.     self.contents.draw_text(x, y, 40, WLH, YE::REDUX::MENU::EXP_TEXT)
  925.     self.contents.font.color = normal_color
  926.     if actor.next_exp != 0
  927.       expercent = actor.now_exp * 100.000
  928.       expercent /= actor.next_exp
  929.     else
  930.       expercent = 100.000
  931.     end
  932.     expercent = 100.000 if expercent > 100.000
  933.     text = sprintf(YE::REDUX::MENU::PERCENT_EXP, expercent)
  934.     self.contents.draw_text(x, y, size, WLH, text, 2)
  935.   end
  936.  
  937. end # Window_ReDuxMenuStatus
  938.  
  939. #===============================================================================
  940. # Window_MultiVariableWindow
  941. #===============================================================================
  942.  
  943. class Window_MultiVariableWindow < Window_Selectable
  944.  
  945.   #--------------------------------------------------------------------------
  946.   # initialize
  947.   #--------------------------------------------------------------------------
  948.   def initialize
  949.     dh = 32 + 24 * YE::REDUX::MENU::VARIABLES_SHOWN.size
  950.     dy = Graphics.height - dh
  951.     super(0, dy, 160, dh)
  952.     refresh
  953.   end
  954.  
  955.   #--------------------------------------------------------------------------
  956.   # refresh
  957.   #--------------------------------------------------------------------------
  958.   def refresh
  959.     @data = []
  960.     for i in YE::REDUX::MENU::VARIABLES_SHOWN
  961.       next unless YE::REDUX::MENU::VARIABLES_HASH.include?(i)
  962.       @time_index = @data.size if i == -1
  963.       @data.push(i)
  964.     end
  965.     @item_max = @data.size
  966.     create_contents
  967.     for i in 0...@item_max
  968.       draw_item(i)
  969.     end
  970.   end
  971.  
  972.   #--------------------------------------------------------------------------
  973.   # draw_item
  974.   #--------------------------------------------------------------------------
  975.   def draw_item(index)
  976.     rect = item_rect(index)
  977.     sw = self.width - 32
  978.     dy = WLH * index
  979.     self.contents.clear_rect(rect)
  980.     i = @data[index]
  981.     case i
  982.     when -5 # Draw Map Name
  983.       self.contents.draw_text(0, dy, sw, WLH, $game_map.map_name, 1)
  984.      
  985.     when -2 # Draw Steps
  986.       if YE::REDUX::MENU::VARIABLES_ICONS
  987.         text = $game_party.steps
  988.         self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
  989.         draw_icon(YE::REDUX::MENU::VARIABLES_HASH[-2][0], sw-24, dy)
  990.       else
  991.         text = YE::REDUX::MENU::VARIABLES_HASH[-2][1]
  992.         value = $game_party.steps
  993.         cx = contents.text_size(text).width
  994.         self.contents.font.color = normal_color
  995.         self.contents.draw_text(0, dy, sw-cx-2, WLH, value, 2)
  996.         self.contents.font.color = system_color
  997.         self.contents.draw_text(0, dy, sw, WLH, text, 2)
  998.       end
  999.      
  1000.     when -1 # Draw Time
  1001.       if YE::REDUX::MENU::VARIABLES_ICONS
  1002.         text = game_time
  1003.         self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
  1004.         draw_icon(YE::REDUX::MENU::VARIABLES_HASH[-1][0], sw-24, dy)
  1005.       else
  1006.         self.contents.font.color = normal_color
  1007.         text = game_time
  1008.         self.contents.draw_text(0, dy, sw, WLH, text, 1)
  1009.       end
  1010.      
  1011.     when 0 # Draw Gold
  1012.       if YE::REDUX::MENU::VARIABLES_ICONS
  1013.         text = $game_party.gold
  1014.         self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
  1015.         draw_icon(YE::REDUX::MENU::VARIABLES_HASH[0][0], sw-24, dy)
  1016.       else
  1017.         draw_currency_value($game_party.gold, 4, dy, 120)
  1018.       end
  1019.      
  1020.     else # Draw Variables
  1021.       if YE::REDUX::MENU::VARIABLES_ICONS
  1022.         text = $game_variables[i]
  1023.         self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
  1024.         draw_icon(YE::REDUX::MENU::VARIABLES_HASH[i][0], sw-24, dy)
  1025.       else
  1026.         text = YE::REDUX::MENU::VARIABLES_HASH[i][1]
  1027.         value = $game_variables[i]
  1028.         cx = contents.text_size(text).width
  1029.         self.contents.font.color = normal_color
  1030.         self.contents.draw_text(0, dy, sw-cx-2, WLH, value, 2)
  1031.         self.contents.font.color = system_color
  1032.         self.contents.draw_text(0, dy, sw, WLH, text, 2)
  1033.       end
  1034.     end
  1035.   end
  1036.  
  1037.   #--------------------------------------------------------------------------
  1038.   # game_time
  1039.   #--------------------------------------------------------------------------
  1040.   def game_time
  1041.     @gametime = Graphics.frame_count / Graphics.frame_rate
  1042.     hours = @gametime / 3600
  1043.     minutes = @gametime / 60 % 60
  1044.     seconds = @gametime % 60
  1045.     result = sprintf("%d:%02d:%02d", hours, minutes, seconds)
  1046.     return result
  1047.   end
  1048.  
  1049.   #--------------------------------------------------------------------------
  1050.   # update
  1051.   #--------------------------------------------------------------------------
  1052.   if YE::REDUX::MENU::VARIABLES_SHOWN.include?(-1)
  1053.   def update
  1054.     if @gametime != (Graphics.frame_count / Graphics.frame_rate)
  1055.       draw_item(@time_index)
  1056.     end
  1057.   end
  1058.   end
  1059.  
  1060. end # Window_MultiVariableWindow
  1061.  
  1062. #===============================================================================
  1063. #
  1064. # END OF FILE
  1065. #
  1066. #===============================================================================
Add Comment
Please, Sign In to add comment