From cb0220b751c1c219278a934ad5dca2603893eaba Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Thu, 22 Jul 2021 22:46:43 +0100 Subject: [PATCH] Cleaned up evolution method definitions, rewrote the "Fill Bag" Debug feature to make it much faster, removed all instances of changing the game window's title --- .../001_Debugging/002_DebugConsole.rb | 4 +- .../001_Technical/005_PluginManager.rb | 8 +- .../002_Save data/003_SaveData_Conversion.rb | 4 +- .../004_Game classes/006_Game_MapFactory.rb | 2 +- Data/Scripts/005_Sprites/007_Spriteset_Map.rb | 8 +- Data/Scripts/009_Scenes/001_Transitions.rb | 2 +- .../001_Hardcoded data/013_EncounterType.rb | 77 ++++++------------- Data/Scripts/013_Items/008_PokemonBag.rb | 5 +- .../003_EditorScreens_MapConnections.rb | 10 +-- .../003_Debug menus/002_Debug_MenuCommands.rb | 18 ++++- .../003_Debug_MenuExtraCode.rb | 21 ++--- Data/Scripts/021_Compiler/001_Compiler.rb | 6 +- .../021_Compiler/002_Compiler_CompilePBS.rb | 3 +- .../021_Compiler/003_Compiler_WritePBS.rb | 12 +-- .../004_Compiler_MapsAndEvents.rb | 7 +- 15 files changed, 89 insertions(+), 98 deletions(-) diff --git a/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb b/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb index 2b87d941f..69a3f25b6 100644 --- a/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb +++ b/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb @@ -43,8 +43,8 @@ module Kernel end def echoln(string) - echo(string) - echo("\r\n") + echo string + echo "\r\n" end end diff --git a/Data/Scripts/001_Technical/005_PluginManager.rb b/Data/Scripts/001_Technical/005_PluginManager.rb index 650c70046..1f47988bd 100644 --- a/Data/Scripts/001_Technical/005_PluginManager.rb +++ b/Data/Scripts/001_Technical/005_PluginManager.rb @@ -650,7 +650,7 @@ module PluginManager # Check if plugins need compiling #----------------------------------------------------------------------------- def self.compilePlugins(order, plugins) - echo 'Compiling plugin scripts...' + echo "Compiling plugin scripts..." scripts = [] # go through the entire order one by one for o in order @@ -672,8 +672,8 @@ module PluginManager File.open("Data/PluginScripts.rxdata", 'wb') { |f| Marshal.dump(scripts, f) } # collect garbage GC.start - echoln ' done.' - echoln '' + echoln " done." + echoln "" end #----------------------------------------------------------------------------- # Check if plugins need compiling @@ -711,7 +711,7 @@ module PluginManager end end end - echoln '' if !echoed_plugins.empty? + echoln "" if !echoed_plugins.empty? end #----------------------------------------------------------------------------- end diff --git a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb index f48bc35ea..c6e0175a7 100644 --- a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb +++ b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb @@ -199,9 +199,9 @@ module SaveData conversions_to_run.each do |conversion| echo "#{conversion.title}..." conversion.run(save_data) - echoln ' done.' + echoln " done." end - echoln '' if conversions_to_run.length > 0 + echoln "" if conversions_to_run.length > 0 save_data[:essentials_version] = Essentials::VERSION save_data[:game_version] = Settings::GAME_VERSION return true diff --git a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb index 9c4dcf6ce..20bee4934 100644 --- a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb +++ b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb @@ -31,7 +31,7 @@ class PokemonMapFactory return @maps[@mapIndex] if @maps[@mapIndex] raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length==0 if @maps[0] - echoln("Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})") + echoln "Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})" return @maps[0] end raise "No maps in save file... (all maps empty; mapIndex=#{@mapIndex})" diff --git a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb index ac0f1490e..54bac9c27 100644 --- a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb +++ b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb @@ -9,21 +9,21 @@ class ClippableSprite < Sprite_Character super @_src_rect = self.src_rect tmright = @tilemap.map_data.xsize*Game_Map::TILE_WIDTH-@tilemap.ox - echoln("x=#{self.x},ox=#{self.ox},tmright=#{tmright},tmox=#{@tilemap.ox}") + echoln "x=#{self.x},ox=#{self.ox},tmright=#{tmright},tmox=#{@tilemap.ox}" if @tilemap.ox-self.ox<-self.x # clipped on left diff = -self.x-@tilemap.ox+self.ox self.src_rect = Rect.new(@_src_rect.x+diff,@_src_rect.y, @_src_rect.width-diff,@_src_rect.height) - echoln("clipped out left: #{diff} #{@tilemap.ox-self.ox} #{self.x}") + echoln "clipped out left: #{diff} #{@tilemap.ox-self.ox} #{self.x}" elsif tmright-self.ox :Land, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :LandDay, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :LandNight, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :LandMorning, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :LandAfternoon, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :LandEvening, :type => :land, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) GameData::EncounterType.register({ :id => :Cave, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :CaveDay, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :CaveNight, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :CaveMorning, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :CaveAfternoon, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :CaveEvening, :type => :cave, - :trigger_chance => 5, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 5 }) GameData::EncounterType.register({ :id => :Water, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :WaterDay, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :WaterNight, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :WaterMorning, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :WaterAfternoon, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :WaterEvening, :type => :water, - :trigger_chance => 2, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 2 }) GameData::EncounterType.register({ :id => :OldRod, - :type => :fishing, - :old_slots => [70, 30] + :type => :fishing }) GameData::EncounterType.register({ :id => :GoodRod, - :type => :fishing, - :old_slots => [60, 20, 20] + :type => :fishing }) GameData::EncounterType.register({ :id => :SuperRod, - :type => :fishing, - :old_slots => [40, 40, 15, 4, 1] + :type => :fishing }) GameData::EncounterType.register({ :id => :RockSmash, :type => :none, - :trigger_chance => 50, - :old_slots => [60, 30, 5, 4, 1] + :trigger_chance => 50 }) GameData::EncounterType.register({ :id => :HeadbuttLow, - :type => :none, - :old_slots => [30, 25, 20, 10, 5, 5, 4, 1] + :type => :none }) GameData::EncounterType.register({ :id => :HeadbuttHigh, - :type => :none, - :old_slots => [30, 25, 20, 10, 5, 5, 4, 1] + :type => :none }) GameData::EncounterType.register({ :id => :BugContest, :type => :contest, - :trigger_chance => 21, - :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + :trigger_chance => 21 }) diff --git a/Data/Scripts/013_Items/008_PokemonBag.rb b/Data/Scripts/013_Items/008_PokemonBag.rb index ec42479fc..e3dfd391f 100644 --- a/Data/Scripts/013_Items/008_PokemonBag.rb +++ b/Data/Scripts/013_Items/008_PokemonBag.rb @@ -21,7 +21,7 @@ class PokemonBag @choices[i] = 0 end @registeredItems = [] - @registeredIndex = [0, 0, 1] + @registeredIndex = [0, 0, 1] # Used by the Ready Menu to remember cursor positions end def rearrange @@ -44,6 +44,9 @@ class PokemonBag def clear @pockets.each { |pocket| pocket.clear } + for i in 0..PokemonBag.numPockets + @choices[i] = 0 + end end def pockets diff --git a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb index d3cb45d36..7486ee578 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb @@ -419,24 +419,24 @@ class MapScreenScene end def onRightClick(mapid,x,y) -# echoln("rightclick (#{mapid})") +# echoln "rightclick (#{mapid})" end def onMouseUp(mapid) -# echoln("mouseup (#{mapid})") +# echoln "mouseup (#{mapid})" @dragging=false if @dragging end def onRightMouseUp(mapid) -# echoln("rightmouseup (#{mapid})") +# echoln "rightmouseup (#{mapid})" end def onMouseOver(mapid,x,y) -# echoln("mouseover (#{mapid},#{x},#{y})") +# echoln "mouseover (#{mapid},#{x},#{y})" end def onMouseMove(mapid,x,y) -# echoln("mousemove (#{mapid},#{x},#{y})") +# echoln "mousemove (#{mapid},#{x},#{y})" if @dragging if @dragmapid>=0 sprite=getMapSprite(@dragmapid) diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index c4ac90714..6872404fe 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -483,7 +483,7 @@ DebugMenuCommands.register("additem", { DebugMenuCommands.register("fillbag", { "parent" => "itemsmenu", "name" => _INTL("Fill Bag"), - "description" => _INTL("Add a certain number of every item to the Bag."), + "description" => _INTL("Empties the Bag and then fills it with a certain number of every item."), "effect" => proc { params = ChooseNumberParams.new params.setRange(1, Settings::BAG_MAX_PER_SLOT) @@ -491,7 +491,19 @@ DebugMenuCommands.register("fillbag", { params.setCancelValue(0) qty = pbMessageChooseNumber(_INTL("Choose the number of items."), params) if qty > 0 - GameData::Item.each { |i| $PokemonBag.pbStoreItem(i.id, qty) } + $PokemonBag.clear + # NOTE: This doesn't simply use $PokemonBag.pbStoreItem for every item in + # turn, because that's really slow when done in bulk. + pocket_sizes = Settings::BAG_MAX_POCKET_SIZE + bag = $PokemonBag.pockets # Called here so that it only rearranges itself once + GameData::Item.each do |i| + next if !pocket_sizes[i.pocket] || pocket_sizes[i.pocket] == 0 + next if bag[i.pocket].length >= pocket_sizes[i.pocket] + item_qty = (i.is_important?) ? 1 : qty + bag[i.pocket].push([i.id, item_qty]) + end + # NOTE: Auto-sorting pockets don't need to be sorted afterwards, because + # items are added in the same order they would be sorted into. pbMessage(_INTL("The Bag was filled with {1} of each item.", qty)) end } @@ -1081,7 +1093,7 @@ DebugMenuCommands.register("compiledata", { "always_show" => true, "effect" => proc { msgwindow = pbCreateMessageWindow - Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow, msg, false); echoln(msg) } + Compiler.compile_all(true) { |msg| echoln msg } pbMessageDisplay(msgwindow, _INTL("All game data was compiled.")) pbDisposeMessageWindow(msgwindow) } diff --git a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb index e89bf9e0f..3828b99dd 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb @@ -681,21 +681,22 @@ end # Properly erases all non-existent tiles in maps (including event graphics) #=============================================================================== def pbDebugFixInvalidTiles - num_errors = 0 + total_errors = 0 num_error_maps = 0 tilesets = $data_tilesets mapData = Compiler::MapData.new t = Time.now.to_i Graphics.update + total_maps = mapData.mapinfos.keys.length + echoln _INTL("Checking {1} maps for invalid tiles...", total_maps) for id in mapData.mapinfos.keys.sort if Time.now.to_i - t >= 5 Graphics.update t = Time.now.to_i end - changed = false + map_errors = 0 map = mapData.getMap(id) next if !map || !mapData.mapinfos[id] - pbSetWindowText(_INTL("Processing map {1} ({2})", id, mapData.mapinfos[id].name)) passages = mapData.getTilesetPassages(map, id) # Check all tiles in map for non-existent tiles for x in 0...map.data.xsize @@ -704,8 +705,7 @@ def pbDebugFixInvalidTiles tile_id = map.data[x, y, i] next if pbCheckTileValidity(tile_id, map, tilesets, passages) map.data[x, y, i] = 0 - changed = true - num_errors += 1 + map_errors += 1 end end end @@ -716,19 +716,22 @@ def pbDebugFixInvalidTiles next if page.graphic.tile_id <= 0 next if pbCheckTileValidity(page.graphic.tile_id, map, tilesets, passages) page.graphic.tile_id = 0 - changed = true - num_errors += 1 + map_errors += 1 end end - next if !changed + next if map_errors == 0 # Map was changed; save it + echoln _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name) + total_errors += map_errors num_error_maps += 1 mapData.saveMap(id) end if num_error_maps == 0 + echoln _INTL("Done. No errors found.") pbMessage(_INTL("No invalid tiles were found.")) else - pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", num_errors, num_error_maps)) + echoln _INTL("Done. {1} errors found and fixed. Close RPG Maker XP to ensure fixes are applied.", total_errors) + 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.")) end end diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 15adc5deb..f88fdde0f 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -123,7 +123,6 @@ module Compiler end lineno += 1 Graphics.update if lineno%1000==0 - pbSetWindowText(_INTL("Processing {1} line {2}",FileLineData.file,lineno)) if lineno%200==0 } yield lastsection,sectionname if havesection end @@ -726,7 +725,7 @@ module Compiler compile_metadata # Depends on TrainerType yield(_INTL("Compiling animations")) compile_animations - yield(_INTL("Converting events")) + yield("") compile_trainer_events(mustCompile) yield(_INTL("Saving messages")) pbSetTextMessages @@ -736,7 +735,6 @@ module Compiler echoln "" echoln _INTL("*** Finished full compile ***") echoln "" - pbSetWindowText(nil) end def main @@ -828,7 +826,7 @@ module Compiler end end # Recompile all data - compile_all(mustCompile) { |msg| pbSetWindowText(msg); echoln(msg) } + compile_all(mustCompile) { |msg| echoln msg } rescue Exception e = $! raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit) diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index b3217d79c..1e650bc07 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -908,7 +908,6 @@ module Compiler raise _INTL("Dex list number {1} is defined at least twice.\r\n{2}", section, FileLineData.linereport) end dex_lists[section] = [] - pbSetWindowText(_INTL("Processing {1} section [{2}]", FileLineData.file, section)) else raise _INTL("Expected a section at the beginning of the file.\r\n{1}", FileLineData.linereport) if !section species_list = line.split(",") @@ -1031,7 +1030,7 @@ module Compiler raise _INTL("Minimum level is greater than maximum level: {1}\r\n{2}", line, FileLineData.linereport) end encounter_hash[:types][current_type].push(values) - elsif line[/^\[\s*(.+)\s*\]$/] # Map ID line (new format) + elsif line[/^\[\s*(.+)\s*\]$/] # Map ID line values = $~[1].split(',').collect! { |v| v.strip.to_i } values[1] = 0 if !values[1] map_number = values[0] diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index 104678d68..1bfa5788e 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -248,12 +248,13 @@ module Compiler # Save Pokémon data to PBS file #============================================================================= def write_pokemon + echo _INTL("Writing species") File.open("PBS/pokemon.txt", "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Species.each_species do |species| + echo "." if idx % 50 == 0 idx += 1 - pbSetWindowText(_INTL("Writing species {1}...", idx)) Graphics.update if idx % 100 == 0 f.write("\#-------------------------------\r\n") f.write(sprintf("[%s]\r\n", species.id)) @@ -335,7 +336,7 @@ module Compiler f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense end } - pbSetWindowText(nil) + echoln _INTL("done") Graphics.update end @@ -350,7 +351,6 @@ module Compiler next if species.form == 0 base_species = GameData::Species.get(species.species) idx += 1 - pbSetWindowText(_INTL("Writing form {1}...", idx)) Graphics.update if idx % 100 == 0 f.write("\#-------------------------------\r\n") f.write(sprintf("[%s,%d]\r\n", species.species, species.form)) @@ -441,7 +441,6 @@ module Compiler end end } - pbSetWindowText(nil) Graphics.update end @@ -573,12 +572,13 @@ module Compiler # Save individual trainer data to PBS file #============================================================================= def write_trainers + echo _INTL("Writing trainers") File.open("PBS/trainers.txt", "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Trainer.each do |trainer| + echo "." if idx % 50 == 0 idx += 1 - pbSetWindowText(_INTL("Writing trainer {1}...", idx)) Graphics.update if idx % 50 == 0 f.write("\#-------------------------------\r\n") if trainer.version > 0 @@ -617,7 +617,7 @@ module Compiler end end } - pbSetWindowText(nil) + echoln _INTL("done") Graphics.update end diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index a9ea08f86..63b279139 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -1380,11 +1380,11 @@ module Compiler t = Time.now.to_i Graphics.update trainerChecker = TrainerChecker.new + echo _INTL("Processing {1} maps...", mapData.mapinfos.keys.length) for id in mapData.mapinfos.keys.sort changed = false map = mapData.getMap(id) next if !map || !mapData.mapinfos[id] - pbSetWindowText(_INTL("Processing map {1} ({2})",id,mapData.mapinfos[id].name)) for key in map.events.keys if Time.now.to_i-t>=5 Graphics.update @@ -1415,12 +1415,15 @@ module Compiler if changed mapData.saveMap(id) mapData.saveTilesets + echoln "" + echo _INTL("Map {1}: '{2}' modified and saved.", id, mapData.mapinfos[id].name) end end + echoln "" changed = false Graphics.update commonEvents = load_data("Data/CommonEvents.rxdata") - pbSetWindowText(_INTL("Processing common events")) + echoln _INTL("Processing common events") for key in 0...commonEvents.length newevent = fix_event_use(commonEvents[key],0,mapData) if newevent