User requested an old script to be converted to Spanish, made it work with all languages.
Only tested on Chrome.
Not sure if my Smart Haggle function works over 99,999 NP. Couldn't find an item to test it on.
// ==UserScript== // @name Neopets Auto Smart Haggle // @namespace http://www.neocodex.us/ // @version 0.1.2 // @description Auto Smart Haggle for Neopets Main Shops. // @author Freestyle // @include *neopets.com/haggle.phtml* // ==/UserScript== //Found .repeat somewhere on google by Jacob Relkin. String.prototype.repeat = function(times) { return (new Array(times + 1)).join(this); }; function smart_haggle(price){ return price.substring(0,2).repeat(price.length).substring(0,price.length); } if(document.getElementsByName("lang")[0].value === "en"){ var wont = "I wont take less than "; var regwont = /I wont take less than (.*) Neopoints/; var want = "I want at least "; var regwant = /I want at least (.*) Neopoints/; var separator = ","; }else if(document.getElementsByName("lang")[0].value === "nl"){ var wont = "Ik wil zeker niet minder dan "; var regwont = /Ik wil zeker niet minder dan (.*) Neopunten/; var want = "Ik wil minstens "; var regwant = /Ik wil minstens (.*) Neopunten/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "pt"){ var wont = "Não aceito menos que "; var regwont = /Não aceito menos que (.*) Neopontos/; var want = "Quero, no mínimo, "; var regwant = /Quero, no mínimo, (.*) Neopontos/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "de"){ var wont = "Ich nehme nicht weniger als "; var regwont = /Ich nehme nicht weniger als (.*) Neopunkte/; var want = "Ich möchte mindestens "; var regwant = /Ich möchte mindestens (.*) Neopunkte/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "fr"){ var wont = "Je ne descendrai pas en-dessous de "; var regwont = /Je ne descendrai pas en-dessous de (.*) Neopoints/; var want = "Je veux au moins "; var regwant = /Je veux au moins (.*) Neopoints/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "it"){ var wont = "Non prenderò meno di "; var regwont = /Non prenderò meno di (.*) Neopunti/; var want = "Voglio almeno "; var regwant = /Voglio almeno (.*) Neopunti/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "es"){ var wont = "No acepto menos de "; var regwont = /No acepto menos de (.*) Neopuntos/; var want = "Quiero al menos "; var regwant = /Quiero al menos (.*) Neopuntos/; var separator = "."; }else if(document.getElementsByName("lang")[0].value === "ch"){ var wont = "店主说“少于 "; var regwont = /店主说“少于 (.*) 尼奥/; var want = "店主说“至少要 "; var regwant = /店主说“至少要 (.*) 尼奥/; var separator = ","; }else if(document.getElementsByName("lang")[0].value === "zh"){ var wont = "店主說「少於 "; var regwont = /店主說「少於 (.*) 尼奥/; var want = "店主說「至少要 "; var regwant = /店主說「至少要 (.*) 尼奥/; var separator = ","; }else if(document.getElementsByName("lang")[0].value === "ja"){ var wont = "店員が「うーん、 "; var regwont = /店員が「うーん、 (.*) NP/; var want = "店員が「この品には、少なくとも"; var regwant = /店員が「この品には、少なくとも (.*) NP/; var separator = ","; }else if(document.getElementsByName("lang")[0].value === "ko"){ var wont = "점원이 '음... "; var regwont = /점원이 '음... (.*) NP/; var want = "점원이 '이 물건은 아무리 적어도 "; var regwant = /점원이 '이 물건은 아무리 적어도 (.*) NP/; var separator = ","; } if(document.body.innerHTML.indexOf(wont) > -1){ haggle = document.body.innerHTML.match(regwont); document.getElementsByName("current_offer")[0].value = smart_haggle(haggle[1].replace(separator,"").trim()); }else if(document.body.innerHTML.indexOf(want) > -1){ haggle = document.body.innerHTML.match(regwant); document.getElementsByName("current_offer")[0].value = smart_haggle(haggle[1].replace(separator,"").trim()); }
Edited by Freestyle, 19 July 2015 - 07:57 PM.