-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack_override.js
87 lines (72 loc) · 2.46 KB
/
webpack_override.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
(function webpack_inject(){
const waitMaxCount = 15;
var waitCount = 0;
var doWork = function() {
var IDs = window.gameVars.OverrideIDs;
if(!IDs.isDetected()) {
if(++waitCount > waitMaxCount) {
console.log('webpack detect failed');
window.stop();
window.location.href = window.location.href;
return;
}
setTimeout(doWork, 100);
return;
}
window.webpackJsonp([0], {
"webpack_inject": function (wrapper, exports, getModule) {
var mainModule = getModule(IDs.mainModule);
// init
var gameInitBase = mainModule.prototype.init;
mainModule.prototype.init = function(){
gameInitBase.apply(this, arguments);
window.gameFunctions.gameInit.call(this);
};
// free
var gameFreeBase = mainModule.prototype.free;
mainModule.prototype.free = function(){
gameFreeBase.apply(this, arguments);
window.gameFunctions.gameFree.call(this);
};
// update and override
var gameUpdateBase = mainModule.prototype.update;
mainModule.prototype.update = function(){
if(!this.override)
window.gameFunctions.gameOverride.call(this);
gameUpdateBase.apply(this, arguments);
window.gameFunctions.gameUpdate.call(this);
};
// render
var gameRenderBase = mainModule.prototype.render;
mainModule.prototype.render = function(){
gameRenderBase.apply(this, arguments);
window.gameFunctions.gameRender.call(this);
};
// sendMessage
var gameSendMessageBase = mainModule.prototype.sendMessage;
mainModule.prototype.sendMessage = function(){
gameSendMessageBase.apply(this, arguments);
window.gameFunctions.gameSendMessage.apply(this, arguments);
};
// processGameUpdate
var gameSrocessGameUpdateBase = mainModule.prototype.processGameUpdate;
mainModule.prototype.processGameUpdate = function(){
gameSrocessGameUpdateBase.apply(this, arguments);
window.gameFunctions.gameSrocessGameUpdate.apply(this, arguments);
};
// PING
var emoteModule = getModule(IDs.emoteModule);
// override
var emoteManagerUpdateBase = emoteModule.EmoteManager.prototype.update;
emoteModule.EmoteManager.prototype.update = function(){
if(!this.override)
window.gameFunctions.pingOverride.call(this);
emoteManagerUpdateBase.apply(this, arguments);
};
// DATA
window.gameVars.Game.GameData = getModule(IDs.gameData);
}
}, ["webpack_inject"]);
};
doWork();
})();