Commit f52efe51df9a462094f2c31748f48e555df3c85a
1 parent
922ce27a
符文升级
Showing
2 changed files
with
24 additions
and
2 deletions
Show diff stats
src/actions/CarAction.lua
@@ -103,7 +103,7 @@ function _M.runeUpRpc( agent, data ) | @@ -103,7 +103,7 @@ function _M.runeUpRpc( agent, data ) | ||
103 | local uid = msg.uid | 103 | local uid = msg.uid |
104 | local ownRune = role.runeBag[uid] | 104 | local ownRune = role.runeBag[uid] |
105 | if not ownRune then return 1 end | 105 | if not ownRune then return 1 end |
106 | - if ownRune:getProperty("refer") ~= 0 then return 2 end | 106 | + |
107 | 107 | ||
108 | local typ = ownRune:getProperty("type") | 108 | local typ = ownRune:getProperty("type") |
109 | local id = ownRune:getProperty("id") | 109 | local id = ownRune:getProperty("id") |
@@ -126,6 +126,12 @@ function _M.runeUpRpc( agent, data ) | @@ -126,6 +126,12 @@ function _M.runeUpRpc( agent, data ) | ||
126 | ownRune:updateProperty({field = "level",value = level+1}) | 126 | ownRune:updateProperty({field = "level",value = level+1}) |
127 | role:checkTaskEnter("RuneUp") | 127 | role:checkTaskEnter("RuneUp") |
128 | 128 | ||
129 | + if ownRune:getProperty("refer") ~= 0 then | ||
130 | + local hero = role.heros[ownRune:getProperty("refer")] | ||
131 | + if hero then | ||
132 | + hero:updateProperty({field = "battleV", value = hero:getBattleValue()}) | ||
133 | + end | ||
134 | + end | ||
129 | ownRune:log({desc = "runeUp", int1 = level + 1}) | 135 | ownRune:log({desc = "runeUp", int1 = level + 1}) |
130 | 136 | ||
131 | SendPacket(actionCodes.Car_runeUpRpc, '') | 137 | SendPacket(actionCodes.Car_runeUpRpc, '') |
src/actions/HeroAction.lua
@@ -536,13 +536,29 @@ function _M.referRunesRpc(agent, data) | @@ -536,13 +536,29 @@ function _M.referRunesRpc(agent, data) | ||
536 | local runes = msg.runes | 536 | local runes = msg.runes |
537 | if not runes or not next(runes) then return 11 end | 537 | if not runes or not next(runes) then return 11 end |
538 | 538 | ||
539 | + local used = {} | ||
539 | for typ = 1, 6 do | 540 | for typ = 1, 6 do |
540 | if runes[typ] and runes[typ] ~= 0 then | 541 | if runes[typ] and runes[typ] ~= 0 then |
541 | local ownRune = role.runeBag[runes[typ]] | 542 | local ownRune = role.runeBag[runes[typ]] |
542 | if not ownRune then return end | 543 | if not ownRune then return end |
543 | - if ownRune:getProperty("refer") ~= 0 then return end | 544 | + if ownRune:getProperty("refer") ~= 0 then |
545 | + used[ownRune:getProperty("refer")] = used[ownRune:getProperty("refer")] or {} | ||
546 | + used[ownRune:getProperty("refer")][runes[typ]] = 1 | ||
547 | + end | ||
548 | + end | ||
549 | + end | ||
550 | + | ||
551 | + for cheroId, cIds in pairs(used) do | ||
552 | + local chero = role.heros[cheroId] | ||
553 | + local hrunes = chero:getProperty("rune") | ||
554 | + for slot, rId in pairs(hrunes:toNumMap()) do | ||
555 | + if cIds[rId] then | ||
556 | + hrunes = hrunes:delk(slot) | ||
557 | + end | ||
544 | end | 558 | end |
559 | + chero:updateProperty({field = "rune", value = hrunes}) | ||
545 | end | 560 | end |
561 | + | ||
546 | local curRune = hero:getProperty("rune") | 562 | local curRune = hero:getProperty("rune") |
547 | for typ = 1, 6 do | 563 | for typ = 1, 6 do |
548 | if runes[typ] then | 564 | if runes[typ] then |