From 4bedd22a3fc2fc8ff5ce68c48964772354a5d7c0 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 18 Jun 2011 03:53:51 +0400 Subject: [PATCH] [11640] Implement TradeSkill.GMIgnore.* config options Options let set GM level that allow ignore at training level/skill/maxprofs Mostly for allow avoid use commands when need learn prof ranks. --- src/game/Player.cpp | 23 +++++++++++++++-------- src/game/World.cpp | 7 ++++++- src/game/World.h | 3 +++ src/mangosd/mangosd.conf.dist.in | 15 +++++++++++++++ src/shared/revision_nr.h | 2 +- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b84eec9d8..4b35c3649 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3464,7 +3464,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo if(sSpellMgr.IsPrimaryProfessionFirstRankSpell(spell_id)) { uint32 freeProfs = GetFreePrimaryProfessionPoints()+1; - if(freeProfs <= sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL)) + uint32 maxProfs = GetSession()->GetSecurity() < sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT) ? sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL) : 10; + if(freeProfs <= maxProfs) SetFreePrimaryProfessions(freeProfs); } @@ -4093,16 +4094,19 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell return TRAINER_SPELL_RED; // known spell - if(HasSpell(trainer_spell->learnedSpell)) + if (HasSpell(trainer_spell->learnedSpell)) return TRAINER_SPELL_GRAY; // check race/class requirement - if(!IsSpellFitByClassAndRace(trainer_spell->learnedSpell)) + if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell)) return TRAINER_SPELL_RED; + bool prof = SpellMgr::IsProfessionSpell(trainer_spell->learnedSpell); + // check level requirement - if(getLevel() < trainer_spell->reqLevel) - return TRAINER_SPELL_RED; + if (prof && GetSession()->GetSecurity() < sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL)) + if (getLevel() < trainer_spell->reqLevel) + return TRAINER_SPELL_RED; if(SpellChainNode const* spell_chain = sSpellMgr.GetSpellChainNode(trainer_spell->learnedSpell)) { @@ -4116,8 +4120,9 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell } // check skill requirement - if(trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue) - return TRAINER_SPELL_RED; + if (prof && GetSession()->GetSecurity() < sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL)) + if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue) + return TRAINER_SPELL_RED; // exist, already checked at loading SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->learnedSpell); @@ -20015,7 +20020,9 @@ void Player::SetPhaseMask(uint32 newPhaseMask, bool update) void Player::InitPrimaryProfessions() { - SetFreePrimaryProfessions(sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL)); + uint32 maxProfs = GetSession()->GetSecurity() < sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT) + ? sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL) : 10; + SetFreePrimaryProfessions(maxProfs); } void Player::SendComboPoints() diff --git a/src/game/World.cpp b/src/game/World.cpp index 8f7e136aa..104b8a807 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -603,7 +603,12 @@ void World::LoadConfigSettings(bool reload) setConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR, "Instance.ResetTimeHour", 4); setConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY, "Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS); - setConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL, "MaxPrimaryTradeSkill", 2); + setConfigMinMax(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL, "MaxPrimaryTradeSkill", 2, 0, 10); + + setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT, "TradeSkill.GMIgnore.MaxPrimarySkillsCount", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE); + setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL, "TradeSkill.GMIgnore.Level", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE); + setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL, "TradeSkill.GMIgnore.Skill", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE); + setConfigMinMax(CONFIG_UINT32_MIN_PETITION_SIGNS, "MinPetitionSigns", 9, 0, 9); setConfig(CONFIG_UINT32_GM_LOGIN_STATE, "GM.LoginState", 2); diff --git a/src/game/World.h b/src/game/World.h index df6072199..6b49a6471 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -116,6 +116,9 @@ enum eConfigUInt32Values CONFIG_UINT32_MAX_SPELL_CASTS_IN_CHAIN, CONFIG_UINT32_BIRTHDAY_TIME, CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL, + CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT, + CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL, + CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL, CONFIG_UINT32_MIN_PETITION_SIGNS, CONFIG_UINT32_GM_LOGIN_STATE, CONFIG_UINT32_GM_VISIBLE_STATE, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index cf73e54b0..80036087e 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -665,6 +665,18 @@ LogColors = "" # Default: 2 # Max : 10 # +# TradeSkill.GMIgnore.MaxPrimarySkillsCount +# GM level starting from max primary skill count requirement ignored. +# Default: 4 (Console as noneone) +# +# TradeSkill.GMIgnore.Level +# GM level starting from trade skill level requirement ignored. +# Default: 4 (Console as noneone) +# +# TradeSkill.GMIgnore.Skill +# GM level starting from trade skill skill requirement ignored. +# Default: 4 (Console as noneone) +# # MinPetitionSigns # Min signatures count to creating guild (0..9). # Default: 9 @@ -788,6 +800,9 @@ TimerBar.Breath.Max = 180 TimerBar.Fire.GMLevel = 4 TimerBar.Fire.Max = 1 MaxPrimaryTradeSkill = 2 +TradeSkill.GMIgnore.MaxPrimarySkillsCount = 4 +TradeSkill.GMIgnore.Level = 4 +TradeSkill.GMIgnore.Skill = 4 MinPetitionSigns = 9 MaxGroupXPDistance = 74 MailDeliveryDelay = 3600 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 64d21930d..0cba266e1 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 "11639" + #define REVISION_NR "11640" #endif // __REVISION_NR_H__