aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2021-10-05 18:17:29 +0200
committerGitHub <noreply@github.com>2021-10-05 18:17:29 +0200
commit71eb30f89dc5abeb33c7aa4a526073f769b5c7d1 (patch)
treefa7f1fc240797044d97d25d2946c9af51d1fb466 /src
parent6d93f0a5f79c5465341a850279466ce36232e72e (diff)
Core/Characters: Added allied race creation data, implemented intro scenes & added config option to disable achievement requirements for allied races (#26974)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp34
-rw-r--r--src/server/game/Globals/ObjectMgr.h4
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp38
-rw-r--r--src/server/game/World/World.cpp7
-rw-r--r--src/server/game/World/World.h1
-rw-r--r--src/server/worldserver/worldserver.conf.dist8
7 files changed, 78 insertions, 16 deletions
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 5299adbeb65..df19cbca8d3 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -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; }
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 6eaa14f0879..fa12c26614e 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -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;
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index d3cd89ba585..3abb550b9a2 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -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;
};
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 0f2c5f6432e..3ed1240bdba 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -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))
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index f0c1faffc02..212ae90e00b 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -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();
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 76272c92e8e..2bc273d7885 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -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
};
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index b26b2ae45dd..a2d603cb433 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -845,6 +845,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.
# Prevents buggy intros in case of custom start location coordinates.