'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim RealmData As Map
Dim Realms As List
Dim EUrealms As Map
Type pvpArea(status As Int, ne As Int, faction As Int, area As Int)
Type RealmInfo(wintergrasp As pvpArea, queue As Boolean, timezone As String, battlegroup As String, status As Boolean, locale As String, name As String, slug As String, tolbarad As pvparea, pvp As String, population As String)
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Get_Realm_Data
EUrealms.Initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Get_Realm_Data
Dim RealmStatus As HttpJob, Server As String
Server = "http://eu.battle.net/api/wow/realm/status"
RealmStatus.Initialize("RealmStatus",Me)
RealmStatus.Download(Server)
End Sub
Sub JobDone (Job As HttpJob)
Dim a As Int, JSON,JSON1 As JSONParser,winter, tolb As Map, Ri As RealmInfo, Win, tol As pvpArea
If Job.Success = True Then
Select Job.JobName
Case "RealmStatus"
JSON.Initialize(Job.GetString)
Log(Job.GetString)
RealmData = JSON.NextObject
Realms = RealmData.Get("realms")
a=0
winter.Initialize
tolb.Initialize
Win.Initialize
tolb.Initialize
EUrealms.Initialize
For Each Realm As Map In Realms
winter.Clear
tolb.Clear
'Log(Realm.Get("wintergrasp"))
winter = Realm.Get("wintergrasp")
tolb = Realm.Get("tol-barad")
Win.status = winter.Get("status")
Win.ne = winter.Get("next")
Win.faction = winter.Get("controlling-faction")
Win.area = winter.Get("area")
tol.status = tolb.Get("status")
tol.ne = tolb.Get("next")
tol.faction = tolb.Get("controlling-faction")
tol.area = tolb.Get("area")
Ri.wintergrasp = Win
Ri.queue = Realm.Get("queue")
Ri.timezone = Realm.Get("timezone")
Ri.battlegroup = Realm.Get("battlegroup")
Ri.status = Realm.Get("status")
Ri.locale = Realm.Get("locale")
Ri.name = Realm.Get("name")
Ri.slug = Realm.Get("slug")
Ri.tolbarad = tol
Ri.pvp = Realm.Get("type")
Ri.population = Realm.Get("population")
EUrealms.Put(a,Ri)
'Log(EUrealms.GetValueAt(a))
a=a+1
Next
End Select
For a=0 To EUrealms.Size-1
Log(a & ":" & EUrealms.GetValueAt(a))
Next
End If
Job.Release
End Sub