修复装备融合BUG 装备继承半程进度

This commit is contained in:
Lenheart 2025-12-17 10:48:30 +08:00
commit 66a3e9f49b
6 changed files with 300 additions and 36 deletions

View File

@ -342,6 +342,26 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow {
}
}
}
//绘制道具带道具信息
function DrawItemObject(X, Y, Object) {
if (!Object) return;
L_Sq_DrawItem(X, Y, Object.ItemId, Object.Count, 0, 0, 0);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 30, 30)) {
//打开道具信息窗口
if (!ItemInfoDrawS) {
ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Object.ItemAddress, 41);
//校准道具信息窗口位置
L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28);
//我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具
getroottable().WindowsShowABFlag <- false;
}
} else {
if (ItemInfoDrawS) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
ItemInfoDrawS = null;
}
}
}
//绘制标题
function DrawWindowTitle(Width) {
@ -1478,3 +1498,82 @@ class Yosin_ScrollBar {
}
}
class LenheartNewUI_ItemSlot extends LenheartNewUI_CommonUi {
ItemId = null;
ItemCount = null;
ItemObject = null;
ItemInfoWindow = null;
//禁止点击
NoClick = false;
RemoveCallBack = null;
constructor(X, Y) {
LenheartNewUI_CommonUi.constructor(X, Y, 30, 30);
}
function Show(obj) {
if (ItemObject) {
L_Sq_DrawItem(X, Y, ItemId, ItemCount, 0, 0, 0);
if (isInRect) {
//打开道具信息窗口
if (!ItemInfoWindow) {
ItemInfoWindow = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, ItemObject.C_Object, 41);
//校准道具信息窗口位置
L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoWindow, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28);
//我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具
getroottable().WindowsShowABFlag <- false;
}
} else {
if (ItemInfoWindow) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
ItemInfoWindow = null;
}
}
}
//悬停光效
if (isInRect) {
L_sq_SetDrawImgModel(2, 0);
Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X - 2, Y - 2);
L_sq_ReleaseDrawImgModel();
}
}
function SetItem(item) {
ItemObject = item;
ItemId = item.GetIndex();
ItemCount = 1;
}
function RemoveItem()
{
ItemObject = null;
ItemId = null;
ItemCount = null;
}
function SetRemoveCallBack(Func){
RemoveCallBack = Func;
}
//鼠标右键按下回调
function OnMouseRbDown(MousePos_X, MousePos_Y) {
if(NoClick)return;
if (isInRect) {
if(ItemObject){
ItemObject = null;
ItemId = null;
ItemCount = null;
}
if (ItemInfoWindow) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
ItemInfoWindow = null;
}
if(RemoveCallBack)RemoveCallBack(this);
}
}
}

67
Base/_Tool/Item_Class.nut Normal file
View File

@ -0,0 +1,67 @@
class Rindro_Item {
C_Object = null;
constructor() {
}
function LoadById(Index) {
local itemBuffer = Memory.alloc(0xD0);
L_Sq_CallFunc(0x65DE50, "pointer", FFI_FASTCALL, ["pointer", "int"], itemBuffer.C_Object, 0); //Fastcall 补位
C_Object = L_Sq_CallFunc(0x972220, "int", FFI_MS_CDECL, ["int", "pointer", "int"], Index, itemBuffer.C_Object, 1); //ID 后面的1未知
}
function LoadByAddress(Address) {
C_Object = Address;
}
//获取ID
function GetIndex() {
return NativePointer(C_Object).add(0x1C).readInt();
}
//设置ID
function SetIndex(Index) {
NativePointer(C_Object).add(0x1C).writeInt(Index);
}
//获取强化值
function GetUpgrade() {
return MemoryTool.DecodeMemoryData(C_Object + 0x1054);
}
//设置强化值
function SetUpgrade(Upgrade) {
MemoryTool.EncodeMemoryData(C_Object + 0x1054, Upgrade);
}
//获取增幅属性
function GetAmplification() {
return MemoryTool.DecodeMemoryData(C_Object + 0x10A8);
}
//设置增幅属性
function SetAmplification(Amplification) {
MemoryTool.EncodeMemoryData(C_Object + 0x10A8, Amplification);
}
//获取锻造等级
function GetForging() {
return MemoryTool.DecodeMemoryData(C_Object + 0x10E8);
}
//设置锻造等级
function SetForging(Forging) {
MemoryTool.EncodeMemoryData(C_Object + 0x10E8, Forging);
}
//获取锻造属性
function GetForgingAttribute() {
return MemoryTool.DecodeMemoryData(C_Object + 0xE1C);
}
//设置锻造属性
function SetForgingAttribute(ForgingAttribute) {
MemoryTool.EncodeMemoryData(C_Object + 0xE1C, ForgingAttribute);
}
//获取附魔卡片ID
function GetEnchanting() {
return MemoryTool.DecodeMemoryData(C_Object + 0x1084);
}
//设置附魔卡片ID
function SetEnchanting(Enchanting) {
MemoryTool.EncodeMemoryData(C_Object + 0x1084, Enchanting);
}
}

View File

@ -11,6 +11,7 @@
"Base/_Tool/Script_Class.nut",
"Base/_Tool/Image_Class.nut",
"Base/_Tool/Animation_Class.nut",
"Base/_Tool/Item_Class.nut",
"Base/CallBack/PackControl.nut",
"Base/CallBack/DrawMain.nut",
"Base/CallBack/DrawHudMain.nut",

View File

@ -164,28 +164,6 @@ class ItemCrossoverC extends LenheartNewUI_Windows {
}
}
//绘制道具带道具信息
function DrawItemObject(X, Y, Object) {
if (!Object) return;
L_Sq_DrawItem(X, Y, Object.ItemId, Object.Count, 0, 0, 0);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 30, 30)) {
//打开道具信息窗口
if (!ItemInfoDrawS) {
ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Object.ItemAddress, 41);
//校准道具信息窗口位置
L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28);
//我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具
getroottable().WindowsShowABFlag <- false;
}
} else {
if (ItemInfoDrawS) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
ItemInfoDrawS = null;
}
}
}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);

View File

@ -30,11 +30,11 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
if (Item) {
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress;
Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1);
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null;
}
CheckInRect();
}
function CheckInRect() {
@ -125,6 +125,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
local Jso = Json.Decode(Chunk);
Msg = Jso.msg;
if (Jso.rawin("value")) {
print(Jso.value[0]);
Slot[2].Item = {
itemId = Jso.value[0]
}
@ -365,11 +366,11 @@ class ItemFusionC extends LenheartNewUI_Windows {
}
// L_Windows_List <- [];
// getroottable().rawdelete("LenheartPluginsInitFlag");
// getroottable().rawdelete("EventList_Obj")
// getroottable().rawdelete("ItemFusion_Obj");
// getroottable().rawdelete("L_Each_Obj");
L_Windows_List <- [];
getroottable().rawdelete("LenheartPluginsInitFlag");
getroottable().rawdelete("EventList_Obj")
getroottable().rawdelete("ItemFusion_Obj");
getroottable().rawdelete("L_Each_Obj");
function Lenheart_ItemFusion_Fun(obj) {
local RootTab = getroottable();

View File

@ -4,6 +4,7 @@
创建日期:2025-12-15 15:03
文件用途:
*/
class ItemInheritC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
@ -18,25 +19,58 @@ class ItemInheritC extends LenheartNewUI_Windows {
Img = Rindro_Image("interface2/ui/newitemtool/newitemtool.img");
//材料装备
MaterialItem = null;
MaterialItemSlot = null;
//目标装备
TargetItem = null;
TargetItemSlot = null;
//继承结果装备
ResultItem = null;
ResultItemSlot = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
DiscardItemCallBackFunc.rawset("ItemCrossoverC", DiscardItem.bindenv(this));
}
function RegisterWidget() {
// //关闭按钮
// local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
// CloseButton.OnClick = function() {
// this.Visible = false;
// }.bindenv(this);
// Childrens.append(CloseButton);
//关闭按钮
local CloseButton = LenheartNewUI_BaseButton(274, 4, 11, 12, "interface/lenheartwindowcommon.img", 276);
CloseButton.OnClick = function() {
this.Visible = false;
}.bindenv(this);
Childrens.append(CloseButton);
MaterialItemSlot = LenheartNewUI_ItemSlot(56, 87);
MaterialItemSlot.SetRemoveCallBack(function(obj) {
MaterialItem = null;
PlaceItem();
}.bindenv(this));
AddChild(MaterialItemSlot);
TargetItemSlot = LenheartNewUI_ItemSlot(211, 87);
TargetItemSlot.SetRemoveCallBack(function(obj) {
TargetItem = null;
PlaceItem();
}.bindenv(this));
AddChild(TargetItemSlot);
ResultItemSlot = LenheartNewUI_ItemSlot(133, 132);
ResultItemSlot.NoClick = true;
// ResultItemSlot.SetItem(ItemR);
AddChild(ResultItemSlot);
}
//绘制主界面
function DrawMain(obj) {
//背景框
@ -57,7 +91,6 @@ class ItemInheritC extends LenheartNewUI_Windows {
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
}
//逻辑入口
@ -65,6 +98,89 @@ class ItemInheritC extends LenheartNewUI_Windows {
LenheartNewUI_Windows.SyncPos(X, Y);
}
//遍历背包查找Item
function FindItemPosByForeachInven(FindAddress) {
local Inven = L_sq_RA(0x1A5FB24);
local InvenAdd = L_sq_RA(Inven + 56);
InvenAdd += 36;
for (local z = 0; z< 5; z++) {
for (local i = 0; i< 48; i++) {
local ItemAdd = L_sq_RA(InvenAdd + ((i + (z * 48)) * 4));
if (ItemAdd == FindAddress) {
local NamePointer = L_sq_RA(FindAddress + 0x20);
if (z != 0) {
if (ItemInfoDrawS) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
ItemInfoDrawS = null;
ResetFocus();
}
return null;
}
return {
Type = z,
Pos = i,
Vis = false,
Count = MemoryTool.DecodeMemoryData(FindAddress + 0x1A4),
ItemId = L_sq_RA(FindAddress + 0x1c),
ItemAddress = FindAddress,
Name = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString()
Rarity = L_sq_RA(FindAddress + 0xF4),
};
}
}
}
return null;
}
//回收道具回调
function DiscardItem(ItemAddress) {
local MousePos_X = IMouse.GetXPos();
local MousePos_Y = IMouse.GetYPos();
if (!sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) return true;
if (!Visible) return true;
else {
local ItemInfo = FindItemPosByForeachInven(ItemAddress);
local ItemObject = Rindro_Item();
ItemInfo.ItemObject <- ItemObject;
ItemObject.LoadByAddress(ItemInfo.ItemAddress);
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 56, Y + 87, 30, 30)) {
MaterialItem = ItemInfo;
MaterialItemSlot.SetItem(ItemObject);
} else if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 211, Y + 87, 30, 30)) {
TargetItem = ItemInfo;
TargetItemSlot.SetItem(ItemObject);
}
PlaceItem();
}
}
//物品被放置的回调
function PlaceItem() {
//两个都放上去了
if (MaterialItem && TargetItem) {
//获取材料装备的强化 增幅 附魔 锻造
local MaterialItemObject = MaterialItem.ItemObject;
local Upgrade = MaterialItemObject.GetUpgrade();
local Amplification = MaterialItemObject.GetAmplification();
local Forging = MaterialItemObject.GetForging();
local ForgingAttribute = MaterialItemObject.GetForgingAttribute();
local Enchanting = MaterialItemObject.GetEnchanting();
//创建一个目标装备
ResultItem = Rindro_Item();
ResultItem.LoadById(TargetItem.ItemObject.GetIndex());
ResultItem.SetUpgrade(Upgrade);
ResultItem.SetAmplification(Amplification);
ResultItem.SetForging(Forging);
ResultItem.SetForgingAttribute(ForgingAttribute);
ResultItem.SetEnchanting(Enchanting);
ResultItemSlot.SetItem(ResultItem);
} else {
ResultItem = null;
ResultItemSlot.RemoveItem();
}
}
}
L_Windows_List <- [];
@ -74,6 +190,8 @@ getroottable().rawdelete("ItemInherit_Obj");
getroottable().rawdelete("L_Each_Obj");
function Lenheart_ItemInherit_Fun(obj) {
sq_IsValidActiveStatus(obj, 1);
local RootTab = getroottable();
if (!RootTab.rawin("ItemInherit_Obj")) {
RootTab.rawset("ItemInherit_Obj", true);