From 862a28307eaa5c3508fa0b9777081b95d79ee5b9 Mon Sep 17 00:00:00 2001 From: Barbz Date: Wed, 19 Sep 2018 19:26:19 +0200 Subject: [PATCH 01/17] Add missing spells --- src/mod_learnspells.cpp | 69 ++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 0401952..20c3018 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -12,37 +12,42 @@ class LearnSpellsOnLevelUp : public PlayerScript LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { - uint32 temp[] = { - 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, - 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, - 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, - 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, - 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, - 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, - 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, - 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, - 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, - 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, - 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, - 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, - 20467, 20425, 67, 26017, 34471, 53254, 13812, 14314, - 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, - 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, - 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, - 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, - 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, - 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, - 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, - 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, - 26365, 26366, 26367, 26369, 26370, 26363, 26371, 26372, - 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, - 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, - 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, - 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, - 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, - 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, - 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, - 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708 + uint32 temp[] = + { + 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, + 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, + 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, + 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, + 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, + 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, + 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, + 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, + 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, + 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, + 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, + 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, + 20467, 20425, 67, 26017, 34471, 53254, 13812, 14314, + 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, + 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, + 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, + 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, + 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, + 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, + 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, + 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, + 26365, 26366, 26367, 26369, 26370, 26363, 26371, 26372, + 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, + 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, + 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, + 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, + 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, + 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, + 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, + 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708, + 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, + 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, + 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, + 18848, 16979, 49376, 54055, 20647 }; ignoreSpells = std::vector(temp, temp + sizeof(temp) / sizeof(temp[0])); @@ -190,4 +195,4 @@ void AddLearnAllSpellsScripts() { new LearnAllSpellsWorld(); new LearnSpellsOnLevelUp(); -} \ No newline at end of file +} From 82e66aabbb9cb3d057b02e63201490e0a3e26954 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Fri, 5 Apr 2019 00:06:03 +1100 Subject: [PATCH 02/17] Build: Delete pch include (#6) removing ScriptPCH , repair build using new headers --- src/mod_learnspells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 20c3018..9e91860 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -1,4 +1,4 @@ -#include "ScriptPCH.h" +#include "ScriptMgr.h" #include "DisableMgr.h" #include "Config.h" #include "Player.h" From c0399fda017987a59b7c24768a1d13d0e7cfd2b2 Mon Sep 17 00:00:00 2001 From: Barbz Date: Mon, 9 Mar 2020 23:28:02 +0100 Subject: [PATCH 03/17] fix(cpp): Add missing spells to be ignored --- src/mod_learnspells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 9e91860..d35dc75 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -47,7 +47,7 @@ class LearnSpellsOnLevelUp : public PlayerScript 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, - 18848, 16979, 49376, 54055, 20647 + 18848, 16979, 49376, 54055, 20647, 42243, 24131 }; ignoreSpells = std::vector(temp, temp + sizeof(temp) / sizeof(temp[0])); From 769e883d18d2a63ba0f08c5ac5d9cd586c8d400d Mon Sep 17 00:00:00 2001 From: Barbz Date: Mon, 9 Mar 2020 23:53:06 +0100 Subject: [PATCH 04/17] fix(cpp): Compilation missing headers + Wrong vars (#8) --- src/mod_learnspells.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index d35dc75..476ce08 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -1,4 +1,6 @@ +#include "Chat.h" #include "ScriptMgr.h" +#include "SpellInfo.h" #include "DisableMgr.h" #include "Config.h" #include "Player.h" @@ -135,7 +137,7 @@ class LearnSpellsOnLevelUp : public PlayerScript continue; if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) continue; - if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != HORDE)) + if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) continue; if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo)) continue; From e9ef8ef62e0a177c6d3af57754aabe1a58bffc0f Mon Sep 17 00:00:00 2001 From: arenacraftwow <61932925+arenacraftwow@users.noreply.github.com> Date: Wed, 1 Apr 2020 20:22:25 +0200 Subject: [PATCH 05/17] feat(cpp/conf): Add option to teach all spells on first login (#9) - Adds a `LearnAllOnFirstLogin` (default: false) option to teach the player all the spells when he first logs in, - Disabled by default because of performance concerns, - Slight optimizations have been added to mitigate this issue - However enabling this on a more populous server could cause issues due to the current design of the module --- conf/mod_learnspells.conf.dist | 6 ++ src/mod_learnspells.cpp | 113 +++++++++++++++++---------------- 2 files changed, 64 insertions(+), 55 deletions(-) diff --git a/conf/mod_learnspells.conf.dist b/conf/mod_learnspells.conf.dist index e0461b8..e9a3ebe 100644 --- a/conf/mod_learnspells.conf.dist +++ b/conf/mod_learnspells.conf.dist @@ -12,6 +12,12 @@ LearnSpells.Enable = 1 LearnSpells.Announce = 1 +# Should the player receive all spells on first login? +# Useful for instant leveling type of servers +# (1: true | 0: false) + +LearnSpells.LearnAllOnFirstLogin = 0 + # Max level Limit the player will learn spells # Default: = 80 diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 476ce08..b8e3b0f 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -10,52 +10,48 @@ uint32 MaxLevel; class LearnSpellsOnLevelUp : public PlayerScript { public: - std::vector ignoreSpells; + std::unordered_set ignoreSpells = { + 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, + 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, + 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, + 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, + 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, + 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, + 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, + 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, + 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, + 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, + 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, + 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, + 20467, 20425, 67, 26017, 34471, 53254, 13812, 14314, + 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, + 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, + 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, + 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, + 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, + 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, + 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, + 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, + 26365, 26366, 26367, 26369, 26370, 26363, 26371, 26372, + 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, + 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, + 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, + 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, + 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, + 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, + 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, + 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708, + 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, + 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, + 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, + 18848, 16979, 49376, 54055, 20647, 42243, 24131 + }; LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { - uint32 temp[] = - { - 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, - 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, - 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, - 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, - 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, - 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, - 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, - 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, - 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, - 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, - 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, - 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, - 20467, 20425, 67, 26017, 34471, 53254, 13812, 14314, - 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, - 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, - 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, - 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, - 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, - 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, - 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, - 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, - 26365, 26366, 26367, 26369, 26370, 26363, 26371, 26372, - 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, - 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, - 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, - 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, - 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, - 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, - 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, - 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708, - 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, - 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, - 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, - 18848, 16979, 49376, 54055, 20647, 42243, 24131 - }; - - ignoreSpells = std::vector(temp, temp + sizeof(temp) / sizeof(temp[0])); } - void OnLogin(Player *player) + void OnLogin(Player *player) override { if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) { @@ -66,7 +62,15 @@ class LearnSpellsOnLevelUp : public PlayerScript } } - void OnLevelChanged(Player* player, uint8 oldLevel) + void OnFirstLogin(Player *player) override + { + if (sConfigMgr->GetBoolDefault("LearnSpells.LearnAllOnFirstLogin", false)) + { + LearnSpellsForNewLevel(player, 1); + } + } + + void OnLevelChanged(Player *player, uint8 oldLevel) override { if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) { @@ -80,13 +84,11 @@ class LearnSpellsOnLevelUp : public PlayerScript bool IsIgnoredSpell(uint32 spellID) { - for (std::vector::const_iterator itr = ignoreSpells.begin(); itr != ignoreSpells.end(); ++itr) - if (spellID == (*itr)) - return true; - return false; + auto spellIt = ignoreSpells.find(spellID); + return spellIt != ignoreSpells.end(); } - void LearnSpellsForNewLevel(Player* player, uint8 level) + void LearnSpellsForNewLevel(Player *player, uint8 level) { if (level == player->getLevel() + 1) return; @@ -126,22 +128,22 @@ class LearnSpellsOnLevelUp : public PlayerScript } for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); + SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(i); if (!spellInfo) continue; if (spellInfo->SpellFamilyName != family) continue; - if (IsIgnoredSpell(spellInfo->Id)) + if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) continue; if (spellInfo->PowerType == POWER_FOCUS) continue; - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) + if (IsIgnoredSpell(spellInfo->Id)) continue; - if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) continue; if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo)) continue; - + bool valid = false; SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellInfo->Id); @@ -150,7 +152,7 @@ class LearnSpellsOnLevelUp : public PlayerScript if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0) { valid = true; - SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell(); + SpellInfo const *prevSpell = spellInfo->GetPrevRankSpell(); if (prevSpell && !player->HasSpell(prevSpell->Id)) { valid = false; @@ -173,11 +175,12 @@ class LearnSpellsOnLevelUp : public PlayerScript class LearnAllSpellsWorld : public WorldScript { public: - LearnAllSpellsWorld() : WorldScript("LearnAllSpellsWorld") { } + LearnAllSpellsWorld() : WorldScript("LearnAllSpellsWorld") {} void OnBeforeConfigLoad(bool reload) override { - if (!reload) { + if (!reload) + { std::string conf_path = _CONF_DIR; std::string cfg_file = conf_path + "/mod_learnspells.conf"; #ifdef WIN32 From 222850c1c458faa73587404a7beffc22af531802 Mon Sep 17 00:00:00 2001 From: arenacraftwow <61932925+arenacraftwow@users.noreply.github.com> Date: Wed, 8 Apr 2020 21:35:09 +0200 Subject: [PATCH 06/17] Fix: Add missing spells (#12) - Anyone can add the missing spells directly in the code - A bit hacky, but will do the job for now. --- src/mod_learnspells.cpp | 377 +++++++++++++++++++++++++++------------- 1 file changed, 261 insertions(+), 116 deletions(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index b8e3b0f..583a51a 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -1,57 +1,20 @@ #include "Chat.h" -#include "ScriptMgr.h" -#include "SpellInfo.h" -#include "DisableMgr.h" #include "Config.h" +#include "DisableMgr.h" #include "Player.h" +#include "ScriptMgr.h" +#include "SpellInfo.h" uint32 MaxLevel; class LearnSpellsOnLevelUp : public PlayerScript { -public: - std::unordered_set ignoreSpells = { - 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, - 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, - 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, - 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, - 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, - 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, - 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, - 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, - 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, - 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, - 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, - 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, - 20467, 20425, 67, 26017, 34471, 53254, 13812, 14314, - 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, - 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, - 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, - 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, - 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, - 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, - 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, - 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, - 26365, 26366, 26367, 26369, 26370, 26363, 26371, 26372, - 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, - 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, - 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, - 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, - 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, - 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, - 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, - 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708, - 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, - 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, - 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, - 18848, 16979, 49376, 54055, 20647, 42243, 24131 - }; - + public: LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { } - void OnLogin(Player *player) override + void OnLogin(Player* player) override { if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) { @@ -62,7 +25,7 @@ class LearnSpellsOnLevelUp : public PlayerScript } } - void OnFirstLogin(Player *player) override + void OnFirstLogin(Player* player) override { if (sConfigMgr->GetBoolDefault("LearnSpells.LearnAllOnFirstLogin", false)) { @@ -70,7 +33,7 @@ class LearnSpellsOnLevelUp : public PlayerScript } } - void OnLevelChanged(Player *player, uint8 oldLevel) override + void OnLevelChanged(Player* player, uint8 oldLevel) override { if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) { @@ -82,100 +45,282 @@ class LearnSpellsOnLevelUp : public PlayerScript } } + private: + std::unordered_set m_ignoreSpells = { + 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, 33110, 48084, + 28276, 27874, 27873, 7001, 49821, 53022, 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, 42938, 12484, 12485, 12486, + 44461, 55361, 55362, 34913, 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, 20467, 20425, 67, 26017, 34471, 53254, + 13812, 14314, 14315, 27026, 49064, 49065, 60202, 60210, 13797, 14298, 14299, 14300, 14301, 27024, 49053, 49054, 52399, 1742, 24453, 53548, 53562, 52016, 26064, 35346, 57386, 57389, 57390, 57391, 57392, 57393, 55509, 35886, 43339, 45297, + 45298, 45299, 45300, 45301, 45302, 49268, 49269, 8349, 8502, 8503, 11306, 11307, 25535, 25537, 61650, 61654, 63685, 45284, 45286, 45287, 45288, 45289, 45290, 45291, 45292, 45293, 45294, 45295, 45296, 49239, 49240, 26364, 26365, 26366, + 26367, 26369, 26370, 26363, 26371, 26372, 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, 44207, 44208, 48444, 48445, + 33891, 52374, 57532, 59921, 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, 20186, 20185, 20184, 20187, 25899, 24406, + 50581, 30708, 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, 18848, 16979, 49376, 54055, 20647, 42243, 24131, + }; + + struct AddSpell // Additional Spell Entry + { + uint32 spellId; + TeamId faction = TeamId::TEAM_NEUTRAL; + }; + // { level: { SPELL_FAMILY_NAME: [{ spellId: uint32, faction: TeamId }] } } + using SpellFamilyToExtraSpells = std::unordered_map>; + using AdditionalSpellsList = std::unordered_map; + // -------------------------------------------- ^^^^^ level + + AdditionalSpellsList m_additionalSpells = { + {6, + { + {SPELLFAMILY_WARRIOR, + { + AddSpell{.spellId = 3127}, // parry + }}, + }}, + {8, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{.spellId = 3127}, // parry + }}, + {SPELLFAMILY_PALADIN, + { + AddSpell{.spellId = 3127}, // parry + }}, + }}, + {10, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{.spellId = 1515}, // tame beast + }}, + }}, + {12, + { + {SPELLFAMILY_ROGUE, + { + AddSpell{.spellId = 3127}, // parry + }}, + }}, + {14, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{.spellId = 6197}, // eagle eye + }}, + }}, + {20, + { + {SPELLFAMILY_WARRIOR, + { + AddSpell{.spellId = 674}, // dual wield + AddSpell{.spellId = 12678}, // stance mastery + }}, + {SPELLFAMILY_HUNTER, + { + AddSpell{.spellId = 674}, // dual wield + }}, + }}, + {24, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{.spellId = 1462}, // Beast Lore + }}, + {SPELLFAMILY_ROGUE, + { + AddSpell{.spellId = 2836}, // Detect Traps + }}, + {SPELLFAMILY_WARLOCK, + { + AddSpell{.spellId = 5500}, // Sense Demons + }}, + }}, + {24, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{.spellId = 6196}, // Far Sight + }}, + }}, + {30, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{.spellId = 66842}, // Call of the Elements + }}, + }}, + {32, + { + {SPELLFAMILY_DRUID, + { + AddSpell{.spellId = 5225}, // Track Humanoids + }}, + }}, + {40, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{.spellId = 66843}, // Call of the Ancestors + }}, + {SPELLFAMILY_DRUID, + { + AddSpell{.spellId = 20719}, // Feline Grace + AddSpell{.spellId = 62600}, // Savage Defense + }}, + }}, + {50, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{.spellId = 66844}, // Call of the Spirits + }}, + }}, + {66, + { + {SPELLFAMILY_PALADIN, + { + AddSpell{.spellId = 53736, .faction = TeamId::TEAM_HORDE}, // Seal of Corruption + AddSpell{.spellId = 31801, .faction = TeamId::TEAM_ALLIANCE}, // Seal of Vengeance + }}, + {SPELLFAMILY_WARLOCK, + { + AddSpell{.spellId = 29858}, // Soulshatter + }}, + }}, + {70, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{.spellId = 2825, .faction = TeamId::TEAM_HORDE}, // Bloodlust + AddSpell{.spellId = 32182, .faction = TeamId::TEAM_ALLIANCE}, // Heroism + }}, + }}, + {80, + { + {SPELLFAMILY_WARLOCK, + { + AddSpell{.spellId = 47836}, // Seed of Corruption (rank 3) + }}, + }}, + }; + bool IsIgnoredSpell(uint32 spellID) { - auto spellIt = ignoreSpells.find(spellID); - return spellIt != ignoreSpells.end(); + auto spellIt = m_ignoreSpells.find(spellID); + return spellIt != m_ignoreSpells.end(); + } + + void LearnSpellsForNewLevel(Player* player, uint8 fromLevel) + { + uint8 upToLevel = player->getLevel(); + uint32 family = GetSpellFamily(player); + + for (int level = fromLevel; level <= upToLevel; level++) + { + ApplyAdditionalSpells(level, family, player); + for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); + + if (!spellInfo) + continue; + if (spellInfo->SpellFamilyName != family) + continue; + if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) + continue; + if (spellInfo->PowerType == POWER_FOCUS) + continue; + if (IsIgnoredSpell(spellInfo->Id)) + continue; + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) + continue; + if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo)) + continue; + + bool valid = false; + + SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellInfo->Id); + + for (SkillLineAbilityMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + { + if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0) + { + valid = true; + SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell(); + if (prevSpell && !player->HasSpell(prevSpell->Id)) + { + valid = false; + break; + } + if (GetTalentSpellPos(itr->second->spellId)) + if (!prevSpell || !player->HasSpell(prevSpell->Id) || spellInfo->GetRank() == 1) + valid = false; + break; + } + } + + if (valid) + player->learnSpell(spellInfo->Id); + } + } + } + + void ApplyAdditionalSpells(uint8 level, uint32 playerSpellFamily, Player* player) + { + auto spells = m_additionalSpells.find(level); + if (spells != m_additionalSpells.end()) + { + SpellFamilyToExtraSpells spellsMap = spells->second; + auto spellsForPlayersFamily = spellsMap.find(playerSpellFamily); + if (spellsForPlayersFamily != spellsMap.end()) + { + vector additionalSpellsToTeach = spellsForPlayersFamily->second; + for (auto const& spell : additionalSpellsToTeach) + { + if (!(player->HasSpell(spell.spellId)) && (spell.faction == TeamId::TEAM_NEUTRAL || spell.faction == player->GetTeamId())) + { + player->learnSpell(spell.spellId); + } + } + } + } } - void LearnSpellsForNewLevel(Player *player, uint8 level) + uint32 GetSpellFamily(const Player* p) { - if (level == player->getLevel() + 1) - return; - uint32 family; - switch (player->getClass()) + switch (p->getClass()) { case CLASS_ROGUE: - family = SPELLFAMILY_ROGUE; - break; + return SPELLFAMILY_ROGUE; case CLASS_DEATH_KNIGHT: - family = SPELLFAMILY_DEATHKNIGHT; - break; + return SPELLFAMILY_DEATHKNIGHT; case CLASS_WARRIOR: - family = SPELLFAMILY_WARRIOR; - break; + return SPELLFAMILY_WARRIOR; case CLASS_PRIEST: - family = SPELLFAMILY_PRIEST; - break; + return SPELLFAMILY_PRIEST; case CLASS_MAGE: - family = SPELLFAMILY_MAGE; - break; + return SPELLFAMILY_MAGE; case CLASS_PALADIN: - family = SPELLFAMILY_PALADIN; - break; + return SPELLFAMILY_PALADIN; case CLASS_HUNTER: - family = SPELLFAMILY_HUNTER; - break; + return SPELLFAMILY_HUNTER; case CLASS_DRUID: - family = SPELLFAMILY_DRUID; - break; + return SPELLFAMILY_DRUID; case CLASS_SHAMAN: - family = SPELLFAMILY_SHAMAN; - break; + return SPELLFAMILY_SHAMAN; case CLASS_WARLOCK: - family = SPELLFAMILY_WARLOCK; - break; - } - for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) - { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(i); - if (!spellInfo) - continue; - if (spellInfo->SpellFamilyName != family) - continue; - if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) - continue; - if (spellInfo->PowerType == POWER_FOCUS) - continue; - if (IsIgnoredSpell(spellInfo->Id)) - continue; - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) - continue; - if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo)) - continue; - - bool valid = false; - - SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellInfo->Id); - for (SkillLineAbilityMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) - { - if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0) - { - valid = true; - SpellInfo const *prevSpell = spellInfo->GetPrevRankSpell(); - if (prevSpell && !player->HasSpell(prevSpell->Id)) - { - valid = false; - break; - } - if (GetTalentSpellPos(itr->second->spellId)) - if (!prevSpell || !player->HasSpell(prevSpell->Id) || spellInfo->GetRank() == 1) - valid = false; - break; - } - } - - if (valid) - player->learnSpell(spellInfo->Id); + return SPELLFAMILY_WARLOCK; + default: + return SPELLFAMILY_GENERIC; } - LearnSpellsForNewLevel(player, ++level); } }; class LearnAllSpellsWorld : public WorldScript { -public: - LearnAllSpellsWorld() : WorldScript("LearnAllSpellsWorld") {} + public: + LearnAllSpellsWorld() : WorldScript("LearnAllSpellsWorld") + { + } void OnBeforeConfigLoad(bool reload) override { From 63a914a4f951f2586229557679822f5f4b2c2114 Mon Sep 17 00:00:00 2001 From: Barbz Date: Sat, 11 Apr 2020 21:24:28 +0200 Subject: [PATCH 07/17] fix(cpp): Now will grant spells on level 80 levelup - Before that commit, .character level 80 didn't teach any spell --- src/mod_learnspells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 583a51a..f14251a 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -37,7 +37,7 @@ class LearnSpellsOnLevelUp : public PlayerScript { if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) { - if (player->getLevel() < MaxLevel) + if (player->getLevel() <= MaxLevel) { if (oldLevel < player->getLevel()) LearnSpellsForNewLevel(player, oldLevel); From 91b8bbdf0bf870f74ae53c0260d1454c051e6a6f Mon Sep 17 00:00:00 2001 From: Helias Date: Sat, 18 Apr 2020 14:29:37 +0200 Subject: [PATCH 08/17] fix(build): add casting to uint32 --- src/mod_learnspells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index f14251a..7c6fca5 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -233,7 +233,7 @@ class LearnSpellsOnLevelUp : public PlayerScript continue; if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) continue; - if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo)) + if (spellInfo->BaseLevel != uint32(level) && sSpellMgr->IsSpellValid(spellInfo)) continue; bool valid = false; From 7204516557b4144781afc2b79955bf0964f5baa8 Mon Sep 17 00:00:00 2001 From: Barbz Date: Sat, 8 Aug 2020 20:05:04 +0200 Subject: [PATCH 09/17] fix(cpp): Ignore some vanity spells from being autolearned - Add cosmetic mage spells to the ignore list as some are not blizzlike and some are obtained ingame, thus cutting the reward from obtaining it and not being able to show it off - Same for the warlock spell ritual of doom to summon doom guard (there is another spell anyway which is learned and is much easier to use) --- src/mod_learnspells.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 7c6fca5..f3631a2 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -55,6 +55,10 @@ class LearnSpellsOnLevelUp : public PlayerScript 26367, 26369, 26370, 26363, 26371, 26372, 49278, 49279, 32176, 32175, 21169, 47206, 27285, 47833, 47836, 42223, 42224, 42225, 42226, 42218, 47817, 47818, 42231, 42232, 42233, 42230, 48466, 44203, 44205, 44206, 44207, 44208, 48444, 48445, 33891, 52374, 57532, 59921, 52372, 49142, 52375, 47633, 47632, 52373, 50536, 27214, 47822, 11682, 11681, 5857, 1010, 24907, 24905, 53227, 61391, 61390, 61388, 61387, 64801, 5421, 9635, 1178, 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708, 48076, 62900, 62901, 62902, 59671, 50589, 66906, 66907, 24131, 23455, 23458, 23459, 27803, 27804, 27805, 25329, 48075, 42243, 42244, 42245, 42234, 58432, 58433, 65878, 18848, 16979, 49376, 54055, 20647, 42243, 24131, + // COSMETIC SPELLS + 28271, 28272, 61025, 61305, 61721, 61780, + // OPTIONAL QUEST SPELLS + 18540, }; struct AddSpell // Additional Spell Entry From 3a241288c8b50d9e8c5d75aaa98b21cda2a6cac3 Mon Sep 17 00:00:00 2001 From: Helias Date: Sun, 30 Aug 2020 18:46:28 +0200 Subject: [PATCH 10/17] feat(CI): move from Travis to GitHub Actions --- .github/workflows/core-build.yml | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/core-build.yml diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml new file mode 100644 index 0000000..ce3e176 --- /dev/null +++ b/.github/workflows/core-build.yml @@ -0,0 +1,45 @@ +name: core-build +on: + push: + pull_request: + +jobs: + build: + strategy: + fail-fast: false + matrix: + compiler: [clang6, clang9, clang10] + runs-on: ubuntu-20.04 + name: ${{ matrix.compiler }} + env: + COMPILER: ${{ matrix.compiler }} + steps: + - uses: actions/checkout@v2 + with: + repository: 'azerothcore/azerothcore-wotlk' + ref: 'master' + submodules: 'recursive' + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + path: 'modules/mod-learn-spells' + - name: Cache + uses: actions/cache@v1.1.2 + with: + path: /home/runner/.ccache + key: ccache:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:${{ matrix.compiler }}:${{ github.ref }} + ccache:${{ matrix.compiler }} + - name: Configure OS + run: source ./apps/ci/ci-install.sh + env: + CONTINUOUS_INTEGRATION: true + - name: Import db + run: source ./apps/ci/ci-import-db.sh + - name: Build + run: source ./apps/ci/ci-compile.sh + - name: Dry run + run: source ./apps/ci/ci-worldserver-dry-run.sh + - name: Check startup errors + run: source ./apps/ci/ci-error-check.sh \ No newline at end of file From 0b5c081d596c7cfbb69f1f19d6b3303720d97bc1 Mon Sep 17 00:00:00 2001 From: Patrick Lewis Date: Sat, 21 Nov 2020 15:50:07 -0800 Subject: [PATCH 11/17] docs(readme): add AzerothCore logo and build status badge (#21) --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 18f9f70..c6cd98f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore ## mod-learnspells - -# LearnAllSpells module for AzerothCore. +### LearnAllSpells module for AzerothCore. +- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-learn-spells/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-learn-spells) LearnAllSpells teach new spells on level-up, like in Cataclysm and up. From 00c109f7f77d5ae6fca135db4e47da7587449378 Mon Sep 17 00:00:00 2001 From: Maarten de Jong Date: Wed, 3 Feb 2021 21:57:41 +0100 Subject: [PATCH 12/17] Update the way the struct is called to correspond with current C++ --- CMakeLists.txt | 2 +- src/{loader_learnspells.h => loader.h} | 0 src/mod_learnspells.cpp | 50 +++++++++++++------------- 3 files changed, 26 insertions(+), 26 deletions(-) rename src/{loader_learnspells.h => loader.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64557b1..3396cba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,6 @@ CU_SET_PATH("CMAKE_MOD_LEARNSPELLS_DIR" "${CMAKE_CURRENT_LIST_DIR}") AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/mod_learnspells.cpp") -AC_ADD_SCRIPT_LOADER("LearnAllSpells" "${CMAKE_CURRENT_LIST_DIR}/src/loader_learnspells.h") +AC_ADD_SCRIPT_LOADER("LearnAllSpells" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake") \ No newline at end of file diff --git a/src/loader_learnspells.h b/src/loader.h similarity index 100% rename from src/loader_learnspells.h rename to src/loader.h diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index f3631a2..b3a5969 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -76,133 +76,133 @@ class LearnSpellsOnLevelUp : public PlayerScript { {SPELLFAMILY_WARRIOR, { - AddSpell{.spellId = 3127}, // parry + AddSpell{3127}, // parry }}, }}, {8, { {SPELLFAMILY_HUNTER, { - AddSpell{.spellId = 3127}, // parry + AddSpell{3127}, // parry }}, {SPELLFAMILY_PALADIN, { - AddSpell{.spellId = 3127}, // parry + AddSpell{3127}, // parry }}, }}, {10, { {SPELLFAMILY_HUNTER, { - AddSpell{.spellId = 1515}, // tame beast + AddSpell{1515}, // tame beast }}, }}, {12, { {SPELLFAMILY_ROGUE, { - AddSpell{.spellId = 3127}, // parry + AddSpell{3127}, // parry }}, }}, {14, { {SPELLFAMILY_HUNTER, { - AddSpell{.spellId = 6197}, // eagle eye + AddSpell{6197}, // eagle eye }}, }}, {20, { {SPELLFAMILY_WARRIOR, { - AddSpell{.spellId = 674}, // dual wield - AddSpell{.spellId = 12678}, // stance mastery + AddSpell{674}, // dual wield + AddSpell{12678}, // stance mastery }}, {SPELLFAMILY_HUNTER, { - AddSpell{.spellId = 674}, // dual wield + AddSpell{674}, // dual wield }}, }}, {24, { {SPELLFAMILY_HUNTER, { - AddSpell{.spellId = 1462}, // Beast Lore + AddSpell{1462}, // Beast Lore }}, {SPELLFAMILY_ROGUE, { - AddSpell{.spellId = 2836}, // Detect Traps + AddSpell{2836}, // Detect Traps }}, {SPELLFAMILY_WARLOCK, { - AddSpell{.spellId = 5500}, // Sense Demons + AddSpell{5500}, // Sense Demons }}, }}, {24, { {SPELLFAMILY_SHAMAN, { - AddSpell{.spellId = 6196}, // Far Sight + AddSpell{6196}, // Far Sight }}, }}, {30, { {SPELLFAMILY_SHAMAN, { - AddSpell{.spellId = 66842}, // Call of the Elements + AddSpell{66842}, // Call of the Elements }}, }}, {32, { {SPELLFAMILY_DRUID, { - AddSpell{.spellId = 5225}, // Track Humanoids + AddSpell{5225}, // Track Humanoids }}, }}, {40, { {SPELLFAMILY_SHAMAN, { - AddSpell{.spellId = 66843}, // Call of the Ancestors + AddSpell{66843}, // Call of the Ancestors }}, {SPELLFAMILY_DRUID, { - AddSpell{.spellId = 20719}, // Feline Grace - AddSpell{.spellId = 62600}, // Savage Defense + AddSpell{20719}, // Feline Grace + AddSpell{62600}, // Savage Defense }}, }}, {50, { {SPELLFAMILY_SHAMAN, { - AddSpell{.spellId = 66844}, // Call of the Spirits + AddSpell{66844}, // Call of the Spirits }}, }}, {66, { {SPELLFAMILY_PALADIN, { - AddSpell{.spellId = 53736, .faction = TeamId::TEAM_HORDE}, // Seal of Corruption - AddSpell{.spellId = 31801, .faction = TeamId::TEAM_ALLIANCE}, // Seal of Vengeance + AddSpell{53736, TeamId::TEAM_HORDE}, // Seal of Corruption + AddSpell{31801, TeamId::TEAM_ALLIANCE}, // Seal of Vengeance }}, {SPELLFAMILY_WARLOCK, { - AddSpell{.spellId = 29858}, // Soulshatter + AddSpell{29858}, // Soulshatter }}, }}, {70, { {SPELLFAMILY_SHAMAN, { - AddSpell{.spellId = 2825, .faction = TeamId::TEAM_HORDE}, // Bloodlust - AddSpell{.spellId = 32182, .faction = TeamId::TEAM_ALLIANCE}, // Heroism + AddSpell{2825, TeamId::TEAM_HORDE}, // Bloodlust + AddSpell{32182, TeamId::TEAM_ALLIANCE}, // Heroism }}, }}, {80, { {SPELLFAMILY_WARLOCK, { - AddSpell{.spellId = 47836}, // Seed of Corruption (rank 3) + AddSpell{47836}, // Seed of Corruption (rank 3) }}, }}, }; From 2711418bb3cb7cd7909b1e26fe6bd36f680c3f73 Mon Sep 17 00:00:00 2001 From: Carey Brooks Date: Mon, 1 Mar 2021 13:27:59 -0600 Subject: [PATCH 13/17] Fix Config Errors --- CMakeLists.txt | 5 +--- src/mod_learnspells.cpp | 63 +++++++++++++++-------------------------- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3396cba..aeb556e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,4 @@ -CU_SET_PATH("CMAKE_MOD_LEARNSPELLS_DIR" "${CMAKE_CURRENT_LIST_DIR}") - AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/mod_learnspells.cpp") - AC_ADD_SCRIPT_LOADER("LearnAllSpells" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") -CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake") \ No newline at end of file +AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_learnspells.conf.dist") \ No newline at end of file diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index b3a5969..d77b52b 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -5,7 +5,23 @@ #include "ScriptMgr.h" #include "SpellInfo.h" -uint32 MaxLevel; +static bool learnlpells_announce; +static bool learnspells_enable; +static bool learnspells_onfirstlogin; +static uint32 learnspells_maxlevel; + +class LearnAllSpellseBeforeConfigLoad : public WorldScript { +public: + + LearnAllSpellseBeforeConfigLoad() : WorldScript("LearnAllSpellseBeforeConfigLoad") { } + + void OnBeforeConfigLoad(bool /*reload*/) override { + learnlpells_announce = sConfigMgr->GetBoolDefault("LearnSpells.Announce", 1); + learnspells_enable = sConfigMgr->GetBoolDefault("LearnSpells.Enable", 1); + learnspells_onfirstlogin = sConfigMgr->GetBoolDefault("LearnSpells.OnFirstLogin", 0); + learnspells_maxlevel = sConfigMgr->GetIntDefault("learnspells_maxlevel", 80); + } +}; class LearnSpellsOnLevelUp : public PlayerScript { @@ -16,29 +32,22 @@ class LearnSpellsOnLevelUp : public PlayerScript void OnLogin(Player* player) override { - if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) - { - if (sConfigMgr->GetBoolDefault("LearnSpells.Announce", true)) - { - ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00LearnAllSpells |rmodule."); - } + if (learnspells_enable && learnlpells_announce){ + ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00LearnAllSpells |rmodule."); } } void OnFirstLogin(Player* player) override { - if (sConfigMgr->GetBoolDefault("LearnSpells.LearnAllOnFirstLogin", false)) - { + if (learnspells_onfirstlogin){ LearnSpellsForNewLevel(player, 1); } } void OnLevelChanged(Player* player, uint8 oldLevel) override { - if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) - { - if (player->getLevel() <= MaxLevel) - { + if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)){ + if (player->getLevel() <= learnspells_maxlevel){ if (oldLevel < player->getLevel()) LearnSpellsForNewLevel(player, oldLevel); } @@ -319,34 +328,8 @@ class LearnSpellsOnLevelUp : public PlayerScript } }; -class LearnAllSpellsWorld : public WorldScript -{ - public: - LearnAllSpellsWorld() : WorldScript("LearnAllSpellsWorld") - { - } - - void OnBeforeConfigLoad(bool reload) override - { - if (!reload) - { - std::string conf_path = _CONF_DIR; - std::string cfg_file = conf_path + "/mod_learnspells.conf"; -#ifdef WIN32 - cfg_file = "mod_learnspells.conf"; -#endif - std::string cfg_def_file = cfg_file + ".dist"; - sConfigMgr->LoadMore(cfg_def_file.c_str()); - - sConfigMgr->LoadMore(cfg_file.c_str()); - - MaxLevel = sConfigMgr->GetIntDefault("MaxLevel", 80); - } - } -}; - void AddLearnAllSpellsScripts() { - new LearnAllSpellsWorld(); + new LearnAllSpellseBeforeConfigLoad(); new LearnSpellsOnLevelUp(); } From 81a0af4a8bd31f398de849a20a10c7fca34166ec Mon Sep 17 00:00:00 2001 From: Winfidonarleyan Date: Sat, 1 May 2021 02:46:36 +0700 Subject: [PATCH 14/17] feat(Misc): update --- CMakeLists.txt | 3 +- conf/mod_learnspells.conf.dist | 2 +- src/cmake/after_ws_install.cmake | 15 -- src/loader.h | 19 +- src/mod_learnspells.cpp | 308 +++++++++++++++---------------- 5 files changed, 166 insertions(+), 181 deletions(-) delete mode 100644 src/cmake/after_ws_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index aeb556e..33d536f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,3 @@ AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/mod_learnspells.cpp") AC_ADD_SCRIPT_LOADER("LearnAllSpells" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h") - -AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_learnspells.conf.dist") \ No newline at end of file +AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/mod_learnspells.conf.dist") diff --git a/conf/mod_learnspells.conf.dist b/conf/mod_learnspells.conf.dist index e9a3ebe..82e60ed 100644 --- a/conf/mod_learnspells.conf.dist +++ b/conf/mod_learnspells.conf.dist @@ -21,4 +21,4 @@ LearnSpells.LearnAllOnFirstLogin = 0 # Max level Limit the player will learn spells # Default: = 80 -MaxLevel = 80 +LearnSpells.MaxLevel = 80 diff --git a/src/cmake/after_ws_install.cmake b/src/cmake/after_ws_install.cmake deleted file mode 100644 index b566e77..0000000 --- a/src/cmake/after_ws_install.cmake +++ /dev/null @@ -1,15 +0,0 @@ -if( WIN32 ) - if ( MSVC ) - add_custom_command(TARGET worldserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_LEARNSPELLS_DIR}/conf/mod_learnspells.conf.dist" ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ - ) - elseif ( MINGW ) - add_custom_command(TARGET worldserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_LEARNSPELLS_DIR}/conf/mod_learnspells.conf.dist" ${CMAKE_BINARY_DIR}/bin/ - ) - endif() -endif() - -install(FILES "${CMAKE_MOD_LEARNSPELLS_DIR}/conf/mod_learnspells.conf.dist" DESTINATION ${CONF_DIR}) \ No newline at end of file diff --git a/src/loader.h b/src/loader.h index ce4291f..58e9daa 100644 --- a/src/loader.h +++ b/src/loader.h @@ -1 +1,18 @@ -void AddLearnAllSpellsScripts(); +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + */ + +#ifndef _LEARN_ALL_SPELLS_LOADER_H_ +#define _LEARN_ALL_SPELLS_LOADER_H_ + +// From SC +void AddSC_LearnAllSpells(); + +// Add all +void AddLearnAllSpellsScripts() +{ + AddSC_LearnAllSpells(); +} + +#endif /* _LEARN_ALL_SPELLS_LOADER_H_ */ diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index d77b52b..5de4c8a 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -5,57 +5,31 @@ #include "ScriptMgr.h" #include "SpellInfo.h" -static bool learnlpells_announce; -static bool learnspells_enable; -static bool learnspells_onfirstlogin; -static uint32 learnspells_maxlevel; - -class LearnAllSpellseBeforeConfigLoad : public WorldScript { -public: - - LearnAllSpellseBeforeConfigLoad() : WorldScript("LearnAllSpellseBeforeConfigLoad") { } - - void OnBeforeConfigLoad(bool /*reload*/) override { - learnlpells_announce = sConfigMgr->GetBoolDefault("LearnSpells.Announce", 1); - learnspells_enable = sConfigMgr->GetBoolDefault("LearnSpells.Enable", 1); - learnspells_onfirstlogin = sConfigMgr->GetBoolDefault("LearnSpells.OnFirstLogin", 0); - learnspells_maxlevel = sConfigMgr->GetIntDefault("learnspells_maxlevel", 80); - } -}; - class LearnSpellsOnLevelUp : public PlayerScript { - public: - LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") - { - } - - void OnLogin(Player* player) override - { - if (learnspells_enable && learnlpells_announce){ - ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00LearnAllSpells |rmodule."); - } - } +public: + LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { } void OnFirstLogin(Player* player) override { - if (learnspells_onfirstlogin){ + if (sConfigMgr->GetOption("LearnSpells.OnFirstLogin", 0)) + { LearnSpellsForNewLevel(player, 1); } } void OnLevelChanged(Player* player, uint8 oldLevel) override { - if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)){ - if (player->getLevel() <= learnspells_maxlevel){ - if (oldLevel < player->getLevel()) - LearnSpellsForNewLevel(player, oldLevel); - } + if (sConfigMgr->GetOption("LearnSpells.Enable", true)) + { + if (player->getLevel() <= sConfigMgr->GetOption("LearnSpells.MaxLevel", 80) && oldLevel < player->getLevel()) + LearnSpellsForNewLevel(player, oldLevel); } } - private: - std::unordered_set m_ignoreSpells = { +private: + std::unordered_set m_ignoreSpells = + { 64380, 23885, 23880, 44461, 25346, 10274, 10273, 8418, 8419, 7270, 7269, 7268, 54648, 12536, 24530, 70909, 12494, 57933, 24224, 27095, 27096, 27097, 27099, 32841, 56131, 56160, 56161, 48153, 34754, 64844, 64904, 48085, 33110, 48084, 28276, 27874, 27873, 7001, 49821, 53022, 47757, 47750, 47758, 47666, 53001, 52983, 52998, 52986, 52987, 52999, 52984, 53002, 53003, 53000, 52988, 52985, 42208, 42209, 42210, 42211, 42212, 42213, 42198, 42937, 42938, 12484, 12485, 12486, 44461, 55361, 55362, 34913, 43043, 43044, 38703, 38700, 27076, 42844, 42845, 64891, 25912, 25914, 25911, 25913, 25902, 25903, 27175, 27176, 33073, 33074, 48822, 48820, 48823, 48821, 20154, 25997, 20467, 20425, 67, 26017, 34471, 53254, @@ -80,146 +54,146 @@ class LearnSpellsOnLevelUp : public PlayerScript using AdditionalSpellsList = std::unordered_map; // -------------------------------------------- ^^^^^ level - AdditionalSpellsList m_additionalSpells = { + AdditionalSpellsList m_additionalSpells = + { {6, - { - {SPELLFAMILY_WARRIOR, - { - AddSpell{3127}, // parry - }}, - }}, + { + {SPELLFAMILY_WARRIOR, + { + AddSpell{3127}, // parry + }}, + }}, {8, - { - {SPELLFAMILY_HUNTER, - { - AddSpell{3127}, // parry - }}, - {SPELLFAMILY_PALADIN, - { - AddSpell{3127}, // parry - }}, - }}, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{3127}, // parry + }}, + {SPELLFAMILY_PALADIN, + { + AddSpell{3127}, // parry + }}, + }}, {10, - { - {SPELLFAMILY_HUNTER, - { - AddSpell{1515}, // tame beast - }}, - }}, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{1515}, // tame beast + }}, + }}, {12, - { - {SPELLFAMILY_ROGUE, - { - AddSpell{3127}, // parry - }}, - }}, + { + {SPELLFAMILY_ROGUE, + { + AddSpell{3127}, // parry + }}, + }}, {14, - { - {SPELLFAMILY_HUNTER, - { - AddSpell{6197}, // eagle eye - }}, - }}, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{6197}, // eagle eye + }}, + }}, {20, - { - {SPELLFAMILY_WARRIOR, - { - AddSpell{674}, // dual wield - AddSpell{12678}, // stance mastery - }}, - {SPELLFAMILY_HUNTER, - { - AddSpell{674}, // dual wield - }}, - }}, + { + {SPELLFAMILY_WARRIOR, + { + AddSpell{674}, // dual wield + AddSpell{12678}, // stance mastery + }}, + {SPELLFAMILY_HUNTER, + { + AddSpell{674}, // dual wield + }}, + }}, {24, - { - {SPELLFAMILY_HUNTER, - { - AddSpell{1462}, // Beast Lore - }}, - {SPELLFAMILY_ROGUE, - { - AddSpell{2836}, // Detect Traps - }}, - {SPELLFAMILY_WARLOCK, - { - AddSpell{5500}, // Sense Demons - }}, - }}, + { + {SPELLFAMILY_HUNTER, + { + AddSpell{1462}, // Beast Lore + }}, + {SPELLFAMILY_ROGUE, + { + AddSpell{2836}, // Detect Traps + }}, + {SPELLFAMILY_WARLOCK, + { + AddSpell{5500}, // Sense Demons + }}, + }}, {24, - { - {SPELLFAMILY_SHAMAN, - { - AddSpell{6196}, // Far Sight - }}, - }}, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{6196}, // Far Sight + }}, + }}, {30, - { - {SPELLFAMILY_SHAMAN, - { - AddSpell{66842}, // Call of the Elements - }}, - }}, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{66842}, // Call of the Elements + }}, + }}, {32, - { - {SPELLFAMILY_DRUID, - { - AddSpell{5225}, // Track Humanoids - }}, - }}, + { + {SPELLFAMILY_DRUID, + { + AddSpell{5225}, // Track Humanoids + }}, + }}, {40, - { - {SPELLFAMILY_SHAMAN, - { - AddSpell{66843}, // Call of the Ancestors - }}, - {SPELLFAMILY_DRUID, - { - AddSpell{20719}, // Feline Grace - AddSpell{62600}, // Savage Defense - }}, - }}, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{66843}, // Call of the Ancestors + }}, + {SPELLFAMILY_DRUID, + { + AddSpell{20719}, // Feline Grace + AddSpell{62600}, // Savage Defense + }}, + }}, {50, - { - {SPELLFAMILY_SHAMAN, - { - AddSpell{66844}, // Call of the Spirits - }}, - }}, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{66844}, // Call of the Spirits + }}, + }}, {66, - { - {SPELLFAMILY_PALADIN, - { - AddSpell{53736, TeamId::TEAM_HORDE}, // Seal of Corruption - AddSpell{31801, TeamId::TEAM_ALLIANCE}, // Seal of Vengeance - }}, - {SPELLFAMILY_WARLOCK, - { - AddSpell{29858}, // Soulshatter - }}, - }}, + { + {SPELLFAMILY_PALADIN, + { + AddSpell{53736, TeamId::TEAM_HORDE}, // Seal of Corruption + AddSpell{31801, TeamId::TEAM_ALLIANCE}, // Seal of Vengeance + }}, + {SPELLFAMILY_WARLOCK, + { + AddSpell{29858}, // Soulshatter + }}, + }}, {70, - { - {SPELLFAMILY_SHAMAN, - { - AddSpell{2825, TeamId::TEAM_HORDE}, // Bloodlust - AddSpell{32182, TeamId::TEAM_ALLIANCE}, // Heroism - }}, - }}, + { + {SPELLFAMILY_SHAMAN, + { + AddSpell{2825, TeamId::TEAM_HORDE}, // Bloodlust + AddSpell{32182, TeamId::TEAM_ALLIANCE}, // Heroism + }}, + }}, {80, - { - {SPELLFAMILY_WARLOCK, - { - AddSpell{47836}, // Seed of Corruption (rank 3) - }}, - }}, + { + {SPELLFAMILY_WARLOCK, + { + AddSpell{47836}, // Seed of Corruption (rank 3) + }}, + }}, }; bool IsIgnoredSpell(uint32 spellID) { - auto spellIt = m_ignoreSpells.find(spellID); - return spellIt != m_ignoreSpells.end(); + return m_ignoreSpells.find(spellID) != m_ignoreSpells.end(); } void LearnSpellsForNewLevel(Player* player, uint8 fromLevel) @@ -230,22 +204,29 @@ class LearnSpellsOnLevelUp : public PlayerScript for (int level = fromLevel; level <= upToLevel; level++) { ApplyAdditionalSpells(level, family, player); + for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); if (!spellInfo) continue; + if (spellInfo->SpellFamilyName != family) continue; - if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeamId() != TEAM_HORDE)) + + if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_SPECIFIC_SPELL && player->GetTeamId() != TEAM_ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_SPECIFIC_SPELL && player->GetTeamId() != TEAM_HORDE)) continue; + if (spellInfo->PowerType == POWER_FOCUS) continue; + if (IsIgnoredSpell(spellInfo->Id)) continue; + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player)) continue; + if (spellInfo->BaseLevel != uint32(level) && sSpellMgr->IsSpellValid(spellInfo)) continue; @@ -253,20 +234,23 @@ class LearnSpellsOnLevelUp : public PlayerScript SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellInfo->Id); - for (SkillLineAbilityMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + for (auto itr = bounds.first; itr != bounds.second; ++itr) { if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0) { valid = true; SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell(); + if (prevSpell && !player->HasSpell(prevSpell->Id)) { valid = false; break; } + if (GetTalentSpellPos(itr->second->spellId)) if (!prevSpell || !player->HasSpell(prevSpell->Id) || spellInfo->GetRank() == 1) valid = false; + break; } } @@ -283,6 +267,7 @@ class LearnSpellsOnLevelUp : public PlayerScript if (spells != m_additionalSpells.end()) { SpellFamilyToExtraSpells spellsMap = spells->second; + auto spellsForPlayersFamily = spellsMap.find(playerSpellFamily); if (spellsForPlayersFamily != spellsMap.end()) { @@ -328,8 +313,7 @@ class LearnSpellsOnLevelUp : public PlayerScript } }; -void AddLearnAllSpellsScripts() +void AddSC_LearnAllSpells() { - new LearnAllSpellseBeforeConfigLoad(); new LearnSpellsOnLevelUp(); } From 24d71d11a96fcdaee372063cb01f18e6476d418c Mon Sep 17 00:00:00 2001 From: Helias Date: Mon, 31 May 2021 19:29:28 +0200 Subject: [PATCH 15/17] fix: build and ci --- .github/workflows/core-build.yml | 4 ++-- src/mod_learnspells.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml index ce3e176..e1c0568 100644 --- a/.github/workflows/core-build.yml +++ b/.github/workflows/core-build.yml @@ -8,8 +8,8 @@ jobs: strategy: fail-fast: false matrix: - compiler: [clang6, clang9, clang10] - runs-on: ubuntu-20.04 + compiler: [clang] + runs-on: ubuntu-latest name: ${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 5de4c8a..5da8d7d 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -271,7 +271,7 @@ class LearnSpellsOnLevelUp : public PlayerScript auto spellsForPlayersFamily = spellsMap.find(playerSpellFamily); if (spellsForPlayersFamily != spellsMap.end()) { - vector additionalSpellsToTeach = spellsForPlayersFamily->second; + std::vector additionalSpellsToTeach = spellsForPlayersFamily->second; for (auto const& spell : additionalSpellsToTeach) { if (!(player->HasSpell(spell.spellId)) && (spell.faction == TeamId::TEAM_NEUTRAL || spell.faction == player->GetTeamId())) From b56f95cad4c301fe7f1f7910a613355d20930674 Mon Sep 17 00:00:00 2001 From: wbaileydev Date: Thu, 24 Jun 2021 21:38:06 -0400 Subject: [PATCH 16/17] fixed no member named spell id due to name changes in SkillLineAbilityEntry --- src/mod_learnspells.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 5da8d7d..7e06d1e 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -236,7 +236,7 @@ class LearnSpellsOnLevelUp : public PlayerScript for (auto itr = bounds.first; itr != bounds.second; ++itr) { - if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0) + if (itr->second->Spell == spellInfo->Id && itr->second->RaceMask == 0 && itr->second->AquireMethod == 0) { valid = true; SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell(); @@ -247,7 +247,7 @@ class LearnSpellsOnLevelUp : public PlayerScript break; } - if (GetTalentSpellPos(itr->second->spellId)) + if (GetTalentSpellPos(itr->second->Spell)) if (!prevSpell || !player->HasSpell(prevSpell->Id) || spellInfo->GetRank() == 1) valid = false; From e8da436a059f0fd7d60e9a274bcd1826a8f8768a Mon Sep 17 00:00:00 2001 From: wbaileydev Date: Thu, 24 Jun 2021 22:10:04 -0400 Subject: [PATCH 17/17] fixed typo, Aquired method to AcquiredMethod --- src/mod_learnspells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_learnspells.cpp b/src/mod_learnspells.cpp index 7e06d1e..b665530 100644 --- a/src/mod_learnspells.cpp +++ b/src/mod_learnspells.cpp @@ -236,7 +236,7 @@ class LearnSpellsOnLevelUp : public PlayerScript for (auto itr = bounds.first; itr != bounds.second; ++itr) { - if (itr->second->Spell == spellInfo->Id && itr->second->RaceMask == 0 && itr->second->AquireMethod == 0) + if (itr->second->Spell == spellInfo->Id && itr->second->RaceMask == 0 && itr->second->AcquireMethod == 0) { valid = true; SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell();