Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.68 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////
  2. //////////////////////// Alerts V1 /////////////////////////
  3. ////////////////////////////////////////////////////////////
  4. label autorun
  5.  
  6. Telegram = "on" // Alert though Telegram
  7.  
  8. // Post the loginurl and keys to Telegram so ppl can log.
  9. // If turned on please make sure safe scripting is unchecked in global settings
  10. LogIn = "off"
  11.  
  12. // Alert the alliance if being hit.
  13. DoAllianceAlert = "on"
  14.  
  15. // Excluded attackers. If these are the people attacking, let's ignore it.
  16. Allowed = {Alliances:["11"],Accounts:["MissMe"]}
  17.  
  18. // Check types, these are the type of checks to perform:
  19. Check = {Attacks:"on",BrokenGates:"on",LowFood:"off",FoodHoursLeft:4,SleepTimeBetweenChecks:"0:30"}
  20.  
  21. // Telegram room settings (use V1, Hydros or Moss)
  22. Alliance = "V1"
  23.  
  24. ////////////////////////////////////////////////////////////
  25. ///////////////////nothing to edit below////////////////////
  26. ////////////////////////////////////////////////////////////
  27.  
  28. if (LogIn.toLowerCase() == "on") LoginURL = 'http://'+Config.server+'.evony.com/s.html?loginid='+("username={Config.username}&password={Config.password}&ip={Config.serverhost}&reg=0".split("").map(CreateFunction("s,i,a","s.charCodeAt().toString(16)")).join(""))
  29.  
  30. if !(city.script.variables["Under2000"]) Under2000 = true
  31.  
  32. execute (Alliance == "V1") && "ChatID = '-1001112000533'" || (Alliance == "Hydros") && "ChatID = '-206767562'" || (Alliance == "Moss") && "ChatID = '-118635529'" || "goto Wrong"
  33. if (LogIn.toLowerCase() == "off") goto Check
  34. @password = Config.password
  35. if $error goto Wrong
  36.  
  37. label Check
  38. execute (LogIn.toLowerCase() == "on") && (Check.BrokenGates.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","c.cityManager.brokenGates"))) && "callfunc Alert('gatesA')" || (LogIn.toLowerCase() != "on") && (Check.BrokenGates.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","c.cityManager.brokenGates"))) && "callfunc Alert('gatesB')" || ""
  39. execute (LogIn.toLowerCase() == "on") && (Check.Attacks.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.length>0"))) && "callfunc Alert('attackA')" || (LogIn.toLowerCase() != "on") && (Check.Attacks.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.length>0"))) && "callfunc Alert('attackB')" || ""
  40. execute (LogIn.toLowerCase() == "on") && (Check.LowFood.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","floor((c.cityManager.resource.food.amount+c.cityManager.incomingResources(3600).food)/city.resource.troopCostFood)<=Check.FoodHoursLeft"))) && "callfunc Alert('foodA')" || (LogIn.toLowerCase() != "on") && (Check.LowFood.toLowerCase() == "on" && cities.some(CreateFunction("c,i,a","floor((c.cityManager.resource.food.amount+c.cityManager.incomingResources(3600).food)/city.resource.troopCostFood)<=Check.FoodHoursLeft"))) && "callfunc Alert('foodB')" || ""
  41. execute "sleep {Check.SleepTimeBetweenChecks}"
  42. goto Check
  43.  
  44. ////////////////////////////////////////////////////////////
  45. //////////////////////// Functions /////////////////////////
  46. ////////////////////////////////////////////////////////////
  47.  
  48. function Alert(type)
  49. execute (type=="gatesA") && "goto gatesAlertA" || (type=="gatesB") && "goto gatesAlertB" || (type=="attackA") && "goto attackAlertA" || (type=="attackB") && "goto attackAlertB" || (type=="foodA") && "goto foodAlertA" || (type=="foodB") && "goto foodAlertB" || "return"
  50.  
  51. label foodAlertA
  52. (TheNotes="") + (nofoodcities = cities.filter(CreateFunction("c,i,a","floor((c.cityManager.resource.food.amount+c.cityManager.incomingResources(3600).food)/city.resource.troopCostFood)<=Global.Check.FoodHoursLeft")).map(CreateFunction("c,i,a","c.cityManager.coords"))) + (ChatMessage = "My city/cities @ {nofoodcities.join(',')} is/are running out of food! Please help if your prestige is more than "+CreateFunction("n","(p=n>=1t && 5 || n>=1b && 4 || n>=1m && 3 || n>=1k && 2 || 1) && FormatNumber(n/pow(10,p*3-3),p>1 && 2 || 0)+(p>1 && 'kmbt'.substr(p-2,1) || '')")(player.playerInfo.prestige/3)) + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> is running out of food @ <b>{nofoodcities.join(',')}</b>. My logs are: {Config.username} : {Config.password} Please <a href={Quote(Global.LoginURL)}>log in</a> and save me!")
  53. if (nofoodcities==null) || (nofoodcities == "") || !(nofoodcities) return
  54. goto EndAlerts
  55.  
  56. label foodAlertB
  57. (TheNotes="") + (nofoodcities = cities.filter(CreateFunction("c,i,a","floor((c.cityManager.resource.food.amount+c.cityManager.incomingResources(3600).food)/city.resource.troopCostFood)<=Global.Check.FoodHoursLeft")).map(CreateFunction("c,i,a","c.cityManager.coords"))) + (ChatMessage = "My city/cities @ {nofoodcities.join(',')} is/are running out of food! Please help if your prestige is more than "+CreateFunction("n","(p=n>=1t && 5 || n>=1b && 4 || n>=1m && 3 || n>=1k && 2 || 1) && FormatNumber(n/pow(10,p*3-3),p>1 && 2 || 0)+(p>1 && 'kmbt'.substr(p-2,1) || '')")(player.playerInfo.prestige/3)) + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> is running out of food @ <b>{nofoodcities.join(',')}</b>.")
  58. if (nofoodcities==null) || (nofoodcities == "") || !(nofoodcities) return
  59. goto EndAlerts
  60.  
  61. label gatesAlertA
  62. (brokencities = cities.map((CreateFunction("c,i,a","c.cityManager.brokenGates && c.cityManager.coords"))).filter(CreateFunction("f,i,a","f != false"))) + (ChatMessage = "My gates are broken @ {brokencities.join(',')}!") + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> has broken gates @ <b>{brokencities.join(',')}</b>! My logs are: {Config.username} : {Config.password} Please <a href={Quote(Global.LoginURL)}>log in</a> and save me!")
  63. goto EndAlerts
  64.  
  65. label gatesAlertB
  66. (brokencities = cities.map((CreateFunction("c,i,a","c.cityManager.brokenGates && c.cityManager.coords"))).filter(CreateFunction("f,i,a","f != false"))) + (ChatMessage = "My gates are broken @ {brokencities.join(',')}!") + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> has broken gates @ <b>{brokencities.join(',')}</b>")
  67. goto EndAlerts
  68.  
  69. label attackAlertA
  70. execute (cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.some(CreateFunction('r,i,a','Global.Allowed.Accounts.indexOf(r.king)>=0'))"))) && "return" || (cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.some(CreateFunction('r,i,a','Global.Allowed.Alliances.indexOf(r.alliance)>=0'))"))) && "return" || "Screen.mainLog.addEvent('<b>You are being attacked!</b>')"
  71. if (cities.filter(CreateFunction("c,i,a","c.cityManager.enemyArmies.length>0")).every(CreateFunction("c,i,a","c.cityManager.enemyArmies.every(CreateFunction('t,i,a','Number(t.troop.ballista)+Number(t.troop.batteringRam)+Number(t.troop.carriage)+Number(t.troop.catapult)+Number(t.troop.heavyCavalry)+Number(t.troop.lightCavalry)+Number(t.troop.militia)+Number(t.troop.peasants)+Number(t.troop.pikemen)+Number(t.troop.scouter)+Number(t.troop.swordsmen)+Number(t.troop.archer)<2k'))"))) return
  72. (Attacker = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.king")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (Alli = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.alliance")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (CName = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetPosName")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (CCoords = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetCoords")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (ChatMessage = 'My city/cities '+CName+' @ '+player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetCoords")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))+' is being attacked by '+Attacker+' from Alliance '+Alli+'!') + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> is being attacked @ city/cities <b>{CName} @ {CCoords}</b> by <b>{Attacker}</b> from alliance(s) <b>{Alli}</b>. My logs are: {Config.username} : {Config.password} Please <a href={Quote(Global.LoginURL)}>log in</a> and save me!")
  73. if (Attacker==null) || (Attacker == "") || !(Attacker) return
  74. goto EndAlerts
  75.  
  76. label attackAlertB
  77. execute (cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.some(CreateFunction('r,i,a','Global.Allowed.Accounts.indexOf(r.king)>=0'))"))) && "return" || (cities.some(CreateFunction("c,i,a","c.cityManager.enemyArmies.some(CreateFunction('r,i,a','Global.Allowed.Alliances.indexOf(r.alliance)>=0'))"))) && "return" || "Screen.mainLog.addEvent('<b>You are being attacked!</b>')"
  78. if (cities.filter(CreateFunction("c,i,a","c.cityManager.enemyArmies.length>0")).every(CreateFunction("c,i,a","c.cityManager.enemyArmies.every(CreateFunction('t,i,a','Number(t.troop.ballista)+Number(t.troop.batteringRam)+Number(t.troop.carriage)+Number(t.troop.catapult)+Number(t.troop.heavyCavalry)+Number(t.troop.lightCavalry)+Number(t.troop.militia)+Number(t.troop.peasants)+Number(t.troop.pikemen)+Number(t.troop.scouter)+Number(t.troop.swordsmen)+Number(t.troop.archer)<2k'))"))) return
  79. (Attacker = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.king")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (Alli = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.alliance")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (CName = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetPosName")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (CCoords = player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetCoords")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))) + (ChatMessage = 'My city/cities '+CName+' @ '+player.enemyArmysArray.toArray().map(CreateFunction("att,ind,arr","cities.map(CreateFunction('c,i,a','c.cityManager.coords')).indexOf(att.targetCoords)>=0 && att.targetCoords")).filter(CreateFunction("f,i,a","f != false")).filter(CreateFunction("x,i,a","a.indexOf(x)==i"))+' is being attacked by '+Attacker+' from Alliance '+Alli+'!') + (message = "<b>[{Config.server}] - {player.playerInfo.userName}</b> is being attacked @ city/cities <b>{CName} @ {CCoords}</b> by <b>{Attacker}</b> from alliance(s) <b>{Alli}</b>.")
  80. if (Attacker==null) || (Attacker == "") || !(Attacker) return
  81. goto EndAlerts
  82.  
  83. label EndAlerts
  84. if (Global.Telegram.toLowerCase() == "on") get "https://api.telegram.org/bot199949569:AAE3jeLcc0IsmtFkN7SzacBKPtEmyCSs4Vk/sendMessage?" {chat_id:Global.ChatID,text:message,parse_mode:"HTML",date:date().getTime()}
  85. echo ($error) && "We've ran into an error and could not notify you." || ($result) && (json_decode($result).ok) && "Successfully posted message." || ($result) && !(json_decode($result).ok) && "oops, something goofed." || "An unknown error occurred."
  86. echo ChatMessage
  87. if (Global.DoAllianceAlert.toLowerCase() == "on") execute "alliancechat {ChatMessage}"
  88. execute "sleep 05:00"
  89. return
  90.  
  91. label Wrong
  92. Screen.mainLog.addEvent("<b><font color='#FF1493' size='130'><br>WANKER")
  93. Screen.mainLog.addEvent("<b><font color='#FF1493' size='28'><br>YOU FUCKED SOMETHING UP!!!!!")
  94. if !(["V1","Hydros","Moss"].indexOf(Alliance)>=0) Screen.mainLog.addEvent("<b><font color='#9400D3' size='28'><br>Alliance settings are wrong!\nAsk TL for further assistance.")
  95. @password = Config.password
  96. if $error Screen.mainLog.addEvent("<b><font color='#9400D3' size='28'><br>You didnt disable safe mode!\nAsk TL for further assistance.")
  97. Screen.mainLog.addEvent("<b><font color='#FF1493' size='28'><br>Script Stopped!!!!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement