Commit 47904e5138439c99c5daa5a3df65d69792365de4
1 parent
94449a78
创角后的时间礼包
Showing
4 changed files
with
26 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
@@ -54,6 +54,7 @@ actionCodes = { | @@ -54,6 +54,7 @@ actionCodes = { | ||
54 | Role_loadSparks = 138, | 54 | Role_loadSparks = 138, |
55 | Role_updateSpark = 139, -- 更新火花 | 55 | Role_updateSpark = 139, -- 更新火花 |
56 | Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品 | 56 | Role_diamondConvertRpc = 140, -- 钻石兑换成别的物品 |
57 | + Role_getTimeGiftRpc = 141, | ||
57 | 58 | ||
58 | Adv_startAdvRpc = 151, | 59 | Adv_startAdvRpc = 151, |
59 | Adv_startHangRpc = 152, | 60 | Adv_startHangRpc = 152, |
src/actions/RoleAction.lua
@@ -1526,4 +1526,26 @@ function _M.accuseRpc(agent, data) | @@ -1526,4 +1526,26 @@ function _M.accuseRpc(agent, data) | ||
1526 | return true | 1526 | return true |
1527 | end | 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 | return _M | 1551 | return _M |
1530 | \ No newline at end of file | 1552 | \ No newline at end of file |
src/models/Role.lua
@@ -78,6 +78,7 @@ Role.schema = { | @@ -78,6 +78,7 @@ Role.schema = { | ||
78 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL | 78 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
79 | crown = {"number", 0}, -- 看伴娘 | 79 | crown = {"number", 0}, -- 看伴娘 |
80 | silent = {"number", 0}, --禁言解禁时间 | 80 | silent = {"number", 0}, --禁言解禁时间 |
81 | + timeGift = {"number", 0}, -- 创建角色时间礼包 | ||
81 | 82 | ||
82 | bagLimit = {"table", globalCsv.store_limit_max}, | 83 | bagLimit = {"table", globalCsv.store_limit_max}, |
83 | 84 | ||
@@ -348,6 +349,7 @@ function Role:data() | @@ -348,6 +349,7 @@ function Role:data() | ||
348 | diamond = self:getAllDiamond(), | 349 | diamond = self:getAllDiamond(), |
349 | bagLimit = self:getProperty("bagLimit"), | 350 | bagLimit = self:getProperty("bagLimit"), |
350 | silent = self:getProperty("silent"), | 351 | silent = self:getProperty("silent"), |
352 | + timeGift = self:getProperty("timeGift"), | ||
351 | 353 | ||
352 | advPass = self:getProperty("advPass"), | 354 | advPass = self:getProperty("advPass"), |
353 | advInfo = self:getProperty("advInfo"), | 355 | advInfo = self:getProperty("advInfo"), |
src/models/RoleLog.lua
@@ -59,6 +59,7 @@ local ItemReason = { | @@ -59,6 +59,7 @@ local ItemReason = { | ||
59 | advLevelStage = 143, -- 拾荒活动阶段奖励 | 59 | advLevelStage = 143, -- 拾荒活动阶段奖励 |
60 | towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励 | 60 | towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励 |
61 | convert = 145, -- 钻石兑换其他物品 | 61 | convert = 145, -- 钻石兑换其他物品 |
62 | + giftTime = 146, -- 创角后的时间礼包 | ||
62 | 63 | ||
63 | advHang = 301, -- 拾荒挂机 | 64 | advHang = 301, -- 拾荒挂机 |
64 | hangBattle = 302, -- 挂机战斗 | 65 | hangBattle = 302, -- 挂机战斗 |