--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by zhangkai. --- DateTime: 2024/8/28 下午9:14 --- MonsterTaskGoal = {} ---@see 在指定地图对怪造成伤害 function MonsterTaskGoal.FlushHurtMapMonster(actor, type, goal_id, goal_count, param) if param == nil then return goal_count end local monsterId = tonumber(param["monsterid"]) local mapId = tonumber(param["mapid"]) local hurt = tonumber(param["hurt"]) if hurt < 1 then return goal_count 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 local monsterCfg = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam","id", goal_id)) local mapCfg = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2","id", goal_id)) if monsterId ~= monsterCfg or mapId ~= mapCfg then return goal_count end return goal_count + hurt end ---@alias 击杀指定类型怪物 function MonsterTaskGoal.FlushKillTypeMonster(_, _, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local monster_id = param[1] local cfg_map_id = param[2] local mon_type = ConfigDataManager.getTableValue("cfg_monster", "type", "id", monster_id) local map_type = ConfigDataManager.getTableValue("cfg_map_info", "type", "id", cfg_map_id) local g_config = ConfigDataManager.getById("cfg_task_target", goal_id) if table.isEmpty(g_config) then return goal_count end local target = g_config.taskgoalparam if tonumber(mon_type) ~= tonumber(target) then return goal_count end local target_2 = g_config.taskgoalparam2 if target_2 and target_2 ~= "" then if tonumber(map_type) ~= tonumber(target_2) then return goal_count end end return goal_count + 1 end ---@see 击杀x次指定等级以上怪物 function MonsterTaskGoal.KillLevelMonster(actor, type, goal_id, goal_count, param) if param == nil then return goal_count end local monsterLv = tonumber(ConfigDataManager.getTableValue("cfg_monster", "level", "id", param)) if monsterLv == nil then return goal_count end local monsterType = tonumber(ConfigDataManager.getTableValue("cfg_monster", "type", "id", param)) local needType = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam","id", goal_id)) if needType ~= nil and monsterType ~= needType then return goal_count end local levelParam = ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam2","id", goal_id) if string.isNullOrEmpty(levelParam) then return goal_count + 1 end local leverArray = string.split(levelParam, "#") if #leverArray == 1 and monsterLv >= tonumber(leverArray[1]) then return goal_count + 1 end if #leverArray == 2 then if monsterLv >= tonumber(leverArray[1]) and monsterLv <= tonumber(leverArray[2]) then return goal_count + 1 end end return goal_count end ---@see 尾刀击杀怪物 function MonsterTaskGoal.LastKillMonster(_, _, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local monster_id = string.tonumber(param[1]) local mongen_id = string.tonumber(param[3]) 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_gen_id = string.split(target_2, "#") if target_id > 0 and #target_gen_id > 0 then if target_id == monster_id and table.contains(target_gen_id, mongen_id) then return goal_count + 1 end elseif target_id > 0 and #target_gen_id < 1 then if target_id == monster_id then return goal_count + 1 end elseif target_id < 1 and #target_gen_id > 0 then if table.contains(target_gen_id, mongen_id) then return goal_count + 1 end end return goal_count end ---@see 首刀击杀怪物 function MonsterTaskGoal.FirstAttackMonster(actor, type, goal_id, goal_count, param) if table.isEmpty(param) then return goal_count end local needCfgId = tonumber(ConfigDataManager.getTableValue("cfg_task_target", "taskgoalparam","id", goal_id)) local monsterCfgId = tonumber(param[1]) if needCfgId == nil or needCfgId == monsterCfgId then return goal_count + 1 end return goal_count end