Tuesday, May 26, 2009

Mountain Dew promotion

Moutain Dew is starting a new promotion for their "Gamer Fuel" soda with a World of Warcraft theme. Here's my banner.

Mountain Dew Game Fuel Horde Banner

Tuesday, May 5, 2009

Warcraft Recipe Builder Powershell Script

I've posted this script before on my own server, but since it's being rebuilt, I thought I'd repost it here. The script will take the name of an item from Warcraft (for example) Mekgineer's Chopper, then return all the items and roughly how you get each. Maybe revise the code to return a webpage with links to the source, but that's for a third revision.

Note: This script requires Powershell installed on your PC. Copy and paste the code below and save into a file with a PS1 extention.

Sample Results
Please Enter the WowHead name or ItemID (found in the URL)?: Mekgineer's Chopper
Mekgineer's Chopper x 1
Titansteel Bar x 12
Titanium Bar x 36
- created
Eternal Fire x 12
- created
Eternal Earth x 12
- created
Eternal Shadow x 12
- created
Handful of Cobalt Bolts x 40
Cobalt Bar x 80
Cobalt Ore x 80
- drop
Arctic Fur x 2
- drop
Salvaged Iron Golem Parts x 1
- vendor ( 3000 g)
Goblin-machined Piston x 8
- vendor ( 8000 g)
Elementium-plated Exhaust Pipe x 1
- vendor ( 1500 g)



################## Code starts here ####

#Eric Woodford
#EricWoodford.com
#Break down made items to get all required ingredients.

function Read-URL ($url) {
#source: http://waynes-world-it.blogspot.com/2008/05/reading-web-content-with-powershell.html
$col = new-object System.Collections.Specialized.NameValueCollection
$col.Add("a","stats")
$col.Add("s","s451qaz2WSX")
$wc = new-object system.net.WebClient
$wc.proxy = $proxy
$wc.QueryString = $col
$webpage = $wc.DownloadData($url)
$string = [System.Text.Encoding]::ASCII.GetString($webpage)
return $String
}

function get-ingredientfor([string]$item, [int]$multi) {
$x +=4
#$Needed = $csv | ?{$_.item -eq $item}
[xml] $needed = Read-URL($url+ $item + $strXML)
Write-Host (" " * $x) $needed.wowhead.item.name.psbase.innertext "x" $multi
$reagents = $needed.wowhead.item.createdBy.spell.reagent
if ($reagents -ne $null) {
$reagents | % {
if ($_.id -ne "") {
get-ingredientfor $_.id ($multi * [int]$_.count)
} else {
$strSource = $needed.wowhead.item.json.psbase.innertext
#http://www.johndcook.com/regex.html
$words = ([regex]::matches($strSource, "source:\[[123456,]+\]") | %{$_.value})
if ($words -match "1") {Write-Host (" " * $x)" - created"}
if ($words -match "2") {Write-Host (" " * $x)" - drop"}
if ($words -match "5") {Write-Host (" " * $x)" - vendor"}
}
}
} else {
$strSource = $needed.wowhead.item.json.psbase.innertext
$words = ([regex]::matches($strSource, "source:\[[123456,]+\]") | %{$_.value})
if ($words -match "1") {Write-Host (" " * $x)" - created"}
if ($words -match "2") {Write-Host (" " * $x)" - drop"}
if ($words -match "5") {
$strSource = $needed.wowhead.item.jsonequip.psbase.innertext
$words = ([regex]::matches($strSource, "buyprice:[01234567890]+") | %{$_.value})
if ($words -ne $null) {
$cost = [int] $words.split(":")[1]
if ($cost -gt 10000) {
Write-Host (" " * $x)" - vendor (" (($cost/10000)*$multi) "g)"
} else {
Write-Host (" " * $x)" - vendor (" (($cost/100)*$multi) "s)"
}
} else { Write-Host (" " * $x)" - vendor (non gold price)"}
}
}
}

$x = -4
$url = "http://www1.wowhead.com/?item="
#$itemCode = "42101"
$strXML = "&xml"
cls
Write-Host "Beta - PowerShell World of Warcraft Ingredients List"
Write-Host "This code will read the WowHead website and process all the ingredients necessary to make something."
Write-Host "----------------------------------------------------------"
$ItemCode = Read-Host "Please Enter the WowHead name or ItemID (found in the URL)?"

if ($itemcode -eq $null) {Throw "Please enter an itemID to continue"}
$test = Read-URL($url+ $itemCode + $strXML)
if ($test -match "not found") {Throw "Item not found in WowHead"}

get-ingredientfor $itemCode 1



# SIG # Begin signature block
# MIID9QYJKoZIhvcNAQcCoIID5jCCA+ICAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUvsc0vRAk+dqFXZlphHXBOSZ4
# 4eCgggITMIICDzCCAXygAwIBAg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JElwykc7NqBsb4W5sD0vk+ubVjDC
# k26/SY/gLD+vHSDiIhGpq0Ho3fdWKNFNXuo1cn/4ekb28wj094SfAxUgW7kNz0y0
# 3FwIdEL2tPVp
# SIG # End signature block

Topic 24 - Class Fantasy Yay or Nay

Post about class fantasy with some fantasy conversation between my pally and my warlock. Warlock: I hate my class hall. I hate my class...