Commit fb8917785ba13ed8feb3693fd8bc86f593661417

Authored by liuzujun
2 parents dfa9ae5e 219e9654

fix confict

src/GlobalVar.lua
... ... @@ -142,7 +142,6 @@ ItemId = {
142 142 TimeReset = {
143 143 CrossDay = 1, --通用跨天
144 144 CrossWeek = 2, --通用跨周
145   - CrossMonth = 1, --通用跨月 索引使用跨天,在回调方法中判断是否跨越 跨月的前置条件是跨天
146 145 DinerRank = 1, -- 餐厅排行榜
147 146 PvpRank = 2, -- pvp排行榜
148 147 PvpHight = 11, --高级竞技场
... ... @@ -225,6 +224,7 @@ AdvBackEventType = {
225 224 LinkChooseOver = 26, -- 连锁事件结束
226 225 BuffEffect = 27, -- buff 效果
227 226 PassiveEffect = 28, -- 被动 效果
  227 + ChooseDice = 29, -- 选择点随机效果
228 228 }
229 229  
230 230 AdvScoreType = {
... ... @@ -326,6 +326,7 @@ MailId = {
326 326 PayBackAward = 242,
327 327 CBBackAward = 243,
328 328 CBBackAward2 = 244,
  329 + ActivityPoolRet = 280,
329 330 }
330 331  
331 332 TriggerEventType = {
... ...
src/actions/GmAction.lua
... ... @@ -247,6 +247,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"})
247 247 table.insert(helpDes, {"获得所有碎片", "get", "FRAG"})
248 248 table.insert(helpDes, {"获得所有食物", "get", "FOOD"})
249 249 table.insert(helpDes, {"获得所有角色", "get", "HERO"})
  250 +table.insert(helpDes, {"获得满级满觉醒角色,满级满精进铭文", "get", "MAXHERO"})
250 251 function _M.get(role, pms)
251 252 if pms.pm1 == "ALL" then
252 253 local reward = {}
... ... @@ -263,7 +264,7 @@ function _M.get(role, pms)
263 264 end
264 265 end
265 266 elseif pms.pm1 == "RUNE" then
266   - for itemId = 2000 , 3000 do
  267 + for itemId = 10000 , 20000 do
267 268 if csvdb["itemCsv"][itemId] then
268 269 role:award({[itemId] = 1}, {log = {desc = "gm"}})
269 270 end
... ... @@ -286,6 +287,36 @@ function _M.get(role, pms)
286 287 role:award({[itemId] = 1}, {log = {desc = "gm"}})
287 288 end
288 289 end
  290 + elseif pms.pm1 == "MAXHERO" then
  291 + -- 给英雄
  292 + for itemId = 400 , 700 do
  293 + if csvdb["itemCsv"][itemId] then
  294 + role:award({[itemId] = 1}, {log = {desc = "gm"}})
  295 + end
  296 + end
  297 + -- 升满级
  298 + for _, hero in ipairs(role.heros) do
  299 + hero:updateProperty({field = "level", value = 140})
  300 + hero:updateProperty({field = "wakeL", value = #csvdb["unit_wakeCsv"]})
  301 + end
  302 +
  303 + -- 添加铭文
  304 + for itemId = 10000 , 20000 do
  305 + if csvdb["itemCsv"][itemId] then
  306 + role:award({[itemId] = 1}, {log = {desc = "gm"}})
  307 + end
  308 + end
  309 + for _, rune in ipairs(role.runeBag) do
  310 + local typ = rune:getProperty("type")
  311 + local id = rune:getProperty("id")
  312 +
  313 + local runeSet = csvdb["runeCsv"][typ]
  314 + if not runeSet then break end
  315 + local runeData = runeSet[id]
  316 + if not runeData then break end
  317 +
  318 + rune:updateProperty({field = "level",value = runeData.lvLimit})
  319 + end
289 320 else
290 321 local itemId = tonum(pms.pm1)
291 322 if not csvdb["itemCsv"][itemId] then
... ... @@ -561,6 +592,12 @@ function _M.ayncPurchase(role, params)
561 592 return role:handlePurchase(params) or ""
562 593 end
563 594  
  595 +-- 获取订单号
  596 +function _M.getPurchaseOrder(role, params)
  597 + return role:getPurchaseOrderByPlatform(params) or ""
  598 +end
  599 +
  600 +
564 601 function _M.cz(role, pms)
565 602 local id = tonum(pms.pm1)
566 603 local csvData = csvdb["shop_rechargeCsv"][id]
... ...
src/actions/RoleAction.lua
... ... @@ -157,6 +157,7 @@ function _M.loginRpc( agent, data )
157 157 SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start")
158 158  
159 159 role:changeStructVersion() -- 数据结构 版本更新
  160 + role:getAdvData(true) -- 清掉不合格的数据
160 161 role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查
161 162  
162 163 -- 跨天登陆事件
... ... @@ -607,9 +608,9 @@ function _M.openTimeBoxRpc(agent, data)
607 608 local itemData = csvdb["itemCsv"][itemId]
608 609 local unitTime = globalCsv.box_key_time[itemId] * 60
609 610 if quick then
610   - stopTime = time + globalCsv.box_productLine_time * 3600
  611 + stopTime = nowTime + quick
611 612 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
612   - local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2]
  613 + local costKey = math.ceil(quick / (cost_pre[1] * 60)) * cost_pre[2]
613 614 if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end
614 615 role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}})
615 616 else
... ... @@ -1055,6 +1056,10 @@ function _M.chatRpc(agent, data)
1055 1056 result = 1
1056 1057 return
1057 1058 end
  1059 + if role:getProperty("level") < (globalCsv.chat_level or 15) then
  1060 + result = 3
  1061 + return
  1062 + end
1058 1063  
1059 1064 role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间
1060 1065  
... ...
src/adv/Adv.lua
... ... @@ -20,8 +20,6 @@ function Adv:ctor(owner)
20 20 self.advTask = self.owner:getProperty("advTask")
21 21 self.advMTask = self.owner:getProperty("advMTask")
22 22 self.advTaskChange = false -- 任务改变才更新
23   -
24   - self:initByInfo(self.owner:getProperty("advInfo"))
25 23 end
26 24  
27 25 function Adv:mylog(contents)
... ... @@ -36,7 +34,8 @@ function Adv:mylog(contents)
36 34 end
37 35  
38 36 --初始化adv 信息
39   -function Adv:initByInfo(advInfo)
  37 +function Adv:initByInfo()
  38 + local advInfo = self.owner:getProperty("advInfo")
40 39 if not next(advInfo) then return end --还没有 开始新地图
41 40  
42 41 self.chapterId = advInfo.chapterId
... ... @@ -407,10 +406,9 @@ function Adv:isRunning()
407 406 return false
408 407 end
409 408  
410   --- 强制结束
411   -function Adv:forceOver(notNotify)
412   - if self:isRunning() then
413   -
  409 +-- 强制结束 逻辑和adv内部无关
  410 +function Adv:forceOver(notNotify, force)
  411 + if self:isRunning() or force then
414 412 local advTeam = self.owner:getProperty("advTeam")
415 413 advTeam.player = nil
416 414  
... ... @@ -895,25 +893,27 @@ function Adv:over(success, rewardRatio, overType)
895 893 if not self:isEndless() and self.level >= chapterData.limitlevel then
896 894 self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId})
897 895 end
  896 + end
898 897  
899   - local roleId = self.owner:getProperty("id")
900   - local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId))
901   - if score > oldMaxScore and not self.actid then
902   - local team = self.owner:getProperty("advTeam")
903   - local curInfo = {
904   - name = self.owner:getProperty("name"),
905   - headId = self.owner:getProperty("headId"),
906   - lv = self.owner:getProperty("level"),
907   - batteV = self.owner:getTeamBattleValue(team.heros),
908   - chapter = self.chapterId,
909   - format = self.owner:getTeamHerosInfo(team).heros,
910   - }
911   - redisproxy:pipelining(function (red)
912   - red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数
913   - red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo))
914   - end)
915   - end
  898 +
  899 + local roleId = self.owner:getProperty("id")
  900 + local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId))
  901 + if score > oldMaxScore and not self.actid then
  902 + local team = self.owner:getProperty("advTeam")
  903 + local curInfo = {
  904 + name = self.owner:getProperty("name"),
  905 + headId = self.owner:getProperty("headId"),
  906 + lv = self.owner:getProperty("level"),
  907 + batteV = self.owner:getTeamBattleValue(team.heros),
  908 + chapter = self.chapterId,
  909 + format = self.owner:getTeamHerosInfo(team).heros,
  910 + }
  911 + redisproxy:pipelining(function (red)
  912 + red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数
  913 + red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo))
  914 + end)
916 915 end
  916 +
917 917 -- 通关的时候要把引导步骤设定到成就引导
918 918 if not self.owner:checkOverGuide(57) then
919 919 self.owner:saveGuide(57,1,true)
... ... @@ -1224,6 +1224,11 @@ local function clickOut(self, room, block, params, isExit)
1224 1224 else
1225 1225 if self.level > (advPass[self.chapterId] or 0) then
1226 1226 self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}})
  1227 +
  1228 + if (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束
  1229 + self.owner:checkTaskEnter("AdvPassFirst", {id = self.chapterId})
  1230 + end
  1231 +
1227 1232 end
1228 1233 end
1229 1234  
... ... @@ -1281,24 +1286,22 @@ local function clickMonster(self, room, block, params)
1281 1286 return true
1282 1287 end
1283 1288  
1284   -local function chooseCommon(self, room, block, chooseData, choose, tag)
1285   - if not choose then return end
1286   - if not chooseData or not chooseData["button".. choose .."cond"] then return end
1287 1289  
1288   - local conds = chooseData["button".. choose .."cond"]:toTableArray(true)
  1290 +local function checkChooseCondFunc(self, condStr, room, block, tag, chooseData)
  1291 + chooseData = chooseData or {}
1289 1292 local checkCond = {
1290 1293 -- 没有条件
1291 1294 [0] = function()
1292 1295 return true
1293 1296 end,
1294 1297 -- 拥有道具
1295   - [1] = function(_, itemId, count)
  1298 + [1] = function(itemId, count)
1296 1299 if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, true) then
1297 1300 return true
1298 1301 end
1299 1302 end,
1300 1303 -- xx角色(todo 队长)
1301   - [2] = function(_, heroType)
  1304 + [2] = function(heroType)
1302 1305 for slot, heroId in pairs(self.owner:getProperty("advTeam").heros) do
1303 1306 local hero = self.owner.heros[heroId]
1304 1307 if hero and hero:getProperty("type") == heroType then
... ... @@ -1318,38 +1321,38 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1318 1321 return true
1319 1322 end,
1320 1323 --制定属性
1321   - [4] = function(_, attrType, value)
  1324 + [4] = function(attrType, value)
1322 1325 if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then
1323 1326 return true
1324 1327 end
1325 1328 end,
1326 1329 -- 提交一个物品
1327   - [5] = function (_, itemId, count)
  1330 + [5] = function (itemId, count)
1328 1331 if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}) then
1329 1332 self:backCost({[itemId] = count})
1330 1333 return true
1331 1334 end
1332 1335 end,
1333 1336 -- sp 到达指定值
1334   - [6] = function(_, value)
  1337 + [6] = function(value)
1335 1338 if self.battle.player.sp >= value then
1336 1339 self.battle.player:changeSp(-value)
1337 1340 return true
1338 1341 end
1339 1342 end,
1340 1343 --7=拥有指定buff指定层数
1341   - [7] = function(_, buffId, layer)
  1344 + [7] = function(buffId, layer)
1342 1345 local buff = self.battle.player:getBuffById(buffId)
1343 1346 if buff and buff:getLayer() >= layer then
1344 1347 return true
1345 1348 end
1346 1349 end,
1347 1350 --8=拥有x神器
1348   - [8] = function(_, artifactId)
  1351 + [8] = function(artifactId)
1349 1352 return self:isHaveArtifact(artifactId)
1350 1353 end,
1351 1354 -- 9 = 生命值大于x%
1352   - [9] = function (_, value)
  1355 + [9] = function (value)
1353 1356 local cost = value / 100 * self.battle.player.hpMax
1354 1357 if self.battle.player.hp > cost then
1355 1358 self.battle.player:hurt(cost, nil, {hurtType = 6, buffId = -1})
... ... @@ -1357,11 +1360,11 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1357 1360 end
1358 1361 end,
1359 1362 -- 10 = 未获得x神器
1360   - [10] = function(_, artifactId)
  1363 + [10] = function(artifactId)
1361 1364 return not self:isHaveArtifact(artifactId)
1362 1365 end,
1363 1366 -- 11 = 地图上没有指定id 的怪
1364   - [11] = function(_, monsterId, size)
  1367 + [11] = function(monsterId, size)
1365 1368 if not size or size == 0 then
1366 1369 for _, room in pairs(self:getCurMap().rooms) do
1367 1370 for _, block in pairs(room.blocks) do
... ... @@ -1386,7 +1389,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1386 1389 return true
1387 1390 end,
1388 1391 -- 12 = 地图上没有指定id 的建筑
1389   - [12] = function(_, buildId, size)
  1392 + [12] = function(buildId, size)
1390 1393 if not size or size == 0 then
1391 1394 for _, room in pairs(self:getCurMap().rooms) do
1392 1395 for _, block in pairs(room.blocks) do
... ... @@ -1411,7 +1414,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1411 1414 return true
1412 1415 end,
1413 1416 -- 13 = 地图上没有指定的 选择点
1414   - [13] = function(_, chooseId, size)
  1417 + [13] = function(chooseId, size)
1415 1418 if not size or size == 0 then
1416 1419 for _, room in pairs(self:getCurMap().rooms) do
1417 1420 for _, block in pairs(room.blocks) do
... ... @@ -1436,138 +1439,175 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1436 1439 return true
1437 1440 end,
1438 1441 }
1439   - for _, cond in ipairs(conds) do
  1442 +
  1443 + local status, count = true, 0
  1444 + for _, cond in ipairs(condStr:toTableArray(true)) do
1440 1445 assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id)
1441   - if cond[1] and not checkCond[cond[1]](table.unpack(cond)) then return end
  1446 + if not checkCond[cond[1]](select(2, table.unpack(cond))) then
  1447 + status = false
  1448 + else
  1449 + count = count + 1
  1450 + end
1442 1451 end
1443   -
1444   - local clearBlock = chooseData.keep ~= 1
1445   - local effects = chooseData["button".. choose .."effect"]:toTableArray(true)
1446   - for _, effect in ipairs(effects) do
1447   - local doEffect = {
1448   - [1] = function() -- 获得某道具N个
1449   - local count = effect[3] or 1
1450   - local reward = {}
1451   - for i = 1, count do
1452   - local dropData = csvdb["event_dropCsv"][effect[2]]
1453   - if dropData then
1454   - local item = dropData["range"]:randWeight(true)
1455   - reward[item[1]] = (reward[item[1]] or 0) + item[2]
1456   - else
1457   - skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id))
1458   - end
1459   - end
1460   - self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId})
1461   - end,
1462   - [2] = function() --获得冒险buff
1463   - local layer = effect[3] or 1
1464   - for i = 1, layer do
1465   - self.battle.player:addBuff(effect[2])
1466   - end
1467   - end,
1468   - [3] = function() --发现怪物
1469   - self:getCurMap():addNewMonsterRand(effect[2], {room, block})
1470   - self:pushBackEvent(AdvBackEventType.Monster, {id = effect[2]})
1471   - clearBlock = false
1472   - end,
1473   - [4] = function() --无事发生
1474   - end,
1475   - [5] = function() --5=属性枚举=数值;直接增加玩家属性
1476   - local attr
1477   - if effect[3] == 0 then
1478   - attr = "sp"
  1452 + return status, count
  1453 +end
  1454 +
  1455 +local function doChooseEffect(self, effectStr, room, block, tag, chooseData)
  1456 + chooseData = chooseData or {}
  1457 + local clearBlock = true
  1458 + local doEffect = {
  1459 + [1] = function(dropId, count) -- 获得某道具N个
  1460 + count = count or 1
  1461 + local reward = {}
  1462 + for i = 1, count do
  1463 + local dropData = csvdb["event_dropCsv"][dropId]
  1464 + if dropData then
  1465 + local item = dropData["range"]:randWeight(true)
  1466 + reward[item[1]] = (reward[item[1]] or 0) + item[2]
1479 1467 else
1480   - attr = AttsEnumEx[effect[3]]
1481   - if not AdvAttsEnum[attr] then return end
  1468 + skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", dropId, tag, chooseData.id))
1482 1469 end
1483   - self.battle.player:addBaseAttr(attr, effect[4], effect[2])
1484   - end,
1485   - [6] = function() -- 商店
1486   - block:updateEvent({
1487   - etype = AdvEventType.Trader,
1488   - id = effect[2]
1489   - })
1490   - self:pushBackEvent(AdvBackEventType.Trader, {id = effect[2]})
1491   - clearBlock = false
1492   - end,
1493   - [7] = function() -- 建筑
1494   - block:updateEvent({
1495   - etype = AdvEventType.Build,
1496   - id = effect[2]
1497   - })
1498   - clearBlock = false
1499   - end,
1500   - [8] = function() -- 选择
1501   - block:updateEvent({
1502   - etype = AdvEventType.Choose,
1503   - id = effect[2]
1504   - })
1505   - clearBlock = false
1506   - end,
1507   - [9] = function() -- click
1508   - block:updateEvent({
1509   - etype = AdvEventType.Click,
1510   - id = effect[2]
1511   - })
1512   - clearBlock = false
1513   - end,
1514   - [10] = function() -- 陷阱
1515   - block:updateEvent({
1516   - etype = AdvEventType.Trap,
1517   - id = effect[2]
1518   - })
1519   - clearBlock = false
1520   - end,
1521   - [11] = function() -- 获得神器
1522   - self:waitChooseArtifact() --等待获取神器
1523   - end,
1524   - [12] = function()
1525   - -- buffId
1526   - local targers = self.battle.player:getTeam(2, nil, nil, true)
1527   - for _, target in pairs(targers) do
1528   - target:addBuff(effect[2])
  1470 + end
  1471 + self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId})
  1472 + end,
  1473 + [2] = function(buffId, layer) --获得冒险buff
  1474 + self.battle.player:addBuff(buffId, nil, layer or 1)
  1475 + end,
  1476 + [3] = function(id) --发现怪物
  1477 + self:getCurMap():addNewMonsterRand(id, {room, block})
  1478 + self:pushBackEvent(AdvBackEventType.Monster, {id = id})
  1479 + clearBlock = false
  1480 + end,
  1481 + [4] = function() --无事发生
  1482 + end,
  1483 + [5] = function(addType, attrType, value) --5=属性枚举=数值;直接增加玩家属性
  1484 + local attr
  1485 + if attrType == 0 then
  1486 + attr = "sp"
  1487 + else
  1488 + attr = AttsEnumEx[attrType]
  1489 + if not AdvAttsEnum[attr] then return end
  1490 + end
  1491 + self.battle.player:addBaseAttr(attr, value, addType)
  1492 + end,
  1493 + [6] = function(id) -- 商店
  1494 + block:updateEvent({
  1495 + etype = AdvEventType.Trader,
  1496 + id = id
  1497 + })
  1498 + self:pushBackEvent(AdvBackEventType.Trader, {id = id})
  1499 + clearBlock = false
  1500 + end,
  1501 + [7] = function(id) -- 建筑
  1502 + block:updateEvent({
  1503 + etype = AdvEventType.Build,
  1504 + id = id
  1505 + })
  1506 + clearBlock = false
  1507 + end,
  1508 + [8] = function(id) -- 选择
  1509 + block:updateEvent({
  1510 + etype = AdvEventType.Choose,
  1511 + id = id
  1512 + })
  1513 + clearBlock = false
  1514 + end,
  1515 + [9] = function(id) -- click
  1516 + block:updateEvent({
  1517 + etype = AdvEventType.Click,
  1518 + id = id
  1519 + })
  1520 + clearBlock = false
  1521 + end,
  1522 + [10] = function(id) -- 陷阱
  1523 + block:updateEvent({
  1524 + etype = AdvEventType.Trap,
  1525 + id = id
  1526 + })
  1527 + clearBlock = false
  1528 + end,
  1529 + [11] = function() -- 获得神器
  1530 + self:waitChooseArtifact() --等待获取神器
  1531 + end,
  1532 + [12] = function(id)
  1533 + -- buffId
  1534 + local targers = self.battle.player:getTeam(2, nil, nil, true)
  1535 + for _, target in pairs(targers) do
  1536 + target:addBuff(id)
  1537 + end
  1538 + end,
  1539 + [13] = function() -- 显示地图
  1540 + self:getCurMap():showMap()
  1541 + self:backMapShow()
  1542 + end,
  1543 + [14] = function(eventType, eventId, count, stage) -- 指定地块召唤 指定类型的id
  1544 + local change = self:getCurMap():layEventToStage(eventType, eventId, count, stage)
  1545 + for _, one in ipairs(change) do
  1546 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1547 + clearBlock = false
  1548 + else
  1549 + self:backBlockChange(one[1].roomId, one[2].blockId)
1529 1550 end
1530   - end,
1531   - [13] = function() -- 显示地图
1532   - self:getCurMap():showMap()
1533   - self:backMapShow()
1534   - end,
1535   - [14] = function() -- 指定地块召唤 指定类型的id
1536   - local change = self:getCurMap():layEventToStage(effect[2], effect[3], effect[4], effect[5])
1537   - for _, one in ipairs(change) do
1538   - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
1539   - clearBlock = false
1540   - else
1541   - self:backBlockChange(one[1].roomId, one[2].blockId)
1542   - end
  1551 + end
  1552 + end,
  1553 + [15] = function(eventType, eventId, count) -- 移除指定事件
  1554 + local change = self:getCurMap():clearEventById(eventType, eventId, count)
  1555 + for _, one in ipairs(change) do
  1556 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1557 + clearBlock = false
  1558 + else
  1559 + self:backBlockChange(one[1].roomId, one[2].blockId)
1543 1560 end
1544   - end,
1545   - [15] = function() -- 移除指定事件
1546   - local change = self:getCurMap():clearEventById(effect[2], effect[3], effect[4])
1547   - for _, one in ipairs(change) do
1548   - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
1549   - clearBlock = false
1550   - else
1551   - self:backBlockChange(one[1].roomId, one[2].blockId)
1552   - end
  1561 + end
  1562 + end,
  1563 + [16] = function(eventTypeF, eventIdF, eventTypeT, eventIdT, count) -- 指定事件转移
  1564 + local change = self:getCurMap():eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, count)
  1565 + for _, one in ipairs(change) do
  1566 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1567 + clearBlock = false
  1568 + else
  1569 + self:backBlockChange(one[1].roomId, one[2].blockId)
1553 1570 end
1554   - end,
1555   - [16] = function() -- 指定事件转移
1556   - local change = self:getCurMap():eventChangeToOther(effect[2], effect[3], effect[4], effect[5], effect[6])
1557   - for _, one in ipairs(change) do
1558   - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
1559   - clearBlock = false
1560   - else
1561   - self:backBlockChange(one[1].roomId, one[2].blockId)
1562   - end
  1571 + end
  1572 + end,
  1573 + [17] = function(eventId)
  1574 + local diceCsv = csvdb["event_choose_diceCsv"][eventId]
  1575 + if not diceCsv then return end
  1576 + local weight = math.randomInt(1, 12)
  1577 + local sum = 0
  1578 + local needEffect = nil
  1579 + local pool = {}
  1580 + for _, v in ipairs(diceCsv) do
  1581 + local status, okCount = checkChooseCondFunc(self, v.cond, room, block, tag .. " dice", chooseData)
  1582 + pool[#pool + 1] = v.weight + okCount * v.weightUp
  1583 + sum = sum + pool[#pool + 1]
  1584 + if sum >= weight and not needEffect then
  1585 + -- 达成效果
  1586 + needEffect = v.effect
1563 1587 end
1564   - end,
1565   - }
  1588 + end
  1589 + if needEffect then
  1590 + self:pushBackEvent(AdvBackEventType.ChooseDice, {id = eventId, pool = pool, result = weight})
  1591 + clearBlock = doChooseEffect(self, needEffect, room, block, tag .. " dice", chooseData)
  1592 + end
  1593 + end,
  1594 + }
  1595 +
  1596 + for _, effect in ipairs(effectStr:toTableArray(true)) do
1566 1597 assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. (block.event and block.event.id or 0) .. "effect " .. effect[1])
1567   - doEffect[effect[1]]()
  1598 + doEffect[effect[1]](select(2, table.unpack(effect)))
1568 1599 end
1569   - self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分
  1600 + return clearBlock
  1601 +end
1570 1602  
  1603 +
  1604 +local function chooseCommon(self, room, block, chooseData, choose, tag)
  1605 + if not choose then return end
  1606 + if not chooseData or not chooseData["button".. choose .."cond"] then return end
  1607 + if not checkChooseCondFunc(self, chooseData["button".. choose .."cond"], room, block, tag, chooseData) then return end
  1608 + local clearBlock = chooseData.keep ~= 1
  1609 + clearBlock = clearBlock and doChooseEffect(self, chooseData["button".. choose .."effect"], room, block, tag, chooseData)
  1610 + self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分
1571 1611 return true, clearBlock
1572 1612 end
1573 1613  
... ... @@ -1821,9 +1861,6 @@ function Adv:clickBlock(roomId, blockId, params)
1821 1861 if not block.isOpen then
1822 1862 if self.isRelay or checkAroundBlocks() then --开放
1823 1863 self:getCurMap():openBlock(roomId, blockId, true, true)
1824   - if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励
1825   - self:passAdvRelay()
1826   - end
1827 1864 status = true
1828 1865 end
1829 1866 else
... ...
src/adv/AdvMap.lua
... ... @@ -272,6 +272,10 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack)
272 272 if not ignoreBack then
273 273 self.adv:backBlockChange(roomId, blockId)
274 274 end
  275 +
  276 + if self.adv.isRelay and self:isAllOpen() then -- 发放翻开的奖励
  277 + self.adv:passAdvRelay()
  278 + end
275 279 end
276 280 return status
277 281 end
... ...
src/models/Activity.lua
... ... @@ -656,6 +656,12 @@ activityFunc[Activity.ActivityType.ActHeroPool] = {
656 656 local actData = self:getActData(actType)
657 657 local cfg = csvdb["activity_ctrlCsv"][actId]
658 658 if not cfg then return end
  659 + -- 保底次数转换成万能碎片
  660 + --local count = math.ceil(((actData[cfg.condition] or 0) / 100) * 60)
  661 + --if count > 0 then
  662 + -- local gift = {[723] = count}
  663 + -- self.owner:sendMail(MailId.ActivityPoolRet, nil, gift, {})
  664 + --end
659 665 actData[cfg.condition] = nil
660 666 self:updateActData(actType, actData, not notify)
661 667 end,
... ...
src/models/RolePlugin.lua
... ... @@ -849,9 +849,16 @@ function RolePlugin.bind(Role)
849 849 return runeSet
850 850 end
851 851  
852   - function Role:getAdvData()
  852 + function Role:getAdvData(notNotify)
853 853 if not self.advData then
854 854 self.advData = require("adv.Adv").new(self)
  855 + local status, err = pcall(function()
  856 + self.advData:initByInfo()
  857 + end)
  858 + if not status then
  859 + self.advData:forceOver(notNotify, true)
  860 + skynet.error("getAdvData error adv initByInfo " .. err)
  861 + end
855 862 end
856 863 return self.advData
857 864 end
... ... @@ -1678,8 +1685,34 @@ function RolePlugin.bind(Role)
1678 1685 self:updateProperty({field = "redp", value = redp})
1679 1686 end
1680 1687  
  1688 + -- 网页支付获取订单号
  1689 + function Role:getPurchaseOrderByPlatform(params)
  1690 + local checkPlatform = {
  1691 + ["mycard"] = "mycard_product_id",
  1692 + }
  1693 + local pidField = checkPlatform[params.payMode or ""]
  1694 + if not pidField or not params.product_id or params.product_id == "" then
  1695 + return "no product"
  1696 + end
  1697 +
  1698 + for k , v in pairs(csvdb["shop_rechargeCsv"]) do
  1699 + if not v[pidField] then return "no product" end
  1700 + if v[pidField] == params.product_id then
  1701 + if v.rmb ~= params.money then
  1702 + return "error money"
  1703 + end
  1704 + -- 发现需要的id
  1705 + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId)
  1706 + if partnerOrderId == "" then
  1707 + return "no product"
  1708 + end
  1709 + return json.encode({order = partnerOrderId})
  1710 + end
  1711 + end
  1712 + end
  1713 +
1681 1714 -- 获取充值订单号
1682   - function Role:getPurchaseOrder(rechargeId)
  1715 + function Role:getPurchaseOrder(rechargeId, transactionId)
1683 1716 local roleId = self:getProperty("id")
1684 1717 local rechargeData = csvdb["shop_rechargeCsv"][rechargeId]
1685 1718 if not rechargeData then
... ... @@ -1716,6 +1749,7 @@ function RolePlugin.bind(Role)
1716 1749 order = partnerOrderId,
1717 1750 rechargeId = rechargeId,
1718 1751 createTime = skynet.timex(),
  1752 + transactionId = transactionId,
1719 1753 })
1720 1754 order:create()
1721 1755 -- 正在进行中的订单 缓存
... ... @@ -1794,6 +1828,7 @@ function RolePlugin.bind(Role)
1794 1828 request.product_id = data.product_id
1795 1829 request.pay_time = data.pay_time
1796 1830 request.transactionId = data.order_no
  1831 + request.extension_info = data.extension_info
1797 1832 ]]
1798 1833 function Role:handlePurchase(params)
1799 1834 local roleId = self:getProperty("id")
... ... @@ -1824,6 +1859,10 @@ function RolePlugin.bind(Role)
1824 1859 })
1825 1860  
1826 1861 if not status then
  1862 + if params.extension_info == "mycard_web" then
  1863 + -- todo 发邮件
  1864 + skynet.error("mycard_web " .. params.order)
  1865 + end
1827 1866 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr,
1828 1867 result = "success", reward = reward}))
1829 1868 end
... ...
src/models/RolePvp.lua
... ... @@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异
9 9 local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分
10 10  
11 11 -- 匹配规则改为以排名来匹配
12   -local PVP_GET_ROBOT_SCORE = 2400 -- 2400分以下低档位匹配机器人
  12 +local PVP_GET_ROBOT_SCORE = 1300 -- 1300分以下低档位匹配机器人
13 13 local PRE_RANGE_COUNT = 20 -- 每个档位人数
14 14 local NEED_MATCH = 3 --匹配到多少人
15 15  
... ... @@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin)
73 73 if isWin then
74 74 local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400)))
75 75 myScore = myScore + scoreChange
76   - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3
  76 + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3
77 77 else
78 78 local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400)))
79 79 myScore = myScore - scoreChange
... ... @@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin)
139 139 if isWin then
140 140 local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000)))
141 141 myScore = myScore + scoreChange
142   - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3
  142 + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3
143 143 else
144 144 local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000)))
145 145 myScore = myScore - scoreChange
... ... @@ -530,7 +530,7 @@ function Role:changeCrossServerPvpSelfInfo(cType)
530 530 return
531 531 end
532 532 change.battleV = self:getProperty("pvpTBVH")
533   - change.heros = self:getProperty("pvpTSH")
  533 + change.team = self:getProperty("pvpTSH")
534 534 change.battleInfo = self:getProperty("pvpTBH")
535 535 end
536 536  
... ...
src/models/RoleTask.lua
... ... @@ -55,6 +55,7 @@ local TaskType = {
55 55 AdvKillBoss = 415, -- 拾荒击杀boss
56 56 AdvHangHeroCnt = 416, -- 拾荒人数
57 57 AdvCostPower = 417, -- 消耗体力
  58 + AdvPassFirst = 418, -- 冒险首次通关 - id
58 59  
59 60 --爬塔相关
60 61 TowerPass = 501, -- 爬塔通关 - level
... ... @@ -254,7 +255,7 @@ local StoreListener = {
254 255 [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}},
255 256 [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}},
256 257 [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}},
257   - [TaskType.AdvPass] = {{TriggerEventType.AdvPass, f("id")}},
  258 + [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}},
258 259 [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}},
259 260 }
260 261 }
... ... @@ -881,4 +882,4 @@ function RoleTask.bind(Role)
881 882  
882 883 end
883 884  
884   -return RoleTask
885 885 \ No newline at end of file
  886 +return RoleTask
... ...
src/models/RoleTimeReset.lua
... ... @@ -23,6 +23,11 @@ ResetFunc[&quot;CrossDay&quot;] = function(self, notify, response, now)
23 23 end
24 24 self:setProperty("advMine", advMine)
25 25  
  26 + local ltime = self:getProperty("ltime")
  27 + if isCrossMonth(ltime, now) then
  28 + self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id
  29 + end
  30 +
26 31 response.dTask = {}
27 32 response.advSup = self:getProperty("advSup")
28 33 self:log("onLogin")
... ... @@ -45,13 +50,6 @@ ResetFunc[&quot;CrossWeek&quot;] = function(self, notify, response)
45 50 self.activity:refreshWeekData(notify)
46 51 end
47 52  
48   -ResetFunc["CrossMonth"] = function(self, notify, response)
49   - local ltime = self:getProperty("ltime")
50   - if isCrossMonth(ltime, skynet.timex()) then
51   - self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id
52   - end
53   -end
54   -
55 53  
56 54 ResetFunc["DinerRank"] = function(self, notify, response)
57 55 self.dinerData:rankResetData(notify)
... ... @@ -91,13 +89,10 @@ function Role:updateTimeReset(now, notify)
91 89 ResetFunc[funcName](self, notify, response, now)
92 90 resetMode[funcName] = true
93 91 end
94   - if needResetId[resetId] then
95   - -- 充值商城购买记录
96   - self.storeData:resetStoreReored(resetId)
97   - end
98 92 end
99 93  
100 94 for resetId, round in pairs(needResetId) do
  95 + self.storeData:resetStoreReored(resetId)
101 96 timeReset[resetId] = round
102 97 end
103 98 self:setProperties({timeReset = timeReset, ltime = now})
... ...
src/utils/CommonFunc.lua
... ... @@ -100,7 +100,7 @@ end
100 100 -- 判断是不是同一个月
101 101 function isCrossMonth(target, now)
102 102 now = now or skynet.timex()
103   - local tarTm = os.date("*t", target)
  103 + local tarTm = os.date("*t", target - RESET_TIME * 3600)
104 104 local nowTm = os.date("*t", now - RESET_TIME * 3600)
105 105 if tarTm.year == nowTm.year and tarTm.month == nowTm.month then
106 106 return false
... ...