Пример #1
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int         num  = Event.PopWiredInt32();
            List <uint> list = new List <uint>();

            for (int i = 0; i < num; i++)
            {
                list.Add(Event.PopWiredUInt());
            }
            string text = Event.PopFixedString();

            text = Essential.DoFilter(text, true, false);
            text = ChatCommandHandler.ApplyFilter(text);
            ServerMessage Message = new ServerMessage(Outgoing.InstantInvite);     // Update

            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendStringWithBreak(text);
            foreach (uint current in list)
            {
                if (Session.GetHabbo().GetMessenger().method_9(Session.GetHabbo().Id, current))
                {
                    GameClient @class = Essential.GetGame().GetClientManager().GetClient(current);
                    if (@class == null)
                    {
                        break;
                    }
                    @class.SendMessage(Message);
                }
            }
        }
Пример #2
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                RoomItem class2 = @class.method_28(Event.PopWiredUInt());
                if (class2 != null)
                {
                    string text = class2.GetBaseItem().InteractionType.ToLower();
                    if (text != null)
                    {
                        switch (text)
                        {
                        case "wf_trg_atscore":
                        {
                            Event.PopWiredInt32();
                            class2.string_3 = Event.PopWiredInt32().ToString();
                            goto updatethings;
                        }

                        case "wf_cnd_time_more_than":
                        case "wf_cnd_time_less_than":
                        {
                            string   text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2));
                            string[] array = text2.Split(new char[]
                                {
                                    '@'
                                });
                            class2.string_3 = array[0];
                            class2.string_2 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5));
                            goto updatethings;
                        }

                        case "wf_trg_attime":
                        {
                            int    junk    = Event.PopWiredInt32();
                            int    junk2   = Event.PopWiredInt32();
                            string message = Event.PopFixedString();
                            class2.string_3 = message;
                            class2.string_2 = Convert.ToString(Convert.ToString((double)junk2 * 0.5));
                            goto updatethings;
                        }

                        case "wf_trg_timer":
                        {
                            Event.PopWiredInt32();
                            string   text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2));
                            string[] array = text2.Split(new char[]
                                {
                                    '@'
                                });
                            class2.string_3 = array[0];
                            class2.string_2 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5));
                            goto updatethings;
                        }

                        case "wf_cnd_actor_in_group":
                        case "wf_trg_enterroom":
                        case "wf_cnd_not_in_group":
                        {
                            Event.PopWiredInt32();
                            string text3 = Event.PopFixedString();
                            class2.string_2 = text3;
                            goto updatethings;
                        }

                        case "wf_trg_onsay":
                        {
                            Event.PopWiredInt32();
                            bool   value = (Event.PopWiredInt32() == 1);
                            string text3 = Event.PopFixedString();
                            text3 = Essential.DoFilter(text3, false, true);
                            if (text3.Length > 100)
                            {
                                text3 = text3.Substring(0, 100);
                            }
                            class2.string_2 = text3;
                            class2.string_3 = Convert.ToString(value);
                            goto updatethings;
                        }
                        }
                    }
updatethings:
                    class2.UpdateState(true, false);
                    Session.SendMessage(new ServerMessage(Outgoing.SaveWired)); // NEW
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string text = Essential.DoFilter(Event.PopFixedString(), false, true);

            if (text.Length < 3)
            {
                ServerMessage Message = new ServerMessage(Outgoing.ChangeUsernameError); // Updated
                Message.AppendInt32(2);
                Message.AppendString(text);
                Message.AppendInt32(0);
                Session.SendMessage(Message);
            }
            else
            {
                if (text.Length > 15)
                {
                    ServerMessage Message = new ServerMessage(Outgoing.ChangeUsernameError); // Updated
                    Message.AppendInt32(3);
                    Message.AppendString(text);
                    Message.AppendInt32(0);
                    Session.SendMessage(Message);
                }
                else
                {
                    if (text.Contains(" ") || !Session.GetClientMessageHandler().method_8(text) || text != ChatCommandHandler.ApplyFilter(text))
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.ChangeUsernameError); // Updated
                        Message.AppendInt32(5);
                        Message.AppendString(text);
                        Message.AppendInt32(0);
                        Session.SendMessage(Message);
                    }
                    else
                    {
                        if (Event.Id == 3511)
                        {
                            ServerMessage Message = new ServerMessage(Outgoing.ChangeUsernameError); // Updated
                            Message.AppendInt32(0);
                            Message.AppendString(text);
                            Message.AppendInt32(0);
                            Session.SendMessage(Message);
                        }
                        else
                        {
                            if (Event.Id == 1457)
                            {
                                ServerMessage Message3 = new ServerMessage(Outgoing.ChangeUsername1); // Updated
                                Message3.AppendUInt(Session.GetHabbo().Id);
                                Message3.AppendUInt(Session.GetHabbo().CurrentRoomId);
                                Message3.AppendString(text);
                                Session.SendMessage(Message3);
                                if (Session.GetHabbo().CurrentRoomId > 0u)
                                {
                                    Room          @class   = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                                    RoomUser      class2   = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                                    ServerMessage Message4 = new ServerMessage(Outgoing.SetRoomUser); // P
                                    Message4.AppendInt32(1);
                                    class2.method_14(Message4);
                                    @class.SendMessage(Message4, null);
                                }
                                Dictionary <Room, int> dictionary = Essential.GetGame().GetRoomManager().method_22();
                                IEnumerable <Room>     arg_204_0  = dictionary.Keys;
                                if (ChangeUserNameMessageEvent.func_0 == null)
                                {
                                    ChangeUserNameMessageEvent.func_0 = new Func <Room, int>(ChangeUserNameMessageEvent.smethod_0);
                                }
                                IOrderedEnumerable <Room> orderedEnumerable = arg_204_0.OrderByDescending(ChangeUserNameMessageEvent.func_0);
                                foreach (Room current in orderedEnumerable)
                                {
                                    if (current.Owner == Session.GetHabbo().Username)
                                    {
                                        current.Owner = text;
                                        Essential.GetGame().GetRoomManager().method_16(Essential.GetGame().GetRoomManager().GetRoom(current.Id));
                                    }
                                }
                                using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
                                {
                                    class3.AddParamWithValue("newuname", text);
                                    class3.AddParamWithValue("olduname", Session.GetHabbo().Username);
                                    class3.ExecuteQuery(string.Concat(new string[]
                                    {
                                        "UPDATE rooms SET owner = @newuname WHERE owner = @olduname"
                                    }));
                                    class3.AddParamWithValue("newuname", text);

                                    class3.ExecuteQuery(string.Concat(new object[]
                                    {
                                        "UPDATE users SET username = @newuname WHERE Id = '",
                                        Session.GetHabbo().Id,
                                        "' LIMIT 1"
                                    }));
                                    Essential.GetGame().GetClientManager().StoreCommand(Session, "flagme", "OldName: " + Session.GetHabbo().Username + " NewName: " + text);
                                    Session.GetHabbo().Username = text;
                                    Session.GetHabbo().method_1(class3);
                                    foreach (RoomData current2 in Session.GetHabbo().OwnedRooms)
                                    {
                                        current2.Owner = text;
                                    }
                                }
                                Session.GetHabbo().ChangeNamaAchievementsCompleted();
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                Room     @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                uint     uint_  = Event.PopWiredUInt();
                RoomItem class2 = @class.method_28(uint_);
                string   text   = class2.GetBaseItem().InteractionType.ToLower();
                switch (text)
                {
                case "wf_act_give_phx":
                {
                    Event.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.ApplyFilter(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (Essential.GetGame().GetRoleManager().HasSuperWiredFXFuse(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(EssentialEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_cnd_phx":
                {
                    Event.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.ApplyFilter(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (Essential.GetGame().GetRoleManager().HasSuperWiredcndFuse(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(EssentialEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_act_saymsg":
                {
                    Event.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.DoFilter(text2, false, true);
                    if (text2.Length > 100)
                    {
                        text2 = text2.Substring(0, 100);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_act_kick_user":
                {
                    Event.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.DoFilter(text2, false, true);
                    if (text2.Length > 200)
                    {
                        text2 = text2.Substring(0, 200);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_trg_furnistate":
                case "wf_trg_onfurni":
                case "wf_trg_offfurni":
                case "wf_act_moveuser":
                case "wf_act_togglefurni":
                {
                    Event.PopWiredInt32();
                    Event.PopFixedString();

                    /*    class2.string_2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2));
                     *  class2.string_2 = class2.string_2.Substring(0, class2.string_2.Length - 2);
                     *  Event.ResetPointer();
                     *  class2 = @class.method_28(Event.PopWiredUInt());
                     *  Event.PopWiredBoolean();
                     *  Event.PopFixedString();
                     */
                    int num2 = Event.PopWiredInt32();
                    class2.string_3 = "";
                    for (int i = 0; i < num2; i++)
                    {
                        class2.string_3 = class2.string_3 + "," + Convert.ToString(Event.PopWiredUInt());
                    }

                    if (class2.string_3.Length > 0)
                    {
                        class2.string_3 = class2.string_3.Substring(1);
                    }
                    class2.string_2 = (Convert.ToDouble(Event.PopWiredInt32()) / 2) + "";
                    break;
                }

                case "wf_act_givepoints":
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    break;

                case "wf_act_moverotate":
                {
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    Event.PopWiredBoolean();
                    Event.PopWiredBoolean();
                    int num2 = Event.PopWiredInt32();
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }

                case "wf_act_matchfurni":
                {
                    Event.PopWiredInt32();
                    Event.PopWiredBoolean();
                    Event.PopWiredBoolean();

                    class2.string_3 = "";

                    RoomItem expr_4A8 = class2;
                    expr_4A8.string_3 += "I";


                    RoomItem expr_4E1 = class2;
                    expr_4E1.string_3 += "I";

                    RoomItem expr_51A = class2;
                    expr_51A.string_3 += "I";

                    // Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_2 = "";
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                            RoomItem class3   = @class.method_28(Convert.ToUInt32(num3));
                            RoomItem expr_5E6 = class2;
                            object   string_2 = expr_5E6.string_2;
                            expr_5E6.string_2 = string.Concat(new object[]
                                {
                                    string_2,
                                    ";",
                                    class3.GetX,
                                    ",",
                                    class3.Int32_1,
                                    ",",
                                    class3.Double_0,
                                    ",",
                                    class3.int_3,
                                    ",",
                                    class3.ExtraData
                                });
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                        class2.string_2 = class2.string_2.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }
                }
                Session.SendMessage(new ServerMessage(Outgoing.SaveWired)); // NEW
                class2.UpdateState(true, false);
            }
            catch
            {
            }
        }