From 64a5f3f6d2b70daabe7d7ac1ed63b657251be3d3 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Tue, 4 Nov 2025 20:17:53 +0800 Subject: [PATCH] 11112 --- Base/CallBack/PackControl.nut | 2 +- Base/_Tool/Animation_Class.nut | 1 - FileConfig.json | 12 + Project/Anton/Rindro_Anton_PartyApplyJoin.nut | 6 +- Project/HudUi/HudUi.nut | 11 + Project/Luke/Rindro_Luke_PartyApplyJoin.nut | 6 +- Project/NpcTransaction/NpcTransaction.nut | 334 ++++++++++++++++++ Project/SkinHub/SkinHub.nut | 5 + folder-alias.json | 3 + 9 files changed, 372 insertions(+), 8 deletions(-) create mode 100644 Project/NpcTransaction/NpcTransaction.nut diff --git a/Base/CallBack/PackControl.nut b/Base/CallBack/PackControl.nut index 2af243d..60a2430 100644 --- a/Base/CallBack/PackControl.nut +++ b/Base/CallBack/PackControl.nut @@ -178,6 +178,6 @@ Pack_Control.rawset(20069016, LenheartAdditionalCallBack); getroottable().PluginsCompatibilityModeCallBack <- false; //兼容模式 function CompatibilityModeCallBack(Chunk) { - PluginsCompatibilityModeCallBack <- true; + getroottable().PluginsCompatibilityModeCallBack <- true; } Pack_Control.rawset(30004, CompatibilityModeCallBack); \ No newline at end of file diff --git a/Base/_Tool/Animation_Class.nut b/Base/_Tool/Animation_Class.nut index f28252d..e550033 100644 --- a/Base/_Tool/Animation_Class.nut +++ b/Base/_Tool/Animation_Class.nut @@ -504,7 +504,6 @@ class Rindro_Draw_Character { try { AniInfo.Ani.DrawIndex(X + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].x, Y + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].y, 0); } catch (exception) { - } } releaseClip(); //裁切结束 diff --git a/FileConfig.json b/FileConfig.json index c64e1e6..3eb80a7 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -131,6 +131,18 @@ "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" } }, + "宽屏UI": { + "Private": true, + "Script": [ + "Project/HudUi/HudUi.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "自用宽屏UI", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "骑士马战": { "Private": true, "price": 100, diff --git a/Project/Anton/Rindro_Anton_PartyApplyJoin.nut b/Project/Anton/Rindro_Anton_PartyApplyJoin.nut index 8e911c9..12905f0 100644 --- a/Project/Anton/Rindro_Anton_PartyApplyJoin.nut +++ b/Project/Anton/Rindro_Anton_PartyApplyJoin.nut @@ -78,9 +78,9 @@ class Rindro_AntonApplyJoinC extends LenheartNewUI_Windows { local InfoObj = RequestJoinTeamArr[NowSelectJoinIndex]; Charc = InfoObj.Charc; //角色等级 - Level = InfoObj.Level; + Level = InfoObj.Level.tostring(); //角色名称 - Name = InfoObj.Name; + Name = InfoObj.Name.tostring(); //角色职业 Job = InfoObj.Job; //角色决斗等级 @@ -92,7 +92,7 @@ class Rindro_AntonApplyJoinC extends LenheartNewUI_Windows { //角色疲劳值 Fatigue = InfoObj.Fatigue.tostring(); //战斗力 - Combat = InfoObj.Combat; + Combat = InfoObj.Combat.tostring(); //通过次数 ClearanceCount = InfoObj.ClearanceCount; //头像 diff --git a/Project/HudUi/HudUi.nut b/Project/HudUi/HudUi.nut index 87052ad..8e27c08 100644 --- a/Project/HudUi/HudUi.nut +++ b/Project/HudUi/HudUi.nut @@ -42,6 +42,17 @@ class HudUiC extends LenheartNewUI_Windows { //修补内存 function FixMemory() { + + L_sq_WAB(0x400E10, 9); + L_sq_WAB(0x400E11, 4); + L_sq_WAB(0x400E12, 7); + L_sq_WAB(0x400E13, 3); + L_sq_WAB(0x400E14, 3); + L_sq_WAB(0x400E15, 0); + L_sq_WAB(0x400E16, 6); + L_sq_WAB(0x400E17, 7); + L_sq_WAB(0x400E18, 0); + // 干掉nut初始化基础技能栏坐标 L_sq_WAB(0x4B3239, 0xEB); diff --git a/Project/Luke/Rindro_Luke_PartyApplyJoin.nut b/Project/Luke/Rindro_Luke_PartyApplyJoin.nut index cd63f03..7fba34e 100644 --- a/Project/Luke/Rindro_Luke_PartyApplyJoin.nut +++ b/Project/Luke/Rindro_Luke_PartyApplyJoin.nut @@ -78,9 +78,9 @@ class Rindro_LukeApplyJoinC extends LenheartNewUI_Windows { local InfoObj = RequestJoinTeamArr[NowSelectJoinIndex]; Charc = InfoObj.Charc; //角色等级 - Level = InfoObj.Level; + Level = InfoObj.Level.tostring(); //角色名称 - Name = InfoObj.Name; + Name = InfoObj.Name.tostring(); //角色职业 Job = InfoObj.Job; //角色决斗等级 @@ -92,7 +92,7 @@ class Rindro_LukeApplyJoinC extends LenheartNewUI_Windows { //角色疲劳值 Fatigue = InfoObj.Fatigue.tostring(); //战斗力 - Combat = InfoObj.Combat; + Combat = InfoObj.Combat.tostring(); //通过次数 ClearanceCount = InfoObj.ClearanceCount; //头像 diff --git a/Project/NpcTransaction/NpcTransaction.nut b/Project/NpcTransaction/NpcTransaction.nut new file mode 100644 index 0000000..13c847d --- /dev/null +++ b/Project/NpcTransaction/NpcTransaction.nut @@ -0,0 +1,334 @@ +/* +文件名:NpcTransaction.nut +路径:Project/NpcTransaction/NpcTransaction.nut +创建日期:2025-10-23 12:50 +文件用途:NPC交易系统 +*/ +class NpcTransactionC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + EquList = null; + NPCList = null; + Dialog = null; + CurDialog = -1; + mode = 0; + DiaTimer = 0; + + //置换装备 + ReplacementEqu = null; + //交易金币 + TransactionGlod = 0; + //交易装备 + TransactionEqu = null; + + + Img = Rindro_Image("npctransation/main.img"); + + Charc = null; + PlayerName = "无名"; + PlayerLevel = 0; + AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + + NpcName = "赛利亚"; + //当前交互NPCId + CurNpcId = -1; + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + InifPvf(); + RegNpc(); + + local obj = sq_getMyCharacter(); + local C_Object = L_sq_RA(0x1ab7cdc); + local job = sq_getJob(obj); + //记录装备 + local equiitemsbuf = []; + foreach(offset in AvatarInfoIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + equiitemsbuf.append(ExIndex == 0 ? NormalIndex : ExIndex); + } + } + Charc = Rindro_Draw_Character(job, equiitemsbuf, "rest.ani", null); + PlayerName = L_Sq_GetObjectName(obj); + PlayerLevel = L_Sq_GetObjectLevel(obj); + + DiscardItemCallBackFunc.rawset("RecoveryC", DiscardItem.bindenv(this)); + + + + Pack_Control.rawset(21005002, function(Chunk) { + local Jso = Json.Decode(Chunk); + local flag = Jso.flag; + CurDialog = flag; + mode = flag; + DiaTimer = Clock(); + if (Jso.rawin("glod")) { + TransactionGlod = Jso.glod; + } + if(Jso.rawin("equ")){ + TransactionEqu = Jso.equ; + } + }.bindenv(this)); + + Pack_Control.rawset(21005006, function(Chunk) { + ReplacementEqu = null; + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(250, 14, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + //确认按钮 + local ConfirmButton = LenheartNewUI_ButtonText(56, 313, 15, "同意交易"); + ConfirmButton.DWidth = 18; + ConfirmButton.Width = 74; + ConfirmButton.SetTextOffset(-4, 1); + ConfirmButton.OnClickEx = function(Btn) { + if (!Btn.Visible) return; + local T = { + op = 21005003, + npc = CurNpcId, + } + SendPackEx(T); + CloseWindow(); + }.bindenv(this); + ConfirmButton.SetCallBackFunc(function(Btn) { + if (mode >= 1 && mode < 3) { + Btn.Visible = true; + } else { + Btn.Visible = false; + } + }.bindenv(this)); + AddChild(ConfirmButton); + + local CancelButton = LenheartNewUI_ButtonText(145, 313, 15, "取消交易"); + CancelButton.DWidth = 18; + CancelButton.Width = 74; + CancelButton.SetTextOffset(-4, 1); + CancelButton.OnClick = function() { + CloseWindow(); + }.bindenv(this); + AddChild(CancelButton); + + } + + //绘制主界面 + function DrawMain(obj) { + Img.DrawPng(0, X, Y); + + + + + + if (Charc) Charc.DrawFace(X + 20, Y + 188); + L_sq_DrawCode("Lv." + PlayerLevel.tostring(), X + 46, Y + 185, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(PlayerName, X + 46, Y + 196, sq_RGBA(179, 169, 135, 255), 0, 1); + + L_sq_DrawImg("map/npc/npcface02.img", 5, X + 20, Y + 44); + L_sq_DrawCode("Lv.99", X + 46, Y + 41, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(NpcName, X + 46, Y + 53, sq_RGBA(179, 169, 135, 255), 0, 1); + + + //置换装备 + if (ReplacementEqu) { + L_Sq_DrawItem(X + 122, Y + 242, ReplacementEqu, 1, 0, 0, 0); + } + + //交易金币 + if (TransactionGlod > 0) { + L_sq_DrawCode(TransactionGlod.tostring(), X + 165, Y + 48, sq_RGBA(179, 169, 135, 255), 0, 1); + } + + //交易装备 + if(TransactionEqu){ + DrawItemBase(X + 122, Y + 98, TransactionEqu, 1); + } + + //对话 + if (Dialog && CurDialog != -1) { + ShowMessageBox(X + Dialog[CurDialog].x, Y + Dialog[CurDialog].y, Dialog[CurDialog].str); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + if (DiaTimer != 0 && Clock() - DiaTimer > 2000) { + DiaTimer = 0; + CurDialog = -1; + } + } + + //回收道具回调 + function DiscardItem(ItemAddress) { + if (!Visible) return true; + else { + local info = FindItemPosByForeachInven(ItemAddress); + if (!EquList.rawin(info.itemId)) { + return; + } + if (info) { + info.op <- 21005001; + info.npc <- CurNpcId; + ReplacementEqu = info.itemId; + SendPackEx(info); + } + } + } + + //遍历背包查找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) + } + } + } + return null; + } + + function InifPvf() { + EquList = {}; + Rindro_Script.GetFileData("etc/rindro/npctransaction/npctransaction.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[npc list]") { + NPCList = []; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/npc list]") { + break; + } + NPCList.append(Fbuf); + } + } else if (Fragment == "[event dialog]") { + Dialog = []; + for (local i = 0; i< 4; i++) { + local T = { + str = Sq_ConvertWideChar(Data.Get(), "big5"), + x = Data.Get(), + y = Data.Get() + } + Dialog.append(T); + } + }else if (Fragment == "[value]") { + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/value]") { + break; + } + local Value = Data.Get(); + EquList.rawset(Fbuf, Value); + } + } + } + }); + } + + function RegNpc() { + local EachManager = getroottable()["L_Each_Obj"]; + foreach(id in NPCList) { + //先清空注册 + EachManager.RemoveEachForNpc(id); + EachManager.AddEachForNpc(id, 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 = 27; + ApplyEngagementButton.Str = "交易"; + ApplyEngagementButton.Data = SThis.NPC_Index; + ApplyEngagementButton.OnClick = function(Button) { + CurNpcId = Button.Data; + TransactionEqu = null; + TransactionGlod = 0; + mode = 0; + ReplacementEqu = null; + CurDialog = -1; + InitWindow(); + //打开背包 + L_sq_Open_ExWindow(0x1ADE090, 0, 0, 1); + Button.Parent.CloseAllEach(); + Button.Parent.CloseWindow(); + ResetFocus(); + }.bindenv(this); + ApplyEngagementButton.SetCallBackFunc(function(Button) {}) + SThis.AddChild(ApplyEngagementButton); + }.bindenv(this)); + } + } + + function ShowMessageBox(X, Y, STR) { + local StrDrawLen = LenheartTextClass.GetStringLength(STR); + local WLen = ((StrDrawLen - 30) / 12) + 1; + local HLen = (StrDrawLen / 110); + + WLen = WLen > 7 ? 7 : WLen; + //Item信息框一般为211的宽度 + L_sq_DrawImg("interface/messageballoon.img", 49, X + (-50 + (WLen * 12)), Y + 11 + ((HLen + 1) * 13)); + L_sq_DrawWindow(X, Y, 30 + (WLen * 12), 21 + (HLen * 13), "interface/messageballoon.img", 40, 9, 12, 9, 13); + //绘制字符串 + local Buf = L_sq_GetStringDrawArray(STR, 123); + + foreach(Line, Str in Buf) { + L_sq_DrawCode(Str, X + 8, Y + 8 + (Line * 14), sq_RGBA(255, 255, 255, 255), 0, 1); + } + } + + function InitWindow() { + //TODO 读NPC头像 读NPC名字 + Visible = true; + } +} + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("NpcTransaction_Obj"); +getroottable().rawdelete("L_Each_Obj"); + +function Lenheart_NpcTransaction_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("NpcTransaction_Obj")) { + RootTab.rawset("NpcTransaction_Obj", true); + LenheartNewUI_CreateWindow(NpcTransactionC, "npc交易窗口", 100, 120, 272, 334, 32); + } +} + +getroottable()["LenheartFuncTab"].rawset("NpcTransactionFuncN", Lenheart_NpcTransaction_Fun); \ No newline at end of file diff --git a/Project/SkinHub/SkinHub.nut b/Project/SkinHub/SkinHub.nut index ec3121b..90eb5ed 100644 --- a/Project/SkinHub/SkinHub.nut +++ b/Project/SkinHub/SkinHub.nut @@ -566,6 +566,11 @@ class SkinHubC extends LenheartNewUI_Windows { } +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("SkinHub_Obj"); + function Lenheart_SkinHub_Fun(obj) { local RootTab = getroottable(); if (!RootTab.rawin("SkinHub_Obj")) { diff --git a/folder-alias.json b/folder-alias.json index 46c4ab2..91a7234 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -172,5 +172,8 @@ }, "Project/CumulativeReward": { "description": "累计奖励" + }, + "Project/NpcTransaction": { + "description": "npc交易" } } \ No newline at end of file