70 lines
2.7 KiB
Plaintext
70 lines
2.7 KiB
Plaintext
/*
|
|
文件名:月光定制收集图鉴.nut
|
|
路径:OfficialProject/月光定制收集图鉴/月光定制收集图鉴.nut
|
|
创建日期:2025-04-20 11:38
|
|
文件用途:
|
|
*/
|
|
|
|
getroottable()._MoonlightCustomizedCollectionCatalogMysql_ <- null;
|
|
|
|
function InitMysql() {
|
|
if (!getroottable()._MoonlightCustomizedCollectionCatalogMysql_) {
|
|
local Config = GlobalConfig.Get("装备镶嵌与时装镶嵌_Lenheart.json");
|
|
local Ip = Config["数据库IP 不是外置数据库不要更改"];
|
|
local Port = Config["数据库端口 不懂不要更改"];
|
|
local DbName = Config["数据库用户名 本地用户名不懂不要更改"];
|
|
local Password = Config["数据库密码 本地密码不懂不要更改"];
|
|
getroottable()._MoonlightCustomizedCollectionCatalogMysql_ = Mysql(Str_Ptr(Ip), Port, Str_Ptr("taiwan_cain"), Str_Ptr(DbName), Str_Ptr(Password));
|
|
}
|
|
}
|
|
|
|
function _Moonlight_collect_check(id) {
|
|
if (!getroottable()._MoonlightCustomizedCollectionCatalogMysql_) return;
|
|
local SqlObj = getroottable()._MoonlightCustomizedCollectionCatalogMysql_;
|
|
local CheckSql = "select id from `collect`.`s_item` where id = " + id + ";";
|
|
local Ret = SqlObj.Select(CheckSql, ["int"]);
|
|
if (Ret.len()< 1 || Ret[0][0] == null) {
|
|
return false;
|
|
} else {
|
|
return Ret[0][0];
|
|
}
|
|
}
|
|
|
|
function _Moonlight_collect_check_has(uid, item) {
|
|
if (!getroottable()._MoonlightCustomizedCollectionCatalogMysql_) return;
|
|
local SqlObj = getroottable()._MoonlightCustomizedCollectionCatalogMysql_;
|
|
local CheckSql = "select num from `collect`.`g_user_item` where uid = " + uid + " and item = " + item + ";";
|
|
local Ret = SqlObj.Select(CheckSql, ["int"]);
|
|
if (Ret.len()< 1 || Ret[0][0] == null) {
|
|
return false;
|
|
} else {
|
|
return Ret[0][0];
|
|
}
|
|
}
|
|
|
|
function _Moonlight_collect_update(uid, item, type, num) {
|
|
if (!getroottable()._MoonlightCustomizedCollectionCatalogMysql_) return;
|
|
local SqlObj = getroottable()._MoonlightCustomizedCollectionCatalogMysql_;
|
|
local CheckSql = "select id,num from `collect`.`g_user_item` where uid = " + uid + " and item = " + item + ";";
|
|
local Ret = SqlObj.Select(CheckSql, ["int", "int"]);
|
|
if (Ret.len()< 1 || Ret[0][0] == null) {
|
|
local InsertSql = "INSERT INTO `collect`.`g_user_item`(`uid`,`item`,`type`,`num`) VALUES(" + uid + "," + item + "," + type + "," + num + ");";
|
|
SqlObj.Exec_Sql(InsertSql);
|
|
} else {
|
|
local id = Ret[0][0]
|
|
local num = Ret[0][1];
|
|
local UpdateSql = "update `collect`.`g_user_item` set num = ' + num + ' where id = ' + id + ';";
|
|
SqlObj.Exec_Sql(UpdateSql);
|
|
}
|
|
}
|
|
|
|
|
|
function _Moonlight_collect_equ(user,slot)
|
|
{
|
|
// local inven =
|
|
}
|
|
|
|
|
|
function _Dps_MoonlightCustomizedCollectionCatalog_Main_() {
|
|
InitMysql();
|
|
} |