Rindro-Sqr/Project/NewItemInfoWindow/NewItemInfoWindow.nut

178 lines
6.3 KiB
Plaintext
Raw Normal View History

2026-01-20 02:55:20 +08:00
/*
文件名:NewItemInfoWindow.nut
路径:Project/NewItemInfoWindow/NewItemInfoWindow.nut
创建日期:2026-01-18 11:22
文件用途:
*/
class NewItemInfoWindowC extends Rindro_BaseToolClass {
//绘制信息Map
DrawInfoMap = null;
//Script信息
ScriptInfoMap = null;
2026-02-02 13:30:37 +08:00
//需要添加绘制HOOK的List
NeedDrawHookList = null;
2026-01-20 02:55:20 +08:00
//自定义绘制代理
CustomDrawDelegate = null;
constructor() {
DrawInfoMap = {};
ScriptInfoMap = {};
CustomDrawDelegate = {};
2026-02-02 13:30:37 +08:00
NeedDrawHookList = {};
2026-01-20 02:55:20 +08:00
Fix();
}
//绘制Info
function Show(InfoList, EquipAddress, XPos, YPos) {
if (!DrawInfoMap.rawin(EquipAddress)) {
local ItemObject = Rindro_Item();
ItemObject.LoadByAddress(EquipAddress);
ItemObject.ConstructDrawingInformation(InfoList);
DrawInfoMap.rawset(EquipAddress, ItemObject);
}
DrawInfoMap[EquipAddress].Show(XPos, YPos);
}
2026-02-02 13:30:37 +08:00
function Proc() {
//鼠标没有悬停东西的时候直接清空绘制信息
if (NativePointer(0x1AE45B4).readInt() == 0) {
DrawInfoMap = {};
}
if (KeyPress.isKeyPress(OPTION_HOTKEY_TOOLTIP_)) {
DrawInfoMap = {};
}
}
2026-01-20 02:55:20 +08:00
function AddDelegate(Name, Height, Func, CheckFunc) {
CustomDrawDelegate.rawset(Name, {
//代理区域高度
Height = Height,
//代理回调函数
Func = Func,
//代理条件
CheckFunc = CheckFunc
})
}
2026-02-02 13:30:37 +08:00
function AddHookItemId(Index) {
NeedDrawHookList.rawset(Index, true);
}
2026-01-20 02:55:20 +08:00
function RemoveDelegate(Name) {
CustomDrawDelegate.rawdelete(Name);
}
2026-02-02 13:30:37 +08:00
function RemoveHookItemId(Index) {
NeedDrawHookList.rawdelete(Index);
}
2026-01-20 02:55:20 +08:00
function Fix() {
NativePointer(0xF363D9).writeByteArray(array(16, 0x90))
Rindro_Haker.LoadHook(0xF363D0, ["int", "int", "int", "void"],
function(args) {
//先获取到 DrawItemContent_F36110 的 a3参数
local a3 = L_sq_P2I(Rindro_Haker.CpuContext.ecx) + 0x17c;
//计算
//数据头尾指针 一个元素 72字节
local Start = NativePointer(a3).add(0x4).readInt();
local End = NativePointer(a3).add(0x8).readInt();
//数据数组长度
local Length = ((End - Start) / 72);
//原数据
local InfoList = [];
//获取装备编号 (遍历所有数据块 找到标志位 读取装备指针)
local EquipAddress = 0;
for (local i = 1; i< Length; i++) {
local Info = {};
local Str = null;
if (NativePointer(Start).add(72 * i + 0x24).readInt()< 8) {
local StrPointer = NativePointer(Start).add(72 * i + 0x10);
if (L_sq_P2I(StrPointer.C_Object) > 0x400000) {
Str = StrPointer.readUnicodeString();
}
} else {
local StrPointer = NativePointer(Start).add(72 * i + 0x10).readInt();
if (StrPointer > 0x400000) {
Str = NativePointer(StrPointer).readUnicodeString();
}
}
Info.Str <- Str;
Info.Flag <- NativePointer(Start).add(72 * i).readInt();
local Pos = NativePointer(Start).add(72 * i + 0x4).readInt();
local Color = NativePointer(Start).add(72 * i + 0x8).readInt();
//特殊的位置信息 作为标志位的时候 颜色是装备指针
if (Pos == 947330670) {
EquipAddress = Color;
}
Info.Color <- Color;
InfoList.append(Info);
}
if (EquipAddress != 0) {
// printf("装备编号: " + NativePointer(EquipAddress).add(0x1c).readInt());
local XPos = NativePointer(L_sq_P2I(Rindro_Haker.CpuContext.esi) + 0x14).readInt();
local YPos = NativePointer(L_sq_P2I(Rindro_Haker.CpuContext.esi) + 0x18).readInt();
Show(InfoList, EquipAddress, XPos, YPos);
//HOOK原逻辑不执行
NativePointer(0xF363D9).writeByteArray(array(16, 0x90))
}
return null;
}.bindenv(this),
function(args) {
//还原原逻辑
NativePointer(0xF363D9).writeByteArray([0x80, 0xBE, 0x90, 0x01, 0x00, 0x00, 0x00, 0x74, 0x0E, 0xC6, 0x86, 0x90, 0x01, 0x00, 0x00, 0x00]);
return null;
}.bindenv(this));
//构造信息时
Rindro_Haker.LoadHook(0xF542F0, ["int", "int", "int", "int", "int"],
function(args) {
//找到新增分割线的构造时机 将标志位写入位置参数 将Item地址写入颜色参数
if (args[0] > 0) {
if (NativePointer(args[1]).readUnicodeString().len() <= 0) {
local EquipmentAddress = NativePointer(Rindro_Haker.CpuContext.ecx).add(0x178).readInt();
//是装备才做这个事
2026-02-02 13:30:37 +08:00
local Id = NativePointer(EquipmentAddress).add(0x1c).readInt();
if (NativePointer(EquipmentAddress).add(0x4).readInt() == 2 || NeedDrawHookList.rawin(Id)) {
2026-01-20 02:55:20 +08:00
args[2] = 947330670;
args[3] = EquipmentAddress;
return args;
}
}
}
}.bindenv(this),
function(args) {
return null;
}.bindenv(this));
}
}
2026-02-02 13:30:37 +08:00
2026-01-20 02:55:20 +08:00
getroottable().rawdelete("NewItemInfoWindow_Obj");
function Lenheart_NewItemInfoWindow_Fun(obj) {
local RootTab = getroottable();
if (!RootTab.rawin("NewItemInfoWindow_Obj")) {
RootTab.rawset("NewItemInfoWindow_Obj", NewItemInfoWindowC());
}
2026-02-02 13:30:37 +08:00
RootTab["NewItemInfoWindow_Obj"].Proc();
2026-01-20 02:55:20 +08:00
}
2026-02-02 13:30:37 +08:00
getroottable()["LenheartBaseFuncTab"].rawset("NewItemInfoWindowFuncN", Lenheart_NewItemInfoWindow_Fun);