Commit cefa858504308eb83d6bd47f25e10d7e8c125e97
Merge branch 'develop' into player
Showing
21 changed files
with
227 additions
and
157 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -110,7 +110,8 @@ ItemId = { |
| 110 | 110 | DinerSpTask = 20, -- 餐厅任务采购券 |
| 111 | 111 | LoveBreak = 21, --好感度突破道具 |
| 112 | 112 | PvpKey = 22, -- pvp钥匙 |
| 113 | - LunchFragment = 23, | |
| 113 | + LunchFragment = 23, | |
| 114 | + RuneFragment = 24, | |
| 114 | 115 | HeroFC = {700, 701, 702, 703}, --通用角色碎片 |
| 115 | 116 | AdvKey = 80, -- 冒险钥匙 |
| 116 | 117 | BoxKey = 60, -- 拆解工具 |
| ... | ... | @@ -129,6 +130,11 @@ TimeReset = { |
| 129 | 130 | DailyBattle3 = 16, -- 特殊-每日副本(时钟箱) |
| 130 | 131 | } |
| 131 | 132 | |
| 133 | +GuideStep = { | |
| 134 | + AdvGuide = 1010, | |
| 135 | + AdvRelay = 1012, | |
| 136 | +} | |
| 137 | + | |
| 132 | 138 | --客户端不需要知道这个 |
| 133 | 139 | AdvSpecialStage = { |
| 134 | 140 | [1]= "In", |
| ... | ... | @@ -178,7 +184,7 @@ AdvBackEventType = { |
| 178 | 184 | Dead = 11, --怪死亡 |
| 179 | 185 | Trader = 12, -- 召唤商人 |
| 180 | 186 | Monster = 13, -- 召唤怪物 |
| 181 | - | |
| 187 | + RelayReward = 14, -- 中级层奖励 | |
| 182 | 188 | |
| 183 | 189 | Cost = 16, -- 消耗道具 |
| 184 | 190 | Trap = 17, --陷阱 | ... | ... |
src/ProtocolCode.lua
src/actions/AdvAction.lua
| ... | ... | @@ -350,15 +350,22 @@ function _M.clickBlockRpc(agent, data) |
| 350 | 350 | local role = agent.role |
| 351 | 351 | local msg = MsgPack.unpack(data) |
| 352 | 352 | |
| 353 | - if not isCanContinue(role) then return end | |
| 353 | + local function returnFail(status) | |
| 354 | + SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = {}})) | |
| 355 | + return true or status -- 调试使用 status | |
| 356 | + end | |
| 357 | + | |
| 358 | + if not isCanContinue(role) then | |
| 359 | + return returnFail() | |
| 360 | + end | |
| 354 | 361 | local adv = role:getAdvData() |
| 355 | 362 | |
| 356 | - if adv:isWaitChooseArtifact() then return end | |
| 363 | + if adv:isWaitChooseArtifact() then return returnFail() end | |
| 357 | 364 | |
| 358 | 365 | adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) |
| 359 | 366 | |
| 360 | 367 | local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) |
| 361 | - if not status then return errorCode end | |
| 368 | + if not status then return returnFail(errorCode) end | |
| 362 | 369 | |
| 363 | 370 | SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()})) |
| 364 | 371 | return true |
| ... | ... | @@ -636,10 +643,10 @@ function _M.wheelSurfRpc(agent, data) |
| 636 | 643 | local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] |
| 637 | 644 | if not drawData then return 4 end |
| 638 | 645 | |
| 639 | - local costs = drawData.cost:toNumMap() | |
| 640 | - for id, count_ in pairs(costs) do | |
| 641 | - costs[id] = count_ * count | |
| 642 | - end | |
| 646 | + local cost = drawData.cost:toArray(true, "=") | |
| 647 | + local costs = {[ItemId.OldCoin] = cost[ctype]} | |
| 648 | + if not next(costs) then return 6 end | |
| 649 | + | |
| 643 | 650 | |
| 644 | 651 | if not role:checkItemEnough(costs) then return 5 end |
| 645 | 652 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) |
| ... | ... | @@ -648,10 +655,10 @@ function _M.wheelSurfRpc(agent, data) |
| 648 | 655 | advDrawB[ptype] = (advDrawB[ptype] or 0) + count |
| 649 | 656 | role:updateProperty({field = "advDrawB", value = advDrawB}) |
| 650 | 657 | -- 随机池子 |
| 651 | - local pool = drawData.weight:randWeight() | |
| 652 | 658 | local reward = {} |
| 653 | 659 | local backReward = {} |
| 654 | 660 | for i = 1, count do |
| 661 | + local pool = drawData.weight:randWeight() | |
| 655 | 662 | local gift = drawData["pool" .. pool]:randWeight(true) |
| 656 | 663 | reward[gift[1]] = (reward[gift[1]] or 0) + gift[2] |
| 657 | 664 | table.insert(backReward, gift) | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -565,8 +565,17 @@ function _M.refreshTaskRpc( agent, data ) |
| 565 | 565 | end |
| 566 | 566 | |
| 567 | 567 | local pool = {} |
| 568 | + | |
| 569 | + local dishTree = role.dinerData:getProperty("dishTree") | |
| 568 | 570 | for id, temp in pairs(taskData) do |
| 569 | - if not hadTask[id] then | |
| 571 | + local unlock = true | |
| 572 | + for _, front in ipairs(temp.front:toArray(true, "=")) do | |
| 573 | + if dishTree:getv(front, 0) == 0 then | |
| 574 | + unlock = false | |
| 575 | + break | |
| 576 | + end | |
| 577 | + end | |
| 578 | + if not hadTask[id] and unlock then | |
| 570 | 579 | table.insert(pool, temp) |
| 571 | 580 | end |
| 572 | 581 | end | ... | ... |
src/actions/GmAction.lua
| ... | ... | @@ -354,16 +354,16 @@ function _M.adv(role, pms) |
| 354 | 354 | local chapterId = tonum(pms.pm1) |
| 355 | 355 | local layer = tonum(pms.pm2) |
| 356 | 356 | |
| 357 | - local advData = csvdb["adv_chapterCsv"][chapterId] | |
| 358 | - if not advData then return end | |
| 357 | + local advCsv = csvdb["adv_chapterCsv"][chapterId] | |
| 358 | + if not advCsv then return end | |
| 359 | 359 | if math.floor(chapterId / 100) ~= 2 then |
| 360 | - layer = math.min(layer, advData.limitlevel) | |
| 360 | + layer = math.min(layer, advCsv.limitlevel) | |
| 361 | 361 | end |
| 362 | 362 | local advPass = role:getProperty("advPass") |
| 363 | 363 | local addPre |
| 364 | 364 | addPre = function(chapterId) |
| 365 | - local advData = csvdb["adv_chapterCsv"][chapterId] | |
| 366 | - for pre, l in ipairs(advData.prepose:toNumMap()) do | |
| 365 | + local advCsv = csvdb["adv_chapterCsv"][chapterId] | |
| 366 | + for pre, l in ipairs(advCsv.prepose:toNumMap()) do | |
| 367 | 367 | if (advPass[pre] or 0) < l then |
| 368 | 368 | advPass[pre] = l |
| 369 | 369 | addPre(pre) |
| ... | ... | @@ -384,15 +384,15 @@ table.insert(helpDes, {"冒险到达指定层", "advt", "章节id", "层数"}) |
| 384 | 384 | function _M.advt(role, pms) |
| 385 | 385 | local chapterId = tonum(pms.pm1) |
| 386 | 386 | local layer = tonum(pms.pm2) |
| 387 | - local advData = csvdb["adv_chapterCsv"][chapterId] | |
| 388 | - if not advData then return "不存在的章节" end | |
| 387 | + local advCsv = csvdb["adv_chapterCsv"][chapterId] | |
| 388 | + if not advCsv then return "不存在的章节" end | |
| 389 | 389 | |
| 390 | 390 | local advData = role:getAdvData() |
| 391 | 391 | if not advData.chapterId then |
| 392 | 392 | return "先随便开启一关" |
| 393 | 393 | end |
| 394 | 394 | if not advData:isEndless() then |
| 395 | - layer = math.min(layer, advData.limitlevel) | |
| 395 | + layer = math.min(layer, advCsv.limitlevel) | |
| 396 | 396 | end |
| 397 | 397 | |
| 398 | 398 | _M.adv(role, {pm1 = chapterId, pm2 = layer - 1}) | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -89,11 +89,14 @@ function _M.startRpc( agent, data ) |
| 89 | 89 | local isNew = not hangInfo.carbonId |
| 90 | 90 | hangInfo.carbonId = carbonId |
| 91 | 91 | local nowTime = skynet.timex() |
| 92 | - hangInfo.coinTime = nowTime | |
| 93 | - hangInfo.itemTime = nowTime | |
| 94 | 92 | if isNew then |
| 93 | + hangInfo.coinTime = nowTime | |
| 94 | + hangInfo.itemTime = nowTime | |
| 95 | 95 | hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max |
| 96 | 96 | hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max |
| 97 | + else | |
| 98 | + hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) | |
| 99 | + hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) | |
| 97 | 100 | end |
| 98 | 101 | if not hangPass[carbonId] then |
| 99 | 102 | hangInfo.bossTime = nowTime + carbonData.idle_time |
| ... | ... | @@ -444,8 +447,6 @@ function _M.startBonusBattleRpc(agent, data) |
| 444 | 447 | local bonusC = role.dailyData:getProperty("bonusC") |
| 445 | 448 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} |
| 446 | 449 | if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 4 end |
| 447 | - bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 | |
| 448 | - role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | |
| 449 | 450 | |
| 450 | 451 | |
| 451 | 452 | role.__bonusBattleCache = { |
| ... | ... | @@ -469,6 +470,13 @@ function _M.endBonusBattleRpc(agent, data) |
| 469 | 470 | |
| 470 | 471 | local reward |
| 471 | 472 | if starNum and starNum > 0 then |
| 473 | + -- 胜利扣除次数 | |
| 474 | + local bonusC = role.dailyData:getProperty("bonusC") | |
| 475 | + bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | |
| 476 | + if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 3 end | |
| 477 | + bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 | |
| 478 | + role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | |
| 479 | + | |
| 472 | 480 | reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}}) |
| 473 | 481 | role:checkTaskEnter("BonusPass", {id = id}) |
| 474 | 482 | end | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -72,24 +72,8 @@ function _M.wakeRpc(agent, data) |
| 72 | 72 | return 4 |
| 73 | 73 | end |
| 74 | 74 | |
| 75 | - local skills = {} | |
| 76 | - for _,v in pairs(wakeData.skill:toArray(true,"=") ) do | |
| 77 | - local skillSet = hero:getSkillData(v) | |
| 78 | - if skillSet and next(skillSet) then | |
| 79 | - local skillLv = hero:getSkillLevel(v)+1 | |
| 80 | - local skillData = skillSet[skillLv] | |
| 81 | - if skillData and next(skillData) then | |
| 82 | - skills[v] = skillLv | |
| 83 | - else | |
| 84 | - return 5 | |
| 85 | - end | |
| 86 | - end | |
| 87 | - end | |
| 88 | - | |
| 89 | 75 | role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) |
| 90 | - for k,v in pairs(skills) do | |
| 91 | - hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(k, v)}) | |
| 92 | - end | |
| 76 | + | |
| 93 | 77 | hero:updateProperty({field = "wakeL", delta = 1}) |
| 94 | 78 | |
| 95 | 79 | local curLevel = hero:getProperty("wakeL") |
| ... | ... | @@ -104,22 +88,6 @@ function _M.wakeRpc(agent, data) |
| 104 | 88 | return true |
| 105 | 89 | end |
| 106 | 90 | |
| 107 | --- 已取消技能升级功能,觉醒时自动升级技能 | |
| 108 | -function _M.skillUpRpc(agent, data) | |
| 109 | - local role = agent.role | |
| 110 | - local msg = MsgPack.unpack(data) | |
| 111 | - local index = msg.skillIdx -- 第几个技能 -- 1 2 3 | |
| 112 | - local hero = role.heros[msg.id] | |
| 113 | - if not hero then return end | |
| 114 | - local curLevel = hero:getSkillLevel(index) | |
| 115 | - if hero:getLSPoint() <= 0 or curLevel >= #hero:getSkillData(index) then return end | |
| 116 | - hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(index, curLevel + 1)}) | |
| 117 | - | |
| 118 | - hero:log({desc = "skillUp", int1 = index, int2 = curLevel + 1}) | |
| 119 | - | |
| 120 | - SendPacket(actionCodes.Hero_skillUpRpc, '') | |
| 121 | - return true | |
| 122 | -end | |
| 123 | 91 | |
| 124 | 92 | function _M.talentRpc(agent, data) |
| 125 | 93 | local role = agent.role |
| ... | ... | @@ -128,52 +96,62 @@ function _M.talentRpc(agent, data) |
| 128 | 96 | if not hero then return 1 end |
| 129 | 97 | |
| 130 | 98 | local index = msg.index -- 第几个天赋 |
| 131 | - local need = {[1] = 1, [2] = 1, [3] = 1, [4] = 1} | |
| 99 | + local need = {[0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1} | |
| 132 | 100 | if not need[index] then return 2 end |
| 133 | 101 | |
| 134 | 102 | local talent = hero:getProperty("talent") |
| 135 | 103 | local curStage = talent:getv(0, 1) |
| 136 | - if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return 3 end | |
| 137 | - | |
| 138 | 104 | local curData = csvdb["unit_talentCsv"][curStage] |
| 139 | 105 | if not curData then return 4 end |
| 140 | 106 | |
| 141 | - local level = talent:getv(index, 0) | |
| 142 | - if level >= #curData then return 5 end | |
| 143 | - | |
| 144 | - local talentData = curData[level] | |
| 145 | - if not talentData then return end | |
| 146 | - local cost = talentData.money:toNumMap() | |
| 147 | - local cost2 = talentData.cost:toNumMap() | |
| 148 | - for k,v in pairs(cost2) do | |
| 149 | - cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | |
| 150 | - end | |
| 151 | - if not role:checkItemEnough(cost) then return 6 end | |
| 152 | - role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) | |
| 153 | - talent = talent:incrv(index, 1) | |
| 154 | - | |
| 155 | - --是否进阶 | |
| 156 | - local max = true | |
| 157 | - for i = 1, 4 do | |
| 158 | - if talent:getv(i, 0) < #curData then | |
| 159 | - max = false | |
| 160 | - break | |
| 161 | - end | |
| 162 | - end | |
| 163 | - if max then | |
| 164 | - talent = talent:setv(0, curStage + 1) | |
| 107 | + if index == 0 then | |
| 108 | + if not csvdb["unit_talentCsv"][curStage + 1] then return 11 end | |
| 109 | + --是否进阶 | |
| 110 | + local max = true | |
| 165 | 111 | for i = 1, 4 do |
| 166 | - talent = talent:setv(i, 0) | |
| 112 | + if talent:getv(i, 0) < #curData then | |
| 113 | + max = false | |
| 114 | + break | |
| 115 | + end | |
| 167 | 116 | end |
| 117 | + if max then | |
| 118 | + talent = talent:setv(0, curStage + 1) | |
| 119 | + for i = 1, 4 do | |
| 120 | + talent = talent:setv(i, 0) | |
| 121 | + end | |
| 122 | + else | |
| 123 | + return 12 | |
| 124 | + end | |
| 125 | + else | |
| 126 | + | |
| 127 | + local level = talent:getv(index, 0) | |
| 128 | + if level >= #curData then return 5 end | |
| 129 | + | |
| 130 | + local talentData = curData[level] | |
| 131 | + if not talentData then return end | |
| 132 | + | |
| 133 | + if talentData.lvRequire > hero:getProperty("level") then return 6 end | |
| 134 | + | |
| 135 | + local cost = talentData.money:toNumMap() | |
| 136 | + local cost2 = talentData.cost:toNumMap() | |
| 137 | + for k,v in pairs(cost2) do | |
| 138 | + cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | |
| 139 | + end | |
| 140 | + if not role:checkItemEnough(cost) then return 6 end | |
| 141 | + role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) | |
| 142 | + talent = talent:incrv(index, 1) | |
| 143 | + | |
| 144 | + | |
| 145 | + local aheadLevel = 0 | |
| 146 | + for i = 1, talent:getv(0, 1) - 1 do | |
| 147 | + aheadLevel = aheadLevel + #csvdb["unit_talentCsv"][i] | |
| 148 | + end | |
| 149 | + aheadLevel = aheadLevel + talent:getv(index, 0) | |
| 150 | + | |
| 151 | + role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel}) | |
| 168 | 152 | end |
| 169 | - hero:updateProperty({field = "talent", value = talent}) | |
| 170 | - local aheadLevel = 0 | |
| 171 | - for i = 1, talent:getv(0, 1) - 1 do | |
| 172 | - aheadLevel = aheadLevel + #csvdb["unit_talentCsv"][i] | |
| 173 | - end | |
| 174 | - aheadLevel = aheadLevel + talent:getv(index, 0) | |
| 175 | 153 | |
| 176 | - role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel}) | |
| 154 | + hero:updateProperty({field = "talent", value = talent}) | |
| 177 | 155 | |
| 178 | 156 | hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) |
| 179 | 157 | |
| ... | ... | @@ -181,6 +159,7 @@ function _M.talentRpc(agent, data) |
| 181 | 159 | return true |
| 182 | 160 | end |
| 183 | 161 | |
| 162 | + | |
| 184 | 163 | -- 暂时没有这个功能 |
| 185 | 164 | function _M.likeHeroRpc(agent, data) |
| 186 | 165 | local role = agent.role | ... | ... |
src/actions/PvpAction.lua
| ... | ... | @@ -817,7 +817,7 @@ function _M.highDivisionGiftRpc(agent, data) |
| 817 | 817 | local role = agent.role |
| 818 | 818 | local roleId = role:getProperty("id") |
| 819 | 819 | |
| 820 | - local pvpHGTime = self:getProperty("pvpHGTime") | |
| 820 | + local pvpHGTime = role:getProperty("pvpHGTime") | |
| 821 | 821 | if pvpHGTime == 0 then return end |
| 822 | 822 | local score = role:unpackPvpScore(redisproxy:zscore(role:getPvpDBKey(RANK_PVP_HIGHT), roleId)) |
| 823 | 823 | |
| ... | ... | @@ -833,7 +833,7 @@ function _M.highDivisionGiftRpc(agent, data) |
| 833 | 833 | local newTime, newReward = role:calculatePvpHGift(divisionId) |
| 834 | 834 | if not next(newReward) then return end |
| 835 | 835 | |
| 836 | - self:updateProperties({ | |
| 836 | + role:updateProperties({ | |
| 837 | 837 | pvpHGTime = newTime, |
| 838 | 838 | pvpHGift = {}, |
| 839 | 839 | }) | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -28,7 +28,7 @@ function _M.rechargeRpc(agent , data) |
| 28 | 28 | local rmb = dataSet.rmb |
| 29 | 29 | role:updateProperty({field = "rmbC", delta = rmb}) |
| 30 | 30 | |
| 31 | - role:log("role_action", {desc = "recharge", int1 = id}) | |
| 31 | + role:log("role_action", {desc = "recharge", int1 = id, int2 = rmb}) | |
| 32 | 32 | |
| 33 | 33 | SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount})) |
| 34 | 34 | return true |
| ... | ... | @@ -49,14 +49,10 @@ function _M.dailyBuyRpc(agent , data) |
| 49 | 49 | if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dailySDC[id] or 0))) then return 1 end |
| 50 | 50 | |
| 51 | 51 | local cost = dataSet.cost |
| 52 | - if dataSet.type == 0 then | |
| 53 | - local dailySDD = role.dailyData:getProperty("dailySDD") | |
| 54 | - if dailySDD[id] then -- 折扣 | |
| 55 | - cost = math.ceil(cost * (1 - dataSet.disount / 100)) | |
| 56 | - end | |
| 57 | - elseif dataSet.type == 1 then | |
| 58 | - else | |
| 59 | - return 3 | |
| 52 | + | |
| 53 | + local dailySDD = role.dailyData:getProperty("dailySDD") | |
| 54 | + if dailySDD[id] then -- 折扣 | |
| 55 | + cost = math.ceil(cost * (1 - dataSet.disount / 100)) | |
| 60 | 56 | end |
| 61 | 57 | |
| 62 | 58 | if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then |
| ... | ... | @@ -67,7 +63,11 @@ function _M.dailyBuyRpc(agent , data) |
| 67 | 63 | dailySDC[id] = (dailySDC[id] or 0) + count |
| 68 | 64 | role.dailyData:updateProperty({field = "dailySDC", value = dailySDC}) |
| 69 | 65 | end |
| 70 | - local reward = role:award(dataSet.gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) | |
| 66 | + local gift = {} | |
| 67 | + for itemId, count_ in pairs(dataSet.gift:toNumMap()) do | |
| 68 | + gift[itemId] = count_ * count | |
| 69 | + end | |
| 70 | + local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) | |
| 71 | 71 | |
| 72 | 72 | role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count}) |
| 73 | 73 | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -111,6 +111,11 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt |
| 111 | 111 | else |
| 112 | 112 | mapId = self:randomMapId(chapterId, level) |
| 113 | 113 | end |
| 114 | + | |
| 115 | + if isEnter and not self.owner:checkOverGuide(GuideStep.AdvGuide) then | |
| 116 | + mapId = 101 | |
| 117 | + end | |
| 118 | + | |
| 114 | 119 | self.isRelay = isRelay |
| 115 | 120 | local isNewRelay = false |
| 116 | 121 | if self.isRelay then -- 中继层 |
| ... | ... | @@ -120,7 +125,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt |
| 120 | 125 | isNewRelay = true |
| 121 | 126 | advRelay[chapter] = advRelay[chapter] or {} |
| 122 | 127 | advRelay[chapter][self.level] = 1 |
| 123 | - self.owner:updateProperty({field = advRelay, value = advRelay}) | |
| 128 | + self.owner:updateProperty({field = "advRelay", value = advRelay}) | |
| 124 | 129 | end |
| 125 | 130 | end |
| 126 | 131 | |
| ... | ... | @@ -454,8 +459,9 @@ function Adv:awardArtifact(id, params) |
| 454 | 459 | else |
| 455 | 460 | print("awardArtifact no log ", debug.traceback()) |
| 456 | 461 | end |
| 457 | - | |
| 458 | - self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) | |
| 462 | + if not params.isChoose then | |
| 463 | + self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) | |
| 464 | + end | |
| 459 | 465 | end |
| 460 | 466 | |
| 461 | 467 | |
| ... | ... | @@ -645,7 +651,7 @@ end |
| 645 | 651 | |
| 646 | 652 | function Adv:chooseArtifact(index) |
| 647 | 653 | if not self.waitArtifact or not self.waitArtifact[index] then return end |
| 648 | - self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}}) | |
| 654 | + self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true}) | |
| 649 | 655 | |
| 650 | 656 | self:log({desc = "chooseArtifact", int1 = self.waitArtifact[index]}) |
| 651 | 657 | |
| ... | ... | @@ -882,8 +888,13 @@ function Adv:cost(item, params, check) |
| 882 | 888 | end |
| 883 | 889 | |
| 884 | 890 | --事件点击处理 |
| 885 | -local function clickOut(self, room, block, params) | |
| 891 | +local function clickOut(self, room, block, params, isExit) | |
| 886 | 892 | if self:getCurMap():checkOver() then --检查是否可以出去了 |
| 893 | + if isExit then | |
| 894 | + self:over(true) | |
| 895 | + return true | |
| 896 | + end | |
| 897 | + | |
| 887 | 898 | if #self.mapStack > 1 then -- 处于夹层中 |
| 888 | 899 | table.remove(self.mapStack) --退出夹层 |
| 889 | 900 | self:backLayer(-1) |
| ... | ... | @@ -937,8 +948,7 @@ local function clickOut(self, room, block, params) |
| 937 | 948 | end |
| 938 | 949 | |
| 939 | 950 | local function clickExit(self, room, block, params) |
| 940 | - self:over(true) | |
| 941 | - return true | |
| 951 | + return clickOut(self, room, block, params, true) | |
| 942 | 952 | end |
| 943 | 953 | |
| 944 | 954 | --战斗 普通攻击 |
| ... | ... | @@ -1351,8 +1361,14 @@ function Adv:clickBlock(roomId, blockId, params) |
| 1351 | 1361 | end |
| 1352 | 1362 | |
| 1353 | 1363 | if not block.isOpen then |
| 1354 | - if checkAroundBlocks() then --开放 | |
| 1364 | + if self.isRelay or checkAroundBlocks() then --开放 | |
| 1355 | 1365 | self:getCurMap():openBlock(roomId, blockId, true, true) |
| 1366 | + if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 | |
| 1367 | + local relayData = self:isHaveRelay() | |
| 1368 | + if relayData and relayData.award ~= "" then | |
| 1369 | + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | |
| 1370 | + end | |
| 1371 | + end | |
| 1356 | 1372 | status = true |
| 1357 | 1373 | end |
| 1358 | 1374 | else | ... | ... |
src/adv/AdvBlock.lua
| ... | ... | @@ -158,6 +158,8 @@ function Block:randomEvent() |
| 158 | 158 | for _, buffId in ipairs(buffs) do |
| 159 | 159 | adv.battle.player:addBuff(buffId) |
| 160 | 160 | end |
| 161 | + | |
| 162 | + local backTrap = true | |
| 161 | 163 | if data.target == 1 then-- 给所有敌人同样增加buff |
| 162 | 164 | local enemys = adv.battle.player:getTeam(2) |
| 163 | 165 | for k , enemy in ipairs(enemys) do |
| ... | ... | @@ -165,7 +167,11 @@ function Block:randomEvent() |
| 165 | 167 | enemy:addBuff(buffId) |
| 166 | 168 | end |
| 167 | 169 | end |
| 170 | + elseif data.target == 2 then -- 翻开房间 | |
| 171 | + self.room.map.adv:getCurMap():openBlocksByRoom(self.room.roomId) | |
| 172 | + backTrap = false | |
| 168 | 173 | end |
| 174 | + | |
| 169 | 175 | if data.specialEff ~= "" then |
| 170 | 176 | local effect = data.specialEff:toArray(true, "=") |
| 171 | 177 | if effect[1] == 1 then |
| ... | ... | @@ -174,7 +180,9 @@ function Block:randomEvent() |
| 174 | 180 | end |
| 175 | 181 | |
| 176 | 182 | adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id) |
| 177 | - adv:backTrap() | |
| 183 | + if backTrap then | |
| 184 | + adv:backTrap() | |
| 185 | + end | |
| 178 | 186 | self:clear() |
| 179 | 187 | end |
| 180 | 188 | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -19,17 +19,17 @@ function Map:ctor(adv, mapIdx, mapInfo, isEnter, isNewRelay) |
| 19 | 19 | self.mapId = mapInfo.mapId |
| 20 | 20 | self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用 |
| 21 | 21 | self.rooms = {} |
| 22 | - self:loadRooms(mapInfo.rooms) | |
| 22 | + self:loadRooms(mapInfo.rooms, isNewRelay) | |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | -function Map:loadRooms(rooms) | |
| 25 | +function Map:loadRooms(rooms, isNewRelay) | |
| 26 | 26 | local mapData = csvdb["map_" .. csvdb["mapCsv"][self.mapId]["path"] .. "Csv"] |
| 27 | 27 | for roomId, roomName in pairs(mapData["rooms"]) do |
| 28 | 28 | if roomName == "path" then |
| 29 | - self.rooms[roomId] = Room.new(self, roomId, mapData["path"], rooms[roomId], true) | |
| 29 | + self.rooms[roomId] = Room.new(self, roomId, mapData["path"], rooms[roomId], true, isNewRelay) | |
| 30 | 30 | else |
| 31 | 31 | roomName = roomName:gsub("/", "_") |
| 32 | - self.rooms[roomId] = Room.new(self, roomId, csvdb["room_" .. roomName .. "Csv"], rooms[roomId], false) | |
| 32 | + self.rooms[roomId] = Room.new(self, roomId, csvdb["room_" .. roomName .. "Csv"], rooms[roomId], false, isNewRelay) | |
| 33 | 33 | end |
| 34 | 34 | end |
| 35 | 35 | end |
| ... | ... | @@ -55,6 +55,17 @@ function Map:showMap() |
| 55 | 55 | self.isShow = true |
| 56 | 56 | end |
| 57 | 57 | |
| 58 | +function Map:isAllOpen() | |
| 59 | + for roomId, room in pairs(self.rooms) do | |
| 60 | + for blockId, block in pairs(room.blocks) do | |
| 61 | + if not block.isOpen then | |
| 62 | + return false | |
| 63 | + end | |
| 64 | + end | |
| 65 | + end | |
| 66 | + return true | |
| 67 | +end | |
| 68 | + | |
| 58 | 69 | --结束本层的时候调用 |
| 59 | 70 | function Map:checkOver() |
| 60 | 71 | local mapCsv = csvdb["mapCsv"][self.mapId] |
| ... | ... | @@ -65,6 +76,8 @@ function Map:checkOver() |
| 65 | 76 | if #self.adv.battle.player:getTeam(2) == 0 then return true end |
| 66 | 77 | elseif mapCsv.clearType == 3 then -- 持有 |
| 67 | 78 | if self.adv:cost(mapCsv.clear:toNumMap(), {}, true) then return true end |
| 79 | + elseif mapCsv.clearType == 4 then | |
| 80 | + return self:isAllOpen() | |
| 68 | 81 | else |
| 69 | 82 | return true |
| 70 | 83 | end |
| ... | ... | @@ -279,13 +292,13 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
| 279 | 292 | randomFunc[AdvEventType.In] = function()end |
| 280 | 293 | --出口 |
| 281 | 294 | randomFunc[AdvEventType.Out] = function() |
| 282 | - if not self.adv:isEndless() and isNewRelay then | |
| 295 | + if not self.adv:isEndless() and self.adv.isRelay and not self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then | |
| 283 | 296 | return false |
| 284 | 297 | end |
| 285 | 298 | end |
| 286 | 299 | --中继点出口 |
| 287 | 300 | randomFunc[AdvEventType.Exit] = function() |
| 288 | - if not self.adv.isRelay or isEnter then return false end | |
| 301 | + if not self.adv.isRelay or self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then return false end | |
| 289 | 302 | end |
| 290 | 303 | --开放出口 |
| 291 | 304 | randomFunc[AdvEventType.InOut] = function() end |
| ... | ... | @@ -390,6 +403,8 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
| 390 | 403 | if self.adv.isRelay and isNewRelay then |
| 391 | 404 | local relayData = self.adv:isHaveRelay() |
| 392 | 405 | if relayData then |
| 406 | + | |
| 407 | + -- choose | |
| 393 | 408 | local choose = relayData.choose:toArray(true, "=") |
| 394 | 409 | local lastCount = stagePool["global"][AdvCodeRandomStage] and #stagePool["global"][AdvCodeRandomStage] or 0 |
| 395 | 410 | for _, chooseId in pairs(choose) do |
| ... | ... | @@ -403,6 +418,22 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
| 403 | 418 | lastCount = lastCount - 1 |
| 404 | 419 | stagePool[cur["room"]][AdvCodeRandomStage][cur["block"]] = nil |
| 405 | 420 | end |
| 421 | + | |
| 422 | + -- 掉落 | |
| 423 | + local drop = relayData.drop:toNumMap() | |
| 424 | + for dropId, dropCount in pairs(drop) do | |
| 425 | + for i = 1, dropCount do | |
| 426 | + if lastCount <= 0 then break end | |
| 427 | + local idx = math.randomInt(1, lastCount) | |
| 428 | + local cur = stagePool["global"][AdvCodeRandomStage][idx] | |
| 429 | + | |
| 430 | + giveEvent(cur["room"], cur["block"], AdvEventType.Drop, dropId) | |
| 431 | + | |
| 432 | + table.remove(stagePool["global"][AdvCodeRandomStage], idx) | |
| 433 | + lastCount = lastCount - 1 | |
| 434 | + stagePool[cur["room"]][AdvCodeRandomStage][cur["block"]] = nil | |
| 435 | + end | |
| 436 | + end | |
| 406 | 437 | end |
| 407 | 438 | end |
| 408 | 439 | ... | ... |
src/adv/AdvRoom.lua
| ... | ... | @@ -5,7 +5,7 @@ local Block = require "adv.AdvBlock" |
| 5 | 5 | local Passive = require "adv.AdvPassive" |
| 6 | 6 | |
| 7 | 7 | local Room = class("AdvRoom") |
| 8 | -function Room:ctor(map, roomId, csvData, info, isPath) | |
| 8 | +function Room:ctor(map, roomId, csvData, info, isPath, isNewRelay) | |
| 9 | 9 | self.map = map |
| 10 | 10 | self.roomId = roomId |
| 11 | 11 | self.col, self.row = AdvCommon.getCrById(self.roomId) |
| ... | ... | @@ -15,10 +15,10 @@ function Room:ctor(map, roomId, csvData, info, isPath) |
| 15 | 15 | self.battleAfterCall = {} |
| 16 | 16 | |
| 17 | 17 | self.blocks = {} |
| 18 | - self:loadBlocks(csvData, info) | |
| 18 | + self:loadBlocks(csvData, info, isNewRelay) | |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | -function Room:loadBlocks(csvData, info) | |
| 21 | +function Room:loadBlocks(csvData, info, isNewRelay) | |
| 22 | 22 | local isFirstOpen = false |
| 23 | 23 | for blockId, _ in pairs(csvData["blocks"]) do |
| 24 | 24 | self.blocks[blockId] = Block.new(self, blockId, info.event[blockId], info.open == 1 or info.open[blockId], info.trap[blockId]) |
| ... | ... | @@ -38,7 +38,7 @@ function Room:loadBlocks(csvData, info) |
| 38 | 38 | end |
| 39 | 39 | end |
| 40 | 40 | --中继层全部开放 boss 房间 开启所有的地块 |
| 41 | - if self.map.adv.isRelay or (self.isBossRoom and self.isShow and isFirstOpen) then | |
| 41 | + if (self.map.adv.isRelay and not isNewRelay) or (self.isBossRoom and self.isShow and isFirstOpen) then | |
| 42 | 42 | table.insert(self.battleAfterCall, function() |
| 43 | 43 | for _, block in pairs(self.blocks) do |
| 44 | 44 | self:openBlock(block) | ... | ... |
src/models/Daily.lua
| ... | ... | @@ -64,7 +64,7 @@ function Daily:refreshDailyData(notify) |
| 64 | 64 | local dailySDD = {} |
| 65 | 65 | local sddPool = {} |
| 66 | 66 | for id, data in pairs(csvdb["shop_diamondCsv"]) do |
| 67 | - if data.type == 0 and data.disount ~= 0 then | |
| 67 | + if data.disount ~= 0 then | |
| 68 | 68 | table.insert(sddPool, id) |
| 69 | 69 | end |
| 70 | 70 | end | ... | ... |
src/models/Diner.lua
| ... | ... | @@ -52,14 +52,14 @@ function Diner:refreshDailyData(notify) |
| 52 | 52 | end |
| 53 | 53 | end |
| 54 | 54 | if show then |
| 55 | - table.insert(pool, id) | |
| 55 | + table.insert(pool, {id, data.chance}) | |
| 56 | 56 | end |
| 57 | 57 | end |
| 58 | 58 | end |
| 59 | 59 | |
| 60 | 60 | if #pool > 0 then |
| 61 | - local idx = math.randomInt(1, #pool) | |
| 62 | - entrust[i] = pool[idx] | |
| 61 | + local idx = math.randWeight(pool, 2) | |
| 62 | + entrust[i] = pool[idx][1] | |
| 63 | 63 | change = true |
| 64 | 64 | table.remove(pool, idx) |
| 65 | 65 | end |
| ... | ... | @@ -92,8 +92,16 @@ function Diner:refreshDailyData(notify) |
| 92 | 92 | local taskData = csvdb["diner_questCsv"][taskLevel] |
| 93 | 93 | if not taskData then return end |
| 94 | 94 | local pool = {} |
| 95 | + local dishTree = self:getProperty("dishTree") | |
| 95 | 96 | for id, temp in pairs(taskData) do |
| 96 | - if not hadTask[id] then | |
| 97 | + local unlock = true | |
| 98 | + for _, front in ipairs(temp.front:toArray(true, "=")) do | |
| 99 | + if dishTree:getv(front, 0) == 0 then | |
| 100 | + unlock = false | |
| 101 | + break | |
| 102 | + end | |
| 103 | + end | |
| 104 | + if not hadTask[id] and unlock then | |
| 97 | 105 | table.insert(pool, temp) |
| 98 | 106 | end |
| 99 | 107 | end | ... | ... |
src/models/Hero.lua
| ... | ... | @@ -9,7 +9,6 @@ Hero.schema = { |
| 9 | 9 | level = {"number", 1}, -- 等级 |
| 10 | 10 | breakL = {"number", 0}, -- 突破等级 |
| 11 | 11 | wakeL = {"number", 1}, -- 觉醒等级 |
| 12 | - skillL = {"string", ""}, -- 技能等级 1=1 2=1 3=1 | |
| 13 | 12 | talent = {"string", ""}, -- 0=阶段 1=1 2=1 3=1 4=1 四个天赋当前阶段的等级 阶段默认为1 等级默认为0 |
| 14 | 13 | battleV = {"number", 0}, -- 保存战斗力 |
| 15 | 14 | -- loveExp = {"number", 0}, --好感度经验 |
| ... | ... | @@ -97,7 +96,6 @@ function Hero:data() |
| 97 | 96 | level = self:getProperty("level"), |
| 98 | 97 | breakL = self:getProperty("breakL"), |
| 99 | 98 | wakeL = self:getProperty("wakeL"), |
| 100 | - skillL = self:getProperty("skillL"), | |
| 101 | 99 | talent = self:getProperty("talent"), |
| 102 | 100 | battleV = self:getProperty("battleV"), |
| 103 | 101 | -- loveExp = self:getProperty("loveExp"), | ... | ... |
src/models/HeroPlugin.lua
| ... | ... | @@ -18,24 +18,6 @@ function HeroPlugin.bind(Hero) |
| 18 | 18 | return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit) |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | - function Hero:getSPoint() | |
| 22 | - local point = 0 | |
| 23 | - for i = 0, self:getProperty("wakeL") do | |
| 24 | - if csvdb["unit_wakeCsv"][i] then | |
| 25 | - point = point + csvdb["unit_wakeCsv"][i].sp | |
| 26 | - end | |
| 27 | - end | |
| 28 | - return point | |
| 29 | - end | |
| 30 | - | |
| 31 | - function Hero:getLSPoint() | |
| 32 | - local point = self:getSPoint() | |
| 33 | - for skill, level in pairs(self:getProperty("skillL"):toNumMap()) do | |
| 34 | - point = point - (level - 1) | |
| 35 | - end | |
| 36 | - return point | |
| 37 | - end | |
| 38 | - | |
| 39 | 21 | --角色属性值 = 基础属性值(unit)* [ 1 + 升级属性(unit_exp)+ 突破属性(unit_break)] * [ 1 + 觉醒属性(unit_wake)+ 天赋属性(unit_talent)] |
| 40 | 22 | function Hero:getBaseAttrs(params) |
| 41 | 23 | params = params or {} |
| ... | ... | @@ -211,7 +193,16 @@ function HeroPlugin.bind(Hero) |
| 211 | 193 | |
| 212 | 194 | -- 技能1234 对应必杀技,冒险技,被动技,战斗技 |
| 213 | 195 | function Hero:getSkillLevel(idx) |
| 214 | - return self:getProperty("skillL"):getv(idx, 1) | |
| 196 | + local level = 1 | |
| 197 | + for wakeL = 1, self:getProperty("wakeL") do | |
| 198 | + local wakeData = csvdb["unit_wakeCsv"][wakeL] | |
| 199 | + for _, slot in ipairs(wakeData.skill:toArray(true,"=")) do | |
| 200 | + if slot == idx then | |
| 201 | + level = level + 1 | |
| 202 | + end | |
| 203 | + end | |
| 204 | + end | |
| 205 | + return level | |
| 215 | 206 | end |
| 216 | 207 | |
| 217 | 208 | function Hero:getSkillData(idx) | ... | ... |
src/models/RoleCross.lua
| ... | ... | @@ -308,7 +308,7 @@ function CMD.pvpHInfo(roleId) |
| 308 | 308 | end |
| 309 | 309 | |
| 310 | 310 | -- 高级pvp 排行榜 |
| 311 | -function CMD:pvpHRankInfo(roleId) | |
| 311 | +function CMD.pvpHRankInfo(roleId) | |
| 312 | 312 | local info = CMD.getProperties(roleId, {"name", "level", "headId", "pvpTBVH", "ltime"}) |
| 313 | 313 | local info = { |
| 314 | 314 | name = info.name, | ... | ... |
src/models/RoleLog.lua
| ... | ... | @@ -36,7 +36,7 @@ local LogType = { |
| 36 | 36 | |
| 37 | 37 | -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* |
| 38 | 38 | local Mapping = { |
| 39 | - -- 预留一些数据格式 | |
| 39 | + -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long | |
| 40 | 40 | common = { |
| 41 | 41 | desc = "keyword",--索引的短字符串 |
| 42 | 42 | ucode = "keyword",--关联日志对应ucode |
| ... | ... | @@ -46,15 +46,15 @@ local Mapping = { |
| 46 | 46 | text1 = "text", --长字符串不索引的类型 |
| 47 | 47 | -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用 |
| 48 | 48 | short1 = "short", |
| 49 | - int1 = "integer", | |
| 50 | - int2 = "integer", | |
| 49 | + int1 = "long", | |
| 50 | + int2 = "long", | |
| 51 | 51 | long1 = "long", |
| 52 | 52 | float1 = "float", |
| 53 | 53 | |
| 54 | 54 | -- 底层使用的 一些参数 |
| 55 | - cint1 = "integer", | |
| 56 | - cint2 = "integer", | |
| 57 | - cint3 = "integer", | |
| 55 | + cint1 = "long", | |
| 56 | + cint2 = "long", | |
| 57 | + cint3 = "long", | |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -1372,6 +1372,15 @@ function RolePlugin.bind(Role) |
| 1372 | 1372 | return RANK_ADV[idx] |
| 1373 | 1373 | end |
| 1374 | 1374 | |
| 1375 | + -- 是否需要进行引导 | |
| 1376 | + function Role:checkOverGuide(guideId) | |
| 1377 | + local funcGuide = self:getProperty("funcGuide") | |
| 1378 | + if funcGuide:getv(guideId, 0) > 0 then | |
| 1379 | + return true | |
| 1380 | + end | |
| 1381 | + return false | |
| 1382 | + end | |
| 1383 | + | |
| 1375 | 1384 | end |
| 1376 | 1385 | |
| 1377 | 1386 | return RolePlugin |
| 1378 | 1387 | \ No newline at end of file | ... | ... |
src/models/RolePvp.lua
| ... | ... | @@ -98,7 +98,7 @@ function Role:calculatePvpHGift(division) |
| 98 | 98 | newTime = oldTime + times * globalCsv.pvp_high_reward_add_pre |
| 99 | 99 | |
| 100 | 100 | for itemId, count in pairs(divisionData.reward:toNumMap()) do |
| 101 | - newReward[itemId] = math.min((newReward[itemId] or 0) + count, divisionData.limit) | |
| 101 | + newReward[itemId] = math.min((newReward[itemId] or 0) + count * times, divisionData.limit) | |
| 102 | 102 | end |
| 103 | 103 | end |
| 104 | 104 | return newTime, newReward | ... | ... |