function ReportReader
game.php?screen=report&mode=all&view=
Constructor Summary |
---|
ReportReader(HTMLDocument gameDocument) Returns a ReportReader that reads from the specified HTMLDocument object |
Method Summary | |
---|---|
Array | getAttacker() Returns an array of information about the attacking player: (id,name) |
Array | getAttackerLosses() Returns the troops that the attacker lost, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Array | getAttackerQuantity() Returns the troops that the attacker sent, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Array | getAttackerVillage() Returns an array of information about the attacker's village: (x,y,id) |
Array | getBuildingLevels() Returns an array of the building levels |
Array | getDefender() Returns an array of information about the defending player: (id,name). id = 0 for barbarians, id = -1 for deleted player |
Array | getDefenderLosses Returns the troops that the defender lost, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Array | getDefenderQuantity Returns the defending troops, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Array | getDefenderVillage() Returns an array of information about the defender's village: (x,y,id) |
String | getDotColor() Returns the color of the dot, signifying the result of the battle |
Array | getEspionageLevel() Returns a number representing the amount of information available |
Array | getHaul() Returns the pillaged resources, in an array: (timber,clay,iron) |
Number | getLuck() Returns the attacker's luck in the battle |
Array | getLoyalty() Returns the loyalty of the defender's village, in an array: (from,to) |
Number | getMorale() Returns the attacker's morale |
Number | getReportId() Returns the report ID that's used as a key |
Array | getResources() Returns the resources scouted, in an array: (timber,clay,iron) |
Date | getSent() Returns the date and time the report was received |
Array | getSupportKilled() Returns information about "Defender's troops in other villages", in an array of Reinforcements |
Array | getUnitsInTransit() Returns information about the defender's troops in transit, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Array | getUnitsOutside() Returns the defender's troops outside the village, in an array: (spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble) |
Constructor Summary |
---|
gameDocument:HTMLDocument
- HTMLDocument object that the report will be read from. If the user doesn't have a premium account, game.php will be embedded within a frame. The following code can be used to retrieve the game document for both premium and non-premium users:
var gameDocument = (window.frames.length>0)?window.main.document:document;
initializing a report reader will then look like this:myReportReader = new ReportReader(gameDocument);
Method Summary |
---|
player:Array(id:Number,name:String)
troops:Array(spear:Number,sword:Number,archer:Number,axe:Number,scout:Number,lcav:Number,acav:Number,hcav:Number,ram:Number,cat:Number,paladin:Number,noble:Number)
troops:Array(spear:Number,sword:Number,archer:Number,axe:Number,scout:Number,lcav:Number,acav:Number,hcav:Number,ram:Number,cat:Number,paladin:Number,noble:Number)
village:Array(x:Number,y:Number,id:Number)
, where x and y are the coordinates that are usually seen as (x|y)
buildingLevels:Array(hq:Number,barracks:Number,stable:Number...)
-an array of the building levels scouted
Building | Index |
---|---|
hq | 0 |
barracks | 1 |
stable | 2 |
workshop | 3 |
church | 4 |
church_f | 5 |
academy | 6 |
smithy | 7 |
rally point | 8 |
statue | 9 |
market | 10 |
timber camp | 11 |
clay pit | 12 |
iron mine | 13 |
farm | 14 |
warehouse | 15 |
hiding place | 16 |
wall | 17 |
player:Array(id:Number,name:String)
troops:Array(spear:Number,sword:Number,archer:Number,axe:Number,scout:Number,lcav:Number,acav:Number,hcav:Number,ram:Number,cat:Number,paladin:Number,noble:Number)
troops:Array(spear:Number,sword:Number,archer:Number,axe:Number,scout:Number,lcav:Number,acav:Number,hcav:Number,ram:Number,cat:Number,paladin:Number,noble:Number)
village:Array(x:Number,y:Number,id:Number)
, where x and y are the coordinates that are usually seen as (x|y)
color:String
Color | Significance |
---|---|
blue | only attacking scouts survived |
green | all attacking units survived |
red | no attacking units survived |
yellow | some attacking units survived, but not all |
espionageLevel:Number
Value | Significance |
---|---|
0 | nothing scouted |
1 | resources |
2 | buildings |
3 | external troops |
resources:Array(timber:Number,clay:Number,iron:Number)
luck:Number
loyalty:Array(from:Number,to:Number)
-from is the loyalty before the battle, and to is the loyalty after the battle.
morale:Number
reportID:Number
resources:Array(timber:Number,clay:Number,iron:Number)
sent:Date
- formatted as a Date object for use with calculations
reinforcements:Array(reinforcement0:Reinforcements, reinforcement1:Reinforcements, reinforcement2:Reinforcements...)
troops:Array(spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble)
troops:Array(spear,sword,archer,axe,scout,lcav,acav,hcav,ram,cat,paladin,noble)
Testing |
---|
testReportReader()
can be called to open a debug window with the information that was read from the report.
Script Source |
---|