Skip to content

Instantly share code, notes, and snippets.

@ExtReMLapin
Created September 14, 2020 11:50
Show Gist options
  • Save ExtReMLapin/4f5bd8ba3aaa9fdfc2d83f076b886c3a to your computer and use it in GitHub Desktop.
Save ExtReMLapin/4f5bd8ba3aaa9fdfc2d83f076b886c3a to your computer and use it in GitHub Desktop.
tool used to find names of the mordhau faces bones
local gameinipath = "C:/Users/pierr/AppData/Local/Mordhau/Saved/Config/WindowsClient/Game.ini"
local BONE_LIP_INNER = 1
local BONE_LIP_INNER_EXT = 2
local BONE_MAXILIA = 3
local BONE_WHOLE_EYEBROW_1 = 4
local BONE_UNKNOWN_05 = 5
local BONE_WHOLE_EYEBROW_2 = 6
local BONE_EYE_1 = 7
local BONE_UNKNOWN_08 = 8
local BONE_UNKNOWN_09 = 9
local BONE_UNKNOWN_10 = 10
local BONE_WHOLE_MOUTH = 11
local BONE_EYE_2 = 12
local BONE_MOUTH_COMMISSURE_1 = 13
local BONE_MOUTH_COMMISSURE_2 = 14
local BONE_CHIN = 15
local BONE_OUTTER_JAW = 16
local BONE_CHEEK_1 = 17
local BONE_LOWERLIP_MIDDLE = 18
local BONE_LOWERLIP_1 = 19
local BONE_LOWERLIP_2 = 20
local BONE_UPPER_ZYGOMATIC_1 = 21
local BONE_UPPERLIP_MIDDLE = 22
local BONE_UPPERLIP_1 = 23
local BONE_UPPERLIP_2 = 24
local BONE_PHILTRUM = 25
local BONE_NOSE_TIP = 26
local BONE_NOSE_BRIDGE = 27
local BONE_GLABELLA = 28
local BONE_UPPER_ZYGOMATIC_2 = 29
local BONE_LOWER_ZYGOMATIC = 30
local BONE_CHEEK_2 = 31
local BONE_EYEBROWS_1_INNER = 32
local BONE_EYEBROWS_2_INNER = 33
local BONE_EYEBROWS_1_CENTER = 34
local BONE_EYEBROWS_2_CENTER = 35
local BONE_EYEBROWS_1_EXTERIOR = 36
local BONE_EYEBROWS_2_EXTERIOR = 37
local BONE_EAR1 = 38
local BONE_EAR2 = 39
local BONE_UNKNOWN_40 = 40
local BONE_UNKNOWN_41 = 41
local BONE_EYE_1_UPPERLID = 42
local BONE_EYE_1_LOWERLID = 43
local BONE_UNKNOWN_44 = 44
local BONE_UNKNOWN_45 = 45
local BONE_EYE_2_UPPERLID = 46
local BONE_EYE_2_LOWERLID = 47
local BONE_ZYGOMATIC = 48
local BONE_UNKNOWN_49 = 49
local tableDefinition = {"BONE_LIP_INNER", "BONE_LIP_INNER_EXT", "BONE_MAXILIA", "BONE_WHOLE_EYEBROW_1", "BONE_UNKNOWN_05", "BONE_WHOLE_EYEBROW_2", "BONE_EYE_1", "BONE_UNKNOWN_08", "BONE_UNKNOWN_09", "BONE_UNKNOWN_10", "BONE_WHOLE_MOUTH", "BONE_EYE_2", "BONE_MOUTH_COMMISSURE_1", "BONE_MOUTH_COMMISSURE_2", "BONE_CHIN", "BONE_OUTTER_JAW", "BONE_CHEEK_1", "BONE_LOWERLIP_MIDDLE", "BONE_LOWERLIP_1", "BONE_LOWERLIP_2", "BONE_UPPER_ZYGOMATIC_1", "BONE_UPPERLIP_MIDDLE", "BONE_UPPERLIP_1", "BONE_UPPERLIP_2", "BONE_PHILTRUM", "BONE_NOSE_TIP", "BONE_NOSE_BRIDGE", "BONE_GLABELLA", "BONE_UPPER_ZYGOMATIC_2", "BONE_LOWER_ZYGOMATIC", "BONE_CHEEK_2", "BONE_EYEBROWS_1_INNER", "BONE_EYEBROWS_2_INNER", "BONE_EYEBROWS_1_CENTER", "BONE_EYEBROWS_2_CENTER", "BONE_EYEBROWS_1_EXTERIOR", "BONE_EYEBROWS_2_EXTERIOR", "BONE_EAR1", "BONE_EAR2", "BONE_UNKNOWN_40", "BONE_UNKNOWN_41", "BONE_EYE_1_UPPERLID", "BONE_EYE_1_LOWERLID", "BONE_UNKNOWN_44", "BONE_UNKNOWN_45", "BONE_EYE_2_UPPERLID", "BONE_EYE_2_LOWERLID", "BONE_ZYGOMATIC", "BONE_UNKNOWN_49"}
local function split(pString, pPattern)
local Table = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pPattern
local last_end = 1
local s, e, cap = pString:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(Table, cap)
end
last_end = e + 1
s, e, cap = pString:find(fpat, last_end)
end
if last_end <= #pString then
cap = pString:sub(last_end)
table.insert(Table, cap)
end
return Table
end
local bonesTable = {
[BONE_LIP_INNER] = {0, 0, 0},
[BONE_LIP_INNER_EXT] = {0, 0, 0},
[BONE_MAXILIA] = {0, 0, 0},
[BONE_WHOLE_EYEBROW_1] = {0, 0, 0},
[BONE_UNKNOWN_05] = {0, 0, 0},
[BONE_WHOLE_EYEBROW_2] = {0, 0, 0},
[BONE_EYE_1] = {0, 0, 0},
[BONE_UNKNOWN_08] = {0, 0, 0},
[BONE_UNKNOWN_09] = {0, 0, 0},
[BONE_UNKNOWN_10] = {0, 0, 0},
[BONE_WHOLE_MOUTH] = {0, 0, 0},
[BONE_EYE_2] = {0, 0, 0},
[BONE_MOUTH_COMMISSURE_1] = {0, 0, 0},
[BONE_MOUTH_COMMISSURE_2] = {0, 0, 0},
[BONE_CHIN] = {0, 0, 0},
[BONE_OUTTER_JAW] = {0, 0, 0},
[BONE_CHEEK_1] = {0, 0, 0},
[BONE_LOWERLIP_MIDDLE] = {0, 0, 0},
[BONE_LOWERLIP_1] = {0, 0, 0},
[BONE_LOWERLIP_2] = {0, 0, 0},
[BONE_UPPER_ZYGOMATIC_1] = {0, 0, 0},
[BONE_UPPERLIP_MIDDLE] = {0, 0, 0},
[BONE_UPPERLIP_1] = {0, 0, 0},
[BONE_UPPERLIP_2] = {0, 0, 0},
[BONE_PHILTRUM] = {0, 0, 0},
[BONE_NOSE_TIP] = {0, 0, 0},
[BONE_NOSE_BRIDGE] = {0, 0, 0},
[BONE_GLABELLA] = {0, 0, 0},
[BONE_UPPER_ZYGOMATIC_2] = {0, 0, 0},
[BONE_LOWER_ZYGOMATIC] = {0, 0, 0},
[BONE_CHEEK_2] = {0, 0, 0},
[BONE_EYEBROWS_1_INNER] = {0, 0, 0},
[BONE_EYEBROWS_2_INNER] = {0, 0, 0},
[BONE_EYEBROWS_1_CENTER] = {0, 0, 0},
[BONE_EYEBROWS_2_CENTER] = {0, 0, 0},
[BONE_EYEBROWS_1_EXTERIOR] = {0, 0, 0},
[BONE_EYEBROWS_2_EXTERIOR] = {0, 0, 0},
[BONE_EAR1] = {0, 0, 0},
[BONE_EAR2] = {0, 0, 0},
[BONE_UNKNOWN_40] = {0, 0, 0},
[BONE_UNKNOWN_41] = {0, 0, 0},
[BONE_EYE_1_UPPERLID] = {0, 0, 0},
[BONE_EYE_1_LOWERLID] = {0, 0, 0},
[BONE_UNKNOWN_44] = {0, 0, 0},
[BONE_UNKNOWN_45] = {0, 0, 0},
[BONE_EYE_2_UPPERLID] = {0, 0, 0},
[BONE_EYE_2_LOWERLID] = {0, 0, 0},
[BONE_ZYGOMATIC] = {0, 0, 0},
[BONE_UNKNOWN_49] = {0, 0, 0}
}
local txt = [[CharacterProfiles=(Name=INVTEXT("TESTBONECHAR"),GearCustomization=(Wearables=((),(),(ID=30),(),(),(),(),(ID=15),(ID=8)),Equipment=((),(),())),AppearanceCustomization=(Emblem=0,EmblemColors=(0,0),MetalRoughnessScale=0,MetalTint=0,Age=0,Voice=0,VoicePitch=127,bIsFemale=False,Fat=85,Skinny=85,Strong=85,SkinColor=0,Face=0,EyeColor=0,HairColor=0,Hair=0,FacialHair=0,Eyebrows=0),FaceCustomization=(%s,%s,%s),SkillsCustomization=(Perks=0))]]
local function genCharacter()
local translateTable = {}
local rotateTable = {}
local scaleTable = {}
local i = 1
while (i <= 49) do
translateTable[i] = bonesTable[i][1]
rotateTable[i] = bonesTable[i][2]
scaleTable[i] = bonesTable[i][3]
i = i + 1
end
local translateString = string.format("Translate=(%s)", table.concat(translateTable, ","))
local rotateString = string.format("Rotate=(%s)", table.concat(rotateTable, ","))
local scaleString = string.format("Scale=(%s)", table.concat(scaleTable, ","))
return string.format(txt, translateString, rotateString, scaleString)
end
--print(genCharacter()) -- uncomment to create char with default vectors
local file = io.open(gameinipath)
local data = file:read("*all")
file:close()
local _start, _end = data:find([[TESTBONECHAR.-DefaultCharacterEquipment]])
_end = _end - 25
local str = data:sub(_start, _end)
local function strArrayToTable(str, nameToFind)
local _start, _end = string.find(str, nameToFind .. "=%(.-%)")
_start = _start + #nameToFind + 2
_end = _end - 1
local numbers = split(str:sub(_start, _end), ",")
local i = 1
while (i <= 49) do
numbers[i] = tonumber(numbers[i])
i = i + 1
end
return numbers
end
local function parseProfileBones(str)
local translateTable = strArrayToTable(str, "Translate")
local rotateTable = strArrayToTable(str, "Rotate")
local scaleTable = strArrayToTable(str, "Scale")
local repackedTable = {}
local i = 1
while i <= 49 do
repackedTable[i] = {translateTable[i], rotateTable[i], scaleTable[i]}
i = i + 1
end
return repackedTable
end
local function showProfileBones(table, hideNullBones, hideKnownBones)
local i = 1
while i < 49 do
if not hideNullBones or ((table[i][1] ~= 0) or table[i][2] ~= 0 or table[i][3] ~= 0) then
if not hideKnownBones or tableDefinition[i]:sub(1, 12) == "BONE_UNKNOWN" then
print(string.format("%s :\n\ttranslate : %i\n\trotate : %i\n\tscale: %i\n", tableDefinition[i], table[i][1], table[i][2], table[i][3]))
end
end
i = i + 1
end
end
showProfileBones(parseProfileBones(str), true, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment