diff --git a/Source/Game/Spells/Skills/SkillDiscovery.cs b/Source/Game/Spells/Skills/SkillDiscovery.cs index b4803208b..e0ed47059 100644 --- a/Source/Game/Spells/Skills/SkillDiscovery.cs +++ b/Source/Game/Spells/Skills/SkillDiscovery.cs @@ -185,6 +185,19 @@ namespace Game.Spells return true; } + public static bool HasDiscoveredAnySpell(uint spellId, Player player) + { + var tab = SkillDiscoveryStorage.LookupByKey((int)spellId); + if (tab.Empty()) + return false; + + foreach (var item_iter in tab) + if (player.HasSpell(item_iter.spellId)) + return true; + + return false; + } + public static uint GetSkillDiscoverySpell(uint skillId, uint spellId, Player player) { uint skillvalue = skillId != 0 ? (uint)player.GetSkillValue((SkillType)skillId) : 0; diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index beecc3acd..4f98727d2 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -223,6 +223,9 @@ namespace Scripts.Spells.Generic public const uint Parachute = 45472; public const uint ParachuteBuff = 44795; + // ProfessionResearch + public const uint NorthrendInscriptionResearch = 61177; + // Trinketspells public const uint PvpTrinketAlliance = 97403; public const uint PvpTrinketHorde = 97404; @@ -2388,7 +2391,9 @@ namespace Scripts.Spells.Generic SpellCastResult CheckRequirement() { - if (SkillDiscovery.HasDiscoveredAllSpells(GetSpellInfo().Id, GetCaster().ToPlayer())) + Player player = GetCaster().ToPlayer(); + + if (SkillDiscovery.HasDiscoveredAllSpells(GetSpellInfo().Id, player)) { SetCustomCastResultMessage(SpellCustomErrors.NothingToDiscover); return SpellCastResult.CustomError; @@ -2402,12 +2407,21 @@ namespace Scripts.Spells.Generic Player caster = GetCaster().ToPlayer(); uint spellId = GetSpellInfo().Id; - // learn random explicit discovery recipe (if any) + // Learn random explicit discovery recipe (if any) + // Players will now learn 3 recipes the very first time they perform Northrend Inscription Research (3.3.0 patch notes) + if (spellId == SpellIds.NorthrendInscriptionResearch && !SkillDiscovery.HasDiscoveredAnySpell(spellId, caster)) + { + for (int i = 0; i < 2; ++i) + { + uint _discoveredSpellId = SkillDiscovery.GetExplicitDiscoverySpell(spellId, caster); + if (_discoveredSpellId != 0) + caster.LearnSpell(_discoveredSpellId, false); + } + } + uint discoveredSpellId = SkillDiscovery.GetExplicitDiscoverySpell(spellId, caster); if (discoveredSpellId != 0) caster.LearnSpell(discoveredSpellId, false); - - caster.UpdateCraftSkill(spellId); } public override void Register()