### 新增IO 类

### 新增MD5 类

### 新增Mysql 类

### 新增Timer 类
This commit is contained in:
lenheart
2024-09-20 19:24:32 +08:00
parent 237bcf8719
commit 7f547f5fd4
21 changed files with 1234 additions and 16 deletions

View File

@@ -153,13 +153,19 @@ Gm_InputFunc_Handle.Q <- function(SUser, CmdString) {
};
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
local PartyObj = SUser.GetParty();
if (PartyObj) {
local Bfobj = PartyObj.GetBattleField();
print(Bfobj.GetHellDifficulty());
// print(n);
}
// local PartyObj = SUser.GetParty();
// if (PartyObj) {
// local Bfobj = PartyObj.GetBattleField();
// print(Bfobj.GetHellDifficulty());
// // print(n);
// }
SUser.SendNotiForColorAIdPacketMessage([
[" → ", 0, [0xff, 0xff, 0xff]],
["无色", 1, [255, 215, 0], 3037],
[" x" + (1).tostring(), 0, [0xff, 0xff, 0xff]]
], 6);
};
Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
@@ -173,7 +179,7 @@ Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
Pack.Put_Binary(Str);
Pack.Finalize(true);
SUser.Send(Pack);
Pack.Delete();
Pack.Delocale();
};
Gm_InputFunc_Handle.T <- function(SUser, CmdString) {
@@ -212,4 +218,137 @@ function Cb_gm_input(C_User, 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("文件书写完成");
}
}
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);
};