Working on adding the Guild Controller scrolls into the source but, I'm getting this weird issue: I can add the NPC with the same UID to every map that the NPC does not exist in. It only updates to one map on the database, so it's not like it's making multiple. It's the same NPC with the same code.
This is the script I'm currently working with, it was from an example of Furniture from another source that I had lying around:
Code:
if (client.HasItem(720021)) { client.DeleteItem(720021); var _newNPC = new DbNpc() { UID = 102093, Type = (NpcType)2, Mesh = look, X = packet.DataLow, Y = packet.DataHigh, Map = client.MapID }; ServerDatabase.Context.Npcs.AddOrUpdate(_newNPC); client.Map.Insert(new Npc(_newNPC)); } break;
Code:
public Npc(DbNpc _npc) { BaseNpc = _npc; UID = _npc.UID; Location = new Point(_npc.X, _npc.Y); SpawnPacket = SpawnNpcPacket.Create(this); foreach (var player in PlayerManager.Players.Values) { player.Send(SpawnPacket); } }
Code:
public static SpawnNpcPacket Create(Npc _npc) { var packet = new SpawnNpcPacket(); packet.UID = _npc.UID; packet.X = _npc.X; packet.Y = _npc.Y; packet.Mesh = _npc.Mesh; packet.Type = _npc.Type; if (_npc.Name != null && _npc.Name.Length > 0) { packet.Name = new NetStringPacker(); packet.Name.AddString(_npc.Name); } return packet; }