feat(Core\Player): Added createplayerinfo_cast_spell support cast spell for some class spells (#9448)
This commit is contained in:
@@ -339,6 +339,7 @@ struct PlayerInfo
|
||||
uint16 displayId_f{0};
|
||||
PlayerCreateInfoItems item;
|
||||
PlayerCreateInfoSpells customSpells;
|
||||
PlayerCreateInfoSpells castSpells;
|
||||
PlayerCreateInfoActions action;
|
||||
PlayerCreateInfoSkills skills;
|
||||
|
||||
|
||||
@@ -3607,6 +3607,63 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
}
|
||||
|
||||
// Load playercreate cast spell
|
||||
LOG_INFO("server.loading", "Loading Player Create Cast Spell Data...");
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, spell FROM playercreateinfo_cast_spell");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("server.loading", ">> Loaded 0 player create cast spells. DB table `playercreateinfo_cast_spell` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 raceMask = fields[0].GetUInt32();
|
||||
uint32 classMask = fields[1].GetUInt32();
|
||||
uint32 spellId = fields[2].GetUInt32();
|
||||
|
||||
if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_cast_spell` table, ignoring.", raceMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_cast_spell` table, ignoring.", classMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
|
||||
{
|
||||
if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask))
|
||||
{
|
||||
for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
|
||||
{
|
||||
if (classMask == 0 || ((1 << (classIndex - 1)) & classMask))
|
||||
{
|
||||
if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
|
||||
{
|
||||
info->castSpells.push_back(spellId);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u player create cast spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
}
|
||||
|
||||
// Load playercreate actions
|
||||
LOG_INFO("server.loading", "Loading Player Create Action Data...");
|
||||
{
|
||||
|
||||
@@ -982,13 +982,22 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
bool firstLogin = pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST);
|
||||
if (firstLogin)
|
||||
{
|
||||
|
||||
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
|
||||
|
||||
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(pCurrChar->getRace(), pCurrChar->getClass());
|
||||
for (uint32 spellId : info->castSpells)
|
||||
{
|
||||
pCurrChar->CastSpell(pCurrChar, spellId, true);
|
||||
}
|
||||
|
||||
// start with every map explored
|
||||
if (sWorld->getBoolConfig(CONFIG_START_ALL_EXPLORED))
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; i++)
|
||||
{
|
||||
pCurrChar->SetFlag(PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
// Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way
|
||||
|
||||
Reference in New Issue
Block a user