mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Scripts: Remove old database spell script system (#31484)
This commit is contained in:
@@ -1342,7 +1342,6 @@ INSERT INTO `rbac_linked_permissions` VALUES
|
||||
(196,697),
|
||||
(196,698),
|
||||
(196,699),
|
||||
(196,700),
|
||||
(196,701),
|
||||
(196,702),
|
||||
(196,703),
|
||||
@@ -2169,7 +2168,6 @@ INSERT INTO `rbac_permissions` VALUES
|
||||
(697,'Command: reload spell_pet_auras'),
|
||||
(698,'Command: character changeaccount'),
|
||||
(699,'Command: reload spell_proc'),
|
||||
(700,'Command: reload spell_scripts'),
|
||||
(701,'Command: reload spell_target_position'),
|
||||
(702,'Command: reload spell_threats'),
|
||||
(703,'Command: reload spell_group_stack_rules'),
|
||||
@@ -2533,7 +2531,8 @@ INSERT INTO `updates` VALUES
|
||||
('2024_09_26_00_auth.sql','E37C3997FD7851EA360774AC568912846C448272','ARCHIVED','2024-09-26 18:27:26',0),
|
||||
('2024_11_22_00_auth.sql','F2C1D1572A3968E9E9D778EF7DC82778DF3EF887','ARCHIVED','2024-11-22 23:18:14',0),
|
||||
('2025_02_14_00_auth.sql','4A30E92FF519BB41C520CDBF90019291217C26A2','ARCHIVED','2025-02-14 17:20:00',0),
|
||||
('2025_10_21_00_auth.sql','1A221989F98337CB285B4328E791F5531CFD2454','ARCHIVED','2025-10-21 18:16:45',0);
|
||||
('2025_10_21_00_auth.sql','1A221989F98337CB285B4328E791F5531CFD2454','ARCHIVED','2025-10-21 18:16:45',0),
|
||||
('2026_01_12_00_auth.sql','91644588146896CA04E6B8FEDEB34CF4FEB64EEF','RELEASED','2026-01-12 21:26:18',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
5
sql/updates/auth/3.3.5/2026_01_12_00_auth.sql
Normal file
5
sql/updates/auth/3.3.5/2026_01_12_00_auth.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
--
|
||||
DELETE FROM `rbac_account_permissions` WHERE `permissionId`=700;
|
||||
DELETE FROM `rbac_default_permissions` WHERE `permissionId`=700;
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `linkedId`=700;
|
||||
DELETE FROM `rbac_permissions` WHERE `id`=700;
|
||||
3
sql/updates/world/3.3.5/2026_01_12_00_world.sql
Normal file
3
sql/updates/world/3.3.5/2026_01_12_00_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
--
|
||||
DROP TABLE IF EXISTS `spell_scripts`;
|
||||
DELETE FROM `command` WHERE `name` = 'reload spell_scripts';
|
||||
@@ -567,7 +567,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_PET_AURAS = 697,
|
||||
RBAC_PERM_COMMAND_CHARACTER_CHANGEACCOUNT = 698,
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_PROC = 699,
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_SCRIPTS = 700,
|
||||
// 700 previously used, do not reuse
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_TARGET_POSITION = 701,
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_THREATS = 702,
|
||||
RBAC_PERM_COMMAND_RELOAD_SPELL_GROUP_STACK_RULES = 703,
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
|
||||
ScriptMapMap sSpellScripts;
|
||||
ScriptMapMap sEventScripts;
|
||||
ScriptMapMap sWaypointScripts;
|
||||
|
||||
@@ -66,7 +65,6 @@ std::string GetScriptsTableNameByType(ScriptsType type)
|
||||
std::string res = "";
|
||||
switch (type)
|
||||
{
|
||||
case SCRIPTS_SPELL: res = "spell_scripts"; break;
|
||||
case SCRIPTS_EVENT: res = "event_scripts"; break;
|
||||
case SCRIPTS_WAYPOINT: res = "waypoint_scripts"; break;
|
||||
default: break;
|
||||
@@ -79,7 +77,6 @@ ScriptMapMap* GetScriptsMapByType(ScriptsType type)
|
||||
ScriptMapMap* res = nullptr;
|
||||
switch (type)
|
||||
{
|
||||
case SCRIPTS_SPELL: res = &sSpellScripts; break;
|
||||
case SCRIPTS_EVENT: res = &sEventScripts; break;
|
||||
case SCRIPTS_WAYPOINT: res = &sWaypointScripts; break;
|
||||
default: break;
|
||||
@@ -5444,9 +5441,8 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
||||
|
||||
scripts->clear(); // need for reload support
|
||||
|
||||
bool isSpellScriptTable = (type == SCRIPTS_SPELL);
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o{} FROM {}", isSpellScriptTable ? ", effIndex" : "", tableName);
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o FROM {}", tableName);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -5462,8 +5458,6 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
||||
ScriptInfo tmp;
|
||||
tmp.type = type;
|
||||
tmp.id = fields[0].GetUInt32();
|
||||
if (isSpellScriptTable)
|
||||
tmp.id |= fields[10].GetUInt8() << 24;
|
||||
tmp.delay = fields[1].GetUInt32();
|
||||
tmp.command = ScriptCommands(fields[2].GetUInt32());
|
||||
tmp.Raw.nData[0] = fields[3].GetUInt32();
|
||||
@@ -5738,35 +5732,6 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
||||
TC_LOG_INFO("server.loading", ">> Loaded {} script definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadSpellScripts()
|
||||
{
|
||||
LoadScripts(SCRIPTS_SPELL);
|
||||
|
||||
// check ids
|
||||
for (ScriptMapMap::const_iterator itr = sSpellScripts.begin(); itr != sSpellScripts.end(); ++itr)
|
||||
{
|
||||
uint32 spellId = uint32(itr->first) & 0x00FFFFFF;
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
|
||||
if (!spellInfo)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `spell_scripts` has not existing spell (Id: {}) as script id", spellId);
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellEffIndex i = SpellEffIndex((uint32(itr->first) >> 24) & 0x000000FF);
|
||||
if (uint32(i) >= MAX_SPELL_EFFECTS)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `spell_scripts` has too high effect index {} for spell (Id: {}) as script id", uint32(i), spellId);
|
||||
continue;
|
||||
}
|
||||
|
||||
//check for correct spellEffect
|
||||
if (!spellInfo->GetEffect(i).Effect || (spellInfo->GetEffect(i).Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->GetEffect(i).Effect != SPELL_EFFECT_DUMMY))
|
||||
TC_LOG_ERROR("sql.sql", "Table `spell_scripts` - spell {} effect {} is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, uint32(i));
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadEventScripts()
|
||||
{
|
||||
LoadScripts(SCRIPTS_EVENT);
|
||||
|
||||
@@ -173,8 +173,7 @@ enum ScriptsType
|
||||
{
|
||||
SCRIPTS_FIRST = 1,
|
||||
|
||||
SCRIPTS_SPELL = SCRIPTS_FIRST,
|
||||
SCRIPTS_EVENT,
|
||||
SCRIPTS_EVENT = SCRIPTS_FIRST,
|
||||
SCRIPTS_WAYPOINT,
|
||||
|
||||
SCRIPTS_LAST
|
||||
@@ -412,7 +411,6 @@ typedef std::multimap<uint32, ScriptInfo> ScriptMap;
|
||||
typedef std::map<uint32, ScriptMap> ScriptMapMap;
|
||||
typedef std::multimap<uint32 /*spell id*/, std::pair<uint32 /*script id*/, bool /*enabled*/>> SpellScriptsContainer;
|
||||
typedef std::pair<SpellScriptsContainer::iterator, SpellScriptsContainer::iterator> SpellScriptsBounds;
|
||||
TC_GAME_API extern ScriptMapMap sSpellScripts;
|
||||
TC_GAME_API extern ScriptMapMap sEventScripts;
|
||||
TC_GAME_API extern ScriptMapMap sWaypointScripts;
|
||||
|
||||
@@ -1138,7 +1136,6 @@ class TC_GAME_API ObjectMgr
|
||||
bool LoadTrinityStrings();
|
||||
|
||||
void LoadEventScripts();
|
||||
void LoadSpellScripts();
|
||||
void LoadWaypointScripts();
|
||||
|
||||
void LoadSpellScriptNames();
|
||||
|
||||
@@ -699,10 +699,6 @@ void Spell::EffectDummy()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// normal DB scripted effect
|
||||
TC_LOG_DEBUG("spells", "Spell ScriptStart spellid {} in EffectDummy({})", m_spellInfo->Id, uint32(effectInfo->EffectIndex));
|
||||
m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effectInfo->EffectIndex << 24)), m_caster, unitTarget);
|
||||
}
|
||||
|
||||
void Spell::EffectTriggerSpell()
|
||||
@@ -3572,10 +3568,6 @@ void Spell::EffectScriptEffect()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// normal DB scripted effect
|
||||
TC_LOG_DEBUG("spells", "Spell ScriptStart spellid {} in EffectScriptEffect({})", m_spellInfo->Id, uint32(effectInfo->EffectIndex));
|
||||
m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effectInfo->EffectIndex << 24)), m_caster, unitTarget);
|
||||
}
|
||||
|
||||
void Spell::EffectSanctuary()
|
||||
|
||||
@@ -2087,7 +2087,6 @@ void World::SetInitialWorldSettings()
|
||||
LoadAutobroadcasts();
|
||||
|
||||
///- Load and initialize scripts
|
||||
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sObjectMgr->LoadWaypointScripts();
|
||||
|
||||
|
||||
@@ -155,7 +155,6 @@ public:
|
||||
{ "spell_linked_spell", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_LINKED_SPELL, true, &HandleReloadSpellLinkedSpellCommand, "" },
|
||||
{ "spell_pet_auras", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_PET_AURAS, true, &HandleReloadSpellPetAurasCommand, "" },
|
||||
{ "spell_proc", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_PROC, true, &HandleReloadSpellProcsCommand, "" },
|
||||
{ "spell_scripts", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_SCRIPTS, true, &HandleReloadSpellScriptsCommand, "" },
|
||||
{ "spell_target_position", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_TARGET_POSITION, true, &HandleReloadSpellTargetPositionCommand, "" },
|
||||
{ "spell_threats", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_THREATS, true, &HandleReloadSpellThreatsCommand, "" },
|
||||
{ "spell_group_stack_rules", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_GROUP_STACK_RULES, true, &HandleReloadSpellGroupStackRulesCommand, "" },
|
||||
@@ -271,7 +270,6 @@ public:
|
||||
|
||||
TC_LOG_INFO("misc", "Re-Loading Scripts...");
|
||||
HandleReloadEventScriptsCommand(handler, "a");
|
||||
HandleReloadSpellScriptsCommand(handler, "a");
|
||||
handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded.");
|
||||
HandleReloadWpScriptsCommand(handler, "a");
|
||||
HandleReloadWpCommand(handler, "a");
|
||||
@@ -956,26 +954,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (sMapMgr->IsScriptScheduled())
|
||||
{
|
||||
handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*args != 'a')
|
||||
TC_LOG_INFO("misc", "Re-Loading Scripts from `spell_scripts`...");
|
||||
|
||||
sObjectMgr->LoadSpellScripts();
|
||||
|
||||
if (*args != 'a')
|
||||
handler->SendGlobalGMSysMessage("DB table `spell_scripts` reloaded.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
TC_LOG_INFO("misc", "Re-Loading Graveyard-zone links...");
|
||||
|
||||
Reference in New Issue
Block a user