diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 3d09604..6e13be5 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -397,10 +397,16 @@ TeamSystemType = { Dinner = 4, FriendBattle = 5, } +-- 加速类型 +UpSpeedType = { + ExplorationUpSpeed = 1, -- 探索加速 + GearUpSpeed = 2, -- 齿轮加速 + Restaurant = 3, -- 餐厅加速 +} -- 某个功能对其他系统功能的加成类型 SystemBnousType = { - TowerBuff = 1, -- 电波塔内战斗开始时获得buff + TowerBuff = 1, -- 电波塔内战斗开始时获得buff or CrusadeTask = 2, -- 讨伐电台任务加速 DinerGet = 3, -- 食材供应商获取速度 DinerLimit = 4, -- 食材供应商上限 @@ -410,4 +416,10 @@ SystemBnousType = { HangTime = 8, -- 挂机时间上限 PvpTicket = 9, -- 每周额外获得竞技场门票数量 SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具 + DismantlingMaximum = 11,-- 拆解术式模块运行时间上限 + DismantlingImproved = 12,-- 拆解术式构筑效率提升 + DailyReward = 13,-- 每日签到额外获得道具 + TreasureBaseMaximum = 14, -- 增加宝藏资源值上限 + UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 + ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 } diff --git a/src/actions/ActivityAction.lua b/src/actions/ActivityAction.lua index 3c14373..7a96a03 100644 --- a/src/actions/ActivityAction.lua +++ b/src/actions/ActivityAction.lua @@ -136,7 +136,14 @@ function _M.signRpc(agent, data) end signs[curDay] = yearMonth - local reward, change = role:award(monthData[curDay].item, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) + -- 达到一定等级,签到会有额外奖励 + local reward = role:getBnousDaily() + local change + local award = monthData[curDay].item:toNumMap() or {} + for k, v in pairs(award) do + reward[k] = (reward[k] or 0) + v + end + reward, change = role:award(reward, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) role:checkTaskEnter("SignIn") diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index bb38467..18124cd 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -251,11 +251,20 @@ end function _M.expediteSellRpc( agent, data ) local role = agent.role local count = role.dinerData:getProperty("expedite") - local max = #globalCsv.diner_sell_quick_cost - if count > max then - return 1 + local maxIdx = #globalCsv.diner_sell_quick_cost + + -- 增加今日餐厅加速次数 + local max = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.Restaurant) + if count > max then return 1 end + + local costs = clone(globalCsv.diner_sell_quick_cost) + if count > maxIdx then + for idx = maxIdx+1, count do + costs[idx] = costs[maxIdx] + end end - local diamond = globalCsv.diner_sell_quick_cost[count] + + local diamond = costs[count] if diamond > 0 then local cost = {[ItemId.Jade] = diamond} if not role:checkItemEnough(cost) then diff --git a/src/actions/EmailAction.lua b/src/actions/EmailAction.lua index 935deae..2284593 100644 --- a/src/actions/EmailAction.lua +++ b/src/actions/EmailAction.lua @@ -124,6 +124,8 @@ function _M.drawAllAttachRpc(agent, data) role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) end end + if role:checkRuneFullyByReward(reward) then return 1 end + reward, change = role:award(reward, {log = {desc = "draw_attach"}}) SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change})) return true @@ -143,8 +145,17 @@ function _M.drawAttachRpc(agent, data) local attachments = getEmailAttachments(email) if attachments == "" then return end - local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = id}}) + local reward, change = {} + if type(attachments) == "string" then + for key, v in pairs(attachments:toNumMap()) do + reward[key] = (reward[key] or 0) + v + end + else + reward = attachments + end if role:checkRuneFullyByReward(reward) then return 1 end + reward, change = role:award(reward, {log = {desc = "draw_attach", int1 = id}}) + email:setProperty("status", 2, true) email:log(role, 2) diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 072fa66..94de4c9 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -478,6 +478,18 @@ function _M.quickRpc(agent , data) local curCount = role.dailyData:getProperty("hangQC") + 1 local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") + + -- 增加今日探索加速次数 + local maxIdx = #costs + local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.ExplorationUpSpeed) + if curCount > maxCount then return end + + if curCount > maxIdx then + for idx = maxIdx+1, curCount do + costs[idx] = costs[maxIdx] + end + end + if not costs[curCount] then return end if costs[curCount] > 0 then if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end @@ -666,7 +678,7 @@ function _M.startBonusBattleRpc(agent, data) if open and actData then coef = tonumber(actData.condition2) end - if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end + if math.illegalNum(count, 1, (globalCsv.bonus_daily_count + role:getBnousChangeBaseCount()) * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count role.dailyData:updateProperty({field = "bonusC", value = bonusC}) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 85b7f94..e4dda8b 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -633,6 +633,7 @@ function _M.openTimeBoxRpc(agent, data) else local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time local unitTime = globalCsv.box_key_time[oldId] * 60 + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) if doneCnt > 0 then reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) @@ -642,7 +643,7 @@ function _M.openTimeBoxRpc(agent, data) if role:getItemCount(itemId) >= limit then return 3 end boxL[slot] = {id = itemId, process = 0, time = skynet.timex()} - role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600}) + role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()}) elseif oper == 2 then -- 重置运行时间(可以使用加速) local quick = msg.quick if not boxL[slot] then return 4 end @@ -652,6 +653,7 @@ function _M.openTimeBoxRpc(agent, data) local stopTime = nowTime local itemData = csvdb["itemCsv"][itemId] local unitTime = globalCsv.box_key_time[itemId] * 60 + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) if quick then stopTime = nowTime + quick local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") @@ -661,6 +663,8 @@ function _M.openTimeBoxRpc(agent, data) else stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) end + stopTime = stopTime + role:getBnousDismantlingMaximum() + role:pushCancel({type = "box", slot = slot}) local doneCnt = math.floor((process + stopTime - time) / unitTime) @@ -672,21 +676,23 @@ function _M.openTimeBoxRpc(agent, data) end boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime} - role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600}) + role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()}) elseif oper == 3 then -- 开箱子 local costId = msg.costId local costs = (msg.costs or ""):toNumMap() if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end local costIdData = csvdb["itemCsv"][costId] - local count = 0 + local count, runeCount = 0, 0 for itemId, num in pairs(costs) do local itemIdData = csvdb["itemCsv"][itemId] if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end + + if itemIdData.type == ItemType.Rune then runeCount = runeCount + num end count = count + num end - if role:checkRuneFully(count) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 if role:getItemCount(costId) < count then return 8 end if not role:checkItemEnough(costs) then return 9 end @@ -701,8 +707,8 @@ function _M.openTimeBoxRpc(agent, data) role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}}) for _ = 1, value do for i = 1, 10 do - local num = randomData["num" .. i] - local gift = randomData["gift" .. i] + local num = randomData["num" .. tostring(i)] + local gift = randomData["gift" .. tostring(i)] if num and gift and num > 0 and gift ~= "" then local pool = {} for _, temp in ipairs(gift:toArray()) do @@ -1392,7 +1398,20 @@ end function _M.goldBuyRpc(agent, data) local role = agent.role local curT = role.dailyData:getProperty("goldBuyT") - local costD = globalCsv.idle_quickMoney_cost[curT] + + local costs = clone(globalCsv.idle_quickMoney_cost) + -- 增加今日齿轮加速次数 + local maxIdx = #globalCsv.idle_quickMoney_cost + local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed) + if curT > maxCount then return end + if curT > maxIdx then + for idx = maxIdx+1, curCount do + costs[idx] = costs[maxIdx] + end + end + + local costD = costs[curT] + if not costD then return 1 end diff --git a/src/models/Role.lua b/src/models/Role.lua index 10045c0..4303223 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -75,6 +75,7 @@ Role.schema = { expireItem = {"table", {}}, --物品过期检查 funcOpen = {"table", {}}, --功能是否开放 funcLv = {"table", {}}, --功能等级 + levelBnous = {"table", {}}, --等级奖励 -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL crown = {"number", 0}, -- 看伴娘 silent = {"number", 0}, --禁言解禁时间 @@ -349,6 +350,7 @@ function Role:data() items = self:getProperty("items"):toNumMap(), funcOpen = self:getProperty("funcOpen"), funcLv = self:getProperty("funcLv"), + levelBnous = self:getProperty("levelBnous"), -- loveStatus = self:getProperty("loveStatus"):toNumMap(), timeReset = self:getProperty("timeReset"), diamond = self:getAllDiamond(), diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 76c58b1..4bf49ce 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -284,6 +284,7 @@ function RolePlugin.bind(Role) newExp = newExp - csvdb["player_expCsv"][level].exp level = level + 1 self:checkTaskEnter("RoleLevelUp", {level = level}) + self:getLevelBnous(level) else newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 end @@ -2753,45 +2754,145 @@ function RolePlugin.bind(Role) function Role:getBnousCrusade(value) local towerBnous = self:getTowerBnousActive() - return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) + local levelValue = self:getDeltaValue(self:getProperty("levelBnous")[SystemBnousType.CrusadeTask], value) + local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) + return levelValue + towerValue end function Role:getBnousDiner(type, value) local towerBnous = self:getTowerBnousActive() type = type or 1 - local result + local result, levelReault if type == 1 then result = towerBnous[SystemBnousType.DinerGet] + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet] elseif type == 2 then result = towerBnous[SystemBnousType.DinerLimit] + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit] elseif type == 3 then result = towerBnous[SystemBnousType.DinerSell] + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell] elseif type == 4 then result = towerBnous[SystemBnousType.DinerPrice] + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice] end - return self:getDeltaValue(result, value) + return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) end + local function appendBnous(dstBnous, srcBnous) + if not dstBnous or not srcBnous then return end + for time, set in pairs(srcBnous) do + if not dstBnous[time] then + dstBnous[time] = {} + end + for key, value in pairs(set) do + dstBnous[time][key] = (dstBnous[time][key] or 0) + value + end + end + end function Role:getBnousAdv() local towerBnous = self:getTowerBnousActive() + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {} + appendBnous(towerBnous[SystemBnousType.Adv], levelBnous) return towerBnous[SystemBnousType.Adv] or {} end function Role:getBnousHangTime() local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.HangTime] or 0 + local levelBnous = self:getProperty("levelBnous") or {} + local tmptime = 0 + if next(levelBnous) then + tmptime = levelBnous[SystemBnousType.HangTime] or 0 + end + return towerBnous[SystemBnousType.HangTime] or 0 + tmptime end function Role:getBnousPvpTicket() local towerBnous = self:getTowerBnousActive() + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {} + appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous) return towerBnous[SystemBnousType.PvpTicket] or {} end function Role:getBnousSweep() local towerBnous = self:getTowerBnousActive() + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {} + appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous) return towerBnous[SystemBnousType.SweepReward] or {} end + function Role:getBnousDismantlingMaximum() + return self:getProperty("levelBnous")[SystemBnousType.DismantlingMaximum] or 0 + end + + function Role:getBnousDismantlingImproved(value) + local result = self:getProperty("levelBnous")[SystemBnousType.DismantlingImproved] or {} + return self:getDeltaValue(result, value) + end + + function Role:getBnousDaily() + local reward = {} + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.DailyReward] or {} + for k, v in pairs(levelBnous) do + reward[k] = (reward[k] or 0) + v + end + return reward + end + + function Role:getBnousTreasureBaseMaximum() + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.TreasureBaseMaximum] or 0 + local treasureBase = self.dailyData:getProperty("treasureBase") + levelBnous + self.dailyData:updateProperty({field = "treasureBase", value = treasureBase}) + end + + --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 + function Role:getBnousUpSpeedNum(upType) + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.UpSpeedNum] or {} + if next(levelBnous) then + return levelBnous[upType] or 0 + end + return 0 + end + + function Role:getBnousChangeBaseCount() + return self:getProperty("levelBnous")[SystemBnousType.ChangeBaseCount] or 0 + end + + function Role:getLevelBnous(level) + local levelBnous = self:getProperty("levelBnous") + local additionData = csvdb["level_additionCsv"][level] + if additionData then + local effects = additionData.effect:toTableArraySec() + for _, effect in pairs(effects) do + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4]) + if not levelBnous[pm1] then + levelBnous[pm1] = {} + end + if pm1 == SystemBnousType.TowerBuff then + + elseif pm1 == SystemBnousType.Adv then + if not levelBnous[pm1][pm4] then + levelBnous[pm1][pm4] = {} + end + levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3 + elseif pm1 == SystemBnousType.HangTime or + pm1 == SystemBnousType.ExploreMaximum or + pm1 == SystemBnousType.DismantlingMaximum or + pm1 == SystemBnousType.TreasureBaseMaximum or + pm1 == SystemBnousType.ChangeBaseCount then + if type(levelBnous[pm1]) == "table" then + levelBnous[pm1] = 0 + end + levelBnous[pm1] = levelBnous[pm1] + pm2 + else + levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 + end + end + end + self:updateProperty({field = "levelBnous", value= levelBnous}) + return levelBnous + end + function Role:getPotionLevel(id) local level = self.dinerData:getProperty("dishTree"):getv(id, 1) local talentSet = csvdb["diner_talentCsv"][id] @@ -2838,7 +2939,7 @@ function RolePlugin.bind(Role) count = count or 0 local page = globalCsv.store_type[ItemType.Rune] local limit = self:getProperty("bagLimit")[page] - return self:getRuneBatCount() + count >= limit + return self:getRuneBatCount() + count > limit end function Role:checkRuneFullyByReward(reward) @@ -2889,6 +2990,8 @@ function RolePlugin.bind(Role) self:sendMail(20, nil, tmpreward) end end + + end return RolePlugin \ No newline at end of file -- libgit2 0.21.2