feature(Core/Spells): Allow to learn all spells for characters on cre… (#6464)

* feature(Core/Spells): Allow to learn all spells for characters on creation

* Cherry-picked from TrinityCore

* now it works =)

* Update Player.cpp
This commit is contained in:
Kitzunu
2021-06-23 23:55:10 +02:00
committed by GitHub
parent 065d403b72
commit 06ee4ea7c4
4 changed files with 496 additions and 7 deletions

View File

@@ -23957,10 +23957,20 @@ void Player::LearnCustomSpells()
// learn default race/class spells
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
ASSERT(info);
for (PlayerCreateInfoSpells::const_iterator itr = info->customSpells.begin(); itr != info->customSpells.end(); ++itr)
{
uint32 tspell = *itr;
LOG_DEBUG("entities.player.loading", "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getRace()), tspell);
LOG_DEBUG("entities.player.loading", "Player::LearnCustomSpells: Player '%s' (%s, Class: %u Race: %u): Adding initial spell (SpellID: %u)",
GetName().c_str(), GetGUID().ToString().c_str(), uint32(getClass()), uint32(getRace()), tspell);
if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
{
addSpell(tspell, true, true);
}
else // but send in normal spell in game learn case
{
learnSpell(tspell);
}
}
}

View File

@@ -1260,8 +1260,8 @@ void World::LoadConfigSettings(bool reload)
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
LOG_INFO("server.loading", "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
m_bool_configs[CONFIG_PET_LOS] = sConfigMgr->GetOption<bool>("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetOption<bool>("PlayerStart.CustomSpells", false);
m_bool_configs[CONFIG_PET_LOS] = sConfigMgr->GetOption<bool>("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetOption<bool>("PlayerStart.AllSpells", false);
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetOption<int32>("HonorPointsAfterDuel", 0);
m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetOption<bool>("PlayerStart.MapsExplored", false);
m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetOption<bool>("PlayerStart.AllReputation", false);

View File

@@ -2952,13 +2952,15 @@ ItemDelete.ItemLevel = 80
PlayerStart.AllReputation = 0
#
# PlayerStart.CustomSpells
# Description: If enabled, players will ignore spells from playercreateinfo_spellstart at character
# creation and will start with spells from the table playercreateinfo_spell_custom instead.
# PlayerStart.AllSpells
# Description: If enabled, players will start with all their class spells (not talents).
# You must populate playercreateinfo_spell_custom table with the spells you
# want, or this will not work! The table has data for all classes / races up
# to TBC expansion.
# Default: 0 - (Disabled)
# 1 - (Enabled)
PlayerStart.CustomSpells = 0
PlayerStart.AllSpells = 0
#
# PlayerStart.MapsExplored