function _Dps_Cross_Stone_Main_() { Cb_ModItemattr_Enter_Func.Cross_Stone <- function(args) { local SUser = User(args[1]); local pack = NativePointer(args[2]); local a = NativePointer(pack.add(20).readPointer()); local itemSlot = a.add(13).add(6).readShort(); local equSlot = a.add(13).add(0).readShort(); local InvenObj = SUser.GetInven(); if (InvenObj) { local ItemObj = InvenObj.GetSlot(1, itemSlot); if (ItemObj.GetIndex() == 2675422) { Sq_WriteByteArr(S_Ptr("0x820110E"), array(5, 0x90)); Sq_WriteByteArr(S_Ptr("0x8201647"), array(5, 0x90)); } } } Cb_ModItemattr_Leave_Func.Cross_Stone <- function(args) { local Config = GlobalConfig.Get("多彩蜜蜡改跨界石_Nangua.json"); local SUser = User(args[1]); local pack = NativePointer(args[2]); local a = NativePointer(pack.add(20).readPointer()); local itemSlot = a.add(13).add(6).readShort(); local equSlot = a.add(13).add(0).readShort(); local InvenObj = SUser.GetInven(); local result = 0; if (InvenObj) { local ItemObj = InvenObj.GetSlot(1, itemSlot); local equObj = InvenObj.GetSlot(1, equSlot); if (ItemObj.GetIndex() == 2675422) { local PvfItemObj = PvfItem.GetPvfItemById(equObj.GetIndex()); local qixi1 = NativePointer(equObj.C_Object).add(31).readU8(); local qixi2 = NativePointer(equObj.C_Object).add(32).readU8(); local ItemType = NativePointer(PvfItemObj.C_Object).add(141 * 4).readU32(); //获取账号金库对象 local CargoObj = SUser.GetAccountCargo(); //获取账号金库中的一个空格子 local EmptySlot = CargoObj.GetEmptySlot(); local CheckItemLock = Sq_CallFunc(S_Ptr("0x8646942"), "int", ["pointer", "int", "int"], SUser.C_Object, 1, equSlot); if (CheckItemLock) { _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else if(qixi1 > 0 || qixi2 > 0) { _Cross_StoneBynangua.sendNotification(SUser, true, itemSlot, Config["跨界失败提示4"]); _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else if (Config["不可跨界装备"].find(equObj.GetIndex()) != null) { _Cross_StoneBynangua.sendNotification(SUser, true, itemSlot, format(Config["跨界失败提示2"], PvfItem.GetNameById(equObj.GetIndex()))); _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else if (Config["不可跨界的装备类型"].find(ItemType) != null) { _Cross_StoneBynangua.sendNotification(SUser, true, itemSlot, Config["跨界失败提示3"]); _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else if (EmptySlot == -1) { _Cross_StoneBynangua.sendNotification(SUser, true, itemSlot, Config["跨界失败提示1"]); _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else { local Flag = CargoObj.InsertItem(equObj, EmptySlot); if (Flag == -1) { _Cross_StoneBynangua.sendNotification(SUser, true, itemSlot, Config["跨界失败提示5"]); _Cross_StoneBynangua.CUser_SendCmdErrorPacket(SUser, 84, 13) } else { local num = NativePointer(ItemObj.C_Object).add(7).readU32(); _Cross_StoneBynangua.SendConsume(SUser, itemSlot, num); //销毁背包中的道具 equObj.Delete(); //刷新玩家背包列表 SUser.SendUpdateItemList(1, 0, equSlot); //刷新账号金库列表 Timer.SetTimeOut(function() { CargoObj.SendItemList(); }, 1); _Cross_StoneBynangua.sendNotification(SUser, false, itemSlot, format(Config["跨界成功提示"], PvfItem.GetNameById(equObj.GetIndex()))); } } Sq_WriteByteArr(S_Ptr("0x820110E"), [0x3D, 0x4E, 0xD1, 0x28, 0x00]); Sq_WriteByteArr(S_Ptr("0x8201647"), [0xE8, 0xEC, 0x02, 0x00, 0x00]); } } return result; } } class _Cross_StoneBynangua { function sendNotification(SUser, bool, slot, message) { local Config = GlobalConfig.Get("多彩蜜蜡改跨界石_Nangua.json"); if(bool){ SUser.GiveItem(2675422, 1); SUser.SendUpdateItemList(1, 0, slot); } if (Config["233弹窗提示开启(true开启/false关闭)"]) { SUser.SendNotiBox(message, 1); } else { SUser.SendNotiPacketMessage(message, 8); } } function CUser_SendCmdErrorPacket(SUser, a, b) { return Sq_CallFunc(S_Ptr("0x0867BF42"), "int", ["pointer", "int", "int"], SUser.C_Object, a, b); } function SendConsume(SUser,ItemSlot,num){ local Pack = Packet(); Pack.Put_Header(1, 84); Pack.Put_Byte(1); Pack.Put_Short(ItemSlot); Pack.Put_Int(num); Pack.Put_Short(2); Pack.Finalize(true); SUser.Send(Pack); Pack.Delete(); } }