// ==UserScript== // @name hwm_shop // @author Demin // @namespace Demin // @description Отображает стоимость боя и ОА в магазине и инфе арта, переплаты за покупку и аренду, добавляет быстрые ссылки на рынок (by Demin) // @homepage https://greasyfork.org/users/1602-demin // @icon http://i.imgur.com/LZJFLgt.png // @version 7.2 // @encoding utf-8 // @include http://*heroeswm.ru/shop.php* // @include http://178.248.235.15/shop.php* // @include http://209.200.152.144/shop.php* // @include http://*lordswm.com/shop.php* // @include http://*heroeswm.ru/art_info.php?id=* // @include http://178.248.235.15/art_info.php?id=* // @include http://209.200.152.144/art_info.php?id=* // @include http://*lordswm.com/art_info.php?id=* // @downloadURL https://update.greasyfork.icu/scripts/1222/hwm_shop.user.js // @updateURL https://update.greasyfork.icu/scripts/1222/hwm_shop.meta.js // ==/UserScript== // (c) 2010-2014, demin ( http://www.heroeswm.ru/pl_info.php?id=15091 ) (function() { var version = '7.2'; if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) { this.GM_getValue=function (key,def) { return localStorage[key] || def; }; this.GM_setValue=function (key,value) { return localStorage[key]=value; }; this.GM_deleteValue=function (key) { return delete localStorage[key]; }; } var script_num = 92569; var script_name = "hwm_shop: Отображает стоимость боя и ОА в магазине и инфе арта, переплаты за покупку и аренду, добавляет быстрые ссылки на рынок (by Demin)"; update_n(version,script_num,script_name); var url_cur = location.href; var url = 'http://'+location.hostname+'/'; if ( document.querySelector("body") ) { var array_arts; add_array_arts(); var shop_hide_arts = GM_getValue( "92569_shop_hide_arts", '1' ); var shop_change_sections = GM_getValue( "92569_shop_change_sections", '1' ); if ( url.match('lordswm') ) { var sum = /Amount in stock:<\/b> (\d+)/; var sear = "Required level:"; var searc = /Artifact cost per battle.+(\d+)<\/td>/; var seard = "Cost:"; var shop = "buy on market"; var text0_title = 'Overpayment for buying art in the store (if you take the number to get the price of the plant), ie how much you can save if you walk around the map.'; var text1 = 'Cost per battle: '; var text1_title = 'Price for one fight (minimum when buying art from the factory).\nAP price (the minimum price for the fight).\n\nIn brackets (if any) - overpayment for one fight when buying in a store (if we get the numbers add up the cost of the battle when buying in a store), ie how much you overpay for 1 fight, buying art in the store.'; var text2 = '  Overpay: per battle '; var text2_title = 'Overpayment for rent on 1 battle and overpayment for the entire Prochko. In brackets - the percentage appreciation of the price for the fight, exceeding the cost of their own battle artifacts.'; var text3 = ' all durability '; var s_text1 = 'Hide artifacts'; var s_text1_title = 'Collapses the arts in the store that are not ("Amount in stock: 0").\nClick on the field with the name of art hidden information unfolds.'; var s_text2 = 'Change sections'; var s_text2_title = 'Adds quick links menu:\n- artifact lease (transition in one click),\n- enchanted artifact lease (transition in one click).'; var s_author = 'Script author'; var s_text_menu1 = 'lease'; var s_text_menu2 = 'mod'; var oa_text = 'AP'; } else { var sum = /\u0434\u043B\u044F \u043F\u0440\u043E\u0434\u0430\u0436\u0438:<\/b> (\d+)/; var sear = "\u0422\u0440\u0435\u0431\u0443\u0435\u043C\u044B\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C:"; var searc = /\u0426\u0435\u043D\u0430 \u0430\u0440\u0435\u043D\u0434\u044B \u043D\u0430 1 \u0431\u043E\u0439.+(\d+)<\/td>/; var seard = "\u0421\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C:"; var shop = "поиск на рынке"; var text0_title = 'Переплата за покупку арта в магазине (если числа отнять получим цену завода), т.е. сколько можно сэкономить если прогуляться по карте.'; var text1 = '\u0421\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C 1 \u0431\u043E\u044F: '; var text1_title = 'Цена за 1 бой (минимальная, при покупке арта с завода).\nЦена ОА (от минимальной цены за бой).\n\nВ скобках (если есть) - переплата за 1 бой при покупке в магазине (если числа сложить получим стоимость боя при покупке в магазине), т.е. сколько вы переплатите за 1 бой, купив арт в магазине.'; var text2 = '  \u041F\u0435\u0440\u0435\u043F\u043B\u0430\u0442\u0430: \u0437\u0430 \u0431\u043E\u0439 '; var text2_title = 'Переплата за аренду на 1 бой и переплата за всю прочку. В скобках - процент удорожания цены за бой, превышающий стоимость боя собственных артефактов.'; var text3 = ' \u0437\u0430 \u0432\u0441\u044E \u043F\u0440\u043E\u0447\u043A\u0443 '; var s_text1 = '\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u044B'; var s_text1_title = 'Сворачивает арты в магазине, которых нет ("Доступно для продажи: 0").\nКликом по полю с названием арта скрытая информация разворачивается.'; var s_text2 = '\u0418\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B\u044B'; var s_text2_title = 'Добавляет быстрые ссылки в меню:\n- на аренду категории артов (переход за один клик),\n- на аренду модифицированных артов (переход за один клик).'; var s_author = '\u0410\u0432\u0442\u043E\u0440 \u0441\u043A\u0440\u0438\u043F\u0442\u0430'; var s_text_menu1 = '\u0430\u0440\u0435\u043d\u0434\u0430'; var s_text_menu2 = '\u043c\u043e\u0434'; var oa_text = 'OA'; } if ( location.pathname=='/shop.php' ) { var arts_id_array = document.querySelectorAll("a[href^='art_info.php?id=']"); } else { var arts_id_array = document.querySelectorAll("img[src*='/artifacts/'][src$='.jpg']"); } for ( var i=0; i('+((shop_price-Number(arts_cost_proch))/Number(arts_cost_proch)*100).toFixed(0)+'%),' + text3+Math.round((shop_price-Number(arts_cost_proch))*now_art[3])+'
'; var aj = ai.lastChild.firstChild; aj.parentNode.insertBefore(bt, aj.nextSibling); } } // price one battle if ( ai.innerHTML.indexOf(seard)!=-1 ) { var bt = document.createElement('span'); bt.title = text1_title; bt.innerHTML = '            '+text1+arts_cost_proch + ( now_art[5] == 0 ? ( '  (+'+(now_art[4]/now_art[3]-Number(arts_cost_proch)).toFixed(2)+')' ) : '' ) + '  ('+oa_text+': '+(Number(arts_cost_proch)/now_art[6]).toFixed(2)+')'; var j = 2; var aj = ai.lastChild.childNodes[j]; while ( aj.tagName != 'B' ) { j++; aj = ai.lastChild.childNodes[j]; } if ( //.exec(ai.innerHTML) ) { aj = ai.lastChild.childNodes[j+2]; } else { aj = ai.lastChild.childNodes[j+1]; } aj.parentNode.insertBefore(bt, aj.nextSibling); } // price summ if ( ai.innerHTML.indexOf(seard)!=-1 ) { var aj = ai.querySelector("img[src$='/gold.gif']"); if ( aj.parentNode.nextSibling.innerHTML.match(' ') ) { var bt = document.createElement('td'); bt.innerHTML = '  =  '; aj.parentNode.parentNode.appendChild(bt); bt = aj.parentNode.cloneNode(true); aj.parentNode.parentNode.appendChild(bt); bt = document.createElement('td'); bt.innerHTML = now_art[4]; aj.parentNode.parentNode.appendChild(bt); } // pereplata if ( now_art[5] == 0 ) { bt = document.createElement('td'); bt.title = text0_title; bt.innerHTML = '  (-'+(now_art[4]-Math.floor( now_art[4] * 0.97 ))+')'; aj.parentNode.parentNode.appendChild(bt); } } // link to market if ( now_art[1]!='gift' ) { var bt = document.createElement('span'); bt.innerHTML = '  ['+shop+']'; var aj = ai.lastChild.lastChild; aj.parentNode.insertBefore(bt, aj.nextSibling); } } } } } if ( location.pathname=='/shop.php' ) { shop_hide_f(); // nastrojki var link_transport = document.querySelector("a[href$='shop.php?cat=transport']"); if ( link_transport ) { var bt = document.createElement('br'); link_transport.parentNode.insertBefore(bt, link_transport.nextSibling); var bt = document.createElement('li'); bt.innerHTML = ' '+s_author+': Demin ?
'; link_transport.parentNode.parentNode.insertBefore(bt, link_transport.parentNode.nextSibling); addEvent($("open_transfer_id"), "click", open_transfer_f); var bt = document.createElement('li'); bt.title = s_text2_title; bt.innerHTML = ' '+s_text2+':
'; link_transport.parentNode.parentNode.insertBefore(bt, link_transport.parentNode.nextSibling); addEvent($("shop_change_sections_id"), "click", shop_change_sections_f); var bt = document.createElement('li'); bt.title = s_text1_title; bt.innerHTML = ' '+s_text1+':
'; link_transport.parentNode.parentNode.insertBefore(bt, link_transport.parentNode.nextSibling); addEvent($("shop_hide_arts_id"), "click", shop_hide_arts_f); } // menu if ( shop_change_sections == '1' ) { var link_help = document.querySelector("li > a[href*='shop.php?cat=helm']"); if ( !link_help ) { link_help = document.querySelector("li > a[href*='shop.php?cat=weapon']"); } var all_a = link_help.parentNode.parentNode.querySelectorAll("a[href*='shop.php?cat=']"); for ( var i=0; i'+s_text_menu1+'] ['+s_text_menu2+']
'; a_i.parentNode.insertBefore(bt, a_i.nextSibling); } } } // !======================================== // proverka massiva var flash_heart = document.querySelector("object > param[value*='heart.swf']"); if ( flash_heart ) flash_heart = flash_heart.parentNode.querySelector("param[name='FlashVars']"); if ( flash_heart ) { flash_heart = flash_heart.value.split('|'); if ( flash_heart[3] ) { var nick = flash_heart[3]; } } if ( nick && nick == 'demin' ) { var arts_id_array = document.querySelectorAll("a[href^='art_info.php?id=']"); if ( url.match('lordswm') ) { var proch_regexp = /Durability:<\/b> (\d+)/; var uroven_regexp = /Required level:<\/b> (\d+)/; var uroven_regexp2 = /Required level:<\/b> (\d+)/; var oa_regexp = /Ammunition points:<\/b> (\d+)/; } else { var proch_regexp = /\u041F\u0440\u043E\u0447\u043D\u043E\u0441\u0442\u044C:<\/b> (\d+)/; var uroven_regexp = /\u0422\u0440\u0435\u0431\u0443\u0435\u043C\u044B\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C:<\/b> (\d+)/; var uroven_regexp2 = /\u0422\u0440\u0435\u0431\u0443\u0435\u043C\u044B\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C:<\/b> (\d+)/; var oa_regexp = /\u041E\u0447\u043A\u0438 \u0430\u043C\u0443\u043D\u0438\u0446\u0438\u0438:<\/b> (\d+)/; } for ( var i=0; i3){return}var f=new Date().getTime();var g=document.querySelector('#update_demin_script2');if(g){if((d+86400000f)){g=g.innerHTML;if(/100000=1.1/.exec(g)){var h=new RegExp(b+'=(\\d+\\.\\d+)=(\\d+)').exec(g);var i=/url7=([^%]+)/.exec(g);if(a&&h&&i){if(Number(h[1])>Number(a))setTimeout(function(){if(confirm('\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043A\u0440\u0438\u043F\u0442\u0430: "'+c+'".\n\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E \u0441\u0435\u0439\u0447\u0430\u0441?\n\nThere is an update available for the script: "'+c+'".\nWould you like install the script now?')){if(typeof GM_openInTab=='function'){GM_openInTab(i[1].replace(/\s/g,'')+h[2])}else{window.open(i[1].replace(/\s/g,'')+h[2],'_blank')}}},500)}GM_setValue(b+'_update_script_last2',''+f)}else{setTimeout(function(){update_n(a,b,c,d,e)},1000)}}}else{var j=document.querySelector('body');if(j){var k=GM_getValue(b+'_update_script_array2');if(e==1&&((d+86400000f)||!k)){if(k){GM_deleteValue(b+'_update_script_array2')}setTimeout(function(){update_n(a,b,c,d,e)},1000);return}var l=document.createElement('div');l.id='update_demin_script2';l.setAttribute('style','position: absolute; width: 0px; height: 0px; top: 0px; left: 0px; display: none;');l.innerHTML='';j.appendChild(l);if((d+86400000f)||!k){var m=new XMLHttpRequest();m.open('GET','photo_pl_photos.php?aid=1777'+'&rand='+(Math.random()*100),true);m.onreadystatechange=function(){update(m,a,b,c,d,e)};m.send(null)}else{document.querySelector('#update_demin_script2').innerHTML=k;setTimeout(function(){update_n(a,b,c,d,e)},10)}}}}function update(a,b,c,d,e,f){if(a.readyState==4&&a.status==200){a=a.responseText;var g=/(\d+=\d+\.\d+(=\d+)*)/g;var h='';var i=/(url7=[^%]+\%)/.exec(a);if(i){h+=i[1]}while((i=g.exec(a))!=null){if(h.indexOf(i[1])==-1){h+=' '+i[1]}};GM_setValue(c+'_update_script_array2',''+h);var j=document.querySelector('#update_demin_script2');if(j){j.innerHTML=h;setTimeout(function(){update_n(b,c,d,e,f)},10)}}} })();