Commit dbd0ca58e0d6ecdb07297c30730d0a1f4769fec4

Authored by gaofengduan
1 parent 289a4927

car  营养剂制作

src/ProtocolCode.lua
@@ -69,6 +69,7 @@ actionCodes = { @@ -69,6 +69,7 @@ actionCodes = {
69 Diner_refreshTaskRpc = 309, 69 Diner_refreshTaskRpc = 309,
70 Diner_expediteSellRpc = 310, 70 Diner_expediteSellRpc = 310,
71 Diner_getGreenhouseRpc = 311, 71 Diner_getGreenhouseRpc = 311,
  72 + Diner_makePotionRpc = 312,
72 } 73 }
73 74
74 rpcResponseBegin = 10000 75 rpcResponseBegin = 10000
src/actions/DinerAction.lua
@@ -297,7 +297,7 @@ function _M.talentUpRpc( agent, data ) @@ -297,7 +297,7 @@ function _M.talentUpRpc( agent, data )
297 return 6 297 return 6
298 end 298 end
299 299
300 - -- 正在贩卖不能升级 300 + -- 正在贩卖不能升级料理天赋
301 local sells = json.decode(role.dinerData:getProperty("sells")) 301 local sells = json.decode(role.dinerData:getProperty("sells"))
302 for slot, _ in pairs(sells) do 302 for slot, _ in pairs(sells) do
303 role.dinerData:updateSell(slot) 303 role.dinerData:updateSell(slot)
@@ -309,9 +309,13 @@ function _M.talentUpRpc( agent, data ) @@ -309,9 +309,13 @@ function _M.talentUpRpc( agent, data )
309 end 309 end
310 end 310 end
311 311
  312 + -- 正在冒险不能升级营养剂天赋
  313 + if talentData.effect:split2()[1] == 2 then
  314 + if next(role.advTeam) then return 8 end
  315 + end
  316 +
312 role:costItems(cost) 317 role:costItems(cost)
313 role.dinerData:updateProperty({field = "dishTree", value = dishTree:setv(dish, dishLevel + 1)}) 318 role.dinerData:updateProperty({field = "dishTree", value = dishTree:setv(dish, dishLevel + 1)})
314 - -- talentData.tree_point = "40=1"  
315 local treePoint = talentData.tree_point:toNumMap() 319 local treePoint = talentData.tree_point:toNumMap()
316 if next(treePoint) then 320 if next(treePoint) then
317 role:award(treePoint) 321 role:award(treePoint)
@@ -501,4 +505,40 @@ function _M.getGreenhouseRpc( agent, data ) @@ -501,4 +505,40 @@ function _M.getGreenhouseRpc( agent, data )
501 return true 505 return true
502 end 506 end
503 507
  508 +function _M.makePotionRpc( agent, data )
  509 + local role = agent.role
  510 + local msg = MsgPack.unpack(data)
  511 + local potionId = msg.id
  512 + local count = msg.count
  513 + if count < 1 then return 0 end
  514 + local potionBag = role:getProperty("potionBag")
  515 + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0)
  516 + if potionLv < 1 then return 1 end
  517 +
  518 + local potionSet = csvdb["adv_potionCsv"][potionId]
  519 + if not potionSet then return 2 end
  520 +
  521 + local potionData = potionSet[potionLv]
  522 + if not potionData then return 3 end
  523 +
  524 + local own = potionBag[potionId] or 0
  525 + if own+count > potionData.limit then
  526 + return 4
  527 + end
  528 +
  529 + local cost = potionData.material:toNumMap()
  530 + for _, n in pairs(cost) do
  531 + n = n * count
  532 + end
  533 + if not role:checkItemEnough(cost) then
  534 + return 5
  535 + end
  536 +
  537 + role:costItems(cost)
  538 + potionBag[potionId] = own + count
  539 + role:updateProperty({field = "potionBag", value = potionBag})
  540 + SendPacket(actionCodes.Diner_makePotionRpc, MsgPack.pack({potionBag = potionBag}))
  541 + return true
  542 +end
  543 +
504 return _M 544 return _M
505 \ No newline at end of file 545 \ No newline at end of file
1 -Subproject commit 9c9b5130c9acea03c877095d5bd8f3e34437bdb8 1 +Subproject commit 48bcf09fd9d9b66f7c7f06553f3b3a49d723364e
src/models/Role.lua
@@ -52,6 +52,7 @@ Role.schema = { @@ -52,6 +52,7 @@ Role.schema = {
52 hangBag = {"table", {}}, -- 背包 52 hangBag = {"table", {}}, -- 背包
53 hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限 53 hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限
54 54
  55 + potionBag = {"table", {}}, -- 营养剂背包
55 } 56 }
56 57
57 58
@@ -113,7 +114,7 @@ function Role:changeUpdates(params, notNotify) @@ -113,7 +114,7 @@ function Role:changeUpdates(params, notNotify)
113 error("[ERROR:] need handler for changeUpdate, field : " .. fieldType) 114 error("[ERROR:] need handler for changeUpdate, field : " .. fieldType)
114 return 115 return
115 end 116 end
116 - --支持多深度单字段 117 + --支持多深度单字段
117 local curValue = self:getProperty(fieldType) 118 local curValue = self:getProperty(fieldType)
118 if type(info["field"]) == "table" then 119 if type(info["field"]) == "table" then
119 for _idx, _field in ipairs(info["field"]) do 120 for _idx, _field in ipairs(info["field"]) do
@@ -155,7 +156,7 @@ function Role:data() @@ -155,7 +156,7 @@ function Role:data()
155 loveStatus = self:getProperty("loveStatus"):toNumMap(), 156 loveStatus = self:getProperty("loveStatus"):toNumMap(),
156 diamond = self:getAllDiamond(), 157 diamond = self:getAllDiamond(),
157 bagLimit = self:getProperty("bagLimit"), 158 bagLimit = self:getProperty("bagLimit"),
158 - 159 +
159 advPass = self:getProperty("advPass"), 160 advPass = self:getProperty("advPass"),
160 advInfo = self:getProperty("advInfo"), 161 advInfo = self:getProperty("advInfo"),
161 advItems = self:getProperty("advItems"):toNumMap(), 162 advItems = self:getProperty("advItems"):toNumMap(),
@@ -166,6 +167,8 @@ function Role:data() @@ -166,6 +167,8 @@ function Role:data()
166 hangInfo = self:getProperty("hangInfo"), 167 hangInfo = self:getProperty("hangInfo"),
167 hangBag = self:getProperty("hangBag"), 168 hangBag = self:getProperty("hangBag"),
168 hangBagLimit = self:getProperty("hangBagLimit"), 169 hangBagLimit = self:getProperty("hangBagLimit"),
  170 +
  171 + potionBag = self:getProperty("potionBag"),
169 } 172 }
170 end 173 end
171 174