Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html><head></head>
- <body>
- <a href="http://www.gw2spidy.com/">Search this for items, item ID will be http://www.gw2spidy.com/item/{item ID}</a>
- <script>
- var item = null;
- var m = null;
- var moneyToSpend= 0;
- var moneyYoullGet= 0;
- var itemsGetting = "";
- var itemsSelling= "";
- function Item(I)
- {
- if(I.result)
- {
- item=I.result;
- if(m>0)
- {
- moneyToSpend+=m*item["max_offer_unit_price"];
- itemsGetting+=m+" "+item['name']+", ";
- }
- if(m<0)
- {
- moneyYoullGet+= -m*item["min_sale_unit_price"];
- itemsSelling+= -m+" "+item['name']+", ";
- }
- var npc = +document.getElementById('npc').value;
- var multi = +document.getElementById('multiplier').value;
- var span = document.getElementById("output");
- span.innerText = "To Buy: "+itemsGetting+"\n";
- span.innerText+= "To Sell: "+itemsSelling+"\n";
- span.innerText+="Minimum purchase price:"+numberToGSC((moneyToSpend+npc)*multi)+"\n";
- span.innerText+="Maximum Sale Price with after market fee:"+numberToGSC(parseInt(moneyYoullGet*0.85*multi))+"\n";
- span.innerText+="Profit:"+numberToGSC(parseInt((moneyYoullGet*0.85-moneyToSpend-npc)*multi))+"\n";
- }
- else m = I;
- }
- function refreshClicked()
- {
- var scripts = document.getElementById("loadScript");
- while(scripts.childNodes.length>0)
- {
- scripts.removeChild(scripts.childNodes[0]);
- }
- moneyToSpend= 0;
- moneyYoullGet= 0;
- itemsGetting = "";
- itemsSelling="";
- var area = document.getElementById("items");
- var txt = area.value;
- var items = txt.split(";");
- for(var i=0; i<items.length; i++)
- {
- if(items[i].length>0)
- {
- var csv = items[i].split(' ');
- var multiplier = parseInt(csv[0]);
- var src= parseInt(csv[1]);
- if(multiplier&&src)
- {
- var script = document.createElement("script");
- script.src = 'http://www.gw2spidy.com/api/v0.9/json/item/'+src+'?callback=Item%28'+multiplier+'%29%3BItem';
- scripts.appendChild(script);
- }
- }
- }
- }
- function numberToGSC(num)
- {
- var txt = num.toString();
- var response = "";
- for(var i=1; i<=txt.length; i++)
- {
- var nxt =txt.charAt(txt.length-i);
- if(i==1&&txt.length!=i-1)nxt+="(c)";
- if(i==3&&txt.length!=i-1)nxt+="(s) ";
- if(i==5&&txt.length!=i-1)nxt+="(g) ";
- response = nxt+response;
- }
- return response;
- }
- function saveLastResult()
- {
- document.getElementById("saved").innerHTML+=document.getElementById("output").innerHTML+"<br>";
- }
- function updateNPCOut(npc)
- {
- var npcOut = document.getElementById("npcOut");
- npcOut.innerText = numberToGSC(npc.value);
- }
- </script>
- <div style="display:hidden" id="loadScript"></div>
- <textarea id="items">
- 5 19721;
- 28 19701;
- -1 13459;
- 25 24276;
- 10 24474;
- </textarea><br>
- Multiplier<input id="multiplier" value="1" type="number"/><br>
- NPC Purchaces(<span id="npcOut">0</span>)<input id="npc" value="0" type="number" oninput="updateNPCOut(this)"/><br>
- <button onclick="refreshClicked()">Load Items</button><br><br>
- <span id="output"></span><br>
- <button onclick="saveLastResult()">Keep Result</button><br>
- <span id="saved" style="background-color:#AAF"></span>
- <textarea>
- --Notes
- </textarea>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement