diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 37b6d2b..60402f1 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -452,7 +452,7 @@ function _M.createHeroRpc(agent, data) end -- typ 位置,level等级对应唯一装备,level为0时为移除,不为0时无则装备,有则替换 -function _M.referEquips(agent, data) +function _M.referEquipsRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) local hero = role.heros[msg.id] @@ -466,21 +466,21 @@ function _M.referEquips(agent, data) if ownLv == 0 then return 2 end else if role:getEquipCount(typ,level) < 1 then return 3 end + local equipSet = csvdb["equipCsv"][typ] + if not equipSet then return 4 end + local equipData = equipSet[level] + if not equipData then return 5 end end - local equipSet = csvdb["equipCsv"][typ] - if not equipSet then return 4 end - local equipData = equipSet[level] - if not equipData then return 5 end end for typ,level in pairs(equips) do local ownLv = hero:getProperty("equip"):getv(typ,0) if level == 0 then - role:addEquip({{type=typ,level=ownLv,count=1}}) + role:addEquip({type=typ,level=ownLv,count=1,isRefer=true}) else - role:addEquip({{type=typ,level=level,count=-1}}) - if ownLv ~= 0 then - role:addEquip({type=typ,level=ownLv,count=1}) + role:addEquip({type=typ,level=level,count=-1,isRefer=true}) + if ownLv > 0 then + role:addEquip({type=typ,level=ownLv,count=1,isRefer=true}) end end hero:updateProperty({field = "equip", value = hero:getProperty("equip"):setv(typ, level)}) diff --git a/src/csvdata b/src/csvdata index a7426f9..67615e0 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit a7426f9183da7afcd6b2780d23a4f6241d3e3aab +Subproject commit 67615e0a0a3ec5653f4b6e457d45c32dd3afed79 diff --git a/src/models/Hero.lua b/src/models/Hero.lua index 4c630e7..69dae3c 100644 --- a/src/models/Hero.lua +++ b/src/models/Hero.lua @@ -16,6 +16,7 @@ Hero.schema = { loveL = {"number", 0}, --好感度等级 skin = {"number", 0}, --皮肤 0 、 1、 2、 3 equip = {"string","1=0 2=0 3=0 4=0"}, --装备 type=level + rune = {"string","1=0 2=0 3=0 4=0 5=0 6=0"}, --零件 type=id } function Hero:ctor( properties ) @@ -77,6 +78,8 @@ function Hero:data() loveExp = self:getProperty("loveExp"), loveL = self:getProperty("loveL"), skin = self:getProperty("skin"), + equip = self:getProperty("equip"), + rune = self:getProperty("rune"), } end diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 0651975..a66c876 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -386,13 +386,13 @@ function RolePlugin.bind(Role) if equip then local originCount = equip:getProperty("count") - if isRefer and count < 0 then + if isRefer then if count < 0 then if count+originCount<0 then return end else - if equip:getProperty("refer")-count<0 then + if equip:getProperty("refer")+count<0 then return end end @@ -412,7 +412,7 @@ function RolePlugin.bind(Role) end equip:updateProperty({field = "count", value = count}) if isRefer then - equip:updateProperty({field = "refer", value = equip:getProperty("refer")+count}) + equip:updateProperty({field = "refer", value = equip:getProperty("refer")+params.count}) end self.equipBag[equipType][equipLv] = equip end -- libgit2 0.21.2