Commit a8abfb649a856ba6b291306ed8015af8f860bf2b

Authored by 熊润斐
2 parents 59b56f33 d933495e

Merge branch 'cn/develop' into cn/publish/release

config/develop.lua
1 1 include("basic.lua")
2 2  
3   -logd = 1 -- 是否开启日志
  3 +logd = 0 -- 是否开启日志
4 4 thread = 4
5 5 codeurl = "192.168.0.199:9090"
6 6 servId = 1
... ...
src/actions/CarAction.lua
... ... @@ -220,6 +220,16 @@ function _M.saleRuneRpc(agent, data )
220 220 for k ,v in pairs(one) do
221 221 reward[k] = (reward[k] or 0) + v
222 222 end
  223 +
  224 + --分解铭文返还强化所需铭文碎片的60%
  225 + local level = rune:getProperty("level")
  226 + for i = 1, level do
  227 + local lvData = csvdb["rune_buildCsv"][i]
  228 + local cost = lvData.cost:toNumMap()
  229 + for k, v in pairs(cost) do
  230 + reward[k] = (reward[k] or 0) + v*0.6
  231 + end
  232 + end
223 233 end
224 234  
225 235 role:delRunes(backs, {log = {desc = "saleRune"}})
... ...
src/actions/HangAction.lua
... ... @@ -127,12 +127,12 @@ local function checkReward(role, isTreasure, carbonId)
127 127  
128 128 --挂机得到的宝藏加入到挂机奖励
129 129 if isTreasure or false == true then
130   - local treasureList= role.dailyData:checkTreasureList(hangInfo.carbonId) or {}
  130 + local treasureList= role.dailyData:checkTreasureList(carbonId or hangInfo.carbonId) or {}
131 131 if next(treasureList) ~= nil then
132 132 for id, val in pairs(treasureList) do
133 133 local award = val.award:toNumMap()
134 134 for k,v in pairs(award) do
135   - items[k] = (award[k] or 0) + v
  135 + items[k] = (items[k] or 0) + v
136 136 end
137 137 end
138 138 end
... ... @@ -513,6 +513,17 @@ function _M.quickRpc(agent , data)
513 513 end
514 514 end
515 515  
  516 + --宝藏加速
  517 + local treasureList= role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {}
  518 + if next(treasureList) then
  519 + for id, val in pairs(treasureList) do
  520 + local award = val.award:toNumMap()
  521 + for k,v in pairs(award) do
  522 + reward[k] = (reward[k] or 0) + v
  523 + end
  524 + end
  525 + end
  526 +
516 527 local change
517 528 reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
518 529 if reward[ItemId.Gold] then
... ...
src/actions/HeroAction.lua
... ... @@ -865,6 +865,11 @@ function _M.drawHeroRpc(agent, data)
865 865  
866 866 local unitPool = csvdb["build_unitCsv"][poolId]
867 867 if not unitPool then return 7 end
  868 + -- ssr硬性保底
  869 + local isSSRup = false
  870 + if unitPool["rare_"..HeroQuality.SSR] or 0 > 0 then
  871 + isSSRup = true
  872 + end
868 873  
869 874 -- 开始抽
870 875 local resultPool = {}
... ... @@ -872,21 +877,38 @@ function _M.drawHeroRpc(agent, data)
872 877 local condition = {"rare"}
873 878 local values = {}
874 879  
  880 + -- check ssr up
  881 + if isSSRup then
  882 + local ssrUpMap = role:getProperty("ssrUp") or {}
  883 + local ssrFloorCnt = ssrUpMap[poolId] or 0
  884 + if ssrFloorCnt >= (globalCsv.draw_ssr_guarantee or 40) - 1 then
  885 + values[1] = HeroQuality.SSR
  886 + ssrUpMap[poolId] = 0
  887 + else
  888 + for idx, field in ipairs(condition) do
  889 + if not values[idx] then
  890 + local lpool = {}
  891 + local curIdx = 1
  892 + while unitPool[field .. "_" .. curIdx] do
  893 + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]}
  894 + curIdx = curIdx + 1
  895 + end
  896 +
  897 + if next(lpool) then
  898 + values[idx] = math.randWeight(lpool, 1)
  899 + end
  900 + end
  901 + end
  902 + if values[1] == HeroQuality.SSR then
  903 + ssrUpMap[poolId] = 0
  904 + else
  905 + ssrUpMap[poolId] = ssrFloorCnt + 1
  906 + end
  907 + end
  908 + role:updateProperty({field="ssrUp", value = ssrUpMap, notNotify = true})
  909 + end
875 910  
876   - for idx, field in ipairs(condition) do
877   - if not values[idx] then
878   - local lpool = {}
879   - local curIdx = 1
880   - while unitPool[field .. "_" .. curIdx] do
881   - lpool[curIdx] = {unitPool[field .. "_" .. curIdx]}
882   - curIdx = curIdx + 1
883   - end
884 911  
885   - if next(lpool) then
886   - values[idx] = math.randWeight(lpool, 1)
887   - end
888   - end
889   - end
890 912  
891 913 local weight = 0
892 914 local up_pool = nil
... ... @@ -1291,7 +1313,11 @@ function _M.changeSparkRpc(agent, data)
1291 1313 end
1292 1314 end
1293 1315  
1294   - SendPacket(actionCodes.Hero_changeSparkRpc, MsgPack.pack({reward = reward}))
  1316 + local change = {}
  1317 + if next(reward) then
  1318 + reward, change = role:award(reward, {log = {desc = "changeSpark"}})
  1319 + end
  1320 + SendPacket(actionCodes.Hero_changeSparkRpc, MsgPack.pack(role:packReward(reward, change)))
1295 1321 return true
1296 1322 end
1297 1323  
... ...
src/actions/PvpAction.lua
... ... @@ -243,6 +243,12 @@ function _M.buyCountRpc(agent, data)
243 243  
244 244 local cost = {[ItemId.Jade] = globalCsv.pvp_buy_cost * count}
245 245 if not role:checkItemEnough(cost) then return 2 end
  246 +
  247 + --限制每天购买次数
  248 + local pvpBought = role.dailyData:getProperty("pvpBought")
  249 + if count + pvpBought > globalCsv["pvp_buy_max"] then return 3 end
  250 + role.dailyData:updateProperty({field = "pvpBought", value = count + pvpBought})
  251 +
246 252 role:costItems(cost, {log = {desc = "buyPvpKey"}})
247 253 role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}})
248 254  
... ...
src/actions/TowerAction.lua
... ... @@ -115,7 +115,7 @@ function _M.endBattleRpc(agent, data)
115 115 curLevel = curLevel + 1
116 116 reward, change = role:award(rewardStr, {log = {desc = "towerBattle", int1 = id}})
117 117 if towerType == 0 then
118   - role:checkTaskEnter("TowerPass", {level = towerInfo.l})
  118 + role:checkTaskEnter("TowerPass", {level = towerInfo.l, type = towerType + 1})
119 119 end
120 120 end
121 121  
... ...
src/models/Daily.lua
... ... @@ -100,21 +100,9 @@ function Daily:checkUnlock(treaval)
100 100 local treasureC = treaval.unlock:toArray(true, "=")
101 101 local show = false
102 102 if treasureC[1] == 1 then --通关关卡
103   - if self.owner:checkHangPass(treasureC[2]) then show = true end
  103 + show = self.owner:checkHangPass(treasureC[2])
104 104 elseif treasureC[1] == 2 then --通关拾荒章节=x层
105   - local chapterId = treasureC[2]
106   - local layer = 1
107   - local advCsv = csvdb["adv_chapterCsv"][chapterId]
108   - if not advCsv then return false end --不存在的章节
109   - if math.floor(chapterId / 100) ~= 2 then
110   - layer = math.min(layer, advCsv.limitlevel)
111   - end
112   - local advPass = role:getProperty("advPass")
113   - if (advPass[chapterId] or 0) < layer then
114   - show = false
115   - else
116   - show = true
117   - end
  105 + show = role:checkAdvChapterPass(treasureC[2])
118 106 elseif treasureC[1] == 3 then --拥有指定id的角色时
119 107 local hero = role:getHeroByID(treasureC[2])
120 108 if hero then show = true end
... ... @@ -145,6 +133,10 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList)
145 133 end
146 134 curInfo = clone(treasureAttr)
147 135 end
  136 + elseif curInfo["end_time"] then
  137 + print("end_time")
  138 + print(curInfo["end_time"])
  139 + print(skynet.timex())
148 140 end
149 141 else
150 142 curInfo = clone(treasureAttr)
... ... @@ -247,9 +239,9 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
247 239 local treasure = nil
248 240  
249 241 if not curInfo then
250   - print("curInfo is nil")
251 242 return treasure
252 243 end
  244 + local treasureBase = self:getProperty("treasureBase")
253 245  
254 246 --开始挖宝关卡ID=挂机关卡ID
255 247 if chapterId == curInfo.chapter_id then
... ... @@ -261,8 +253,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
261 253 if curInfo.cool_time > 1 then
262 254 --宝藏冷却时间
263 255 if not curInfo["expire_time"] then
264   - treasure = treasureList[curInfo.id]
265   - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  256 + if treasureBase >= curInfo["treasure_value"] then
  257 + treasureBase = treasureBase - curInfo["treasure_value"]
  258 +
  259 + treasure = treasureList[curInfo.id]
  260 + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  261 + end
266 262 else
267 263 --已经领取宝藏 检索宝藏冷却时间
268 264 if skynet.timex() >= curInfo["expire_time"] then
... ... @@ -270,8 +266,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
270 266 end
271 267 end
272 268 else
273   - treasure = treasureList[curInfo.id]
274   - treasureList[curInfo.id] = nil
  269 + if treasureBase >= curInfo["treasure_value"] then
  270 + treasureBase = treasureBase - curInfo["treasure_value"]
  271 +
  272 + treasure = treasureList[curInfo.id]
  273 + treasureList[curInfo.id] = nil
  274 + end
275 275 end
276 276 end
277 277 end
... ... @@ -282,8 +282,13 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
282 282 if curInfo.cool_time > 1 then
283 283 --宝藏冷却时间
284 284 if not curInfo["expire_time"] then
285   - treasure = treasureList[curInfo.id]
286   - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  285 + if treasureBase >= curInfo["treasure_value"] then
  286 + treasureBase = treasureBase - curInfo["treasure_value"]
  287 +
  288 + treasure = treasureList[curInfo.id]
  289 + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  290 + end
  291 +
287 292 else
288 293 --已经领取宝藏 检索宝藏冷却时间
289 294 if skynet.timex() >= curInfo["expire_time"] then
... ... @@ -291,8 +296,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
291 296 end
292 297 end
293 298 else
294   - treasure = treasureList[curInfo.id]
295   - treasureList[curInfo.id] = nil
  299 + if treasureBase >= curInfo["treasure_value"] then
  300 + treasureBase = treasureBase - curInfo["treasure_value"]
  301 +
  302 + treasure = treasureList[curInfo.id]
  303 + treasureList[curInfo.id] = nil
  304 + end
296 305 end
297 306 else
298 307 curInfo["end_time"] = nil
... ... @@ -306,12 +315,9 @@ function Daily:buyTreasure(treasureList)
306 315 local boughtTreasurer = {}
307 316 local treasureBase = self:getProperty("treasureBase")
308 317 for id, val in pairs(treasureList) do
309   - treasureBase = treasureBase - val.treasure_value
310   - if treasureBase < 0 then
311   - treasureBase = treasureBase + val.treasure_value
312   - return
313   - else
  318 + if treasureBase >= val.treasure_value then
314 319 boughtTreasurer[id] = val
  320 + treasureBase = treasureBase - val.treasure_value
315 321 end
316 322 end
317 323 self:updateProperty({field = "treasureBase", value = treasureBase})
... ... @@ -366,6 +372,20 @@ function Daily:checkTreasureList(chapterId)
366 372 return boughtTreasurer
367 373 end
368 374  
  375 +--宝藏加速
  376 +function Daily:quickTreasureList(chapterId, time)
  377 + local treasureList = self:getProperty("treasureList") or {}
  378 + if next(treasureList) then
  379 + for id, val in pairs(treasureList) do
  380 + if val["end_time"] and val["chapter_id"] and chapterId == val["chapter_id"] then
  381 + val["end_time"] = val["end_time"] - time
  382 + end
  383 + end
  384 + end
  385 + self:updateProperty({field = "treasureList", value = treasureList})
  386 + return self:checkTreasureList(chapterId)
  387 +end
  388 +
369 389 function Daily:data()
370 390 return {
371 391 hangQC = self:getProperty("hangQC"),
... ...
src/models/RolePlugin.lua
... ... @@ -1304,10 +1304,20 @@ function RolePlugin.bind(Role)
1304 1304  
1305 1305 function Role:advChapterIsOpen(chapterId)
1306 1306 local chapterData = csvdb["adv_chapterCsv"][chapterId]
1307   - if chapterData.prepose ~= 0 and not self:checkHangPass(chapterData.prepose) then return false end
  1307 + if chapterData.prepose == "" then return true end
  1308 + local prepose = chapterData.prepose:toArray(true,"=")
  1309 + if prepose[1] == 1 then
  1310 + if chapterData.prepose ~= 0 and not self:checkHangPass(prepose[2]) then return false end
  1311 + elseif prepose[1] == 2 then
  1312 + return self:checkAdvChapterPass(prepose[2])
  1313 + elseif prepose[1] == 3 then
  1314 + return self:checkOverGuide(prepose[2])
  1315 + end
1308 1316 return true
1309 1317 end
1310 1318  
  1319 +
  1320 +
1311 1321 function Role:advEventOpenStatus()
1312 1322 local openStatus = {}
1313 1323 for func , data in pairs(csvdb["unlockCsv"]) do
... ... @@ -2038,6 +2048,13 @@ function RolePlugin.bind(Role)
2038 2048 return (hangPass[diff] or 0) >= carbonId
2039 2049 end
2040 2050  
  2051 + function Role:checkAdvChapterPass(chapterId)
  2052 + local chapterData = csvdb["adv_chapterCsv"][chapterId]
  2053 + local advPass = self:getProperty("advPass") or {}
  2054 + local pass = advPass[chapterId] or 0
  2055 + return pass >= chapterData.limitlevel
  2056 + end
  2057 +
2041 2058 function Role:hangFinish(carbonId)
2042 2059 local hangPass = self:getProperty("hangPass")
2043 2060 local diff = math.floor(carbonId / 10000)
... ...
src/models/RoleTask.lua
... ... @@ -194,7 +194,7 @@ local AchievListener = {
194 194 [TaskType.OverOderTask] = {{14}},
195 195 [TaskType.FoodSellGold] = {{15, f("count")}},
196 196 [TaskType.DinerPopular] = {{16, f("count")}},
197   - [TaskType.TowerPass] = {{17, f("level")}},
  197 + [TaskType.TowerPass] = {{17, f("level"), f("type")}},
198 198 [TaskType.OpenBox] = {{18, f("count")}},
199 199 [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}},
200 200 [TaskType.DinerTalentUp] = {{20, 1, f("type")}},
... ... @@ -289,7 +289,7 @@ local CalendaTaskListener = {
289 289 [TaskType.PvpWin]= {{10, 2, f("score")}},
290 290 [TaskType.DinerPopular]= {{11, 2, f("count")}},
291 291 [TaskType.RoleLevelUp]= {{12, 2, f("level")}},
292   - [TaskType.TowerPass]= {{13, 2, f("level")}},
  292 + [TaskType.TowerPass]= {{13, 3, f("level"), f("type")}},
293 293 [TaskType.HeroTalent]= {{14, 1}},
294 294 [TaskType.HangPass]= {{15, 3}},
295 295 [TaskType.HeroStarCollect]= {{16, 3}},
... ... @@ -809,6 +809,10 @@ function RoleTask.bind(Role)
809 809 if cfg.condition2 == param1 then
810 810 calTask[id] = (calTask[id] or 0) + 1
811 811 end
  812 + elseif cfg.type == 13 then -- 挑战电波塔主塔
  813 + if cfg.condition2 == param1 and param2 == 1 then
  814 + calTask[id] = (calTask[id] or 0) + 1
  815 + end
812 816 end
813 817 end
814 818 end
... ...
src/shared/ModelBaseMysql.lua
... ... @@ -485,6 +485,8 @@ function ModelBaseMysql:updateFields(fields)
485 485 if next(value) then
486 486 local result = mysqlproxy:quote_sql_str(MsgPack.pack(value))
487 487 params[field] = result
  488 + else
  489 + params[field] = mysqlproxy:quote_sql_str(MsgPack.pack({}))
488 490 end
489 491 elseif self.class.schema[field][1] == "string" then
490 492 local result = mysqlproxy:quote_sql_str(value)
... ...