Commit ea0995c2388d835532d50ee664c22f96fdfd3264
Merge branch 'tr/bugfix' into tr/publish/player
* tr/bugfix: (76 commits) 美食币计算错误 开启x品质时钟箱任务计数错误bug 活动结束回收邮件 进入中继层补给药剂,补足到上限,扣除错误 宝藏怪 清空背包gm 修复拾荒结算时,返还药剂错误导致药水被吞的bug 进入拾荒自动补给药水,按当前等级下的携带最大数量计算 获得所有SSR 且满级 满觉醒 同时获得全部满级金色铭文 满精进 充值mycard 拾荒bug pvp 匹配 和 失败扣减积分 无论什么方式翻开中继层格子都给奖励 跨天礼包重置 月重置 跨月 拾荒 失败也记录积分 编队 世界聊天等级15判断 活动卡池结束回馈次数通关邮件折算碎片 功能注释 ...
Showing
35 changed files
with
1423 additions
and
263 deletions
Show diff stats
src/GlobalVar.lua
... | ... | @@ -16,6 +16,7 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", |
16 | 16 | |
17 | 17 | START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 |
18 | 18 | |
19 | +STRUCT_VERSION = 3 -- 数据结构版本 | |
19 | 20 | |
20 | 21 | MAX_ROLE_NUM = 1000000 |
21 | 22 | -- 属性枚举 |
... | ... | @@ -72,7 +73,7 @@ ItemType = { |
72 | 73 | EquipBase = 9, -- 基础装备 |
73 | 74 | Rune = 10, -- 符文 |
74 | 75 | Cuisine = 11, -- 料理(用于增加好感度、贩卖获得金币) |
75 | - LunchBox = 12, -- 便当盒(料理合成,冒险系统消耗道具) | |
76 | + Potion = 12, -- 拾荒药剂 | |
76 | 77 | TimeBox = 13, -- 时间箱(开启需要时间,随机产出道具) |
77 | 78 | AdvItem = 14, -- 冒险道具 |
78 | 79 | FuncOpen = 15, -- 管理功能开放 |
... | ... | @@ -141,7 +142,6 @@ ItemId = { |
141 | 142 | TimeReset = { |
142 | 143 | CrossDay = 1, --通用跨天 |
143 | 144 | CrossWeek = 2, --通用跨周 |
144 | - CrossMonth = 1, --通用跨月 索引使用跨天,在回调方法中判断是否跨越 跨月的前置条件是跨天 | |
145 | 145 | DinerRank = 1, -- 餐厅排行榜 |
146 | 146 | PvpRank = 2, -- pvp排行榜 |
147 | 147 | PvpHight = 11, --高级竞技场 |
... | ... | @@ -324,6 +324,7 @@ MailId = { |
324 | 324 | PayBackAward = 242, |
325 | 325 | CBBackAward = 243, |
326 | 326 | CBBackAward2 = 244, |
327 | + ActivityPoolRet = 280, | |
327 | 328 | } |
328 | 329 | |
329 | 330 | TriggerEventType = { | ... | ... |
src/ProtocolCode.lua
... | ... | @@ -229,6 +229,8 @@ actionCodes = { |
229 | 229 | Activity_battleMilestoneRpc = 663, |
230 | 230 | Activity_bossRewardRpc = 664, |
231 | 231 | Activity_crisisMilestoneRpc = 665, |
232 | + Activity_commonSignRpc = 666, | |
233 | + Activity_friendHelpRpc = 667, | |
232 | 234 | |
233 | 235 | Radio_startQuestRpc = 700, |
234 | 236 | Radio_finishQuestRpc = 701, | ... | ... |
src/RedisKeys.lua
... | ... | @@ -47,6 +47,7 @@ FRIEND_KEY = "role:%d:friend" --哈希表 好友 |
47 | 47 | FRIEND_APPLY_KEY = "role:%d:apply" -- sort set 申请列表 |
48 | 48 | FRIEND_BLACK_KEY = "role:%d:black" -- set 黑名单 |
49 | 49 | FRIEND_POINT = "role:%d:point" -- set 当天送给我心的人 |
50 | +FRIEND_ENERGY = "role:%d:energy" -- set 送给我活动能量的好友 | |
50 | 51 | FRIEND_RECOMMEND = "friend:recommend" -- sort set 登录排序 获取推荐好友 |
51 | 52 | CHAT_OFFLINE = "chat:offline:%d" --消息离线缓存 |
52 | 53 | ... | ... |
src/actions/ActivityAction.lua
... | ... | @@ -259,7 +259,10 @@ function _M.actCalendaTaskRpc(agent, data) |
259 | 259 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
260 | 260 | }) |
261 | 261 | |
262 | + role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) | |
263 | + | |
262 | 264 | SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) |
265 | + | |
263 | 266 | return true |
264 | 267 | end |
265 | 268 | |
... | ... | @@ -375,6 +378,8 @@ function _M.hangDropRpc(agent, data) |
375 | 378 | local msg = MsgPack.unpack(data) |
376 | 379 | local actid = msg.actid |
377 | 380 | if not role.activity:isOpenById(actid, "HangDrop") then return 1 end |
381 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | |
382 | + if not actCtrlData then return end | |
378 | 383 | |
379 | 384 | local actCfg = csvdb["activity_putCsv"][actid] |
380 | 385 | if not actCfg then return 2 end |
... | ... | @@ -407,7 +412,7 @@ function _M.hangDropRpc(agent, data) |
407 | 412 | return 4 |
408 | 413 | end |
409 | 414 | local num = math.floor((timeNow - actData)/ period) |
410 | - num = num > 8 and 8 or num | |
415 | + num = num > actCtrlData.condition and actCtrlData.condition or num | |
411 | 416 | if num == 0 then |
412 | 417 | return 5 |
413 | 418 | end |
... | ... | @@ -483,8 +488,16 @@ function _M.startBattleRpc(agent, data) |
483 | 488 | local bi = actData[id] |
484 | 489 | if not bi then return 8 end |
485 | 490 | local star = bi["star"] or 0 |
486 | - if star < 1 then | |
487 | - return 9 | |
491 | + local maxP = bi["maxP"] or 0 | |
492 | + -- 世界boss | |
493 | + if battleCfg.worldBoss_award ~= 0 then | |
494 | + if maxP < 1 then | |
495 | + return 9 | |
496 | + end | |
497 | + else | |
498 | + if star < 1 then | |
499 | + return 9 | |
500 | + end | |
488 | 501 | end |
489 | 502 | num = num * count |
490 | 503 | end |
... | ... | @@ -501,6 +514,7 @@ function _M.startBattleRpc(agent, data) |
501 | 514 | key = tostring(math.random()), |
502 | 515 | actid = actid, |
503 | 516 | id = id, |
517 | + format = msg.format, | |
504 | 518 | } |
505 | 519 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) |
506 | 520 | else |
... | ... | @@ -511,7 +525,7 @@ function _M.startBattleRpc(agent, data) |
511 | 525 | return 7 |
512 | 526 | end |
513 | 527 | local bi = actData[id] |
514 | - local star = bi["star"] | |
528 | + local star = bi["star"] or 0 | |
515 | 529 | local award = battleCfg.item_clear:toNumMap() |
516 | 530 | if getStarCount(battleCfg, star) == 3 then |
517 | 531 | local aw = battleCfg.perfect_reward:toNumMap() |
... | ... | @@ -526,10 +540,10 @@ function _M.startBattleRpc(agent, data) |
526 | 540 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) |
527 | 541 | |
528 | 542 | if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then |
529 | - bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] | |
543 | + bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count | |
530 | 544 | end |
531 | 545 | |
532 | - bi["sum"] = bi["sum"] + bi["top"] | |
546 | + bi["sum"] = bi["sum"] + bi["top"] * count | |
533 | 547 | actData["ticket"] = ticket - num |
534 | 548 | actData[id] = bi |
535 | 549 | changeFlag = true |
... | ... | @@ -558,7 +572,10 @@ function _M.endBattleRpc(agent, data) |
558 | 572 | local isWin = msg.isWin |
559 | 573 | local heros = msg.heros |
560 | 574 | local support = msg.support |
561 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | |
575 | + if not role.activity:isOpenById(actid, "ChallengeLevel") then | |
576 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({})) | |
577 | + return true | |
578 | + end | |
562 | 579 | |
563 | 580 | if not role.__actBattleCache then return 2 end |
564 | 581 | |
... | ... | @@ -566,6 +583,18 @@ function _M.endBattleRpc(agent, data) |
566 | 583 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) |
567 | 584 | end |
568 | 585 | |
586 | + -- 防作弊 | |
587 | + if not role:checkBattleCheat("act_battle", { | |
588 | + id = id, | |
589 | + isWin = isWin, | |
590 | + info = msg.info, | |
591 | + format = role.__actBattleCache.format | |
592 | + }) then | |
593 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) | |
594 | + return true | |
595 | + end | |
596 | + role.__actBattleCache = nil | |
597 | + | |
569 | 598 | local actCfg = csvdb["activity_battleCsv"][actid] |
570 | 599 | if not actCfg then return 3 end |
571 | 600 | |
... | ... | @@ -831,6 +860,7 @@ function _M.bossRewardRpc(agent, data) |
831 | 860 | local awardCfg = actCfg[index] |
832 | 861 | if not awardCfg then return 6 end |
833 | 862 | |
863 | + local totalAwardCnt = #actCfg | |
834 | 864 | local preList = awardCfg.condition1:toArray(true, "=") |
835 | 865 | |
836 | 866 | local actData = role.activity:getActData("ChallengeLevel") or {} |
... | ... | @@ -858,6 +888,16 @@ function _M.bossRewardRpc(agent, data) |
858 | 888 | if not ok then return 8 end |
859 | 889 | |
860 | 890 | battleInfo["bossR"] = string.setbit(bossRecord, index) |
891 | + local allFinish = true | |
892 | + for i = 1, totalAwardCnt do | |
893 | + if string.char(string.getbit(battleInfo["bossR"], i)) == "0" then | |
894 | + allFinish = false | |
895 | + break | |
896 | + end | |
897 | + end | |
898 | + if allFinish then | |
899 | + battleInfo["bossR"] = "" | |
900 | + end | |
861 | 901 | battleInfo["bossP"] = bossPoint - 1 |
862 | 902 | actData[id] = battleInfo |
863 | 903 | role.activity:updateActData("ChallengeLevel", actData) |
... | ... | @@ -868,4 +908,216 @@ function _M.bossRewardRpc(agent, data) |
868 | 908 | return true |
869 | 909 | end |
870 | 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 | + | |
871 | 1123 | return _M |
872 | 1124 | \ No newline at end of file | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) |
57 | 57 | end |
58 | 58 | end |
59 | 59 | |
60 | + -- 多队挂机 电台任务英雄也不能重用 | |
61 | + local radioTask = role:getProperty("radioTask") | |
62 | + for id, taskInfo in pairs(radioTask) do | |
63 | + local heros = taskInfo["heros"] or {} | |
64 | + for _, heroId in ipairs(heros) do | |
65 | + hadHero[heroId] = true | |
66 | + end | |
67 | + end | |
68 | + | |
60 | 69 | if not format.leader then return end |
61 | 70 | if format.leader2 == format.leader then return end |
62 | 71 | local hadLeader = false |
... | ... | @@ -102,6 +111,8 @@ function _M.startAdvRpc( agent, data ) |
102 | 111 | |
103 | 112 | local advPass = role:getProperty("advPass") |
104 | 113 | |
114 | + if not checkFormat(role) then return 7 end | |
115 | + | |
105 | 116 | if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 |
106 | 117 | |
107 | 118 | if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 |
... | ... | @@ -118,37 +129,24 @@ function _M.startAdvRpc( agent, data ) |
118 | 129 | if not relayData then return 14 end -- 不是中继层 |
119 | 130 | if advElM < relayData.unlockfloor then return 15 end --未解锁 |
120 | 131 | end |
132 | + | |
133 | + role.dailyData:updateProperty({field = "advElC", delta = 1}) | |
121 | 134 | else -- 普通模式判断 |
122 | - if not role:checkAdvCount(chapterData.limitlevel) then return 2 end -- 是否有体力 | |
123 | 135 | if layer >= chapterData.limitlevel then return 4 end |
124 | - -- 关卡开放判断 | |
125 | - if not role:advChapterIsOpen(chapterId) then return 5 end | |
126 | 136 | |
137 | + local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) | |
138 | + if not relayData then return 6 end -- 不是中继层 | |
127 | 139 | if layer ~= 1 then |
128 | - local relayData = role:getAdvData():isHaveRelay(layer, chapterId) | |
129 | - if not relayData then return 6 end -- 不是中继层 | |
130 | - if (advPass[chapterId] or 0) < relayData.floor then return 21 end | |
140 | + local advRelay = role:getProperty("advRelay") | |
141 | + if not (advRelay[chapterId] or {})[layer] then return 21 end -- 没有开放 | |
131 | 142 | end |
132 | - end | |
133 | - | |
134 | - if not checkFormat(role) then return 7 end | |
135 | - | |
136 | - --local advTeam = role:getProperty("advTeam") | |
137 | - --table.clear(advTeam) | |
143 | + if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 | |
144 | + -- 关卡开放判断 | |
145 | + if not role:advChapterIsOpen(chapterId) then return 5 end | |
138 | 146 | |
139 | - --advTeam.heros = {} | |
140 | - --for slot, heroId in pairs(format.heros) do | |
141 | - -- advTeam.heros[slot] = heroId | |
142 | - --end | |
143 | - --advTeam.leader = format.leader | |
144 | - --advTeam.leader2 = format.leader2 | |
145 | - --role:updateProperty({field = "advTeam", value = advTeam}) | |
146 | - if AdvCommon.isEndless(chapterId) then | |
147 | - role.dailyData:updateProperty({field = "advElC", delta = 1}) | |
148 | - else | |
149 | - role:changeAdvCount(chapterData.limitlevel) | |
147 | + role:changeAdvCount(relayData.supply) | |
150 | 148 | end |
151 | - | |
149 | + | |
152 | 150 | local support = {} -- 支援效果 |
153 | 151 | if AdvCommon.isEndless(chapterId) then |
154 | 152 | -- 选择的支援效果 |
... | ... | @@ -168,6 +166,7 @@ function _M.startAdvRpc( agent, data ) |
168 | 166 | end |
169 | 167 | end |
170 | 168 | end |
169 | + | |
171 | 170 | role:getAdvData():initByChapter({ |
172 | 171 | chapterId = chapterId, |
173 | 172 | level = layer, |
... | ... | @@ -175,6 +174,7 @@ function _M.startAdvRpc( agent, data ) |
175 | 174 | isEnter = true, |
176 | 175 | support = support, |
177 | 176 | }) |
177 | + | |
178 | 178 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
179 | 179 | role:checkTaskEnter("AdvStartSelf", {id = chapterId}) |
180 | 180 | role:getAdvData():popBackEvents() -- 清一下事件 |
... | ... | @@ -192,7 +192,7 @@ function _M.startHangRpc(agent, data) |
192 | 192 | local format = msg.format --编队 |
193 | 193 | local index = msg.index or 1--时间索引id |
194 | 194 | |
195 | - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
195 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
196 | 196 | if not chapterData then return 1 end |
197 | 197 | local campSiteData = chapterData[campId] |
198 | 198 | if not campSiteData then return 1 end |
... | ... | @@ -214,7 +214,7 @@ function _M.startHangRpc(agent, data) |
214 | 214 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 |
215 | 215 | |
216 | 216 | local advRelay = role:getProperty("advRelay") |
217 | - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 | |
217 | + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放 | |
218 | 218 | |
219 | 219 | |
220 | 220 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
... | ... | @@ -236,7 +236,8 @@ function _M.startHangRpc(agent, data) |
236 | 236 | + 0.226 * player["hit"] |
237 | 237 | + 0.26 * player["miss"] |
238 | 238 | |
239 | - if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | |
239 | + --print(math.ceil(battleV), campSiteData.idleValue) | |
240 | + if math.ceil(battleV) < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | |
240 | 241 | |
241 | 242 | local info = {} |
242 | 243 | info.format = {} |
... | ... | @@ -344,6 +345,7 @@ function _M.endHangRpc(agent, data) |
344 | 345 | adv_idle_time = adv_idle_time * 60 |
345 | 346 | |
346 | 347 | local reward, isFull, change, heroFaithMap |
348 | + local heroCnt = 0 | |
347 | 349 | if skynet.timex() >= info.time then |
348 | 350 | -- 最新需求加成取消 |
349 | 351 | --[[ |
... | ... | @@ -378,6 +380,7 @@ function _M.endHangRpc(agent, data) |
378 | 380 | for _, heroId in pairs(info.format.heros) do |
379 | 381 | local curFaith = addHeroFaith(role, heroId, exp) |
380 | 382 | heroFaithMap[heroId] = curFaith |
383 | + heroCnt = heroCnt + 1 | |
381 | 384 | end |
382 | 385 | |
383 | 386 | local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 |
... | ... | @@ -406,6 +409,7 @@ function _M.endHangRpc(agent, data) |
406 | 409 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) |
407 | 410 | |
408 | 411 | role:checkTaskEnter("AdvHang", {}) |
412 | + role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) | |
409 | 413 | |
410 | 414 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) |
411 | 415 | return true |
... | ... | @@ -543,8 +547,8 @@ function _M.usePotionRpc(agent, data) |
543 | 547 | local msg = MsgPack.unpack(data) |
544 | 548 | local potionId = msg.potionId -- 营养剂Id |
545 | 549 | local target = msg.target -- {roomId = 1, blockId = 1} 选择的目标 |
546 | - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | |
547 | - 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 | |
548 | 552 | |
549 | 553 | local potionSet = csvdb["adv_potionCsv"][potionId] |
550 | 554 | if not potionSet then return 2 end |
... | ... | @@ -552,12 +556,9 @@ function _M.usePotionRpc(agent, data) |
552 | 556 | local potionData = potionSet[potionLv] |
553 | 557 | if not potionData then return 3 end |
554 | 558 | |
555 | - local potionBag = role:getProperty("potionBag") | |
556 | - local own = potionBag[potionId] or 0 | |
557 | - if own <= 0 then return 4 end | |
558 | - | |
559 | 559 | if not isCanContinue(role) then return end |
560 | 560 | local adv = role:getAdvData() |
561 | + if not adv:cost({[potionId] = 1}, {}, true) then return 4 end | |
561 | 562 | if adv:isWaitChooseArtifact() then return end |
562 | 563 | |
563 | 564 | adv:mylog({desc = "usePotion", int1 = potionId}) |
... | ... | @@ -565,8 +566,7 @@ function _M.usePotionRpc(agent, data) |
565 | 566 | local status = adv:doActive(potionData.effect, target) -- target |
566 | 567 | if not status then return end |
567 | 568 | |
568 | - potionBag[potionId] = own - 1 | |
569 | - role:updateProperty({field = "potionBag", value = potionBag}) | |
569 | + adv:cost({[potionId] = 1}, {log = {desc = "usePotion", int1 = potionId}}) | |
570 | 570 | adv:pushBackEvent(AdvBackEventType.Potion, {id = potionId}) |
571 | 571 | adv:afterRound() |
572 | 572 | adv:saveDB() |
... | ... | @@ -737,7 +737,7 @@ function _M.endBattleRpc(agent, data) |
737 | 737 | role:finishGuide(52) |
738 | 738 | -- 调理剂使用引导(生命药剂) |
739 | 739 | if not role:checkOverGuide(61) then |
740 | - local potionBag = role:getProperty("potionBag") | |
740 | + local potionBag = role:getProperty("advItems"):toNumMap() | |
741 | 741 | local own = potionBag[10] or 0 |
742 | 742 | if own > 0 then |
743 | 743 | -- 造假 |
... | ... | @@ -962,6 +962,9 @@ function _M.roleFormatRpc(agent , data) |
962 | 962 | local index = msg.index -- 阵容索引 |
963 | 963 | local title = msg.title -- 阵容名称 |
964 | 964 | local team = {} |
965 | + | |
966 | + if role:getAdvData():isRunning() then return 3 end | |
967 | + | |
965 | 968 | for slot, heroId in pairs(msg.heros) do |
966 | 969 | if not role.heros[heroId] then |
967 | 970 | return 1 |
... | ... | @@ -1004,6 +1007,9 @@ function _M.selectTeamRpc(agent, data) |
1004 | 1007 | local role = agent.role |
1005 | 1008 | local msg = MsgPack.unpack(data) |
1006 | 1009 | local index = msg.index -- 阵容索引 |
1010 | + | |
1011 | + if role:getAdvData():isRunning() then return 1 end | |
1012 | + | |
1007 | 1013 | local team = role:getAdvTeamFormat(index) |
1008 | 1014 | if not next(team) then return end |
1009 | 1015 | team["index"] = index | ... | ... |
src/actions/CarAction.lua
... | ... | @@ -13,7 +13,7 @@ function _M.makePotionRpc( agent, data ) |
13 | 13 | local count = msg.count |
14 | 14 | if count < 1 then return 0 end |
15 | 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 | 17 | if potionLv < 1 then return 1 end |
18 | 18 | |
19 | 19 | local potionSet = csvdb["adv_potionCsv"][potionId] |
... | ... | @@ -22,20 +22,15 @@ function _M.makePotionRpc( agent, data ) |
22 | 22 | local potionData = potionSet[potionLv] |
23 | 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 | 25 | local cost = potionData.material:toNumMap() |
31 | 26 | for k, n in pairs(cost) do |
32 | 27 | cost[k] = n * count |
33 | 28 | end |
34 | 29 | if not role:checkItemEnough(cost) then |
35 | - return 5 | |
30 | + return 4 | |
36 | 31 | end |
37 | - | |
38 | 32 | role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) |
33 | + local own = potionBag[potionId] or 0 | |
39 | 34 | potionBag[potionId] = own + count |
40 | 35 | role:updateProperty({field = "potionBag", value = potionBag}) |
41 | 36 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) |
... | ... | @@ -129,8 +124,8 @@ function _M.runeUpRpc( agent, data ) |
129 | 124 | local runeData = runeSet[id] |
130 | 125 | if not runeData then return 5 end |
131 | 126 | |
132 | - local maxLv = #csvdb["rune_buildCsv"] | |
133 | - if level >= maxLv then return 6 end | |
127 | + --local maxLv = #csvdb["rune_buildCsv"] | |
128 | + if level >= runeData.lvLimit then return 6 end | |
134 | 129 | local lvData = csvdb["rune_buildCsv"][level] |
135 | 130 | local cost = lvData.cost:toNumMap() |
136 | 131 | if not role:checkItemEnough(cost) then | ... | ... |
src/actions/DinerAction.lua
... | ... | @@ -305,7 +305,7 @@ function _M.expediteSellRpc( agent, data ) |
305 | 305 | local gift = reward:toNumMap() |
306 | 306 | |
307 | 307 | -- 特权卡获取加速获得额外道具 |
308 | - local coef = role.storeData:getProduceItemSpeedCoef() | |
308 | + local coef = 1 --role.storeData:getProduceItemSpeedCoef() | |
309 | 309 | for k, v in pairs(gift) do |
310 | 310 | if coef > 1 then |
311 | 311 | v = math.floor(v * coef) |
... | ... | @@ -385,22 +385,12 @@ function _M.talentUpRpc( agent, data ) |
385 | 385 | local msg = MsgPack.unpack(data) |
386 | 386 | local dish = msg.dish |
387 | 387 | local dishTree = role.dinerData:getProperty("dishTree") |
388 | - local dishLevel = dishTree:getv(dish, 0) | |
389 | 388 | |
390 | 389 | local talentSet = csvdb["diner_talentCsv"][dish] |
391 | 390 | if not talentSet then |
392 | 391 | return 1 |
393 | 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 | 394 | local typ = math.floor(dish/100 + 1) |
405 | 395 | local treeSet = csvdb["diner_treeCsv"][typ] |
406 | 396 | if not treeSet then |
... | ... | @@ -412,6 +402,17 @@ function _M.talentUpRpc( agent, data ) |
412 | 402 | return 4 |
413 | 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 | 416 | local limit = talentData.pointFront:toNumMap() |
416 | 417 | for k,v in pairs(limit) do |
417 | 418 | local lv = dishTree:getv(k, 0) | ... | ... |
src/actions/EmailAction.lua
... | ... | @@ -40,10 +40,17 @@ function _M.listRpc(agent, data) |
40 | 40 | local count = 1 |
41 | 41 | for _, data in ipairs(result) do |
42 | 42 | local email = tarr2tab(data) |
43 | - if tonum(email.createtime) > role:getProperty("ctime") | |
44 | - and ( not email.mid or tonum(email.mid) == mid ) | |
43 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 | |
44 | + local delayType = tonum(email.delayType) | |
45 | + local flag = false | |
46 | + if delayType == 1 then | |
47 | + flag = skynet.timex() > tonum(email.createtime) | |
48 | + else | |
49 | + flag = tonum(email.createtime) > role:getProperty("ctime") | |
50 | + end | |
51 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | |
45 | 52 | and ( not email.endtime or tonum(email.endtime) > now )then |
46 | - local time = math.max(tonum(email.timestamp, 0) or email.createtime) | |
53 | + local time = math.max(tonum(email.timestamp, 0) , tonum(email.createtime)) | |
47 | 54 | redisproxy:insertEmail({ |
48 | 55 | roleId = roleId, |
49 | 56 | emailId = 0, | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -36,26 +36,15 @@ function _M.ban(role, pms) |
36 | 36 | local time = tonum(pms.pm1, 1) |
37 | 37 | local ctype = tonum(pms.pm2, 0) |
38 | 38 | |
39 | - local isBan = role:getProperty("banTime") <= now | |
40 | 39 | role:setBan(time, ctype) |
41 | - if time > 0 then | |
42 | - role:sendGmMsg("server_accountBanned_1") | |
43 | - local agent = datacenter.get("agent", role:getProperty("id")) | |
44 | - if agent then | |
45 | - skynet.timeout(50, function () | |
46 | - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | |
47 | - end) | |
48 | - end | |
49 | - end | |
50 | - | |
51 | 40 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) |
52 | - | |
53 | - return isBan and "解封杀成功" or "封杀成功" | |
41 | + return "封杀成功" | |
54 | 42 | end |
55 | 43 | |
44 | + | |
56 | 45 | function _M.unban(role, pms) |
57 | 46 | role:setBan(0, 0) |
58 | - | |
47 | + role:setProperty("cheatCount", 0) -- 清除作弊次数 | |
59 | 48 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) |
60 | 49 | |
61 | 50 | return "解封杀成功" |
... | ... | @@ -63,18 +52,17 @@ end |
63 | 52 | |
64 | 53 | function _M.gmmsg(role, pms) |
65 | 54 | role:sendGmMsg(pms.pm1, true) |
66 | - | |
67 | - local agent = datacenter.get("agent", role:getProperty("id")) | |
68 | - if agent then | |
69 | - skynet.timeout(50, function () | |
70 | - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | |
71 | - end) | |
72 | - end | |
73 | 55 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) |
74 | - | |
75 | 56 | return "指令成功" |
76 | 57 | end |
77 | 58 | |
59 | + | |
60 | +function _M.reset_rank(role, pms) | |
61 | + role:resetRank() | |
62 | + role:mylog("gm_action", {desc = "reset_rank", key1 = pms.sender}) | |
63 | + return "封杀成功" | |
64 | +end | |
65 | + | |
78 | 66 | function _M.silent(role, pms) |
79 | 67 | local pm1 = tonum(pms.pm1) |
80 | 68 | if pm1 < 1 then |
... | ... | @@ -259,6 +247,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"}) |
259 | 247 | table.insert(helpDes, {"获得所有碎片", "get", "FRAG"}) |
260 | 248 | table.insert(helpDes, {"获得所有食物", "get", "FOOD"}) |
261 | 249 | table.insert(helpDes, {"获得所有角色", "get", "HERO"}) |
250 | +table.insert(helpDes, {"获得满级满觉醒角色,满级满精进铭文", "get", "MAXHERO"}) | |
262 | 251 | function _M.get(role, pms) |
263 | 252 | if pms.pm1 == "ALL" then |
264 | 253 | local reward = {} |
... | ... | @@ -275,7 +264,7 @@ function _M.get(role, pms) |
275 | 264 | end |
276 | 265 | end |
277 | 266 | elseif pms.pm1 == "RUNE" then |
278 | - for itemId = 2000 , 3000 do | |
267 | + for itemId = 10000 , 20000 do | |
279 | 268 | if csvdb["itemCsv"][itemId] then |
280 | 269 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
281 | 270 | end |
... | ... | @@ -298,6 +287,36 @@ function _M.get(role, pms) |
298 | 287 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
299 | 288 | end |
300 | 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 | |
301 | 320 | else |
302 | 321 | local itemId = tonum(pms.pm1) |
303 | 322 | if not csvdb["itemCsv"][itemId] then |
... | ... | @@ -539,6 +558,26 @@ function _M.actbattle(role, pms) |
539 | 558 | return "成功" |
540 | 559 | end |
541 | 560 | |
561 | +table.insert(helpDes, {"清空背包", "clearbag"}) | |
562 | +function _M.clearbag(role, pms) | |
563 | + -- 装备 | |
564 | + role:updateProperty({field="equips", value = {}}) | |
565 | + -- 道具 | |
566 | + local items = role:getProperty("items"):toNumMap() | |
567 | + for k, v in pairs(items) do | |
568 | + role:addItem({itemId = k, count = -v, log = {desc = "gm"}}) | |
569 | + end | |
570 | + | |
571 | + -- 铭文 | |
572 | + local uids = {} | |
573 | + for uid, _ in pairs(role.runeBag) do | |
574 | + table.insert(uids, uid) | |
575 | + end | |
576 | + role:delRunes(uids, {log = {desc = "gm"}}) | |
577 | + | |
578 | + return "成功" | |
579 | +end | |
580 | + | |
542 | 581 | function _M.helpRpc(agent, data) |
543 | 582 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) |
544 | 583 | return true |
... | ... | @@ -546,11 +585,23 @@ end |
546 | 585 | |
547 | 586 | function _M.test(role, pms) |
548 | 587 | local id = tonum(pms.pm1, 0) |
588 | + local actid = nil | |
589 | + if id > 100 then | |
590 | + actid = tonum(pms.pm2, 0) | |
591 | + end | |
549 | 592 | --local hero = require ("actions.HeroAction") |
550 | 593 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
551 | 594 | |
552 | 595 | --role:sendMail(13, nil, "1=2", {111}) |
553 | - dump(redisproxy:zrevrange("rank:tower", 0 , 10, "WITHSCORES")) | |
596 | + local file = io.open("draw_hero_"..id..".csv", "a") | |
597 | + for i=1, 10000 do | |
598 | + local heroIds = _M.drawHero(role, id, actid) | |
599 | + for k, v in ipairs(heroIds) do | |
600 | + print((i - 1)* 10 + k, v) | |
601 | + file:write(v.."\n") | |
602 | + end | |
603 | + end | |
604 | + io.close(file) | |
554 | 605 | return "成功" |
555 | 606 | end |
556 | 607 | |
... | ... | @@ -559,6 +610,12 @@ function _M.ayncPurchase(role, params) |
559 | 610 | return role:handlePurchase(params) or "" |
560 | 611 | end |
561 | 612 | |
613 | +-- 获取订单号 | |
614 | +function _M.getPurchaseOrder(role, params) | |
615 | + return role:getPurchaseOrderByPlatform(params) or "" | |
616 | +end | |
617 | + | |
618 | + | |
562 | 619 | function _M.cz(role, pms) |
563 | 620 | local id = tonum(pms.pm1) |
564 | 621 | local csvData = csvdb["shop_rechargeCsv"][id] |
... | ... | @@ -575,5 +632,259 @@ function _M.cz(role, pms) |
575 | 632 | return "指令成功" |
576 | 633 | end |
577 | 634 | |
635 | +function _M.drawHero(role, t, act) | |
636 | + local btype = t -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池 | |
637 | + local subType = 1-- 定向卡池需要传 子类型 | |
638 | + local drawType = 2 -- 1 单抽 2 十连 | |
639 | + if btype ~= 1 then | |
640 | + subType = 1 | |
641 | + end | |
642 | + | |
643 | + local actid = act | |
644 | + -- 另开活动卡池 | |
645 | + if actid then | |
646 | + --if not role.activity:isOpenById(actid, "ActHeroPool") then return end | |
647 | + local cfg = csvdb["activity_ctrlCsv"][actid] | |
648 | + if not cfg then return end | |
649 | + | |
650 | + btype = cfg.condition | |
651 | + end | |
652 | + | |
653 | + local buildTypeData = csvdb["build_typeCsv"][btype] | |
654 | + if not buildTypeData then return 2 end | |
655 | + | |
656 | + local drawCount = {1, 10} -- 抽取次数 | |
657 | + if not drawCount[drawType] then return 3 end | |
658 | + | |
659 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | |
660 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | |
661 | + | |
662 | + -- 抽取的池子 | |
663 | + local poolMap = buildTypeData["pool"]:toNumMap() | |
664 | + local poolId = poolMap[subType] | |
665 | + if not poolId then return 5 end | |
666 | + | |
667 | + --TODO 活动覆盖 | |
668 | + local actPoolId = role.activity:getActivityPool(btype, subType) | |
669 | + if actPoolId ~= 0 then | |
670 | + poolId = actPoolId | |
671 | + end | |
672 | + | |
673 | + local unitPool = csvdb["build_unitCsv"][poolId] | |
674 | + if not unitPool then return 7 end | |
675 | + | |
676 | + -- 开始抽 | |
677 | + local resultPool = {} | |
678 | + local function fillDrawPool(isFloorBack) | |
679 | + local condition = {"rare"} | |
680 | + local values = {} | |
681 | + | |
682 | + | |
683 | + for idx, field in ipairs(condition) do | |
684 | + if not values[idx] then | |
685 | + local lpool = {} | |
686 | + local curIdx = 1 | |
687 | + while unitPool[field .. "_" .. curIdx] do | |
688 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | |
689 | + curIdx = curIdx + 1 | |
690 | + end | |
691 | + | |
692 | + if next(lpool) then | |
693 | + values[idx] = math.randWeight(lpool, 1) | |
694 | + end | |
695 | + end | |
696 | + end | |
697 | + | |
698 | + local weight = 0 | |
699 | + local up_pool = nil | |
700 | + local rand_v = math.randomInt(1, 100) | |
701 | + if values[1] == HeroQuality.SR then | |
702 | + weight = unitPool["up_sr_weight"] | |
703 | + up_pool = unitPool["up_sr_id"] | |
704 | + elseif values[1] == HeroQuality.SSR then | |
705 | + weight = unitPool["up_ssr_weight"] | |
706 | + up_pool = unitPool["up_ssr_id"] | |
707 | + end | |
708 | + --print(poolId, rand_v, weight, up_pool, values[1]) | |
709 | + if rand_v < weight and up_pool then | |
710 | + up_pool = up_pool:toArray(true, "=") | |
711 | + if btype == 5 then -- 爱心卡池,使用玩家设置的备选池子 | |
712 | + up_pool = role:getProperty("wishPool") | |
713 | + up_pool[1] = 606 | |
714 | + up_pool[2] = 607 | |
715 | + up_pool[3] = 608 | |
716 | + end | |
717 | + for k, v in ipairs(up_pool) do | |
718 | + resultPool[v] = {1} | |
719 | + end | |
720 | + else | |
721 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | |
722 | + local pool_str = "pool_" .. poolId | |
723 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | |
724 | + local itemData = csvdb["itemCsv"][itemId] | |
725 | + while itemData do | |
726 | + if itemData.type ~= ItemType.Hero then break end | |
727 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | |
728 | + if not heroData then break end | |
729 | + local ok = true | |
730 | + -- 保底是全随机,不用比较类型 | |
731 | + if not isFloorBack then | |
732 | + for idx, field in ipairs(condition) do | |
733 | + if heroData[field] ~= values[idx] then ok = false break end | |
734 | + end | |
735 | + end | |
736 | + if not ok then break end | |
737 | + if oneData[pool_str] > 0 then | |
738 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | |
739 | + end | |
740 | + break | |
741 | + end | |
742 | + end | |
743 | + end | |
744 | + end | |
745 | + end | |
746 | + | |
747 | + local guideHero = nil | |
748 | + if role:getProperty("newerGuide") == "8=1" then | |
749 | + guideHero = globalCsv.newdraw_hero_item_id or 503 | |
750 | + end | |
751 | + | |
752 | + local ssrCount = 0 | |
753 | + local reward = {} | |
754 | + local logReward = {} | |
755 | + local result = {} | |
756 | + for i = 1, drawCount[drawType] do | |
757 | + floorHeroCount = floorHeroCount + 1 | |
758 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | |
759 | + resultPool = {} | |
760 | + fillDrawPool(isFloorBack) | |
761 | + if not next(resultPool) then | |
762 | + skynet.error("random pool error, poolId:" .. poolId, isFloorBack) | |
763 | + return 8 | |
764 | + end | |
765 | + | |
766 | + local itemId = math.randWeight(resultPool, 1) | |
767 | + if guideHero then | |
768 | + itemId = guideHero | |
769 | + end | |
770 | + | |
771 | + local itemData = csvdb["itemCsv"][itemId] | |
772 | + if itemData.quality == HeroQuality.SSR then | |
773 | + ssrCount = ssrCount + 1 | |
774 | + if not guideHero then | |
775 | + -- 广播获得ssr英雄 | |
776 | + local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} | |
777 | + --mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) | |
778 | + end | |
779 | + end | |
780 | + | |
781 | + if btype == 4 and role:getProperty("newerDraw") == 0 then -- 新手卡池 | |
782 | + if itemData.quality == HeroQuality.SSR then | |
783 | + floorHeroCount = 0 | |
784 | + end | |
785 | + else | |
786 | + if itemData.quality >= HeroQuality.SR then | |
787 | + floorHeroCount = 0 | |
788 | + end | |
789 | + end | |
790 | + | |
791 | + if role:isHaveHero(itemData.id - ItemStartId.Hero) then | |
792 | + local fragId = itemData.id - ItemStartId.Hero | |
793 | + local heroData = csvdb["unitCsv"][fragId] | |
794 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] | |
795 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
796 | + logReward[fragId] = (logReward[fragId] or 0) + count | |
797 | + table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | |
798 | + else | |
799 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
800 | + logReward[itemId] = (logReward[itemId] or 0) + 1 | |
801 | + table.insert(reward, {id = itemId, count = 1}) | |
802 | + end | |
803 | + end | |
804 | + | |
805 | + if draw_floor_back_counts then | |
806 | + local floorHero = role:getProperty("floorHero") | |
807 | + floorHero[btype] = floorHeroCount | |
808 | + role:setProperty("floorHero", floorHero) | |
809 | + end | |
810 | + | |
811 | + if btype == 4 then | |
812 | + local newCount = role:getProperty("newerDraw") | |
813 | + role:updateProperty({field="newerDraw", value = newCount + drawCount[drawType]}) | |
814 | + end | |
815 | + | |
816 | + --SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | |
817 | + for k, v in pairs(reward) do | |
818 | + local hero = v | |
819 | + if hero["from"] then | |
820 | + result[#result+1] = hero["from"] | |
821 | + else | |
822 | + result[#result+1] = hero["id"] | |
823 | + end | |
824 | + end | |
825 | + | |
826 | + local feedbackId = buildTypeData["can_feedback"] or 0 | |
827 | + if feedbackId ~= 0 then | |
828 | + -- 达到一定次数,给响应奖励 | |
829 | + local oldVal = role:getProperty("repayHero") or 0 | |
830 | + if actid then | |
831 | + local actData = role.activity:getActData("ActHeroPool") | |
832 | + oldVal = actData[btype] or 0 | |
833 | + end | |
834 | + local newVal = oldVal + drawCount[drawType] | |
835 | + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | |
836 | + -- 空字符穿代表直接给英雄 走以前repayHeroRpc | |
837 | + if drawCardReward == "" then | |
838 | + local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 | |
839 | + repayHeroMaxCount = repayHeroMaxCount + 1 | |
840 | + | |
841 | + role:updateProperty({field = "repayMaxC", value = repayHeroMaxCount}) | |
842 | + local even = repayHeroMaxCount % 2 | |
843 | + local id = 0 | |
844 | + if even == 1 then | |
845 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | |
846 | + else | |
847 | + local giftHeroSet = {} | |
848 | + for gid, cfg in pairs(csvdb["build_giftCsv"]) do | |
849 | + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | |
850 | + giftHeroSet[gid] = {1} | |
851 | + end | |
852 | + end | |
853 | + if next(giftHeroSet) then | |
854 | + id = math.randWeight(giftHeroSet, 1) | |
855 | + end | |
856 | + end | |
857 | + if id == 0 then | |
858 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | |
859 | + end | |
860 | + | |
861 | + local r,change = {} | |
862 | + local itemData = csvdb["itemCsv"][id] | |
863 | + --if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | |
864 | + -- local fragId = itemData.id - ItemStartId.Hero | |
865 | + -- local heroData = csvdb["unitCsv"][fragId] | |
866 | + -- local count = globalCsv.draw_unit_tofragment[heroData.rare] | |
867 | + -- r, change = role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}}) | |
868 | + -- --r = {id = fragId, count = count, from = id, fcount = 1} | |
869 | + --else | |
870 | + r, change = role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}}) | |
871 | + --end | |
872 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | |
873 | + elseif drawCardReward and drawCardReward ~= "" then | |
874 | + local r,change = {} | |
875 | + r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | |
876 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | |
877 | + end | |
878 | + if not actid then | |
879 | + role:updateProperty({field = "repayHero", value = val}) | |
880 | + else | |
881 | + local actData = role.activity:getActData("ActHeroPool") | |
882 | + actData[btype] = val | |
883 | + role.activity:updateActData("ActHeroPool", actData) | |
884 | + end | |
885 | + end | |
886 | + return result | |
887 | +end | |
888 | + | |
578 | 889 | |
579 | 890 | return _M |
580 | 891 | \ No newline at end of file | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) |
235 | 235 | return 4 |
236 | 236 | end |
237 | 237 | |
238 | + -- 防作弊 | |
239 | + if not role:checkBattleCheat("hang", { | |
240 | + id = carbonId, | |
241 | + isWin = isWin, | |
242 | + info = msg.info | |
243 | + }) then | |
244 | + SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) | |
245 | + return true | |
246 | + end | |
247 | + | |
238 | 248 | local reward, change |
239 | 249 | if isWin then --win |
240 | 250 | role:hangFinish(carbonId) |
... | ... | @@ -581,6 +591,8 @@ function _M.startBonusBattleRpc(agent, data) |
581 | 591 | |
582 | 592 | local reward, change = bonusWinReward(role, bonusData, 3, count) |
583 | 593 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
594 | + | |
595 | + role:checkTaskEnter("BonusQuick", {count = count}) | |
584 | 596 | else |
585 | 597 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) |
586 | 598 | if not next(bTeam) then return 5 end |
... | ... | @@ -607,6 +619,18 @@ function _M.endBonusBattleRpc(agent, data) |
607 | 619 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) |
608 | 620 | return true |
609 | 621 | end |
622 | + role.__bonusBattleCache = nil | |
623 | + | |
624 | + -- 防作弊 | |
625 | + if not role:checkBattleCheat("bonus", { | |
626 | + id = id, | |
627 | + isWin = starNum and starNum > 0, | |
628 | + info = msg.info | |
629 | + }) then | |
630 | + SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | |
631 | + return true | |
632 | + end | |
633 | + | |
610 | 634 | local bonusData = csvdb["bonus_battleCsv"][id] |
611 | 635 | |
612 | 636 | local reward, change = {} | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -663,7 +663,8 @@ function _M.getResetRewardRpc(agent, data) |
663 | 663 | |
664 | 664 | while stage > 0 do |
665 | 665 | local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][stage] |
666 | - for lvl = 1, curTalentLvl - 1 do | |
666 | + local offset = stage == talent:getv(0,1) and curTalentLvl - 1 or #curData | |
667 | + for lvl = 1, offset do | |
667 | 668 | local talentData = curData[lvl] |
668 | 669 | for itemId, count in pairs(talentData.money:toNumMap()) do |
669 | 670 | reward[itemId] = (reward[itemId] or 0) + count |
... | ... | @@ -853,6 +854,10 @@ function _M.drawHeroRpc(agent, data) |
853 | 854 | elseif values[1] == HeroQuality.SSR then |
854 | 855 | weight = unitPool["up_ssr_weight"] |
855 | 856 | up_pool = unitPool["up_ssr_id"] |
857 | + if btype == 5 then | |
858 | + local wishPool = role:getProperty("wishPool") or {} | |
859 | + weight = weight * #wishPool | |
860 | + end | |
856 | 861 | end |
857 | 862 | --print(poolId, rand_v, weight, up_pool, values[1]) |
858 | 863 | if rand_v < weight and up_pool then |
... | ... | @@ -879,6 +884,15 @@ function _M.drawHeroRpc(agent, data) |
879 | 884 | if heroData[field] ~= values[idx] then ok = false break end |
880 | 885 | end |
881 | 886 | end |
887 | + -- 随机剔除up池中的角色 | |
888 | + if up_pool then | |
889 | + for k, v in ipairs(up_pool) do | |
890 | + if v == itemData.id then | |
891 | + ok = false | |
892 | + break | |
893 | + end | |
894 | + end | |
895 | + end | |
882 | 896 | if not ok then break end |
883 | 897 | if oneData[pool_str] > 0 then |
884 | 898 | resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 |
... | ... | @@ -913,6 +927,7 @@ function _M.drawHeroRpc(agent, data) |
913 | 927 | local itemId = math.randWeight(resultPool, 1) |
914 | 928 | if guideHero then |
915 | 929 | itemId = guideHero |
930 | + guideHero = nil | |
916 | 931 | end |
917 | 932 | |
918 | 933 | local itemData = csvdb["itemCsv"][itemId] | ... | ... |
src/actions/HttpAction.lua
... | ... | @@ -147,6 +147,15 @@ function _M.gm_action(query) |
147 | 147 | return status |
148 | 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 | 159 | function _M.broadcast(query) |
151 | 160 | local msg = {} |
152 | 161 | local handle = { | ... | ... |
src/actions/PvpAction.lua
... | ... | @@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) |
372 | 372 | |
373 | 373 | if not match then return end |
374 | 374 | |
375 | + -- 防作弊 | |
376 | + if not role:checkBattleCheat("pvpc", { | |
377 | + isWin = isWin, | |
378 | + info = msg.info, | |
379 | + format = _pvpStartBattleCacheC.pvpTC, | |
380 | + }) then | |
381 | + SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({errorCode = 1})) | |
382 | + return true | |
383 | + end | |
384 | + | |
375 | 385 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) |
376 | 386 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) |
377 | 387 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 |
... | ... | @@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) |
652 | 662 | end |
653 | 663 | end |
654 | 664 | |
665 | + -- 防作弊 | |
666 | + if not role:checkBattleCheat("pvph", { | |
667 | + isWin = isWin, | |
668 | + info = msg.info, | |
669 | + format = _pvpStartBattleCacheH.pvpTH[#_pvpStartBattleCacheH.result] | |
670 | + }) then | |
671 | + SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({errorCode = 1})) | |
672 | + return true | |
673 | + end | |
674 | + | |
655 | 675 | if winCount >= 2 then |
656 | 676 | isWin = true |
657 | 677 | elseif loseCount >= 2 then |
658 | 678 | isWin = false |
659 | 679 | else -- 没结束 |
660 | 680 | -- 返回继续战斗 |
661 | - | |
662 | 681 | local key = tostring(math.random()) |
663 | 682 | _pvpStartBattleCacheH.key = key |
664 | 683 | local round = #_pvpStartBattleCacheH.result + 1 | ... | ... |
src/actions/RadioAction.lua
... | ... | @@ -179,6 +179,7 @@ function _M.finishQuestRpc(agent, data) |
179 | 179 | msg["heroFaith"] = heroFaithMap |
180 | 180 | SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg)) |
181 | 181 | |
182 | + role:checkTaskEnter("RadioTaskStart", {heroCnt = #task.heros}) | |
182 | 183 | |
183 | 184 | local herolist = {} |
184 | 185 | for _, heroId in ipairs(task.heros) do | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -157,6 +157,7 @@ function _M.loginRpc( agent, data ) |
157 | 157 | SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start") |
158 | 158 | |
159 | 159 | role:changeStructVersion() -- 数据结构 版本更新 |
160 | + role:getAdvData(true) -- 清掉不合格的数据 | |
160 | 161 | role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查 |
161 | 162 | |
162 | 163 | -- 跨天登陆事件 |
... | ... | @@ -586,9 +587,9 @@ function _M.openTimeBoxRpc(agent, data) |
586 | 587 | else |
587 | 588 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time |
588 | 589 | local unitTime = globalCsv.box_key_time[oldId] * 60 |
589 | - local doneCnt = math.floor((process + skynet.timex() - time) / unitTime) | |
590 | + local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) | |
590 | 591 | if doneCnt > 0 then |
591 | - reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
592 | + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
592 | 593 | end |
593 | 594 | end |
594 | 595 | local limit = globalCsv.box_key_max[itemId] or 5 |
... | ... | @@ -610,7 +611,7 @@ function _M.openTimeBoxRpc(agent, data) |
610 | 611 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
611 | 612 | local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2] |
612 | 613 | if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end |
613 | - role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}}) | |
614 | + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
614 | 615 | else |
615 | 616 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) |
616 | 617 | end |
... | ... | @@ -618,7 +619,7 @@ function _M.openTimeBoxRpc(agent, data) |
618 | 619 | |
619 | 620 | local doneCnt = math.floor((process + stopTime - time) / unitTime) |
620 | 621 | if doneCnt > 0 then |
621 | - reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
622 | + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
622 | 623 | end |
623 | 624 | if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then |
624 | 625 | nowTime = 0 |
... | ... | @@ -687,7 +688,7 @@ function _M.openTimeBoxRpc(agent, data) |
687 | 688 | reward[id] = (reward[id] or 0) + num |
688 | 689 | end |
689 | 690 | end |
690 | - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}}) | |
691 | + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId, int2 = oper}}) | |
691 | 692 | else |
692 | 693 | return |
693 | 694 | end |
... | ... | @@ -847,6 +848,11 @@ function _M.taskRpc(agent, data) |
847 | 848 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) |
848 | 849 | local active = (taskStatus["a"] or 0) + taskData.active |
849 | 850 | |
851 | + -- 日常活动完成 | |
852 | + if taskType == 1 then | |
853 | + role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) | |
854 | + end | |
855 | + | |
850 | 856 | role:changeUpdates({ |
851 | 857 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, |
852 | 858 | { type = roleField[taskType], field = "a", value = active}, |
... | ... | @@ -1013,6 +1019,10 @@ function _M.chatRpc(agent, data) |
1013 | 1019 | result = 1 |
1014 | 1020 | return |
1015 | 1021 | end |
1022 | + if role:getProperty("level") < (globalCsv.chat_level or 15) then | |
1023 | + result = 3 | |
1024 | + return | |
1025 | + end | |
1016 | 1026 | |
1017 | 1027 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
1018 | 1028 | ... | ... |
src/actions/StoreAction.lua
... | ... | @@ -232,6 +232,13 @@ function _M.getFreeChestRpc(agent, data) |
232 | 232 | local config = csvdb["shop_rechargeCsv"][id] |
233 | 233 | if not config then return end |
234 | 234 | |
235 | + --判断是否是活动商品 | |
236 | + if config.activity_id ~= 0 then | |
237 | + local actCfg = csvdb["activity_ctrlCsv"][config.activity_id] | |
238 | + if not actCfg then return 2 end | |
239 | + if not role.activity:isOpenById(config.activity_id, "ActShopGoods") then return 3 end | |
240 | + end | |
241 | + | |
235 | 242 | local rechargeRecord = role.storeData:getProperty("payR") |
236 | 243 | local getCount = (rechargeRecord[id] or 0) |
237 | 244 | if getCount >= config.limit then | ... | ... |
src/actions/TowerAction.lua
... | ... | @@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) |
65 | 65 | local curTower = csvdb["tower_battleCsv"][id] |
66 | 66 | if not curTower then return 2 end |
67 | 67 | |
68 | + -- 防作弊 | |
69 | + if not role:checkBattleCheat("tower", { | |
70 | + isWin = msg.starNum and msg.starNum > 0, | |
71 | + info = msg.info | |
72 | + }) then | |
73 | + SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | |
74 | + return true | |
75 | + end | |
76 | + | |
68 | 77 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
69 | 78 | |
70 | 79 | ... | ... |
src/adv/Adv.lua
... | ... | @@ -20,8 +20,6 @@ function Adv:ctor(owner) |
20 | 20 | self.advTask = self.owner:getProperty("advTask") |
21 | 21 | self.advMTask = self.owner:getProperty("advMTask") |
22 | 22 | self.advTaskChange = false -- 任务改变才更新 |
23 | - | |
24 | - self:initByInfo(self.owner:getProperty("advInfo")) | |
25 | 23 | end |
26 | 24 | |
27 | 25 | function Adv:mylog(contents) |
... | ... | @@ -36,7 +34,8 @@ function Adv:mylog(contents) |
36 | 34 | end |
37 | 35 | |
38 | 36 | --初始化adv 信息 |
39 | -function Adv:initByInfo(advInfo) | |
37 | +function Adv:initByInfo() | |
38 | + local advInfo = self.owner:getProperty("advInfo") | |
40 | 39 | if not next(advInfo) then return end --还没有 开始新地图 |
41 | 40 | |
42 | 41 | self.chapterId = advInfo.chapterId |
... | ... | @@ -61,10 +60,10 @@ function Adv:initByInfo(advInfo) |
61 | 60 | self:initBattle(advInfo) |
62 | 61 | end |
63 | 62 | -- 找出level 是否存在中继层 |
64 | -function Adv:isHaveRelay(level, chapterId) | |
63 | +function Adv:isHaveRelay(level, chapterId, force) | |
65 | 64 | level = level or self.level |
66 | 65 | chapterId = chapterId or self.chapterId |
67 | - if level == 1 then return end | |
66 | + if level == 1 and not force then return end | |
68 | 67 | |
69 | 68 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] |
70 | 69 | for _, campsite in ipairs(campsiteCsv) do |
... | ... | @@ -140,12 +139,13 @@ function Adv:initByChapter(params) |
140 | 139 | local chapter = self:isEndless() and -1 or self.chapterId |
141 | 140 | if not (advRelay[chapter] or {})[self.level] then |
142 | 141 | isNewRelay = true |
143 | - advRelay[chapter] = advRelay[chapter] or {} | |
144 | - advRelay[chapter][self.level] = 1 | |
145 | - self.owner:updateProperty({field = "advRelay", value = advRelay}) | |
146 | 142 | end |
147 | 143 | end |
148 | 144 | |
145 | + if self.level == 1 or self.isRelay then | |
146 | + self:supplyPotion() | |
147 | + end | |
148 | + | |
149 | 149 | self.maps = {} |
150 | 150 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
151 | 151 | |
... | ... | @@ -153,8 +153,6 @@ function Adv:initByChapter(params) |
153 | 153 | |
154 | 154 | self:initLayerTask() |
155 | 155 | |
156 | - | |
157 | - | |
158 | 156 | self:checkTask(Adv.TaskType.Arrive) |
159 | 157 | self:checkAdvUnlock(1, self.level) |
160 | 158 | |
... | ... | @@ -168,6 +166,20 @@ function Adv:initByChapter(params) |
168 | 166 | end |
169 | 167 | end |
170 | 168 | |
169 | +function Adv:passAdvRelay() | |
170 | + local advRelay = self.owner:getProperty("advRelay") | |
171 | + local chapter = self:isEndless() and -1 or self.chapterId | |
172 | + if not (advRelay[chapter] or {})[self.level] then | |
173 | + advRelay[chapter] = advRelay[chapter] or {} | |
174 | + advRelay[chapter][self.level] = 1 | |
175 | + self.owner:updateProperty({field = "advRelay", value = advRelay}) | |
176 | + local relayData = self:isHaveRelay() | |
177 | + if relayData and relayData.award ~= "" then | |
178 | + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | |
179 | + end | |
180 | + end | |
181 | +end | |
182 | + | |
171 | 183 | function Adv:clear() |
172 | 184 | self.chapterId = nil |
173 | 185 | self.level = nil |
... | ... | @@ -389,18 +401,24 @@ function Adv:isRunning() |
389 | 401 | return false |
390 | 402 | end |
391 | 403 | |
392 | --- 强制结束 | |
393 | -function Adv:forceOver(notNotify) | |
394 | - if self:isRunning() then | |
395 | - | |
404 | +-- 强制结束 逻辑和adv内部无关 | |
405 | +function Adv:forceOver(notNotify, force) | |
406 | + if self:isRunning() or force then | |
396 | 407 | local advTeam = self.owner:getProperty("advTeam") |
397 | 408 | advTeam.player = nil |
398 | 409 | |
410 | + local advPotionCsv = csvdb["adv_potionCsv"] | |
411 | + local potionBag = self.owner:getProperty("potionBag") | |
412 | + | |
399 | 413 | local reward = self.owner:getProperty("advItems"):toNumMap() |
400 | 414 | for itemId, count in pairs(reward) do |
401 | - 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 | |
402 | 420 | end |
403 | - self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | |
421 | + self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) | |
404 | 422 | |
405 | 423 | self:clear() |
406 | 424 | self.owner:updateProperties({ |
... | ... | @@ -409,6 +427,7 @@ function Adv:forceOver(notNotify) |
409 | 427 | advItems = "", |
410 | 428 | advAFGet = {}, |
411 | 429 | advAFWear = {}, |
430 | + potionBag = potionBag, | |
412 | 431 | }, notNotify) |
413 | 432 | end |
414 | 433 | end |
... | ... | @@ -789,9 +808,13 @@ function Adv:over(success, rewardRatio, overType) |
789 | 808 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) |
790 | 809 | |
791 | 810 | local reward = {} |
811 | + local advPotionCsv = csvdb["adv_potionCsv"] | |
812 | + local potionBag = self.owner:getProperty("potionBag") | |
792 | 813 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
793 | 814 | local itemCsv = csvdb["itemCsv"][itemId] |
794 | - if not itemCsv then | |
815 | + if advPotionCsv[itemId] then | |
816 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | |
817 | + elseif not itemCsv then | |
795 | 818 | print("ERROR: no itemId in ItemCsv : ", itemId) |
796 | 819 | elseif itemCsv.type ~= ItemType.AdvItem then |
797 | 820 | reward[itemId] = math.ceil(count * rewardRatio / 100) |
... | ... | @@ -811,28 +834,29 @@ function Adv:over(success, rewardRatio, overType) |
811 | 834 | if not self:isEndless() and self.level >= chapterData.limitlevel then |
812 | 835 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) |
813 | 836 | end |
837 | + end | |
814 | 838 | |
815 | - local roleId = self.owner:getProperty("id") | |
816 | - local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) | |
817 | - if score > oldMaxScore then | |
818 | - local team = self.owner:getProperty("advTeam") | |
819 | - local curInfo = { | |
820 | - name = self.owner:getProperty("name"), | |
821 | - headId = self.owner:getProperty("headId"), | |
822 | - lv = self.owner:getProperty("level"), | |
823 | - batteV = self.owner:getTeamBattleValue(team.heros), | |
824 | - chapter = self.chapterId, | |
825 | - format = self.owner:getTeamHerosInfo(team).heros, | |
826 | - } | |
827 | - redisproxy:pipelining(function (red) | |
828 | - red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数 | |
829 | - red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) | |
830 | - end) | |
831 | - end | |
832 | - -- 通关的时候要把引导步骤设定到成就引导 | |
833 | - if not self.owner:checkOverGuide(57) then | |
834 | - self.owner:saveGuide(57,1,true) | |
835 | - end | |
839 | + local roleId = self.owner:getProperty("id") | |
840 | + local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) | |
841 | + if score > oldMaxScore then | |
842 | + local team = self.owner:getProperty("advTeam") | |
843 | + local curInfo = { | |
844 | + name = self.owner:getProperty("name"), | |
845 | + headId = self.owner:getProperty("headId"), | |
846 | + lv = self.owner:getProperty("level"), | |
847 | + batteV = self.owner:getTeamBattleValue(team.heros), | |
848 | + chapter = self.chapterId, | |
849 | + format = self.owner:getTeamHerosInfo(team).heros, | |
850 | + } | |
851 | + redisproxy:pipelining(function (red) | |
852 | + red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数 | |
853 | + red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) | |
854 | + end) | |
855 | + end | |
856 | + | |
857 | + -- 通关的时候要把引导步骤设定到成就引导 | |
858 | + if not self.owner:checkOverGuide(57) then | |
859 | + self.owner:saveGuide(57,1,true) | |
836 | 860 | end |
837 | 861 | self:clearAdvUnlockCache() |
838 | 862 | |
... | ... | @@ -889,6 +913,7 @@ function Adv:over(success, rewardRatio, overType) |
889 | 913 | advItems = "", |
890 | 914 | advAFGet = {}, |
891 | 915 | advAFWear = {}, |
916 | + potionBag = potionBag, | |
892 | 917 | }) |
893 | 918 | self:pushBackEvent(AdvBackEventType.End, { |
894 | 919 | success = success, |
... | ... | @@ -963,7 +988,7 @@ function Adv:award(gift, params, backRewardParams) |
963 | 988 | |
964 | 989 | local autoUse = {} |
965 | 990 | for itemId, count in pairs(tgift) do |
966 | - if count > 0 then | |
991 | + if count > 0 and self.battle.player then | |
967 | 992 | local buffAdd = self.battle.player:getRewardChange(itemId) |
968 | 993 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 |
969 | 994 | self:checkTask(Adv.TaskType.Item, count, itemId) |
... | ... | @@ -973,7 +998,8 @@ function Adv:award(gift, params, backRewardParams) |
973 | 998 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then |
974 | 999 | autoUse[itemId] = count |
975 | 1000 | else |
976 | - local origin = items:getv(itemId, 0) | |
1001 | + local transId = globalCsv.adv_item_potion[itemId] or itemId | |
1002 | + local origin = items:getv(transId, 0) | |
977 | 1003 | local nums = origin + count |
978 | 1004 | |
979 | 1005 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 |
... | ... | @@ -983,10 +1009,10 @@ function Adv:award(gift, params, backRewardParams) |
983 | 1009 | end |
984 | 1010 | else |
985 | 1011 | if nums <= 0 then |
986 | - items = items:delk(itemId) | |
1012 | + items = items:delk(transId) | |
987 | 1013 | nums = 0 |
988 | 1014 | else |
989 | - items = items:setv(itemId, nums) | |
1015 | + items = items:setv(transId, nums) | |
990 | 1016 | end |
991 | 1017 | |
992 | 1018 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
... | ... | @@ -1064,6 +1090,7 @@ end |
1064 | 1090 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 |
1065 | 1091 | function Adv:cost(item, params, check) |
1066 | 1092 | local items = self.owner:getProperty("advItems") |
1093 | + local potionCsv = csvdb["adv_potionCsv"] | |
1067 | 1094 | local less = {} |
1068 | 1095 | local advCost = {} |
1069 | 1096 | for itemId, count in pairs(item) do |
... | ... | @@ -1077,9 +1104,13 @@ function Adv:cost(item, params, check) |
1077 | 1104 | less[itemId] = -last |
1078 | 1105 | end |
1079 | 1106 | |
1107 | + if potionCsv[itemId] and last < 0 then -- 只能使用冒险背包里的药水 | |
1108 | + return | |
1109 | + end | |
1080 | 1110 | end |
1081 | 1111 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 |
1082 | 1112 | if check then return true end |
1113 | + | |
1083 | 1114 | self:award(advCost, params) |
1084 | 1115 | if next(less) then |
1085 | 1116 | self.owner:costItems(less, params) |
... | ... | @@ -1087,6 +1118,34 @@ function Adv:cost(item, params, check) |
1087 | 1118 | return true |
1088 | 1119 | end |
1089 | 1120 | |
1121 | +-- 补满冒险背包药剂,从药剂背包扣除药水放到冒险背包 | |
1122 | +function Adv:supplyPotion() | |
1123 | + local potionCsv = csvdb["adv_potionCsv"] | |
1124 | + local potionBag = self.owner:getProperty("potionBag") | |
1125 | + local advItems = self.owner:getProperty("advItems") | |
1126 | + local dishTree = self.owner.dinerData:getProperty("dishTree") | |
1127 | + for potionId, set in pairs(potionCsv) do | |
1128 | + local count = potionBag[potionId] or 0 | |
1129 | + if count > 0 then | |
1130 | + local max = set[dishTree:getv(potionId,1)].limit | |
1131 | + local old = advItems:getv(potionId,0) | |
1132 | + local need = max - old | |
1133 | + | |
1134 | + if need < count then | |
1135 | + advItems = advItems:setv(potionId,max) | |
1136 | + potionBag[potionId] = count - need | |
1137 | + else | |
1138 | + advItems = advItems:setv(potionId,old + count) | |
1139 | + potionBag[potionId] = nil | |
1140 | + end | |
1141 | + end | |
1142 | + end | |
1143 | + self.owner:updateProperties({ | |
1144 | + advItems = advItems, | |
1145 | + potionBag = potionBag, | |
1146 | + }) | |
1147 | +end | |
1148 | + | |
1090 | 1149 | --事件点击处理 |
1091 | 1150 | local function clickOut(self, room, block, params, isExit) |
1092 | 1151 | if self:getCurMap():checkOver() then --检查是否可以出去了 |
... | ... | @@ -1112,6 +1171,11 @@ local function clickOut(self, room, block, params, isExit) |
1112 | 1171 | else |
1113 | 1172 | if self.level > (advPass[self.chapterId] or 0) then |
1114 | 1173 | self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}}) |
1174 | + | |
1175 | + if (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 | |
1176 | + self.owner:checkTaskEnter("AdvPassFirst", {id = self.chapterId}) | |
1177 | + end | |
1178 | + | |
1115 | 1179 | end |
1116 | 1180 | end |
1117 | 1181 | |
... | ... | @@ -1124,6 +1188,7 @@ local function clickOut(self, room, block, params, isExit) |
1124 | 1188 | end |
1125 | 1189 | |
1126 | 1190 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 |
1191 | + self:passAdvRelay() | |
1127 | 1192 | self:over(true) |
1128 | 1193 | else |
1129 | 1194 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
... | ... | @@ -1675,12 +1740,6 @@ function Adv:clickBlock(roomId, blockId, params) |
1675 | 1740 | if not block.isOpen then |
1676 | 1741 | if self.isRelay or checkAroundBlocks() then --开放 |
1677 | 1742 | self:getCurMap():openBlock(roomId, blockId, true, true) |
1678 | - if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 | |
1679 | - local relayData = self:isHaveRelay() | |
1680 | - if relayData and relayData.award ~= "" then | |
1681 | - self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | |
1682 | - end | |
1683 | - end | |
1684 | 1743 | status = true |
1685 | 1744 | end |
1686 | 1745 | else |
... | ... | @@ -2143,6 +2202,7 @@ function Adv:enemyDead(enemy, escape) |
2143 | 2202 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) |
2144 | 2203 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) |
2145 | 2204 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) |
2205 | + self.owner:checkTaskEnter("AdvKillBoss") | |
2146 | 2206 | elseif monsterData.type == 3 then |
2147 | 2207 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) |
2148 | 2208 | end | ... | ... |
src/adv/AdvBlock.lua
... | ... | @@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit) |
60 | 60 | end |
61 | 61 | self:randomEvent() |
62 | 62 | end |
63 | - self:quickDrop() | |
64 | 63 | |
65 | 64 | if not isInit and self.isOpen then |
65 | + self:quickDrop() | |
66 | 66 | local newet = self:getEventType() |
67 | 67 | if oldet ~= newet then |
68 | 68 | local em = {} | ... | ... |
src/adv/AdvMap.lua
... | ... | @@ -272,6 +272,10 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) |
272 | 272 | if not ignoreBack then |
273 | 273 | self.adv:backBlockChange(roomId, blockId) |
274 | 274 | end |
275 | + | |
276 | + if self.adv.isRelay and self:isAllOpen() then -- 发放翻开的奖励 | |
277 | + self.adv:passAdvRelay() | |
278 | + end | |
275 | 279 | end |
276 | 280 | return status |
277 | 281 | end | ... | ... |
src/adv/AdvPassive.lua
... | ... | @@ -532,7 +532,7 @@ function Passive:effect8(dropId) |
532 | 532 | end |
533 | 533 | |
534 | 534 | --9=直接获得item(可在结算触发时使用) |
535 | -function Passive:effect9(itemId, triggerPms, ratio, max) | |
535 | +function Passive:effect9(itemId, triggerPms, ratio, ratio2, max) | |
536 | 536 | local cond = nil |
537 | 537 | if self.passiveData.value == 0 then |
538 | 538 | cond = triggerPms.score |
... | ... | @@ -542,7 +542,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) |
542 | 542 | return |
543 | 543 | end |
544 | 544 | if not cond then return end |
545 | - self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | |
545 | + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio * ratio2)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | |
546 | 546 | end |
547 | 547 | |
548 | 548 | --10=战斗额外掉落次数 | ... | ... |
src/models/Activity.lua
... | ... | @@ -30,6 +30,9 @@ Activity.ActivityType = { |
30 | 30 | ActShopGoods = 25, -- 活动商品 |
31 | 31 | |
32 | 32 | Crisis = 26, -- 宝藏怪活动 |
33 | + | |
34 | + CommonSignIn = 28, --通用签到 | |
35 | + FriendEnergy = 30, -- 好友互赠能量活动 | |
33 | 36 | } |
34 | 37 | |
35 | 38 | local function checkActivityType(activityType) |
... | ... | @@ -73,6 +76,9 @@ Activity.schema = { |
73 | 76 | |
74 | 77 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} |
75 | 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 | 84 | function Activity:data() |
... | ... | @@ -91,7 +97,11 @@ function Activity:data() |
91 | 97 | act18 = self:getProperty("act18"), |
92 | 98 | act19 = self:getProperty("act19"), |
93 | 99 | act20 = self:getProperty("act20"), |
100 | + act24 = self:getProperty("act24"), | |
94 | 101 | act26 = self:getProperty("act26"), |
102 | + | |
103 | + act28 = self:getProperty("act28"), | |
104 | + act30 = self:getProperty("act30"), | |
95 | 105 | } |
96 | 106 | end |
97 | 107 | |
... | ... | @@ -277,38 +287,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) |
277 | 287 | local totalCnt = 0 |
278 | 288 | local finishCnt = 0 |
279 | 289 | local maxCondition = 0 |
280 | - for k, cfg in pairs(csvdb[info.table] or {}) do | |
281 | - totalCnt = totalCnt + 1 | |
282 | - if maxCondition < cfg.condition1 then | |
283 | - maxCondition = cfg.condition1 | |
284 | - end | |
285 | - if not curData[cfg.id] and curData[0] >= cfg.condition1 then | |
286 | - if info.mailId then | |
290 | + local flag = true | |
291 | + while flag do | |
292 | + --print("tatal number :", curData[0]) | |
293 | + for i = 1, #csvdb[info.table] do | |
294 | + local cfg = csvdb[info.table][i] | |
295 | + --for k, cfg in pairs(csvdb[info.table] or {}) do | |
296 | + totalCnt = totalCnt + 1 | |
297 | + if maxCondition < cfg.condition1 then | |
298 | + maxCondition = cfg.condition1 | |
299 | + end | |
300 | + --print("cur condition", cfg.condition1) | |
301 | + if curData[0] < cfg.condition1 then | |
302 | + flag = false | |
303 | + break | |
304 | + end | |
287 | 305 | |
288 | - self.owner:log("activity", { | |
289 | - activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | |
290 | - activity_type = actType, -- 活动类型,见活动类型枚举表 | |
291 | - activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
292 | - }) | |
306 | + --print(curData[0], cfg.condition1) | |
307 | + if not curData[cfg.id] and curData[0] >= cfg.condition1 then | |
308 | + if info.mailId then | |
293 | 309 | |
294 | - self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | |
295 | - curData[cfg.id] = 1 | |
310 | + self.owner:log("activity", { | |
311 | + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | |
312 | + activity_type = actType, -- 活动类型,见活动类型枚举表 | |
313 | + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
314 | + }) | |
315 | + | |
316 | + self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | |
317 | + curData[cfg.id] = 1 | |
318 | + end | |
319 | + end | |
320 | + if curData[cfg.id] then | |
321 | + finishCnt = finishCnt + 1 | |
296 | 322 | end |
297 | 323 | end |
298 | - if curData[cfg.id] then | |
299 | - finishCnt = finishCnt + 1 | |
300 | - end | |
301 | - end | |
302 | - if totalCnt == finishCnt then | |
303 | - roundData[actType] = curRound + 1 | |
304 | - for k,v in pairs(curData) do | |
305 | - if k == 0 then | |
306 | - curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | |
307 | - else | |
308 | - curData[k] = nil | |
324 | + if totalCnt == finishCnt then | |
325 | + roundData[actType] = (roundData[actType] or 0) + 1 | |
326 | + for k,v in pairs(curData) do | |
327 | + if k == 0 then | |
328 | + curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | |
329 | + else | |
330 | + curData[k] = nil | |
331 | + end | |
332 | + end | |
333 | + --print("cur round ".. roundData[actType], ctrlData.condition) | |
334 | + if roundData[actType] >= ctrlData.condition then | |
335 | + curData[0] = maxCondition | |
336 | + flag = false | |
309 | 337 | end |
338 | + self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | |
310 | 339 | end |
311 | - self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | |
312 | 340 | end |
313 | 341 | self:updateActData(actType, curData, not notify) |
314 | 342 | end |
... | ... | @@ -427,7 +455,7 @@ activityFunc[Activity.ActivityType.PayBack] = { |
427 | 455 | -- 英雄帖 |
428 | 456 | activityFunc[Activity.ActivityType.CalendaTask] = { |
429 | 457 | ["init"] = function(self, actType, isCrossDay, notify) |
430 | - local calTask = self.owner:getProperty("CalTask") | |
458 | + local calTask = self.owner:getProperty("calTask") | |
431 | 459 | calTask = {} |
432 | 460 | local role = self.owner |
433 | 461 | local buildL = role.dinerData:getProperty("buildL") |
... | ... | @@ -452,8 +480,9 @@ activityFunc[Activity.ActivityType.CalendaTask] = { |
452 | 480 | role:checkTaskEnter("RuneQualityCollect", {}) |
453 | 481 | |
454 | 482 | end, |
455 | - -- ["close"] = function(self, actType, notify) | |
456 | - -- end, | |
483 | + ["close"] = function(self, actType, notify) | |
484 | + self.owner:updateProperty({field="calTask", value={}}) | |
485 | + end, | |
457 | 486 | } |
458 | 487 | |
459 | 488 | -- 兑换 |
... | ... | @@ -463,6 +492,9 @@ activityFunc[Activity.ActivityType.Exchange] = { |
463 | 492 | actData[actId] = {} |
464 | 493 | self:updateActData(actType, actData, not notify) |
465 | 494 | end, |
495 | + ["login"] = function(self, actType, actId) | |
496 | + activityFunc[Activity.ActivityType.Exchange]["crossDay"](self, actType, true, actId) | |
497 | + end, | |
466 | 498 | ["crossDay"] = function(self, actType, notify, actId) |
467 | 499 | local actData = self:getActData(actType) or {} |
468 | 500 | local lastTs = actData["ts"] or 0 |
... | ... | @@ -471,14 +503,14 @@ activityFunc[Activity.ActivityType.Exchange] = { |
471 | 503 | if not cfg then return end |
472 | 504 | local refreshTimes = cfg.condition2:toArray(false, "=") |
473 | 505 | for i = 1, #refreshTimes do |
474 | - local rt = toUnixtime(refreshTimes[1]..string_format("%02x", RESET_TIME)) | |
506 | + local rt = toUnixtime(refreshTimes[i]..string_format("%02x", RESET_TIME)) | |
475 | 507 | if timeNow >= rt and rt > lastTs then |
476 | 508 | lastTs = rt |
477 | 509 | actData = {} |
478 | 510 | end |
479 | 511 | end |
480 | - if next(actData) then | |
481 | - actData["ts"] = lastTs | |
512 | + if not next(actData) then | |
513 | + actData["ts"] = timeNow | |
482 | 514 | self:updateActData(actType, actData, not notify) |
483 | 515 | end |
484 | 516 | end, |
... | ... | @@ -507,6 +539,12 @@ activityFunc[Activity.ActivityType.ActHeroPool] = { |
507 | 539 | local actData = self:getActData(actType) |
508 | 540 | local cfg = csvdb["activity_ctrlCsv"][actId] |
509 | 541 | if not cfg then return end |
542 | + -- 保底次数转换成万能碎片 | |
543 | + --local count = math.ceil(((actData[cfg.condition] or 0) / 100) * 60) | |
544 | + --if count > 0 then | |
545 | + -- local gift = {[723] = count} | |
546 | + -- self.owner:sendMail(MailId.ActivityPoolRet, nil, gift, {}) | |
547 | + --end | |
510 | 548 | actData[cfg.condition] = nil |
511 | 549 | self:updateActData(actType, actData, not notify) |
512 | 550 | end, |
... | ... | @@ -560,8 +598,8 @@ function Activity:closeActivity(actId, notify, notUpdateAct) |
560 | 598 | local actType = actData.showType |
561 | 599 | if activityFunc[actType] and activityFunc[actType]['close'] then |
562 | 600 | activityFunc[actType]["close"](self, actType, notify, actId) |
563 | - self:recycleActItem(actId) | |
564 | 601 | end |
602 | + self:recycleActItem(actId) | |
565 | 603 | if Activity.schema["act".. actType] then |
566 | 604 | if not Activity.schema["act" .. actType][3] then |
567 | 605 | self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) |
... | ... | @@ -680,7 +718,7 @@ function Activity:recycleActItem(actId) |
680 | 718 | local itemCount = role:getItemCount(fromId) |
681 | 719 | if itemCount > 0 then |
682 | 720 | costs[fromId] = (costs[fromId] or 0) + itemCount |
683 | - gift[toId] = toNum * itemCount | |
721 | + gift[toId] = (gift[toId] or 0) + toNum * itemCount | |
684 | 722 | end |
685 | 723 | end |
686 | 724 | if next(costs) then |
... | ... | @@ -744,7 +782,46 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { |
744 | 782 | end, |
745 | 783 | } |
746 | 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 | +} | |
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 | |
747 | 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 | |
748 | 825 | |
749 | 826 | activityFunc[Activity.ActivityType.Crisis] = { |
750 | 827 | ["check"] = function(self, actType, notify, atype, count) -- 检查 |
... | ... | @@ -757,25 +834,27 @@ activityFunc[Activity.ActivityType.Crisis] = { |
757 | 834 | for id, actSet in pairs(actCsv) do |
758 | 835 | if actSet.type == atype then |
759 | 836 | local status = actData.task[id] or 0 |
760 | - status = status + count | |
761 | - if status >= actSet.condition1 then | |
762 | - local reward | |
763 | - if actSet.loop == 1 then | |
764 | - local rcount = math.floor(status / actSet.condition1) | |
765 | - reward = actSet.reward:toNumMap() | |
766 | - for itemId, itemC in pairs(reward) do | |
767 | - reward[itemId] = itemC * rcount | |
837 | + if status ~= -1 then | |
838 | + status = status + count | |
839 | + if status >= actSet.condition1 then | |
840 | + local reward | |
841 | + if actSet.loop == 1 then | |
842 | + local rcount = math.floor(status / actSet.condition1) | |
843 | + reward = actSet.reward:toNumMap() | |
844 | + for itemId, itemC in pairs(reward) do | |
845 | + reward[itemId] = itemC * rcount | |
846 | + end | |
847 | + status = status % actSet.condition1 | |
848 | + else | |
849 | + reward = actSet.reward | |
850 | + status = -1 | |
768 | 851 | end |
769 | - status = status % actSet.condition1 | |
770 | - else | |
771 | - reward = actSet.reward | |
772 | - status = -1 | |
773 | - end | |
774 | 852 | |
775 | - self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | |
853 | + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | |
854 | + end | |
855 | + actData.task[id] = status | |
856 | + change = true | |
776 | 857 | end |
777 | - actData.task[id] = status | |
778 | - change = true | |
779 | 858 | end |
780 | 859 | end |
781 | 860 | if change then |
... | ... | @@ -786,4 +865,40 @@ activityFunc[Activity.ActivityType.Crisis] = { |
786 | 865 | end, |
787 | 866 | } |
788 | 867 | |
868 | +activityFunc[Activity.ActivityType.CommonSignIn] = { | |
869 | + ["init"] = function(self, actType, isCrossDay, notify, actId) | |
870 | + if not isCrossDay then | |
871 | + activityFunc[Activity.ActivityType.CommonSignIn]["crossDay"](self, actType, notify, actId) | |
872 | + end | |
873 | + end, | |
874 | + ["crossDay"] = function(self, actType, notify, actId) | |
875 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | |
876 | + if not actCfg then return end | |
877 | + local conArr = actCfg.condition2:toArray(true, "=") | |
878 | + -- 0 登录即可, 1 达到指定活跃度 | |
879 | + if conArr[1] ~= 0 then | |
880 | + return | |
881 | + end | |
882 | + local curData = self:getActData(actType) or {} | |
883 | + curData[0] = (curData[0] or 0) + 1 | |
884 | + self:updateActData(actType, curData, not notify) | |
885 | + end, | |
886 | + ["check"] = function(self, actType, notify, pre, cur) -- 检查 | |
887 | + local isOpen, actId = self:isOpen(actType) | |
888 | + local actData = self:getActData(actType) or {} | |
889 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | |
890 | + if not actCfg then return end | |
891 | + local conArr = actCfg.condition2:toArray("true", "=") | |
892 | + -- 0 登录即可, 1 达到指定活跃度 | |
893 | + if conArr[1] ~= 1 then | |
894 | + return | |
895 | + end | |
896 | + local val = conArr[2] or 0 | |
897 | + if pre < val and cur >= val then | |
898 | + actData[0] = (actData[0] or 0) + 1 | |
899 | + self:updateActData(actType, actData, not notify) | |
900 | + end | |
901 | + end, | |
902 | +} | |
903 | + | |
789 | 904 | return Activity | ... | ... |
src/models/Diner.lua
... | ... | @@ -201,7 +201,7 @@ function Diner:calSellReward(sell, delta, dishData) |
201 | 201 | upValue[ItemId.Gold] = (upValue[ItemId.Gold] or 0) + buildData.gold_up |
202 | 202 | end |
203 | 203 | if buildData.item_up > 0 then |
204 | - upValue[ItemId.DinerCoin] = (upValue[ItemId.DinerCoin] or 0) + buildData.gold_up | |
204 | + upValue[ItemId.DinerCoin] = (upValue[ItemId.DinerCoin] or 0) + buildData.item_up | |
205 | 205 | end |
206 | 206 | if buildData and buildData.famous_up > 0 then |
207 | 207 | upValue[-1] = (upValue[-1] or 0) + buildData.famous_up | ... | ... |
src/models/HeroPlugin.lua
... | ... | @@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) |
53 | 53 | local talentAttrS = {} |
54 | 54 | |
55 | 55 | -- 四个基础属性 |
56 | - local curData = csvdb["unit_talentCsv"][talent:getv(0, 1)] | |
57 | - local curTalentLvl = 0 | |
58 | - if not curData then -- 已经满阶段了 | |
59 | - local cfgName = "unit_talent_"..heroCfgId.."Csv" | |
60 | - curData = csvdb[cfgName][#csvdb[cfgName]] | |
61 | - else | |
62 | - curTalentLvl = talent:getv(1, 1) | |
63 | - end | |
64 | - for lvl, cfg in pairs(curData) do | |
65 | - if lvl < curTalentLvl or curTalentLvl == 0 then | |
66 | - if cfg.effect ~= 99 then | |
67 | - local curVal = talentAttrS[cfg.effect] or 0 | |
68 | - if curVal < cfg.strength then | |
69 | - talentAttrS[cfg.effect] = cfg.strength | |
56 | + local cfgName = "unit_talent_"..heroCfgId.."Csv" | |
57 | + local curRank = talent:getv(0, 1) | |
58 | + local curLv = talent:getv(1,1) - 1 | |
59 | + for i, value in ipairs(csvdb[cfgName]) do | |
60 | + if i <= curRank then | |
61 | + for lv, cfg in ipairs(value) do | |
62 | + if i < curRank or lv <= curLv then | |
63 | + if cfg.effect ~= 99 then | |
64 | + if not talentAttrS[cfg.effect] then | |
65 | + talentAttrS[AttsEnumEx[cfg.effect]] = 0 | |
66 | + end | |
67 | + talentAttrS[AttsEnumEx[cfg.effect]] = cfg.strength | |
68 | + end | |
69 | + else | |
70 | + break | |
70 | 71 | end |
71 | 72 | end |
73 | + else | |
74 | + break | |
72 | 75 | end |
73 | 76 | end |
74 | 77 | |
... | ... | @@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) |
85 | 88 | for lvl = 1, #faithConfig do |
86 | 89 | if faith >= faithConfig[lvl].exp then |
87 | 90 | local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=") |
88 | - faithAttr[add[1]] = (faithAttr[add[1]] or 0) + add[2] | |
91 | + faithAttr[AttsEnumEx[add[1]]] = (faithAttr[AttsEnumEx[add[1]]] or 0) + add[2] | |
89 | 92 | end |
90 | 93 | end |
91 | 94 | for _, attrName in pairs(AttsEnumEx) do | ... | ... |
src/models/Role.lua
... | ... | @@ -53,10 +53,11 @@ Role.schema = { |
53 | 53 | banTime = {"number", 0}, |
54 | 54 | banType = {"number", 0}, |
55 | 55 | heartWarning = {"number", 0}, |
56 | + cheatCount = {"number", 0}, | |
56 | 57 | ltime = {"number", 0}, -- 最后登录时间 |
57 | 58 | ctime = {"number", skynet.timex()}, -- 创建时间 |
58 | 59 | ignoreMt = {"number", 0}, -- 忽略维护拦截 |
59 | - sversion = {"number", globalCsv.StructVersion or 0}, -- 重整数据版本 | |
60 | + sversion = {"number", STRUCT_VERSION or 0}, -- 重整数据版本 | |
60 | 61 | timeReset = {"table", {}}, --重置轮回记录 |
61 | 62 | diamond = {"number", 0}, |
62 | 63 | reDiamond = {"number", 0}, |
... | ... | @@ -355,6 +356,7 @@ function Role:data() |
355 | 356 | advSup = self:getProperty("advSup"), |
356 | 357 | advC = self:getProperty("advC"), |
357 | 358 | advCT = self:getProperty("advCT"), |
359 | + advRelay = self:getProperty("advRelay"), | |
358 | 360 | |
359 | 361 | hangPass = self:getProperty("hangPass"), |
360 | 362 | hangGift = self:getProperty("hangGift"), | ... | ... |
src/models/RoleBattle.lua
... | ... | @@ -21,13 +21,153 @@ local BattleType = { |
21 | 21 | |
22 | 22 | RoleBattle.bind = function (Role) |
23 | 23 | |
24 | +local checkCheatAttrs = { | |
25 | + ["hp"] = 1, | |
26 | + ["atk"] = 1, | |
27 | + ["def"] = 1, | |
28 | + ["hit"] = 1, | |
29 | + ["miss"] = 1, | |
30 | + ["crit"] = 1, | |
31 | + ["atkSpeed"] = 1, | |
32 | + ["critHurt"] = 1, | |
33 | + -- ["vampire"] = 1, | |
34 | + -- ["pierce"] = 1, | |
35 | +} | |
24 | 36 | |
25 | --- TODO 检查战斗是否作弊 | |
26 | -local function checkBattleCheat() | |
27 | - | |
37 | +local function checkOneCheat(selfTeamClient, selfTeamServer, enemyClient, enemyServer) | |
38 | + if not selfTeamClient or type(selfTeamClient) ~= "table" then return end | |
39 | + for unitType, clientInfo in pairs(selfTeamClient) do | |
40 | + local serverInfo = selfTeamServer[unitType] | |
41 | + if not serverInfo then return end | |
42 | + for attr, pm in pairs(checkCheatAttrs) do | |
43 | + if not clientInfo[attr] then return end | |
44 | + end | |
45 | + local b1 = ((clientInfo["hp"] + clientInfo["def"] * 7 + clientInfo["miss"] * 4) * (clientInfo["atk"] * 4 + clientInfo["hit"] * 2) * (1 + clientInfo["crit"]/100 * clientInfo["critHurt"]/100) * clientInfo["atkSpeed"] / 600000) ^ 0.8 | |
46 | + local b2 = ((serverInfo["hp"] + serverInfo["def"] * 7 + serverInfo["miss"] * 4) * (serverInfo["atk"] * 4 + serverInfo["hit"] * 2) * (1 + serverInfo["crit"]/100 * serverInfo["critHurt"]/100) * serverInfo["atkSpeed"] / 600000) ^ 0.8 | |
47 | + if b1 >= b2 * 2 then | |
48 | + return | |
49 | + end | |
50 | + end | |
51 | + return true | |
28 | 52 | end |
29 | 53 | |
54 | +-- local function getRobotAttrs(info, strength) | |
55 | +-- strength = strength or 10000 | |
56 | +-- local unitData = csvdb["unitCsv"][info.unitType] | |
57 | +-- local enemy = {} | |
58 | +-- for arr, _ in pairs(checkCheatAttrs) do | |
59 | +-- enemy[arr] = unitData[attr] * info[attr] * strength / 10000 | |
60 | +-- end | |
61 | +-- return enemy | |
62 | +-- end | |
63 | + | |
64 | +-- --通过配表构建敌人队伍 通用 | |
65 | +-- function BattleEnter:packBattleEnemyCommon( carbonData ) | |
66 | +-- local enemys = {} | |
67 | +-- local monsterSet = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | |
68 | +-- for phase = 1, #monsterSet do | |
69 | +-- local allEnemys = table.values(monsterSet[phase]) | |
70 | +-- table.sort(allEnemys, function(a, b) return a.id < b.id end) | |
71 | +-- local heros = {} | |
72 | +-- for idx, enemy in ipairs(allEnemys) do | |
73 | +-- local info = getRobotAttrs(enemy, carbonData.strength) | |
74 | +-- enemys[idx] = info | |
75 | +-- end | |
76 | +-- break | |
77 | +-- end | |
78 | +-- return enemys | |
79 | +-- end | |
80 | + | |
81 | +-- 检查战斗是否作弊 | |
82 | +function Role:checkBattleCheat(battleType, params) | |
83 | + if not params.isWin then return true end | |
84 | + local clientInfo = params.info or {} | |
85 | + | |
86 | + if not BattleType[battleType] then | |
87 | + print(string.format("NO find battleType: %s", battleType)) | |
88 | + return true | |
89 | + end | |
90 | + local selfTeamServer = {} | |
91 | + local enemyServer = {} | |
92 | + | |
93 | + local cheat = {} | |
94 | + cheat["hang"] = function() | |
95 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Hang)) | |
96 | + for slot, hero in pairs(team.heros) do | |
97 | + local temp = {} | |
98 | + for arr, _ in pairs(checkCheatAttrs) do | |
99 | + temp[arr] = hero[arr] | |
100 | + end | |
101 | + selfTeamServer[hero.type] = temp | |
102 | + end | |
103 | + -- local carbonData = csvdb["idle_battleCsv"][params.id] | |
104 | + -- enemyServer = packBattleEnemyCommon(carbonData) | |
105 | + end | |
106 | + cheat["tower"] = function() | |
107 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Tower)) | |
108 | + for slot, hero in pairs(team.heros) do | |
109 | + local temp = {} | |
110 | + for arr, _ in pairs(checkCheatAttrs) do | |
111 | + temp[arr] = hero[arr] | |
112 | + end | |
113 | + selfTeamServer[hero.type] = temp | |
114 | + end | |
115 | + -- local carbonData = csvdb["tower_battleCsv"][params.id] | |
116 | + -- enemyServer = packBattleEnemyCommon(carbonData) | |
117 | + end | |
118 | + cheat["bonus"] = function() | |
119 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.BonusBattle)) | |
120 | + for slot, hero in pairs(team.heros) do | |
121 | + local temp = {} | |
122 | + for arr, _ in pairs(checkCheatAttrs) do | |
123 | + temp[arr] = hero[arr] | |
124 | + end | |
125 | + selfTeamServer[hero.type] = temp | |
126 | + end | |
127 | + -- local carbonData = csvdb["bonus_battleCsv"][params.id] | |
128 | + -- enemyServer = packBattleEnemyCommon(carbonData) | |
129 | + end | |
130 | + cheat["pvpc"] = function() | |
131 | + if not params.format then return end | |
132 | + local team = self:getTeamBattleInfo(params.format) | |
133 | + for slot, hero in pairs(team.heros) do | |
134 | + local temp = {} | |
135 | + for arr, _ in pairs(checkCheatAttrs) do | |
136 | + temp[arr] = hero[arr] | |
137 | + end | |
138 | + selfTeamServer[hero.type] = temp | |
139 | + end | |
140 | + end | |
141 | + cheat["pvph"] = cheat["pvpc"] | |
142 | + cheat["act_battle"] = cheat["pvpc"] | |
143 | + | |
144 | + cheat[battleType]() | |
145 | + | |
146 | + local status = checkOneCheat(clientInfo.selfAttr, selfTeamServer, clientInfo.enemyAttr, enemyServer) | |
147 | + if not status then | |
148 | + -- local cheatCount = self:getProperty("cheatCount") | |
149 | + -- cheatCount = cheatCount + 1 | |
150 | + -- self:setProperty("cheatCount", cheatCount) | |
151 | + | |
152 | + local result = {clientSelf = {}, serverSelf = {}} | |
153 | + for k , v in pairs(clientInfo.selfAttr or {}) do | |
154 | + result.clientSelf[tostring(k)] = v | |
155 | + end | |
156 | + for k , v in pairs(selfTeamServer) do | |
157 | + result.serverSelf[tostring(k)] = v | |
158 | + end | |
159 | + result = json.encode(result) | |
160 | + self:mylog("cheat", {desc = battleType, int1 = 1, text1 = result}) | |
30 | 161 | |
162 | + -- for _, v in ipairs(globalCsv.cheat_check) do | |
163 | + -- if cheatCount == v[1] then | |
164 | + -- self:setBan(v[2] / 86400, 5) | |
165 | + -- break | |
166 | + -- end | |
167 | + -- end | |
168 | + end | |
169 | + return true | |
170 | +end | |
31 | 171 | |
32 | 172 | function Role:checkBattle(battleType, params) |
33 | 173 | local clientInfo = params.info or {} | ... | ... |
src/models/RoleChangeStruct.lua
... | ... | @@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params) |
31 | 31 | print("awardGift" .. " >>> " .. params) |
32 | 32 | end) |
33 | 33 | |
34 | + | |
34 | 35 | local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params) |
35 | 36 | local sudoku = role:getProperty("sudoku") |
36 | 37 | local phase = sudoku[-1] or 1 |
... | ... | @@ -48,11 +49,38 @@ local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params |
48 | 49 | end |
49 | 50 | end) |
50 | 51 | |
52 | +local bugFixRune = createVersionFunc(VersionType.DoOnly, function(role, params) | |
53 | + local had = false | |
54 | + for id, rune in pairs(role.runeBag) do | |
55 | + if math.floor(rune:getProperty("id") / 1000) == 16 then | |
56 | + local attrs = rune:getProperty("attrs") | |
57 | + local atk = attrs:getv(2, 0) | |
58 | + if atk ~= 0 then | |
59 | + attrs = attrs:delk(2):setv(1, atk) | |
60 | + had = true | |
61 | + rune:setProperty("attrs",attrs) | |
62 | + end | |
63 | + end | |
64 | + end | |
65 | + if had then | |
66 | + -- 补偿 | |
67 | + end | |
68 | +end) | |
69 | + | |
70 | +-- 清除 player 消失 的冒险 | |
71 | +local bugFixAdvPlayer = createVersionFunc(VersionType.Override, function(role, params) | |
72 | + if role:getAdvData():isRunning() and not role:getProperty("advTeam").player then | |
73 | + role:getAdvData():forceOver(true) | |
74 | + end | |
75 | +end) | |
76 | + | |
51 | 77 | ---------------------版本方法 end ---------------------- |
52 | 78 | |
53 | 79 | -- version 罗列start |
54 | 80 | local versionList = {} -- version 列表 |
55 | 81 | versionList[1] = {bugFixSuduku, {}} |
82 | +versionList[2] = {bugFixRune, {}} | |
83 | +versionList[3] = {bugFixAdvPlayer, {}} | |
56 | 84 | -- versionList[2] = {clearActivity, {5, 7}} |
57 | 85 | -- versionList[3] = {changeStructF, "test1"} |
58 | 86 | -- versionList[4] = {changeStructF, "test2"} |
... | ... | @@ -69,11 +97,11 @@ function RoleChangeStruct.bind(Role) |
69 | 97 | |
70 | 98 | function Role:changeStructVersion() |
71 | 99 | local curVersion = self:getProperty("sversion") |
72 | - if not globalCsv.StructVersion or curVersion >= globalCsv.StructVersion then return end | |
100 | + if not STRUCT_VERSION or curVersion >= STRUCT_VERSION then return end | |
73 | 101 | |
74 | 102 | local jumpVersion = {} |
75 | 103 | local versionTemp = {} |
76 | - for version = curVersion + 1, globalCsv.StructVersion do | |
104 | + for version = curVersion + 1, STRUCT_VERSION do | |
77 | 105 | local versionData = versionList[version] |
78 | 106 | if versionData then |
79 | 107 | if versionData[1].vType == VersionType.DoOnly then |
... | ... | @@ -106,7 +134,7 @@ function RoleChangeStruct.bind(Role) |
106 | 134 | end |
107 | 135 | end |
108 | 136 | |
109 | - for version = curVersion + 1, globalCsv.StructVersion do | |
137 | + for version = curVersion + 1, STRUCT_VERSION do | |
110 | 138 | if not jumpVersion[version] then |
111 | 139 | local versionData = versionList[version] |
112 | 140 | if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then |
... | ... | @@ -116,7 +144,7 @@ function RoleChangeStruct.bind(Role) |
116 | 144 | end |
117 | 145 | end |
118 | 146 | end |
119 | - self:setProperty("sversion", globalCsv.StructVersion) | |
147 | + self:setProperty("sversion", STRUCT_VERSION) | |
120 | 148 | end |
121 | 149 | |
122 | 150 | end | ... | ... |
src/models/RoleLog.lua
... | ... | @@ -51,6 +51,8 @@ local ItemReason = { |
51 | 51 | actBattle = 135, -- 活动关卡 |
52 | 52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 |
53 | 53 | worldBossReward = 137, -- 世界boss翻牌奖励 |
54 | + commonSign = 138, -- 每日活跃签到 | |
55 | + actFriendHelp = 139,-- 好友能量互助活动 | |
54 | 56 | |
55 | 57 | |
56 | 58 | advHang = 301, -- 拾荒挂机 |
... | ... | @@ -122,6 +124,7 @@ local ItemReason = { |
122 | 124 | |
123 | 125 | -- pvp |
124 | 126 | pvpCHead = 1301, -- pvp 跨服竞技场头像 |
127 | + crossPvpBet = 1302, -- 竞猜 | |
125 | 128 | |
126 | 129 | --adv |
127 | 130 | chooseEvent = 1351, -- 冒险选择 |
... | ... | @@ -591,6 +594,7 @@ local LogType = { |
591 | 594 | guide = "common", |
592 | 595 | newdevice = "common", |
593 | 596 | cbback = "common", |
597 | + cheat = "common", | |
594 | 598 | |
595 | 599 | in_item = "common", |
596 | 600 | out_item = "common", | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -131,6 +131,9 @@ function RolePlugin.bind(Role) |
131 | 131 | self:addItem(pms) |
132 | 132 | end |
133 | 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 | 139 | count = checkItemCount(self, itemId, count) |
... | ... | @@ -286,10 +289,41 @@ function RolePlugin.bind(Role) |
286 | 289 | print("addPlayExp no log ", debug.traceback()) |
287 | 290 | end |
288 | 291 | |
289 | - self:updateProperties({level = level, exp = newExp}) | |
292 | + self:updateProperties({level = level, exp = newExp}, params.notNotify) | |
290 | 293 | self:changeCrossServerPvpSelfInfo("level") |
291 | 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 | 327 | function Role:addItem(params) |
294 | 328 | params = params or {} |
295 | 329 | params.count = math.floor(params.count or 0) |
... | ... | @@ -387,7 +421,7 @@ function RolePlugin.bind(Role) |
387 | 421 | end |
388 | 422 | |
389 | 423 | if update then |
390 | - self:updateProperty({field = "boxL", value = boxL}) | |
424 | + self:updateProperty({field = "boxL", value = boxL, notNotify = pms.notNotify}) | |
391 | 425 | end |
392 | 426 | end |
393 | 427 | |
... | ... | @@ -804,9 +838,16 @@ function RolePlugin.bind(Role) |
804 | 838 | return runeSet |
805 | 839 | end |
806 | 840 | |
807 | - function Role:getAdvData() | |
841 | + function Role:getAdvData(notNotify) | |
808 | 842 | if not self.advData then |
809 | 843 | self.advData = require("adv.Adv").new(self) |
844 | + local status, err = pcall(function() | |
845 | + self.advData:initByInfo() | |
846 | + end) | |
847 | + if not status then | |
848 | + self.advData:forceOver(notNotify, true) | |
849 | + skynet.error("getAdvData error adv initByInfo " .. err) | |
850 | + end | |
810 | 851 | end |
811 | 852 | return self.advData |
812 | 853 | end |
... | ... | @@ -830,7 +871,6 @@ function RolePlugin.bind(Role) |
830 | 871 | self:setProperty("heartWarning", heartWarning) |
831 | 872 | if heartWarning == 50 then |
832 | 873 | self:setBan(30, 1) --封禁 30天 |
833 | - self:sendGmMsg("server_accountBanned_inGame_1") | |
834 | 874 | return |
835 | 875 | end |
836 | 876 | if heartWarning < 50 and heartWarning % 5 == 0 then |
... | ... | @@ -843,21 +883,52 @@ function RolePlugin.bind(Role) |
843 | 883 | time = time or 0 |
844 | 884 | banType = banType or 0 |
845 | 885 | local now = skynet.timex() |
846 | - if time == 0 then | |
886 | + if time <= 0 then | |
847 | 887 | self:setProperty("banTime", 0) |
848 | 888 | self:setProperty("banType", 0) |
849 | 889 | self:setProperty("heartWarning", 0) |
850 | - | |
851 | 890 | self:mylog("role_action", {desc = "ban_rm"}) |
852 | 891 | else |
853 | - self:setProperty("banTime", now + 86400 * time) | |
892 | + self:sendGmMsg(globalCsv.ban_tips[banType] or globalCsv.ban_tips[0]) | |
893 | + self:setProperty("banTime", math.ceil(now + 86400 * time)) | |
854 | 894 | self:setProperty("banType", banType) |
855 | - self:mylog("role_action", {desc = "ban", int1 = time, int2 = banType}) | |
895 | + self:resetRank() | |
896 | + self:mylog("role_action", {desc = "ban", int1 = math.ceil(time), int2 = banType}) | |
856 | 897 | end |
857 | 898 | end |
858 | 899 | |
900 | + -- 清掉所有排行榜 | |
901 | + function Role:resetRank() | |
902 | + local roleId = self:getProperty("id") | |
903 | + redisproxy:pipelining(function (red) | |
904 | + red:zrem(RANK_TOWER, roleId) | |
905 | + for _, rk in pairs(RANK_ADV) do | |
906 | + red:zrem(rk, roleId) | |
907 | + end | |
908 | + for _, rk in pairs(RANK_DINER) do | |
909 | + red:zrem(rk, roleId) | |
910 | + end | |
911 | + for _, rk in pairs(RANK_PVP_COMMON_KEY) do | |
912 | + red:zrem(rk, roleId) | |
913 | + end | |
914 | + for _, rk in pairs(RANK_PVP_HIGHT_KEY) do | |
915 | + red:zrem(rk, roleId) | |
916 | + end | |
917 | + for _, ct in pairs(RANK_TYPE) do | |
918 | + red:zrem(RANK_COMMON .. ct, roleId) | |
919 | + end | |
920 | + end) | |
921 | + end | |
922 | + | |
859 | 923 | function Role:sendGmMsg(text, isNotKey) |
860 | 924 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) |
925 | + | |
926 | + local agent = datacenter.get("agent", self:getProperty("id")) | |
927 | + if agent then | |
928 | + skynet.timeout(50, function () | |
929 | + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | |
930 | + end) | |
931 | + end | |
861 | 932 | end |
862 | 933 | |
863 | 934 | -- function Role:getHeroActiveRelationData(heros) |
... | ... | @@ -1470,6 +1541,7 @@ function RolePlugin.bind(Role) |
1470 | 1541 | return function (now, role) |
1471 | 1542 | if name == "email" and role.sendMailFlag then |
1472 | 1543 | last_breath = now + sec |
1544 | + role.sendMailFlag = false | |
1473 | 1545 | return true |
1474 | 1546 | end |
1475 | 1547 | if now >= last_breath then |
... | ... | @@ -1505,8 +1577,15 @@ function RolePlugin.bind(Role) |
1505 | 1577 | end) |
1506 | 1578 | for _, data in ipairs(redret) do |
1507 | 1579 | local email = tarr2tab(data) |
1508 | - if tonum(email.createtime) > self:getProperty("ctime") | |
1509 | - and ( not email.mid or tonum(email.mid) == mid ) | |
1580 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 | |
1581 | + local delayType = tonum(email.delayType) | |
1582 | + local flag = false | |
1583 | + if delayType == 1 then | |
1584 | + flag = skynet.timex() > tonum(email.createtime) | |
1585 | + else | |
1586 | + flag = tonum(email.createtime) > self:getProperty("ctime") | |
1587 | + end | |
1588 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | |
1510 | 1589 | and ( not email.endtime or tonum(email.endtime) > now )then |
1511 | 1590 | return true |
1512 | 1591 | end |
... | ... | @@ -1543,7 +1622,6 @@ function RolePlugin.bind(Role) |
1543 | 1622 | if table.pack(next(newReward))[2] >= divisionData.limit then |
1544 | 1623 | return true |
1545 | 1624 | end |
1546 | - | |
1547 | 1625 | end |
1548 | 1626 | |
1549 | 1627 | local events = {} |
... | ... | @@ -1596,8 +1674,34 @@ function RolePlugin.bind(Role) |
1596 | 1674 | self:updateProperty({field = "redp", value = redp}) |
1597 | 1675 | end |
1598 | 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 | + | |
1599 | 1703 | -- 获取充值订单号 |
1600 | - function Role:getPurchaseOrder(rechargeId) | |
1704 | + function Role:getPurchaseOrder(rechargeId, transactionId) | |
1601 | 1705 | local roleId = self:getProperty("id") |
1602 | 1706 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
1603 | 1707 | if not rechargeData then |
... | ... | @@ -1634,6 +1738,7 @@ function RolePlugin.bind(Role) |
1634 | 1738 | order = partnerOrderId, |
1635 | 1739 | rechargeId = rechargeId, |
1636 | 1740 | createTime = skynet.timex(), |
1741 | + transactionId = transactionId, | |
1637 | 1742 | }) |
1638 | 1743 | order:create() |
1639 | 1744 | -- 正在进行中的订单 缓存 |
... | ... | @@ -1666,6 +1771,9 @@ function RolePlugin.bind(Role) |
1666 | 1771 | local dataSet = csvdb["shop_rechargeCsv"][rechargeId] |
1667 | 1772 | |
1668 | 1773 | if orderObject:getProperty("finishTime") > 0 then |
1774 | + skynet.error(string.format("[recharge] is a finish order cpOrder: %s, platformOrder : %s, hadPlatformOrder: %s, id: %s, overTime : %s", | |
1775 | + partnerOrderStr, platformOrder, orderObject:getProperty("transactionId"), rechargeId, orderObject:getProperty("finishTime") | |
1776 | + )) | |
1669 | 1777 | return false, "finsh" |
1670 | 1778 | end |
1671 | 1779 | |
... | ... | @@ -1709,12 +1817,12 @@ function RolePlugin.bind(Role) |
1709 | 1817 | request.product_id = data.product_id |
1710 | 1818 | request.pay_time = data.pay_time |
1711 | 1819 | request.transactionId = data.order_no |
1820 | + request.extension_info = data.extension_info | |
1712 | 1821 | ]] |
1713 | 1822 | function Role:handlePurchase(params) |
1714 | 1823 | local roleId = self:getProperty("id") |
1715 | 1824 | local partnerOrderStr = params.order |
1716 | 1825 | |
1717 | - | |
1718 | 1826 | local status, back = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") |
1719 | 1827 | if not status then |
1720 | 1828 | if back == "finsh" then |
... | ... | @@ -1740,6 +1848,10 @@ function RolePlugin.bind(Role) |
1740 | 1848 | }) |
1741 | 1849 | |
1742 | 1850 | if not status then |
1851 | + if params.extension_info == "mycard_web" then | |
1852 | + -- todo 发邮件 | |
1853 | + skynet.error("mycard_web " .. params.order) | |
1854 | + end | |
1743 | 1855 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, |
1744 | 1856 | result = "success", reward = reward})) |
1745 | 1857 | end | ... | ... |
src/models/RolePvp.lua
... | ... | @@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 |
9 | 9 | local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分 |
10 | 10 | |
11 | 11 | -- 匹配规则改为以排名来匹配 |
12 | -local PVP_GET_ROBOT_SCORE = 2400 -- 2400分以下低档位匹配机器人 | |
12 | +local PVP_GET_ROBOT_SCORE = 1300 -- 1300分以下低档位匹配机器人 | |
13 | 13 | local PRE_RANGE_COUNT = 20 -- 每个档位人数 |
14 | 14 | local NEED_MATCH = 3 --匹配到多少人 |
15 | 15 | |
... | ... | @@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin) |
73 | 73 | if isWin then |
74 | 74 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400))) |
75 | 75 | myScore = myScore + scoreChange |
76 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | |
76 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 | |
77 | 77 | else |
78 | 78 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400))) |
79 | 79 | myScore = myScore - scoreChange |
... | ... | @@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin) |
139 | 139 | if isWin then |
140 | 140 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000))) |
141 | 141 | myScore = myScore + scoreChange |
142 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | |
142 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 | |
143 | 143 | else |
144 | 144 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000))) |
145 | 145 | myScore = myScore - scoreChange |
... | ... | @@ -521,7 +521,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) |
521 | 521 | change[cType] = self:getProperty(cType) |
522 | 522 | elseif cType == "format" then |
523 | 523 | -- 是否过了时间 |
524 | - local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) | |
524 | + local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) + RESET_TIME * 3600 | |
525 | 525 | local aday = 3600 * 24 |
526 | 526 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
527 | 527 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 |
... | ... | @@ -530,7 +530,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) |
530 | 530 | return |
531 | 531 | end |
532 | 532 | change.battleV = self:getProperty("pvpTBVH") |
533 | - change.heros = self:getProperty("pvpTSH") | |
533 | + change.team = self:getProperty("pvpTSH") | |
534 | 534 | change.battleInfo = self:getProperty("pvpTBH") |
535 | 535 | end |
536 | 536 | |
... | ... | @@ -615,7 +615,7 @@ end |
615 | 615 | |
616 | 616 | function Role:setCrossServerPvpBet(idx) |
617 | 617 | if not self:isTimeResetOpen(TimeReset.PvpCross) then return false , 1 end |
618 | - local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) | |
618 | + local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) + RESET_TIME * 3600 | |
619 | 619 | local aday = 3600 * 24 |
620 | 620 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
621 | 621 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | ... | ... |
src/models/RoleTask.lua
... | ... | @@ -34,6 +34,7 @@ local TaskType = { |
34 | 34 | HangBattle = 304, -- 挂机战斗 - id |
35 | 35 | HangGetGold = 305, -- 挂机获得齿轮 - count |
36 | 36 | BonusPass = 306, -- 奖励副本通关 - id count |
37 | + BonusQuick = 307, -- 奖励关卡扫荡 -- id count | |
37 | 38 | |
38 | 39 | -- 冒险相关 |
39 | 40 | AdvPass = 401, -- 冒险通过关 - id level score |
... | ... | @@ -50,6 +51,9 @@ local TaskType = { |
50 | 51 | AdvHang = 412, -- 代理拾荒次数 |
51 | 52 | AdvMineKill = 413, -- 宝藏怪击杀 |
52 | 53 | AdvMineLayer = 414, -- 宝藏洞激活 |
54 | + AdvKillBoss = 415, -- 拾荒击杀boss | |
55 | + AdvHangHeroCnt = 416, -- 拾荒人数 | |
56 | + AdvPassFirst = 417, -- 冒险首次通关 - id | |
53 | 57 | |
54 | 58 | --爬塔相关 |
55 | 59 | TowerPass = 501, -- 爬塔通关 - level |
... | ... | @@ -91,6 +95,9 @@ local TaskType = { |
91 | 95 | SignIn = 901, -- 签到 |
92 | 96 | Pay = 902, -- 充值 |
93 | 97 | ShopAll = 903, -- 在任意商店购买 |
98 | + DailyTask = 904, -- 完成每日活跃任务 | |
99 | + RadioTaskStart = 905, -- 电台任务开始 | |
100 | + FinishSpeTask = 906, -- 指定任务完成 | |
94 | 101 | |
95 | 102 | --功能未实现 todo |
96 | 103 | AdvShop = 1002, -- 冒险商城 |
... | ... | @@ -231,6 +238,7 @@ local ActivityListener = { |
231 | 238 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
232 | 239 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
233 | 240 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
241 | + [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, | |
234 | 242 | } |
235 | 243 | } |
236 | 244 | |
... | ... | @@ -240,7 +248,7 @@ local StoreListener = { |
240 | 248 | [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}}, |
241 | 249 | [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}}, |
242 | 250 | [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}}, |
243 | - [TaskType.AdvPass] = {{TriggerEventType.AdvPass, f("id")}}, | |
251 | + [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}}, | |
244 | 252 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, |
245 | 253 | } |
246 | 254 | } |
... | ... | @@ -268,6 +276,14 @@ local CalendaTaskListener = { |
268 | 276 | [TaskType.HangGet]= {{18, 3, f("reward")}}, |
269 | 277 | [TaskType.RuneQualityCollect]= {{19, 3}}, |
270 | 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 | + | |
271 | 287 | } |
272 | 288 | } |
273 | 289 | |
... | ... | @@ -690,7 +706,7 @@ function RoleTask.bind(Role) |
690 | 706 | calTask[id] = count |
691 | 707 | elseif cfg.type == 20 then -- 开启x品质时钟箱子 |
692 | 708 | if cfg.condition2 <= (param2 or 0) then |
693 | - calTask[id] = (calTask[id] or 0) + param2 | |
709 | + calTask[id] = (calTask[id] or 0) + param1 | |
694 | 710 | end |
695 | 711 | elseif cfg.type == 15 then -- 通关关卡 |
696 | 712 | if (calTask[id] or 0) == 0 then |
... | ... | @@ -700,6 +716,15 @@ function RoleTask.bind(Role) |
700 | 716 | calTask[id] = 1 |
701 | 717 | end |
702 | 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 | |
703 | 728 | end |
704 | 729 | end |
705 | 730 | end |
... | ... | @@ -712,4 +737,4 @@ function RoleTask.bind(Role) |
712 | 737 | |
713 | 738 | end |
714 | 739 | |
715 | -return RoleTask | |
716 | 740 | \ No newline at end of file |
741 | +return RoleTask | ... | ... |
src/models/RoleTimeReset.lua
... | ... | @@ -23,6 +23,11 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) |
23 | 23 | end |
24 | 24 | self:setProperty("advMine", advMine) |
25 | 25 | |
26 | + local ltime = self:getProperty("ltime") | |
27 | + if isCrossMonth(ltime, now) then | |
28 | + self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id | |
29 | + end | |
30 | + | |
26 | 31 | response.dTask = {} |
27 | 32 | response.advSup = self:getProperty("advSup") |
28 | 33 | self:log("onLogin") |
... | ... | @@ -43,13 +48,6 @@ ResetFunc["CrossWeek"] = function(self, notify, response) |
43 | 48 | response.dinerS = {} |
44 | 49 | end |
45 | 50 | |
46 | -ResetFunc["CrossMonth"] = function(self, notify, response) | |
47 | - local ltime = self:getProperty("ltime") | |
48 | - if isCrossMonth(ltime, skynet.timex()) then | |
49 | - self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id | |
50 | - end | |
51 | -end | |
52 | - | |
53 | 51 | |
54 | 52 | ResetFunc["DinerRank"] = function(self, notify, response) |
55 | 53 | self.dinerData:rankResetData(notify) |
... | ... | @@ -89,13 +87,10 @@ function Role:updateTimeReset(now, notify) |
89 | 87 | ResetFunc[funcName](self, notify, response, now) |
90 | 88 | resetMode[funcName] = true |
91 | 89 | end |
92 | - if needResetId[resetId] then | |
93 | - -- 充值商城购买记录 | |
94 | - self.storeData:resetStoreReored(resetId) | |
95 | - end | |
96 | 90 | end |
97 | 91 | |
98 | 92 | for resetId, round in pairs(needResetId) do |
93 | + self.storeData:resetStoreReored(resetId) | |
99 | 94 | timeReset[resetId] = round |
100 | 95 | end |
101 | 96 | self:setProperties({timeReset = timeReset, ltime = now}) | ... | ... |
src/services/globald.lua
... | ... | @@ -69,7 +69,8 @@ local function mailQuene() |
69 | 69 | "attachments", email.attachments, |
70 | 70 | "endtime", email.endTime, |
71 | 71 | "mid", email.mid, |
72 | - "timestamp", now | |
72 | + "timestamp", now, | |
73 | + "delayType", email.delayType | |
73 | 74 | ) |
74 | 75 | else |
75 | 76 | redisproxy:hmset(string_format("globalEmail:%s", gid), |
... | ... | @@ -80,7 +81,8 @@ local function mailQuene() |
80 | 81 | "content", email.content, |
81 | 82 | "attachments", email.attachments, |
82 | 83 | "endtime", email.endTime, |
83 | - "timestamp", now | |
84 | + "timestamp", now, | |
85 | + "delayType", email.delayType | |
84 | 86 | ) |
85 | 87 | end |
86 | 88 | end | ... | ... |
src/services/pvpd.lua
... | ... | @@ -84,7 +84,7 @@ function CMD.updateRoleInfo(change) |
84 | 84 | CMD.refreshRoleInfo(change) |
85 | 85 | local pvpd = cluster.query("center", "pvpd") |
86 | 86 | if pvpd then |
87 | - pcall(cluster.call, "center", pvpd, "updateRoleInfo", change) | |
87 | + pcall(cluster.send, "center", pvpd, "updateRoleInfo", change) | |
88 | 88 | end |
89 | 89 | end |
90 | 90 | |
... | ... | @@ -92,7 +92,7 @@ local function getDayAndTime() |
92 | 92 | local startTime = getStartTime() |
93 | 93 | local now = skynet.timex() |
94 | 94 | |
95 | - local crossTime = now - startTime | |
95 | + local crossTime = now - startTime + RESET_TIME * 3600 | |
96 | 96 | local aday = 3600 * 24 |
97 | 97 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
98 | 98 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | ... | ... |
src/utils/CommonFunc.lua
... | ... | @@ -100,7 +100,7 @@ end |
100 | 100 | -- 判断是不是同一个月 |
101 | 101 | function isCrossMonth(target, now) |
102 | 102 | now = now or skynet.timex() |
103 | - local tarTm = os.date("*t", target) | |
103 | + local tarTm = os.date("*t", target - RESET_TIME * 3600) | |
104 | 104 | local nowTm = os.date("*t", now - RESET_TIME * 3600) |
105 | 105 | if tarTm.year == nowTm.year and tarTm.month == nowTm.month then |
106 | 106 | return false | ... | ... |