Commit 6232e12181712e44ef9c61552e3fa1868f796ed5
Merge branch 'cn/develop' into cn/publish/preview
# Conflicts: # src/csvdata
Showing
24 changed files
with
681 additions
and
94 deletions
Show diff stats
config/develop.lua
1 | 1 | include("basic.lua") |
2 | 2 | |
3 | -logd = 0 -- 是否开启日志 | |
3 | +logd = 1 -- 是否开启日志 | |
4 | 4 | thread = 4 |
5 | 5 | codeurl = "192.168.0.199:9090" |
6 | 6 | servId = 1 |
... | ... | @@ -20,4 +20,4 @@ redis_auth = nil |
20 | 20 | mysql_host = "127.0.0.1" |
21 | 21 | mysql_port = 3306 |
22 | 22 | mysql_user = "root" |
23 | -mysql_password = "123456" | |
24 | 23 | \ No newline at end of file |
24 | +mysql_password = "123456" | ... | ... |
src/ProtocolCode.lua
src/actions/ActivityAction.lua
... | ... | @@ -143,7 +143,8 @@ function _M.signRpc(agent, data) |
143 | 143 | if monthData[curDay].daily_sign_email ~= "" then |
144 | 144 | local emails = monthData[curDay].daily_sign_email:toArray(true,"=") |
145 | 145 | for _, emailId in pairs(emails) do |
146 | - redisproxy:insertEmail({roleId = role:getProperty("id"), emailId = emailId}) | |
146 | + --redisproxy:insertEmail({roleId = role:getProperty("id"), emailId = emailId}) | |
147 | + role:sendMail(emailId) | |
147 | 148 | end |
148 | 149 | end |
149 | 150 | |
... | ... | @@ -312,6 +313,7 @@ function _M.actBattleCommandTaskRpc(agent, data) |
312 | 313 | activity_type = role.activity.ActivityType.BattleCommandTask, -- 活动类型,见活动类型枚举表 |
313 | 314 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
314 | 315 | }) |
316 | + role:mylog("act_action", {desc="bcTask", int1=taskId, int2=taskCfg.resetType}) | |
315 | 317 | |
316 | 318 | role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) |
317 | 319 | |
... | ... | @@ -1327,6 +1329,7 @@ function _M.buyBattleCommandLvlRpc(agent, data) |
1327 | 1329 | role:costItems({[ItemId.Jade] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) |
1328 | 1330 | actData["lvl"] = nextLvl |
1329 | 1331 | role.activity:updateActData("BattleCommand", actData) |
1332 | + role:mylog("act_action", {desc="buyBcLvl", int1=count, int2=nextLvl}) | |
1330 | 1333 | |
1331 | 1334 | SendPacket(actionCodes.Activity_buyBattleCommandLvlRpc, MsgPack.pack({})) |
1332 | 1335 | return true | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -183,6 +183,7 @@ function _M.startAdvRpc( agent, data ) |
183 | 183 | cost = relayData.supply |
184 | 184 | end |
185 | 185 | role:checkTaskEnter("AdvCostPower", {count = cost}) |
186 | + role:mylog("adv_action", {desc = "costPower", int1 = cost}) | |
186 | 187 | |
187 | 188 | local support = {} -- 支援效果 |
188 | 189 | if AdvCommon.isEndless(chapterId) then |
... | ... | @@ -293,6 +294,8 @@ function _M.startHangRpc(agent, data) |
293 | 294 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
294 | 295 | |
295 | 296 | role:checkTaskEnter("AdvCostPower", {count = adv_idle_energy}) |
297 | + role:checkTaskEnter("AdvHangTime", {count = math.ceil(adv_idle_time / 3600)}) | |
298 | + role:mylog("adv_action", {desc = "costPower", int1 = adv_idle_energy}) | |
296 | 299 | |
297 | 300 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 |
298 | 301 | |
... | ... | @@ -494,7 +497,6 @@ function _M.endHangRpc(agent, data) |
494 | 497 | |
495 | 498 | role:checkTaskEnter("AdvHang", {}) |
496 | 499 | role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) |
497 | - role:checkTaskEnter("AdvHangTime", {count = math.ceil(adv_idle_time / 3600)}) | |
498 | 500 | |
499 | 501 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap})) |
500 | 502 | return true | ... | ... |
src/actions/DinerAction.lua
... | ... | @@ -182,13 +182,17 @@ function _M.getSellRewardRpc( agent, data ) |
182 | 182 | local sells = json.decode(role.dinerData:getProperty("sells")) |
183 | 183 | |
184 | 184 | local deltaTimes = {} |
185 | - for slot, _ in pairs(sells) do | |
185 | + for slot, sell in pairs(sells) do | |
186 | + local oldCount = sell.count | |
187 | + local sellDish = sell.dish | |
186 | 188 | local temp = role.dinerData:updateSell(slot) or { |
187 | 189 | deltaCount = 0, |
188 | 190 | deltaTime = 0, |
189 | 191 | lastCount = 0, |
190 | 192 | } |
191 | 193 | deltaTimes[slot] = temp.deltaTime |
194 | + local sellCount = oldCount - temp.lastCount | |
195 | + role:mylog("diner_action", {desc = "sell", int1 = sellDish, int2 = sellCount}) | |
192 | 196 | end |
193 | 197 | sells = json.decode(role.dinerData:getProperty("sells")) |
194 | 198 | for slot, sell in pairs(sells) do |
... | ... | @@ -238,7 +242,7 @@ function _M.getSellRewardRpc( agent, data ) |
238 | 242 | role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) |
239 | 243 | end |
240 | 244 | |
241 | - role:mylog("diner_action", {desc = "sell"}) | |
245 | + --role:mylog("diner_action", {desc = "sell"}) | |
242 | 246 | |
243 | 247 | SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) |
244 | 248 | return true |
... | ... | @@ -327,7 +331,7 @@ function _M.expediteSellRpc( agent, data ) |
327 | 331 | end |
328 | 332 | role:checkTaskEnter("FoodSellQuick") |
329 | 333 | |
330 | - role:mylog("diner_action", {desc = "sellQ"}) | |
334 | + role:mylog("diner_action", {desc = "sellQ", int1 = count + 1}) | |
331 | 335 | |
332 | 336 | SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular})) |
333 | 337 | return true |
... | ... | @@ -703,37 +707,47 @@ function _M.addWantFoodRpc(agent , data) |
703 | 707 | if #ids > buildingData.business then return 2 end |
704 | 708 | |
705 | 709 | local had = {} |
706 | - for _, itemId in ipairs(ids) do | |
707 | - if had[itemId] then return end | |
708 | - had[itemId] = 1 | |
709 | - local foodData = csvdb["diner_materialCsv"][itemId] | |
710 | - if not foodData then return 3 end | |
711 | - if foodData.unlock ~= 0 then | |
712 | - -- 遍历adv_potion | |
713 | - for potionId, _ in pairs(csvdb["adv_potionCsv"]) do | |
714 | - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | |
715 | - if potionLv < 1 then return 4 end | |
716 | - | |
717 | - local potionSet = csvdb["adv_potionCsv"][potionId] | |
718 | - if not potionSet then return 5 end | |
719 | - | |
720 | - local potionData = potionSet[potionLv] | |
721 | - if not potionData then return 6 end | |
722 | - | |
723 | - local cost = potionData.material:toNumMap() | |
724 | - if not cost[itemId] then return 7 end | |
710 | + -- 遍历adv_potion | |
711 | + for potionId, potionData in pairs(csvdb["adv_potionCsv"]) do | |
712 | + local potionLv = role:getPotionLevel(potionId) | |
713 | + if potionLv > 0 then | |
714 | + local cfg = potionData[potionLv] | |
715 | + if cfg then | |
716 | + local cost = cfg.material:toNumMap() | |
717 | + for id, _ in pairs(cost) do | |
718 | + local itemData = csvdb["itemCsv"][id] | |
719 | + local mData = csvdb["diner_materialCsv"][id] | |
720 | + if itemData.type == ItemType.Cuisine and not had[id] then | |
721 | + had[id] = true | |
722 | + end | |
723 | + end | |
725 | 724 | end |
726 | - if not role:checkHangPass(foodData.unlock) then | |
727 | - return 4 | |
725 | + end | |
726 | + end | |
727 | + -- 遍历dish | |
728 | + for id, lv in pairs(role.dinerData:getProperty("dishTree"):toNumMap()) do | |
729 | + if csvdb["diner_dishCsv"][id] and csvdb["diner_dishCsv"][id][lv] then | |
730 | + local data = csvdb["diner_dishCsv"][id][lv] | |
731 | + local costs = data.material:toNumMap() | |
732 | + for id, _ in pairs(costs) do | |
733 | + local itemData = csvdb["itemCsv"][id] | |
734 | + local mData = csvdb["diner_materialCsv"][id] | |
735 | + if itemData.type == ItemType.Cuisine and not had[id] then | |
736 | + had[id] = true | |
737 | + end | |
728 | 738 | end |
729 | 739 | end |
730 | 740 | end |
741 | + for _, itemId in ipairs(ids) do | |
742 | + if not had[itemId] then return 3 end | |
743 | + end | |
744 | + | |
731 | 745 | local gfood = {} |
732 | 746 | for slot, itemId in ipairs(ids) do |
733 | 747 | gfood[slot] = {id = itemId, st = skynet.timex()} |
734 | 748 | end |
735 | 749 | |
736 | - role:finishGuide(36) | |
750 | + role:finishGuide(30) | |
737 | 751 | role:mylog("diner_action", {desc = "wantFood"}) |
738 | 752 | |
739 | 753 | role.dinerData:updateProperty({field = "gfood", value = gfood}) | ... | ... |
src/actions/EmailAction.lua
... | ... | @@ -133,6 +133,7 @@ function _M.drawAttachRpc(agent, data) |
133 | 133 | |
134 | 134 | |
135 | 135 | local email = require("models.Email").new({key = string.format("%d", id), id = id}) |
136 | + email.owner = role | |
136 | 137 | if not email:load() then return end |
137 | 138 | |
138 | 139 | local attachments = getEmailAttachments(email) |
... | ... | @@ -142,7 +143,7 @@ function _M.drawAttachRpc(agent, data) |
142 | 143 | email:setProperty("status", 2, true) |
143 | 144 | email:log(role, 2) |
144 | 145 | SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) |
145 | - role:mylog("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments}) | |
146 | + role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) | |
146 | 147 | return true |
147 | 148 | end |
148 | 149 | ... | ... |
src/actions/FriendAction.lua
... | ... | @@ -118,7 +118,6 @@ function _M.applyRpc(agent, data) |
118 | 118 | |
119 | 119 | local msg = MsgPack.unpack(data) |
120 | 120 | local objectId = msg.roleId |
121 | - dump(msg) | |
122 | 121 | |
123 | 122 | if objectId == roleId then |
124 | 123 | return |
... | ... | @@ -130,7 +129,6 @@ function _M.applyRpc(agent, data) |
130 | 129 | red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId) |
131 | 130 | red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId) |
132 | 131 | end) |
133 | - dump(redret) | |
134 | 132 | |
135 | 133 | -- 玩家id不存在 |
136 | 134 | if not result and not roleExists(objectId) then |
... | ... | @@ -171,7 +169,7 @@ function _M.applyRpc(agent, data) |
171 | 169 | myInfo.online = true |
172 | 170 | myInfo.hadApply = true |
173 | 171 | |
174 | - role:mylog("role_action", {desc = "addFriend", int1 = 1}) | |
172 | + role:mylog("role_action", {desc = "applyFriend", int1 = 1}) | |
175 | 173 | |
176 | 174 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方 |
177 | 175 | end |
... | ... | @@ -420,6 +418,7 @@ function _M.deleteRpc(agent, data) |
420 | 418 | friend_roleid = objectId, -- 好友账户下的角色id |
421 | 419 | friend_cnt = 0, -- 操作后好友数量 |
422 | 420 | }) |
421 | + role:mylog("role_action", {desc = "delFriend", int1 = 1}) | |
423 | 422 | SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack("")) |
424 | 423 | return true |
425 | 424 | end |
... | ... | @@ -646,18 +645,19 @@ function _M.randomRpc(agent, data) |
646 | 645 | for idx, objId in ipairs(needRoleIds) do |
647 | 646 | if not redret[idx] then |
648 | 647 | local online, info = getRoleInfo(objId) |
649 | - table.insert(randomRoles, table_merge({ | |
650 | - roleId = objId, | |
651 | - online = online, | |
652 | - hadApply = hadApply, | |
653 | - inBlack = inBlack, | |
654 | - }, info, { | |
655 | - | |
656 | - })) | |
657 | - if #randomRoles >= globalCsv.friendRecommendLimit then break end | |
648 | + if next(info) then | |
649 | + table.insert(randomRoles, table_merge({ | |
650 | + roleId = objId, | |
651 | + online = online, | |
652 | + hadApply = hadApply, | |
653 | + inBlack = inBlack, | |
654 | + }, info, { | |
655 | + | |
656 | + })) | |
657 | + if #randomRoles >= globalCsv.friendRecommendLimit then break end | |
658 | + end | |
658 | 659 | end |
659 | 660 | end |
660 | - | |
661 | 661 | SendPacket(actionCodes.Friend_randomRpc, MsgPack.pack({list = randomRoles})) |
662 | 662 | return true |
663 | 663 | end | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -301,9 +301,13 @@ function _M.get(role, pms) |
301 | 301 | end |
302 | 302 | end |
303 | 303 | elseif pms.pm1 == "HERO" then |
304 | - for itemId = 400 , 700 do | |
304 | + local unitCsv = csvdb["unitCsv"] | |
305 | + for itemId = 400 , 800 do | |
305 | 306 | if csvdb["itemCsv"][itemId] then |
306 | - role:award({[itemId] = 1}, {log = {desc = "gm"}}) | |
307 | + local heroUnit = unitCsv[itemId - 300] | |
308 | + if heroUnit.open == 1 then | |
309 | + role:award({[itemId] = 1}, {log = {desc = "gm"}}) | |
310 | + end | |
307 | 311 | end |
308 | 312 | end |
309 | 313 | elseif pms.pm1 == "MAXHERO" then |
... | ... | @@ -984,5 +988,43 @@ function _M.drawHero(role, t, act) |
984 | 988 | return result |
985 | 989 | end |
986 | 990 | |
991 | +table.insert(helpDes, {"宝藏图鉴", "treasure", "list"} ) | |
992 | +function _M.treasure(role, pms) | |
993 | + local pm1 = pms.pm1 | |
994 | + if pm1 == "LIST" then | |
995 | + local treasureList= role.dailyData:getProperty("treasureList") | |
996 | + dump(treasureList) | |
997 | + return "宝藏图鉴" | |
998 | + elseif pm1 == "FLUSH" then | |
999 | + local treasureList= role.dailyData:getTreasrueList(role) | |
1000 | + dump(treasureList) | |
1001 | + return "宝藏图鉴" | |
1002 | + elseif pm1 == "CHECK" then | |
1003 | + local treasureList = role.dailyData:checkTreasureList(role) | |
1004 | + if treasureList == nil then | |
1005 | + return "未挖到宝藏" | |
1006 | + end | |
1007 | + dump(treasureList) | |
1008 | + return "挖宝成功" | |
1009 | + elseif pm1 == "RESET" then | |
1010 | + role.dailyData:resetTreasureList() | |
1011 | + return "重置宝藏图鉴" | |
1012 | + else | |
1013 | + return "暂无指令: ".. pm1 | |
1014 | + end | |
1015 | +end | |
1016 | + | |
1017 | +table.insert(helpDes, {"天赋点设置", "savegenius", "heroId", "wakeL", "awake"}) | |
1018 | +function _M.savegenius(role, pms) | |
1019 | + local heroId = pms.pm1 | |
1020 | + local wakeL = pms.pm2 | |
1021 | + local awake = pms.pm3 | |
1022 | + local hero = role.heros[tonumber(heroId)] | |
1023 | + | |
1024 | + if not hero then return "英雄不存在" end | |
1025 | + local genius = hero:saveGeniusTree(wakeL, awake) | |
1026 | + print(genius) | |
1027 | + return "天赋点设置成功" | |
1028 | +end | |
987 | 1029 | |
988 | 1030 | return _M |
989 | 1031 | \ No newline at end of file | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -16,7 +16,18 @@ local table_unpack = table.unpack |
16 | 16 | |
17 | 17 | local _M = {} |
18 | 18 | |
19 | -local function checkReward(role) | |
19 | +local function getHangTime(role) | |
20 | + local hangInfo = role:getProperty("hangInfo") | |
21 | + if not hangInfo.carbonId or not hangInfo.coinTime or not hangInfo.itemTime then | |
22 | + return 0 | |
23 | + end | |
24 | + local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | |
25 | + local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) | |
26 | + | |
27 | + return nowCoinTime - hangInfo.coinTime | |
28 | +end | |
29 | + | |
30 | +local function checkReward(role, isTreasure, carbonId) | |
20 | 31 | local hangInfo = role:getProperty("hangInfo") |
21 | 32 | if not hangInfo.carbonId or not hangInfo.coinTime or not hangInfo.itemTime then |
22 | 33 | return false |
... | ... | @@ -45,7 +56,7 @@ local function checkReward(role) |
45 | 56 | coinCount = (coinCount + coinDoubleCount) * expCoef |
46 | 57 | items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * (expCarbonData.money or 0)) |
47 | 58 | items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * (expCarbonData.exp or 0)) |
48 | - items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + (coinCount * expCarbonData.playerExp or 0)) | |
59 | + items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * (expCarbonData.playerExp or 0)) | |
49 | 60 | |
50 | 61 | local pool = {} |
51 | 62 | for _, temp in pairs(carbonData.item:toArray()) do |
... | ... | @@ -114,6 +125,19 @@ local function checkReward(role) |
114 | 125 | randomItem() |
115 | 126 | end |
116 | 127 | |
128 | + --挂机得到的宝藏加入到挂机奖励 | |
129 | + if isTreasure or false == true then | |
130 | + local treasureList= role.dailyData:checkTreasureList(hangInfo.carbonId) or {} | |
131 | + if next(treasureList) ~= nil then | |
132 | + for id, val in pairs(treasureList) do | |
133 | + local award = val.award:toNumMap() | |
134 | + for k,v in pairs(award) do | |
135 | + items[k] = (award[k] or 0) + v | |
136 | + end | |
137 | + end | |
138 | + end | |
139 | + end | |
140 | + | |
117 | 141 | if coinCount > 0 or itemCount > 0 then |
118 | 142 | return true |
119 | 143 | end |
... | ... | @@ -147,7 +171,7 @@ function _M.startRpc( agent, data ) |
147 | 171 | end |
148 | 172 | end |
149 | 173 | |
150 | - if checkReward(role) then | |
174 | + if checkReward(role, true, carbonId) then | |
151 | 175 | role:updateProperty({field = "hangBag", value = role:getProperty("hangBag")}) |
152 | 176 | end |
153 | 177 | |
... | ... | @@ -214,6 +238,7 @@ function _M.startBattleRpc(agent, data) |
214 | 238 | end |
215 | 239 | |
216 | 240 | _BattleKey = tostring(math.random()) |
241 | + role._StartBattleTs = skynet.timex() | |
217 | 242 | |
218 | 243 | role:checkTaskEnter("HangBattle", {id = carbonId}) |
219 | 244 | SendPacket(actionCodes.Hang_startBattleRpc, MsgPack.pack({key = _BattleKey})) |
... | ... | @@ -241,7 +266,7 @@ function _M.endBattleRpc(agent, data) |
241 | 266 | -- end |
242 | 267 | --end |
243 | 268 | |
244 | - if role:checkHangPass(carbonId) then | |
269 | + if role:checkHangPass(carbonId) then | |
245 | 270 | return 4 |
246 | 271 | end |
247 | 272 | |
... | ... | @@ -313,6 +338,12 @@ function _M.endBattleRpc(agent, data) |
313 | 338 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time |
314 | 339 | --end |
315 | 340 | end |
341 | + | |
342 | + --刷新宝藏图鉴 | |
343 | + if isWin and globalCsv.idle_treasure_point and globalCsv.idle_treasure_point == carbonId then | |
344 | + role.dailyData:getTreasrueList() | |
345 | + end | |
346 | + | |
316 | 347 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
317 | 348 | |
318 | 349 | role:checkBattle("hang", { |
... | ... | @@ -323,7 +354,9 @@ function _M.endBattleRpc(agent, data) |
323 | 354 | }) |
324 | 355 | |
325 | 356 | local team = role:getProperty("pvpTC") |
326 | - role:mylog("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)}) | |
357 | + | |
358 | + local battleTime = skynet.timex() - role._StartBattleTs | |
359 | + role:mylog("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros), cint2 = battleTime}) | |
327 | 360 | |
328 | 361 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ |
329 | 362 | starNum = msg.starNum, |
... | ... | @@ -394,7 +427,8 @@ end |
394 | 427 | |
395 | 428 | function _M.getRewardRpc(agent , data) |
396 | 429 | local role = agent.role |
397 | - checkReward(role) | |
430 | + local hangTime = getHangTime(role) | |
431 | + checkReward(role, true) | |
398 | 432 | local items = role:getProperty("hangBag") |
399 | 433 | if not next(items) then return end |
400 | 434 | local reward, change = role:award(items, {log = {desc = "hangReward"}}) |
... | ... | @@ -424,6 +458,7 @@ function _M.getRewardRpc(agent , data) |
424 | 458 | residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
425 | 459 | }) |
426 | 460 | |
461 | + role:mylog("hang_action", {desc = "hangReward", int1 = hangInfo.carbonId, int2=hangTime}) | |
427 | 462 | |
428 | 463 | SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ |
429 | 464 | reward = reward, |
... | ... | @@ -493,6 +528,8 @@ function _M.quickRpc(agent , data) |
493 | 528 | residence_time = time, --挂机或排名时长 |
494 | 529 | residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
495 | 530 | }) |
531 | + role:mylog("hang_action", {desc = "quick", int1 = hangInfo.carbonId, short1 = curCount}) | |
532 | + | |
496 | 533 | SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ |
497 | 534 | reward = reward, |
498 | 535 | change = change | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -151,6 +151,10 @@ function _M.wakeRpc(agent, data) |
151 | 151 | if curLevel == 3 then -- 解锁cg |
152 | 152 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
153 | 153 | end |
154 | + | |
155 | + if curLevel >= 4 then --自动觉醒技能 | |
156 | + hero:increGeniusTree() | |
157 | + end | |
154 | 158 | hero:mylog({desc = "wake", int1 = hero:getProperty("wakeL")}) |
155 | 159 | |
156 | 160 | role:log("hero_rise", { |
... | ... | @@ -728,7 +732,7 @@ function _M.getResetRewardRpc(agent, data) |
728 | 732 | equip = "", |
729 | 733 | rune = "", |
730 | 734 | }) |
731 | - hero:mylog({desc = "resetHero"}) | |
735 | + hero:mylog({desc = "resetHero", int1=tmpLevel}) | |
732 | 736 | |
733 | 737 | --local coef = globalCsv.unit_back_discount |
734 | 738 | --coef = (pay or tmpLevel <= 60) and 1 or coef |
... | ... | @@ -805,6 +809,7 @@ function _M.drawHeroRpc(agent, data) |
805 | 809 | |
806 | 810 | -- 计算抽卡消耗品 |
807 | 811 | local cost = {} |
812 | + local drawAddReward = {} | |
808 | 813 | if buildTypeData["draw_coin_1"] == "" then |
809 | 814 | return 11 |
810 | 815 | end |
... | ... | @@ -991,19 +996,29 @@ function _M.drawHeroRpc(agent, data) |
991 | 996 | local fragId = itemData.id - ItemStartId.Hero |
992 | 997 | local heroData = csvdb["unitCsv"][fragId] |
993 | 998 | local count = globalCsv.draw_unit_tofragment[heroData.rare] |
994 | - role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
999 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId, short1=isFloorBack and 1 or 0}}) | |
995 | 1000 | logReward[fragId] = (logReward[fragId] or 0) + count |
996 | 1001 | table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) |
997 | 1002 | else |
998 | - role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
1003 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId, short1=isFloorBack and 1 or 0}}) | |
999 | 1004 | logReward[itemId] = (logReward[itemId] or 0) + 1 |
1000 | 1005 | table.insert(reward, {id = itemId, count = 1}) |
1001 | 1006 | end |
1002 | 1007 | |
1008 | + -- 招募得到的英雄追加奖励 | |
1009 | + local unitData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | |
1010 | + if unitData.build_award ~= "" then | |
1011 | + for tId, tCount in pairs(unitData.build_award:toNumMap()) do | |
1012 | + drawAddReward[tId] = (drawAddReward[tId] or 0) + tCount | |
1013 | + end | |
1014 | + end | |
1015 | + -- | |
1016 | + | |
1003 | 1017 | dailyDrawCnt = dailyDrawCnt + 1 |
1004 | 1018 | role:checkTaskEnter("DrawHeroLimitPack", {count = dailyDrawCnt}) |
1005 | 1019 | end |
1006 | 1020 | |
1021 | + role:award(drawAddReward, {log = {desc = "drawHero", int1 = btype}}) | |
1007 | 1022 | role.dailyData:setProperty("drawHeroCnt", dailyDrawCnt) |
1008 | 1023 | |
1009 | 1024 | if draw_floor_back_counts then |
... | ... | @@ -1035,7 +1050,9 @@ function _M.drawHeroRpc(agent, data) |
1035 | 1050 | gacha_cost = cost, -- 购买道具消耗的货币 |
1036 | 1051 | gacha_cnt = floorHeroCount, |
1037 | 1052 | }) |
1038 | - SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | |
1053 | + | |
1054 | + role:mylog("hero_action", {desc = "drawHero", int1=poolId, int2=btype, short1 = drawCount[drawType]}) | |
1055 | + SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward, subReward = drawAddReward})) -- 这个 reward 是数组 | |
1039 | 1056 | |
1040 | 1057 | local feedbackId = buildTypeData["can_feedback"] or 0 |
1041 | 1058 | if feedbackId ~= 0 then |
... | ... | @@ -1275,4 +1292,26 @@ function _M.changeSparkRpc(agent, data) |
1275 | 1292 | return true |
1276 | 1293 | end |
1277 | 1294 | |
1295 | +function _M.saveGeniusTreeRpc(agent, data) | |
1296 | + local role = agent.role | |
1297 | + local msg = MsgPack.unpack(data) | |
1298 | + | |
1299 | + local awake = msg.awake | |
1300 | + local wakeL = msg.wakeL | |
1301 | + local heroId = msg.hero_id | |
1302 | + local hero = role.heros[tonumber(heroId)] | |
1303 | + | |
1304 | + if not hero then print("hero is nil") return 0 end | |
1305 | + | |
1306 | + if wakeL > hero:getProperty("wakeL") then return 1 end | |
1307 | + | |
1308 | + local genius = hero:saveGeniusTree(wakeL, awake) | |
1309 | + if #genius == 0 then | |
1310 | + genius = "" | |
1311 | + end | |
1312 | + hero:updateProperty({field="genius", value=genius}) | |
1313 | + SendPacket(actionCodes.Hero_saveGeniusTreeRpc, MsgPack.pack({genius = genius})) | |
1314 | + return true | |
1315 | +end | |
1316 | + | |
1278 | 1317 | return _M | ... | ... |
src/actions/RadioAction.lua
... | ... | @@ -199,7 +199,8 @@ function _M.finishQuestRpc(agent, data) |
199 | 199 | mission_result = 1, -- 战斗结果(0-无效,1-胜利,2-失败) |
200 | 200 | mission_roundtime = config.time, -- 完成耗时(秒) |
201 | 201 | mission_cleartype = 2, -- 1-开始; 2-完成(领取奖励时) |
202 | - }) | |
202 | + }) | |
203 | + role:mylog("role_action", {desc = "radioTask", int1 = id, short1 = bigSuccess and 1 or 0}) | |
203 | 204 | |
204 | 205 | return true |
205 | 206 | end | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -399,7 +399,8 @@ function _M.createRpc(agent, data) |
399 | 399 | |
400 | 400 | newRole:award(globalCsv.birthItem, {log = {desc = "birth"}, notNotify = true}) |
401 | 401 | -- 欢迎邮件 |
402 | - mysqlproxy:insertEmail({roleId = roleId, emailId = 1}) | |
402 | + --mysqlproxy:insertEmail({roleId = roleId, emailId = 1}) | |
403 | + newRole:sendMail(1) | |
403 | 404 | |
404 | 405 | if msg.newuser then |
405 | 406 | newRole:log("onCreateAccount") |
... | ... | @@ -904,8 +905,10 @@ function _M.taskRpc(agent, data) |
904 | 905 | -- 日常活动完成 |
905 | 906 | if taskType == 1 then |
906 | 907 | role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) |
908 | + role:mylog("role_action", {desc="dayTask", int1=taskId, int2=active}) | |
907 | 909 | else |
908 | 910 | role:checkTaskEnter("WeekTask", {pre = (taskStatus["a"] or 0), cur = active}) |
911 | + role:mylog("role_action", {desc="weekTask", int1=taskId, int2=active}) | |
909 | 912 | end |
910 | 913 | |
911 | 914 | role:changeUpdates({ |
... | ... | @@ -1000,6 +1003,8 @@ function _M.achiveRpc(agent, data) |
1000 | 1003 | achievement_type = cfg.type, -- 成就类型,具体枚举表中成就类型枚举表 |
1001 | 1004 | achievement_reward = award, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
1002 | 1005 | }) |
1006 | + | |
1007 | + role:mylog("role_action", {desc="finishAchieve", int1=cfg.id}) | |
1003 | 1008 | end |
1004 | 1009 | end |
1005 | 1010 | end |
... | ... | @@ -1034,6 +1039,7 @@ function _M.achiveRpc(agent, data) |
1034 | 1039 | achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 |
1035 | 1040 | achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
1036 | 1041 | }) |
1042 | + role:mylog("role_action", {desc="finishAchieve", int1=taskId}) | |
1037 | 1043 | |
1038 | 1044 | SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) |
1039 | 1045 | end |
... | ... | @@ -1057,6 +1063,7 @@ function _M.achiveRpc(agent, data) |
1057 | 1063 | if preMaxCount < pData.request and overCount >= pData.request then |
1058 | 1064 | role:sendMail(101, skynet.timex(), pData.reward, {pData.level}) |
1059 | 1065 | flag = true |
1066 | + role:mylog("role_action", {desc="fux", int1=pdata.level}) | |
1060 | 1067 | end |
1061 | 1068 | end |
1062 | 1069 | if flag then |
... | ... | @@ -1381,7 +1388,7 @@ function _M.goldBuyRpc(agent, data) |
1381 | 1388 | if not costD then |
1382 | 1389 | return 1 |
1383 | 1390 | end |
1384 | - if costD ~= 0 and not role:checkItemEnough({[ItemId.Diamond] = costD}) then | |
1391 | + if costD ~= 0 and not role:checkItemEnough({[ItemId.Jade] = costD}) then | |
1385 | 1392 | return 2 |
1386 | 1393 | end |
1387 | 1394 | local goldC = 0 |
... | ... | @@ -1403,7 +1410,7 @@ function _M.goldBuyRpc(agent, data) |
1403 | 1410 | local coef = role.storeData:getGearExchangeCoef() |
1404 | 1411 | goldC = goldC * coef |
1405 | 1412 | role.dailyData:updateProperty({field = "goldBuyT", value = curT + 1}) |
1406 | - role:costItems({[ItemId.Diamond] = costD}, {log = {desc = "goldBuy"}}) | |
1413 | + role:costItems({[ItemId.Jade] = costD}, {log = {desc = "goldBuy"}}) | |
1407 | 1414 | local reward, change = role:award({[ItemId.Gold] = math.floor(goldC)}, {log = {desc = "goldBuy"}}) |
1408 | 1415 | SendPacket(actionCodes.Role_goldBuyRpc, MsgPack.pack(role:packReward(reward, change))) |
1409 | 1416 | return true |
... | ... | @@ -1424,7 +1431,7 @@ function _M.diamondConvertRpc(agent, data) |
1424 | 1431 | role:costDiamond({count = cost, log = {desc = "convert", int1 = oper, int2 = get}}) |
1425 | 1432 | local reward, change |
1426 | 1433 | if oper == 1 then -- 钻石兑换成虹光玉 |
1427 | - reward, change = role:award({[ItemId.Jade] = get}, {log = {desc = "convert"}}) | |
1434 | + reward, change = role:award({[ItemId.Jade] = get}, {log = {desc = "convert", short1=oper}}) | |
1428 | 1435 | elseif oper == 2 then -- 钻石兑换成虹光玉再兑换成招募券 |
1429 | 1436 | local old = role:getItemCount(ItemId.Jade) |
1430 | 1437 | get = old + get |
... | ... | @@ -1437,7 +1444,7 @@ function _M.diamondConvertRpc(agent, data) |
1437 | 1444 | allReward[ItemId.Jade] = remain - old |
1438 | 1445 | elseif remain == old then |
1439 | 1446 | else |
1440 | - role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert"}}) | |
1447 | + role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert", short1=oper}}) | |
1441 | 1448 | end |
1442 | 1449 | |
1443 | 1450 | if quan > 0 then | ... | ... |
src/actions/SeaportAction.lua
... | ... | @@ -59,6 +59,12 @@ function _M.donateRpc(agent, data) |
59 | 59 | redisproxy:hincrby(SEAPORT_TRADE_TASK_2,id,itemCount) |
60 | 60 | end |
61 | 61 | |
62 | + local seaport = role:getProperty("seaport") or {} | |
63 | + if not seaport.join then | |
64 | + seaport.join = 1 | |
65 | + role:updateProperty({field = "seaport", value = seaport}) | |
66 | + end | |
67 | + | |
62 | 68 | role:costItems({[itemId] = itemCount}, {log = {desc = "seaportDonate", int1 = phase, int2 = id}}) |
63 | 69 | local reward, change = role:award(rewards, {log = {desc = "seaportDonate", int1 = ddata.phase, int2 = ddata.id}}) |
64 | 70 | |
... | ... | @@ -237,6 +243,8 @@ function _M.taskRpc(agent, data) |
237 | 243 | reward, change = role:award(itemReward, {log = {desc = "seaportTask", int1 = taskId, int2 = level}}) |
238 | 244 | |
239 | 245 | seaport.collect[taskId] = nil |
246 | + | |
247 | + role:mylog("role_action", {desc="seaportTask", int1=taskId, int2=level, short1=bigSuccess and 1 or 0}) | |
240 | 248 | else |
241 | 249 | return 0 |
242 | 250 | end | ... | ... |
src/actions/StoreAction.lua
... | ... | @@ -268,7 +268,7 @@ function _M.shopBuyRpc(agent , data) |
268 | 268 | local id = msg.id |
269 | 269 | local count = msg.count or 1 |
270 | 270 | |
271 | - local dataSet = csvdb["shop_normalCsv"][id] | |
271 | + local dataSet = csvdb["shop_normalCsv"][id] | |
272 | 272 | if not dataSet then return end |
273 | 273 | |
274 | 274 | if dataSet.unlock ~= "" then |
... | ... | @@ -278,6 +278,13 @@ function _M.shopBuyRpc(agent , data) |
278 | 278 | end |
279 | 279 | end |
280 | 280 | |
281 | + --判断是否是活动商品 | |
282 | + if dataSet.activity_id and dataSet.activity_id ~= 0 then | |
283 | + local actCfg = csvdb["activity_ctrlCsv"][dataSet.activity_id] | |
284 | + if not actCfg then return 2 end | |
285 | + if not role.activity:isOpenById(dataSet.activity_id, "ActShopGoods") then return 3 end | |
286 | + end | |
287 | + | |
281 | 288 | local buyRecord = role.storeData:getProperty("buyR") |
282 | 289 | if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (buyRecord[id] or 0))) then |
283 | 290 | skynet.error(string.format("shop buy over limit, user_id:%d, goods_id:%d", role:getProperty("id"), id)) |
... | ... | @@ -299,19 +306,19 @@ function _M.shopBuyRpc(agent , data) |
299 | 306 | desc = "pvpShop" |
300 | 307 | end |
301 | 308 | |
302 | - if not role:checkItemEnough(cost) then return end | |
309 | + if not role:checkItemEnough(cost) then return 4 end | |
303 | 310 | |
304 | 311 | if dataSet.limit ~= 0 then |
305 | 312 | buyRecord[id] = (buyRecord[id] or 0) + count |
306 | 313 | role.storeData:updateProperty({field = "buyR", value = buyRecord}) |
307 | 314 | end |
308 | - role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count}}) | |
315 | + role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, short1 = dataSet.shop}}) | |
309 | 316 | |
310 | 317 | local gift = {} |
311 | 318 | for _id, _count in pairs(dataSet.gift:toNumMap()) do |
312 | 319 | gift[_id] = _count * count |
313 | 320 | end |
314 | - local reward = role:award(gift, {log = {desc = desc, int1 = id, int2 = count}}) | |
321 | + local reward = role:award(gift, {log = {desc = desc, int1 = id, int2 = count, short1=dataSet.shop}}) | |
315 | 322 | |
316 | 323 | if dataSet.shop == 1 then |
317 | 324 | role:checkTaskEnter("ShopAll", {count = count}) | ... | ... |
src/adv/Adv.lua
... | ... | @@ -922,7 +922,7 @@ function Adv:over(success, rewardRatio, overType) |
922 | 922 | end |
923 | 923 | self:clearAdvUnlockCache() |
924 | 924 | |
925 | - self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType}) | |
925 | + self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType, int2 = self.chapterId, long1 = self.level}) | |
926 | 926 | |
927 | 927 | |
928 | 928 | local team = self.owner:getProperty("advTeam") | ... | ... |
src/models/Daily.lua
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | |
3 | 3 | local Daily = class("Daily", require("shared.ModelBaseMysql")) |
4 | 4 | |
5 | +oneDay = 60*60*24 | |
6 | + | |
5 | 7 | function Daily:ctor(properties) |
6 | 8 | Daily.super.ctor(self, properties) |
7 | 9 | end |
... | ... | @@ -30,6 +32,8 @@ Daily.schema = { |
30 | 32 | unlockPool = {"table", {}}, -- 解锁的属性卡池 |
31 | 33 | curPool = {"number", 0}, -- 属性卡池当前索引 |
32 | 34 | drawHeroCnt = {"number", 0}, -- 每日抽卡次数 |
35 | + | |
36 | + treasureList = {"table", {}}, --挂机图鉴 | |
33 | 37 | } |
34 | 38 | |
35 | 39 | function Daily:updateProperty(params) |
... | ... | @@ -60,6 +64,8 @@ function Daily:refreshDailyData(notify) |
60 | 64 | if self:getProperty(field) > 0 then |
61 | 65 | dataMap[field] = 0 |
62 | 66 | end |
67 | + elseif field == "treasureList" then | |
68 | + dataMap[field] = self:getTreasrueList() | |
63 | 69 | elseif field ~= "key" then |
64 | 70 | local typ, def = table.unpack(schema) |
65 | 71 | dataMap[field] = def |
... | ... | @@ -85,6 +91,279 @@ function Daily:refreshDailyData(notify) |
85 | 91 | end |
86 | 92 | end |
87 | 93 | |
94 | +--解锁 | |
95 | +function Daily:checkUnlock(treaval) | |
96 | + local role = self.owner | |
97 | + local treasureC = treaval.unlock:toArray(true, "=") | |
98 | + local show = false | |
99 | + if treasureC[1] == 1 then --通关关卡 | |
100 | + if self.owner:checkHangPass(treasureC[2]) then show = true end | |
101 | + elseif treasureC[1] == 2 then --通关拾荒章节=x层 | |
102 | + local chapterId = treasureC[2] | |
103 | + local layer = 1 | |
104 | + local advCsv = csvdb["adv_chapterCsv"][chapterId] | |
105 | + if not advCsv then return false end --不存在的章节 | |
106 | + if math.floor(chapterId / 100) ~= 2 then | |
107 | + layer = math.min(layer, advCsv.limitlevel) | |
108 | + end | |
109 | + local advPass = role:getProperty("advPass") | |
110 | + if (advPass[chapterId] or 0) < layer then | |
111 | + show = false | |
112 | + else | |
113 | + show = true | |
114 | + end | |
115 | + elseif treasureC[1] == 3 then --拥有指定id的角色时 | |
116 | + local hero = role:getHeroByID(treasureC[2]) | |
117 | + if hero then show = true end | |
118 | + else | |
119 | + show = true | |
120 | + end | |
121 | + return show | |
122 | +end | |
123 | + | |
124 | +--CD | |
125 | +function Daily:checkTreasureExpired(treasureAttr, treasureList) | |
126 | + local curInfo = treasureList[treasureAttr.id] | |
127 | + if curInfo then | |
128 | + -- check finish | |
129 | + if curInfo["expire_time"] then | |
130 | + if curInfo.cool_time > 1 then | |
131 | + if skynet.timex() >= curInfo["expire_time"] then | |
132 | + treasureList[treasureAttr.id] = nil | |
133 | + curInfo = clone(treasureAttr) | |
134 | + elseif skynet.timex() >= curInfo["expire_time"] - curInfo.cool_time * oneDay then --未冷却 | |
135 | + curInfo = nil | |
136 | + else | |
137 | + curInfo = clone(treasureAttr) | |
138 | + end | |
139 | + else | |
140 | + if skynet.timex() >= curInfo["expire_time"] then | |
141 | + treasureList[treasureAttr.id] = nil | |
142 | + end | |
143 | + curInfo = clone(treasureAttr) | |
144 | + end | |
145 | + else | |
146 | + curInfo = clone(treasureAttr) | |
147 | + end | |
148 | + else | |
149 | + curInfo = clone(treasureAttr) | |
150 | + end | |
151 | + | |
152 | + return curInfo | |
153 | +end | |
154 | + | |
155 | +--资源 | |
156 | +function Daily:checkTreasureBase(treasureList, treasureBase, removeId) | |
157 | + local tmptreasure = {} | |
158 | + local num = 0 | |
159 | + for k, val in pairs(treasureList) do | |
160 | + if removeId and val.id == removeId then | |
161 | + treasureList[k] = nil | |
162 | + else | |
163 | + if treasureBase >= val.treasure_value then | |
164 | + treasureBase = treasureBase - val.treasure_value | |
165 | + tmptreasure[val.id] = val | |
166 | + num = num + 1 | |
167 | + end | |
168 | + end | |
169 | + | |
170 | + end | |
171 | + return tmptreasure, num | |
172 | +end | |
173 | + | |
174 | +--绑定通关关卡 | |
175 | +function Daily:checkChapters() | |
176 | + local chapters = {} | |
177 | + local tmp_chapters = {} | |
178 | + local treasureList = self:getProperty("treasureList") | |
179 | + if next(treasureList) ~= nil then | |
180 | + for id, curInfo in pairs(treasureList) do | |
181 | + if curInfo["end_time"] then | |
182 | + if skynet.timex() < curInfo["end_time"] then | |
183 | + tmp_chapters[curInfo.chapter_id] = curInfo | |
184 | + end | |
185 | + end | |
186 | + end | |
187 | + end | |
188 | + | |
189 | + for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do | |
190 | + if self.owner:checkHangPass(chapter_id) then | |
191 | + if next(tmp_chapters) == nil then | |
192 | + chapters[chapter_id] = val | |
193 | + else | |
194 | + if not tmp_chapters[chapter_id] then | |
195 | + chapters[chapter_id] = val | |
196 | + end | |
197 | + end | |
198 | + end | |
199 | + end | |
200 | + return chapters | |
201 | +end | |
202 | + | |
203 | +--权重 | |
204 | +function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | |
205 | + local removeId | |
206 | + local chapters = self:checkChapters() | |
207 | + local treasure | |
208 | + if next(chapters) == nil then return end | |
209 | + | |
210 | + while next(tmptreasure) do | |
211 | + local tmp, num = self:checkTreasureBase(tmptreasure, treasureBase, removeId) | |
212 | + | |
213 | + if num == 0 then | |
214 | + break | |
215 | + elseif num == 1 then | |
216 | + for _, val in pairs(tmp) do | |
217 | + treasure = val | |
218 | + end | |
219 | + else | |
220 | + local id = math.randWeight(tmp, "weight") --宝藏id | |
221 | + if not id then | |
222 | + break | |
223 | + end | |
224 | + treasure = tmp[id] | |
225 | + end | |
226 | + | |
227 | + if treasureBase >= treasure.treasure_value then | |
228 | + --扣除资源值 | |
229 | + treasureBase = treasureBase - treasure.treasure_value | |
230 | + else | |
231 | + break | |
232 | + end | |
233 | + local chapterId = math.randWeight(chapters, "treasure_weight") --关卡id | |
234 | + if not chapterId then | |
235 | + break | |
236 | + end | |
237 | + | |
238 | + treasure.chapter_id = chapterId | |
239 | + treasureList[treasure.id] = treasure | |
240 | + removeId = treasure.id | |
241 | + end | |
242 | +end | |
243 | + | |
244 | +--chapterId | |
245 | +function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId) | |
246 | + local treasure = nil | |
247 | + | |
248 | + if not curInfo then | |
249 | + print("curInfo is nil") | |
250 | + return treasure | |
251 | + end | |
252 | + | |
253 | + --开始挖宝关卡ID=挂机关卡ID | |
254 | + if chapterId == curInfo.chapter_id then | |
255 | + --开始挖宝 | |
256 | + if not curInfo["end_time"] then | |
257 | + curInfo["end_time"] = skynet.timex() + curInfo.working_time | |
258 | + else | |
259 | + if skynet.timex() >= curInfo["end_time"] then | |
260 | + if curInfo.cool_time > 1 then | |
261 | + --宝藏冷却时间 | |
262 | + if not curInfo["expire_time"] then | |
263 | + treasure = treasureList[curInfo.id] | |
264 | + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay | |
265 | + else | |
266 | + --已经领取宝藏 检索宝藏冷却时间 | |
267 | + if skynet.timex() >= curInfo["expire_time"] then | |
268 | + treasureList[curInfo.id] = nil | |
269 | + end | |
270 | + end | |
271 | + else | |
272 | + treasure = treasureList[curInfo.id] | |
273 | + treasureList[curInfo.id] = nil | |
274 | + end | |
275 | + end | |
276 | + end | |
277 | + else | |
278 | + --已经开始挖宝 | |
279 | + if curInfo["end_time"] then | |
280 | + if skynet.timex() >= curInfo["end_time"] then | |
281 | + if curInfo.cool_time > 1 then | |
282 | + --宝藏冷却时间 | |
283 | + if not curInfo["expire_time"] then | |
284 | + treasure = treasureList[curInfo.id] | |
285 | + curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay | |
286 | + else | |
287 | + --已经领取宝藏 检索宝藏冷却时间 | |
288 | + if skynet.timex() >= curInfo["expire_time"] then | |
289 | + treasureList[curInfo.id] = nil | |
290 | + end | |
291 | + end | |
292 | + else | |
293 | + treasure = treasureList[curInfo.id] | |
294 | + treasureList[curInfo.id] = nil | |
295 | + end | |
296 | + else | |
297 | + curInfo["end_time"] = nil | |
298 | + end | |
299 | + end | |
300 | + end | |
301 | + return treasure | |
302 | +end | |
303 | + | |
304 | +function Daily:buyTreasure(treasureList) | |
305 | + local boughtTreasurer = {} | |
306 | + local treasureBase = globalCsv.idle_treasure_base | |
307 | + for id, val in pairs(treasureList) do | |
308 | + treasureBase = treasureBase - val.treasure_value | |
309 | + if treasureBase < 0 then | |
310 | + treasureBase = treasureBase + val.treasure_value | |
311 | + return | |
312 | + else | |
313 | + boughtTreasurer[id] = val | |
314 | + end | |
315 | + end | |
316 | + --self:updateProperty({field = "treasureBase", value = treasureBase}) | |
317 | + return boughtTreasurer | |
318 | +end | |
319 | + | |
320 | +--重置宝藏图鉴 | |
321 | +function Daily:resetTreasureList() | |
322 | + self:updateProperty({field = "treasureList", value = {}}) | |
323 | +end | |
324 | + | |
325 | +--宝藏图鉴 | |
326 | +function Daily:getTreasrueList() | |
327 | + local tmpcsv = csvdb["idle_treasureCsv"] | |
328 | + local treasureList = self:getProperty("treasureList") or {} --挖宝列表 过期删除 领取奖励删除 跨天更新 | |
329 | + local tmptreasure = {} | |
330 | + local treasureBase = globalCsv.idle_treasure_base | |
331 | + for id, val in pairs(tmpcsv) do | |
332 | + if self:checkUnlock(val) == true then | |
333 | + local treasure = self:checkTreasureExpired(val, treasureList) | |
334 | + if treasure then | |
335 | + table.insert(tmptreasure, treasure) | |
336 | + end | |
337 | + end | |
338 | + end | |
339 | + table.sort(tmptreasure, function (a,b) return a.treasure_value > b.treasure_value end) | |
340 | + | |
341 | + self:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | |
342 | + self:updateProperty({field = "treasureList", value = treasureList}) | |
343 | + return treasureList | |
344 | +end | |
345 | + | |
346 | + | |
347 | +--检索挖宝列表 | |
348 | +function Daily:checkTreasureList(chapterId) | |
349 | + local treasureList = self:getProperty("treasureList") or {} | |
350 | + local tmptreasure = {} | |
351 | + for id, val in pairs(treasureList) do | |
352 | + local treasure = self:checkTreasureChapterId(val, treasureList, chapterId) | |
353 | + if treasure ~= nil then | |
354 | + tmptreasure[id] = treasure | |
355 | + end | |
356 | + end | |
357 | + | |
358 | + if next(tmptreasure) == nil then | |
359 | + self:updateProperty({field = "treasureList", value = treasureList}) | |
360 | + return nil | |
361 | + end | |
362 | + local boughtTreasurer = self:buyTreasure(tmptreasure) | |
363 | + self:updateProperty({field = "treasureList", value = treasureList}) | |
364 | + return boughtTreasurer | |
365 | +end | |
366 | + | |
88 | 367 | function Daily:data() |
89 | 368 | return { |
90 | 369 | hangQC = self:getProperty("hangQC"), |
... | ... | @@ -104,6 +383,7 @@ function Daily:data() |
104 | 383 | goldBuyT = self:getProperty("goldBuyT"), |
105 | 384 | unlockPool = self:getProperty("unlockPool"), |
106 | 385 | curPool = self:getProperty("curPool"), |
386 | + treasureList = self:getProperty("treasureList"), | |
107 | 387 | } |
108 | 388 | end |
109 | 389 | ... | ... |
src/models/Hero.lua
... | ... | @@ -18,6 +18,7 @@ Hero.schema = { |
18 | 18 | rune = {"string",""}, --零件 type=id |
19 | 19 | faith = {"number", 0}, -- 信赖 |
20 | 20 | spark = {"table", {}}, -- 火花属性 |
21 | + genius = {"string", "" }, --天赋点 4=10201 5=10201 6=10203 7=10204 | |
21 | 22 | } |
22 | 23 | |
23 | 24 | function Hero:ctor( properties ) |
... | ... | @@ -111,6 +112,7 @@ function Hero:data() |
111 | 112 | rune = self:getProperty("rune"), |
112 | 113 | faith = self:getProperty("faith"), |
113 | 114 | spark = self:getProperty("spark"), |
115 | + genius = self:getProperty("genius"), | |
114 | 116 | } |
115 | 117 | end |
116 | 118 | ... | ... |
src/models/HeroPlugin.lua
... | ... | @@ -381,6 +381,90 @@ function HeroPlugin.bind(Hero) |
381 | 381 | end |
382 | 382 | end |
383 | 383 | self:setProperty("faith", faith) |
384 | + self:mylog({desc = "addFaith", int1 = exp}) | |
385 | + end | |
386 | + | |
387 | + --检验天赋树是否合理 | |
388 | + function Hero:checkGeniusTree(genius) | |
389 | + local maxWakeL = 0 | |
390 | + local star = self:getProperty("wakeL") | |
391 | + if star < 4 then return maxWakeL end | |
392 | + if #genius == 0 then return maxWakeL end | |
393 | + | |
394 | + local geniusTree = genius:toNumMap() | |
395 | + local tmpgenius = "" | |
396 | + for wakeL, val in pairs(geniusTree) do | |
397 | + if wakeL < 4 then return maxWakeL end | |
398 | + if wakeL % 2 == 0 then | |
399 | + if geniusTree[wakeL+1] and geniusTree[wakeL+1] ~= val then | |
400 | + return 0, 0, tmpgenius | |
401 | + end | |
402 | + end | |
403 | + maxWakeL = math.max(maxWakeL, wakeL) | |
404 | + if #tmpgenius == 0 then | |
405 | + tmpgenius = string.format("%s=%s", tostring(wakeL), tostring(val)) | |
406 | + else | |
407 | + tmpgenius = string.format("%s %s=%s", tmpgenius, tostring(wakeL), tostring(val)) | |
408 | + end | |
409 | + end | |
410 | + return tonumber(maxWakeL), tonumber(geniusTree[maxWakeL]), tmpgenius | |
411 | + end | |
412 | + | |
413 | + function Hero:increGeniusTree() | |
414 | + local genius = self:getProperty("genius") | |
415 | + local wakeL = self:getProperty("wakeL") | |
416 | + local maxWakeL, awake | |
417 | + maxWakeL, awake, genius = self:checkGeniusTree(genius) | |
418 | + if maxWakeL >= 4 and wakeL > maxWakeL and maxWakeL % 2 == 0 then | |
419 | + maxWakeL = maxWakeL + 1 | |
420 | + if #genius == 0 then | |
421 | + genius = string.format("%s=%s", tostring(maxWakeL), tostring(awake)) | |
422 | + else | |
423 | + genius = string.format("%s %s=%s", genius, tostring(maxWakeL), tostring(awake)) | |
424 | + end | |
425 | + end | |
426 | + return genius | |
427 | + end | |
428 | + | |
429 | + function Hero:resetGeniusTree() | |
430 | + local unit_starTalent_reset = globalCsv["unit_starTalent_reset"] | |
431 | + local cost = unit_starTalent_reset:toNumMap() | |
432 | + if not self.owner:checkItemEnough(cost) then return false end | |
433 | + | |
434 | + self.owner:costItems(cost, {log = {desc = "heroGenius", int1 = self:getProperty("id"), int2 = self:getProperty("type")}}) | |
435 | + return true | |
436 | + end | |
437 | + | |
438 | + function Hero:saveGeniusTree(wakeL, awake) | |
439 | + local genius = self:getProperty("genius") | |
440 | + local typ = self:getProperty("type") | |
441 | + local curWakeL = self:getProperty("wakeL") | |
442 | + if not wakeL or not awake then | |
443 | + if self:resetGeniusTree() == true then return "" end | |
444 | + return genius | |
445 | + end | |
446 | + | |
447 | + local heroUnit = csvdb["unitCsv"][typ] | |
448 | + if not heroUnit then return genius end | |
449 | + if not heroUnit.awake_1 or not heroUnit.awake_2 then return genius end | |
450 | + | |
451 | + if #genius == 0 then | |
452 | + genius = string.format("%s=%s", tostring(wakeL), tostring(awake)) | |
453 | + else | |
454 | + genius = string.format("%s %s=%s", genius, tostring(wakeL), tostring(awake)) | |
455 | + end | |
456 | + | |
457 | + local maxWakeL | |
458 | + maxWakeL, _, genius = self:checkGeniusTree(genius) | |
459 | + if maxWakeL == 0 then | |
460 | + genius = self:getProperty("genius") | |
461 | + else | |
462 | + if curWakeL > wakeL and wakeL % 2 == 0 then --自动升一级,举例,6星设置4星觉醒技能。自动升级到5星 | |
463 | + genius = string.format("%s %s=%s", genius, tostring(wakeL + 1), tostring(awake)) | |
464 | + maxWakeL, _, genius = self:checkGeniusTree(genius) | |
465 | + end | |
466 | + end | |
467 | + return genius | |
384 | 468 | end |
385 | 469 | |
386 | 470 | end | ... | ... |
src/models/Role.lua
... | ... | @@ -198,7 +198,7 @@ Role.schema = { |
198 | 198 | nbTask = {"table", {}}, -- 新用户活动 |
199 | 199 | radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv |
200 | 200 | |
201 | - seaport = {"table", {}}, -- 海岛贸易季 {time = 1234567890, donate = {}, collect = {[1] = {team = "1=2=3", time = 1234567890}}, shop = {}} | |
201 | + seaport = {"table", {}}, -- 海岛贸易季 {time = 1234567890, donate = {}, collect = {[1] = {team = "1=2=3", time = 1234567890}}, shop = {}, join = 1} | |
202 | 202 | |
203 | 203 | returner = {"table", {}}, -- 回归者 {time = 12334233423, [1] = 1, [2] = 2, status = {[1] = 1}} |
204 | 204 | ... | ... |
src/models/RoleBattle.lua
... | ... | @@ -99,7 +99,8 @@ function Role:checkBattleCheat(battleType, params) |
99 | 99 | for arr, _ in pairs(checkCheatAttrs) do |
100 | 100 | temp[arr] = hero[arr] |
101 | 101 | end |
102 | - selfTeamServer[hero.type] = temp | |
102 | + selfTeamServer[hero.type] = temp | |
103 | + self:log_battle_hero(hero.type, "hangTeam") | |
103 | 104 | end |
104 | 105 | -- local carbonData = csvdb["idle_battleCsv"][params.id] |
105 | 106 | -- enemyServer = packBattleEnemyCommon(carbonData) |
... | ... | @@ -112,6 +113,7 @@ function Role:checkBattleCheat(battleType, params) |
112 | 113 | temp[arr] = hero[arr] |
113 | 114 | end |
114 | 115 | selfTeamServer[hero.type] = temp |
116 | + self:log_battle_hero(hero.type, "towerTeam") | |
115 | 117 | end |
116 | 118 | -- local carbonData = csvdb["tower_battleCsv"][params.id] |
117 | 119 | -- enemyServer = packBattleEnemyCommon(carbonData) |
... | ... | @@ -124,6 +126,7 @@ function Role:checkBattleCheat(battleType, params) |
124 | 126 | temp[arr] = hero[arr] |
125 | 127 | end |
126 | 128 | selfTeamServer[hero.type] = temp |
129 | + self:log_battle_hero(hero.type, "bonusTeam") | |
127 | 130 | end |
128 | 131 | -- local carbonData = csvdb["bonus_battleCsv"][params.id] |
129 | 132 | -- enemyServer = packBattleEnemyCommon(carbonData) |
... | ... | @@ -136,6 +139,7 @@ function Role:checkBattleCheat(battleType, params) |
136 | 139 | temp[arr] = hero[arr] |
137 | 140 | end |
138 | 141 | selfTeamServer[hero.type] = temp |
142 | + self:log_battle_hero(hero.type, "workTeam") | |
139 | 143 | end |
140 | 144 | -- local carbonData = csvdb["bonus_battleCsv"][params.id] |
141 | 145 | -- enemyServer = packBattleEnemyCommon(carbonData) |
... | ... | @@ -149,6 +153,7 @@ function Role:checkBattleCheat(battleType, params) |
149 | 153 | temp[arr] = hero[arr] |
150 | 154 | end |
151 | 155 | selfTeamServer[hero.type] = temp |
156 | + self:log_battle_hero(hero.type, "pvpcTeam") | |
152 | 157 | end |
153 | 158 | end |
154 | 159 | cheat["pvph"] = cheat["pvpc"] | ... | ... |
src/models/RoleLog.lua
src/models/RolePlugin.lua
... | ... | @@ -252,7 +252,8 @@ function RolePlugin.bind(Role) |
252 | 252 | local headData = csvdb["player_iconCsv"][itemId] |
253 | 253 | -- pvp 跨服竞技场奖励 |
254 | 254 | if headData and headData.path == 2 then |
255 | - mysqlproxy:insertEmail({roleId = self:getProperty("id"), emailId = 19}) | |
255 | + --mysqlproxy:insertEmail({roleId = self:getProperty("id"), emailId = 19}) | |
256 | + self:sendMail(19) | |
256 | 257 | end |
257 | 258 | end |
258 | 259 | end |
... | ... | @@ -397,10 +398,11 @@ function RolePlugin.bind(Role) |
397 | 398 | return true, less |
398 | 399 | end |
399 | 400 | for itemId, count in pairs(itemCountT) do |
400 | - if count <= 0 then | |
401 | - -- 判断物品数量值不应该小于等于0 | |
402 | - less[itemId] = 0 | |
403 | - else | |
401 | + --if count <= 0 then | |
402 | + -- -- 判断物品数量值不应该小于等于0 | |
403 | + -- less[itemId] = 0 | |
404 | + --else | |
405 | + if count > 0 then | |
404 | 406 | local last = self:getItemCount(itemId) - count |
405 | 407 | if last < 0 then |
406 | 408 | less[itemId] = -last |
... | ... | @@ -636,6 +638,15 @@ function RolePlugin.bind(Role) |
636 | 638 | return count |
637 | 639 | end |
638 | 640 | |
641 | + function Role:getHeroByID(heroId) | |
642 | + for id, hero in pairs(self.heros) do | |
643 | + if id == heroId then | |
644 | + return hero | |
645 | + end | |
646 | + end | |
647 | + return nil | |
648 | + end | |
649 | + | |
639 | 650 | |
640 | 651 | function Role:loadHeros() |
641 | 652 | local roleId = self:getProperty("id") |
... | ... | @@ -825,7 +836,7 @@ function RolePlugin.bind(Role) |
825 | 836 | newRune:create() |
826 | 837 | newRune:generateAttrs() |
827 | 838 | newRune.owner = self |
828 | - self.runeBag[runeUid] = newRune | |
839 | + self.runeBag[roleId * MAX_RUNE_NUM + runeUid] = newRune | |
829 | 840 | if not params.notNotify then |
830 | 841 | local response = {} |
831 | 842 | table.insert(response, newRune:data()) |
... | ... | @@ -876,7 +887,7 @@ function RolePlugin.bind(Role) |
876 | 887 | newSpark:create() |
877 | 888 | newSpark:addAttr(data.attr:toNumMap()) |
878 | 889 | newSpark.owner = self |
879 | - self.sparkBag[sparkUid] = newSpark | |
890 | + self.sparkBag[roleId * MAX_SPARK_NUM + sparkUid] = newSpark | |
880 | 891 | if not params.notNotify then |
881 | 892 | local response = {} |
882 | 893 | table.insert(response, newSpark:data()) |
... | ... | @@ -1360,7 +1371,7 @@ function RolePlugin.bind(Role) |
1360 | 1371 | local function getReward(reset) |
1361 | 1372 | -- 全服捐赠奖励 |
1362 | 1373 | local donate = seaport.donate or {} |
1363 | - if not reset and (not donate[1] or not donate[2]) then | |
1374 | + if not reset and seaport.join and (not donate[1] or not donate[2]) then | |
1364 | 1375 | local result = self:getSeaportServerProgress() |
1365 | 1376 | for idx, set in ipairs(csvdb["seaport_purchaseCsv"]) do |
1366 | 1377 | local done = true |
... | ... | @@ -1372,11 +1383,12 @@ function RolePlugin.bind(Role) |
1372 | 1383 | end |
1373 | 1384 | if done then |
1374 | 1385 | update = true |
1375 | - redisproxy:insertEmail({ | |
1376 | - roleId = self:getProperty("id"), | |
1377 | - emailId = idx == 1 and 361 or 362, | |
1378 | - attachments = set[1].phase_award, | |
1379 | - }) | |
1386 | + --redisproxy:insertEmail({ | |
1387 | + -- roleId = self:getProperty("id"), | |
1388 | + -- emailId = idx == 1 and 361 or 362, | |
1389 | + -- attachments = set[1].phase_award, | |
1390 | + --}) | |
1391 | + self:sendMail(idx == 1 and 361 or 362, nil, set[1].phase_award) | |
1380 | 1392 | -- self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) |
1381 | 1393 | donate[idx] = 1 |
1382 | 1394 | end |
... | ... | @@ -1469,11 +1481,12 @@ function RolePlugin.bind(Role) |
1469 | 1481 | end |
1470 | 1482 | rewardStr = rewardStr .. string.format("%s=%s",itemId,value) |
1471 | 1483 | end |
1472 | - redisproxy:insertEmail({ | |
1473 | - roleId = self:getProperty("id"), | |
1474 | - emailId = 363, | |
1475 | - attachments = rewardStr, | |
1476 | - }) | |
1484 | + --redisproxy:insertEmail({ | |
1485 | + -- roleId = self:getProperty("id"), | |
1486 | + -- emailId = 363, | |
1487 | + -- attachments = rewardStr, | |
1488 | + --}) | |
1489 | + self:sendMail(363, nil, rewardStr) | |
1477 | 1490 | end |
1478 | 1491 | end |
1479 | 1492 | seaport.collect = {} |
... | ... | @@ -1695,6 +1708,7 @@ function RolePlugin.bind(Role) |
1695 | 1708 | |
1696 | 1709 | if level > advL[1] then |
1697 | 1710 | self:checkTaskEnter("AdvLevel", {level = level}) |
1711 | + self:mylog("adv_action", {desc = "adv_level", int1 = level}) | |
1698 | 1712 | end |
1699 | 1713 | advL[1] = level |
1700 | 1714 | advL[2] = newExp |
... | ... | @@ -1763,6 +1777,7 @@ function RolePlugin.bind(Role) |
1763 | 1777 | info.type = hero:getProperty("type") |
1764 | 1778 | info.level = hero:getProperty("level") |
1765 | 1779 | info.wakeL = hero:getProperty("wakeL") |
1780 | + info.genius = hero:getProperty("genius") | |
1766 | 1781 | info.blockLevel = hero:getSkillLevel(4) |
1767 | 1782 | info.specialLevel = hero:getSkillLevel(1) |
1768 | 1783 | info.passiveLevel = hero:getSkillLevel(3) |
... | ... | @@ -1786,6 +1801,7 @@ function RolePlugin.bind(Role) |
1786 | 1801 | type = hero:getProperty("type"), |
1787 | 1802 | level = hero:getProperty("level"), |
1788 | 1803 | wakeL = hero:getProperty("wakeL"), |
1804 | + genius = hero:getProperty("genius"), | |
1789 | 1805 | } |
1790 | 1806 | end |
1791 | 1807 | format.heros = heros |
... | ... | @@ -2341,6 +2357,8 @@ function RolePlugin.bind(Role) |
2341 | 2357 | gift = gift .. k.."="..v.." " |
2342 | 2358 | end |
2343 | 2359 | mysqlproxy:insertEmail({roleId = self:getProperty("id"), emailId = mailId, createtime = createTime, attachments = gift, contentPms = contentPms}) |
2360 | + | |
2361 | + self:mylog("role_action", {desc="sendMail", int1 = mailId}) | |
2344 | 2362 | self.sendMailFlag = true |
2345 | 2363 | end |
2346 | 2364 | |
... | ... | @@ -2757,6 +2775,37 @@ function RolePlugin.bind(Role) |
2757 | 2775 | return towerBnous[SystemBnousType.SweepReward] or {} |
2758 | 2776 | end |
2759 | 2777 | |
2778 | + function Role:getPotionLevel(id) | |
2779 | + local level = self.dinerData:getProperty("dishTree"):getv(id, 1) | |
2780 | + local talentSet = csvdb["diner_talentCsv"][id] | |
2781 | + if not talentSet then return 0 end | |
2782 | + local talentData = talentSet[level] | |
2783 | + if not talentData then return 0 end | |
2784 | + | |
2785 | + if talentData.pointFront == "" then | |
2786 | + if talentData.levelFront ~= "" and not self:checkHangPass(tonumber(talentData.levelFront)) then | |
2787 | + if level == 0 then return 0 end | |
2788 | + end | |
2789 | + return level | |
2790 | + end | |
2791 | + | |
2792 | + if talentData.levelFront ~= "" and not self:checkHangPass(tonumber(talentData.levelFront)) then | |
2793 | + if level == 0 then return 0 end | |
2794 | + end | |
2795 | + | |
2796 | + for preId, needV in pairs(talentData.pointFront:toNumMap()) do | |
2797 | + if self.dinerData:getProperty("dishTree"):getv(preId, 0) < needV then | |
2798 | + if level == 0 then return 0 end | |
2799 | + if level == 1 then return 0 end | |
2800 | + end | |
2801 | + end | |
2802 | + return level | |
2803 | + end | |
2804 | + | |
2805 | + function Role:log_battle_hero(heroType, desc) | |
2806 | + self:mylog("hero_action", {desc = desc, int1 = heroType}) | |
2807 | + end | |
2808 | + | |
2760 | 2809 | end |
2761 | 2810 | |
2762 | 2811 | return RolePlugin |
2763 | 2812 | \ No newline at end of file | ... | ... |
src/models/Store.lua
... | ... | @@ -301,7 +301,9 @@ function Store:onBuyCard(type, duration, id, actid) |
301 | 301 | actData["unlock"] = 1 |
302 | 302 | if actCfg.condition ~= 0 then |
303 | 303 | actData["lvl"] = (actData["lvl"] or 0) + actCfg.condition |
304 | + role:mylog("act_action", {desc="buyBcLvl", int1=actCfg.condition, int2=actData["lvl"]}) | |
304 | 305 | end |
306 | + self.owner:mylog("act_action", {desc="buyBc", int1=id, int2=actData["lvl"] or 0}) | |
305 | 307 | self.owner.activity:updateActData("BattleCommand", actData) |
306 | 308 | end |
307 | 309 | end |
... | ... | @@ -438,19 +440,19 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
438 | 440 | end |
439 | 441 | end |
440 | 442 | if config ~= nil then |
441 | - local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId] | |
443 | + local rechargeCfg = csvdb["shop_normalCsv"][config.packId] | |
442 | 444 | if rechargeCfg then |
443 | 445 | limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} |
444 | 446 | self.owner:log("push_gift", { |
445 | 447 | gift_id = rechargeCfg.id, --礼包ID |
446 | - gift_name = rechargeCfg.title, --礼包名称 | |
448 | + gift_name = rechargeCfg.descId, --礼包名称 | |
447 | 449 | }) |
448 | 450 | -- 每日抽卡限时礼包 触发重置 |
449 | 451 | if eventType == TriggerEventType.DrawHeroCnt then |
450 | - local payR = self:getProperty("payR") | |
452 | + local payR = self:getProperty("buyR") | |
451 | 453 | if payR[rechargeCfg.id] then |
452 | 454 | payR[rechargeCfg.id] = nil |
453 | - self:updateProperty({field = "payR", value = payR}) | |
455 | + self:updateProperty({field = "buyR", value = payR}) | |
454 | 456 | end |
455 | 457 | end |
456 | 458 | self:updateProperty({field = "limitTPack", value = limitPack}) | ... | ... |
src/shared/ModelBaseMysql.lua
... | ... | @@ -280,12 +280,14 @@ function ModelBaseMysql:setProperties(fields, forceSave) |
280 | 280 | tostring(self), self.class.__cname, property, typ, type(value))) |
281 | 281 | |
282 | 282 | if typ == "number" or typ == "string" then |
283 | - if self[propname] == value then | |
284 | - return | |
283 | + if self[propname] ~= value then | |
284 | + self[propname] = value | |
285 | + self.cacheFields[property] = self[propname] | |
285 | 286 | end |
287 | + else | |
288 | + self[propname] = value | |
289 | + self.cacheFields[property] = self[propname] | |
286 | 290 | end |
287 | - self[propname] = value | |
288 | - self.cacheFields[property] = self[propname] | |
289 | 291 | end |
290 | 292 | end |
291 | 293 | if forceSave then | ... | ... |