Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////
- //////////////////////// Alerts V1 /////////////////////////
- ////////////////////////////////////////////////////////////
- label autorun
- Telegram = "on" // Alert though Telegram
- // Post the loginurl and keys to Telegram so ppl can log.
- // If turned on please make sure safe scripting is unchecked in global settings
- LogIn = "off"
- // Alert the alliance if being hit.
- DoAllianceAlert = "on"
- // Excluded attackers. If these are the people attacking, let's ignore it.
- Allowed = {Alliances:["11"],Accounts:["MissMe"]}
- // Check types, these are the type of checks to perform:
- Check = {Attacks:"on",BrokenGates:"on",LowFood:"off",FoodHoursLeft:4,SleepTimeBetweenChecks:"0:30"}
- // Telegram room settings (use V1, Hydros or Moss)
- Alliance = "V1"
- ////////////////////////////////////////////////////////////
- ///////////////////nothing to edit below////////////////////
- ////////////////////////////////////////////////////////////
- if (LogIn.toLowerCase() == "on") LoginURL = 'http://'+Config.server+'.evony.com/s.html?loginid='+("username={Config.username}&password={Config.password}&ip={Config.serverhost}®=0".split("").map(CreateFunction("s,i,a","s.charCodeAt().toString(16)")).join(""))
- if !(city.script.variables["Under2000"]) Under2000 = true
- execute (Alliance == "V1") && "ChatID = '-1001112000533'" || (Alliance == "Hydros") && "ChatID = '-206767562'" || (Alliance == "Moss") && "ChatID = '-118635529'" || "goto Wrong"
- if (LogIn.toLowerCase() == "off") goto Check
- @password = Config.password
- if $error goto Wrong
- label Check
- 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')" || ""
- 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')" || ""
- 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')" || ""
- execute "sleep {Check.SleepTimeBetweenChecks}"
- goto Check
- ////////////////////////////////////////////////////////////
- //////////////////////// Functions /////////////////////////
- ////////////////////////////////////////////////////////////
- function Alert(type)
- 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"
- label foodAlertA
- (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!")
- if (nofoodcities==null) || (nofoodcities == "") || !(nofoodcities) return
- goto EndAlerts
- label foodAlertB
- (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>.")
- if (nofoodcities==null) || (nofoodcities == "") || !(nofoodcities) return
- goto EndAlerts
- label gatesAlertA
- (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!")
- goto EndAlerts
- label gatesAlertB
- (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>")
- goto EndAlerts
- label attackAlertA
- 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>')"
- 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
- (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!")
- if (Attacker==null) || (Attacker == "") || !(Attacker) return
- goto EndAlerts
- label attackAlertB
- 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>')"
- 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
- (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>.")
- if (Attacker==null) || (Attacker == "") || !(Attacker) return
- goto EndAlerts
- label EndAlerts
- 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()}
- 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."
- echo ChatMessage
- if (Global.DoAllianceAlert.toLowerCase() == "on") execute "alliancechat {ChatMessage}"
- execute "sleep 05:00"
- return
- label Wrong
- Screen.mainLog.addEvent("<b><font color='#FF1493' size='130'><br>WANKER")
- Screen.mainLog.addEvent("<b><font color='#FF1493' size='28'><br>YOU FUCKED SOMETHING UP!!!!!")
- 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.")
- @password = Config.password
- if $error Screen.mainLog.addEvent("<b><font color='#9400D3' size='28'><br>You didnt disable safe mode!\nAsk TL for further assistance.")
- Screen.mainLog.addEvent("<b><font color='#FF1493' size='28'><br>Script Stopped!!!!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement