Commit c7a8e254488978899a068340531bc311136c1d3d
Merge branch 'tr/bugfix-qa' into tr/publish/preview
Showing
19 changed files
with
800 additions
and
45 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
| @@ -247,6 +247,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"}) | @@ -247,6 +247,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"}) | ||
| 247 | table.insert(helpDes, {"获得所有碎片", "get", "FRAG"}) | 247 | table.insert(helpDes, {"获得所有碎片", "get", "FRAG"}) |
| 248 | table.insert(helpDes, {"获得所有食物", "get", "FOOD"}) | 248 | table.insert(helpDes, {"获得所有食物", "get", "FOOD"}) |
| 249 | table.insert(helpDes, {"获得所有角色", "get", "HERO"}) | 249 | table.insert(helpDes, {"获得所有角色", "get", "HERO"}) |
| 250 | +table.insert(helpDes, {"获得满级满觉醒角色,满级满精进铭文", "get", "MAXHERO"}) | ||
| 250 | function _M.get(role, pms) | 251 | function _M.get(role, pms) |
| 251 | if pms.pm1 == "ALL" then | 252 | if pms.pm1 == "ALL" then |
| 252 | local reward = {} | 253 | local reward = {} |
| @@ -263,7 +264,7 @@ function _M.get(role, pms) | @@ -263,7 +264,7 @@ function _M.get(role, pms) | ||
| 263 | end | 264 | end |
| 264 | end | 265 | end |
| 265 | elseif pms.pm1 == "RUNE" then | 266 | elseif pms.pm1 == "RUNE" then |
| 266 | - for itemId = 2000 , 3000 do | 267 | + for itemId = 10000 , 20000 do |
| 267 | if csvdb["itemCsv"][itemId] then | 268 | if csvdb["itemCsv"][itemId] then |
| 268 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) | 269 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
| 269 | end | 270 | end |
| @@ -286,6 +287,36 @@ function _M.get(role, pms) | @@ -286,6 +287,36 @@ function _M.get(role, pms) | ||
| 286 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) | 287 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
| 287 | end | 288 | end |
| 288 | end | 289 | end |
| 290 | + elseif pms.pm1 == "MAXHERO" then | ||
| 291 | + -- 给英雄 | ||
| 292 | + for itemId = 400 , 700 do | ||
| 293 | + if csvdb["itemCsv"][itemId] then | ||
| 294 | + role:award({[itemId] = 1}, {log = {desc = "gm"}}) | ||
| 295 | + end | ||
| 296 | + end | ||
| 297 | + -- 升满级 | ||
| 298 | + for _, hero in ipairs(role.heros) do | ||
| 299 | + hero:updateProperty({field = "level", value = 140}) | ||
| 300 | + hero:updateProperty({field = "wakeL", value = #csvdb["unit_wakeCsv"]}) | ||
| 301 | + end | ||
| 302 | + | ||
| 303 | + -- 添加铭文 | ||
| 304 | + for itemId = 10000 , 20000 do | ||
| 305 | + if csvdb["itemCsv"][itemId] then | ||
| 306 | + role:award({[itemId] = 1}, {log = {desc = "gm"}}) | ||
| 307 | + end | ||
| 308 | + end | ||
| 309 | + for _, rune in ipairs(role.runeBag) do | ||
| 310 | + local typ = rune:getProperty("type") | ||
| 311 | + local id = rune:getProperty("id") | ||
| 312 | + | ||
| 313 | + local runeSet = csvdb["runeCsv"][typ] | ||
| 314 | + if not runeSet then break end | ||
| 315 | + local runeData = runeSet[id] | ||
| 316 | + if not runeData then break end | ||
| 317 | + | ||
| 318 | + rune:updateProperty({field = "level",value = runeData.lvLimit}) | ||
| 319 | + end | ||
| 289 | else | 320 | else |
| 290 | local itemId = tonum(pms.pm1) | 321 | local itemId = tonum(pms.pm1) |
| 291 | if not csvdb["itemCsv"][itemId] then | 322 | if not csvdb["itemCsv"][itemId] then |
| @@ -534,11 +565,23 @@ end | @@ -534,11 +565,23 @@ end | ||
| 534 | 565 | ||
| 535 | function _M.test(role, pms) | 566 | function _M.test(role, pms) |
| 536 | local id = tonum(pms.pm1, 0) | 567 | local id = tonum(pms.pm1, 0) |
| 568 | + local actid = nil | ||
| 569 | + if id > 100 then | ||
| 570 | + actid = tonum(pms.pm2, 0) | ||
| 571 | + end | ||
| 537 | --local hero = require ("actions.HeroAction") | 572 | --local hero = require ("actions.HeroAction") |
| 538 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 573 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
| 539 | 574 | ||
| 540 | --role:sendMail(13, nil, "1=2", {111}) | 575 | --role:sendMail(13, nil, "1=2", {111}) |
| 541 | - dump(redisproxy:zrevrange("rank:tower", 0 , 10, "WITHSCORES")) | 576 | + local file = io.open("draw_hero_"..id..".csv", "a") |
| 577 | + for i=1, 10000 do | ||
| 578 | + local heroIds = _M.drawHero(role, id, actid) | ||
| 579 | + for k, v in ipairs(heroIds) do | ||
| 580 | + print((i - 1)* 10 + k, v) | ||
| 581 | + file:write(v.."\n") | ||
| 582 | + end | ||
| 583 | + end | ||
| 584 | + io.close(file) | ||
| 542 | return "成功" | 585 | return "成功" |
| 543 | end | 586 | end |
| 544 | 587 | ||
| @@ -547,6 +590,12 @@ function _M.ayncPurchase(role, params) | @@ -547,6 +590,12 @@ function _M.ayncPurchase(role, params) | ||
| 547 | return role:handlePurchase(params) or "" | 590 | return role:handlePurchase(params) or "" |
| 548 | end | 591 | end |
| 549 | 592 | ||
| 593 | +-- 获取订单号 | ||
| 594 | +function _M.getPurchaseOrder(role, params) | ||
| 595 | + return role:getPurchaseOrderByPlatform(params) or "" | ||
| 596 | +end | ||
| 597 | + | ||
| 598 | + | ||
| 550 | function _M.cz(role, pms) | 599 | function _M.cz(role, pms) |
| 551 | local id = tonum(pms.pm1) | 600 | local id = tonum(pms.pm1) |
| 552 | local csvData = csvdb["shop_rechargeCsv"][id] | 601 | local csvData = csvdb["shop_rechargeCsv"][id] |
| @@ -563,5 +612,259 @@ function _M.cz(role, pms) | @@ -563,5 +612,259 @@ function _M.cz(role, pms) | ||
| 563 | return "指令成功" | 612 | return "指令成功" |
| 564 | end | 613 | end |
| 565 | 614 | ||
| 615 | +function _M.drawHero(role, t, act) | ||
| 616 | + local btype = t -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池 | ||
| 617 | + local subType = 1-- 定向卡池需要传 子类型 | ||
| 618 | + local drawType = 2 -- 1 单抽 2 十连 | ||
| 619 | + if btype ~= 1 then | ||
| 620 | + subType = 1 | ||
| 621 | + end | ||
| 622 | + | ||
| 623 | + local actid = act | ||
| 624 | + -- 另开活动卡池 | ||
| 625 | + if actid then | ||
| 626 | + --if not role.activity:isOpenById(actid, "ActHeroPool") then return end | ||
| 627 | + local cfg = csvdb["activity_ctrlCsv"][actid] | ||
| 628 | + if not cfg then return end | ||
| 629 | + | ||
| 630 | + btype = cfg.condition | ||
| 631 | + end | ||
| 632 | + | ||
| 633 | + local buildTypeData = csvdb["build_typeCsv"][btype] | ||
| 634 | + if not buildTypeData then return 2 end | ||
| 635 | + | ||
| 636 | + local drawCount = {1, 10} -- 抽取次数 | ||
| 637 | + if not drawCount[drawType] then return 3 end | ||
| 638 | + | ||
| 639 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | ||
| 640 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | ||
| 641 | + | ||
| 642 | + -- 抽取的池子 | ||
| 643 | + local poolMap = buildTypeData["pool"]:toNumMap() | ||
| 644 | + local poolId = poolMap[subType] | ||
| 645 | + if not poolId then return 5 end | ||
| 646 | + | ||
| 647 | + --TODO 活动覆盖 | ||
| 648 | + local actPoolId = role.activity:getActivityPool(btype, subType) | ||
| 649 | + if actPoolId ~= 0 then | ||
| 650 | + poolId = actPoolId | ||
| 651 | + end | ||
| 652 | + | ||
| 653 | + local unitPool = csvdb["build_unitCsv"][poolId] | ||
| 654 | + if not unitPool then return 7 end | ||
| 655 | + | ||
| 656 | + -- 开始抽 | ||
| 657 | + local resultPool = {} | ||
| 658 | + local function fillDrawPool(isFloorBack) | ||
| 659 | + local condition = {"rare"} | ||
| 660 | + local values = {} | ||
| 661 | + | ||
| 662 | + | ||
| 663 | + for idx, field in ipairs(condition) do | ||
| 664 | + if not values[idx] then | ||
| 665 | + local lpool = {} | ||
| 666 | + local curIdx = 1 | ||
| 667 | + while unitPool[field .. "_" .. curIdx] do | ||
| 668 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
| 669 | + curIdx = curIdx + 1 | ||
| 670 | + end | ||
| 671 | + | ||
| 672 | + if next(lpool) then | ||
| 673 | + values[idx] = math.randWeight(lpool, 1) | ||
| 674 | + end | ||
| 675 | + end | ||
| 676 | + end | ||
| 677 | + | ||
| 678 | + local weight = 0 | ||
| 679 | + local up_pool = nil | ||
| 680 | + local rand_v = math.randomInt(1, 100) | ||
| 681 | + if values[1] == HeroQuality.SR then | ||
| 682 | + weight = unitPool["up_sr_weight"] | ||
| 683 | + up_pool = unitPool["up_sr_id"] | ||
| 684 | + elseif values[1] == HeroQuality.SSR then | ||
| 685 | + weight = unitPool["up_ssr_weight"] | ||
| 686 | + up_pool = unitPool["up_ssr_id"] | ||
| 687 | + end | ||
| 688 | + --print(poolId, rand_v, weight, up_pool, values[1]) | ||
| 689 | + if rand_v < weight and up_pool then | ||
| 690 | + up_pool = up_pool:toArray(true, "=") | ||
| 691 | + if btype == 5 then -- 爱心卡池,使用玩家设置的备选池子 | ||
| 692 | + up_pool = role:getProperty("wishPool") | ||
| 693 | + up_pool[1] = 606 | ||
| 694 | + up_pool[2] = 607 | ||
| 695 | + up_pool[3] = 608 | ||
| 696 | + end | ||
| 697 | + for k, v in ipairs(up_pool) do | ||
| 698 | + resultPool[v] = {1} | ||
| 699 | + end | ||
| 700 | + else | ||
| 701 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | ||
| 702 | + local pool_str = "pool_" .. poolId | ||
| 703 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | ||
| 704 | + local itemData = csvdb["itemCsv"][itemId] | ||
| 705 | + while itemData do | ||
| 706 | + if itemData.type ~= ItemType.Hero then break end | ||
| 707 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
| 708 | + if not heroData then break end | ||
| 709 | + local ok = true | ||
| 710 | + -- 保底是全随机,不用比较类型 | ||
| 711 | + if not isFloorBack then | ||
| 712 | + for idx, field in ipairs(condition) do | ||
| 713 | + if heroData[field] ~= values[idx] then ok = false break end | ||
| 714 | + end | ||
| 715 | + end | ||
| 716 | + if not ok then break end | ||
| 717 | + if oneData[pool_str] > 0 then | ||
| 718 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ||
| 719 | + end | ||
| 720 | + break | ||
| 721 | + end | ||
| 722 | + end | ||
| 723 | + end | ||
| 724 | + end | ||
| 725 | + end | ||
| 726 | + | ||
| 727 | + local guideHero = nil | ||
| 728 | + if role:getProperty("newerGuide") == "8=1" then | ||
| 729 | + guideHero = globalCsv.newdraw_hero_item_id or 503 | ||
| 730 | + end | ||
| 731 | + | ||
| 732 | + local ssrCount = 0 | ||
| 733 | + local reward = {} | ||
| 734 | + local logReward = {} | ||
| 735 | + local result = {} | ||
| 736 | + for i = 1, drawCount[drawType] do | ||
| 737 | + floorHeroCount = floorHeroCount + 1 | ||
| 738 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | ||
| 739 | + resultPool = {} | ||
| 740 | + fillDrawPool(isFloorBack) | ||
| 741 | + if not next(resultPool) then | ||
| 742 | + skynet.error("random pool error, poolId:" .. poolId, isFloorBack) | ||
| 743 | + return 8 | ||
| 744 | + end | ||
| 745 | + | ||
| 746 | + local itemId = math.randWeight(resultPool, 1) | ||
| 747 | + if guideHero then | ||
| 748 | + itemId = guideHero | ||
| 749 | + end | ||
| 750 | + | ||
| 751 | + local itemData = csvdb["itemCsv"][itemId] | ||
| 752 | + if itemData.quality == HeroQuality.SSR then | ||
| 753 | + ssrCount = ssrCount + 1 | ||
| 754 | + if not guideHero then | ||
| 755 | + -- 广播获得ssr英雄 | ||
| 756 | + local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} | ||
| 757 | + --mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) | ||
| 758 | + end | ||
| 759 | + end | ||
| 760 | + | ||
| 761 | + if btype == 4 and role:getProperty("newerDraw") == 0 then -- 新手卡池 | ||
| 762 | + if itemData.quality == HeroQuality.SSR then | ||
| 763 | + floorHeroCount = 0 | ||
| 764 | + end | ||
| 765 | + else | ||
| 766 | + if itemData.quality >= HeroQuality.SR then | ||
| 767 | + floorHeroCount = 0 | ||
| 768 | + end | ||
| 769 | + end | ||
| 770 | + | ||
| 771 | + if role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
| 772 | + local fragId = itemData.id - ItemStartId.Hero | ||
| 773 | + local heroData = csvdb["unitCsv"][fragId] | ||
| 774 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
| 775 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
| 776 | + logReward[fragId] = (logReward[fragId] or 0) + count | ||
| 777 | + table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | ||
| 778 | + else | ||
| 779 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
| 780 | + logReward[itemId] = (logReward[itemId] or 0) + 1 | ||
| 781 | + table.insert(reward, {id = itemId, count = 1}) | ||
| 782 | + end | ||
| 783 | + end | ||
| 784 | + | ||
| 785 | + if draw_floor_back_counts then | ||
| 786 | + local floorHero = role:getProperty("floorHero") | ||
| 787 | + floorHero[btype] = floorHeroCount | ||
| 788 | + role:setProperty("floorHero", floorHero) | ||
| 789 | + end | ||
| 790 | + | ||
| 791 | + if btype == 4 then | ||
| 792 | + local newCount = role:getProperty("newerDraw") | ||
| 793 | + role:updateProperty({field="newerDraw", value = newCount + drawCount[drawType]}) | ||
| 794 | + end | ||
| 795 | + | ||
| 796 | + --SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | ||
| 797 | + for k, v in pairs(reward) do | ||
| 798 | + local hero = v | ||
| 799 | + if hero["from"] then | ||
| 800 | + result[#result+1] = hero["from"] | ||
| 801 | + else | ||
| 802 | + result[#result+1] = hero["id"] | ||
| 803 | + end | ||
| 804 | + end | ||
| 805 | + | ||
| 806 | + local feedbackId = buildTypeData["can_feedback"] or 0 | ||
| 807 | + if feedbackId ~= 0 then | ||
| 808 | + -- 达到一定次数,给响应奖励 | ||
| 809 | + local oldVal = role:getProperty("repayHero") or 0 | ||
| 810 | + if actid then | ||
| 811 | + local actData = role.activity:getActData("ActHeroPool") | ||
| 812 | + oldVal = actData[btype] or 0 | ||
| 813 | + end | ||
| 814 | + local newVal = oldVal + drawCount[drawType] | ||
| 815 | + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | ||
| 816 | + -- 空字符穿代表直接给英雄 走以前repayHeroRpc | ||
| 817 | + if drawCardReward == "" then | ||
| 818 | + local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 | ||
| 819 | + repayHeroMaxCount = repayHeroMaxCount + 1 | ||
| 820 | + | ||
| 821 | + role:updateProperty({field = "repayMaxC", value = repayHeroMaxCount}) | ||
| 822 | + local even = repayHeroMaxCount % 2 | ||
| 823 | + local id = 0 | ||
| 824 | + if even == 1 then | ||
| 825 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
| 826 | + else | ||
| 827 | + local giftHeroSet = {} | ||
| 828 | + for gid, cfg in pairs(csvdb["build_giftCsv"]) do | ||
| 829 | + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | ||
| 830 | + giftHeroSet[gid] = {1} | ||
| 831 | + end | ||
| 832 | + end | ||
| 833 | + if next(giftHeroSet) then | ||
| 834 | + id = math.randWeight(giftHeroSet, 1) | ||
| 835 | + end | ||
| 836 | + end | ||
| 837 | + if id == 0 then | ||
| 838 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
| 839 | + end | ||
| 840 | + | ||
| 841 | + local r,change = {} | ||
| 842 | + local itemData = csvdb["itemCsv"][id] | ||
| 843 | + --if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
| 844 | + -- local fragId = itemData.id - ItemStartId.Hero | ||
| 845 | + -- local heroData = csvdb["unitCsv"][fragId] | ||
| 846 | + -- local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
| 847 | + -- r, change = role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 848 | + -- --r = {id = fragId, count = count, from = id, fcount = 1} | ||
| 849 | + --else | ||
| 850 | + r, change = role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 851 | + --end | ||
| 852 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
| 853 | + elseif drawCardReward and drawCardReward ~= "" then | ||
| 854 | + local r,change = {} | ||
| 855 | + r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
| 856 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
| 857 | + end | ||
| 858 | + if not actid then | ||
| 859 | + role:updateProperty({field = "repayHero", value = val}) | ||
| 860 | + else | ||
| 861 | + local actData = role.activity:getActData("ActHeroPool") | ||
| 862 | + actData[btype] = val | ||
| 863 | + role.activity:updateActData("ActHeroPool", actData) | ||
| 864 | + end | ||
| 865 | + end | ||
| 866 | + return result | ||
| 867 | +end | ||
| 868 | + | ||
| 566 | 869 | ||
| 567 | return _M | 870 | return _M |
| 568 | \ No newline at end of file | 871 | \ 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/HttpAction.lua
| @@ -147,6 +147,15 @@ function _M.gm_action(query) | @@ -147,6 +147,15 @@ function _M.gm_action(query) | ||
| 147 | return status | 147 | return status |
| 148 | end | 148 | end |
| 149 | 149 | ||
| 150 | +function _M.query_role(query) | ||
| 151 | + if not query.uid then return "not found" end | ||
| 152 | + local user = redisproxy:get(string.format("uid:%s", query.uid)) | ||
| 153 | + if not user then return "not found" end | ||
| 154 | + local roleId = redisproxy:get(string_format("user:%s", string.upper(user))) | ||
| 155 | + if not roleId then return "not found" end | ||
| 156 | + return json.encode({roleId, user}) | ||
| 157 | +end | ||
| 158 | + | ||
| 150 | function _M.broadcast(query) | 159 | function _M.broadcast(query) |
| 151 | local msg = {} | 160 | local msg = {} |
| 152 | local handle = { | 161 | local handle = { |
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
| @@ -848,6 +848,11 @@ function _M.taskRpc(agent, data) | @@ -848,6 +848,11 @@ function _M.taskRpc(agent, data) | ||
| 848 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) | 848 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) |
| 849 | local active = (taskStatus["a"] or 0) + taskData.active | 849 | local active = (taskStatus["a"] or 0) + taskData.active |
| 850 | 850 | ||
| 851 | + -- 日常活动完成 | ||
| 852 | + if taskType == 1 then | ||
| 853 | + role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) | ||
| 854 | + end | ||
| 855 | + | ||
| 851 | role:changeUpdates({ | 856 | role:changeUpdates({ |
| 852 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, | 857 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, |
| 853 | { type = roleField[taskType], field = "a", value = active}, | 858 | { type = roleField[taskType], field = "a", value = active}, |
src/adv/Adv.lua
| @@ -141,6 +141,11 @@ function Adv:initByChapter(params) | @@ -141,6 +141,11 @@ function Adv:initByChapter(params) | ||
| 141 | isNewRelay = true | 141 | isNewRelay = true |
| 142 | end | 142 | end |
| 143 | end | 143 | end |
| 144 | + | ||
| 145 | + if self.level == 1 or self.isRelay then | ||
| 146 | + self:supplyPotion() | ||
| 147 | + end | ||
| 148 | + | ||
| 144 | self.maps = {} | 149 | self.maps = {} |
| 145 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) | 150 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
| 146 | 151 | ||
| @@ -402,9 +407,16 @@ function Adv:forceOver(notNotify, force) | @@ -402,9 +407,16 @@ function Adv:forceOver(notNotify, force) | ||
| 402 | local advTeam = self.owner:getProperty("advTeam") | 407 | local advTeam = self.owner:getProperty("advTeam") |
| 403 | advTeam.player = nil | 408 | advTeam.player = nil |
| 404 | 409 | ||
| 410 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
| 411 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 412 | + | ||
| 405 | local reward = self.owner:getProperty("advItems"):toNumMap() | 413 | local reward = self.owner:getProperty("advItems"):toNumMap() |
| 406 | for itemId, count in pairs(reward) do | 414 | for itemId, count in pairs(reward) do |
| 407 | - reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | 415 | + if advPotionCsv[itemId] then |
| 416 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 417 | + else | ||
| 418 | + reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | ||
| 419 | + end | ||
| 408 | end | 420 | end |
| 409 | self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) | 421 | self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) |
| 410 | 422 | ||
| @@ -415,6 +427,7 @@ function Adv:forceOver(notNotify, force) | @@ -415,6 +427,7 @@ function Adv:forceOver(notNotify, force) | ||
| 415 | advItems = "", | 427 | advItems = "", |
| 416 | advAFGet = {}, | 428 | advAFGet = {}, |
| 417 | advAFWear = {}, | 429 | advAFWear = {}, |
| 430 | + potionBag = potionBag, | ||
| 418 | }, notNotify) | 431 | }, notNotify) |
| 419 | end | 432 | end |
| 420 | end | 433 | end |
| @@ -795,12 +808,18 @@ function Adv:over(success, rewardRatio, overType) | @@ -795,12 +808,18 @@ function Adv:over(success, rewardRatio, overType) | ||
| 795 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | 808 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) |
| 796 | 809 | ||
| 797 | local reward = {} | 810 | local reward = {} |
| 811 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
| 812 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 798 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do | 813 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
| 799 | local itemCsv = csvdb["itemCsv"][itemId] | 814 | local itemCsv = csvdb["itemCsv"][itemId] |
| 800 | if not itemCsv then | 815 | if not itemCsv then |
| 801 | print("ERROR: no itemId in ItemCsv : ", itemId) | 816 | print("ERROR: no itemId in ItemCsv : ", itemId) |
| 802 | elseif itemCsv.type ~= ItemType.AdvItem then | 817 | elseif itemCsv.type ~= ItemType.AdvItem then |
| 803 | - reward[itemId] = math.ceil(count * rewardRatio / 100) | 818 | + if advPotionCsv[itemId] then |
| 819 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 820 | + else | ||
| 821 | + reward[itemId] = math.ceil(count * rewardRatio / 100) | ||
| 822 | + end | ||
| 804 | end | 823 | end |
| 805 | end | 824 | end |
| 806 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 825 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
| @@ -896,6 +915,7 @@ function Adv:over(success, rewardRatio, overType) | @@ -896,6 +915,7 @@ function Adv:over(success, rewardRatio, overType) | ||
| 896 | advItems = "", | 915 | advItems = "", |
| 897 | advAFGet = {}, | 916 | advAFGet = {}, |
| 898 | advAFWear = {}, | 917 | advAFWear = {}, |
| 918 | + potionBag = potionBag, | ||
| 899 | }) | 919 | }) |
| 900 | self:pushBackEvent(AdvBackEventType.End, { | 920 | self:pushBackEvent(AdvBackEventType.End, { |
| 901 | success = success, | 921 | success = success, |
| @@ -980,7 +1000,8 @@ function Adv:award(gift, params, backRewardParams) | @@ -980,7 +1000,8 @@ function Adv:award(gift, params, backRewardParams) | ||
| 980 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then | 1000 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then |
| 981 | autoUse[itemId] = count | 1001 | autoUse[itemId] = count |
| 982 | else | 1002 | else |
| 983 | - local origin = items:getv(itemId, 0) | 1003 | + local transId = globalCsv.adv_item_potion[itemId] or itemId |
| 1004 | + local origin = items:getv(transId, 0) | ||
| 984 | local nums = origin + count | 1005 | local nums = origin + count |
| 985 | 1006 | ||
| 986 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | 1007 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 |
| @@ -990,10 +1011,10 @@ function Adv:award(gift, params, backRewardParams) | @@ -990,10 +1011,10 @@ function Adv:award(gift, params, backRewardParams) | ||
| 990 | end | 1011 | end |
| 991 | else | 1012 | else |
| 992 | if nums <= 0 then | 1013 | if nums <= 0 then |
| 993 | - items = items:delk(itemId) | 1014 | + items = items:delk(transId) |
| 994 | nums = 0 | 1015 | nums = 0 |
| 995 | else | 1016 | else |
| 996 | - items = items:setv(itemId, nums) | 1017 | + items = items:setv(transId, nums) |
| 997 | end | 1018 | end |
| 998 | 1019 | ||
| 999 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then | 1020 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
| @@ -1071,6 +1092,7 @@ end | @@ -1071,6 +1092,7 @@ end | ||
| 1071 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 | 1092 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 |
| 1072 | function Adv:cost(item, params, check) | 1093 | function Adv:cost(item, params, check) |
| 1073 | local items = self.owner:getProperty("advItems") | 1094 | local items = self.owner:getProperty("advItems") |
| 1095 | + local potionCsv = csvdb["adv_potionCsv"] | ||
| 1074 | local less = {} | 1096 | local less = {} |
| 1075 | local advCost = {} | 1097 | local advCost = {} |
| 1076 | for itemId, count in pairs(item) do | 1098 | for itemId, count in pairs(item) do |
| @@ -1084,9 +1106,13 @@ function Adv:cost(item, params, check) | @@ -1084,9 +1106,13 @@ function Adv:cost(item, params, check) | ||
| 1084 | less[itemId] = -last | 1106 | less[itemId] = -last |
| 1085 | end | 1107 | end |
| 1086 | 1108 | ||
| 1109 | + if potionCsv[itemId] and last < 0 then -- 只能使用冒险背包里的药水 | ||
| 1110 | + return | ||
| 1111 | + end | ||
| 1087 | end | 1112 | end |
| 1088 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 | 1113 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 |
| 1089 | if check then return true end | 1114 | if check then return true end |
| 1115 | + | ||
| 1090 | self:award(advCost, params) | 1116 | self:award(advCost, params) |
| 1091 | if next(less) then | 1117 | if next(less) then |
| 1092 | self.owner:costItems(less, params) | 1118 | self.owner:costItems(less, params) |
| @@ -1094,6 +1120,25 @@ function Adv:cost(item, params, check) | @@ -1094,6 +1120,25 @@ function Adv:cost(item, params, check) | ||
| 1094 | return true | 1120 | return true |
| 1095 | end | 1121 | end |
| 1096 | 1122 | ||
| 1123 | +-- 补满冒险背包药剂,从药剂背包扣除药水放到冒险背包 | ||
| 1124 | +function Adv:supplyPotion() | ||
| 1125 | + local potionCsv = csvdb["adv_potionCsv"] | ||
| 1126 | + local potionBag = self.owner:getProperty("potionBag") | ||
| 1127 | + local advItems = self.owner:getProperty("advItems") | ||
| 1128 | + for potionId, set in pairs(potionCsv) do | ||
| 1129 | + local count = potionBag[potionId] or 0 | ||
| 1130 | + if count > 0 then | ||
| 1131 | + local num = math.min(set[1].limit,count) | ||
| 1132 | + advItems = advItems:setv(potionId,num) | ||
| 1133 | + potionBag[potionId] = num ~= count and (count - num) or nil | ||
| 1134 | + end | ||
| 1135 | + end | ||
| 1136 | + self.owner:updateProperties({ | ||
| 1137 | + advItems = advItems, | ||
| 1138 | + potionBag = potionBag, | ||
| 1139 | + }) | ||
| 1140 | +end | ||
| 1141 | + | ||
| 1097 | --事件点击处理 | 1142 | --事件点击处理 |
| 1098 | local function clickOut(self, room, block, params, isExit) | 1143 | local function clickOut(self, room, block, params, isExit) |
| 1099 | if self:getCurMap():checkOver() then --检查是否可以出去了 | 1144 | if self:getCurMap():checkOver() then --检查是否可以出去了 |
| @@ -2150,6 +2195,7 @@ function Adv:enemyDead(enemy, escape) | @@ -2150,6 +2195,7 @@ function Adv:enemyDead(enemy, escape) | ||
| 2150 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) | 2195 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) |
| 2151 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) | 2196 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) |
| 2152 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) | 2197 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) |
| 2198 | + self.owner:checkTaskEnter("AdvKillBoss") | ||
| 2153 | elseif monsterData.type == 3 then | 2199 | elseif monsterData.type == 3 then |
| 2154 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) | 2200 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) |
| 2155 | end | 2201 | 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) |
| @@ -1588,7 +1622,6 @@ function RolePlugin.bind(Role) | @@ -1588,7 +1622,6 @@ function RolePlugin.bind(Role) | ||
| 1588 | if table.pack(next(newReward))[2] >= divisionData.limit then | 1622 | if table.pack(next(newReward))[2] >= divisionData.limit then |
| 1589 | return true | 1623 | return true |
| 1590 | end | 1624 | end |
| 1591 | - | ||
| 1592 | end | 1625 | end |
| 1593 | 1626 | ||
| 1594 | local events = {} | 1627 | local events = {} |
| @@ -1641,8 +1674,34 @@ function RolePlugin.bind(Role) | @@ -1641,8 +1674,34 @@ function RolePlugin.bind(Role) | ||
| 1641 | self:updateProperty({field = "redp", value = redp}) | 1674 | self:updateProperty({field = "redp", value = redp}) |
| 1642 | end | 1675 | end |
| 1643 | 1676 | ||
| 1677 | + -- 网页支付获取订单号 | ||
| 1678 | + function Role:getPurchaseOrderByPlatform(params) | ||
| 1679 | + local checkPlatform = { | ||
| 1680 | + ["mycard"] = "mycard_product_id", | ||
| 1681 | + } | ||
| 1682 | + local pidField = checkPlatform[params.payMode or ""] | ||
| 1683 | + if not pidField or not params.product_id or params.product_id == "" then | ||
| 1684 | + return "no product" | ||
| 1685 | + end | ||
| 1686 | + | ||
| 1687 | + for k , v in pairs(csvdb["shop_rechargeCsv"]) do | ||
| 1688 | + if not v[pidField] then return "no product" end | ||
| 1689 | + if v[pidField] == params.product_id then | ||
| 1690 | + if v.rmb ~= params.money then | ||
| 1691 | + return "error money" | ||
| 1692 | + end | ||
| 1693 | + -- 发现需要的id | ||
| 1694 | + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId) | ||
| 1695 | + if partnerOrderId == "" then | ||
| 1696 | + return "no product" | ||
| 1697 | + end | ||
| 1698 | + return json.encode({order = partnerOrderId}) | ||
| 1699 | + end | ||
| 1700 | + end | ||
| 1701 | + end | ||
| 1702 | + | ||
| 1644 | -- 获取充值订单号 | 1703 | -- 获取充值订单号 |
| 1645 | - function Role:getPurchaseOrder(rechargeId) | 1704 | + function Role:getPurchaseOrder(rechargeId, transactionId) |
| 1646 | local roleId = self:getProperty("id") | 1705 | local roleId = self:getProperty("id") |
| 1647 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | 1706 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
| 1648 | if not rechargeData then | 1707 | if not rechargeData then |
| @@ -1679,6 +1738,7 @@ function RolePlugin.bind(Role) | @@ -1679,6 +1738,7 @@ function RolePlugin.bind(Role) | ||
| 1679 | order = partnerOrderId, | 1738 | order = partnerOrderId, |
| 1680 | rechargeId = rechargeId, | 1739 | rechargeId = rechargeId, |
| 1681 | createTime = skynet.timex(), | 1740 | createTime = skynet.timex(), |
| 1741 | + transactionId = transactionId, | ||
| 1682 | }) | 1742 | }) |
| 1683 | order:create() | 1743 | order:create() |
| 1684 | -- 正在进行中的订单 缓存 | 1744 | -- 正在进行中的订单 缓存 |
| @@ -1757,6 +1817,7 @@ function RolePlugin.bind(Role) | @@ -1757,6 +1817,7 @@ function RolePlugin.bind(Role) | ||
| 1757 | request.product_id = data.product_id | 1817 | request.product_id = data.product_id |
| 1758 | request.pay_time = data.pay_time | 1818 | request.pay_time = data.pay_time |
| 1759 | request.transactionId = data.order_no | 1819 | request.transactionId = data.order_no |
| 1820 | + request.extension_info = data.extension_info | ||
| 1760 | ]] | 1821 | ]] |
| 1761 | function Role:handlePurchase(params) | 1822 | function Role:handlePurchase(params) |
| 1762 | local roleId = self:getProperty("id") | 1823 | local roleId = self:getProperty("id") |
| @@ -1787,6 +1848,10 @@ function RolePlugin.bind(Role) | @@ -1787,6 +1848,10 @@ function RolePlugin.bind(Role) | ||
| 1787 | }) | 1848 | }) |
| 1788 | 1849 | ||
| 1789 | if not status then | 1850 | if not status then |
| 1851 | + if params.extension_info == "mycard_web" then | ||
| 1852 | + -- todo 发邮件 | ||
| 1853 | + skynet.error("mycard_web " .. params.order) | ||
| 1854 | + end | ||
| 1790 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, | 1855 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, |
| 1791 | result = "success", reward = reward})) | 1856 | result = "success", reward = reward})) |
| 1792 | end | 1857 | end |
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 |