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,10 +397,16 @@ TeamSystemType = { | ||
| 397 | Dinner = 4, | 397 | Dinner = 4, | 
| 398 | FriendBattle = 5, | 398 | FriendBattle = 5, | 
| 399 | } | 399 | } | 
| 400 | +-- 加速类型 | ||
| 401 | +UpSpeedType = { | ||
| 402 | + ExplorationUpSpeed = 1, -- 探索加速 | ||
| 403 | + GearUpSpeed = 2, -- 齿轮加速 | ||
| 404 | + Restaurant = 3, -- 餐厅加速 | ||
| 400 | 405 | ||
| 406 | +} | ||
| 401 | -- 某个功能对其他系统功能的加成类型 | 407 | -- 某个功能对其他系统功能的加成类型 | 
| 402 | SystemBnousType = { | 408 | SystemBnousType = { | 
| 403 | - TowerBuff = 1, -- 电波塔内战斗开始时获得buff | 409 | + TowerBuff = 1, -- 电波塔内战斗开始时获得buff or | 
| 404 | CrusadeTask = 2, -- 讨伐电台任务加速 | 410 | CrusadeTask = 2, -- 讨伐电台任务加速 | 
| 405 | DinerGet = 3, -- 食材供应商获取速度 | 411 | DinerGet = 3, -- 食材供应商获取速度 | 
| 406 | DinerLimit = 4, -- 食材供应商上限 | 412 | DinerLimit = 4, -- 食材供应商上限 | 
| @@ -410,4 +416,11 @@ SystemBnousType = { | @@ -410,4 +416,11 @@ SystemBnousType = { | ||
| 410 | HangTime = 8, -- 挂机时间上限 | 416 | HangTime = 8, -- 挂机时间上限 | 
| 411 | PvpTicket = 9, -- 每周额外获得竞技场门票数量 | 417 | PvpTicket = 9, -- 每周额外获得竞技场门票数量 | 
| 412 | SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具 | 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,6 +56,8 @@ actionCodes = { | ||
| 56 | Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品 | 56 | Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品 | 
| 57 | Role_getTimeGiftRpc = 141, | 57 | Role_getTimeGiftRpc = 141, | 
| 58 | Role_runeBuyRpc = 142, -- 铭文购买 | 58 | Role_runeBuyRpc = 142, -- 铭文购买 | 
| 59 | + Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 | ||
| 60 | + Role_setBgRpc = 144, -- 设置看板娘 | ||
| 59 | 61 | ||
| 60 | Adv_startAdvRpc = 151, | 62 | Adv_startAdvRpc = 151, | 
| 61 | Adv_startHangRpc = 152, | 63 | Adv_startHangRpc = 152, | 
src/actions/ActivityAction.lua
| @@ -136,7 +136,14 @@ function _M.signRpc(agent, data) | @@ -136,7 +136,14 @@ function _M.signRpc(agent, data) | ||
| 136 | end | 136 | end | 
| 137 | signs[curDay] = yearMonth | 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 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) | 147 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) | 
| 141 | role:checkTaskEnter("SignIn") | 148 | role:checkTaskEnter("SignIn") | 
| 142 | 149 | 
src/actions/AdvAction.lua
| @@ -897,6 +897,11 @@ function _M.wheelSurfRpc(agent, data) | @@ -897,6 +897,11 @@ function _M.wheelSurfRpc(agent, data) | ||
| 897 | local costs = {[ItemId.OldCoin] = cost[ctype]} | 897 | local costs = {[ItemId.OldCoin] = cost[ctype]} | 
| 898 | if not next(costs) then return 6 end | 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 | if not role:checkItemEnough(costs) then return 5 end | 906 | if not role:checkItemEnough(costs) then return 5 end | 
| 902 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) | 907 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) | 
src/actions/DinerAction.lua
| @@ -251,11 +251,20 @@ end | @@ -251,11 +251,20 @@ end | ||
| 251 | function _M.expediteSellRpc( agent, data ) | 251 | function _M.expediteSellRpc( agent, data ) | 
| 252 | local role = agent.role | 252 | local role = agent.role | 
| 253 | local count = role.dinerData:getProperty("expedite") | 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 | end | 265 | end | 
| 258 | - local diamond = globalCsv.diner_sell_quick_cost[count] | 266 | + | 
| 267 | + local diamond = costs[count] | ||
| 259 | if diamond > 0 then | 268 | if diamond > 0 then | 
| 260 | local cost = {[ItemId.Jade] = diamond} | 269 | local cost = {[ItemId.Jade] = diamond} | 
| 261 | if not role:checkItemEnough(cost) then | 270 | if not role:checkItemEnough(cost) then | 
src/actions/EmailAction.lua
| @@ -14,19 +14,27 @@ local function loadEmails(roleId) | @@ -14,19 +14,27 @@ local function loadEmails(roleId) | ||
| 14 | end | 14 | end | 
| 15 | 15 | ||
| 16 | local function delExpireEmails(roleId) | 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 | sql = string.format(sql, roleId, EMAIL_LIMIT) | 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 | end | 38 | end | 
| 31 | 39 | ||
| 32 | function _M.listRpc(agent, data) | 40 | function _M.listRpc(agent, data) | 
| @@ -94,7 +102,11 @@ local function getEmailAttachments( email ) | @@ -94,7 +102,11 @@ local function getEmailAttachments( email ) | ||
| 94 | local rewardPms = email:getProperty("rewardPms") | 102 | local rewardPms = email:getProperty("rewardPms") | 
| 95 | local emailData = csvdb["emailCsv"][email:getProperty("emailId")] | 103 | local emailData = csvdb["emailCsv"][email:getProperty("emailId")] | 
| 96 | if emailData then | 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 | end | 110 | end | 
| 99 | end | 111 | end | 
| 100 | return attachments | 112 | return attachments | 
| @@ -120,6 +132,8 @@ function _M.drawAllAttachRpc(agent, data) | @@ -120,6 +132,8 @@ function _M.drawAllAttachRpc(agent, data) | ||
| 120 | role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) | 132 | role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) | 
| 121 | end | 133 | end | 
| 122 | end | 134 | end | 
| 135 | + if role:checkRuneFullyByReward(reward) then return 1 end | ||
| 136 | + | ||
| 123 | reward, change = role:award(reward, {log = {desc = "draw_attach"}}) | 137 | reward, change = role:award(reward, {log = {desc = "draw_attach"}}) | 
| 124 | SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change})) | 138 | SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change})) | 
| 125 | return true | 139 | return true | 
| @@ -139,7 +153,18 @@ function _M.drawAttachRpc(agent, data) | @@ -139,7 +153,18 @@ function _M.drawAttachRpc(agent, data) | ||
| 139 | local attachments = getEmailAttachments(email) | 153 | local attachments = getEmailAttachments(email) | 
| 140 | if attachments == "" then return end | 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 | email:setProperty("status", 2, true) | 168 | email:setProperty("status", 2, true) | 
| 144 | email:log(role, 2) | 169 | email:log(role, 2) | 
| 145 | SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) | 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,4 +1027,49 @@ function _M.savegenius(role, pms) | ||
| 1027 | return "天赋点设置成功" | 1027 | return "天赋点设置成功" | 
| 1028 | end | 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 | return _M | 1075 | return _M | 
| 1031 | \ No newline at end of file | 1076 | \ No newline at end of file | 
src/actions/HangAction.lua
| @@ -478,6 +478,18 @@ function _M.quickRpc(agent , data) | @@ -478,6 +478,18 @@ function _M.quickRpc(agent , data) | ||
| 478 | 478 | ||
| 479 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 479 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 
| 480 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | 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 | if not costs[curCount] then return end | 493 | if not costs[curCount] then return end | 
| 482 | if costs[curCount] > 0 then | 494 | if costs[curCount] > 0 then | 
| 483 | if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end | 495 | if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end | 
| @@ -568,7 +580,7 @@ function _M.buyBonusCountRpc(agent, data) | @@ -568,7 +580,7 @@ function _M.buyBonusCountRpc(agent, data) | ||
| 568 | local bonusC = role.dailyData:getProperty("bonusC") | 580 | local bonusC = role.dailyData:getProperty("bonusC") | 
| 569 | local extraCnt = role.storeData:getBonusExtraFightCount() | 581 | local extraCnt = role.storeData:getBonusExtraFightCount() | 
| 570 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} | 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 | if math.illegalNum(count, 1, lastCount) then return 1 end | 584 | if math.illegalNum(count, 1, lastCount) then return 1 end | 
| 573 | 585 | ||
| 574 | if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end | 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,7 +678,7 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 666 | if open and actData then | 678 | if open and actData then | 
| 667 | coef = tonumber(actData.condition2) | 679 | coef = tonumber(actData.condition2) | 
| 668 | end | 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 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | 683 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | 
| 672 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 684 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 
src/actions/RoleAction.lua
| @@ -633,6 +633,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -633,6 +633,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 633 | else | 633 | else | 
| 634 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time | 634 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time | 
| 635 | local unitTime = globalCsv.box_key_time[oldId] * 60 | 635 | local unitTime = globalCsv.box_key_time[oldId] * 60 | 
| 636 | + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) | ||
| 636 | local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) | 637 | local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) | 
| 637 | if doneCnt > 0 then | 638 | if doneCnt > 0 then | 
| 638 | reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | 639 | reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | 
| @@ -642,7 +643,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -642,7 +643,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 642 | if role:getItemCount(itemId) >= limit then return 3 end | 643 | if role:getItemCount(itemId) >= limit then return 3 end | 
| 643 | 644 | ||
| 644 | boxL[slot] = {id = itemId, process = 0, time = skynet.timex()} | 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 | elseif oper == 2 then -- 重置运行时间(可以使用加速) | 647 | elseif oper == 2 then -- 重置运行时间(可以使用加速) | 
| 647 | local quick = msg.quick | 648 | local quick = msg.quick | 
| 648 | if not boxL[slot] then return 4 end | 649 | if not boxL[slot] then return 4 end | 
| @@ -652,6 +653,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -652,6 +653,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 652 | local stopTime = nowTime | 653 | local stopTime = nowTime | 
| 653 | local itemData = csvdb["itemCsv"][itemId] | 654 | local itemData = csvdb["itemCsv"][itemId] | 
| 654 | local unitTime = globalCsv.box_key_time[itemId] * 60 | 655 | local unitTime = globalCsv.box_key_time[itemId] * 60 | 
| 656 | + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime) | ||
| 655 | if quick then | 657 | if quick then | 
| 656 | stopTime = nowTime + quick | 658 | stopTime = nowTime + quick | 
| 657 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 659 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 
| @@ -661,6 +663,8 @@ function _M.openTimeBoxRpc(agent, data) | @@ -661,6 +663,8 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 661 | else | 663 | else | 
| 662 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) | 664 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) | 
| 663 | end | 665 | end | 
| 666 | + stopTime = stopTime + role:getBnousDismantlingMaximum() | ||
| 667 | + | ||
| 664 | role:pushCancel({type = "box", slot = slot}) | 668 | role:pushCancel({type = "box", slot = slot}) | 
| 665 | 669 | ||
| 666 | local doneCnt = math.floor((process + stopTime - time) / unitTime) | 670 | local doneCnt = math.floor((process + stopTime - time) / unitTime) | 
| @@ -672,20 +676,24 @@ function _M.openTimeBoxRpc(agent, data) | @@ -672,20 +676,24 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 672 | end | 676 | end | 
| 673 | 677 | ||
| 674 | boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime} | 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 | elseif oper == 3 then -- 开箱子 | 680 | elseif oper == 3 then -- 开箱子 | 
| 677 | local costId = msg.costId | 681 | local costId = msg.costId | 
| 678 | local costs = (msg.costs or ""):toNumMap() | 682 | local costs = (msg.costs or ""):toNumMap() | 
| 679 | if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end | 683 | if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end | 
| 680 | - | 684 | + | 
| 681 | local costIdData = csvdb["itemCsv"][costId] | 685 | local costIdData = csvdb["itemCsv"][costId] | 
| 682 | - local count = 0 | 686 | + local count, runeCount = 0, 0 | 
| 683 | for itemId, num in pairs(costs) do | 687 | for itemId, num in pairs(costs) do | 
| 684 | local itemIdData = csvdb["itemCsv"][itemId] | 688 | local itemIdData = csvdb["itemCsv"][itemId] | 
| 685 | if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end | 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 | count = count + num | 692 | count = count + num | 
| 687 | end | 693 | end | 
| 688 | 694 | ||
| 695 | + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 | ||
| 696 | + | ||
| 689 | if role:getItemCount(costId) < count then return 8 end | 697 | if role:getItemCount(costId) < count then return 8 end | 
| 690 | if not role:checkItemEnough(costs) then return 9 end | 698 | if not role:checkItemEnough(costs) then return 9 end | 
| 691 | 699 | ||
| @@ -699,8 +707,8 @@ function _M.openTimeBoxRpc(agent, data) | @@ -699,8 +707,8 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 699 | role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}}) | 707 | role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}}) | 
| 700 | for _ = 1, value do | 708 | for _ = 1, value do | 
| 701 | for i = 1, 10 do | 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 | if num and gift and num > 0 and gift ~= "" then | 712 | if num and gift and num > 0 and gift ~= "" then | 
| 705 | local pool = {} | 713 | local pool = {} | 
| 706 | for _, temp in ipairs(gift:toArray()) do | 714 | for _, temp in ipairs(gift:toArray()) do | 
| @@ -1390,7 +1398,20 @@ end | @@ -1390,7 +1398,20 @@ end | ||
| 1390 | function _M.goldBuyRpc(agent, data) | 1398 | function _M.goldBuyRpc(agent, data) | 
| 1391 | local role = agent.role | 1399 | local role = agent.role | 
| 1392 | local curT = role.dailyData:getProperty("goldBuyT") | 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 | if not costD then | 1415 | if not costD then | 
| 1395 | return 1 | 1416 | return 1 | 
| 1396 | end | 1417 | end | 
| @@ -1583,4 +1604,27 @@ function _M.runeBuyRpc(agent, data) | @@ -1583,4 +1604,27 @@ function _M.runeBuyRpc(agent, data) | ||
| 1583 | return true | 1604 | return true | 
| 1584 | end | 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 | return _M | 1630 | return _M | 
| 1587 | \ No newline at end of file | 1631 | \ No newline at end of file | 
src/actions/TowerAction.lua
| @@ -114,9 +114,9 @@ function _M.endBattleRpc(agent, data) | @@ -114,9 +114,9 @@ function _M.endBattleRpc(agent, data) | ||
| 114 | 114 | ||
| 115 | curLevel = curLevel + 1 | 115 | curLevel = curLevel + 1 | 
| 116 | reward, change = role:award(rewardStr, {log = {desc = "towerBattle", int1 = id}}) | 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 | end | 120 | end | 
| 121 | 121 | ||
| 122 | if towerType == 0 then | 122 | if towerType == 0 then | 
src/adv/Adv.lua
| @@ -881,6 +881,8 @@ function Adv:over(success, rewardRatio, overType) | @@ -881,6 +881,8 @@ function Adv:over(success, rewardRatio, overType) | ||
| 881 | reward[itemId] = math.ceil(count * rewardRatio / 100) | 881 | reward[itemId] = math.ceil(count * rewardRatio / 100) | 
| 882 | end | 882 | end | 
| 883 | end | 883 | end | 
| 884 | + | ||
| 885 | + self.owner:checkRuneCount(reward) | ||
| 884 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 886 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 
| 885 | 887 | ||
| 886 | local backAdvCount | 888 | local backAdvCount | 
src/models/Role.lua
| @@ -30,6 +30,7 @@ function Role:ctor( properties ) | @@ -30,6 +30,7 @@ function Role:ctor( properties ) | ||
| 30 | self.advData = nil | 30 | self.advData = nil | 
| 31 | self.activity = nil | 31 | self.activity = nil | 
| 32 | self._pushToken = nil | 32 | self._pushToken = nil | 
| 33 | + self._lastSaveTs = skynet.timex() | ||
| 33 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 | 34 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 | 
| 34 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 | 35 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 | 
| 35 | if self.advOverTime == 0 then | 36 | if self.advOverTime == 0 then | 
| @@ -75,6 +76,7 @@ Role.schema = { | @@ -75,6 +76,7 @@ Role.schema = { | ||
| 75 | expireItem = {"table", {}}, --物品过期检查 | 76 | expireItem = {"table", {}}, --物品过期检查 | 
| 76 | funcOpen = {"table", {}}, --功能是否开放 | 77 | funcOpen = {"table", {}}, --功能是否开放 | 
| 77 | funcLv = {"table", {}}, --功能等级 | 78 | funcLv = {"table", {}}, --功能等级 | 
| 79 | + levelBnous = {"table", {}}, --等级奖励 | ||
| 78 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL | 80 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL | 
| 79 | crown = {"number", 0}, -- 看伴娘 | 81 | crown = {"number", 0}, -- 看伴娘 | 
| 80 | silent = {"number", 0}, --禁言解禁时间 | 82 | silent = {"number", 0}, --禁言解禁时间 | 
| @@ -205,6 +207,10 @@ Role.schema = { | @@ -205,6 +207,10 @@ Role.schema = { | ||
| 205 | roleIncre = {"table", {}}, -- 角色英雄,铭文,火花自增序列 {heroId = 1, runeId = 1, sparkId = 1} | 207 | roleIncre = {"table", {}}, -- 角色英雄,铭文,火花自增序列 {heroId = 1, runeId = 1, sparkId = 1} | 
| 206 | 208 | ||
| 207 | unlockChap = {"table", {}}, -- 解锁的章节 | 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,6 +355,7 @@ function Role:data() | ||
| 349 | items = self:getProperty("items"):toNumMap(), | 355 | items = self:getProperty("items"):toNumMap(), | 
| 350 | funcOpen = self:getProperty("funcOpen"), | 356 | funcOpen = self:getProperty("funcOpen"), | 
| 351 | funcLv = self:getProperty("funcLv"), | 357 | funcLv = self:getProperty("funcLv"), | 
| 358 | + levelBnous = self:getProperty("levelBnous"), | ||
| 352 | -- loveStatus = self:getProperty("loveStatus"):toNumMap(), | 359 | -- loveStatus = self:getProperty("loveStatus"):toNumMap(), | 
| 353 | timeReset = self:getProperty("timeReset"), | 360 | timeReset = self:getProperty("timeReset"), | 
| 354 | diamond = self:getAllDiamond(), | 361 | diamond = self:getAllDiamond(), | 
| @@ -444,6 +451,8 @@ function Role:data() | @@ -444,6 +451,8 @@ function Role:data() | ||
| 444 | returner = self:getProperty("returner"), | 451 | returner = self:getProperty("returner"), | 
| 445 | 452 | ||
| 446 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 | 453 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 | 
| 454 | + friendTeam = self:getProperty("friendTeam"), | ||
| 455 | + bgId = self:getProperty("bgId"), | ||
| 447 | } | 456 | } | 
| 448 | end | 457 | end | 
| 449 | 458 | 
src/models/RoleCross.lua
| @@ -11,7 +11,9 @@ RoleCross.bind = function (Role) | @@ -11,7 +11,9 @@ RoleCross.bind = function (Role) | ||
| 11 | level = self:getProperty("level"), | 11 | level = self:getProperty("level"), | 
| 12 | headId = self:getProperty("headId"), | 12 | headId = self:getProperty("headId"), | 
| 13 | ltime = self:getProperty("ltime"), | 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 | return info | 18 | return info | 
| 17 | end | 19 | end | 
| @@ -19,8 +21,13 @@ RoleCross.bind = function (Role) | @@ -19,8 +21,13 @@ RoleCross.bind = function (Role) | ||
| 19 | -- 好友详细队伍信息 | 21 | -- 好友详细队伍信息 | 
| 20 | function Role:friendInfo() | 22 | function Role:friendInfo() | 
| 21 | local info = self:friendSInfo() | 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 | return info | 31 | return info | 
| 25 | end | 32 | end | 
| 26 | 33 | ||
| @@ -274,31 +281,42 @@ function CMD.getProperties(roleId, fields) | @@ -274,31 +281,42 @@ function CMD.getProperties(roleId, fields) | ||
| 274 | end | 281 | end | 
| 275 | 282 | ||
| 276 | function CMD.friendSInfo(roleId) | 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 | return { | 286 | return { | 
| 279 | name = info.name, | 287 | name = info.name, | 
| 280 | level = info.level, | 288 | level = info.level, | 
| 281 | headId = info.headId, | 289 | headId = info.headId, | 
| 282 | ltime = info.ltime, | 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 | end | 294 | end | 
| 286 | 295 | ||
| 287 | function CMD.friendInfo(roleId) | 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 | return { | 299 | return { | 
| 290 | name = info.name, | 300 | name = info.name, | 
| 291 | level = info.level, | 301 | level = info.level, | 
| 292 | headId = info.headId, | 302 | headId = info.headId, | 
| 293 | ltime = info.ltime, | 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 | end | 313 | end | 
| 298 | 314 | ||
| 299 | function CMD.friendBattleInfo(roleId) | 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 | end | 320 | end | 
| 303 | 321 | ||
| 304 | function CMD.pvpCInfo(roleId) | 322 | function CMD.pvpCInfo(roleId) | 
src/models/RoleLog.lua
| @@ -4,7 +4,7 @@ local logproxy = require "shared.logproxy" | @@ -4,7 +4,7 @@ local logproxy = require "shared.logproxy" | ||
| 4 | 4 | ||
| 5 | --[[ | 5 | --[[ | 
| 6 | 100 购买/兑换行为 | 6 | 100 购买/兑换行为 | 
| 7 | - 200 交易行为(与其他玩家) | 7 | + 200 交易行为(与其他玩家) | 
| 8 | 300 通过关卡产出或消耗 | 8 | 300 通过关卡产出或消耗 | 
| 9 | 400 通过任务产出或消耗 | 9 | 400 通过任务产出或消耗 | 
| 10 | 500 通过公会产出或消耗 | 10 | 500 通过公会产出或消耗 | 
| @@ -62,6 +62,7 @@ local ItemReason = { | @@ -62,6 +62,7 @@ local ItemReason = { | ||
| 62 | convert = 146, -- 钻石兑换其他物品 | 62 | convert = 146, -- 钻石兑换其他物品 | 
| 63 | giftTime = 147, -- 创角后的时间礼包 | 63 | giftTime = 147, -- 创角后的时间礼包 | 
| 64 | activityCrisis = 148, -- 物资危机奖励 | 64 | activityCrisis = 148, -- 物资危机奖励 | 
| 65 | + glodConvertRune = 149, -- 金币兑换铭文 | ||
| 65 | 66 | ||
| 66 | advHang = 301, -- 拾荒挂机 | 67 | advHang = 301, -- 拾荒挂机 | 
| 67 | hangBattle = 302, -- 挂机战斗 | 68 | hangBattle = 302, -- 挂机战斗 | 
src/models/RolePlugin.lua
| @@ -284,6 +284,7 @@ function RolePlugin.bind(Role) | @@ -284,6 +284,7 @@ function RolePlugin.bind(Role) | ||
| 284 | newExp = newExp - csvdb["player_expCsv"][level].exp | 284 | newExp = newExp - csvdb["player_expCsv"][level].exp | 
| 285 | level = level + 1 | 285 | level = level + 1 | 
| 286 | self:checkTaskEnter("RoleLevelUp", {level = level}) | 286 | self:checkTaskEnter("RoleLevelUp", {level = level}) | 
| 287 | + self:getLevelBnous(level) | ||
| 287 | else | 288 | else | 
| 288 | newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 | 289 | newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 | 
| 289 | end | 290 | end | 
| @@ -603,6 +604,7 @@ function RolePlugin.bind(Role) | @@ -603,6 +604,7 @@ function RolePlugin.bind(Role) | ||
| 603 | SendPacket(actionCodes.Hero_loadInfos, bin) | 604 | SendPacket(actionCodes.Hero_loadInfos, bin) | 
| 604 | end | 605 | end | 
| 605 | 606 | ||
| 607 | + self:updateProperty({field = "heroCnt", value = #self.heros}) | ||
| 606 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) | 608 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) | 
| 607 | 609 | ||
| 608 | if params.log then | 610 | if params.log then | 
| @@ -1929,10 +1931,15 @@ function RolePlugin.bind(Role) | @@ -1929,10 +1931,15 @@ function RolePlugin.bind(Role) | ||
| 1929 | function Role:onRecoverTimer(now) | 1931 | function Role:onRecoverTimer(now) | 
| 1930 | self:updateTimeReset(now, true) | 1932 | self:updateTimeReset(now, true) | 
| 1931 | self:checkNewEvent(now) | 1933 | self:checkNewEvent(now) | 
| 1932 | - self:saveRoleData() | 1934 | + self:saveRoleData(now) | 
| 1933 | end | 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 | self:update() | 1943 | self:update() | 
| 1937 | local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre} | 1944 | local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre} | 
| 1938 | for _, info in ipairs(objs) do | 1945 | for _, info in ipairs(objs) do | 
| @@ -2753,45 +2760,149 @@ function RolePlugin.bind(Role) | @@ -2753,45 +2760,149 @@ function RolePlugin.bind(Role) | ||
| 2753 | 2760 | ||
| 2754 | function Role:getBnousCrusade(value) | 2761 | function Role:getBnousCrusade(value) | 
| 2755 | local towerBnous = self:getTowerBnousActive() | 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 | end | 2766 | end | 
| 2758 | 2767 | ||
| 2759 | function Role:getBnousDiner(type, value) | 2768 | function Role:getBnousDiner(type, value) | 
| 2760 | local towerBnous = self:getTowerBnousActive() | 2769 | local towerBnous = self:getTowerBnousActive() | 
| 2761 | type = type or 1 | 2770 | type = type or 1 | 
| 2762 | - local result | 2771 | + local result, levelReault | 
| 2763 | if type == 1 then | 2772 | if type == 1 then | 
| 2764 | result = towerBnous[SystemBnousType.DinerGet] | 2773 | result = towerBnous[SystemBnousType.DinerGet] | 
| 2774 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet] | ||
| 2765 | elseif type == 2 then | 2775 | elseif type == 2 then | 
| 2766 | result = towerBnous[SystemBnousType.DinerLimit] | 2776 | result = towerBnous[SystemBnousType.DinerLimit] | 
| 2777 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit] | ||
| 2767 | elseif type == 3 then | 2778 | elseif type == 3 then | 
| 2768 | result = towerBnous[SystemBnousType.DinerSell] | 2779 | result = towerBnous[SystemBnousType.DinerSell] | 
| 2780 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell] | ||
| 2769 | elseif type == 4 then | 2781 | elseif type == 4 then | 
| 2770 | result = towerBnous[SystemBnousType.DinerPrice] | 2782 | result = towerBnous[SystemBnousType.DinerPrice] | 
| 2783 | + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice] | ||
| 2771 | end | 2784 | end | 
| 2772 | - return self:getDeltaValue(result, value) | 2785 | + return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) | 
| 2773 | end | 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 | function Role:getBnousAdv() | 2799 | function Role:getBnousAdv() | 
| 2776 | local towerBnous = self:getTowerBnousActive() | 2800 | local towerBnous = self:getTowerBnousActive() | 
| 2801 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {} | ||
| 2802 | + appendBnous(towerBnous[SystemBnousType.Adv], levelBnous) | ||
| 2777 | return towerBnous[SystemBnousType.Adv] or {} | 2803 | return towerBnous[SystemBnousType.Adv] or {} | 
| 2778 | end | 2804 | end | 
| 2779 | 2805 | ||
| 2780 | function Role:getBnousHangTime() | 2806 | function Role:getBnousHangTime() | 
| 2781 | local towerBnous = self:getTowerBnousActive() | 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 | end | 2814 | end | 
| 2784 | 2815 | ||
| 2785 | function Role:getBnousPvpTicket() | 2816 | function Role:getBnousPvpTicket() | 
| 2786 | local towerBnous = self:getTowerBnousActive() | 2817 | local towerBnous = self:getTowerBnousActive() | 
| 2818 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {} | ||
| 2819 | + appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous) | ||
| 2787 | return towerBnous[SystemBnousType.PvpTicket] or {} | 2820 | return towerBnous[SystemBnousType.PvpTicket] or {} | 
| 2788 | end | 2821 | end | 
| 2789 | 2822 | ||
| 2790 | function Role:getBnousSweep() | 2823 | function Role:getBnousSweep() | 
| 2791 | local towerBnous = self:getTowerBnousActive() | 2824 | local towerBnous = self:getTowerBnousActive() | 
| 2825 | + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {} | ||
| 2826 | + appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous) | ||
| 2792 | return towerBnous[SystemBnousType.SweepReward] or {} | 2827 | return towerBnous[SystemBnousType.SweepReward] or {} | 
| 2793 | end | 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 | function Role:getPotionLevel(id) | 2906 | function Role:getPotionLevel(id) | 
| 2796 | local level = self.dinerData:getProperty("dishTree"):getv(id, 1) | 2907 | local level = self.dinerData:getProperty("dishTree"):getv(id, 1) | 
| 2797 | local talentSet = csvdb["diner_talentCsv"][id] | 2908 | local talentSet = csvdb["diner_talentCsv"][id] | 
| @@ -2823,6 +2934,74 @@ function RolePlugin.bind(Role) | @@ -2823,6 +2934,74 @@ function RolePlugin.bind(Role) | ||
| 2823 | self:mylog("hero_action", {desc = desc, int1 = heroType}) | 2934 | self:mylog("hero_action", {desc = desc, int1 = heroType}) | 
| 2824 | end | 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 | end | 3005 | end | 
| 2827 | 3006 | ||
| 2828 | return RolePlugin | 3007 | return RolePlugin | 
| 2829 | \ No newline at end of file | 3008 | \ No newline at end of file | 
src/models/RoleTask.lua
| @@ -810,7 +810,7 @@ function RoleTask.bind(Role) | @@ -810,7 +810,7 @@ function RoleTask.bind(Role) | ||
| 810 | calTask[id] = (calTask[id] or 0) + 1 | 810 | calTask[id] = (calTask[id] or 0) + 1 | 
| 811 | end | 811 | end | 
| 812 | elseif cfg.type == 13 then -- 挑战电波塔主塔 | 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 | calTask[id] = (calTask[id] or 0) + 1 | 814 | calTask[id] = (calTask[id] or 0) + 1 | 
| 815 | end | 815 | end | 
| 816 | end | 816 | end | 
src/services/dbseed.lua
| @@ -100,6 +100,9 @@ local function initAutoIncreUidTable() | @@ -100,6 +100,9 @@ local function initAutoIncreUidTable() | ||
| 100 | mysqlproxy:query(string.format(tpl, "seaportTime0", 0)) | 100 | mysqlproxy:query(string.format(tpl, "seaportTime0", 0)) | 
| 101 | mysqlproxy:query(string.format(tpl, "seaportTime1", 0)) | 101 | mysqlproxy:query(string.format(tpl, "seaportTime1", 0)) | 
| 102 | mysqlproxy:query(string.format(tpl, "seaportTime2", 0)) | 102 | mysqlproxy:query(string.format(tpl, "seaportTime2", 0)) | 
| 103 | + | ||
| 104 | + -- 记录当前更新版本 | ||
| 105 | + mysqlproxy:query(string.format(tpl, "db_ver", 0)) | ||
| 103 | end | 106 | end | 
| 104 | end | 107 | end | 
| 105 | 108 | ||
| @@ -255,6 +258,31 @@ local function selectDb() | @@ -255,6 +258,31 @@ local function selectDb() | ||
| 255 | end | 258 | end | 
| 256 | end | 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 | skynet.start(function () | 286 | skynet.start(function () | 
| 259 | --local new = redisproxy:hsetnx("autoincrement_set", "server_start", os.date("%Y%m%d", skynet.timex())) == 1 | 287 | --local new = redisproxy:hsetnx("autoincrement_set", "server_start", os.date("%Y%m%d", skynet.timex())) == 1 | 
| 260 | --if not new then | 288 | --if not new then | 
| @@ -273,6 +301,7 @@ skynet.start(function () | @@ -273,6 +301,7 @@ skynet.start(function () | ||
| 273 | initRedisDb() | 301 | initRedisDb() | 
| 274 | initSeaportTask() -- 海港任务数据初始化 | 302 | initSeaportTask() -- 海港任务数据初始化 | 
| 275 | loadAllUserInfo() | 303 | loadAllUserInfo() | 
| 304 | + doUpdateSql() -- 执行更新sql | ||
| 276 | selectDb() | 305 | selectDb() | 
| 277 | skynet.exit() | 306 | skynet.exit() | 
| 278 | end) | 307 | end) | 
| 279 | \ No newline at end of file | 308 | \ No newline at end of file | 
src/utils/MysqlUtil.lua
| @@ -34,7 +34,6 @@ function addFriend(roleId, friendId) | @@ -34,7 +34,6 @@ function addFriend(roleId, friendId) | ||
| 34 | rpcRole(roleId, "addFriend", friendId) | 34 | rpcRole(roleId, "addFriend", friendId) | 
| 35 | rpcRole(friendId, "addFriend", roleId) | 35 | rpcRole(friendId, "addFriend", roleId) | 
| 36 | end | 36 | end | 
| 37 | - dump(r) | ||
| 38 | end | 37 | end | 
| 39 | 38 | ||
| 40 | function delFriend(roleId, friendId) | 39 | function delFriend(roleId, friendId) | 
| @@ -44,7 +43,6 @@ function delFriend(roleId, friendId) | @@ -44,7 +43,6 @@ function delFriend(roleId, friendId) | ||
| 44 | rpcRole(roleId, "delFriend", friendId) | 43 | rpcRole(roleId, "delFriend", friendId) | 
| 45 | rpcRole(friendId, "delFriend", roleId) | 44 | rpcRole(friendId, "delFriend", roleId) | 
| 46 | end | 45 | end | 
| 47 | - dump(r) | ||
| 48 | end | 46 | end | 
| 49 | 47 | ||
| 50 | function roleExists(roleId) | 48 | function roleExists(roleId) |