#============================================================================ # 本脚本来自www.66rpg.com,转载请保留此信息,使用……只能用一次 # 核心作者:RoyRoy # 使用方法: # 1、首先输入RMXP的标准素材库地址,下面给出的是默认地址 # 2、运行脚本就OK了。 # ★★特别声明!!运用此脚本会删掉你给的路径的素材库★★请自己备份好★★★★ #============================================================================ RMXP = "C:/Program Files/RPG Maker XP/RGSS/Standard/" # 素材库地址 module DumpRgss def self.dump @rgss_list = [] @rgss_dir = { 'BGM' => 'Audio/BGM', 'BGS' => 'Audio/BGS', 'ME' => 'Audio/ME', 'SE' => 'Audio/SE', 'Animations' => 'Graphics/Animations', 'Autotiles' => 'Graphics/Autotiles', 'Battlebacks' => 'Graphics/Battlebacks', 'Battlers' => 'Graphics/Battlers', 'Characters' => 'Graphics/Characters', 'Fogs' => 'Graphics/Fogs', 'Gameovers' => 'Graphics/Gameovers', 'Icons' => 'Graphics/Icons', 'Panoramas' => 'Graphics/Panoramas', 'Pictures' => 'Graphics/Pictures', 'Tilesets' => 'Graphics/Tilesets', 'Titles' => 'Graphics/Titles', 'Transitions' => 'Graphics/Transitions', 'Windowskins' => 'Graphics/Windowskins' } base_data = ['Actors', 'Animations', 'Armors', 'Enemies', 'Items', 'Skills', 'Tilesets', 'Weapons'] rgss_data = { 'menu_se' => 'SE', 'animation_name' => 'Animations', 'battler_name' => 'Battlers', 'battleback_name' => 'Battlebacks', 'character_name' => 'Characters', 'fog_name' => 'Fogs', 'icon_name' => 'Icons', 'panorama_name' => 'Panoramas', 'tileset_name' => 'Tilesets' } for fnbase in base_data rxdata = self.open_file(fnbase) for data in rxdata for data_key in rgss_data.keys begin data_value = eval('data.' + data_key) self.push_to_list(rgss_data[data_key], data_value) rescue end # begin end # for data_key # Animations.rxdata if fnbase == 'Animations' begin for timing in data.timings self.push_to_list('SE', timing.se) end # for timing rescue end # begin elsif fnbase == 'Tilesets' begin for autotile_name in data.autotile_names self.push_to_list('Autotiles', autotile_name) end # for timing rescue end # begin end end # for data end # for fnbase # System.rxdata rgss_data = { 'battleback_name' => 'Battlebacks', 'battler_name' => 'Battlers', 'windowskin_name' => 'Windowskins', 'gameover_name' => 'Gameovers', 'title_name' => 'Titles', 'battle_transition' => 'Transitions', 'title_bgm' => 'BGM', 'battle_bgm' => 'BGM', 'battle_end_me' => 'ME', 'gameover_me' => 'ME', 'cursor_se' => 'SE', 'decision_se' => 'SE', 'cancel_se' => 'SE', 'buzzer_se' => 'SE', 'equip_se' => 'SE', 'shop_se' => 'SE', 'save_se' => 'SE', 'load_se' => 'SE', 'battle_start_se' => 'SE', 'escape_se' => 'SE', 'actor_collapse_se' => 'SE', 'enemy_collapse_se' => 'SE' } rxdata = self.open_file('System') for data_key in rgss_data.keys begin data_value = eval('rxdata.' + data_key) self.push_to_list(rgss_data[data_key], data_value) rescue end # begin end # for data_key # CommonEvents.rxdata rxdata = self.open_file('CommonEvents') for data in rxdata begin self.dump_event_list(data.list) rescue end # begin end # Troops (events) data rxdata = self.open_file('Troops') for data in rxdata begin for page in data.pages self.dump_event_list(page.list) end # begin rescue end end # Map (events) data fldata = 'Data/MapInfos.rxdata' mapinfos = load_data(fldata) for mapinfo in mapinfos rxdata = self.open_file(sprintf('Map%03d', mapinfo[0])) begin self.push_to_list('BGM', rxdata.bgm) self.push_to_list('BGS', rxdata.bgs) rescue end # begin # Events for event in rxdata.events.values for page in event.pages begin self.push_to_list('Characters', page.graphic.character_name) self.dump_custom_move_list(page.move_route.list) self.dump_event_list(page.list) rescue end # begin end end end # Save @rgss_list.shift f = open('./dump_rgss.txt', 'w') begin for rgss in @rgss_list printf(f, '%s%s', rgss, "\n") end ensure f.close end p 'dump end' end def self.open_file(fndata) fldata = sprintf('Data/%s.rxdata', fndata) @rgss_list.push('') @rgss_list.push(sprintf('[%s]', fldata)) return load_data(fldata) end def self.push_to_list(dir_key, value) # Audio/SE if value.is_a?(RPG::AudioFile) value = value.name end if value != '' flrgss = sprintf('%s/%s', @rgss_dir[dir_key], value) if File.exist?(RMXP+flrgss+".jpg") File.rename(RMXP+flrgss+".jpg",flrgss+".jpg") end if File.exist?(RMXP+flrgss+".bmp") File.rename(RMXP+flrgss+".bmp",flrgss+".bmp") end if File.exist?(RMXP+flrgss+".png") File.rename(RMXP+flrgss+".png",flrgss+".png") end if File.exist?(RMXP+flrgss+".wav") File.rename(RMXP+flrgss+".wav",flrgss+".wav") end if File.exist?(RMXP+flrgss+".mp3") File.rename(RMXP+flrgss+".mp3",flrgss+".mp3") end if File.exist?(RMXP+flrgss+".mid") File.rename(RMXP+flrgss+".mid",flrgss+".mid") end if File.exist?(RMXP+flrgss+".wma") File.rename(RMXP+flrgss+".wma",flrgss+".wma") end if File.exist?(RMXP+flrgss+".ogg") File.rename(RMXP+flrgss+".ogg",flrgss+".ogg") end #if @rgss_list.include?(flrgss) #flrgss = sprintf('>%s', flrgss) #end @rgss_list.push(flrgss) end end def self.dump_event_list(event_commands) for event_command in event_commands self.dump_event(event_command) end end def self.dump_event(event_command) parameters = event_command.parameters case event_command.code when 131 self.push_to_list('Windowskins', parameters[0]) when 132 self.push_to_list('BGM', parameters[0]) when 133 self.push_to_list('ME', parameters[0]) when 204 case parameters[0] when 0 self.push_to_list('Panoramas', parameters[1]) when 1 self.push_to_list('Fogs', parameters[1]) when 2 self.push_to_list('Battlebacks', parameters[1]) end when 209 dump_custom_move_list(parameters[1].list) when 222 self.push_to_list('Transitions', parameters[0]) when 231 self.push_to_list('Pictures', parameters[1]) when 241 self.push_to_list('BGM', parameters[0]) when 245 self.push_to_list('BGS', parameters[0]) when 249 self.push_to_list('ME', parameters[0]) when 250 self.push_to_list('SE', parameters[0]) when 322 self.push_to_list('Characters', parameters[1]) self.push_to_list('Battlers', parameters[3]) end end def self.dump_custom_move_list(move_commands) for move_command in move_commands self.dump_custom_move(move_command) end end def self.dump_custom_move(move_command) parameters = move_command.parameters case move_command.code when 41 self.push_to_list('Characters', parameters[0]) when 44 self.push_to_list('SE', parameters[0]) end end end DumpRgss.dump |