Core/Players: Implemented selecting Exile's Reach during character creation
Port From (https://github.com/TrinityCore/TrinityCore/commit/d54edfeb8bd9e525bac62677b8f9dffbaa5124c3)
This commit is contained in:
@@ -613,8 +613,17 @@ namespace Game.Entities
|
||||
|
||||
if (!ok && HasAtLoginFlag(AtLoginFlags.FirstLogin))
|
||||
{
|
||||
homebind = new WorldLocation(info.MapId, info.PositionX, info.PositionY, info.PositionZ, info.Orientation);
|
||||
homebindAreaId = info.ZoneId;
|
||||
var createPosition = m_createMode == PlayerCreateMode.NPE && info.createPositionNPE.HasValue ? info.createPositionNPE.Value : info.createPosition;
|
||||
|
||||
homebind = new WorldLocation(createPosition.Loc.GetMapId(), createPosition.Loc);
|
||||
if (createPosition.TransportGuid.HasValue)
|
||||
{
|
||||
Transport transport = Global.ObjAccessor.FindTransport(ObjectGuid.Create(HighGuid.Transport, createPosition.TransportGuid.Value));
|
||||
if (transport != null)
|
||||
transport.CalculatePassengerPosition(ref homebind.posX, ref homebind.posY, ref homebind.posZ, ref homebind.Orientation);
|
||||
}
|
||||
|
||||
homebindAreaId = Global.MapMgr.GetAreaId(PhasingHandler.EmptyPhaseShift, homebind);
|
||||
|
||||
saveHomebindToDb();
|
||||
ok = true;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Achievements;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Chat;
|
||||
@@ -26,7 +27,6 @@ using Game.Mails;
|
||||
using Game.Maps;
|
||||
using Game.Misc;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -269,15 +269,8 @@ namespace Game.Entities
|
||||
|
||||
public class PlayerInfo
|
||||
{
|
||||
public uint MapId;
|
||||
public uint ZoneId;
|
||||
public float PositionX;
|
||||
public float PositionY;
|
||||
public float PositionZ;
|
||||
public float Orientation;
|
||||
|
||||
public uint DisplayId_m;
|
||||
public uint DisplayId_f;
|
||||
public CreatePosition createPosition;
|
||||
public Optional<CreatePosition> createPositionNPE;
|
||||
|
||||
public List<PlayerCreateInfoItem> item = new();
|
||||
public List<uint> customSpells = new();
|
||||
@@ -286,6 +279,12 @@ namespace Game.Entities
|
||||
public List<SkillRaceClassInfoRecord> skills = new();
|
||||
|
||||
public PlayerLevelInfo[] levelInfo = new PlayerLevelInfo[WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)];
|
||||
|
||||
public struct CreatePosition
|
||||
{
|
||||
public WorldLocation Loc;
|
||||
public ulong? TransportGuid;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerCreateInfoItem
|
||||
|
||||
@@ -176,8 +176,6 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
Relocate(info.PositionX, info.PositionY, info.PositionZ, info.Orientation);
|
||||
|
||||
var cEntry = CliDB.ChrClassesStorage.LookupByKey(createInfo.ClassId);
|
||||
if (cEntry == null)
|
||||
{
|
||||
@@ -193,8 +191,28 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
SetMap(Global.MapMgr.CreateMap(info.MapId, this));
|
||||
var position = createInfo.UseNPE && info.createPositionNPE.HasValue ? info.createPositionNPE.Value : info.createPosition;
|
||||
|
||||
m_createTime = GameTime.GetGameTime();
|
||||
m_createMode = createInfo.UseNPE && info.createPositionNPE.HasValue ? PlayerCreateMode.NPE : PlayerCreateMode.Normal;
|
||||
|
||||
Relocate(position.Loc);
|
||||
|
||||
SetMap(Global.MapMgr.CreateMap(position.Loc.GetMapId(), this));
|
||||
|
||||
if (position.TransportGuid.HasValue)
|
||||
{
|
||||
Transport transport = Global.ObjAccessor.FindTransport(ObjectGuid.Create(HighGuid.Transport, position.TransportGuid.Value));
|
||||
if (transport != null)
|
||||
{
|
||||
transport.AddPassenger(this);
|
||||
m_movementInfo.transport.pos.Relocate(position.Loc);
|
||||
position.Loc.GetPosition(out float x, out float y, out float z, out float o);
|
||||
transport.CalculatePassengerPosition(ref x, ref y, ref z, ref o);
|
||||
Relocate(x, y, z, o);
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePositionData();
|
||||
|
||||
// set initial homebind position
|
||||
@@ -5332,28 +5350,15 @@ namespace Game.Entities
|
||||
|
||||
public void InitDisplayIds()
|
||||
{
|
||||
PlayerInfo info = Global.ObjectMgr.GetPlayerInfo(GetRace(), GetClass());
|
||||
if (info == null)
|
||||
ChrModelRecord model = Global.DB2Mgr.GetChrModel(GetRace(), GetNativeSex());
|
||||
if (model == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player {0} has incorrect race/class pair. Can't init display ids.", GetGUID().ToString());
|
||||
Log.outError(LogFilter.Player, $"Player {GetGUID()} has incorrect race/gender pair. Can't init display ids.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (GetNativeSex())
|
||||
{
|
||||
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:
|
||||
Log.outError(LogFilter.Player, "Player {0} ({1}) has invalid gender {2}", GetName(), GetGUID().ToString(), GetNativeSex());
|
||||
return;
|
||||
}
|
||||
|
||||
SetDisplayId(model.DisplayID);
|
||||
SetNativeDisplayId(model.DisplayID);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.StateAnimID), Global.DB2Mgr.GetEmptyAnimStateID());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user