Commit 1a31fdc6b3f3708116dcc8a5b4923762854d33c9

Authored by zhouhaihai
2 parents c1af8329 89760dbe

Merge branch 'develop' into tr/publish

* develop:
  拆解室功能重写
  世界Boss 增加行动点
  世界boss翻牌奖励 活动卡池保底单独记录
src/GlobalVar.lua
... ... @@ -134,7 +134,6 @@ ItemId = {
134 134 RuneFragment = 24,
135 135 HeroFC = {700, 701, 702, 703}, --通用角色碎片
136 136 AdvKey = 80, -- 冒险钥匙
137   - BoxKey = 60, -- 拆解工具
138 137 AdvPower = 4701, -- 拾荒体力
139 138 CrisisScore = 8010, -- 积分
140 139 }
... ...
src/actions/ActivityAction.lua
... ... @@ -703,6 +703,10 @@ function _M.endBattleRpc(agent, data)
703 703 role:checkStoryStatus(false, 5, id)
704 704 end
705 705  
  706 + if battleCfg.worldBoss_award ~= 0 and msg.point then
  707 + battleInfo["bossP"] = (battleInfo["bossP"] or 0) + msg.point
  708 + end
  709 +
706 710 reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}})
707 711  
708 712 SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({
... ... @@ -815,11 +819,42 @@ function _M.bossRewardRpc(agent, data)
815 819 local battleCfg = actCfg[id]
816 820 if not battleCfg then return 3 end
817 821  
818   - if battleCfg.boss_reward_id == 0 then return 4 end
  822 + if battleCfg.worldBoss_award == 0 then return 4 end
  823 +
  824 + actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award]
  825 + if not actCfg then return 5 end
  826 + local awardCfg = actCfg[index]
  827 + if not awardCfg then return 6 end
  828 +
  829 + local preList = awardCfg.condition1:toArray(true, "=")
  830 +
  831 + local actData = role.activity:getActData("ChallengeLevel") or {}
  832 + local battleInfo = actData[id] or {}
  833 + local bossPoint = battleInfo["bossP"] or 0
  834 + if bossPoint < 1 then return 7 end
  835 +
  836 + local bossRecord = battleInfo["bossR"] or ""
  837 + local ok = false
  838 + if #preList == 0 then
  839 + ok = true
  840 + else
  841 + for _, i in ipairs(preList) do
  842 + local flag = string.char(string.getbit(bossRecord, i))
  843 + if flag == "1" then
  844 + ok = true
  845 + break
  846 + end
  847 + end
  848 + end
  849 + if not ok then return 8 end
  850 +
  851 + battleInfo["bossR"] = string.setbit(bossRecord, index)
  852 + actData[id] = battleInfo
  853 + role.activity:updateActData("ChallengeLevel", actData)
819 854  
820   - --local award = mileCfg.reward:toNumMap()
821   - --local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}})
822   - --SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change)))
  855 + local award = awardCfg.reward:toNumMap()
  856 + local reward, change = role:award(award, {log = {desc = "worldBossReward", int1 = actid, int2 = index}})
  857 + SendPacket(actionCodes.Activity_bossRewardRpc, MsgPack.pack(role:packReward(reward, change)))
823 858 return true
824 859 end
825 860  
... ...
src/actions/HeroAction.lua
... ... @@ -727,7 +727,7 @@ function _M.drawHeroRpc(agent, data)
727 727 end
728 728 end
729 729  
730   - -- 活动卡池
  730 + -- 另开活动卡池
731 731 if actid then
732 732 if not role.activity:isOpenById(actid, "ActHeroPool") then return end
733 733 local cfg = csvdb["activity_ctrlCsv"][actid]
... ... @@ -974,11 +974,16 @@ function _M.drawHeroRpc(agent, data)
974 974 })
975 975 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
976 976  
977   - if (buildTypeData["can_feedback"] or 0) == 1 then
  977 + local feedbackId = buildTypeData["can_feedback"] or 0
  978 + if feedbackId ~= 0 then
978 979 -- 达到一定次数,给响应奖励
979 980 local oldVal = role:getProperty("repayHero") or 0
  981 + if actid then
  982 + local actData = role.activity:getActData("ActHeroPool")
  983 + oldVal = actData[btype] or 0
  984 + end
980 985 local newVal = oldVal + drawCount[drawType]
981   - local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal)
  986 + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal)
982 987 -- 空字符穿代表直接给英雄 走以前repayHeroRpc
983 988 if drawCardReward == "" then
984 989 local repayHeroMaxCount = role:getProperty("repayMaxC") or 0
... ... @@ -992,7 +997,7 @@ function _M.drawHeroRpc(agent, data)
992 997 else
993 998 local giftHeroSet = {}
994 999 for gid, cfg in pairs(csvdb["build_giftCsv"]) do
995   - if cfg["pool_1"] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then
  1000 + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then
996 1001 giftHeroSet[gid] = {1}
997 1002 end
998 1003 end
... ... @@ -1021,7 +1026,13 @@ function _M.drawHeroRpc(agent, data)
1021 1026 r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}})
1022 1027 SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change)))
1023 1028 end
1024   - role:updateProperty({field = "repayHero", value = val})
  1029 + if not actid then
  1030 + role:updateProperty({field = "repayHero", value = val})
  1031 + else
  1032 + local actData = role.activity:getActData("ActHeroPool")
  1033 + actData[btype] = val
  1034 + role.activity:updateActData("ActHeroPool", actData)
  1035 + end
1025 1036 end
1026 1037 return true
1027 1038 end
... ...
src/actions/RoleAction.lua
... ... @@ -537,82 +537,129 @@ function _M.openTimeBoxRpc(agent, data)
537 537 local slot = msg.slot -- 位置 1 - 6
538 538  
539 539 -- 特权卡时间箱额外栏位
540   - local privExtraCnt = role.storeData:getTimeBoxSlotExtraCount()
541   - if oper == 1 then
542   - if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot) + privExtraCnt) then return end
543   - end
  540 + -- local privExtraCnt = role.storeData:getTimeBoxSlotExtraCount()
  541 + -- if oper == 1 then
  542 + -- if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot) + privExtraCnt) then return end
  543 + -- end
544 544  
545 545 local boxL = role:getProperty("boxL")
546   - local reward, change = {}
547   - if oper == 1 then -- 打开
  546 + local reward, change
  547 + if oper == 1 then -- 构建开始(包括切换构建的id)
548 548 local itemId = msg.itemId
549   - if role:getItemCount(itemId) < 1 then return end
550 549 local itemData = csvdb["itemCsv"][itemId]
551   - local randomData = csvdb["item_randomCsv"][itemId]
552   - if not itemData or not randomData or randomData.openTime <= 0 then return end
553   -
554   - if boxL[slot] then return end
555   - role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}})
556   - boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime}
557   - role:pushMsg({type = "box", slot = slot, time = randomData.openTime})
558   - elseif oper == 2 then -- 领取
  550 + if not itemData then return 1 end
  551 + if not boxL[slot] then
  552 + boxL[slot] = {}
  553 + else
  554 + local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time
  555 + local unitTime = globalCsv.box_key_time[oldId] * 60
  556 + local doneCnt = math.floor((process + skynet.timex() - time) / unitTime)
  557 + if doneCnt > 0 then
  558 + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}})
  559 + end
  560 + end
  561 + local limit = globalCsv.box_key_max[itemId] or 5
  562 + if role:getItemCount(itemId) >= limit then return 3 end
  563 +
  564 + boxL[slot] = {id = itemId, process = 0, time = skynet.timex()}
  565 + role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600})
  566 + elseif oper == 2 then -- 重置运行时间(可以使用加速)
559 567 local quick = msg.quick
560   - if not boxL[slot] then return end
561   - local costKey = 0
562   - if boxL[slot].time > skynet.timex() then -- 没开完
563   - if not quick then return end
  568 + if not boxL[slot] then return 4 end
  569 +
  570 + local itemId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time
  571 + local nowTime = skynet.timex()
  572 + local stopTime = nowTime
  573 + local itemData = csvdb["itemCsv"][itemId]
  574 + local unitTime = globalCsv.box_key_time[itemId] * 60
  575 + if quick then
  576 + stopTime = time + globalCsv.box_productLine_time * 3600
564 577 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
565   - costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2]
566   - if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end
567   - role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}})
568   - role:pushCancel({type = "box", slot = slot})
  578 + local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2]
  579 + if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end
  580 + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}})
569 581 end
570   - local boxId = boxL[slot].id
571   - local itemData = csvdb["itemCsv"][boxId]
572   - local randomData = csvdb["item_randomCsv"][itemData.id]
573   - local costTime = skynet.timex() - (boxL[slot].time - randomData.openTime)
574   - -- 随机奖励
  582 + role:pushCancel({type = "box", slot = slot})
  583 +
  584 + local doneCnt = math.floor((process + stopTime - time) / unitTime)
  585 + if doneCnt > 0 then
  586 + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}})
  587 + end
  588 + if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then
  589 + nowTime = 0
  590 + end
  591 +
  592 + boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime}
  593 + role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600})
  594 + elseif oper == 3 then -- 开箱子
  595 + local costId = msg.costId
  596 + local costs = (msg.costs or ""):toNumMap()
  597 + if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end
  598 +
  599 + local costIdData = csvdb["itemCsv"][costId]
  600 + local count = 0
  601 + for itemId, num in pairs(costs) do
  602 + local itemIdData = csvdb["itemCsv"][itemId]
  603 + if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end
  604 + count = count + num
  605 + end
  606 +
  607 + if role:getItemCount(costId) < count then return 8 end
  608 +
  609 + role:costItems({[costId] = count}, {log = {desc = "openTimeBox"}})
  610 +
575 611 reward = {}
576   - for i = 1, 10 do
577   - local num = randomData["num" .. i]
578   - local gift = randomData["gift" .. i]
579   - if num and gift and num > 0 and gift ~= "" then
580   - local pool = {}
581   - for _, temp in ipairs(gift:toArray()) do
582   - local set = temp:toArray(true, "=")
583   - table.insert(pool, set)
  612 + for itemId, value in pairs(costs) do
  613 + local tempReward = {}
  614 + local randomData = csvdb["item_randomCsv"][itemId]
  615 + local itemData = csvdb["itemCsv"][itemId]
  616 + role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}})
  617 + for _ = 1, value do
  618 + for i = 1, 10 do
  619 + local num = randomData["num" .. i]
  620 + local gift = randomData["gift" .. i]
  621 + if num and gift and num > 0 and gift ~= "" then
  622 + local pool = {}
  623 + for _, temp in ipairs(gift:toArray()) do
  624 + local set = temp:toArray(true, "=")
  625 + table.insert(pool, set)
  626 + end
  627 +
  628 + local needCount = math.min(#pool, num)
  629 + for j = 1, needCount do
  630 + local idx = math.randWeight(pool, 3)
  631 + tempReward[pool[idx][1]] = (tempReward[pool[idx][1]] or 0) + pool[idx][2]
  632 + table.remove(pool, idx)
  633 + end
  634 + end
584 635 end
  636 + end
  637 + tempReward[0] = nil
  638 + role:checkTaskEnter("OpenBox", {id = itemId, count=value, quality=itemData.quality})
  639 + role:log("carriage_dismantle", {
  640 + item_id = itemId, -- 道具id
  641 + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表
  642 + item_level = 0, -- 道具等级
  643 + item_number = 1, -- 道具变化数量的绝对值
  644 + carriage_dismantle_type = 1, -- 拆解方式,时间到期:0,钥匙开启:1
  645 + carriage_dismantle_time = 0, -- 拆解耗时,填写实际耗时
  646 + carriage_dismantle_cost = value, -- 拆解花费钥匙数量,未使用填写0
  647 + carriage_dismantle_rwd = tempReward, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..}
  648 + })
585 649  
586   - local needCount = math.min(#pool, num)
587   - for j = 1, needCount do
588   - local idx = math.randWeight(pool, 3)
589   - reward[pool[idx][1]] = (reward[pool[idx][1]] or 0) + pool[idx][2]
590   - table.remove(pool, idx)
591   - end
  650 + for id, num in pairs(tempReward) do
  651 + reward[id] = (reward[id] or 0) + num
592 652 end
593 653 end
594   - reward[0] = nil
595   -
596   - boxL[slot] = nil
597   - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}})
598   - role:checkTaskEnter("OpenBox", {id = boxId, count=1, quality=itemData.quality})
599   -
600   - role:log("carriage_dismantle", {
601   - item_id = boxId, -- 道具id
602   - item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表
603   - item_level = 0, -- 道具等级
604   - item_number = 1, -- 道具变化数量的绝对值
605   - carriage_dismantle_type = quick and 1 or 0, -- 拆解方式,时间到期:0,钥匙开启:1
606   - carriage_dismantle_time = costTime, -- 拆解耗时,填写实际耗时
607   - carriage_dismantle_cost = costKey, -- 拆解花费钥匙数量,未使用填写0
608   - carriage_dismantle_rwd = reward, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..}
609   - })
  654 + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}})
610 655 else
611 656 return
612 657 end
613 658  
614   - role:setProperty("boxL") --刷新
615   - role:changeUpdates({{type = "boxL", field = slot, value = boxL[slot], isOnlyToC = true}}) -- 通知客户端
  659 + role:setProperty("boxL",boxL) --刷新
  660 + if slot then
  661 + role:changeUpdates({{type = "boxL", field = slot, value = boxL[slot], isOnlyToC = true}}) -- 通知客户端
  662 + end
616 663 SendPacket(actionCodes.Role_openTimeBoxRpc, MsgPack.pack(role:packReward(reward, change)))
617 664 return true
618 665 end
... ...
src/actions/StoreAction.lua
... ... @@ -14,6 +14,9 @@ function _M.rechargeRpc(agent , data)
14 14  
15 15 --创建订单号
16 16 local partnerOrderId = role:getPurchaseOrder(id)
  17 + if partnerOrderId == "" then
  18 + return 1
  19 + end
17 20 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId }))
18 21  
19 22  
... ...
1   -Subproject commit 591f2b4097214f9f5bf3b746f86ac704cbc9ea44
  1 +Subproject commit f6a626350c1f4039f0f677a1baf262f3493757d2
... ...
src/models/Activity.lua
... ... @@ -71,6 +71,7 @@ Activity.schema = {
71 71 act19 = {"number", 0}, -- {挂机信息}
72 72 act20 = {"table", {}}, -- {id=扭蛋抽出数量}
73 73  
  74 + act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum}
74 75 act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}}
75 76 }
76 77  
... ... @@ -493,6 +494,19 @@ activityFunc[Activity.ActivityType.Gachakon] = {
493 494 end,
494 495 }
495 496  
  497 +-- 活动卡池
  498 +activityFunc[Activity.ActivityType.ActHeroPool] = {
  499 + ["init"] = function(self, actType, isCrossDay, notify, actId)
  500 + end,
  501 + ["close"] = function(self, actType, notify, actId)
  502 + local actData = self:getActData(actType)
  503 + local cfg = csvdb["activity_ctrlCsv"][actId]
  504 + if not cfg then return end
  505 + actData[cfg.condition] = nil
  506 + self:updateActData(actType, actData, not notify)
  507 + end,
  508 +}
  509 +
496 510 -- 挂机掉落
497 511 activityFunc[Activity.ActivityType.HangDrop] = {
498 512 ["init"] = function(self, actType, isCrossDay, notify, actId)
... ... @@ -544,7 +558,9 @@ function Activity:closeActivity(actId, notify, notUpdateAct)
544 558 self:recycleActItem(actId)
545 559 end
546 560 if Activity.schema["act".. actType] then
547   - self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  561 + if not Activity.schema["act" .. actType][3] then
  562 + self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  563 + end
548 564 end
549 565 end
550 566  
... ...
src/models/RoleLog.lua
... ... @@ -50,6 +50,7 @@ local ItemReason = {
50 50 actHangDrop = 134, -- 掉落活动奖励
51 51 actBattle = 135, -- 活动关卡
52 52 actMilestone = 136, -- 活动关卡boss伤害里程碑
  53 + worldBossReward = 137, -- 世界boss翻牌奖励
53 54  
54 55  
55 56 advHang = 301, -- 拾荒挂机
... ...
src/models/RolePlugin.lua
... ... @@ -362,10 +362,34 @@ function RolePlugin.bind(Role)
362 362 pms.itemId = itemId
363 363 pms.count = - count
364 364 self:addItem(pms)
  365 + self:itemDeltaEvent(pms)
365 366 end
366 367 return true
367 368 end
368 369  
  370 + function Role:itemDeltaEvent(pms)
  371 + self:eventBoxL(pms)
  372 + end
  373 +
  374 + -- 拆解室的生产线启动
  375 + function Role:eventBoxL(pms)
  376 + local limit = globalCsv.box_key_max[pms.itemId]
  377 + if not limit then return end
  378 +
  379 + local update = false
  380 + local boxL = self:getProperty("boxL") or {}
  381 + for slot, data in pairs(boxL) do
  382 + if data.time == 0 and data.id == pms.itemId and self:getItemCount(pms.itemId) < limit then
  383 + update = true
  384 + data.time = skynet.timex()
  385 + end
  386 + end
  387 +
  388 + if update then
  389 + self:updateProperty({field = "boxL", value = boxL})
  390 + end
  391 + end
  392 +
369 393 function Role:getItemCount(itemId)
370 394 if itemId == ItemId.Diamond then
371 395 return self:getAllDiamond()
... ... @@ -1580,15 +1604,17 @@ function RolePlugin.bind(Role)
1580 1604 return ""
1581 1605 end
1582 1606 local limit = rechargeData.limit
1583   - local rechargeRecord = self:getProperty("payR") or {}
  1607 + local rechargeRecord = self.storeData:getProperty("payR") or {}
1584 1608 if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then
1585 1609 return ""
1586 1610 end
1587 1611  
1588 1612 --判断是否是活动商品
1589   - local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id]
1590   - if not actCfg then return "" end
1591   - if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end
  1613 + if rechargeData.activity_id ~= 0 then
  1614 + local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id]
  1615 + if not actCfg then return "" end
  1616 + if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end
  1617 + end
1592 1618  
1593 1619 local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId)
1594 1620 if orderId then
... ... @@ -1835,10 +1861,10 @@ function RolePlugin.bind(Role)
1835 1861 end
1836 1862  
1837 1863 -- 抽卡阶段奖励
1838   - function Role:getDrawCardExtraReward(oldVal, newVal)
  1864 + function Role:getDrawCardExtraReward(feedbackId, oldVal, newVal)
1839 1865 local reward = nil
1840 1866 local maxCount = 0
1841   - for k, v in pairs(csvdb["build_extraRewardCsv"]) do
  1867 + for k, v in pairs(csvdb["build_extraRewardCsv"][feedbackId]) do
1842 1868 if oldVal < k and newVal >= k then
1843 1869 reward = v["reward"] or ""
1844 1870 end
... ...