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

View file

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

View file

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