diff --git a/Base/CallBack/DrawMain.nut b/Base/CallBack/DrawMain.nut index cb2ab81..fd84599 100644 --- a/Base/CallBack/DrawMain.nut +++ b/Base/CallBack/DrawMain.nut @@ -62,18 +62,41 @@ function L_drawMainCustomUI_All() { getroottable().LenheartPluginsInitFlag <- true; } + // for (local i = 0; i< 100; i++) { + // for (local z = 0; z < 100; z++) { + // sq_PutPixel(sq_RGBA(230, 200, 155, 255), 200 + i, 200 + z); + // } + // } + // sq_DrawBox(100, 100, 100, 100, 0xffffffff); + + + // L_Sq_CallFunc(0x11E86C0, "char", FFI_STDCALL, ["int", "int", "int", "int", "int"], 10, 10, 750, 350, 0xffffffff); + + // for (local i = 0; i< 100; i++) { + // for (local z = 0; z< 100; z++) { + // sq_PutPixel(sq_RGBA(230, 200, 155, 255), 200 + i, 200 + z); + // } + // } + + // L_sq_Test(0x11A7B65); + // local Device = NativePointer(0x1B45AB8).readInt(); + // print(format("Device:0x%02x", Device)); + // L_sq_Test(Device); // if (!TTTAAA) TTTAAA = Rindro_Draw_Character(0, [601590000, 1751501, 601500069], "rest.ani", null); // if (TTTAAA) TTTAAA.Draw(120, 200); } + + + // for (local i = 0; i < 42; i++) { // local Value = MemoryTool.DecodeMemoryData(0x394e8c00+0x1050 + (i * 4)); // if(Value == 151)print("Value :" + i * 4); // } // print(MemoryTool.DecodeMemoryData(0x1DFFB240)); - // MemoryTool.EncodeMemoryData(0x304bdc00+0x1054,7); +// MemoryTool.EncodeMemoryData(0x304bdc00+0x1054,7); // TTTAAA <- null; // L_NewWindows("Lenheart", 56, 0x1); @@ -121,46 +144,46 @@ function L_drawMainCustomUI_All() { // L_sq_GoDungeon(1504); -CargoType <- 0; -Sq_GetExeStr_Map[21910] <- function(Index) { - CargoType = 0; - return 21910; -} -Sq_GetExeStr_Map[21911] <- function(Index) { - CargoType = 1; - return 21911; -} -Rindro_Haker.LoadHook(0xE67800, ["int", "int"], - function(args) { - //点击了仓库转移物品 - if (args[0] == 0x2B) { - if (CargoType == 0) { - printf("点击个人仓库转移物品"); - local T = { - op = 21091001, - type = 0, - } - Rindro_BaseToolClass.SendPackEx(T); - return [0]; - } - if (CargoType == 1) { - printf("点击账号仓库转移物品"); - local T = { - op = 21091001, - type = 1, - } - Rindro_BaseToolClass.SendPackEx(T); - return [0]; - } - } - return null; - }, - function(args) { - // print(666); - // print(format("%02x", args.pop())); - // TTTAni <- args.pop(); - return null; - }); +// CargoType <- 0; +// Sq_GetExeStr_Map[21910] <- function(Index) { +// CargoType = 0; +// return 21910; +// } +// Sq_GetExeStr_Map[21911] <- function(Index) { +// CargoType = 1; +// return 21911; +// } +// Rindro_Haker.LoadHook(0xE67800, ["int", "int"], +// function(args) { +// //点击了仓库转移物品 +// if (args[0] == 0x2B) { +// if (CargoType == 0) { +// printf("点击个人仓库转移物品"); +// local T = { +// op = 21091001, +// type = 0, +// } +// Rindro_BaseToolClass.SendPackEx(T); +// return [0]; +// } +// if (CargoType == 1) { +// printf("点击账号仓库转移物品"); +// local T = { +// op = 21091001, +// type = 1, +// } +// Rindro_BaseToolClass.SendPackEx(T); +// return [0]; +// } +// } +// return null; +// }, +// function(args) { +// // print(666); +// // print(format("%02x", args.pop())); +// // TTTAni <- args.pop(); +// return null; +// }); diff --git a/Base/UI/Lenheart_Event_Class.nut b/Base/UI/Lenheart_Event_Class.nut index c9fb29a..9aed30d 100644 --- a/Base/UI/Lenheart_Event_Class.nut +++ b/Base/UI/Lenheart_Event_Class.nut @@ -105,7 +105,6 @@ class Rindro_Event extends LenheartNewUI_Windows { //根据模式调整透明度 if (!BlinkMode) Alpha = sq_GetUniformVelocity(250, 130, RT, 500); else Alpha = sq_GetUniformVelocity(130, 250, RT, 500); - //转换模式 if (RT >= 500) { Timer = Clock(); @@ -172,6 +171,7 @@ class Rindro_EventList { X = Jso.YosinEventIconInfoXpos; Y = Jso.YosinEventIconInfoYpos; + getroottable()["LenheartEventOffset"] <- { x = X - 456, y = Y diff --git a/Base/UI/Lenheart_UI_Class.nut b/Base/UI/Lenheart_UI_Class.nut index c5a2d2f..fac5ab1 100644 --- a/Base/UI/Lenheart_UI_Class.nut +++ b/Base/UI/Lenheart_UI_Class.nut @@ -192,6 +192,9 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { Duration = 0.0; DurationFlag = 0.0; + //是否是焦点 + IsFocus = false; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { ObjectId = gObjectId; //宽度 @@ -211,6 +214,7 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { //调用原生方法 LenheartNewUI_BaseWindow.constructor(); } + //切换到最上层窗口 即得到焦点时 function ResetFocus() { @@ -218,9 +222,17 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { foreach(Index, WindowObj in L_Windows_List) { if (WindowObj.ObjectId == this.ObjectId) L_Windows_List.remove(Index); } + 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{ + L_Windows_List[i].IsFocus = false; + } + } L_Windows_List.append(this); //切换上层显示 getroottable().WindowsShowABFlag <- true; + IsFocus = true; } /* @@ -329,7 +341,17 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { } } - + //绘制标题 + function DrawWindowTitle(Width) { + //绘制标题 + 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); + L_sq_ReleaseDrawImgModel(); + } + } + //生成DT function GenerateDt() { try { @@ -981,6 +1003,7 @@ class LenheartNewUI_BaseInput extends LenheartNewUI_CommonUi { sliceCode = "|"; BaseTime = 0; InputController = null; + CallBack = null; constructor(X, Y, W, H) { this.DWidth = W; @@ -1015,8 +1038,11 @@ class LenheartNewUI_BaseInput extends LenheartNewUI_CommonUi { if (InputController) { local StrBuf = L_sq_GetInputBoxStr(InputController); - if (StrBuf != "LenheartNULL") str = StrBuf; - else { + if (StrBuf != "LenheartNULL") { + local oldStr = str; + str = StrBuf; + if (CallBack) CallBack(this, oldStr); + } else { InputController = null; InputState = 0; } diff --git a/Base/_Tool/Animation_Class.nut b/Base/_Tool/Animation_Class.nut index 80cf16c..d8e0e98 100644 --- a/Base/_Tool/Animation_Class.nut +++ b/Base/_Tool/Animation_Class.nut @@ -379,17 +379,21 @@ class Rindro_Draw_Character { //光环单独处理 其他的在下面处理 if (Equ.equipment_type == "aurora avatar") { foreach(Path in Equ.Aurora.Back) { - local AniBuf = Rindro_Animation(Path); + // local AniBuf = Rindro_Animation(Path); AniList.append({ - Ani = AniBuf, + Ani = Path, + AniName = Path + Clock(), Layer = -10000, + DrawType = "Native" }); } foreach(Path in Equ.Aurora.Front) { - local AniBuf = Rindro_Animation(Path); + // local AniBuf = Rindro_Animation(Path); AniList.append({ - Ani = AniBuf, + Ani = Path, + AniName = Path + Clock(), Layer = 10000, + DrawType = "Native" }); } } @@ -476,8 +480,13 @@ class Rindro_Draw_Character { function Draw(X, Y) { foreach(AniInfo in DrawInfo) { // print(AniInfo.Layer); - if (!HideMap.rawin(AniInfo.Layer)) - AniInfo.Ani.Draw(X, Y); + if (!HideMap.rawin(AniInfo.Layer)) { + if (!AniInfo.rawin("DrawType") || AniInfo["DrawType"] != "Native") { + AniInfo.Ani.Draw(X, Y); + } else { + Rindro_BaseToolClass.DrawAniEx(X, Y, AniInfo.Ani, AniInfo.AniName); + } + } } if (Name) { diff --git a/Base/_Tool/BaseTool_Class.nut b/Base/_Tool/BaseTool_Class.nut index 626d87a..5466d7e 100644 --- a/Base/_Tool/BaseTool_Class.nut +++ b/Base/_Tool/BaseTool_Class.nut @@ -114,6 +114,15 @@ class KeyPressNB { //基础工具类 class Rindro_BaseToolClass { + function IsNumber(value) { + try { + local Buffer = value.tointeger(); + return true; + } catch (exception) { + return false; + } + } + function GetItemNameById(ItemId) { local ItemObject = L_sq_GetItem(ItemId); local NamePointer = L_sq_RA(ItemObject + 0x20); @@ -198,6 +207,42 @@ class Rindro_BaseToolClass { return null; } + function DrawTriptych(X, Y, Width, Img, StartIndex) { + //如果没有载入img就载入 + if (!Rindro_Image_GlobalMap.rawin(Img)) { + Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img); + } + Rindro_Image_GlobalMap[Img].DrawPng(StartIndex, X, Y); + //获取第一张图片的宽 + local FirstW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetWidth(); + //获取中间的图片宽 + local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 1).GetWidth(); + //获得最后一张图片的宽 + local LastW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 2).GetWidth(); + //绘制中间 + Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 1, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0); + //绘制最后一张 + Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 2, X + Width - LastW, Y); + } + + function DrawTriptychDetail(X, Y, Width, Img, Fi, Mi, La) { + //如果没有载入img就载入 + if (!Rindro_Image_GlobalMap.rawin(Img)) { + Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img); + } + Rindro_Image_GlobalMap[Img].DrawPng(Fi, X, Y); + //获取第一张图片的宽 + local FirstW = Rindro_Image_GlobalMap[Img].GetPng(Fi).GetWidth(); + //获取中间的图片宽 + local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(Mi).GetWidth(); + //获得最后一张图片的宽 + local LastW = Rindro_Image_GlobalMap[Img].GetPng(La).GetWidth(); + //绘制中间 + Rindro_Image_GlobalMap[Img].DrawExPng(Mi, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0); + //绘制最后一张 + Rindro_Image_GlobalMap[Img].DrawPng(La, X + Width - LastW, Y); + } + function DrawNineBox(X, Y, Width, Height, Img, StartIndex) { //如果没有载入img就载入 if (!Rindro_Image_GlobalMap.rawin(Img)) { @@ -240,6 +285,8 @@ class Rindro_BaseToolClass { //绘制右下角 Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 8, X + Width - LeftTopW, Y + Height - LeftTopH); } + + } //获取文字绘制长度 class LenheartTextClass { @@ -395,4 +442,70 @@ class longlong { return RetStr; } +} + + + +//任务队列 +class QuestQueue { + //队列 + Queue = null; + + constructor() { + Queue = {}; + } + + //添加任务 + function AddQuest(QuestName, QuestLogic, ...) { + local args = null; + if (vargc > 0) { + args = []; + for (local i = 0; i< vargc; i++) { + args.append(vargv[i]); + } + } + Queue[QuestName] <- { + Logic = QuestLogic, + InseartTime = Clock(), + arg = args + }; + } + + //移除任务 + function RemoveQuest(QuestName) { + if (Queue) { + Queue.rawdelete(QuestName); + } + } + + //执行任务 + function Run() { + if (Queue) { + local NowTime = Clock(); + foreach(QuestName, QuestInfo in Queue) { + if (QuestInfo.arg && QuestInfo.arg.len() > 0) { + local Arr = []; + Arr.append(getroottable()); + Arr.append(QuestName); + Arr.append(NowTime); + foreach(value in QuestInfo.arg) { + Arr.append(value); + } + QuestInfo.Logic.acall(Arr); + // QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime, QuestInfo.arg); + } else QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime); + } + } + } + + + //示例 + + /* + Obj.AddQuest("测试任务",function (Name,Time) + { + print(Time); + if(Time >= 2000)Obj.RemoveQuest(Name); + }.bindenv(this)); + */ } \ No newline at end of file diff --git a/FileConfig.json b/FileConfig.json index 73f37fb..586e64d 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -40,6 +40,7 @@ }, "新成就系统": { "Private": true, + "price": 999, "Script": [ "Project/Achievement_New/Achievement_New.nut" ], @@ -50,8 +51,23 @@ "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" } }, + "定制-交易行": { + "Private": true, + "price": 999, + "Script": [ + "Project/Exchange/Exchange.nut", + "Project/Exchange/Exchange_auc.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "定制交易行", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "桃花定制战力系统": { "Private": true, + "price": 999, "Script": [ "Project/TH_CombatRank/TH_CombatRank.nut" ], @@ -62,8 +78,22 @@ "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" } }, + "毁梦定制战力系统": { + "Private": true, + "price": 999, + "Script": [ + "Project/HM_CombatRank/HM_CombatRank.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "桃花定制战力系统", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "宿命魂石": { "Private": true, + "price": 999, "Script": [ "Project/FatalismStone/FatalismStone_Stone.nut", "Project/FatalismStone/FatalismStone.nut" @@ -87,18 +117,6 @@ "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" } }, - "百级血槽": { - "Private": true, - "Script": [ - "Project/HudUi/HudUi.nut" - ], - "info": { - "ProjectAuthor": "官方 (期限:月)", - "ProjectVersion": "1.0.0", - "ProjectDescribe": "自用血槽", - "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:baijixueshuang.png" - } - }, "骑士马战": { "Private": true, "price": 100, @@ -125,6 +143,36 @@ }, "imgPath": "HorseGuessing" }, + "圣者遗物箱": { + "price": 30, + "Script": [ + "Project/AncientheroLuckyBox/AncientheroLuckyBox.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "通过服务器的表格配置,可开启圣者遗物箱来获取游戏道具。", + "ProjectDetails": [ + { + "type": "str", + "content": "通过服务器的表格配置,可开启圣者遗物箱来获取游戏道具。" + }, + { + "type": "str", + "content": "可以单抽和十连抽,可设置保底道具,动画效果酷炫。" + }, + { + "type": "img", + "content": "1" + }, + { + "type": "img", + "content": "2" + } + ] + }, + "imgPath": "AncientheroLuckyBox" + }, "皮肤仓库": { "price": 25, "Script": [ @@ -495,6 +543,24 @@ ] }, "imgPath": "Anton" + }, + "世界地图修补": { + "price": 0, + "Script": [ + "Project/RepairWorldMap/RepairWorldMap.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "修补原版的世界地图。", + "ProjectDetails": [ + { + "type": "str", + "content": "修补原版的世界地图。" + } + ] + }, + "imgPath": "CombatRank" } } } \ No newline at end of file diff --git a/Project/AncientheroLuckyBox/AncientheroLuckyBox.nut b/Project/AncientheroLuckyBox/AncientheroLuckyBox.nut index 76c80e7..7ca08a5 100644 --- a/Project/AncientheroLuckyBox/AncientheroLuckyBox.nut +++ b/Project/AncientheroLuckyBox/AncientheroLuckyBox.nut @@ -12,7 +12,7 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows { // NoWindow = true; //是否可见 - // Visible = false; + Visible = false; Img = null; @@ -319,70 +319,6 @@ getroottable().rawdelete("EventList_Obj") getroottable().rawdelete("AncientheroLuckyBox_Obj"); -//任务队列 -class QuestQueue { - //队列 - Queue = null; - - constructor() { - Queue = {}; - } - - //添加任务 - function AddQuest(QuestName, QuestLogic, ...) { - local args = null; - if (vargc > 0) { - args = []; - for (local i = 0; i< vargc; i++) { - args.append(vargv[i]); - } - } - Queue[QuestName] <- { - Logic = QuestLogic, - InseartTime = Clock(), - arg = args - }; - } - - //移除任务 - function RemoveQuest(QuestName) { - if (Queue) { - Queue.rawdelete(QuestName); - } - } - - //执行任务 - function Run() { - if (Queue) { - local NowTime = Clock(); - foreach(QuestName, QuestInfo in Queue) { - if (QuestInfo.arg && QuestInfo.arg.len() > 0) { - local Arr = []; - Arr.append(getroottable()); - Arr.append(QuestName); - Arr.append(NowTime); - foreach(value in QuestInfo.arg) { - Arr.append(value); - } - QuestInfo.Logic.acall(Arr); - // QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime, QuestInfo.arg); - } else QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime); - } - } - } - - - //示例 - - /* - Obj.AddQuest("测试任务",function (Name,Time) - { - print(Time); - if(Time >= 2000)Obj.RemoveQuest(Name); - }.bindenv(this)); - */ -} - class AncientheroLuckyBoxC_Box extends Rindro_BaseToolClass { //父对象 diff --git a/Project/AncientheroLuckyBox/img/0.png b/Project/AncientheroLuckyBox/img/0.png new file mode 100644 index 0000000..f2262b0 Binary files /dev/null and b/Project/AncientheroLuckyBox/img/0.png differ diff --git a/Project/AncientheroLuckyBox/img/1.png b/Project/AncientheroLuckyBox/img/1.png new file mode 100644 index 0000000..e5eb44a Binary files /dev/null and b/Project/AncientheroLuckyBox/img/1.png differ diff --git a/Project/AncientheroLuckyBox/img/2.png b/Project/AncientheroLuckyBox/img/2.png new file mode 100644 index 0000000..5265663 Binary files /dev/null and b/Project/AncientheroLuckyBox/img/2.png differ diff --git a/Project/Exchange/Exchange.nut b/Project/Exchange/Exchange.nut new file mode 100644 index 0000000..acba1e5 --- /dev/null +++ b/Project/Exchange/Exchange.nut @@ -0,0 +1,359 @@ +/* +文件名:Exchange.nut +路径:Project/Exchange/Exchange.nut +创建日期:2025-07-23 00:02 +文件用途:交易所 +*/ +class ExchangeC extends LenheartNewUI_Windows { + //包头 + Op = 21001000; + + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //手续费 + Commission = 0; + + //最低价Map + MinPriceMap = null; + + //待回收道具 + RecoveryItem = null; + //绘制对象的信息 + DrawItemCurObject = null; + + //输入框 + InputObject = null; + //上架价值 + InputValue = null; + + + //时间对象 + Timer = null; + + Img = Rindro_Image("interface2/yosin/exchange.img"); + LenheartUI = Rindro_Image("interface/lenheartwindowcommon.img"); + + //遍历背包查找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), + name = NativePointer(L_sq_I2P(L_sq_RA(FindAddress + 0x20))).readUnicodeString(), + level = L_sq_RA(FindAddress + 0x8) + } + } + } + return null; + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + Timer = Clock(); + + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + //初始化PVF配置 + InitScriptConfig(); + + + DiscardItemCallBackFunc.rawset("ExchangeC", DiscardItem.bindenv(this)); + + + DiscardItem(1011932160); + } + + + function InitScriptConfig() { + MinPriceMap = {}; + Rindro_Script.GetFileData("etc/rindro/exchange/exchange.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Str = Data.Get(); + if (Str == "[commission]") { + Commission = Data.Get().tofloat() * 0.01; + } else if (Str == "[bottom price]") { + while (!Data.Eof()) { + local Str = Data.Get(); + local Str2 = Data.Get(); + if (Str == "[/bottom price]") break; + else { + MinPriceMap[Str] <- Str2.tointeger(); + } + } + } + } + }.bindenv(this)); + } + + //回收道具回调 + function DiscardItem(ItemAddress) { + // print(ItemAddress); + if (!Visible) return true; + else { + local info = FindItemPosByForeachInven(ItemAddress); + if (info) { + RecoveryItem = null; + DrawItemCurObject = null; + InputObject.str = ""; + InputValue = null; + + info.ObjectAddress <- ItemAddress; + RecoveryItem = info; + } + } + } + + function RegisterNpc(id) { + local EachManager = getroottable()["L_Each_Obj"]; + //先清空注册 + 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.OnClick = function(Button) { + //打开背包 + L_sq_Open_ExWindow(0x1ADE090, 0, 0, 1); + Button.Parent.CloseAllEach(); + Button.Parent.CloseWindow(); + Visible = true; + ResetFocus(); + }.bindenv(this); + ApplyEngagementButton.SetCallBackFunc(function(Button) {}) + SThis.AddChild(ApplyEngagementButton); + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(332, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + AddChild(CloseButton); + + local CloseButton = LenheartNewUI_ButtonText(80, 324, 5, "上架"); + CloseButton.SetTextOffset(0, 1); + CloseButton.OnClick = function() { + if (!RecoveryItem) return; + local equvalue = InputValue.tointeger(); + //如果是装备判断一下最低价格 + if (RecoveryItem.type == 0) { + local EquipLevel = RecoveryItem.level; + local MinPrice = getMinPrice(EquipLevel); + if (equvalue< MinPrice) { + equvalue = MinPrice; + } + } + local T = { + op = Op + 1, + type = RecoveryItem.type, + pos = RecoveryItem.pos, + value = equvalue + } + SendPackEx(T); + RecoveryItem = null; + DrawItemCurObject = null; + InputObject.str = ""; + InputValue = null; + }.bindenv(this); + AddChild(CloseButton); + + local CloseButton = LenheartNewUI_ButtonText(210, 324, 5, "取消"); + CloseButton.SetTextOffset(0, 1); + CloseButton.OnClick = function() { + this.Visible = false; + RecoveryItem = null; + DrawItemCurObject = null; + InputObject.str = ""; + InputValue = null; + }.bindenv(this); + AddChild(CloseButton); + + //输入框 + InputObject = LenheartNewUI_BaseInput(120, 209, 110, 20); + InputObject.CallBack = function(Input, oldStr) { + if (Rindro_BaseToolClass.IsNumber(Input.str)) { + local buf = Input.str.tointeger(); + if (buf == 2147483647) { + Input.SetStr("2147483647"); + } + InputValue = buf; + } + }.bindenv(this); + AddChild(InputObject); + } + + + function getMinPrice(equiplevel) { + // 从当前等级开始查找 + local currentLevel = equiplevel; + + // 循环查找更低的等级,直到找到或等级小于1 + while (currentLevel >= 1) { + // 检查当前等级是否存在于映射表中 + if (MinPriceMap.rawin(currentLevel)) { + return MinPriceMap[currentLevel]; + } + // 降低一个等级继续查找 + currentLevel--; + } + + // 如果所有等级都找不到,返回null或默认值 + return null; + } + + //绘制主界面 + function DrawMain(obj) { + + Rindro_BaseToolClass.DrawNineBox(X - 2, Y + 14, 354, 350, "interface/lenheartwindowcommon.img", 0); //背景框 + //绘制背景图 + Img.DrawPng(0, X + 0, Y + 0); + //绘制点卷图标 + Img.DrawPng(1, X + 100, Y + 210); + + //绘制标题 + L_sq_DrawCode("上架物品", X + 152, Y + 3, sq_RGBA(221, 197, 147, 250), 1, 1); + + //如果有上架道具 则绘制 + if (RecoveryItem) { + DrawItemCur(RecoveryItem.ObjectAddress, RecoveryItem, X + 162, Y + 80); + L_sq_DrawCode(RecoveryItem.name, X + 176 - LenheartTextClass.GetStringLength(RecoveryItem.name) / 2, Y + 130, sq_RGBA(221, 197, 147, 250), 1, 1); + } + + if (InputValue) { + local CommissionStr = (InputValue * Commission).tointeger().tostring(); //手续费 + local EstimatedRevenue = (InputValue - (InputValue * Commission)).tointeger().tostring(); + L_sq_DrawCode("手续费: " + CommissionStr, X + 154 - (LenheartTextClass.GetStringLength(CommissionStr) / 2), Y + 247, sq_RGBA(221, 197, 147, 250), 1, 1); + L_sq_DrawCode("预计收入: " + EstimatedRevenue, X + 146 - (LenheartTextClass.GetStringLength(EstimatedRevenue) / 2), Y + 282, sq_RGBA(221, 197, 147, 250), 1, 1); + } + } + + + //绘制项目 + function DrawItemCur(Object, Info, XPos, Ypos) { + local Id = L_sq_RA(Object + 0x1C); + local Rarity = L_sq_RA(Object + 0xF4); + L_Sq_DrawItem(XPos, Ypos, Id, Info.count, 0, 0, 0); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, XPos, Ypos, 24, 24)) { + //打开道具信息窗口 + if (!Info.vis) { + //手动解锁道具信息窗口 + Sq_Memory_WriteByteArr(L_sq_I2P(0xF63DDA), [0x56, 0xE8, 0x10, 0xFE, 0xFF, 0xFF]); + local ItemDrawInfo = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Object, 41); + //校准道具信息窗口位置 + L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemDrawInfo, IMouse.GetXPos(), IMouse.GetYPos(), 24, 24); + Info.vis = true; + //我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具 + getroottable().WindowsShowABFlag <- false; + DrawItemCurObject = Object; + } + } else { + if (Info.vis) { + //关闭道具信息窗口 + L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); + Info.vis = false; + DrawItemCurObject = null; + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + //同步位移窗口逻辑 + local Window = sq_GetPopupWindowMainCotrol(64); + if (Window) { + X = Window.GetXPos() - 430; + Y = Window.GetYPos() + 60; + } + + //悬停已回收锁定逻辑 + local SelectItem = L_sq_RA(0x1AE45B4); + if (RecoveryItem && RecoveryItem.rawin("ObjectAddress")) { + if (RecoveryItem.ObjectAddress == SelectItem) { + R_Mouse.Lock(); + _Rindro_Cusor_.ForceLockState = true; + } else { + _Rindro_Cusor_.ForceLockState = false; + } + } else { + _Rindro_Cusor_.ForceLockState = false; + } + + LenheartNewUI_Windows.SyncPos(X, Y); + + if (Timer) { + if (Clock() - Timer >= 2000) { + Timer = null; + RegisterNpc(1); + } + } + } + + //override + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + if (DrawItemCurObject && RecoveryItem) { + local Info = RecoveryItem; + if (Info.vis) { + //关闭道具信息窗口 + L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); + Info.vis = false; + RecoveryItem = null; + DrawItemCurObject = null; + InputObject.str = ""; + InputValue = null; + } + } + //调用原生方法 + LenheartNewUI_Windows.OnMouseLbDown(MousePos_X, MousePos_Y); + } +} + + + +function Lenheart_Exchange_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Exchange_Obj")) { + RootTab.rawset("Exchange_Obj", true); + LenheartNewUI_CreateWindow(ExchangeC, "交易所窗口", 43, 128, 420, 412, 0); + } +} + +getroottable()["LenheartFuncTab"].rawset("ExchangeFuncN", Lenheart_Exchange_Fun); + + + + + +// L_Windows_List <- []; +// getroottable().rawdelete("LenheartPluginsInitFlag"); +// getroottable().rawdelete("EventList_Obj") +// getroottable().rawdelete("Exchange_Obj"); \ No newline at end of file diff --git a/Project/Exchange/Exchange_auc.nut b/Project/Exchange/Exchange_auc.nut new file mode 100644 index 0000000..0848cb8 --- /dev/null +++ b/Project/Exchange/Exchange_auc.nut @@ -0,0 +1,330 @@ +/* +文件名:Exchange_auc.nut +路径:Project/Exchange/Exchange_auc.nut +创建日期:2025-07-23 13:13 +文件用途:交易所拍卖行 +*/ +class Exchange_aucC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + Img = null; + + //标题按钮集合 + TitleButtonList = null; + + //页面 + Page = 0; + //子页面 + SubPage = 0; + //总条数 + Total = 0; + + //拍卖信息 + AuctionInfo = null; + + //选中拍品 + SelectAuction = null; + + function QueryExchange() { + AuctionInfo = []; + SendPackEx({ + op = 21001003, + type = Page + 1, + offset = SubPage * 7 + }) + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + TitleButtonList = []; + AuctionInfo = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Img = {}; + Img["main"] <- Rindro_Image("interface2/yosin/exchange.img"); + + //查询拍卖信息回包 + RegisterPack(21001004, function(Chunk) { + local Jso = Json.Decode(Chunk); + Total = Jso.total; + foreach(infoobj in Jso.info) { + infoobj.itemName <- NativePointer(L_sq_I2P(L_sq_RA(L_sq_GetItem(infoobj.itemId) + 0x20))).readUnicodeString() + local buf = Exchange_aucC_Item(this, infoobj); + AuctionInfo.append(buf); + } + + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(388, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + local LogicFunc = function(Btn) { + foreach(Pos, obj in TitleButtonList) { + if (obj != Btn) obj.State = 0; + else { + obj.State = 1; + Page = Pos; + } + } + QueryExchange(); + }; + + local UpdateLogic = function(Btn) { + if (SelectAuction) Btn.Visible = false; + else Btn.Visible = true; + } + + local FuncTabbar1 = LenheartNewUI_TabbarsText(4, 20, "装备"); + FuncTabbar1.State = 1; + FuncTabbar1.SetTextOffset(20, 4); + AddChild(FuncTabbar1); + FuncTabbar1.OnClickEx = LogicFunc.bindenv(this); + TitleButtonList.append(FuncTabbar1); + + // local FuncTabbar2 = LenheartNewUI_TabbarsText(65, 20, "消耗品"); + // FuncTabbar2.SetTextOffset(13, 3); + // AddChild(FuncTabbar2); + // FuncTabbar2.OnClickEx = LogicFunc.bindenv(this); + // TitleButtonList.append(FuncTabbar2); + + // local FuncTabbar3 = LenheartNewUI_TabbarsText(126, 20, "材料"); + // FuncTabbar3.SetTextOffset(20, 3); + // AddChild(FuncTabbar3); + // FuncTabbar3.OnClickEx = LogicFunc.bindenv(this); + // TitleButtonList.append(FuncTabbar3); + + // local FuncTabbar4 = LenheartNewUI_TabbarsText(187, 20, "副职业"); + // FuncTabbar4.SetTextOffset(13, 3); + // AddChild(FuncTabbar4); + // FuncTabbar4.OnClickEx = LogicFunc.bindenv(this); + // TitleButtonList.append(FuncTabbar4); + + // local FuncTabbar5 = LenheartNewUI_TabbarsText(248, 20, "任务"); + // FuncTabbar5.SetTextOffset(20, 3); + // AddChild(FuncTabbar5); + // FuncTabbar5.OnClickEx = LogicFunc.bindenv(this); + // TitleButtonList.append(FuncTabbar5); + + local FuncTabbar6 = LenheartNewUI_TabbarsText(340, 20, "我的"); + FuncTabbar6.SetTextOffset(20, 3); + AddChild(FuncTabbar6); + FuncTabbar6.OnClickEx = LogicFunc.bindenv(this); + TitleButtonList.append(FuncTabbar6); + + //左翻页按钮 + local LeftButton = LenheartNewUI_BaseButton(320, 350, 15, 15, "interface/lenheartwindowcommon.img", 34); + LeftButton.OnClick = function() { + if (SubPage > 0) SubPage--; + QueryExchange(); + }.bindenv(this); + LeftButton.SetCallBackFunc(UpdateLogic.bindenv(this)); + AddChild(LeftButton); + + //右翻页按钮 + local RightButton = LenheartNewUI_BaseButton(380, 350, 15, 15, "interface/lenheartwindowcommon.img", 38); + RightButton.OnClick = function() { + if (SubPage + 1<((Total / 7) + 1)) SubPage++; + QueryExchange(); + }.bindenv(this); + RightButton.SetCallBackFunc(UpdateLogic.bindenv(this)); + AddChild(RightButton); + + + local ByCallLogic = function(Btn) { + if (!SelectAuction) Btn.Visible = false; + else Btn.Visible = true; + } + + local BuyButton = LenheartNewUI_ButtonText(120, 340, 5, "购买"); + BuyButton.SetTextOffset(0, 1); + BuyButton.OnClickEx = function(Btn) { + if (Btn.Visible) { + local T = { + op = 21001005, + uuid = SelectAuction.Info.uid + } + SendPackEx(T); + SelectAuction = null; + QueryExchange(); + } + }.bindenv(this); + BuyButton.SetCallBackFunc(ByCallLogic.bindenv(this)); + AddChild(BuyButton); + + local CancelButton = LenheartNewUI_ButtonText(230, 340, 5, "取消"); + CancelButton.SetTextOffset(0, 1); + CancelButton.OnClick = function() { + SelectAuction = null; + }.bindenv(this); + CancelButton.SetCallBackFunc(ByCallLogic.bindenv(this)); + AddChild(CancelButton); + } + + //绘制主界面 + function DrawMain(obj) { + + DrawNineBox(X, Y + 2, 405, 372, "interface/lenheartwindowcommon.img", 213); //背景框 + Img["main"].DrawPng(2, X + 1, Y); + + DrawNineBox(X + 2, Y + 39, 400, 332, "interface/lenheartwindowcommon.img", 213); //背景框 + // SelectAuction = Exchange_aucC_Item(this, { + // //唯一id + // uid = "1231", + // itemId = 2243114, + // itemName = "御影法杖", + // count = 1, + // price = 1000, + // name = "Kina" + // }); + + if (!SelectAuction) { + //绘制交易物品 + if (Page >= 0 && Page< 5) { + if (AuctionInfo) { + foreach(Pos, Object in AuctionInfo) { + Object.Show(X + 4, Y + 44 + Pos * 44); + } + } + } + + //绘制页数 + local SubPageStr = (SubPage + 1).tostring() + "/" + ((Total / 7) + 1).tostring(); + L_sq_DrawCode(SubPageStr, X + 359 - LenheartTextClass.GetStringLength(SubPageStr) / 2, Y + 352, sq_RGBA(230, 200, 155, 255), 0, 1); + } else { + //绘制交易唯一ID + L_sq_DrawCode("交易码: " + SelectAuction.Info.uid, X + 8, Y + 60, sq_RGBA(230, 200, 155, 255), 0, 1); + DrawItemBase(X + 8, Y + 80, SelectAuction.Info.itemId, SelectAuction.Info.count); + //绘制名称 + L_sq_DrawCode(SelectAuction.Info.itemName + "x" + SelectAuction.Info.count, X + 48, Y + 88, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制价格 + local Pstr = "售价: " + SelectAuction.Info.price + " 单价: " + (SelectAuction.Info.price / SelectAuction.Info.count + "/件"); + L_sq_DrawCode(Pstr, X + 8, Y + 120, sq_RGBA(140, 255, 113, 255), 0, 1); + //绘制卖家名称 + L_sq_DrawCode("卖家: " + SelectAuction.Info.name, X + 8, Y + 140, sq_RGBA(230, 200, 155, 255), 0, 1); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + function TopShow(obj) { + LenheartNewUI_Windows.TopShow(obj); + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + if (Page >= 0 && Page< 5 && !SelectAuction) { + if (AuctionInfo) { + foreach(Pos, Object in AuctionInfo) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 4, Y + 44 + Pos * 44, 392, 39)) { + Object.HoverShow(X + 4, Y + 44 + Pos * 44); + } + } + } + } + } + + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); + if (Page >= 0 && Page< 5 && !SelectAuction) { + if (AuctionInfo) { + foreach(Pos, Object in AuctionInfo) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 4, Y + 44 + Pos * 44, 392, 39)) { + Object.OnMouseLbDown(X + 4, Y + 44 + Pos * 44); + } + } + } + } + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + function OpenCallBack() { + Visible = true; + QueryExchange(); + } +} + +function Lenheart_Exchange_auc_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Exchange_auc_Obj")) { + RootTab.rawset("Exchange_auc_Obj", true); + local Win = LenheartNewUI_CreateWindow(Exchange_aucC, "交易所拍卖行窗口", ((getroottable().Rindro_Scr_Width - 405) / 2).tointeger(), 100, 405, 372, 28); + EventList_Obj.AddEvent("点券交易所", 43, Win); + } +} + +getroottable()["LenheartFuncTab"].rawset("Exchange_aucFuncN", Lenheart_Exchange_auc_Fun); + + +class Exchange_aucC_Item { + + //Img + Img = null; + //父对象 + Parent = null; + //信息 + Info = null; + + constructor(Window, Info) { + Parent = Window; + Img = Window.Img["main"]; + this.Info = Info; + } + + + function Show(X, Y) { + Img.DrawPng(3, X, Y); + local Xpos = X; + local Ypos = Y; + + //绘制交易唯一ID + L_sq_DrawCode("交易码: " + Info.uid, Xpos + 8, Ypos + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + + //绘制道具 + Parent.DrawItemBase(Xpos + 100, Ypos + 5, Info.itemId, Info.count); + //绘制名称 + L_sq_DrawCode(Info.itemName + "x" + Info.count, Xpos + 137, Ypos + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + + //绘制价格 + local Pstr = "售价: " + Info.price + " 单价: " + (Info.price / Info.count + "/件"); + L_sq_DrawCode(Pstr, Xpos + 315 - LenheartTextClass.GetStringLength(Pstr) / 2, Ypos + 14, sq_RGBA(140, 255, 113, 255), 0, 1); + } + + function HoverShow(X, Y) { + Img.DrawPng(4, X, Y); + } + + function OnMouseLbDown(X, Y) { + Parent.SelectAuction = this; + } +} + + + + +// L_Windows_List <- []; +// getroottable().rawdelete("LenheartPluginsInitFlag"); +// getroottable().rawdelete("EventList_Obj") +// getroottable().rawdelete("Exchange_auc_Obj"); diff --git a/Project/FatalismStone/FatalismStone.nut b/Project/FatalismStone/FatalismStone.nut index c69b08d..85f16f9 100644 --- a/Project/FatalismStone/FatalismStone.nut +++ b/Project/FatalismStone/FatalismStone.nut @@ -125,12 +125,12 @@ class FatalismStoneC extends LenheartNewUI_Windows { function RegisterWidget() { - // //关闭按钮 - // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); - // CloseButton.OnClick = function() { - // this.Visible = false; - // }.bindenv(this); - // Childrens.append(CloseButton); + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(738, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); local FuncTabbar1 = LenheartNewUI_TabbarsText(302, 27, "洗练"); FuncTabbar1.State = 1; @@ -253,6 +253,8 @@ class FatalismStoneC extends LenheartNewUI_Windows { function DrawMain(obj) { Img["main"].DrawPng(0, X, Y); + L_sq_DrawCode("宿命魂石", X + 362, Y + 3, sq_RGBA(221, 197, 147, 250), 1, 1); + //绘制自身人物 local charAni = sq_GetCNRDObjectToSQRCharacter(obj).sq_GetRestAni(); sq_AnimationProc(charAni); @@ -272,11 +274,13 @@ class FatalismStoneC extends LenheartNewUI_Windows { //绘制魂石 if (PageFatalismStoneLst) { foreach(Pos, Stone in PageFatalismStoneLst) { + // sq_DrawBox(X + Stone.XPos, Y + Stone.YPos, 34,34, 0xffffffff); Stone.Show(obj, X + Stone.XPos, Y + Stone.YPos); } } } + function TopShow(obj) { LenheartNewUI_Windows.TopShow(obj); //还没有初始化数据的时候直接返回 @@ -321,7 +325,7 @@ class FatalismStoneC extends LenheartNewUI_Windows { function OnMouseLbDown(MousePos_X, MousePos_Y) { LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); foreach(Pos, Stone in PageFatalismStoneLst) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 39, 35)) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 34, 34)) { if (Stone.isSuccess) { DragObj = Stone; PageFatalismStoneLst[Pos] = FatalismStone_Stone(null); @@ -338,7 +342,7 @@ class FatalismStoneC extends LenheartNewUI_Windows { LenheartNewUI_BaseWindow.OnMouseLbUp(MousePos_X, MousePos_Y); if (!PageFatalismStoneLst) return; foreach(Pos, Stone in PageFatalismStoneLst) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 39, 35)) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 34, 34)) { if (DragObj) { //获取到旧的穿戴类型 local OldEType = DragObj.Stone_Type; diff --git a/Project/HM_CombatRank/HM_CombatRank.nut b/Project/HM_CombatRank/HM_CombatRank.nut new file mode 100644 index 0000000..7c9d862 --- /dev/null +++ b/Project/HM_CombatRank/HM_CombatRank.nut @@ -0,0 +1,695 @@ +/* +文件名:TH_CombatRank.nut +路径:Project/TH_CombatRank/TH_CombatRank.nut +创建日期:2025-07-01 10:18 +文件用途:战力排行榜 +*/ +class TH_CombatRankC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + Img = null; + + + TitleButtonList = null; + + //个人 公会 + Page = 0; + + Test = null; + + //个人战力集合 + CombatInfoList = null; + //个人奖励集合 + PersonReward = null; + //查看中的详细个人信息 + LookingInfo = null; + + //我的战力 + MyCombat = null; + + //宣言Timer + DeclareTimer = null; + DeclareFlag = false; + + //公会奖励集合 + GuildReward = null; + GuildFlagData = null; + GuildFlagImgMap = null; + //公会战力集合 + GuildInfoList = null; + + //滚动条 + ScrollBar = null; + ScrollBarRate = 0; + ScrollBarValue = 1804; + + function CheckPersonalCombatPower() { + SendPackEx({ + op = 20096003 + }) + } + + function CheckGuildCombatPower() { + SendPackEx({ + op = 20096005 + }) + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + DeclareTimer = Clock(); + Childrens = []; + TitleButtonList = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + Img = {}; + Img["main"] <- Rindro_Image("interface/rindro/hmnew_rank.img"); + Img["information_button_cn"] <- Rindro_Image("interface2/hud/information_button/information_button_cn.img"); + Img["newuserinfo"] <- Rindro_Image("interface/userinfomation/newuserinfo.img"); + + //基础配置数据回包 + RegisterPack(20096102, function(Chunk) { + local Jso = Json.Decode(Chunk); + PersonReward = Jso["config"]; + }.bindenv(this)); + + //基础公会数据回包 + RegisterPack(20096104, function(Chunk) { + local Jso = Json.Decode(Chunk); + GuildReward = Jso["config"]; + GuildFlagData = {}; + GuildFlagImgMap = {}; + foreach(object in Jso["config2"]) { + GuildFlagData.rawset(object.guildId, [object.img, object.imgid]); + } + }.bindenv(this)); + + //查询个人战力排行榜包 + RegisterPack(20096004, function(Chunk) { + local Jso = Json.Decode(Chunk); + local ranking = Jso.ranking; + + CombatInfoList = []; + foreach(Pos, Info in ranking) { + //补全默认公会 + if (!Info.rawin("guildname")) Info.guildname <- "无公会"; + //构造显示对象 + local Buf = TH_CombatRankC_Item(this, Pos, Info, 0); + CombatInfoList.append(Buf); + } + + // LookingInfo = CombatInfoList[0]; + + //构造我自己 + if (!Jso.my.rawin("guildname")) Jso.my.guildname <- "无公会"; + MyCombat = TH_CombatRankC_Item(this, 900, Jso.my, 0); + MyCombat.Idx = Jso.on - 1; + }.bindenv(this)); + + RegisterPack(20096006, function(Chunk) { + local Jso = Json.Decode(Chunk); + local ranking = Jso.ranking; + GuildInfoList = []; + foreach(Pos, Info in ranking) { + local Buf = TH_CombatRankC_Item(this, Pos, Info, 1); + GuildInfoList.append(Buf); + } + }.bindenv(this)); + + CheckPersonalCombatPower(); + CheckGuildCombatPower(); + + UploadYourOwnCombatPower(); + } + + function RegisterWidget() { + //返回按钮 + local ReturnButton = LenheartNewUI_BaseButton(8, 8, 11, 12, "interface/lenheartwindowcommon.img", 540); + ReturnButton.OnClick = function() { + LookingInfo = null; + }.bindenv(this); + Childrens.append(ReturnButton); + + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(722, 8, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + local WorshipButton = LenheartNewUI_ButtonText(630, 240, 45, "膜 拜"); + WorshipButton.SetTextOffset(13, 1); + WorshipButton.OnClick = function() { + if (LookingInfo) { + SendPackEx({ + op = 20096007, + mbcid = LookingInfo.Info.cid + }) + } + }.bindenv(this); + WorshipButton.SetCallBackFunc(function(Btn) { + if (LookingInfo == null) { + Btn.Visible = false; + } else { + Btn.Visible = true; + } + }.bindenv(this)); + AddChild(WorshipButton); + + // local FuncTabbar1 = LenheartNewUI_TabbarsText(4, 23, "巅峰战力"); + // FuncTabbar1.State = 1; + // FuncTabbar1.SetTextOffset(8, 4); + // AddChild(FuncTabbar1); + // FuncTabbar1.OnClick = function() { + // TitleButtonList[1].State = 0; + // TitleButtonList[0].State = 1; + // TitleButtonList[2].State = 0; + // Page = 0; + // LookingInfo = null; + // ScrollBar.Reset(); + // }.bindenv(this); + // TitleButtonList.append(FuncTabbar1); + + // local FuncTabbar2 = LenheartNewUI_TabbarsText(65, 23, "公会战力"); + // FuncTabbar2.SetTextOffset(8, 4); + // AddChild(FuncTabbar2); + // FuncTabbar2.OnClick = function() { + // TitleButtonList[0].State = 0; + // TitleButtonList[1].State = 1; + // TitleButtonList[2].State = 0; + // Page = 1; + // LookingInfo = null; + // ScrollBar.Reset(); + // }.bindenv(this); + // TitleButtonList.append(FuncTabbar2); + + // local FuncTabbar3 = LenheartNewUI_TabbarsText(476, 23, "我的战力"); + // FuncTabbar3.SetTextOffset(8, 4); + // AddChild(FuncTabbar3); + // FuncTabbar3.OnClick = function() { + // TitleButtonList[0].State = 0; + // TitleButtonList[1].State = 0; + // TitleButtonList[2].State = 1; + // Page = 0; + // LookingInfo = MyCombat; + // ScrollBar.Reset(); + // }.bindenv(this); + // TitleButtonList.append(FuncTabbar3); + + ScrollBar = Yosin_ScrollBar(729, 295, 218, 60); + ScrollBar.SetParent(this); + ScrollBar.SetStep(20 / 100.0); + ScrollBar.SetOnChange(function(Rate) { + ScrollBarRate = Rate; + }.bindenv(this)); + } + + + //绘制主界面 + function DrawMain(obj) { + Img["main"].DrawPng(0, X, Y); + Img["main"].DrawPng(0, X, Y); + // Img["main"].DrawPng(0, X, Y); + + L_sq_DrawCode("荣誉殿堂", X + 347, Y + 8, sq_RGBA(255, 177, 0, 255), 0, 1); + Img["information_button_cn"].DrawPng(136, X + 14, Y + 274); + + if (Page == 0) { + //职业 + L_sq_DrawCode("角色名", X + 90, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode("膜拜次数", X + 189, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode("职业", X + 282, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode("公会名", X + 378, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode("战斗力", X + 497, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode("奖励", X + 644, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1); + + + setClip(X + 2, Y + 294, X + 729, Y + 294 + 218); + if (CombatInfoList) { + foreach(Pos, Object in CombatInfoList) { + Object.Show(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger()); + } + } + releaseClip(); //裁切结束 + + //绘制前三名 + if (CombatInfoList) { + for (local i = 0; i< 3; i++) { + //如果不足3个 + if (i >= CombatInfoList.len()) break; + + local OffsetX = 370; + local OffsetY = 220; + if (i == 1) { + OffsetX = 178; + } + if (i == 2) { + OffsetX = 565; + } + if (!LookingInfo || LookingInfo.Idx != i) { + CombatInfoList[i].ShowCharacter(X + OffsetX, Y + OffsetY); + local name = CombatInfoList[i].Info.name; + L_sq_DrawCode(name, X + OffsetX + 5 - LenheartTextClass.GetStringLength(name) / 2, Y + OffsetY + 25, sq_RGBA(179, 169, 135, 255), 0, 1); + + if (Clock() - DeclareTimer >= 3000) { + DeclareTimer = Clock(); + DeclareFlag = !DeclareFlag; + } + if (DeclareFlag) { + local gg = CombatInfoList[i].Info.zdygg; + if (gg.len() == 0) gg = "暂无宣言!"; + Img["main"].DrawPng(9 + i, X + OffsetX - 66, Y + OffsetY - 194); + L_sq_DrawCode_Ex(gg, X + OffsetX - 56, Y + OffsetY - 176, sq_RGBA(179, 169, 135, 255), 0, 1); + } + } + } + } + + //如果有查看者 + if (LookingInfo) { + Img["main"].DrawPng(7, X + 2, Y + 24); + T_DrawDynamicAni(obj, "ui/selectcharacter/animation/selectcharactereffect.ani", X + 15, Y + 30, "桃花战斗力角色背景光环"); + Img["main"].DrawPng(8, X + 30, Y + 140); + // LookingInfo.CharacShow.Draw(X + 80, Y + 248); + LookingInfo.ShowCharacter(X + 80, Y + 228); + + local YPosBuffer = Y - 25; + //排名 + L_sq_DrawCode("排名: " + (LookingInfo.Idx + 1), X + 150, YPosBuffer + 60, sq_RGBA(230, 200, 155, 255), 0, 1); + //角色名 + L_sq_DrawCode("角色名: " + LookingInfo.Info.name, X + 150, YPosBuffer + 78, sq_RGBA(230, 200, 155, 255), 0, 1); + //职业 + L_sq_DrawCode("角色职业: " + LookingInfo.Info.jobname, X + 150, YPosBuffer + 96, sq_RGBA(230, 200, 155, 255), 0, 1); + //等级 + L_sq_DrawCode("角色等级: " + LookingInfo.Info.level, X + 150, YPosBuffer + 114, sq_RGBA(230, 200, 155, 255), 0, 1); + //公会名 + L_sq_DrawCode("所属公会: " + LookingInfo.Info.guildname, X + 150, YPosBuffer + 132, sq_RGBA(230, 200, 155, 255), 0, 1); + //是否在线 + L_sq_DrawCode("当前状态: " + (LookingInfo.Info.isOnline ? "在线" : "离线"), X + 150, YPosBuffer + 150, sq_RGBA(230, 200, 155, 255), 0, 1); + + //战斗力 + L_sq_DrawCode("战斗力: " + LookingInfo.Info.zdlS, X + 150, YPosBuffer + 168, sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode("-- 基础战斗力: " + LookingInfo.Info.jczdlS, X + 150, YPosBuffer + 186, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(" 四维: " + LookingInfo.Info.swzldS, X + 150, YPosBuffer + 204, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(" 三攻: " + LookingInfo.Info.sgzldS, X + 150, YPosBuffer + 222, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(" 属强: " + LookingInfo.Info.sqzldS, X + 150, YPosBuffer + 240, sq_RGBA(179, 169, 135, 255), 0, 1); + L_sq_DrawCode(" 其他: " + LookingInfo.Info.qtzldS, X + 150, YPosBuffer + 258, sq_RGBA(179, 169, 135, 255), 0, 1); + + L_sq_DrawCode("-- 膜拜次数: " + LookingInfo.Info.fstS, X + 150, YPosBuffer + 276, sq_RGBA(179, 169, 135, 255), 0, 1); + } + + + } + + + if (Page == 1) { + //职业 + L_sq_DrawCode("会长", X + 58, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //角色名 + L_sq_DrawCode("公会名称", X + 152, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //公会名 + L_sq_DrawCode("战斗力", X + 280, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //战斗力 + L_sq_DrawCode(" 奖励", X + 438, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + + setClip(X, Y + 316, X + 528, Y + 316 + 196); + if (GuildInfoList) { + foreach(Pos, Object in GuildInfoList) { + Object.Show(X, Y + 316 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger()); + } + } + releaseClip(); //裁切结束 + + if (GuildInfoList) { + for (local i = 0; i< 3; i++) { + if (GuildInfoList.len() <= i) break; + + local OffsetX = 270; + local OffsetY = 268; + if (i == 1) { + OffsetX = 130; + OffsetY = 268; + } + if (i == 2) { + OffsetX = 410; + OffsetY = 268; + } + + local Object = GuildInfoList[i]; + local GuildId = Object.Info.guildId; + if (GuildFlagData.rawin(GuildId)) { + local Info = GuildFlagData[GuildId]; + if (!GuildFlagImgMap.rawin(Info[0])) { + GuildFlagImgMap[Info[0]] <- Rindro_Image(Info[0]); + } + GuildFlagImgMap[Info[0]].DrawPng(0, X + OffsetX, Y + OffsetY); + } else { + Img["main"].DrawPng(3, X + OffsetX, Y + OffsetY); + } + } + } + } + } + + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + function TopShow(obj) { + LenheartNewUI_Windows.TopShow(obj); + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + + if (CombatInfoList && Page == 0) { + setClip(X + 2, Y + 294, X + 729, Y + 294 + 218); + foreach(Pos, Object in CombatInfoList) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger(), 726, 39)) { + Object.HoverShow(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger()); + } + } + releaseClip(); //裁切结束 + } + } + + function DrawItemBase(X, Ypos, Id, Count) { + if ((Ypos + 28) > this.Y + 294 && Ypos< this.Y + 294 + 218) { + LenheartNewUI_Windows.DrawItemBase(X, Ypos, Id, Count); + } + } + + //鼠标滚轮事件回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + //左侧的滚动条判定 + if (MousePos_X > X && MousePos_X<(X + 726) && MousePos_Y > (Y + 294) && MousePos_Y<(Y + 294 + 218)) { + if (Flag) ScrollBar.DoStep(-1); + if (!Flag) ScrollBar.DoStep(1); + } + } + + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); + if (CombatInfoList) { + foreach(Pos, Object in CombatInfoList) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger(), 726, 39)) { + Object.OnMouseLbDown(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger()); + } + } + } + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + //上传自身战斗力 + //时装 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环 + // AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3034]; + AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + creInfoIdx = [0x3068, 0x306C, 0x3070, 0x3074]; + + function UploadYourOwnCombatPower() { + if (sq_GetCurrentModuleType() != 1) return; + local obj = sq_GetMyMasterCharacter(); + if (!obj) return; + local C_Object = L_sq_RA(0x1ab7cdc); + //记录时装 + local avataritemsbuf = []; + foreach(offset in AvatarInfoIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local Ab = []; + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + Ab.append(NormalIndex); + Ab.append(ExIndex); + avataritemsbuf.append(Ab); + } else { + local Ab = []; + Ab.append(0); + Ab.append(0); + avataritemsbuf.append(Ab); + } + } + //记录装备 + local equiitemsbuf = []; + local equiupbuf = []; + for (local i = 1; i< 13; ++i) { + //编号 + local Index = L_sq_GetCharacterAttribute(0x1c, i); + //强化 + local Upvalue = L_sq_GetCharacterAttribute(0x1054, i) + //是否有增幅属性 + local IsZf = L_sq_GetCharacterAttribute(0x10A8, i) + //锻造 + local DsUpvalue = L_sq_GetCharacterAttribute(0x10E8, i); + //附魔卡片 + local Enchanting = L_sq_GetCharacterAttribute(0x1084, i); + + equiitemsbuf.append(Index); + + local Info = []; + if (IsZf) { + Info.append(0); + Info.append(Upvalue); + } else { + Info.append(Upvalue); + Info.append(0); + } + Info.append(DsUpvalue); + Info.append(Enchanting); + equiupbuf.append(Info); + + } + //记录宠物 + local creitemsbuf = []; + foreach(offset in creInfoIdx) { + local creEquiAddress = L_sq_RA(C_Object + offset); + if (creEquiAddress >= 0x400000) { + local NormalIndex = L_sq_RA(creEquiAddress + 0x1c); + creitemsbuf.append(NormalIndex); + } else { + creitemsbuf.append(0); + } + } + + //记录四维三攻属强 + local Attributes = 0; + Attributes += L_sq_GetCharacterAttribute(0x2364); + Attributes += L_sq_GetCharacterAttribute(0x2394); + Attributes += L_sq_GetCharacterAttribute(0x237c); + Attributes += L_sq_GetCharacterAttribute(0x23ac); + + + local AttackValue = 0; + AttackValue += L_sq_GetCharacterAttribute(0x1E54); + AttackValue += L_sq_GetCharacterAttribute(0x1E84); + AttackValue += L_sq_GetCharacterAttribute(0x22C8); + + local Enhancement = 0; //火冰光暗 + Enhancement += L_sq_GetCharacterAttribute(0x1b54); + Enhancement += L_sq_GetCharacterAttribute(0x1b60); + Enhancement += L_sq_GetCharacterAttribute(0x1b78); + Enhancement += L_sq_GetCharacterAttribute(0x1b6c); + + local T = { + op = 20096001, + ava = avataritemsbuf, + equ = equiitemsbuf, + sw = Attributes, + atk = AttackValue, + ele = Enhancement, + cre = creitemsbuf, + job = sq_getJob(obj), + exjob = sq_getGrowType(obj), + name = L_Sq_GetObjectName(obj), + equUp = equiupbuf, + fst = 0, + } + SendPackEx(T); + } + + function OpenCallBack() { + UploadYourOwnCombatPower(); + CheckPersonalCombatPower(); + CheckGuildCombatPower(); + LookingInfo = null; + this.Visible = true; + } + + + //高级绘制文字(带换行) + function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) { + local strarr = []; + if (str.find("\\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc); + else { + local Bpos = 0; + while (true) { + local Npos = str.find("\\n", Bpos); + if (!Npos) { + local strbuff = str.slice(Bpos, str.len()); + strarr.append(strbuff); + break; + } + local strbuff = str.slice(Bpos, Npos); + strarr.append(strbuff); + Bpos = Npos + 2; + } + for (local z = 0; z< strarr.len(); z++) { + L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc); + } + } + } +} + + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("TH_CombatRank_Obj"); + +function Lenheart_TH_CombatRank_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("TH_CombatRank_Obj")) { + RootTab.rawset("TH_CombatRank_Obj", true); + local Win = LenheartNewUI_CreateWindow(TH_CombatRankC, "桃花定制战力榜窗口", ((getroottable().Rindro_Scr_Width - 742) / 2).tointeger(), 28, 742, 515, 24); + EventList_Obj.AddEvent("全服战力榜", 694, Win, "interface2/hud/information_button/information_button_cn.img"); + } +} + +getroottable()["LenheartFuncTab"].rawset("TH_CombatRankFuncN", Lenheart_TH_CombatRank_Fun); + + + +class TH_CombatRankC_Item { + + //Img + Img = null; + //编号 + Idx = null; + //父对象 + Parent = null; + //显示角色 + CharacShow = null; + + //信息体 + Info = null; + //类型 + Type = 0; + + constructor(Window, Idx, Info, Type) { + Parent = Window; + Img = Window.Img["main"]; + this.Idx = Idx; + this.Info = Info; + this.Type = Type; + } + + + function Show(X, Y) { + + if (Idx< 3) { + Img.DrawPng(4 + Idx, X + 3, Y); + } else { + Img.DrawPng(1, X + 3, Y); + } + + local Ranking = (Idx + 1).tostring(); + + local JobName; + local CharacName; + local Combat; + local MbCount; + local GuildName; + + if (this.Type == 0) { + JobName = Info.jobname; + CharacName = Info.name; + Combat = Info.zdlS; + MbCount = Info.mbcs.tostring(); + GuildName = Info.guildname; + } else if (this.Type == 1) { + JobName = Info.guildMaster; + CharacName = Info.guildName; + Combat = Info.zdlS; + } + + //绘制排名 + L_sq_DrawCode(Ranking, X + 25 - LenheartTextClass.GetStringLength(Ranking) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制角色名 + L_sq_DrawCode(CharacName, X + 110 - LenheartTextClass.GetStringLength(CharacName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制膜拜次数 + L_sq_DrawCode(MbCount, X + 213 - LenheartTextClass.GetStringLength(MbCount) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制职业 + L_sq_DrawCode(JobName, X + 297 - LenheartTextClass.GetStringLength(JobName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制公会名 + L_sq_DrawCode(GuildName, X + 398 - LenheartTextClass.GetStringLength(GuildName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + //绘制战斗力 + L_sq_DrawCode(Combat, X + 517 - LenheartTextClass.GetStringLength(Combat) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1); + + //绘制奖励 + if (this.Type == 0) { + if (Parent.PersonReward) { + if(Idx >= Parent.PersonReward.len())return; + local Reward = Parent.PersonReward[Idx]; + foreach(Pos, ItemInfo in Reward) { + Parent.DrawItemBase(X + 377 + 200 + (Pos * 30), Y + 4, ItemInfo[0], ItemInfo[1]); + } + } + } else if (this.Type == 1) { + if (Parent.PersonReward) { + local Reward = Parent.PersonReward[Idx]; + foreach(Pos, ItemInfo in Reward) { + Parent.DrawItemBase(X + 377 + 200 + (Pos * 30), Y + 4, ItemInfo[0], ItemInfo[1]); + } + } + } + } + + function HoverShow(X, Y) { + if (Y <= (Parent.Y + 316 + 196)) { + Img.DrawPng(2, X + 3, Y); + } + } + + function ShowCharacter(X, Y) { + //没有正在查看的对象的时候才绘制人物 + // if (!Parent.LookingInfo) { + if (!CharacShow) StructureCharacAni(); + CharacShow.Draw(X, Y); + // } + } + + function StructureCharacAni() { + local AvaList = []; + foreach(Ava in Info.avaS) { + if (Ava != 0) AvaList.append(Ava); + } + CharacShow = Rindro_Draw_Character(Info.job.tointeger(), AvaList, "rest.ani", null); + } + + function OnMouseLbDown(X, Y) { + if (this.Type == 0) { + if (Y <= (Parent.Y + 294 + 218) && Y >= (Parent.Y + 294)) { + Parent.LookingInfo = this; + } + } + } +} \ No newline at end of file diff --git a/Project/HM_CombatRank/img/0.png b/Project/HM_CombatRank/img/0.png new file mode 100644 index 0000000..8a7d9c9 Binary files /dev/null and b/Project/HM_CombatRank/img/0.png differ diff --git a/Project/HorseGuessing/HorseGuessing.nut b/Project/HorseGuessing/HorseGuessing.nut index 30367b2..a278065 100644 --- a/Project/HorseGuessing/HorseGuessing.nut +++ b/Project/HorseGuessing/HorseGuessing.nut @@ -619,4 +619,5 @@ function Lenheart_HorseGuessing_Fun(obj) { } } -getroottable()["LenheartFuncTab"].rawset("HorseGuessingFuncN", Lenheart_HorseGuessing_Fun); \ No newline at end of file +getroottable()["LenheartFuncTab"].rawset("HorseGuessingFuncN", Lenheart_HorseGuessing_Fun); + diff --git a/Project/RepairWorldMap/RepairWorldMap.nut b/Project/RepairWorldMap/RepairWorldMap.nut index 9473666..d9bd63f 100644 --- a/Project/RepairWorldMap/RepairWorldMap.nut +++ b/Project/RepairWorldMap/RepairWorldMap.nut @@ -83,9 +83,9 @@ class RepairWorldMapC extends LenheartNewUI_Windows { //绘制主界面 function DrawMain(obj) { - if (!getroottable().rawin("RINDRO_CONFIG")) { - return; - } + // if (!getroottable().rawin("RINDRO_CONFIG")) { + // return; + // } //黑框 L_sq_DrawImg("interface/minimap_minimap_town.img", 8, 131 + YosinWorldMapX, 7 + YosinWorldMapY); //绘制区域名称 @@ -144,6 +144,9 @@ function Sq_DrawMiniMapUI(obj) { } } +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") getroottable().rawdelete("RepairWorldMap_Obj"); function Lenheart_RepairWorldMap_Fun(obj) { @@ -153,4 +156,7 @@ function Lenheart_RepairWorldMap_Fun(obj) { } } -getroottable()["LenheartFuncTab"].rawset("RepairWorldMapFuncN", Lenheart_RepairWorldMap_Fun); \ No newline at end of file +getroottable()["LenheartFuncTab"].rawset("RepairWorldMapFuncN", Lenheart_RepairWorldMap_Fun); + + + diff --git a/Project/TreasureGoblin/TreasureGoblin.nut b/Project/TreasureGoblin/TreasureGoblin.nut new file mode 100644 index 0000000..6ebba88 --- /dev/null +++ b/Project/TreasureGoblin/TreasureGoblin.nut @@ -0,0 +1,190 @@ +/* +文件名:TreasureGoblin.nut +路径:Project/TreasureGoblin/TreasureGoblin.nut +创建日期:2025-08-06 09:34 +文件用途:TreasureGoblin +*/ +class TreasureGoblinC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + BaseImg = Rindro_Image("interface2/rindro_reward.img"); + MainImg = Rindro_Image("treasuregoblin/main.img"); + + + //窗口名称 + WindowTitle = "普通宝藏哥布林的宝箱"; + + //搜索时间Flag + SearchTimeFlag = 0; + //搜索时间品级对应表 + SearchTimeGradeTable = [1000, 1500, 2000, 2500, 3000, 3500]; + + //奖励包 + RewardPackage = null; + + //动画队列 + AniQueue = null; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + AniQueue = QuestQueue();; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + local RewList = [7422, 7422, 7422, 7422, 7422, 2682154, 2682154, 2682154, 2682154, 2682154, 10007482, 10007482, 10007482, 10007482, 10007482, 10007483, 10007483, 10007483, 10007483, 10007483, 10007484, 10007484, 10007484, 10007484, 10007484, 10092470, 10092470, 10092470, 10092470, 10092470, 490701711, 490701711, 490701711, 490701711, 490701711, 490701712, 490701712, 490701712, 490701712, 490701712, 2660671, 2660671, 2660671, 2660671, 2660671, 2660672, 2660672, 2660672, 2660672, 2660672, 7163, 1298, 2682833, 7163, 1298, 2682833, 7163, 1298, 2682833, 2682834, 2682835, 10007249, 10007250, 10007251, 10015164, 10015165, 10015166, 10015167, 10015168, 10015169, 10015170, 10015171, 10015172, 10015173, 10015174, 490001458, 490001942, 490001937, 490001941, 490002485, 490001940, 490001956, 490001693, 490011087, 490703966, 490702732, 490702941, 490700168, 10008064, 10008065, 10008066, 10008067, 10008068, 10008069, 10008070, 10008071, 10008072, 10008073, 10008074, 10008075, 10008076, 10008077, 10008078, 10008079, 10008080, 10008081, 10008082, 10008083, 10008084, 10008085, 10008086, 10008087, 10008088, 10008089, 10008090, 10008091, 10008092, 10008093, 10008094, 10008095, 10008096, 10008097, 10008098, 10008099, 10008100, 10008101, 10008102, 10008103, 10008104, 10008105, 10008106, 10008107, 10008910, 10008911, 8381, 2681176, 2681177, 2681178, 2681179, 2681180, 2681181, 2681182, 2681183, 2681184, 2681185, 2681186, 2681187, 2681482, 2681483, 2681486, 2681487, 2747554, 2747555, 2747556, 2747557, 2747558, 2747559, 2747560, 2747561, 20210112, 20210113]; + + RewardPackage = []; + for (local i = 0; i< sq_getRandom(5, 16); i++) { + local T = {}; + T.ItemId <- RewList[sq_getRandom(0, RewList.len() - 1)]; + T.Count <- sq_getRandom(1, 5); + T.IsSearch <- false; //是否已经搜索 + // T.Grade <- L_sq_RA(L_sq_GetItem(T.ItemId) + 0xF4); //到时候品级由服务端决定下发 + // T.Grade <- L_sq_RA(L_sq_GetItem(T.ItemId) + 0xF4); + T.Grade <- sq_getRandom(4, 5); + RewardPackage.append(T); + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(303, 6, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + local PickAllButton = LenheartNewUI_ButtonText(108, 341, 45, "全部拾取"); + PickAllButton.SetTextOffset(9, 1); + PickAllButton.OnClick = function() { + + }.bindenv(this); + AddChild(PickAllButton); + } + + + + //绘制主界面 + function DrawMain(obj) { + + //绘制标题 + DrawWindowTitle(318); + //绘制标题名 + L_sq_DrawCode(WindowTitle, X + 158 - LenheartTextClass.GetStringLength(WindowTitle) / 2, Y + 7, sq_RGBA(230, 200, 155, 255), 0, 1); + + //绘制窗口 + DrawNineBox(X, Y + 23, 316, 350, "interface/lenheartwindowcommon.img", 213); //背景框 + + //绘制内嵌窗口 + DrawNineBox(X + 8, Y + 32, 299, 299, "interface/lenheartwindowcommon.img", 204); //背景框 + + //绘制分割线 + MainImg.DrawExPng(0, X + 10, Y + 34, 0, sq_RGBA(127, 132, 142, 250), 1.0, 1.0); + + + if (RewardPackage) { + foreach(Index, Info in RewardPackage) { + local XPos = X + 11 + ((Index % 8) * 37); + local YPos = Y + ((Index / 8).tointeger() * 37) + 35; + if (Info.IsSearch) { + BaseImg.DrawPng(Info.Grade, XPos, YPos); + DrawItemBase(XPos + 3, YPos + 3, Info.ItemId, Info.Count); + } else { + MainImg.DrawPng(1, XPos + 10, YPos + 10); + } + } + + foreach(Index, Info in RewardPackage) { + local XPos = X + 11 + ((Index % 8) * 37); + local YPos = Y + ((Index / 8).tointeger() * 37) + 35; + //如果是没有搜索状态 + if (!Info.IsSearch) { + //还没有开始计时 + if (!Info.rawin("SeachTimer")) { + Info.SeachTimer <- 0; + } + if (Duration< 100) Info.SeachTimer += Duration; + if (Info.SeachTimer< SearchTimeGradeTable[Info.Grade]) { + local T = GetClockwiseCirclePoint(Info.SeachTimer / 1300.0, 0, 0, 6); + Rindro_Image_GlobalMap["lenheartui"].DrawPng(159, XPos + 12 + T.x, YPos + 12 + T.y); + } else { + Info.IsSearch = true; + R_Utils.PlaySound("ICON_KEY"); + + AniQueue.AddQuest("搜索完成动画" + Info.Grade, function(Name, Time, Grade, XPos, YPos) { + local AniPath = "common/item_effect/custom_2option_setting.ani"; + if (Grade == 3) AniPath = "common/item_effect/custom_3option.ani"; + if (Grade == 5) AniPath = "common/item_effect/custom_4option.ani"; + if (Grade == 4) AniPath = "common/item_effect/custom_honor_4option.ani"; + local Ani = DrawAniEx(XPos, YPos, AniPath); + if (sq_GetAnimationFrameIndex(Ani) == 14) { + sq_Rewind(Ani); + AniQueue.RemoveQuest(Name); + } + }.bindenv(this), Info.Grade, XPos + 1, YPos + 1); + } + break; + } + } + } + } + + function Show(obj) { + DrawMain(obj); + AniQueue.Run(); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + IsFocus = true; + } + + function GetClockwiseCirclePoint(dt, centerX, centerY, radius) { + // 将dt映射到角度(0到2π弧度),并反转方向实现顺时针 + local angle = 2 * 3.1415926535 * (1.0 - dt); + + // 计算相对圆心的偏移量 + local offsetX = radius * cos(angle); + local offsetY = radius * sin(angle); + + // 返回包含坐标的表 + return { + x = centerX + offsetX, + y = centerY + offsetY + }; + } +} +getroottable().rawdelete("TreasureGoblin_Obj"); + +function Lenheart_TreasureGoblin_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("TreasureGoblin_Obj")) { + RootTab.rawset("TreasureGoblin_Obj", true); + LenheartNewUI_CreateWindow(TreasureGoblinC, "宝藏哥布林的宝箱窗口", ((getroottable().Rindro_Scr_Width - 317) / 2).tointeger(), 80, 317, 370, 26); + } +} + +getroottable()["LenheartFuncTab"].rawset("TreasureGoblinFuncN", Lenheart_TreasureGoblin_Fun); + + + + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("TreasureGoblin_Obj"); + +// L_sq_GoDungeon(3709); \ No newline at end of file diff --git a/Project/WorldBoss/WorldBoss.nut b/Project/WorldBoss/WorldBoss.nut index 0a7555a..eeea27b 100644 --- a/Project/WorldBoss/WorldBoss.nut +++ b/Project/WorldBoss/WorldBoss.nut @@ -18,6 +18,8 @@ class WorldBossC extends LenheartNewUI_Windows { 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; @@ -28,12 +30,30 @@ class WorldBossC extends LenheartNewUI_Windows { //伤害列表 RankList = null; + //标题栏 + Title = null; + //组队榜单按钮 + TeamRankBtn = null; + //个人榜单按钮 + PersonalRankBtn = null; + + //页面 Page = 0; - //查询排名页数 - CheckPage = 1; - MaxPage = 50; + //查询排名 + CheckType = 0; //0组队 1个人 + RankPage = 0; //当前页数 + MaxRankPage = 1; //最大页数 + + //奖励 + RewardList = null; + RewardType = 0; + + //排行榜 + RankObject = null; + MyRankObject = null; + //计时器 @@ -46,21 +66,81 @@ class WorldBossC extends LenheartNewUI_Windows { constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { Childrens = []; - InitButtonConfig(); //注册控件 RegisterWidget(); - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); Pack_Control.rawset(20060002, function(Chunk) { local Jso = Json.Decode(Chunk); BaseInfo = Jso; + //临时 + for (local i = 0; i< BaseInfo.info.len(); i++) { + if (i == 0) BaseInfo.info[i].boss_name <- "斯卡萨侵袭"; + else BaseInfo.info[i].boss_name <- "世界BOSS" + i; + } + 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); }.bindenv(this)); Pack_Control.rawset(20060006, function(Chunk) { local Jso = Json.Decode(Chunk); - RankList = Jso.list; + MaxRankPage = Jso.maxPage; + RankObject = []; + foreach(Info in Jso.list) { + local T = { + idx = Info.rank, + name = Info.name, + time = "15:20", + 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 = "15:20", + damage = Jso.myteam.damage, + teamid = Jso.myteam.teamId, + 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) { @@ -69,7 +149,6 @@ class WorldBossC extends LenheartNewUI_Windows { TiemrCache = Jso.endTime; }.bindenv(this)); - PushDamageFontFuncTab.rawset("DamagePerSecondCFunc", function(ObjAddress, MySelfAddress, Value) { if (!SendDamagePackFlag) return; if (ObjAddress == 0 || ObjAddress == MySelfAddress) { @@ -79,147 +158,174 @@ class WorldBossC extends LenheartNewUI_Windows { }.bindenv(this)); - - // ChangePage(1); - // SendPackEx({ - // op = 20060005, - // page = 1 - // }) + // 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 InitButtonConfig() { - PvfInfo = Rindro_Script.GetFileData("etc/rindro/worldboss/worldboss.etc", function(DataTable, Data) { - while (!Data.Eof()) { - local Key = Data.Get(); - if (Key == "[Enter Button]") { - DataTable.EnterButton <- { - x = Data.Get(), - y = Data.Get(), - width = Data.Get(), - height = Data.Get() - } - } else if (Key == "[Refresh Button]") { - DataTable.RefreshButton <- { - x = Data.Get(), - y = Data.Get(), - width = Data.Get(), - height = Data.Get() - } - } else if (Key == "[Rank List]") { - DataTable.RankList <- { - x = Data.Get(), - y = Data.Get() - } - } else if (Key == "[Time Countdown]") { - DataTable.Countdown <- { - x = Data.Get(), - y = Data.Get() - } - } - } - }.bindenv(this)); + //请求奖励信息 + function RequestRewardInformation() { + if (Page == null) return; + local T = { + op = 20060001, + index = Page + } + SendPackEx(T); } - //标题栏 - Title = null; - function ChangePage(ToPage) { - foreach(ButtonObj in Title) { - ButtonObj.State = 0; - } Page = ToPage; - Title[ToPage].State = 1; + 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.boss_name); + if (Pos == 0) Tabbars1.State = 1; + Tabbars1.SetTextOffset(31 - LenheartTextClass.GetStringLength(Info.boss_name) / 2, 4); + AddChild(Tabbars1); + Tabbars1.OnClickEx = LogicFunc.bindenv(this); + Title.append(Tabbars1); + } } function RegisterWidget() { - Title = []; - local Tabbars1 = LenheartNewUI_TabbarsText(2, 27, "玩法简介"); - Tabbars1.State = 1; - Tabbars1.SetTextOffset(7, 4); - AddChild(Tabbars1); - Tabbars1.OnClick = function() { - ChangePage(0); - }.bindenv(this); - Title.append(Tabbars1); - - local Tabbars2 = LenheartNewUI_TabbarsText(64, 27, "世界BOSS"); - Tabbars2.SetTextOffset(7, 4); - AddChild(Tabbars2); - Tabbars2.OnClick = function() { - ChangePage(1); - }.bindenv(this); - Title.append(Tabbars2); - //关闭按钮 - local CloseButton = LenheartNewUI_BaseButton(600, 5, 11, 12, "interface/lenheartwindowcommon.img", 276); + local CloseButton = LenheartNewUI_BaseButton(738, 3, 11, 12, "interface/lenheartwindowcommon.img", 276); CloseButton.OnClick = function() { this.Visible = false; }.bindenv(this); Childrens.append(CloseButton); - //进入按钮 - local EnterButton = LenheartNewUI_BaseButton(PvfInfo.EnterButton.x, PvfInfo.EnterButton.y, PvfInfo.EnterButton.width, PvfInfo.EnterButton.height, "hud/worldboss.img", 1); - EnterButton.OnClick = function() { - SendPackEx({ - op = 20060007 - }) + local RankingRewardsButton = LenheartNewUI_ButtonText(42, 472, 40, "排名奖励"); + RankingRewardsButton.SetTextOffset(6, 1); + RankingRewardsButton.OnClickEx = function(Btn) { + RewardType = 0; }.bindenv(this); - EnterButton.SetCallBackFunc(function(Btn) { - if (Page == 1) - Btn.Visible = true; - else - Btn.Visible = false; - }.bindenv(this)) - Childrens.append(EnterButton); - - //刷新按钮 - local RefreshButton = LenheartNewUI_BaseButton(PvfInfo.RefreshButton.x, PvfInfo.RefreshButton.y, PvfInfo.RefreshButton.width, PvfInfo.RefreshButton.height, "hud/worldboss.img", 5); - RefreshButton.OnClick = function() { + AddChild(RankingRewardsButton); + local BasicRewardsButton = LenheartNewUI_ButtonText(170, 472, 40, "基础奖励"); + BasicRewardsButton.SetTextOffset(6, 1); + BasicRewardsButton.OnClickEx = function(Btn) { + RewardType = 1; }.bindenv(this); - RefreshButton.SetCallBackFunc(function(Btn) { - if (Page == 1) - Btn.Visible = true; - else - Btn.Visible = false; - }.bindenv(this)) - Childrens.append(RefreshButton); + 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); - //左按钮 - local LeftButton = LenheartNewUI_BaseButton(PvfInfo.RankList.x + 150, PvfInfo.RankList.y + 284, 12, 9, "interface/lenheartwindowcommon.img", 511); + 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; + 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; + CheckRank(); + }.bindenv(this); + AddChild(PersonalRankBtn); + + //左翻页按钮 + local LeftButton = LenheartNewUI_BaseButton(480, 416, 15, 15, "interface/lenheartwindowcommon.img", 34); LeftButton.OnClick = function() { - if (CheckPage > 1) CheckPage--; - SendPackEx({ - op = 20060005, - Page = CheckPage - }) + if (RankPage > 0) { + RankPage--; + CheckRank(); + } }.bindenv(this); - LeftButton.SetCallBackFunc(function(Btn) { - if (Page == 1) - Btn.Visible = true; - else - Btn.Visible = false; - }.bindenv(this)) - Childrens.append(LeftButton); - //关闭按钮 - local RightButton = LenheartNewUI_BaseButton(PvfInfo.RankList.x + 196, PvfInfo.RankList.y + 284, 12, 9, "interface/lenheartwindowcommon.img", 521); + AddChild(LeftButton); + + //右翻页按钮 + local RightButton = LenheartNewUI_BaseButton(550, 416, 15, 15, "interface/lenheartwindowcommon.img", 38); RightButton.OnClick = function() { - if (CheckPage< MaxPage) CheckPage++; - SendPackEx({ - op = 20060005, - page = CheckPage - }) + if (RankPage<(MaxRankPage - 1)) { + RankPage++; + CheckRank(); + } }.bindenv(this); - RightButton.SetCallBackFunc(function(Btn) { - if (Page == 1) - Btn.Visible = true; - else - Btn.Visible = false; - }.bindenv(this)) - Childrens.append(RightButton); + 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 @@ -227,73 +333,66 @@ class WorldBossC extends LenheartNewUI_Windows { //绘制主界面 function DrawMain(obj) { - //玩法简介 - if (Page == 0) { - WindowImg.DrawPng(0, X, Y); + + if (Page != null) { + WindowLogoImg.DrawExPng(Page, X + 1, Y + 19, 0, sq_RGBA(255, 255, 255, 220), 1.0, 1.0); } - //世界BOSS - else if (Page == 1) { - WindowImg.DrawPng(9, X, Y); - WindowImg.DrawPng(10, X + PvfInfo.RankList.x, Y + PvfInfo.RankList.y); - //绘制查询页数 - local Str = CheckPage + "/" + MaxPage; - L_sq_DrawCode(Str, X + PvfInfo.RankList.x + 179 - LenheartTextClass.GetStringLength(Str) / 2, Y + PvfInfo.RankList.y + 283, sq_RGBA(230, 200, 155, 255), 0, 1); + WindowImg.DrawPng(0, X, Y); - HoverFlag = null; - //绘制排行榜 - if (RankList) { - foreach(Pos, info in RankList) { - local Rank = info.rank.tostring(); - L_sq_DrawCode(Rank, X + PvfInfo.RankList.x + 18 - LenheartTextClass.GetStringLength(Rank) / 2, Y + PvfInfo.RankList.y + 10 + (Pos * 20), sq_RGBA(230, 200, 155, 255), 0, 1); + if (Page != null) { + WindowInfoImg.DrawExPng(Page, X + 19, Y + 66, 0, sq_RGBA(255, 255, 255, 220), 1.0, 1.0); + } - local TeamName = info.teamName; - L_sq_DrawCode(TeamName, X + PvfInfo.RankList.x + 70 - LenheartTextClass.GetStringLength(TeamName) / 2, Y + PvfInfo.RankList.y + 10 + (Pos * 20), sq_RGBA(230, 200, 155, 255), 0, 1); + 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 Damage = info.totalDamage.tostring(); - L_sq_DrawCode(Damage, X + PvfInfo.RankList.x + 150 - LenheartTextClass.GetStringLength(Damage) / 2, Y + PvfInfo.RankList.y + 10 + (Pos * 20), sq_RGBA(230, 200, 155, 255), 0, 1); - - if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + PvfInfo.RankList.x, Y + PvfInfo.RankList.y + (Pos * 20), 200, 20)) { - HoverFlag = Pos; - } - } + 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) { + foreach(Pos, ItemId in RewardList[RewardType]) { + DrawItemEx(X + 34 + (Pos * 36), Y + 423, ItemId, 1); } + } - //悬停层 - if (HoverFlag != null) { - L_sq_DrawWindow(X + PvfInfo.RankList.x, Y + PvfInfo.RankList.y + (HoverFlag * 20), 200, 100, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); - L_sq_DrawWindow(X + PvfInfo.RankList.x, Y + PvfInfo.RankList.y + (HoverFlag * 20), 200, 100, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + if (RankObject) { + foreach(Pos, Object in RankObject) { + Object.Show(X + 309, Y + 132 + (Pos * 40)); + } + } + if (MyRankObject) { + MyRankObject.Show(X + 309, Y + 434); + } + } - L_sq_DrawCode(RankList[HoverFlag].teamName, X + PvfInfo.RankList.x + 104 - LenheartTextClass.GetStringLength(RankList[HoverFlag].teamName) / 2, Y + PvfInfo.RankList.y + (HoverFlag * 20) + 14, sq_RGBA(83, 205, 255, 255), 0, 1); - local Yoffset = 40; - for (local Pos = 0; Pos < 4; Pos++) { - local info = { - name = "无队员", - job = "无职业", - damage = "0", - color = sq_RGBA(174, 174, 174, 255) - } - if(RankList[HoverFlag].team.len() > Pos) { - info = RankList[HoverFlag].team[Pos]; - info.color <- sq_RGBA(218, 248, 129, 255); - } - local Name = info.name; - L_sq_DrawCode(Name, X + PvfInfo.RankList.x + 28 - LenheartTextClass.GetStringLength(Name) / 2, Y + PvfInfo.RankList.y + (HoverFlag * 20) + Yoffset + (Pos * 20), info.color, 0, 1); - local Job = info.job; - L_sq_DrawCode(Job, X + PvfInfo.RankList.x + 110 - LenheartTextClass.GetStringLength(Job) / 2, Y + PvfInfo.RankList.y + (HoverFlag * 20) + Yoffset + (Pos * 20), info.color, 0, 1); - - local Damage = info.damage.tostring(); - L_sq_DrawCode(Damage, X + PvfInfo.RankList.x + 202 - LenheartTextClass.GetStringLength(Damage), Y + PvfInfo.RankList.y + (HoverFlag * 20) + Yoffset + (Pos * 20), info.color, 0, 1); + 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 DrawX = PvfInfo.Countdown.x; - local DrawY = PvfInfo.Countdown.y; + local CountdownX = 300; + local CountdownY = 0; + local DrawX = CountdownX; + local DrawY = CountdownY; //背景绘制 WindowTimeImg.DrawPng(1, DrawX, DrawY); WindowTimeImg.DrawPng(0, DrawX, DrawY + 2); @@ -316,8 +415,11 @@ class WorldBossC extends LenheartNewUI_Windows { } function DrawNum(time, Xoffset) { - local DrawX = PvfInfo.Countdown.x; - local DrawY = PvfInfo.Countdown.y; + 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); @@ -338,18 +440,26 @@ class WorldBossC extends LenheartNewUI_Windows { 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.dgn && mapIndex == BaseInfo.map) { + if (dungeonIndex == BaseInfo.info[Page].dgn && mapIndex == BaseInfo.info[Page].map) { if (!EnterMapPackFlag) { EnterMapPackFlag = true; SendPackEx({ - op = 20060013 + op = 20060013, + index = Page }) } SendDamagePackFlag = true; } else { SendDamagePackFlag = false; + EnterMapPackFlag = false; TiemrCache = null; Timer = null; } @@ -369,32 +479,31 @@ class WorldBossC extends LenheartNewUI_Windows { if (SendDamagePackFlag) { SendDamageT += Rindro_Duration; if (SendDamageT > 5000) { - SendDamageT = 0; - SendPackEx({ - op = 20060017, - Damage = TotalDamage.Value - }) - TotalDamage = null; + // 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; - - SendPackEx({ - op = 20060005, - page = 1 - }) } } @@ -403,10 +512,61 @@ 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 - 620) / 2).tointeger(), 64, 620, 430, 28); + 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 diff --git a/folder-alias.json b/folder-alias.json index 69e292e..d645530 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -154,5 +154,20 @@ }, "Project/AncientheroLuckyBox": { "description": "圣者遗物箱" + }, + "Project/Achievement_New": { + "description": "新成就系统" + }, + "Project/Fiendwar": { + "description": "超时空" + }, + "Project/Exchange": { + "description": "交易所" + }, + "Project/TreasureGoblin": { + "description": "宝藏哥布林" + }, + "Project/HM_CombatRank": { + "description": "毁梦定制-战力榜" } } \ No newline at end of file