From b9c61e5c663d69ce0bfb2a676f934a99701e4924 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Wed, 7 Feb 2024 22:04:25 +0100
Subject: [PATCH 01/27] modular rewrite initial push
---
customWorldboss.lua => customWorldboss.txt | 75 ++-
eventBoss1.lua | 140 +++++
eventBosses.lua | 658 +++++++++++++++++++++
3 files changed, 835 insertions(+), 38 deletions(-)
rename customWorldboss.lua => customWorldboss.txt (97%)
create mode 100644 eventBoss1.lua
create mode 100644 eventBosses.lua
diff --git a/customWorldboss.lua b/customWorldboss.txt
similarity index 97%
rename from customWorldboss.lua
rename to customWorldboss.txt
index 988764a..c93d42b 100644
--- a/customWorldboss.lua
+++ b/customWorldboss.txt
@@ -773,9 +773,8 @@ local RAID_IN_PROGRESS = 2
local ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16
--local variables
-local cancelGossipEvent
local eventInProgress
-local bossfightInProgress
+local fightType
local difficulty -- difficulty is set when using .startevent and it is meant for a range of 1-10
local addsDownCounter
local phase
@@ -949,7 +948,7 @@ end
local function eS_onHello(event, player, creature)
if player == nil then return end
- if bossfightInProgress ~= nil then
+ if fightType ~= 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)
@@ -964,7 +963,7 @@ end
local function eS_onPartyOnlyHello(event, player, creature)
if player == nil then return end
- if bossfightInProgress ~= nil then
+ if fightType ~= 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)
@@ -997,10 +996,10 @@ local function awardScore()
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)..');');
+ CharDBExecute('INSERT IGNORE INTO `'..Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..difficulty..', '..fightType..', '..GetTimeDiff(encounterStartTime)..');');
end
end
- bossfightInProgress = nil
+ fightType = nil
end
local function storeEncounter()
@@ -1009,10 +1008,10 @@ local function storeEncounter()
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)..');');
+ CharDBExecute('INSERT IGNORE INTO `'..Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..difficulty..', '..fightType..', '..GetTimeDiff(encounterStartTime)..');');
end
end
- bossfightInProgress = nil
+ fightType = nil
end
local function eS_chromieGossip(event, player, object, sender, intid, code, menu_id)
@@ -1031,7 +1030,7 @@ local function eS_chromieGossip(event, player, object, sender, intid, code, menu
player:GossipComplete()
elseif intid == 1 then
- if bossfightInProgress ~= nil then
+ if fightType ~= nil then
player:SendBroadcastMessage("There is already a fight in progress.")
player:GossipComplete()
return
@@ -1062,7 +1061,7 @@ local function eS_chromieGossip(event, player, object, sender, intid, code, menu
end
end
--start 5man encounter
- bossfightInProgress = PARTY_IN_PROGRESS
+ fightType = 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))
@@ -1090,7 +1089,7 @@ local function eS_chromieGossip(event, player, object, sender, intid, code, menu
elseif intid == 2 then
- if bossfightInProgress ~= nil then
+ if fightType ~= nil then
player:SendBroadcastMessage("There is already a fight in progress.")
player:GossipComplete()
return
@@ -1124,7 +1123,7 @@ local function eS_chromieGossip(event, player, object, sender, intid, code, menu
end
--start raid encounter
- bossfightInProgress = RAID_IN_PROGRESS
+ fightType = RAID_IN_PROGRESS
spawnedBoss = player:SpawnCreature(Config_bossEntry[eventInProgress], x, y, z+2, o)
spawnedBoss:SetPhaseMask(2)
@@ -1224,7 +1223,7 @@ local function eS_chromiePartyOnlyGossip(event, player, object, sender, intid, c
else
difficulty = partyEvent[accountId]
partyEvent[accountId] = intid - 100
- if bossfightInProgress ~= nil then
+ if fightType ~= nil then
player:SendBroadcastMessage("There is already a fight in progress.")
player:GossipComplete()
return
@@ -1261,7 +1260,7 @@ local function eS_chromiePartyOnlyGossip(event, player, object, sender, intid, c
local o = player:GetO()
--start 5man encounter
- bossfightInProgress = PARTY_IN_PROGRESS
+ fightType = 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))
@@ -1433,7 +1432,7 @@ function bossNPC.reset(event, creature)
elseif Config.storeRaid == 1 then
storeEncounter()
else
- bossfightInProgress = nil
+ fightType = nil
end
SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty "..difficulty.." in "..eS_getEncounterDuration().." by: "..playerListString..". Congratulations!")
CreateLuaEvent(eS_castFireworks, 1000, 20)
@@ -1451,7 +1450,7 @@ function bossNPC.reset(event, creature)
end
end
playersInRaid = {}
- bossfightInProgress = nil
+ fightType = nil
end
creature:DespawnOrUnsummon(0)
addsDownCounter = nil
@@ -1461,8 +1460,8 @@ 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
+ if eS_getDifficultyTimer(Config_bossSpellEnrageTimer[eventInProgress]) < GetTimeDiff(encounterStartTime) then
+ if phase == 2 and GetTimeDiff(encounterStartTime) > Config_bossSpellEnrageTimer[eventInProgress] then
phase = 3
creature:SendUnitYell("FEEL MY WRATH!", 0 )
creature:CastSpell(creature, Config_bossSpellEnrage[eventInProgress])
@@ -1472,7 +1471,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
if Config_bossSpellTimer3[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < eS_getTimeSince(lastBossSpell3) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < GetTimeDiff(lastBossSpell3) then
if addsDownCounter < Config_addsAmount[eventInProgress] then
if Config_bossSpellSelf[eventInProgress] ~= nil then
if Config_bossSpellSelfYell[eventInProgress] ~= nil then
@@ -1492,7 +1491,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
if Config_bossSpellTimer1[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer1[eventInProgress]) < eS_getTimeSince(lastBossSpell1) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer1[eventInProgress]) < GetTimeDiff(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])
@@ -1514,7 +1513,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
if Config_bossSpellTimer2[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer2[eventInProgress]) < eS_getTimeSince(lastBossSpell2) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer2[eventInProgress]) < GetTimeDiff(lastBossSpell2) then
if Config_bossSpell2[eventInProgress] ~= nil then
if (math.random(1, 100) <= 50) then
if Config_bossSpell2MaxRange[eventInProgress] == nil then
@@ -1544,7 +1543,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
if Config_bossSpellTimer3[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < eS_getTimeSince(lastBossSpell3) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer3[eventInProgress]) < GetTimeDiff(lastBossSpell3) then
if phase > 1 then
local players = creature:GetPlayersInRange(30)
if #players > 1 then
@@ -1627,7 +1626,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
if Config_bossSpellTimer5[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_bossSpellTimer5[eventInProgress]) < eS_getTimeSince(lastBossSpell5) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer5[eventInProgress]) < GetTimeDiff(lastBossSpell5) then
if phase == 1 then
if Config_bossSpell5[eventInProgress] ~= nil then
if Config_bossSpellModifier5bp0[eventInProgress] ~= nil and Config_bossSpellModifier5bp1[eventInProgress] ~= nil then
@@ -1674,7 +1673,7 @@ function bossNPC.Event(event, delay, pCall, creature)
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_bossSpell8delay[eventInProgress] < GetTimeDiff(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])
@@ -1694,7 +1693,7 @@ function bossNPC.Event(event, delay, pCall, creature)
end
end
- if eS_getDifficultyTimer(Config_bossSpellTimer7[eventInProgress]) < eS_getTimeSince(lastBossSpell7) then
+ if eS_getDifficultyTimer(Config_bossSpellTimer7[eventInProgress]) < GetTimeDiff(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])
@@ -1733,7 +1732,7 @@ function addNPC.onEnterCombat(event, creature, target)
end
addphase = 1
- if bossfightInProgress == PARTY_IN_PROGRESS then
+ if fightType == PARTY_IN_PROGRESS then
lastAddSpell1[1] = encounterStartTime
lastAddSpell2[1] = encounterStartTime
lastAddSpell3[1] = encounterStartTime
@@ -1751,7 +1750,7 @@ 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 fightType == 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
@@ -1780,8 +1779,8 @@ function addNPC.Event(event, delay, pCall, creature)
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
+ if eS_getDifficultyTimer(Config.addEnrageTimer) < GetTimeDiff(encounterStartTime)then
+ if phase == 2 and GetTimeDiff(encounterStartTime) > Config_addSpellEnrage[eventInProgress] then
phase = 3
creature:SendUnitYell("FEEL MY WRATH!", 0 )
creature:CastSpell(creature, Config_addSpellEnrage[eventInProgress])
@@ -1793,7 +1792,7 @@ function addNPC.Event(event, delay, pCall, creature)
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
+ if eS_getDifficultyTimer(Config_addSpellTimer1[eventInProgress]) < randomTimer + GetTimeDiff(lastAddSpell1[n]) then
local random = math.random(0, 2)
local players = creature:GetPlayersInRange(30)
if #players > 1 then
@@ -1833,7 +1832,7 @@ function addNPC.Event(event, delay, pCall, creature)
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 eS_getDifficultyTimer(Config_addSpellTimer2[eventInProgress]) < randomTimer + (GetTimeDiff(lastAddSpell2[n])) then
if Config_addSpell2Sound[eventInProgress] ~= nil then
creature:PlayDirectSound(Config_addSpell2Sound[eventInProgress])
end
@@ -1856,7 +1855,7 @@ function addNPC.Event(event, delay, pCall, creature)
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 eS_getDifficultyTimer(Config_addSpellTimer3[eventInProgress]) < randomTimer + GetTimeDiff(lastAddSpell3[n]) then
if Config_addSpell3Yell[eventInProgress] ~= nil then
creature:SendUnitYell(Config_addSpell3Yell[eventInProgress], 0 )
end
@@ -1878,9 +1877,9 @@ function addNPC.Event(event, delay, pCall, creature)
end
end
- if bossfightInProgress == RAID_IN_PROGRESS then
+ if fightType == 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
+ if eS_getDifficultyTimer(Config_addSpellTimer4[eventInProgress]) < randomTimer + GetTimeDiff(lastAddSpell4[n]) then
local map = creature:GetMap()
if map ~= nil then
if map:GetWorldObject(spawnedBossGuid) ~= nil then
@@ -1897,11 +1896,11 @@ end
function addNPC.reset(event, creature)
local player
- if bossfightInProgress == PARTY_IN_PROGRESS then
+ if fightType == PARTY_IN_PROGRESS then
eS_checkInCombat()
end
creature:RemoveEvents()
- if bossfightInProgress == PARTY_IN_PROGRESS then
+ if fightType == PARTY_IN_PROGRESS then
if creature:IsDead() == true then
local playerListString
CreateLuaEvent(eS_castFireworks, 1000, 20)
@@ -1925,7 +1924,7 @@ function addNPC.reset(event, creature)
elseif Config.storeParty == 1 then
storeEncounter()
else
- bossfightInProgress = nil
+ fightType = nil
end
SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty "..difficulty.." in "..eS_getEncounterDuration().." by: "..playerListString..". Congratulations!")
playersForFireworks = playersInRaid
@@ -1942,7 +1941,7 @@ function addNPC.reset(event, creature)
end
end
playersInRaid = {}
- bossfightInProgress = nil
+ fightType = nil
end
else
if creature:IsDead() == true then
diff --git a/eventBoss1.lua b/eventBoss1.lua
new file mode 100644
index 0000000..b3c63d6
--- /dev/null
+++ b/eventBoss1.lua
@@ -0,0 +1,140 @@
+--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. --
+-- The encounterId must be unique for each encounter. --
+--------------------------------------------------------------------------------------
+
+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
+}
+
+--------------------------------------------------------------------------------------
+
+local addDownCounter = 0
+
+function bossNPC.Fire( eventid, delay, repeats, creature )
+ local target = creature:GetAITarget( SELECT_TARGET_RANDOM, true, nil, -20 )
+ if target then
+ creature:CastSpell( target, 31340, false )
+ end
+end
+
+function bossNPC.PullIn( eventid, delay, repeats, creature )
+ local target = creature:GetAITarget( SELECT_TARGET_FARTHEST, true, nil, -20 )
+end
+
+function bossNPC.Pool( eventid, delay, repeats, creature )
+ if math.random(1,2) == 1 then
+ creature:CastSpell( creature, 32014, false )
+ else
+ creature:CastSpell( creature:GetVictim(), 53721, false )
+ end
+end
+
+function bossNPC.onEnterCombat( event, creature, target )
+ creature:CallAssistance()
+ creature:CallForHelp( 200 )
+ -- add custom scripting below
+ creature:RegisterEvent( bossNPC.Fire, 10000, 0 )
+end
+
+function bossNPC.reset( event, creature )
+ creature:RemoveEvents()
+ -- add custom scripting below
+end
+
+function addNPC.RemoveInterrupt( eventid, delay, repeats, add )
+ add:SetImmuneTo( MECHANIC_INTERRUPT, false )
+end
+
+function addNPC.HealBoss( eventid, delay, repeats, add )
+ local boss = add:GetOwner()
+ 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:CastCustomSpell( boss, 30878, false, nil, 1000000 )
+ add:RegisterEvent( addNPC.RemoveInterrupt, 3000, 1 )
+ end
+ end
+end
+
+function addNPC.Splash( eventid, delay, repeats, add )
+ add:CastSpell( add, 32014, false )
+end
+
+function addNPC.onEnterCombat( event, creature, target )
+ creature:CallAssistance()
+ creature:CallForHelp( 200 )
+ -- add custom scripting below
+ creature:RegisterEvent(addNPC.HealBoss, {10000, 15000}, 0)
+ creature:RegisterEvent(addNPC.Splash, {20000, 25000}, 0)
+end
+
+function addNPC.reset( event, creature )
+ creature:RemoveEvents()
+ -- add custom scripting below
+ if creature:IsDead() then
+ addDownCounter = addDownCounter + 1
+ if addDownCounter == ebs.encounter[ encounterId ].addAmount then
+ local boss = creature:GetOwner()
+ if boss then
+ boss:SendUnitYell( "You will pay for your actions!", 0 )
+ boss:RegisterEvent( bossNPC.PullIn, { 4000, 6000 }, 0 )
+ boss:RegisterEvent( bossNPC.Pool, { 10000, 12000}, 0 )
+ end
+ end
+ end
+
+end
+
+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/eventBosses.lua b/eventBosses.lua
new file mode 100644
index 0000000..c09c535
--- /dev/null
+++ b/eventBosses.lua
@@ -0,0 +1,658 @@
+--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,
+ ["printErrorsToConsole"] = 1,
+ ["addEnrageTimer"] = 300000,
+ ["baseScore"] = 40,
+ ["additionalScore"] = 10,
+ ["rewardRaid"] = 1,
+ ["storeRaid"] = 1,
+ ["rewardParty"] = 0,
+ ["storeParty"] = 1
+}
+
+------------------------------------------
+-- 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
+
+--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, chatHandler) - 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 ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16
+local ELUNA_EVENT_ON_LUA_STATE_OPEN = 33
+
+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
+
+local PARTY_IN_PROGRESS = 1
+local RAID_IN_PROGRESS = 2
+local eventInProgress
+local encounterStartTime = {}
+
+local 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 = {}
+
+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 index
+ end
+ end
+ return 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(_, _, _, worldobject)
+ if worldobject and worldobject: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(playersInGroup) do
+ if ebs.has_value(playersInGroup[v], player:GetGUID()) and player:GetPhaseMask() ~= 1 then
+ return true
+ end
+ end
+ return false
+end
+
+function ebs.resetPlayers(_, 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) / 4
+ end
+ return value
+end
+
+function ebs.checkInCombat(encounterId)
+ --check if all players are in combat
+ local player
+ for _, v in pairs(playersInGroup[encounterId]) 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(encounterId)
+ local dt = GetTimeDiff(encounterStartTime(encounterId))
+ return string.format("%.2d:%.2d", (dt / 1000 / 60) % 60, (dt / 1000) % 60)
+end
+
+function ebs.getFreeSlot()
+ for k, v in ipairs(ebs.phaseIdDifficulty) do
+ if v == nil then
+ return k
+ end
+ end
+ return 1
+end
+
+function ebs.getLastSuccessfulDifficulty(playerGUID)
+ if ebs.clearedDifficulty[playerGUID] then
+ return ebs.clearedDifficulty[playerGUID]
+ else
+ return 0
+ end
+end
+
+function ebs.awardScore(encounterId)
+ local score = ebs.Config.baseScore + (ebs.Config.additionalScore * ebs.phaseIdDifficulty[encounterId])
+ for _, playerGuid in pairs(playersInGroup[encounterId]) 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 `'..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[encounterId]..', '..ebs.fightType[encounterId]..', '..GetTimeDiff(encounterStartTime[encounterId])..');');
+ end
+ end
+end
+
+function ebs.storeEncounter(encounterId)
+ for _, playerGuid in pairs(playersInGroup[encounterId]) do
+ if GetPlayerByGUID(playerGuid) ~= nil 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[encounterId]..', '..ebs.fightType[encounterId]..', '..GetTimeDiff(encounterStartTime[encounterId])..');');
+ end
+ end
+end
+
+function ebs.onHello(_, player, creature)
+ if player == nil 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
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant!", ebs.encounter[eventInProgress].npc[2], 1)
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. ebs.getLastSuccessfulDifficulty(player:GetGUID(), RAID_IN_PROGRESS) + 1 .. ")", ebs.encounter[eventInProgress].npc[2], 2)
+ 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 slot = ebs.getFreeSlot()
+ 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
+
+ if intid == 1 or intid == 2 then
+ if slot == 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
+
+ if intid == 1 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
+
+ --start 5man encounter
+ ebs.fightType[slot] = PARTY_IN_PROGRESS
+ ebs.phaseIdDifficulty[slot] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType)
+
+ spawnedCreature[1]= player:SpawnCreature(ebs.encounter[eventInProgress].addEntry, x, y, z, o)
+ spawnedCreature[1]:SetPhaseMask(ebs.Config.eventPhase[slot])
+ spawnedCreature[1]:SetScale(spawnedCreature[1]:GetScale() * ebs.getSize(slot))
+ ebs.spawnedBossGuid[slot] = spawnedCreature[1]
+
+ 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)
+
+ encounterStartTime[slot] = GetCurrTime()
+
+ for n, v in pairs(groupPlayers) do
+ if v:GetDistance(player) ~= nil then
+ if v:GetDistance(player) < 80 then
+ v:SetPhaseMask(ebs.Config.eventPhase[slot])
+ playersInGroup[slot][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
+
+ if intid == 2 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()
+
+ --start raid encounter
+ ebs.fightType[slot] = RAID_IN_PROGRESS
+ ebs.phaseIdDifficulty[slot] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType[slot])
+
+ spawnedBoss = object:SpawnCreature(ebs.encounter[eventInProgress].bossEntry, x, y, z+2, o)
+ spawnedBoss:SetPhaseMask(ebs.Config.eventPhase[slot])
+ spawnedBoss:SetScale(spawnedBoss:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slot]))
+ ebs.spawnedBossGuid[slot] = spawnedBoss:GetGUID()
+
+ if ebs.encounter[encounterId].addAmount > 0 then
+ for c = 1, ebs.encounter[encounterId].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[slot].addEntry, x + randomX, y + randomY, z+2, o)
+ spawnedCreature[c]:SetPhaseMask(ebs.Config.eventPhase[slot])
+ spawnedCreature[c]:SetScale(spawnedCreature[c]:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slot]))
+ end
+ end
+
+ encounterStartTime[slot] = GetCurrTime()
+
+ for n, v in pairs(groupPlayers) do
+ if v:GetDistance(player) ~= nil then
+ if v:GetDistance(player) < 80 then
+ v:SetPhaseMask(ebs.Config.eventPhase[slot])
+ playersInGroup[slot][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
+ end
+ else
+ v:SendBroadcastMessage("You were too far away to join the fight.")
+ end
+ end
+ end
+ player:GossipComplete()
+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()
+ 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(slot)
+ local player
+ local playerListString
+ for _, v in pairs(playersInGroup[slot]) do
+ player = GetPlayerByGUID(v)
+ if player then
+ player:SetPhaseMask(1)
+ if player:GetCorpse() then
+ player:GetCorpse():SetPhaseMask(1)
+ if playerListString == nil then
+ playerListString = player:GetName()
+ else
+ playerListString = playerListString..", "..player:GetName()
+ end
+ end
+ end
+ end
+ return playerListString
+end
+
+function ebs.finishPlayers(slot)
+ local player
+ for _, v in pairs(playersInGroup[slot]) do
+ player = GetPlayerByGUID(v)
+ if player then
+ player:RegisterEvent(ebs.castFireworks, 1000, 20)
+ if not ebs.clearedDifficulty[GetGUIDLow(v)] or ebs.clearedDifficulty[GetGUIDLow(v)] < ebs.phaseIdDifficulty[slot] then
+ ebs.clearedDifficulty[GetGUIDLow(v)] = ebs.phaseIdDifficulty[slot]
+ end
+ end
+ end
+end
+
+function ebs.bossReset(event, creature)
+ local slot = 0
+ if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
+ slot = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ end
+
+ if slot == 0 then
+ PrintError("eventBosses.lua: A Boss encounter ended without a valid slot Id.")
+ return
+ end
+ ebs.spawnedBossGuid[slot] = nil
+
+ if creature:IsDead() == true then
+ local playerListString = ebs.returnPlayers(slot)
+ if Config.rewardRaid == 1 then
+ ebs.awardScore(slot)
+ elseif Config.storeRaid == 1 then
+ ebs.storeEncounter(slot)
+ end
+ SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slot] ..
+ " in " .. ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
+ ebs.finnishPlayers(slot)
+ playersInGroup[slot] = {}
+ else
+ ebs.returnPlayers(slot)
+ playersInGroup[slot] = {}
+ ebs.fightType[slot] = nil
+ end
+ creature:DespawnOrUnsummon(0)
+end
+
+function ebs.addReset(event, creature)
+ local slot = 0
+ if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
+ slot = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ end
+ if ebs.fightType[slot] ~= PARTY_IN_PROGRESS then
+ return
+ end
+
+ if slot == 0 then
+ PrintError("eventBosses.lua: A Boss encounter ended without a valid slot Id.")
+ return
+ end
+
+ ebs.spawnedBossGuid[slot] = nil
+
+ if creature:IsDead() == true then
+ local playerListString = ebs.returnPlayers(slot)
+ if ebs.Config.rewardParty == 1 then
+ awardScore(slot)
+ elseif ebs.Config.storeParty == 1 then
+ storeEncounter(slot)
+ end
+ SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slot] ..
+ " in " ..ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
+ ebs.finnishPlayers(slot)
+ playersInGroup[slot] = {}
+ ebs.fightType[slot] = nil
+ end
+ creature:DespawnOrUnsummon(0)
+end
+
+function ebs.initBossEvents()
+ for k,v in pairs(ebs.encounter) do
+ RegisterCreatureEvent(v.bossEntry, 2, ebs.bossReset) -- OnLeaveCombat
+ RegisterCreatureEvent(v.bossEntry, 4, ebs.bossReset) -- OnDied
+ end
+end
+
+function ebs.initAddEvents()
+ for k,v in pairs(ebs.encounter) do
+ RegisterCreatureEvent(v.addEntry, 2, ebs.addReset) -- OnLeaveCombat
+ RegisterCreatureEvent(v.addEntry, 4, ebs.addReset) -- OnDied
+ end
+end
+
+function ebs.init(_)
+ ebs.initBossEvents()
+ ebs.initAddEvents()
+end
+
+function ebs.closeLua(_)
+ 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
+
+math.randomseed(os.time())
+
+--on ReloadEluna / Startup
+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)
+--wait until all other scripts are loaded until creating events
+RegisterServerEvent(ELUNA_EVENT_ON_LUA_STATE_OPEN, ebs.init, 0)
From 37fbacaad7fe90847981379ae762af251438731a Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 8 Feb 2024 14:23:29 +0100
Subject: [PATCH 02/27] debugging
---
eventBoss1.lua | 34 +++++++---
eventBosses.lua | 165 +++++++++++++++++++++---------------------------
2 files changed, 98 insertions(+), 101 deletions(-)
diff --git a/eventBoss1.lua b/eventBoss1.lua
index b3c63d6..2b5bd5b 100644
--- a/eventBoss1.lua
+++ b/eventBoss1.lua
@@ -36,7 +36,7 @@ local addNPC = {}
--------------------------------------------------------------------------------------
local encounterId = 1
-
+print('register 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
@@ -49,7 +49,7 @@ ebs.encounter[encounterId] = {
--------------------------------------------------------------------------------------
-local addDownCounter = 0
+local addDownCounter = {}
function bossNPC.Fire( eventid, delay, repeats, creature )
local target = creature:GetAITarget( SELECT_TARGET_RANDOM, true, nil, -20 )
@@ -60,6 +60,7 @@ end
function bossNPC.PullIn( eventid, delay, repeats, creature )
local target = creature:GetAITarget( SELECT_TARGET_FARTHEST, true, nil, -20 )
+ creature:CastSpell( target, 60105, false )
end
function bossNPC.Pool( eventid, delay, repeats, creature )
@@ -80,6 +81,9 @@ end
function bossNPC.reset( event, creature )
creature:RemoveEvents()
-- add custom scripting below
+
+ -- add custom scripting above
+ ebs.bossReset(event, creature)
end
function addNPC.RemoveInterrupt( eventid, delay, repeats, add )
@@ -103,23 +107,36 @@ function addNPC.HealBoss( eventid, delay, repeats, add )
end
function addNPC.Splash( eventid, delay, repeats, add )
- add:CastSpell( add, 32014, false )
+ add:CastSpell( add:GetVictim(), 32014, false )
+ print('addNPC.Splash')
end
function addNPC.onEnterCombat( event, creature, target )
creature:CallAssistance()
creature:CallForHelp( 200 )
-- add custom scripting below
- creature:RegisterEvent(addNPC.HealBoss, {10000, 15000}, 0)
- creature:RegisterEvent(addNPC.Splash, {20000, 25000}, 0)
+ print('addNPC.onEnterCombat')
+ creature:RegisterEvent( addNPC.HealBoss, { 10000, 15000 }, 0 )
+ creature:RegisterEvent( addNPC.Splash, { 10000, 15000 }, 0 )
+ creature:RegisterEvent( bossNPC.PullIn, { 10000, 15000 }, 0 )
end
function addNPC.reset( event, creature )
creature:RemoveEvents()
-- add custom scripting below
if creature:IsDead() then
- addDownCounter = addDownCounter + 1
- if addDownCounter == ebs.encounter[ encounterId ].addAmount then
+ if ebs.has_value( ebs.spawnedBossGuid, creature:GetGUID() ) then
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ end
+ if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
+ return
+ end
+
+ if not addDownCounter[ slotId ] then
+ addDownCounter[ slotId ] = 0
+ end
+ addDownCounter[ slotId ] = addDownCounter[ slotId ] + 1
+ if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
local boss = creature:GetOwner()
if boss then
boss:SendUnitYell( "You will pay for your actions!", 0 )
@@ -128,7 +145,8 @@ function addNPC.reset( event, creature )
end
end
end
-
+ -- add custom scripting above
+ ebs.addReset( event, creature )
end
RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 1, bossNPC.onEnterCombat )
diff --git a/eventBosses.lua b/eventBosses.lua
index c09c535..12b501b 100644
--- a/eventBosses.lua
+++ b/eventBosses.lua
@@ -199,7 +199,7 @@ function ebs.isParticipating(player)
return false
end
for _,v in pairs(playersInGroup) do
- if ebs.has_value(playersInGroup[v], player:GetGUID()) and player:GetPhaseMask() ~= 1 then
+ if ebs.has_value(v, player:GetGUID()) and player:GetPhaseMask() ~= 1 then
return true
end
end
@@ -224,10 +224,10 @@ function ebs.getSize(difficulty)
return value
end
-function ebs.checkInCombat(encounterId)
+function ebs.checkInCombat(slotId)
--check if all players are in combat
local player
- for _, v in pairs(playersInGroup[encounterId]) do
+ for _, v in pairs(playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
if player ~= nil then
if player:IsInCombat() == false and player:GetPhaseMask() == 2 then
@@ -241,8 +241,8 @@ function ebs.checkInCombat(encounterId)
end
end
-function ebs.getEncounterDuration(encounterId)
- local dt = GetTimeDiff(encounterStartTime(encounterId))
+function ebs.getEncounterDuration(slotId)
+ local dt = GetTimeDiff(encounterStartTime(slotId))
return string.format("%.2d:%.2d", (dt / 1000 / 60) % 60, (dt / 1000) % 60)
end
@@ -263,9 +263,9 @@ function ebs.getLastSuccessfulDifficulty(playerGUID)
end
end
-function ebs.awardScore(encounterId)
- local score = ebs.Config.baseScore + (ebs.Config.additionalScore * ebs.phaseIdDifficulty[encounterId])
- for _, playerGuid in pairs(playersInGroup[encounterId]) do
+function ebs.awardScore(slotId)
+ local score = ebs.Config.baseScore + (ebs.Config.additionalScore * ebs.phaseIdDifficulty[slotId])
+ for _, playerGuid in pairs(playersInGroup[slotId]) do
if GetPlayerByGUID(playerGuid) ~= nil then
local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
@@ -275,18 +275,18 @@ function ebs.awardScore(encounterId)
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[encounterId]..', '..ebs.fightType[encounterId]..', '..GetTimeDiff(encounterStartTime[encounterId])..');');
+ CharDBExecute('INSERT IGNORE INTO `'..ebs.Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..ebs.phaseIdDifficulty[slotId]..', '..ebs.fightType[slotId]..', '..GetTimeDiff(encounterStartTime[slotId])..');');
end
end
end
-function ebs.storeEncounter(encounterId)
- for _, playerGuid in pairs(playersInGroup[encounterId]) do
+function ebs.storeEncounter(slotId)
+ for _, playerGuid in pairs(playersInGroup[slotId]) do
if GetPlayerByGUID(playerGuid) ~= nil 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[encounterId]..', '..ebs.fightType[encounterId]..', '..GetTimeDiff(encounterStartTime[encounterId])..');');
+ CharDBExecute('INSERT IGNORE INTO `'..ebs.Config.customDbName..'`.`eventscript_encounters` VALUES ('..gameTime..', '..playerLowGuid..', '..eventInProgress..', '..ebs.phaseIdDifficulty[slotId]..', '..ebs.fightType[slotId]..', '..GetTimeDiff(encounterStartTime[slotId])..');');
end
end
end
@@ -311,7 +311,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
if player == nil then return end
local group = player:GetGroup()
- local slot = ebs.getFreeSlot()
+ local slotId = ebs.getFreeSlot()
if intid == 0 then
local accountId = player:GetAccountId()
if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
@@ -323,7 +323,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
end
if intid == 1 or intid == 2 then
- if slot == nil 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()
@@ -345,6 +345,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
end
end
+ local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventInProgress].npc)
if intid == 1 then
if group:IsRaidGroup() == true then
--todo: change broadcast message to whisper
@@ -352,28 +353,28 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
player:GossipComplete()
return
end
+ groupPlayers = group:GetMembers()
--start 5man encounter
- ebs.fightType[slot] = PARTY_IN_PROGRESS
- ebs.phaseIdDifficulty[slot] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType)
-
- spawnedCreature[1]= player:SpawnCreature(ebs.encounter[eventInProgress].addEntry, x, y, z, o)
- spawnedCreature[1]:SetPhaseMask(ebs.Config.eventPhase[slot])
- spawnedCreature[1]:SetScale(spawnedCreature[1]:GetScale() * ebs.getSize(slot))
- ebs.spawnedBossGuid[slot] = spawnedCreature[1]
+ ebs.fightType[slotId] = PARTY_IN_PROGRESS
+ ebs.phaseIdDifficulty[slotId] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType)
+ 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]
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)
- encounterStartTime[slot] = GetCurrTime()
+ encounterStartTime[slotId] = GetCurrTime()
for n, v in pairs(groupPlayers) do
if v:GetDistance(player) ~= nil then
if v:GetDistance(player) < 80 then
- v:SetPhaseMask(ebs.Config.eventPhase[slot])
- playersInGroup[slot][n] = v:GetGUID()
+ v:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ playersInGroup[slotId][n] = v:GetGUID()
spawnedCreature[1]:SetInCombatWith(v)
v:SetInCombatWith(spawnedCreature[1])
spawnedCreature[1]:AddThreat(v, 1)
@@ -391,35 +392,34 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
player:GossipComplete()
return
end
-
groupPlayers = group:GetMembers()
--start raid encounter
- ebs.fightType[slot] = RAID_IN_PROGRESS
- ebs.phaseIdDifficulty[slot] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType[slot])
+ ebs.fightType[slotId] = RAID_IN_PROGRESS
+ ebs.phaseIdDifficulty[slotId] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType[slotId])
- spawnedBoss = object:SpawnCreature(ebs.encounter[eventInProgress].bossEntry, x, y, z+2, o)
- spawnedBoss:SetPhaseMask(ebs.Config.eventPhase[slot])
- spawnedBoss:SetScale(spawnedBoss:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slot]))
- ebs.spawnedBossGuid[slot] = spawnedBoss:GetGUID()
+ 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:GetGUID()
- if ebs.encounter[encounterId].addAmount > 0 then
- for c = 1, ebs.encounter[encounterId].addAmount do
+ 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[slot].addEntry, x + randomX, y + randomY, z+2, o)
- spawnedCreature[c]:SetPhaseMask(ebs.Config.eventPhase[slot])
- spawnedCreature[c]:SetScale(spawnedCreature[c]:GetScale() * ebs.getSize(ebs.phaseIdDifficulty[slot]))
+ 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]))
end
end
- encounterStartTime[slot] = GetCurrTime()
+ encounterStartTime[slotId] = GetCurrTime()
for n, v in pairs(groupPlayers) do
if v:GetDistance(player) ~= nil then
if v:GetDistance(player) < 80 then
- v:SetPhaseMask(ebs.Config.eventPhase[slot])
- playersInGroup[slot][n] = v:GetGUID()
+ v:SetPhaseMask(ebs.Config.eventPhase[slotId])
+ playersInGroup[slotId][n] = v:GetGUID()
spawnedBoss:SetInCombatWith(v)
v:SetInCombatWith(spawnedBoss)
spawnedBoss:AddThreat(v, 1)
@@ -512,10 +512,10 @@ function ebs.command(event, player, command, chatHandler)
return
end
-function ebs.returnPlayers(slot)
+function ebs.returnPlayers(slotId)
local player
local playerListString
- for _, v in pairs(playersInGroup[slot]) do
+ for _, v in pairs(playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
if player then
player:SetPhaseMask(1)
@@ -532,101 +532,82 @@ function ebs.returnPlayers(slot)
return playerListString
end
-function ebs.finishPlayers(slot)
+function ebs.finishPlayers(slotId)
local player
- for _, v in pairs(playersInGroup[slot]) do
+ for _, v in pairs(playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
if player then
player:RegisterEvent(ebs.castFireworks, 1000, 20)
- if not ebs.clearedDifficulty[GetGUIDLow(v)] or ebs.clearedDifficulty[GetGUIDLow(v)] < ebs.phaseIdDifficulty[slot] then
- ebs.clearedDifficulty[GetGUIDLow(v)] = ebs.phaseIdDifficulty[slot]
+ if not ebs.clearedDifficulty[GetGUIDLow(v)] or ebs.clearedDifficulty[GetGUIDLow(v)] < ebs.phaseIdDifficulty[slotId] then
+ ebs.clearedDifficulty[GetGUIDLow(v)] = ebs.phaseIdDifficulty[slotId]
end
end
end
end
function ebs.bossReset(event, creature)
- local slot = 0
+ local slotId = 0
if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
- slot = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
end
- if slot == 0 then
- PrintError("eventBosses.lua: A Boss encounter ended without a valid slot Id.")
+ if slotId == 0 then
+ PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
return
end
- ebs.spawnedBossGuid[slot] = nil
+ ebs.spawnedBossGuid[slotId] = nil
if creature:IsDead() == true then
- local playerListString = ebs.returnPlayers(slot)
+ local playerListString = ebs.returnPlayers(slotId)
if Config.rewardRaid == 1 then
- ebs.awardScore(slot)
+ ebs.awardScore(slotId)
elseif Config.storeRaid == 1 then
- ebs.storeEncounter(slot)
+ ebs.storeEncounter(slotId)
end
- SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slot] ..
+ SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
" in " .. ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
- ebs.finnishPlayers(slot)
- playersInGroup[slot] = {}
+ ebs.finnishPlayers(slotId)
+ playersInGroup[slotId] = {}
else
- ebs.returnPlayers(slot)
- playersInGroup[slot] = {}
- ebs.fightType[slot] = nil
+ ebs.returnPlayers(slotId)
+ playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
end
creature:DespawnOrUnsummon(0)
end
function ebs.addReset(event, creature)
- local slot = 0
+ local slotId = 0
if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
- slot = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
end
- if ebs.fightType[slot] ~= PARTY_IN_PROGRESS then
+ if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
return
end
- if slot == 0 then
- PrintError("eventBosses.lua: A Boss encounter ended without a valid slot Id.")
+ if slotId == 0 then
+ PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
return
end
- ebs.spawnedBossGuid[slot] = nil
+ ebs.spawnedBossGuid[slotId] = nil
if creature:IsDead() == true then
- local playerListString = ebs.returnPlayers(slot)
+ local playerListString = ebs.returnPlayers(slotId)
if ebs.Config.rewardParty == 1 then
- awardScore(slot)
+ awardScore(slotId)
elseif ebs.Config.storeParty == 1 then
- storeEncounter(slot)
+ storeEncounter(slotId)
end
- SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slot] ..
+ SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
" in " ..ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
- ebs.finnishPlayers(slot)
- playersInGroup[slot] = {}
- ebs.fightType[slot] = nil
+ ebs.finnishPlayers(slotId)
+ playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
end
creature:DespawnOrUnsummon(0)
end
-function ebs.initBossEvents()
- for k,v in pairs(ebs.encounter) do
- RegisterCreatureEvent(v.bossEntry, 2, ebs.bossReset) -- OnLeaveCombat
- RegisterCreatureEvent(v.bossEntry, 4, ebs.bossReset) -- OnDied
- end
-end
-
-function ebs.initAddEvents()
- for k,v in pairs(ebs.encounter) do
- RegisterCreatureEvent(v.addEntry, 2, ebs.addReset) -- OnLeaveCombat
- RegisterCreatureEvent(v.addEntry, 4, ebs.addReset) -- OnDied
- end
-end
-
-function ebs.init(_)
- ebs.initBossEvents()
- ebs.initAddEvents()
-end
-
function ebs.closeLua(_)
if eventInProgress then
local npcObject
@@ -654,5 +635,3 @@ RegisterPlayerEvent(PLAYER_EVENT_ON_REPOP, ebs.resetPlayers)
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGOUT, ebs.resetPlayers)
RegisterServerEvent(ELUNA_EVENT_ON_LUA_STATE_CLOSE, ebs.closeLua, 0)
---wait until all other scripts are loaded until creating events
-RegisterServerEvent(ELUNA_EVENT_ON_LUA_STATE_OPEN, ebs.init, 0)
From 9774660a39227fd677b61702d917117fd3969e31 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 8 Feb 2024 22:40:50 +0100
Subject: [PATCH 03/27] de-bugging
---
eventBoss1.lua | 28 ++++----
eventBosses.lua | 169 +++++++++++++++++++++++++++---------------------
2 files changed, 112 insertions(+), 85 deletions(-)
diff --git a/eventBoss1.lua b/eventBoss1.lua
index 2b5bd5b..6b46317 100644
--- a/eventBoss1.lua
+++ b/eventBoss1.lua
@@ -36,7 +36,7 @@ local addNPC = {}
--------------------------------------------------------------------------------------
local encounterId = 1
-print('register 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
@@ -60,7 +60,7 @@ end
function bossNPC.PullIn( eventid, delay, repeats, creature )
local target = creature:GetAITarget( SELECT_TARGET_FARTHEST, true, nil, -20 )
- creature:CastSpell( target, 60105, false )
+ creature:CastSpell( target, 59395, true )
end
function bossNPC.Pool( eventid, delay, repeats, creature )
@@ -74,8 +74,9 @@ end
function bossNPC.onEnterCombat( event, creature, target )
creature:CallAssistance()
creature:CallForHelp( 200 )
+ local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
- creature:RegisterEvent( bossNPC.Fire, 10000, 0 )
+ creature:RegisterEvent( bossNPC.Fire, GetTimer( 10000, difficulty ), 0 )
end
function bossNPC.reset( event, creature )
@@ -99,36 +100,39 @@ function addNPC.HealBoss( eventid, delay, repeats, add )
else
add:SendUnitYell( "Don't you dare harm the master!", 0 )
end
- add:SetImmuneTo( MECHANIC_INTERRUPT, true )
+ --add:SetImmuneTo( MECHANIC_INTERRUPT, true )
add:CastCustomSpell( boss, 30878, false, nil, 1000000 )
- add:RegisterEvent( addNPC.RemoveInterrupt, 3000, 1 )
+ --add:RegisterEvent( addNPC.RemoveInterrupt, 3000, 1 )
end
end
end
function addNPC.Splash( eventid, delay, repeats, add )
- add:CastSpell( add:GetVictim(), 32014, false )
- print('addNPC.Splash')
+ add:CastCustomSpell( add:GetVictim(), 32014, false, nil, 150 )
end
function addNPC.onEnterCombat( event, creature, target )
creature:CallAssistance()
creature:CallForHelp( 200 )
+ local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
- print('addNPC.onEnterCombat')
creature:RegisterEvent( addNPC.HealBoss, { 10000, 15000 }, 0 )
- creature:RegisterEvent( addNPC.Splash, { 10000, 15000 }, 0 )
- creature:RegisterEvent( bossNPC.PullIn, { 10000, 15000 }, 0 )
+ creature:RegisterEvent( addNPC.Splash, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
+ if difficulty >= 3 or creature:GetData('ebs_mode') == PARTY_IN_PROGRESS then
+ creature:RegisterEvent( bossNPC.PullIn, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
+ end
end
function addNPC.reset( event, creature )
creature:RemoveEvents()
+ local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
if creature:IsDead() then
if ebs.has_value( ebs.spawnedBossGuid, creature:GetGUID() ) then
slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
end
if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
+ ebs.addReset( event, creature )
return
end
@@ -140,8 +144,8 @@ function addNPC.reset( event, creature )
local boss = creature:GetOwner()
if boss then
boss:SendUnitYell( "You will pay for your actions!", 0 )
- boss:RegisterEvent( bossNPC.PullIn, { 4000, 6000 }, 0 )
- boss:RegisterEvent( bossNPC.Pool, { 10000, 12000}, 0 )
+ boss:RegisterEvent( bossNPC.PullIn, { ebs.GetTimer( 4000, difficulty ), 6000 }, 0 )
+ boss:RegisterEvent( bossNPC.Pool, { ebs.GetTimer( 10000, difficulty ), 12000}, 0 )
end
end
end
diff --git a/eventBosses.lua b/eventBosses.lua
index 12b501b..1bf7f5e 100644
--- a/eventBosses.lua
+++ b/eventBosses.lua
@@ -51,7 +51,6 @@ ebs.Config = {
["fireworks"] = { 66400, 66402, 46847, 46829, 46830, 62074, 62075, 62077, 55420 },
["GMRankForEventStart"] = 2,
["GMRankForUpdateDB"] = 3,
- ["printErrorsToConsole"] = 1,
["addEnrageTimer"] = 300000,
["baseScore"] = 40,
["additionalScore"] = 10,
@@ -127,9 +126,8 @@ TYPE_GAMEOBJECT = 2
local PARTY_IN_PROGRESS = 1
local RAID_IN_PROGRESS = 2
local eventInProgress
-local encounterStartTime = {}
-local playersInGroup = {
+ebs.playersInGroup = {
[1] = {},
[2] = {},
[3] = {},
@@ -149,6 +147,7 @@ ebs.phaseIdDifficulty = {} -- stores the difficulty of the encounter. 0 mea
ebs.fightType = {} -- party or raid
ebs.encounter = {}
ebs.clearedDifficulty = {}
+ebs.encounterStartTime = {}
function ebs.has_value (tab, val)
for index, value in ipairs(tab) do
@@ -188,8 +187,8 @@ function ebs.splitString(inputstr, seperator)
return t
end
-function ebs.castFireworks(_, _, _, worldobject)
- if worldobject and worldobject:GetPhaseMask() == 1 then
+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
@@ -198,7 +197,7 @@ function ebs.isParticipating(player)
if not player then
return false
end
- for _,v in pairs(playersInGroup) do
+ for _,v in pairs(ebs.playersInGroup) do
if ebs.has_value(v, player:GetGUID()) and player:GetPhaseMask() ~= 1 then
return true
end
@@ -227,7 +226,7 @@ end
function ebs.checkInCombat(slotId)
--check if all players are in combat
local player
- for _, v in pairs(playersInGroup[slotId]) do
+ for _, v in pairs(ebs.playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
if player ~= nil then
if player:IsInCombat() == false and player:GetPhaseMask() == 2 then
@@ -242,10 +241,19 @@ function ebs.checkInCombat(slotId)
end
function ebs.getEncounterDuration(slotId)
- local dt = GetTimeDiff(encounterStartTime(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 rawTimer
+ else
+ local timer = rawTimer / (1 + ((difficulty - 1) / 9))
+ return timer
+ end
+end
+
function ebs.getFreeSlot()
for k, v in ipairs(ebs.phaseIdDifficulty) do
if v == nil then
@@ -255,18 +263,20 @@ function ebs.getFreeSlot()
return 1
end
-function ebs.getLastSuccessfulDifficulty(playerGUID)
+function ebs.getLastSuccessfulDifficulty(playerGUID, fightType)
if ebs.clearedDifficulty[playerGUID] then
- return ebs.clearedDifficulty[playerGUID]
- else
- return 0
+ local difficulty = ebs.clearedDifficulty[playerGUID][fightType]
+ if difficulty then
+ return difficulty
+ end
end
+ return 0
end
function ebs.awardScore(slotId)
local score = ebs.Config.baseScore + (ebs.Config.additionalScore * ebs.phaseIdDifficulty[slotId])
- for _, playerGuid in pairs(playersInGroup[slotId]) do
- if GetPlayerByGUID(playerGuid) ~= nil then
+ for _, playerGuid in pairs(ebs.playersInGroup[slotId]) do
+ if GetPlayerByGUID(playerGuid) then
local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
@@ -275,30 +285,32 @@ function ebs.awardScore(slotId)
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(encounterStartTime[slotId])..');');
+ 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.storeEncounter(slotId)
- for _, playerGuid in pairs(playersInGroup[slotId]) do
- if GetPlayerByGUID(playerGuid) ~= nil then
+ 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(encounterStartTime[slotId])..');');
+ 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 player == nil then return end
+ 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
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant!", ebs.encounter[eventInProgress].npc[2], 1)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. ebs.getLastSuccessfulDifficulty(player:GetGUID(), RAID_IN_PROGRESS) + 1 .. ")", ebs.encounter[eventInProgress].npc[2], 2)
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant! (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), PARTY_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 1)
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), RAID_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 2)
end
player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", ebs.encounter[eventInProgress].npc[2], 0)
player:GossipSendMenu(ebs.encounter[eventInProgress].npcText, creature, 0)
@@ -357,28 +369,28 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
--start 5man encounter
ebs.fightType[slotId] = PARTY_IN_PROGRESS
- ebs.phaseIdDifficulty[slotId] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType)
+ ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), ebs.fightType[slotId])
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]
+ ebs.spawnedBossGuid[slotId] = spawnedCreature[1]:GetGUID()
+ 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)
- encounterStartTime[slotId] = GetCurrTime()
+ ebs.encounterStartTime[slotId] = GetCurrTime()
for n, v in pairs(groupPlayers) do
- if v:GetDistance(player) ~= nil then
- if v:GetDistance(player) < 80 then
- v:SetPhaseMask(ebs.Config.eventPhase[slotId])
- playersInGroup[slotId][n] = v:GetGUID()
- spawnedCreature[1]:SetInCombatWith(v)
- v:SetInCombatWith(spawnedCreature[1])
- spawnedCreature[1]:AddThreat(v, 1)
- end
+ 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
@@ -396,12 +408,13 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
--start raid encounter
ebs.fightType[slotId] = RAID_IN_PROGRESS
- ebs.phaseIdDifficulty[slotId] = ebs.getLastSuccessfulDifficulty(player:GetGUID(),ebs.fightType[slotId])
+ ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), ebs.fightType[slotId])
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:GetGUID()
+ spawnedBoss:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
if ebs.encounter[slotId].addAmount > 0 then
for c = 1, ebs.encounter[slotId].addAmount do
@@ -410,25 +423,24 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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])
end
end
- encounterStartTime[slotId] = GetCurrTime()
+ ebs.encounterStartTime[slotId] = GetCurrTime()
for n, v in pairs(groupPlayers) do
- if v:GetDistance(player) ~= nil then
- if v:GetDistance(player) < 80 then
- v:SetPhaseMask(ebs.Config.eventPhase[slotId])
- 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
+ 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
else
@@ -515,17 +527,17 @@ end
function ebs.returnPlayers(slotId)
local player
local playerListString
- for _, v in pairs(playersInGroup[slotId]) do
+ 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)
- if playerListString == nil then
- playerListString = player:GetName()
- else
- playerListString = playerListString..", "..player:GetName()
- end
end
end
end
@@ -534,13 +546,17 @@ end
function ebs.finishPlayers(slotId)
local player
- for _, v in pairs(playersInGroup[slotId]) do
+ for _, v in pairs(ebs.playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
+ if not ebs.clearedDifficulty[GetGUIDLow(v)] then
+ ebs.clearedDifficulty[GetGUIDLow(v)] = {}
+ end
+ if not ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]]
+ or ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
+ ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
+ end
if player then
player:RegisterEvent(ebs.castFireworks, 1000, 20)
- if not ebs.clearedDifficulty[GetGUIDLow(v)] or ebs.clearedDifficulty[GetGUIDLow(v)] < ebs.phaseIdDifficulty[slotId] then
- ebs.clearedDifficulty[GetGUIDLow(v)] = ebs.phaseIdDifficulty[slotId]
- end
end
end
end
@@ -556,23 +572,20 @@ function ebs.bossReset(event, creature)
return
end
ebs.spawnedBossGuid[slotId] = nil
-
+ local playerListString = ebs.returnPlayers(slotId)
if creature:IsDead() == true then
- local playerListString = ebs.returnPlayers(slotId)
if Config.rewardRaid == 1 then
ebs.awardScore(slotId)
elseif Config.storeRaid == 1 then
ebs.storeEncounter(slotId)
end
SendWorldMessage("The raid encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
- " in " .. ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
+ " in " .. ebs.getEncounterDuration(slotId).." by: "..playerListString..". Congratulations!")
ebs.finnishPlayers(slotId)
- playersInGroup[slotId] = {}
- else
- ebs.returnPlayers(slotId)
- playersInGroup[slotId] = {}
- ebs.fightType[slotId] = nil
end
+
+ ebs.playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
creature:DespawnOrUnsummon(0)
end
@@ -589,22 +602,22 @@ function ebs.addReset(event, creature)
PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
return
end
-
ebs.spawnedBossGuid[slotId] = nil
+ local playerListString = ebs.returnPlayers(slotId)
if creature:IsDead() == true then
- local playerListString = ebs.returnPlayers(slotId)
if ebs.Config.rewardParty == 1 then
- awardScore(slotId)
+ ebs.awardScore(slotId)
elseif ebs.Config.storeParty == 1 then
- storeEncounter(slotId)
+ ebs.storeEncounter(slotId)
end
SendWorldMessage("The party encounter "..creature:GetName().." was completed on difficulty " .. ebs.phaseIdDifficulty[slotId] ..
- " in " ..ebs.getEncounterDuration().." by: "..playerListString..". Congratulations!")
- ebs.finnishPlayers(slotId)
- playersInGroup[slotId] = {}
- ebs.fightType[slotId] = nil
+ " in " ..ebs.getEncounterDuration(slotId).." by: "..playerListString..". Congratulations!")
+ ebs.finishPlayers(slotId)
end
+
+ ebs.playersInGroup[slotId] = {}
+ ebs.fightType[slotId] = nil
creature:DespawnOrUnsummon(0)
end
@@ -627,6 +640,16 @@ function ebs.closeLua(_)
end
end
+local query = CharDBQuery('SELECT * FROM `'..Config.customDbName..'`.`eventscript_score`;')
+if query ~= nil 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())
--on ReloadEluna / Startup
From 0ae9ab5a89f21fc255d8bf8fe88db579e7b7d9e2 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 13 Feb 2024 21:31:46 +0100
Subject: [PATCH 04/27] account wide score
---
eventBosses.lua | 66 +++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 30 deletions(-)
diff --git a/eventBosses.lua b/eventBosses.lua
index 1bf7f5e..aff2f1e 100644
--- a/eventBosses.lua
+++ b/eventBosses.lua
@@ -56,7 +56,7 @@ ebs.Config = {
["additionalScore"] = 10,
["rewardRaid"] = 1,
["storeRaid"] = 1,
- ["rewardParty"] = 0,
+ ["rewardParty"] = 1,
["storeParty"] = 1
}
@@ -263,9 +263,9 @@ function ebs.getFreeSlot()
return 1
end
-function ebs.getLastSuccessfulDifficulty(playerGUID, fightType)
- if ebs.clearedDifficulty[playerGUID] then
- local difficulty = ebs.clearedDifficulty[playerGUID][fightType]
+function ebs.getLastSuccessfulDifficulty(accountId, fightType)
+ if ebs.clearedDifficulty[accountId] then
+ local difficulty = ebs.clearedDifficulty[accountId][fightType]
if difficulty then
return difficulty
end
@@ -274,14 +274,28 @@ function ebs.getLastSuccessfulDifficulty(playerGUID, fightType)
end
function ebs.awardScore(slotId)
- local score = ebs.Config.baseScore + (ebs.Config.additionalScore * ebs.phaseIdDifficulty[slotId])
for _, playerGuid in pairs(ebs.playersInGroup[slotId]) do
- if GetPlayerByGUID(playerGuid) then
+ local player GetPlayerByGUID(playerGuid)
+ if player then
+ local totalscore
+ 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
- scoreEarned[accountId] = scoreEarned[accountId] + score
- scoreTotal[accountId] = scoreTotal[accountId] + score
+ local oldScore = scoreEarned[accountId]
+
+ if ebs.fightType[slotId] == PARTY_IN_PROGRESS and ebs.Config.rewardParty == 1 then
+ basescore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.GetLastSuccessfulDifficulty(accountId, PARTY_IN_PROGRESS)
+ end
+
+ if ebs.fightType[slotId] == RAID_IN_PROGRESS and ebs.Config.rewardRaid == 1 then
+ totalscore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.GetLastSuccessfulDifficulty(accountId, RAID_IN_PROGRESS)
+ end
+
+ local gain = score - oldScore
+ scoreEarned[accountId] = score
+ scoreTotal[accountId] = scoreTotal[accountId] + gain
CharDBExecute('REPLACE INTO `'..ebs.Config.customDbName..'`.`eventscript_score` VALUES ('..accountId..', '..scoreEarned[accountId]..', '..scoreTotal[accountId]..');');
local gameTime = (tonumber(tostring(GetGameTime())))
local playerLowGuid = GetGUIDLow(playerGuid)
@@ -309,8 +323,8 @@ function ebs.onHello(_, player, creature)
--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
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant! (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), PARTY_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 1)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), RAID_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 2)
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant! (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), PARTY_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 1)
+ player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), RAID_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 2)
end
player:GossipMenuAddItem(OPTION_ICON_CHAT, "What's my score?", ebs.encounter[eventInProgress].npc[2], 0)
player:GossipSendMenu(ebs.encounter[eventInProgress].npcText, creature, 0)
@@ -369,7 +383,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
--start 5man encounter
ebs.fightType[slotId] = PARTY_IN_PROGRESS
- ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), ebs.fightType[slotId])
+ ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), ebs.fightType[slotId])
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))
@@ -408,7 +422,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
--start raid encounter
ebs.fightType[slotId] = RAID_IN_PROGRESS
- ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(GetGUIDLow(player:GetGUID()), ebs.fightType[slotId])
+ ebs.phaseIdDifficulty[slotId] = 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), ebs.fightType[slotId])
spawnedBoss = object:SpawnCreature(ebs.encounter[eventInProgress].bossEntry, x, y, z+2, o, spawnType, despawnTime)
spawnedBoss:SetPhaseMask(ebs.Config.eventPhase[slotId])
@@ -548,12 +562,12 @@ function ebs.finishPlayers(slotId)
local player
for _, v in pairs(ebs.playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
- if not ebs.clearedDifficulty[GetGUIDLow(v)] then
- ebs.clearedDifficulty[GetGUIDLow(v)] = {}
+ if not ebs.clearedDifficulty[v:GetAccountId()] then
+ ebs.clearedDifficulty[v:GetAccountId()] = {}
end
- if not ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]]
- or ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
- ebs.clearedDifficulty[GetGUIDLow(v)][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
+ if not ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]]
+ or ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
+ ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
end
if player then
player:RegisterEvent(ebs.castFireworks, 1000, 20)
@@ -574,14 +588,10 @@ function ebs.bossReset(event, creature)
ebs.spawnedBossGuid[slotId] = nil
local playerListString = ebs.returnPlayers(slotId)
if creature:IsDead() == true then
- if Config.rewardRaid == 1 then
- ebs.awardScore(slotId)
- elseif Config.storeRaid == 1 then
- ebs.storeEncounter(slotId)
- end
+ 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!")
- ebs.finnishPlayers(slotId)
end
ebs.playersInGroup[slotId] = {}
@@ -606,14 +616,10 @@ function ebs.addReset(event, creature)
local playerListString = ebs.returnPlayers(slotId)
if creature:IsDead() == true then
- if ebs.Config.rewardParty == 1 then
- ebs.awardScore(slotId)
- elseif ebs.Config.storeParty == 1 then
- ebs.storeEncounter(slotId)
- end
+ 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!")
- ebs.finishPlayers(slotId)
end
ebs.playersInGroup[slotId] = {}
@@ -640,6 +646,7 @@ function ebs.closeLua(_)
end
end
+--on ReloadEluna / Startup
local query = CharDBQuery('SELECT * FROM `'..Config.customDbName..'`.`eventscript_score`;')
if query ~= nil then
local account
@@ -652,7 +659,6 @@ end
math.randomseed(os.time())
---on ReloadEluna / Startup
RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, ebs.command)
RegisterPlayerEvent(PLAYER_EVENT_ON_REPOP, ebs.resetPlayers)
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGOUT, ebs.resetPlayers)
From 234a1161ac77503c22489bc9008c0c58d7ee6341 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 13 Feb 2024 21:40:28 +0100
Subject: [PATCH 05/27] creature levels to TBC
---
database/world/customWorldboss.sql | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
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';
From b9bd7c5f5370e0e8df6de4afd2919153bb209a13 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 13 Feb 2024 22:56:52 +0100
Subject: [PATCH 06/27] can't reach code
---
eventBosses.lua | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/eventBosses.lua b/eventBosses.lua
index aff2f1e..8020c50 100644
--- a/eventBosses.lua
+++ b/eventBosses.lua
@@ -585,7 +585,9 @@ function ebs.bossReset(event, creature)
PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
return
end
+
ebs.spawnedBossGuid[slotId] = nil
+
local playerListString = ebs.returnPlayers(slotId)
if creature:IsDead() == true then
ebs.finishPlayers(slotId)
@@ -604,14 +606,15 @@ function ebs.addReset(event, creature)
if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
end
- if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
- return
- end
if slotId == 0 then
PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
return
end
+ if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
+ return
+ end
+
ebs.spawnedBossGuid[slotId] = nil
local playerListString = ebs.returnPlayers(slotId)
From 04de8a8dbc8e625d059cf67da6286a9a42b9b84f Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 17:46:08 +0100
Subject: [PATCH 07/27] remove outdated query
---
scripts/query-points.sql | 15 ---------------
1 file changed, 15 deletions(-)
delete mode 100644 scripts/query-points.sql
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
From 676e86ee3d01b3b0d54d7884836cc5e76e6a2537 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 17:49:02 +0100
Subject: [PATCH 08/27] move scripts
---
eventBoss1.lua => scripts/custom_boss_events/eventBoss1.lua | 0
eventBosses.lua => scripts/custom_boss_events/eventBosses.lua | 0
hideAndSeek.lua => scripts/hide_and_seek/hideAndSeek.lua | 0
.../hide_and_seek/hideAndSeekConf.lua.dist | 0
4 files changed, 0 insertions(+), 0 deletions(-)
rename eventBoss1.lua => scripts/custom_boss_events/eventBoss1.lua (100%)
rename eventBosses.lua => scripts/custom_boss_events/eventBosses.lua (100%)
rename hideAndSeek.lua => scripts/hide_and_seek/hideAndSeek.lua (100%)
rename hideAndSeekConf.lua.dist => scripts/hide_and_seek/hideAndSeekConf.lua.dist (100%)
diff --git a/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
similarity index 100%
rename from eventBoss1.lua
rename to scripts/custom_boss_events/eventBoss1.lua
diff --git a/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
similarity index 100%
rename from eventBosses.lua
rename to scripts/custom_boss_events/eventBosses.lua
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
From 5f9c03d4ee68a60c71a30c7193559d385d5ffa2d Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 17:49:35 +0100
Subject: [PATCH 09/27] rename pvp event script
---
funTools.lua => pvp_events.lua | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename funTools.lua => pvp_events.lua (100%)
diff --git a/funTools.lua b/pvp_events.lua
similarity index 100%
rename from funTools.lua
rename to pvp_events.lua
From 2bac6aa0406f109f4bfc5866b786b0a9ca4fedfc Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 17:50:13 +0100
Subject: [PATCH 10/27] move pvp script
---
pvp_events.lua => scripts/pvp/pvp_events.lua | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename pvp_events.lua => scripts/pvp/pvp_events.lua (100%)
diff --git a/pvp_events.lua b/scripts/pvp/pvp_events.lua
similarity index 100%
rename from pvp_events.lua
rename to scripts/pvp/pvp_events.lua
From 9d0a7d2e8868858f123bcdc29d63ccd426b50cba Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 17:57:00 +0100
Subject: [PATCH 11/27] move bonusbuff
---
bonusbuff.lua => scripts/bonusbuff/bonusbuff.lua | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename bonusbuff.lua => scripts/bonusbuff/bonusbuff.lua (100%)
diff --git a/bonusbuff.lua b/scripts/bonusbuff/bonusbuff.lua
similarity index 100%
rename from bonusbuff.lua
rename to scripts/bonusbuff/bonusbuff.lua
From c560a90ee9028d3406f253c455dd751a51ae8e80 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Thu, 29 Feb 2024 19:37:25 +0100
Subject: [PATCH 12/27] typo
---
scripts/custom_boss_events/eventBosses.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 8020c50..3ff008a 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -650,7 +650,7 @@ function ebs.closeLua(_)
end
--on ReloadEluna / Startup
-local query = CharDBQuery('SELECT * FROM `'..Config.customDbName..'`.`eventscript_score`;')
+local query = CharDBQuery('SELECT * FROM `'..ebs.Config.customDbName..'`.`eventscript_score`;')
if query ~= nil then
local account
repeat
From 6ee3ecc43282f7ff162a815ef830993988c9bc0e Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 16 Mar 2024 22:52:43 +0100
Subject: [PATCH 13/27] fix account-wide handling
---
scripts/custom_boss_events/eventBoss1.lua | 13 ++++++++-----
scripts/custom_boss_events/eventBosses.lua | 14 +++++++-------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 6b46317..f4fd362 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -40,11 +40,11 @@ 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
+ ["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
}
--------------------------------------------------------------------------------------
@@ -116,6 +116,7 @@ function addNPC.onEnterCombat( event, creature, target )
creature:CallForHelp( 200 )
local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
+
creature:RegisterEvent( addNPC.HealBoss, { 10000, 15000 }, 0 )
creature:RegisterEvent( addNPC.Splash, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
if difficulty >= 3 or creature:GetData('ebs_mode') == PARTY_IN_PROGRESS then
@@ -127,6 +128,7 @@ function addNPC.reset( event, creature )
creature:RemoveEvents()
local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
+
if creature:IsDead() then
if ebs.has_value( ebs.spawnedBossGuid, creature:GetGUID() ) then
slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
@@ -149,6 +151,7 @@ function addNPC.reset( event, creature )
end
end
end
+
-- add custom scripting above
ebs.addReset( event, creature )
end
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 3ff008a..1dd1458 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -247,9 +247,9 @@ end
function ebs.GetTimer(timer, difficulty)
if difficulty == 1 then
- return rawTimer
+ return timer
else
- local timer = rawTimer / (1 + ((difficulty - 1) / 9))
+ timer = timer / (1 + ((difficulty - 1) / 9))
return timer
end
end
@@ -562,12 +562,12 @@ function ebs.finishPlayers(slotId)
local player
for _, v in pairs(ebs.playersInGroup[slotId]) do
player = GetPlayerByGUID(v)
- if not ebs.clearedDifficulty[v:GetAccountId()] then
- ebs.clearedDifficulty[v:GetAccountId()] = {}
+ if not ebs.clearedDifficulty[player:GetAccountId()] then
+ ebs.clearedDifficulty[player:GetAccountId()] = {}
end
- if not ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]]
- or ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
- ebs.clearedDifficulty[v:GetAccountId()][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
+ if not ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]]
+ or ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
+ ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
end
if player then
player:RegisterEvent(ebs.castFireworks, 1000, 20)
From 521309725b402b4550ad97325f8c7f7e67502b48 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 16 Mar 2024 23:21:35 +0100
Subject: [PATCH 14/27] store difficulty
---
scripts/custom_boss_events/eventBosses.lua | 25 ++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 1dd1458..dc0be1b 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -69,6 +69,11 @@ if tostring(ebs.Config.customDbName) == "" or (ebs.Config.customDbName) == nil t
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
local PLAYER_EVENT_ON_LOGOUT = 4 -- (event, player)
local PLAYER_EVENT_ON_REPOP = 35 -- (event, player)
@@ -559,15 +564,19 @@ function ebs.returnPlayers(slotId)
end
function ebs.finishPlayers(slotId)
- local player
for _, v in pairs(ebs.playersInGroup[slotId]) do
+ local player
+ local accountId
player = GetPlayerByGUID(v)
- if not ebs.clearedDifficulty[player:GetAccountId()] then
- ebs.clearedDifficulty[player:GetAccountId()] = {}
+ accountId = player:GetAccountId()
+ local difficulty = ebs.phaseIdDifficulty[slotId]
+ if not ebs.clearedDifficulty[accountId] then
+ ebs.clearedDifficulty[accountId] = {}
end
- if not ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]]
- or ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]] < ebs.phaseIdDifficulty[slotId] then
- ebs.clearedDifficulty[player:GetAccountId()][ebs.fightType[slotId]] = ebs.phaseIdDifficulty[slotId]
+ 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)
@@ -630,6 +639,10 @@ function ebs.addReset(event, creature)
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.closeLua(_)
if eventInProgress then
local npcObject
From 369c14f94f273a4fba08e7c74df6bc859f355f7b Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sun, 17 Mar 2024 00:44:17 +0100
Subject: [PATCH 15/27] fix score logic
---
scripts/custom_boss_events/eventBoss1.lua | 10 +--
scripts/custom_boss_events/eventBosses.lua | 78 ++++++++++++++--------
2 files changed, 57 insertions(+), 31 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index f4fd362..80a5295 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -76,7 +76,7 @@ function bossNPC.onEnterCombat( event, creature, target )
creature:CallForHelp( 200 )
local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
- creature:RegisterEvent( bossNPC.Fire, GetTimer( 10000, difficulty ), 0 )
+ creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
end
function bossNPC.reset( event, creature )
@@ -127,11 +127,11 @@ end
function addNPC.reset( event, creature )
creature:RemoveEvents()
local difficulty = creature:GetData('ebs_difficulty')
- -- add custom scripting below
if creature:IsDead() then
- if ebs.has_value( ebs.spawnedBossGuid, creature:GetGUID() ) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ if ebs.has_value( ebs.spawnedBossGuid, creature:GetOwnerGUID() ) then
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetOwnerGUID())
+ print("135: "..slotId)
end
if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
ebs.addReset( event, creature )
@@ -145,6 +145,8 @@ function addNPC.reset( event, creature )
if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
local boss = creature:GetOwner()
if boss then
+ -- add custom scripting below
+
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 )
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index dc0be1b..891164a 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -280,32 +280,35 @@ end
function ebs.awardScore(slotId)
for _, playerGuid in pairs(ebs.playersInGroup[slotId]) do
- local player GetPlayerByGUID(playerGuid)
- if player then
- local totalscore
- local basescore
- local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
+ local player = GetPlayerByGUID(playerGuid)
+ if not player then
+ PrintError("eventBosses.lua: Player with GUID "..tostring(playerGuid).." not found in ebs.awardScore(slotId).")
+ return
+ end
- if scoreEarned[accountId] == nil then scoreEarned[accountId] = 0 end
- if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
- local oldScore = scoreEarned[accountId]
+ local newScore
+ local baseScore
+ local accountId = GetPlayerByGUID(playerGuid):GetAccountId()
- if ebs.fightType[slotId] == PARTY_IN_PROGRESS and ebs.Config.rewardParty == 1 then
- basescore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.GetLastSuccessfulDifficulty(accountId, PARTY_IN_PROGRESS)
- end
+ 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] == RAID_IN_PROGRESS and ebs.Config.rewardRaid == 1 then
- totalscore = ebs.Config.baseScore + ebs.Config.additionalScore * ebs.GetLastSuccessfulDifficulty(accountId, RAID_IN_PROGRESS)
- end
+ if ebs.fightType[slotId] == PARTY_IN_PROGRESS and ebs.Config.rewardParty == 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
- local gain = score - oldScore
- scoreEarned[accountId] = score
- scoreTotal[accountId] = scoreTotal[accountId] + gain
- 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])..');');
+ if ebs.fightType[slotId] == RAID_IN_PROGRESS and ebs.Config.rewardRaid == 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
@@ -511,6 +514,7 @@ function ebs.command(event, player, command, chatHandler)
if eventInProgress == nil then
eventInProgress = eventId
ebs.summonEventNPC()
+ ebs.loadRecords()
chatHandler:SendSysMessage("Starting event "..eventInProgress..".")
return false
else
@@ -576,7 +580,7 @@ function ebs.finishPlayers(slotId)
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)
+ ebs.saveProgress(accountId, ebs.fightType[slotId], difficulty)
end
if player then
player:RegisterEvent(ebs.castFireworks, 1000, 20)
@@ -588,10 +592,11 @@ function ebs.bossReset(event, creature)
local slotId = 0
if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ print("595: "..slotId)
end
if slotId == 0 then
- PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
+ PrintError("eventBosses.lua: A boss rest without a valid slotId.")
return
end
@@ -613,11 +618,13 @@ end
function ebs.addReset(event, creature)
local slotId = 0
if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
+ slotId = ebs.returnKey
+ print("622: "..slotId)
+ (ebs.spawnedBossGuid, creature:GetGUID())
end
if slotId == 0 then
- PrintError("eventBosses.lua: A Boss encounter ended without a valid slotId.")
+ PrintError("eventBosses.lua: An add reset without a valid slotId.")
return
end
if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
@@ -639,10 +646,27 @@ function ebs.addReset(event, creature)
creature:DespawnOrUnsummon(0)
end
-function ebs.SaveProgress(accountId, encounterType, difficulty)
+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 eventInProgress then
local npcObject
@@ -664,7 +688,7 @@ end
--on ReloadEluna / Startup
local query = CharDBQuery('SELECT * FROM `'..ebs.Config.customDbName..'`.`eventscript_score`;')
-if query ~= nil then
+if query then
local account
repeat
account = query:GetUInt32(0)
From 0897ed4255c1fddc975bceeac1af3a5ecf6270bf Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sun, 17 Mar 2024 15:11:07 +0100
Subject: [PATCH 16/27] store low guid in setdata
---
scripts/custom_boss_events/eventBoss1.lua | 13 +++++++-----
scripts/custom_boss_events/eventBosses.lua | 23 +++++++++++-----------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 80a5295..9333904 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -127,11 +127,12 @@ end
function addNPC.reset( event, creature )
creature:RemoveEvents()
local difficulty = creature:GetData('ebs_difficulty')
-
+ local slotId
if creature:IsDead() then
- if ebs.has_value( ebs.spawnedBossGuid, creature:GetOwnerGUID() ) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetOwnerGUID())
- print("135: "..slotId)
+ local bossLowGUID = creature:GetData('ebs_boss_lowguid')
+
+ if ebs.has_value( ebs.spawnedBossGuid, bossLowGUID ) then
+ slotId = ebs.returnKey( ebs.spawnedBossGuid, bossLowGUID )
end
if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
ebs.addReset( event, creature )
@@ -150,11 +151,13 @@ function addNPC.reset( event, creature )
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 )
+
+ -- add custom scripting above
end
end
end
- -- add custom scripting above
+
ebs.addReset( event, creature )
end
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 891164a..ca63268 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -395,7 +395,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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]:GetGUID()
+ ebs.spawnedBossGuid[slotId] = spawnedCreature[1]:GetGUIDLow()
spawnedCreature[1]:SetData('ebs_mode', ebs.fightType[slotId])
spawnedCreature[1]:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
@@ -435,7 +435,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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:GetGUID()
+ ebs.spawnedBossGuid[slotId] = spawnedBoss:GetGUIDLow()
spawnedBoss:SetData('ebs_difficulty', ebs.phaseIdDifficulty[slotId])
if ebs.encounter[slotId].addAmount > 0 then
@@ -446,6 +446,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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
@@ -590,9 +591,8 @@ end
function ebs.bossReset(event, creature)
local slotId = 0
- if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUID())
- print("595: "..slotId)
+ if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUIDLow()) then
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
end
if slotId == 0 then
@@ -617,17 +617,16 @@ end
function ebs.addReset(event, creature)
local slotId = 0
- if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUID()) then
- slotId = ebs.returnKey
- print("622: "..slotId)
- (ebs.spawnedBossGuid, creature:GetGUID())
+ if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUIDLow()) then
+ slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
end
- if slotId == 0 then
- PrintError("eventBosses.lua: An add reset without a valid slotId.")
+ if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
return
end
- if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
+ -- 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
From aa9e543c76c288df25c3adadb003a94c3172645a Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sun, 17 Mar 2024 16:59:34 +0100
Subject: [PATCH 17/27] fix local, optimize duplicate table lookups
---
scripts/custom_boss_events/eventBoss1.lua | 9 +++++----
scripts/custom_boss_events/eventBosses.lua | 19 +++++++------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 9333904..0fefcb7 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -131,9 +131,8 @@ function addNPC.reset( event, creature )
if creature:IsDead() then
local bossLowGUID = creature:GetData('ebs_boss_lowguid')
- if ebs.has_value( ebs.spawnedBossGuid, bossLowGUID ) then
- slotId = ebs.returnKey( ebs.spawnedBossGuid, bossLowGUID )
- end
+ local hasValue
+ hasValue, slotId = ebs.returnKey ( ebs.spawnedBossGuid, bossLowGUID )
if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
ebs.addReset( event, creature )
return
@@ -142,9 +141,11 @@ function addNPC.reset( event, creature )
if not addDownCounter[ slotId ] then
addDownCounter[ slotId ] = 0
end
+
addDownCounter[ slotId ] = addDownCounter[ slotId ] + 1
if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
- local boss = creature:GetOwner()
+ local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
+ local boss = creature:GetMap():GetWorldObject( guid )
if boss then
-- add custom scripting below
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index ca63268..5e0ad4d 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -128,8 +128,9 @@ SELECT_TARGET_FARTHEST = 4
TYPE_CREATURE = 1
TYPE_GAMEOBJECT = 2
-local PARTY_IN_PROGRESS = 1
-local RAID_IN_PROGRESS = 2
+PARTY_IN_PROGRESS = 1
+RAID_IN_PROGRESS = 2
+
local eventInProgress
ebs.playersInGroup = {
@@ -166,10 +167,10 @@ end
function ebs.returnKey (tab, val)
for index, value in ipairs(tab) do
if value == val then
- return index
+ return true, index
end
end
- return 0
+ return false, 0
end
function ebs.returnIndex (tab, val)
@@ -590,10 +591,7 @@ function ebs.finishPlayers(slotId)
end
function ebs.bossReset(event, creature)
- local slotId = 0
- if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUIDLow()) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
- end
+ local hasValue, slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
if slotId == 0 then
PrintError("eventBosses.lua: A boss rest without a valid slotId.")
@@ -616,10 +614,7 @@ function ebs.bossReset(event, creature)
end
function ebs.addReset(event, creature)
- local slotId = 0
- if ebs.has_value(ebs.spawnedBossGuid, creature:GetGUIDLow()) then
- slotId = ebs.returnKey(ebs.spawnedBossGuid, creature:GetGUIDLow())
- end
+ local hasValue, slotId = ebs.returnKey (ebs.spawnedBossGuid, creature:GetGUIDLow())
if ebs.fightType[slotId] ~= PARTY_IN_PROGRESS then
return
From 3af3b6ce60879d16d3c2d0a41f4601c2fcf1effd Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sun, 17 Mar 2024 21:32:35 +0100
Subject: [PATCH 18/27] fix boss fetching
---
scripts/custom_boss_events/eventBoss1.lua | 5 ++++-
scripts/custom_boss_events/eventBosses.lua | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 0fefcb7..a5451c7 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -76,6 +76,7 @@ function bossNPC.onEnterCombat( event, creature, target )
creature:CallForHelp( 200 )
local difficulty = creature:GetData('ebs_difficulty')
-- add custom scripting below
+
creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
end
@@ -92,7 +93,9 @@ function addNPC.RemoveInterrupt( eventid, delay, repeats, add )
end
function addNPC.HealBoss( eventid, delay, repeats, add )
- local boss = add:GetOwner()
+ local bossLowGUID = creature:GetData('ebs_boss_lowguid')
+ local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
+ local boss = creature:GetMap():GetWorldObject( guid )
if boss then
if boss:GetHealthPct() < 90 then
if math.random(1,2) == 1 then
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 5e0ad4d..f44d0ba 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -224,7 +224,7 @@ end
function ebs.getSize(difficulty)
local value = 1
if difficulty >= 1 then
- value = 1 + (difficulty - 1) / 4
+ value = 1 + (difficulty - 1) / 8
end
return value
end
From e9cd9536446bfbc2072ec5cb4f657b6a89d25dcc Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 23 Mar 2024 23:10:39 +0100
Subject: [PATCH 19/27] add rewards/buffs
---
.../custom_boss_events/eventBossRewards.lua | 139 ++++++++++++++++++
scripts/custom_boss_events/eventBosses.lua | 16 +-
2 files changed, 150 insertions(+), 5 deletions(-)
create mode 100644 scripts/custom_boss_events/eventBossRewards.lua
diff --git a/scripts/custom_boss_events/eventBossRewards.lua b/scripts/custom_boss_events/eventBossRewards.lua
new file mode 100644
index 0000000..e0aba4b
--- /dev/null
+++ b/scripts/custom_boss_events/eventBossRewards.lua
@@ -0,0 +1,139 @@
+--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
+------------------------------------------
+
+local MAX_REWARD_LEVEL = 10
+local REPUTATION_FACTOR = 2
+
+ebs.Config.cityAreas = { 3703, 3899, -- Shattrath
+ 4395, 4560, 4567, 4601, 4613, 4616, 4620 -- Dalaran
+}
+ebs.Config.cityAura = { [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] = 22590, -- 15% 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
+------------------------------------------
+
+if ebs.Config.rewardRaid == 1 then
+
+end
+
+function ebs.BuffInRaid(player)
+ 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 > MAX_REWARD_LEVEL then
+ difficulty = MAX_REWARD_LEVEL
+ end
+
+ local duration = raidAuraBaseDuration + (raidAuraAdditionalDuration * difficulty)
+ player:AddAura(ebs.Config.raidAura, player)
+ player:RegisterEvent(function(_, _, _, player)
+ player:RemoveAura(ebs.Config.raidAura)
+ end, duration * 1000, 1)
+end
+
+function ebs.RemoveAuras(_, player)
+ player:RemoveAura(ebs.Config.raidAura)
+ for _,v in ipairs(ebs.Config.cityAreas) do
+ player:RemoveAura(ebs.Config.cityAura[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
+ local difficulty = ebs.clearedDifficulty[player:GetAccountId()][RAID_IN_PROGRESS]
+ if not difficulty then
+ return
+ end
+ if difficulty > MAX_REWARD_LEVEL then
+ difficulty = MAX_REWARD_LEVEL
+ end
+ player:AddAura(ebs.Config.cityAura[difficulty], player)
+
+ -- if the player was in a main city area before, remove the auras
+ elseif ebs.has_value (ebs.Config.cityAreas, oldArea) then
+ ebs.RemoveAuras(_, 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] >= MAX_REWARD_LEVEL then
+ print('standing: + incremental: '..standing + (incremental * REPUTATION_FACTOR))
+ return standing + (incremental * REPUTATION_FACTOR)
+ 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.RemoveAuras )
+RegisterPlayerEvent( PLAYER_EVENT_ON_REPUTATION_CHANGE, ebs.BoostReputation )
+RegisterPlayerEvent( PLAYER_EVENT_ON_UPDATE_AREA, ebs.BuffInCity )
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index f44d0ba..c4d5abd 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -54,10 +54,12 @@ ebs.Config = {
["addEnrageTimer"] = 300000,
["baseScore"] = 40,
["additionalScore"] = 10,
- ["rewardRaid"] = 1,
+ ["giveScoreRaid"] = 1,
["storeRaid"] = 1,
- ["rewardParty"] = 1,
- ["storeParty"] = 1
+ ["rewardRaid"] = 1,
+ ["giveScoreParty"] = 1,
+ ["storeParty"] = 1,
+ ["rewardParty"] = 1
}
------------------------------------------
@@ -295,12 +297,12 @@ function ebs.awardScore(slotId)
if scoreTotal[accountId] == nil then scoreTotal[accountId] = 0 end
local oldScore = scoreEarned[accountId]
- if ebs.fightType[slotId] == PARTY_IN_PROGRESS and ebs.Config.rewardParty == 1 then
+ 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.rewardRaid == 1 then
+ 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
@@ -467,6 +469,10 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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
From 1f1929f64c3f02dd72273a874520e3b106a3e7fb Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Fri, 29 Mar 2024 16:12:24 +0100
Subject: [PATCH 20/27] fix naming
---
scripts/custom_boss_events/eventBoss1.lua | 36 +++++++++++------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index a5451c7..f568c22 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -93,9 +93,9 @@ function addNPC.RemoveInterrupt( eventid, delay, repeats, add )
end
function addNPC.HealBoss( eventid, delay, repeats, add )
- local bossLowGUID = creature:GetData('ebs_boss_lowguid')
+ local bossLowGUID = add:GetData('ebs_boss_lowguid')
local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
- local boss = creature:GetMap():GetWorldObject( guid )
+ local boss = add:GetMap():GetWorldObject( guid )
if boss then
if boss:GetHealthPct() < 90 then
if math.random(1,2) == 1 then
@@ -114,30 +114,30 @@ function addNPC.Splash( eventid, delay, repeats, add )
add:CastCustomSpell( add:GetVictim(), 32014, false, nil, 150 )
end
-function addNPC.onEnterCombat( event, creature, target )
- creature:CallAssistance()
- creature:CallForHelp( 200 )
- local difficulty = creature:GetData('ebs_difficulty')
+function addNPC.onEnterCombat( event, add, target )
+ add:CallAssistance()
+ add:CallForHelp( 200 )
+ local difficulty = add:GetData('ebs_difficulty')
-- add custom scripting below
- creature:RegisterEvent( addNPC.HealBoss, { 10000, 15000 }, 0 )
- creature:RegisterEvent( addNPC.Splash, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
- if difficulty >= 3 or creature:GetData('ebs_mode') == PARTY_IN_PROGRESS then
- creature:RegisterEvent( bossNPC.PullIn, { ebs.GetTimer( 10000, difficulty ), 15000 }, 0 )
+ 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.reset( event, creature )
- creature:RemoveEvents()
- local difficulty = creature:GetData('ebs_difficulty')
+function addNPC.reset( event, add )
+ add:RemoveEvents()
+ local difficulty = add:GetData('ebs_difficulty')
local slotId
- if creature:IsDead() then
- local bossLowGUID = creature:GetData('ebs_boss_lowguid')
+ if add:IsDead() then
+ local bossLowGUID = add:GetData('ebs_boss_lowguid')
local hasValue
hasValue, slotId = ebs.returnKey ( ebs.spawnedBossGuid, bossLowGUID )
if ebs.fightType[ slotId ] ~= RAID_IN_PROGRESS then
- ebs.addReset( event, creature )
+ ebs.addReset( event, add )
return
end
@@ -148,7 +148,7 @@ function addNPC.reset( event, creature )
addDownCounter[ slotId ] = addDownCounter[ slotId ] + 1
if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
- local boss = creature:GetMap():GetWorldObject( guid )
+ local boss = add:GetMap():GetWorldObject( guid )
if boss then
-- add custom scripting below
@@ -162,7 +162,7 @@ function addNPC.reset( event, creature )
end
- ebs.addReset( event, creature )
+ ebs.addReset( event, add )
end
RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 1, bossNPC.onEnterCombat )
From cf6fda247600104a049416cf3ed7feb0340f700a Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Fri, 29 Mar 2024 21:21:15 +0100
Subject: [PATCH 21/27] remove pre-PR original script
---
customWorldboss.txt | 2036 -------------------------------------------
1 file changed, 2036 deletions(-)
delete mode 100644 customWorldboss.txt
diff --git a/customWorldboss.txt b/customWorldboss.txt
deleted file mode 100644
index c93d42b..0000000
--- a/customWorldboss.txt
+++ /dev/null
@@ -1,2036 +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 eventInProgress
-local fightType
-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 fightType ~= 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 fightType ~= 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..', '..fightType..', '..GetTimeDiff(encounterStartTime)..');');
- end
- end
- fightType = 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..', '..fightType..', '..GetTimeDiff(encounterStartTime)..');');
- end
- end
- fightType = 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 fightType ~= 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
- fightType = 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 fightType ~= 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
- fightType = 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 fightType ~= 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
- fightType = 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
- fightType = 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 = {}
- fightType = 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]) < GetTimeDiff(encounterStartTime) then
- if phase == 2 and GetTimeDiff(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]) < GetTimeDiff(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]) < GetTimeDiff(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]) < GetTimeDiff(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]) < GetTimeDiff(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]) < GetTimeDiff(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] < GetTimeDiff(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]) < GetTimeDiff(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 fightType == 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 fightType == 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) < GetTimeDiff(encounterStartTime)then
- if phase == 2 and GetTimeDiff(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 + GetTimeDiff(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 + (GetTimeDiff(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 + GetTimeDiff(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 fightType == RAID_IN_PROGRESS then
- if Config_addSpellTimer4[eventInProgress] ~= nil and Config_addSpell4[eventInProgress] ~= nil then
- if eS_getDifficultyTimer(Config_addSpellTimer4[eventInProgress]) < randomTimer + GetTimeDiff(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 fightType == PARTY_IN_PROGRESS then
- eS_checkInCombat()
- end
- creature:RemoveEvents()
- if fightType == 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
- fightType = 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 = {}
- fightType = 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
From f693f0dd2163511486021ea1d81f546d0a06a09d Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sat, 4 May 2024 14:09:57 +0200
Subject: [PATCH 22/27] add reward auras and debug
---
scripts/custom_boss_events/eventBoss1.lua | 1 -
.../custom_boss_events/eventBossRewards.lua | 90 ++++++++++++-------
scripts/custom_boss_events/eventBosses.lua | 22 ++++-
3 files changed, 78 insertions(+), 35 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index f568c22..279eca8 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -116,7 +116,6 @@ end
function addNPC.onEnterCombat( event, add, target )
add:CallAssistance()
- add:CallForHelp( 200 )
local difficulty = add:GetData('ebs_difficulty')
-- add custom scripting below
diff --git a/scripts/custom_boss_events/eventBossRewards.lua b/scripts/custom_boss_events/eventBossRewards.lua
index e0aba4b..3d71df5 100644
--- a/scripts/custom_boss_events/eventBossRewards.lua
+++ b/scripts/custom_boss_events/eventBossRewards.lua
@@ -31,22 +31,19 @@ end
-- Begin of config section
------------------------------------------
-local MAX_REWARD_LEVEL = 10
-local REPUTATION_FACTOR = 2
-
ebs.Config.cityAreas = { 3703, 3899, -- Shattrath
4395, 4560, 4567, 4601, 4613, 4616, 4620 -- Dalaran
}
-ebs.Config.cityAura = { [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] = 22590, -- 15% speed
- [10] = 22590 -- 15% speed
+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
@@ -68,11 +65,8 @@ ebs.Config.boostedFactions = { 270, -- Zandalar Tribe
-- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
------------------------------------------
-if ebs.Config.rewardRaid == 1 then
-
-end
-
function ebs.BuffInRaid(player)
+ print("69: actually buffing")
if not ebs.clearedDifficulty[player:GetAccountId()] then
ebs.clearedDifficulty[player:GetAccountId()] = {}
end
@@ -80,39 +74,44 @@ function ebs.BuffInRaid(player)
if not difficulty then
return
end
- if difficulty > MAX_REWARD_LEVEL then
- difficulty = MAX_REWARD_LEVEL
+ if difficulty > ebs.Config.maxRewardLevel then
+ difficulty = ebs.Config.maxRewardLevel
end
- local duration = raidAuraBaseDuration + (raidAuraAdditionalDuration * difficulty)
+ 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.RemoveAuras(_, player)
+function ebs.RemovePlayerAuras(_, player)
player:RemoveAura(ebs.Config.raidAura)
for _,v in ipairs(ebs.Config.cityAreas) do
- player:RemoveAura(ebs.Config.cityAura[v])
+ 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 ebs.clearedDifficulty[player:GetAccountId()] == nil then
+ return
+ end
+
local difficulty = ebs.clearedDifficulty[player:GetAccountId()][RAID_IN_PROGRESS]
if not difficulty then
return
end
- if difficulty > MAX_REWARD_LEVEL then
- difficulty = MAX_REWARD_LEVEL
+ if difficulty > ebs.Config.maxRewardLevel then
+ difficulty = ebs.Config.maxRewardLevel
end
- player:AddAura(ebs.Config.cityAura[difficulty], player)
+ player:AddAura(ebs.Config.cityAuras[difficulty], player)
- -- if the player was in a main city area before, remove the auras
- elseif ebs.has_value (ebs.Config.cityAreas, oldArea) then
- ebs.RemoveAuras(_, player)
+ -- if the player was in a main city area before, remove the auras
+ else
+ ebs.RemovePlayerAuras(_, player)
end
end
@@ -123,17 +122,44 @@ function ebs.BoostReputation(_, player, factionId, standing, incremental) -- Can
if not ebs.clearedDifficulty[player:GetAccountId()] then
return
end
- if ebs.clearedDifficulty[player:GetAccountId()][RAID_IN_PROGRESS] >= MAX_REWARD_LEVEL then
+ 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.RemoveAuras )
-RegisterPlayerEvent( PLAYER_EVENT_ON_REPUTATION_CHANGE, ebs.BoostReputation )
-RegisterPlayerEvent( PLAYER_EVENT_ON_UPDATE_AREA, ebs.BuffInCity )
+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 )
+ RegisterPlayerEvent( PLAYER_EVENT_ON_LOGIN, ebs.BuffInCity )
+end
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index c4d5abd..2da6d8f 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -59,7 +59,14 @@ ebs.Config = {
["rewardRaid"] = 1,
["giveScoreParty"] = 1,
["storeParty"] = 1,
- ["rewardParty"] = 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 rewartds are given.
+ ["maxRewardLevel"] = 10
}
------------------------------------------
@@ -214,6 +221,7 @@ function ebs.isParticipating(player)
end
function ebs.resetPlayers(_, player)
+ ebs.RemovePlayerAuras(_, player)
if ebs.isParticipating(player) then
player:SetPhaseMask(1)
player:SendBroadcastMessage("You left the event.")
@@ -449,6 +457,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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])
+ print("460: " .. ebs.phaseIdDifficulty[slotId])
spawnedCreature[c]:SetData('ebs_boss_lowguid', ebs.spawnedBossGuid[slotId])
end
end
@@ -471,7 +480,7 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
end
if ebs.Config.rewardParty == 1 then
- ebs.buffInRaid(v)
+ ebs.BuffInRaid(v)
end
else
v:SendBroadcastMessage("You were too far away to join the fight.")
@@ -623,6 +632,7 @@ 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.
@@ -668,6 +678,14 @@ function ebs.loadRecords()
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
From 7462047d85344ceaaa65fc8e084bf21bca8d7e15 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Sun, 5 May 2024 11:52:31 +0200
Subject: [PATCH 23/27] remove duplicate event, fix slot choice
---
.../custom_boss_events/eventBossRewards.lua | 4 +--
scripts/custom_boss_events/eventBosses.lua | 28 +++++++++----------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/scripts/custom_boss_events/eventBossRewards.lua b/scripts/custom_boss_events/eventBossRewards.lua
index 3d71df5..bdb9662 100644
--- a/scripts/custom_boss_events/eventBossRewards.lua
+++ b/scripts/custom_boss_events/eventBossRewards.lua
@@ -96,7 +96,8 @@ 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 ebs.clearedDifficulty[player:GetAccountId()] == nil then
+ if not ebs.clearedDifficulty[player:GetAccountId()] then
+ print("returned 100")
return
end
@@ -161,5 +162,4 @@ end
if ebs.Config.rewardRaid == 1 then
RegisterPlayerEvent( PLAYER_EVENT_ON_UPDATE_AREA, ebs.BuffInCity )
- RegisterPlayerEvent( PLAYER_EVENT_ON_LOGIN, ebs.BuffInCity )
end
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 2da6d8f..92ba317 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -84,16 +84,17 @@ CharDBQuery('CREATE TABLE IF NOT EXISTS `'..ebs.Config.customDbName..'`.`eventsc
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
-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, chatHandler) - 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 ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16
-local ELUNA_EVENT_ON_LUA_STATE_OPEN = 33
+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
MECHANIC_CHARM = 1
MECHANIC_DISORIENTED= 2
@@ -271,9 +272,9 @@ function ebs.GetTimer(timer, difficulty)
end
function ebs.getFreeSlot()
- for k, v in ipairs(ebs.phaseIdDifficulty) do
- if v == nil then
- return k
+ for n = 1, 10 do
+ if ebs.phaseIdDifficulty[n] == nil then
+ return n
end
end
return 1
@@ -457,7 +458,6 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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])
- print("460: " .. ebs.phaseIdDifficulty[slotId])
spawnedCreature[c]:SetData('ebs_boss_lowguid', ebs.spawnedBossGuid[slotId])
end
end
From 9e2122bb4ff973fc8e0b2198b3de79feaea8f259 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 7 May 2024 19:58:36 +0200
Subject: [PATCH 24/27] change difficulty gossip, redesign AI script
---
scripts/custom_boss_events/eventBoss1.lua | 193 +++++++++++++--------
scripts/custom_boss_events/eventBosses.lua | 88 ++++++++--
2 files changed, 199 insertions(+), 82 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 279eca8..7b159ad 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -32,7 +32,7 @@ local addNPC = {}
--------------------------------------------------------------------------------------
-- The data below is mandatory for the main script to work with the encounter. --
--- The encounterId must be unique for each encounter. --
+-- Adjust as needed. The encounterId must be unique for each encounter. --
--------------------------------------------------------------------------------------
local encounterId = 1
@@ -48,90 +48,39 @@ ebs.encounter[encounterId] = {
}
--------------------------------------------------------------------------------------
-
+-- 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.Fire( eventid, delay, repeats, creature )
- local target = creature:GetAITarget( SELECT_TARGET_RANDOM, true, nil, -20 )
- if target then
- creature:CastSpell( target, 31340, false )
- end
-end
-
-function bossNPC.PullIn( eventid, delay, repeats, creature )
- local target = creature:GetAITarget( SELECT_TARGET_FARTHEST, true, nil, -20 )
- creature:CastSpell( target, 59395, true )
-end
-
-function bossNPC.Pool( eventid, delay, repeats, creature )
- if math.random(1,2) == 1 then
- creature:CastSpell( creature, 32014, false )
- else
- creature:CastSpell( creature:GetVictim(), 53721, false )
- end
-end
-
function bossNPC.onEnterCombat( event, creature, target )
creature:CallAssistance()
creature:CallForHelp( 200 )
local difficulty = creature:GetData('ebs_difficulty')
- -- add custom scripting below
-
- creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
+ bossNPC.CustomEnterCombat( creature, target, difficulty )
end
function bossNPC.reset( event, creature )
creature:RemoveEvents()
- -- add custom scripting below
-
- -- add custom scripting above
- ebs.bossReset(event, creature)
-end
-
-function addNPC.RemoveInterrupt( eventid, delay, repeats, add )
- add:SetImmuneTo( MECHANIC_INTERRUPT, false )
-end
-
-function addNPC.HealBoss( eventid, delay, repeats, 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:CastCustomSpell( boss, 30878, false, nil, 1000000 )
- --add:RegisterEvent( addNPC.RemoveInterrupt, 3000, 1 )
- end
- end
-end
-
-function addNPC.Splash( eventid, delay, repeats, add )
- add:CastCustomSpell( add:GetVictim(), 32014, false, nil, 150 )
+ bossNPC.CustomReset( creature )
+ ebs.bossReset( event, creature )
end
function addNPC.onEnterCombat( event, add, target )
add:CallAssistance()
local difficulty = add:GetData('ebs_difficulty')
- -- add custom scripting below
-
- 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
+ addNPC.CustomEnterCombat( add, target, difficulty )
end
function addNPC.reset( event, add )
add:RemoveEvents()
- local difficulty = add:GetData('ebs_difficulty')
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 bossLowGUID = add:GetData('ebs_boss_lowguid')
local hasValue
hasValue, slotId = ebs.returnKey ( ebs.spawnedBossGuid, bossLowGUID )
@@ -146,24 +95,124 @@ function addNPC.reset( event, add )
addDownCounter[ slotId ] = addDownCounter[ slotId ] + 1
if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
- local guid = GetUnitGUID( bossLowGUID, ebs.encounter[ encounterId ].bossEntry )
- local boss = add:GetMap():GetWorldObject( guid )
+
if boss then
- -- add custom scripting below
+ -------------------------------------------------------------------------------
+ -- last add died, boss is still alive
+ -------------------------------------------------------------------------------
+ addNPC.CustomLastAddDead( add, boss, difficulty, slotId )
- 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
+ end
+ end
+
+ addNPC.CustomReset( add, boss, difficulty, slotId )
+ ebs.addReset( event, add )
+end
+
+-------------------------------------------------------------------------------
+-- CUSTOM SCRIPTING BELOW
+-------------------------------------------------------------------------------
+
+function bossNPC.CustomEnterCombat( creature, target, difficulty )
+ creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
+end
+
+function bossNPC.CustomReset( creature )
+ -------------------------------------------------------------------------------
+ -- 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 )
+ 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 )
+ 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
- -- add custom scripting above
+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
- ebs.addReset( event, add )
+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
diff --git a/scripts/custom_boss_events/eventBosses.lua b/scripts/custom_boss_events/eventBosses.lua
index 92ba317..1b17834 100644
--- a/scripts/custom_boss_events/eventBosses.lua
+++ b/scripts/custom_boss_events/eventBosses.lua
@@ -64,9 +64,15 @@ ebs.Config = {
-- 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 rewartds are given.
- ["maxRewardLevel"] = 10
+ -- 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
}
------------------------------------------
@@ -88,14 +94,21 @@ 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
@@ -343,8 +356,19 @@ function ebs.onHello(_, player, creature)
--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
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We are ready to fight a servant! (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), PARTY_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 1)
- player:GossipMenuAddItem(OPTION_ICON_CHAT, "We brought the best there is and we're ready for anything (Difficulty " .. 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), RAID_IN_PROGRESS) .. ")", ebs.encounter[eventInProgress].npc[2], 2)
+ 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)
@@ -358,6 +382,8 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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
@@ -368,7 +394,8 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
return
end
- if intid == 1 or intid == 2 then
+ -- 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.")
@@ -392,7 +419,8 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
end
local spawnType, entry, mapId, x, y, z, o, despawnTime = table.unpack(ebs.encounter[eventInProgress].npc)
- if intid == 1 then
+
+ 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.")
@@ -400,10 +428,18 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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] = 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), ebs.fightType[slotId])
+ 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))
@@ -429,9 +465,8 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
v:SendBroadcastMessage("You were too far away to join the fight.")
end
end
- end
- if intid == 2 then
+ 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.")
@@ -439,10 +474,17 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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] = 1 + ebs.getLastSuccessfulDifficulty(player:GetAccountId(), ebs.fightType[slotId])
+ ebs.phaseIdDifficulty[slotId] = designatedDifficulty
spawnedBoss = object:SpawnCreature(ebs.encounter[eventInProgress].bossEntry, x, y, z+2, o, spawnType, despawnTime)
spawnedBoss:SetPhaseMask(ebs.Config.eventPhase[slotId])
@@ -490,6 +532,32 @@ function ebs.chromieGossip(_, player, object, sender, intid, code, menu_id)
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)
From a9463ff0c8a0a0c6f392bfaf618c5de4c2367b08 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 7 May 2024 20:05:36 +0200
Subject: [PATCH 25/27] more comments
---
scripts/custom_boss_events/eventBoss1.lua | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 7b159ad..f9cdfae 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -115,6 +115,9 @@ end
-------------------------------------------------------------------------------
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
@@ -127,6 +130,9 @@ function bossNPC.CustomReset( creature )
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
@@ -135,6 +141,9 @@ function addNPC.CustomEnterCombat( add, target, difficulty )
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 )
From 7c47d5887418c4d8326bdf1dd729081bf5f1be40 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 7 May 2024 20:37:02 +0200
Subject: [PATCH 26/27] readability
---
scripts/custom_boss_events/eventBoss1.lua | 35 ++++++++++++-----------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index f9cdfae..51f1a72 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -30,10 +30,10 @@ 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. --
---------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------
+-- 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. --
+------------------------------------------------------------------------------------------
local encounterId = 1
@@ -47,11 +47,11 @@ ebs.encounter[encounterId] = {
["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.
---------------------------------------------------------------------------------------
----
+------------------------------------------------------------------------------------------
+-- 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 )
@@ -63,7 +63,8 @@ end
function bossNPC.reset( event, creature )
creature:RemoveEvents()
- bossNPC.CustomReset( creature )
+ local difficulty = creature:GetData('ebs_difficulty')
+ bossNPC.CustomReset( creature, difficulty )
ebs.bossReset( event, creature )
end
@@ -110,9 +111,9 @@ function addNPC.reset( event, add )
ebs.addReset( event, add )
end
--------------------------------------------------------------------------------
--- CUSTOM SCRIPTING BELOW
--------------------------------------------------------------------------------
+--**********************************************************************************
+--**** CUSTOM SCRIPTING BELOW ****
+--**********************************************************************************
function bossNPC.CustomEnterCombat( creature, target, difficulty )
-------------------------------------------------------------------------------
@@ -121,7 +122,7 @@ function bossNPC.CustomEnterCombat( creature, target, difficulty )
creature:RegisterEvent( bossNPC.Fire, ebs.GetTimer( 10000, difficulty ), 0 )
end
-function bossNPC.CustomReset( creature )
+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:
@@ -218,9 +219,9 @@ function addNPC.ResumeChase( _, _, _, add )
add:UnitMoveChase()
end
--------------------------------------------------------------------------------
--- END OF CUSTOM SCRIPTING
--------------------------------------------------------------------------------
+--**********************************************************************************
+--**** END OF CUSTOM SCRIPTING ****
+--**********************************************************************************
RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 1, bossNPC.onEnterCombat )
RegisterCreatureEvent( ebs.encounter[ encounterId ].bossEntry, 2, bossNPC.reset ) -- OnLeaveCombat
From a9205457e37333e56dae2e702d1686263d5badb5 Mon Sep 17 00:00:00 2001
From: 55Honey <71938210+55Honey@users.noreply.github.com>
Date: Tue, 7 May 2024 21:03:50 +0200
Subject: [PATCH 27/27] polish AI script
---
scripts/custom_boss_events/eventBoss1.lua | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/custom_boss_events/eventBoss1.lua b/scripts/custom_boss_events/eventBoss1.lua
index 51f1a72..47d1820 100644
--- a/scripts/custom_boss_events/eventBoss1.lua
+++ b/scripts/custom_boss_events/eventBoss1.lua
@@ -33,6 +33,10 @@ 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
@@ -98,11 +102,7 @@ function addNPC.reset( event, add )
if addDownCounter[ slotId ] == ebs.encounter[ encounterId ].addAmount then
if boss then
- -------------------------------------------------------------------------------
- -- last add died, boss is still alive
- -------------------------------------------------------------------------------
addNPC.CustomLastAddDead( add, boss, difficulty, slotId )
-
end
end
end