private static void Process_Add_Npc(Player client, string[] command) { if (client.Account.Permission < PlayerPermission.GM) { return; } if (command.Length < 2) { client.SendMessage("ERROR: Correct format should be /addnpc mesh"); } ushort mesh; if (ushort.TryParse(command[1], out mesh)) { var npc = new DbNpc(); npc.Map = client.MapID; npc.X = client.X; npc.Y = client.Y; byte flag = 2; if (command.Length > 2) { byte.TryParse(command[2], out flag); } npc.Type = (NpcType)flag; npc.Mesh = mesh; ServerDatabase.Context.Npcs.Add(npc); client.Map.Insert(new Npc(npc, client.Map)); } //TODO: FINISH }
public Npc(DbNpc _npc, Map _map) { BaseNpc = _npc; UID = _npc.UID; Location = new Point(_npc.X, _npc.Y); SpawnPacket = SpawnNpcPacket.Create(this); Map = _map; }
/// <summary> /// Creates a new npc. /// </summary> /// <param name="dbNpc">The database model tied to it.</param> public Npc(DbNpc dbNpc) { _dbNpc = dbNpc; _clientId = _dbNpc.NpcId; _x = _dbNpc.X; _y = _dbNpc.Y; // Sets controllers Npc = this; MapObject = this; Entity = this; }
public GameNpc(DbNpc pNpc) { m_dbNpc = pNpc; m_pPacket = new MsgNpcInfo { Identity = pNpc.Id, MapX = pNpc.Cellx, MapY = pNpc.Celly, Kind = pNpc.Type, Sort = pNpc.Sort, Lookface = pNpc.Lookface }; }
public Npc(ILogger <Npc> logger, DbNpc dbNpc, List <(float X, float Y, float Z, ushort Angle)> moveCoordinates, Map map)