From e8f9aa171bd82d77f5ed532943a225f4972b72c9 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Mon, 2 Feb 2026 13:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=B5=E9=AD=82=E6=95=91=E8=B5=8E=E6=AD=A6?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/SoulSalvation/SoulSalvation.nut | 263 ++++++++++++++++ .../SoulSalvation/SoulSalvation_Enchant.nut | 225 ++++++++++++++ .../SoulSalvation/SoulSalvation_Upgrade.nut | 290 ++++++++++++++++++ 3 files changed, 778 insertions(+) create mode 100644 Project/SoulSalvation/SoulSalvation.nut create mode 100644 Project/SoulSalvation/SoulSalvation_Enchant.nut create mode 100644 Project/SoulSalvation/SoulSalvation_Upgrade.nut diff --git a/Project/SoulSalvation/SoulSalvation.nut b/Project/SoulSalvation/SoulSalvation.nut new file mode 100644 index 0000000..e1a9416 --- /dev/null +++ b/Project/SoulSalvation/SoulSalvation.nut @@ -0,0 +1,263 @@ +/* +文件名:SoulSalvation.nut +路径:Project/SoulSalvation/SoulSalvation.nut +创建日期:2026-01-20 03:00 +文件用途:灵魂救赎武器 +*/ +class SoulSalvationC extends Rindro_BaseToolClass { + + //灵魂救赎武器标识 (阶段1) + Equipment1List = null; + //1阶段所需灵魂数量 + Stage1SoulCount = 1000; + //灵魂救赎武器标识 (阶段2) + Equipment2List = null; + //灵魂救赎武器标识 (阶段3) + Equipment3List = null; + //三阶段灵魂石对应APC + Equipment3SoulStone = null; + + Img = Rindro_Image("soulweapon/main.img"); + + //灵魂数据 + EquipData = null; + //APC数据 + ApcInfo = null; + + constructor() { + Equipment1List = {}; + Equipment2List = {}; + Equipment3List = {}; + Equipment3SoulStone = {}; + EquipData = {}; + ApcInfo = {}; + InifPvf(); + + local ItemDrawControl = getroottable()["NewItemInfoWindow_Obj"]; + + ItemDrawControl.AddDelegate("灵魂救赎武器代理一阶段", 28, Delegate1.bindenv(this), + function(Item) { + return Equipment1List.rawin(Item.GetIndex()); + }.bindenv(this)); + ItemDrawControl.AddDelegate("灵魂救赎武器代理二阶段", 42, Delegate2.bindenv(this), + function(Item) { + return Equipment2List.rawin(Item.GetIndex()); + }.bindenv(this)); + ItemDrawControl.AddDelegate("灵魂救赎武器代理三阶段", 42, Delegate3.bindenv(this), + function(Item) { + return Equipment3List.rawin(Item.GetIndex()); + }.bindenv(this)); + + foreach(Id, _f in Equipment3SoulStone) { + ItemDrawControl.AddHookItemId(Id); + } + ItemDrawControl.AddDelegate("灵魂救赎灵魂石代理", 160, Delegate4.bindenv(this), + function(Item) { + return Equipment3SoulStone.rawin(Item.GetIndex()); + }.bindenv(this)); + + //上线获取全身灵魂武器灵魂数 + Pack_Control.rawset(21011002, function(Chunk) { + local Jso = Json.Decode(Chunk); + EquipData = Jso.Info; + }.bindenv(this)); + + //多个灵魂武器的补充信息包 + Pack_Control.rawset(21011006, function(Chunk) { + local Jso = Json.Decode(Chunk); + foreach(index, value in Jso.Info) { + EquipData[index.tostring()] <- value; + } + }.bindenv(this)); + + //单个灵魂武器的刷新信息 + Pack_Control.rawset(21011004, function(Chunk) { + local Jso = Json.Decode(Chunk); + EquipData[Jso.uuid.tostring()] <- Jso.info; + }.bindenv(this)); + + SendPackEx({ + op = 21011001 + }) + + + + //创建灵魂武器升级窗口 + LenheartNewUI_CreateWindow(SoulSalvation_UpgradeC, "灵魂武器升级窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 160, 292, 290, 28); + LenheartNewUI_CreateWindow(SoulSalvation_EnchantC, "灵魂武器附灵窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 160, 292, 290, 28); + } + + //1阶段的代理 + function Delegate1(X, Y, Item) { + L_sq_DrawCode("灵魂救赎阶段: 1 / 3", X + 6, Y + 15, sq_RGBA(255, 0, 240, 255), 0, 1); + L_sq_DrawCode("封印灵魂数: ", X + 6, Y + 30, sq_RGBA(104, 213, 237, 255), 0, 1); + local Uuid = Item.GetUuid().tostring(); + //获取封印灵魂数 + local Count = 0; + if (EquipData.rawin(Uuid)) { + Count = EquipData[Uuid].soul_count; + } + local Rate = Count.tofloat() / Stage1SoulCount.tofloat(); + L_sq_DrawCode(format("%.1f%%", Rate * 100.0), X + 180, Y + 30, sq_RGBA(255, 119, 0, 255), 0, 1); + Img.DrawPng(0, X + 70, Y + 34); + setClip(X + 72, Y + 36, X + 72 + (Rate * 97.0).tointeger(), Y + 40); //开始裁切 + Img.DrawPng(1, X + 72, Y + 36); + releaseClip(); //裁切结束 + } + + //2阶段的代理 + function Delegate2(X, Y, Item) { + L_sq_DrawCode("灵魂救赎阶段: 2 / 3", X + 6, Y + 15, 0xFF0055FF, 0, 1); + L_sq_DrawCode("佩戴释魂通关镇魂曲地区副本", X + 6, Y + 30, 0xFF0055FF, 0, 1); + L_sq_DrawCode("即可救赎沉沦无尽永恒的灵魂!", X + 6, Y + 45, 0xFF0055FF, 0, 1); + } + + //3阶段的代理 + function Delegate3(X, Y, Item) { + L_sq_DrawCode("灵魂救赎阶段: 3 / 3", X + 6, Y + 15, 0xFF0055FF, 0, 1); + L_sq_DrawCode("已附灵的不朽灵魂:", X + 6, Y + 30, 0xFF0055FF, 0, 1); + local Uuid = Item.GetUuid().tostring(); + local APCId = 0; + if (EquipData.rawin(Uuid)) { + APCId = EquipData[Uuid].soul_id; + } + if (APCId == 0) { + L_sq_DrawCode("未定名", X + 6, Y + 45, 0xFF0055FF, 0, 1); + } else { + local ApcName = GetApcInfo(APCId).Name; + L_sq_DrawCode("Lv.85 " + ApcName, X + 6, Y + 45, 0xFF0055FF, 0, 1); + } + } + + //灵魂石的代理 + function Delegate4(X, Y, Item) { + local ApcId = 0; + if (Equipment3SoulStone.rawin(Item.GetIndex())) { + ApcId = Equipment3SoulStone[Item.GetIndex()]; + } + if (ApcId > 0) { + local Info = GetApcInfo(ApcId); + if (!Info.rawin("Ani")) { + Info.Ani <- Rindro_Draw_Character(Info.Job, Info.Equ, "rest.ani", null); + } + L_sq_DrawCode("不朽的灵魂: " + Info.Name, X + 6, Y + 15, 0xFF0055FF, 0, 1); + Info.Ani.Draw(X + 102, Y + 160); + } + } + + //读取配置 + function InifPvf() { + Rindro_Script.GetFileData("etc/rindro/expandequipment/soulsalvation.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[EQUIPMENT1]") { + Equipment1List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT1]") { + break; + } + Equipment1List.rawset(Fbuf, true); + } + } else if (Fragment == "[EQUIPMENT2]") { + Equipment2List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT2]") { + break; + } + Equipment2List.rawset(Fbuf, true); + } + } else if (Fragment == "[EQUIPMENT3]") { + Equipment3List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT3]") { + break; + } + Equipment3List.rawset(Fbuf, true); + } + } else if (Fragment == "[STAGE1 VALUE]") { + Stage1SoulCount = Data.Get(); + } else if (Fragment == "[STAGE2 SOULSTONE]") { + Equipment3SoulStone = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/STAGE2 SOULSTONE]") { + break; + } + Equipment3SoulStone.rawset(Fbuf, Data.Get()); + } + } + } + }); + } + + //读取APC名字 + function GetApcInfo(ApcIndex) { + if (ApcInfo.rawin(ApcIndex)) return ApcInfo[ApcIndex]; + local Path = "aicharacter/" + R_Utils.GetApcPath(ApcIndex); + local Info = Rindro_Script.GetFileData(Path, function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[minimum info]") { + DataTable.Name <- Sq_ConvertWideChar(Data.Get(), "big5"); + DataTable.Job <- Data.Get(); + } else if (Fragment == "[equipment]") { + DataTable.Equ <- []; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/equipment]") { + break; + } + Data.Get(); + Data.Get(); + DataTable.Equ.append(Fbuf); + } + } + } + }); + ApcInfo.rawset(ApcIndex, Info); + return Info; + } +} + + +function Lenheart_SoulSalvation_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("SoulSalvation_Obj")) { + RootTab.rawset("SoulSalvation_Obj", SoulSalvationC()); + } + + if (KeyPressNB.isKeyPress(OPTION_HOTKEY_PAUSE_IN_TOWER, "asdasd")) { + local os = sq_CreateAICharacter(21435); + // foreach(member, val in os.getclass()) { + // ::print(member + "\n"); + // local attr; + // if ((attr = os.getclass().getattributes(member)) != null) { + // foreach(i, v in attr) { + // // ::print("\t" + i + " = " + (typeof v) + "\n"); + // } + // } else { + // // ::print("\t\n") + // } + // } + + // local os = sq_CreateAICharacter(21435); + os.setCurrentPos(obj.getXPos() + 100, obj.getYPos(), 600); + os.setMaster(obj); + os.setMapFollowParent(obj); + os.setMapFollowType(1); + // sq_SetKeyxEnable(obj, E_ATTACK_COMMAND, true); + sq_AddObject(obj, os, OBJECTTYPE_CHARACTER, false); + } +} + +getroottable()["LenheartFuncTab"].rawset("SoulSalvationFuncN", Lenheart_SoulSalvation_Fun); + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("SoulSalvation_Obj"); +getroottable().rawdelete("L_Each_Obj"); \ No newline at end of file diff --git a/Project/SoulSalvation/SoulSalvation_Enchant.nut b/Project/SoulSalvation/SoulSalvation_Enchant.nut new file mode 100644 index 0000000..f7b64c7 --- /dev/null +++ b/Project/SoulSalvation/SoulSalvation_Enchant.nut @@ -0,0 +1,225 @@ +/* +文件名:SoulSalvation_Enchant.nut +路径:Project/SoulSalvation/SoulSalvation_Enchant.nut +创建日期:2026-01-26 02:56 +文件用途: +*/ +class SoulSalvation_EnchantC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + Img = Rindro_Image("interface2/ui/newitemtool/soulweapon.img"); + + //装备 + Item = null; + //装备槽位 + ItemSlot = null; + //灵魂槽位 + ItemSlot2 = null; + //注册的NPC列表 + NPC = null; + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + InifPvf(); + RegNpc(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + DiscardItemCallBackFunc.rawset("SoulSalvation_EnchantC", DiscardItem.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(274, 4, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //确认按钮 + local CrossoverButton = LenheartNewUI_ButtonText(109, 260, 15, "确认升级"); + CrossoverButton.DWidth = 18; + CrossoverButton.Width = 74; + CrossoverButton.SetTextOffset(-4, 1); + CrossoverButton.OnClickEx = function(Btn) { + if (!Btn.Visible) return; + SendPackEx({ + op = 21011009, + item = Item + }); + }.bindenv(this); + CrossoverButton.SetCallBackFunc(function(Btn) { + if (ItemSlot.ItemObject && ItemSlot2.ItemObject) { + Btn.State = 0; + } else { + Btn.State = 8; + } + }.bindenv(this)); + AddChild(CrossoverButton); + + ItemSlot = LenheartNewUI_ItemSlot(66, 97); + ItemSlot.SetRemoveCallBack(function(obj) { + Item = null; + }.bindenv(this)); + AddChild(ItemSlot); + + ItemSlot2 = LenheartNewUI_ItemSlot(197, 97); + ItemSlot2.SetRemoveCallBack(function(obj) { + Item = null; + }.bindenv(this)); + AddChild(ItemSlot2); + } + + //绘制主界面 + function DrawMain(obj) { + //背景框 + DrawNineBox(X, Y, 292, 292, "interface/lenheartwindowcommon.img", 213); + //标题 + DrawWindowTitle(293); + //绘制标题名 + L_sq_DrawCode("灵魂武器附灵", X + 110, Y + 5, sq_RGBA(230, 200, 155, 255), 0, 1); + + Img.DrawPng(1, X + 8, Y + 32); + Img.DrawPng(3, X + 8, Y + 32); + + for (local i = 0; i< 5; i++) { + Img.DrawPng(2, X + 31 + 51 * i, Y + 195); + continue; + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + 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; + local SlotPos = 0; + + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, ItemSlot.X, ItemSlot.Y, ItemSlot.Width, ItemSlot.Height)) { + SlotPos = 1; + } else if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, ItemSlot2.X, ItemSlot2.Y, ItemSlot2.Width, ItemSlot2.Height)) { + SlotPos = 2; + } else { + return null; + } + if (!Visible) return true; + else { + Item = FindItemPosByForeachInven(ItemAddress, SlotPos); + if (Item) { + local ItemObject = Rindro_Item(); + ItemObject.LoadByAddress(Item.ItemAddress); + if (SlotPos == 1) + ItemSlot.SetItem(ItemObject); + else if (SlotPos == 2) + ItemSlot2.SetItem(ItemObject); + } + } + } + + //遍历背包查找Item + function FindItemPosByForeachInven(FindAddress, SlotPos) { + local Inven = L_sq_RA(0x1A5FB24); + local InvenAdd = L_sq_RA(Inven + 56); + InvenAdd += 36; + //0是装备 2是任务材料 + local z = 0; + if (SlotPos == 2) z = 2; + for (local i = 0; i< 56; i++) { + local ItemAdd = L_sq_RA(InvenAdd + ((i + (z * 56)) * 4)); + if (ItemAdd == FindAddress) { + local NamePointer = L_sq_RA(FindAddress + 0x20); + local rRarity = L_sq_RA(FindAddress + 0xF4); + local rItemId = L_sq_RA(FindAddress + 0x1c); + if (SlotPos == 1) { + if (!getroottable().SoulSalvation_Obj.Equipment2List.rawin(rItemId)) return null; + } else if (SlotPos == 2) { + if (rItemId< 92208 || rItemId > 92214) return null; + } + return { + Type = z, + Pos = i, + Vis = false, + Count = MemoryTool.DecodeMemoryData(FindAddress + 0x1A4), + ItemId = rItemId, + ItemAddress = FindAddress, + Name = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString(), + Rarity = rRarity, + }; + } + } + return null; + } + + + function RegNpc() { + local EachManager = Lenheart_Get_EachObj(); + EachManager.AddEachForNpc(NPC, function(SThis) { + //关闭按钮 + local ApplyEngagementButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3); + ApplyEngagementButton.Icon = "interface2/popup_menu/popup_icon_cn.img"; + ApplyEngagementButton.IconIdx = 53; + ApplyEngagementButton.Str = "释魂附灵"; + ApplyEngagementButton.Data = SThis.NPC_Index; + ApplyEngagementButton.OnClick = function(Button) { + + InitWindow(); + //打开背包 + L_sq_Open_ExWindow(0x1ADE090, 0, 0, 1); + Button.Parent.CloseAllEach(); + Button.Parent.CloseWindow(); + ResetFocus(); + R_Utils.PlaySound("WINDOW_SHOW"); + }.bindenv(this); + ApplyEngagementButton.SetCallBackFunc(function(Button) {}) + SThis.AddChild(ApplyEngagementButton); + }.bindenv(this)); + } + + //读取配置 + function InifPvf() { + Rindro_Script.GetFileData("etc/rindro/expandequipment/soulsalvation.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[STAGE2 NPC]") { + NPC = Data.Get(); + } + } + }); + } + + function InitWindow() { + Visible = true; + //清空 + Item = null; + ItemSlot.RemoveItem(); + ItemSlot2.RemoveItem(); + } +} + + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("SoulSalvation_Obj"); +getroottable().rawdelete("L_Each_Obj"); \ No newline at end of file diff --git a/Project/SoulSalvation/SoulSalvation_Upgrade.nut b/Project/SoulSalvation/SoulSalvation_Upgrade.nut new file mode 100644 index 0000000..facb10e --- /dev/null +++ b/Project/SoulSalvation/SoulSalvation_Upgrade.nut @@ -0,0 +1,290 @@ +/* +文件名:SoulSalvation_Upgrade.nut +路径:Project/SoulSalvation/SoulSalvation_Upgrade.nut +创建日期:2026-01-23 10:46 +文件用途: +*/ +class SoulSalvation_UpgradeC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + Img = Rindro_Image("interface2/ui/newitemtool/soulweapon.img"); + + //装备 + Item = null; + //装备槽位 + ItemSlot = null; + //注册的NPC列表 + NPC = null; + //所需的基础材料 + BasicMaterials = null; + //等级倍率 + LevelRate = null; + //品级倍率 + RarityRate = null; + + //错误 + Error = null; + + //错误信息 + ErrorMsg = null; + //所需材料信息 + MaterialInfo = null; + //所需材料是否足够 + MaterialIsEnough = false; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + InifPvf(); + RegNpc(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + DiscardItemCallBackFunc.rawset("SoulSalvation_UpgradeC", DiscardItem.bindenv(this)); + + //检查材料 + Pack_Control.rawset(21011008, function(Chunk) { + local Jso = Json.Decode(Chunk); + if (Jso.rawin("error")) { + ErrorMsg = Jso.error; + } + if (Jso.rawin("MgInfo")) { + MaterialInfo = Jso.MgInfo; + //材料是否充足 + MaterialIsEnough = true; + foreach(Info in MaterialInfo) { + if (Info.NeedCount > Info.RealCount) { + MaterialIsEnough = false; + break; + } + } + } + }.bindenv(this)); + + //成功回包 + Pack_Control.rawset(21011010, function(Chunk) { + //清空 + Item = null; + ItemSlot.RemoveItem(); + ErrorMsg = null; + MaterialInfo = null; + MaterialIsEnough = false; + // R_Utils.PlaySound("CHNUTTREE_BOX"); + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(274, 4, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //确认按钮 + local CrossoverButton = LenheartNewUI_ButtonText(109, 260, 15, "确认升级"); + CrossoverButton.DWidth = 18; + CrossoverButton.Width = 74; + CrossoverButton.SetTextOffset(-4, 1); + CrossoverButton.OnClickEx = function(Btn) { + if (!Btn.Visible) return; + SendPackEx({ + op = 21011009, + item = Item + }); + }.bindenv(this); + CrossoverButton.SetCallBackFunc(function(Btn) { + if (ErrorMsg || !MaterialIsEnough) { + Btn.State = 8; + } else { + Btn.State = 0; + } + }.bindenv(this)); + AddChild(CrossoverButton); + + ItemSlot = LenheartNewUI_ItemSlot(132, 100); + ItemSlot.SetRemoveCallBack(function(obj) { + Item = null; + }.bindenv(this)); + AddChild(ItemSlot); + } + + //绘制主界面 + function DrawMain(obj) { + //背景框 + DrawNineBox(X, Y, 292, 292, "interface/lenheartwindowcommon.img", 213); + //标题 + DrawWindowTitle(293); + //绘制标题名 + L_sq_DrawCode("灵魂武器进阶", X + 110, Y + 5, sq_RGBA(230, 200, 155, 255), 0, 1); + + Img.DrawPng(1, X + 8, Y + 32); + Img.DrawPng(0, X + 8, Y + 32); + + //绘制进阶所需材料及数量信息 + if (MaterialInfo) { + for (local i = 0; i< 5; i++) { + if (i >= MaterialInfo.len()) { + Img.DrawPng(2, X + 31 + 51 * i, Y + 195); + continue; + } + local Info = MaterialInfo[i]; + DrawItemBase(X + 31 + 51 * i, Y + 195, Info.Item, Info.NeedCount); + //数量不足绘制遮盖图 + if (Info.NeedCount > Info.RealCount) { + Rindro_Image_GlobalMap["lenheartui"].DrawExPng(257, X + 32 + 51 * i, Y + 196, 0, sq_RGBA(255, 255, 255, 120), 1.0, 1.0); + } + + local RealCountStr = Info.RealCount.tostring(); + local Color = Info.RealCount >= Info.NeedCount ? sq_RGBA(52, 255, 50, 255) : sq_RGBA(255, 60, 47, 255); + L_sq_DrawCode(RealCountStr, X + 46 + (51 * i) - LenheartTextClass.GetStringLength(RealCountStr) / 2, Y + 232, Color, 0, 1); + } + + if (!MaterialIsEnough) { + local str = "进阶材料不足!"; + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, sq_RGBA(255, 60, 48, 255), 0, 1); + } else { + local str = Item.Name; + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, GetRarityColor(Item.Rarity), 0, 1); + } + return; + } + + if (ErrorMsg) { + local ErrorStr = null; + if (ErrorMsg == 2) ErrorStr = "所需灵魂不足!"; + else if (ErrorMsg == 1) ErrorStr = "装备不可进阶!" + L_sq_DrawCode(ErrorStr, X + 148 - LenheartTextClass.GetStringLength(ErrorStr) / 2, Y + 142, sq_RGBA(255, 60, 48, 255), 0, 1); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + 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 { + Item = FindItemPosByForeachInven(ItemAddress); + if (Item) { + local ItemObject = Rindro_Item(); + ItemObject.LoadByAddress(Item.ItemAddress); + ItemSlot.SetItem(ItemObject); + SendPackEx({ + op = 21011007, + item = Item + }); + } + } + } + + //遍历背包查找Item + function FindItemPosByForeachInven(FindAddress) { + local Inven = L_sq_RA(0x1A5FB24); + local InvenAdd = L_sq_RA(Inven + 56); + InvenAdd += 36; + for (local z = 0; z< 1; 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; + } + local rRarity = L_sq_RA(FindAddress + 0xF4); + 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 = rRarity, + }; + } + } + } + return null; + } + + + function RegNpc() { + local EachManager = Lenheart_Get_EachObj(); + EachManager.AddEachForNpc(NPC, function(SThis) { + //关闭按钮 + local ApplyEngagementButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3); + ApplyEngagementButton.Icon = "interface2/popup_menu/popup_icon_cn.img"; + ApplyEngagementButton.IconIdx = 53; + ApplyEngagementButton.Str = "镇魂进阶"; + ApplyEngagementButton.Data = SThis.NPC_Index; + ApplyEngagementButton.OnClick = function(Button) { + + InitWindow(); + //打开背包 + L_sq_Open_ExWindow(0x1ADE090, 0, 0, 1); + Button.Parent.CloseAllEach(); + Button.Parent.CloseWindow(); + ResetFocus(); + R_Utils.PlaySound("WINDOW_SHOW"); + }.bindenv(this); + ApplyEngagementButton.SetCallBackFunc(function(Button) {}) + SThis.AddChild(ApplyEngagementButton); + }.bindenv(this)); + } + + //读取配置 + function InifPvf() { + Rindro_Script.GetFileData("etc/rindro/expandequipment/soulsalvation.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[STAGE1 NPC]") { + NPC = Data.Get(); + } + } + }); + } + + function InitWindow() { + Visible = true; + //清空 + Item = null; + ItemSlot.RemoveItem(); + ErrorMsg = null; + MaterialInfo = null; + MaterialIsEnough = false; + } +} + + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("SoulSalvation_Obj"); +getroottable().rawdelete("L_Each_Obj"); \ No newline at end of file