EvoWorld.io Premium Unlocker

Unlock premium features, food clock, pet, and prevent XP loss on death

Size

23.8 KB

Version

1.1.1

Created

Mar 3, 2026

Updated

18 days ago

1// ==UserScript==
2// @name		EvoWorld.io Premium Unlocker
3// @description		Unlock premium features, food clock, pet, and prevent XP loss on death
4// @version		1.1.1
5// @match		https://*.evoworld.io/*
6// @icon		https://evoworld.io/favicon/favicon.ico
7// @grant		GM.getValue
8// @grant		GM.setValue
9// ==/UserScript==
10(function() {
11    'use strict';
12
13    console.log('[EvoWorld Premium Unlocker] Extension loaded');
14
15    // Store original XP value to prevent loss
16    let savedXP = null;
17    let savedHealth = null;
18    let maxHealth = null;
19
20    // Intercept WebSocket to modify game data
21    const originalWebSocket = window.WebSocket;
22    window.WebSocket = function(...args) {
23        console.log('[EvoWorld Premium Unlocker] WebSocket connection intercepted');
24        const ws = new originalWebSocket(...args);
25        
26        // Intercept incoming messages
27        const originalAddEventListener = ws.addEventListener;
28        ws.addEventListener = function(type, listener, ...rest) {
29            if (type === 'message') {
30                const wrappedListener = function(event) {
31                    try {
32                        // Try to parse and modify the message
33                        let data = event.data;
34                        
35                        // Check if it's JSON data
36                        if (typeof data === 'string' && (data.startsWith('{') || data.startsWith('['))) {
37                            try {
38                                let parsed = JSON.parse(data);
39                                let modified = false;
40
41                                // Intercept health/damage data
42                                if (parsed.health !== undefined || parsed.hp !== undefined || parsed.life !== undefined) {
43                                    const currentHealth = parsed.health || parsed.hp || parsed.life;
44                                    
45                                    // Save max health if we see a higher value
46                                    if (maxHealth === null || currentHealth > maxHealth) {
47                                        maxHealth = currentHealth;
48                                        savedHealth = currentHealth;
49                                        console.log('[EvoWorld Premium Unlocker] Max health set to:', maxHealth);
50                                    }
51                                    
52                                    // If health decreased, restore it to max
53                                    if (savedHealth !== null && currentHealth < savedHealth) {
54                                        if (parsed.health !== undefined) parsed.health = maxHealth || savedHealth;
55                                        if (parsed.hp !== undefined) parsed.hp = maxHealth || savedHealth;
56                                        if (parsed.life !== undefined) parsed.life = maxHealth || savedHealth;
57                                        modified = true;
58                                        console.log('[EvoWorld Premium Unlocker] Damage prevented! Health restored to:', maxHealth || savedHealth);
59                                    } else {
60                                        savedHealth = currentHealth;
61                                    }
62                                }
63
64                                // Intercept damage events
65                                if (parsed.damage !== undefined || parsed.dmg !== undefined || parsed.hurt !== undefined) {
66                                    // Set damage to 0
67                                    if (parsed.damage !== undefined) parsed.damage = 0;
68                                    if (parsed.dmg !== undefined) parsed.dmg = 0;
69                                    if (parsed.hurt !== undefined) parsed.hurt = false;
70                                    modified = true;
71                                    console.log('[EvoWorld Premium Unlocker] Damage blocked!');
72                                }
73
74                                // Intercept death events
75                                if (parsed.dead !== undefined || parsed.isDead !== undefined || parsed.death !== undefined) {
76                                    if (parsed.dead !== undefined) parsed.dead = false;
77                                    if (parsed.isDead !== undefined) parsed.isDead = false;
78                                    if (parsed.death !== undefined) parsed.death = false;
79                                    modified = true;
80                                    console.log('[EvoWorld Premium Unlocker] Death prevented!');
81                                }
82
83                                // Check player object for health
84                                if (parsed.player) {
85                                    if (parsed.player.health !== undefined || parsed.player.hp !== undefined) {
86                                        const playerHealth = parsed.player.health || parsed.player.hp;
87                                        
88                                        if (maxHealth === null || playerHealth > maxHealth) {
89                                            maxHealth = playerHealth;
90                                            savedHealth = playerHealth;
91                                        }
92                                        
93                                        if (savedHealth !== null && playerHealth < savedHealth) {
94                                            if (parsed.player.health !== undefined) parsed.player.health = maxHealth || savedHealth;
95                                            if (parsed.player.hp !== undefined) parsed.player.hp = maxHealth || savedHealth;
96                                            modified = true;
97                                            console.log('[EvoWorld Premium Unlocker] Player health restored!');
98                                        }
99                                    }
100                                    
101                                    if (parsed.player.dead !== undefined) {
102                                        parsed.player.dead = false;
103                                        modified = true;
104                                    }
105                                }
106
107                                // Modify premium status
108                                if (parsed.premium !== undefined) {
109                                    parsed.premium = true;
110                                    modified = true;
111                                    console.log('[EvoWorld Premium Unlocker] Premium status enabled');
112                                }
113
114                                // Modify food clock
115                                if (parsed.foodClock !== undefined || parsed.food_clock !== undefined) {
116                                    parsed.foodClock = true;
117                                    parsed.food_clock = true;
118                                    modified = true;
119                                    console.log('[EvoWorld Premium Unlocker] Food clock enabled');
120                                }
121
122                                // Modify pet status
123                                if (parsed.pet !== undefined || parsed.hasPet !== undefined) {
124                                    parsed.pet = true;
125                                    parsed.hasPet = true;
126                                    modified = true;
127                                    console.log('[EvoWorld Premium Unlocker] Pet enabled');
128                                }
129
130                                // Prevent XP loss
131                                if (parsed.exp !== undefined || parsed.experience !== undefined || parsed.xp !== undefined) {
132                                    const currentXP = parsed.exp || parsed.experience || parsed.xp;
133                                    
134                                    if (savedXP !== null && currentXP < savedXP) {
135                                        // XP decreased, restore it
136                                        if (parsed.exp !== undefined) parsed.exp = savedXP;
137                                        if (parsed.experience !== undefined) parsed.experience = savedXP;
138                                        if (parsed.xp !== undefined) parsed.xp = savedXP;
139                                        modified = true;
140                                        console.log('[EvoWorld Premium Unlocker] XP loss prevented, restored to:', savedXP);
141                                    } else {
142                                        savedXP = currentXP;
143                                    }
144                                }
145
146                                // Modify account data
147                                if (parsed.account) {
148                                    if (parsed.account.premium !== undefined) {
149                                        parsed.account.premium = true;
150                                        modified = true;
151                                    }
152                                    if (parsed.account.exp !== undefined) {
153                                        if (savedXP !== null && parsed.account.exp < savedXP) {
154                                            parsed.account.exp = savedXP;
155                                            modified = true;
156                                        } else {
157                                            savedXP = parsed.account.exp;
158                                        }
159                                    }
160                                }
161
162                                // Modify player data
163                                if (parsed.player) {
164                                    if (parsed.player.premium !== undefined) {
165                                        parsed.player.premium = true;
166                                        modified = true;
167                                    }
168                                    if (parsed.player.foodClock !== undefined) {
169                                        parsed.player.foodClock = true;
170                                        modified = true;
171                                    }
172                                    if (parsed.player.pet !== undefined) {
173                                        parsed.player.pet = true;
174                                        modified = true;
175                                    }
176                                }
177
178                                if (modified) {
179                                    // Create a new event with modified data
180                                    const modifiedEvent = new MessageEvent('message', {
181                                        data: JSON.stringify(parsed),
182                                        origin: event.origin,
183                                        lastEventId: event.lastEventId,
184                                        source: event.source,
185                                        ports: event.ports
186                                    });
187                                    return listener.call(this, modifiedEvent);
188                                }
189                            } catch (e) {
190                                // Not JSON or parsing failed, pass through
191                            }
192                        }
193                        
194                        return listener.call(this, event);
195                    } catch (error) {
196                        console.error('[EvoWorld Premium Unlocker] Error in message handler:', error);
197                        return listener.call(this, event);
198                    }
199                };
200                return originalAddEventListener.call(this, type, wrappedListener, ...rest);
201            }
202            return originalAddEventListener.call(this, type, listener, ...rest);
203        };
204
205        // Intercept outgoing messages
206        const originalSend = ws.send;
207        ws.send = function(data) {
208            try {
209                if (typeof data === 'string' && (data.startsWith('{') || data.startsWith('['))) {
210                    try {
211                        let parsed = JSON.parse(data);
212                        
213                        // Save XP before sending death/respawn messages
214                        if (parsed.action === 'respawn' || parsed.action === 'death' || parsed.type === 'respawn' || parsed.type === 'death') {
215                            console.log('[EvoWorld Premium Unlocker] Death/respawn detected, XP protected');
216                        }
217                    } catch (e) {
218                        // Not JSON, pass through
219                    }
220                }
221            } catch (error) {
222                console.error('[EvoWorld Premium Unlocker] Error in send handler:', error);
223            }
224            return originalSend.call(this, data);
225        };
226
227        return ws;
228    };
229
230    // Intercept fetch requests
231    const originalFetch = window.fetch;
232    window.fetch = async function(...args) {
233        const response = await originalFetch.apply(this, args);
234        
235        // Clone the response so we can read it
236        const clonedResponse = response.clone();
237        
238        try {
239            const contentType = response.headers.get('content-type');
240            if (contentType && contentType.includes('application/json')) {
241                const data = await clonedResponse.json();
242                
243                // Modify health data
244                if (data.health !== undefined && savedHealth !== null && data.health < savedHealth) {
245                    data.health = maxHealth || savedHealth;
246                }
247                if (data.hp !== undefined && savedHealth !== null && data.hp < savedHealth) {
248                    data.hp = maxHealth || savedHealth;
249                }
250                
251                // Modify the response data
252                if (data.premium !== undefined) {
253                    data.premium = true;
254                }
255                if (data.foodClock !== undefined) {
256                    data.foodClock = true;
257                }
258                if (data.pet !== undefined) {
259                    data.pet = true;
260                }
261                if (data.account) {
262                    data.account.premium = true;
263                    if (data.account.exp !== undefined && savedXP !== null && data.account.exp < savedXP) {
264                        data.account.exp = savedXP;
265                    }
266                }
267                
268                // Return modified response
269                return new Response(JSON.stringify(data), {
270                    status: response.status,
271                    statusText: response.statusText,
272                    headers: response.headers
273                });
274            }
275        } catch (e) {
276            // If parsing fails, return original response
277        }
278        
279        return response;
280    };
281
282    // Intercept XMLHttpRequest
283    const originalXHROpen = XMLHttpRequest.prototype.open;
284    const originalXHRSend = XMLHttpRequest.prototype.send;
285    
286    XMLHttpRequest.prototype.open = function(method, url, ...rest) {
287        this._url = url;
288        return originalXHROpen.call(this, method, url, ...rest);
289    };
290    
291    XMLHttpRequest.prototype.send = function(...args) {
292        const xhr = this;
293        
294        const originalOnReadyStateChange = xhr.onreadystatechange;
295        xhr.onreadystatechange = function() {
296            if (xhr.readyState === 4 && xhr.status === 200) {
297                try {
298                    const contentType = xhr.getResponseHeader('content-type');
299                    if (contentType && contentType.includes('application/json')) {
300                        const data = JSON.parse(xhr.responseText);
301                        
302                        // Modify health
303                        if (data.health !== undefined && savedHealth !== null && data.health < savedHealth) {
304                            data.health = maxHealth || savedHealth;
305                        }
306                        
307                        if (data.premium !== undefined) {
308                            data.premium = true;
309                        }
310                        if (data.foodClock !== undefined) {
311                            data.foodClock = true;
312                        }
313                        if (data.pet !== undefined) {
314                            data.pet = true;
315                        }
316                        if (data.account && data.account.exp !== undefined) {
317                            if (savedXP !== null && data.account.exp < savedXP) {
318                                data.account.exp = savedXP;
319                            } else {
320                                savedXP = data.account.exp;
321                            }
322                        }
323                        
324                        // Override the response
325                        Object.defineProperty(xhr, 'responseText', {
326                            writable: true,
327                            value: JSON.stringify(data)
328                        });
329                        Object.defineProperty(xhr, 'response', {
330                            writable: true,
331                            value: JSON.stringify(data)
332                        });
333                    }
334                } catch (e) {
335                    // Parsing failed, ignore
336                }
337            }
338            
339            if (originalOnReadyStateChange) {
340                return originalOnReadyStateChange.apply(this, arguments);
341            }
342        };
343        
344        return originalXHRSend.apply(this, args);
345    };
346
347    // Hook into localStorage to maintain premium status
348    const originalSetItem = Storage.prototype.setItem;
349    Storage.prototype.setItem = function(key, value) {
350        try {
351            // Intercept game data storage
352            if (typeof value === 'string' && (value.startsWith('{') || value.startsWith('['))) {
353                try {
354                    let data = JSON.parse(value);
355                    
356                    // Force premium features
357                    if (data.premium !== undefined) {
358                        data.premium = true;
359                    }
360                    if (data.foodClock !== undefined) {
361                        data.foodClock = true;
362                    }
363                    if (data.pet !== undefined) {
364                        data.pet = true;
365                    }
366                    
367                    // Prevent health loss
368                    if (data.health !== undefined || data.hp !== undefined) {
369                        const currentHealth = data.health || data.hp;
370                        if (savedHealth !== null && currentHealth < savedHealth) {
371                            if (data.health !== undefined) data.health = maxHealth || savedHealth;
372                            if (data.hp !== undefined) data.hp = maxHealth || savedHealth;
373                            console.log('[EvoWorld Premium Unlocker] Health loss prevented in localStorage');
374                        } else if (currentHealth > (savedHealth || 0)) {
375                            savedHealth = currentHealth;
376                            if (maxHealth === null || currentHealth > maxHealth) {
377                                maxHealth = currentHealth;
378                            }
379                        }
380                    }
381                    
382                    if (data.exp !== undefined || data.experience !== undefined) {
383                        const currentXP = data.exp || data.experience;
384                        if (savedXP !== null && currentXP < savedXP) {
385                            if (data.exp !== undefined) data.exp = savedXP;
386                            if (data.experience !== undefined) data.experience = savedXP;
387                            console.log('[EvoWorld Premium Unlocker] XP loss prevented in localStorage');
388                        } else {
389                            savedXP = currentXP;
390                        }
391                    }
392                    
393                    value = JSON.stringify(data);
394                } catch (e) {
395                    // Not JSON, pass through
396                }
397            }
398        } catch (error) {
399            console.error('[EvoWorld Premium Unlocker] Error in setItem:', error);
400        }
401        
402        return originalSetItem.call(this, key, value);
403    };
404
405    const originalGetItem = Storage.prototype.getItem;
406    Storage.prototype.getItem = function(key) {
407        const value = originalGetItem.call(this, key);
408        
409        try {
410            if (value && typeof value === 'string' && (value.startsWith('{') || value.startsWith('['))) {
411                try {
412                    let data = JSON.parse(value);
413                    
414                    // Force premium features when reading
415                    if (data.premium !== undefined) {
416                        data.premium = true;
417                    }
418                    if (data.foodClock !== undefined) {
419                        data.foodClock = true;
420                    }
421                    if (data.pet !== undefined) {
422                        data.pet = true;
423                    }
424                    if (data.health !== undefined && savedHealth !== null && data.health < savedHealth) {
425                        data.health = maxHealth || savedHealth;
426                    }
427                    if (data.hp !== undefined && savedHealth !== null && data.hp < savedHealth) {
428                        data.hp = maxHealth || savedHealth;
429                    }
430                    if (data.exp !== undefined && savedXP !== null && data.exp < savedXP) {
431                        data.exp = savedXP;
432                    }
433                    
434                    return JSON.stringify(data);
435                } catch (e) {
436                    // Not JSON, return original
437                }
438            }
439        } catch (error) {
440            console.error('[EvoWorld Premium Unlocker] Error in getItem:', error);
441        }
442        
443        return value;
444    };
445
446    // Monitor for death screen and prevent XP loss
447    const observer = new MutationObserver(function(mutations) {
448        mutations.forEach(function(mutation) {
449            mutation.addedNodes.forEach(function(node) {
450                if (node.nodeType === 1) {
451                    // Check for death screen or play again button
452                    const playAgainButton = node.querySelector && (
453                        node.querySelector('[data-translate*="play"]') ||
454                        node.querySelector('button[class*="play"]') ||
455                        node.querySelector('[class*="death"]') ||
456                        node.querySelector('[class*="respawn"]')
457                    );
458                    
459                    if (playAgainButton || (node.textContent && (node.textContent.includes('Play Again') || node.textContent.includes('Respawn')))) {
460                        console.log('[EvoWorld Premium Unlocker] Death screen detected, XP is protected');
461                    }
462                }
463            });
464        });
465    });
466
467    // Start observing the document
468    if (document.body) {
469        observer.observe(document.body, {
470            childList: true,
471            subtree: true
472        });
473    } else {
474        document.addEventListener('DOMContentLoaded', function() {
475            observer.observe(document.body, {
476                childList: true,
477                subtree: true
478            });
479        });
480    }
481
482    // Periodically save XP from UI
483    setInterval(function() {
484        try {
485            const expElement = document.querySelector('.accountExperienceBar .exp');
486            if (expElement) {
487                const expText = expElement.textContent;
488                const match = expText.match(/(\d+)\/(\d+)/);
489                if (match) {
490                    const currentXP = parseInt(match[1]);
491                    if (currentXP > (savedXP || 0)) {
492                        savedXP = currentXP;
493                        console.log('[EvoWorld Premium Unlocker] XP saved:', savedXP);
494                    }
495                }
496            }
497        } catch (e) {
498            // Ignore errors
499        }
500    }, 1000);
501
502    console.log('[EvoWorld Premium Unlocker] All hooks installed successfully');
503    console.log('[EvoWorld Premium Unlocker] Invincibility, premium features, food clock, pet enabled, and XP loss prevention active');
504})();