Commit ba8b6160c812a04e50da801c68007bd5e1e94d2c

Authored by jiyue
2 parents 83734e23 9e5f9701

Merge branch 'cn/develop' into cn/publish/preview

src/actions/ActivityAction.lua
... ... @@ -645,7 +645,7 @@ function _M.startBattleRpc(agent, data)
645 645 award[k] = v * count
646 646 end
647 647 local reward, change = role:award(award, {log = {desc = "actBattle", int1 = actid, int2 = count or 0}})
648   - SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change)))
  648 +
649 649 changeFlag = true
650 650 actData["ticket"] = ticket - num
651 651  
... ... @@ -665,11 +665,15 @@ function _M.startBattleRpc(agent, data)
665 665 end
666 666 role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal)
667 667 end
  668 + role.activity:updateActData("ChallengeLevel", actData)
668 669  
  670 + SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change)))
  671 +
  672 + return true
669 673 end
670   - if changeFlag then
671   - role.activity:updateActData("ChallengeLevel", actData)
672   - end
  674 + --if changeFlag then
  675 + -- role.activity:updateActData("ChallengeLevel", actData)
  676 + --end
673 677  
674 678 return true
675 679 end
... ...
src/actions/HttpAction.lua
... ... @@ -143,7 +143,7 @@ function _M.gm_action(query)
143 143 role:startActionUcode()
144 144 local status = gmFuncs[query.cmd](role, query)
145 145 role:endActionUcode()
146   - role:update()
  146 + role:saveRoleData()
147 147  
148 148 return status
149 149 end
... ... @@ -174,6 +174,7 @@ function _M.pay_action(query)
174 174 role:startActionUcode()
175 175 local status = gmFuncs[query.cmd](role, query)
176 176 role:endActionUcode()
  177 + role:saveRoleData()
177 178  
178 179 return status
179 180 end
... ...
src/models/Activity.lua
... ... @@ -497,6 +497,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = {
497 497 --role:checkTaskEnter("HangPass", {id = 0})
498 498 role:checkCalendaTask(true, 15, 3)
499 499 role:checkTaskEnter("HeroStarCollect", {})
  500 + role:checkTaskEnter("HeroStartSum", {})
500 501 role:checkTaskEnter("RuneQualityCollect", {})
501 502  
502 503 end,
... ... @@ -565,6 +566,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = {
565 566 --role:checkTaskEnter("HangPass", {id = 0})
566 567 role:checkCalendaTask(true, 15, 3)
567 568 role:checkTaskEnter("HeroStarCollect", {})
  569 + role:checkTaskEnter("HeroStartSum", {})
568 570 role:checkTaskEnter("RuneQualityCollect", {})
569 571  
570 572 end,
... ... @@ -669,6 +671,7 @@ activityFunc[Activity.ActivityType.NewUserTask] = {
669 671 --role:checkTaskEnter("HangPass", {id = 0})
670 672 role:checkCalendaTask(true, 15, 3)
671 673 role:checkTaskEnter("HeroStarCollect", {})
  674 + role:checkTaskEnter("HeroStartSum", {})
672 675 role:checkTaskEnter("RuneQualityCollect", {})
673 676  
674 677 end,
... ...
src/models/RoleCross.lua
... ... @@ -167,6 +167,7 @@ RoleCross.bind = function (Role)
167 167 })
168 168 self:checkTaskEnter("Wake", {heroType = heroId, wakeL = initData.heros.wakeL})
169 169 self:checkTaskEnter("WakeCG", {heroType = heroId})
  170 + self:checkTaskEnter("WakeCGSum", {count = 1})
170 171 self:checkTaskEnter("HeroTalent", {heroType = heroId, alv = aheadLevel})
171 172  
172 173 end
... ...
src/models/RolePlugin.lua
... ... @@ -32,6 +32,8 @@ function RolePlugin.bind(Role)
32 32 function Role:onOfflineEvent()
33 33 -- 设置最新的登录时间
34 34 self:setProperty("ltime", skynet.timex())
  35 +
  36 + self:saveRoleData()
35 37 end
36 38  
37 39 local function checkItemCount(self, itemId, count)
... ... @@ -606,6 +608,7 @@ function RolePlugin.bind(Role)
606 608 }
607 609 if heroInfo.wakeL == 3 then
608 610 self:checkTaskEnter("WakeCG", {heroType = heroType})
  611 + self:checkTaskEnter("WakeCGSum", {count = 1})
609 612 end
610 613 local newHero = require("models.Hero").new(heroInfo)
611 614 newHero:create()
... ... @@ -2051,10 +2054,10 @@ function RolePlugin.bind(Role)
2051 2054  
2052 2055 local SAVE_DATA_INTERVAL = 3
2053 2056 function Role:saveRoleData(now)
2054   - if now - self._lastSaveTs < SAVE_DATA_INTERVAL then
  2057 + if now and (now - self._lastSaveTs < SAVE_DATA_INTERVAL) then
2055 2058 return
2056 2059 end
2057   - self._lastSaveTs = now
  2060 + self._lastSaveTs = now or skynet.timex()
2058 2061 self:update()
2059 2062 local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre}
2060 2063 for _, info in ipairs(objs) do
... ...
src/models/RoleTask.lua
... ... @@ -17,6 +17,9 @@ local TaskType = {
17 17 HeroStarCollect = 12, -- 英雄星级收集进度
18 18 DrawHeroNotFriend = 13, -- 非友情招募 -- count
19 19 DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count
  20 + HeroStartSum = 15, -- 英雄星级总数
  21 + WakeCGSum = 16, -- 累计解锁xx张CG
  22 +
20 23  
21 24 --装备相关
22 25 AddEquip = 101, -- 获得装备 - equipId rarity
... ... @@ -325,6 +328,8 @@ local CalendaTaskListener = {
325 328 [TaskType.ActBattlePass] = {{40, 3, f("chapterId")}},
326 329 [TaskType.AdvPass] = {{41, 3, f("id")}},
327 330 [TaskType.CostJade] = {{43, 1, f("count")}},
  331 + [TaskType.HeroStartSum] = {{44, 3}},
  332 + [TaskType.WakeCGSum] = {{45, 1, f("count")}},
328 333 }
329 334 }
330 335  
... ... @@ -745,7 +750,7 @@ function RoleTask.bind(Role)
745 750 for _,uid in pairs(hero:getRunes()) do
746 751 if uid > 0 then
747 752 local runeData = self.runeBag[uid]
748   - if runeData then
  753 + if runeData then
749 754 local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")]
750 755  
751 756 if csvData and cfg.condition2 <= csvData.rarity then
... ... @@ -765,9 +770,9 @@ function RoleTask.bind(Role)
765 770 end
766 771 elseif cfg.type == 15 then -- 通关关卡
767 772 if (calTask[id] or 0) == 0 then
768   - if self:checkHangPass(cfg.condition2) then
  773 + if self:checkHangPass(cfg.condition2) then
769 774 calTask[id] = 1
770   - end
  775 + end
771 776 --local hangPass = self:getProperty("hangPass")
772 777 --local diff = math.floor(cfg.condition2 / 10000)
773 778 --if (hangPass[diff] or 0) >= cfg.condition2 then
... ... @@ -798,7 +803,7 @@ function RoleTask.bind(Role)
798 803 elseif cfg.type == 37 then -- 拾荒使用道具
799 804 if cfg.condition2 == param1 then
800 805 calTask[id] = (calTask[id] or 0) + (param2 or 0)
801   - end
  806 + end
802 807 elseif cfg.type == 38 then -- 和指定建筑交互
803 808 local condArr = cfg.condition3:toArray(true, "=")
804 809 for i = 0, #condArr do
... ... @@ -827,6 +832,14 @@ function RoleTask.bind(Role)
827 832 if cfg.condition2 <= param1 and param2 == 1 then
828 833 calTask[id] = (calTask[id] or 0) + 1
829 834 end
  835 + elseif cfg.type == 44 then --玩家拥有拾荒者总星级达到xxx
  836 + local count = 0
  837 + for _, hero in pairs(self.heros) do
  838 + count = count + hero:getProperty("wakeL")
  839 + end
  840 + if (calTask[id] or 0) < count then
  841 + calTask[id] = count
  842 + end
830 843 end
831 844 end
832 845 end
... ...