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

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

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);