Commit 460afa6ed62568461352cf56a3926b73669aed66
1 parent
84cf48b4
付费签到改为主动领取,战斗关卡不一定是当前挂机关卡
Showing
10 changed files
with
78 additions
and
47 deletions
Show diff stats
src/GlobalVar.lua
1 | 1 | XXTEA_KEY = "699D448D6D24f7F941E9F6E99F823E18" |
2 | -RESET_TIME = 0 | |
2 | +RESET_TIME = 4 | |
3 | 3 | |
4 | -START_RESET_TIME_BASE = 1584316800 -- 0时区 | |
4 | +START_RESET_TIME_BASE = 1584316800 + RESET_TIME * 3600 -- 0时区 | |
5 | 5 | DAY_SEC = 86400 |
6 | 6 | TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", START_RESET_TIME_BASE))) / 3600) -- 本地时区 |
7 | 7 | |
... | ... | @@ -256,7 +256,7 @@ SettingStatus = { |
256 | 256 | }, |
257 | 257 | } |
258 | 258 | |
259 | -EMAIL_LIMIT = 20 --邮件最大数量 | |
259 | +EMAIL_LIMIT = 50 --邮件最大数量 | |
260 | 260 | |
261 | 261 | RedPointTags = { |
262 | 262 | PvpCR = 1, | ... | ... |
src/ProtocolCode.lua
src/actions/ActivityAction.lua
... | ... | @@ -183,19 +183,21 @@ end |
183 | 183 | function _M.actPaySignRpc(agent, data) |
184 | 184 | local role = agent.role |
185 | 185 | local msg = MsgPack.unpack(data) |
186 | + local dayIndex = msg.day | |
186 | 187 | local actGoodsFlag = role.storeData:getProperty("actGoodsFlag") |
187 | 188 | local index = GetActGoodsIndex("paySignIn") |
188 | - local flag = actGoodsFlag[index] or 0 | |
189 | - if flag == 0 then return 1 end | |
189 | + local ts = actGoodsFlag[index] or 0 | |
190 | + if ts == 0 then return 1 end | |
190 | 191 | |
191 | - if not role.activity:isOpen("PaySignIn") then return 2 end | |
192 | + local open, actId = role.activity:isOpen("PaySignIn") | |
193 | + if not open then return 2 end | |
192 | 194 | |
193 | - local diffDay = diffFromOpen() + 1 | |
195 | + local diffDay = diffFromTs(ts) + 1 | |
194 | 196 | |
195 | 197 | local curData = role.activity:getActData("PaySignIn") |
196 | 198 | local reward, change = {} |
197 | 199 | for day, csvData in ipairs(csvdb["pay_signInCsv"]) do |
198 | - if day <= diffDay then | |
200 | + if day <= diffDay and day == dayIndex then | |
199 | 201 | if not curData[day] then |
200 | 202 | curData[day] = 1 |
201 | 203 | -- 奖励 |
... | ... | @@ -203,8 +205,8 @@ function _M.actPaySignRpc(agent, data) |
203 | 205 | reward[itemId] = (reward[itemId] or 0) + count |
204 | 206 | end |
205 | 207 | end |
206 | - else | |
207 | - break | |
208 | + --else | |
209 | + -- break | |
208 | 210 | end |
209 | 211 | end |
210 | 212 | if next(reward) then |
... | ... | @@ -213,7 +215,7 @@ function _M.actPaySignRpc(agent, data) |
213 | 215 | end |
214 | 216 | |
215 | 217 | role:log("activity", { |
216 | - activity_id = curData[0], -- 活动ID(或活动指定任务的ID) | |
218 | + activity_id = actId, -- 活动ID(或活动指定任务的ID) | |
217 | 219 | activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 |
218 | 220 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
219 | 221 | }) | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -59,7 +59,8 @@ local function checkReward(role) |
59 | 59 | |
60 | 60 | -- 特权卡挂机额外栏位 |
61 | 61 | local privExtraCnt = role.storeData:getHangSlotExtraCount() |
62 | - local selfFC = role:getProperty("hangBagLimit") + privExtraCnt | |
62 | + --local selfFC = role:getProperty("hangBagLimit") + privExtraCnt | |
63 | + local selfFC = 50 | |
63 | 64 | local selfIC = selfFC * globalCsv.idle_field_limit |
64 | 65 | |
65 | 66 | local function randomItem() |
... | ... | @@ -195,12 +196,12 @@ function _M.startBattleRpc(agent, data) |
195 | 196 | return 1 |
196 | 197 | end |
197 | 198 | |
198 | - local hangInfo = role:getProperty("hangInfo") or {} | |
199 | - if curData.main ~= 1 then | |
200 | - if carbonId ~= hangInfo.carbonId then | |
201 | - return 2 | |
202 | - end | |
203 | - end | |
199 | + --local hangInfo = role:getProperty("hangInfo") or {} | |
200 | + --if curData.main ~= 1 then | |
201 | + -- if carbonId ~= hangInfo.carbonId then | |
202 | + -- return 2 | |
203 | + -- end | |
204 | + --end | |
204 | 205 | |
205 | 206 | if role:checkHangPass(carbonId) then |
206 | 207 | return 3 |
... | ... | @@ -228,11 +229,11 @@ function _M.endBattleRpc(agent, data) |
228 | 229 | return 2 |
229 | 230 | end |
230 | 231 | |
231 | - if carbonData.main ~= 1 then | |
232 | - if carbonId ~= hangInfo.carbonId then | |
233 | - return 3 | |
234 | - end | |
235 | - end | |
232 | + --if carbonData.main ~= 1 then | |
233 | + -- if carbonId ~= hangInfo.carbonId then | |
234 | + -- return 3 | |
235 | + -- end | |
236 | + --end | |
236 | 237 | |
237 | 238 | if role:checkHangPass(carbonId) then |
238 | 239 | return 4 | ... | ... |
src/actions/HeroAction.lua
src/actions/RoleAction.lua
... | ... | @@ -655,7 +655,7 @@ function _M.openSpeedUpBoxRpc(agent, data) |
655 | 655 | for k , v in pairs(gfood) do |
656 | 656 | local itemId = v.id |
657 | 657 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 |
658 | - reward[itemId] = (reward[itemId] or 0) + math.floor(time / speed) * count | |
658 | + reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count) | |
659 | 659 | end |
660 | 660 | else |
661 | 661 | return 6 | ... | ... |
src/models/Activity.lua
... | ... | @@ -345,8 +345,9 @@ activityFunc[Activity.ActivityType.PaySignIn] = { |
345 | 345 | ["init"] = function(self, actType, isCrossDay, notify) |
346 | 346 | self:updateActData(actType, {}, not notify) |
347 | 347 | end, |
348 | - -- ["close"] = function(self, actType, notify) | |
349 | - -- end, | |
348 | + ["close"] = function(self, actType, notify) | |
349 | + self.owner.storeData:SetActGoodsFlag("paySignIn", 0) | |
350 | + end, | |
350 | 351 | } |
351 | 352 | |
352 | 353 | -- 充值反馈 | ... | ... |
src/models/Store.lua
... | ... | @@ -57,7 +57,7 @@ end |
57 | 57 | function Store:onCrossDay() |
58 | 58 | self:sendMonthCardEmail() |
59 | 59 | self:deleteExpireLimitGoods() |
60 | - self:checkPaySignReward() | |
60 | + --self:checkPaySignReward() | |
61 | 61 | end |
62 | 62 | |
63 | 63 | -- 删除过期商品 |
... | ... | @@ -356,32 +356,46 @@ function GetActGoodsIndex(goodsType) |
356 | 356 | return ActGoodsType[goodsType] or 0 |
357 | 357 | end |
358 | 358 | |
359 | --- 购买付费签到 按开服时间算奖励 | |
360 | -function Store:onBuyPaySignCard(dur) | |
361 | - local curTs = skynet.timex() | |
359 | +function Store:SetActGoodsFlag(goodsType, flag) | |
362 | 360 | local actGoodsFlag = self:getProperty("actGoodsFlag") or {} |
363 | - local goodsIndex = GetActGoodsIndex("paySignIn") | |
361 | + local goodsIndex = GetActGoodsIndex(goodsType) | |
364 | 362 | if goodsIndex == 0 then |
365 | 363 | print("get act goods index fail :paySignIn") |
366 | 364 | return |
367 | 365 | end |
368 | - actGoodsFlag[goodsIndex] = 1 | |
366 | + actGoodsFlag[goodsIndex] = flag | |
369 | 367 | self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) |
370 | - -- 发钱 | |
371 | - local change | |
372 | - local reward, curData = self.owner.activity:getPaySignReward() | |
373 | - if next(reward) then | |
374 | - self.owner.activity:updateActData("PaySignIn", curData) | |
375 | - reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}}) | |
376 | - end | |
368 | +end | |
369 | + | |
370 | +-- 购买付费签到 按开服时间算奖励 | |
371 | +function Store:onBuyPaySignCard(dur) | |
372 | + local curTs = skynet.timex() | |
377 | 373 | |
378 | - self.owner:log("activity", { | |
379 | - activity_id = 0, -- 活动ID(或活动指定任务的ID) | |
380 | - activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | |
381 | - activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
382 | - }) | |
374 | + self:SetActGoodsFlag("paySignIn", curTs) | |
383 | 375 | |
384 | - SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | |
376 | + --local actGoodsFlag = self:getProperty("actGoodsFlag") or {} | |
377 | + --local goodsIndex = GetActGoodsIndex("paySignIn") | |
378 | + --if goodsIndex == 0 then | |
379 | + -- print("get act goods index fail :paySignIn") | |
380 | + -- return | |
381 | + --end | |
382 | + --actGoodsFlag[goodsIndex] = 1 | |
383 | + --self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | |
384 | + -- 发钱 | |
385 | + --local change | |
386 | + --local reward, curData = self.owner.activity:getPaySignReward() | |
387 | + --if next(reward) then | |
388 | + -- self.owner.activity:updateActData("PaySignIn", curData) | |
389 | + -- reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}}) | |
390 | + --end | |
391 | + | |
392 | + --self.owner:log("activity", { | |
393 | + -- activity_id = 0, -- 活动ID(或活动指定任务的ID) | |
394 | + -- activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | |
395 | + -- activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
396 | + --}) | |
397 | + | |
398 | + --SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | |
385 | 399 | end |
386 | 400 | |
387 | 401 | function Store:checkPaySignReward() | ... | ... |
src/utils/CommonFunc.lua
... | ... | @@ -161,6 +161,18 @@ function diffFromOpen() |
161 | 161 | return math.floor((now - openTime) / DAY_SEC) |
162 | 162 | end |
163 | 163 | |
164 | +function diffFromTs(ts) | |
165 | + local now = skynet.timex() | |
166 | + local tm = os.date("*t", ts) | |
167 | + | |
168 | + local time = os.time({year = tm.year, month = tm.month, day = tm.day, hour = RESET_TIME}) | |
169 | + if now < time then | |
170 | + return -1 | |
171 | + end | |
172 | + | |
173 | + return math.floor((now - time) / DAY_SEC) | |
174 | +end | |
175 | + | |
164 | 176 | function getServerOpenTs() |
165 | 177 | local openTime = os.time{ |
166 | 178 | year = tonum(SERV_OPEN:sub(1,4)), | ... | ... |
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808