-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPTE_CheatScript.user.js
124 lines (123 loc) · 6.09 KB
/
PTE_CheatScript.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
// ==UserScript==
// @name PTE_CheatScript
// @version 2021.04.23
// @author leo7044 (https://github.com/leo7044)
// @description PTE_CheatScript
// @downloadURL https://github.com/leo7044/CnC_TA/raw/master/PTE_CheatScript.user.js
// @updateURL https://github.com/leo7044/CnC_TA/raw/master/PTE_CheatScript.user.js
// @include http*://prodgame*.alliances.commandandconquer.com/320/index.aspx*
// @include http*://cncapp*.alliances.commandandconquer.com/320/index.aspx*
// @grant none
// ==/UserScript==
(function () {
var PTECheatMain = function ()
{
function PTECheatCreate()
{
try
{
var cheat_setcommandpoints = false;
var cheat_resetmovecooldownpte = true;
var cheat_repairallpte = false;
var cheat_repairoff = false;
var cheat_maxresources = false;
function makeCheat()
{
var bases = ClientLib.Data.MainData.GetInstance().get_Cities().get_AllCities().d;
// var wishLevel = 65;
var i = 0;
// CP-Cheat
if (cheat_setcommandpoints && ClientLib.Data.MainData.GetInstance().get_Player().GetCommandPointCount() < 9999)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat setcommandpoints 9999");
}
for (var key in bases)
{
// Basis verlegen
if (cheat_resetmovecooldownpte && bases[key].get_hasCooldown() === true)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat resetmovecooldownpte");
}
// RepTime (Base)
if (cheat_repairallpte && !bases[key].get_IsGhostMode() && bases[key].GetFullConditionInPercent() < 100)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat repairallpte " + i);
}
// RepTime (Off)
if (cheat_repairoff && !bases[key].get_IsGhostMode() && bases[key].GetOffenseConditionInPercent() < 100 && bases[key].get_LvlOffense() > 0)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat repairoff " + key);
}
else if (!cheat_repairoff && !cheat_repairallpte && bases[key].get_CityRepairData().CanRepairAll(ClientLib.Vis.Mode.ArmySetup))
{
bases[key].get_CityRepairData().RepairAll(ClientLib.Vis.Mode.ArmySetup);
}
// maximale Ressourcen
if (cheat_maxresources && (bases[key].GetResourceCount(ClientLib.Base.EResourceType.Tiberium) < bases[key].GetResourceMaxStorage(ClientLib.Base.EResourceType.Tiberium) || bases[key].GetResourceCount(ClientLib.Base.EResourceType.Crystal) < bases[key].GetResourceMaxStorage(ClientLib.Base.EResourceType.Crystal) || bases[key].GetResourceCount(ClientLib.Base.EResourceType.Power) < bases[key].GetResourceMaxStorage(ClientLib.Base.EResourceType.Power)))
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat maxresources " + key);
}
// Pakete einsammeln
if (bases[key].get_CityBuildingsData().get_HasCollectableBuildings())
{
bases[key].CollectAllResources();
}
// Ressources
/*if (bases[key].get_LvlBase() < wishLevel && bases[key].GetBuildingSlotCount() == 40)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat setlevelbasepte " + i + " " + wishLevel);
}
if (bases[key].get_LvlOffense() < wishLevel && bases[key].get_TotalOffenseHeadCount() == 200)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat setleveloffensepte " + i + " " + wishLevel);
}
if (bases[key].get_LvlDefense() < wishLevel && bases[key].get_TotalDefenseHeadCount() == 300)
{
qx.core.Init.getApplication().getChat().getChatWidget().send("/cheat setleveldefensepte " + i + " " + wishLevel);
}*/
i++;
}
}
window.setInterval(makeCheat, 1000);
}
catch(e)
{
console.log(e);
window.setTimeout(PTECheatCreate, 1000);
}
}
function LoadExtension()
{
try
{
if (typeof(qx)!='undefined')
{
if (!!qx.core.Init.getApplication().getMenuBar())
{
PTECheatCreate();
return;
}
}
}
catch (e)
{
if (console !== undefined) console.log(e);
else if (window.opera) opera.postError(e);
else GM_log(e);
}
window.setTimeout(LoadExtension, 1000);
}
LoadExtension();
};
function Inject()
{
if (window.location.pathname != ("/login/auth"))
{
var Script = document.createElement("script");
Script.innerHTML = "(" + PTECheatMain.toString() + ")();";
Script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(Script);
}
}
Inject();
})();