From 14f1591bd96f27c0cf8689bff33c8955f05a2f0b Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Fri, 20 Dec 2019 17:02:47 +0800 Subject: [PATCH] 删除好感度相关 --- src/actions/GmAction.lua | 44 ++++++++++++++++++++++---------------------- src/actions/HeroAction.lua | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------- src/actions/RoleAction.lua | 4 +--- src/models/Hero.lua | 8 ++++---- src/models/HeroPlugin.lua | 12 ++++++------ src/models/Role.lua | 12 ++++++------ src/models/RoleTask.lua | 10 +++++----- 7 files changed, 145 insertions(+), 147 deletions(-) diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 8728eb6..20915d9 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -89,28 +89,28 @@ function _M.fbc(role, pms) -- 直接通关 return "成功" end -table.insert(helpDes, {"好感度", "love", "角色类型", "好感度等级", "好感度经验"}) -function _M.love(role, pms) - local heroType = tonum(pms.pm1) - local level = tonum(pms.pm2) - local exp = tonum(pms.pm3) - local curPlus = csvdb["unit_love_plusCsv"][heroType] - if not curPlus then return "参数错误" end - level = math.max(math.min(curPlus.limit, level), 0) - local curEffect = csvdb["unit_love_effectCsv"][level] - exp = math.max(math.min(curEffect.loveValue, exp) , 0) - for _, hero in pairs(role.heros) do - if hero:getProperty("type") == heroType then - hero:updateProperty({field = "loveL", value = level}) - hero:updateProperty({field = "loveExp", value = exp}) - if role:getProperty("loveStatus"):getv(heroType, 0) < level then - role:changeUpdates({{type = "loveStatus", field = heroType, value = level}}) -- 总的 - end - role:checkTaskEnter("LoveBreak", {heroType = heroType, loveL = level}) - end - end - return "成功" -end +-- table.insert(helpDes, {"好感度", "love", "角色类型", "好感度等级", "好感度经验"}) +-- function _M.love(role, pms) +-- local heroType = tonum(pms.pm1) +-- local level = tonum(pms.pm2) +-- local exp = tonum(pms.pm3) +-- local curPlus = csvdb["unit_love_plusCsv"][heroType] +-- if not curPlus then return "参数错误" end +-- level = math.max(math.min(curPlus.limit, level), 0) +-- local curEffect = csvdb["unit_love_effectCsv"][level] +-- exp = math.max(math.min(curEffect.loveValue, exp) , 0) +-- for _, hero in pairs(role.heros) do +-- if hero:getProperty("type") == heroType then +-- hero:updateProperty({field = "loveL", value = level}) +-- hero:updateProperty({field = "loveExp", value = exp}) +-- if role:getProperty("loveStatus"):getv(heroType, 0) < level then +-- role:changeUpdates({{type = "loveStatus", field = heroType, value = level}}) -- 总的 +-- end +-- role:checkTaskEnter("LoveBreak", {heroType = heroType, loveL = level}) +-- end +-- end +-- return "成功" +-- end table.insert(helpDes, {"玩家经验", "exp", "经验"}) function _M.exp(role, pms) diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index e9c6727..48dc2de 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -375,107 +375,107 @@ function _M.likeCommentRpc(agent, data) return true end -function _M.loveItemRpc(agent, data) - local role = agent.role - local msg = MsgPack.unpack(data) - local hero = role.heros[msg.heroId] - if not hero then - return - end - local curL = hero:getProperty("loveL") - local curExp = hero:getProperty("loveExp") - local curType = hero:getProperty("type") - local curPlus = csvdb["unit_love_plusCsv"][curType] - if not curPlus then - return - end - if curL >= curPlus.limit then - SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 1})) --已满级 - return true - end - local curEffect = csvdb["unit_love_effectCsv"][curL] - if not curEffect then - return - end - if curExp >= curEffect.loveValue and not msg.bBreak then - SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 2})) --当前等级经验已满 - return true - end - - if msg.bBreak then - local cost = curEffect.cost:toArray(true, "=") - if not role:checkItemEnough({[cost[1]] = cost[2]}) then - SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = cost[1]})) --物品不足 - return true - end - role:costItems({[cost[1]] = cost[2]}) - local newLevel = curL + 1 - hero:updateProperty({field = "loveL", value = newLevel}) - hero:updateProperty({field = "loveExp", value = 0}) - - if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then - role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 - end - - role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) - - else - local delta = globalCsv.unit_love_presentValue[msg.itemId] - if not delta then - return - end - if not role:checkItemEnough({[msg.itemId] = 1}) then - SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = msg.itemId})) - return true - end - local newExp = curExp + delta - if newExp > curEffect.loveValue then - newExp = curEffect.loveValue - end - role:costItems({[msg.itemId] = 1}) - hero:updateProperty({field = "loveExp", value = newExp}) - end - SendPacket(actionCodes.Hero_loveItemRpc, "") - return true -end - -function _M.loveTaskRpc(agent, data) - local role = agent.role - local msg = MsgPack.unpack(data) - local hero = role.heros[msg.id] - if not hero then return end - - local curL = hero:getProperty("loveL") - local curExp = hero:getProperty("loveExp") - local curType = hero:getProperty("type") - local curPlus = csvdb["unit_love_plusCsv"][curType] - if not curPlus or curL >= curPlus.limit then return end - - local curEffect = csvdb["unit_love_effectCsv"][curL] - if not curEffect or curExp < curEffect.loveValue then return end - - local lastEffect = csvdb["unit_love_effectCsv"][curL + 1] - local newExp = curExp - curEffect.loveValue - if lastEffect and curL + 1 < curPlus.limit then - if newExp >= lastEffect.loveValue then - -- todo 发任务 - end - else - newExp = 0 - end - local newLevel = curL + 1 - hero:updateProperty({field = "loveExp", value = newExp}) - hero:updateProperty({field = "loveL", value = newLevel}) - - if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then - role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 - end - - role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) - - SendPacket(actionCodes.Hero_loveTaskRpc, "") - return true -end +-- function _M.loveItemRpc(agent, data) +-- local role = agent.role +-- local msg = MsgPack.unpack(data) +-- local hero = role.heros[msg.heroId] +-- if not hero then +-- return +-- end +-- local curL = hero:getProperty("loveL") +-- local curExp = hero:getProperty("loveExp") +-- local curType = hero:getProperty("type") +-- local curPlus = csvdb["unit_love_plusCsv"][curType] +-- if not curPlus then +-- return +-- end +-- if curL >= curPlus.limit then +-- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 1})) --已满级 +-- return true +-- end +-- local curEffect = csvdb["unit_love_effectCsv"][curL] +-- if not curEffect then +-- return +-- end +-- if curExp >= curEffect.loveValue and not msg.bBreak then +-- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 2})) --当前等级经验已满 +-- return true +-- end + +-- if msg.bBreak then +-- local cost = curEffect.cost:toArray(true, "=") +-- if not role:checkItemEnough({[cost[1]] = cost[2]}) then +-- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = cost[1]})) --物品不足 +-- return true +-- end +-- role:costItems({[cost[1]] = cost[2]}) +-- local newLevel = curL + 1 +-- hero:updateProperty({field = "loveL", value = newLevel}) +-- hero:updateProperty({field = "loveExp", value = 0}) + +-- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then +-- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 +-- end + +-- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) + +-- else +-- local delta = globalCsv.unit_love_presentValue[msg.itemId] +-- if not delta then +-- return +-- end +-- if not role:checkItemEnough({[msg.itemId] = 1}) then +-- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = msg.itemId})) +-- return true +-- end +-- local newExp = curExp + delta +-- if newExp > curEffect.loveValue then +-- newExp = curEffect.loveValue +-- end +-- role:costItems({[msg.itemId] = 1}) +-- hero:updateProperty({field = "loveExp", value = newExp}) +-- end +-- SendPacket(actionCodes.Hero_loveItemRpc, "") +-- return true +-- end + +-- function _M.loveTaskRpc(agent, data) +-- local role = agent.role +-- local msg = MsgPack.unpack(data) +-- local hero = role.heros[msg.id] +-- if not hero then return end + +-- local curL = hero:getProperty("loveL") +-- local curExp = hero:getProperty("loveExp") +-- local curType = hero:getProperty("type") +-- local curPlus = csvdb["unit_love_plusCsv"][curType] +-- if not curPlus or curL >= curPlus.limit then return end + +-- local curEffect = csvdb["unit_love_effectCsv"][curL] +-- if not curEffect or curExp < curEffect.loveValue then return end + +-- local lastEffect = csvdb["unit_love_effectCsv"][curL + 1] +-- local newExp = curExp - curEffect.loveValue +-- if lastEffect and curL + 1 < curPlus.limit then +-- if newExp >= lastEffect.loveValue then +-- -- todo 发任务 +-- end +-- else +-- newExp = 0 +-- end +-- local newLevel = curL + 1 +-- hero:updateProperty({field = "loveExp", value = newExp}) +-- hero:updateProperty({field = "loveL", value = newLevel}) + +-- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then +-- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 +-- end + +-- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) + +-- SendPacket(actionCodes.Hero_loveTaskRpc, "") +-- return true +-- end function _M.createHeroRpc(agent, data) local role = agent.role diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 8c3f663..3ae5aea 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -365,9 +365,7 @@ function _M.changeIntroRpc(agent, data) content = mod or "" end - if content == "" then - role:updateProperty({field = "intro", value = content}) - end + role:updateProperty({field = "intro", value = content}) SendPacket(actionCodes.Role_changeIntroRpc, '') return true diff --git a/src/models/Hero.lua b/src/models/Hero.lua index b098b7f..a1ffa6d 100644 --- a/src/models/Hero.lua +++ b/src/models/Hero.lua @@ -12,8 +12,8 @@ Hero.schema = { skillL = {"string", ""}, -- 技能等级 1=1 2=1 3=1 talent = {"string", ""}, -- 0=阶段 1=1 2=1 3=1 4=1 四个天赋当前阶段的等级 阶段默认为1 等级默认为0 battleV = {"number", 0}, -- 保存战斗力 - loveExp = {"number", 0}, --好感度经验 - loveL = {"number", 0}, --好感度等级 + -- loveExp = {"number", 0}, --好感度经验 + -- loveL = {"number", 0}, --好感度等级 equip = {"string",""}, --装备 type=level rune = {"string",""}, --零件 type=id } @@ -78,8 +78,8 @@ function Hero:data() skillL = self:getProperty("skillL"), talent = self:getProperty("talent"), battleV = self:getProperty("battleV"), - loveExp = self:getProperty("loveExp"), - loveL = self:getProperty("loveL"), + -- loveExp = self:getProperty("loveExp"), + -- loveL = self:getProperty("loveL"), equip = self:getProperty("equip"), rune = self:getProperty("rune"), } diff --git a/src/models/HeroPlugin.lua b/src/models/HeroPlugin.lua index 499e884..c57038e 100644 --- a/src/models/HeroPlugin.lua +++ b/src/models/HeroPlugin.lua @@ -69,12 +69,12 @@ function HeroPlugin.bind(Hero) --好感度 local loveUp = {} - for i = 0, self:getProperty("loveL") do - local reward = csvdb["unit_love_effectCsv"][i]["reward"] - for attrId, value in pairs(reward:toNumMap()) do - loveUp[AttsEnumEx[attrId]] = (loveUp[AttsEnumEx[attrId]] or 0) + value - end - end + -- for i = 0, self:getProperty("loveL") do + -- local reward = csvdb["unit_love_effectCsv"][i]["reward"] + -- for attrId, value in pairs(reward:toNumMap()) do + -- loveUp[AttsEnumEx[attrId]] = (loveUp[AttsEnumEx[attrId]] or 0) + value + -- end + -- end --觉醒 local wData = csvdb["unit_wakeCsv"][wakeL] diff --git a/src/models/Role.lua b/src/models/Role.lua index 4a6b3d3..69a4354 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -47,7 +47,7 @@ Role.schema = { items = {"string", ""}, funcOpen = {"table", {}}, --功能是否开放 funcLv = {"table", {}}, --功能等级 - loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL + -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL crown = {"number", 0}, -- 看伴娘 silent = {"number", 0}, --禁言解禁时间 @@ -165,10 +165,10 @@ end -- 某些字段 更新改变量 改变量的定义由字段自身决定 {{type = ""}, } function Role:changeUpdates(params, notNotify) local changeUpdateFunc = { - ["loveStatus"] = function(info) - self:setProperty("loveStatus", self:getProperty("loveStatus"):setv(info["field"], info["value"])) - return {type = "loveStatus", field = info["field"], value = info["value"]} - end, + -- ["loveStatus"] = function(info) + -- self:setProperty("loveStatus", self:getProperty("loveStatus"):setv(info["field"], info["value"])) + -- return {type = "loveStatus", field = info["field"], value = info["value"]} + -- end, --table 类型通用更新 ["tableCommon"] = function(fieldType, info) if self.class.schema[fieldType][1] ~= "table" then @@ -225,7 +225,7 @@ function Role:data() items = self:getProperty("items"):toNumMap(), funcOpen = self:getProperty("funcOpen"), funcLv = self:getProperty("funcLv"), - loveStatus = self:getProperty("loveStatus"):toNumMap(), + -- loveStatus = self:getProperty("loveStatus"):toNumMap(), diamond = self:getAllDiamond(), bagLimit = self:getProperty("bagLimit"), silent = self:getProperty("silent"), diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index 87f88c6..0d0b2e4 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -231,11 +231,11 @@ function RoleTask.bind(Role) end local function checkStoryStatusByLove(role, data, status, cond1) -- cond1 heroType - if data.sort ~= cond1 then return end - local curL = role:getProperty("loveStatus"):getv(cond1, 0) - if curL < tonumber(data.unlockData) then return end - status.s = 1 - return true + -- if data.sort ~= cond1 then return end + -- local curL = role:getProperty("loveStatus"):getv(cond1, 0) + -- if curL < tonumber(data.unlockData) then return end + -- status.s = 1 + -- return true end local function checkStoryStatusByMultStar(role, data, status, cond1, cond2) -- cond1 heroType, cond2 wakeL -- libgit2 0.21.2