Skip to content

Commit

Permalink
Merge pull request #10 from FelixPflaum/fix-sod
Browse files Browse the repository at this point in the history
Fix error due to cata proj id missing in sod
  • Loading branch information
FelixPflaum authored May 2, 2024
2 parents 5964f04 + c88e650 commit e5bde71
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions ExportStructures/ItemSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,26 @@

local Env = select(2, ...)

-- Protobuf layouts. Strings are types for some weak type checking (on key creation only!)
-- Protobuf layout used in the sim. Strings are types for some weak type checking (on key creation only!)
local protobufLayout = {
[WOW_PROJECT_CLASSIC] = {
id = "number", --"int"
random_suffix = "number", --"int"
enchant = "number", --"int"
rune = "number", --"int"
},
[WOW_PROJECT_WRATH_CLASSIC] = {
id = "number", --"int"
enchant = "number", --"int"
gems = "table", --"int[]"
},
[WOW_PROJECT_CATACLYSM_CLASSIC] = {
id = "number", --"int"
enchant = "number", --"int"
gems = "table", --"int[]"
random_suffix = "number", --"int"
reforging = "number", --"int"
}
id = "number", -- int
enchant = "number", -- int
}

assert(protobufLayout[WOW_PROJECT_ID], "No ItemSpec structure defined for this client version!")
if Env.IS_CLASSIC_ERA then
protobufLayout.random_suffix = "number" -- int
if Env.IS_CLASSIC_ERA_SOD then
protobufLayout.rune = "number" -- int
end
elseif Env.IS_CLASSIC_WRATH then
protobufLayout.gems = "table" -- int[]
elseif Env.IS_CLASSIC_CATA then
protobufLayout.gems = "table" -- int[]
protobufLayout.random_suffix = "number" -- int
protobufLayout.reforging = "number" -- int
end

local ItemSpecMeta = { isItemSpec = true, _structure = protobufLayout[WOW_PROJECT_ID] }
local ItemSpecMeta = { isItemSpec = true, _structure = protobufLayout }
ItemSpecMeta.__index = ItemSpecMeta

---Prevent adding keys not defined in the chosen layout or with wrong type.
Expand Down

0 comments on commit e5bde71

Please sign in to comment.