@@ -3,13 +3,32 @@ if not loadStatFile then
33end
44loadStatFile (" stat_descriptions.csd" )
55
6+ -- not comprehensive. see moddomains table in export tool and enums.lua
7+ local Domains = {
8+ GenericMod = 1 ,
9+ FlaskCharm = 2 ,
10+ Jewel = 11 ,
11+ UniqueJewel = 22 ,
12+ Veiled = 28 ,
13+ -- not actually present on the table, but still referenced by mods
14+ IncursionLimb = 37 ,
15+ }
16+
17+ local GenTypes = {
18+ Prefix = 1 ,
19+ Suffix = 2 ,
20+ -- includes both implicit mods and unique explicit mods
21+ Intrinsic = 3 ,
22+ Corruption = 5 ,
23+ }
24+
625function table .containsId (table , element )
7- for _ , value in pairs (table ) do
8- if value .Id == element then
9- return true
10- end
11- end
12- return false
26+ for _ , value in pairs (table ) do
27+ if value .Id == element then
28+ return true
29+ end
30+ end
31+ return false
1332end
1433
1534local whiteListStat = {
@@ -28,32 +47,28 @@ local function writeMods(outName, condFunc)
2847 local stats , orders , missing = describeMod (mod )
2948 if missing [1 ] then
3049 local printHeader = true
31- for k , _ in pairs (missing ) do
50+ for k , _ in pairs (missing ) do
3251 if k ~= 1 and not whiteListStat [k ] then
3352 if printHeader then
3453 printHeader = false
3554 ConPrintf (" ====================================" )
36- ConPrintf (" Mod '" .. mod .Id .. " ' is missing stats:" )
55+ ConPrintf (" Mod '" .. mod .Id .. " ' is missing stats:" )
3756 end
3857 ConPrintf (' %s' , k )
3958 end
4059 end
4160 end
4261 if # orders > 0 then
4362 out :write (' \t ["' , mod .Id , ' "] = { ' )
44- if mod .GenerationType == 1 then
63+ if mod .GenerationType == GenTypes . Prefix then
4564 out :write (' type = "Prefix", ' )
46- elseif mod .GenerationType == 2 then
65+ elseif mod .GenerationType == GenTypes . Suffix then
4766 out :write (' type = "Suffix", ' )
48- elseif mod .GenerationType == 3 then
49- if mod .Domain == 1 and mod .Id :match (" ^Synthesis" ) then
50- out :write (' type = "Synthesis", ' )
51- elseif mod .Domain == 16 then
52- out :write (' type = "DelveImplicit", ' )
53- elseif mod .Id :match (" SpecialCorruption" ) then
67+ elseif mod .GenerationType == GenTypes .Intrinsic then
68+ if mod .Id :match (" SpecialCorruption" ) then
5469 out :write (' type = "SpecialCorrupted", ' )
5570 end
56- elseif mod .GenerationType == 5 then
71+ elseif mod .GenerationType == GenTypes . Corruption then
5772 out :write (' type = "Corrupted", ' )
5873 end
5974 out :write (' affix = "' , mod .Name , ' ", ' )
@@ -63,7 +78,7 @@ local function writeMods(outName, condFunc)
6378 table.remove (orders , index )
6479 break
6580 end
66- end
81+ end
6782 out :write (' "' , table.concat (stats , ' ", "' ), ' ", ' )
6883 out :write (' statOrder = { ' , table.concat (orders , ' , ' ), ' }, ' )
6984 out :write (' level = ' , mod .Level , ' , group = "' , mod .Type .Id , ' ", ' )
@@ -75,7 +90,7 @@ local function writeMods(outName, condFunc)
7590 out :write (' weightVal = { ' , table.concat (mod .SpawnWeight , ' , ' ), ' }, ' )
7691 if mod .GenerationWeightTags [1 ] then
7792 -- make large clusters only have 1 notable suffix
78- if mod .GenerationType == 2 and mod .Tags [1 ] and outName == " ../Data/ModJewelCluster.lua" and mod .Tags [1 ].Id == " has_affliction_notable" then
93+ if mod .GenerationType == GenTypes . Suffix and mod .Tags [1 ] and outName == " ../Data/ModJewelCluster.lua" and mod .Tags [1 ].Id == " has_affliction_notable" then
7994 out :write (' weightMultiplierKey = { "has_affliction_notable2", ' )
8095 for _ , tag in ipairs (mod .GenerationWeightTags ) do
8196 out :write (' "' , tag .Id , ' ", ' )
@@ -159,13 +174,13 @@ local function writeMods(outName, condFunc)
159174 end
160175 out :write (" tradeHashes = { " )
161176 for hash , desc in pairs (tradeHashes ) do
162- local descriptionLines = ' "' .. table.concat (desc , ' ", "' ).. ' "'
177+ local descriptionLines = ' "' .. table.concat (desc , ' ", "' ) .. ' "'
163178 out :write (string.format (' [%d] = { %s }, ' , hash , descriptionLines ))
164179 end
165180 out :write (' } ' )
166181 out :write (' },\n ' )
167182 else
168- print (" Mod '" .. mod .Id .. " ' has no stats" )
183+ print (" Mod '" .. mod .Id .. " ' has no stats" )
169184 end
170185 end
171186 :: continue::
@@ -175,32 +190,41 @@ local function writeMods(outName, condFunc)
175190end
176191
177192writeMods (" ../Data/ModItem.lua" , function (mod )
178- return mod .Domain == 1 and (mod .GenerationType == 1 or mod .GenerationType == 2 )
179- and (mod .Family [1 ] and mod .Family [1 ].Id ~= " AuraBonus" or not mod .Family [1 ]) and (not mod .Id :match (" Cowards" )) and not mod .Id :match (" Master" )
193+ return mod .Domain == Domains .GenericMod and
194+ (mod .GenerationType == GenTypes .Prefix or mod .GenerationType == GenTypes .Suffix )
195+ and (mod .Family [1 ] and mod .Family [1 ].Id ~= " AuraBonus" or not mod .Family [1 ]) and (not mod .Id :match (" Cowards" )) and
196+ not mod .Id :match (" Master" )
180197end )
181198writeMods (" ../Data/ModCorrupted.lua" , function (mod )
182- return (mod .Domain == 11 or mod .Domain == 1 ) and (mod .GenerationType == 3 and mod .Id :match (" SpecialCorruption" ) or mod .GenerationType == 5 )
199+ return (mod .Domain == Domains .Jewel or mod .Domain == Domains .GenericMod ) and
200+ (mod .GenerationType == GenTypes .Intrinsic and mod .Id :match (" SpecialCorruption" ) or mod .GenerationType == GenTypes .Corruption )
183201end )
184202writeMods (" ../Data/ModFlask.lua" , function (mod )
185- return mod .Domain == 2 and (mod .GenerationType == 1 or mod .GenerationType == 2 ) and mod .Id :match (" ^Flask" )
203+ return mod .Domain == Domains .FlaskCharm and
204+ (mod .GenerationType == GenTypes .Prefix or mod .GenerationType == GenTypes .Suffix ) and mod .Id :match (" ^Flask" )
186205end )
187206writeMods (" ../Data/ModCharm.lua" , function (mod )
188- return mod .Domain == 2 and ((mod .GenerationType == 1 and mod .Id :match (" ^Charm" ))
189- or (mod .GenerationType == 2 and not mod .Id :match (" Immunity" )))
207+ return mod .Domain == Domains . FlaskCharm and ((mod .GenerationType == GenTypes . Prefix and mod .Id :match (" ^Charm" ))
208+ or (mod .GenerationType == GenTypes . Suffix and not mod .Id :match (" Immunity" )))
190209end )
191210writeMods (" ../Data/ModJewel.lua" , function (mod )
192- return (mod .Domain == 11 and (mod .GenerationType == 1 or mod .GenerationType == 2 )) or (mod .Domain == 21 and mod .GenerationType == 3 )
211+ return (mod .Domain == Domains .Jewel and (mod .GenerationType == GenTypes .Prefix or mod .GenerationType == GenTypes .Suffix )) or
212+ (mod .Domain == Domains .FlaskCharm1 and mod .GenerationType == GenTypes .Intrinsic )
193213end )
194214writeMods (" ../Data/ModIncursionLimb.lua" , function (mod )
195- return (mod .Domain == 37 and mod .GenerationType == 3 )
196- end )
197- writeMods (" ../Data/ModItemExclusive.lua" , function (mod ) -- contains primarily uniques and items implicits but also other mods only available on a single base or unique.
198- return (mod .Domain == 1 or mod .Domain == 2 or mod .Domain == 11 or mod .Domain == 22 ) and mod .GenerationType == 3
199- and (mod .Family [1 ] and mod .Family [1 ].Id ~= " AuraBonus" or not mod .Family [1 ])
200- and not mod .Id :match (" ^Synthesis" ) and not mod .Id :match (" Royale" ) and not mod .Id :match (" Cowards" ) and not mod .Id :match (" Map" ) and not mod .Id :match (" Ultimatum" ) and not mod .Id :match (" SpecialCorruption" )
215+ return (mod .Domain == Domains .IncursionLimb and mod .GenerationType == GenTypes .Intrinsic )
201216end )
217+ writeMods (" ../Data/ModItemExclusive.lua" ,
218+ -- contains primarily uniques and items implicits but also other mods only available on a single base or unique.
219+ function (mod )
220+ return (mod .Domain == Domains .GenericMod or mod .Domain == Domains .FlaskCharm or mod .Domain == Domains .Jewel or mod .Domain == Domains .UniqueJewel ) and
221+ mod .GenerationType == GenTypes .Intrinsic
222+ and (mod .Family [1 ] and mod .Family [1 ].Id ~= " AuraBonus" or not mod .Family [1 ])
223+ and not mod .Id :match (" ^Synthesis" ) and not mod .Id :match (" Royale" ) and not mod .Id :match (" Cowards" ) and
224+ not mod .Id :match (" Map" ) and not mod .Id :match (" Ultimatum" ) and not mod .Id :match (" SpecialCorruption" )
225+ end )
202226writeMods (" ../Data/ModVeiled.lua" , function (mod )
203- return mod .Domain == 28 and not mod .Id :match (" Map" )
227+ return mod .Domain == Domains . Veiled and not mod .Id :match (" Map" )
204228end )
205229
206230print (" Mods exported." )
0 commit comments