Войти на сайт
×
ТЕМА: [ACE] Yami Patch system
[ACE] Yami Patch system 9 года 9 мес. назад #78329
|
Не могу понять, как пользоваться этим скриптом?
ВНИМАНИЕ: Спойлер! [ Нажмите, чтобы развернуть ][ Нажмите, чтобы скрыть ] #============================================================================== # # ¥ Yami Engine Ace - Patch System # -- Last Updated: 2012.03.17 # -- Level: Hard # -- Requires: Yami Engine Ace - Basic Module # #============================================================================== $imported = {} if $imported.nil? $imported["YSE-PatchSystem"] = true #============================================================================== # ¥ Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2012.03.17 - Released Full version. # 2012.03.04 - Released Open Beta version. # 2012.03.01 - Started Script. # #============================================================================== # ¥ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script will generate patch files for your game and make your game read # it to update things. # #============================================================================== # ¥ Instructions # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # To install this script, open up your script editor and copy/paste this script # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save. # # To open Patch Maker, use this custom script: (Use Script in Event) # # YSE.patch_start # # #============================================================================== # ¥ Compatibility # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that # it will run with RPG Maker VX without adjusting. # # Do not compress patch files in any methods. # #============================================================================== #============================================================================== # ¥ Configuration #============================================================================== module YSE module PATCH_SYSTEM #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Save Data Configuration - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SAVE_CONFIGURATION = { # Start here. :path => "Patches", :prefix_name => "Patch", } # Do not delete this. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Load Data Configuration - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LOAD_CONFIGURATION = { # Start here. :load_test => true, # Load Patches when Test. :quit_fake => true, # Quit Game when detected Fake Patches. } # Do not delete this. end end #============================================================================== # ¥ Editting anything past this point may potentially result in causing # computer damage, incontinence, explosion of user's head, coma, death, and/or # halitosis so edit at your own risk. #============================================================================== #============================================================================== # ¡ YSE - Patch Module #============================================================================== module YSE module PATCH_SYSTEM # # load_map_data # def self.load_map_data(map_id) result = load_data(sprintf("Data/Map%03d.rvdata2", map_id)) result end # # slice_data # def self.slice_data(data) # Preparing Output result = {} actors = {} classes = {} skills = {} items = {} weapons = {} armors = {} enemies = {} troops = {} states = {} animations = {} map_data = {} tileset = {} common_event = {} # Analyzing Data data.each { |key, value| case key when /(?:common_event)(\d+)?/i common_event[$1] = value when /(?:tileset)(\d+)?/i tileset[$1] = value when /(?:map)(\d+)/i map_data[$1] = value when /(?:map_info)/i map_data[:map_info] = value when /(?:actors)(\d+)/i actors[$1] = value when /(?:classes)(\d+)/i classes[$1] = value when /(?:skills)(\d+)/i skills[$1] = value when /(?:items)(\d+)/i items[$1] = value when /(?:weapons)(\d+)/i weapons[$1] = value when /(?:armors)(\d+)/i armors[$1] = value when /(?:enemies)(\d+)/i enemies[$1] = value when /(?:troops)(\d+)/i troops[$1] = value when /(?:states)(\d+)/i states[$1] = value when /(?:animations)(\d+)/i animations[$1] = value end } # Combining Data result[:common_event] = common_event result[:tileset] = tileset result[:map_data] = map_data result[:actors] = actors result[:classes] = classes result[:skills] = skills result[:items] = items result[:weapons] = weapons result[:armors] = armors result[:enemies] = enemies result[:troops] = troops result[:states] = states result[:animations] = animations result end end # PATCH_SYSTEM end # YSE #============================================================================== # ¡ DataManager #============================================================================== module DataManager # # alias method: load_normal_database # class<<self; alias datamanager_patch_yse_load_normal_database load_normal_database; end def self.load_normal_database datamanager_patch_yse_load_normal_database return unless YSE::PATCH_SYSTEM::LOAD_CONFIGURATION[:load_test] load_patch_database end # # new method: load_patch_database # def self.load_patch_database $data_maps_patch = {} # Load Directory dir = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:path] prefix = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:prefix_name] begin directory = Dir.open("./#{dir}") rescue Dir.mkdir("./#{dir}", 0777) directory = Dir.open("./#{dir}") end directory.each { |filename| if filename =~ /(?:#{prefix})(\d+)?(?:.*)/i YSE.load_data("./#{dir}/#{filename}", method(:extract_patch_data), 0, :mtime) end } end # # new method: extract_patch_data # def self.extract_patch_data(data, mtime) # Checking hash real_mtime = mtime.strftime("%s") real_hash = YSE.make_hash(real_mtime) if data["hash"].nil? || real_hash != data["hash"] msg = "System detected a fake patch. Filename: #{data["filename"]}.\n" msg += "Please delete that file or you will take your own risk.\n" msg += "Thank you." YSE.message_box("Fake Patch Detected!", msg) exit if YSE::PATCH_SYSTEM::LOAD_CONFIGURATION[:quit_fake] end # Slice Data temp = YSE::PATCH_SYSTEM.slice_data(data) common_event = temp[:common_event] tileset = temp[:tileset] map_data = temp[:map_data] actors = temp[:actors] classes = temp[:classes] skills = temp[:skills] items = temp[:items] weapons = temp[:weapons] armors = temp[:armors] enemies = temp[:enemies] troops = temp[:troops] states = temp[:states] animations = temp[:animations] # Common Events common_event.each { |key, value| next if value.nil? $data_common_events[key.to_i] = value } # Database tileset.each { |key, value| next if value.nil? $data_tilesets[key.to_i] = value } actors.each { |key, value| next if value.nil? $data_actors[key.to_i] = value } classes.each { |key, value| next if value.nil? $data_classes[key.to_i] = value } skills.each { |key, value| next if value.nil? $data_skills[key.to_i] = value } items.each { |key, value| next if value.nil? $data_items[key.to_i] = value } weapons.each { |key, value| next if value.nil? $data_weapons[key.to_i] = value } armors.each { |key, value| next if value.nil? $data_armors[key.to_i] = value } enemies.each { |key, value| next if value.nil? $data_enemies[key.to_i] = value } troops.each { |key, value| next if value.nil? $data_troops[key.to_i] = value } states.each { |key, value| next if value.nil? $data_states[key.to_i] = value } animations.each { |key, value| next if value.nil? $data_animations[key.to_i] = value } # Maps $data_mapinfos = map_data[:map_info] if map_data[:map_info] map_data.delete(:map_info) $data_maps_patch = map_data end # # alias method: reload_map_if_updated # class<<self; alias datamanager_patch_yse_reload_map_if_updated reload_map_if_updated; end def self.reload_map_if_updated datamanager_patch_yse_reload_map_if_updated reload_map_if_patched end # # new method: reload_map_if_patched # def self.reload_map_if_patched unless $data_maps_patch[$game_map.map_id].nil? $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) $game_player.make_encounter_count end end end # DataManager #============================================================================== # ¡ Game_Map #============================================================================== class Game_Map # # overwrite method: setup # def setup(map_id) @map_id = map_id if $data_maps_patch.nil? || $data_maps_patch[map_id.to_s].nil? @map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id)) else @map = $data_maps_patch[map_id.to_s] end @tileset_id = @map.tileset_id @display_x = 0 @display_y = 0 referesh_vehicles setup_events setup_scroll setup_parallax setup_battleback @need_refresh = false end end # Game_Map #============================================================================== # ¡ Window_Patch_Base #============================================================================== class Window_Patch_Base < Window_Selectable # # initialize # def initialize super((Graphics.width - 408) / 2, (Graphics.height - 344) / 2, 408, 344) @data = [] refresh end # # item_max # def item_max return @data.nil? ? 1 : @data.size end # # item_max # def make_data_list # Loading Data. end # # highlight # def highlight(index) # Highlight Data. end # # draw_item # def draw_item(index) name = @data[index] rect = item_rect(index) rect.width -= 4 change_color(normal_color) rect.x += 4 draw_text(rect, "#{index + 1}, ", 0) change_color(normal_color) change_color(Color.new(100,100,100)) unless highlight(index) rect.x += 40 draw_text(rect, "#{name}", 0) change_color(Color.new(255,175,175)) rect.x -= 44 draw_text(rect, sprintf("(ID: %03d)", index + 1), 2) end # # refresh # def refresh make_data_list create_contents draw_all_items end # # refresh # def set_on_off # Set on/off end end # Window_Patch_Base #============================================================================== # ¡ Window_Patch_Maps #============================================================================== class Window_Patch_Maps < Window_Patch_Base # # initialize # def initialize $patch_map_temp = [] super end # # make_data_list # def make_data_list $data_mapinfos.each { |key, value| @data.push(value.name) } end # # highlight # def highlight(index) $patch_map_temp.include?(index + 1) end # # set_on_off # def set_on_off if $patch_map_temp.include?(index + 1) $patch_map_temp.delete(index + 1) draw_item(index) else $patch_map_temp.push(index + 1) draw_item(index) end end end # Window_Patch_Maps #============================================================================== # ¡ Window_Patch_Common_Event #============================================================================== class Window_Patch_Common_Event < Window_Patch_Base # # initialize # def initialize $patch_ce_temp = [] super end # # make_data_list # def make_data_list $data_common_events.each { |value| next if value.nil? @data.push(value.name) } end # # highlight # def highlight(index) $patch_ce_temp.include?(index + 1) end # # refresh # def set_on_off if $patch_ce_temp.include?(index + 1) $patch_ce_temp.delete(index + 1) draw_item(index) else $patch_ce_temp.push(index + 1) draw_item(index) end end end # Window_Patch_Common_Event #============================================================================== # ¡ Window_Patch_Tileset #============================================================================== class Window_Patch_Tileset < Window_Patch_Base # # initialize # def initialize $patch_ts_temp = [] super end # # make_data_list # def make_data_list $data_tilesets.each { |value| next if value.nil? @data.push(value.name) } end # # highlight # def highlight(index) $patch_ts_temp.include?(index + 1) end # # refresh # def set_on_off if $patch_ts_temp.include?(index + 1) $patch_ts_temp.delete(index + 1) draw_item(index) else $patch_ts_temp.push(index + 1) draw_item(index) end end end # Window_Patch_Tileset PATCH_HASH_NAME = ["Actors", "Classes", "Skills", "Items", "Weapons", "Armors", "Enemies", "Troops", "States", "Animations"] PATCH_HASH_NAME.each { |patch_name| cStr = %Q( class Window_Patch_#{patch_name} < Window_Patch_Base # # initialize # def initialize $patch_#{patch_name.downcase}_temp = [] super end # # make_data_list # def make_data_list $data_#{patch_name.downcase}.each { |value| next if value.nil? @data.push(value.name) } end # # highlight # def highlight(index) $patch_#{patch_name.downcase}_temp.include?(index + 1) end # # refresh # def set_on_off if $patch_#{patch_name.downcase}_temp.include?(index + 1) $patch_#{patch_name.downcase}_temp.delete(index + 1) draw_item(index) else $patch_#{patch_name.downcase}_temp.push(index + 1) draw_item(index) end end end ) eval(cStr) } #============================================================================== # ¡ Window_Patch_Command #============================================================================== class Window_Patch_Command < Window_Command # # initialize # def initialize super(0, (Graphics.height - fitting_height(4)) / 2) end # # window_width # def window_width return Graphics.width end # # visible_line_number # def visible_line_number return 4 end # # col_max # def col_max 4 end # # make_command_list # def make_command_list add_command("Maps", :maps, true) add_command("Common Events", :ce, true) add_command("Tilesets", :ts, true) PATCH_HASH_NAME.each { |patch_name| cStr = "add_command(\"#{patch_name}\", :#{patch_name.downcase}, true)" eval(cStr) } add_command("Patch!", :patch, true) add_command("Patch All Things", :patch_all, true) add_command("Exit", :cancel, true) end end # Window_Patch_Command #============================================================================== # ¡ Scene_Patch_YSE #============================================================================== class Scene_Patch_YSE < Scene_Base # # start # def start super create_all_windows @command_window.activate @command_window.select(0) end # # create_all_windows # def create_all_windows #--- @command_window = Window_Patch_Command.new @command_window.viewport = @viewport @command_window.set_handler(:maps, method(:patch_maps)) @command_window.set_handler(:ts, method(:patch_tileset)) @command_window.set_handler(:ce, method(:patch_common_event)) @command_window.set_handler(:patch, method(:apply_patch)) @command_window.set_handler(:patch_all, method(:apply_patch_all)) PATCH_HASH_NAME.each { |patch_name| cStr = "@command_window.set_handler(:#{patch_name.downcase}, method(:patch_#{patch_name.downcase}))" eval(cStr) } @command_window.set_handler(:cancel, method(:return_scene)) #--- @maps_window = Window_Patch_Maps.new @maps_window.viewport = @viewport @maps_window.set_handler(:ok, method(:on_maps_ok)) @maps_window.set_handler(:cancel, method(:on_maps_cancel)) @maps_window.close #--- PATCH_HASH_NAME.each { |patch_name| cStr = %Q( @#{patch_name.downcase}_window = Window_Patch_#{patch_name}.new @#{patch_name.downcase}_window.viewport = @viewport @#{patch_name.downcase}_window.set_handler(:ok, method(:on_#{patch_name.downcase}_ok)) @#{patch_name.downcase}_window.set_handler(:cancel, method(:on_#{patch_name.downcase}_cancel)) @#{patch_name.downcase}_window.close ) eval(cStr) } #--- @ce_window = Window_Patch_Common_Event.new @ce_window.viewport = @viewport @ce_window.set_handler(:ok, method(:on_ce_ok)) @ce_window.set_handler(:cancel, method(:on_ce_cancel)) @ce_window.close #--- @ts_window = Window_Patch_Tileset.new @ts_window.viewport = @viewport @ts_window.set_handler(:ok, method(:on_ts_ok)) @ts_window.set_handler(:cancel, method(:on_ts_cancel)) @ts_window.close end # # patch_maps # def patch_maps @command_window.deactivate @maps_window.open @maps_window.activate @maps_window.select(0) end # # patch_tileset # def patch_tileset @command_window.deactivate @ts_window.open @ts_window.activate @ts_window.select(0) end # # patch_common_event # def patch_common_event @command_window.deactivate @ce_window.open @ce_window.activate @ce_window.select(0) end PATCH_HASH_NAME.each { |patch_name| cStr = %Q( def patch_#{patch_name.downcase} @command_window.deactivate @#{patch_name.downcase}_window.open @#{patch_name.downcase}_window.activate @#{patch_name.downcase}_window.select(0) end ) module_eval(cStr) } # # on_maps_ok # def on_maps_ok @maps_window.set_on_off @maps_window.activate end # # on_maps_ok # def on_maps_cancel @maps_window.deactivate @maps_window.close @command_window.activate end PATCH_HASH_NAME.each { |patch_name| cStr = %Q( def on_#{patch_name.downcase}_ok @#{patch_name.downcase}_window.set_on_off @#{patch_name.downcase}_window.activate end def on_#{patch_name.downcase}_cancel @#{patch_name.downcase}_window.deactivate @#{patch_name.downcase}_window.close @command_window.activate end ) module_eval(cStr) } # # on_ce_ok # def on_ce_ok @ce_window.set_on_off @ce_window.activate end # # on_ce_cancel # def on_ce_cancel @ce_window.deactivate @ce_window.close @command_window.activate end # # on_ts_ok # def on_ts_ok @ts_window.set_on_off @ts_window.activate end # # on_ts_cancel # def on_ts_cancel @ts_window.deactivate @ts_window.close @command_window.activate end # # apply_patch # def apply_patch dir = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:path] prefix = YSE::PATCH_SYSTEM::SAVE_CONFIGURATION[:prefix_name] filename = YSE.make_filename("#{prefix}#{Time.now.strftime("%s")}", dir) @temporary = {} $patch_map_temp.each { |id| next if id.nil? map_data = YSE::PATCH_SYSTEM.load_map_data(id) @temporary["map#{id}"] = map_data @temporary["map_info"] = $data_mapinfos } $patch_ce_temp.each { |id| next if id.nil? @temporary["common_event#{id}"] = $data_common_events[id] } $patch_ts_temp.each { |id| next if id.nil? @temporary["tileset#{id}"] = $data_tilesets[id] } PATCH_HASH_NAME.each { |patch_name| cStr = %Q( $patch_#{patch_name.downcase}_temp.each { |id| next if id.nil? @temporary["#{patch_name.downcase}"+id.to_s] = $data_#{patch_name.downcase}[id] } ) eval(cStr) } @temporary["hash"] = YSE.make_hash(Time.now.strftime("%s")) @temporary["filename"] = filename YSE.save_data(filename, @temporary) YSE.message_box("Patch System","Create Patch Complete! Location: #{filename}. Click OK to Exit.") exit end # # apply_patch_all # def apply_patch_all $data_mapinfos.each_key { |i| next if i == 0 $patch_map_temp.push(i) } $data_common_events.size.times { |i| next if i == 0 $patch_ce_temp.push(i) } $data_tilesets.size.times { |i| next if i == 0 $patch_ts_temp.push(i) } PATCH_HASH_NAME.each { |patch_name| cStr = %Q( $data_#{patch_name.downcase}.size.times { |i| next if i == 0 $patch_#{patch_name.downcase}_temp.push(i) } ) eval(cStr) } apply_patch end end # Scene_Patch_YSE #============================================================================== # # ¥ End of File # #============================================================================== Пояснения: ntroduction: This script will help you to make patches for your games. This works with Encrypted Games as well. This script will load your games’ data and storage in a small file. Players can download this file and copy it into games’ folder to patch it. How to Use: To call Patch Maker, use this Custom Script (can be called with Script in Events): YSE.patch_start You will have to choose Maps/Tilesets/Common Events… to make patch for, and then confirm at Patch! to create patch. |
Администратор запретил публиковать записи гостям.
|
[ACE] Yami Patch system 9 года 9 мес. назад #78330
|
Этот скрипт требует еще Basic Module к сожалению у них пока проблема со скачиванием.
Судя по описанию, нужно вызвать команду YSE.patch_start в событии вызова скрипта. (последняя кнопка в событиях). Должно появится окошко с выбором Maps/Tilesets/Common Events. |
Последнее редактирование: 9 года 9 мес. назад от Arykray.
Администратор запретил публиковать записи гостям.
За этот пост поблагодарили: Guren_san
|
[ACE] Yami Patch system 9 года 9 мес. назад #78334
|
После долгих раскопок в недрах интернета, нашел скрипт BasicModule
ВНИМАНИЕ: Спойлер! [ Нажмите, чтобы развернуть ][ Нажмите, чтобы скрыть ] #==============================================================================
#
# ¥ Yami Engine Ace - Basic Module
# -- Last Updated: 2012.04.27
# -- Level: Nothing
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YSE-BasicModule"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.27 - Added Notetags Initializer.
# 2012.03.24 - Added Parse Range Keys.
# 2012.03.17 - Updated Load Data Method.
# 2012.03.13 - Remove requirements mechanic.
# 2012.03.11 - Change in requirements mechanic.
# 2012.03.02 - Added Message Box.
# 2012.03.01 - Started and Finished Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides many methods for Yami Engine Ace.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
#==============================================================================
# ¥ Configuration
#==============================================================================
module YSE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - External Data Configuration -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DATA_CONFIGURATION = { # Start here.
:ext => "rvdata2", # Data File Extension.
:salt => "cl", # Salt. Make an unique two-character phrase.
# Must be 2 characters.
:unique => "z8x8273ac", # Unique phrase. Must be at least 1 character.
:comp_level => 9, # Level from 1 to 9. Best Speed at 1, Best
# Compress at 9.
} # Do not delete this.
end
#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ¡ YSE - Basic Module
#==============================================================================
module YSE
#--------------------------------------------------------------------------
# message_box
#--------------------------------------------------------------------------
def self.message_box(title, message)
api = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I')
api.call(0,message,title,0)
end
#--------------------------------------------------------------------------
# charset
#--------------------------------------------------------------------------
def self.charset
result = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789"
result
end
#--------------------------------------------------------------------------
# make_random_string
#--------------------------------------------------------------------------
def self.make_random_string(length = 6)
result = ""
while result.size < length
result << charset[rand(charset.size)]
end
result
end
#--------------------------------------------------------------------------
# make_filename
#--------------------------------------------------------------------------
def self.make_filename(filename, dir = "")
ext = DATA_CONFIGURATION[:ext]
result = "#{dir}/#{filename}.#{ext}"
result
end
#--------------------------------------------------------------------------
# compress_data
#--------------------------------------------------------------------------
def self.compress_data(data, comp_level = nil)
compress_level = comp_level.nil? ? DATA_CONFIGURATION[:comp_level] : comp_level
result = Zlib::Deflate.deflate(Marshal.dump(data), compress_level)
result
end
#--------------------------------------------------------------------------
# decompress_data
#--------------------------------------------------------------------------
def self.decompress_data(data)
result = Zlib::Inflate.inflate(Marshal.load(data))
result
end
#--------------------------------------------------------------------------
# make_hash
#--------------------------------------------------------------------------
def self.make_hash(string = "")
salt = DATA_CONFIGURATION[:salt]
result = string.crypt(salt)
result = result + DATA_CONFIGURATION[:unique]
result
end
#--------------------------------------------------------------------------
# save_data
#--------------------------------------------------------------------------
def self.save_data(filename, data_hash)
File.open(filename, "wb") do |file|
Marshal.dump(compress_data(data_hash), file)
end
return true
end
#--------------------------------------------------------------------------
# save_data
#--------------------------------------------------------------------------
def self.load_data(filename, method, index = 0, ext = nil)
File.open(filename, "rb") do |file|
index.times { Marshal.load(file) }
if ext
case ext
when :mtime
method.call(Marshal.load(decompress_data(file)), file.mtime)
end
else
method.call(Marshal.load(decompress_data(file)))
end
end
return true
end
#--------------------------------------------------------------------------
# parse_range
#--------------------------------------------------------------------------
def self.parse_range(hash)
result = {}
hash.each { |key, value|
if key.is_a?(Range)
key.each { |id| result[id] = value }
else
result[key] = value
end
}
result
end
#--------------------------------------------------------------------------
# patch_start
#--------------------------------------------------------------------------
def self.patch_start
return unless $imported["YSE-PatchSystem"]
SceneManager.call(Scene_Patch_YSE)
end
end # YSE - Basic Module
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_yebm load_database; end
def self.load_database
load_database_yebm
load_notetags_ye
end
#--------------------------------------------------------------------------
# new method: load_notetags_ye
#--------------------------------------------------------------------------
def self.load_notetags_ye
groups = [$data_actors, $data_classes, $data_skills, $data_items, $data_weapons,
$data_armors, $data_enemies, $data_states]
groups.each { |group|
group.each { |obj|
next if obj.nil?
obj.notetags_initialize
}
}
end
end # DataManager
#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# new method: notetags_initialize
#--------------------------------------------------------------------------
def notetags_initialize
@notelines = []
#---
self.note.split(/[\r\n]+/).each { |line|
@notelines.push(line)
} # self.note.split
#---
notetags_reader
end
#--------------------------------------------------------------------------
# new method: notetags_reader
#--------------------------------------------------------------------------
def notetags_reader
# Reading Notetags.
end
end # RPG::BaseItem
#==============================================================================
# ¡ System Errors
#==============================================================================
if YSE::DATA_CONFIGURATION[:salt].size < 2
YSE.message_box("YSE - Basic Module", "Salt must have at least 2 characters.")
exit
end
if YSE::DATA_CONFIGURATION[:unique].size < 1
YSE.message_box("YSE - Basic Module", "Unique phrase must have at least 1 character.")
exit
end
#==============================================================================
#
# ¥ End of File
#
#============================================================================== После установки этого скрипта в паре с Patch System, все работает. |
Администратор запретил публиковать записи гостям.
За этот пост поблагодарили: Guren_san, MissAlisa5
|
Модераторы: NeKotZima
Время создания страницы: 0.585 секунд