69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
CeraCardCoolT <- {};
|
|
|
|
function handleCeraCardBynangua(SUser, ItemId) {
|
|
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
|
local ItemIdStr = ItemId.tostring();
|
|
local UseCount = 0;
|
|
|
|
|
|
if (!CeraCardCoolT.rawin(SUser.GetUID())) {
|
|
CeraCardCoolT.rawset(SUser.GetUID(), 0);
|
|
} else {
|
|
UseCount = CeraCardCoolT.rawget(SUser.GetUID());
|
|
}
|
|
if (UseCount >= 30) {
|
|
if (Config["启用233发包(true/false)"]) {
|
|
SUser.SendNotiBox("点券充值卡已达到本日使用上限!", 1);
|
|
} else {
|
|
SUser.SendNotiPacketMessage("点券充值卡已达到本日使用上限!", 8);
|
|
}
|
|
}
|
|
|
|
if (Config["充值卡配置"].rawin(ItemIdStr)) {
|
|
local CeraAmount = Config["充值卡配置"][ItemIdStr];
|
|
SUser.RechargeCera(CeraAmount);
|
|
if (Config["启用233发包(true/false)"]) {
|
|
SUser.SendNotiBox(format(Config["充值成功提示"], CeraAmount), 1);
|
|
SUser.SendNotiBox(format("充值卡本日已使用次数%d / 30", UseCount + 1), 1);
|
|
} else {
|
|
SUser.SendNotiPacketMessage(format(Config["充值成功提示"], CeraAmount), 8);
|
|
SUser.SendNotiPacketMessage(format("充值卡本日已使用次数%d / 30", UseCount + 1), 8);
|
|
}
|
|
}
|
|
|
|
CeraCardCoolT.rawset(SUser.GetUID(), UseCount + 1);
|
|
}
|
|
|
|
//加载入口
|
|
function _Dps_handleCeraCard_Main_() {
|
|
_Dps_handleCeraCard_Logic_();
|
|
|
|
|
|
Timer.SetCronTask(function() {
|
|
getroottable().CeraCardCoolT = {};
|
|
}, {
|
|
Cron = "0 0 6 * * *",
|
|
Name = "刷新点卷充值卡每日限额"
|
|
});
|
|
}
|
|
|
|
//重载入口
|
|
function _Dps_handleCeraCard_Main_Reload_(OldConfig) {
|
|
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
|
// 删除旧的注册
|
|
foreach(itemId, _ in OldConfig["充值卡配置"]) {
|
|
Cb_Use_Item_Sp_Func.rawdelete(itemId.tointeger());
|
|
}
|
|
//重新注册
|
|
_Dps_handleCeraCard_Logic_();
|
|
}
|
|
|
|
function _Dps_handleCeraCard_Logic_() {
|
|
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
|
// 注册所有充值卡
|
|
foreach(itemId, _ in Config["充值卡配置"]) {
|
|
Cb_Use_Item_Sp_Func[itemId.tointeger()] <- handleCeraCardBynangua;
|
|
}
|
|
}
|
|
|