|
|
@@ -150,9 +150,87 @@ function get(human,index,type,id)
|
|
|
initDB(human,id)
|
|
|
|
|
|
local nowDay = Util.diffDay(starTime) + 1
|
|
|
+ local allItems = {} -- 用于批量领取时收集所有奖励
|
|
|
+
|
|
|
+ -- 如果index为0或nil,则批量领取该type下所有可领取的奖励
|
|
|
+ if not index or index == 0 then
|
|
|
+ local hasReward = false
|
|
|
+
|
|
|
+ if type == 1 then
|
|
|
+ -- 福袋任务:遍历所有drum任务,领取状态为1的
|
|
|
+ local taskConfig = AbsActExcel.drum
|
|
|
+ for i = 1, #taskConfig do
|
|
|
+ local v = taskConfig[i]
|
|
|
+ if v.day == nowDay then
|
|
|
+ local taskState = absAct.drum[i] and absAct.drum[i].state or 0
|
|
|
+ if taskState == 1 then
|
|
|
+ hasReward = true
|
|
|
+ -- 收集奖励
|
|
|
+ for j = 1, #v.item do
|
|
|
+ table.insert(allItems, v.item[j])
|
|
|
+ end
|
|
|
+ -- 更新状态
|
|
|
+ absAct.drum[i].state = 2
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+ elseif type == 2 then
|
|
|
+ -- 礼炮奖励:遍历所有blasting,领取状态为1的
|
|
|
+ local taskConfig = AbsActExcel.blasting
|
|
|
+ for i = 1, #taskConfig do
|
|
|
+ local v = taskConfig[i]
|
|
|
+ local blastingState = absAct.blasting[i] and absAct.blasting[i].state or 0
|
|
|
+ if blastingState == 1 then
|
|
|
+ hasReward = true
|
|
|
+ -- 收集奖励
|
|
|
+ local itemLen = type(v.item[nowDay]) == "table" and #v.item[nowDay] or 0
|
|
|
+ for j = 1, itemLen do
|
|
|
+ table.insert(allItems, v.item[nowDay][j])
|
|
|
+ end
|
|
|
+ -- 更新状态
|
|
|
+ absAct.blasting[i].state = 2
|
|
|
+ -- 增加一次,累计放炮次数,判断是否达到进度奖励领取值
|
|
|
+ absAct.blastingCnt = absAct.blastingCnt + 1
|
|
|
+ for j = 1, #AbsActExcel.blastingBox do
|
|
|
+ if absAct.blastingCnt - 1 < AbsActExcel.blastingBox[j].needCnt and absAct.blastingCnt == AbsActExcel.blastingBox[j].needCnt then
|
|
|
+ absAct.box[j] = 1
|
|
|
+ break
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+ elseif type == 3 then
|
|
|
+ -- 进度奖励:遍历所有box,领取状态为1的
|
|
|
+ local taskConfig = AbsActExcel.blastingBox
|
|
|
+ for i = 1, #taskConfig do
|
|
|
+ local v = taskConfig[i]
|
|
|
+ local boxState = absAct.box[i] or 0
|
|
|
+ if boxState == 1 then
|
|
|
+ hasReward = true
|
|
|
+ -- 收集奖励
|
|
|
+ for j = 1, #v.item do
|
|
|
+ table.insert(allItems, v.item[j])
|
|
|
+ end
|
|
|
+ -- 更新状态
|
|
|
+ absAct.box[i] = 2
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 如果有奖励,则发放
|
|
|
+ if hasReward and #allItems > 0 then
|
|
|
+ BagLogic.addItemList(human, allItems, "abs_drumblasting")
|
|
|
+ getAndSendMsg(human, id, absConfig.actID)
|
|
|
+ YunYingLogic.sendBanner(human)
|
|
|
+ YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
|
|
|
+ end
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 原有逻辑:单个领取
|
|
|
local item = nil
|
|
|
|
|
|
- -- 选锟斤拷锟接︼拷锟斤拷锟�
|
|
|
+ -- 选锟斤拷锟接︼拷锟斤拷锟?
|
|
|
local config = nil
|
|
|
local state = nil
|
|
|
if type == 1 then
|
|
|
@@ -166,7 +244,7 @@ function get(human,index,type,id)
|
|
|
state = absAct.box[index] or 0
|
|
|
end
|
|
|
|
|
|
- -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
|
|
|
+ -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟?
|
|
|
if not config then
|
|
|
return
|
|
|
end
|
|
|
@@ -183,7 +261,7 @@ function get(human,index,type,id)
|
|
|
elseif type == 2 then
|
|
|
item = config.item[nowDay]
|
|
|
absAct.blasting[index].state = 2
|
|
|
- -- 锟斤拷锟斤拷一锟斤拷,锟斤拷锟斤拷锟桔计达拷锟斤拷锟斤拷锟斤拷锟叫讹拷锟角凤拷锏斤拷锟斤拷锟斤拷锟饺★拷锟街�
|
|
|
+ -- 锟斤拷锟斤拷一锟斤拷,锟斤拷锟斤拷锟桔计达拷锟斤拷锟斤拷锟斤拷锟叫讹拷锟角凤拷锏斤拷锟斤拷锟斤拷锟饺★拷锟街?
|
|
|
absAct.blastingCnt = absAct.blastingCnt + 1
|
|
|
for i = 1,#AbsActExcel.blastingBox do
|
|
|
if absAct.blastingCnt - 1 < AbsActExcel.blastingBox[i].needCnt and absAct.blastingCnt == AbsActExcel.blastingBox[i].needCnt then
|
|
|
@@ -199,13 +277,13 @@ function get(human,index,type,id)
|
|
|
end
|
|
|
|
|
|
BagLogic.addItemList(human, item, "abs_drumblasting")
|
|
|
- getAndSendMsg(human,id,actID)
|
|
|
+ getAndSendMsg(human,id,absConfig.actID)
|
|
|
|
|
|
YunYingLogic.sendBanner(human)
|
|
|
YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
|
|
|
end
|
|
|
|
|
|
--- 每锟斤拷锟斤拷锟斤拷锟皆撅拷锟�
|
|
|
+-- 每锟斤拷锟斤拷锟斤拷锟皆撅拷锟?
|
|
|
function onDailyTask(human,funcID, parameter)
|
|
|
drumTaskCallBack(human,funcID,1,parameter)
|
|
|
end
|
|
|
@@ -241,7 +319,7 @@ function onJjcFight(human,funcID, parameter)
|
|
|
drumTaskCallBack(human,funcID,7,parameter)
|
|
|
end
|
|
|
|
|
|
--- 锟斤拷锟斤拷痰旯猴拷锟�
|
|
|
+-- 锟斤拷锟斤拷痰旯猴拷锟?
|
|
|
function onShopBuy(human,funcID,parameter)
|
|
|
drumTaskCallBack(human,funcID,8,parameter)
|
|
|
end
|
|
|
@@ -256,7 +334,7 @@ function onBinglong(human,funcID,parameter)
|
|
|
drumTaskCallBack(human,funcID,10,parameter)
|
|
|
end
|
|
|
|
|
|
--- 锟斤拷锟�
|
|
|
+-- 锟斤拷锟?
|
|
|
function onExchangeJinbi(human,funcID,parameter)
|
|
|
drumTaskCallBack(human,funcID,11,parameter)
|
|
|
end
|
|
|
@@ -278,7 +356,7 @@ end
|
|
|
|
|
|
-- 占锟斤拷
|
|
|
function onZhanBuBuyCard(human,funcID,parameter)
|
|
|
- -- ZhanbuLogic.lua 436琛� 浼犵殑鏁板€间负璐�, 涓嶇煡閬撳摢涓�洃鍚��浜嬩欢鐨勫湴鏂归渶瑕佹暟鍊间负璐燂紝鎵€浠ュ彧澶勭悊褰撳墠妯″潡
|
|
|
+ -- ZhanbuLogic.lua 436琛? 浼犵殑鏁板€间负璐?, 涓嶇煡閬撳摢涓?鐩戝惉璇ヤ簨浠剁殑鍦版柟闇€瑕佹暟鍊间负璐燂紝鎵€浠ュ彧澶勭悊褰撳墠妯″潡
|
|
|
if parameter < 0 then
|
|
|
return
|
|
|
end
|
|
|
@@ -308,7 +386,7 @@ function drumTaskCallBack(human,id,type,cnt)
|
|
|
|
|
|
|
|
|
local state, endTime, starTime = AbsActLogic.isStarted(human, id)
|
|
|
- -- 娲诲嫊鏈�枊鍟�
|
|
|
+ -- 娲诲嫊鏈?闁嬪晸
|
|
|
if not state or os.time() > endTime then
|
|
|
return
|
|
|
end
|
|
|
@@ -378,11 +456,11 @@ function updateDaily(human,id)
|
|
|
human.db.absAct[id] = absAct
|
|
|
end
|
|
|
|
|
|
- -- 鍥犱负鐜╁�鍦ㄦ椿鍔ㄦ湭寮€鍚�墠瀹屾垚浜嗘椿璺冨害浠诲姟锛屾椿鍔ㄥ紑鍚�悗娌℃硶瀹屾垚娲昏穬搴︿换鍔�,鎵€浠ュ湪鐜╁�涓婄嚎鏃�,鍋氫竴娆℃洿鏂版椿璺冨害鏁版嵁鎿嶄綔
|
|
|
+ -- 鍥犱负鐜╁?跺湪娲诲姩鏈?寮€鍚?鍓嶅畬鎴愪簡娲昏穬搴︿换鍔★紝娲诲姩寮€鍚?鍚庢病娉曞畬鎴愭椿璺冨害浠诲姟,鎵€浠ュ湪鐜╁?朵笂绾挎椂,鍋氫竴娆℃洿鏂版椿璺冨害鏁版嵁鎿嶄綔
|
|
|
function specialFunc(human, id)
|
|
|
AbsActLogic.checkAbsActClean(human, id)
|
|
|
local state, endTime, starTime = AbsActLogic.isStarted(human, id)
|
|
|
- -- 娲诲嫊鏈�枊鍟�
|
|
|
+ -- 娲诲嫊鏈?闁嬪晸
|
|
|
if not state or os.time() > endTime then
|
|
|
return
|
|
|
end
|