diff --git a/Base/CallBack/GetDamageRate.nut b/Base/CallBack/GetDamageRate.nut index 8f6bcce..380eef0 100644 --- a/Base/CallBack/GetDamageRate.nut +++ b/Base/CallBack/GetDamageRate.nut @@ -5,6 +5,8 @@ 文件用途:获取伤害倍率 */ RindroDamageRate <- 1.0; +RindroDamageRateChanageAddFunc <- {}; +RindroDamageRateChanageRideFunc <- {}; function L_getCurrentModuleDamageRate(obj) { if (!obj) @@ -17,6 +19,18 @@ function L_getCurrentModuleDamageRate(obj) { ClientRat = 1.0; } + local AddRate = 0; + foreach (Func in RindroDamageRateChanageAddFunc) { + AddRate += Func(); + } + ClientRat += AddRate; + + local RideRate = 1.0; + foreach (Func in RindroDamageRateChanageRideFunc) { + RideRate *= Func(); + } + ClientRat *= RideRate; + return (RindroDamageRate * ClientRat); } diff --git a/Base/_Tool/Hacker_RegApi.nut b/Base/_Tool/Hacker_RegApi.nut index 8576580..5247854 100644 --- a/Base/_Tool/Hacker_RegApi.nut +++ b/Base/_Tool/Hacker_RegApi.nut @@ -284,6 +284,61 @@ function Sq_GetExeStr_Event(Index) { return Index; } +getroottable().DrawAppendCallBackFunc <- {}; +Rindro_Haker.LoadHook(0x67C560, ["pointer", "int", "int", "int", "int", "void"], + function(args) { + foreach(Func in DrawAppendCallBackFunc) { + Func(args); + } + return null; + }, + function(args) { + + return null; + }); + + +/* + 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; + */ + +// HOOK读取AP脚本 +// Rindro_Haker.LoadHook(0x121A100, ["int", "int", "int", "int", "int","bool"], +// function(args) { +// return null; +// }, +// function(args) { +// print(NativePointer(L_sq_I2P(args[1])).readUnicodeString()); +// if (NativePointer(L_sq_I2P(args[1])).readUnicodeString() == "SQR/../etc/rindro/ancientrelic/ancientrelic.nut") { +// printf("加载AP脚本"); +// local str = "function sq_AddFunctionName(appendage)\n{\n}\n print(778899);"; +// NativePointer(L_sq_I2P(args[4])).writeInt(str.len()); +// NativePointer(L_sq_I2P(args[2])).writeByteArray(str); +// } +// return null; +// }); + + +// getroottable().onAttackParentCallBackFunc <- {}; +// Rindro_Haker.LoadHook(0x9CFF50, ["pointer", "int", "int", "int", "int", "int"], +// function(args) { +// foreach(Func in onAttackParentCallBackFunc) { +// Func(args); +// } +// return null; +// }, +// function(args) { + +// return null; +// }); + + // //hook打开窗口 // Rindro_Haker.LoadHook(0xE6E070, ["int","int","int","int","void"], diff --git a/FileConfig.json b/FileConfig.json index 0d4e473..09e0876 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -52,6 +52,19 @@ "CSBase/Interface.nut" ], "ProjectScript": { + "荒古遗尘装备": { + "price": 1, + "Script": [ + "Project/CustomizeWeapon/AncientRelic/AncientRelic.nut" + ], + "info": { + "ProjectAuthor": "1", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "荒古遗尘装备", + "ProjectAlias": "荒古遗尘装备" + }, + "imgPath": "CustomizeWeapon/AncientRelic" + }, "累计奖励": { "price": 10, "Script": [ diff --git a/Project/CustomizeWeapon/AncientRelic/AncientRelic.nut b/Project/CustomizeWeapon/AncientRelic/AncientRelic.nut new file mode 100644 index 0000000..59d6a2e --- /dev/null +++ b/Project/CustomizeWeapon/AncientRelic/AncientRelic.nut @@ -0,0 +1,205 @@ +/* +文件名:AncientRelic.nut +路径:Project/CustomizeWeapon/AncientRelic.nut +创建日期:2025-12-04 14:22 +文件用途: +*/ +class CustomizeWeapon_AncientRelic { + + Info = null; + + //是否有荒古装备 + IsAncientRelic = false; + //当前魔能积攒数值 + MagicEnergyValue = 0; + //当前魔能开启状态 + MagicEnergyState = false; + //魔能爆发阶段 + MagicEnergyStage = 0; + //魔能爆发计时器 + MagicEnergyTimer = 0; + //常规状态伤害增加率 + DamageRate = 1.0; + //魔能状态伤害增加率 + MagicDamageRate = 1.0; + + + constructor() { + Info = {}; + //读取PVF中 荒古装备的配置 + Rindro_Script.GetFileData("etc/rindro/ancientrelic/ancientrelic.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[info]") { + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/info]") { + break; + } + local NormalRate = Data.Get(); + local ExRate = Data.Get(); + + Info.rawset(Fbuf, { + NormalRate = NormalRate.tofloat() / 100.0 + 1.0, + ExRate = ExRate.tofloat() / 100.0 + 1.0 + }) + } + } + } + }); + + RindroDamageRateChanageRideFunc.rawset("AncientRelic", function() { + return MagicEnergyState ? MagicDamageRate : DamageRate; + }.bindenv(this)); + + DrawAppendCallBackFunc.rawset("AncientRelic", DrawEffect.bindenv(this)); + // onAttackParentCallBackFunc.rawset("AncientRelic", OnAttack.bindenv(this)); + + // local str = "funcaksdnjkansdknasjdad"; + // local A = Memory.allocUtf8String(str); + // local B = Memory.alloc(0x1000); + + // local str = "testsadsdads"; + // local B = Memory.alloc(0x1000); + // B.writeByteArray(str); + // print(B.readUtf8String(str.len())); + } + + function AdditionalAppendage(obj) { + if (sq_GetCurrentModuleType() == 3) { + local appendage = CNSquirrelAppendage.sq_GetAppendage(obj, "../etc/rindro/ancientrelic/ancientrelic.nut"); + if (!appendage) { + CNSquirrelAppendage.sq_AppendAppendage(obj, obj, 169, true, "../etc/rindro/ancientrelic/ancientrelic.nut", true); + } + } + } + + //魔能爆炸 + function MagicEnergyExplosion(obj) { + local OutbreakBool = obj.getMyPassiveObject(48882, 0); + if (OutbreakBool && !MagicEnergyState) { + MagicEnergyState = true; + MagicEnergyTimer = Clock(); + sq_SendDestroyPacketPassiveObject(OutbreakBool); + } + } + + + //绘制魔能特效 + function DrawEffect(args) { + if (IsAncientRelic) { + //魔能开启状态 + if (MagicEnergyValue > 0) { + if (MagicEnergyState) { + if (MagicEnergyStage == 0) { + Rindro_BaseToolClass.DrawAniEx(args[1], args[2], "etc/rindro/ancientrelic/ani/open/01_red/red_onedodge2.ani"); + } else if (MagicEnergyStage == 1) { + Rindro_BaseToolClass.DrawAniEx(args[1], args[2], "etc/rindro/ancientrelic/ani/open/02_yellow/yellow_onedodge2.ani"); + } else if (MagicEnergyStage == 2) { + Rindro_BaseToolClass.DrawAniEx(args[1], args[2], "etc/rindro/ancientrelic/ani/open/03_white/white_onedodge2.ani"); + } + } + //普通状态 + else { + local Step = ((MagicEnergyValue / 20).tointeger() + 1); + if (Step > 5) Step = 5; + Rindro_BaseToolClass.DrawAniEx(args[1], args[2], "etc/rindro/ancientrelic/ani/" + Step + "/particle1.ani"); + } + + } + } + } + + //攻击判定回调 + function OnAttack() { + if (IsAncientRelic) { + MagicEnergyValue++; + if (MagicEnergyValue > 100) MagicEnergyValue = 100; + } + } + + //检测是否穿戴荒古装备 + function CheckWear() { + for (local i = 1; i< 13; ++i) { + //编号 + local Index = L_sq_GetCharacterAttribute(0x1c, i); + if (Info.rawin(Index)) { + DamageRate = Info[Index].NormalRate; + MagicDamageRate = Info[Index].ExRate; + IsAncientRelic = true; + return; + } + } + IsAncientRelic = false; + } + + function MagicEnergyLogic(obj) { + if (IsAncientRelic) { + //魔能开启状态 + if (MagicEnergyValue > 0) { + if (MagicEnergyState) { + //检测魔能变更时间 + if (Clock() - MagicEnergyTimer >= 7000) { + MagicEnergyTimer = Clock(); + MagicEnergyStage++; + //爆发结束 + if (MagicEnergyStage > 2) { + MagicEnergyState = false; + MagicEnergyStage = 0; + MagicEnergyValue = 0; + sq_GetCNRDObjectToSQRCharacter(obj).sq_SendCreatePassiveObjectPacket(48883, 0, 0, 0, 0); + } + } + } + } + } + } + + function Proc(obj) { + CheckWear(); + //如果穿戴了荒古装备 + if (IsAncientRelic) { + MagicEnergyExplosion(obj); + AdditionalAppendage(obj); + MagicEnergyLogic(obj); + } else { + //是否有荒古装备 + IsAncientRelic = false; + //当前魔能积攒数值 + MagicEnergyValue = 0; + //当前魔能开启状态 + MagicEnergyState = false; + //魔能爆发阶段 + MagicEnergyStage = 0; + //魔能爆发计时器 + MagicEnergyTimer = 0; + //常规状态伤害增加率 + DamageRate = 1.0; + //魔能状态伤害增加率 + MagicDamageRate = 1.0; + } + } +} + +getroottable().rawdelete("CustomizeWeapon_AncientRelic_Obj"); + + +function Lenheart_AncientRelic_Fun(obj) { + + local RootTab = getroottable(); + if (!RootTab.rawin("CustomizeWeapon_AncientRelic_Obj")) { + RootTab.rawset("CustomizeWeapon_AncientRelic_Obj", CustomizeWeapon_AncientRelic()); + } else { + RootTab["CustomizeWeapon_AncientRelic_Obj"].Proc(obj); + } +} + +function onAttackParent_appendage_AncientRelic(appendage, realAttacker, damager, boundingBox, isStuck) { + if (!appendage) return; + local RootTab = getroottable(); + if (RootTab.rawin("CustomizeWeapon_AncientRelic_Obj")) { + RootTab["CustomizeWeapon_AncientRelic_Obj"].OnAttack(); + } +} + +getroottable()["LenheartFuncTab"].rawset("AncientRelicFuncN", Lenheart_AncientRelic_Fun); \ No newline at end of file diff --git a/Project/CustomizeWeapon/AncientRelic/img/image.png b/Project/CustomizeWeapon/AncientRelic/img/image.png new file mode 100644 index 0000000..0737a29 Binary files /dev/null and b/Project/CustomizeWeapon/AncientRelic/img/image.png differ diff --git a/folder-alias.json b/folder-alias.json index 91a7234..0400abe 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -175,5 +175,11 @@ }, "Project/NpcTransaction": { "description": "npc交易" + }, + "Project/CustomizeWeapon": { + "description": "定制武器" + }, + "Project/CustomizeWeapon/AncientRelic.nut": { + "description": "荒古系列装备" } } \ No newline at end of file