From 475e8cbcf6b2711406968265e59bfe549d72237c Mon Sep 17 00:00:00 2001 From: ApoC Date: Sat, 24 Jan 2009 17:38:54 +0100 Subject: [PATCH] [7161] Implemented configurable option to allow/disallow achievements gain for GMs. Signed-off-by: ApoC --- src/game/AchievementMgr.cpp | 4 ++++ src/game/World.cpp | 1 + src/game/World.h | 1 + src/mangosd/mangosd.conf.dist.in | 24 +++++++++++++++--------- src/shared/revision_nr.h | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 8d7b0e542..0561daf1a 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -325,6 +325,10 @@ void AchievementMgr::CheckAllAchievementCriteria() void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time) { sLog.outDetail("AchievementMgr::UpdateAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time); + + if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) + return; + AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) { diff --git a/src/game/World.cpp b/src/game/World.cpp index 03ed7ea45..e7bfc2e7a 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -799,6 +799,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_configs[CONFIG_GM_LOWER_SECURITY] = sConfig.GetBoolDefault("GM.LowerSecurity", false); + m_configs[CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS] = sConfig.GetBoolDefault("GM.AllowAchievementGain", true); m_configs[CONFIG_GROUP_VISIBILITY] = sConfig.GetIntDefault("Visibility.GroupMode",0); diff --git a/src/game/World.h b/src/game/World.h index 3f2640ffa..dc4210685 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -130,6 +130,7 @@ enum WorldConfigs CONFIG_GM_LOG_TRADE, CONFIG_START_GM_LEVEL, CONFIG_GM_LOWER_SECURITY, + CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS, CONFIG_GROUP_VISIBILITY, CONFIG_MAIL_DELIVERY_DELAY, CONFIG_UPTIME_UPDATE, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 700e1c3c8..0f897d45a 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -875,17 +875,23 @@ Channel.SilentlyGMJoin = 0 # Default: 0 (disable) # 1 (enable) # +# GM.AllowAchievementGain +# If enabled it allows gaining achievements for GM characters +# Default: 0 (disable) +# 1 (enable) (default) +# ################################################################################################################### -GM.LoginState = 2 -GM.AcceptTickets = 2 -GM.Chat = 2 -GM.WhisperingTo = 2 -GM.InGMList = 0 -GM.InWhoList = 0 -GM.LogTrade = 1 -GM.StartLevel = 1 -GM.LowerSecurity = 0 +GM.LoginState = 2 +GM.AcceptTickets = 2 +GM.Chat = 2 +GM.WhisperingTo = 2 +GM.InGMList = 0 +GM.InWhoList = 0 +GM.LogTrade = 1 +GM.StartLevel = 1 +GM.LowerSecurity = 0 +GM.AllowAchievementGain = 1 ################################################################################################################### # VISIBILITY AND RADIUSES diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d117accab..bd887b8ea 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 "7160" + #define REVISION_NR "7161" #endif // __REVISION_NR_H__