Skip to content
Outlands Hub

Razor script

Vendor Log Dump Reader

by Brozan (Syal) · 233 lines
Download
GatheringHousingOrganizing
Vendor Log Dump Reader.razor
1# This is an automated backup - check out https://outlands.uorazorscripts.com/script/dee22327-7b81-4b72-afaf-3c6ae8aa9513 for latest2# Automation by Jaseowns3## Script: Vendor Log Dump Reader4## Created by: Brozan (Syal)#45235#############################################6 7$dir = "C:\Program Files (x86)\Ultima Online Outlands\ClassicUO\Data\Client\JournalLogs"8$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 19 10$file = $latest.name11 12#Remember this is hardcoded for testing!13#$file = "2021_10_27_11_12_55_journal.txt"14 15$outfile = "C:\users\oreos\desktop\test.txt"16 17Set-Content $outfile ''18 19$new_vendor = 020$line_count = 021$write_check = 122$item_count = 123$last_item_count = 124$master_list_count = 025$total_count = 026$item_string = ''27$last_item_string = 'a'28$master_list_string_output = 'Master List of Items ['29$last_line = ''30foreach($line in Get-Content $dir\$file) {31	$line_count = $line_count + 132	if ($line -like "*START CATALOGUE*"  )33	{34		#Start Block35		$write_check = 0		36	}37	if ($line -like "*DONE CATALOGUE*"  )38	{39		#Start Block40		$write_check = 1		41	}42	if ($write_check -eq 0 -and $line -like "*New Vendor*" -and $line -notlike "*New target*" )43	{44		#Found new vendor - grab next line45		$new_vendor = 146		$line_count = 047	}48	if ($write_check -eq 0 -and $line -like "*Razor: Target*" -and $line -notlike "*New target*" )49	{		50		$line = $line -replace '\[.*\].*Razor: Target: ', '**Vendor Name: '51		$line = $line + "**"52		Add-Content $outfile " "53		Add-Content $outfile $line54	}55	56	if ($write_check -eq 0 -and $new_vendor -eq 1 -and $line_count -eq 1  -and $line -notlike "*When used, it will*"  -and $line -notlike "*That is not accessible*"  -and $line -notlike "*used to increase*"  -and $line -notlike "*WorldMap*" -and $line -notlike "*completed the achievement*" -and $line -like "*System*" -and $line -notlike "*.xml*" -and $line -notlike "*New target*" )57	{58		#This is our vendor name		59		60		#Output last build item61		if($item_string -ne $last_item_string)62		{63			#new item - output64			if($last_item_count -gt 1)65			{66				#Previous item had multiples67				$dup_out_string = "        >> [" +  $last_item_count + "] AVAILABLE!"				68				Add-Content $outfile $dup_out_string69			}70			$dump_item_string = $item_string -replace '(?<=\d)(?=(0{3})+\b)', 'k'71			$dump_item_string = $dump_item_string -replace 'k000', 'k'72			Add-Content $outfile $dump_item_string73			74			#Add item to master list if it's not on the list	75			if($item_string -notlike '*carpet dye*' -and $item_string -notlike '*queued actions*'  -and $item_string -notlike '*martial manual*'  -and $item_string -notlike '*gorget*'  -and $item_string -notlike '*Queuing action*' -and $item_string -notlike '*exceptional*' -and $item_string -notlike '*viking sword*' -and $item_string -notlike '*two-handed axe*' -and $item_string -notlike '*select an item*' -and $item_string -notlike '*crossbow*' -and $item_string -notlike '*CATALOGUE*'  -and $item_string -notlike '*black staff*'   -and $item_string -notlike '*battleaxe*'  -and $item_string -notlike '*prestige has*'  -and $item_string -notlike '*melodious*'  -and $item_string -notlike '*spellbook*' -and $item_string -notlike '*container identification wand*'  -and $item_string -notlike '*dullhide*'  -and $item_string -notlike '*copperhide*'  -and $item_string  -notlike '*goldenwood*'  -and $item_string -notlike '*dullwood*'  -and $item_string -notlike '*verewood*'  -and $item_string -notlike '*valewood*' )76			{77				$master_list_string = $master_list_string + $item_string + ";"78				#echo $item_string79			}80			$master_list_count = $master_list_count + 1 81			$last_item_count = 182		}83		else84		{85			#Previous item had multiples86			$dup_out_string = "        >> [" +  $last_item_count + "] AVAILABLE!"					87			Add-Content $outfile $dup_out_string	88			$last_item_count = 1	89		}90 91		92		93		#build vendor name94		$new_vendor = 095		$item_string = ''96	}97	if ($write_check -eq 0 -and $new_vendor -ne 1 -and $line_count -gt 1  -and $line -notlike "*When used, it will*" -and $line -notlike "*That is not accessible*"  -and $line -notlike "*used to increase*"  -and $line -notlike "*Ignore List cleared*"  -and $line -notlike "*completed the achievement*" -and $line -notlike "*Welcome Syal*"  -and $line -notlike "*WorldMap*"   -and $line -notlike "*.xml*" -and $line -notlike "*Not for sale*" -and $line -like "*System*" -and $line -notlike "*New target*" )98	{99		#First  line of new item; generally the price, grab and append next lines100		$total_count = $total_count + 1101		102		#Output last build item103		if($item_string -ne $last_item_string)104		{105			#new item - output106			if($last_item_count -gt 1)107			{108				#Previous item had multiples109				$dup_out_string = "        >> [" +  $last_item_count + "] AVAILABLE!"						110				Add-Content $outfile $dup_out_string111			}112			$dump_item_string = $item_string -replace '(?<=\d)(?=(0{3})+\b)', 'k'113			$dump_item_string = $dump_item_string -replace 'k000', 'k'114			Add-Content $outfile $dump_item_string115			$last_item_count = 1116			117			#Add item to master list if it's not on the list	queued actions 		118			if($item_string -notlike '*carpet dye*' -and $item_string -notlike '*queued actions*'  -and $item_string -notlike '*martial manual*'  -and $item_string -notlike '*gorget*'  -and $item_string -notlike '*Queuing action*' -and $item_string -notlike '*exceptional*' -and $item_string -notlike '*viking sword*' -and $item_string -notlike '*two-handed axe*' -and $item_string -notlike '*select an item*' -and $item_string -notlike '*crossbow*' -and $item_string -notlike '*CATALOGUE*'  -and $item_string -notlike '*black staff*'   -and $item_string -notlike '*battleaxe*'  -and $item_string -notlike '*prestige has*'  -and $item_string -notlike '*melodious*'  -and $item_string -notlike '*spellbook*' -and $item_string -notlike '*container identification wand*'  -and $item_string -notlike '*dullhide*'  -and $item_string -notlike '*copperhide*'  -and $item_string  -notlike '*goldenwood*'  -and $item_string -notlike '*dullwood*'  -and $item_string -notlike '*verewood*'  -and $item_string -notlike '*valewood*' )119			{120				$master_list_string = $master_list_string + $item_string + ";"121				#echo $item_string122			}123			$master_list_count = $master_list_count + 1 124		}125		else126		{127			#repeat item128			$last_item_count = $last_item_count + 1	129		}130		131		132		#build new string133		$line = $line -replace '\[.*\].*System: ', '   - '134		$last_item_string = $item_string135		$item_string = $line 136	}137	if ($write_check -eq 0 -and $new_vendor -ne 1 -and $line_count -gt 1 -and $line -notlike "*Description*"  -and $line -notlike "*When used, it will*"  -and $line -ne "bag"  -and $line -ne "backpack"  -and $line -ne "wooden box"  -and $line -ne "pouch"  -and $line -notlike "*That is not accessible*"  -and $line -notlike "*used to increase*"   -and $line -notlike "*Price*"  -and $line -notlike "*completed the achievement*"  -and $line -notlike "*New target*" -and $line -notlike  '*`[*`]*')138	{139		#Lines to be appended to item140		$line =  " " + $line 141		$item_string = $item_string + $line142		143	}144	if ($write_check -eq 0 -and $new_vendor -ne 1 -and $line_count -gt 1 -and $line -like "*Description*"  -and $line -notlike "*When used, it will*"  -and $line -notlike "*That is not accessible*"  -and $line -ne "backpack"  -and $line -ne "wooden box"  -and $line -ne "pouch"  -and $line -notlike "*used to increase*"  -and $line -notlike "*New target*" -and $line -notlike "*completed the achievement*"  -and $line -notlike  '*`[*`]*')145	{146		#Lines to be appended to item - Description line147		$line =  " " + $line + " -- "  148		$item_string = $item_string + $line149	} 150	$last_line = $line151}152 153 154#Output last build item155if($item_string -ne $last_item_string)156{157	#new item - output158	if($last_item_count -gt 1)159	{160		#Previous item had multiples161		$dup_out_string = "        >> [" +  $last_item_count + "] AVAILABLE!"				162		Add-Content $outfile $dup_out_string163	}164	$dump_item_string = $item_string -replace '(?<=\d)(?=(0{3})+\b)', 'k'165	$dump_item_string = $dump_item_string -replace 'k000', 'k'166	Add-Content $outfile $dump_item_string167	$last_item_count = 1168}169else170{171	#repeat item172	$last_item_count = $last_item_count + 1			173	Add-Content $outfile $item_string174 175	#Previous item had multiples176	$dup_out_string = "        >> [" +  $last_item_count + "] AVAILABLE!"					177	Add-Content $outfile $dup_out_string	178}179 180#format master list181$master_list_string = $master_list_string -replace 'Price: \d+ ', ''182$master_list_string = $master_list_string -replace '; ;', ';'183$master_list_string = $master_list_string -replace ' ; ', '; '184$master_list_string = $master_list_string -replace ' - ', ' '185$master_list_string = $master_list_string -replace 'When used, it will unlock this spell hue for a randomized spell you do not currently have in this hue.;', ''186$master_list_string = $master_list_string -replace 'skill mastery scroll', 'SS'187$master_list_string = $master_list_string -replace 'When used, it will unlock this spell hue for a randomized spell you do not currently have in this hue.;', ''188$master_list_string = $master_list_string -replace ' ;', ';'189$master_list_string = $master_list_string -replace 'Aspect', ' '190$master_list_string = $master_list_string -replace 'Tierra', ''191$master_list_string = $master_list_string -replace '\s+', ' '192$master_list_string = $master_list_string -replace '\s+;\s+', ';'193$master_list_string = $master_list_string -replace ';\s+', ';'194$master_list_string = $master_list_string -replace ' ;', ';'195$master_list_string = $master_list_string -replace '\s+;\s+', ';'196$master_list_string = $master_list_string -replace 'Tierra', ''197$master_list_string = $master_list_string -replace '\(.*?\)', ''198$master_list_string = $master_list_string -replace ':.*?;', ';'199$master_list_string = $master_list_string -replace '\s+', ' '200$master_list_string = $master_list_string -replace '\s+;\s+', ';'201$master_list_string = $master_list_string -replace ';\s+', ';'202$master_list_string = $master_list_string -replace ' ;', ';'203#echo $master_list_string204 205#push some stuff we had to cut206$master_list_string = $master_list_string + "carpet dyes galore;magic spellbooks;container identification wands;"207 208 209 210$master_list_string = $master_list_string -replace '\s+', ' '211 212#dedupe and sort list213$master_list_string = ($master_list_string -split ';' | Sort-Object | Select -Unique) -join ';'214 215 216$master_list_string_output = $master_list_string_output + $master_list_count + " Unique Items!] and [" + $total_count + " Total Items!] Available `r`n" 217				218Add-Content $outfile " "219Add-Content $outfile " "220Add-Content $outfile $master_list_string_output	221 222 223 224 225 226 227 228 229 230 231 232 233