123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- ---
- --- 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
|