Dub / Boat Log Parser by Brozan (Syal)

Related: Snippet

Description: Powershell script to parse logs for upgrades/crew by dub value

#doubloons for sinking a ship #Crew Contracts added to pending salvage #1 Ship Upgrades added to pending salvage $last_out_line = '' $folders = Get-ChildItem -Path 'C:\Program Files (x86)\Ultima Online Outlands\ClassicUO\Data\Client\JournalLogs' -Name foreach($item in $folders) { $files = 'C:\Program Files (x86)\Ultima Online Outlands\ClassicUO\Data\Client\JournalLogs\' + $item foreach($file in $files) { foreach($line in Get-Content $file) { if ($line -like "*doubloons for sinking a ship*" ) { $out_line = $line.substring(42) $out_line = $out_line -replace " doubloons for sinking a ship! They have been placed in the ship's hold." #echo "$out_line" } if ($line -like "*ship's hold: *1*added to pending salvage*" ) { if ($out_line -ne $last_out_line) { $boat_size = [Math]::Floor([decimal]($out_line.trim() / 2000)) + 1 if ($line -like "*Upgrade*" ) { $out_drop = "Upgrade" } else { $out_drop = "Crew_Contract" } $dub_value = $out_line.trim() echo "$dub_value,$boat_size,$out_drop" } $last_out_line = $out_line } } } }