diff --git a/customWorldboss.lua b/customWorldboss.lua
deleted file mode 100644
index 988764a..0000000
--- a/customWorldboss.lua
+++ /dev/null
@@ -1,2037 +0,0 @@
---Copyright (C) 2022 https://github.com/55Honey
---
---This program is free software: you can redistribute it and/or modify
---it under the terms of the GNU Affero General Public License as published by
---the Free Software Foundation, either version 3 of the License, or
---(at your option) any later version.
---
---This program is distributed in the hope that it will be useful,
---but WITHOUT ANY WARRANTY; without even the implied warranty of
---MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---GNU Affero General Public License for more details.
---
---You should have received a copy of the GNU Affero General Public License
---along with this program. If not, see .
---
---
---
---
--- Created by IntelliJ IDEA.
--- User: Silvia
--- Date: 17/05/2021
--- Time: 19:50
--- To change this template use File | Settings | File Templates.
--- Originally created by Honey for Azerothcore
--- requires ElunaLua module
-
-
--- This module spawns (custom) NPCs and grants them scripted combat abilities
-------------------------------------------------------------------------------------------------
--- ADMIN GUIDE: - compile the core with ElunaLua module
--- - adjust config in this file
--- - add this script to ../lua_scripts/
--- - adjust the IDs and config flags in case of conflicts and run the associated SQL to add the required NPCs
--- - the acore_cms module assumes that 1112001 is the boss of encounter 1 and adding +10 for each subsequent encounter
--- (1112011 = boss for encounter 2 / 1112021 = boss for encounter 3, etc.)
-------------------------------------------------------------------------------------------------
--- GM GUIDE: - use .startevent $event $difficulty to start and spawn
--- - maybe offer teleports
--- - use .stopevent to end the event and despawn the NPC
-------------------------------------------------------------------------------------------------
-local Config = {} --general config flags
-
-local Config_npcEntry = {} --db entry of the NPC creature to summon the boss
-local Config_npcText = {} --gossip in npc_text to be told by the summoning NPC
-local Config_bossEntry = {} --db entry of the boss creature
-local Config_addEntry = {} --db entry of the add creature
-
-local Config_bossSpell1 = {} --directly applied to the tank
-local Config_bossSpell2 = {} --randomly applied to a player in 35m(configurable) range
-local Config_bossSpell2MaxRange = {} --max range im m to check for targets for boss spell 2 (default 35)
-local Config_bossSpell3 = {} --on the 2nd nearest player within 30m (only when adds are dead)
-local Config_bossSpell4 = {} --on a random player within 40m (only when adds are dead)
-local Config_bossSpell4Counter = {} --amount of casts to perform for spell 4. defaults to 1
-local Config_bossSpell4MaxRange = {} --max range im m to check for targets for boss spell 4 (default 40)
-local Config_bossSpell5 = {} --directly applied to the tank with adds alive
-local Config_bossSpell6 = {} --directly applied to the tank when adds are dead
-local Config_bossSpell7 = {} --directly applied to the tank
-local Config_bossSpell8 = {} --directly applied to the tank x seconds after spell 7
-local Config_bossSpell8delay = {} --delay between spell 7 and 8. Must be smaller than timer7 / 2
-local Config_bossSpellSelf = {} --cast on boss while adds are still alive
-local Config_bossSpellEnrage = {} --cast on boss once after Config_bossSpellEnrageTimer ms have passed
-
-local Config_bossSpellTimer1 = {} -- This timer applies to Config_bossSpell1 (in ms)
-local Config_bossSpellTimer2 = {} -- This timer applies to Config_bossSpell2 (in ms)
-local Config_bossSpellTimer3 = {} -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later (in ms)
--- local Config_bossSpellTimer4 = {} -- Not used. Timer3 covers BossSpells 3+4
-local Config_bossSpellTimer5 = {} -- This timer applies to Config_bossSpell5+6 (in ms)
--- local Config_bossSpellTimer6 = {} -- Not used. Timer5 covers BossSpells 5+6
-local Config_bossSpellTimer7 = {} -- This timer applies to Config_bossSpell7+8 (in ms)
--- local Config_bossSpellTimer8 = {} -- Not used. Timer7 covers BossSpells 7+8
-local Config_bossSpellEnrageTimer = {} -- Time in ms until Config_bossSpellEnrage is cast
-local Config_minPhaseForTimer7 = {} -- From this phase on the boss will use Timer 7 to cast Spell 7+8
-
-local Config_bossSpellModifier1bp0 = {} -- Custom base value of the spell 1s effect #1. Default if left out.
-local Config_bossSpellModifier1bp1 = {} -- Custom base value of the spell 1s effect #2. Default if left out.
-local Config_bossSpellModifier2bp0 = {} -- Custom base value of the spell 2s effect #1. Default if left out.
-local Config_bossSpellModifier2bp1 = {} -- Custom base value of the spell 2s effect #2. Default if left out.
-local Config_bossSpellModifier3bp0 = {} -- Custom base value of the spell 3s effect #1. Default if left out.
-local Config_bossSpellModifier3bp1 = {} -- Custom base value of the spell 3s effect #2. Default if left out.
-local Config_bossSpellModifier4bp0 = {} -- Custom base value of the spell 4s effect #1. Default if left out.
-local Config_bossSpellModifier4bp1 = {} -- Custom base value of the spell 4s effect #2. Default if left out.
-local Config_bossSpellModifier5bp0 = {} -- Custom base value of the spell 5s effect #1. Default if left out.
-local Config_bossSpellModifier5bp1 = {} -- Custom base value of the spell 5s effect #2. Default if left out.
-local Config_bossSpellModifier6bp0 = {} -- Custom base value of the spell 6s effect #1. Default if left out.
-local Config_bossSpellModifier6bp1 = {} -- Custom base value of the spell 6s effect #2. Default if left out.
-local Config_bossSpellModifier7bp0 = {} -- Custom base value of the spell 6s effect #1. Default if left out.
-local Config_bossSpellModifier7bp1 = {} -- Custom base value of the spell 6s effect #2. Default if left out.
-local Config_bossSpellModifier8bp0 = {} -- Custom base value of the spell 6s effect #1. Default if left out.
-local Config_bossSpellModifier8bp1 = {} -- Custom base value of the spell 6s effect #2. Default if left out.
-
-local Config_addHealthModifierParty = {} -- modifier to change health for party encounter. Value in the SQL applies for raid
-local Config_addsAmount = {} -- how many adds will spawn
-
-local Config_addSpell1 = {} -- min range 30m, 1-3rd farthest target within 30m
-local Config_addSpell2 = {} -- min range 45m, cast on tank
-local Config_addSpell3 = {} -- min range 0m, cast on Self
-local Config_addSpell4 = {} -- cast on the boss
-
-local Config_addSpellEnrage = {} -- This spell will be cast on the add in 5man mode only after 300 seconds
-local Config_addSpellTimer1 = {} -- This timer applies to Config_addSpell1 (in ms)
-local Config_addSpellTimer2 = {} -- This timer applies to Config_addSpell2 (in ms)
-local Config_addSpellTimer3 = {} -- This timer applies to Config_addSpell3 (in ms)
-local Config_addSpellTimer4 = {} -- This timer applies to Config_addSpell4 (in ms)
-
-local Config_addSpellModifier1bp0 = {} -- Custom base value of the spell 1s effect #1. Default if left out.
-local Config_addSpellModifier1bp1 = {} -- Custom base value of the spell 1s effect #2. Default if left out.
-local Config_addSpellModifier2bp0 = {} -- Custom base value of the spell 2s effect #1. Default if left out.
-local Config_addSpellModifier2bp1 = {} -- Custom base value of the spell 2s effect #2. Default if left out.
-local Config_addSpellModifier3bp0 = {} -- Custom base value of the spell 3s effect #1. Default if left out.
-local Config_addSpellModifier3bp1 = {} -- Custom base value of the spell 3s effect #2. Default if left out.
-
-local Config_aura1Add1 = {} -- an aura to add to the 1st add
-local Config_aura2Add1 = {} -- another aura to add to the 1st add
-local Config_aura1Add2 = {} -- an aura to add to the 2nd add
-local Config_aura2Add2 = {} -- another aura to add to the 2nd add
-local Config_aura1Add3 = {} -- an aura to add to all adds from the 3rd on
-local Config_aura2Add3 = {} -- another aura to add to all adds from the 3rd on
-
-local Config_addSpell3Yell = {} -- yell for the adds when Spell 3 is cast
-local Config_addEnoughYell = {} -- yell for the add at 33% and 66% hp
-local Config_addEnoughSound = {} -- sound to play when the add is at 33% and 66%
-local Config_addSpell2Sound = {} -- sound to play when add casts spell 2
-local Config_bossYellPhase2 = {} -- yell for the boss when phase 2 starts
-local Config_bossSpellSelfYell = {} -- yell for the boss when they cast on themself
-
-local Config_fireworks = {} -- these are the fireworks to be cast randomly for 20s when an encounter was beaten
-
-------------------------------------------
--- Begin of config section
-------------------------------------------
-
--- Name of Eluna dB scheme
-Config.customDbName = "ac_eluna"
--- Min GM rank to start an event
-Config.GMRankForEventStart = 2
--- Min GM rank to add NPCs to the db
-Config.GMRankForUpdateDB = 3
--- set to 1 to print error messages to the console. Any other value including nil turns it off.
-Config.printErrorsToConsole = 1
--- time in ms before adds enrage in 5man mode
-Config.addEnrageTimer = 300000
--- spell to cast at 33 and 66%hp in party mode (charge with a knockback = 19471)
-Config.addEnoughSpell = 19471
--- base score per encounter
-Config.baseScore = 40
--- additional score per difficulty level
-Config.additionalScore = 10
--- set to award score for beating raids. Any other value including nil turns it off.
-Config.rewardRaid = 1
--- set to 1 to store succesful raid attempts in the db. Any other value including nil turns it off.
-Config.storeRaid = 1
--- set to award score for beating party encounter. Any other value including nil turns it off.
-Config.rewardParty = 0
--- set to 1 to store succesful party attempts in the db. Any other value including nil turns it off.
-Config.storeParty = 1
--- npc entry for party-only mode
-Config.partySelectNpc = 1112999
--- generic welcome text1
-Config.defaultNpcText1 = 91101
--- generic welcome text2
-Config.defaultNpcText2 = 91102
--- activate permanent 5man only NPC
-Config.partySelectNpcActive = 0
--- Map where to spawn the exchange NPC
-Config.InstanceId = 0
-Config.MapId = 1
--- Pos where to spawn the exchange NPC
-Config.NpcX = -7168.4
-Config.NpcY = -3961.6
-Config.NpcZ = 9.403
-Config.NpcO = 6.24
-Config.PartyNpcYellText = 'Come to the Gadgetzan graveyard, if you dare. Try and prove yourself to Chromie!'
-Config.PartyNpcSayText = 'What are you waiting for? Bring a party of five and step up against the enemies of time!'
-
-------------------------------------------
--- List of encounters:
--- 1: Level 50, Glorifrir Flintshoulder / Zombie Captain
--- 2: Level 40, Pondulum of Deem / Seawitch
--- 3: Level 50, Crocolisk Dundee / Aligator Minion
--- 4: Level 50, Crocolisk Bunbee / Aligator Pet
--- 5: Level 60, Crocolisk Rundee / Aligator Guard
--- 6: Level 60: One-Three-Three-Seven / Ragnarosqt
--- 7: Level 60: Big Bad Bug / Bug's Bunny
-------------------------------------------
-
-------------------------------------------
--- Begin of encounter 1 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[1] = 1112001 --db entry of the boss creature
-Config_npcEntry[1] = 1112002 --db entry of the NPC creature to summon the boss
-Config_addEntry[1] = 1112003 --db entry of the add creature
-Config_npcText[1] = 91111 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[1] = 38846 --directly applied to the tank-- Forceful Cleave (Target + nearest ally)
-Config_bossSpell2[1] = 45108 --randomly applied to a player in 35m range-- CKs Fireball
-Config_bossSpell2MaxRange[1] = 35 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[1] = 53721 --on the 2nd nearest player within 30m-- Death and decay (10% hp per second)
-Config_bossSpell4[1] = 37279 --on a random player within 40m-- Rain of Fire
-Config_bossSpell4Counter[1] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[1] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[1] = nil --this line is not neccesary. If a spell is missing it will just be skipped
-Config_bossSpell6[1] = nil --this line is not neccesary. If a spell is missing it will just be skipped
-Config_bossSpellSelf[1] = 69898 --cast on boss while adds are still alive-- Hot
-Config_bossSpellEnrage[1] = 69166 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[1] = 19000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[1] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[1] = 11000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[1] = nil -- This timer applies to Config_bossSpell5+6
-Config_bossSpellEnrageTimer[1] = 180000
-
-Config_bossSpellModifier1bp0[1] = nil -- base damage of the Cleave
-Config_bossSpellModifier1bp1[1] = nil -- not required if nil
-Config_bossSpellModifier2bp0[1] = 2000 -- Fireball modifier hit
-Config_bossSpellModifier2bp1[1] = 2000 -- Fireball modifier tick
-Config_bossSpellModifier3bp0[1] = 10 -- base damage of the D&D
-Config_bossSpellModifier3bp1[1] = nil -- not required if nil
-Config_bossSpellModifier4bp0[1] = 1200 -- tick damage of fire rain
-Config_bossSpellModifier4bp1[1] = nil -- not required if nil
-Config_bossSpellModifier5bp0[1] = nil -- not required if nil
-Config_bossSpellModifier5bp1[1] = nil -- not required if nil
-Config_bossSpellModifier6bp0[1] = nil -- not required if nil
-Config_bossSpellModifier6bp1[1] = nil -- not required if nil
-
-
-Config_addHealthModifierParty[1] = 1 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[1] = 3 -- how many adds will spawn
-
-Config_addSpell1[1] = 12421 -- min range 30m, 1-3rd farthest target within 30m -- Mithril Frag Bomb 8y 149-201 damage + stun
-Config_addSpell2[1] = 60488 -- min range 45m, cast on tank -- Shadow Bolt (30)
-Config_addSpell3[1] = 24326 -- min range 0m -- HIGH knockback (ZulFarrak beast)
-Config_addSpell4[1] = 69898 -- cast on boss - Hot
-Config_addSpellEnrage[1] = 69166 -- Enrage after 300 seconds
-
-Config_addSpellTimer1[1] = 13000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[1] = 11000 -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[1] = 37000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[1] = 12000 -- This timer applies to Config_addSpell4
-
-Config_addSpellModifier1bp0[1] = 500 -- not required if nil
-Config_addSpellModifier1bp1[1] = nil -- not required if nil
-Config_addSpellModifier2bp0[1] = 2000 -- not required if nil
-Config_addSpellModifier2bp1[1] = nil -- not required if nil
-Config_addSpellModifier3bp0[1] = nil -- not required if nil
-Config_addSpellModifier3bp1[1] = nil -- not required if nil
-
-Config_aura1Add1[1] = 34184 -- an aura to add to the 1st add-- Arcane
-Config_aura2Add1[1] = 7941 -- another aura to add to the 1st add-- Nature
-Config_aura1Add2[1] = 7942 -- an aura to add to the 2nd add-- Fire
-Config_aura2Add2[1] = 7940 -- another aura to add to the 2nd add-- Frost
-Config_aura1Add3[1] = 34182 -- an aura to add to the 3rd add-- Holy
-Config_aura2Add3[1] = 34309 -- another aura to add to the 3rd add-- Shadow
-
-Config_addSpell3Yell[1] = "Me smash." -- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[1] = "ENOUGH" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[1] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[1] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[1] = "You might have handled these creatures. But now I WILL handle YOU!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[1] = nil
-
-------------------------------------------
--- Begin of encounter 2 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[2] = 1112011 --db entry of the boss creature
-Config_npcEntry[2] = 1112012 --db entry of the NPC creature to summon the boss
-Config_addEntry[2] = 1112013 --db entry of the add creature
-Config_npcText[2] = 91112 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[2] = 33661 --directly applied to the tank-- Crush Armor: 10% reduction, stacks
-Config_bossSpell2[2] = 51503 --randomly applied to a player in 35m range-- Domination
-Config_bossSpell2MaxRange[2] = 35 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[2] = 35198 --on the 2nd nearest player within 30m-- AE fear
-Config_bossSpell4[2] = 35198 --on a random player within 40m-- AE Fear
-Config_bossSpell4Counter[2] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[2] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[2] = nil --this line is not neccesary. If a spell is missing it will just be skipped
-Config_bossSpell6[2] = 31436 --directly applied to the tank when adds are dead
-Config_bossSpellSelf[2] = nil --cast on boss while adds are still alive
-Config_bossSpellEnrage[2] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[2] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[2] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[2] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[2] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellEnrageTimer[2] = 300000
-
-Config_addHealthModifierParty[2] = 1 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[2] = 2 -- how many adds will spawn
-
-Config_addSpell1[2] = 10150 -- min range 30m, 1-3rd farthest target within 30m
-Config_addSpell2[2] = 37704 -- min range 45m, cast on tank
-Config_addSpell3[2] = 68958 -- min range 0m -- Blast Nova
-Config_addSpell4[2] = 69389 -- cast on the boss
-Config_addSpellEnrage[2] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[2] = 13000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[2] = 11000 -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[2] = 37000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[2] = 23000 -- This timer applies to Config_addSpell4
-
-Config_aura1Add1[2] = nil -- an aura to add to the 1st add--
-Config_aura2Add1[2] = nil -- another aura to add to the 1st add--
-Config_aura1Add2[2] = nil -- an aura to add to the 2nd add--
-Config_aura2Add2[2] = nil -- another aura to add to the 2nd add--
-Config_aura1Add3[2] = nil -- an aura to add to all ads from the 3rd on--
-Config_aura2Add3[2] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[2] = "Thissss." -- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[2] = "Ssssssuffer!"-- yell for the add at 33% and 66% hp
-Config_addEnoughSound[2] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[2] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[2] = "Now. You. Die."
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[2] = nil
-
-------------------------------------------
--- Begin of encounter 3 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[3] = 1112021 --db entry of the boss creature
-Config_npcEntry[3] = 1112022 --db entry of the NPC creature to summon the boss
-Config_addEntry[3] = 1112023 --db entry of the add creature
-Config_npcText[3] = 91113 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[3] = nil --directly applied to the tank--
-Config_bossSpell2[3] = 56909 --randomly applied to a player in 35m range-- Cleave, up to 10 targets
-Config_bossSpell2MaxRange[3] = 5 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[3] = nil --on the 2nd nearest player within 30m--
-Config_bossSpell4[3] = 11446 --on a random player within 40m-- 5min domination
-Config_bossSpell4Counter[3] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[3] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[3] = 22643 --directly applied to the tank with adds alive --volley
-Config_bossSpell6[3] = 22643 --directly applied to the tank when adds are dead --volley
-Config_bossSpellSelf[3] = 55948 --cast on boss while adds are still alive
-Config_bossSpellEnrage[3] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[3] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[3] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[3] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[3] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellEnrageTimer[3] = 300000
-
-Config_addHealthModifierParty[3] = 3 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[3] = 8 -- how many adds will spawn
-
-Config_addSpell1[3] = 29320 -- min range 30m, 1-3rd farthest target within 30m -- charge
-Config_addSpell2[3] = nil -- min range 45m, cast on tank
-Config_addSpell3[3] = 23105 -- min range 0m -- Lightning cloud
-Config_addSpell4[3] = nil -- cast on the boss
-Config_addSpellEnrage[3] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[3] = 37000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[3] = nil -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[3] = 37000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[3] = nil -- This timer applies to Config_addSpell4
-
-Config_aura1Add1[3] = nil -- an aura to add to the 1st add--
-Config_aura2Add1[3] = nil -- another aura to add to the 1st add--
-Config_aura1Add2[3] = nil -- an aura to add to the 2nd add--
-Config_aura2Add2[3] = nil -- another aura to add to the 2nd add--
-Config_aura1Add3[3] = nil -- an aura to add to all ads from the 3rd on--
-Config_aura2Add3[3] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[3] = "Mmmrrrrrrrr."-- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[3] = "Rooooaaar" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[3] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[3] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[3] = " I'll git ye!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[3] = "Yous Minions be feeding me all ya Strength!"
-
-------------------------------------------
--- Begin of encounter 4 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[4] = 1112031 --db entry of the boss creature
-Config_npcEntry[4] = 1112032 --db entry of the NPC creature to summon the boss
-Config_addEntry[4] = 1112033 --db entry of the add creature
-Config_npcText[4] = 91114 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[4] = nil --directly applied to the tank--
-Config_bossSpell2[4] = 56909 --randomly applied to a player in [Config_bossSpell2MaxRange] meters-- Cleave, up to 10 targets
-Config_bossSpell2MaxRange[4] = 5 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[4] = 19717 --on the 2nd nearest player within 30m-- fire rain
-Config_bossSpell4[4] = 11446 --on a random player within 40m-- 5min domination
-Config_bossSpell4Counter[4] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[4] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[4] = 22643 --directly applied to the tank with adds alive --volley
-Config_bossSpell6[4] = 22643 --directly applied to the tank when adds are dead --volley
-Config_bossSpell7[4] = nil --directly applied to the tank
-Config_bossSpell8[4] = nil --directly applied to the tank x seconds after spell 7
-Config_bossSpellSelf[4] = 55948 --cast on boss while adds are still alive
-Config_bossSpellEnrage[4] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[4] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[4] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[4] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[4] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellTimer7[4] = nil -- This timer applies to Config_bossSpell7+8
-Config_bossSpell8delay[4] = nil -- Delay between spell 7 and 8. Must be smaller than timer7 / 2
-Config_bossSpellEnrageTimer[4] = 300000
-
-Config_bossSpellModifier1bp0[4] = 35 -- base damage of the Cleave
-Config_bossSpellModifier1bp1[4] = nil -- not required if nil
-Config_bossSpellModifier2bp0[4] = nil -- not required if nil
-Config_bossSpellModifier2bp1[4] = nil -- not required if nil
-Config_bossSpellModifier3bp0[4] = 800 -- base damage of the fire rain
-Config_bossSpellModifier3bp1[4] = nil -- not required if nil
-Config_bossSpellModifier4bp0[4] = nil -- not required if nil
-Config_bossSpellModifier4bp1[4] = nil -- not required if nil
-Config_bossSpellModifier5bp0[4] = 250 -- base damage for the Frostbolt Volley in P1
-Config_bossSpellModifier5bp1[4] = nil -- not required if nil
-Config_bossSpellModifier6bp0[4] = 400 -- base damage for the Frostbolt Volley in P2
-Config_bossSpellModifier6bp1[4] = nil -- not required if nil
-Config_bossSpellModifier7bp0[4] = nil -- not required if nil
-Config_bossSpellModifier7bp1[4] = nil -- not required if nil
-Config_bossSpellModifier8bp0[4] = nil -- not required if nil
-Config_bossSpellModifier8bp1[4] = nil -- not required if nil
-
-Config_addHealthModifierParty[4] = 3 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[4] = 8 -- how many adds will spawn
-
-Config_addSpell1[4] = 29320 -- min range 30m, 1-3rd farthest target within 30m --charge
-Config_addSpell2[4] = nil -- min range 45m, cast on tank
-Config_addSpell3[4] = 23105 -- min range 0m -- lightning cloud
-Config_addSpell4[4] = 69898 -- cast on the boss -- hot
-Config_addSpellEnrage[4] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[4] = 37000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[4] = nil -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[4] = 37000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[4] = 12000 -- This timer applies to Config_addSpell4
-
-Config_addSpellModifier1bp0[4] = nil -- not required if nil
-Config_addSpellModifier1bp1[4] = nil -- not required if nil
-Config_addSpellModifier2bp0[4] = nil -- not required if nil
-Config_addSpellModifier2bp1[4] = nil -- not required if nil
-Config_addSpellModifier3bp0[4] = 500 -- Initial damage of Lightning Cloud
-Config_addSpellModifier3bp1[4] = 1000 -- Tick damage of Lightning Cloud
-
-Config_aura1Add1[4] = 42375 -- an aura to add to the 1st add-- AE heal
-Config_aura2Add1[4] = nil -- another aura to add to the 1st add--
-Config_aura1Add2[4] = 42375 -- an aura to add to the 2nd add-- AE heal
-Config_aura2Add2[4] = nil -- another aura to add to the 2nd add--
-Config_aura1Add3[4] = 42375 -- an aura to add to all ads from the 3rd on-- AE heal
-Config_aura2Add3[4] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[4] = "Mmmrrrrrrrr."-- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[4] = "Rooooaaar" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[4] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[4] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[4] = " I'll git ye!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[4] = "Yous Minions be feeding me all ya Strength!"
-
-------------------------------------------
--- Begin of encounter 5 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[5] = 1112041 --db entry of the boss creature
-Config_npcEntry[5] = 1112042 --db entry of the NPC creature to summon the boss
-Config_addEntry[5] = 1112043 --db entry of the add creature
-Config_npcText[5] = 91115 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[5] = nil --directly applied to the tank--
-Config_bossSpell2[5] = 56909 --randomly applied to a player in 35m range-- Cleave, up to 10 targets
-Config_bossSpell2MaxRange[5] = 5 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[5] = 19717 --on the 2nd nearest player within 30m--
-Config_bossSpell4[5] = 11446 --on a random player within 40m-- 5min domination
-Config_bossSpell4Counter[5] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[5] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[5] = 22643 --directly applied to the tank with adds alive --volley
-Config_bossSpell6[5] = 22643 --directly applied to the tank when adds are dead --volley
-Config_bossSpell7[5] = 16805 --directly applied to the tank
-Config_bossSpell8[5] = 16805 --directly applied to the tank x seconds after spell 7
-Config_bossSpell8delay[5] = 6000 --delay between spell 7 and 8. Must be smaller than timer7 / 2
-Config_bossSpellSelf[5] = 55948 --cast on boss while adds are still alive
-Config_bossSpellEnrage[5] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[5] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[5] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[5] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[5] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellTimer7[5] = 18000 -- This timer applies to Config_bossSpell7+8 (in ms)
-Config_bossSpellEnrageTimer[5] = 300000
-
-Config_bossSpellModifier1bp0[5] = 35 -- base damage of the Cleave
-Config_bossSpellModifier1bp1[5] = nil -- not required if nil
-Config_bossSpellModifier2bp0[5] = nil -- not required if nil
-Config_bossSpellModifier2bp1[5] = nil -- not required if nil
-Config_bossSpellModifier3bp0[5] = 800 -- base damage of the fire rain
-Config_bossSpellModifier3bp1[5] = nil -- not required if nil
-Config_bossSpellModifier4bp0[5] = nil -- not required if nil
-Config_bossSpellModifier4bp1[5] = nil -- not required if nil
-Config_bossSpellModifier5bp0[5] = 250 -- base damage for the Frostbolt Volley in P1
-Config_bossSpellModifier5bp1[5] = nil -- not required if nil
-Config_bossSpellModifier6bp0[5] = 400 -- base damage for the Frostbolt Volley in P2
-Config_bossSpellModifier6bp1[5] = nil -- not required if nil
-Config_bossSpellModifier7bp0[5] = nil -- not required if nil
-Config_bossSpellModifier7bp1[5] = nil -- not required if nil
-Config_bossSpellModifier8bp0[5] = nil -- not required if nil
-Config_bossSpellModifier8bp1[5] = nil -- not required if nil
-
-Config_addHealthModifierParty[5] = 2 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[5] = 6 -- how many adds will spawn
-
-Config_addSpell1[5] = 29320 -- min range 30m, 1-3rd farthest target within 30m -- charge
-Config_addSpell2[5] = nil -- min range 45m, cast on tank
-Config_addSpell3[5] = 23105 -- min range 0m -- Lightning cloud
-Config_addSpell4[5] = 69898 -- cast on the boss
-Config_addSpellEnrage[5] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[5] = 37000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[5] = nil -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[5] = 37000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[5] = 12000 -- This timer applies to Config_addSpell4
-
-Config_addSpellModifier1bp0[5] = nil -- not required if nil
-Config_addSpellModifier1bp1[5] = nil -- not required if nil
-Config_addSpellModifier2bp0[5] = nil -- not required if nil
-Config_addSpellModifier2bp1[5] = nil -- not required if nil
-Config_addSpellModifier3bp0[5] = 400 -- Initial damage of Lightning Cloud
-Config_addSpellModifier3bp1[5] = 1200 -- Tick damage of Lightning Cloud
-
-Config_aura1Add1[5] = 42375 -- an aura to add to the 1st add-- AE heal
-Config_aura2Add1[5] = nil -- another aura to add to the 1st add--
-Config_aura1Add2[5] = 42375 -- an aura to add to the 2nd add-- AE heal
-Config_aura2Add2[5] = nil -- another aura to add to the 2nd add--
-Config_aura1Add3[5] = 42375 -- an aura to add to all ads from the 3rd on-- AE heal
-Config_aura2Add3[5] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[5] = "Mmmrrrrrrrr."-- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[5] = "Rooooaaar" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[5] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[5] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[5] = " I'll git ye!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[5] = "Yous Minions be feeding me all ya Strength!"
-
-------------------------------------------
--- Begin of encounter 6 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[6] = 1112051 --db entry of the boss creature
-Config_npcEntry[6] = 1112052 --db entry of the NPC creature to summon the boss
-Config_addEntry[6] = 1112053 --db entry of the add creature
-Config_npcText[6] = 91116 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[6] = 15283 --directly applied to the tank-- 8second stun
-Config_bossSpell2[6] = 25034 --randomly applied to a player in 35m range-- Forked Lightning
-Config_bossSpell2MaxRange[6] = 30 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[6] = 25021 --on the 2nd nearest player within 30m-- Chain Lightning
-Config_bossSpell4[6] = 11446 --on a random player within 40m-- 5min domination
-Config_bossSpell4Counter[6] = 1 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[6] = 40 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[6] = nil --directly applied to the tank with adds alive --volley
-Config_bossSpell6[6] = nil --directly applied to the tank when adds are dead --volley
-Config_bossSpell7[6] = 37106 --directly applied to the tank - Charged Arcane Explosion
-Config_bossSpell8[6] = 43648 --directly applied to the tank x seconds after spell 7 - Electrical Storm
-Config_bossSpell8delay[6] = 8000 --delay between spell 7 and 8. Must be smaller than timer7 / 2
-Config_bossSpellSelf[6] = 67973 --cast on boss while adds are still alive (Rejuvenation)
-Config_bossSpellEnrage[6] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[6] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[6] = 23000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[6] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[6] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellTimer7[6] = 22000 -- This timer applies to Config_bossSpell7+8 (in ms)
-Config_bossSpellEnrageTimer[6] = 300000
-Config_minPhaseForTimer7[6] = 2 -- From this phase on the boss will use Timer 7 to cast Spell 7+8. Will ignore it before.
-
-Config_bossSpellModifier1bp0[6] = nil -- not required if nil
-Config_bossSpellModifier1bp1[6] = nil -- not required if nil
-Config_bossSpellModifier2bp0[6] = 1000 -- base damage of the forked lightning
-Config_bossSpellModifier2bp1[6] = nil -- not required if nil
-Config_bossSpellModifier3bp0[6] = 800 -- base damage of the Chain Lightning
-Config_bossSpellModifier3bp1[6] = nil -- not required if nil
-Config_bossSpellModifier4bp0[6] = nil -- not required if nil
-Config_bossSpellModifier4bp1[6] = nil -- not required if nil
-Config_bossSpellModifier5bp0[6] = nil -- not required if nil
-Config_bossSpellModifier5bp1[6] = nil -- not required if nil
-Config_bossSpellModifier6bp0[6] = nil -- not required if nil
-Config_bossSpellModifier6bp1[6] = nil -- not required if nil
-Config_bossSpellModifier7bp0[6] = 500 -- base damage for Charged Arcane Explosion
-Config_bossSpellModifier7bp1[6] = nil -- not required if nil
-Config_bossSpellModifier8bp0[6] = nil -- not required if nil
-Config_bossSpellModifier8bp1[6] = nil -- not required if nil
-
-Config_addHealthModifierParty[6] = 0.2 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[6] = 2 -- how many adds will spawn
-
-Config_addSpell1[6] = 28884 -- min range 30m, 1-3rd farthest target within 30m -- Meteor
-Config_addSpell2[6] = 19630 -- min range 45m, cast on tank -- Cone of Fire
-Config_addSpell3[6] = 13808 -- min range 0m -- Grenade
-Config_addSpell4[6] = 67973 -- cast on the boss (Rejuvenation)
-Config_addSpellEnrage[6] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[6] = 37000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[6] = 13000 -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[6] = 7000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[6] = 12000 -- This timer applies to Config_addSpell4
-
-Config_addSpellModifier1bp0[6] = nil -- not required if nil
-Config_addSpellModifier1bp1[6] = nil -- not required if nil
-Config_addSpellModifier2bp0[6] = nil -- not required if nil
-Config_addSpellModifier2bp1[6] = nil -- not required if nil
-Config_addSpellModifier3bp0[6] = 1000 -- not required if nil
-Config_addSpellModifier3bp1[6] = nil -- not required if nil
-
-Config_aura1Add1[6] = 13022 -- an aura to add to the 1st add-- Fire and Arcane Reflect
-Config_aura2Add1[6] = 19595 -- another aura to add to the 1st add-- Shadow and Frost Reflect
-Config_aura1Add2[6] = 25777 -- an aura to add to the 2nd add-- Thorns
-Config_aura2Add2[6] = nil -- another aura to add to the 2nd add--
-Config_aura1Add3[6] = nil -- an aura to add to all ads from the 3rd on-- Fiery Aura
-Config_aura2Add3[6] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[6] = "Die, Insect."-- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[6] = "Feel my Wrath!" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[6] = 412 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[6] = 6436 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[6] = "Bee bop. Reconfiguring!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[6] = "Adjusting Defenses. Stand back."
-
-------------------------------------------
--- Begin of encounter 7 config
-------------------------------------------
-
--- Database NPC entries. Must match the associated .sql file
-Config_bossEntry[7] = 1112061 --db entry of the boss creature
-Config_npcEntry[7] = 1112062 --db entry of the NPC creature to summon the boss
-Config_addEntry[7] = 1112063 --db entry of the add creature
-Config_npcText[7] = 91117 --gossip in npc_text to be told by the summoning NPC
-
--- list of spells:
-Config_bossSpell1[7] = 15283 --directly applied to the tank-- 8second stun
-Config_bossSpell2[7] = nil --on a random player within Config_bossSpell2MaxRange
-Config_bossSpell2MaxRange[7] = 50 --max range im m/y to check for targets for boss spell 2 (default 35)
-Config_bossSpell3[7] = 29484 --on the 2nd nearest player within 30m -- Web Spray
-Config_bossSpell4[7] = 59108 --on a random player within Config_bossSpell4MaxRange -- Glutinous Poison
-Config_bossSpell4Counter[7] = 10 --amount of casts to perform for spell 4. defaults to 1
-Config_bossSpell4MaxRange[7] = 30 --max range im m to check for targets for boss spell 4 (default 40)
-Config_bossSpell5[7] = 28741 --directly applied to the tank with adds alive --poison cone
-Config_bossSpell6[7] = 28741 --directly applied to the tank when adds are dead --poison cone
-Config_bossSpell7[7] = nil --directly applied to the tank -
-Config_bossSpell8[7] = nil --directly applied to the tank x seconds after spell 7 -
-Config_bossSpell8delay[7] = nil --delay between spell 7 and 8. Must be smaller than timer7 / 2
-Config_bossSpellSelf[7] = 19712 --cast on boss while adds are still alive (Arcane Explosion)
-Config_bossSpellEnrage[7] = 54356 --cast on boss once after Config_bossSpellEnrageTimer ms have passed-- Soft Enrage
-
-Config_bossSpellTimer1[7] = 10000 -- This timer applies to Config_bossSpell1
-Config_bossSpellTimer2[7] = 37000 -- This timer applies to Config_bossSpell2
-Config_bossSpellTimer3[7] = 29000 -- This timer applies to Config_bossSpellSelf in phase 1 and Config_bossSpell3+4 randomly later
-Config_bossSpellTimer5[7] = 19000 -- This timer applies to Config_bossSpell5+6
-Config_bossSpellTimer7[7] = 22000 -- This timer applies to Config_bossSpell7+8 (in ms)
-Config_bossSpellEnrageTimer[7] = 90000
-Config_minPhaseForTimer7[7] = 3 -- From this phase on the boss will use Timer 7 to cast Spell 7+8. Will ignore it before.
-
-Config_bossSpellModifier1bp0[7] = nil -- not required if nil
-Config_bossSpellModifier1bp1[7] = nil -- not required if nil
-Config_bossSpellModifier2bp0[7] = nil -- not required if nil
-Config_bossSpellModifier2bp1[7] = nil -- not required if nil
-Config_bossSpellModifier3bp0[7] = nil -- not required if nil
-Config_bossSpellModifier3bp1[7] = 250 -- web spray damage
-Config_bossSpellModifier4bp0[7] = 1000 -- base damage of Glutinous Poison
-Config_bossSpellModifier4bp1[7] = nil -- not required if nil
-Config_bossSpellModifier5bp0[7] = 750 -- base damage of poison cone
-Config_bossSpellModifier5bp1[7] = nil -- not required if nil
-Config_bossSpellModifier6bp0[7] = 1500 -- base damage of poison cone
-Config_bossSpellModifier6bp1[7] = nil -- not required if nil
-Config_bossSpellModifier7bp0[7] = nil -- not required if nil
-Config_bossSpellModifier7bp1[7] = nil -- not required if nil
-Config_bossSpellModifier8bp0[7] = nil -- not required if nil
-Config_bossSpellModifier8bp1[7] = nil -- not required if nil
-
-Config_addHealthModifierParty[7] = 0.2 -- modifier to change health for party encounter. Value in the SQL applies for raid
-Config_addsAmount[7] = 4 -- how many adds will spawn
-
-Config_addSpell1[7] = 12421 -- min range 30m, 1-3rd farthest target within 30m -- Mithril Grenade
-Config_addSpell2[7] = 23105 -- min range 45m, cast on tank
-Config_addSpell3[7] = nil -- min range 0m
-Config_addSpell4[7] = 67891 -- cast on the boss (Direct full heal)
-Config_addSpellEnrage[7] = nil -- Enrage after 300 seconds
-
-Config_addSpellTimer1[7] = 23000 -- This timer applies to Config_addSpell1
-Config_addSpellTimer2[7] = 13000 -- This timer applies to Config_addSpell2
-Config_addSpellTimer3[7] = 7000 -- This timer applies to Config_addSpell3
-Config_addSpellTimer4[7] = 12000 -- This timer applies to Config_addSpell4
-
-Config_addSpellModifier1bp0[7] = 714 -- not required if nil
-Config_addSpellModifier1bp1[7] = nil -- not required if nil
-Config_addSpellModifier2bp0[7] = 500 -- not required if nil
-Config_addSpellModifier2bp1[7] = 1000 -- not required if nil
-Config_addSpellModifier3bp0[7] = 1000 -- not required if nil
-Config_addSpellModifier3bp1[7] = nil -- not required if nil
-
-Config_aura1Add1[7] = 13022 -- an aura to add to the 1st add-- Fire and Arcane Reflect
-Config_aura2Add1[7] = 19595 -- another aura to add to the 1st add-- Shadow and Frost Reflect
-Config_aura1Add2[7] = 25777 -- an aura to add to the 2nd add-- Fire and Arcane Reflect
-Config_aura2Add2[7] = 19595 -- another aura to add to the 2nd add -- Shadow and Frost Reflect
-Config_aura1Add3[7] = 25777 -- an aura to add to all ads from the 3rd on-- Thorns
-Config_aura2Add3[7] = nil -- another aura to add to all add from the 3rd on--
-
-Config_addSpell3Yell[7] = "Bow to your gods!"-- yell for the adds when Spell 3 is cast
-Config_addEnoughYell[7] = "Feel my Wrath!" -- yell for the add at 33% and 66% hp
-Config_addEnoughSound[7] = 6763 -- sound to play when the add is at 33% and 66%
-Config_addSpell2Sound[7] = 721 -- sound to play when add casts spell 2
---yell for the boss when all adds are dead
-Config_bossYellPhase2[7] = "Sssssszzzzzzzzz!"
--- yell for the boss when they cast on themself
-Config_bossSpellSelfYell[7] = "SSSSSSSUFfffrrrrr!"
-
-
-------------------------------------------
--- End of encounter 7
-------------------------------------------
-
--- these are the fireworks to be cast randomly for 20s when an encounter was beaten
-Config_fireworks[1] = 66400
-Config_fireworks[2] = 66402
-Config_fireworks[3] = 46847
-Config_fireworks[4] = 46829
-Config_fireworks[5] = 46830
-Config_fireworks[6] = 62074
-Config_fireworks[7] = 62075
-Config_fireworks[8] = 62077
-Config_fireworks[9] = 55420
-
-------------------------------------------
--- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
-------------------------------------------
-
---constants
-local PLAYER_EVENT_ON_LOGOUT = 4 -- (event, player)
-local PLAYER_EVENT_ON_REPOP = 35 -- (event, player)
-local PLAYER_EVENT_ON_COMMAND = 42 -- (event, player, command) - player is nil if command used from console. Can return false
-local TEMPSUMMON_MANUAL_DESPAWN = 8 -- despawns when UnSummon() is called
-local GOSSIP_EVENT_ON_HELLO = 1 -- (event, player, object) - Object is the Creature/GameObject/Item. Can return false to do default action. For item gossip can return false to stop spell casting.
-local GOSSIP_EVENT_ON_SELECT = 2 -- (event, player, object, sender, intid, code, menu_id)
-local OPTION_ICON_CHAT = 0
-local OPTION_ICON_BATTLE = 9
-
-local SELECT_TARGET_RANDOM = 0 -- Just selects a random target
-local SELECT_TARGET_TOPAGGRO = 1 -- Selects targets from top aggro to bottom
-local SELECT_TARGET_BOTTOMAGGRO = 2 -- Selects targets from bottom aggro to top
-local SELECT_TARGET_NEAREST = 3
-local SELECT_TARGET_FARTHEST = 4
-
-local PARTY_IN_PROGRESS = 1
-local RAID_IN_PROGRESS = 2
-
-local ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16
-
---local variables
-local cancelGossipEvent
-local eventInProgress
-local bossfightInProgress
-local difficulty -- difficulty is set when using .startevent and it is meant for a range of 1-10
-local addsDownCounter
-local phase
-local addphase
-local x
-local y
-local z
-local o
-local spawnedBossGuid
-local spawnedNPCGuid
-local encounterStartTime
-local mapEventStart
-local npcObjectGuid
-local partyNpcSayCounter = 0
-local lastBossSpell1
-local lastBossSpell2
-local lastBossSpell3
-local lastBossSpell5
-local lastBossSpell7
-local nextBossSpell8Delay
-local lastBossSpellSelf
-local lastAddSpell1 = {}
-local lastAddSpell2 = {}
-local lastAddSpell3 = {}
-local lastAddSpell4 = {}
-local partyEvent = {} -- selected boss per [accountId] for party only mode
-
---local arrays
-local cancelEventIdHello = {}
-local cancelEventIdStart = {}
-local addNPC = {}
-local bossNPC = {}
-local playersInRaid = {}
-local groupPlayers = {}
-local playersForFireworks = {}
-local spawnedCreatureGuid = {}
-local scoreEarned = {}
-local scoreTotal = {}
-
-if Config.addEnoughSpell == nil then PrintError("customWorldboss.lua: Missing flag Config.addEnoughSpell.") end
-if Config.customDbName == nil then PrintError("customWorldboss.lua: Missing flag Config.customDbName.") end
-if Config.GMRankForEventStart == nil then PrintError("customWorldboss.lua: Missing flag Config.GMRankForEventStart.") end
-if Config.GMRankForUpdateDB == nil then PrintError("customWorldboss.lua: Missing flag Config.GMRankForUpdateDB.") end
-if Config.printErrorsToConsole == nil then PrintError("customWorldboss.lua: Missing flag Config.printErrorsToConsole.") end
-if Config.addEnrageTimer == nil then PrintError("customWorldboss.lua: Missing flag Config.addEnrageTimer.") end
-
-local function eS_has_value (tab, val)
- for index, value in ipairs(tab) do
- if value == val then
- return true
- end
- end
- return false
-end
-
-local function eS_returnIndex (tab, val)
- for index, value in ipairs(tab) do
- if value == val then
- return index
- end
- end
- return false
-end
-
-local function newAutotable(dim)
- local MT = {};
- for i=1, dim do
- MT[i] = {__index = function(t, k)
- if i < dim then
- t[k] = setmetatable({}, MT[i+1])
- return t[k];
- end
- end}
- end
-
- return setmetatable({}, MT[1]);
-end
-
-local function eS_castFireworks(eventId, delay, repeats)
- local player
- for n, v in pairs(playersForFireworks) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- player:CastSpell(player, Config_fireworks[math.random(1, #Config_fireworks)])
- end
- end
- if repeats == 1 then
- playersForFireworks = {}
- end
-end
-
-local function eS_resetPlayers(event, player)
- if eS_has_value(playersInRaid, player:GetGUID()) and player:GetPhaseMask() ~= 1 then
- if player ~= nil then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- player:SendBroadcastMessage("You left the event.")
- end
- end
-end
-
-local function eS_getSize(difficulty)
- local value
- if difficulty == 1 then
- value = 1
- else
- value = 1 + (difficulty - 1) / 4
- end
- return value
-end
-
-local function eS_splitString(inputstr, seperator)
- if seperator == nil then
- seperator = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..seperator.."]+)") do
- table.insert(t, str)
- end
- return t
-end
-
-local function eS_checkInCombat()
- --check if all players are in combat
- local player
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- if player:IsInCombat() == false and player:GetPhaseMask() == 2 then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- player:SendBroadcastMessage("You were returned to the real time because you did not participate.")
- end
- end
- end
-end
-
-local function eS_getEncounterDuration()
- local dt = GetTimeDiff(encounterStartTime)
- return string.format("%.2d:%.2d", (dt / 1000 / 60) % 60, (dt / 1000) % 60)
-end
-
-local function eS_getTimeSince(time)
- if time then
- return GetTimeDiff(time)
- end
- return 0
-end
-
-local function eS_getDifficultyTimer(rawTimer)
- if difficulty == 1 then
- return rawTimer
- else
- local timer = rawTimer / (1 + ((difficulty - 1) / 9))
- return timer
- end
-end
-
-local function eS_getDifficultyModifier(base)
- if difficulty == 1 then
- return base
- else
- local modifier = base * (1 + ((difficulty - 1) / 9))
- return modifier
- end
-end
-
-local function eS_onHello(event, player, creature)
- if player == nil then return end
- if bossfightInProgress ~= nil then
- player:SendBroadcastMessage("Some heroes are still fighting the enemies of time since "..eS_getEncounterDuration())
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", Config_npcEntry[eventInProgress], 0)
- player:GossipSendMenu(Config_npcText[eventInProgress], creature, 0)
- return
- end
-
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", Config_npcEntry[eventInProgress], 0)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant!", Config_npcEntry[eventInProgress], 1)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything.", Config_npcEntry[eventInProgress], 2)
- player:GossipSendMenu(Config_npcText[eventInProgress], creature, 0)
-end
-
-local function eS_onPartyOnlyHello(event, player, creature)
- if player == nil then return end
- if bossfightInProgress ~= nil then
- player:SendBroadcastMessage("Some heroes are still fighting the enemies of time since "..eS_getEncounterDuration())
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", Config.partySelectNpc, 0)
- player:GossipSendMenu(Config.defaultNpcText1, creature, 0)
- return
- end
-
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", Config.partySelectNpc, 0)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 1)", Config.partySelectNpc, 1)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 2)", Config.partySelectNpc, 2)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 3)", Config.partySelectNpc, 3)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 4)", Config.partySelectNpc, 4)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 5)", Config.partySelectNpc, 5)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 6)", Config.partySelectNpc, 6)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 7)", Config.partySelectNpc, 7)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 8)", Config.partySelectNpc, 8)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 9)", Config.partySelectNpc, 9)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Let us fight a servant! (Difficulty 10)", Config.partySelectNpc, 10)
- player:GossipSendMenu(Config.defaultNpcText1, creature, 0)
-end
-
-local function awardScore()
- local score = Config.baseScore + (Config.additionalScore * difficulty)
- for _, playerGuid in pairs(playersInRaid) do
- if GetPlayerByGUID(playerGuid) ~= nil then
- local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
- if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
- if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
- scoreEarned[accountId] = scoreEarned[accountId] + score
- scoreTotal[accountId] = scoreTotal[accountId] + score
- CharDBExecute('REPLACE INTO `'..Config.customDbName..'`.`eventscript_score` VALUES ('..accountId..', '..scoreEarned[accountId]..', '..scoreTotal[accountId]..');');
- local gameTime = (tonumber(tostring(GetGameTime())))
- local playerLowGuid = GetGUIDLow(playerGuid)
- CharDBExecute('INSERT IGNORE INTO `'..Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..difficulty..', '..bossfightInProgress..', '..eS_getTimeSince(encounterStartTime)..');');
- end
- end
- bossfightInProgress = nil
-end
-
-local function storeEncounter()
- for _, playerGuid in pairs(playersInRaid) do
- if GetPlayerByGUID(playerGuid) ~= nil then
- local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
- local gameTime = (tonumber(tostring(GetGameTime())))
- local playerLowGuid = GetGUIDLow(playerGuid)
- CharDBExecute('INSERT IGNORE INTO `'..Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..difficulty..', '..bossfightInProgress..', '..eS_getTimeSince(encounterStartTime)..');');
- end
- end
- bossfightInProgress = nil
-end
-
-local function eS_chromieGossip(event, player, object, sender, intid, code, menu_id)
- local spawnedBoss
- local spawnedCreature = {}
-
- if player == nil then return end
-
- local group = player:GetGroup()
-
- if intid == 0 then
- local accountId = player:GetAccountId()
- if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
- if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
- player:SendBroadcastMessage("Your current event score is: "..scoreEarned[accountId].." and your all-time event score is: "..scoreTotal[accountId])
- player:GossipComplete()
- elseif intid == 1 then
-
- if bossfightInProgress ~= nil then
- player:SendBroadcastMessage("There is already a fight in progress.")
- player:GossipComplete()
- return
- end
-
- if player:IsInGroup() == false then
- player:SendBroadcastMessage("You need to be in a party.")
- player:GossipComplete()
- return
- end
-
- if group:IsRaidGroup() == true then
- player:SendBroadcastMessage("You can not accept that task while in a raid group.")
- player:GossipComplete()
- return
- end
- if not group:IsLeader(player:GetGUID()) then
- player:SendBroadcastMessage("You are not the leader of your group.")
- player:GossipComplete()
- return
- end
- groupPlayers = group:GetMembers()
- for n, v in pairs(groupPlayers) do
- if eS_has_value(playersForFireworks, v:GetGUID()) then
- object:SendUnitSay("Please, just a little break. I need to breathe, "..player:GetName()..". How about watching the fireworks?", 0 )
- player:GossipComplete()
- return
- end
- end
- --start 5man encounter
- bossfightInProgress = PARTY_IN_PROGRESS
- spawnedCreature[1]= player:SpawnCreature(Config_addEntry[eventInProgress], x, y, z, o)
- spawnedCreature[1]:SetPhaseMask(2)
- spawnedCreature[1]:SetScale(spawnedCreature[1]:GetScale() * eS_getSize(difficulty))
-
- local maxHealth = Config_addHealthModifierParty[eventInProgress] * spawnedCreature[1]:GetMaxHealth()
- local health = Config_addHealthModifierParty[eventInProgress] * spawnedCreature[1]:GetHealth()
- spawnedCreature[1]:SetMaxHealth(maxHealth)
- spawnedCreature[1]:SetHealth(health)
-
- encounterStartTime = GetCurrTime()
-
- for n, v in pairs(groupPlayers) do
- if v:GetDistance(player) ~= nil then
- if v:GetDistance(player) < 80 then
- v:SetPhaseMask(2)
- playersInRaid[n] = v:GetGUID()
- spawnedCreature[1]:SetInCombatWith(v)
- v:SetInCombatWith(spawnedCreature[1])
- spawnedCreature[1]:AddThreat(v, 1)
- end
- else
- v:SendBroadcastMessage("You were too far away to join the fight.")
- end
- end
-
- elseif intid == 2 then
-
- if bossfightInProgress ~= nil then
- player:SendBroadcastMessage("There is already a fight in progress.")
- player:GossipComplete()
- return
- end
-
- if player:IsInGroup() == false then
- player:SendBroadcastMessage("You need to be in a party.")
- player:GossipComplete()
- return
- end
-
- if group:IsRaidGroup() == false then
- player:SendBroadcastMessage("You can not accept that task without being in a raid group.")
- player:GossipComplete()
- return
- end
- if not group:IsLeader(player:GetGUID()) then
- player:SendBroadcastMessage("You are not the leader of your group.")
- player:GossipComplete()
- return
- end
- groupPlayers = group:GetMembers()
-
- --prevent starting the next raid while fireworks are running
- for n, v in pairs(groupPlayers) do
- if eS_has_value(playersForFireworks, v:GetGUID()) then
- object:SendUnitSay("Please, just a little break. I need to breathe, "..player:GetName()..". How about watching the fireworks?", 0 )
- player:GossipComplete()
- return
- end
- end
-
- --start raid encounter
- bossfightInProgress = RAID_IN_PROGRESS
-
- spawnedBoss = player:SpawnCreature(Config_bossEntry[eventInProgress], x, y, z+2, o)
- spawnedBoss:SetPhaseMask(2)
- spawnedBoss:SetScale(spawnedBoss:GetScale() * eS_getSize(difficulty))
- spawnedBossGuid = spawnedBoss:GetGUID()
-
- if Config_addsAmount[eventInProgress] == nil then Config_addsAmount[eventInProgress] = 1 end
-
- for c = 1, Config_addsAmount[eventInProgress] do
- local randomX = (math.sin(math.random(1,360)) * 15)
- local randomY = (math.sin(math.random(1,360)) * 15)
- spawnedCreature[c] = player:SpawnCreature(Config_addEntry[eventInProgress], x + randomX, y + randomY, z+2, o)
- spawnedCreature[c]:SetPhaseMask(2)
- spawnedCreature[c]:SetScale(spawnedCreature[c]:GetScale() * eS_getSize(difficulty))
- spawnedCreatureGuid[c] = spawnedCreature[c]:GetGUID()
- end
- encounterStartTime = GetCurrTime()
-
- for n, v in pairs(groupPlayers) do
- if v:GetDistance(player) ~= nil then
- if v:GetDistance(player) < 80 then
- v:SetPhaseMask(2)
- playersInRaid[n] = v:GetGUID()
- spawnedBoss:SetInCombatWith(v)
- v:SetInCombatWith(spawnedBoss)
- spawnedBoss:AddThreat(v, 1)
- for c = 1, Config_addsAmount[eventInProgress] do
- spawnedCreature[c]:SetInCombatWith(v)
- v:SetInCombatWith(spawnedCreature[c])
- spawnedCreature[c]:AddThreat(v, 1)
- end
- end
- else
- v:SendBroadcastMessage("You were too far away to join the fight.")
- end
- end
-
- --apply auras to adds
- if spawnedCreature[1] ~= nil then
- if Config_aura1Add1[1] ~= nil then
- spawnedCreature[1]:AddAura(Config_aura1Add1[1], spawnedCreature[1])
- end
- if Config_aura2Add1[1] ~= nil then
- spawnedCreature[1]:AddAura(Config_aura2Add1[1], spawnedCreature[1])
- end
- end
-
- if spawnedCreature[2] ~= nil then
- if Config_aura1Add2[2] ~= nil then
- spawnedCreature[2]:AddAura(Config_aura1Add2[2], spawnedCreature[2])
- end
- if Config_aura2Add2[2] ~= nil then
- spawnedCreature[2]:AddAura(Config_aura2Add2[2], spawnedCreature[2])
- end
- end
- if #spawnedCreature > 2 then
- for c = 3, #spawnedCreature do
- if spawnedCreature[c] ~= nil then
- if Config_aura1Add3[c] ~= nil then
- spawnedCreature[c]:AddAura(Config_aura1Add3[c], spawnedCreature[c])
- end
- if Config_aura2Add3[c] ~= nil then
- spawnedCreature[c]:AddAura(Config_aura2Add3[c], spawnedCreature[c])
- end
- end
- end
- end
- end
- player:GossipComplete()
-end
-
-local function eS_chromiePartyOnlyGossip(event, player, object, sender, intid, code, menu_id)
- local spawnedBoss
- local spawnedCreature = {}
-
- if player == nil then return end
-
- local group = player:GetGroup()
- local accountId = player:GetAccountId()
-
- if intid == 0 then
- if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
- if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
- player:SendBroadcastMessage("Your current event score is: "..scoreEarned[accountId].." and your all-time event score is: "..scoreTotal[accountId])
- player:GossipComplete()
-
- elseif intid <= 100 then
- partyEvent[accountId] = intid
-
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Zombie Captain (Level 50)", Config.partySelectNpc, 101)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Seawitch (Level 40)", Config.partySelectNpc, 102)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Aligator Pet (Level 50)", Config.partySelectNpc, 104)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Aligator Guard (Level 60)", Config.partySelectNpc, 105)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "Ragnarix Qt (Level 60)", Config.partySelectNpc, 106)
- player:GossipSendMenu(Config.defaultNpcText2, object, 0)
-
- else
- difficulty = partyEvent[accountId]
- partyEvent[accountId] = intid - 100
- if bossfightInProgress ~= nil then
- player:SendBroadcastMessage("There is already a fight in progress.")
- player:GossipComplete()
- return
- end
-
- if player:IsInGroup() == false then
- player:SendBroadcastMessage("You need to be in a party.")
- player:GossipComplete()
- return
- end
-
- if group:IsRaidGroup() == true then
- player:SendBroadcastMessage("You can not accept that task while in a raid group.")
- player:GossipComplete()
- return
- end
- if not group:IsLeader(player:GetGUID()) then
- player:SendBroadcastMessage("You are not the leader of your group.")
- player:GossipComplete()
- return
- end
- groupPlayers = group:GetMembers()
- for n, v in pairs(groupPlayers) do
- if eS_has_value(playersForFireworks, v:GetGUID()) then
- object:SendUnitSay("Please, just a little break. I need to breathe, "..player:GetName()..". How about watching the fireworks?", 0 )
- player:GossipComplete()
- return
- end
- end
- eventInProgress = partyEvent[accountId]
- local x = player:GetX()
- local y = player:GetY()
- local z = player:GetZ()
- local o = player:GetO()
-
- --start 5man encounter
- bossfightInProgress = PARTY_IN_PROGRESS
- spawnedCreature[1]= player:SpawnCreature(Config_addEntry[eventInProgress], x, y, z, o)
- spawnedCreature[1]:SetPhaseMask(2)
- spawnedCreature[1]:SetScale(spawnedCreature[1]:GetScale() * eS_getSize(difficulty))
-
- local maxHealth = Config_addHealthModifierParty[eventInProgress] * spawnedCreature[1]:GetMaxHealth()
- local health = Config_addHealthModifierParty[eventInProgress] * spawnedCreature[1]:GetHealth()
- spawnedCreature[1]:SetMaxHealth(maxHealth)
- spawnedCreature[1]:SetHealth(health)
-
- encounterStartTime = GetCurrTime()
-
- for n, v in pairs(groupPlayers) do
- if v:GetDistance(player) ~= nil then
- if v:GetDistance(player) < 80 then
- v:SetPhaseMask(2)
- playersInRaid[n] = v:GetGUID()
- spawnedCreature[1]:SetInCombatWith(v)
- v:SetInCombatWith(spawnedCreature[1])
- spawnedCreature[1]:AddThreat(v, 1)
- end
- else
- v:SendBroadcastMessage("You were too far away to join the fight.")
- end
- end
-
- end
-end
-
-local function eS_summonEventNPC(playerGuid)
- local player
- -- tempSummon an NPC with a dialogue option to start the encounter, store the guid for later unsummon
- player = GetPlayerByGUID(playerGuid)
- if player == nil then return end
- x = player:GetX()
- y = player:GetY()
- z = player:GetZ()
- o = player:GetO()
- local spawnedNPC = player:SpawnCreature(Config_npcEntry[eventInProgress], x, y, z, o)
- spawnedNPCGuid = spawnedNPC:GetGUID()
-
- -- add an event to spawn the Boss in a phase when gossip is clicked
- cancelEventIdHello[eventInProgress] = RegisterCreatureGossipEvent(Config_npcEntry[eventInProgress], GOSSIP_EVENT_ON_HELLO, eS_onHello)
- cancelEventIdStart[eventInProgress] = RegisterCreatureGossipEvent(Config_npcEntry[eventInProgress], GOSSIP_EVENT_ON_SELECT, eS_chromieGossip)
-end
-
-local function eS_command(event, player, command, chatHandler)
- local commandArray = {}
- local eventNPC
-
- --prevent players from using this
- if not chatHandler:IsAvailable(Config.GMRankForEventStart) then
- return
- end
-
- -- split the command variable into several strings which can be compared individually
- commandArray = eS_splitString(command)
-
- if commandArray[2] ~= nil then
- commandArray[2] = commandArray[2]:gsub("[';\\, ]", "")
- if commandArray[3] ~= nil then
- commandArray[3] = commandArray[3]:gsub("[';\\, ]", "")
- end
- end
-
- if commandArray[2] == nil then commandArray[2] = 1 end
- if commandArray[3] == nil then commandArray[3] = 1 end
-
- if commandArray[1] == "startevent" then
- if player == nil then
- chatHandler:SendSysMessage("Can not start an event from the console.")
- return false
- end
- eventNPC = tonumber(commandArray[2])
- difficulty = tonumber(commandArray[3])
-
- if Config_npcEntry[eventNPC] == nil or Config_bossEntry == nil or Config_addEntry == nil or Config_npcText == nil then
- chatHandler:SendSysMessage("Event "..eventNPC.." is not properly configured. Aborting")
- return false
- end
-
- mapEventStart = player:GetMap():GetMapId()
-
- if difficulty <= 0 then difficulty = 1 end
- if difficulty > 10 then difficulty = 10 end
-
- if eventInProgress == nil then
- eventInProgress = eventNPC
- eS_summonEventNPC(player:GetGUID())
- chatHandler:SendSysMessage("Starting event "..eventInProgress.." with difficulty "..difficulty..".")
- return false
- else
- chatHandler:SendSysMessage("Event "..eventInProgress.." is already active.")
- return false
- end
- elseif commandArray[1] == "stopevent" then
- if player == nil then
- chatHandler:SendSysMessage("Must be used from inside the game.")
- return false
- end
- if eventInProgress == nil then
- chatHandler:SendSysMessage("There is no event in progress.")
- return false
- end
- local map = player:GetMap()
- local mapId = map:GetMapId()
- if mapId ~= mapEventStart then
- chatHandler:SendSysMessage("You must be in the same map to stop an event.")
- return false
- end
- chatHandler:SendSysMessage("Stopping event "..eventInProgress..".")
- ClearCreatureGossipEvents(Config_npcEntry[eventInProgress])
- local spawnedNPC = map:GetWorldObject(spawnedNPCGuid):ToCreature()
- spawnedNPC:DespawnOrUnsummon(0)
- eventInProgress = nil
- return false
- end
-
- --prevent non-Admins from using the rest
- if not chatHandler:IsAvailable(Config.GMRankForUpdateDB) then
- return
- end
-
- --nothing here yet
- return
-end
-
-function bossNPC.onEnterCombat(event, creature, target)
- creature:RegisterEvent(bossNPC.Event, 100, 0)
- creature:CallAssistance()
- creature:SendUnitYell("You will NOT interrupt this mission!", 0 )
- phase = 1
- addsDownCounter = 0
- creature:CallForHelp(200)
- creature:PlayDirectSound(8645)
-
- lastBossSpell1 = encounterStartTime
- lastBossSpell2 = encounterStartTime
- lastBossSpell3 = encounterStartTime
- lastBossSpell5 = encounterStartTime
- lastBossSpell7 = encounterStartTime
- nextBossSpell8Delay = nil
- lastBossSpellSelf = encounterStartTime
-end
-
-function bossNPC.reset(event, creature)
- local player
- eS_checkInCombat()
- creature:RemoveEvents()
- if creature:IsDead() == true then
- creature:SendUnitYell("Master, save me!", 0 )
- creature:PlayDirectSound(8865)
- local playerListString
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- if playerListString == nil then
- playerListString = player:GetName()
- else
- playerListString = playerListString..", "..player:GetName()
- end
- end
- end
- if Config.rewardRaid == 1 then
- awardScore()
- elseif Config.storeRaid == 1 then
- storeEncounter()
- else
- bossfightInProgress = nil
- end
- SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty "..difficulty.." in "..eS_getEncounterDuration().." by: "..playerListString..". Congratulations!")
- CreateLuaEvent(eS_castFireworks, 1000, 20)
- playersForFireworks = playersInRaid
- playersInRaid = {}
- else
- creature:SendUnitYell("You never had a chance.", 0 )
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- end
- end
- playersInRaid = {}
- bossfightInProgress = nil
- end
- creature:DespawnOrUnsummon(0)
- addsDownCounter = nil
-end
-
-function bossNPC.Event(event, delay, pCall, creature)
- if creature:IsCasting() == true then return end
-
- if Config_bossSpellEnrageTimer[eventInProgress] ~= nil and Config_bossSpellEnrage[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellEnrageTimer[eventInProgress]) < eS_getTimeSince(encounterStartTime) then
- if phase == 2 and eS_getTimeSince(encounterStartTime) > Config_bossSpellEnrageTimer[eventInProgress] then
- phase = 3
- creature:SendUnitYell("FEEL MY WRATH!", 0 )
- creature:CastSpell(creature, Config_bossSpellEnrage[eventInProgress])
- return
- end
- end
- end
-
- if Config_bossSpellTimer3[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < eS_getTimeSince(lastBossSpell3) then
- if addsDownCounter < Config_addsAmount[eventInProgress] then
- if Config_bossSpellSelf[eventInProgress] ~= nil then
- if Config_bossSpellSelfYell[eventInProgress] ~= nil then
- creature:SendUnitYell(Config_bossSpellSelfYell[eventInProgress], 0 )
- end
- creature:CastSpell(creature, Config_bossSpellSelf[eventInProgress])
- lastBossSpell3 = GetCurrTime()
- return
- end
- elseif phase == 1 then
- if Config_bossYellPhase2[eventInProgress] ~= nil then
- creature:SendUnitYell(Config_bossYellPhase2[eventInProgress], 0 )
- end
- phase = 2
- end
- end
- end
-
- if Config_bossSpellTimer1[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer1[eventInProgress]) < eS_getTimeSince(lastBossSpell1) then
- if Config_bossSpell1[eventInProgress] ~= nil then
- if Config_bossSpellModifier1bp0[eventInProgress] ~= nil and Config_bossSpellModifier1bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier1bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell1[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier1bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier1bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell1[eventInProgress], false, base1)
- elseif Config_bossSpellModifier1bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell1[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell1[eventInProgress])
- end
- lastBossSpell1 = GetCurrTime()
- return
- end
- end
- end
-
- if Config_bossSpellTimer2[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer2[eventInProgress]) < eS_getTimeSince(lastBossSpell2) then
- if Config_bossSpell2[eventInProgress] ~= nil then
- if (math.random(1, 100) <= 50) then
- if Config_bossSpell2MaxRange[eventInProgress] == nil then
- Config_bossSpell2MaxRange[eventInProgress] = 35
- end
- local players = creature:GetPlayersInRange(Config_bossSpell2MaxRange[eventInProgress])
- local targetPlayer = players[math.random(1, #players)]
- creature:SendUnitYell("You die now, "..targetPlayer:GetName().."!", 0 )
- if Config_bossSpellModifier2bp0[eventInProgress] ~= nil and Config_bossSpellModifier2bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier2bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier2bp1[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell2[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier2bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier2bp0[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell2[eventInProgress], false, base1)
- elseif Config_bossSpellModifier2bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier2bp1[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell2[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(targetPlayer, Config_bossSpell2[eventInProgress])
- end
- lastBossSpell2 = GetCurrTime()
- return
- end
- end
- end
- end
-
- if Config_bossSpellTimer3[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < eS_getTimeSince(lastBossSpell3) then
- if phase > 1 then
- local players = creature:GetPlayersInRange(30)
- if #players > 1 then
- if (math.random(1, 100) <= 50) then
- if Config_bossSpell3[eventInProgress] ~= nil then
- if Config_bossSpellModifier3bp0[eventInProgress] ~= nil and Config_bossSpellModifier3bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier3bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_NEAREST, true, 1, 30), Config_bossSpell3[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier3bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier3bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_NEAREST, true, 1, 30), Config_bossSpell3[eventInProgress], false, base1)
- elseif Config_bossSpellModifier3bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_NEAREST, true, 1, 30), Config_bossSpell3[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetAITarget(SELECT_TARGET_NEAREST, true, 1, 30), Config_bossSpell3[eventInProgress])
- end
- lastBossSpell3 = GetCurrTime()
- return
- end
- elseif phase > 1 then
- if Config_bossSpell4[eventInProgress] ~= nil then
- if Config_bossSpell4MaxRange[eventInProgress] == nil then
- Config_bossSpell4MaxRange[eventInProgress] = 40
- end
- local players = creature:GetPlayersInRange(Config_bossSpell4MaxRange[eventInProgress])
- local nextPlayerIndex = math.random(1, #players)
- if Config_bossSpell4Counter[eventInProgress] == nil then
- Config_bossSpell4Counter[eventInProgress] = 1
- end
- for m = 1, Config_bossSpell4Counter[eventInProgress] do
- local targetPlayer = players[nextPlayerIndex]
- if targetPlayer then
- if Config_bossSpellModifier4bp0[eventInProgress] ~= nil and Config_bossSpellModifier4bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier4bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier4bp1[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell4[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier4bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier4bp0[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell4[eventInProgress], false, base1)
- elseif Config_bossSpellModifier4bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier4bp1[eventInProgress])
- creature:CastCustomSpell(targetPlayer, Config_bossSpell4[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(targetPlayer, Config_bossSpell4[eventInProgress])
- end
- if nextPlayerIndex >= #players then
- nextPlayerIndex = 1
- else
- nextPlayerIndex = nextPlayerIndex + 1
- end
- end
- end
- lastBossSpell3 = GetCurrTime()
- return
- end
- end
- else
- if Config_bossSpell3[eventInProgress] ~= nil then
- if Config_bossSpellModifier3bp0[eventInProgress] ~= nil and Config_bossSpellModifier3bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier3bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell3[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier3bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier3bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell3[eventInProgress], false, base1)
- elseif Config_bossSpellModifier3bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell3[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell3[eventInProgress])
- end
- lastBossSpell3 = GetCurrTime()
- return
- end
- end
- end
- end
- end
-
- if Config_bossSpellTimer5[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer5[eventInProgress]) < eS_getTimeSince(lastBossSpell5) then
- if phase == 1 then
- if Config_bossSpell5[eventInProgress] ~= nil then
- if Config_bossSpellModifier5bp0[eventInProgress] ~= nil and Config_bossSpellModifier5bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier5bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier5bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell5[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier5bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier5bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell5[eventInProgress], false, base1)
- elseif Config_bossSpellModifier5bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier5bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell5[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell5[eventInProgress])
- end
- lastBossSpell5 = GetCurrTime()
- return
- end
- else
- if Config_bossSpell6[eventInProgress] ~= nil then
- if Config_bossSpellModifier6bp0[eventInProgress] ~= nil and Config_bossSpellModifier6bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier6bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier6bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell6[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier6bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier6bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell6[eventInProgress], false, base1)
- elseif Config_bossSpellModifier6bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier6bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell6[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell6[eventInProgress])
- end
- lastBossSpell5 = GetCurrTime()
- return
- end
- end
- end
- end
-
- if Config_minPhaseForTimer7[eventInProgress] == nil then
- Config_minPhaseForTimer7[eventInProgress] = 1
- end
- if Config_bossSpellTimer7[eventInProgress] ~= nil and phase >= Config_minPhaseForTimer7[eventInProgress] then
- if nextBossSpell8Delay ~= nil then
- if Config_bossSpell8[eventInProgress] ~= nil then
- if Config_bossSpell8delay[eventInProgress] < eS_getTimeSince(nextBossSpell8Delay) then
- if Config_bossSpellModifier8bp0[eventInProgress] ~= nil and Config_bossSpellModifier8bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier8bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier8bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell8[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier8bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier8bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell8[eventInProgress], false, base1)
- elseif Config_bossSpellModifier8bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier8bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell8[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell8[eventInProgress])
- end
- nextBossSpell8Delay = nil
- return
- end
- end
- end
-
- if eS_getDifficultyTimer(Config_bossSpellTimer7[eventInProgress]) < eS_getTimeSince(lastBossSpell7) then
- if Config_bossSpell7[eventInProgress] ~= nil then
- if Config_bossSpellModifier7bp0[eventInProgress] ~= nil and Config_bossSpellModifier7bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier7bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier7bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell7[eventInProgress], false, base1, base2)
- elseif Config_bossSpellModifier7bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_bossSpellModifier7bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell7[eventInProgress], false, base1)
- elseif Config_bossSpellModifier7bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_bossSpellModifier7bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_bossSpell7[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_bossSpell7[eventInProgress])
- end
- lastBossSpell7 = GetCurrTime()
- nextBossSpell8Delay = lastBossSpell7
- return
- end
- end
- end
-end
-
-function addNPC.onEnterCombat(event, creature, target)
- local player
-
-
- creature:RegisterEvent(addNPC.Event, math.random(100,150), 0)
-
- creature:CallAssistance()
- creature:CallForHelp(200)
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- creature:AddThreat(player, 1)
- end
- end
- addphase = 1
-
- if bossfightInProgress == PARTY_IN_PROGRESS then
- lastAddSpell1[1] = encounterStartTime
- lastAddSpell2[1] = encounterStartTime
- lastAddSpell3[1] = encounterStartTime
- lastAddSpell4[1] = encounterStartTime
- else
- for n, _ in pairs(spawnedCreatureGuid) do
- lastAddSpell1[n] = encounterStartTime
- lastAddSpell2[n] = encounterStartTime
- lastAddSpell3[n] = encounterStartTime
- lastAddSpell4[n] = encounterStartTime
- end
- end
-end
-
-function addNPC.Event(event, delay, pCall, creature)
- if creature:IsCasting() == true then return end
-
- if bossfightInProgress == PARTY_IN_PROGRESS and Config_addSpell1[eventInProgress] ~= nil then -- only for the party version
- if addphase == 1 and creature:GetHealthPct() < 67 then
- addphase = 2
- elseif addphase == 2 and creature:GetHealthPct() < 34 then
- addphase = 3
- end
- if addphase == 1 and creature:GetHealthPct() < 67 or addphase == 2 and creature:GetHealthPct() < 34 then
- if Config_addEnoughYell[eventInProgress] ~= nil then
- creature:SendUnitYell(Config_addEnoughYell[eventInProgress], 0 )
- end
- if Config_addEnoughSound[eventInProgress] ~= nil then
- creature:PlayDirectSound(Config_addEnoughSound[eventInProgress])
- end
- local players = creature:GetPlayersInRange(30)
- if #players > 1 then
- creature:CastSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, 0, 30), Config.addEnoughSpell)
- return
- else
- creature:CastSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, 0, 30), Config_addSpell1[eventInProgress])
- return
- end
- end
- end
-
- local n = eS_returnIndex(spawnedCreatureGuid, creature:GetGUID()) -- tell multiple adds apart in raid mode
- if n == false then n = 1 end -- no need to set this in party mode
-
-
- if Config_addSpellEnrage[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config.addEnrageTimer) < eS_getTimeSince(encounterStartTime)then
- if phase == 2 and eS_getTimeSince(encounterStartTime) > Config_addSpellEnrage[eventInProgress] then
- phase = 3
- creature:SendUnitYell("FEEL MY WRATH!", 0 )
- creature:CastSpell(creature, Config_addSpellEnrage[eventInProgress])
- return
- end
- end
- end
-
- local randomTimer = math.random(0,1000)
-
- if Config_addSpellTimer1[eventInProgress] ~= nil and Config_addSpell1[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_addSpellTimer1[eventInProgress]) < randomTimer + eS_getTimeSince(lastAddSpell1[n]) then
- local random = math.random(0, 2)
- local players = creature:GetPlayersInRange(30)
- if #players > 1 then
- if Config_addSpellModifier1bp0[eventInProgress] ~= nil and Config_addSpellModifier1bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier1bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, random, 30), Config_addSpell1[eventInProgress], false, base1, base2)
- elseif Config_addSpellModifier1bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier1bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, random, 30), Config_addSpell1[eventInProgress], false, base1)
- elseif Config_addSpellModifier1bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, random, 30), Config_addSpell1[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetAITarget(SELECT_TARGET_FARTHEST, true, random, 30), Config_addSpell1[eventInProgress])
- end
- lastAddSpell1[n] = GetCurrTime()
- return
- else
- if Config_addSpellModifier1bp0[eventInProgress] ~= nil and Config_addSpellModifier1bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier1bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell1[eventInProgress], false, base1, base2)
- elseif Config_addSpellModifier1bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier1bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell1[eventInProgress], false, base1)
- elseif Config_addSpellModifier1bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier1bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell1[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(),Config_addSpell1[eventInProgress])
- end
- lastAddSpell1[n] = GetCurrTime()
- return
- end
- end
- end
-
- if Config_addSpellTimer2[eventInProgress] ~= nil and Config_addSpell2[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_addSpellTimer2[eventInProgress]) < randomTimer + (eS_getTimeSince(lastAddSpell2[n])) then
- if Config_addSpell2Sound[eventInProgress] ~= nil then
- creature:PlayDirectSound(Config_addSpell2Sound[eventInProgress])
- end
- if Config_addSpellModifier2bp0[eventInProgress] ~= nil and Config_addSpellModifier2bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier2bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier2bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell2[eventInProgress], false, base1, base2)
- elseif Config_addSpellModifier2bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier2bp0[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell2[eventInProgress], false, base1)
- elseif Config_addSpellModifier2bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier2bp1[eventInProgress])
- creature:CastCustomSpell(creature:GetVictim(), Config_addSpell2[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature:GetVictim(), Config_addSpell2[eventInProgress])
- end
- lastAddSpell2[n] = GetCurrTime()
- return
- end
- end
-
- if Config_addSpellTimer3[eventInProgress] ~= nil and Config_addSpell3[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_addSpellTimer3[eventInProgress]) < randomTimer + eS_getTimeSince(lastAddSpell3[n]) then
- if Config_addSpell3Yell[eventInProgress] ~= nil then
- creature:SendUnitYell(Config_addSpell3Yell[eventInProgress], 0 )
- end
- if Config_addSpellModifier3bp0[eventInProgress] ~= nil and Config_addSpellModifier3bp1[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier3bp0[eventInProgress])
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature, Config_addSpell3[eventInProgress], false, base1, base2)
- elseif Config_addSpellModifier3bp0[eventInProgress] ~= nil then
- local base1 = eS_getDifficultyModifier(Config_addSpellModifier3bp0[eventInProgress])
- creature:CastCustomSpell(creature, Config_addSpell3[eventInProgress], false, base1)
- elseif Config_addSpellModifier3bp1[eventInProgress] ~= nil then
- local base2 = eS_getDifficultyModifier(Config_addSpellModifier3bp1[eventInProgress])
- creature:CastCustomSpell(creature, Config_addSpell3[eventInProgress], false, nil, base2)
- else
- creature:CastSpell(creature, Config_addSpell3[eventInProgress])
- end
- lastAddSpell3[n] = GetCurrTime()
- return
- end
- end
-
- if bossfightInProgress == RAID_IN_PROGRESS then
- if Config_addSpellTimer4[eventInProgress] ~= nil and Config_addSpell4[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_addSpellTimer4[eventInProgress]) < randomTimer + eS_getTimeSince(lastAddSpell4[n]) then
- local map = creature:GetMap()
- if map ~= nil then
- if map:GetWorldObject(spawnedBossGuid) ~= nil then
- local bossNPC = map:GetWorldObject(spawnedBossGuid):ToCreature()
- creature:CastSpell(bossNPC, Config_addSpell4[eventInProgress])
- lastAddSpell4[n] = GetCurrTime()
- return
- end
- end
- end
- end
- end
-end
-
-function addNPC.reset(event, creature)
- local player
- if bossfightInProgress == PARTY_IN_PROGRESS then
- eS_checkInCombat()
- end
- creature:RemoveEvents()
- if bossfightInProgress == PARTY_IN_PROGRESS then
- if creature:IsDead() == true then
- local playerListString
- CreateLuaEvent(eS_castFireworks, 1000, 20)
- creature:PlayDirectSound(8803)
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- if playerListString == nil then
- playerListString = player:GetName()
- else
- playerListString = playerListString..", "..player:GetName()
- end
- end
- end
- if Config.rewardParty == 1 then
- awardScore()
- elseif Config.storeParty == 1 then
- storeEncounter()
- else
- bossfightInProgress = nil
- end
- SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty "..difficulty.." in "..eS_getEncounterDuration().." by: "..playerListString..". Congratulations!")
- playersForFireworks = playersInRaid
- playersInRaid = {}
- else
- creature:SendUnitYell("Hahahaha!", 0 )
- for _, v in pairs(playersInRaid) do
- player = GetPlayerByGUID(v)
- if player ~= nil then
- if player:GetCorpse() ~= nil then
- player:GetCorpse():SetPhaseMask(1)
- end
- player:SetPhaseMask(1)
- end
- end
- playersInRaid = {}
- bossfightInProgress = nil
- end
- else
- if creature:IsDead() == true then
- if addsDownCounter == nil then
- addsDownCounter = 1
- else
- addsDownCounter = addsDownCounter + 1
- end
- end
- end
- creature:DespawnOrUnsummon(0)
-end
-
-local function initBossEvents()
- for n = Config_bossEntry[1], Config_bossEntry[1] + 990, 10 do
- if eS_has_value(Config_bossEntry,n) then
- RegisterCreatureEvent(n, 1, bossNPC.onEnterCombat)
- RegisterCreatureEvent(n, 2, bossNPC.reset) -- OnLeaveCombat
- RegisterCreatureEvent(n, 4, bossNPC.reset) -- OnDied
- else
- return
- end
- end
-end
-
-local function initAddEvents()
- for n = Config_addEntry[1], Config_addEntry[1] + 990, 10 do
- if eS_has_value(Config_addEntry,n) then
- RegisterCreatureEvent(n, 1, addNPC.onEnterCombat)
- RegisterCreatureEvent(n, 2, addNPC.reset) -- OnLeaveCombat
- RegisterCreatureEvent(n, 4, addNPC.reset) -- OnDied
- else
- return
- end
- end
-end
-
-local function eS_partyNpcYell(eventid, delay, repeats, worldobject)
- if partyNpcSayCounter == 10 then
- worldobject:SendUnitYell(Config.PartyNpcYellText, 0)
- partyNpcSayCounter = 0
- else
- worldobject:SendUnitSay(Config.PartyNpcSayText, 0)
- partyNpcSayCounter = partyNpcSayCounter + 1
- end
-end
-
-local function eS_CloseLua(eI_CloseLua)
- if npcObjectGuid ~= nil then
- local npcObject
- local map
- map = GetMapById(Config.MapId)
- if not map then
- return
- end
- npcObject = map:GetWorldObject(npcObjectGuid):ToCreature()
- if not npcObject then
- return
- end
- npcObject:DespawnOrUnsummon(0)
- end
-end
-
---on ReloadEluna / Startup
-RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, eS_command)
-RegisterPlayerEvent(PLAYER_EVENT_ON_REPOP, eS_resetPlayers)
-
-initBossEvents()
-initAddEvents()
-
-CharDBQuery('CREATE DATABASE IF NOT EXISTS `'..Config.customDbName..'`;');
-CharDBQuery('CREATE TABLE IF NOT EXISTS `'..Config.customDbName..'`.`eventscript_encounters` (`time_stamp` INT NOT NULL, `playerGuid` INT NOT NULL, `encounter` INT DEFAULT 0, `difficulty` TINYINT DEFAULT 0, `group_type` TINYINT DEFAULT 0, `duration` INT NOT NULL, PRIMARY KEY (`time_stamp`, `playerGuid`));');
-CharDBQuery('CREATE TABLE IF NOT EXISTS `'..Config.customDbName..'`.`eventscript_score` (`account_id` INT NOT NULL, `score_earned_current` INT DEFAULT 0, `score_earned_total` INT DEFAULT 0, PRIMARY KEY (`account_id`));')
-
-local Data_SQL = CharDBQuery('SELECT * FROM `'..Config.customDbName..'`.`eventscript_score`;')
-if Data_SQL ~= nil then
- local account
- repeat
- account = Data_SQL:GetUInt32(0)
- scoreEarned[account] = Data_SQL:GetUInt32(1)
- scoreTotal[account] = Data_SQL:GetUInt32(2)
- until not Data_SQL:NextRow()
-end
-
-if Config.partySelectNpcActive == 1 then
- RegisterServerEvent(ELUNA_EVENT_ON_LUA_STATE_CLOSE, eS_CloseLua, 0)
- RegisterCreatureGossipEvent(Config.partySelectNpc, GOSSIP_EVENT_ON_HELLO, eS_onPartyOnlyHello)
- RegisterCreatureGossipEvent(Config.partySelectNpc, GOSSIP_EVENT_ON_SELECT, eS_chromiePartyOnlyGossip)
- local npcObject = PerformIngameSpawn(1, Config.partySelectNpc, Config.MapId, Config.InstanceId, Config.NpcX, Config.NpcY, Config.NpcZ, Config.NpcO)
- npcObjectGuid = npcObject:GetGUID()
- npcObject:RegisterEvent(eS_partyNpcYell, 60000, 0)
-end
diff --git a/database/world/customWorldboss.sql b/database/world/customWorldboss.sql
index 746073f..9a5fcf6 100644
--- a/database/world/customWorldboss.sql
+++ b/database/world/customWorldboss.sql
@@ -12,47 +12,47 @@ INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entr
-- Party-only NPC:
(1112999, 0, 0, 0, 0, 0, 11062, 0, 0, 0, 'Amber Haze', 'Dark Queen of Timeshifts', 62001, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 1 Boss:
-(1112001, 0, 0, 0, 0, 0, 3456, 0, 0, 0, 'Glorifrir Flintshoulder', '', 0, 50, 50, 0, 63, 0, 1, 2, 3, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 450, 1, 1, 0, 0, 1, 634077055, 0, 256, '', 0),
+(1112001, 0, 0, 0, 0, 0, 3456, 0, 0, 0, 'Glorifrir Flintshoulder', '', 0, 73, 73, 0, 63, 0, 1, 2, 3, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 450, 1, 1, 0, 0, 1, 634077055, 0, 256, '', 0),
-- Custom Chromie 1:
(1112002, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62001, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 1 Add:
-(1112003, 0, 0, 0, 0, 0, 21443, 0, 0, 0, 'Zombie Captain', '', 0, 50, 50, 0, 415, 0, 1, 2, 1, 1, 0, 10, 2000, 2000, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 60, 1, 1, 0, 0, 1, 667631487, 0, 256, '', 0),
+(1112003, 0, 0, 0, 0, 0, 21443, 0, 0, 0, 'Zombie Captain', '', 0, 73, 73, 0, 415, 0, 1, 2, 1, 1, 0, 10, 2000, 2000, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 60, 1, 1, 0, 0, 1, 667631487, 0, 256, '', 0),
-- Event 2 Boss:
-(1112011, 0, 0, 0, 0, 0, 24722, 0, 0, 0, 'Pondulum of Deem', '', 0, 40, 40, 0, 63, 0, 1, 2, 3, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 1, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112011, 0, 0, 0, 0, 0, 24722, 0, 0, 0, 'Pondulum of Deem', '', 0, 73, 73, 0, 63, 0, 1, 2, 3, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 1, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 2:
(1112012, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62002, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 2 Add:
-(1112013, 0, 0, 0, 0, 0, 17953, 0, 0, 0, 'Seawitch', '', 0, 40, 40, 0, 63, 0, 1, 2, 1, 1, 0, 10, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 80, 100, 1, 0, 0, 1, 634077055, 0, 256, '', 0),
+(1112013, 0, 0, 0, 0, 0, 17953, 0, 0, 0, 'Seawitch', '', 0, 73, 73, 0, 63, 0, 1, 2, 1, 1, 0, 10, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 80, 100, 1, 0, 0, 1, 634077055, 0, 256, '', 0),
-- Event 3 Boss:
-(1112021, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Dundee', '', 0, 50, 50, 0, 63, 0, 1, 2, 2, 3, 0, 15, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112021, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Dundee', '', 0, 73, 73, 0, 63, 0, 1, 2, 2, 3, 0, 15, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 3:
(1112022, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62003, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 3 Add:
-(1112023, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Minion', '', 0, 50, 50, 0, 63, 0, 1, 2, 1, 1, 0, 5, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 50, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
+(1112023, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Minion', '', 0, 73, 73, 0, 63, 0, 1, 2, 1, 1, 0, 5, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 50, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
-- Event 4 Boss:
-(1112031, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Bunbee', '', 0, 50, 50, 0, 63, 0, 1, 2, 2, 3, 0, 25, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112031, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Bunbee', '', 0, 73, 73, 0, 63, 0, 1, 2, 2, 3, 0, 25, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 300, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 4:
(1112032, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62004, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 4 Add:
-(1112033, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Pet', '', 0, 50, 50, 0, 63, 0, 1, 2, 1, 1, 0, 5, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 50, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
+(1112033, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Pet', '', 0, 73, 73, 0, 63, 0, 1, 2, 1, 1, 0, 5, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 50, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
-- Event 4 Boss:
-(1112041, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Rundee', '', 0, 60, 60, 0, 63, 0, 1, 2, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112041, 0, 0, 0, 0, 0, 17557, 0, 0, 0, 'Crocolisk Rundee', '', 0, 73, 73, 0, 63, 0, 1, 2, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 4:
(1112042, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62005, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 4 Add:
-(1112043, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Guard', '', 0, 60, 60, 0, 63, 0, 1, 2, 1, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 70, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
+(1112043, 0, 0, 0, 0, 0, 1034, 0, 0, 0, 'Aligator Guard', '', 0, 73, 73, 0, 63, 0, 1, 2, 1, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 70, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
-- Event 6 Boss:
-(1112051, 0, 0, 0, 0, 0, 9475, 0, 0, 0, 'One-Three-Three-Seven', '', 0, 60, 60, 0, 63, 0, 1, 2, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1200, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112051, 0, 0, 0, 0, 0, 9475, 0, 0, 0, 'One-Three-Three-Seven', '', 0, 73, 73, 0, 63, 0, 1, 2, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1200, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 6:
(1112052, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62006, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 6 Add:
-(1112053, 0, 0, 0, 0, 0, 8409, 0, 0, 0, 'Ragnarix Qt', '', 0, 60, 60, 0, 63, 0, 1, 2, 2, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
+(1112053, 0, 0, 0, 0, 0, 8409, 0, 0, 0, 'Ragnarix Qt', '', 0, 73, 73, 0, 63, 0, 1, 2, 2, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0),
-- Event 7 Boss:
-(1112061, 0, 0, 0, 0, 0, 15656, 0, 0, 0, 'Big Bad Bug', '...not related to coding.', 0, 60, 60, 0, 63, 0, 1, 1, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1200, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
+(1112061, 0, 0, 0, 0, 0, 15656, 0, 0, 0, 'Big Bad Bug', '...not related to coding.', 0, 73, 73, 0, 63, 0, 1, 1, 2, 3, 0, 30, 2000, 2000, 1, 1, 1, 32832, 2048, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1200, 100, 1, 0, 0, 1, 667631231, 0, 0, '', 0),
-- Custom Chromie 7:
(1112062, 0, 0, 0, 0, 0, 10008, 0, 0, 0, 'Chromie', '', 62007, 63, 63, 0, 35, 1, 1, 1.14286, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1.35, 1, 1, 0, 0, 1, 0, 0, 2, '', 0),
-- Event 7 Add:
-(1112063, 0, 0, 0, 0, 0, 21955, 0, 0, 0, 'Bug\'s Bunny', '', 0, 62, 62, 0, 63, 0, 1, 5, 2, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0);
+(1112063, 0, 0, 0, 0, 0, 21955, 0, 0, 0, 'Bug\'s Bunny', '', 0, 73, 73, 0, 63, 0, 1, 5, 2, 1, 0, 15, 2000, 2000, 1, 1, 8, 0, 2048, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 600, 100, 1, 0, 0, 1, 667631227, 0, 256, '', 0);
-- Npc_text
SET @NPC_TEXT = 'Greetings, $n. One of the invaders of the timeline is in a nearby timenode. I might be able to make them visible for your eyes and vulnerable to your magic and weapons, but i can not aid you in this fight while i am maintaining the spell. Are you ready to face the worst this timeline has to deal with?\n';
diff --git a/bonusbuff.lua b/scripts/bonusbuff/bonusbuff.lua
similarity index 100%
rename from bonusbuff.lua
rename to scripts/bonusbuff/bonusbuff.lua
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
new file mode 100644
index 0000000..47d1820
--- /dev/null
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -0,0 +1,232 @@
+--Copyright (C) 2022-2024 https://github.com/55Honey
+--
+--This program is free software: you can redistribute it and/or modify
+--it under the terms of the GNU Affero General Public License as published by
+--the Free Software Foundation, either version 3 of the License, or
+--(at your option) any later version.
+--
+--This program is distributed in the hope that it will be useful,
+--but WITHOUT ANY WARRANTY; without even the implied warranty of
+--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+--GNU Affero General Public License for more details.
+--
+--You should have received a copy of the GNU Affero General Public License
+--along with this program. If not, see .
+--
+--
+--
+--
+-- Created by IntelliJ IDEA.
+-- User: Silvia
+-- Date: 05/02/2024
+-- Time: 12:31
+-- Originally created by Honey for Azerothcore
+-- requires mod-eluna
+
+if not ebs then
+ require('eventBosses')
+end
+
+local bossNPC = {}
+local addNPC = {}
+
+------------------------------------------------------------------------------------------
+-- The data below is mandatory for the main script to work with the encounter. --
+-- Adjust as needed. The encounterId must be unique for each encounter. --
+-- entry ..XX1 is the boss. --
+-- entry ..XX2 is the gossip NPC. --
+-- entry ..XX3 is the add. --
+-- For encounterId 2, the entries are 1112011, 1112012, 1112013. Add +10 per Id. --
+------------------------------------------------------------------------------------------
+
+local encounterId = 1
+
+ebs.encounter[encounterId] = {
+ -- type entry map x y z o despawnTime
+ ["npc"] = { TYPE_CREATURE, 1112002, 1, 5507.3, -3685.5, 1594.3, 1.97, 0 }, -- gossip NPC for players to interact with
+ ["npcText"] = 91111, -- gossip NPC text ID
+ ["bossEntry"] = 1112001, -- boss entry (auto summoned)
+ ["addEntry"] = 1112003, -- add entry (auto summoned, if addAmount > 0)
+ ["addHealthModifierParty"] = 0.2, -- modifier for add health in 5man mode
+ ["addAmount"] = 3 -- amount of adds to spawn right at the start of the encounter
+}
+
+------------------------------------------------------------------------------------------
+-- There are no changes required to this part. It is mandatory for the script to work. --
+-- Custom scripting goes to the designated section at the bottom. --
+------------------------------------------------------------------------------------------
+
+local addDownCounter = {}
+
+function bossNPC.onEnterCombat( event, creature, target )
+ creature:CallAssistance()
+ creature:CallForHelp( 200 )
+ local difficulty = creature:GetData('ebs_difficulty')
+ bossNPC.CustomEnterCombat( creature, target, difficulty )
+end
+
+function bossNPC.reset( event, creature )
+ creature:RemoveEvents()
+ local difficulty = creature:GetData('ebs_difficulty')
+ bossNPC.CustomReset( creature, difficulty )
+ ebs.bossReset( event, creature )
+end
+
+function addNPC.onEnterCombat( event, add, target )
+ add:CallAssistance()
+ local difficulty = add:GetData('ebs_difficulty')
+ addNPC.CustomEnterCombat( add, target, difficulty )
+end
+
+function addNPC.reset( event, add )
+ add:RemoveEvents()
+ local slotId
+ local difficulty = add:GetData('ebs_difficulty')
+ local bossLowGUID = add:GetData('ebs_boss_lowguid')
+ local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
+ local boss = add:GetMap():GetWorldObject( guid )
+ if add:IsDead() then
+
+ local hasValue
+ hasValue, slotId = ebs.returnKey ( ebs.spawnedBossGuid, bossLowGUID )
+ if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
+ ebs.addReset( event, add )
+ return
+ end
+
+ if not addDownCounter[ slotId ] then
+ addDownCounter[ slotId ] = 0
+ end
+
+ addDownCounter[ slotId ] = addDownCounter[ slotId ] + 1
+ if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
+
+ if boss then
+ addNPC.CustomLastAddDead( add, boss, difficulty, slotId )
+ end
+ end
+ end
+
+ addNPC.CustomReset( add, boss, difficulty, slotId )
+ ebs.addReset( event, add )
+end
+
+--**********************************************************************************
+--**** CUSTOM SCRIPTING BELOW ****
+--**********************************************************************************
+
+function bossNPC.CustomEnterCombat( creature, target, difficulty )
+ -------------------------------------------------------------------------------
+ -- This function runs when the raid boss enters combat. It's main use is to register events.
+ -------------------------------------------------------------------------------
+ creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
+end
+
+function bossNPC.CustomReset( creature, difficulty )
+ -------------------------------------------------------------------------------
+ -- This function runs for the boss when it resets. This includes everything which ends their combat.
+ -- You can add custom scripting here, e.g. checking:
+ -- if creature:IsDead() then
+ -------------------------------------------------------------------------------
+end
+
+function addNPC.CustomEnterCombat( add, target, difficulty )
+ -------------------------------------------------------------------------------
+ -- This function runs when an add enters combat. It's main use is to register events.
+ -------------------------------------------------------------------------------
+ add:RegisterEvent( addNPC.HealBoss, { 10000, 15000 }, 0 )
+ add:RegisterEvent( addNPC.Splash, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
+ if difficulty >= 3 or add:GetData('ebs_mode') == PARTY_IN_PROGRESS then
+ add:RegisterEvent( bossNPC.PullIn, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
+ end
+end
+
+function addNPC.CustomLastAddDead( add, boss, difficulty, slotId )
+ -------------------------------------------------------------------------------
+ -- This function runs when the last add has died but the boss is still alive.
+ -------------------------------------------------------------------------------
+ boss:SendUnitYell( "You will pay for your actions!", 0 )
+ boss:RegisterEvent( bossNPC.PullIn, { ebs.GetTimer( 4000, difficulty ), 6000 }, 0 )
+ boss:RegisterEvent( bossNPC.Pool, { ebs.GetTimer( 10000, difficulty ), 12000}, 0 )
+end
+
+function addNPC.CustomReset( add, boss, difficulty, slotId )
+ -------------------------------------------------------------------------------
+ -- This function runs for every add that resets. This includes everything which ends their combat.
+ -- You can add custom scripting here, e.g. checking:
+ -- if add:IsDead() then
+ -------------------------------------------------------------------------------
+end
+
+-------------------------------------------------------------------------------
+-- End of pre-defined hooks
+-------------------------------------------------------------------------------
+local RAIN_OF_FIRE = 31340
+local ABOMINATION_HOOK = 59395
+local AIR_BURST = 32014
+local DEATH_AND_DECAY = 53721
+local HEAL = 30878
+
+function bossNPC.Fire( _, _, _, creature )
+ local target = creature:GetAITarget( SELECT_TARGET_RANDOM, true, nil, -10 )
+ if target then
+ creature:CastSpell( target, RAIN_OF_FIRE, false )
+ end
+end
+
+function bossNPC.PullIn( _, _, _, creature )
+ local target = creature:GetAITarget( SELECT_TARGET_FARTHEST, true, nil, -10 )
+ creature:CastSpell( target, ABOMINATION_HOOK, true )
+end
+
+function bossNPC.Pool( _, _, _, creature )
+ if math.random(1,2) == 1 then
+ creature:CastSpell( creature, AIR_BURST, false )
+ else
+ creature:CastSpell( creature:GetVictim(), DEATH_AND_DECAY, false )
+ end
+end
+
+function addNPC.RemoveInterrupt( _, _, _, add )
+ add:SetImmuneTo( MECHANIC_INTERRUPT, false )
+end
+
+function addNPC.HealBoss( _, _, _, add )
+ local bossLowGUID = add:GetData('ebs_boss_lowguid')
+ local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
+ local boss = add:GetMap():GetWorldObject( guid )
+ if boss then
+ if boss:GetHealthPct() < 90 then
+ if math.random(1,2) == 1 then
+ boss:SendUnitYell( "HAHAHA! You can't hurt me!", 0 )
+ else
+ add:SendUnitYell( "Don't you dare harm the master!", 0 )
+ end
+ --add:SetImmuneTo( MECHANIC_INTERRUPT, true )
+ add:UnitMoveStop()
+ add:CastCustomSpell( boss, HEAL, false, 1000000 )
+ add:RegisterEvent( addNPC.ResumeChase, 2600, 1)
+ --add:RegisterEvent( addNPC.RemoveInterrupt, 3000, 1 )
+ end
+ end
+end
+
+function addNPC.Splash( _, _, _, add )
+ add:CastCustomSpell( add:GetVictim(), AIR_BURST, false, nil, 150 )
+end
+
+function addNPC.ResumeChase( _, _, _, add )
+ add:UnitMoveChase()
+end
+
+--**********************************************************************************
+--**** END OF CUSTOM SCRIPTING ****
+--**********************************************************************************
+
+RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 1, bossNPC.onEnterCombat )
+RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 2, bossNPC.reset ) -- OnLeaveCombat
+RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 4, bossNPC.reset ) -- OnDied
+
+RegisterCreatureEvent( ebs.encounter[ encounterId ].addEntry, 1, addNPC.onEnterCombat )
+RegisterCreatureEvent( ebs.encounter[ encounterId ].addEntry, 2, addNPC.reset ) -- OnLeaveCombat
+RegisterCreatureEvent( ebs.encounter[ encounterId ].addEntry, 4, addNPC.reset ) -- OnDied
diff --git a/scripts/custom_boss_events/eventBossRewards.lua b/scripts/custom_boss_events/eventBossRewards.lua
new file mode 100644
index 0000000..bdb9662
--- /dev/null
+++ b/scripts/custom_boss_events/eventBossRewards.lua
@@ -0,0 +1,165 @@
+--Copyright (C) 2022-2024 https://github.com/55Honey
+--
+--This program is free software: you can redistribute it and/or modify
+--it under the terms of the GNU Affero General Public License as published by
+--the Free Software Foundation, either version 3 of the License, or
+--(at your option) any later version.
+--
+--This program is distributed in the hope that it will be useful,
+--but WITHOUT ANY WARRANTY; without even the implied warranty of
+--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+--GNU Affero General Public License for more details.
+--
+--You should have received a copy of the GNU Affero General Public License
+--along with this program. If not, see .
+--
+--
+--
+--
+-- Created by IntelliJ IDEA.
+-- User: Silvia
+-- Date: 22/03/2024
+-- Time: 20:07
+-- Originally created by Honey for Azerothcore
+-- requires mod-eluna
+
+if not ebs then
+ require('eventBosses')
+end
+
+------------------------------------------
+-- Begin of config section
+------------------------------------------
+
+ebs.Config.cityAreas = { 3703, 3899, -- Shattrath
+ 4395, 4560, 4567, 4601, 4613, 4616, 4620 -- Dalaran
+}
+ebs.Config.cityAuras = { [1] = 22586, -- 5% speed
+ [2] = 22586, -- 5% speed
+ [3] = 22587, -- 8% speed
+ [4] = 22587, -- 8% speed
+ [5] = 22588, -- 10% speed
+ [6] = 22588, -- 10% speed
+ [7] = 22589, -- 13% speed
+ [8] = 22589, -- 13% speed
+ [9] = 22589, -- 13% speed
+ [10] = 22590 -- 15% speed
+}
+
+ebs.Config.raidAura = 2147
+ebs.Config.raidAuraBaseDuration = 8
+ebs.Config.raidAuraAdditionalDuration = 2
+ebs.Config.boostedFactions = { 270, -- Zandalar Tribe
+ 509, -- League of Arathor
+ 510, -- The Defilers
+ 609, -- Cenarion Circle
+ 729, -- Frostwolf Clan
+ 730, -- Stormpike Guard
+ 749, -- Hydraxian Waterlords
+ 889, -- Warsong Outriders
+ 890, -- Silverwing Sentinels
+ 910 -- Brood of Nozdormu
+}
+
+------------------------------------------
+-- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
+------------------------------------------
+
+function ebs.BuffInRaid(player)
+ print("69: actually buffing")
+ if not ebs.clearedDifficulty[player:GetAccountId()] then
+ ebs.clearedDifficulty[player:GetAccountId()] = {}
+ end
+ local difficulty = ebs.clearedDifficulty[player:GetAccountId()][PARTY_IN_PROGRESS]
+ if not difficulty then
+ return
+ end
+ if difficulty > ebs.Config.maxRewardLevel then
+ difficulty = ebs.Config.maxRewardLevel
+ end
+
+ local duration = ebs.Config.raidAuraBaseDuration + (ebs.Config.raidAuraAdditionalDuration * difficulty)
+ player:AddAura(ebs.Config.raidAura, player)
+ player:RegisterEvent(function(_, _, _, player)
+ player:RemoveAura(ebs.Config.raidAura)
+ end, duration * 1000, 1)
+end
+
+function ebs.RemovePlayerAuras(_, player)
+ player:RemoveAura(ebs.Config.raidAura)
+ for _,v in ipairs(ebs.Config.cityAreas) do
+ player:RemoveAura(v)
+ end
+end
+
+function ebs.BuffInCity(event, player, oldArea, newArea)
+ -- if the player is now in a main city area, buff it
+ if ebs.has_value (ebs.Config.cityAreas, newArea) then
+ -- if the player has not completed anything, stop checking early
+ if not ebs.clearedDifficulty[player:GetAccountId()] then
+ print("returned 100")
+ return
+ end
+
+ local difficulty = ebs.clearedDifficulty[player:GetAccountId()][RAID_IN_PROGRESS]
+ if not difficulty then
+ return
+ end
+ if difficulty > ebs.Config.maxRewardLevel then
+ difficulty = ebs.Config.maxRewardLevel
+ end
+ player:AddAura(ebs.Config.cityAuras[difficulty], player)
+
+ -- if the player was in a main city area before, remove the auras
+ else
+ ebs.RemovePlayerAuras(_, player)
+ end
+end
+
+function ebs.BoostReputation(_, player, factionId, standing, incremental) -- Can return new standing -> if standing == -1, it will prevent default action (rep gain)
+ print('standing: '..standing)
+ print('incrememntal: '..incremental)
+ if ebs.has_value(ebs.Config.boostedFactions, factionId) then
+ if not ebs.clearedDifficulty[player:GetAccountId()] then
+ return
+ end
+ if ebs.clearedDifficulty[player:GetAccountId()][RAID_IN_PROGRESS] >= ebs.Config.maxRewardLevel then
+ print('standing: + incremental: '..standing + (incremental * REPUTATION_FACTOR))
+ return standing + (incremental * REPUTATION_FACTOR)
+ end
+ end
+end
+
+function ebs.RemoveRaidAuras()
+ for m = 1,2 do
+ local players = GetPlayersInWorld( n )
+ for _, player in pairs(players) do
+ player:RemoveAura(ebs.Config.raidAura)
+ end
+ end
+end
+
+function ebs.RemovePartyAuras()
+ for n = 1,2 do
+ local players = GetPlayersInWorld( n )
+ for _, player in pairs(players) do
+ for _,v in ipairs(ebs.Config.cityAuras) do
+ player:RemoveAura(v)
+ end
+ end
+ end
+end
+
+local PLAYER_EVENT_ON_LOGOUT = 4
+local PLAYER_EVENT_ON_REPUTATION_CHANGE = 15
+local PLAYER_EVENT_ON_UPDATE_AREA = 47
+
+RegisterPlayerEvent( PLAYER_EVENT_ON_LOGOUT, ebs.RemovePlayerAuras )
+
+if ebs.Config.reputationFactor ~= 1 then
+ RegisterPlayerEvent( PLAYER_EVENT_ON_REPUTATION_CHANGE, ebs.BoostReputation )
+end
+
+if ebs.Config.rewardRaid == 1 then
+ RegisterPlayerEvent( PLAYER_EVENT_ON_UPDATE_AREA, ebs.BuffInCity )
+end
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
new file mode 100644
index 0000000..1b17834
--- /dev/null
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -0,0 +1,792 @@
+--Copyright (C) 2022-2024 https://github.com/55Honey
+--
+--This program is free software: you can redistribute it and/or modify
+--it under the terms of the GNU Affero General Public License as published by
+--the Free Software Foundation, either version 3 of the License, or
+--(at your option) any later version.
+--
+--This program is distributed in the hope that it will be useful,
+--but WITHOUT ANY WARRANTY; without even the implied warranty of
+--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+--GNU Affero General Public License for more details.
+--
+--You should have received a copy of the GNU Affero General Public License
+--along with this program. If not, see .
+--
+--
+--
+--
+-- Created by IntelliJ IDEA.
+-- User: Silvia
+-- Date: 05/02/2024
+-- Time: 12:31
+-- Originally created by Honey for Azerothcore
+-- requires mod-eluna
+
+
+-- This module spawns (custom) NPCs and grants them scripted combat abilities
+------------------------------------------------------------------------------------------------
+-- ADMIN GUIDE: - compile the core with mod-eluna
+-- - adjust config in this file
+-- - add this script to ../lua_scripts/
+-- - possibly add additional boss scripts
+-- - adjust the IDs and config flags in case of conflicts and run the associated SQL to add the required NPCs
+-- - the acore_cms module assumes that 1112001 is the boss of encounter 1 and adding +10 for each subsequent encounter
+-- (1112011 = boss for encounter 2 / 1112021 = boss for encounter 3, etc.)
+------------------------------------------------------------------------------------------------
+-- GM GUIDE: - use .startevent $event to start and spawn
+-- - maybe offer teleports
+-- - use .stopevent to end the event and despawn the NPC
+------------------------------------------------------------------------------------------------
+ebs = {}
+
+------------------------------------------
+-- Begin of config section
+------------------------------------------
+
+ebs.Config = {
+ ["creature_template"] = {}, --db entry of the boss creature
+ ["customDbName"] = "ac_eluna",
+ ["eventPhase"] = { 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 },
+ ["fireworks"] = { 66400, 66402, 46847, 46829, 46830, 62074, 62075, 62077, 55420 },
+ ["GMRankForEventStart"] = 2,
+ ["GMRankForUpdateDB"] = 3,
+ ["addEnrageTimer"] = 300000,
+ ["baseScore"] = 40,
+ ["additionalScore"] = 10,
+ ["giveScoreRaid"] = 1,
+ ["storeRaid"] = 1,
+ ["rewardRaid"] = 1,
+ ["giveScoreParty"] = 1,
+ ["storeParty"] = 1,
+ ["rewardParty"] = 1,
+
+ -- Factor for reputation increase with the `ebs.Config.boostedFactions`.
+ -- Not registering any events if 1
+ ["reputationFactor"] = 1,
+
+ -- Highest difficulty level that is taken into account for rewards.
+ -- Higher levels might be playable, but no additional rewards are given.
+ ["maxRewardLevel"] = 10,
+
+ -- Amount of players with the lowest already cleared difficulty to ignore
+ -- when calculating the group's difficulty level.
+ ["ebs.Config.IgnoreLowestPartyAmount"] = 1,
+ ["ebs.Config.IgnoreLowestRaidAmount"] = 5
+}
+
+------------------------------------------
+-- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
+------------------------------------------
+
+if tostring(ebs.Config.customDbName) == "" or (ebs.Config.customDbName) == nil then
+ PrintError("eventBosses.lua: Missing flag ebs.Config.customDbName. Defaulting to ac_eluna.")
+ ebs.Config.customDbName = "ac_eluna"
+end
+
+CharDBQuery('CREATE DATABASE IF NOT EXISTS `'..ebs.Config.customDbName..'`;');
+CharDBQuery('CREATE TABLE IF NOT EXISTS `'..ebs.Config.customDbName..'`.`eventscript_encounters` (`time_stamp` INT NOT NULL, `playerGuid` INT NOT NULL, `encounter` INT DEFAULT 0, `difficulty` TINYINT DEFAULT 0, `group_type` TINYINT DEFAULT 0, `duration` INT NOT NULL, PRIMARY KEY (`time_stamp`, `playerGuid`));');
+CharDBQuery('CREATE TABLE IF NOT EXISTS `'..ebs.Config.customDbName..'`.`eventscript_score` (`account_id` INT NOT NULL, `score_earned_current` INT DEFAULT 0, `score_earned_total` INT DEFAULT 0, PRIMARY KEY (`account_id`));')
+CharDBQuery('CREATE TABLE IF NOT EXISTS `'..ebs.Config.customDbName..'`.`eventscript_difficulty` (`account_id` INT NOT NULL, `encounter_id` INT NOT NULL, `encounter_type` INT NOT NULL, `difficulty` INT NOT NULL, PRIMARY KEY (`account_id`, `encounter_id`, `encounter_type`));')
+
+--constants
+PLAYER_EVENT_ON_LOGIN = 3 -- (event, player)
+PLAYER_EVENT_ON_LOGOUT = 4 -- (event, player)
+PLAYER_EVENT_ON_REPOP = 35 -- (event, player)
+PLAYER_EVENT_ON_COMMAND = 42 -- (event, player, command, chatHandler) - player is nil if command used from console. Can return false
+
+TEMPSUMMON_MANUAL_DESPAWN = 8 -- despawns when UnSummon() is called
+
+GOSSIP_EVENT_ON_HELLO = 1 -- (event, player, object) - Object is the Creature/GameObject/Item. Can return false to do default action. For item gossip can return false to stop spell casting.
+GOSSIP_EVENT_ON_SELECT = 2 -- (event, player, object, sender, intid, code, menu_id)
+
+OPTION_ICON_CHAT = 0
+OPTION_ICON_BATTLE = 9
+
+ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16
+ELUNA_EVENT_ON_LUA_STATE_OPEN = 33
+
+GROUPTYPE_NORMAL = 0
+GROUPTYPE_RAID = 2
+
+MECHANIC_CHARM = 1
+MECHANIC_DISORIENTED= 2
+MECHANIC_DISARM = 3
+MECHANIC_DISTRACT = 4
+MECHANIC_FEAR = 5
+MECHANIC_GRIP = 6
+MECHANIC_ROOT = 7
+MECHANIC_SLOW_ATTACK = 8
+MECHANIC_SILENCE = 9
+MECHANIC_SLEEP = 10
+MECHANIC_SNARE = 11
+MECHANIC_STUN = 12
+MECHANIC_FREEZE = 13
+MECHANIC_KNOCKOUT = 14
+MECHANIC_BLEED = 15
+MECHANIC_BANDAGE = 16
+MECHANIC_POLYMORPH = 17
+MECHANIC_BANISH = 18
+MECHANIC_SHIELD = 19
+MECHANIC_SHACKLE = 20
+MECHANIC_MOUNT = 21
+MECHANIC_INFECTED = 22
+MECHANIC_TURN = 23
+MECHANIC_HORROR = 24
+MECHANIC_INVULNERABILITY = 25
+MECHANIC_INTERRUPT = 26
+MECHANIC_DAZE = 27
+MECHANIC_DISCOVERY = 28
+MECHANIC_IMMUNE_SHIELD = 29
+MECHANIC_SAPPED = 30
+MECHANIC_ENRAGED = 31
+
+
+SELECT_TARGET_RANDOM = 0 -- Just selects a random target
+SELECT_TARGET_TOPAGGRO = 1 -- Selects targets from top aggro to bottom
+SELECT_TARGET_BOTTOMAGGRO = 2 -- Selects targets from bottom aggro to top
+SELECT_TARGET_NEAREST = 3
+SELECT_TARGET_FARTHEST = 4
+
+TYPE_CREATURE = 1
+TYPE_GAMEOBJECT = 2
+
+PARTY_IN_PROGRESS = 1
+RAID_IN_PROGRESS = 2
+
+local eventInProgress
+
+ebs.playersInGroup = {
+ [1] = {},
+ [2] = {},
+ [3] = {},
+ [4] = {},
+ [5] = {},
+ [6] = {},
+ [7] = {},
+ [8] = {},
+ [9] = {},
+ [10] = {}
+}
+local scoreEarned = {}
+local scoreTotal = {}
+ebs.spawnedGossipNpcGuid = 0
+ebs.spawnedBossGuid = {}
+ebs.phaseIdDifficulty = {} -- stores the difficulty of the encounter. 0 means the slot is free
+ebs.fightType = {} -- party or raid
+ebs.encounter = {}
+ebs.clearedDifficulty = {}
+ebs.encounterStartTime = {}
+
+function ebs.has_value (tab, val)
+ for index, value in ipairs(tab) do
+ if value == val then
+ return true
+ end
+ end
+ return false
+end
+
+function ebs.returnKey (tab, val)
+ for index, value in ipairs(tab) do
+ if value == val then
+ return true, index
+ end
+ end
+ return false, 0
+end
+
+function ebs.returnIndex (tab, val)
+ for index, value in ipairs(tab) do
+ if value == val then
+ return index
+ end
+ end
+ return false
+end
+
+function ebs.splitString(inputstr, seperator)
+ if seperator == nil then
+ seperator = "%s"
+ end
+ local t={}
+ for str in string.gmatch(inputstr, "([^"..seperator.."]+)") do
+ table.insert(t, str)
+ end
+ return t
+end
+
+function ebs.castFireworks(_, _, _, player)
+ if player and player:GetPhaseMask() == 1 then
+ player:CastSpell(player, ebs.Config.fireworks[math.random(1, #ebs.Config.fireworks)])
+ end
+end
+
+function ebs.isParticipating(player)
+ if not player then
+ return false
+ end
+ for _,v in pairs(ebs.playersInGroup) do
+ if ebs.has_value(v, player:GetGUID()) and player:GetPhaseMask() ~= 1 then
+ return true
+ end
+ end
+ return false
+end
+
+function ebs.resetPlayers(_, player)
+ ebs.RemovePlayerAuras(_, player)
+ if ebs.isParticipating(player) then
+ player:SetPhaseMask(1)
+ player:SendBroadcastMessage("You left the event.")
+ if player:GetCorpse() then
+ player:GetCorpse():SetPhaseMask(1)
+ end
+ end
+end
+
+function ebs.getSize(difficulty)
+ local value = 1
+ if difficulty >= 1 then
+ value = 1 + (difficulty - 1) / 8
+ end
+ return value
+end
+
+function ebs.checkInCombat(slotId)
+ --check if all players are in combat
+ local player
+ for _, v in pairs(ebs.playersInGroup[slotId]) do
+ player = GetPlayerByGUID(v)
+ if player ~= nil then
+ if player:IsInCombat() == false and player:GetPhaseMask() == 2 then
+ if player:GetCorpse() ~= nil then
+ player:GetCorpse():SetPhaseMask(1)
+ end
+ player:SetPhaseMask(1)
+ player:SendBroadcastMessage("You were returned to the real time because you did not participate.")
+ end
+ end
+ end
+end
+
+function ebs.getEncounterDuration(slotId)
+ local dt = GetTimeDiff(ebs.encounterStartTime[slotId])
+ return string.format("%.2d:%.2d", (dt / 1000 / 60) % 60, (dt / 1000) % 60)
+end
+
+function ebs.GetTimer(timer, difficulty)
+ if difficulty == 1 then
+ return timer
+ else
+ timer = timer / (1 + ((difficulty - 1) / 9))
+ return timer
+ end
+end
+
+function ebs.getFreeSlot()
+ for n = 1, 10 do
+ if ebs.phaseIdDifficulty[n] == nil then
+ return n
+ end
+ end
+ return 1
+end
+
+function ebs.getLastSuccessfulDifficulty(accountId, fightType)
+ if ebs.clearedDifficulty[accountId] then
+ local difficulty = ebs.clearedDifficulty[accountId][fightType]
+ if difficulty then
+ return difficulty
+ end
+ end
+ return 0
+end
+
+function ebs.awardScore(slotId)
+ for _, playerGuid in pairs(ebs.playersInGroup[slotId]) do
+ local player = GetPlayerByGUID(playerGuid)
+ if not player then
+ PrintError("eventBosses.lua: Player with GUID "..tostring(playerGuid).." not found in ebs.awardScore(slotId).")
+ return
+ end
+
+ local newScore
+ local baseScore
+ local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
+
+ if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
+ if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
+ local oldScore = scoreEarned[accountId]
+
+ if ebs.fightType[slotId] == PARTY_IN_PROGRESS and ebs.Config.giveScoreParty == 1 then
+ newScore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.getLastSuccessfulDifficulty(accountId, PARTY_IN_PROGRESS)
+ baseScore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.getLastSuccessfulDifficulty(accountId, RAID_IN_PROGRESS)
+ end
+
+ if ebs.fightType[slotId] == RAID_IN_PROGRESS and ebs.Config.giveScoreRaid == 1 then
+ newScore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.getLastSuccessfulDifficulty(accountId, RAID_IN_PROGRESS)
+ baseScore= ebs.Config.baseScore + ebs.Config.additionalScore * ebs.getLastSuccessfulDifficulty(accountId, PARTY_IN_PROGRESS)
+ end
+
+ scoreEarned[accountId] = newScore + baseScore
+ CharDBExecute('REPLACE INTO `'..ebs.Config.customDbName..'`.`eventscript_score` VALUES ('..accountId..', '..scoreEarned[accountId]..', '..scoreTotal[accountId]..');');
+ local gameTime = (tonumber(tostring(GetGameTime())))
+ local playerLowGuid = GetGUIDLow(playerGuid)
+ CharDBExecute('INSERT IGNORE INTO `'..ebs.Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..ebs.phaseIdDifficulty[slotId]..', '..ebs.fightType[slotId]..', '..GetTimeDiff(ebs.encounterStartTime[slotId])..');');
+ end
+end
+
+function ebs.storeEncounter(slotId)
+ for _, playerGuid in pairs(ebs.playersInGroup[slotId]) do
+ if GetPlayerByGUID(playerGuid) then
+ local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
+ local gameTime = (tonumber(tostring(GetGameTime())))
+ local playerLowGuid = GetGUIDLow(playerGuid)
+ CharDBExecute('INSERT IGNORE INTO `'..ebs.Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..ebs.phaseIdDifficulty[slotId]..', '..ebs.fightType[slotId]..', '..GetTimeDiff(ebs.encounterStartTime[slotId])..');');
+ end
+ end
+end
+
+function ebs.onHello(_, player, creature)
+ if not player then
+ return
+ end
+ if ebs.getFreeSlot() == nil then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("Too many heroes are already fighting the enemies of time. Please hold on until i can support more timewalking magic.")
+ else
+ if player:GetGroup() then
+ if player:GetGroup():GetGroupType() == GROUPTYPE_NORMAL then
+ local MaxPartyLevel = ebs.getLowestGroupLevel(player, PARTY_IN_PROGRESS)
+ for n = 1,MaxPartyLevel do
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant! (Difficulty " .. n .. ")", ebs.encounter[eventInProgress].npc[2], n)
+ end
+ else
+ local MaxRaidLevel = ebs.getLowestGroupLevel(player, RAID_IN_PROGRESS)
+ for n = 1,MaxRaidLevel do
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything! (Difficulty " .. n .. ")", ebs.encounter[eventInProgress].npc[2], n + 10)
+ end
+ end
+ end
+ end
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", ebs.encounter[eventInProgress].npc[2], 0)
+ player:GossipSendMenu(ebs.encounter[eventInProgress].npcText, creature, 0)
+end
+
+function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
+ local spawnedBoss
+ local spawnedCreature = {}
+
+ if player == nil then return end
+
+ local group = player:GetGroup()
+ local slotId = ebs.getFreeSlot()
+
+ -- Display the player's progress
+ if intid == 0 then
+ local accountId = player:GetAccountId()
+ if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
+ if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("Your current event score is: "..scoreEarned[accountId].." and your all-time event score is: "..scoreTotal[accountId])
+ player:GossipComplete()
+ return
+ end
+
+ -- Check if the player is in a group and if they are the leader
+ if intid >= 1 and intid <= 20 then
+ if slotId == nil then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("Too many heroes are already fighting the enemies of time. Please hold on until i can support more timewalking magic.")
+ player:GossipComplete()
+ return
+ end
+
+ if player:IsInGroup() == false then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("You need to be in a group to start this.")
+ player:GossipComplete()
+ return
+ end
+
+ if not group:IsLeader(player:GetGUID()) then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("You are not the leader of your group.")
+ player:GossipComplete()
+ return
+ end
+ end
+
+ local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventInProgress].npc)
+
+ if intid <= 10 then
+ if group:IsRaidGroup() == true then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("You can not accept that task while in a raid group.")
+ player:GossipComplete()
+ return
+ end
+ groupPlayers = group:GetMembers()
+ local designatedDifficulty = intid
+ if ebs.getLowestGroupLevel(player, PARTY_IN_PROGRESS) < designatedDifficulty then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("Group composition has changed. Please talk to Chromie again after adding members.")
+ player:GossipComplete()
+ return
+ end
+
+ --start 5man encounter
+ ebs.fightType[slotId] = PARTY_IN_PROGRESS
+ ebs.phaseIdDifficulty[slotId] = designatedDifficulty
+
+ spawnedCreature[1]= object:SpawnCreature(ebs.encounter[eventInProgress].addEntry, x, y, z+2, o, spawnType, despawnTime)
+ spawnedCreature[1]:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ spawnedCreature[1]:SetScale(spawnedCreature[1]:GetScale() * ebs.getSize(slotId))
+ ebs.spawnedBossGuid[slotId] = spawnedCreature[1]:GetGUIDLow()
+ spawnedCreature[1]:SetData('ebs_mode', ebs.fightType[slotId])
+ spawnedCreature[1]:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
+
+ local maxHealth = ebs.encounter[eventInProgress].addHealthModifierParty * spawnedCreature[1]:GetMaxHealth()
+ local health = ebs.encounter[eventInProgress].addHealthModifierParty * spawnedCreature[1]:GetHealth()
+ spawnedCreature[1]:SetMaxHealth(maxHealth)
+ spawnedCreature[1]:SetHealth(health)
+
+ ebs.encounterStartTime[slotId] = GetCurrTime()
+
+ for n, v in pairs(groupPlayers) do
+ if v:GetDistance(object) < 80 then
+ v:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ ebs.playersInGroup[slotId][n] = v:GetGUID()
+ spawnedCreature[1]:SetInCombatWith(v)
+ v:SetInCombatWith(spawnedCreature[1])
+ spawnedCreature[1]:AddThreat(v, 1)
+ else
+ v:SendBroadcastMessage("You were too far away to join the fight.")
+ end
+ end
+
+ elseif intid <= 20 then
+ if group:IsRaidGroup() == false then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("You can not accept that task without being in a raid group.")
+ player:GossipComplete()
+ return
+ end
+ groupPlayers = group:GetMembers()
+ local designatedDifficulty = intid - 10
+ if ebs.getLowestGroupLevel(player, RAID_IN_PROGRESS) < designatedDifficulty then
+ --todo: change broadcast message to whisper
+ player:SendBroadcastMessage("Group composition has changed. Please talk to Chromie again after adding members.")
+ player:GossipComplete()
+ return
+ end
+
+ --start raid encounter
+ ebs.fightType[slotId] = RAID_IN_PROGRESS
+ ebs.phaseIdDifficulty[slotId] = designatedDifficulty
+
+ spawnedBoss = object:SpawnCreature(ebs.encounter[eventInProgress].bossEntry, x, y, z+2, o, spawnType, despawnTime)
+ spawnedBoss:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ spawnedBoss:SetScale(spawnedBoss:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slotId]))
+ ebs.spawnedBossGuid[slotId] = spawnedBoss:GetGUIDLow()
+ spawnedBoss:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
+
+ if ebs.encounter[slotId].addAmount > 0 then
+ for c = 1, ebs.encounter[slotId].addAmount do
+ local randomX = (math.sin(math.random(1,360)) * 15)
+ local randomY = (math.sin(math.random(1,360)) * 15)
+ spawnedCreature[c] = spawnedBoss:SpawnCreature(ebs.encounter[slotId].addEntry, x + randomX, y + randomY, z+2, o)
+ spawnedCreature[c]:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ spawnedCreature[c]:SetScale(spawnedCreature[c]:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slotId]))
+ spawnedCreature[c]:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
+ spawnedCreature[c]:SetData('ebs_boss_lowguid', ebs.spawnedBossGuid[slotId])
+ end
+ end
+
+ ebs.encounterStartTime[slotId] = GetCurrTime()
+
+ for n, v in pairs(groupPlayers) do
+ if v:GetDistance(object) < 80 then
+ v:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ ebs.playersInGroup[slotId][n] = v:GetGUID()
+ spawnedBoss:SetInCombatWith(v)
+ v:SetInCombatWith(spawnedBoss)
+ spawnedBoss:AddThreat(v, 1)
+ if ebs.encounter[eventInProgress].addAmount > 0 then
+ for c = 1, ebs.encounter[eventInProgress].addAmount do
+ spawnedCreature[c]:SetInCombatWith(v)
+ v:SetInCombatWith(spawnedCreature[c])
+ spawnedCreature[c]:AddThreat(v, 1)
+ end
+ end
+
+ if ebs.Config.rewardParty == 1 then
+ ebs.BuffInRaid(v)
+ end
+ else
+ v:SendBroadcastMessage("You were too far away to join the fight.")
+ end
+ end
+ end
+ player:GossipComplete()
+end
+
+function ebs.getLowestGroupLevel(player, groupType)
+ local group = player:GetGroup()
+ local members = group:GetMembers()
+ local n = 1
+ local completedLevel = {}
+ for _,v in pairs(members) do
+ completedLevel[n] = ebs.getLastSuccessfulDifficulty(v:GetAccountId(), groupType)
+ n = n + 1
+ end
+ table.sort(completedLevel)
+ if group:GetGroupType() == GROUPTYPE_NORMAL then
+ if completedLevel[1 + ebs.Config.IgnoreLowestPartyAmount] then
+ return completedLevel[1 + ebs.Config.IgnoreLowestPartyAmount]
+ else
+ return completedLevel[completedLevel.maxn()]
+ end
+ elseif group:GetGroupType() == GROUPTYPE_RAID then
+ if completedLevel[1 + ebs.Config.IgnoreLowestRaidAmount] then
+ return completedLevel[1 + ebs.Config.IgnoreLowestRaidAmount]
+ else
+ return completedLevel[completedLevel.maxn()]
+ end
+ end
+ PrintError("eventBosses.lua: getLowestGroupLevel() failed.")
+end
+
+function ebs.summonEventNPC()
+ -- tempSummon an NPC with a dialogue option to start the encounter, store the guid for later unsummon
+ local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventInProgress].npc)
+ local spawnedNPC = PerformIngameSpawn(spawnType, entry, mapId, 0, x, y, z, o, false, despawnTime)
+ ebs.spawnedGossipNpcGuid = spawnedNPC:GetGUID()
+ RegisterCreatureGossipEvent(ebs.encounter[eventInProgress].npc[2], GOSSIP_EVENT_ON_HELLO, ebs.onHello)
+ RegisterCreatureGossipEvent(ebs.encounter[eventInProgress].npc[2], GOSSIP_EVENT_ON_SELECT, ebs.chromieGossip)
+end
+
+function ebs.command(event, player, command, chatHandler)
+ local commandArray = {}
+ local eventId
+
+ --prevent players from using this
+ if not chatHandler:IsAvailable(ebs.Config.GMRankForEventStart) then
+ return
+ end
+
+ -- split the command variable into several strings which can be compared individually
+ commandArray = ebs.splitString(command)
+
+ for k, v in pairs(commandArray) do
+ commandArray[k] = string.lower(commandArray[k]:gsub("[';\\, ]", ""))
+ end
+
+ if commandArray[1] == "startevent" then
+ eventId = tonumber(commandArray[2])
+ if not eventId then
+ chatHandler:SendSysMessage("Missing event id. Expected syntax: 'startevent $eventId'")
+ return false
+ end
+ if ebs.encounter[eventId] then
+ local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventId].npc)
+ else
+ chatHandler:SendSysMessage("Event "..eventId.." is not properly configured. Aborting")
+ return false
+ end
+
+ if eventInProgress == nil then
+ eventInProgress = eventId
+ ebs.summonEventNPC()
+ ebs.loadRecords()
+ chatHandler:SendSysMessage("Starting event "..eventInProgress..".")
+ return false
+ else
+ chatHandler:SendSysMessage("Event "..eventInProgress.." is already active.")
+ return false
+ end
+ elseif commandArray[1] == "stopevent" then
+ if eventInProgress == nil then
+ chatHandler:SendSysMessage("There is no event in progress.")
+ return false
+ end
+ chatHandler:SendSysMessage("Stopping event "..eventInProgress..".")
+ local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventInProgress].npc)
+ ClearCreatureGossipEvents(entry)
+ local map = GetMapById(mapId)
+ local spawnedNPC = map:GetWorldObject(ebs.spawnedGossipNpcGuid):ToCreature()
+ if spawnedNPC then
+ spawnedNPC:DespawnOrUnsummon(0)
+ end
+ eventInProgress = nil
+ return false
+ end
+
+ --prevent non-Admins from using the rest
+ if not chatHandler:IsAvailable(ebs.Config.GMRankForUpdateDB) then
+ return
+ end
+
+ --nothing here yet
+ return
+end
+
+function ebs.returnPlayers(slotId)
+ local player
+ local playerListString
+ for _, v in pairs(ebs.playersInGroup[slotId]) do
+ player = GetPlayerByGUID(v)
+ if player then
+ player:SetPhaseMask(1)
+ if playerListString == nil then
+ playerListString = player:GetName()
+ else
+ playerListString = playerListString..", "..player:GetName()
+ end
+ if player:GetCorpse() then
+ player:GetCorpse():SetPhaseMask(1)
+ end
+ end
+ end
+ return playerListString
+end
+
+function ebs.finishPlayers(slotId)
+ for _, v in pairs(ebs.playersInGroup[slotId]) do
+ local player
+ local accountId
+ player = GetPlayerByGUID(v)
+ accountId = player:GetAccountId()
+ local difficulty = ebs.phaseIdDifficulty[slotId]
+ if not ebs.clearedDifficulty[accountId] then
+ ebs.clearedDifficulty[accountId] = {}
+ end
+ if not ebs.clearedDifficulty[accountId][ebs.fightType[slotId]]
+ or ebs.clearedDifficulty[accountId][ebs.fightType[slotId]] < difficulty then
+ ebs.clearedDifficulty[accountId][ebs.fightType[slotId]] = difficulty
+ ebs.saveProgress(accountId, ebs.fightType[slotId], difficulty)
+ end
+ if player then
+ player:RegisterEvent(ebs.castFireworks, 1000, 20)
+ end
+ end
+end
+
+function ebs.bossReset(event, creature)
+ local hasValue, slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
+
+ if slotId == 0 then
+ PrintError("eventBosses.lua: A boss rest without a valid slotId.")
+ return
+ end
+
+ ebs.spawnedBossGuid[slotId] = nil
+
+ local playerListString = ebs.returnPlayers(slotId)
+ if creature:IsDead() == true then
+ ebs.finishPlayers(slotId)
+ ebs.awardScore(slotId)
+ SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
+ " in " .. ebs.getEncounterDuration(slotId).." by: "..playerListString..". Congratulations!")
+ end
+
+ ebs.playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
+ creature:DespawnOrUnsummon(0)
+end
+
+function ebs.addReset(event, creature)
+ local hasValue, slotId = ebs.returnKey (ebs.spawnedBossGuid, creature:GetGUIDLow())
+
+ if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
+ creature:DespawnOrUnsummon(0)
+ return
+ end
+ -- Only do this check if it's a party-encounter. For the raid-encounter the add's GUID won't be used.
+ if slotId == 0 then
+ PrintError("eventBosses.lua: An add reset without a valid slotId.")
+ return
+ end
+
+ ebs.spawnedBossGuid[slotId] = nil
+
+ local playerListString = ebs.returnPlayers(slotId)
+ if creature:IsDead() == true then
+ ebs.finishPlayers(slotId)
+ ebs.awardScore(slotId)
+ SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
+ " in " ..ebs.getEncounterDuration(slotId).." by: "..playerListString..". Congratulations!")
+ end
+
+ ebs.playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
+ creature:DespawnOrUnsummon(0)
+end
+
+function ebs.saveProgress(accountId, encounterType, difficulty)
+ CharDBExecute('REPLACE INTO `'..ebs.Config.customDbName..'`.`eventscript_difficulty` VALUES ('..accountId..', '..eventInProgress..', '..encounterType..', '..difficulty..');')
+end
+
+function ebs.loadRecords()
+ ebs.clearedDifficulty = {}
+ local query = CharDBQuery('SELECT * FROM `'..ebs.Config.customDbName..'`.`eventscript_difficulty` WHERE `encounter_id` = '..eventInProgress..';')
+ if query then
+ local accountId
+ local fightType
+ repeat
+ accountId = query:GetUInt32(0)
+ fightType = query:GetUInt32(2)
+ if not ebs.clearedDifficulty[accountId] then
+ ebs.clearedDifficulty[accountId] = {}
+ end
+ ebs.clearedDifficulty[accountId][fightType] = query:GetUInt32(3)
+ until not query:NextRow()
+ end
+end
+
+function ebs.closeLua(_)
+ if ebs.Config.rewardRaid == 1 then
+ ebs.RemoveRaidAuras()
+ end
+
+ if ebs.Config.rewardParty == 1 then
+ ebs.RemovePartyAuras()
+ end
+
+ if eventInProgress then
+ local npcObject
+ local mapId
+ mapId = ebs.encounter[eventInProgress].npc[3]
+ if not mapId then
+ PrintError("eventBosses.lua: No mapId found for the event ".. eventInProgress ..".")
+ return
+ end
+ local map = GetMapById(mapId)
+ npcObject = map:GetWorldObject(ebs.spawnedGossipNpcGuid):ToCreature()
+ if not npcObject then
+ PrintError("eventBosses.lua: No valid npcObject found for the event ".. eventInProgress ..".")
+ return
+ end
+ npcObject:DespawnOrUnsummon(0)
+ end
+end
+
+--on ReloadEluna / Startup
+local query = CharDBQuery('SELECT * FROM `'..ebs.Config.customDbName..'`.`eventscript_score`;')
+if query then
+ local account
+ repeat
+ account = query:GetUInt32(0)
+ scoreEarned[account] = query:GetUInt32(1)
+ scoreTotal[account] = query:GetUInt32(2)
+ until not query:NextRow()
+end
+
+math.randomseed(os.time())
+
+RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, ebs.command)
+RegisterPlayerEvent(PLAYER_EVENT_ON_REPOP, ebs.resetPlayers)
+RegisterPlayerEvent(PLAYER_EVENT_ON_LOGOUT, ebs.resetPlayers)
+
+RegisterServerEvent(ELUNA_EVENT_ON_LUA_STATE_CLOSE, ebs.closeLua, 0)
diff --git a/hideAndSeek.lua b/scripts/hide_and_seek/hideAndSeek.lua
similarity index 100%
rename from hideAndSeek.lua
rename to scripts/hide_and_seek/hideAndSeek.lua
diff --git a/hideAndSeekConf.lua.dist b/scripts/hide_and_seek/hideAndSeekConf.lua.dist
similarity index 100%
rename from hideAndSeekConf.lua.dist
rename to scripts/hide_and_seek/hideAndSeekConf.lua.dist
diff --git a/funTools.lua b/scripts/pvp/pvp_events.lua
similarity index 100%
rename from funTools.lua
rename to scripts/pvp/pvp_events.lua
diff --git a/scripts/query-points.sql b/scripts/query-points.sql
deleted file mode 100644
index f4ce7be..0000000
--- a/scripts/query-points.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--- compatible with acore-cms and mycred plugin
-SELECT CONCAT(
- 'UPDATE wp_usermeta SET meta_value = CAST(`meta_value` AS UNSIGNED) + ',
- `ac_eluna`.`eventscript_score`.`score_earned_current`,
- ' WHERE meta_key = "mycred_default" AND user_id = (SELECT ID FROM wp_users WHERE user_login = "',
- (SELECT username FROM acore_auth.account WHERE id=account_id), '");') AS `query` FROM ac_eluna.eventscript_score WHERE `ac_eluna`.`eventscript_score`.`score_earned_current` > 0;
-
--- run this ONLY if you already distributed the points
-UPDATE ac_eluna.eventscript_score SET `score_earned_current` = 0;
-
--- create chromie points row for all users
-INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`)
- SELECT u.`ID`, 'mycred_default', 0
- FROM `wp_users` u
- WHERE u.`ID` NOT IN (SELECT `user_id` FROM `wp_usermeta` WHERE meta_key = 'mycred_default'); -- you can add a filter per IDs here