Esempio n. 1
0
        public void ReleaseAvatarClaim(IVoltronSession session)
        {
            if (session.GetAttribute("currentLot") == null)
            {
                return;
            }
            lock (_Visitors) _Visitors.Remove(session.AvatarId);

            //We need to keep currentLot because we need to process the Leave action
            //session.SetAttribute("currentLot", null);
            SyncNumVisitors();
            if (Context.JobLot)
            {
                //tell the matchmaker we aren't connected.
                CityConnection.Write(new MatchmakerNotify()
                {
                    Mode     = MatchmakerNotifyType.RemoveAvatar,
                    AvatarID = session.AvatarId,
                    LotID    = Context.Id & 0x3FFFFFFF
                });
            }

            InBackground(() =>
            {
                using (var db = DAFactory.Get)
                {
                    //return claim to the city we got it from.

                    if ((bool)(session.GetAttribute("returnClaim") ?? true))
                    {
                        db.AvatarClaims.Claim(session.AvatarClaimId, Config.Call_Sign, (string)session.GetAttribute("cityCallSign"), 0);
                    }
                    else
                    {
                        db.AvatarClaims.Delete(session.AvatarClaimId, Config.Call_Sign);
                    }
                }

                if (session.GetAttribute("visitId") != null)
                {
                    var id = (int)session.GetAttribute("visitId");
                    using (var da = DAFactory.Get)
                    {
                        da.LotVisits.Leave(id);
                    }
                }
            });
        }
Esempio n. 2
0
        public void ReleaseAvatarClaim(IVoltronSession session)
        {
            if (session.GetAttribute("currentLot") == null)
            {
                return;
            }
            lock (_Visitors) _Visitors.Remove(session.AvatarId);

            //We need to keep currentLot because we need to process the Leave action
            //session.SetAttribute("currentLot", null);
            SyncNumVisitors();

            InBackground(() =>
            {
                using (var db = DAFactory.Get())
                {
                    //return claim to the city we got it from.

                    if ((bool)(session.GetAttribute("returnClaim") ?? true))
                    {
                        db.AvatarClaims.Claim(session.AvatarClaimId, Config.Call_Sign, (string)session.GetAttribute("cityCallSign"), 0);
                    }
                    else
                    {
                        db.AvatarClaims.Delete(session.AvatarClaimId, Config.Call_Sign);
                    }
                }

                if (session.GetAttribute("visitId") != null)
                {
                    var id = (int)session.GetAttribute("visitId");
                    using (var da = DAFactory.Get())
                    {
                        da.LotVisits.Leave(id);
                    }
                }
            });
        }
Esempio n. 3
0
        LotHostEntry GetLot(IVoltronSession session)
        {
            var lotId = (int?)session.GetAttribute("currentLot");

            if (lotId == null)
            {
                return(null);
            }
            lock (Lots)
            {
                if (Lots.ContainsKey(lotId.Value))
                {
                    return(Lots[lotId.Value]);
                }
            }
            return(null);
        }