Skip to content

Commit 118c748

Browse files
committed
Revert "Fix Trade Skill Limit (#192)"
This commit broke guild creation This reverts commit 360ddbd.
1 parent 4daa549 commit 118c748

File tree

5 files changed

+43
-15
lines changed

5 files changed

+43
-15
lines changed

cmake/MangosParams.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(MANGOS_EXP "TBC")
22
set(MANGOS_PKG "Mangos One")
3-
set(MANGOS_WORLD_VER 2023102200)
3+
set(MANGOS_WORLD_VER 2023062700)
44
set(MANGOS_REALM_VER 2021010100)
55
set(MANGOS_AHBOT_VER 2021010100)

src/game/Object/Player.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,11 +3755,12 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
37553755
UpdateFreeTalentPoints(false);
37563756
}
37573757

3758-
// update free primary prof.points (if any, can be none in case GM .learn prof. learning)
3758+
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning)
37593759
if (sSpellMgr.IsPrimaryProfessionFirstRankSpell(spell_id))
37603760
{
37613761
uint32 freeProfs = GetFreePrimaryProfessionPoints() + 1;
3762-
if (freeProfs <= sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL))
3762+
uint32 maxProfs = GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT)) ? sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL) : 10;
3763+
if (freeProfs <= maxProfs)
37633764
{
37643765
SetFreePrimaryProfessions(freeProfs);
37653766
}
@@ -4443,7 +4444,16 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
44434444
return TRAINER_SPELL_RED;
44444445
}
44454446

4447+
bool prof = SpellMgr::IsProfessionSpell(trainer_spell->spell);
44464448

4449+
// check level requirement
4450+
if (!prof || GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL)))
4451+
{
4452+
if (getLevel() < reqLevel)
4453+
{
4454+
return TRAINER_SPELL_RED;
4455+
}
4456+
}
44474457

44484458
if (SpellChainNode const* spell_chain = sSpellMgr.GetSpellChainNode(trainer_spell->spell))
44494459
{
@@ -4460,18 +4470,12 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
44604470
}
44614471
}
44624472

4463-
// check level requirement
4464-
bool prof = SpellMgr::IsProfessionSpell(trainer_spell->spell);
4465-
if (prof || trainer_spell->reqLevel && (trainer_spell->reqLevel) < reqLevel)
4466-
{
4467-
return TRAINER_SPELL_RED;
4468-
}
4469-
44704473
// check skill requirement
4471-
if (prof || trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
4472-
{
4473-
return TRAINER_SPELL_RED;
4474-
}
4474+
if (!prof || GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL)))
4475+
if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
4476+
{
4477+
return TRAINER_SPELL_RED;
4478+
}
44754479

44764480
// exist, already checked at loading
44774481
SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->spell);
@@ -21973,7 +21977,9 @@ template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicOb
2197321977

2197421978
void Player::InitPrimaryProfessions()
2197521979
{
21976-
SetFreePrimaryProfessions(sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL));
21980+
uint32 maxProfs = GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT))
21981+
? sWorld.getConfig(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL) : 10;
21982+
SetFreePrimaryProfessions(maxProfs);
2197721983
}
2197821984

2197921985
void Player::SendComboPoints()

src/game/WorldHandlers/World.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ void World::LoadConfigSettings(bool reload)
637637

638638
setConfigMinMax(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL, "MaxPrimaryTradeSkill", 2, 0, 10);
639639

640+
setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT, "TradeSkill.GMIgnore.MaxPrimarySkillsCount", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE);
641+
setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL, "TradeSkill.GMIgnore.Level", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE);
642+
setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL, "TradeSkill.GMIgnore.Skill", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE);
643+
640644
setConfigMinMax(CONFIG_UINT32_MIN_PETITION_SIGNS, "MinPetitionSigns", 9, 0, 9);
641645

642646
setConfig(CONFIG_UINT32_GM_LOGIN_STATE, "GM.LoginState", 2);

src/game/WorldHandlers/World.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ enum eConfigUInt32Values
115115
CONFIG_UINT32_MAX_SPELL_CASTS_IN_CHAIN,
116116
CONFIG_UINT32_RABBIT_DAY,
117117
CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL,
118+
CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT,
119+
CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL,
120+
CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL,
118121
CONFIG_UINT32_MIN_PETITION_SIGNS,
119122
CONFIG_UINT32_GM_LOGIN_STATE,
120123
CONFIG_UINT32_GM_VISIBLE_STATE,

src/mangosd/mangosd.conf.dist.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,18 @@ SD3ErrorLogFile = "scriptdev3-errors.log"
706706
# Default: 2
707707
# Max : 10
708708
#
709+
# TradeSkill.GMIgnore.MaxPrimarySkillsCount
710+
# GM level starting from max primary skill count requirement ignored.
711+
# Default: 4 (Console as noneone)
712+
#
713+
# TradeSkill.GMIgnore.Level
714+
# GM level starting from trade skill level requirement ignored.
715+
# Default: 4 (Console as noneone)
716+
#
717+
# TradeSkill.GMIgnore.Skill
718+
# GM level starting from trade skill skill requirement ignored.
719+
# Default: 4 (Console as noneone)
720+
#
709721
# MinPetitionSigns
710722
# Min signatures count to creating guild (0..9).
711723
# Default: 9
@@ -820,6 +832,9 @@ TimerBar.Breath.Max = 180
820832
TimerBar.Fire.GMLevel = 4
821833
TimerBar.Fire.Max = 1
822834
MaxPrimaryTradeSkill = 2
835+
TradeSkill.GMIgnore.MaxPrimarySkillsCount = 4
836+
TradeSkill.GMIgnore.Level = 4
837+
TradeSkill.GMIgnore.Skill = 4
823838
MinPetitionSigns = 9
824839
MaxGroupXPDistance = 74
825840
MailDeliveryDelay = 3600

0 commit comments

Comments
 (0)