diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 20540701f..0cc0703d3 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -38,6 +38,7 @@ #include "Util.h" #include "ArenaTeam.h" #include "Language.h" +#include "SpellMgr.h" // config option SkipCinematics supported values enum CinematicsSkipMode @@ -792,7 +793,12 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) SendNotification(LANG_GM_ON); if (!pCurrChar->isGMVisible()) + { SendNotification(LANG_INVISIBLE_INVISIBLE); + SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); + if (!invisibleAuraInfo || !IsSpellAppliesAura(invisibleAuraInfo)) + pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, true); + } std::string IP_str = GetRemoteAddress(); sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid: %u)", diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index fd075a1cb..e2bfd1add 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -33,6 +33,7 @@ #include "MapPersistentStateMgr.h" #include "Mail.h" #include "Util.h" +#include "SpellMgr.h" #ifdef _DEBUG_VMAPS #include "VMapFactory.h" #endif @@ -231,15 +232,24 @@ bool ChatHandler::HandleGMVisibleCommand(char* args) return false; } + Player* player = m_session->GetPlayer(); + SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); + if (!invisibleAuraInfo || !IsSpellAppliesAura(invisibleAuraInfo)) + invisibleAuraInfo = NULL; + if (value) { - m_session->GetPlayer()->SetGMVisible(true); + player->SetGMVisible(true); m_session->SendNotification(LANG_INVISIBLE_VISIBLE); + if (invisibleAuraInfo) + player->RemoveAurasDueToSpell(invisibleAuraInfo->Id); } else { m_session->SendNotification(LANG_INVISIBLE_INVISIBLE); - m_session->GetPlayer()->SetGMVisible(false); + player->SetGMVisible(false); + if (invisibleAuraInfo) + player->CastSpell(player, invisibleAuraInfo, true); } return true; diff --git a/src/game/World.cpp b/src/game/World.cpp index db9d33ca2..93d82cfe5 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -628,6 +628,7 @@ void World::LoadConfigSettings(bool reload) setConfigMinMax(CONFIG_UINT32_START_GM_LEVEL, "GM.StartLevel", 1, getConfig(CONFIG_UINT32_START_PLAYER_LEVEL), MAX_LEVEL); setConfig(CONFIG_BOOL_GM_LOWER_SECURITY, "GM.LowerSecurity", false); setConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS, "GM.AllowAchievementGain", true); + setConfig(CONFIG_UINT32_GM_INVISIBLE_AURA, "GM.InvisibleAura", 37800); setConfig(CONFIG_UINT32_GROUP_VISIBILITY, "Visibility.GroupMode", 0); diff --git a/src/game/World.h b/src/game/World.h index 1a93600d0..660b636b6 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -129,6 +129,7 @@ enum eConfigUInt32Values CONFIG_UINT32_GM_LEVEL_IN_GM_LIST, CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST, CONFIG_UINT32_START_GM_LEVEL, + CONFIG_UINT32_GM_INVISIBLE_AURA, CONFIG_UINT32_GROUP_VISIBILITY, CONFIG_UINT32_MAIL_DELIVERY_DELAY, CONFIG_UINT32_MASS_MAILER_SEND_PER_TICK, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 47ec35b58..0c8b1418d 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -1139,6 +1139,11 @@ Channel.SilentlyGMJoin = 0 # Default: 1 (enable) # 0 (disable) # +# GM.InvisibleAura +# A spell that will be cast when a gm uses ".gm visible off" (Must be aura spell) +# Default: 37800 (50% Transparency) +# 0 (Disabled) +# ################################################################################################################### GM.LoginState = 2 @@ -1152,6 +1157,7 @@ GM.LogTrade = 1 GM.StartLevel = 1 GM.LowerSecurity = 0 GM.AllowAchievementGain = 1 +GM.InvisibleAura = 37800 ################################################################################################################### # VISIBILITY AND RADIUSES diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a28de5bdf..b4f0dab72 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12042" + #define REVISION_NR "12043" #endif // __REVISION_NR_H__