保存标准
This commit is contained in:
11
OfficialProject/点券充值卡/Proj.ifo
Normal file
11
OfficialProject/点券充值卡/Proj.ifo
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ProjectName": "点券充值卡",
|
||||
"ProjectDescribe": "根据道具ID充值对应的点券数量",
|
||||
"ProjectAuthor": "南瓜",
|
||||
"ProjectVersion": 1.0,
|
||||
"ProjectConfig": "点券充值卡配置_Nangua.json",
|
||||
"ProjectFiles": [
|
||||
"点券充值卡.nut"
|
||||
],
|
||||
"ProjectRunFunc": "_Dps_handleCeraCard_Main_"
|
||||
}
|
||||
68
OfficialProject/点券充值卡/点券充值卡.nut
Normal file
68
OfficialProject/点券充值卡/点券充值卡.nut
Normal file
@@ -0,0 +1,68 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user