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
src/actions/HeroAction.lua
... | ... | @@ -35,10 +35,19 @@ function _M.levelUpRpc( agent, data ) |
35 | 35 | local hero = role.heros[msg.id] |
36 | 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 | 41 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} |
41 | 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 | 51 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) |
43 | 52 | |
44 | 53 | local oldAttr = hero:getTotalAttrs() |
... | ... | @@ -69,12 +78,21 @@ function _M.breakRpc( agent, data ) |
69 | 78 | local hero = role.heros[msg.id] |
70 | 79 | if not hero then return 1 end |
71 | 80 | |
81 | + local breakL = hero:getProperty("breakL") | |
72 | 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 | 85 | if hero:getProperty("wakeL") < curData["starLimit"] then return 4 end |
76 | 86 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
77 | 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 | 96 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
79 | 97 | local oldAttr = hero:getTotalAttrs() |
80 | 98 | hero:updateProperty({field = "breakL", delta = 1}) | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -528,14 +528,19 @@ function _M.saleItemRpc(agent, data) |
528 | 528 | local role = agent.role |
529 | 529 | local msg = MsgPack.unpack(data) |
530 | 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 | 540 | local reward = {} |
534 | 541 | local fragCount = 0 |
535 | 542 | for itemId, count in pairs(backs) do |
536 | - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | |
537 | 543 | local itemData = csvdb["itemCsv"][itemId] |
538 | - if itemData.sell_effect == "" then return end | |
539 | 544 | if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.HeroFCommon then |
540 | 545 | fragCount = fragCount + count |
541 | 546 | end |
... | ... | @@ -1521,4 +1526,26 @@ function _M.accuseRpc(agent, data) |
1521 | 1526 | return true |
1522 | 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 | 1551 | return _M |
1525 | 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 | |
... | ... | @@ -350,6 +351,7 @@ function Role:data() |
350 | 351 | diamond = self:getAllDiamond(), |
351 | 352 | bagLimit = self:getProperty("bagLimit"), |
352 | 353 | silent = self:getProperty("silent"), |
354 | + timeGift = self:getProperty("timeGift"), | |
353 | 355 | |
354 | 356 | advPass = self:getProperty("advPass"), |
355 | 357 | advInfo = self:getProperty("advInfo"), | ... | ... |
src/models/RoleLog.lua