mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
1eca51b follow-up, nuke command.permission from orbit; it was only duplicating data already stored in the core.
(cherry picked from commit 991dc8e050)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--
|
||||
ALTER TABLE `command` DROP COLUMN `permission`;
|
||||
DELETE FROM `command` WHERE `name` IN ('reload command', 'gm', 'gm off', 'gm on');
|
||||
INSERT INTO `command` (`name`,`help`) VALUES
|
||||
('gm on', 'Syntax: .gm on
|
||||
|
||||
Enables in-game GM mode. This makes you exempt from most game mechanics.
|
||||
Among other things, it makes creatures unable to attack you, and makes you untargetable by most spells. It also makes creatures in all phases, as well as invisible creatures, visible to you.'),
|
||||
('gm off', 'Syntax: .gm off
|
||||
|
||||
Disables in-game GM mode.');
|
||||
@@ -76,7 +76,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(WORLD_UPD_WAYPOINT_SCRIPT_O, "UPDATE waypoint_scripts SET o = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, permission, help FROM command", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, help FROM command", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, name, femaleName, subname, TitleAlt, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, unit_flags3, dynamicflags, family, trainer_class, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, VehicleId, mingold, maxgold, AIName, MovementType, ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, CreatureDifficultyID, WidgetSetID, WidgetSetUnitConditionID, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId WHERE entry = ? OR 1 = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
|
||||
|
||||
@@ -497,7 +497,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_RELOAD_AREATRIGGER_TELEPORT = 625,
|
||||
RBAC_PERM_COMMAND_RELOAD_AUCTIONS = 626,
|
||||
RBAC_PERM_COMMAND_RELOAD_AUTOBROADCAST = 627,
|
||||
RBAC_PERM_COMMAND_RELOAD_COMMAND = 628,
|
||||
// 628 previously used, do not reuse
|
||||
RBAC_PERM_COMMAND_RELOAD_CONDITIONS = 629,
|
||||
RBAC_PERM_COMMAND_RELOAD_CONFIG = 630,
|
||||
RBAC_PERM_COMMAND_RELOAD_BATTLEGROUND_TEMPLATE = 631,
|
||||
|
||||
@@ -80,8 +80,7 @@ static ChatSubCommandMap COMMAND_MAP;
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string_view const name = fields[0].GetStringView();
|
||||
uint16 const permission = fields[1].GetUInt16();
|
||||
std::string_view const help = fields[2].GetStringView();
|
||||
std::string_view const help = fields[1].GetStringView();
|
||||
|
||||
ChatCommandNode* cmd = nullptr;
|
||||
ChatSubCommandMap* map = &COMMAND_MAP;
|
||||
@@ -104,14 +103,6 @@ static ChatSubCommandMap COMMAND_MAP;
|
||||
if (!cmd)
|
||||
continue;
|
||||
|
||||
if (cmd->_invoker && (cmd->_permission.RequiredPermission != permission))
|
||||
{
|
||||
TC_LOG_WARN("sql.sql", "Table `command` has permission %u for '" STRING_VIEW_FMT "' which does not match the core (%u). Overriding.",
|
||||
permission, STRING_VIEW_FMT_ARG(name), cmd->_permission.RequiredPermission);
|
||||
|
||||
cmd->_permission.RequiredPermission = static_cast<rbac::RBACPermissions>(permission);
|
||||
}
|
||||
|
||||
cmd->_help.assign(help);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ public:
|
||||
{ "ingame", HandleGMListIngameCommand, rbac::RBAC_PERM_COMMAND_GM_INGAME, Console::Yes },
|
||||
{ "list", HandleGMListFullCommand, rbac::RBAC_PERM_COMMAND_GM_LIST, Console::Yes },
|
||||
{ "visible", HandleGMVisibleCommand, rbac::RBAC_PERM_COMMAND_GM_VISIBLE, Console::No },
|
||||
{ "", HandleGMCommand, rbac::RBAC_PERM_COMMAND_GM, Console::No },
|
||||
{ "on", HandleGMOnCommand, rbac::RBAC_PERM_COMMAND_GM, Console::No },
|
||||
{ "off", HandleGMOffCommand, rbac::RBAC_PERM_COMMAND_GM, Console::No },
|
||||
};
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
@@ -222,30 +223,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//Enable\Disable GM Mode
|
||||
static bool HandleGMCommand(ChatHandler* handler, Optional<bool> enableArg)
|
||||
static bool HandleGMOnCommand(ChatHandler* handler)
|
||||
{
|
||||
Player* _player = handler->GetSession()->GetPlayer();
|
||||
|
||||
if (!enableArg)
|
||||
{
|
||||
handler->GetSession()->SendNotification(_player->IsGameMaster() ? LANG_GM_ON : LANG_GM_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (*enableArg)
|
||||
{
|
||||
_player->SetGameMaster(true);
|
||||
handler->GetSession()->SendNotification(LANG_GM_ON);
|
||||
_player->UpdateTriggerVisibility();
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->SetGameMaster(false);
|
||||
handler->GetSession()->SendNotification(LANG_GM_OFF);
|
||||
_player->UpdateTriggerVisibility();
|
||||
}
|
||||
handler->GetPlayer()->SetGameMaster(true);
|
||||
handler->GetPlayer()->UpdateTriggerVisibility();
|
||||
handler->GetSession()->SendNotification(LANG_GM_ON);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGMOffCommand(ChatHandler* handler)
|
||||
{
|
||||
handler->GetPlayer()->SetGameMaster(false);
|
||||
handler->GetPlayer()->UpdateTriggerVisibility();
|
||||
handler->GetSession()->SendNotification(LANG_GM_OFF);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -701,6 +701,8 @@ public:
|
||||
static bool HandleHelpCommand(ChatHandler* handler, Tail cmd)
|
||||
{
|
||||
Trinity::ChatCommands::SendCommandHelpFor(*handler, cmd);
|
||||
if (cmd.empty())
|
||||
Trinity::ChatCommands::SendCommandHelpFor(*handler, "help");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public:
|
||||
{ "autobroadcast", rbac::RBAC_PERM_COMMAND_RELOAD_AUTOBROADCAST, true, &HandleReloadAutobroadcastCommand, "" },
|
||||
{ "battleground_template", rbac::RBAC_PERM_COMMAND_RELOAD_BATTLEGROUND_TEMPLATE, true, &HandleReloadBattlegroundTemplate, "" },
|
||||
{ "character_template", rbac::RBAC_PERM_COMMAND_RELOAD_CHARACTER_TEMPLATE, true, &HandleReloadCharacterTemplate, "" },
|
||||
{ "command", rbac::RBAC_PERM_COMMAND_RELOAD_COMMAND, true, &HandleReloadCommandCommand, "" },
|
||||
{ "conditions", rbac::RBAC_PERM_COMMAND_RELOAD_CONDITIONS, true, &HandleReloadConditions, "" },
|
||||
{ "config", rbac::RBAC_PERM_COMMAND_RELOAD_CONFIG, true, &HandleReloadConfigCommand, "" },
|
||||
{ "conversation_template", rbac::RBAC_PERM_COMMAND_RELOAD_CONVERSATION_TEMPLATE, true, &HandleReloadConversationTemplateCommand, "" },
|
||||
@@ -204,7 +203,6 @@ public:
|
||||
|
||||
HandleReloadAccessRequirementCommand(handler, "");
|
||||
HandleReloadMailLevelRewardCommand(handler, "");
|
||||
HandleReloadCommandCommand(handler, "");
|
||||
HandleReloadReservedNameCommand(handler, "");
|
||||
HandleReloadTrinityStringCommand(handler, "");
|
||||
HandleReloadGameTeleCommand(handler, "");
|
||||
@@ -410,17 +408,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReloadCommandCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
TC_LOG_INFO("misc", "Reloading .command information...");
|
||||
Trinity::ChatCommands::LoadCommandMap();
|
||||
handler->SendGlobalGMSysMessage("DB table `command` reloaded.");
|
||||
|
||||
// do not log this invocation, otherwise we might crash (the command table we used to get here is no longer valid!)
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
TC_LOG_INFO("misc", "Re-Loading creature award reputation definitions...");
|
||||
|
||||
Reference in New Issue
Block a user