Created
June 18, 2020 03:45
-
-
Save mburbea/3448b52585bfa965cc3e4800e16bc2d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function save_to_file(filename, data) | |
if io then | |
io.output(filename) | |
io.write(data) | |
io.flush() | |
end | |
end | |
function determine_category(actor) | |
local e = ACTOR.get_equip_type(actor) | |
if(e == "Weapon") then | |
local cats = {} | |
cats['Dagger']="Daggers" | |
cats['Sword'] = "Longsword" | |
cats['Two-Handed Sword'] = 'Greatsword' | |
cats['Staff'] = 'Staff' | |
cats['Wand'] = 'Sceptre' | |
cats['Mirror Blades']= 'Faeblades' | |
cats['Greathammer'] = 'Greathammer' | |
cats['Bow']='Longbow' | |
cats['Chakram']='Chakrams' | |
return cats[inventory_win.get_weapon_type(actor)] | |
end | |
return e | |
end | |
function get_hex_of_raw_id(v) | |
return ("%06X"):format(TELEMETRY.get_database_id_specified_object_was_created_from(v)) | |
end | |
function get_buff_strings(actor) | |
local prefix = '' | |
local normal = '' | |
local buffs = buff_utils.get_buff_ids_on_item(actor) | |
for i,buff in ipairs(buffs) do | |
local id = tostring(buff["id"]):sub(5,10):upper() | |
if(buff["buff_type"] == 'owner') then | |
normal = normal .. id | |
elseif(buff["buff_type"] == 'self') then | |
prefix = prefix .. id | |
end | |
end | |
return prefix, normal | |
end | |
function dump_item_names(tbl,simtypes) | |
local callback = function(text, canceled) | |
op = {} | |
local rarity_text = {"Common","Infrequent","Rare","Unique","Set"} | |
for i = 1,#tbl do | |
local actor = tbl[i] | |
WINDOW.populate_edit_box(name_win.m_editbox, actor) | |
local name = WINDOW.get_editbox_text(name_win.m_editbox) | |
local telem = get_hex_of_raw_id(actor) | |
local prefix,normal = get_buff_strings(actor) | |
local category = determine_category(actor) | |
local content = { | |
category, | |
telem, | |
name, | |
simtypes[telem], | |
ACTOR.get_item_level(actor), | |
buff_utils.get_total_sockets_on_item(actor), | |
rarity_text[buff_utils.get_item_rarity(actor)], | |
prefix, | |
normal | |
} | |
if(category ~= nil) then | |
local line = table.concat(content,',') | |
op[#op + 1] =line | |
end | |
end | |
save_to_file("items.txt", table.concat(op,'\n')) | |
end | |
name_win.launch(SL(357894144), tbl[1], true, 32, callback, false) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment