{"id":49,"date":"2013-05-28T01:02:22","date_gmt":"2013-05-28T05:02:22","guid":{"rendered":"http:\/\/powershell.erichcottom.com\/?p=49"},"modified":"2013-05-28T01:31:52","modified_gmt":"2013-05-28T05:31:52","slug":"eve-pi","status":"publish","type":"post","link":"https:\/\/powershell.erichcottom.com\/?p=49","title":{"rendered":"EVE PI"},"content":{"rendered":"<p>This is a script i wrote to see if i was making ISK in <a title=\"eve\" href=\"http:\/\/www.eveonline.com\/?\" target=\"_blank\">eve<\/a> by importing PI basic or refined commodities and making Specialized commodities.\u00a0 At some point I want to make this script do all PI commodities but for now its setup for robots.\u00a0 If you know your item IDs you can edit it for your commodities.<\/p>\n<pre class=\"brush: powershell; gutter: true\">param([switch]$Debug)\r\nif($Debug){$DebugPreference = 'Continue'}\r\nWrite-Debug \"ON\"\r\n\r\n$ItemIDs = @{\r\n\u00a0\u00a0\u00a0 \"ReactiveMetals\" = 2398\r\n\u00a0\u00a0\u00a0 \"PreciousMetals\" = 2399\r\n\u00a0\u00a0\u00a0 \"ToxicMetals\" = 2400\r\n\u00a0\u00a0\u00a0 \"ChiralStructures\" = 2401\r\n\u00a0\u00a0\u00a0 \"MechanicalParts\" = 3689\r\n\u00a0\u00a0\u00a0 \"ConsumerElectronics\" = 9836\r\n\u00a0\u00a0\u00a0 \"Robotics\" = 9848\r\n}\r\n\r\n$Items = @{\r\n\u00a0\u00a0\u00a0 2398 = \"ReactiveMetals\"\r\n\u00a0\u00a0\u00a0 2399 = \"PreciousMetals\"\r\n\u00a0\u00a0\u00a0 2400 = \"ToxicMetals\"\r\n\u00a0\u00a0\u00a0 2401 = \"ChiralStructures\"\r\n\u00a0\u00a0\u00a0 3689 = \"MechanicalParts\"\r\n\u00a0\u00a0\u00a0 9836 = \"ConsumerElectronics\"\r\n\u00a0\u00a0\u00a0 9848 = \"Robotics\"\r\n}\r\n\r\nfunction GetPriceData\r\n{\r\n\r\n\u00a0\u00a0\u00a0 param\r\n\u00a0\u00a0\u00a0 (\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $IDs,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $Region = 10000002 #the forge\r\n\u00a0\u00a0\u00a0 )\r\n\r\n\u00a0\u00a0\u00a0 $IDString = ''\r\n\u00a0\u00a0\u00a0 $IDs | %{$IDString += \"typeid=\"+\"$_\"+'&amp;'}\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 $XMLString = \"http:\/\/api.eve-central.com\/api\/marketstat?\"+\"$IDString\"+\"regionlimit=$Region\"\r\n\u00a0\u00a0\u00a0 $XML = New-Object system.xml.xmldocument\r\n\u00a0\u00a0\u00a0 $XML.load($XMLString)\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 Write-Debug $XMLString\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 #$BaseNode = \"\/evec_api\/marketstat\"\r\n\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 $Returns = @{}\r\n\u00a0\u00a0\u00a0 $Root = $XML.evec_api.marketstat\r\n\u00a0\u00a0\u00a0 foreach($Node in $Root.ChildNodes)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [int32]$TypeID = $Node.id\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $Buy = $Node.buy\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $Sell = $Node.sell\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Write-Debug $ItemsIDs[$TypeID]\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $Returns[$Items[$TypeID]] = New-Object -TypeName PSObject -Property (@{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 'ID' = $TypeID\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 'SellPrice' = [double]$Sell.min\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 'BuyPrice' = [double]$Buy.max})\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0 return $Returns\r\n\r\n}\r\n\r\n$BasicQuantity = 80\r\n$RefinedQuantity = 10\r\n$SpecializedQuantity = 3\r\n$BasicTax = 2000 # per 80\r\n$RefinedTax = 4500 # per 10\r\n$SpecializedTax = 21000 # per 3\r\n$SalesTax = 0.01 # lv5 sales tax\r\n\r\n$PriceData = GetPriceData (\r\n\u00a0\u00a0\u00a0 $ItemIDs.ReactiveMetals,\r\n\u00a0\u00a0\u00a0 $ItemIDs.PreciousMetals,\r\n\u00a0\u00a0\u00a0 $ItemIDs.ToxicMetals,\r\n\u00a0\u00a0\u00a0 $ItemIDs.ChiralStructures,\r\n\u00a0\u00a0\u00a0 $ItemIDs.MechanicalParts,\r\n\u00a0\u00a0\u00a0 $ItemIDs.ConsumerElectronics,\r\n\u00a0\u00a0\u00a0 $ItemIDs.Robotics\r\n\u00a0\u00a0\u00a0 )\r\n\r\n\r\nif(!$PriceData){Write-Debug 'Nothing returned'}\r\n\r\n$Sales = $PriceData.Robotics.BuyPrice * $SpecializedQuantity * (1 - $SalesTax)\r\n\r\n#this bit needs to be a function for things other then robotics\r\n\r\n$Costs = ($PriceData.ReactiveMetals.SellPrice * $BasicQuantity`\r\n\u00a0\u00a0\u00a0 + $PriceData.PreciousMetals.SellPrice * $BasicQuantity`\r\n\u00a0\u00a0\u00a0 + $PriceData.ToxicMetals.SellPrice * $BasicQuantity`\r\n\u00a0\u00a0\u00a0 + $PriceData.ChiralStructures.SellPrice * $BasicQuantity)`\r\n\u00a0\u00a0\u00a0 * (1 + $SalesTax)\r\n\u00a0\u00a0 \u00a0\r\n$Tax = 4 * $BasicTax + $SpecializedTax\r\n\r\n$Profits = ($Sales - $Costs) - $Tax\r\n\r\nif($Profits -ge 0){$Color = \"Green\"}\r\nelse{$Color = \"Red\"}\r\n\r\nWrite-Host -ForegroundColor $Color \"Basic:\" $Profits \"Per Day:\" ($Profits*24)\r\n\r\n$Costs = ($PriceData.MechanicalParts.SellPrice * $RefinedQuantity`\r\n\u00a0\u00a0\u00a0 + $PriceData.ConsumerElectronics.SellPrice * $RefinedQuantity)`\r\n\u00a0\u00a0\u00a0 * (1 + $SalesTax)\r\n\u00a0\u00a0 \u00a0\r\n$Tax = 2 * $RefinedTax + $SpecializedTax\r\n\r\n$Profits = ($Sales - $Costs) - $Tax\r\n\r\nif($Profits -ge 0){$Color = \"Green\"}\r\nelse{$Color = \"Red\"}\r\n\r\nWrite-Host -ForegroundColor $Color \"Refined:\" $Profits \"Per Day:\" ($Profits*24)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a script i wrote to see if i was making ISK in eve by importing PI basic or refined commodities and making Specialized commodities.\u00a0 At some point I want to make this script do all PI commodities but &hellip; <a href=\"https:\/\/powershell.erichcottom.com\/?p=49\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,7,8],"tags":[23,24],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-poshtested","category-powershell","category-scripts","tag-eve","tag-xml"],"_links":{"self":[{"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":8,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/powershell.erichcottom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}