khanhdu

CSCA Menu Organizer

Jun 3rd, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 13.84 KB | None | 0 0
  1. =begin
  2. CSCA Menu Organizer
  3. version: 1.0.6 (Released: July 20, 2013)
  4. Created by: Casper Gaming (http://www.caspergaming.com/)
  5.  
  6. This version supports:
  7. CSCA Encyclopedia w/ Bestiary (all versions)
  8. CSCA Dungeon Tools (v1.3b +)
  9. CSCA Treasure Maps (all versions)
  10. CSCA Achievements (all versions)
  11. CSCA SideQuests (all versions)
  12. CSCA Professions (all versions)
  13. CSCA Quest System (all versions)
  14.  
  15. COMPATIBILITY
  16. Note: If you are using a version of any CSCA script that adds itself to the menu,
  17. you'll need to turn that option off to be compatible with this script.
  18.  
  19. Should be compatible with almost any script. Compatible only for VXAce.
  20. IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
  21. otherwise noted.
  22.  
  23. FFEATURES
  24. This script will allow you to easily add any CSCA Scripts to your main menu. It
  25. also allows you to change the default commands easily, as well as add an option
  26. to open the debug menu from the main menu during playtest mode.
  27.  
  28. SETUP
  29. Setup options below.
  30.  
  31. CREDIT:
  32. Free to use in noncommercial games if credit is given to:
  33. Casper Gaming (http://www.caspergaming.com/)
  34.  
  35. To use in a commercial game, please purchase a license here:
  36. http://www.caspergaming.com/licenses.html
  37.  
  38. TERMS:
  39. http://www.caspergaming.com/terms_of_use.html
  40. =end
  41. module CSCA
  42.   module MENU
  43.    
  44.     #Main Menu Options - changing these to true may increase compatibility with
  45.     #custom menu scripts
  46.     MAIN_COMMANDS = true     # Add item, skill, equip, status to the menu?
  47.     FORMATION_COMMAND = true # Add the formation command to the menu?
  48.     ORIGINAL_COMMANDS = true # Add custom script commands to the menu?
  49.     SAVE_COMMAND = true      # Add the save command to the menu?
  50.     END_COMMAND = true       # Add the game end command to the menu?
  51.    
  52.     # Leaving these as true may increase compatibility with custom menu scripts.
  53.     # These only have an effect if MAIN_COMMANDS above is set to true.
  54.     ITEM_ENABLED = true     # Add Item to the menu?
  55.     SKILL_ENABLED = true    # Add Skill to the menu?
  56.     EQUIP_ENABLED = true    # Add Equip to the menu?
  57.     STATUS_ENABLED = true   # Add Status to the menu?
  58.    
  59.     DEBUG = true # Add debug option to menu in playtest mode?
  60.    
  61.     #Setting this to 0 may increase compatibility with custom menu scripts.
  62.     LINES = 10  #Amount of commands to show before scrolling to show.
  63.                #If set to 0, the window will show all commands without scrolling.
  64.    
  65.    
  66.     #CSCA Script Setup
  67.    
  68.     #The following commands require CSCA Encyclopedia
  69.     #http://www.rpgmakervxace.net/topic/2775-csca-encyclopedia-w-bestiary-v20/
  70.     ENCYCLOPEDIA = "Bách Khoa"
  71.     INCLUDE_ENC = true # Include the CSCA Encyclopedia in the menu?
  72.     ENC_SWITCH = 0 # Switch that shows/hides Encyclopedia in menu. 0 = always show
  73.    
  74.     #The following commands require CSCA Dungeon Tools
  75.     #http://www.rpgmakervxace.net/topic/2275-csca-dungeon-tools/
  76.     DUNGEON_TOOLS = "Dungeon Tools"
  77.     INCLUDE_DUN = true # Include the CSCA Dungeon Tools in the menu?
  78.     DT_SWITCH = 0 # Switch that shows/hides Dungeon Tools in menu. 0 = always show
  79.    
  80.     #The following commands require CSCA Treasure Maps
  81.     #http://www.rpgmakervxace.net/topic/5388-csca-treasure-maps/
  82.     TREASURE_MAPS = "Bản Đồ"
  83.     INCLUDE_MAP = true # Include the CSCA Treasure Maps in the menu?
  84.     MAP_SWITCH = 0 # Switch that shows/hides Treasure Maps in menu. 0 = always show
  85.    
  86.     #The following commands require CSCA Achievements
  87.     #http://www.rpgmakervxace.net/topic/5554-csca-achievements/
  88.     ACHIEVEMENTS = "Thành Tựu"
  89.     INCLUDE_ACH = true # Include the CSCA Achievements in the menu?
  90.     ACH_SWITCH = 0 # Switch that shows/hides Achievements in menu. 0 = always show
  91.    
  92.     # The following commands require CSCA SideQuests
  93.     #http://www.rpgmakervxace.net/topic/7837-csca-sidequestbulletin-board-system/
  94.     SIDEQUESTS = "Nhiệm Vụ Phụ"
  95.     INCLUDE_SQ = true # Include CSCA SideQuests in the menu?
  96.     SQ_SWITCH = 1 # Switch that shows/hides Sidequess in menu. 0 = always show
  97.    
  98.     # The following commands require CSCA Professions
  99.     #http://www.rpgmakervxace.net/topic/14734-csca-professions/
  100.     PROFESSIONS = "Nghề Nghiệp"
  101.     INCLUDE_PRF = true # Include CSCA Professions in the menu?
  102.     PRF_SWITCH = 0 # Switch that shows/hides Professions in menu. 0 = always show
  103.    
  104.     # The following commands require CSCA Quest System
  105.     #coming soon
  106.     QUESTS = "Nhiệm Vụ"
  107.     INCLUDE_QSY = true # Include CSCA Quest System in the menu?
  108.     QSY_SWITCH = 0 # Switch that shows/hides Quest System in menu. 0 = always show
  109.    
  110.     # NOTE:
  111.     #
  112.     # This script will be updated consistently to include future CSCA scripts
  113.     # that can go in the menu, however support for all custom scripts is not
  114.     # planned. Yanfly already has a script for that, if that's what you want:
  115.     # http://yanflychannel.wordpress.com/rmvxa/menu-scripts/ace-menu-engine/
  116.     #
  117.     # This script is just meant for those who just want to easily add CSCA
  118.     # Scripts to the menu without all of the other features.
  119.    
  120.   end
  121. end
  122. $imported = {} if $imported.nil?
  123. $imported["CSCA-MenuOrganizer"] = true
  124. #==============================================================================
  125. # ** Scene_Menu
  126. #------------------------------------------------------------------------------
  127. # Adds commands for CSCA Scripts.
  128. #==============================================================================
  129. class Scene_Menu < Scene_MenuBase
  130.   #--------------------------------------------------------------------------
  131.   # Alias Method; create command window
  132.   #--------------------------------------------------------------------------
  133.   alias :csca_create_command_window :create_command_window
  134.   def create_command_window
  135.     csca_create_command_window
  136.     @command_window.set_handler(:cscadebug, method(:csca_debug_select)) if $TEST && CSCA::MENU::DEBUG
  137.     @command_window.set_handler(:encyclopedia, method(:csca_encyclopedia_select))  if $imported["CSCA-Encyclopedia"] &&
  138.     CSCA::MENU::INCLUDE_ENC
  139.     @command_window.set_handler(:dungeontools, method(:csca_dt_select)) if $imported["CSCA-DungeonTools"] &&
  140.     CSCA::MENU::INCLUDE_DUN
  141.     @command_window.set_handler(:treasuremaps, method(:csca_tmap_select)) if $imported["CSCA-TreasureMaps"] &&
  142.     CSCA::MENU::INCLUDE_MAP
  143.     @command_window.set_handler(:achievements, method(:csca_ach_select)) if $imported["CSCA-Achievements"] &&
  144.     CSCA::MENU::INCLUDE_ACH
  145.     @command_window.set_handler(:sidequests, method(:csca_sq_select)) if $imported["CSCA-SideQuests"] &&
  146.     CSCA::MENU::INCLUDE_SQ
  147.     @command_window.set_handler(:professions, method(:csca_prf_select)) if $imported["CSCA-Professions"] &&
  148.     CSCA::MENU::INCLUDE_PRF
  149.     @command_window.set_handler(:quests, method(:csca_qsys_select)) if $imported["CSCA-QuestSystem"] &&
  150.     CSCA::MENU::INCLUDE_QSY
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # Processing when Encyclopedia is selected
  154.   #--------------------------------------------------------------------------
  155.   def csca_encyclopedia_select
  156.     SceneManager.call(Scene_CSCA_Encyclopedia)
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # Processing when Dungeon Tools is selected
  160.   #--------------------------------------------------------------------------
  161.   def csca_dt_select
  162.     SceneManager.call(CSCA_Scene_DungeonToolSelect)
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # Processing when Treasure Maps is selected
  166.   #--------------------------------------------------------------------------
  167.   def csca_tmap_select
  168.     SceneManager.call(Scene_CSCA_TreasureMaps)
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # Processing when Debug is selected
  172.   #--------------------------------------------------------------------------
  173.   def csca_debug_select
  174.     SceneManager.call(Scene_Debug)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # Processing when Achievements is selected
  178.   #--------------------------------------------------------------------------
  179.   def csca_ach_select
  180.     SceneManager.call(CSCA_Scene_Achievements)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # Processing when Side Quests is selected
  184.   #--------------------------------------------------------------------------
  185.   def csca_sq_select
  186.     SceneManager.call(CSCA_Scene_SidequestMenu)
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # Processing when Professions is selected
  190.   #--------------------------------------------------------------------------
  191.   def csca_prf_select
  192.     SceneManager.call(CSCA_Scene_Professions)
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # Processing when Quest System is selected
  196.   #--------------------------------------------------------------------------
  197.   def csca_qsys_select
  198.     SceneManager.call(CSCA_Scene_Quest)
  199.   end
  200. end
  201. #==============================================================================
  202. # ** Window_MenuCommand
  203. #------------------------------------------------------------------------------
  204. # Displays commands for CSCA Scripts.
  205. #==============================================================================
  206. class Window_MenuCommand < Window_Command
  207.   #--------------------------------------------------------------------------
  208.   # Alias Method; make command list
  209.   #--------------------------------------------------------------------------
  210.   alias :csca_make_command_list :make_command_list
  211.   def make_command_list
  212.     if CSCA::MENU::MAIN_COMMANDS && CSCA::MENU::FORMATION_COMMAND &&
  213.       CSCA::MENU::ORIGINAL_COMMANDS && CSCA::MENU::SAVE_COMMAND &&
  214.       CSCA::MENU::END_COMMAND
  215.       csca_make_command_list
  216.     else
  217.       add_main_commands if CSCA::MENU::MAIN_COMMANDS
  218.       add_formation_command if CSCA::MENU::FORMATION_COMMAND
  219.       add_original_commands if CSCA::MENU::ORIGINAL_COMMANDS
  220.       add_save_command if CSCA::MENU::SAVE_COMMAND
  221.       add_game_end_command if CSCA::MENU::END_COMMAND
  222.     end
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # Alias Method; add main commands
  226.   #--------------------------------------------------------------------------
  227.   alias :csca_main_commands :add_main_commands
  228.   def add_main_commands
  229.     if CSCA::MENU::ITEM_ENABLED && CSCA::MENU::SKILL_ENABLED && CSCA::MENU::EQUIP_ENABLED &&
  230.       CSCA::MENU::STATUS_ENABLED
  231.       csca_main_commands
  232.     else
  233.       add_command(Vocab::item,   :item,   main_commands_enabled) if CSCA::MENU::ITEM_ENABLED
  234.       add_command(Vocab::skill,  :skill,  main_commands_enabled) if CSCA::MENU::SKILL_ENABLED
  235.       add_command(Vocab::equip,  :equip,  main_commands_enabled) if CSCA::MENU::EQUIP_ENABLED
  236.       add_command(Vocab::status, :status, main_commands_enabled) if CSCA::MENU::STATUS_ENABLED
  237.     end
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # Alias Method; add original commands
  241.   #--------------------------------------------------------------------------
  242.   alias :csca_commands :add_original_commands
  243.   def add_original_commands
  244.     add_command(CSCA::MENU::ENCYCLOPEDIA, :encyclopedia) if $imported["CSCA-Encyclopedia"] &&
  245.       CSCA::MENU::INCLUDE_ENC && csca_check_switch(CSCA::MENU::ENC_SWITCH)
  246.     add_command(CSCA::MENU::DUNGEON_TOOLS, :dungeontools, csca_dt_enabled) if $imported["CSCA-DungeonTools"] &&
  247.       CSCA::MENU::INCLUDE_DUN && csca_check_switch(CSCA::MENU::DT_SWITCH)
  248.     add_command(CSCA::MENU::TREASURE_MAPS, :treasuremaps) if $imported["CSCA-TreasureMaps"] &&
  249.       CSCA::MENU::INCLUDE_MAP && csca_check_switch(CSCA::MENU::MAP_SWITCH)
  250.     add_command(CSCA::MENU::ACHIEVEMENTS, :achievements) if $imported["CSCA-Achievements"] &&
  251.       CSCA::MENU::INCLUDE_ACH && csca_check_switch(CSCA::MENU::ACH_SWITCH)
  252.     add_command(CSCA::MENU::SIDEQUESTS, :sidequests) if $imported["CSCA-SideQuests"] &&
  253.       CSCA::MENU::INCLUDE_SQ && csca_check_switch(CSCA::MENU::SQ_SWITCH)
  254.     add_command(CSCA::MENU::PROFESSIONS, :professions) if $imported["CSCA-Professions"] &&
  255.       CSCA::MENU::INCLUDE_PRF && csca_check_switch(CSCA::MENU::PRF_SWITCH)
  256.     add_command(CSCA::MENU::QUESTS, :quests) if $imported["CSCA-QuestSystem"] &&
  257.       CSCA::MENU::INCLUDE_QSY && csca_check_switch(CSCA::MENU::QSY_SWITCH)
  258.     csca_commands
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # Alias Method; visible line number
  262.   #--------------------------------------------------------------------------
  263.   alias :csca_line_number :visible_line_number
  264.   def visible_line_number
  265.     if CSCA::MENU::LINES > 0
  266.       CSCA::MENU::LINES
  267.     else
  268.       csca_line_number
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # Check if command's switch is on (or 0)
  273.   #--------------------------------------------------------------------------
  274.   def csca_check_switch(switch_id)
  275.     switch_id == 0 ? true : $game_switches[switch_id]
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # check if Dungeon Tools are enabled
  279.   #--------------------------------------------------------------------------
  280.   def csca_dt_enabled
  281.     $game_switches[CSCA_DUNGEON_TOOLS::ON_OFF] && csca_check_tools
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # Check if player has at least one Dungeon Tool
  285.   #--------------------------------------------------------------------------
  286.   def csca_check_tools
  287.     return $game_switches[CSCA_DUNGEON_TOOLS::ARROW] ||
  288.     $game_switches[CSCA_DUNGEON_TOOLS::BOMB] ||
  289.     $game_switches[CSCA_DUNGEON_TOOLS::HOOKSHOT] ||
  290.     $game_switches[CSCA_DUNGEON_TOOLS::BOOMERANG] ||
  291.     $game_switches[CSCA_DUNGEON_TOOLS::RESET]
  292.   end
  293. end
Advertisement
Add Comment
Please, Sign In to add comment