mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Players: Implemented selecting Exile's Reach during character creation
This commit is contained in:
28
sql/updates/world/master/2021_10_02_05_world.sql
Normal file
28
sql/updates/world/master/2021_10_02_05_world.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
ALTER TABLE `playercreateinfo`
|
||||
ADD `npe_map` int(10) unsigned DEFAULT NULL AFTER `orientation`,
|
||||
ADD `npe_position_x` float DEFAULT NULL AFTER `npe_map`,
|
||||
ADD `npe_position_y` float DEFAULT NULL AFTER `npe_position_x`,
|
||||
ADD `npe_position_z` float DEFAULT NULL AFTER `npe_position_y`,
|
||||
ADD `npe_orientation` float DEFAULT NULL AFTER `npe_position_z`,
|
||||
ADD `npe_transport_guid` bigint(20) unsigned DEFAULT NULL AFTER `npe_orientation`,
|
||||
DROP `zone`;
|
||||
|
||||
DELETE FROM `gameobject_template` WHERE `entry` IN (333479,349879);
|
||||
INSERT INTO `gameobject_template` (`entry`,`type`,`displayId`,`name`,`IconName`,`castBarCaption`,`unk1`,`size`,`Data0`,`Data1`,`Data2`,`Data3`,`Data4`,`Data5`,`Data6`,`Data7`,`Data8`,`Data9`,`Data10`,`Data11`,`Data12`,`Data13`,`Data14`,`Data15`,`Data16`,`Data17`,`Data18`,`Data19`,`Data20`,`Data21`,`Data22`,`Data23`,`Data24`,`Data25`,`Data26`,`Data27`,`Data28`,`Data29`,`Data30`,`Data31`,`Data32`,`Data33`,`ContentTuningId`,`VerifiedBuild`) VALUES
|
||||
(333479,15,61205,'Alliance Ship','','','',1,7748,10,2,0,0,81,2261,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40120), -- Alliance Ship
|
||||
(349879,15,61835,'Horde Transport','','','',1,8099,10,2,0,0,81,2369,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40120); -- Horde Transport
|
||||
|
||||
DELETE FROM `gameobject_template_addon` WHERE `entry` IN (333479,349879);
|
||||
INSERT INTO `gameobject_template_addon` (`entry`,`faction`,`flags`,`mingold`,`maxgold`,`WorldEffectID`,`AIAnimKitID`) VALUES
|
||||
(333479,0,0x28,0,0,0,0),
|
||||
(349879,0,0x28,0,0,0,0);
|
||||
|
||||
SET @ALLIANCE_SHIP := 29;
|
||||
SET @HORDE_SHIP := 30;
|
||||
DELETE FROM `transports` WHERE `guid` IN (@ALLIANCE_SHIP,@HORDE_SHIP);
|
||||
INSERT INTO `transports` (`guid`, `entry`, `name`, `phaseUseFlags`, `phaseid`, `phasegroup`, `ScriptName`) VALUES
|
||||
(29,333479,'NPE - Alliance Ship',0,0,0,''),
|
||||
(30,349879,'NPE - Horde Transport',0,0,0,'');
|
||||
|
||||
UPDATE `playercreateinfo` SET `npe_map`=2175,`npe_position_x`=11.1301,`npe_position_y`=-0.417182,`npe_position_z`=5.18741,`npe_orientation`=3.1484344,`npe_transport_guid`=@ALLIANCE_SHIP WHERE `race` IN (1,3,4,7,11,22,25) AND `class` NOT IN (6,12);
|
||||
UPDATE `playercreateinfo` SET `npe_map`=2175,`npe_position_x`=-10.7291,`npe_position_y`=-7.14635,`npe_position_z`=8.73113,`npe_orientation`=1.563206,`npe_transport_guid`=@HORDE_SHIP WHERE `race` IN (2,5,6,8,9,10,26) AND `class` NOT IN (6,12);
|
||||
@@ -434,8 +434,6 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
|
||||
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
||||
m_items[i] = nullptr;
|
||||
|
||||
Relocate(info->positionX, info->positionY, info->positionZ, info->orientation);
|
||||
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class);
|
||||
if (!cEntry)
|
||||
{
|
||||
@@ -451,8 +449,28 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
|
||||
return false;
|
||||
}
|
||||
|
||||
SetMap(sMapMgr->CreateMap(info->mapId, this));
|
||||
PlayerInfo::CreatePosition const& position = createInfo->UseNPE && info->createPositionNPE ? info->createPositionNPE.get() : info->createPosition;
|
||||
|
||||
m_createTime = GameTime::GetGameTime();
|
||||
m_createMode = createInfo->UseNPE && info->createPositionNPE ? PlayerCreateMode::NPE : PlayerCreateMode::Normal;
|
||||
|
||||
Relocate(position.Loc);
|
||||
|
||||
SetMap(sMapMgr->CreateMap(position.Loc.GetMapId(), this));
|
||||
|
||||
if (position.TransportGuid)
|
||||
{
|
||||
if (Transport* transport = HashMapHolder<Transport>::Find(ObjectGuid::Create<HighGuid::Transport>(*position.TransportGuid)))
|
||||
{
|
||||
transport->AddPassenger(this);
|
||||
m_movementInfo.transport.pos.Relocate(position.Loc);
|
||||
float x, y, z, o;
|
||||
position.Loc.GetPosition(x, y, z, o);
|
||||
transport->CalculatePassengerPosition(x, y, z, &o);
|
||||
Relocate(x, y, z, o);
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePositionData();
|
||||
|
||||
// set initial homebind position
|
||||
@@ -20288,11 +20306,15 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
|
||||
if (!ok && HasAtLoginFlag(AT_LOGIN_FIRST))
|
||||
{
|
||||
m_homebindMapId = info->mapId;
|
||||
m_homebindAreaId = info->areaId;
|
||||
m_homebindX = info->positionX;
|
||||
m_homebindY = info->positionY;
|
||||
m_homebindZ = info->positionZ;
|
||||
PlayerInfo::CreatePosition const& createPosition = m_createMode == PlayerCreateMode::NPE && info->createPositionNPE ? info->createPositionNPE.get() : info->createPosition;
|
||||
|
||||
m_homebindMapId = createPosition.Loc.GetMapId();
|
||||
createPosition.Loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
|
||||
if (createPosition.TransportGuid)
|
||||
if (Transport* transport = HashMapHolder<Transport>::Find(ObjectGuid::Create<HighGuid::Transport>(*createPosition.TransportGuid)))
|
||||
transport->CalculatePassengerPosition(m_homebindX, m_homebindY, m_homebindZ);
|
||||
|
||||
m_homebindAreaId = sMapMgr->GetAreaId(PhasingHandler::GetEmptyPhaseShift(), m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ);
|
||||
|
||||
saveHomebindToDb();
|
||||
ok = true;
|
||||
@@ -22886,29 +22908,15 @@ void Player::InitDataForForm(bool reapplyMods)
|
||||
|
||||
void Player::InitDisplayIds()
|
||||
{
|
||||
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
|
||||
if (!info)
|
||||
ChrModelEntry const* model = sDB2Manager.GetChrModel(getRace(), GetNativeSex());
|
||||
if (!model)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::InitDisplayIds: Player '%s' (%s) has incorrect race/class pair. Can't init display ids.", GetName().c_str(), GetGUID().ToString().c_str());
|
||||
TC_LOG_ERROR("entities.player", "Player::InitDisplayIds: Player '%s' (%s) has incorrect race/gender pair. Can't init display ids.", GetName().c_str(), GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Gender gender = GetNativeSex();
|
||||
switch (gender)
|
||||
{
|
||||
case GENDER_FEMALE:
|
||||
SetDisplayId(info->displayId_f);
|
||||
SetNativeDisplayId(info->displayId_f);
|
||||
break;
|
||||
case GENDER_MALE:
|
||||
SetDisplayId(info->displayId_m);
|
||||
SetNativeDisplayId(info->displayId_m);
|
||||
break;
|
||||
default:
|
||||
TC_LOG_ERROR("entities.player", "Player::InitDisplayIds: Player '%s' (%s) has invalid gender %u", GetName().c_str(), GetGUID().ToString().c_str(), uint32(gender));
|
||||
break;
|
||||
}
|
||||
|
||||
SetDisplayId(model->DisplayID);
|
||||
SetNativeDisplayId(model->DisplayID);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::StateAnimID), sDB2Manager.GetEmptyAnimStateID());
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Timer.h"
|
||||
#include "TransportMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "World.h"
|
||||
@@ -3475,8 +3476,8 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
// Load playercreate
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo");
|
||||
// 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");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -3494,11 +3495,10 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
uint32 current_race = fields[0].GetUInt8();
|
||||
uint32 current_class = fields[1].GetUInt8();
|
||||
uint32 mapId = fields[2].GetUInt16();
|
||||
uint32 areaId = fields[3].GetUInt32(); // zone
|
||||
float positionX = fields[4].GetFloat();
|
||||
float positionY = fields[5].GetFloat();
|
||||
float positionZ = fields[6].GetFloat();
|
||||
float orientation = fields[7].GetFloat();
|
||||
float positionX = fields[3].GetFloat();
|
||||
float positionY = fields[4].GetFloat();
|
||||
float positionZ = fields[5].GetFloat();
|
||||
float orientation = fields[6].GetFloat();
|
||||
|
||||
if (!sChrRacesStore.LookupEntry(current_race))
|
||||
{
|
||||
@@ -3525,29 +3525,44 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
continue;
|
||||
}
|
||||
|
||||
ChrModelEntry const* maleModel = sDB2Manager.GetChrModel(current_race, GENDER_MALE);
|
||||
if (!maleModel)
|
||||
if (!sDB2Manager.GetChrModel(current_race, GENDER_MALE))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Missing male model for race %u, ignoring.", current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
ChrModelEntry const* femaleModel = sDB2Manager.GetChrModel(current_race, GENDER_FEMALE);
|
||||
if (!femaleModel)
|
||||
if (!sDB2Manager.GetChrModel(current_race, GENDER_FEMALE))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Missing female model for race %u, ignoring.", current_race);
|
||||
continue;
|
||||
}
|
||||
|
||||
std::unique_ptr<PlayerInfo> info = std::make_unique<PlayerInfo>();
|
||||
info->mapId = mapId;
|
||||
info->areaId = areaId;
|
||||
info->positionX = positionX;
|
||||
info->positionY = positionY;
|
||||
info->positionZ = positionZ;
|
||||
info->orientation = orientation;
|
||||
info->displayId_m = maleModel->DisplayID;
|
||||
info->displayId_f = femaleModel->DisplayID;
|
||||
info->createPosition.Loc.WorldRelocate(mapId, positionX, positionY, positionZ, orientation);
|
||||
|
||||
if (std::none_of(fields + 7, fields + 12, [](Field const& field) { return field.IsNull(); }))
|
||||
{
|
||||
info->createPositionNPE.emplace();
|
||||
|
||||
info->createPositionNPE->Loc.WorldRelocate(fields[7].GetUInt32(), fields[8].GetFloat(), fields[9].GetFloat(), fields[10].GetFloat(), fields[11].GetFloat());
|
||||
if (!fields[12].IsNull())
|
||||
info->createPositionNPE->TransportGuid = fields[12].GetUInt64();
|
||||
|
||||
if (!sMapStore.LookupEntry(info->createPositionNPE->Loc.GetMapId()))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Invalid NPE map id %u for class %u race %u pair in `playercreateinfo` table, ignoring.",
|
||||
info->createPositionNPE->Loc.GetMapId(), current_class, current_race);
|
||||
info->createPositionNPE.reset();
|
||||
}
|
||||
|
||||
if (info->createPositionNPE && info->createPositionNPE->TransportGuid && !sTransportMgr->GetTransportSpawn(*info->createPositionNPE->TransportGuid))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Invalid NPE transport spawn id " UI64FMTD " for class %u race %u pair in `playercreateinfo` table, ignoring.",
|
||||
*info->createPositionNPE->TransportGuid, current_class, current_race);
|
||||
info->createPositionNPE.reset(); // remove entire NPE data - assume user put transport offsets into npe_position fields
|
||||
}
|
||||
}
|
||||
|
||||
_playerInfo[current_race][current_class] = std::move(info);
|
||||
|
||||
++count;
|
||||
|
||||
@@ -596,14 +596,15 @@ typedef std::vector<SkillRaceClassInfoEntry const*> PlayerCreateInfoSkills;
|
||||
// existence checked by displayId != 0
|
||||
struct PlayerInfo
|
||||
{
|
||||
uint32 mapId = 0;
|
||||
uint32 areaId = 0;
|
||||
float positionX = 0.0f;
|
||||
float positionY = 0.0f;
|
||||
float positionZ = 0.0f;
|
||||
float orientation = 0.0f;
|
||||
uint32 displayId_m = 0;
|
||||
uint32 displayId_f = 0;
|
||||
struct CreatePosition
|
||||
{
|
||||
WorldLocation Loc;
|
||||
Optional<ObjectGuid::LowType> TransportGuid;
|
||||
};
|
||||
|
||||
CreatePosition createPosition;
|
||||
Optional<CreatePosition> createPositionNPE;
|
||||
|
||||
PlayerCreateInfoItems item;
|
||||
PlayerCreateInfoSpells customSpells;
|
||||
PlayerCreateInfoSpells castSpells;
|
||||
|
||||
Reference in New Issue
Block a user