From f67370b817d62049b3783b463426fc1de0834657 Mon Sep 17 00:00:00 2001 From: PeridexisErrant Date: Thu, 12 Feb 2015 09:39:56 +1100 Subject: [PATCH] exportlegends - more data in legends_plus.xml Originally written by Mason11987, adapted and included with permission. --- NEWS | 1 + Readme.rst | 6 +- scripts/exportlegends.lua | 496 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 502 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 11bf20509..0152ce1d2 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ DFHack Future Removed Misc Improvements Multiline commands are now possible inside dfhack.init scripts. See dfhack.init-example for example usage. + exportlegends: 'info' and 'all' exports legends_plus xml with more data for legends utilities DFHack 0.40.24-r1 Internals diff --git a/Readme.rst b/Readme.rst index 27592955d..94b237242 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1473,9 +1473,13 @@ exportlegends Controls legends mode to export data - especially useful to set-and-forget large worlds, or when you want a map of every site when there are several hundred. +The 'info' option exports more data than is possible in vanilla, to a +region-date-legends_plus.xml" file developed to extend the World +Viewer utility and potentially compatible with others. + Options: -:info: Exports the world/gen info and the legends XML +:info: Exports the world/gen info, the legends XML, and a custom XML with more information :sites: Exports all available site maps :maps: Exports all seventeen detailed maps :all: Equivalent to calling all of the above, in that order diff --git a/scripts/exportlegends.lua b/scripts/exportlegends.lua index ccfa09735..6f5bc84a0 100644 --- a/scripts/exportlegends.lua +++ b/scripts/exportlegends.lua @@ -26,12 +26,508 @@ local MAPS = { "Diplomacy", } +getItemSubTypeName = function (itemType, subType) + if (dfhack.items.getSubtypeCount(itemType)) <= 0 then + return tostring(-1) + end + local subtypename = dfhack.items.getSubtypeDef(itemType, subType) + if (subtypename == nil) then + return tostring(-1) + else + return tostring(subtypename.name):lower() + end +end + +findEntity = function (id) + for k,v in ipairs(df.global.world.entities.all) do + if (v.id == id) then + return v + end + end + return nil +end + +function table.contains(table, element) + for _, value in pairs(table) do + if value == element then + return true + end + end + return false +end + +function table.containskey(table, key) + for value, _ in pairs(table) do + if value == key then + return true + end + end + return false +end + +--create an extra legends xml with extra data, by Mason11987 for World Viewer +function export_more_legends_xml() + local julian_day = math.floor(df.global.cur_year_tick / 1200) + 1 + local month = math.floor(julian_day / 28) + 1 --days and months are 1-indexed + local day = julian_day % 28 + 1 + local year_str = string.format('%0'..math.max(5, string.len(''..df.global.cur_year))..'d', df.global.cur_year) + local date_str = year_str..string.format('-%02d-%02d', month, day) + + io.output(tostring(df.global.world.cur_savegame.save_dir).."-"..date_str.."-legends_plus.xml") + --io.output(tostring(df.global.world.cur_savegame.save_dir).."-legends_plus.xml") + + io.write ("".."\n") + io.write ("".."\n") + io.write (""..dfhack.TranslateName(df.global.world.world_data.name).."".."\n") + io.write (""..dfhack.TranslateName(df.global.world.world_data.name,1).."".."\n") + + io.write ("".."\n") + for regionK, regionV in ipairs(df.global.world.world_data.regions) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..regionV.index.."".."\n") + io.write ("\t\t".."") + for xK, xVal in ipairs(regionV.region_coords.x) do + io.write (xVal..","..regionV.region_coords.y[xK].."|") + end + io.write ("\n") + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + for regionK, regionV in ipairs(df.global.world.world_data.underground_regions) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..regionV.index.."".."\n") + io.write ("\t\t".."") + for xK, xVal in ipairs(regionV.region_coords.x) do + io.write (xVal..","..regionV.region_coords.y[xK].."|") + end + io.write ("\n") + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + for siteK, siteV in ipairs(df.global.world.world_data.sites) do + if (#siteV.buildings > 0) then + io.write ("\t".."".."\n") + for k,v in pairs(siteV) do + if (k == "id") then + io.write ("\t\t".."<"..k..">"..tostring(v).."".."\n") + elseif (k == "buildings") then + io.write ("\t\t".."".."\n") + for buildingK, buildingV in ipairs(siteV.buildings) do + io.write ("\t\t\t".."".."\n") + io.write ("\t\t\t\t"..""..buildingV.id.."".."\n") + io.write ("\t\t\t\t"..""..df.abstract_building_type[buildingV:getType()]:lower().."".."\n") + if (df.abstract_building_type[buildingV:getType()]:lower() ~= "underworld_spire") then + io.write ("\t\t\t\t"..""..dfhack.TranslateName(buildingV.name, 1).."".."\n") + io.write ("\t\t\t\t"..""..dfhack.TranslateName(buildingV.name).."".."\n") + end + io.write ("\t\t\t".."".."\n") + end + io.write ("\t\t".."".."\n") + end + + end + io.write ("\t".."".."\n") + end + end + io.write ("".."\n") + + io.write ("".."\n") + for wcK, wcV in ipairs(df.global.world.world_data.constructions.list) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..wcV.id.."".."\n") + io.write ("\t\t"..""..dfhack.TranslateName(wcV.name,1).."".."\n") + io.write ("\t\t"..""..(df.world_construction_type[wcV:getType()]):lower().."".."\n") + io.write ("\t\t".."") + for xK, xVal in ipairs(wcV.square_pos.x) do + io.write (xVal..","..wcV.square_pos.y[xK].."|") + end + io.write ("\n") + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + for artifactK, artifactV in ipairs(df.global.world.artifacts.all) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..artifactV.id.."".."\n") + if (artifactV.item:getType() ~= -1) then + io.write ("\t\t"..""..tostring(df.item_type[artifactV.item:getType()]):lower().."".."\n") + if (artifactV.item:getSubtype() ~= -1) then + io.write ("\t\t"..""..artifactV.item.subtype.name.."".."\n") + end + end + if (table.containskey(artifactV.item,"description")) then + io.write ("\t\t"..""..artifactV.item.description:lower().."".."\n") + end + + if (artifactV.item:getMaterial() ~= -1 and artifactV.item:getMaterialIndex() ~= -1) then + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(artifactV.item:getMaterial(), artifactV.item:getMaterialIndex())).."".."\n") + end + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + io.write ("".."\n") + + io.write ("".."\n") + for entityPopK, entityPopV in ipairs(df.global.world.entity_populations) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..entityPopV.id.."".."\n") + for raceK, raceV in ipairs(entityPopV.races) do + local raceName = (df.global.world.raws.creatures.all[raceV].creature_id):lower() + io.write ("\t\t"..""..raceName..":"..entityPopV.counts[raceK].."".."\n") + end + io.write ("\t\t"..""..entityPopV.civ_id.."".."\n") + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + for entityK, entityV in ipairs(df.global.world.entities.all) do + io.write ("\t".."".."\n") + io.write ("\t\t"..""..entityV.id.."".."\n") + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[entityV.race].creature_id):lower().."".."\n") + io.write ("\t\t"..""..(df.historical_entity_type[entityV.type]):lower().."".."\n") + if (df.historical_entity_type[entityV.type]):lower() == "religion" then -- Get worshipped figure + if (entityV.unknown1b ~= nil and entityV.unknown1b.worship ~= nill and + #entityV.unknown1b.worship == 1) then + io.write ("\t\t"..""..entityV.unknown1b.worship[0].."".."\n") + else + print(entityV.unknown1b, entityV.unknown1b.worship, #entityV.unknown1b.worship) + end + end + for id, link in pairs(entityV.entity_links) do + io.write ("\t\t".."".."\n") + for k, v in pairs(link) do + if (k == "type") then + io.write ("\t\t\t".."<"..k..">"..tostring(df.entity_entity_link_type[v]).."".."\n") + else + io.write ("\t\t\t".."<"..k..">"..v.."".."\n") + end + end + io.write ("\t\t".."".."\n") + end + for id, link in ipairs(entityV.children) do + io.write ("\t\t"..""..link.."".."\n") + end + io.write ("\t".."".."\n") + end + io.write ("".."\n") + + io.write ("".."\n") + for ID, event in ipairs(df.global.world.history.events) do + if event:getType() == df.history_event_type.ADD_HF_ENTITY_LINK + or event:getType() == df.history_event_type.ADD_HF_SITE_LINK + or event:getType() == df.history_event_type.ADD_HF_HF_LINK + or event:getType() == df.history_event_type.ADD_HF_ENTITY_LINK + or event:getType() == df.history_event_type.TOPICAGREEMENT_CONCLUDED + or event:getType() == df.history_event_type.TOPICAGREEMENT_REJECTED + or event:getType() == df.history_event_type.TOPICAGREEMENT_MADE + or event:getType() == df.history_event_type.BODY_ABUSED + or event:getType() == df.history_event_type.CHANGE_HF_JOB + or event:getType() == df.history_event_type.CREATED_BUILDING + or event:getType() == df.history_event_type.CREATURE_DEVOURED + or event:getType() == df.history_event_type.HF_DOES_INTERACTION + or event:getType() == df.history_event_type.HF_LEARNS_SECRET + or event:getType() == df.history_event_type.HIST_FIGURE_NEW_PET + or event:getType() == df.history_event_type.HIST_FIGURE_REACH_SUMMIT + or event:getType() == df.history_event_type.ITEM_STOLEN + or event:getType() == df.history_event_type.REMOVE_HF_ENTITY_LINK + or event:getType() == df.history_event_type.REMOVE_HF_SITE_LINK + or event:getType() == df.history_event_type.REPLACED_BUILDING + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_ARCH_DESIGN + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_DYE_ITEM + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_ARCH_CONSTRUCT + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_FOOD -- Missing item subtype + or event:getType() == df.history_event_type.MASTERPIECE_CREATED_ENGRAVING + or event:getType() == df.history_event_type.MASTERPIECE_LOST + or event:getType() == df.history_event_type.ENTITY_ACTION + or event:getType() == df.history_event_type.HF_ACT_ON_BUILDING + or event:getType() == df.history_event_type.ARTIFACT_CREATED + or event:getType() == df.history_event_type.ASSUME_IDENTITY + or event:getType() == df.history_event_type.CREATE_ENTITY_POSITION + or event:getType() == df.history_event_type.DIPLOMAT_LOST + or event:getType() == df.history_event_type.MERCHANT + or event:getType() == df.history_event_type.WAR_PEACE_ACCEPTED + or event:getType() == df.history_event_type.WAR_PEACE_REJECTED + or event:getType() == df.history_event_type.HIST_FIGURE_WOUNDED + or event:getType() == df.history_event_type.HIST_FIGURE_DIED + then + io.write ("\t".."".."\n") + io.write ("\t\t"..""..event.id.."".."\n") + io.write ("\t\t"..""..tostring(df.history_event_type[event:getType()]):lower().."".."\n") + for k,v in pairs(event) do + if k == "year" or k == "seconds" or k == "flags" or k == "id" + or (k == "region" and event:getType() ~= df.history_event_type.HF_DOES_INTERACTION) + or k == "region_pos" or k == "layer" or k == "feature_layer" or k == "subregion" + or k == "anon_1" or k == "anon_2" or k == "flags2" or k == "unk1" then + + elseif event:getType() == df.history_event_type.ADD_HF_ENTITY_LINK and k == "link_type" then + io.write ("\t\t".."<"..k..">"..df.histfig_entity_link_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.ADD_HF_ENTITY_LINK and k == "position_id" then + local entity = findEntity(event.civ) + if (entity ~= nil and event.civ > -1 and v > -1) then + for entitypositionsK, entityPositionsV in ipairs(entity.positions.own) do + if entityPositionsV.id == v then + io.write ("\t\t"..""..tostring(entityPositionsV.name[0]):lower().."".."\n") + break + end + end + else + io.write ("\t\t".."-1".."\n") + end + elseif event:getType() == df.history_event_type.CREATE_ENTITY_POSITION and k == "position" then + local entity = findEntity(event.site_civ) + if (entity ~= nil and v > -1) then + for entitypositionsK, entityPositionsV in ipairs(entity.positions.own) do + if entityPositionsV.id == v then + io.write ("\t\t"..""..tostring(entityPositionsV.name[0]):lower().."".."\n") + break + end + end + else + io.write ("\t\t".."-1".."\n") + end + elseif event:getType() == df.history_event_type.REMOVE_HF_ENTITY_LINK and k == "link_type" then + io.write ("\t\t".."<"..k..">"..df.histfig_entity_link_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.REMOVE_HF_ENTITY_LINK and k == "position_id" then + local entity = findEntity(event.civ) + if (entity ~= nil and event.civ > -1 and v > -1) then + for entitypositionsK, entityPositionsV in ipairs(entity.positions.own) do + if entityPositionsV.id == v then + io.write ("\t\t"..""..tostring(entityPositionsV.name[0]):lower().."".."\n") + break + end + end + else + io.write ("\t\t".."-1".."\n") + end + elseif event:getType() == df.history_event_type.ADD_HF_HF_LINK and k == "type" then + io.write ("\t\t"..""..df.histfig_hf_link_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.ADD_HF_SITE_LINK and k == "type" then + io.write ("\t\t"..""..df.histfig_site_link_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.REMOVE_HF_SITE_LINK and k == "type" then + io.write ("\t\t"..""..df.histfig_site_link_type[v]:lower().."".."\n") + elseif (event:getType() == df.history_event_type.ITEM_STOLEN or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT + ) and k == "item_type" then + io.write ("\t\t"..""..df.item_type[v]:lower().."".."\n") + elseif (event:getType() == df.history_event_type.ITEM_STOLEN or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT + ) and k == "item_subtype" then + --if event.item_type > -1 and v > -1 then + io.write ("\t\t".."<"..k..">"..getItemSubTypeName(event.item_type,v).."".."\n") + --end + elseif event:getType() == df.history_event_type.ITEM_STOLEN and k == "mattype" then + if (v > -1) then + if (dfhack.matinfo.decode(event.mattype, event.matindex) == nil) then + io.write ("\t\t"..""..event.mattype.."".."\n") + io.write ("\t\t"..""..event.matindex.."".."\n") + else + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.mattype, event.matindex)).."".."\n") + end + end + elseif (event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT + ) and k == "mat_type" then + if (v > -1) then + if (dfhack.matinfo.decode(event.mat_type, event.mat_index) == nil) then + io.write ("\t\t"..""..event.mat_type.."".."\n") + io.write ("\t\t"..""..event.mat_index.."".."\n") + else + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.mat_type, event.mat_index)).."".."\n") + end + end + elseif event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT and k == "imp_mat_type" then + if (v > -1) then + if (dfhack.matinfo.decode(event.imp_mat_type, event.imp_mat_index) == nil) then + io.write ("\t\t"..""..event.imp_mat_type.."".."\n") + io.write ("\t\t"..""..event.imp_mat_index.."".."\n") + else + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.imp_mat_type, event.imp_mat_index)).."".."\n") + end + end + + elseif event:getType() == df.history_event_type.ITEM_STOLEN and k == "matindex" then + --skip + elseif event:getType() == df.history_event_type.ITEM_STOLEN and k == "item" and v == -1 then + --skip + elseif (event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM or + event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT + ) and k == "mat_index" then + --skip + elseif event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT and k == "imp_mat_index" then + --skip + elseif (event:getType() == df.history_event_type.WAR_PEACE_ACCEPTED or + event:getType() == df.history_event_type.WAR_PEACE_REJECTED or + event:getType() == df.history_event_type.TOPICAGREEMENT_CONCLUDED or + event:getType() == df.history_event_type.TOPICAGREEMENT_REJECTED or + event:getType() == df.history_event_type.TOPICAGREEMENT_MADE + ) and k == "topic" then + io.write ("\t\t"..""..tostring(df.meeting_topic[v]):lower().."".."\n") + elseif event:getType() == df.history_event_type.MASTERPIECE_CREATED_ITEM_IMPROVEMENT and k == "improvement_type" then + io.write ("\t\t"..""..df.improvement_type[v]:lower().."".."\n") + elseif ((event:getType() == df.history_event_type.HIST_FIGURE_REACH_SUMMIT and k == "figures") or + (event:getType() == df.history_event_type.HIST_FIGURE_NEW_PET and k == "group") + or (event:getType() == df.history_event_type.BODY_ABUSED and k == "bodies")) then + for detailK,detailV in pairs(v) do + io.write ("\t\t".."<"..k..">"..detailV.."".."\n") + end + elseif event:getType() == df.history_event_type.HIST_FIGURE_NEW_PET and k == "pets" then + for detailK,detailV in pairs(v) do + io.write ("\t\t".."<"..k..">"..(df.global.world.raws.creatures.all[detailV].creature_id):lower().."".."\n") + end + + elseif event:getType() == df.history_event_type.BODY_ABUSED and (k == "props") then + io.write ("\t\t".."<"..k.."_item_type"..">"..tostring(df.item_type[event.props.item.item_type]):lower().."".."\n") + io.write ("\t\t".."<"..k.."_item_subtype"..">"..getItemSubTypeName(event.props.item.item_type,event.props.item.item_subtype).."".."\n") + if (event.props.item.mat_type > -1) then + if (dfhack.matinfo.decode(event.props.item.mat_type, event.props.item.mat_index) == nil) then + io.write ("\t\t"..""..event.props.item.mat_type.."".."\n") + io.write ("\t\t"..""..event.props.item.mat_index.."".."\n") + else + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.props.item.mat_type, event.props.item.mat_index)).."".."\n") + end + end + --io.write ("\t\t".."<"..k.."_item_mat_type"..">"..tostring(event.props.item.mat_type).."".."\n") + --io.write ("\t\t".."<"..k.."_item_mat_index"..">"..tostring(event.props.item.mat_index).."".."\n") + io.write ("\t\t".."<"..k.."_pile_type"..">"..tostring(event.props.pile_type).."".."\n") + elseif event:getType() == df.history_event_type.ASSUME_IDENTITY and k == "identity" then + if (df.global.world.assumed_identities.all[v].histfig_id == -1) then + local thisIdentity = df.global.world.assumed_identities.all[v] + io.write ("\t\t"..""..thisIdentity.name.first_name.."".."\n") + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[thisIdentity.race].creature_id):lower().."".."\n") + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[thisIdentity.race].caste[thisIdentity.caste].caste_id):lower().."".."\n") + else + io.write ("\t\t"..""..df.global.world.assumed_identities.all[v].histfig_id.."".."\n") + end + elseif event:getType() == df.history_event_type.MASTERPIECE_CREATED_ARCH_CONSTRUCT and k == "building_type" then + io.write ("\t\t"..""..df.building_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.MASTERPIECE_CREATED_ARCH_CONSTRUCT and k == "building_subtype" then + if (df.building_type[event.building_type]:lower() == "furnace") then + io.write ("\t\t"..""..df.furnace_type[v]:lower().."".."\n") + elseif v > -1 then + io.write ("\t\t"..""..tostring(v).."".."\n") + end + elseif k == "race" then + if v > -1 then + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[v].creature_id):lower().."".."\n") + end + elseif k == "caste" then + if v > -1 then + io.write ("\t\t"..""..(df.global.world.raws.creatures.all[event.race].caste[v].caste_id):lower().."".."\n") + end + elseif k == "interaction" and event:getType() == df.history_event_type.HF_DOES_INTERACTION then + io.write ("\t\t"..""..df.global.world.raws.interactions[v].str[3].value.."".."\n") + io.write ("\t\t"..""..df.global.world.raws.interactions[v].str[4].value.."".."\n") + elseif k == "interaction" and event:getType() == df.history_event_type.HF_LEARNS_SECRET then + io.write ("\t\t"..""..df.global.world.raws.interactions[v].str[2].value.."".."\n") + elseif event:getType() == df.history_event_type.HIST_FIGURE_DIED and k == "weapon" then + for detailK,detailV in pairs(v) do + + if (detailK == "item") then + if detailV > -1 then + io.write ("\t\t".."<"..detailK..">"..detailV.."".."\n") + local thisItem = df.item.find(detailV) + if (thisItem ~= nil) then + if (thisItem.flags.artifact == true) then + for refk,refv in pairs(thisItem.general_refs) do + if (refv:getType() == 1) then + io.write ("\t\t"..""..refv.artifact_id.."".."\n") + break + end + end + end + end + + end + elseif (detailK == "item_type") then + if event.weapon.item > -1 then + io.write ("\t\t".."<"..detailK..">"..tostring(df.item_type[detailV]):lower().."".."\n") + end + elseif (detailK == "item_subtype") then + if event.weapon.item > -1 and detailV > -1 then + io.write ("\t\t".."<"..detailK..">"..getItemSubTypeName(event.weapon.item_type,detailV).."".."\n") + end + elseif (detailK == "mattype") then + if (detailV > -1) then + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.weapon.mattype, event.weapon.matindex)).."".."\n") + end + elseif (detailK == "matindex") then + + elseif (detailK == "shooter_item") then + if detailV > -1 then + io.write ("\t\t".."<"..detailK..">"..detailV.."".."\n") + local thisItem = df.item.find(detailV) + if thisItem ~= nil then + if (thisItem.flags.artifact == true) then + for refk,refv in pairs(thisItem.general_refs) do + if (refv:getType() == 1) then + io.write ("\t\t"..""..refv.artifact_id.."".."\n") + break + end + end + end + end + end + elseif (detailK == "shooter_item_type") then + if event.weapon.shooter_item > -1 then + io.write ("\t\t".."<"..detailK..">"..tostring(df.item_type[detailV]):lower().."".."\n") + end + elseif (detailK == "shooter_item_subtype") then + if event.weapon.shooter_item > -1 and detailV > -1 then + io.write ("\t\t".."<"..detailK..">"..getItemSubTypeName(event.weapon.shooter_item_type,detailV).."".."\n") + end + elseif (detailK == "shooter_mattype") then + if (detailV > -1) then + io.write ("\t\t"..""..dfhack.matinfo.toString(dfhack.matinfo.decode(event.weapon.shooter_mattype, event.weapon.shooter_matindex)).."".."\n") + end + elseif (detailK == "shooter_matindex") then + + elseif detailK == "slayer_race" or detailK == "slayer_caste" then + + else + io.write ("\t\t".."<"..detailK..">"..detailV.."".."\n") + end + end + elseif event:getType() == df.history_event_type.HIST_FIGURE_DIED and k == "death_cause" then + io.write ("\t\t".."<"..k..">"..df.death_type[v]:lower().."".."\n") + elseif event:getType() == df.history_event_type.CHANGE_HF_JOB and (k == "new_job" or k == "old_job") then + io.write ("\t\t".."<"..k..">"..df.profession[v]:lower().."".."\n") + else + io.write ("\t\t".."<"..k..">"..tostring(v).."".."\n") + end + + end + io.write ("\t".."".."\n") + end + end + io.write ("".."\n") + io.write ("".."\n") + io.write ("".."\n") + io.write ("".."\n") + io.write ("".."\n") + io.write ("".."\n") + io.close() +end + -- export information and XML ('p, x') function export_legends_info() print(' Exporting: World map/gen info') gui.simulateInput(vs, 'LEGENDS_EXPORT_MAP') print(' Exporting: Legends xml') gui.simulateInput(vs, 'LEGENDS_EXPORT_XML') + print(" Exporting: Extra legends_plus xml") + export_more_legends_xml() end -- presses 'd' for detailed maps