Commit d64e546854ab4239179b0a3e86bc2dfefa10154a
Merge branch 'tr/bugfix-qa' into tr/publish/qa-out
* tr/bugfix-qa: pvp 匹配 和 失败扣减积分 Revert "修改 robot" 修改 robot 联动任务活动 appid 好友赠送能量活动bug修复 活动能量bug 修改联动好友赠送活动的消息通知结构 少个大括号 修改联动好友赠送获得的红点记录和通知 未测试版好友能量助力活动 联动签到活动 调理剂生产和使用逻辑优化
Showing
18 changed files
with
720 additions
and
43 deletions
Show diff stats
src/GlobalVar.lua
| @@ -73,7 +73,7 @@ ItemType = { | @@ -73,7 +73,7 @@ ItemType = { | ||
| 73 | EquipBase = 9, -- 基础装备 | 73 | EquipBase = 9, -- 基础装备 |
| 74 | Rune = 10, -- 符文 | 74 | Rune = 10, -- 符文 |
| 75 | Cuisine = 11, -- 料理(用于增加好感度、贩卖获得金币) | 75 | Cuisine = 11, -- 料理(用于增加好感度、贩卖获得金币) |
| 76 | - LunchBox = 12, -- 便当盒(料理合成,冒险系统消耗道具) | 76 | + Potion = 12, -- 拾荒药剂 |
| 77 | TimeBox = 13, -- 时间箱(开启需要时间,随机产出道具) | 77 | TimeBox = 13, -- 时间箱(开启需要时间,随机产出道具) |
| 78 | AdvItem = 14, -- 冒险道具 | 78 | AdvItem = 14, -- 冒险道具 |
| 79 | FuncOpen = 15, -- 管理功能开放 | 79 | FuncOpen = 15, -- 管理功能开放 |
src/ProtocolCode.lua
| @@ -229,6 +229,8 @@ actionCodes = { | @@ -229,6 +229,8 @@ actionCodes = { | ||
| 229 | Activity_battleMilestoneRpc = 663, | 229 | Activity_battleMilestoneRpc = 663, |
| 230 | Activity_bossRewardRpc = 664, | 230 | Activity_bossRewardRpc = 664, |
| 231 | Activity_crisisMilestoneRpc = 665, | 231 | Activity_crisisMilestoneRpc = 665, |
| 232 | + Activity_commonSignRpc = 666, | ||
| 233 | + Activity_friendHelpRpc = 667, | ||
| 232 | 234 | ||
| 233 | Radio_startQuestRpc = 700, | 235 | Radio_startQuestRpc = 700, |
| 234 | Radio_finishQuestRpc = 701, | 236 | Radio_finishQuestRpc = 701, |
src/RedisKeys.lua
| @@ -47,6 +47,7 @@ FRIEND_KEY = "role:%d:friend" --哈希表 好友 | @@ -47,6 +47,7 @@ FRIEND_KEY = "role:%d:friend" --哈希表 好友 | ||
| 47 | FRIEND_APPLY_KEY = "role:%d:apply" -- sort set 申请列表 | 47 | FRIEND_APPLY_KEY = "role:%d:apply" -- sort set 申请列表 |
| 48 | FRIEND_BLACK_KEY = "role:%d:black" -- set 黑名单 | 48 | FRIEND_BLACK_KEY = "role:%d:black" -- set 黑名单 |
| 49 | FRIEND_POINT = "role:%d:point" -- set 当天送给我心的人 | 49 | FRIEND_POINT = "role:%d:point" -- set 当天送给我心的人 |
| 50 | +FRIEND_ENERGY = "role:%d:energy" -- set 送给我活动能量的好友 | ||
| 50 | FRIEND_RECOMMEND = "friend:recommend" -- sort set 登录排序 获取推荐好友 | 51 | FRIEND_RECOMMEND = "friend:recommend" -- sort set 登录排序 获取推荐好友 |
| 51 | CHAT_OFFLINE = "chat:offline:%d" --消息离线缓存 | 52 | CHAT_OFFLINE = "chat:offline:%d" --消息离线缓存 |
| 52 | 53 |
src/actions/ActivityAction.lua
| @@ -259,7 +259,10 @@ function _M.actCalendaTaskRpc(agent, data) | @@ -259,7 +259,10 @@ function _M.actCalendaTaskRpc(agent, data) | ||
| 259 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | 259 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 260 | }) | 260 | }) |
| 261 | 261 | ||
| 262 | + role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) | ||
| 263 | + | ||
| 262 | SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) | 264 | SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) |
| 265 | + | ||
| 263 | return true | 266 | return true |
| 264 | end | 267 | end |
| 265 | 268 | ||
| @@ -905,4 +908,216 @@ function _M.bossRewardRpc(agent, data) | @@ -905,4 +908,216 @@ function _M.bossRewardRpc(agent, data) | ||
| 905 | return true | 908 | return true |
| 906 | end | 909 | end |
| 907 | 910 | ||
| 911 | +function _M.commonSignRpc(agent, data) | ||
| 912 | + local role = agent.role | ||
| 913 | + local msg = MsgPack.unpack(data) | ||
| 914 | + local actid = msg.actid | ||
| 915 | + local index = msg.index | ||
| 916 | + | ||
| 917 | + if not role.activity:isOpenById(actid, "CommonSignIn") then return 1 end | ||
| 918 | + | ||
| 919 | + local actData = role.activity:getActData("CommonSignIn") | ||
| 920 | + if (actData[0] or 0) < index then | ||
| 921 | + return 2 | ||
| 922 | + end | ||
| 923 | + if (actData[index] or 0) == 1 then | ||
| 924 | + return 3 | ||
| 925 | + end | ||
| 926 | + | ||
| 927 | + local actCfg = csvdb["activity_signInCsv"][actid] | ||
| 928 | + if not actCfg then return 4 end | ||
| 929 | + actCfg = actCfg[index] | ||
| 930 | + if not actCfg then return 5 end | ||
| 931 | + | ||
| 932 | + actData[index] = 1 | ||
| 933 | + role.activity:updateActData("CommonSignIn", actData) | ||
| 934 | + | ||
| 935 | + local award = actCfg.reward:toNumMap() | ||
| 936 | + local reward, change = role:award(award, {log = {desc = "commonSign", int1 = actid, int2 = index}}) | ||
| 937 | + SendPacket(actionCodes.Activity_commonSignRpc, MsgPack.pack(role:packReward(reward, change))) | ||
| 938 | + return true | ||
| 939 | +end | ||
| 940 | + | ||
| 941 | +function _M.friendHelpRpc(agent, data) | ||
| 942 | + local role = agent.role | ||
| 943 | + local roleId = role:getProperty("id") | ||
| 944 | + local msg = MsgPack.unpack(data) | ||
| 945 | + local oper = tonumber(msg.oper) or -1 | ||
| 946 | + local award = {} | ||
| 947 | + local result | ||
| 948 | + | ||
| 949 | + | ||
| 950 | + local actid = 37 | ||
| 951 | + if not role.activity:isOpenById(actid, "FriendEnergy") then return 1 end | ||
| 952 | + if oper < 1 or oper > 4 then return 2 end | ||
| 953 | + | ||
| 954 | + local actCsv = csvdb["activity_ctrlCsv"][actid] | ||
| 955 | + local getLimit = actCsv.condition | ||
| 956 | + local gifts = actCsv.condition2:toTableArray(true) | ||
| 957 | + | ||
| 958 | + local actData = role.activity:getActData("FriendEnergy") or {} | ||
| 959 | + | ||
| 960 | + local function getIds() | ||
| 961 | + local ids = {} | ||
| 962 | + local friends = redisproxy:hgetall(FRIEND_KEY:format(roleId)) | ||
| 963 | + for i = 1, #friends , 2 do | ||
| 964 | + local objId = tonumber(friends[i]) | ||
| 965 | + ids[objId] = 1 | ||
| 966 | + end | ||
| 967 | + return ids | ||
| 968 | + end | ||
| 969 | + | ||
| 970 | + if oper == 1 then -- 赠送好友能量 | ||
| 971 | + local giveAE = actData.giveAE or {} | ||
| 972 | + local objId = msg.roleId | ||
| 973 | + local gift = gifts[1] | ||
| 974 | + local ids = {} | ||
| 975 | + | ||
| 976 | + if not objId then | ||
| 977 | + return 3 | ||
| 978 | + end | ||
| 979 | + if not redisproxy:hexists(FRIEND_KEY:format(roleId), objId) then | ||
| 980 | + result = 2 | ||
| 981 | + end | ||
| 982 | + if giveAE[objId] then | ||
| 983 | + result = 1 | ||
| 984 | + end | ||
| 985 | + | ||
| 986 | + if not result then | ||
| 987 | + giveAE[objId] = 1 | ||
| 988 | + award[gift[1]] = gift[2] | ||
| 989 | + redisproxy:sadd(FRIEND_ENERGY:format(objId), roleId) | ||
| 990 | + rpcRole(objId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}})) | ||
| 991 | + actData.giveAE = giveAE | ||
| 992 | + end | ||
| 993 | + elseif oper == 2 then -- 收取能量 | ||
| 994 | + local objId = msg.roleId | ||
| 995 | + local gift = gifts[2] | ||
| 996 | + local getAE = actData.getAE or {} | ||
| 997 | + local limit = actData.limit or 0 | ||
| 998 | + | ||
| 999 | + if limit >= getLimit then return 4 end | ||
| 1000 | + if not redisproxy:sismember(FRIEND_ENERGY:format(roleId), objId) then | ||
| 1001 | + result = 3 | ||
| 1002 | + end | ||
| 1003 | + if getAE[objId] then | ||
| 1004 | + result = 2 | ||
| 1005 | + end | ||
| 1006 | + if limit >= getLimit then | ||
| 1007 | + result = 1 | ||
| 1008 | + end | ||
| 1009 | + | ||
| 1010 | + if not result then | ||
| 1011 | + limit = limit + 1 | ||
| 1012 | + getAE[objId] = 1 | ||
| 1013 | + award[gift[1]] = gift[2] | ||
| 1014 | + redisproxy:srem(FRIEND_ENERGY:format(roleId), objId) | ||
| 1015 | + actData.limit = limit | ||
| 1016 | + actData.getAE = getAE | ||
| 1017 | + end | ||
| 1018 | + elseif oper == 3 then -- 一键送领全部 | ||
| 1019 | + local giveAE = actData.giveAE or {} | ||
| 1020 | + local getAE = actData.getAE or {} | ||
| 1021 | + local gift1 = gifts[1] | ||
| 1022 | + local gift2 = gifts[2] | ||
| 1023 | + local limit = actData.limit or 0 | ||
| 1024 | + local cmd1, cmd2 = 0, 0 | ||
| 1025 | + local ids = getIds() | ||
| 1026 | + | ||
| 1027 | + local members = {} | ||
| 1028 | + local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
| 1029 | + for _, id in pairs(temp) do | ||
| 1030 | + members[tonumber(id)] = 1 | ||
| 1031 | + end | ||
| 1032 | + | ||
| 1033 | + redisproxy:pipelining(function(red) | ||
| 1034 | + for friendId, _ in pairs(ids) do | ||
| 1035 | + if not giveAE[friendId] then | ||
| 1036 | + giveAE[friendId] = 1 | ||
| 1037 | + award[gift1[1]] = (award[gift1[1]] or 0) + gift1[2] | ||
| 1038 | + red:sadd(FRIEND_ENERGY:format(friendId), roleId) | ||
| 1039 | + rpcRole(friendId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}})) | ||
| 1040 | + cmd1 = 2 | ||
| 1041 | + end | ||
| 1042 | + | ||
| 1043 | + if members[friendId] and not getAE[friendId] and limit <= getLimit then | ||
| 1044 | + cmd2 = 1 | ||
| 1045 | + limit = limit + 1 | ||
| 1046 | + getAE[friendId] = 1 | ||
| 1047 | + award[gift2[1]] = (award[gift2[1]] or 0) + gift2[2] | ||
| 1048 | + red:srem(FRIEND_ENERGY:format(roleId), friendId) | ||
| 1049 | + end | ||
| 1050 | + end | ||
| 1051 | + end) | ||
| 1052 | + | ||
| 1053 | + local sum = cmd1 + cmd2 | ||
| 1054 | + if sum == 0 then | ||
| 1055 | + result = 3 | ||
| 1056 | + elseif sum ~= 3 then | ||
| 1057 | + result = sum | ||
| 1058 | + end | ||
| 1059 | + | ||
| 1060 | + actData.limit = limit | ||
| 1061 | + actData.giveAE = giveAE | ||
| 1062 | + actData.getAE = getAE | ||
| 1063 | + elseif oper == 4 then -- 抽大奖 | ||
| 1064 | + local magic = actData.magic or 0 | ||
| 1065 | + local rewards = actData.reward or {} | ||
| 1066 | + local rewardCsv = csvdb["activity_orderRewardsCsv"][actid] | ||
| 1067 | + local itemId1 = gifts[1][1] | ||
| 1068 | + local itemId2 = gifts[2][1] | ||
| 1069 | + | ||
| 1070 | + local level = math.min(magic + 1,#rewardCsv) | ||
| 1071 | + local rewardData = rewardCsv[level] | ||
| 1072 | + | ||
| 1073 | + local cost = {[itemId1] = rewardData.condition1, [itemId2] = rewardData.condition2} | ||
| 1074 | + | ||
| 1075 | + if not role:checkItemEnough(cost) then return 7 end | ||
| 1076 | + role:costItems(cost, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) | ||
| 1077 | + | ||
| 1078 | + if rewardData.reward ~= "" then | ||
| 1079 | + result = 1 | ||
| 1080 | + award = rewardData.reward:toNumMap() | ||
| 1081 | + end | ||
| 1082 | + if rewardData.reward_random ~= "" then | ||
| 1083 | + result = 1 | ||
| 1084 | + local pool = {} | ||
| 1085 | + for _, temp in pairs(rewardData.reward_random:toArray()) do | ||
| 1086 | + table.insert(pool, temp:toArray(true, "=")) | ||
| 1087 | + end | ||
| 1088 | + local gift = pool[math.randWeight(pool, 3)] | ||
| 1089 | + award[gift[1]] = (award[gift[1]] or 0) + gift[2] | ||
| 1090 | + end | ||
| 1091 | + rewards[level] = 1 | ||
| 1092 | + actData.reward = rewards | ||
| 1093 | + actData.magic = level | ||
| 1094 | + else | ||
| 1095 | + return 5 | ||
| 1096 | + end | ||
| 1097 | + | ||
| 1098 | + local ids = {} | ||
| 1099 | + local members = {} | ||
| 1100 | + local friendIds = getIds() | ||
| 1101 | + local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
| 1102 | + for _, id in pairs(temp) do | ||
| 1103 | + members[tonumber(id)] = 1 | ||
| 1104 | + end | ||
| 1105 | + | ||
| 1106 | + for id, _ in pairs(friendIds) do | ||
| 1107 | + if members[id] then | ||
| 1108 | + ids[id] = 1 | ||
| 1109 | + end | ||
| 1110 | + end | ||
| 1111 | + | ||
| 1112 | + actData.new = ids | ||
| 1113 | + | ||
| 1114 | + local reward, change | ||
| 1115 | + if next(award) then | ||
| 1116 | + reward, change = role:award(award, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) | ||
| 1117 | + end | ||
| 1118 | + role.activity:updateActData("FriendEnergy", actData) | ||
| 1119 | + SendPacket(actionCodes.Activity_friendHelpRpc, MsgPack.pack({result = result, reward = reward})) | ||
| 1120 | + return true | ||
| 1121 | +end | ||
| 1122 | + | ||
| 908 | return _M | 1123 | return _M |
| 909 | \ No newline at end of file | 1124 | \ No newline at end of file |
src/actions/AdvAction.lua
| @@ -345,6 +345,7 @@ function _M.endHangRpc(agent, data) | @@ -345,6 +345,7 @@ function _M.endHangRpc(agent, data) | ||
| 345 | adv_idle_time = adv_idle_time * 60 | 345 | adv_idle_time = adv_idle_time * 60 |
| 346 | 346 | ||
| 347 | local reward, isFull, change, heroFaithMap | 347 | local reward, isFull, change, heroFaithMap |
| 348 | + local heroCnt = 0 | ||
| 348 | if skynet.timex() >= info.time then | 349 | if skynet.timex() >= info.time then |
| 349 | -- 最新需求加成取消 | 350 | -- 最新需求加成取消 |
| 350 | --[[ | 351 | --[[ |
| @@ -379,6 +380,7 @@ function _M.endHangRpc(agent, data) | @@ -379,6 +380,7 @@ function _M.endHangRpc(agent, data) | ||
| 379 | for _, heroId in pairs(info.format.heros) do | 380 | for _, heroId in pairs(info.format.heros) do |
| 380 | local curFaith = addHeroFaith(role, heroId, exp) | 381 | local curFaith = addHeroFaith(role, heroId, exp) |
| 381 | heroFaithMap[heroId] = curFaith | 382 | heroFaithMap[heroId] = curFaith |
| 383 | + heroCnt = heroCnt + 1 | ||
| 382 | end | 384 | end |
| 383 | 385 | ||
| 384 | local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 | 386 | local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 |
| @@ -407,6 +409,7 @@ function _M.endHangRpc(agent, data) | @@ -407,6 +409,7 @@ function _M.endHangRpc(agent, data) | ||
| 407 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) | 409 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) |
| 408 | 410 | ||
| 409 | role:checkTaskEnter("AdvHang", {}) | 411 | role:checkTaskEnter("AdvHang", {}) |
| 412 | + role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) | ||
| 410 | 413 | ||
| 411 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) | 414 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) |
| 412 | return true | 415 | return true |
| @@ -544,8 +547,8 @@ function _M.usePotionRpc(agent, data) | @@ -544,8 +547,8 @@ function _M.usePotionRpc(agent, data) | ||
| 544 | local msg = MsgPack.unpack(data) | 547 | local msg = MsgPack.unpack(data) |
| 545 | local potionId = msg.potionId -- 营养剂Id | 548 | local potionId = msg.potionId -- 营养剂Id |
| 546 | local target = msg.target -- {roomId = 1, blockId = 1} 选择的目标 | 549 | local target = msg.target -- {roomId = 1, blockId = 1} 选择的目标 |
| 547 | - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | ||
| 548 | - if potionLv == 0 then return 1 end | 550 | + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 1) |
| 551 | + if potionLv < 1 then return 1 end | ||
| 549 | 552 | ||
| 550 | local potionSet = csvdb["adv_potionCsv"][potionId] | 553 | local potionSet = csvdb["adv_potionCsv"][potionId] |
| 551 | if not potionSet then return 2 end | 554 | if not potionSet then return 2 end |
| @@ -553,12 +556,9 @@ function _M.usePotionRpc(agent, data) | @@ -553,12 +556,9 @@ function _M.usePotionRpc(agent, data) | ||
| 553 | local potionData = potionSet[potionLv] | 556 | local potionData = potionSet[potionLv] |
| 554 | if not potionData then return 3 end | 557 | if not potionData then return 3 end |
| 555 | 558 | ||
| 556 | - local potionBag = role:getProperty("potionBag") | ||
| 557 | - local own = potionBag[potionId] or 0 | ||
| 558 | - if own <= 0 then return 4 end | ||
| 559 | - | ||
| 560 | if not isCanContinue(role) then return end | 559 | if not isCanContinue(role) then return end |
| 561 | local adv = role:getAdvData() | 560 | local adv = role:getAdvData() |
| 561 | + if not adv:cost({[potionId] = 1}, {}, true) then return 4 end | ||
| 562 | if adv:isWaitChooseArtifact() then return end | 562 | if adv:isWaitChooseArtifact() then return end |
| 563 | 563 | ||
| 564 | adv:mylog({desc = "usePotion", int1 = potionId}) | 564 | adv:mylog({desc = "usePotion", int1 = potionId}) |
| @@ -566,8 +566,7 @@ function _M.usePotionRpc(agent, data) | @@ -566,8 +566,7 @@ function _M.usePotionRpc(agent, data) | ||
| 566 | local status = adv:doActive(potionData.effect, target) -- target | 566 | local status = adv:doActive(potionData.effect, target) -- target |
| 567 | if not status then return end | 567 | if not status then return end |
| 568 | 568 | ||
| 569 | - potionBag[potionId] = own - 1 | ||
| 570 | - role:updateProperty({field = "potionBag", value = potionBag}) | 569 | + adv:cost({[potionId] = 1}, {log = {desc = "usePotion", int1 = potionId}}) |
| 571 | adv:pushBackEvent(AdvBackEventType.Potion, {id = potionId}) | 570 | adv:pushBackEvent(AdvBackEventType.Potion, {id = potionId}) |
| 572 | adv:afterRound() | 571 | adv:afterRound() |
| 573 | adv:saveDB() | 572 | adv:saveDB() |
| @@ -738,7 +737,7 @@ function _M.endBattleRpc(agent, data) | @@ -738,7 +737,7 @@ function _M.endBattleRpc(agent, data) | ||
| 738 | role:finishGuide(52) | 737 | role:finishGuide(52) |
| 739 | -- 调理剂使用引导(生命药剂) | 738 | -- 调理剂使用引导(生命药剂) |
| 740 | if not role:checkOverGuide(61) then | 739 | if not role:checkOverGuide(61) then |
| 741 | - local potionBag = role:getProperty("potionBag") | 740 | + local potionBag = role:getProperty("advItems"):toNumMap() |
| 742 | local own = potionBag[10] or 0 | 741 | local own = potionBag[10] or 0 |
| 743 | if own > 0 then | 742 | if own > 0 then |
| 744 | -- 造假 | 743 | -- 造假 |
src/actions/CarAction.lua
| @@ -13,7 +13,7 @@ function _M.makePotionRpc( agent, data ) | @@ -13,7 +13,7 @@ function _M.makePotionRpc( agent, data ) | ||
| 13 | local count = msg.count | 13 | local count = msg.count |
| 14 | if count < 1 then return 0 end | 14 | if count < 1 then return 0 end |
| 15 | local potionBag = role:getProperty("potionBag") | 15 | local potionBag = role:getProperty("potionBag") |
| 16 | - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | 16 | + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 1) |
| 17 | if potionLv < 1 then return 1 end | 17 | if potionLv < 1 then return 1 end |
| 18 | 18 | ||
| 19 | local potionSet = csvdb["adv_potionCsv"][potionId] | 19 | local potionSet = csvdb["adv_potionCsv"][potionId] |
| @@ -22,20 +22,15 @@ function _M.makePotionRpc( agent, data ) | @@ -22,20 +22,15 @@ function _M.makePotionRpc( agent, data ) | ||
| 22 | local potionData = potionSet[potionLv] | 22 | local potionData = potionSet[potionLv] |
| 23 | if not potionData then return 3 end | 23 | if not potionData then return 3 end |
| 24 | 24 | ||
| 25 | - local own = potionBag[potionId] or 0 | ||
| 26 | - if own+count > potionData.limit then | ||
| 27 | - return 4 | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | local cost = potionData.material:toNumMap() | 25 | local cost = potionData.material:toNumMap() |
| 31 | for k, n in pairs(cost) do | 26 | for k, n in pairs(cost) do |
| 32 | cost[k] = n * count | 27 | cost[k] = n * count |
| 33 | end | 28 | end |
| 34 | if not role:checkItemEnough(cost) then | 29 | if not role:checkItemEnough(cost) then |
| 35 | - return 5 | 30 | + return 4 |
| 36 | end | 31 | end |
| 37 | - | ||
| 38 | role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) | 32 | role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) |
| 33 | + local own = potionBag[potionId] or 0 | ||
| 39 | potionBag[potionId] = own + count | 34 | potionBag[potionId] = own + count |
| 40 | role:updateProperty({field = "potionBag", value = potionBag}) | 35 | role:updateProperty({field = "potionBag", value = potionBag}) |
| 41 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) | 36 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) |
src/actions/DinerAction.lua
| @@ -385,22 +385,12 @@ function _M.talentUpRpc( agent, data ) | @@ -385,22 +385,12 @@ function _M.talentUpRpc( agent, data ) | ||
| 385 | local msg = MsgPack.unpack(data) | 385 | local msg = MsgPack.unpack(data) |
| 386 | local dish = msg.dish | 386 | local dish = msg.dish |
| 387 | local dishTree = role.dinerData:getProperty("dishTree") | 387 | local dishTree = role.dinerData:getProperty("dishTree") |
| 388 | - local dishLevel = dishTree:getv(dish, 0) | ||
| 389 | 388 | ||
| 390 | local talentSet = csvdb["diner_talentCsv"][dish] | 389 | local talentSet = csvdb["diner_talentCsv"][dish] |
| 391 | if not talentSet then | 390 | if not talentSet then |
| 392 | return 1 | 391 | return 1 |
| 393 | end | 392 | end |
| 394 | 393 | ||
| 395 | - local talentData = talentSet[dishLevel] | ||
| 396 | - if not talentData then | ||
| 397 | - return 2 | ||
| 398 | - end | ||
| 399 | - | ||
| 400 | - if not talentSet[dishLevel+1] then | ||
| 401 | - return 21 | ||
| 402 | - end | ||
| 403 | - | ||
| 404 | local typ = math.floor(dish/100 + 1) | 394 | local typ = math.floor(dish/100 + 1) |
| 405 | local treeSet = csvdb["diner_treeCsv"][typ] | 395 | local treeSet = csvdb["diner_treeCsv"][typ] |
| 406 | if not treeSet then | 396 | if not treeSet then |
| @@ -412,6 +402,17 @@ function _M.talentUpRpc( agent, data ) | @@ -412,6 +402,17 @@ function _M.talentUpRpc( agent, data ) | ||
| 412 | return 4 | 402 | return 4 |
| 413 | end | 403 | end |
| 414 | 404 | ||
| 405 | + -- 调理剂的默认等级是1级 | ||
| 406 | + local dishLevel = dishTree:getv(dish, treeData.rarity == 2 and 1 or 0) | ||
| 407 | + local talentData = talentSet[dishLevel] | ||
| 408 | + if not talentData then | ||
| 409 | + return 2 | ||
| 410 | + end | ||
| 411 | + | ||
| 412 | + if not talentSet[dishLevel+1] then | ||
| 413 | + return 21 | ||
| 414 | + end | ||
| 415 | + | ||
| 415 | local limit = talentData.pointFront:toNumMap() | 416 | local limit = talentData.pointFront:toNumMap() |
| 416 | for k,v in pairs(limit) do | 417 | for k,v in pairs(limit) do |
| 417 | local lv = dishTree:getv(k, 0) | 418 | local lv = dishTree:getv(k, 0) |
src/actions/GmAction.lua
| @@ -534,11 +534,23 @@ end | @@ -534,11 +534,23 @@ end | ||
| 534 | 534 | ||
| 535 | function _M.test(role, pms) | 535 | function _M.test(role, pms) |
| 536 | local id = tonum(pms.pm1, 0) | 536 | local id = tonum(pms.pm1, 0) |
| 537 | + local actid = nil | ||
| 538 | + if id > 100 then | ||
| 539 | + actid = tonum(pms.pm2, 0) | ||
| 540 | + end | ||
| 537 | --local hero = require ("actions.HeroAction") | 541 | --local hero = require ("actions.HeroAction") |
| 538 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 542 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
| 539 | 543 | ||
| 540 | --role:sendMail(13, nil, "1=2", {111}) | 544 | --role:sendMail(13, nil, "1=2", {111}) |
| 541 | - dump(redisproxy:zrevrange("rank:tower", 0 , 10, "WITHSCORES")) | 545 | + local file = io.open("draw_hero_"..id..".csv", "a") |
| 546 | + for i=1, 10000 do | ||
| 547 | + local heroIds = _M.drawHero(role, id, actid) | ||
| 548 | + for k, v in ipairs(heroIds) do | ||
| 549 | + print((i - 1)* 10 + k, v) | ||
| 550 | + file:write(v.."\n") | ||
| 551 | + end | ||
| 552 | + end | ||
| 553 | + io.close(file) | ||
| 542 | return "成功" | 554 | return "成功" |
| 543 | end | 555 | end |
| 544 | 556 | ||
| @@ -563,5 +575,259 @@ function _M.cz(role, pms) | @@ -563,5 +575,259 @@ function _M.cz(role, pms) | ||
| 563 | return "指令成功" | 575 | return "指令成功" |
| 564 | end | 576 | end |
| 565 | 577 | ||
| 578 | +function _M.drawHero(role, t, act) | ||
| 579 | + local btype = t -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池 | ||
| 580 | + local subType = 1-- 定向卡池需要传 子类型 | ||
| 581 | + local drawType = 2 -- 1 单抽 2 十连 | ||
| 582 | + if btype ~= 1 then | ||
| 583 | + subType = 1 | ||
| 584 | + end | ||
| 585 | + | ||
| 586 | + local actid = act | ||
| 587 | + -- 另开活动卡池 | ||
| 588 | + if actid then | ||
| 589 | + --if not role.activity:isOpenById(actid, "ActHeroPool") then return end | ||
| 590 | + local cfg = csvdb["activity_ctrlCsv"][actid] | ||
| 591 | + if not cfg then return end | ||
| 592 | + | ||
| 593 | + btype = cfg.condition | ||
| 594 | + end | ||
| 595 | + | ||
| 596 | + local buildTypeData = csvdb["build_typeCsv"][btype] | ||
| 597 | + if not buildTypeData then return 2 end | ||
| 598 | + | ||
| 599 | + local drawCount = {1, 10} -- 抽取次数 | ||
| 600 | + if not drawCount[drawType] then return 3 end | ||
| 601 | + | ||
| 602 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | ||
| 603 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | ||
| 604 | + | ||
| 605 | + -- 抽取的池子 | ||
| 606 | + local poolMap = buildTypeData["pool"]:toNumMap() | ||
| 607 | + local poolId = poolMap[subType] | ||
| 608 | + if not poolId then return 5 end | ||
| 609 | + | ||
| 610 | + --TODO 活动覆盖 | ||
| 611 | + local actPoolId = role.activity:getActivityPool(btype, subType) | ||
| 612 | + if actPoolId ~= 0 then | ||
| 613 | + poolId = actPoolId | ||
| 614 | + end | ||
| 615 | + | ||
| 616 | + local unitPool = csvdb["build_unitCsv"][poolId] | ||
| 617 | + if not unitPool then return 7 end | ||
| 618 | + | ||
| 619 | + -- 开始抽 | ||
| 620 | + local resultPool = {} | ||
| 621 | + local function fillDrawPool(isFloorBack) | ||
| 622 | + local condition = {"rare"} | ||
| 623 | + local values = {} | ||
| 624 | + | ||
| 625 | + | ||
| 626 | + for idx, field in ipairs(condition) do | ||
| 627 | + if not values[idx] then | ||
| 628 | + local lpool = {} | ||
| 629 | + local curIdx = 1 | ||
| 630 | + while unitPool[field .. "_" .. curIdx] do | ||
| 631 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
| 632 | + curIdx = curIdx + 1 | ||
| 633 | + end | ||
| 634 | + | ||
| 635 | + if next(lpool) then | ||
| 636 | + values[idx] = math.randWeight(lpool, 1) | ||
| 637 | + end | ||
| 638 | + end | ||
| 639 | + end | ||
| 640 | + | ||
| 641 | + local weight = 0 | ||
| 642 | + local up_pool = nil | ||
| 643 | + local rand_v = math.randomInt(1, 100) | ||
| 644 | + if values[1] == HeroQuality.SR then | ||
| 645 | + weight = unitPool["up_sr_weight"] | ||
| 646 | + up_pool = unitPool["up_sr_id"] | ||
| 647 | + elseif values[1] == HeroQuality.SSR then | ||
| 648 | + weight = unitPool["up_ssr_weight"] | ||
| 649 | + up_pool = unitPool["up_ssr_id"] | ||
| 650 | + end | ||
| 651 | + --print(poolId, rand_v, weight, up_pool, values[1]) | ||
| 652 | + if rand_v < weight and up_pool then | ||
| 653 | + up_pool = up_pool:toArray(true, "=") | ||
| 654 | + if btype == 5 then -- 爱心卡池,使用玩家设置的备选池子 | ||
| 655 | + up_pool = role:getProperty("wishPool") | ||
| 656 | + up_pool[1] = 606 | ||
| 657 | + up_pool[2] = 607 | ||
| 658 | + up_pool[3] = 608 | ||
| 659 | + end | ||
| 660 | + for k, v in ipairs(up_pool) do | ||
| 661 | + resultPool[v] = {1} | ||
| 662 | + end | ||
| 663 | + else | ||
| 664 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | ||
| 665 | + local pool_str = "pool_" .. poolId | ||
| 666 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | ||
| 667 | + local itemData = csvdb["itemCsv"][itemId] | ||
| 668 | + while itemData do | ||
| 669 | + if itemData.type ~= ItemType.Hero then break end | ||
| 670 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
| 671 | + if not heroData then break end | ||
| 672 | + local ok = true | ||
| 673 | + -- 保底是全随机,不用比较类型 | ||
| 674 | + if not isFloorBack then | ||
| 675 | + for idx, field in ipairs(condition) do | ||
| 676 | + if heroData[field] ~= values[idx] then ok = false break end | ||
| 677 | + end | ||
| 678 | + end | ||
| 679 | + if not ok then break end | ||
| 680 | + if oneData[pool_str] > 0 then | ||
| 681 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ||
| 682 | + end | ||
| 683 | + break | ||
| 684 | + end | ||
| 685 | + end | ||
| 686 | + end | ||
| 687 | + end | ||
| 688 | + end | ||
| 689 | + | ||
| 690 | + local guideHero = nil | ||
| 691 | + if role:getProperty("newerGuide") == "8=1" then | ||
| 692 | + guideHero = globalCsv.newdraw_hero_item_id or 503 | ||
| 693 | + end | ||
| 694 | + | ||
| 695 | + local ssrCount = 0 | ||
| 696 | + local reward = {} | ||
| 697 | + local logReward = {} | ||
| 698 | + local result = {} | ||
| 699 | + for i = 1, drawCount[drawType] do | ||
| 700 | + floorHeroCount = floorHeroCount + 1 | ||
| 701 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | ||
| 702 | + resultPool = {} | ||
| 703 | + fillDrawPool(isFloorBack) | ||
| 704 | + if not next(resultPool) then | ||
| 705 | + skynet.error("random pool error, poolId:" .. poolId, isFloorBack) | ||
| 706 | + return 8 | ||
| 707 | + end | ||
| 708 | + | ||
| 709 | + local itemId = math.randWeight(resultPool, 1) | ||
| 710 | + if guideHero then | ||
| 711 | + itemId = guideHero | ||
| 712 | + end | ||
| 713 | + | ||
| 714 | + local itemData = csvdb["itemCsv"][itemId] | ||
| 715 | + if itemData.quality == HeroQuality.SSR then | ||
| 716 | + ssrCount = ssrCount + 1 | ||
| 717 | + if not guideHero then | ||
| 718 | + -- 广播获得ssr英雄 | ||
| 719 | + local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} | ||
| 720 | + --mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) | ||
| 721 | + end | ||
| 722 | + end | ||
| 723 | + | ||
| 724 | + if btype == 4 and role:getProperty("newerDraw") == 0 then -- 新手卡池 | ||
| 725 | + if itemData.quality == HeroQuality.SSR then | ||
| 726 | + floorHeroCount = 0 | ||
| 727 | + end | ||
| 728 | + else | ||
| 729 | + if itemData.quality >= HeroQuality.SR then | ||
| 730 | + floorHeroCount = 0 | ||
| 731 | + end | ||
| 732 | + end | ||
| 733 | + | ||
| 734 | + if role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
| 735 | + local fragId = itemData.id - ItemStartId.Hero | ||
| 736 | + local heroData = csvdb["unitCsv"][fragId] | ||
| 737 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
| 738 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
| 739 | + logReward[fragId] = (logReward[fragId] or 0) + count | ||
| 740 | + table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | ||
| 741 | + else | ||
| 742 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
| 743 | + logReward[itemId] = (logReward[itemId] or 0) + 1 | ||
| 744 | + table.insert(reward, {id = itemId, count = 1}) | ||
| 745 | + end | ||
| 746 | + end | ||
| 747 | + | ||
| 748 | + if draw_floor_back_counts then | ||
| 749 | + local floorHero = role:getProperty("floorHero") | ||
| 750 | + floorHero[btype] = floorHeroCount | ||
| 751 | + role:setProperty("floorHero", floorHero) | ||
| 752 | + end | ||
| 753 | + | ||
| 754 | + if btype == 4 then | ||
| 755 | + local newCount = role:getProperty("newerDraw") | ||
| 756 | + role:updateProperty({field="newerDraw", value = newCount + drawCount[drawType]}) | ||
| 757 | + end | ||
| 758 | + | ||
| 759 | + --SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | ||
| 760 | + for k, v in pairs(reward) do | ||
| 761 | + local hero = v | ||
| 762 | + if hero["from"] then | ||
| 763 | + result[#result+1] = hero["from"] | ||
| 764 | + else | ||
| 765 | + result[#result+1] = hero["id"] | ||
| 766 | + end | ||
| 767 | + end | ||
| 768 | + | ||
| 769 | + local feedbackId = buildTypeData["can_feedback"] or 0 | ||
| 770 | + if feedbackId ~= 0 then | ||
| 771 | + -- 达到一定次数,给响应奖励 | ||
| 772 | + local oldVal = role:getProperty("repayHero") or 0 | ||
| 773 | + if actid then | ||
| 774 | + local actData = role.activity:getActData("ActHeroPool") | ||
| 775 | + oldVal = actData[btype] or 0 | ||
| 776 | + end | ||
| 777 | + local newVal = oldVal + drawCount[drawType] | ||
| 778 | + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | ||
| 779 | + -- 空字符穿代表直接给英雄 走以前repayHeroRpc | ||
| 780 | + if drawCardReward == "" then | ||
| 781 | + local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 | ||
| 782 | + repayHeroMaxCount = repayHeroMaxCount + 1 | ||
| 783 | + | ||
| 784 | + role:updateProperty({field = "repayMaxC", value = repayHeroMaxCount}) | ||
| 785 | + local even = repayHeroMaxCount % 2 | ||
| 786 | + local id = 0 | ||
| 787 | + if even == 1 then | ||
| 788 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
| 789 | + else | ||
| 790 | + local giftHeroSet = {} | ||
| 791 | + for gid, cfg in pairs(csvdb["build_giftCsv"]) do | ||
| 792 | + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | ||
| 793 | + giftHeroSet[gid] = {1} | ||
| 794 | + end | ||
| 795 | + end | ||
| 796 | + if next(giftHeroSet) then | ||
| 797 | + id = math.randWeight(giftHeroSet, 1) | ||
| 798 | + end | ||
| 799 | + end | ||
| 800 | + if id == 0 then | ||
| 801 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
| 802 | + end | ||
| 803 | + | ||
| 804 | + local r,change = {} | ||
| 805 | + local itemData = csvdb["itemCsv"][id] | ||
| 806 | + --if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
| 807 | + -- local fragId = itemData.id - ItemStartId.Hero | ||
| 808 | + -- local heroData = csvdb["unitCsv"][fragId] | ||
| 809 | + -- local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
| 810 | + -- r, change = role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 811 | + -- --r = {id = fragId, count = count, from = id, fcount = 1} | ||
| 812 | + --else | ||
| 813 | + r, change = role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 814 | + --end | ||
| 815 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
| 816 | + elseif drawCardReward and drawCardReward ~= "" then | ||
| 817 | + local r,change = {} | ||
| 818 | + r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
| 819 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
| 820 | + end | ||
| 821 | + if not actid then | ||
| 822 | + role:updateProperty({field = "repayHero", value = val}) | ||
| 823 | + else | ||
| 824 | + local actData = role.activity:getActData("ActHeroPool") | ||
| 825 | + actData[btype] = val | ||
| 826 | + role.activity:updateActData("ActHeroPool", actData) | ||
| 827 | + end | ||
| 828 | + end | ||
| 829 | + return result | ||
| 830 | +end | ||
| 831 | + | ||
| 566 | 832 | ||
| 567 | return _M | 833 | return _M |
| 568 | \ No newline at end of file | 834 | \ No newline at end of file |
src/actions/HangAction.lua
| @@ -591,6 +591,8 @@ function _M.startBonusBattleRpc(agent, data) | @@ -591,6 +591,8 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 591 | 591 | ||
| 592 | local reward, change = bonusWinReward(role, bonusData, 3, count) | 592 | local reward, change = bonusWinReward(role, bonusData, 3, count) |
| 593 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 593 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
| 594 | + | ||
| 595 | + role:checkTaskEnter("BonusQuick", {count = count}) | ||
| 594 | else | 596 | else |
| 595 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) | 597 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) |
| 596 | if not next(bTeam) then return 5 end | 598 | if not next(bTeam) then return 5 end |
src/actions/RadioAction.lua
| @@ -179,6 +179,7 @@ function _M.finishQuestRpc(agent, data) | @@ -179,6 +179,7 @@ function _M.finishQuestRpc(agent, data) | ||
| 179 | msg["heroFaith"] = heroFaithMap | 179 | msg["heroFaith"] = heroFaithMap |
| 180 | SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg)) | 180 | SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg)) |
| 181 | 181 | ||
| 182 | + role:checkTaskEnter("RadioTaskStart", {heroCnt = #task.heros}) | ||
| 182 | 183 | ||
| 183 | local herolist = {} | 184 | local herolist = {} |
| 184 | for _, heroId in ipairs(task.heros) do | 185 | for _, heroId in ipairs(task.heros) do |
src/actions/RoleAction.lua
| @@ -847,6 +847,11 @@ function _M.taskRpc(agent, data) | @@ -847,6 +847,11 @@ function _M.taskRpc(agent, data) | ||
| 847 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) | 847 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) |
| 848 | local active = (taskStatus["a"] or 0) + taskData.active | 848 | local active = (taskStatus["a"] or 0) + taskData.active |
| 849 | 849 | ||
| 850 | + -- 日常活动完成 | ||
| 851 | + if taskType == 1 then | ||
| 852 | + role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) | ||
| 853 | + end | ||
| 854 | + | ||
| 850 | role:changeUpdates({ | 855 | role:changeUpdates({ |
| 851 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, | 856 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, |
| 852 | { type = roleField[taskType], field = "a", value = active}, | 857 | { type = roleField[taskType], field = "a", value = active}, |
src/adv/Adv.lua
| @@ -142,6 +142,11 @@ function Adv:initByChapter(params) | @@ -142,6 +142,11 @@ function Adv:initByChapter(params) | ||
| 142 | isNewRelay = true | 142 | isNewRelay = true |
| 143 | end | 143 | end |
| 144 | end | 144 | end |
| 145 | + | ||
| 146 | + if self.level == 1 or self.isRelay then | ||
| 147 | + self:supplyPotion() | ||
| 148 | + end | ||
| 149 | + | ||
| 145 | self.maps = {} | 150 | self.maps = {} |
| 146 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) | 151 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
| 147 | 152 | ||
| @@ -404,9 +409,16 @@ function Adv:forceOver(notNotify) | @@ -404,9 +409,16 @@ function Adv:forceOver(notNotify) | ||
| 404 | local advTeam = self.owner:getProperty("advTeam") | 409 | local advTeam = self.owner:getProperty("advTeam") |
| 405 | advTeam.player = nil | 410 | advTeam.player = nil |
| 406 | 411 | ||
| 412 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
| 413 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 414 | + | ||
| 407 | local reward = self.owner:getProperty("advItems"):toNumMap() | 415 | local reward = self.owner:getProperty("advItems"):toNumMap() |
| 408 | for itemId, count in pairs(reward) do | 416 | for itemId, count in pairs(reward) do |
| 409 | - reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | 417 | + if advPotionCsv[itemId] then |
| 418 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 419 | + else | ||
| 420 | + reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | ||
| 421 | + end | ||
| 410 | end | 422 | end |
| 411 | self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) | 423 | self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) |
| 412 | 424 | ||
| @@ -417,6 +429,7 @@ function Adv:forceOver(notNotify) | @@ -417,6 +429,7 @@ function Adv:forceOver(notNotify) | ||
| 417 | advItems = "", | 429 | advItems = "", |
| 418 | advAFGet = {}, | 430 | advAFGet = {}, |
| 419 | advAFWear = {}, | 431 | advAFWear = {}, |
| 432 | + potionBag = potionBag, | ||
| 420 | }, notNotify) | 433 | }, notNotify) |
| 421 | end | 434 | end |
| 422 | end | 435 | end |
| @@ -797,12 +810,18 @@ function Adv:over(success, rewardRatio, overType) | @@ -797,12 +810,18 @@ function Adv:over(success, rewardRatio, overType) | ||
| 797 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | 810 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) |
| 798 | 811 | ||
| 799 | local reward = {} | 812 | local reward = {} |
| 813 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
| 814 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 800 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do | 815 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
| 801 | local itemCsv = csvdb["itemCsv"][itemId] | 816 | local itemCsv = csvdb["itemCsv"][itemId] |
| 802 | if not itemCsv then | 817 | if not itemCsv then |
| 803 | print("ERROR: no itemId in ItemCsv : ", itemId) | 818 | print("ERROR: no itemId in ItemCsv : ", itemId) |
| 804 | elseif itemCsv.type ~= ItemType.AdvItem then | 819 | elseif itemCsv.type ~= ItemType.AdvItem then |
| 805 | - reward[itemId] = math.ceil(count * rewardRatio / 100) | 820 | + if advPotionCsv[itemId] then |
| 821 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 822 | + else | ||
| 823 | + reward[itemId] = math.ceil(count * rewardRatio / 100) | ||
| 824 | + end | ||
| 806 | end | 825 | end |
| 807 | end | 826 | end |
| 808 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 827 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
| @@ -898,6 +917,7 @@ function Adv:over(success, rewardRatio, overType) | @@ -898,6 +917,7 @@ function Adv:over(success, rewardRatio, overType) | ||
| 898 | advItems = "", | 917 | advItems = "", |
| 899 | advAFGet = {}, | 918 | advAFGet = {}, |
| 900 | advAFWear = {}, | 919 | advAFWear = {}, |
| 920 | + potionBag = potionBag, | ||
| 901 | }) | 921 | }) |
| 902 | self:pushBackEvent(AdvBackEventType.End, { | 922 | self:pushBackEvent(AdvBackEventType.End, { |
| 903 | success = success, | 923 | success = success, |
| @@ -982,7 +1002,8 @@ function Adv:award(gift, params, backRewardParams) | @@ -982,7 +1002,8 @@ function Adv:award(gift, params, backRewardParams) | ||
| 982 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then | 1002 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then |
| 983 | autoUse[itemId] = count | 1003 | autoUse[itemId] = count |
| 984 | else | 1004 | else |
| 985 | - local origin = items:getv(itemId, 0) | 1005 | + local transId = globalCsv.adv_item_potion[itemId] or itemId |
| 1006 | + local origin = items:getv(transId, 0) | ||
| 986 | local nums = origin + count | 1007 | local nums = origin + count |
| 987 | 1008 | ||
| 988 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | 1009 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 |
| @@ -992,10 +1013,10 @@ function Adv:award(gift, params, backRewardParams) | @@ -992,10 +1013,10 @@ function Adv:award(gift, params, backRewardParams) | ||
| 992 | end | 1013 | end |
| 993 | else | 1014 | else |
| 994 | if nums <= 0 then | 1015 | if nums <= 0 then |
| 995 | - items = items:delk(itemId) | 1016 | + items = items:delk(transId) |
| 996 | nums = 0 | 1017 | nums = 0 |
| 997 | else | 1018 | else |
| 998 | - items = items:setv(itemId, nums) | 1019 | + items = items:setv(transId, nums) |
| 999 | end | 1020 | end |
| 1000 | 1021 | ||
| 1001 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then | 1022 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
| @@ -1073,6 +1094,7 @@ end | @@ -1073,6 +1094,7 @@ end | ||
| 1073 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 | 1094 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 |
| 1074 | function Adv:cost(item, params, check) | 1095 | function Adv:cost(item, params, check) |
| 1075 | local items = self.owner:getProperty("advItems") | 1096 | local items = self.owner:getProperty("advItems") |
| 1097 | + local potionCsv = csvdb["adv_potionCsv"] | ||
| 1076 | local less = {} | 1098 | local less = {} |
| 1077 | local advCost = {} | 1099 | local advCost = {} |
| 1078 | for itemId, count in pairs(item) do | 1100 | for itemId, count in pairs(item) do |
| @@ -1086,9 +1108,13 @@ function Adv:cost(item, params, check) | @@ -1086,9 +1108,13 @@ function Adv:cost(item, params, check) | ||
| 1086 | less[itemId] = -last | 1108 | less[itemId] = -last |
| 1087 | end | 1109 | end |
| 1088 | 1110 | ||
| 1111 | + if potionCsv[itemId] and last < 0 then -- 只能使用冒险背包里的药水 | ||
| 1112 | + return | ||
| 1113 | + end | ||
| 1089 | end | 1114 | end |
| 1090 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 | 1115 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 |
| 1091 | if check then return true end | 1116 | if check then return true end |
| 1117 | + | ||
| 1092 | self:award(advCost, params) | 1118 | self:award(advCost, params) |
| 1093 | if next(less) then | 1119 | if next(less) then |
| 1094 | self.owner:costItems(less, params) | 1120 | self.owner:costItems(less, params) |
| @@ -1096,6 +1122,25 @@ function Adv:cost(item, params, check) | @@ -1096,6 +1122,25 @@ function Adv:cost(item, params, check) | ||
| 1096 | return true | 1122 | return true |
| 1097 | end | 1123 | end |
| 1098 | 1124 | ||
| 1125 | +-- 补满冒险背包药剂,从药剂背包扣除药水放到冒险背包 | ||
| 1126 | +function Adv:supplyPotion() | ||
| 1127 | + local potionCsv = csvdb["adv_potionCsv"] | ||
| 1128 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 1129 | + local advItems = self.owner:getProperty("advItems") | ||
| 1130 | + for potionId, set in pairs(potionCsv) do | ||
| 1131 | + local count = potionBag[potionId] or 0 | ||
| 1132 | + if count > 0 then | ||
| 1133 | + local num = math.min(set[1].limit,count) | ||
| 1134 | + advItems = advItems:setv(potionId,num) | ||
| 1135 | + potionBag[potionId] = num ~= count and (count - num) or nil | ||
| 1136 | + end | ||
| 1137 | + end | ||
| 1138 | + self.owner:updateProperties({ | ||
| 1139 | + advItems = advItems, | ||
| 1140 | + potionBag = potionBag, | ||
| 1141 | + }) | ||
| 1142 | +end | ||
| 1143 | + | ||
| 1099 | --事件点击处理 | 1144 | --事件点击处理 |
| 1100 | local function clickOut(self, room, block, params, isExit) | 1145 | local function clickOut(self, room, block, params, isExit) |
| 1101 | if self:getCurMap():checkOver() then --检查是否可以出去了 | 1146 | if self:getCurMap():checkOver() then --检查是否可以出去了 |
| @@ -2152,6 +2197,7 @@ function Adv:enemyDead(enemy, escape) | @@ -2152,6 +2197,7 @@ function Adv:enemyDead(enemy, escape) | ||
| 2152 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) | 2197 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) |
| 2153 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) | 2198 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) |
| 2154 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) | 2199 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) |
| 2200 | + self.owner:checkTaskEnter("AdvKillBoss") | ||
| 2155 | elseif monsterData.type == 3 then | 2201 | elseif monsterData.type == 3 then |
| 2156 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) | 2202 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) |
| 2157 | end | 2203 | end |
src/models/Activity.lua
| @@ -30,6 +30,9 @@ Activity.ActivityType = { | @@ -30,6 +30,9 @@ Activity.ActivityType = { | ||
| 30 | ActShopGoods = 25, -- 活动商品 | 30 | ActShopGoods = 25, -- 活动商品 |
| 31 | 31 | ||
| 32 | Crisis = 26, -- 宝藏怪活动 | 32 | Crisis = 26, -- 宝藏怪活动 |
| 33 | + | ||
| 34 | + CommonSignIn = 28, --通用签到 | ||
| 35 | + FriendEnergy = 30, -- 好友互赠能量活动 | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | local function checkActivityType(activityType) | 38 | local function checkActivityType(activityType) |
| @@ -73,6 +76,9 @@ Activity.schema = { | @@ -73,6 +76,9 @@ Activity.schema = { | ||
| 73 | 76 | ||
| 74 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} | 77 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} |
| 75 | act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | 78 | act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} |
| 79 | + | ||
| 80 | + act28 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | ||
| 81 | + act30 = {"table", {}}, -- {magic = 0, limit = 0, reward = {id = 1, id = 1}, giveAE = {}, getAE = {}} 奖励字段1表示领取过奖励 | ||
| 76 | } | 82 | } |
| 77 | 83 | ||
| 78 | function Activity:data() | 84 | function Activity:data() |
| @@ -93,6 +99,9 @@ function Activity:data() | @@ -93,6 +99,9 @@ function Activity:data() | ||
| 93 | act20 = self:getProperty("act20"), | 99 | act20 = self:getProperty("act20"), |
| 94 | act24 = self:getProperty("act24"), | 100 | act24 = self:getProperty("act24"), |
| 95 | act26 = self:getProperty("act26"), | 101 | act26 = self:getProperty("act26"), |
| 102 | + | ||
| 103 | + act28 = self:getProperty("act28"), | ||
| 104 | + act30 = self:getProperty("act30"), | ||
| 96 | } | 105 | } |
| 97 | end | 106 | end |
| 98 | 107 | ||
| @@ -471,8 +480,9 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | @@ -471,8 +480,9 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | ||
| 471 | role:checkTaskEnter("RuneQualityCollect", {}) | 480 | role:checkTaskEnter("RuneQualityCollect", {}) |
| 472 | 481 | ||
| 473 | end, | 482 | end, |
| 474 | - -- ["close"] = function(self, actType, notify) | ||
| 475 | - -- end, | 483 | + ["close"] = function(self, actType, notify) |
| 484 | + self.owner:updateProperty({field="CalTask", value={}}) | ||
| 485 | + end, | ||
| 476 | } | 486 | } |
| 477 | 487 | ||
| 478 | -- 兑换 | 488 | -- 兑换 |
| @@ -772,7 +782,46 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | @@ -772,7 +782,46 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | ||
| 772 | end, | 782 | end, |
| 773 | } | 783 | } |
| 774 | 784 | ||
| 785 | +activityFunc[Activity.ActivityType.FriendEnergy] = { | ||
| 786 | + ["init"] = function (self, actType, isCrossDay, notify, actId) | ||
| 787 | + local data = {magic = 0, limit = 0, reward = {}, giveAE = {}, getAE = {}, new = self:getActFriendNew()} | ||
| 788 | + self:updateActData(actType, data, not notify) | ||
| 789 | + end, | ||
| 790 | + ["login"] = function (self, actType) | ||
| 791 | + local actData = self:getActData(actType) or {} | ||
| 792 | + actData.new = self:getActFriendNew() | ||
| 793 | + self:updateActData(actType, actData, not notify) | ||
| 794 | + end, | ||
| 795 | + ["crossDay"] = function(self, actType, notify) | ||
| 796 | + local actData = self:getActData(actType) | ||
| 797 | + actData.limit = 0 | ||
| 798 | + actData.giveAE = {} | ||
| 799 | + actData.getAE = {} | ||
| 800 | + self:updateActData(actType, actData, not notify) | ||
| 801 | + end, | ||
| 802 | + ["close"] = function (self, actType, notify, actId) | ||
| 803 | + redisproxy:del(FRIEND_ENERGY:format(self.owner:getProperty("id"))) | ||
| 804 | + end | ||
| 805 | +} | ||
| 775 | 806 | ||
| 807 | +function Activity:getActFriendNew() | ||
| 808 | + local roleId = self.owner:getProperty("id") | ||
| 809 | + local friendIds = {} | ||
| 810 | + local friends = redisproxy:hgetall(FRIEND_KEY:format(roleId)) | ||
| 811 | + for i = 1, #friends , 2 do | ||
| 812 | + local objId = tonumber(friends[i]) | ||
| 813 | + friendIds[objId] = 1 | ||
| 814 | + end | ||
| 815 | + | ||
| 816 | + local ids = {} | ||
| 817 | + local members = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
| 818 | + for _, id in pairs(members) do | ||
| 819 | + if friendIds[tonumber(id)] then | ||
| 820 | + ids[tonumber(id)] = 1 | ||
| 821 | + end | ||
| 822 | + end | ||
| 823 | + return ids | ||
| 824 | +end | ||
| 776 | 825 | ||
| 777 | activityFunc[Activity.ActivityType.Crisis] = { | 826 | activityFunc[Activity.ActivityType.Crisis] = { |
| 778 | ["check"] = function(self, actType, notify, atype, count) -- 检查 | 827 | ["check"] = function(self, actType, notify, atype, count) -- 检查 |
| @@ -814,4 +863,40 @@ activityFunc[Activity.ActivityType.Crisis] = { | @@ -814,4 +863,40 @@ activityFunc[Activity.ActivityType.Crisis] = { | ||
| 814 | end, | 863 | end, |
| 815 | } | 864 | } |
| 816 | 865 | ||
| 866 | +activityFunc[Activity.ActivityType.CommonSignIn] = { | ||
| 867 | + ["init"] = function(self, actType, isCrossDay, notify, actId) | ||
| 868 | + if not isCrossDay then | ||
| 869 | + activityFunc[Activity.ActivityType.CommonSignIn]["crossDay"](self, actType, notify, actId) | ||
| 870 | + end | ||
| 871 | + end, | ||
| 872 | + ["crossDay"] = function(self, actType, notify, actId) | ||
| 873 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
| 874 | + if not actCfg then return end | ||
| 875 | + local conArr = actCfg.condition2:toArray("true", "=") | ||
| 876 | + -- 0 登录即可, 1 达到指定活跃度 | ||
| 877 | + if conArr[1] ~= 0 then | ||
| 878 | + return | ||
| 879 | + end | ||
| 880 | + local curData = self:getActData(actType) or {} | ||
| 881 | + curData[0] = (curData[0] or 0) + 1 | ||
| 882 | + self:updateActData(actType, curData, not notify) | ||
| 883 | + end, | ||
| 884 | + ["check"] = function(self, actType, notify, pre, cur) -- 检查 | ||
| 885 | + local isOpen, actId = self:isOpen(actType) | ||
| 886 | + local actData = self:getActData(actType) or {} | ||
| 887 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
| 888 | + if not actCfg then return end | ||
| 889 | + local conArr = actCfg.condition2:toArray("true", "=") | ||
| 890 | + -- 0 登录即可, 1 达到指定活跃度 | ||
| 891 | + if conArr[1] ~= 1 then | ||
| 892 | + return | ||
| 893 | + end | ||
| 894 | + local val = conArr[2] or 0 | ||
| 895 | + if pre < val and cur >= val then | ||
| 896 | + actData[0] = (actData[0] or 0) + 1 | ||
| 897 | + self:updateActData(actType, actData, not notify) | ||
| 898 | + end | ||
| 899 | + end, | ||
| 900 | +} | ||
| 901 | + | ||
| 817 | return Activity | 902 | return Activity |
src/models/RoleLog.lua
| @@ -51,6 +51,8 @@ local ItemReason = { | @@ -51,6 +51,8 @@ local ItemReason = { | ||
| 51 | actBattle = 135, -- 活动关卡 | 51 | actBattle = 135, -- 活动关卡 |
| 52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 | 52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 |
| 53 | worldBossReward = 137, -- 世界boss翻牌奖励 | 53 | worldBossReward = 137, -- 世界boss翻牌奖励 |
| 54 | + commonSign = 138, -- 每日活跃签到 | ||
| 55 | + actFriendHelp = 139,-- 好友能量互助活动 | ||
| 54 | 56 | ||
| 55 | 57 | ||
| 56 | advHang = 301, -- 拾荒挂机 | 58 | advHang = 301, -- 拾荒挂机 |
src/models/RolePlugin.lua
| @@ -131,6 +131,9 @@ function RolePlugin.bind(Role) | @@ -131,6 +131,9 @@ function RolePlugin.bind(Role) | ||
| 131 | self:addItem(pms) | 131 | self:addItem(pms) |
| 132 | end | 132 | end |
| 133 | end, | 133 | end, |
| 134 | + [ItemType.Potion] = function () | ||
| 135 | + self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log}) | ||
| 136 | + end, | ||
| 134 | } | 137 | } |
| 135 | -- 对数量筛查 | 138 | -- 对数量筛查 |
| 136 | count = checkItemCount(self, itemId, count) | 139 | count = checkItemCount(self, itemId, count) |
| @@ -290,6 +293,37 @@ function RolePlugin.bind(Role) | @@ -290,6 +293,37 @@ function RolePlugin.bind(Role) | ||
| 290 | self:changeCrossServerPvpSelfInfo("level") | 293 | self:changeCrossServerPvpSelfInfo("level") |
| 291 | end | 294 | end |
| 292 | 295 | ||
| 296 | + function Role:addPotion(params) | ||
| 297 | + dump(params) | ||
| 298 | + local pId = globalCsv.adv_item_potion[params.id] | ||
| 299 | + local potionBag = self:getProperty("potionBag") | ||
| 300 | + local origin = potionBag[pId] or 0 | ||
| 301 | + local nums = origin + params.count | ||
| 302 | + potionBag[pId] = nums | ||
| 303 | + | ||
| 304 | + self:logItems(params.id, origin, nums, params.log) | ||
| 305 | + if params.log then | ||
| 306 | + local log = clone(params.log) | ||
| 307 | + if log["cint1"] or log["cint2"] then | ||
| 308 | + print("addItem error log have cint1 or cint2 ", debug.traceback()) | ||
| 309 | + end | ||
| 310 | + log["cint1"] = params.id | ||
| 311 | + log["cint2"] = math.abs(params.count) | ||
| 312 | + if params.count <= 0 then | ||
| 313 | + self:mylog("out_item", log) | ||
| 314 | + else | ||
| 315 | + self:mylog("in_item", log) | ||
| 316 | + end | ||
| 317 | + else | ||
| 318 | + print("addItem no log ", debug.traceback()) | ||
| 319 | + end | ||
| 320 | + | ||
| 321 | + self:updateProperty({field = "potionBag", value = potionBag}) | ||
| 322 | + if not params.notNotify then | ||
| 323 | + SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.id] = params.count})) | ||
| 324 | + end | ||
| 325 | + end | ||
| 326 | + | ||
| 293 | function Role:addItem(params) | 327 | function Role:addItem(params) |
| 294 | params = params or {} | 328 | params = params or {} |
| 295 | params.count = math.floor(params.count or 0) | 329 | params.count = math.floor(params.count or 0) |
| @@ -1581,7 +1615,6 @@ function RolePlugin.bind(Role) | @@ -1581,7 +1615,6 @@ function RolePlugin.bind(Role) | ||
| 1581 | if table.pack(next(newReward))[2] >= divisionData.limit then | 1615 | if table.pack(next(newReward))[2] >= divisionData.limit then |
| 1582 | return true | 1616 | return true |
| 1583 | end | 1617 | end |
| 1584 | - | ||
| 1585 | end | 1618 | end |
| 1586 | 1619 | ||
| 1587 | local events = {} | 1620 | local events = {} |
src/models/RolePvp.lua
| @@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 | @@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 | ||
| 9 | local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分 | 9 | local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分 |
| 10 | 10 | ||
| 11 | -- 匹配规则改为以排名来匹配 | 11 | -- 匹配规则改为以排名来匹配 |
| 12 | -local PVP_GET_ROBOT_SCORE = 2400 -- 2400分以下低档位匹配机器人 | 12 | +local PVP_GET_ROBOT_SCORE = 1300 -- 1300分以下低档位匹配机器人 |
| 13 | local PRE_RANGE_COUNT = 20 -- 每个档位人数 | 13 | local PRE_RANGE_COUNT = 20 -- 每个档位人数 |
| 14 | local NEED_MATCH = 3 --匹配到多少人 | 14 | local NEED_MATCH = 3 --匹配到多少人 |
| 15 | 15 | ||
| @@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin) | @@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin) | ||
| 73 | if isWin then | 73 | if isWin then |
| 74 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400))) | 74 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400))) |
| 75 | myScore = myScore + scoreChange | 75 | myScore = myScore + scoreChange |
| 76 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | 76 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 |
| 77 | else | 77 | else |
| 78 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400))) | 78 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400))) |
| 79 | myScore = myScore - scoreChange | 79 | myScore = myScore - scoreChange |
| @@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin) | @@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin) | ||
| 139 | if isWin then | 139 | if isWin then |
| 140 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000))) | 140 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000))) |
| 141 | myScore = myScore + scoreChange | 141 | myScore = myScore + scoreChange |
| 142 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | 142 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 |
| 143 | else | 143 | else |
| 144 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000))) | 144 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000))) |
| 145 | myScore = myScore - scoreChange | 145 | myScore = myScore - scoreChange |
src/models/RoleTask.lua
| @@ -34,6 +34,7 @@ local TaskType = { | @@ -34,6 +34,7 @@ local TaskType = { | ||
| 34 | HangBattle = 304, -- 挂机战斗 - id | 34 | HangBattle = 304, -- 挂机战斗 - id |
| 35 | HangGetGold = 305, -- 挂机获得齿轮 - count | 35 | HangGetGold = 305, -- 挂机获得齿轮 - count |
| 36 | BonusPass = 306, -- 奖励副本通关 - id count | 36 | BonusPass = 306, -- 奖励副本通关 - id count |
| 37 | + BonusQuick = 307, -- 奖励关卡扫荡 -- id count | ||
| 37 | 38 | ||
| 38 | -- 冒险相关 | 39 | -- 冒险相关 |
| 39 | AdvPass = 401, -- 冒险通过关 - id level score | 40 | AdvPass = 401, -- 冒险通过关 - id level score |
| @@ -50,7 +51,9 @@ local TaskType = { | @@ -50,7 +51,9 @@ local TaskType = { | ||
| 50 | AdvHang = 412, -- 代理拾荒次数 | 51 | AdvHang = 412, -- 代理拾荒次数 |
| 51 | AdvMineKill = 413, -- 宝藏怪击杀 | 52 | AdvMineKill = 413, -- 宝藏怪击杀 |
| 52 | AdvMineLayer = 414, -- 宝藏洞激活 | 53 | AdvMineLayer = 414, -- 宝藏洞激活 |
| 53 | - AdvPassFirst = 415, -- 冒险首次通关 - id | 54 | + AdvKillBoss = 415, -- 拾荒击杀boss |
| 55 | + AdvHangHeroCnt = 416, -- 拾荒人数 | ||
| 56 | + AdvPassFirst = 417, -- 冒险首次通关 - id | ||
| 54 | 57 | ||
| 55 | --爬塔相关 | 58 | --爬塔相关 |
| 56 | TowerPass = 501, -- 爬塔通关 - level | 59 | TowerPass = 501, -- 爬塔通关 - level |
| @@ -92,6 +95,9 @@ local TaskType = { | @@ -92,6 +95,9 @@ local TaskType = { | ||
| 92 | SignIn = 901, -- 签到 | 95 | SignIn = 901, -- 签到 |
| 93 | Pay = 902, -- 充值 | 96 | Pay = 902, -- 充值 |
| 94 | ShopAll = 903, -- 在任意商店购买 | 97 | ShopAll = 903, -- 在任意商店购买 |
| 98 | + DailyTask = 904, -- 完成每日活跃任务 | ||
| 99 | + RadioTaskStart = 905, -- 电台任务开始 | ||
| 100 | + FinishSpeTask = 906, -- 指定任务完成 | ||
| 95 | 101 | ||
| 96 | --功能未实现 todo | 102 | --功能未实现 todo |
| 97 | AdvShop = 1002, -- 冒险商城 | 103 | AdvShop = 1002, -- 冒险商城 |
| @@ -232,6 +238,7 @@ local ActivityListener = { | @@ -232,6 +238,7 @@ local ActivityListener = { | ||
| 232 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | 238 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
| 233 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, | 239 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
| 234 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, | 240 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
| 241 | + [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, | ||
| 235 | } | 242 | } |
| 236 | } | 243 | } |
| 237 | 244 | ||
| @@ -269,6 +276,14 @@ local CalendaTaskListener = { | @@ -269,6 +276,14 @@ local CalendaTaskListener = { | ||
| 269 | [TaskType.HangGet]= {{18, 3, f("reward")}}, | 276 | [TaskType.HangGet]= {{18, 3, f("reward")}}, |
| 270 | [TaskType.RuneQualityCollect]= {{19, 3}}, | 277 | [TaskType.RuneQualityCollect]= {{19, 3}}, |
| 271 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, | 278 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, |
| 279 | + [TaskType.RadioTaskStart] = {{21, 1}, {22, 3, f("heroCnt")}}, | ||
| 280 | + [TaskType.BonusQuick] = {{23, 1, f("count")}}, | ||
| 281 | + [TaskType.AdvHangHeroCnt] = {{24, 3, f("HeroCnt")}}, | ||
| 282 | + [TaskType.AdvKillBoss] = {{25, 1}}, | ||
| 283 | + [TaskType.AdvMineKill] = {{26, 1}}, | ||
| 284 | + [TaskType.PvpBattle] = {{27, 1}}, | ||
| 285 | + [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}}, | ||
| 286 | + | ||
| 272 | } | 287 | } |
| 273 | } | 288 | } |
| 274 | 289 | ||
| @@ -701,6 +716,15 @@ function RoleTask.bind(Role) | @@ -701,6 +716,15 @@ function RoleTask.bind(Role) | ||
| 701 | calTask[id] = 1 | 716 | calTask[id] = 1 |
| 702 | end | 717 | end |
| 703 | end | 718 | end |
| 719 | + elseif cfg.type == 22 then -- 电台任务出勤人数 | ||
| 720 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | ||
| 721 | + elseif cfg.type == 24 then -- 代理拾荒出勤人数 | ||
| 722 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | ||
| 723 | + elseif cfg.type == 28 then -- 完成指定任务 | ||
| 724 | + print(actId,param2, cfg.condition2, param1) | ||
| 725 | + if actId == param2 and cfg.condition2 == param1 then | ||
| 726 | + calTask[id] = (calTask[id] or 0) + 1 | ||
| 727 | + end | ||
| 704 | end | 728 | end |
| 705 | end | 729 | end |
| 706 | end | 730 | end |
| @@ -713,4 +737,4 @@ function RoleTask.bind(Role) | @@ -713,4 +737,4 @@ function RoleTask.bind(Role) | ||
| 713 | 737 | ||
| 714 | end | 738 | end |
| 715 | 739 | ||
| 716 | -return RoleTask | ||
| 717 | \ No newline at end of file | 740 | \ No newline at end of file |
| 741 | +return RoleTask |