Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- How the caster config works :
- --[[
- Options:
- words - words of spell to cast
- creatures - table of creatures to consider, if you disclude this it will consider all
- count - amount of creatures in order to cast
- range - distance from self to consider creatures
- padding - for pvpsafe, if enabled each spell must have a padding setting, distance from self players must be in order to cast
- needTarget - for spells that require a target, no need for a count or padding if this is enabled
- ]]--
- -- user config:
- ExoriHur = true
- Exori = true
- ExoriGran = true
- ExoriIco = true
- ExoriGranIco = true
- Creatures = {'Creature 1', 'Creature 2', 'Creature 3'} -- All names must be in 'CamelCase'
- -- the caster module:
- local Attacks = {}
- spellCaster = Module.New('Caster', function(module)
- for _, data in ipairs(Attacks) do
- if (not PvPSafe) or (Self.isAreaPvPSafe(data.padding,true,true)) then
- if data.needTarget then
- local target = Creature.New(Self.TargetID())
- if (data.creatures and table.find(data.creatures, target:Name(), false)) or (not data.creatures) then
- if target:DistanceFromSelf() <= data.range and Self.CanCastSpell(data.words) then
- Self.Say(data.words)
- end
- end
- else
- local count, mob = 0, Self.GetTargets(data.range)
- if data.creatures then
- for i = 1, #mob do
- if mob[i]:isOnScreen() and table.find(data.creatures, mob[i]:Name(), false) then
- count = count + 1
- end
- end
- else
- count = #mob
- end
- if count >= data.count and Self.CanCastSpell(data.words) then
- Self.Say(data.words)
- end
- end
- end
- end
- end,false)
- -- Creating the config table based on user configuration:
- local n = 1
- if Exori then
- Attacks[n] = {words = 'exori', creatures = Creatures, count = 2, range = 1}
- n = n + 1 -- since we already added Attacks[1] let's add Attacks[2] in the next
- end
- if ExoriGran then
- Attacks[n] = {words = 'exori gran', creatures = Creatures, count = 3, range = 1}
- n = n + 1
- end
- if ExoriGranIco then
- Attacks[n] = {words = 'exori gran ico', creatures = Creatures, count = 1, range = 1, needTarget = true}
- n = n + 1
- end
- if ExoriIco then
- Attacks[n] = {words = 'exori ico', creatures = Creatures, count = 1, range = 1, needTarget = true}
- n = n + 1
- end
- if ExoriHur then
- Attacks[n] = {words = 'exori hur', creatures = Creatures, count = 1, range = 4, needTarget = true}
- n = n+1
- end
- if (Exori or ExoriGran or ExoriGranIco or ExoriIco or ExoriHur) then
- spellCaster:Start() -- starting the module
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement