318 lines
9.4 KiB
Lua
318 lines
9.4 KiB
Lua
FuLiDaTingOBJ = Up_BaseClass:new()
|
||
FuLiDaTingOBJ._name = "FuLiDaTingOBJ"
|
||
|
||
-- 配置文件
|
||
FuLiDaTingOBJ.cfg = {
|
||
[1] = {
|
||
xh = { { "元宝", 1680, 1 } },
|
||
gives = Func.require("cfg_王者特权奖励"),
|
||
},
|
||
[2] = {
|
||
{ "神兽之精", 2, 819 },
|
||
{ "神兽之丹", 2, 819 },
|
||
{ "天命石", 2, 819 },
|
||
{ "荣誉会员", 1, 819 },
|
||
},
|
||
[3] = Func.require("cfg_每日限购"),
|
||
[4] = Func.require("cfg_福利大厅装备回收"),
|
||
[5] = Func.require("cfg_装备首爆"),
|
||
[6] = Func.require("cfg_BOSS首杀"),
|
||
[7] = Func.require("cfg_成长基金"),
|
||
[8] = Func.require("cfg_福利大厅_累充奖励"),
|
||
-- [7] = "CDK兑换",
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
local function FuLiDaTingOBJ_for()
|
||
local sb_name = {}
|
||
local boss_list = {}
|
||
for i, v in ipairs(FuLiDaTingOBJ.cfg[5]) do
|
||
sb_name[v.name] = {}
|
||
sb_name[v.name].index = i
|
||
sb_name[v.name].money = v.money
|
||
end
|
||
|
||
for i, v in ipairs(FuLiDaTingOBJ.cfg[6] or {}) do
|
||
boss_list[v.name] = {
|
||
index = i,
|
||
cfg = v,
|
||
}
|
||
end
|
||
return sb_name, boss_list
|
||
end
|
||
|
||
|
||
FuLiDaTingOBJ.Qzsb, FuLiDaTingOBJ.bosslist = FuLiDaTingOBJ_for()
|
||
|
||
|
||
|
||
---* 加入上线同步数据
|
||
Player.sycCfg[FuLiDaTingOBJ._name] = FuLiDaTingOBJ.cfg
|
||
|
||
function FuLiDaTingOBJ:main(page)
|
||
local data = {}
|
||
data.page = page
|
||
Message:SubLink(actor, self._name .. "_main", data)
|
||
end
|
||
|
||
---* 每日充值领取
|
||
function FuLiDaTingOBJ:mrcz(actor, p1, p2, p3, data)
|
||
local _falg = Player.getTLint(actor, VarCfg.Player.TL.int["每日充值领取"]) or 0
|
||
if _falg > 0 then
|
||
Func.sendmsg9(actor, "您已领取过了哦!")
|
||
return
|
||
end
|
||
|
||
local meiri_money = Player.getTLint(actor, VarCfg.Player.TL.int["每日充值"]) or 0
|
||
if meiri_money < 18 then
|
||
Func.sendmsg9(actor, "您今日充值未达18元!")
|
||
return
|
||
end
|
||
|
||
local cfg = {}
|
||
for i, v in ipairs(self.cfg[2]) do
|
||
if v[1] ~= "荣誉会员" then
|
||
table.insert(cfg, v)
|
||
end
|
||
end
|
||
Func.mailitem(actor, cfg, "每日充值")
|
||
if checktitle(actor, "荣誉会员") then
|
||
deprivetitle(actor, "荣誉会员")
|
||
end
|
||
if confertitle(actor, "荣誉会员", 0) then
|
||
local now = os.date("*t")
|
||
local next_day = {
|
||
year = now.year,
|
||
month = now.month,
|
||
day = now.day + 1,
|
||
hour = 0,
|
||
min = 0,
|
||
sec = 0
|
||
}
|
||
local tomorrow_midnight = os.time(next_day)
|
||
changetitletime(actor, "荣誉会员", "=", tomorrow_midnight)
|
||
Player.setTLint(actor, VarCfg.Player.TL.int["每日充值领取"], 1)
|
||
end
|
||
end
|
||
|
||
---* 每日限购
|
||
function FuLiDaTingOBJ:mrxg(actor, p1, p2, p3, data)
|
||
local id = data[1].id
|
||
|
||
if not data or not id then
|
||
return
|
||
end
|
||
|
||
local buy_num = Player.getkeycount(actor, VarCfg.Player.TL.str["每日限购"], id, "LT") or 0
|
||
local cfg = self.cfg[3][id]
|
||
if buy_num >= cfg.limitbuy then
|
||
return Func.sendmsg9(actor, "[每日限购]:#70|您今日购买次数已满!")
|
||
end
|
||
if Func.takeitmes(actor, cfg.xh, true, true) then
|
||
Func.mailitem(actor, cfg.gives, "每日限购")
|
||
Player.setkeycount(actor, VarCfg.Player.TL.str["每日限购"], id, buy_num + 1, "LT")
|
||
end
|
||
end
|
||
|
||
---* 王者特权
|
||
function FuLiDaTingOBJ:wztq(actor)
|
||
local open = getflagstatus(actor, VarCfg.Falg_tequan) or 0
|
||
if open > 0 then
|
||
return Func.sendmsg9(actor, "您已开通特权!")
|
||
end
|
||
local cfg = self.cfg[1]
|
||
if not cfg then
|
||
return
|
||
end
|
||
|
||
local gives = {}
|
||
for i, v in ipairs(cfg.gives) do
|
||
table.insert(gives, { v.name, v.num, v.bind })
|
||
end
|
||
|
||
if Func.takeitmes(actor, cfg.xh, true, true) then
|
||
Func.mailitem(actor, gives, "开通王者特权")
|
||
setflagstatus(actor, VarCfg.Falg_tequan, 1)
|
||
Player.confertitle(actor, "王者特权", 0)
|
||
sendmsgnew(actor, 251, 0,
|
||
string.format("<[王者特权]/FCOLOR=70>恭喜<[%s]/FCOLOR=249>成功开启<王者特权/FCOLOR=215>", Player.getname(actor)), 1, 3)
|
||
end
|
||
end
|
||
|
||
---* 开通成长基金
|
||
function FuLiDaTingOBJ:czjjbuy(actor)
|
||
if getflagstatus(actor, VarCfg.Falg_ChengZhang) > 0 then
|
||
return Func.sendmsg9(actor, "您已开通成长基金!")
|
||
end
|
||
local _money = querymoney(actor, ConstCfg.sysMoney["元宝"])
|
||
if _money >= 2880 then
|
||
changemoney(actor, ConstCfg.sysMoney["元宝"], "-" ,2880,"开通成长基金",true)
|
||
setflagstatus(actor, VarCfg.Falg_ChengZhang, 1)
|
||
Func.mailitem(actor, self.cfg[7][1].gives, "成长基金")
|
||
sendmsgnew(actor, 251, 0,
|
||
string.format("<[成长基金]/FCOLOR=70>恭喜<[%s]/FCOLOR=249>成功开启<成长基金/FCOLOR=215>", Player.getname(actor)), 1, 3)
|
||
else
|
||
Func.sendmsg9(actor, "您的元宝不足2880!#215|")
|
||
end
|
||
end
|
||
|
||
|
||
|
||
---* 领取成长基金
|
||
function FuLiDaTingOBJ:czjj(actor, p1, p2, p3, data)
|
||
local id = data[1].id
|
||
if not data or not id then
|
||
return
|
||
end
|
||
|
||
if getflagstatus(actor, VarCfg.Falg_ChengZhang) == 0 then
|
||
Func.sendmsg9(actor, "您未开通成长基金!")
|
||
return
|
||
end
|
||
|
||
local open = Player.getkeycount(actor, VarCfg.Player.str["成长基金"], id) or 0
|
||
if open > 0 then
|
||
return Func.sendmsg9(actor, "[成长基金]:#70|您已领取过该档位!")
|
||
end
|
||
|
||
local cfg = self.cfg[7][id]
|
||
if Func.checkcontion(actor, cfg.check, true, true) then
|
||
Func.mailitem(actor, cfg.gives, "成长基金")
|
||
Player.setkeycount(actor, VarCfg.Player.str["成长基金"], id, 1)
|
||
end
|
||
end
|
||
|
||
---* 累充奖励领取
|
||
function FuLiDaTingOBJ:lcjl(actor, p1, p2, p3, data)
|
||
local id = data[1].id
|
||
if not data or not id then
|
||
return
|
||
end
|
||
|
||
local cfg = self.cfg[8][id]
|
||
if not cfg then
|
||
return Func.sendmsg9(actor, "[累充奖励]:#70|配置不存在!")
|
||
end
|
||
|
||
---* 检查是否已领取
|
||
local claimed = Player.getkeycount(actor, VarCfg.Player.str["累充奖励"], id) or 0
|
||
if claimed > 0 then
|
||
return Func.sendmsg9(actor, "[累充奖励]:#70|该档位已领取!")
|
||
end
|
||
|
||
---* 检查累计充值是否达标
|
||
local totalRecharge = querymoney(actor, ConstCfg.sysMoney["累计充值"])
|
||
if totalRecharge < cfg.price then
|
||
return Func.sendmsg9(actor, string.format("[累充奖励]:#70|累计充值需达到#251|%d元#215|才可领取!", cfg.price))
|
||
end
|
||
|
||
---* 发放奖励
|
||
local gives = {}
|
||
for _, v in ipairs(cfg.gives) do
|
||
table.insert(gives, { v[1], v[2], v[3] })
|
||
end
|
||
Func.mailitem(actor, gives, "累充奖励")
|
||
Player.setkeycount(actor, VarCfg.Player.str["累充奖励"], id, 1)
|
||
sendmsgnew(actor, 251, 0,
|
||
string.format("<[累充奖励]/FCOLOR=70>恭喜<[%s]/FCOLOR=249>累计充值达<[%d元]/FCOLOR=250>,领取累充奖励!", Player.getname(actor),
|
||
cfg.price), 1, 3)
|
||
end
|
||
|
||
---* 装备回收
|
||
|
||
function FuLiDaTingOBJ:recycle(actor, p1, p2, p3, data)
|
||
local id = data[1].id
|
||
if not data or not id then
|
||
return
|
||
end
|
||
|
||
local cfg = self.cfg[4][id]
|
||
if not cfg then
|
||
return
|
||
end
|
||
|
||
local num = Sys.getkeycount(VarCfg.sys.str["福利回收"], id) or 0
|
||
if num >= cfg.num then
|
||
return Func.sendmsg9(actor, "[装备回收]:#70|回收名额已满!")
|
||
end
|
||
|
||
local xh = {
|
||
{ cfg.name, 1, 0 }
|
||
}
|
||
if Func.takeitmes(actor, xh, true, true) then
|
||
Func.mailitem(actor, cfg.gives, "福利大厅装备回收")
|
||
Sys.setkeycount(VarCfg.sys.str["福利回收"], id, num + 1)
|
||
end
|
||
end
|
||
|
||
local function FuLiDaTingOBJ_addbag(actor, itemMakeIndex, itemIndex, Info)
|
||
local _falg = Item.getint(itemMakeIndex, VarCfg.item.int["首爆标识"]) or 0
|
||
if _falg > 0 then
|
||
return
|
||
end
|
||
|
||
if not FuLiDaTingOBJ.Qzsb[Info.name] then
|
||
return
|
||
end
|
||
|
||
local cfg = FuLiDaTingOBJ.Qzsb[Info.name]
|
||
|
||
|
||
local _b = Sys.getkeycount(VarCfg.sys.str["全区首爆"], cfg.index) or nil
|
||
if _b ~= nil then
|
||
return
|
||
else
|
||
Item.setint(itemMakeIndex, VarCfg.item.int["首爆标识"], 1)
|
||
Player.addint(actor, VarCfg.Player.int["首爆统计"], cfg.money)
|
||
Func.mailitem(actor, { { "绑定元宝", cfg.money, 0 } }, Info.name .. "-全区首爆")
|
||
Sys.setkeycount(VarCfg.sys.str["全区首爆"], cfg.index, Info.player)
|
||
sendmovemsg(actor, 0, 251, 0, 60, 1,
|
||
string.format("<[全服首爆]:/FCOLOR=70>恭喜玩家<【%s】/FCOLOR=249>打到<【%s】/FCOLOR=215>奖励,获得%d元宝!", Info.player, Info
|
||
.name, cfg.money))
|
||
end
|
||
end
|
||
GameEvent.add(EventCfg.onAddBag, FuLiDaTingOBJ_addbag, FuLiDaTingOBJ)
|
||
|
||
|
||
|
||
|
||
----* BOSS首杀
|
||
local function _boss_shousha(actor, mon, itype, kill, monName, mapID)
|
||
|
||
if FuLiDaTingOBJ.bosslist[monName] then
|
||
local cfg = FuLiDaTingOBJ.bosslist[monName]
|
||
|
||
if monName == "迷宫之主" and string.find(mapID,"先天秘境",1,true) ~= nil then
|
||
mapID = "先天秘境"
|
||
end
|
||
|
||
if cfg and mapID == cfg.cfg.map then
|
||
local _falg = Sys.getkeycount(VarCfg.sys.str["BOSS击杀"], cfg.index) or nil
|
||
if not _falg then
|
||
|
||
local PlayerName = Player.getname(actor)
|
||
Sys.setkeycount(VarCfg.sys.str["BOSS击杀"], cfg.index, PlayerName)
|
||
Func.mailitem(actor, cfg.cfg.gives, "BOSS首杀-" .. monName)
|
||
|
||
local gives = {}
|
||
for i, v in ipairs(cfg.cfg.gives) do
|
||
table.insert(gives, string.format("%sx%d", v[1], v[2]))
|
||
end
|
||
|
||
sendmsgnew(actor, 251, 0,
|
||
string.format("<[BOSS首杀]/FCOLOR=70>恭喜<%s/FCOLOR=253>成功击杀<%s/FCOLOR=215>,获得奖励:<%s/FCOLOR=254>",
|
||
PlayerName,
|
||
monName, table.concat(gives)), 1, 3)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
GameEvent.add(EventCfg.onKillMon, _boss_shousha, FuLiDaTingOBJ)
|
||
|
||
|
||
|
||
FuLiDaTingOBJ.allowFunc = {"main", "mrcz", "mrxg", "wztq", "czjjbuy", "czjj", "lcjl", "recycle"}
|
||
return FuLiDaTingOBJ
|