public bool TryJoin(IVoltronSession session) { if (Container.IsAvatarOnLot(session.AvatarId)) { return(false); //already on the lot. } lock (_Visitors) { if (ShuttingDown || (_Visitors.Count >= ((Context.HighMax)?128:24))) { if (ShuttingDown) { return(false); //cannot join } //check if this user has special permissions. should only happen when a lot is full //let them in anyways if they do var avatar = DAFactory.Get().Avatars.Get(session.AvatarId); if (avatar.moderation_level == 0 && !Context.JobLot) { if (DAFactory.Get().Roommates.Get(session.AvatarId, Context.DbId) == null) { return(false); //not a roommate } } } session.SetAttribute("currentLot", ((Context.Id & 0x40000000) > 0)?(int)Context.Id:Context.DbId); _Visitors.Add(session.AvatarId, session); SyncNumVisitors(); InBackground(() => Container.AvatarJoin(session)); return(true); } }
public void DropClient(uint id, bool returnClaim) { lock (_Visitors) { IVoltronSession visitor = null; if (_Visitors.TryGetValue(id, out visitor)) { visitor.SetAttribute("returnClaim", returnClaim); visitor.Close(); } } }
public void RecordStartVisit(IVoltronSession session, DbLotVisitorType visitorType) { if (Context.JobLot) { return; } using (var da = DAFactory.Get) { var id = da.LotVisits.Visit(session.AvatarId, visitorType, Context.DbId); if (id != null && id.HasValue) { session.SetAttribute("visitId", id.Value); } } }