public DynamicNpc(DbDynamicNPC dbNpc) { m_dbNpc = dbNpc; m_pPacket = new MsgNpcInfoEx { Flag = dbNpc.Type, Identity = dbNpc.Id, Lookface = dbNpc.Lookface, Life = dbNpc.Life, MaxLife = dbNpc.Maxlife, MapX = dbNpc.Cellx, MapY = dbNpc.Celly, Type = dbNpc.Type }; try { m_sElevation = Map[MapX, MapY].Elevation; } catch { m_sElevation = 999; } if (OwnerType == _OWNER_USER && OwnerIdentity > 0) { Client temp = null; if (ServerKernel.Players.TryGetValue(OwnerIdentity, out temp)) { if (temp.Character != null) { m_pRole = temp.Character; m_pPacket.Name = temp.Character.Name; } } } if (OwnerType == _OWNER_SYN && OwnerIdentity > 0 && IsSynFlag()) { Syndicate temp = ServerKernel.Syndicates.Values.FirstOrDefault(x => x.Identity == OwnerIdentity); if (temp != null) { m_pPacket.Name = temp.Name; } } Scores = new ConcurrentDictionary <uint, SynScore>(); m_tDeathTime = new TimeOutMS(500); m_tDeathTime.Startup(500); }
public bool Create() { m_pMap = m_pOwner.Map; Items = new ConcurrentDictionary <uint, BoothItem>(); m_pNpc = m_pMap.GameObjects.Values.FirstOrDefault(x => x.MapX == m_pOwner.MapX - 2 && x.MapY == m_pOwner.MapY) as GameNpc; if (m_pNpc == null) { return(false); } if (m_pNpc.Vending) { return(false); } Vending = true; m_szWords = ""; m_pOwner.Direction = FacingDirection.SOUTH_EAST; m_pOwner.Action = EntityAction.SIT; var tempDb = new DbDynamicNPC { Id = ((m_pOwner.Identity % 1000000) + ((m_pOwner.Identity / 1000000) * 100000)), Name = m_pOwner.Name, Cellx = (ushort)(m_pNpc.MapX + 3), Celly = m_pNpc.MapY, Type = NpcTypes.BOOTH_NPC, Lookface = 406, Mapid = m_pOwner.MapIdentity, Datastr = "PlayerShop" }; m_pShop = new DynamicNpc(tempDb) { Name = m_pOwner.Name }; m_dwIdentity = m_pShop.Identity; m_pMap.AddDynaNpc(m_pShop); return(true); }