Skill = {} local this = {} -- 计算连击值 -- function Skill.calculationComboValue(actor,skillCfgId,skillLevel,skill) -- -- local growthFactor = ConfigDataManager.getTableValue("cfg_skill_info","growthFactor","skillID",skillCfgId,"skillLevel",skillLevel) -- -- local comboValue = ConfigDataManager.getTableValue("cfg_skill","comboValue","id",skill) -- -- if string.isNullOrEmpty(comboValue) or string.isNullOrEmpty(growthFactor) then -- -- return 0 -- -- end -- -- local add = math.ceil(tonumber(comboValue) * tonumber(growthFactor) / 10000) -- return 1000000, 1000000, 1000000 -- -- return 1 -- end -- 添加连击技能 function Skill.ComboSkillUp(actor) local comboSkill = getrolefield(actor, "role.roleskill.comboskill") local skillLv = comboSkill.skillLv local skillCfgId = comboSkill.skillCfgId if skillCfgId == 0 then local comboSkillInfo = ConfigDataManager.getTableValue("cfg_global", "value", "id", GlobalConfigId.COMBO_SKILL_INFO) -- error(comboSkillInfo) local baseCareer = getbaseinfo(actor, "getbasecareer") local comboSkillTable = string.split(comboSkillInfo, "|") for index, careerComboSkill in pairs(comboSkillTable) do local careerComboSkillInfo = string.split(careerComboSkill, "#") if tonumber(careerComboSkillInfo[1]) == tonumber(baseCareer) then skillCfgId = tonumber(careerComboSkillInfo[2]) end end skillLv = 0 end skillLv = skillLv + 1 local skillInfo = ConfigDataManager.getTable("cfg_skill_info", "skillID", skillCfgId, "skillLevel", skillLv) if table.isEmpty(skillInfo) then -- error("没有找到连击技能的配置信息") return end local skill = skillInfo[1] local skillLevelUpItemID = skill.skilllevelupitemid if not string.isNullOrEmpty(skillLevelUpItemID) then local skillLevelUpItemTable = string.split(skillLevelUpItemID, "|") local cost = {} for index, skillLevelUpItem in pairs(skillLevelUpItemTable) do local itemInfo = string.split(skillLevelUpItem, "#") local itemCfgId = tonumber(itemInfo[1]) local count = tonumber(itemInfo[2]) local have = getbagitemcountbyid(actor, itemCfgId) if have < count then tipinfo(actor, "连击技能已经提升到最高等级,无法再升级了") -- noticeTip.noticeinfo(actor, StringIdConst.TEXT346) return end cost[tostring(itemCfgId)] = count end for index, costCount in pairs(cost) do removeitemfrombag(actor, index, costCount, 0, 9999, '连击技能') end end local nextSkillLevel = skillLv addcomboskill(actor, skillCfgId, nextSkillLevel) TaskHandler.TriggerTaskGoal(actor, TaskTargetType.ACTIVATE_COMBO_SKILL) OpenServerCompetition.updateRankData(actor, CompetitionType.COMBO_SKILL, nextSkillLevel) local rid = getbaseinfo(actor, "rid") sendrefluamsg(actor, LuaMessageIdToClient.RES_COMBO_SKILL_MODEL_VIEW, {tostring(rid), tostring(skillCfgId), tostring(skillLv)}) LogManager.RoleUpComboSkill(actor, nextSkillLevel) end -- 玩家进入是也发送连击技能视野包 function Skill.playerequipview(actor, targetPlayer) local comboSkill = getrolefield(targetPlayer, "role.roleskill.comboskill") local skillLv = comboSkill.skillLv local skillCfgId = comboSkill.skillCfgId if skillCfgId == 0 then return end local rid = getbaseinfo(targetPlayer, "rid") sendluamsg(actor, LuaMessageIdToClient.RES_COMBO_SKILL_MODEL_VIEW, {tostring(rid), tostring(skillCfgId), tostring(skillLv)}) end -- 判断是不是连击技能 function Skill.isComboSkill(actor, skillId) local comboSkillInfo = ConfigDataManager.getTableValue("cfg_global", "value", "id", GlobalConfigId.COMBO_SKILL_INFO) local comboSkillTable = string.split(comboSkillInfo, "|") for index, careerComboSkill in pairs(comboSkillTable) do local careerComboSkillInfo = string.split(careerComboSkill, "#") if tonumber(careerComboSkillInfo[2]) == skillId then return true end end return false end --- 学习或升级技能 function Skill.levelUp(actor, skillInfo) if skillInfo == SkillConfigId.DEMON_HERMIT_SKILL_ID then levelupskill(actor, SkillConfigId.DEMON_HERMIT_COMMON_ONE_SKILL_ID, 1, 0) levelupskill(actor, SkillConfigId.DEMON_HERMIT_COMMON_TWO_SKILL_ID, 1, 0) levelupskill(actor, SkillConfigId.DEMON_HERMIT_COMMON_THREE_SKILL_ID, 1, 0) end end function skilltest(actor) Skill.releaseSkill(actor, SkillConfigId.DEMON_HERMIT_SKILL_ID) end --- 技能生效前触发 function Skill.releaseSkill(actor, skillid) if skillid == SkillConfigId.DEMON_HERMIT_SKILL_ID then setplaydef(actor, PlayerDefKey.skill.DEMON_HERMIT_SKILL, 1) local skillTable = {SkillConfigId.DEMON_HERMIT_COMMON_ONE_SKILL_ID, SkillConfigId.DEMON_HERMIT_COMMON_TWO_SKILL_ID, SkillConfigId.DEMON_HERMIT_COMMON_THREE_SKILL_ID} setskillopen(actor, skillTable, 1) -- setskillopen(actor,SkillConfigId.DEMON_HERMIT_COMMON_ONE_SKILL_ID,1) -- setskillopen(actor,SkillConfigId.DEMON_HERMIT_COMMON_TWO_SKILL_ID,1) -- setskillopen(actor,SkillConfigId.DEMON_HERMIT_COMMON_THREE_SKILL_ID,1) SceneMap.sendEnterViewInfoByType(actor, SceneMap.viewKey.DEMON_HERMIT_SKILL, 1) end end function Skill.closePet(actor) local pets = getpets(actor) local typeString = type(pets) if typeString ~= "table" then return nil end for index, value in ipairs(pets) do local petActor = pets[index] removepet(petActor); end end --- 关闭恶灵召唤技能 function Skill.closeDemonHermitSkill(actor) -- local skill = getplaydef(actor, PlayerDefKey.skill.DEMON_HERMIT_SKILL) -- if skill and skill == 1 then -- local skillTable = {SkillConfigId.DEMON_HERMIT_COMMON_ONE_SKILL_ID,SkillConfigId.DEMON_HERMIT_COMMON_TWO_SKILL_ID,SkillConfigId.DEMON_HERMIT_COMMON_THREE_SKILL_ID} -- setskillopen(actor,skillTable,0) -- --setskillopen(actor,SkillConfigId.DEMON_HERMIT_COMMON_TWO_SKILL_ID,0) -- --setskillopen(actor,SkillConfigId.DEMON_HERMIT_COMMON_THREE_SKILL_ID,0) -- SceneMap.sendEnterViewInfoByType(actor, SceneMap.viewKey.DEMON_HERMIT_SKILL, 0) -- setplaydef(actor, PlayerDefKey.skill.DEMON_HERMIT_SKILL,0) -- info("关闭召唤恶灵") -- end end SYS_SKILL_TRANSFER = "R$skill_transfer" function Skill.GetTransfers() local transfers = getsysvar(SYS_SKILL_TRANSFER) if transfers == nil then transfers = {} end return transfers end function Skill.SetTransfers(transfers) setsysvar(SYS_SKILL_TRANSFER, transfers) end function Skill.releaseSkillAfter(actor, skillid) if skillid ~= 1005003 then return end local teamid = getbaseinfo(actor, "teamid") if teamid == nil or teamid == "" or teamid == 0 then return end local transfers = Skill.GetTransfers() if transfers == nil then transfers = {} end local playerName = getbaseinfo(actor, "rolename") local mapId = tonumber(getbaseinfo(actor, "mapid")) local x = tonumber(getbaseinfo(actor, "x")) local y = tonumber(getbaseinfo(actor, "y")) local line = tonumber(getbaseinfo(actor, "line")) local transferData = transfers[actor:toString()]; if transferData == nil then transferData = { index = 0 } end transferData.index = transferData.index + 1 transferData.rid = actor:toString() transferData.playerName = playerName transferData.mapId = mapId transferData.line = line transferData.x = x transferData.y = y transfers[actor:toString()] = transferData Skill.SetTransfers(transfers) local team = getteaminfo(teamid) for k, v in pairs(team.allteammemberinfo) do if tostring(v.rid) ~= tostring(actor:toString()) then local tActor = getactor(actor, v.rid) sendluamsg(tActor, LuaMessageIdToSever.SkillTransfer, transferData) end end end function Skill.onTransfers(actor, data) local rid = data.rid if rid == nil or rid == "" then return end rid = tostring(rid) local index = data.index local transfers = Skill.GetTransfers() if transfers == nil or transfers[rid] == nil then tipinfo(actor, string.format("未知错误")) return end local transferData = transfers[rid]; if transferData.index ~= index then tipinfo(actor, string.format("操作过时")) return end local canTransfer, reason = SummonAndChat.checkMapTransfer(actor, transferData.mapId, transferData.line, transferData.x, transferData.y) if canTransfer then -- 执行传送 maptransfer(actor, transferData.x, transferData.y, transferData.mapId, transferData.line, 3) addbuff(actor, 100500301, 1) else tipinfo(actor, "无法传送:" .. reason) end end