Skip to content

Commit 1c107fe

Browse files
author
LocalIdentity
committed
Special tokens fix from PoB PR #9749
Just in case PoE 2 decides to add a new stat description format that includes 2 words like reminder text in PoE 1
1 parent 3ff8900 commit 1c107fe

3 files changed

Lines changed: 80 additions & 52 deletions

File tree

src/Data/StatDescriptions/stat_descriptions.lua

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,13 +2577,13 @@ return {
25772577
},
25782578
[4]={
25792579
[1]={
2580-
k="canonical_stat",
2581-
v=1
2582-
},
2583-
[2]={
25842580
k="canonical_line",
25852581
v=true
25862582
},
2583+
[2]={
2584+
k="canonical_stat",
2585+
v=1
2586+
},
25872587
limit={
25882588
[1]={
25892589
[1]=2,
@@ -10573,13 +10573,13 @@ return {
1057310573
},
1057410574
[2]={
1057510575
[1]={
10576-
k="canonical_stat",
10577-
v=2
10578-
},
10579-
[2]={
1058010576
k="canonical_line",
1058110577
v=true
1058210578
},
10579+
[2]={
10580+
k="canonical_stat",
10581+
v=2
10582+
},
1058310583
limit={
1058410584
[1]={
1058510585
[1]="#",
@@ -20086,13 +20086,13 @@ return {
2008620086
},
2008720087
[3]={
2008820088
[1]={
20089-
k="canonical_stat",
20090-
v=1
20091-
},
20092-
[2]={
2009320089
k="canonical_line",
2009420090
v=true
2009520091
},
20092+
[2]={
20093+
k="canonical_stat",
20094+
v=1
20095+
},
2009620096
limit={
2009720097
[1]={
2009820098
[1]=1,
@@ -37389,13 +37389,13 @@ return {
3738937389
},
3739037390
[3]={
3739137391
[1]={
37392-
k="canonical_stat",
37393-
v=1
37394-
},
37395-
[2]={
3739637392
k="canonical_line",
3739737393
v=true
3739837394
},
37395+
[2]={
37396+
k="canonical_stat",
37397+
v=1
37398+
},
3739937399
limit={
3740037400
[1]={
3740137401
[1]="#",
@@ -51862,13 +51862,13 @@ return {
5186251862
v=1
5186351863
},
5186451864
[2]={
51865-
k="canonical_stat",
51866-
v=2
51867-
},
51868-
[3]={
5186951865
k="canonical_line",
5187051866
v=true
5187151867
},
51868+
[3]={
51869+
k="canonical_stat",
51870+
v=2
51871+
},
5187251872
limit={
5187351873
[1]={
5187451874
[1]="#",
@@ -52967,13 +52967,13 @@ return {
5296752967
},
5296852968
[2]={
5296952969
[1]={
52970-
k="negate",
52971-
v=1
52972-
},
52973-
[2]={
5297452970
k="canonical_line",
5297552971
v=true
5297652972
},
52973+
[2]={
52974+
k="negate",
52975+
v=1
52976+
},
5297752977
limit={
5297852978
[1]={
5297952979
[1]="#",
@@ -84302,13 +84302,13 @@ return {
8430284302
v=2
8430384303
},
8430484304
[2]={
84305-
k="canonical_stat",
84306-
v=1
84307-
},
84308-
[3]={
8430984305
k="canonical_line",
8431084306
v=true
8431184307
},
84308+
[3]={
84309+
k="canonical_stat",
84310+
v=1
84311+
},
8431284312
limit={
8431384313
[1]={
8431484314
[1]="#",

src/Export/Scripts/statdesc.lua

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,33 @@ local function processStatFile(name, changeOutLocation)
6868
end
6969
table.insert(desc.limit, limit)
7070
end
71-
for k, v in special:gmatch("([%w%%_]+) (%d+)") do
72-
table.insert(desc, {
73-
k = k,
74-
v = tonumber(v) or v,
75-
})
76-
nk[k] = v
71+
local specialTokens = { }
72+
for token in special:gmatch("([%w%%_]+)") do
73+
table.insert(specialTokens, token)
7774
end
78-
if special:match("canonical_line") then
79-
table.insert(desc, {
80-
k = "canonical_line",
81-
v = true,
82-
})
83-
nk["canonical_line"] = true
75+
local tokenIndex = 1
76+
while tokenIndex <= #specialTokens do
77+
local token = specialTokens[tokenIndex]
78+
if token == "canonical_line" then
79+
table.insert(desc, {
80+
k = "canonical_line",
81+
v = true,
82+
})
83+
nk["canonical_line"] = true
84+
tokenIndex = tokenIndex + 1
85+
else
86+
local value = specialTokens[tokenIndex + 1]
87+
if value then
88+
table.insert(desc, {
89+
k = token,
90+
v = tonumber(value) or value,
91+
})
92+
nk[token] = value
93+
tokenIndex = tokenIndex + 2
94+
else
95+
tokenIndex = tokenIndex + 1
96+
end
97+
end
8498
end
8599
if quality:match("gem_quality") then
86100
desc[quality] = true

src/Export/statdesc.lua

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,33 @@ function loadStatFile(fileName)
6969
end
7070
table.insert(desc.limit, limit)
7171
end
72-
for k, v in special:gmatch("([%w%%_]+) (%d+)") do
73-
table.insert(desc, {
74-
k = k,
75-
v = tonumber(v) or v,
76-
})
77-
nk[k] = v
72+
local specialTokens = { }
73+
for token in special:gmatch("([%w%%_]+)") do
74+
table.insert(specialTokens, token)
7875
end
79-
if special:match("canonical_line") then
80-
table.insert(desc, {
81-
k = "canonical_line",
82-
v = true,
83-
})
84-
nk["canonical_line"] = true
76+
local tokenIndex = 1
77+
while tokenIndex <= #specialTokens do
78+
local token = specialTokens[tokenIndex]
79+
if token == "canonical_line" then
80+
table.insert(desc, {
81+
k = "canonical_line",
82+
v = true,
83+
})
84+
nk["canonical_line"] = true
85+
tokenIndex = tokenIndex + 1
86+
else
87+
local value = specialTokens[tokenIndex + 1]
88+
if value then
89+
table.insert(desc, {
90+
k = token,
91+
v = tonumber(value) or value,
92+
})
93+
nk[token] = value
94+
tokenIndex = tokenIndex + 2
95+
else
96+
tokenIndex = tokenIndex + 1
97+
end
98+
end
8599
end
86100
if quality:match("gem_quality") then
87101
desc[quality] = true

0 commit comments

Comments
 (0)