forked from leo7044/CnC_TA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTiberium_Alliances_Report_Stats_sumPerCp.user.js
535 lines (450 loc) · 22.4 KB
/
Tiberium_Alliances_Report_Stats_sumPerCp.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
// ==UserScript==
// @name Tiberium Alliances Report Stats
// @version 0.5.4.3
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @author petui
// @contributor leo7044 (https://github.com/leo7044)
// @contributor AlkalyneD4 (https://github.com/SebHeuze)
// @downloadURL https://raw.githubusercontent.com/SebHeuze/CnC_TA/master/Tiberium_Alliances_Report_Stats_sumPerCp.user.js
// @updateURL https://raw.githubusercontent.com/SebHeuze/CnC_TA/master/Tiberium_Alliances_Report_Stats_sumPerCp.user.js
// @description Calculates combined RT and CP costs and loot of multiple combat reports
// @include http*://cncapp*.alliances.commandandconquer.com/*/index.aspx*
// ==/UserScript==
'use strict';
(function() {
var main = function() {
'use strict';
function createReportStats() {
console.log('ReportStats loaded');
qx.Class.define('ReportStats', {
type: 'singleton',
extend: qx.core.Object,
statics: {
BaseInfoExtraWidth: 6, // width to add to BaseInfoWindow to get rid of horizontal scroll bar
StatusbarHeight: 35, // height to add to BaseInfoWindow to accomodate statusbar being visible
CheckboxColumnWidth: 28,
ResourceTypes: {}
},
defer: function(statics) {
var fileManager = ClientLib.File.FileManager.GetInstance();
statics.ResourceTypes[ClientLib.Base.EResourceType.Tiberium] = fileManager.GetPhysicalPath('ui/common/icn_res_tiberium.png');
statics.ResourceTypes[ClientLib.Base.EResourceType.Crystal] = fileManager.GetPhysicalPath('ui/common/icn_res_chrystal.png');
statics.ResourceTypes[ClientLib.Base.EResourceType.Gold] = fileManager.GetPhysicalPath('ui/common/icn_res_dollar.png');
statics.ResourceTypes[ClientLib.Base.EResourceType.Power] = fileManager.GetPhysicalPath('ui/common/icn_res_power.png');
statics.ResourceTypes[ClientLib.Base.EResourceType.ResearchPoints] = fileManager.GetPhysicalPath('ui/common/icn_res_research.png');
},
members: {
reportsLoading: [],
reportsLoaded: [],
skipBaseInfoReportsReload: 0,
initialize: function() {
this.initializeHacks();
this.initializeUserInterface();
},
initializeHacks: function() {
var source;
if (typeof qx.ui.table.model.Abstract.prototype.addColumn !== 'function') {
source = qx.ui.table.model.Abstract.prototype.getColumnId.toString();
var columnIdsMemberName = source.match(/return this\.([A-Za-z_]+)\[[A-Z]\];/)[1];
source = qx.ui.table.model.Abstract.prototype.getColumnName.toString();
var columnNamesMemberName = source.match(/return this\.([A-Za-z_]+)\[[A-Z]\];/)[1];
/**
* @param {String} id
* @param {String} name
* @returns {Number}
*/
qx.ui.table.model.Abstract.prototype.addColumn = function(id, name) {
var columnIndex = this[columnIdsMemberName].push(id) - 1;
this[columnNamesMemberName].push(name);
this.fireEvent('metaDataChanged');
return columnIndex;
};
}
if (typeof qx.ui.table.columnmodel.Basic.prototype.addColumn !== 'function') {
source = qx.ui.table.columnmodel.Basic.prototype.getColumnWidth.toString();
var columnsMemberName = source.match(/return this\.([A-Za-z_]+)\[[A-Z]\]\.width;/)[1];
source = qx.ui.table.columnmodel.Basic.prototype.getOverallColumnCount.toString();
var columnOrderMemberName = source.match(/return this\.([A-Za-z_]+)\.length;/)[1];
source = qx.ui.table.columnmodel.Basic.prototype.getVisibleColumnAtX.toString();
var columnVisibilityMemberName = source.match(/return this\.([A-Za-z_]+)\[[A-Z]\];/)[1];
source = qx.ui.table.columnmodel.Basic.prototype._getColToXPosMap.toString();
var columnToXPosMapMemberName = source.match(/return this\.([A-Za-z_]+);\}$/)[1];
source = qx.ui.table.columnmodel.Basic.prototype.init.toString();
var matches = source.match(/this\.([A-Za-z_]+)\|\|\(this\.\1=new qx\.ui\.table\.columnmodel\.Basic\.DEFAULT_HEADER_RENDERER\(\)\);.+this\.([A-Za-z_]+)\|\|\(this\.\2=new qx\.ui\.table\.columnmodel\.Basic\.DEFAULT_DATA_RENDERER\(\)\);.+this\.([A-Za-z_]+)\|\|\(this\.\3=new qx\.ui\.table\.columnmodel\.Basic\.DEFAULT_EDITOR_FACTORY\(\)\);/);
var headerRendererMemberName = matches[1];
var dataRendererMemberName = matches[2];
var editorFactoryMemberName = matches[3];
/**
* @param {Boolean} visible
* @returns {Number}
*/
qx.ui.table.columnmodel.Basic.prototype.addColumn = function(visible) {
var columnIndex = this[columnsMemberName].push({
width: qx.ui.table.columnmodel.Basic.DEFAULT_WIDTH,
headerRenderer: this[headerRendererMemberName],
dataRenderer: this[dataRendererMemberName],
editorFactory: this[editorFactoryMemberName]
}) - 1;
this[columnToXPosMapMemberName] = null;
this[columnOrderMemberName].push(columnIndex);
if (!visible) {
this[columnVisibilityMemberName].push(columnIndex);
}
this.setColumnVisible(columnIndex, visible);
return columnIndex;
};
}
if (typeof webfrontend.gui.info.BaseInfoWindow.prototype.onCellClick !== 'function') {
source = Function.prototype.toString.call(webfrontend.gui.info.BaseInfoWindow.constructor);
var createOutgoingTabMethodName = source.match(/;[A-Za-z]+\.add\(this\.([A-Za-z_]+)\(\)\);this\.[A-Za-z_]+=new webfrontend\.gui\.widgets\.confirmationWidgets\.ProtectionConfirmationWidget\(\);/)[1];
source = webfrontend.gui.info.BaseInfoWindow.prototype[createOutgoingTabMethodName].toString();
var onCellClickMethodName = source.match(/([A-Za-z]+)\.set\(\{statusBarVisible:false,columnVisibilityButtonVisible:false\}\);\1\.addListener\([A-Za-z]+,this\.([A-Za-z_]+),this\.[A-Za-z_]+\);/)[2];
webfrontend.gui.info.BaseInfoWindow.prototype.onCellClick = webfrontend.gui.info.BaseInfoWindow.prototype[onCellClickMethodName];
}
if (typeof webfrontend.gui.info.BaseInfoWindow.prototype.onTotalUnreadCountUpdated !== 'function') {
source = webfrontend.gui.info.BaseInfoWindow.prototype._onClose.toString();
var onTotalUnreadCountUpdatedMethodName = source.match(/ClientLib\.Data\.Reports\.TotalUnreadCountUpdated,this,this\.([A-Za-z_]+)\);/)[1];
webfrontend.gui.info.BaseInfoWindow.prototype.onTotalUnreadCountUpdated = webfrontend.gui.info.BaseInfoWindow.prototype[onTotalUnreadCountUpdatedMethodName];
var context = this;
webfrontend.gui.info.BaseInfoWindow.prototype[onTotalUnreadCountUpdatedMethodName] = function() {
return context.onTotalUnreadCountUpdated(this, arguments);
};
}
/* Detect and fix bug described in http://forum.alliances.commandandconquer.com/showthread.php?tid=30346 */ {
source = ClientLib.Data.Reports.Reports.prototype.AddReport.toString();
var initMethodName = source.match(/break;\}[a-z]\.([A-Z]{6})\([a-z]\);if/)[1];
source = ClientLib.Data.Reports.CombatReport.prototype[initMethodName].toString();
var setDataMethodName = source.match(/this\.([A-Z]{6})\([A-Za-z]+\);/)[1];
source = ClientLib.Data.Reports.CombatReport.prototype[setDataMethodName].toString();
var matches = source.match(/this\.([A-Z]{6})=([a-z])\.abl;/);
if (matches !== null) {
var attackerBaseIdMemberName = matches[1];
var original = ClientLib.Data.Reports.CombatReport.prototype[setDataMethodName];
ClientLib.Data.Reports.CombatReport.prototype[setDataMethodName] = function(data) {
original.call(this, data);
this[attackerBaseIdMemberName] = data.d.abi;
};
}
else {
console.warn('ReportStats::initializeHacks', 'Unable to patch ClientLib.Data.Reports.CombatReport.prototype.' + setDataMethodName + '. Its likely already fixed in the game code.');
}
}
if (typeof qx.ui.table.Table.prototype.getLastFocusedRow !== 'function') {
qx.ui.table.Table.prototype.lastFocusedRow = null;
var originalSetFocusedCell = qx.ui.table.Table.prototype.setFocusedCell;
qx.ui.table.Table.prototype.setFocusedCell = function() {
this.lastFocusedRow = this.getFocusedRow();
originalSetFocusedCell.apply(this, arguments);
};
/**
* @returns {Number}
*/
qx.ui.table.Table.prototype.getLastFocusedRow = function() {
return this.lastFocusedRow;
};
}
},
initializeUserInterface: function() {
var baseInfoWindow = webfrontend.gui.info.BaseInfoWindow.getInstance();
var tabs = baseInfoWindow.getChildren()[0].getChildren();
for (var tabIndex = 1; tabIndex <= 2; tabIndex++) {
var table = tabs[tabIndex].getChildren()[0];
var tableModel = table.getTableModel();
var tableModelIndex = tableModel.addColumn('ReportStatsCheckbox', '');
tableModel.setColumnSortable(tableModelIndex, false);
tableModel.addListener('dataChanged', this.onTableModelDataChange, this);
tableModel.setUserData('checkboxColumnIndex', tableModelIndex);
var columnModel = table.getTableColumnModel();
var columnModelIndex = columnModel.addColumn(true);
columnModel.setDataCellRenderer(columnModelIndex, new qx.ui.table.cellrenderer.Boolean());
columnModel.setColumnWidth(columnModelIndex, ReportStats.CheckboxColumnWidth);
columnModel.moveColumn(columnModelIndex, 0);
var cellClickEventName = PerforceChangelist >= 434241 ? 'cellTap' : 'cellClick';
table.removeListener(cellClickEventName, baseInfoWindow.onCellClick, tableModel);
table.addListener(cellClickEventName, this.onCellClickDelegate, this);
table.getChildControl('statusbar').set({
height: ReportStats.StatusbarHeight,
rich: true,
toolTip: new qx.ui.tooltip.ToolTip().set({
label: '<div>"Loot" is the sum of resources gained from destruction, plunder and own repair costs.</div><br/>'
+ '<div>Tip: You can select multiple reports at once by holding down the Shift key.</div>',
rich: true
})
});
}
baseInfoWindow.setWidth(baseInfoWindow.getWidth() + ReportStats.CheckboxColumnWidth + ReportStats.BaseInfoExtraWidth);
baseInfoWindow.setHeight(baseInfoWindow.getHeight() + ReportStats.StatusbarHeight);
},
/**
* Sets checkbox value to false for rows being initialized
* @param {qx.event.type.Data} event
*/
onTableModelDataChange: function(event) {
var data = event.getData();
if (data.firstColumn !== 0) {
return;
}
var tableModel = event.getTarget();
var columnIndex = tableModel.getUserData('checkboxColumnIndex');
var columnId = tableModel.getColumnId(columnIndex);
for (var row = data.firstRow; row <= data.lastRow; row++) {
var rowData = tableModel.getRowData(row);
if (rowData && rowData[columnId] === undefined) {
rowData[columnId] = false;
}
}
tableModel.fireDataEvent('dataChanged', {
firstRow: data.firstRow,
lastRow: data.lastRow,
firstColumn: columnIndex,
lastColumn: columnIndex
});
if (this.isReportTab(this.getCurrentBaseInfoTab())) {
this.calculateCombinedRepairCosts(tableModel);
}
},
/**
* @param {qx.ui.table.pane.CellEvent} event
*/
onCellClickDelegate: function(event) {
var tableModel = event.getTarget().getTable().getTableModel();
if (event.getColumn() === tableModel.getUserData('checkboxColumnIndex') && tableModel.getRowData(event.getRow())) {
this.onCheckboxClick(event);
}
else {
webfrontend.gui.info.BaseInfoWindow.prototype.onCellClick.call(tableModel, event);
}
},
/**
* @param {qx.ui.table.pane.CellEvent} event
*/
onCheckboxClick: function(event) {
var table = event.getTarget().getTable();
var tableModel = table.getTableModel();
var newValue = !tableModel.getValue(event.getColumn(), event.getRow());
if (event.isShiftPressed() && table.getLastFocusedRow() !== null) {
var start = Math.min(event.getRow(), table.getLastFocusedRow());
var end = Math.max(event.getRow(), table.getLastFocusedRow());
for (var row = start; row <= end; row++) {
tableModel.setValue(event.getColumn(), row, newValue);
}
}
else {
tableModel.setValue(event.getColumn(), event.getRow(), newValue);
}
this.calculateCombinedRepairCosts(tableModel);
},
/**
* @param {webfrontend.data.ReportHeaderDataModel} tableModel
*/
calculateCombinedRepairCosts: function(tableModel) {
var wasLoading = this.reportsLoading.length > 0;
this.reportsLoading = [];
this.reportsLoaded = [];
var rowCount = tableModel.getRowCount();
for (var row = 0; row < rowCount; row++) {
var rowData = tableModel.getRowData(row);
if (rowData && rowData.ReportStatsCheckbox) {
this.reportsLoading.push(rowData.Id);
}
}
if (this.reportsLoading.length > 0) {
var reports = ClientLib.Data.MainData.GetInstance().get_Reports();
if (!wasLoading) {
phe.cnc.Util.attachNetEvent(reports, 'ReportDelivered', ClientLib.Data.Reports.ReportDelivered, this, this.onReportDelivered);
}
for (var i = this.reportsLoading.length - 1; i >= 0; i--) {
reports.RequestReportData(this.reportsLoading[i]);
}
if (this.reportsLoading.length > 0) {
var table = this.getCurrentBaseInfoTab().getChildren()[0];
table.getChildControl('statusbar').setValue('Please wait...');
}
}
else {
this.onAllReportsLoaded();
}
},
/**
* @param {webfrontend.gui.info.BaseInfoWindow} baseInfoWindow
* @param {Object} parameters
*/
onTotalUnreadCountUpdated: function(baseInfoWindow, parameters) {
if (!this.skipBaseInfoReportsReload) {
baseInfoWindow.onTotalUnreadCountUpdated.apply(baseInfoWindow, parameters);
}
else {
this.skipBaseInfoReportsReload--;
}
},
/**
* @param {ClientLib.Data.Reports.CombatReport} report
*/
onReportDelivered: function(report) {
var index = this.reportsLoading.indexOf(report.get_Id());
if (index !== -1) {
this.reportsLoading.splice(index, 1);
this.reportsLoaded.push(report);
if (!this.reportsLoading.length) {
this.onAllReportsLoaded();
}
}
if (!report.get_IsRead()) {
report.set_IsRead(true);
this.skipBaseInfoReportsReload++;
}
},
onAllReportsLoaded: function() {
phe.cnc.Util.detachNetEvent(ClientLib.Data.MainData.GetInstance().get_Reports(), 'ReportDelivered', ClientLib.Data.Reports.ReportDelivered, this, this.onReportDelivered);
var hasSelectedReports = this.reportsLoaded.length > 0;
var table = this.getCurrentBaseInfoTab().getChildren()[0];
table.setStatusBarVisible(hasSelectedReports);
if (hasSelectedReports) {
var attackerBaseIds = [];
var defenderBaseIds = [];
var repairTimeCosts = 0;
var minCommandPointCosts = 0;
var maxCommandPointCosts = 0;
var firstAttack = null;
var lastAttack = 0;
var loot = {};
var getTotalLootMethod, getRepairCostsMethod;
if (this.reportsLoaded[0].get_PlayerReportType() === ClientLib.Data.Reports.EPlayerReportType.CombatOffense) {
getTotalLootMethod = ClientLib.Data.Reports.CombatReport.prototype.GetAttackerTotalResourceReceived;
getRepairCostsMethod = ClientLib.Data.Reports.CombatReport.prototype.GetAttackerRepairCosts;
}
else {
getTotalLootMethod = ClientLib.Data.Reports.CombatReport.prototype.GetDefenderTotalResourceCosts;
getRepairCostsMethod = ClientLib.Data.Reports.CombatReport.prototype.GetDefenderRepairCosts;
}
var server = ClientLib.Data.MainData.GetInstance().get_Server();
var combatCostMinimum = server.get_CombatCostMinimum();
var combatCostMinimumPvP = server.get_UsesRebalancingI() ? server.get_PvPCombatCostMinimum() : combatCostMinimum;
var combatCostPerFieldInside = server.get_CombatCostPerField();
var combatCostPerFieldOutside = server.get_CombatCostPerFieldOutsideTerritory();
for (var i = 0; i < this.reportsLoaded.length; i++) {
var report = this.reportsLoaded[i];
if (!(report instanceof ClientLib.Data.Reports.CombatReport)) {
continue;
}
if (attackerBaseIds.indexOf(report.get_AttackerBaseId()) === -1) {
attackerBaseIds.push(report.get_AttackerBaseId());
}
if (defenderBaseIds.indexOf(report.get_DefenderBaseId()) === -1) {
defenderBaseIds.push(report.get_DefenderBaseId());
}
repairTimeCosts += report.GetAttackerMaxRepairTime();
var distance = Math.sqrt(
Math.pow(report.get_AttackerBaseXCoord() - report.get_DefenderBaseXCoord(), 2) +
Math.pow(report.get_AttackerBaseYCoord() - report.get_DefenderBaseYCoord(), 2)
);
switch (report.get_Type()) {
case ClientLib.Data.Reports.EReportType.Combat:
var isFriendlyTerritory = report.get_AttackerAllianceName() === report.get_DefenderAllianceName();
var cost = Math.floor(combatCostMinimumPvP + (isFriendlyTerritory ? combatCostPerFieldInside : combatCostPerFieldOutside) * distance);
minCommandPointCosts += cost;
maxCommandPointCosts += cost;
break;
case ClientLib.Data.Reports.EReportType.NPCRaid:
switch (parseInt(report.get_DefenderBaseName(), 10)) {
case ClientLib.Data.Reports.ENPCCampType.Base:
case ClientLib.Data.Reports.ENPCCampType.Fortress:
var cost = Math.floor(combatCostMinimum + combatCostPerFieldOutside * distance);
minCommandPointCosts += cost;
maxCommandPointCosts += cost;
break;
default:
minCommandPointCosts += Math.floor(combatCostMinimum + combatCostPerFieldInside * distance);
maxCommandPointCosts += Math.floor(combatCostMinimum + combatCostPerFieldOutside * distance);
}
break;
case ClientLib.Data.Reports.EReportType.NPCPlayerCombat:
// No repair time or command point cost for Forgotten attacks
break;
default:
throw 'Unexpected report type (' + report.get_Type() + ')';
}
if (firstAttack === null || report.get_Time() < firstAttack) {
firstAttack = report.get_Time();
}
if (report.get_Time() > lastAttack) {
lastAttack = report.get_Time();
}
for (var resourceType in ReportStats.ResourceTypes) {
var resourceCount = getTotalLootMethod.call(report, resourceType) - getRepairCostsMethod.call(report, resourceType);
if (resourceCount !== 0) {
if (!(resourceType in loot)) {
loot[resourceType] = 0;
}
loot[resourceType] += resourceCount;
}
}
}
var lootRow = 'Loot:';
var sumRes = 0;
for (var resourceType in loot) {
lootRow += ' <img width="17" height="17" src="' + ReportStats.ResourceTypes[resourceType] + '" style="vertical-align: text-bottom;"/>';
if (loot[resourceType] < 0) {
lootRow += '<span style="color: #d00;">' + phe.cnc.gui.util.Numbers.formatNumbersCompact(loot[resourceType]) + '</span>';
}
else {
lootRow += phe.cnc.gui.util.Numbers.formatNumbersCompact(loot[resourceType]);
sumRes += loot[resourceType];
}
}
lootRow += ' Sum: ' + phe.cnc.gui.util.Numbers.formatNumbersCompact(sumRes);
lootRow += ' Sum/CP (max): ' + phe.cnc.gui.util.Numbers.formatNumbersCompact(sumRes / minCommandPointCosts);
lootRow += ' Sum/CP (min): ' + phe.cnc.gui.util.Numbers.formatNumbersCompact(sumRes / maxCommandPointCosts);
table.getChildControl('statusbar').setValue(
attackerBaseIds.length + ' attacker' + (attackerBaseIds.length === 1 ? '' : 's') + ', ' +
defenderBaseIds.length + ' defender' + (defenderBaseIds.length === 1 ? '' : 's') + ', ' +
this.reportsLoaded.length + ' attack' + (this.reportsLoaded.length === 1 ? '' : 's') + ', ' +
phe.cnc.Util.getTimespanString(repairTimeCosts) + ' RT and ' + (minCommandPointCosts === maxCommandPointCosts
? minCommandPointCosts
: (minCommandPointCosts + '-' + maxCommandPointCosts)
) + ' CPs spent' + (this.reportsLoaded.length > 1
? ' in ' + phe.cnc.Util.getTimespanString((lastAttack - firstAttack) / 1000)
: ''
) + '<br/>' + lootRow
);
}
},
/**
* @returns {qx.ui.tabview.Page}
*/
getCurrentBaseInfoTab: function() {
return webfrontend.gui.info.BaseInfoWindow.getInstance().getChildren()[0].getSelection()[0];
},
/**
* @param {qx.ui.tabview.Page} tab
* @returns {Boolean}
*/
isReportTab: function(tab) {
var tabView = webfrontend.gui.info.BaseInfoWindow.getInstance().getChildren()[0];
var tabIndex = tabView.getChildren().indexOf(tab);
return 1 <= tabIndex && tabIndex <= 2;
}
}
});
}
function waitForGame() {
try {
if (typeof qx !== 'undefined' && qx.core.Init.getApplication() && qx.core.Init.getApplication().initDone) {
createReportStats();
ReportStats.getInstance().initialize();
}
else {
setTimeout(waitForGame, 1000);
}
}
catch (e) {
console.log('ReportStats: ', e.toString());
}
}
setTimeout(waitForGame, 1000);
};
var script = document.createElement('script');
script.innerHTML = '(' + main.toString() + ')();';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
})();