mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Updated console message code to Luka's latest version
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# To use the console, use the executable explicitly built
|
# To use the console, use the executable explicitly built with the console
|
||||||
# with the console enabled on Windows. On Linux and macOS,
|
# enabled on Windows. On Linux and macOS, just launch the executable directly
|
||||||
# just launch the executable directly from a terminal.
|
# from a terminal.
|
||||||
module Console
|
module Console
|
||||||
def self.setup_console
|
def self.setup_console
|
||||||
return unless $DEBUG
|
return unless $DEBUG
|
||||||
@@ -51,147 +51,169 @@ Console.setup_console
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Console message formatting
|
# Console message formatting
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
module ConsoleRGB
|
module Console
|
||||||
# string colors
|
module_function
|
||||||
CMD_COLORS = {
|
|
||||||
default: '38', black: '30', red: '31', green: '32', brown: '33', blue: '34',
|
|
||||||
purple: '35', cyan: '36', gray: '37',
|
|
||||||
dark_gray: '1;30', light_red: '1;31', light_green: '1;32', yellow: '1;33',
|
|
||||||
light_blue: '1;34', light_purple: '1;35', light_cyan: '1;36', white: '1;37'
|
|
||||||
}
|
|
||||||
# background colors
|
|
||||||
CMD_BG_COLORS = {
|
|
||||||
default: '0', black: '40', red: '41', green: '42', brown: '43', blue: '44',
|
|
||||||
purple: '45', cyan: '46', gray: '47',
|
|
||||||
dark_gray: '100', light_red: '101', light_green: '102', yellow: '103',
|
|
||||||
light_blue: '104', light_purple: '105', light_cyan: '106', white: '107'
|
|
||||||
}
|
|
||||||
# font options
|
|
||||||
CMD_FONT_OPTIONS = {
|
|
||||||
bold: '1', dim: '2', italic: '3', underline: '4', reverse: '7', hidden: '8'
|
|
||||||
}
|
|
||||||
# syntax highlighting based on markup
|
|
||||||
CMD_SYNTAX_COLOR = {
|
|
||||||
'`' => :cyan, '"' => :purple, "'" => :purple, '$' => :green, '~' => :red
|
|
||||||
}
|
|
||||||
# syntax options based on markup
|
|
||||||
CMD_SYNTAX_OPTIONS = {
|
|
||||||
'*' => :bold, '|' => :italic, '__' => :underline
|
|
||||||
}
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# apply console coloring
|
# echo string into console (example shorthand for common options)
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
def self.colors(string, text: :default, bg: :default, **options)
|
|
||||||
# get colors
|
|
||||||
code_text = CMD_COLORS[text]
|
|
||||||
code_bg = CMD_BG_COLORS[bg]
|
|
||||||
# get options
|
|
||||||
option_pool = options.select { |key, val| CMD_FONT_OPTIONS.key?(key) && val }
|
|
||||||
font_options = option_pool.keys.map { |opt| CMD_FONT_OPTIONS[opt] }.join(';').squeeze
|
|
||||||
# return formatted string
|
|
||||||
return "\e[#{code_bg};#{font_options};#{code_text}m#{string}\e[0m".squeeze(';')
|
|
||||||
end
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# character markup to color mapping for console
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# component level
|
|
||||||
def self.markup_component(string, options = {})
|
|
||||||
# syntax markup format options
|
|
||||||
[CMD_SYNTAX_COLOR, CMD_SYNTAX_OPTIONS].each_with_index do |hash, i|
|
|
||||||
hash.each do |key, value|
|
|
||||||
l = key.length
|
|
||||||
# ensure escape
|
|
||||||
key = key.chars.map { |c| "\\#{c}" }.join
|
|
||||||
# define regex
|
|
||||||
regex = "#{key}.*?#{key}"
|
|
||||||
# match markup
|
|
||||||
string.scan(/#{regex}/).each do |cpt|
|
|
||||||
options[i == 0 ? :text : value] = i == 0 ? value : true
|
|
||||||
options, string = self.markup_component(cpt[l...-l], options)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return options, string
|
|
||||||
end
|
|
||||||
|
|
||||||
# full string
|
|
||||||
def self.markup(string)
|
|
||||||
final_options = {}
|
|
||||||
(CMD_SYNTAX_COLOR.merge(CMD_SYNTAX_OPTIONS)).each_key do |key|
|
|
||||||
# ensure escape
|
|
||||||
key = key.chars.map { |c| "\\#{c}" }.join
|
|
||||||
# define regex
|
|
||||||
regex = "#{key}.*?#{key}"
|
|
||||||
string.scan(/#{regex}/).each do |cpt|
|
|
||||||
options, clean = self.markup_component(cpt)
|
|
||||||
if final_options[clean]
|
|
||||||
final_options[clean].deep_merge!(options)
|
|
||||||
else
|
|
||||||
final_options[clean] = options.clone
|
|
||||||
end
|
|
||||||
string.gsub!(cpt, clean)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# iterate through final options and apply them
|
|
||||||
final_options.each do |key, opt|
|
|
||||||
string.gsub!(key, self.colors(key, **opt))
|
|
||||||
end
|
|
||||||
return string
|
|
||||||
end
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# echo string into console (example short hand for common options)
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# heading 1
|
# heading 1
|
||||||
def self.echo_h1(msg)
|
def echo_h1(msg)
|
||||||
echoln ConsoleRGB.colors("*** #{msg} ***\r\n", text: :brown)
|
echoln markup_style("*** #{msg} ***", text: :brown)
|
||||||
|
echoln ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# heading 2
|
# heading 2
|
||||||
def self.echo_h2(msg, **options)
|
def echo_h2(msg, **options)
|
||||||
echoln ConsoleRGB.colors("#{msg}\r\n", **options)
|
echoln markup_style(msg, **options)
|
||||||
|
echoln ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# heading 3
|
# heading 3
|
||||||
def self.echo_h3(msg)
|
def echo_h3(msg)
|
||||||
echoln ConsoleRGB.markup("#{msg}\r\n")
|
echoln markup(msg)
|
||||||
|
echoln ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# list item
|
# list item
|
||||||
def self.echo_li(msg)
|
def echo_li(msg, pad = 0, color = :brown)
|
||||||
echo ConsoleRGB.colors(" -> ", text: :brown)
|
echo markup_style(' -> ', text: color)
|
||||||
echo ConsoleRGB.markup(msg)
|
pad = (pad - msg.length) > 0 ? '.' * (pad - msg.length) : ''
|
||||||
|
echo markup(msg + pad)
|
||||||
end
|
end
|
||||||
|
|
||||||
# list item (ends the line)
|
# list item with line break after
|
||||||
def self.echoln_li(msg)
|
def echoln_li(msg, pad = 0, color = :brown)
|
||||||
self.echo_li(msg + "\r\n")
|
self.echo_li(msg, pad, color)
|
||||||
|
echoln ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# paragraph with markup
|
# paragraph with markup
|
||||||
def self.echo_p(msg)
|
def echo_p(msg)
|
||||||
echoln ConsoleRGB.markup(msg)
|
echoln markup(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
# warning message
|
# warning message
|
||||||
def self.echo_warn(msg)
|
def echo_warn(msg)
|
||||||
echoln ConsoleRGB.colors("WARNING: " + msg, text: :yellow)
|
echoln markup_style("WARNING: #{msg}", text: :yellow)
|
||||||
end
|
end
|
||||||
|
|
||||||
# error message
|
# error message
|
||||||
def self.echo_error(msg)
|
def echo_error(msg)
|
||||||
echoln ConsoleRGB.colors("ERROR: " + msg, text: :light_red)
|
echoln markup_style("ERROR: #{msg}", text: :light_red)
|
||||||
end
|
end
|
||||||
|
|
||||||
# status output
|
# status output
|
||||||
def self.echo_status(status)
|
def echo_status(status)
|
||||||
echoln status ? ConsoleRGB.colors('OK', text: :green) : ConsoleRGB.colors('FAIL', text: :red)
|
echoln (status) ? markup_style('OK', text: :green) : markup_style('FAIL', text: :red)
|
||||||
end
|
end
|
||||||
|
|
||||||
# completion output
|
# completion output
|
||||||
def self.echo_complete(status)
|
def echo_done(status)
|
||||||
echoln status ? ConsoleRGB.colors('done', text: :green) : ConsoleRGB.colors('error', text: :red)
|
echoln (status) ? markup_style('done', text: :green) : markup_style('error', text: :red)
|
||||||
|
end
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Markup options
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
def string_colors
|
||||||
|
{
|
||||||
|
default: '38', black: '30', red: '31', green: '32', brown: '33',
|
||||||
|
blue: '34', purple: '35', cyan: '36', gray: '37',
|
||||||
|
dark_gray: '1;30', light_red: '1;31', light_green: '1;32', yellow: '1;33',
|
||||||
|
light_blue: '1;34', light_purple: '1;35', light_cyan: '1;36', white: '1;37'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def background_colors
|
||||||
|
{
|
||||||
|
default: '0', black: '40', red: '41', green: '42', brown: '43',
|
||||||
|
blue: '44', purple: '45', cyan: '46', gray: '47',
|
||||||
|
dark_gray: '100', light_red: '101', light_green: '102', yellow: '103',
|
||||||
|
light_blue: '104', light_purple: '105', light_cyan: '106', white: '107'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def font_options
|
||||||
|
{
|
||||||
|
bold: '1', dim: '2', italic: '3', underline: '4', reverse: '7',
|
||||||
|
hidden: '8'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Text markup that turns text between them a certain color
|
||||||
|
def markup_colors
|
||||||
|
{
|
||||||
|
'`' => :cyan, '"' => :purple, "'" => :purple, '$' => :green, '~' => :red
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def markup_options
|
||||||
|
{
|
||||||
|
'__' => :underline, '*' => :bold, '|' => :italic
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# apply console coloring
|
||||||
|
def markup_style(string, text: :default, bg: :default, **options)
|
||||||
|
# get colors
|
||||||
|
code_text = string_colors[text]
|
||||||
|
code_bg = background_colors[bg]
|
||||||
|
# get options
|
||||||
|
options_pool = options.select { |key, val| font_options.key?(key) && val }
|
||||||
|
markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(';').squeeze
|
||||||
|
# return formatted string
|
||||||
|
"\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(';')
|
||||||
|
end
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Perform markup on text
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def markup_all_options
|
||||||
|
@markup_all_options ||= markup_colors.merge(markup_options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def markup_component(string, component, key, options)
|
||||||
|
# trim inner markup content
|
||||||
|
l = key.length
|
||||||
|
trimmed = component[l...-l]
|
||||||
|
# merge markup options
|
||||||
|
options[trimmed] = {} unless options[trimmed]
|
||||||
|
options[trimmed].deep_merge!({}.tap do |new_opt|
|
||||||
|
new_opt[:text] = markup_colors[key] if markup_colors.key?(key)
|
||||||
|
new_opt[markup_options[key]] = true if markup_options.key?(key)
|
||||||
|
end)
|
||||||
|
# remove markup from input string
|
||||||
|
string.gsub!(component, trimmed)
|
||||||
|
# return output
|
||||||
|
return string, options
|
||||||
|
end
|
||||||
|
|
||||||
|
def markup_breakdown(string, options = {})
|
||||||
|
# iterate through all options
|
||||||
|
markup_all_options.each_key do |key|
|
||||||
|
# ensure escape
|
||||||
|
key_char = key.chars.map { |c| "\\#{c}" }.join
|
||||||
|
# define regex
|
||||||
|
regex = "#{key_char}.*?#{key_char}"
|
||||||
|
# go through matches
|
||||||
|
string.scan(/#{regex}/).each do |component|
|
||||||
|
return *markup_breakdown(*markup_component(string, component, key, options))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# return output
|
||||||
|
return string, options
|
||||||
|
end
|
||||||
|
|
||||||
|
def markup(string)
|
||||||
|
# get a breakdown of all markup options
|
||||||
|
string, options = markup_breakdown(string)
|
||||||
|
# iterate through each option and apply
|
||||||
|
options.each do |key, opt|
|
||||||
|
string.gsub!(key, markup_style(key, **opt))
|
||||||
|
end
|
||||||
|
# return string
|
||||||
|
return string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module Deprecation
|
|||||||
unless alternative.nil?
|
unless alternative.nil?
|
||||||
text += "\r\n" + _INTL("Use \"{1}\" instead.", alternative)
|
text += "\r\n" + _INTL("Use \"{1}\" instead.", alternative)
|
||||||
end
|
end
|
||||||
ConsoleRGB.echo_warn text
|
Console.echo_warn text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ module PluginManager
|
|||||||
def self.error(msg)
|
def self.error(msg)
|
||||||
Graphics.update
|
Graphics.update
|
||||||
t = Thread.new do
|
t = Thread.new do
|
||||||
ConsoleRGB.echo_error "Plugin Error:\r\n#{msg}"
|
Console.echo_error "Plugin Error:\r\n#{msg}"
|
||||||
p "Plugin Error: #{msg}"
|
p "Plugin Error: #{msg}"
|
||||||
Thread.exit
|
Thread.exit
|
||||||
end
|
end
|
||||||
@@ -659,7 +659,7 @@ module PluginManager
|
|||||||
# Check if plugins need compiling
|
# Check if plugins need compiling
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def self.compilePlugins(order, plugins)
|
def self.compilePlugins(order, plugins)
|
||||||
ConsoleRGB.echo_li "Compiling plugin scripts..."
|
Console.echo_li "Compiling plugin scripts..."
|
||||||
scripts = []
|
scripts = []
|
||||||
# go through the entire order one by one
|
# go through the entire order one by one
|
||||||
for o in order
|
for o in order
|
||||||
@@ -681,13 +681,13 @@ module PluginManager
|
|||||||
File.open("Data/PluginScripts.rxdata", 'wb') { |f| Marshal.dump(scripts, f) }
|
File.open("Data/PluginScripts.rxdata", 'wb') { |f| Marshal.dump(scripts, f) }
|
||||||
# collect garbage
|
# collect garbage
|
||||||
GC.start
|
GC.start
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
end
|
end
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Check if plugins need compiling
|
# Check if plugins need compiling
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def self.runPlugins
|
def self.runPlugins
|
||||||
ConsoleRGB.echo_h1 "Checking plugins"
|
Console.echo_h1 "Checking plugins"
|
||||||
# get the order of plugins to interpret
|
# get the order of plugins to interpret
|
||||||
order, plugins = self.getPluginOrder
|
order, plugins = self.getPluginOrder
|
||||||
# compile if necessary
|
# compile if necessary
|
||||||
@@ -699,7 +699,7 @@ module PluginManager
|
|||||||
# get the required data
|
# get the required data
|
||||||
name, meta, script = plugin
|
name, meta, script = plugin
|
||||||
if !meta[:essentials] || !meta[:essentials].include?(Essentials::VERSION)
|
if !meta[:essentials] || !meta[:essentials].include?(Essentials::VERSION)
|
||||||
ConsoleRGB.echo_warn "Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway."
|
Console.echo_warn "Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway."
|
||||||
end
|
end
|
||||||
# register plugin
|
# register plugin
|
||||||
self.register(meta)
|
self.register(meta)
|
||||||
@@ -715,7 +715,7 @@ module PluginManager
|
|||||||
# try to run the code
|
# try to run the code
|
||||||
begin
|
begin
|
||||||
eval(code, TOPLEVEL_BINDING, fname)
|
eval(code, TOPLEVEL_BINDING, fname)
|
||||||
ConsoleRGB.echoln_li "Loaded plugin: '#{name}'" if !echoed_plugins.include?(name)
|
Console.echoln_li "Loaded plugin: '#{name}'" if !echoed_plugins.include?(name)
|
||||||
echoed_plugins.push(name)
|
echoed_plugins.push(name)
|
||||||
rescue Exception # format error message to display
|
rescue Exception # format error message to display
|
||||||
self.pluginErrorMsg(name, sname)
|
self.pluginErrorMsg(name, sname)
|
||||||
@@ -725,9 +725,9 @@ module PluginManager
|
|||||||
end
|
end
|
||||||
if scripts.length > 0
|
if scripts.length > 0
|
||||||
echoln ""
|
echoln ""
|
||||||
ConsoleRGB.echo_h2("Successfully loaded #{scripts.length} plugin(s)", text: :green)
|
Console.echo_h2("Successfully loaded #{scripts.length} plugin(s)", text: :green)
|
||||||
else
|
else
|
||||||
ConsoleRGB.echo_h2("No plugins found", text: :green)
|
Console.echo_h2("No plugins found", text: :green)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -195,14 +195,14 @@ module SaveData
|
|||||||
conversions_to_run = self.get_conversions(save_data)
|
conversions_to_run = self.get_conversions(save_data)
|
||||||
return false if conversions_to_run.none?
|
return false if conversions_to_run.none?
|
||||||
File.open(SaveData::FILE_PATH + '.bak', 'wb') { |f| Marshal.dump(save_data, f) }
|
File.open(SaveData::FILE_PATH + '.bak', 'wb') { |f| Marshal.dump(save_data, f) }
|
||||||
ConsoleRGB.echo_h1 "Running #{conversions_to_run.length} save file conversions"
|
Console.echo_h1 "Running #{conversions_to_run.length} save file conversions"
|
||||||
conversions_to_run.each do |conversion|
|
conversions_to_run.each do |conversion|
|
||||||
ConsoleRGB.echo_li "#{conversion.title}..."
|
Console.echo_li "#{conversion.title}..."
|
||||||
conversion.run(save_data)
|
conversion.run(save_data)
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
end
|
end
|
||||||
echoln "" if conversions_to_run.length > 0
|
echoln "" if conversions_to_run.length > 0
|
||||||
ConsoleRGB.echo_h2("All save file conversions applied successfully", text: :green)
|
Console.echo_h2("All save file conversions applied successfully", text: :green)
|
||||||
save_data[:essentials_version] = Essentials::VERSION
|
save_data[:essentials_version] = Essentials::VERSION
|
||||||
save_data[:game_version] = Settings::GAME_VERSION
|
save_data[:game_version] = Settings::GAME_VERSION
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -677,7 +677,7 @@ def pbDebugFixInvalidTiles
|
|||||||
t = Time.now.to_i
|
t = Time.now.to_i
|
||||||
Graphics.update
|
Graphics.update
|
||||||
total_maps = mapData.mapinfos.keys.length
|
total_maps = mapData.mapinfos.keys.length
|
||||||
ConsoleRGB.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps)
|
Console.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps)
|
||||||
for id in mapData.mapinfos.keys.sort
|
for id in mapData.mapinfos.keys.sort
|
||||||
if Time.now.to_i - t >= 5
|
if Time.now.to_i - t >= 5
|
||||||
Graphics.update
|
Graphics.update
|
||||||
@@ -710,18 +710,18 @@ def pbDebugFixInvalidTiles
|
|||||||
end
|
end
|
||||||
next if map_errors == 0
|
next if map_errors == 0
|
||||||
# Map was changed; save it
|
# Map was changed; save it
|
||||||
ConsoleRGB.echoln_li _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name)
|
Console.echoln_li _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name)
|
||||||
total_errors += map_errors
|
total_errors += map_errors
|
||||||
num_error_maps += 1
|
num_error_maps += 1
|
||||||
mapData.saveMap(id)
|
mapData.saveMap(id)
|
||||||
end
|
end
|
||||||
if num_error_maps == 0
|
if num_error_maps == 0
|
||||||
ConsoleRGB.echo_h2(_INTL("Done. No errors found."), text: :green)
|
Console.echo_h2(_INTL("Done. No errors found."), text: :green)
|
||||||
pbMessage(_INTL("No invalid tiles were found."))
|
pbMessage(_INTL("No invalid tiles were found."))
|
||||||
else
|
else
|
||||||
echoln ""
|
echoln ""
|
||||||
ConsoleRGB.echo_h2(_INTL("Done. {1} errors found and fixed.", total_errors), text: :green)
|
Console.echo_h2(_INTL("Done. {1} errors found and fixed.", total_errors), text: :green)
|
||||||
ConsoleRGB.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
||||||
echoln ""
|
echoln ""
|
||||||
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps))
|
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps))
|
||||||
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
||||||
|
|||||||
@@ -701,23 +701,23 @@ module Compiler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def compile_pbs_file_message_start(filename)
|
def compile_pbs_file_message_start(filename)
|
||||||
# The `` around the file's name turns it cyan
|
# The `` around the file's name turns it cyan
|
||||||
ConsoleRGB.echo_li _INTL("Compiling PBS file `{1}`...", filename.split("/").last)
|
Console.echo_li _INTL("Compiling PBS file `{1}`...", filename.split("/").last)
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_pbs_file_message_start(filename)
|
def write_pbs_file_message_start(filename)
|
||||||
# The `` around the file's name turns it cyan
|
# The `` around the file's name turns it cyan
|
||||||
ConsoleRGB.echo_li _INTL("Writing PBS file `{1}`...", filename.split("/").last)
|
Console.echo_li _INTL("Writing PBS file `{1}`...", filename.split("/").last)
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_pbs_file_message_end
|
def process_pbs_file_message_end
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
Graphics.update
|
Graphics.update
|
||||||
end
|
end
|
||||||
|
|
||||||
def compile_all(mustCompile)
|
def compile_all(mustCompile)
|
||||||
return if !mustCompile
|
return if !mustCompile
|
||||||
FileLineData.clear
|
FileLineData.clear
|
||||||
ConsoleRGB.echo_h1 _INTL("Starting full compile")
|
Console.echo_h1 _INTL("Starting full compile")
|
||||||
compile_town_map # No dependencies
|
compile_town_map # No dependencies
|
||||||
compile_connections # No dependencies
|
compile_connections # No dependencies
|
||||||
compile_phone # No dependencies
|
compile_phone # No dependencies
|
||||||
@@ -740,16 +740,16 @@ module Compiler
|
|||||||
compile_map_metadata # No dependencies
|
compile_map_metadata # No dependencies
|
||||||
compile_animations
|
compile_animations
|
||||||
compile_trainer_events(mustCompile)
|
compile_trainer_events(mustCompile)
|
||||||
ConsoleRGB.echo_li _INTL("Saving messages...")
|
Console.echo_li _INTL("Saving messages...")
|
||||||
pbSetTextMessages
|
pbSetTextMessages
|
||||||
MessageTypes.saveMessages
|
MessageTypes.saveMessages
|
||||||
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
|
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
ConsoleRGB.echo_li _INTL("Reloading cache...")
|
Console.echo_li _INTL("Reloading cache...")
|
||||||
System.reload_cache
|
System.reload_cache
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
echoln ""
|
echoln ""
|
||||||
ConsoleRGB.echo_h2("Successfully fully compiled", text: :green)
|
Console.echo_h2("Successfully fully compiled", text: :green)
|
||||||
end
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
|
|||||||
@@ -1727,7 +1727,7 @@ module Compiler
|
|||||||
# Compile battle animations
|
# Compile battle animations
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def compile_animations
|
def compile_animations
|
||||||
ConsoleRGB.echo_li _INTL("Compiling animations...")
|
Console.echo_li _INTL("Compiling animations...")
|
||||||
begin
|
begin
|
||||||
pbanims = load_data("Data/PkmnAnimations.rxdata")
|
pbanims = load_data("Data/PkmnAnimations.rxdata")
|
||||||
rescue
|
rescue
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ module Compiler
|
|||||||
# Save all data to PBS files
|
# Save all data to PBS files
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def write_all
|
def write_all
|
||||||
ConsoleRGB.echo_h1 _INTL("Writing all PBS files")
|
Console.echo_h1 _INTL("Writing all PBS files")
|
||||||
write_town_map
|
write_town_map
|
||||||
write_connections
|
write_connections
|
||||||
write_phone
|
write_phone
|
||||||
@@ -911,6 +911,6 @@ module Compiler
|
|||||||
write_metadata
|
write_metadata
|
||||||
write_map_metadata
|
write_map_metadata
|
||||||
echoln ""
|
echoln ""
|
||||||
ConsoleRGB.echo_h2("Successfully rewrote all PBS files", text: :green)
|
Console.echo_h2("Successfully rewrote all PBS files", text: :green)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1445,7 +1445,7 @@ module Compiler
|
|||||||
Graphics.update
|
Graphics.update
|
||||||
trainerChecker = TrainerChecker.new
|
trainerChecker = TrainerChecker.new
|
||||||
change_record = []
|
change_record = []
|
||||||
ConsoleRGB.echo_li _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
|
Console.echo_li _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
|
||||||
idx = 0
|
idx = 0
|
||||||
for id in mapData.mapinfos.keys.sort
|
for id in mapData.mapinfos.keys.sort
|
||||||
echo "." if idx % 20 == 0
|
echo "." if idx % 20 == 0
|
||||||
@@ -1488,12 +1488,12 @@ module Compiler
|
|||||||
change_record.push(_INTL("Map {1}: '{2}' was modified and saved.", id, mapData.mapinfos[id].name))
|
change_record.push(_INTL("Map {1}: '{2}' was modified and saved.", id, mapData.mapinfos[id].name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
change_record.each { |msg| ConsoleRGB.echo_warn msg }
|
change_record.each { |msg| Console.echo_warn msg }
|
||||||
changed = false
|
changed = false
|
||||||
Graphics.update
|
Graphics.update
|
||||||
commonEvents = load_data("Data/CommonEvents.rxdata")
|
commonEvents = load_data("Data/CommonEvents.rxdata")
|
||||||
ConsoleRGB.echo_li _INTL("Processing common events...")
|
Console.echo_li _INTL("Processing common events...")
|
||||||
for key in 0...commonEvents.length
|
for key in 0...commonEvents.length
|
||||||
newevent = fix_event_use(commonEvents[key],0,mapData)
|
newevent = fix_event_use(commonEvents[key],0,mapData)
|
||||||
if newevent
|
if newevent
|
||||||
@@ -1502,9 +1502,9 @@ module Compiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
save_data(commonEvents,"Data/CommonEvents.rxdata") if changed
|
save_data(commonEvents,"Data/CommonEvents.rxdata") if changed
|
||||||
ConsoleRGB.echo_complete(true)
|
Console.echo_done(true)
|
||||||
if change_record.length > 0 || changed
|
if change_record.length > 0 || changed
|
||||||
ConsoleRGB.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user