-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QoL Enums Data file was added, Trade Data relative was added (#7275)
* QoL Enums Data file was added, Trade Data relative was added * COmmentas was added, Unused variable was removed * Method was renamed * Tooltips was added * Enum indentation was fixed * Enum indentation was fixed v2 --------- Co-authored-by: justjuangui <[email protected]>
- Loading branch information
1 parent
4d9e848
commit b2f5081
Showing
5 changed files
with
307 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
local band = bit.band | ||
local rshift = bit.rshift | ||
local push = table.insert | ||
local schar = string.char | ||
|
||
local function writeNum(n, c) | ||
local bytes = {} | ||
for i = 1, c do | ||
push(bytes, schar(band(n, 0xFF))) | ||
n = rshift(n, 8) | ||
end | ||
return table.concat(bytes) | ||
end | ||
|
||
function len(t) | ||
local count = 0 | ||
for _ in pairs(t) do count = count + 1 end | ||
return count | ||
end | ||
|
||
local function writeEnum(filename, enumTable) | ||
local filenameAbs = "./ggpk/data/" .. filename | ||
local out = io.open(filenameAbs, "wb") | ||
local size = len(enumTable) | ||
|
||
out:write(writeNum(size,4)) | ||
|
||
-- Write fields | ||
local stringIndex = 8 | ||
for v, s in ipairs(enumTable) do | ||
out:write(writeNum(stringIndex,8)) | ||
local utf16 = convertUTF8to16(s) | ||
stringIndex = stringIndex + utf16:len() + 2 | ||
end | ||
|
||
-- data offset mark | ||
for i = 1, 8 do | ||
out:write(schar(0xBB)) | ||
end | ||
|
||
-- strings in utf16 | ||
for _, s in ipairs(enumTable) do | ||
out:write(convertUTF8to16(s) .. "\0\0") | ||
end | ||
|
||
out:close() | ||
print("Wrote " .. size .. " enum types to " .. filename) | ||
end | ||
|
||
|
||
-- influenced types | ||
local influenceTypes = { | ||
"Shaper", | ||
"Elder", | ||
"Crusader", | ||
"Eyrie", | ||
"Basilisk", | ||
"Adjudicator", | ||
"None" | ||
} | ||
|
||
writeEnum("influenceTypes.dat64", influenceTypes) | ||
|
||
-- passive Skills types | ||
local passiveSkillTypes = { | ||
"Passive Tree", | ||
"Atlas Tree" | ||
} | ||
writeEnum("passiveSkillTypes.dat64", passiveSkillTypes) |
Oops, something went wrong.