Turtle, configurable player position

This commit is contained in:
xeon 2024-02-15 21:33:05 +03:00
parent 035cf19514
commit 4e82ccb871
4 changed files with 24 additions and 20 deletions

View file

@ -191,12 +191,7 @@ internal class CreatureController : Controller
PlayerId = _modelManager.Player.Id,
Level = 1,
IsOffline = false,
Location = new()
{
X = 4000,
Y = -2000,
Z = 260
},
Location = _modelManager.Player.Position,
PlayerName = _modelManager.Player.Name,
FightRoleInfos = { GetFightRoleInfos() }
}
@ -225,12 +220,7 @@ internal class CreatureController : Controller
for (int i = 0; i < _modelManager.Formation.RoleIds.Length; i++)
{
PlayerEntity entity = _entityFactory.CreatePlayer(_modelManager.Formation.RoleIds[i], _modelManager.Player.Id);
entity.Pos = new()
{
X = 4000,
Y = -2000,
Z = 260
};
entity.Pos = _modelManager.Player.Position.Clone();
entity.IsCurrentRole = i == 0;
_entitySystem.Create(entity);
@ -247,13 +237,15 @@ internal class CreatureController : Controller
private void CreateWorldEntities()
{
Vector playerPos = _modelManager.Player.Position;
// Test monster
MonsterEntity monster = _entityFactory.CreateMonster(102000014); // Monster001
MonsterEntity monster = _entityFactory.CreateMonster(106003002); // Turtle.
monster.Pos = new()
{
X = 4444,
Y = -2222,
Z = 260
X = playerPos.X + 250,
Y = playerPos.Y + 250,
Z = playerPos.Z
};
_entitySystem.Create(monster);

View file

@ -1,4 +1,5 @@
using GameServer.Settings;
using Protocol;
using GameServer.Settings;
namespace GameServer.Models;
internal class PlayerModel
@ -6,11 +7,13 @@ internal class PlayerModel
public int Id { get; private set; }
public string Name { get; private set; }
public int[] Characters { get; private set; }
public Vector Position { get; private set; }
public PlayerModel()
{
Name = string.Empty;
Characters = [];
Position = new Vector();
}
public static PlayerModel CreateDefaultPlayer(PlayerStartingValues startingValues)
@ -19,7 +22,8 @@ internal class PlayerModel
{
Id = 1337,
Name = startingValues.Name,
Characters = startingValues.Characters
Characters = startingValues.Characters,
Position = startingValues.Position.Clone()
};
}
}

View file

@ -1,6 +1,9 @@
namespace GameServer.Settings;
using Protocol;
namespace GameServer.Settings;
internal class PlayerStartingValues
{
public required string Name { get; set; }
public required int[] Characters { get; set; }
public required Vector Position { get; set; }
}

View file

@ -1,7 +1,12 @@
{
"StartingValues": {
"Name": "ReversedRooms",
"Characters": [ 1601, 1302, 1203 ]
"Characters": [ 1601, 1302, 1203 ],
"Position": {
"X": -84500,
"Y": 164500,
"Z": 2000
}
},
"Features": {
"TeleportByMapMark": true