260 lines
7.7 KiB
Plaintext
260 lines
7.7 KiB
Plaintext
/*
|
|
文件名:ObjectConvert.nut
|
|
路径:Project/CustomPlugins/lulu/ObjectConvert.nut
|
|
创建日期:2026-02-09 23:33
|
|
文件用途:
|
|
*/
|
|
|
|
|
|
function sq_GetCNRDObjectToPassiveObject(obj) {
|
|
return L_Sq_ObjectAddressToSqrObject(L_Sq_GetObjectAddress(obj), "CNRDPassiveObject", 0);
|
|
}
|
|
|
|
function sq_GetCNRDObjectToSQRPassiveObject(obj) {
|
|
return L_Sq_ObjectAddressToSqrObject(L_Sq_GetObjectAddress(obj), "CNSquirrelPassiveObject", 0);
|
|
}
|
|
|
|
function sq_GetObjectAbilityInteger(obj, ObjectAddressOffset) {
|
|
return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readInt();
|
|
}
|
|
|
|
function sq_SetObjectAbilityInteger(obj, ObjectAddressOffset, Value) {
|
|
NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeInt(Value);
|
|
}
|
|
|
|
function sq_GetObjectAbilityFloat(obj, ObjectAddressOffset) {
|
|
return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readFloat();
|
|
}
|
|
|
|
function sq_SetObjectAbilityFloat(obj, ObjectAddressOffset, Value) {
|
|
NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeFloat(Value);
|
|
}
|
|
|
|
function sq_GetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset) {
|
|
return MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset);
|
|
}
|
|
|
|
function sq_SetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset, Value) {
|
|
MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, Value);
|
|
}
|
|
|
|
function sq_GetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset) {
|
|
local Res = MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset, Value) {
|
|
local B = blob();
|
|
B.writen(Value, 'f');
|
|
MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, B.readn('i'));
|
|
}
|
|
|
|
|
|
|
|
//[human damage rate]
|
|
// print(DATK(AtkC, 0x294).readFloat());
|
|
|
|
//[fort damage rate]
|
|
// print(DATK(AtkC, 0x2A0).readFloat());
|
|
|
|
//[monster damage rate]
|
|
// print(DATK(AtkC, 0x2AC).readFloat());
|
|
|
|
//[critical hit]
|
|
// print(DATK(AtkC, 0x68).readFloat());
|
|
|
|
//[damage]
|
|
// print(DATK(AtkC, 0x0).readFloat());
|
|
|
|
//[damage bonus]
|
|
// print(DATK(AtkC, 0x24).readInt());
|
|
|
|
//[absolute damage]
|
|
// print(DATK(AtkC, 0x18).readInt());
|
|
|
|
//[damage reaction]
|
|
// print(NativePointer(AtkC + 0x4C).readInt());
|
|
|
|
//[knuck back]
|
|
// print(DATK(AtkC, 0x8C).readInt());
|
|
|
|
|
|
function EncodeAttackMemoryData(AtkC, Offset) {
|
|
// 读取 ObjectId
|
|
local ObjectIdPtr = NativePointer(AtkC + Offset);
|
|
local ObjectId = ObjectIdPtr.readInt();
|
|
// 读取 base1 (全局表)
|
|
local base1Ptr = NativePointer(0x1AF8D78);
|
|
local base1 = base1Ptr.readInt();
|
|
// 计算并读取二级表
|
|
local offset_high = 4 * ((ObjectId >> 16) & 0xFFFF);
|
|
local addr1 = base1 + offset_high + 0x24;
|
|
local base2Ptr = NativePointer(addr1);
|
|
local base2 = base2Ptr.readInt();
|
|
// 计算并读取 verifyValue
|
|
local offset_low = 4 * (ObjectId & 0xFFFF);
|
|
local addr2 = base2 + offset_low + 0x2114;
|
|
local verifyValuePtr = NativePointer(addr2);
|
|
local verifyValue = verifyValuePtr.readInt();
|
|
// 读取输入值
|
|
local inputAddr = AtkC + Offset + 0x8;
|
|
local inputPtr = NativePointer(inputAddr);
|
|
local inputValue = inputPtr.readInt();
|
|
// 解密
|
|
local lowWord = verifyValue & 0xFFFF;
|
|
local expanded = (lowWord << 16) | lowWord;
|
|
local decrypted = inputValue ^ expanded;
|
|
|
|
local Res = Memory.alloc(4);
|
|
Res.writeInt(decrypted);
|
|
return Res;
|
|
}
|
|
|
|
|
|
function sq_GetCurrentAttackInfoDamage(attackInfo) {
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x0);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
B.seek(0);
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoDamage(attackInfo, damage) {
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(damage, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x0, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoAbsoluteDamage(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x18);
|
|
return Res;
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoAbsoluteDamage(attackInfo, damage)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x18, damage);
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoBonusRate(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x24);
|
|
return Res;
|
|
}
|
|
// print(DATK(AtkC, 0x1c8).readFloat());
|
|
// print(DATK(AtkC, 0x1ec).readInt());
|
|
// print(DATK(AtkC, 0x234).readInt());
|
|
function sq_GetCurrentAttackInfoChangeStatus(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Info = [EncodeAttackMemoryData(AtkC, 0x1c8).readFloat(), EncodeAttackMemoryData(AtkC, 0x1ec).readInt(), EncodeAttackMemoryData(AtkC, 0x234).readInt()];
|
|
return Info;
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoChangeStatus(attackInfo, Data1, Data2, Data3)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(Data1, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x1c8, B.readn('i'));
|
|
B.seek(0);
|
|
B.writen(Data2, 'i');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x1ec, B.readn('i'));
|
|
B.seek(0);
|
|
B.writen(Data3, 'i');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x234, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoHumanDamageRate(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x294);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
B.seek(0);
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoHumanDamageRate(attackInfo, rate)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(rate, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x294, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoFortDamageRate(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x2A0);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
B.seek(0);
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoFortDamageRate(attackInfo, rate)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(rate, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x2A0, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoMonsterDamageRate(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x2AC);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
B.seek(0);
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoMonsterDamageRate(attackInfo, rate)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(rate, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x2AC, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoCriticalRate(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x68);
|
|
local B = blob();
|
|
B.writen(Res, 'i');
|
|
B.seek(0);
|
|
return B.readn('f');
|
|
}
|
|
|
|
function sq_SetCurrentAttackInfoCriticalRate(attackInfo, rate)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local B = blob();
|
|
B.writen(rate, 'f');
|
|
B.seek(0);
|
|
MemoryTool.EncodeMemoryData(AtkC + 0x68, B.readn('i'));
|
|
}
|
|
|
|
function sq_GetCurrentAttackInfoDamageReaction(attackInfo)
|
|
{
|
|
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
|
|
local Res = MemoryTool.DecodeMemoryData(AtkC + 0x4C);
|
|
return Res;
|
|
} |