diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index e961f7b..646298d 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -901,6 +901,7 @@ function _M.entrustRpc(agent , data) role:finishGuide(26) role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) + role:checkTaskEnter("VillageApply", {}) SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) return true diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index e956747..2016639 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -409,10 +409,9 @@ function _M.quickRpc(agent , data) end local doubleCoef = role.activity:isOpen("DoubleDrop") and 2 or 1 - -- 特权卡获取加速获得额外道具 local coef = role.storeData:getProduceItemSpeedCoef() - if coef > 1 then + if coef > 1 or doubleCoef > 1 then for k, cnt in pairs(reward) do reward[k] = math.floor(cnt * coef * doubleCoef) end @@ -479,10 +478,15 @@ function _M.buyBonusCountRpc(agent, data) local btype = msg.type if not TimeReset["DailyBattle" .. btype] then return end + local open, actId = role.activity:isOpen("BonusDouble") + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return end + + local coef = open and tonumber(actData.condition2) or 1 local bonusC = role.dailyData:getProperty("bonusC") bonusC[btype] = bonusC[btype] or {c = 0, b = 0} - local lastCount = globalCsv.bonus_daily_buy_count - bonusC[btype]["b"] + local lastCount = globalCsv.bonus_daily_buy_count * coef - bonusC[btype]["b"] if math.illegalNum(count, 1, lastCount) then return 1 end if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end @@ -502,20 +506,30 @@ function _M.startBonusBattleRpc(agent, data) local msg = MsgPack.unpack(data) local id = msg.id - if not role:isFuncUnlock(FuncUnlock.BonusBattle) then return end + local open, actId = role.activity:isOpen("BonusDouble") + + if not role:isFuncUnlock(FuncUnlock.BonusBattle) then return 1 end local bonusData = csvdb["bonus_battleCsv"][id] - if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return end + if not open then + if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return 2 end + end - if not bonusData then return 1 end - if not role:checkHangPass(bonusData.unlock) then return 2 end + if not bonusData then return 3 end + if not role:checkHangPass(bonusData.unlock) then return 4 end - if not next(role:getProperty("bTeam")) then return 3 end + if not next(role:getProperty("bTeam")) then return 5 end local bonusC = role.dailyData:getProperty("bonusC") bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} - if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 4 end + + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return 6 end + + local coef = open and tonumber(actData.condition2) or 1 + + if globalCsv.bonus_daily_count * coef - bonusC[bonusData.type]["c"] <= 0 then return 7 end role.__bonusBattleCache = { @@ -533,6 +547,11 @@ function _M.endBonusBattleRpc(agent, data) local key = msg.key local starNum = msg.starNum if not role.__bonusBattleCache then return 1 end + local open, actId = role.activity:isOpen("BonusDouble") + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return end + + local coef = open and tonumber(actData.condition2) or 1 if role.__bonusBattleCache.id ~= id or role.__bonusBattleCache.key ~= key then SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) @@ -545,7 +564,7 @@ function _M.endBonusBattleRpc(agent, data) -- 胜利扣除次数 local bonusC = role.dailyData:getProperty("bonusC") bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} - if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 3 end + if globalCsv.bonus_daily_count * coef - bonusC[bonusData.type]["c"] <= 0 then return 3 end bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 role.dailyData:updateProperty({field = "bonusC", value = bonusC}) @@ -554,6 +573,9 @@ function _M.endBonusBattleRpc(agent, data) if chance[1] ~= 0 then reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] end + for k, v in pairs(reward) do + reward[k] = v * (coef > 1 and actData.condition or 1) + end reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) role:checkTaskEnter("BonusPass", {id = id}) end diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index d93ef16..c6a0fd5 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -721,7 +721,7 @@ function _M.drawHeroRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) - if not role:isFuncUnlock(FuncUnlock.GetHero) then return end + if not role:isFuncUnlock(FuncUnlock.GetHero) then return 1 end local btype = msg.pool -- 1 2 3 卡池类型 local subType = msg.subType or 1-- 定向卡池需要传 子类型 local drawType = msg.type -- 1 单抽 2 十连 @@ -730,10 +730,10 @@ function _M.drawHeroRpc(agent, data) end local buildTypeData = csvdb["build_typeCsv"][btype] - if not buildTypeData then return 1 end + if not buildTypeData then return 2 end local drawCount = {1, 10} -- 抽取次数 - if not drawCount[drawType] then return 2 end + if not drawCount[drawType] then return 3 end local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] local floorHeroCount = role:getProperty("floorHero")[btype] or 0 @@ -757,20 +757,20 @@ function _M.drawHeroRpc(agent, data) end end if lastCount > 0 then -- 钱不够 - return 3 + return 4 end -- 抽取的池子 local poolMap = buildTypeData["pool"]:toNumMap() local poolId = poolMap[subType] - if not poolId then return end + if not poolId then return 5 end --判断定向卡池是否开启 if btype == 1 then if not role:isTimeResetOpen(TimeReset["DrawType" .. subType]) then local unlockPool = role.dailyData:getProperty("unlockPool") if not unlockPool[subType] then - return 1 + return 6 end end end @@ -782,12 +782,12 @@ function _M.drawHeroRpc(agent, data) end local unitPool = csvdb["build_unitCsv"][poolId] - if not unitPool then return 4 end + if not unitPool then return 7 end -- 开始抽 local resultPool = {} local function fillDrawPool(isFloorBack) - local condition = {"rare", "camp"} + local condition = {"rare"} local values = {} @@ -848,7 +848,7 @@ function _M.drawHeroRpc(agent, data) fillDrawPool(isFloorBack) if not next(resultPool) then skynet.error("random pool error, poolId:" .. poolId) - return + return 8 end local itemId = math.randWeight(resultPool, 1) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 0f07e10..aca9097 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -584,7 +584,7 @@ function _M.openTimeBoxRpc(agent, data) boxL[slot] = nil reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) - role:checkTaskEnter("OpenBox", {id = boxId, count=1}) + role:checkTaskEnter("OpenBox", {id = boxId, count=1, quality=itemData.quality}) role:log("carriage_dismantle", { item_id = boxId, -- 道具id diff --git a/src/csvdata b/src/csvdata index 5751e98..76bf12d 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 5751e98613ad7ade246cb9068c6752ecca115163 +Subproject commit 76bf12dfa6afe523ec30d1da6467cb8cbd30790f diff --git a/src/models/Activity.lua b/src/models/Activity.lua index e205207..91bed44 100644 --- a/src/models/Activity.lua +++ b/src/models/Activity.lua @@ -1,17 +1,23 @@ local Activity = class("Activity", require("shared.ModelBase")) local string_format = string.format +-- activity_ctr showType Activity.ActivityType = { - Sign = 1, -- 签到 + SsrUpPoolChange = 1, -- 特定英雄活动,切卡池 DoubleDrop = 2, -- 双倍掉落 - FoodSell = 3, --贩卖周 料理 - DrawHero = 4, --抽卡周 招募 - AdvDraw = 5, --拾荒抽周 资助 - OpenBox = 6, --拆解周 时钟箱 - PaySignIn = 7, --付费签到 - PayBack = 9, --返利 - - SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 + Sign = 4, -- 签到 + ChangeCG = 5, -- 客户端使用,切换抽卡界面 + PaySignIn = 6, --付费签到 + ExploreCommand = 7, -- 探索指令 + PayBack = 8, --返利 + + BonusDouble = 9, -- 奖励关卡翻倍 + CalendaTask = 10, -- 日历任务 + + FoodSell = 11, --贩卖周 料理 + DrawHero = 12, --抽卡周 招募 + AdvDraw = 13, --拾荒抽周 资助 + OpenBox = 14, --拆解周 时钟箱 } @@ -33,26 +39,27 @@ end Activity.schema = { actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} round = {"table", {}}, -- 记录活动到了第几轮 {id = roundnum} - act1 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 - act3 = {"table", {}}, -- {0 = 抽卡次数, 1=1, 2=1} 抽卡周活动 1表示领取过该档位的奖励 - act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 - act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 - act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 - act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 - act9 = {"number", 0}, -- 充值返利 + act4 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 + act6 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 + act8 = {"number", 0}, -- 充值返利 + + act11 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 + act12 = {"table", {}}, -- {0 = 抽卡次数, 1=1, 2=1} 抽卡周活动 1表示领取过该档位的奖励 + act13 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 + act14 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 } function Activity:data() return { actime = self:getProperty("actime"), round = self:getProperty("round"), - act1 = self:getProperty("act1"), - act3 = self:getProperty("act3"), act4 = self:getProperty("act4"), - act5 = self:getProperty("act5"), act6 = self:getProperty("act6"), - act7 = self:getProperty("act7"), - act9 = self:getProperty("act9"), + act8 = self:getProperty("act8"), + act11 = self:getProperty("act11"), + act12 = self:getProperty("act12"), + act13 = self:getProperty("act13"), + act14 = self:getProperty("act14"), } end @@ -77,10 +84,9 @@ function Activity:updateProperty(params) return false end - -function Activity:isOpenRaw(activityType, now) - activityType = checkActivityType(activityType) - local actData = csvdb["activity_ctrlCsv"][activityType] +function Activity:isOpenRaw(activityId, now) + activityId = checkActivityType(activityId) + local actData = csvdb["activity_ctrlCsv"][activityId] if not actData then return end if actData.time == "" then -- 关闭 @@ -89,7 +95,7 @@ function Activity:isOpenRaw(activityType, now) local st = 0 local et = 0 - local now = skynet.timex() + --local now = skynet.timex() if actData.ttype == 0 then -- 时间开放 local openTimes = actData.time:toArray(false, "=") @@ -118,7 +124,17 @@ end -- 缓存开放 function Activity:isOpen(activityType) activityType = checkActivityType(activityType) - return self._isOpen[activityType] + --return self._isOpen[activityType] + local open = false + for id, data in pairs(csvdb["activity_ctrlCsv"]) do + if data.showType == activityType then + open = self._isOpen[data.id] + if open then + return true, data.id + end + end + end + return false end function Activity:getActData(actType) @@ -137,22 +153,22 @@ function Activity:checkActivityStatus(now, isCrossDay, notify) self._isOpen = {} local actime = self:getProperty("actime") local change = false - for actType, actData in pairs(csvdb["activity_ctrlCsv"]) do - local isOpen, startTime = self:isOpenRaw(actType, now) - self._isOpen[actType] = isOpen + for actId, actData in pairs(csvdb["activity_ctrlCsv"]) do + local isOpen, startTime = self:isOpenRaw(actId, now) + self._isOpen[actId] = isOpen if isOpen then - if actime[actType] and actime[actType] == startTime then -- 还是之前的状态 开放中 + if actime[actId] and actime[actId] == startTime then -- 还是之前的状态 开放中 else -- 重置 - actime[actType] = startTime - self:closeActivity(actType, notify, true) - self:initActivity(actType, isCrossDay, notify) + actime[actId] = startTime + self:closeActivity(actId, notify, true) + self:initActivity(actId, isCrossDay, notify) change = true end else - if actime[actType] then - self:closeActivity(actType, notify) - actime[actType] = nil + if actime[actId] then + self:closeActivity(actId, notify) + actime[actId] = nil change = true end end @@ -345,13 +361,19 @@ activityFunc[Activity.ActivityType.PayBack] = { -- end, } -function Activity:initActivity(actType, isCrossDay, notify) +function Activity:initActivity(actId, isCrossDay, notify) + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return end + local actType = actData.showType if activityFunc[actType] and activityFunc[actType]['close'] then activityFunc[actType]["init"](self, actType, isCrossDay, notify) end end -function Activity:closeActivity(actType, notify, notUpdateAct) +function Activity:closeActivity(actId, notify, notUpdateAct) + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return end + local actType = actData.showType if activityFunc[actType] and activityFunc[actType]['close'] then activityFunc[actType]["close"](self, actType, notify) end @@ -361,8 +383,10 @@ function Activity:closeActivity(actType, notify, notUpdateAct) end function Activity:refreshDailyData(notify) - for actType, status in pairs(self._isOpen) do - if status then + for actId, status in pairs(self._isOpen) do + local actData = csvdb["activity_ctrlCsv"][actId] + if status and actData then + local actType = actData.showType if activityFunc[actType] and activityFunc[actType]['crossDay'] then activityFunc[actType]["crossDay"](self, actType, notify) end @@ -398,10 +422,12 @@ end -- 获取活动卡池id function Activity:getActivityPool(mainType, subType) - if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then + local open, actId = self:isOpen(Activity.ActivityType.SsrUpPoolChange) + if not open then + --if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then return 0 end - local actData = csvdb["activity_ctrlCsv"][Activity.ActivityType.SsrUpPoolChange] + local actData = csvdb["activity_ctrlCsv"][actId] if not actData then return 0 end local poolMap = actData.condition2:toMap(true, "=") diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index 0f4d482..42d5b8a 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -12,6 +12,9 @@ local TaskType = { WakeCG = 7, -- 觉醒到解锁CG - heroType HeroTalent = 8, -- 天赋升级 - heroType alv DrawSSR = 9, -- 抽到SSR - count + HeroLvlCollect = 10, -- 英雄等级收集进度 + HeroQualityCollect = 11, -- 英雄品质收集进度 + HeroStarCollect = 12, -- 英雄星级收集进度 --装备相关 AddEquip = 101, -- 获得装备 - equipId rarity @@ -44,6 +47,7 @@ local TaskType = { AdvStartSelf = 409, -- 手动冒险 - id AdvScore = 410, -- 冒险分数 - score AdvDraw = 411, -- 冒险资助 - count ptype + AdvHang = 412, -- 代理拾荒次数 --爬塔相关 TowerPass = 501, -- 爬塔通关 - level @@ -60,6 +64,7 @@ local TaskType = { DinerPopular = 608, -- 人气值 - count DinerLevelUp = 609, -- 餐厅升级 - level type DinerTalentUp = 610, -- 天赋升级 - type level + VillageApply = 611, -- 餐厅委托个数 -- 车厢相关 PotionMake = 701, -- 营养剂制作 - id count @@ -78,6 +83,7 @@ local TaskType = { -- 角色相关 RoleLevelUp = 901, -- 角色升级 - curlevel + RuneQualityCollect = 902, -- 铭文品质收集进度 --功能未实现 todo AdvShop = 1002, -- 冒险商城 @@ -230,6 +236,32 @@ local StoreListener = { } } +local CalendaTaskListener = { + func = "checkCalendaTask", + listen = { + [TaskType.DrawHero] = {{1, 1, f("count")}}, + [TaskType.BonusPass]= {{2, 1}}, + [TaskType.AdvPass]= {{3, 1}}, + [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, + [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 + [TaskType.AdvHang]= {{6, 1}}, ---- + [TaskType.HeroQualityCollect]= {{7, 3}}, + [TaskType.OverOderTask]= {{8, 1}}, + [TaskType.VillageApply]= {{9, 1}}, + [TaskType.PvpWin]= {{10, 2, f("score")}}, + [TaskType.DinerPopular]= {{11, 2, f("count")}}, + [TaskType.RoleLevelUp]= {{12, 2, f("level")}}, + [TaskType.TowerPass]= {{13, 2, f("level")}}, + [TaskType.HeroTalent]= {{14, 1}}, + [TaskType.HangPass]= {{15, 2, f("id")}}, + [TaskType.HeroStarCollect]= {{16, 3}}, + [TaskType.FoodSell]= {{17, 1, f("count")}}, + [TaskType.HangGet]= {{18, 3, f("reward")}}, + [TaskType.RuneQualityCollect]= {{19, 3, f("id")}}, + [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, + } +} + local TaskListeners = { StoryListener, @@ -552,6 +584,33 @@ function RoleTask.bind(Role) self.storeData:OnTriggerLimitTimePack(triggerType, param) end + function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) + local open, actId = self.activity:isOpen("CalendaTask") + local actData = csvdb["activity_ctrlCsv"][actId] + if not actData then return end + if not open then return end + + local change = false + local calTask = self:getProperty("calTask") or {} + param1 = param1 or 1 + + local cid = actData.condition + for k, taskList in pairs(csvdb["activity_taskCsv"]) do + if k == cid then + for id, cfg in pairs(taskList) do + if cfg.type == mainType then + if subType == 1 then -- 增加数值 + calTask[id] = (calTask[id] or 0) + param1 + elseif subType == 2 then -- 直接赋值 + calTask[id] = param1 + elseif subType == 3 then -- 自定义类型 + end + end + end + end + end + end + end return RoleTask \ No newline at end of file diff --git a/src/utils/CommonFunc.lua b/src/utils/CommonFunc.lua index a7b99b6..96a0f87 100644 --- a/src/utils/CommonFunc.lua +++ b/src/utils/CommonFunc.lua @@ -155,7 +155,7 @@ function diffFromOpen() hour = RESET_TIME, } if now < openTime then - return 0 + return -1 end return math.floor((now - openTime) / DAY_SEC) -- libgit2 0.21.2