Can thiệp vào bộ nhớ túi đồ, nhân đôi số lượng vật phẩm mỗi khi tương tác Equip/Unequip.
// ==UserScript==
// @name Sword Master - Auto Dupe Items
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Can thiệp vào bộ nhớ túi đồ, nhân đôi số lượng vật phẩm mỗi khi tương tác Equip/Unequip.
// @author You
// @match *://*.swordmaster.io/*
// @match *://*swordmasters.io/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
console.log("[Dupe Script] Đang tiêm mã vào bộ nhớ game...");
// Khởi tạo một bộ đếm để theo dõi số lần Equip/Unequip
let multiplier = 2;
// KỸ THUẬT 1: Hook vào JSON.parse để thao túng dữ liệu Inventory khi load/cập nhật
const originalParse = JSON.parse;
JSON.parse = function() {
// Gọi hàm gốc để lấy dữ liệu nguyên bản
const data = originalParse.apply(this, arguments);
// Kiểm tra cấu trúc bộ nhớ xem có chứa mảng túi đồ không
if (data && typeof data === 'object') {
// Các biến phổ biến mà game .io thường dùng để lưu đồ
let inventory = data.inventory || data.items || data.equipment || data.bag;
if (Array.isArray(inventory)) {
inventory.forEach(item => {
// Quét tìm các biến chứa số lượng vật phẩm và nhân đôi chúng
if (typeof item.amount === 'number') item.amount *= multiplier;
if (typeof item.count === 'number') item.count *= multiplier;
if (typeof item.quantity === 'number') item.quantity *= multiplier;
if (typeof item.qty === 'number') item.qty *= multiplier;
});
}
}
return data;
};
// KỸ THUẬT 2: Hook vào giao thức WebSocket để can thiệp khi bấm Equip
const originalSend = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
try {
// Giải mã gói tin gửi lên server
let payload = JSON.parse(data);
// Nếu phát hiện hành động là "Equip" hoặc "Unequip"
if (payload.action === "equip" || payload.type === "equipItem") {
console.log("[Dupe Script] Phát hiện hành động Equip! Đang x2 bộ nhớ...");
multiplier *= 2; // Tăng hệ số nhân mỗi khi lặp lại thao tác
}
} catch (e) {
// Bỏ qua nếu dữ liệu không phải định dạng JSON (ví dụ: ArrayBuffer)
}
// Vẫn gửi gói tin bình thường để game không bị crash
originalSend.apply(this, arguments);
};
// KỸ THUẬT 3: Can thiệp trực tiếp vào Object Game Global (Nếu game không dùng mã hóa gắt gao)
window.addEventListener('load', () => {
// Tìm kiếm các object quản lý logic game thường lộ ra ngoài Window
const gameLogic = window.Game || window.GameManager || window.App;
if (gameLogic && gameLogic.EquipItem) {
const originalEquip = gameLogic.EquipItem;
gameLogic.EquipItem = function(itemId) {
console.log(`[Dupe Script] Đang can thiệp vật phẩm ID: ${itemId}`);
originalEquip.apply(this, arguments);
};
}
});
})();