Created
May 29, 2018 16:26
-
-
Save DoctorD90/3f8520cbf034064289f4f2b036b44665 to your computer and use it in GitHub Desktop.
This script uses http://gw2timer.com/ as source for daily Pact Supply Network
This file contains 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
# This script uses http://gw2timer.com/ as source for daily Pact Supply Network: | |
# A collaborative effort to record what recipes are being offered daily by the Pact Supply Network Agents in Guild Wars 2. [cit.] | |
# So please, if something is outofdate, go there and follow rules about how to update and give a contribute to the community :) | |
# See Ya | |
### | |
# Do not edit below | |
### | |
$recipe = 'https://api.guildwars2.com/v2/items?ids=' | |
$gcsv = 'https://docs.google.com/spreadsheets/d/1hIw2DAzdD72wPfP-GJ3sNlf4weaJ2L2mMFGJPFb93eE/export?format=csv&id=1hIw2DAzdD72wPfP-GJ3sNlf4weaJ2L2mMFGJPFb93eE&gid=0' | |
$head = "Mehem", "Fox", "Derwena", "Yana", "Katelyn", "Verma", "today" | |
$csv = Invoke-WebRequest -Uri $gcsv | ConvertFrom-Csv -Header $head | |
$upddate = $csv.today[0] | |
#location | |
$location = @{} | |
$location.Mehem = @('[&BIsHAAA=]', '[&BIcHAAA=]', '[&BH8HAAA=]', '[&BH4HAAA=]', '[&BKsHAAA=]', '[&BJQHAAA=]', '[&BH8HAAA=]') | |
$location.Fox = @('[&BDoBAAA=]', '[&BEwDAAA=]', '[&BEgAAAA=]', '[&BMIBAAA=]', '[&BE8AAAA=]', '[&BMMCAAA=]', '[&BLkCAAA=]') | |
$location.Derwena = @('[&BC0AAAA=]', '[&BKYBAAA=]', '[&BBkAAAA=]', '[&BKYAAAA=]', '[&BIMAAAA=]', '[&BNUGAAA=]', '[&BJIBAAA=]') | |
$location.Yana = @('[&BO4CAAA=]', '[&BNIEAAA=]', '[&BKgCAAA=]', '[&BP0CAAA=]', '[&BP0DAAA=]', '[&BJsCAAA=]', '[&BBEDAAA=]') | |
$location.Katelyn = @('[&BIUCAAA=]', '[&BIMCAAA=]', '[&BGQCAAA=]', '[&BDgDAAA=]', '[&BF0GAAA=]', '[&BHsBAAA=]', '[&BEICAAA=]') | |
$location.Verma = @('[&BCECAAA=]', '[&BA8CAAA=]', '[&BIMBAAA=]', '[&BPEBAAA=]', '[&BOQBAAA=]', '[&BNMAAAA=]', '[&BBABAAA=]') | |
$td = get-date -UFormat %u | |
$chatlinkfull = @() | |
$mytable = 'Merchant','Known','Item','Chatcode'; | |
$head[0..5] | ForEach-Object { | |
$id = $csv.$_[1] | |
$updtime = $csv.$_[2] | |
if ( $updtime -eq $upddate ) { | |
$link = $recipe + $id | |
$recdata = Invoke-WebRequest -Uri $link | ConvertFrom-Json | |
$recname = $recdata.name | |
$reclink = $recdata.chat_link | |
$chatlink = $_ + $reclink + "@" + $location.$_[$td] | |
$chatlinkfull += $chatlink | |
$chatlinkpart += $chatlink | |
} | |
else { | |
$chatlink = $_ + "2upd" + "@" + $location.$_[$td] | |
$chatlinkfull += $chatlink | |
} | |
} | |
$chatlinkfulljoined = $chatlinkfull -join " - " | |
$chatlinkfulljoined | clip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment