-
Notifications
You must be signed in to change notification settings - Fork 389
Expand file tree
/
Copy pathmiscdata.lua
More file actions
174 lines (159 loc) · 6.49 KB
/
Copy pathmiscdata.lua
File metadata and controls
174 lines (159 loc) · 6.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
local out = io.open("../Data/Misc.lua", "w")
out:write("-- This file is automatically generated, do not edit!\n\n")
out:write('local data = ...\n')
local evasion = ""
local accuracy = ""
local life = ""
local allyLife = ""
local allyDamage = ""
local damage = ""
local armour = ""
local ailmentThreshold = ""
local poiseThreshold = ""
local leechResistance = ""
local minionLevel = ""
for stats in dat("DefaultMonsterStats"):Rows() do
evasion = evasion .. stats.Evasion .. ", "
accuracy = accuracy .. stats.Accuracy .. ", "
life = life .. stats.MonsterLife .. ", "
allyLife = allyLife .. stats.MinionLife .. ", "
damage = damage .. stats.Damage .. ", "
allyDamage = allyDamage .. stats.MinionDamage .. ", "
armour = armour .. stats.Armour .. ", "
ailmentThreshold = ailmentThreshold .. stats.AilmentThreshold .. ", "
poiseThreshold = poiseThreshold .. stats.PoiseThreshold .. ", "
leechResistance = leechResistance .. stats.LeechResistance .. ", "
end
-- Table was incorrect is PoE 1 but seems to be correct for PoE 2. Keeping here just in case
--for i = 1, 100 do
--armour = armour .. math.floor((dat("GameConstants"):GetRow("Id", "MonsterArmourBase").Value + 2.5 * i ) * ( ( 1 + dat("GameConstants"):GetRow("Id", "MonsterArmourImprovement").Value / dat("GameConstants"):GetRow("Id", "MonsterArmourImprovement").Divisor / 100 ) ^ i)) .. ", "
--end
out:write('-- From DefaultMonsterStats.dat\n')
out:write('data.monsterEvasionTable = { '..evasion..'}\n') --This table is off by about 0.5% in some cases but is quicker than generating the value at runtime
out:write('data.monsterAccuracyTable = { '..accuracy..'}\n')
out:write('data.monsterLifeTable = { '..life..'}\n')
out:write('data.monsterAllyLifeTable = { '..allyLife..'}\n')
out:write('data.monsterDamageTable = { '..damage..'}\n')
out:write('data.monsterAllyDamageTable = { '..allyDamage..'}\n')
out:write('data.monsterArmourTable = { '..armour..'}\n')
out:write('data.monsterAilmentThresholdTable = { '..ailmentThreshold..'}\n')
out:write('data.monsterPoiseThresholdTable = { '..poiseThreshold..'}\n')
out:write('data.monsterLeechResistanceTable = { '..leechResistance..'}\n')
out:write('\n')
out:write('-- From MinionGemLevelScaling.dat\n')
for level in dat("MinionGemLevelScaling"):Rows() do
minionLevel = minionLevel .. level.MinionLevel .. ", "
end
out:write('data.minionLevelTable = { '..minionLevel..'}\n')
out:write('\n')
out:write('-- From GameConstants.dat\n')
out:write('data.gameConstants = {\n')
for row in dat("GameConstants"):Rows() do
out:write('\t["' .. row.Id .. '"] = ' .. row.Value / row.Divisor .. ',\n')
end
out:write('}\n')
out:write('-- From Metadata/Characters/Character.ot\n')
out:write('data.characterConstants = {\n')
local file = getFile("Metadata/Characters/Character.ot")
if not file then return nil end
local text = convertUTF16to8(file)
local inWantedBlock = false
for line in text:gmatch("[^\r\n]+") do
-- Detect start of a block
if line:match("^Stats") or line:match("^Pathfinding") then
inWantedBlock = true
elseif inWantedBlock and line:match("^}") then
inWantedBlock = false
elseif inWantedBlock and line:find("=") then
local key, value = line:gsub("%s+",""):match("^(.-)=(.+)$")
if key and value then
out:write('\t["' .. key .. '"] = ' .. value .. ',\n')
end
end
end
out:write('}\n')
out:write('-- From Metadata/Monsters/Monster.ot\n')
out:write('data.monsterConstants = {\n')
local file = getFile("Metadata/Monsters/Monster.ot")
if not file then return nil end
local text = convertUTF16to8(file)
local inWantedBlock = false
for line in text:gmatch("[^\r\n]+") do
-- Detect start of a block
if line:match("^Stats") then
inWantedBlock = true
elseif inWantedBlock and line:match("^}") then
inWantedBlock = false
elseif inWantedBlock and line:find("=") then
local key, value = line:gsub("%s+",""):match("^(.-)=(.+)$")
if key and value then
out:write('\t["' .. key .. '"] = ' .. value .. ',\n')
end
end
end
out:write('}\n')
out:write('-- From PlayerMinionIntrinsicStats.dat\n')
out:write('data.playerMinionIntrinsicStats = {\n')
for row in dat("PlayerMinionIntrinsicStats"):Rows() do
out:write('\t["' .. row.Id.Id .. '"] = ' .. row.Value .. ',\n')
end
out:write('}\n')
local totemMult = ""
local keys = { }
for var in dat("SkillTotemVariations"):Rows() do
if not keys[var.SkillTotem] then
keys[var.SkillTotem] = true
totemMult = totemMult .. "[" .. var.SkillTotem .. "] = " .. ((var.MonsterVariety and var.MonsterVariety.LifeMultiplier / 100) or 1) .. ", "
end
end
out:write('-- From MonsterVarieties.dat combined with SkillTotemVariations.dat\n')
out:write('data.totemLifeMult = { '..totemMult..'}\n')
--[[out:write('-- From ActiveSkillType.dat\n') --Export list for use in Global.lua
out:write('data.skillTypeMap = {\n')
local skillTypeMap = { }
for row in dat("ActiveSkillType"):Rows() do
out:write('\t' .. row.Id .. ' = ' .. row._rowIndex .. ',\n')
end
out:write('}\n')]]
out:write('data.monsterVarietyLifeMult = {\n')
local cachedEntry = { }
for row in dat("MonsterVarieties"):Rows() do
for _, mod in ipairs(row.Mods) do
if mod.Id == "MonsterNecromancerRaisable" and not cachedEntry['"' .. row.Name .. '"'] then
out:write('\t["' .. row.Name .. '"] = ' .. row.LifeMultiplier/100 .. ',\n')
cachedEntry['"' .. row.Name .. '"'] = true
break
end
end
end
out:write('}\n')
out:write('-- From MonsterMapDifficulty.dat\n')
out:write('data.mapLevelLifeMult = { ')
for row in dat("MonsterMapDifficulty"):Rows() do
out:write('[' .. row.AreaLevel .. '] = ' .. (1+row.LifePercentIncrease/100) .. ', ')
end
out:write('}\n')
local mapBossLifeMult = ""
local mapBossAilmentMult = ""
for var in dat("MonsterMapBossDifficulty"):Rows() do
mapBossLifeMult = mapBossLifeMult .. "[" .. var.AreaLevel .. "] = " .. 1 + var.BossLifePercentIncrease / 100 .. ", "
mapBossAilmentMult = mapBossAilmentMult .. "[" .. var.AreaLevel .. "] = " .. (100 + var.BossAilmentPercentDecrease) / 100 .. ", "
end
out:write('-- From MonsterMapBossDifficulty.dat\n')
out:write('data.mapLevelBossLifeMult = { '..mapBossLifeMult..'}\n')
out:write('data.mapLevelBossAilmentMult = { '..mapBossAilmentMult..'}\n')
out:write('\n')
out:write('-- From FlatPhysicalDamageValues.dat\n')
out:write('data.hollowPalmAddedPhys = {\n')
for row in dat("FlatPhysicalDamageValues"):Rows() do
out:write('\t[' .. row.Level .. '] = { ' .. row.MinPhys .. ', ' .. row.MaxPhys .. ' },\n')
end
out:write('}\n')
out:write('-- From GoldRespecPrices.dat\n')
out:write('data.goldRespecPrices = { ')
for row in dat("GoldRespecPrices"):Rows() do
out:write(row.Cost .. ', ')
end
out:write('}\n')
out:close()
print("Misc data exported.")