From 25d40bd78d43cb394abc79886c22f65292aa7833 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Fri, 19 Dec 2025 16:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E4=B8=96=E7=95=8CBOSS?= =?UTF-8?q?=E6=AF=81=E6=A2=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FileConfig.json | 15 + Project/WorldBoss/WorldBoss_HM.nut | 578 +++++++++++++++++++++++++++++ 2 files changed, 593 insertions(+) create mode 100644 Project/WorldBoss/WorldBoss_HM.nut diff --git a/FileConfig.json b/FileConfig.json index f099f86..eb5da07 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -290,6 +290,21 @@ }, "imgPath": "WorldBoss" }, + "世界BOSS毁梦": { + "Private": true, + "price": 100, + "Script": [ + "Project/WorldBoss/WorldBoss.nut" + ], + "info": { + "ProjectAuthor": "100", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "🔥 打破原版桎梏,重塑世界 BOSS 核心乐趣", + "ProjectDetails": [ + ] + }, + "imgPath": "WorldBoss" + }, "圣者遗物箱": { "price": 30, "Script": [ diff --git a/Project/WorldBoss/WorldBoss_HM.nut b/Project/WorldBoss/WorldBoss_HM.nut new file mode 100644 index 0000000..3ac3ce3 --- /dev/null +++ b/Project/WorldBoss/WorldBoss_HM.nut @@ -0,0 +1,578 @@ +/* +文件名:WorldBoss.nut +路径:Project/WorldBoss/WorldBoss.nut +创建日期:2025-05-01 23:54 +文件用途:世界BOSS +*/ + +class WorldBossC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + WindowImg = Rindro_Image("hud/worldboss.img"); + WindowTimeImg = Rindro_Image("hud/worldboss_time.img"); + WindowTimeNumImg = Rindro_Image("hud/worldboss_timenum.img"); + WindowLogoImg = Rindro_Image("hud/worldboss_logo.img"); + WindowInfoImg = Rindro_Image("hud/worldboss_info.img"); + + //基础信息 + BaseInfo = null; + + //Pvf信息 + PvfInfo = null; + + //伤害列表 + RankList = null; + + //标题栏 + Title = null; + //组队榜单按钮 + TeamRankBtn = null; + //个人榜单按钮 + PersonalRankBtn = null; + + + + //页面 + Page = 0; + //查询排名 + CheckType = 0; //0组队 1个人 + RankPage = 0; //当前页数 + MaxRankPage = 1; //最大页数 + + //奖励 + RewardList = null; + RewardType = 0; + RewardSubType = 0; + + //排行榜 + RankObject = null; + MyRankObject = null; + + + //计时器 + TiemrCache = null; + Timer = null; + + //累计伤害 + TotalDamage = null; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + //注册控件 + RegisterWidget(); + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + Pack_Control.rawset(20060002, function(Chunk) { + local Jso = Json.Decode(Chunk); + BaseInfo = Jso; + RegisterBossPage(); + ChangePage(0); + }.bindenv(this)); + + //获取奖励 + Pack_Control.rawset(20060012, function(Chunk) { + local Jso = Json.Decode(Chunk); + RewardList = []; + RewardList.append(Jso.rewards); + RewardList.append(Jso.rewards2); + if (Jso.rawin("rewards3")) + RewardList.append(Jso.rewards3); + }.bindenv(this)); + + Pack_Control.rawset(20060006, function(Chunk) { + local Jso = Json.Decode(Chunk); + MaxRankPage = Jso.maxPage; + RankObject = []; + foreach(Info in Jso.list) { + local T = { + idx = Info.rank, + name = Info.name, + time = Info.time, + damage = Info.damage, + teamid = Info.teamId, + }; + local Buffer = WorldBossC_Item(this, T); + RankObject.append(Buffer); + } + + //我的排名 + if (Jso.rawin("myteam")) { + MyRankObject = WorldBossC_Item(this, { + idx = Jso.myteam.rank, + name = "我的队伍", + time = Jso.myteam.time, + damage = Jso.myteam.damage, + teamid = Jso.myteam.teamId, + self = true + }) + } else { + MyRankObject = WorldBossC_Item(this, { + idx = "∞", + name = "我的队伍", + time = "0:0", + damage = "0", + teamid = 0, + self = true + }) + } + }.bindenv(this)); + + Pack_Control.rawset(20060026, function(Chunk) { + local Jso = Json.Decode(Chunk); + MaxRankPage = Jso.maxPage; + RankObject = []; + foreach(Info in Jso.list) { + local T = { + idx = Info.rank, + name = Info.name, + time = Info.time, + damage = Info.damage, + }; + local Buffer = WorldBossC_Item(this, T); + RankObject.append(Buffer); + } + if (Jso.rawin("myteam")) { + MyRankObject = WorldBossC_Item(this, { + idx = Jso.myteam.rank, + name = "我的队伍", + time = Jso.myteam.time, + damage = Jso.myteam.damage, + self = true + }) + } + }.bindenv(this)); + + Pack_Control.rawset(20060014, function(Chunk) { + local Jso = Json.Decode(Chunk); + Timer = Clock(); + TiemrCache = Jso.endTime; + }.bindenv(this)); + + PushDamageFontFuncTab.rawset("DamagePerSecondCFunc", function(ObjAddress, MySelfAddress, Value) { + if (!SendDamagePackFlag) return; + if (ObjAddress == 0 || ObjAddress == MySelfAddress) { + if (!TotalDamage) TotalDamage = longlong(0); + TotalDamage += longlong(Value); + } + }.bindenv(this)); + + // RankObject = []; + // for (local i = 0; i< 7; i++) { + // local Buffer = WorldBossC_Item(this, { + // idx = i, + // name = "倾泪寒的队伍" + i, + // time = "15:20", + // damage = Clock().tostring(), + // }); + // RankObject.append(Buffer); + // } + // MyRankObject = WorldBossC_Item(this, { + // idx = 56, + // name = "我的队伍", + // time = "15:20", + // damage = Clock().tostring(), + // self = true + // }); + } + + //请求奖励信息 + function RequestRewardInformation() { + if (Page == null) return; + local T = { + op = 20060001, + index = Page + } + SendPackEx(T); + } + + + function ChangePage(ToPage) { + Page = ToPage; + RankPage = 0; //重置页数 + CheckRank(); + RequestRewardInformation(); + } + + function CheckRank() { + local T = { + //0查组队 否则查个人 + op = (CheckType == 0 ? 20060005 : 20060025), + index = Page, + page = RankPage + } + SendPackEx(T); + } + + function RegisterBossPage() { + Title = []; + + local LogicFunc = function(Btn) { + foreach(Pos, obj in Title) { + if (obj != Btn) obj.State = 0; + else { + obj.State = 1; + ChangePage(Pos); + } + } + }; + + //遍历有多少个Boss + foreach(Pos, Info in BaseInfo.info) { + local Tabbars1 = LenheartNewUI_TabbarsText(6 + (Pos * 61), 23, Info.name); + if (Pos == 0) Tabbars1.State = 1; + Tabbars1.SetTextOffset(31 - LenheartTextClass.GetStringLength(Info.name) / 2, 4); + AddChild(Tabbars1); + Tabbars1.OnClickEx = LogicFunc.bindenv(this); + Title.append(Tabbars1); + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(738, 3, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + local RankingRewardsButton = LenheartNewUI_ButtonText(106, 472, 40, "排名奖励"); + RankingRewardsButton.SetTextOffset(6, 1); + RankingRewardsButton.OnClickEx = function(Btn) { + RewardType = 0; + }.bindenv(this); + AddChild(RankingRewardsButton); + + // local BasicRewardsButton = LenheartNewUI_ButtonText(170, 472, 40, "基础奖励"); + // BasicRewardsButton.SetTextOffset(6, 1); + // BasicRewardsButton.OnClickEx = function(Btn) { + // RewardType = 1; + // }.bindenv(this); + // AddChild(BasicRewardsButton); + + local PurchaseTicketsButton = LenheartNewUI_ButtonText(420, 478, 150, "开始挑战"); + PurchaseTicketsButton.SetTextOffset(59, 1); + PurchaseTicketsButton.OnClickEx = function(Btn) { + local T = { + op = 20060007, + index = Page + } + SendPackEx(T); + }.bindenv(this); + AddChild(PurchaseTicketsButton); + + + TeamRankBtn = LenheartNewUI_TabbarsText(305, 84, "组队榜单"); + TeamRankBtn.State = 1; + TeamRankBtn.SetTextOffset(7, 4); + TeamRankBtn.OnClickEx = function(Btn) { + if (Btn.State == 1) return; + PersonalRankBtn.State = 0; + Btn.State = 1; + CheckType = 0; + RewardSubType = 0; + CheckRank(); + }.bindenv(this); + AddChild(TeamRankBtn); + + PersonalRankBtn = LenheartNewUI_TabbarsText(366, 84, "个人榜单"); + PersonalRankBtn.SetTextOffset(7, 4); + PersonalRankBtn.OnClickEx = function(Btn) { + if (Btn.State == 1) return; + TeamRankBtn.State = 0; + Btn.State = 1; + CheckType = 1; + RewardSubType = 1; + CheckRank(); + }.bindenv(this); + AddChild(PersonalRankBtn); + + //左翻页按钮 + local LeftButton = LenheartNewUI_BaseButton(480, 416, 15, 15, "interface/lenheartwindowcommon.img", 34); + LeftButton.OnClick = function() { + if (RankPage > 0) { + RankPage--; + CheckRank(); + } + }.bindenv(this); + AddChild(LeftButton); + + //右翻页按钮 + local RightButton = LenheartNewUI_BaseButton(550, 416, 15, 15, "interface/lenheartwindowcommon.img", 38); + RightButton.OnClick = function() { + if (RankPage<(MaxRankPage - 1)) { + RankPage++; + CheckRank(); + } + }.bindenv(this); + AddChild(RightButton); + + for (local i = 0; i< 8; i++) { + local ButtonBuffer = LenheartNewUI_BaseButton(700, 139 + (i * 40), 25, 25, "interface/lenheartwindowcommon.img", 362); + ButtonBuffer.Data = i; + ButtonBuffer.OnClickEx = function(Btn) { + if (RankObject && Btn.Data< RankObject.len()) { + local T = { + op = 20060003, + index = Page, + teamId = RankObject[Btn.Data].Info.teamid + } + SendPackEx(T); + } + }.bindenv(this); + ButtonBuffer.SetCallBackFunc(function(Btn) { + if (RankObject && Btn.Data< RankObject.len() && CheckType == 0) Btn.Visible = true; + else Btn.Visible = false; + }.bindenv(this)); + Childrens.append(ButtonBuffer); + } + } + + //悬停层绘制Flag + HoverFlag = null; + + //绘制主界面 + function DrawMain(obj) { + + if (Page != null) { + WindowLogoImg.DrawExPng(Page, X + 1, Y + 19, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); + } + + WindowImg.DrawPng(0, X, Y); + + if (Page != null) { + WindowInfoImg.DrawExPng(Page, X + 19, Y + 66, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); + } + + DrawNineBox(X + 26, Y + 416, 260, 42, "interface/lenheartwindowcommon.img", 213); //背景框 + DrawNineBox(X + 308, Y + 106, 433, 26, "interface/lenheartwindowcommon.img", 213); //榜单表头 + L_sq_DrawCode("名次", X + 330, Y + 113, sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode(CheckType == 0 ? "队伍名称" : "玩家名称", X + 408, Y + 113, sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode("战斗时长", X + 510, Y + 113, sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode("总伤害", X + 604, Y + 113, sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode("详细", X + 700, Y + 113, sq_RGBA(230, 200, 155, 255), 0, 1); + + local RankPageStr = (RankPage + 1) + "/" + MaxRankPage; + L_sq_DrawCode(RankPageStr, X + 524 - LenheartTextClass.GetStringLength(RankPageStr) / 2, Y + 418, sq_RGBA(230, 200, 155, 255), 0, 1); + if (RewardList) { + local Typep = RewardType; + if (Typep == 0 && RewardSubType == 1 && RewardList.len() == 3) Typep = 2; + foreach(Pos, ItemId in RewardList[Typep]) { + DrawItemEx(X + 34 + (Pos * 36), Y + 423, ItemId, 1); + } + } + + if (RankObject) { + foreach(Pos, Object in RankObject) { + Object.Show(X + 309, Y + 132 + (Pos * 40)); + } + } + if (MyRankObject) { + MyRankObject.Show(X + 309, Y + 434); + } + } + + function TopShow(obj) { + LenheartNewUI_Windows.TopShow(obj); + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + if (RankObject) { + foreach(Pos, Object in RankObject) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 309, Y + 131 + (Pos * 39), 433, 39)) { + Object.HoverShow(X + 309, Y + 132 + (Pos * 40)); + } + } + } + + + DrawTime(obj); + } + + + function DrawTime(obj) { + if (!TiemrCache || !Timer) return; + local CountdownX = 300; + local CountdownY = 0; + local DrawX = CountdownX; + local DrawY = CountdownY; + //背景绘制 + WindowTimeImg.DrawPng(1, DrawX, DrawY); + WindowTimeImg.DrawPng(0, DrawX, DrawY + 2); + + //时间绘制 + local DrawTime = TiemrCache - (Clock() - Timer); + local TotalSeconds = DrawTime / 1000; + local Minutes = (TotalSeconds % 3600) / 60; + local Seconds = (TotalSeconds % 3600) % 60; + local Millisecond = DrawTime % 1000 / 10; + + local Offset = 43; + DrawNum(format("%02d", Minutes), Offset); + Offset += 40; + WindowTimeNumImg.DrawPng(10, DrawX + Offset - 5, DrawY + 27); + DrawNum(format("%02d", Seconds), Offset); + Offset += 40; + WindowTimeNumImg.DrawPng(10, DrawX + Offset - 5, DrawY + 27); + DrawNum(format("%02d", Millisecond), Offset); + } + + function DrawNum(time, Xoffset) { + if (!TiemrCache || !Timer) return; + local CountdownX = 300; + local CountdownY = 0; + local DrawX = CountdownX; + local DrawY = CountdownY; + for (local i = 0; i< time.len(); i++) { + local DrawNum = time.slice(i, i + 1); + WindowTimeNumImg.DrawPng(DrawNum.tointeger(), DrawX + Xoffset + (i * 15), DrawY + 21); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //进入副本初始化包Flag + EnterMapPackFlag = false; + //发送伤害包Flag + SendDamagePackFlag = false; + + //副本逻辑 + function DungeonLogic() { + local stage = sq_GetGlobaludpModuleStage(); + local mapIndex = sq_GetMapIndex(stage); + if (mapIndex == -1) { + SendDamagePackFlag = false; + EnterMapPackFlag = false; + TiemrCache = null; + Timer = null; + } + local dungeon = sq_GetDungeonByStage(stage); + local dungeonIndex = sq_GetDuegonIndex(dungeon); + if (dungeonIndex == BaseInfo.info[Page].dgn && mapIndex == BaseInfo.info[Page].map) { + if (!EnterMapPackFlag) { + EnterMapPackFlag = true; + SendPackEx({ + op = 20060013, + index = Page + }) + } + SendDamagePackFlag = true; + } else { + SendDamagePackFlag = false; + EnterMapPackFlag = false; + TiemrCache = null; + Timer = null; + } + } + + //发送伤害计时器 + SendDamageT = 0; + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + if (!BaseInfo) return; + DungeonLogic(); + DrawTime(obj); + + //在副本中需要发送伤害的时候 + if (TotalDamage) { + if (SendDamagePackFlag) { + SendDamageT += Rindro_Duration; + if (SendDamageT > 5000) { + // SendDamageT = 0; + // SendPackEx({ + // op = 20060017, + // Damage = TotalDamage.Value + // }) + // TotalDamage = null; + } + } + //结束时再发一次 + else { + SendPackEx({ + op = 20060017, + index = Page, + Damage = TotalDamage.Value + }) + // print("发送伤害: " + TotalDamage.Value) + + TotalDamage = null; + } + } + } + + + function OpenCallBack() { + Visible = true; + } +} + + +function Lenheart_WorldBoss_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("WorldBoss_Obj")) { + RootTab.rawset("WorldBoss_Obj", true); + local Win = LenheartNewUI_CreateWindow(WorldBossC, "阿拉德守卫战窗口", ((getroottable().Rindro_Scr_Width - 753) / 2).tointeger(), 40, 753, 518, 20); + EventList_Obj.AddEvent("阿拉德守卫战", 1001, Win); + } +} + +getroottable()["LenheartFuncTab"].rawset("WorldBossFuncN", Lenheart_WorldBoss_Fun); + + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("WorldBoss_Obj"); + +class WorldBossC_Item { + //Img + Img = null; + //父对象 + Parent = null; + //信息 + Info = null; + + constructor(Window, Info) { + Parent = Window; + Img = Window.WindowImg; + this.Info = Info; + } + + function Show(X, Y) { + if (!Info.rawin("self")) Img.DrawPng(1, X, Y); + else Parent.DrawNineBox(X + 0, Y + 2, 432, 35, "interface/lenheartwindowcommon.img", 204); + + local IdxStr = Info.idx.tostring(); + L_sq_DrawCode(IdxStr, X + 32 - LenheartTextClass.GetStringLength(IdxStr) / 2, Y + 10, sq_RGBA(230, 200, 155, 255), 2, 1); + + + L_sq_DrawCode(Info.name, X + 125 - LenheartTextClass.GetStringLength(Info.name) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + + L_sq_DrawCode(Info.time.tostring(), X + 230 - LenheartTextClass.GetStringLength(Info.time.tostring()) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + + L_sq_DrawCode(Info.damage, X + 313 - LenheartTextClass.GetStringLength(Info.damage) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + } + + + function HoverShow(X, Y) { + Img.DrawPng(2, X, Y); + } +} + + + + + +// L_sq_GoDungeon(20501); \ No newline at end of file