From 6431e2ef389a3de7044ba1fbac5ff2b110ef455a Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Wed, 14 Jan 2026 20:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E7=B1=BB=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=81=93?= =?UTF-8?q?=E5=85=B7=E6=95=B0=E9=87=8F=E6=98=BE=E7=A4=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E7=A6=81=E7=94=A8=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=9F=E8=83=BD=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?UI=E5=85=83=E7=B4=A0=E4=BD=8D=E7=BD=AE=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/CallBack/DrawMain.nut | 3 +- Base/UI/Lenheart_UI_Class.nut | 14 + .../_Tool/CustomAnimation_Class.nut | 41 +- Base/_Tool/Hacker_RegApi.nut | 36 + Base/_Tool/Script_Class.nut | 66 +- CSBase/CallBack/DrawHudMain.nut | 37 - CSBase/CallBack/DrawMain.nut | 231 --- CSBase/CallBack/GetDamageRate.nut | 84 - CSBase/CallBack/PackControl.nut | 183 --- CSBase/CallBack/PushDamage.nut | 32 - CSBase/Interface.nut | 30 - CSBase/UI/Lenheart_Character_Info_Class.nut | 512 ------ CSBase/UI/Lenheart_Cursor_Class.nut | 57 - CSBase/UI/Lenheart_Each_Class.nut | 418 ----- CSBase/UI/Lenheart_Event_Class.nut | 374 ----- CSBase/UI/Lenheart_UI_Class.nut | 1456 ----------------- CSBase/UI/OldWindowsMap.nut | 52 - CSBase/_ENUM/_ENUM_.nut | 426 ----- CSBase/_Tool/Animation_Class.nut | 545 ------ CSBase/_Tool/BaseTool_Class.nut | 516 ------ CSBase/_Tool/Hacker_Class.nut | 60 - CSBase/_Tool/Hacker_RegApi.nut | 301 ---- CSBase/_Tool/Image_Class.nut | 80 - CSBase/_Tool/Json_Class.nut | 661 -------- CSBase/_Tool/MemoryClass.nut | 204 --- CSBase/_Tool/Packet_Class.nut | 61 - CSBase/_Tool/Script_Class.nut | 713 -------- CSBase/_Z_Data/CharacterInfoData.nut | 113 -- FileConfig.json | 42 + Project/FixItemCout/FixItemCout.nut | 138 ++ .../ItemTool/ItemCrossover/ItemCrossover.nut | 4 +- Project/ItemTool/ItemFusion/ItemFusion.nut | 28 +- Project/ItemTool/ItemInherit/ItemInherit.nut | 1 + .../ItemOtherWolrdUpgrade.nut | 353 ++++ folder-alias.json | 9 + 35 files changed, 668 insertions(+), 7213 deletions(-) rename CSBase/UI/Lenheart_Ani_Class.nut => Base/_Tool/CustomAnimation_Class.nut (66%) delete mode 100644 CSBase/CallBack/DrawHudMain.nut delete mode 100644 CSBase/CallBack/DrawMain.nut delete mode 100644 CSBase/CallBack/GetDamageRate.nut delete mode 100644 CSBase/CallBack/PackControl.nut delete mode 100644 CSBase/CallBack/PushDamage.nut delete mode 100644 CSBase/Interface.nut delete mode 100644 CSBase/UI/Lenheart_Character_Info_Class.nut delete mode 100644 CSBase/UI/Lenheart_Cursor_Class.nut delete mode 100644 CSBase/UI/Lenheart_Each_Class.nut delete mode 100644 CSBase/UI/Lenheart_Event_Class.nut delete mode 100644 CSBase/UI/Lenheart_UI_Class.nut delete mode 100644 CSBase/UI/OldWindowsMap.nut delete mode 100644 CSBase/_ENUM/_ENUM_.nut delete mode 100644 CSBase/_Tool/Animation_Class.nut delete mode 100644 CSBase/_Tool/BaseTool_Class.nut delete mode 100644 CSBase/_Tool/Hacker_Class.nut delete mode 100644 CSBase/_Tool/Hacker_RegApi.nut delete mode 100644 CSBase/_Tool/Image_Class.nut delete mode 100644 CSBase/_Tool/Json_Class.nut delete mode 100644 CSBase/_Tool/MemoryClass.nut delete mode 100644 CSBase/_Tool/Packet_Class.nut delete mode 100644 CSBase/_Tool/Script_Class.nut delete mode 100644 CSBase/_Z_Data/CharacterInfoData.nut create mode 100644 Project/FixItemCout/FixItemCout.nut create mode 100644 Project/ItemTool/ItemOtherWolrdUpgrade/ItemOtherWolrdUpgrade.nut diff --git a/Base/CallBack/DrawMain.nut b/Base/CallBack/DrawMain.nut index c90eb6a..1ca4177 100644 --- a/Base/CallBack/DrawMain.nut +++ b/Base/CallBack/DrawMain.nut @@ -186,4 +186,5 @@ function L_drawMainCustomUI_All() { // ::print("\t\n") // } -// } \ No newline at end of file +// } + diff --git a/Base/UI/Lenheart_UI_Class.nut b/Base/UI/Lenheart_UI_Class.nut index 6a2cebf..cf79f59 100644 --- a/Base/UI/Lenheart_UI_Class.nut +++ b/Base/UI/Lenheart_UI_Class.nut @@ -1505,6 +1505,7 @@ class LenheartNewUI_ItemSlot extends LenheartNewUI_CommonUi { ItemCount = null; ItemObject = null; ItemInfoWindow = null; + HoverFlag = false; //禁止点击 NoClick = false; @@ -1535,6 +1536,19 @@ class LenheartNewUI_ItemSlot extends LenheartNewUI_CommonUi { } } } + CheckInRect(); + } + + function CheckInRect() { + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, 30, 30)) { + //绘制悬停框 + L_sq_SetDrawImgModel(2, 0); + Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X, Y); + L_sq_ReleaseDrawImgModel(); + HoverFlag = true; + } else HoverFlag = false; } function SetItem(item) { diff --git a/CSBase/UI/Lenheart_Ani_Class.nut b/Base/_Tool/CustomAnimation_Class.nut similarity index 66% rename from CSBase/UI/Lenheart_Ani_Class.nut rename to Base/_Tool/CustomAnimation_Class.nut index a501dbd..51ca7e9 100644 --- a/CSBase/UI/Lenheart_Ani_Class.nut +++ b/Base/_Tool/CustomAnimation_Class.nut @@ -1,15 +1,16 @@ /* -文件名:Lenheart_Ani_Class.nut -路径:Base/UI/Lenheart_Ani_Class.nut -创建日期:2024-08-06 18:56 -文件用途:Ani +文件名:CustomAnimation_Class.nut +路径:Base/_Tool/CustomAnimation_Class.nut +创建日期:2026-01-13 19:54 +文件用途: */ -class Lenheart_Ani { - - X = 0; - Y = 0; +class Rindro_CustomAnimation { + //Img路径 ImgPath = null; + //Img对象 + Img = null; + //帧信息 ImgFrame = null; @@ -27,22 +28,27 @@ class Lenheart_Ani { //img 路径 调用帧数组 - constructor(path, frame, Pos) { - ImgPath = ("Character/" + path + ".img").tolower(); + constructor(path, frame) { + ImgPath = path.tolower(); + Img = Rindro_Image(ImgPath); ImgFrame = frame; InitTime = Clock(); State = 1; - X = Pos[0]; - Y = Pos[1]; + + //预载入img + foreach(FrameObj in ImgFrame) { + Img.DrawPng(FrameObj.ImgIndex, -999, 999); + } } - function Show(dt) { + function Show(dt, X, Y) { if (State == 1) { if (ImgFrame) { local NowFrameObj = ImgFrame[CurFrame]; PlayCurTime += dt; - L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y); + Img.DrawPng(NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y); + if (PlayCurTime >= NowFrameObj.Delay) { CurFrame++; //播放完成 @@ -57,12 +63,12 @@ class Lenheart_Ani { } } - function ShowEx(dt,gRgba,rate_x,rate_y) { + function ShowEx(dt, X, Y, gRgba, rate_x, rate_y) { if (State == 1) { if (ImgFrame) { local NowFrameObj = ImgFrame[CurFrame]; PlayCurTime += dt; - L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y,1,gRgba,rate_x,rate_y); + Img.DrawExPng(NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y, 0, gRgba, rate_x, rate_y); if (PlayCurTime >= NowFrameObj.Delay) { CurFrame++; //播放完成 @@ -77,8 +83,7 @@ class Lenheart_Ani { } } - function Reset() - { + function Reset() { CurFrame = 0; State = 1; } diff --git a/Base/_Tool/Hacker_RegApi.nut b/Base/_Tool/Hacker_RegApi.nut index 8c3bc87..9cfc3a7 100644 --- a/Base/_Tool/Hacker_RegApi.nut +++ b/Base/_Tool/Hacker_RegApi.nut @@ -408,3 +408,39 @@ Rindro_Haker.LoadHook(0x7B64BA, ["int", "int", "bool"], // TTTAni <- args.pop(); return null; }); + + +// Rindro_Haker.LoadHook(0x7FFA80, ["int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "void"], +// function(args) { +// if(args[0] == 0xA){ +// args[1] = 4600563; +// printf("切换武器") +// return args; +// } +// // foreach (Func in WearOrRemoveEquipmentCallBackFunc) { +// // Func(args); +// // } +// // print(args[1]); +// // local ThisC = NativePointer(0x1A5FB24).readInt(); +// // local Slot = NativePointer(Rindro_Haker.CpuContext.ebp).add(8).readInt(); + +// // local EquiObj = L_Sq_CallFunc(0x7B03C0, "int", FFI_FASTCALL, ["int", "int", "int"], ThisC, 0, Slot); +// // if (EquiObj) { +// // local Index = NativePointer(EquiObj).add(0x1c).readInt(); +// // print(Index); +// // } +// return null; +// }, +// function(args) { +// // print(666); +// // print(format("%02x", args.pop())); +// // TTTAni <- args.pop(); +// return null; +// }); + + +// NativePointer(0x8266F5).writeShort(0x9090) +// NativePointer(0x78FD37).writeShort(0x9090) +// NativePointer(0x78FD3B).writeShort(0x9090) + + diff --git a/Base/_Tool/Script_Class.nut b/Base/_Tool/Script_Class.nut index 41704de..fdb07e0 100644 --- a/Base/_Tool/Script_Class.nut +++ b/Base/_Tool/Script_Class.nut @@ -239,6 +239,8 @@ class Rindro_Script { local Key = Rindro_Script.GetBinString(FindKey); if (Key) { local StrFilePath = Key.tolower(); + local Type = StrFilePath.slice(0, StrFilePath.find("/")).tolower(); + getroottable().RindroLoadStringTable.rawset(Type, {}); local StrFile = R_Utils.GetScriptFileReader(StrFilePath, 10240000); if (StrFile) { local StrBuffer = StrFile.Buffer.readUtf8String(StrFile.Size); @@ -247,7 +249,7 @@ class Rindro_Script { if (strobj.find(">") != null) { local strobjarr = split(strobj, ">"); if (strobjarr.len() > 1) { - getroottable().RindroLoadStringTable.rawset(strobjarr[0], Sq_ConvertWideChar(strobjarr[1], "big5")); + getroottable().RindroLoadStringTable[Type].rawset(strobjarr[0], Sq_ConvertWideChar(strobjarr[1], "big5")); } } } @@ -293,17 +295,28 @@ class Rindro_Script { } } - function GetLoadString(Key) { - if (getroottable().RindroLoadStringTable.rawin(Key)) return getroottable().RindroLoadStringTable[Key]; + function GetLoadString(Type, Key) { + if (getroottable().RindroLoadStringTable.rawin(Type) && getroottable().RindroLoadStringTable[Type].rawin(Key)) return getroottable().RindroLoadStringTable[Type][Key]; else return ""; } - function UnpackData(IO, i) { + function UnpackData(IO, i, Type) { local out = ""; IO.seek(i); //内容指示位 local currentByte = IO.readn('c'); //内容指示位 local after = IO.GetInt(); switch (currentByte) { + case 9: { + local NewcurrentByte = IO.readn('c'); + local Newafter = IO.GetInt(); + local Buf = Rindro_Script.GetBinString(after); + if (!Buf) { + Buf = ""; + } else { + Buf = Rindro_Script.GetLoadString(Type, Buf); + } + return Buf; + } case 10: { IO.seek(i - 4); local Before = IO.readn('i'); @@ -311,7 +324,7 @@ class Rindro_Script { if (!Buf) { Buf = ""; } else { - Buf = "<" + Before + "::" + Buf + "`" + Rindro_Script.GetLoadString(Buf) + "`>"; + Buf = "<" + Before + "::" + Buf + "`" + Rindro_Script.GetLoadString(Type, Buf) + "`>"; } Buf = Buf + "\r\n"; out += Buf; @@ -327,8 +340,7 @@ class Rindro_Script { Bbuf.writen(after, 'i'); Bbuf.seek(0); local Buf = Bbuf.readn('f'); - out += after + '\t'; - break; + return Buf; } case 6: case 8: @@ -338,15 +350,8 @@ class Rindro_Script { if (!Buf) Buf = ""; return Buf; } - case 9: { - IO.seek(i + 6); - local Before = IO.readn('i'); - local Buf = Rindro_Script.GetBinString(Before); - out += Rindro_Script.GetLoadString(Buf); - } default: - out += ""; - break; + return ""; } return out; @@ -363,24 +368,24 @@ class Rindro_Script { local i = 2; while (true) { if (i< ReadObject.Size && ReadObject.Size - i >= 5) { - local str = Rindro_Script.UnpackData(IO, i); + local str = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; //名称 if (str == "[name]") { local RealKey = str.slice(1, str.len() - 1); - EquipmentAtt[RealKey] <- Rindro_Script.UnpackData(IO, i); + EquipmentAtt[RealKey] <- Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; } //装备类型 else if (str == "[equipment type]") { - local Buf = Rindro_Script.UnpackData(IO, i); + local Buf = Rindro_Script.UnpackData(IO, i, "equipment"); EquipmentAtt["equipment_type"] <- Buf.slice(1, -1); i += 5; } //称号动画 else if (str == "[custom animation]") { - local Buf = Rindro_Script.UnpackData(IO, i).tolower(); + local Buf = Rindro_Script.UnpackData(IO, i, "equipment").tolower(); EquipmentAtt["custom_animation"] <- Buf; i += 5; } @@ -389,12 +394,12 @@ class Rindro_Script { EquipmentAtt["Aurora"] <- {}; EquipmentAtt["Aurora"].Back <- []; EquipmentAtt["Aurora"].Front <- []; - local Count = Rindro_Script.UnpackData(IO, i); + local Count = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; for (local z = 0; z< Count; z++) { - local Layer = Rindro_Script.UnpackData(IO, i); + local Layer = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; - local Path = Rindro_Script.UnpackData(IO, i).tolower(); + local Path = Rindro_Script.UnpackData(IO, i, "equipment").tolower(); i += 5; if (Layer == 0) EquipmentAtt["Aurora"].Back.append(Path); if (Layer == 1) EquipmentAtt["Aurora"].Front.append(Path); @@ -405,7 +410,7 @@ class Rindro_Script { else if (str == "[hide layer]") { EquipmentAtt["hidelayer"] <- []; while (true) { - local Buffer = Rindro_Script.UnpackData(IO, i); + local Buffer = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; if (Buffer == "[/hide layer]") { break; @@ -415,7 +420,7 @@ class Rindro_Script { } //Ani else if (str == "[animation job]") { - local Job = Rindro_Script.UnpackData(IO, i).slice(1, -1); + local Job = Rindro_Script.UnpackData(IO, i, "equipment").slice(1, -1); local SpacePos = Job.find(" "); if (SpacePos) { Job = Job.slice(0, SpacePos) + Job.slice(SpacePos + 1); @@ -424,24 +429,24 @@ class Rindro_Script { EquipmentAtt["Ani_" + Job] <- {}; i += 5; - local Index1 = Rindro_Script.UnpackData(IO, i); + local Index1 = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; - local Index2 = Rindro_Script.UnpackData(IO, i); + local Index2 = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; EquipmentAtt["Ani_" + Job].variation <- [Index1, Index2]; EquipmentAtt["Ani_" + Job].layer_variation <- []; while (true) { try { - local Ret = Rindro_Script.UnpackData(IO, i); + local Ret = Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; if (Ret == "[animation job]" || (Rindro_Script.endswith(Ret, "]") && Ret != "[equipment ani script]" && Ret != "[layer variation]")) { i -= 5; break; } else if (Ret == "[layer variation]") { local InfoBuf = {}; - InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i); + InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; - InfoBuf.Path <- Rindro_Script.UnpackData(IO, i); + InfoBuf.Path <- Rindro_Script.UnpackData(IO, i, "equipment"); i += 5; EquipmentAtt["Ani_" + Job].layer_variation.append(InfoBuf); } @@ -692,13 +697,14 @@ class Rindro_Script { function ResolvingData(IO, Func, Path) { local DataTable = {}; DataTable.filepath <- Path; + local Type = Path.slice(0, Path.find("/")).tolower(); local DataArr = []; local Length = IO.len(); if (Length >= 7) { local i = 2; while (true) { if (i< Length && Length - i >= 5) { - local str = Rindro_Script.UnpackData(IO, i); + local str = Rindro_Script.UnpackData(IO, i, Type); i += 5; DataArr.push(str); } else break; diff --git a/CSBase/CallBack/DrawHudMain.nut b/CSBase/CallBack/DrawHudMain.nut deleted file mode 100644 index 96437c1..0000000 --- a/CSBase/CallBack/DrawHudMain.nut +++ /dev/null @@ -1,37 +0,0 @@ -/* -文件名:DrawHudMain.nut -路径:Base/CallBack/DrawHudMain.nut -创建日期:2024-08-29 09:39 -文件用途: -*/ -//血槽背景 -function L_HUD_BloodBackground() { - local RootTab = getroottable(); - local obj = sq_getMyCharacter(); - if (!obj) return; - if (RootTab.rawin("HudUi_Obj")) { - RootTab.HudUi_Obj.BottomShow(obj); - } - if (RootTab.rawin("EventList_Obj")) { - foreach(win in EventList_Obj.Events) { - win.EventShow(obj); - } - } - -} - -getroottable().Camera_Pos <- {}; - -//城镇摄像机 -function L_Sync_Camera_Pos(Camera_Object) { - // print(Camera_Object); - // print(Camera_Object); - getroottable().Camera_Pos.X <- L_sq_RA(Camera_Object + 0x638); - getroottable().Camera_Pos.Y <- L_sq_RA(Camera_Object + 0x63C); -} - - -function Sq_DrawChannel() { - // L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer_calendarui.img", 0, 0, 0); -} - diff --git a/CSBase/CallBack/DrawMain.nut b/CSBase/CallBack/DrawMain.nut deleted file mode 100644 index 98dd929..0000000 --- a/CSBase/CallBack/DrawMain.nut +++ /dev/null @@ -1,231 +0,0 @@ -/* -文件名:DrawMain.nut -路径:Base/CallBack/DrawMain.nut -创建日期:2024-08-06 18:58 -文件用途:绘制回调 -*/ -//在DrawMain后面调用 -function L_drawMainCustomUI_All() { - - local obj = sq_getMyCharacter(); - if (!obj) return; - - local RootTab = getroottable(); - - //获取与上一帧的dt - if (!(RootTab.rawin("Rindro_DurationFlag"))) { - Rindro_DurationFlag <- L_Getmicroseconds(); - Rindro_Duration <- 0; - } else { - local NowM = L_Getmicroseconds(); - Rindro_Duration = (NowM - Rindro_DurationFlag); - Rindro_DurationFlag = NowM; - } - - //下帧执行任务事件 - if (RootTab.rawin("LenheartNextFrameFuncTab")) { - foreach(Func in RootTab["LenheartNextFrameFuncTab"]) { - Func(); - } - RootTab["LenheartNextFrameFuncTab"] = []; - } else { - RootTab.LenheartNextFrameFuncTab <- []; - } - - //重载逻辑 - Sq_ReloadLogic(); - - //初始化活动图标 - Lenheart_EventList_Fun(obj); - - //加载注册Base函数窗口 - if (RootTab.rawin("LenheartBaseFuncTab")) { - local LenheartFunc = RootTab["LenheartBaseFuncTab"]; - foreach(Func in LenheartFunc) { - Func(obj); - } - } - - //加载注册Ex函数窗口 - if (RootTab.rawin("LenheartFuncTab")) { - local LenheartFunc = RootTab["LenheartFuncTab"]; - foreach(name,Func in LenheartFunc) { - - if(name = "GetDamageRateFuncN"){ - print(name); - Func(obj); - } - - } - } - - //所有插件初始化完毕 - if (!getroottable().rawin("LenheartPluginsInitFlag")) { - local T = { - op = 25001021, - } - Rindro_BaseToolClass.SendPackEx(T); - 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); -// TTTAAA <- null; - -// L_NewWindows("Lenheart", 56, 0x1); -// L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], 0x01ADE090, 56, 0, 0); -// getroottable().Lsnzz <- Clock(); - -// dofile("sqr/Base/_Tool/Json.nut"); - -// print(T); - - - -// Register_DPS_Pack(1, function(Jso) { -// printT(Jso); -// }); - -// for (local i = 0; i< 50; i++) { -// local asos = sq_CreateCharacter(0,0); -// // asos.setValid(false); -// // local obj = sq_GetCNRDObjectToActiveObject(asos); -// // sq_SendDestroyPacketPassiveObject(obj); -// // sendDestroyPacket(obj); - -// // sq_SendDestroyPacketPassiveObject(asos); - -// // sq_AddObject(sq_getMyCharacter(), asos, OBJECTTYPE_VIRTUALCHARACTER, false); -// // asos.setValid(false); -// // L_sq_Test(L_Sq_GetObjectAddress(asos)); -// L_Sq_CallFunc(0x5A44B0, "void", FFI_MS_CDECL, ["int"], L_Sq_GetObjectAddress(asos)); -// } - - - - -// local asos = sq_CreateAICharacter(900); - - - -// // sq_DeleteParticleCreater(asos); -// local asos = sq_CreateAICharacter(419); -// asos.setCurrentPos(sq_getMyCharacter().getXPos() + 100, sq_getMyCharacter().getYPos(), 0); -// sq_AddObject(sq_getMyCharacter(), asos, OBJECTTYPE_VIRTUALCHARACTER, false); -// sq_ChangeDrawLayer(asos, ENUM_DRAWLAYER_CLOSEBACK); - - -// 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; -// }); - - - -// function onAttack_Swordman(obj, damager, boundingBox, isStuck) -// { -// local Mon = sq_GetCNRDObjectToActiveObject(damager); -// Mon.setHp(0, null, true); -// } - -// function getCurrentModuleDamageRate(obj) { -// local LLJob = sq_getJob(obj); -// local LLGrowT = sq_getGrowType(obj); -// if (LLJob == 0 && LLGrowT == 2) -// return 2100000000.0; - -// return 1.0; -// } - -// function onStartDungeon_Swordman(obj) { -// print(666); -// obj.setEnableDamageBox(false); -// } - - -// local chrobj = sq_CreateCharacter(0, 4); - -// print("-----------------------------------------------/"); -// foreach(member, val in chrobj.getclass()) { -// ::print(member + "\n"); -// local attr; -// if ((attr = chrobj.getclass().getattributes(member)) != null) { -// foreach(i, v in attr) { -// ::print("\t" + i + " = " + (typeof v) + "\n"); -// } -// } else { -// ::print("\t\n") -// } - -// } \ No newline at end of file diff --git a/CSBase/CallBack/GetDamageRate.nut b/CSBase/CallBack/GetDamageRate.nut deleted file mode 100644 index 8f6bcce..0000000 --- a/CSBase/CallBack/GetDamageRate.nut +++ /dev/null @@ -1,84 +0,0 @@ -/* -文件名:GetDamageRate.nut -路径:Base/CallBack/GetDamageRate.nut -创建日期:2024-08-09 14:10 -文件用途:获取伤害倍率 -*/ -RindroDamageRate <- 1.0; - -function L_getCurrentModuleDamageRate(obj) { - if (!obj) - return 1.0; - - local ClientRat = 1.0; - try { - ClientRat = getCurrentModuleDamageRate(obj).tofloat(); - } catch (exception) { - ClientRat = 1.0; - } - - return (RindroDamageRate * ClientRat); -} - - -function Lenheart_GetDamageRate_Fun(obj) { - //在城镇时 - if (sq_GetCurrentModuleType() == 1) { - RindroDamageRate = 1.0; - } -} - -//修改伤害回调 -function SetDamageRateCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - RindroDamageRate = Jso.rate; -} -Pack_Control.rawset(2024110902, SetDamageRateCallBack); - -getroottable()["LenheartFuncTab"].rawset("GetDamageRateFuncN", Lenheart_GetDamageRate_Fun); - - -// ModuleDamageTable <- { -// //这个1是 副本编号 -// [1] = { -// //这个0是大职业编号 比如说鬼剑士就是 0 女格斗家就是 1 在character/character.lst 这个文件里可以看 -// [0] = { -// //这个0 和 1 是转职编号 0就是未转职 1 就是转了剑魂 -// [0] = 1.0, -// [1] = 3.0 -// } -// }, -// //2号副本 -// [2] ={ -// //女格斗家职业 -// [1] = { -// [0] = 1.0, -// [1] = 3.0 -// } -// } -// } - - -// function getCurrentModuleDamageRate(obj) -// { -// local Rate = 1.0; -// local stage = sq_GetGlobaludpModuleStage(); -// local dungeon = sq_GetDungeonByStage(stage); -// local dungeonIndex = sq_GetDuegonIndex(dungeon); - -// local LLJob = sq_getJob(obj); -// local LLGrowT = sq_getGrowType(obj); - -// //处于生效副本中 -// if(ModuleDamageTable.rawin(dungeonIndex)){ -// //自己是生效职业 -// if(ModuleDamageTable[dungeonIndex].rawin(LLJob)){ -// //是生效转职 -// if(ModuleDamageTable[dungeonIndex][LLJob].rawin(LLGrowT)){ -// Rate += ModuleDamageTable[dungeonIndex][LLJob][LLGrowT].tofloat(); -// } -// } -// } - -// return Rate; -// } \ No newline at end of file diff --git a/CSBase/CallBack/PackControl.nut b/CSBase/CallBack/PackControl.nut deleted file mode 100644 index 60a2430..0000000 --- a/CSBase/CallBack/PackControl.nut +++ /dev/null @@ -1,183 +0,0 @@ -/* -文件名:PackControl.nut -路径:Base/PackControl/PackControl.nut -创建日期:2024-08-06 22:13 -文件用途: -*/ -Pack_Control <- {} -Pack_Hex_Control <- {} -Pack_DPS_Control <- {} - -function Register_DPS_Pack(Id, Func) { - Pack_DPS_Control.rawset(Id, Func); -} - -function Sq_Pack_Control(Chunk) { - try { - local Pack_Json = Json.Decode(Chunk); - if (Pack_Json.op == 2147483646) { - if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) { - local Jso = Json.Decode(Chunk); - Jso.rawdelete("op"); - Pack_DPS_Control[Pack_Json.dps_id](Jso); - } - } else { - if (Pack_Control.rawin(Pack_Json.op)) { - try { - Pack_Control[Pack_Json.op](Chunk); - } catch (exception) { - print("error pack: " + Pack_Json.op); - } - } - } - } catch (exception) { - // print("error packmsg: " + Pack_Json.op); - print(exception); - } - -} - -function Sq_Pack_ControlLocal(Chunk) { - local Pack_Json = Json.Decode(Chunk); - if (Pack_Json.op == 2147483646) { - if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) { - local Jso = Json.Decode(Chunk); - Jso.rawdelete("op"); - Pack_DPS_Control[Pack_Json.dps_id](Jso); - } - } else { - if (Pack_Control.rawin(Pack_Json.op)) { - Pack_Control[Pack_Json.op](Chunk); - } - } -} - -//字节流包 -function Sq_BlobPack_Control(Size, Pointer) { - local Pack = Packet(); - Pack.Load(Pointer, Size); - local Op = Pack.GetInt(); - //读取位置回到原点 - // Pack.Seek(0); - - if (Pack_Hex_Control.rawin(Op)) { - Pack_Hex_Control[Op](Pack); - } -} - - -function SendPackToDP_S(Id, T) { - T.op <- 2147483646; - T.dps_id <- Id; - Rindro_BaseToolClass.SendPackEx(T); -} - - -//进入副本回调 -function LenheartGotoDgnCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - local DgnId = Jso.map.id; - local DgnRate = Jso.map.ra; - L_sq_GoDungeon(DgnId); -} -Pack_Control.rawset(2024041602, LenheartGotoDgnCallBack); - - -//进入副本增加属性 -function LenheartAdditionalAttributes(obj) { - obj = sq_ObjectToSQRCharacter(obj); - //在副本中 - if (sq_GetCurrentModuleType() == 3) { - if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/lenheartap.nut")) { - if ("LenheartAttributesTable" in getroottable()) { - local Abarr = {}; - foreach(AtObj in getroottable()["LenheartAttributesTable"]) { - foreach(Apos, At in AtObj) { - if (!Abarr.rawin(Apos)) Abarr[Apos] <- At; - else Abarr[Apos] += At; - } - } - - local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, -1, false, "appendage/lenheartap.nut", true); - - CNSquirrelAppendage.sq_Append(appendage, obj, obj); - local change_appendage = appendage.sq_getChangeStatus("Yosin_LenheartDgnBuff"); - if (!change_appendage) { - change_appendage = appendage.sq_AddChangeStatusAppendageID(obj, obj, 0, - CHANGE_STATUS_TYPE_COOLTIME_DECLINE, - false, 0, 115514); - } - if (change_appendage) { - change_appendage.clearParameter(); - - foreach(Key, Value in Abarr) { - if (Key == 0) change_appendage.addParameter(13, false, Value.tofloat()); //HP - else if (Key == 1) change_appendage.addParameter(48, false, Value.tofloat()); //MP - else if (Key == "strength") change_appendage.addParameter(0, false, Value.tofloat()); //力量 - else if (Key == "intelligence") change_appendage.addParameter(1, false, Value.tofloat()); //智力 - else if (Key == "vitality") change_appendage.addParameter(2, false, Value.tofloat()); //体力 - else if (Key == "spirit") change_appendage.addParameter(3, false, Value.tofloat()); //精神 - else if (Key == "physicalAttack") change_appendage.addParameter(4, false, Value.tofloat()); //物攻 - else if (Key == "magicAttack") change_appendage.addParameter(31, false, Value.tofloat()); //魔攻 - else if (Key == "independentAttack") { - change_appendage.addParameter(53, false, Value.tofloat()); //独立 - change_appendage.addParameter(54, false, Value.tofloat()); //独立 - } else if (Key == "physicalDefense") change_appendage.addParameter(5, false, Value.tofloat()); //物理防御 - else if (Key == "magicDefense") change_appendage.addParameter(32, false, Value.tofloat()); //魔法防御 - else if (Key == "physicalCritical") change_appendage.addParameter(15, false, Value.tofloat() / 10.0); //物理暴击 - else if (Key == "magicCritical") change_appendage.addParameter(16, false, Value.tofloat() / 10.0); //魔法暴击 - else if (Key == "attackSpeed") change_appendage.addParameter(10, false, Value.tofloat()); //攻速 - else if (Key == "releaseSpeed") change_appendage.addParameter(12, false, Value.tofloat()); //释放 - else if (Key == "moveSpeed") change_appendage.addParameter(11, false, Value.tofloat()); //移速 - else if (Key == "resistance") change_appendage.addParameter(39, false, Value.tofloat()); //抗磨 - else if (Key == "hitRate") change_appendage.addParameter(33, false, Value.tofloat()); //命中 - else if (Key == "avoidance") change_appendage.addParameter(27, false, Value.tofloat()); //闪避 - else if (Key == "hpRecovery") change_appendage.addParameter(14, false, Value.tofloat()); //HP恢复 - else if (Key == "mpRecovery") change_appendage.addParameter(29, false, Value.tofloat()); //MP恢复 - else if (Key == "stun") change_appendage.addParameter(41, false, Value.tofloat()); //僵直 - else if (Key == "hardStun") change_appendage.addParameter(34, false, Value.tofloat()); //硬直 - else if (Key == "fire") change_appendage.addParameter(42, false, Value.tofloat()); //火强 - else if (Key == "fireResistance") change_appendage.addParameter(20, false, Value.tofloat()); //火抗 - else if (Key == "water") change_appendage.addParameter(43, false, Value.tofloat()); //冰强 - else if (Key == "waterResistance") change_appendage.addParameter(21, false, Value.tofloat()); //冰抗 - else if (Key == "light") change_appendage.addParameter(45, false, Value.tofloat()); //光强 - else if (Key == "lightResistance") change_appendage.addParameter(23, false, Value.tofloat()); //光抗 - else if (Key == "dark") change_appendage.addParameter(44, false, Value.tofloat()); //暗强 - else if (Key == "darkResistance") change_appendage.addParameter(22, false, Value.tofloat()); //暗抗 - } - } - } - } - } -} - -if (getroottable().rawin("LenheartFuncTab")) { - getroottable()["LenheartFuncTab"].rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes); -} else { - local T = {}; - T.rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes); - getroottable().rawset("LenheartFuncTab", T); -} - - -//进入副本增加属性 -function LenheartAdditionalCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - if ("LenheartAttributesTable" in getroottable()) { - local T = getroottable()["LenheartAttributesTable"]; - T.rawset("LenheartCollectBoxAb", Jso.Attribute); - } else { - local T = {}; - T.rawset("LenheartCollectBoxAb", Jso.Attribute); - getroottable().rawset("LenheartAttributesTable", T); - } -} -Pack_Control.rawset(20069016, LenheartAdditionalCallBack); - - -getroottable().PluginsCompatibilityModeCallBack <- false; -//兼容模式 -function CompatibilityModeCallBack(Chunk) { - getroottable().PluginsCompatibilityModeCallBack <- true; -} -Pack_Control.rawset(30004, CompatibilityModeCallBack); \ No newline at end of file diff --git a/CSBase/CallBack/PushDamage.nut b/CSBase/CallBack/PushDamage.nut deleted file mode 100644 index b65c7c6..0000000 --- a/CSBase/CallBack/PushDamage.nut +++ /dev/null @@ -1,32 +0,0 @@ -/* -文件名:PushDamage.nut -路径:Base/CallBack/PushDamage.nut -创建日期:2024-08-30 14:41 -文件用途:发生伤害时 -*/ -PushDamageFontDataFuncTab <- {}; -PushDamageFontFuncTab <- {}; - -function Sq_PushDamageData(ObjAddress, MySelfAddress, Value) { - // print("MyCharacter: " + format("%02x", L_sq_RA(0x1AB7CDC))); - // print("ObjAddress: " + format("%02x", ObjAddress)); - // print("A1: " + format("%02x", A1)); - // print("A2: " + format("%02x", A2)); - // print(" "); - foreach(Func in PushDamageFontFuncTab) { - Func(ObjAddress, MySelfAddress, Value); - } -} - -function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A1, A2) { - - local Flag = true; - foreach(Func in PushDamageFontDataFuncTab) { - local Ret = Func(ObjAddress, X, Y, Z, Value, Type, A1, A2); - if (Ret == false) { - Flag = false; - } - } - - return Flag; -} \ No newline at end of file diff --git a/CSBase/Interface.nut b/CSBase/Interface.nut deleted file mode 100644 index 0f5c9a2..0000000 --- a/CSBase/Interface.nut +++ /dev/null @@ -1,30 +0,0 @@ -/* -文件名:Interface.nut -路径:Base/Interface.nut -创建日期:2025-05-01 07:39 -文件用途:所有基础文件加载以后 将会执行的逻辑 用于初始化一些接口和默认设置 -*/ - -//消息框黏贴 -NativePointer(0x011C53B0).writeShort(0x1B0); - -//修复233号弹窗 -NativePointer(0x00727017).writeByteArray([0xEB, 0x11, 0x90, 0x90, 0x90, 0x90, 0x90]); - -//反遍历函数 -NativePointer(0x1370FD7).writeInt(0); - -//全局的道具信息 -if (!getroottable().rawin("Rindro_ItemInfoObject")) Rindro_ItemInfoObject <- {}; - -//开启热重载目录 -if(getroottable().rawin("RINDROLOCAL") && RINDROLOCAL == true)Sq_AutoReload("sqr"); - - -print("cs base "); -print("cs base "); -print("cs base "); -print("cs base "); -print("cs base "); -print("cs base "); -print("cs base "); \ No newline at end of file diff --git a/CSBase/UI/Lenheart_Character_Info_Class.nut b/CSBase/UI/Lenheart_Character_Info_Class.nut deleted file mode 100644 index 018e9f7..0000000 --- a/CSBase/UI/Lenheart_Character_Info_Class.nut +++ /dev/null @@ -1,512 +0,0 @@ -/* -文件名:Lenheart_Character_Info_Class.nut -路径:Base/UI/Lenheart_Character_Info_Class.nut -创建日期:2024-08-27 12:13 -文件用途:个人信息属性面板 -*/ -return; -class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows { - //调试模式 - // DeBugMode = true; - - //不是窗口 - NoWindow = true; - - //是否可见 - Visible = false; - - //图标路径 - IconPath = "interface2/profile/profile_icon1.img"; - - //我的信息 - MyInfo = null; - - //滚轮偏移值 - YOffset = 0; - - - function My_GetCharacterInfoCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - MyInfo = Jso.Attribute; - } - - //初始化 - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - //注册控件 - RegisterWidget(); - - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - Pack_Control.rawset(20069014, My_GetCharacterInfoCallBack.bindenv(this)); - } - - 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); - } - - //绘制主界面 - function DrawMain(obj) { - DrawInfo(obj); - } - - function CheckPosInDrawBox(PosY) { - if ((PosY + YOffset) >= 0 && (PosY + YOffset)< 144) return true; - return false; - } - - //绘制信息 - function DrawInfo(obj) { - if (MyInfo) { - - //生命魔法值 - local PosOffset = 0; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 0, X + 4, Y + 3 + YOffset); - L_sq_DrawCode("HP", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local HpStr = MyInfo.CurHp.tostring() + "/" + MyInfo.MaxHp.tostring(); - L_sq_DrawCode(HpStr, X + 128 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - - L_sq_DrawImg(IconPath, 1, X + 130, Y + 3 + YOffset); - L_sq_DrawCode("MP", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local HpStr = MyInfo.CurMp.tostring() + "/" + MyInfo.MaxMp.tostring(); - L_sq_DrawCode(HpStr, X + 248 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //力量智力 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 2, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("力量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.Strength.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - - L_sq_DrawImg(IconPath, 3, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("智力", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.Intellect.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //体力精神 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 4, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("体力", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.Vitality.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - - L_sq_DrawImg(IconPath, 5, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("精神", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.Spirit.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //物理攻击魔法攻击 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 6, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("物理攻击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.PhysicalAttack.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - - L_sq_DrawImg(IconPath, 7, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("魔法攻击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.MagicalAttack.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //独立攻击力 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 31, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("独立攻击力(物理/魔法)", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.IndependentAttack.tostring(); - L_sq_DrawCode(Str, X + 248 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //物理防御魔法防御 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 8, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("物理防御", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.PhysicalDefend.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - - L_sq_DrawImg(IconPath, 9, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("魔法防御", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.MagicalDefend.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); - } - - //物理暴击 魔法暴击 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 10, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("物理暴击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = format("%0.1f%%", MyInfo.PhysicalCrit); - L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 11, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("魔法暴击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = format("%0.1f%%", MyInfo.MagicalCrit); - L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //攻击速度 释放速度 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 12, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("攻击速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = format("%0.1f%%", MyInfo.AttackSpeed); - L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 13, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("释放速度", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = format("%0.1f%%", MyInfo.ReleaseSpeed); - L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //移动速度 抗魔 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 14, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("移动速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = format("%0.1f%%", MyInfo.MoveSpeed); - L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 15, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("抗魔", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.AntiMagic.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //命中率 回避率 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 16, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("命中率", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = format("%0.1f%%", MyInfo.HitRate); - L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 17, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("回避率", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = format("%0.1f%%", MyInfo.DodgeRate); - L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //HP恢复量 MP恢复量 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 18, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("HP恢复量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.HPRecovery.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 19, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("MP恢复量", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.MPRecovery.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //僵直度 硬直 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 20, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("僵直度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.StunRate.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 21, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("硬直", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.StunResist.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //火属性强化 火属性抗性 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 22, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("火属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.FireStrength.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 23, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("火属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.FireResist.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //冰属性强化 冰属性抗性 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 24, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("冰属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.IceStrength.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 25, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("冰属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.IceResist.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //光属性强化 光属性抗性 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 26, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("光属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.LightStrength.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 27, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("光属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.LightResist.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //暗属性强化 暗属性抗性 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 28, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("暗属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.DarkStrength.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 29, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("暗属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.DarkResist.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - - //名望值 罪恶值 - PosOffset += 18; - if (CheckPosInDrawBox(PosOffset)) { - L_sq_DrawImg(IconPath, 53, X + 4, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("名望值", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str = MyInfo.Fame.tostring(); - L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - - L_sq_DrawImg(IconPath, 45, X + 130, Y + 3 + PosOffset + YOffset); - L_sq_DrawCode("最终伤害", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); - local Str2 = MyInfo.FinalDamage.tostring(); - L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); - } - } - } - - function Show(obj) { - - } - - function RealShow(obj) { - - DrawMain(obj); - LenheartNewUI_Windows.Show(obj); - } - - //override - //鼠标滚轮事件回调 - function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { - if (Flag) { - if (YOffset< 0) YOffset += 18; - } - if (!Flag) { - if (YOffset > (-145)) YOffset -= 18; - } - } - - //调用原生方法 - LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y); - } - - GetMyInfoFlag = false; - - //逻辑入口 - function Proc(obj) { - Visible = false; - LenheartNewUI_Windows.SyncPos(X, Y); - - local WindowX = sq_GetPopupWindowMainCotrol(74); - - if (!WindowX) { - GetMyInfoFlag = false; - } - - if (!WindowX) return; - - if (!GetMyInfoFlag) { - GetMyInfoFlag = true; - local T = { - op = 20069013, - Info = Lenheart_Character_GetAttribute(null) - } - SendPackEx(T); - } - - X = Base_X; - Y = Base_Y; - } - - Base_X = 0; - Base_Y = 0; - - function SyncState(Args) { - Base_X = Args[0] + 800; - Base_Y = Args[1] - 174; - local obj = sq_getMyCharacter(); - RealShow(obj); - Visible = true; - } - -} -DrawCodeCallBackFunc.Rindro_Character_Info <- function(Args) { - if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) { - local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj"); - MyWindow.SyncState(Args); - } -} - -//个人信息窗口逻辑 -function L_Character_Info_Window(WindowObject) { - return false; - // //返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行 - // local Flag = false; - // if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) { - // local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj"); - // local Ret = MyWindow.SyncState(WindowObject); - // if (Ret) Flag = true; - // } - // return Flag; -} - -getroottable().rawdelete("Lenheart_Character_Info_Class_Obj"); - -function Lenheart_Character_Info_Class_Fun(obj) { - local RootTab = getroottable(); - if (!RootTab.rawin("Lenheart_Character_Info_Class_Obj")) { - RootTab.rawset("Lenheart_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Character_Info_ClassC, "个人信息属性面板窗口", 0, 0, 263, 146, 0)); - } -} - -getroottable()["LenheartFuncTab"].rawset("Lenheart_Character_Info_ClassFuncN", Lenheart_Character_Info_Class_Fun); - - - -class Lenheart_Other_Character_Info_ClassC extends Lenheart_Character_Info_ClassC { - //调试模式 - // DeBugMode = true; - - //不是窗口 - NoWindow = true; - - //是否可见 - Visible = false; - - //图标路径 - IconPath = "interface2/profile/profile_icon1.img"; - - //我的信息 - MyInfo = null; - - //滚轮偏移值 - YOffset = 0; - - function Other_GetCharacterInfoCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - MyInfo = Jso.Attribute; - } - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - //注册控件 - RegisterWidget(); - - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - Pack_Control.rawset(20069012, Other_GetCharacterInfoCallBack.bindenv(this)); - } - - function RegisterWidget() { - - } - - function Show(obj) { - - } - - function DrawMain(obj) { - DrawInfo(obj); - } - - function RealShow(obj) { - DrawMain(obj); - LenheartNewUI_Windows.Show(obj); - } - - - //override - //鼠标滚轮事件回调 - function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { - - if (Flag) { - if (YOffset< 0) YOffset += 18; - } - if (!Flag) { - if (YOffset > (-145)) YOffset -= 18; - } - - //调用原生方法 - LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y); - } - - //逻辑入口 - function Proc(obj) { - Visible = false; - LenheartNewUI_Windows.SyncPos(X, Y); - - local WindowX = sq_GetPopupWindowMainCotrol(74); - if (!WindowX || !OldWindowAddress) return; - X = L_sq_RA(OldWindowAddress + 0x14); - Y = L_sq_RA(OldWindowAddress + 0x18) + 154; - - } - - OldWindowAddress = null; - - function SyncState(Address) { - OldWindowAddress = Address; - local obj = sq_getMyCharacter(); - RealShow(obj); - Visible = true; - return true; - } - -} - -//他人信息窗口逻辑 -function L_Other_Character_Info_Window(WindowObject) { - return false; - //返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行 - local Flag = false; - if (getroottable().rawin("Lenheart_Other_Character_Info_Class_Obj")) { - local MyWindow = getroottable().rawget("Lenheart_Other_Character_Info_Class_Obj"); - local Ret = MyWindow.SyncState(WindowObject); - if (Ret) Flag = true; - } - return Flag; -} - -getroottable().rawdelete("Lenheart_Other_Character_Info_Class_Obj"); - -function Lenheart_Other_Character_Info_Class_Fun(obj) { - local RootTab = getroottable(); - if (!RootTab.rawin("Lenheart_Other_Character_Info_Class_Obj")) { - RootTab.rawset("Lenheart_Other_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Other_Character_Info_ClassC, "他人信息属性面板窗口", 0, 0, 263, 146, 0)); - } -} - -getroottable()["LenheartFuncTab"].rawset("Lenheart_Other_Character_Info_ClassFuncN", Lenheart_Other_Character_Info_Class_Fun); \ No newline at end of file diff --git a/CSBase/UI/Lenheart_Cursor_Class.nut b/CSBase/UI/Lenheart_Cursor_Class.nut deleted file mode 100644 index 7f2fdad..0000000 --- a/CSBase/UI/Lenheart_Cursor_Class.nut +++ /dev/null @@ -1,57 +0,0 @@ -/* -文件名:Lenheart_Cursor_Class.nut -路径:Base/UI/Lenheart_Cursor_Class.nut -创建日期:2024-09-25 19:23 -文件用途:鼠标绘制逻辑 -*/ -class Rindro_Cursor { - - //强制锁 - ForceLockState = false; - - - //是否启用 - UseState = 0; - - TypeState = 0; - SubState = 0; - - constructor() { - - } - - function Proc(Xpos, Ypos) { - - //使用自建的鼠标绘制函数 - if (UseState) { - //工作类型为0 - if (TypeState == 0) { - //常规状态 - if (SubState == 0) { - L_sq_DrawImg("interface/newstyle/windows/cursor.img", 0, Xpos, Ypos); - } - //按下状态 - else if (SubState == 1) { - L_sq_DrawImg("interface/newstyle/windows/cursor.img", 1, Xpos, Ypos); - } - } else { - L_sq_DrawImg("interface/newstyle/windows/cursor.img", TypeState, Xpos, Ypos); - } - - } - } - - function Sync(Xpos, Ypos) { - Proc(Xpos, Ypos); - return UseState; - } -} -_Rindro_Cusor_ <- Rindro_Cursor(); - -function SyncRindro_Cursor(Xpos, Ypos) { - if (getroottable().rawin("_Rindro_Cusor_")) { - local Ret = _Rindro_Cusor_.Sync(Xpos, Ypos); - return Ret; - } - return false; -} \ No newline at end of file diff --git a/CSBase/UI/Lenheart_Each_Class.nut b/CSBase/UI/Lenheart_Each_Class.nut deleted file mode 100644 index 7a48928..0000000 --- a/CSBase/UI/Lenheart_Each_Class.nut +++ /dev/null @@ -1,418 +0,0 @@ -/* -文件名:Lenheart_Each_Class.nut -路径:Base/UI/Lenheart_Each_Class.nut -创建日期:2024-09-30 14:46 -文件用途:交互界面类 -*/ -class LenheartNewUI_Each_BaseButton extends LenheartNewUI_CommonUi { - State = 0; - BaseIdx = 29; - DWidth = null; - Path = null; - Idx = null; - SetFlag = null; - SetIndex = null; - - Icon = null; - IconIdx = null; - Str = null; - StrColor = sq_RGBA(189, 159, 126, 250); - - constructor(X, Y, W, H, Path, Idx) { - this.DWidth = W; - this.Path = Path; - this.Idx = Idx; - LenheartNewUI_CommonUi.constructor(X, Y, W, H); - - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - // L_sq_DrawImg(Path, Idx + 3, X, Y); - } else { - //按下 - if (isLBDown) { - L_sq_DrawImg(Path, Idx + 1, X, Y); - if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 2); - if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 5, StrColor, 0, 1); - } - //悬停 - else if (isInRect) { - L_sq_DrawImg(Path, Idx, X, Y); - if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1); - if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1); - } - //普通 - else { - L_sq_DrawImg(Path, 0, X, Y); - if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1); - if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1); - } - } - } - - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - if (isLBDown && OnClick) { - OnClick(this); - } - isLBDown = false; - } -} - -class Lenheart_EachC extends LenheartNewUI_Windows { - //调试模式 - // DeBugMode = true; - - //不是窗口 - NoWindow = true; - - //是否可见 - // Visible = false; - - Info = null; - - NPC_Index = null; - NPC_Flag = false; - NPC_ButtonMap = null; - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - NPC_ButtonMap = {}; - //注册控件 - RegisterWidget(); - - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - - } - - function RegisterWidget() { - - } - - function Show(obj) { - - } - - function TopShow(obj) { - if (NPC_Index) { - SyncPos(); - LenheartNewUI_Windows.Show(obj); - } - } - - function DrawMain(obj) { - // if (Info) { - // local NPC_Index = Rindro_BaseToolClass.GetEachNpcId(); - // } - - - } - - - // function BottomShow() {} - - //初始化NPC按钮 - function InitNpcButton() { - Childrens = []; - if (NPC_ButtonMap.rawin(NPC_Index)) { - foreach(Func in NPC_ButtonMap[NPC_Index]) { - Func(this); - } - } - this.Visible = true; - } - - function AddEachForNpc(Index, Func) { - if (NPC_ButtonMap.rawin(Index)) { - NPC_ButtonMap[Index].append(Func); - return; - } - NPC_ButtonMap.rawset(Index, [Func]); - } - - function RemoveEachForNpc(Index) { - NPC_ButtonMap.rawdelete(Index); - } - - //逻辑入口 - function Proc(obj) { - LenheartNewUI_Windows.SyncPos(X, Y); - - NPC_Index = Rindro_BaseToolClass.GetEachNpcId(); - if (NPC_Index) { - if (!NPC_Flag) { - NPC_Flag = true; - InitNpcButton(); - } - } else { - NPC_Flag = false; - } - } - - function CloseAllEach() { - local EachClassObject = L_sq_RA(0x1ADE0E0); - if (EachClassObject) { - local FristChildOffset = (EachClassObject + 0x68); - for (local i = 0; i< 74; i++) { - local AddressBuf = FristChildOffset + (4 * i); - local ChildAddress = L_sq_RA(AddressBuf); - if (ChildAddress) { - local OpenFlag = L_sq_RA(ChildAddress + 0xC); - if (OpenFlag = 257) L_sq_WA(ChildAddress + 0xC, 256); - } - } - } - } - - function Lenheart_Get_Each_Info() { - local EachCount = 0; - local Xpos = 0; - local Ypos = 0; - local EachClassObject = L_sq_RA(0x1ADE0E0); - if (EachClassObject) { - local FristChildOffset = (EachClassObject + 0x68); - for (local i = 0; i< 74; i++) { - local AddressBuf = FristChildOffset + (4 * i); - local ChildAddress = L_sq_RA(AddressBuf); - if (ChildAddress) { - local OpenFlag = L_sq_RA(ChildAddress + 0xC); - if (OpenFlag == 257) EachCount++; - } - //第0个的时候记录一下坐标 - if (i == 0) { - Xpos = L_sq_RA(ChildAddress + 0x14); - Ypos = L_sq_RA(ChildAddress + 0x18); - } - } - } - return { - Count = EachCount, - X = Xpos, - Y = Ypos - }; - } - - //override - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - //调用原生方法 - LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); - - - } - - function SyncPos() { - //读取交互坐标数据 - Info = Lenheart_Get_Each_Info(); - - X = Info.X; - Y = Info.Y + (21 * Info.Count); - //宽度 - Width = 100; - //高度 - Height = (21 * Childrens.len()); - //同步子对象坐标 - foreach(pos, winobj in Childrens) { - winobj.X = Info.X; - winobj.Y = Info.Y + (21 * (Info.Count + pos)); - - } - } -} - - -function Lenheart_Each_Fun(obj) { - local RootTab = getroottable(); - if (!RootTab.rawin("L_Each_Obj")) { - RootTab.rawset("L_Each_Obj", LenheartNewUI_CreateWindow(Lenheart_EachC, "玩家与NPC交互界面窗口", 0, 0, 0, 0, 0)); - } -} - -getroottable()["LenheartFuncTab"].rawset("Lenheart_EachN", Lenheart_Each_Fun); - - - - - -class Lenheart_PlayerEachC extends LenheartNewUI_Windows { - //调试模式 - // DeBugMode = true; - - //不是窗口 - NoWindow = true; - - //是否可见 - // Visible = false; - - Info = null; - Basic = null; - - //当前交互角色姓名 - PlayerEach_Name = null; - PlayerEach_Flag = false; - PlayerEach_ButtonMap = null; - - //通用按钮 - PlayerEach_CommonButtonMap = null; - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - PlayerEach_ButtonMap = {}; - PlayerEach_CommonButtonMap = {}; - //注册控件 - RegisterWidget(); - - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - - } - - function RegisterWidget() {} - - function Show(obj) {} - - function TopShow(obj) {} - - function DrawMain(obj) {} - - function MySelfShow() { - if (PlayerEach_Name) { - local obj = sq_getMyCharacter(); - LenheartNewUI_Windows.Show(obj); - } - } - - - //初始化NPC按钮 - function InitNpcButton() { - Childrens = []; - if (PlayerEach_ButtonMap.rawin(PlayerEach_Name)) { - foreach(Func in PlayerEach_ButtonMap[PlayerEach_Name]) { - Func(this); - } - } - foreach(Func in PlayerEach_CommonButtonMap) { - Func(this); - } - this.Visible = true; - } - - function AddEachForCommon(Index, Func) { - PlayerEach_CommonButtonMap.rawset(Index, Func); - } - - function RemoveEachForCommon(Index) { - PlayerEach_CommonButtonMap.rawdelete(Index); - } - - function AddEachForPlayerName(Index, Func) { - if (PlayerEach_ButtonMap.rawin(Index)) { - PlayerEach_ButtonMap[Index].append(Func); - return; - } - PlayerEach_ButtonMap.rawset(Index, [Func]); - } - - function RemoveEachForPlayerName(Index) { - PlayerEach_ButtonMap.rawdelete(Index); - } - - function CloseAllEach() { - if (Basic) { - L_sq_WA(L_sq_P2I(Basic) + 0xC, 256); - } - } - - //逻辑入口 - function Proc(obj) { - LenheartNewUI_Windows.SyncPos(X, Y); - - local Str = L_Sq_GetPlayerEachName(); - if (Str.len() > 0) { - PlayerEach_Name = Str; - } - if (PlayerEach_Name) { - if (!PlayerEach_Flag) { - PlayerEach_Flag = true; - InitNpcButton(); - } - } else { - PlayerEach_Flag = false; - } - } - - //override - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); - } - - function SelfSyncPos(gInfo) { - //读取交互坐标数据 - Info = gInfo; - Basic = gInfo.BasicAdd; - - X = Info.X; - Y = Info.Y + (21 * Info.Count); - //宽度 - Width = 100; - //高度 - Height = (21 * Childrens.len()); - //同步子对象坐标 - foreach(pos, winobj in Childrens) { - winobj.X = Info.X; - winobj.Y = Info.Y + (21 * (Info.Count + pos)); - } - } -} - - -RindroPlayerEachDrawFlag <- false; -RindroPlayerEachDrawCountBuffer <- 0; -RindroPlayerEachDrawCount <- 0; -Rindro_Haker.LoadHook(0x10002A0, ["pointer", "int", "int"], - function(args) { - if (L_Sq_GetPlayerEachName().len() <= 0) return; - local Xpos = L_sq_RA(L_sq_P2I(args[0]) + 0x14); - local Ypos = L_sq_RA(L_sq_P2I(args[0]) + 0x18); - - if (!RindroPlayerEachDrawFlag) { - local RootTab = getroottable(); - RindroPlayerEachDrawFlag = true; - if (RootTab.rawin("L_PlayerEach_Obj")) { - RootTab["L_PlayerEach_Obj"].SelfSyncPos({ - X = Xpos, - Y = Ypos, - Count = RindroPlayerEachDrawCount, - BasicAdd = args[0] - }); - RootTab["L_PlayerEach_Obj"].MySelfShow(); - } - } - RindroPlayerEachDrawCountBuffer++; - // print(args[0]); - return null; - - }, - function(args) { - return null; - }); - - -function Lenheart_PlayerEach_Fun(obj) { - local RootTab = getroottable(); - RindroPlayerEachDrawFlag = false; - RindroPlayerEachDrawCount = RindroPlayerEachDrawCountBuffer; - RindroPlayerEachDrawCountBuffer = 0; - if (!RootTab.rawin("L_PlayerEach_Obj")) { - RootTab.rawset("L_PlayerEach_Obj", LenheartNewUI_CreateWindow(Lenheart_PlayerEachC, "玩家与玩家交互界面窗口", 0, 0, 0, 0, 0)); - } -} - -getroottable()["LenheartFuncTab"].rawset("Lenheart_PlayerEachN", Lenheart_PlayerEach_Fun); \ No newline at end of file diff --git a/CSBase/UI/Lenheart_Event_Class.nut b/CSBase/UI/Lenheart_Event_Class.nut deleted file mode 100644 index 9aed30d..0000000 --- a/CSBase/UI/Lenheart_Event_Class.nut +++ /dev/null @@ -1,374 +0,0 @@ -/* -文件名:Lenheart_Event_Class.nut -路径:Base/UI/Lenheart_Event_Class.nut -创建日期:2024-08-11 09:47 -文件用途:活动图标 -*/ - - -class LenheartNewUI_EventButton extends LenheartNewUI_CommonUi { - State = 0; - BaseIdx = 29; - DWidth = null; - Path = null; - Idx = null; - BindObj = null; - Timer = 0; - EffFlag = true; - ShowName = null; - - constructor(X, Y, Path, Idx) { - this.DWidth = 20; - this.Path = Path; - this.Idx = Idx; - LenheartNewUI_CommonUi.constructor(X, Y, 20, 20); - Timer = Clock(); - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "EventIcon" + ObjectId); - //不可用 - if (State == 8) { - L_sq_DrawImg(Path, Idx + 3, X, Y + 1); - } else { - //按下 - if (isLBDown) { - L_sq_DrawImg(Path, Idx + 1, X, Y); - } - //悬停 - else if (isInRect) { - L_sq_DrawImg(Path, Idx, X, Y); - } - //普通 - else { - L_sq_DrawImg(Path, Idx, X, Y); - } - } - } - - //鼠标左键按下回调 - function OnMouseLbDown(MousePos_X, MousePos_Y) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isLBDown = true; - } - - //鼠标左键弹起回调 overr - function OnMouseLbUp(MousePos_X, MousePos_Y) { - if (isLBDown && OnClick) { - local obj = sq_getMyCharacter(); - obj.sq_PlaySound("CLICK_BUTTON1"); - OnClick(this); - } - isLBDown = false; - } -} - - -class Rindro_Event extends LenheartNewUI_Windows { - //调试模式 - // DeBugMode = true; - - EventFlag = true; - //不是窗口 - NoWindow = true; - //显示标志位 - PosIdx = null; - - //闪烁透明度 - Alpha = 250; - //闪烁模式 - BlinkMode = false; - //时间 - Timer = 0; - - //是否可见 - Visible = true; - - //主要Button - MainButton = null; - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - - Timer = Clock(); - } - - //绘制主界面 - function DrawMain(obj) { - local RT = Clock() - Timer; - - //根据模式调整透明度 - if (!BlinkMode) Alpha = sq_GetUniformVelocity(250, 130, RT, 500); - else Alpha = sq_GetUniformVelocity(130, 250, RT, 500); - //转换模式 - if (RT >= 500) { - Timer = Clock(); - BlinkMode = !BlinkMode; - } - - - L_sq_SetDrawImgModel(2, 0); - L_sq_DrawImg("interface2/yosin/eventsystemeff.img", 0, X, Y, 1, sq_RGBA(255, 255, 255, Alpha), 1.0, 1.0); - L_sq_ReleaseDrawImgModel(); - } - - function Show(obj) { - // DrawMain(obj); - // LenheartNewUI_Windows.Show(obj); - } - - function EventShow(obj) { - DrawMain(obj); - LenheartNewUI_Windows.Show(obj); - } - - function TopShow(obj) { - if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 20, 20)) { - local XposOffset = 0; - local Len = LenheartTextClass.GetStringLength(MainButton.ShowName); - local Count = ((Len - 10) / 15) + 1; - XposOffset = (-(10 + Count * 15) / 2) + 10; - - L_sq_DrawImg("interface2/yosin/eventsystem.img", 0, X + XposOffset, Y - 24); - for (local i = 0; i< Count; i++) { - L_sq_DrawImg("interface2/yosin/eventsystem.img", 1, X + XposOffset + 5 + (15 * i), Y - 24); - } - L_sq_DrawImg("interface2/yosin/eventsystem.img", 2, X + XposOffset + 5 + (15 * Count), Y - 24); - L_sq_DrawCode(MainButton.ShowName, X - Len / 2 + 12, Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1); - } - } - - function SyncEventIcon() { - local Count = L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c); - X = EventList_Obj.X + (((Count + PosIdx) % 8) * 20); - Y = EventList_Obj.Y - ((Count + PosIdx) / 8) * 20; - } - - //逻辑入口 - function Proc(obj) { - //同步图标位置 - SyncEventIcon(); - LenheartNewUI_Windows.SyncPos(X, Y); - } -} - -class Rindro_EventList { - - X = 0; - Y = 0; - - //活动数组 - Events = null; - EventsMap = null; - - function YosinEventIconInfoCallBack(Chunk) { - local Jso = Json.Decode(Chunk); - X = Jso.YosinEventIconInfoXpos; - Y = Jso.YosinEventIconInfoYpos; - - - getroottable()["LenheartEventOffset"] <- { - x = X - 456, - y = Y - }; - - L_sq_RefreshEventIcon(); - } - - constructor() { - - Events = []; - EventsMap = {}; - Pack_Control.rawset(30002, YosinEventIconInfoCallBack.bindenv(this)); - - } - - //添加活动 - function AddEvent(Name, Idx, WindowObject, ...) { - if (EventsMap.rawin(Name)) return EventsMap.rawget(Name); - local Window = LenheartNewUI_CreateWindow(Rindro_Event, Name, 0, 0, 20, 20, 0) - local Flag = Events.len(); - local ImgPath = "interface2/yosin/eventsystemlist.img"; - if (vargc == 1) ImgPath = vargv[0]; - local ButtonBuf = LenheartNewUI_EventButton(0, 0, ImgPath, Idx); - ButtonBuf.BindObj = WindowObject; - ButtonBuf.ShowName = Name; - ButtonBuf.OnClick = function(B_obj) { - if (B_obj.BindObj) B_obj.BindObj.OpenCallBack(); - }.bindenv(this); - Window.AddChild(ButtonBuf); - Window.PosIdx = Events.len(); - Window.MainButton = ButtonBuf; - Events.append(Window); - EventsMap.rawset(Name, Window); - return Window; - } - - //检测是否悬停活动图标 - function CheckInEvent(MousePos_X, MousePos_Y) { - if (sq_GetPopupWindowMainCotrol(244)) return; - foreach(Window in Events) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) { - getroottable().WindowsShowABFlag <- true; - } - } - } -} - -getroottable().rawdelete("EventList_Obj") - -function Lenheart_EventList_Fun(obj) { - local RootTab = getroottable(); - if (!RootTab.rawin("EventList_Obj")) { - RootTab.rawset("EventList_Obj", Rindro_EventList()); - } -} - -//获取活动图标坐标 在活动图标变动时会被调用 -function Sq_Get_Event_Pos_X() { - if (getroottable().rawin("LenheartEventOffset")) { - return getroottable()["LenheartEventOffset"].x; - } else { - getroottable()["LenheartEventOffset"] <- { - x = 277, - y = 530 - }; - return getroottable()["LenheartEventOffset"].x; - } -} - -function Sq_Get_Event_Pos_Y() { - if (getroottable().rawin("LenheartEventOffset")) { - return getroottable()["LenheartEventOffset"].y; - } else { - getroottable()["LenheartEventOffset"] <- { - x = 277, - y = 530 - }; - return getroottable()["LenheartEventOffset"].y; - } -} - - - -/* -//活动图标类 -class Rindro_EventIcon extends LenheartNewUI_CommonUi { - //Key - Key = null; - //活动图标文字 - EventStr = null; - //活动图标Ani编号 - EventFrame = null; - //绑定对象 - BandObject = null; - - //图标img路径 - ImgPath = "interface2/yosin/eventsystemlist.img"; - - x = null; - y = null; - - constructor(gEventStr, gEventFrame, gKey, gBandObject) { - this.EventStr = gEventStr; - this.EventFrame = gEventFrame; - this.Key = gKey; - this.BandObject = gBandObject; - - local RootTab = getroottable(); - if (RootTab.rawin("YosinEventSystem")) { - local Arr = RootTab["YosinEventSystem"]; - local TryAppend = true; - local wpos; - foreach(pos, value in Arr) { - if (value.Key == this.Key) { - TryAppend = false; - wpos = pos; - } - } - if (TryAppend) { - Arr.append(this); - RootTab.rawset("YosinEventSystem", Arr); - } else { - Arr[wpos] = this; - RootTab.rawset("YosinEventSystem", Arr); - } - } else { - local Arr = []; - Arr.append(this); - RootTab.rawset("YosinEventSystem", Arr); - } - } - - function Show(obj, X, Y) { - x = X; - y = Y; - - //绘制框 - T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "YosinEventIconEffA"); - - try { - if (isLBDown()) { - //绘制活动图标 - L_sq_DrawImg(ImgPath, EventFrame, X, Y + 1); - //T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key); - } else { - //绘制活动图标 - L_sq_DrawImg(ImgPath, EventFrame, X, Y); - } - } catch (exception) { - if (isLBDown()) { - //绘制活动图标 - T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key); - } else { - //绘制活动图标 - T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y, EventFrame, "YosinEventIconKey" + Key); - } - } - } - - function StrShow(obj, X, Y) { - //悬停 - if (isInRect() && EventStr) { - local count = EventStr.len() / 3; - T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7), Y - 24, 0, "YosinEventIconStrEffL"); - for (local i = 0; i< count; i++) { - T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (i * 15), Y - 24, 1, "YosinEventIconStrEffZ"); - } - T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (count * 15), Y - 24, 2, "YosinEventIconStrEffR"); - L_sq_DrawCode(EventStr, X - (count * 4), Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1); - } - if (isLBActive()) { - BandObject.MainState = true; - BandObject.OpenClassCallBack(); - } - } - - //悬停状态 - function isInRect() { - if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, x, y, 20, 20)) return true; - else return false; - } - //左键按下状态 - function isLBDown() { - if (isInRect() && Mobj.Lb == 1) return true; - else return false; - } - //左键弹起状态 - function isLBUp() { - if (isInRect() && Mobj.Lb == 0) return true; - else return false; - } - - //左键单击状态 - function isLBActive() { - if (isInRect() && Mobj.LbEvent) return true; - else return false; - } -} -*/ \ No newline at end of file diff --git a/CSBase/UI/Lenheart_UI_Class.nut b/CSBase/UI/Lenheart_UI_Class.nut deleted file mode 100644 index fac5ab1..0000000 --- a/CSBase/UI/Lenheart_UI_Class.nut +++ /dev/null @@ -1,1456 +0,0 @@ -/* -文件名:Lenheart_UI_Class.nut -路径:Base/UI/Lenheart_UI_Class.nut -创建日期:2024-08-06 18:56 -文件用途:UI -*/ - -//新窗口队列 -L_Windows_List <- []; -//渲染窗口的默认层在下层 即A层 -WindowsShowABFlag <- false; -//左键单击过的Flag 因为要模拟左键单击还原鼠标状态如果存在这个Flag将不响应鼠标消息一次 -Rindro_MouseClickFlag <- false; - - -//鼠标类 -class R_Mouse { - //是否锁定鼠标 - function IsLock() { - return L_sq_RAB(0x1B46886); - } - //锁定鼠标 - function Lock() { - - _Rindro_Cusor_.UseState = 1; - L_sq_WAB(0x1B46886, 1); - //技能描述窗口 - Sq_Memory_WriteByteArr(L_sq_I2P(0x4CC47E), [0xE9, 0xA0, 0x00, 0x00, 0x00, 0x90]); - //物品描述窗口 - // Sq_Memory_WriteByteArr(L_sq_I2P(0xF63DDA), [0x90, 0x90, 0x90, 0x90, 0x90, 0x90]); - //buff信息描述窗口 - Sq_Memory_WriteByteArr(L_sq_I2P(0x4BF532), [0x90, 0x90, 0x90, 0x90]); - //原生商城 个人信息等按钮的悬停 - L_sq_WAB(0x4C4690, 0xC3); - //活动图标的悬停 - L_sq_WAB(0x11C6510, 0xC3); - } - //解锁鼠标 - function UnLock() { - - _Rindro_Cusor_.UseState = 0; - L_sq_WAB(0x1B46886, 0); - Sq_Memory_WriteByteArr(L_sq_I2P(0x4CC47E), [0x39, 0x05, 0xE0, 0xF6, 0xA3, 0x01]); - // Sq_Memory_WriteByteArr(L_sq_I2P(0xF63DDA), [0x56, 0xE8, 0x10, 0xFE, 0xFF, 0xFF]); - Sq_Memory_WriteByteArr(L_sq_I2P(0x4BF532), [0x75, 0x07, 0x32, 0xC0]); - L_sq_WAB(0x4C4690, 0x55); - L_sq_WAB(0x11C6510, 0x55); - } - //获取鼠标工作类型 - function GetType() { - return _Rindro_Cusor_.TypeState; - // return L_sq_RAB(0x1b46898); - } - //设置鼠标工作类型 - function SetType(Type) { - - _Rindro_Cusor_.TypeState = Type; - // L_sq_WAB(0x1b46898, Type); - } - //鼠标0状态下是否按下 - function GetBaseState() { - return _Rindro_Cusor_.SubState; - // return L_sq_RAB(0x1B46874); - } - //鼠标0状态设置是否按下 - function SetBaseState(Flag) { - - _Rindro_Cusor_.SubState = Flag; - // return L_sq_WAB(0x1B46874, Flag); - } - - //还原鼠标 - function Restore() { - //这里判断是否有锁定鼠标 如果有就解锁 - if (R_Mouse.IsLock()) R_Mouse.UnLock(); - //如果鼠标工作类型不是0则设置为0 - if (R_Mouse.GetType() != 0) R_Mouse.SetType(0); - //如果鼠标是按下状态则设置为未按下 - if (R_Mouse.GetBaseState() != 0) R_Mouse.SetBaseState(0); - } -} -//基础窗口类 所有UI类继承与本类 -class LenheartNewUI_BaseWindow extends Rindro_BaseToolClass { - //父控件 - Parent = null; - //子控件 - Childrens = null; - //回调事件 - CallBackFunc = null; - - constructor() { - - } - - //鼠标事件回调 - function OnMouseProc(Flag, MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseProc(Flag, MousePos_X, MousePos_Y); - } - } - //鼠标左键按下回调 - function OnMouseLbDown(MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseLbDown(MousePos_X, MousePos_Y); - } - } - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseLbUp(MousePos_X, MousePos_Y); - } - } - //鼠标右键按下回调 - function OnMouseRbDown(MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseRbDown(MousePos_X, MousePos_Y); - } - } - //鼠标右键弹起回调 - function OnMouseRbUp(MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseRbUp(MousePos_X, MousePos_Y); - } - } - //鼠标滚轮时间回调 - function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { - foreach(Window in Childrens) { - Window.OnMouseWheel(Flag, MousePos_X, MousePos_Y); - } - } - //设置回调事件 - function SetCallBackFunc(Func) { - CallBackFunc = Func; - } - //显示 - function Show(obj) { - foreach(Window in Childrens) { - if (Window.CallBackFunc) Window.CallBackFunc(Window); - if (!Window.rawin("Visible")) print(Window.ObjectId + " 显示失败"); - if (Window.Visible) { - Window.Show(obj); - Window.TopShow(obj); - } - } - } - //同步坐标 - function SyncPos(X, Y) { - foreach(Window in Childrens) { - Window.SyncPos(X, Y); - } - } - - /* - * @函数作用: 添加子对象 - * @参数 name - */ - function AddChild(gChild) { - this.Childrens.append(gChild); - gChild.Parent = this; - } -} - -//游戏窗口类 -class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { - //窗口名称 - ObjectId = null; - //可用性 - Visible = true; - //宽度 - Width = null; - //高度 - Height = null; - //标题高度 - TitleH = null; - - //调试模式 - DeBugMode = false; - - //X坐标 - X = null; - B_X = null; - //Y坐标 - Y = null; - B_Y = null; - - M_Xpos = null; - M_Ypos = null; - //移动Flag - MoveFlag = false; - - //时间片段 - Duration = 0.0; - DurationFlag = 0.0; - - //是否是焦点 - IsFocus = false; - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - ObjectId = gObjectId; - //宽度 - Width = gWidth; - //高度 - Height = gHeight; - //标题高度 - TitleH = gTitleH; - - //X坐标 - X = gX; - //Y坐标 - Y = gY; - - ResetFocus(); - - //调用原生方法 - LenheartNewUI_BaseWindow.constructor(); - } - - - //切换到最上层窗口 即得到焦点时 - function ResetFocus() { - //遍历全局窗口数组将自己移除重新添加在末尾 - 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; - } - - /* - * @函数作用: 移除子对象 - * @参数 子对象名称 - */ - function RemoveChild(ChildName) { - foreach(_Index, _Child in Childrens) { - if (_Child.ObjectId == ChildName) { - Childrens.remove(_Index); - return; - } - } - } - /* - * @函数作用: 移除子对象类 - * @参数 类 如果传入第二个参数false 则移除所有非该类的子对象 - * @返回值 - */ - function RemoveChilds(ClassName, ...) { - local RemoveIndexArr = []; - if (vargc == 1 && vargv[0] == false) { - foreach(_Index, _Child in Childrens) { - if (!(_Child instanceof ClassName)) { - RemoveIndexArr.append(_Index - RemoveIndexArr.len()); - } - } - } else { - foreach(_Index, _Child in Childrens) { - if (_Child instanceof ClassName) { - RemoveIndexArr.append(_Index - RemoveIndexArr.len()); - } - } - } - foreach(SaveIndex in RemoveIndexArr) { - Childrens.remove(SaveIndex); - } - } - - /* - * @函数作用: 添加子对象 - * @参数 name - */ - function AddChild(gChild) { - this.Childrens.append(gChild); - gChild.Parent = this; - } - - //关闭窗口 -并没有销毁只是隐藏 - function CloseWindow() { - this.Visible = false; - //还原鼠标 - R_Mouse.Restore(); - //左键单击还原游戏状态 - // L_sq_MouseClick(); - } - //销毁窗口 - function DestroyWindow() { - foreach(Index, WindowObj in L_Windows_List) { - if (WindowObj.ObjectId == this.ObjectId) L_Windows_List.remove(Index); - } - //还原鼠标 - R_Mouse.Restore(); - //左键单击还原游戏状态 - // L_sq_MouseClick(); - } - - //道具信息窗口地址 - ItemInfoDrawS = null; - //绘制道具相信信息 - ItemObject = null; - - //获取道具信息并生成缓存 - function GetItemInfo(Id) { - if (!Rindro_ItemInfoObject.rawin(Id)) { - local ItemObject = L_sq_GetItem(Id); - if (!ItemObject) ItemObject = L_sq_GetItem(3037); - Rindro_ItemInfoObject.rawset(Id, ItemObject); - } - } - //绘制道具带道具信息 带道具边框 - function DrawItemEx(X, Y, Id, Count) { - GetItemInfo(Id); - local Rarity = L_sq_RA(Rindro_ItemInfoObject[Id] + 0xF4); - L_sq_DrawImg("interface2/rindro_reward.img", Rarity, X - 3, Y - 3); - DrawItemBase(X, Y, Id, Count); - } - //绘制道具带道具信息 - function DrawItemBase(X, Y, Id, Count) { - GetItemInfo(Id); - L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0); - if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) { - //打开道具信息窗口 - if (!ItemInfoDrawS) { - ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Rindro_ItemInfoObject[Id], 41); - //校准道具信息窗口位置 - L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28); - //我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具 - getroottable().WindowsShowABFlag <- false; - } - } else { - if (ItemInfoDrawS) { - L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); - ItemInfoDrawS = null; - } - } - } - - //绘制标题 - 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 { - local CurT = L_Getmicroseconds(); - Duration = (CurT - DurationFlag); - DurationFlag = CurT; - } catch (exception) { - - } - } - - function Show(obj) { - GenerateDt(); - if (!Visible) return; - - //调用原生方法 - LenheartNewUI_BaseWindow.Show(obj); - if (DeBugMode) DeBug(obj); - - //初始化绘制道具 - // ItemInfoDrawS = null; - } - - function TopShow(obj) { - - } - - function DeBug(obj) { - sq_DrawBox(X, Y, Width, Height, 0xffffffff); - sq_DrawBox(X, Y, Width, TitleH, 0xffffffff); - } - - //override - function OnMouseProc(Flag, MousePos_X, MousePos_Y) { - if (!Visible) return; - //设定拖动逻辑 - if (Flag == 1) { - if (MoveFlag) { - //左键拖动 - X = B_X - (M_Xpos - MousePos_X); - Y = B_Y - (M_Ypos - MousePos_Y); - } - } - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseProc(Flag, MousePos_X, MousePos_Y); - } - - //override - //鼠标左键按下回调 - function OnMouseLbDown(MousePos_X, MousePos_Y) { - if (!Visible) return; - //如果点击事件在窗口内 - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { - ResetFocus(); - //如果点下去在标题栏 - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, TitleH)) { - MoveFlag = true; - M_Xpos = MousePos_X; //原始鼠标位置数据 - M_Ypos = MousePos_Y; - B_X = X; //原始窗口位置 - B_Y = Y; - } - } - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); - } - //override - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - if (!Visible) return; - if (MoveFlag) { - MoveFlag = false; - M_Xpos = null; - M_Ypos = null; - B_X = null; - B_Y = null; - } - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseLbUp(MousePos_X, MousePos_Y); - } - //override - //鼠标右键按下回调 - function OnMouseRbDown(MousePos_X, MousePos_Y) { - if (!Visible) return; - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseRbDown(MousePos_X, MousePos_Y); - } - //override - //鼠标右键弹起回调 - function OnMouseRbUp(MousePos_X, MousePos_Y) { - if (!Visible) return; - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseRbUp(MousePos_X, MousePos_Y); - } - //override - //鼠标滚轮事件回调 - function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { - if (!Visible) return; - //调用原生方法 - LenheartNewUI_BaseWindow.OnMouseWheel(Flag, MousePos_X, MousePos_Y); - } -} - - -//创建窗口 如果已存在则返回窗口 -function LenheartNewUI_CreateWindow(ClassName, gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - foreach(Index, WindowObj in L_Windows_List) { - if (WindowObj.ObjectId == gObjectId) { - return WindowObj; - } - } - return ClassName(gObjectId, gX, gY, gWidth, gHeight, gTitleH); -} -//销毁窗口 -function LenheartNewUI_DestoryWindow(gObjectId) { - foreach(Index, WindowObj in L_Windows_List) { - if (WindowObj.ObjectId == gObjectId) { - L_Windows_List.remove(Index); - return true; - } - } - return false; -} - - -//遍历窗口查询是否有悬停在新窗口中 -function CheackMouseInNewWindows(MousePos_X, MousePos_Y) { - local Flag = false; - foreach(Window in L_Windows_List) { - if (!Window.Visible) continue; - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) { - Flag = true; - // print(Window.ObjectId); - // Sout("%L",Window.ObjectId); - return Flag; - } - } - return Flag; -} -//遍历是否悬停在原生窗口上 -function CheackMouseInOldWindows() { - // if (!NotOldWindowsMap.rawin(L_sq_RA(0x1A32950)) && (L_sq_RA(0x1A32950) <= 2390 || L_sq_RA(0x1A32950) >= 2500) && (L_sq_RA(0x1A32950) <= 120 || L_sq_RA(0x1A32950) >= 140)) { - // return true; - // } - // local Id = L_sq_RA(0x1A32950); - // if (Id == Rindro_Info_Base_Nowindow || Id <= 300) return false; - // return true; - - - //城镇基础背景窗口 副本背景 城镇背景 拓展技能按钮 切换技能页按钮 - local OldBaseWindowArr = [0x184D0C4, 0x0184CF6C, 0x15A249C, 0x184D174]; - local WindowAddress = L_sq_RA(0x1B474D4); - if (WindowAddress) { - local Flag = L_sq_RA(WindowAddress); - foreach(value in OldBaseWindowArr) { - if (Flag == value) { - //空地 - if (Flag == 0x184D0C4 || Flag == 0x0184CF6C) { - //都为0的时候城镇背景 508是血槽那一块的逻辑 坐标Y是508 - if ((L_sq_RA(WindowAddress + 0x14) == 0 && (L_sq_RA(WindowAddress + 0x18) == 0 || L_sq_RA(WindowAddress + 0x18) == 508))) { - return false; - } - } else { - //原生窗口里的按钮 - if (Flag == 0x184D174) return true; - return false; - } - } - } - } - return true; -} - -//设定鼠标逻辑 -function RunMouseLogic(MousePos_X, MousePos_Y) { - //解锁鼠标 如果鼠标已处于锁定状态 并且没有悬停在任何窗口上 解锁鼠标 - if (R_Mouse.IsLock()) { - //不在任何新窗口上 - if (!CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { - //还原鼠标 - R_Mouse.Restore(); - } - //在任何老窗口上 并且渲染层为A层 也就是下层渲染 - else if (CheackMouseInOldWindows() && !getroottable().WindowsShowABFlag) { - //还原鼠标 - R_Mouse.Restore(); - } - } - //锁定鼠标 如果鼠标处于未锁定状态 并且悬停在任意一个窗口上 - else if (!R_Mouse.IsLock() && CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { - //如果没有悬停任何原生窗口直接锁 - if (!CheackMouseInOldWindows()) { - //锁定鼠标 - R_Mouse.Lock(); - //设置鼠标模式 - R_Mouse.SetType(1); - } - //如果有悬停原生窗口 就要判断AB层 - else { - if (getroottable().WindowsShowABFlag) { - //锁定鼠标 - R_Mouse.Lock(); - //设置鼠标模式 - R_Mouse.SetType(1); - } - } - } -} - -//鼠标消息回调 -function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { - - // //获取基础无窗口的位置的值 - // if (!Rindro_Info_Base_Nowindow) { - // if (!sq_getMyCharacter()) return; - // if (!Rindro_Info_Base_Nowindow) { - // IMouse.SetPos((800 * 0.45).tointeger(), (600 * 0.1).tointeger()); - // if (MousePos_X == (getroottable().Rindro_Scr_Width * 0.45).tointeger() && MousePos_Y == (getroottable().Rindro_Scr_High * 0.1).tointeger()) { - // Rindro_Info_Base_Nowindow = L_sq_RA(0x1A32950); - // } - // } - // } - //用于抵消Esc造成的点击事件 - // if (Rindro_MouseClickFlag) { - // Rindro_MouseClickFlag--; - // return; - // } - if (MouseState == 0x200) { - //常规事件就要设定鼠标是否锁定逻辑 - if (_Rindro_Cusor_.ForceLockState == false) - RunMouseLogic(MousePos_X, MousePos_Y); - } - - //判断是否悬停活动图标 没悬停在老窗口上 没在选图界面 - if (getroottable().rawin("EventList_Obj") && !CheackMouseInOldWindows() && sq_GetCurrentModuleType() != 2) EventList_Obj.CheckInEvent(MousePos_X, MousePos_Y); - - - //如果渲染层级在下级 即A层 或者是 鼠标没有悬停在任何新窗口上时 执行判断 如果悬停在原生窗口 就解除鼠标锁定 如果点击 就改变渲染层级 - if (!getroottable().WindowsShowABFlag || !CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { - if (CheackMouseInOldWindows()) { - //如果点击了原生窗口 或者使用了滚轮 就把渲染队列改成下 - if (MouseState == 0x201 || MouseState == 0x20a) { - getroottable().WindowsShowABFlag <- false; - } - if (MouseState != 0x20a) return; - } - } - - //克隆一遍窗口列表 - local WindowListF = clone(L_Windows_List); - WindowListF.reverse(); - //判断滚轮是向上还是向下的 - local Flag = MouseFlag == 0xff880000 ? 0 : 1; - foreach(Window in WindowListF) { - if (Window.Visible) { - switch (MouseState) { - //常规或者拖动事件 - case 0x200: { - Window.OnMouseProc(MouseFlag, MousePos_X, MousePos_Y); - break; - } - //左键点击 - case 0x201: { - //如果点击了新窗口就把渲染队列改成上 - getroottable().WindowsShowABFlag <- true; - Window.OnMouseLbDown(MousePos_X, MousePos_Y); - break; - - } - //左键松开 - case 0x202: { - if (getroottable().WindowsShowABFlag) L_sq_WA(0x1B46874, 0); - Window.OnMouseLbUp(MousePos_X, MousePos_Y); - break; - } - //右键点击 - case 0x204: { - Window.OnMouseRbDown(MousePos_X, MousePos_Y); - break; - } - //右键松开 - case 0x205: { - Window.OnMouseRbUp(MousePos_X, MousePos_Y); - break; - } - //滚轮事件 - case 0x20a: { - Window.OnMouseWheel(Flag, MousePos_X, MousePos_Y); - break; - } - } - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) return; - } - } -} -//打开原生窗口回调 -function L_OpenOldWindowCallBack(WindowIndex) { - //将新窗口渲染队列改为下层 抵消窗口 Esc窗口 登录可能显示的任务窗口 - if (WindowIndex != 170 && WindowIndex != 176 && WindowIndex != 276 && WindowIndex != 275 && WindowIndex != 278 && WindowIndex != 279 && WindowIndex != 283 && WindowIndex != 36) { - - getroottable().WindowsShowABFlag <- false; - } -} - -//窗口逻辑入口 -function L_WindowsLogic(obj) { - //是否存在一个窗口Flag - local WindowExistence = false; - //遍历窗口队列 如果可见则调用Show 只要有一个可见就写入Flag - foreach(Window in L_Windows_List) { - if (sq_GetCurrentModuleType() != 2) Window.Proc(obj); - if (Window.Visible) { - if (sq_GetCurrentModuleType() != 2) Window.Show(obj); - if (sq_GetCurrentModuleType() != 2) Window.TopShow(obj); - if (!Window.rawin("NoWindow")) { - WindowExistence = true; - } - } - } - - //如果可见 需要调用一个原生窗口抵消ESC - if (WindowExistence) { - local W = sq_GetPopupWindowMainCotrol(170); - if (!W) L_NewWindows("Lenheart", 170, 0x65535); - else { - W.SetVisible(false); - W.SetEnable(false); - } - } - //没有任何新窗口打开 并且原生窗口开启者 - else { - local W = sq_GetPopupWindowMainCotrol(170); - if (W) { - L_sq_UseSkill(DIK_ESCAPE); - } - } - //如果按下ESC键要将所有的窗口关闭 - if (WindowExistence) { - if (KeyPressNB.isKeyPress(48, "AllLenheartWindows") || sq_GetCurrentModuleType() == 2) { - local Flag = false; - foreach(Window in L_Windows_List) { - if (!Window.rawin("NoWindow")) { - Flag = true; - Window.CloseWindow(); - } - } - if (Flag) { - getroottable().WindowsShowABFlag <- false; - //还原鼠标 - R_Mouse.Restore(); - L_Sq_CallFunc(0x11A8B60, "void", FFI_MS_CDECL, []); - // L_sq_MouseClick(); - Rindro_MouseClickFlag = 5; - } - } - } - -} -//绘制下层回调 -function L_DrawWindow_A() { - local obj = sq_getMyCharacter(); - if (!obj) return; - - //A层只在下层渲染 - if (getroottable().WindowsShowABFlag == false) L_WindowsLogic(obj); -} -//绘制上层回调 -function L_DrawWindow_B() { - local obj = sq_getMyCharacter(); - if (!obj) return; - - //B层只在上层渲染 - if (getroottable().WindowsShowABFlag) L_WindowsLogic(obj); - - local RootTab = getroottable(); - if (RootTab.rawin("LenheartTopFuncTab")) { - local LenheartFunc = RootTab["LenheartTopFuncTab"]; - foreach(Func in LenheartFunc) { - Func(obj); - } - } -} - - - - -class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow { - X = 0; - Y = 0; - Localtion_X = 0; - Localtion_Y = 0; - Width = null; - Height = null; - isLBDown = false; - isInRect = false; - - OnClick = null; - OnClickEx = null; - OnClickSound = null; - ObjectId = null; - - Visible = true; - - TopCallBackFunc = null; - - Data = null; - DeBugMode = false; - - constructor(x, y, width, height) { - this.Localtion_X = x; - this.Localtion_Y = y; - this.Width = width; - this.Height = height; - - ObjectId = Clock(); - } - - //同步坐标 - function SyncPos(x, y) { - this.X = Localtion_X + x; - this.Y = Localtion_Y + y; - } - - //鼠标事件回调 - function OnMouseProc(Flag, MousePos_X, MousePos_Y) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true; - else isInRect = false; - } - //鼠标左键按下回调 - function OnMouseLbDown(MousePos_X, MousePos_Y) { - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { - isLBDown = true; - if (!OnClickSound) { - R_Utils.PlaySound("CLICK_BUTTON1"); - } else { - R_Utils.PlaySound(OnClickSound); - } - } - } - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - if (isLBDown) { - if (OnClick) OnClick(); - if (OnClickEx) OnClickEx(this); - } - isLBDown = false; - } - - //鼠标右键按下回调 - function OnMouseRbDown(MousePos_X, MousePos_Y) { - - } - //鼠标右键弹起回调 - function OnMouseRbUp(MousePos_X, MousePos_Y) { - - } - //鼠标滚轮时间回调 - function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { - - } - - function TopShow(obj) { - if (TopCallBackFunc) TopCallBackFunc(obj, this); - if (DeBugMode) DeBug(obj); - } - - function DeBug(obj) { - sq_DrawBox(X, Y, Width, Height, 0xffffffff); - } - -} - -class LenheartNewUI_BaseButton extends LenheartNewUI_CommonUi { - State = 0; - BaseIdx = 29; - DWidth = null; - Path = null; - Idx = null; - - - constructor(X, Y, W, H, Path, Idx) { - this.DWidth = W; - this.Path = Path; - this.Idx = Idx; - LenheartNewUI_CommonUi.constructor(X, Y, W, H); - - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_DrawImg(Path, Idx + 3, X, Y + 1); - } else { - //按下 - if (isLBDown) { - L_sq_DrawImg(Path, Idx + 2, X, Y + 1); - } - //悬停 - else if (isInRect) { - L_sq_DrawImg(Path, Idx + 1, X, Y); - } - //普通 - else { - L_sq_DrawImg(Path, Idx, X, Y); - } - } - } -} - -class LenheartNewUI_Button extends LenheartNewUI_CommonUi { - State = 0; - BaseIdx = 29; - DWidth = null; - Path = "interface/lenheartwindowcommon.img"; - Idx = 172; - FillWidth = 2; - FirstWidth = 28; - - - - constructor(X, Y, W) { - this.DWidth = W; - LenheartNewUI_CommonUi.constructor(X, Y, W + 28 * 2, 24); - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 9, FillWidth, FirstWidth); - } else { - //按下 - if (isLBDown) { - L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 3, FillWidth, FirstWidth); - } - //悬停 - else if (isInRect) { - L_sq_DrawButton(X, Y, this.DWidth, Path, Idx + 3, FillWidth, FirstWidth); - } - //普通 - else { - L_sq_DrawButton(X, Y, this.DWidth, Path, Idx, FillWidth, FirstWidth); - } - } - } -} - -class LenheartNewUI_VerticalButton extends LenheartNewUI_CommonUi { - State = 0; - BaseIdx = 29; - DHeight = null; // 改为高度 - Path = "interface/lenheartwindowcommon.img"; - Idx = 172; - FillHeight = 2; // 改为填充高度 - FirstHeight = 28; // 改为首节高度 - Width = 24; // 固定宽度,垂直按钮宽度通常是固定的 - - constructor(X, Y, H) { - this.DHeight = H; - LenheartNewUI_CommonUi.constructor(X, Y, 24, H + 28 * 2); // 宽度固定,高度动态 - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_Draw3Image_Vertical(X + 1, Y, this.Width, this.DHeight, Path, Idx + 9, FillHeight, FirstHeight); - } else { - //按下 - if (isLBDown) { - L_sq_Draw3Image_Vertical(X + 1, Y, this.Width, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight); - } - //悬停 - else if (isInRect) { - L_sq_Draw3Image_Vertical(X, Y, this.Width, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight); - } - //普通 - else { - L_sq_Draw3Image_Vertical(X, Y, this.Width, this.DHeight, Path, Idx, FillHeight, FirstHeight); - } - } - } -} - - -class LenheartNewUI_ButtonText extends LenheartNewUI_Button { - TextStr = null; - TextX = null; - TextY = null; - TextColor = null; - TextRColor = null; - - TextXoffset = null; - TextYoffset = null; - - constructor(X, Y, W, Str) { - LenheartNewUI_Button.constructor(X, Y, W); - this.TextStr = Str; - TextColor = sq_RGBA(185, 148, 96, 255); - TextRColor = sq_RGBA(227, 212, 154, 255); - - TextXoffset = 19; - TextYoffset = 3; - } - - function SetTextColor(RGBA) { - TextColor = RGBA; - } - - function SetTextOffset(gX, gY) { - TextXoffset = gX; - TextYoffset = gY; - } - - function Show(obj) { - LenheartNewUI_Button.Show(obj); - local Color = TextColor; - local SY = Y + TextYoffset; - if (State != 8) { - if (isLBDown) { - SY = Y + TextYoffset + 1; - } - if (isInRect || State == 1) { - Color = TextRColor; - } - } - L_sq_DrawCode(TextStr, X + TextXoffset + 19, SY + 5, Color, 0, 1); - } -} - -class LenheartNewUI_BaseInput extends LenheartNewUI_CommonUi { - State = 0; - InputState = 0; - DWidth = null; - str = ""; - sliceCode = "|"; - BaseTime = 0; - InputController = null; - CallBack = null; - - constructor(X, Y, W, H) { - this.DWidth = W; - LenheartNewUI_CommonUi.constructor(X, Y, W, H); - } - - function sliceCodeFlicker() { - local T = Clock(); - if ((T - 500) >= BaseTime) { - BaseTime = T; - if (sliceCode.len() > 0) sliceCode = ""; - else if (sliceCode.len() == 0) sliceCode = "|"; - } - } - - function Show(obj) { - //光标闪烁 - if (InputState == 1) sliceCodeFlicker(); - else sliceCode = ""; - - L_sq_DrawImg("interface/lenheartwindowcommon.img", 63, this.X, this.Y); - for (local i = 0; i< this.Width; i++) { - L_sq_DrawImg("interface/lenheartwindowcommon.img", 64, this.X + 3 + i, this.Y); - } - L_sq_DrawImg("interface/lenheartwindowcommon.img", 65, this.X + 3 + this.Width, this.Y); - L_sq_DrawCode(str + sliceCode, this.X + 4, this.Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1); - this.OnClick = function() { - InputController = L_sq_NewInputBox(this.X, this.Y, this.Width, this.Height, str); - InputState = 1; - } - - - if (InputController) { - local StrBuf = L_sq_GetInputBoxStr(InputController); - if (StrBuf != "LenheartNULL") { - local oldStr = str; - str = StrBuf; - if (CallBack) CallBack(this, oldStr); - } else { - InputController = null; - InputState = 0; - } - } - } - - function SetStr(Value) { - L_sq_SetInputBoxStr(InputController, Value); - } -} - -//复选框 -class LenheartNewUI_SwitchButton extends LenheartNewUI_CommonUi { - State = 0; - ImgIndex = null; - ImgPath = "interface/lenheartwindowcommon.img"; - - constructor(X, Y) { - LenheartNewUI_CommonUi.constructor(X, Y, 14, 15); - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex + 3 : 141, X, Y + 1); - } else { - //悬停 - if (isLBDown) { - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex + 2 : 140, X, Y + 1); - } - //按下 - else if (isInRect) { - if (State == 0) - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex + 1 : 139, X, Y); - if (State == 1) - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex + 2 : 140, X, Y); - } - //普通 - else { - if (State == 0) - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex : 138, X, Y); - if (State == 1) - L_sq_DrawImg(ImgPath, ImgIndex ? ImgIndex + 2 : 140, X, Y); - - } - } - } -} - -class LenheartNewUI_SwitchButtonText extends LenheartNewUI_SwitchButton { - - TextStr = null; - TextX = 0; - TextY = 0; - TextColor = null; - TextRColor = null; - - - constructor(X, Y, Str) { - LenheartNewUI_SwitchButton.constructor(X, Y); - this.TextStr = Str; - TextColor = sq_RGBA(221, 197, 147, 250); - TextRColor = sq_RGBA(255, 255, 184, 250); - } - - function SetTextColor(RGBA) { - TextColor = RGBA; - } - - function SetTextPos(gX, gY) { - TextX = gX; - TextY = gY; - } - - function Show(obj) { - LenheartNewUI_SwitchButton.Show(obj); - local Color = TextColor; - local SY = Y; - if (State != 8) { - if (isLBDown) { - SY = Y + 1; - } - if (isInRect || State == 1) { - Color = TextRColor; - } - } - L_sq_DrawCode(TextStr, X + 16 + TextX, SY + 1 + TextY, Color, 0, 1); - } -} - -class LenheartNewUI_Tabbars extends LenheartNewUI_CommonUi { - State = 0; - Path = "interface/lenheartwindowcommon.img"; - Idx = 29; - - constructor(X, Y, ...) { - if (vargc == 2) { - LenheartNewUI_CommonUi.constructor(X, Y, vargv[0], vargv[1]); - } else { - LenheartNewUI_CommonUi.constructor(X, Y, 61, 19); - } - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_DrawImg(Path, Idx + 3, X, Y); - } else { - //按下 - if (isLBDown) { - L_sq_DrawImg(Path, Idx + 1, X, Y + 1); - } - //悬停 - else if (isInRect) { - if (State == 0) - L_sq_DrawImg(Path, Idx + 1, X, Y); - if (State == 1) - L_sq_DrawImg(Path, Idx + 2, X, Y); - } - //普通 - else { - if (State == 0) - L_sq_DrawImg(Path, Idx, X, Y); - if (State == 1) - L_sq_DrawImg(Path, Idx + 2, X, Y); - } - } - } -} - -class LenheartNewUI_TabbarsText extends LenheartNewUI_Tabbars { - TextStr = null; - TextX = null; - TextY = null; - TextColor = null; - TextRColor = null; - - TextXoffset = null; - TextYoffset = null; - - constructor(X, Y, Str, ...) { - if (vargc == 2) { - LenheartNewUI_Tabbars.constructor(X, Y, vargv[0], vargv[1]); - } else { - LenheartNewUI_Tabbars.constructor(X, Y); - } - this.TextStr = Str; - TextColor = sq_RGBA(124, 110, 82, 255); - TextRColor = sq_RGBA(185, 172, 145, 255); - - TextXoffset = 19; - TextYoffset = 3; - } - - function SetTextColor(RGBA) { - TextColor = RGBA; - } - - function SetTextOffset(gX, gY) { - TextXoffset = gX; - TextYoffset = gY; - } - - function Show(obj) { - LenheartNewUI_Tabbars.Show(obj); - local Color = TextColor; - local SY = Y + TextYoffset; - if (State != 8) { - if (isLBDown) { - SY = Y + TextYoffset + 1; - } - if (isInRect || State == 1) { - Color = TextRColor; - } - } - if (State == 1) - L_sq_DrawCode(TextStr, X + TextXoffset, SY, Color, 0, 1); - if (State == 0 || State == 8) - L_sq_DrawCode(TextStr, X + TextXoffset, SY + 2, Color, 0, 1); - } -} - - -class Yosin_DragButton extends LenheartNewUI_CommonUi { - State = 0; - DHeight = null; // 改为高度 - Path = "interface/lenheartwindowcommon.img"; - Idx = 172; - FillHeight = 2; // 改为填充高度 - FirstHeight = 7; // 改为首节高度 - Width = 9; // 固定宽度,垂直按钮宽度通常是固定的 - Visible = true; - DeBugMode = false; - - BasePos = null; - MoveFlag = false; - //鼠标相对位置 - M_Xpos = null; - M_Ypos = null; - B_X = null; - B_Y = null; - Move_Value = 0; - Max_Move_Value = 0; - - CurrentMovePosY = 0; - - //当前滚动值 - CurrentScrollValue = 0.0; - - OnChange = null; - - constructor(X, Y, H) { - this.DHeight = H; - LenheartNewUI_CommonUi.constructor(X, Y, Width, H + 7 * 2); // 宽度固定,高度动态 - - BasePos = { - x = X, - y = Y - } - - } - - function SetFrame(gPath, gIdx) { - if (gPath) Path = gPath; - Idx = gIdx; - } - - function Show(obj) { - //不可用 - if (State == 8) { - L_sq_Draw3Image_Vertical(X + 1, Y, this.DHeight, Path, Idx + 9, FillHeight, FirstHeight); - } else { - //按下 - if (isLBDown) { - L_sq_Draw3Image_Vertical(X, Y + 1, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight); - } - //悬停 - else if (isInRect) { - L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight); - } - //普通 - else { - L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx, FillHeight, FirstHeight); - } - } - } - - - //鼠标左键按下回调 - function OnMouseLbDown(MousePos_X, MousePos_Y) { - LenheartNewUI_CommonUi.OnMouseLbDown(MousePos_X, MousePos_Y); - - if (isInRect) { - MoveFlag = true; - M_Xpos = MousePos_X; //原始鼠标位置数据 - M_Ypos = MousePos_Y; - B_X = X; //原始窗口位置 - B_Y = Y; - } - } - - //鼠标事件回调 - function OnMouseProc(Flag, MousePos_X, MousePos_Y) { - LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y); - - //移动 - if (MoveFlag) { - Move_Value = MousePos_Y - M_Ypos + CurrentMovePosY; - if (Move_Value > 0 && Move_Value <= Max_Move_Value) { - Y = (Move_Value); - Localtion_Y = (BasePos.y + Move_Value); - if (OnChange) { - local Rate = Move_Value.tofloat() / Max_Move_Value.tofloat(); - CurrentScrollValue = format("%.2f", Rate).tofloat(); - OnChange(CurrentScrollValue); - } - } - } - } - - //鼠标左键弹起回调 - function OnMouseLbUp(MousePos_X, MousePos_Y) { - LenheartNewUI_CommonUi.OnMouseLbUp(MousePos_X, MousePos_Y); - MoveFlag = false; - if (Move_Value< 0) Move_Value = 0; - if (Move_Value > Max_Move_Value) Move_Value = Max_Move_Value; - CurrentMovePosY = Move_Value; //记录当前移动位置 - } - - //设置最大移动值 - function SetMaxMoveValue(Value) { - Max_Move_Value = Value; - } - - //设置滚动回调函数 - function SetOnChange(OnChange) { - this.OnChange = OnChange; - } - - //设置滚动步进 - function SetStep(Step) { - // 计算新的移动值 - local newValue = CurrentMovePosY + (Step * Max_Move_Value).tointeger(); - - // 边界检查 - if (newValue< 0) newValue = 0; - if (newValue > Max_Move_Value) newValue = Max_Move_Value; - - // 更新位置 - Move_Value = newValue; - CurrentMovePosY = newValue; - Localtion_Y = BasePos.y + newValue; - // 更新并回调滚动值 - if (OnChange) { - local Rate = Move_Value.tofloat() / Max_Move_Value.tofloat(); - CurrentScrollValue = format("%.2f", Rate).tofloat(); - OnChange(CurrentScrollValue); - } - } - - //重置 - function Reset() { - Move_Value = 0; - CurrentMovePosY = 0; - Localtion_Y = BasePos.y; - // 更新并回调滚动值 - if (OnChange) { - local Rate = Move_Value.tofloat() / Max_Move_Value.tofloat(); - CurrentScrollValue = format("%.2f", Rate).tofloat(); - OnChange(CurrentScrollValue); - } - } -} - -class Yosin_ScrollBar { - - //上按钮 - UpButton = null; - //下按钮 - DownButton = null; - //滑动按钮 - ScrollButton = null; - //点击时步进的Y轴值 - Step = 0.0; - - Parent = null; - - constructor(X, Y, H, Sbtn_H) { - - - ScrollButton = Yosin_DragButton(X, Y + 13, Sbtn_H); - ScrollButton.SetFrame("interface/lenheartwindowcommon.img", 184); - //减去按钮高度 加滚动条长度加滚动条上下拼接长度15 加滚动条最大高度 - ScrollButton.SetMaxMoveValue(H - 26 - ScrollButton.Height); - - UpButton = LenheartNewUI_BaseButton(X, Y, 9, 13, "interface/lenheartwindowcommon.img", 16); - UpButton.OnClick = function() { - DoStep(-1); - }.bindenv(this); - - DownButton = LenheartNewUI_BaseButton(X, Y + H - 13, 9, 13, "interface/lenheartwindowcommon.img", 22); - DownButton.OnClick = function() { - DoStep(1); - }.bindenv(this); - } - - function DoStep(Flag) { - ScrollButton.SetStep(Step * Flag); - } - - function SetParent(Ui) { - Parent = Ui; - Ui.AddChild(UpButton); - Ui.AddChild(ScrollButton); - Ui.AddChild(DownButton); - } - - function RemoveSelf() { - for (local i = 0; i< Parent.Childrens.len(); i++) { - local obj = Parent.Childrens[i]; - if (obj == UpButton || obj == ScrollButton || obj == DownButton) { - Parent.Childrens.remove(i); - i--; - } - } - } - - function SetDebugModel(Flag) { - UpButton.DeBugMode = Flag; - ScrollButton.DeBugMode = Flag; - DownButton.DeBugMode = Flag; - } - - function SetOnChange(Func) { - ScrollButton.SetOnChange(Func); - } - - function SetStep(value) { - Step = value; - } - - function Reset() { - ScrollButton.Reset(); - } - -} \ No newline at end of file diff --git a/CSBase/UI/OldWindowsMap.nut b/CSBase/UI/OldWindowsMap.nut deleted file mode 100644 index 80f1567..0000000 --- a/CSBase/UI/OldWindowsMap.nut +++ /dev/null @@ -1,52 +0,0 @@ -/* -文件名:OldWindowsMap.nut -路径:Base/UI/OldWindowsMap.nut -创建日期:2024-08-06 18:56 -文件用途:用于查询是否鼠标悬停在原生窗口上的Flag 以下编号代表着没有悬停其他均为悬停在原生窗口 -*/ -NotOldWindowsMap <- {} -NotOldWindowsMap.rawset(92, 1); -NotOldWindowsMap.rawset(79, 1); -NotOldWindowsMap.rawset(2395, 1); -NotOldWindowsMap.rawset(2396, 1); -NotOldWindowsMap.rawset(3877, 1); -NotOldWindowsMap.rawset(3878, 1); -NotOldWindowsMap.rawset(3873, 1); -NotOldWindowsMap.rawset(3874, 1); -NotOldWindowsMap.rawset(3858, 1); -NotOldWindowsMap.rawset(3871, 1); -NotOldWindowsMap.rawset(3857, 1); -NotOldWindowsMap.rawset(3861, 1); -NotOldWindowsMap.rawset(3862, 1); -NotOldWindowsMap.rawset(93, 1); -NotOldWindowsMap.rawset(94, 1); -NotOldWindowsMap.rawset(95, 1); -NotOldWindowsMap.rawset(96, 1); -NotOldWindowsMap.rawset(97, 1); -NotOldWindowsMap.rawset(98, 1); -NotOldWindowsMap.rawset(99, 1); -NotOldWindowsMap.rawset(100, 1); -NotOldWindowsMap.rawset(101, 1); -NotOldWindowsMap.rawset(114, 1); -NotOldWindowsMap.rawset(88, 1); -NotOldWindowsMap.rawset(102, 1); -NotOldWindowsMap.rawset(108, 1); -NotOldWindowsMap.rawset(109, 1); -NotOldWindowsMap.rawset(103, 1); -NotOldWindowsMap.rawset(104, 1); -NotOldWindowsMap.rawset(110, 1); -NotOldWindowsMap.rawset(111, 1); -NotOldWindowsMap.rawset(105, 1); -NotOldWindowsMap.rawset(106, 1); -NotOldWindowsMap.rawset(112, 1); -NotOldWindowsMap.rawset(113, 1); -NotOldWindowsMap.rawset(107, 1); -NotOldWindowsMap.rawset(87, 1); -NotOldWindowsMap.rawset(86, 1); -NotOldWindowsMap.rawset(80, 1); -NotOldWindowsMap.rawset(81, 1); -NotOldWindowsMap.rawset(82, 1); -NotOldWindowsMap.rawset(83, 1); -NotOldWindowsMap.rawset(4067, 1); -NotOldWindowsMap.rawset(122, 1); -NotOldWindowsMap.rawset(120, 1); \ No newline at end of file diff --git a/CSBase/_ENUM/_ENUM_.nut b/CSBase/_ENUM/_ENUM_.nut deleted file mode 100644 index 0aadf47..0000000 --- a/CSBase/_ENUM/_ENUM_.nut +++ /dev/null @@ -1,426 +0,0 @@ -/* -文件名:_ENUM_KEY.nut -路径:Base/_ENUM/_ENUM_KEY.nut -创建日期:2024-08-06 22:09 -文件用途:按键枚举类 -*/ -DIK_ESCAPE <- 0x01 -DIK_1 <- 0x02 -DIK_2 <- 0x03 -DIK_3 <- 0x04 -DIK_4 <- 0x05 -DIK_5 <- 0x06 -DIK_6 <- 0x07 -DIK_7 <- 0x08 -DIK_8 <- 0x09 -DIK_9 <- 0x0A -DIK_0 <- 0x0B -DIK_MINUS <- 0x0C /* - on main keyboard */ -DIK_EQUALS <- 0x0D -DIK_BACK <- 0x0E /* backspace */ -DIK_TAB <- 0x0F -DIK_Q <- 0x10 -DIK_W <- 0x11 -DIK_E <- 0x12 -DIK_R <- 0x13 -DIK_T <- 0x14 -DIK_Y <- 0x15 -DIK_U <- 0x16 -DIK_I <- 0x17 -DIK_O <- 0x18 -DIK_P <- 0x19 -DIK_LBRACKET <- 0x1A -DIK_RBRACKET <- 0x1B -DIK_RETURN <- 0x1C /* Enter on main keyboard */ -DIK_LCONTROL <- 0x1D -DIK_A <- 0x1E -DIK_S <- 0x1F -DIK_D <- 0x20 -DIK_F <- 0x21 -DIK_G <- 0x22 -DIK_H <- 0x23 -DIK_J <- 0x24 -DIK_K <- 0x25 -DIK_L <- 0x26 -DIK_SEMICOLON <- 0x27 -DIK_APOSTROPHE <- 0x28 -DIK_GRAVE <- 0x29 /* accent grave */ -DIK_LSHIFT <- 0x2A -DIK_BACKSLASH <- 0x2B -DIK_Z <- 0x2C -DIK_X <- 0x2D -DIK_C <- 0x2E -DIK_V <- 0x2F -DIK_B <- 0x30 -DIK_N <- 0x31 -DIK_M <- 0x32 -DIK_COMMA <- 0x33 -DIK_PERIOD <- 0x34 /* . on main keyboard */ -DIK_SLASH <- 0x35 /* / on main keyboard */ -DIK_RSHIFT <- 0x36 -DIK_MULTIPLY <- 0x37 /* * on numeric keypad */ -DIK_LMENU <- 0x38 /* left Alt */ -DIK_SPACE <- 0x39 -DIK_CAPITAL <- 0x3A -DIK_F1 <- 0x3B -DIK_F2 <- 0x3C -DIK_F3 <- 0x3D -DIK_F4 <- 0x3E -DIK_F5 <- 0x3F -DIK_F6 <- 0x40 -DIK_F7 <- 0x41 -DIK_F8 <- 0x42 -DIK_F9 <- 0x43 -DIK_F10 <- 0x44 -DIK_NUMLOCK <- 0x45 -DIK_SCROLL <- 0x46 /* Scroll Lock */ -DIK_NUMPAD7 <- 0x47 -DIK_NUMPAD8 <- 0x48 -DIK_NUMPAD9 <- 0x49 -DIK_SUBTRACT <- 0x4A /* - on numeric keypad */ -DIK_NUMPAD4 <- 0x4B -DIK_NUMPAD5 <- 0x4C -DIK_NUMPAD6 <- 0x4D -DIK_ADD <- 0x4E /* + on numeric keypad */ -DIK_NUMPAD1 <- 0x4F -DIK_NUMPAD2 <- 0x50 -DIK_NUMPAD3 <- 0x51 -DIK_NUMPAD0 <- 0x52 -DIK_DECIMAL <- 0x53 /* . on numeric keypad */ -DIK_OEM_102 <- 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ -DIK_F11 <- 0x57 -DIK_F12 <- 0x58 -DIK_F13 <- 0x64 /* (NEC PC98) */ -DIK_F14 <- 0x65 /* (NEC PC98) */ -DIK_F15 <- 0x66 /* (NEC PC98) */ -DIK_KANA <- 0x70 /* (Japanese keyboard) */ -DIK_ABNT_C1 <- 0x73 /* /? on Brazilian keyboard */ -DIK_CONVERT <- 0x79 /* (Japanese keyboard) */ -DIK_NOCONVERT <- 0x7B /* (Japanese keyboard) */ -DIK_YEN <- 0x7D /* (Japanese keyboard) */ -DIK_ABNT_C2 <- 0x7E /* Numpad . on Brazilian keyboard */ -DIK_NUMPADEQUALS <- 0x8D /* = on numeric keypad (NEC PC98) */ -DIK_PREVTRACK <- 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ -DIK_AT <- 0x91 /* (NEC PC98) */ -DIK_COLON <- 0x92 /* (NEC PC98) */ -DIK_UNDERLINE <- 0x93 /* (NEC PC98) */ -DIK_KANJI <- 0x94 /* (Japanese keyboard) */ -DIK_STOP <- 0x95 /* (NEC PC98) */ -DIK_AX <- 0x96 /* (Japan AX) */ -DIK_UNLABELED <- 0x97 /* (J3100) */ -DIK_NEXTTRACK <- 0x99 /* Next Track */ -DIK_NUMPADENTER <- 0x9C /* Enter on numeric keypad */ -DIK_RCONTROL <- 0x9D -DIK_MUTE <- 0xA0 /* Mute */ -DIK_CALCULATOR <- 0xA1 /* Calculator */ -DIK_PLAYPAUSE <- 0xA2 /* Play / Pause */ -DIK_MEDIASTOP <- 0xA4 /* Media Stop */ -DIK_VOLUMEDOWN <- 0xAE /* Volume - */ -DIK_VOLUMEUP <- 0xB0 /* Volume + */ -DIK_WEBHOME <- 0xB2 /* Web home */ -DIK_NUMPADCOMMA <- 0xB3 /* , on numeric keypad (NEC PC98) */ -DIK_DIVIDE <- 0xB5 /* / on numeric keypad */ -DIK_SYSRQ <- 0xB7 -DIK_RMENU <- 0xB8 /* right Alt */ -DIK_PAUSE <- 0xC5 /* Pause */ -DIK_HOME <- 0xC7 /* Home on arrow keypad */ -DIK_UP <- 0xC8 /* UpArrow on arrow keypad */ -DIK_PRIOR <- 0xC9 /* PgUp on arrow keypad */ -DIK_LEFT <- 0xCB /* LeftArrow on arrow keypad */ -DIK_RIGHT <- 0xCD /* RightArrow on arrow keypad */ -DIK_END <- 0xCF /* End on arrow keypad */ -DIK_DOWN <- 0xD0 /* DownArrow on arrow keypad */ -DIK_NEXT <- 0xD1 /* PgDn on arrow keypad */ -DIK_INSERT <- 0xD2 /* Insert on arrow keypad */ -DIK_DELETE <- 0xD3 /* Delete on arrow keypad */ -DIK_LWIN <- 0xDB /* Left Windows key */ -DIK_RWIN <- 0xDC /* Right Windows key */ -DIK_APPS <- 0xDD /* AppMenu key */ -DIK_POWER <- 0xDE /* System Power */ -DIK_SLEEP <- 0xDF /* System Sleep */ -DIK_WAKE <- 0xE3 /* System Wake */ -DIK_WEBSEARCH <- 0xE5 /* Web Search */ -DIK_WEBFAVORITES <- 0xE6 /* Web Favorites */ -DIK_WEBREFRESH <- 0xE7 /* Web Refresh */ -DIK_WEBSTOP <- 0xE8 /* Web Stop */ -DIK_WEBFORWARD <- 0xE9 /* Web Forward */ -DIK_WEBBACK <- 0xEA /* Web Back */ -DIK_MYCOMPUTER <- 0xEB /* My Computer */ -DIK_MAIL <- 0xEC /* Mail */ -DIK_MEDIASELECT <- 0xED /* Media Select */ -FFI_FIRST_ABI <- 0; -FFI_SYSV <- 1; -FFI_STDCALL <- 2; -FFI_THISCALL <- 3; -FFI_FASTCALL <- 4; -FFI_MS_CDECL <- 5; -FFI_PASCAL <- 6; -FFI_REGISTER <- 7; - - -function Sq_L_Medal(x, y) {} - -function Sq_SettingWindowCallBack(x, y) {} - -function Sq_BuffSwitchingCallBack(x, y) {} - -function Sq_SwitchingCallBack(x, y) {} - -function Sq_UpgradeCallBack(x, y) {} - -function Sq_RecoveryCallBack(x, y) {} - -function Sq_RecoveryTypeSetCallBack(Type) {} - -function Sq_DrawMainMaxLayerCustomUI(pack) {} - -function Lenheart(VmTop) {} - -function Sq_MouseEventCallBack(Lb, Rb, Mb) {} - -function Sq_SelectCharacter(Chunk) {} - -function Sq_DrawMainTopLayerCustomUI(pack) {} - -function Sq_GetExeStr_Event(StrIndex) { - return StrIndex; -} - -function Sq_CreatChr(chunk) {} - -function Sq_SendPackType_Event(Type) {} - -function Sq_SendPackByte_Event(Parm) {} - -function Sq_SendPackWord_Event(Parm) {} - -function Sq_SendPackDWord_Event(Parm) {} - -function Sq_SendPackChar_Event(Parm) {} - -function Sq_SendPack_Event() {} - -function Sq_DrawItemBack(Xpos, Ypos, Image) {} - -function Sq_DrawItemFront(Xpos, Ypos, Image) {} - -function Sq_GetDrawMonBloodSw() { - return false; -} - -function Sq_DrawMonsterBlood(Object, X, Y) {} - -function Sq_Set_Inventory_M_Pos(This) {} - -function Sq_Get_Ex_IntData(SkillAddress, Idx, objAddress) { - return 0; -} - -function Sq_Get_Ex_SkillCoolTime(SkillAddress, Idx, objAddress) { - return 0; -} - -function Sq_Get_Ex_LevelData(SkillAddress, Idx, objAddress) { - return 0; -} - -function Sq_PlayerEachPos(x, y) {} - -function Sq_DrawMainMaxLayerCustomUI(pack) {} - -function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A8, A9) { - return true; -} - -function Sq_PushDamageData(ObjAddress, MySelfAddress, Value); - -function Sq_Pack_Control(chunk) {} - -function Sq_MessageWindowDraw(a, c) {} - -function Sq_Get_Event_Pos_X() { - return 1; -} - -function Sq_Get_Event_Pos_Y() { - return 1; -} - -function Sq_L_OtherPlayerInfo(x, y, Type, Value, ImgBuf) { - local str = Value.tostring(); - local lenght = L_sq_GetStringDrawLength(str); - L_sq_DrawImg(ImgBuf, x + 70 - lenght, y + 5); - return Value; -} - -function Sq_DrawMiniMapUI(a) {} - -function Sq_CompleteTask(a1, a2, a3) {} - -function L_drawMainCustomUI_All() {} - -function L_MouseCallBack(a, b, c, d) {} - -function L_DrawWindow_A() {} - -function L_DrawWindow_B() {} - -function L_OpenOldWindowCallBack(WindowIndex) {} - -function L_Old_Window_Get(WindowObject) {} - -function L_Character_Info_Window(WindowObject) { - return false; -} - -function L_Other_Character_Info_Window(WindowObject) { - return false; -} - -function L_Old_Window_Visible(WindowObject, Flag) {} - - -getroottable().LenheartBaseFuncTab <- {}; -getroottable().LenheartFuncTab <- {}; -getroottable().Rindro_Scr_Width <- L_sq_RA(0x4D848E); -getroottable().Rindro_Scr_High <- L_sq_RA(0x4D8495); - -//获取装备偏移 -function Rindro_GetEquAddr(addr) { - switch (addr) { - case 1: - return 0x3038; - break; - case 2: - return 0x304C; - break; - case 3: - return 0x3048; - break; - case 4: - return 0x3050; - break; - case 5: - return 0x3044; - break; - case 6: - return 0x3040; - break; - case 7: - return 0x3058; - break; - case 8: - return 0x305C; - break; - case 9: - return 0x3054; - break; - case 10: - return 0x3060; - break; - case 11: - return 0x3064; - break; - case 12: - return 0x303c; - break; - - - case 13: //帽子 - return 0x3010; - break; - case 14: //头部 - return 0x3014; - break; - case 15: //脸 - return 0x3018; - break; - case 16: - return 0x301c; - break; - case 17: - return 0x3020; - break; - case 18: - return 0x3024; - break; - case 19: - return 0x3028; - break; - case 20: - return 0x302c; - break; - case 21: - return 0x3030; - break; - case 22: - return 0x3034; - break; - case 23: - return 0x3030; - break; - case 24: - return 0x3068; - break; - case 25: - return 0x306C; - break; - case 26: - return 0x3070; - break; - case 27: - return 0x3074; - break; - } - return -1; -} - -//本地模式 -if(!getroottable().rawin("RINDROLOCAL"))RINDROLOCAL <- false; - -function deepcopy(obj) { - local copies = {}; // 用于跟踪已拷贝对象的表 - return _deepcopy(obj, copies); -} - -function _deepcopy(obj, copies) { - local type = typeof obj; - - // 处理基本类型 - if (type != "table" && type != "array" && type != "class" && type != "instance") { - return obj; - } - - // 处理循环引用 - if (obj in copies) { - return copies[obj]; - } - - // 创建新容器 - local newObj; - if (type == "array") { - newObj = array(obj.len()); - copies[obj] <- newObj; // 在拷贝前记录 - - for (local i = 0; i < obj.len(); i++) { - newObj[i] = _deepcopy(obj[i], copies); - } - } - else if (type == "table") { - newObj = {}; - copies[obj] <- newObj; // 在拷贝前记录 - - foreach(key, val in obj) { - // 键也需要深拷贝 - local newKey = _deepcopy(key, copies); - local newVal = _deepcopy(val, copies); - newObj[newKey] <- newVal; - } - } - else { // 类和实例(浅拷贝) - newObj = obj; - copies[obj] <- newObj; - } - - return newObj; -} \ No newline at end of file diff --git a/CSBase/_Tool/Animation_Class.nut b/CSBase/_Tool/Animation_Class.nut deleted file mode 100644 index f28252d..0000000 --- a/CSBase/_Tool/Animation_Class.nut +++ /dev/null @@ -1,545 +0,0 @@ -/* -文件名:Animation_Class.nut -路径:Base/_Tool/Animation_Class.nut -创建日期:2024-10-21 16:57 -文件用途:动画类 -*/ -class Rindro_Animation { - - //Ani是否可用 - IsUsability = true; - - //当前帧数 - CurrentFrameIndex = 0; - //当前帧时间 - CurrentIndexT = 0; - //当前帧 - CurrentFrame = null; - - //Ani的标签 - AnimationFlag = null; - //图片对象数组 - PngList = null; - //帧对象数组 - FrameList = null; - - //附加选项 - AdditionalOptions = null; - - //角度 - Angle = 0; - - - constructor(Data, ...) { - PngList = []; - FrameList = []; - - //附加选项 - if (vargc > 0) AdditionalOptions = vargv[0]; - - //初始化数据 - InitData(Data); - } - - - function InitData(Data) { - local Buf; - - if (type(Data) == "table") { - Buf = Data; - } - //从PVF数据加载 - else if (type(Data) == "string") { - local ReadObject = R_Utils.GetScriptFileReader(Data); - if (ReadObject) { - Buf = Rindro_Script.ReadAnimation(ReadObject); - } - } - - if (Buf) { - AnimationFlag = Buf.Flag; - FrameList = Buf.Frame; - foreach(FrameObj in FrameList) { - //如果有附加处理 格式化 - if (AdditionalOptions && AdditionalOptions.rawin("ImgFormat")) FrameObj.Img_Path = AdditionalOptions["ImgFormat"](FrameObj.Img_Path); - local Png = Rindro_Image.Load(FrameObj.Img_Path); - // Png.Draw(-500, -500); - - //如果有附加处理 坐标 - if (AdditionalOptions && AdditionalOptions.rawin("Pos")) { - FrameObj.Pos.x += AdditionalOptions["Pos"].x; - FrameObj.Pos.y += AdditionalOptions["Pos"].y; - } - // Spritebuf.SetPosition(FrameObj.Pos); - - PngList.append(Png); - } - } else { - AnimationFlag = {}; - FrameList.append({ - AttackBox = [], - DamageBox = [], - Delay = 800, - Flag = {}, - Img_Index = 0, - Img_Path = "", - Pos = { - x = -248, - y = -331 - } - }) - - // print(Data); - // print("创建Ani失败,找不到Ani数据"); - } - } - - - //重置Ani - function Reset() { - IsUsability = true; - FlushFrame(0); - } - - //获取当前帧信息 - function GetCurrentFrameInfo() { - return FrameList[CurrentFrameIndex]; - } - - function FlushFrame(Index) { - if (PngList.len() <= 0) return; - //同步当前帧 - CurrentFrameIndex = Index; - //当前帧更换为本帧 - CurrentFrame = PngList[CurrentFrameIndex]; - - local FlagBuf = FrameList[CurrentFrameIndex].Flag; - //关键帧 - if ("SET_FLAG" in FlagBuf) { - // if (StateMachine && StateMachine.State != -1) StateMachine.ChangeAniKeyFlag(FlagBuf.SET_FLAG); - } - //播放音效 - if ("PLAY_SOUND" in FlagBuf) { - R_Utils.PlaySound(FlagBuf.PLAY_SOUND); - } - } - - //绘制 - function DrawFrame(X, Y) { - - // local NowDrawPng = CurrentFrame; - if (FrameList.len() <= 0) return; - local FrameObj = FrameList[CurrentFrameIndex]; - // printT(FrameObj); - - - //坐标偏移 - local XOffset = FrameObj.Pos.x; - local YOffset = FrameObj.Pos.y; - - //染色 - local RGBA = sq_RGBA(255, 255, 255, 255); - if ("RGBA" in FrameObj.Flag) { - local Fbuf = FrameObj.Flag.RGBA; - RGBA = sq_RGBA(Fbuf[0].tointeger(), Fbuf[1].tointeger(), Fbuf[2].tointeger(), Fbuf[3].tointeger()); - } - - //缩放 - local XRate = 1.0; - local YRate = 1.0; - if ("IMAGE_RATE" in FrameObj.Flag) { - local Fbuf = FrameObj.Flag.IMAGE_RATE; - XRate = Fbuf.x; - YRate = Fbuf.y; - } - - //线性减淡 - if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) { - L_sq_SetDrawImgModel(2, 0); - } - - if (CurrentFrame) CurrentFrame.DrawExPng(FrameObj.Img_Index, X + XOffset, Y + YOffset, Angle, RGBA, XRate, YRate); - - //线性减淡 - if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) { - L_sq_ReleaseDrawImgModel(); - } - } - - - function Draw(X, Y) { - //可用性检查 - if (IsUsability) { - DrawFrame(X, Y); - //累加当前帧时间 - CurrentIndexT += Rindro_Duration; - - //当前帧时间 超过 当前帧延迟就需要切换帧了 - if ("Delay" in FrameList[CurrentFrameIndex] && CurrentIndexT >= FrameList[CurrentFrameIndex].Delay) { - CurrentIndexT = 0; - //如果当前帧小于总帧数就切换 - if (CurrentFrameIndex<(FrameList.len() - 1)) { - FlushFrame(CurrentFrameIndex + 1); - } - //说明播放完毕了 - else { - //如果有循环 - if ("LOOP" in AnimationFlag) { - FlushFrame(0); - } - //没有循环触发状态机回调 - else { - //将不再可用 - IsUsability = false; - } - } - } - } - } - - function DrawIndex(X, Y, Index) { - // return; - if (IsUsability) { - FlushFrame(Index); - DrawFrame(X, Y); - } - } -} - - -//绘制角色类 -class Rindro_Draw_Character { - - //名字 - Name = null; - //职业 - Job = null; - - //绘制体信息 - DrawInfo = null; - - //隐藏图层Map - HideMap = null; - - - ENUM_RINDRO_JOB_NAME = ["swordman", "fighter", "gunner", "mage", "priest", "atgunner", "thief", "atfighter", "atmage", "demonicswordman", "creatormage"]; - ENUM_RINDRO_JOB_TITLE_HEIGHT = [ - //男鬼剑士 - { - x = -42, - y = -154 - }, - //女格斗 - { - x = -42, - y = -140 - }, - //男神枪手 - { - x = -44, - y = -168 - }, - //女魔法师 - { - x = -46, - y = -126 - }, - //男圣职者 - { - x = -46, - y = -166 - }, - //女神枪手 - { - x = -42, - y = -156 - }, - //女暗夜使者 - { - x = -44, - y = -154 - }, - //男格斗家 - { - x = -45, - y = -160 - }, - //男魔法师 - { - x = -45, - y = -140 - }, - //黑暗武士 - { - x = -42, - y = -154 - }, - //缔造者 - { - x = -46, - y = -126 - }, - ]; - - ENUM_RINDRO_JOB_FACE_HEIGHT = [ - //男鬼剑士 - { - x = 11, - y = 111 - }, - //女格斗 - { - x = 9, - y = 103 - }, - //男神枪手 - { - x = 13, - y = 131 - }, - //女魔法师 - { - x = 14, - y = 87 - }, - //男圣职者 - { - x = 16, - y = 126 - }, - //女神枪手 - { - x = 11, - y = 119 - }, - - //女暗夜使者 - { - x = 12, - y = 115 - }, - //男格斗家 - { - x = 13, - y = 119 - }, - //男魔法师 - { - x = 13, - y = 101 - }, - //黑暗武士 - { - x = -42, - y = -154 - }, - //缔造者 - { - x = -46, - y = -126 - }, - ]; - - - //获取角色AniBy装备 - function GetCharacAniByEqu(Job, Equ, AniName) { - local AniList = []; - foreach(value in Equ) { - if (value > 0) { - local ListBuf = CreateEquipmentAni(value, Job, AniName); - AniList.extend(ListBuf); - } - } - local n = AniList.len(); - for (local i = 0; i< n - 1; i++) { - for (local j = i + 1; j< n; j++) { - if (AniList[i].Layer > AniList[j].Layer) { - // 交换两个元素 - local temp = AniList[i]; - AniList[i] = AniList[j]; - AniList[j] = temp; - } - } - } - return AniList; - } - - function CreateEquipmentAni(Index, Job, AniName) { - local AniList = []; - //获取装备或时装的文件路径 - local FilePath = R_Utils.GetEquPath(Index); - if (FilePath) { - local ReadObject = R_Utils.GetScriptFileReader("equipment/" + FilePath); - if (ReadObject) { - local Equ = Rindro_Script.ReadEquipment(ReadObject); - //职业名字 - local JobName = ENUM_RINDRO_JOB_NAME[Job]; - //没有装备类型 - if (!(Equ.rawin("equipment_type"))) Equ.equipment_type <- "normal"; - //光环单独处理 其他的在下面处理 - if (Equ.equipment_type == "aurora avatar") { - foreach(Path in Equ.Aurora.Back) { - // local AniBuf = Rindro_Animation(Path); - AniList.append({ - Ani = Path, - AniName = Path + Clock(), - Layer = -10000, - DrawType = "Native" - }); - } - foreach(Path in Equ.Aurora.Front) { - // local AniBuf = Rindro_Animation(Path); - AniList.append({ - Ani = Path, - AniName = Path + Clock(), - Layer = 10000, - DrawType = "Native" - }); - } - } - //称号 - else if (Equ.equipment_type == "title name") { - local PathBuf = "equipment/" + FilePath; - PathBuf = PathBuf.slice(0, R_Utils.String.FindLastSubstring(PathBuf, "/")); - local Path = PathBuf + "/" + Equ.custom_animation; - local Ao = { - Pos = ENUM_RINDRO_JOB_TITLE_HEIGHT[Job] - } - local AniBuf = Rindro_Animation(Path, Ao); - AniList.append({ - Ani = AniBuf, - Layer = 10001, - }); - } - - //没有Ani 就那种透明时装 - if (!(Equ.rawin("Ani_" + JobName))) return AniList; - - //记录时装的隐藏图层值 - if (Equ.rawin("hidelayer")) { - foreach(value in Equ["hidelayer"]) { - HideMap.rawset(value, true); - } - } - - //读取Ani配置 - local AniScript = Equ["Ani_" + JobName]; - // printT(AniScript); - if (Equ.equipment_type == "skin avatar") { - local Path; - if (JobName.find("at") >= 0) { - Path = format("character/%s/atanimation/%s", JobName.slice(2), AniName); - } else Path = format("character/%s/animation/%s", JobName, AniName); - local Ao = { - ImgVariation = AniScript.variation, - ImgFormat = function(ImgPath) { - if (ImgVariation[0] > 0) { - local Pos = ImgPath.find("%04d"); - ImgPath = ImgPath.slice(0, Pos) + "%02d%02d" + ImgPath.slice(Pos + 4); - return format(ImgPath, ImgVariation[0], ImgVariation[1]); - } else { - return format(ImgPath, ImgVariation[1]); - } - } - } - local AniBuf = Rindro_Animation(Path, Ao); - AniList.append({ - Ani = AniBuf, - Layer = -1, - }); - } else { - foreach(Info in AniScript.layer_variation) { - local PathBuf = "equipment/" + FilePath; - PathBuf = PathBuf.slice(0, R_Utils.String.FindLastSubstring(PathBuf, "/")); - local Path = PathBuf + "/" + Info.Path + "/" + AniName; - local Ao = { - ImgVariation = AniScript.variation, - ImgFormat = function(ImgPath) { - return format(ImgPath, ImgVariation[0], ImgVariation[1]); - } - } - local AniBuf = Rindro_Animation(Path, Ao); - AniList.append({ - Ani = AniBuf, - Layer = Info.Zorder, - }); - } - } - } - } - return AniList; - } - - constructor(Job, EquipmentArr, Action, Name) { - HideMap = {}; - DrawInfo = GetCharacAniByEqu(Job, EquipmentArr, Action); - this.Job = Job; - this.Name = Name; - } - - function Draw(X, Y) { - foreach(AniInfo in DrawInfo) { - // print(AniInfo.Layer); - 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) { - L_sq_DrawCode(Name, 44 + X + ENUM_RINDRO_JOB_TITLE_HEIGHT[Job].x - (LenheartTextClass.GetStringLength(Name) / 2), Y + ENUM_RINDRO_JOB_TITLE_HEIGHT[Job].y + 24, sq_RGBA(255, 255, 255, 250), 1, 1); - } - } - - function DrawFace(X, Y) { - //兼容模式 - if (getroottable().PluginsCompatibilityModeCallBack){ - return; - } - setClip(X, Y, X + 22, Y + 18); //开始裁切 - foreach(AniInfo in DrawInfo) { - try { - AniInfo.Ani.DrawIndex(X + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].x, Y + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].y, 0); - } catch (exception) { - - } - } - releaseClip(); //裁切结束 - } -} -//鬼剑士 -//601580026 101550559 -// Sassq <- {}; -// Sassq[0] <- Rindro_Draw_Character(0, [ -// 601550071, -// 601560067, -// 601570062, -// 601500069, -// 601510068, -// 601540069, -// 601520061, -// 601530060, -// 601580026, -// 0, -// 27610, -// 26058 -// ], "rest.ani", "鬼剑士-Kina") -// //格斗家 -// Sassq[1] <- Rindro_Draw_Character(1, [26373, 102550540, 102560700, 102570504, 102520514, 102500742, 102510739, 102540664, 102580139, 102530474], "rest.ani", "Kina") -// //神枪手 -// Sassq[2] <- Rindro_Draw_Character(2, [26373, 104550553, 104560725, 104570492, 104520541, 104500750, 104510913, 104540671, 104580148, 104530494], "rest.ani", "Kina") -// //魔法师 -// Sassq[3] <- Rindro_Draw_Character(3, [26373, 106550521, 106560580, 106570446, 106520529, 106500603, 106510607, 106540583, 106580143, 106530461], "rest.ani", "Kina") -// //圣职者 -// Sassq[4] <- Rindro_Draw_Character(4, [26373, 108550600, 108560591, 108570687, 108520580, 108500587, 108510590, 108540562, 108580138, 108530560], "rest.ani", "Kina") -// //女枪 -// Sassq[5] <- Rindro_Draw_Character(5, [26373, 105550431, 105560424, 105570386, 105520415, 105500424, 105510429, 105540408, 105580144, 105530361], "rest.ani", "Kina") -// //暗夜 -// Sassq[6] <- Rindro_Draw_Character(6, [26373, 109550385, 109560393, 109570369, 109520406, 109500402, 109510414, 109540389, 109580134, 109530355], "rest.ani", "Kina") -// //男格斗 -// Sassq[7] <- Rindro_Draw_Character(7, [26373, 103550302, 103560311, 103570274, 103520297, 103500297, 103510301, 103540284, 103580128, 103530246], "rest.ani", "Kina") -// //男法 -// Sassq[8] <- Rindro_Draw_Character(8, [26373, 107550220, 107560223, 107570188, 107520224, 107500233, 107510231, 107540209, 107580129, 107530192], "rest.ani", "Kina") \ No newline at end of file diff --git a/CSBase/_Tool/BaseTool_Class.nut b/CSBase/_Tool/BaseTool_Class.nut deleted file mode 100644 index 20e9fe9..0000000 --- a/CSBase/_Tool/BaseTool_Class.nut +++ /dev/null @@ -1,516 +0,0 @@ -/* -文件名:BaseTool_Class.nut -路径:Base/_Tool/BaseTool_Class.nut -创建日期:2024-08-06 23:49 -文件用途:基础工具类 -*/ - -function printT(T) { - Sq_OutPutTable(Json.Encode(T)); -} -//Json类 -class Json { - function Encode(Table) { - - local JsonObj = JSONEncoder(); - return JsonObj.encode(Table); - - local Size = Table.len(); - local Pos = 0; - local Str = "{"; - foreach(Key, Value in Table) { - ++Pos; - Str += "\""; - Str += Key.tostring(); - Str += "\""; - Str += ":"; - if (typeof(Value) == "string") { - Str += "\""; - Str += Value; - Str += "\""; - } else if (typeof(Value) == "table") { - Str += Json.Encode(Value); - } else if (typeof(Value) == "array") { - Str += "["; - foreach(ArrObj in Value) { - if (typeof(ArrObj) == "table") Str += Json.Encode(Value); - else { - Str += ArrObj; - Str += ","; - } - } - Str = Str.slice(0, Str.len() - 1); - Str += "]"; - } else Str += Value; - if (Pos != Size) Str += ","; - } - Str += "}"; - return Str; - } - - function Decode(Str) { - // Str = L_sq_DecondeJson(Str); - // local Str = "local _M = " + Str + ";\n return _M;\n"; - // local Func = compilestring(Str); - // return Func(); - - local JsonObj = JSONParser(); - return JsonObj.parse(Str); - } -} -//Key 键盘按键类 -class KeyPress { - function KeyDown(obj, KeyValue) { - local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器 - KeyEvent.clear_vector(); //清空储存器的向量位 - if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) { - KeyEvent.setInt(0, 1); - return true; - } - } - - function KeyUp(obj, KeyValue) { - local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器 - if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) { - KeyEvent.setInt(0, 0); - } - } - - function isKeyPress(KeyValue) { - local obj = sq_getMyCharacter(); - if (KeyPress.KeyDown(obj, KeyValue)) { - return true; - } - KeyPress.KeyUp(obj, KeyValue); - } -} -//Key 键盘按键类 -class KeyPressNB { - function KeyDown(obj, KeyValue, VarKey) { - local KeyEvent = obj.getVar(VarKey); //声明储存器 - KeyEvent.clear_vector(); //清空储存器的向量位 - if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) { - KeyEvent.setInt(0, 1); - return true; - } - } - - function KeyUp(obj, KeyValue, VarKey) { - local KeyEvent = obj.getVar(VarKey); //声明储存器 - if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) { - KeyEvent.setInt(0, 0); - } - } - - function isKeyPress(KeyValue, VarKey) { - local obj = sq_getMyCharacter(); - obj = sq_GetCNRDObjectToActiveObject(obj); - if (KeyPressNB.KeyDown(obj, KeyValue, VarKey)) { - return true; - } - KeyPressNB.KeyUp(obj, KeyValue, VarKey); - } -} -//基础工具类 -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); - local ItemName = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString(); - return ItemName; - } - - function SendPack(T) { - local str = Json.Encode(T); - L_sq_SendPackType(130); - L_sq_SendPackWChar(str); - L_sq_SendPack(); - } - - function SendPackEx(T) { - local str = L_sq_EncondeJson(T); - L_sq_SendPackType(130); - L_sq_SendPackWChar(str); - L_sq_SendPack(); - } - - function RegisterPack(Id, CallBack) { - Pack_Control.rawset(Id, CallBack); - } - - function RegisterHexPack(Id, CallBack) - { - Pack_Hex_Control.rawset(Id, CallBack); - } - - //绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字 - function T_DrawStayAni(obj, aniFileName, x, y, index, aniname) { - local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName); - //sq_AnimationProc(SelectAni); - sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0); - return SelectAni; - } - - //绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字 - function T_DrawStayAniRate(obj, aniFileName, x, y, index, aniname, rate) { - local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName); - SelectAni.setImageRateFromOriginal(rate, rate); - //sq_AnimationProc(SelectAni); - sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0); - return SelectAni; - } - - //绘制简易动态Ani // obj -- ani路径 -- X -- Y -- ani名字 - function T_DrawDynamicAni(obj, aniFileName, x, y, aniname) { - local ani = obj.getVar().GetAnimationMap(aniname, aniFileName); - sq_AnimationProc(ani); - sq_drawCurrentFrame(ani, x, y, true); - return ani; - } - - //超简易绘制动态Ani - function DrawAniEx(X, Y, AniPath, ...) { - local AniName = "简易播放Ani:" + AniPath; - if (vargc > 0) AniName = vargv[0]; - local obj = sq_getMyCharacter(); - local ani = obj.getVar().GetAnimationMap(AniName, AniPath); - sq_AnimationProc(ani); - sq_drawCurrentFrame(ani, X, Y, true); - return ani; - } - - - - //初始化根表成员 - function InitClass(Name) { - local RootTab = getroottable(); - if (RootTab.rawin(Name) == true) { - RootTab.rawdelete(Name); - } - } - - //获取交互Npc名称 - function GetEachNpcId() { - local OneAddress = L_sq_RA(0x1ADE0E0); - if (OneAddress) { - local TowAddress = L_sq_RA(OneAddress + 8); - if (TowAddress) { - local Id = L_sq_RA(TowAddress + 0x210); - return Id; - } - } - 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)) { - Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img); - } - //绘制左上角 - Rindro_Image_GlobalMap[Img].DrawPng(StartIndex, X, Y); - //获取左上角的图片宽高 - local LeftTopW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetWidth(); - local LeftTopH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetHeight(); - - //绘制上边 - //获取上边的宽 - local TopW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 1).GetWidth(); - Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 1, X + LeftTopW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / TopW, 1.0); - - //绘制右上角 - Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 2, X + Width - LeftTopW, Y); - - //绘制左边 - //获取左边的高 - local LeftH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 3).GetHeight(); - Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 3, X, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), 1.0, (Height - LeftTopH * 2).tofloat() / LeftH); - - //绘制中间 - //获取中间的宽高 - local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 4).GetWidth(); - local MiddleH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 4).GetHeight(); - Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 4, X + LeftTopW, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / MiddleW, (Height - LeftTopH * 2).tofloat() / MiddleH); - - //绘制右边 - Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 5, X + Width - LeftTopW, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), 1.0, (Height - LeftTopH * 2).tofloat() / LeftH); - - //绘制左下角 - Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 6, X, Y + Height - LeftTopH); - - //绘制下边 - Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 7, X + LeftTopW, Y + Height - LeftTopH, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / TopW, 1.0); - - //绘制右下角 - Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 8, X + Width - LeftTopW, Y + Height - LeftTopH); - } - - -} -//获取文字绘制长度 -class LenheartTextClass { - function GetStringLength(str) { - if (typeof str != "string") str = "无字符"; - return L_sq_GetStringDrawLength(str); - } -} - -class MemoryTool { - //给指定地址写入字节数组 - function WirteByteArr(Address, ByteArr) { - for (local i = 0; i< ByteArr.len(); i++) { - L_sq_WAB(Address + i, ByteArr[i]); - } - } - - - //解密读取内存地址的数据 - function DecodeMemoryData(Address) { - local nEax, nEcx8, nEsi, nEdx, nTmp; - nEax = NativePointer(L_sq_I2P(Address)).readInt(); - if (nEax == -1) return nEax; - nEcx8 = NativePointer(L_sq_I2P(Address + 8)).readInt(); - if (nEcx8 == -1) return nEcx8; - nEsi = NativePointer(L_sq_I2P(0x1AF8D78)).readInt(); - if (nEsi == -1) return nEdx; - nEdx = nEax >> 16; - nTmp = (nEdx << 2) + nEsi + 36; - nEdx = NativePointer(L_sq_I2P(nTmp)).readInt(); - if (nEdx == -1) return nEdx; - nEax = nEax & 65535; - nTmp = (nEax << 2) + nEdx + 8468; - nEax = NativePointer(L_sq_I2P(nTmp)).readInt(); - if (nEax == -1) return nEax; - nEdx = nEax & 0xFFFF; - nEsi = nEdx << 16; - nEsi = nEsi | nEdx; - nEax = nEsi ^ nEcx8; - return nEax; - } - - //加密写入内存地址数据 - function EncodeMemoryData(AddreSs, Data) { - local JEdi, JEcx, JEax, JEsi, JEdx, JSs; - JEcx = AddreSs; - JEax = L_sq_RA(0x1AF8DB8); - JEax = JEax + 1; - L_sq_WA(0x1AF8DB8, JEax); - JEdx = JEax; - JEdx = JEdx >> 8; - JEdx = JEdx << 24; - JEdx = JEdx >> 24; - JEdx = L_sq_RA(JEdx * 2 + 0x1843F58); - JEdx = JEdx & 0xFFFF; - JEax = JEax << 24; - JEax = JEax >> 24; - JSs = L_sq_RA(JEax * 2 + 0x1844158); - JSs = JSs & 0xFFFF; - JEdx = JEdx ^ JSs; - JEax = JEdx; - JEax = JEax & 0xFFFF; - JEsi = Data; - JEdx = JEsi >> 16; - - JSs = JEsi & 0xFFFF; - JEdx = JEdx + JSs; - JEdx = JEdx ^ JEax; - JEdi = JEdx; - JEdx = JEax; - JEax = JEax << 16; - JEax = JEax + JEdx; - JEsi = Data; - JEax = JEax ^ JEsi; - JEsi = AddreSs + 8; - L_sq_WA(JEsi, JEax); - JEax = L_sq_RA(AddreSs); - JEsi = L_sq_RA(0x1AF8D78); - - JEcx = JEdi; - JEcx = JEcx << 16; - JEcx = JEcx + JEdx; - JEdx = JEax; - JEdx = JEdx >> 16; - JEdx = L_sq_RA(JEsi + JEdx * 4 + 36); - JEax = JEax & 0xFFFF; - L_sq_WA(JEdx + JEax * 4 + 8468, JEcx); - } - - function DecodeMemoryDataF(Address) { - local Value = MemoryTool.DecodeMemoryData(Address); - local Bl = blob(); - Bl.writen(Value, 'i'); - Bl.seek(0); - return Bl.readn('f'); - } - - function ReadFloat(Address) { - local Arr = []; - for (local i = 0; i< 4; i++) { - Arr.append(L_sq_RAB(Address + i)); - } - // local Value = L_sq_RAB(Address); - // print(Value); - local Bl = blob(); - foreach(intvalue in Arr) { - Bl.writen(intvalue, 'c'); - } - // Bl.writen(Value, 'i'); - Bl.seek(0); - return Bl.readn('f'); - } -} - -//大数字 -class longlong { - Value = null; - //构造函数 不管是不是string类型都要转成string类型 - constructor(StrValue) { - Value = StrValue.tostring(); - } - - function _add(other) { - return longlong(L_sq_LongLongOperation(this.Value, other.Value, "+")); - } - - function _sub(other) { - return longlong(L_sq_LongLongOperation(this.Value, other.Value, "-")); - } - - function _mul(other) { - return longlong(L_sq_LongLongOperation(this.Value, other.Value, "*")); - } - - function _div(other) { - return L_sq_LongLongOperation(this.Value, other.Value, "/"); - } - - function _unm() { - return longlong(L_sq_LongLongOperation(longlong("0"), this.Value, "-")); - } - - function _modulo(other) { - return longlong(L_sq_LongLongOperation(this.Value, other.Value, "%")); - } - - function GetFormat(FType) { - local Buf = L_sq_LongLongOperation(this.Value, FType, "format"); - if (Buf.len()< 2) return Buf + ".0"; - local Value = Buf.slice(0, -1); - local Unit = Buf.slice(-1); - local RetStr = format(FType + Unit, Value.tofloat()); - 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/CSBase/_Tool/Hacker_Class.nut b/CSBase/_Tool/Hacker_Class.nut deleted file mode 100644 index 672c352..0000000 --- a/CSBase/_Tool/Hacker_Class.nut +++ /dev/null @@ -1,60 +0,0 @@ -/* -文件名:Hacker_Class.nut -路径:Base/_Tool/Hacker_Class.nut -创建日期:2024-09-24 06:25 -文件用途: -*/ -class _Rindro_Hacker { - HookTable = null; - - constructor() { - HookTable = {}; - } - - function UnLoadHook(AddressStr) { - Sq_DeHookFunc(HookTable[AddressStr]); - } - - function LoadHook(AddressStr, ArgumentArr, EnterFunc, LeaveFunc) { - //如果已经HOOK过 需要先卸载原来的HOOK - if (HookTable.rawin(AddressStr)) { - UnLoadHook(AddressStr); - print("地址: " + AddressStr + " 已经装载了Hook,本次操作将会卸载之前的Hook在执行。") - } - - local Controler = Sq_HookFunc(AddressStr, ArgumentArr, EnterFunc, LeaveFunc); - HookTable.rawset(AddressStr, Controler); - } -} -//初始化Hacker -if (!(getroottable().rawin("Rindro_Haker"))) Rindro_Haker <- _Rindro_Hacker(); - - -//重选角色时触发的回调函数(进入赛利亚房间) -OnSetCharacter_Control <- {} -Rindro_Haker.LoadHook(0x674350, ["pointer", "int"], - function(args) { - foreach(Func in OnSetCharacter_Control) { - Func(); - } - return null; - }, - function(args) { - - return null; - }); - -OnSetCharacter_Control.MarrySystem <- function() { - if (getroottable().rawin("Yosin_14SkillXpos1") && - getroottable().rawin("Yosin_14SkillXpos2") && - getroottable().rawin("Yosin_14SkillYpos1") && - getroottable().rawin("Yosin_14SkillYpos2") - ) { - for (local i = 6; i< 7; i++) { - L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x14, Yosin_14SkillXpos1 + (i * 31)); - L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x18, Yosin_14SkillYpos1); - L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x14, Yosin_14SkillXpos2 + (i * 31)); - L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x18, Yosin_14SkillYpos2); - } - } -}; \ No newline at end of file diff --git a/CSBase/_Tool/Hacker_RegApi.nut b/CSBase/_Tool/Hacker_RegApi.nut deleted file mode 100644 index 2b861f5..0000000 --- a/CSBase/_Tool/Hacker_RegApi.nut +++ /dev/null @@ -1,301 +0,0 @@ -/* -文件名:Hacker_RegApi.nut -路径:Base/_Tool/Hacker_RegApi.nut -创建日期:2024-09-25 18:31 -文件用途:注册API -*/ -//工具类 -class R_Utils { - - String = { - FindLastSubstring = function(str, substring) { - local strLen = str.len(); - local subLen = substring.len(); - local lastIndex = -1; - for (local i = 0; i <= strLen - subLen; i++) { - local found = true; - for (local j = 0; j< subLen; j++) { - if (str[i + j] != substring[j]) { - found = false; - break; - } - } - if (found) { - lastIndex = i; - } - } - return lastIndex; - } - } - //播放音效 - function PlaySound(SoundName) { - L_Sq_CallFunc(0x75BD70, "void", FFI_MS_CDECL, ["pointer", "int", "int", "int"], Memory.allocUtf8String(SoundName).C_Object, -1, 0, 0); - } - - //读取文件内容 - function ReadScript(Path, Size, CodePage) { - local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object); - local Reader = Memory.alloc(Size); - local ReadBuffer = L_sq_P2I(Reader.C_Object); - L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4); - - - if (CodePage == "utf8") - return Reader.readUtf8String(); - if (CodePage == "unicode") - return Reader.readUnicodeString(); - if (CodePage == "big5") - return Reader.readBig5String(); - } - - //读取文件 - function GetScriptFileReader(Path, ...) { - local AllocSize = 102400; - if (vargc > 0) AllocSize = vargv[0]; - //读取路径 - local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object); - //读取缓存 - local Reader = Memory.alloc(AllocSize); - local ReadBuffer = L_sq_P2I(Reader.C_Object); - //实际读取大小 - local ReadSizeer = Memory.alloc(4); - local ReadSizeBuffer = L_sq_P2I(ReadSizeer.C_Object); - - local Flag = L_Sq_CallFunc(0x59E3D0, "bool", FFI_MS_CDECL, ["int", "int", "int", "int"], ReadPath, ReadBuffer, AllocSize, ReadSizeBuffer); - if (Flag) { - return { - Buffer = Reader, - Size = ReadSizeer.readInt() - }; - } else return null; - } - - //读取配置表 - function ReadScriptConfig(Path, Size, ...) { - local CodePage = "utf8"; - if (vargc > 0) CodePage = vargv[0]; - local Script = R_Utils.ReadScript(Path, Size, CodePage); - local Func = compilestring("return " + Script); - local Ret = Func(); - return Ret; - } - - //获取一个指定装备的角色对象 - function GetCharacByEqu(Job, GrowType, Equ) { - local Obj = sq_CreateCharacter(Job, GrowType); - local ObjAddress = L_Sq_GetObjectAddress(Obj); - foreach(value in Equ) { - local ItemObject = L_sq_GetItem(value); - // L_Sq_CallFunc(0x825570, "void", FFI_THISCALL, ["int", "int"], ObjAddress, ItemObject); - L_Sq_CallFunc(0x8265A0, "void", FFI_THISCALL, ["int", "int", "int"], ObjAddress, ItemObject, -1); - } - return sq_GetCNRDObjectToSQRCharacter(Obj); - } - - //获取装备编号的得文件路径 - function GetEquPath(Equ) { - local EquPathAddress = L_Sq_CallFunc(0x1219E80, "int", FFI_THISCALL, ["int", "int"], 0x1d7993c, Equ); - if (EquPathAddress) { - return NativePointer(EquPathAddress).readUnicodeString(); - } - return null; - } - - //获取Lst文件的返回Array - function GetLstArr(Path, Header) { - local Arr = []; - local LstBuf = R_Utils.GetScriptFileReader(Path); - if (LstBuf) { - local IO = Sq_Point2Blob(L_sq_P2I(LstBuf.Buffer.C_Object), LstBuf.Size); - local i = 2; - while (i< LstBuf.Size) { - if ((LstBuf.Size - i) >= 10) { - IO.seek(i + 6); //内容指示位 - local FindKey = IO.readn('i'); - local Key = Rindro_Script.GetBinString(FindKey); - if (Key) { - local StrFilePath = Header + Key.tolower(); - Arr.append(StrFilePath); - } - } else break; - i += 10; - } - } - return Arr; - } - - //通过处理函数获取文件Table - function GetFileTableByHandle(Path, Func) { - local Data = {}; - local FileData = R_Utils.GetScriptFileReader(Path); - if (FileData) { - if (FileData.Size >= 7) { - //创建Blob对象 - local IO = Sq_Point2Blob(L_sq_P2I(FileData.Buffer.C_Object), FileData.Size); - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - if (i< FileData.Size && FileData.Size - i >= 5) { - i = Func(Data, IO, i); - } else break; - } - } - } - return Data; - } -} - - - - - - -//根据List读取文件地址 -// Rindro_Haker.LoadHook(0x1219E80, ["int", "int", "int"], -// function(args) { -// // print(format("%02x", args[0])); - -// // print(args[2]); -// return null; -// }, -// function(args) { -// // print(666); -// // print(format("%02x", args.pop())); -// // TTTAni <- args.pop(); - - -// // local Path = NativePointer(L_sq_I2P(args.pop())).readUnicodeString(); -// // if (Path != "character/swordman/weapon/katana/kat_lowkogaras.equ" && Path != "new_elvengard.twn") { -// // print(args[0]); -// // print(args[1]); -// // // print(format("%02x", args[1])); -// // print(Path); -// // } -// return null; -// }); - -//可能是构造装备以及构造其他东西 -// Rindro_Haker.LoadHook(0x972220, ["int", "int", "int", "int"], -// function(args) { -// // print(format("%02x", args[0])); -// // local AniPath = NativePointer(L_sq_I2P(args[0])).readUnicodeString(); -// if (args[0] == 10402) { -// print(args[0]); -// print(args[1]); -// print(args[2]); -// } -// // print(args[2]); -// return null; -// }, -// function(args) { -// // print(666); -// // print(format("%02x", args.pop())); -// // TTTAni <- args.pop(); -// return null; -// }); - -//绘制字符 -getroottable().DrawCodeCallBackFunc <- {}; -// Rindro_Haker.LoadHook(0x1206BD0, ["int", "int", "int", "pointer", "int", "void"], -// function(args) { -// // print("nut:" + format("%02x", args[3])); - -// if (args[3]) { -// // for (local i = 0; i< 10000; i++) { -// local DrawCode = NativePointer((args[3])).readUnicodeString(); -// if (DrawCode in DrawCodeCallBackFunc) -// DrawCodeCallBackFunc[DrawCode](args); -// // } -// } -// return null; -// }, -// function(args) { -// // print(666); -// // print(format("%02x", args.pop())); -// // TTTAni <- args.pop(); -// return null; -// }); - - -//绘制城镇回调 -getroottable().DrawTownCallBackFunc <- {}; -Rindro_Haker.LoadHook(0x1108700, ["int", "void"], - function(args) { - // print("nut:" + format("%02x", args[3])); - // print(format("%02x", args[0])); - foreach(Func in DrawTownCallBackFunc) { - Func(); - } - return null; - }, - function(args) { - // print(666); - // print(format("%02x", args.pop())); - // TTTAni <- args.pop(); - return null; - }); - - -//顺图 -function Rindro_Gm_MoveMap(obj) { - if (sq_IsKeyDown(OPTION_HOTKEY_PAUSE_IN_TOWER, ENUM_SUBKEY_TYPE_ALL) && RINDROLOCAL) { - if (KeyPress.isKeyPress(0)) L_sq_MoveMap(2); - if (KeyPress.isKeyPress(1)) L_sq_MoveMap(0); - if (KeyPress.isKeyPress(2)) L_sq_MoveMap(3); - if (KeyPress.isKeyPress(3)) L_sq_MoveMap(1); - } -} -getroottable()["LenheartFuncTab"].rawset("Rindro_Gm_MoveMapFuncN", Rindro_Gm_MoveMap); - - -//丢弃物品回调 -getroottable().DiscardItemCallBackFunc <- {}; - -function Sq_DiscardItem(Item) { - local Flag = true; - foreach(Func in DiscardItemCallBackFunc) { - local Ret = Func(Item); - if (!Ret) Flag = false; - } - return Flag; -} - -//从exe获取字符串 -getroottable()["Sq_GetExeStr_Map"] <- {}; -function Sq_GetExeStr_Event(Index) -{ - if(Index in getroottable()["Sq_GetExeStr_Map"]){ - return getroottable()["Sq_GetExeStr_Map"][Index](Index); - } - return Index; -} - - -// //hook打开窗口 -// Rindro_Haker.LoadHook(0xE6E070, ["int","int","int","int","void"], -// function(args) { - -// return null; -// }, -// function(args) { -// // print(666); -// // print(format("%02x", args.pop())); -// // TTTAni <- args.pop(); -// return null; -// }); - - -// Rindro_Haker.LoadHook(0xE6E070, ["int", "int", "int", "int", "int"], -// function(args) { -// print("nut:" + format("%02x", args[0])); -// print("nut:" + format("%02x", args[1])); -// print("nut:" + format("%02x", args[2])); -// print("nut:" + format("%02x", args[3])); -// return null; -// }, -// function(args) { -// // print(666); -// // print(format("%02x", args.pop())); -// // TTTAni <- args.pop(); -// return null; -// }); \ No newline at end of file diff --git a/CSBase/_Tool/Image_Class.nut b/CSBase/_Tool/Image_Class.nut deleted file mode 100644 index 064e40e..0000000 --- a/CSBase/_Tool/Image_Class.nut +++ /dev/null @@ -1,80 +0,0 @@ -/* -文件名:Image_Class.nut -路径:Base/_Tool/Image_Class.nut -创建日期:2024-10-21 16:58 -文件用途: 图片类 -*/ -class Rindro_Png { - C_Object = null; - Path = null; - Idx = null; - - constructor(Object, Path, Idx) { - this.Path = Path; - this.Idx = Idx; - this.C_Object = Object; - } - - function Draw(X, Y) { - L_Sq_CallFunc(0x11A8F60, "int", FFI_THISCALL, ["int", "int", "int", "int"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object); - } - - function DrawEx(X, Y, Model, Rgba, Xrate, Yrate) { - L_Sq_CallFunc(0x11A97E0, "int", FFI_THISCALL, ["int", "int", "int", "int", "float", "float", "float", "int", "float", "float"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object, Xrate, Yrate, Model, Rgba, 0, 0); - } - - function GetWidth() - { - return NativePointer(this.C_Object + 0x1C).readShort(); - } - - function GetHeight() - { - return NativePointer(this.C_Object + 0x1E).readShort(); - } -} -class Rindro_Image { - - Img = null; - Path = null; - - constructor(Path) { - this.Path = Path; - //读取Img - Img = L_Sq_CallFunc(0x11C0410, "int", FFI_THISCALL, ["int", "int", "int"], NativePointer(0x1B4684C).readInt(), 0, L_sq_P2I(Memory.allocUtf8String(Path).C_Object)); - } - - function GetPng(Idx) { - if (Img) { - local PngObject = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx); - return Rindro_Png(PngObject, Path, Idx); - } - } - - function DrawPng(Idx, X, Y) { - local Buffer = GetPng(Idx); - Buffer.Draw(X, Y); - } - - function DrawExPng(Idx, X, Y, Model, Rgba, Xrate, Yrate) { - local Buffer = GetPng(Idx); - Buffer.DrawEx(X, Y, Model, Rgba, Xrate, Yrate) - } - - //加载 - function Load(Path) { - if (!(getroottable().rawin("Rindro_Image_Map"))) getroottable().Rindro_Image_Map <- {}; - if (getroottable().Rindro_Image_Map.rawin(Path)) return getroottable().Rindro_Image_Map[Path]; - else { - getroottable().Rindro_Image_Map[Path] <- Rindro_Image(Path); - return getroottable().Rindro_Image_Map[Path]; - } - } -} -Rindro_Image_GlobalMap <- {}; -Rindro_Image_GlobalMap["lenheartui"] <- Rindro_Image("interface/lenheartwindowcommon.img"); -/* - local Png = TestImg.GetPng(0); - Png.Draw(200, 200); - Png.DrawEx(100, 400, 0, sq_RGBA(255, 255, 255, 255), 1.5, 1.5); -*/ \ No newline at end of file diff --git a/CSBase/_Tool/Json_Class.nut b/CSBase/_Tool/Json_Class.nut deleted file mode 100644 index 681c086..0000000 --- a/CSBase/_Tool/Json_Class.nut +++ /dev/null @@ -1,661 +0,0 @@ -/* -文件名:Json_Class.nut -路径:Base/_Tool/Json_Class.nut -创建日期:2024-09-27 23:54 -文件用途:Json类 -*/ - -class JSONParser { - - - static version = "1.0.1"; - - - state = ""; - stack = null; - container = null; - key = ""; - value = ""; - converter = null; - - constructor() { - stack = []; - container = {}; - } - - function parse(str, ...) { - if (vargc > 0) converter = vargc[0]; - - - - local string = { - go = function() { - state = "ok"; - }.bindenv(this), - firstokey = function() { - key = value; - state = "colon"; - }.bindenv(this), - okey = function() { - key = value; - state = "colon"; - }.bindenv(this), - ovalue = function() { - value = this._convert(value, "string", converter); - state = "ocomma"; - }.bindenv(this), - firstavalue = function() { - value = this._convert(value, "string", converter); - state = "acomma"; - }.bindenv(this), - avalue = function() { - value = value; - this._convert(value, "string", converter); - state = "acomma"; - }.bindenv(this) - }; - - - local number = { - go = function() { - state = "ok"; - }.bindenv(this), - ovalue = function() { - value = this._convert(value, "number", converter); - state = "ocomma"; - }.bindenv(this), - firstavalue = function() { - value = this._convert(value, "number", converter); - state = "acomma"; - }.bindenv(this), - avalue = function() { - value = this._convert(value, "number", converter); - state = "acomma"; - }.bindenv(this) - }; - - - - - local action = {}; - - - action["{"] <- { - go = function() { - stack.push({ - state = "ok" - }); - container = {}; - state = "firstokey"; - }.bindenv(this), - ovalue = function() { - stack.push({ - container = container, - state = "ocomma", - key = key - }); - container = {}; - state = "firstokey"; - }.bindenv(this), - firstavalue = function() { - stack.push({ - container = container, - state = "acomma" - }); - container = {}; - state = "firstokey"; - }.bindenv(this), - avalue = function() { - stack.push({ - container = container, - state = "acomma" - }); - container = {}; - state = "firstokey"; - }.bindenv(this) - }, - - action["}"] <- { - firstokey = function() { - local pop = stack.pop(); - value = container; - container = ("container" in pop) ? pop.container : null; - key = ("key" in pop) ? pop.key : null; - state = pop.state; - }.bindenv(this), - ocomma = function() { - local pop = stack.pop(); - container[key] <- value; - value = container; - container = ("container" in pop) ? pop.container : null; - key = ("key" in pop) ? pop.key : null; - state = pop.state; - }.bindenv(this) - }, - - action["["] <- { - go = function() { - stack.push({ - state = "ok" - }); - container = []; - state = "firstavalue"; - }.bindenv(this), - ovalue = function() { - stack.push({ - container = container, - state = "ocomma", - key = key - }); - container = []; - state = "firstavalue"; - }.bindenv(this), - firstavalue = function() { - stack.push({ - container = container, - state = "acomma" - }); - container = []; - state = "firstavalue"; - }.bindenv(this), - avalue = function() { - stack.push({ - container = container, - state = "acomma" - }); - container = []; - state = "firstavalue"; - }.bindenv(this) - }, - - action["]"] <- { - firstavalue = function() { - local pop = stack.pop(); - value = container; - container = ("container" in pop) ? pop.container : null; - key = ("key" in pop) ? pop.key : null; - state = pop.state; - }.bindenv(this), - acomma = function() { - local pop = stack.pop(); - container.push(value); - value = container; - container = ("container" in pop) ? pop.container : null; - key = ("key" in pop) ? pop.key : null; - state = pop.state; - }.bindenv(this) - }, - - action[":"] <- { - colon = function() { - - - - local err = false; - foreach(akey, avalue in container) { - if (akey == key) err = true; - break - } - if (err) throw "Duplicate key \"" + key + "\""; - state = "ovalue"; - }.bindenv(this) - }, - - action[","] <- { - ocomma = function() { - container[key] <- value; - state = "okey"; - }.bindenv(this), - acomma = function() { - container.push(value); - state = "avalue"; - }.bindenv(this) - }, - - action["true"] <- { - go = function() { - value = true; - state = "ok"; - }.bindenv(this), - ovalue = function() { - value = true; - state = "ocomma"; - }.bindenv(this), - firstavalue = function() { - value = true; - state = "acomma"; - }.bindenv(this), - avalue = function() { - value = true; - state = "acomma"; - }.bindenv(this) - }, - - action["false"] <- { - go = function() { - value = false; - state = "ok"; - }.bindenv(this), - ovalue = function() { - value = false; - state = "ocomma"; - }.bindenv(this), - firstavalue = function() { - value = false; - state = "acomma"; - }.bindenv(this), - avalue = function() { - value = false; - state = "acomma"; - }.bindenv(this) - }, - - action["null"] <- { - go = function() { - value = null; - state = "ok"; - }.bindenv(this), - ovalue = function() { - value = null; - state = "ocomma"; - }.bindenv(this), - firstavalue = function() { - value = null; - state = "acomma"; - }.bindenv(this), - avalue = function() { - value = null; - state = "acomma"; - }.bindenv(this) - } - - - - - state = "go"; - stack = []; - - - local start = 0; - - try { - - local result, token, tokenizer = _JSONTokenizer(); - - while (token = tokenizer.nextToken(str, start)) { - - if ("ptfn" == token.type) { - - action[token.value][state](); - } else if ("number" == token.type) { - - value = token.value; - number[state](); - } else if ("string" == token.type) { - - value = tokenizer.unescape(token.value); - string[state](); - } - - start += token.length; - } - - } catch (e) { - state = e; - } - - - if (state != "ok" || regexp("[^\\s]").capture(str, start)) { - local near = str.slice(start, GetMin(str.len(), start + 10)); - throw "JSON Syntax Error near `" + near + "`"; - } - - - return value; - } - - function GetMin(a, b) { - return a< b ? a : b; - } - - - function _convert(value, type, converter) { - if ("function" == typeof converter) { - - - - local parametercCount = 2; - - - if ("getinfos" in converter) { - parametercCount = converter.getinfos().parameters.len() - - 1; - } - - if (parametercCount == 1) { - return converter(value); - } else if (parametercCount == 2) { - return converter(value, type); - } else { - throw "Error: converter function must take 1 or 2 parameters" - } - - } else if ("number" == type) { - local Ret = (value.find(".") == null && value.find("e") == null && value.find("E") == null) ? value.tointeger() : value.tofloat(); - return Ret; - } else { - return value; - } - - } -} - - - -class _JSONTokenizer { - - _ptfnRegex = null; - _numberRegex = null; - _stringRegex = null; - _ltrimRegex = null; - _unescapeRegex = null; - - constructor() { - - this._ptfnRegex = regexp("^(?:\\,|\\:|\\[|\\]|\\{|\\}|true|false|null)"); - - - this._numberRegex = regexp("^(?:\\-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)"); - - - this._stringRegex = regexp("^(?:\\\"((?:[^\\r\\n\\t\\\\\\\"]|\\\\(?:[\"\\\\\\/trnfb]|u[0-9a-fA-F]{4}))*)\\\")"); - - - this._ltrimRegex = regexp("^[\\s\\t\\n\\r]*"); - - - this._unescapeRegex = regexp("\\\\(?:(?:u\\d{4})|[\\\"\\\\/bfnrt])"); - } - - - function nextToken(str, ...) { - local start = 0; - if (vargc > 0) start = vargv[0]; - local - m, - type, - token, - value, - length, - whitespaces; - - - whitespaces = this._leadingWhitespaces(str, start); - start += whitespaces; - - if (m = this._ptfnRegex.capture(str, start)) { - - value = str.slice(m[0].begin, m[0].end); - type = "ptfn"; - } else if (m = this._numberRegex.capture(str, start)) { - - value = str.slice(m[0].begin, m[0].end); - type = "number"; - } else if (m = this._stringRegex.capture(str, start)) { - - value = str.slice(m[1].begin, m[1].end); - type = "string"; - } else { - return null; - } - - token = { - type = type, - value = value, - length = m[0].end - m[0].begin + whitespaces - }; - - return token; - } - - - function _leadingWhitespaces(str, start) { - local r = this._ltrimRegex.capture(str, start); - - if (r) { - return r[0].end - r[0].begin; - } else { - return 0; - } - } - - - _unescapeReplacements = { - b = "\b", - f = "\f", - n = "\n", - r = "\r", - t = "\t" - }; - - function unescape(str) { - - local start = 0; - local res = ""; - - while (start< str.len()) { - local m = this._unescapeRegex.capture(str, start); - - if (m) { - local token = str.slice(m[0].begin, m[0].end); - - - local pre = str.slice(start, m[0].begin); - res += pre; - - if (token.len() == 6) { - res += token; - } else { - local char = token.slice(1); - - if (char in this._unescapeReplacements) { - res += this._unescapeReplacements[char]; - } else { - res += char; - } - } - - } else { - res += str.slice(start); - break; - } - - start = m[0].end; - } - - return res; - } -} - - -class JSONEncoder { - - static VERSION = "2.0.0"; - - - - static _maxDepth = 32; - - - function encode(value) { - return this._encode(value); - } - - - function _encode(val, ...) { - local depth = 0; - if (vargc > 0) depth = vargv[0]; - - if (depth > this._maxDepth) { - throw "Possible cyclic reference"; - } - - local - r = "", - s = "", - i = 0; - - switch (typeof val) { - - case "table": - case "class": - s = ""; - - - foreach(k, v in val) { - if (typeof v != "function") { - s += ",\"" + k + "\":" + this._encode(v, depth + 1); - } - } - - s = s.len() > 0 ? s.slice(1) : s; - r += "{" + s + "}"; - break; - - case "array": - s = ""; - - for (i = 0; i< val.len(); i++) { - s += "," + this._encode(val[i], depth + 1); - } - - s = (i > 0) ? s.slice(1) : s; - r += "[" + s + "]"; - break; - - case "integer": - case "float": - case "bool": - r += val; - break; - - case "null": - r += "null"; - break; - - case "instance": - - if ("_serializeRaw" in val && typeof val._serializeRaw == "function") { - - - r += val._serializeRaw().tostring(); - - } else if ("_serialize" in val && typeof val._serialize == "function") { - - - r += this._encode(val._serialize(), depth + 1); - - } else { - - s = ""; - - try { - - - foreach(k, v in val) { - s += ",\"" + k + "\":" + this._encode(v, depth + 1); - } - - } catch (e) { - - - - foreach(k, v in val.getclass()) { - if (typeof v != "function") { - s += ",\"" + k + "\":" + this._encode(val[k], depth + 1); - } - } - - } - - s = s.len() > 0 ? s.slice(1) : s; - r += "{" + s + "}"; - } - - break; - - case "blob": - - - - r += "\"" + (val.len() ? this._escape(val.tostring()) : "") + "\""; - break; - - - default: - r += "\"" + this._escape(val.tostring()) + "\""; - break; - } - - return r; - } - - function _escape(str) { - local res = ""; - - for (local i = 0; i< str.len(); i++) { - - local ch1 = (str[i] & 0xFF); - - if ((ch1 & 0x80) == 0x00) { - - - ch1 = format("%c", ch1); - - if (ch1 == "\"") { - res += "\\\""; - } else if (ch1 == "\\") { - res += "\\\\"; - } else if (ch1 == "/") { - res += "\\/"; - } else if (ch1 == "\b") { - res += "\\b"; - } else if (ch1 == "\f") { - res += "\\f"; - } else if (ch1 == "\n") { - res += "\\n"; - } else if (ch1 == "\r") { - res += "\\r"; - } else if (ch1 == "\t") { - res += "\\t"; - } else if (ch1 == "\0") { - res += "\\u0000"; - } else { - res += ch1; - } - - } else { - - if ((ch1 & 0xE0) == 0xC0) { - - local ch2 = (str[++i] & 0xFF); - res += format("%c%c", ch1, ch2); - } else if ((ch1 & 0xF0) == 0xE0) { - - local ch2 = (str[++i] & 0xFF); - local ch3 = (str[++i] & 0xFF); - res += format("%c%c%c", ch1, ch2, ch3); - } else if ((ch1 & 0xF8) == 0xF0) { - - local ch2 = (str[++i] & 0xFF); - local ch3 = (str[++i] & 0xFF); - local ch4 = (str[++i] & 0xFF); - res += format("%c%c%c%c", ch1, ch2, ch3, ch4); - } - - } - } - - return res; - } -} \ No newline at end of file diff --git a/CSBase/_Tool/MemoryClass.nut b/CSBase/_Tool/MemoryClass.nut deleted file mode 100644 index 9e4bef3..0000000 --- a/CSBase/_Tool/MemoryClass.nut +++ /dev/null @@ -1,204 +0,0 @@ -/* -文件名:MemoryClass.nut -路径:Base/_Tool/MemoryClass.nut -创建日期:2024-09-24 08:22 -文件用途: -*/ - -class Memory { - - function alloc(Size) { - return NativePointer(Size.tostring()); - } - - function allocUtf8String(Str) { - return NativePointer(Str_Ptr(Str)); - } -} - -class NativePointer { - //大小 - Size = -1; - - C_Object = null; - - constructor(T) { - if (type(T) == "integer") { - C_Object = L_sq_I2P(T); - } else if (type(T) == "userdata") { - C_Object = T; - } else if (type(T) == "string") { - C_Object = Sq_New_Point(T.tointeger()); - Size = T; - //注册销毁伪析构 - Register_Destruction(C_Object, this); - } - } - - function add(intoffset) { - return NativePointer(L_sq_I2P(L_sq_P2I(this.C_Object) + intoffset)); - } - - function sub(intoffset) { - return NativePointer(L_sq_I2P(L_sq_P2I(this.C_Object) - intoffset)); - } - - function writeByteArray(arr) { - Sq_Memory_WriteByteArr(this.C_Object, arr); - } - - function readByteArray(size) { - local PointB = Sq_Point2Blob(this.C_Object, size); - local arr = []; - foreach(value in PointB) { - arr.append(value); - } - return arr; - } - - - function write(value, type) { - local Buf = blob(0); - Buf.writen(value, type); - local arr = []; - foreach(value in Buf) { - arr.append(value); - } - writeByteArray(arr); - } - - function writeS8(value) { - write(value, 'c'); - } - - function writeU8(value) { - write(value, 'b'); - } - - function writeS16(value) { - write(value, 's'); - } - - function writeU16(value) { - write(value, 'w'); - } - - function writeS32(value) { - write(value, 'i'); - } - - function writeU32(value) { - write(value, 'i'); - } - - function writeShort(value) { - write(value, 's'); - } - - function writeUShort(value) { - write(value, 'w'); - } - - function writeInt(value) { - write(value, 'i'); - } - - function writeUInt(value) { - write(value, 'i'); - } - - function writeFloat(value) { - write(value, 'f'); - } - - function writeDouble(value) { - write(value, 'd'); - } - - - function read(type) { - local Buf = Sq_Point2Blob(L_sq_P2I(this.C_Object), 4); - return Buf.readn(type); - } - - function readS8() { - return read('c'); - } - - function readU8() { - return read('b'); - } - - function readS16() { - return read('s'); - } - - function readU16() { - return read('w'); - } - - function readS32() { - return read('i'); - } - - function readU32() { - return read('i'); - } - - function readShort() { - return read('s'); - } - - function readUShort() { - return read('w'); - } - - function readInt() { - return read('i'); - } - - function readUInt() { - return read('i'); - } - - function readFloat() { - return read('f'); - } - - function readDouble() { - return read('d'); - } - - - function readUnicodeString(...) { - if (vargc > 0) { - return Sq_Memory_ReadString(this.C_Object, vargv[0]); - } else { - return Sq_Memory_ReadString(this.C_Object); - } - } - - function readUtf8String(...) { - if (vargc > 0) { - return Sq_Memory_ReadStringByUtf8(this.C_Object, vargv[0]); - } else { - return Sq_Memory_ReadStringByUtf8(this.C_Object); - } - } - - function readBig5String(...) { - if (vargc > 0) { - return Sq_Memory_ReadStringByBig5(this.C_Object, vargv[0]); - } else { - return Sq_Memory_ReadStringByBig5(this.C_Object); - } - } - - function readPointer() { - return Sq_ReadPoint(this.C_Object); - } - - function tostring() { - return this.C_Object.tostring(); - } -} \ No newline at end of file diff --git a/CSBase/_Tool/Packet_Class.nut b/CSBase/_Tool/Packet_Class.nut deleted file mode 100644 index 61c4b47..0000000 --- a/CSBase/_Tool/Packet_Class.nut +++ /dev/null @@ -1,61 +0,0 @@ -/* -文件名:Pack_Class.nut -路径:Base/_Tool/Pack_Class.nut -创建日期:2025-06-30 09:24 -文件用途:字节包 -*/ -class Packet { - - //读取指针位置 - Index = 0; - - //内存数据 - Pointer = null; - //包大小 - Size = 0; - - - //加载包 - function Load(P, S) { - Pointer = P; - Size = S; - } - - //读取指针跳转 - function Seek(...) { - local Pos = vargv[0]; - local Mode = 0; - if(vargc > 1) Mode = vargv[1]; - if (Mode == 0) { - Index = Pos; - } else if (Mode == 1) { - Index += Pos; - } else if (Mode == 2) { - Index -= Pos; - } - } - - //读取整形 - function GetInt() { - local Size_t = 4; - if (Index + Size_t > Size) { - print("读取包越界!"); - return; - } - local Buf = NativePointer(Pointer).add(Index).readInt(); - Index += Size_t; - return Buf; - } - - //读取流 - function GetStream(Size_t) { - if (Index + Size_t > Size) { - print("读取包越界!"); - return; - } - local Np = NativePointer(Pointer).add(Index); - Np.Size = Size_t; - Index += Size_t; - return Np; - } -} diff --git a/CSBase/_Tool/Script_Class.nut b/CSBase/_Tool/Script_Class.nut deleted file mode 100644 index 41704de..0000000 --- a/CSBase/_Tool/Script_Class.nut +++ /dev/null @@ -1,713 +0,0 @@ -/* -文件名:Script_Class.nut -路径:Base/_Tool/Script_Class.nut -创建日期:2024-10-21 14:49 -文件用途:PVF读取类 -*/ -class BlobEx extends blob { - - constructor(BaseBlob) { - blob.constructor(BaseBlob.len()); - writeblob(BaseBlob); - } - - function writeblob(B) { - blob.writeblob(B); - seek(0); - } - - function GetUShort() { - return readn('s'); - } - - function GetShort() { - return readn('w'); - } - - function charPtrToInt(arr) { - local value = ((arr[0]) << 0) | - ((arr[1]) << 8) | - ((arr[2]) << 16) | - ((arr[3]) << 24); - return value; - } - - function GetInt() { - local CurTPos = tell(); - local Ret = charPtrToInt([this[CurTPos], this[CurTPos + 1], this[CurTPos + 2], this[CurTPos + 3]]); - seek(4, 'c'); - return Ret; - } - - function Get256() { - local Buf = readn('c'); - return (256.0 + Buf.tofloat()) % 256.0; - } - - function GetFloat() { - return readn('f'); - } - - function GetString(count) { - local MBuf = Memory.alloc(count); - local BlobBuf = readblob(count); - local arr = []; - foreach(value in BlobBuf) { - arr.append(value); - } - MBuf.writeByteArray(arr); - - return MBuf.readUtf8String(count); - } -} - -Rindro_Script_Bin_Data <- []; - -class _PVF_Data_ { - //数据 - Data = null; - //位置 - Pos = 0; - //最大值 - Max = 0; - - function _typeof() { - return "pvf_data"; - } - - constructor(gData) { - Data = gData; - Max = gData.len(); - } - - function Last() { - if (Pos > 0) { - Pos--; - return Get(); - } - return null; - } - - function Seek(i) { - if (Pos > 0 && Pos<(Max - 1)) { - Pos = i; - } - } - - function Get() { - local Ret = Data[Pos]; - if (Pos<(Max - 1)) { - Pos++; - } - return Ret; - } - - function Eof() { - if (Pos == Max - 1) - return true; - } - - function Next() { - if (Pos<(Max - 1)) { - Pos++; - return Get(); - } - return null; - } -} - -class Rindro_Script { - - function Get_Ani_Flip_Type(data) { - switch (data) { - case 1: - return "HORIZON"; - case 2: - return "VERTICAL"; - case 3: - return "ALL"; - default: - return ""; - } - } - - - function Get_Ani_Effect_Type(data) { - switch (data) { - case 0: - return "NONE"; - case 1: - return "DODGE"; - case 2: - return "LINEARDODGE"; - case 3: - return "DARK"; - case 4: - return "XOR"; - case 5: - return "MONOCHROME"; - case 6: - return "SPACEDISTORT"; - default: - return ""; - } - } - - function Get_Ani_Damage_Type(data) { - switch (data) { - case 0: - return "NORMAL"; - case 1: - return "SUPERARMOR"; - case 2: - return "UNBREAKABLE"; - default: - return ""; - } - } - - function Get_Ani_Flag(data) { - switch (data) { - case 0: - return "LOOP"; - case 1: - return "SHADOW"; - case 3: - return "COORD"; - case 7: - return "IMAGE_RATE"; - case 8: - return "IMAGE_ROTATE"; - case 9: - return "RGBA"; - case 10: - return "INTERPOLATION"; - case 11: - return "GRAPHIC_EFFECT"; - case 12: - return "DELAY"; - case 13: - return "DAMAGE_TYPE"; - case 14: - return "DAMAGE_BOX"; - case 15: - return "ATTACK_BOX"; - case 16: - return "PLAY_SOUND"; - case 17: - return "PRELOAD"; - case 18: - return "SPECTRUM"; - case 23: - return "SET_FLAG"; - case 24: - return "FLIP_TYPE"; - case 25: - return "LOOP_START"; - case 26: - return "LOOP_END"; - case 27: - return "CLIP"; - case 28: - return "OPERATION"; - default: - return ""; - } - } - - - function endswith(Str, cmp) { - local len = cmp.len(); - local EndStr = Str.slice(-len); - if (EndStr == cmp) - return true; - return false; - - } - - function InitLoad_String() { - if (getroottable().rawin("RindroLoadStringTable")) return; - getroottable().RindroLoadStringTable <- {}; - local N_String = R_Utils.GetScriptFileReader("n_string.lst"); - if (N_String) { - local IO = Sq_Point2Blob(L_sq_P2I(N_String.Buffer.C_Object), N_String.Size); - local i = 2; - while (i< N_String.Size) { - if ((N_String.Size - i) >= 10) { - IO.seek(i + 6); //内容指示位 - local FindKey = IO.readn('i'); - local Key = Rindro_Script.GetBinString(FindKey); - if (Key) { - local StrFilePath = Key.tolower(); - local StrFile = R_Utils.GetScriptFileReader(StrFilePath, 10240000); - if (StrFile) { - local StrBuffer = StrFile.Buffer.readUtf8String(StrFile.Size); - local StrArr = split(StrBuffer, "\r\n"); - foreach(index, strobj in StrArr) { - if (strobj.find(">") != null) { - local strobjarr = split(strobj, ">"); - if (strobjarr.len() > 1) { - getroottable().RindroLoadStringTable.rawset(strobjarr[0], Sq_ConvertWideChar(strobjarr[1], "big5")); - } - } - } - } - } - } else break; - i += 10; - } - } - } - - function GetBin() { - local BinFile = R_Utils.GetScriptFileReader("stringtable.bin", 40960000); - if (BinFile) { - local Ro = Sq_Point2Blob(L_sq_P2I(BinFile.Buffer.C_Object), BinFile.Size); - Ro = BlobEx(Ro.readblob(Ro.len())); - local Count = Ro.readn('i'); - - local CurrentIndex = 0; - for (local i = 0; i< Count; i++) { - Ro.seek(CurrentIndex * 4 + 4); - local StartPos = Ro.readn('i'); - local EndPos = Ro.readn('i'); - local Len = EndPos - StartPos; - Ro.seek(StartPos + 4); - if (Len > 0) { - local Str = Ro.GetString(Len); - Rindro_Script_Bin_Data.append(Str); - } else { - Rindro_Script_Bin_Data.append(""); - } - CurrentIndex++; - } - } - } - - function GetBinString(Index) { - if (!(getroottable().rawin("ENUM_TW_GROWTYPE_VERS")) || ENUM_TW_GROWTYPE_VERS >= 24112901) //24112901更新了新的读取bin文件的方式 - return L_sq_StringBinById(Index); - else { - if (Index< Rindro_Script_Bin_Data.len()) return Rindro_Script_Bin_Data[Index]; - return ""; - } - } - - function GetLoadString(Key) { - if (getroottable().RindroLoadStringTable.rawin(Key)) return getroottable().RindroLoadStringTable[Key]; - else return ""; - } - - function UnpackData(IO, i) { - local out = ""; - IO.seek(i); //内容指示位 - local currentByte = IO.readn('c'); //内容指示位 - local after = IO.GetInt(); - switch (currentByte) { - case 10: { - IO.seek(i - 4); - local Before = IO.readn('i'); - local Buf = Rindro_Script.GetBinString(after); - if (!Buf) { - Buf = ""; - } else { - Buf = "<" + Before + "::" + Buf + "`" + Rindro_Script.GetLoadString(Buf) + "`>"; - } - Buf = Buf + "\r\n"; - out += Buf; - break; - } - case 2: { - IO.seek(-4, 'c'); - local ret = IO.readn('i'); - return ret; - } - case 4: { - local Bbuf = blob(4); - Bbuf.writen(after, 'i'); - Bbuf.seek(0); - local Buf = Bbuf.readn('f'); - out += after + '\t'; - break; - } - case 6: - case 8: - case 7: - case 5: { - local Buf = Rindro_Script.GetBinString(after); - if (!Buf) Buf = ""; - return Buf; - } - case 9: { - IO.seek(i + 6); - local Before = IO.readn('i'); - local Buf = Rindro_Script.GetBinString(Before); - out += Rindro_Script.GetLoadString(Buf); - } - default: - out += ""; - break; - } - - return out; - } - - - function ReadEquipment(ReadObject) { - local EquipmentAtt = {}; - if (ReadObject.Size >= 7) { - //创建Blob对象 - local IOBUF = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size); - local IO = BlobEx(IOBUF.readblob(IOBUF.len())); - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - if (i< ReadObject.Size && ReadObject.Size - i >= 5) { - local str = Rindro_Script.UnpackData(IO, i); - i += 5; - - //名称 - if (str == "[name]") { - local RealKey = str.slice(1, str.len() - 1); - EquipmentAtt[RealKey] <- Rindro_Script.UnpackData(IO, i); - i += 5; - } - //装备类型 - else if (str == "[equipment type]") { - local Buf = Rindro_Script.UnpackData(IO, i); - EquipmentAtt["equipment_type"] <- Buf.slice(1, -1); - i += 5; - } - //称号动画 - else if (str == "[custom animation]") { - local Buf = Rindro_Script.UnpackData(IO, i).tolower(); - EquipmentAtt["custom_animation"] <- Buf; - i += 5; - } - //光环生成效果 - else if (str == "[aurora graphic effects]") { - EquipmentAtt["Aurora"] <- {}; - EquipmentAtt["Aurora"].Back <- []; - EquipmentAtt["Aurora"].Front <- []; - local Count = Rindro_Script.UnpackData(IO, i); - i += 5; - for (local z = 0; z< Count; z++) { - local Layer = Rindro_Script.UnpackData(IO, i); - i += 5; - local Path = Rindro_Script.UnpackData(IO, i).tolower(); - i += 5; - if (Layer == 0) EquipmentAtt["Aurora"].Back.append(Path); - if (Layer == 1) EquipmentAtt["Aurora"].Front.append(Path); - } - i += 5; - } - //隐藏图层 - else if (str == "[hide layer]") { - EquipmentAtt["hidelayer"] <- []; - while (true) { - local Buffer = Rindro_Script.UnpackData(IO, i); - i += 5; - if (Buffer == "[/hide layer]") { - break; - } - EquipmentAtt["hidelayer"].append(Buffer); - } - } - //Ani - else if (str == "[animation job]") { - local Job = Rindro_Script.UnpackData(IO, i).slice(1, -1); - local SpacePos = Job.find(" "); - if (SpacePos) { - Job = Job.slice(0, SpacePos) + Job.slice(SpacePos + 1); - } - i += 5; - EquipmentAtt["Ani_" + Job] <- {}; - i += 5; - - local Index1 = Rindro_Script.UnpackData(IO, i); - i += 5; - local Index2 = Rindro_Script.UnpackData(IO, i); - i += 5; - EquipmentAtt["Ani_" + Job].variation <- [Index1, Index2]; - EquipmentAtt["Ani_" + Job].layer_variation <- []; - while (true) { - try { - local Ret = Rindro_Script.UnpackData(IO, i); - i += 5; - if (Ret == "[animation job]" || (Rindro_Script.endswith(Ret, "]") && Ret != "[equipment ani script]" && Ret != "[layer variation]")) { - i -= 5; - break; - } else if (Ret == "[layer variation]") { - local InfoBuf = {}; - InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i); - i += 5; - InfoBuf.Path <- Rindro_Script.UnpackData(IO, i); - i += 5; - EquipmentAtt["Ani_" + Job].layer_variation.append(InfoBuf); - } - } catch (exception) { - break; - } - } - } - } else break; - } - } - return EquipmentAtt; - } - - - function ReadAnimation(ReadObject) { - local Ro = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size); - Ro = BlobEx(Ro.readblob(Ro.len())); - local AniObject = { - Img_List = [], - Frame = [], - Flag = {} - }; - - local Frame_Max = Ro.readn('s'); - local Img_Count = Ro.readn('s'); - - //Img的路径读取 存入数组 - for (local index = 0; index< Img_Count; index++) { - local Buf = Ro.readn('i'); - local ImgPath = Ro.GetString(Buf); - //有可能Img有空路径 - AniObject.Img_List.append(ImgPath); - } - //Ani头部标签数量 - local Ani_H_Item_Count = Ro.readn('s'); - - //处理标签 - for (local index = 0; index< Ani_H_Item_Count; index++) { - //标签类型 - local Type = Ro.readn('s'); - - switch (Type) { - case 0: - case 1: { - local Key = Rindro_Script.Get_Ani_Flag(Type); - local Value = Ro.readn('c'); - AniObject.Flag.rawset(Key, Value); - break; - } - case 3: - case 28: { - local Key = Rindro_Script.Get_Ani_Flag(Type); - local Value = Ro.readn('s'); - AniObject.Flag.rawset(Key, Value); - break; - } - case 18: - // print("残影解析"); - //此处无解析 暂时先保证运行 残影功能暂时用不上 - Ro.readn('c'); - Ro.readn('i'); - Ro.readn('i'); - Ro.readn('i'); - Ro.Get256(); - Ro.Get256(); - Ro.Get256(); - Ro.Get256(); - Ro.readn('s'); - break; - default: - break; - } - } - - //读取每一个Img - for (local index = 0; index< Frame_Max; index++) { - //帧结构体对象 - local FrameObject = { - AttackBox = [], - DamageBox = [], - Flag = {}, - }; - - //碰撞框项目数量 - local Ani_Box_Item_Count = Ro.readn('s'); - for (local _i = 0; _i< Ani_Box_Item_Count; _i++) { - local Box_Type = Ro.readn('s'); - local D_Box_b = []; - for (local _k = 0; _k< 6; _k++) { - D_Box_b.append(Ro.readn('i')); - } - if (Box_Type == 15) { - FrameObject.AttackBox.append(D_Box_b); - } else { - FrameObject.DamageBox.append(D_Box_b); - } - // //0是攻击框 1是受击框 - // FrameObject.Box.rawset(15 - Box_Type, D_Box_b); - } - - //调用的第几个Img - local Index_Buf = Ro.GetShort(); - //如果等于-1说明是img路径为空 - if (Index_Buf != 65535) { - FrameObject.Img_Path <- AniObject.Img_List[Index_Buf].tolower(); - //Img中的PNG下标 - FrameObject.Img_Index <- Ro.readn('s'); - } else { - FrameObject.Img_Path <- ""; - FrameObject.Img_Index <- 0; - } - - //坐标 - FrameObject.Pos <- { - x = Ro.readn('i'), - y = Ro.readn('i'), - }; - - //Img中的项目数量 - local Img_Flag_Count = Ro.readn('s'); - for (local _o = 0; _o< Img_Flag_Count; _o++) { - local Img_Flag_Type = Ro.readn('s'); - local Key; - local Value; - switch (Img_Flag_Type) { - case 0: - case 1: - case 10: - Key = Rindro_Script.Get_Ani_Flag(Img_Flag_Type); - Value = Ro.readn('c'); - FrameObject.Flag.rawset(Key, Value); - break; - case 3: - Key = "COORD"; - Value = Ro.readn('s'); - FrameObject.Flag.rawset(Key, Value); - break; - case 17: - Key = "PRELOAD"; - Value = 1; - FrameObject.Flag.rawset(Key, Value); - break; - case 7: - Key = "IMAGE_RATE"; - Value = { - x = Ro.GetFloat(), - y = Ro.GetFloat() - }; - FrameObject.Flag.rawset(Key, Value); - break; - case 8: - Key = "IMAGE_ROTATE"; - Value = Ro.GetFloat(); - FrameObject.Flag.rawset(Key, Value); - break; - case 9: - Key = "RGBA"; - Value = [ - Ro.Get256(), - Ro.Get256(), - Ro.Get256(), - Ro.Get256(), - ]; - FrameObject.Flag.rawset(Key, Value); - break; - case 11: - local Effect_Type = Ro.readn('s'); - Key = "GRAPHIC_EFFECT_" + Rindro_Script.Get_Ani_Effect_Type(Effect_Type); - switch (Effect_Type) { - case 5: - Value = [Ro.Get256(), Ro.Get256(), Ro.Get256()]; - break; - case 6: - Value = [Ro.GetShort(), Ro.GetShort()]; - break; - } - FrameObject.Flag.rawset(Key, Value); - break; - case 12: - Value = Ro.readn('i'); - FrameObject.Delay <- Value; - break; - case 13: - Key = "DAMAGE_TYPE"; - Value = Rindro_Script.Get_Ani_Damage_Type(Ro.readn('s')); - FrameObject.Flag.rawset(Key, Value); - break; - case 16: - local SoundTempSize = Ro.readn('i'); - Key = "PLAY_SOUND"; - Value = Ro.GetString(SoundTempSize); - FrameObject.Flag.rawset(Key, Value); - break; - case 23: - Key = "SET_FLAG"; - Value = Ro.readn('i'); - FrameObject.Flag.rawset(Key, Value); - break; - case 24: - Key = "FLIP_TYPE"; - Value = Rindro_Script.Get_Ani_Flip_Type(Ro.readn('s')); - FrameObject.Flag.rawset(Key, Value); - break; - case 25: - Key = "LOOP_START"; - FrameObject.Flag.rawset(Key, 1); - break; - case 26: - Key = "LOOP_END"; - Value = Ro.readn('i'); - FrameObject.Flag.rawset(Key, Value); - break; - case 27: - Key = "CLIP"; - Value = [ - Ro.GetShort(), - Ro.GetShort(), - Ro.GetShort(), - Ro.GetShort(), - ]; - FrameObject.Flag.rawset(Key, Value); - break; - default: - break; - } - } - - //每一帧都是一个结构体 存入数组中 - AniObject.Frame.append(FrameObject); - } - return AniObject; - } - - //获取文件并处理 - function GetFileData(Path, Func) { - local N_Buffer = R_Utils.GetScriptFileReader(Path); - if (N_Buffer) { - local IO = Sq_Point2Blob(L_sq_P2I(N_Buffer.Buffer.C_Object), N_Buffer.Size); - IO = BlobEx(IO.readblob(IO.len())); - return Rindro_Script.ResolvingData(IO, Func, Path); - } else { - print(Path + "找不到文件!"); - return null; - } - } - - function ResolvingData(IO, Func, Path) { - local DataTable = {}; - DataTable.filepath <- Path; - local DataArr = []; - local Length = IO.len(); - if (Length >= 7) { - local i = 2; - while (true) { - if (i< Length && Length - i >= 5) { - local str = Rindro_Script.UnpackData(IO, i); - i += 5; - DataArr.push(str); - } else break; - } - Func(DataTable, _PVF_Data_(DataArr)); - return DataTable; - } - return null; - } -} -// Rindro_Script.GetBin(); -Rindro_Script.InitLoad_String(); \ No newline at end of file diff --git a/CSBase/_Z_Data/CharacterInfoData.nut b/CSBase/_Z_Data/CharacterInfoData.nut deleted file mode 100644 index 8571a01..0000000 --- a/CSBase/_Z_Data/CharacterInfoData.nut +++ /dev/null @@ -1,113 +0,0 @@ -/* -文件名:CharacterInfoData.nut -路径:Base/_Z_Data/CharacterInfoData.nut -创建日期:2024-09-03 11:34 -文件用途:角色信息数据 -*/ - -//读取属性数据 -function Lenheart_Character_GetAttribute(Address) { - //传入读传入不传读自己 - local ObjectAddress = Address; - if (ObjectAddress == null) - ObjectAddress = L_sq_RA(0x1AB7CDC); - if (!ObjectAddress) return; - - local Info = {}; - //当前HP - Info.CurHp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BEC); - //总HP - Info.MaxHp <- L_sq_RA(ObjectAddress + 0x36A0); - //当前MP - Info.CurMp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BF8); - //总MP - Info.MaxMp <- L_sq_RA(ObjectAddress + 0x36A4); - - //力量 - Info.Strength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2364); - //智力 - Info.Intellect <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2394); - //体力 - Info.Vitality <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x237C); - //精神 - Info.Spirit <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x23AC); - //物理攻击 (没读武器精通) - Info.PhysicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E54) * (Info.Strength.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1EB4); - //魔法攻击 - Info.MagicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E84) * (Info.Intellect.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1ED8); - //独立攻击力 //TODO 需要加上成长独立攻击力 需要服务端发送给我 - Info.IndependentAttack <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x22C8) + MemoryTool.DecodeMemoryData(ObjectAddress + 0x22F8); - - //物理防御 - Info.PhysicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x273C); - //魔法防御 - Info.MagicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x276C); - //物理暴击 - Info.PhysicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F14); - //魔法暴击 - Info.MagicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F20); - - //攻击速度 - Info.AttackSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2688) - 1.0) * 100.0; - //释放速度 - Info.ReleaseSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x26A0) - 1.0) * 100.0; - //移动速度 - Info.MoveSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2670) - 1.0) * 100.0; - - //抗魔值 - local Kbuf = 0; - for (local i = 1; i< 13; ++i) { - local EquOffset = Rindro_GetEquAddr(i); - local AbAddress = L_sq_RA(ObjectAddress + EquOffset); - if (AbAddress) { - Kbuf += MemoryTool.DecodeMemoryData(AbAddress + 0xAD4); - } - } - Info.AntiMagic <- Kbuf; - - - //命中率 - Info.HitRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F50); - //闪避率 - Info.DodgeRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1C50); - //HP回复量 - Info.HPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D64) * 1.6; - //MP回复量 - Info.MPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D7C) * 7.2; - //僵直度 - Info.StunRate <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DF4); - //硬直 - Info.StunResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DDC); - - //火属性强化 - Info.FireStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B54); - //冰属性强化 - Info.IceStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B60); - //光属性强化 - Info.LightStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B78); - //暗属性强化 - Info.DarkStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B6C); - //火属性抗性 - Info.FireResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1AF4); - //冰属性抗性 - Info.IceResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B00); - //光属性抗性 - Info.LightResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B18); - //暗属性抗性 - Info.DarkResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B0C); - - //名望值 - Info.Fame <- 0; - //最终伤害 - Info.FinalDamage <- 0; - - return Info; -} - -// function Rindro_GetCharacterInfoCallBack(Chunk) { -// local Jso = Json.Decode(Chunk); -// Jso.op <- 20069011; -// Jso.Info <- Lenheart_Character_GetAttribute(null); -// Rindro_BaseToolClass.SendPackEx(Jso); -// } -// Pack_Control.rawset(20069010, Rindro_GetCharacterInfoCallBack); \ No newline at end of file diff --git a/FileConfig.json b/FileConfig.json index 3f65ca6..b9f2e8b 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -12,6 +12,7 @@ "Base/_Tool/Image_Class.nut", "Base/_Tool/Animation_Class.nut", "Base/_Tool/Item_Class.nut", + "Base/_Tool/CustomAnimation_Class.nut", "Base/_Z_Data/Global.nut", "Base/CallBack/PackControl.nut", "Base/CallBack/DrawMain.nut", @@ -56,8 +57,21 @@ "CSBase/Interface.nut" ], "ProjectScript": { + "修复道具数量显示": { + "Private": true, + "Script": [ + "Project/FixItemCout/FixItemCout.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "修复道具数量显示", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "扩展装备": { "Private": true, + "Enabled": false, "Script": [ "Project/ExpandEquipment/ExpandEquipment.nut" ], @@ -70,6 +84,7 @@ }, "修炼场": { "Private": true, + "Enabled": false, "Script": [ "Project/Trainingroom/Training_SummonMonster.nut", "Project/Trainingroom/Training_ModifyAttributes.nut", @@ -86,6 +101,7 @@ }, "融合装备": { "Private": true, + "Enabled": false, "Script": [ "Project/ItemTool/ItemFusion/ItemFusion.nut" ], @@ -133,6 +149,7 @@ }, "赛利亚的热忱": { "Private": true, + "Enabled": false, "Script": [ "Project/SeriaZeal/SeriaZeal.nut" ], @@ -176,6 +193,7 @@ }, "累计奖励": { "price": 10, + "Enabled": false, "Script": [ "Project/CumulativeReward/CumulativeReward.nut" ], @@ -220,6 +238,7 @@ }, "世界BOSS": { "price": 100, + "Enabled": false, "Script": [ "Project/WorldBoss/WorldBoss.nut" ], @@ -306,6 +325,7 @@ }, "世界BOSS毁梦": { "Private": true, + "Enabled": false, "price": 100, "Script": [ "Project/WorldBoss/WorldBoss_HM.nut" @@ -321,6 +341,7 @@ }, "仓库锁": { "Private": true, + "Enabled": false, "price": 100, "Script": [ "Project/WarehouseLock/WarehouseLock.nut" @@ -336,6 +357,7 @@ }, "圣者遗物箱": { "price": 30, + "Enabled": false, "Script": [ "Project/AncientheroLuckyBox/AncientheroLuckyBox.nut" ], @@ -366,6 +388,7 @@ }, "皮肤仓库": { "price": 25, + "Enabled": false, "Script": [ "Project/SkinHub/SkinHub.nut" ], @@ -392,6 +415,7 @@ }, "收集箱": { "price": 50, + "Enabled": false, "Script": [ "Project/CollectionBox/CollectionBox.nut" ], @@ -414,6 +438,7 @@ }, "伤害控制": { "price": 10, + "Enabled": false, "Script": [], "info": { "ProjectAuthor": "10", @@ -430,6 +455,7 @@ }, "战令": { "price": 60, + "Enabled": false, "Script": [ "Project/AradPass/AradPass_Help.nut", "Project/AradPass/AradPass_Quest.nut", @@ -478,6 +504,7 @@ }, "秒伤统计": { "price": 0, + "Enabled": false, "Script": [ "Project/DamagePerSecond/DamagePerSecond.nut" ], @@ -504,6 +531,7 @@ }, "土罐": { "price": 25, + "Enabled": false, "Script": [ "Project/Tuguan/Tuguan.nut" ], @@ -534,6 +562,7 @@ }, "上线公告": { "price": 0, + "Enabled": false, "Script": [ "Project/OnlineAnnouncement/OnlineAnnouncement.nut" ], @@ -556,6 +585,7 @@ }, "时装变身": { "price": 0, + "Enabled": false, "Script": [ "Project/Shapeshifting/Shapeshifting.nut" ], @@ -582,6 +612,7 @@ }, "战力系统": { "price": 50, + "Enabled": false, "Script": [ "Project/CombatRank/CombatRank.nut" ], @@ -608,6 +639,7 @@ }, "安图恩": { "price": 200, + "Enabled": false, "Script": [ "Project/Anton/Rindro_Anton_CreateParty.nut", "Project/Anton/Rindro_Anton_FightSituation.nut", @@ -737,6 +769,7 @@ }, "卢克": { "price": 200, + "Enabled": false, "Script": [ "Project/Luke/Rindro_Luke_CreateParty.nut", "Project/Luke/Rindro_Luke_FightSituation.nut", @@ -842,6 +875,7 @@ }, "超时空": { "price": 300, + "Enabled": false, "Script": [ "Project/Fiendwar/FiendFightLogic.nut", "Project/Fiendwar/Rindro_Fiendwar_CreateParty.nut", @@ -967,6 +1001,7 @@ }, "成就系统": { "Private": true, + "Enabled": false, "Script": [ "Project/Achievement/Achievement.nut" ], @@ -979,6 +1014,7 @@ }, "新成就系统": { "Private": true, + "Enabled": false, "price": 999, "Script": [ "Project/Achievement_New/Achievement_New.nut" @@ -992,6 +1028,7 @@ }, "定制-交易行": { "Private": true, + "Enabled": false, "price": 999, "Script": [ "Project/Exchange/Exchange.nut", @@ -1006,6 +1043,7 @@ }, "桃花定制战力系统": { "Private": true, + "Enabled": false, "price": 999, "Script": [ "Project/TH_CombatRank/TH_CombatRank.nut" @@ -1019,6 +1057,7 @@ }, "毁梦定制战力系统": { "Private": true, + "Enabled": false, "price": 999, "Script": [ "Project/HM_CombatRank/HM_CombatRank.nut" @@ -1032,6 +1071,7 @@ }, "宿命魂石": { "Private": true, + "Enabled": false, "price": 999, "Script": [ "Project/FatalismStone/FatalismStone_Stone.nut", @@ -1047,6 +1087,7 @@ }, "宽屏UI": { "Private": true, + "Enabled": false, "Script": [ "Project/HudUi/HudUi.nut" ], @@ -1059,6 +1100,7 @@ }, "NPC交易": { "Private": true, + "Enabled": false, "Script": [ "Project/NpcTransaction/NpcTransaction.nut" ], diff --git a/Project/FixItemCout/FixItemCout.nut b/Project/FixItemCout/FixItemCout.nut new file mode 100644 index 0000000..b82f755 --- /dev/null +++ b/Project/FixItemCout/FixItemCout.nut @@ -0,0 +1,138 @@ +/* +文件名:FixItemCout.nut +路径:Project/FixItemCout/FixItemCout.nut +创建日期:2026-01-14 16:58 +文件用途: +*/ + +class FixItemCoutC { + + Img = Rindro_Image("common/smallnumber.img"); + Img2 = Rindro_Image("interface/digit/small_stroke_white.img"); + + LengthList = [6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 3, 8, 7]; + SmallLengthList = [5, 4, 5, 5, 5, 5, 5, 5, 5, 5]; + + constructor() { + _FixItemCount_(); + } + + function Logic(X, Y, Count) { + if (Count > 1) { + local Suf = -1; + if (Count > 9999) { + Count = Count / 10000.0; + Suf = 12; + + local Str = Count.tostring(); + if (typeof Count == "float") Str = format("%.1f", Count); + local Length = 0; + local DrawList = []; + for (local i = 0; i< Str.len(); i++) { + local char = Str.slice(i, i + 1); + local Width = 0; + if (char == ".") { + Width = 3; + DrawList.append({ + index = 10, + width = Width + + }) + } else { + local Index = char.tointeger(); + Width = LengthList[Index]; + DrawList.append({ + index = Index, + width = Width + }) + } + Length += Width; + } + if (Suf != -1) { + DrawList.append({ + index = Suf, + width = LengthList[Suf] + }) + Length += LengthList[Suf]; + } + + local DrawOffset = 0; + foreach(index, info in DrawList) { + local offset = 0; + if (index != 0) { + offset = DrawList[index - 1].width + DrawOffset + } + Img.DrawPng(info.index, X - Length + offset, Y + (info.index == 10 ? 7 : 0) + (info.index == 12 ? -1 : 0)); + DrawOffset = offset; + } + } else if (Count > 999 && Count <= 9999) { + local Str = Count.tostring(); + local Length = 0; + local DrawList = []; + for (local i = 0; i< Str.len(); i++) { + local char = Str.slice(i, i + 1); + local Index = char.tointeger(); + DrawList.append({ + index = Index, + width = SmallLengthList[Index] + }); + Length += SmallLengthList[Index]; + } + + local DrawOffset = 0; + foreach(index, info in DrawList) { + local offset = 0; + if (index != 0) { + offset = DrawList[index - 1].width + DrawOffset + } + Img2.DrawPng(info.index, X - 1 - Length + offset, Y); + DrawOffset = offset; + } + } else if (Count <= 999) { + local Str = Count.tostring(); + local Length = 0; + local DrawList = []; + for (local i = 0; i< Str.len(); i++) { + local char = Str.slice(i, i + 1); + local Index = char.tointeger(); + DrawList.append({ + index = Index, + width = LengthList[Index] + }); + Length += LengthList[Index]; + } + + + local DrawOffset = 0; + foreach(index, info in DrawList) { + local offset = 0; + if (index != 0) { + offset = DrawList[index - 1].width + DrawOffset + } + Img.DrawPng(info.index, X - 1 - Length + offset, Y); + DrawOffset = offset; + } + } + + } + } +} + + +getroottable().rawdelete("FixItemCout_Obj"); + +function Lenheart_FixItemCout_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("FixItemCout_Obj")) { + RootTab.rawset("FixItemCout_Obj", FixItemCoutC()); + } +} + +function Sq_FixItemCount(X, Y, Count) { + local RootTab = getroottable(); + if (RootTab.rawin("FixItemCout_Obj")) { + RootTab["FixItemCout_Obj"].Logic(X, Y, Count); + } +} + +getroottable()["LenheartFuncTab"].rawset("FixItemCoutFuncN", Lenheart_FixItemCout_Fun); \ No newline at end of file diff --git a/Project/ItemTool/ItemCrossover/ItemCrossover.nut b/Project/ItemTool/ItemCrossover/ItemCrossover.nut index d0b1c85..d25b1e3 100644 --- a/Project/ItemTool/ItemCrossover/ItemCrossover.nut +++ b/Project/ItemTool/ItemCrossover/ItemCrossover.nut @@ -146,10 +146,10 @@ class ItemCrossoverC extends LenheartNewUI_Windows { if (!MaterialIsEnough) { local str = "跨界材料不足!"; - L_sq_DrawCode(str, X + 147 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, sq_RGBA(255, 60, 48, 255), 0, 1); + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, sq_RGBA(255, 60, 48, 255), 0, 1); } else { local str = CrossoverItem.Name; - L_sq_DrawCode(str, X + 147 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, GetRarityColor(CrossoverItem.Rarity), 0, 1); + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, GetRarityColor(CrossoverItem.Rarity), 0, 1); } } } diff --git a/Project/ItemTool/ItemFusion/ItemFusion.nut b/Project/ItemTool/ItemFusion/ItemFusion.nut index bcd161e..0c71ece 100644 --- a/Project/ItemTool/ItemFusion/ItemFusion.nut +++ b/Project/ItemTool/ItemFusion/ItemFusion.nut @@ -16,12 +16,8 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_ItemSlot { HoverFlag = false; -<<<<<<< HEAD constructor(X, Y, Index) { MyIndex = Index; -======= - constructor(X, Y) { ->>>>>>> a11458d226ec41caa22d30b6d76893362389e3e1 LenheartNewUI_ItemSlot.constructor(X, Y); } @@ -36,21 +32,21 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_ItemSlot { // if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null; // } - CheckInRect(); + // CheckInRect(); } - function CheckInRect() { - local MousePos_X = IMouse.GetXPos(); - local MousePos_Y = IMouse.GetYPos(); - if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, 30, 30)) { - //绘制悬停框 - L_sq_SetDrawImgModel(2, 0); - Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X, Y); - L_sq_ReleaseDrawImgModel(); - HoverFlag = true; - } else HoverFlag = false; - } + // function CheckInRect() { + // local MousePos_X = IMouse.GetXPos(); + // local MousePos_Y = IMouse.GetYPos(); + // if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, 30, 30)) { + // //绘制悬停框 + // L_sq_SetDrawImgModel(2, 0); + // Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X, Y); + // L_sq_ReleaseDrawImgModel(); + // HoverFlag = true; + // } else HoverFlag = false; + // } function DiscardItem(info) { diff --git a/Project/ItemTool/ItemInherit/ItemInherit.nut b/Project/ItemTool/ItemInherit/ItemInherit.nut index 0223546..8c5777f 100644 --- a/Project/ItemTool/ItemInherit/ItemInherit.nut +++ b/Project/ItemTool/ItemInherit/ItemInherit.nut @@ -68,6 +68,7 @@ class ItemInheritC extends LenheartNewUI_Windows { // ResultItemSlot.SetItem(ItemR); AddChild(ResultItemSlot); + } diff --git a/Project/ItemTool/ItemOtherWolrdUpgrade/ItemOtherWolrdUpgrade.nut b/Project/ItemTool/ItemOtherWolrdUpgrade/ItemOtherWolrdUpgrade.nut new file mode 100644 index 0000000..9ab2953 --- /dev/null +++ b/Project/ItemTool/ItemOtherWolrdUpgrade/ItemOtherWolrdUpgrade.nut @@ -0,0 +1,353 @@ +/* +文件名:ItemOtherWolrdUpgrade.nut +路径:Project/ItemTool/ItemOtherWolrdUpgrade/ItemOtherWolrdUpgrade.nut +创建日期:2026-01-13 19:31 +文件用途: +*/ +class ItemOtherWolrdUpgradeC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + Img = Rindro_Image("interface2/ui/newitemtool/otherworldup.img"); + + //装备 + Item = null; + //装备槽位 + ItemSlot = null; + //注册的NPC列表 + NPCList = null; + //所需的基础材料 + BasicMaterials = null; + //等级倍率 + LevelRate = null; + //品级倍率 + RarityRate = null; + + //背景动画 + BackGroundAni = null; + + //错误 + Error = null; + + //错误信息 + ErrorMsg = null; + //所需材料信息 + MaterialInfo = null; + //所需材料是否足够 + MaterialIsEnough = false; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + DiscardItemCallBackFunc.rawset("ItemOtherWolrdUpgradeC", DiscardItem.bindenv(this)); + + //初始化信息 + InifPvf(); + //注册NPC回调 + RegNpc(); + + //初始化背景动画 + local BallFrameArr = []; + for (local i = 0; i< 30; i++) { + local T = { + ImgIndex = i, + Delay = 60, + Pos = [0, 0] + } + BallFrameArr.append(T); + } + BackGroundAni = Rindro_CustomAnimation("interface2/itemtoolwindow/changeoptions/mastercube.img", BallFrameArr); + + + Pack_Control.rawset(21010002, function(Chunk) { + local Jso = Json.Decode(Chunk); + if (Jso.rawin("error")) { + ErrorMsg = 1; + } + if (Jso.rawin("MgInfo")) { + MaterialInfo = Jso.MgInfo; + //材料是否充足 + MaterialIsEnough = true; + foreach(Info in MaterialInfo) { + if (Info.NeedCount > Info.RealCount) { + MaterialIsEnough = false; + break; + } + } + } + }.bindenv(this)); + + //成功回包 + Pack_Control.rawset(21010004, function(Chunk) { + //清空 + Item = null; + ItemSlot.RemoveItem(); + ErrorMsg = null; + MaterialInfo = null; + MaterialIsEnough = false; + // R_Utils.PlaySound("CHNUTTREE_BOX"); + }.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(274, 4, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //确认按钮 + local CrossoverButton = LenheartNewUI_ButtonText(109, 260, 15, "确认升级"); + CrossoverButton.DWidth = 18; + CrossoverButton.Width = 74; + CrossoverButton.SetTextOffset(-4, 1); + CrossoverButton.OnClickEx = function(Btn) { + if (!Btn.Visible) return; + SendPackEx({ + op = 21010003, + item = Item + }); + }.bindenv(this); + CrossoverButton.SetCallBackFunc(function(Btn) { + if (ErrorMsg || !MaterialIsEnough) { + Btn.State = 8; + } else { + Btn.State = 0; + } + }.bindenv(this)); + AddChild(CrossoverButton); + + ItemSlot = LenheartNewUI_ItemSlot(132, 100); + ItemSlot.SetRemoveCallBack(function(obj) { + Item = null; + }.bindenv(this)); + AddChild(ItemSlot); + } + + //绘制主界面 + function DrawMain(obj) { + + //背景框 + DrawNineBox(X, Y, 292, 292, "interface/lenheartwindowcommon.img", 213); + //标题 + DrawWindowTitle(293); + //绘制标题名 + L_sq_DrawCode("异界装备升级", X + 110, Y + 5, sq_RGBA(230, 200, 155, 255), 0, 1); + + + setClip(X + 8, Y + 32, X + 285, Y + 259); + local rate = 0.35; + Img.DrawExPng(1, X + 12, Y + 36, 0, sq_RGBA(255, 255, 255, 250), rate, rate); + L_sq_SetDrawImgModel(2, 0); + BackGroundAni.ShowEx(Duration, X + 12 - 80, Y + 36 - 45, sq_RGBA(255, 255, 255, 250), 0.75, 0.75); + L_sq_ReleaseDrawImgModel(); + releaseClip(); + + + Img.DrawPng(0, X + 8, Y + 32); + + + // if (MaterialsList) { + // foreach(Index, Info in MaterialsList) { + // DrawItemBase(X + 31 + 51 * Index, Y + 195, Info.ItemId, Info.ItemCount); + // } + // } + + //绘制跨界所需材料及数量信息 + if (MaterialInfo) { + for (local i = 0; i< 5; i++) { + if (i >= MaterialInfo.len()) { + Img.DrawPng(2, X + 31 + 51 * i, Y + 195); + continue; + } + local Info = MaterialInfo[i]; + DrawItemBase(X + 31 + 51 * i, Y + 195, Info.Item, Info.NeedCount); + //数量不足绘制遮盖图 + if (Info.NeedCount > Info.RealCount) { + Rindro_Image_GlobalMap["lenheartui"].DrawExPng(257, X + 32 + 51 * i, Y + 196, 0, sq_RGBA(255, 255, 255, 120), 1.0, 1.0); + } + + local RealCountStr = Info.RealCount.tostring(); + local Color = Info.RealCount >= Info.NeedCount ? sq_RGBA(52, 255, 50, 255) : sq_RGBA(255, 60, 47, 255); + L_sq_DrawCode(RealCountStr, X + 46 + (51 * i) - LenheartTextClass.GetStringLength(RealCountStr) / 2, Y + 232, Color, 0, 1); + } + + if (!MaterialIsEnough) { + local str = "升级材料不足!"; + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, sq_RGBA(255, 60, 48, 255), 0, 1); + } else { + local str = Item.Name; + L_sq_DrawCode(str, X + 148 - LenheartTextClass.GetStringLength(str) / 2, Y + 142, GetRarityColor(Item.Rarity), 0, 1); + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + function DiscardItem(ItemAddress) { + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + if (!sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) return true; + if (!Visible) return true; + else { + Item = FindItemPosByForeachInven(ItemAddress); + if (Item) { + local ItemObject = Rindro_Item(); + ItemObject.LoadByAddress(Item.ItemAddress); + ItemSlot.SetItem(ItemObject); + + SendPackEx({ + op = 21010001, + item = Item + }); + } + } + } + + //遍历背包查找Item + function FindItemPosByForeachInven(FindAddress) { + local Inven = L_sq_RA(0x1A5FB24); + local InvenAdd = L_sq_RA(Inven + 56); + InvenAdd += 36; + for (local z = 0; z< 1; z++) { + for (local i = 0; i< 48; i++) { + local ItemAdd = L_sq_RA(InvenAdd + ((i + (z * 48)) * 4)); + if (ItemAdd == FindAddress) { + local NamePointer = L_sq_RA(FindAddress + 0x20); + if (z != 0) { + if (ItemInfoDrawS) { + L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); + ItemInfoDrawS = null; + ResetFocus(); + } + return null; + } + local rRarity = L_sq_RA(FindAddress + 0xF4); + //不是异界装备 + if (rRarity != 5) return; + return { + Type = z, + Pos = i, + Vis = false, + Count = MemoryTool.DecodeMemoryData(FindAddress + 0x1A4), + ItemId = L_sq_RA(FindAddress + 0x1c), + ItemAddress = FindAddress, + Name = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString(), + Rarity = rRarity, + Level = L_sq_RA(FindAddress + 0x8) + }; + } + } + } + return null; + } + + //读取配置 + function InifPvf() { + Rindro_Script.GetFileData("etc/rindro/itemtool/itemotherworldupgrade/itemotherworldupgrade.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[NPC]") { + NPCList = []; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/NPC]") { + break; + } + NPCList.append(Fbuf); + } + } else if (Fragment == "[BASIC MATERIALS]") { + BasicMaterials = []; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/BASIC MATERIALS]") { + break; + } + local T = { + Item = Fbuf, + Count = Data.Get() + } + BasicMaterials.push(T); + } + } else if (Fragment == "[LEVEL RATE]") { + LevelRate = Data.Get() + } else if (Fragment == "[RARITY RATE]") { + RarityRate = Data.Get() + } + } + }); + } + + function RegNpc() { + local EachManager = Lenheart_Get_EachObj(); + foreach(id in NPCList) { + //先清空注册 + 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 = 53; + ApplyEngagementButton.Str = "装备升级"; + ApplyEngagementButton.Data = SThis.NPC_Index; + ApplyEngagementButton.OnClick = function(Button) { + + InitWindow(); + //打开背包 + L_sq_Open_ExWindow(0x1ADE090, 0, 0, 1); + Button.Parent.CloseAllEach(); + Button.Parent.CloseWindow(); + ResetFocus(); + R_Utils.PlaySound("WINDOW_SHOW"); + }.bindenv(this); + ApplyEngagementButton.SetCallBackFunc(function(Button) {}) + SThis.AddChild(ApplyEngagementButton); + }.bindenv(this)); + } + } + + function InitWindow() { + Visible = true; + //清空 + Item = null; + ItemSlot.RemoveItem(); + ErrorMsg = null; + MaterialInfo = null; + MaterialIsEnough = false; + } +} + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("ItemOtherWolrdUpgrade_Obj"); +getroottable().rawdelete("L_Each_Obj"); + + +function Lenheart_ItemOtherWolrdUpgrade_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("ItemOtherWolrdUpgrade_Obj")) { + RootTab.rawset("ItemOtherWolrdUpgrade_Obj", true); + LenheartNewUI_CreateWindow(ItemOtherWolrdUpgradeC, "异界装备升级窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 160, 292, 290, 28); + } +} + +getroottable()["LenheartFuncTab"].rawset("ItemOtherWolrdUpgradeFuncN", Lenheart_ItemOtherWolrdUpgrade_Fun); \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json index fe5dfbf..1ff69ea 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -226,5 +226,14 @@ }, "Project/ExpandEquipment": { "description": "拓展装备" + }, + "Project/ItemTool/ItemOtherWolrdUpgrade": { + "description": "异界装备升级" + }, + "Base/_Tool/CustomAnimation_Class.nut": { + "description": "自定义Ani" + }, + "Project/FixItemCout": { + "description": "修复道具数量显示" } } \ No newline at end of file