MAMC_CONFIG.merge!({
:menu_hidden => "???",
:menu_switch => 11
})
class Window_MenuCommand
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Insert Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maic_insert_command(symbol)
command = MA_COMMAND_INSERTS[symbol]
# Get the command name
name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
# Check whether enabled
enabled = case command.enable
when Integer then command.enable == 0 ? true : $game_switches[command.enable]
when String then eval(command.enable)
when Symbol then self.send(command.enable)
else
enabled = true
end
# Add the command to the list
if $game_switches[MAMC_CONFIG[:menu_switch]] == false
add_command(MAMC_CONFIG[:menu_hidden], nil, false)
else
add_command(name, symbol, enabled)
end
added = @list.pop
@list.insert([command.index, @list.size].min, added) # Insert at specific index
end
end
class Scene_Menu
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Inserted Handler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maic_set_insert_handler(symbol)
other = MA_COMMAND_INSERTS[symbol].other
handler = case other
when Symbol then method(other)
when String then lambda { eval(other) }
when TrueClass then method(:command_personal)
else
if $game_switches[MAMC_CONFIG[:menu_switch]] == false
handler = nil
symbol = nil
else
handler = method(:maic_command_insert)
end
end
@command_window.set_handler(symbol, handler)
end
end