commit f11a45c8f9bd8ec9e014a854726aa87acf152271 Author: Lenheart <947330670@qq.com> Date: Sun Mar 23 10:51:55 2025 +0000 1111 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/ActiveCall/ActiveCall.md b/ActiveCall/ActiveCall.md new file mode 100644 index 0000000..8fe2502 --- /dev/null +++ b/ActiveCall/ActiveCall.md @@ -0,0 +1,15 @@ +# ActiveCall 回调函数文档 + +**回调说明**: +`ActiveCall`类用于动态执行服务端中的函数。 + +--- + +**注册方法**: +- `逆向出 函数地址与参数` + +**例子**: + +```squirrel +Sq_CallFunc(S_Ptr("0x0817a17c"), "int", ["pointer"], this.C_Object); +``` diff --git a/AllCallBack/AllCallBack.md b/AllCallBack/AllCallBack.md new file mode 100644 index 0000000..4c94b75 --- /dev/null +++ b/AllCallBack/AllCallBack.md @@ -0,0 +1,142 @@ +# 集成回调函数 文档 + +**说明**: +由于新增的回调接口较多,并且注册方式与使用方法相同所以全部写在这个文档中 + +--- + +**注册方式**: +>此文档中每一个回调函数都分为两个注册接口 一个注册接口在原函数执行前 一个注册接口在原函数执行后 + +>这里使用 玩家拾取道具 接口为例 与frida一样函数的参数被储存在 args 数组中 可以用过args[0] args[1]这样的方式调用 +``` +//函数调用前的回调函数 +Cb_User_Get_Item_Enter_Func.MyFunc <- function(args){ + local itemId = args[2]; + local SUser = User(args[1]); + print("玩家: [ " + SUser.GetCharacName() + " ]" + " 拾取了道具: [ " + itemId + " ]"); + + //return null 或者不写 return 代表不对原函数参数做任何修改 + //return args 代表修改原函数的参数为修改过的args +} +//函数调用后的回调函数 +Cb_User_Get_Item_Leave_Func.MyFunc <- function(args){ + local itemId = args[2]; + local SUser = User(args[1]); + print("玩家: [ " + SUser.GetCharacName() + " ]" + " 拾取了道具: [ " + itemId + " ]"); + + //对args 数组 进行 pop 操作将会取得原函数的返回值 + local OldRet = args.pop(); + + //return null 或者不写 return 代表不对原函数返回值做任何修改 + //return 任意其他类型 代表将原函数返回值强制修改为你返回的值 +} +``` + + +--- +--- +**回调大全**: +接下来开始公布回调函数 +--- +--- + + +>玩家新增道具时 +``` +Cb_User_Insert_Item_Enter_Func +Cb_User_Insert_Item_Leave_Func +``` +--- + +>玩家捡起道具 +``` +Cb_User_Get_Item_Enter_Func +Cb_User_Get_Item_Leave_Func +``` +--- + +>服务器Chat日志HOOK +``` +Cb_Server_Chat_Log_Enter_Func +Cb_Server_Chat_Log_Leave_Func +``` +--- + +>玩家上线设置IP +``` +Cb_User_Set_WebAddress_Enter_Func +Cb_User_Set_WebAddress_Leave_Func +``` +--- + +>服务端关闭执行函数 +``` +Cb_Server_Close_Enter_Func +Cb_Server_Close_Leave_Func +``` +--- + +>检查地下城的状况 +``` +Cb_CheckInoutConditionDungeon_Enter_Func +Cb_CheckInoutConditionDungeon_Leave_Func +``` +--- + +>地下城现场杀死地狱党组怪物Cnt +``` +Cb_Field_KillHellPartyGroupMonsterCnt_Enter_Func +Cb_Field_KillHellPartyGroupMonsterCnt_Leave_Func +``` +--- + +>经验收益 +``` +Cb_Gain_Exp_Sp_Enter_Func +Cb_Gain_Exp_Sp_Leave_Func +``` +--- + + +>货币收益 +``` +Cb_Gain_Money_Enter_Func +Cb_Gain_Money_Leave_Func +``` +--- + +>GetItem检查错误 +``` +Cb_GetItem_Check_Error_Enter_Func +Cb_GetItem_Check_Error_Leave_Func +``` +--- + +>队伍清除副本 +``` +Cb_ClearDungeon_Enter_Func +Cb_ClearDungeon_Leave_Func +``` +--- + +>检查选择进入副本时状态 +``` +Cb_SelectDungeon_Check_Error_Enter_Func +Cb_SelectDungeon_Check_Error_Leave_Func +``` +--- + +>切换装备 +``` +Cb_CInventory_ChangeEquip_Enter_Func +Cb_CInventory_ChangeEquip_Leave_Func +``` +--- + +>获取通关时间回调 +``` +Cb_CParty_SetBestClearTime_Enter_Func +Cb_CParty_SetBestClearTime_Leave_Func +``` +--- \ No newline at end of file diff --git a/AutoHotLoadScript/AutoHotLoadScript.md b/AutoHotLoadScript/AutoHotLoadScript.md new file mode 100644 index 0000000..97cc49b --- /dev/null +++ b/AutoHotLoadScript/AutoHotLoadScript.md @@ -0,0 +1,20 @@ +# AutoHotReload 文档 + +**说明**: +`AutoHotReload`使你能够不重启服务端程序,自动迭代你最新的脚本代码 + +--- + +> 在 sqr_main 的回调函数中写入以下代码 参数为你要重载的脚本文件夹 +``` +//初始化自动重载 +GameManager.OpenHotFix("/dp_s/MyProject"); +``` + + +--- +--- +**温馨提示**: +在开发环境开启自动热重载后,上线请关闭自动热重载功能以免对性能造成影响 +--- +--- \ No newline at end of file diff --git a/CallBack/Base_Input/Base_Input.md b/CallBack/Base_Input/Base_Input.md new file mode 100644 index 0000000..493531e --- /dev/null +++ b/CallBack/Base_Input/Base_Input.md @@ -0,0 +1,42 @@ +# Base_Input 回调函数文档 + +**回调说明**: +`Base_Input`类用于处理游戏中的普通输入事件。 + +--- + +**注册方法**: +- `Base_InputFunc_Handle.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Base_InputFunc_Handle.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Base_InputFunc_Handle.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Base_InputFunc_Handle["Test"] <- Test_Function; +``` +or +```squirrel +Base_InputFunc_Handle.Test <- function (SUser, CmdString) +{ + print(CmdString); +}; +``` \ No newline at end of file diff --git a/CallBack/BossDie/BossDie.md b/CallBack/BossDie/BossDie.md new file mode 100644 index 0000000..3c53e42 --- /dev/null +++ b/CallBack/BossDie/BossDie.md @@ -0,0 +1,42 @@ +# BossDie 回调函数文档 + +**回调说明**: +`BossDie`类用于处理游戏中的BOSS死亡事件。 + +--- + +**注册方法**: +- `Cb_BossDie_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("副本通关"); +} +Cb_BossDie_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("副本通关"); +} +Cb_BossDie_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("副本通关"); +} +Cb_BossDie_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_BossDie_Func.Test <- function (SUser) +{ + print("副本通关"); +}; +``` \ No newline at end of file diff --git a/CallBack/BuyCeraShopItem/BuyCeraShopItem.md b/CallBack/BuyCeraShopItem/BuyCeraShopItem.md new file mode 100644 index 0000000..0ae48f0 --- /dev/null +++ b/CallBack/BuyCeraShopItem/BuyCeraShopItem.md @@ -0,0 +1,53 @@ +# BuyCeraShopItem 回调函数文档 + +**回调说明**: +`BuyCeraShopItem`类用于在服务端中持续锻造时的HOOK。 + +--- + +**注册方法**: +- `Cb_Dispatcher_BuyCeraShopItem_useCountDownCoinInFreeCoinDungeonFunc.rawset(Key,Function)` + +**参数**: +- `未知对象(C指针)` +- `角色对象` +- `被购买的道具对象` +- `原返回值` + +**特殊说明**: +- `如果返回值不为 -99 则返回你要返回的值` +- `在此回调中可以对Item对象进行修改操作,并且不需要调用Flush函数` + + +**例子**: + +```squirrel +function Test_Function(C_Point1,SUser,ItemObj,OldRet) +{ + return -99; +} +Cb_Dispatcher_BuyCeraShopItem_useCountDownCoinInFreeCoinDungeonFunc.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(C_Point1,SUser,ItemObj,OldRet) +{ + return -99; +} +Cb_Dispatcher_BuyCeraShopItem_useCountDownCoinInFreeCoinDungeonFunc.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(C_Point1,SUser,ItemObj,OldRet) +{ + return -99; +} +Cb_Dispatcher_BuyCeraShopItem_useCountDownCoinInFreeCoinDungeonFunc["Test"] <- Test_Function; +``` +or +```squirrel +Cb_Dispatcher_BuyCeraShopItem_useCountDownCoinInFreeCoinDungeonFunc.Test <- function (C_Point1,SUser,ItemObj,OldRet) +{ + return -99; +}; +``` \ No newline at end of file diff --git a/CallBack/CItemUpgrade_Separate/CItemUpgrade_Separate.md b/CallBack/CItemUpgrade_Separate/CItemUpgrade_Separate.md new file mode 100644 index 0000000..4f7d512 --- /dev/null +++ b/CallBack/CItemUpgrade_Separate/CItemUpgrade_Separate.md @@ -0,0 +1,54 @@ +# WongWork_CItemUpgrade_Separate 回调函数文档 + +**回调说明**: +`WongWork_CItemUpgrade_Separate`类用于在服务端中持续锻造时的HOOK。 + +--- + +**注册方法**: +- `Cb_WongWork_CItemUpgrade_Separate__DoProcUpgradeFunc.rawset(Key,Function)` + +**参数**: +- `锻造信息对象(C指针)` +- `角色对象` +- `被锻造的道具对象` +- `原返回值` +- `锻造信息对象(C指针)` + +**特殊说明**: +- `如果返回值不为 -99 则返回你要返回的值` +- `在此回调中可以对Item对象进行修改操作,并且不需要调用Flush函数` + + +**例子**: + +```squirrel +function Test_Function(CItemUpgrade_Separate,SUser,ItemObj,OldRet,STUpgradeInfo) +{ + return -99; +} +Cb_WongWork_CItemUpgrade_Separate__DoProcUpgradeFunc.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(CItemUpgrade_Separate,SUser,ItemObj,OldRet,STUpgradeInfo) +{ + return -99; +} +Cb_WongWork_CItemUpgrade_Separate__DoProcUpgradeFunc.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(CItemUpgrade_Separate,SUser,ItemObj,OldRet,STUpgradeInfo) +{ + return -99; +} +Cb_WongWork_CItemUpgrade_Separate__DoProcUpgradeFunc["Test"] <- Test_Function; +``` +or +```squirrel +Cb_WongWork_CItemUpgrade_Separate__DoProcUpgradeFunc.Test <- function (CItemUpgrade_Separate,SUser,ItemObj,OldRet,STUpgradeInfo) +{ + return -99; +}; +``` \ No newline at end of file diff --git a/CallBack/Chacter_Exit/Chacter_Exit.md b/CallBack/Chacter_Exit/Chacter_Exit.md new file mode 100644 index 0000000..11532b3 --- /dev/null +++ b/CallBack/Chacter_Exit/Chacter_Exit.md @@ -0,0 +1,42 @@ +# Chacter_Exit 回调函数文档 + +**回调说明**: +`Chacter_Exit`类用于处理游戏中的玩家退出事件。 + +--- + +**注册方法**: +- `Cb_player_exit_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("退出"); +} +Cb_player_exit_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("退出"); +} +Cb_player_exit_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("退出"); +} +Cb_player_exit_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_player_exit_Func.Test <- function (SUser) +{ + print("退出"); +}; +``` \ No newline at end of file diff --git a/CallBack/CheckMoveTown/CheckMoveTown.md b/CallBack/CheckMoveTown/CheckMoveTown.md new file mode 100644 index 0000000..9576eb5 --- /dev/null +++ b/CallBack/CheckMoveTown/CheckMoveTown.md @@ -0,0 +1,51 @@ +# CheckMoveTown 回调函数文档 + +**回调说明**: +`CheckMoveTown`类用于在服务端中持续执行的HOOK。 + +--- + +**注册方法**: +- `Cb_WongWork_CDungeonClear_getClearedDungeonDiffMap.rawset(Key,Function)` + +**参数**: +- `角色对象` +- `下一个城镇的ID` + +**特殊说明**: +- `如果返回值不为 -99 则不允许进入下一个城镇` +- `所有此类回调函数中只要有一个不满足-99条件即为失败` + + +**例子**: + +```squirrel +function Test_Function(SUser,NextVillageId) +{ + return -99; +} +Cb_WongWork_CDungeonClear_getClearedDungeonDiffMap.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser,NextVillageId) +{ + return -99; +} +Cb_WongWork_CDungeonClear_getClearedDungeonDiffMap.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser,NextVillageId) +{ + return -99; +} +Cb_WongWork_CDungeonClear_getClearedDungeonDiffMap["Test"] <- Test_Function; +``` +or +```squirrel +Cb_WongWork_CDungeonClear_getClearedDungeonDiffMap.Test <- function (SUser,NextVillageId) +{ + return -99; +}; +``` \ No newline at end of file diff --git a/CallBack/GetClearedDungeonDiff/GetClearedDungeonDiff.md b/CallBack/GetClearedDungeonDiff/GetClearedDungeonDiff.md new file mode 100644 index 0000000..777a7f7 --- /dev/null +++ b/CallBack/GetClearedDungeonDiff/GetClearedDungeonDiff.md @@ -0,0 +1,34 @@ +# GetClearedDungeonDiff 回调函数文档 + +**回调说明**: +`GetClearedDungeonDiff`类用于在服务端中更改对应副本是否已清除难度的回调。 + +--- + +**注册方法**: +- `Cb_WongWork_CDungeonClear_getClearedDungeonDiffFunc.rawset(副本ID(int),Diff(int))` + + +**参数**: +- `副本的ID` +- `需要返回的已通关难度值` + +**特殊说明**: +- `如果没有注册ID的副本将执行原来的逻辑` + +**例子**: + +```squirrel +Cb_WongWork_CDungeonClear_getClearedDungeonDiffFunc.rawset(1, 3); +``` +or +```squirrel +Cb_WongWork_CDungeonClear_getClearedDungeonDiffFunc[1] <- 3; +``` + +**级别**: +- `普通 冒险 王者 地狱` + +**注释**: +- `上面的例子是讲1号副本 也就是洛兰 无条件返回已通关难度为3 地狱级` + diff --git a/CallBack/GiveupDgn/GiveupDgn.md b/CallBack/GiveupDgn/GiveupDgn.md new file mode 100644 index 0000000..fde9227 --- /dev/null +++ b/CallBack/GiveupDgn/GiveupDgn.md @@ -0,0 +1,42 @@ +# GiveupDgn 回调函数文档 + +**回调说明**: +`GiveupDgn`类用于处理游戏中的放弃副本事件。 + +--- + +**注册方法**: +- `Cb_giveup_dgn_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("放弃副本"); +} +Cb_giveup_dgn_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("放弃副本"); +} +Cb_giveup_dgn_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("放弃副本"); +} +Cb_giveup_dgn_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_giveup_dgn_Func.Test <- function (SUser) +{ + print("放弃副本"); +}; +``` \ No newline at end of file diff --git a/CallBack/Gm_Input/Gm_Input.md b/CallBack/Gm_Input/Gm_Input.md new file mode 100644 index 0000000..b2d38b9 --- /dev/null +++ b/CallBack/Gm_Input/Gm_Input.md @@ -0,0 +1,42 @@ +# GM_Input 回调函数文档 + +**回调说明**: +`GM_Input`类用于处理游戏中的GM输入事件。 + +--- + +**注册方法**: +- `Gm_InputFunc_Handle.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Gm_InputFunc_Handle.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Gm_InputFunc_Handle.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser, CmdString) +{ + print(CmdString); +} +Gm_InputFunc_Handle["Test"] <- Test_Function; +``` +or +```squirrel +Gm_InputFunc_Handle.Test <- function (SUser, CmdString) +{ + print(CmdString); +}; +``` \ No newline at end of file diff --git a/CallBack/Player_Chanage_Equ/Player_Chanage_Equ.md b/CallBack/Player_Chanage_Equ/Player_Chanage_Equ.md new file mode 100644 index 0000000..0a0784c --- /dev/null +++ b/CallBack/Player_Chanage_Equ/Player_Chanage_Equ.md @@ -0,0 +1,42 @@ +# Player_Chanage_Equ 回调函数文档 + +**回调说明**: +`Player_Chanage_Equ`类用于处理游戏中的玩家更换装备事件。 + +--- + +**注册方法**: +- `Cb_player_chanage_equ_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("更换装备"); +} +Cb_player_chanage_equ_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("更换装备"); +} +Cb_player_chanage_equ_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("更换装备"); +} +Cb_player_chanage_equ_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_player_chanage_equ_Func.Test <- function (SUser) +{ + print("更换装备"); +}; +``` \ No newline at end of file diff --git a/CallBack/Reach_Game_World/Reach_Game_World.md b/CallBack/Reach_Game_World/Reach_Game_World.md new file mode 100644 index 0000000..95c64eb --- /dev/null +++ b/CallBack/Reach_Game_World/Reach_Game_World.md @@ -0,0 +1,42 @@ +# Reach_Game_World 回调函数文档 + +**回调说明**: +`Reach_Game_World`类用于处理游戏中的玩家上线事件。 + +--- + +**注册方法**: +- `Cb_reach_game_world_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("上线"); +} +Cb_reach_game_world_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("上线"); +} +Cb_reach_game_world_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("上线"); +} +Cb_reach_game_world_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_reach_game_world_Func.Test <- function (SUser) +{ + print("上线"); +}; +``` \ No newline at end of file diff --git a/CallBack/Return_SelectCharacter/Return_SelectCharacter.md b/CallBack/Return_SelectCharacter/Return_SelectCharacter.md new file mode 100644 index 0000000..c7fba90 --- /dev/null +++ b/CallBack/Return_SelectCharacter/Return_SelectCharacter.md @@ -0,0 +1,42 @@ +# Return_SelectCharacter 回调函数文档 + +**回调说明**: +`Return_SelectCharacter`类用于处理游戏中的玩家返回选择角色事件。 + +--- + +**注册方法**: +- `Cb_return_select_character_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function(SUser) +{ + print("选择角色"); +} +Cb_return_select_character_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser) +{ + print("选择角色"); +} +Cb_return_select_character_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser) +{ + print("选择角色"); +} +Cb_return_select_character_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_return_select_character_Func.Test <- function (SUser) +{ + print("选择角色"); +}; +``` \ No newline at end of file diff --git a/CallBack/Timer_Dispatch/Timer_Dispatch.md b/CallBack/Timer_Dispatch/Timer_Dispatch.md new file mode 100644 index 0000000..60fb97e --- /dev/null +++ b/CallBack/Timer_Dispatch/Timer_Dispatch.md @@ -0,0 +1,42 @@ +# Timer_Dispatch 回调函数文档 + +**回调说明**: +`Timer_Dispatch`类用于在服务端中持续执行的HOOK。 + +--- + +**注册方法**: +- `Cb_timer_dispatch_Func.rawset(Key,Function)` + +**例子**: + +```squirrel +function Test_Function() +{ + print(Clock()); +} +Cb_timer_dispatch_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function() +{ + print(Clock()); +} +Cb_timer_dispatch_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function() +{ + print(Clock()); +} +Cb_timer_dispatch_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_timer_dispatch_Func.Test <- function () +{ + print(Clock()); +}; +``` \ No newline at end of file diff --git a/CallBack/Use_Item_Sp/Use_Item_Sp.md b/CallBack/Use_Item_Sp/Use_Item_Sp.md new file mode 100644 index 0000000..d742889 --- /dev/null +++ b/CallBack/Use_Item_Sp/Use_Item_Sp.md @@ -0,0 +1,48 @@ +# Use_Item_Sp 回调函数文档 + +**回调说明**: +`Use_Item_Sp`类用于处理游戏中的玩家使用特殊道具事件。 + +--- + +**注册方法**: +- `Cb_Use_Item_Sp_Func.rawset(Key,Function)` +**注意事项**: +- `此函数有返回值如果返回false 则本次使用道具不在执行原逻辑` + +**例子**: + +```squirrel +function Test_Function(SUser, ItemId) +{ + print(”使用道具“); + return true; +} +Cb_Use_Item_Sp_Func.rawset("Test", Test_Function); +``` +or +```squirrel +function Test_Function(SUser, ItemId) +{ + print(”使用道具“); + return true; +} +Cb_Use_Item_Sp_Func.Test <- Test_Function; +``` +or +```squirrel +function Test_Function(SUser, ItemId) +{ + print(”使用道具“); + return true; +} +Cb_Use_Item_Sp_Func["Test"] <- Test_Function; +``` +or +```squirrel +Cb_Use_Item_Sp_Func.Test <- function (SUser, ItemId) +{ + print(”使用道具“); + return true; +}; +``` \ No newline at end of file diff --git a/Contributor/Contributor.md b/Contributor/Contributor.md new file mode 100644 index 0000000..47fe521 --- /dev/null +++ b/Contributor/Contributor.md @@ -0,0 +1,14 @@ +# 人员清单 +--- + +### 开发者: 倾泪寒 +### 维护者: 倾泪寒 + +--- + +# 贡献者 + +--- + +### 邪神 +### Davi(Mysql连接基础套件) \ No newline at end of file diff --git a/HotLoadScript/HotLoadScript.md b/HotLoadScript/HotLoadScript.md new file mode 100644 index 0000000..2e9b43f --- /dev/null +++ b/HotLoadScript/HotLoadScript.md @@ -0,0 +1,39 @@ +# HotReload 文档 + +**说明**: +`HotReload`使你能够不重启服务端程序,来迭代你最新的脚本代码 + +--- + +> 首先我们确定我们自己的热更方式 我个人比较喜欢实用 热更脚本 + 指令触发配合使用 + +> 第一步我们建立热更脚本文件 + + + +> 并在热更脚本中写入我们需要更新的脚本 + + + +> 现在需要给热更脚本挂载在触发方式上 这里我们选择用Gm输入来挂载 这段代码可以直接复制到你的Main.nut中 也可以单独建立一个脚本文件 挂载在Gm输入上 + +``` +Gm_InputFunc_Handle.ResetScript <- function(SUser, CmdString) { + sq_RunScript("HotReloadScript.nut"); +}; +``` + + + +> 就是如此简单就可以在游戏中输入 //ResetScript 来重载我们的设定的脚本了 如果角色打字麻烦可以设定一个快捷键 + + + +> 当然其他触发方式也是支持的 你也可以在持续执行的回调函数中以特殊方式判断重载 + +--- +--- +**温馨提示**: +我本人不建议你重载全部的脚本 因为如果你写了全局变量没有做特殊处理会导致你的数据混乱 最好是在你可控的范围内进行热重载 如果执意需要全部重载 请等待后续更新开发API 获取文件夹全部文件 +--- +--- \ No newline at end of file diff --git a/Object/AccountCargo/AccountCargo.md b/Object/AccountCargo/AccountCargo.md new file mode 100644 index 0000000..1cb6422 --- /dev/null +++ b/Object/AccountCargo/AccountCargo.md @@ -0,0 +1,32 @@ +# AccountCargo 类函数文档 + +**类说明**: +`AccountCargo`类用于表示游戏中的账号金库的各种属性和操作方法。 + +--- + +## 二、GetEmptySlot 函数 +### 函数签名 +- `function GetEmptySlot()` +### 返回值 +- 整数,表示空格子的槽位。 +### 说明 +获取获取空格子。 + +--- + +## 三、InsertItem 函数 +### 函数签名 +- `function InsertItem()` +### 说明 +存储物品。 + +--- + +## 四、SendItemList 函数 +### 函数签名 +- `function SendItemList()` +### 返回值 +- 整数,Flag。 +### 说明 +刷新列表。 \ No newline at end of file diff --git a/Object/AdMsg/AdMsg.md b/Object/AdMsg/AdMsg.md new file mode 100644 index 0000000..fbf0346 --- /dev/null +++ b/Object/AdMsg/AdMsg.md @@ -0,0 +1,109 @@ +# AdMsg 类函数文档 + +**类说明**: +`AdMsg`类为高级信息类,可以便捷的构造出高级信息的Pack包。 + + + +--- + +### 函数签名 +**构造函数**: +- `AdMsg()` + +--- + +### 函数签名 +**私有函数**: +- `function PutType(Type)` +### 功能 +- `设定消息包的类型` +### 参数 +- `Type`:消息类型 + +--- +### 函数签名 +**私有函数**: +- `function PutString(String)` +### 功能 +- `将字符串放入消息中` +### 参数 +- `String`:字符串 + + +--- +### 函数签名 +**私有函数**: +- `function PutColorString(String,ColorArr)` +### 功能 +- `将带有颜色信息的字符串放入消息中` +### 参数 +- `String`:字符串消息 +- `ColorArr`:颜色信息数组 + + + +--- +### 函数签名 +**私有函数**: +- `function PutImoticon(Index)` +### 功能 +- `将表情信息放入消息中` +### 参数 +- `Index`:pvf中标签的编号 + +--- +### 函数签名 +**私有函数**: +- `function PutEquipment(...)` +### 功能 +- `将装备信息放入消息中(该函数为重载函数)` +### 参数 +- `EquObj`:装备对象 +### 参数 +- `Name`:自己提供的装备名字 +- `EquObj`:装备对象 +- `ColorArr`:自己提供的名字颜色数组 + + +--- +### 函数签名 +**私有函数**: +- `function Finalize()` +### 功能 +- `完成高级信息的构造` + +--- +### 函数签名 +**私有函数**: +- `function MakePack()` +### 功能 +- `创建Pack包` + +--- +### 函数签名 +**私有函数**: +- `function Delete()` +### 功能 +- `销毁Pack包` + + +**下面给出一个例子**: +--- +``` + local SUser = World.GetUserByUid(1); + local InvenObj = SUser.GetInven(); + local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 56); + + local AdMsgObj = AdMsg(); + AdMsgObj.PutType(14); + AdMsgObj.PutString("测试文字"); + AdMsgObj.PutColorString("测试文字", [255, 85, 0]); + AdMsgObj.PutImoticon(2); + AdMsgObj.PutEquipment("主动提供名字", EquObj, [255, 85, 0]); + AdMsgObj.PutEquipment(EquObj); + AdMsgObj.Finalize(); + + SUser.Send(AdMsgObj.MakePack()); + AdMsgObj.Delete(); +``` \ No newline at end of file diff --git a/Object/Dungeon/Dungeon.md b/Object/Dungeon/Dungeon.md new file mode 100644 index 0000000..65f9990 --- /dev/null +++ b/Object/Dungeon/Dungeon.md @@ -0,0 +1,34 @@ +# Dungeon 类函数文档 + +**类说明**: +`Dungeon`类用于表示游戏中的副本对象,包含副本的各种属性和操作方法。 + +--- + +## 二、GetId 函数 +### 函数签名 +- `function GetId()` +### 返回值 +- 整数,表示副本的 ID。 +### 说明 +获取副本的 ID。 + +--- + +## 三、GetName 函数 +### 函数签名 +- `function GetName()` +### 返回值 +- 字符串,表示副本的名称。 +### 说明 +获取副本的名称。 + +--- + +## 四、GetMinLevel 函数 +### 函数签名 +- `function GetMinLevel()` +### 返回值 +- 整数,表示副本的最低等级要求。 +### 说明 +获取副本的最低等级要求。 \ No newline at end of file diff --git a/Object/GameManager/GameManager.md b/Object/GameManager/GameManager.md new file mode 100644 index 0000000..6a3cc35 --- /dev/null +++ b/Object/GameManager/GameManager.md @@ -0,0 +1,86 @@ +# GameManager 类函数文档 + +**类说明**: +`GameManager`类用于表示游戏中管理对象的各种属性和操作方法。 + +--- +## 一、设置服务器最大等级 +### 函数签名 +- `function SetGameMaxLevel(MaxLevel)` +### 参数 +- `MaxLevel`:整数,最大等级 + +--- +## 二、设置装备解锁需要时间 +### 函数签名 +- `function SetItemLockTime(time)` +### 参数 +- `MaxLevel`:整数,时间(秒) DNF内置角色轮询有时间差 所以即使设定为0他也等到本次轮询才会解锁 这个过程不会超过30秒 + +--- +## 三、开启创建鼠标妹 +### 函数签名 +- `function OpenCreateJob_CreatorMage()` +--- +## 四、开启获得魔法封印时自动解除魔法封印 +### 函数签名 +- `function OpenRandomAutomaticUnblocking()` +--- + +## 五、开启自动热重载 +### 函数签名 +- `function OpenHotFix(Path = "/dp_s/MyProject")` +### 参数 +- `Path`:不写默认/dp_s/MyProject 写可以自定义重载目录 +--- + +## 六、开启装备与时装镶嵌 +### 函数签名 +- `function FixEquipUseJewel()` +--- + +## 七、修复下线卡城镇 +### 函数签名 +- `function FixSaveTown()` +--- + + +## 八、修复绝望之塔金币异常 +### 函数签名 +- `function FixDespairGold()` +--- + + + +## 九、修复绝望之塔通关后可以用门票继续进入 +### 函数签名 +- `function FixDespairDungeon()` +--- + + + + +## 十、修改交易金币上限 +### 函数签名 +- `function FixGlodTradeDaily(Count)` +--- + + + + + +## 十一、+13免刷新 +### 函数签名 +- `function Fix_13Upgrade()` +--- + + + + + + +## 十二、修复14技能 +### 函数签名 +- `function Fix14Skill()` +--- + diff --git a/Object/Http/Http.md b/Object/Http/Http.md new file mode 100644 index 0000000..21e073f --- /dev/null +++ b/Object/Http/Http.md @@ -0,0 +1,44 @@ +# Http 类函数文档 + +**类说明**: +`Http`类为Http请求相关操作(注意将会阻塞线程)。 + + + + + +**懒得写文档 直接放出使用说明**: + +--- + +``` + //公有方法 获取本机IP + local MyIp = Http.GetMyIp(); + print(MyIp); + + //私有方法 发送Get请求 + local SO = Http("www.baidu.com"); + local BaiduBody = SO.Get("/"); + print(BaiduBody); + + //私有方法 发送带参数的Post请求 + local SO = Http("192.168.200.189","1311"); + local Res = SO.Post("/",{username = "lenheart", password = "123456"}); + + //创建一个Http Server + local HS = HttpServer("0.0.0.0","41817"); + HS.Listen(function (SocketObject,Msg) + { + print("收到请求内容: " + Msg); + + //回复字符串 + //SocketObject.Write("hello world"); + //回复Json 直接Write Table就是Json + SocketObject.Write({ + user = "lenheart", + msg = "hello world" + }); + }); + +``` +--- \ No newline at end of file diff --git a/Object/IO/IO.md b/Object/IO/IO.md new file mode 100644 index 0000000..a2ff182 --- /dev/null +++ b/Object/IO/IO.md @@ -0,0 +1,21 @@ +# IO 类函数文档 + +**类说明**: +`IO`类为文件流泪。 + +**注意事项**: +进阶操作,不提供说明,请确保自身有足够的能力编写,与群内其他开发者或群主沟通使用 +--- + +- `constructor(FileName, Modes)` + +- `function ReadLine()` + +- `function Read() ` + +- `function ReadBuffer(size)` + +- `function Write(Str)` + +- `function Close()` +--- diff --git a/Object/Inven/Inven.md b/Object/Inven/Inven.md new file mode 100644 index 0000000..1bfca6c --- /dev/null +++ b/Object/Inven/Inven.md @@ -0,0 +1,97 @@ +# Inven 类函数文档 + +**类说明**: +`Inven`类用于表示游戏中的背包对象,提供了各种与背包操作相关的方法。 + +## 一、静态变量 +### INVENTORY_TYPE_BODY +- 值为 0,表示身上穿的装备(0 - 26)。 +### INVENTORY_TYPE_ITEM +- 值为 1,表示物品栏(0 - 311)。 +### INVENTORY_TYPE_AVARTAR +- 值为 2,表示时装栏(0 - 104)。 +### INVENTORY_TYPE_CREATURE +- 值为 3,表示宠物装备(0 - 241)。 + +--- + +## 三、GetSlot 函数 +### 函数签名 +- `function GetSlot(Type, Slot)` +### 参数 +- `Type`:整数,表示背包类型。 +- `Slot`:整数,表示背包槽位。 +### 返回值 +- `Item`对象或`null`,表示对应槽位的道具对象,如果槽位为空则返回`null`。 +### 说明 +根据指定的背包类型和槽位获取背包中的道具对象。 + +--- + +## 四、GetSlotById 函数 +### 函数签名 +- `function GetSlotById(Idx)` +### 参数 +- `Idx`:整数,表示道具的 ID。 +### 返回值 +- 整数,表示对应道具在背包中的槽位,如果未找到则返回 -1。 +### 说明 +通过道具的 ID 获取其在背包中的槽位。 + +--- + +## 五、GetMoney 函数 +### 函数签名 +- `function GetMoney()` +### 返回值 +- 整数,表示背包中的金币数量。 +### 说明 +获取背包中的金币数量。 + +--- + +## 六、CheckItemCount 函数 +### 函数签名 +- `function CheckItemCount(ItemId, ItemCount)` +### 参数 +- `ItemId`:整数,表示道具的 ID。 +- `ItemCount`:整数,表示要检查的道具数量。 +### 返回值 +- 布尔值,如果背包中拥有指定数量的指定道具则返回`true`,否则返回`false`。 +### 说明 +检查背包中是否拥有指定数量的指定道具,包括点券、代币券和金币的特殊处理。 + +--- + +## 七、CheckArrItemCount 函数 +### 函数签名 +- `function CheckArrItemCount(T)` +### 参数 +- `T`:包含道具 ID 和数量的对象数组。 +### 返回值 +- 布尔值,如果背包中拥有指定表中的所有道具及数量则返回`true`,否则返回`false`。 +### 说明 +检查背包中是否拥有指定表中的所有道具及对应的数量。 + +--- + +## 八、DeleteArrItemCount 函数 +### 函数签名 +- `function DeleteArrItemCount(T)` +### 参数 +- `T`:包含道具 ID 和数量的对象数组。 +### 说明 +销毁背包中指定表中的所有道具及对应的数量,并更新背包信息。 + +--- + +## 九、DeleteItemCount 函数 +### 函数签名 +- `function DeleteItemCount(Id, Count)` +### 参数 +- `Id`:整数,表示道具的 ID。 +- `Count`:整数,表示要销毁的道具数量。 +### 返回值 +- 布尔值,如果成功销毁指定数量的道具则返回`true`,否则返回`false`。 +### 说明 +销毁背包中指定数量的指定道具,并更新背包信息,包括对点券、代币券和金币的特殊处理。 \ No newline at end of file diff --git a/Object/Item/Item.md b/Object/Item/Item.md new file mode 100644 index 0000000..0f328b4 --- /dev/null +++ b/Object/Item/Item.md @@ -0,0 +1,201 @@ +# Item 类函数文档 + +**类说明**: +`Item`类用于表示游戏中的道具对象,包含各种属性和操作方法。 + +--- + +## 二、Output 函数 +### 函数签名 +- `function Output()` +### 说明 +将道具的属性数据转换为字符串并输出。遍历`Attribute`中的每个值,将其转换为十六进制格式并拼接成字符串,最后打印输出。 + +--- + +## 三、GetType 函数 +### 函数签名 +- `function GetType()` +### 返回值 +- 字符串,表示道具的类型。 +### 说明 +根据道具属性中的类型值返回对应的道具类型描述,包括“装备”“消耗品”“材料”“任务材料”“副职业材料”等。 + +--- + +## 四、GetIndex 函数 +### 函数签名 +- `function GetIndex()` +### 返回值 +- 整数,表示道具的编号。 +### 说明 +从道具属性数据中读取道具的编号。 + +--- + +## 五、SetIndex 函数 +### 函数签名 +- `function SetIndex(Index)` +### 参数 +- `Index`:整数,表示要设置的道具编号。 +### 说明 +在道具属性数据中设置道具的编号。 + +--- + +## 六、GetUpgrade 函数 +### 函数签名 +- `function GetUpgrade()` +### 返回值 +- 整数,表示道具的强化等级。 +### 说明 +从道具属性数据中读取道具的强化等级。 + +--- + +## 七、SetUpgrade 函数 +### 函数签名 +- `function SetUpgrade(Level)` +### 参数 +- `Level`:整数,表示要设置的强化等级。 +### 说明 +在道具属性数据中设置道具的强化等级。 + +--- + +## 八、GetAdd_Info 函数 +### 函数签名 +- `function GetAdd_Info()` +### 返回值 +- 整数,表示道具的品级或数量。 +### 说明 +如果是装备,则返回品级;如果是其他类型道具,则返回数量。 + +--- + +## 九、SetAdd_Info 函数 +### 函数签名 +- `function SetAdd_Info(Value)` +### 参数 +- `Value`:整数,表示要设置的品级或数量。 +### 说明 +如果是装备,则设置品级;如果是其他类型道具,则设置数量。 + +--- + +## 十、GetDurable 函数 +### 函数签名 +- `function GetDurable()` +### 返回值 +- 整数,表示道具的耐久度。 +### 说明 +从道具属性数据中读取道具的耐久度。 + +--- + +## 十一、SetDurable 函数 +### 函数签名 +- `function SetDurable(Value)` +### 参数 +- `Value`:整数,表示要设置的耐久度。 +### 说明 +在道具属性数据中设置道具的耐久度。 + +--- + +## 十二、GetAmplification 函数 +### 函数签名 +- `function GetAmplification()` +### 返回值 +- 整数,表示道具的增幅属性。 +### 说明 +从道具属性数据中读取道具的增幅属性。 + +--- + +## 十三、SetAmplification 函数 +### 函数签名 +- `function SetAmplification(Value)` +### 参数 +- `Value`:整数,表示要设置的增幅属性。 +### 说明 +在道具属性数据中设置道具的增幅属性。 + +--- + +## 十四、GetForging 函数 +### 函数签名 +- `function GetForging()` +### 返回值 +- 整数,表示道具的锻造属性。 +### 说明 +从道具属性数据中读取道具的锻造属性。 + +--- + +## 十五、SetForging 函数 +### 函数签名 +- `function SetForging(Value)` +### 参数 +- `Value`:整数,表示要设置的锻造属性。 +### 说明 +在道具属性数据中设置道具的锻造属性。 + +--- + +## 十六、GetEnchanting 函数 +### 函数签名 +- `function GetEnchanting()` +### 返回值 +- 整数,表示道具的附魔属性。 +### 说明 +从道具属性数据中读取道具的附魔属性。 + +--- + +## 十七、SetEnchanting 函数 +### 函数签名 +- `function SetEnchanting(Value)` +### 参数 +- `Value`:整数,表示要设置的附魔属性。 +### 说明 +在道具属性数据中设置道具的附魔属性。 + +--- + +## 十八、Flush 函数 +### 函数签名 +- `function Flush()` +### 说明 +将道具的属性数据`Attribute`刷写到对应的内存地址中。 + +--- + +## 十九、Delete 函数 +### 函数签名 +- `function Delete()` +### 说明 +删除道具,调用相关函数移除道具,并将当前对象设为`null`。 +--- + +## 十九、GetRarity 函数 +### 函数签名 +- `function GetRarity()` +### 说明 +获取品级 + +--- + +## 十九、GetAttachType 函数 +### 函数签名 +- `function GetAttachType()` +### 说明 +获取交易类型 + +--- + +## 十九、IsPackagble 函数 +### 函数签名 +- `function IsPackagble()` +### 说明 +//是否可打包 \ No newline at end of file diff --git a/Object/Log/Log.md b/Object/Log/Log.md new file mode 100644 index 0000000..a488712 --- /dev/null +++ b/Object/Log/Log.md @@ -0,0 +1,36 @@ +# Log 类函数文档 + +**类说明**: +`Log`类为日志相关操作,在使用前请先在sqr_main中初始化。 + +``` + //初始化日志器 + Log({ + "normal": "/dp_s/log/normal.log", + "error": "/dp_s/log/error.log" + }); +``` + + + +--- + +### 函数签名 +**公有函数**: +- `function Put(Type,Msg)` +### 参数 +- `Type`:日志类型 +- `Msg`:日志字符串 + + +**这里给出一个例子**: + +--- + +``` + Log.Put("normal", "测试日志"); + Log.Put("error", "测试错误日志"); +``` +--- + +--- diff --git a/Object/MD5/MD5.md b/Object/MD5/MD5.md new file mode 100644 index 0000000..ee2d374 --- /dev/null +++ b/Object/MD5/MD5.md @@ -0,0 +1,17 @@ +# MD5 类函数文档 + +**类说明**: +`MD5`类为获取MD5相关操作。 + + +--- + +### 函数签名 +**公有函数**: +- `function GetFile(FileName)` +### 参数 +- `FileName`:字符串,要获取MD5的文件路径 +### 返回值 +- string类型。 + +--- diff --git a/Object/Math/Math.md b/Object/Math/Math.md new file mode 100644 index 0000000..5394042 --- /dev/null +++ b/Object/Math/Math.md @@ -0,0 +1,282 @@ +# MathClass 类函数文档 + +## 一、getDirectionToTargetX 函数 +### 函数签名 +- `function getDirectionToTargetX(objX, x)` +### 参数 +- `objX`:整数,表示对象的 X 坐标 +- `x`:整数,表示目标 X 坐标 +### 返回值 +- 如果 `objX` 大于 `x`,返回 0;否则返回 1。 + +--- + +## 二、Rand 函数 +### 函数签名 +- `function Rand(Min, Max)` +### 参数 +- `Min`:整数,表示随机数的最小值 +- `Max`:整数,表示随机数的最大值(左闭右开区间) +### 返回值 +- 一个在 `Min` 和 `Max` 之间的随机整数。 + +--- + +## 三、getCollisionByObjBox 函数 +### 函数签名 +- `function getCollisionByObjBox(obj, box)` +### 参数 +- `obj`:对象,包含 `X`、`Y`、`Z` 属性 +- `box`:数组,表示碰撞盒的参数 +### 返回值 +- 数组,包含碰撞盒的两个顶点坐标。 + +--- + +## 四、GetDistancePos 函数 +### 函数签名 +- `function GetDistancePos(startX, direction, offsetX)` +### 参数 +- `startX`:整数,表示起始 X 坐标 +- `direction`:整数,表示方向(0 或 1) +- `offsetX`:整数,表示偏移量 +### 返回值 +- 根据方向计算得到的新的 X 坐标。 + +--- + +## 五、getRorateAngleByCurrentPos 函数 +### 函数签名 +- `function getRorateAngleByCurrentPos(x1, y1, z1, x2, y2, z2)` +### 参数 +- `x1`、`y1`、`z1`:整数,表示第一个点的坐标 +- `x2`、`y2`、`z2`:整数,表示第二个点的坐标 +### 返回值 +- 目前总是返回 0。 + +--- + +## 六、sq_BParabola 函数 +### 函数签名 +- `function sq_BParabola(currentT, maxT, initZPos, jumpHeight, lastZPos)` +### 参数 +- `currentT`:整数,表示当前时间 +- `maxT`:整数,表示最大时间 +- `initZPos`:整数,表示初始 Z 坐标 +- `jumpHeight`:整数,表示跳跃高度 +- `lastZPos`:整数,表示最终 Z 坐标 +### 返回值 +- 通过贝塞尔曲线计算得到的 Z 坐标,整数类型。 + +--- + +## 七、sq_Parabola 函数 +### 函数签名 +- `function sq_Parabola(x, b, c)` +### 参数 +- `x`:整数,表示自变量 +- `b`:整数,表示抛物线参数 +- `c`:整数,表示抛物线参数 +### 返回值 +- 通过抛物线公式计算得到的值,浮点数类型。 + +--- + +## 八、Get2D_Distance 函数 +### 函数签名 +- `function Get2D_Distance(x1, y1, x2, y2)` +### 参数 +- `x1`、`y1`:整数,表示第一个点的坐标 +- `x2`、`y2`:整数,表示第二个点的坐标 +### 返回值 +- 两个点之间的平面距离,浮点数类型。 + +--- + +## 九、CheckAngleIsInArea 函数 +### 函数签名 +- `function CheckAngleIsInArea(judge, startA, endA)` +### 参数 +- `judge`:整数,表示要判断的角度 +- `startA`:整数,表示起始角度 +- `endA`:整数,表示结束角度 +### 返回值 +- 如果 `judge` 在 `startA` 和 `endA` 形成的锐角内,返回 `true`;否则返回 `false`。 + +--- + +## 十、toDegree 函数 +### 函数签名 +- `function toDegree(x)` +### 参数 +- `x`:浮点数,表示弧度值 +### 返回值 +- 弧度值转换为角度值,浮点数类型。 + +--- + +## 十一、toRadian 函数 +### 函数签名 +- `function toRadian(x)` +### 参数 +- `x`:浮点数,表示角度值 +### 返回值 +- 角度值转换为弧度值,浮点数类型。 + +--- + +## 十二、CubeAndCubeCollection 函数 +### 函数签名 +- `function CubeAndCubeCollection(c1StartX, c1StartY, c1StartZ, c1EndX, c1EndY, c1EndZ, c2StartX, c2StartY, c2StartZ, c2EndX, c2EndY, c2EndZ)` +### 参数 +- `c1StartX`、`c1StartY`、`c1StartZ`:整数,表示第一个立方体的起始坐标 +- `c1EndX`、`c1EndY`、`c1EndZ`:整数,表示第一个立方体的结束坐标 +- `c2StartX`、`c2StartY`、`c2StartZ`:整数,表示第二个立方体的起始坐标 +- `c2EndX`、`c2EndY`、`c2EndZ`:整数,表示第二个立方体的结束坐标 +### 返回值 +- 如果两个立方体有碰撞,返回 `true`;否则返回 `false`。 + +--- + +## 十三、pointIsInCubeArea 函数 +### 函数签名 +- `function pointIsInCubeArea(px, py, pz, startX, startY, startZ, endX, endY, endZ)` +### 参数 +- `px`、`py`、`pz`:整数,表示要判断的点的坐标 +- `startX`、`startY`、`startZ`:整数,表示立方体的起始坐标 +- `endX`、`endY`、`endZ`:整数,表示立方体的结束坐标 +### 返回值 +- 如果点在立方体内,返回 `true`;否则返回 `false`。 + +--- + +## 十四、pointIsIn4PointArea 函数 +### 函数签名 +- `function pointIsIn4PointArea(px, py, x1, y1, x2, y2, x3, y3, x4, y4)` +### 参数 +- `px`、`py`:整数,表示要判断的点的坐标 +- `x1`、`y1`、`x2`、`y2`、`x3`、`y3`、`x4`、`y4`:整数,表示四边形的四个顶点坐标 +### 返回值 +- 如果点在四边形内,返回 `true`;否则返回 `false`。 + +--- + +## 十五、get4PointArea 函数 +### 函数签名 +- `function get4PointArea(x1, y1, x2, y2, x3, y3, x4, y4)` +### 参数 +- `x1`、`y1`、`x2`、`y2`、`x3`、`y3`、`x4`、`y4`:整数,表示四边形的四个顶点坐标 +### 返回值 +- 四边形的面积,浮点数类型。 + +--- + +## 十六、get3PointArea 函数 +### 函数签名 +- `function get3PointArea(x1, y1, x2, y2, x3, y3)` +### 参数 +- `x1`、`y1`、`x2`、`y2`、`x3`、`y3`:整数,表示三角形的三个顶点坐标 +### 返回值 +- 三角形的面积,浮点数类型。 + +--- + +## 十七、getSign 函数 +### 函数签名 +- `function getSign(var)` +### 参数 +- `var`:整数,表示要判断符号的数 +### 返回值 +- 如果 `var` 小于 0,返回 1;如果 `var` 大于 0,返回 -1;如果 `var` 等于 0,返回 0。 + +--- + +## 十八、sqrt 函数 +### 函数签名 +- `function sqrt(sum)` +### 参数 +- `sum`:浮点数,表示要开平方的数 +### 返回值 +- `sum` 的平方根,浮点数类型。 + +--- + +## 十九、Round 函数 +### 函数签名 +- `function Round(var)` +### 参数 +- `var`:浮点数,表示要四舍五入的数 +### 返回值 +- 对 `var` 进行四舍五入后的结果,整数类型。 + +--- + +## 二十、getUniformVelocity 函数 +### 函数签名 +- `function getUniformVelocity(sv, ev, currentRate, maxRate)` +### 参数 +- `sv`:浮点数,表示起始值 +- `ev`:浮点数,表示结束值 +- `currentRate`:整数,表示当前速率 +- `maxRate`:整数,表示最大速率 +### 返回值 +- 根据当前速率和最大速率计算得到的在 `sv` 和 `ev` 之间的值,浮点数类型。 + +--- + +## 二十一、sq_GetAccel 函数 +### 函数签名 +- `function sq_GetAccel(sv, ev, currentRate, maxRate, increaseFeature)` +### 参数 +- `sv`:浮点数,表示起始值 +- `ev`:浮点数,表示结束值 +- `currentRate`:整数,表示当前速率 +- `maxRate`:整数,表示最大速率 +- `increaseFeature`:布尔值,表示加速度的特征 +### 返回值 +- 根据当前速率、最大速率和加速度特征计算得到的在 `sv` 和 `ev` 之间的值,浮点数类型。 + +--- + +## 二十二、getMax 函数 +### 函数签名 +- `function getMax(a, b)` +### 参数 +- `a`、`b`:整数,表示要比较的两个数 +### 返回值 +- `a` 和 `b` 中的较大值。 + +--- + +## 二十三、getMin 函数 +### 函数签名 +- `function getMin(a, b)` +### 参数 +- `a`、`b`:整数,表示要比较的两个数 +### 返回值 +- `a` 和 `b` 中的较小值。 + +--- + +## 二十四、getBeizeri 函数 +### 函数签名 +- `function getBeizeri(var1, var2, p0, p1, p2, p3)` +### 参数 +- `var1`、`var2`:整数,表示贝塞尔曲线的参数 +- `p0`、`p1`、`p2`、`p3`:浮点数,表示贝塞尔曲线的控制点 +### 返回值 +- 通过贝塞尔曲线公式计算得到的值,浮点数类型。 + +--- + +## 二十五、getBeizeriAngle 函数 +### 函数签名 +- `function getBeizeriAngle(var1, var2, p0, p1, p2, p3)` +### 参数 +- `var1`、`var2`:整数,表示贝塞尔曲线的参数 +- `p0`、`p1`、`p2`、`p3`:浮点数,表示贝塞尔曲线的控制点 +### 返回值 +- 通过贝塞尔曲线公式计算得到的角度值,浮点数类型。 + + +--- diff --git a/Object/Memory/Memory.md b/Object/Memory/Memory.md new file mode 100644 index 0000000..fddd379 --- /dev/null +++ b/Object/Memory/Memory.md @@ -0,0 +1,26 @@ +# Memory 类函数文档 + +**类说明**: +`Memory`类用于服务端内存操作方法。 + +--- + +## 一、alloc 函数 +### 函数签名 +- `function alloc(Size)` +### 返回值 +- NativePointer。 +### 说明 +申请一块指定大小的内存。 + +--- + +## 二、allocUtf8String 函数 +### 函数签名 +- `function allocUtf8String(Str)` +### 返回值 +- NativePointer。 +### 说明 +将字符串转换为内存空间的字符串指针(注意 此内存不可修改)。 + +--- diff --git a/Object/Mysql/Mysql.md b/Object/Mysql/Mysql.md new file mode 100644 index 0000000..62a69cc --- /dev/null +++ b/Object/Mysql/Mysql.md @@ -0,0 +1,39 @@ +# MYSQL 类函数文档 + +**类说明**: +`MYSQL`类为服务端数据库相关操作。 + + + +--- +**本类为单例类逻辑相关不易描述请直接模仿示例**: +### 示例 + +> 请在你的 sqr_main() 函数中初始化数据库连接池 +``` + local PoolObj = MysqlPool.GetInstance(); + PoolObj.SetBaseConfiguration("127.0.0.1", 3306, "game", "uu5!^%jg"); + //连接池编码 默认为latin1 如果有需求可更改为 utf8之类的 + //PoolObj.Charset = "latin1"; + //连接池大小 + PoolObj.PoolSize = 10; + //初始化 + PoolObj.Init(); +``` + +> 然后你可以在任何地方调用连接池获取连接 进行数据库操作 +``` + //查询的sql语句 + local sql = "SELECT m_id,charac_name,lev,village,job,exp,Hp FROM charac_info WHERE charac_no = 1;"; + //查询的元素类型,按sql中的顺序 + local column_type_list = ["int", "string", "int", "int", "int", "int", "int"]; + //从连接池中获取一个空闲连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + local result = SqlObj.Select(sql, column_type_list); + + printT(result); + + //使用完成后请将连接放回连接池 + MysqlPool.GetInstance().PutConnect(SqlObj); +``` +--- diff --git a/Object/NativePointer/NativePointer.md b/Object/NativePointer/NativePointer.md new file mode 100644 index 0000000..8562cd8 --- /dev/null +++ b/Object/NativePointer/NativePointer.md @@ -0,0 +1,70 @@ +# NativePointer 类函数文档 + +**类说明**: +`NativePointer`类为服务端Native层内存对象。 + +**注意事项**: +进阶操作,不提供说明,请确保自身有足够的能力编写,与群内其他开发者或群主沟通使用 +--- + +- `function add(intoffset)` + +- `function sub(intoffset)` + +- `function writeByteArray(arr)` + +- `function readByteArray(size)` + +- `function writeS8(value)` + +- `function writeU8(value)` + +- `function writeS16(value)` + +- `function writeU16(value)` + +- `function writeS32(value)` + +- `function writeU32(value)` + +- `function writeShort(value)` + +- `function writeUShort(value)` + +- `function writeInt(value)` + +- `function writeUInt(value)` + +- `function writeFloat(value)` + +- `function writeDouble(value)` + +- `function readS8()` + +- `function readU8()` + +- `function readS16()` + +- `function readU16()` + +- `function readS32()` + +- `function readU32()` + +- `function readShort()` + +- `function readUShort()` + +- `function readInt()` + +- `function readUInt()` + +- `function readFloat()` + +- `function readDouble()` + +- `function readUtf8String(...)` + +- `function readPointer()` + +--- diff --git a/Object/Pack/Pack.md b/Object/Pack/Pack.md new file mode 100644 index 0000000..64346b1 --- /dev/null +++ b/Object/Pack/Pack.md @@ -0,0 +1,121 @@ +# Packet 类函数文档 + +## 一、构造函数 +### 函数签名 +- `constructor(...)` +### 说明 +如果有参数传入,则使用传入的参数进行构造;如果没有参数传入,则创建一个新的数据包。 + +--- + +## 二、Put_Header 函数 +### 函数签名 +- `function Put_Header(a, b)` +### 参数 +- `a`:整数 +- `b`:整数 +### 说明 +设置数据包的头部信息。 + +--- + +## 三、Put_Byte 函数 +### 函数签名 +- `function Put_Byte(Value)` +### 参数 +- `Value`:整数 +### 说明 +向数据包中写入一个字节的值。 + +--- + +## 四、Put_Short 函数 +### 函数签名 +- `function Put_Short(Value)` +### 参数 +- `Value`:整数 +### 说明 +向数据包中写入一个短整型的值。 + +--- + +## 五、Put_Int 函数 +### 函数签名 +- `function Put_Int(Value)` +### 参数 +- `Value`:整数 +### 说明 +向数据包中写入一个整型的值。 + +--- + +## 六、Put_Binary 函数 +### 函数签名 +- `function Put_Binary(Value)` +### 参数 +- `Value`:字符串 +### 说明 +向数据包中写入二进制数据。 + +--- + +## 七、Put_BinaryEx 函数 +### 函数签名 +- `function Put_BinaryEx(Str, Len)` +### 参数 +- `Str`:字符串指针 +- `Len`:整数,表示字符串长度 +### 说明 +向数据包中写入指定长度的二进制数据。 + +--- + +## 八、Put_BinaryEx_M 函数 +### 函数签名 +- `function Put_BinaryEx_M(Str, Len)` +### 参数 +- `Str`:字符串指针 +- `Len`:整数,表示字符串长度 +### 说明 +向数据包中写入指定长度的二进制数据。 + +--- + +## 九、Put_Str 函数 +### 函数签名 +- `function Put_Str(Str, Len)` +### 参数 +- `Str`:字符串 +- `Len`:整数,表示字符串长度 +### 说明 +向数据包中写入一个字符串。 + +--- + +## 十、Finalize 函数 +### 函数签名 +- `function Finalize(Value)` +### 参数 +- `Value`:布尔值 +### 说明 +完成数据包的构建。 + +--- + +## 十一、Send 函数 +### 函数签名 +- `function Send(SUser)` +### 参数 +- `SUser`:用户对象 +### 说明 +将数据包发送给指定用户。 + +--- + +## 十二、Delete 函数 +### 函数签名 +- `function Delete()` +### 说明 +删除数据包。 + +--- diff --git a/Object/Party/Party.md b/Object/Party/Party.md new file mode 100644 index 0000000..6fce9ba --- /dev/null +++ b/Object/Party/Party.md @@ -0,0 +1,89 @@ +# Party 类函数文档 + +## 一、创建队伍 +### 函数签名 +- `function Create(SUser)` +### 参数 +- `SUser`:用户对象 + +--- + +## 二、给队伍加入玩家 +### 函数签名 +- `function Join(SUser)` +### 参数 +- `SUser`:用户对象 + +--- + +## 三、获取队长 +### 函数签名 +- `function GetMaster()` +### 返回值 +- 用户对象,表示队长,若没有则返回 null + +--- + +## 四、发送每个玩家的 IP 广播(因为组队时 P2P) +### 函数签名 +- `function SendIpInfo()` + +--- + +## 五、获取战斗对象 +### 函数签名 +- `function GetBattleField()` +### 返回值 +- `BattleField`对象,表示战斗对象 + +--- + +## 六、获取玩家 +### 函数签名 +- `function GetUser(Pos)` +### 参数 +- `Pos`:整数,表示位置 +### 返回值 +- 用户对象,表示玩家,若没有则返回 null + +--- + +## 七、踢出玩家 +### 函数签名 +- `function LeaveUser(SUser)` +### 参数 +- `SUser`:用户对象 + +--- + +## 八、从副本踢出玩家 +### 函数签名 +- `function LeaveUserOnDgn(SUser)` +### 参数 +- `SUser`:用户对象 + +--- + +## 九、设置队伍可用复活币数量 +### 函数签名 +- `function SetPartyMemberCoinLimit(Count)` +### 参数 +- `Count`:整数,表示复活币数量 + +--- + +## 十、遍历玩家并执行函数 +### 函数签名 +- `function ForeachMember(Func)` +### 参数 +- `Func`:函数,表示要执行的函数 + +--- + +## 十一、获取地下城清除状态 +### 函数签名 +- `function Get_Dgn_Clear_State()` +### 返回值 +- 整数,表示地下城清除状态 + +--- diff --git a/Object/PvfItem/PvfItem.md b/Object/PvfItem/PvfItem.md new file mode 100644 index 0000000..9d86c09 --- /dev/null +++ b/Object/PvfItem/PvfItem.md @@ -0,0 +1,85 @@ +# PvfItem 类函数文档 + +## 三、Output 函数 +### 函数签名 +- `function Output()` +### 功能 +- 遍历`Attribute`属性中的值,将其转换为十六进制字符串表示,并打印出来。 + +--- + +## 四、获取编号函数 +### 函数签名 +- `function GetIndex()` +### 返回值 +- 整数,表示物品的编号。 + +--- + +## 五、获取可用等级函数 +### 函数签名 +- `function GetUsableLevel()` +### 返回值 +- 整数,表示物品的可用等级。 + +--- + +## 六、获取稀有度函数 +### 函数签名 +- `function GetRarity()` +### 返回值 +- 整数,表示物品的稀有度。 + +--- + +## 七、获取名字函数 +### 函数签名 +- `function GetName()` +### 返回值 +- 字符串,表示物品的名字。 + +--- + +## 八、公共函数 - 获取名字 +### 函数签名 +- `function GetNameById(Id)` +### 参数 +- `Id`:整数,表示物品的 ID。 +### 返回值 +- 字符串,表示对应 ID 的物品名字。 + +--- + +## 九、公共函数 - 获取 PVF 物品 +### 函数签名 +- `function GetPvfItemById(Idx)` +### 参数 +- `Idx`:整数,表示物品的索引。 +### 返回值 +- 如果找到对应索引的物品,返回一个`PvfItem`对象;否则返回 null。 + +--- + +## 十、是否是魔法封印 +### 函数签名 +- `function IsRandomOption()` +### 返回值 +- 如果是否是魔法封印 1为true 0为false。 + +--- + +## 十一、获取最低穿戴等级 +### 函数签名 +- `function GetUsableLevel()` +### 返回值 +- 如果最低的可穿戴等级。 + +--- + +## 十二、是否为消耗品 +### 函数签名 +- `function IsStackable()` +### 返回值 +- 如果是否是消耗品 0为装备 1为消耗品。 + +--- \ No newline at end of file diff --git a/Object/ScriptData/ScriptData.md b/Object/ScriptData/ScriptData.md new file mode 100644 index 0000000..a27f22e --- /dev/null +++ b/Object/ScriptData/ScriptData.md @@ -0,0 +1,55 @@ +# ScriptData 类函数文档 + +**类说明**: +`ScriptData`类为读取PVF相关操作,使用前,请现在sqr_main中调用构造函数初始化。 + + + +--- + +### 函数签名 +**构造函数**: +- `Script(Path = "/home/neople/game/Script.pvf")` +### 参数 +- `Path`:PVF文件的路径 + +**这里给出两个例子**: + +--- +``` + //在默认路径的PVF + Script(); + //在指定路径的PVF 例如/home/xxx/Scirpt.pvf + Script("/home/xxx/Scirpt.pvf"); +``` +--- + + +**懒得写函数原型了 这里直接给出使用例子**: + +--- + +``` + //读取装备List 读取完的内容在这个Buffer里 + local Buffer = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) { + while (!Data.Eof()) { + local Key = Data.Get(); + //注册装备列表 路径写入 数据未读取 + DataTable.rawset(Key, { + Path = Data.Get(), + Data = null + }); + } + print("加载装备List完成, 共" + DataTable.len() + "个"); + }); + + + //读取某一件装备的数据 + local Buffer = ScriptData.GetFileData("equipment/character/swordman/weapon/hsword/lgcy_agitto_nitras.equ", function(DataTable, Data) { + while (!Data.Eof()) { + local Buf = Data.Get(); + print(Buf); + } + }); +``` +--- diff --git a/Object/Timer/Timer.md b/Object/Timer/Timer.md new file mode 100644 index 0000000..6d18a98 --- /dev/null +++ b/Object/Timer/Timer.md @@ -0,0 +1,63 @@ +# Timer 类函数文档 + +**类说明**: +`Timer`类为定时器相关操作。 + + +--- + +### 函数签名 +**公有函数**: +- `function SetTimeOut(target_func, delay_time, ...)` +### 参数 +- `target_func`:函数体,要获执行的函数 +- `delay_time`:整数,要延迟的时间(秒) +- `...`:可变参数,传入的参数可再函数体回调函数中使用 + + +**这里给出两个个例子**: +> 无参数 +``` + Timer.SetTimeOut(function() { + print("注册 5 秒后执行") + }, 5); +``` +--- +> 有参数 +``` + Timer.SetTimeOut(function(str,num) { + print(str);//将打印 "字符串" + print(num);//将打印 123 + print("注册 5 秒后执行") + }, 5,"字符串",123); +``` +--- + +--- + +### 函数签名 +**公有函数**: +- `function SetCronTask(target_func, CronString, ...)` +### 参数 +- `target_func`:函数体,要获执行的函数 +- `CronString`:字符串,计划任务格式 让gpt帮你写cron字符串 +- `...`:可变参数,传入的参数可再函数体回调函数中使用 + + +**这里给出两个个例子**: +> 无参数 +``` + Timer.SetCronTask(function() { + print("注册 每五秒 执行") + }, "*/5 * * * * ?"); +``` +--- +> 有参数 +``` + Timer.SetCronTask(function(str,num) { + print(str);//将打印 "字符串" + print(num);//将打印 123 + print("注册 每五秒 执行") + }, "*/5 * * * * ?","字符串",123); +``` +--- diff --git a/Object/User/User.md b/Object/User/User.md new file mode 100644 index 0000000..32a3650 --- /dev/null +++ b/Object/User/User.md @@ -0,0 +1,449 @@ + +# 用户相关函数文档 + +## 一、获取当前区域 +### 函数签名 +- `function GetArea(b)` + +此函数接受一个布尔值参数`b`,返回一个整数,表示当前区域索引。 + +--- + +## 二、获取当前区域位置 +### 函数签名 +- `function GetAreaPos()` + +该函数返回一个包含两个整数属性`X`和`Y`的对象,分别表示当前位置的横坐标和纵坐标。 + +--- + +## 三、获取朝向 +### 函数签名 +- `function GetDirections()` + +此函数返回一个整数,表示朝向。 + +--- + +## 四、获取可见 values +### 函数签名 +- `function GetVisibleValues()` + +返回一个整数,表示可见值。 + +--- + +## 五、获取当前城镇位置 +### 函数签名 +- `function GetLocation()` + +该函数返回一个对象,包含`Pos`(对象,包含当前位置的横坐标和纵坐标)、`Town`(整数,表示城镇索引)、`Area`(整数,表示区域索引)。 + +--- + +## 六、账号状态 +### 函数签名 +- `function GetState()` + +返回一个整数,代表账号状态(登录后大于等于 3)。 + +--- + +## 七、角色数量 +### 函数签名 +- `function GetCharacCount()` + +此函数返回一个整数,表示角色数量。 + +--- + +## 八、账号 ID +### 函数签名 +- `function GetUID()` + +返回一个整数,表示账号 ID。 + +--- + +## 九、唯一 ID +### 函数签名 +- `function GetUniqueId()` + +返回一个整数,表示唯一 ID。 + +--- + +## 十、角色 ID +### 函数签名 +- `function GetCID()` + +此函数返回一个整数,表示角色 ID。 + +--- + +## 十一、角色职业 +### 函数签名 +- `function GetCharacJob()` + +返回一个整数,表示角色职业。 + +--- + +## 十二、角色名称 +### 函数签名 +- `function GetCharacName()` + +该函数返回一个字符串,表示角色名称。 + +--- + +## 十三、角色等级 +### 函数签名 +- `function GetCharacLevel()` + +返回一个整数,表示角色等级。 + +--- + +## 十四、设置角色等级 +### 函数签名 +- `function SetCharacLevel(new_level)` + +此函数接受一个整数参数`new_level`,表示新的角色等级,返回一个布尔值。 + +--- + +## 十五、角色转职职业 +### 函数签名 +- `function GetCharacGrowType()` + +返回一个整数,表示角色转职职业。 + +--- + +## 十六、角色觉醒职业 +### 函数签名 +- `function GetCharacSecondGrowType()` + +该函数返回一个整数,表示角色觉醒职业。 + +--- + +## 十七、更改转职职业 +### 函数签名 +- `function ChangeGrowType(GrowType, IsAwa)` + +接受两个参数,`GrowType`为整数,转职职业;`IsAwa`为布尔值,表示是否觉醒。 + +--- + +## 十八、已用疲劳值 +### 函数签名 +- `function GetFatigue()` + +返回一个整数,表示已用疲劳值。 + +--- + +## 十九、最大疲劳值 +### 函数签名 +- `function GetMaxFatigue()` + +此函数返回一个整数,表示最大疲劳值。 + +--- + +## 二十、获取背包 +### 函数签名 +- `function GetInven()` + +返回一个整数,表示背包索引,若没有则返回 null。 + +--- + +## 二十一、踢人 +### 函数签名 +- `function Kick(...)` + +此函数接受可变参数,参数包括`src`(整数,渠道,可选)、`p2`(整数,可选)、`p3`(整数,可选),返回一个整数,表示错误码? + +### 函数签名 +- `function DisConn(err)` + +接受一个错误号参数`err`(可选),返回一个整数,表示踢人结果。 + +--- + +## 二十二、当前小队/副本 +### 函数签名 +- `function GetParty()` + +返回一个`CParty`对象,表示当前小队/副本,若没有则返回 null。 + +--- + +## 二十三、是否在领主塔 +### 函数签名 +- `function CheckInBossTower()` + +返回一个布尔值,表示是否在领主塔。 + +--- + +## 二十四、是否在龙之路 +### 函数签名 +- `function CheckInBlueMarble()` + +该函数返回一个布尔值,表示是否在龙之路。 + +--- + +## 二十五、是否开启 GM 权限 +### 函数签名 +- `function IsGmMode()` + +返回一个布尔值,表示是否开启 GM 权限。 + +--- + +## 二十六、获取账号上次退出游戏的时间 +### 函数签名 +- `function GetCurCharacLastPlayTick()` + +返回一个时间戳,表示账号上次退出游戏的时间。 + +--- + +## 二十七、获取账号本次登录游戏的时间 +### 函数签名 +- `function GetCurCharacLoginTick()` + +此函数返回一个时间戳,表示账号本次登录游戏的时间。 + +--- + +## 二十八、获得公网地址 +### 函数签名 +- `function GetIpAddress()` + +返回一个整数,表示公网地址。 + +--- + +## 二十九、发包 +### 函数签名 +- `function Send(SPacket)` + +此函数接受一个数据包对象`SPacket`作为参数。 + +--- + +## 三十一、发送消息包 +### 函数签名 +- `function SendNotiPacket(Str, Type2, Type3)` + +此函数接受三个整数参数`Type1`、`Type2`、`Type3`。 + +--- + +## 三十二、获取技能树 +### 函数签名 +- `function GetSkillW()` + +返回一个技能树对象。 + +--- + +## 三十三、重置技能树 +### 函数签名 +- `function InitSkillW(GrowType, IsAwa)` + +接受两个参数,`GrowType`为整数,转职编号;`IsAwa`为布尔值,表示是否觉醒。 + +--- + +## 三十四、发送公告消息 +### 函数签名 +- `function SendNotiPacketMessage(String, Type)` + +此函数接受两个参数,一个字符串`String`和一个整数`Type`。 + +--- + +## 三十五、发送公告消息(带颜色) +### 函数签名 +- `function SendNotiForColorPacketMessage(StringArr, Type)` + +接受一个字符串数组`StringArr`和一个整数`Type`作为参数。 + +--- + +## 三十六、发送公告消息(带颜色和 ID) +### 函数签名 +- `function SendNotiForColorAIdPacketMessage(StringArr, Type)` + +接受一个字符串数组`StringArr`和一个整数`Type`作为参数。 + +--- + +## 三十七、调试信息包 +### 函数签名 +- `function Debug(Any)` + +接受一个任意对象`Any`作为参数。 + +--- + +## 三十八、发送道具 +### 函数签名 +- `function GiveItem(ItemId, ItemCount)` + +此函数接受两个参数,一个整数`ItemId`表示道具 ID,一个整数`ItemCount`表示道具数量,返回一个数组,表示发送成功后的道具信息,若发送失败则返回 null。 + +### 函数签名 +- `function GiveItemEx(GiveTab)` + +接受一个包含道具 ID 和数量的对象Map`GiveTab`作为参数。 + +--- + +## 三十九、更新背包栏 +### 函数签名 +- `function SendItemSpace(ItemSpace)` + +接受一个整数参数`ItemSpace`,表示背包栏索引。 + +--- + +## 四十、更新道具信息 +### 函数签名 +- `function SendUpdateItemList(Type, ItemSpace, Slot)` + +此函数接受三个参数,一个整数`Type`、一个整数`ItemSpace`表示背包栏索引、一个整数`Slot`表示道具槽位。 + +--- + +## 四十一、发送系统邮件 +### 函数签名 +- `function SendMail(ItemList,...)` + +接受一个道具列表`ItemList`和可变参数,可选参数包含邮件标题和正文等信息。 + +--- + +## 四十二、无条件完成指定任务并领取奖励 +### 函数签名 +- `function ClearQuest_Gm(QuestId)` + +接受一个整数参数`QuestId`,表示任务 ID。 + +--- + +## 四十三、充值点券 +### 函数签名 +- `function RechargeCera(Amount)` + +接受一个整数参数`Amount`,表示点券数量。 + +--- + +## 四十四、获取点券 +### 函数签名 +- `function GetCera()` + +返回一个整数,表示点券数量。 + +--- + +## 四十五、充值代币券 +### 函数签名 +- `function RechargeCeraPoint(Amount)` + +接受一个整数参数`Amount`,表示代币券数量。 + +--- + +## 四十六、获取代币券 +### 函数签名 +- `function GetCeraPoint()` + +此函数返回一个整数,表示代币券数量。 + +--- + +## 四十七、充值金币 +### 函数签名 +- `function RechargeMoney(Amount)` + +接受一个整数参数`Amount`,表示金币数量。 + +--- + +## 四十八、充值胜点 +### 函数签名 +- `function RechargeWinPoint(Amount)` + +接受一个整数参数`Amount`,表示胜点数量。 + +--- + +## 四十九、获取胜点 +### 函数签名 +- `function GetWinPoint()` + +返回一个整数,表示胜点数量。 + +--- + +## 五十、获取复活币 +### 函数签名 +- `function GetCoin()` + +此函数返回一个整数,表示复活币数量。 + +--- + +## 五十一、离开队伍 +### 函数签名 +- `function LeaveParty()` + +--- + +## 五十二、放弃副本 +### 函数签名 +- `function GiveupDgn()` + +--- + +## 五十三、设置玩家坐标 +### 函数签名 +- `function SetPosition(Xpos, Ypos, Direction)` + +接受三个参数,一个整数`Xpos`表示横坐标,一个整数`Ypos`表示纵坐标,一个整数`Direction`表示方向。 + +--- + +## 五十四、获取玩家任务信息 +### 函数签名 +- `function GetQuest()` + +返回一个任务信息对象。 + +--- + +## 五十四、发送弹窗公告包(可自定义文字需要客户端修复233dll搭配) +### 函数签名 +- `function SendNotiBox(Msg, Type)` + +接受三个参数,一个字符串`Msg`公告文本,一个整数`Type`表示类型 0全体 1自己 2队伍。 + +--- + +## 五十四、获取公会名称 +### 函数签名 +- `function GetGuildName()` +### 返回值 +- 如果公会的名称。 + + +--- \ No newline at end of file diff --git a/Object/World/World.md b/Object/World/World.md new file mode 100644 index 0000000..5449d29 --- /dev/null +++ b/Object/World/World.md @@ -0,0 +1,101 @@ +## 一、根据 UID 获取 Session +### 函数签名 +- `function GetSessionByUid(Uid)` +### 参数 +- `Uid`:整数,表示用户 ID +### 返回值 +- 返回一个 Session 对象,表示根据用户 ID 获取到的 Session。 + +--- + +## 二、根据 Session 获取玩家 +### 函数签名 +- `function GetUserBySession(Session)` +### 参数 +- `Session`:Session 对象 +### 返回值 +- 如果找到对应的用户,返回一个 User 对象;否则返回 null。 + +--- + +## 三、根据 UID 获取玩家 +### 函数签名 +- `function GetUserByUid(Uid)` +### 参数 +- `Uid`:整数,表示用户 ID +### 返回值 +- 如果找到对应的用户,返回一个 User 对象;否则返回 null。 + +--- + +## 四、根据名字获取玩家 +### 函数签名 +- `function GetUserByName(Name)` +### 参数 +- `Name`:字符串,表示用户名字 +### 返回值 +- 如果找到对应的用户,返回一个 User 对象;否则返回 null。 + +--- + +## 五、获取玩家数量 +### 函数签名 +- `function GetUserCount()` +### 返回值 +- 整数,表示玩家数量。 + +--- + +## 六、给所有玩家发包 +### 函数签名 +- `function SendAll(Pack)` +### 参数 +- `Pack`:数据包对象 + +--- + +## 七、给所有玩家发送公告 +### 函数签名 +- `function SendNotiPacketMessage(String, Type)` +### 参数 +- `String`:字符串,表示公告内容 +- `Type`:整数,表示公告类型 + +--- + +## 八、发送公告消息(带颜色) +### 函数签名 +- `function SendNotiForColorPacketMessage(StringArr, Type)` +### 参数 +- `StringArr`:字符串数组 +- `Type`:整数,表示公告类型 + +--- + +## 九、发送公告消息(带颜色和 ID) +### 函数签名 +- `function SendNotiForColorAIdPacketMessage(StringArr, Type)` +### 参数 +- `StringArr`:字符串数组 +- `Type`:整数,表示公告类型 + +--- + +## 十、通过 UID 和 CID 获取玩家 +### 函数签名 +- `function GetUserByUidCid(Uid, Cid)` +### 参数 +- `Uid`:整数,表示用户 ID +- `Cid`:整数,表示角色 ID +### 返回值 +- 如果找到对应的用户,返回一个 User 对象;否则返回 null。 + +--- + +## 十一、获取在线玩家列表 +### 函数签名 +- `function GetOnlinePlayer()` +### 返回值 +- 在线玩家的数组。 + +--- \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0cad782 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# 欢迎使用 DP-S 服务端插件 + +> 我该去哪里下载 + +[点我下载](https://www.baidu.com) + +> 是否有交流学习的地方 + +[点我加群](https://qm.qq.com/q/cavwGu9TVu) + +> 插件是否收费 + +完全免费,并且以后也不会收费。 \ No newline at end of file diff --git a/Start/1.md b/Start/1.md new file mode 100644 index 0000000..e584de5 --- /dev/null +++ b/Start/1.md @@ -0,0 +1,26 @@ +> 第一步下载程序本体 + + + +> 第二步解压至服务器根目录 + + + +> 第三步创建Main.nut文件 + + + +> 第四步在Main.nut中写入以下代码 + +``` +print("DP-S插件已加载"); +``` + + + +> 第五步更改服务端run脚本 + + + +```LD_PRELOAD="/dp_s/lib/libAurora.so" ./df_game_r siroco15 start &``` +自行将siroco15替换为你的频道 \ No newline at end of file diff --git a/Start/Example/1.md b/Start/Example/1.md new file mode 100644 index 0000000..d8fa5b4 --- /dev/null +++ b/Start/Example/1.md @@ -0,0 +1,73 @@ +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 ForgingEnhancement.nut 用于编写我们的代码 + + + +> 然后我们在ForgeEnhancement.nut中写入以下代码 + +``` +ForgingEnhancementStr1 <- "装备栏1号位没有装备.." +ForgingEnhancementStr2 <- "锻造成功,当前武器锻造[+%d]" +ForgingEnhancementStr3 <- "锻造失败,当前武器锻造[+%d]" +ForgingEnhancementStr4 <- "装备锻造等级已为最高等级,无法继续锻造.." +ForgingEnhancementMaxForgingLevel <- 31 +Cb_Use_Item_Sp_Func[7577] <- function(SUser, ItemId) { + //定义锻造成功率 + local DLevel = 60; + //获取玩家背包 + local InvenObj = SUser.GetInven(); + //如果背包存在 + if (InvenObj) { + //获取玩家背包类型1的第9个格子 + local ItemObj = InvenObj.GetSlot(1, 9); + //空装备 + if (ItemObj.IsEmpty) { + //发送通知 + SUser.SendNotiPacketMessage(ForgingEnhancementStr1, 8); + //返还消耗的道具 + SUser.GiveItem(ItemId, 1); + return; + } + //获取原装备的锻造等级 + local OldLevel = ItemObj.GetForging(); + //判断锻造等级是否大于设定的最大等级 + if (OldLevel >= ForgingEnhancementMaxForgingLevel) { + //发送通知 + SUser.SendNotiPacketMessage(ForgingEnhancementStr4, 8); + //返还消耗的道具 + SUser.GiveItem(ItemId, 1); + return; + } + //获得0-100的随机数 + local RandNum = MathClass.Rand(0, 100); + //判断随机数是否小于设定的几率 + if (RandNum <= DLevel) { + //将装备的锻造等级+1 + ItemObj.SetForging(OldLevel + 1); + //刷写装备 + ItemObj.Flush(); + //刷新玩家背包 + SUser.SendUpdateItemList(1, 0, 9); + //发送通知 + SUser.SendNotiPacketMessage(format(ForgingEnhancementStr2, (OldLevel + 1)), 8); + } else { + //发送通知 + SUser.SendNotiPacketMessage(format(ForgingEnhancementStr3, OldLevel), 8); + } + } +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/ForgingEnhancement.nut"); +``` + + +> 至此一个简单的锻造提升卷的逻辑就写完了,然后我们就可以在游戏中使用道具来提升武器锻造等级了 \ No newline at end of file diff --git a/Start/Example/10.md b/Start/Example/10.md new file mode 100644 index 0000000..34e47fc --- /dev/null +++ b/Start/Example/10.md @@ -0,0 +1,140 @@ +## 任务清理券大全 (贡献者: X) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 任务清理券大全.nut 用于编写我们的代码 + + + +> 然后我们在任务清理券大全.nut中写入以下代码 + +``` + + +//使用本功能,需要群文件内233.dll插件,用来弹窗提示用户;如果不需要233插件,请将SUser.SendNotiBox("这里写提示文字",1);修改为:SUser.SendNotiPacketMessage("这里写提示文字", 8); + +//数字11111代表你的主线任务清理券在pvf中的id,下面同样,修改为你的pvf内的文件id即可。 +//如有疑问 群内询问 +//主线任务清理券 +Cb_Use_Item_Sp_Func[2021458802] <- function(SUser, ItemId) { + pdrw(SUser,ItemId,0,null); +}; + +//支线/普通任务清理券(会清掉副职业/转职任务,这里添加了跳过副职业的任务ID) +Cb_Use_Item_Sp_Func[11111] <- function(SUser, ItemId) { + local QuestArray =[2702,2708,2710,2712]; + pdrw(SUser,ItemId,5,QuestArray); +}; + +//每日任务清理券 +Cb_Use_Item_Sp_Func[22222] <- function(SUser, ItemId) { + pdrw(SUser,ItemId,3,null); +}; + + +//成就任务清理券(会清掉觉醒任务,自行添加需要屏蔽的ID) +Cb_Use_Item_Sp_Func[3333] <- function(SUser, ItemId) { + pdrw(SUser,ItemId,2,null); +}; + + +//修炼任务清理券 +Cb_Use_Item_Sp_Func[6666] <- function(SUser, ItemId) { + pdrw(SUser,ItemId,1,null); +}; + +//Tag:int型,传递一个标记来表示本次完成哪种类型的任务:(0=主线,5=普通/副职业/转职,1=修炼,3=每日/活动,2=觉醒/成就) +//QuestArray:一个包含int型的数组,数组内是要过滤掉的任务ID。举例 local QuestArray = [12,44],如果不需要过滤任务,直接传null +function pdrw(SUser, ItemId,Tag,QuestArray){ + + local QuestArray = QuestArray; + + //获取角色任务信息 + local userQuest = SUser.GetQuest(); + + + + //当前角色已完成的任务 + local questIsClear = NativePointer(userQuest).add(4); + //获取角色等级 + local characLevel = SUser.GetCharacLevel(); + //统计要完成的任务数量 + local allClearQuest = 0; + + //获取pvf数据 + local DataManager = Sq_CallFunc(S_Ptr("0x80CC19B"), "pointer"); + + + //清空已接任务 + for(local i=0; i<20; i++) { + local a = NativePointer(userQuest).add(4 * (i + 7500 + 2)).readInt(); + SUser.ClearQuest_Gm(a); + } + + //循环开始清理 + for(local questID = 1; questID < 30000; questID++){ + + //判断下不需要自动完成的任务数组,包含就跳过 + if(QuestArray!=null){ + if(QuestArray.find(questID)!=null){continue;}; + } + //判断当前任务是否已经完成,questID=任务ID; + local isClear = Sq_CallFunc(S_Ptr("0x808BAE0"),"bool",["pointer","int"],questIsClear.C_Object,questID); + + + //此任务已清理,跳过 + if(isClear){continue;}; + + //从pvf中获取任务数据 questID=任务ID + local pvfQuest = Sq_CallFunc(S_Ptr("0x835FDC6"), "pointer", ["pointer", "int"],DataManager,questID ); + + + if(pvfQuest){ + + + //获取任务类型0=主线,5=普通/副职业/转职,1=修炼,3=每日/活动,2=觉醒/成就 + local questGrade = NativePointer(pvfQuest).add(8).readInt(); + + + if(questGrade == Tag){ + //获取任务的级别 + local questLv = NativePointer(pvfQuest).add(0x20).readInt(); + if(questLv<=characLevel){ + //将该任务设置为已完成状态 + + Sq_CallFunc(S_Ptr("0x808BA78"), "int", ["pointer", "int"], questIsClear.C_Object,questID); + + allClearQuest++; + }; + + }; + }; + }; + + + //已清理了0个以上的任务 + if(allClearQuest>0){ + //通知客户端刷新任务列表 + local Pack = Packet(); + Sq_CallFunc(S_Ptr("0x86ABBA8"), "int", ["pointer", "pointer"], userQuest, Pack.C_Object); + SUser.Send(Pack); + Pack.Delete(); + SUser.SendNotiBox("已清理任务共 "+allClearQuest+" 个",1); + }else{ + SUser.SendNotiBox("无任务需要清理",1); + SUser.GiveItem(ItemId, 1); + } +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/任务清理券大全.nut"); +``` + +> 至此一个简单的任务清理券大全的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/11.md b/Start/Example/11.md new file mode 100644 index 0000000..ef2cfcf --- /dev/null +++ b/Start/Example/11.md @@ -0,0 +1,84 @@ +## 通关时间播报 (贡献者: 邪神) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 通关时间播报.nut 用于编写我们的代码 + +> 然后我们在通关时间播报.nut中写入以下代码 + +``` +//贡献者: 邪神 +ClearTimeMsg <- "玩家[%s]通关<%s>[%s]耗时:[%s]"; + +//难度对应难度名称 +dungeon_diff_Map <- { + "0": "普通级", + "1": "冒险级", + "2": "王者级", + "3": "地狱级", + "4": "英雄级" +}; +//通关时间回调 +Cb_CParty_SetBestClearTime_Enter_Func.ClearTime <- function(args) { + local PartyObj = Party(args[0]); + local dungeon_diff = args[2]; + local clearTime = args[3]; + local Bfobj = PartyObj.GetBattleField(); + local DgnObj = Bfobj.GetDgn(); + local Dungeon_Name = DgnObj.GetName(); + local diff_name = dungeon_diff_Map[(dungeon_diff).tostring()]; + + local MemberNames = []; + for (local i = 0; i < 4; ++i) { + local SUser = PartyObj.GetUser(i); + if (SUser) { + local name = SUser.GetCharacName(); + MemberNames.push(name); + } + } + + local joinedNames = join(MemberNames, ", "); + local time = formatMilliseconds(clearTime); + + World.SendNotiPacketMessage(format(ClearTimeMsg, joinedNames, diff_name, Dungeon_Name, time), 0); +} + +function join(array, delimiter) { + local result = ""; + for (local i = 0; i < array.len(); ++i) { + if (i > 0) { + result += delimiter; + } + result += array[i]; + } + return result; +} +//毫秒转换 +function formatMilliseconds(ms) { + local str = ""; + local minutes = ms / 60000; + local seconds = (ms % 60000) / 1000; + local milliseconds = (ms % 1000) / 10; + if (minutes > 0) { + str = minutes + "分" + + (seconds < 10 ? "0" : "") + seconds + "秒" + + (milliseconds < 10 ? "0" : "") + milliseconds; + } else { + str = seconds + "秒" + + (milliseconds < 10 ? "0" : "") + milliseconds; + } + return str; +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/通关时间播报.nut"); +``` + +> 至此一个简单的通关时间播报的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/12.md b/Start/Example/12.md new file mode 100644 index 0000000..0270d5c --- /dev/null +++ b/Start/Example/12.md @@ -0,0 +1,66 @@ +## 在线泡点 (贡献者: 邪神) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 在线泡点.nut 用于编写我们的代码 + +> 然后我们在在线泡点.nut中写入以下代码 + +``` +//贡献者: 邪神 +//tips:发放点券或代表可在配置中填写数值,如两个选项都填写大于0的数值则点券代币都会发放,如填写0则不会发放 + +RewardCera <- 0; // 每分钟XX点券 +RewardCeraPoint <- 10; // 每分钟XX代币 +total_cera_reward <- {}; // 存储每个玩家的累计点券奖励 +total_ceraPoint_reward <- {}; // 存储每个玩家的累计代币奖励 + +function Online_rewards() { + local OnlinePlayerList = World.GetOnlinePlayer(); + + foreach(SUser in OnlinePlayerList) { + // 点券奖励处理 + if (RewardCera > 0) { + if (!(SUser.GetUID() in total_cera_reward)) { + total_cera_reward[SUser.GetUID()] <- 0; + } + + total_cera_reward[SUser.GetUID()] += RewardCera; + + SUser.SendNotiPacketMessage("活跃奖励获得: " + RewardCera + "点券, 累计获得: " + total_cera_reward[SUser.GetUID()] + "点券", 14); + + SUser.RechargeCera(RewardCera); + } + + // 代币奖励处理 + if (RewardCeraPoint > 0) { + if (!(SUser.GetUID() in total_ceraPoint_reward)) { + total_ceraPoint_reward[SUser.GetUID()] <- 0; + } + + total_ceraPoint_reward[SUser.GetUID()] += RewardCeraPoint; + + SUser.SendNotiPacketMessage("活跃奖励获得: " + RewardCeraPoint + "代币, 累计获得: " + total_ceraPoint_reward[SUser.GetUID()] + "代币", 14); + + SUser.RechargeCeraPoint(RewardCeraPoint); + } + } +} + +//默认为1分钟发放一次泡点 +Timer.SetCronTask(function() { + Online_rewards(); +}, "/1 * * * *"); +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/在线泡点.nut"); +``` + +> 至此一个简单的在线泡点的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/13.md b/Start/Example/13.md new file mode 100644 index 0000000..16d22eb --- /dev/null +++ b/Start/Example/13.md @@ -0,0 +1,33 @@ +## 副本难度解锁 (贡献者: 邪神) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 副本难度解锁.nut 用于编写我们的代码 + +> 然后我们在副本难度解锁.nut中写入以下代码 + +``` +UnlockDGndiff_itemId <- 202203296 //副本难度解锁券道具ID + +Cb_Use_Item_Sp_Func[UnlockDGndiff_itemId] <- function(SUser, ItemId) { + local a3 = Memory.allocUtf8String("3"); + Sq_CallFunc(S_Ptr("0x0820BA90"), "int", ["pointer", "int", "pointer"], SUser.C_Object, 120, a3.C_Object); + + Timer.SetTimeOut(function(SUser) { + Sq_CallFunc(S_Ptr("0x8686FEE"), "int", ["pointer", "int"], SUser.C_Object, 1); + }, 1, SUser); +} + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/副本难度解锁.nut"); +``` + +> 至此一个简单的副本难度解锁的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/14.md b/Start/Example/14.md new file mode 100644 index 0000000..02c1894 --- /dev/null +++ b/Start/Example/14.md @@ -0,0 +1,22 @@ +## 反外挂制裁 (贡献者: 邪神) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 反外挂代码涉及逻辑不方便公开,以免被开挂者洞悉,请去群内下载加密文件直接加载 + +``` + + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/反外挂制裁.sut"); +``` + +> 至此一个简单的反外挂制裁的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/15.md b/Start/Example/15.md new file mode 100644 index 0000000..9548e1e --- /dev/null +++ b/Start/Example/15.md @@ -0,0 +1,615 @@ +## 装备镶嵌与时装镶嵌 (贡献者: 倾泪寒) +> 如果你不需要更改装备和时装镶嵌的逻辑则不需要添加 这个文件 直接去使用GameManager的接口即可 + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 装备镶嵌与时装镶嵌.nut 用于编写我们的代码 + +> 然后我们在装备镶嵌与时装镶嵌.nut中写入以下代码 + +``` +/* +文件名:EquimentUseJewel.nut +路径:Dps_A/ProjectClass/EquimentUseJewel/EquimentUseJewel.nut +创建日期:2024-10-28 21:18 +文件用途:装备镶嵌 +*/ + +class EquimentUseJewel { + + ExecUser = null; + + //建库建表 + function CreateMysqlTable() { + local CreateSql1 = "create database if not exists l_equ_jewel default charset utf8;" + local CreateSql2 = "CREATE TABLE l_equ_jewel.equipment ( equ_id int(11) AUTO_INCREMENT, jewel_data blob NOT NULL,andonglishanbai_flag int(11),date VARCHAR(255), PRIMARY KEY (equ_id)) ENGINE=InnoDB DEFAULT CHARSET=utf8,AUTO_INCREMENT = 150;" + local SqlObj = MysqlPool.GetInstance().GetConnect(); + SqlObj.Exec_Sql(CreateSql1); + SqlObj.Exec_Sql(CreateSql2); + MysqlPool.GetInstance().PutConnect(SqlObj); + } + + function api_get_jewel_socket_data(id) { //获取徽章数据,存在返回徽章数据,不存在返回空字节数据 + local CheckSql = "SELECT jewel_data FROM l_equ_jewel.equipment where equ_id = " + id + ";"; + //从池子拿连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + local Ret = SqlObj.Select(CheckSql, ["binary"]); + //把连接还池子 + MysqlPool.GetInstance().PutConnect(SqlObj); + //没结婚要返回false + if (Ret.len()< 1 || Ret[0][0] == null) { + return 0; + } else { + return Ret[0][0]; + } + } + + function api_exitjeweldata(id) { //0代表不存在,存在返回1 + local CheckSql = "SELECT andonglishanbai_flag FROM l_equ_jewel.equipment where equ_id = " + id + ";"; + //从池子拿连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + local Ret = SqlObj.Select(CheckSql, ["int"]); + //把连接还池子 + MysqlPool.GetInstance().PutConnect(SqlObj); + //没结婚要返回false + if (Ret.len()< 1 || Ret[0][0] == null) { + return 0; + } else { + return Ret[0][0]; + } + } + + function save_equiment_socket(socket_data, id) { //0代表不存在,存在返回1 + local CheckSql = "UPDATE l_equ_jewel.equipment SET jewel_data = 0x" + socket_data + " WHERE equ_id = " + id + ";"; + //从池子拿连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + local Ret = SqlObj.Select(CheckSql, ["int"]); + //把连接还池子 + MysqlPool.GetInstance().PutConnect(SqlObj); + //没结婚要返回false + if (Ret.len()< 1 || Ret[0][0] == null) { + return false; + } else { + return true; + } + } + + function CUser_SendCmdErrorPacket(SUser, id, id2) { + local Pack = Packet(); + Pack.Put_Header(1, id); + Pack.Put_Byte(0); + Pack.Put_Byte(id2); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + + function api_PacketBuf_get_buf(packet_buf) { + return NativePointer(NativePointer(packet_buf).add(20).readPointer()).add(13); + } + + function add_equiment_socket(equipment_type) { //0代表开孔失败 成功返回标识 + /* + 武器10 + 称号11 + 上衣12 + 头肩13 + 下衣14 + 鞋子15 + 腰带16 + 项链17 + 手镯18 + 戒指19 + 辅助装备20 + 魔法石21 + */ + + /* + 红色:'010000000000010000000000000000000000000000000000000000000000' A + 黄色:'020000000000020000000000000000000000000000000000000000000000' B + 绿色:'040000000000040000000000000000000000000000000000000000000000' C + 蓝色:'080000000000080000000000000000000000000000000000000000000000' D + 白金:'100000000000100000000000000000000000000000000000000000000000' + */ + local DB_JewelsocketData = ""; + switch (equipment_type) { + case 10: //武器10 SS + DB_JewelsocketData = "100000000000000000000000000000000000000000000000000000000000" + break; + case 11: //称号11 SS + DB_JewelsocketData = "100000000000000000000000000000000000000000000000000000000000" + break; + case 12: //上衣12 C + DB_JewelsocketData = "040000000000040000000000000000000000000000000000000000000000" + break; + case 13: //头肩13 B + DB_JewelsocketData = "020000000000020000000000000000000000000000000000000000000000" + break; + case 14: //下衣14 C + DB_JewelsocketData = "040000000000040000000000000000000000000000000000000000000000" + break; + case 15: //鞋子15 D + DB_JewelsocketData = "080000000000080000000000000000000000000000000000000000000000" + break; + case 16: //腰带16 A + DB_JewelsocketData = "010000000000010000000000000000000000000000000000000000000000" + break; + case 17: //项链17 B + DB_JewelsocketData = "020000000000020000000000000000000000000000000000000000000000" + break; + case 18: //手镯18 D + DB_JewelsocketData = "080000000000080000000000000000000000000000000000000000000000" + break; + case 19: //戒指19 A + DB_JewelsocketData = "010000000000010000000000000000000000000000000000000000000000" + break; + case 20: //辅助装备20 S + DB_JewelsocketData = "100000000000000000000000000000000000000000000000000000000000" + break; + case 21: //魔法石21 S + DB_JewelsocketData = "100000000000000000000000000000000000000000000000000000000000" + break; + default: + DB_JewelsocketData = "000000000000000000000000000000000000000000000000000000000000" + break; + } + local date = time(); + local Ct = Sq_GetTimestampString(); + date = date.tostring() + Ct; + + local CheckSql = "INSERT INTO l_equ_jewel.equipment (andonglishanbai_flag,jewel_data,date) VALUES(1,0x" + DB_JewelsocketData + ",\'" + date + "\');"; + local CheckSql1 = "SELECT equ_id FROM l_equ_jewel.equipment where date = \'" + date + "\';"; + //从池子拿连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + SqlObj.Select(CheckSql, ["int"]); + local Ret = SqlObj.Select(CheckSql1, ["int"]); + //把连接还池子 + MysqlPool.GetInstance().PutConnect(SqlObj); + if (Ret.len()< 1 || Ret[0][0] == null) { + return 0; + } else { + return Ret[0][0]; + } + return 0; + } + + function CStackableItem_getJewelTargetSocket(C_Object) { + return Sq_CallFunc(S_Ptr("0x0822CA28"), "int", ["pointer"], C_Object); + } + + function CUser_SendUpdateItemList_DB(SUser, Slot, DB_JewelSocketData) { + local Pack = Packet(); + Pack.Put_Header(0, 14); + Pack.Put_Byte(0); + Pack.Put_Short(1); + local InvenObj = SUser.GetInven(); + Sq_CallFunc(S_Ptr("0x084FC6BC"), "int", ["pointer", "int", "int", "pointer"], InvenObj.C_Object, 1, Slot, Pack.C_Object); + Pack.Put_BinaryEx(DB_JewelSocketData.C_Object, 30); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + + function GetByte(value) { + local Blob = blob(); + Blob.writen(value, 'w'); + return Blob; + } + + function intToHex(num) { + if (num == 0) { + return "0"; + } + local hexDigits = "0123456789abcdef"; + local hexString = ""; + while (num > 0) { + local remainder = num % 16; + hexString = hexDigits[remainder] + hexString; + num = (num / 16).tointeger(); + } + return hexString; + } + + function lengthCutting(str, ystr, num, maxLength) { + // 如果字符串长度小于最大长度,在前面补0 + local lengthDiff = maxLength - str.len(); + if (lengthDiff > 0) { + local zeroPadding = ""; + for (local i = 0; i< lengthDiff; i++) { + zeroPadding += "0"; + } + str = zeroPadding + str; + } + local strArr = ""; + for (local i = 0; i< str.len(); i += num) { + local endIndex = i + num; + if (endIndex > str.len()) { + endIndex = str.len(); + } + strArr += str.slice(i, endIndex); + } + return ystr + strArr; + } + + + HackReturnAddSocketToAvatarFalg = null; + + + function HackReturnAddSocketToAvatar(Code) { + //标记flag + HackReturnAddSocketToAvatarFalg = Code; + + Cb_PacketBuf_get_short_Leave_Func.EquimentUseJewel <- function(args) { + Cb_PacketBuf_get_short_Leave_Func.rawdelete("EquimentUseJewel"); + return 0; + }.bindenv(this); + } + + + function FixFunction() { + //称号回包 + Cb_CTitleBook_putItemData_Leave_Func.EquimentUseJewel <- function(args) { + local JewelSocketData = api_get_jewel_socket_data(NativePointer(args[3]).add(25).readU32()); + local ret = args.pop(); + if (JewelSocketData && NativePointer(JewelSocketData).add(0).readU8() != 0) { + local Pack = Packet(args[1]); + Pack.Put_BinaryEx(JewelSocketData.C_Object, 30); + } + return null; + }.bindenv(this); + + //设计图继承 + Cb_CUsercopyItemOption_Enter_Func.EquimentUseJewel <- function(args) { + local jewelSocketID = NativePointer(args[2]).add(25).readU32(); + NativePointer(args[1]).add(25).writeU32(jewelSocketID); + return null; + }.bindenv(this); + + //装备开孔 + Cb_AddSocketToAvatar_Enter_Func.EquimentUseJewel <- function(args) { + local SUser = User(args[1]); + local Pack = Packet(args[2]); + local equ_slot = Pack.GetShort(); + local equitem_id = Pack.GetInt(); + local sta_slot = Pack.GetShort(); + local CurCharacInvenW = SUser.GetInven(); + local inven_item = CurCharacInvenW.GetSlot(1, equ_slot); + + if (equ_slot > 56) { //修改后:大于56则是时装装备 原:如果不是装备文件就调用原逻辑 + equ_slot = equ_slot - 57; + local C_PacketBuf = api_PacketBuf_get_buf(args[2]) //获取原始封包数据 + C_PacketBuf.add(0).writeShort(equ_slot) //修改掉装备位置信息 时装类镶嵌从57开始。 + //执行原逻辑 + return null; + } + //如果已开启镶嵌槽则不执行 + local equ_id = NativePointer(inven_item.C_Object).add(25).readU32(); + if (api_exitjeweldata(equ_id)) { + HackReturnAddSocketToAvatar(0x13); + return null; + } + + local item = PvfItem.GetPvfItemById(equitem_id); + local ItemType = Sq_CallFunc(S_Ptr("0x08514D26"), "int", ["pointer"], item.C_Object); + + if (ItemType == 10) { + SUser.SendNotiBox("装备为武器类型,不支持打孔!", 1) + HackReturnAddSocketToAvatar(0x0); + return null; + } else if (ItemType == 11) { + SUser.SendNotiBox("装备为称号类型,不支持打孔!", 1) + HackReturnAddSocketToAvatar(0x0); + return null; + } + + local id = add_equiment_socket(ItemType); + + Sq_Inven_RemoveItemFormCount(CurCharacInvenW.C_Object, 1, sta_slot, 1, 8, 1); //删除打孔道具 + NativePointer(inven_item.C_Object).add(25).writeU32(id) //写入槽位标识 + SUser.SendUpdateItemList(1, 0, equ_slot); + + local JewelSocketData = api_get_jewel_socket_data(id); + CUser_SendUpdateItemList_DB(SUser, equ_slot, JewelSocketData); //用于更新镶嵌后的装备显示,这里用的是带镶嵌数据的更新背包函数,并非CUser_SendUpdateItemList + + local Pack = Packet(); + Pack.Put_Header(1, 209); + Pack.Put_Byte(1); + Pack.Put_Short(equ_slot + 104); + Pack.Put_Short(sta_slot); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + HackReturnAddSocketToAvatar(0x0); + return null; + }.bindenv(this); + + Cb_AddSocketToAvatar_Leave_Func.EquimentUseJewel <- function(args) { + //跳的错误返回0 正常调用的话不处理返回值 + if (HackReturnAddSocketToAvatarFalg != null) { + local SUser = User(args[1]); + // SUser.SendItemSpace(0); + CUser_SendCmdErrorPacket(SUser, 209, HackReturnAddSocketToAvatarFalg); + HackReturnAddSocketToAvatarFalg = null; + return 0; + } + return null; + }.bindenv(this); + + //装备镶嵌和时装镶嵌 + Cb_Dispatcher_UseJewel_Enter_Func.EquimentUseJewel <- function(args) { + local SUser = User(args[1]); + local Pack = Packet(args[2]); + local PackIndex = NativePointer(args[2]).add(4).readInt(); + local State = SUser.GetState(); + if (State != 3) return null; + + local avartar_inven_slot = Pack.GetShort(); + local avartar_item_id = Pack.GetInt(); + local emblem_cnt = Pack.GetByte(); + + //下面是参照原时装镶嵌的思路写的。个别点标记出来。 + if (avartar_inven_slot > 104) { + local equipment_inven_slot = avartar_inven_slot - 104; //取出真实装备所在背包位置值 + local Inven = SUser.GetInven(); + local equipment = Inven.GetSlot(1, equipment_inven_slot); + //校验是否合法 + if (!equipment || equipment.IsEmpty || (equipment.GetIndex() != avartar_item_id) || SUser.CheckItemLock(1, equipment_inven_slot)) return; + + local id = NativePointer(equipment.C_Object).add(25).readU32(); + local JewelSocketData = api_get_jewel_socket_data(id); + if (!JewelSocketData) return; + + local emblems = {}; + if (emblem_cnt <= 3) { + for (local i = 0; i< emblem_cnt; i++) { + local emblem_inven_slot = Pack.GetShort(); + local emblem_item_id = Pack.GetInt(); + local equipment_socket_slot = Pack.GetByte(); + local emblem = Inven.GetSlot(1, emblem_inven_slot); + //校验徽章及插槽数据是否合法 + if (!emblem || emblem.IsEmpty || (emblem.GetIndex() != emblem_item_id) || (equipment_socket_slot >= 3)) return; + + //校验徽章是否满足时装插槽颜色要求 + //获取徽章pvf数据 + local citem = PvfItem.GetPvfItemById(emblem_item_id); + if (!citem) return; + + //校验徽章类型 + if (!citem.IsStackable() || citem.GetItemType() != 20) return; + + //获取徽章支持的插槽 + local emblem_socket_type = CStackableItem_getJewelTargetSocket(citem.C_Object); + //获取要镶嵌的时装插槽类型 + local avartar_socket_type = JewelSocketData.add(equipment_socket_slot * 6).readShort(); + + if (!(emblem_socket_type & avartar_socket_type)) { + + return; + } + + emblems[equipment_socket_slot] <- [emblem_inven_slot, emblem_item_id]; + } + } + + + foreach(equipment_socket_slot, emblemObject in emblems) { + //删除徽章 + local emblem_inven_slot = emblemObject[0]; + Sq_Inven_RemoveItemFormCount(Inven.C_Object, 1, emblem_inven_slot, 1, 8, 1); //删除打孔道具 + //设置时装插槽数据 + local emblem_item_id = emblemObject[1]; + JewelSocketData.add(2 + 6 * equipment_socket_slot).writeU32(emblem_item_id); + } + + local Buf = Sq_Point2Blob(JewelSocketData.C_Object, 30); + local Str = ""; + foreach(Value in Buf) { + Str += format("%02X", Value); + } + + save_equiment_socket(Str, id); + // if (!save_equiment_socket(DB_JewelSocketData, id)) { + // print("写入失败了"); + // return null; + // } + + CUser_SendUpdateItemList_DB(SUser, equipment_inven_slot, JewelSocketData); //用于更新镶嵌后的装备显示,这里用的是带镶嵌数据的更新背包函数,并非CUser_SendUpdateItemList + local Pack = Packet(); + Pack.Put_Header(1, 209); + Pack.Put_Byte(1); + Pack.Put_Short(equipment_inven_slot + 104); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + + return; + } + + AvatarLogic(args, PackIndex); + + return null; + }.bindenv(this); + + Cb_Dispatcher_UseJewel_Leave_Func.EquimentUseJewel <- function(args) { + return -1; + }.bindenv(this); + + //额外数据包,发送装备镶嵌数据给本地处理 + Cb_InterfacePacketBuf_put_packet_Leave_Func.EquimentUseJewel <- function(args) { + local ret = args.pop(); + local Inven_Item = NativePointer(args[1]); + if (Inven_Item.add(1).readU8() == 1) { + local ItemObj = Item(args[1]); + local JewelSocketData = api_get_jewel_socket_data(NativePointer(ItemObj.C_Object).add(25).readU32()); + if (JewelSocketData && JewelSocketData.add(0).readU8() != 0) { + local Pack = Packet(args[0]); + Pack.Put_BinaryEx(JewelSocketData.C_Object, 30); + } + } + return null; + }.bindenv(this); + + L_HookEquimentUseJewel(); + } + + + + + function WongWork_CAvatarItemMgr_getJewelSocketData(a, b) { + return Sq_CallFunc(S_Ptr("0x82F98F8"), "pointer", ["pointer", "int"], a, b); + } + + function CStackableItem_getJewelTargetSocket(C_Object) { + return Sq_CallFunc(S_Ptr("0x0822CA28"), "int", ["pointer"], C_Object); + } + + function CInventory_delete_item(C_Object, Type, Slot, Count, Ps, Log) { + return Sq_CallFunc(S_Ptr("0x850400C"), "int", ["pointer", "int", "int", "int", "int", "int"], C_Object, Type, Slot, Count, Ps, Log); + } + + function api_set_JewelSocketData(jewelSocketData, slot, emblem_item_id) { + if (jewelSocketData) { + NativePointer(jewelSocketData).add(slot * 6 + 2).writeInt(emblem_item_id); + } + } + + function DB_UpdateAvatarJewelSlot_makeRequest(a, b, c) { + return Sq_CallFunc(S_Ptr("0x843081C"), "pointer", ["int", "int", "pointer"], a, b, c); + } + + //获取时装在数据库中的uid + function api_get_avartar_ui_id(avartar) { + return NativePointer(avartar).add(7).readInt(); + } + + + function AvatarLogic(args, PackIndex) { + //角色 + local SUser = User(args[1]); + //包数据 + local Pack = Packet(args[2]); + //还原包读取数据号位 + NativePointer(args[2]).add(4).writeInt(PackIndex); + + //校验角色状态是否允许镶嵌 + if (!SUser || SUser.GetState() != 3) { + return; + } + //时装所在的背包槽 + local Inven_Slot = Pack.GetShort(); + //时装item_id + local Item_Id = Pack.GetInt(); + //本次镶嵌徽章数量 + local Emblem_Count = Pack.GetByte(); + + //获取时装道具 + local InvemObj = SUser.GetInven(); + local AvatarObj = InvemObj.GetSlot(2, Inven_Slot); + + + //校验时装 数据是否合法 + if (!AvatarObj || AvatarObj.IsEmpty || (AvatarObj.GetIndex() != Item_Id) || SUser.CheckItemLock(2, Inven_Slot)) return; + + local Avartar_AddInfo = AvatarObj.GetAdd_Info(); + //获取时装管理器 + local Inven_AvartarMgr = InvemObj.GetAvatarItemMgr(); + + //获取时装插槽数据 + local Jewel_Socket_Data = WongWork_CAvatarItemMgr_getJewelSocketData(Inven_AvartarMgr, Avartar_AddInfo); + if (!Jewel_Socket_Data) return; + + //最多只支持3个插槽 + if (Emblem_Count <= 3) { + local emblems = {}; + + for (local i = 0; i< Emblem_Count; i++) { + //徽章所在的背包槽 + local emblem_inven_slot = Pack.GetShort(); + //徽章item_id + local emblem_item_id = Pack.GetInt(); + //该徽章镶嵌的时装插槽id + local avartar_socket_slot = Pack.GetByte(); + + //获取徽章道具 + local EmblemObje = InvemObj.GetSlot(1, emblem_inven_slot); + + //校验徽章及插槽数据是否合法 + if (!EmblemObje || EmblemObje.IsEmpty || (EmblemObje.GetIndex() != emblem_item_id) || (avartar_socket_slot >= 3)) return; + + //校验徽章是否满足时装插槽颜色要求 + //获取徽章pvf数据 + local citem = PvfItem.GetPvfItemById(emblem_item_id); + if (!citem) return; + + //校验徽章类型 + if (!citem.IsStackable() || citem.GetItemType() != 20) return; + + //获取徽章支持的插槽 + local emblem_socket_type = CStackableItem_getJewelTargetSocket(citem.C_Object); + + //获取要镶嵌的时装插槽类型 + local avartar_socket_type = NativePointer(Jewel_Socket_Data).add(avartar_socket_slot * 6).readShort(); + + if (!(emblem_socket_type & avartar_socket_type)) return; + + emblems[avartar_socket_slot] <- [emblem_inven_slot, emblem_item_id]; + } + + //开始镶嵌 + foreach(avartar_socket_slot, emblemObject in emblems) { + //删除徽章 + local emblem_inven_slot = emblemObject[0]; + CInventory_delete_item(InvemObj.C_Object, 1, emblem_inven_slot, 1, 8, 1); + //设置时装插槽数据 + local emblem_item_id = emblemObject[1]; + api_set_JewelSocketData(Jewel_Socket_Data, avartar_socket_slot, emblem_item_id); + } + + //时装插槽数据存档 + DB_UpdateAvatarJewelSlot_makeRequest(SUser.GetCID(), api_get_avartar_ui_id(AvatarObj.C_Object), Jewel_Socket_Data); + + //通知客户端时装数据已更新 + SUser.SendUpdateItemList(1, 1, Inven_Slot); + + //回包给客户端 + local Pack = Packet(); + Pack.Put_Header(1, 204); + Pack.Put_Int(1); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + + return null; + } + + constructor() { + CreateMysqlTable(); + + FixFunction(); + } +} + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 如果你已经开启过数据库连接池则不需要初始化数据库连接池的代码 + +``` +sq_RunScript("MyProject/装备镶嵌与时装镶嵌.nut"); + +local PoolObj = MysqlPool.GetInstance(); +PoolObj.SetBaseConfiguration("127.0.0.1", 3306, "game", "uu5!^%jg"); +//连接池大小 +PoolObj.PoolSize = 10; +//初始化 +PoolObj.Init(); + + +GameManager.FixEquipUseJewel(); +``` + +> 至此一个简单的装备镶嵌与时装镶嵌的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/2.md b/Start/Example/2.md new file mode 100644 index 0000000..4c93a1d --- /dev/null +++ b/Start/Example/2.md @@ -0,0 +1,71 @@ +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 跨界石.nut 用于编写我们的代码 + + + +> 然后我们在跨界石.nut中写入以下代码 + +``` +CrossoverStr1 <- "装备栏1号位没有装备.."; +CrossoverStr2 <- "跨界失败,请检查一下账号金库是否没有开启或者没有空位"; +CrossoverStr3 <- "跨界失败"; +CrossoverStr4 <- "跨界成功,已经装备栏第一格的 [%s] 转移至账号金库"; +CrossoverId <- 7577; +Cb_Use_Item_Sp_Func[CrossoverId] <- function(SUser, ItemId) { + //获取账号金库对象 + local CargoObj = SUser.GetAccountCargo(); + //获取账号金库中的一个空格子 + local EmptySlot = CargoObj.GetEmptySlot(); + + //如果没有空格子 + if (EmptySlot == -1) { + SUser.SendNotiPacketMessage(CrossoverStr2, 8); + //不扣除道具 + SUser.GiveItem(ItemId, 1); + return; + } + + //获取角色背包 + local InvenObj = SUser.GetInven(); + //获取需要转移的装备 这里默认写的装备栏第一个格子 + local ItemObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9); + //获取装备名字 + local ItemName = PvfItem.GetNameById(ItemObj.GetIndex()); + //如果没找到这个格子的装备 + if (!ItemName) { + SUser.SendNotiPacketMessage(CrossoverStr1, 8); + //不扣除道具 + SUser.GiveItem(ItemId, 1); + return; + } + //跨界 + local Flag = CargoObj.InsertItem(ItemObj, EmptySlot); + if (Flag == -1) { + SUser.SendNotiPacketMessage(CrossoverStr3, 8); + //不扣除道具 + SUser.GiveItem(ItemId, 1); + } else { + //销毁背包中的道具 + ItemObj.Delete(); + //刷新玩家背包列表 + SUser.SendUpdateItemList(1, 0, 9); + //刷新账号金库列表 + CargoObj.SendItemList(); + SUser.SendNotiPacketMessage(format(CrossoverStr4, ItemName), 7); + } +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/跨界石.nut"); +``` + + +> 至此一个简单的跨界石的逻辑就写完了,然后我们就可以在游戏中使用道具7577来跨界了 \ No newline at end of file diff --git a/Start/Example/3.md b/Start/Example/3.md new file mode 100644 index 0000000..f63bcd9 --- /dev/null +++ b/Start/Example/3.md @@ -0,0 +1,82 @@ +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 融合石.nut 用于编写我们的代码 + + + +> 然后我们在融合石.nut中写入以下代码 + +``` +//本例子由凌众提供 + +//装备代码1 装备代码2 融合后产出代码 +Ronghe_Config <- { +"27601,27601",27601 +} + +Cb_Use_Item_Sp_Func[7577] <- function(SUser, ItemId) { + //获取玩家背包 + local InvenObj = SUser.GetInven(); + //如果背包存在 + if (InvenObj) { + //获取玩家背包类型1的第9个格子 + local ItemObj = InvenObj.GetSlot(1, 9); + local ItemObj2 = InvenObj.GetSlot(1, 10); + //空装备 + if (ItemObj.IsEmpty || ItemObj2.IsEmpty) { + //发送通知 + SUser.SendNotiPacketMessage("装备融合失败,请检查装备位置是否正确", 8); + //返还消耗的道具 + local test = SUser.GiveItem(ItemId, 1); + return; + } + local ItemId1 = ItemObj.GetIndex(); + local ItemId2 = ItemObj2.GetIndex(); + local Skey = ItemId1 + "," + ItemId2; + + if (!(Skey in Ronghe_Config)) { + //发送通知 + SUser.SendNotiPacketMessage("装备融合失败,装备不可融合", 8); + //返还消耗的道具 + SUser.GiveItem(ItemId, 1); + return; + } + local itemid3 = Ronghe_Config[Skey]; + local item = SUser.GiveItem(itemid3, 1); + //最后获得的道具 + local reitem = InvenObj.GetSlot(1, item[1]); + + local dz = ItemObj.GetForging(); + local qh = ItemObj.GetUpgrade(); + local zf = ItemObj.GetAmplification(); + local fm = ItemObj.GetEnchanting(); + local pj = ItemObj.GetAdd_Info(); + + ItemObj.Delete(); + ItemObj2.Delete(); + + reitem.SetForging(dz); + reitem.SetUpgrade(qh); + reitem.SetAmplification(zf); + reitem.SetEnchanting(fm); + reitem.SetAdd_Info(pj); + reitem.Flush(); + + SUser.SendItemSpace(0); + SUser.SendNotiPacketMessage("装备融合成功", 8); + } +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/融合石.nut"); +``` + + +> 至此一个简单的融合石的逻辑就写完了,然后我们就可以在游戏中使用道具7577来融合了 \ No newline at end of file diff --git a/Start/Example/4.md b/Start/Example/4.md new file mode 100644 index 0000000..37cf32d --- /dev/null +++ b/Start/Example/4.md @@ -0,0 +1,180 @@ +## 装备继承卷 (贡献者: X) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 装备继承卷.nut 用于编写我们的代码 + + + +> 然后我们在装备继承卷.nut中写入以下代码 + +``` +//本例子由X提供 + + +//提示弹窗需配合233.dll插件(插件在群文件内)。不用233插件请将此方法SUser.SendNotiBox("这里写提示文字",1);修改为SUser.SendNotiPacketMessage("这里写提示文字", 8); +Cb_Use_Item_Sp_Func[2023629246] <- function(SUser, ItemId) { + local InvenObj = SUser.GetInven(); + if (InvenObj) { + //获取玩家背包类型1的第9个格子 + local ItemObj1 = InvenObj.GetSlot(1, 9); + local ItemObj2 = InvenObj.GetSlot(1, 10); + + + //空装备 + if (ItemObj1.IsEmpty || ItemObj2.IsEmpty) { + //发送通知 + SUser.SendNotiBox("请将已强化/增幅/锻造的装备放到\n[装备栏] 的第一格,要继承的装备放到第二格。", 1); + //返还消耗的道具 + SUser.GiveItem(ItemId, 1); + return; + } + //获取物品ID + local ItemId1 = ItemObj1.GetIndex(); + local ItemId2 = ItemObj2.GetIndex(); + + + + //限制类型 10=武器;称号=11;16=腰带;15=鞋子;14=下装;13=护肩;12=上衣;项链=17;手镯=18;戒指=19;魔法石=21;辅助装备=20; + local itemType1 = PvfItem.GetPvfData(ItemId1).add(141 * 4).readU32(); + local itemType2 = PvfItem.GetPvfData(ItemId2).add(141 * 4).readU32(); + if (itemType1 == 11 || itemType2 == 11) { + SUser.SendNotiBox("继承或要继承的装备不能是称号!", 1); + SUser.GiveItem(ItemId, 1); + return; + } + if (itemType1 == 10) { + if (itemType1 == itemType2) { + jc(SUser, ItemId, ItemObj1, ItemObj2); + } else { + SUser.SendNotiBox("继承失败!\n[武器]\n只能继承至:\n[武器]", 1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + + if (itemType1 == 17 || itemType1 == 18 || itemType1 == 19) { + if (itemType2 == 17 || itemType2 == 18 || itemType2 == 19) { + jc(SUser, ItemId, ItemObj1, ItemObj2); + } else { + SUser.SendNotiBox("继承失败!\n[首饰]\n只能继承至:\n[首饰]", 1); + SUser.GiveItem(ItemId, 1); + + } + return; + } + + + if (itemType1 == 21 || itemType1 == 20) { + if (itemType2 == 21 || itemType2 == 20) { + + jc(SUser, ItemId, ItemObj1, ItemObj2); + } else { + SUser.SendNotiBox("继承失败!\n[魔法石、辅助装备]只能继承至:\n[魔法石或辅助装备]", 1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + + if (itemType1 == 12 || itemType1 == 13 || itemType1 == 14 || itemType1 == 15 || itemType1 == 16) { + if (itemType2 == 12 || itemType2 == 13 || itemType2 == 14 || itemType2 == 15 || itemType2 == 16) { + + jc(SUser, ItemId, ItemObj1, ItemObj2); + } else { + SUser.SendNotiBox("继承失败!\n[护肩、上衣、下装、腰带、鞋]\n只能继承至:\n[护肩、上衣、下装、腰带、鞋]", 1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + + } else { + SUser.GiveItem(ItemId, 1); + SUser.SendNotiBox("遇到错误,暂无法继承。", 1); + } + + +} + +function jc(SUser, ItemId, ItemObj1, ItemObj2) { + SUser.SendNotiPacketMessage("开始继承了", 8); + //获取物品ID + local ItemId1 = ItemObj1.GetIndex(); + local ItemId2 = ItemObj2.GetIndex(); + + + //获得pvf中物品 + local PvfItem1 = PvfItem.GetPvfItemById(ItemId1); + local PvfItem2 = PvfItem.GetPvfItemById(ItemId2); + //获取装备名称 + local itemName1 = PvfItem1.GetName(); + local itemName2 = PvfItem2.GetName(); + + + + //获取物品1和2的等级与品级 + local itemLevel1 = PvfItem1.GetUsableLevel(); + local itemLevel2 = PvfItem2.GetUsableLevel(); + //限制继承装备的级别 + if (itemLevel1< 60 || itemLevel2< 60) { + SUser.SendNotiBox("只有大于或者等于 【60级】 的装备才可以继承。", 1); + SUser.GiveItem(ItemId, 1); + return; + } + + //获取品级 + local itemRarity1 = PvfItem1.GetRarity(); + local itemRarity2 = PvfItem2.GetRarity(); + //限制品级 + if (itemRarity1< 3 || itemRarity2< 3) { + SUser.SendNotiBox("只有 【神器】 以上的品级才能继承。", 1); + SUser.GiveItem(ItemId, 1); + return; + } + + //获取物品1的属性 + local itemType1 = PvfItem.GetPvfData(ItemId1).add(141 * 4).readU32(); + local itemType2 = PvfItem.GetPvfData(ItemId2).add(141 * 4).readU32(); + local forging = ItemObj1.GetForging(); //锻造 + local upgrade = ItemObj1.GetUpgrade(); //强化 + local amplification = ItemObj1.GetAmplification(); //增幅 + local enchanting = ItemObj1.GetEnchanting(); //附魔 + + if (itemType1 == 10 && itemType2 == 10 && forging > 0) { + ItemObj2.SetForging(forging); + } + + if (upgrade > 0) { + ItemObj2.SetUpgrade(upgrade); + } + + if (amplification != 0) { + ItemObj2.SetAmplification(amplification); + } + ItemObj2.SetEnchanting(enchanting); + + //删除原武器,若不删除就把原武器的属性清掉。 + ItemObj1.Delete(); + //刷新背包 + SUser.SendUpdateItemList(1, 0, 9); + ItemObj2.Flush(); + SUser.SendUpdateItemList(1, 0, 10); + SUser.SendNotiBox("装备继承成功!\n获得:\n[+" + upgrade + " " + itemName2 + "]", 1); + return; +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/装备继承卷.nut"); +``` + + +> 至此一个简单的装备继承卷的逻辑就写完了,然后我们就可以在游戏中使用道具7577来融合了 \ No newline at end of file diff --git a/Start/Example/5.md b/Start/Example/5.md new file mode 100644 index 0000000..e855a13 --- /dev/null +++ b/Start/Example/5.md @@ -0,0 +1,93 @@ +## 主线任务完成卷 (贡献者: Trim) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 主线任务完成卷.nut 用于编写我们的代码 + + + +> 然后我们在主线任务完成卷.nut中写入以下代码 + +``` +//本例子由 Trim 提供 + + + +//主线任务完成卷ID +CrossoverId <- 7577; + +Cb_Use_Item_Sp_Func[CrossoverId] <- function(SUser, ItemId) { + // 不需要完成的任务ID数组 + local skippedQuestIDs = [674]; //将不要清理的任务ID写入数组内即可 + + // 获取角色任务信息和等级 + local userQuest = SUser.GetQuest(); + local questIsClear = NativePointer(userQuest).add(4); + local characLevel = SUser.GetCharacLevel(); + local allClearQuest = 0; + + // 获取 pvf 数据 + local DataManager = Sq_CallFunc(S_Ptr("0x80CC19B"), "pointer", []); + + // 判断任务是否需要跳过 + function shouldSkip(questID) { + return skippedQuestIDs.find(questID) != null; + } + + // 判断任务是否为主线并且角色等级符合要求 + function isMainQuestAndLevelValid(pvfQuest, characLevel) { + local questGrade = NativePointer(pvfQuest).add(8).readInt(); + local questLv = NativePointer(pvfQuest).add(0x20).readInt(); + return questGrade == 0 && questLv <= characLevel; + } + + // 判断任务是否已完成 + function isQuestCleared(questID) { + return Sq_CallFunc(S_Ptr("0x808BAE0"), "bool", ["pointer", "int"], questIsClear.C_Object, questID); + } + + // 设置任务为已完成 + function clearQuest(questID) { + Sq_CallFunc(S_Ptr("0x808BA78"), "int", ["pointer", "int"], questIsClear.C_Object, questID); + } + + // 循环处理任务 + for (local questID = 1; questID< 30000; questID++) { + // 从 pvf 中获取任务数据 + local pvfQuest = Sq_CallFunc(S_Ptr("0x835FDC6"), "pointer", ["pointer", "int"], DataManager, questID); + if (!pvfQuest || shouldSkip(questID)) continue; // 跳过空任务或不需要完成的任务 + + // 判断是否为主线任务且等级符合要求 + if (!isMainQuestAndLevelValid(pvfQuest, characLevel)) continue; + + // 判断任务是否已完成,若未完成则清理任务 + if (!isQuestCleared(questID)) { + clearQuest(questID); + allClearQuest++; + } + } + + + local Pack = Packet(); + //通知客户端刷新任务列表 + Sq_CallFunc(S_Ptr("0x86ABBA8"), "int", ["pointer", "pointer"], userQuest, Pack.C_Object); + SUser.Send(Pack); + Pack.Delete(); + + // 发送通知 + SUser.SendNotiPacketMessage("已清理:" + allClearQuest + "个主线任务!", 8); +} +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/主线任务完成卷.nut"); +``` + + +> 至此一个简单的主线任务完成卷的逻辑就写完了,然后我们就可以在游戏中使用道具7577来完成主线任务了 \ No newline at end of file diff --git a/Start/Example/6.md b/Start/Example/6.md new file mode 100644 index 0000000..eef5073 --- /dev/null +++ b/Start/Example/6.md @@ -0,0 +1,96 @@ +## 史诗掉落奖励 (贡献者: 凌众) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 史诗掉落奖励.nut 用于编写我们的代码 + + + +> 然后我们在史诗掉落奖励.nut中写入以下代码 + +``` +//本例子由 凌众 提供 +//单次副本累计掉落史诗奖励 +rewardAmountMap <- { + "4": 3000, + "5": 5000, + "6": 20000 +} +//掉落特定史诗奖励 比如涂鸦笔和无影剑 顺便发全服公告 参数为 物品id ,奖励的点券,公告,公告类型 +rewardAmountOnId <- { + "34253": [3000, "恭喜玩家[%s]在地下城深渊挑战中获得了[%s] 让我们恭喜这个b", 14], + "27098": [5000, "恭喜玩家[%s]在地下城深渊挑战中获得了[%s] 让我们恭喜这个b", 14], +} + +userCounters <- {} +dgnname <- {} + +//离开副本 +Cb_History_DungeonLeave_Func.RindroSSDL <- function(SUser, Data) { + local num = userCounters[SUser.GetCID()]; + local rewardAmount = 0; + local numS = num.tostring(); + if (numS in rewardAmountMap) { + rewardAmount = rewardAmountMap[numS] + } + + if (rewardAmount == 0) return; + World.SendNotiPacketMessage("玩家" + SUser.GetCharacName() + "在" + Data[14] + "中获得了" + userCounters[SUser.GetCID()].tostring() + "件史诗装备 奖励" + rewardAmount + "点券", 14); + + SUser.RechargeCera(rewardAmount) + userCounters[SUser.GetCID()] <- 0; +} + + +//进入副本 +Cb_History_DungeonEnter_Func.RindroSSDL <- function(SUser, Data) { + + userCounters[SUser.GetCID()] <- 0; + + dgnname[SUser.GetCID()] <- Data[14]; + +} + + +//拾取道具 +Cb_User_Get_Item_Leave_Func.RindroSSDL <- function(args) { + local itemId = args[2]; + + local SUser = User(args[1]); + local pvfitem = PvfItem.GetPvfItemById(itemId); + + + local itemids = itemId.tostring(); + //这里发放特定道具的奖励 + if (itemids in rewardAmountOnId) { + local rewardAmount = rewardAmountOnId[itemids][0]; + local msg = format(rewardAmountOnId[itemids][1], SUser.GetCharacName(), pvfitem.GetName()); + World.SendNotiPacketMessage(msg, 14); + SUser.RechargeCera(rewardAmount) + } + + + if (!pvfitem.IsStackable() == 0) return; + + local rarity = pvfitem.GetRarity(); + local level = pvfitem.GetUsableLevel(); + if (pvfitem == 4 && level > 10) { + userCounters[SUser.GetCID()]++; + } + userCounters[SUser.GetCID()]++; + return null; +}; + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/史诗掉落奖励.nut"); +``` + +> 至此一个简单的史诗掉落奖励的逻辑就写完了 \ No newline at end of file diff --git a/Start/Example/7.md b/Start/Example/7.md new file mode 100644 index 0000000..d40c414 --- /dev/null +++ b/Start/Example/7.md @@ -0,0 +1,48 @@ +## 公会讲话互通 (贡献者: 凌众) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 公会讲话互通.nut 用于编写我们的代码 + + + +> 然后我们在公会讲话互通.nut中写入以下代码 + +``` +//本例子由凌众提供 + +//输入hook +Cb_Server_Chat_Log_Leave_Func.RindroGHHT <- function(args) { + local type = args[2]; + + local SUser = User(args[1]); + local msg = args[3]; + if (type == 6) { + local guildName = SUser.GetGuildName(); + local name = SUser.GetCharacName(); + //遍历在线玩家 + local users = World.GetOnlinePlayer() + + users.apply(function(Value) { + local onguildName = Value.GetGuildName(); + if (guildName != onguildName) { + Value.SendNotiPacketMessage(name + "[" + guildName + "] :" + msg, 6) + } + }); + } + return null; +} + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/公会讲话互通.nut"); +``` + +> 至此一个简单的公会讲话互通的逻辑就写完了,这样其他公会的人也能互相看到了 \ No newline at end of file diff --git a/Start/Example/8.md b/Start/Example/8.md new file mode 100644 index 0000000..42ae5eb --- /dev/null +++ b/Start/Example/8.md @@ -0,0 +1,58 @@ +## 分解券 (贡献者: 凌众) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 分解券.nut 用于编写我们的代码 + + + +> 然后我们在分解券.nut中写入以下代码 + +``` +//本例子由凌众提供 + +//分解券 +Cb_Use_Item_Sp_Func[7577] <- function(SUser, ItemId) { + SUser.GiveItem(ItemId, 1); + + local is = SUser.GetCurCharacExpertJob(); + if (!is) { + SUser.SendNotiPacketMessage("未开启分解机", 8); + return; + } + local inven = SUser.GetInven(); + + for (local i = 9; i <= 48; i++) //<=16为一行 以此类推+8多一行 + { + local itemObj = inven.GetSlot(1, i); + local itemid = itemObj.GetIndex(); + + //如果这个位置有道具 + if (itemid != 0) { + + local pvfitem = PvfItem.GetPvfItemById(itemid); + + local rarity = pvfitem.GetRarity(); + if (rarity <= 3) { + SUser.DisPatcher_DisJointItem_disjoint(i); + } + } + SUser.SendItemSpace(0); + + } + +}; + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/分解券.nut"); +``` + +> 至此一个简单的分解券的逻辑就写完了,这样其他公会的人也能互相看到了 \ No newline at end of file diff --git a/Start/Example/9.md b/Start/Example/9.md new file mode 100644 index 0000000..550f55a --- /dev/null +++ b/Start/Example/9.md @@ -0,0 +1,184 @@ +## 装备继承券 (贡献者: X) + +> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理 + + + +> 然后我们建立一个新文件 装备继承券.nut 用于编写我们的代码 + + + +> 然后我们在装备继承券.nut中写入以下代码 + +``` +Cb_Use_Item_Sp_Func[2023629246] <- function(SUser, ItemId) { +local InvenObj = SUser.GetInven(); +if(InvenObj){ + //获取玩家背包类型1的第9个格子 + local ItemObj1 = InvenObj.GetSlot(1, 9); + local ItemObj2 = InvenObj.GetSlot(1, 10); + + + //空装备 + if (ItemObj1.IsEmpty || ItemObj2.IsEmpty) { + //发送通知 + SUser.SendNotiBox("请将已强化/增幅/锻造的装备放到\n[装备栏] 的第一格,要继承的装备放到第二格。",1); + //返还消耗的道具 + SUser.GiveItem(ItemId, 1); + return; + } + //获取物品ID + local ItemId1 = ItemObj1.GetIndex(); + local ItemId2 = ItemObj2.GetIndex(); + + + + //限制类型 10=武器;称号=11;16=腰带;15=鞋子;14=下装;13=护肩;12=上衣;项链=17;手镯=18;戒指=19;魔法石=21;辅助装备=20; + + local pP1 = PvfItem.GetPvfItemById(ItemId1); + + local itemType1 = NativePointer(pP1.C_Object).add(141*4).readU32(); + + local pP2 = PvfItem.GetPvfItemById(ItemId2); + + local itemType2 = NativePointer(pP2.C_Object).add(141*4).readU32(); + + + if(itemType1==11 || itemType2 ==11){ + SUser.SendNotiBox("继承或要继承的装备不能是称号!",1); + SUser.GiveItem(ItemId, 1); + return; + } + if(itemType1==10){ + if(itemType1==itemType2){ + jc(SUser,ItemObj1,ItemObj2); + }else{ + SUser.SendNotiBox("继承失败!\n[武器]\n只能继承至:\n[武器]",1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + + if(itemType1==17||itemType1==18||itemType1==19){ + if(itemType2==17||itemType2==18||itemType2==19){ + jc(SUser,ItemObj1,ItemObj2); + }else{ + SUser.SendNotiBox("继承失败!\n[首饰]\n只能继承至:\n[首饰]",1); + SUser.GiveItem(ItemId, 1); + + } + return; + } + + + if(itemType1==21||itemType1==20){ + if(itemType2==21||itemType2==20){ + + jc(SUser,ItemObj1,ItemObj2); + }else{ + SUser.SendNotiBox("继承失败!\n[魔法石、辅助装备]只能继承至:\n[魔法石或辅助装备]",1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + + if(itemType1==12||itemType1==13||itemType1==14||itemType1==15||itemType1==16){ + if(itemType2==12||itemType2==13||itemType2==14||itemType2==15||itemType2==16){ + + jc(SUser,ItemObj1,ItemObj2); + }else{ + SUser.SendNotiBox("继承失败!\n[护肩、上衣、下装、腰带、鞋]\n只能继承至:\n[护肩、上衣、下装、腰带、鞋]",1); + SUser.GiveItem(ItemId, 1); + return; + } + return; + } + +}else{ + SUser.GiveItem(ItemId, 1); + SUser.SendNotiBox("遇到错误,暂无法继承。",1); +} + + +} + +function jc(SUser,ItemObj1,ItemObj2){ + + //获取物品ID + local ItemId1 = ItemObj1.GetIndex(); + local ItemId2 = ItemObj2.GetIndex(); + + + //获得pvf中物品 + local PvfItem1 = PvfItem.GetPvfItemById(ItemId1); + local PvfItem2 = PvfItem.GetPvfItemById(ItemId2); + //获取装备名称 + local itemName1 = PvfItem1.GetName(); + local itemName2 = PvfItem2.GetName(); + + + + //获取物品1和2的等级与品级 + local itemLevel1 = PvfItem1.GetUsableLevel(); + local itemLevel2 = PvfItem2.GetUsableLevel(); + //限制继承装备的级别 + if(itemLevel1<60 ||itemLevel2<60){ + SUser.SendNotiBox("只有大于或者等于 【60级】 的装备才可以继承。",1); + SUser.GiveItem(ItemId, 1); + return; + } + + //获取品级 + local itemRarity1 = PvfItem1.GetRarity(); + local itemRarity2 = PvfItem2.GetRarity(); + //限制品级 + if(itemRarity1<3||itemRarity2<3){ + SUser.SendNotiBox("只有 【神器】 以上的品级才能继承。",1); + SUser.GiveItem(ItemId, 1); + return; + } + + + + + local forging = ItemObj1.GetForging();//锻造 + local upgrade = ItemObj1.GetUpgrade();//强化 + local amplification = ItemObj1.GetAmplification();//增幅 + local enchanting = ItemObj1.GetEnchanting();//附魔 + + if(forging>0){ + ItemObj2.SetForging(forging); + } + + if(upgrade>0){ + ItemObj2.SetUpgrade(upgrade); + } + + if(amplification!=0){ + ItemObj2.SetAmplification(amplification); + } + ItemObj2.SetEnchanting(enchanting); + + //删除原武器,若不删除就把原武器的属性清掉。 + ItemObj1.Delete(); + //刷新背包 + SUser.SendUpdateItemList(1, 0, 9); + ItemObj2.Flush(); + SUser.SendUpdateItemList(1, 0, 10); + SUser.SendNotiBox("装备继承成功!\n获得:\n[+"+upgrade+" "+itemName2+"]",1); + return; +} + +``` + + + +> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑 + +``` +sq_RunScript("MyProject/装备继承券.nut"); +``` + +> 至此一个简单的装备继承券的逻辑就写完了 \ No newline at end of file diff --git a/Update/Update.md b/Update/Update.md new file mode 100644 index 0000000..1e5f72b --- /dev/null +++ b/Update/Update.md @@ -0,0 +1,100 @@ +# 更新 文档 + +**20240914**: +### 新增四个回调接口 +`判断玩家城镇移动 获取地下城通关难度 锻造过程 购买商城物品` + +--- + +**20240916**: +### 新增SUser 接口 +`获取玩家账号金库` + +### 账号金库 类 +`获取空格子 存储物品 刷新列表` + +### 例子 +`跨界石` + +--- + +**20240917**: +### 新增Memory 类 +`Memory` +### NativePointer 类 +`NativePointer` + + +### 例子 +`融合石` + +--- + +**20240918**: +### 新增SUser 接口 +`发送自定义文本弹窗公告(需要客户端修复233包补丁)` + +### 新增NativePointer类 接口 +`readPointer` + +### 新增GameManager类 接口 +`SetGameMaxLevel` 设置游戏最大等级 +`SetItemLockTime` 设置装备解锁需要时间 + +### 新增入口函数sqr_main 函数 +``` +function sqr_main() +{ + print("插件已加载"); +} +``` +`-服务端将在初始化完毕以后调用sqr_main 函数` + + +--- + +**20240920**: +### 新增IO 类 + +### 新增MD5 类 + +### 新增Mysql 类 + +### 新增Timer 类 + + + + +--- + +**20241023**: +### 新增HTTP 类 + +### 新增BlobEx 类 + +### 新增ScriptData 类 + +### 新增AdMsg 类 + +### Item 类 +`新增部分接口` + +### 新增Hook接口若干 + +### 新增简繁转化接口 +``` + local Trad = Sq_Conversion("這是繁體語句", 0); + local Simple = Sq_Conversion("这是简体语句", 1); + print(Trad); + print(Simple); +``` + +### 新增获取毫秒级时间戳接口 +``` + Sq_GetTimestampString(); +``` + + + + + diff --git a/_sidebar.md b/_sidebar.md new file mode 100644 index 0000000..fd5b113 --- /dev/null +++ b/_sidebar.md @@ -0,0 +1,66 @@ + + +* [首页](/) +* [入门](/) + - [如何安装](Start/1.md) + - [快速开始](/) + - [使用道具提升武器锻造等级](Start/Example/1.md) + - [注册使用跨界石](Start/Example/2.md) + - [注册装备融合石](Start/Example/3.md) + - [注册装备继承卷](Start/Example/4.md) + - [注册主线任务完成卷](Start/Example/5.md) + - [深渊史诗掉落奖励](Start/Example/6.md) + - [公会互通](Start/Example/7.md) + - [分解券](Start/Example/8.md) + - [装备继承券](Start/Example/9.md) + - [任务清理券大全](Start/Example/10.md) + - [通关时间播报](Start/Example/11.md) + - [在线泡点](Start/Example/12.md) + - [副本难度解锁](Start/Example/13.md) + - [反外挂](Start/Example/14.md) + - [装备和时装镶嵌](Start/Example/15.md) +* [API文档](/) + - [对象类](/) + - [User 类](Object/User/User.md) + - [World 类](Object/World/World.md) + - [PvfItem 类](Object/PvfItem/PvfItem.md) + - [Party 类](Object/Party/Party.md) + - [Pack 类](Object/Pack/Pack.md) + - [Math 类](Object/Math/Math.md) + - [Item 类](Object/Item/Item.md) + - [Inven 类](Object/Inven/Inven.md) + - [Dungeon 类](Object/Dungeon/Dungeon.md) + - [GameManager 类](Object/GameManager/GameManager.md) + - [AccountCargo 类](Object/AccountCargo/AccountCargo.md) + - [Memory 类](Object/Memory/Memory.md) + - [NativePointer 类](Object/NativePointer/NativePointer.md) + - [IO 类](Object/IO/IO.md) + - [MD5 类](Object/MD5/MD5.md) + - [Mysql 类](Object/Mysql/Mysql.md) + - [Timer 类](Object/Timer/Timer.md) + - [Log 类](Object/Log/Log.md) + - [Http 类](Object/Http/Http.md) + - [ScriptData 类](Object/ScriptData/ScriptData.md) + - [AdMsg 类](Object/AdMsg/AdMsg.md) + - [回调类](/) + - [Proc 回调](CallBack/Timer_Dispatch/Timer_Dispatch.md) + - [普通输入 回调](CallBack/Base_Input/Base_Input.md) + - [GM输入 回调](CallBack/Gm_Input/Gm_Input.md) + - [BOSS死亡 回调](CallBack/BossDie/BossDie.md) + - [玩家更换装备 回调](CallBack/Player_Chanage_Equ/Player_Chanage_Equ.md) + - [玩家退出 回调](CallBack/Chacter_Exit/Chacter_Exit.md) + - [玩家上线 回调](CallBack/Reach_Game_World/Reach_Game_World.md) + - [返回选择角色 回调](CallBack/Return_SelectCharacter/Return_SelectCharacter.md) + - [玩家放弃副本 回调](CallBack/GiveupDgn/GiveupDgn.md) + - [玩家使用特殊道具 回调](CallBack/Use_Item_Sp/Use_Item_Sp.md) + - [判断玩家城镇移动 回调](CallBack/CheckMoveTown/CheckMoveTown.md) + - [获取地下城通关难度 回调](CallBack/GetClearedDungeonDiff/GetClearedDungeonDiff.md) + - [锻造过程 回调](CallBack/CItemUpgrade_Separate/CItemUpgrade_Separate.md) + - [购买商城物品 回调](CallBack/BuyCeraShopItem/BuyCeraShopItem.md) + - [动态调用Call](ActiveCall/ActiveCall.md) + - [脚本热更新重载](HotLoadScript/HotLoadScript.md) + - [自动脚本热更新重载](AutoHotLoadScript/AutoHotLoadScript.md) + - [集成回调函数](AllCallBack/AllCallBack.md) +* [贡献名单](Contributor/Contributor.md) +* [更新日志](Update/Update.md) +* [关于](关于.md) \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/folder-alias.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/image/1.png b/image/1.png new file mode 100644 index 0000000..4936288 Binary files /dev/null and b/image/1.png differ diff --git a/image/10.png b/image/10.png new file mode 100644 index 0000000..b130e44 Binary files /dev/null and b/image/10.png differ diff --git a/image/11.png b/image/11.png new file mode 100644 index 0000000..9fa6654 Binary files /dev/null and b/image/11.png differ diff --git a/image/12.png b/image/12.png new file mode 100644 index 0000000..58c79b6 Binary files /dev/null and b/image/12.png differ diff --git a/image/13.png b/image/13.png new file mode 100644 index 0000000..c6ea98b Binary files /dev/null and b/image/13.png differ diff --git a/image/14.png b/image/14.png new file mode 100644 index 0000000..13c8427 Binary files /dev/null and b/image/14.png differ diff --git a/image/15.png b/image/15.png new file mode 100644 index 0000000..cd13de8 Binary files /dev/null and b/image/15.png differ diff --git a/image/16.png b/image/16.png new file mode 100644 index 0000000..a859e32 Binary files /dev/null and b/image/16.png differ diff --git a/image/17.png b/image/17.png new file mode 100644 index 0000000..f038fd3 Binary files /dev/null and b/image/17.png differ diff --git a/image/18.png b/image/18.png new file mode 100644 index 0000000..4581c56 Binary files /dev/null and b/image/18.png differ diff --git a/image/19.png b/image/19.png new file mode 100644 index 0000000..095d333 Binary files /dev/null and b/image/19.png differ diff --git a/image/2.png b/image/2.png new file mode 100644 index 0000000..8f853cc Binary files /dev/null and b/image/2.png differ diff --git a/image/20.png b/image/20.png new file mode 100644 index 0000000..5d33a67 Binary files /dev/null and b/image/20.png differ diff --git a/image/21.png b/image/21.png new file mode 100644 index 0000000..76c9ab8 Binary files /dev/null and b/image/21.png differ diff --git a/image/22.png b/image/22.png new file mode 100644 index 0000000..3bf6f6a Binary files /dev/null and b/image/22.png differ diff --git a/image/23.png b/image/23.png new file mode 100644 index 0000000..7d39b5f Binary files /dev/null and b/image/23.png differ diff --git a/image/24.png b/image/24.png new file mode 100644 index 0000000..587769b Binary files /dev/null and b/image/24.png differ diff --git a/image/25.png b/image/25.png new file mode 100644 index 0000000..dee5102 Binary files /dev/null and b/image/25.png differ diff --git a/image/26.png b/image/26.png new file mode 100644 index 0000000..28e9596 Binary files /dev/null and b/image/26.png differ diff --git a/image/27.png b/image/27.png new file mode 100644 index 0000000..b3d0b5b Binary files /dev/null and b/image/27.png differ diff --git a/image/28.png b/image/28.png new file mode 100644 index 0000000..08ed16d Binary files /dev/null and b/image/28.png differ diff --git a/image/29.png b/image/29.png new file mode 100644 index 0000000..f622e8d Binary files /dev/null and b/image/29.png differ diff --git a/image/3.png b/image/3.png new file mode 100644 index 0000000..3c9a921 Binary files /dev/null and b/image/3.png differ diff --git a/image/30.png b/image/30.png new file mode 100644 index 0000000..262681c Binary files /dev/null and b/image/30.png differ diff --git a/image/31.png b/image/31.png new file mode 100644 index 0000000..eed5203 Binary files /dev/null and b/image/31.png differ diff --git a/image/4.png b/image/4.png new file mode 100644 index 0000000..0f4d8fa Binary files /dev/null and b/image/4.png differ diff --git a/image/5.png b/image/5.png new file mode 100644 index 0000000..4603b58 Binary files /dev/null and b/image/5.png differ diff --git a/image/6.png b/image/6.png new file mode 100644 index 0000000..1e20477 Binary files /dev/null and b/image/6.png differ diff --git a/image/7.png b/image/7.png new file mode 100644 index 0000000..1fe6755 Binary files /dev/null and b/image/7.png differ diff --git a/image/8.png b/image/8.png new file mode 100644 index 0000000..a0225a9 Binary files /dev/null and b/image/8.png differ diff --git a/image/9.png b/image/9.png new file mode 100644 index 0000000..8fbbc21 Binary files /dev/null and b/image/9.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..55a3592 --- /dev/null +++ b/index.html @@ -0,0 +1,44 @@ + + +
+ +