Commit 60ef966ec3cd1462a62743e952baf57a602a11ff

Authored by zhangqijia
2 parents 25ec4b29 e28973d5

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

# Conflicts:
#	src/actions/GmAction.lua
#	src/actions/HangAction.lua
#	src/models/Daily.lua
@@ -156,6 +156,7 @@ ItemId = { @@ -156,6 +156,7 @@ ItemId = {
156 AdvPower = 4701, -- 拾荒体力 156 AdvPower = 4701, -- 拾荒体力
157 CrisisScore = 8010, -- 积分 157 CrisisScore = 8010, -- 积分
158 MonthCard = 31000, --兑换月卡的物品 158 MonthCard = 31000, --兑换月卡的物品
  159 + TreasureMap = 861, --藏宝图
159 } 160 }
160 161
161 TimeReset = { 162 TimeReset = {
src/actions/HangAction.lua
@@ -1200,19 +1200,20 @@ end @@ -1200,19 +1200,20 @@ end
1200 function _M.takeTreasureRpc(agent, data) 1200 function _M.takeTreasureRpc(agent, data)
1201 local role = agent.role 1201 local role = agent.role
1202 local extraCount = role.dailyData:getProperty("treasureExtraCount") --每日发现额外宝藏使用次数(累计),隔天清零 1202 local extraCount = role.dailyData:getProperty("treasureExtraCount") --每日发现额外宝藏使用次数(累计),隔天清零
1203 - local mapCount = role.dailyData:getProperty("treasureMapCount")  
1204 local baseExtra = role.dailyData:getProperty("treasureBaseExtra") 1203 local baseExtra = role.dailyData:getProperty("treasureBaseExtra")
1205 1204
1206 if extraCount >= globalCsv.idle_treasure_extra_limie then return 1 end 1205 if extraCount >= globalCsv.idle_treasure_extra_limie then return 1 end
1207 - if mapCount <= 0 then return 2 end  
1208 1206
1209 - baseExtra = baseExtra + globalCsv.idle_treasure_base_extra 1207 + local cost ={[ItemId.TreasureMap] = 1}
  1208 + if not role:checkItemEnough(cost) then return 2 end
1210 1209
  1210 + baseExtra = baseExtra + globalCsv.idle_treasure_base_extra
1211 local tmpTreasure, treasureListExtra = role.dailyData:getTreasureExtra(baseExtra) 1211 local tmpTreasure, treasureListExtra = role.dailyData:getTreasureExtra(baseExtra)
1212 if not tmpTreasure then return 3 end 1212 if not tmpTreasure then return 3 end
1213 1213
  1214 + if not role:costItems(cost, {log = {desc = "TreasureMap", int1 = ItemId.TreasureMap, int2 = 1}}) then return 4 end
  1215 +
1214 role.dailyData:updateProperty({field = "treasureExtraCount", delta = 1}) 1216 role.dailyData:updateProperty({field = "treasureExtraCount", delta = 1})
1215 - role.dailyData:updateProperty({field = "treasureMapCount", value = mapCount - 1})  
1216 role.dailyData:updateProperty({field = "treasureBaseExtra", value = baseExtra}) 1217 role.dailyData:updateProperty({field = "treasureBaseExtra", value = baseExtra})
1217 1218
1218 SendPacket(actionCodes.Hang_takeTreasureRpc, MsgPack.pack({treasureListExtra = treasureListExtra, treasure = tmpTreasure})) 1219 SendPacket(actionCodes.Hang_takeTreasureRpc, MsgPack.pack({treasureListExtra = treasureListExtra, treasure = tmpTreasure}))
@@ -1226,10 +1227,9 @@ function _M.treasureMapRpc(agent,data) @@ -1226,10 +1227,9 @@ function _M.treasureMapRpc(agent,data)
1226 local cost ={[ItemId.Jade] = globalCsv.idle_treasure_buy * count} 1227 local cost ={[ItemId.Jade] = globalCsv.idle_treasure_buy * count}
1227 if not role:checkItemEnough(cost) then return 1 end 1228 if not role:checkItemEnough(cost) then return 1 end
1228 if not role:costItems(cost, {log = {desc = "treasureMap", int1 = count}}) then return 2 end 1229 if not role:costItems(cost, {log = {desc = "treasureMap", int1 = count}}) then return 2 end
1229 - role.dailyData:updateProperty({field = "treasureMapCount", delta = count})  
1230 1230
1231 - local treasureMapCount = role.dailyData:getProperty("treasureMapCount")  
1232 - SendPacket(actionCodes.Hang_treasureMapRpc, MsgPack.pack({mapCount = treasureMapCount})) 1231 + local reward, change = role:award({[ItemId.TreasureMap] = count}, {log = {desc = "TreasureMap", int1 = ItemId.TreasureMap, int2 = count}})
  1232 + SendPacket(actionCodes.Hang_treasureMapRpc, MsgPack.pack(role:packReward(reward, change)))
1233 return true 1233 return true
1234 end 1234 end
1235 1235
src/models/Daily.lua
@@ -38,7 +38,6 @@ Daily.schema = { @@ -38,7 +38,6 @@ Daily.schema = {
38 treasureList = {"table", {}}, --挂机图鉴 38 treasureList = {"table", {}}, --挂机图鉴
39 39
40 treasureListExtra = {"table", {}}, --额外宝藏,挂机图鉴扩展功能 40 treasureListExtra = {"table", {}}, --额外宝藏,挂机图鉴扩展功能
41 - treasureMapCount = {"number", 0}, --宝藏图,消耗一张宝藏图可以发现一次额外宝藏  
42 treasureExtraCount = {"number", 0}, --每日发现额外宝藏使用次数(累计),隔天清零 41 treasureExtraCount = {"number", 0}, --每日发现额外宝藏使用次数(累计),隔天清零
43 treasureBaseExtra = {"number", 0}, --额外宝藏资源值 42 treasureBaseExtra = {"number", 0}, --额外宝藏资源值
44 43
@@ -131,7 +130,6 @@ function Daily:data() @@ -131,7 +130,6 @@ function Daily:data()
131 treasureBase = self:getProperty("treasureBase"), 130 treasureBase = self:getProperty("treasureBase"),
132 treasureList = self:getProperty("treasureList"), 131 treasureList = self:getProperty("treasureList"),
133 treasureListExtra = self:getProperty("treasureListExtra"), 132 treasureListExtra = self:getProperty("treasureListExtra"),
134 - treasureMapCount = self:getProperty("treasureMapCount"),  
135 treasureExtraCount = self:getProperty("treasureExtraCount"), 133 treasureExtraCount = self:getProperty("treasureExtraCount"),
136 treasureBaseExtra = self:getProperty("treasureBaseExtra"), 134 treasureBaseExtra = self:getProperty("treasureBaseExtra"),
137 chatTimes = self:getProperty("chatTimes"), 135 chatTimes = self:getProperty("chatTimes"),
src/models/DailyPlugin.lua
@@ -20,26 +20,31 @@ function DailyPlugin.bind(Daily) @@ -20,26 +20,31 @@ function DailyPlugin.bind(Daily)
20 end 20 end
21 21
22 --CD 22 --CD
23 - function Daily:checkTreasureExpired(treasureAttr, treasureList) 23 + function Daily:checkTreasureExpired(treasureAttr, treasureList, isExtra)
24 local curInfo = treasureList[treasureAttr.id] 24 local curInfo = treasureList[treasureAttr.id]
  25 + local now = skynet.timex()
25 if curInfo then 26 if curInfo then
26 -- check finish 27 -- check finish
27 if curInfo["expire_time"] then 28 if curInfo["expire_time"] then
28 if curInfo.cool_time > 1 then 29 if curInfo.cool_time > 1 then
29 - if skynet.timex() >= curInfo["expire_time"] then 30 + if now >= curInfo["expire_time"] then
30 treasureList[treasureAttr.id] = nil 31 treasureList[treasureAttr.id] = nil
31 curInfo = clone(treasureAttr) 32 curInfo = clone(treasureAttr)
32 - elseif skynet.timex() >= curInfo["expire_time"] - curInfo.cool_time * oneDay then --未冷却 33 + elseif now >= curInfo["expire_time"] - curInfo.cool_time * oneDay then --未冷却
33 curInfo = nil 34 curInfo = nil
34 else 35 else
35 curInfo = clone(treasureAttr) 36 curInfo = clone(treasureAttr)
36 end 37 end
37 else 38 else
38 - if skynet.timex() >= curInfo["expire_time"] then 39 + if now >= curInfo["expire_time"] then
39 treasureList[treasureAttr.id] = nil 40 treasureList[treasureAttr.id] = nil
40 end 41 end
41 curInfo = clone(treasureAttr) 42 curInfo = clone(treasureAttr)
42 end 43 end
  44 + else
  45 + if isExtra then
  46 + curInfo = nil
  47 + end
43 end 48 end
44 else 49 else
45 curInfo = clone(treasureAttr) 50 curInfo = clone(treasureAttr)
@@ -48,19 +53,23 @@ function DailyPlugin.bind(Daily) @@ -48,19 +53,23 @@ function DailyPlugin.bind(Daily)
48 return curInfo 53 return curInfo
49 end 54 end
50 55
51 - --绑定通关关卡 56 + --绑定通关关卡 每日宝藏
52 function Daily:checkChapters(treasureList, treasureListOther) 57 function Daily:checkChapters(treasureList, treasureListOther)
53 local chapters = {} 58 local chapters = {}
54 local tmp_chapters = {} 59 local tmp_chapters = {}
55 60
  61 + --不可以绑定的关卡
  62 + --1. 正在挖宝,未挖到
  63 + --2. 已经挖到宝藏,但未领取
  64 + --3. 正在挂机
56 for _, curInfo in pairs(treasureList or {}) do 65 for _, curInfo in pairs(treasureList or {}) do
57 - if curInfo["expire_time"] or not curInfo["end_time"] then 66 + if (not curInfo["expire_time"] and curInfo["end_time"]) then
58 tmp_chapters[curInfo.chapter_id] = curInfo 67 tmp_chapters[curInfo.chapter_id] = curInfo
59 end 68 end
60 end 69 end
61 70
62 for _, curInfo in pairs(treasureListOther or {}) do 71 for _, curInfo in pairs(treasureListOther or {}) do
63 - if curInfo["expire_time"] or not curInfo["end_time"] then 72 + if (not curInfo["expire_time"] and curInfo["end_time"]) then
64 tmp_chapters[curInfo.chapter_id] = curInfo 73 tmp_chapters[curInfo.chapter_id] = curInfo
65 end 74 end
66 end 75 end
@@ -69,10 +78,42 @@ function DailyPlugin.bind(Daily) @@ -69,10 +78,42 @@ function DailyPlugin.bind(Daily)
69 for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do 78 for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do
70 if chapter_id ~= hangInfo.carbonId then 79 if chapter_id ~= hangInfo.carbonId then
71 if self.owner:checkHangPass(chapter_id) then 80 if self.owner:checkHangPass(chapter_id) then
72 - if next(tmp_chapters) and not tmp_chapters[chapter_id] then  
73 - chapters[chapter_id] = val  
74 - else  
75 - chapters[chapter_id] = val 81 + if not tmp_chapters[chapter_id] then
  82 + chapters[chapter_id] = {treasure_weight=val.treasure_weight}
  83 + end
  84 + end
  85 + end
  86 +
  87 + end
  88 + return chapters
  89 + end
  90 +
  91 + --绑定通关关卡 额外宝藏
  92 + function Daily:checkChaptersExtra(treasureList, treasureListOther)
  93 + local chapters = {}
  94 + local tmp_chapters = {}
  95 +
  96 + --不可以绑定的关卡
  97 + --1. 未过期(未挖,在挖,未领)
  98 + --2. 正在挂机
  99 + for _, curInfo in pairs(treasureList or {}) do
  100 + if not curInfo["expire_time"] then
  101 + tmp_chapters[curInfo.chapter_id] = curInfo
  102 + end
  103 + end
  104 +
  105 + for _, curInfo in pairs(treasureListOther or {}) do
  106 + if not curInfo["expire_time"] then
  107 + tmp_chapters[curInfo.chapter_id] = curInfo
  108 + end
  109 + end
  110 +
  111 + local hangInfo = self.owner:getProperty("hangInfo") or {}
  112 + for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do
  113 + if chapter_id ~= hangInfo.carbonId then
  114 + if self.owner:checkHangPass(chapter_id) then
  115 + if not tmp_chapters[chapter_id] then
  116 + chapters[chapter_id] = {treasure_weight=val.treasure_weight}
76 end 117 end
77 end 118 end
78 end 119 end
@@ -130,7 +171,7 @@ function DailyPlugin.bind(Daily) @@ -130,7 +171,7 @@ function DailyPlugin.bind(Daily)
130 171
131 --只抓一个 额外宝藏 172 --只抓一个 额外宝藏
132 function Daily:getOneTreasureExtra(treasureList, tmpTreasure, treasureBase, treasureListOther) 173 function Daily:getOneTreasureExtra(treasureList, tmpTreasure, treasureBase, treasureListOther)
133 - local chapters = self:checkChapters(treasureList, treasureListOther) 174 + local chapters = self:checkChaptersExtra(treasureList, treasureListOther)
134 if not chapters or not next(chapters) then return end 175 if not chapters or not next(chapters) then return end
135 176
136 --扣除在挖宝列表里未过期宝藏的资源值 177 --扣除在挖宝列表里未过期宝藏的资源值
@@ -177,14 +218,15 @@ function DailyPlugin.bind(Daily) @@ -177,14 +218,15 @@ function DailyPlugin.bind(Daily)
177 function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId, treasureBase) 218 function Daily:checkTreasureChapterId(curInfo, treasureList, chapterId, treasureBase)
178 if not curInfo then return nil end 219 if not curInfo then return nil end
179 220
  221 + local now = skynet.timex()
180 local treasure = nil 222 local treasure = nil
181 --开始挖宝关卡ID=挂机关卡ID 223 --开始挖宝关卡ID=挂机关卡ID
182 if chapterId == curInfo.chapter_id then 224 if chapterId == curInfo.chapter_id then
183 --开始挖宝 225 --开始挖宝
184 if not curInfo["end_time"] then 226 if not curInfo["end_time"] then
185 - curInfo["end_time"] = skynet.timex() + curInfo.working_time 227 + curInfo["end_time"] = now + curInfo.working_time
186 else 228 else
187 - if skynet.timex() >= curInfo["end_time"] then 229 + if now >= curInfo["end_time"] then
188 if curInfo.cool_time > 1 then 230 if curInfo.cool_time > 1 then
189 --宝藏冷却时间 231 --宝藏冷却时间
190 if not curInfo["expire_time"] then 232 if not curInfo["expire_time"] then
@@ -192,11 +234,11 @@ function DailyPlugin.bind(Daily) @@ -192,11 +234,11 @@ function DailyPlugin.bind(Daily)
192 treasureBase = treasureBase - curInfo["treasure_value"] 234 treasureBase = treasureBase - curInfo["treasure_value"]
193 235
194 treasure = treasureList[curInfo.id] 236 treasure = treasureList[curInfo.id]
195 - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay 237 + curInfo["expire_time"] = now + curInfo.cool_time * oneDay
196 end 238 end
197 else 239 else
198 --已经领取宝藏 检索宝藏冷却时间 240 --已经领取宝藏 检索宝藏冷却时间
199 - if skynet.timex() >= curInfo["expire_time"] then 241 + if now >= curInfo["expire_time"] then
200 treasureList[curInfo.id] = nil 242 treasureList[curInfo.id] = nil
201 end 243 end
202 end 244 end
@@ -213,7 +255,7 @@ function DailyPlugin.bind(Daily) @@ -213,7 +255,7 @@ function DailyPlugin.bind(Daily)
213 else 255 else
214 --已经开始挖宝 256 --已经开始挖宝
215 if curInfo["end_time"] then 257 if curInfo["end_time"] then
216 - if skynet.timex() >= curInfo["end_time"] then 258 + if now >= curInfo["end_time"] then
217 if curInfo.cool_time > 1 then 259 if curInfo.cool_time > 1 then
218 --宝藏冷却时间 260 --宝藏冷却时间
219 if not curInfo["expire_time"] then 261 if not curInfo["expire_time"] then
@@ -221,12 +263,12 @@ function DailyPlugin.bind(Daily) @@ -221,12 +263,12 @@ function DailyPlugin.bind(Daily)
221 treasureBase = treasureBase - curInfo["treasure_value"] 263 treasureBase = treasureBase - curInfo["treasure_value"]
222 264
223 treasure = treasureList[curInfo.id] 265 treasure = treasureList[curInfo.id]
224 - curInfo["expire_time"] = skynet.timex() + curInfo.cool_time * oneDay 266 + curInfo["expire_time"] = now + curInfo.cool_time * oneDay
225 end 267 end
226 268
227 else 269 else
228 --已经领取宝藏 检索宝藏冷却时间 270 --已经领取宝藏 检索宝藏冷却时间
229 - if skynet.timex() >= curInfo["expire_time"] then 271 + if now >= curInfo["expire_time"] then
230 treasureList[curInfo.id] = nil 272 treasureList[curInfo.id] = nil
231 end 273 end
232 end 274 end
@@ -267,13 +309,14 @@ function DailyPlugin.bind(Daily) @@ -267,13 +309,14 @@ function DailyPlugin.bind(Daily)
267 309
268 --宝藏图鉴 310 --宝藏图鉴
269 function Daily:getTreasureList() 311 function Daily:getTreasureList()
270 - local tmpcsv = csvdb["idle_treasureCsv"]  
271 local treasureList = self:getProperty("treasureList") or {} --挖宝列表 过期删除 领取奖励删除 跨天更新 312 local treasureList = self:getProperty("treasureList") or {} --挖宝列表 过期删除 领取奖励删除 跨天更新
272 local treasureListExtra = self:getProperty("treasureListExtra") or {} --额外宝藏列表 过期删除 领取奖励删除 跨天更新 313 local treasureListExtra = self:getProperty("treasureListExtra") or {} --额外宝藏列表 过期删除 领取奖励删除 跨天更新
  314 +
  315 + --获取宝藏列表(与额外宝藏逻辑不同) 进行随机获取宝藏
273 local tmpTreasure = {} 316 local tmpTreasure = {}
274 local treasureBase = globalCsv.idle_treasure_base + self.owner:getBnousTreasureBaseMaximum() 317 local treasureBase = globalCsv.idle_treasure_base + self.owner:getBnousTreasureBaseMaximum()
275 - for _, val in pairs(tmpcsv) do  
276 - if self:checkUnlock(val) == true then 318 + for _, val in pairs(csvdb["idle_treasureCsv"]) do
  319 + if self:checkUnlock(val) then
277 local treasure = self:checkTreasureExpired(val, treasureList) 320 local treasure = self:checkTreasureExpired(val, treasureList)
278 if treasure then 321 if treasure then
279 table.insert(tmpTreasure, treasure) 322 table.insert(tmpTreasure, treasure)
@@ -328,26 +371,26 @@ function DailyPlugin.bind(Daily) @@ -328,26 +371,26 @@ function DailyPlugin.bind(Daily)
328 --宝藏功能优化——增加"发现宝藏"功能 371 --宝藏功能优化——增加"发现宝藏"功能
329 function Daily:buyTreasureExtra(treasureList) 372 function Daily:buyTreasureExtra(treasureList)
330 local boughtTreasure = {} 373 local boughtTreasure = {}
331 - local treasureBase = self:getProperty("treasureExtraBase") 374 + local treasureBase = self:getProperty("treasureBaseExtra")
332 for id, val in pairs(treasureList) do 375 for id, val in pairs(treasureList) do
333 if treasureBase >= val.treasure_value then 376 if treasureBase >= val.treasure_value then
334 boughtTreasure[id] = val 377 boughtTreasure[id] = val
335 treasureBase = treasureBase - val.treasure_value 378 treasureBase = treasureBase - val.treasure_value
336 end 379 end
337 end 380 end
338 - self:updateProperty({field = "treasureExtraBase", value = treasureBase}) 381 + self:updateProperty({field = "treasureBaseExtra", value = treasureBase})
339 return boughtTreasure 382 return boughtTreasure
340 end 383 end
341 384
342 function Daily:getTreasureExtra(tmpBaseExtra) 385 function Daily:getTreasureExtra(tmpBaseExtra)
343 - local tmpcsv = csvdb["idle_treasureCsv"]  
344 local treasureList = self:getProperty("treasureList") or {} --挖宝列表 过期删除 领取奖励删除 跨天更新 386 local treasureList = self:getProperty("treasureList") or {} --挖宝列表 过期删除 领取奖励删除 跨天更新
345 local treasureListExtra = self:getProperty("treasureListExtra") or {} --额外宝藏 过期删除 领取奖励删除 跨天更新 387 local treasureListExtra = self:getProperty("treasureListExtra") or {} --额外宝藏 过期删除 领取奖励删除 跨天更新
346 388
  389 + --获取宝藏列表(排除未过期的宝藏) 进行随机获取宝藏
347 local tmpTreasure = {} 390 local tmpTreasure = {}
348 - for _, val in pairs(tmpcsv) do 391 + for _, val in pairs(csvdb["idle_treasureCsv"]) do
349 if self:checkUnlock(val) then 392 if self:checkUnlock(val) then
350 - local treasure = self:checkTreasureExpired(val, treasureListExtra) 393 + local treasure = self:checkTreasureExpired(val, treasureListExtra, true)
351 if treasure then 394 if treasure then
352 table.insert(tmpTreasure, treasure) 395 table.insert(tmpTreasure, treasure)
353 end 396 end
src/models/RoleLog.lua
@@ -179,6 +179,8 @@ local ItemReason = { @@ -179,6 +179,8 @@ local ItemReason = {
179 CapsuleCoinCost = 1413, --抽扭蛋机消耗 179 CapsuleCoinCost = 1413, --抽扭蛋机消耗
180 180
181 worldLine = 1500, --世界线积分 181 worldLine = 1500, --世界线积分
  182 +
  183 + TreasureMap = 1600, --藏宝图
182 } 184 }
183 185
184 186