Commit 3ee9494b7ccaa7a88b96e041a73d93814bc208ad

Authored by 熊润斐
2 parents aa84432f 8dc5f0dd

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

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/ProtocolCode.lua
... ... @@ -55,6 +55,7 @@ actionCodes = {
55 55 Role_updateSpark = 139, -- 更新火花
56 56 Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品
57 57 Role_getTimeGiftRpc = 141,
  58 + Role_runeBuyRpc = 142, -- 铭文购买
58 59  
59 60 Adv_startAdvRpc = 151,
60 61 Adv_startHangRpc = 152,
... ...
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/RoleAction.lua
... ... @@ -1332,11 +1332,17 @@ function _M.guideRpc(agent, data)
1332 1332 local funcGuide = role:getProperty("funcGuide")
1333 1333 if cmdType == 1 then
1334 1334 -- 新手引导
1335   - local master = msg.master or -1
1336   - local slave = msg.slave or -1
1337   - if master < 0 or slave < 0 then return end
1338   -
1339   - role:saveGuide(master, slave)
  1335 + if msg.masters then
  1336 + for _, master in pairs(msg.masters) do
  1337 + role:saveGuide(master,1,true)
  1338 + end
  1339 + else
  1340 + local master = msg.master or -1
  1341 + local slave = msg.slave or -1
  1342 + if master < 0 or slave < 0 then return end
  1343 + role:saveGuide(master, slave)
  1344 + end
  1345 +
1340 1346 elseif cmdType == 2 then
1341 1347 -- 系统引导(玩家可选择是否进行)
1342 1348 if not msg.skip then return end
... ... @@ -1562,4 +1568,19 @@ function _M.getTimeGiftRpc(agent, data)
1562 1568 return true
1563 1569 end
1564 1570  
  1571 +function _M.runeBuyRpc(agent, data)
  1572 + local role = agent.role
  1573 + local msg = MsgPack.unpack(data)
  1574 + local count = msg.count
  1575 +
  1576 + local glodCount = globalCsv.rune_exchange * count
  1577 + if not role:checkItemEnough({[ItemId.Gold] = glodCount}) then return end
  1578 + role:costItems({[ItemId.Gold] = glodCount}, {log = {desc = "glodConvertRune", int1 = count, int2 = glodCount}})
  1579 + local reward, change = {}
  1580 + reward[ItemId.RuneFragment] = count
  1581 + reward, change = role:award(reward, {log = {desc = "glodConvertRune"}})
  1582 + SendPacket(actionCodes.Role_runeBuyRpc, MsgPack.pack(role:packReward(reward, change)))
  1583 + return true
  1584 +end
  1585 +
1565 1586 return _M
1566 1587 \ No newline at end of file
... ...
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
... ... @@ -21,7 +21,8 @@ Daily.schema = {
21 21 giveFP = {"table", {}}, -- 给谁送过心心
22 22 getFP = {"table", {}}, -- 领过谁的心心
23 23 pvpFree = {"number", 0}, -- pvp使用免费次数
24   - pvpFreeH = {"number", 0}, -- 高级pvp使用免费次数
  24 + pvpFreeH = {"number", 0}, -- 高级pvp使用免费次
  25 + pvpBought = {"number", 0}, -- 门票购买次数
25 26  
26 27 dailySDC = {"table", {}}, -- daily shop diamond count {[id] = count} -- 每日商城购买次数统计
27 28 dailySDD = {"table", {}}, -- daily shop diamond disount {[id] = 1} -- 每日商城折扣统计
... ... @@ -67,8 +68,12 @@ function Daily:refreshDailyData(notify)
67 68 end
68 69 elseif field == "id" then
69 70 -- skip
  71 + elseif field == "treasureBase" then
  72 + dataMap[field] = globalCsv.idle_treasure_base
70 73 elseif field == "treasureList" then
71 74 dataMap[field] = self:getTreasrueList()
  75 + elseif field == "pvpBought" then
  76 + dataMap[field] = 0
72 77 elseif field ~= "key" then
73 78 local typ, def = table.unpack(schema)
74 79 dataMap[field] = def
... ... @@ -100,21 +105,9 @@ function Daily:checkUnlock(treaval)
100 105 local treasureC = treaval.unlock:toArray(true, "=")
101 106 local show = false
102 107 if treasureC[1] == 1 then --通关关卡
103   - if self.owner:checkHangPass(treasureC[2]) then show = true end
  108 + show = self.owner:checkHangPass(treasureC[2])
104 109 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
  110 + show = role:checkAdvChapterPass(treasureC[2])
118 111 elseif treasureC[1] == 3 then --拥有指定id的角色时
119 112 local hero = role:getHeroByID(treasureC[2])
120 113 if hero then show = true end
... ... @@ -247,9 +240,9 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
247 240 local treasure = nil
248 241  
249 242 if not curInfo then
250   - print("curInfo is nil")
251 243 return treasure
252 244 end
  245 + local treasureBase = self:getProperty("treasureBase")
253 246  
254 247 --开始挖宝关卡ID=挂机关卡ID
255 248 if chapterId == curInfo.chapter_id then
... ... @@ -261,8 +254,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
261 254 if curInfo.cool_time > 1 then
262 255 --宝藏冷却时间
263 256 if not curInfo["expire_time"] then
264   - treasure = treasureList[curInfo.id]
265   - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  257 + if treasureBase >= curInfo["treasure_value"] then
  258 + treasureBase = treasureBase - curInfo["treasure_value"]
  259 +
  260 + treasure = treasureList[curInfo.id]
  261 + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  262 + end
266 263 else
267 264 --已经领取宝藏 检索宝藏冷却时间
268 265 if skynet.timex() >= curInfo["expire_time"] then
... ... @@ -270,8 +267,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
270 267 end
271 268 end
272 269 else
273   - treasure = treasureList[curInfo.id]
274   - treasureList[curInfo.id] = nil
  270 + if treasureBase >= curInfo["treasure_value"] then
  271 + treasureBase = treasureBase - curInfo["treasure_value"]
  272 +
  273 + treasure = treasureList[curInfo.id]
  274 + treasureList[curInfo.id] = nil
  275 + end
275 276 end
276 277 end
277 278 end
... ... @@ -282,8 +283,13 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
282 283 if curInfo.cool_time > 1 then
283 284 --宝藏冷却时间
284 285 if not curInfo["expire_time"] then
285   - treasure = treasureList[curInfo.id]
286   - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  286 + if treasureBase >= curInfo["treasure_value"] then
  287 + treasureBase = treasureBase - curInfo["treasure_value"]
  288 +
  289 + treasure = treasureList[curInfo.id]
  290 + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay
  291 + end
  292 +
287 293 else
288 294 --已经领取宝藏 检索宝藏冷却时间
289 295 if skynet.timex() >= curInfo["expire_time"] then
... ... @@ -291,8 +297,12 @@ function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId)
291 297 end
292 298 end
293 299 else
294   - treasure = treasureList[curInfo.id]
295   - treasureList[curInfo.id] = nil
  300 + if treasureBase >= curInfo["treasure_value"] then
  301 + treasureBase = treasureBase - curInfo["treasure_value"]
  302 +
  303 + treasure = treasureList[curInfo.id]
  304 + treasureList[curInfo.id] = nil
  305 + end
296 306 end
297 307 else
298 308 curInfo["end_time"] = nil
... ... @@ -306,12 +316,9 @@ function Daily:buyTreasure(treasureList)
306 316 local boughtTreasurer = {}
307 317 local treasureBase = self:getProperty("treasureBase")
308 318 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
  319 + if treasureBase >= val.treasure_value then
314 320 boughtTreasurer[id] = val
  321 + treasureBase = treasureBase - val.treasure_value
315 322 end
316 323 end
317 324 self:updateProperty({field = "treasureBase", value = treasureBase})
... ... @@ -366,6 +373,20 @@ function Daily:checkTreasureList(chapterId)
366 373 return boughtTreasurer
367 374 end
368 375  
  376 +--宝藏加速
  377 +function Daily:quickTreasureList(chapterId, time)
  378 + local treasureList = self:getProperty("treasureList") or {}
  379 + if next(treasureList) then
  380 + for id, val in pairs(treasureList) do
  381 + if val["end_time"] and val["chapter_id"] and chapterId == val["chapter_id"] then
  382 + val["end_time"] = val["end_time"] - time
  383 + end
  384 + end
  385 + end
  386 + self:updateProperty({field = "treasureList", value = treasureList})
  387 + return self:checkTreasureList(chapterId)
  388 +end
  389 +
369 390 function Daily:data()
370 391 return {
371 392 hangQC = self:getProperty("hangQC"),
... ... @@ -379,12 +400,14 @@ function Daily:data()
379 400 getFP = self:getProperty("getFP"),
380 401 pvpFree = self:getProperty("pvpFree"),
381 402 pvpFreeH = self:getProperty("pvpFreeH"),
  403 + pvpBought = self:getProperty("pvpBought"),
382 404 dailySDC = self:getProperty("dailySDC"),
383 405 dailySDD = self:getProperty("dailySDD"),
384 406 advSupRe = self:getProperty("advSupRe"),
385 407 goldBuyT = self:getProperty("goldBuyT"),
386 408 unlockPool = self:getProperty("unlockPool"),
387 409 curPool = self:getProperty("curPool"),
  410 + treasureBase = self:getProperty("treasureBase"),
388 411 treasureList = self:getProperty("treasureList"),
389 412 }
390 413 end
... ...
src/models/RoleLog.lua
... ... @@ -4,7 +4,7 @@ local logproxy = require &quot;shared.logproxy&quot;
4 4  
5 5 --[[
6 6 100 购买/兑换行为
7   - 200 交易行为(与其他玩家)
  7 + 200 交易行为(与其他玩家)
8 8 300 通过关卡产出或消耗
9 9 400 通过任务产出或消耗
10 10 500 通过公会产出或消耗
... ... @@ -62,6 +62,7 @@ local ItemReason = {
62 62 convert = 146, -- 钻石兑换其他物品
63 63 giftTime = 147, -- 创角后的时间礼包
64 64 activityCrisis = 148, -- 物资危机奖励
  65 + glodConvertRune = 149, -- 金币兑换铭文
65 66  
66 67 advHang = 301, -- 拾荒挂机
67 68 hangBattle = 302, -- 挂机战斗
... ...
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)
... ...