毁梦更新
This commit is contained in:
@@ -91,6 +91,120 @@ _HM_DQJYHD_ <- "0"
|
||||
|
||||
function _Dps_JYYJBB2_Main_() {
|
||||
|
||||
Cb_History_ItemUp_Func["交易邮件播报"] <- function(SUser, args) {
|
||||
local reason = args[18];
|
||||
if (reason == "1") {
|
||||
local pvfitem = PvfItem.GetNameById(args[15].tointeger());
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [255, 0, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("获得", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + args[20] + "]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("交易的道具", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(pvfitem, [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(args[17] + "个", [255, 255, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Cb_History_MoneyUp_Func["交易邮件播报"] <- function(SUser, args) {
|
||||
local reason = args[16];
|
||||
if (reason == "1") {
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [255, 0, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("获得", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + getFirstBracketContent(args[17]) + "]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("交易的", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(args[15], [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("金币", [255, 255, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
Cb_MailBox11_Send_Leave_Func["交易邮件播报"] <- function(args) {
|
||||
local jewelSocketID = NativePointer(args[0]).readPointer();
|
||||
local SUser = User(jewelSocketID);
|
||||
local name = SUser.GetCharacName();
|
||||
local receive_name = NativePointer(args[1]).add(17).readUtf8String();
|
||||
local send_gold_count = NativePointer(args[1]).add(46).readU32();
|
||||
local send_item_id = NativePointer(args[1]).add(57).readU32();
|
||||
local send_item_count = NativePointer(args[1]).add(61).readU32(); //发送道具数量
|
||||
local item_name;
|
||||
if (send_item_id > 0) {
|
||||
item_name = PvfItem.GetNameById(send_item_id);
|
||||
}
|
||||
// 发送世界公告播报
|
||||
if (send_gold_count > 0 && send_item_id > 0) {
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("刚刚通过邮件向", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + receive_name + "]", [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("发送了", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("金币*" + send_gold_count, [255, 170, 0]);
|
||||
LoginMsgObj.PutColorString("和", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(send_item_count + "个", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(item_name, [255, 255, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
} else if (send_gold_count > 0) {
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("刚刚通过邮件向", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + receive_name + "]", [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("发送了", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("金币*" + send_gold_count, [255, 170, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
} else if (send_item_id > 0) {
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("刚刚通过邮件向", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + receive_name + "]", [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("发送了", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(send_item_count + "个", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(item_name, [255, 255, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
} else {
|
||||
local LoginMsgObj = AdMsg();
|
||||
LoginMsgObj.PutType(14);
|
||||
LoginMsgObj.PutColorString("玩家[", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString(SUser.GetCharacName(), [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("]", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("刚刚通过邮件向", [255, 255, 0]);
|
||||
LoginMsgObj.PutColorString("[" + receive_name + "]", [0, 255, 0]);
|
||||
LoginMsgObj.PutColorString("发送了一封邮件", [255, 255, 0]);
|
||||
LoginMsgObj.Finalize();
|
||||
World.SendAll(LoginMsgObj.MakePack());
|
||||
LoginMsgObj.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Cb_History_ItemUp_Func["交易邮件播报"] <- function(SUser, args) {
|
||||
local reason = args[18];
|
||||
if (reason == "1" || reason == "17") {
|
||||
@@ -161,55 +275,55 @@ function _Dps_JYYJBB2_Main_() {
|
||||
|
||||
Cb_Inter_AuctionResultBidding_Leave_Func["交易播报2"] <- function(args) {
|
||||
|
||||
Timer.SetTimeOut(function() {
|
||||
Timer.SetTimeOut(function() {
|
||||
|
||||
local username = User(args[1]).GetCharacName();
|
||||
local id = NativePointer(args[2]).add(14).readInt();
|
||||
local username = User(args[1]).GetCharacName();
|
||||
local id = NativePointer(args[2]).add(14).readInt();
|
||||
|
||||
local CheckSql = "SELECT item_id,unit_price,owner_id FROM taiwan_cain_auction_gold.auction_history_" + getYearMonth() + " where auction_id = " + id + ";";
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(CheckSql, ["int", "int", "int"]);
|
||||
local CheckSql = "SELECT item_id,unit_price,owner_id FROM taiwan_cain_auction_gold.auction_history_" + getYearMonth() + " where auction_id = " + id + ";";
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(CheckSql, ["int", "int", "int"]);
|
||||
|
||||
|
||||
if (Ret == null || Ret.len() == 0) {
|
||||
print(123);
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
local itemId = Ret[0][0];
|
||||
local unitPrice = Ret[0][1];
|
||||
local maijiacid = Ret[0][2];
|
||||
|
||||
if (maijiacid == User(args[1]).GetCID()) {
|
||||
print(321);
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
local CheckSql2 = "SELECT price FROM taiwan_cain_auction_gold.auction_history_buyer_" + getYearMonth() + " ORDER BY occ_time DESC LIMIT 1;";
|
||||
|
||||
local Ret2 = SqlObj.Select(CheckSql2, ["int"]);
|
||||
|
||||
local price = Ret2[0][0];
|
||||
|
||||
|
||||
|
||||
local CheckSql3 = "SELECT charac_name FROM taiwan_cain.charac_info where charac_no = " + maijiacid;
|
||||
|
||||
local Ret3 = SqlObj.Select(CheckSql3, ["string"]);
|
||||
|
||||
local mjname = Ret3[0][0];
|
||||
|
||||
|
||||
if (Ret == null || Ret.len() == 0) {
|
||||
print(123);
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
local itemId = Ret[0][0];
|
||||
local unitPrice = Ret[0][1];
|
||||
local maijiacid = Ret[0][2];
|
||||
|
||||
if (maijiacid == User(args[1]).GetCID()) {
|
||||
print(321);
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
local CheckSql2 = "SELECT price FROM taiwan_cain_auction_gold.auction_history_buyer_" + getYearMonth() + " ORDER BY occ_time DESC LIMIT 1;";
|
||||
|
||||
local Ret2 = SqlObj.Select(CheckSql2, ["int"]);
|
||||
|
||||
local price = Ret2[0][0];
|
||||
|
||||
|
||||
|
||||
local CheckSql3 = "SELECT charac_name FROM taiwan_cain.charac_info where charac_no = " + maijiacid;
|
||||
|
||||
local Ret3 = SqlObj.Select(CheckSql3, ["string"]);
|
||||
|
||||
local mjname = Ret3[0][0];
|
||||
|
||||
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
|
||||
World.SendNotiPacketMessage(format("玩家[%s]在拍卖行用[%d]金币从[%s]手里购得[%s]物品", username, price, mjname, PvfItem.GetNameById(itemId)), 14);
|
||||
World.SendNotiPacketMessage(format("玩家[%s]在拍卖行用[%d]金币从[%s]手里购得[%s]物品", username, price, mjname, PvfItem.GetNameById(itemId)), 14);
|
||||
|
||||
}, 100);
|
||||
|
||||
@@ -262,7 +376,7 @@ function _Dps_JYYJBB2_Main_() {
|
||||
local ItemType = Sq_CallFunc(S_Ptr("0x085018D2"), "int", ["pointer", "int"], InvenObj.C_Object, item_id);
|
||||
local pvfitem = PvfItem.GetPvfItemById(item_id);
|
||||
// 史诗装备记录
|
||||
if (pvfitem.GetRarity() == 4 /*&& type == 4 */&& ItemType == 1) {
|
||||
if (pvfitem.GetRarity() == 4 /*&& type == 4 */ && ItemType == 1) {
|
||||
local MsgObj = AdMsg();
|
||||
MsgObj.PutType(14);
|
||||
MsgObj.PutColorString("玩家[" + SUser.GetCharacName() + "]于", [255, 220, 0]);
|
||||
@@ -276,6 +390,35 @@ function _Dps_JYYJBB2_Main_() {
|
||||
}
|
||||
}
|
||||
|
||||
Cb_DisPatcher_MoveItem_Enter_Func["毁梦定制一件入库"] <- function(args) {
|
||||
local ParamBase = NativePointer(args[2]);
|
||||
if (!ParamBase) return null;
|
||||
|
||||
// 读取 type 参数(ParamBase + 16 位置)
|
||||
local Type = ParamBase.add(16).readU8();
|
||||
|
||||
if (Type == 98) {
|
||||
// 移动到个人仓库
|
||||
local SUser = User(args[1]);
|
||||
if (SUser) {
|
||||
MoveToCargo(SUser, 0);
|
||||
}
|
||||
//执行原函数会判断是否等于0x7FFFFFFF 所以这里写0以后 原函数条件不成立 会return 阻止原函数执行
|
||||
ParamBase.add(4).writeInt(0);
|
||||
} else if (Type == 99) {
|
||||
// 移动到账号仓库
|
||||
local SUser = User(args[1]);
|
||||
if (SUser) {
|
||||
MoveToCargo(SUser, 1);
|
||||
}
|
||||
//执行原函数会判断是否等于0x7FFFFFFF 所以这里写0以后 原函数条件不成立 会return 阻止原函数执行
|
||||
ParamBase.add(4).writeInt(0);
|
||||
}
|
||||
|
||||
// 其他情况继续执行原逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
function getYearMonth() {
|
||||
local now = date();
|
||||
return format("%d%02d", now.year, now.month + 1);
|
||||
@@ -317,6 +460,108 @@ function getContentBetweenDelimiters(str, delimiter = "\"") {
|
||||
|
||||
|
||||
|
||||
|
||||
// 移动物品到仓库的Hook实现
|
||||
// type: 0-个人仓库 1-账号仓库
|
||||
function MoveToCargo(SUser, type) {
|
||||
// slot: 3-8快捷栏 9-56线名栏 57-104消耗品栏 105-152材料栏 153-200任务栏 201-248副职业栏 249-311徽章栏
|
||||
local Cargo = null;
|
||||
local InvenObj = SUser.GetInven();
|
||||
if (!InvenObj) return;
|
||||
|
||||
// 根据类型选择仓库
|
||||
if (type == 0) {
|
||||
// 获取个人仓库
|
||||
local CargoPtr = Sq_CallFunc(S_Ptr("0x8151A94"), "pointer", ["pointer"], SUser.C_Object);
|
||||
if (!CargoPtr) return;
|
||||
Cargo = NativePointer(CargoPtr);
|
||||
} else if (type == 1) {
|
||||
// 获取账号仓库
|
||||
local CargoObj = SUser.GetAccountCargo();
|
||||
if (!CargoObj) return;
|
||||
Cargo = NativePointer(CargoObj.C_Object);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// 遍历 57-152 槽位(消耗品栏和材料栏)
|
||||
for (local slot = 57; slot <= 152; slot++) {
|
||||
// 获取背包对应slot的物品
|
||||
local SlotItem = InvenObj.GetSlot(1, slot);
|
||||
if (!SlotItem || SlotItem.IsEmpty) continue;
|
||||
|
||||
// 获取物品ID
|
||||
local ItemId = SlotItem.GetIndex();
|
||||
if (ItemId <= 0) continue;
|
||||
|
||||
local IsExist = -1;
|
||||
local CargoInvenItemPtr = null;
|
||||
local CargoItemId = 0;
|
||||
|
||||
// 根据仓库类型检查物品是否存在
|
||||
if (type == 0) {
|
||||
// 个人仓库检查
|
||||
IsExist = Sq_CallFunc(S_Ptr("0x850BC14"), "int", ["pointer", "int"], Cargo.C_Object, ItemId);
|
||||
if (IsExist == -1) continue;
|
||||
|
||||
// 获取个人仓库中物品的指针
|
||||
local CargoItemListPtr = NativePointer(Cargo.add(4).readPointer());
|
||||
CargoInvenItemPtr = CargoItemListPtr.add(61 * IsExist);
|
||||
CargoItemId = CargoItemListPtr.add(61 * IsExist + 2).readU32();
|
||||
} else {
|
||||
// 账号仓库检查
|
||||
IsExist = Sq_CallFunc(S_Ptr("0x828A61A"), "int", ["pointer", "int"], Cargo.C_Object, ItemId);
|
||||
if (IsExist == -1) continue;
|
||||
|
||||
// 获取账号仓库中物品的指针
|
||||
CargoInvenItemPtr = Cargo.add(61 * IsExist);
|
||||
CargoItemId = CargoInvenItemPtr.add(6).readU32();
|
||||
}
|
||||
|
||||
// 获取物品数量
|
||||
local CargoItemCount = Sq_CallFunc(S_Ptr("0x80F783A"), "int", ["pointer"], CargoInvenItemPtr.C_Object);
|
||||
local SlotItemCount = SlotItem.GetAdd_Info();
|
||||
|
||||
print("CargoItemCount: " + CargoItemCount + " SlotItemCount: " + SlotItemCount);
|
||||
// 检查是否超过物品堆叠上限 0 超过 1没超过
|
||||
local IsMax = Sq_CallFunc(S_Ptr("0x8501A79"), "int", ["int", "int"], CargoItemId, CargoItemCount + SlotItemCount);
|
||||
if (IsMax == 0) {
|
||||
// 超过堆叠上限,跳过
|
||||
continue;
|
||||
}
|
||||
|
||||
// 移动物品到仓库
|
||||
local Result = -1;
|
||||
if (type == 0) {
|
||||
// 个人仓库插入
|
||||
Result = Sq_CallFunc(S_Ptr("0x850B400"), "int", ["pointer", "pointer"], Cargo.C_Object, SlotItem.C_Object);
|
||||
} else {
|
||||
// 账号仓库插入
|
||||
Result = Sq_CallFunc(S_Ptr("0x8289c82"), "int", ["pointer", "pointer", "int"], Cargo.C_Object, SlotItem.C_Object, IsExist);
|
||||
}
|
||||
|
||||
if (Result >= 0) {
|
||||
// 删除背包物品
|
||||
Sq_CallFunc(S_Ptr("0x080CB7D8"), "int", ["pointer"], SlotItem.C_Object);
|
||||
// 更新背包
|
||||
SUser.SendUpdateItemList(1, 0, slot);
|
||||
|
||||
// 更新仓库显示
|
||||
if (type == 0) {
|
||||
// 更新个人仓库
|
||||
Sq_CallFunc(S_Ptr("0x865DB6C"), "int", ["pointer", "int"], SUser.C_Object, 2);
|
||||
} else {
|
||||
// 更新账号仓库
|
||||
local CargoObj = SUser.GetAccountCargo();
|
||||
if (CargoObj) {
|
||||
CargoObj.SendItemList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Timer.SetTimeOut(function() {
|
||||
|
||||
getroottable()._DreamDestroyerCustomizedCombatPowerSystemC_ <- DreamDestroyerCustomizedCombatPowerSystemC();
|
||||
|
||||
Reference in New Issue
Block a user