Market Buttons

Venta rapida en el mercado

  1. // ==UserScript==
  2. // @name Market Buttons
  3. // @namespace https://gf.qytechs.cn/users/904482
  4. // @version 0.3.0
  5. // @description Venta rapida en el mercado
  6. // @author lpachecob
  7. // @grant none
  8. // @match *.gladiatus.gameforge.com/game/index.php?mod=guildMarket*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=gameforge.com
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. /* Getting the element with the id "sellForm" from the page. */
  14. var panelVenta=document.getElementById("sellForm");
  15. /* Getting the element with the id "preis" from the page. */
  16. var inputPrecio = document.getElementById("preis");
  17.  
  18. var inputDuracion = document.getElementById("dauer");
  19.  
  20. /* Getting the element with the name "anbieten" from the page. */
  21. var botonVender = document.getElementsByName("anbieten")[0];
  22. /* Getting the element with the id "market_inventory" from the page. */
  23. var marketInventory = document.getElementById("market_inventory");
  24. /* Getting the element with the id "sstat_gold_val" from the page and getting the text content of the
  25. element. Then it is converting the text content to a number. */
  26. var oro = parseFloat(document.getElementById("sstat_gold_val").textContent);
  27.  
  28. var cajaVenta = document.getElementsByClassName("ui-droppable")[0];
  29.  
  30.  
  31.  
  32. /* Adding HTML to the page. */
  33. panelVenta.insertAdjacentHTML('beforebegin', `
  34. <h2
  35. id="VentaRapidaMenuTitle"
  36. class="section-header"
  37. style="cursor: pointer;">
  38. Venta Rapida
  39. </h2>
  40. <section
  41. id="VentaRapidaMenu"
  42. style="display: block;">
  43. </section>`);
  44.  
  45. marketInventory.insertAdjacentHTML('afterbegin', `
  46. <h2
  47. id="CalcularRotativosTitle"
  48. class="section-header"
  49. style="cursor: pointer;">
  50. Calcular Rotativos
  51. </h2>
  52. <section
  53. id="CalcularRotativos"
  54. style="display: block;">
  55. </section>
  56. `);
  57.  
  58.  
  59. /* Getting the element with the id "VentaRapidaMenu" from the page. */
  60. var ventaRapidaMenu = document.getElementById("VentaRapidaMenu");
  61.  
  62. /* Adding HTML to the page. */
  63. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  64. <p>Coloca un item y elige el precio para vender.</p>
  65. `);
  66.  
  67. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  68. <button
  69. id="buttonAdd50k"
  70. class="awesome-button"
  71. style="margin:5px;"
  72. data-toggle="tooltip"
  73. title="Costo de venta: 2.000 💰"
  74. disabled>
  75. 50k
  76. </button>`);
  77. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  78. <button
  79. id="buttonAdd100k"
  80. class="awesome-button"
  81. style="margin:5px;"
  82. data-toggle="tooltip"
  83. title="Costo de venta: 4.000 💰"
  84. disabled>
  85. 100k
  86. </button>`);
  87. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  88. <button
  89. id="buttonAdd200k"
  90. class="awesome-button"
  91. style="margin:5px;"
  92. data-toggle="tooltip"
  93. title="Costo de venta: 8.000 💰"
  94. disabled>
  95. 200k
  96. </button>`);
  97. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  98. <button
  99. id="buttonAdd500k"
  100. class="awesome-button"
  101. style="margin:5px;"
  102. data-toggle="tooltip"
  103. title="Costo de venta: 20.000 💰"
  104. disabled>
  105. 500k
  106. </button>`);
  107. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  108. <button
  109. id="buttonAdd1kk"
  110. class="awesome-button"
  111. style="margin:5px;"
  112. data-toggle="tooltip"
  113. title="Costo de venta: 40.000 💰"
  114. disabled>
  115. 1kk
  116. </button>`);
  117. ventaRapidaMenu.insertAdjacentHTML('beforeend', `
  118. <section
  119. id=""
  120. style="display: block;">
  121. <p><small>Elegir duración</small></p>
  122. <select
  123. id="SelectHora"
  124. size="1">
  125.  
  126. <option value="1">2 h</option>
  127. <option value="2">8 h</option>
  128. <option value="3">24 h</option>
  129. </select>
  130. </section>`);
  131.  
  132.  
  133. var selectHora = document.getElementById("SelectHora");
  134. if(localStorage.SelectHora == undefined ){
  135. localStorage.SelectHora = 1
  136. selectHora.value = 1
  137. } else {
  138. selectHora.value = localStorage.SelectHora
  139. }
  140. selectHora.addEventListener("change",(event)=>{
  141. localStorage.SelectHora = selectHora.value;
  142. });
  143.  
  144.  
  145. /* Getting the element with the id "VentaRapidaMenuTitle" from the page. */
  146. var ventaRapidaMenuTitle = document.getElementById("VentaRapidaMenuTitle");
  147. /* Adding an event listener to the element with the id "VentaRapidaMenuTitle" from the page. When the
  148. user clicks on the element, the function will be executed. The function will check if the element
  149. with the id "VentaRapidaMenu" is visible or not. If it is visible, it will hide it. If it is hidden,
  150. it will show it. */
  151. ventaRapidaMenuTitle.addEventListener("click", ()=>{
  152. if(ventaRapidaMenu.style.display == "none"){
  153. ventaRapidaMenu.style.display="block";
  154. }else{
  155. ventaRapidaMenu.style.display="none";
  156. }
  157. });
  158.  
  159. /* Adding an event listener to the element with the id "buttonAdd50k". When the user clicks on the
  160. element, the function will be executed. The function will set the value of the element with the id
  161. "preis" to 50000 and will click on the element with the name "anbieten". */
  162. var add50k = document.getElementById("buttonAdd50k");
  163. add50k.addEventListener("click", ()=>{
  164. inputPrecio.value=50000;
  165. inputDuracion.value = localStorage.SelectHora;
  166. botonVender.click();
  167. });
  168. /* Adding an event listener to the element with the id "buttonAdd100k". When the user clicks on the
  169. element, the function will be executed. The function will set the value of the element with the id
  170. "preis" to 100000 and will click on the element with the name "anbieten". */
  171. var add100k = document.getElementById("buttonAdd100k");
  172. add100k.addEventListener("click", ()=>{
  173. inputPrecio.value=100000;
  174. botonVender.click();
  175. });
  176. /* Adding an event listener to the element with the id "buttonAdd200k". When the user clicks on the
  177. element, the function will be executed. The function will set the value of the element with the id
  178. "preis" to 200000 and will click on the element with the name "anbieten". */
  179. var add200k = document.getElementById("buttonAdd200k");
  180. add200k.addEventListener("click", ()=>{
  181. inputPrecio.value=200000;
  182. inputDuracion.value = localStorage.SelectHora;
  183. botonVender.click();
  184. });
  185. /* Adding an event listener to the element with the id "buttonAdd500k". When the user clicks on the
  186. element, the function will be executed. The function will set the value of the element with the id
  187. "preis" to 500000 and will click on the element with the name "anbieten". */
  188. var add500k = document.getElementById("buttonAdd500k");
  189. add500k.addEventListener("click", ()=>{
  190. inputPrecio.value=500000;
  191. inputDuracion.value = localStorage.SelectHora;
  192. botonVender.click();
  193. });
  194. /* Adding an event listener to the element with the id "buttonAdd1kk". When the user clicks on the
  195. element, the function will be executed. The function will set the value of the element with the id
  196. "preis" to 1000000 and will click on the element with the name "anbieten". */
  197. var add1kk = document.getElementById("buttonAdd1kk");
  198. add1kk.addEventListener("click", ()=>{
  199. inputPrecio.value=1000000;
  200. inputDuracion.value = localStorage.SelectHora;
  201. botonVender.click();
  202. });
  203.  
  204.  
  205. /* Getting the element with the id "CalcularRotativos" from the page. */
  206. var calcularRotativos = document.getElementById("CalcularRotativos");
  207.  
  208. /* Adding HTML to the page. */
  209. calcularRotativos.insertAdjacentHTML('beforeend', "<p>Puedes comprar los siguientes rotativos</p>");
  210. calcularRotativos.insertAdjacentHTML('beforeend', `
  211. <section
  212. style="
  213. display: flex;
  214. flex-direction: row;
  215. flex-wrap: wrap;">
  216. <section
  217. id="col1"
  218. style="
  219. width: 50%;">
  220. </section>
  221. <section
  222. id="col2"
  223. style="
  224. width: 50%;">
  225. </section>
  226. </section>`);
  227.  
  228. /* Getting the elements with the id "col1" and "col2" from the page. */
  229. var col1 = document.getElementById("col1");
  230. var col2 = document.getElementById("col2");
  231.  
  232. /* Creating a variable called text50k and setting it to a string. Then it is inserting the string into
  233. the element with the id "col1". */
  234. var text50k = "<p>50k: "+(Math.floor(oro/50.000))+"</p>";
  235. col1.insertAdjacentHTML('beforeend', text50k);
  236. /* Creating a variable called text100k and setting it to a string. Then it is inserting the string into
  237. the element with the id "col1". */
  238. var text100k = "<p>100k: "+(Math.floor(oro/100.000))+"</p>";
  239. col1.insertAdjacentHTML('beforeend', text100k);
  240. /* Creating a variable called text200k and setting it to a string. Then it is inserting the string into
  241. the element with the id "col1". */
  242. var text200k = "<p>200k: "+(Math.floor(oro/200.000))+"</p>";
  243. col1.insertAdjacentHTML('beforeend', text200k);
  244. /* Creating a variable called text500k and setting it to a string. Then it is inserting the string into
  245. the element with the id "col2". */
  246. var text500k = "<p>500k: "+(Math.floor(oro/500.000))+"</p>";
  247. col2.insertAdjacentHTML('beforeend', text500k);
  248. /* Creating a variable called text1kk and setting it to a string. Then it is inserting the string into
  249. the element with the id "col2". */
  250. var text1kk = "<p>1kk: "+(Math.floor(oro/1000.000))+"</p>";
  251. col2.insertAdjacentHTML('beforeend', text1kk);
  252.  
  253.  
  254. /* Adding an event listener to the element with the id "CalcularRotativosTitle". When the user clicks
  255. on the element, the function will be executed. The function will check if the element with the id
  256. "CalcularRotativos" is visible or not. If it is visible, it will hide it. If it is hidden, it will
  257. show it. */
  258. var calcularRotativosTitle = document.getElementById("CalcularRotativosTitle");
  259. calcularRotativosTitle.addEventListener("click", ()=>{
  260. if(calcularRotativos.style.display == "none"){
  261. calcularRotativos.style.display="block";
  262. }else{
  263. calcularRotativos.style.display="none";
  264. }
  265. });
  266.  
  267.  
  268. document.addEventListener("mouseup",()=>{
  269. if(cajaVenta.children.length>0){
  270. add50k.disabled = false;
  271. add100k.disabled = false;
  272. add200k.disabled = false;
  273. add500k.disabled = false;
  274. add1kk.disabled = false;
  275. }
  276. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址