diff --git a/Base/UI/Lenheart_UI_Class.nut b/Base/UI/Lenheart_UI_Class.nut index fac5ab1..4d14384 100644 --- a/Base/UI/Lenheart_UI_Class.nut +++ b/Base/UI/Lenheart_UI_Class.nut @@ -214,7 +214,7 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { //调用原生方法 LenheartNewUI_BaseWindow.constructor(); } - + //切换到最上层窗口 即得到焦点时 function ResetFocus() { @@ -225,7 +225,7 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { for (local i = L_Windows_List.len() - 1; i >= 0; i--) { if (L_Windows_List[i].ObjectId == this.ObjectId) { L_Windows_List.remove(i); - }else{ + } else { L_Windows_List[i].IsFocus = false; } } @@ -304,6 +304,8 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { ItemInfoDrawS = null; //绘制道具相信信息 ItemObject = null; + //临时绘制道具地址 + TemporaryDrawItemAddress = null; //获取道具信息并生成缓存 function GetItemInfo(Id) { @@ -327,7 +329,7 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) { //打开道具信息窗口 if (!ItemInfoDrawS) { - ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Rindro_ItemInfoObject[Id], 41); + ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, TemporaryDrawItemAddress ? TemporaryDrawItemAddress : Rindro_ItemInfoObject[Id], 41); //校准道具信息窗口位置 L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28); //我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具 @@ -347,11 +349,11 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { DrawTriptych(X - 1, Y, Width, "interface/lenheartwindowcommon.img", 9); if (IsFocus) { L_sq_SetDrawImgModel(2, 0); - DrawTriptychDetail(X - 1, Y , Width, "interface/lenheartwindowcommon.img", 109, 114, 115); + DrawTriptychDetail(X - 1, Y, Width, "interface/lenheartwindowcommon.img", 109, 114, 115); L_sq_ReleaseDrawImgModel(); } } - + //生成DT function GenerateDt() { try { diff --git a/Base/_Tool/Hacker_Class.nut b/Base/_Tool/Hacker_Class.nut index 672c352..ea91208 100644 --- a/Base/_Tool/Hacker_Class.nut +++ b/Base/_Tool/Hacker_Class.nut @@ -7,8 +7,11 @@ class _Rindro_Hacker { HookTable = null; + HookData = null; + constructor() { HookTable = {}; + HookData = {}; } function UnLoadHook(AddressStr) { diff --git a/Base/_Tool/Hacker_RegApi.nut b/Base/_Tool/Hacker_RegApi.nut index 5247854..17cae70 100644 --- a/Base/_Tool/Hacker_RegApi.nut +++ b/Base/_Tool/Hacker_RegApi.nut @@ -194,8 +194,9 @@ class R_Utils { // return null; // }); -// //绘制字符 -// getroottable().DrawCodeCallBackFunc <- {}; +//绘制字符 +getroottable().DrawCodeCallBackFunc <- {}; +getroottable().DrawCodeChangeMap <- {}; // Rindro_Haker.LoadHook(0x1206BD0, ["int", "int", "int", "pointer", "int", "void"], // function(args) { // // print("nut:" + format("%02x", args[3])); diff --git a/FileConfig.json b/FileConfig.json index 0ce078c..27431d5 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -52,6 +52,18 @@ "CSBase/Interface.nut" ], "ProjectScript": { + "融合装备": { + "Private": true, + "Script": [ + "Project/ItemTool/ItemFusion/ItemFusion.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "NPC交易定制插件", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "荒古遗尘装备": { "price": 1, "Script": [ diff --git a/Project/ItemTool/ItemFusion/ItemFusion.nut b/Project/ItemTool/ItemFusion/ItemFusion.nut new file mode 100644 index 0000000..be4ed4e --- /dev/null +++ b/Project/ItemTool/ItemFusion/ItemFusion.nut @@ -0,0 +1,328 @@ +/* +文件名:ItemFusion.nut +路径:Project/ItemTool/ItemFusion/ItemFusion.nut +创建日期:2025-12-06 10:07 +文件用途: +*/ + +class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi { + + WindowImg = Rindro_Image("interface2/itemtoolwindow/itemfusion/itemfusion.img"); + + Item = null; + + //覆写悬停Flag + HoverFlag = false; + + //UseFlag + UseFlag = true; + + constructor(X, Y) { + LenheartNewUI_CommonUi.constructor(X, Y, 46, 47); + } + + + function Show(obj) { + WindowImg.DrawPng(9, X, Y); + + + //如果槽里面有道具 绘制道具 + if (Item) { + if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress; + Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1); + } + + CheckInRect(); + + + } + + function CheckInRect() { + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 9, Y + 10, 24, 24)) { + //绘制悬停框 + L_sq_SetDrawImgModel(2, 0); + Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X + 8, Y + 8); + L_sq_ReleaseDrawImgModel(); + HoverFlag = true; + } else HoverFlag = false; + } + + //override + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + if (!Visible) return; + //调用原生方法 + LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y); + } + + function DiscardItem(info) { + if (HoverFlag) { + if (info) { + Item = info; + + } + return true; + } + } + + + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + if (!UseFlag) return; + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 9, Y + 10, 24, 24)) { + Item = null; + if (Parent.ItemInfoDrawS) { + L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); + Parent.ItemInfoDrawS = null; + Parent.ResetFocus(); + } + if (Parent.Slot[2].Item != null) { + Parent.Msg = 0; + Parent.Slot[2].Item = null; + } + } + } +} + +class ItemFusionC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + Slot = null; + + //Ani任务队列 + AniQueue = null; + //动画播放Flag + AniFlag = false; + SoundFlag = false; + + + Msg = 0; + + WindowImg = Rindro_Image("interface2/itemtoolwindow/itemfusion/itemfusion.img"); + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + AniQueue = QuestQueue(); + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + DiscardItemCallBackFunc.rawset("RecoveryC", DiscardItem.bindenv(this)); + + Pack_Control.rawset(21006002, function(Chunk) { + local Jso = Json.Decode(Chunk); + Msg = Jso.msg; + if (Jso.rawin("value")) { + Slot[2].Item = { + itemId = Jso.value[0] + } + } + }.bindenv(this)); + + Pack_Control.rawset(21006004, function(Chunk) { + local Jso = Json.Decode(Chunk); + if (Jso.rawin("error")) { + foreach(value in Slot) { + value.Item = null; + } + Msg = 0; + } else { + AniQueue.AddQuest("装备融合特效动画", function(Name, Time) { + local AniPath = "etc/rindro/itemtool/itemfusion/itemfusioneffect.ani"; + local Ani = DrawAniEx(X + 8, Y + 120, AniPath, "装备融合特效1"); + if (sq_GetAnimationFrameIndex(Ani) == 10 && !SoundFlag) { + R_Utils.PlaySound("RANK_UP"); + SoundFlag = true; + } + if (sq_GetAnimationFrameIndex(Ani) == 40) { + sq_Rewind(Ani); + AniQueue.RemoveQuest(Name); + foreach(value in Slot) { + value.Item = null; + } + Msg = 0; + SoundFlag = false; + } + }.bindenv(this)); + } + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(228, 5, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //确认按钮 + local ConfirmButton = LenheartNewUI_ButtonText(85, 250, 15, "确认融合"); + ConfirmButton.DWidth = 18; + ConfirmButton.Width = 74; + ConfirmButton.SetTextOffset(-4, 1); + ConfirmButton.OnClickEx = function(Btn) { + if (!Btn.Visible) return; + local T = { + op = 21006003, + } + SendPackEx(T); + }.bindenv(this); + ConfirmButton.SetCallBackFunc(function(Btn) { + // if (mode >= 1 && mode< 3) { + // Btn.Visible = true; + // } else { + // Btn.Visible = false; + // } + }.bindenv(this)); + AddChild(ConfirmButton); + + //创建槽 + Slot = [ItemFusionC_ItemSlot(49, 58), ItemFusionC_ItemSlot(150, 58), ItemFusionC_ItemSlot(99, 182)]; + foreach(value in Slot) { + AddChild(value); + } + Slot[2].UseFlag = false; + } + + //绘制主界面 + function DrawMain(obj) { + + //背景框 + DrawNineBox(X, Y, 244, 294, "interface/lenheartwindowcommon.img", 213); + + DrawWindowTitle(247); + //绘制标题名 + L_sq_DrawCode("装备融合", X + 100, Y + 6, sq_RGBA(230, 200, 155, 255), 0, 1); + + DrawNineBox(X + 5, Y + 27, 235, 260, "interface/lenheartwindowcommon.img", 97); + + local SlotEnableCount = 0; + for (local i = 0; i< 2; i++) { + local value = Slot[i]; + if (value.Item != null) SlotEnableCount++; + } + WindowImg.DrawPng(0 + SlotEnableCount, X + 8, Y + 30); + WindowImg.DrawPng(3, X + 8, Y + 32); + WindowImg.DrawPng(8, X + 112, Y + 70); + + if (Msg == 2 && Slot[1].Item != null && Slot[0].Item != null) { + WindowImg.DrawPng(7, X + 5, Y + 240); + L_sq_DrawCode("不是可以融合的装备!", X + 72, Y + 246, sq_RGBA(255, 255, 255, 255), 0, 1); + } + + // local Co = [ + // 0xFFFF64A0, // 起始色: (160,100,255,255) + // 0xFFEB6EAA, // 过渡色1 + // 0xFFDB78B4, // 过渡色2 + // 0xFFDB82BE, // 过渡色3 + // 0xFFAF8CC8, // 过渡色4 + // 0xFF9B96D2, // 过渡色5 + // 0xFF8BDCDC, // 过渡色6(修正格式:0xFF8BDCDC) + // 0xFF7BB4E6, // 过渡色7 + // 0xFF6FBEE0, // 过渡色8 + // 0xFF4BC8FA, // 过渡色9(修正格式:0xFF4BC8FA) + // 0xFF37D2F4, // 过渡色10 + // 0xFF00B1FF // 结束色: (255,177,0,255) + // ]; + // DrawText("测试文本", X + 30, Y + 40, Co); + } + + // function DrawText(Str, XPos, YPos, Color) { + // if (typeof Color == "array") { + // for (local i = 0; i< 12; i++) { + // local clipBottom = YPos + (13 - i); + // setClip(0, YPos - 1, getroottable().Rindro_Scr_Width, clipBottom); //开始裁切 + // L_sq_DrawCode(Str, XPos, YPos, Color[i], 0, 1); + // releaseClip(); //裁切结束 + // } + // } + // } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + AniQueue.Run(); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + + + + + //回收道具回调 + 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 info = FindItemPosByForeachInven(ItemAddress); + for (local i = 0; i< 2; i++) { + local Value = Slot[i]; + local Ret = Value.DiscardItem(info); + if (Ret) { + R_Utils.PlaySound("CHANGE_ALERT"); + if (Slot[0].Item && Slot[1].Item) { + local T = { + op = 21006001, + item1 = Slot[0].Item, + item2 = Slot[1].Item, + } + SendPackEx(T); + } + break; + } + } + } + } + + //遍历背包查找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) return { + type = z, + pos = i, + vis = false, + count = MemoryTool.DecodeMemoryData(FindAddress + 0x1A4), + itemId = L_sq_RA(FindAddress + 0x1c), + itemAddress = FindAddress + } + } + } + return null; + } +} + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("ItemFusion_Obj"); + +function Lenheart_ItemFusion_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("ItemFusion_Obj")) { + RootTab.rawset("ItemFusion_Obj", true); + LenheartNewUI_CreateWindow(ItemFusionC, "装备改造-融合装备", 100, 120, 246, 292, 24); + } +} + +getroottable()["LenheartFuncTab"].rawset("ItemFusionFuncN", Lenheart_ItemFusion_Fun); \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json index 0400abe..a33f0df 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -181,5 +181,11 @@ }, "Project/CustomizeWeapon/AncientRelic.nut": { "description": "荒古系列装备" + }, + "Project/ItemTool": { + "description": "物品改造相关" + }, + "Project/ItemTool/ItemFusion": { + "description": "融合装备" } } \ No newline at end of file