diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bb14cf9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "Codegeex.RepoIndex": true +} \ No newline at end of file diff --git a/Dps_A/BaseClass/BigInt/BigInt.nut b/Dps_A/BaseClass/BigInt/BigInt.nut new file mode 100644 index 0000000..a5005d1 --- /dev/null +++ b/Dps_A/BaseClass/BigInt/BigInt.nut @@ -0,0 +1,6 @@ +/* +文件名:BigInt.nut +路径:Dps_A/BaseClass/BigInt/BigInt.nut +创建日期:2025-03-25 18:28 +文件用途:大数字类 +*/ diff --git a/Dps_A/BaseClass/BlobExClass/BlobExClass.nut b/Dps_A/BaseClass/BlobExClass/BlobExClass.nut index 513f076..0326010 100644 --- a/Dps_A/BaseClass/BlobExClass/BlobExClass.nut +++ b/Dps_A/BaseClass/BlobExClass/BlobExClass.nut @@ -56,4 +56,66 @@ class BlobEx extends blob { return stream_myreadstring(count); } +} + +class blobex extends blob { + + //-----------------Metamethods--------------------// + function _typeof() { + return "blobex"; + } + //-----------------Metamethods--------------------// + + constructor(arg) { + //通过blob构造 + if (typeof arg == "blob") { + base.constructor(arg.len()); + writeblob(arg); + } + //直接构造 + else { + base.constructor(arg); + } + } + + function writeblob(B) { + base.writeblob(B); + seek(0); + } + + function GetUShort() { + return readn('w'); + } + + function GetShort() { + return readn('s'); + } + + function charPtrToInt(arr) { + local value = ((arr[0]) << 0) | + ((arr[1]) << 8) | + ((arr[2]) << 16) | + ((arr[3]) << 24); + return value; + } + + function GetInt() { + local CurTPos = tell(); + local Ret = charPtrToInt([this[CurTPos], this[CurTPos + 1], this[CurTPos + 2], this[CurTPos + 3]]); + seek(4, 'c'); + return Ret; + } + + function Get256() { + local Buf = readn('c'); + return (256.0 + Buf.tofloat()) % 256.0; + } + + function GetFloat() { + return readn('f'); + } + + function GetString(count) { + return stream_myreadstring(count); + } } \ No newline at end of file diff --git a/Dps_A/BaseClass/GameManagerClass/GameManagerClass.nut b/Dps_A/BaseClass/GameManagerClass/GameManagerClass.nut index fd4a9c2..2ab4314 100644 --- a/Dps_A/BaseClass/GameManagerClass/GameManagerClass.nut +++ b/Dps_A/BaseClass/GameManagerClass/GameManagerClass.nut @@ -94,6 +94,22 @@ class GameManager extends Base_C_Object { _AvatarUseJewel_Object <- AvatarUseJewel(); } + //开启装备镶嵌 + function FixEquipUseJewel() { + //装备镶嵌修复 + _EquimentUseJewel_Object <- EquimentUseJewel(); + } + + //修复14技能 + function Fix14Skill() { + Sq_WriteByteArr(S_Ptr("0x08604B1E"), [0x83, 0x7D, 0xEC, 0x07]); + Sq_WriteByteArr(S_Ptr("0x08604B8C"), [0xC7, 0x45, 0xE4, 0x08, 0x00, 0x00, 0x00]); + Sq_WriteByteArr(S_Ptr("0x08604A09"), [0x83, 0x7D, 0x0C, 0x07]); + Sq_WriteByteArr(S_Ptr("0x086050b1"), [0xC7, 0x45, 0xEC, 0x08, 0x00, 0x00, 0x00]); + Sq_WriteByteArr(S_Ptr("0x0860511c"), [0xC7, 0x45, 0xE8, 0x08, 0x00, 0x00, 0x00]); + Sq_WriteByteArr(S_Ptr("0x08608D7B"), [0x83, 0xF8, 0x0B]); + } + //修复下线卡城镇 function FixSaveTown() { Cb_Set_Charac_Info_Detail_Enter_Func._FixSaveTown_ <- function(arg) { @@ -158,6 +174,31 @@ class GameManager extends Base_C_Object { return null; }); } + + //副本可丢弃品级 传入一个值 3为神器 + function FixDungeonDropGrade(Level) { + NativePointer("0x085A69F2").writeS8(Level); + } + + //邮件去除验证 + function FixEmailRemovalVerification() { + //修改独立掉落原逻辑为不掉落 + local HexCode = Haker.AsmGenerateMcd( + "mov eax, 0x0", + "ret"); + Sq_WriteByteArr(S_Ptr("0x0868A51A"), HexCode); + } + + //修复拍卖行消耗品上架,设置最大总价,建议值2E + function Fix_Auction_Regist_Item() { + Haker.LoadHook("0x08213E40", ["int", "int", "bool"], + function(args) { + return null; + }, + function(args) { + return true; + }); + } } //热重载 function _Reload_List_Write_(Path) { diff --git a/Dps_A/BaseClass/HackerClass/HackerClass.nut b/Dps_A/BaseClass/HackerClass/HackerClass.nut index 8d3785b..2f1aa3b 100644 --- a/Dps_A/BaseClass/HackerClass/HackerClass.nut +++ b/Dps_A/BaseClass/HackerClass/HackerClass.nut @@ -7,10 +7,18 @@ class _Hacker { HookTable = null; + HookJumpMemoryTable = null; + + __strtol__function__address__ = null; + + NextReturnAddress = null; + constructor() { HookTable = {}; + HookJumpMemoryTable = {}; } + function UnLoadHook(AddressStr) { Sq_DeHookFunc(HookTable[AddressStr]); } @@ -23,9 +31,57 @@ class _Hacker { } local Controler = Sq_HookFunc(S_Ptr(AddressStr), ArgumentArr, EnterFunc, LeaveFunc); - print(Controler); HookTable.rawset(AddressStr, Controler); } + + + function HexStringToInt(Str) { + if (!__strtol__function__address__) __strtol__function__address__ = Module.getExportByName(null, "strtol"); + local Ret = Sq_CallFunc(__strtol__function__address__, "int", ["pointer", "pointer", "int"], Memory.allocUtf8String(Str).C_Object, Memory.alloc(0), 16); + return Ret; + } + + function AsmGenerateMcd(...) { + local CodeArr = []; + local CurCode = ""; + try { + foreach(Str in vargv) { + CurCode = Str; + local Code = Sq_Asmjit_Compile(Str); + CodeArr.extend(Code); + } + } catch (exception) { + error("汇编代码有误,错误行: " + CurCode); + } + return CodeArr; + } + + function InsertCode(Address, Code) { + //置入代码的大小 + local CodeSize = Code.len(); + //申请一块内存 + local MemBuffer = Memory.alloc(CodeSize); + //记录 + HookJumpMemoryTable.rawset(Address, MemBuffer); + //写入置入的代码 + MemBuffer.writeByteArray(Code); + + //计算偏移 + local Offset = Sq_PointerOperationPointer(MemBuffer.C_Object, Sq_PointerOperation(S_Ptr(Address), 5, "+"), "-"); + local Str = "" + Offset; + Str = Str.slice(Str.find("0x") + 4, -1); + local JumpCodeArr = [0xE9]; + for (local i = 0; i< 4; i++) { + local Index = -2 * (i + 1); + local StrBuffer = "0x" + (Str.slice(Index).slice(0, 2)); + JumpCodeArr.push(HexStringToInt(StrBuffer)); + } + Sq_WriteByteArr(S_Ptr(Address), JumpCodeArr); + } +} + +function _Haker_SetNextReturnAddress(Address) { + Haker.NextReturnAddress = "" + Address; } //初始化Hacker Haker <- _Hacker(); \ No newline at end of file diff --git a/Dps_A/BaseClass/HttpClass/HttpClass.nut b/Dps_A/BaseClass/HttpClass/HttpClass.nut index a17c96d..05d1e26 100644 --- a/Dps_A/BaseClass/HttpClass/HttpClass.nut +++ b/Dps_A/BaseClass/HttpClass/HttpClass.nut @@ -14,26 +14,276 @@ class Http { Service = service; } + // 辅助函数:将参数表编码为 URL 编码字符串 + function _EncodeParams(params) { + local encoded = ""; + foreach(key, value in params) { + if (encoded.len() > 0) encoded += "&"; + encoded += key + "=" + value; // 需要实现 urlencode + } + return encoded; + } + function Request(Type, Url, Content) { - local Request = Type + " " + Url + " HTTP/1.1\r\nHost: " + Host + "\r\n"; + local RequestBuffer = Type + " " + Url + " HTTP/1.1\r\nHost: " + Host + "\r\n"; if (Content) { - Request += "Content-Length: " + Content.len() + "\r\n"; - Request += "Content-Type: application/x-www-form-urlencoded\r\n"; - Request += "\r\n"; - Request += Content; + RequestBuffer += "Content-Length: " + Content.len() + "\r\n"; + RequestBuffer += "Content-Type: application/x-www-form-urlencoded\r\n"; + RequestBuffer += "\r\n"; + RequestBuffer += Content; } else { - Request += "Connection: close\r\n\r\n"; + RequestBuffer += "Connection: close\r\n\r\n"; } - return Sq_CreateHttp(Host, Service, Request); + return Sq_CreateHttp(Host, Service, RequestBuffer); } // 发送请求 - function Post(Url, Content = null) { - return Request("POST", Url, Content); + function Post(Url, params = null) { + local content = null; + if (params != null && typeof params == "table") { + content = _EncodeParams(params); // 编码参数 + } + return Request("POST", Url, content); } function Get(Url, Content = null) { return Request("GET", Url, Content); } + + + + + + + function xorEncryptDecrypt(BlobObj, Key) { + local Arr = []; + for (local i = 0; i< BlobObj.len(); i++) { + local currentKeyChar = Key[i % Key.len()]; + Arr.push(BlobObj[i] ^ currentKeyChar); + } + return Arr; + } + + function base64_encode(input) { + local base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + local inputLength = input.len(); + local i = 0; + local j = 0; + local charArray3 = array(3); + local charArray4 = array(4); + local encoded = ""; + + while (inputLength--) { + charArray3[i++] = input[inputLength]; + if (i == 3) { + charArray4[0] = (charArray3[0] & 0xfc) >> 2; + charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4); + charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6); + charArray4[3] = charArray3[2] & 0x3f; + + for (i = 0; i< 4; i++) { + encoded += base64_chars.slice(charArray4[i], charArray4[i] + 1); + } + i = 0; + } + } + + if (i) { + for (j = i; j< 3; j++) { + charArray3[j] = 0; + } + + charArray4[0] = (charArray3[0] & 0xfc) >> 2; + charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4); + charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6); + charArray4[3] = charArray3[2] & 0x3f; + + for (j = 0; j< i + 1; j++) { + encoded += base64_chars.slice(charArray4[j], charArray4[j] + 1); + } + + while (i++<3) { + encoded += "="; + } + } + return encoded; + } + + function AsciiToStr(code) { + local str = Memory.alloc(1); + str.writeS8(code); + return str.readUtf8String(); + } + + function base64_decode(input) { + local base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + local base64_map = {}; + for (local i = 0; i< base64_chars.len(); i++) { + local key = base64_chars.slice(i, i + 1); + if (key != "=") { + base64_map[key] <- i; + } + } + local inputLength = input.len(); + local i = 0; + local j = 0; + local charArray4 = array(4); + local charArray3 = array(3); + local decoded = []; + + while (inputLength--) { + if (input.slice(i, i + 1) == "=") { + charArray4[j++] = 0; + } else { + charArray4[j++] = base64_map[input.slice(i, i + 1)]; + } + i++; + if (j == 4) { + charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); + charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); + charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; + + for (j = 0; j< 3; j++) { + decoded.push(charArray3[j]); + } + j = 0; + } + } + + if (j) { + for (local k = j; k< 4; k++) { + charArray4[k] = 0; + } + + charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); + charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); + charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; + + for (local k = 0; k< j - 1; k++) { + decoded.push(charArray3[k]); + } + } + local ret = decoded.reverse(); + ret.remove(0); + ret.push(0); + return ret; + } + + + function GetMyIp() { + local Hb = Http("tnedi.me"); + return Hb.Get("/"); + } + + function generateRandomString(length) { + local alphabet = "abcdefghijklmnopqrstuvwxyz"; + local result = ""; + for (local i = 0; i< length; i++) { + local randomIndex = math.random(0, alphabet.len() - 1); + result += alphabet.get(randomIndex); + } + return result; + } + + function Blend(str1, str2) { + local alphabet = "abcdefghijklmnopqrstuvwxyz"; + local result = ""; + local len = MathClass.getMin(str1.len(), str2.len()); + for (local i = 0; i< len; i++) { + print((str1[i].tointeger() % alphabet.len()) - 1); + result += alphabet.slice((str1[i].tointeger() % alphabet.len()), (str1[i].tointeger() % alphabet.len()) + 1) + str2[i]; + } + return result; + } + + function Encode(Str, Key = [9, 4, 7, 3, 3, 0, 6, 7, 0]) { + local StrPointer = Memory.allocUtf8String(Str); + local BlobObj = StrPointer.readBinary(Str.len()); + local str = ""; + for (local i = 0; i< BlobObj.len(); i++) { + str += BlobObj[i].tostring(); + str += "," + } + print(str) + // printT(BlobObj); + local Arr = xorEncryptDecrypt(BlobObj, Key); + local encodestr = base64_encode(Arr); + return encodestr; + } + + function Decode(Str, Key = [9, 4, 7, 3, 3, 0, 6, 7, 0]) { + local StrArr = base64_decode(Str); + local Arr = xorEncryptDecrypt(StrArr, Key); + local str = ""; + for (local i = 0; i< Arr.len(); i++) { + str += Arr[i].tostring(); + str += "," + } + print(str) + local StrPointer = Memory.alloc(Arr.len()); + StrPointer.writeByteArray(Arr); + local decodestr = StrPointer.readUtf8String(Arr.len()); + return decodestr; + } } + + +class HttpResponse { + C_Object = null; + constructor(obj) { + C_Object = obj; + } + + function Write(Msg) { + local response = "HTTP/1.1 200 OK\r\n"; + if (typeof Msg == "table") { + response += "Content-Type: application/json\r\n"; + local JsonString = Json.Encode(Msg); + response += "Content-Length: " + JsonString.len() + "\r\n"; + response += "\r\n"; + response += JsonString; + } + else if(typeof Msg == "string") { + response += "Content-Type: text/plain\r\n"; + response += "Content-Length: " + Msg.len() + "\r\n"; + response += "\r\n"; + response += Msg; + } + + Sq_HttpServerResponse_Write(C_Object, response); + } +} + +class HttpServer { + + Host = null; + Service = null; + + //处理函数 + Handler = null; + + + constructor(host, service = "80") { + Host = host; + Service = service; + + getroottable()["HttpServer_" + Host + "_" + Service] <- this; + } + + function Listen(Func) { + //记录处理函数 + Handler = Func; + + local success = Sq_CreateHttpServer(Host, Service, this); + if (success) { + ::print("Server started successfully."); + } else { + ::print("Failed to start server."); + } + } + + function Event(SocketObject, Msg) { + Timer.SetTimeOut(Handler, 1, HttpResponse(SocketObject), Msg); + } +} \ No newline at end of file diff --git a/Dps_A/BaseClass/InvenClass/InvenClass.nut b/Dps_A/BaseClass/InvenClass/InvenClass.nut index d9867e2..0f34e4c 100644 --- a/Dps_A/BaseClass/InvenClass/InvenClass.nut +++ b/Dps_A/BaseClass/InvenClass/InvenClass.nut @@ -35,6 +35,26 @@ class Inven extends Base_C_Object { //检查背包是否拥有指定数量的指定道具 function CheckItemCount(ItemId, ItemCount) { + if (ItemId == 0) { + //检查金币 + local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object); + if (Money >= ItemCount) { + return true; + } + } + if (ItemId == -1) { + //检查点券 + if (SUser.GetCera() >= ItemCount) { + return true; + } + } + if (ItemId == -2) { + //检查代币券 + if (SUser.GetCeraPoint() >= ItemCount) { + return true; + } + } + local SlotIdx = GetSlotById(ItemId); if (SlotIdx != -1) { local SlotItem = GetSlot(1, SlotIdx); @@ -56,6 +76,8 @@ class Inven extends Base_C_Object { return Flag; } + + //销毁背包中指定表的道具及数量 function DeleteArrItemCount(T) { foreach(value in T) { @@ -67,6 +89,22 @@ class Inven extends Base_C_Object { //销毁背包中指定的道具及数量 function DeleteItemCount(Id, Count) { + if (Id == 0) { + //处理金币 + SUser.RechargeMoney(-Count); + return 1; + } + if (Id == -1) { + //处理点券 + SUser.RechargeCera(-Count); + return 1; + } + if (Id == -2) { + //处理代币券 + SUser.RechargeCeraPoint(-Count); + return 1; + } + local Slot = GetSlotById(Id); local Ret = Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, Count, 10, 1); SUser.SendUpdateItemList(1, 0, Slot); @@ -77,4 +115,72 @@ class Inven extends Base_C_Object { function GetAvatarItemMgr() { return Sq_CallFunc(S_Ptr("0x80DD576"), "pointer", ["pointer"], this.C_Object); } + + + //销毁背包中指定表的道具及数量 并且需要格子匹配 + function DeleteArrItemCountRindro(T) { + foreach(value in T) { + if (value.type == 0) { + //如果是装备 按格子直接删除 + Sq_Inven_RemoveItemFormCount(this.C_Object, 1, value.pos, value.count, 10, 1); + SUser.SendUpdateItemList(1, 0, value.pos); + } else { + //如果不是装备 走原逻辑 + local Slot = GetSlotById(value.itemId); + Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, value.count, 10, 1); + SUser.SendUpdateItemList(1, 0, Slot); + } + } + } + + + //检查背包是否拥有指定表的道具及数量 并且是装备还要匹配格子 + function CheckArrItemCountRindro(T) { + local Flag = true; + foreach(value in T) { + if (!CheckItemCountRindro(value.itemId, value.count, value.pos)) Flag = false; + } + return Flag; + } + + //检查背包是否拥有指定数量的指定道具 + function CheckItemCountRindro(ItemId, ItemCount, Slot) { + if (ItemId == 0) { + //检查金币 + local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object); + if (Money >= ItemCount) { + return true; + } + } + if (ItemId == -1) { + //检查点券 + if (SUser.GetCera() >= ItemCount) { + return true; + } + } + if (ItemId == -2) { + //检查代币券 + if (SUser.GetCeraPoint() >= ItemCount) { + return true; + } + } + + local SlotIdx = GetSlotById(ItemId); + if (SlotIdx != -1) { + local SlotItem = GetSlot(1, SlotIdx); + if (SlotItem) { + if (SlotItem.GetType() != "装备") { + if (SlotItem.GetAdd_Info() >= ItemCount) return true; + } else { + //如果是装备 检查格子所在的道具id + local ItemId2 = GetSlot(1, Slot).GetIndex(); + //如果这个格子的道具id就是发来的id 那么返回true + if (ItemId == ItemId2) { + return true; + } + } + } + } + return false; + } } \ No newline at end of file diff --git a/Dps_A/BaseClass/MemoryClass/MemoryClass.nut b/Dps_A/BaseClass/MemoryClass/MemoryClass.nut index ecf2016..a8543e7 100644 --- a/Dps_A/BaseClass/MemoryClass/MemoryClass.nut +++ b/Dps_A/BaseClass/MemoryClass/MemoryClass.nut @@ -27,6 +27,11 @@ class Memory { class NativePointer extends Base_C_Object { + function _tyoeof() + { + return "Sq_Pointer"; + } + constructor(T) { if (typeof T == "integer") { base.constructor(Sq_New_Point(T)); diff --git a/Dps_A/BaseClass/PacketClass/PacketClass.nut b/Dps_A/BaseClass/PacketClass/PacketClass.nut index a7aeafa..b9cdad2 100644 --- a/Dps_A/BaseClass/PacketClass/PacketClass.nut +++ b/Dps_A/BaseClass/PacketClass/PacketClass.nut @@ -104,4 +104,5 @@ class Packet extends Base_C_Object { Sq_Delete_Point(this.C_Object); // Sq_Packet_Delete(this.C_Object); } + } \ No newline at end of file diff --git a/Dps_A/BaseClass/ScriptManager/ScriptManager.nut b/Dps_A/BaseClass/ScriptManager/ScriptManager.nut index 20f19e7..fae37ff 100644 --- a/Dps_A/BaseClass/ScriptManager/ScriptManager.nut +++ b/Dps_A/BaseClass/ScriptManager/ScriptManager.nut @@ -1,1207 +1,215 @@ /* 文件名:ScriptManager.nut -路径:Dps_A/BaseClass/ScriptManager/ScriptManager.nut +路径:Core/BaseClass/ScriptManager/ScriptManager.nut 创建日期:2024-10-11 12:24 文件用途:pvf 管理器 */ class Script { + C_Object = null; + constructor(Path = "/home/neople/game/Script.pvf") { print("正在初始化PVF..."); local StartTime = time(); - //文件 - local FileIo = null; - try { - FileIo = file(Path, "rb"); - } catch (exception) { - error("打不开Script文件!"); - } - if (!FileIo) return; - local FileRo = BlobEx(FileIo.readblob(FileIo.len())); - InitPvfTreeHeader(FileRo); - FileIo.close(); - InitStringBin(FileRo); - InitLoadString(FileRo); - - ScriptData.IO = FileRo; - ScriptData.Init(); + C_Object = Asset_LoadScript(Path); print("PVF初始化完毕!!!"); print("用时: " + (time() - StartTime) + "秒"); + getroottable()._Script_Data_ <- this; } - function charPtrToInt(arr) { - local value = ((arr[0]) << 0) | ((arr[1]) << 8) | ((arr[2]) << 16) | ((arr[3]) << 24); - return value; + + function GetFileInfo(Path) { + local size = Asset_GetPvfFileSize(C_Object, Path); + if (size) { + local blobobj = blobex(size); + Asset_GetPvfFile(C_Object, Path, blobobj); + return blobobj; + } else return null; } - function CrcDecode(Ro, Length, crc32) { - local num = 0x81A79011; - for (local i = 0; i< Length; i += 4) { - local Pos = Ro.tell(); - local anInt = charPtrToInt([Ro[Pos], Ro[Pos + 1], Ro[Pos + 2], Ro[Pos + 3]]); - local val = (anInt ^ num ^ crc32); - local jiemi = (val >>> 6) | ((val << (32 - 6)) & 0xFFFFFFFF); + function GetBinString(Key) { + return Asset_GetPvfBinString(C_Object, Key); + } - Ro[Pos] = ((jiemi >>> 0) & 0xFF); - Ro[Pos + 1] = ((jiemi >>> 8) & 0xFF); - Ro[Pos + 2] = ((jiemi >>> 16) & 0xFF); - Ro[Pos + 3] = ((jiemi >>> 24) & 0xFF); - Ro.seek(4, 'c'); + function GetLoadString(Type, Key) { + return Asset_GetPvfLoadString(C_Object, Type, Key); + } +} + + +class _PVF_Data_ { + //数据 + Data = null; + //位置 + Pos = 0; + //最大值 + Max = 0; + + function _typeof() { + return "pvf_data"; + } + + constructor(gData) { + Data = gData; + Max = gData.len(); + } + + function Last() { + if (Pos > 0) { + Pos--; + return Get(); + } + return null; + } + + function Seek(i) { + if (Pos > 0 && Pos<(Max - 1)) { + Pos = i; } } - //初始化PVF文件树 - function InitPvfTreeHeader(HeaderRo) { - //读取UUID的长度 - local UUID_LENGTH = HeaderRo.GetInt(); - //UUID 读 1 - 36位 构造 UTF8 string - local UUID = HeaderRo.GetString(UUID_LENGTH); - //版本号 - local Version = HeaderRo.GetInt(); - // 文件路径数据的大小 - local AlignedIndexHeaderSize = HeaderRo.GetInt(); - // 解密密钥 - local IndexHeaderCrc = HeaderRo.GetInt(); - // 文件数量 - local IndexSize = HeaderRo.GetInt(); - local FristPos = HeaderRo.tell(); - - - CrcDecode(HeaderRo, AlignedIndexHeaderSize, IndexHeaderCrc) - // HeaderRo.CrcDecode(AlignedIndexHeaderSize, IndexHeaderCrc); - - - local CurrPos = 0; - ScriptData.StartPos = AlignedIndexHeaderSize + 56; - - for (local i = 0; i< IndexSize; i++) { - HeaderRo.seek(FristPos + CurrPos); - local FileNumber = HeaderRo.GetInt(); - local FilePathLength = HeaderRo.GetInt(); - local FileName = HeaderRo.GetString(FilePathLength); - local FileLength = HeaderRo.GetInt(); - local Cre32 = HeaderRo.GetInt(); - local RelativeOffset = HeaderRo.GetInt(); - if (FileLength > 0) { - local RealFileLength = (FileLength + 3) & 4294967292; - ScriptData.PvfFileInfo[FileName] <- { - ROffset = RelativeOffset, - Cr32 = Cre32, - Length = RealFileLength, - DecodeFlag = 0 - } - } - CurrPos += 20; - CurrPos += FilePathLength; - } + function Seekg(i) { + Pos += i; } - function InitStringBin(Ro) { - local Info = ScriptData.GetFileInfo("stringtable.bin"); - if (!Info) return; - - Ro.seek(ScriptData.StartPos + Info.ROffset); - CrcDecode(Ro, Info.Length, Info.Cr32); - //解密完需要重新调整指针位置 - Ro.seek(ScriptData.StartPos + Info.ROffset); - - local FileHPos = Ro.tell(); - local Count = Ro.GetInt(); - - - local CurrentIndex = 0; - for (local i = 0; i< Count; i++) { - Ro.seek(FileHPos + CurrentIndex * 4 + 4); - local StartPos = Ro.GetInt(); - local EndPos = Ro.GetInt(); - local Len = EndPos - StartPos; - Ro.seek(FileHPos + StartPos + 4); - local Str = Ro.GetString(Len); - ScriptData.BinString[CurrentIndex] <- Str; - CurrentIndex++; + function Get() { + local Ret = Data[Pos]; + if (Pos<(Max - 1)) { + Pos++; } - ScriptData.RemoveFileInfo("stringtable.bin"); - // print("初始化StringTable完成,数量: " + ScriptData.BinString.len()); + return Ret; } - function InitLoadString(Ro) { - local Info = ScriptData.GetFileInfo("n_string.lst"); - if (!Info) return; + function Eof() { + if (Pos == Max - 1) + return true; + } - Ro.seek(ScriptData.StartPos + Info.ROffset); - CrcDecode(Ro, Info.Length, Info.Cr32); - //解密完需要重新调整指针位置 - Ro.seek(ScriptData.StartPos + Info.ROffset); - - local FileHPos = Ro.tell(); - local Flag = Ro.GetUShort(); - // print("Flag :" + Flag); - local i = 2; - while (i< Info.Length) { - if ((Info.Length - i) >= 10) { - Ro.seek(FileHPos + i + 6); - local FindKey = Ro.GetInt(); - local Key = ScriptData.GetBinString(FindKey); - if (Key) { - local FileInfo = ScriptData.GetFileInfo(Key.tolower()); - - Ro.seek(ScriptData.StartPos + FileInfo.ROffset); - CrcDecode(Ro, FileInfo.Length, FileInfo.Cr32); - //解密完需要重新调整指针位置 - Ro.seek(ScriptData.StartPos + FileInfo.ROffset); - local Str = Ro.GetString(FileInfo.Length); - local StrArr = split(Str, "\r\n"); - foreach(index, strobj in StrArr) { - if (strobj.find(">") != null) { - local strobjarr = split(strobj, ">"); - if (strobjarr.len() > 1) - ScriptData.LoadString[strobjarr[0]] <- strobjarr[1]; - } - } - ScriptData.RemoveFileInfo(Key.tolower()); - } - } else break; - i += 10; + function Next() { + if (Pos<(Max - 1)) { + Pos++; + return Get(); } - ScriptData.RemoveFileInfo("n_string.lst"); - // print("初始化LoadString完成,数量: " + ScriptData.LoadString.len()); + return null; } } - - class GlobaData { - //加载完成的Flag - InitFlag = false; - //PVF的文件解析集合 - PvfFileInfo = null; - //PVF文件的开始下标 - StartPos = null; - //PVF文件的IO - IO = null; - - AniPathTable = null; + //动画文件Map Ani = null; - LoadString = null; - BinString = null; - - //怪物List - MonsterLst = null; - MonsterConfigLst = null; - //地图List - MapLst = null; - MapConfigLst = null; - //地板List - TileConfigLst = null; - //被动对象List - PassiveObjectLst = null; - PassiveObjectConfigLst = null; - //角色配置信息路径List - CharacterLst = null; - CharacterConfigLst = null; - //装备List - EquipmentLst = null; - EquipmentConfigLst = null; - //APC List - AICharacterLst = null; - AICharacterConfigLst = null; - //Atk List - AttackinfoConfigLst = null; constructor() { - PvfFileInfo = {}; Ani = {}; - AniPathTable = {}; - LoadString = {}; - BinString = {}; - MonsterConfigLst = {}; - MapConfigLst = {}; - TileConfigLst = {}; - PassiveObjectConfigLst = {}; - CharacterConfigLst = {}; - EquipmentConfigLst = {}; - AICharacterConfigLst = {}; - AttackinfoConfigLst = {}; } - function InitList(Path, ErrorStr, TableName) { - this[TableName] = {}; - local HeaderPath = Path + "/"; - local Info = ScriptData.GetFileInfo(HeaderPath + Path + ".lst"); - if (!Info) return error(ErrorStr + "列表不存在。加载失败!"); - IO.seek(ScriptData.StartPos + Info.ROffset); + //获取文件的IO + function GetFile(Path) { + return getroottable()._Script_Data_.GetFileInfo(Path); + } - local FileHPos = IO.tell(); - local Flag = IO.GetUShort(); - - local i = 2; - while (i< Info.Length) { - if ((Info.Length - i) >= 10) { - IO.seek(FileHPos + i + 1); - local Id; - if (Path == "equipment") { - Id = IO.GetInt(); - IO.seek(1, 'c'); - } else { - Id = IO.GetShort(); - IO.seek(3, 'c'); - } - local FindKey = IO.readn('i'); - local Key = ScriptData.GetBinString(FindKey); - Key = HeaderPath + Key.tolower(); - this[TableName][Id] <- Key; - } else break; - i += 10; - } - } - - function Init() { - //初始化怪物列表 - InitList("monster", "怪物", "MonsterLst"); - //初始化地图列表 - InitList("map", "地图", "MapLst"); - //初始化被动对象列表 - InitList("passiveobject", "被动对象", "PassiveObjectLst"); - //初始化角色配置信息列表 - InitList("character", "角色配置", "CharacterLst"); - //初始化角色配置信息列表 - InitList("equipment", "装备", "EquipmentLst"); - // Util.PrintTable(EquipmentLst); - //初始化APC列表 - InitList("aicharacter", "APC", "AICharacterLst"); - - ScriptData.InitFlag = true; - } - - function RegRealPath(Path) { - if (Path.find("../") != null) { - while (true) { - local rbuf = regexp("[^/]+/../"); - local Ret = rbuf.capture(Path); - if (Ret) { - Path = Path.slice(0, Ret[0].begin) + Path.slice(Ret[0].end); - } else { - return Path; - } - } - } - return Path; - } - - function GetFileInfo(Path) { - Path = RegRealPath(Path); - if (!PvfFileInfo.rawin(Path)) return null; - else { - //如果是未解密的需要先解密 - if (Path != "stringtable.bin" && Path != "n_string.lst" && !(endswith(Path, ".str")) && PvfFileInfo[Path].DecodeFlag == 0) { - local Info = PvfFileInfo[Path]; - IO.seek(StartPos + Info.ROffset); - Script.CrcDecode(IO, Info.Length, Info.Cr32); - // 解密完需要重新调整指针位置 - // FileRo.seek(StartPos + Info.ROffset); - } - return PvfFileInfo[Path]; - } - } - - function RemoveFileInfo(Path) { - if (PvfFileInfo.rawin(Path)) { - delete PvfFileInfo[Path] + //获取文件并处理 + function GetFileData(Path, Func) { + local IO = GetFile(Path); + if (IO) { + return ResolvingData(IO, Func, Path); + } else { + print(Path + "找不到文件!"); + return null; } } + //获取动画文件 function GetAni(Path) { - Path = RegRealPath(Path); if (Path in Ani) return Ani[Path]; else { - try { - IO.seek(AniPathTable[Path].Pos); - CrcDecode(IO, AniPathTable[Path].Length, AniPathTable[Path].Cr32); - IO.seek(AniPathTable[Path].Pos); + local IO = GetFile(Path); + if (IO) { Ani[Path] <- InitPvfAni(IO); + Ani[Path].filepath <- Path; return Ani[Path]; - } catch (exception) { + } else { print(Path + "找不到文件!"); - error(exception); + return null; } - // print(Path + "找不到文件!"); - return null; } } - - function GetBinString(Path) { - if (Path in BinString) - return BinString[Path]; - else { - print(Path + "找不到文件!"); - return null; + function ResolvingData(IO, Func, Path) { + local DataTable = {}; + DataTable.filepath <- Path; + local Type = Path.slice(0, Path.find("/")).tolower(); + local DataArr = []; + local Length = IO.len(); + if (Length >= 7) { + local i = 2; + while (true) { + if (i< Length && Length - i >= 5) { + local str = UnpackData(IO, i, Type); + i += 5; + DataArr.push(str); + } else break; + } + Func(DataTable, _PVF_Data_(DataArr)); + return DataTable; } + return null; } - function GetLoadString(Path) { - if (Path in LoadString) - return LoadString[Path]; - else { - print(Path + "找不到文件!"); - return null; - } - } - - function UnpackData(FilePos, i) { - local out = ""; - IO.seek(FilePos + i); //内容指示位 + function UnpackData(IO, i, Type) { + IO.seek(i); //内容指示位 local currentByte = IO.readn('c'); //内容指示位 local after = IO.GetInt(); switch (currentByte) { - case 10: { - IO.seek(FilePos + i - 4); - local Before = IO.GetInt(); - local Buf = GetBinString(after); + case 9: { + local NewcurrentByte = IO.readn('c'); //内容指示位 + local Newafter = IO.GetInt(); + local Buf = getroottable()._Script_Data_.GetBinString(Newafter); if (!Buf) { Buf = ""; } else { - Buf = "<" + Before + "::" + Buf + "`" + GetLoadString(Buf) + "`>"; + Buf = getroottable()._Script_Data_.GetLoadString(Type, Buf); } - Buf = Buf + "\r\n"; - out += Buf; - break; + return Buf; + } + case 10: { + local Buf = getroottable()._Script_Data_.GetBinString(after); + if (!Buf) { + Buf = ""; + } else { + Buf = getroottable()._Script_Data_.GetLoadString(Type, Buf); + } + return Buf; } case 2: { - out += after + '\t'; - break; + IO.seek(-4, 'c'); + local ret = IO.readn('i'); + return ret; } case 4: { local Bbuf = blob(4); Bbuf.writen(after, 'i'); Bbuf.seek(0); local Buf = Bbuf.readn('f'); - out += after + '\t'; - break; + return Buf.tofloat(); } case 6: case 8: case 7: case 5: { - local Buf = GetBinString(after); + local Buf = getroottable()._Script_Data_.GetBinString(after); if (!Buf) Buf = ""; return Buf; } default: - out += ""; - break; + return ""; } - return out; - } - - - function Decompile_attackinfo(DirPath, FileRealName, Info) { - local AttackinfoAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - //攻击类型 攻击属性类型 损伤反应 - if (str == "[attack type]" || str == "[elemental property]" || str == "[damage reaction]") { - local Ret = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt[str.slice(1, -1)] <- Ret.slice(1, -1); - } - //武器伤害应用 推力 抬起 - else if (str == "[weapon damage apply]" || str == "[push aside]" || str == "[lift up]") { - local Ret = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt[str.slice(1, -1)] <- ((Ret.tointeger() - 9).tofloat()); - } - //打击音效 - else if (str == "[hit wav]") { - local Ret = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt[str.slice(1, -1)] <- Ret; - } - //打击效果 - else if (str == "[hit info]") { - AttackinfoAtt["hit_info"] <- {}; - local HitType = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt["hit_info"].Type <- HitType; - local Ret = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt["hit_info"].BloodType <- Ret.slice(1, -1); - local Value0 = UnpackData(FilePos, i); - i += 5; - local Value1 = UnpackData(FilePos, i); - i += 5; - AttackinfoAtt["hit_info"].Value <- [Value0, Value1]; - } - } else break; - } - - } - return AttackinfoAtt; - } - - //获取ATK - function GetAtk(Path) { - Path = RegRealPath(Path); - if (AttackinfoConfigLst.rawin(Path)) return AttackinfoConfigLst[Path]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - if (Info) { - local InfoObj = Decompile_attackinfo(DirPath, FileRealName, Info); - AttackinfoConfigLst[Path] <- InfoObj; - return InfoObj; - } else error(Path + " AttackInfo不存在!"); - } - - function Decompile_monster(DirPath, FileRealName, Info) { - local MonsterAtt = {}; - //属性表 - MonsterAtt.Attributes <- {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - //大小 - if (str == "[size]") { - local gx = UnpackData(FilePos, i); - i += 5; - local gy = UnpackData(FilePos, i); - i += 5; - MonsterAtt.size <- { - x = gx.tointeger(), - y = gy.tointeger() - }; - } - //属性 - else if (str == "[HpMax]" || str == "[Attack]" || str == "[Speed]" || str == "[Defense]" || str == "[DeployCost]" || str == "[Resilience]" || str == "[FirePower]" || str == "[IcePower]" || str == "[LightningPower]" || str == "[DarkPower]" || str == "[FireResistance]" || str == "[IceResistance]" || str == "[LightningResistance]" || str == "[DarkResistance]") { - local RealKey = str.slice(1, str.len() - 1); - MonsterAtt.Attributes[RealKey] <- UnpackData(FilePos, i).tointeger() - 9; - i += 5; - } - // //属性 - // else if (str == "[ability]") { - // MonsterAtt.ability <- {}; - // while (true) { - // local Ret = UnpackData(FilePos, i); - // i += 5; - // if (Ret == "[/ability]") break; - // if (endswith(Ret, "]")) { - // local Value = UnpackData(FilePos, i); - // i += 5; - // MonsterAtt.ability[Ret.slice(1, Ret.len() - 1)] <- Value.tointeger(); - // } - // } - // } - //标签 - else if (str == "[category]") { - MonsterAtt.category <- {}; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/category]") break; - if (endswith(Ret, "]")) { - MonsterAtt.category[Ret.slice(1, Ret.len() - 1)] <- true; - } - } - } - //等级 移动速度 攻击速度 释放速度 硬直 重量 - else if (str == "[level]" || str == "[move speed]" || str == "[attack speed]" || str == "[cast speed]" || str == "[hit recovery]" || str == "[weight]") { - local RealKey = str.slice(1, str.len() - 1); - MonsterAtt[RealKey] <- {}; - MonsterAtt[RealKey].min <- UnpackData(FilePos, i).tointeger(); - i += 5; - MonsterAtt[RealKey].max <- UnpackData(FilePos, i).tointeger(); - i += 5; - } - //视力 针对最近 好战 攻击延迟(僵值) 名字 - else if (str == "[sight]" || str == "[targeting nearest]" || str == "[warlike]" || str == "[attack delay]") { - local RealKey = str.slice(1, str.len() - 1); - MonsterAtt[RealKey] <- UnpackData(FilePos, i).tointeger(); - i += 5; - } - //名字 - else if (str == "[name]") { - local RealKey = str.slice(1, str.len() - 1); - MonsterAtt[RealKey] <- UnpackData(FilePos, i); - i += 5; - } - //头像 - else if (str == "[face image]") { - local buf1 = UnpackData(FilePos, i); - i += 5; - local buf2 = UnpackData(FilePos, i); - i += 5; - MonsterAtt.face <- { - path = buf1, - index = buf2 - }; - } - //Ani - else if (str == "[animotion]") { - MonsterAtt.animotion <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/animotion]") break; - MonsterAtt.animotion.append(DirPath + Ret.tolower()); - } - } - //Atk - else if (str == "[attack info]") { - MonsterAtt.attackinfo <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/attack info]") break; - MonsterAtt.attackinfo.append(DirPath + Ret.tolower()); - } - } - } else break; - } - - } - return MonsterAtt; - } - - - function GetMonster(Idx) { - if (MonsterLst.rawin(Idx)) { - local Path = MonsterLst[Idx]; - if (MonsterConfigLst.rawin(Path)) return MonsterConfigLst[Path]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_monster(DirPath, FileRealName, Info); - MonsterConfigLst[Path] <- InfoObj; - return InfoObj; - } else error(Idx + " 号怪物不存在!"); - } - - - function Decompile_map(DirPath, FileRealName, Info) { - local MapAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - //远景速度 中景速度 近景速度 - if (str == "[far sight scroll]" || str == "[middle sight scroll]" || str == "[near sight scroll]") { - local RealKey = str.slice(1, str.len() - 1); - MapAtt[RealKey] <- UnpackData(FilePos, i).tointeger(); - i += 5; - } - //名字 - else if (str == "[map name]" || str == "[map type]") { - local RealKey = str.slice(1, str.len() - 1); - MapAtt[RealKey] <- UnpackData(FilePos, i); - i += 5; - } - //地板 - else if (str == "[tile]") { - MapAtt.tile <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/tile]") break; - MapAtt.tile.append(DirPath + Ret.tolower()); - } - } - //音乐 - else if (str == "[sound]") { - MapAtt.sound <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/sound]") break; - MapAtt.sound.append(Ret); - } - } - //对象 - else if (str == "[passive object]") { - MapAtt.passiveobject <- []; - while (true) { - local Id = UnpackData(FilePos, i); - i += 5; - if (Id == "[/passive object]") break; - local XPos = UnpackData(FilePos, i); - i += 5; - local YPos = UnpackData(FilePos, i); - i += 5; - local ZPos = UnpackData(FilePos, i); - i += 5; - local Tbuf = { - id = Id.tointeger() - 9, - x = XPos.tointeger() - 9, - y = YPos.tointeger() - 9, - z = ZPos.tointeger() - 9, - } - MapAtt.passiveobject.append(Tbuf); - } - } - //Ani - else if (str == "[animation]") { - MapAtt.animation <- []; - while (true) { - local Path = UnpackData(FilePos, i); - i += 5; - if (Path == "[/animation]") break; - local Layer = UnpackData(FilePos, i); - i += 5; - local XPos = UnpackData(FilePos, i).tointeger(); - i += 5; - local YPos = UnpackData(FilePos, i).tointeger(); - i += 5; - local ZPos = UnpackData(FilePos, i).tointeger(); - i += 5; - local Tbuf = { - path = DirPath + Path.tolower(), - layer = Layer, - x = XPos - 9, - y = YPos - 9, - z = ZPos - 9 - } - MapAtt.animation.append(Tbuf); - } - } - //背景动画 - else if (str == "[background animation]") { - MapAtt.backgroundani <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/background animation]") break; - if (Ret == "[ani info]") { - local AniBuf = {}; - while (true) { - local Key = UnpackData(FilePos, i); - i += 5; - if (Key == "[/ani info]") break; - local Value = UnpackData(FilePos, i); - i += 5; - if (Key == "[filename]") Value = DirPath + Value.tolower(); - AniBuf[Key] <- Value; - } - MapAtt.backgroundani.append(AniBuf); - } - } - } - } else break; - } - - } - return MapAtt; - } - - function GetMap(Idx) { - if (MapLst.rawin(Idx)) { - local Path = MapLst[Idx]; - if (MapConfigLst.rawin(Path)) return MapConfigLst[Path]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_map(DirPath, FileRealName, Info); - MapConfigLst[Path] <- InfoObj; - return InfoObj; - } else error(Idx + " 号地图不存在!"); - } - - function Decompile_tile(Info) { - local TileAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - if (str == "[IMAGE]") { - local gpath = "sprite/" + UnpackData(FilePos, i).tolower(); - i += 5; - local gidx = UnpackData(FilePos, i).tointeger() - 9; - i += 5; - TileAtt.image <- { - path = gpath, - idx = gidx - } - } - //偏移 - else if (str == "[img pos]") { - TileAtt.pos <- UnpackData(FilePos, i).tointeger(); - i += 5; - } - } else break; - } - - } - return TileAtt; - } - - - //读取地板 - function GetTile(Path) { - if (TileConfigLst.rawin(Path)) return TileConfigLst[Path]; - local Info = GetFileInfo(Path); - local InfoObj = Decompile_tile(Info); - TileConfigLst[Path] <- InfoObj; - return InfoObj; - } - - function Decompile_passiveobject(DirPath, FileRealName, Info) { - local PassiveobjectAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - //大小 - if (str == "[size]") { - local gx = UnpackData(FilePos, i); - i += 5; - local gy = UnpackData(FilePos, i); - i += 5; - PassiveobjectAtt.size <- { - x = gx.tointeger(), - y = gy.tointeger() - }; - } - //浮动高度 图层 通过类型 名字 - else if (str == "[floating height]" || str == "[layer]" || str == "[pass type]" || str == "[name]") { - local RealKey = str.slice(1, str.len() - 1); - PassiveobjectAtt[RealKey] <- UnpackData(FilePos, i); - i += 5; - } - //Ani - else if (str == "[animotion]") { - PassiveobjectAtt.animotion <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/animotion]") break; - PassiveobjectAtt.animotion.append(DirPath + Ret.tolower()); - } - } - //Atk - else if (str == "[attack info]") { - PassiveobjectAtt.attackinfo <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/attack info]") break; - PassiveobjectAtt.attackinfo.append(DirPath + Ret.tolower()); - } - } - //回调函数 - else if (str == "[create function]" || str == "[proc function]" || str == "[destroy function]" || str == "[attack function]") { - local RealKey = str.slice(1, str.len() - 1); - local Path = UnpackData(FilePos, i); - i += 5; - // Path = "sqr/PassiveObjectFunc/" + Path + ".nut"; - // PassiveobjectAtt[RealKey] <- dofile(Path); - Path = "PassiveObject_" + Path; - if (getroottable().PassiveObjectFunction.rawin(Path)) - PassiveobjectAtt[RealKey] <- getroottable().PassiveObjectFunction[Path]; - } - } else break; - } - - } - return PassiveobjectAtt; - } - - //获取被动对象 - function GetPassiveObject(Idx) { - if (PassiveObjectLst.rawin(Idx)) { - local Path = PassiveObjectLst[Idx]; - if (PassiveObjectConfigLst.rawin(Path)) return PassiveObjectConfigLst[Path]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_passiveobject(DirPath, FileRealName, Info); - PassiveObjectConfigLst[Path] <- InfoObj; - return InfoObj; - } else error(Idx + " 号被动对象不存在!"); - } - - - - function Decompile_character(DirPath, FileRealName, Info) { - local CharacterAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - - //职业 - if (str == "[job]") { - local RealKey = str.slice(1, -1); - CharacterAtt[RealKey] <- UnpackData(FilePos, i).slice(1, -1); - i += 5; - } - //基础属性 - else if (str == "[HP MAX]]" || str == "[MP MAX]]" || str == "[physical attack]]" || str == "[physical defense]]" || str == "[magical attack]]" || str == "[magical defense]]" || str == "[inventory limit]]" || str == "[MP regen speed]]" || str == "[move speed]]" || str == "[attack speed]]" || str == "[cast speed]]" || str == "[hit recovery]]" || str == "[jump power]]" || str == "[weight]]" || str == "[jump speed]]") { - local RealKey = str.slice(1, str.len() - 1); - CharacterAtt[RealKey] <- UnpackData(FilePos, i).tofloat(); - i += 5; - } - //基础Ani - else if (str == "[waiting motion]" || str == "[move motion]" || str == "[sit motion]" || str == "[damage motion 1]" || str == "[damage motion 2]" || str == "[down motion]" || str == "[overturn motion]" || str == "[jump motion]" || str == "[jumpattack motion]" || str == "[rest motion]" || str == "[throw motion 1-1]" || str == "[throw motion 1-2]" || str == "[throw motion 2-1]" || str == "[throw motion 2-2]" || str == "[throw motion 3-1]" || str == "[throw motion 3-2]" || str == "[throw motion 4-1]" || str == "[throw motion 4-2]" || str == "[dash motion]" || str == "[dashattack motion]" || str == "[getitem motion]" || str == "[buff motion]" || str == "[simple rest motion]" || str == "[simple move motion]" || str == "[back motion]") { - local RealKey = str.slice(1, str.len() - 1); - CharacterAtt[RealKey] <- (UnpackData(FilePos, i).tolower()); - i += 5; - } - //普攻Ani - else if (str == "[attack motion]") { - CharacterAtt.attack_motion <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/attack motion]") break; - CharacterAtt.attack_motion.append(Ret.tolower()); - } - } - //进阶Ani - else if (str == "[etc motion]") { - CharacterAtt.etc_motion <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/etc motion]") break; - CharacterAtt.etc_motion.append(Ret.tolower()); - } - } - //基础Atk - else if (str == "[jumpattack info]" || str == "[dashattack info]") { - local RealKey = str.slice(1, str.len() - 1); - CharacterAtt[RealKey] <- (DirPath + UnpackData(FilePos, i).tolower()); - i += 5; - } - //普攻Atk - else if (str == "[attack info]") { - CharacterAtt.attack_info <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/attack info]") break; - CharacterAtt.attack_info.append(DirPath + Ret.tolower()); - } - } - //进阶Atk - else if (str == "[etc attack info]") { - CharacterAtt.etc_attack_info <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/etc attack info]") break; - CharacterAtt.etc_attack_info.append(DirPath + Ret.tolower()); - } - } - - } else break; - } - - } - return CharacterAtt; - } - //获取角色配置 - function GetCharacter(Idx) { - //如果已经读取过配置 直接返回配置 - if (CharacterConfigLst.rawin(Idx)) return CharacterConfigLst[Idx]; - if (CharacterLst.rawin(Idx)) { - local Path = CharacterLst[Idx]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_character(DirPath, FileRealName, Info); - InfoObj.DirPath <- DirPath; - CharacterConfigLst[Idx] <- InfoObj; - // Util.PrintTable(InfoObj); - return InfoObj; - } else error(Idx + " 号角色配置不存在!"); - } - - - function Decompile_equipment(DirPath, FileRealName, Info) { - local EquipmentAtt = {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - - //名称 - if (str == "[name]") { - local RealKey = str.slice(1, str.len() - 1); - EquipmentAtt[RealKey] <- UnpackData(FilePos, i); - i += 5; - } - //grade 套装Id - else if (str == "[grade]" || str == "[part set index]" || str == "[anti evil]" || str == "[sb dongcai]") { - local RealKey = str.slice(1, str.len() - 1); - EquipmentAtt[RealKey] <- UnpackData(FilePos, i).tointeger() - 9; - i += 5; - } - //适用角色 - else if (str == "[usable job]") { - EquipmentAtt.usable_job <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/usable job]") break; - EquipmentAtt.usable_job.append(Ret.slice(1, -1).tolower()); - } - } - //图标 - else if (str == "[icon]") { - EquipmentAtt.icon <- {}; - local Ret = UnpackData(FilePos, i); - i += 5; - EquipmentAtt.icon.path <- Ret.tolower(); - Ret = UnpackData(FilePos, i); - i += 5; - EquipmentAtt.icon.index <- Ret.tointeger(); - } - //装备类型 - else if (str == "[equipment type]") { - EquipmentAtt.type <- {}; - local Ret = UnpackData(FilePos, i); - i += 5; - EquipmentAtt.type.path <- Ret.tolower().slice(1, -1); - Ret = UnpackData(FilePos, i); - i += 5; - EquipmentAtt.type.index <- Ret.tointeger(); - } - //Ani - else if (str == "[animation job]") { - local Job = UnpackData(FilePos, i).slice(1, -1); - i += 5; - EquipmentAtt["Ani_" + Job] <- {}; - i += 5; - - local Index1 = UnpackData(FilePos, i).tointeger() - 9; - i += 5; - local Index2 = UnpackData(FilePos, i).tointeger() - 9; - i += 5; - EquipmentAtt["Ani_" + Job].variation <- [Index1, Index2]; - EquipmentAtt["Ani_" + Job].layer_variation <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[animation job]" || (endswith(Ret, "]") && Ret != "[equipment ani script]" && Ret != "[layer variation]")) { - i -= 5; - break; - } else if (Ret == "[layer variation]") { - local InfoBuf = {}; - InfoBuf.Zorder <- UnpackData(FilePos, i).tointeger() - 9; - i += 5; - InfoBuf.Path <- UnpackData(FilePos, i); - i += 5; - EquipmentAtt["Ani_" + Job].layer_variation.append(InfoBuf); - } - } - } - - - - } else break; - } - - } - return EquipmentAtt; - } - - //获取装备配置 - function GetEquipment(Idx) { - //如果已经读取过配置 直接返回配置 - if (EquipmentConfigLst.rawin(Idx)) return EquipmentConfigLst[Idx]; - if (EquipmentLst.rawin(Idx)) { - local Path = EquipmentLst[Idx]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_equipment(DirPath, FileRealName, Info); - InfoObj.DirPath <- DirPath; - EquipmentConfigLst[Idx] <- InfoObj; - // Util.PrintTable(InfoObj); - return InfoObj; - } else error(Idx + " 号装备配置不存在!"); - } - - - function Decompile_aicharacter(DirPath, FileRealName, Info) { - local AICharacterAtt = {}; - //属性表 - AICharacterAtt.Attributes <- {}; - IO.seek(StartPos + Info.ROffset); - local FilePos = IO.tell(); - local out = ""; - if (Info.Length >= 7) { - //以5为单步从第二位开始遍历字节 - local i = 2; - while (true) { - //到最后了就不处理了防止内存越界 - if (i< Info.Length && Info.Length - i >= 5) { - local str = UnpackData(FilePos, i); - i += 5; - - //名称 - if (str == "[name]") { - local RealKey = str.slice(1, str.len() - 1); - AICharacterAtt[RealKey] <- UnpackData(FilePos, i); - i += 5; - } - //属性 - else if (str == "[HpMax]" || str == "[Attack]" || str == "[Speed]" || str == "[Defense]" || str == "[DeployCost]" || str == "[Resilience]" || str == "[FirePower]" || str == "[IcePower]" || str == "[LightningPower]" || str == "[DarkPower]" || str == "[FireResistance]" || str == "[IceResistance]" || str == "[LightningResistance]" || str == "[DarkResistance]") { - local RealKey = str.slice(1, str.len() - 1); - AICharacterAtt.Attributes[RealKey] <- UnpackData(FilePos, i).tointeger() - 9; - i += 5; - } - //装备 - else if (str == "[equipment]") { - AICharacterAtt.equipment <- []; - while (true) { - local Ret = UnpackData(FilePos, i); - i += 5; - if (Ret == "[/equipment]") break; - AICharacterAtt.equipment.append(Ret.tointeger() - 9); - } - } - //基础信息 - else if (str == "[minimum info]") { - AICharacterAtt["minimum info"] <- []; - for (local o = 0; o< 16; o++) { - local Buf = UnpackData(FilePos, i); - i += 5; - if (o == 0 || o == 12) { - AICharacterAtt["minimum info"].append(Buf); - } else { - AICharacterAtt["minimum info"].append(Buf.tointeger() - 9); - } - } - } - } else break; - } - - } - return AICharacterAtt; - } - - //获取APC配置 - function GetAICharacter(Idx) { - //如果已经读取过配置 直接返回配置 - if (AICharacterConfigLst.rawin(Idx)) return AICharacterConfigLst[Idx]; - if (AICharacterLst.rawin(Idx)) { - local Path = AICharacterLst[Idx]; - local Pos = 0; - while (true) { - local Buf = Path.find("/", Pos + 1); - if (Buf != null) - Pos = Buf; - else break; - } - local DirPath = Path.slice(0, Pos + 1); - local FileRealName = Path.slice(Pos + 1); - local Info = GetFileInfo(Path); - local InfoObj = Decompile_aicharacter(DirPath, FileRealName, Info); - InfoObj.DirPath <- DirPath; - AICharacterConfigLst[Idx] <- InfoObj; - // Util.PrintTable(InfoObj); - return InfoObj; - } else error(Idx + " 号APC配置不存在!"); } } diff --git a/Dps_A/BaseClass/Socket/SocketBase.nut b/Dps_A/BaseClass/Socket/SocketBase.nut index 0c055b7..9bfb14f 100644 --- a/Dps_A/BaseClass/Socket/SocketBase.nut +++ b/Dps_A/BaseClass/Socket/SocketBase.nut @@ -119,6 +119,7 @@ GatewaySocketPackFuncMap[20240416] <- function(Jso) { //客户端包回调Map if (!getroottable().rawin("ClientSocketPackFuncMap")) ClientSocketPackFuncMap <- {} +if (!getroottable().rawin("ClientSocketDP_SPackFuncMap")) ClientSocketDP_SPackFuncMap <- {} //收到来自客户端的包 只有130 @@ -126,15 +127,27 @@ function OnClientSocketMsg(C_User, C_Pack_Str) { if (PacketDebugModel) print("收到客户端包: " + C_Pack_Str); local Jso = Json.Decode(C_Pack_Str); - if (Jso.op in ClientSocketPackFuncMap) { - local SUser = User(C_User); - ClientSocketPackFuncMap[Jso.op](SUser, Jso); + if (Jso.op == 2147483646) { + if (Jso.dps_id in ClientSocketDP_SPackFuncMap) { + Jso.rawdelete("op"); + local SUser = User(C_User); + ClientSocketDP_SPackFuncMap[Jso.dps_id](SUser, Jso); + } } else { - local SUser = User(C_User); - if (SUser) { - Jso.uid <- SUser.GetUID(); - Jso.cid <- SUser.GetCID(); - Socket.SendGateway(Jso); + if (Jso.op in ClientSocketPackFuncMap) { + local SUser = User(C_User); + ClientSocketPackFuncMap[Jso.op](SUser, Jso); + } else { + local SUser = User(C_User); + if (SUser) { + Jso.uid <- SUser.GetUID(); + Jso.cid <- SUser.GetCID(); + Socket.SendGateway(Jso); + } } } +} + +function Register_DPS_Pack(Id, Func) { + ClientSocketDP_SPackFuncMap.rawset(Id, Func); } \ No newline at end of file diff --git a/Dps_A/BaseClass/TimerClass/TimerClass.nut b/Dps_A/BaseClass/TimerClass/TimerClass.nut index ca41fa0..1ce42f7 100644 --- a/Dps_A/BaseClass/TimerClass/TimerClass.nut +++ b/Dps_A/BaseClass/TimerClass/TimerClass.nut @@ -118,7 +118,6 @@ class Timer { _Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info); } - function Update() { CheckTimeOut(); CheckCronTask(); diff --git a/Dps_A/BaseClass/UserClass/UserClass.nut b/Dps_A/BaseClass/UserClass/UserClass.nut index 0b36f88..1320685 100644 --- a/Dps_A/BaseClass/UserClass/UserClass.nut +++ b/Dps_A/BaseClass/UserClass/UserClass.nut @@ -242,6 +242,14 @@ class User extends Base_C_Object { Pack.Delete(); } + //发送自定义DPS包 + function Send_DPS_Pack(Id, Jso) { + Jso.op <- 2147483646; + Jso.dps_id <- Id; + SendJso(Jso); + } + + //发送消息包 function SendNotiPacket(Type1, Type2, Type3) { Sq_CUser_SendNotiPacket(this.C_Object, Type1, Type2, Type3); @@ -532,6 +540,126 @@ class User extends Base_C_Object { if (Ret) return AccountCargo(Ret, this); else return null; } + + //获取角色身上的显示时装 + function GetAva() { + //获取背包对象 + local InvenObj = this.GetInven(); + if (!InvenObj) return; + local re = []; + local job = this.GetCharacJob(); + + //遍历身上的每一件装备 + for (local u = 0; u <= 10; u++) { + local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u); + if (EquObj && !EquObj.IsEmpty) { + //先拿克隆id 如果这个值有 那说明带的克隆这个是被克隆的装备 直接用这个 但是如果这个人什么都没带 只带了克隆 会显示克隆的id 所以还得判断这个id是不是克隆时装 + local clearId = Sq_CallFunc(S_Ptr("0x850d374"), "int", ["pointer", "int"], InvenObj.C_Object, u) + + + local EquObjId = EquObj.GetIndex(); + //如果这个是克隆 + if (clearId > 0) { + re.push(clearId); + } else { //不是克隆 直接把id放上去 + re.push(EquObjId); + } + } else { //如果这个部位没东西 直接放默认时装上去 + re.push(defaultJobItemIdMap[job].index[u]); + } + } + return re; + } + +} + +class defaultJobItemId { + + /** + * 头发 + */ + hat = 0; + + /** + * 帽子 + */ + hair = 0; + + /** + *脸 + */ + face = 0; + /** + * 披风 + */ + breast = 0; + /** + * 上衣 + */ + coat = 0; + + /** + * 下装 + */ + pants = 0; + + /** + * 腰部 + */ + waist = 0; + + /** + * 鞋子 + */ + shoes = 0; + + /** + * 皮肤 + */ + skin = 0; + + index = null; + + constructor(hat, hair, face, breast, coat, pants, waist, shoes, skin) { + index = []; + this.hat = hat; + this.hair = hair; + this.face = face; + this.breast = breast; + this.coat = coat; + this.pants = pants; + this.waist = waist; + this.shoes = shoes; + this.skin = skin; + + index.push(hat); + index.push(hair); + index.push(face); + index.push(breast); + index.push(coat); + index.push(pants); + index.push(waist); + index.push(shoes); + index.push(skin); + index.push(0); + index.push(0); + } +} +//默认时装 +if (!(getroottable().rawin("defaultJobItemIdMap"))) { + getroottable().defaultJobItemIdMap <- {}; + defaultJobItemIdMap.rawset(0, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200)); + defaultJobItemIdMap.rawset(1, defaultJobItemId(0, 43400, 0, 0, 44600, 45000, 0, 45800, 46200)); + defaultJobItemIdMap.rawset(2, defaultJobItemId(0, 47400, 0, 48426, 48600, 49000, 0, 49800, 50200)); + defaultJobItemIdMap.rawset(3, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200)); + defaultJobItemIdMap.rawset(4, defaultJobItemId(0, 55400, 55820, 0, 56600, 57000, 0, 57800, 58200)); + + defaultJobItemIdMap.rawset(5, defaultJobItemId(1600000, 1610000, 0, 0, 1640000, 1650000, 0, 1670000, 1680000)); + defaultJobItemIdMap.rawset(6, defaultJobItemId(1720000, 1730000, 0, 1750000, 1760000, 1770000, 0, 1790000, 1800000)); + defaultJobItemIdMap.rawset(7, defaultJobItemId(0, 29201, 0, 0, 29202, 29203, 0, 29204, 29205)); + defaultJobItemIdMap.rawset(8, defaultJobItemId(0, 2090000, 0, 0, 2120000, 2130000, 0, 2140000, 2150000)); + defaultJobItemIdMap.rawset(9, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200)); + defaultJobItemIdMap.rawset(10, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200)); } //获取公会名称 @@ -604,4 +732,15 @@ function User::SendItemMail(UID, CID, ItemList, title, content) { //道具是否被锁 function User::CheckItemLock(Type, Slot) { return Sq_CallFunc(S_Ptr("0x8646942"), "int", ["pointer", "int", "int"], this.C_Object, Type, Slot); +} + + +//查询本日金币交易额度 +function User::GetTradeGoldDaily() { + return Sq_CallFunc(S_Ptr("0x8696600"), "int", ["pointer"], this.C_Object); +} + +//设置本日金币交易额度 +function User::SetTradeGoldDaily(Value) { + return Sq_CallFunc(S_Ptr("0x84EC002"), "int", ["pointer", "int"], this.C_Object, Value); } \ No newline at end of file diff --git a/Dps_A/CallBack/Gm_Input.nut b/Dps_A/CallBack/Gm_Input.nut index 5545e0c..00ea72e 100644 --- a/Dps_A/CallBack/Gm_Input.nut +++ b/Dps_A/CallBack/Gm_Input.nut @@ -52,6 +52,20 @@ Gm_InputFunc_Handle["升级"] <- function(SUser, CmdString) { } } + +Gm_InputFunc_Handle["cs"] <- function(SUser, CmdString) { + local InvenObj = SUser.GetInven(); + local slot = InvenObj.GetSlotById(26058); + + if (slot == -1) { + return; + } + local itemobj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, slot); + + itemobj.Delete(); + SUser.SendUpdateItemList(1, 0, slot); +} + Gm_InputFunc_Handle["给"] <- function(SUser, CmdString) { local count = -1; local pos = 0; @@ -108,7 +122,9 @@ Gm_InputFunc_Handle["完成任务"] <- function(SUser, CmdString) { SUser.ClearQuest_Gm(675); SUser.ClearQuest_Gm(650); + SUser.ClearQuest_Gm(4571); SUser.ClearQuest_Gm(4414); + SUser.ClearQuest_Gm(4415); SUser.ClearQuest_Gm(2603); SUser.ClearQuest_Gm(2610); @@ -180,7 +196,7 @@ Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) { Pack.Put_Binary(Str); Pack.Finalize(true); SUser.Send(Pack); - Pack.Delocale(); + Pack.Delete(); }; Gm_InputFunc_Handle.T <- function(SUser, CmdString) { @@ -283,480 +299,48 @@ function TestCronTask(str) { // AdMsgObj.Delete(); // }, 0); -Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) { - // print("初始化开始时间: " + time()); - // local PvfObject = Script(); - // print("初始化结束时间: " + time()); - print(123123); - local Str = "{\"op\":2024041602,\"uid\":1,\"map\":{\"id\":15154,\"ra\":0},\"cid\":1}"; - local Pack = Packet(); - Pack.Put_Header(1, 130); - Pack.Put_Byte(1); - Pack.Put_Int(Str.len()); - Pack.Put_Binary(Str); - Pack.Finalize(true); - SUser.Send(Pack); - Pack.Delete(); - - print("asdasdadad"); - // local Sing = Memory.alloc(100); - // Sing.add(0).writeU32(1200); - // Sing.add(4).writeU32(3037); - // Sing.add(8).writeU32(1); - // Sing.add(12).writeU32(100); - // Sing.add(16).writeU32(100); - // Sing.add(20).writeU32(100); - // Sing.add(40).writeU32(time()); - // Sing.add(68).writeU32(100); +Gm_InputFunc_Handle.WEQ <- function(SUser, CmdString) { + // // World.MoveArea(SUser, 1, 0, 55, 349); - // local Sing = Memory.alloc(100); - // Sing.add(10).writeInt(1200); - // Sing.add(14).writeInt(100); - // Sing.add(18).writeInt(100); - - // Sq_CallFunc(S_Ptr(0x84DB452), "pointer", ["pointer", "pointer", "pointer"], S_Ptr("0x0"), SUser.C_Object, Sing.C_Object); - - // //修复金币异常 - // //CParty::UseAncientDungeonItems - // var CParty_UseAncientDungeonItems_ptr = ptr(0x859EAC2); - // var CParty_UseAncientDungeonItems = new NativeFunction(CParty_UseAncientDungeonItems_ptr, 'int', ['pointer', 'pointer', 'pointer', 'pointer'], { - // "abi": "sysv" - // }); - // Interceptor.replace(CParty_UseAncientDungeonItems_ptr, new NativeCallback(function(party, dungeon, inven_item, a4) { - // //当前进入的地下城id - // var dungeon_index = CDungeon_get_index(dungeon); - // //根据地下城id判断是否为绝望之塔 - // if ((dungeon_index >= 11008) && (dungeon_index <= 11107)) { - // //绝望之塔 不再扣除金币 - // return 1; - // } - // //其他副本执行原始扣除道具逻辑 - // return CParty_UseAncientDungeonItems(party, dungeon, inven_item, a4); - // }, 'int', ['pointer', 'pointer', 'pointer', 'pointer'])); - // } - - // local exp_bonus = Memory.alloc(4); - // local gold_bonus = Memory.alloc(4); - // local quest_point_bonus = Memory.alloc(4); - // local quest_piece_bonus = Memory.alloc(4); - - // //计算任务基础奖励(不包含道具奖励) - // Sq_CallFunc(S_Ptr(0x866E7A8), "int", ["pointer", "pointer", "pointer", "pointer", "pointer", "pointer", "int"], SUser, pvfQuest, exp_bonus, gold_bonus, quest_point_bonus, quest_piece_bonus, 1); - - // local mitems = {}; - // mitems[3037] <- 500; - // SUser.SendMail(mitems, { - // Title = "标题", - // Text = "内容" - // }); - - // Timer.SetCronTask(function() { - - // }, "1/0/0/0"); //计划任务格式为 1/0/0/0 这样格式的字符串 代表 分 时 天 周 如例子标识的 为每分钟执行1次 - - - // local MoveSUser = World.GetUserByUidCid(2, 2); + // // print(789456); + // local Str = "{\"op\":20074002,\"uid\":1,\"btnX\":430,\"btnY\":500,\"info\":[{\"Toubu\":0,\"Maozi\":0,\"Lianbu\":0,\"Guanghuan\":0,\"Xiongbu\":0,\"Shangyi\":0,\"Pifu\":0,\"Yaobu\":0,\"Xiazhuang\":0,\"Xie\":0,\"MonsterId\":1},{\"Toubu\":0,\"Maozi\":0,\"Lianbu\":0,\"Guanghuan\":0,\"Xiongbu\":0,\"Shangyi\":0,\"Pifu\":0,\"Yaobu\":0,\"Xiazhuang\":0,\"Xie\":0,\"MonsterId\":0}],\"cid\":1}"; + // // local Str = "{\"op\":20078034,\"info\":[{\"job\":3,\"growjob\":0,\"avatar\":[106550521,106560580,106570446,106520529,106500603,106510607,106540583,106580143,106530461],\"name\":\"小号吉祥物\",\"uid\":2,\"cid\":27},{\"job\":3,\"growjob\":1,\"avatar\":[106550521,106560580,106570446,106520529,106500603,106510607,106540583,106580143,106530461],\"name\":\"吉祥物\",\"uid\":3,\"cid\":26},{\"job\":3,\"growjob\":0,\"avatar\":[51265,51400,0,0,52600,53000,0,53800,54200,0,0],\"name\":\"小号吉祥物\",\"uid\":2,\"cid\":27}]}"; + // // local Str = "{\"op\":20064026,\"uid\":2,\"rewards2\":[[{\"item\":3040,\"num\":2,\"item2\":0,\"num2\":0,\"grade\":1,\"count\":1,\"cid\":27}]],\"deathsNum\":0,\"time\":179999,\"state\":1,\"rewards\":[{\"item\":3036,\"num\":1,\"item2\":0,\"num2\":0,\"grade\":0,\"count\":1,\"cid\":27}],\"cid\":27}"; // local Pack = Packet(); - // Pack.Put_Header(0, 22); - // Pack.Put_Short(MoveSUser.GetUniqueId()); - // Pack.Put_Short(500); - // Pack.Put_Short(200); + // Pack.Put_Header(1, 130); // Pack.Put_Byte(1); - // Pack.Put_Short(0); - // Pack.Finalize(true); - // SUser.Send(Pack); - // Pack.Delete(); - // local MoveSUser = World.GetUserByUidCid(2, 2); - - - // local Pack = Packet(); - // Pack.Put_Header(0, 23); - // Pack.Put_Short(MoveSUser.GetUniqueId()); //唯一id - // Pack.Put_Byte(MoveSUser.GetLocation().Town); //城镇 - - - // Pack.Put_Byte(7); //区域 - // Pack.Put_Short(MoveSUser.GetAreaPos().X); - - // Pack.Put_Short(MoveSUser.GetAreaPos().Y); - // Pack.Put_Byte(MoveSUser.GetDirections()); //朝向 - // Pack.Put_Byte(MoveSUser.GetVisibleValues()); //是否可见 - // Pack.Finalize(true); - // print(111); - // SUser.Send(Pack); - // Pack.Delete(); - - // local PartyObj = SUser.GetParty(); - - // Sq_CallFunc(S_Ptr("0x85A73A6"), "int", ["pointer", "pointer", "int"], PartyObj.C_Object, SUser.C_Object, 3037); - - // Haker.LoadHook(S_Ptr("0x859D14E"), - // ["pointer", "pointer"], - // function(args) { - // local PartyObj = Party(args[0]); - // local Ssuser = PartyObj.GetUser(0); - // if (Ssuser) { - // local pack = Packet(args[1]); - // Ssuser.Send(pack); - // } - // return null; - // }, - // function(args) { - - // return null; - // }); - // local RealList = [World.GetUserByUidCid(2, 2), World.GetUserByUidCid(1, 1)]; - - // foreach(_Index, Value in RealList) { - // local SUser = Value; - // local Pack = Packet(); - // Pack.Put_Header(0, 24); - // Pack.Put_Byte(2); //城镇 - // Pack.Put_Byte(0); //区域 - // Pack.Put_Short((RealList.len() - 1)); //几个玩家 要减去自己 - // foreach(__Index, MapObj in RealList) { - // // if (SUser.GetUID() == MapObj.GetUID()) continue; - // Pack.Put_Short(MapObj.GetUniqueId()); - // Pack.Put_Short(MapObj.GetAreaPos().X); - // Pack.Put_Short(MapObj.GetAreaPos().Y); - // Pack.Put_Byte(MapObj.GetDirections()); //朝向 - // Pack.Put_Byte(MapObj.GetVisibleValues()); //是否可见 - // } - // Pack.Put_Byte(1); //是否可见 - // Pack.Finalize(true); - - // foreach(vavava in RealList) { - // vavava.Send(Pack); - // } - // Pack.Delete(); - // } - - // Timer.SetCronTask(TestCronTask, "1/0/0/0", "测试字符串参数"); - // print("注册任务"); - - // Sq_AutoReload("/dp_s/MyProject"); - - // local ms = 2000; - // 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; // 补全毫秒数为两位 - // } - - // print(str); - - // User.SendItemMail(1, 7, [{ - // itemId = 3037, - // num = 100 - // }, { - // itemId = 3038, - // num = 100 - // }], "给你", "东西"); - - // Sq_CallFunc(S_Ptr("0x86C5A84"), "pointer", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int"], Sq_Get_GameWorld(), SUser.C_Object, 1, 1, 200, 200, 0, 0, 0, 0, 0); - - // Haker.LoadHook(S_Ptr("0x86C5A84"), - // ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "pointer"], - // function(args) { - // print(args[0]); - // print(Sq_Get_GameWorld()); - // print(args[2]); - // print(args[3]); - // print(args[4]); - // print(args[5]); - // print(args[6]); - // print(args[7]); - // print(args[8]); - // print(args[9]); - // print(args[10]); - // return null; - // }, - // function(args) { - - // return null; - // }); - - - // local Sm = Memory.alloc(200); - // Sq_CallFunc(S_Ptr("0x8AA5CBA"), "int", ["pointer", "int", "pointer"], S_Ptr("0x949B140"), 7, Sm.C_Object); - // local Bsa = Sq_Point2Blob(Sm.C_Object, 120); - // local str = "[" - // foreach(value in Bsa) { - // str += value; - // str += "," - // } - // str += "]"; - // print(str); - // print("字符串: " + Sm.readUtf8String()); - - // getroottable()._nut_file_md5_table.rawset(file_name, file_md5_string); - - // local opendirAddr = Module.getExportByName(null, "opendir"); - - // function open_dir(dir_path) { - // local path_ptr = Memory.allocUtf8String(dir_path).C_Object; - // return Sq_CallFunc(opendirAddr, "pointer", ["pointer"], path_ptr); - // } - // local dir_pointer = open_dir("/dp_s/"); - // print("dir_pointer = " + dir_pointer); - - // local Pack = Packet(); - // Pack.Put_Header(1, 83); - // Pack.Put_Byte(1); - // Pack.Put_Byte(11) - // Pack.Put_Short(8195); - // Pack.Put_Int(1); - // Pack.Put_Short(65535); - // Pack.Put_Byte(1); - // Pack.Put_Byte(12); - // Pack.Put_Byte(1); - // Pack.Put_Byte(13); - // Pack.Put_Byte(25); + // Pack.Put_Int(Str.len()); + // Pack.Put_Binary(Str); // Pack.Finalize(true); // SUser.Send(Pack); // Pack.Delete(); + // print("下发模拟包"); + // local A = NativePointer(SUser.C_Object).add(16); + // local B = A.readPointer(); + // local C = NativePointer(B).add(101); + // local D = NativePointer(C).add(8).readInt(); - // GameManager.SetGameMaxLevel(95); + Sq_CallFunc(S_Ptr("0x84EC002"), "int", ["pointer", "int"], SUser.C_Object, 0); - // Sq_HookFunc(); + local D = Sq_CallFunc(S_Ptr("0x8696600"), "int", ["pointer"], SUser.C_Object); + print(D); - // Sq_HookFunc(S_Ptr("0x8678526"), - // 2, - // function(a,args) { - // print("AAA动态HOOK成功 城镇移动HOOK"); - // print(CUser); - // print(id); - // }, - // function(a,args) { - // print("AAA动态HOOK成功 城镇移动HOOK"); - // print(CUser); - // print(id); - // }); - - - //给角色发消息var CUser_SendNotiPacketMessage = new NativeFunction(ptr(0x86886CE), 'int', ['pointer', 'pointer', 'int'], { "abi": "sysv" }); - - // Sq_CallFunc(S_Ptr("0x86886CE"), "int", ["pointer", "pointer","int"], SUser.C_Object, Memory.allocUtf8String("测试信息"),14); - // Sq_HookFunc(S_Ptr("0x8678526"), - - /* - // 发包 - Haker.LoadHook("0x86485BA", ["pointer", "pointer", "int"], - function(args) { - print(args[0]); - local Pack = NativePointer(args[1]); - Pack = NativePointer(Pack.readPointer()); - local headIndex = Pack.add(0x19).readU16(); - if (headIndex == 83) { - print("发了83包"); - - // local Bo = Sq_Point2Blob(args[1], 100); - - // local Str = "["; - // foreach(Value in Bo) { - // Str = format("%s%02X", Str, Value); - // Str += ","; - // } - // Str += "]"; - // print(Str); - - // local bufftype = Pack.add(0x28).readU8(); - // local itemSlot = Pack.add(0x29).readU16(); - // local itemCount = Pack.add(0x2B).readU32(); - // local upType = Pack.add(0x31).readU8(); - // local ret = Pack.add(0x33).readU8(); - // local newUpLevel = Pack.add(0x34).readU8(); - // local equSlot = Pack.add(0x35).readU16(); - // print("bufftype: " + bufftype); - // print("itemSlot: " + itemSlot); - // print("itemCount: " + itemCount); - // print("upType: " + upType); - // print("ret: " + ret); - // print("newUpLevel: " + newUpLevel); - // print("equSlot: " + equSlot); - } - return null; - }, - function(args) { - - return null; - }); - - Haker.LoadHook("0x080FC850", ["pointer", "pointer", "pointer", "int", "void"], - function(args) { - // local Arr = [0x95, 0xDA, 0xF6, 0x12, 0x25, 0xDF, 0xE0, 0x0B, 0x48, 0xDF, 0xCC, 0xC6, 0x95, 0xDA, 0x31, 0x3F, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0xBE, 0x6B, 0x00, 0x00, 0xFF, 0xFF, 0x3C, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xB9, 0xB8, 0xE5, 0xAD, 0x98, 0xE8, 0x80, 0x85, 0xE7, 0x9A, 0x84, 0xE5, 0xA5, 0xA7, 0xE7, 0xA5, 0x95]; - - // Sq_Memory_WriteByteArr(args[2], Arr); - - // local Address = NativePointer(args[2]).add(35); - // NativePointer(Address).writeU8(0x3c); - // // local Address2 = NativePointer(args[2]).add(36); - // NativePointer(Address).writeShort(65535); - // NativePointer(Address2).writeShort(0x3E); - - local Bo = Sq_Point2Blob(args[2], 100); - - local Str = "["; - foreach(Value in Bo) { - Str = format("%s%02X", Str, Value); - Str += ","; - } - Str += "]"; - print(Str); - return null; - }, - function(args) { - local Pos = NativePointer(args[2]).add(27).readU16(); - local SUser = User(args[1]); - SUser.SendUpdateItemList(1, 0, Pos); - - // local Pack = Packet(); - // Pack.Put_Header(1, 83); - // Pack.Put_Byte(1); - // Pack.Put_Byte(11) - // Pack.Put_Short(8195); - // Pack.Put_Int(0); - // Pack.Put_Short(65535); - // Pack.Put_Byte(0); - // Pack.Put_Byte(30); - // Pack.Put_Byte(0); - // Pack.Put_Byte(31); - // Pack.Put_Byte(25); - // Pack.Finalize(true); - // SUser.Send(Pack); - // Pack.Delete(); - - return null; - }); - */ - - // Sq_CallFunc(S_Ptr("0x84ECAA2"), "pointer", ["pointer", "float"], SUser.C_Object, 5.5); - - /* - - - - function(args) { - print("AAA动态HOOK成功 城镇移动HOOK"); - print(CUser); - print(id); - } - - */ - // local md5 = MD5.GetFile("/dp_s/a.txt"); - // print("Md5文本值: " + md5); - // local Arr = []; - // foreach(char in md5) { - // Arr.append(char.tointeger()); - // } - // print("Md5字符值>>>"); - // printT(Arr); - - - // local Io = IO("/dp_s/a.txt", "r+"); - // local Ret = Io.ReadBuffer(256); - // printT(Ret); - // Io.Close(); - - // local coro = newthread(TestIoP); - // Timer.SetTimeOut(TestThread, 0, coro); - // Timer.SetTimeOut(TestL, 1); - - // local FileObj = file("/dp_s/a.txt", "r+"); - - // local Arr = [0, 1]; - // local T = { - // TestWn = 666 - // }; - // // Arr.insert(0,getroottable()); - // Arr.insert(0, T); - // TestWn.acall(Arr); - - // sq_RunScript("测试加密脚本.sut"); - // local Opendir = Module.getExportByName(null, "opendir"); - // local Readdir = Module.getExportByName(null, "readdir"); - // local Closedir = Module.getExportByName(null, "closedir"); - // print("Opendir: " + Opendir); - // print("Readdir: " + Readdir); - // print("Closedir: " + Closedir); - - // local UserList = World.GetOnlinePlayer(); - - // foreach (SUserObj in UserList) { - // print(SUserObj.GetCharacLevel()); - // } - - // api_exec_delay_function(function() { - // print("先注册") - // }, 2); - - // api_exec_delay_function(function() { - // print("后注册") - // }, 5); - - - // local rbTree = RedBlackTree(); - // // rbTree.insert(10); - // // rbTree.insert(40); - // // rbTree.insert(20); - // // rbTree.insert(50); - // // rbTree.insert(30); - // // rbTree.insert(752); - // // rbTree.insert(54); - // // rbTree.insert(12); - // // rbTree.insert(787); - // // rbTree.insert(26); - // // rbTree.insert(278); - - // rbTree.inorderTraversal(); - - // local l = rbTree.pop(); - // print(">>>"); - // print("弹出值: " + l); - // print(">>>"); - // rbTree.inorderTraversal(); - - - // Timer.SetTimeOut(function() { - // print("注册 5 秒后执行") - // }, 5); - // Timer.SetTimeOut(function() { - // print("注册 3 秒后执行") - // }, 3); - // Timer.SetTimeOut(function() { - // print("注册 2 秒后执行") - // }, 2); }; -Gm_InputFunc_Handle.WEQ <- function(SUser, CmdString) { - // World.MoveArea(SUser, 1, 0, 55, 349); - - // print(789456); - // local Str = "{\"op\":20078034,\"info\":[{\"uid\":1,\"name\":\"Kina\",\"growjob\":4,\"avatar\":[101550559,101560718,101570470,101520542,101500739,101510903,101540654,101580144,101530499],\"job\":0},{\"uid\":2,\"name\":\"SQDQSD\",\"growjob\":17,\"avatar\":[105550431,105560424,105570386,105520415,105500424,105510429,105540408,105580144,105530361],\"job\":5},{\"name\":\"Kina\",\"growjob\":4,\"avatar\":[601550071,601560067,601570062,601500069,601510068,601540069,601520061,601530060,601580026,42219],\"job\":0},{\"name\":\"SQDQSD\",\"growjob\":17,\"avatar\":[601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021],\"job\":0},{\"name\":\"Kina\",\"growjob\":4,\"avatar\":[601550071,601560067,601570062,601500069,601510068,601540069,601520061,601530060,601580026,42219],\"job\":0},{\"name\":\"SQDQSD\",\"growjob\":17,\"avatar\":[601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021],\"job\":0},{\"name\":\"Kina\",\"growjob\":4,\"avatar\":[601550071,601560067,601570062,601500069,601510068,601540069,601520061,601530060,601580026,42219],\"job\":0},{\"name\":\"SQDQSD\",\"growjob\":17,\"avatar\":[601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021],\"job\":0}]}"; - local Str = "{\"op\":20084038,\"uid\":2,\"type\":9,\"cid\":2}"; - local Pack = Packet(); - Pack.Put_Header(1, 130); - Pack.Put_Byte(1); - Pack.Put_Int(Str.len()); - Pack.Put_Binary(Str); - Pack.Finalize(true); - SUser.Send(Pack); - Pack.Delete(); - - print("asdasdadad"); - +Gm_InputFunc_Handle.QS <- function(SUser, CmdString) { + SUser.RechargeCeraPoint(10000); +}; +Gm_InputFunc_Handle.QS2 <- function(SUser, CmdString) { + SUser.RechargeCeraPoint(-100); +}; +Gm_InputFunc_Handle.Test <- function(SUser, CmdString) { + SUser.SetCharacLevel(60); }; function HexStringToInt(Str) { @@ -773,40 +357,637 @@ function UserdataSliceStr(Data) { return Ret; } -// //幸运值获取装备品级 -// Haker.LoadHook("0x08550BE4", ["pointer", "pointer", "int", "int", "int"], -// function(args) { -// local P = args[0]; -// local ABuf = NativePointer(P).readPointer(); -// local BBuf = NativePointer(P).add(4).readPointer(); -// local A = HexStringToInt(UserdataSliceStr(ABuf).slice(-5)); -// local B = HexStringToInt(UserdataSliceStr(BBuf).slice(-5)); -// local Size = (B - A) >> 2; -// print(Size); -// }, -// function(args) { -// return 4; -// }); +// MultiMailBoxCloseRindroMap <- null; +// Cb_MultiMailBoxReqSend_Enter_Func.CloseRindro <- function(args) { +// MultiMailBoxCloseRindroMap = Memory.alloc(144370 * 4); +// MultiMailBoxCloseRindroMap.add(144369 * 4).writeInt(0); +// args[1] = MultiMailBoxCloseRindroMap.C_Object; +// return args; +// } +// Cb_MultiMailBoxReqSend_Leave_Func.CloseRindro <- function(args) { +// MultiMailBoxCloseRindroMap = null; +// } + +// //Hook -Cb_fnStatQuestClear_Enter_Func.text <- function(args) { - local user = User(args[0]) - print(args[1]); - print(user.GetCharacName()); +/* + + + +function xorEncryptDecrypt(BlobObj, Key) { + for (local i = 0; i< Key.len(); i++) { + local currentKeyChar = Key[i % Key.len()]; + BlobObj[i] = BlobObj[i] ^ currentKeyChar; + } + local Arr = []; + foreach(value in BlobObj) { + Arr.append(value); + } + return Arr; +} + +function base64_encode(input) { + local base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + local inputLength = input.len(); + local i = 0; + local j = 0; + local charArray3 = array(3); + local charArray4 = array(4); + local encoded = ""; + + while (inputLength--) { + charArray3[i++] = input[inputLength]; + if (i == 3) { + charArray4[0] = (charArray3[0] & 0xfc) >> 2; + charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4); + charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6); + charArray4[3] = charArray3[2] & 0x3f; + + for (i = 0; i< 4; i++) { + encoded += base64_chars[charArray4[i]]; + } + i = 0; + } + } + + if (i) { + for (j = i; j< 3; j++) { + charArray3[j] = 0; + } + + charArray4[0] = (charArray3[0] & 0xfc) >> 2; + charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4); + charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6); + charArray4[3] = charArray3[2] & 0x3f; + + for (j = 0; j< i + 1; j++) { + encoded += base64_chars[charArray4[j]]; + } + + while (i++<3) { + encoded += "="; + } + } + + return encoded; +} + +Timer.SetTimeOut(function() { + local Key = "desaqe"; + local Str = "Test Data"; + print("old: " + Str); + local StrPointer = Memory.allocUtf8String(Str); + local BlobObj = StrPointer.readBinary(Str.len()); + local Arr = xorEncryptDecrypt(BlobObj, Key); + StrPointer.writeByteArray(Arr); + //此时str已不可读 需要掌控其指针 与 长度 + local NewStrPointer = StrPointer; + local encodestr = base64_encode(NewStrPointer.readUtf8String(Str.len())); + print("encode: " + encodestr); + + local BlobObj = NewStrPointer.readBinary(Str.len()); + local Arr = xorEncryptDecrypt(BlobObj, Key); + NewStrPointer.writeByteArray(Arr); + print("new: " + NewStrPointer.readUtf8String()); +}, 1); + +*/ + + +//分割道具列表 +function splitItemList(item_list, maxSlots) { + local length = item_list.len(); + if (length <= maxSlots) { + return [item_list]; + } + + local result = []; + for (local i = 0; i< length; i += maxSlots) { + local end = i + maxSlots; + if (end > length) { + end = length; + } + result.append(item_list.slice(i, end)); + } + return result; +} + +//角色类 发送邮件函数 (标题, 正文, 金币, 道具列表[[3037,100],[3038,100]]) +function User::ReqDBSendMultiMail(title, text, gold, item_list) { + local Cid = this.GetCID(); + // 获取分割后的道具列表 + local subLists; + local maxSlots = 10; + local length = item_list.len(); + if (length <= maxSlots) { + subLists = [item_list]; + } else { + subLists = []; + for (local i = 0; i< length; i += maxSlots) { + local end = i + maxSlots; + if (end > length) { + end = length; + } + subLists.append(item_list.slice(i, end)); + } + } + if (subLists) { + // 为每个子列表发送邮件 + for (local i = 0; i< subLists.len(); ++i) { + local subList = subLists[i]; + + // 添加道具附件 + local vector = Memory.alloc(100); + + Sq_CallFunc(S_Ptr("0x81349D6"), "pointer", ["pointer"], vector.C_Object); + Sq_CallFunc(S_Ptr("0x817A342"), "pointer", ["pointer"], vector.C_Object); + //将所有要发送的道具写入Vector + for (local j = 0; j< subList.len(); ++j) { + //道具ID 分配4字节内存 + local item_id = Memory.alloc(4); + //道具数量 分配4字节内存 + local item_cnt = Memory.alloc(4); + //写入道具ID和数量 + item_id.writeInt(subList[j][0]); + item_cnt.writeInt(subList[j][1]); + + local pair = Memory.alloc(100); + + Sq_CallFunc(S_Ptr("0x81B8D41"), "pointer", ["pointer", "pointer", "pointer"], pair.C_Object, item_id.C_Object, item_cnt.C_Object); + Sq_CallFunc(S_Ptr("0x80DD606"), "pointer", ["pointer", "pointer"], vector.C_Object, pair.C_Object); + } + + // 邮件支持10个道具附件格子 + local addition_slots = Memory.alloc(1000); + + for (local j = 0; j< 10; ++j) { + Sq_CallFunc(S_Ptr("0x80CB854"), "pointer", ["pointer"], addition_slots.add(j * 61).C_Object); + } + + Sq_CallFunc(S_Ptr("0x8556A14"), "int", ["pointer", "pointer", "int"], vector.C_Object, addition_slots.C_Object, 10); + + local title_ptr = Memory.allocUtf8String(title); // 邮件标题 + local text_ptr = Memory.allocUtf8String(text); // 邮件正文 + + local text_len = text.len(); // 邮件正文长度 + + // 发邮件给角色 + Sq_CallFunc(S_Ptr("0x8556B68"), "int", ["pointer", "pointer", "int", "int", "int", "pointer", "int", "int", "int", "int"], title_ptr.C_Object, addition_slots.C_Object, subList.len(), gold, Cid, text_ptr.C_Object, text_len, 0, 99, 1); + } + } +} + + + +function WongWork_CQuestClear_isClearedQuest(QuestInfo, QuestID) { + return Sq_CallFunc(S_Ptr("0x808BAE0"), "bool", ["pointer", "int"], QuestInfo, QuestID); +} + +// 判断任务是否为主线并且角色等级符合要求 +function isMainQuestAndLevelValid(pvfQuest, characLevel) { + local questGrade = NativePointer(pvfQuest).add(8).readInt(); + local questLv = NativePointer(pvfQuest).add(0x20).readInt(); + return questGrade == 0 && questLv <= characLevel; +} + +// 设置任务为已完成 +function clearQuest(QuestInfo, QuestID) { + Sq_CallFunc(S_Ptr("0x808BA78"), "int", ["pointer", "int"], QuestInfo, QuestID); +} + +function User::SendCharacQp() { + Sq_CallFunc(S_Ptr("0x868AC24"), "int", ["pointer"], this.C_Object); +} + +function User::SendCharacQuestPiece() { + Sq_CallFunc(S_Ptr("0x868AF2C"), "int", ["pointer"], this.C_Object); +} + +function User::MainTaskCompleted() { + // 获取角色任务信息和等级 + local userQuest = GetQuest(); + local questIsClear = NativePointer(userQuest).add(4); + local characLevel = GetCharacLevel(); + local allClearQuest = 0; + // 获取 pvf 数据 + local DataManager = Sq_CallFunc(S_Ptr("0x80CC19B"), "pointer", []); + + //完成当前等级所有任务总经验奖励 + local total_exp_bonus = 0; + //完成当前等级所有任务总金币奖励 + local total_gold_bonus = 0; + //任务点奖励 + local total_quest_point_bonus = 0; + local total_quest_piece_bonus = 0; + + //任务最大编号: 29999 + for (local quest_id = 1; quest_id< 30000; quest_id++) { + //跳过已完成的任务 + if (WongWork_CQuestClear_isClearedQuest(questIsClear.C_Object, quest_id)) continue; + + local achievement = [3606, 4303, 3, 1028, 4, 5, 6, 59, 4423, 2, 60, 61, 6670, 446, 9, 10, 11, 12, 13, 14, 15, 21, 1332, 400, 402, 401, 403, 399, 24, 4572, 25, 26, 58, 93, 5851, 5850, 5852, 5853, 4392, 4393, 4394, 4395, 4396, 4397]; + local found = false; + for (local i = 0; i< achievement.len(); i++) { + if (achievement[i] == quest_id) { + found = true; + break; + } + } + + //获取任务数据 + local quest = Sq_CallFunc(S_Ptr("0x835FDC6"), "pointer", ["pointer", "int"], DataManager, quest_id); + if (!quest || found == true) continue; // 跳过空任务或不需要完成的任务 + + // 判断是否为主线任务且等级符合要求 + if (!isMainQuestAndLevelValid(quest, characLevel)) continue; + + //获取该任务的基础奖励 + local exp_bonus = Memory.alloc(4); + local gold_bonus = Memory.alloc(4); + local quest_point_bonus = Memory.alloc(4); + local quest_piece_bonus = Memory.alloc(4); + //QP奖励已直接发送到角色 经验/金币只返回结果 需要手动发送 + CUser_quest_basic_reward(this.C_Object, quest, exp_bonus.C_Object, gold_bonus.C_Object, quest_point_bonus.C_Object, quest_piece_bonus.C_Object, 1); + + local exp = exp_bonus.readInt(); + local gold = gold_bonus.readInt(); + local quest_point = quest_point_bonus.readInt(); + local quest_piece = quest_piece_bonus.readInt(); + + if (quest_point > 0) total_quest_point_bonus += quest_point; //没有[quest point]字段的任务 + if (quest_piece > 0) total_quest_piece_bonus += quest_piece; + + clearQuest(questIsClear.C_Object, quest_id); + allClearQuest++; + } + + local Pack = Packet(); + //通知客户端刷新任务列表 + Sq_CallFunc(S_Ptr("0x86ABBA8"), "int", ["pointer", "pointer"], userQuest, Pack.C_Object); + Send(Pack); + Pack.Delete(); + + SendNotiPacket(0, 2, 0); + SendNotiPacket(1, 2, 1); + SendUpdateItemList(1, 0, 0); + SendCharacQp(); + SendCharacQuestPiece(); + + // 发送通知 + SendNotiPacketMessage("已清理:" + allClearQuest + "个主线任务!", 8); +} + + +function User::DropItem(ItemId, Xpos, Ypos) { + local PartyObj = GetParty(); + if (!PartyObj) return; + //更改掉落物的坐标 + NativePointer("0x085A7599").writeShort(Xpos); + NativePointer("0x085A759F").writeShort(Ypos); + //申请一块内存用于存放包地址 + local PackBuffer = Memory.alloc(8); + PackBuffer.writeInt(947330670); + local StrBuffer = "" + PackBuffer.C_Object; + local AddressStr = StrBuffer.slice(StrBuffer.find("0x") + 2, -1); + local HexCode = Haker.AsmGenerateMcd( + "mov ebx," + AddressStr, + "mov [ebx], eax", + "mov ebx , 0", + "mov eax, 0x85A775B", + "jmp eax"); + + Haker.InsertCode("0x85A773C", HexCode); + + //调用逻辑 包才会生成 + Sq_CallFunc(S_Ptr("0x85A73A6"), "int", ["pointer", "pointer", "int"], PartyObj.C_Object, this.C_Object, ItemId); + + local Pack = Packet(PackBuffer.readPointer()); + Send(Pack); + //销毁包 + Sq_CallFunc(S_Ptr("0x858DE80"), "void", ["pointer"], Pack.C_Object); + //还原逻辑 + Sq_WriteByteArr(S_Ptr("0x85A773C"), [0x89, 0x44, 0x24, 0x04, 0x8B, 0x45, 0x08]); + NativePointer("0x085A7599").writeShort(300); + NativePointer("0x085A759F").writeShort(240); +} + + +Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) { + // SUser.ReqDBSendMultiMail("测试邮件", "测试邮件正文", 1000, [ + // [3037, 1000], + // [3038, 200] + // ]); + + SUser.DropItem(27095, 800, 200); + + + // SUser.MainTaskCompleted(); }; Timer.SetTimeOut(function() { - local P = S_Ptr("0x08550BE4"); - local ABuf = NativePointer(P).readPointer(); - print("ABuf: " + ABuf); - local BBuf = NativePointer(P).add(4).readPointer(); - print("BBuf: " + BBuf); - local A = HexStringToInt(UserdataSliceStr(ABuf).slice(-5)); - print("A:" + A); - local B = HexStringToInt(UserdataSliceStr(BBuf).slice(-5)); - print("B:" + B); - local Size = (B - A) >> 2; - print(Size); -}, 0) \ No newline at end of file + + // Haker.LoadHook("0x0834F776", ["pointer", "int", "int"], + // function(args) { + // print(args[0]); + // print(args[1]); + // return null; + // }, + // function(args) { + // print(args[2]); + // return null; + // }); + + Haker.LoadHook("0x0830BC78", ["pointer", "pointer", "pointer", "pointer", "pointer", "int"], + function(args) { + return null; + }, + function(args) { + getroottable().LashKillMonsterId <- NativePointer(args[2]).add(3 * 4).readInt(); + return null; + }); + + + + Haker.LoadHook("0x085A27E8", ["pointer", "pointer", "short", "pointer", "pointer", "int"], + function(args) { + return null; + }, + function(args) { + //杀死怪物了 要判断是否掉落 + //获取队伍 + local PartyObj = Party(args[0]); + //获取战斗对象 + local BattleFieldObj = PartyObj.GetBattleField(); + + + + //怪物等级 + local MonsterLevel = NativePointer(args[4]).add(2605).readInt(); + print("怪物等级: " + MonsterLevel); + + //怪物ID + local MonsterId = getroottable().LashKillMonsterId; + print("怪物ID: " + MonsterId); + + //坐标 + local Xpos = NativePointer(args[4]).add(2596).readShort(); + local Ypos = NativePointer(args[4]).add(2598).readShort(); + print("坐标: " + Xpos + "," + Ypos); + + + local DgnObj = BattleFieldObj.GetDgn(); + //副本名称 + local DgnName = DgnObj.GetName(); + print("副本名称: " + DgnName); + + //副本ID + local DgnId = DgnObj.GetId(); + print("副本ID: " + DgnId); + + //副本等级 + local DgnLevel = DgnObj.GetMinLevel(); + print("副本等级: " + DgnLevel); + + //深渊标识 + local HellDiff = BattleFieldObj.GetHellDifficulty(); + print("深渊标识: " + HellDiff); + + + for (local i = 0; i< 4; i++) { + local SUser = PartyObj.GetUser(i); + if (SUser) { + SUser.DropItem(MathClass.Rand(3033, 3042), Xpos, Ypos); + // print("玩家名称: " + SUser.GetCharacName()); + } + } + return null; + }); + + + + //修改独立掉落原逻辑为不掉落 + local HexCode = Haker.AsmGenerateMcd( + "mov eax, 0x830CD5D", + "jmp eax"); + Haker.InsertCode("0x830CCE2", HexCode); + + + // local HexCode = Haker.AsmGenerateMcd( + // "mov eax,0x666", + // "mov ebx,0x86B1B98", + // "jmp ebx"); + + // Haker.InsertCode("0x86B1B93", HexCode); + + // local RandNum = Sq_CallFunc(S_Ptr("0x086B1B87"), "int", ["int"], -6); + // print("返回的随机值: " + RandNum); + + + + + + //公有方法 获取本机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", + // time = clock() + // }); + // }); + + + + //初始化PVF 可传路径 可不传 + // Script(); + + //读取装备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); + // } + // }); + + // Script(); + // local Tim = clock(); + // local Buffer = ScriptData.GetFileData("etc/independent_drop.etc", function(DataTable, Data) { + // while (!Data.Eof()) { + // local Buf = Data.Get(); + // } + // }); + + // print("耗时: " + (clock() - Tim)); + + + // Haker.InsertCode("0x86B1B93", [0xB8, 0x06, 0x00, 0x00, 0x00, 0xBB, 0x98, 0x1B, 0x6B, 0x08, 0xFF, 0xE3]); + + // local RandNum = Sq_CallFunc(S_Ptr("0x086B1B87"), "int", ["int"], -6); + // print("返回的随机值: " + RandNum); + + + + +}, 1); + + + +ClientSocketPackFuncMap.rawset(21091001, function (SUser, Jso) +{ + printT(Jso); + if(Jso.type == 0){ + saveItemToInven(SUser); + } +}); + + + +Register_DPS_Pack(1, function(SUser, Pack) { + printT(Pack); + SUser.Send_DPS_Pack(1, { + ttt = 1, + }) +}); + + + +// //收到查询我的战绩包 查询我的战绩 注意这个包不止我请求的时候要发 一局游戏结束了以后 你要主动刷这个包 +// ClientSocketPackFuncMap.rawset(20092097, function(SUser, Jso) { +// local evv = { +// op = 20092098, +// WinCount = 1, //胜利场次 +// Ranking = 2, //排名 +// OnlineRanking = 56, //跨服排名 +// TicketCount = 3, //入场卷数量 +// } +// SUser.SendJso(evv); +// }); + +// //收到开始匹配包 服务端进入匹配状态 告诉客户端开始匹配了 +// ClientSocketPackFuncMap.rawset(20092001, function(SUser, Jso) { +// local evv = { +// op = 20092002, +// } +// SUser.SendJso(evv); + +// //这里添加的是定时任务 两秒后默认开局 在你那边你应该是正常匹配 然后开局了给客户端发消息 +// Timer.SetTimeOut(function() { +// //角色类 名字 职业 穿戴装备 +// local Charac = { +// Name = "测试角色", +// Job = 8, +// Equ = [26373, 107550220, 107560223, 107570188, 107520224, 107500233, 107510231, 107540209, 107580129, 107530192], +// CardList = [0, 1, 2, 3, 1] +// } + +// //这里发送角色类List 0号位是自己 然后顺时针坐玩家 发送主牌ID +// local evv = { +// op = 20092006, +// CharacList = [Charac, Charac, Charac, Charac], +// MainCard = 2 +// } + +// SUser.SendJso(evv); +// }, 500); +// }); +// //收到取消匹配包 服务端进入匹配状态 告诉客户端取消匹配了 +// ClientSocketPackFuncMap.rawset(20092003, function(SUser, Jso) { +// local evv = { +// op = 20092004, +// } +// SUser.SendJso(evv); +// }); +// //收到出牌包 +// ClientSocketPackFuncMap.rawset(20092007, function(SUser, Jso) { +// //这里CardList 是玩家打出了它手上的第几张牌 而不是牌的ID List +// local CardList = Jso.CardList; +// //..... 这里需要对牌做校验 是不是相同的牌 或者万能牌 +// //如果校验通过了 发送出牌回调包给客户端告诉他出牌成功 这里要告诉所有的牌桌上的玩家 如果是出牌人则发0 CharacId 其他人 要发他们那里对应的ID +// local evv = { +// op = 20092008, +// CharacId = 1, +// CardList = CardList +// }; +// SUser.SendJso(evv); +// }); + +// //主动下发 回合信息包 20092010 要告诉客户端的玩家 现在是谁的回合 回合剩余时间多少秒 注意每个客户端的玩家你要发送不同的位置信息给他的 +// local evv = { +// //谁的回合 +// RoundCharac = 0; +// //剩余多少时间 (这个应该是在你的配置里) +// RoundTime = 30; +// }; + +// //主动下发 质疑包 20092012 要告诉客户端的玩家 谁要质疑 注意每个客户端的玩家你要发送不同的位置信息给他的 质疑翻牌信息 +// local evv = { +// //质疑玩家 +// QuestionCharac = 0; +// //质疑牌List (注意这里发的不是牌的位置了 是牌对应的ID 一开始分配的那个) +// QuestionCardList = [0, 1, 2, 3, 1]; +// }; + +// //主动下发 刷新玩家信息包 20092014 要告诉客户端的玩家 谁还剩多少血 0就是没血了 -1就是这个地方是没有玩家的 1就是还剩1滴血 +// local evv = { +// Charac = [0, -1, 1, -1] +// }; + +// //主动下发 结算包 20092018 一局游戏结束了 发包给我 +// local evv = { +// //0 是你输了 1是你赢了 +// Win = 0 +// }; + +// //主动下发 牌桌显示公告 20092016 这个公告文字我会显示在牌桌上的 是你一些重要信息 比如谁打出了什么牌 质疑什么的之类的 +// local evv = { +// //消息 +// Msg = "公告消息" +// }; + +// //收到聊天信息包 +// ClientSocketPackFuncMap.rawset(20092099, function(SUser, Jso) { +// //这里是左下角聊天框打字发送上来的信息 +// local MsgBuffer = Jso.Msg; +// //转发给所有玩家 包括他自己 +// local evv = { +// op = 20092100, +// Msg = MsgBuffer, +// }; +// SUser.SendJso(evv); +// }); \ No newline at end of file diff --git a/Dps_A/ProjectClass/A_ServerControl/ServerControl.nut b/Dps_A/ProjectClass/A_ServerControl/ServerControl.nut index d84e97c..a3b0124 100644 --- a/Dps_A/ProjectClass/A_ServerControl/ServerControl.nut +++ b/Dps_A/ProjectClass/A_ServerControl/ServerControl.nut @@ -104,6 +104,10 @@ class ServerControl { local UserInfo = []; foreach(_Index, SUser in UserList) { if (SUser) { + local growjob = SUser.GetCharacGrowType(); + if (growjob >= 16) { + growjob = growjob - 16; + } local T = { uid = SUser.GetUID(), cid = SUser.GetCID(), @@ -112,7 +116,7 @@ class ServerControl { //基础职业 job = SUser.GetCharacJob(), //转职职业 - growjob = SUser.GetCharacSecondGrowType(), + growjob = SUser.GetCharacGrowType(), //觉醒职业 Secondjob = SUser.GetCharacSecondGrowType(), //等级 @@ -129,6 +133,9 @@ class ServerControl { cerapoint = SUser.GetCeraPoint(), //胜点 winpoint = SUser.GetWinPoint(), + //时装信息 + avatar = SUser.GetAva() + }; UserInfo.append(T); } else { @@ -141,6 +148,51 @@ class ServerControl { Socket.SendGateway(Jso); }); + + //根据名称查询玩家信息 + GatewaySocketPackFuncMap.rawset(20241124, function(Jso) { + local SUser = World.GetUserByName(Jso.Name); + + if (SUser) { + local T = { + uid = SUser.GetUID(), + cid = SUser.GetCID(), + //名字 + name = SUser.GetCharacName(), + //基础职业 + job = SUser.GetCharacJob(), + //转职职业 + growjob = SUser.GetCharacSecondGrowType(), + //觉醒职业 + Secondjob = SUser.GetCharaecondGrowType(), + //等级 + level = SUser.GetCharacLevel(), + //使用了多少疲劳 + fatigue = SUser.GetFatigue(), + //总疲劳 + maxfatigue = SUser.GetMaxFatigue(), + //是否是GM + isgm = SUser.IsGmMode(), + //点券 + cera = SUser.GetCera(), + //代币 + cerapoint = SUser.GetCeraPoint(), + //胜点 + winpoint = SUser.GetWinPoint(), + //时装信息 + avatar = SUser.GetAva() + + }; + Jso.userinfo <- T; + + } else { + Jso.userinfo <- null; + } + + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + }); + //将玩家移出副本 GatewaySocketPackFuncMap.rawset(20240420, function(Jso) { local UserList = []; @@ -177,6 +229,111 @@ class ServerControl { }); + //注册区域不可见hook + GatewaySocketPackFuncMap.rawset(20241128, function(Jso) { + local id = Jso.id; + local Town = Jso.Town; + local Area = Jso.Area; + + Cb_Insert_User_Func[id] <- function(C_Area, C_User) { + local SUser = User(C_User); + if (SUser.GetLocation().Town == Town && SUser.GetLocation().Area == Area) { + Sq_WriteAddress(C_Area, 0x68, 1); + } + } + }); + + //设置玩家可见 + GatewaySocketPackFuncMap.rawset(20241130, function(Jso) { + local uids = Jso.uids; + + local RealList = []; + foreach(uid in uids) { + local SUser = World.GetUserByUid(uid); + if (SUser && SUser.GetState() >= 3) RealList.append(SUser); + } + foreach(_Index, Value in RealList) { + local SUser = Value; + local Pack = Packet(); + Pack.Put_Header(0, 24); + Pack.Put_Byte(SUser.GetLocation().Town); //城镇 + Pack.Put_Byte(SUser.GetArea(1)); //区域 + Pack.Put_Short((RealList.len() - 1)); //几个玩家 要减去自己 + foreach(__Index, MapObj in RealList) { + if (SUser.GetUID() == MapObj.GetUID()) continue; + Pack.Put_Short(MapObj.GetUniqueId()); + Pack.Put_Short(MapObj.GetAreaPos().X); + Pack.Put_Short(MapObj.GetAreaPos().Y); + Pack.Put_Byte(MapObj.GetDirections()); //朝向 + Pack.Put_Byte(MapObj.GetVisibleValues()); //是否可见 + } + Pack.Put_Byte(1); //是否可见 + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + }); + + //退出可见列表 + GatewaySocketPackFuncMap.rawset(20241132, function(Jso) { + local uids = Jso.uids; + local uid = Jso.uid; + local MUser = World.GetUserByUid(uid); + + foreach(_Index, Value in uids) { + local SUser = World.GetUserByUid(Value); + if (!SUser || !(SUser.GetState() >= 3) || !MUser || !(MUser.GetState() >= 3)) continue; + if (SUser.GetUID() == MUser.GetUID()) continue; + local Pack = Packet(); + Pack.Put_Header(0, 23); + Pack.Put_Short(MUser.GetUniqueId()); //唯一id + Pack.Put_Byte(MUser.GetLocation().Town); //城镇 + + + Pack.Put_Byte(99); //区域 + Pack.Put_Short(MUser.GetAreaPos().X); + + Pack.Put_Short(MUser.GetAreaPos().Y); + Pack.Put_Byte(MUser.GetDirections()); //朝向 + Pack.Put_Byte(MUser.GetVisibleValues()); //是否可见 + Pack.Finalize(true); + + SUser.Send(Pack); + Pack.Delete(); + } + }); + + + //玩家移动回调 + GatewaySocketPackFuncMap.rawset(20241134, function(Jso) { + + local MoveSUser = World.GetUserByUid(Jso.uid); + if (!MoveSUser) return; + + local uids = Jso.list; + local RealList = []; + foreach(uid in uids) { + local SUser = World.GetUserByUid(uid); + if (SUser && SUser.GetState() >= 3) RealList.append(SUser); + } + + local Pack = Packet(); + Pack.Put_Header(0, 22); + Pack.Put_Short(MoveSUser.GetUniqueId()); + Pack.Put_Short(Jso.XPos); + Pack.Put_Short(Jso.YPos); + Pack.Put_Byte(Jso.Direction); + Pack.Put_Short(Jso.Code); + Pack.Finalize(true); + + + foreach(_Index, Value in RealList) { + local SUser = Value; + if (SUser.GetUniqueId() == MoveSUser.GetUniqueId()) continue; + SUser.Send(Pack); + } + Pack.Delete(); + }); //给注册玩家使用道具回调 GatewaySocketPackFuncMap.rawset(2023110702, function(Jso) { @@ -200,26 +357,40 @@ class ServerControl { local CID = Jso.cid; local SUser = World.GetUserByUidCid(UID, CID); local ItemId = Jso.itemid; + local num = 0; if (SUser) { //获取背包对象 local InvenObj = SUser.GetInven(); local SlotIdx = InvenObj.GetSlotById(ItemId); - if (SlotIdx != -1) { - local SlotItem = InvenObj.GetSlot(1, SlotIdx); - if (SlotItem) { - local Count = 1; - if (SlotItem.GetType() != "装备") { - Count = SlotItem.GetAdd_Info(); - } - Jso.Count <- Count; - Jso.op = Jso.realop; - Socket.SendGateway(Jso); - return; + + local SlotItem = InvenObj.GetSlot(1, SlotIdx); + if (SlotItem != null && SlotItem.GetIndex() == ItemId) { + local Count = 1; + if (SlotItem.GetType() != "装备") { + Count = SlotItem.GetAdd_Info(); } + Jso.Count <- Count; + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + return; } + + print(num); + for (local i = 0; i< 120; i++) { + local ItemObj = InvenObj.GetSlot(3, i); + if (ItemObj != null && ItemObj.GetIndex() == ItemId) { + num++; + } + + ItemObj = InvenObj.GetSlot(2, i); + if (ItemObj != null && ItemObj.GetIndex() == ItemId) { + num++; + } + }; + print(num); } - Jso.Count <- 0; + Jso.Count <- num; Jso.op = Jso.realop; Socket.SendGateway(Jso); }); @@ -347,7 +518,7 @@ class ServerControl { local InvenObj = SUser.GetInven(); local FlagBuf = InvenObj.CheckArrItemCount([{ Id = Jso.itemid, - Count = Jso.itemcount + Count = Jso.itemcount, }]); if (!FlagBuf) Flag = false; Jso.Loser <- uid; @@ -360,6 +531,7 @@ class ServerControl { local SUser = World.GetUserByUid(uid); local InvenObj = SUser.GetInven(); InvenObj.DeleteItemCount(Jso.itemid, Jso.itemcount); + SUser.SendItemSpace(0); } Jso.DeleteFlag <- true; } else { @@ -369,6 +541,136 @@ class ServerControl { Socket.SendGateway(Jso); }); + + //给指定玩家扣除装备 并且会返回是否成功的 + GatewaySocketPackFuncMap.rawset(20250318, function(Jso) { + local UID = Jso.uid; + local SUser = World.GetUserByUid(UID); + if (SUser) { + local InvenObj = SUser.GetInven(); + local slot = InvenObj.GetSlotById(Jso.itemId); + + if (slot == -1) { + Jso.DeleteFlag <- false; + } else { + local itemobj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, slot); + itemobj.Delete(); + SUser.SendUpdateItemList(1, 0, slot); + Jso.DeleteFlag <- true; + + } + } else { + Jso.DeleteFlag <- false; + } + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + }); + + + //给一个玩家 批量扣除道具 + GatewaySocketPackFuncMap.rawset(20241122, function(Jso) { + local Flag = true; + + local SUser = World.GetUserByUid(Jso.uid); + local InvenObj = SUser.GetInven(); + + if (SUser) { + //获取背包对象 + local FlagBuf = InvenObj.CheckArrItemCountRindro(Jso.ItemS); + if (!FlagBuf) Flag = false; + } else { + Flag = false; + } + if (Flag) { + InvenObj.DeleteArrItemCountRindro(Jso.ItemS); + SUser.SendItemSpace(0); + } + + Jso.DeleteFlag <- Flag; + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + }); + + + //给一个玩家 设置角色栏上限 + GatewaySocketPackFuncMap.rawset(20250227, function(Jso) { + local Flag = true; + + local SUser = World.GetUserByUid(Jso.uid); + if (SUser == null) { + SUser = WebAddressUser; + } + Sq_CallFunc(S_Ptr("0x0869755C"), "int", ["pointer", "int"], SUser.C_Object, Jso.num); + + }); + + + + //给一个玩家 设置当天交易额 + GatewaySocketPackFuncMap.rawset(20250228, function(Jso) { + local SUser = World.GetUserByUid(Jso.uid); + + + SUser.SetTradeGoldDaily(Jso.num); + print(SUser.GetTradeGoldDaily()); + }); + + //设置全服交易上限 + GatewaySocketPackFuncMap.rawset(20250229, function(Jso) { + GameManager.FixGlodTradeDaily(Jso.num); + }); + + + + //给一个玩家 批量扣除道具 并且如果第一个道具是装备 就返回装备的强化信息 + GatewaySocketPackFuncMap.rawset(20241210, function(Jso) { + local Flag = true; + + local SUser = World.GetUserByUid(Jso.uid); + local InvenObj = SUser.GetInven(); + + local ItemObj1 = InvenObj.GetSlot(1, Jso.pos); + + if (SUser) { + //获取背包对象 + local FlagBuf = InvenObj.CheckArrItemCountRindro(Jso.ItemS); + if (!FlagBuf) Flag = false; + } else { + Flag = false; + } + if (Flag) { + if (!ItemObj1.IsEmpty && ItemObj1.GetType() == "装备") { + local forging = ItemObj1.GetForging(); //锻造 + local upgrade = ItemObj1.GetUpgrade(); //强化 + local amplification = ItemObj1.GetAmplification(); //增幅 + local enchanting = ItemObj1.GetEnchanting(); //附魔 + Jso.up <- [forging, upgrade, amplification, enchanting]; + } + InvenObj.DeleteArrItemCountRindro(Jso.ItemS); + SUser.SendItemSpace(0); + } + Jso.DeleteFlag <- Flag; + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + }); + + //给指定玩家下发道具 并且如果道具是装备 就给加上强化信息 + GatewaySocketPackFuncMap.rawset(20241212, function(Jso) { + local UID = Jso.uid; + local CID = Jso.cid; + local SUser = World.GetUserByUidCid(UID, CID); + local item = SUser.GiveItem(Jso.itemId, Jso.count); + //最后获得的道具 + local reitem = InvenObj.GetSlot(1, item[1]); + if (reitem.GetType() == "装备") { + reitem.SetForging(Jso.up[0]); + reitem.SetUpgrade(Jso.up[1]); + reitem.SetAmplification(Jso.up[2]); + reitem.SetEnchanting(Jso.up[3]); + reitem.Flush(); + } + }); + //公告包 GatewaySocketPackFuncMap.rawset(2023082102, function(Jso) { World.SendNotiPacketMessage(Jso.str, Jso.type); @@ -379,10 +681,28 @@ class ServerControl { local CID = Jso.cid; local SUser = World.GetUserByUidCid(UID, CID); if (SUser) { - SUser.SendNotiPacketMessage(Jso.str, Jso.type); + if (Jso.type == -1) { + SUser.SendNotiBox(Jso.str, 1); + } else { + SUser.SendNotiPacketMessage(Jso.str, Jso.type); + } } }); + //获取玩家位置信息 + GatewaySocketPackFuncMap.rawset(20241126, function(Jso) { + local SUser = World.GetUserByUid(Jso.uid); + local Info = SUser.GetLocation(); + local list = []; + list.append(Info.Town); + list.append(Info.Area); + list.append(Info.Pos.X); + list.append(Info.Pos.Y); + Jso.Location <- list; + Jso.op = Jso.realop; + Socket.SendGateway(Jso); + }); + //玩家进入副本 Cb_History_DungeonEnter_Func["RindroGoDgn"] <- function(SUser, Data) { local PartyObj = SUser.GetParty(); @@ -416,10 +736,14 @@ class ServerControl { } } + + //给注册玩家通关副本 GatewaySocketPackFuncMap.rawset(2023110704, function(Jso) { local RealOp = Jso.realop; + print("注册副本了"); Cb_ClearDungeon_Enter_Func[RealOp] <- function(arg) { + print("通关副本了"); local PartyObj = Party(arg[0]); if (PartyObj) { local Bfobj = PartyObj.GetBattleField(); @@ -477,6 +801,7 @@ class ServerControl { Socket.SendGateway(T); } + //返回选择角色 Cb_return_select_character_Func["Rindro_return_select_character"] <- function(SUser) { local T = { @@ -546,7 +871,8 @@ class ServerControl { return true; } - Cb_History_PCoinDown_Func["Rindro_PCoinDown"] <- function(SUser, Data) { + Cb_UseCoin_Enter_Func["Rindro_PCoinDown"] <- function(args) { + local SUser = User(args[1]); if (SUser) { local T = { op = 25001035, @@ -557,7 +883,6 @@ class ServerControl { } } - //组队HOOK包 同意加入或者同意申请 Cb_User_Party_Agree_Func["Rindro_player_User_Party_Agree"] <- function(SUser) { local T = { @@ -715,13 +1040,31 @@ class ServerControl { uid = SUser.GetUID(), cid = SUser.GetCID(), queId = args[1], - op = 20069009 + op = 25001041 } Socket.SendGateway(Jso); }; + + // 登录游戏时点击开始游戏的回调 + Cb_User_Set_WebAddress_Leave_Func.ServerControl <- function(args) { + local SUser = User(args[0]); + + local Jso = { + uid = SUser.GetUID(), + cid = SUser.GetCID(), + op = 25001043 + } + Socket.SendGateway(Jso); + WebAddressUser = SUser; + } + + } } +//刚登录游戏没办法从世界里找到这个角色 在这暂存下 +WebAddressUser <- null; + ProjectInitFuncMap.P_ServerControl <- ServerControl(); \ No newline at end of file diff --git a/Dps_A/ProjectClass/Anton/AntonClass.nut b/Dps_A/ProjectClass/Anton/AntonClass.nut index 73f57c7..7096dfb 100644 --- a/Dps_A/ProjectClass/Anton/AntonClass.nut +++ b/Dps_A/ProjectClass/Anton/AntonClass.nut @@ -49,6 +49,7 @@ class Anton { function base_input_hook(CUser, CmdString) { if (!CUser) return true; local SUser = User(CUser); + //安图恩频道 if (Sq_Game_GetConfig().find("18") != null) { local Localtion = SUser.GetLocation(); @@ -69,6 +70,28 @@ class Anton { } } + + function base_input_hook2(args) { + local type = args[2]; + local SUser = User(args[1]); + local msg = args[3]; + if ((type == 8 || type == 3) && Sq_Game_GetConfig().find("18") != null) { + local Localtion = SUser.GetLocation(); + if (Localtion.Area <= 1) { + return true; + } else { + local Jso = { + op = 20064027, + uid = SUser.GetUID(), + cid = SUser.GetCID(), + msg = msg + } + Socket.SendGateway(Jso); + } + } + return; + } + //玩家消息分发 function PlayerNotiMsgDistribute(Jso) { local SUser = World.GetUserByUidCid(Jso.uid, Jso.cid); @@ -82,7 +105,7 @@ class Anton { local SUserName = SUser.GetCharacName(); local Type = Jso.type; - Jso.msg = Jso.msg.slice(0, Jso.msg.len() - 11); + Jso.msg = Jso.msg; if (Type == -1) { Jso.Name <- SUserName; foreach(_Index, Value in RealList) { @@ -211,8 +234,10 @@ class Anton { //注册HOOK Cb_Insert_User_Func.Anton <- insert_user_hook.bindenv(this); //区域添加角色 Cb_Move_Area_Func.Anton <- move_area_hook.bindenv(this); //区域移动 - Base_InputHookFunc_Handle.Anton <- base_input_hook.bindenv(this); //玩家发送消息 + //Base_InputHookFunc_Handle.Anton <- base_input_hook.bindenv(this); //玩家发送消息 Cb_reach_game_world_Func.Anton <- Login_Hook.bindenv(this); //上线HOOK + Cb_Server_Chat_Log_Leave_Func.Anton <- base_input_hook2.bindenv(this); //玩家发送消息 + //注册收包 GatewaySocketPackFuncMap.rawset(20064010, AntonSendAreaUserCallBack.bindenv(this)); //玩家移动后的区域广播包 diff --git a/Dps_A/ProjectClass/CombatRank/CombatRank.nut b/Dps_A/ProjectClass/CombatRank/CombatRank.nut index 31a67b6..0fdbff5 100644 --- a/Dps_A/ProjectClass/CombatRank/CombatRank.nut +++ b/Dps_A/ProjectClass/CombatRank/CombatRank.nut @@ -8,6 +8,7 @@ class CombatRank { //角色更换了装备事件包 PacketId_0 = 20072102; + PacketId_1 = 20072602; constructor() { @@ -24,6 +25,12 @@ class CombatRank { } SUser.SendJso(T); }.bindenv(this); + Cb_player_chanage_equ_Func.CombatRankBFunc <- function(SUser) { + local T = { + op = PacketId_1 + } + SUser.SendJso(T); + }.bindenv(this); } diff --git a/Dps_A/ProjectClass/EquimentUseJewel/EquimentUseJewel.nut b/Dps_A/ProjectClass/EquimentUseJewel/EquimentUseJewel.nut index 20ea883..873b9d7 100644 --- a/Dps_A/ProjectClass/EquimentUseJewel/EquimentUseJewel.nut +++ b/Dps_A/ProjectClass/EquimentUseJewel/EquimentUseJewel.nut @@ -54,7 +54,6 @@ class EquimentUseJewel { //从池子拿连接 local SqlObj = MysqlPool.GetInstance().GetConnect(); local Ret = SqlObj.Select(CheckSql, ["int"]); - printT(Ret); //把连接还池子 MysqlPool.GetInstance().PutConnect(SqlObj); //没结婚要返回false @@ -184,7 +183,6 @@ class EquimentUseJewel { function GetByte(value) { local Blob = blob(); Blob.writen(value, 'w'); - print(Blob.len()); return Blob; } @@ -226,262 +224,358 @@ class EquimentUseJewel { HackReturnAddSocketToAvatarFalg = null; + function HackReturnAddSocketToAvatar(Code) { - //通过hook get short直接返回0达到错误返回的效果 //标记flag HackReturnAddSocketToAvatarFalg = Code; - Haker.LoadHook("0x0858D0B0", ["pointer", "pointer", "int"], - function(args) { - return null; - }, - function(args) { - Haker.UnLoadHook("0x0858D0B0"); - return 0; - }); + + Cb_PacketBuf_get_short_Leave_Func.EquimentUseJewel <- function(args) { + Cb_PacketBuf_get_short_Leave_Func.rawdelete("EquimentUseJewel"); + return 0; + }.bindenv(this); } function FixFunction() { //称号回包 - Haker.LoadHook("0x08641A6A", ["pointer", "pointer", "int", "pointer", "int"], - function(args) { - return null; - }.bindenv(this), - - 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_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); //设计图继承 - Haker.LoadHook("0x08671EB2", ["pointer", "pointer", "pointer", "int"], - function(args) { - local jewelSocketID = NativePointer(args[2]).add(25).readU32(); - NativePointer(args[1]).add(25).writeU32(jewelSocketID); - return null; - }.bindenv(this), - - function(args) { - 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); //装备开孔 - Haker.LoadHook("0x0821A412", ["pointer", "pointer", "pointer", "int"], - function(args) { + 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) { + + local Pack = Packet(args[2]); + local equ_slot = Pack.GetShort(); + print(equ_slot); + //跳的错误返回0 正常调用的话不处理返回值 + if (HackReturnAddSocketToAvatarFalg != null) { 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); + // SUser.SendItemSpace(0); + CUser_SendCmdErrorPacket(SUser, 209, HackReturnAddSocketToAvatarFalg); + HackReturnAddSocketToAvatarFalg = null; + return 0; + } + return null; + }.bindenv(this); - 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; - } + //装备镶嵌和时装镶嵌 + 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 item = PvfItem.GetPvfItemById(equitem_id); - local ItemType = Sq_CallFunc(S_Ptr("0x08514D26"), "int", ["pointer"], item.C_Object); + local avartar_inven_slot = Pack.GetShort(); + local avartar_item_id = Pack.GetInt(); + local emblem_cnt = Pack.GetByte(); - 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); + //下面是参照原时装镶嵌的思路写的。个别点标记出来。 + 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); - CUser_SendUpdateItemList_DB(SUser, equ_slot, JewelSocketData); //用于更新镶嵌后的装备显示,这里用的是带镶嵌数据的更新背包函数,并非CUser_SendUpdateItemList + 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(equ_slot + 104); - Pack.Put_Short(sta_slot); + Pack.Put_Short(equipment_inven_slot + 104); Pack.Finalize(true); SUser.Send(Pack); Pack.Delete(); - HackReturnAddSocketToAvatar(0x0); - return null; - }.bindenv(this), - function(args) { - //跳的错误返回0 正常调用的话不处理返回值 - if (HackReturnAddSocketToAvatarFalg != null) { - local SUser = User(args[1]); - // SUser.SendItemSpace(0); - CUser_SendCmdErrorPacket(SUser, 209, HackReturnAddSocketToAvatarFalg); - HackReturnAddSocketToAvatarFalg = null; - return 0; - } + return; + } - return null; - }.bindenv(this)); + AvatarLogic(args, PackIndex); - //装备镶嵌和时装镶嵌 - Haker.LoadHook("0x8217BD6", ["int", "pointer", "pointer", "int"], - function(args) { - local SUser = User(args[1]); - local Pack = Packet(args[2]); - local State = SUser.GetState(); - if (State != 3) return null; + return null; + }.bindenv(this); - 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 null; - }.bindenv(this), - - function(args) { - return 0; - }.bindenv(this)); + Cb_Dispatcher_UseJewel_Leave_Func.EquimentUseJewel <- function(args) { + return -1; + }.bindenv(this); //额外数据包,发送装备镶嵌数据给本地处理 - Haker.LoadHook("0x0815098e", ["pointer", "pointer", "int"], - function(args) { - return null; - }.bindenv(this), - - 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); - } + 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)); + } + return null; + }.bindenv(this); - //装备全字节复制 - Haker.LoadHook("0x0814A62E", ["pointer", "pointer", "pointer"], - function(args) { - return null; - }.bindenv(this), + L_HookEquimentUseJewel(); + } - function(args) { - local Old = NativePointer(args[1]); - local New = NativePointer(args[0]); - Memory.copy(New, Old, 61); - return args[0]; - }.bindenv(this)); - //装备全字节删除 - Haker.LoadHook("0x080CB7D8", ["pointer", "int"], - function(args) { - return null; - }.bindenv(this), - function(args) { - local New = NativePointer(args[0]); - Memory.reset(New, 61); - return null; - }.bindenv(this)); + + 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() { @@ -489,8 +583,4 @@ class EquimentUseJewel { FixFunction(); } -} - - - -getroottable().RRR <- EquimentUseJewel(); \ No newline at end of file +} \ No newline at end of file diff --git a/Dps_A/ProjectClass/Fiendwar/FiendwarClass.nut b/Dps_A/ProjectClass/Fiendwar/FiendwarClass.nut index 02159a8..84a8fd6 100644 --- a/Dps_A/ProjectClass/Fiendwar/FiendwarClass.nut +++ b/Dps_A/ProjectClass/Fiendwar/FiendwarClass.nut @@ -72,6 +72,27 @@ class Fiendwar { } } + function base_input_hook2(args) { + local type = args[2]; + local SUser = User(args[1]); + local msg = args[3]; + if ((type == 8 || type == 3) && Sq_Game_GetConfig().find("20") != null) { + local Localtion = SUser.GetLocation(); + if (Localtion.Area <= 1) { + return true; + } else { + local Jso = { + op = 20063027, + uid = SUser.GetUID(), + cid = SUser.GetCID(), + msg = msg + } + Socket.SendGateway(Jso); + } + } + return; + } + //玩家消息分发 function PlayerNotiMsgDistribute(Jso) { local SUser = World.GetUserByUidCid(Jso.uid, Jso.cid); @@ -85,21 +106,22 @@ class Fiendwar { local SUserName = SUser.GetCharacName(); local Type = Jso.type; + Jso.msg = Jso.msg; if (Type == -1) { Jso.Name <- SUserName; foreach(_Index, Value in RealList) { local SendObj = Value; SendObj.SendJso(Jso); } - } else { - local NotiStr = "(" + Type + ") " + "" + SUserName + " : " + Jso.msg; - foreach(_Index, Value in RealList) { - local SendObj = Value; - SendObj.SendNotiPacketMessage(NotiStr, 8); - } + Type = "长" + } + local NotiStr = "(攻坚队" + Type + ") " + "" + SUserName + " : " + Jso.msg; + foreach(_Index, Value in RealList) { + local SendObj = Value; + SendObj.SendNotiPacketMessage(NotiStr, 8); } - } + } function FiendwarSendAreaUserCallBack(Jso) { local CUserList = Jso.list; diff --git a/Dps_A/ProjectClass/Luke/LukeClass.nut b/Dps_A/ProjectClass/Luke/LukeClass.nut index 98a49af..25f0b9a 100644 --- a/Dps_A/ProjectClass/Luke/LukeClass.nut +++ b/Dps_A/ProjectClass/Luke/LukeClass.nut @@ -49,6 +49,7 @@ class Luke { function base_input_hook(CUser, CmdString) { if (!CUser) return true; local SUser = User(CUser); + print(111); //卢克频道 if (Sq_Game_GetConfig().find("19") != null) { local Localtion = SUser.GetLocation(); @@ -69,6 +70,29 @@ class Luke { } } + function base_input_hook2(args) { + local type = args[2]; + local SUser = User(args[1]); + local msg = args[3]; + + if ((type == 8 || type == 3) && Sq_Game_GetConfig().find("19") != null) { + + local Localtion = SUser.GetLocation(); + if (Localtion.Area <= 1) { + return true; + } else { + local Jso = { + op = 20084027, + uid = SUser.GetUID(), + cid = SUser.GetCID(), + msg = msg + } + Socket.SendGateway(Jso); + } + } + return; + } + //玩家消息分发 function PlayerNotiMsgDistribute(Jso) { local SUser = World.GetUserByUidCid(Jso.uid, Jso.cid); @@ -82,7 +106,7 @@ class Luke { local SUserName = SUser.GetCharacName(); local Type = Jso.type; - Jso.msg = Jso.msg.slice(0, Jso.msg.len() - 11); + Jso.msg = Jso.msg; if (Type == -1) { Jso.Name <- SUserName; foreach(_Index, Value in RealList) { @@ -183,13 +207,15 @@ class Luke { //玩家上线 function Login_Hook(SUser) { - //玩家上线发信息包 - local evv = { - op = 20084502, - town_index = Town, - channel_index = Channel - } - SUser.SendJso(evv); + Timer.SetTimeOut(function(SUser) { + //玩家上线发信息包 + local evv = { + op = 20084502, + town_index = Town, + channel_index = Channel + } + SUser.SendJso(evv); + }.bindenv(this), 5, SUser); local T = { op = 20084063, @@ -211,8 +237,9 @@ class Luke { //注册HOOK Cb_Insert_User_Func.Luke <- insert_user_hook.bindenv(this); //区域添加角色 Cb_Move_Area_Func.Luke <- move_area_hook.bindenv(this); //区域移动 - Base_InputHookFunc_Handle.Luke <- base_input_hook.bindenv(this); //玩家发送消息 + //Base_InputHookFunc_Handle.Luke <- base_input_hook.bindenv(this); //玩家发送消息 Cb_reach_game_world_Func.Luke <- Login_Hook.bindenv(this); //上线HOOK + Cb_Server_Chat_Log_Leave_Func.Luke <- base_input_hook2.bindenv(this); //玩家发送消息 //注册收包 GatewaySocketPackFuncMap.rawset(20084010, LukeSendAreaUserCallBack.bindenv(this)); //玩家移动后的区域广播包 diff --git a/Dps_A/ProjectClass/MarrySystem/MarrySystem.nut b/Dps_A/ProjectClass/MarrySystem/MarrySystem.nut index 3cb97a2..db3f0bf 100644 --- a/Dps_A/ProjectClass/MarrySystem/MarrySystem.nut +++ b/Dps_A/ProjectClass/MarrySystem/MarrySystem.nut @@ -6,94 +6,7 @@ */ -class defaultJobItemId { - /** - * 头发 - */ - hat = 0; - - /** - * 帽子 - */ - hair = 0; - - /** - *脸 - */ - face = 0; - /** - * 披风 - */ - breast = 0; - /** - * 上衣 - */ - coat = 0; - - /** - * 下装 - */ - pants = 0; - - /** - * 腰部 - */ - waist = 0; - - /** - * 鞋子 - */ - shoes = 0; - - /** - * 皮肤 - */ - skin = 0; - - index = null; - - constructor(hat, hair, face, breast, coat, pants, waist, shoes, skin) { - index = []; - this.hat = hat; - this.hair = hair; - this.face = face; - this.breast = breast; - this.coat = coat; - this.pants = pants; - this.waist = waist; - this.shoes = shoes; - this.skin = skin; - - index.push(hat); - index.push(hair); - index.push(face); - index.push(breast); - index.push(coat); - index.push(pants); - index.push(waist); - index.push(shoes); - index.push(skin); - index.push(0); - index.push(0); - } -} -//默认时装 -if (!(getroottable().rawin("defaultJobItemIdMap"))) { - getroottable().defaultJobItemIdMap <- {}; - defaultJobItemIdMap.rawset(0, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200)); - defaultJobItemIdMap.rawset(1, defaultJobItemId(0, 43400, 0, 0, 44600, 45000, 0, 45800, 46200)); - defaultJobItemIdMap.rawset(2, defaultJobItemId(0, 47400, 0, 48426, 48600, 49000, 0, 49800, 50200)); - defaultJobItemIdMap.rawset(3, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200)); - defaultJobItemIdMap.rawset(4, defaultJobItemId(0, 55400, 55820, 0, 56600, 57000, 0, 57800, 58200)); - - defaultJobItemIdMap.rawset(5, defaultJobItemId(1600000, 1610000, 0, 0, 1640000, 1650000, 0, 1670000, 1680000)); - defaultJobItemIdMap.rawset(6, defaultJobItemId(1720000, 1730000, 0, 1750000, 1760000, 1770000, 0, 1790000, 1800000)); - defaultJobItemIdMap.rawset(7, defaultJobItemId(0, 29201, 0, 0, 29202, 29203, 0, 29204, 29205)); - defaultJobItemIdMap.rawset(8, defaultJobItemId(0, 2090000, 0, 0, 2120000, 2130000, 0, 2140000, 2150000)); - defaultJobItemIdMap.rawset(9, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200)); - defaultJobItemIdMap.rawset(10, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200)); -} class Marry { @@ -307,44 +220,26 @@ class Marry { MysqlPool.GetInstance().PutConnect(SqlObj); } - } - - - - //获取角色身上的显示时装 - function GetAva(SUser) { - //获取背包对象 - local InvenObj = SUser.GetInven(); - if (!InvenObj) return; - local re = []; - local job = SUser.GetCharacJob(); - - //遍历身上的每一件装备 - for (local u = 0; u <= 2; u++) { - local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u); - if (EquObj && !EquObj.IsEmpty) { - //先拿克隆id 如果这个值有 那说明带的克隆这个是被克隆的装备 直接用这个 但是如果这个人什么都没带 只带了克隆 会显示克隆的id 所以还得判断这个id是不是克隆时装 - local clearId = Sq_CallFunc(S_Ptr("0x850d374"), "int", ["pointer", "int"], InvenObj.C_Object, u) - - - local EquObjId = EquObj.GetIndex(); - //如果这个是克隆 - if (clearId > 0) { - re.push(clearId); - } else { //不是克隆 直接把id放上去 - re.push(EquObjId); - } - } else { //如果这个部位没东西 直接放默认时装上去 - re.push(defaultJobItemIdMap[job].index[u]); + //根据cid查询自己的uid + GetUidByCid = function(cid) { + local Sql = format(MARRY_SQL_LIST.GetUidByCid, cid); + //从池子拿连接 + local SqlObj = MysqlPool.GetInstance().GetConnect(); + local Ret = SqlObj.Select(Sql, ["int"]); + //把连接还池子 + MysqlPool.GetInstance().PutConnect(SqlObj); + if (Ret.len()< 1 || Ret[0][0] == null) { + return null; + } else { + return Ret[0][0]; } } - - return re; } + //查看是否结婚包 function CheckMarryStateCallBack(SUser, Jso) { local T = { @@ -530,7 +425,10 @@ class Marry { infore.rawset("name", SUser.GetCharacName()); infore.rawset("uid", SUser.GetUID()); - local Muser = World.GetUserByUid(Target_CId); + //根据cid去查uid + local Target_Uid = Mysql_Operate_Func.GetUidByCid(Target_CId); + + local Muser = World.GetUserByUid(Target_Uid); local infore2 = {}; infore2.rawset("job", Muser.GetCharacJob()); infore2.rawset("growjob", Muser.GetCharacGrowType()); @@ -613,7 +511,7 @@ class Marry { local infore = { job = user.GetCharacJob(), growjob = user.GetCharacGrowType(), - avatar = GetAva(user), + avatar = user.GetAva(), name = user.GetCharacName(), }; info.push(infore); @@ -686,7 +584,7 @@ class Marry { local infore = {}; infore.rawset("job", SUser.GetCharacJob()); infore.rawset("growjob", SUser.GetCharacGrowType()); - infore.rawset("avatar", GetAva(SUser)); + infore.rawset("avatar", SUser.GetAva()); infore.rawset("name", SUser.GetCharacName()); @@ -720,7 +618,6 @@ class Marry { if (SUser.GetLocation().Area == Config["礼堂区域编号"]) Sq_WriteAddress(C_Area, 0x68, 1); } } - } @@ -850,22 +747,23 @@ class Marry { Channel = ConfigPath.slice(-6).slice(0, 2); //注册来自客户端的收包 - ClientSocketPackFuncMap.rawset(OP + 9, CheckMarryStateCallBack.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 3, RequestMarry.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 5, ResponseMarry.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 7, CancelMarry.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 11, OpenPreparationWindow.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 13, ConfirmMarry.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 15, EnterAuditorium.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 17, LeaveAuditorium.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 19, GetAuditoriumList.bindenv(this)); - ClientSocketPackFuncMap.rawset(OP + 777, GetConfig.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 9, CheckMarryStateCallBack.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 3, RequestMarry.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 5, ResponseMarry.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 7, CancelMarry.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 11, OpenPreparationWindow.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 13, ConfirmMarry.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 15, EnterAuditorium.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 17, LeaveAuditorium.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 19, GetAuditoriumList.bindenv(this)); + // ClientSocketPackFuncMap.rawset(OP + 777, GetConfig.bindenv(this)); //注册结婚回调函数 Cb_Insert_User_Func.Marry <- Marry_insert_user_hook.bindenv(this); //区域添加角色 - //玩家重新上线的时候自动给他退出礼堂 + // //玩家重新上线的时候自动给他退出礼堂 Cb_reach_game_world_Func.Auditorium <- function(SUser) { - if (EnterAuditoriumPosList.rawin(SUser.GetUID())) { + + if (EnterAuditoriumPosList && EnterAuditoriumPosList.rawin(SUser.GetUID())) { local Info = EnterAuditoriumPosList[SUser.GetCID()]; //给这个礼堂的人发送退出可见列表的包 foreach(cid in AuditoriumUserInfo[Info["所在礼堂编号"]]) { @@ -878,6 +776,7 @@ class Marry { }.bindenv(this); + //从池子拿连接 local SqlObj = MysqlPool.GetInstance().GetConnect(); local query = "SELECT COUNT(*) AS table_exists FROM information_schema.tables WHERE table_schema = 'zyk' AND table_name = 'marry';" @@ -892,29 +791,34 @@ class Marry { //把连接还池子 MysqlPool.GetInstance().PutConnect(SqlObj); + + Cb_Use_Item_Sp_Func[Config["结婚等级1道具ID"]] <- function(SUser, ItemId) { + ExpUp(SUser, Config["道具1给的心意点"]); + }.bindenv(this); + Cb_Use_Item_Sp_Func[Config["结婚等级2道具ID"]] <- function(SUser, ItemId) { + ExpUp(SUser, Config["道具2给的心意点"]); + }.bindenv(this); + Cb_Use_Item_Sp_Func[Config["结婚等级3道具ID"]] <- function(SUser, ItemId) { + ExpUp(SUser, Config["道具3给的心意点"]); + }.bindenv(this); + } + function ExpUp(SUser, expUp) { + exp = Mysql_Operate_Func.GetExpById(SUser.GetCID()) + if (!exp) { + return; + } + exp = exp + expUp; + for (local i = 6; i >= 0; i--) { + //如果当前的经验值大于所遍历到的等级 就设定等级为这个 然后不继续向更低等级遍历 + if (Config["戒指等级"][i.tostring()]["所需经验"]< exp) { + Mysql_Operate_Func.SetExpAndLvById(SUser.GetCID(), i, exp) + } + } + } + + } - - -// Cb_Use_Item_Sp_Func[Config["结婚等级1道具ID"]] <- function(SUser, ItemId) { -// ExpUp(SUser, Config["道具1给的心意点"]); -// } -// Cb_Use_Item_Sp_Func[Config["结婚等级2道具ID"]] <- function(SUser, ItemId) { -// ExpUp(SUser, Config["道具2给的心意点"]); -// } -// Cb_Use_Item_Sp_Func[Config["结婚等级3道具ID"]] <- function(SUser, ItemId) { -// ExpUp(SUser, Config["道具3给的心意点"]); -// } - - -// function ExpUp(SUser, expUp) { -// exp = Mysql_Operate_Func.GetExpById(SUser.GetCID()) -// exp = exp + expUp; -// for (local i = 6; i >= 0; i--) { -// //如果当前的经验值大于所遍历到的等级 就设定等级为这个 然后不继续向更低等级遍历 -// if (Config["戒指等级"][i.tostring()]["所需经验"]< exp) { -// Mysql_Operate_Func.SetExpAndLvById(SUser.GetCID(), i, exp) -// } -// } -// } \ No newline at end of file +//初始化结婚 +// ProjectInitFuncMap.P_Marry <- Marry(); \ No newline at end of file diff --git a/Dps_A/ProjectClass/MarrySystem/Marry_sql.nut b/Dps_A/ProjectClass/MarrySystem/Marry_sql.nut index 1efcdf7..0febb65 100644 --- a/Dps_A/ProjectClass/MarrySystem/Marry_sql.nut +++ b/Dps_A/ProjectClass/MarrySystem/Marry_sql.nut @@ -46,4 +46,7 @@ MARRY_SQL_LIST.RomoveRoom <- @"DELETE FROM marry_room where rindex < UNIX_TIMEST MARRY_SQL_LIST.GetExpById <- @"SELECT experience FROM zyk.marry WHERE cid = %d"; //设置自己的经验值和等级 -MARRY_SQL_LIST.SetExpAndLvById <- @"UPDATE zyk.marry SET level = %d , experience = %d WHERE cid = %d or target_cid = %d"; \ No newline at end of file +MARRY_SQL_LIST.SetExpAndLvById <- @"UPDATE zyk.marry SET level = %d , experience = %d WHERE cid = %d or target_cid = %d"; + +//根据cid获取uid +MARRY_SQL_LIST.GetUidByCid <- @"SELECT m_id FROM taiwan_caincharac_info WHERE charac_no = %d"; \ No newline at end of file diff --git a/Dps_C/New_Hook.nut b/Dps_A/ProjectClass/New_Hook.nut similarity index 77% rename from Dps_C/New_Hook.nut rename to Dps_A/ProjectClass/New_Hook.nut index ba7e146..163b0f9 100644 --- a/Dps_C/New_Hook.nut +++ b/Dps_A/ProjectClass/New_Hook.nut @@ -341,9 +341,107 @@ Cb_CVillageMonsterMgr_OnKillVillageMonster_Enter_Func <- {}; Cb_CVillageMonsterMgr_OnKillVillageMonster_Leave_Func <- {}; _Hook_Register_Currency_Func_("0x086B4866", ["pointer", "pointer", "bool", "int"], Cb_CVillageMonsterMgr_OnKillVillageMonster_Enter_Func, Cb_CVillageMonsterMgr_OnKillVillageMonster_Leave_Func); - +//玩家使用复活币 +Cb_UseCoin_Enter_Func <- {}; +Cb_UseCoin_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x81CA852", ["pointer", "pointer", "pointer", "pointer", "int"], Cb_UseCoin_Enter_Func, Cb_UseCoin_Leave_Func); //玩家完成任务 Cb_fnStatQuestClear_Enter_Func <- {}; Cb_fnStatQuestClear_Leave_Func <- {}; -_Hook_Register_Currency_Func_("0x8664412", ["pointer", "int", "int"], Cb_fnStatQuestClear_Enter_Func, Cb_fnStatQuestClear_Leave_Func); \ No newline at end of file +_Hook_Register_Currency_Func_("0x8664412", ["pointer", "int", "int"], Cb_fnStatQuestClear_Enter_Func, Cb_fnStatQuestClear_Leave_Func); + +//深渊派对开始时 +Cb_HellPartyStart_dispatch_Enter_Func <- {}; +Cb_HellPartyStart_dispatch_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x821D9A6", ["pointer", "pointer", "int"], Cb_HellPartyStart_dispatch_Enter_Func, Cb_HellPartyStart_dispatch_Leave_Func); + +//获取道具日志 +Cb_UserHistoryLog_ItemAdd_Enter_Func <- {}; +Cb_UserHistoryLog_ItemAdd_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x8682E84", ["pointer", "int", "int", "int", "pointer", "int", "void"], Cb_UserHistoryLog_ItemAdd_Enter_Func, Cb_UserHistoryLog_ItemAdd_Leave_Func); + +//获取绝望之塔进入次数 +Cb_TOD_UserState_getEnterCount_Enter_Func <- {}; +Cb_TOD_UserState_getEnterCount_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x8643872", ["pointer", "int"], Cb_TOD_UserState_getEnterCount_Enter_Func, Cb_TOD_UserState_getEnterCount_Leave_Func); + + +//掉落道具 +Cb_GetItemRarity_Enter_Func <- {}; +Cb_GetItemRarity_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x8550BE4", ["pointer", "pointer", "int", "int", "int", ], Cb_GetItemRarity_Enter_Func, Cb_GetItemRarity_Leave_Func); + +//怪物死亡爆奖励的时候 +Cb_dispatch_sig_Enter_Func <- {}; +Cb_dispatch_sig_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x81EB0C4", ["pointer", "pointer", "pointer", "int"], Cb_dispatch_sig_Enter_Func, Cb_dispatch_sig_Leave_Func); + +//装备解锁动作 +Cb_CItemLock_DoItemUnlock_Enter_Func <- {}; +Cb_CItemLock_DoItemUnlock_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x854231A", ["pointer", "pointer", "int", "int", "int"], Cb_CItemLock_DoItemUnlock_Enter_Func, Cb_CItemLock_DoItemUnlock_Leave_Func); + +//丢弃物品检查错误 +Cb_DropItem_check_error_Enter_Func <- {}; +Cb_DropItem_check_error_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x81C2D9A", ["pointer", "pointer", "pointer", "pointer", "int"], Cb_DropItem_check_error_Enter_Func, Cb_DropItem_check_error_Leave_Func); + +//城镇瞬移 +Cb_GameWorld_move_area_Enter_Func <- {}; +Cb_GameWorld_move_area_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x086C5A84", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int"], Cb_GameWorld_move_area_Enter_Func, Cb_GameWorld_move_area_Leave_Func); + + +//称号回包 +Cb_CTitleBook_putItemData_Enter_Func <- {}; +Cb_CTitleBook_putItemData_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x08641A6A", ["pointer", "pointer", "int", "pointer", "int"], Cb_CTitleBook_putItemData_Enter_Func, Cb_CTitleBook_putItemData_Leave_Func); + +//设计图继承 +Cb_CUsercopyItemOption_Enter_Func <- {}; +Cb_CUsercopyItemOption_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x08671EB2", ["pointer", "pointer", "pointer", "int"], Cb_CUsercopyItemOption_Enter_Func, Cb_CUsercopyItemOption_Leave_Func); + + +//装备开孔 +Cb_AddSocketToAvatar_Enter_Func <- {}; +Cb_AddSocketToAvatar_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0821A412", ["pointer", "pointer", "pointer", "int"], Cb_AddSocketToAvatar_Enter_Func, Cb_AddSocketToAvatar_Leave_Func); + +//装备镶嵌和时装镶嵌 +Cb_Dispatcher_UseJewel_Enter_Func <- {}; +Cb_Dispatcher_UseJewel_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x8217BD6", ["int", "pointer", "pointer", "int"], Cb_Dispatcher_UseJewel_Enter_Func, Cb_Dispatcher_UseJewel_Leave_Func); + +//额外数据包,发送装备镶嵌数据给本地处理 +Cb_InterfacePacketBuf_put_packet_Enter_Func <- {}; +Cb_InterfacePacketBuf_put_packet_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0815098e", ["pointer", "pointer", "int"], Cb_InterfacePacketBuf_put_packet_Enter_Func, Cb_InterfacePacketBuf_put_packet_Leave_Func); + + +//额外数据包,发送装备镶嵌数据给本地处理 +Cb_PacketBuf_get_short_Enter_Func <- {}; +Cb_PacketBuf_get_short_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0858D0B0", ["pointer", "pointer", "int"], Cb_PacketBuf_get_short_Enter_Func, Cb_PacketBuf_get_short_Leave_Func); + + +//公会普通信息回包 +Cb_MonitorNoticeGuildChatMsg_Enter_Func <- {}; +Cb_MonitorNoticeGuildChatMsg_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x084C9E30", ["pointer", "pointer", "pointer", "int"], Cb_MonitorNoticeGuildChatMsg_Enter_Func, Cb_MonitorNoticeGuildChatMsg_Leave_Func); + +//公会超链接信息回包 +Cb_MonitorNoticeGuildChatMsgHyperLink_Enter_Func <- {}; +Cb_MonitorNoticeGuildChatMsgHyperLink_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x084E503C", ["pointer", "pointer", "pointer", "int"], Cb_MonitorNoticeGuildChatMsgHyperLink_Enter_Func, Cb_MonitorNoticeGuildChatMsgHyperLink_Leave_Func); + +//检查移动技能槽位 +Cb_CheckMoveComboSkillSlot_Enter_Func <- {}; +Cb_CheckMoveComboSkillSlot_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x08608C98", ["pointer", "char", "char", "bool"], Cb_CheckMoveComboSkillSlot_Enter_Func, Cb_CheckMoveComboSkillSlot_Leave_Func); + +//检查插入快捷技能槽位 +Cb_CheckComboSkillInsertQuickSlot_Enter_Func <- {}; +Cb_CheckComboSkillInsertQuickSlot_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x08608D58", ["pointer", "int", "bool"], Cb_CheckComboSkillInsertQuickSlot_Enter_Func, Cb_CheckComboSkillInsertQuickSlot_Leave_Func); \ No newline at end of file diff --git a/Dps_A/enum.nut b/Dps_A/enum.nut index de4bd0c..28a20cf 100644 --- a/Dps_A/enum.nut +++ b/Dps_A/enum.nut @@ -31,4 +31,9 @@ enum RETTYPE { function printT(T) { Sq_OutPutTable(Json.Encode(T)); +} + +function LoadConfig(Path) +{ + dofile("/dp_s/" + Path); } \ No newline at end of file diff --git a/Dps_A/main.nut b/Dps_A/main.nut index 08e630d..d5909f9 100644 --- a/Dps_A/main.nut +++ b/Dps_A/main.nut @@ -10,7 +10,10 @@ function InitPluginInfo() { local ConfigPath = Sq_Game_GetConfig(); local Channel = ConfigPath.slice(ConfigPath.find("cfg/") + 4, ConfigPath.len()); // if (Channel.find("15")) GameManager.OpenHotFix("/dp_s/Dps_A"); - if (Channel.find("19")) GameManager.OpenHotFix("/dp_s/Dps_A"); + if (Channel.find("15")) { + GameManager.OpenHotFix("/dp_s/Dps_A"); + GameManager.OpenHotFix("/dp_s/MyProject"); + } local PoolObj = MysqlPool.GetInstance(); PoolObj.SetBaseConfiguration("127.0.0.1", 3306, "game", "uu5!^%jg"); @@ -19,8 +22,10 @@ function InitPluginInfo() { //初始化 PoolObj.Init(); + GameManager.FixEquipUseJewel(); + GameManager.Fix14Skill(); - Sq_CreatSocketConnect("192.168.200.24", "65109"); + Sq_CreatSocketConnect("192.168.200.20", "65109"); //初始化结婚 // ProjectInitFuncMap.P_Marry <- Marry(); @@ -35,6 +40,8 @@ function InitPluginInfo() { //Log.Put("normal", "测试日志"); //Log.Put("error", "测试错误日志"); + GameManager.OpenCreateJob_CreatorMage(); + } @@ -55,8 +62,6 @@ function main() { GameManager.FixDespairGold(); GameManager.FixGlodTradeDaily(80000000); - - getroottable().RRR <- EquimentUseJewel(); // local PvfObject = Script(); // local Data = ScriptData.GetEquipment(305014); // printT(Data); @@ -65,6 +70,26 @@ function main() { } +/* +function onil() { + print(11); + local T = { + op = 20065005, + uid = 0, + cid = 0 + } + local WorldMap = World.GetOnlinePlayer(); + foreach(W_User in WorldMap) { + T.uid = W_User.GetUniqueId(); + T.cid = W_User.GetCID(); + Socket.SendGateway(T); + } +} + +Timer.SetCronTask(onil, "0/10 * * * * *"); +*/ + + // getroottable().CombatRankServerProject <- CombatRank(); // getroottable().ServerControlProject <- ServerControl(); diff --git a/Main.nut b/Main.nut index b53bd79..89a13fa 100644 --- a/Main.nut +++ b/Main.nut @@ -3,17 +3,4 @@ function sqr_main() { print("服务端插件启动"); -} - - -//玩家完成任务 -Cb_fnStatQuestClear_Enter_Func <- {}; -Cb_fnStatQuestClear_Leave_Func <- {}; -_Hook_Register_Currency_Func_("0x8664412", ["pointer", "int", "int"], Cb_fnStatQuestClear_Enter_Func, Cb_fnStatQuestClear_Leave_Func); - - -Cb_fnStatQuestClear_Enter_Func.text <- function(args) { - local user = User(args[0]) - print(args[1]); - print(user.GetCharacName()); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/MyProject/一键入库.nut b/MyProject/一键入库.nut new file mode 100644 index 0000000..9a5e5d0 --- /dev/null +++ b/MyProject/一键入库.nut @@ -0,0 +1,178 @@ +/* +文件名:一键入库.nut +路径:MyProject/一键入库.nut +创建日期:2025-03-25 14:42 +文件用途:一键入库 +*/ +//获取金库 +function User::GetCharacCargo() { + return Sq_CallFunc(S_Ptr("0x008151A94"), "pointer", ["pointer"], this.C_Object); +} + +//检查金库是否有指定ID道具 +function CharacCargo_Check_Item_Exist(Cargo_C_Object, ItemId) { + return Sq_CallFunc(S_Ptr("0x0850BC14"), "int", ["pointer", "int"], Cargo_C_Object, ItemId); +} + +//检查物上限品堆叠 +function Check_Item_Stack(ItemId, ItemCount) { + return Sq_CallFunc(S_Ptr("0x08501A79"), "int", ["int", "int"], ItemId, ItemCount); +} + +//将物品存入仓库 +function CharacCargo_Insert_Item(Cargo_C_Object, Item_C_Object) { + return Sq_CallFunc(S_Ptr("0x0850B400"), "int", ["pointer", "pointer"], Cargo_C_Object, Item_C_Object); +} + +Gm_InputFunc_Handle.AAWW <- function(SUser, CmdString) { + //获取金库 + local Cargo_C_Object = SUser.GetCharacCargo(); + //获取背包 + local InvenObj = SUser.GetInven(); + + // 物品槽范围: 57-152 (材料、消耗品栏) + local INVENTORY_SLOT_START = 57; + local INVENTORY_SLOT_END = 152; + + local anyItemInserted = false; // 标志变量,用于跟踪是否有物品被成功插入 + + for (local slot = INVENTORY_SLOT_START; slot <= INVENTORY_SLOT_END; slot++) { + local ItemObject = InvenObj.GetSlot(1, slot); + local ItemId = ItemObject.GetIndex(); + local ItemName = PvfItem.GetNameById(ItemId); + + // 如果物品ID无效,跳过当前循环 + if (ItemId <= 0) continue; + local CheckFlag = CharacCargo_Check_Item_Exist(Cargo_C_Object, ItemId); + // 如果仓库中没有该物品,跳过 + if (CheckFlag == -1) continue; + + local Cargo_M_Object = NativePointer(Cargo_C_Object); + // 获取仓库中对应物品的指针和数量 + local CargoItemPointer = NativePointer(Cargo_M_Object.add(4).readPointer()).add(61 * CheckFlag).readPointer(); + local CargoItem = Item(CargoItemPointer); + local CargoItemId = NativePointer(Cargo_M_Object.add(4).readPointer()).add(61 * CheckFlag + 2).readU32(); + //仓库中的数量 + local CargoItemCount = CargoItem.GetAdd_Info() ? CargoItem.GetAdd_Info() : 1; + //背包中的数量 + local InventoryItemCount = ItemObject.GetAdd_Info(); + + //检查物品堆叠是否超过上限 + local CanStack = Check_Item_Stack(ItemId, InventoryItemCount + CargoItemCount); + if (CanStack == 0) { + SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "超过堆叠上限,无法放入", 8); + continue; + } + + // 将物品存入仓库 + local InsertResult = CharacCargo_Insert_Item(Cargo_C_Object, ItemObject.C_Object); + if (InsertResult >= 0) { + SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + InventoryItemCount, 8); + InvenObj.DeleteItemCount(ItemId, InventoryItemCount); + SUser.SendUpdateItemList(1, 0, slot); + } + } + + //更新仓库 + SUser.SendItemSpace(2); +}; + + + +function saveItemToInven(SUser) { + // 获取角色背包 + local InvenObj = SUser.GetInven(); + // 角色仓库 + local CargoObj = Sq_CallFunc(S_Ptr("0x08151a94"), "pointer", ["pointer"], SUser.C_Object); + // 添加计数器 + local transferCount = 0; + // 遍历背包消耗品栏及材料栏 + for (local i = 57; i <= 152; ++i) { + // 获取背包物品 + local ItemObj = InvenObj.GetSlot(1, i); + // 获取背包物品ID + local Item_Id = ItemObj.GetIndex(); + local ItemName = PvfItem.GetNameById(Item_Id); + // 如果物品ID为0或3037,跳过(在此可以添加其他需要跳过的物品ID) + if (Item_Id == 0 || Item_Id == 3037) { + continue; + } + + // 角色仓库是否存在背包物品 + local CargoSlot = Sq_CallFunc(S_Ptr("0x850bc14"), "int", ["pointer", "int"], CargoObj, Item_Id); + // 如果角色仓库中没有该物品,跳过 + if(CargoSlot == -1) { + continue; + } + + // 获取仓库物品指针 + local cargoItemPointer = NativePointer(CargoObj).add(4).readPointer(); + // 获取角色仓库物品对象 + local cargoItemObj = NativePointer(cargoItemPointer).add(61 * CargoSlot); + print(typeof cargoItemObj) + // 获取角色仓库物品ID + local cargoItemId = NativePointer(cargoItemPointer).add(61 * CargoSlot + 2).readU32(); + // 获取角色仓库物品数量 + local cargoItemCount = Sq_CallFunc(S_Ptr("0x80F783A"), "int", ["pointer"], cargoItemObj.C_Object); + + // 获取物品对象 + local PvfItem = PvfItem.GetPvfItemById(cargoItemId); + + // 获取物品可堆叠数量 + local getStackableLimit = Sq_CallFunc(S_Ptr("0x0822C9FC"), "int", ["pointer"], PvfItem.C_Object); + + // 如果仓库已达堆叠上限,跳过此物品 + if(cargoItemCount >= getStackableLimit) { + continue; + } + + // 获取背包物品数量 + local inventoryItemCount = Sq_CallFunc(S_Ptr("0x80F783A"), "int", ["pointer"], ItemObj.C_Object); + // 获取物品是否可堆叠 + local checkStackableLimit = Sq_CallFunc(S_Ptr("0x08501A79"), "int", ["int", "int"], cargoItemId, cargoItemCount + inventoryItemCount); + // 尝试将物品储存至角色仓库中 + local tryAddStackItem = Sq_CallFunc(S_Ptr("0x0850B4B0"), "int", ["pointer", "pointer", "int"], CargoObj, ItemObj.C_Object, CargoSlot); + if (tryAddStackItem >= 0) { + // 正式将物品插入角色仓库中 + Sq_CallFunc(S_Ptr("0x850b672"), "pointer", ["pointer", "pointer", "int"], CargoObj, ItemObj.C_Object, CargoSlot); + // 删除背包中的物品 + ItemObj.Delete(); + transferCount++; + SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + inventoryItemCount, 8); + } + + // 处理可堆叠物品 + if(checkStackableLimit == 0) { + // 获取物品总数 + local totalCount = cargoItemCount + inventoryItemCount; + + // 如果总数不超过上限,全部堆到仓库 + if(totalCount <= getStackableLimit) { + // 将物品堆到仓库 + Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], cargoItemObj.C_Object, totalCount); + // 删除背包中的物品 + ItemObj.Delete(); + transferCount++; + SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + inventoryItemCount, 8); + } else { + // 如果总数超过上限 + // 将仓库的物品数量设置为最大数量 + Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], cargoItemObj.C_Object, getStackableLimit); + // 将背包数量减去转移至仓库的数量 + local transferAmount = getStackableLimit - cargoItemCount; + Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], ItemObj.C_Object, totalCount - getStackableLimit); + transferCount++; + SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + transferAmount, 8); + } + } + + // 通知客户端更新背包 + SUser.SendUpdateItemList(1, 0, i); + } + + if (transferCount == 0) { + SUser.SendNotiBox("没有可转移的物品!", 1); + } + // 通知客户端更新仓库 + SUser.SendItemSpace(2); +} \ No newline at end of file diff --git a/MyProject/任务清理券大全.nut b/MyProject/任务清理券大全.nut deleted file mode 100644 index e69de29..0000000 diff --git a/a.txt b/a.txt deleted file mode 100644 index b15f8f9..0000000 --- a/a.txt +++ /dev/null @@ -1,3 +0,0 @@ -abcdef -1561561561563156156adaa -asndKasdakdn阿基德拿手机卡迪那啊睡你的觉卡死 \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json index cbef44e..94ee500 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -154,5 +154,8 @@ }, "Dps_A/ProjectClass/Luke": { "description": "卢克攻坚战" + }, + "Dps_A/BaseClass/BigInt": { + "description": "大数字类" } } \ No newline at end of file diff --git a/lib/libAurora.so b/lib/libAurora.so index eb9a66d..0a10008 100644 Binary files a/lib/libAurora.so and b/lib/libAurora.so differ diff --git a/lib/strip_other_funcs_unix.sh b/lib/strip_other_funcs_unix.sh new file mode 100755 index 0000000..759cda2 --- /dev/null +++ b/lib/strip_other_funcs_unix.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# save as strip_other_funcs.sh + +# 输入参数检查 +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +TARGET_BIN="$1" +BACKUP_BIN="${TARGET_BIN}.bak" + +# 定义要保留的函数列表 +TARGET_FUNCTIONS=( + "Lenheart()" + "_Inter_LoadGeolocation_dispatch_sig(void*, void*, char*)" + "SocketThread_function(void*)" + "PrintAuroraTag()" + "InitSquirrel()" + "ReloadingScript(SQVM*, std::string)" + "ReqSquirrelScript(SQVM*)" + "Cutecode(char*, int*, int)" +) + +# 创建备份 +cp "$TARGET_BIN" "$BACKUP_BIN" + +# 获取保留符号列表 +KEEP_SYMBOLS=() +while read -r symbol; do + demangled=$(c++filt "$symbol" 2>/dev/null) + for target in "${TARGET_FUNCTIONS[@]}"; do + if [[ "$demangled" == "$target" ]]; then + KEEP_SYMBOLS+=("$symbol") + break + fi + done +done < <(nm --defined-only "$BACKUP_BIN" | awk '/ [TtWw] /{print $3}') + +if [ ${#KEEP_SYMBOLS[@]} -eq 0 ]; then + echo "Error: No target symbols found!" + exit 2 +fi + +# 生成保留符号文件 +KEEP_FILE=$(mktemp) +printf "%s\n" "${KEEP_SYMBOLS[@]}" > "$KEEP_FILE" + +# 执行符号清理 +echo "Stripping symbols..." +objcopy --strip-all \ + --keep-symbols="$KEEP_FILE" \ + "$BACKUP_BIN" \ + "$TARGET_BIN" + +# 清理临时文件 +rm -f "$KEEP_FILE" + +echo "Done. Original backup at: $BACKUP_BIN" diff --git a/测试加密脚本.sut b/测试加密脚本.sut deleted file mode 100644 index c75194f..0000000 Binary files a/测试加密脚本.sut and /dev/null differ