2024-01-23 17:54:53 +00:00
|
|
|
|
using RPG.GameCore.Level.Objects;
|
|
|
|
|
using RPG.Network.Proto;
|
|
|
|
|
|
|
|
|
|
namespace RPG.Services.Gameserver.Game.Entity.Factory;
|
|
|
|
|
|
|
|
|
|
internal class EntityFactory
|
|
|
|
|
{
|
|
|
|
|
private uint _entityIdSeed;
|
|
|
|
|
|
|
|
|
|
public AvatarEntity CreateAvatarEntity(uint avatarId, AvatarType type, uint uid)
|
|
|
|
|
{
|
2024-01-25 10:55:10 +00:00
|
|
|
|
return new(NextEntityId(), avatarId, type, uid);
|
2024-01-23 17:54:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NpcMonsterEntity CreateNpcMonsterEntity(LevelMonsterInfo levelMonster, uint groupId)
|
|
|
|
|
{
|
|
|
|
|
return new(NextEntityId(), groupId, levelMonster.ID, levelMonster.NPCMonsterID, levelMonster.EventID);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-25 10:55:10 +00:00
|
|
|
|
public PropEntity CreatePropEntity(LevelPropInfo levelProp, uint groupId)
|
|
|
|
|
{
|
|
|
|
|
return new(NextEntityId(), groupId, levelProp.ID, levelProp);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-25 11:31:32 +00:00
|
|
|
|
public NpcEntity CreateNpcEntity(LevelNPCInfo levelNPC, uint groupId)
|
|
|
|
|
{
|
|
|
|
|
return new(NextEntityId(), groupId, levelNPC.ID, levelNPC);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-23 17:54:53 +00:00
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
|
|
|
|
_entityIdSeed = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private uint NextEntityId()
|
|
|
|
|
{
|
|
|
|
|
return ++_entityIdSeed;
|
|
|
|
|
}
|
|
|
|
|
}
|