Commit a4a9148d46c75f7814b37fbc4eebf751fe7af256
Merge branch 'cn/develop' into cn/player
Showing
19 changed files
with
451 additions
and
53 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -397,10 +397,16 @@ TeamSystemType = { |
| 397 | 397 | Dinner = 4, |
| 398 | 398 | FriendBattle = 5, |
| 399 | 399 | } |
| 400 | +-- 加速类型 | |
| 401 | +UpSpeedType = { | |
| 402 | + ExplorationUpSpeed = 1, -- 探索加速 | |
| 403 | + GearUpSpeed = 2, -- 齿轮加速 | |
| 404 | + Restaurant = 3, -- 餐厅加速 | |
| 400 | 405 | |
| 406 | +} | |
| 401 | 407 | -- 某个功能对其他系统功能的加成类型 |
| 402 | 408 | SystemBnousType = { |
| 403 | - TowerBuff = 1, -- 电波塔内战斗开始时获得buff | |
| 409 | + TowerBuff = 1, -- 电波塔内战斗开始时获得buff or | |
| 404 | 410 | CrusadeTask = 2, -- 讨伐电台任务加速 |
| 405 | 411 | DinerGet = 3, -- 食材供应商获取速度 |
| 406 | 412 | DinerLimit = 4, -- 食材供应商上限 |
| ... | ... | @@ -410,4 +416,11 @@ SystemBnousType = { |
| 410 | 416 | HangTime = 8, -- 挂机时间上限 |
| 411 | 417 | PvpTicket = 9, -- 每周额外获得竞技场门票数量 |
| 412 | 418 | SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具 |
| 419 | + DismantlingMaximum = 11,-- 拆解术式模块运行时间上限 | |
| 420 | + DismantlingImproved = 12,-- 拆解术式构筑效率提升 | |
| 421 | + DailyReward = 13,-- 每日签到额外获得道具 | |
| 422 | + TreasureBaseMaximum = 14, -- 增加宝藏资源值上限 | |
| 423 | + UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 | |
| 424 | + ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 | |
| 425 | + ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, | |
| 413 | 426 | } | ... | ... |
src/ProtocolCode.lua
| ... | ... | @@ -56,6 +56,8 @@ actionCodes = { |
| 56 | 56 | Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品 |
| 57 | 57 | Role_getTimeGiftRpc = 141, |
| 58 | 58 | Role_runeBuyRpc = 142, -- 铭文购买 |
| 59 | + Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 | |
| 60 | + Role_setBgRpc = 144, -- 设置看板娘 | |
| 59 | 61 | |
| 60 | 62 | Adv_startAdvRpc = 151, |
| 61 | 63 | Adv_startHangRpc = 152, | ... | ... |
src/actions/ActivityAction.lua
| ... | ... | @@ -136,7 +136,14 @@ function _M.signRpc(agent, data) |
| 136 | 136 | end |
| 137 | 137 | signs[curDay] = yearMonth |
| 138 | 138 | |
| 139 | - local reward, change = role:award(monthData[curDay].item, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) | |
| 139 | + -- 达到一定等级,签到会有额外奖励 | |
| 140 | + local reward = role:getBnousDaily() | |
| 141 | + local change | |
| 142 | + local award = monthData[curDay].item:toNumMap() or {} | |
| 143 | + for k, v in pairs(award) do | |
| 144 | + reward[k] = (reward[k] or 0) + v | |
| 145 | + end | |
| 146 | + reward, change = role:award(reward, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) | |
| 140 | 147 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) |
| 141 | 148 | role:checkTaskEnter("SignIn") |
| 142 | 149 | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -897,6 +897,11 @@ function _M.wheelSurfRpc(agent, data) |
| 897 | 897 | local costs = {[ItemId.OldCoin] = cost[ctype]} |
| 898 | 898 | if not next(costs) then return 6 end |
| 899 | 899 | |
| 900 | + local tmpcount = 1 | |
| 901 | + if ctype == 2 then | |
| 902 | + tmpcount = 10 | |
| 903 | + end | |
| 904 | + if role:checkRuneFully(tmpcount) then return 6 end | |
| 900 | 905 | |
| 901 | 906 | if not role:checkItemEnough(costs) then return 5 end |
| 902 | 907 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -251,11 +251,20 @@ end |
| 251 | 251 | function _M.expediteSellRpc( agent, data ) |
| 252 | 252 | local role = agent.role |
| 253 | 253 | local count = role.dinerData:getProperty("expedite") |
| 254 | - local max = #globalCsv.diner_sell_quick_cost | |
| 255 | - if count > max then | |
| 256 | - return 1 | |
| 254 | + local maxIdx = #globalCsv.diner_sell_quick_cost | |
| 255 | + | |
| 256 | + -- 增加今日餐厅加速次数 | |
| 257 | + local max = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.Restaurant) | |
| 258 | + if count > max then return 1 end | |
| 259 | + | |
| 260 | + local costs = clone(globalCsv.diner_sell_quick_cost) | |
| 261 | + if count > maxIdx then | |
| 262 | + for idx = maxIdx+1, count do | |
| 263 | + costs[idx] = costs[maxIdx] | |
| 264 | + end | |
| 257 | 265 | end |
| 258 | - local diamond = globalCsv.diner_sell_quick_cost[count] | |
| 266 | + | |
| 267 | + local diamond = costs[count] | |
| 259 | 268 | if diamond > 0 then |
| 260 | 269 | local cost = {[ItemId.Jade] = diamond} |
| 261 | 270 | if not role:checkItemEnough(cost) then | ... | ... |
src/actions/EmailAction.lua
| ... | ... | @@ -14,19 +14,27 @@ local function loadEmails(roleId) |
| 14 | 14 | end |
| 15 | 15 | |
| 16 | 16 | local function delExpireEmails(roleId) |
| 17 | - local sql = [[ | |
| 18 | - DELETE FROM Email | |
| 19 | - WHERE id IN ( | |
| 20 | - SELECT id FROM ( | |
| 21 | - SELECT id | |
| 22 | - FROM Email WHERE roleId=%s | |
| 23 | - ORDER BY createtime DESC, id desc | |
| 24 | - LIMIT %s, 100000 | |
| 25 | - ) a | |
| 26 | - ); | |
| 27 | - ]] | |
| 17 | + --local sql = [[ | |
| 18 | + -- DELETE FROM Email | |
| 19 | + -- WHERE id IN ( | |
| 20 | + -- SELECT id FROM ( | |
| 21 | + -- SELECT id | |
| 22 | + -- FROM Email WHERE roleId=%s | |
| 23 | + -- ORDER BY createtime DESC, id desc | |
| 24 | + -- LIMIT %s, 100000 | |
| 25 | + -- ) a | |
| 26 | + -- ); | |
| 27 | + --]] | |
| 28 | + local sql = "SELECT id FROM Email WHERE roleId=%s ORDER BY createtime DESC, id desc LIMIT %s, 100000" | |
| 28 | 29 | sql = string.format(sql, roleId, EMAIL_LIMIT) |
| 29 | - mysqlproxy:query(sql) | |
| 30 | + local res = mysqlproxy:query(sql) | |
| 31 | + local tmp = {} | |
| 32 | + for _, v in ipairs(res) do | |
| 33 | + table.insert(tmp, v.id) | |
| 34 | + end | |
| 35 | + if next(tmp) then | |
| 36 | + mysqlproxy:query(string.format("DELETE FROM Email WHERE id IN (%s)", table.concat(tmp, ","))) | |
| 37 | + end | |
| 30 | 38 | end |
| 31 | 39 | |
| 32 | 40 | function _M.listRpc(agent, data) |
| ... | ... | @@ -94,7 +102,11 @@ local function getEmailAttachments( email ) |
| 94 | 102 | local rewardPms = email:getProperty("rewardPms") |
| 95 | 103 | local emailData = csvdb["emailCsv"][email:getProperty("emailId")] |
| 96 | 104 | if emailData then |
| 97 | - attachments = emailData.attachment:format(table.unpack(rewardPms)) | |
| 105 | + if next(rewardPms) then | |
| 106 | + attachments = emailData.attachment:format(table.unpack(rewardPms)) | |
| 107 | + else | |
| 108 | + attachments = emailData.attachment | |
| 109 | + end | |
| 98 | 110 | end |
| 99 | 111 | end |
| 100 | 112 | return attachments |
| ... | ... | @@ -120,6 +132,8 @@ function _M.drawAllAttachRpc(agent, data) |
| 120 | 132 | role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) |
| 121 | 133 | end |
| 122 | 134 | end |
| 135 | + if role:checkRuneFullyByReward(reward) then return 1 end | |
| 136 | + | |
| 123 | 137 | reward, change = role:award(reward, {log = {desc = "draw_attach"}}) |
| 124 | 138 | SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change})) |
| 125 | 139 | return true |
| ... | ... | @@ -139,7 +153,18 @@ function _M.drawAttachRpc(agent, data) |
| 139 | 153 | local attachments = getEmailAttachments(email) |
| 140 | 154 | if attachments == "" then return end |
| 141 | 155 | |
| 142 | - local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = id}}) | |
| 156 | + local reward, change = {} | |
| 157 | + if type(attachments) == "string" then | |
| 158 | + for key, v in pairs(attachments:toNumMap()) do | |
| 159 | + reward[key] = (reward[key] or 0) + v | |
| 160 | + end | |
| 161 | + else | |
| 162 | + reward = attachments | |
| 163 | + end | |
| 164 | + if role:checkRuneFullyByReward(reward) then return 1 end | |
| 165 | + reward, change = role:award(reward, {log = {desc = "draw_attach", int1 = id}}) | |
| 166 | + | |
| 167 | + | |
| 143 | 168 | email:setProperty("status", 2, true) |
| 144 | 169 | email:log(role, 2) |
| 145 | 170 | SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) | ... | ... |
src/actions/GmAction.lua
| ... | ... | @@ -1027,4 +1027,49 @@ function _M.savegenius(role, pms) |
| 1027 | 1027 | return "天赋点设置成功" |
| 1028 | 1028 | end |
| 1029 | 1029 | |
| 1030 | +table.insert(helpDes, {"清讨伐电台", "clear_radio", "id"}) | |
| 1031 | +function _M.clear_radio(role, pms) | |
| 1032 | + local id = pms.pm1 | |
| 1033 | + local radioTask = role:getProperty("radioTask") | |
| 1034 | + if id == 0 then | |
| 1035 | + radioTask[id] = nil | |
| 1036 | + else | |
| 1037 | + radioTask = {} | |
| 1038 | + end | |
| 1039 | + | |
| 1040 | + role:updateProperty({field = "radioTask", value = radioTask}) | |
| 1041 | + | |
| 1042 | + return "成功" | |
| 1043 | +end | |
| 1044 | + | |
| 1045 | +table.insert(helpDes, {"清代理拾荒", "clear_adv_hang", "id"}) | |
| 1046 | +function _M.clear_adv_hang(role, pms) | |
| 1047 | + local id = pms.pm1 | |
| 1048 | + local task = role:getProperty("advHang") | |
| 1049 | + if id == 0 then | |
| 1050 | + task[id] = nil | |
| 1051 | + else | |
| 1052 | + task = {} | |
| 1053 | + end | |
| 1054 | + | |
| 1055 | + role:updateProperty({field = "advHang", value = task}) | |
| 1056 | + | |
| 1057 | + return "成功" | |
| 1058 | +end | |
| 1059 | + | |
| 1060 | +table.insert(helpDes, {"清海港贸易", "clear_sea", "id"}) | |
| 1061 | +function _M.clear_radio(role, pms) | |
| 1062 | + local id = pms.pm1 | |
| 1063 | + local task = role:getProperty("seaport") | |
| 1064 | + if id == 0 then | |
| 1065 | + task.collect[id] = nil | |
| 1066 | + else | |
| 1067 | + task.collect = {} | |
| 1068 | + end | |
| 1069 | + | |
| 1070 | + role:updateProperty({field = "seaport", value = task}) | |
| 1071 | + | |
| 1072 | + return "成功" | |
| 1073 | +end | |
| 1074 | + | |
| 1030 | 1075 | return _M |
| 1031 | 1076 | \ No newline at end of file | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -478,6 +478,18 @@ function _M.quickRpc(agent , data) |
| 478 | 478 | |
| 479 | 479 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
| 480 | 480 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
| 481 | + | |
| 482 | + -- 增加今日探索加速次数 | |
| 483 | + local maxIdx = #costs | |
| 484 | + local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.ExplorationUpSpeed) | |
| 485 | + if curCount > maxCount then return end | |
| 486 | + | |
| 487 | + if curCount > maxIdx then | |
| 488 | + for idx = maxIdx+1, curCount do | |
| 489 | + costs[idx] = costs[maxIdx] | |
| 490 | + end | |
| 491 | + end | |
| 492 | + | |
| 481 | 493 | if not costs[curCount] then return end |
| 482 | 494 | if costs[curCount] > 0 then |
| 483 | 495 | if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end |
| ... | ... | @@ -568,7 +580,7 @@ function _M.buyBonusCountRpc(agent, data) |
| 568 | 580 | local bonusC = role.dailyData:getProperty("bonusC") |
| 569 | 581 | local extraCnt = role.storeData:getBonusExtraFightCount() |
| 570 | 582 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
| 571 | - local lastCount = globalCsv.bonus_daily_buy_count * coef + extraCnt - bonusC[btype]["b"] | |
| 583 | + local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | |
| 572 | 584 | if math.illegalNum(count, 1, lastCount) then return 1 end |
| 573 | 585 | |
| 574 | 586 | if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end |
| ... | ... | @@ -666,7 +678,7 @@ function _M.startBonusBattleRpc(agent, data) |
| 666 | 678 | if open and actData then |
| 667 | 679 | coef = tonumber(actData.condition2) |
| 668 | 680 | end |
| 669 | - if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | |
| 681 | + if math.illegalNum(count, 1, (globalCsv.bonus_daily_count + role:getBnousChangeBaseCount()) * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | |
| 670 | 682 | |
| 671 | 683 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count |
| 672 | 684 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -633,6 +633,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 633 | 633 | else |
| 634 | 634 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time |
| 635 | 635 | local unitTime = globalCsv.box_key_time[oldId] * 60 |
| 636 | + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) | |
| 636 | 637 | local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) |
| 637 | 638 | if doneCnt > 0 then |
| 638 | 639 | reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) |
| ... | ... | @@ -642,7 +643,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 642 | 643 | if role:getItemCount(itemId) >= limit then return 3 end |
| 643 | 644 | |
| 644 | 645 | boxL[slot] = {id = itemId, process = 0, time = skynet.timex()} |
| 645 | - role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600}) | |
| 646 | + role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()}) | |
| 646 | 647 | elseif oper == 2 then -- 重置运行时间(可以使用加速) |
| 647 | 648 | local quick = msg.quick |
| 648 | 649 | if not boxL[slot] then return 4 end |
| ... | ... | @@ -652,6 +653,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 652 | 653 | local stopTime = nowTime |
| 653 | 654 | local itemData = csvdb["itemCsv"][itemId] |
| 654 | 655 | local unitTime = globalCsv.box_key_time[itemId] * 60 |
| 656 | + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) | |
| 655 | 657 | if quick then |
| 656 | 658 | stopTime = nowTime + quick |
| 657 | 659 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
| ... | ... | @@ -661,6 +663,8 @@ function _M.openTimeBoxRpc(agent, data) |
| 661 | 663 | else |
| 662 | 664 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) |
| 663 | 665 | end |
| 666 | + stopTime = stopTime + role:getBnousDismantlingMaximum() | |
| 667 | + | |
| 664 | 668 | role:pushCancel({type = "box", slot = slot}) |
| 665 | 669 | |
| 666 | 670 | local doneCnt = math.floor((process + stopTime - time) / unitTime) |
| ... | ... | @@ -672,20 +676,24 @@ function _M.openTimeBoxRpc(agent, data) |
| 672 | 676 | end |
| 673 | 677 | |
| 674 | 678 | boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime} |
| 675 | - role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600}) | |
| 679 | + role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()}) | |
| 676 | 680 | elseif oper == 3 then -- 开箱子 |
| 677 | 681 | local costId = msg.costId |
| 678 | 682 | local costs = (msg.costs or ""):toNumMap() |
| 679 | 683 | if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end |
| 680 | - | |
| 684 | + | |
| 681 | 685 | local costIdData = csvdb["itemCsv"][costId] |
| 682 | - local count = 0 | |
| 686 | + local count, runeCount = 0, 0 | |
| 683 | 687 | for itemId, num in pairs(costs) do |
| 684 | 688 | local itemIdData = csvdb["itemCsv"][itemId] |
| 685 | 689 | if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end |
| 690 | + | |
| 691 | + if itemIdData.type == ItemType.Rune then runeCount = runeCount + num end | |
| 686 | 692 | count = count + num |
| 687 | 693 | end |
| 688 | 694 | |
| 695 | + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 | |
| 696 | + | |
| 689 | 697 | if role:getItemCount(costId) < count then return 8 end |
| 690 | 698 | if not role:checkItemEnough(costs) then return 9 end |
| 691 | 699 | |
| ... | ... | @@ -699,8 +707,8 @@ function _M.openTimeBoxRpc(agent, data) |
| 699 | 707 | role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}}) |
| 700 | 708 | for _ = 1, value do |
| 701 | 709 | for i = 1, 10 do |
| 702 | - local num = randomData["num" .. i] | |
| 703 | - local gift = randomData["gift" .. i] | |
| 710 | + local num = randomData["num" .. tostring(i)] | |
| 711 | + local gift = randomData["gift" .. tostring(i)] | |
| 704 | 712 | if num and gift and num > 0 and gift ~= "" then |
| 705 | 713 | local pool = {} |
| 706 | 714 | for _, temp in ipairs(gift:toArray()) do |
| ... | ... | @@ -1390,7 +1398,20 @@ end |
| 1390 | 1398 | function _M.goldBuyRpc(agent, data) |
| 1391 | 1399 | local role = agent.role |
| 1392 | 1400 | local curT = role.dailyData:getProperty("goldBuyT") |
| 1393 | - local costD = globalCsv.idle_quickMoney_cost[curT] | |
| 1401 | + | |
| 1402 | + local costs = clone(globalCsv.idle_quickMoney_cost) | |
| 1403 | + -- 增加今日齿轮加速次数 | |
| 1404 | + local maxIdx = #globalCsv.idle_quickMoney_cost | |
| 1405 | + local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed) | |
| 1406 | + if curT > maxCount then return end | |
| 1407 | + if curT > maxIdx then | |
| 1408 | + for idx = maxIdx+1, curCount do | |
| 1409 | + costs[idx] = costs[maxIdx] | |
| 1410 | + end | |
| 1411 | + end | |
| 1412 | + | |
| 1413 | + local costD = costs[curT] | |
| 1414 | + | |
| 1394 | 1415 | if not costD then |
| 1395 | 1416 | return 1 |
| 1396 | 1417 | end |
| ... | ... | @@ -1583,4 +1604,27 @@ function _M.runeBuyRpc(agent, data) |
| 1583 | 1604 | return true |
| 1584 | 1605 | end |
| 1585 | 1606 | |
| 1607 | +function _M.setFriendTeamRpc(agent, data) | |
| 1608 | + local role = agent.role | |
| 1609 | + local msg = MsgPack.unpack(data) | |
| 1610 | + local team = msg.team | |
| 1611 | + local info = {} | |
| 1612 | + info.team = role:getTeamHerosInfo(team) | |
| 1613 | + info.bInfo = role:getTeamBattleInfo(team) | |
| 1614 | + info.v = role:getTeamBattleValue(team.heros) | |
| 1615 | + role:updateProperty({field="friendTeam", value=info}) | |
| 1616 | + | |
| 1617 | + SendPacket(actionCodes.Role_setFriendTeamRpc, "") | |
| 1618 | + return true | |
| 1619 | +end | |
| 1620 | + | |
| 1621 | +function _M.setBgRpc(agent, data) | |
| 1622 | + local role = agent.role | |
| 1623 | + local msg = MsgPack.unpack(data) | |
| 1624 | + role:updateProperty({field="bgId", value=msg.id}) | |
| 1625 | + | |
| 1626 | + SendPacket(actionCodes.Role_setBgRpc, "") | |
| 1627 | + return true | |
| 1628 | +end | |
| 1629 | + | |
| 1586 | 1630 | return _M |
| 1587 | 1631 | \ No newline at end of file | ... | ... |
src/actions/TowerAction.lua
| ... | ... | @@ -114,9 +114,9 @@ function _M.endBattleRpc(agent, data) |
| 114 | 114 | |
| 115 | 115 | curLevel = curLevel + 1 |
| 116 | 116 | reward, change = role:award(rewardStr, {log = {desc = "towerBattle", int1 = id}}) |
| 117 | - if towerType == 0 then | |
| 118 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l, type = towerType + 1}) | |
| 119 | - end | |
| 117 | + --if towerType == 0 then | |
| 118 | + role:checkTaskEnter("TowerPass", {level = curLevel % 10000, type = towerType + 1}) | |
| 119 | + --end | |
| 120 | 120 | end |
| 121 | 121 | |
| 122 | 122 | if towerType == 0 then | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -881,6 +881,8 @@ function Adv:over(success, rewardRatio, overType) |
| 881 | 881 | reward[itemId] = math.ceil(count * rewardRatio / 100) |
| 882 | 882 | end |
| 883 | 883 | end |
| 884 | + | |
| 885 | + self.owner:checkRuneCount(reward) | |
| 884 | 886 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
| 885 | 887 | |
| 886 | 888 | local backAdvCount | ... | ... |
src/models/Role.lua
| ... | ... | @@ -30,6 +30,7 @@ function Role:ctor( properties ) |
| 30 | 30 | self.advData = nil |
| 31 | 31 | self.activity = nil |
| 32 | 32 | self._pushToken = nil |
| 33 | + self._lastSaveTs = skynet.timex() | |
| 33 | 34 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 |
| 34 | 35 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 |
| 35 | 36 | if self.advOverTime == 0 then |
| ... | ... | @@ -75,6 +76,7 @@ Role.schema = { |
| 75 | 76 | expireItem = {"table", {}}, --物品过期检查 |
| 76 | 77 | funcOpen = {"table", {}}, --功能是否开放 |
| 77 | 78 | funcLv = {"table", {}}, --功能等级 |
| 79 | + levelBnous = {"table", {}}, --等级奖励 | |
| 78 | 80 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
| 79 | 81 | crown = {"number", 0}, -- 看伴娘 |
| 80 | 82 | silent = {"number", 0}, --禁言解禁时间 |
| ... | ... | @@ -205,6 +207,10 @@ Role.schema = { |
| 205 | 207 | roleIncre = {"table", {}}, -- 角色英雄,铭文,火花自增序列 {heroId = 1, runeId = 1, sparkId = 1} |
| 206 | 208 | |
| 207 | 209 | unlockChap = {"table", {}}, -- 解锁的章节 |
| 210 | + | |
| 211 | + heroCnt = {"number", 0}, -- 英雄数量 | |
| 212 | + friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0} | |
| 213 | + bgId = {"number", 0}, -- 看板娘id | |
| 208 | 214 | } |
| 209 | 215 | |
| 210 | 216 | |
| ... | ... | @@ -349,6 +355,7 @@ function Role:data() |
| 349 | 355 | items = self:getProperty("items"):toNumMap(), |
| 350 | 356 | funcOpen = self:getProperty("funcOpen"), |
| 351 | 357 | funcLv = self:getProperty("funcLv"), |
| 358 | + levelBnous = self:getProperty("levelBnous"), | |
| 352 | 359 | -- loveStatus = self:getProperty("loveStatus"):toNumMap(), |
| 353 | 360 | timeReset = self:getProperty("timeReset"), |
| 354 | 361 | diamond = self:getAllDiamond(), |
| ... | ... | @@ -444,6 +451,8 @@ function Role:data() |
| 444 | 451 | returner = self:getProperty("returner"), |
| 445 | 452 | |
| 446 | 453 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 |
| 454 | + friendTeam = self:getProperty("friendTeam"), | |
| 455 | + bgId = self:getProperty("bgId"), | |
| 447 | 456 | } |
| 448 | 457 | end |
| 449 | 458 | ... | ... |
src/models/RoleCross.lua
| ... | ... | @@ -11,7 +11,9 @@ RoleCross.bind = function (Role) |
| 11 | 11 | level = self:getProperty("level"), |
| 12 | 12 | headId = self:getProperty("headId"), |
| 13 | 13 | ltime = self:getProperty("ltime"), |
| 14 | - battleV = self:getProperty("pvpTBVC") ~= 0 and self:getProperty("pvpTBVC") or self:getProperty("hangTBV") | |
| 14 | + | |
| 15 | + battleV = self.getProperty("friendTeam").v or 0, | |
| 16 | + --battleV = self:getProperty("pvpTBVC") ~= 0 and self:getProperty("pvpTBVC") or self:getProperty("hangTBV") | |
| 15 | 17 | } |
| 16 | 18 | return info |
| 17 | 19 | end |
| ... | ... | @@ -19,8 +21,13 @@ RoleCross.bind = function (Role) |
| 19 | 21 | -- 好友详细队伍信息 |
| 20 | 22 | function Role:friendInfo() |
| 21 | 23 | local info = self:friendSInfo() |
| 22 | - local team = self:getProperty("pvpTBVC") ~= 0 and self:getProperty("pvpTSC") or self:getProperty("hangTS") | |
| 23 | - info.team = team | |
| 24 | + --local team = self:getProperty("pvpTBVC") ~= 0 and self:getProperty("pvpTSC") or self:getProperty("hangTS") | |
| 25 | + --info.team = team | |
| 26 | + info.team = self:getProperty("friendTeam").team or {} | |
| 27 | + info.heroCnt = self:getProperty("heroCnt") | |
| 28 | + info.achieveCnt = table.numbers(self:getProperty("achiveV")) | |
| 29 | + info.bgId = self:getProperty("bgId") | |
| 30 | + info.hangPass = self:getProperty("hangPass") | |
| 24 | 31 | return info |
| 25 | 32 | end |
| 26 | 33 | |
| ... | ... | @@ -274,31 +281,42 @@ function CMD.getProperties(roleId, fields) |
| 274 | 281 | end |
| 275 | 282 | |
| 276 | 283 | function CMD.friendSInfo(roleId) |
| 277 | - local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "pvpTBVC", "hangTBV"}) | |
| 284 | + --local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "pvpTBVC", "hangTBV"}) | |
| 285 | + local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "friendTeam"}) | |
| 278 | 286 | return { |
| 279 | 287 | name = info.name, |
| 280 | 288 | level = info.level, |
| 281 | 289 | headId = info.headId, |
| 282 | 290 | ltime = info.ltime, |
| 283 | - battleV = info.pvpTBVC ~= 0 and info.pvpTBVC or info.hangTBV, | |
| 291 | + --battleV = info.pvpTBVC ~= 0 and info.pvpTBVC or info.hangTBV, | |
| 292 | + battleV = info.friendTeam.v or 0, | |
| 284 | 293 | } |
| 285 | 294 | end |
| 286 | 295 | |
| 287 | 296 | function CMD.friendInfo(roleId) |
| 288 | - local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "pvpTBVC", "hangTBV", "pvpTSC", "hangTS"}) | |
| 297 | + --local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "pvpTBVC", "hangTBV", "pvpTSC", "hangTS"}) | |
| 298 | + local info = CMD.getProperties(roleId, {"name", "level", "headId", "ltime", "friendTeam", "heroCnt", "achiveV", "bgId", "hangPass"}) | |
| 289 | 299 | return { |
| 290 | 300 | name = info.name, |
| 291 | 301 | level = info.level, |
| 292 | 302 | headId = info.headId, |
| 293 | 303 | ltime = info.ltime, |
| 294 | - battleV = info.pvpTBVC ~= 0 and info.pvpTBVC or info.hangTBV, | |
| 295 | - team = info.pvpTBVC ~= 0 and info.pvpTSC or info.hangTS | |
| 304 | + --battleV = info.pvpTBVC ~= 0 and info.pvpTBVC or info.hangTBV, | |
| 305 | + --team = info.pvpTBVC ~= 0 and info.pvpTSC or info.hangTS | |
| 306 | + battleV = info.friendTeam.v or 0, | |
| 307 | + team = info.friendTeam.team or {}, | |
| 308 | + heroCnt = info.heroCnt, | |
| 309 | + achieveCnt = table.numbers(info.achiveV), | |
| 310 | + bgId = info.bgId, | |
| 311 | + hangPass = info.hangPass, | |
| 296 | 312 | } |
| 297 | 313 | end |
| 298 | 314 | |
| 299 | 315 | function CMD.friendBattleInfo(roleId) |
| 300 | - local info = CMD.getProperties(roleId, {"pvpTBC", "hangTB"}) | |
| 301 | - return (next(info.pvpTBC) and next(info.pvpTBC.heros)) and info.pvpTBC or info.hangTB | |
| 316 | + --local info = CMD.getProperties(roleId, {"pvpTBC", "hangTB"}) | |
| 317 | + local info = CMD.getProperties(roleId, {"friendTeam"}) | |
| 318 | + --return (next(info.pvpTBC) and next(info.pvpTBC.heros)) and info.pvpTBC or info.hangTB | |
| 319 | + return info.friendTeam.bInfo or {} | |
| 302 | 320 | end |
| 303 | 321 | |
| 304 | 322 | function CMD.pvpCInfo(roleId) | ... | ... |
src/models/RoleLog.lua
| ... | ... | @@ -4,7 +4,7 @@ local logproxy = require "shared.logproxy" |
| 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
| ... | ... | @@ -284,6 +284,7 @@ function RolePlugin.bind(Role) |
| 284 | 284 | newExp = newExp - csvdb["player_expCsv"][level].exp |
| 285 | 285 | level = level + 1 |
| 286 | 286 | self:checkTaskEnter("RoleLevelUp", {level = level}) |
| 287 | + self:getLevelBnous(level) | |
| 287 | 288 | else |
| 288 | 289 | newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 |
| 289 | 290 | end |
| ... | ... | @@ -603,6 +604,7 @@ function RolePlugin.bind(Role) |
| 603 | 604 | SendPacket(actionCodes.Hero_loadInfos, bin) |
| 604 | 605 | end |
| 605 | 606 | |
| 607 | + self:updateProperty({field = "heroCnt", value = #self.heros}) | |
| 606 | 608 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) |
| 607 | 609 | |
| 608 | 610 | if params.log then |
| ... | ... | @@ -1929,10 +1931,15 @@ function RolePlugin.bind(Role) |
| 1929 | 1931 | function Role:onRecoverTimer(now) |
| 1930 | 1932 | self:updateTimeReset(now, true) |
| 1931 | 1933 | self:checkNewEvent(now) |
| 1932 | - self:saveRoleData() | |
| 1934 | + self:saveRoleData(now) | |
| 1933 | 1935 | end |
| 1934 | 1936 | |
| 1935 | - function Role:saveRoleData() | |
| 1937 | + local SAVE_DATA_INTERVAL = 3 | |
| 1938 | + function Role:saveRoleData(now) | |
| 1939 | + if now - self._lastSaveTs < SAVE_DATA_INTERVAL then | |
| 1940 | + return | |
| 1941 | + end | |
| 1942 | + self._lastSaveTs = now | |
| 1936 | 1943 | self:update() |
| 1937 | 1944 | local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre} |
| 1938 | 1945 | for _, info in ipairs(objs) do |
| ... | ... | @@ -2753,45 +2760,149 @@ function RolePlugin.bind(Role) |
| 2753 | 2760 | |
| 2754 | 2761 | function Role:getBnousCrusade(value) |
| 2755 | 2762 | local towerBnous = self:getTowerBnousActive() |
| 2756 | - return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) | |
| 2763 | + local levelValue = self:getDeltaValue(self:getProperty("levelBnous")[SystemBnousType.CrusadeTask], value) | |
| 2764 | + local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) | |
| 2765 | + return levelValue + towerValue | |
| 2757 | 2766 | end |
| 2758 | 2767 | |
| 2759 | 2768 | function Role:getBnousDiner(type, value) |
| 2760 | 2769 | local towerBnous = self:getTowerBnousActive() |
| 2761 | 2770 | type = type or 1 |
| 2762 | - local result | |
| 2771 | + local result, levelReault | |
| 2763 | 2772 | if type == 1 then |
| 2764 | 2773 | result = towerBnous[SystemBnousType.DinerGet] |
| 2774 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet] | |
| 2765 | 2775 | elseif type == 2 then |
| 2766 | 2776 | result = towerBnous[SystemBnousType.DinerLimit] |
| 2777 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit] | |
| 2767 | 2778 | elseif type == 3 then |
| 2768 | 2779 | result = towerBnous[SystemBnousType.DinerSell] |
| 2780 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell] | |
| 2769 | 2781 | elseif type == 4 then |
| 2770 | 2782 | result = towerBnous[SystemBnousType.DinerPrice] |
| 2783 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice] | |
| 2771 | 2784 | end |
| 2772 | - return self:getDeltaValue(result, value) | |
| 2785 | + return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) | |
| 2773 | 2786 | end |
| 2774 | 2787 | |
| 2788 | + local function appendBnous(dstBnous, srcBnous) | |
| 2789 | + if not dstBnous or not srcBnous then return end | |
| 2790 | + for time, set in pairs(srcBnous) do | |
| 2791 | + if not dstBnous[time] then | |
| 2792 | + dstBnous[time] = {} | |
| 2793 | + end | |
| 2794 | + for key, value in pairs(set) do | |
| 2795 | + dstBnous[time][key] = (dstBnous[time][key] or 0) + value | |
| 2796 | + end | |
| 2797 | + end | |
| 2798 | + end | |
| 2775 | 2799 | function Role:getBnousAdv() |
| 2776 | 2800 | local towerBnous = self:getTowerBnousActive() |
| 2801 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {} | |
| 2802 | + appendBnous(towerBnous[SystemBnousType.Adv], levelBnous) | |
| 2777 | 2803 | return towerBnous[SystemBnousType.Adv] or {} |
| 2778 | 2804 | end |
| 2779 | 2805 | |
| 2780 | 2806 | function Role:getBnousHangTime() |
| 2781 | 2807 | local towerBnous = self:getTowerBnousActive() |
| 2782 | - return towerBnous[SystemBnousType.HangTime] or 0 | |
| 2808 | + local levelBnous = self:getProperty("levelBnous") or {} | |
| 2809 | + local tmptime = 0 | |
| 2810 | + if next(levelBnous) then | |
| 2811 | + tmptime = levelBnous[SystemBnousType.HangTime] or 0 | |
| 2812 | + end | |
| 2813 | + return towerBnous[SystemBnousType.HangTime] or 0 + tmptime | |
| 2783 | 2814 | end |
| 2784 | 2815 | |
| 2785 | 2816 | function Role:getBnousPvpTicket() |
| 2786 | 2817 | local towerBnous = self:getTowerBnousActive() |
| 2818 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {} | |
| 2819 | + appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous) | |
| 2787 | 2820 | return towerBnous[SystemBnousType.PvpTicket] or {} |
| 2788 | 2821 | end |
| 2789 | 2822 | |
| 2790 | 2823 | function Role:getBnousSweep() |
| 2791 | 2824 | local towerBnous = self:getTowerBnousActive() |
| 2825 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {} | |
| 2826 | + appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous) | |
| 2792 | 2827 | return towerBnous[SystemBnousType.SweepReward] or {} |
| 2793 | 2828 | end |
| 2794 | 2829 | |
| 2830 | + function Role:getBnousDismantlingMaximum() | |
| 2831 | + return self:getProperty("levelBnous")[SystemBnousType.DismantlingMaximum] or 0 | |
| 2832 | + end | |
| 2833 | + | |
| 2834 | + function Role:getBnousDismantlingImproved(value) | |
| 2835 | + local result = self:getProperty("levelBnous")[SystemBnousType.DismantlingImproved] or {} | |
| 2836 | + return self:getDeltaValue(result, value) | |
| 2837 | + end | |
| 2838 | + | |
| 2839 | + function Role:getBnousDaily() | |
| 2840 | + local reward = {} | |
| 2841 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.DailyReward] or {} | |
| 2842 | + for k, v in pairs(levelBnous) do | |
| 2843 | + reward[k] = (reward[k] or 0) + v | |
| 2844 | + end | |
| 2845 | + return reward | |
| 2846 | + end | |
| 2847 | + | |
| 2848 | + function Role:getBnousTreasureBaseMaximum() | |
| 2849 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.TreasureBaseMaximum] or 0 | |
| 2850 | + local treasureBase = self.dailyData:getProperty("treasureBase") + levelBnous | |
| 2851 | + self.dailyData:updateProperty({field = "treasureBase", value = treasureBase}) | |
| 2852 | + end | |
| 2853 | + | |
| 2854 | + --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 | |
| 2855 | + function Role:getBnousUpSpeedNum(upType) | |
| 2856 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.UpSpeedNum] or {} | |
| 2857 | + if next(levelBnous) then | |
| 2858 | + return levelBnous[upType] or 0 | |
| 2859 | + end | |
| 2860 | + return 0 | |
| 2861 | + end | |
| 2862 | + | |
| 2863 | + function Role:getBnousChangeBaseCount() | |
| 2864 | + return self:getProperty("levelBnous")[SystemBnousType.ChangeBaseCount] or 0 | |
| 2865 | + end | |
| 2866 | + | |
| 2867 | + function Role:getBnousChangeBuyCount() | |
| 2868 | + return self:getProperty("levelBnous")[SystemBnousType.ChangeBuyCount] or 0 | |
| 2869 | + end | |
| 2870 | + | |
| 2871 | + function Role:getLevelBnous(level) | |
| 2872 | + local levelBnous = self:getProperty("levelBnous") | |
| 2873 | + local additionData = csvdb["level_additionCsv"][level] | |
| 2874 | + if additionData then | |
| 2875 | + local effects = additionData.effect:toTableArraySec() | |
| 2876 | + for _, effect in pairs(effects) do | |
| 2877 | + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4]) | |
| 2878 | + if not levelBnous[pm1] then | |
| 2879 | + levelBnous[pm1] = {} | |
| 2880 | + end | |
| 2881 | + if pm1 == SystemBnousType.TowerBuff then | |
| 2882 | + | |
| 2883 | + elseif pm1 == SystemBnousType.Adv then | |
| 2884 | + if not levelBnous[pm1][pm4] then | |
| 2885 | + levelBnous[pm1][pm4] = {} | |
| 2886 | + end | |
| 2887 | + levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3 | |
| 2888 | + elseif pm1 == SystemBnousType.HangTime or | |
| 2889 | + pm1 == SystemBnousType.DismantlingMaximum or | |
| 2890 | + pm1 == SystemBnousType.TreasureBaseMaximum or | |
| 2891 | + pm1 == SystemBnousType.ChangeBaseCount or | |
| 2892 | + pm1 == SystemBnousType.ChangeBuyCount then | |
| 2893 | + if type(levelBnous[pm1]) == "table" then | |
| 2894 | + levelBnous[pm1] = 0 | |
| 2895 | + end | |
| 2896 | + levelBnous[pm1] = levelBnous[pm1] + pm2 | |
| 2897 | + else | |
| 2898 | + levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | |
| 2899 | + end | |
| 2900 | + end | |
| 2901 | + end | |
| 2902 | + self:updateProperty({field = "levelBnous", value= levelBnous}) | |
| 2903 | + return levelBnous | |
| 2904 | + end | |
| 2905 | + | |
| 2795 | 2906 | function Role:getPotionLevel(id) |
| 2796 | 2907 | local level = self.dinerData:getProperty("dishTree"):getv(id, 1) |
| 2797 | 2908 | local talentSet = csvdb["diner_talentCsv"][id] |
| ... | ... | @@ -2823,6 +2934,74 @@ function RolePlugin.bind(Role) |
| 2823 | 2934 | self:mylog("hero_action", {desc = desc, int1 = heroType}) |
| 2824 | 2935 | end |
| 2825 | 2936 | |
| 2937 | + function Role:getRuneBatCount() | |
| 2938 | + local count = 0 | |
| 2939 | + for _, rune in pairs(self.runeBag) do | |
| 2940 | + if next(rune) then | |
| 2941 | + count = count + 1 | |
| 2942 | + end | |
| 2943 | + end | |
| 2944 | + return count or 0 | |
| 2945 | + end | |
| 2946 | + | |
| 2947 | + -- 铭文仓库是否满仓 | |
| 2948 | + function Role:checkRuneFully(count) | |
| 2949 | + count = count or 0 | |
| 2950 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2951 | + local limit = self:getProperty("bagLimit")[page] | |
| 2952 | + return self:getRuneBatCount() + count > limit | |
| 2953 | + end | |
| 2954 | + | |
| 2955 | + function Role:checkRuneFullyByReward(reward) | |
| 2956 | + local count = self:getRuneBatCount() | |
| 2957 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2958 | + local limit = self:getProperty("bagLimit")[page] | |
| 2959 | + if count >= limit then | |
| 2960 | + return true | |
| 2961 | + end | |
| 2962 | + for itemId, n in pairs(reward) do | |
| 2963 | + local itemData = csvdb["itemCsv"][itemId] | |
| 2964 | + if itemData and itemData.type == ItemType.Rune then | |
| 2965 | + count = count + n | |
| 2966 | + if count > limit then return true end | |
| 2967 | + end | |
| 2968 | + end | |
| 2969 | + return false | |
| 2970 | + end | |
| 2971 | + | |
| 2972 | + -- 把溢出的铭文奖励通过邮件发送 | |
| 2973 | + function Role:checkRuneCount(reward) | |
| 2974 | + local firstMore = false | |
| 2975 | + local count = self:getRuneBatCount() | |
| 2976 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2977 | + local limit = self:getProperty("bagLimit")[page] | |
| 2978 | + if count >= limit then | |
| 2979 | + firstMore = true | |
| 2980 | + end | |
| 2981 | + | |
| 2982 | + local tmpreward = {} | |
| 2983 | + for itemId, n in pairs(reward) do | |
| 2984 | + local itemData = csvdb["itemCsv"][itemId] | |
| 2985 | + if itemData and itemData.type == ItemType.Rune then | |
| 2986 | + count = count + n | |
| 2987 | + if count > limit then | |
| 2988 | + if not firstMore then | |
| 2989 | + firstMore = true | |
| 2990 | + reward[itemId] = n - (count - limit) | |
| 2991 | + tmpreward[itemId] = count - limit | |
| 2992 | + else | |
| 2993 | + reward[itemId] = nil | |
| 2994 | + tmpreward[itemId] = n | |
| 2995 | + end | |
| 2996 | + end | |
| 2997 | + end | |
| 2998 | + end | |
| 2999 | + if next(tmpreward) then | |
| 3000 | + self:sendMail(20, nil, tmpreward) | |
| 3001 | + end | |
| 3002 | + end | |
| 3003 | + | |
| 3004 | + | |
| 2826 | 3005 | end |
| 2827 | 3006 | |
| 2828 | 3007 | return RolePlugin |
| 2829 | 3008 | \ No newline at end of file | ... | ... |
src/models/RoleTask.lua
| ... | ... | @@ -810,7 +810,7 @@ function RoleTask.bind(Role) |
| 810 | 810 | calTask[id] = (calTask[id] or 0) + 1 |
| 811 | 811 | end |
| 812 | 812 | elseif cfg.type == 13 then -- 挑战电波塔主塔 |
| 813 | - if cfg.condition2 == param1 and param2 == 1 then | |
| 813 | + if cfg.condition2 <= param1 and param2 == 1 then | |
| 814 | 814 | calTask[id] = (calTask[id] or 0) + 1 |
| 815 | 815 | end |
| 816 | 816 | end | ... | ... |
src/services/dbseed.lua
| ... | ... | @@ -100,6 +100,9 @@ local function initAutoIncreUidTable() |
| 100 | 100 | mysqlproxy:query(string.format(tpl, "seaportTime0", 0)) |
| 101 | 101 | mysqlproxy:query(string.format(tpl, "seaportTime1", 0)) |
| 102 | 102 | mysqlproxy:query(string.format(tpl, "seaportTime2", 0)) |
| 103 | + | |
| 104 | + -- 记录当前更新版本 | |
| 105 | + mysqlproxy:query(string.format(tpl, "db_ver", 0)) | |
| 103 | 106 | end |
| 104 | 107 | end |
| 105 | 108 | |
| ... | ... | @@ -255,6 +258,31 @@ local function selectDb() |
| 255 | 258 | end |
| 256 | 259 | end |
| 257 | 260 | |
| 261 | +local function doUpdateSql() | |
| 262 | + local updates = { | |
| 263 | + [1] = { | |
| 264 | + "ALTER TABLE `Email` ADD INDEX roleid_createtime_id(`roleId`,`createtime`,`id`),DROP INDEX roleId_Index", | |
| 265 | + "ALTER TABLE `Role` ADD INDEX uid_Index(`uid`)", | |
| 266 | + }, | |
| 267 | + } | |
| 268 | + -- 更新记录表 | |
| 269 | + local res = mysqlproxy:query("SELECT `value` FROM `autoincrement_set` WHERE `key` = 'db_ver';") | |
| 270 | + local ver = res[1].value | |
| 271 | + for k, sqls in ipairs(updates) do | |
| 272 | + if ver < k then | |
| 273 | + skynet.error("do update sql, version:"..k) | |
| 274 | + for _, sql in ipairs(sqls) do | |
| 275 | + local r = mysqlproxy:query(sql) | |
| 276 | + if r["errno"] then | |
| 277 | + skynet.error(string.format("%s, err:%s",sql, r["err"])) | |
| 278 | + return | |
| 279 | + end | |
| 280 | + end | |
| 281 | + mysqlproxy:query(string.format("UPDATE `autoincrement_set` SET `value` = %d WHERE `key` = 'db_ver';", k)) | |
| 282 | + end | |
| 283 | + end | |
| 284 | +end | |
| 285 | + | |
| 258 | 286 | skynet.start(function () |
| 259 | 287 | --local new = redisproxy:hsetnx("autoincrement_set", "server_start", os.date("%Y%m%d", skynet.timex())) == 1 |
| 260 | 288 | --if not new then |
| ... | ... | @@ -273,6 +301,7 @@ skynet.start(function () |
| 273 | 301 | initRedisDb() |
| 274 | 302 | initSeaportTask() -- 海港任务数据初始化 |
| 275 | 303 | loadAllUserInfo() |
| 304 | + doUpdateSql() -- 执行更新sql | |
| 276 | 305 | selectDb() |
| 277 | 306 | skynet.exit() |
| 278 | 307 | end) |
| 279 | 308 | \ No newline at end of file | ... | ... |
src/utils/MysqlUtil.lua
| ... | ... | @@ -34,7 +34,6 @@ function addFriend(roleId, friendId) |
| 34 | 34 | rpcRole(roleId, "addFriend", friendId) |
| 35 | 35 | rpcRole(friendId, "addFriend", roleId) |
| 36 | 36 | end |
| 37 | - dump(r) | |
| 38 | 37 | end |
| 39 | 38 | |
| 40 | 39 | function delFriend(roleId, friendId) |
| ... | ... | @@ -44,7 +43,6 @@ function delFriend(roleId, friendId) |
| 44 | 43 | rpcRole(roleId, "delFriend", friendId) |
| 45 | 44 | rpcRole(friendId, "delFriend", roleId) |
| 46 | 45 | end |
| 47 | - dump(r) | |
| 48 | 46 | end |
| 49 | 47 | |
| 50 | 48 | function roleExists(roleId) | ... | ... |