diff --git a/MyProject/A.nut b/MyProject/A.nut index c189d9c..b7df019 100644 --- a/MyProject/A.nut +++ b/MyProject/A.nut @@ -23,36 +23,145 @@ Gm_InputFunc_Handle["给"] <- function(SUser, CmdString) { } +// Timer.SetTimeOut(function() { + +// Haker.LoadHook("0x0830ADF6", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int", "void"], +// function(args) { +// local SParty = Party(NativePointer(args[0]).readPointer()); +// local map_monster_param = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer(); +// local monster_uid = NativePointer(NativePointer(Haker.CpuContext.ebp).add(0x18).readPointer()).readU16(); + +// SParty.ForeachMember(function(SUser, Index) { +// local user_item_list = Memory.alloc(8); +// Sq_CallFunc(S_Ptr("0x08152A2C"), "pointer", ["pointer"], user_item_list.C_Object); + +// Sq_CallFunc(S_Ptr("0x0830ADF6"), "void", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int"], args[0], user_item_list.C_Object, args[2], args[3], Index + 1, 1, args[6], args[7], args[8], args[9], args[10], args[11]); + +// api_copy_mapinfo_items_between_lists(NativePointer(args[1]), user_item_list); + +// local Pack = Packet(); +// Sq_CallFunc(S_Ptr("0x0830B8CC"), "pointer", ["pointer", "pointer", "pointer", "int", "int", "pointer", "pointer"], args[0], Pack.C_Object, user_item_list.C_Object, monster_uid, Index + 1, args[3], map_monster_param); +// SUser.Send(Pack); +// Pack.Delete(); + +// Sq_CallFunc(S_Ptr("0x08151F6E"), "pointer", ["pointer"], user_item_list.C_Object); +// }); + +// //跳过原逻辑 +// Sq_WriteByteArr(S_Ptr("0x830ADFC"), Haker.AsmGenerateMcd( +// "pop ebx", +// "pop esi", +// "pop edi", +// "pop ebp", +// "ret")); +// return null; +// }, +// function(args) { +// //还原 +// Sq_WriteByteArr(S_Ptr("0x830ADFC"), [0x81, 0xec, 0x7c, 0x01, 0x00, 0x00, 0x8B, 0x55, 0x18]); +// return null; +// }); + +// //跳过原本的怪物死亡掉落包构造 +// Haker.LoadHook("0x0830B8CC", ["pointer", "pointer", "pointer", "int", "int", "pointer", "pointer", "pointer"], +// function(args) { +// if (Haker.NextReturnAddress == "0x830CE08") { +// print(12313); +// local v109 = NativePointer(NativePointer(Haker.CpuContext.ebp).sub(0x90).readPointer()); +// local v106 = NativePointer(Haker.CpuContext.ebp).sub(0x96) +// if (v109.add(44).readU32() == 100 && v106.readU8() != 1 && NativePointer(args[0]).add(109 * 4).readU32() != 1) { +// //跳过原逻辑 +// Sq_WriteByteArr(S_Ptr("0x830B8D3"), Haker.AsmGenerateMcd( +// "add esp , 64", +// "pop ebx", +// "pop ebp", +// "ret")); +// } +// } +// return null; +// }, +// function(args) { +// if (Haker.NextReturnAddress == "0x830CE08") { +// local v109 = NativePointer(NativePointer(Haker.CpuContext.ebp).sub(0x90).readPointer()); +// local v106 = NativePointer(Haker.CpuContext.ebp).sub(0x96) +// if (v109.add(44).readU32() == 100 && v106.readU8() != 1 && NativePointer(args[0]).add(109 * 4).readU32() != 1) { +// Sq_WriteByteArr(S_Ptr("0x830B8D3"), [0x8B, 0x45, 0x18, 0x66, 0x89, 0x45, 0xB4, 0x8B, 0x45, 0x0C]); +// return 1; +// } +// } +// return null; +// }); + +// //跳过原本的怪物死亡掉落包队伍发包 +// Haker.LoadHook("0x0859d14e", ["pointer", "pointer", "int"], +// function(args) { +// if (Haker.NextReturnAddress == "0x85a39db" && Sq_CallFunc(S_Ptr("0x0848F438"), "int", ["pointer"], args[1]) == 0) { +// //跳过原逻辑 +// Sq_WriteByteArr(S_Ptr("0x859D154"), Haker.AsmGenerateMcd( +// "add esp , 28", +// "pop ebp", +// "ret")); +// } +// return null; +// }, +// function(args) { +// if (Haker.NextReturnAddress == "0x85a39db" && Sq_CallFunc(S_Ptr("0x0848F438"), "int", ["pointer"], args[1]) == 0) { +// Sq_WriteByteArr(S_Ptr("0x859D154"), [0xC7, 0x45, 0xF4, 0x00, 0x00, 0x00, 0x00]); +// return 0; +// } +// return null; +// }); + +// //DisPatcher_GetItem::check_error 校验用户是否非法捡取物品 +// Haker.LoadHook("0x081C35AC", ["int"], +// function(args) { +// return null; +// }, +// function(args) { +// local user = NativePointer(Haker.CpuContext.ebp).add(0xc).readPointer(); +// local msg_base = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer(); +// local drop_id = NativePointer(msg_base).add(13).readU16(); +// local res = validate_pickup_permission(user, drop_id); +// return res; +// }); + +// //跳过物品掷点 +// Haker.LoadHook("0x0850D756", ["pointer", "bool"], +// function(args) { +// return null; +// }, +// function(args) { +// return false; +// }); + +// //取消队友分金币 +// Haker.LoadHook("0x0859A918", ["pointer", "int"], +// function(args) { +// return null; +// }, +// function(args) { +// return 1; +// }); -Timer.SetTimeOut(function() { +// //SS免确认 +// Sq_WriteByteArr(S_Ptr("0x085A56D0"), [9]); +// Haker.LoadHook("0x08150f18", ["pointer", "int"], +// function(args) { +// return null; +// }, +// function(args) { +// return 0; +// }); - Haker.LoadHook("0x0830ADF6", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int", "void"], - function(args) { - local SParty = Party(NativePointer(args[0]).readPointer()); - local map_monster_param = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer(); - local monster_uid = NativePointer(NativePointer(Haker.CpuContext.ebp).add(0x18).readPointer()).readU16(); - - Sq_WriteByteArr(S_Ptr("0x830ADFB"), Haker.AsmGenerateMcd( - "pop esi", - "pop edi", - "pop ebp", - "ret")); - return null; - }, - function(args) { - //还原 - Sq_WriteByteArr(S_Ptr("0x830ADFB"), [0x53, 0x81, 0xec, 0x7c, 0x01]); - return null; - }); -}, 1) +// Sq_WriteByteArr(S_Ptr("0x085A41D1"), [0xB8, 0x00, 0x00, 0x00, 0x00, 0x90]); +// }, 1) +Timer.SetTimeOut(function () +{ + // dofile("/dp_s/_DPS_/_BuiltProject/宿命魂石/FatalismStone.nut"); + // ProjectInitFuncMap.P_FatalismStone <- FatalismStone(); -Timer.SetTimeOut(function() { - local Config = sq_ReadJsonFile("/dp_s/OfficialConfig" + "/" + "门票进入副本配置_Maomi.json"); - // local Config = GlobalConfig.Get("门票进入副本配置_Maomi.json"); - print(Config); }, 1); - diff --git a/MyProject/史诗药剂.nut b/MyProject/史诗药剂.nut deleted file mode 100644 index 83fdee8..0000000 --- a/MyProject/史诗药剂.nut +++ /dev/null @@ -1,54 +0,0 @@ -/* -文件名:史诗药剂.nut -路径:MyProject/史诗药剂.nut -创建日期:2025-03-28 10:21 -文件用途:史诗药剂 -*/ - -//➢SS药剂的ID -EpicPotionID <- 2600006; -//➢默认的药剂增加倍率 -EpicPotionOdds <- 0.1; -//➢指定玩家增加深渊爆率 -EpicPotionlist <- {}; -//角色ID:增加个人深渊爆率 -EpicPotionlist[1] <- 1; - - -Cb_GetItemRarity_Enter_Func["史诗药剂_逻辑"] <- function(args) { - local Addr = NativePointer(args[0]); - local VectorSize = (Addr.add(4).readU32() - Addr.readU32()) / 4; - // 遍历队伍成员,找到使用了史诗药剂的玩家 - local userWithPotion = null; - for (local i = 0; i< VectorSize; i++) { - local elementAddr = NativePointer(Addr.readPointer()).add(i * 4); - local user = elementAddr.readPointer(); - if (user && Sq_CallFunc(S_Ptr("0x865E994"), "int", ["pointer", "int", ], user, EpicPotionID) ) { - userWithPotion = User(user); - break; - } - } - if (userWithPotion && Haker.NextReturnAddress == "0x853583a") { - local partyobj = userWithPotion.GetParty(); - // 检查是否单人 - if (Sq_CallFunc(S_Ptr("0x0859A16A"), "int", ["pointer"], partyobj.C_Object) == 1) { - local MaxRoll = NativePointer(args[1]).add(16).readU32(); - local odds = EpicPotionOdds; // 默认药剂的增加几率 - // 检查是否VIP玩家 - local charac_no = userWithPotion.GetCID(); - if (EpicPotionlist.rawin(charac_no)) { - odds = EpicPotionlist[charac_no]; - } - // 计算新的roll值 - args[2] = MathClass.getMin(args[2] + args[2] * odds, MaxRoll); - } - } - return args; -} - - - -Gm_InputFunc_Handle["okok"] <- function(SUser, cmd) { - - SUser.SendNotiPacketMessage("出纳上asdasdasda到几点方柏霓撒娇扩大年级卡萨", 7); -} \ No newline at end of file diff --git a/_DPS_/_BuiltProject/宿命魂石/FatalismStone.nut b/_DPS_/_BuiltProject/宿命魂石/FatalismStone.nut index 38c854c..54deaeb 100644 --- a/_DPS_/_BuiltProject/宿命魂石/FatalismStone.nut +++ b/_DPS_/_BuiltProject/宿命魂石/FatalismStone.nut @@ -8,20 +8,25 @@ class FatalismStone_Stone { //编号 - Id = 0; + Id = null; + //唯一ID + Uuid = null; //类型 - StoneType = 0; + StoneType = null; //洗练度 - CultivationDegree = 0; + CultivationDegree = null; + constructor() { - //特殊 ! 石头的储存数据大小 - Size = 8; + } - constructor(FatalismStoneID = 0) { - Id = FatalismStoneID; - CultivationDegree = MathClass.Rand(1, 100); + + //反序列化构造 + function Deserialize(StoneId, StoneUuid) { + this.Id = StoneId; + this.Uuid = StoneUuid; + this.StoneType = ProjectInitFuncMap.P_FatalismStone.GetStoneData(this.Id)["stone type"]; } function Blob2Hex(buf) { @@ -34,28 +39,90 @@ class FatalismStone_Stone { function Serialize() { local B = blob(0); - B.writen(Id, 'i'); //写入ID - B.writen(CultivationDegree, 'i'); //写入洗练值 - + B.writen(Uuid, 'i'); //写入Uuid return Blob2Hex(B); } +} - function Deserialize(Data) { - local Buf = FatalismStone_Stone(); - Buf.Id = Data.readn('i'); - Buf.CultivationDegree = Data.readn('i'); - if (Buf.Id == 0) return Buf; - Buf.StoneType = ProjectInitFuncMap.P_FatalismStone.GetStoneData(Buf.Id)["stone type"]; - return Buf; +//魂石背包类 +class FatalismStone_BackPack { + + //背包总格子数 + GridCount = 77; + //穿戴总格子数 + WearCount = 6; + StoneArr = null; + + constructor() { + StoneArr = []; } - function SerializeTable(Obj) { - local T = { - id = Obj.Id, - cultivationDegree = Obj.CultivationDegree + //通过数据构造背包 反序列化 + function Deserialize(N_Data) { + local BackpackData = N_Data[0][0]; + local WearData = N_Data[0][1]; + + //转换背包数据 + local BackPackArr = []; + for (local i = 0; i<(GridCount * 3); i++) { + local StoneId = BackpackData.add(i * 8).readInt(); + local StoneUuid = BackpackData.add(i * 8 + 4).readInt(); + if (StoneId != 0 && StoneUuid != 0) { + local StoneObj = FatalismStone_Stone(); + StoneObj.Deserialize(StoneId, StoneUuid) + BackPackArr.push(StoneObj); + } else { + BackPackArr.push(null); + } + } + //转化穿戴数据 + local WearArr = []; + for (local i = 0; i< WearCount; i++) { + local StoneId = WearData.add(i * 8).readInt(); + local StoneUuid = WearData.add(i * 8 + 4).readInt(); + if (StoneId != 0 && StoneUuid != 0) { + local StoneObj = FatalismStone_Stone(); + StoneObj.Deserialize(StoneId, StoneUuid) + WearArr.push(StoneObj); + } else { + WearArr.push(null); + } + } + + //两段数据放入总数据 + StoneArr.extend(BackPackArr); + StoneArr.extend(WearArr); + } + + //序列化 + function Serialize() { + //背包数据 + local BackpackArr = StoneArr.slice(0, GridCount * 3); + local BackpackHex = "0x"; + foreach(Pos, StoneObject in BackpackArr) { + if (StoneObject) BackpackHex += StoneObject.Serialize(); + else BackpackHex += "0000000000000000"; + } + //穿戴数据 + local WearArr = StoneArr.slice(GridCount * 3, GridCount * 3 + WearCount); + local WearHex = "0x"; + foreach(Pos, StoneObject in WearArr) { + if (StoneObject) WearHex += StoneObject.Serialize(); + else WearHex += "0000000000000000"; + } + //返回 + return { + inventory = BackpackHex, + wear = WearHex }; - return T; + } + + //获取魂石的列表 3为身上穿戴的 + function GetList(Page) { + local SliceLength = GridCount; + if (Page == 3) SliceLength = WearCount; + return StoneArr.slice(Page * 77, Page * 77 + SliceLength); } } @@ -71,8 +138,11 @@ class FatalismStone { //魂石Lst FatalismStoneLst = null; + //魂石配置 + FatalismStoneConfig = null; constructor() { + Script(); local PoolObj = MysqlPool.GetInstance(); PoolObj.SetBaseConfiguration("127.0.0.1", 3306, "game", "uu5!^%jg"); //连接池大小 @@ -83,96 +153,114 @@ class FatalismStone { //读取pvf的魂石相关数据 InitFatalismStoneData(); + //创建新架构表 + SelectSql("CREATE TABLE `zyk`.`f_user_info` ( `cid` int(250) NOT NULL, `inventory` varbinary(1848) NULL, `wear` varbinary(48) NULL, PRIMARY KEY (`cid`));", []); + SelectSql("CREATE TABLE `zyk`.`f_stone_map` ( `uuid` int(250) NOT NULL AUTO_INCREMENT, `cultivation` float NULL DEFAULT NULL, PRIMARY KEY (`uuid`) USING BTREE);", []); + // UpdateNewMysqlData(); + + + //注册客户端收包 RegisterClient(); //注册调试命令 RegisterDebugCmd(); - - - - SelectSql("CREATE TABLE `zyk`.`fatalismstone` ( `cid` int(250) NOT NULL, `data` varbinary(10240) NULL, `wearpack` varbinary(1024) NULL, PRIMARY KEY (`cid`));", []); } - //通过数组生成魂石序列化数据 - function GenerateSerializeData(StoneList) { - local Str = "0x"; - foreach(Stone in StoneList) { - Str += Stone.Serialize(); + //查询单个魂石的属性 + function GetStoneAttr(Uuid) { + local Ret = SelectSql("select cultivation from zyk.f_stone_map where uuid = " + Uuid, ["float"]); + if (Ret.len() == 0) { + return null; + } else { + return Ret[0]; } - return Str; } - //通过数据反序列化魂石列表 数据 序列化个数 - function GenerateDeserializeData(Data, Count) { - local BData = Sq_Point2Blob(Data.C_Object, FatalismStone_Stone.Size * Count); - local DataArr = []; - - //一直读到最后 - while (!BData.eos()) { - DataArr.push(FatalismStone_Stone.Deserialize(BData)); - } - return DataArr; - } - - //给指定玩家新增魂石 - function AddFatalismStone(SUser, FatalismStoneID) { - local CID = SUser.GetCID(); - local Ret = SelectSql("select data from zyk.fatalismstone where cid = " + CID, ["binary"]); - //获得玩家魂石数据 - local DataArr = GenerateDeserializeData(Ret[0][0], GridCount * 3); - //获取魂石属性 - local info = GetStoneData(FatalismStoneID); - //根据页数分割 - local Offset = (info["stone type"] * GridCount); - - local DataBuffer = DataArr.slice(Offset); - //找到第一个空格子 - local Index = null; - foreach(Pos, Obj in DataBuffer) { - if (Obj.Id == 0) { - Index = Pos; - break; + //查询多个魂石的属性 + function GetStoneAttrArr(UuidArr) { + local SqlStr = "select uuid,cultivation from zyk.f_stone_map where uuid in ("; + for (local i = 0; i< UuidArr.len(); i++) { + SqlStr += UuidArr[i]; + if (i != UuidArr.len() - 1) { + SqlStr += ","; } } - if (Index == null) { - SUser.SendNotiPacketMessage("您的魂石背包已满!", 8); - return false; + SqlStr += ")"; + local Ret = SelectSql(SqlStr, ["int", "float"]); + if (Ret.len() == 0) { + return null; + } else { + return Ret; } - //添加魂石 - DataArr[Offset + Index] = FatalismStone_Stone(FatalismStoneID); - local backpackBinary = GenerateSerializeData(DataArr); - SelectSql("update zyk.fatalismstone set data = (" + backpackBinary + ") where cid = " + CID, ["int"]); - FlushPlayerFatalismStoneBackpack(SUser); - return true; } - //给指定玩家刷新魂石背包 - function FlushPlayerFatalismStoneBackpack(SUser) { - local Ret = SelectSql("select data,wearpack from zyk.fatalismstone where cid = " + SUser.GetCID(), ["binary", "binary"]); - //背包数量*背包类型数量全部使用默认的构造石头填充会是0 - local BackPackArr = array(GridCount * 3, FatalismStone_Stone()); - local WearArr = array(WearCount, FatalismStone_Stone()); - //没有初始化背包的时候先初始化背包 - if (Ret.len() == 0) { - local backpackBinary = GenerateSerializeData(BackPackArr); - local wearBinary = GenerateSerializeData(WearArr); - SelectSql("insert into zyk.fatalismstone(cid,data,wearpack) values(" + SUser.GetCID() + ",(" + backpackBinary + "),(" + wearBinary + "))", ["int"]); - } else { - BackPackArr = GenerateDeserializeData(Ret[0][0], GridCount * 3); - WearArr = GenerateDeserializeData(Ret[0][1], WearCount); - } - SUser.SendJso({ - op = 21000002, - BackPackData = BackPackArr.map(FatalismStone_Stone.SerializeTable), - WearData = WearArr.map(FatalismStone_Stone.SerializeTable) - }); - } function RegisterClient() { + //查询魂石背包数据 ClientSocketPackFuncMap.rawset(21000001, function(SUser, Jso) { - FlushPlayerFatalismStoneBackpack(SUser); + local Ret = GetInvenData(SUser); + //没查到东西说明没有背包 第一次创建背包 + if (!Ret || Ret.len() == 0) { + local SqlStr = format("INSERT INTO zyk.f_user_info (cid, inventory, wear) VALUES (%d,REPEAT(0x00, 1848),REPEAT(0x00, 48))", SUser.GetCID()); + SelectSql(SqlStr, []); + } + //有数据的读取 + else { + local BackPackData = Ret[0][0]; + local WearData = Ret[0][1]; + local PackSize = 4 + 4 + BackPackData.Size + 4 + WearData.Size; + local Pack = Packet(); + Pack.Put_Header(1, 131); + Pack.Put_Byte(1); + Pack.Put_Int(PackSize); + Pack.Put_Int(21000002); + Pack.Put_Int(BackPackData.Size); + Pack.Put_BinaryEx(BackPackData.C_Object, BackPackData.Size); + Pack.Put_Int(WearData.Size); + Pack.Put_BinaryEx(WearData.C_Object, WearData.Size); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + + //查询身上穿戴的魂石属性 + local BackPack = FatalismStone_BackPack(); + BackPack.Deserialize(Ret); + local WearArr = BackPack.GetList(3); + local UuidArr = []; + for (local i = 0; i< WearArr.len(); i++) { + if (WearArr[i] != null) { + UuidArr.push(WearArr[i].Uuid); + } + } + if (UuidArr.len() > 0) { + local Attr = GetStoneAttrArr(UuidArr); + if (Attr) { + local PackSize = 4 + 4 + (Attr.len() * 4 * Attr[0].len()); + local Pack = Packet(); + Pack.Put_Header(1, 131); + Pack.Put_Byte(1); + Pack.Put_Int(PackSize); + Pack.Put_Int(21000014); + Pack.Put_Int(Attr.len()); + for (local i = 0; i< Attr.len(); i++) { + for (local z = 0; z< Attr[i].len(); z++) { + Pack.Put_Int(Attr[i][z]); + } + } + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + } + } + }.bindenv(this)); + + //查询魂石唯一属性 + ClientSocketPackFuncMap.rawset(21000011, function(SUser, Jso) { + local Uuid = Jso.uuid; + SendFatalismStoneData(SUser, Uuid); }.bindenv(this)); //交换魂石位置 @@ -183,92 +271,38 @@ class FatalismStone { local NewType = Jso.newtype; local NewIndex = Jso.newpos; + local BackPack = GetInven(SUser); + if (!BackPack) return; - local Ret = SelectSql("select data,wearpack from zyk.fatalismstone where cid = " + SUser.GetCID(), ["binary", "binary"]); - local BackPackArr = GenerateDeserializeData(Ret[0][0], GridCount * 3); - local WearArr = GenerateDeserializeData(Ret[0][1], WearCount); + //直接去交换位置 + local Buffer = BackPack.StoneArr[OldType * 77 + OldIndex]; + BackPack.StoneArr[OldType * 77 + OldIndex] = BackPack.StoneArr[NewType * 77 + NewIndex]; + BackPack.StoneArr[NewType * 77 + NewIndex] = Buffer; - //如果有魂石要移动到穿戴栏 需要检测魂石的类型是否与穿戴栏符合 - // if (OldType == -1 || NewType == -1) { - // if(OldType == -1){ - // local OldStone = WearArr[OldIndex]; - // if(OldStone.Id != 0){ - // local Info = GetStoneData(OldStone.Id); - // if(Info["stone type"] != NewType){ - // SUser.SendNotiPacketMessage("该魂石无法穿戴在当前位置", 8); - // return; - // } - // } - // } - // if(NewType == -1){ - // local NewStone = BackPackArr[NewIndex]; - // if(NewStone.Id != 0){ - // local Info = GetStoneData(NewStone.Id); - // if(Info["stone type"] != OldType){ - // SUser.SendNotiPacketMessage("该魂石无法穿戴在当前位置", 8); - // return; - // } - // } - // } - // } - - //如果Type等于-1 说明是穿戴的魂石的槽位 - local OldTemp, NewTemp; - if (OldType == -1) { - OldTemp = WearArr[OldIndex]; - } else { - OldTemp = BackPackArr[OldType * GridCount + OldIndex]; - } - if (NewType == -1) { - NewTemp = WearArr[NewIndex]; - } else { - NewTemp = BackPackArr[NewType * GridCount + NewIndex]; - } - - - // //比对两个魂石的槽位类型 - // local ComparisonType; - // if (NewType == -1) { - // ComparisonType = NewIndex + 1; - // } else { - // ComparisonType = (NewType + 1); - // } - // print("旧类型: " + OldTemp.StoneType + "\n 新类型: " + ComparisonType); - // print("旧ID: " + OldTemp.Id + "\n 新ID: " + NewTemp.Id); - // if (OldTemp.StoneType != ComparisonType) { - // SUser.SendNotiPacketMessage("该魂石无法穿戴在当前位置", 8); - // return; - // } - - //交换数据 - if (OldType == -1) { - WearArr[OldIndex] = NewTemp; - } else { - BackPackArr[OldType * GridCount + OldIndex] = NewTemp; - } - if (NewType == -1) { - WearArr[NewIndex] = OldTemp; - } else { - BackPackArr[NewType * GridCount + NewIndex] = OldTemp; - } - - - //序列化数据 - local backpackBinary = GenerateSerializeData(BackPackArr); - local wearBinary = GenerateSerializeData(WearArr); - - - //更新数据库 - SelectSql("update zyk.fatalismstone set data = (" + backpackBinary + "),wearpack = (" + wearBinary + ") where cid = " + SUser.GetCID(), ["int"]); - - //发送数据 - SUser.SendJso({ - op = 21000002, - BackPackData = BackPackArr.map(FatalismStone_Stone.SerializeTable), - WearData = WearArr.map(FatalismStone_Stone.SerializeTable) - }); + SaveInven(BackPack, SUser); }.bindenv(this)); + //魂石洗练 + ClientSocketPackFuncMap.rawset(21000005, function(SUser, Jso) { + local Uuid = Jso.uuid; + local rarity = Jso.rarity; + //获取背包对象 + local InvenObj = SUser.GetInven(); + local Flag = InvenObj.DeleteItemCount(FatalismStoneConfig["wash_item"], FatalismStoneConfig["wash_cost"][rarity]); + //扣除不成功 + if (!Flag) { + SUser.SendNotiPacketMessage("精炼魂石所需的材料不足!", 8); + return; + } + + local Rand = MathClass.Rand(1, 105); + if (Rand > 100) Rand = 100; + + //将新的精炼值写入数据库 + local Sql = "update zyk.f_stone_map set cultivation = " + Rand + " where uuid = " + Uuid; + SelectSql(Sql, []); + SendFatalismStoneData(SUser, Uuid) + }.bindenv(this)); Cb_User_Insert_Item_Leave_Func["宿命魂石"] <- function(args) { local SUser = User(NativePointer(args[0]).readPointer()); @@ -283,7 +317,7 @@ class FatalismStone { Timer.SetTimeOut(function() { inven_item.Delete(); SUser.SendUpdateItemList(1, 0, idx); - }, 100); + }, 1000); //如果满了就发邮件 if (!Ret) { local T = {}; @@ -297,8 +331,6 @@ class FatalismStone { } } }.bindenv(this); - - } @@ -324,8 +356,63 @@ class FatalismStone { }.bindenv(this); } + //获取玩家背包数据 + function GetInvenData(SUser) { + local Ret = SelectSql("select inventory,wear from zyk.f_user_info where cid = " + SUser.GetCID(), ["binary", "binary"]); + if (!Ret || Ret.len() == 0) return null; + else return Ret; + } + + //获取玩家背包 + function GetInven(SUser) { + local Ret = GetInvenData(SUser); + if (Ret) { + local BackPack = FatalismStone_BackPack(); + BackPack.Deserialize(Ret); + return BackPack; + } else return null; + } + + //固化背包数据到数据库 + function SaveInven(Inven, SUser) { + //获取背包整体信息并储存 + local Hex = Inven.Serialize(); + //更新数据库 + local Sql = "update zyk.f_user_info set inventory = " + Hex.inventory + ",wear = " + Hex.wear + " where cid = " + SUser.GetCID(); + SelectSql(Sql, []); + } + + //发送uuid的魂石数据给客户端 + function SendFatalismStoneData(SUser, Uuid) { + local Attr = GetStoneAttr(Uuid); + if (!Attr) { + SUser.SendNotiPacketMessage("魂石属性异常,请联系管理员!", 8); + } else { + local Cultivation = Attr[0]; + local PackSize = 4 + 4 + 4; + local Pack = Packet(); + Pack.Put_Header(1, 131); + Pack.Put_Byte(1); + Pack.Put_Int(PackSize); + Pack.Put_Int(21000012); + Pack.Put_Int(Uuid); + Pack.Put_Int(Cultivation); + Pack.Finalize(true); + SUser.Send(Pack); + Pack.Delete(); + } + } + + //给指定玩家新增魂石 + function AddFatalismStone(SUser, FatalismStoneID) { + local CID = SUser.GetCID(); + + + } + + function InitFatalismStoneData() { - Script(); + // Script(); FatalismStoneLst = {}; ScriptData.GetFileData("fatalismstone/fatalismstone.lst", function(DataTable, Data) { while (!Data.Eof()) { @@ -334,6 +421,17 @@ class FatalismStone { FatalismStoneLst.rawset(Id, Path); } }.bindenv(this)); + + FatalismStoneConfig = ScriptData.GetFileData("fatalismstone/fatalismstone.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Str = Data.Get(); + if (Str == "[wash item]") { + DataTable.wash_item <- Data.Get(); + } else if (Str == "[wash cost]") { + DataTable.wash_cost <- [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()]; + } + } + }.bindenv(this)); } function GetStoneData(Index) { @@ -409,16 +507,6 @@ class FatalismStone { - - - - - - - - - - @@ -438,10 +526,79 @@ class FatalismStone { MysqlPool.GetInstance().PutConnect(SqlObj); return Ret; } + + + //UpdateNewMysqlData + function UpdateNewMysqlData() { + + local Ret = SelectSql("select * from zyk.fatalismstone", ["int", "binary", "binary"]); + + foreach(Index, Info in Ret) { + local cid = Info[0]; + local inventory = Info[1]; + local wear = Info[2]; + + //处理背包里的魂石 + local NewBlob = blob(); + for (local i = 0; i< 462; i += 2) { + local item_id = inventory.add(i * 4).readInt(); + local cultivation = inventory.add(i * 4 + 4).readInt(); + if (item_id > 0) { + //在新表中建立这件装备的uuid + local Sql = "insert into zyk.f_stone_map (cultivation) values (" + cultivation + ")"; + SelectSql(Sql, []); + //查询最后新增条目的uuid + Sql = "select LAST_INSERT_ID() as uuid"; + local uuid = SelectSql(Sql, ["int"])[0][0]; + + NewBlob.writen(item_id, 'i'); + NewBlob.writen(uuid, 'i'); + } else { + NewBlob.writen(0, 'i'); + NewBlob.writen(0, 'i'); + } + } + local inventoryBinary = "0x" + Blob2Hex(NewBlob); + + //处理身上穿戴的魂石 + NewBlob.resize(0); + for (local i = 0; i< 12; i += 2) { + local item_id = wear.add(i * 4).readInt(); + print(item_id); + + local cultivation = wear.add(i * 4 + 4).readInt(); + if (item_id > 0) { + //在新表中建立这件装备的uuid + local Sql = "insert into zyk.f_stone_map (cultivation) values (" + cultivation + ")"; + SelectSql(Sql, []); + //查询最后新增条目的uuid + Sql = "select LAST_INSERT_ID() as uuid"; + local uuid = SelectSql(Sql, ["int"])[0][0]; + + NewBlob.writen(item_id, 'i'); + NewBlob.writen(uuid, 'i'); + } else { + NewBlob.writen(0, 'i'); + NewBlob.writen(0, 'i'); + } + } + local wearBinary = "0x" + Blob2Hex(NewBlob); + + local Sql = "insert into zyk.f_user_info (cid,inventory, wear) values (" + cid + "," + inventoryBinary + "," + wearBinary + ")"; + SelectSql(Sql, []); + } + } + + function Blob2Hex(buf) { + local str = ""; + for (local i = 0; i< buf.len(); i++) { + str += format("%02X", buf[i]); + } + return str; + } } -ProjectInitFuncMap.P_FatalismStone <- FatalismStone(); -print("文件加载!"); \ No newline at end of file +ProjectInitFuncMap.P_FatalismStone <- FatalismStone(); \ No newline at end of file diff --git a/_DPS_/_Core/BaseClass/HackerClass/HackerClass.nut b/_DPS_/_Core/BaseClass/HackerClass/HackerClass.nut index e7855c5..b06712a 100644 --- a/_DPS_/_Core/BaseClass/HackerClass/HackerClass.nut +++ b/_DPS_/_Core/BaseClass/HackerClass/HackerClass.nut @@ -14,6 +14,8 @@ class _Hacker { NextReturnAddress = null; CpuContext = null; + + constructor() { HookTable = {}; HookJumpMemoryTable = {}; diff --git a/_DPS_/_Core/BaseClass/MemoryClass/MemoryClass.nut b/_DPS_/_Core/BaseClass/MemoryClass/MemoryClass.nut index 11c185e..5b6aa00 100644 --- a/_DPS_/_Core/BaseClass/MemoryClass/MemoryClass.nut +++ b/_DPS_/_Core/BaseClass/MemoryClass/MemoryClass.nut @@ -85,9 +85,9 @@ class NativePointer extends Base_C_Object { function write(value, type) { local Buf = blob(0); Buf.writen(value, type); - local arr = []; - foreach(value in Buf) { - arr.append(value); + local arr = array(Buf.len()); + for (local i = 0; i< Buf.len(); i++) { + arr[i] = Buf[i]; } writeByteArray(arr); } diff --git a/_DPS_/_Core/BaseClass/PartyClass/PartyClass.nut b/_DPS_/_Core/BaseClass/PartyClass/PartyClass.nut index 0f27602..94e2887 100644 --- a/_DPS_/_Core/BaseClass/PartyClass/PartyClass.nut +++ b/_DPS_/_Core/BaseClass/PartyClass/PartyClass.nut @@ -43,9 +43,11 @@ class Party extends Base_C_Object { //获取玩家 function GetUser(Pos) { - local C_User = Sq_CallFunc(S_Ptr("0x08145764"), "pointer", ["pointer", "int"], this.C_Object, Pos); - if (C_User) { - return User(C_User); + if (Sq_CallFunc(S_Ptr("0x085B4D12"), "int", ["pointer", "int"], this.C_Object, Pos)) { + local C_User = Sq_CallFunc(S_Ptr("0x08145764"), "pointer", ["pointer", "int"], this.C_Object, Pos); + if (C_User) { + return User(C_User); + } } return null; } diff --git a/_DPS_/_Core/New_Hook.nut b/_DPS_/_Core/New_Hook.nut index d26658e..9812243 100644 --- a/_DPS_/_Core/New_Hook.nut +++ b/_DPS_/_Core/New_Hook.nut @@ -226,7 +226,7 @@ _Hook_Register_Currency_Func_("0x084D7A90", ["pointer", "pointer", "pointer", "i //副本内生成物品时 Cb_Battle_Field_MakeDropItems_Enter_Func <- {}; Cb_Battle_Field_MakeDropItems_Leave_Func <- {}; -_Hook_Register_Currency_Func_("0x0830ADF6", ["pointer", "int", "int", "int", "short", "int", "int", "int", "char", "int", "int", "int", "void"], Cb_Battle_Field_MakeDropItems_Enter_Func, Cb_Battle_Field_MakeDropItems_Leave_Func); +_Hook_Register_Currency_Func_("0x0830ADF6", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int", "void"], Cb_Battle_Field_MakeDropItems_Enter_Func, Cb_Battle_Field_MakeDropItems_Leave_Func); //独立掉落几率 Cb_IndependentItemRateControl_Enter_Func <- {}; @@ -601,4 +601,24 @@ _Hook_Register_Currency_Func_("0x86C5288", ["int", "pointer", "pointer", "int"], //获取Item Rarity Cb_CItem_get_rarity_Enter_Func <- {}; Cb_CItem_get_rarity_Leave_Func <- {}; -_Hook_Register_Currency_Func_("0x080F12D6", ["pointer", "int"], Cb_CItem_get_rarity_Enter_Func, Cb_CItem_get_rarity_Leave_Func); \ No newline at end of file +_Hook_Register_Currency_Func_("0x080F12D6", ["pointer", "int"], Cb_CItem_get_rarity_Enter_Func, Cb_CItem_get_rarity_Leave_Func); + +//副本内怪物死亡消息包 +Cb_CBattle_Field_MakeNotiPacketDieMonster_Enter_Func <- {}; +Cb_CBattle_Field_MakeNotiPacketDieMonster_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0830B8CC", ["pointer", "pointer", "pointer", "int", "int", "pointer", "pointer", "pointer"], Cb_CBattle_Field_MakeNotiPacketDieMonster_Enter_Func, Cb_CBattle_Field_MakeNotiPacketDieMonster_Leave_Func); + +//向队伍全体发包 +Cb_CParty_send_to_party_Enter_Func <- {}; +Cb_CParty_send_to_party_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0859d14e", ["pointer", "pointer", "int"], Cb_CParty_send_to_party_Enter_Func, Cb_CParty_send_to_party_Leave_Func); + +//物品掷点 +Cb_CItem_check_item_routing_Enter_Func <- {}; +Cb_CItem_check_item_routing_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0850D756", ["pointer", "bool"], Cb_CItem_check_item_routing_Enter_Func, Cb_CItem_check_item_routing_Leave_Func); + +//统计队伍中满足特定条件的成员数量 +Cb_CParty_get_live_count_enter_map_Enter_Func <- {}; +Cb_CParty_get_live_count_enter_map_Leave_Func <- {}; +_Hook_Register_Currency_Func_("0x0859A918", ["pointer", "int"], Cb_CParty_get_live_count_enter_map_Enter_Func, Cb_CParty_get_live_count_enter_map_Leave_Func); diff --git a/lib/libAurora.so b/lib/libAurora.so index e0d9b3b..0a17c91 100755 Binary files a/lib/libAurora.so and b/lib/libAurora.so differ diff --git a/lib/libAurora.so.bak b/lib/libAurora.so.bak deleted file mode 100755 index 0a17c91..0000000 Binary files a/lib/libAurora.so.bak and /dev/null differ