Commit 8bbfdd033d7f61548a622ae17881ad700a3578ea

Authored by zhouhaihai
2 parents eb5b69f0 2ab0d91b

Merge branch 'develop' into qa

@@ -130,6 +130,11 @@ TimeReset = { @@ -130,6 +130,11 @@ TimeReset = {
130 DailyBattle3 = 16, -- 特殊-每日副本(时钟箱) 130 DailyBattle3 = 16, -- 特殊-每日副本(时钟箱)
131 } 131 }
132 132
  133 +GuideStep = {
  134 + AdvGuide = 1010,
  135 + AdvRelay = 1012,
  136 +}
  137 +
133 --客户端不需要知道这个 138 --客户端不需要知道这个
134 AdvSpecialStage = { 139 AdvSpecialStage = {
135 [1]= "In", 140 [1]= "In",
@@ -179,7 +184,7 @@ AdvBackEventType = { @@ -179,7 +184,7 @@ AdvBackEventType = {
179 Dead = 11, --怪死亡 184 Dead = 11, --怪死亡
180 Trader = 12, -- 召唤商人 185 Trader = 12, -- 召唤商人
181 Monster = 13, -- 召唤怪物 186 Monster = 13, -- 召唤怪物
182 - 187 + RelayReward = 14, -- 中级层奖励
183 188
184 Cost = 16, -- 消耗道具 189 Cost = 16, -- 消耗道具
185 Trap = 17, --陷阱 190 Trap = 17, --陷阱
src/ProtocolCode.lua
@@ -69,7 +69,7 @@ actionCodes = { @@ -69,7 +69,7 @@ actionCodes = {
69 Hero_levelUpRpc = 203, 69 Hero_levelUpRpc = 203,
70 Hero_breakRpc = 204, 70 Hero_breakRpc = 204,
71 Hero_wakeRpc = 205, 71 Hero_wakeRpc = 205,
72 - Hero_skillUpRpc = 206, 72 +
73 Hero_talentRpc = 207, 73 Hero_talentRpc = 207,
74 Hero_likeHeroRpc = 208, 74 Hero_likeHeroRpc = 208,
75 Hero_commentHeroRpc = 209, 75 Hero_commentHeroRpc = 209,
src/actions/AdvAction.lua
@@ -350,15 +350,22 @@ function _M.clickBlockRpc(agent, data) @@ -350,15 +350,22 @@ function _M.clickBlockRpc(agent, data)
350 local role = agent.role 350 local role = agent.role
351 local msg = MsgPack.unpack(data) 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 local adv = role:getAdvData() 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 adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) 365 adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId})
359 366
360 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) 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 SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()})) 370 SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()}))
364 return true 371 return true
@@ -636,10 +643,10 @@ function _M.wheelSurfRpc(agent, data) @@ -636,10 +643,10 @@ function _M.wheelSurfRpc(agent, data)
636 local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] 643 local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)]
637 if not drawData then return 4 end 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 if not role:checkItemEnough(costs) then return 5 end 651 if not role:checkItemEnough(costs) then return 5 end
645 role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) 652 role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}})
@@ -648,10 +655,10 @@ function _M.wheelSurfRpc(agent, data) @@ -648,10 +655,10 @@ function _M.wheelSurfRpc(agent, data)
648 advDrawB[ptype] = (advDrawB[ptype] or 0) + count 655 advDrawB[ptype] = (advDrawB[ptype] or 0) + count
649 role:updateProperty({field = "advDrawB", value = advDrawB}) 656 role:updateProperty({field = "advDrawB", value = advDrawB})
650 -- 随机池子 657 -- 随机池子
651 - local pool = drawData.weight:randWeight()  
652 local reward = {} 658 local reward = {}
653 local backReward = {} 659 local backReward = {}
654 for i = 1, count do 660 for i = 1, count do
  661 + local pool = drawData.weight:randWeight()
655 local gift = drawData["pool" .. pool]:randWeight(true) 662 local gift = drawData["pool" .. pool]:randWeight(true)
656 reward[gift[1]] = (reward[gift[1]] or 0) + gift[2] 663 reward[gift[1]] = (reward[gift[1]] or 0) + gift[2]
657 table.insert(backReward, gift) 664 table.insert(backReward, gift)
src/actions/DinerAction.lua
@@ -565,8 +565,17 @@ function _M.refreshTaskRpc( agent, data ) @@ -565,8 +565,17 @@ function _M.refreshTaskRpc( agent, data )
565 end 565 end
566 566
567 local pool = {} 567 local pool = {}
  568 +
  569 + local dishTree = role.dinerData:getProperty("dishTree")
568 for id, temp in pairs(taskData) do 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 table.insert(pool, temp) 579 table.insert(pool, temp)
571 end 580 end
572 end 581 end
src/actions/HangAction.lua
@@ -89,11 +89,14 @@ function _M.startRpc( agent, data ) @@ -89,11 +89,14 @@ function _M.startRpc( agent, data )
89 local isNew = not hangInfo.carbonId 89 local isNew = not hangInfo.carbonId
90 hangInfo.carbonId = carbonId 90 hangInfo.carbonId = carbonId
91 local nowTime = skynet.timex() 91 local nowTime = skynet.timex()
92 - hangInfo.coinTime = nowTime  
93 - hangInfo.itemTime = nowTime  
94 if isNew then 92 if isNew then
  93 + hangInfo.coinTime = nowTime
  94 + hangInfo.itemTime = nowTime
95 hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max 95 hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max
96 hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max 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 end 100 end
98 if not hangPass[carbonId] then 101 if not hangPass[carbonId] then
99 hangInfo.bossTime = nowTime + carbonData.idle_time 102 hangInfo.bossTime = nowTime + carbonData.idle_time
@@ -444,8 +447,6 @@ function _M.startBonusBattleRpc(agent, data) @@ -444,8 +447,6 @@ function _M.startBonusBattleRpc(agent, data)
444 local bonusC = role.dailyData:getProperty("bonusC") 447 local bonusC = role.dailyData:getProperty("bonusC")
445 bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} 448 bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0}
446 if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 4 end 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 role.__bonusBattleCache = { 452 role.__bonusBattleCache = {
@@ -469,6 +470,13 @@ function _M.endBonusBattleRpc(agent, data) @@ -469,6 +470,13 @@ function _M.endBonusBattleRpc(agent, data)
469 470
470 local reward 471 local reward
471 if starNum and starNum > 0 then 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 reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}}) 480 reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}})
473 role:checkTaskEnter("BonusPass", {id = id}) 481 role:checkTaskEnter("BonusPass", {id = id})
474 end 482 end
src/actions/HeroAction.lua
@@ -72,24 +72,8 @@ function _M.wakeRpc(agent, data) @@ -72,24 +72,8 @@ function _M.wakeRpc(agent, data)
72 return 4 72 return 4
73 end 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 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) 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 hero:updateProperty({field = "wakeL", delta = 1}) 77 hero:updateProperty({field = "wakeL", delta = 1})
94 78
95 local curLevel = hero:getProperty("wakeL") 79 local curLevel = hero:getProperty("wakeL")
@@ -104,22 +88,6 @@ function _M.wakeRpc(agent, data) @@ -104,22 +88,6 @@ function _M.wakeRpc(agent, data)
104 return true 88 return true
105 end 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 function _M.talentRpc(agent, data) 92 function _M.talentRpc(agent, data)
125 local role = agent.role 93 local role = agent.role
@@ -128,52 +96,62 @@ function _M.talentRpc(agent, data) @@ -128,52 +96,62 @@ function _M.talentRpc(agent, data)
128 if not hero then return 1 end 96 if not hero then return 1 end
129 97
130 local index = msg.index -- 第几个天赋 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 if not need[index] then return 2 end 100 if not need[index] then return 2 end
133 101
134 local talent = hero:getProperty("talent") 102 local talent = hero:getProperty("talent")
135 local curStage = talent:getv(0, 1) 103 local curStage = talent:getv(0, 1)
136 - if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return 3 end  
137 -  
138 local curData = csvdb["unit_talentCsv"][curStage] 104 local curData = csvdb["unit_talentCsv"][curStage]
139 if not curData then return 4 end 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 for i = 1, 4 do 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 end 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 end 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 hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) 156 hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)})
179 157
@@ -181,6 +159,7 @@ function _M.talentRpc(agent, data) @@ -181,6 +159,7 @@ function _M.talentRpc(agent, data)
181 return true 159 return true
182 end 160 end
183 161
  162 +
184 -- 暂时没有这个功能 163 -- 暂时没有这个功能
185 function _M.likeHeroRpc(agent, data) 164 function _M.likeHeroRpc(agent, data)
186 local role = agent.role 165 local role = agent.role
src/actions/StoreAction.lua
@@ -28,7 +28,7 @@ function _M.rechargeRpc(agent , data) @@ -28,7 +28,7 @@ function _M.rechargeRpc(agent , data)
28 local rmb = dataSet.rmb 28 local rmb = dataSet.rmb
29 role:updateProperty({field = "rmbC", delta = rmb}) 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 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount})) 33 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount}))
34 return true 34 return true
@@ -49,14 +49,10 @@ function _M.dailyBuyRpc(agent , data) @@ -49,14 +49,10 @@ function _M.dailyBuyRpc(agent , data)
49 if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dailySDC[id] or 0))) then return 1 end 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 local cost = dataSet.cost 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 end 56 end
61 57
62 if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then 58 if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then
@@ -111,6 +111,11 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt @@ -111,6 +111,11 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
111 else 111 else
112 mapId = self:randomMapId(chapterId, level) 112 mapId = self:randomMapId(chapterId, level)
113 end 113 end
  114 +
  115 + if isEnter and not self.owner:checkOverGuide(GuideStep.AdvGuide) then
  116 + mapId = 101
  117 + end
  118 +
114 self.isRelay = isRelay 119 self.isRelay = isRelay
115 local isNewRelay = false 120 local isNewRelay = false
116 if self.isRelay then -- 中继层 121 if self.isRelay then -- 中继层
@@ -120,7 +125,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt @@ -120,7 +125,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
120 isNewRelay = true 125 isNewRelay = true
121 advRelay[chapter] = advRelay[chapter] or {} 126 advRelay[chapter] = advRelay[chapter] or {}
122 advRelay[chapter][self.level] = 1 127 advRelay[chapter][self.level] = 1
123 - self.owner:updateProperty({field = advRelay, value = advRelay}) 128 + self.owner:updateProperty({field = "advRelay", value = advRelay})
124 end 129 end
125 end 130 end
126 131
@@ -882,8 +887,13 @@ function Adv:cost(item, params, check) @@ -882,8 +887,13 @@ function Adv:cost(item, params, check)
882 end 887 end
883 888
884 --事件点击处理 889 --事件点击处理
885 -local function clickOut(self, room, block, params) 890 +local function clickOut(self, room, block, params, isExit)
886 if self:getCurMap():checkOver() then --检查是否可以出去了 891 if self:getCurMap():checkOver() then --检查是否可以出去了
  892 + if isExit then
  893 + self:over(true)
  894 + return true
  895 + end
  896 +
887 if #self.mapStack > 1 then -- 处于夹层中 897 if #self.mapStack > 1 then -- 处于夹层中
888 table.remove(self.mapStack) --退出夹层 898 table.remove(self.mapStack) --退出夹层
889 self:backLayer(-1) 899 self:backLayer(-1)
@@ -937,8 +947,7 @@ local function clickOut(self, room, block, params) @@ -937,8 +947,7 @@ local function clickOut(self, room, block, params)
937 end 947 end
938 948
939 local function clickExit(self, room, block, params) 949 local function clickExit(self, room, block, params)
940 - self:over(true)  
941 - return true 950 + return clickOut(self, room, block, params, true)
942 end 951 end
943 952
944 --战斗 普通攻击 953 --战斗 普通攻击
@@ -1351,8 +1360,14 @@ function Adv:clickBlock(roomId, blockId, params) @@ -1351,8 +1360,14 @@ function Adv:clickBlock(roomId, blockId, params)
1351 end 1360 end
1352 1361
1353 if not block.isOpen then 1362 if not block.isOpen then
1354 - if checkAroundBlocks() then --开放 1363 + if self.isRelay or checkAroundBlocks() then --开放
1355 self:getCurMap():openBlock(roomId, blockId, true, true) 1364 self:getCurMap():openBlock(roomId, blockId, true, true)
  1365 + if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励
  1366 + local relayData = self:isHaveRelay()
  1367 + if relayData and relayData.award ~= "" then
  1368 + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})})
  1369 + end
  1370 + end
1356 status = true 1371 status = true
1357 end 1372 end
1358 else 1373 else
src/adv/AdvBlock.lua
@@ -158,6 +158,8 @@ function Block:randomEvent() @@ -158,6 +158,8 @@ function Block:randomEvent()
158 for _, buffId in ipairs(buffs) do 158 for _, buffId in ipairs(buffs) do
159 adv.battle.player:addBuff(buffId) 159 adv.battle.player:addBuff(buffId)
160 end 160 end
  161 +
  162 + local backTrap = true
161 if data.target == 1 then-- 给所有敌人同样增加buff 163 if data.target == 1 then-- 给所有敌人同样增加buff
162 local enemys = adv.battle.player:getTeam(2) 164 local enemys = adv.battle.player:getTeam(2)
163 for k , enemy in ipairs(enemys) do 165 for k , enemy in ipairs(enemys) do
@@ -165,7 +167,11 @@ function Block:randomEvent() @@ -165,7 +167,11 @@ function Block:randomEvent()
165 enemy:addBuff(buffId) 167 enemy:addBuff(buffId)
166 end 168 end
167 end 169 end
  170 + elseif data.target == 2 then -- 翻开房间
  171 + self.room.map.adv:getCurMap():openBlocksByRoom(self.room.roomId)
  172 + backTrap = false
168 end 173 end
  174 +
169 if data.specialEff ~= "" then 175 if data.specialEff ~= "" then
170 local effect = data.specialEff:toArray(true, "=") 176 local effect = data.specialEff:toArray(true, "=")
171 if effect[1] == 1 then 177 if effect[1] == 1 then
@@ -174,7 +180,9 @@ function Block:randomEvent() @@ -174,7 +180,9 @@ function Block:randomEvent()
174 end 180 end
175 181
176 adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id) 182 adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id)
177 - adv:backTrap() 183 + if backTrap then
  184 + adv:backTrap()
  185 + end
178 self:clear() 186 self:clear()
179 end 187 end
180 188
src/adv/AdvMap.lua
@@ -19,17 +19,17 @@ function Map:ctor(adv, mapIdx, mapInfo, isEnter, isNewRelay) @@ -19,17 +19,17 @@ function Map:ctor(adv, mapIdx, mapInfo, isEnter, isNewRelay)
19 self.mapId = mapInfo.mapId 19 self.mapId = mapInfo.mapId
20 self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用 20 self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用
21 self.rooms = {} 21 self.rooms = {}
22 - self:loadRooms(mapInfo.rooms) 22 + self:loadRooms(mapInfo.rooms, isNewRelay)
23 end 23 end
24 24
25 -function Map:loadRooms(rooms) 25 +function Map:loadRooms(rooms, isNewRelay)
26 local mapData = csvdb["map_" .. csvdb["mapCsv"][self.mapId]["path"] .. "Csv"] 26 local mapData = csvdb["map_" .. csvdb["mapCsv"][self.mapId]["path"] .. "Csv"]
27 for roomId, roomName in pairs(mapData["rooms"]) do 27 for roomId, roomName in pairs(mapData["rooms"]) do
28 if roomName == "path" then 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 else 30 else
31 roomName = roomName:gsub("/", "_") 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 end 33 end
34 end 34 end
35 end 35 end
@@ -55,6 +55,17 @@ function Map:showMap() @@ -55,6 +55,17 @@ function Map:showMap()
55 self.isShow = true 55 self.isShow = true
56 end 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 function Map:checkOver() 70 function Map:checkOver()
60 local mapCsv = csvdb["mapCsv"][self.mapId] 71 local mapCsv = csvdb["mapCsv"][self.mapId]
@@ -65,6 +76,8 @@ function Map:checkOver() @@ -65,6 +76,8 @@ function Map:checkOver()
65 if #self.adv.battle.player:getTeam(2) == 0 then return true end 76 if #self.adv.battle.player:getTeam(2) == 0 then return true end
66 elseif mapCsv.clearType == 3 then -- 持有 77 elseif mapCsv.clearType == 3 then -- 持有
67 if self.adv:cost(mapCsv.clear:toNumMap(), {}, true) then return true end 78 if self.adv:cost(mapCsv.clear:toNumMap(), {}, true) then return true end
  79 + elseif mapCsv.clearType == 4 then
  80 + return self:isAllOpen()
68 else 81 else
69 return true 82 return true
70 end 83 end
@@ -279,13 +292,13 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -279,13 +292,13 @@ createMap = function(self, mapId, isEnter, isNewRelay)
279 randomFunc[AdvEventType.In] = function()end 292 randomFunc[AdvEventType.In] = function()end
280 --出口 293 --出口
281 randomFunc[AdvEventType.Out] = function() 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 return false 296 return false
284 end 297 end
285 end 298 end
286 --中继点出口 299 --中继点出口
287 randomFunc[AdvEventType.Exit] = function() 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 end 302 end
290 --开放出口 303 --开放出口
291 randomFunc[AdvEventType.InOut] = function() end 304 randomFunc[AdvEventType.InOut] = function() end
@@ -390,6 +403,8 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -390,6 +403,8 @@ createMap = function(self, mapId, isEnter, isNewRelay)
390 if self.adv.isRelay and isNewRelay then 403 if self.adv.isRelay and isNewRelay then
391 local relayData = self.adv:isHaveRelay() 404 local relayData = self.adv:isHaveRelay()
392 if relayData then 405 if relayData then
  406 +
  407 + -- choose
393 local choose = relayData.choose:toArray(true, "=") 408 local choose = relayData.choose:toArray(true, "=")
394 local lastCount = stagePool["global"][AdvCodeRandomStage] and #stagePool["global"][AdvCodeRandomStage] or 0 409 local lastCount = stagePool["global"][AdvCodeRandomStage] and #stagePool["global"][AdvCodeRandomStage] or 0
395 for _, chooseId in pairs(choose) do 410 for _, chooseId in pairs(choose) do
@@ -403,6 +418,22 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -403,6 +418,22 @@ createMap = function(self, mapId, isEnter, isNewRelay)
403 lastCount = lastCount - 1 418 lastCount = lastCount - 1
404 stagePool[cur["room"]][AdvCodeRandomStage][cur["block"]] = nil 419 stagePool[cur["room"]][AdvCodeRandomStage][cur["block"]] = nil
405 end 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 end 437 end
407 end 438 end
408 439
src/adv/AdvRoom.lua
@@ -5,7 +5,7 @@ local Block = require &quot;adv.AdvBlock&quot; @@ -5,7 +5,7 @@ local Block = require &quot;adv.AdvBlock&quot;
5 local Passive = require "adv.AdvPassive" 5 local Passive = require "adv.AdvPassive"
6 6
7 local Room = class("AdvRoom") 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 self.map = map 9 self.map = map
10 self.roomId = roomId 10 self.roomId = roomId
11 self.col, self.row = AdvCommon.getCrById(self.roomId) 11 self.col, self.row = AdvCommon.getCrById(self.roomId)
@@ -15,10 +15,10 @@ function Room:ctor(map, roomId, csvData, info, isPath) @@ -15,10 +15,10 @@ function Room:ctor(map, roomId, csvData, info, isPath)
15 self.battleAfterCall = {} 15 self.battleAfterCall = {}
16 16
17 self.blocks = {} 17 self.blocks = {}
18 - self:loadBlocks(csvData, info) 18 + self:loadBlocks(csvData, info, isNewRelay)
19 end 19 end
20 20
21 -function Room:loadBlocks(csvData, info) 21 +function Room:loadBlocks(csvData, info, isNewRelay)
22 local isFirstOpen = false 22 local isFirstOpen = false
23 for blockId, _ in pairs(csvData["blocks"]) do 23 for blockId, _ in pairs(csvData["blocks"]) do
24 self.blocks[blockId] = Block.new(self, blockId, info.event[blockId], info.open == 1 or info.open[blockId], info.trap[blockId]) 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,7 +38,7 @@ function Room:loadBlocks(csvData, info)
38 end 38 end
39 end 39 end
40 --中继层全部开放 boss 房间 开启所有的地块 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 table.insert(self.battleAfterCall, function() 42 table.insert(self.battleAfterCall, function()
43 for _, block in pairs(self.blocks) do 43 for _, block in pairs(self.blocks) do
44 self:openBlock(block) 44 self:openBlock(block)
src/models/Daily.lua
@@ -64,7 +64,7 @@ function Daily:refreshDailyData(notify) @@ -64,7 +64,7 @@ function Daily:refreshDailyData(notify)
64 local dailySDD = {} 64 local dailySDD = {}
65 local sddPool = {} 65 local sddPool = {}
66 for id, data in pairs(csvdb["shop_diamondCsv"]) do 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 table.insert(sddPool, id) 68 table.insert(sddPool, id)
69 end 69 end
70 end 70 end
src/models/Diner.lua
@@ -52,14 +52,14 @@ function Diner:refreshDailyData(notify) @@ -52,14 +52,14 @@ function Diner:refreshDailyData(notify)
52 end 52 end
53 end 53 end
54 if show then 54 if show then
55 - table.insert(pool, id) 55 + table.insert(pool, {id, data.chance})
56 end 56 end
57 end 57 end
58 end 58 end
59 59
60 if #pool > 0 then 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 change = true 63 change = true
64 table.remove(pool, idx) 64 table.remove(pool, idx)
65 end 65 end
@@ -92,8 +92,16 @@ function Diner:refreshDailyData(notify) @@ -92,8 +92,16 @@ function Diner:refreshDailyData(notify)
92 local taskData = csvdb["diner_questCsv"][taskLevel] 92 local taskData = csvdb["diner_questCsv"][taskLevel]
93 if not taskData then return end 93 if not taskData then return end
94 local pool = {} 94 local pool = {}
  95 + local dishTree = self:getProperty("dishTree")
95 for id, temp in pairs(taskData) do 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 table.insert(pool, temp) 105 table.insert(pool, temp)
98 end 106 end
99 end 107 end
src/models/Hero.lua
@@ -9,7 +9,6 @@ Hero.schema = { @@ -9,7 +9,6 @@ Hero.schema = {
9 level = {"number", 1}, -- 等级 9 level = {"number", 1}, -- 等级
10 breakL = {"number", 0}, -- 突破等级 10 breakL = {"number", 0}, -- 突破等级
11 wakeL = {"number", 1}, -- 觉醒等级 11 wakeL = {"number", 1}, -- 觉醒等级
12 - skillL = {"string", ""}, -- 技能等级 1=1 2=1 3=1  
13 talent = {"string", ""}, -- 0=阶段 1=1 2=1 3=1 4=1 四个天赋当前阶段的等级 阶段默认为1 等级默认为0 12 talent = {"string", ""}, -- 0=阶段 1=1 2=1 3=1 4=1 四个天赋当前阶段的等级 阶段默认为1 等级默认为0
14 battleV = {"number", 0}, -- 保存战斗力 13 battleV = {"number", 0}, -- 保存战斗力
15 -- loveExp = {"number", 0}, --好感度经验 14 -- loveExp = {"number", 0}, --好感度经验
@@ -97,7 +96,6 @@ function Hero:data() @@ -97,7 +96,6 @@ function Hero:data()
97 level = self:getProperty("level"), 96 level = self:getProperty("level"),
98 breakL = self:getProperty("breakL"), 97 breakL = self:getProperty("breakL"),
99 wakeL = self:getProperty("wakeL"), 98 wakeL = self:getProperty("wakeL"),
100 - skillL = self:getProperty("skillL"),  
101 talent = self:getProperty("talent"), 99 talent = self:getProperty("talent"),
102 battleV = self:getProperty("battleV"), 100 battleV = self:getProperty("battleV"),
103 -- loveExp = self:getProperty("loveExp"), 101 -- loveExp = self:getProperty("loveExp"),
src/models/HeroPlugin.lua
@@ -18,24 +18,6 @@ function HeroPlugin.bind(Hero) @@ -18,24 +18,6 @@ function HeroPlugin.bind(Hero)
18 return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit) 18 return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit)
19 end 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 --角色属性值 = 基础属性值(unit)* [ 1 + 升级属性(unit_exp)+ 突破属性(unit_break)] * [ 1 + 觉醒属性(unit_wake)+ 天赋属性(unit_talent)] 21 --角色属性值 = 基础属性值(unit)* [ 1 + 升级属性(unit_exp)+ 突破属性(unit_break)] * [ 1 + 觉醒属性(unit_wake)+ 天赋属性(unit_talent)]
40 function Hero:getBaseAttrs(params) 22 function Hero:getBaseAttrs(params)
41 params = params or {} 23 params = params or {}
@@ -211,7 +193,16 @@ function HeroPlugin.bind(Hero) @@ -211,7 +193,16 @@ function HeroPlugin.bind(Hero)
211 193
212 -- 技能1234 对应必杀技,冒险技,被动技,战斗技 194 -- 技能1234 对应必杀技,冒险技,被动技,战斗技
213 function Hero:getSkillLevel(idx) 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 end 206 end
216 207
217 function Hero:getSkillData(idx) 208 function Hero:getSkillData(idx)
src/models/RoleLog.lua
@@ -36,7 +36,7 @@ local LogType = { @@ -36,7 +36,7 @@ local LogType = {
36 36
37 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* 37 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
38 local Mapping = { 38 local Mapping = {
39 - -- 预留一些数据格式 39 + -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long
40 common = { 40 common = {
41 desc = "keyword",--索引的短字符串 41 desc = "keyword",--索引的短字符串
42 ucode = "keyword",--关联日志对应ucode 42 ucode = "keyword",--关联日志对应ucode
@@ -46,15 +46,15 @@ local Mapping = { @@ -46,15 +46,15 @@ local Mapping = {
46 text1 = "text", --长字符串不索引的类型 46 text1 = "text", --长字符串不索引的类型
47 -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用 47 -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用
48 short1 = "short", 48 short1 = "short",
49 - int1 = "integer",  
50 - int2 = "integer", 49 + int1 = "long",
  50 + int2 = "long",
51 long1 = "long", 51 long1 = "long",
52 float1 = "float", 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,6 +1372,15 @@ function RolePlugin.bind(Role)
1372 return RANK_ADV[idx] 1372 return RANK_ADV[idx]
1373 end 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 end 1384 end
1376 1385
1377 return RolePlugin 1386 return RolePlugin
1378 \ No newline at end of file 1387 \ No newline at end of file