Commit b9536b0259903bf493155d8edfec08e3ad24b3ae

Authored by 熊润斐
2 parents 9e2e5c31 da555218

Merge branch 'cn/develop' into cn/publish/preview

src/actions/CarAction.lua
@@ -209,6 +209,7 @@ function _M.saleRuneRpc(agent, data ) @@ -209,6 +209,7 @@ function _M.saleRuneRpc(agent, data )
209 209
210 local reward, change = {} 210 local reward, change = {}
211 local count = 0 211 local count = 0
  212 + local returnRune = {}
212 for _, uid in pairs(backs) do 213 for _, uid in pairs(backs) do
213 count = count + 1 214 count = count + 1
214 local rune = role.runeBag[uid] 215 local rune = role.runeBag[uid]
@@ -223,15 +224,21 @@ function _M.saleRuneRpc(agent, data ) @@ -223,15 +224,21 @@ function _M.saleRuneRpc(agent, data )
223 224
224 --分解铭文返还强化所需铭文碎片的60% 225 --分解铭文返还强化所需铭文碎片的60%
225 local level = rune:getProperty("level") 226 local level = rune:getProperty("level")
226 - for i = 1, level do  
227 - local lvData = csvdb["rune_buildCsv"][i]  
228 - local cost = lvData.cost:toNumMap()  
229 - for k, v in pairs(cost) do  
230 - reward[k] = (reward[k] or 0) + v*0.6 227 + if level > 0 then
  228 + for i = 0, level - 1 do
  229 + local lvData = csvdb["rune_buildCsv"][i]
  230 + local cost = lvData.cost:toNumMap()
  231 + for k, v in pairs(cost) do
  232 + returnRune[k] = (returnRune[k] or 0) + v
  233 + end
231 end 234 end
232 end 235 end
233 end 236 end
234 237
  238 + for k, v in pairs(returnRune) do
  239 + reward[k] = (reward[k] or 0) + math.ceil(v*0.6)
  240 + end
  241 +
235 role:delRunes(backs, {log = {desc = "saleRune"}}) 242 role:delRunes(backs, {log = {desc = "saleRune"}})
236 role:checkTaskEnter("DecoRune", {count = count}) 243 role:checkTaskEnter("DecoRune", {count = count})
237 reward, change = role:award(reward, {log = {desc = "saleRune"}}) 244 reward, change = role:award(reward, {log = {desc = "saleRune"}})
src/actions/PvpAction.lua
@@ -371,6 +371,18 @@ function _M.endBattleRpc(agent, data) @@ -371,6 +371,18 @@ function _M.endBattleRpc(agent, data)
371 if revenge then 371 if revenge then
372 match = _pvpRecordInfoCacheC[msg.idx] 372 match = _pvpRecordInfoCacheC[msg.idx]
373 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 373 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打
  374 +
  375 + if isWin then
  376 + -- 次数扣一波
  377 + local pvpFree = role.dailyData:getProperty("pvpFree")
  378 + if pvpFree >= globalCsv.pvp_battle_free_count then
  379 + local cost = {[ItemId.PvpKey] = 1}
  380 + if not role:checkItemEnough(cost) then return 5 end
  381 + role:costItems(cost, {log = {desc = "startPvp", int1 = 1}})
  382 + else
  383 + role.dailyData:updateProperty({field = "pvpFree", delta = 1})
  384 + end
  385 + end
374 else 386 else
375 local pvpMC = role:getProperty("pvpMC") 387 local pvpMC = role:getProperty("pvpMC")
376 match = pvpMC[msg.idx] 388 match = pvpMC[msg.idx]
@@ -630,6 +642,18 @@ function _M.endBattleHRpc(agent, data) @@ -630,6 +642,18 @@ function _M.endBattleHRpc(agent, data)
630 if revenge then 642 if revenge then
631 match = _pvpRecordInfoCacheH[msg.idx] 643 match = _pvpRecordInfoCacheH[msg.idx]
632 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 644 _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打
  645 +
  646 + if isWin then
  647 + -- 次数扣一波
  648 + local pvpFreeH = role.dailyData:getProperty("pvpFreeH")
  649 + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
  650 + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
  651 + if not role:checkItemEnough(cost) then return 5 end
  652 + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}})
  653 + else
  654 + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
  655 + end
  656 + end
633 else 657 else
634 local pvpMH = role:getProperty("pvpMH") 658 local pvpMH = role:getProperty("pvpMH")
635 match = pvpMH[msg.idx] 659 match = pvpMH[msg.idx]
src/models/HeroPlugin.lua
@@ -185,26 +185,30 @@ function HeroPlugin.bind(Hero) @@ -185,26 +185,30 @@ function HeroPlugin.bind(Hero)
185 for _, uid in pairs(self:getProperty("rune"):toNumMap()) do 185 for _, uid in pairs(self:getProperty("rune"):toNumMap()) do
186 if uid > 0 then 186 if uid > 0 then
187 local rune = self.owner.runeBag[uid] 187 local rune = self.owner.runeBag[uid]
188 - local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")]  
189 - local runeRareData = csvdb["rune_rareCsv"][csvData.rarity]  
190 - local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")]  
191 - for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do  
192 - local attName = AttsEnumEx[k]  
193 - --零件的加成属性有特殊需求 填的是 10倍的值  
194 - --rare的effect不影响 特殊属性  
195 -  
196 - --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100)  
197 - --铭文单件特殊属性=attr+[rune_build表effect]  
198 -  
199 - local effect = buildData[attName]  
200 - if not PercentAttr[attName] then  
201 - effect = buildData[attName] * runeRareData.effect / 100  
202 - end  
203 - attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName)  
204 - end  
205 -  
206 - if not suits[csvData.suit] then suits[csvData.suit] = {} end  
207 - table.insert(suits[csvData.suit],csvData) 188 + if not rune then
  189 + skynet.error(string.format("rune not exist,uid:%s,hero:%s,roleId:%s", uid, self:getProperty("id"), self:getProperty("roleid")))
  190 + else
  191 + local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")]
  192 + local runeRareData = csvdb["rune_rareCsv"][csvData.rarity]
  193 + local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")]
  194 + for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do
  195 + local attName = AttsEnumEx[k]
  196 + --零件的加成属性有特殊需求 填的是 10倍的值
  197 + --rare的effect不影响 特殊属性
  198 +
  199 + --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100)
  200 + --铭文单件特殊属性=attr+[rune_build表effect]
  201 +
  202 + local effect = buildData[attName]
  203 + if not PercentAttr[attName] then
  204 + effect = buildData[attName] * runeRareData.effect / 100
  205 + end
  206 + attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName)
  207 + end
  208 +
  209 + if not suits[csvData.suit] then suits[csvData.suit] = {} end
  210 + table.insert(suits[csvData.suit],csvData)
  211 + end
208 end 212 end
209 end 213 end
210 -- 零件套装效果 214 -- 零件套装效果