Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SmartAttackScript
javascript:var Settings={Mode:0,Times:[0,6,12,18],Range: 1,Include:{Scout:1},Troops:[{Ram:1,All:1},{Catapult:1,All:1},{Spear:1,Sword:1,Axe:1,Light:1,Heavy:1,All:0}],Limit:{},Keep:0,Coords:'469|513 472|509 476|535 558|505 562|506 566|505 568|504 568|510 568|512 570|504 570|505 571|506 403|543 404|524 407|500 410|501 413|549 413|550 414|543 414|544 415|546 431|529 433|521 433|526 438|517 440|523 443|527 444|521 451|528 452|525 453|532 454|521 454|522 458|518 460|515 472|527 472|528 475|537 475|539 477|537 478|541 479|541 480|526 480|538 480|542 481|539 482|522 484|519 484|538 486|513 486|530 488|526 490|525 493|511 494|523 526|502 529|500 536|537 537|512 537|536 537|537 538|536 539|539 541|538 562|504 564|501 566|501 569|501 571|504 592|523 593|520 593|525 594|522 595|511 596|519 596|525 596|527 597|524 461|510 463|516 465|517 465|520 466|517 466|519 485|538 487|534 487|536 492|527 492|528 492|529 493|527 494|521 496|516 497|521 499|518 499|520 499|521 499|522 500|520 500|521 500|522 509|514 513|516 513|517 514|514 515|516 515|517 515|518 515|519 516|528 517|525 517|530 518|529 518|530 519|522 519|524 519|525 519|530 520|524 521|524 521|527 521|529 521|530 522|525 522|526 522|527 522|528 523|525 523|526 523|529 524|524 524|526 524|527 525|525 525|526 525|527 526|525 526|526 528|522 538|540 539|515 539|533 539|541 540|533 540|534 541|516 541|534 542|513 542|515 542|534 543|516 544|507 546|515 547|516 470|524 477|523 479|523 536|503 537|506 539|503 540|503 540|514 541|513 558|502 558|504 579|509 586|516 587|514 587|516 588|510 590|511 592|511 594|519 595|512 596|510 400|518 401|518 402|518 403|518 404|522 409|523 410|524 411|521 415|529 417|527 433|519 435|518 435|521 436|518 439|525 445|527 445|529 446|527 446|528 446|529 446|530 446|531 447|527 447|528 447|530 454|509 455|508 456|509 456|528 457|507 459|518 461|519 461|520 463|526 463|529 463|530 464|525 464|526 471|523 482|521 516|525 522|529 402|516 409|509 411|500 412|517 413|501 413|516 413|518 415|523 416|522 416|523 416|528 417|519 417|520 417|528 418|512 418|527 418|529 418|530 419|547 420|511 420|518 420|526 420|548 420|549 421|526 421|527 422|520 423|506 424|506 425|530 426|505 429|534 430|534 433|512 436|512 437|514 438|508 439|501 451|537 452|532 452|534 453|533 454|532 456|529 456|532 457|526 457|527 457|531 479|530 482|535 496|505 539|540 584|502 587|517 591|500 593|510 599|515 408|508 408|509 408|510 429|502 482|526 483|535 491|528 596|520 598|505 598|510 598|529 599|519 457|510 459|513 461|511 462|509 462|510 462|511 462|516 462|517 463|510 465|510 465|511 466|509 466|510 522|500 528|500 528|504 533|500 534|501 534|503 538|503 551|511 552|514 553|512 509|513 510|513 510|514 512|514 527|511 590|506 590|508 591|506 591|518 592|507 593|508 594|507 594|520 595|526 596|528 401|534 402|534 404|528 404|530 404|531 405|529 405|530 405|531 406|508 406|522 406|530 406|532 407|531 408|527 408|528 408|531 408|533 409|527 410|526 412|537 418|528 425|532 475|535 477|534 590|500 476|541 478|542 479|539 480|541 481|534 481|540 482|537 482|539 482|541 483|539 488|533 402|548 408|548 408|550 408|551 409|548 409|549 409|550 410|547 412|550 413|548 415|548 415|551 418|551 419|550 439|532 442|533 444|514 445|514 449|512 449|518 449|519 450|514 450|517 450|518 450|519 450|520 451|512 451|518 ', Click:2 };(function()%7Bvar%20SmartAttackScript%20%3D%7BVersion%3A%201.0%2CModes%3A%20%5B0%2C1%2C3%5D%2CTextData%3A%20%7BNotTWPage%3A%20%22This%20script%20needs%20to%20be%20run%20in%20TribalWars%20page!%22%2CNotRallyPoint%3A%20%22This%20script%20needs%20to%20be%20run%20from%20the%20Rally%20point!%22%2CNoSettings%3A%20%22Script%20Settings%20not%20specified!%22%2CNoCoordsTroops%3A%20%22Nothing%20done%2C%20no%20coords%20and%20troops%20specified!%22%2CNoTimes%3A%20%22Times%20not%20specified!%22%2CNoRange%3A%20%22Range%20not%20specified!%22%2CInvalidCoords%3A%20%22Some%20coordinates%20are%20invalid!%22%2CNoStorageSupport%3A%20%22Your%20browser%20doesn't%20support%20Storage%2C%20please%20update%20or%20change%20your%20browser!%22%2CProtection%3A%20%22Bot%20Protection!%22%2CError%3A%20%22Error%3A%20%22%2CFailedLoad%3A%20%22Failed%20to%20load%20data%20from%20server!%22%7D%2CUnitInputID%3A%20%22unit_input_%22%2CGameConfigURL%3A%20%22%2Finterface.php%3Ffunc%3Dget_config%22%2CUnitInfoURL%3A%20%22%2Finterface.php%3Ffunc%3Dget_unit_info%22%2CBuildingInfoURL%3A%20%22%2Finterface.php%3Ffunc%3Dget_building_info%22%2CStorageName%3A%20%22SmartAttackScriptStorage%22%2CHashPrefix%3A%20%22sd_%22%2CSeed%3A%20%22JustSomeSeed%22%2CTroopNames%3A%20%7BSpear%3A%22spear%22%2CSword%3A%22sword%22%2CAxe%3A%22axe%22%2CScout%3A%22spy%22%2CLight%3A%22light%22%2CHeavy%3A%22heavy%22%2CRam%3A%22ram%22%2CCatapult%3A%22catapult%22%2CPaladin%3A%22knight%22%2CNoble%3A%22snob%22%7D%2CScriptSettings%3A%20null%2CScriptHash%3A%20null%2CStoredData%3A%20null%2CGameData%3A%20null%2CServerTime%3A%20null%2CUnitData%3A%20null%2CSlowestUnit%3A%20%7BName%3A%20null%2CSpeed%3A%20null%7D%2CTroops%3A%20%7BSpear%3A0%2CSword%3A0%2CAxe%3A0%2CScout%3A0%2CLight%3A0%2CHeavy%3A0%2CRam%3A0%2CCatapult%3A0%2CPaladin%3A0%2CNoble%3A0%7D%2CFillRallyPoint%3A%20function()%7Bthis.GameData%20%3D%20this.Data.GetGameData()%3Bthis.ScriptSettings%20%3D%20this.Data.GetSettings()%3Bif%20(this.IsTribalWars()%20!%3D%20true)%7Balert(this.TextData.NotTWPage)%3Breturn%20false%3B%7Dif%20(this.IsRallyPoint()%20!%3D%20true)%7BUI.InfoMessage(this.TextData.NotRallyPoint%2C3000%2Ctrue)%3Breturn%20false%3B%7Dif%20(this.IsSettings()%20!%3D%20true)%7BUI.InfoMessage(this.TextData.NoSettings%2C3000%2Ctrue)%3Breturn%20false%3B%7Dif%20(this.ScriptSettings.Protection%20%3D%3D%201)%7Bif%20(this.IsBotProtection())%7BUI.InfoMessage(this.TextData.Protection%2C3000%2Ctrue)%3Breturn%20false%3B%7D%7Dif%20(this.ScriptSettings.Focus%20%3D%3D%202)%7B%24(%22%23troop_confirm_go%22).focus()%3B%7Dif%20(this.ScriptSettings.Click%20%3D%3D%202)%7B%24(%22%23troop_confirm_go%22).click()%3B%7Dif%20(this.IsUnitForm()%20%3D%3D%20false)%7Breturn%20false%3B%7Dif%20(this.ScriptSettings.Keep%20!%3D%201%20%26%26%20this.ScriptSettings.Keep%20!%3D%203)%20%7Bthis.ClearCoords()%3B%7Dif%20(this.ScriptSettings.Keep%20!%3D%202%20%26%26%20this.ScriptSettings.Keep%20!%3D%203)%20%7Bthis.ClearRallyPointTroops()%3B%7Dthis.ReadRallyPointTroops()%3Bthis.VerifyTroops()%3Bthis.VerifyInclude()%3Bthis.VerifyLimit()%3Bvar%20AllCoordsValid%20%3D%20this.VerifyCoords()%3Bif%20(AllCoordsValid%20!%3D%20true)%7BUI.InfoMessage(this.TextData.InvalidCoords%2C3000%2Ctrue)%3B%7Dif%20(this.ScriptSettings.Mode%20%3E%200)%20%7Bif%20(this.GetAllStoredData()%20%3D%3D%20true)%7Bthis.VerifyStoredData()%3B%7D%20else%20%7BUI.InfoMessage(this.TextData.NoStorageSupport%2C3000%2Ctrue)%3Breturn%20false%3B%7Dif%20(this.ScriptSettings.Mode%20%3D%3D%204)%20%7Bvar%20CurrentStorageName%20%3D%20this.GetStorageName()%3Bif%20(this.StoredData%5BCurrentStorageName%5D.ModeIndex%20%3E%3D%20this.Modes.length)%7Bthis.StoredData%5BCurrentStorageName%5D.ModeIndex%20%3D%200%3B%7Dthis.ScriptSettings.Mode%20%3D%20this.Modes%5Bthis.StoredData%5BCurrentStorageName%5D.ModeIndex%5D%3Bthis.StoredData%5BCurrentStorageName%5D.ModeIndex%2B%2B%3B%7Dif%20(this.ScriptSettings.Mode%20%3D%3D%203)%20%7Bif%20(this.ScriptSettings.Times.length%20%3C%3D%200)%7BUI.InfoMessage(this.TextData.NoTimes%2C3000%2Ctrue)%3Breturn%20false%3B%7Dif%20(this.ScriptSettings.Range%20%3C%3D%200)%7BUI.InfoMessage(this.TextData.NoRange%2C3000%2Ctrue)%3Breturn%20false%3B%7D%7D%7Dif%20(this.Utilities.IsLocalStorageAvailable()%20%3D%3D%20true)%7Bthis.UnitData%20%3D%20this.GetUnitData()%3B%7Dvar%20TroopsFilled%20%3D%20this.FillRallyPointTroops()%3Bvar%20CoordsFilled%20%3D%20this.FillCoords()%3Bif%20(TroopsFilled%20!%3D%20true%20%26%26%20CoordsFilled%20!%3D%20true%20%26%26%20AllCoordsValid%20%3D%3D%20true)%7BUI.InfoMessage(this.TextData.NoCoordsTroops%2C3000%2Ctrue)%3Breturn%20false%3B%7Dif%20(this.ScriptSettings.Focus%20%3D%3D%201%20%7C%7C%20this.ScriptSettings.Focus%20%3D%3D%202)%7B%24(%22%23target_attack%22).focus()%3B%7Dif%20(this.ScriptSettings.Click%20%3D%3D%201%20%7C%7C%20this.ScriptSettings.Click%20%3D%3D%202)%7B%24(%22%23target_attack%22).click()%3B%7Dthis.StoreAllData()%3Breturn%20true%3B%7D%2CIsTribalWars%3A%20function()%7Bif%20(this.GameData%20instanceof%20Object)%7Breturn%20true%3B%7Dreturn%20false%3B%7D%2CIsRallyPoint%3A%20function()%7Bif%20(this.GameData.screen.toLowerCase()%20%3D%3D%20%22place%22)%7Breturn%20true%3B%7Dreturn%20false%3B%7D%2CIsUnitForm%3A%20function()%7Bif%20(typeof(document.forms.units)%20!%3D%20%22undefined%22)%7Breturn%20true%3B%7Dreturn%20false%3B%7D%2CIsSettings%3A%20function()%7Bif%20(this.ScriptSettings%20!%3D%20null%20%26%26%20this.ScriptSettings%20instanceof%20Object)%7Breturn%20true%3B%7Dreturn%20false%3B%7D%2CIsBotProtection%3A%20function()%7Bvar%20captcha%20%3D%20%24.grep(%24('img')%2C%20function(element%2C%20index)%20%7Breturn%20(element.src.match(%2F%5C%3Fcaptcha%2Fi)%20!%3D%20null)%7D)%3Bif%20(captcha.length%20%3D%3D%200%20%26%26%20%24('%23bot_check').length%20%3D%3D%200)%7Breturn%20false%3B%7Dreturn%20true%3B%7D%2CReadRallyPointTroops%3A%20function()%7Bvar%20Element%20%3D%20null%3Bvar%20Value%20%3D%20null%3Bfor%20(var%20Unit%20in%20this.TroopNames)%20%7BElement%20%3D%20%24('%23'%2Bthis.UnitInputID%2Bthis.TroopNames%5BUnit%5D).next(%22a%22)%3Bif%20(Element.length%20%3E%200)%7BValue%20%3D%20Element.text().match(%2F%5C((%5Cd*)%5C)%2F)%3Bif%20(Value%20instanceof%20Array%20%26%26%20Value.length%20%3E%201)%7Bthis.Troops%5BUnit%5D%20%3D%20parseInt(Value%5B1%5D%2C10)%3B%7D%7D%7D%7D%2CFillCoords%3A%20function()%7Bif%20(this.ScriptSettings.Coords.length%20%3E%200)%7Bvar%20Coords%20%3D%20this.ScriptSettings.Coords%5B0%5D%3Bif%20(this.ScriptSettings.Coords.length%20%3E%201)%7Bif%20(this.ScriptSettings.Mode%20%3D%3D%201%20%7C%7C%20this.ScriptSettings.Mode%20%3D%3D%202)%20%7Bvar%20CurrentStorageName%20%3D%20this.GetStorageName()%3Bif%20(this.StoredData%5BCurrentStorageName%5D.CoordIndex%20%3E%3D%20this.ScriptSettings.Coords.length)%7Bthis.StoredData%5BCurrentStorageName%5D.CoordIndex%20%3D%200%3B%7Dthis.StoredData%5BCurrentStorageName%5D.CoordIndex%2B%2B%3Bif%20(this.ScriptSettings.Mode%20%3D%3D%202)%7Bthis.ScriptSettings.Coords.reverse()%3B%7DCoords%20%3D%20this.ScriptSettings.Coords%5Bthis.StoredData%5BCurrentStorageName%5D.CoordIndex-1%5D%3B%7D%20else%20if%20(this.ScriptSettings.Mode%20%3D%3D%203)%20%7Bif%20(this.SlowestUnit.Name%20!%3D%20null%20%26%26%20this.SlowestUnit.Speed%20!%3D%20null)%7Bthis.ServerTime%20%3D%20this.Data.GetServerTime()%3Bvar%20IntervalCoords%20%3D%20this.GetIntervalCoords()%3Bif%20(IntervalCoords.length%20%3C%3D%200)%7BIntervalCoords%20%3D%20this.ScriptSettings.Coords%3B%7DCoords%20%3D%20IntervalCoords%5Bthis.Utilities.Random(IntervalCoords.length)%5D%3B%7D%7D%20else%20%7BCoords%20%3D%20this.ScriptSettings.Coords%5Bthis.Utilities.Random(this.ScriptSettings.Coords.length)%5D%3B%7D%7Dvar%20CoordSplit%20%3D%20Coords.split('%7C')%3Bif%20(CoordSplit.length%20%3E%3D%202)%7BselectTarget(CoordSplit%5B0%5D%2CCoordSplit%5B1%5D)%3Breturn%20true%3B%7D%7Dreturn%20false%3B%7D%2CFillRallyPointTroops%3A%20function()%7Bvar%20TroopsInserted%20%3D%20false%3Bvar%20Name%3Bfor%20(var%20Key%20in%20this.ScriptSettings.Troops)%20%7Bvar%20Data%20%3D%20this.ScriptSettings.Troops%5BKey%5D%3Bif%20(Data.All%20%3D%3D%201)%7Bvar%20NeedFillTroops%20%3D%200%3Bvar%20CanFillTroops%20%3D%200%3Bfor%20(Name%20in%20this.Troops)%20%7Bif%20(Data%5BName%5D%20%3E%200)%7BNeedFillTroops%2B%2B%3Bif%20%20(this.Troops%5BName%5D-this.ScriptSettings.Limit%5BName%5D%20%3E%3D%20Data%5BName%5D)%7BCanFillTroops%2B%2B%3B%7D%7D%7Dif%20(NeedFillTroops%20%3E%200%20%26%26%20CanFillTroops%20%3E%3D%20NeedFillTroops%20)%7Bfor%20(Name%20in%20this.TroopNames)%20%7Bif%20(Data%5BName%5D%20%3E%200)%7Bthis.InsertUnits(Name%2CData%5BName%5D)%3BTroopsInserted%20%3D%20true%3B%7D%7Dbreak%3B%7D%7D%20else%20%7Bvar%20FillTroops%20%3D%20new%20Array()%3Bfor%20(Name%20in%20this.Troops)%20%7Bif%20(Data%5BName%5D%20%3E%200%20%26%26%20this.Troops%5BName%5D-this.ScriptSettings.Limit%5BName%5D%20%3E%3D%20Data%5BName%5D)%7BFillTroops.push(Name)%3B%7D%7Dif%20(FillTroops.length%20%3E%200%20)%7BUnitName%20%3D%20FillTroops%5Bthis.Utilities.Random(FillTroops.length)%5D%3Bthis.InsertUnits(UnitName%2CData%5BUnitName%5D)%3BTroopsInserted%20%3D%20true%3Bbreak%3B%7D%7D%7Dfor%20(Name%20in%20this.Troops)%20%7Bif%20(this.ScriptSettings.Include%5BName%5D%20%3E%200)%7Bif%20%20(this.Troops%5BName%5D-this.ScriptSettings.Limit%5BName%5D%20%3E%3D%20this.ScriptSettings.Include%5BName%5D)%7Bthis.InsertUnits(Name%2Cthis.ScriptSettings.Include%5BName%5D)%3BTroopsInserted%20%3D%20true%3B%7D%7D%7Dreturn%20TroopsInserted%3B%7D%2CVerifyTroops%3A%20function()%7Bfor%20(var%20Key%20in%20this.ScriptSettings.Troops)%7Bvar%20Data%20%3D%20this.ScriptSettings.Troops%5BKey%5D%3Bfor%20(var%20Name%20in%20this.Troops)%20%7Bif%20(typeof(Data%5BName%5D)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(Data%5BName%5D)%20!%3D%20%22number%22%20%7C%7C%20Data%5BName%5D%20%3C%200)%7Bthis.ScriptSettings.Troops%5BKey%5D%5BName%5D%20%3D%200%3B%7D%7Dif%20(typeof(Data.All)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(Data.All)%20!%3D%20%22number%22)%7Bthis.ScriptSettings.Troops%5BKey%5D.All%20%3D%200%3B%7D%7Dreturn%20true%3B%7D%2CVerifyInclude%3A%20function()%7Bfor%20(var%20Name%20in%20this.Troops)%20%7Bif%20(typeof(this.ScriptSettings.Include%5BName%5D)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.ScriptSettings.Include%5BName%5D)%20!%3D%20%22number%22)%7Bthis.ScriptSettings.Include%5BName%5D%20%3D%200%3B%7D%7Dreturn%20true%3B%7D%2CVerifyLimit%3A%20function()%7Bfor%20(var%20Name%20in%20this.Troops)%20%7Bif%20(typeof(this.ScriptSettings.Limit%5BName%5D)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.ScriptSettings.Limit%5BName%5D)%20!%3D%20%22number%22)%7Bthis.ScriptSettings.Limit%5BName%5D%20%3D%200%3B%7D%7Dreturn%20true%3B%7D%2CVerifyTimes%3A%20function()%7Bfor%20(var%20Name%20in%20this.Troops)%20%7Bif%20(typeof(this.ScriptSettings.Limit%5BName%5D)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.ScriptSettings.Limit%5BName%5D)%20!%3D%20%22number%22)%7Bthis.ScriptSettings.Limit%5BName%5D%20%3D%200%3B%7D%7Dreturn%20true%3B%7D%2CVerifyCoords%3A%20function()%7Bvar%20AllValid%20%3D%20true%3Bif%20(this.ScriptSettings.Coords.length%20%3E%200)%7Bif%20(this.ScriptSettings.Coords%5B0%5D.match(%2F%5Cd%2B%5C%7C%5Cd%2B%2F)%20instanceof%20Array)%7B%7D%20else%20%7Bthis.ScriptSettings.Coords.splice(0%2C1)%3B%7Dfor%20(var%20Index%20in%20this.ScriptSettings.Coords)%20%7Bif%20(this.ScriptSettings.Coords%5BIndex%5D.match(%2F%5Cd%2B%5C%7C%5Cd%2B%2F)%20instanceof%20Array)%7B%7D%20else%20%7Bthis.ScriptSettings.Coords.splice(Index%2C1)%3BAllValid%20%3D%20false%3B%7D%7D%7Dreturn%20AllValid%3B%7D%2CVerifyStoredData%3A%20function()%7Bif%20(typeof(this.StoredData.Version)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.StoredData.Version)%20!%3D%20%22number%22)%7Bthis.StoredData.Version%20%3D%20this.Version%3B%7Dif%20(this.StoredData.Version%20!%3D%20this.Version)%7Bthis.StoredData%20%3D%20%7BVersion%3A%20this.Version%7D%3B%7Dvar%20CurrentStorageName%20%3D%20this.GetStorageName()%3Bif%20(typeof(this.StoredData%5BCurrentStorageName%5D)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.StoredData%5BCurrentStorageName%5D)%20!%3D%20%22object%22)%7Bthis.StoredData%5BCurrentStorageName%5D%20%3D%20%7B%7D%3B%7Dif%20(typeof(this.StoredData%5BCurrentStorageName%5D.CoordIndex)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.StoredData%5BCurrentStorageName%5D.CoordIndex)%20!%3D%20%22number%22)%7Bthis.StoredData%5BCurrentStorageName%5D.CoordIndex%20%3D%200%3B%7Dif%20(typeof(this.StoredData%5BCurrentStorageName%5D.ModeIndex)%20%3D%3D%20%22undefined%22%20%7C%7C%20typeof(this.StoredData%5BCurrentStorageName%5D.ModeIndex)%20!%3D%20%22number%22)%7Bthis.StoredData%5BCurrentStorageName%5D.ModeIndex%20%3D%200%3B%7Dif%20(this.StoredData%5BCurrentStorageName%5D.CoordIndex%20%3C%200)%7Bthis.StoredData%5BCurrentStorageName%5D.CoordIndex%20%3D%200%3B%7Dreturn%20true%3B%7D%2CGetAllStoredData%3A%20function()%7Bif%20(this.Utilities.IsLocalStorageAvailable()%20%3D%3D%20true)%7Bthis.StoredData%20%3D%20this.Utilities.GetStoredData(this.StorageName)%3Breturn%20true%3B%7Dreturn%20false%3B%7D%2CStoreAllData%3A%20function()%7Bif%20(this.Utilities.IsLocalStorageAvailable()%20%3D%3D%20true%20%26%26%20this.StoredData%20instanceof%20Object)%7Bthis.Utilities.StoreData(this.StorageName%2Cthis.StoredData)%3Breturn%20true%3B%7Dreturn%20false%3B%7D%2CGetStorageName%3A%20function()%7Bvar%20Hash%20%3D%20this.GetHash()%3Breturn%20this.HashPrefix%2Bthis.GameData.player.id%2B%22_%22%2BHash%2B%22_%22%2Bthis.ScriptSettings.RealMode%3B%7D%2CGetHash%3A%20function()%7Bif%20(this.ScriptHash%20%3D%3D%20null)%7Bthis.ScriptHash%20%3D%20this.Utilities.MurmurHash3(JSON.stringify(this.ScriptSettings.Coords)%2Cthis.Seed)%3B%7Dreturn%20this.ScriptHash%3B%7D%2CSetAccessKey%3A%20function()%7B%24(document).bind('keyup'%2C%20function(Event)%20%7Bif%20(Event.which%20%3D%3D%20%22Q%22.charCodeAt(0))%7B%24(%22%23target_attack%22).click()%3B%7D%7D)%3B%7D%2CInsertUnits%3A%20function(UnitName%2CCount)%7B%24('%23'%2Bthis.UnitInputID%2Bthis.TroopNames%5BUnitName%5D).val(Count)%3Bthis.UpdateSlowestUnit(UnitName)%3Breturn%20true%3B%7D%2CUpdateSlowestUnit%3A%20function(UnitName)%7Bif%20(this.UnitData%20!%3D%20null%20%26%26%20this.UnitData%20instanceof%20Object)%7Bvar%20UnitSpeed%20%3D%20this.UnitData%5Bthis.TroopNames%5BUnitName%5D%5D.speed%3Bif%20(typeof(UnitSpeed)%20%3D%3D%20%22number%22%20%26%26%20(this.SlowestUnit.Speed%20%3D%3D%20null%20%7C%7C%20UnitSpeed%20%3E%20this.SlowestUnit.Speed))%7Bthis.SlowestUnit.Speed%20%3D%20UnitSpeed%3Bthis.SlowestUnit.Name%20%3D%20UnitName%3B%7Dreturn%20true%3B%7Dreturn%20false%3B%7D%2CGetIntervalCoords%3A%20function()%7Bvar%20Coordinates%20%3D%20%5B%5D%3Bfor%20(var%20Index%20%3D%200%3B%20Index%20%3C%20this.ScriptSettings.Coords.length%3B%20Index%2B%2B)%20%7Bvar%20CoordSplit%20%3D%20this.ScriptSettings.Coords%5BIndex%5D.split('%7C')%3Bvar%20CoordSplit2%20%3D%20this.GameData.village.coord.split('%7C')%3Bif%20(CoordSplit.length%20%3E%3D%202%20%26%26%20CoordSplit2.length%20%3E%3D%202)%7Bvar%20Distance%20%3D%20this.GetDistance(CoordSplit%5B0%5D%2CCoordSplit%5B1%5D%2CCoordSplit2%5B0%5D%2CCoordSplit2%5B1%5D)%3Bvar%20TravelTime%20%3D%20this.GetTravelTime(this.SlowestUnit.Speed%2C%20Distance)%3Bvar%20ArrivalTime%20%3D%20%20new%20Date(this.ServerTime.getTime())%3BArrivalTime.setTime(%20ArrivalTime.getTime()%20%2B%20TravelTime*1000)%3Bfor%20(var%20T%20in%20this.ScriptSettings.Times)%20%7Bvar%20Time%20%3D%20this.ScriptSettings.Times%5BT%5D%3Bvar%20TimeBefore%20%3D%20Time%20-%20this.ScriptSettings.Range%3Bvar%20TimeAfter%20%3D%20Time%20%2B%20this.ScriptSettings.Range%3Bvar%20BeforeHours%20%3D%20Math.floor(TimeBefore)%3Bvar%20BeforeMinutes%20%3D%2060*(TimeBefore%20%25%201)%3Bvar%20AfterHours%20%3D%20Math.floor(TimeAfter)%3Bvar%20AfterMinutes%20%3D%2060*(TimeAfter%20%25%201)%3Bif%20((ArrivalTime.getHours()%20%3E%20BeforeHours%20%7C%7C%20(ArrivalTime.getHours()%20%3D%3D%20BeforeHours%20%26%26%20ArrivalTime.getMinutes()%20%3E%3D%20BeforeMinutes%20))%20%26%26(ArrivalTime.getHours()%20%3C%20AfterHours%20%7C%7C%20(ArrivalTime.getHours()%20%3D%3D%20AfterHours%20%26%26%20ArrivalTime.getMinutes()%20%3C%3D%20AfterMinutes)))%20%7BCoordinates.push(this.ScriptSettings.Coords%5BIndex%5D)%3B%7D%7D%7D%7Dreturn%20Coordinates%3B%7D%2CClearRallyPointTroops%3A%20function()%7Bvar%20UnitFields%20%3D%20%24('.unitsInput')%3Bif%20(UnitFields.length%20%3E%200)%7BUnitFields.each(function(Index%2CValue)%7B%24(Value).val('')%3B%7D)%3Breturn%20true%3B%7Dreturn%20false%3B%7D%2CClearCoords%3A%20function()%7BselectTarget(''%2C'')%3B%7D%2CFailedLoadData%3A%20function(jqXHR%2C%20textStatus%2C%20errorThrown)%20%7BUI.InfoMessage(SmartAttackScript.TextData.Error%20%2B%20SmartAttackScript.TextData.FailedLoad%2C5000%2Ctrue)%3Breturn%20false%3B%7D%2CGetUnitData%3A%20function()%7Bvar%20Data%20%3D%20this.Utilities.GetStoredData(%22UnitData%22)%3Bif%20(Data%20!%3D%20null%20%26%26%20%24.isEmptyObject(Data)%20%3D%3D%20true)%7BData%20%3D%20null%3Bvar%20XML%20%3D%20this.Utilities.GetXMLData(this.UnitInfoURL%2C%20this.FailedLoadData%20)%3Bif%20(XML%20!%3D%20null%20%26%26%20XML%20instanceof%20Object)%7BData%20%3D%20this.Utilities.XMLToObject(XML.documentElement)%3B%7Dthis.Utilities.StoreData(%22UnitData%22%2CData)%3B%7Dreturn%20Data%3B%7D%2CGetDistance%3A%20function(X1%2CY1%2CX2%2CY2)%7Breturn%20Math.sqrt((X1%20-%20X2)%20*%20(X1%20-%20X2)%20%2B%20(Y1%20-%20Y2)%20*%20(Y1%20-%20Y2))%3B%7D%2CGetTravelTime%3A%20function(UnitSpeed%2CDistance)%7Breturn%20UnitSpeed*60*Distance%3B%7D%2CData%3A%20%7BGetGameData%3A%20function()%7Bvar%20GameData%20%3D%20null%3Bif%20(typeof(%24)%20!%3D%20%22undefined%22%20%26%26%20typeof(game_data)%20!%3D%20%22undefined%22)%7Bif%20(game_data%20instanceof%20Object%20%26%26%20typeof(game_data.screen)%20%3D%3D%20%22string%22%20%26%26%20game_data.screen.length%20%3E%200)%7BGameData%20%3D%20game_data%3B%7D%7Dreturn%20GameData%3B%7D%2CGetSettings%3A%20function()%7Bvar%20ScriptSettings%20%3D%20null%3Bif%20(typeof(Settings)%20%3D%3D%20%22object%22)%7BScriptSettings%20%3D%20Settings%3BScriptSettings.Mode%20%3D%20this.GetMode()%3BScriptSettings.RealMode%20%3D%20ScriptSettings.Mode%3BScriptSettings.Times%20%3D%20this.GetTimes()%3BScriptSettings.Range%20%3D%20this.GetRange()%3BScriptSettings.Troops%20%3D%20this.GetTroops()%3BScriptSettings.Include%20%3D%20this.GetInclude()%3BScriptSettings.Limit%20%3D%20this.GetLimit()%3BScriptSettings.Keep%20%3D%20this.GetKeep()%3BScriptSettings.Coords%20%3D%20this.GetCoords()%3BScriptSettings.Protection%20%3D%20this.GetProtection()%3BScriptSettings.Focus%20%3D%20this.GetFocus()%3BScriptSettings.Click%20%3D%20this.GetClick()%3B%7Dreturn%20ScriptSettings%3B%7D%2CGetMode%3A%20function()%7Bvar%20Mode%20%3D%200%3Bif%20(typeof(Settings.Mode)%20%3D%3D%20%22number%22)%7BMode%20%3D%20Settings.Mode%3B%7Dreturn%20Mode%3B%7D%2CGetTimes%3A%20function()%7Bvar%20Times%20%3D%20%5B%5D%3Bif%20(typeof(Settings.Times)%20!%3D%20%22undefined%22%20%26%26%20Settings.Times%20instanceof%20Array)%7BTimes%20%3D%20Settings.Times%3B%7Dreturn%20Times%3B%7D%2CGetRange%3A%20function()%7Bvar%20Range%20%3D%200%3Bif%20(typeof(Settings.Range)%20%3D%3D%20%22number%22)%7BRange%20%3D%20Settings.Range%3B%7Dreturn%20Range%3B%7D%2CGetTroops%3A%20function()%7Bvar%20Troops%20%3D%20%5B%7B%7D%5D%3Bif%20(typeof(Settings.Troops)%20!%3D%20%22undefined%22%20%26%26%20Settings.Troops%20instanceof%20Array)%7BTroops%20%3D%20Settings.Troops%3B%7Dreturn%20Troops%3B%7D%2CGetInclude%3A%20function()%7Bvar%20Include%20%3D%20%7BSpear%3A0%2CSword%3A0%2CAxe%3A0%2CScout%3A0%2CLight%3A0%2CHeavy%3A0%2CRam%3A0%2CCatapult%3A0%2CPaladin%3A0%2CNoble%3A0%7D%3Bif%20(typeof(Settings.Include)%20!%3D%20%22undefined%22%20%26%26%20Settings.Include%20instanceof%20Object)%7BInclude%20%3D%20Settings.Include%3B%7Dreturn%20Include%3B%7D%2CGetLimit%3A%20function()%7Bvar%20Limit%20%3D%20%7BSpear%3A0%2CSword%3A0%2CAxe%3A0%2CScout%3A0%2CLight%3A0%2CHeavy%3A0%2CRam%3A0%2CCatapult%3A0%2CPaladin%3A0%2CNoble%3A0%7D%3Bif%20(typeof(Settings.Limit)%20!%3D%20%22undefined%22%20%26%26%20Settings.Limit%20instanceof%20Object)%7BLimit%20%3D%20Settings.Limit%3B%7Dreturn%20Limit%3B%7D%2CGetKeep%3A%20function()%7Bvar%20Keep%20%3D%200%3Bif%20(typeof(Settings.Keep)%20%3D%3D%20%22number%22)%7BKeep%20%3D%20Settings.Keep%3B%7Dreturn%20Keep%3B%7D%2CGetCoords%3A%20function()%7Bvar%20Coords%20%3D%20new%20Array()%3Bif%20(typeof(Settings.Coords)%20%3D%3D%20%22string%22)%7BCoords%3DSettings.Coords.split('%20')%3B%7Dreturn%20Coords%3B%7D%2CGetServerTime%3A%20function()%7Bvar%20TextDate%20%3D%20%24(%22%23serverDate%22).text()%3Bvar%20TextTime%20%3D%20%24(%22%23serverTime%22).text()%3Bvar%20DateValues%20%3D%20TextDate.match(%2F(%5Cd%2B)%5C%2F(%5Cd%2B)%5C%2F(%5Cd%2B)%2F)%3Bvar%20TimeValues%20%3D%20TextTime.match(%2F(%5Cd%2B)%3A(%5Cd%2B)%3A(%5Cd%2B)%2F)%3Breturn%20new%20Date(DateValues%5B3%5D%2CDateValues%5B2%5D-1%2CDateValues%5B1%5D%2CTimeValues%5B1%5D%2CTimeValues%5B2%5D%2CTimeValues%5B3%5D)%3B%7D%2CGetProtection%3A%20function()%7Bvar%20Protection%20%3D%201%3Bif%20(typeof(Settings.Protection)%20%3D%3D%20%22number%22)%7BProtection%20%3D%20Settings.Protection%3B%7Dreturn%20Protection%3B%7D%2CGetFocus%3A%20function()%7Bvar%20Focus%20%3D%200%3Bif%20(typeof(Settings.Focus)%20%3D%3D%20%22number%22)%7BFocus%20%3D%20Settings.Focus%3B%7Dreturn%20Focus%3B%7D%2CGetClick%3A%20function()%7Bvar%20Click%20%3D%200%3Bif%20(typeof(Settings.Click)%20%3D%3D%20%22number%22)%7BClick%20%3D%20Settings.Click%3B%7Dreturn%20Click%3B%7D%7D%2CUtilities%3A%20%7BRandom%3A%20function(Max)%7Breturn%20Math.floor(Math.random()*Max)%3B%7D%2CIsLocalStorageAvailable%3A%20function()%7Bif%20(typeof(localStorage)%20!%3D%20%22undefined%22%20%26%26%20%22localStorage%22%20in%20window%20%26%26%20localStorage%20instanceof%20Object)%7Breturn%20true%3B%7Dreturn%20false%3B%7D%2CGetStoredData%3A%20function(StorageName)%7Bvar%20StoredData%20%3D%20localStorage.getItem(StorageName)%3Bif%20(typeof(StoredData)%20%3D%3D%20%22string%22)%7BStoredData%20%3D%20JSON.parse(StoredData)%3B%7D%20else%20%7BStoredData%20%3D%20%7B%7D%3B%7Dreturn%20StoredData%3B%7D%2CStoreData%3A%20function(StorageName%2CData)%7Breturn%20localStorage.setItem(StorageName%2C%20JSON.stringify(Data))%3B%7D%2CReLoadPage%3A%20function()%7B%24(document).bind('load'%2C%20this.ReLoadPage)%3BsetTimeout(this.ReLoadPage%2C5000)%3Bwindow.location.reload(true)%3B%7D%2CGetXMLData%3A%20function(URL%2CErrorFunction)%7Bvar%20ResultData%20%3D%20null%3Bfunction%20SetResult(XML)%7BResultData%20%3D%20XML%3B%7D%24.ajax(%7Basync%3A%20false%2Ctype%3A%20%22GET%22%2Curl%3A%20URL%2CdataType%3A%20%22xml%22%2Csuccess%3A%20SetResult%2Cerror%3A%20ErrorFunction%7D)%3Breturn%20ResultData%3B%7D%2CXMLToObject%3A%20function(XML)%7Bvar%20Data%20%3D%20%7B%7D%3Bvar%20Text%20%3D%20%22%22%3Bvar%20Childs%20%3D%20XML.childNodes%3Bfor%20(var%20i%20%3D%200%3B%20i%20%3C%20Childs.length%3B%20i%2B%2B)%20%7Bif%20(Childs%5Bi%5D.nodeType%20%3D%3D%20document.ELEMENT_NODE)%7BData%5BChilds%5Bi%5D.nodeName%5D%20%3D%20%7B%7D%3Bif%20(Childs%5Bi%5D.hasChildNodes()%20%3D%3D%20true)%7BData%5BChilds%5Bi%5D.nodeName%5D%20%3D%20this.XMLToObject(Childs%5Bi%5D)%3B%7D%7D%20else%20if%20(Childs%5Bi%5D.nodeType%20%3D%3D%20document.TEXT_NODE)%20%7BText%20%3D%20%24.trim(Childs%5Bi%5D.nodeValue)%3Bif%20(Text.length%20%3E%200)%7Bif%20(isNaN(Text)%20%3D%3D%20false%20)%7BText%20%3D%20%2BText%3B%7DData%20%3D%20Text%3B%7D%7D%7Dreturn%20Data%3B%7D%2CMurmurHash3%3A%20function%20(key%2C%20seed)%20%7Bvar%20remainder%2C%20bytes%2C%20h1%2C%20h1b%2C%20c1%2C%20c1b%2C%20c2%2C%20c2b%2C%20k1%2C%20i%3Bremainder%20%3D%20key.length%20%26%203%3Bbytes%20%3D%20key.length%20-%20remainder%3Bh1%20%3D%20seed%3Bc1%20%3D%200xcc9e2d51%3Bc2%20%3D%200x1b873593%3Bi%20%3D%200%3Bwhile%20(i%20%3C%20bytes)%20%7Bk1%20%3D((key.charCodeAt(i)%20%26%200xff))%20%7C((key.charCodeAt(%2B%2Bi)%20%26%200xff)%20%3C%3C%208)%20%7C((key.charCodeAt(%2B%2Bi)%20%26%200xff)%20%3C%3C%2016)%20%7C((key.charCodeAt(%2B%2Bi)%20%26%200xff)%20%3C%3C%2024)%3B%2B%2Bi%3Bk1%20%3D%20((((k1%20%26%200xffff)%20*%20c1)%20%2B%20((((k1%20%3E%3E%3E%2016)%20*%20c1)%20%26%200xffff)%20%3C%3C%2016)))%20%26%200xffffffff%3Bk1%20%3D%20(k1%20%3C%3C%2015)%20%7C%20(k1%20%3E%3E%3E%2017)%3Bk1%20%3D%20((((k1%20%26%200xffff)%20*%20c2)%20%2B%20((((k1%20%3E%3E%3E%2016)%20*%20c2)%20%26%200xffff)%20%3C%3C%2016)))%20%26%200xffffffff%3Bh1%20%5E%3D%20k1%3Bh1%20%3D%20(h1%20%3C%3C%2013)%20%7C%20(h1%20%3E%3E%3E%2019)%3Bh1b%20%3D%20((((h1%20%26%200xffff)%20*%205)%20%2B%20((((h1%20%3E%3E%3E%2016)%20*%205)%20%26%200xffff)%20%3C%3C%2016)))%20%26%200xffffffff%3Bh1%20%3D%20(((h1b%20%26%200xffff)%20%2B%200x6b64)%20%2B%20((((h1b%20%3E%3E%3E%2016)%20%2B%200xe654)%20%26%200xffff)%20%3C%3C%2016))%3B%7Dk1%20%3D%200%3Bswitch%20(remainder)%20%7Bcase%203%3Ak1%20%5E%3D%20(key.charCodeAt(i%20%2B%202)%20%26%200xff)%20%3C%3C%2016%3Bcase%202%3Ak1%20%5E%3D%20(key.charCodeAt(i%20%2B%201)%20%26%200xff)%20%3C%3C%208%3Bcase%201%3Ak1%20%5E%3D%20(key.charCodeAt(i)%20%26%200xff)%3Bk1%20%3D%20(((k1%20%26%200xffff)%20*%20c1)%20%2B%20((((k1%20%3E%3E%3E%2016)%20*%20c1)%20%26%200xffff)%20%3C%3C%2016))%20%26%200xffffffff%3Bk1%20%3D%20(k1%20%3C%3C%2016)%20%7C%20(k1%20%3E%3E%3E%2016)%3Bk1%20%3D%20(((k1%20%26%200xffff)%20*%20c2)%20%2B%20((((k1%20%3E%3E%3E%2016)%20*%20c2)%20%26%200xffff)%20%3C%3C%2016))%20%26%200xffffffff%3Bh1%20%5E%3D%20k1%3B%7Dh1%20%5E%3D%20key.length%3Bh1%20%5E%3D%20h1%20%3E%3E%3E%2016%3Bh1%20%3D%20(((h1%20%26%200xffff)%20*%200x85ebca6b)%20%2B%20((((h1%20%3E%3E%3E%2016)%20*%200x85ebca6b)%20%26%200xffff)%20%3C%3C%2016))%20%26%200xffffffff%3Bh1%20%5E%3D%20h1%20%3E%3E%3E%2013%3Bh1%20%3D%20((((h1%20%26%200xffff)%20*%200xc2b2ae35)%20%2B%20((((h1%20%3E%3E%3E%2016)%20*%200xc2b2ae35)%20%26%200xffff)%20%3C%3C%2016)))%20%26%200xffffffff%3Bh1%20%5E%3D%20h1%20%3E%3E%3E%2016%3Breturn%20h1%20%3E%3E%3E%200%3B%7D%7D%7D%3BSmartAttackScript.FillRallyPoint()%7D)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.