mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-11-03 00:06:01 +00:00
Update 6.8
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
module Encryption
|
||||
ENCRYPTION_KEY = [0x4A, 0x8F, 0x2C, 0xE1, 0x73, 0xB5, 0x96, 0x0D,
|
||||
0x5E, 0xA2, 0x3F, 0xC7, 0x81, 0x14, 0x6B, 0xD9]
|
||||
|
||||
def self.xor(data)
|
||||
data.bytes.each_with_index.map { |b, i| b ^ ENCRYPTION_KEY[i % ENCRYPTION_KEY.length] }.pack("C*")
|
||||
end
|
||||
end
|
||||
@@ -8,7 +8,7 @@ module Deprecation
|
||||
# @param removal_version [String] version the method is removed in
|
||||
# @param alternative [String] preferred alternative method
|
||||
def warn_method(method_name, removal_version = nil, alternative = nil)
|
||||
text = _INTL('WARN: usage of deprecated method "{1}" or its alias.', method_name)
|
||||
text = _INTL("WARN: usage of deprecated method '{1}' or its alias.", method_name)
|
||||
unless removal_version.nil?
|
||||
text += _INTL("\nThe method is slated to be"\
|
||||
" removed in Essentials {1}.", removal_version)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
KNOWN_BITMAP_EXTENSIONS = /\.(bmp|png|gif|jpg|jpeg|dat)$/
|
||||
|
||||
#===============================================================================
|
||||
# Reads files of certain format from a directory
|
||||
#===============================================================================
|
||||
@@ -118,22 +120,18 @@ end
|
||||
# archives. Returns nil if the path can't be found.
|
||||
def pbResolveBitmap(x)
|
||||
return nil if !x
|
||||
noext = x.gsub(/\.(bmp|png|gif|jpg|jpeg)$/,"")
|
||||
noext = x.gsub(KNOWN_BITMAP_EXTENSIONS,"")
|
||||
noext = pbLocalizedBitmapFilename(noext)
|
||||
filename = nil
|
||||
# RTP.eachPathFor(x) { |path|
|
||||
# filename = pbTryString(path) if !filename
|
||||
# filename = pbTryString(path+".gif") if !filename
|
||||
# }
|
||||
RTP.eachPathFor(noext) { |path|
|
||||
filename = pbTryString(path+".png") if !filename
|
||||
filename = pbTryString(path+".gif") if !filename
|
||||
# filename = pbTryString(path+".jpg") if !filename
|
||||
# filename = pbTryString(path+".jpeg") if !filename
|
||||
# filename = pbTryString(path+".bmp") if !filename
|
||||
filename = pbTryString(path+".dat") if !filename
|
||||
}
|
||||
return filename
|
||||
end
|
||||
|
||||
|
||||
# Finds the real path for an image file. This includes paths in encrypted
|
||||
# archives. Returns _x_ if the path can't be found.
|
||||
def pbBitmapName(x)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
def pbAddScriptTexts(items, script)
|
||||
script.force_encoding(Encoding::UTF_8)
|
||||
script.scan(/(?:_I)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) do |s|
|
||||
script.scan(/(?:_I|sign)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) do |s|
|
||||
string = s[0]
|
||||
string.gsub!(/\\\"/, "\"")
|
||||
string.gsub!(/\\\\/, "\\")
|
||||
@@ -35,17 +35,13 @@ def pbSetTextMessages
|
||||
scr = Zlib::Inflate.inflate(script[2])
|
||||
pbAddRgssScriptTexts(texts, scr)
|
||||
end
|
||||
# If Scripts.rxdata only has 1 section, scripts have been extracted. Get
|
||||
# script texts from .rb files in Data/Scripts
|
||||
if $RGSS_SCRIPTS.length == 1
|
||||
Dir.all("Data/Scripts").each do |script_file|
|
||||
if System.uptime - t >= 5
|
||||
t += 5
|
||||
Graphics.update
|
||||
end
|
||||
File.open(script_file, "rb") do |f|
|
||||
pbAddRgssScriptTexts(texts, f.read)
|
||||
end
|
||||
Dir.all("Data/Scripts").each do |script_file|
|
||||
if System.uptime - t >= 5
|
||||
t += 5
|
||||
Graphics.update
|
||||
end
|
||||
File.open(script_file, "rb") do |f|
|
||||
pbAddRgssScriptTexts(texts, f.read)
|
||||
end
|
||||
end
|
||||
# Must add messages because this code is used by both game system and Editor
|
||||
@@ -194,11 +190,76 @@ def pbSetTextMessages
|
||||
Graphics.update
|
||||
end
|
||||
end
|
||||
pbAddTrainerTextMessages
|
||||
pbAddOutfitTextMessages
|
||||
rescue Hangup
|
||||
end
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
|
||||
def pbAddTrainerTextMessages
|
||||
names = []
|
||||
loseTexts = []
|
||||
speeches = []
|
||||
infoTexts = []
|
||||
GameData::Trainer.each do |trainer|
|
||||
names.push(trainer.real_name)
|
||||
|
||||
loseTexts.push(trainer.real_lose_text)
|
||||
loseTexts.push(trainer.loseText_rematch) if trainer.loseText_rematch
|
||||
loseTexts.push(trainer.loseText_rematch_double) if trainer.loseText_rematch_double
|
||||
|
||||
speeches.push(trainer.battleText) if trainer.battleText
|
||||
speeches.push(trainer.preRematchText) if trainer.preRematchText
|
||||
speeches.push(trainer.preRematchText_caught) if trainer.preRematchText_caught
|
||||
speeches.push(trainer.preRematchText_evolved) if trainer.preRematchText_evolved
|
||||
speeches.push(trainer.preRematchText_fused) if trainer.preRematchText_fused
|
||||
speeches.push(trainer.preRematchText_unfused) if trainer.preRematchText_unfused
|
||||
speeches.push(trainer.preRematchText_reversed) if trainer.preRematchText_reversed
|
||||
speeches.push(trainer.preRematchText_gift) if trainer.preRematchText_gift
|
||||
|
||||
infoTexts.push(trainer.infoText) if trainer.infoText
|
||||
end
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::TrainerNames, names)
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::TrainerLoseText, loseTexts)
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::BeginSpeech, speeches)
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::TrainerInfoText, infoTexts)
|
||||
end
|
||||
|
||||
def pbCollectOutfitTexts(obj, texts)
|
||||
case obj
|
||||
when Hash
|
||||
texts << obj["name"] if obj["name"].is_a?(String)
|
||||
texts << obj["description"] if obj["description"].is_a?(String)
|
||||
obj.each_value { |v| pbCollectOutfitTexts(v, texts) }
|
||||
when Array
|
||||
obj.each { |v| pbCollectOutfitTexts(v, texts) }
|
||||
end
|
||||
end
|
||||
|
||||
def pbAddOutfitTextMessages
|
||||
texts = []
|
||||
|
||||
files = [
|
||||
Settings::CLOTHES_DATA_PATH,
|
||||
Settings::HAIRSTYLE_DATA_PATH,
|
||||
Settings::HATS_DATA_PATH
|
||||
]
|
||||
|
||||
files.each do |file|
|
||||
json_data = File.read(file)
|
||||
data = HTTPLite::JSON.parse(json_data)
|
||||
|
||||
data.each do |entry|
|
||||
texts << entry["name"] if entry["name"]
|
||||
texts << entry["description"] if entry["description"]
|
||||
end
|
||||
end
|
||||
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::OutfitTexts, texts)
|
||||
end
|
||||
|
||||
def pbEachIntlSection(file)
|
||||
lineno = 1
|
||||
re = /^\s*\[\s*([^\]]+)\s*\]\s*$/
|
||||
@@ -533,12 +594,18 @@ class Messages
|
||||
|
||||
def saveMessages(filename = nil)
|
||||
filename = "Data/messages.dat" if !filename
|
||||
File.open(filename, "wb") { |f| Marshal.dump(@messages, f) }
|
||||
raw = Marshal.dump(@messages)
|
||||
File.open(filename, "wb") { |f| f.write(Encryption.xor(raw)) }
|
||||
end
|
||||
|
||||
def loadMessageFile(filename)
|
||||
begin
|
||||
pbRgssOpen(filename, "rb") { |f| @messages = Marshal.load(f) }
|
||||
raw = File.open(filename, "rb") { |f| f.read }
|
||||
begin
|
||||
@messages = Marshal.load(Encryption.xor(raw))
|
||||
rescue TypeError, ArgumentError
|
||||
@messages = Marshal.load(raw) # fallback for old unencrypted file
|
||||
end
|
||||
if !@messages.is_a?(Array)
|
||||
@messages = nil
|
||||
raise "Corrupted data"
|
||||
@@ -623,6 +690,8 @@ module MessageTypes
|
||||
ScriptTexts = 24
|
||||
RibbonNames = 25
|
||||
RibbonDescriptions = 26
|
||||
TrainerInfoText = 27
|
||||
OutfitTexts = 28
|
||||
@@messages = Messages.new
|
||||
@@messagesFallback = Messages.new("Data/messages.dat", true)
|
||||
|
||||
@@ -727,6 +796,10 @@ end
|
||||
|
||||
# Replaces first argument with a localized version and formats the other
|
||||
# parameters by replacing {1}, {2}, etc. with those placeholders.
|
||||
def _OUTFIT_INTL(str)
|
||||
return MessageTypes.getFromHash(MessageTypes::OutfitTexts, str)
|
||||
end
|
||||
|
||||
def _INTL(*arg)
|
||||
begin
|
||||
string = MessageTypes.getFromHash(MessageTypes::ScriptTexts, arg[0])
|
||||
|
||||
@@ -2,8 +2,8 @@ module Input
|
||||
USE = C
|
||||
BACK = B
|
||||
ACTION = A
|
||||
JUMPUP = X
|
||||
JUMPDOWN = Y
|
||||
JUMPUP = L
|
||||
JUMPDOWN = R
|
||||
SPECIAL = Z
|
||||
AUX1 = L
|
||||
AUX2 = R
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
# Name = Simple Extension #
|
||||
# Version = 1.0 #
|
||||
# Requires = Basic Plugin #
|
||||
# Requires = Useful Utilities,1.1 #
|
||||
# Requires = Useful 0_Utilities,1.1 #
|
||||
# Conflicts = Complex Extension #
|
||||
# Conflicts = Extended Windows #
|
||||
# Link = https://reliccastle.com/link-to-the-plugin/ #
|
||||
@@ -234,8 +234,7 @@ module PluginManager
|
||||
dep_version = dep[1]
|
||||
next if self.installed?(dep_name, dep_version)
|
||||
if self.installed?(dep_name) # Have plugin but lower version
|
||||
msg = "Plugin '#{name}' requires plugin '#{dep_name}' version #{dep_version} or higher, " +
|
||||
"but the installed version is #{self.version(dep_name)}."
|
||||
msg = _INTL("Plugin '{1}' requires plugin '{2}' version {3} or higher, but the installed version is {4}.", name, dep_name, dep_version, self.version(dep_name))
|
||||
if dep_link = self.link(dep_name)
|
||||
msg += "\r\nCheck #{dep_link} for an update to plugin '#{dep_name}'."
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user