Commit 18ab94e528bdf7cdef64253103ea941d84cd13e3

Authored by zhouhaihai
2 parents 0a22a374 4aadc450

Merge branch 'tr/bugfix' into tr/publish/release

* tr/bugfix:
  切换拆解术式bug,造成获得巨大数量的物品
  or
  global
  email
  添加新的延時類型郵件

# Conflicts:
#	src/csvdata
src/actions/EmailAction.lua
... ... @@ -40,10 +40,17 @@ function _M.listRpc(agent, data)
40 40 local count = 1
41 41 for _, data in ipairs(result) do
42 42 local email = tarr2tab(data)
43   - if tonum(email.createtime) > role:getProperty("ctime")
44   - and ( not email.mid or tonum(email.mid) == mid )
  43 + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取
  44 + local delayType = tonum(email.delayType)
  45 + local flag = false
  46 + if delayType == 1 then
  47 + flag = skynet.timex() > tonum(email.createtime)
  48 + else
  49 + flag = tonum(email.createtime) > role:getProperty("ctime")
  50 + end
  51 + if flag and ( not email.mid or tonum(email.mid) == mid )
45 52 and ( not email.endtime or tonum(email.endtime) > now )then
46   - local time = math.max(tonum(email.timestamp, 0) or email.createtime)
  53 + local time = math.max(tonum(email.timestamp, 0) , tonum(email.createtime))
47 54 redisproxy:insertEmail({
48 55 roleId = roleId,
49 56 emailId = 0,
... ...
src/actions/RoleAction.lua
... ... @@ -586,9 +586,9 @@ function _M.openTimeBoxRpc(agent, data)
586 586 else
587 587 local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time
588 588 local unitTime = globalCsv.box_key_time[oldId] * 60
589   - local doneCnt = math.floor((process + skynet.timex() - time) / unitTime)
  589 + local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime)
590 590 if doneCnt > 0 then
591   - reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}})
  591 + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}})
592 592 end
593 593 end
594 594 local limit = globalCsv.box_key_max[itemId] or 5
... ... @@ -610,7 +610,7 @@ function _M.openTimeBoxRpc(agent, data)
610 610 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
611 611 local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2]
612 612 if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end
613   - role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}})
  613 + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}})
614 614 else
615 615 stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600)
616 616 end
... ... @@ -618,7 +618,7 @@ function _M.openTimeBoxRpc(agent, data)
618 618  
619 619 local doneCnt = math.floor((process + stopTime - time) / unitTime)
620 620 if doneCnt > 0 then
621   - reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}})
  621 + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}})
622 622 end
623 623 if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then
624 624 nowTime = 0
... ... @@ -687,7 +687,7 @@ function _M.openTimeBoxRpc(agent, data)
687 687 reward[id] = (reward[id] or 0) + num
688 688 end
689 689 end
690   - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}})
  690 + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId, int2 = oper}})
691 691 else
692 692 return
693 693 end
... ...
src/models/RolePlugin.lua
... ... @@ -1506,8 +1506,15 @@ function RolePlugin.bind(Role)
1506 1506 end)
1507 1507 for _, data in ipairs(redret) do
1508 1508 local email = tarr2tab(data)
1509   - if tonum(email.createtime) > self:getProperty("ctime")
1510   - and ( not email.mid or tonum(email.mid) == mid )
  1509 + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取
  1510 + local delayType = tonum(email.delayType)
  1511 + local flag = false
  1512 + if delayType == 1 then
  1513 + flag = skynet.timex() > tonum(email.createtime)
  1514 + else
  1515 + flag = tonum(email.createtime) > self:getProperty("ctime")
  1516 + end
  1517 + if flag and ( not email.mid or tonum(email.mid) == mid )
1511 1518 and ( not email.endtime or tonum(email.endtime) > now )then
1512 1519 return true
1513 1520 end
... ...
src/services/globald.lua
... ... @@ -69,7 +69,8 @@ local function mailQuene()
69 69 "attachments", email.attachments,
70 70 "endtime", email.endTime,
71 71 "mid", email.mid,
72   - "timestamp", now
  72 + "timestamp", now,
  73 + "delayType", email.delayType
73 74 )
74 75 else
75 76 redisproxy:hmset(string_format("globalEmail:%s", gid),
... ... @@ -80,7 +81,8 @@ local function mailQuene()
80 81 "content", email.content,
81 82 "attachments", email.attachments,
82 83 "endtime", email.endTime,
83   - "timestamp", now
  84 + "timestamp", now,
  85 + "delayType", email.delayType
84 86 )
85 87 end
86 88 end
... ...