更新回调
This commit is contained in:
parent
a162ecee48
commit
153de52d6b
|
|
@ -129,27 +129,32 @@ Timer.SetTimeOut(function() {
|
|||
// local EnStr = _base64_encode(Byte);
|
||||
// print(EnStr);
|
||||
|
||||
local passwd = "1";
|
||||
|
||||
|
||||
// local passwd = "1";
|
||||
|
||||
// Sq_WriteByteArr(S_Ptr("0x081E907E"), [0x90, 0x90, 0x90, 0x90, 0x90]);
|
||||
// Sq_WriteByteArr(S_Ptr("0x0081E9085"), [0x0F, 0x94, 0xC0]);
|
||||
|
||||
// Sq_WriteByteArr(S_Ptr("0x81731F2"), Haker.AsmGenerateMcd(
|
||||
// "mov eax,0",
|
||||
// "ret" ));
|
||||
|
||||
}, 1);
|
||||
|
||||
|
||||
|
||||
// //玩家新增道具时
|
||||
// // //玩家新增道具时
|
||||
// Cb_wdzsdfge_Enter_Func <- {};
|
||||
// Cb_wdzsdfge_Leave_Func <- {};
|
||||
// _Hook_Register_Currency_Func_("0x81E8C78", ["pointer", "pointer", "pointer", "int"], Cb_wdzsdfge_Enter_Func, Cb_wdzsdfge_Leave_Func);
|
||||
// _Hook_Register_Currency_Func_("0x81731F2", ["pointer", "pointer", "pointer", "int"], Cb_wdzsdfge_Enter_Func, Cb_wdzsdfge_Leave_Func);
|
||||
|
||||
|
||||
|
||||
// Cb_wdzsdfge_Leave_Func["11"] <- function(args) {
|
||||
// local Ret = Sq_CallFunc(S_Ptr("0x816EE1E"), "pointer", ["pointer"], args[1]);
|
||||
// print("登录请求: ");
|
||||
// print("GarenaAuthData: " + Ret);
|
||||
// print("args[0]: " + args[0] + " args[1]: " + args[1]);
|
||||
// print("args[2]: ");
|
||||
// print("args[0]: " + args[0]);
|
||||
// NativePointer(args[0]).Output(512);
|
||||
// print("args[1]: " + args[1]);
|
||||
// //NativePointer(args[1]).Output(512);
|
||||
// print("args[2]: " + args[2]);
|
||||
// NativePointer(args[2]).Output(512);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
|
|||
|
|
@ -22,43 +22,129 @@ class _DPS_Login_Gateway_ {
|
|||
|
||||
}
|
||||
|
||||
PackHandleMap["/GetConfig"] <- function(SocketObject, Header, Msg) {
|
||||
PackHandleMap["/GetConfig"] <- function(SocketObject, Header, Jso) {
|
||||
local Config = sq_ReadJsonFile("/dp_s/OfficialConfig/登录器配置.json");
|
||||
//读取DPS登录器的配置并发送
|
||||
SocketObject.Write(Config);
|
||||
}
|
||||
|
||||
|
||||
PackHandleMap["/Login"] <- function(SocketObject, Header, Msg) {
|
||||
local Jso = Json.Decode(Msg);
|
||||
PackHandleMap["/Login"] <- function(SocketObject, Header, Jso) {
|
||||
if (!Jso.rawin("account")) return;
|
||||
if (!Jso.rawin("passwd")) return;
|
||||
local account = Jso.account;
|
||||
local passwd = Jso.passwd;
|
||||
local passwd_hash = MD5_Hash(passwd);
|
||||
|
||||
|
||||
//正则表达式 只允许字母和数字
|
||||
local regex = regexp("^[A-Za-z0-9]{1,19}$");
|
||||
if (!regex.match(account)) {
|
||||
SocketObject.Write({
|
||||
error = "账号只能包含字母和数字且长度小于20"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
local sql = format("select UID from d_taiwan.accounts where accountname='%s' and password='%s';", account, passwd_hash);
|
||||
local Ret = MysqlObject.Select(sql, ["int"]);
|
||||
if (Ret && Ret.len() > 0) {
|
||||
local Uid = Ret[0][0];
|
||||
local str = format("%08x010101010101010101010101010101010101010101010101010101010101010155914510010403030101", Uid);
|
||||
local Byte = Sq_Rsa_Private_Encrypt(str);
|
||||
local EnStr = _base64_encode(Byte);
|
||||
local EnStr = MD5.base64_encode(Byte);
|
||||
//发送登录Token
|
||||
SocketObject.Write({
|
||||
token = EnStr
|
||||
});
|
||||
} else {
|
||||
SocketObject.Write({
|
||||
error = 1
|
||||
error = "账号或密码错误!"
|
||||
});
|
||||
}
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
PackHandleMap["/Register"] <- function(SocketObject, Header, Jso) {
|
||||
|
||||
if (!Jso.rawin("account")) return;
|
||||
if (!Jso.rawin("passwd")) return;
|
||||
|
||||
local account = Jso.account;
|
||||
local passwd = Jso.passwd;
|
||||
|
||||
|
||||
//正则表达式 只允许字母和数字
|
||||
local regex = regexp("^[A-Za-z0-9]{1,19}$");
|
||||
if (account.len() == 0 || !regex.match(account)) {
|
||||
SocketObject.Write({
|
||||
error = "账号只能包含字母和数字且长度大于0小于20"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (passwd.len() == 0 || !regex.match(passwd)) {
|
||||
SocketObject.Write({
|
||||
error = "密码只能包含字母和数字且长度大于0小于20"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (GetAccountByName(account) != null) {
|
||||
SocketObject.Write({
|
||||
error = "账号已存在"
|
||||
})
|
||||
return;
|
||||
}
|
||||
local passwd_hash = MD5_Hash(passwd);
|
||||
|
||||
|
||||
local sql = format("INSERT INTO d_taiwan.accounts(accountname, password)VALUES( '%s' , '%s');", account, passwd_hash);
|
||||
MysqlObject.Exec_Sql(sql);
|
||||
local Ret = MysqlObject.Select("SELECT LAST_INSERT_ID()", ["int"]);
|
||||
if (Ret && Ret.len() > 0) {
|
||||
local Uid = Ret[0][0].tostring();
|
||||
MysqlObject.Exec_Sql(format("INSERT INTO d_taiwan.member_info(m_id, user_id)VALUES('%s','%s');", Uid, Uid));
|
||||
MysqlObject.Exec_Sql(format("INSERT INTO d_taiwan.member_white_account(m_id)VALUES('%s')", Uid));
|
||||
MysqlObject.Exec_Sql(format("INSERT INTO taiwan_login.member_login(m_id)VALUES('%s')", Uid));
|
||||
MysqlObject.Exec_Sql(format("INSERT INTO taiwan_billing.cash_cera(account, cera,mod_tran,mod_date, reg_date)VALUES('%s',0,0,NOW(), NOW())", Uid));
|
||||
MysqlObject.Exec_Sql(format("INSERT INTO taiwan_billing.cash_cera_point(account, cera_point,mod_date, reg_date)VALUES('%s',0,NOW(), NOW())", Uid));
|
||||
SocketObject.Write({
|
||||
success = "账号注册成功,现在您可以登录了!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function GetAccountByName(account) {
|
||||
local sql = format("select UID , accountname, password from d_taiwan.accounts where accountname='%s'", account);
|
||||
local Ret = MysqlObject.Select(sql, ["int", "string", "string"]);
|
||||
print(Ret);
|
||||
if (!Ret || Ret.len() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
uid = Ret[0][0],
|
||||
account = Ret[0][1],
|
||||
passwd = Ret[0][2]
|
||||
}
|
||||
}
|
||||
|
||||
function _HttpServer_Event_DPS_(SocketObject, Header, Msg) {
|
||||
if (PackHandleMap.rawin(Header.path)) {
|
||||
PackHandleMap[Header.path](SocketObject, Header, Msg);
|
||||
local Jso = null;
|
||||
try {
|
||||
Jso = Json.Decode(Msg);
|
||||
} catch (exception) {
|
||||
|
||||
}
|
||||
if (!Jso) return;
|
||||
PackHandleMap[Header.path](SocketObject, Header, Jso);
|
||||
|
||||
} else {
|
||||
SocketObject.Write({
|
||||
error = "error url"
|
||||
|
|
@ -66,15 +152,6 @@ class _DPS_Login_Gateway_ {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function MD5_Hash(str) {
|
||||
local Ctx = Memory.alloc(0x100);
|
||||
MD5.MD5_Init(Ctx.C_Object);
|
||||
|
|
|
|||
|
|
@ -699,6 +699,26 @@ Cb_ItemVendingMachine_ProcessIPG_ResultOutput_Leave_Func <- {};
|
|||
_Hook_Register_Currency_Func_("0x8178676", ["pointer", "pointer", "int", "int", "pointer", "int"], Cb_ItemVendingMachine_ProcessIPG_ResultOutput_Enter_Func, Cb_ItemVendingMachine_ProcessIPG_ResultOutput_Leave_Func);
|
||||
|
||||
|
||||
//商城购买道具收包
|
||||
Cb_ItemVendingMachine_BuyAuctionItem_Enter_Func <- {};
|
||||
Cb_ItemVendingMachine_BuyAuctionItem_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x81769f6", ["pointer", "pointer", "int", "pointer"], Cb_ItemVendingMachine_BuyAuctionItem_Enter_Func, Cb_ItemVendingMachine_BuyAuctionItem_Leave_Func);
|
||||
|
||||
|
||||
// 构建地图
|
||||
Cb_CBattle_Field_ConsistMap_Enter_Func <- {};
|
||||
Cb_CBattle_Field_ConsistMap_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x083031D2", ["pointer", "void"], Cb_CBattle_Field_ConsistMap_Enter_Func, Cb_CBattle_Field_ConsistMap_Leave_Func);
|
||||
// 击杀怪物时
|
||||
Cb_CBattle_Field_kill_monster_Enter_Func <- {};
|
||||
Cb_CBattle_Field_kill_monster_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x0830BC78", ["pointer", "pointer", "pointer", "pointer", "pointer", "int"], Cb_CBattle_Field_kill_monster_Enter_Func, Cb_CBattle_Field_kill_monster_Leave_Func);
|
||||
// 副本中角色死亡
|
||||
Cb_CParty_die_user_Enter_Func <- {};
|
||||
Cb_CParty_die_user_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x085A7828", ["pointer", "pointer", "void"], Cb_CParty_die_user_Enter_Func, Cb_CParty_die_user_Leave_Func);
|
||||
|
||||
|
||||
function _Hook_Register_Currency_DelayHook_() {
|
||||
//五国时的热点函数
|
||||
//获取Item Rarity
|
||||
|
|
|
|||
Loading…
Reference in New Issue