Open Schokokex opened 4 years ago
InsertDamageFilter("make Damage =1", function(event) event.damage =1 end) InsertDamageFilter("make Damage = 4", function(event) event.damage = 4 end) InsertDamageFilter("make Damage = 10", 1, function(event) event.damage = 10 end) print(table.unpack(GetDamageFilters())) -- "make Damage =1" , "make Damage = 10", "make Damage = 4" --- src local filterNames = {"BountyRunePickup", "AbilityTuningValue", "Damage", "ExecuteOrder", "RuneSpawn", "Healing", "ItemAdedToInventory", "ModifierGained", "ModifyExperience", "ModifyGold", "TrackingProjectile"} local filterTables = {} local filterLabels = {} for _,fName in pairs(filterNames) do filterTables[fName] = {} filterLabels[fName] = {} local xFilterTable = filterTables[fName] local xFilterLabelTable = filterLabels[fName] _G[fName.."Filter"] = function (num, func, str) local pos,f,s = argSorter({num,func,str},{"number","function","string"},{[2]=true}) pos = pos and math.clamp(math.ceil(pos),#xFilterTable+1,1) or #xFilterTable +1 table.insert(xFilterTable ,pos,f) table.insert(xFilterLabelTable ,pos, s or tostring(f)) return pos end _G["Get"..fName.."Filters"] = function() return table.pack(table.unpack(xFilterLabelTable)) end _G["Remove"..fName.."Filter"] = function(pos) table.remove(damageFilterTable,pos) table.remove(damageFilterLabelTable,pos) end _G["RemoveAll"..fName.."Filters"] =function() damageFilterTable = {} damageFilterLabelTable = {} end end