feat: 添加获取和设置攻击信息伤害值的函数

添加 sq_GetCurrentAttackInfoDamage 和 sq_SetCurrentAttackInfoDamage 函数,用于读取和修改攻击信息的伤害值,扩展对象能力操作功能
This commit is contained in:
Lenheart 2026-03-14 23:59:31 +08:00
parent 2f20020a01
commit 1194db30b3
1 changed files with 25 additions and 16 deletions

View File

@ -14,47 +14,56 @@ function sq_GetCNRDObjectToSQRPassiveObject(obj) {
return L_Sq_ObjectAddressToSqrObject(L_Sq_GetObjectAddress(obj), "CNSquirrelPassiveObject", 0); return L_Sq_ObjectAddressToSqrObject(L_Sq_GetObjectAddress(obj), "CNSquirrelPassiveObject", 0);
} }
function sq_GetObjectAbilityInteger(obj, ObjectAddressOffset) function sq_GetObjectAbilityInteger(obj, ObjectAddressOffset) {
{
return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readInt(); return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readInt();
} }
function sq_SetObjectAbilityInteger(obj, ObjectAddressOffset, Value) function sq_SetObjectAbilityInteger(obj, ObjectAddressOffset, Value) {
{
NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeInt(Value); NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeInt(Value);
} }
function sq_GetObjectAbilityFloat(obj, ObjectAddressOffset) function sq_GetObjectAbilityFloat(obj, ObjectAddressOffset) {
{
return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readFloat(); return NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).readFloat();
} }
function sq_SetObjectAbilityFloat(obj, ObjectAddressOffset, Value) function sq_SetObjectAbilityFloat(obj, ObjectAddressOffset, Value) {
{
NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeFloat(Value); NativePointer(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset).writeFloat(Value);
} }
function sq_GetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset) function sq_GetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset) {
{
return MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset); return MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset);
} }
function sq_SetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset, Value) function sq_SetObjectAbilityIntegerWithDecrypt(obj, ObjectAddressOffset, Value) {
{
MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, Value); MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, Value);
} }
function sq_GetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset) function sq_GetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset) {
{
local Res = MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset); local Res = MemoryTool.DecodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset);
local B = blob(); local B = blob();
B.writen(Res, 'i'); B.writen(Res, 'i');
return B.readn('f'); return B.readn('f');
} }
function sq_SetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset, Value) function sq_SetObjectAbilityFloatWithDecrypt(obj, ObjectAddressOffset, Value) {
{
local B = blob(); local B = blob();
B.writen(Value, 'f'); B.writen(Value, 'f');
MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, B.readn('i')); MemoryTool.EncodeMemoryData(L_Sq_GetObjectAddress(obj) + ObjectAddressOffset, B.readn('i'));
} }
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');
return B.readn('f');
}
function sq_SetCurrentAttackInfoDamage(attackInfo, damage) {
local AtkC = L_sq_P2I(attackInfo["__ot"][28259608]);
local B = blob();
B.writen(damage, 'f');
MemoryTool.EncodeMemoryData(AtkC + 0x0, B.readn('i'));
}