Exemplo n.º 1
0
        public void IncreaseIdleTime(bool IsOwner)
        {
            mIdleTime++;

            if (!IsSleeping && mIdleTime >= 600)
            {
                mIsSleeping = true;
                mInstance.BroadcastMessage(RoomUserSleepComposer.Compose(mId, true));
            }
            else if (!mIsLeavingRoom && mIdleTime >= 1800 && !IsOwner)
            {
                LeaveRoom();
                return;
            }

            if (mCarryItemTimer > 0)
            {
                mCarryItemTimer--;

                if (mCarryItemTimer == 0)
                {
                    CarryItem(0);
                }
            }

            if (mAntiSpamTicks >= 0)
            {
                mAntiSpamTicks--;

                if (mAntiSpamTicks == -1)
                {
                    mAntiSpamMessagesSent = 0;
                }
            }
        }
Exemplo n.º 2
0
        public void Unidle()
        {
            mIdleTime = 0;

            if (mIsSleeping)
            {
                mInstance.BroadcastMessage(RoomUserSleepComposer.Compose(mId, false));
                mIsSleeping = false;
            }
        }
Exemplo n.º 3
0
        public void SendObjects(Session Session)
        {
            Session.SendData(RoomItemHeightmapComposer.Compose(Model.Heightmap.ToString()));
            Session.SendData(RoomRelativeHeightmapComposer.Compose(RelativeHeightmap));

            List <RoomActor> ActorObjects = new List <RoomActor>();

            Dictionary <uint, int> DancingActors  = new Dictionary <uint, int>();
            Dictionary <uint, int> CarryingActors = new Dictionary <uint, int>();
            Dictionary <uint, int> EffectActors   = new Dictionary <uint, int>();
            List <uint>            SleepingActors = new List <uint>();

            lock (mActorSyncRoot)
            {
                foreach (RoomActor Actor in mActors.Values)
                {
                    ActorObjects.Add(Actor);

                    if (Actor.DanceId > 0)
                    {
                        DancingActors.Add(Actor.Id, Actor.DanceId);
                    }

                    if (Actor.CarryItemId > 0)
                    {
                        CarryingActors.Add(Actor.Id, Actor.CarryItemId);
                    }

                    if (Actor.AvatarEffectId > 0)
                    {
                        EffectActors.Add(Actor.Id, Actor.AvatarEffectId);
                    }

                    if (Actor.IsSleeping)
                    {
                        SleepingActors.Add(Actor.Id);
                    }
                }
            }

            Session.SendData(RoomUserObjectListComposer.Compose(ActorObjects));
            Session.SendData(RoomStaticObjectsComposer.Compose(mStaticObjects));
            Session.SendData(RoomFloorObjectsComposer.Compose(GetFloorItems()));
            Session.SendData(RoomWallObjectsComposer.Compose(GetWallItems()));
            Session.SendData(RoomUserStatusListComposer.Compose(ActorObjects));

            foreach (KeyValuePair <uint, int> DancingActor in DancingActors)
            {
                Session.SendData(RoomUserDanceComposer.Compose(DancingActor.Key, DancingActor.Value));
            }

            foreach (KeyValuePair <uint, int> CarryingActor in CarryingActors)
            {
                Session.SendData(RoomUserCarryComposer.Compose(CarryingActor.Key, CarryingActor.Value));
            }

            foreach (KeyValuePair <uint, int> EffectActor in EffectActors)
            {
                Session.SendData(RoomUserEffectComposer.Compose(EffectActor.Key, EffectActor.Value));
            }

            foreach (uint SleepingActor in SleepingActors)
            {
                Session.SendData(RoomUserSleepComposer.Compose(SleepingActor, true));
            }
        }