|
| 1 | +-- |
| 2 | +-- Export all playable skill gems from game data |
| 3 | +-- |
| 4 | +local out = io.open("../Export/Skills/SkillGems.txt", "w") |
| 5 | +out:write('-- This file is automatically generated, do not edit!\n') |
| 6 | +out:write('-- Gem data (c) Grinding Gear Games\n\n') |
| 7 | + |
| 8 | +local export = false |
| 9 | + |
| 10 | +local types = { "Strength", "Dexterity", "Intelligence", "Other" } |
| 11 | + |
| 12 | +local function grantedEffectString(grantedEffect) |
| 13 | + local s = "#skill "..grantedEffect.Id.."\n" |
| 14 | + for _, statSet in ipairs(grantedEffect.GrantedEffectStatSets) do |
| 15 | + if not (statSet.LabelType and statSet.LabelType.Id == "Hidden") then |
| 16 | + s = s.."#set "..statSet.Id.."\n#flags\n#mods\n" |
| 17 | + end |
| 18 | + end |
| 19 | + return s |
| 20 | +end |
| 21 | +for i, _ in ipairs(types) do |
| 22 | + local active = {} |
| 23 | + local support = {} |
| 24 | + local activeExport = {} |
| 25 | + local supportExport = {} |
| 26 | + local colour |
| 27 | + for skillGem in dat("SkillGems"):Rows() do |
| 28 | + for _, gemEffect in ipairs(skillGem.GemVariants) do |
| 29 | + if skillGem.Str >= 50 then |
| 30 | + colour = "Strength" |
| 31 | + elseif skillGem.Int >= 50 then |
| 32 | + colour = "Intelligence" |
| 33 | + elseif skillGem.Dex >= 50 then |
| 34 | + colour = "Dexterity" |
| 35 | + else |
| 36 | + colour = "Other" |
| 37 | + end |
| 38 | + if skillGem.IsSupport then |
| 39 | + local gemName = skillGem.BaseItemType.Name |
| 40 | + local gemId = gemEffect.Id |
| 41 | + if skillGem.GemColour == i and not gemId:match("Unknown") and not gemId:match("Playtest") and not gemId:match("Royale") and not gemName:match("DNT") and not gemName:match("UNUSED") and not gemName:match("NOT CURRENTLY USED") and not gemName:match("WIP") and not gemName:match("Unnamed") then |
| 42 | + local temp = skillGem.BaseItemType.Name..string.rep(" ", 45 - string.len(skillGem.BaseItemType.Name)).."\t\t----\t\t"..gemEffect.GrantedEffect.Id |
| 43 | + local temp1 = skillGem.BaseItemType.Name..grantedEffectString(gemEffect.GrantedEffect) |
| 44 | + if gemEffect.GrantedEffect2 then |
| 45 | + temp = temp.."\t"..gemEffect.GrantedEffect2.Id |
| 46 | + temp1 = temp1..grantedEffectString(gemEffect.GrantedEffect2) |
| 47 | + end |
| 48 | + table.insert(support, temp) |
| 49 | + table.insert(supportExport, temp1) |
| 50 | + end |
| 51 | + else |
| 52 | + local gemName = gemEffect.GrantedEffect.ActiveSkill.DisplayName |
| 53 | + local gemId = gemEffect.Id |
| 54 | + if gemName ~= "" and types[i] == colour and not gemId:match("Unknown") and not gemId:match("Playtest") and not gemId:match("Royale") and not gemName:match("%.%.%.") and not gemName:match("DNT") and not gemName:match("UNUSED") and not gemName:match("NOT CURRENTLY USED") and not gemName:match("Unnamed") and not gemEffect.GrantedEffect.Id:match("HardMode") and not skillGem.BaseItemType.Name:match("DNT") |
| 55 | + and not (skillGem.IsVaalGem and gemEffect.Variant ~= 3) then |
| 56 | + local temp = gemName..string.rep(" ", 45 - string.len(gemName)).."\t\t----\t\t"..gemEffect.GrantedEffect.Id |
| 57 | + local temp1 = gemName..grantedEffectString(gemEffect.GrantedEffect) |
| 58 | + if gemEffect.GrantedEffect2 and not skillGem.IsVaalGem then |
| 59 | + temp = temp.."\t"..gemEffect.GrantedEffect2.Id |
| 60 | + temp1 = temp1..grantedEffectString(gemEffect.GrantedEffect2) |
| 61 | + end |
| 62 | + table.insert(active, temp) |
| 63 | + table.insert(activeExport, temp1) |
| 64 | + end |
| 65 | + end |
| 66 | + end |
| 67 | + end |
| 68 | + table.sort(active) |
| 69 | + table.sort(support) |
| 70 | + table.sort(supportExport) |
| 71 | + table.sort(activeExport) |
| 72 | + |
| 73 | + for i, row in ipairs(supportExport) do |
| 74 | + -- Remove text before "#skill" only if it is at the start of the string |
| 75 | + supportExport[i] = string.gsub(row, "^(.-)#skill", "#skill") |
| 76 | + end |
| 77 | + for i, row in ipairs(activeExport) do |
| 78 | + -- Remove text before "#skill" only if it is at the start of the string |
| 79 | + activeExport[i] = string.gsub(row, "^(.-)#skill", "#skill") |
| 80 | + end |
| 81 | + |
| 82 | + out:write("\t\t\t\t\t\t--------- Active "..types[i].." ---------\n") |
| 83 | + if export == false then |
| 84 | + out:write(table.concat(active, "\n")) |
| 85 | + else |
| 86 | + out:write(table.concat(activeExport, "\n")) |
| 87 | + end |
| 88 | + out:write('\n\n') |
| 89 | + out:write("\t\t\t\t\t\t--------- Support "..types[i].." ---------\n") |
| 90 | + if export == false then |
| 91 | + out:write(table.concat(support, "\n")) |
| 92 | + else |
| 93 | + out:write(table.concat(supportExport, "\n")) |
| 94 | + end |
| 95 | + out:write('\n\n') |
| 96 | +end |
| 97 | + |
| 98 | +out:close() |
| 99 | + |
| 100 | +print("Skill gems exported.") |
0 commit comments