Commit 1cbe35d88cf9852e0d6560c54eef1f95b04e3de5
Merge branch 'cn/develop' into cn/develop-mysql
* cn/develop: (136 commits) 付费钻区分ios钻和android钻 修改gm添加满级英雄指令,开启特权时,加速道具效果未受影响 gm 奖励 获取有效期物品 增加gm 方法 每日抽卡礼包bug 每日抽卡限时礼包触发时,清空购买记录 添加活动关卡gm指令, 活动代理拾荒数据清理 新春签到代码优化,支持不同时开同类型的签到活动,方便后期复用 新春签到领奖方法里 漏掉了一个int转string 拾荒活动积分up 新春签到 记录字段值的key改成string 拾荒bug 每日抽卡次数触发礼包 第一层奖励 错误单词 重置preload服务器时间 新春活动任务 第一层也发奖 假的boss 没有效果 ...
Showing
42 changed files
with
2710 additions
and
486 deletions
Show diff stats
src/GlobalVar.lua
@@ -16,6 +16,9 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", | @@ -16,6 +16,9 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", | ||
16 | 16 | ||
17 | START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 | 17 | START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 |
18 | 18 | ||
19 | +STRUCT_VERSION = 3 -- 数据结构版本 | ||
20 | + | ||
21 | +IOS_SID = 4 -- 判断是不是ios设备 | ||
19 | 22 | ||
20 | MAX_ROLE_NUM = 1000000 | 23 | MAX_ROLE_NUM = 1000000 |
21 | -- 属性枚举 | 24 | -- 属性枚举 |
@@ -72,7 +75,7 @@ ItemType = { | @@ -72,7 +75,7 @@ ItemType = { | ||
72 | EquipBase = 9, -- 基础装备 | 75 | EquipBase = 9, -- 基础装备 |
73 | Rune = 10, -- 符文 | 76 | Rune = 10, -- 符文 |
74 | Cuisine = 11, -- 料理(用于增加好感度、贩卖获得金币) | 77 | Cuisine = 11, -- 料理(用于增加好感度、贩卖获得金币) |
75 | - LunchBox = 12, -- 便当盒(料理合成,冒险系统消耗道具) | 78 | + Potion = 12, -- 拾荒药剂 |
76 | TimeBox = 13, -- 时间箱(开启需要时间,随机产出道具) | 79 | TimeBox = 13, -- 时间箱(开启需要时间,随机产出道具) |
77 | AdvItem = 14, -- 冒险道具 | 80 | AdvItem = 14, -- 冒险道具 |
78 | FuncOpen = 15, -- 管理功能开放 | 81 | FuncOpen = 15, -- 管理功能开放 |
@@ -141,7 +144,6 @@ ItemId = { | @@ -141,7 +144,6 @@ ItemId = { | ||
141 | TimeReset = { | 144 | TimeReset = { |
142 | CrossDay = 1, --通用跨天 | 145 | CrossDay = 1, --通用跨天 |
143 | CrossWeek = 2, --通用跨周 | 146 | CrossWeek = 2, --通用跨周 |
144 | - CrossMonth = 1, --通用跨月 索引使用跨天,在回调方法中判断是否跨越 跨月的前置条件是跨天 | ||
145 | DinerRank = 1, -- 餐厅排行榜 | 147 | DinerRank = 1, -- 餐厅排行榜 |
146 | PvpRank = 2, -- pvp排行榜 | 148 | PvpRank = 2, -- pvp排行榜 |
147 | PvpHight = 11, --高级竞技场 | 149 | PvpHight = 11, --高级竞技场 |
@@ -155,6 +157,23 @@ TimeReset = { | @@ -155,6 +157,23 @@ TimeReset = { | ||
155 | DrawType3 = 19, -- 魔法 抽卡加成 | 157 | DrawType3 = 19, -- 魔法 抽卡加成 |
156 | } | 158 | } |
157 | 159 | ||
160 | +-- TimeReset 索引数组 | ||
161 | +TimeResetArray = { | ||
162 | + "CrossDay", --通用跨天 | ||
163 | + "CrossWeek", --通用跨周 | ||
164 | + "DinerRank", -- 餐厅排行榜 | ||
165 | + "PvpRank", -- pvp排行榜 | ||
166 | + "PvpHight", --高级竞技场 | ||
167 | + "PvpCross", -- 跨服竞技场 | ||
168 | + "PvpShop", -- 竞技场商城 | ||
169 | + "DailyBattle2", -- 特殊-每日副本(贴纸) | ||
170 | + "DailyBattle1", -- 特殊-每日副本(装备) | ||
171 | + "DailyBattle3", -- 特殊-每日副本(时钟箱) | ||
172 | + "DrawType1", -- 变异 抽卡加成 | ||
173 | + "DrawType2", -- 通常 抽卡加成 | ||
174 | + "DrawType3", -- 魔法 抽卡加成 | ||
175 | +} | ||
176 | + | ||
158 | GuideStep = { | 177 | GuideStep = { |
159 | AdvGuide = 41, | 178 | AdvGuide = 41, |
160 | AdvRelay = 42, | 179 | AdvRelay = 42, |
@@ -224,6 +243,8 @@ AdvBackEventType = { | @@ -224,6 +243,8 @@ AdvBackEventType = { | ||
224 | LinkChooseOver = 26, -- 连锁事件结束 | 243 | LinkChooseOver = 26, -- 连锁事件结束 |
225 | BuffEffect = 27, -- buff 效果 | 244 | BuffEffect = 27, -- buff 效果 |
226 | PassiveEffect = 28, -- 被动 效果 | 245 | PassiveEffect = 28, -- 被动 效果 |
246 | + ChooseDice = 29, -- 选择点随机效果 | ||
247 | + NoEffect = 30, -- 没有效果 | ||
227 | } | 248 | } |
228 | 249 | ||
229 | AdvScoreType = { | 250 | AdvScoreType = { |
@@ -290,6 +311,7 @@ CardType = { | @@ -290,6 +311,7 @@ CardType = { | ||
290 | BattleCard = 5, --赛季卡 | 311 | BattleCard = 5, --赛季卡 |
291 | PaySignCard = 6, -- 付费签到卡 | 312 | PaySignCard = 6, -- 付费签到卡 |
292 | BattlePassCard = 7, -- 探索指令 | 313 | BattlePassCard = 7, -- 探索指令 |
314 | + ActBattleCommandCard = 8, -- 战令活动卡 | ||
293 | } | 315 | } |
294 | 316 | ||
295 | ShopPackType = { | 317 | ShopPackType = { |
@@ -324,6 +346,8 @@ MailId = { | @@ -324,6 +346,8 @@ MailId = { | ||
324 | PayBackAward = 242, | 346 | PayBackAward = 242, |
325 | CBBackAward = 243, | 347 | CBBackAward = 243, |
326 | CBBackAward2 = 244, | 348 | CBBackAward2 = 244, |
349 | + ActivityPoolRet = 280, | ||
350 | + MyCardBuy = 300, | ||
327 | } | 351 | } |
328 | 352 | ||
329 | TriggerEventType = { | 353 | TriggerEventType = { |
@@ -334,6 +358,7 @@ TriggerEventType = { | @@ -334,6 +358,7 @@ TriggerEventType = { | ||
334 | AddNewHero = 5, | 358 | AddNewHero = 5, |
335 | SSRCount = 6, | 359 | SSRCount = 6, |
336 | AfterTs = 7, -- 某时间以后 | 360 | AfterTs = 7, -- 某时间以后 |
361 | + DrawHeroCnt = 8, -- 每日抽卡次数 | ||
337 | } | 362 | } |
338 | 363 | ||
339 | DrawCardType = { | 364 | DrawCardType = { |
src/ProtocolCode.lua
@@ -232,6 +232,13 @@ actionCodes = { | @@ -232,6 +232,13 @@ actionCodes = { | ||
232 | Activity_battleMilestoneRpc = 663, | 232 | Activity_battleMilestoneRpc = 663, |
233 | Activity_bossRewardRpc = 664, | 233 | Activity_bossRewardRpc = 664, |
234 | Activity_crisisMilestoneRpc = 665, | 234 | Activity_crisisMilestoneRpc = 665, |
235 | + Activity_commonSignRpc = 666, | ||
236 | + Activity_friendHelpRpc = 667, | ||
237 | + Activity_battleCommandRpc = 668, | ||
238 | + Activity_actBattleCommandTaskRpc = 669, | ||
239 | + Activity_newSignRpc = 670, | ||
240 | + Activity_advLevelRpc = 671, | ||
241 | + Activity_buyBattleCommandLvlRpc = 672, | ||
235 | 242 | ||
236 | Radio_startQuestRpc = 700, | 243 | Radio_startQuestRpc = 700, |
237 | Radio_finishQuestRpc = 701, | 244 | Radio_finishQuestRpc = 701, |
@@ -249,4 +256,4 @@ for key, value in pairs(actionCodes) do | @@ -249,4 +256,4 @@ for key, value in pairs(actionCodes) do | ||
249 | actionHandlers[value + rpcResponseBegin] = handlerName .. "Response" | 256 | actionHandlers[value + rpcResponseBegin] = handlerName .. "Response" |
250 | end | 257 | end |
251 | actionHandlers[value] = string.gsub(key, "_", ".") | 258 | actionHandlers[value] = string.gsub(key, "_", ".") |
252 | -end | ||
253 | \ No newline at end of file | 259 | \ No newline at end of file |
260 | +end |
src/RedisKeys.lua
@@ -47,6 +47,7 @@ FRIEND_KEY = "role:%d:friend" --哈希表 好友 | @@ -47,6 +47,7 @@ FRIEND_KEY = "role:%d:friend" --哈希表 好友 | ||
47 | FRIEND_APPLY_KEY = "role:%d:apply" -- sort set 申请列表 | 47 | FRIEND_APPLY_KEY = "role:%d:apply" -- sort set 申请列表 |
48 | FRIEND_BLACK_KEY = "role:%d:black" -- set 黑名单 | 48 | FRIEND_BLACK_KEY = "role:%d:black" -- set 黑名单 |
49 | FRIEND_POINT = "role:%d:point" -- set 当天送给我心的人 | 49 | FRIEND_POINT = "role:%d:point" -- set 当天送给我心的人 |
50 | +FRIEND_ENERGY = "role:%d:energy" -- set 送给我活动能量的好友 | ||
50 | FRIEND_RECOMMEND = "friend:recommend" -- sort set 登录排序 获取推荐好友 | 51 | FRIEND_RECOMMEND = "friend:recommend" -- sort set 登录排序 获取推荐好友 |
51 | CHAT_OFFLINE = "chat:offline:%d" --消息离线缓存 | 52 | CHAT_OFFLINE = "chat:offline:%d" --消息离线缓存 |
52 | 53 |
src/actions/ActivityAction.lua
@@ -259,7 +259,57 @@ function _M.actCalendaTaskRpc(agent, data) | @@ -259,7 +259,57 @@ function _M.actCalendaTaskRpc(agent, data) | ||
259 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | 259 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
260 | }) | 260 | }) |
261 | 261 | ||
262 | + role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) | ||
263 | + | ||
262 | SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) | 264 | SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) |
265 | + | ||
266 | + return true | ||
267 | +end | ||
268 | + | ||
269 | +function _M.actBattleCommandTaskRpc(agent, data) | ||
270 | + local role = agent.role | ||
271 | + local msg = MsgPack.unpack(data) | ||
272 | + local taskId = msg.id | ||
273 | + local calTask = role:getProperty("bcTask") or {} | ||
274 | + local record = calTask["r"] or {} | ||
275 | + local flag = record[taskId] or 0 | ||
276 | + if flag == 1 then return 1 end | ||
277 | + local open, actId = role.activity:isOpen("BattleCommandTask") | ||
278 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
279 | + if not open then return 2 end | ||
280 | + if not actData then return 3 end | ||
281 | + | ||
282 | + local taskList = csvdb["activity_taskCsv"][actData.condition] | ||
283 | + if not taskList then return 4 end | ||
284 | + local taskCfg = taskList[taskId] | ||
285 | + if not taskCfg then return 5 end | ||
286 | + if taskCfg.key ~= actData.condition then return 6 end | ||
287 | + | ||
288 | + if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end | ||
289 | + | ||
290 | + local open, actId = role.activity:isOpen("BattleCommand") | ||
291 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
292 | + if not open then return 2 end | ||
293 | + if not actData then return 3 end | ||
294 | + | ||
295 | + | ||
296 | + record[taskId] = 1 | ||
297 | + calTask["r"] = record | ||
298 | + | ||
299 | + role:updateProperty({field = "bcTask", value = calTask}) | ||
300 | + | ||
301 | + local reward, change = role:award(taskCfg.reward, {log = {desc = "battleCommandTask"}}) | ||
302 | + | ||
303 | + role:log("activity", { | ||
304 | + activity_id = taskId, -- 活动ID(或活动指定任务的ID) | ||
305 | + activity_type = role.activity.ActivityType.BattleCommandTask, -- 活动类型,见活动类型枚举表 | ||
306 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
307 | + }) | ||
308 | + | ||
309 | + role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) | ||
310 | + | ||
311 | + SendPacket(actionCodes.Activity_actBattleCommandTaskRpc, MsgPack.pack(role:packReward(reward, change))) | ||
312 | + | ||
263 | return true | 313 | return true |
264 | end | 314 | end |
265 | 315 | ||
@@ -511,6 +561,7 @@ function _M.startBattleRpc(agent, data) | @@ -511,6 +561,7 @@ function _M.startBattleRpc(agent, data) | ||
511 | key = tostring(math.random()), | 561 | key = tostring(math.random()), |
512 | actid = actid, | 562 | actid = actid, |
513 | id = id, | 563 | id = id, |
564 | + format = msg.format, | ||
514 | } | 565 | } |
515 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) | 566 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) |
516 | else | 567 | else |
@@ -539,7 +590,7 @@ function _M.startBattleRpc(agent, data) | @@ -539,7 +590,7 @@ function _M.startBattleRpc(agent, data) | ||
539 | bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count | 590 | bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count |
540 | end | 591 | end |
541 | 592 | ||
542 | - bi["sum"] = bi["sum"] + bi["top"] | 593 | + bi["sum"] = bi["sum"] + bi["top"] * count |
543 | actData["ticket"] = ticket - num | 594 | actData["ticket"] = ticket - num |
544 | actData[id] = bi | 595 | actData[id] = bi |
545 | changeFlag = true | 596 | changeFlag = true |
@@ -568,7 +619,10 @@ function _M.endBattleRpc(agent, data) | @@ -568,7 +619,10 @@ function _M.endBattleRpc(agent, data) | ||
568 | local isWin = msg.isWin | 619 | local isWin = msg.isWin |
569 | local heros = msg.heros | 620 | local heros = msg.heros |
570 | local support = msg.support | 621 | local support = msg.support |
571 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | 622 | + if not role.activity:isOpenById(actid, "ChallengeLevel") then |
623 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({})) | ||
624 | + return true | ||
625 | + end | ||
572 | 626 | ||
573 | if not role.__actBattleCache then return 2 end | 627 | if not role.__actBattleCache then return 2 end |
574 | 628 | ||
@@ -576,6 +630,18 @@ function _M.endBattleRpc(agent, data) | @@ -576,6 +630,18 @@ function _M.endBattleRpc(agent, data) | ||
576 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) | 630 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) |
577 | end | 631 | end |
578 | 632 | ||
633 | + -- 防作弊 | ||
634 | + if not role:checkBattleCheat("act_battle", { | ||
635 | + id = id, | ||
636 | + isWin = isWin, | ||
637 | + info = msg.info, | ||
638 | + format = role.__actBattleCache.format | ||
639 | + }) then | ||
640 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) | ||
641 | + return true | ||
642 | + end | ||
643 | + role.__actBattleCache = nil | ||
644 | + | ||
579 | local actCfg = csvdb["activity_battleCsv"][actid] | 645 | local actCfg = csvdb["activity_battleCsv"][actid] |
580 | if not actCfg then return 3 end | 646 | if not actCfg then return 3 end |
581 | 647 | ||
@@ -657,7 +723,9 @@ function _M.endBattleRpc(agent, data) | @@ -657,7 +723,9 @@ function _M.endBattleRpc(agent, data) | ||
657 | if check[cond[1]] and check[cond[1]](table.unpack(cond)) then | 723 | if check[cond[1]] and check[cond[1]](table.unpack(cond)) then |
658 | curStar = curStar + (1 << (i - 1)) | 724 | curStar = curStar + (1 << (i - 1)) |
659 | end | 725 | end |
660 | - end | 726 | + end |
727 | + | ||
728 | + role:checkTaskEnter("ActBattlePass", {chapterId = id}) | ||
661 | else | 729 | else |
662 | curStar = 0 | 730 | curStar = 0 |
663 | if battleCfg.rank ~= 0 then | 731 | if battleCfg.rank ~= 0 then |
@@ -889,4 +957,417 @@ function _M.bossRewardRpc(agent, data) | @@ -889,4 +957,417 @@ function _M.bossRewardRpc(agent, data) | ||
889 | return true | 957 | return true |
890 | end | 958 | end |
891 | 959 | ||
892 | -return _M | ||
893 | \ No newline at end of file | 960 | \ No newline at end of file |
961 | +function _M.commonSignRpc(agent, data) | ||
962 | + local role = agent.role | ||
963 | + local msg = MsgPack.unpack(data) | ||
964 | + local actid = msg.actid | ||
965 | + local index = msg.index | ||
966 | + | ||
967 | + if not role.activity:isOpenById(actid, "CommonSignIn") then return 1 end | ||
968 | + | ||
969 | + local actData = role.activity:getActData("CommonSignIn") | ||
970 | + if (actData[0] or 0) < index then | ||
971 | + return 2 | ||
972 | + end | ||
973 | + if (actData[index] or 0) == 1 then | ||
974 | + return 3 | ||
975 | + end | ||
976 | + | ||
977 | + local actCfg = csvdb["activity_signInCsv"][actid] | ||
978 | + if not actCfg then return 4 end | ||
979 | + actCfg = actCfg[index] | ||
980 | + if not actCfg then return 5 end | ||
981 | + | ||
982 | + actData[index] = 1 | ||
983 | + role.activity:updateActData("CommonSignIn", actData) | ||
984 | + | ||
985 | + local award = actCfg.reward:toNumMap() | ||
986 | + local reward, change = role:award(award, {log = {desc = "commonSign", int1 = actid, int2 = index}}) | ||
987 | + SendPacket(actionCodes.Activity_commonSignRpc, MsgPack.pack(role:packReward(reward, change))) | ||
988 | + return true | ||
989 | +end | ||
990 | + | ||
991 | +function _M.friendHelpRpc(agent, data) | ||
992 | + local role = agent.role | ||
993 | + local roleId = role:getProperty("id") | ||
994 | + local msg = MsgPack.unpack(data) | ||
995 | + local oper = tonumber(msg.oper) or -1 | ||
996 | + local award = {} | ||
997 | + local result | ||
998 | + | ||
999 | + | ||
1000 | + local actid = 37 | ||
1001 | + if not role.activity:isOpenById(actid, "FriendEnergy") then return 1 end | ||
1002 | + if oper < 1 or oper > 4 then return 2 end | ||
1003 | + | ||
1004 | + local actCsv = csvdb["activity_ctrlCsv"][actid] | ||
1005 | + local getLimit = actCsv.condition | ||
1006 | + local gifts = actCsv.condition2:toTableArray(true) | ||
1007 | + | ||
1008 | + local actData = role.activity:getActData("FriendEnergy") or {} | ||
1009 | + | ||
1010 | + local function getIds() | ||
1011 | + local ids = {} | ||
1012 | + local friends = redisproxy:hgetall(FRIEND_KEY:format(roleId)) | ||
1013 | + for i = 1, #friends , 2 do | ||
1014 | + local objId = tonumber(friends[i]) | ||
1015 | + ids[objId] = 1 | ||
1016 | + end | ||
1017 | + return ids | ||
1018 | + end | ||
1019 | + | ||
1020 | + if oper == 1 then -- 赠送好友能量 | ||
1021 | + local giveAE = actData.giveAE or {} | ||
1022 | + local objId = msg.roleId | ||
1023 | + local gift = gifts[1] | ||
1024 | + local ids = {} | ||
1025 | + | ||
1026 | + if not objId then | ||
1027 | + return 3 | ||
1028 | + end | ||
1029 | + if not redisproxy:hexists(FRIEND_KEY:format(roleId), objId) then | ||
1030 | + result = 2 | ||
1031 | + end | ||
1032 | + if giveAE[objId] then | ||
1033 | + result = 1 | ||
1034 | + end | ||
1035 | + | ||
1036 | + if not result then | ||
1037 | + giveAE[objId] = 1 | ||
1038 | + award[gift[1]] = gift[2] | ||
1039 | + redisproxy:sadd(FRIEND_ENERGY:format(objId), roleId) | ||
1040 | + rpcRole(objId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}})) | ||
1041 | + actData.giveAE = giveAE | ||
1042 | + end | ||
1043 | + elseif oper == 2 then -- 收取能量 | ||
1044 | + local objId = msg.roleId | ||
1045 | + local gift = gifts[2] | ||
1046 | + local getAE = actData.getAE or {} | ||
1047 | + local limit = actData.limit or 0 | ||
1048 | + | ||
1049 | + if limit >= getLimit then return 4 end | ||
1050 | + if not redisproxy:sismember(FRIEND_ENERGY:format(roleId), objId) then | ||
1051 | + result = 3 | ||
1052 | + end | ||
1053 | + if getAE[objId] then | ||
1054 | + result = 2 | ||
1055 | + end | ||
1056 | + if limit >= getLimit then | ||
1057 | + result = 1 | ||
1058 | + end | ||
1059 | + | ||
1060 | + if not result then | ||
1061 | + limit = limit + 1 | ||
1062 | + getAE[objId] = 1 | ||
1063 | + award[gift[1]] = gift[2] | ||
1064 | + redisproxy:srem(FRIEND_ENERGY:format(roleId), objId) | ||
1065 | + actData.limit = limit | ||
1066 | + actData.getAE = getAE | ||
1067 | + end | ||
1068 | + elseif oper == 3 then -- 一键送领全部 | ||
1069 | + local giveAE = actData.giveAE or {} | ||
1070 | + local getAE = actData.getAE or {} | ||
1071 | + local gift1 = gifts[1] | ||
1072 | + local gift2 = gifts[2] | ||
1073 | + local limit = actData.limit or 0 | ||
1074 | + local cmd1, cmd2 = 0, 0 | ||
1075 | + local ids = getIds() | ||
1076 | + | ||
1077 | + local members = {} | ||
1078 | + local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
1079 | + for _, id in pairs(temp) do | ||
1080 | + members[tonumber(id)] = 1 | ||
1081 | + end | ||
1082 | + | ||
1083 | + redisproxy:pipelining(function(red) | ||
1084 | + for friendId, _ in pairs(ids) do | ||
1085 | + if not giveAE[friendId] then | ||
1086 | + giveAE[friendId] = 1 | ||
1087 | + award[gift1[1]] = (award[gift1[1]] or 0) + gift1[2] | ||
1088 | + red:sadd(FRIEND_ENERGY:format(friendId), roleId) | ||
1089 | + rpcRole(friendId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}})) | ||
1090 | + cmd1 = 2 | ||
1091 | + end | ||
1092 | + | ||
1093 | + if members[friendId] and not getAE[friendId] and limit <= getLimit then | ||
1094 | + cmd2 = 1 | ||
1095 | + limit = limit + 1 | ||
1096 | + getAE[friendId] = 1 | ||
1097 | + award[gift2[1]] = (award[gift2[1]] or 0) + gift2[2] | ||
1098 | + red:srem(FRIEND_ENERGY:format(roleId), friendId) | ||
1099 | + end | ||
1100 | + end | ||
1101 | + end) | ||
1102 | + | ||
1103 | + local sum = cmd1 + cmd2 | ||
1104 | + if sum == 0 then | ||
1105 | + result = 3 | ||
1106 | + elseif sum ~= 3 then | ||
1107 | + result = sum | ||
1108 | + end | ||
1109 | + | ||
1110 | + actData.limit = limit | ||
1111 | + actData.giveAE = giveAE | ||
1112 | + actData.getAE = getAE | ||
1113 | + elseif oper == 4 then -- 抽大奖 | ||
1114 | + local magic = actData.magic or 0 | ||
1115 | + local rewards = actData.reward or {} | ||
1116 | + local rewardCsv = csvdb["activity_orderRewardsCsv"][actid] | ||
1117 | + local itemId1 = gifts[1][1] | ||
1118 | + local itemId2 = gifts[2][1] | ||
1119 | + | ||
1120 | + local level = math.min(magic + 1,#rewardCsv) | ||
1121 | + local rewardData = rewardCsv[level] | ||
1122 | + | ||
1123 | + local cost = {[itemId1] = rewardData.condition1, [itemId2] = rewardData.condition2} | ||
1124 | + | ||
1125 | + if not role:checkItemEnough(cost) then return 7 end | ||
1126 | + role:costItems(cost, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) | ||
1127 | + | ||
1128 | + if rewardData.reward ~= "" then | ||
1129 | + result = 1 | ||
1130 | + award = rewardData.reward:toNumMap() | ||
1131 | + end | ||
1132 | + if rewardData.reward_random ~= "" then | ||
1133 | + result = 1 | ||
1134 | + local pool = {} | ||
1135 | + for _, temp in pairs(rewardData.reward_random:toArray()) do | ||
1136 | + table.insert(pool, temp:toArray(true, "=")) | ||
1137 | + end | ||
1138 | + local gift = pool[math.randWeight(pool, 3)] | ||
1139 | + award[gift[1]] = (award[gift[1]] or 0) + gift[2] | ||
1140 | + end | ||
1141 | + rewards[level] = 1 | ||
1142 | + actData.reward = rewards | ||
1143 | + actData.magic = level | ||
1144 | + else | ||
1145 | + return 5 | ||
1146 | + end | ||
1147 | + | ||
1148 | + local ids = {} | ||
1149 | + local members = {} | ||
1150 | + local friendIds = getIds() | ||
1151 | + local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
1152 | + for _, id in pairs(temp) do | ||
1153 | + members[tonumber(id)] = 1 | ||
1154 | + end | ||
1155 | + | ||
1156 | + for id, _ in pairs(friendIds) do | ||
1157 | + if members[id] then | ||
1158 | + ids[id] = 1 | ||
1159 | + end | ||
1160 | + end | ||
1161 | + | ||
1162 | + actData.new = ids | ||
1163 | + | ||
1164 | + local reward, change | ||
1165 | + if next(award) then | ||
1166 | + reward, change = role:award(award, {log = {desc = "actFriendHelp", int1 = actid}}) | ||
1167 | + end | ||
1168 | + role.activity:updateActData("FriendEnergy", actData) | ||
1169 | + SendPacket(actionCodes.Activity_friendHelpRpc, MsgPack.pack({result = result, reward = reward})) | ||
1170 | + return true | ||
1171 | +end | ||
1172 | + | ||
1173 | +-- 战令活动奖励 | ||
1174 | +function _M.battleCommandRpc(agent, data) | ||
1175 | + local role = agent.role | ||
1176 | + local msg = MsgPack.unpack(data) | ||
1177 | + local actid = msg.actid -- 活动id | ||
1178 | + local index = msg.index -- 领取的阶段id | ||
1179 | + local pay = msg.pay -- 是否是超级奖励 | ||
1180 | + | ||
1181 | + if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end | ||
1182 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | ||
1183 | + | ||
1184 | + if not actCtrlData then return end | ||
1185 | + | ||
1186 | + local actData = role.activity:getActData("BattleCommand") or {} | ||
1187 | + if pay and not actData["unlock"] then return 2 end | ||
1188 | + | ||
1189 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid] | ||
1190 | + if not bpCfg then return 3 end | ||
1191 | + | ||
1192 | + local unlock = actData["unlock"] or 0 | ||
1193 | + local award = {} | ||
1194 | + if not index then -- 一键领取 | ||
1195 | + for i = 1, #bpCfg do | ||
1196 | + local cfg = bpCfg[i] | ||
1197 | + if not cfg then return 4 end | ||
1198 | + | ||
1199 | + if (actData["lvl"] or 0) < cfg["type"] then break end | ||
1200 | + local records = {{"freeR", "rewardNormal"}, {"payR", "rewardHigh"}} | ||
1201 | + | ||
1202 | + for _, info in ipairs(records) do | ||
1203 | + local typeKey, rewardKey = info[1], info[2] | ||
1204 | + if typeKey == "payR" and unlock == 0 then | ||
1205 | + break | ||
1206 | + end | ||
1207 | + local record = actData[typeKey] or "" | ||
1208 | + local flag = string.char(string.getbit(record, i)) | ||
1209 | + if flag == "0" then | ||
1210 | + record = string.setbit(record, i) | ||
1211 | + local awd = cfg[rewardKey] | ||
1212 | + for k, v in pairs(awd:toNumMap()) do | ||
1213 | + award[k] = (award[k] or 0) + v | ||
1214 | + end | ||
1215 | + end | ||
1216 | + actData[typeKey] = record | ||
1217 | + | ||
1218 | + end | ||
1219 | + end | ||
1220 | + else | ||
1221 | + bpCfg = bpCfg[index] | ||
1222 | + if not bpCfg then return 4 end | ||
1223 | + | ||
1224 | + if (actData["lvl"] or 0) < bpCfg["type"] then return 5 end | ||
1225 | + | ||
1226 | + local record = "" | ||
1227 | + if pay then | ||
1228 | + record = actData["payR"] or "" | ||
1229 | + else | ||
1230 | + record = actData["freeR"] or "" | ||
1231 | + end | ||
1232 | + | ||
1233 | + local flag = string.char(string.getbit(record, index)) | ||
1234 | + | ||
1235 | + if flag == "1" then | ||
1236 | + return 6 | ||
1237 | + end | ||
1238 | + | ||
1239 | + record = string.setbit(record, index) | ||
1240 | + local awd = "" | ||
1241 | + if pay then | ||
1242 | + actData["payR"] = record | ||
1243 | + awd = bpCfg["rewardHigh"] | ||
1244 | + else | ||
1245 | + actData["freeR"] = record | ||
1246 | + awd = bpCfg["rewardNormal"] | ||
1247 | + end | ||
1248 | + for k, v in pairs(awd:toNumMap()) do | ||
1249 | + award[k] = (award[k] or 0) + v | ||
1250 | + end | ||
1251 | + end | ||
1252 | + | ||
1253 | + role.activity:updateActData("BattleCommand", actData) | ||
1254 | + | ||
1255 | + local reward, change = role:award(award, {log = {desc = "actBattleCommand", int1 = actid, int2 = index}}) | ||
1256 | + | ||
1257 | + SendPacket(actionCodes.Activity_battleCommandRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1258 | + return true | ||
1259 | +end | ||
1260 | + | ||
1261 | +function _M.buyBattleCommandLvlRpc(agent, data) | ||
1262 | + local role = agent.role | ||
1263 | + local msg = MsgPack.unpack(data) | ||
1264 | + local actid = msg.actid -- 活动id | ||
1265 | + local count = msg.count | ||
1266 | + | ||
1267 | + if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end | ||
1268 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | ||
1269 | + | ||
1270 | + if not actCtrlData then return 2 end | ||
1271 | + | ||
1272 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid] | ||
1273 | + if not bpCfg then return 3 end | ||
1274 | + | ||
1275 | + local actData = role.activity:getActData("BattleCommand") or {} | ||
1276 | + | ||
1277 | + local curLvl = actData["lvl"] or 0 | ||
1278 | + local nextLvl = curLvl + count | ||
1279 | + if curLvl >= bpCfg[#bpCfg]["type"] then return 4 end | ||
1280 | + local cost = 0 | ||
1281 | + for i = 1, #bpCfg do | ||
1282 | + local cfg = bpCfg[i] | ||
1283 | + if cfg["type"] > curLvl and cfg["type"] <= nextLvl then | ||
1284 | + cost = cost + cfg["cost"] | ||
1285 | + elseif cfg["type"] > nextLvl then | ||
1286 | + break | ||
1287 | + end | ||
1288 | + end | ||
1289 | + if cost == 0 then return 5 end | ||
1290 | + | ||
1291 | + if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end | ||
1292 | + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) | ||
1293 | + actData["lvl"] = nextLvl | ||
1294 | + role.activity:updateActData("BattleCommand", actData) | ||
1295 | + | ||
1296 | + SendPacket(actionCodes.Activity_buyBattleCommandLvlRpc, MsgPack.pack({})) | ||
1297 | + return true | ||
1298 | +end | ||
1299 | + | ||
1300 | +function _M.newSignRpc(agent, data) | ||
1301 | + local role = agent.role | ||
1302 | + local msg = MsgPack.unpack(data) | ||
1303 | + | ||
1304 | + local open, actId = role.activity:isOpen("NewSign") | ||
1305 | + if not open then return 1 end | ||
1306 | + | ||
1307 | + local actData = role.activity:getActData("NewSign") | ||
1308 | + if actData[tostring(actData["0"] or 0)] then | ||
1309 | + return 2 | ||
1310 | + end | ||
1311 | + | ||
1312 | + local actCfg = csvdb["activity_signInCsv"][actId] | ||
1313 | + if not actCfg then return 4 end | ||
1314 | + | ||
1315 | + local sumDay = actData["0"] or 0 | ||
1316 | + local award = {} | ||
1317 | + for k, data in pairs(actCfg) do | ||
1318 | + if not actData[tostring(data.day)] and data.day <= sumDay then | ||
1319 | + for id, value in pairs(data.reward:toNumMap()) do | ||
1320 | + award[id] = (award[id] or 0) + value | ||
1321 | + end | ||
1322 | + actData[tostring(data.day)] = 1 | ||
1323 | + end | ||
1324 | + end | ||
1325 | + | ||
1326 | + local reward, change | ||
1327 | + if next(award) then | ||
1328 | + role.activity:updateActData("NewSign", actData) | ||
1329 | + reward, change = role:award(award, {log = {desc = "newSign", int1 = actId, int2 = sumDay}}) | ||
1330 | + end | ||
1331 | + | ||
1332 | + SendPacket(actionCodes.Activity_newSignRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1333 | + return true | ||
1334 | +end | ||
1335 | + | ||
1336 | +-- 活动拾荒领取阶段奖励 | ||
1337 | +function _M.advLevelRpc(agent, data) | ||
1338 | + local role = agent.role | ||
1339 | + local msg = MsgPack.unpack(data) | ||
1340 | + local actid = msg.actid | ||
1341 | + local index = msg.index | ||
1342 | + | ||
1343 | + if not role.activity:isOpenById(actid, "AdvLevel") then return 1 end | ||
1344 | + | ||
1345 | + local actCfg = csvdb["activity_stagesAwardCsv"][actid] | ||
1346 | + if not actCfg then return 2 end | ||
1347 | + actCfg = actCfg[index] | ||
1348 | + if not actCfg then return 3 end | ||
1349 | + | ||
1350 | + local actData = role.activity:getActData("AdvLevel") or {} | ||
1351 | + local record = actData["r"] or "" | ||
1352 | + local flag = string.char(string.getbit(record, index)) | ||
1353 | + | ||
1354 | + if flag == "1" then return 4 end | ||
1355 | + | ||
1356 | + local chapters = actCfg["condition2"]:toArray(true, "=") | ||
1357 | + local totalVal = 0 | ||
1358 | + for i = 1, #chapters do | ||
1359 | + local cid = chapters[i] | ||
1360 | + local info = actData[cid] or {} | ||
1361 | + totalVal = totalVal + (info["max"] or 0) | ||
1362 | + end | ||
1363 | + if totalVal < actCfg["condition1"] then return 5 end | ||
1364 | + | ||
1365 | + actData["r"] = string.setbit(record, index) | ||
1366 | + role.activity:updateActData("AdvLevel", actData) | ||
1367 | + | ||
1368 | + local reward, change = role:award(actCfg.reward, {log = {desc = "advLevelStage", int1 = actid, int2 = index}}) | ||
1369 | + | ||
1370 | + SendPacket(actionCodes.Activity_advLevelRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1371 | + return true | ||
1372 | +end | ||
1373 | + | ||
1374 | +return _M |
src/actions/AdvAction.lua
@@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) | @@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) | ||
57 | end | 57 | end |
58 | end | 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 | if not format.leader then return end | 69 | if not format.leader then return end |
61 | if format.leader2 == format.leader then return end | 70 | if format.leader2 == format.leader then return end |
62 | local hadLeader = false | 71 | local hadLeader = false |
@@ -86,22 +95,58 @@ function _M.startAdvRpc( agent, data ) | @@ -86,22 +95,58 @@ function _M.startAdvRpc( agent, data ) | ||
86 | local role = agent.role | 95 | local role = agent.role |
87 | local msg = MsgPack.unpack(data) | 96 | local msg = MsgPack.unpack(data) |
88 | local chapterId = msg.chapterId --关卡id | 97 | local chapterId = msg.chapterId --关卡id |
98 | + local actid = msg.actid --活动id | ||
89 | local layer = msg.layer or 1 --选择层数 | 99 | local layer = msg.layer or 1 --选择层数 |
90 | --local format = msg.format --编队 | 100 | --local format = msg.format --编队 |
91 | local supportIdx = msg.supportIdx --选择的支援效果 | 101 | local supportIdx = msg.supportIdx --选择的支援效果 |
92 | if not role:isFuncUnlock(FuncUnlock.Adv) then return end | 102 | if not role:isFuncUnlock(FuncUnlock.Adv) then return end |
93 | - | 103 | + |
94 | --上一个关卡结束才可以开始新的关卡 | 104 | --上一个关卡结束才可以开始新的关卡 |
95 | if role:getAdvData():isRunning() then return 8 end | 105 | if role:getAdvData():isRunning() then return 8 end |
96 | local advHang = role:getProperty("advHang") | 106 | local advHang = role:getProperty("advHang") |
97 | -- if advHang[chapterId] then return 9 end --正在挂机 | 107 | -- if advHang[chapterId] then return 9 end --正在挂机 |
98 | 108 | ||
109 | + -- 检查活动正确性 | ||
110 | + if actid then | ||
111 | + if not role.activity:isOpenById(actid, "AdvLevel") then | ||
112 | + return 20 | ||
113 | + end | ||
114 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | ||
115 | + if not actCfg then return 21 end | ||
116 | + actCfg = actCfg[chapterId] | ||
117 | + if not actCfg then return 22 end | ||
118 | + | ||
119 | + if actCfg["unlockTime"] ~= 0 then | ||
120 | + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME)) | ||
121 | + if st > skynet.timex() then return 23 end | ||
122 | + end | ||
123 | + | ||
124 | + if actCfg["prepose"] ~= "" then | ||
125 | + local type, cid = actCfg["prepose"]:toArray(true, "=") | ||
126 | + if type == 1 then | ||
127 | + local actData = role.activity:getActData("ChallengeLevel") | ||
128 | + local battleInfo = actData[cid] or {} | ||
129 | + if (battleInfo["star"] or 0) == 0 then | ||
130 | + return 24 | ||
131 | + end | ||
132 | + elseif type == 2 then | ||
133 | + local actData = role.activity:getActData("AdvLevel") | ||
134 | + local advInfo = actData[cid] or {} | ||
135 | + if not advInfo["pass"] then | ||
136 | + return 25 | ||
137 | + end | ||
138 | + end | ||
139 | + end | ||
140 | + end | ||
99 | 141 | ||
100 | local chapterData = csvdb["adv_chapterCsv"][chapterId] | 142 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
101 | if not chapterData or layer < 1 then return 1 end | 143 | if not chapterData or layer < 1 then return 1 end |
102 | 144 | ||
103 | local advPass = role:getProperty("advPass") | 145 | local advPass = role:getProperty("advPass") |
104 | 146 | ||
147 | + if not checkFormat(role) then return 7 end | ||
148 | + | ||
149 | + local cost = 0 | ||
105 | if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 | 150 | if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 |
106 | 151 | ||
107 | if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 | 152 | if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 |
@@ -118,37 +163,27 @@ function _M.startAdvRpc( agent, data ) | @@ -118,37 +163,27 @@ function _M.startAdvRpc( agent, data ) | ||
118 | if not relayData then return 14 end -- 不是中继层 | 163 | if not relayData then return 14 end -- 不是中继层 |
119 | if advElM < relayData.unlockfloor then return 15 end --未解锁 | 164 | if advElM < relayData.unlockfloor then return 15 end --未解锁 |
120 | end | 165 | end |
166 | + | ||
167 | + role.dailyData:updateProperty({field = "advElC", delta = 1}) | ||
168 | + cost = 1 | ||
121 | else -- 普通模式判断 | 169 | else -- 普通模式判断 |
122 | - if not role:checkAdvCount(chapterData.limitlevel) then return 2 end -- 是否有体力 | ||
123 | if layer >= chapterData.limitlevel then return 4 end | 170 | if layer >= chapterData.limitlevel then return 4 end |
124 | - -- 关卡开放判断 | ||
125 | - if not role:advChapterIsOpen(chapterId) then return 5 end | ||
126 | 171 | ||
172 | + local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) | ||
173 | + if not relayData then return 6 end -- 不是中继层 | ||
127 | if layer ~= 1 then | 174 | 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 | 175 | + local advRelay = role:getProperty("advRelay") |
176 | + if not (advRelay[chapterId] or {})[layer] then return 21 end -- 没有开放 | ||
131 | end | 177 | end |
132 | - end | ||
133 | - | ||
134 | - if not checkFormat(role) then return 7 end | ||
135 | - | ||
136 | - --local advTeam = role:getProperty("advTeam") | ||
137 | - --table.clear(advTeam) | 178 | + if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 |
179 | + -- 关卡开放判断 | ||
180 | + if not role:advChapterIsOpen(chapterId) then return 5 end | ||
138 | 181 | ||
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) | 182 | + role:changeAdvCount(relayData.supply) |
183 | + cost = relayData.supply | ||
150 | end | 184 | end |
151 | - | 185 | + role:checkTaskEnter("AdvCostPower", {count = cost}) |
186 | + | ||
152 | local support = {} -- 支援效果 | 187 | local support = {} -- 支援效果 |
153 | if AdvCommon.isEndless(chapterId) then | 188 | if AdvCommon.isEndless(chapterId) then |
154 | -- 选择的支援效果 | 189 | -- 选择的支援效果 |
@@ -168,13 +203,16 @@ function _M.startAdvRpc( agent, data ) | @@ -168,13 +203,16 @@ function _M.startAdvRpc( agent, data ) | ||
168 | end | 203 | end |
169 | end | 204 | end |
170 | end | 205 | end |
206 | + | ||
171 | role:getAdvData():initByChapter({ | 207 | role:getAdvData():initByChapter({ |
172 | chapterId = chapterId, | 208 | chapterId = chapterId, |
173 | level = layer, | 209 | level = layer, |
174 | isRelay = layer ~= 1, | 210 | isRelay = layer ~= 1, |
175 | isEnter = true, | 211 | isEnter = true, |
176 | support = support, | 212 | support = support, |
213 | + actid = actid | ||
177 | }) | 214 | }) |
215 | + | ||
178 | role:checkTaskEnter("AdvStart", {id = chapterId}) | 216 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
179 | role:checkTaskEnter("AdvStartSelf", {id = chapterId}) | 217 | role:checkTaskEnter("AdvStartSelf", {id = chapterId}) |
180 | role:getAdvData():popBackEvents() -- 清一下事件 | 218 | role:getAdvData():popBackEvents() -- 清一下事件 |
@@ -191,8 +229,42 @@ function _M.startHangRpc(agent, data) | @@ -191,8 +229,42 @@ function _M.startHangRpc(agent, data) | ||
191 | local campId = msg.campId or 2 --营地id | 229 | local campId = msg.campId or 2 --营地id |
192 | local format = msg.format --编队 | 230 | local format = msg.format --编队 |
193 | local index = msg.index or 1--时间索引id | 231 | local index = msg.index or 1--时间索引id |
232 | + local actid = msg.actid | ||
194 | 233 | ||
195 | - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | 234 | + -- 检查活动正确性 |
235 | + if actid then | ||
236 | + if not role.activity:isOpenById(actid, "AdvLevel") then | ||
237 | + return 20 | ||
238 | + end | ||
239 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | ||
240 | + if not actCfg then return 21 end | ||
241 | + actCfg = actCfg[chapterId] | ||
242 | + if not actCfg then return 22 end | ||
243 | + | ||
244 | + if actCfg["unlockTime"] ~= 0 then | ||
245 | + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME)) | ||
246 | + if st > skynet.timex() then return 23 end | ||
247 | + end | ||
248 | + | ||
249 | + if actCfg["prepose"] ~= "" then | ||
250 | + local type, cid = actCfg["prepose"]:toArray(true, "=") | ||
251 | + if type == 1 then | ||
252 | + local actData = role.activity:getActData("ChallengeLevel") | ||
253 | + local battleInfo = actData[cid] or {} | ||
254 | + if (battleInfo["star"] or 0) == 0 then | ||
255 | + return 24 | ||
256 | + end | ||
257 | + elseif type == 2 then | ||
258 | + local actData = role.activity:getActData("AdvLevel") | ||
259 | + local advInfo = actData[cid] or {} | ||
260 | + if not advInfo["pass"] then | ||
261 | + return 25 | ||
262 | + end | ||
263 | + end | ||
264 | + end | ||
265 | + end | ||
266 | + | ||
267 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | ||
196 | if not chapterData then return 1 end | 268 | if not chapterData then return 1 end |
197 | local campSiteData = chapterData[campId] | 269 | local campSiteData = chapterData[campId] |
198 | if not campSiteData then return 1 end | 270 | if not campSiteData then return 1 end |
@@ -214,11 +286,13 @@ function _M.startHangRpc(agent, data) | @@ -214,11 +286,13 @@ function _M.startHangRpc(agent, data) | ||
214 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 | 286 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 |
215 | 287 | ||
216 | local advRelay = role:getProperty("advRelay") | 288 | local advRelay = role:getProperty("advRelay") |
217 | - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 | 289 | + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放 |
218 | 290 | ||
219 | 291 | ||
220 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 | 292 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
221 | 293 | ||
294 | + role:checkTaskEnter("AdvCostPower", {count = adv_idle_energy}) | ||
295 | + | ||
222 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 | 296 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 |
223 | 297 | ||
224 | local player = {} | 298 | local player = {} |
@@ -236,7 +310,8 @@ function _M.startHangRpc(agent, data) | @@ -236,7 +310,8 @@ function _M.startHangRpc(agent, data) | ||
236 | + 0.226 * player["hit"] | 310 | + 0.226 * player["hit"] |
237 | + 0.26 * player["miss"] | 311 | + 0.26 * player["miss"] |
238 | 312 | ||
239 | - if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | 313 | + --print(math.ceil(battleV), campSiteData.idleValue) |
314 | + if math.ceil(battleV) < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | ||
240 | 315 | ||
241 | local info = {} | 316 | local info = {} |
242 | info.format = {} | 317 | info.format = {} |
@@ -259,7 +334,7 @@ function _M.startHangRpc(agent, data) | @@ -259,7 +334,7 @@ function _M.startHangRpc(agent, data) | ||
259 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) | 334 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
260 | 335 | ||
261 | role:changeAdvCount(adv_idle_energy) | 336 | role:changeAdvCount(adv_idle_energy) |
262 | - role:checkTaskEnter("AdvStart", {id = chapterId}) | 337 | + role:checkTaskEnter("AdvStart", {id = chapterId, actid = actid}) |
263 | role:mylog("adv_action", {desc = "startHang", int1 = chapterId}) | 338 | role:mylog("adv_action", {desc = "startHang", int1 = chapterId}) |
264 | 339 | ||
265 | SendPacket(actionCodes.Adv_startHangRpc, '') | 340 | SendPacket(actionCodes.Adv_startHangRpc, '') |
@@ -344,6 +419,7 @@ function _M.endHangRpc(agent, data) | @@ -344,6 +419,7 @@ function _M.endHangRpc(agent, data) | ||
344 | adv_idle_time = adv_idle_time * 60 | 419 | adv_idle_time = adv_idle_time * 60 |
345 | 420 | ||
346 | local reward, isFull, change, heroFaithMap | 421 | local reward, isFull, change, heroFaithMap |
422 | + local heroCnt = 0 | ||
347 | if skynet.timex() >= info.time then | 423 | if skynet.timex() >= info.time then |
348 | -- 最新需求加成取消 | 424 | -- 最新需求加成取消 |
349 | --[[ | 425 | --[[ |
@@ -378,6 +454,7 @@ function _M.endHangRpc(agent, data) | @@ -378,6 +454,7 @@ function _M.endHangRpc(agent, data) | ||
378 | for _, heroId in pairs(info.format.heros) do | 454 | for _, heroId in pairs(info.format.heros) do |
379 | local curFaith = addHeroFaith(role, heroId, exp) | 455 | local curFaith = addHeroFaith(role, heroId, exp) |
380 | heroFaithMap[heroId] = curFaith | 456 | heroFaithMap[heroId] = curFaith |
457 | + heroCnt = heroCnt + 1 | ||
381 | end | 458 | end |
382 | 459 | ||
383 | local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 | 460 | local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 |
@@ -406,6 +483,7 @@ function _M.endHangRpc(agent, data) | @@ -406,6 +483,7 @@ function _M.endHangRpc(agent, data) | ||
406 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) | 483 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) |
407 | 484 | ||
408 | role:checkTaskEnter("AdvHang", {}) | 485 | role:checkTaskEnter("AdvHang", {}) |
486 | + role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) | ||
409 | 487 | ||
410 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) | 488 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) |
411 | return true | 489 | return true |
@@ -543,8 +621,8 @@ function _M.usePotionRpc(agent, data) | @@ -543,8 +621,8 @@ function _M.usePotionRpc(agent, data) | ||
543 | local msg = MsgPack.unpack(data) | 621 | local msg = MsgPack.unpack(data) |
544 | local potionId = msg.potionId -- 营养剂Id | 622 | local potionId = msg.potionId -- 营养剂Id |
545 | local target = msg.target -- {roomId = 1, blockId = 1} 选择的目标 | 623 | 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 | 624 | + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 1) |
625 | + if potionLv < 1 then return 1 end | ||
548 | 626 | ||
549 | local potionSet = csvdb["adv_potionCsv"][potionId] | 627 | local potionSet = csvdb["adv_potionCsv"][potionId] |
550 | if not potionSet then return 2 end | 628 | if not potionSet then return 2 end |
@@ -552,12 +630,9 @@ function _M.usePotionRpc(agent, data) | @@ -552,12 +630,9 @@ function _M.usePotionRpc(agent, data) | ||
552 | local potionData = potionSet[potionLv] | 630 | local potionData = potionSet[potionLv] |
553 | if not potionData then return 3 end | 631 | if not potionData then return 3 end |
554 | 632 | ||
555 | - local potionBag = role:getProperty("potionBag") | ||
556 | - local own = potionBag[potionId] or 0 | ||
557 | - if own <= 0 then return 4 end | ||
558 | - | ||
559 | if not isCanContinue(role) then return end | 633 | if not isCanContinue(role) then return end |
560 | local adv = role:getAdvData() | 634 | local adv = role:getAdvData() |
635 | + if not adv:cost({[potionId] = 1}, {}, true) then return 4 end | ||
561 | if adv:isWaitChooseArtifact() then return end | 636 | if adv:isWaitChooseArtifact() then return end |
562 | 637 | ||
563 | adv:mylog({desc = "usePotion", int1 = potionId}) | 638 | adv:mylog({desc = "usePotion", int1 = potionId}) |
@@ -565,8 +640,7 @@ function _M.usePotionRpc(agent, data) | @@ -565,8 +640,7 @@ function _M.usePotionRpc(agent, data) | ||
565 | local status = adv:doActive(potionData.effect, target) -- target | 640 | local status = adv:doActive(potionData.effect, target) -- target |
566 | if not status then return end | 641 | if not status then return end |
567 | 642 | ||
568 | - potionBag[potionId] = own - 1 | ||
569 | - role:updateProperty({field = "potionBag", value = potionBag}) | 643 | + adv:cost({[potionId] = 1}, {log = {desc = "usePotion", int1 = potionId}}) |
570 | adv:pushBackEvent(AdvBackEventType.Potion, {id = potionId}) | 644 | adv:pushBackEvent(AdvBackEventType.Potion, {id = potionId}) |
571 | adv:afterRound() | 645 | adv:afterRound() |
572 | adv:saveDB() | 646 | adv:saveDB() |
@@ -737,7 +811,7 @@ function _M.endBattleRpc(agent, data) | @@ -737,7 +811,7 @@ function _M.endBattleRpc(agent, data) | ||
737 | role:finishGuide(52) | 811 | role:finishGuide(52) |
738 | -- 调理剂使用引导(生命药剂) | 812 | -- 调理剂使用引导(生命药剂) |
739 | if not role:checkOverGuide(61) then | 813 | if not role:checkOverGuide(61) then |
740 | - local potionBag = role:getProperty("potionBag") | 814 | + local potionBag = role:getProperty("advItems"):toNumMap() |
741 | local own = potionBag[10] or 0 | 815 | local own = potionBag[10] or 0 |
742 | if own > 0 then | 816 | if own > 0 then |
743 | -- 造假 | 817 | -- 造假 |
@@ -962,6 +1036,9 @@ function _M.roleFormatRpc(agent , data) | @@ -962,6 +1036,9 @@ function _M.roleFormatRpc(agent , data) | ||
962 | local index = msg.index -- 阵容索引 | 1036 | local index = msg.index -- 阵容索引 |
963 | local title = msg.title -- 阵容名称 | 1037 | local title = msg.title -- 阵容名称 |
964 | local team = {} | 1038 | local team = {} |
1039 | + | ||
1040 | + if role:getAdvData():isRunning() then return 3 end | ||
1041 | + | ||
965 | for slot, heroId in pairs(msg.heros) do | 1042 | for slot, heroId in pairs(msg.heros) do |
966 | if not role.heros[heroId] then | 1043 | if not role.heros[heroId] then |
967 | return 1 | 1044 | return 1 |
@@ -1004,6 +1081,9 @@ function _M.selectTeamRpc(agent, data) | @@ -1004,6 +1081,9 @@ function _M.selectTeamRpc(agent, data) | ||
1004 | local role = agent.role | 1081 | local role = agent.role |
1005 | local msg = MsgPack.unpack(data) | 1082 | local msg = MsgPack.unpack(data) |
1006 | local index = msg.index -- 阵容索引 | 1083 | local index = msg.index -- 阵容索引 |
1084 | + | ||
1085 | + if role:getAdvData():isRunning() then return 1 end | ||
1086 | + | ||
1007 | local team = role:getAdvTeamFormat(index) | 1087 | local team = role:getAdvTeamFormat(index) |
1008 | if not next(team) then return end | 1088 | if not next(team) then return end |
1009 | team["index"] = index | 1089 | team["index"] = index |
src/actions/CarAction.lua
@@ -13,7 +13,7 @@ function _M.makePotionRpc( agent, data ) | @@ -13,7 +13,7 @@ function _M.makePotionRpc( agent, data ) | ||
13 | local count = msg.count | 13 | local count = msg.count |
14 | if count < 1 then return 0 end | 14 | if count < 1 then return 0 end |
15 | local potionBag = role:getProperty("potionBag") | 15 | local potionBag = role:getProperty("potionBag") |
16 | - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | 16 | + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 1) |
17 | if potionLv < 1 then return 1 end | 17 | if potionLv < 1 then return 1 end |
18 | 18 | ||
19 | local potionSet = csvdb["adv_potionCsv"][potionId] | 19 | local potionSet = csvdb["adv_potionCsv"][potionId] |
@@ -22,20 +22,15 @@ function _M.makePotionRpc( agent, data ) | @@ -22,20 +22,15 @@ function _M.makePotionRpc( agent, data ) | ||
22 | local potionData = potionSet[potionLv] | 22 | local potionData = potionSet[potionLv] |
23 | if not potionData then return 3 end | 23 | if not potionData then return 3 end |
24 | 24 | ||
25 | - local own = potionBag[potionId] or 0 | ||
26 | - if own+count > potionData.limit then | ||
27 | - return 4 | ||
28 | - end | ||
29 | - | ||
30 | local cost = potionData.material:toNumMap() | 25 | local cost = potionData.material:toNumMap() |
31 | for k, n in pairs(cost) do | 26 | for k, n in pairs(cost) do |
32 | cost[k] = n * count | 27 | cost[k] = n * count |
33 | end | 28 | end |
34 | if not role:checkItemEnough(cost) then | 29 | if not role:checkItemEnough(cost) then |
35 | - return 5 | 30 | + return 4 |
36 | end | 31 | end |
37 | - | ||
38 | role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) | 32 | role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) |
33 | + local own = potionBag[potionId] or 0 | ||
39 | potionBag[potionId] = own + count | 34 | potionBag[potionId] = own + count |
40 | role:updateProperty({field = "potionBag", value = potionBag}) | 35 | role:updateProperty({field = "potionBag", value = potionBag}) |
41 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) | 36 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) |
src/actions/DinerAction.lua
@@ -305,7 +305,7 @@ function _M.expediteSellRpc( agent, data ) | @@ -305,7 +305,7 @@ function _M.expediteSellRpc( agent, data ) | ||
305 | local gift = reward:toNumMap() | 305 | local gift = reward:toNumMap() |
306 | 306 | ||
307 | -- 特权卡获取加速获得额外道具 | 307 | -- 特权卡获取加速获得额外道具 |
308 | - local coef = role.storeData:getProduceItemSpeedCoef() | 308 | + local coef = 1 --role.storeData:getProduceItemSpeedCoef() |
309 | for k, v in pairs(gift) do | 309 | for k, v in pairs(gift) do |
310 | if coef > 1 then | 310 | if coef > 1 then |
311 | v = math.floor(v * coef) | 311 | v = math.floor(v * coef) |
@@ -385,22 +385,12 @@ function _M.talentUpRpc( agent, data ) | @@ -385,22 +385,12 @@ function _M.talentUpRpc( agent, data ) | ||
385 | local msg = MsgPack.unpack(data) | 385 | local msg = MsgPack.unpack(data) |
386 | local dish = msg.dish | 386 | local dish = msg.dish |
387 | local dishTree = role.dinerData:getProperty("dishTree") | 387 | local dishTree = role.dinerData:getProperty("dishTree") |
388 | - local dishLevel = dishTree:getv(dish, 0) | ||
389 | 388 | ||
390 | local talentSet = csvdb["diner_talentCsv"][dish] | 389 | local talentSet = csvdb["diner_talentCsv"][dish] |
391 | if not talentSet then | 390 | if not talentSet then |
392 | return 1 | 391 | return 1 |
393 | end | 392 | end |
394 | 393 | ||
395 | - local talentData = talentSet[dishLevel] | ||
396 | - if not talentData then | ||
397 | - return 2 | ||
398 | - end | ||
399 | - | ||
400 | - if not talentSet[dishLevel+1] then | ||
401 | - return 21 | ||
402 | - end | ||
403 | - | ||
404 | local typ = math.floor(dish/100 + 1) | 394 | local typ = math.floor(dish/100 + 1) |
405 | local treeSet = csvdb["diner_treeCsv"][typ] | 395 | local treeSet = csvdb["diner_treeCsv"][typ] |
406 | if not treeSet then | 396 | if not treeSet then |
@@ -412,6 +402,17 @@ function _M.talentUpRpc( agent, data ) | @@ -412,6 +402,17 @@ function _M.talentUpRpc( agent, data ) | ||
412 | return 4 | 402 | return 4 |
413 | end | 403 | end |
414 | 404 | ||
405 | + -- 调理剂的默认等级是1级 | ||
406 | + local dishLevel = dishTree:getv(dish, treeData.rarity == 2 and 1 or 0) | ||
407 | + local talentData = talentSet[dishLevel] | ||
408 | + if not talentData then | ||
409 | + return 2 | ||
410 | + end | ||
411 | + | ||
412 | + if not talentSet[dishLevel+1] then | ||
413 | + return 21 | ||
414 | + end | ||
415 | + | ||
415 | local limit = talentData.pointFront:toNumMap() | 416 | local limit = talentData.pointFront:toNumMap() |
416 | for k,v in pairs(limit) do | 417 | for k,v in pairs(limit) do |
417 | local lv = dishTree:getv(k, 0) | 418 | local lv = dishTree:getv(k, 0) |
src/actions/EmailAction.lua
@@ -40,10 +40,17 @@ function _M.listRpc(agent, data) | @@ -40,10 +40,17 @@ function _M.listRpc(agent, data) | ||
40 | local count = 1 | 40 | local count = 1 |
41 | for _, data in ipairs(result) do | 41 | for _, data in ipairs(result) do |
42 | local email = tarr2tab(data) | 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 | and ( not email.endtime or tonum(email.endtime) > now )then | 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 | redisproxy:insertEmail({ | 54 | redisproxy:insertEmail({ |
48 | roleId = roleId, | 55 | roleId = roleId, |
49 | emailId = 0, | 56 | emailId = 0, |
src/actions/GmAction.lua
@@ -36,26 +36,15 @@ function _M.ban(role, pms) | @@ -36,26 +36,15 @@ function _M.ban(role, pms) | ||
36 | local time = tonum(pms.pm1, 1) | 36 | local time = tonum(pms.pm1, 1) |
37 | local ctype = tonum(pms.pm2, 0) | 37 | local ctype = tonum(pms.pm2, 0) |
38 | 38 | ||
39 | - local isBan = role:getProperty("banTime") <= now | ||
40 | role:setBan(time, ctype) | 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 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) | 40 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) |
52 | - | ||
53 | - return isBan and "解封杀成功" or "封杀成功" | 41 | + return "封杀成功" |
54 | end | 42 | end |
55 | 43 | ||
44 | + | ||
56 | function _M.unban(role, pms) | 45 | function _M.unban(role, pms) |
57 | role:setBan(0, 0) | 46 | role:setBan(0, 0) |
58 | - | 47 | + role:setProperty("cheatCount", 0) -- 清除作弊次数 |
59 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) | 48 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) |
60 | 49 | ||
61 | return "解封杀成功" | 50 | return "解封杀成功" |
@@ -63,18 +52,17 @@ end | @@ -63,18 +52,17 @@ end | ||
63 | 52 | ||
64 | function _M.gmmsg(role, pms) | 53 | function _M.gmmsg(role, pms) |
65 | role:sendGmMsg(pms.pm1, true) | 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 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) | 55 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) |
74 | - | ||
75 | return "指令成功" | 56 | return "指令成功" |
76 | end | 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 | function _M.silent(role, pms) | 66 | function _M.silent(role, pms) |
79 | local pm1 = tonum(pms.pm1) | 67 | local pm1 = tonum(pms.pm1) |
80 | if pm1 < 1 then | 68 | if pm1 < 1 then |
@@ -92,6 +80,10 @@ function _M.pvp_cross_head(role, pms) | @@ -92,6 +80,10 @@ function _M.pvp_cross_head(role, pms) | ||
92 | return "成功" | 80 | return "成功" |
93 | end | 81 | end |
94 | 82 | ||
83 | +function _M.expire_item(role, pms) | ||
84 | + role:awardExpireItem(tonum(pms.pm1), pms.pm2, {log = {desc = "gm"}}) | ||
85 | + return "成功" | ||
86 | +end | ||
95 | 87 | ||
96 | local helpDes = {{"描述", "指令", "参数1", "参数2" ,"参数3"}} | 88 | local helpDes = {{"描述", "指令", "参数1", "参数2" ,"参数3"}} |
97 | 89 | ||
@@ -259,6 +251,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"}) | @@ -259,6 +251,7 @@ table.insert(helpDes, {"获得所有零件", "get", "RUNE"}) | ||
259 | table.insert(helpDes, {"获得所有碎片", "get", "FRAG"}) | 251 | table.insert(helpDes, {"获得所有碎片", "get", "FRAG"}) |
260 | table.insert(helpDes, {"获得所有食物", "get", "FOOD"}) | 252 | table.insert(helpDes, {"获得所有食物", "get", "FOOD"}) |
261 | table.insert(helpDes, {"获得所有角色", "get", "HERO"}) | 253 | table.insert(helpDes, {"获得所有角色", "get", "HERO"}) |
254 | +table.insert(helpDes, {"获得满级满觉醒角色,满级满精进铭文", "get", "MAXHERO"}) | ||
262 | function _M.get(role, pms) | 255 | function _M.get(role, pms) |
263 | if pms.pm1 == "ALL" then | 256 | if pms.pm1 == "ALL" then |
264 | local reward = {} | 257 | local reward = {} |
@@ -275,7 +268,7 @@ function _M.get(role, pms) | @@ -275,7 +268,7 @@ function _M.get(role, pms) | ||
275 | end | 268 | end |
276 | end | 269 | end |
277 | elseif pms.pm1 == "RUNE" then | 270 | elseif pms.pm1 == "RUNE" then |
278 | - for itemId = 2000 , 3000 do | 271 | + for itemId = 10000 , 20000 do |
279 | if csvdb["itemCsv"][itemId] then | 272 | if csvdb["itemCsv"][itemId] then |
280 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) | 273 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
281 | end | 274 | end |
@@ -298,6 +291,37 @@ function _M.get(role, pms) | @@ -298,6 +291,37 @@ function _M.get(role, pms) | ||
298 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) | 291 | role:award({[itemId] = 1}, {log = {desc = "gm"}}) |
299 | end | 292 | end |
300 | end | 293 | end |
294 | + elseif pms.pm1 == "MAXHERO" then | ||
295 | + -- 给英雄 | ||
296 | + for heroId = 100, 500 do | ||
297 | + local heroCfg = csvdb["unitCsv"][heroId] | ||
298 | + if heroCfg and heroCfg.open == 1 then | ||
299 | + role:award({[heroId + 300] = 1}, {log = {desc = "gm"}}) | ||
300 | + end | ||
301 | + end | ||
302 | + -- 升满级 | ||
303 | + for _, hero in ipairs(role.heros) do | ||
304 | + _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = 130}) | ||
305 | + hero:updateProperty({field = "wakeL", value = #csvdb["unit_wakeCsv"]}) | ||
306 | + end | ||
307 | + | ||
308 | + -- 添加铭文 | ||
309 | + for itemId = 10000 , 20000 do | ||
310 | + if csvdb["itemCsv"][itemId] then | ||
311 | + role:award({[itemId] = 1}, {log = {desc = "gm"}}) | ||
312 | + end | ||
313 | + end | ||
314 | + for _, rune in ipairs(role.runeBag) do | ||
315 | + local typ = rune:getProperty("type") | ||
316 | + local id = rune:getProperty("id") | ||
317 | + | ||
318 | + local runeSet = csvdb["runeCsv"][typ] | ||
319 | + if not runeSet then break end | ||
320 | + local runeData = runeSet[id] | ||
321 | + if not runeData then break end | ||
322 | + | ||
323 | + rune:updateProperty({field = "level",value = runeData.lvLimit}) | ||
324 | + end | ||
301 | else | 325 | else |
302 | local itemId = tonum(pms.pm1) | 326 | local itemId = tonum(pms.pm1) |
303 | if not csvdb["itemCsv"][itemId] then | 327 | if not csvdb["itemCsv"][itemId] then |
@@ -371,6 +395,7 @@ function _M.advt(role, pms) | @@ -371,6 +395,7 @@ function _M.advt(role, pms) | ||
371 | local chapterId = tonum(pms.pm1) | 395 | local chapterId = tonum(pms.pm1) |
372 | local layer = tonum(pms.pm2) | 396 | local layer = tonum(pms.pm2) |
373 | local mapId = tonum(pms.pm3) | 397 | local mapId = tonum(pms.pm3) |
398 | + local actid = tonum(pms.pm4) | ||
374 | local advCsv = csvdb["adv_chapterCsv"][chapterId] | 399 | local advCsv = csvdb["adv_chapterCsv"][chapterId] |
375 | if not advCsv then return "不存在的章节" end | 400 | if not advCsv then return "不存在的章节" end |
376 | 401 | ||
@@ -387,6 +412,7 @@ function _M.advt(role, pms) | @@ -387,6 +412,7 @@ function _M.advt(role, pms) | ||
387 | level = layer, | 412 | level = layer, |
388 | isEnter = true, | 413 | isEnter = true, |
389 | debugMapId = mapId, | 414 | debugMapId = mapId, |
415 | + actid = actid, | ||
390 | }) | 416 | }) |
391 | role:mylog("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) | 417 | role:mylog("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) |
392 | return "成功" | 418 | return "成功" |
@@ -539,6 +565,70 @@ function _M.actbattle(role, pms) | @@ -539,6 +565,70 @@ function _M.actbattle(role, pms) | ||
539 | return "成功" | 565 | return "成功" |
540 | end | 566 | end |
541 | 567 | ||
568 | +table.insert(helpDes, {"清空背包", "clearbag"}) | ||
569 | +function _M.clearbag(role, pms) | ||
570 | + -- 装备 | ||
571 | + role:updateProperty({field="equips", value = {}}) | ||
572 | + -- 道具 | ||
573 | + local items = role:getProperty("items"):toNumMap() | ||
574 | + for k, v in pairs(items) do | ||
575 | + role:addItem({itemId = k, count = -v, log = {desc = "gm"}}) | ||
576 | + end | ||
577 | + | ||
578 | + -- 铭文 | ||
579 | + local uids = {} | ||
580 | + for uid, _ in pairs(role.runeBag) do | ||
581 | + table.insert(uids, uid) | ||
582 | + end | ||
583 | + role:delRunes(uids, {log = {desc = "gm"}}) | ||
584 | + | ||
585 | + return "成功" | ||
586 | +end | ||
587 | + | ||
588 | +table.insert(helpDes, {"发送跑马灯", "notice"}) | ||
589 | +function _M.notice(role, pms) | ||
590 | + local msg = pms.pm1 | ||
591 | + SendPacket(actionCodes.Sys_commonNotice, MsgPack.pack({body = msg})) | ||
592 | + | ||
593 | + return "成功" | ||
594 | +end | ||
595 | + | ||
596 | +table.insert(helpDes, {"活动关卡", "actbp", "id", "actid"}) | ||
597 | +function _M.actbp(role, pms) | ||
598 | + local id = tonum(pms.pm1, 0) | ||
599 | + local actid = tonum(pms.pm2, 0) | ||
600 | + if not role.activity:isOpenById(actid, "ChallengeLevel") then return end | ||
601 | + local actData = role.activity:getActData("ChallengeLevel") or {} | ||
602 | + | ||
603 | + local actCfg = csvdb["activity_battleCsv"][actid] | ||
604 | + if not actCfg then return end | ||
605 | + for k, v in pairs(actCfg) do | ||
606 | + if k <= id then | ||
607 | + local bpInfo = actData[i] or {} | ||
608 | + bpInfo["star"] = 1 | ||
609 | + actData[k] = bpInfo | ||
610 | + end | ||
611 | + end | ||
612 | + role.activity:updateActData("ChallengeLevel", actData) | ||
613 | + | ||
614 | + return "成功" | ||
615 | +end | ||
616 | + | ||
617 | +table.insert(helpDes, {"活动拾荒", "actadv", "id", "actid"}) | ||
618 | +function _M.actadv(role, pms) | ||
619 | + local id = tonum(pms.pm1, 0) | ||
620 | + local actid = tonum(pms.pm2, 0) | ||
621 | + if not role.activity:isOpenById(actid, "AdvLevel") then return end | ||
622 | + local actData = role.activity:getActData("AdvLevel") or {} | ||
623 | + local advInfo = actData[id] | ||
624 | + advInfo["pass"] = 1 | ||
625 | + actData[id] = advInfo | ||
626 | + | ||
627 | + role.activity:updateActData("AdvLevel", actData) | ||
628 | + | ||
629 | + return "成功" | ||
630 | +end | ||
631 | + | ||
542 | function _M.helpRpc(agent, data) | 632 | function _M.helpRpc(agent, data) |
543 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) | 633 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) |
544 | return true | 634 | return true |
@@ -546,11 +636,23 @@ end | @@ -546,11 +636,23 @@ end | ||
546 | 636 | ||
547 | function _M.test(role, pms) | 637 | function _M.test(role, pms) |
548 | local id = tonum(pms.pm1, 0) | 638 | local id = tonum(pms.pm1, 0) |
639 | + local actid = nil | ||
640 | + if id > 100 then | ||
641 | + actid = tonum(pms.pm2, 0) | ||
642 | + end | ||
549 | --local hero = require ("actions.HeroAction") | 643 | --local hero = require ("actions.HeroAction") |
550 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 644 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
551 | 645 | ||
552 | --role:sendMail(13, nil, "1=2", {111}) | 646 | --role:sendMail(13, nil, "1=2", {111}) |
553 | - dump(redisproxy:zrevrange("rank:tower", 0 , 10, "WITHSCORES")) | 647 | + local file = io.open("draw_hero_"..id..".csv", "a") |
648 | + for i=1, 10000 do | ||
649 | + local heroIds = _M.drawHero(role, id, actid) | ||
650 | + for k, v in ipairs(heroIds) do | ||
651 | + print((i - 1)* 10 + k, v) | ||
652 | + file:write(v.."\n") | ||
653 | + end | ||
654 | + end | ||
655 | + io.close(file) | ||
554 | return "成功" | 656 | return "成功" |
555 | end | 657 | end |
556 | 658 | ||
@@ -559,8 +661,15 @@ function _M.ayncPurchase(role, params) | @@ -559,8 +661,15 @@ function _M.ayncPurchase(role, params) | ||
559 | return role:handlePurchase(params) or "" | 661 | return role:handlePurchase(params) or "" |
560 | end | 662 | end |
561 | 663 | ||
664 | +-- 获取订单号 | ||
665 | +function _M.getPurchaseOrder(role, params) | ||
666 | + return role:getPurchaseOrderByPlatform(params) or "" | ||
667 | +end | ||
668 | + | ||
669 | + | ||
562 | function _M.cz(role, pms) | 670 | function _M.cz(role, pms) |
563 | local id = tonum(pms.pm1) | 671 | local id = tonum(pms.pm1) |
672 | + local sid = tonum(pms.pm2) or 0 | ||
564 | local csvData = csvdb["shop_rechargeCsv"][id] | 673 | local csvData = csvdb["shop_rechargeCsv"][id] |
565 | if not csvData then | 674 | if not csvData then |
566 | return "充值id错误, 查看shop_recharge.csv" | 675 | return "充值id错误, 查看shop_recharge.csv" |
@@ -570,10 +679,276 @@ function _M.cz(role, pms) | @@ -570,10 +679,276 @@ function _M.cz(role, pms) | ||
570 | transactionId = "GM", | 679 | transactionId = "GM", |
571 | order = "GM", | 680 | order = "GM", |
572 | pay_time = skynet.timex(), | 681 | pay_time = skynet.timex(), |
682 | + sid = sid == 1 and IOS_SID or 0, | ||
573 | }) | 683 | }) |
574 | role:mylog("gm_action", {desc = "recharge", int1 = id, key1 = pms.sender}) | 684 | role:mylog("gm_action", {desc = "recharge", int1 = id, key1 = pms.sender}) |
575 | return "指令成功" | 685 | return "指令成功" |
576 | end | 686 | end |
577 | 687 | ||
688 | +function _M.drawHero(role, t, act) | ||
689 | + local btype = t -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池 | ||
690 | + local subType = 1-- 定向卡池需要传 子类型 | ||
691 | + local drawType = 2 -- 1 单抽 2 十连 | ||
692 | + if btype ~= 1 then | ||
693 | + subType = 1 | ||
694 | + end | ||
695 | + | ||
696 | + local actid = act | ||
697 | + -- 另开活动卡池 | ||
698 | + if actid then | ||
699 | + --if not role.activity:isOpenById(actid, "ActHeroPool") then return end | ||
700 | + local cfg = csvdb["activity_ctrlCsv"][actid] | ||
701 | + if not cfg then return end | ||
702 | + | ||
703 | + btype = cfg.condition | ||
704 | + end | ||
705 | + | ||
706 | + local buildTypeData = csvdb["build_typeCsv"][btype] | ||
707 | + if not buildTypeData then return 2 end | ||
708 | + | ||
709 | + local drawCount = {1, 10} -- 抽取次数 | ||
710 | + if not drawCount[drawType] then return 3 end | ||
711 | + | ||
712 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | ||
713 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | ||
714 | + | ||
715 | + -- 抽取的池子 | ||
716 | + local poolMap = buildTypeData["pool"]:toNumMap() | ||
717 | + local poolId = poolMap[subType] | ||
718 | + if not poolId then return 5 end | ||
719 | + | ||
720 | + --TODO 活动覆盖 | ||
721 | + local actPoolId = role.activity:getActivityPool(btype, subType) | ||
722 | + if actPoolId ~= 0 then | ||
723 | + poolId = actPoolId | ||
724 | + end | ||
725 | + | ||
726 | + local unitPool = csvdb["build_unitCsv"][poolId] | ||
727 | + if not unitPool then return 7 end | ||
728 | + | ||
729 | + -- 开始抽 | ||
730 | + local resultPool = {} | ||
731 | + local function fillDrawPool(isFloorBack) | ||
732 | + local condition = {"rare"} | ||
733 | + local values = {} | ||
734 | + | ||
735 | + | ||
736 | + for idx, field in ipairs(condition) do | ||
737 | + if not values[idx] then | ||
738 | + local lpool = {} | ||
739 | + local curIdx = 1 | ||
740 | + while unitPool[field .. "_" .. curIdx] do | ||
741 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
742 | + curIdx = curIdx + 1 | ||
743 | + end | ||
744 | + | ||
745 | + if next(lpool) then | ||
746 | + values[idx] = math.randWeight(lpool, 1) | ||
747 | + end | ||
748 | + end | ||
749 | + end | ||
750 | + | ||
751 | + local weight = 0 | ||
752 | + local up_pool = nil | ||
753 | + local rand_v = math.randomInt(1, 100) | ||
754 | + if values[1] == HeroQuality.SR then | ||
755 | + weight = unitPool["up_sr_weight"] | ||
756 | + up_pool = unitPool["up_sr_id"] | ||
757 | + elseif values[1] == HeroQuality.SSR then | ||
758 | + weight = unitPool["up_ssr_weight"] | ||
759 | + up_pool = unitPool["up_ssr_id"] | ||
760 | + if btype == 5 then | ||
761 | + weight = 3 * weight | ||
762 | + end | ||
763 | + end | ||
764 | + --print(poolId, rand_v, weight, up_pool, values[1]) | ||
765 | + if rand_v < weight and up_pool then | ||
766 | + up_pool = up_pool:toArray(true, "=") | ||
767 | + if btype == 5 then -- 爱心卡池,使用玩家设置的备选池子 | ||
768 | + up_pool = role:getProperty("wishPool") | ||
769 | + up_pool[1] = 408 | ||
770 | + up_pool[2] = 409 | ||
771 | + up_pool[3] = 410 | ||
772 | + end | ||
773 | + for k, v in ipairs(up_pool) do | ||
774 | + resultPool[v] = {1} | ||
775 | + end | ||
776 | + else | ||
777 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | ||
778 | + local pool_str = "pool_" .. poolId | ||
779 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | ||
780 | + local itemData = csvdb["itemCsv"][itemId] | ||
781 | + while itemData do | ||
782 | + if itemData.type ~= ItemType.Hero then break end | ||
783 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
784 | + if not heroData then break end | ||
785 | + local ok = true | ||
786 | + -- 保底是全随机,不用比较类型 | ||
787 | + if not isFloorBack then | ||
788 | + for idx, field in ipairs(condition) do | ||
789 | + if heroData[field] ~= values[idx] then ok = false break end | ||
790 | + end | ||
791 | + end | ||
792 | + if up_pool then | ||
793 | + for k, v in ipairs(up_pool) do | ||
794 | + if v == itemData.id then | ||
795 | + ok = false | ||
796 | + break | ||
797 | + end | ||
798 | + end | ||
799 | + end | ||
800 | + if not ok then break end | ||
801 | + if oneData[pool_str] > 0 then | ||
802 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ||
803 | + end | ||
804 | + break | ||
805 | + end | ||
806 | + end | ||
807 | + end | ||
808 | + end | ||
809 | + end | ||
810 | + | ||
811 | + local guideHero = nil | ||
812 | + if role:getProperty("newerGuide") == "8=1" then | ||
813 | + guideHero = globalCsv.newdraw_hero_item_id or 503 | ||
814 | + end | ||
815 | + | ||
816 | + local ssrCount = 0 | ||
817 | + local reward = {} | ||
818 | + local logReward = {} | ||
819 | + local result = {} | ||
820 | + for i = 1, drawCount[drawType] do | ||
821 | + floorHeroCount = floorHeroCount + 1 | ||
822 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | ||
823 | + resultPool = {} | ||
824 | + fillDrawPool(isFloorBack) | ||
825 | + if not next(resultPool) then | ||
826 | + skynet.error("random pool error, poolId:" .. poolId, isFloorBack) | ||
827 | + return 8 | ||
828 | + end | ||
829 | + | ||
830 | + local itemId = math.randWeight(resultPool, 1) | ||
831 | + if guideHero then | ||
832 | + itemId = guideHero | ||
833 | + end | ||
834 | + | ||
835 | + local itemData = csvdb["itemCsv"][itemId] | ||
836 | + if itemData.quality == HeroQuality.SSR then | ||
837 | + ssrCount = ssrCount + 1 | ||
838 | + if not guideHero then | ||
839 | + -- 广播获得ssr英雄 | ||
840 | + local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} | ||
841 | + --mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) | ||
842 | + end | ||
843 | + end | ||
844 | + | ||
845 | + if btype == 4 and role:getProperty("newerDraw") == 0 then -- 新手卡池 | ||
846 | + if itemData.quality == HeroQuality.SSR then | ||
847 | + floorHeroCount = 0 | ||
848 | + end | ||
849 | + else | ||
850 | + if itemData.quality >= HeroQuality.SR then | ||
851 | + floorHeroCount = 0 | ||
852 | + end | ||
853 | + end | ||
854 | + | ||
855 | + if role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
856 | + local fragId = itemData.id - ItemStartId.Hero | ||
857 | + local heroData = csvdb["unitCsv"][fragId] | ||
858 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
859 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
860 | + logReward[fragId] = (logReward[fragId] or 0) + count | ||
861 | + table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | ||
862 | + else | ||
863 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | ||
864 | + logReward[itemId] = (logReward[itemId] or 0) + 1 | ||
865 | + table.insert(reward, {id = itemId, count = 1}) | ||
866 | + end | ||
867 | + end | ||
868 | + | ||
869 | + if draw_floor_back_counts then | ||
870 | + local floorHero = role:getProperty("floorHero") | ||
871 | + floorHero[btype] = floorHeroCount | ||
872 | + role:setProperty("floorHero", floorHero) | ||
873 | + end | ||
874 | + | ||
875 | + if btype == 4 then | ||
876 | + local newCount = role:getProperty("newerDraw") | ||
877 | + role:updateProperty({field="newerDraw", value = newCount + drawCount[drawType]}) | ||
878 | + end | ||
879 | + | ||
880 | + --SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | ||
881 | + for k, v in pairs(reward) do | ||
882 | + local hero = v | ||
883 | + if hero["from"] then | ||
884 | + result[#result+1] = hero["from"] | ||
885 | + else | ||
886 | + result[#result+1] = hero["id"] | ||
887 | + end | ||
888 | + end | ||
889 | + | ||
890 | + local feedbackId = buildTypeData["can_feedback"] or 0 | ||
891 | + if feedbackId ~= 0 then | ||
892 | + -- 达到一定次数,给响应奖励 | ||
893 | + local oldVal = role:getProperty("repayHero") or 0 | ||
894 | + if actid then | ||
895 | + local actData = role.activity:getActData("ActHeroPool") | ||
896 | + oldVal = actData[btype] or 0 | ||
897 | + end | ||
898 | + local newVal = oldVal + drawCount[drawType] | ||
899 | + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | ||
900 | + -- 空字符穿代表直接给英雄 走以前repayHeroRpc | ||
901 | + if drawCardReward == "" then | ||
902 | + local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 | ||
903 | + repayHeroMaxCount = repayHeroMaxCount + 1 | ||
904 | + | ||
905 | + role:updateProperty({field = "repayMaxC", value = repayHeroMaxCount}) | ||
906 | + local even = repayHeroMaxCount % 2 | ||
907 | + local id = 0 | ||
908 | + if even == 1 then | ||
909 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
910 | + else | ||
911 | + local giftHeroSet = {} | ||
912 | + for gid, cfg in pairs(csvdb["build_giftCsv"]) do | ||
913 | + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | ||
914 | + giftHeroSet[gid] = {1} | ||
915 | + end | ||
916 | + end | ||
917 | + if next(giftHeroSet) then | ||
918 | + id = math.randWeight(giftHeroSet, 1) | ||
919 | + end | ||
920 | + end | ||
921 | + if id == 0 then | ||
922 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | ||
923 | + end | ||
924 | + | ||
925 | + local r,change = {} | ||
926 | + local itemData = csvdb["itemCsv"][id] | ||
927 | + --if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
928 | + -- local fragId = itemData.id - ItemStartId.Hero | ||
929 | + -- local heroData = csvdb["unitCsv"][fragId] | ||
930 | + -- local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
931 | + -- r, change = role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}}) | ||
932 | + -- --r = {id = fragId, count = count, from = id, fcount = 1} | ||
933 | + --else | ||
934 | + r, change = role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}}) | ||
935 | + --end | ||
936 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
937 | + elseif drawCardReward and drawCardReward ~= "" then | ||
938 | + local r,change = {} | ||
939 | + r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
940 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
941 | + end | ||
942 | + if not actid then | ||
943 | + role:updateProperty({field = "repayHero", value = val}) | ||
944 | + else | ||
945 | + local actData = role.activity:getActData("ActHeroPool") | ||
946 | + actData[btype] = val | ||
947 | + role.activity:updateActData("ActHeroPool", actData) | ||
948 | + end | ||
949 | + end | ||
950 | + return result | ||
951 | +end | ||
952 | + | ||
578 | 953 | ||
579 | return _M | 954 | return _M |
580 | \ No newline at end of file | 955 | \ No newline at end of file |
src/actions/HangAction.lua
@@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) | @@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) | ||
235 | return 4 | 235 | return 4 |
236 | end | 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 | local reward, change | 248 | local reward, change |
239 | if isWin then --win | 249 | if isWin then --win |
240 | role:hangFinish(carbonId) | 250 | role:hangFinish(carbonId) |
@@ -581,6 +591,8 @@ function _M.startBonusBattleRpc(agent, data) | @@ -581,6 +591,8 @@ function _M.startBonusBattleRpc(agent, data) | ||
581 | 591 | ||
582 | local reward, change = bonusWinReward(role, bonusData, 3, count) | 592 | local reward, change = bonusWinReward(role, bonusData, 3, count) |
583 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 593 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
594 | + | ||
595 | + role:checkTaskEnter("BonusQuick", {count = count}) | ||
584 | else | 596 | else |
585 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) | 597 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) |
586 | if not next(bTeam) then return 5 end | 598 | if not next(bTeam) then return 5 end |
@@ -607,6 +619,18 @@ function _M.endBonusBattleRpc(agent, data) | @@ -607,6 +619,18 @@ function _M.endBonusBattleRpc(agent, data) | ||
607 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | 619 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) |
608 | return true | 620 | return true |
609 | end | 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 | local bonusData = csvdb["bonus_battleCsv"][id] | 634 | local bonusData = csvdb["bonus_battleCsv"][id] |
611 | 635 | ||
612 | local reward, change = {} | 636 | local reward, change = {} |
src/actions/HeroAction.lua
@@ -72,6 +72,7 @@ function _M.breakRpc( agent, data ) | @@ -72,6 +72,7 @@ function _M.breakRpc( agent, data ) | ||
72 | if hero:getProperty("level") < hero:getMaxLevel() then return 2 end | 72 | if hero:getProperty("level") < hero:getMaxLevel() then return 2 end |
73 | if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return 3 end | 73 | if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return 3 end |
74 | local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] | 74 | local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] |
75 | + if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end | ||
75 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} | 76 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
76 | if not role:checkItemEnough(cost) then return 4 end | 77 | if not role:checkItemEnough(cost) then return 4 end |
77 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) | 78 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
@@ -617,7 +618,7 @@ function _M.getResetRewardRpc(agent, data) | @@ -617,7 +618,7 @@ function _M.getResetRewardRpc(agent, data) | ||
617 | if level <= 1 and talent == "" then return end | 618 | if level <= 1 and talent == "" then return end |
618 | 619 | ||
619 | local pay = true | 620 | local pay = true |
620 | - if level <= 60 then | 621 | + if level <= 60 or role.activity:isOpen("HeroBackFree") then |
621 | pay = false | 622 | pay = false |
622 | end | 623 | end |
623 | 624 | ||
@@ -663,7 +664,8 @@ function _M.getResetRewardRpc(agent, data) | @@ -663,7 +664,8 @@ function _M.getResetRewardRpc(agent, data) | ||
663 | 664 | ||
664 | while stage > 0 do | 665 | while stage > 0 do |
665 | local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][stage] | 666 | local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][stage] |
666 | - for lvl = 1, curTalentLvl - 1 do | 667 | + local offset = stage == talent:getv(0,1) and curTalentLvl - 1 or #curData |
668 | + for lvl = 1, offset do | ||
667 | local talentData = curData[lvl] | 669 | local talentData = curData[lvl] |
668 | for itemId, count in pairs(talentData.money:toNumMap()) do | 670 | for itemId, count in pairs(talentData.money:toNumMap()) do |
669 | reward[itemId] = (reward[itemId] or 0) + count | 671 | reward[itemId] = (reward[itemId] or 0) + count |
@@ -853,6 +855,10 @@ function _M.drawHeroRpc(agent, data) | @@ -853,6 +855,10 @@ function _M.drawHeroRpc(agent, data) | ||
853 | elseif values[1] == HeroQuality.SSR then | 855 | elseif values[1] == HeroQuality.SSR then |
854 | weight = unitPool["up_ssr_weight"] | 856 | weight = unitPool["up_ssr_weight"] |
855 | up_pool = unitPool["up_ssr_id"] | 857 | up_pool = unitPool["up_ssr_id"] |
858 | + if btype == 5 then | ||
859 | + local wishPool = role:getProperty("wishPool") or {} | ||
860 | + weight = weight * #wishPool | ||
861 | + end | ||
856 | end | 862 | end |
857 | --print(poolId, rand_v, weight, up_pool, values[1]) | 863 | --print(poolId, rand_v, weight, up_pool, values[1]) |
858 | if rand_v < weight and up_pool then | 864 | if rand_v < weight and up_pool then |
@@ -879,6 +885,15 @@ function _M.drawHeroRpc(agent, data) | @@ -879,6 +885,15 @@ function _M.drawHeroRpc(agent, data) | ||
879 | if heroData[field] ~= values[idx] then ok = false break end | 885 | if heroData[field] ~= values[idx] then ok = false break end |
880 | end | 886 | end |
881 | end | 887 | end |
888 | + -- 随机剔除up池中的角色 | ||
889 | + if up_pool then | ||
890 | + for k, v in ipairs(up_pool) do | ||
891 | + if v == itemData.id then | ||
892 | + ok = false | ||
893 | + break | ||
894 | + end | ||
895 | + end | ||
896 | + end | ||
882 | if not ok then break end | 897 | if not ok then break end |
883 | if oneData[pool_str] > 0 then | 898 | if oneData[pool_str] > 0 then |
884 | resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | 899 | resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 |
@@ -900,6 +915,8 @@ function _M.drawHeroRpc(agent, data) | @@ -900,6 +915,8 @@ function _M.drawHeroRpc(agent, data) | ||
900 | local ssrCount = 0 | 915 | local ssrCount = 0 |
901 | local reward = {} | 916 | local reward = {} |
902 | local logReward = {} | 917 | local logReward = {} |
918 | + -- 限时礼包 | ||
919 | + local dailyDrawCnt = role.dailyData:getProperty("drawHeroCnt") or 0 | ||
903 | for i = 1, drawCount[drawType] do | 920 | for i = 1, drawCount[drawType] do |
904 | floorHeroCount = floorHeroCount + 1 | 921 | floorHeroCount = floorHeroCount + 1 |
905 | local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | 922 | local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts |
@@ -913,6 +930,7 @@ function _M.drawHeroRpc(agent, data) | @@ -913,6 +930,7 @@ function _M.drawHeroRpc(agent, data) | ||
913 | local itemId = math.randWeight(resultPool, 1) | 930 | local itemId = math.randWeight(resultPool, 1) |
914 | if guideHero then | 931 | if guideHero then |
915 | itemId = guideHero | 932 | itemId = guideHero |
933 | + guideHero = nil | ||
916 | end | 934 | end |
917 | 935 | ||
918 | local itemData = csvdb["itemCsv"][itemId] | 936 | local itemData = csvdb["itemCsv"][itemId] |
@@ -947,8 +965,13 @@ function _M.drawHeroRpc(agent, data) | @@ -947,8 +965,13 @@ function _M.drawHeroRpc(agent, data) | ||
947 | logReward[itemId] = (logReward[itemId] or 0) + 1 | 965 | logReward[itemId] = (logReward[itemId] or 0) + 1 |
948 | table.insert(reward, {id = itemId, count = 1}) | 966 | table.insert(reward, {id = itemId, count = 1}) |
949 | end | 967 | end |
968 | + | ||
969 | + dailyDrawCnt = dailyDrawCnt + 1 | ||
970 | + role:checkTaskEnter("DrawHeroLimitPack", {count = dailyDrawCnt}) | ||
950 | end | 971 | end |
951 | 972 | ||
973 | + role.dailyData:setProperty("drawHeroCnt", dailyDrawCnt) | ||
974 | + | ||
952 | if draw_floor_back_counts then | 975 | if draw_floor_back_counts then |
953 | local floorHero = role:getProperty("floorHero") | 976 | local floorHero = role:getProperty("floorHero") |
954 | floorHero[btype] = floorHeroCount | 977 | floorHero[btype] = floorHeroCount |
@@ -961,6 +984,9 @@ function _M.drawHeroRpc(agent, data) | @@ -961,6 +984,9 @@ function _M.drawHeroRpc(agent, data) | ||
961 | end | 984 | end |
962 | 985 | ||
963 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) | 986 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) |
987 | + if btype ~= 3 then | ||
988 | + role:checkTaskEnter("DrawHeroNotFriend", {pool = btype, count = drawCount[drawType]}) | ||
989 | + end | ||
964 | if ssrCount > 0 then | 990 | if ssrCount > 0 then |
965 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | 991 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
966 | end | 992 | end |
@@ -1108,7 +1134,7 @@ function _M.changeCrown(agent, data) | @@ -1108,7 +1134,7 @@ function _M.changeCrown(agent, data) | ||
1108 | 1134 | ||
1109 | local heroType = msg.heroType | 1135 | local heroType = msg.heroType |
1110 | 1136 | ||
1111 | - if not role:isHaveHero(heroType) then return true end | 1137 | + if heroType < 10000 and not role:isHaveHero(heroType) then return true end |
1112 | role:setProperty("crown", heroType) | 1138 | role:setProperty("crown", heroType) |
1113 | 1139 | ||
1114 | role:log("hero_show", { | 1140 | role:log("hero_show", { |
src/actions/HttpAction.lua
@@ -147,6 +147,15 @@ function _M.gm_action(query) | @@ -147,6 +147,15 @@ function _M.gm_action(query) | ||
147 | return status | 147 | return status |
148 | end | 148 | end |
149 | 149 | ||
150 | +function _M.query_role(query) | ||
151 | + if not query.uid then return "not found" end | ||
152 | + local user = redisproxy:get(string.format("uid:%s", query.uid)) | ||
153 | + if not user then return "not found" end | ||
154 | + local roleId = redisproxy:get(string.format("user:%s", string.upper(user))) | ||
155 | + if not roleId then return "not found" end | ||
156 | + return json.encode({roleId, user}) | ||
157 | +end | ||
158 | + | ||
150 | function _M.broadcast(query) | 159 | function _M.broadcast(query) |
151 | local msg = {} | 160 | local msg = {} |
152 | local handle = { | 161 | local handle = { |
src/actions/PvpAction.lua
@@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) | @@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) | ||
372 | 372 | ||
373 | if not match then return end | 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 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) | 385 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) |
376 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) | 386 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) |
377 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 | 387 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 |
@@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) | @@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) | ||
652 | end | 662 | end |
653 | end | 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 | if winCount >= 2 then | 675 | if winCount >= 2 then |
656 | isWin = true | 676 | isWin = true |
657 | elseif loseCount >= 2 then | 677 | elseif loseCount >= 2 then |
658 | isWin = false | 678 | isWin = false |
659 | else -- 没结束 | 679 | else -- 没结束 |
660 | -- 返回继续战斗 | 680 | -- 返回继续战斗 |
661 | - | ||
662 | local key = tostring(math.random()) | 681 | local key = tostring(math.random()) |
663 | _pvpStartBattleCacheH.key = key | 682 | _pvpStartBattleCacheH.key = key |
664 | local round = #_pvpStartBattleCacheH.result + 1 | 683 | local round = #_pvpStartBattleCacheH.result + 1 |
src/actions/RadioAction.lua
@@ -179,6 +179,7 @@ function _M.finishQuestRpc(agent, data) | @@ -179,6 +179,7 @@ function _M.finishQuestRpc(agent, data) | ||
179 | msg["heroFaith"] = heroFaithMap | 179 | msg["heroFaith"] = heroFaithMap |
180 | SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg)) | 180 | SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg)) |
181 | 181 | ||
182 | + role:checkTaskEnter("RadioTaskStart", {heroCnt = #task.heros}) | ||
182 | 183 | ||
183 | local herolist = {} | 184 | local herolist = {} |
184 | for _, heroId in ipairs(task.heros) do | 185 | for _, heroId in ipairs(task.heros) do |
src/actions/RoleAction.lua
@@ -157,6 +157,7 @@ function _M.loginRpc( agent, data ) | @@ -157,6 +157,7 @@ function _M.loginRpc( agent, data ) | ||
157 | SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start") | 157 | SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start") |
158 | 158 | ||
159 | role:changeStructVersion() -- 数据结构 版本更新 | 159 | role:changeStructVersion() -- 数据结构 版本更新 |
160 | + role:getAdvData(true) -- 清掉不合格的数据 | ||
160 | role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查 | 161 | role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查 |
161 | 162 | ||
162 | -- 跨天登陆事件 | 163 | -- 跨天登陆事件 |
@@ -165,6 +166,7 @@ function _M.loginRpc( agent, data ) | @@ -165,6 +166,7 @@ function _M.loginRpc( agent, data ) | ||
165 | role.activity:checkActivityStatus(now, false, false) | 166 | role.activity:checkActivityStatus(now, false, false) |
166 | role:log("onLogin") | 167 | role:log("onLogin") |
167 | end | 168 | end |
169 | + role:checkTaskEnter("Login", {}) | ||
168 | 170 | ||
169 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) | 171 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) |
170 | 172 | ||
@@ -586,9 +588,9 @@ function _M.openTimeBoxRpc(agent, data) | @@ -586,9 +588,9 @@ function _M.openTimeBoxRpc(agent, data) | ||
586 | else | 588 | else |
587 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time | 589 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time |
588 | local unitTime = globalCsv.box_key_time[oldId] * 60 | 590 | local unitTime = globalCsv.box_key_time[oldId] * 60 |
589 | - local doneCnt = math.floor((process + skynet.timex() - time) / unitTime) | 591 | + local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) |
590 | if doneCnt > 0 then | 592 | if doneCnt > 0 then |
591 | - reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | 593 | + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) |
592 | end | 594 | end |
593 | end | 595 | end |
594 | local limit = globalCsv.box_key_max[itemId] or 5 | 596 | local limit = globalCsv.box_key_max[itemId] or 5 |
@@ -606,11 +608,11 @@ function _M.openTimeBoxRpc(agent, data) | @@ -606,11 +608,11 @@ function _M.openTimeBoxRpc(agent, data) | ||
606 | local itemData = csvdb["itemCsv"][itemId] | 608 | local itemData = csvdb["itemCsv"][itemId] |
607 | local unitTime = globalCsv.box_key_time[itemId] * 60 | 609 | local unitTime = globalCsv.box_key_time[itemId] * 60 |
608 | if quick then | 610 | if quick then |
609 | - stopTime = time + globalCsv.box_productLine_time * 3600 | 611 | + stopTime = nowTime + quick |
610 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 612 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
611 | - local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2] | 613 | + local costKey = math.ceil(quick / (cost_pre[1] * 60)) * cost_pre[2] |
612 | if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end | 614 | if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end |
613 | - role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}}) | 615 | + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) |
614 | else | 616 | else |
615 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) | 617 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) |
616 | end | 618 | end |
@@ -618,7 +620,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -618,7 +620,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
618 | 620 | ||
619 | local doneCnt = math.floor((process + stopTime - time) / unitTime) | 621 | local doneCnt = math.floor((process + stopTime - time) / unitTime) |
620 | if doneCnt > 0 then | 622 | if doneCnt > 0 then |
621 | - reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | 623 | + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) |
622 | end | 624 | end |
623 | if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then | 625 | if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then |
624 | nowTime = 0 | 626 | nowTime = 0 |
@@ -687,7 +689,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -687,7 +689,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
687 | reward[id] = (reward[id] or 0) + num | 689 | reward[id] = (reward[id] or 0) + num |
688 | end | 690 | end |
689 | end | 691 | end |
690 | - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}}) | 692 | + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId, int2 = oper}}) |
691 | else | 693 | else |
692 | return | 694 | return |
693 | end | 695 | end |
@@ -752,6 +754,17 @@ function _M.openSpeedUpBoxRpc(agent, data) | @@ -752,6 +754,17 @@ function _M.openSpeedUpBoxRpc(agent, data) | ||
752 | role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) | 754 | role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) |
753 | end | 755 | end |
754 | 756 | ||
757 | + local doubleCoef = role.activity:isOpen("DoubleDrop") and 2 or 1 | ||
758 | + -- 特权卡获取加速获得额外道具 | ||
759 | + local coef = role.storeData:getProduceItemSpeedCoef() | ||
760 | + if coef > 1 or doubleCoef > 1 then | ||
761 | + for k, cnt in pairs(reward) do | ||
762 | + if k == ItemId.Gold or k == ItemId.Exp then | ||
763 | + reward[k] = math.floor(cnt * coef * doubleCoef) | ||
764 | + end | ||
765 | + end | ||
766 | + end | ||
767 | + | ||
755 | local change | 768 | local change |
756 | reward, change = role:award(reward, {log = {desc = "speedUpBox"}}) | 769 | reward, change = role:award(reward, {log = {desc = "speedUpBox"}}) |
757 | 770 | ||
@@ -847,6 +860,13 @@ function _M.taskRpc(agent, data) | @@ -847,6 +860,13 @@ function _M.taskRpc(agent, data) | ||
847 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) | 860 | local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) |
848 | local active = (taskStatus["a"] or 0) + taskData.active | 861 | local active = (taskStatus["a"] or 0) + taskData.active |
849 | 862 | ||
863 | + -- 日常活动完成 | ||
864 | + if taskType == 1 then | ||
865 | + role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) | ||
866 | + else | ||
867 | + role:checkTaskEnter("WeekTask", {pre = (taskStatus["a"] or 0), cur = active}) | ||
868 | + end | ||
869 | + | ||
850 | role:changeUpdates({ | 870 | role:changeUpdates({ |
851 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, | 871 | { type = roleField[taskType], field = {"t", taskId}, value = -1 }, |
852 | { type = roleField[taskType], field = "a", value = active}, | 872 | { type = roleField[taskType], field = "a", value = active}, |
@@ -907,62 +927,96 @@ function _M.achiveRpc(agent, data) | @@ -907,62 +927,96 @@ function _M.achiveRpc(agent, data) | ||
907 | local taskId = msg.id --任务id | 927 | local taskId = msg.id --任务id |
908 | 928 | ||
909 | if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end | 929 | if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end |
910 | - | ||
911 | - local achiveTask = csvdb["achievementCsv"][taskId] | ||
912 | - if not achiveTask then return 1 end | ||
913 | - | ||
914 | local achiveT = role:getProperty("achiveT") | 930 | local achiveT = role:getProperty("achiveT") |
915 | local achiveV = role:getProperty("achiveV") | 931 | local achiveV = role:getProperty("achiveV") |
932 | + local fuxRecord = role:getProperty("fuxR") or 0 | ||
933 | + | ||
934 | + local groups = {} | ||
935 | + | ||
936 | + if not taskId then | ||
937 | + local awards = {} | ||
938 | + for id, cfg in pairs(csvdb["achievementCsv"]) do | ||
939 | + -- 没领过 | ||
940 | + if not achiveV[id] then | ||
941 | + if (achiveT[cfg.type] or 0) >= cfg.condition1 then | ||
942 | + local award = cfg.reward:toNumMap() | ||
943 | + for k, v in pairs(award) do | ||
944 | + awards[k] = (awards[k] or 0) + v | ||
945 | + end | ||
946 | + achiveV[id] = skynet.timex() | ||
947 | + groups[cfg.group] = 1 | ||
948 | + | ||
949 | + role:log("achievement", { | ||
950 | + achievement_id = cfg.id, -- 成就id | ||
951 | + achievement_type = cfg.type, -- 成就类型,具体枚举表中成就类型枚举表 | ||
952 | + achievement_reward = award, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | ||
953 | + }) | ||
954 | + end | ||
955 | + end | ||
956 | + end | ||
957 | + if not next(awards) then | ||
958 | + return 5 | ||
959 | + end | ||
960 | + local reward, change = role:award(awards, {log = {desc = "finishAchive", int1 = 0}}) | ||
961 | + role:updateProperty({field = "achiveV", value = achiveV}) | ||
916 | 962 | ||
917 | - if achiveV[taskId] then return 2 end | 963 | + SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) |
964 | + else | ||
965 | + local achiveTask = csvdb["achievementCsv"][taskId] | ||
966 | + if not achiveTask then return 1 end | ||
918 | 967 | ||
919 | - local curStatus = achiveT[achiveTask.type] or 0 | ||
920 | - local maxc = achiveTask.condition1 | 968 | + if achiveV[taskId] then return 2 end |
921 | 969 | ||
922 | - if maxc > curStatus then | ||
923 | - return 3 | ||
924 | - end | 970 | + local curStatus = achiveT[achiveTask.type] or 0 |
971 | + local maxc = achiveTask.condition1 | ||
925 | 972 | ||
926 | - local reward, change = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}}) | ||
927 | - role:changeUpdates({ | ||
928 | - { type = "achiveV", field = taskId, value = skynet.timex() } | ||
929 | - }) | 973 | + if maxc > curStatus then |
974 | + return 3 | ||
975 | + end | ||
930 | 976 | ||
931 | - -- 复兴奖励 | ||
932 | - if csvdb["achievement_groupCsv"][achiveTask.group].bookmark == 3 then | ||
933 | - local overCount = 0 | ||
934 | - for tId, status in pairs(achiveV) do | ||
935 | - local tData = csvdb["achievementCsv"][tId] | ||
936 | - if tData then | ||
937 | - local groupData = csvdb["achievement_groupCsv"][tData.group] | ||
938 | - if groupData.bookmark == 3 then | ||
939 | - overCount = overCount + 1 | 977 | + local reward, change = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}}) |
978 | + role:changeUpdates({ | ||
979 | + { type = "achiveV", field = taskId, value = skynet.timex() } | ||
980 | + }) | ||
981 | + groups[achiveTask.group] = 1 | ||
982 | + | ||
983 | + role:log("achievement", { | ||
984 | + achievement_id = taskId, -- 成就id | ||
985 | + achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 | ||
986 | + achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | ||
987 | + }) | ||
988 | + | ||
989 | + SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | ||
990 | + end | ||
991 | + | ||
992 | + for group, _ in pairs(groups) do | ||
993 | + -- 复兴奖励 | ||
994 | + if csvdb["achievement_groupCsv"][group].bookmark == 3 then | ||
995 | + local overCount = 0 | ||
996 | + local preMaxCount = fuxRecord or 0 | ||
997 | + for tId, status in pairs(achiveV) do | ||
998 | + local tData = csvdb["achievementCsv"][tId] | ||
999 | + if tData then | ||
1000 | + local groupData = csvdb["achievement_groupCsv"][tData.group] | ||
1001 | + if groupData.bookmark == 3 then | ||
1002 | + overCount = overCount + 1 | ||
1003 | + end | ||
940 | end | 1004 | end |
941 | end | 1005 | end |
942 | - end | ||
943 | - | ||
944 | - for level, pData in pairs(csvdb["achievement_rewardCsv"]) do | ||
945 | - if pData.request == overCount then | ||
946 | - -- 发放奖励 | ||
947 | - redisproxy:insertEmail({ | ||
948 | - roleId = role:getProperty("id"), | ||
949 | - emailId = 101, | ||
950 | - attachments = pData.reward, | ||
951 | - contentPms = {pData.level}, | ||
952 | - }) | ||
953 | - elseif pData.request > overCount then | ||
954 | - break | 1006 | + local flag = false |
1007 | + for level, pData in pairs(csvdb["achievement_rewardCsv"]) do | ||
1008 | + if preMaxCount < pData.request and overCount >= pData.request then | ||
1009 | + role:sendMail(101, skynet.timex(), pData.reward, {pData.level}) | ||
1010 | + flag = true | ||
1011 | + end | ||
955 | end | 1012 | end |
1013 | + if flag then | ||
1014 | + role:updateProperty({field = "fuxR", value = overCount, notNotify = true}) | ||
1015 | + end | ||
1016 | + break | ||
956 | end | 1017 | end |
957 | end | 1018 | end |
958 | - | ||
959 | - role:log("achievement", { | ||
960 | - achievement_id = taskId, -- 成就id | ||
961 | - achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 | ||
962 | - achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | ||
963 | - }) | ||
964 | 1019 | ||
965 | - SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | ||
966 | return true | 1020 | return true |
967 | end | 1021 | end |
968 | 1022 | ||
@@ -1013,6 +1067,10 @@ function _M.chatRpc(agent, data) | @@ -1013,6 +1067,10 @@ function _M.chatRpc(agent, data) | ||
1013 | result = 1 | 1067 | result = 1 |
1014 | return | 1068 | return |
1015 | end | 1069 | end |
1070 | + if role:getProperty("level") < (globalCsv.chat_level or 15) then | ||
1071 | + result = 3 | ||
1072 | + return | ||
1073 | + end | ||
1016 | 1074 | ||
1017 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 | 1075 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
1018 | 1076 |
src/actions/StoreAction.lua
@@ -23,7 +23,7 @@ function _M.rechargeRpc(agent , data) | @@ -23,7 +23,7 @@ function _M.rechargeRpc(agent , data) | ||
23 | skynet.timeout(10, function () | 23 | skynet.timeout(10, function () |
24 | role:handlePurchase({ | 24 | role:handlePurchase({ |
25 | order = partnerOrderId, | 25 | order = partnerOrderId, |
26 | - amount = dataSet.rmb, | 26 | + amount = dataSet.rmb * 100, |
27 | game_money = dataSet.diamond, | 27 | game_money = dataSet.diamond, |
28 | product_id = dataSet.productId, | 28 | product_id = dataSet.productId, |
29 | pay_time = skynet.timex(), | 29 | pay_time = skynet.timex(), |
@@ -310,6 +310,13 @@ function _M.getFreeChestRpc(agent, data) | @@ -310,6 +310,13 @@ function _M.getFreeChestRpc(agent, data) | ||
310 | local config = csvdb["shop_rechargeCsv"][id] | 310 | local config = csvdb["shop_rechargeCsv"][id] |
311 | if not config then return end | 311 | if not config then return end |
312 | 312 | ||
313 | + --判断是否是活动商品 | ||
314 | + if config.activity_id ~= 0 then | ||
315 | + local actCfg = csvdb["activity_ctrlCsv"][config.activity_id] | ||
316 | + if not actCfg then return 2 end | ||
317 | + if not role.activity:isOpenById(config.activity_id, "ActShopGoods") then return 3 end | ||
318 | + end | ||
319 | + | ||
313 | local rechargeRecord = role.storeData:getProperty("payR") | 320 | local rechargeRecord = role.storeData:getProperty("payR") |
314 | local getCount = (rechargeRecord[id] or 0) | 321 | local getCount = (rechargeRecord[id] or 0) |
315 | if getCount >= config.limit then | 322 | if getCount >= config.limit then |
src/actions/TowerAction.lua
@@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) | @@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) | ||
65 | local curTower = csvdb["tower_battleCsv"][id] | 65 | local curTower = csvdb["tower_battleCsv"][id] |
66 | if not curTower then return 2 end | 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 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 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,8 +20,6 @@ function Adv:ctor(owner) | ||
20 | self.advTask = self.owner:getProperty("advTask") | 20 | self.advTask = self.owner:getProperty("advTask") |
21 | self.advMTask = self.owner:getProperty("advMTask") | 21 | self.advMTask = self.owner:getProperty("advMTask") |
22 | self.advTaskChange = false -- 任务改变才更新 | 22 | self.advTaskChange = false -- 任务改变才更新 |
23 | - | ||
24 | - self:initByInfo(self.owner:getProperty("advInfo")) | ||
25 | end | 23 | end |
26 | 24 | ||
27 | function Adv:mylog(contents) | 25 | function Adv:mylog(contents) |
@@ -36,11 +34,13 @@ function Adv:mylog(contents) | @@ -36,11 +34,13 @@ function Adv:mylog(contents) | ||
36 | end | 34 | end |
37 | 35 | ||
38 | --初始化adv 信息 | 36 | --初始化adv 信息 |
39 | -function Adv:initByInfo(advInfo) | 37 | +function Adv:initByInfo() |
38 | + local advInfo = self.owner:getProperty("advInfo") | ||
40 | if not next(advInfo) then return end --还没有 开始新地图 | 39 | if not next(advInfo) then return end --还没有 开始新地图 |
41 | 40 | ||
42 | self.chapterId = advInfo.chapterId | 41 | self.chapterId = advInfo.chapterId |
43 | self.level = advInfo.level or 1 | 42 | self.level = advInfo.level or 1 |
43 | + self.actid = advInfo.actid | ||
44 | self.round = advInfo.round or 0 | 44 | self.round = advInfo.round or 0 |
45 | self.score = advInfo.score or {} | 45 | self.score = advInfo.score or {} |
46 | self.isRelay = advInfo.isRelay | 46 | self.isRelay = advInfo.isRelay |
@@ -61,10 +61,10 @@ function Adv:initByInfo(advInfo) | @@ -61,10 +61,10 @@ function Adv:initByInfo(advInfo) | ||
61 | self:initBattle(advInfo) | 61 | self:initBattle(advInfo) |
62 | end | 62 | end |
63 | -- 找出level 是否存在中继层 | 63 | -- 找出level 是否存在中继层 |
64 | -function Adv:isHaveRelay(level, chapterId) | 64 | +function Adv:isHaveRelay(level, chapterId, force) |
65 | level = level or self.level | 65 | level = level or self.level |
66 | chapterId = chapterId or self.chapterId | 66 | chapterId = chapterId or self.chapterId |
67 | - if level == 1 then return end | 67 | + if level == 1 and not force then return end |
68 | 68 | ||
69 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] | 69 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] |
70 | for _, campsite in ipairs(campsiteCsv) do | 70 | for _, campsite in ipairs(campsiteCsv) do |
@@ -85,6 +85,7 @@ function Adv:initByChapter(params) | @@ -85,6 +85,7 @@ function Adv:initByChapter(params) | ||
85 | local isEnter = params.isEnter | 85 | local isEnter = params.isEnter |
86 | local support = params.support | 86 | local support = params.support |
87 | local debugMapId = params.debugMapId | 87 | local debugMapId = params.debugMapId |
88 | + local actid = params.actid | ||
88 | 89 | ||
89 | if not self.chapterId then -- 开始新的章节 | 90 | if not self.chapterId then -- 开始新的章节 |
90 | self.chapterId = chapterId | 91 | self.chapterId = chapterId |
@@ -95,6 +96,7 @@ function Adv:initByChapter(params) | @@ -95,6 +96,7 @@ function Adv:initByChapter(params) | ||
95 | 96 | ||
96 | self.level = level or 1 | 97 | self.level = level or 1 |
97 | self.round = 0 | 98 | self.round = 0 |
99 | + self.actid = self.actid or actid | ||
98 | self.score = self.score or {} | 100 | self.score = self.score or {} |
99 | self.lastEnemyId = 1 | 101 | self.lastEnemyId = 1 |
100 | self.mapStack = {1} -- 最后一个为当前的地图 | 102 | self.mapStack = {1} -- 最后一个为当前的地图 |
@@ -140,12 +142,13 @@ function Adv:initByChapter(params) | @@ -140,12 +142,13 @@ function Adv:initByChapter(params) | ||
140 | local chapter = self:isEndless() and -1 or self.chapterId | 142 | local chapter = self:isEndless() and -1 or self.chapterId |
141 | if not (advRelay[chapter] or {})[self.level] then | 143 | if not (advRelay[chapter] or {})[self.level] then |
142 | isNewRelay = true | 144 | isNewRelay = true |
143 | - advRelay[chapter] = advRelay[chapter] or {} | ||
144 | - advRelay[chapter][self.level] = 1 | ||
145 | - self.owner:updateProperty({field = "advRelay", value = advRelay}) | ||
146 | end | 145 | end |
147 | end | 146 | end |
148 | 147 | ||
148 | + if self.level == 1 or self.isRelay then | ||
149 | + self:supplyPotion() | ||
150 | + end | ||
151 | + | ||
149 | self.maps = {} | 152 | self.maps = {} |
150 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) | 153 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
151 | 154 | ||
@@ -153,14 +156,15 @@ function Adv:initByChapter(params) | @@ -153,14 +156,15 @@ function Adv:initByChapter(params) | ||
153 | 156 | ||
154 | self:initLayerTask() | 157 | self:initLayerTask() |
155 | 158 | ||
156 | - | ||
157 | - | ||
158 | self:checkTask(Adv.TaskType.Arrive) | 159 | self:checkTask(Adv.TaskType.Arrive) |
159 | self:checkAdvUnlock(1, self.level) | 160 | self:checkAdvUnlock(1, self.level) |
160 | 161 | ||
161 | -- 中继进入奖励 | 162 | -- 中继进入奖励 |
162 | - if relayData and isEnter then | ||
163 | - self:awardRelay(relayData, notNotify) | 163 | + if isEnter then |
164 | + relayData = relayData or self:isHaveRelay(level, chapterId, true) | ||
165 | + if relayData then | ||
166 | + self:awardRelay(relayData, notNotify) | ||
167 | + end | ||
164 | end | 168 | end |
165 | 169 | ||
166 | if not notNotify then | 170 | if not notNotify then |
@@ -168,9 +172,24 @@ function Adv:initByChapter(params) | @@ -168,9 +172,24 @@ function Adv:initByChapter(params) | ||
168 | end | 172 | end |
169 | end | 173 | end |
170 | 174 | ||
175 | +function Adv:passAdvRelay() | ||
176 | + local advRelay = self.owner:getProperty("advRelay") | ||
177 | + local chapter = self:isEndless() and -1 or self.chapterId | ||
178 | + if not (advRelay[chapter] or {})[self.level] then | ||
179 | + advRelay[chapter] = advRelay[chapter] or {} | ||
180 | + advRelay[chapter][self.level] = 1 | ||
181 | + self.owner:updateProperty({field = "advRelay", value = advRelay}) | ||
182 | + local relayData = self:isHaveRelay() | ||
183 | + if relayData and relayData.award ~= "" then | ||
184 | + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | ||
185 | + end | ||
186 | + end | ||
187 | +end | ||
188 | + | ||
171 | function Adv:clear() | 189 | function Adv:clear() |
172 | self.chapterId = nil | 190 | self.chapterId = nil |
173 | self.level = nil | 191 | self.level = nil |
192 | + self.actid = nil | ||
174 | self.score = {} | 193 | self.score = {} |
175 | self.round = 0 | 194 | self.round = 0 |
176 | self.lastEnemyId = 1 | 195 | self.lastEnemyId = 1 |
@@ -193,6 +212,7 @@ function Adv:saveDB(notNotify) | @@ -193,6 +212,7 @@ function Adv:saveDB(notNotify) | ||
193 | advInfo.level = self.level | 212 | advInfo.level = self.level |
194 | advInfo.round = self.round | 213 | advInfo.round = self.round |
195 | advInfo.score = self.score | 214 | advInfo.score = self.score |
215 | + advInfo.actid = self.actid | ||
196 | advInfo.isRelay = self.isRelay | 216 | advInfo.isRelay = self.isRelay |
197 | advInfo.lastEId = self.lastEnemyId | 217 | advInfo.lastEId = self.lastEnemyId |
198 | advInfo.mstack = self.mapStack | 218 | advInfo.mstack = self.mapStack |
@@ -223,7 +243,6 @@ end | @@ -223,7 +243,6 @@ end | ||
223 | 243 | ||
224 | function Adv:awardRelay(relayData, notNotify) | 244 | function Adv:awardRelay(relayData, notNotify) |
225 | local gift = {} | 245 | local gift = {} |
226 | - | ||
227 | if relayData.artifact > 0 then | 246 | if relayData.artifact > 0 then |
228 | local pool = {} | 247 | local pool = {} |
229 | for id, temp in pairs(csvdb["adv_artifactCsv"]) do | 248 | for id, temp in pairs(csvdb["adv_artifactCsv"]) do |
@@ -248,7 +267,9 @@ function Adv:awardRelay(relayData, notNotify) | @@ -248,7 +267,9 @@ function Adv:awardRelay(relayData, notNotify) | ||
248 | local dropData = csvdb["event_dropCsv"][dropId] | 267 | local dropData = csvdb["event_dropCsv"][dropId] |
249 | if dropData then | 268 | if dropData then |
250 | local item = dropData["range"]:randWeight(true) | 269 | local item = dropData["range"]:randWeight(true) |
251 | - gift[item[1]] = (gift[item[1]] or 0) + item[2] | 270 | + if item[1] ~= 0 then |
271 | + gift[item[1]] = (gift[item[1]] or 0) + item[2] | ||
272 | + end | ||
252 | else | 273 | else |
253 | skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId)) | 274 | skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId)) |
254 | end | 275 | end |
@@ -389,18 +410,24 @@ function Adv:isRunning() | @@ -389,18 +410,24 @@ function Adv:isRunning() | ||
389 | return false | 410 | return false |
390 | end | 411 | end |
391 | 412 | ||
392 | --- 强制结束 | ||
393 | -function Adv:forceOver(notNotify) | ||
394 | - if self:isRunning() then | ||
395 | - | 413 | +-- 强制结束 逻辑和adv内部无关 |
414 | +function Adv:forceOver(notNotify, force) | ||
415 | + if self:isRunning() or force then | ||
396 | local advTeam = self.owner:getProperty("advTeam") | 416 | local advTeam = self.owner:getProperty("advTeam") |
397 | advTeam.player = nil | 417 | advTeam.player = nil |
398 | 418 | ||
419 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
420 | + local potionBag = self.owner:getProperty("potionBag") | ||
421 | + | ||
399 | local reward = self.owner:getProperty("advItems"):toNumMap() | 422 | local reward = self.owner:getProperty("advItems"):toNumMap() |
400 | for itemId, count in pairs(reward) do | 423 | for itemId, count in pairs(reward) do |
401 | - reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | 424 | + if advPotionCsv[itemId] then |
425 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
426 | + else | ||
427 | + reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 | ||
428 | + end | ||
402 | end | 429 | end |
403 | - self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 430 | + self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) |
404 | 431 | ||
405 | self:clear() | 432 | self:clear() |
406 | self.owner:updateProperties({ | 433 | self.owner:updateProperties({ |
@@ -409,6 +436,7 @@ function Adv:forceOver(notNotify) | @@ -409,6 +436,7 @@ function Adv:forceOver(notNotify) | ||
409 | advItems = "", | 436 | advItems = "", |
410 | advAFGet = {}, | 437 | advAFGet = {}, |
411 | advAFWear = {}, | 438 | advAFWear = {}, |
439 | + potionBag = potionBag, | ||
412 | }, notNotify) | 440 | }, notNotify) |
413 | end | 441 | end |
414 | end | 442 | end |
@@ -752,6 +780,10 @@ function Adv:isEndless() | @@ -752,6 +780,10 @@ function Adv:isEndless() | ||
752 | return AdvCommon.isEndless(self.chapterId) | 780 | return AdvCommon.isEndless(self.chapterId) |
753 | end | 781 | end |
754 | 782 | ||
783 | +function Adv:isActivity() | ||
784 | + return self.actid ~= nil | ||
785 | +end | ||
786 | + | ||
755 | function Adv:getCurFloorData() | 787 | function Adv:getCurFloorData() |
756 | local chapter = self.chapterId % 100 | 788 | local chapter = self.chapterId % 100 |
757 | return (csvdb["adv_chapter_floorCsv"][self.chapterId] or {})[self.level] | 789 | return (csvdb["adv_chapter_floorCsv"][self.chapterId] or {})[self.level] |
@@ -781,17 +813,69 @@ function Adv:over(success, rewardRatio, overType) | @@ -781,17 +813,69 @@ function Adv:over(success, rewardRatio, overType) | ||
781 | 813 | ||
782 | local score = self.owner:fixAdvScoreChange(self:getScore()) | 814 | local score = self.owner:fixAdvScoreChange(self:getScore()) |
783 | local scoreInfo = self.score | 815 | local scoreInfo = self.score |
816 | + | ||
817 | + local scoreCoef = chapterData.scoreAward | ||
818 | + local itemId = ItemId.OldCoin | ||
819 | + -- 拾荒活动关卡相关处理 | ||
820 | + if self.actid then | ||
821 | + while true do | ||
822 | + if not self.owner.activity:isOpenById(self.actid, "AdvLevel") then | ||
823 | + break | ||
824 | + end | ||
825 | + local actCfg = csvdb["activity_adv_chapterCsv"][self.actid] | ||
826 | + if not actCfg then break end | ||
827 | + actCfg = actCfg[self.chapterId] | ||
828 | + if not actCfg then break end | ||
829 | + local arr = actCfg["transform"]:toArray(true, "=") | ||
830 | + itemId, scoreCoef = arr[1], arr[2] | ||
831 | + local actData = self.owner.activity:getActData("AdvLevel") | ||
832 | + | ||
833 | + -- 计算活动积分up | ||
834 | + local upMap = actCfg["upCharacter"]:toNumMap() | ||
835 | + local team = self.owner:getProperty("advTeam") | ||
836 | + local format = self.owner:getTeamHerosInfo(team).heros | ||
837 | + local upVal = 0 | ||
838 | + for _, hero in pairs(format) do | ||
839 | + local heroId = hero["type"] | ||
840 | + upVal = upVal + (upMap[heroId] or 0) | ||
841 | + end | ||
842 | + score = math.floor(score * (1 + upVal / 100)) | ||
843 | + | ||
844 | + local advInfo = actData[self.chapterId] or {} | ||
845 | + --print("upVal", upVal, score, advInfo["max"], itemId, scoreCoef) | ||
846 | + local maxScore = advInfo["max"] or 0 | ||
847 | + local flag = false | ||
848 | + if success then | ||
849 | + advInfo["pass"] = 1 | ||
850 | + flag = true | ||
851 | + end | ||
852 | + -- 更新活动最大积分 | ||
853 | + if score > maxScore then | ||
854 | + advInfo["max"] = score | ||
855 | + actData[self.chapterId] = advInfo | ||
856 | + flag = true | ||
857 | + end | ||
858 | + if flag then | ||
859 | + self.owner.activity:updateActData("AdvLevel", actData) | ||
860 | + end | ||
861 | + break | ||
862 | + end | ||
863 | + end | ||
784 | 864 | ||
785 | - local scoreReward = math.floor(score / chapterData.scoreAward) | ||
786 | - self.owner:award({[ItemId.OldCoin] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}}) | 865 | + local scoreReward = math.floor(score / scoreCoef) |
866 | + self.owner:award({[itemId] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}}) | ||
787 | 867 | ||
788 | -- 被动技会影响奖励 | 868 | -- 被动技会影响奖励 |
789 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | 869 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) |
790 | 870 | ||
791 | local reward = {} | 871 | local reward = {} |
872 | + local advPotionCsv = csvdb["adv_potionCsv"] | ||
873 | + local potionBag = self.owner:getProperty("potionBag") | ||
792 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do | 874 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
793 | local itemCsv = csvdb["itemCsv"][itemId] | 875 | local itemCsv = csvdb["itemCsv"][itemId] |
794 | - if not itemCsv then | 876 | + if advPotionCsv[itemId] then |
877 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
878 | + elseif not itemCsv then | ||
795 | print("ERROR: no itemId in ItemCsv : ", itemId) | 879 | print("ERROR: no itemId in ItemCsv : ", itemId) |
796 | elseif itemCsv.type ~= ItemType.AdvItem then | 880 | elseif itemCsv.type ~= ItemType.AdvItem then |
797 | reward[itemId] = math.ceil(count * rewardRatio / 100) | 881 | reward[itemId] = math.ceil(count * rewardRatio / 100) |
@@ -811,25 +895,27 @@ function Adv:over(success, rewardRatio, overType) | @@ -811,25 +895,27 @@ function Adv:over(success, rewardRatio, overType) | ||
811 | if not self:isEndless() and self.level >= chapterData.limitlevel then | 895 | if not self:isEndless() and self.level >= chapterData.limitlevel then |
812 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) | 896 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) |
813 | end | 897 | end |
898 | + end | ||
814 | 899 | ||
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 | 900 | + |
901 | + local roleId = self.owner:getProperty("id") | ||
902 | + local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) | ||
903 | + if score > oldMaxScore and not self.actid then | ||
904 | + local team = self.owner:getProperty("advTeam") | ||
905 | + local curInfo = { | ||
906 | + name = self.owner:getProperty("name"), | ||
907 | + headId = self.owner:getProperty("headId"), | ||
908 | + lv = self.owner:getProperty("level"), | ||
909 | + batteV = self.owner:getTeamBattleValue(team.heros), | ||
910 | + chapter = self.chapterId, | ||
911 | + format = self.owner:getTeamHerosInfo(team).heros, | ||
912 | + } | ||
913 | + redisproxy:pipelining(function (red) | ||
914 | + red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数 | ||
915 | + red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) | ||
916 | + end) | ||
832 | end | 917 | end |
918 | + | ||
833 | -- 通关的时候要把引导步骤设定到成就引导 | 919 | -- 通关的时候要把引导步骤设定到成就引导 |
834 | if not self.owner:checkOverGuide(57) then | 920 | if not self.owner:checkOverGuide(57) then |
835 | self.owner:saveGuide(57,1,true) | 921 | self.owner:saveGuide(57,1,true) |
@@ -882,6 +968,7 @@ function Adv:over(success, rewardRatio, overType) | @@ -882,6 +968,7 @@ function Adv:over(success, rewardRatio, overType) | ||
882 | }) | 968 | }) |
883 | 969 | ||
884 | local chapterId = self.chapterId | 970 | local chapterId = self.chapterId |
971 | + local actid = self.actid | ||
885 | self:clear() | 972 | self:clear() |
886 | self.owner:checkTaskEnter("AdvScore", {score = score}) | 973 | self.owner:checkTaskEnter("AdvScore", {score = score}) |
887 | 974 | ||
@@ -889,6 +976,7 @@ function Adv:over(success, rewardRatio, overType) | @@ -889,6 +976,7 @@ function Adv:over(success, rewardRatio, overType) | ||
889 | advItems = "", | 976 | advItems = "", |
890 | advAFGet = {}, | 977 | advAFGet = {}, |
891 | advAFWear = {}, | 978 | advAFWear = {}, |
979 | + potionBag = potionBag, | ||
892 | }) | 980 | }) |
893 | self:pushBackEvent(AdvBackEventType.End, { | 981 | self:pushBackEvent(AdvBackEventType.End, { |
894 | success = success, | 982 | success = success, |
@@ -899,6 +987,7 @@ function Adv:over(success, rewardRatio, overType) | @@ -899,6 +987,7 @@ function Adv:over(success, rewardRatio, overType) | ||
899 | scoreAward = scoreReward, | 987 | scoreAward = scoreReward, |
900 | chapterId = chapterId, | 988 | chapterId = chapterId, |
901 | backAdvCount = backAdvCount, | 989 | backAdvCount = backAdvCount, |
990 | + actid = actid | ||
902 | }) | 991 | }) |
903 | end | 992 | end |
904 | 993 | ||
@@ -963,7 +1052,7 @@ function Adv:award(gift, params, backRewardParams) | @@ -963,7 +1052,7 @@ function Adv:award(gift, params, backRewardParams) | ||
963 | 1052 | ||
964 | local autoUse = {} | 1053 | local autoUse = {} |
965 | for itemId, count in pairs(tgift) do | 1054 | for itemId, count in pairs(tgift) do |
966 | - if count > 0 then | 1055 | + if count > 0 and self.battle.player then |
967 | local buffAdd = self.battle.player:getRewardChange(itemId) | 1056 | local buffAdd = self.battle.player:getRewardChange(itemId) |
968 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 | 1057 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 |
969 | self:checkTask(Adv.TaskType.Item, count, itemId) | 1058 | self:checkTask(Adv.TaskType.Item, count, itemId) |
@@ -973,7 +1062,8 @@ function Adv:award(gift, params, backRewardParams) | @@ -973,7 +1062,8 @@ function Adv:award(gift, params, backRewardParams) | ||
973 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then | 1062 | if globalCsv.adv_auto_useItem[itemId] and count > 0 then |
974 | autoUse[itemId] = count | 1063 | autoUse[itemId] = count |
975 | else | 1064 | else |
976 | - local origin = items:getv(itemId, 0) | 1065 | + local transId = globalCsv.adv_item_potion[itemId] or itemId |
1066 | + local origin = items:getv(transId, 0) | ||
977 | local nums = origin + count | 1067 | local nums = origin + count |
978 | 1068 | ||
979 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | 1069 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 |
@@ -983,10 +1073,10 @@ function Adv:award(gift, params, backRewardParams) | @@ -983,10 +1073,10 @@ function Adv:award(gift, params, backRewardParams) | ||
983 | end | 1073 | end |
984 | else | 1074 | else |
985 | if nums <= 0 then | 1075 | if nums <= 0 then |
986 | - items = items:delk(itemId) | 1076 | + items = items:delk(transId) |
987 | nums = 0 | 1077 | nums = 0 |
988 | else | 1078 | else |
989 | - items = items:setv(itemId, nums) | 1079 | + items = items:setv(transId, nums) |
990 | end | 1080 | end |
991 | 1081 | ||
992 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then | 1082 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
@@ -1045,6 +1135,7 @@ function Adv:useItem(itemId, count, target) | @@ -1045,6 +1135,7 @@ function Adv:useItem(itemId, count, target) | ||
1045 | end | 1135 | end |
1046 | 1136 | ||
1047 | self:checkAchievement(self.AchievType.UseItem, count, itemId) | 1137 | self:checkAchievement(self.AchievType.UseItem, count, itemId) |
1138 | + self.owner:checkTaskEnter("AdvUseItem", {itemId = itemId, count = count}) | ||
1048 | self:mylog({desc = "useItem", int1 = itemId, int2 = count}) | 1139 | self:mylog({desc = "useItem", int1 = itemId, int2 = count}) |
1049 | 1140 | ||
1050 | self.owner:log("mission_pick_use", { | 1141 | self.owner:log("mission_pick_use", { |
@@ -1064,6 +1155,7 @@ end | @@ -1064,6 +1155,7 @@ end | ||
1064 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 | 1155 | -- 消耗物品 优先冒险背包 --check 只是检查够不够 |
1065 | function Adv:cost(item, params, check) | 1156 | function Adv:cost(item, params, check) |
1066 | local items = self.owner:getProperty("advItems") | 1157 | local items = self.owner:getProperty("advItems") |
1158 | + local potionCsv = csvdb["adv_potionCsv"] | ||
1067 | local less = {} | 1159 | local less = {} |
1068 | local advCost = {} | 1160 | local advCost = {} |
1069 | for itemId, count in pairs(item) do | 1161 | for itemId, count in pairs(item) do |
@@ -1077,9 +1169,13 @@ function Adv:cost(item, params, check) | @@ -1077,9 +1169,13 @@ function Adv:cost(item, params, check) | ||
1077 | less[itemId] = -last | 1169 | less[itemId] = -last |
1078 | end | 1170 | end |
1079 | 1171 | ||
1172 | + if potionCsv[itemId] and last < 0 then -- 只能使用冒险背包里的药水 | ||
1173 | + return | ||
1174 | + end | ||
1080 | end | 1175 | end |
1081 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 | 1176 | if next(less) and not self.owner:checkItemEnough(less) then return end --不够 |
1082 | if check then return true end | 1177 | if check then return true end |
1178 | + | ||
1083 | self:award(advCost, params) | 1179 | self:award(advCost, params) |
1084 | if next(less) then | 1180 | if next(less) then |
1085 | self.owner:costItems(less, params) | 1181 | self.owner:costItems(less, params) |
@@ -1087,6 +1183,35 @@ function Adv:cost(item, params, check) | @@ -1087,6 +1183,35 @@ function Adv:cost(item, params, check) | ||
1087 | return true | 1183 | return true |
1088 | end | 1184 | end |
1089 | 1185 | ||
1186 | +-- 补满冒险背包药剂,从药剂背包扣除药水放到冒险背包 | ||
1187 | +function Adv:supplyPotion() | ||
1188 | + local potionCsv = csvdb["adv_potionCsv"] | ||
1189 | + local potionBag = self.owner:getProperty("potionBag") | ||
1190 | + local advItems = self.owner:getProperty("advItems") | ||
1191 | + local dishTree = self.owner.dinerData:getProperty("dishTree") | ||
1192 | + for potionId, set in pairs(potionCsv) do | ||
1193 | + local count = potionBag[potionId] or 0 | ||
1194 | + if count > 0 then | ||
1195 | + local max = set[dishTree:getv(potionId,1)].limit | ||
1196 | + local old = advItems:getv(potionId,0) | ||
1197 | + local need = max - old | ||
1198 | + | ||
1199 | + if need < 0 then | ||
1200 | + elseif need < count then | ||
1201 | + advItems = advItems:setv(potionId,max) | ||
1202 | + potionBag[potionId] = count - need | ||
1203 | + else | ||
1204 | + advItems = advItems:setv(potionId,old + count) | ||
1205 | + potionBag[potionId] = nil | ||
1206 | + end | ||
1207 | + end | ||
1208 | + end | ||
1209 | + self.owner:updateProperties({ | ||
1210 | + advItems = advItems, | ||
1211 | + potionBag = potionBag, | ||
1212 | + }) | ||
1213 | +end | ||
1214 | + | ||
1090 | --事件点击处理 | 1215 | --事件点击处理 |
1091 | local function clickOut(self, room, block, params, isExit) | 1216 | local function clickOut(self, room, block, params, isExit) |
1092 | if self:getCurMap():checkOver() then --检查是否可以出去了 | 1217 | if self:getCurMap():checkOver() then --检查是否可以出去了 |
@@ -1112,6 +1237,11 @@ local function clickOut(self, room, block, params, isExit) | @@ -1112,6 +1237,11 @@ local function clickOut(self, room, block, params, isExit) | ||
1112 | else | 1237 | else |
1113 | if self.level > (advPass[self.chapterId] or 0) then | 1238 | if self.level > (advPass[self.chapterId] or 0) then |
1114 | self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}}) | 1239 | self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}}) |
1240 | + | ||
1241 | + if (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 | ||
1242 | + self.owner:checkTaskEnter("AdvPassFirst", {id = self.chapterId}) | ||
1243 | + end | ||
1244 | + | ||
1115 | end | 1245 | end |
1116 | end | 1246 | end |
1117 | 1247 | ||
@@ -1124,6 +1254,7 @@ local function clickOut(self, room, block, params, isExit) | @@ -1124,6 +1254,7 @@ local function clickOut(self, room, block, params, isExit) | ||
1124 | end | 1254 | end |
1125 | 1255 | ||
1126 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 | 1256 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 |
1257 | + self:passAdvRelay() | ||
1127 | self:over(true) | 1258 | self:over(true) |
1128 | else | 1259 | else |
1129 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) | 1260 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
@@ -1168,24 +1299,22 @@ local function clickMonster(self, room, block, params) | @@ -1168,24 +1299,22 @@ local function clickMonster(self, room, block, params) | ||
1168 | return true | 1299 | return true |
1169 | end | 1300 | end |
1170 | 1301 | ||
1171 | -local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1172 | - if not choose then return end | ||
1173 | - if not chooseData or not chooseData["button".. choose .."cond"] then return end | ||
1174 | 1302 | ||
1175 | - local conds = chooseData["button".. choose .."cond"]:toTableArray(true) | 1303 | +local function checkChooseCondFunc(self, condStr, room, block, tag, chooseData) |
1304 | + chooseData = chooseData or {} | ||
1176 | local checkCond = { | 1305 | local checkCond = { |
1177 | -- 没有条件 | 1306 | -- 没有条件 |
1178 | [0] = function() | 1307 | [0] = function() |
1179 | return true | 1308 | return true |
1180 | end, | 1309 | end, |
1181 | -- 拥有道具 | 1310 | -- 拥有道具 |
1182 | - [1] = function(_, itemId, count) | 1311 | + [1] = function(itemId, count) |
1183 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, true) then | 1312 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, true) then |
1184 | return true | 1313 | return true |
1185 | end | 1314 | end |
1186 | end, | 1315 | end, |
1187 | -- xx角色(todo 队长) | 1316 | -- xx角色(todo 队长) |
1188 | - [2] = function(_, heroType) | 1317 | + [2] = function(heroType) |
1189 | for slot, heroId in pairs(self.owner:getProperty("advTeam").heros) do | 1318 | for slot, heroId in pairs(self.owner:getProperty("advTeam").heros) do |
1190 | local hero = self.owner.heros[heroId] | 1319 | local hero = self.owner.heros[heroId] |
1191 | if hero and hero:getProperty("type") == heroType then | 1320 | if hero and hero:getProperty("type") == heroType then |
@@ -1205,38 +1334,38 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1205,38 +1334,38 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1205 | return true | 1334 | return true |
1206 | end, | 1335 | end, |
1207 | --制定属性 | 1336 | --制定属性 |
1208 | - [4] = function(_, attrType, value) | 1337 | + [4] = function(attrType, value) |
1209 | if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then | 1338 | if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then |
1210 | return true | 1339 | return true |
1211 | end | 1340 | end |
1212 | end, | 1341 | end, |
1213 | -- 提交一个物品 | 1342 | -- 提交一个物品 |
1214 | - [5] = function (_, itemId, count) | 1343 | + [5] = function (itemId, count) |
1215 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}) then | 1344 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}) then |
1216 | self:backCost({[itemId] = count}) | 1345 | self:backCost({[itemId] = count}) |
1217 | return true | 1346 | return true |
1218 | end | 1347 | end |
1219 | end, | 1348 | end, |
1220 | -- sp 到达指定值 | 1349 | -- sp 到达指定值 |
1221 | - [6] = function(_, value) | 1350 | + [6] = function(value) |
1222 | if self.battle.player.sp >= value then | 1351 | if self.battle.player.sp >= value then |
1223 | self.battle.player:changeSp(-value) | 1352 | self.battle.player:changeSp(-value) |
1224 | return true | 1353 | return true |
1225 | end | 1354 | end |
1226 | end, | 1355 | end, |
1227 | --7=拥有指定buff指定层数 | 1356 | --7=拥有指定buff指定层数 |
1228 | - [7] = function(_, buffId, layer) | 1357 | + [7] = function(buffId, layer) |
1229 | local buff = self.battle.player:getBuffById(buffId) | 1358 | local buff = self.battle.player:getBuffById(buffId) |
1230 | if buff and buff:getLayer() >= layer then | 1359 | if buff and buff:getLayer() >= layer then |
1231 | return true | 1360 | return true |
1232 | end | 1361 | end |
1233 | end, | 1362 | end, |
1234 | --8=拥有x神器 | 1363 | --8=拥有x神器 |
1235 | - [8] = function(_, artifactId) | 1364 | + [8] = function(artifactId) |
1236 | return self:isHaveArtifact(artifactId) | 1365 | return self:isHaveArtifact(artifactId) |
1237 | end, | 1366 | end, |
1238 | -- 9 = 生命值大于x% | 1367 | -- 9 = 生命值大于x% |
1239 | - [9] = function (_, value) | 1368 | + [9] = function (value) |
1240 | local cost = value / 100 * self.battle.player.hpMax | 1369 | local cost = value / 100 * self.battle.player.hpMax |
1241 | if self.battle.player.hp > cost then | 1370 | if self.battle.player.hp > cost then |
1242 | self.battle.player:hurt(cost, nil, {hurtType = 6, buffId = -1}) | 1371 | self.battle.player:hurt(cost, nil, {hurtType = 6, buffId = -1}) |
@@ -1244,16 +1373,27 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1244,16 +1373,27 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1244 | end | 1373 | end |
1245 | end, | 1374 | end, |
1246 | -- 10 = 未获得x神器 | 1375 | -- 10 = 未获得x神器 |
1247 | - [10] = function(_, artifactId) | 1376 | + [10] = function(artifactId) |
1248 | return not self:isHaveArtifact(artifactId) | 1377 | return not self:isHaveArtifact(artifactId) |
1249 | end, | 1378 | end, |
1250 | -- 11 = 地图上没有指定id 的怪 | 1379 | -- 11 = 地图上没有指定id 的怪 |
1251 | - [11] = function(_, monsterId) | ||
1252 | - for _, room in pairs(self:getCurMap().rooms) do | ||
1253 | - for _, block in pairs(room.blocks) do | ||
1254 | - if block:isMonster() then | ||
1255 | - if not monsterId then return false end | ||
1256 | - if block.event.id == monsterId then | 1380 | + [11] = function(monsterId, size) |
1381 | + if not size or size == 0 then | ||
1382 | + for _, room in pairs(self:getCurMap().rooms) do | ||
1383 | + for _, block in pairs(room.blocks) do | ||
1384 | + if block:isMonster() then | ||
1385 | + if not monsterId or monsterId == 0 then return false end | ||
1386 | + if block.event.id == monsterId then | ||
1387 | + return false | ||
1388 | + end | ||
1389 | + end | ||
1390 | + end | ||
1391 | + end | ||
1392 | + else | ||
1393 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
1394 | + if cblock:isMonster() then | ||
1395 | + if not monsterId or monsterId == 0 then return false end | ||
1396 | + if cblock.event.id == monsterId then | ||
1257 | return false | 1397 | return false |
1258 | end | 1398 | end |
1259 | end | 1399 | end |
@@ -1262,12 +1402,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1262,12 +1402,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1262 | return true | 1402 | return true |
1263 | end, | 1403 | end, |
1264 | -- 12 = 地图上没有指定id 的建筑 | 1404 | -- 12 = 地图上没有指定id 的建筑 |
1265 | - [12] = function(_, buildId) | ||
1266 | - for _, room in pairs(self:getCurMap().rooms) do | ||
1267 | - for _, block in pairs(room.blocks) do | ||
1268 | - if block:isBuild() then | ||
1269 | - if not buildId then return false end | ||
1270 | - if block.event.id == buildId then | 1405 | + [12] = function(buildId, size) |
1406 | + if not size or size == 0 then | ||
1407 | + for _, room in pairs(self:getCurMap().rooms) do | ||
1408 | + for _, block in pairs(room.blocks) do | ||
1409 | + if block:isBuild() then | ||
1410 | + if not buildId or buildId == 0 then return false end | ||
1411 | + if block.event.id == buildId then | ||
1412 | + return false | ||
1413 | + end | ||
1414 | + end | ||
1415 | + end | ||
1416 | + end | ||
1417 | + else | ||
1418 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
1419 | + if cblock:isBuild() then | ||
1420 | + if not buildId or buildId == 0 then return false end | ||
1421 | + if cblock.event.id == buildId then | ||
1271 | return false | 1422 | return false |
1272 | end | 1423 | end |
1273 | end | 1424 | end |
@@ -1276,12 +1427,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1276,12 +1427,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1276 | return true | 1427 | return true |
1277 | end, | 1428 | end, |
1278 | -- 13 = 地图上没有指定的 选择点 | 1429 | -- 13 = 地图上没有指定的 选择点 |
1279 | - [13] = function(_, chooseId) | ||
1280 | - for _, room in pairs(self:getCurMap().rooms) do | ||
1281 | - for _, block in pairs(room.blocks) do | ||
1282 | - if block:isChoose() then | ||
1283 | - if not chooseId then return false end | ||
1284 | - if block.event.id == chooseId then | 1430 | + [13] = function(chooseId, size) |
1431 | + if not size or size == 0 then | ||
1432 | + for _, room in pairs(self:getCurMap().rooms) do | ||
1433 | + for _, block in pairs(room.blocks) do | ||
1434 | + if block:isChoose() then | ||
1435 | + if not chooseId or chooseId == 0 then return false end | ||
1436 | + if block.event.id == chooseId then | ||
1437 | + return false | ||
1438 | + end | ||
1439 | + end | ||
1440 | + end | ||
1441 | + end | ||
1442 | + else | ||
1443 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
1444 | + if cblock:isChoose() then | ||
1445 | + if not chooseId or chooseId == 0 then return false end | ||
1446 | + if cblock.event.id == chooseId then | ||
1285 | return false | 1447 | return false |
1286 | end | 1448 | end |
1287 | end | 1449 | end |
@@ -1290,138 +1452,178 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1290,138 +1452,178 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1290 | return true | 1452 | return true |
1291 | end, | 1453 | end, |
1292 | } | 1454 | } |
1293 | - for _, cond in ipairs(conds) do | 1455 | + |
1456 | + local status, count = true, 0 | ||
1457 | + for _, cond in ipairs(condStr:toTableArray(true)) do | ||
1294 | assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) | 1458 | assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) |
1295 | - if cond[1] and not checkCond[cond[1]](table.unpack(cond)) then return end | 1459 | + if not checkCond[cond[1]](select(2, table.unpack(cond))) then |
1460 | + status = false | ||
1461 | + else | ||
1462 | + count = count + 1 | ||
1463 | + end | ||
1296 | end | 1464 | end |
1297 | - | ||
1298 | - local clearBlock = chooseData.keep ~= 1 | ||
1299 | - local effects = chooseData["button".. choose .."effect"]:toTableArray(true) | ||
1300 | - for _, effect in ipairs(effects) do | ||
1301 | - local doEffect = { | ||
1302 | - [1] = function() -- 获得某道具N个 | ||
1303 | - local count = effect[3] or 1 | ||
1304 | - local reward = {} | ||
1305 | - for i = 1, count do | ||
1306 | - local dropData = csvdb["event_dropCsv"][effect[2]] | ||
1307 | - if dropData then | ||
1308 | - local item = dropData["range"]:randWeight(true) | 1465 | + return status, count |
1466 | +end | ||
1467 | + | ||
1468 | +local function doChooseEffect(self, effectStr, room, block, tag, chooseData) | ||
1469 | + chooseData = chooseData or {} | ||
1470 | + local clearBlock = true | ||
1471 | + local doEffect = { | ||
1472 | + [1] = function(dropId, count) -- 获得某道具N个 | ||
1473 | + count = count or 1 | ||
1474 | + local reward = {} | ||
1475 | + for i = 1, count do | ||
1476 | + local dropData = csvdb["event_dropCsv"][dropId] | ||
1477 | + if dropData then | ||
1478 | + local item = dropData["range"]:randWeight(true) | ||
1479 | + if item[1] ~= 0 then | ||
1309 | reward[item[1]] = (reward[item[1]] or 0) + item[2] | 1480 | reward[item[1]] = (reward[item[1]] or 0) + item[2] |
1310 | - else | ||
1311 | - skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id)) | ||
1312 | end | 1481 | end |
1313 | - end | ||
1314 | - self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId}) | ||
1315 | - end, | ||
1316 | - [2] = function() --获得冒险buff | ||
1317 | - local layer = effect[3] or 1 | ||
1318 | - for i = 1, layer do | ||
1319 | - self.battle.player:addBuff(effect[2]) | ||
1320 | - end | ||
1321 | - end, | ||
1322 | - [3] = function() --发现怪物 | ||
1323 | - self:getCurMap():addNewMonsterRand(effect[2], {room, block}) | ||
1324 | - self:pushBackEvent(AdvBackEventType.Monster, {id = effect[2]}) | ||
1325 | - clearBlock = false | ||
1326 | - end, | ||
1327 | - [4] = function() --无事发生 | ||
1328 | - end, | ||
1329 | - [5] = function() --5=属性枚举=数值;直接增加玩家属性 | ||
1330 | - local attr | ||
1331 | - if effect[3] == 0 then | ||
1332 | - attr = "sp" | ||
1333 | else | 1482 | else |
1334 | - attr = AttsEnumEx[effect[3]] | ||
1335 | - if not AdvAttsEnum[attr] then return end | 1483 | + skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", dropId, tag, chooseData.id)) |
1336 | end | 1484 | end |
1337 | - self.battle.player:addBaseAttr(attr, effect[4], effect[2]) | ||
1338 | - end, | ||
1339 | - [6] = function() -- 商店 | ||
1340 | - block:updateEvent({ | ||
1341 | - etype = AdvEventType.Trader, | ||
1342 | - id = effect[2] | ||
1343 | - }) | ||
1344 | - self:pushBackEvent(AdvBackEventType.Trader, {id = effect[2]}) | ||
1345 | - clearBlock = false | ||
1346 | - end, | ||
1347 | - [7] = function() -- 建筑 | ||
1348 | - block:updateEvent({ | ||
1349 | - etype = AdvEventType.Build, | ||
1350 | - id = effect[2] | ||
1351 | - }) | ||
1352 | - clearBlock = false | ||
1353 | - end, | ||
1354 | - [8] = function() -- 选择 | ||
1355 | - block:updateEvent({ | ||
1356 | - etype = AdvEventType.Choose, | ||
1357 | - id = effect[2] | ||
1358 | - }) | ||
1359 | - clearBlock = false | ||
1360 | - end, | ||
1361 | - [9] = function() -- click | ||
1362 | - block:updateEvent({ | ||
1363 | - etype = AdvEventType.Click, | ||
1364 | - id = effect[2] | ||
1365 | - }) | ||
1366 | - clearBlock = false | ||
1367 | - end, | ||
1368 | - [10] = function() -- 陷阱 | ||
1369 | - block:updateEvent({ | ||
1370 | - etype = AdvEventType.Trap, | ||
1371 | - id = effect[2] | ||
1372 | - }) | ||
1373 | - clearBlock = false | ||
1374 | - end, | ||
1375 | - [11] = function() -- 获得神器 | ||
1376 | - self:waitChooseArtifact() --等待获取神器 | ||
1377 | - end, | ||
1378 | - [12] = function() | ||
1379 | - -- buffId | ||
1380 | - local targers = self.battle.player:getTeam(2, nil, nil, true) | ||
1381 | - for _, target in pairs(targers) do | ||
1382 | - target:addBuff(effect[2]) | 1485 | + end |
1486 | + self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId}) | ||
1487 | + end, | ||
1488 | + [2] = function(buffId, layer) --获得冒险buff | ||
1489 | + self.battle.player:addBuff(buffId, nil, layer or 1) | ||
1490 | + end, | ||
1491 | + [3] = function(id) --发现怪物 | ||
1492 | + self:getCurMap():addNewMonsterRand(id, {room, block}) | ||
1493 | + self:pushBackEvent(AdvBackEventType.Monster, {id = id}) | ||
1494 | + clearBlock = false | ||
1495 | + end, | ||
1496 | + [4] = function() --无事发生 | ||
1497 | + end, | ||
1498 | + [5] = function(addType, attrType, value) --5=属性枚举=数值;直接增加玩家属性 | ||
1499 | + local attr | ||
1500 | + if attrType == 0 then | ||
1501 | + attr = "sp" | ||
1502 | + else | ||
1503 | + attr = AttsEnumEx[attrType] | ||
1504 | + if not AdvAttsEnum[attr] then return end | ||
1505 | + end | ||
1506 | + self.battle.player:addBaseAttr(attr, value, addType) | ||
1507 | + end, | ||
1508 | + [6] = function(id) -- 商店 | ||
1509 | + block:updateEvent({ | ||
1510 | + etype = AdvEventType.Trader, | ||
1511 | + id = id | ||
1512 | + }) | ||
1513 | + self:pushBackEvent(AdvBackEventType.Trader, {id = id}) | ||
1514 | + clearBlock = false | ||
1515 | + end, | ||
1516 | + [7] = function(id) -- 建筑 | ||
1517 | + block:updateEvent({ | ||
1518 | + etype = AdvEventType.Build, | ||
1519 | + id = id | ||
1520 | + }) | ||
1521 | + clearBlock = false | ||
1522 | + end, | ||
1523 | + [8] = function(id) -- 选择 | ||
1524 | + block:updateEvent({ | ||
1525 | + etype = AdvEventType.Choose, | ||
1526 | + id = id | ||
1527 | + }) | ||
1528 | + clearBlock = false | ||
1529 | + end, | ||
1530 | + [9] = function(id) -- click | ||
1531 | + block:updateEvent({ | ||
1532 | + etype = AdvEventType.Click, | ||
1533 | + id = id | ||
1534 | + }) | ||
1535 | + clearBlock = false | ||
1536 | + end, | ||
1537 | + [10] = function(id) -- 陷阱 | ||
1538 | + block:updateEvent({ | ||
1539 | + etype = AdvEventType.Trap, | ||
1540 | + id = id | ||
1541 | + }) | ||
1542 | + clearBlock = false | ||
1543 | + end, | ||
1544 | + [11] = function() -- 获得神器 | ||
1545 | + self:waitChooseArtifact() --等待获取神器 | ||
1546 | + end, | ||
1547 | + [12] = function(id) | ||
1548 | + -- buffId | ||
1549 | + local targers = self.battle.player:getTeam(2, nil, nil, true) | ||
1550 | + for _, target in pairs(targers) do | ||
1551 | + target:addBuff(id) | ||
1552 | + end | ||
1553 | + end, | ||
1554 | + [13] = function() -- 显示地图 | ||
1555 | + self:getCurMap():showMap() | ||
1556 | + self:backMapShow() | ||
1557 | + end, | ||
1558 | + [14] = function(eventType, eventId, count, stage) -- 指定地块召唤 指定类型的id | ||
1559 | + local change = self:getCurMap():layEventToStage(eventType, eventId, count, stage) | ||
1560 | + for _, one in ipairs(change) do | ||
1561 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1562 | + clearBlock = false | ||
1563 | + else | ||
1564 | + self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1383 | end | 1565 | end |
1384 | - end, | ||
1385 | - [13] = function() -- 显示地图 | ||
1386 | - self:getCurMap():showMap() | ||
1387 | - self:backMapShow() | ||
1388 | - end, | ||
1389 | - [14] = function() -- 指定地块召唤 指定类型的id | ||
1390 | - local change = self:getCurMap():layEventToStage(effect[2], effect[3], effect[4], effect[5]) | ||
1391 | - for _, one in ipairs(change) do | ||
1392 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1393 | - clearBlock = false | ||
1394 | - else | ||
1395 | - self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1396 | - end | 1566 | + end |
1567 | + end, | ||
1568 | + [15] = function(eventType, eventId, count) -- 移除指定事件 | ||
1569 | + local change = self:getCurMap():clearEventById(eventType, eventId, count) | ||
1570 | + for _, one in ipairs(change) do | ||
1571 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1572 | + clearBlock = false | ||
1573 | + else | ||
1574 | + self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1397 | end | 1575 | end |
1398 | - end, | ||
1399 | - [15] = function() -- 移除指定事件 | ||
1400 | - local change = self:getCurMap():clearEventById(effect[2], effect[3], effect[4]) | ||
1401 | - for _, one in ipairs(change) do | ||
1402 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1403 | - clearBlock = false | ||
1404 | - else | ||
1405 | - self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1406 | - end | 1576 | + end |
1577 | + end, | ||
1578 | + [16] = function(eventTypeF, eventIdF, eventTypeT, eventIdT, count) -- 指定事件转移 | ||
1579 | + local change = self:getCurMap():eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, count) | ||
1580 | + for _, one in ipairs(change) do | ||
1581 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1582 | + clearBlock = false | ||
1583 | + else | ||
1584 | + self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1407 | end | 1585 | end |
1408 | - end, | ||
1409 | - [16] = function() -- 指定事件转移 | ||
1410 | - local change = self:getCurMap():eventChangeToOther(effect[2], effect[3], effect[4], effect[5], effect[6]) | ||
1411 | - for _, one in ipairs(change) do | ||
1412 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | ||
1413 | - clearBlock = false | ||
1414 | - else | ||
1415 | - self:backBlockChange(one[1].roomId, one[2].blockId) | ||
1416 | - end | 1586 | + end |
1587 | + end, | ||
1588 | + [17] = function(eventId) | ||
1589 | + local diceCsv = csvdb["event_choose_diceCsv"][eventId] | ||
1590 | + if not diceCsv then return end | ||
1591 | + local weight = math.randomInt(1, 12) | ||
1592 | + local sum = 0 | ||
1593 | + local needEffect = nil | ||
1594 | + local pool = {} | ||
1595 | + for _, v in ipairs(diceCsv) do | ||
1596 | + local status, okCount = checkChooseCondFunc(self, v.cond, room, block, tag .. " dice", chooseData) | ||
1597 | + pool[#pool + 1] = v.weight + okCount * v.weightUp | ||
1598 | + sum = sum + pool[#pool] | ||
1599 | + if sum >= weight and not needEffect then | ||
1600 | + -- 达成效果 | ||
1601 | + needEffect = v.effect | ||
1417 | end | 1602 | end |
1418 | - end, | ||
1419 | - } | 1603 | + end |
1604 | + if needEffect then | ||
1605 | + self:pushBackEvent(AdvBackEventType.ChooseDice, {id = eventId, pool = pool, result = weight}) | ||
1606 | + clearBlock = doChooseEffect(self, needEffect, room, block, tag .. " dice", chooseData) | ||
1607 | + end | ||
1608 | + end, | ||
1609 | + } | ||
1610 | + | ||
1611 | + for _, effect in ipairs(effectStr:toTableArray(true)) do | ||
1420 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. (block.event and block.event.id or 0) .. "effect " .. effect[1]) | 1612 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. (block.event and block.event.id or 0) .. "effect " .. effect[1]) |
1421 | - doEffect[effect[1]]() | 1613 | + doEffect[effect[1]](select(2, table.unpack(effect))) |
1422 | end | 1614 | end |
1423 | - self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | 1615 | + return clearBlock |
1616 | +end | ||
1617 | + | ||
1424 | 1618 | ||
1619 | +local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
1620 | + if not choose then return end | ||
1621 | + if not chooseData or not chooseData["button".. choose .."cond"] then return end | ||
1622 | + if not checkChooseCondFunc(self, chooseData["button".. choose .."cond"], room, block, tag, chooseData) then return end | ||
1623 | + local clearBlock = chooseData.keep ~= 1 | ||
1624 | + local clearBlock_ = doChooseEffect(self, chooseData["button".. choose .."effect"], room, block, tag, chooseData) | ||
1625 | + clearBlock = clearBlock and clearBlock_ | ||
1626 | + self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | ||
1425 | return true, clearBlock | 1627 | return true, clearBlock |
1426 | end | 1628 | end |
1427 | 1629 | ||
@@ -1561,6 +1763,7 @@ local function clickBuild(self, room, block, params) | @@ -1561,6 +1763,7 @@ local function clickBuild(self, room, block, params) | ||
1561 | self:checkTask(Adv.TaskType.Build, 1, oldId) | 1763 | self:checkTask(Adv.TaskType.Build, 1, oldId) |
1562 | self:checkAchievement(Adv.AchievType.Build, 1, oldId) | 1764 | self:checkAchievement(Adv.AchievType.Build, 1, oldId) |
1563 | self:checkAchievement(Adv.AchievType.BuildBySelect, 1, oldId, choose) | 1765 | self:checkAchievement(Adv.AchievType.BuildBySelect, 1, oldId, choose) |
1766 | + self.owner:checkTaskEnter("AdvBuild", {buildId = oldId}) | ||
1564 | 1767 | ||
1565 | if clearBlock then | 1768 | if clearBlock then |
1566 | block:clear() | 1769 | block:clear() |
@@ -1583,7 +1786,9 @@ local function clickClick(self, room, block, params) | @@ -1583,7 +1786,9 @@ local function clickClick(self, room, block, params) | ||
1583 | local reward = {} | 1786 | local reward = {} |
1584 | for _, dropId in ipairs(clickData.effect:toArray(true, "=")) do | 1787 | for _, dropId in ipairs(clickData.effect:toArray(true, "=")) do |
1585 | local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) | 1788 | local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) |
1586 | - reward[item[1]] = (reward[item[1]] or 0) + item[2] | 1789 | + if item[1] ~= 0 then |
1790 | + reward[item[1]] = (reward[item[1]] or 0) + item[2] | ||
1791 | + end | ||
1587 | end | 1792 | end |
1588 | self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId}) | 1793 | self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId}) |
1589 | end, | 1794 | end, |
@@ -1675,12 +1880,6 @@ function Adv:clickBlock(roomId, blockId, params) | @@ -1675,12 +1880,6 @@ function Adv:clickBlock(roomId, blockId, params) | ||
1675 | if not block.isOpen then | 1880 | if not block.isOpen then |
1676 | if self.isRelay or checkAroundBlocks() then --开放 | 1881 | if self.isRelay or checkAroundBlocks() then --开放 |
1677 | self:getCurMap():openBlock(roomId, blockId, true, true) | 1882 | 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 | status = true | 1883 | status = true |
1685 | end | 1884 | end |
1686 | else | 1885 | else |
@@ -1690,6 +1889,18 @@ function Adv:clickBlock(roomId, blockId, params) | @@ -1690,6 +1889,18 @@ function Adv:clickBlock(roomId, blockId, params) | ||
1690 | return | 1889 | return |
1691 | end | 1890 | end |
1692 | 1891 | ||
1892 | + if not block:isMonster() then | ||
1893 | + for _, one in ipairs(map:getAroundBlocksPlus(room, block)) do | ||
1894 | + local _room, _block = one[1], one[2] | ||
1895 | + if _block:isMonster() then | ||
1896 | + local enemy = self.battle:getEnemy(_room.roomId, _block.blockId) | ||
1897 | + if enemy:hadBuff(Buff.OBSTACLE_PLUS) then | ||
1898 | + return | ||
1899 | + end | ||
1900 | + end | ||
1901 | + end | ||
1902 | + end | ||
1903 | + | ||
1693 | if block:isHinder() then | 1904 | if block:isHinder() then |
1694 | if not checkAroundBlocks(true) then return end | 1905 | if not checkAroundBlocks(true) then return end |
1695 | end | 1906 | end |
@@ -1824,9 +2035,18 @@ function Adv:doActive(activeId, target) | @@ -1824,9 +2035,18 @@ function Adv:doActive(activeId, target) | ||
1824 | -- 5:放逐目标 | 2035 | -- 5:放逐目标 |
1825 | doActiveEffect[5] = function(_) | 2036 | doActiveEffect[5] = function(_) |
1826 | for _, target in ipairs(targers) do | 2037 | for _, target in ipairs(targers) do |
2038 | + local had = false | ||
1827 | if not target.lock and not target.isDead then | 2039 | if not target.lock and not target.isDead then |
1828 | - target:kill() | ||
1829 | - self:backBlockChange(target.roomId, target.blockId) | 2040 | + if target:getMonsterCsv().type == 5 then |
2041 | + -- 假boss 不能用 | ||
2042 | + had = true | ||
2043 | + else | ||
2044 | + target:kill() | ||
2045 | + self:backBlockChange(target.roomId, target.blockId) | ||
2046 | + end | ||
2047 | + end | ||
2048 | + if had then | ||
2049 | + self:pushBackEvent(AdvBackEventType.NoEffect) | ||
1830 | end | 2050 | end |
1831 | end | 2051 | end |
1832 | return true | 2052 | return true |
@@ -1855,13 +2075,8 @@ function Adv:doActive(activeId, target) | @@ -1855,13 +2075,8 @@ function Adv:doActive(activeId, target) | ||
1855 | end | 2075 | end |
1856 | 2076 | ||
1857 | -- 7=道具燃烧效果 | 2077 | -- 7=道具燃烧效果 |
1858 | - doActiveEffect[7] = function(_) | ||
1859 | - for _ , target in ipairs(targers) do | ||
1860 | - if target:getEventType() == AdvEventType.Drop then | ||
1861 | - target:updateEvent(nil) | ||
1862 | - self:backBlockChange(target.room.roomId, target.blockId) | ||
1863 | - end | ||
1864 | - end | 2078 | + doActiveEffect[7] = function(_, ctype) |
2079 | + self:blockDropChange(ctype, targers) | ||
1865 | return true | 2080 | return true |
1866 | end | 2081 | end |
1867 | 2082 | ||
@@ -2091,7 +2306,7 @@ function Adv:enemyDead(enemy, escape) | @@ -2091,7 +2306,7 @@ function Adv:enemyDead(enemy, escape) | ||
2091 | end | 2306 | end |
2092 | end | 2307 | end |
2093 | -- 这些奖励可能会有被动加成 | 2308 | -- 这些奖励可能会有被动加成 |
2094 | - self.battle.player:triggerPassive(Passive.BATTLE_WIN, {drops = drops}) | 2309 | + self.battle.player:triggerPassive(Passive.BATTLE_WIN, {drops = drops, trigger = enemy}) |
2095 | 2310 | ||
2096 | -- 自身带的掉落是不会被改变的 也不会被加成 | 2311 | -- 自身带的掉落是不会被改变的 也不会被加成 |
2097 | if block.event.item and block.event.item[1] ~= 0 then | 2312 | if block.event.item and block.event.item[1] ~= 0 then |
@@ -2131,6 +2346,8 @@ function Adv:enemyDead(enemy, escape) | @@ -2131,6 +2346,8 @@ function Adv:enemyDead(enemy, escape) | ||
2131 | self:checkAchievement(Adv.AchievType.Kill, 1, enemyId) | 2346 | self:checkAchievement(Adv.AchievType.Kill, 1, enemyId) |
2132 | self:checkAchievement(Adv.AchievType.KillHadBuff, 1, enemy) | 2347 | self:checkAchievement(Adv.AchievType.KillHadBuff, 1, enemy) |
2133 | 2348 | ||
2349 | + self.owner:checkTaskEnter("AdvKill", {chapterId = self.chapterId}) | ||
2350 | + | ||
2134 | self:checkAchievement(Adv.AchievType.KillWithBuff, 1) | 2351 | self:checkAchievement(Adv.AchievType.KillWithBuff, 1) |
2135 | self:checkAchievement(Adv.AchievType.KillNoBuff, 1) | 2352 | self:checkAchievement(Adv.AchievType.KillNoBuff, 1) |
2136 | self:checkAchievement(Adv.AchievType.KillWithMWeapon, 1) | 2353 | self:checkAchievement(Adv.AchievType.KillWithMWeapon, 1) |
@@ -2143,6 +2360,7 @@ function Adv:enemyDead(enemy, escape) | @@ -2143,6 +2360,7 @@ function Adv:enemyDead(enemy, escape) | ||
2143 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) | 2360 | self:checkAchievement(Adv.AchievType.KillBossNoBuff, 1) |
2144 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) | 2361 | self:checkAchievement(Adv.AchievType.KillBossWithMWeapon, 1) |
2145 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) | 2362 | self:checkAchievement(Adv.AchievType.KillBossWithAMWeapon, 1) |
2363 | + self.owner:checkTaskEnter("AdvKillBoss") | ||
2146 | elseif monsterData.type == 3 then | 2364 | elseif monsterData.type == 3 then |
2147 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) | 2365 | self:checkTask(Adv.TaskType.KillElite, 1, enemyId) |
2148 | end | 2366 | end |
src/adv/AdvBlock.lua
@@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit) | @@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit) | ||
60 | end | 60 | end |
61 | self:randomEvent() | 61 | self:randomEvent() |
62 | end | 62 | end |
63 | - self:quickDrop() | ||
64 | 63 | ||
65 | if not isInit and self.isOpen then | 64 | if not isInit and self.isOpen then |
65 | + self:quickDrop() | ||
66 | local newet = self:getEventType() | 66 | local newet = self:getEventType() |
67 | if oldet ~= newet then | 67 | if oldet ~= newet then |
68 | local em = {} | 68 | local em = {} |
@@ -134,6 +134,9 @@ function Block:randomEvent() | @@ -134,6 +134,9 @@ function Block:randomEvent() | ||
134 | randomFunc[AdvEventType.Drop] = function() | 134 | randomFunc[AdvEventType.Drop] = function() |
135 | if not self.event.item then | 135 | if not self.event.item then |
136 | self.event.item = csvdb["event_dropCsv"][self.event.id]["range"]:randWeight(true) | 136 | self.event.item = csvdb["event_dropCsv"][self.event.id]["range"]:randWeight(true) |
137 | + if self.event.item[1] == 0 then | ||
138 | + self:clear() | ||
139 | + end | ||
137 | end | 140 | end |
138 | end | 141 | end |
139 | --交易 | 142 | --交易 |
src/adv/AdvBuff.lua
@@ -38,6 +38,7 @@ Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 | @@ -38,6 +38,7 @@ Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 | ||
38 | Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 2 - 1 | 38 | Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 2 - 1 |
39 | Buff.DISABLE_AURA = 36 -- 禁用光环 | 39 | Buff.DISABLE_AURA = 36 -- 禁用光环 |
40 | Buff.GET_AURA = 37 -- 获得光环 | 40 | Buff.GET_AURA = 37 -- 获得光环 |
41 | +Buff.OBSTACLE_PLUS = 38 -- 周围8格不能点击 | ||
41 | 42 | ||
42 | 43 | ||
43 | --角色一些属性的变化 | 44 | --角色一些属性的变化 |
src/adv/AdvMap.lua
@@ -272,6 +272,10 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | @@ -272,6 +272,10 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) | ||
272 | if not ignoreBack then | 272 | if not ignoreBack then |
273 | self.adv:backBlockChange(roomId, blockId) | 273 | self.adv:backBlockChange(roomId, blockId) |
274 | end | 274 | end |
275 | + | ||
276 | + if self.adv.isRelay and self:isAllOpen() then -- 发放翻开的奖励 | ||
277 | + self.adv:passAdvRelay() | ||
278 | + end | ||
275 | end | 279 | end |
276 | return status | 280 | return status |
277 | end | 281 | end |
@@ -379,6 +383,24 @@ function Map:getAroundBlocks(room, block) | @@ -379,6 +383,24 @@ function Map:getAroundBlocks(room, block) | ||
379 | return blocks | 383 | return blocks |
380 | end | 384 | end |
381 | 385 | ||
386 | +function Map:getAroundBlocksPlus(room, block) | ||
387 | + local blocks = {} | ||
388 | + local range = {1, 0, -1} | ||
389 | + local col, row = room:tranLtoG(block.col, block.row) | ||
390 | + for _, c in ipairs(range) do | ||
391 | + for _, r in ipairs(range) do | ||
392 | + if c == 0 and r == 0 then | ||
393 | + else | ||
394 | + local rroom, rblock = self:getRBByPos(col + c, row + r) | ||
395 | + if rroom then | ||
396 | + table.insert(blocks, {rroom, rblock}) | ||
397 | + end | ||
398 | + end | ||
399 | + end | ||
400 | + end | ||
401 | + return blocks | ||
402 | +end | ||
403 | + | ||
382 | function Map:getBlocksBySize(roomId, blockId, size) | 404 | function Map:getBlocksBySize(roomId, blockId, size) |
383 | local blocks = {} | 405 | local blocks = {} |
384 | local room = self.rooms[roomId] | 406 | local room = self.rooms[roomId] |
@@ -873,7 +895,7 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | @@ -873,7 +895,7 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | ||
873 | level = AdvCommon.getEndlessDataLv(chapterId, level) | 895 | level = AdvCommon.getEndlessDataLv(chapterId, level) |
874 | end | 896 | end |
875 | local libsToType = { | 897 | local libsToType = { |
876 | - ["event_monsterCsv"] = {AdvEventType.Monster, AdvEventType.BOSS, AdvEventType.Monster}, | 898 | + ["event_monsterCsv"] = {AdvEventType.Monster, AdvEventType.BOSS, AdvEventType.Monster, AdvEventType.Monster, AdvEventType.Monster}, |
877 | ["event_chooseCsv"] = AdvEventType.Choose, | 899 | ["event_chooseCsv"] = AdvEventType.Choose, |
878 | ["event_dropCsv"] = AdvEventType.Drop, | 900 | ["event_dropCsv"] = AdvEventType.Drop, |
879 | ["event_buildingCsv"] = AdvEventType.Build, | 901 | ["event_buildingCsv"] = AdvEventType.Build, |
src/adv/AdvPassive.lua
@@ -527,12 +527,13 @@ function Passive:effect8(dropId) | @@ -527,12 +527,13 @@ function Passive:effect8(dropId) | ||
527 | skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) | 527 | skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) |
528 | end | 528 | end |
529 | local item = dropData["range"]:randWeight(true) | 529 | local item = dropData["range"]:randWeight(true) |
530 | - self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | ||
531 | - | 530 | + if item[1] ~= 0 then |
531 | + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | ||
532 | + end | ||
532 | end | 533 | end |
533 | 534 | ||
534 | --9=直接获得item(可在结算触发时使用) | 535 | --9=直接获得item(可在结算触发时使用) |
535 | -function Passive:effect9(itemId, triggerPms, ratio, max) | 536 | +function Passive:effect9(itemId, triggerPms, ratio, ratio2, max) |
536 | local cond = nil | 537 | local cond = nil |
537 | if self.passiveData.value == 0 then | 538 | if self.passiveData.value == 0 then |
538 | cond = triggerPms.score | 539 | cond = triggerPms.score |
@@ -542,7 +543,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) | @@ -542,7 +543,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) | ||
542 | return | 543 | return |
543 | end | 544 | end |
544 | if not cond then return end | 545 | 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}) | 546 | + 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 | end | 547 | end |
547 | 548 | ||
548 | --10=战斗额外掉落次数 | 549 | --10=战斗额外掉落次数 |
src/adv/AdvPlayer.lua
@@ -677,6 +677,10 @@ function Enemy:getClassify() | @@ -677,6 +677,10 @@ function Enemy:getClassify() | ||
677 | return csvdb["event_monsterCsv"][self.monsterId].classify | 677 | return csvdb["event_monsterCsv"][self.monsterId].classify |
678 | end | 678 | end |
679 | 679 | ||
680 | +function Enemy:getMonsterCsv() | ||
681 | + return csvdb["event_monsterCsv"][self.monsterId] | ||
682 | +end | ||
683 | + | ||
680 | -- 0=所有 1=怪物 2=玩家 | 684 | -- 0=所有 1=怪物 2=玩家 |
681 | function Enemy:checkAuraBuff(buffs) | 685 | function Enemy:checkAuraBuff(buffs) |
682 | local needBuffs = {} | 686 | local needBuffs = {} |
@@ -795,7 +799,7 @@ function Player:changeSp(value, cType) | @@ -795,7 +799,7 @@ function Player:changeSp(value, cType) | ||
795 | if cType == 0 then | 799 | if cType == 0 then |
796 | change = value | 800 | change = value |
797 | elseif cType == 1 then | 801 | elseif cType == 1 then |
798 | - change = self.sp * value / 100 | 802 | + change = self.spMax * value / 100 |
799 | end | 803 | end |
800 | local old = self.sp | 804 | local old = self.sp |
801 | self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) | 805 | self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) |
src/models/Activity.lua
@@ -30,6 +30,15 @@ Activity.ActivityType = { | @@ -30,6 +30,15 @@ Activity.ActivityType = { | ||
30 | ActShopGoods = 25, -- 活动商品 | 30 | ActShopGoods = 25, -- 活动商品 |
31 | 31 | ||
32 | Crisis = 26, -- 宝藏怪活动 | 32 | Crisis = 26, -- 宝藏怪活动 |
33 | + | ||
34 | + CommonSignIn = 28, --通用签到 | ||
35 | + FriendEnergy = 30, -- 好友互赠能量活动 | ||
36 | + AdvLevel = 33, -- 拾荒关卡 | ||
37 | + BattleCommand = 34, -- 战令活动 | ||
38 | + NewSign = 36, -- 活动签到,单独的签到界面 | ||
39 | + HeroBackFree = 37, -- 无损耗归还 | ||
40 | + | ||
41 | + BattleCommandTask = 38, -- 战令任务活动 | ||
33 | } | 42 | } |
34 | 43 | ||
35 | local function checkActivityType(activityType) | 44 | local function checkActivityType(activityType) |
@@ -73,6 +82,14 @@ Activity.schema = { | @@ -73,6 +82,14 @@ Activity.schema = { | ||
73 | 82 | ||
74 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} | 83 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} |
75 | act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | 84 | act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} |
85 | + | ||
86 | + act28 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | ||
87 | + act30 = {"table", {}}, -- {magic = 0, limit = 0, reward = {id = 1, id = 1}, giveAE = {}, getAE = {}} 奖励字段1表示领取过奖励 | ||
88 | + | ||
89 | + act33 = {"table", {}}, -- 拾荒关卡活动 {id={max=最大积分, pass=1}, r=""} | ||
90 | + | ||
91 | + act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} | ||
92 | + act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | ||
76 | } | 93 | } |
77 | 94 | ||
78 | function Activity:data() | 95 | function Activity:data() |
@@ -91,7 +108,16 @@ function Activity:data() | @@ -91,7 +108,16 @@ function Activity:data() | ||
91 | act18 = self:getProperty("act18"), | 108 | act18 = self:getProperty("act18"), |
92 | act19 = self:getProperty("act19"), | 109 | act19 = self:getProperty("act19"), |
93 | act20 = self:getProperty("act20"), | 110 | act20 = self:getProperty("act20"), |
111 | + act24 = self:getProperty("act24"), | ||
94 | act26 = self:getProperty("act26"), | 112 | act26 = self:getProperty("act26"), |
113 | + | ||
114 | + act28 = self:getProperty("act28"), | ||
115 | + act30 = self:getProperty("act30"), | ||
116 | + | ||
117 | + act33 = self:getProperty("act33"), | ||
118 | + | ||
119 | + act34 = self:getProperty("act34"), | ||
120 | + act36 = self:getProperty("act36"), | ||
95 | } | 121 | } |
96 | end | 122 | end |
97 | 123 | ||
@@ -445,8 +471,9 @@ activityFunc[Activity.ActivityType.PayBack] = { | @@ -445,8 +471,9 @@ activityFunc[Activity.ActivityType.PayBack] = { | ||
445 | -- 英雄帖 | 471 | -- 英雄帖 |
446 | activityFunc[Activity.ActivityType.CalendaTask] = { | 472 | activityFunc[Activity.ActivityType.CalendaTask] = { |
447 | ["init"] = function(self, actType, isCrossDay, notify) | 473 | ["init"] = function(self, actType, isCrossDay, notify) |
448 | - local calTask = self.owner:getProperty("CalTask") | 474 | + local calTask = self.owner:getProperty("calTask") |
449 | calTask = {} | 475 | calTask = {} |
476 | + self.owner:updateProperty({field="calTask", value=calTask}) | ||
450 | local role = self.owner | 477 | local role = self.owner |
451 | local buildL = role.dinerData:getProperty("buildL") | 478 | local buildL = role.dinerData:getProperty("buildL") |
452 | local curLevel = buildL:getv(1, 1) | 479 | local curLevel = buildL:getv(1, 1) |
@@ -470,8 +497,111 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | @@ -470,8 +497,111 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | ||
470 | role:checkTaskEnter("RuneQualityCollect", {}) | 497 | role:checkTaskEnter("RuneQualityCollect", {}) |
471 | 498 | ||
472 | end, | 499 | end, |
473 | - -- ["close"] = function(self, actType, notify) | ||
474 | - -- end, | 500 | + ["crossDay"] = function(self, actType, notify, actId) |
501 | + local actData = self.owner:getProperty("calTask") or {} | ||
502 | + local record = actData["r"] or {} | ||
503 | + local actCfg = csvdb["activity_taskCsv"][actId] | ||
504 | + if not actCfg then return end | ||
505 | + local change = false | ||
506 | + for taskId, cfg in pairs(actCfg) do | ||
507 | + if cfg["resetType"] == 1 then -- 每日重置 | ||
508 | + record[taskId] = nil | ||
509 | + actData[taskId] = nil | ||
510 | + change = true | ||
511 | + end | ||
512 | + end | ||
513 | + if change then | ||
514 | + self.owner:updateProperty({field="calTask", value=actData}) | ||
515 | + end | ||
516 | + end, | ||
517 | + ["crossWeek"] = function(self, actType, notify, actId) | ||
518 | + local actData = self.owner:getProperty("calTask") or {} | ||
519 | + local record = actData["r"] or {} | ||
520 | + local actCfg = csvdb["activity_taskCsv"][actId] | ||
521 | + if not actCfg then return end | ||
522 | + local change = false | ||
523 | + for taskId, cfg in pairs(actCfg) do | ||
524 | + if cfg["resetType"] == 2 then -- 每周重置 | ||
525 | + record[taskId] = nil | ||
526 | + actData[taskId] = nil | ||
527 | + change = true | ||
528 | + end | ||
529 | + end | ||
530 | + if change then | ||
531 | + self.owner:updateProperty({field="calTask", value=actData}) | ||
532 | + end | ||
533 | + end, | ||
534 | + ["close"] = function(self, actType, notify) | ||
535 | + self.owner:updateProperty({field="calTask", value={}}) | ||
536 | + end, | ||
537 | +} | ||
538 | + | ||
539 | +-- 活动任务 仅供春节活动使用 防冲突 | ||
540 | +activityFunc[Activity.ActivityType.BattleCommandTask] = { | ||
541 | + ["init"] = function(self, actType, isCrossDay, notify) | ||
542 | + local bcTask = self.owner:getProperty("bcTask") | ||
543 | + bcTask = {} | ||
544 | + self.owner:updateProperty({field="bcTask", value=bcTask}) | ||
545 | + local role = self.owner | ||
546 | + local buildL = role.dinerData:getProperty("buildL") | ||
547 | + local curLevel = buildL:getv(1, 1) | ||
548 | + role:checkTaskEnter("DinerLevelUp", {level = curLevel}) | ||
549 | + | ||
550 | + role:checkTaskEnter("HeroLvlCollect", {}) | ||
551 | + role:checkTaskEnter("HeroQualityCollect", {}) | ||
552 | + | ||
553 | + local curPopular = role.dinerData:getProperty("popular") | ||
554 | + role:checkTaskEnter("DinerPopular", {count = curPopular}) | ||
555 | + | ||
556 | + local rLevel = role:getProperty("level") | ||
557 | + role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | ||
558 | + | ||
559 | + local towerInfo = role:getProperty("towerInfo") | ||
560 | + role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | ||
561 | + --"PvpWin" | ||
562 | + --role:checkTaskEnter("HangPass", {id = 0}) | ||
563 | + role:checkCalendaTask(true, 15, 3) | ||
564 | + role:checkTaskEnter("HeroStarCollect", {}) | ||
565 | + role:checkTaskEnter("RuneQualityCollect", {}) | ||
566 | + | ||
567 | + end, | ||
568 | + ["crossDay"] = function(self, actType, notify, actId) | ||
569 | + local actData = self.owner:getProperty("bcTask") or {} | ||
570 | + local record = actData["r"] or {} | ||
571 | + local actCfg = csvdb["activity_taskCsv"][actId] | ||
572 | + if not actCfg then return end | ||
573 | + local change = false | ||
574 | + for taskId, cfg in pairs(actCfg) do | ||
575 | + if cfg["resetType"] == 1 then -- 每日充值 | ||
576 | + record[taskId] = nil | ||
577 | + actData[taskId] = nil | ||
578 | + change = true | ||
579 | + end | ||
580 | + end | ||
581 | + if change then | ||
582 | + self.owner:updateProperty({field="bcTask", value=actData}) | ||
583 | + end | ||
584 | + end, | ||
585 | + ["crossWeek"] = function(self, actType, notify, actId) | ||
586 | + local actData = self.owner:getProperty("bcTask") or {} | ||
587 | + local record = actData["r"] or {} | ||
588 | + local actCfg = csvdb["activity_taskCsv"][actId] | ||
589 | + if not actCfg then return end | ||
590 | + local change = false | ||
591 | + for taskId, cfg in pairs(actCfg) do | ||
592 | + if cfg["resetType"] == 2 then -- 每周重置 | ||
593 | + record[taskId] = nil | ||
594 | + actData[taskId] = nil | ||
595 | + change = true | ||
596 | + end | ||
597 | + end | ||
598 | + if change then | ||
599 | + self.owner:updateProperty({field="bcTask", value=actData}) | ||
600 | + end | ||
601 | + end, | ||
602 | + ["close"] = function(self, actType, notify) | ||
603 | + self.owner:updateProperty({field="bcTask", value={}}) | ||
604 | + end, | ||
475 | } | 605 | } |
476 | 606 | ||
477 | -- 兑换 | 607 | -- 兑换 |
@@ -481,6 +611,9 @@ activityFunc[Activity.ActivityType.Exchange] = { | @@ -481,6 +611,9 @@ activityFunc[Activity.ActivityType.Exchange] = { | ||
481 | actData[actId] = {} | 611 | actData[actId] = {} |
482 | self:updateActData(actType, actData, not notify) | 612 | self:updateActData(actType, actData, not notify) |
483 | end, | 613 | end, |
614 | + ["login"] = function(self, actType, actId) | ||
615 | + activityFunc[Activity.ActivityType.Exchange]["crossDay"](self, actType, true, actId) | ||
616 | + end, | ||
484 | ["crossDay"] = function(self, actType, notify, actId) | 617 | ["crossDay"] = function(self, actType, notify, actId) |
485 | local actData = self:getActData(actType) or {} | 618 | local actData = self:getActData(actType) or {} |
486 | local lastTs = actData["ts"] or 0 | 619 | local lastTs = actData["ts"] or 0 |
@@ -489,14 +622,14 @@ activityFunc[Activity.ActivityType.Exchange] = { | @@ -489,14 +622,14 @@ activityFunc[Activity.ActivityType.Exchange] = { | ||
489 | if not cfg then return end | 622 | if not cfg then return end |
490 | local refreshTimes = cfg.condition2:toArray(false, "=") | 623 | local refreshTimes = cfg.condition2:toArray(false, "=") |
491 | for i = 1, #refreshTimes do | 624 | for i = 1, #refreshTimes do |
492 | - local rt = toUnixtime(refreshTimes[1]..string_format("%02x", RESET_TIME)) | 625 | + local rt = toUnixtime(refreshTimes[i]..string_format("%02x", RESET_TIME)) |
493 | if timeNow >= rt and rt > lastTs then | 626 | if timeNow >= rt and rt > lastTs then |
494 | lastTs = rt | 627 | lastTs = rt |
495 | actData = {} | 628 | actData = {} |
496 | end | 629 | end |
497 | end | 630 | end |
498 | - if next(actData) then | ||
499 | - actData["ts"] = lastTs | 631 | + if not next(actData) then |
632 | + actData["ts"] = timeNow | ||
500 | self:updateActData(actType, actData, not notify) | 633 | self:updateActData(actType, actData, not notify) |
501 | end | 634 | end |
502 | end, | 635 | end, |
@@ -525,6 +658,12 @@ activityFunc[Activity.ActivityType.ActHeroPool] = { | @@ -525,6 +658,12 @@ activityFunc[Activity.ActivityType.ActHeroPool] = { | ||
525 | local actData = self:getActData(actType) | 658 | local actData = self:getActData(actType) |
526 | local cfg = csvdb["activity_ctrlCsv"][actId] | 659 | local cfg = csvdb["activity_ctrlCsv"][actId] |
527 | if not cfg then return end | 660 | if not cfg then return end |
661 | + -- 保底次数转换成万能碎片 | ||
662 | + --local count = math.ceil(((actData[cfg.condition] or 0) / 100) * 60) | ||
663 | + --if count > 0 then | ||
664 | + -- local gift = {[723] = count} | ||
665 | + -- self.owner:sendMail(MailId.ActivityPoolRet, nil, gift, {}) | ||
666 | + --end | ||
528 | actData[cfg.condition] = nil | 667 | actData[cfg.condition] = nil |
529 | self:updateActData(actType, actData, not notify) | 668 | self:updateActData(actType, actData, not notify) |
530 | end, | 669 | end, |
@@ -578,8 +717,8 @@ function Activity:closeActivity(actId, notify, notUpdateAct) | @@ -578,8 +717,8 @@ function Activity:closeActivity(actId, notify, notUpdateAct) | ||
578 | local actType = actData.showType | 717 | local actType = actData.showType |
579 | if activityFunc[actType] and activityFunc[actType]['close'] then | 718 | if activityFunc[actType] and activityFunc[actType]['close'] then |
580 | activityFunc[actType]["close"](self, actType, notify, actId) | 719 | activityFunc[actType]["close"](self, actType, notify, actId) |
581 | - self:recycleActItem(actId) | ||
582 | end | 720 | end |
721 | + self:recycleActItem(actId) | ||
583 | if Activity.schema["act".. actType] then | 722 | if Activity.schema["act".. actType] then |
584 | if not Activity.schema["act" .. actType][3] then | 723 | if not Activity.schema["act" .. actType][3] then |
585 | self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) | 724 | self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) |
@@ -599,6 +738,18 @@ function Activity:refreshDailyData(notify) | @@ -599,6 +738,18 @@ function Activity:refreshDailyData(notify) | ||
599 | end | 738 | end |
600 | end | 739 | end |
601 | 740 | ||
741 | +function Activity:refreshWeekData(notify) | ||
742 | + for actId, status in pairs(self._isOpen) do | ||
743 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
744 | + if status and actData then | ||
745 | + local actType = actData.showType | ||
746 | + if activityFunc[actType] and activityFunc[actType]['crossWeek'] then | ||
747 | + activityFunc[actType]["crossWeek"](self, actType, notify, actId) | ||
748 | + end | ||
749 | + end | ||
750 | + end | ||
751 | +end | ||
752 | + | ||
602 | function Activity:checkActivity(notNotify, activityType, ...) | 753 | function Activity:checkActivity(notNotify, activityType, ...) |
603 | if not activityType then return end | 754 | if not activityType then return end |
604 | if not self:isOpen(activityType) then return end | 755 | if not self:isOpen(activityType) then return end |
@@ -698,7 +849,7 @@ function Activity:recycleActItem(actId) | @@ -698,7 +849,7 @@ function Activity:recycleActItem(actId) | ||
698 | local itemCount = role:getItemCount(fromId) | 849 | local itemCount = role:getItemCount(fromId) |
699 | if itemCount > 0 then | 850 | if itemCount > 0 then |
700 | costs[fromId] = (costs[fromId] or 0) + itemCount | 851 | costs[fromId] = (costs[fromId] or 0) + itemCount |
701 | - gift[toId] = toNum * itemCount | 852 | + gift[toId] = (gift[toId] or 0) + toNum * itemCount |
702 | end | 853 | end |
703 | end | 854 | end |
704 | if next(costs) then | 855 | if next(costs) then |
@@ -762,7 +913,46 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | @@ -762,7 +913,46 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | ||
762 | end, | 913 | end, |
763 | } | 914 | } |
764 | 915 | ||
916 | +activityFunc[Activity.ActivityType.FriendEnergy] = { | ||
917 | + ["init"] = function (self, actType, isCrossDay, notify, actId) | ||
918 | + local data = {magic = 0, limit = 0, reward = {}, giveAE = {}, getAE = {}, new = self:getActFriendNew()} | ||
919 | + self:updateActData(actType, data, not notify) | ||
920 | + end, | ||
921 | + ["login"] = function (self, actType) | ||
922 | + local actData = self:getActData(actType) or {} | ||
923 | + actData.new = self:getActFriendNew() | ||
924 | + self:updateActData(actType, actData, not notify) | ||
925 | + end, | ||
926 | + ["crossDay"] = function(self, actType, notify) | ||
927 | + local actData = self:getActData(actType) | ||
928 | + actData.limit = 0 | ||
929 | + actData.giveAE = {} | ||
930 | + actData.getAE = {} | ||
931 | + self:updateActData(actType, actData, not notify) | ||
932 | + end, | ||
933 | + ["close"] = function (self, actType, notify, actId) | ||
934 | + redisproxy:del(FRIEND_ENERGY:format(self.owner:getProperty("id"))) | ||
935 | + end | ||
936 | +} | ||
937 | + | ||
938 | +function Activity:getActFriendNew() | ||
939 | + local roleId = self.owner:getProperty("id") | ||
940 | + local friendIds = {} | ||
941 | + local friends = redisproxy:hgetall(FRIEND_KEY:format(roleId)) | ||
942 | + for i = 1, #friends , 2 do | ||
943 | + local objId = tonumber(friends[i]) | ||
944 | + friendIds[objId] = 1 | ||
945 | + end | ||
765 | 946 | ||
947 | + local ids = {} | ||
948 | + local members = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) | ||
949 | + for _, id in pairs(members) do | ||
950 | + if friendIds[tonumber(id)] then | ||
951 | + ids[tonumber(id)] = 1 | ||
952 | + end | ||
953 | + end | ||
954 | + return ids | ||
955 | +end | ||
766 | 956 | ||
767 | activityFunc[Activity.ActivityType.Crisis] = { | 957 | activityFunc[Activity.ActivityType.Crisis] = { |
768 | ["check"] = function(self, actType, notify, atype, count) -- 检查 | 958 | ["check"] = function(self, actType, notify, atype, count) -- 检查 |
@@ -775,25 +965,27 @@ activityFunc[Activity.ActivityType.Crisis] = { | @@ -775,25 +965,27 @@ activityFunc[Activity.ActivityType.Crisis] = { | ||
775 | for id, actSet in pairs(actCsv) do | 965 | for id, actSet in pairs(actCsv) do |
776 | if actSet.type == atype then | 966 | if actSet.type == atype then |
777 | local status = actData.task[id] or 0 | 967 | local status = actData.task[id] or 0 |
778 | - status = status + count | ||
779 | - if status >= actSet.condition1 then | ||
780 | - local reward | ||
781 | - if actSet.loop == 1 then | ||
782 | - local rcount = math.floor(status / actSet.condition1) | ||
783 | - reward = actSet.reward:toNumMap() | ||
784 | - for itemId, itemC in pairs(reward) do | ||
785 | - reward[itemId] = itemC * rcount | 968 | + if status ~= -1 then |
969 | + status = status + count | ||
970 | + if status >= actSet.condition1 then | ||
971 | + local reward | ||
972 | + if actSet.loop == 1 then | ||
973 | + local rcount = math.floor(status / actSet.condition1) | ||
974 | + reward = actSet.reward:toNumMap() | ||
975 | + for itemId, itemC in pairs(reward) do | ||
976 | + reward[itemId] = itemC * rcount | ||
977 | + end | ||
978 | + status = status % actSet.condition1 | ||
979 | + else | ||
980 | + reward = actSet.reward | ||
981 | + status = -1 | ||
786 | end | 982 | end |
787 | - status = status % actSet.condition1 | ||
788 | - else | ||
789 | - reward = actSet.reward | ||
790 | - status = -1 | ||
791 | - end | ||
792 | 983 | ||
793 | - self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | 984 | + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) |
985 | + end | ||
986 | + actData.task[id] = status | ||
987 | + change = true | ||
794 | end | 988 | end |
795 | - actData.task[id] = status | ||
796 | - change = true | ||
797 | end | 989 | end |
798 | end | 990 | end |
799 | if change then | 991 | if change then |
@@ -804,4 +996,193 @@ activityFunc[Activity.ActivityType.Crisis] = { | @@ -804,4 +996,193 @@ activityFunc[Activity.ActivityType.Crisis] = { | ||
804 | end, | 996 | end, |
805 | } | 997 | } |
806 | 998 | ||
999 | +activityFunc[Activity.ActivityType.CommonSignIn] = { | ||
1000 | + ["init"] = function(self, actType, isCrossDay, notify, actId) | ||
1001 | + if not isCrossDay then | ||
1002 | + activityFunc[Activity.ActivityType.CommonSignIn]["crossDay"](self, actType, notify, actId) | ||
1003 | + | ||
1004 | + local taskStatus = self.owner:getProperty("dTask") | ||
1005 | + activityFunc[Activity.ActivityType.CommonSignIn]["check"](self, actType, notify, 0, (taskStatus["a"] or 0)) | ||
1006 | + end | ||
1007 | + end, | ||
1008 | + ["crossDay"] = function(self, actType, notify, actId) | ||
1009 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
1010 | + if not actCfg then return end | ||
1011 | + local conArr = actCfg.condition2:toArray(true, "=") | ||
1012 | + -- 0 登录即可, 1 达到指定活跃度 | ||
1013 | + if conArr[1] ~= 0 then | ||
1014 | + return | ||
1015 | + end | ||
1016 | + local curData = self:getActData(actType) or {} | ||
1017 | + curData[0] = (curData[0] or 0) + 1 | ||
1018 | + self:updateActData(actType, curData, not notify) | ||
1019 | + end, | ||
1020 | + ["check"] = function(self, actType, notify, pre, cur) -- 检查 | ||
1021 | + local isOpen, actId = self:isOpen(actType) | ||
1022 | + local actData = self:getActData(actType) or {} | ||
1023 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
1024 | + if not actCfg then return end | ||
1025 | + local conArr = actCfg.condition2:toArray(true, "=") | ||
1026 | + -- 0 登录即可, 1 达到指定活跃度 | ||
1027 | + if conArr[1] ~= 1 then | ||
1028 | + return | ||
1029 | + end | ||
1030 | + local val = conArr[2] or 0 | ||
1031 | + if pre < val and cur >= val then | ||
1032 | + actData[0] = (actData[0] or 0) + 1 | ||
1033 | + self:updateActData(actType, actData, not notify) | ||
1034 | + end | ||
1035 | + end, | ||
1036 | +} | ||
1037 | + | ||
1038 | +activityFunc[Activity.ActivityType.BattleCommand] = { | ||
1039 | + ["init"] = function (self, actType, isCrossDay, notify, actId) | ||
1040 | + local data = {unlock = 0, freeR = "", payR = "", lvl = 0, sum = 0, week = 0} | ||
1041 | + self:updateActData(actType, data, not notify) | ||
1042 | + end, | ||
1043 | + ["check"] = function(self, actType, notify, id, count) -- 检查 itemid, count | ||
1044 | + local isOpen, actId = self:isOpen(actType) | ||
1045 | + local actData = self:getActData(actType) or {} | ||
1046 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | ||
1047 | + if not actCfg then return end | ||
1048 | + if actCfg.condition1 == "" then return end | ||
1049 | + local arr = actCfg.condition2:toArray(true, "=") | ||
1050 | + local itemIdWeek, itemIdNormal, limit = arr[1], arr[2], arr[3] | ||
1051 | + if (itemIdWeek == id or itemIdNormal == id) and count > 0 then | ||
1052 | + if itemIdWeek == id then | ||
1053 | + if (actData["week"] or 0) >= limit then | ||
1054 | + return | ||
1055 | + end | ||
1056 | + local old = actData["week"] or 0 | ||
1057 | + actData["week"] = math.min(old + count, limit) | ||
1058 | + count = actData["week"] - old | ||
1059 | + end | ||
1060 | + local total = actData["sum"] + count | ||
1061 | + local curLvl = actData["lvl"] or 0 | ||
1062 | + if actCfg.condition == 1 then -- 代表sum需要转换为等级 | ||
1063 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actId] | ||
1064 | + if not bpCfg then return end | ||
1065 | + for i = 1, #bpCfg do | ||
1066 | + local cfg = bpCfg[i] | ||
1067 | + if cfg["type"] > curLvl then | ||
1068 | + if total < cfg["condition"] then break end | ||
1069 | + total = total - cfg["condition"] | ||
1070 | + curLvl = curLvl + 1 | ||
1071 | + end | ||
1072 | + end | ||
1073 | + actData["lvl"] = curLvl | ||
1074 | + actData["sum"] = total | ||
1075 | + end | ||
1076 | + | ||
1077 | + self:updateActData(actType, actData) | ||
1078 | + end | ||
1079 | + end, | ||
1080 | + ["crossWeek"] = function(self, actType, notify, actId) | ||
1081 | + local actData = self:getActData(actType) or {} | ||
1082 | + actData["week"] = 0 | ||
1083 | + self:updateActData(actType, actData, true) | ||
1084 | + end, | ||
1085 | +} | ||
1086 | + | ||
1087 | + | ||
1088 | +activityFunc[Activity.ActivityType.NewSign] = { | ||
1089 | + -- ["check"] = function(self, actType, notify) -- 检查 | ||
1090 | + -- end, | ||
1091 | + ["init"] = function(self, actType, isCrossDay, notify) | ||
1092 | + if not isCrossDay then | ||
1093 | + activityFunc[Activity.ActivityType.NewSign]["crossDay"](self, actType, notify) | ||
1094 | + end | ||
1095 | + end, | ||
1096 | + -- ["close"] = function(self, actType, notify) | ||
1097 | + -- end, | ||
1098 | + ["crossDay"] = function(self, actType, notify) | ||
1099 | + local curData = self:getActData(actType) | ||
1100 | + local isOpen, actId = self:isOpen(actType) | ||
1101 | + local actData = csvdb["activity_signInCsv"][actId] or {} | ||
1102 | + curData["0"] = curData["0"] or 0 | ||
1103 | + if curData["0"] >= #actData then return end -- 满了就忽略了 | ||
1104 | + curData["0"] = curData["0"] + 1 | ||
1105 | + | ||
1106 | + -- 没满更新一下 | ||
1107 | + self:updateActData(actType, curData, not notify) | ||
1108 | + end, | ||
1109 | +} | ||
1110 | + | ||
1111 | +local function closeActAdvHang(role, chapterId) | ||
1112 | + local advHang = role:getProperty("advHang") | ||
1113 | + local info = advHang[chapterId] | ||
1114 | + if not info then return end | ||
1115 | + | ||
1116 | + local index = info.index or 1 | ||
1117 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | ||
1118 | + if not chapterData then return end | ||
1119 | + local campSiteData = chapterData[info.campId or 2] | ||
1120 | + if not campSiteData then return 1 end | ||
1121 | + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 | ||
1122 | + | ||
1123 | + local adv_idle_time = globalCsv.adv_idle_time[index] | ||
1124 | + local adv_idle_energy = globalCsv.adv_idle_energy[index] | ||
1125 | + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] | ||
1126 | + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | ||
1127 | + return 2 | ||
1128 | + end | ||
1129 | + adv_idle_time = adv_idle_time * 60 | ||
1130 | + | ||
1131 | + local reward, isFull, change, heroFaithMap | ||
1132 | + local heroCnt = 0 | ||
1133 | + if skynet.timex() >= info.time then | ||
1134 | + -- 增加英雄信赖 | ||
1135 | + local exp = info.duration / 60 | ||
1136 | + heroFaithMap = {} | ||
1137 | + for _, heroId in pairs(info.format.heros) do | ||
1138 | + local curFaith = role:addHeroFaith(heroId, exp) | ||
1139 | + heroFaithMap[heroId] = curFaith | ||
1140 | + heroCnt = heroCnt + 1 | ||
1141 | + end | ||
1142 | + | ||
1143 | + local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 | ||
1144 | + | ||
1145 | + local idleReward = totalReward:toNumMap() | ||
1146 | + for itemId, count in pairs(idleReward) do | ||
1147 | + idleReward[itemId] = count * adv_idle_reward_coef | ||
1148 | + end | ||
1149 | + reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) | ||
1150 | + end | ||
1151 | + role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) | ||
1152 | + | ||
1153 | + role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = 2}) | ||
1154 | + | ||
1155 | + role:checkTaskEnter("AdvHang", {}) | ||
1156 | + role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) | ||
1157 | +end | ||
1158 | + | ||
1159 | +activityFunc[Activity.ActivityType.AdvLevel] = { | ||
1160 | + -- ["check"] = function(self, actType, notify) -- 检查 | ||
1161 | + -- end, | ||
1162 | + ["init"] = function(self, actType, isCrossDay, notify) | ||
1163 | + end, | ||
1164 | + ["close"] = function(self, actType, notify, actid) | ||
1165 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | ||
1166 | + if not actCfg then return end | ||
1167 | + for chapterId, _ in pairs(actCfg) do | ||
1168 | + local advPass = self.owner:getProperty("advPass") | ||
1169 | + advPass[chapterId] = nil | ||
1170 | + local advRelay = self.owner:getProperty("advRelay") | ||
1171 | + advRelay[chapterId] = nil | ||
1172 | + self.owner:updateProperties({ | ||
1173 | + advPass = advPass, | ||
1174 | + advRelay = advRelay, | ||
1175 | + }, not notify) | ||
1176 | + -- 关闭活动代理拾荒 | ||
1177 | + closeActAdvHang(self.owner, chapterId) | ||
1178 | + end | ||
1179 | + -- 强制关闭活动拾荒关卡 | ||
1180 | + local adv = self.owner:getAdvData() | ||
1181 | + if adv:isRunning() and adv:isActivity() then | ||
1182 | + adv:forceOver() | ||
1183 | + end | ||
1184 | + | ||
1185 | + end, | ||
1186 | +} | ||
1187 | + | ||
807 | return Activity | 1188 | return Activity |
src/models/Daily.lua
@@ -28,6 +28,7 @@ Daily.schema = { | @@ -28,6 +28,7 @@ Daily.schema = { | ||
28 | 28 | ||
29 | unlockPool = {"table", {}}, -- 解锁的属性卡池 | 29 | unlockPool = {"table", {}}, -- 解锁的属性卡池 |
30 | curPool = {"number", 0}, -- 属性卡池当前索引 | 30 | curPool = {"number", 0}, -- 属性卡池当前索引 |
31 | + drawHeroCnt = {"number", 0}, -- 每日抽卡次数 | ||
31 | } | 32 | } |
32 | 33 | ||
33 | function Daily:updateProperty(params) | 34 | function Daily:updateProperty(params) |
src/models/Diner.lua
@@ -201,7 +201,7 @@ function Diner:calSellReward(sell, delta, dishData) | @@ -201,7 +201,7 @@ function Diner:calSellReward(sell, delta, dishData) | ||
201 | upValue[ItemId.Gold] = (upValue[ItemId.Gold] or 0) + buildData.gold_up | 201 | upValue[ItemId.Gold] = (upValue[ItemId.Gold] or 0) + buildData.gold_up |
202 | end | 202 | end |
203 | if buildData.item_up > 0 then | 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 | end | 205 | end |
206 | if buildData and buildData.famous_up > 0 then | 206 | if buildData and buildData.famous_up > 0 then |
207 | upValue[-1] = (upValue[-1] or 0) + buildData.famous_up | 207 | upValue[-1] = (upValue[-1] or 0) + buildData.famous_up |
src/models/HeroPlugin.lua
@@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) | @@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) | ||
53 | local talentAttrS = {} | 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 | end | 71 | end |
71 | end | 72 | end |
73 | + else | ||
74 | + break | ||
72 | end | 75 | end |
73 | end | 76 | end |
74 | 77 | ||
@@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) | @@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) | ||
85 | for lvl = 1, #faithConfig do | 88 | for lvl = 1, #faithConfig do |
86 | if faith >= faithConfig[lvl].exp then | 89 | if faith >= faithConfig[lvl].exp then |
87 | local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=") | 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 | end | 92 | end |
90 | end | 93 | end |
91 | for _, attrName in pairs(AttsEnumEx) do | 94 | for _, attrName in pairs(AttsEnumEx) do |
src/models/Order.lua
@@ -12,6 +12,7 @@ Order.schema = { | @@ -12,6 +12,7 @@ Order.schema = { | ||
12 | createTime = {"number", skynet.timex()}, -- 订单创建时间 | 12 | createTime = {"number", skynet.timex()}, -- 订单创建时间 |
13 | finishTime = {"number", 0}, -- 服务端验证完成时间 | 13 | finishTime = {"number", 0}, -- 服务端验证完成时间 |
14 | status = {"string", "create"}, | 14 | status = {"string", "create"}, |
15 | + sid = {"number",0}, -- 创建单号的设备的sid | ||
15 | } | 16 | } |
16 | 17 | ||
17 | Order.fields = { | 18 | Order.fields = { |
@@ -21,6 +22,7 @@ Order.fields = { | @@ -21,6 +22,7 @@ Order.fields = { | ||
21 | createTime = true, | 22 | createTime = true, |
22 | finishTime = true, | 23 | finishTime = true, |
23 | status = true, | 24 | status = true, |
25 | + sid = true, | ||
24 | } | 26 | } |
25 | 27 | ||
26 | return Order | 28 | return Order |
27 | \ No newline at end of file | 29 | \ No newline at end of file |
src/models/Role.lua
@@ -54,13 +54,15 @@ Role.schema = { | @@ -54,13 +54,15 @@ Role.schema = { | ||
54 | banTime = {"number", 0}, | 54 | banTime = {"number", 0}, |
55 | banType = {"number", 0}, | 55 | banType = {"number", 0}, |
56 | heartWarning = {"number", 0}, | 56 | heartWarning = {"number", 0}, |
57 | + cheatCount = {"number", 0}, | ||
57 | ltime = {"number", 0}, -- 最后登录时间 | 58 | ltime = {"number", 0}, -- 最后登录时间 |
58 | ctime = {"number", skynet.timex()}, -- 创建时间 | 59 | ctime = {"number", skynet.timex()}, -- 创建时间 |
59 | ignoreMt = {"number", 0}, -- 忽略维护拦截 | 60 | ignoreMt = {"number", 0}, -- 忽略维护拦截 |
60 | - sversion = {"number", globalCsv.StructVersion or 0}, -- 重整数据版本 | 61 | + sversion = {"number", STRUCT_VERSION or 0}, -- 重整数据版本 |
61 | timeReset = {"table", {}}, --重置轮回记录 | 62 | timeReset = {"table", {}}, --重置轮回记录 |
62 | - diamond = {"number", 0}, | ||
63 | - reDiamond = {"number", 0}, | 63 | + diamond = {"number", 0}, -- 免费钻 |
64 | + reDiamond = {"number", 0}, -- android充值钻 | ||
65 | + reDiamondIos = {"number", 0}, -- ios充值钻 | ||
64 | setting = {"table", {}}, --设置 | 66 | setting = {"table", {}}, --设置 |
65 | codeStr = {"string", "", "blob"}, --已经领过的礼包码 | 67 | codeStr = {"string", "", "blob"}, --已经领过的礼包码 |
66 | -- roleInfo | 68 | -- roleInfo |
@@ -155,6 +157,7 @@ Role.schema = { | @@ -155,6 +157,7 @@ Role.schema = { | ||
155 | 157 | ||
156 | achiveT = {"table", {}}, -- 成就计数统计 achivement_type {id = status} | 158 | achiveT = {"table", {}}, -- 成就计数统计 achivement_type {id = status} |
157 | achiveV = {"table", {}}, -- 成就领奖统计 achivement {id = status} | 159 | achiveV = {"table", {}}, -- 成就领奖统计 achivement {id = status} |
160 | + fuxR = {"number", 0}, -- 复兴成就最大完成数量 | ||
158 | 161 | ||
159 | rechargeF = {"table", {}}, -- 是否首次充值某一项 -- —{[id] = 1} -- 不存在就是没有充值过 | 162 | rechargeF = {"table", {}}, -- 是否首次充值某一项 -- —{[id] = 1} -- 不存在就是没有充值过 |
160 | dinerS = {"table", {}}, -- 美食币商城 购买记录 {[id] = count} | 163 | dinerS = {"table", {}}, -- 美食币商城 购买记录 {[id] = count} |
@@ -183,6 +186,7 @@ Role.schema = { | @@ -183,6 +186,7 @@ Role.schema = { | ||
183 | feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 | 186 | feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 |
184 | 187 | ||
185 | calTask = {"table", {}}, -- 英雄令活动 日历任务活动 | 188 | calTask = {"table", {}}, -- 英雄令活动 日历任务活动 |
189 | + bcTask = {"table", {}}, -- 英雄令活动 日历任务活动 临时使用 | ||
186 | radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv | 190 | radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv |
187 | } | 191 | } |
188 | 192 | ||
@@ -356,6 +360,7 @@ function Role:data() | @@ -356,6 +360,7 @@ function Role:data() | ||
356 | advSup = self:getProperty("advSup"), | 360 | advSup = self:getProperty("advSup"), |
357 | advC = self:getProperty("advC"), | 361 | advC = self:getProperty("advC"), |
358 | advCT = self:getProperty("advCT"), | 362 | advCT = self:getProperty("advCT"), |
363 | + advRelay = self:getProperty("advRelay"), | ||
359 | 364 | ||
360 | hangPass = self:getProperty("hangPass"), | 365 | hangPass = self:getProperty("hangPass"), |
361 | hangGift = self:getProperty("hangGift"), | 366 | hangGift = self:getProperty("hangGift"), |
@@ -409,6 +414,7 @@ function Role:data() | @@ -409,6 +414,7 @@ function Role:data() | ||
409 | feedback = self:getProperty("feedback"), | 414 | feedback = self:getProperty("feedback"), |
410 | ctime = self:getProperty("ctime"), | 415 | ctime = self:getProperty("ctime"), |
411 | calTask = self:getProperty("calTask"), | 416 | calTask = self:getProperty("calTask"), |
417 | + bcTask = self:getProperty("bcTask"), | ||
412 | radioTask = self:getProperty("radioTask"), | 418 | radioTask = self:getProperty("radioTask"), |
413 | } | 419 | } |
414 | end | 420 | end |
src/models/RoleBattle.lua
@@ -21,13 +21,153 @@ local BattleType = { | @@ -21,13 +21,153 @@ local BattleType = { | ||
21 | 21 | ||
22 | RoleBattle.bind = function (Role) | 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 | end | 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 | function Role:checkBattle(battleType, params) | 172 | function Role:checkBattle(battleType, params) |
33 | local clientInfo = params.info or {} | 173 | local clientInfo = params.info or {} |
src/models/RoleChangeStruct.lua
@@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params) | @@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params) | ||
31 | print("awardGift" .. " >>> " .. params) | 31 | print("awardGift" .. " >>> " .. params) |
32 | end) | 32 | end) |
33 | 33 | ||
34 | + | ||
34 | local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params) | 35 | local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params) |
35 | local sudoku = role:getProperty("sudoku") | 36 | local sudoku = role:getProperty("sudoku") |
36 | local phase = sudoku[-1] or 1 | 37 | local phase = sudoku[-1] or 1 |
@@ -48,11 +49,38 @@ local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params | @@ -48,11 +49,38 @@ local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params | ||
48 | end | 49 | end |
49 | end) | 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 | ---------------------版本方法 end ---------------------- | 77 | ---------------------版本方法 end ---------------------- |
52 | 78 | ||
53 | -- version 罗列start | 79 | -- version 罗列start |
54 | local versionList = {} -- version 列表 | 80 | local versionList = {} -- version 列表 |
55 | versionList[1] = {bugFixSuduku, {}} | 81 | versionList[1] = {bugFixSuduku, {}} |
82 | +versionList[2] = {bugFixRune, {}} | ||
83 | +versionList[3] = {bugFixAdvPlayer, {}} | ||
56 | -- versionList[2] = {clearActivity, {5, 7}} | 84 | -- versionList[2] = {clearActivity, {5, 7}} |
57 | -- versionList[3] = {changeStructF, "test1"} | 85 | -- versionList[3] = {changeStructF, "test1"} |
58 | -- versionList[4] = {changeStructF, "test2"} | 86 | -- versionList[4] = {changeStructF, "test2"} |
@@ -69,11 +97,11 @@ function RoleChangeStruct.bind(Role) | @@ -69,11 +97,11 @@ function RoleChangeStruct.bind(Role) | ||
69 | 97 | ||
70 | function Role:changeStructVersion() | 98 | function Role:changeStructVersion() |
71 | local curVersion = self:getProperty("sversion") | 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 | local jumpVersion = {} | 102 | local jumpVersion = {} |
75 | local versionTemp = {} | 103 | local versionTemp = {} |
76 | - for version = curVersion + 1, globalCsv.StructVersion do | 104 | + for version = curVersion + 1, STRUCT_VERSION do |
77 | local versionData = versionList[version] | 105 | local versionData = versionList[version] |
78 | if versionData then | 106 | if versionData then |
79 | if versionData[1].vType == VersionType.DoOnly then | 107 | if versionData[1].vType == VersionType.DoOnly then |
@@ -106,7 +134,7 @@ function RoleChangeStruct.bind(Role) | @@ -106,7 +134,7 @@ function RoleChangeStruct.bind(Role) | ||
106 | end | 134 | end |
107 | end | 135 | end |
108 | 136 | ||
109 | - for version = curVersion + 1, globalCsv.StructVersion do | 137 | + for version = curVersion + 1, STRUCT_VERSION do |
110 | if not jumpVersion[version] then | 138 | if not jumpVersion[version] then |
111 | local versionData = versionList[version] | 139 | local versionData = versionList[version] |
112 | if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then | 140 | if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then |
@@ -116,7 +144,7 @@ function RoleChangeStruct.bind(Role) | @@ -116,7 +144,7 @@ function RoleChangeStruct.bind(Role) | ||
116 | end | 144 | end |
117 | end | 145 | end |
118 | end | 146 | end |
119 | - self:setProperty("sversion", globalCsv.StructVersion) | 147 | + self:setProperty("sversion", STRUCT_VERSION) |
120 | end | 148 | end |
121 | 149 | ||
122 | end | 150 | end |
src/models/RoleLog.lua
@@ -51,6 +51,12 @@ local ItemReason = { | @@ -51,6 +51,12 @@ local ItemReason = { | ||
51 | actBattle = 135, -- 活动关卡 | 51 | actBattle = 135, -- 活动关卡 |
52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 | 52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 |
53 | worldBossReward = 137, -- 世界boss翻牌奖励 | 53 | worldBossReward = 137, -- 世界boss翻牌奖励 |
54 | + commonSign = 138, -- 每日活跃签到 | ||
55 | + actFriendHelp = 139,-- 好友能量互助活动 | ||
56 | + actBattleCommand = 140, -- 活动战令 | ||
57 | + actBuyBpLevel = 141, -- 购买活动战令等级 | ||
58 | + newSign = 142,-- 新的活动签到 | ||
59 | + advLevelStage = 143, -- 拾荒活动阶段奖励 | ||
54 | 60 | ||
55 | 61 | ||
56 | advHang = 301, -- 拾荒挂机 | 62 | advHang = 301, -- 拾荒挂机 |
@@ -92,6 +98,7 @@ local ItemReason = { | @@ -92,6 +98,7 @@ local ItemReason = { | ||
92 | actPaySign = 1008, -- 活动付费签到 | 98 | actPaySign = 1008, -- 活动付费签到 |
93 | calendaTask = 1009, -- 英雄帖 | 99 | calendaTask = 1009, -- 英雄帖 |
94 | actMilecrisis = 1010, -- 物资危机 | 100 | actMilecrisis = 1010, -- 物资危机 |
101 | + battleCommandTask = 1011, -- 将军令任务 | ||
95 | 102 | ||
96 | -- 餐厅 | 103 | -- 餐厅 |
97 | greenHourse = 1101, -- 食材获得 | 104 | greenHourse = 1101, -- 食材获得 |
@@ -122,6 +129,7 @@ local ItemReason = { | @@ -122,6 +129,7 @@ local ItemReason = { | ||
122 | 129 | ||
123 | -- pvp | 130 | -- pvp |
124 | pvpCHead = 1301, -- pvp 跨服竞技场头像 | 131 | pvpCHead = 1301, -- pvp 跨服竞技场头像 |
132 | + crossPvpBet = 1302, -- 竞猜 | ||
125 | 133 | ||
126 | --adv | 134 | --adv |
127 | chooseEvent = 1351, -- 冒险选择 | 135 | chooseEvent = 1351, -- 冒险选择 |
@@ -591,6 +599,7 @@ local LogType = { | @@ -591,6 +599,7 @@ local LogType = { | ||
591 | guide = "common", | 599 | guide = "common", |
592 | newdevice = "common", | 600 | newdevice = "common", |
593 | cbback = "common", | 601 | cbback = "common", |
602 | + cheat = "common", | ||
594 | 603 | ||
595 | in_item = "common", | 604 | in_item = "common", |
596 | out_item = "common", | 605 | out_item = "common", |
@@ -875,4 +884,4 @@ function RoleLog.bind(Role) | @@ -875,4 +884,4 @@ function RoleLog.bind(Role) | ||
875 | 884 | ||
876 | 885 | ||
877 | end | 886 | end |
878 | -return RoleLog | ||
879 | \ No newline at end of file | 887 | \ No newline at end of file |
888 | +return RoleLog |
src/models/RolePlugin.lua
@@ -131,7 +131,19 @@ function RolePlugin.bind(Role) | @@ -131,7 +131,19 @@ function RolePlugin.bind(Role) | ||
131 | self:addItem(pms) | 131 | self:addItem(pms) |
132 | end | 132 | end |
133 | end, | 133 | end, |
134 | + [ItemType.Potion] = function () | ||
135 | + self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log}) | ||
136 | + end, | ||
134 | } | 137 | } |
138 | + | ||
139 | + if count > 0 then | ||
140 | + local itemCfg = csvdb["itemCsv"][itemId] | ||
141 | + local itemType = 0 | ||
142 | + if itemCfg then | ||
143 | + itemType = itemCfg.type | ||
144 | + end | ||
145 | + self:checkTaskEnter("AddItem", {id = itemId, count = count, type = itemType}) | ||
146 | + end | ||
135 | -- 对数量筛查 | 147 | -- 对数量筛查 |
136 | count = checkItemCount(self, itemId, count) | 148 | count = checkItemCount(self, itemId, count) |
137 | if count ~= 0 then | 149 | if count ~= 0 then |
@@ -286,10 +298,41 @@ function RolePlugin.bind(Role) | @@ -286,10 +298,41 @@ function RolePlugin.bind(Role) | ||
286 | print("addPlayExp no log ", debug.traceback()) | 298 | print("addPlayExp no log ", debug.traceback()) |
287 | end | 299 | end |
288 | 300 | ||
289 | - self:updateProperties({level = level, exp = newExp}) | 301 | + self:updateProperties({level = level, exp = newExp}, params.notNotify) |
290 | self:changeCrossServerPvpSelfInfo("level") | 302 | self:changeCrossServerPvpSelfInfo("level") |
291 | end | 303 | end |
292 | 304 | ||
305 | + function Role:addPotion(params) | ||
306 | + dump(params) | ||
307 | + local pId = globalCsv.adv_item_potion[params.id] | ||
308 | + local potionBag = self:getProperty("potionBag") | ||
309 | + local origin = potionBag[pId] or 0 | ||
310 | + local nums = origin + params.count | ||
311 | + potionBag[pId] = nums | ||
312 | + | ||
313 | + self:logItems(params.id, origin, nums, params.log) | ||
314 | + if params.log then | ||
315 | + local log = clone(params.log) | ||
316 | + if log["cint1"] or log["cint2"] then | ||
317 | + print("addItem error log have cint1 or cint2 ", debug.traceback()) | ||
318 | + end | ||
319 | + log["cint1"] = params.id | ||
320 | + log["cint2"] = math.abs(params.count) | ||
321 | + if params.count <= 0 then | ||
322 | + self:mylog("out_item", log) | ||
323 | + else | ||
324 | + self:mylog("in_item", log) | ||
325 | + end | ||
326 | + else | ||
327 | + print("addItem no log ", debug.traceback()) | ||
328 | + end | ||
329 | + | ||
330 | + self:updateProperty({field = "potionBag", value = potionBag}) | ||
331 | + if not params.notNotify then | ||
332 | + SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.id] = params.count})) | ||
333 | + end | ||
334 | + end | ||
335 | + | ||
293 | function Role:addItem(params) | 336 | function Role:addItem(params) |
294 | params = params or {} | 337 | params = params or {} |
295 | params.count = math.floor(params.count or 0) | 338 | params.count = math.floor(params.count or 0) |
@@ -387,7 +430,7 @@ function RolePlugin.bind(Role) | @@ -387,7 +430,7 @@ function RolePlugin.bind(Role) | ||
387 | end | 430 | end |
388 | 431 | ||
389 | if update then | 432 | if update then |
390 | - self:updateProperty({field = "boxL", value = boxL}) | 433 | + self:updateProperty({field = "boxL", value = boxL, notNotify = pms.notNotify}) |
391 | end | 434 | end |
392 | end | 435 | end |
393 | 436 | ||
@@ -399,7 +442,8 @@ function RolePlugin.bind(Role) | @@ -399,7 +442,8 @@ function RolePlugin.bind(Role) | ||
399 | end | 442 | end |
400 | 443 | ||
401 | function Role:getAllDiamond() | 444 | function Role:getAllDiamond() |
402 | - return self:getProperty("diamond") + self:getProperty("reDiamond") | 445 | + local diamond = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") |
446 | + return self:getProperty("diamond") + diamond | ||
403 | end | 447 | end |
404 | 448 | ||
405 | function Role:gainDiamond(params) | 449 | function Role:gainDiamond(params) |
@@ -409,10 +453,14 @@ function RolePlugin.bind(Role) | @@ -409,10 +453,14 @@ function RolePlugin.bind(Role) | ||
409 | return false | 453 | return false |
410 | end | 454 | end |
411 | local origind = self:getProperty("diamond") | 455 | local origind = self:getProperty("diamond") |
412 | - local originr = self:getProperty("reDiamond") | 456 | + local originr = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") |
413 | local origin = origind + originr | 457 | local origin = origind + originr |
414 | if params.isRecharge then | 458 | if params.isRecharge then |
415 | - self:incrProperty("reDiamond", count) | 459 | + if params.sid == IOS_SID then |
460 | + self:incrProperty("reDiamondIos", count) | ||
461 | + else | ||
462 | + self:incrProperty("reDiamond", count) | ||
463 | + end | ||
416 | else | 464 | else |
417 | self:incrProperty("diamond", count) | 465 | self:incrProperty("diamond", count) |
418 | end | 466 | end |
@@ -443,8 +491,9 @@ function RolePlugin.bind(Role) | @@ -443,8 +491,9 @@ function RolePlugin.bind(Role) | ||
443 | if count <= 0 then | 491 | if count <= 0 then |
444 | return false | 492 | return false |
445 | end | 493 | end |
494 | + local isIos = self:getProperty("sid") == IOS_SID | ||
446 | local origind = self:getProperty("diamond") | 495 | local origind = self:getProperty("diamond") |
447 | - local originr = self:getProperty("reDiamond") | 496 | + local originr = isIos and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") |
448 | local origin = origind + originr | 497 | local origin = origind + originr |
449 | 498 | ||
450 | if origin < 0 then | 499 | if origin < 0 then |
@@ -454,9 +503,9 @@ function RolePlugin.bind(Role) | @@ -454,9 +503,9 @@ function RolePlugin.bind(Role) | ||
454 | return false | 503 | return false |
455 | end | 504 | end |
456 | local last = count | 505 | local last = count |
457 | - local costFirst = {"diamond", "reDiamond"} | 506 | + local costFirst = isIos and {"diamond", "reDiamondIos"} or {"diamond", "reDiamond"} |
458 | if params.isRecharge then | 507 | if params.isRecharge then |
459 | - costFirst = {"reDiamond", "diamond"} | 508 | + costFirst = isIos and {"reDiamondIos", "diamond"} or {"reDiamond", "diamond"} |
460 | end | 509 | end |
461 | last = math.max(last - self:getProperty(costFirst[1]), 0) | 510 | last = math.max(last - self:getProperty(costFirst[1]), 0) |
462 | if last < count then | 511 | if last < count then |
@@ -481,6 +530,8 @@ function RolePlugin.bind(Role) | @@ -481,6 +530,8 @@ function RolePlugin.bind(Role) | ||
481 | end | 530 | end |
482 | 531 | ||
483 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 532 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
533 | + | ||
534 | + self:checkTaskEnter("CostDiamond", {count = count}) | ||
484 | return true | 535 | return true |
485 | end | 536 | end |
486 | 537 | ||
@@ -804,9 +855,16 @@ function RolePlugin.bind(Role) | @@ -804,9 +855,16 @@ function RolePlugin.bind(Role) | ||
804 | return runeSet | 855 | return runeSet |
805 | end | 856 | end |
806 | 857 | ||
807 | - function Role:getAdvData() | 858 | + function Role:getAdvData(notNotify) |
808 | if not self.advData then | 859 | if not self.advData then |
809 | self.advData = require("adv.Adv").new(self) | 860 | self.advData = require("adv.Adv").new(self) |
861 | + local status, err = pcall(function() | ||
862 | + self.advData:initByInfo() | ||
863 | + end) | ||
864 | + if not status then | ||
865 | + self.advData:forceOver(notNotify, true) | ||
866 | + skynet.error("getAdvData error adv initByInfo " .. err) | ||
867 | + end | ||
810 | end | 868 | end |
811 | return self.advData | 869 | return self.advData |
812 | end | 870 | end |
@@ -830,7 +888,6 @@ function RolePlugin.bind(Role) | @@ -830,7 +888,6 @@ function RolePlugin.bind(Role) | ||
830 | self:setProperty("heartWarning", heartWarning) | 888 | self:setProperty("heartWarning", heartWarning) |
831 | if heartWarning == 50 then | 889 | if heartWarning == 50 then |
832 | self:setBan(30, 1) --封禁 30天 | 890 | self:setBan(30, 1) --封禁 30天 |
833 | - self:sendGmMsg("server_accountBanned_inGame_1") | ||
834 | return | 891 | return |
835 | end | 892 | end |
836 | if heartWarning < 50 and heartWarning % 5 == 0 then | 893 | if heartWarning < 50 and heartWarning % 5 == 0 then |
@@ -843,21 +900,52 @@ function RolePlugin.bind(Role) | @@ -843,21 +900,52 @@ function RolePlugin.bind(Role) | ||
843 | time = time or 0 | 900 | time = time or 0 |
844 | banType = banType or 0 | 901 | banType = banType or 0 |
845 | local now = skynet.timex() | 902 | local now = skynet.timex() |
846 | - if time == 0 then | 903 | + if time <= 0 then |
847 | self:setProperty("banTime", 0) | 904 | self:setProperty("banTime", 0) |
848 | self:setProperty("banType", 0) | 905 | self:setProperty("banType", 0) |
849 | self:setProperty("heartWarning", 0) | 906 | self:setProperty("heartWarning", 0) |
850 | - | ||
851 | self:mylog("role_action", {desc = "ban_rm"}) | 907 | self:mylog("role_action", {desc = "ban_rm"}) |
852 | else | 908 | else |
853 | - self:setProperty("banTime", now + 86400 * time) | 909 | + self:sendGmMsg(globalCsv.ban_tips[banType] or globalCsv.ban_tips[0]) |
910 | + self:setProperty("banTime", math.ceil(now + 86400 * time)) | ||
854 | self:setProperty("banType", banType) | 911 | self:setProperty("banType", banType) |
855 | - self:mylog("role_action", {desc = "ban", int1 = time, int2 = banType}) | 912 | + self:resetRank() |
913 | + self:mylog("role_action", {desc = "ban", int1 = math.ceil(time), int2 = banType}) | ||
856 | end | 914 | end |
857 | end | 915 | end |
858 | 916 | ||
917 | + -- 清掉所有排行榜 | ||
918 | + function Role:resetRank() | ||
919 | + local roleId = self:getProperty("id") | ||
920 | + redisproxy:pipelining(function (red) | ||
921 | + red:zrem(RANK_TOWER, roleId) | ||
922 | + for _, rk in pairs(RANK_ADV) do | ||
923 | + red:zrem(rk, roleId) | ||
924 | + end | ||
925 | + for _, rk in pairs(RANK_DINER) do | ||
926 | + red:zrem(rk, roleId) | ||
927 | + end | ||
928 | + for _, rk in pairs(RANK_PVP_COMMON_KEY) do | ||
929 | + red:zrem(rk, roleId) | ||
930 | + end | ||
931 | + for _, rk in pairs(RANK_PVP_HIGHT_KEY) do | ||
932 | + red:zrem(rk, roleId) | ||
933 | + end | ||
934 | + for _, ct in pairs(RANK_TYPE) do | ||
935 | + red:zrem(RANK_COMMON .. ct, roleId) | ||
936 | + end | ||
937 | + end) | ||
938 | + end | ||
939 | + | ||
859 | function Role:sendGmMsg(text, isNotKey) | 940 | function Role:sendGmMsg(text, isNotKey) |
860 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) | 941 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) |
942 | + | ||
943 | + local agent = datacenter.get("agent", self:getProperty("id")) | ||
944 | + if agent then | ||
945 | + skynet.timeout(50, function () | ||
946 | + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | ||
947 | + end) | ||
948 | + end | ||
861 | end | 949 | end |
862 | 950 | ||
863 | -- function Role:getHeroActiveRelationData(heros) | 951 | -- function Role:getHeroActiveRelationData(heros) |
@@ -1470,6 +1558,7 @@ function RolePlugin.bind(Role) | @@ -1470,6 +1558,7 @@ function RolePlugin.bind(Role) | ||
1470 | return function (now, role) | 1558 | return function (now, role) |
1471 | if name == "email" and role.sendMailFlag then | 1559 | if name == "email" and role.sendMailFlag then |
1472 | last_breath = now + sec | 1560 | last_breath = now + sec |
1561 | + role.sendMailFlag = false | ||
1473 | return true | 1562 | return true |
1474 | end | 1563 | end |
1475 | if now >= last_breath then | 1564 | if now >= last_breath then |
@@ -1505,8 +1594,15 @@ function RolePlugin.bind(Role) | @@ -1505,8 +1594,15 @@ function RolePlugin.bind(Role) | ||
1505 | end) | 1594 | end) |
1506 | for _, data in ipairs(redret) do | 1595 | for _, data in ipairs(redret) do |
1507 | local email = tarr2tab(data) | 1596 | local email = tarr2tab(data) |
1508 | - if tonum(email.createtime) > self:getProperty("ctime") | ||
1509 | - and ( not email.mid or tonum(email.mid) == mid ) | 1597 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 |
1598 | + local delayType = tonum(email.delayType) | ||
1599 | + local flag = false | ||
1600 | + if delayType == 1 then | ||
1601 | + flag = skynet.timex() > tonum(email.createtime) | ||
1602 | + else | ||
1603 | + flag = tonum(email.createtime) > self:getProperty("ctime") | ||
1604 | + end | ||
1605 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | ||
1510 | and ( not email.endtime or tonum(email.endtime) > now )then | 1606 | and ( not email.endtime or tonum(email.endtime) > now )then |
1511 | return true | 1607 | return true |
1512 | end | 1608 | end |
@@ -1543,7 +1639,6 @@ function RolePlugin.bind(Role) | @@ -1543,7 +1639,6 @@ function RolePlugin.bind(Role) | ||
1543 | if table.pack(next(newReward))[2] >= divisionData.limit then | 1639 | if table.pack(next(newReward))[2] >= divisionData.limit then |
1544 | return true | 1640 | return true |
1545 | end | 1641 | end |
1546 | - | ||
1547 | end | 1642 | end |
1548 | 1643 | ||
1549 | local events = {} | 1644 | local events = {} |
@@ -1596,8 +1691,34 @@ function RolePlugin.bind(Role) | @@ -1596,8 +1691,34 @@ function RolePlugin.bind(Role) | ||
1596 | self:updateProperty({field = "redp", value = redp}) | 1691 | self:updateProperty({field = "redp", value = redp}) |
1597 | end | 1692 | end |
1598 | 1693 | ||
1694 | + -- 网页支付获取订单号 | ||
1695 | + function Role:getPurchaseOrderByPlatform(params) | ||
1696 | + local checkPlatform = { | ||
1697 | + ["mycard"] = "mycard_product_id", | ||
1698 | + } | ||
1699 | + local pidField = checkPlatform[params.payMode or ""] | ||
1700 | + if not pidField or not params.product_id or params.product_id == "" then | ||
1701 | + return "no product" | ||
1702 | + end | ||
1703 | + | ||
1704 | + for k , v in pairs(csvdb["shop_rechargeCsv"]) do | ||
1705 | + if not v[pidField] then return "no product" end | ||
1706 | + if v[pidField] == params.product_id then | ||
1707 | + if v.twd * 100 ~= tonumber(params.money) then | ||
1708 | + return "error money" | ||
1709 | + end | ||
1710 | + -- 发现需要的id | ||
1711 | + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId) | ||
1712 | + if partnerOrderId == "" then | ||
1713 | + return "no product" | ||
1714 | + end | ||
1715 | + return json.encode({order = partnerOrderId}) | ||
1716 | + end | ||
1717 | + end | ||
1718 | + end | ||
1719 | + | ||
1599 | -- 获取充值订单号 | 1720 | -- 获取充值订单号 |
1600 | - function Role:getPurchaseOrder(rechargeId) | 1721 | + function Role:getPurchaseOrder(rechargeId, transactionId) |
1601 | local roleId = self:getProperty("id") | 1722 | local roleId = self:getProperty("id") |
1602 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | 1723 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
1603 | if not rechargeData then | 1724 | if not rechargeData then |
@@ -1634,6 +1755,8 @@ function RolePlugin.bind(Role) | @@ -1634,6 +1755,8 @@ function RolePlugin.bind(Role) | ||
1634 | order = partnerOrderId, | 1755 | order = partnerOrderId, |
1635 | rechargeId = rechargeId, | 1756 | rechargeId = rechargeId, |
1636 | createTime = skynet.timex(), | 1757 | createTime = skynet.timex(), |
1758 | + transactionId = transactionId, | ||
1759 | + sid = role:getProperty("sid"), | ||
1637 | }) | 1760 | }) |
1638 | order:create() | 1761 | order:create() |
1639 | -- 正在进行中的订单 缓存 | 1762 | -- 正在进行中的订单 缓存 |
@@ -1664,8 +1787,12 @@ function RolePlugin.bind(Role) | @@ -1664,8 +1787,12 @@ function RolePlugin.bind(Role) | ||
1664 | 1787 | ||
1665 | local rechargeId = orderObject:getProperty("rechargeId") | 1788 | local rechargeId = orderObject:getProperty("rechargeId") |
1666 | local dataSet = csvdb["shop_rechargeCsv"][rechargeId] | 1789 | local dataSet = csvdb["shop_rechargeCsv"][rechargeId] |
1790 | + local sid = orderObject:getProperty("sid") | ||
1667 | 1791 | ||
1668 | if orderObject:getProperty("finishTime") > 0 then | 1792 | if orderObject:getProperty("finishTime") > 0 then |
1793 | + skynet.error(string.format("[recharge] is a finish order cpOrder: %s, platformOrder : %s, hadPlatformOrder: %s, id: %s, overTime : %s", | ||
1794 | + partnerOrderStr, platformOrder, orderObject:getProperty("transactionId"), rechargeId, orderObject:getProperty("finishTime") | ||
1795 | + )) | ||
1669 | return false, "finsh" | 1796 | return false, "finsh" |
1670 | end | 1797 | end |
1671 | 1798 | ||
@@ -1698,24 +1825,25 @@ function RolePlugin.bind(Role) | @@ -1698,24 +1825,25 @@ function RolePlugin.bind(Role) | ||
1698 | }) | 1825 | }) |
1699 | end | 1826 | end |
1700 | 1827 | ||
1701 | - return true, rechargeId | 1828 | + return true, rechargeId, sid |
1702 | end | 1829 | end |
1703 | 1830 | ||
1704 | -- 充值 -- | 1831 | -- 充值 -- |
1705 | --[[ | 1832 | --[[ |
1706 | request.order = data.out_trade_no | 1833 | request.order = data.out_trade_no |
1707 | - request.amount = data.money / 100 | 1834 | + request.amount = data.money |
1708 | request.game_money = data.game_money | 1835 | request.game_money = data.game_money |
1709 | request.product_id = data.product_id | 1836 | request.product_id = data.product_id |
1710 | request.pay_time = data.pay_time | 1837 | request.pay_time = data.pay_time |
1711 | request.transactionId = data.order_no | 1838 | request.transactionId = data.order_no |
1839 | + request.extension_info = data.extension_info | ||
1840 | + request.is_mycard = 1 | ||
1712 | ]] | 1841 | ]] |
1713 | function Role:handlePurchase(params) | 1842 | function Role:handlePurchase(params) |
1714 | local roleId = self:getProperty("id") | 1843 | local roleId = self:getProperty("id") |
1715 | local partnerOrderStr = params.order | 1844 | local partnerOrderStr = params.order |
1716 | 1845 | ||
1717 | - | ||
1718 | - local status, back = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") | 1846 | + local status, back, sid = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") |
1719 | if not status then | 1847 | if not status then |
1720 | if back == "finsh" then | 1848 | if back == "finsh" then |
1721 | -- 订单已经处理 | 1849 | -- 订单已经处理 |
@@ -1725,7 +1853,7 @@ function RolePlugin.bind(Role) | @@ -1725,7 +1853,7 @@ function RolePlugin.bind(Role) | ||
1725 | end | 1853 | end |
1726 | local rechargeId = back | 1854 | local rechargeId = back |
1727 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | 1855 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
1728 | - if rechargeData.rmb ~= tonumber(params.amount) then | 1856 | + if (params.is_mycard and rechargeData.twd * 100 ~= tonumber(params.amount)) or (not params.is_mycard and rechargeData.rmb * 100 ~= tonumber(params.amount)) then |
1729 | skynet.error(string.format("[recharge] fake order: %s, roleId: %d, order: %s, rmb %s, get %s", | 1857 | skynet.error(string.format("[recharge] fake order: %s, roleId: %d, order: %s, rmb %s, get %s", |
1730 | params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount | 1858 | params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount |
1731 | )) | 1859 | )) |
@@ -1737,9 +1865,13 @@ function RolePlugin.bind(Role) | @@ -1737,9 +1865,13 @@ function RolePlugin.bind(Role) | ||
1737 | transactionId = params.transactionId, | 1865 | transactionId = params.transactionId, |
1738 | pay_time = params.pay_time, | 1866 | pay_time = params.pay_time, |
1739 | order = partnerOrderStr, | 1867 | order = partnerOrderStr, |
1868 | + sid = sid, | ||
1740 | }) | 1869 | }) |
1741 | 1870 | ||
1742 | if not status then | 1871 | if not status then |
1872 | + if params.extension_info == "mycard_web" then | ||
1873 | + self:sendMail(MailId.MyCardBuy, nil, nil, {rechargeId}) | ||
1874 | + end | ||
1743 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, | 1875 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, |
1744 | result = "success", reward = reward})) | 1876 | result = "success", reward = reward})) |
1745 | end | 1877 | end |
@@ -1770,10 +1902,10 @@ function RolePlugin.bind(Role) | @@ -1770,10 +1902,10 @@ function RolePlugin.bind(Role) | ||
1770 | rechargeF[id] = 1 | 1902 | rechargeF[id] = 1 |
1771 | self:updateProperty({field = "rechargeF", value = rechargeF}) | 1903 | self:updateProperty({field = "rechargeF", value = rechargeF}) |
1772 | end | 1904 | end |
1773 | - self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1905 | + self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) |
1774 | elseif rechargeData.shop == 2 then --通行证商店 | 1906 | elseif rechargeData.shop == 2 then --通行证商店 |
1775 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1907 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1776 | - self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id) | 1908 | + self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) |
1777 | elseif rechargeData.shop == 3 then -- 礼包商店 | 1909 | elseif rechargeData.shop == 3 then -- 礼包商店 |
1778 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1910 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1779 | else | 1911 | else |
@@ -2013,6 +2145,15 @@ function RolePlugin.bind(Role) | @@ -2013,6 +2145,15 @@ function RolePlugin.bind(Role) | ||
2013 | return {list = list, rank = rank} | 2145 | return {list = list, rank = rank} |
2014 | end | 2146 | end |
2015 | 2147 | ||
2148 | + function Role:addHeroFaith(heroId, exp) | ||
2149 | + local hero = self.heros[heroId] | ||
2150 | + if not hero then | ||
2151 | + return | ||
2152 | + end | ||
2153 | + | ||
2154 | + hero:addHeroFaith(exp) | ||
2155 | + return hero:getProperty("faith") | ||
2156 | + end | ||
2016 | 2157 | ||
2017 | end | 2158 | end |
2018 | 2159 |
src/models/RolePvp.lua
@@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 | @@ -9,7 +9,7 @@ local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 | ||
9 | local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分 | 9 | local PVP_RANK_BASE_SCORE = globalCsv.pvp_base_score -- 初始积分 |
10 | 10 | ||
11 | -- 匹配规则改为以排名来匹配 | 11 | -- 匹配规则改为以排名来匹配 |
12 | -local PVP_GET_ROBOT_SCORE = 2400 -- 2400分以下低档位匹配机器人 | 12 | +local PVP_GET_ROBOT_SCORE = 1300 -- 1300分以下低档位匹配机器人 |
13 | local PRE_RANGE_COUNT = 20 -- 每个档位人数 | 13 | local PRE_RANGE_COUNT = 20 -- 每个档位人数 |
14 | local NEED_MATCH = 3 --匹配到多少人 | 14 | local NEED_MATCH = 3 --匹配到多少人 |
15 | 15 | ||
@@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin) | @@ -73,7 +73,7 @@ function Role:changePvpScoreCommon(matchId, isWin) | ||
73 | if isWin then | 73 | if isWin then |
74 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400))) | 74 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((myScore - matchScore) / 400))) |
75 | myScore = myScore + scoreChange | 75 | myScore = myScore + scoreChange |
76 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | 76 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 |
77 | else | 77 | else |
78 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400))) | 78 | local scoreChange = math.ceil(60 / (1 + 10 ^ ((matchScore - myScore) / 400))) |
79 | myScore = myScore - scoreChange | 79 | myScore = myScore - scoreChange |
@@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin) | @@ -139,7 +139,7 @@ function Role:changePvpScoreHigh(matchId, isWin) | ||
139 | if isWin then | 139 | if isWin then |
140 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000))) | 140 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((myScore - matchScore) / 1000))) |
141 | myScore = myScore + scoreChange | 141 | myScore = myScore + scoreChange |
142 | - matchScore = matchScore - math.ceil(scoreChange / 3) -- 防守方失败时,扣分减为原来的1/3 | 142 | + matchScore = matchScore - math.ceil(scoreChange / 3 * 2) -- 防守方失败时,扣分减为原来的2/3 |
143 | else | 143 | else |
144 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000))) | 144 | local scoreChange = math.ceil(50 / (1 + 10 ^ ((matchScore - myScore) / 1000))) |
145 | myScore = myScore - scoreChange | 145 | myScore = myScore - scoreChange |
@@ -521,7 +521,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) | @@ -521,7 +521,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) | ||
521 | change[cType] = self:getProperty(cType) | 521 | change[cType] = self:getProperty(cType) |
522 | elseif cType == "format" then | 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 | local aday = 3600 * 24 | 525 | local aday = 3600 * 24 |
526 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 | 526 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
527 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | 527 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 |
@@ -530,7 +530,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) | @@ -530,7 +530,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) | ||
530 | return | 530 | return |
531 | end | 531 | end |
532 | change.battleV = self:getProperty("pvpTBVH") | 532 | change.battleV = self:getProperty("pvpTBVH") |
533 | - change.heros = self:getProperty("pvpTSH") | 533 | + change.team = self:getProperty("pvpTSH") |
534 | change.battleInfo = self:getProperty("pvpTBH") | 534 | change.battleInfo = self:getProperty("pvpTBH") |
535 | end | 535 | end |
536 | 536 | ||
@@ -615,7 +615,7 @@ end | @@ -615,7 +615,7 @@ end | ||
615 | 615 | ||
616 | function Role:setCrossServerPvpBet(idx) | 616 | function Role:setCrossServerPvpBet(idx) |
617 | if not self:isTimeResetOpen(TimeReset.PvpCross) then return false , 1 end | 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 | local aday = 3600 * 24 | 619 | local aday = 3600 * 24 |
620 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 | 620 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
621 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | 621 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 |
src/models/RoleTask.lua
@@ -15,6 +15,8 @@ local TaskType = { | @@ -15,6 +15,8 @@ local TaskType = { | ||
15 | HeroLvlCollect = 10, -- 英雄等级收集进度 | 15 | HeroLvlCollect = 10, -- 英雄等级收集进度 |
16 | HeroQualityCollect = 11, -- 英雄品质收集进度 | 16 | HeroQualityCollect = 11, -- 英雄品质收集进度 |
17 | HeroStarCollect = 12, -- 英雄星级收集进度 | 17 | HeroStarCollect = 12, -- 英雄星级收集进度 |
18 | + DrawHeroNotFriend = 13, -- 非友情招募 -- count | ||
19 | + DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count | ||
18 | 20 | ||
19 | --装备相关 | 21 | --装备相关 |
20 | AddEquip = 101, -- 获得装备 - equipId rarity | 22 | AddEquip = 101, -- 获得装备 - equipId rarity |
@@ -34,6 +36,7 @@ local TaskType = { | @@ -34,6 +36,7 @@ local TaskType = { | ||
34 | HangBattle = 304, -- 挂机战斗 - id | 36 | HangBattle = 304, -- 挂机战斗 - id |
35 | HangGetGold = 305, -- 挂机获得齿轮 - count | 37 | HangGetGold = 305, -- 挂机获得齿轮 - count |
36 | BonusPass = 306, -- 奖励副本通关 - id count | 38 | BonusPass = 306, -- 奖励副本通关 - id count |
39 | + BonusQuick = 307, -- 奖励关卡扫荡 -- id count | ||
37 | 40 | ||
38 | -- 冒险相关 | 41 | -- 冒险相关 |
39 | AdvPass = 401, -- 冒险通过关 - id level score | 42 | AdvPass = 401, -- 冒险通过关 - id level score |
@@ -50,6 +53,13 @@ local TaskType = { | @@ -50,6 +53,13 @@ local TaskType = { | ||
50 | AdvHang = 412, -- 代理拾荒次数 | 53 | AdvHang = 412, -- 代理拾荒次数 |
51 | AdvMineKill = 413, -- 宝藏怪击杀 | 54 | AdvMineKill = 413, -- 宝藏怪击杀 |
52 | AdvMineLayer = 414, -- 宝藏洞激活 | 55 | AdvMineLayer = 414, -- 宝藏洞激活 |
56 | + AdvKillBoss = 415, -- 拾荒击杀boss | ||
57 | + AdvHangHeroCnt = 416, -- 拾荒人数 | ||
58 | + AdvCostPower = 417, -- 消耗体力 | ||
59 | + AdvPassFirst = 418, -- 冒险首次通关 - id | ||
60 | + AdvUseItem = 419, -- 使用道具 - itemId count | ||
61 | + AdvBuild = 420, -- 建筑交互 - buildId | ||
62 | + AdvKill = 421, -- 拾荒击败敌人 | ||
53 | 63 | ||
54 | --爬塔相关 | 64 | --爬塔相关 |
55 | TowerPass = 501, -- 爬塔通关 - level | 65 | TowerPass = 501, -- 爬塔通关 - level |
@@ -91,6 +101,14 @@ local TaskType = { | @@ -91,6 +101,14 @@ local TaskType = { | ||
91 | SignIn = 901, -- 签到 | 101 | SignIn = 901, -- 签到 |
92 | Pay = 902, -- 充值 | 102 | Pay = 902, -- 充值 |
93 | ShopAll = 903, -- 在任意商店购买 | 103 | ShopAll = 903, -- 在任意商店购买 |
104 | + DailyTask = 904, -- 完成每日活跃任务 | ||
105 | + RadioTaskStart = 905, -- 电台任务开始 | ||
106 | + FinishSpeTask = 906, -- 指定任务完成 | ||
107 | + AddItem = 907, -- 获得道具 | ||
108 | + Login = 908, -- 登入 | ||
109 | + CostDiamond = 909, -- 消耗钻石 | ||
110 | + WeekTask = 910, -- 完成每周活跃任务 | ||
111 | + ActBattlePass = 911, -- 活动关卡通关 -- chapterId | ||
94 | 112 | ||
95 | --功能未实现 todo | 113 | --功能未实现 todo |
96 | AdvShop = 1002, -- 冒险商城 | 114 | AdvShop = 1002, -- 冒险商城 |
@@ -231,6 +249,8 @@ local ActivityListener = { | @@ -231,6 +249,8 @@ local ActivityListener = { | ||
231 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | 249 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
232 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, | 250 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
233 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, | 251 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
252 | + [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, | ||
253 | + [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, | ||
234 | } | 254 | } |
235 | } | 255 | } |
236 | 256 | ||
@@ -240,8 +260,9 @@ local StoreListener = { | @@ -240,8 +260,9 @@ local StoreListener = { | ||
240 | [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}}, | 260 | [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}}, |
241 | [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}}, | 261 | [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}}, |
242 | [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}}, | 262 | [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}}, |
243 | - [TaskType.AdvPass] = {{TriggerEventType.AdvPass, f("id")}}, | 263 | + [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}}, |
244 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, | 264 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, |
265 | + [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}}, | ||
245 | } | 266 | } |
246 | } | 267 | } |
247 | 268 | ||
@@ -253,7 +274,7 @@ local CalendaTaskListener = { | @@ -253,7 +274,7 @@ local CalendaTaskListener = { | ||
253 | [TaskType.AdvStart]= {{3, 1}}, | 274 | [TaskType.AdvStart]= {{3, 1}}, |
254 | [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, | 275 | [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, |
255 | [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 | 276 | [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 |
256 | - [TaskType.AdvHang]= {{6, 1}}, ---- | 277 | + [TaskType.AdvHang]= {{6, 3, f("actid")}}, ---- |
257 | [TaskType.HeroQualityCollect]= {{7, 3}}, | 278 | [TaskType.HeroQualityCollect]= {{7, 3}}, |
258 | [TaskType.OverOderTask]= {{8, 1}}, | 279 | [TaskType.OverOderTask]= {{8, 1}}, |
259 | [TaskType.VillageApply]= {{9, 1}}, | 280 | [TaskType.VillageApply]= {{9, 1}}, |
@@ -268,9 +289,35 @@ local CalendaTaskListener = { | @@ -268,9 +289,35 @@ local CalendaTaskListener = { | ||
268 | [TaskType.HangGet]= {{18, 3, f("reward")}}, | 289 | [TaskType.HangGet]= {{18, 3, f("reward")}}, |
269 | [TaskType.RuneQualityCollect]= {{19, 3}}, | 290 | [TaskType.RuneQualityCollect]= {{19, 3}}, |
270 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, | 291 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, |
292 | + [TaskType.RadioTaskStart] = {{21, 1}, {22, 3, f("heroCnt")}}, | ||
293 | + [TaskType.BonusQuick] = {{23, 1, f("count")}}, | ||
294 | + [TaskType.AdvHangHeroCnt] = {{24, 3, f("count")}}, | ||
295 | + [TaskType.AdvKillBoss] = {{25, 1}}, | ||
296 | + [TaskType.AdvMineKill] = {{26, 1}}, | ||
297 | + [TaskType.PvpBattle] = {{27, 1}}, | ||
298 | + [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}}, | ||
299 | + [TaskType.Login] = {{29, 1}}, | ||
300 | + [TaskType.DailyTask] = {{30, 2, f("cur")}}, | ||
301 | + [TaskType.WeekTask] = {{31, 2, f("cur")}}, | ||
302 | + [TaskType.MakeFood] = {{32, 1, f("count")}}, | ||
303 | + [TaskType.AddItem] = {{33, 3, f("type"), f("count")}, {42, 3, f("id"), f("count")}}, | ||
304 | + [TaskType.CostDiamond] = {{34, 1, f("count")}}, | ||
305 | + [TaskType.DrawHeroNotFriend] = {{35, 1, f("count")}}, | ||
306 | + [TaskType.AdvCostPower] = {{36, 1, f("count")}}, | ||
307 | + | ||
308 | + [TaskType.AdvUseItem] = {{37, 3, f("itemId"), f("count")}}, | ||
309 | + [TaskType.AdvBuild] = {{38, 3, f("buildId")}}, | ||
310 | + [TaskType.AdvKill] = {{39, 1, f("chapterId")}}, | ||
311 | + [TaskType.ActBattlePass] = {{40, 3, f("chapterId")}}, | ||
312 | + [TaskType.AdvPass] = {{41, 3, f("id")}}, | ||
271 | } | 313 | } |
272 | } | 314 | } |
273 | 315 | ||
316 | +local BattleCommandTaskListener = { | ||
317 | + func = "checkBattleCommandTask", | ||
318 | + listen = CalendaTaskListener["listen"] | ||
319 | +} | ||
320 | + | ||
274 | local TaskListeners = { | 321 | local TaskListeners = { |
275 | StoryListener, | 322 | StoryListener, |
276 | CommonListener, | 323 | CommonListener, |
@@ -279,6 +326,7 @@ local TaskListeners = { | @@ -279,6 +326,7 @@ local TaskListeners = { | ||
279 | ActivityListener, | 326 | ActivityListener, |
280 | StoreListener, | 327 | StoreListener, |
281 | CalendaTaskListener, | 328 | CalendaTaskListener, |
329 | + BattleCommandTaskListener, | ||
282 | } | 330 | } |
283 | 331 | ||
284 | local RoleTask = {} | 332 | local RoleTask = {} |
@@ -606,16 +654,8 @@ function RoleTask.bind(Role) | @@ -606,16 +654,8 @@ function RoleTask.bind(Role) | ||
606 | self.storeData:OnTriggerLimitTimePack(triggerType, param) | 654 | self.storeData:OnTriggerLimitTimePack(triggerType, param) |
607 | end | 655 | end |
608 | 656 | ||
609 | - function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) | ||
610 | - --print("check calenda taskl", mainType, subType, param1, param2) | ||
611 | - if not self.activity then return end | ||
612 | - local open, actId = self.activity:isOpen("CalendaTask") | ||
613 | - local actData = csvdb["activity_ctrlCsv"][actId] | ||
614 | - if not actData then return end | ||
615 | - if not open then return end | ||
616 | - | ||
617 | - local change = false | ||
618 | - local calTask = self:getProperty("calTask") or {} | 657 | + function Role:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) |
658 | + local calTask = self:getProperty(keyName) or {} | ||
619 | param1 = param1 or 1 | 659 | param1 = param1 or 1 |
620 | 660 | ||
621 | local cid = actData.condition | 661 | local cid = actData.condition |
@@ -690,7 +730,7 @@ function RoleTask.bind(Role) | @@ -690,7 +730,7 @@ function RoleTask.bind(Role) | ||
690 | calTask[id] = count | 730 | calTask[id] = count |
691 | elseif cfg.type == 20 then -- 开启x品质时钟箱子 | 731 | elseif cfg.type == 20 then -- 开启x品质时钟箱子 |
692 | if cfg.condition2 <= (param2 or 0) then | 732 | if cfg.condition2 <= (param2 or 0) then |
693 | - calTask[id] = (calTask[id] or 0) + param2 | 733 | + calTask[id] = (calTask[id] or 0) + param1 |
694 | end | 734 | end |
695 | elseif cfg.type == 15 then -- 通关关卡 | 735 | elseif cfg.type == 15 then -- 通关关卡 |
696 | if (calTask[id] or 0) == 0 then | 736 | if (calTask[id] or 0) == 0 then |
@@ -700,16 +740,90 @@ function RoleTask.bind(Role) | @@ -700,16 +740,90 @@ function RoleTask.bind(Role) | ||
700 | calTask[id] = 1 | 740 | calTask[id] = 1 |
701 | end | 741 | end |
702 | end | 742 | end |
743 | + elseif cfg.type == 22 then -- 电台任务出勤人数 | ||
744 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | ||
745 | + elseif cfg.type == 24 then -- 代理拾荒出勤人数 | ||
746 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | ||
747 | + elseif cfg.type == 28 then -- 完成指定任务 | ||
748 | + --print(actId,param2, cfg.condition2, param1) | ||
749 | + if actData.id == param2 and cfg.condition2 == param1 then | ||
750 | + calTask[id] = (calTask[id] or 0) + 1 | ||
751 | + end | ||
752 | + elseif cfg.type == 33 then -- 获得指定类型道具多少个 | ||
753 | + if cfg.condition2 == param1 then | ||
754 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | ||
755 | + end | ||
756 | + elseif cfg.type == 42 then -- 获得指定id道具多少个 | ||
757 | + if cfg.condition2 == param1 then | ||
758 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | ||
759 | + end | ||
760 | + elseif cfg.type == 6 then -- 代理拾荒次数 | ||
761 | + if cfg.condition2 == 0 or (cfg.condition2 == 1 and param1) then | ||
762 | + calTask[id] = (calTask[id] or 0) + 1 | ||
763 | + end | ||
764 | + elseif cfg.type == 37 then -- 拾荒使用道具 | ||
765 | + if cfg.condition2 == param1 then | ||
766 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | ||
767 | + end | ||
768 | + elseif cfg.type == 38 then -- 和指定建筑交互 | ||
769 | + local condArr = cfg.condition3:toArray(true, "=") | ||
770 | + for i = 0, #condArr do | ||
771 | + if condArr[i] == param1 then | ||
772 | + calTask[id] = (calTask[id] or 0) + 1 | ||
773 | + break | ||
774 | + end | ||
775 | + end | ||
776 | + elseif cfg.type == 39 then -- 拾荒特定章节消灭敌人 | ||
777 | + local condArr = cfg.condition3:toArray(true, "=") | ||
778 | + for i = 0, #condArr do | ||
779 | + if condArr[i] == param1 then | ||
780 | + calTask[id] = (calTask[id] or 0) + 1 | ||
781 | + break | ||
782 | + end | ||
783 | + end | ||
784 | + elseif cfg.type == 40 then -- 指定活动关卡通关 | ||
785 | + if cfg.condition2 == param1 then | ||
786 | + calTask[id] = (calTask[id] or 0) + 1 | ||
787 | + end | ||
788 | + elseif cfg.type == 41 then -- 通关拾荒指定关卡 | ||
789 | + if cfg.condition2 == param1 then | ||
790 | + calTask[id] = (calTask[id] or 0) + 1 | ||
791 | + end | ||
703 | end | 792 | end |
704 | end | 793 | end |
705 | end | 794 | end |
706 | end | 795 | end |
707 | end | 796 | end |
708 | end | 797 | end |
709 | - self:updateProperty({field = "calTask", value = calTask, notNotify = notNotify}) | ||
710 | - --dump(calTask) | 798 | + self:updateProperty({field = keyName, value = calTask, notNotify = notNotify}) |
799 | + end | ||
800 | + | ||
801 | + function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) | ||
802 | + --print("check calenda task", mainType, subType, param1, param2) | ||
803 | + local actEnum = "CalendaTask" | ||
804 | + local keyName = "calTask" | ||
805 | + if not self.activity then return end | ||
806 | + local open, actId = self.activity:isOpen(actEnum) | ||
807 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
808 | + if not actData then return end | ||
809 | + if not open then return end | ||
810 | + | ||
811 | + self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | ||
812 | + end | ||
813 | + | ||
814 | + function Role:checkBattleCommandTask(notNotify, mainType, subType, param1, param2) | ||
815 | + --print("check battle command task", mainType, subType, param1, param2) | ||
816 | + local actEnum = "BattleCommandTask" | ||
817 | + local keyName = "bcTask" | ||
818 | + if not self.activity then return end | ||
819 | + local open, actId = self.activity:isOpen(actEnum) | ||
820 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
821 | + if not actData then return end | ||
822 | + if not open then return end | ||
823 | + | ||
824 | + self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | ||
711 | end | 825 | end |
712 | 826 | ||
713 | end | 827 | end |
714 | 828 | ||
715 | -return RoleTask | ||
716 | \ No newline at end of file | 829 | \ No newline at end of file |
830 | +return RoleTask |
src/models/RoleTimeReset.lua
@@ -5,6 +5,7 @@ RoleTimeReset.bind = function (Role) | @@ -5,6 +5,7 @@ RoleTimeReset.bind = function (Role) | ||
5 | -- 重置内容 对应 GlobalVar TimeReset | 5 | -- 重置内容 对应 GlobalVar TimeReset |
6 | local ResetFunc = {} | 6 | local ResetFunc = {} |
7 | ResetFunc["CrossDay"] = function(self, notify, response, now) | 7 | ResetFunc["CrossDay"] = function(self, notify, response, now) |
8 | + self:setProperty("dTask", {}) | ||
8 | self.activity:checkActivityStatus(now, true, notify) | 9 | self.activity:checkActivityStatus(now, true, notify) |
9 | 10 | ||
10 | self.dailyData:refreshDailyData(notify) | 11 | self.dailyData:refreshDailyData(notify) |
@@ -12,7 +13,6 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) | @@ -12,7 +13,6 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) | ||
12 | self.activity:refreshDailyData(notify) | 13 | self.activity:refreshDailyData(notify) |
13 | self.storeData:onCrossDay() | 14 | self.storeData:onCrossDay() |
14 | 15 | ||
15 | - self:setProperty("dTask", {}) | ||
16 | self:incrProperty("lday", 1) | 16 | self:incrProperty("lday", 1) |
17 | self:advRandomSupportEffect(not notify) | 17 | self:advRandomSupportEffect(not notify) |
18 | 18 | ||
@@ -23,6 +23,11 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) | @@ -23,6 +23,11 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) | ||
23 | end | 23 | end |
24 | self:setProperty("advMine", advMine) | 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 | response.dTask = {} | 31 | response.dTask = {} |
27 | response.advSup = self:getProperty("advSup") | 32 | response.advSup = self:getProperty("advSup") |
28 | self:log("onLogin") | 33 | self:log("onLogin") |
@@ -41,13 +46,8 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | @@ -41,13 +46,8 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | ||
41 | 46 | ||
42 | response.wTask = {} | 47 | response.wTask = {} |
43 | response.dinerS = {} | 48 | response.dinerS = {} |
44 | -end | ||
45 | 49 | ||
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 | 50 | + self.activity:refreshWeekData(notify) |
51 | end | 51 | end |
52 | 52 | ||
53 | 53 | ||
@@ -84,18 +84,19 @@ function Role:updateTimeReset(now, notify) | @@ -84,18 +84,19 @@ function Role:updateTimeReset(now, notify) | ||
84 | local resetMode = {} | 84 | local resetMode = {} |
85 | 85 | ||
86 | local response = {} | 86 | local response = {} |
87 | - for funcName, resetId in pairs(TimeReset) do | ||
88 | - if needResetId[resetId] and ResetFunc[funcName] then | ||
89 | - ResetFunc[funcName](self, notify, response, now) | ||
90 | - resetMode[funcName] = true | ||
91 | - end | ||
92 | - if needResetId[resetId] then | ||
93 | - -- 充值商城购买记录 | ||
94 | - self.storeData:resetStoreReored(resetId) | 87 | + for idx = 1, #TimeResetArray do |
88 | + local funcName = TimeResetArray[idx] | ||
89 | + local resetId = TimeReset[funcName] | ||
90 | + if resetId then | ||
91 | + if needResetId[resetId] and ResetFunc[funcName] then | ||
92 | + ResetFunc[funcName](self, notify, response, now) | ||
93 | + resetMode[funcName] = true | ||
94 | + end | ||
95 | end | 95 | end |
96 | end | 96 | end |
97 | 97 | ||
98 | for resetId, round in pairs(needResetId) do | 98 | for resetId, round in pairs(needResetId) do |
99 | + self.storeData:resetStoreReored(resetId) | ||
99 | timeReset[resetId] = round | 100 | timeReset[resetId] = round |
100 | end | 101 | end |
101 | self:setProperties({timeReset = timeReset, ltime = now}) | 102 | self:setProperties({timeReset = timeReset, ltime = now}) |
src/models/Store.lua
@@ -186,7 +186,7 @@ end | @@ -186,7 +186,7 @@ end | ||
186 | 186 | ||
187 | 187 | ||
188 | -- 购买通行证 | 188 | -- 购买通行证 |
189 | -function Store:onBuyCard(type, duration, id) | 189 | +function Store:onBuyCard(type, duration, id, actid) |
190 | local timeNow = skynet.timex() | 190 | local timeNow = skynet.timex() |
191 | if type == CardType.NormalMonthCard then | 191 | if type == CardType.NormalMonthCard then |
192 | if self:isMonthCardExpire() then | 192 | if self:isMonthCardExpire() then |
@@ -221,6 +221,18 @@ function Store:onBuyCard(type, duration, id) | @@ -221,6 +221,18 @@ function Store:onBuyCard(type, duration, id) | ||
221 | info["flag"] = 1 | 221 | info["flag"] = 1 |
222 | bpInfo[index] = info | 222 | bpInfo[index] = info |
223 | self:updateProperty({field = "bpInfo", value = bpInfo}) | 223 | self:updateProperty({field = "bpInfo", value = bpInfo}) |
224 | + elseif type == CardType.ActBattleCommandCard then | ||
225 | + if not self.owner.activity:isOpenById(actid, "ActShopGoods") then | ||
226 | + return | ||
227 | + end | ||
228 | + local actCfg = csvdb["activity_ctrlCsv"][actid] | ||
229 | + if not actCfg then return end | ||
230 | + local actData = self.owner.activity:getActData("BattleCommand") or {} | ||
231 | + actData["unlock"] = 1 | ||
232 | + if actCfg.condition ~= 0 then | ||
233 | + actData["lvl"] = (actData["lvl"] or 0) + actCfg.condition | ||
234 | + end | ||
235 | + self.owner.activity:updateActData("BattleCommand", actData) | ||
224 | end | 236 | end |
225 | end | 237 | end |
226 | 238 | ||
@@ -363,6 +375,14 @@ function Store:OnTriggerLimitTimePack(eventType, param) | @@ -363,6 +375,14 @@ function Store:OnTriggerLimitTimePack(eventType, param) | ||
363 | gift_id = rechargeCfg.id, --礼包ID | 375 | gift_id = rechargeCfg.id, --礼包ID |
364 | gift_name = rechargeCfg.title, --礼包名称 | 376 | gift_name = rechargeCfg.title, --礼包名称 |
365 | }) | 377 | }) |
378 | + -- 每日抽卡限时礼包 触发重置 | ||
379 | + if eventType == TriggerEventType.DrawHeroCnt then | ||
380 | + local payR = self:getProperty("payR") | ||
381 | + if payR[rechargeCfg.id] then | ||
382 | + payR[rechargeCfg.id] = nil | ||
383 | + self:updateProperty({field = "payR", value = payR}) | ||
384 | + end | ||
385 | + end | ||
366 | self:updateProperty({field = "limitTPack", value = limitPack}) | 386 | self:updateProperty({field = "limitTPack", value = limitPack}) |
367 | end | 387 | end |
368 | end | 388 | end |
src/services/globald.lua
@@ -69,7 +69,8 @@ local function mailQuene() | @@ -69,7 +69,8 @@ local function mailQuene() | ||
69 | "attachments", email.attachments, | 69 | "attachments", email.attachments, |
70 | "endtime", email.endTime, | 70 | "endtime", email.endTime, |
71 | "mid", email.mid, | 71 | "mid", email.mid, |
72 | - "timestamp", now | 72 | + "timestamp", now, |
73 | + "delayType", email.delayType | ||
73 | ) | 74 | ) |
74 | else | 75 | else |
75 | redisproxy:hmset(string_format("globalEmail:%s", gid), | 76 | redisproxy:hmset(string_format("globalEmail:%s", gid), |
@@ -80,7 +81,8 @@ local function mailQuene() | @@ -80,7 +81,8 @@ local function mailQuene() | ||
80 | "content", email.content, | 81 | "content", email.content, |
81 | "attachments", email.attachments, | 82 | "attachments", email.attachments, |
82 | "endtime", email.endTime, | 83 | "endtime", email.endTime, |
83 | - "timestamp", now | 84 | + "timestamp", now, |
85 | + "delayType", email.delayType | ||
84 | ) | 86 | ) |
85 | end | 87 | end |
86 | end | 88 | end |
src/services/httpweb.lua
@@ -41,8 +41,10 @@ local port = ... | @@ -41,8 +41,10 @@ local port = ... | ||
41 | port = tonumber(port) | 41 | port = tonumber(port) |
42 | 42 | ||
43 | local key = "zhaolu1234dangge" | 43 | local key = "zhaolu1234dangge" |
44 | -local function response(id, ...) | ||
45 | - local ok, err = httpd.write_response(sockethelper.writefunc(id), ...) | 44 | +local function response(id, code, body) |
45 | + local ok, err = httpd.write_response(sockethelper.writefunc(id), code, body, { | ||
46 | + ["Connection"] = "Close", | ||
47 | + }) | ||
46 | if not ok then | 48 | if not ok then |
47 | -- if err == sockethelper.socket_error , that means socket closed. | 49 | -- if err == sockethelper.socket_error , that means socket closed. |
48 | skynet.error(string.format("fd = %d, %s", id, err)) | 50 | skynet.error(string.format("fd = %d, %s", id, err)) |
src/services/pvpd.lua
@@ -84,7 +84,7 @@ function CMD.updateRoleInfo(change) | @@ -84,7 +84,7 @@ function CMD.updateRoleInfo(change) | ||
84 | CMD.refreshRoleInfo(change) | 84 | CMD.refreshRoleInfo(change) |
85 | local pvpd = cluster.query("center", "pvpd") | 85 | local pvpd = cluster.query("center", "pvpd") |
86 | if pvpd then | 86 | if pvpd then |
87 | - pcall(cluster.call, "center", pvpd, "updateRoleInfo", change) | 87 | + pcall(cluster.send, "center", pvpd, "updateRoleInfo", change) |
88 | end | 88 | end |
89 | end | 89 | end |
90 | 90 | ||
@@ -92,7 +92,7 @@ local function getDayAndTime() | @@ -92,7 +92,7 @@ local function getDayAndTime() | ||
92 | local startTime = getStartTime() | 92 | local startTime = getStartTime() |
93 | local now = skynet.timex() | 93 | local now = skynet.timex() |
94 | 94 | ||
95 | - local crossTime = now - startTime | 95 | + local crossTime = now - startTime + RESET_TIME * 3600 |
96 | local aday = 3600 * 24 | 96 | local aday = 3600 * 24 |
97 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 | 97 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
98 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | 98 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 |
src/utils/CommonFunc.lua
@@ -100,7 +100,7 @@ end | @@ -100,7 +100,7 @@ end | ||
100 | -- 判断是不是同一个月 | 100 | -- 判断是不是同一个月 |
101 | function isCrossMonth(target, now) | 101 | function isCrossMonth(target, now) |
102 | now = now or skynet.timex() | 102 | now = now or skynet.timex() |
103 | - local tarTm = os.date("*t", target) | 103 | + local tarTm = os.date("*t", target - RESET_TIME * 3600) |
104 | local nowTm = os.date("*t", now - RESET_TIME * 3600) | 104 | local nowTm = os.date("*t", now - RESET_TIME * 3600) |
105 | if tarTm.year == nowTm.year and tarTm.month == nowTm.month then | 105 | if tarTm.year == nowTm.year and tarTm.month == nowTm.month then |
106 | return false | 106 | return false |