2025-12-15 16:45:38 +08:00
|
|
|
/*
|
|
|
|
|
文件名:ItemInherit.nut
|
|
|
|
|
路径:Project/ItemTool/ItemInherit/ItemInherit.nut
|
|
|
|
|
创建日期:2025-12-15 15:03
|
|
|
|
|
文件用途:
|
|
|
|
|
*/
|
2025-12-17 10:48:30 +08:00
|
|
|
|
2025-12-15 16:45:38 +08:00
|
|
|
class ItemInheritC extends LenheartNewUI_Windows {
|
|
|
|
|
//调试模式
|
|
|
|
|
// DeBugMode = true;
|
|
|
|
|
|
|
|
|
|
//不是窗口
|
|
|
|
|
// NoWindow = true;
|
|
|
|
|
|
|
|
|
|
//是否可见
|
|
|
|
|
// Visible = false;
|
|
|
|
|
|
|
|
|
|
NPCList = null;
|
|
|
|
|
|
|
|
|
|
Img = Rindro_Image("interface2/ui/newitemtool/newitemtool.img");
|
|
|
|
|
|
2025-12-17 10:48:30 +08:00
|
|
|
//材料装备
|
|
|
|
|
MaterialItem = null;
|
|
|
|
|
MaterialItemSlot = null;
|
|
|
|
|
//目标装备
|
|
|
|
|
TargetItem = null;
|
|
|
|
|
TargetItemSlot = null;
|
|
|
|
|
//继承结果装备
|
|
|
|
|
ResultItem = null;
|
|
|
|
|
ResultItemSlot = null;
|
|
|
|
|
|
2025-12-15 16:45:38 +08:00
|
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
|
|
|
|
Childrens = [];
|
|
|
|
|
//注册控件
|
|
|
|
|
RegisterWidget();
|
|
|
|
|
|
|
|
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
2025-12-17 10:48:30 +08:00
|
|
|
|
|
|
|
|
DiscardItemCallBackFunc.rawset("ItemCrossoverC", DiscardItem.bindenv(this));
|
2025-12-15 16:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function RegisterWidget() {
|
2025-12-17 10:48:30 +08:00
|
|
|
//关闭按钮
|
|
|
|
|
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);
|
|
|
|
|
|
2025-12-15 16:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
2025-12-17 10:48:30 +08:00
|
|
|
|
2025-12-15 16:45:38 +08:00
|
|
|
//绘制主界面
|
|
|
|
|
function DrawMain(obj) {
|
|
|
|
|
//背景框
|
|
|
|
|
DrawNineBox(X, Y, 292, 292, "interface/lenheartwindowcommon.img", 213);
|
|
|
|
|
//标题
|
|
|
|
|
DrawWindowTitle(293);
|
|
|
|
|
//绘制标题名
|
|
|
|
|
L_sq_DrawCode("装备继承", X + 123, Y + 5, sq_RGBA(230, 200, 155, 255), 0, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Img.DrawPng(3, X + 8, Y + 32);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rindro_Image_GlobalMap["lenheartui"].DrawPng(469, X + 260, Y + 40);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Show(obj) {
|
|
|
|
|
DrawMain(obj);
|
|
|
|
|
LenheartNewUI_Windows.Show(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//逻辑入口
|
|
|
|
|
function Proc(obj) {
|
|
|
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-17 10:48:30 +08:00
|
|
|
//遍历背包查找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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-15 16:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
L_Windows_List <- [];
|
|
|
|
|
getroottable().rawdelete("LenheartPluginsInitFlag");
|
|
|
|
|
getroottable().rawdelete("EventList_Obj")
|
|
|
|
|
getroottable().rawdelete("ItemInherit_Obj");
|
|
|
|
|
getroottable().rawdelete("L_Each_Obj");
|
|
|
|
|
|
|
|
|
|
function Lenheart_ItemInherit_Fun(obj) {
|
2025-12-17 10:48:30 +08:00
|
|
|
|
|
|
|
|
sq_IsValidActiveStatus(obj, 1);
|
2025-12-15 16:45:38 +08:00
|
|
|
local RootTab = getroottable();
|
|
|
|
|
if (!RootTab.rawin("ItemInherit_Obj")) {
|
|
|
|
|
RootTab.rawset("ItemInherit_Obj", true);
|
|
|
|
|
LenheartNewUI_CreateWindow(ItemInheritC, "装备继承窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 160, 292, 290, 28);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getroottable()["LenheartFuncTab"].rawset("ItemInheritFuncN", Lenheart_ItemInherit_Fun);
|