Commit 47904e5138439c99c5daa5a3df65d69792365de4
1 parent
94449a78
创角后的时间礼包
Showing
4 changed files
with
26 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
src/actions/RoleAction.lua
... | ... | @@ -1526,4 +1526,26 @@ function _M.accuseRpc(agent, data) |
1526 | 1526 | return true |
1527 | 1527 | end |
1528 | 1528 | |
1529 | +function _M.getTimeGiftRpc(agent, data) | |
1530 | + local role = agent.role | |
1531 | + | |
1532 | + local GiftCsv = csvdb["time_giftCsv"] | |
1533 | + local timeGift = role:getProperty("timeGift") | |
1534 | + if timeGift >= #GiftCsv then return 0 end | |
1535 | + | |
1536 | + local nextL = timeGift + 1 | |
1537 | + local gift = GiftCsv[nextL] | |
1538 | + if not gift then return 1 end | |
1539 | + | |
1540 | + local createtime = role:getProperty("ctime") | |
1541 | + if skynet.timex() - createtime < gift.time then return 2 end | |
1542 | + | |
1543 | + role:updateProperty({field = "timeGift", value = nextL}) | |
1544 | + local reward, change = role:award(gift.gift, {log = {desc = "giftTime", int1 = nextL}}) | |
1545 | + role:mylog("role_action", {desc = "giftTime", int1 = nextL}) | |
1546 | + | |
1547 | + SendPacket(actionCodes.Role_getTimeGiftRpc, MsgPack.pack(reward, change)) | |
1548 | + return true | |
1549 | +end | |
1550 | + | |
1529 | 1551 | return _M |
1530 | 1552 | \ No newline at end of file | ... | ... |
src/models/Role.lua
... | ... | @@ -78,6 +78,7 @@ Role.schema = { |
78 | 78 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
79 | 79 | crown = {"number", 0}, -- 看伴娘 |
80 | 80 | silent = {"number", 0}, --禁言解禁时间 |
81 | + timeGift = {"number", 0}, -- 创建角色时间礼包 | |
81 | 82 | |
82 | 83 | bagLimit = {"table", globalCsv.store_limit_max}, |
83 | 84 | |
... | ... | @@ -348,6 +349,7 @@ function Role:data() |
348 | 349 | diamond = self:getAllDiamond(), |
349 | 350 | bagLimit = self:getProperty("bagLimit"), |
350 | 351 | silent = self:getProperty("silent"), |
352 | + timeGift = self:getProperty("timeGift"), | |
351 | 353 | |
352 | 354 | advPass = self:getProperty("advPass"), |
353 | 355 | advInfo = self:getProperty("advInfo"), | ... | ... |
src/models/RoleLog.lua