param ( [Parameter(Mandatory=$true)][string]$eqLog = "", [int]$researchMinLvl = 0, [int]$auctionMin = 0, [int]$vendorMin = 0, [switch]$noTskill = $false, [switch]$noResearch = $false, [switch]$noVendor = $false, [switch]$noAuction = $false, [switch]$noPopup = $false, [switch]$groupRaid = $false, [switch]$showDetail = $false ) #================================================ #MAIN SCRIPT #================================================ $url = "http://147.182.224.90:8000/loot/" $ModuleName = 'BurntToast' # Install the module if it is not already installed, then load it. Try { $null = Get-InstalledModule $ModuleName -ErrorAction Stop } Catch { if ( -not ( Get-PackageProvider -ListAvailable | Where-Object Name -eq "Nuget" ) ) { $null = Install-PackageProvider "Nuget" -Force } $null = Install-Module $ModuleName -Force -Scope CurrentUser } $null = Import-Module $ModuleName -Force function Evaluate-Return($vals) { $auctionarray = $vals[0] $vendorarray = $vals[1] $recipearray = $vals[2] $spellsarray = $vals[3] $typearray = $vals[4] $itemname = $vals[5][0] $itemid = $vals[5][1] $itemicon = $vals[5][2] $itemurl = ("https://eqtunnelauctions.com/alla/item.php?id="+$itemid) $iconurl = ("https://www.eqtunnelauctions.com/icons/item_"+$itemicon+".gif") $auctionurl = ("https://eqtunnelauctions.com/item.php?itemstr="+$itemname) $auctionurl = [System.Web.HttpUtility]::UrlPathEncode($auctionurl) $pqdiurl = ("https://www.pqdi.cc/item/"+$itemid) if ( $typearray -ne $null ) { $notifytext = @() $notifybuttons = @() Write-Host "ITEM: "$itemname Write-Host "TYPE: "$typearray $notifyheader = New-BTHeader -Id '001' -Title "$itemname" -Arguments "$itemurl" if ( ( $auctionarray -ne $null ) -And ( $noAuction -eq $false ) ) { Write-Host "Auction Price: "$auctionarray"pp" if ( $auctionarray -ge $auctionMin ) { $notifytext += ("Auction Price: "+$auctionarray+"pp") $notifybuttons += New-BTButton -Content 'Auctions' -Arguments "$auctionurl" } } if (($vendorarray -ne $null) -And ($noVendor -eq $false)) { Write-Host "Vendor Price: "$vendorarray"pp" if ( $vendorarray -ge $vendorMin ) { $notifytext += ("Vendor Price: "+$vendorarray+"pp") } } if ( ($spellsarray -ne $null ) -And ($noResearch -eq $false) ) { Write-Host "Used in Research:" $max_spell = 0 $spells = @() foreach ($h in $spellsarray) { Write-Host "(LEVEL "$h[1]")"$h[0] if ($h[1] -ge $max_spell) { $max_spell = $h[1] $spells += ($h[0]+" (LVL"+$h[1]+")") } } if ( $max_spell -ge $researchMinLvl ){ if ( $showDetail -eq $false ) { $notifytext += ( "Lvl " + $max_spell + " Research Item" ) } else { $spells = @( "Lvl " + $max_spell + " Research Item" ) + $spells $notifytext += ($spells | Out-String) } } } Elseif ( ( $recipearray -ne $null ) -And ( $noTskill -eq $false ) ) { Write-Host "Used in Tradeskill Recipes:" $recipes = @() $recipes += "Tradeskill Item" foreach ($h in $recipearray) { Write-Host $h[0] if ( $showDetail -eq $true ){ $recipes += $h[0] } } $notifytext += ($recipes | Out-String) } $notifybuttons += New-BTButton -Content 'Alla' -Arguments "$itemurl" $notifybuttons += New-BTButton -Content 'PQDI' -Arguments "$pqdiurl" if ( ( $notifytext.Count -ge 1 ) -And ( $noPopup -eq $false ) ) { Toast -Silent -Text $notifytext -Header $notifyheader -AppLogo $iconurl -Button $notifybuttons } } } function Loot-Function($line) { $toSend = @{ line_txt = $line } $jsonBody = $toSend | ConvertTo-Json -Depth 1 $response = Invoke-RestMethod -Uri $url -Method Post -Body $jsonBody -ContentType "application/json" $returnVals = $response | ConvertFrom-Json Evaluate-Return $returnVals } Write-Host "Options: " Write-Host "-eqLog 'path\to\eq\log\file.txt'" Write-Host "-researchMinLvl 30 <-set minimum spell research level for notification. Default: 0" Write-Host "-auctionMin 50 <-set minimum auction price for notification. Default: 0" Write-Host "-vendorMin 50 <-set minimum vendor price for notification. Default: 0" Write-Host "-noTskill <-hide notifications for tradeskill items. Default: On" Write-Host "-noResearch <-hide notifications for research items. Default: On" Write-Host "-noVendor <-hide notifications for vendor prices. Default: On" Write-Host "-noAuction <-hide notifications for auction prices. Default: On" Write-Host "-noPopup <-hide popup notifications. Default: On" Write-Host "-groupRaid <-show details for others' looted items. Default: Off" Write-Host "-showDetail <-list recipes for tradeskill and spell materials. Default: Off" Write-Host "Example: .\loot_buddy.exe -eqLog C:\TAKP\eqlog_Peetree_pq_proj.txt -vendorMin 5 -auctionMin 25 -researchMinLvl 30 -noTskill -groupRaid" Write-Host "========================" Write-Host "Reading File: $eqLog" Write-Host "Min Research Level: $researchMinLvl" Write-Host "Auction Min Price: $auctionMin" Write-Host "Vendor Min Price: $vendorMin" Write-Host "Hiding Tradeskill Items?: $noTskill" Write-Host "Hiding Research Items?: $noResearch" Write-Host "Hiding Vendor Items?: $noVendor" Write-Host "Hiding Auction Items?: $noAuction" Write-Host "Hiding Popups?: $noPopup" Write-Host "Showing Group/Raid Loot?: $groupRaid" Write-Host "========================" Write-Host "Waiting for loot..." Get-Content -Path $eqLog -Wait -Last 0 | ForEach-Object { $line = $_.psobject.BaseObject if ( $groupRaid -eq $false ) { if ($line -match "] --You have looted a ") { Loot-Function $line Write-Host "Waiting for next item..." } Elseif ( $line -match "] You say, 'LB " ) { $extract = ( $line -split "] You say, 'LB " )[1] $extract = $extract.TrimEnd(" '") $line = ( "[Tue Dec 26 10:14:43 2023] --You have looted a " + $extract + ".--") Loot-Function $line Write-Host "Waiting for next item..." } } Else { if ( $line -match "] --You have looted a " ) { Loot-Function $line Write-Host "Waiting for next item..." } Elseif ( $line -match " has looted a " ){ $extract = ( $line -split " has looted a " )[1] $line = ( "[Tue Dec 26 10:14:43 2023] --You have looted a " + $extract ) Loot-Function $line Write-Host "Waiting for next item..." } Elseif ( $line -match "] You say, 'LB " ) { $extract = ( $line -split "] You say, 'LB " )[1] $extract = $extract.TrimEnd(" '") $line = ( "[Tue Dec 26 10:14:43 2023] --You have looted a " + $extract + ".--") Loot-Function $line Write-Host "Waiting for next item..." } } }