Commit e130015dbbac084bf432d78bbf4c457c75083f3a

Authored by 熊润斐
2 parents fe41ea5d 54f63c13

Merge branch 'tr/bugfix' into cn/develop

src/GlobalVar.lua
... ... @@ -83,6 +83,7 @@ ItemType = {
83 83 SpeedBox = 16, -- 加速箱子
84 84 SelectItemBox = 17, -- 自选箱子
85 85 CommonPaster = 18, -- 万能贴纸
  86 + BossTicket = 20, -- boss挑战门票
86 87 }
87 88  
88 89 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID
... ... @@ -313,6 +314,8 @@ CardType = {
313 314 PaySignCard = 6, -- 付费签到卡
314 315 BattlePassCard = 7, -- 探索指令
315 316 ActBattleCommandCard = 8, -- 战令活动卡
  317 + NormalMonthCardLevelUp = 9, -- 月卡升级
  318 + SuperMonthCardLevelUp = 10, -- 超级月卡升级
316 319 }
317 320  
318 321 ShopPackType = {
... ...
src/adv/Adv.lua
... ... @@ -2127,6 +2127,32 @@ function Adv:doActive(activeId, target)
2127 2127 self.battle.player:addBaseAttr(attr, value, vtype)
2128 2128 return true
2129 2129 end
  2130 + -- 13=将目标移动至地图随机点,可以移动至未翻开的空格
  2131 + doActiveEffect[13] = function(_)
  2132 + for _, target in ipairs(targers) do
  2133 + end
  2134 + return true
  2135 + end
  2136 + -- 14=获得drop,在有坐标时需要道具飞入背包的展现。
  2137 + doActiveEffect[14] = function(_, dropId)
  2138 + local gift = nil
  2139 + local dropData = csvdb["event_dropCsv"][dropId]
  2140 + if dropData then
  2141 + local item = dropData["range"]:randWeight(true)
  2142 + if item[1] ~= 0 then
  2143 + gift = {}
  2144 + gift[item[1]] = (gift[item[1]] or 0) + item[2]
  2145 + end
  2146 + end
  2147 + local roomId, blockId
  2148 + if not target or not target.roomId or not target.blockId then
  2149 + roomId, blockId = target.roomId, target.blockId
  2150 + end
  2151 + if gift then
  2152 + self:award(gift, {log = {desc = "doActive", int1 = activeId}}, {roomId = roomId, blockId = blockId})
  2153 + end
  2154 + return true
  2155 + end
2130 2156  
2131 2157 for _, effect in ipairs(activeData.effect:toArray()) do
2132 2158 local cur = effect:toArray(true, "=")
... ...
src/adv/AdvBlock.lua
... ... @@ -215,7 +215,9 @@ function Block:randomEvent()
215 215 randomFunc[AdvEventType.Trap] = function()
216 216 local data = csvdb["event_trapCsv"][self.event.id]
217 217 -- 因为一些神器效果 提前触发被动
218   - adv.battle.player:triggerPassive(Passive.CLICK_TRAP)
  218 + if not data.classify:sismember(1, " ") then
  219 + adv.battle.player:triggerPassive(Passive.CLICK_TRAP)
  220 + end
219 221  
220 222 local buffs = data.effect:toArray(true, "=")
221 223  
... ...
src/adv/AdvBuff.lua
... ... @@ -704,11 +704,13 @@ function Buff:overlay(releaser, data, layer)
704 704  
705 705 self.release = releaser or self.release
706 706 -- 叠加层数
  707 + local oldLayer = self.layer
707 708 self.layer = self.layer + layer
708 709 if maxLayer ~= 0 then
709 710 self.layer = math.min(maxLayer, self.layer)
710 711 end
711   - if self._overlay then
  712 +
  713 + if oldLayer ~= self.layer and self._overlay then
712 714 self:_overlay()
713 715 end
714 716  
... ...
src/adv/AdvMap.lua
... ... @@ -97,23 +97,28 @@ function Map:checkOver()
97 97 end
98 98 end
99 99  
  100 +function Map:randEmptyBlock()
  101 + local pool = {}
  102 + for _, room_ in pairs(self.rooms) do
  103 + for _, block_ in pairs(room_.blocks) do
  104 + if block_.isOpen and not block_.event then
  105 + table.insert(pool, {room_, block_})
  106 + end
  107 + end
  108 + end
  109 + if not next(pool) then return end
  110 + local idx = math.randomInt(1, #pool)
  111 + return pool[idx][1], pool[idx][2]
  112 +end
  113 +
100 114 --随机一个空的位置生成怪, 如果没有就没有
101 115 function Map:addNewMonsterRand(monsterId, where)
102 116 local room, block
103 117 if where then
104 118 room, block = where[1], where[2]
105 119 else
106   - local pool = {}
107   - for _, room_ in pairs(self.rooms) do
108   - for _, block_ in pairs(room_.blocks) do
109   - if block_.isOpen and not block_.event then
110   - table.insert(pool, {room_, block_})
111   - end
112   - end
113   - end
114   - if not next(pool) then return end
115   - local idx = math.randomInt(1, #pool)
116   - room, block = pool[idx][1], pool[idx][2]
  120 + room, block = self:randEmptyBlock()
  121 + if not room then return end
117 122 end
118 123  
119 124 if not monsterId then
... ...
src/adv/AdvPassive.lua
... ... @@ -565,6 +565,16 @@ end
565 565  
566 566 -- 在指定地点召唤event项目
567 567 function Passive:effect12(eventType, triggerPms, eventId, count, stage)
  568 + if eventType == AdvEventType.Monster then
  569 + for _, buff in ipairs(self.owner.battle.player.buffs) do
  570 + if not buff.isDel and buff:getType() == buff.Buff_NO_PASSIVE_MONSTER then
  571 + local effect = buff:effect()
  572 + if effect == 0 or effect == eventId then
  573 + return
  574 + end
  575 + end
  576 + end
  577 + end
568 578 local change = self.owner.battle.adv:getCurMap():layEventToStage(eventType, eventId, count, stage)
569 579 for _, one in ipairs(change) do
570 580 self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId)
... ...
1   -Subproject commit 9ab88a62f1c2ff1121be7547f02668db43dc1f75
  1 +Subproject commit f70c635c2f99d9800b629e41e13aa5115d5f69cd
... ...
src/models/Activity.lua
... ... @@ -1039,6 +1039,14 @@ activityFunc[Activity.ActivityType.BattleCommand] = {
1039 1039 ["init"] = function (self, actType, isCrossDay, notify, actId)
1040 1040 local data = {unlock = 0, freeR = "", payR = "", lvl = 0, sum = 0, week = 0}
1041 1041 self:updateActData(actType, data, not notify)
  1042 +
  1043 + local rechargeRecord = self.owner.storeData:getProperty("payR")
  1044 + for id, cfg in pairs(csvdb["shop_rechargeCsv"]) do
  1045 + if cfg.shop == 2 and cfg.type == CardType.ActBattleCommandCard then
  1046 + rechargeRecord[id] = nil
  1047 + end
  1048 + end
  1049 + self.owner.storeData:updateProperty({field="payR", value=rechargeRecord})
1042 1050 end,
1043 1051 ["check"] = function(self, actType, notify, id, count) -- 检查 itemid, count
1044 1052 local isOpen, actId = self:isOpen(actType)
... ... @@ -1082,6 +1090,15 @@ activityFunc[Activity.ActivityType.BattleCommand] = {
1082 1090 actData["week"] = 0
1083 1091 self:updateActData(actType, actData, true)
1084 1092 end,
  1093 + ["close"] = function (self, actType, notify, actId)
  1094 + local rechargeRecord = self.owner.storeData:getProperty("payR")
  1095 + for id, cfg in pairs(csvdb["shop_rechargeCsv"]) do
  1096 + if cfg.shop == 2 and cfg.type == CardType.ActBattleCommandCard then
  1097 + rechargeRecord[id] = nil
  1098 + end
  1099 + end
  1100 + self.owner.storeData:updateProperty({field="payR", value=rechargeRecord})
  1101 + end,
1085 1102 }
1086 1103  
1087 1104  
... ...
src/models/RolePlugin.lua
... ... @@ -137,6 +137,12 @@ function RolePlugin.bind(Role)
137 137 [ItemType.Potion] = function ()
138 138 self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log})
139 139 end,
  140 + [ItemType.BossTicket] = function ()
  141 + if not self.activity:isOpen("ChallengeLevel") then return end
  142 + local actData = self.activity:getActData("ChallengeLevel")
  143 + actData["ticket"] = (actData["ticket"] or 0) + count
  144 + self.activity:updateActData("ChallengeLevel", actData)
  145 + end,
140 146 }
141 147  
142 148 if count > 0 then
... ...
src/models/Store.lua
... ... @@ -3,7 +3,29 @@
3 3 local Store = class("Store", require("shared.ModelBase"))
4 4  
5 5 function Store:ctor(properties)
6   - Store.super.ctor(self, properties)
  6 + Store.super.ctor(self, properties)
  7 +end
  8 +
  9 +function Store:onLoad()
  10 + local monEx = self:getProperty("monthCardEx")
  11 + local smonEx = self:getProperty("smonthCardEx")
  12 + local monId = self:getProperty("monthCardId")
  13 + local smonId = self:getProperty("smonthCardId")
  14 + local timeNow = skynet.timex()
  15 + local flag = false
  16 + if monEx > timeNow and monId == 0 then
  17 + self:updateProperty({field = "monthCardId", value = 101})
  18 + self:updateProperty({field = "getMailT1", value = 0})
  19 + flag = true
  20 + end
  21 + if smonEx > timeNow and smonId == 0 then
  22 + self:updateProperty({field = "smonthCardId", value = 102})
  23 + self:updateProperty({field = "getMailT2", value = 0})
  24 + flag = true
  25 + end
  26 + if flag then
  27 + self:sendMonthCardEmail()
  28 + end
7 29 end
8 30  
9 31 ActGoodsType = {
... ... @@ -17,7 +39,9 @@ Store.schema = {
17 39 growFundR = {"string", ""}, -- 成长基金领取记录
18 40  
19 41 monthCardEx = {"number", 0}, -- 月卡过期时间戳
  42 + monthCardId = {"number", 0}, -- 月卡id
20 43 smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳
  44 + smonthCardId = {"number", 0}, -- 超级月卡id
21 45  
22 46 battleCard = {"number", 0}, -- 赛季卡
23 47 battleFR = {"string", ""}, -- 免费赛季卡领取记录
... ... @@ -51,7 +75,7 @@ function Store:updateProperty(params)
51 75 return
52 76 end
53 77 local newValue = self:getProperty(params.field)
54   - if not params.notNotify then
  78 + if not params.notNotify then
55 79 self:notifyUpdateProperty(params.field, newValue, oldValue)
56 80 end
57 81 end
... ... @@ -77,13 +101,16 @@ end
77 101 -- 发送月卡邮件
78 102 function Store:sendMonthCardEmail()
79 103 local timeNow = skynet.timex()
80   - local tabs = {{ex="monthCardEx", t="getMailT1", mail=MailId.MonthCard, alert=MailId.MonthCardEx},
81   - {ex="smonthCardEx", t="getMailT2", mail=MailId.SuperMonthCard, alert=MailId.SuperMonthCardEx}}
  104 +
  105 + local tabs = {{ex="monthCardEx", t="getMailT1", id= self:getProperty("monthCardId")},
  106 + {ex="smonthCardEx", t="getMailT2", id=self:getProperty("smonthCardId")}}
82 107 for _, v in ipairs(tabs) do
83 108 local ex = self:getProperty(v.ex)
84 109 local ts = self:getProperty(v.t) or 0
85   - local mailId = v.mail
86   - local alertId = v.alert
  110 + local cfg = csvdb["shop_cardCsv"][v.id] or {}
  111 +
  112 + local mailId = cfg.email
  113 + local alertId = cfg.email_2
87 114 local alertTs = dayLater(ex) - DAY_SEC
88 115 if ex > timeNow then
89 116 local cnt = 0
... ... @@ -184,24 +211,66 @@ function Store:getHangDropCoef()
184 211 return (1 + globalCsv.hang_drop_exp_coef) or 1, (1 + globalCsv.hang_drop_item_coef) or 1
185 212 end
186 213  
  214 +function Store:getCurMonthCardLvl(isSuper)
  215 + local id = 0
  216 + if isSuper then
  217 + id = self:getProperty("smonthCardId") or 0
  218 + else
  219 + id = self:getProperty("monthCardId") or 0
  220 + end
  221 + local cfg = csvdb["shop_cardCsv"][id]
  222 + if not cfg then return 0 end
  223 +
  224 + return cfg.level or 0
  225 +end
187 226  
188 227 -- 购买通行证
189 228 function Store:onBuyCard(type, duration, id, actid)
190 229 local timeNow = skynet.timex()
191 230 if type == CardType.NormalMonthCard then
192 231 if self:isMonthCardExpire() then
  232 + self:updateProperty({field = "monthCardId", value = id})
193 233 self:updateProperty({field = "monthCardEx", value = timeNow + duration})
194 234 else
195 235 self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
196 236 end
197 237 self:sendMonthCardEmail()
  238 + elseif type == CardType.NormalMonthCardLevelUp then
  239 + if self:isMonthCardExpire() then
  240 + skynet.error(string.format("month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
  241 + else
  242 + local cfg = csvdb["shop_cardCsv"][id]
  243 + if not cfg then return end
  244 + local dif = cfg.level - self:getCurMonthCardLvl(false)
  245 + if dif > 1 and dif < 0 then
  246 + return
  247 + end
  248 + self:updateProperty({field = "monthCardId", value = id})
  249 + self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
  250 + end
  251 + self:sendMonthCardEmail()
198 252 elseif type == CardType.SuperMonthCard then
199 253 if self:isSuperMonthCardExpire() then
  254 + self:updateProperty({field = "smonthCardId", value = id})
200 255 self:updateProperty({field = "smonthCardEx", value = timeNow + duration})
201 256 else
202 257 self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
203 258 end
204 259 self:sendMonthCardEmail()
  260 + elseif type == CardType.SuperMonthCardLevelUp then
  261 + if self:isSuperMonthCardExpire() then
  262 + skynet.error(string.format("super month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
  263 + else
  264 + local cfg = csvdb["shop_cardCsv"][id]
  265 + if not cfg then return end
  266 + local dif = cfg.level - self:getCurMonthCardLvl(true)
  267 + if dif > 1 and dif < 0 then
  268 + return
  269 + end
  270 + self:updateProperty({field = "smonthCardId", value = id})
  271 + self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
  272 + end
  273 + self:sendMonthCardEmail()
205 274 elseif type == CardType.PrivilegeCard then
206 275 if self:isPrivCardExpire() then
207 276 self:updateProperty({field = "privCardEx", value = timeNow + duration})
... ... @@ -253,7 +322,7 @@ function Store:notifyUpdateProperty(field, newValue, oldValue)
253 322 key = field,
254 323 newValue = newValue,
255 324 oldValue = oldValue,
256   - }
  325 + }
257 326 SendPacket(actionCodes.Store_updateproperty, MsgPack.pack(datas))
258 327 end
259 328  
... ... @@ -494,6 +563,8 @@ function Store:data()
494 563 actGoodsFlag = self:getProperty("actGoodsFlag"),
495 564 bpInfo = self:getProperty("bpInfo"),
496 565 totalRR = self:getProperty("totalRR"),
  566 + monthCardId = self:getProperty("monthCardId"),
  567 + smonthCardId = self:getProperty("smonthCardId"),
497 568 }
498 569 end
499 570  
... ...