diff --git a/src/actions/CarAction.lua b/src/actions/CarAction.lua index 215e354..2a43a01 100644 --- a/src/actions/CarAction.lua +++ b/src/actions/CarAction.lua @@ -103,7 +103,7 @@ function _M.runeUpRpc( agent, data ) local uid = msg.uid local ownRune = role.runeBag[uid] if not ownRune then return 1 end - if ownRune:getProperty("refer") ~= 0 then return 2 end + local typ = ownRune:getProperty("type") local id = ownRune:getProperty("id") @@ -126,6 +126,12 @@ function _M.runeUpRpc( agent, data ) ownRune:updateProperty({field = "level",value = level+1}) role:checkTaskEnter("RuneUp") + if ownRune:getProperty("refer") ~= 0 then + local hero = role.heros[ownRune:getProperty("refer")] + if hero then + hero:updateProperty({field = "battleV", value = hero:getBattleValue()}) + end + end ownRune:log({desc = "runeUp", int1 = level + 1}) SendPacket(actionCodes.Car_runeUpRpc, '') diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 7c6269d..88d5195 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -536,13 +536,29 @@ function _M.referRunesRpc(agent, data) local runes = msg.runes if not runes or not next(runes) then return 11 end + local used = {} for typ = 1, 6 do if runes[typ] and runes[typ] ~= 0 then local ownRune = role.runeBag[runes[typ]] if not ownRune then return end - if ownRune:getProperty("refer") ~= 0 then return end + if ownRune:getProperty("refer") ~= 0 then + used[ownRune:getProperty("refer")] = used[ownRune:getProperty("refer")] or {} + used[ownRune:getProperty("refer")][runes[typ]] = 1 + end + end + end + + for cheroId, cIds in pairs(used) do + local chero = role.heros[cheroId] + local hrunes = chero:getProperty("rune") + for slot, rId in pairs(hrunes:toNumMap()) do + if cIds[rId] then + hrunes = hrunes:delk(slot) + end end + chero:updateProperty({field = "rune", value = hrunes}) end + local curRune = hero:getProperty("rune") for typ = 1, 6 do if runes[typ] then -- libgit2 0.21.2