[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.
This commit is contained in:
VladimirMangos 2011-06-18 03:53:51 +04:00
parent 479cfcf84a
commit 4bedd22a3f
5 changed files with 40 additions and 10 deletions

View file

@ -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()

View file

@ -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);

View file

@ -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,

View file

@ -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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11639"
#define REVISION_NR "11640"
#endif // __REVISION_NR_H__