原帖:epic_potion(史诗药剂)——frida【台服dnf吧】_百度贴吧
const CUser_CheckCoolTimeItem = new NativeFunction(ptr(0x865E994), 'int', ['pointer', 'int'], {"abi": "sysv"});
const CParty_checkValidUser = new NativeFunction(ptr(0x8145868), 'int', ['pointer', 'int'], {"abi": "sysv"});
const CLuckPoint_getItemRarity = new NativeFunction(ptr(0x8550BE4), 'int', ['pointer', 'pointer', 'int', 'int'], {"abi": "sysv"});
function api_GetPartyMemberNumber(Party) {
if (Party.isNull()) return 1;
let memberCount = 0;
for (let i = 0; i <= 3; i++) {
memberCount += CParty_checkValidUser(Party, i);
}
return memberCount;
}
function epic_potion() {
let user = null;
Interceptor.attach(ptr(0x81EB0C4), {
onEnter: function (args) {
user = args[1];
}
});
Interceptor.attach(ptr(0x85B2412), {
onEnter: function (args) {
user = args[1];
}
});
Interceptor.replace(ptr(0x8550BE4), new NativeCallback(function (a1, a2, roll, a4) {
if (user == null) {
return CLuckPoint_getItemRarity(a1, a2, roll, a4);
}
const Party = CUser_getParty(user);
// 只在单人深渊模式且使用药剂的状态下生效
if (this.returnAddress == 0x853583a && CUser_CheckCoolTimeItem(user, 2600010) && api_GetPartyMemberNumber(Party) == 1) {
const MaxRoll = a2.add(16).readU32();
// 概率
const odds = 0.1;
const MyRoll = Math.floor(Math.min(roll + roll * odds, MaxRoll));
return CLuckPoint_getItemRarity(a1, a2, MyRoll, a4);
}
return CLuckPoint_getItemRarity(a1, a2, roll, a4);
}, 'int', ['pointer', 'pointer', 'int', 'int']));
}