--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by zhangkai. --- DateTime: 2024/8/28 下午8:31 --- EquipTaskGoal = {} ---@see 合成次数 function EquipTaskGoal.FlushSynthesisCount(actor, type, goal_id, goal_count, param) if table.isNullOrEmpty(param) then return goal_count end local synthesisId = param["synthesisid"] local num = param["num"] local needCount = ConfigDataManager.getTableValue("cfg_task_target", "goalcount", "id", goal_id) if needCount == nil or goal_count >= tonumber(needCount) then return goal_count end local goalParam = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) if goalParam == nil or tonumber(goalParam) ~= tonumber(synthesisId) then return goal_count end --local synthesisCount = tonumber(getplaydef(actor,"T$_ItemSynthesisCount")) return goal_count + num end ---@see 回收次数 function EquipTaskGoal.FlushRecoveryCount(actor, type, goal_id, goal_count, param) if table.isNullOrEmpty(param) then return end local needCount = ConfigDataManager.getTableValue("cfg_task_target", "goalcount", "id", goal_id) if needCount == nil or goal_count >= tonumber(needCount) then return goal_count end return goal_count + 1 end ---@see 指定部位强化到达指定等级 function EquipTaskGoal.FlushPartsStrengthenLv(actor, type, goal_id, goal_count, param) --local needCount = ConfigDataManager.getTableValue("cfg_task_target", "goalcount", "id", goal_id) --if goal_count >= tonumber(needCount) then -- return goal_count --end ----local part = param["part"] ----local level = param["level"] --local goalPart = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) --local goalLv = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2", "id", goal_id) ----jprint("强化任务刷新,",goalPart, goalLv,goal_count) --if not string.isNullOrEmpty(goalPart) then -- local goalPartArray = string.split(goalPart, "#") -- for _, part in pairs(goalPartArray) do -- local pass = EquipAndAppear.CheckPartEquipStrengthLv(actor, tonumber(part), tonumber(goalLv)) -- if pass then -- return math.min(goal_count + 1, tonumber(needCount)) -- end -- end --else -- local ok = EquipAndAppear.CheckPartEquipStrengthLv(actor, nil, tonumber(goalLv)) -- if ok then -- return math.min(goal_count + 1, tonumber(needCount)) -- end --end --return goal_count return CommonTaskGoal.EquipAppendAndStrengthen(actor, goal_id, goal_count, "strengthlv") end ---@see 首饰升级 function EquipTaskGoal.FlushJewelryLvUp(actor, _, goal_id, _, param) local target_type_str = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_lv_str = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2", "id", goal_id) local target_type = string.isNullOrEmpty(target_type_str) and 0 or tonumber(target_type_str) local target_lv = string.isNullOrEmpty(target_lv_str) and 0 or tonumber(target_lv_str) local equip_data = EquipAndAppear.getLuaItemExtData(actor) if table.isEmpty(equip_data) then return 0 end local max_count = 0 local function checkEquip(equip, cfg_id) if table.isEmpty(equip) then return 0 end local level = equip.ssuplv or 0 local subtype_str = ConfigDataManager.getTableValue("cfg_item", "subtype", "id", cfg_id) local subtype = string.isNullOrEmpty(subtype_str) and 0 or tonumber(subtype_str) if target_type == tonumber(subtype) and level >= target_lv then return 1 end return 0 end if not table.isEmpty(param) then local id = param[1] local cfg_id = param[2] local equip = equip_data[id] max_count = max_count + checkEquip(equip, cfg_id) else local all_equip = getputonequipinfo(actor) if table.isEmpty(all_equip) then return 0 end for _, v in pairs(all_equip) do max_count = max_count + checkEquip(equip_data[v.id], v.cfgid) end end return max_count end ---@see 指定部位追加到达指定等级 function EquipTaskGoal.FlushPartsAppendLv(actor, _, goal_id, goal_count, _) return CommonTaskGoal.EquipAppendAndStrengthen(actor, goal_id, goal_count, "appendlv") end ---@see 重新获取一个指定道具 function EquipTaskGoal.FlushReGetItem(_, _, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local cfg_id = param[1] local count = param[2] local target_str = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2", "id", goal_id) local target_arr = string.split(target_str, "#") if table.isEmpty(target_arr) then return goal_count end if not table.contains(target_arr, tostring(cfg_id)) then return goal_count end return goal_count + count end ---@see 装备叠加 function EquipTaskGoal.FlushEquipSuperposition(_, _, goal_id, goal_count, param) return CommonTaskGoal.CheckItemIdsAndTypeByGoodsId(goal_id, goal_count, param) end ---@see 镶嵌萤石 function EquipTaskGoal.FlushInlaidGemstones(actor, _, _, goal_count, param) return EquipGem.getAllGemCount(actor) end ---@see 卓越词条 function EquipTaskGoal.FlushExcellenceAttr(actor, _, goal_id, goal_count, _) local all_equip = getputonequipinfo(actor) if table.isEmpty(all_equip) then return 0 end local max_count = 0 local target_part = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) for _, equip in pairs(all_equip) do local entries_size = #equip.entries if tonumber(target_part) > 0 then local part = gameequip.pos(equip.equipindex) if tonumber(part) == target_part then return entries_size end end -- 任意部位大于指定数量 if entries_size >= tonumber(goal_count) then return entries_size end -- 记录最大值 if entries_size > max_count then max_count = entries_size end end return max_count end ---@see 穿戴装备卓越词条数量 function EquipTaskGoal.FlushExcellenceAttrCount(actor, _, goal_id, goal_count, _) local target_type_str = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_type = string.isNullOrEmpty(target_type_str) and 0 or tonumber(target_type_str) if target_type < 1 then -- 已穿戴的卓越词条数量 return EquipAndAppear.GetEquipsSumExcellentEntryCount(actor) end local sum_value = 0 local all_equip = getputonequipinfo(actor) if table.isEmpty(all_equip) then return sum_value end for _, equip in pairs(all_equip) do local sub_type = ConfigDataManager.getTableValue("cfg_item", "subtype", "id", equip.cfgid) if tonumber(sub_type) == target_type then sum_value = sum_value + #equip.entries end end return sum_value end ---@see 回收获得指定道具 function EquipTaskGoal.FlushRecoveryGetAppointItem(_, _, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local target = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local recovery_id = string.tonumber(target) if recovery_id < 1 then return goal_count end local count = param[recovery_id] == nil and 0 or param[recovery_id] return goal_count + count end ---@see 穿戴装备累计强化x次数 function EquipTaskGoal.EquipStrengthenTimes(actor, _, goal_id, goal_count, param) local totalCount = EquipAndAppear.GetEquipStrengthCount(actor) local needCount = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "goalcount", "id", goal_id)) local finalCount = math.min(totalCount, needCount) return finalCount end ---@see 穿戴装备的总追加达到x级 function EquipTaskGoal.EquipAppendTotalLv(actor, _, goal_id, goal_count, param) local sumAppendLv = EquipAndAppear.GetEquipsSumAppendLv(actor) return math.max(goal_count, sumAppendLv) end ---@see 穿戴指定装备 function EquipTaskGoal.SpecificStageEquip(actor, _, goal_id, goal_count, param) local needStage = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam","id", goal_id)) local ratingParam = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2","id", goal_id) local ratingLimit = {} if not string.isNullOrEmpty(ratingParam) then local ratingArray = string.split(ratingParam, "#") for i = 1, #ratingArray do table.insert(ratingLimit, tonumber(ratingArray[i])) end end --jprint("穿戴指定品阶装备任务", needStage, ratingLimit) local sumCount = EquipAndAppear.CheckSpecificStageEquipCount(actor, needStage, ratingLimit) local finalCount = math.max(goal_count, sumCount) return finalCount end ---@see 镶嵌卡牌 function EquipTaskGoal.InlaidTransformationCard(_, _, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local card_id = tonumber(param[1]) local card_quality = tonumber(param[2]) local target = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_2 = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2", "id", goal_id) local target_id = string.tonumber(target) local target_ids = string.split(target_2, "#") local function matchesTarget() if target_id > 0 and #target_ids > 0 then return target_id == card_quality and table.contains(target_ids, card_id) elseif target_id > 0 then return target_id == card_quality elseif #target_ids > 0 then return table.contains(target_ids, card_id) end return true end if matchesTarget() then return goal_count + 1 end return goal_count end ---@see 合成卡牌 function EquipTaskGoal.FlushSynthesisCard(_, _, goal_id, goal_count, param) local item_type = string.tonumber(param) if item_type < 1 then return goal_count end local target_str = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_id = string.tonumber(target_str) if target_id > 0 and item_type ~= target_id then return goal_count end return goal_count + 1 end ---@see 装备指定数量圣杯 function EquipTaskGoal.FlushTakeOnGrailCount(actor, _, goal_id, _, _) local target = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_2 = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2", "id", goal_id) local target_grade = string.tonumber(target) local target_quality = string.tonumber(target_2) return AngelMajorGrail.getGrailCountByCondition(actor, target_grade, target_quality) end ---@see 强化圣杯 function EquipTaskGoal.FlushStrengthenGrail(actor, _, goal_id, _, _) local target = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam", "id", goal_id) local target_lv = string.tonumber(target) return AngelMajorGrail.getGrailCountByStrengthLevel(actor, target_lv) end