Commit f3eb32265fcfc9e60aa9f7539fc4940d3227059e
Merge branch 'cn/develop-mysql' of 120.26.43.151:wasteland/server into cn/develop-mysql
Showing
5 changed files
with
56 additions
and
7 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/HeroAction.lua
@@ -35,10 +35,19 @@ function _M.levelUpRpc( agent, data ) | @@ -35,10 +35,19 @@ function _M.levelUpRpc( agent, data ) | ||
35 | local hero = role.heros[msg.id] | 35 | local hero = role.heros[msg.id] |
36 | if not hero then return 1 end | 36 | if not hero then return 1 end |
37 | 37 | ||
38 | - if hero:getProperty("level") >= hero:getMaxLevel() then return 2 end | ||
39 | - local curData = csvdb["unit_expCsv"][hero:getProperty("level")] | 38 | + local level = hero:getProperty("level") |
39 | + if level >= hero:getMaxLevel() then return 2 end | ||
40 | + local curData = csvdb["unit_expCsv"][level] | ||
40 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} | 41 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} |
41 | if not role:checkItemEnough(cost) then return 3 end | 42 | if not role:checkItemEnough(cost) then return 3 end |
43 | + | ||
44 | + -- 通过指定关卡后才能升级英雄等级 | ||
45 | + local pass = globalCsv.unit_exp_level_pass[level + 1] | ||
46 | + if pass then | ||
47 | + local hangPass = self:getProperty("hangPass") | ||
48 | + if not hangPass[pass] then return 4 end | ||
49 | + end | ||
50 | + | ||
42 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) | 51 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) |
43 | 52 | ||
44 | local oldAttr = hero:getTotalAttrs() | 53 | local oldAttr = hero:getTotalAttrs() |
@@ -69,12 +78,21 @@ function _M.breakRpc( agent, data ) | @@ -69,12 +78,21 @@ function _M.breakRpc( agent, data ) | ||
69 | local hero = role.heros[msg.id] | 78 | local hero = role.heros[msg.id] |
70 | if not hero then return 1 end | 79 | if not hero then return 1 end |
71 | 80 | ||
81 | + local breakL = hero:getProperty("breakL") | ||
72 | if hero:getProperty("level") < hero:getMaxLevel() then return 2 end | 82 | if hero:getProperty("level") < hero:getMaxLevel() then return 2 end |
73 | - if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return 3 end | ||
74 | - local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] | 83 | + if breakL >= #csvdb["unit_breakCsv"] then return 3 end |
84 | + local curData = csvdb["unit_breakCsv"][breakL] | ||
75 | if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end | 85 | if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end |
76 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} | 86 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
77 | if not role:checkItemEnough(cost) then return 4 end | 87 | if not role:checkItemEnough(cost) then return 4 end |
88 | + | ||
89 | + -- 通过指定关卡后才能突破英雄 | ||
90 | + local pass = globalCsv.unit_break_level_pass[breakL] | ||
91 | + if pass then | ||
92 | + local hangPass = self:getProperty("hangPass") | ||
93 | + if not hangPass[pass] then return 4 end | ||
94 | + end | ||
95 | + | ||
78 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) | 96 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
79 | local oldAttr = hero:getTotalAttrs() | 97 | local oldAttr = hero:getTotalAttrs() |
80 | hero:updateProperty({field = "breakL", delta = 1}) | 98 | hero:updateProperty({field = "breakL", delta = 1}) |
src/actions/RoleAction.lua
@@ -528,14 +528,19 @@ function _M.saleItemRpc(agent, data) | @@ -528,14 +528,19 @@ function _M.saleItemRpc(agent, data) | ||
528 | local role = agent.role | 528 | local role = agent.role |
529 | local msg = MsgPack.unpack(data) | 529 | local msg = MsgPack.unpack(data) |
530 | local backs = msg.backs | 530 | local backs = msg.backs |
531 | - if not backs then return end | 531 | + if not backs or not next(backs) then return 0 end |
532 | + | ||
533 | + for itemId, count in pairs(backs) do | ||
534 | + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end | ||
535 | + if globalCsv.unit_paster_ban[itemId] then return 2 end | ||
536 | + local itemData = csvdb["itemCsv"][itemId] | ||
537 | + if itemData.sell_effect == "" then return 3 end | ||
538 | + end | ||
532 | 539 | ||
533 | local reward = {} | 540 | local reward = {} |
534 | local fragCount = 0 | 541 | local fragCount = 0 |
535 | for itemId, count in pairs(backs) do | 542 | for itemId, count in pairs(backs) do |
536 | - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | ||
537 | local itemData = csvdb["itemCsv"][itemId] | 543 | local itemData = csvdb["itemCsv"][itemId] |
538 | - if itemData.sell_effect == "" then return end | ||
539 | if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.HeroFCommon then | 544 | if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.HeroFCommon then |
540 | fragCount = fragCount + count | 545 | fragCount = fragCount + count |
541 | end | 546 | end |
@@ -1521,4 +1526,26 @@ function _M.accuseRpc(agent, data) | @@ -1521,4 +1526,26 @@ function _M.accuseRpc(agent, data) | ||
1521 | return true | 1526 | return true |
1522 | end | 1527 | end |
1523 | 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(role:packReward(reward, change))) | ||
1548 | + return true | ||
1549 | +end | ||
1550 | + | ||
1524 | return _M | 1551 | return _M |
1525 | \ 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 | ||
@@ -350,6 +351,7 @@ function Role:data() | @@ -350,6 +351,7 @@ function Role:data() | ||
350 | diamond = self:getAllDiamond(), | 351 | diamond = self:getAllDiamond(), |
351 | bagLimit = self:getProperty("bagLimit"), | 352 | bagLimit = self:getProperty("bagLimit"), |
352 | silent = self:getProperty("silent"), | 353 | silent = self:getProperty("silent"), |
354 | + timeGift = self:getProperty("timeGift"), | ||
353 | 355 | ||
354 | advPass = self:getProperty("advPass"), | 356 | advPass = self:getProperty("advPass"), |
355 | advInfo = self:getProperty("advInfo"), | 357 | 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, -- 挂机战斗 |