Last active
December 25, 2018 04:26
-
-
Save jfmherokiller/b733d1ee8c72080f60ad102fa6eb164f to your computer and use it in GitHub Desktop.
function that can fix those hashes in wd2
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<object hash="72DE4948"> | |
<field type="BinHex" name="disNomadObjectId">4410C2C602000080</field> | |
<field type="BinHex" name="hidSingleObject" /> | |
<field type="BinHex" name="hidKey">4410C2C602000080</field> | |
<field type="BinHex" name="hidValidationFailed" /> | |
<field type="BinHex" name="text_hidName">546573742E5465737400</field> | |
<field type="BinHex" name="hidName">21B0773B</field> | |
<object hash="027DD861"> | |
<field type="BinHex" name="bPGTCompliant" /> | |
<field type="BinHex" name="uiDifficultyValue">0A</field> | |
<field type="BinHex" name="bCanPatrol">01</field> | |
</object> | |
<object hash="C89E3217"> | |
<field type="BinHex" name="bIsBuddyAI" /> | |
<field type="BinHex" name="bIsPlayerAlly" /> | |
<field type="BinHex" name="selMindSet">01</field> | |
<field type="BinHex" name="bForceRespawnAfterCheckpoint" /> | |
<field type="BinHex" name="stimtableStimEffectTable">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="navigationconfigNavigationConfig">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="fleebehaviordescriptorFleeConfig">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="rewardconfigRewardConfig">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="selAgentSpecies">01</field> | |
<field type="BinHex" name="fHealth">00B751C8</field> | |
<field type="BinHex" name="locdmgconfigDamageLocationConfig">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="animalnavigationparametersNavigationParameters">07D0ACAD01000080</field> | |
<field type="BinHex" name="animalfleeparametersFleeParameters">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="animalproximityparametersProximityParameters">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="animalanimationparametersAnimationParameters">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="bTaggingEnabled" /> | |
<field type="BinHex" name="fHackableSpawnPercentage">00000000</field> | |
<object hash="60E0032E"> | |
<field type="BinHex" name="SoundId" /> | |
<field hash="EE1824B1" type="BinHex">00</field> | |
</object> | |
<object hash="54CB6470"> | |
<field type="BinHex" name="SoundId" /> | |
<field hash="EE1824B1" type="BinHex">00</field> | |
</object> | |
<object hash="771E28FE"> | |
<field type="BinHex" name="disNomadObjectId">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="hidSingleObject" /> | |
<field type="BinHex" name="hidKey">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="hidValidationFailed" /> | |
<field type="BinHex" name="hidName">FFFFFFFF</field> | |
<field type="BinHex" name="graphickitmodelModel">FFFFFFFFFFFFFFFF</field> | |
<field type="BinHex" name="graphickitcollectionCollection">FFFFFFFFFFFFFFFF</field> | |
<object hash="CF8E3B18"> | |
<object hash="792B0429" /> | |
<object hash="59816741" /> | |
<object hash="CB5F0202" /> | |
</object> | |
<object hash="9D1BFC8F" /> | |
</object> | |
</object> | |
</object> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<object hash="72DE4948"> | |
<field hash="1FE8D41C" type="BinHex">4410C2C602000080</field> | |
<field hash="61FC6B02" type="BinHex" /> | |
<field hash="389F6DA7" type="BinHex">4410C2C602000080</field> | |
<field hash="A788914C" type="BinHex" /> | |
<field hash="9D8873F8" type="BinHex">546573742E5465737400</field> | |
<field hash="B9295CC7" type="BinHex">21B0773B</field> | |
<object hash="027DD861"> | |
<field hash="E254842A" type="BinHex" /> | |
<field hash="B41DFEBB" type="BinHex">0A</field> | |
<field hash="ABDA9380" type="BinHex">01</field> | |
</object> | |
<object hash="C89E3217"> | |
<field hash="8BB90240" type="BinHex" /> | |
<field hash="94FC9C48" type="BinHex" /> | |
<field hash="D63D7E8F" type="BinHex">01</field> | |
<field hash="F9A268B6" type="BinHex" /> | |
<field hash="43498FF5" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="E4EE4065" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="E6D1854C" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="797F004C" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="F247526F" type="BinHex">01</field> | |
<field hash="0DBE2127" type="BinHex">00B751C8</field> | |
<field hash="0325E644" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="E1826EE0" type="BinHex">07D0ACAD01000080</field> | |
<field hash="B231E372" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="755BC2FD" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="5F143BBA" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="94D937BC" type="BinHex" /> | |
<field hash="AEEB84B3" type="BinHex">00000000</field> | |
<object hash="60E0032E"> | |
<field hash="B8824CA5" type="BinHex" /> | |
<field hash="EE1824B1" type="BinHex">00</field> | |
</object> | |
<object hash="54CB6470"> | |
<field hash="B8824CA5" type="BinHex" /> | |
<field hash="EE1824B1" type="BinHex">00</field> | |
</object> | |
<object hash="771E28FE"> | |
<field hash="1FE8D41C" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="61FC6B02" type="BinHex" /> | |
<field hash="389F6DA7" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="A788914C" type="BinHex" /> | |
<field hash="B9295CC7" type="BinHex">FFFFFFFF</field> | |
<field hash="B8F64BF2" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<field hash="DADFC44A" type="BinHex">FFFFFFFFFFFFFFFF</field> | |
<object hash="CF8E3B18"> | |
<object hash="792B0429" /> | |
<object hash="59816741" /> | |
<object hash="CB5F0202" /> | |
</object> | |
<object hash="9D1BFC8F" /> | |
</object> | |
</object> | |
</object> |
This file contains hidden or 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
function FixHashes($XMLFilePath) { | |
function HexToString($i) { | |
$r = "" | |
for ($n = 0; $n -lt $i.Length; $n += 2) | |
{$r += [char][int]("0x" + $i.Substring($n,2))} | |
return $r | |
} | |
function ProduceHashTable() { | |
#Get a fresh version of the list | |
$TehContent = ((Invoke-WebRequest "https://gist.githubusercontent.com/wasdennnoch/17ae986e1960b9723a476e0d424fb036/raw/c4794191cdfef3ff7347aec80cc8f638fa3212af/merged_wd_crc32_dump.txt").Content).Split([Environment]::NewLine) | |
$RealContents = @{} | |
$tabset = HexToString("0909") | |
foreach ($line in $TehContent) { | |
$Realline = $line.Replace($tabset, ",").Split(",") | |
try { | |
$RealContents.Add($Realline[0], $Realline[1]) | |
} | |
catch { | |
$RealContents.Remove($Realline[0]) | |
$RealContents.Add($Realline[0], $Realline[1]) | |
} | |
} | |
return $RealContents | |
} | |
[xml]$XmlDoc = Get-Content $XMLFilePath | |
$TheHashTable = ProduceHashTable | |
#get those nodes with hashes | |
$specialNodes = $XmlDoc.SelectNodes(".//field[@hash]|object[@hash]") | |
#perform the needed edits | |
foreach ($node in $specialNodes) { | |
if (-not ($null -eq $TheHashTable[$node.hash])) { | |
$valueToAdd = $TheHashTable[$node.hash] | |
$node.SetAttribute("name", $valueToAdd) | |
$node.RemoveAttribute("hash") | |
} | |
} | |
function Format-XML ($xml, $indent=2) | |
{ | |
$StringWriter = New-Object System.IO.StringWriter | |
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter | |
$xmlWriter.Formatting = “indented” | |
$xmlWriter.Indentation = $Indent | |
$xml.WriteContentTo($XmlWriter) | |
$XmlWriter.Flush() | |
$StringWriter.Flush() | |
Write-Output $StringWriter.ToString() | |
} | |
return Format-XML $XmlDoc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment