Core/Characters: Added allied race creation data, implemented intro scenes & added config option to disable achievement requirements for allied races (#26974)

This commit is contained in:
ModoX
2021-10-05 18:17:29 +02:00
committed by GitHub
parent 6d93f0a5f7
commit 71eb30f89d
8 changed files with 1198 additions and 16 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1836,6 +1836,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void ResurrectUsingRequestData();
void ResurrectUsingRequestDataImpl();
PlayerCreateMode GetCreateMode() const { return m_createMode; }
uint8 getCinematic() const { return m_cinematic; }
void setCinematic(uint8 cine) { m_cinematic = cine; }

View File

@@ -3476,8 +3476,8 @@ void ObjectMgr::LoadPlayerInfo()
// Load playercreate
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult result = WorldDatabase.Query("SELECT race, class, map, position_x, position_y, position_z, orientation, npe_map, npe_position_x, npe_position_y, npe_position_z, npe_orientation, npe_transport_guid FROM playercreateinfo");
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
QueryResult result = WorldDatabase.Query("SELECT race, class, map, position_x, position_y, position_z, orientation, npe_map, npe_position_x, npe_position_y, npe_position_z, npe_orientation, npe_transport_guid, intro_movie_id, intro_scene_id, npe_intro_scene_id FROM playercreateinfo");
if (!result)
{
@@ -3563,6 +3563,36 @@ void ObjectMgr::LoadPlayerInfo()
}
}
if (!fields[13].IsNull())
{
uint32 introMovieId = fields[13].GetUInt32();
if (sMovieStore.LookupEntry(introMovieId))
info->introMovieId = introMovieId;
else
TC_LOG_ERROR("sql.sql", "Invalid intro movie id %u for class %u race %u pair in `playercreateinfo` table, ignoring.",
introMovieId, current_class, current_race);
}
if (!fields[14].IsNull())
{
uint32 introSceneId = fields[14].GetUInt32();
if (GetSceneTemplate(introSceneId))
info->introSceneId = introSceneId;
else
TC_LOG_ERROR("sql.sql", "Invalid intro scene id %u for class %u race %u pair in `playercreateinfo` table, ignoring.",
introSceneId, current_class, current_race);
}
if (!fields[15].IsNull())
{
uint32 introSceneId = fields[15].GetUInt32();
if (GetSceneTemplate(introSceneId))
info->introSceneIdNPE = introSceneId;
else
TC_LOG_ERROR("sql.sql", "Invalid NPE intro scene id %u for class %u race %u pair in `playercreateinfo` table, ignoring.",
introSceneId, current_class, current_race);
}
_playerInfo[current_race][current_class] = std::move(info);
++count;

View File

@@ -612,6 +612,10 @@ struct PlayerInfo
PlayerCreateInfoActions action;
PlayerCreateInfoSkills skills;
Optional<uint32> introMovieId;
Optional<uint32> introSceneId;
Optional<uint32> introSceneIdNPE;
//[level-1] 0..MaxPlayerLevel-1
std::unique_ptr<PlayerLevelInfo[]> levelInfo;
};

View File

@@ -438,6 +438,9 @@ void WorldSession::HandleCharEnum(CharacterDatabaseQueryHolder* holder)
WorldPackets::Character::EnumCharactersResult::RaceUnlock raceUnlock;
raceUnlock.RaceID = requirement.first;
raceUnlock.HasExpansion = GetAccountExpansion() >= requirement.second.Expansion;
raceUnlock.HasAchievement = requirement.second.AchievementId != 0
&& (sWorld->getBoolConfig(CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT)
/* || HasAccountAchievement(requirement.second.AchievementId)*/);
charEnum.RaceUnlockData.push_back(raceUnlock);
}
@@ -1125,19 +1128,32 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
{
pCurrChar->setCinematic(1);
if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
if (PlayerInfo const* playerInfo = sObjectMgr->GetPlayerInfo(pCurrChar->getRace(), pCurrChar->getClass()))
{
if (pCurrChar->getClass() == CLASS_DEMON_HUNTER) /// @todo: find a more generic solution
pCurrChar->SendMovieStart(469);
else if (cEntry->CinematicSequenceID)
pCurrChar->SendCinematicStart(cEntry->CinematicSequenceID);
else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace()))
pCurrChar->SendCinematicStart(rEntry->CinematicSequenceID);
// send new char string if not empty
if (!sWorld->GetNewCharString().empty())
chH.PSendSysMessage("%s", sWorld->GetNewCharString().c_str());
switch (pCurrChar->GetCreateMode())
{
case PlayerCreateMode::Normal:
if (playerInfo->introMovieId)
pCurrChar->SendMovieStart(playerInfo->introMovieId.get());
else if (playerInfo->introSceneId)
pCurrChar->GetSceneMgr().PlayScene(*playerInfo->introSceneId);
else if (sChrClassesStore.AssertEntry(pCurrChar->getClass())->CinematicSequenceID)
pCurrChar->SendCinematicStart(sChrClassesStore.AssertEntry(pCurrChar->getClass())->CinematicSequenceID);
else if (sChrRacesStore.AssertEntry(pCurrChar->getRace())->CinematicSequenceID)
pCurrChar->SendCinematicStart(sChrRacesStore.AssertEntry(pCurrChar->getRace())->CinematicSequenceID);
break;
case PlayerCreateMode::NPE:
if (playerInfo->introSceneIdNPE)
pCurrChar->GetSceneMgr().PlayScene(*playerInfo->introSceneIdNPE);
break;
default:
break;
}
}
// send new char string if not empty
if (!sWorld->GetNewCharString().empty())
chH.PSendSysMessage("%s", sWorld->GetNewCharString().c_str());
}
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar))

View File

@@ -907,6 +907,7 @@ void World::LoadConfigSettings(bool reload)
}
m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEMON_HUNTER] = sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForDemonHunter", 0);
m_bool_configs[CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT] = sConfigMgr->GetBoolDefault("CharacterCreating.DisableAlliedRaceAchievementRequirement", false);
m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
@@ -2031,6 +2032,9 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading linked spells...");
sSpellMgr->LoadSpellLinked();
TC_LOG_INFO("server.loading", "Loading Scenes Templates..."); // must be before LoadPlayerInfo
sObjectMgr->LoadSceneTemplates();
TC_LOG_INFO("server.loading", "Loading Player Create Data...");
sObjectMgr->LoadPlayerInfo();
@@ -2049,9 +2053,6 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Conversation Templates...");
sConversationDataStore->LoadConversationTemplates();
TC_LOG_INFO("server.loading", "Loading Scenes Templates...");
sObjectMgr->LoadSceneTemplates();
TC_LOG_INFO("server.loading", "Loading Player Choices...");
sObjectMgr->LoadPlayerChoices();

View File

@@ -193,6 +193,7 @@ enum WorldBoolConfigs
CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION,
CONFIG_CHECK_GOBJECT_LOS,
CONFIG_RESPAWN_DYNAMIC_ESCORTNPC,
CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -844,6 +844,14 @@ CharactersPerRealm = 50
CharacterCreating.MinLevelForDemonHunter = 0
#
# CharacterCreating.DisableAlliedRaceAchievementRequirement
# Description: Disable achievement requirements for allied race character creation
# Default: 0 (Keep requirements active)
# 1 (Disable requirements)
CharacterCreating.DisableAlliedRaceAchievementRequirement = 0
#
# SkipCinematics
# Description: Disable cinematic intro at first login after character creation.