更新 IP 保存赋值方式

This commit is contained in:
lenheart 2025-12-20 16:51:59 +08:00
parent 51a5665176
commit ce49b1dc9f
3 changed files with 73 additions and 8 deletions

71
MyProject/仓库锁.nut Normal file
View File

@ -0,0 +1,71 @@
/*
文件名:仓库锁.nut
路径:MyProject/仓库锁.nut
创建日期:2025-12-20 02:19
文件用途:
*/
class WarehouseLockC {
MysqlObject = null;
constructor() {
MysqlObject = Mysql(Str_Ptr("127.0.0.1"), 3306, Str_Ptr("taiwan_cain"), Str_Ptr("game"), Str_Ptr("uu5!^%jg"));
MysqlObject.Exec_Sql(format("SET NAMES %s", "latin1"));
MysqlObject.Select("CREATE TABLE `zyk`.`warehouselock` ( `uid` int NOT NULL, `passwd` varchar(255) NULL, PRIMARY KEY (`uid`));", []);
ClientSocketPackFuncMap.rawset(21008009, function(SUser, Jso) {
local Uid = SUser.GetUID();
//查询uid是否存在于数据库中
local querySql = "SELECT passwd FROM zyk.warehouselock WHERE uid = " + Uid;
local result = MysqlObject.Select(querySql, [""]);
//说明有密码
if (result && result.len() > 0) {
SUser.SendJso({
op = 21008010
});
}
}.bindenv(this));
ClientSocketPackFuncMap.rawset(21008001, function(SUser, Jso) {
local Uid = SUser.GetUID();
//查询uid是否存在于数据库中
local querySql = "SELECT passwd FROM zyk.warehouselock WHERE uid = " + Uid;
local result = MysqlObject.Select(querySql, ["string"]);
local passwd = Jso.passwd;
//说明有密码
if (result && result.len() > 0) {
local sqlpasswd = result[0][0];
if (passwd == sqlpasswd) {
SUser.SendJso({
op = 21008002
});
SUser.SendNotiBox(" 验证成功 账号金库限制成功解除", 1);
}
else{
SUser.SendNotiBox(" 验证失败 请重新登录游戏以重试", 1);
}
}
}.bindenv(this));
}
}
Timer.SetTimeOut(function() {
getroottable()._WarehouseLock_ <- WarehouseLockC();
print("双端插件·仓库锁 - 已加载");
}, 1);

View File

@ -655,12 +655,6 @@ Cb_CCompound_ExtreamDun_Item_makeCompoundItem_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x0832CCC0", ["pointer", "pointer", "int", "pointer", "int", "int"],
Cb_CCompound_ExtreamDun_Item_makeCompoundItem_Enter_Func, Cb_CCompound_ExtreamDun_Item_makeCompoundItem_Leave_Func);
//队伍进入副本时
Cb_CParty_dungeon_start_Enter_Func <- {};
Cb_CParty_dungeon_start_Leave_Func <- {};
_Hook_Register_Currency_Func_("0x085A0954", ["pointer", "pointer", "char", "int", "int"],
Cb_CParty_dungeon_start_Enter_Func, Cb_CParty_dungeon_start_Leave_Func);
function _Hook_Register_Currency_DelayHook_() {
//五国时的热点函数

View File

@ -4,7 +4,7 @@
创建日期:2024-05-01 16:24
文件用途:服务端核心类
*/
Dps_Self_Ip <- "";
if (!getroottable().rawin("Dps_Self_Ip")) Dps_Self_Ip <- "";
function removeBackslashes(str) {
local result = "";
@ -95,7 +95,7 @@ class ServerControl {
//获得本服务器的IP
GatewaySocketPackFuncMap.rawset(10002, function(Jso) {
Dps_Self_Ip = Jso.myip;
getroottable().Dps_Self_Ip <- Jso.myip;
}.bindenv(this));