Beispiel #1
0
        public void RemoveUserFromRoom(GameClient Session, bool NotifyClient, bool NotifyKick)
        {
            int num = 1;
            if (Session != null && Session.GetHabbo() != null)
            {
                RoomUser @class = this.GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (@class != null)
                {
                    this.GetRoomTeamManager().OnUserLeave(@class);
                }
            }

            if (this.bool_12)
            {
                if (NotifyClient && Session != null)
                {
                    if (NotifyKick)
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.GenericError); // P
                        Message.AppendInt32(4008);
                        Session.SendMessage(Message);
                    }
                    ServerMessage Message5_ = new ServerMessage(Outgoing.OutOfRoom); // P
                    Session.SendMessage(Message5_);
                }
            }
            else
            {
                try
                {
                    if (Session != null && Session.GetHabbo() != null)
                    {
                        num = 2;
                        RoomUser @class = this.GetRoomUserByHabbo(Session.GetHabbo().Id);
                        if (@class != null)
                        {
                            this.RoomUsers[@class.int_20] = null;
                            @class.int_20 = -1;
                            this.byte_0[@class.X, @class.Y] = @class.byte_0;
                        }
                        num = 3;
                        if (NotifyClient)
                        {
                            if (NotifyKick)
                            {
                                ServerMessage Message = new ServerMessage(Outgoing.GenericError); // P
                                Message.AppendInt32(4008);
                                Session.SendMessage(Message);
                            }
                            ServerMessage Message5_ = new ServerMessage(Outgoing.OutOfRoom); // P
                            Session.SendMessage(Message5_);
                        }
                        num = 4;
                        if (@class != null && [email protected]_11)
                        {
                            if (@class.byte_1 > 0 && @class.GetClient() != null)
                            {
                                @class.GetClient().GetHabbo().GetEffectsInventoryComponent().int_0 = -1;
                            }
                            this.byte_0[@class.X, @class.Y] = @class.byte_0;
                            if (!this.IsPublic)
                            {
                                /*ServerMessage Message2 = new ServerMessage(Outgoing.KickMessage); // m8 idk
                                Message2.AppendBoolean(false);
                                Session.SendMessage(Message2);*/
                            }
                            ServerMessage Message3 = new ServerMessage(Outgoing.UserLeftRoom);
                            Message3.AppendRawInt32(@class.VirtualId);
                            this.SendMessage(Message3, null);
                            if (this.method_74(Session.GetHabbo().Id))
                            {
                                this.method_78(Session.GetHabbo().Id);
                            }
                            num = 5;
                            if (Session.GetHabbo().Username.ToLower() == this.Owner.ToLower() && this.HasEvent)
                            {
                                this.Event = null;
                                /*ServerMessage Logging = new ServerMessage(Outgoing.Logging);
                                Logging.AppendStringWithBreak("-1");
                                this.SendMessage(Logging, null);*/
                            }
                            num = 6;
                            if (@class.class34_1 != null)
                            {
                                @class.class34_1.RoomUser_0 = null;
                                @class.class34_1 = null;
                                Session.GetHabbo().GetEffectsInventoryComponent().int_0 = -1;
                            }
                            Session.GetHabbo().RemoveFromRoom();

                            this.bool_10 = true;
                            this.method_51();
                            List<RoomUser> list = new List<RoomUser>();
                            for (int i = 0; i < this.RoomUsers.Length; i++)
                            {
                                RoomUser class2 = this.RoomUsers[i];
                                if (class2 != null && class2.IsBot)
                                {
                                    list.Add(class2);
                                }
                            }
                            num = 7;
                            foreach (RoomUser current in list)
                            {
                                current.BotAI.OnUserLeaveRoom(Session);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogCriticalException(string.Concat(new object[]
						{
							"Error during removing user from room [Part: ",
							num,
							"]: ",
							ex.ToString()
						}));
                }
            }

        }
Beispiel #2
0
 public void method_6(int int_17, bool bool_13)
 {
     RoomUser @class = this.method_52(int_17);
     if (@class != null && @class.IsBot)
     {
         @class.BotAI.OnSelfLeaveRoom(bool_13);
         ServerMessage Message = new ServerMessage(Outgoing.UserLeftRoom); // Updated
         Message.AppendRawInt32(@class.VirtualId);
         this.SendMessage(Message, null);
         uint num = @class.UId;
         for (int i = 0; i < this.RoomUsers.Length; i++)
         {
             RoomUser class2 = this.RoomUsers[i];
             if (class2 != null && class2.UId == num)
             {
                 this.RoomUsers[i] = null;
             }
         }
     }
 }
Beispiel #3
0
        private void method_33()
        {
            this.alreadyDBUpdated = false;
            isCycling = true;
            int num = 0;
            if (!this.bool_6 && !this.bool_7)
            {
                try
                {
                    this.int_14++;
                    if (this.bool_10 && this.int_14 >= 10)
                    {
                        using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                        {
                            @class.ExecuteQuery(string.Concat(new object[]
							{
								"UPDATE rooms SET users_now = '",
								this.UserCount,
								"' WHERE Id = '",
								this.Id,
								"' LIMIT 1"
							}));
                        }
                        this.int_14 = 0;
                    }
                    this.method_35();
                    int num2 = 0;
                    try
                    {
                        if (this.hashtable_0 != null)
                        {
                            foreach (RoomItem class2 in this.Hashtable_0.Values)
                            {
                                if (class2.bool_1)
                                {
                                    try
                                    {
                                        class2.ProcessUpdates();
                                    }
                                    catch (Exception ex)
                                    {
                                        Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Process Floor Items");
                                        this.method_34();
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Process Floor Items");
                        this.method_34();
                    }
                    try
                    {
                        if (this.hashtable_4 != null)
                        {
                            foreach (RoomItem class2 in this.Hashtable_1.Values)
                            {
                                if (class2.bool_1)
                                {
                                    class2.ProcessUpdates();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Process Wall Items");
                        this.method_34();
                    }
                    List<uint> list = new List<uint>();
                    int num3 = 0;
                    if (this.RoomUsers != null)
                    {
                        try
                        {
                            for (int i = 0; i < this.RoomUsers.Length; i++)
                            {
                                RoomUser class3 = this.RoomUsers[i];
                                if (class3 != null)
                                {
                                    num = 1;
                                    if (!class3.IsBot && class3.GetClient() != null)
                                    {
                                        num3++;
                                        if (class3.GetClient().GetHabbo() != null && class3.GetClient().GetHabbo().int_4 > 0)
                                        {
                                            class3.GetClient().GetHabbo().int_4--;
                                            if (class3.GetClient().GetHabbo().int_4 == 0)
                                            {
                                                class3.GetClient().GetHabbo().IsMuted = false;
                                            }
                                        }
                                    }
                                    if (this.MusicController != null)
                                    {
                                        this.MusicController.Update(this);
                                    }
                                    class3.int_1++;
                                    this.GetFreeze().CycleUser(class3);
                                    num = 2;
                                    if (!class3.bool_8 && class3.int_1 >= ServerConfiguration.SleepTimer)
                                    {
                                        class3.bool_8 = true;
                                        ServerMessage Message = new ServerMessage(Outgoing.IdleStatus);
                                        Message.AppendInt32(class3.VirtualId);
                                        Message.AppendBoolean(true);
                                        this.SendMessage(Message, null);
                                    }
                                    num = 3;
                                    if (class3.GetClient() == null && !class3.IsBot)
                                    {
                                        this.RoomUsers[i] = null;
                                        if (!class3.bool_1)
                                        {
                                            this.byte_0[class3.X, class3.Y] = class3.byte_0;
                                        }
                                        ServerMessage Message2 = new ServerMessage(Outgoing.UserLeftRoom); // Updated
                                        Message2.AppendRawInt32(class3.VirtualId);
                                        this.SendMessage(Message2, null);
                                        this.method_50();
                                    }
                                    num = 4;
                                    if (class3.Boolean_2 && !list.Contains(class3.UId))
                                    {
                                        list.Add(class3.UId);
                                    }
                                    num = 5;
                                    if (class3.CarryItemID > 0)
                                    {
                                        class3.int_6--;
                                        if (class3.int_6 <= 0)
                                        {
                                            class3.CarryItem(0);
                                        }
                                    }
                                    num = 6;
                                    if (class3.bool_4 && class3.class34_1 == null)
                                    {
                                        num = 7;
                                        if (class3.IsBot && class3.RoomBot.RoomUser_0 != null && this.method_30(class3.int_12, class3.int_13, class3.double_0, true, true))
                                        {
                                            num = 8;
                                            this.method_85(class3);
                                            class3.X = class3.int_12;
                                            class3.Y = class3.int_13;
                                            class3.double_0 = class3.double_1;
                                            class3.RoomBot.RoomUser_0.X = class3.int_12;
                                            class3.RoomBot.RoomUser_0.Y = class3.int_13;
                                            class3.RoomBot.RoomUser_0.double_0 = class3.double_1 + 1.0;
                                            class3.RoomBot.RoomUser_0.bool_4 = false;
                                            class3.RoomBot.RoomUser_0.RemoveStatus("mv");
                                            if (class3.X == this.RoomModel.DoorX && class3.Y == this.RoomModel.DoorY && !list.Contains(class3.RoomBot.RoomUser_0.UId))
                                            {
                                                list.Add(class3.RoomBot.RoomUser_0.UId);
                                            }
                                            this.method_87(class3, true, true);
                                        }
                                        else
                                        {
                                            if (this.method_30(class3.int_12, class3.int_13, class3.double_0, true, class3.bool_1))
                                            {
                                                num = 8;
                                                this.method_85(class3);
                                                class3.X = class3.int_12;
                                                class3.Y = class3.int_13;
                                                class3.double_0 = class3.double_1;
                                                if (class3.X == this.RoomModel.DoorX && class3.Y == this.RoomModel.DoorY && !list.Contains(class3.UId) && !class3.IsBot)
                                                {
                                                    list.Add(class3.UId);
                                                }
                                                this.method_87(class3, true, true);
                                            }
                                        }
                                        class3.bool_4 = false;
                                    }
                                    num = 9;
                                    if (class3.bool_6 && !class3.bool_5 && class3.class34_1 == null)
                                    {
                                        num = 10;

                                        SquarePoint @struct = DreamPathfinder.GetNextStep(class3.X, class3.Y, class3.int_10, class3.int_11, this.byte_0, this.double_1, this.class28_0.double_1, this.double_2, this.class28_0.int_4, this.class28_0.int_5, class3.bool_1, this.bool_5, this.HeightOverride, this.GroupGateGuildIds, this, class3.double_0);
                                        num = 11;
                                        if (@struct.X != class3.X || @struct.Y != class3.Y)
                                        {
                                            num = 12;
                                            int int32_ = @struct.X;
                                            int int32_2 = @struct.Y;

                                            if (this.GroupGateGuildIds[@struct.X, @struct.Y] > 0)
                                            {
                                                int RequiredGroupId = this.GroupGateGuildIds[@struct.X, @struct.Y];
                                                bool IsGroupMember = false;
                                                foreach (DataRow dataRow in class3.GetClient().GetHabbo().dataTable_0.Rows)
                                                {
                                                    if ((int)dataRow["groupid"] == RequiredGroupId)
                                                    {
                                                        IsGroupMember = true;
                                                    }
                                                }
                                                if (IsGroupMember)
                                                {
                                                }
                                                else
                                                {
                                                    goto IL_CE1;
                                                }
                                            }
                                            bool b = false;
                                            class3.RemoveStatus("mv");
                                            double num4 = @struct.WalkUnder ? @struct.SmallestZ(class3.double_0) : this.method_84(int32_, int32_2, this.method_93(int32_, int32_2));
                                            class3.Statusses.Remove("lay");
                                            class3.Statusses.Remove("sit");
                                            class3.AddStatus("mv", string.Concat(new object[]
											{
												int32_,
												",",
												int32_2,
												",",
												num4.ToString().Replace(',', '.')
											}));
                                            num = 13;
                                            if (class3.IsBot && class3.RoomBot.RoomUser_0 != null)
                                            {
                                                class3.RoomBot.RoomUser_0.AddStatus("mv", string.Concat(new object[]
												{
													int32_,
													",",
													int32_2,
													",",
													(num4 + 1.0).ToString().Replace(',', '.')
												}));
                                            }
                                            int num5;
                                            if (class3.bool_3)
                                            {
                                                num5 = Rotation.GetReverseRotation(class3.X, class3.Y, int32_, int32_2);
                                            }
                                            else
                                            {
                                                num5 = Rotation.GetRotation(class3.X, class3.Y, int32_, int32_2);
                                            }
                                            class3.BodyRotation = num5;
                                            class3.int_7 = num5;
                                            class3.bool_4 = true;
                                            class3.int_12 = int32_;
                                            class3.int_13 = int32_2;
                                            class3.double_1 = num4;
                                            num = 14;
                                            if (class3.IsBot && class3.RoomBot.RoomUser_0 != null)
                                            {
                                                class3.RoomBot.RoomUser_0.BodyRotation = num5;
                                                class3.RoomBot.RoomUser_0.int_7 = num5;
                                                class3.RoomBot.RoomUser_0.bool_4 = true;
                                                class3.RoomBot.RoomUser_0.int_12 = int32_;
                                                class3.RoomBot.RoomUser_0.int_13 = int32_2;
                                                class3.RoomBot.RoomUser_0.double_1 = num4 + 1.0;
                                            }
                                            try
                                            {
                                                num = 15;
                                                if (!class3.IsBot)
                                                {
                                                    if (class3.GetClient().GetHabbo().Gender.ToLower() == "m" && this.byte_1[int32_, int32_2] > 0 && class3.byte_1 != this.byte_1[int32_, int32_2])
                                                    {
                                                        class3.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2((int)this.byte_1[int32_, int32_2], true);
                                                        class3.byte_1 = this.byte_1[int32_, int32_2];
                                                    }
                                                    else
                                                    {
                                                        if (class3.GetClient().GetHabbo().Gender.ToLower() == "f" && this.byte_2[int32_, int32_2] > 0 && class3.byte_1 != this.byte_2[int32_, int32_2])
                                                        {
                                                            class3.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2((int)this.byte_2[int32_, int32_2], true);
                                                            class3.byte_1 = this.byte_2[int32_, int32_2];
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (!class3.IsPet)
                                                    {
                                                        if (this.byte_1[int32_, int32_2] > 0)
                                                        {
                                                            class3.RoomBot.EffectId = (int)this.byte_1[int32_, int32_2];
                                                            class3.byte_1 = this.byte_1[int32_, int32_2];
                                                        }
                                                        ServerMessage Message3 = new ServerMessage(Outgoing.ApplyEffects); // P
                                                        Message3.AppendInt32(class3.VirtualId);
                                                        Message3.AppendInt32(class3.RoomBot.EffectId);
                                                        Message3.AppendInt32(0);
                                                        this.SendMessage(Message3, null);
                                                    }
                                                }
                                                goto IL_CE1;
                                            }
                                            catch
                                            {
                                                goto IL_CE1;
                                            }
                                        IL_B8B:
                                            this.method_87(class3, false, true);
                                            class3.UpdateNeeded = true;
                                            if (class3.IsBot && class3.RoomBot.RoomUser_0 != null)
                                            {
                                                this.method_87(class3.RoomBot.RoomUser_0, true, true);
                                                class3.RoomBot.RoomUser_0.UpdateNeeded = true;
                                                goto IL_BE0;
                                            }
                                            goto IL_BE0;
                                        IL_CE1:
                                            num = 16;
                                            this.byte_0[class3.X, class3.Y] = class3.byte_0;
                                            class3.byte_0 = this.byte_0[class3.int_12, class3.int_13];
                                            if (this.AllowWalkthrough)
                                            {
                                                goto IL_B8B;
                                            }
                                            this.byte_0[int32_, int32_2] = 0;
                                            goto IL_B8B;

                                        }
                                        num = 12;
                                        class3.bool_6 = false;
                                        class3.RemoveStatus("mv");
                                        class3.bool_10 = false;
                                        if (class3.IsBot && class3.RoomBot.RoomUser_0 != null)
                                        {
                                            class3.RoomBot.RoomUser_0.RemoveStatus("mv");
                                            class3.RoomBot.RoomUser_0.bool_6 = false;
                                            class3.RoomBot.RoomUser_0.bool_10 = false;
                                            class3.RoomBot.RoomUser_0.UpdateNeeded = true;
                                        }
                                    IL_BE0:
                                        class3.UpdateNeeded = true;
                                    }
                                    else
                                    {
                                        num = 17;
                                        if (class3.Statusses.ContainsKey("mv") && class3.class34_1 == null)
                                        {
                                            num = 18;
                                            class3.RemoveStatus("mv");
                                            class3.UpdateNeeded = true;
                                            if (class3.IsBot && class3.RoomBot.RoomUser_0 != null)
                                            {
                                                class3.RoomBot.RoomUser_0.RemoveStatus("mv");
                                                class3.RoomBot.RoomUser_0.UpdateNeeded = true;
                                            }
                                        }
                                    }
                                    if (class3.IsBot || class3.IsPet)
                                    {
                                        try
                                        {
                                            class3.BotAI.OnTimerTick();
                                            goto IL_C9F;
                                        }
                                        catch
                                        {
                                            goto IL_C9F;
                                        }
                                    }
                                    goto IL_C9B;
                                IL_C9F:
                                    if (class3.int_9 > 0)
                                    {
                                        if (class3.int_9 == 1)
                                        {
                                            this.method_87(class3, true, true);
                                        }
                                        class3.int_9--;
                                        goto IL_CD6;
                                    }
                                    goto IL_CD6;
                                IL_C9B:
                                    num2++;
                                    goto IL_C9F;
                                }
                            IL_CD6: ;
                            }
                        }
                        catch (Exception ex)
                        {
                            Logging.LogThreadException(ex.ToString(), string.Concat(new object[]
							{
								"Room [ID: ",
								this.Id,
								"] [Part: ",
								num,
								" cycle task -- Process Users Updates"
							}));
                            // this.method_34();
                        }
                    }
                    try
                    {
                        foreach (uint current in list)
                        {
                            this.RemoveUserFromRoom(Essential.GetGame().GetClientManager().GetClient(current), true, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Remove Users");
                        this.method_34();
                    }
                    if (num2 >= 1)
                    {
                        this.int_8 = 0;
                    }
                    else
                    {
                        this.int_8++;
                    }
                    if (!this.bool_6 && !this.bool_7)
                    {
                        try
                        {
                            if (this.int_8 >= 20)
                            {
                                Essential.GetGame().GetRoomManager().method_16(this);
                                return;
                            }
                            ServerMessage Logging = this.method_67(false);
                            if (Logging != null)
                            {
                                this.SendMessage(Logging, null);
                            }
                        }
                        catch (Exception ex)
                        {
                            Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task -- Cycle End");
                            this.method_34();
                        }
                    }
                    this.class27_0.UsersNow = num3;
                }
                catch (Exception ex)
                {
                    Logging.LogThreadException(ex.ToString(), "Room [ID: " + this.Id + "] cycle task");
                }
            }
            isCycling = false;
        }