feat(Core/Command): add GM spectator to allow cross-faction /follow (#22393)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `acore_string` WHERE `entry` IN (6617, 6618);
|
||||||
|
INSERT INTO `acore_string` (`entry`, `content_default`) VALUES
|
||||||
|
(6617, 'GM Spectator is ON'),
|
||||||
|
(6618, 'GM Spectator is OFF');
|
||||||
@@ -597,6 +597,7 @@ enum PlayerExtraFlags
|
|||||||
PLAYER_EXTRA_SPECTATOR_ON = 0x0080, // Marks if player is spectactor
|
PLAYER_EXTRA_SPECTATOR_ON = 0x0080, // Marks if player is spectactor
|
||||||
PLAYER_EXTRA_PVP_DEATH = 0x0100, // store PvP death status until corpse creating.
|
PLAYER_EXTRA_PVP_DEATH = 0x0100, // store PvP death status until corpse creating.
|
||||||
PLAYER_EXTRA_SHOW_DK_PET = 0x0400, // Marks if player should see ghoul on login screen
|
PLAYER_EXTRA_SHOW_DK_PET = 0x0400, // Marks if player should see ghoul on login screen
|
||||||
|
PLAYER_EXTRA_GM_SPECTATOR = 0x0800,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2^n values
|
// 2^n values
|
||||||
@@ -1177,6 +1178,9 @@ public:
|
|||||||
void SetGameMaster(bool on);
|
void SetGameMaster(bool on);
|
||||||
[[nodiscard]] bool isGMChat() const { return m_ExtraFlags & PLAYER_EXTRA_GM_CHAT; }
|
[[nodiscard]] bool isGMChat() const { return m_ExtraFlags & PLAYER_EXTRA_GM_CHAT; }
|
||||||
void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
|
void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
|
||||||
|
[[nodiscard]] bool IsGMSpectator() const { return m_ExtraFlags & PLAYER_EXTRA_GM_SPECTATOR; }
|
||||||
|
void SetGMSpectator(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_SPECTATOR; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_SPECTATOR; }
|
||||||
|
|
||||||
[[nodiscard]] bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; }
|
[[nodiscard]] bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; }
|
||||||
void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
|
void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
|
||||||
[[nodiscard]] bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
|
[[nodiscard]] bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
|
||||||
|
|||||||
@@ -20791,6 +20791,10 @@ void Unit::PatchValuesUpdate(ByteBuffer& valuesUpdateBuf, BuildValuesCachePosPoi
|
|||||||
{
|
{
|
||||||
valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
|
valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
|
||||||
}
|
}
|
||||||
|
else if (target->IsGMSpectator() && IsControlledByPlayer())
|
||||||
|
{
|
||||||
|
valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
|
sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
|
||||||
|
|||||||
@@ -1171,8 +1171,10 @@ enum AcoreStrings
|
|||||||
LANG_GM_ANNOUNCE_COLOR = 6615,
|
LANG_GM_ANNOUNCE_COLOR = 6615,
|
||||||
|
|
||||||
LANG_GM_SILENCE = 6616, // "Silence is ON for %s" - Spell 1852
|
LANG_GM_SILENCE = 6616, // "Silence is ON for %s" - Spell 1852
|
||||||
|
LANG_GM_SPECTATOR_ON = 6617,
|
||||||
|
LANG_GM_SPECTATOR_OFF = 6618,
|
||||||
|
|
||||||
// Free strings 6617-7522
|
// Free strings 6619-7522
|
||||||
|
|
||||||
LANG_WORLD_CLOSED = 7523,
|
LANG_WORLD_CLOSED = 7523,
|
||||||
LANG_WORLD_OPENED = 7524,
|
LANG_WORLD_OPENED = 7524,
|
||||||
|
|||||||
@@ -38,13 +38,14 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable gmCommandTable =
|
static ChatCommandTable gmCommandTable =
|
||||||
{
|
{
|
||||||
{ "chat", HandleGMChatCommand, SEC_GAMEMASTER, Console::No },
|
{ "chat", HandleGMChatCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "fly", HandleGMFlyCommand, SEC_GAMEMASTER, Console::No },
|
{ "fly", HandleGMFlyCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "ingame", HandleGMListIngameCommand, SEC_PLAYER, Console::Yes },
|
{ "ingame", HandleGMListIngameCommand, SEC_PLAYER, Console::Yes },
|
||||||
{ "list", HandleGMListFullCommand, SEC_ADMINISTRATOR, Console::Yes },
|
{ "list", HandleGMListFullCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||||
{ "visible", HandleGMVisibleCommand, SEC_GAMEMASTER, Console::No },
|
{ "visible", HandleGMVisibleCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "on", HandleGMOnCommand, SEC_MODERATOR, Console::No },
|
{ "on", HandleGMOnCommand, SEC_MODERATOR, Console::No },
|
||||||
{ "off", HandleGMOffCommand, SEC_MODERATOR, Console::No }
|
{ "off", HandleGMOffCommand, SEC_MODERATOR, Console::No },
|
||||||
|
{ "spectator", HandleGMSpectatorCommand, SEC_GAMEMASTER, Console::No },
|
||||||
};
|
};
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
@@ -236,6 +237,19 @@ public:
|
|||||||
handler->SendNotification(LANG_GM_OFF);
|
handler->SendNotification(LANG_GM_OFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool HandleGMSpectatorCommand(ChatHandler* handler, Optional<bool> enable)
|
||||||
|
{
|
||||||
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
|
|
||||||
|
if (enable.has_value())
|
||||||
|
player->SetGMSpectator(*enable);
|
||||||
|
else
|
||||||
|
player->SetGMSpectator(!player->IsGMSpectator());
|
||||||
|
handler->SendNotification(player->IsGMSpectator() ? LANG_GM_SPECTATOR_ON : LANG_GM_SPECTATOR_OFF);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_gm_commandscript()
|
void AddSC_gm_commandscript()
|
||||||
|
|||||||
Reference in New Issue
Block a user