예제 #1
0
 private static void smethod_19(Session session_0, ClientMessage clientMessage_0)
 {
     if (!session_0.CharacterInfo.IsMuted)
     {
         uint actorId = clientMessage_0.ReadUnsignedInteger();
         clientMessage_0.ReadUnsignedInteger();
         string messageText = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false);
         clientMessage_0.ReadUnsignedInteger();
         SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);
         if (instanceBySpaceId != null)
         {
             SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
             if (actorByReferenceId != null)
             {
                 SpaceActor actor = instanceBySpaceId.GetActor(actorId);
                 if ((actor != null) && (messageText.Length != 0))
                 {
                     if (messageText.Length > 100)
                     {
                         messageText = messageText.Substring(0, 100);
                     }
                     uint referenceId = actor.ReferenceId;
                     if (referenceId > 0)
                     {
                         actorByReferenceId.Whisper(messageText, referenceId, false);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        private static void smethod_22(Session session_0, ClientMessage clientMessage_0)
        {
            uint          actorId           = clientMessage_0.ReadUnsignedInteger();
            uint          num2              = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actor  = instanceBySpaceId.GetActor(actorId);
                SpaceActor actor2 = instanceBySpaceId.GetActor(num2);
                if ((actor != null) && (actor2 != null) && ChatCommands.block_coco == false)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject;
                    CharacterInfo info2           = (CharacterInfo)actor2.ReferenceObject;
                    if (!actor2.IsLocked)
                    {
                        using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                        {
                            referenceObject.UpdateGoldCreditsBalance(client, -200);//Coconut cost 10
                            referenceObject.UpdateCoconuts(client, true);
                            info2.UpdateCoconuts(client, false);
                            session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(200), false);//Coconut cost 10
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 5), 0, false);
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 5), 0, false);
                            actor2.Lock(6, false, true);
                            instanceBySpaceId.BroadcastMessage(SpaceUserSendCoconut.SendAndBlock(actor2.ReferenceId), 0, false);
                        }
                    }
                }
            }
        }
예제 #3
0
        private static void smethod_18(Session session_0, ClientMessage clientMessage_0)
        {
            if (!session_0.CharacterInfo.IsMuted)
            {
                SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);
                if (instanceBySpaceId != null)
                {
                    SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                    if (actorByReferenceId != null)
                    {
                        CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
                        clientMessage_0.ReadUnsignedInteger();
                        string input        = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false);
                        int    messageColor = clientMessage_0.ReadInteger();
                        if (input.Length != 0)
                        {
                            if (input.Length > 100)
                            {
                                input = input.Substring(0, 100);
                            }

                            if (referenceObject.Staff == 0)
                            {
                                messageColor = 1;
                            }

                            if (referenceObject.Staff == 1)
                            {
                                messageColor = 9;
                            }

                            if (referenceObject.Staff == 2)
                            {
                                messageColor = 2;
                            }

                            if (!input.StartsWith("@") || !ChatCommands.HandleCommand(session_0, input))
                            {
                                actorByReferenceId.Chat(input, messageColor, referenceObject.Staff == 1);
                            }

                            //1 white, 2 gold, 6 pink, 7 red, 8 blue, 9 orange, 10 green


                            /*
                             *
                             *  White	 =      Normal
                             *  Gold	 =      RetroMods
                             *  Green    =      Designer
                             *  Blue     =      Translators
                             *  Pink     =      VIP
                             *  Red      =      Admin
                             *  Orange   =      XAT Staff
                             *
                             */
                        }
                    }
                }
            }
        }
예제 #4
0
        public static bool RemoveUserFromSpace(Session Session, bool SendKick = true)
        {
            bool flag            = false;
            uint absoluteSpaceId = Session.AbsoluteSpaceId;

            if (absoluteSpaceId > 0)
            {
                if (Session.SpaceJoined)
                {
                    SpaceInstance instanceBySpaceId = GetInstanceBySpaceId(absoluteSpaceId);
                    if (instanceBySpaceId != null)
                    {
                        instanceBySpaceId.RemoveCharacterFromSpace(Session.CharacterId);
                    }
                }
                Session.AbsoluteSpaceId = 0;
                Session.SpaceAuthed     = false;
                Session.SpaceJoined     = false;
                LaptopHandler.MarkUpdateNeeded(Session, 0, false);
                flag = true;
            }
            if (SendKick)
            {
                Session.SendData(SpaceUserRemovedComposer.SingleCompose());
            }
            return(flag);
        }
예제 #5
0
        public static SpaceInfo GetSpaceInfo(uint SpaceId, bool IgnoreCache)
        {
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(SpaceId);

            if (instanceBySpaceId != null)
            {
                return(instanceBySpaceId.Info);
            }
            if (!IgnoreCache)
            {
                SpaceInfo info = smethod_1(SpaceId);
                if (info != null)
                {
                    return(info);
                }
            }
            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
            {
                client.SetParameter("id", SpaceId);
                DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios WHERE id = @id LIMIT 1");
                if (row != null)
                {
                    return(GenerateSpaceInfoFromRow(row));
                }
            }
            return(null);
        }
예제 #6
0
        public static void smethod_20(Session session_0, ClientMessage clientMessage_0)
        {
            uint          itemId            = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if (actorByReferenceId != null)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
                    try
                    {
                        ContestItem item = instanceBySpaceId.Items[itemId];
                        if ((item != null) && item.IsActive)
                        {
                            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                            {
                                item.CatchItem(client, (int)session_0.CharacterId);
                                string definitionName = item.DefinitionName;
                                if (definitionName != null)
                                {
                                    if (definitionName != "cofre_oro")
                                    {
                                        if (!(definitionName == "cofre_plata"))
                                        {
                                            if (definitionName == "")
                                            {
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, actorByReferenceId.Name + " ha cogido un diamante.", false, 3);
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, actorByReferenceId.Name + " has caught a diamond", false, 3);
                                            }
                                            else
                                            {
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " ha atrapado un cofre y obtiene: ", item.SilverCredits, " monedas de plata." }), false, 3);
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has caught a chest and obtained: ", item.GoldCredits, " silver credits." }), false, 3);
                                                referenceObject.UpdateSilverCreditsBalance(client, (int)item.SilverCredits);
                                                session_0.SendData(CharacterCoinsComposer.AddSilverCompose(item.SilverCredits), false);
                                            }
                                        }
                                        else
                                        {
                                            instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " ha atrapado un cofre y obtiene: ", item.GoldCredits, " monedas de oro." }), false, 3);
                                            instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has caught a chest and obtained: ", item.GoldCredits, " gold credits." }), false, 3);
                                            referenceObject.UpdateGoldCreditsBalance(client, (int)item.GoldCredits);
                                            session_0.SendData(CharacterCoinsComposer.AddGoldCompose(item.GoldCredits), false);
                                        }
                                    }
                                }
                                instanceBySpaceId.BroadcastMessage(SpaceCatchItemComposer.Compose(itemId), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceRemoveItemComposer.Compose(itemId), 0, false);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
예제 #7
0
        private static void smethod_21(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadInteger();
            uint actorId = clientMessage_0.ReadUnsignedInteger();

            clientMessage_0.ReadInteger();
            clientMessage_0.ReadInteger();
            uint num2 = clientMessage_0.ReadUnsignedInteger();

            clientMessage_0.ReadInteger();
            clientMessage_0.ReadInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actor  = instanceBySpaceId.GetActor(actorId);
                SpaceActor actor2 = instanceBySpaceId.GetActor(num2);
                uint       ID1    = CharacterResolverCache.GetUidFromName(actor.Name);
                uint       ID2    = CharacterResolverCache.GetUidFromName(actor2.Name);
                if ((actor != null) && (actor2 != null))
                {
                    CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject;
                    CharacterInfo info2           = (CharacterInfo)actor2.ReferenceObject;
                    if (!actor.IsLocked && !actor2.IsLocked && ChatCommands.block_upper == false && !ChatCommands.UpperBlock.Contains(actor2.Name) && !ChatCommands.UpperBlockUser.Contains(ID1) && !ChatCommands.UpperBlockUser.Contains(ID2))
                    {
                        actor.StopMoving();
                        using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                        {
                            if (referenceObject.Staff == 1)
                            {
                                referenceObject.UpdateGoldCreditsBalance(client, -250);//Punch cost 500
                                referenceObject.UpdateUppercuts(client, true);
                                info2.UpdateUppercuts(client, false);
                                session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250), false);//Punch cost 500
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false);
                                actor.Lock(13, false, false);
                                actor2.Lock(10, true, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false);
                            }
                            else
                            {
                                referenceObject.UpdateGoldCreditsBalance(client, -250);//Punch cost 200
                                referenceObject.UpdateUppercuts(client, true);
                                info2.UpdateUppercuts(client, false);
                                session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250), false);//Punch cost 200
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false);
                                actor.Lock(13, false, false);
                                actor2.Lock(10, true, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false);
                            }
                        }
                    }
                }
            }
        }
예제 #8
0
        private static void smethod_16(Session session_0, ClientMessage clientMessage_0)
        {
            uint          color             = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                instanceBySpaceId.BroadcastMessage(UpdateCoconutColor.Compose(session_0.CharacterId, color), 0, false);
            }
        }
예제 #9
0
        private static void smethod_3(Session session_0, ClientMessage clientMessage_0)
        {
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked)
                {
                    SpaceManager.RemoveUserFromSpace(session_0, true);
                }
            }
        }
예제 #10
0
        private static void smethod_7(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadUnsignedInteger();
            int           rotation          = clientMessage_0.ReadInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceUserRotationComposer.Compose(actorByReferenceId.UInt32_0, actorByReferenceId.Position.Int32_0, actorByReferenceId.Position.Int32_1, rotation), 0, false);
                }
            }
        }
예제 #11
0
 private static void smethod_2(Session session_0, ClientMessage clientMessage_0)
 {
     if (session_0 != null)
     {
         if (!SpaceManager.InstanceIsLoadedForSpace(session_0.AbsoluteSpaceId))
         {
             if (SpaceManager.TryLoadSpaceInstance(session_0.AbsoluteSpaceId))
             {
             }
             else
             {
                 Console.WriteLine("ERROR");
             }
         }
         SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.AbsoluteSpaceId);
         if (instanceBySpaceId != null)
         {
             session_0.SpaceAuthed = true;
         }
         if (((instanceBySpaceId != null) && !session_0.SpaceJoined) && (session_0.SpaceAuthed && !instanceBySpaceId.Info.BlackList.Contains(session_0.CharacterInfo.Username)))
         {
             if (!instanceBySpaceId.AddUserToSpace(session_0))
             {
                 SpaceManager.RemoveUserFromSpace(session_0, true);
             }
             else
             {
                 session_0.SpaceAuthed = true;
                 session_0.SpaceJoined = true;
                 instanceBySpaceId.SendObjects(session_0);
                 LaptopHandler.MarkUpdateNeeded(session_0, 0, false);
                 SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                 if (actorByReferenceId == null)
                 {
                     session_0.SendData(SpaceUserRemovedComposer.SingleCompose());
                 }
                 else
                 {
                     instanceBySpaceId.BroadcastMessage(SpaceObjectListComposer.BroadcastCompose(actorByReferenceId), session_0.CharacterId, true);
                 }
             }
         }
         else
         {
             session_0.SendData(SpaceUserRemovedComposer.SingleCompose());
         }
     }
 }
예제 #12
0
        private static void smethod_5(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadUnsignedInteger();
            uint          actionId          = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if ((actorByReferenceId != null) && !actorByReferenceId.IsPreLocked)
                {
                    actorByReferenceId.PreLock(2);
                    instanceBySpaceId.BroadcastMessage(SpaceUserActionComposer.Compose(session_0.CharacterId, actionId), 0, false);
                }
            }
        }
예제 #13
0
        public static bool TryLoadSpaceInstance(uint SpaceId)
        {
            if (GetInstanceBySpaceId(SpaceId) != null)
            {
                return(false);
            }
            uint          instanceId = GenerateInstanceId();
            SpaceInstance instance2  = SpaceInstance.TryCreateSpaceInstance(instanceId, SpaceId);

            if (instance2 == null)
            {
                return(false);
            }
            concurrentDictionary_0.TryAdd(instanceId, instance2);
            Output.WriteLine(string.Concat(new object[] { "[SpaceMgr] Space instance #", instanceId, " has been loaded for area #", SpaceId, "." }), OutputLevel.DebugInformation);
            return(true);
        }
예제 #14
0
        private static void smethod_14(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadUnsignedInteger();
            uint          actorId           = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                SpaceActor actor = instanceBySpaceId.GetActor(actorId);
                if ((actor != null) && (actorByReferenceId != null))
                {
                    Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(actor.ReferenceId);
                    if (sessionByCharacterId != null)
                    {
                        sessionByCharacterId.SendData(SpaceUserCancelActionComposer.TargetCompose(actorByReferenceId.UInt32_0), false);
                    }
                }
            }
        }
예제 #15
0
        private static void smethod_17(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadUnsignedInteger();
            string        motto             = clientMessage_0.ReadString();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if (actorByReferenceId != null)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
                    using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                    {
                        referenceObject.UpdateMotto(client, motto);
                    }
                    instanceBySpaceId.BroadcastMessage(SpaceUserMottoUpdateComposer.Compose(actorByReferenceId.UInt32_0, motto), 0, false);
                }
            }
        }
예제 #16
0
        private static void smethod_10(Session session_0, ClientMessage clientMessage_0)
        {
            uint          actorId           = clientMessage_0.ReadUnsignedInteger();
            uint          colorId           = clientMessage_0.ReadUnsignedInteger();
            int           vote              = clientMessage_0.ReadInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if (actorByReferenceId != null)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
                    using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                    {
                        referenceObject.UpdateVotes(client, colorId, vote);
                    }
                    instanceBySpaceId.BroadcastMessage(SpaceUserVoteUpdateComposer.Compose(actorId, colorId, vote), 0, false);
                }
            }
        }
예제 #17
0
 public SpaceActor(uint uint_2, SpaceActorType Type, uint ReferenceId, object ReferenceObject, Vector3 Position, int Rotation, SpaceInstance Instance)
 {
     this.uint_0           = uint_2;
     this.spaceActorType_0 = Type;
     this.uint_1           = ReferenceId;
     this.object_0         = ReferenceObject;
     this.vector3_0        = Position;
     this.vector3_1        = Position;
     this.int_0            = Rotation;
     this.bool_0           = false;
     this.bool_6           = false;
     this.bool_3           = false;
     this.bool_4           = false;
     this.dictionary_0     = new Dictionary <string, string>();
     this.spaceInstance_0  = Instance;
     this.bool_1           = true;
     this.object_1         = new object();
     this.pathfinder_0     = PathfinderManager.CreatePathfinderInstance();
     this.pathfinder_0.SetSpaceInstance(this.spaceInstance_0, uint_2);
     this.method_1(500);
     this.method_2(500);
 }
예제 #18
0
        private static void smethod_4(Session session_0, ClientMessage clientMessage_0)
        {
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked)
                {
                    clientMessage_0.ReadUnsignedInteger();
                    string         str      = clientMessage_0.ReadString();
                    string         str2     = str;
                    List <Vector3> stepList = new List <Vector3>();
                    while (str2 != "")
                    {
                        stepList.Add(new Vector3(int.Parse(str2.Substring(0, 2)), int.Parse(str2.Substring(2, 2)), int.Parse(str2.Substring(4, 1))));
                        str2 = str2.Substring(5);
                    }
                    Vector3 toPosition = new Vector3(int.Parse(str.Substring(str.Length - 5, 2)), int.Parse(str.Substring(str.Length - 3, 2)), int.Parse(str.Substring(str.Length - 1, 1)));
                    actorByReferenceId.MoveTo(stepList, toPosition, false, false, false);
                }
            }
        }
예제 #19
0
 public static SpaceActor TryCreateActor(uint uint_2, SpaceActorType Type, uint ReferenceId, object ReferenceObject, Vector3 Position, int Rotation, SpaceInstance Instance)
 {
     if (ReferenceObject == null)
     {
         return(null);
     }
     return(new SpaceActor(uint_2, Type, ReferenceId, ReferenceObject, Position, Rotation, Instance));
 }
예제 #20
0
        private static void smethod_0()
        {
            try
            {
                while (Program.Alive)
                {
                    DateTime now = DateTime.Now;
                    Dictionary <uint, SpaceInstance> dictionary = new Dictionary <uint, SpaceInstance>(concurrentDictionary_0);
                    List <uint> list  = new List <uint>();
                    List <uint> list2 = new List <uint>();
                    foreach (SpaceInstance instance in dictionary.Values)
                    {
                        if (instance.Unloaded)
                        {
                            if (instance.TimeUnloaded <= 15.0)
                            {
                                goto Label_00B6;
                            }
                            list.Add(instance.InstanceId);
                            continue;
                        }
                        if (instance.HumanActorCount == 0)
                        {
                            if (instance.MarkedAsEmpty >= 10)
                            {
                                list2.Add(instance.InstanceId);
                            }
                            else
                            {
                                instance.MarkedAsEmpty++;
                            }
                            continue;
                        }
                        if (instance.MarkedAsEmpty > 0)
                        {
                            instance.MarkedAsEmpty = 0;
                        }
Label_00B6:
                        foreach (SpaceActor actor in instance.Actors)
                        {
                            Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(actor.ReferenceId);
                            if ((sessionByCharacterId == null) || (sessionByCharacterId.AbsoluteSpaceId != instance.SpaceId))
                            {
                                instance.RemoveActorFromSpace(actor.UInt32_0);
                            }
                        }
                        instance.PerformUpdate();
                    }
                    foreach (uint num in list2)
                    {
                        if (concurrentDictionary_0.ContainsKey(num))
                        {
                            concurrentDictionary_0[num].Unload();
                            Output.WriteLine("[SpaceMgr] Unloaded Space instance #" + num + ".", OutputLevel.DebugInformation);
                        }
                    }
                    foreach (uint num2 in list)
                    {
                        SpaceInstance instance2 = null;
                        concurrentDictionary_0[num2].Dispose();
                        concurrentDictionary_0[num2] = null;
                        concurrentDictionary_0.TryRemove(num2, out instance2);
                        Output.WriteLine("[SpaceMgr] Disposed Space instance #" + num2 + " and associated resources.", OutputLevel.DebugInformation);
                    }
                    TimeSpan span = (TimeSpan)(DateTime.Now - now);
                    double   num3 = 710.0 - span.TotalMilliseconds;
                    if (num3 < 0.0)
                    {
                        num3 = 0.0;
                        Output.WriteLine("Can't keep up! Did the system time change, or is the server overloaded?", OutputLevel.Warning);
                    }
                    if (num3 > 710.0)
                    {
                        num3 = 710.0;
                    }
                    Thread.Sleep((int)num3);
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (ThreadInterruptedException)
            {
            }
        }
예제 #21
0
        private static void smethod_12(Session session_0, ClientMessage clientMessage_0)
        {
            uint          actionId          = clientMessage_0.ReadUnsignedInteger();
            uint          actorId           = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId == null)
            {
                return;
            }
            SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
            SpaceActor actor = instanceBySpaceId.GetActor(actorId);

            if ((actor == null) || (actorByReferenceId == null))
            {
                return;
            }
            CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
            CharacterInfo info2           = (CharacterInfo)actor.ReferenceObject;

            if (actorByReferenceId.IsLocked || actor.IsLocked)
            {
                return;
            }
            actorByReferenceId.StopMoving();
            actor.StopMoving();
            if (SessionManager.GetSessionByCharacterId(actor.ReferenceId) == null)
            {
                return;
            }
            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
            {
                switch (actionId)
                {
                case 1:
                    referenceObject.UpdateKisses(client, false);
                    info2.UpdateKisses(client, true);
                    actor.Lock(3, false, false);
                    actorByReferenceId.Lock(3, false, false);
                    goto Label_0165;

                case 2:
                    referenceObject.UpdateCocktails(client, false);
                    info2.UpdateCocktails(client, true);
                    actor.Lock(9, false, false);
                    actorByReferenceId.Lock(9, false, false);
                    goto Label_0165;

                case 3:
                    referenceObject.UpdateRoses(client, false);
                    info2.UpdateRoses(client, true);
                    actor.Lock(4, false, false);
                    actorByReferenceId.Lock(4, false, false);
                    goto Label_0165;
                }
                referenceObject.UpdateKisses(client, false);
                info2.UpdateKisses(client, true);
                actor.Lock(3, false, false);
                actorByReferenceId.Lock(3, false, false);
            }
Label_0165:
            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actorByReferenceId, actionId), 0, false);
            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, actionId), 0, false);
            instanceBySpaceId.BroadcastMessage(SpaceUserAcceptInteract.Compose(actor, actorByReferenceId, actionId), 0, false);
        }