Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*______________________________________________________________________________
- ********************************************************************************
- WriterScriptIs : Abu.Rajih *
- VersionScript : 1.0v *
- DateWroteScript: 24-07-2019 *
- URL : https://forum.tribalwars.ae/index.php?members/abu-rajih.40926/*
- _______________________________________________________________________________*
- ********************************************************************************
- ######## ## ######### $$ $$ ## *
- ## ## ## ## ## ###### $$ $$ ## *
- ## ## ## ## ## # ## *
- ########## ## #### ## ## ## ## ######## ## ## ####### *
- ## ## ### ## ## ## ######## ## ## ## ## ## ## *
- ## ## ## ## ## ## ## ## ## ## ## ## ## ## *
- ## ## ## ## ## ## $$ ## ## ## ## ## ## ## ## *
- ## ## ###### ##### $$ ## ## ###### # ## ## ## ## *
- ## *
- ## ## *
- #### *
- _______________________________________________________________________________*
- *******************************************************************************/
- //javascript:
- let jQuery = window.jQuery;
- jQuery(($)=>{
- if(!window.location.href.match(/&screen=overview_villages/) && !window.location.href.match(/&screen=market/))
- {
- window.UI.InfoMessage('السكربت يعمل من الشكل العام >> الانتاج << والسوق فقط',3000,'error');
- return false;
- }
- window.Explain = 'https://forum.tribalwars.ae/index.php?threads/%D8%B3%D9%83%D8%B1%D8%A8%D8%AA-%D9%85%D9%88%D8%A7%D8%B2%D9%86%D8%A9-%D8%A7%D9%84%D9%85%D9%88%D8%A7%D8%B1%D8%AF-%D8%A7%D9%84%D8%AC%D8%AF%D9%8A%D8%AF.96832/';
- window.Sign = `<center>
- <table style='border-collapse:collapse' id = 'table'>
- <tr><th id = 'th' colspan = '4'>
- <b style='font-family:times new roman;font-size:16px;text-align:center;'>مبرمج السكربت</b>
- </th></tr>
- <tr>
- <td id = 'td' colspan = '3' style='background-color:#111'>
- <a id="Salim" title = 'Abu.Rajih' href="https://forum.tribalwars.ae/index.php?members/abu-rajih.40926/" target="_blank">سيد الاساطير</a>
- </td></tr>
- <tr><th id = 'th' colspan = '2'>
- شرح السكربت
- </th>
- <th id = 'th' colspan = '2'>
- <a style='font-family:times new roman;font-size:16px;' href=`+window.Explain+` target="_blank">اضغط هنا</a>
- </tr>
- </table>
- </center>
- <style>
- #table,#th,#td
- {
- border:1px solid black;
- font-family:times new roman;
- font-size:16px;
- text-align:center;
- width:300px;
- }
- #Salim
- {
- font-family:times new roman;
- font-size: 20px;
- animation: salim 1s linear infinite;
- }
- @keyframes salim
- {
- 0% {text-shadow:0 0 5px #eee;color:#efe;}
- 15% {text-shadow:0 0 12px #eee;}
- 30% {text-shadow:0 0 5px #eee;}
- 45% {color:rgba(255,255,255,.10);}
- 60% {text-shadow:0 0 5px #0f0;color:#eee;}
- 80% {text-shadow:0 0 12px #eee;}
- 100%{text-shadow:0 0 5px #0f0;color:#aaf;}
- }
- </style>`;
- $("#production_table , #market-send-form").before(window.Sign);
- var sS = sessionStorage;
- var lS = localStorage;
- if(window.location.href.match(/&screen=overview_villages/g)){
- $("#production_table > tbody > tr:eq(0) > th:eq(3)").after("<th id='fromResources'><b>من</b></th>");
- $("#production_table > tbody > tr:eq(0) > th:eq(4)").after("<th id='toResources'><b>إلى</b></th>");
- $("#production_table > tbody > tr").not("tr:eq(0)").find("td:eq(3)").after("<td><input type='button' value='إلى' class='btn btn-larger' title='to'></td>");
- sS.setItem("from","");
- sS.setItem("to","");
- $("#production_table > tbody > tr").each(function(i){
- var tr0 = $(this);
- var tr1 = $(this);
- $(this).find("td:eq(3)").after("<td id='sendResources'><input type='button' value='من' class='btn btn-larger' title='from'></td>");
- var findVillageId = $(this).find("td:nth-child(2) > span > span > a:nth-child(1)").attr('href');
- var Resources = $(this).find("td:nth-child(4)");
- $(Resources).attr("style" , "background:#333 !important")
- $(Resources).find("span[class=grey]").remove();
- var wood = $(Resources).find("span").eq(0).text();
- var stone = $(Resources).find("span").eq(1).text();
- var iron = $(Resources).find("span").eq(2).text();
- if(wood <= 25000){
- $(Resources).find("span").eq(0).css({'color':'#f00','font-weight':'bold',});
- $(Resources).find("span").eq(0).attr("id","red");
- }
- else if(wood > 25000 && wood <= 80000){
- $(Resources).find("span").eq(0).css({'color':'#ff0','font-weight':'bold',});
- $(Resources).find("span").eq(0).attr("id","yellow");
- }
- else if(wood > 80000){
- $(Resources).find("span").eq(0).css({'color':'#0f0','font-weight':'bold',});
- $(Resources).find("span").eq(0).attr("id","green");
- }
- if(stone <= 25000){
- $(Resources).find("span").eq(1).css({'color':'#f00','font-weight':'bold',});
- $(Resources).find("span").eq(1).attr("id","red");
- }
- else if(stone > 25000 && stone <= 80000){
- $(Resources).find("span").eq(1).css({'color':'#ff0','font-weight':'bold',});
- $(Resources).find("span").eq(1).attr("id","yellow");
- }
- else if(stone > 80000){
- $(Resources).find("span").eq(1).css({'color':'#0f0','font-weight':'bold',});
- $(Resources).find("span").eq(1).attr("id","green");
- }
- if(iron <= 25000){
- $(Resources).find("span").eq(2).css({'color':'#f00','font-weight':'bold',});
- $(Resources).find("span").eq(2).attr("id","red");
- }
- else if(iron > 25000 && iron <= 80000){
- $(Resources).find("span").eq(2).css({'color':'#ff0','font-weight':'bold',});
- $(Resources).find("span").eq(2).attr("id","yellow");
- }
- else if(iron > 80000){
- $(Resources).find("span").eq(2).css({'color':'#0f0','font-weight':'bold',});
- $(Resources).find("span").eq(2).attr("id","green");
- }
- if($(Resources).find("span").eq(0).attr("id") == 'green' && $(Resources).find("span").eq(1).attr("id") == 'green' && $(Resources).find("span").eq(2).attr("id") == 'green')
- {
- $(this).find('input[title=to]').remove();
- }
- $(this).find('input[title="from"]').on('click' , function(){
- var fromThisVillage = findVillageId.match(/\d+/);
- sS.setItem("from" , fromThisVillage);
- if(sS.getItem("from") != null)
- {
- $(this).attr("class","btn btn-confirm-yes btn-larger");
- var from = $.trim($(tr0).find("td:nth-child(2) > span > span > a:nth-child(1)").text());
- sS.setItem("ThisVillage",from);
- }
- });
- if(sS.getItem("to") != null){
- $(this).find('input[title="to"]').on('click' , function(){
- $(this).attr("class","btn btn-confirm-no btn-larger");
- var toThisVillage = findVillageId.match(/\d+/);
- sS.setItem("to" , toThisVillage);
- window.open('/game.php?village='+sS.getItem("from")+'&screen=market&mode=send&target='+sS.getItem("to")+'','_blank');
- window.CheckWood = $(tr0).find("td:eq(3)").find('span[class="res wood"]').text();
- window.CheckStone = $(tr0).find("td:eq(3)").find('span[class="res stone"]').text();
- window.CheckIron = $(tr0).find("td:eq(3)").find('span[class="res iron"]').text();
- window.Storage = $(tr0).find("td:eq(6)").text();
- lS.setItem("WOOD" , window.CheckWood);
- lS.setItem("STONE" , window.CheckStone);
- lS.setItem("IRON" , window.CheckIron);
- lS.setItem("STORAGE", window.Storage);
- });
- }
- });
- }
- if(window.location.href.match(/&screen=market&mode=send&target/g)){
- window.ToVillage = $(".village-name").text();
- $("#market-send-form").before("<br><table id='table' style='border-collapse:collapse' align='center'><tr style='background-color:#d3b271;' id='th'><td id='td' colspan='4'><b style='font-family:times new roman;font-size:16px;text-align:center;'>سيتم تحويل الموارد</b></td></tr><tr id='th'><td id='td' style='background-color:#d3b271;'><b style='font-family:times new roman;font-size:16px;text-align:center;'>مـن</b></td><td id='td'><span style='color:#0a0;'>"+sS.getItem("ThisVillage")+"</td><td style='background-color:#d3b271;' id='td'></span><b style='font-family:times new roman;font-size:16px;text-align:center;'>إلـى</b></td><td id='td'><span style='color:#a00;'>"+window.ToVillage+"</span></td></tr><tr style='background-color:#d3b271;' id='th'><td colspan='4'><b style='font-family:times new roman;font-size:16px;text-align:center;'>أختر طريقة توزيع الموارد</b></tr><tr></tr><td id='td'> <input class='btn btn-larger' type='button' value='%5' title='تحتاج الى 60 تاجر بالقريه' id='S5N'> </td><td id='td'><input class='btn btn-larger' type='button' value='%10' title='تحتاج الى 120 تاجر بالقريه' id='S10N'></td><td id='td'><input class='btn btn-larger' type='button' value='%15' title='تحتاج الى 180 تاجر بالقرية' id='S15N'></td><td id='td'><input class='btn btn-larger' type='button' value='تلقائي' id='AutoSendResources'></td></table>");
- $("#AutoSendResources").click(()=>{
- var MaxTransport = $("#market_merchant_max_transport").text();
- if(parseInt(lS.getItem("WOOD")) <= parseInt(MaxTransport)){
- if(lS.getItem("WOOD") < 80000)
- {
- window.SetWood = parseInt(80000 - lS.getItem("WOOD"));
- if(parseInt(MaxTransport) > window.SetWood)
- {
- $("input[name=wood]").val(window.SetWood);
- window.CheckMaxTransportForWood = parseInt(MaxTransport) - parseInt(window.SetWood);
- console.log('%c window.CheckMaxTransportForWood = ' + window.CheckMaxTransportForWood , 'color:orange;font-weight:bold');
- }else{
- console.log("more 0");
- $('a[class="insert wood"]').click();
- }
- }
- else
- {
- if(lS.getItem("STONE") < 80000)
- {
- window.SetStone = parseInt(80000 - lS.getItem("STONE"));
- if(parseInt(MaxTransport) > window.SetStone)
- {
- $("input[name=stone]").val(window.SetStone);
- window.CheckMaxTransportForStone = parseInt(MaxTransport) - parseInt(window.SetStone);
- console.log('%c window.CheckMaxTransportForStone = ' + window.CheckMaxTransportForStone , 'color:Black;font-weight:bold');
- }else{
- console.log("more 1");
- $('a[class="insert stone"]').click();
- }
- }
- else{
- if(lS.getItem("IRON") < 80000)
- {
- window.SetIron = parseInt(80000 - lS.getItem("IRON"));
- if(parseInt(MaxTransport) > window.SetIron)
- {
- $("input[name=iron]").val(window.SetIron);
- window.CheckMaxTransportForIron = parseInt(MaxTransport) - parseInt(window.SetIron);
- console.log('%c window.CheckMaxTransportForIron = ' + window.CheckMaxTransportForIron , 'color:gray;font-weight:bold');
- }
- else{
- console.log("more 2");
- $('a[class="insert iron"]').click();
- }
- }
- }}
- }
- if($("input[name=wood]").val() != null){
- if(parseInt(lS.getItem("STONE")) <= parseInt(MaxTransport)){
- if(lS.getItem("STONE") < 80000)
- {
- window.SetStone = parseInt(80000 - lS.getItem("STONE"));
- if(parseInt(window.CheckMaxTransportForWood) > window.SetStone)
- {
- $("input[name=stone]").val(window.SetStone);
- window.CheckMaxTransportForStone = parseInt(window.CheckMaxTransportForWood) - parseInt(window.SetStone);
- console.log('%c window.CheckMaxTransportForStone = ' + window.CheckMaxTransportForStone , 'color:#a0a;font-weight:bold');
- }else{
- console.log("more 3");
- $('a[class="insert stone"]').click();
- }
- }
- else{
- if(lS.getItem("IRON") < 80000)
- {
- window.SetIron = parseInt(80000 - lS.getItem("IRON"));
- if(parseInt(MaxTransport) > window.SetIron)
- {
- $("input[name=iron]").val(window.SetIron);
- window.CheckMaxTransportForIron = parseInt(MaxTransport) - parseInt(window.SetIron);
- console.log('%c window.CheckMaxTransportForIron = ' + window.CheckMaxTransportForIron , 'color:Blue;font-weight:bold');
- }
- else{
- console.log("more 4");
- $('a[class="insert iron"]').click();
- }
- }
- }}
- if($("input[name=stone]").val() == null){
- if(parseInt(lS.getItem("IRON")) <= parseInt(MaxTransport)){
- if(lS.getItem("IRON") < 80000)
- {
- window.SetIron = parseInt(80000 - lS.getItem("IRON"));
- if(parseInt(window.CheckMaxTransportForStone) > window.SetIron)
- {
- $("input[name=iron]").val(window.SetIron);
- window.CheckMaxTransportForIron = parseInt(window.CheckMaxTransportForStone) - parseInt(window.SetIron);
- console.log('%c window.CheckMaxTransportForIron = ' + window.CheckMaxTransportForIron , 'color:Green;font-weight:bold');
- }
- else{
- console.log("more 5 : " + window.CheckMaxTransportForIron);
- $('a[class="insert iron"]').click();
- }
- }}
- }
- else if($("input[name=wood]").val() != null && $("input[name=stone]").val() != null){
- if(parseInt(lS.getItem("IRON")) <= parseInt(MaxTransport)){
- if(lS.getItem("IRON") < 80000)
- {
- window.SetIron = parseInt(80000 - lS.getItem("IRON"));
- if(parseInt(MaxTransport) > window.SetIron)
- {
- $("input[name=iron]").val(window.SetIron);
- window.CheckMaxTransportForIron = parseInt(MaxTransport) - parseInt(window.SetIron);
- console.log('%c window.CheckMaxTransportForIron = ' + window.CheckMaxTransportForIron , 'color:Green;font-weight:bold');
- }
- else{
- console.log("more 6 : " + window.CheckMaxTransportForIron);
- $('a[class="insert iron"]').click();
- }
- }}
- }
- var totalWoodStone = parseInt($("input[name=wood]").val())+parseInt($("input[name=stone]").val());
- if(parseInt(totalWoodStone) <= parseInt(MaxTransport))
- {
- $("input[name=iron]").val(parseInt(MaxTransport) - parseInt(totalWoodStone));
- }
- }
- setTimeout(()=>{
- $('input[value="ارسل"]').click();
- },200);
- });
- $("#S5N").click(()=>{
- window.TheResult = parseInt(lS.getItem("STORAGE") * 0.05);
- $('input[name="wood"],input[name="stone"],input[name="iron"]').val(window.TheResult);
- setTimeout(()=>{
- $('input[value="ارسل"]').click();
- },200);
- });
- $("#S10N").click(()=>{
- window.TheResult = parseInt(lS.getItem("STORAGE") * 0.10);
- $('input[name="wood"],input[name="stone"],input[name="iron"]').val(window.TheResult);
- setTimeout(()=>{
- $('input[value="ارسل"]').click();
- },200);
- });
- $("#S15N").click(()=>{
- window.TheResult = parseInt(lS.getItem("STORAGE") * 0.15);
- $('input[name="wood"],input[name="stone"],input[name="iron"]').val(window.TheResult);
- setTimeout(()=>{
- $('input[value="ارسل"]').click();
- },200);
- });
- sS.setItem("ThisVillage","");
- }
- if(window.location.href.match(/&screen=market&mode=send&try=confirm_send/))
- {
- $('input[value="ارسل"]').click();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement