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