Esempio n. 1
0
		internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, double NextZ)
		{
			ServerMessage serverMessage = new ServerMessage(0);
			serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
			serverMessage.AppendInt32(pUser.X);
			serverMessage.AppendInt32(pUser.Y);
			serverMessage.AppendInt32(pNextCoord.X);
			serverMessage.AppendInt32(pNextCoord.Y);
			serverMessage.AppendInt32(0);
			serverMessage.AppendUInt(pRollerID);
			serverMessage.AppendInt32(2);
			serverMessage.AppendInt32(pUser.VirtualId);
			serverMessage.AppendString(TextHandling.GetString(pUser.Z));
			serverMessage.AppendString(TextHandling.GetString(NextZ));
			this.room.GetGameMap().UpdateUserMovement(new Point(pUser.X, pUser.Y), new Point(pNextCoord.X, pNextCoord.Y), pUser);
			this.room.GetGameMap().GameMap[pUser.X, pUser.Y] = 1;
			pUser.X = pNextCoord.X;
			pUser.Y = pNextCoord.Y;
			pUser.Z = NextZ;
			this.room.GetGameMap().GameMap[pUser.X, pUser.Y] = 0;
			return serverMessage;
		}
Esempio n. 2
0
		internal ServerMessage SerializeBotInventory()
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.BotInventoryMessageComposer);
			serverMessage.AppendInt32(this.InventoryBots.Count);
			foreach (RoomBot current in this.InventoryBots.Values)
			{
				serverMessage.AppendUInt(current.BotId);
				serverMessage.AppendString(current.Name);
				serverMessage.AppendString(current.Motto);
				serverMessage.AppendString("m");
				serverMessage.AppendString(current.Look);
			}
			return serverMessage;
		}
Esempio n. 3
0
        public bool Parse(string Input)
        {
            if (Input.StartsWith(":"))
            {
                Input = Input.Substring(1);
                string[] Params = Input.Split(new char[] { ' ' });
                switch (Params[0].ToLower())
                {
                    case "commands":
                    case "comandos":
                        if (this.Session.GetHabbo().GotCommand("commands"))
                        {
                            StringBuilder builder = new StringBuilder();
                            builder.Append("Your commands:\n");
                            foreach (DataRow row in this.Commands.Rows)
                            {
                                builder.Append(":" + Convert.ToString(row[0]) + " " + Convert.ToString(row[1]) + " - " + Convert.ToString(row[2]) + "\n");
                            }
                            this.Session.SendNotifWithScroll(builder.ToString());
                        }
                        return true;
                    case "about":
                    case "info":
                        {
                            ServerMessage Message = new ServerMessage(Outgoing.SuperNotificationMessageComposer);

                            Message.AppendString("mercury22");
                            Message.AppendInt32(4);
                            Message.AppendString("title");
                            Message.AppendString("About the server");
                            Message.AppendString("message");

                            StringBuilder info = new StringBuilder();
                            info.Append("This hotel uses an extremely-modified PlusEMU.");
                            info.Append("<br /><br />");
                            info.Append("<font color=\"#002C59\" size=\"16\"><b>Cyber Emulator" + CyberEnvironment.PrettyBuild + "</b></font><br />Developed by <b>Kessiler Rodrigues</b><br />");
                            info.Append("<br />");
                            info.Append("<b>Build:</b> " + CyberEnvironment.PrettyRelease);
                            info.Append("<br />");

                            int userCount = CyberEnvironment.GetGame().GetClientManager().clients.Count;
                            int roomsCount = CyberEnvironment.GetGame().GetRoomManager().loadedRooms.Count;
                            info.Append("<b>Users:</b> " + userCount + " in " + roomsCount + ((roomsCount == 1) ? " Room" : " Rooms") + ".<br /><br /><br />");
                            Message.AppendString(info.ToString());
                            Message.AppendString("linkUrl");
                            Message.AppendString("event:");
                            Message.AppendString("linkTitle");
                            Message.AppendString("ok");
                            this.Session.SendMessage(Message);
                        }
                        return true;

                    case "sit":
                        {
                            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
                            RoomUser roomUserByHabbo = currentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if ((currentRoom != null) && (roomUserByHabbo != null))
                            {
                                if (((!roomUserByHabbo.IsLyingDown && !roomUserByHabbo.IsLyingDown) && (!roomUserByHabbo.RidingHorse && !roomUserByHabbo.IsWalking)) && !roomUserByHabbo.Statusses.ContainsKey("sit"))
                                {
                                    if ((roomUserByHabbo.RotBody % 2) != 0)
                                    {
                                        roomUserByHabbo.RotBody--;
                                    }
                                    roomUserByHabbo.Statusses.Add("sit", "0.55");
                                    roomUserByHabbo.IsSitting = true;
                                    roomUserByHabbo.UpdateNeeded = true;
                                }
                                return true;
                            }
                            return true;
                        }

                    case "lay":
                        {
                            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
                            RoomUser roomUserByHabbo = currentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if ((currentRoom != null) && (roomUserByHabbo != null))
                            {
                                if (((!roomUserByHabbo.IsSitting && !roomUserByHabbo.IsSitting) && (!roomUserByHabbo.RidingHorse && !roomUserByHabbo.IsWalking)) && !roomUserByHabbo.Statusses.ContainsKey("lay"))
                                {
                                    if ((roomUserByHabbo.RotBody % 2) != 0)
                                    {
                                        roomUserByHabbo.RotBody--;
                                    }
                                    roomUserByHabbo.Statusses.Add("lay", "0.55");
                                    roomUserByHabbo.IsLyingDown = true;
                                    roomUserByHabbo.UpdateNeeded = true;
                                }
                                return true;
                            }
                            return true;
                        }

                    case "stand":
                        {
                            Room room2 = this.Session.GetHabbo().CurrentRoom;
                            RoomUser user2 = room2.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if ((room2 != null) && (user2 != null))
                            {
                                if (user2.IsSitting)
                                {
                                    user2.Statusses.Remove("sit");
                                    user2.IsSitting = false;
                                    user2.UpdateNeeded = true;
                                }
                                else if (user2.IsLyingDown)
                                {
                                    user2.Statusses.Remove("lay");
                                    user2.IsLyingDown = false;
                                    user2.UpdateNeeded = true;
                                }
                                return true;
                            }
                            return true;
                        }

                    case "ejectpets":
                    case "pickpets":
                        {
                            if (!this.Session.GetHabbo().GotCommand("pickall"))
                            {
                                return true;//1121;
                            }

                            Room room3 = this.Session.GetHabbo().CurrentRoom;
                            if (room3 == null)
                            {
                                return true;//1121;
                            }

                            foreach (Pet Pet in room3.GetRoomUserManager().GetPets())
                            {
                                if (Pet.OwnerId != Session.GetHabbo().Id)
                                {
                                    continue;
                                }
                                this.Session.GetHabbo().GetInventoryComponent().AddPet(Pet);
                                room3.GetRoomUserManager().RemoveBot(Pet.VirtualId, false);
                            }
                            this.Session.SendMessage(this.Session.GetHabbo().GetInventoryComponent().SerializePetInventory());
                            return true;
                        }

                    case "pickall":
                        {
                            if (!this.Session.GetHabbo().GotCommand("pickall"))
                            {
                                return true;//1121;
                            }
                            Room room3 = this.Session.GetHabbo().CurrentRoom;
                            if ((room3 == null) || !room3.CheckRights(this.Session, true, false))
                            {
                                this.Session.SendNotif("Ocurri\x00f3 un error.");
                                return true;//1121;
                            }
                            List<RoomItem> roomItemList = room3.GetRoomItemHandler().RemoveAllFurniture(this.Session);
                            if (this.Session.GetHabbo().GetInventoryComponent() != null)
                            {
                                this.Session.GetHabbo().GetInventoryComponent().AddItemArray(roomItemList);
                                this.Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
                            }

                            return true;
                        }

                    case "unbugwalk":
                    case "unbug":
                    case "desbuggear":
                    case "desbuggearsala":
                        {
                            Room room = this.Session.GetHabbo().CurrentRoom;
                            if ((room != null) && room.CheckRights(this.Session, true))
                            {
                                room.GetRoomUserManager().ToSet.Clear();
                                foreach (RoomUser User in room.GetRoomUserManager().GetRoomUsers())
                                {
                                    User.ClearMovement(true);
                                }
                            }
                            return true;
                        }
                    case "unload":
                    case "reload":
                        if (this.Session.GetHabbo().GotCommand("reload"))
                        {
                            Room room = this.Session.GetHabbo().CurrentRoom;
                            if ((room != null) && room.CheckRights(this.Session, true, false))
                            {
                                CyberEnvironment.GetGame().GetRoomManager().UnloadRoom(room);
                                room.RequestReload();
                            }
                        }
                        return true;

                    case "setmax":
                        if (!this.Session.GetHabbo().GotCommand("setmax"))
                        {
                            return true;//1242;
                        }
                        if (Params.Length != 1)
                        {
                            try
                            {
                                int maxUsers = int.Parse(Params[1]);
                                if ((maxUsers > 100) && (this.Session.GetHabbo().Rank < 3))
                                {
                                    this.Session.SendNotif("El m\x00e1ximo es 100");
                                    return true;
                                }
                                if ((maxUsers < 10) && (this.Session.GetHabbo().Rank < 3))
                                {
                                    this.Session.SendNotif("El m\x00ednimo es 10");
                                    return true;
                                }
                                Room room5 = this.Session.GetHabbo().CurrentRoom;
                                room5.UsersMax = maxUsers;
                                room5.SetMaxUsers(maxUsers);
                            }
                            catch
                            {
                            }
                            return true;//1242;
                        }
                        SendChatMessage(this.Session, "You must enter a number to set");
                        return true;

                    case "userinfo":
                    case "ui":
                        {
                            if (!this.Session.GetHabbo().GotCommand("userinfo"))
                            {
                                return true;//1549;
                            }
                            string str = Params[1];
                            bool flag = true;
                            if (!string.IsNullOrEmpty(str))
                            {
                                GameClient clientByUsername = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str);
                                if ((clientByUsername == null) || (clientByUsername.GetHabbo() == null))
                                {
                                    using (IQueryAdapter adapter = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                    {
                                        adapter.setQuery("SELECT username, rank, online, id, motto, credits FROM users WHERE username=@user LIMIT 1");
                                        adapter.addParameter("user", str);
                                        DataRow row2 = adapter.getRow();
                                        this.Session.SendNotif("User Info for " + str + ":\rRank: " + row2[1].ToString() + " \rUser Id: " + row2[3].ToString() + " \rMotto: " + row2[4].ToString() + " \rCredits: " + row2[5].ToString() + " \r");
                                    }
                                    return true;
                                }
                                Habbo habbo = clientByUsername.GetHabbo();
                                StringBuilder builder3 = new StringBuilder();
                                if (habbo.CurrentRoom != null)
                                {
                                    builder3.Append(" - ROOM INFORMAtiON [" + habbo.CurrentRoom.RoomId + "] - \r");
                                    builder3.Append("Owner: " + habbo.CurrentRoom.Owner + "\r");
                                    builder3.Append("Room Name: " + habbo.CurrentRoom.Name + "\r");
                                    builder3.Append(string.Concat(new object[] { "Current Users: ", habbo.CurrentRoom.UserCount, "/", habbo.CurrentRoom.UsersMax }));
                                }
                                this.Session.SendNotif(string.Concat(new object[] { 
                                "User info for: ", str, ":\rRank: ", habbo.Rank, " \rOnline: ", flag.ToString(), " \rUser Id: ", habbo.Id, " \rCurrent Room: ", habbo.CurrentRoomId, " \rMotto: ", habbo.Motto, " \rCredits: ", habbo.Credits, " \rMuted: ", habbo.Muted.ToString(), 
                                "\r\r\r", builder3.ToString()
                             }));
                                return true;
                            }
                            this.Session.SendNotif("Please enter a username");
                            return true;
                        }
                    case "disablediagonal":
                    case "disablediag":
                    case "togglediagonal":
                        if (this.Session.GetHabbo().GotCommand("disablediagonal"))
                        {
                            Room room6 = this.Session.GetHabbo().CurrentRoom;
                            room6 = this.Session.GetHabbo().CurrentRoom;
                            if ((room6 != null) && room6.CheckRights(this.Session, true, false))
                            {
                                if (!room6.GetGameMap().DiagonalEnabled)
                                {
                                    room6.GetGameMap().DiagonalEnabled = true;
                                }
                                else
                                {
                                    room6.GetGameMap().DiagonalEnabled = false;
                                }
                            }
                        }
                        return true;

                    case "freeze":
                        if (this.Session.GetHabbo().GotCommand("freeze"))
                        {
                            Room room1 = this.Session.GetHabbo().CurrentRoom;
                            RoomUser user3 = this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]);
                            if (user3 != null)
                            {
                                user3.Frozen = true;
                            }
                        }
                        return true;

                    case "unfreeze":
                        if (this.Session.GetHabbo().GotCommand("unfreeze"))
                        {
                            Room room41 = this.Session.GetHabbo().CurrentRoom;
                            RoomUser user4 = this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]);
                            if (user4 != null)
                            {
                                user4.Frozen = false;
                            }
                        }
                        return true;

                    case "setspeed":
                        if (this.Session.GetHabbo().GotCommand("setspeed"))
                        {
                            Room room7 = this.Session.GetHabbo().CurrentRoom;
                            room7 = this.Session.GetHabbo().CurrentRoom;
                            if ((room7 != null) && room7.CheckRights(this.Session, true, false))
                            {
                                try
                                {
                                    this.Session.GetHabbo().CurrentRoom.GetRoomItemHandler().SetSpeed(int.Parse(Params[1]));
                                }
                                catch
                                {
                                    this.Session.SendNotif("Numbers Only!");
                                }
                            }
                        }
                        return true;

                    case "regenmaps":
                    case "reloadmaps":
                    case "fixroom":
                        {
                            if (!this.Session.GetHabbo().GotCommand("regenmaps"))
                            {
                                return true;
                            }
                            Room room8 = this.Session.GetHabbo().CurrentRoom;
                            if (room8 != null)
                            {
                                if (!room8.CheckRights(this.Session, true, false))
                                {
                                    return true;
                                }
                                room8.GetGameMap().GenerateMaps(true);
                                this.Session.SendNotif("The room map has been refreshed!");
                                return true;
                            }
                            return true;
                        }

                    case "convertcredits":
                    case "redeemall":
                        if (this.Session.GetHabbo().GotCommand("redeemall"))
                        {
                            try
                            {
                                this.Session.GetHabbo().GetInventoryComponent().Redeemcredits(this.Session);
                                SendChatMessage(this.Session, "\x00a1Todos los cr\x00e9ditos fueron convertidos!");
                            }
                            catch (Exception exception)
                            {
                                Console.WriteLine(exception);
                            }
                        }
                        return true;

                    case "setvideo":
                    case "ponervideo":
                    case "colocarvideo":
                        if (this.Session.GetHabbo().GotCommand("redeemall"))
                        {
                            Room Room = this.Session.GetHabbo().CurrentRoom;
                            if (Room == null || !Room.CheckRights(Session))
                                return true;

                            if (Params.Length < 2)
                                return true;

                            string Video = Params[1].Replace("https://", "http://").Split('&')[0];

                            if (CyberEnvironment.GetGame().GetVideoManager().PlayVideoInRoom(Room, Video))
                            {
                                Session.SendNotif("Good, your custom video is being now played in all the room TVs! Double click one, wait and you'll see.");
                            }
                            else
                            {
                                Session.SendNotif("There was an error. Please, verify your video link is correct.");
                            }


                        }
                        return true;

                    case "mutebots":
                    case "mutepets":
                        if (this.Session.GetHabbo().GotCommand("mutebots") && this.Session.GetHabbo().CurrentRoom.CheckRights(this.Session, true, false))
                        {
                            Room room9 = this.Session.GetHabbo().CurrentRoom;
                            if (!room9.MutedBots)
                            {
                                room9.MutedBots = true;
                            }
                            else
                            {
                                room9.MutedBots = false;
                            }
                            SendChatMessage(this.Session, "Muted bots have been toggled");
                        }
                        return true;

                    case "dance":
                        {
                            int result = 1;
                            if ((Params.Length > 1) && int.TryParse(Params[1], out result))
                            {
                                result = 1;
                            }
                            if ((result > 4) || (result < 0))
                            {
                                this.Session.SendWhisper("The dance ID must be between 0 and 4!");
                                result = 0;
                            }
                            ServerMessage message2 = new ServerMessage();
                            message2.Init(Outgoing.DanceStatusMessageComposer);
                            message2.AppendInt32(this.Session.CurrentRoomUserID);
                            message2.AppendInt32(result);
                            this.Session.GetHabbo().CurrentRoom.SendMessage(message2);
                            return true;
                        }
                    case "deletegroup":
                        {
                            if (!this.Session.GetHabbo().GotCommand("deletegroup"))
                            {
                                return true;//1E19;
                            }
                            Room room12 = this.Session.GetHabbo().CurrentRoom;
                            if (room12.CheckRights(this.Session, true, false))
                            {
                                if ((Params.Length == 1) || (Params[1].ToLower() != "yes"))
                                {
                                    this.Session.SendNotif("Are you sure you want to delete this group?\nOnce you delete it you will never be able to get it back.\n\nTo continue, type ':deletegroup yes' (without '')");
                                    return true;
                                }
                                if (room12.Group == null)
                                {
                                    this.Session.SendNotif("This room does not have a group.");
                                    return true;
                                }
                                Guild group = room12.Group;
                                foreach (GroupUser user7 in group.Members.Values)
                                {
                                    GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(user7.Id);
                                    if (clientByUserID != null)
                                    {
                                        clientByUserID.GetHabbo().UserGroups.Remove(user7);
                                        if (clientByUserID.GetHabbo().FavouriteGroup == group.Id)
                                        {
                                            clientByUserID.GetHabbo().FavouriteGroup = 0;
                                        }
                                    }
                                }
                                room12.RoomData.Group = null;
                                CyberEnvironment.GetGame().GetGroupManager().DeleteGroup(group.Id);
                                CyberEnvironment.GetGame().GetRoomManager().UnloadRoom(room12);
                                return true;//1E19;
                            }
                            this.Session.SendNotif("You do not own this room!");
                            return true;
                        }
                    case "moonwalk":
                        {
                            if (!this.Session.GetHabbo().HasFuse("fuse_vip_commands") && !this.Session.GetHabbo().VIP)
                            {
                                return false;
                            }
                            Room room13 = this.Session.GetHabbo().CurrentRoom;
                            if (room13 != null)
                            {
                                RoomUser user8 = room13.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                user8.IsMoonwalking = !user8.IsMoonwalking;
                                return true;
                            }
                            return true;
                        }
                    case "habnam":
                        {
                            if (!this.Session.GetHabbo().HasFuse("fuse_vip_commands") && !this.Session.GetHabbo().VIP)
                            {
                                return false;
                            }
                            Room room14 = this.Session.GetHabbo().CurrentRoom;
                            if (room14 != null)
                            {
                                RoomUser user9 = room14.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                this.Session.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect((user9.CurrentEffect != 140) ? 140 : 0);
                                return true;
                            }
                            return true;
                        }

                    case "mimic":
                    case "copy":
                    case "copylook":
                        if (this.Session.GetHabbo().HasFuse("fuse_vip_commands") || this.Session.GetHabbo().VIP)
                        {
                            string pName = Params[1];
                            RoomUser user10 = this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(pName);
                            string query = null;
                            string look = null;
                            if (user10 != null)
                            {
                                query = user10.GetClient().GetHabbo().Gender;
                                look = user10.GetClient().GetHabbo().Look;
                                this.Session.GetHabbo().Gender = query;
                                this.Session.GetHabbo().Look = look;
                                using (IQueryAdapter adapter4 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                {
                                    adapter4.setQuery("UPDATE users SET gender = @gender, look = @look WHERE username = @username");
                                    adapter4.addParameter("gender", query);
                                    adapter4.addParameter("look", look);
                                    adapter4.addParameter("username", this.Session.GetHabbo().Username);
                                    adapter4.runQuery();
                                }
                                Room room16 = this.Session.GetHabbo().CurrentRoom;
                                if (room16 == null)
                                {
                                    return true;
                                }
                                RoomUser user11 = room16.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                if (user11 == null)
                                {
                                    return true;
                                }
                                this.Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserDataMessageComposer);
                                this.Session.GetMessageHandler().GetResponse().AppendInt32(-1);
                                this.Session.GetMessageHandler().GetResponse().AppendString(this.Session.GetHabbo().Look);
                                this.Session.GetMessageHandler().GetResponse().AppendString(this.Session.GetHabbo().Gender.ToLower());
                                this.Session.GetMessageHandler().GetResponse().AppendString(this.Session.GetHabbo().Motto);
                                this.Session.GetMessageHandler().GetResponse().AppendInt32(this.Session.GetHabbo().AchievementPoints);
                                this.Session.GetMessageHandler().SendResponse();
                                ServerMessage message3 = new ServerMessage(Outgoing.UpdateUserDataMessageComposer);
                                message3.AppendInt32(user11.VirtualId);
                                message3.AppendString(this.Session.GetHabbo().Look);
                                message3.AppendString(this.Session.GetHabbo().Gender.ToLower());
                                message3.AppendString(this.Session.GetHabbo().Motto);
                                message3.AppendInt32(this.Session.GetHabbo().AchievementPoints);
                                room16.SendMessage(message3);
                            }
                        }
                        return true;

                    case "push":
                        {
                            if (!this.Session.GetHabbo().HasFuse("fuse_vip_commands") && !this.Session.GetHabbo().VIP)
                            {
                                return true;//256A;
                            }
                            Room room17 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            if (room17 != null)
                            {
                                if (Params.Length == 1)
                                {
                                    SendChatMessage(this.Session, "Ingresa un usuario");
                                    return true;
                                }
                                RoomUser user12 = room17.GetRoomUserManager().GetRoomUserByHabbo(Convert.ToString(Params[1]));
                                if (user12 == null)
                                {
                                    SendChatMessage(this.Session, "No se pudo encontrar el user!");
                                    return true;
                                }
                                if (user12.GetUsername() == this.Session.GetHabbo().Username)
                                {
                                    SendChatMessage(this.Session, "S\x00e9 que no quieres empujarte a ti mismo");
                                    return true;
                                }
                                RoomUser user13 = room17.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                if ((user13 != null) && !user12.TeleportEnabled)
                                {
                                    if ((Math.Abs((int)(user12.X - user13.X)) < 2) && (Math.Abs((int)(user12.Y - user13.Y)) < 2))
                                    {
                                        if (user13.RotBody == 4)
                                        {
                                            user12.MoveTo(user12.X, user12.Y + 1);
                                        }
                                        if (user13.RotBody == 0)
                                        {
                                            user12.MoveTo(user12.X, user12.Y - 1);
                                        }
                                        if (user13.RotBody == 6)
                                        {
                                            user12.MoveTo(user12.X - 1, user12.Y);
                                        }
                                        if (user13.RotBody == 2)
                                        {
                                            user12.MoveTo(user12.X + 1, user12.Y);
                                        }
                                        if (user13.RotBody == 3)
                                        {
                                            user12.MoveTo(user12.X + 1, user12.Y + 1);
                                        }
                                        if (user13.RotBody == 1)
                                        {
                                            user12.MoveTo(user12.X + 1, user12.Y - 1);
                                        }
                                        if (user13.RotBody == 7)
                                        {
                                            user12.MoveTo(user12.X - 1, user12.Y - 1);
                                        }
                                        if (user13.RotBody == 5)
                                        {
                                            user12.MoveTo(user12.X - 1, user12.Y + 1);
                                        }
                                        user12.UpdateNeeded = true;
                                        user13.UpdateNeeded = true;
                                        user13.SetRot(PathFinder.CalculateRotation(user13.X, user13.Y, user12.GoalX, user12.GoalY));
                                    }
                                    else
                                    {
                                        SendChatMessage(this.Session, Params[1] + " no est\x00e1 tan cerca.");
                                    }
                                    return true;//256A;
                                }
                            }
                            return true;
                        }
                    case "pull":
                        if (this.Session.GetHabbo().HasFuse("fuse_vip_commands") || this.Session.GetHabbo().VIP)
                        {
                            Room room18 = this.Session.GetHabbo().CurrentRoom;
                            if (room18 == null)
                            {
                                return true;
                            }
                            RoomUser user14 = room18.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if (user14 == null)
                            {
                                return true;
                            }
                            if (Params.Length == 1)
                            {
                                SendChatMessage(this.Session, "Unable to find the user you specified.");
                                return true;
                            }
                            GameClient client4 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client4 == null)
                            {
                                return true;
                            }
                            if (client4.GetHabbo().Id == this.Session.GetHabbo().Id)
                            {
                                SendChatMessage(this.Session, "You can't pull yourself!");
                                return true;
                            }
                            RoomUser user15 = room18.GetRoomUserManager().GetRoomUserByHabbo(client4.GetHabbo().Id);
                            if (user15 == null)
                            {
                                return true;
                            }
                            if (user15.TeleportEnabled)
                            {
                                return true;
                            }
                            if ((Math.Abs((int)(user14.X - user15.X)) >= 3) || (Math.Abs((int)(user14.Y - user15.Y)) >= 3))
                            {
                                SendChatMessage(this.Session, "User is too far away to pull.");
                                return true;
                            }
                            if ((user14.RotBody % 2) != 0)
                            {
                                user14.RotBody--;
                            }
                            if (user14.RotBody == 0)
                            {
                                user15.MoveTo(user14.X, user14.Y - 1);
                            }
                            else if (user14.RotBody == 2)
                            {
                                user15.MoveTo(user14.X + 1, user14.Y);
                            }
                            else if (user14.RotBody == 4)
                            {
                                user15.MoveTo(user14.X, user14.Y + 1);
                            }
                            else if (user14.RotBody == 6)
                            {
                                user15.MoveTo(user14.X - 1, user14.Y);
                            }
                        }
                        return true;

                    case "enable":
                        {
                            if (!this.Session.GetHabbo().HasFuse("fuse_vip_commands") && !this.Session.GetHabbo().VIP)
                            {
                                return false;
                            }

                            if (Params.Length == 1)
                            {
                                SendChatMessage(this.Session, "Escribe un effect ID");
                                return true;
                            }
                            RoomUser user16 = this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Username);
                            if (user16.RidingHorse)
                            {
                                SendChatMessage(this.Session, "No puedes hacer eso mientras est\x00e1s montado en un caballo!");
                                return true;
                            }
                            if (user16.team == Team.none)
                            {
                                double num6;
                                if (user16.IsLyingDown)
                                {
                                    return true;
                                }
                                string s = Params[1];
                                if (double.TryParse(s, out num6))
                                {
                                    this.Session.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(int.Parse(num6.ToString()));
                                    return true;
                                }
                                SendChatMessage(this.Session, "You're pretty bad at math, '" + s + "' ain't a number, n***a.");
                            }
                            return true;
                        }
                    case "handitem":
                        {
                            if (!this.Session.GetHabbo().HasFuse("fuse_vip_commands") && !this.Session.GetHabbo().VIP)
                            {
                                return false;
                            }
                            if (Params.Length == 1)
                            {
                                SendChatMessage(this.Session, "Escribe un item ID");
                                return true;
                            }
                            RoomUser user17 = this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Username);
                            if (user17.RidingHorse)
                            {
                                SendChatMessage(this.Session, "No puedes hacer eso mientras est\x00e1s montado en un caballo!");
                                return true;
                            }
                            if (user17.team == Team.none)
                            {
                                double num7;
                                if (user17.IsLyingDown)
                                {
                                    return true;
                                }
                                string str6 = Params[1];
                                if (double.TryParse(str6, out num7))
                                {
                                    user17.CarryItem(int.Parse(num7.ToString()));
                                    return true;
                                }
                                SendChatMessage(this.Session, "\x00bfAcaso no has aprendido matem\x00e1ticas nunca? '" + str6 + "' no es un n\x00famero.");
                            }
                            return true;
                        }
                    case "empty":
                        if (this.Session.GetHabbo().GotCommand("empty"))
                        {
                            this.Session.GetHabbo().GetInventoryComponent().ClearItems();
                        }
                        return true;

                    case "emptysom":
                        if (!this.Session.GetHabbo().GotCommand("emptysom"))
                        {
                            return false;
                        }
                        if (Params.Length != 1)
                        {
                            GameClient client5 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client5 == null || client5.GetHabbo().Rank >= this.Session.GetHabbo().Rank)
                            {
                                return true;
                            }
                            client5.GetHabbo().GetInventoryComponent().ClearItems();
                            return false;
                        }
                        return true;

                    case "hit":
                        if (this.Session.GetHabbo().HasFuse("fuse_vip_commands") || this.Session.GetHabbo().VIP)
                        {
                            Room room19 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            if (room19 == null)
                            {
                                return true;
                            }
                            if (Params.Length == 1)
                            {
                                SendChatMessage(this.Session, "\x00bfUsuario?");
                                return true;
                            }
                            RoomUser user18 = room19.GetRoomUserManager().GetRoomUserByHabbo(Convert.ToString(Params[1]));
                            if (user18 == null)
                            {
                                SendChatMessage(this.Session, "El usuario no se encontr\x00f3");
                                return true;
                            }
                            if (user18.GetUsername() == this.Session.GetHabbo().Username)
                            {
                                SendChatMessage(this.Session, "\x00a1No querr\x00e1s golpearte a ti mismo!");
                                return true;
                            }
                            RoomUser user19 = room19.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if (user19 == null)
                            {
                                return true;
                            }
                            if ((Math.Abs((int)(user18.X - user19.X)) < 2) && (Math.Abs((int)(user18.Y - user19.Y)) < 2))
                            {
                                if (user19.RotBody == 4)
                                {
                                    user18.MoveTo(user18.X, user18.Y + 1);
                                }
                                if (user19.RotBody == 0)
                                {
                                    user18.MoveTo(user18.X, user18.Y - 1);
                                }
                                if (user19.RotBody == 6)
                                {
                                    user18.MoveTo(user18.X - 1, user18.Y);
                                }
                                if (user19.RotBody == 2)
                                {
                                    user18.MoveTo(user18.X + 1, user18.Y);
                                }
                                if (user19.RotBody == 3)
                                {
                                    user18.MoveTo(user18.X + 1, user18.Y);
                                    user18.MoveTo(user18.X, user18.Y + 1);
                                }
                                if (user19.RotBody == 1)
                                {
                                    user18.MoveTo(user18.X + 1, user18.Y);
                                    user18.MoveTo(user18.X, user18.Y - 1);
                                }
                                if (user19.RotBody == 7)
                                {
                                    user18.MoveTo(user18.X - 1, user18.Y);
                                    user18.MoveTo(user18.X, user18.Y - 1);
                                }
                                if (user19.RotBody == 5)
                                {
                                    user18.MoveTo(user18.X - 1, user18.Y);
                                    user18.MoveTo(user18.X, user18.Y + 1);
                                }
                                user18.UpdateNeeded = true;
                            }
                        }
                        return true;

                    case "roomalert":
                    case "alertroom":
                    case "ra":
                    case "alertarsala":
                        if (!this.Session.GetHabbo().GotCommand("alert"))
                        {
                            return false;//2D3B;
                        }
                        string Alert = MergeParams(Params, 1);

                        foreach (RoomUser user in Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers())
                        {
                            if (user.IsBot || user.GetClient() == null)
                            {
                                continue;
                            }
                            user.GetClient().SendNotif(Alert);
                        }
                        return true;

                    case "alert":
                        if (!this.Session.GetHabbo().GotCommand("alert"))
                        {
                            return false;//2D3B;
                        }
                        if ((Params[1] != null) && (Params[2] != null))
                        {
                            string username = null;
                            GameClient client6 = null;
                            username = Params[1];
                            client6 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(username);
                            Room room42 = client6.GetHabbo().CurrentRoom;
                            if (client6 == null)
                            {
                                this.Session.SendNotif("User could not be found.");
                                return true;
                            }
                            client6.SendNotif(Params[2] + " -" + this.Session.GetHabbo().Username);
                            return true;//2D3B;
                        }
                        this.Session.SendNotif("You left something empty.");
                        return true;

                    case "kick":
                        if (this.Session.GetHabbo().GotCommand("kick"))
                        {
                            string str8 = null;
                            GameClient session = null;
                            str8 = Params[1];
                            session = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str8);
                            Room room20 = session.GetHabbo().CurrentRoom;
                            if (session != null)
                            {
                                if (this.Session.GetHabbo().Rank <= session.GetHabbo().Rank)
                                {
                                    this.Session.SendNotif("You are not allowed to kick that user.");
                                    return true;
                                }
                                if (session.GetHabbo().CurrentRoomId < 1)
                                {
                                    this.Session.SendNotif("That user is not in a room and can not be kicked.");
                                    return true;
                                }
                                room20 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);
                                if (room20 != null)
                                {
                                    room20.GetRoomUserManager().RemoveUserFromRoom(session, true, false);
                                    session.CurrentRoomUserID = -1;
                                    if (Params.Length > 2)
                                    {
                                        session.SendNotif("A moderator has kicked you from the room for the following reason: " + MergeParams(Params, 2));
                                    }
                                    else
                                    {
                                        session.SendNotif("A moderator has kicked you from the room.");
                                    }
                                }
                                return true;
                            }
                            this.Session.SendNotif("User could not be found.");
                        }
                        return true;

                    case "roommute":
                        if (this.Session.GetHabbo().GotCommand("roommute") || this.Session.GetHabbo().GotCommand("roomunmute"))
                        {
                            Room room21 = this.Session.GetHabbo().CurrentRoom;
                            if (!this.Session.GetHabbo().CurrentRoom.RoomMuted)
                            {
                                this.Session.GetHabbo().CurrentRoom.RoomMuted = true;
                            }
                            string str9 = MergeParams(Params, 1);
                            ServerMessage message4 = new ServerMessage();
                            message4.Init(Outgoing.AlertNotificationMessageComposer);
                            message4.AppendString("La sala fue muteada debido a:\n" + str9);
                            message4.AppendString("");
                            room21.SendMessage(message4);
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "Room Mute", "Room muted");
                        }
                        return true;

                    case "roomunmute":
                        if (this.Session.GetHabbo().GotCommand("roomunmute"))
                        {
                            Room room22 = this.Session.GetHabbo().CurrentRoom;
                            if (this.Session.GetHabbo().CurrentRoom.RoomMuted)
                            {
                                this.Session.GetHabbo().CurrentRoom.RoomMuted = false;
                            }
                            ServerMessage message5 = new ServerMessage();
                            message5.Init(Outgoing.AlertNotificationMessageComposer);
                            message5.AppendString("Fuiste desmuteado");
                            message5.AppendString("");
                            room22.SendMessage(message5);
                        }
                        return true;

                    case "mute":
                        {
                            if (!this.Session.GetHabbo().GotCommand("mute"))
                            {
                                return true;//308F;
                            }
                            string str10 = null;
                            GameClient client8 = null;
                            Room room43 = this.Session.GetHabbo().CurrentRoom;
                            str10 = Params[1];
                            client8 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str10);
                            if ((client8 != null) && (client8.GetHabbo() != null))
                            {
                                if (client8.GetHabbo().Rank >= 4)
                                {
                                    this.Session.SendNotif("You are not allowed to (un)mute that user.");
                                    return true;
                                }
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client8.GetHabbo().Username, "Mute", "Muted user");
                                client8.GetHabbo().Mute();
                                return true;//308F;
                            }
                            this.Session.SendNotif("User could not be found.");
                            return true;
                        }
                    case "flood":
                        {
                            if (!this.Session.GetHabbo().GotCommand("flood"))
                            {
                                return true;//311C;
                            }
                            string str11 = null;
                            GameClient client9 = null;
                            str11 = Params[1];
                            client9 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str11);
                            if (Params.Length == 3)
                            {
                                client9.GetHabbo().FloodTime = CyberEnvironment.GetUnixTimestamp() + Convert.ToInt32(Params[2]);
                                ServerMessage message6 = new ServerMessage(Outgoing.FloodFilterMessageComposer);
                                message6.AppendInt32(Convert.ToInt32(Params[2]));
                                client9.SendMessage(message6);
                                return true;//311C;
                            }
                            this.Session.SendNotif("You must include a username and a time for the person you want to flood.");
                            return true;
                        }
                    case "unmute":
                        {
                            if (!this.Session.GetHabbo().GotCommand("unmute"))
                            {
                                return true;//31D7;
                            }
                            string str12 = null;
                            GameClient client10 = null;
                            Room room44 = this.Session.GetHabbo().CurrentRoom;
                            str12 = Params[1];
                            client10 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str12);
                            if ((client10 != null) && (client10.GetHabbo() != null))
                            {
                                if (!client10.GetHabbo().Muted)
                                {
                                    return true;
                                }
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client10.GetHabbo().Username, "Mute", "Un Muted user");
                                client10.GetHabbo().Unmute();
                                return true;//31D7;
                            }
                            this.Session.SendNotif("User could not be found.");
                            return true;
                        }
                    case "summon":
                    case "traer":
                    case "come":
                        if (this.Session.GetHabbo().GotCommand("summon"))
                        {
                            if (Params.Length >= 1)
                            {
                                string str13 = Params[1];
                                if (str13.ToLower() == Session.GetHabbo().Username.ToLower())
                                {
                                    Session.SendNotif("You can't summon yourself!");
                                    return true;
                                }

                                GameClient client11 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(str13);
                                if (client11 == null)
                                {
                                    this.Session.SendNotif("Could not find user \"" + str13 + "\"");
                                    return true;
                                }

                                if (Session.GetHabbo().CurrentRoom != null && Session.GetHabbo().CurrentRoomId != client11.GetHabbo().CurrentRoomId)
                                {
                                    client11.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoom.RoomId, Session.GetHabbo().CurrentRoom.Password);
                                }
                                return true;
                            }
                            this.Session.SendNotif("No use specified");
                        }
                        return true;

                    case "summonall":
                        if (this.Session.GetHabbo().GotCommand("summonall"))
                        {
                            string str14 = Input.Substring(9);
                            foreach (GameClient client12 in CyberEnvironment.GetGame().GetClientManager().clients.Values)
                            {
                                client12.SendNotif("* Todos hab\x00e9is sido atra\x00eddos por " + this.Session.GetHabbo().Username + ":\r\n" + str14);
                                CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(this.Session.GetHabbo().CurrentRoomId).SerializeRoomData(new ServerMessage(), client12.GetHabbo().CurrentRoom == null, client12, false);

                                ServerMessage roomFwd = new ServerMessage(Outgoing.RoomForwardMessageComposer);
                                roomFwd.AppendUInt(this.Session.GetHabbo().CurrentRoomId);
                                client12.SendMessage(roomFwd);
                            }
                        }
                        return true;

                    case "follow":
                    case "seguir":
                    case "stalk":
                        if (this.Session.GetHabbo().GotCommand("follow"))
                        {
                            GameClient client13 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if ((client13 != null) && (client13.GetHabbo() != null))
                            {
                                if (((client13 != null) && (client13.GetHabbo().CurrentRoom != null)) && (client13.GetHabbo().CurrentRoom != this.Session.GetHabbo().CurrentRoom))
                                {
                                    ServerMessage roomFwd = new ServerMessage(Outgoing.RoomForwardMessageComposer);
                                    roomFwd.AppendUInt(client13.GetHabbo().CurrentRoom.RoomId);
                                    Session.SendMessage(roomFwd);
                                }
                                return true;
                            }
                            this.Session.SendNotif("This user could not be found");
                        }
                        return true;

                    case "roomkick":
                        if (this.Session.GetHabbo().GotCommand("roomkick"))
                        {
                            Room room23 = this.Session.GetHabbo().CurrentRoom;
                            room23 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            if (room23 != null)
                            {
                                string allert = MergeParams(Params, 1);
                                RoomKick kick = new RoomKick(allert, (int)this.Session.GetHabbo().Rank);
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "Room kick", "Kicked the whole room");
                                room23.QueueRoomKick(kick);
                                return true;
                            }
                        }
                        return true;

                    case "banear":
                    case "ban":
                        if (this.Session.GetHabbo().GotCommand("ban"))
                        {
                            GameClient user = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

                            if (user != null)
                            {
                                if (user.GetHabbo().Rank >= this.Session.GetHabbo().Rank)
                                {
                                    this.Session.SendNotif("You are not allowed to ban that user.");
                                    return true;
                                }
                                int Length = int.Parse(Params[2]);
                                string Message = MergeParams(Params, 3);
                                if (string.IsNullOrWhiteSpace(Message))
                                {
                                    Message = "El moderador no ha visto necesario darte un motivo de baneo";
                                }
                                Cyber.HabboHotel.Support.ModerationTool.BanUser(Session, user.GetHabbo().Id, Length, Message);
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, user.GetHabbo().Username, "Ban", "User have been banned [" + Params[2] + "]");
                            }
                            this.Session.SendNotif("User could not be found.");
                            return true;
                        }
                        return true;

                    case "desbanear":
                    case "unban":
                        if (this.Session.GetHabbo().GotCommand("unban"))
                        {
                            //GameClient user = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(@params[1]);
                            Habbo user = CyberEnvironment.getHabboForName(Params[1]);

                            if (user != null)
                            {
                                if (user.Rank >= this.Session.GetHabbo().Rank)
                                {
                                    this.Session.SendNotif("You are not allowed to unban that user.");
                                    return true;
                                }
                                using (IQueryAdapter adapter = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                {
                                    adapter.setQuery("DELETE FROM bans WHERE value = '" + user.Username + "'");
                                    adapter.runQuery();
                                    CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, user.Username, "Unban", "Se ha desbaneado al usuario [" + Params[2] + "]");
                                }
                            }
                            this.Session.SendNotif("User could not be found.");
                            return true;
                        }
                        return true;

                    case "superban":
                        {
                            if (!this.Session.GetHabbo().GotCommand("superban"))
                            {
                                return true;//35DC;
                            }
                            GameClient client14 = null;
                            Room room45 = this.Session.GetHabbo().CurrentRoom;
                            client14 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client14 != null)
                            {
                                if (client14.GetHabbo().Rank >= this.Session.GetHabbo().Rank)
                                {
                                    this.Session.SendNotif("You are not allowed to ban that user.");
                                    return true;
                                }
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client14.GetHabbo().Username, "Ban", "Long ban forever");
                                CyberEnvironment.GetGame().GetBanManager().BanUser(client14, this.Session.GetHabbo().Username, 788922000.0, MergeParams(Params, 2), false, false);
                                return true;//35DC;
                            }
                            this.Session.SendNotif("User could not be found.");
                            return true;
                        }
                    case "togglewhisper":
                        this.Session.GetHabbo().GotCommand("togglewhisper");
                        return true;

                    case "fastwalk":
                    case "run":
                        if (this.Session.GetHabbo().HasFuse("fuse_vip_commands") || this.Session.GetHabbo().VIP)
                        {
                            RoomUser user20 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId).GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if (!user20.FastWalking)
                            {
                                user20.FastWalking = true;
                            }
                            else
                            {
                                user20.FastWalking = false;
                            }
                        }
                        return true;

                    case "promoteroom":
                        if (!this.Session.GetHabbo().GotCommand("promoteroom"))
                        {
                            return true;//37B3;
                        }
                        if (Params[1] != null)
                        {
                            int num9;
                            if (!int.TryParse(Params[1], out num9))
                            {
                                this.Session.SendNotif("You need use command like :promoteroom time (time being how long to run event for in seconds).");
                                return true;
                            }
                            Room room25 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            CyberEnvironment.GetGame().GetRoomEvents().AddNewEvent(room25.RoomId, "Default Name", "Default Desc", this.Session, 0x1c20);
                            return true;//37B3;
                        }
                        this.Session.SendNotif("You need to enter event name and description.");
                        return true;

                    case "massdance":
                        if (this.Session.GetHabbo().GotCommand("massdance"))
                        {
                            Room room26 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            RoomUser user21 = room26.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            HashSet<RoomUser> roomUsers = room26.GetRoomUserManager().GetRoomUsers();
                            int i = Convert.ToInt32(Params[1]);
                            if (i <= 4)
                            {
                                if ((i > 0) && (user21.CarryItemID > 0))
                                {
                                    user21.CarryItem(0);
                                }
                                user21.DanceId = i;
                                foreach (RoomUser user22 in roomUsers)
                                {
                                    ServerMessage message7 = new ServerMessage(Outgoing.DanceStatusMessageComposer);
                                    message7.AppendInt32(user22.VirtualId);
                                    message7.AppendInt32(i);
                                    room26.SendMessage(message7);
                                    user22.DanceId = i;
                                }
                                return true;
                            }
                            this.Session.SendNotif("That is an invalid dance ID");
                        }
                        return true;

                    case "goboom":
                        if (this.Session.GetHabbo().GotCommand("goboom"))
                        {
                            Room room27 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            room27.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            foreach (RoomUser user23 in room27.GetRoomUserManager().GetRoomUsers())
                            {
                                user23.ApplyEffect(0x6c);
                            }
                        }
                        return true;

                    case "massenable":
                        if (this.Session.GetHabbo().GotCommand("massenable"))
                        {
                            Room room28 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            room28.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            foreach (RoomUser user24 in room28.GetRoomUserManager().GetRoomUsers())
                            {
                                if (!user24.RidingHorse)
                                {
                                    user24.ApplyEffect(Convert.ToInt32(Params[1]));
                                }
                            }
                        }
                        return true;

                    case "givecredits":
                    case "credits":
                    case "coins":
                        if (this.Session.GetHabbo().GotCommand("credits"))
                        {
                            int num11;
                            GameClient client16 = null;
                            Room room47 = this.Session.GetHabbo().CurrentRoom;
                            client16 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client16 == null)
                            {
                                this.Session.SendNotif("User could not be found.");
                                return true;
                            }
                            if (!int.TryParse(Params[2], out num11))
                            {
                                this.Session.SendNotif("Invalid numbers no, please!");
                                return true;
                            }
                            client16.GetHabbo().Credits += num11;
                            client16.GetHabbo().UpdateCreditsBalance();
                            client16.SendNotif(this.Session.GetHabbo().Username + " gave you " + num11.ToString() + " credits :3");
                            this.Session.SendNotif("You succesfully updated the user's purse!");
                        }
                        return true;

                    case "pixels":
                    case "givepixels":
                    case "duckets":
                        if (this.Session.GetHabbo().GotCommand("duckets"))
                        {
                            int num12;
                            GameClient client17 = null;
                            Room room48 = this.Session.GetHabbo().CurrentRoom;
                            client17 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client17 == null)
                            {
                                this.Session.SendNotif("User could not be found.");
                                return true;
                            }
                            if (!int.TryParse(Params[2], out num12))
                            {
                                this.Session.SendNotif("Invalid numbers no, please!");
                                return true;
                            }
                            client17.GetHabbo().ActivityPoints += num12;
                            this.Session.GetHabbo().NotifyNewPixels(num12);
                            client17.GetHabbo().UpdateActivityPointsBalance();
                            client17.SendNotif(this.Session.GetHabbo().Username + " gave you " + num12.ToString() + " Duckets!");
                            this.Session.SendNotif("You succesfully updated the User's Duckets balance!");
                        }
                        return true;

                    case "belcredits":
                    case "diamonds":
                    case "diamantes":
                    case "givediamonds":
                    case "loyalty":
                        if (this.Session.GetHabbo().GotCommand("diamonds"))
                        {
                            int num13;
                            GameClient client18 = null;
                            Room room49 = this.Session.GetHabbo().CurrentRoom;
                            client18 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client18 == null)
                            {
                                this.Session.SendNotif("User could not be found.");
                                return true;
                            }
                            if (!int.TryParse(Params[2], out num13))
                            {
                                this.Session.SendNotif("OMG Numbers only, please!");
                                return true;
                            }
                            client18.GetHabbo().BelCredits += num13;
                            client18.GetHabbo().UpdateSeasonalCurrencyBalance();
                            client18.SendNotif(this.Session.GetHabbo().Username + " gave you " + num13.ToString() + " Diamonds!");
                            this.Session.SendNotif("You gave him/her diamonds!");
                        }
                        return true;

                    case "oldha":
                    case "ha":
                        if (this.Session.GetHabbo().GotCommand("ha"))
                        {
                            string str16 = MergeParams(Params, 1);
                            ServerMessage message8 = new ServerMessage(Outgoing.BroadcastNotifMessageComposer);
                            message8.AppendString(str16 + "\r\n- " + this.Session.GetHabbo().Username);
                            CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(message8);
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "HotelAlert", "Hotel alert [" + str16 + "]");
                        }
                        return true;

                    case "apagar":
                    case "shutdown":
                        if (this.Session.GetHabbo().GotCommand("shutdown"))
                        {
                            new Task(new Action(CyberEnvironment.PerformShutDown)).Start();
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "Shutdown", "Issued shutdown command");
                        }
                        return true;

                    case "disconnect":
                    case "dc":
                        {
                            if (!this.Session.GetHabbo().GotCommand("dc"))
                            {
                                return true;//3FFD;
                            }
                            GameClient client20 = null;
                            Room room51 = this.Session.GetHabbo().CurrentRoom;
                            client20 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client20 != null)
                            {
                                if ((client20.GetHabbo().Rank >= this.Session.GetHabbo().Rank))
                                {
                                    this.Session.SendNotif("You are not allowed to disconnect that user.");
                                    return true;
                                }
                                CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client20.GetHabbo().Username, "Disconnect", "User disconnected by user");
                                client20.GetConnection().Dispose();
                                return true;//3FFD;
                            }
                            this.Session.SendNotif("User not found.");
                            return true;
                        }
                    case "superha":
                    case "supernotif":
                        {
                            if (!this.Session.GetHabbo().GotCommand("superha"))
                            {
                                return false;
                            }
                            string notice = "";
                            string picture = "alert";
                            notice = MergeParams(Params, 1);
                            CyberEnvironment.GetGame().GetClientManager().SendSuperNotif("Notificaci\x00f3n", notice, picture, this.Session, "", "", true, false);
                            return true;
                        }

                    // TODO Review this here.
                    //case "update_furnisprites":
                    //    {
                    //        if (this.Session.GetHabbo().GotCommand("ri"))
                    //        {
                    //            CyberEnvironment.GetGame().GetItemManager().UpdateFlats();
                    //        }
                    //        return true;
                    //    }

                    //case "testgccollect":
                    //    {
                    //        if (this.Session.GetHabbo().GotCommand("ri"))
                    //        {
                    //            GC.Collect();
                    //        }
                    //        return true;
                    //    }

                    case "anonha":
                        {
                            if (this.Session.GetHabbo().GotCommand("anonha"))
                            {
                                string str16 = MergeParams(Params, 1);
                                ServerMessage message8 = new ServerMessage(Outgoing.BroadcastNotifMessageComposer);
                                message8.AppendString(str16);
                                CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(message8);

                            }
                            return true;
                        }
                    case "eventha":
                        {
                            if (!this.Session.GetHabbo().GotCommand("eventha"))
                            {
                                return false;
                            }
                            string str19 = MergeParams(Params, 1);
                            CyberEnvironment.GetGame().GetClientManager().SendSuperNotif("\x00a1Evento!", str19, "game_promo_small", this.Session, "event:navigator/goto/" + this.Session.GetHabbo().CurrentRoom.RoomId, "Ir para o quarto", true, true);
                            return true;
                        }
                    case "dcroom":
                        if (!this.Session.GetHabbo().GotCommand("dcroom"))
                        {
                            return false;
                        }
                        foreach (RoomUser user25 in this.Session.GetHabbo().CurrentRoom.GetRoomUserManager().UserList.Values)
                        {
                            if (((user25 != null) && (user25.GetClient() != null)) && ((this.Session.GetHabbo().Id != user25.GetClient().GetHabbo().Id) && (user25.GetClient().GetHabbo().Rank < this.Session.GetHabbo().Rank)))
                            {
                                user25.GetClient().GetConnection().Dispose();
                            }
                        }
                        return true;

                    case "dchotel":
                        if (!this.Session.GetHabbo().GotCommand("dchotel"))
                        {
                            return false;
                        }
                        foreach (GameClient client in CyberEnvironment.GetGame().GetClientManager().clients.Values)
                        {
                            if (client != null && client != Session)
                            {
                                client.GetConnection().Dispose();
                            }
                        }
                        return true;

                    case "reloadall":
                        if (this.Session.GetHabbo().GotCommand("reloadall"))
                        {
                            foreach (Room room30 in CyberEnvironment.GetGame().GetRoomManager().loadedRooms.Values)
                            {
                                if ((room30 != null) && room30.CheckRights(this.Session, true, false))
                                {
                                    CyberEnvironment.GetGame().GetRoomManager().UnloadRoom(room30);
                                    //     room30.RequestReload();
                                }
                            }
                        }
                        return false;

                    case "coord":
                    case "coords":
                    case "position":
                        {
                            if (!this.Session.GetHabbo().GotCommand("coords"))
                            {
                                return true;//436A;
                            }
                            Room room31 = this.Session.GetHabbo().CurrentRoom;
                            RoomUser user26 = null;
                            room31 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            if (room31 != null)
                            {
                                user26 = room31.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                if (user26 == null)
                                {
                                    return true;
                                }
                                this.Session.SendNotif(string.Concat(new object[] { "X: ", user26.X, "\n - Y: ", user26.Y, "\n - Z: ", user26.Z, "\n - Rot: ", user26.RotBody, ", sqState: ", room31.GetGameMap().GameMap[user26.X, user26.Y].ToString(), "\n\n - RoomID: ", this.Session.GetHabbo().CurrentRoomId }));
                                return true;//436A;
                            }
                            return true;
                        }
                    case "teleport":
                    case "tele":
                        {
                            if (!this.Session.GetHabbo().GotCommand("tele"))
                            {
                                return true;//4419;
                            }
                            Room room32 = this.Session.GetHabbo().CurrentRoom;
                            RoomUser user27 = null;
                            room32 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                            user27 = room32.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if (!user27.RidingHorse)
                            {
                                if (user27 == null)
                                {
                                    return true;
                                }
                                user27.TeleportEnabled = !user27.TeleportEnabled;
                                room32.GetGameMap().GenerateMaps(true);
                                return true;//4419;
                            }
                            SendChatMessage(this.Session, "You cannot teleport whilst riding a horse!");
                            return true;
                        }

                    case "update_youtube":
                    case "refresh_youtube":
                        if (!this.Session.GetHabbo().GotCommand("refresh_youtube"))
                        {
                            return false;
                        }
                        this.Session.SendWhisper("Please wait, updating YouTube playlists...");
                        using (IQueryAdapter adapter5 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            CyberEnvironment.GetGame().GetVideoManager().Load(adapter5);
                        }
                        this.Session.SendWhisper("Done! YouTube playlists were reloaded.");
                        return true;

                    case "reload_polls":
                    case "refresh_polls":
                    case "update_polls":
                        if (!this.Session.GetHabbo().GotCommand("refresh_polls"))
                        {
                            return false;
                        }
                        using (IQueryAdapter adapter5 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            CyberEnvironment.GetGame().GetPollManager().Init(adapter5);
                        }
                        return true;

                    case "update_breeds":
                    case "refresh_petbreeds":
                        if (!this.Session.GetHabbo().GotCommand("refresh_petbreeds"))
                        {
                            return false;
                        }
                        using (IQueryAdapter adapter6 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            PetRace.Init(adapter6);
                        }
                        return true;

                    case "update_publi":
                    case "refresh_bannedhotels":
                        if (!this.Session.GetHabbo().GotCommand("refresh_bannedhotels"))
                        {
                            return false;
                        }
                        using (IQueryAdapter adapter7 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            AntiPublicistas.Load(adapter7);
                        }
                        return true;

                    case "update_songs":
                    case "refresh_songs":
                        if (!this.Session.GetHabbo().GotCommand("refresh_songs"))
                        {
                            return false;
                        }
                        Cyber.HabboHotel.SoundMachine.SongManager.Initialize();

                        return true;

                    case "update_achievements":
                    case "refresh_achievements":
                        if (!this.Session.GetHabbo().GotCommand("refresh_achievements"))
                        {
                            return false;
                        }
                        CyberEnvironment.GetGame().GetAchievementManager().LoadAchievements(CyberEnvironment.GetDatabaseManager().getQueryReactor());

                        return true;



                    case "update_catalog":
                    case "reload_catalog":
                    case "recache_catalog":
                    case "refresh_catalog":
                    case "update_catalogue":
                    case "reload_catalogue":
                    case "recache_catalogue":
                    case "refresh_catalogue":
                    case "refreshcata":
                        if (this.Session.GetHabbo().GotCommand("refresh_catalogue"))
                        {
                            using (IQueryAdapter adapter8 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.GetGame().GetCatalog().Initialize(adapter8);
                            }
                            CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(Outgoing.PublishShopMessageComposer));
                        }
                        return true;

                    case "refresh_promos":
                        if (this.Session.GetHabbo().GotCommand("refresh_promos"))
                        {
                            CyberEnvironment.GetGame().GetHotelView().RefreshPromoList();
                        }
                        return true;

                    case "update_items":
                    case "reload_items":
                    case "recache_items":
                    case "refresh_items":
                        if (this.Session.GetHabbo().GotCommand("refresh_items"))
                        {
                            using (IQueryAdapter adapter9 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.GetGame().GetItemManager().LoadItems(adapter9);
                            }
                        }
                        return true;

                    case "update_navigator":
                    case "reload_navigator":
                    case "recache_navigator":
                    case "refresh_navigator":
                        if (this.Session.GetHabbo().GotCommand("refresh_navigator"))
                        {
                            using (IQueryAdapter adapter11 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.GetGame().GetNavigator().Initialize(adapter11);
                            }
                            this.Session.SendNotif("The navigator has been updated!");
                        }
                        return true;

                    case "update_ranks":
                    case "reload_ranks":
                    case "recache_ranks":
                    case "refresh_ranks":
                        if (this.Session.GetHabbo().GotCommand("refresh_ranks"))
                        {
                            using (IQueryAdapter adapter12 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.GetGame().GetRoleManager().LoadRights(adapter12);
                            }
                            this.Session.SendNotif("Ranks have been refreshed!");
                        }
                        return true;

                    case "update_settings":
                    case "reload_settings":
                    case "recache_settings":
                    case "refresh_settings":
                        if (this.Session.GetHabbo().GotCommand("refresh_settings"))
                        {
                            using (IQueryAdapter adapter13 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.ConfigData = new ConfigData(adapter13);
                            }
                        }
                        return true;

                    case "update_groups":
                    case "reload_groups":
                    case "recache_groups":
                    case "refresh_groups":
                        if (this.Session.GetHabbo().GotCommand("refresh_groups"))
                        {
                            CyberEnvironment.GetGame().GetGroupManager().InitGroups();
                            this.Session.SendNotif("Groups have been successfully reloaded");
                        }
                        return true;

                    case "update_bans":
                    case "refresh_bans":
                        if (this.Session.GetHabbo().GotCommand("refresh_bans"))
                        {
                            using (IQueryAdapter adapter14 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                CyberEnvironment.GetGame().GetBanManager().LoadBans(adapter14);
                            }
                            this.Session.SendNotif("Bans have been refreshed!");
                        }
                        return true;

                    case "update_quests":
                    case "refresh_quests":
                        if (this.Session.GetHabbo().GotCommand("refresh_quests"))
                        {
                            CyberEnvironment.GetGame().GetQuestManager().Initialize(CyberEnvironment.GetDatabaseManager().getQueryReactor());
                            this.Session.SendNotif("Quests have been successfully reloaed!");
                        }
                        return true;

                    case "spull":
                        if (this.Session.GetHabbo().HasFuse("fuse_vip_commands") || this.Session.GetHabbo().VIP)
                        {
                            Room room33 = this.Session.GetHabbo().CurrentRoom;
                            if (room33 == null)
                            {
                                return true;
                            }
                            RoomUser user28 = room33.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                            if (user28 == null)
                            {
                                return true;
                            }
                            if (Params.Length == 1)
                            {
                                return true;
                            }
                            GameClient client21 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                            if (client21 == null)
                            {
                                return true;
                            }

                            RoomUser user29 = room33.GetRoomUserManager().GetRoomUserByHabbo(client21.GetHabbo().Id);
                            if (client21.GetHabbo().Id == this.Session.GetHabbo().Id)
                            {
                                SendChatMessage(this.Session, "\x00a1No puedes empujarte a ti mismo!");
                                return true;
                            }
                            if (user29.TeleportEnabled)
                            {
                                return true;
                            }
                            if ((user28.RotBody % 2) != 0)
                            {
                                user28.RotBody--;
                            }
                            if (user28.RotBody == 0)
                            {
                                user29.MoveTo(user28.X, user28.Y - 1);
                            }
                            else if (user28.RotBody == 2)
                            {
                                user29.MoveTo(user28.X + 1, user28.Y);
                            }
                            else if (user28.RotBody == 4)
                            {
                                user29.MoveTo(user28.X, user28.Y + 1);
                            }
                            else if (user28.RotBody == 6)
                            {
                                user29.MoveTo(user28.X - 1, user28.Y);
                            }
                        }
                        return true;

                    case "globalcredits":
                        if (!this.Session.GetHabbo().GotCommand("globalcredits"))
                        {
                            return true;//4A0D;
                        }
                        if (Params.Length != 1)
                        {
                            try
                            {
                                int amount = int.Parse(Params[1]);
                                using (IQueryAdapter adapter15 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                {
                                    adapter15.runFastQuery("UPDATE users SET credits=credits+" + amount);
                                }

                                foreach (GameClient Client in CyberEnvironment.GetGame().GetClientManager().clients.Values)
                                {
                                    if (Client.GetHabbo() != null)
                                    {
                                        Client.GetHabbo().Credits += amount;
                                        Client.GetHabbo().UpdateCreditsBalance();
                                    }
                                }
                            }
                            catch
                            {
                            }
                            return true;//4A0D;
                        }
                        this.Session.SendNotif("You need to enter an amount!");
                        return true;

                    case "masscredits":
                        if (!this.Session.GetHabbo().GotCommand("masscredits"))
                        {
                            return true;//4A9D;
                        }
                        if (Params.Length != 1)
                        {
                            try
                            {
                                int num16 = int.Parse(Params[1]);
                                foreach (GameClient Client in CyberEnvironment.GetGame().GetClientManager().clients.Values)
                                {
                                    if (Client.GetHabbo() != null)
                                    {
                                        Client.GetHabbo().Credits += num16;
                                        Client.GetHabbo().UpdateCreditsBalance();
                                    }
                                }
                            }
                            catch
                            {
                            }
                            return true;//4A9D;
                        }
                        this.Session.SendNotif("You need to enter an amount!");
                        return true;

                    case "massbelcredits":
                    case "massdiamonds":
                        if (!this.Session.GetHabbo().GotCommand("masscredits"))
                        {
                            return true;//4B40;
                        }
                        if (Params.Length != 1)
                        {
                            try
                            {
                                int num17 = int.Parse(Params[1]);
                                foreach (GameClient client22 in CyberEnvironment.GetGame().GetClientManager().clients.Values)
                                {
                                    Habbo habbo4 = client22.GetHabbo();
                                    habbo4.BelCredits += num17;
                                    client22.GetHabbo().UpdateSeasonalCurrencyBalance();
                                }
                            }
                            catch
                            {
                            }
                            return true;//4B40;
                        }
                        this.Session.SendNotif("Ingresa monto.");
                        return true;

                    case "placa":
                    case "darplaca":
                    case "badge":
                    case "givebadge":
                        if (this.Session.GetHabbo().GotCommand("givebadge"))
                        {
                            if (Params.Length == 3)
                            {
                                GameClient client23 = null;
                                Room room52 = this.Session.GetHabbo().CurrentRoom;
                                client23 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                                if (client23 != null)
                                {
                                    client23.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, client23, false);
                                    CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client23.GetHabbo().Username, "Badge", "Badge given to user [" + Params[2] + "]");
                                    return true;
                                }
                                this.Session.SendNotif("User no se encontr\x00f3.");
                                return true;
                            }
                            this.Session.SendNotif("\x00a1Incluye c\x00f3digo de placa y User!");
                        }
                        return true;

                    case "quitarplaca":
                    case "takebadge":
                        if (this.Session.GetHabbo().GotCommand("takebadge"))
                        {
                            if (Params.Length == 3)
                            {
                                GameClient client23 = null;
                                Room room52 = this.Session.GetHabbo().CurrentRoom;
                                client23 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
                                if (client23 != null)
                                {
                                    if (client23.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                                    {
                                        client23.GetHabbo().GetBadgeComponent().RemoveBadge(Params[2], client23);
                                        CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, client23.GetHabbo().Username, "Badge Taken", "Badge taken from user [" + Params[2] + "]");
                                        return true;
                                    }
                                    else
                                    {
                                        this.Session.SendNotif("El User no tiene esa placa.");
                                        return true;
                                    }
                                }
                                this.Session.SendNotif("User no se encontr\x00f3.");
                                return true;
                            }
                            this.Session.SendNotif("\x00a1Incluye c\x00f3digo de placa y User!");
                        }
                        return true;

                    case "roombadge":
                        if (!this.Session.GetHabbo().GotCommand("roombadge"))
                        {
                            return true;//4CDC;
                        }
                        if (Params.Length != 1)
                        {
                            Room room34 = this.Session.GetHabbo().CurrentRoom;
                            if (this.Session.GetHabbo().CurrentRoom == null)
                            {
                                return true;
                            }

                            foreach (RoomUser current in room34.GetRoomUserManager().UserList.Values)
                            {
                                try
                                {
                                    if (!current.IsBot && current.GetClient() != null && current.GetClient().GetHabbo() != null)
                                    {
                                        current.GetClient().GetHabbo().GetBadgeComponent().GiveBadge(Params[1], true, current.GetClient(), false);
                                    }
                                }
                                catch
                                {
                                }
                            }

                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "Badge", string.Concat(new object[] { "Roombadge in room [", room34.RoomId, "] with badge [", Params[1], "]" }));
                            return true;//4CDC;
                        }

                        this.Session.SendNotif("You must enter a badge code!");
                        return true;

                    case "massbadge":
                        if (!this.Session.GetHabbo().GotCommand("massbadge"))
                        {
                            return true;//4D71;
                        }
                        if (Params.Length != 1)
                        {
                            Room room53 = this.Session.GetHabbo().CurrentRoom;
                            CyberEnvironment.GetGame().GetClientManager().QueueBadgeUpdate(Params[1]);
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "Badge", "Mass badge with badge [" + Params[1] + "]");
                            new ServerMessage();
                            return true;//4D71;
                        }
                        this.Session.SendNotif("You must enter a badge code!");
                        return true;

                    case "alleyesonme":
                        {
                            if (!this.Session.GetHabbo().GotCommand("alleyesonme"))
                            {
                                return false;//4E6D;
                            }
                            Room room54 = this.Session.GetHabbo().CurrentRoom;
                            if (this.Session.GetHabbo().CurrentRoom != null)
                            {
                                Room room35 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                                RoomUser user30 = room35.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                foreach (RoomUser user31 in room35.GetRoomUserManager().GetRoomUsers())
                                {
                                    if (this.Session.GetHabbo().Id != user31.UserID)
                                    {
                                        user31.SetRot(PathFinder.CalculateRotation(user31.X, user31.Y, user30.X, user30.Y));
                                    }
                                }
                                return true;//4E6D;
                            }
                            return true;
                        }
                    case "ipban":
                    case "banip":
                        if (this.Session.GetHabbo().GotCommand("ipban"))
                        {
                            if (Params.Length == 1)
                            {
                                this.Session.SendNotif("You must include a username and reason!");
                            }
                            GameClient client24 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString());
                            if (client24 == null)
                            {
                                this.Session.SendNotif("An unknown error occured whilst finding this user!");
                                return true;
                            }
                            try
                            {
                                CyberEnvironment.GetGame().GetBanManager().BanUser(client24, this.Session.GetHabbo().Username, 788922000.0, MergeParams(Params, 2), true, false);
                            }
                            catch (Exception exception2)
                            {
                                Console.WriteLine(exception2);
                            }
                        }
                        return true;

                    case "machineban":
                    case "banmachine":
                    case "mban":
                        if (this.Session.GetHabbo().GotCommand("machineban"))
                        {
                            if (Params.Length == 1)
                            {
                                this.Session.SendNotif("You must include a username and reason!");
                            }
                            GameClient client25 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString());
                            if (client25 == null)
                            {
                                this.Session.SendNotif("An unknown error occured whilst finding this user!");
                                return true;
                            }
                            if (string.IsNullOrWhiteSpace(client25.MachineId))
                            {
                                this.Session.SendNotif("Unable to ban this user, they don't have a machine ID");
                                return true;
                            }
                            try
                            {
                                CyberEnvironment.GetGame().GetBanManager().BanUser(client25, this.Session.GetHabbo().Username, 2678400.0, "You have been banned! The reason given was:\n" + MergeParams(Params, 2), false, true);
                            }
                            catch (Exception exception3)
                            {
                                Console.WriteLine(exception3);
                            }
                        }
                        return true;

                    case "mip":
                        if (this.Session.GetHabbo().GotCommand("mip"))
                        {
                            if (Params.Length == 1)
                            {
                                this.Session.SendNotif("You must include a username and reason!");
                            }
                            GameClient client26 = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1].ToString());
                            if (client26 == null)
                            {
                                this.Session.SendNotif("An unknown error occured whilst finding this user!");
                                return true;
                            }
                            try
                            {
                                if (string.IsNullOrWhiteSpace(client26.MachineId))
                                {
                                    this.Session.SendNotif("Unable to ban this user, they don't have a machine ID");
                                    return true;
                                }
                                CyberEnvironment.GetGame().GetBanManager().BanUser(client26, this.Session.GetHabbo().Username, 2678400.0, "You have been banned! The reason given was:\n" + MergeParams(Params, 2), false, true);
                                CyberEnvironment.GetGame().GetBanManager().BanUser(client26, this.Session.GetHabbo().Username, 788922000.0, MergeParams(Params, 2), true, false);
                            }
                            catch (Exception exception4)
                            {
                                Console.WriteLine(exception4);
                            }
                        }
                        return true;

                    case "allaroundme":
                        {
                            if (!this.Session.GetHabbo().GotCommand("allaroundme"))
                            {
                                return true;//5258;
                            }
                            Room room55 = this.Session.GetHabbo().CurrentRoom;
                            if (this.Session.GetHabbo().CurrentRoom != null)
                            {
                                Room room36 = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
                                RoomUser user32 = room36.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id);
                                HashSet<RoomUser> list6 = room36.GetRoomUserManager().GetRoomUsers();
                                foreach (RoomUser user33 in list6)
                                {
                                    if (this.Session.GetHabbo().Id != user33.UserID)
                                    {
                                        user33.MoveTo(user32.X, user32.Y, true);
                                    }
                                }
                                if ((Params.Length == 2) && (Params[1] == "override"))
                                {
                                    foreach (RoomUser user34 in list6)
                                    {
                                        if (this.Session.GetHabbo().Id != user34.UserID)
                                        {
                                            user34.AllowOverride = true;
                                            user34.MoveTo(user32.X, user32.Y, true);
                                            user34.AllowOverride = false;
                                        }
                                    }
                                }
                                return true;//5258;
                            }
                            this.Session.SendNotif("An unknown error occured!");
                            return true;
                        }
                    case "sayall":
                        if (this.Session.GetHabbo().GotCommand("sayall"))
                        {
                            Room room37 = this.Session.GetHabbo().CurrentRoom;
                            if (room37 != null)
                            {
                                string str20 = MergeParams(Params, 1);
                                if (str20 != "")
                                {
                                    foreach (RoomUser user35 in room37.GetRoomUserManager().GetRoomUsers())
                                    {
                                        user35.Chat(user35.GetClient(), str20, false, 0, 0);
                                    }
                                }
                            }
                        }
                        return true;

                    case "hal":
                        if (this.Session.GetHabbo().GotCommand("hal"))
                        {
                            Room room56 = this.Session.GetHabbo().CurrentRoom;
                            string str21 = Params[1];
                            string str22 = MergeParams(Params, 2);
                            ServerMessage message9 = new ServerMessage(Outgoing.AlertNotificationMessageComposer);
                            message9.AppendString(str22 + "\r\n-" + this.Session.GetHabbo().Username);
                            message9.AppendString(str21);
                            CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(message9);
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "HotelAlert", "Hotel alert [" + str22 + "]");
                        }
                        return true;

                    case "sa":
                    case "sm":
                        if (this.Session.GetHabbo().GotCommand("sa"))
                        {
                            string str23 = MergeParams(Params, 1);
                            ServerMessage message10 = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
                            message10.AppendString("staffcloud");
                            message10.AppendInt32(2);
                            message10.AppendString("title");
                            message10.AppendString("Mensaje entre Staff");
                            message10.AppendString("message");
                            message10.AppendString("<b><font color=\"#6E09A0\" size=\"14\">Mensaje entre Staffs:</font></b>\r\n" + str23 + "\r\n- <i>" + this.Session.GetHabbo().Username + "</i>");
                            CyberEnvironment.GetGame().GetClientManager().StaffAlert(message10, 0);
                            CyberEnvironment.GetGame().GetModerationTool().LogStaffEntry(this.Session.GetHabbo().Username, string.Empty, "StaffAlert", "Staff alert [" + str23 + "]");
                        }
                        return true;

                    case "invisible":
                    case "spec":
                    case "spectatorsmode":
                        if (this.Session.GetHabbo().GotCommand("invisible"))
                        {
                            if (this.Session.GetHabbo().SpectatorMode)
                            {
                                this.Session.GetHabbo().SpectatorMode = false;
                                this.Session.SendNotif("You are not invisible anymore.");
                            }
                            else
                            {
                                this.Session.GetHabbo().SpectatorMode = true;
                                this.Session.SendNotif("Reload the room to be invisible");
                            }
                        }
                        return true;


                    case "makepublic":
                        {
                            if (!this.Session.GetHabbo().GotCommand("makepublic"))
                            {
                                return true;//56EA;
                            }
                            Room room38 = this.Session.GetHabbo().CurrentRoom;
                            if (room38 != null)
                            {
                                using (IQueryAdapter adapter17 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                {
                                    adapter17.runFastQuery("UPDATE rooms SET roomtype='public' WHERE id=" + room38.RoomId + " LIMIT 1");
                                }
                                room38.Type = "public";
                                room38.RoomData.Type = "public";
                                room38.RoomData.SerializeRoomData(new ServerMessage(), false, this.Session, true);
                                return true;//56EA;
                            }
                            return true;
                        }
                    case "makeprivate":
                        {
                            if (!this.Session.GetHabbo().GotCommand("makeprivate"))
                            {
                                return true;//5790
                            }
                            Room room39 = this.Session.GetHabbo().CurrentRoom;
                            if (room39 != null)
                            {
                                using (IQueryAdapter adapter18 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                {
                                    adapter18.runFastQuery("UPDATE rooms SET roomtype='private' WHERE id=" + room39.RoomId + " LIMIT 1");
                                }
                                room39.Type = "private";
                                room39.RoomData.Type = "private";
                                room39.RoomData.SerializeRoomData(new ServerMessage(), false, this.Session, true);
                                return true;//5790;
                            }
                            return true;
                        }

                    case "roomaction":
                        if (this.Session.GetHabbo().GotCommand("roomaction"))
                        {
                            try
                            {
                                Room room40 = this.Session.GetHabbo().CurrentRoom;
                                HashSet<RoomUser> list7 = room40.GetRoomUserManager().GetRoomUsers();
                                int action = short.Parse(Params[1]);
                                new ServerMessage();
                                foreach (RoomUser user37 in list7)
                                {
                                    if (user37 != null)
                                    {
                                        ServerMessage ActionMsg = new ServerMessage();
                                        ActionMsg.Init(Outgoing.RoomUserActionMessageComposer);
                                        ActionMsg.AppendInt32(user37.VirtualId);
                                        ActionMsg.AppendInt32(action);
                                        room40.SendMessage(ActionMsg);
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                        return true;


                }
            }
            return false;
        }
Esempio n. 4
0
        internal void MoveBall(RoomItem item, GameClient mover, int newX, int newY, RoomUser user)
        {
            if (item == null || mover == null)
                return;

            if (!room.GetGameMap().itemCanBePlacedHere(newX, newY))
                return;

            Point oldRoomCoord = item.Coordinate;
            // bool itemIsOnGameItem = GameItemOverlaps(item);

            Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];


            ServerMessage mMessage = new ServerMessage();
            mMessage.Init(Outgoing.ItemAnimationMessageComposer); // Cf
            mMessage.AppendInt32(item.Coordinate.X);
            mMessage.AppendInt32(item.Coordinate.Y);
            mMessage.AppendInt32(newX);
            mMessage.AppendInt32(newY);
            mMessage.AppendInt32(1);
            mMessage.AppendUInt(item.Id);
            mMessage.AppendString(TextHandling.GetString(item.GetZ));
            mMessage.AppendString(TextHandling.GetString(NewZ));
            mMessage.AppendUInt(item.Id);
            room.SendMessage(mMessage);
            item.ExtraData = "11";
            item.UpdateNeeded = true;
            if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
                return;

          
            if (!room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false))
            {
                room.GetRoomItemHandler().SetFloorItem(item, newX, newY, NewZ);
            }
            HandleFootballGameItems(item.Coordinate, user);
        }
Esempio n. 5
0
		internal void SerializeClub()
		{
			GameClient client = this.GetClient();
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.SubscriptionStatusMessageComposer);
			serverMessage.AppendString("club_habbo");
			if (client.GetHabbo().GetSubscriptionManager().HasSubscription)
			{
				double num = (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ExpireTime;
				double num2 = num - (double)CyberEnvironment.GetUnixTimestamp();
				checked
				{
					int num3 = (int)Math.Ceiling(num2 / 86400.0);
					int i = (int)Math.Ceiling(unchecked((double)CyberEnvironment.GetUnixTimestamp() - (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ActivateTime) / 86400.0);
					int num4 = num3 / 31;
					if (num4 >= 1)
					{
						num4--;
					}
					serverMessage.AppendInt32(num3 - num4 * 31);
					serverMessage.AppendInt32(1);
					serverMessage.AppendInt32(num4);
					serverMessage.AppendInt32(1);
					serverMessage.AppendBoolean(true);
					serverMessage.AppendBoolean(true);
					serverMessage.AppendInt32(i);
					serverMessage.AppendInt32(i);
					serverMessage.AppendInt32(10);
				}
			}
			else
			{
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
			}
			client.SendMessage(serverMessage);
			ServerMessage serverMessage2 = new ServerMessage(Outgoing.UserClubRightsMessageComposer);
			serverMessage2.AppendInt32(this.GetSubscriptionManager().HasSubscription ? 2 : 0);
			serverMessage2.AppendUInt(this.Rank);
			serverMessage2.AppendInt32(0);
			client.SendMessage(serverMessage2);
		}
		internal void GiveRespect()
		{
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
			if (room == null || this.Session.GetHabbo().DailyRespectPoints <= 0)
			{
				return;
			}
			RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(this.Request.PopWiredUInt());
			if (roomUserByHabbo == null || roomUserByHabbo.GetClient().GetHabbo().Id == this.Session.GetHabbo().Id || roomUserByHabbo.IsBot)
			{
				return;
			}
			CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(this.Session, QuestType.SOCIAL_RESPECT, 0u);
			CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(this.Session, "ACH_RespectGiven", 1, false);
			CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(roomUserByHabbo.GetClient(), "ACH_RespectEarned", 1, false);
			checked
			{
				this.Session.GetHabbo().DailyRespectPoints--;
				roomUserByHabbo.GetClient().GetHabbo().Respect++;
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.runFastQuery(string.Concat(new object[]
					{
						"UPDATE user_stats SET respect = respect + 1 WHERE id = ",
						roomUserByHabbo.GetClient().GetHabbo().Id,
						" LIMIT 1;UPDATE user_stats SET daily_respect_points = daily_respect_points - 1 WHERE id= ",
						this.Session.GetHabbo().Id,
						" LIMIT 1"
					}));
				}
				ServerMessage serverMessage = new ServerMessage(Outgoing.GiveRespectsMessageComposer);
				serverMessage.AppendUInt(roomUserByHabbo.GetClient().GetHabbo().Id);
				serverMessage.AppendInt32(roomUserByHabbo.GetClient().GetHabbo().Respect);
				room.SendMessage(serverMessage);

                ServerMessage thumbsUp = new ServerMessage();
                thumbsUp.Init(Outgoing.RoomUserActionMessageComposer);
                thumbsUp.AppendInt32(room.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Username).VirtualId);
                thumbsUp.AppendInt32(7);
                room.SendMessage(thumbsUp);
            }
		}
		internal void ChooseTVPlayerVideo()
		{
			uint num = this.Request.PopWiredUInt();
			int num2 = this.Request.PopWiredInt32();
			PlayerTV playerTV = CyberEnvironment.GetGame().GetVideoManager().AddOrGetTV(num, this.Session.GetHabbo().CurrentRoomId);
			RoomItem item = this.Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(num);
			if (item.GetBaseItem().InteractionType == InteractionType.youtubetv)
			{
				if (num2 >= 1)
				{
					playerTV.SetNextVideo();
				}
				else
				{
					playerTV.SetPreviousVideo();
				}
				ServerMessage serverMessage = new ServerMessage();
				serverMessage.Init(Outgoing.YouTubeLoadVideoMessageComposer);
				serverMessage.AppendUInt(num);
				serverMessage.AppendString(playerTV.CurrentVideo);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(playerTV.Playlist.GetDuration(playerTV.CurrentVideo));
				this.Response = serverMessage;
				this.SendResponse();
				item.ExtraData = playerTV.CurrentVideo;
				ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
				item.Serialize(message);
				this.Session.GetHabbo().CurrentRoom.SendMessage(message);
			}
		}
Esempio n. 8
0
        internal void UpdateUserStatus(RoomUser User, bool cyclegameitems)
        {
            try
            {
                if (User != null)
                {
                    bool isBot = User.IsBot;
                    if (isBot)
                    {
                        cyclegameitems = false;
                    }
                    if (checked(User.SignTime - CyberEnvironment.GetUnixTimestamp()) < 0 && User.Statusses.ContainsKey("sign"))
                    {
                        User.Statusses.Remove("sign");
                        User.UpdateNeeded = true;
                    }
                    if ((User.Statusses.ContainsKey("lay") && !User.IsLyingDown) || (User.Statusses.ContainsKey("sit") && !User.IsSitting))
                    {
                        User.Statusses.Remove("lay");
                        User.Statusses.Remove("sit");
                        User.UpdateNeeded = true;
                    }
                    else
                    {
                        if (User.IsLyingDown || User.IsSitting)
                        {
                            return;
                        }
                    }
                    CoordItemSearch coordItemSearch = new CoordItemSearch(this.room.GetGameMap().CoordinatedItems);
                    List<RoomItem> allRoomItemForSquare = coordItemSearch.GetAllRoomItemForSquare(User.X, User.Y);
                    double num;
                    if (User.RidingHorse && !User.IsPet)
                    {
                        num = this.room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, allRoomItemForSquare) + 1.0;
                    }
                    else
                    {
                        num = this.room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, allRoomItemForSquare);
                    }
                    if (num != User.Z)
                    {
                        User.Z = num;
                        User.UpdateNeeded = true;
                    }
                    DynamicRoomModel model = this.room.GetGameMap().Model;
                    if (model.SqState[User.X, User.Y] == SquareState.SEAT || User.IsSitting || User.IsLyingDown)
                    {
                        if (User.IsSitting)
                        {
                            if (!User.Statusses.ContainsKey("sit"))
                            {
                                User.Statusses.Add("sit", Convert.ToString((double)model.SqFloorHeight[User.X, User.Y] + 0.55));
                            }
                            User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                            User.UpdateNeeded = true;
                        }
                        else
                        {
                            if (User.IsLyingDown)
                            {
                                if (!User.Statusses.ContainsKey("lay"))
                                {
                                    User.Statusses.Add("lay", Convert.ToString((double)model.SqFloorHeight[User.X, User.Y] + 0.55));
                                }
                                User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                                User.UpdateNeeded = true;
                            }
                            else
                            {
                                if (!User.Statusses.ContainsKey("sit"))
                                {
                                    User.Statusses.Add("sit", "1.0");
                                }
                                User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                                User.RotHead = (int)model.SqSeatRot[User.X, User.Y];
                                User.RotBody = (int)model.SqSeatRot[User.X, User.Y];
                                User.UpdateNeeded = true;
                            }
                        }
                    }
                    if (allRoomItemForSquare.Count == 0)
                    {
                        User.LastItem = 0;
                    }
                    using (List<RoomItem>.Enumerator enumerator = allRoomItemForSquare.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            RoomItem Item = enumerator.Current;
                            if (cyclegameitems)
                            {
                                Item.UserWalksOnFurni(User);
                                CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(User.GetClient(), QuestType.STAND_ON, Item.GetBaseItem().ItemId);
                            }
                            if (Item.GetBaseItem().IsSeat)
                            {
                                if (!User.Statusses.ContainsKey("sit"))
                                {
                                    if (Item.GetBaseItem().StackMultipler && !string.IsNullOrWhiteSpace(Item.ExtraData))
                                    {
                                        if (Item.ExtraData != "0")
                                        {
                                            int num2 = Convert.ToInt32(Item.ExtraData);
                                            User.Statusses.Add("sit", Item.GetBaseItem().ToggleHeight[num2].ToString());
                                        }
                                        else
                                        {
                                            User.Statusses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height));
                                        }
                                    }
                                    else
                                    {
                                        User.Statusses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height));
                                    }
                                }
                                User.Z = Item.GetZ;
                                User.RotHead = Item.Rot;
                                User.RotBody = Item.Rot;
                                User.UpdateNeeded = true;
                            }
                            InteractionType interactionType = Item.GetBaseItem().InteractionType;
                            checked
                            {
                                if (interactionType <= InteractionType.banzaigategreen)
                                {
                                    if (interactionType != InteractionType.bed)
                                    {
                                        if (interactionType != InteractionType.fbgate)
                                        {
                                            switch (interactionType)
                                            {
                                                case InteractionType.banzaigateblue:
                                                case InteractionType.banzaigatered:
                                                case InteractionType.banzaigateyellow:
                                                case InteractionType.banzaigategreen:
                                                    {
                                                        if (!cyclegameitems)
                                                        {
                                                            continue;
                                                        }
                                                        int num3 = (int)(Item.team + 32);
                                                        TeamManager teamManagerForBanzai = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForBanzai();
                                                        AvatarEffectsInventoryComponent avatarEffectsInventoryComponent = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();
                                                        if (User.team == Team.none)
                                                        {
                                                            if (!teamManagerForBanzai.CanEnterOnTeam(Item.team))
                                                            {
                                                                continue;
                                                            }
                                                            if (User.team != Team.none)
                                                            {
                                                                teamManagerForBanzai.OnUserLeave(User);
                                                            }
                                                            User.team = Item.team;
                                                            teamManagerForBanzai.AddUser(User);
                                                            if (avatarEffectsInventoryComponent.CurrentEffect != num3)
                                                            {
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(num3);
                                                                continue;
                                                            }
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            if (User.team != Team.none && User.team != Item.team)
                                                            {
                                                                teamManagerForBanzai.OnUserLeave(User);
                                                                User.team = Team.none;
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(0);
                                                                continue;
                                                            }
                                                            teamManagerForBanzai.OnUserLeave(User);
                                                            if (avatarEffectsInventoryComponent.CurrentEffect == num3)
                                                            {
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(0);
                                                            }
                                                            User.team = Team.none;
                                                            continue;
                                                        }
                                                    }
                                                default:
                                                    continue;
                                            }
                                        }
                                        else
                                        {
                                            if (User.IsBot)
                                            {
                                                continue;
                                            }

                                            string look = Item.ExtraData.Split(';')[0];
                                            if (User.GetClient().GetHabbo().Gender.ToUpper() == "F")
                                            {
                                                look = Item.ExtraData.Split(';')[1];
                                            }
                                            look = look.Replace("hd-99999-99999", User.GetClient().GetHabbo().HeadPart);
                                            User.GetClient().GetHabbo().Look = look;

                                            ServerMessage serverMessage = new ServerMessage();
                                            serverMessage.Init(Outgoing.UpdateUserDataMessageComposer);
                                            serverMessage.AppendInt32(-1);
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Motto);
                                            serverMessage.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
                                            User.GetClient().SendMessage(serverMessage);
                                            ServerMessage serverMessage2 = new ServerMessage();
                                            serverMessage2.Init(Outgoing.UpdateUserDataMessageComposer);
                                            serverMessage2.AppendInt32(User.VirtualId);
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Motto);
                                            serverMessage2.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
                                            this.room.SendMessage(serverMessage2);

                                            ServerMessage serverMessage3 = new ServerMessage();
                                            serverMessage3.Init(Outgoing.UpdateAvatarAspectMessageComposer);
                                            serverMessage3.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage3.AppendString(User.GetClient().GetHabbo().Gender.ToUpper());
                                            User.GetClient().SendMessage(serverMessage3);

                                            continue;
                                        }
                                    }
                                }
                                else
                                {
                                    if (interactionType <= InteractionType.freezebluegate)
                                    {
                                        if (interactionType == InteractionType.banzaitele)
                                        {
                                            this.room.GetGameItemHandler().onTeleportRoomUserEnter(User, Item);
                                            continue;
                                        }
                                        switch (interactionType)
                                        {
                                            case InteractionType.freezeyellowgate:
                                            case InteractionType.freezeredgate:
                                            case InteractionType.freezegreengate:
                                            case InteractionType.freezebluegate:
                                                if (cyclegameitems)
                                                {
                                                    int num4 = (int)(Item.team + 39);
                                                    TeamManager teamManagerForFreeze = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForFreeze();
                                                    AvatarEffectsInventoryComponent avatarEffectsInventoryComponent2 = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();
                                                    if (User.team != Item.team)
                                                    {
                                                        if (teamManagerForFreeze.CanEnterOnTeam(Item.team))
                                                        {
                                                            if (User.team != Team.none)
                                                            {
                                                                teamManagerForFreeze.OnUserLeave(User);
                                                            }
                                                            User.team = Item.team;
                                                            teamManagerForFreeze.AddUser(User);
                                                            if (avatarEffectsInventoryComponent2.CurrentEffect != num4)
                                                            {
                                                                avatarEffectsInventoryComponent2.ActivateCustomEffect(num4);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        teamManagerForFreeze.OnUserLeave(User);
                                                        if (avatarEffectsInventoryComponent2.CurrentEffect == num4)
                                                        {
                                                            avatarEffectsInventoryComponent2.ActivateCustomEffect(0);
                                                        }
                                                        User.team = Team.none;
                                                    }
                                                    ServerMessage serverMessage3 = new ServerMessage(Outgoing.UserIsPlayingFreezeMessageComposer);
                                                    serverMessage3.AppendBoolean(User.team != Team.none);
                                                    User.GetClient().SendMessage(serverMessage3);
                                                    continue;
                                                }
                                                continue;
                                            default:
                                                continue;
                                        }
                                    }
                                    else
                                    {
                                        if (interactionType != InteractionType.jump)
                                        {
                                            switch (interactionType)
                                            {
                                                case InteractionType.pinata:
                                                    {
                                                        if (!User.IsWalking || Item.ExtraData.Length <= 0)
                                                        {
                                                            continue;
                                                        }
                                                        int num5 = int.Parse(Item.ExtraData);
                                                        if (num5 >= 100 || User.CurrentEffect != 158)
                                                        {
                                                            continue;
                                                        }
                                                        int num6 = num5 + 1;
                                                        Item.ExtraData = num6.ToString();

                                                        Item.UpdateState();
                                                        CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(User.GetClient(), "ACH_PinataWhacker", 1, false);
                                                        if (num6 == 100)
                                                        {
                                                            CyberEnvironment.GetGame().GetPinataHandler().DeliverRandomPinataItem(User, this.room, Item);
                                                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(User.GetClient(), "ACH_PinataBreaker", 1, false);
                                                            continue;
                                                        }
                                                        continue;
                                                    }
                                                case InteractionType.tilestackmagic:
                                                case InteractionType.poster:
                                                    continue;

                                                case InteractionType.tent:
                                                case InteractionType.bedtent:
                                                    if (User.LastItem == Item.Id)
                                                        continue;

                                                    if (!User.IsBot && !User.OnCampingTent)
                                                    {
                                                        ServerMessage serverMessage = new ServerMessage();
                                                        serverMessage.Init(Outgoing.UpdateFloorItemExtraDataMessageComposer);
                                                        serverMessage.AppendString(Item.Id.ToString());
                                                        serverMessage.AppendInt32(0);
                                                        serverMessage.AppendString("1");
                                                        User.GetClient().SendMessage(serverMessage);
                                                        User.OnCampingTent = true;
                                                        User.LastItem = Item.Id;
                                                    }
                                                    continue;
                                                case InteractionType.runwaysage:
                                                    {
                                                        int num7 = new Random().Next(1, 4);
                                                        Item.ExtraData = num7.ToString();
                                                        Item.UpdateState();
                                                        continue;
                                                    }
                                                case InteractionType.shower:
                                                    Item.ExtraData = "1";
                                                    Item.UpdateState();
                                                    continue;
                                                default:
                                                    continue;
                                            }
                                        }
                                        else
                                        {
                                            if ((User.Y == Item.GetY || User.Y == Item.GetY - 1) && User.X == Item.GetX + 1)
                                            {
                                                continue;
                                            }
                                            continue;
                                        }
                                    }
                                }
                                if (Item.GetBaseItem().InteractionType == InteractionType.bedtent)
                                {
                                    User.OnCampingTent = true;
                                }
                                if (!User.Statusses.ContainsKey("lay"))
                                {
                                    User.Statusses.Add("lay", TextHandling.GetString(Item.GetBaseItem().Height) + " null");
                                }
                                User.Z = Item.GetZ;
                            }
                            User.RotHead = Item.Rot;
                            User.RotBody = Item.Rot;
                            User.UpdateNeeded = true;
                        }
                    }
                    if (User.IsSitting && User.TeleportEnabled)
                    {
                        User.Z -= 0.35;
                        User.UpdateNeeded = true;
                    }
                    if (cyclegameitems)
                    {
                        if (this.room.GotSoccer())
                        {
                            this.room.GetSoccer().OnUserWalk(User);
                        }
                        if (this.room.GotBanzai())
                        {
                            this.room.GetBanzai().OnUserWalk(User);
                        }
                        this.room.GetFreeze().OnUserWalk(User);
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 9
0
 private ServerMessage NewHeightMap()
 {
     ServerMessage serverMessage = new ServerMessage();
     serverMessage.Init(Outgoing.HeightMapMessageComposer);
     serverMessage.AppendInt32(this.Model.MapSizeX);
     checked
     {
         serverMessage.AppendInt32(this.Model.MapSizeX * this.Model.MapSizeY);
         for (int i = 0; i < this.Model.MapSizeY; i++)
         {
             for (int j = 0; j < this.Model.MapSizeX; j++)
             {
                 serverMessage.AppendShort((short)(this.SqAbsoluteHeight(j, i) * 256));
                 //  serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
             }
         }
         return serverMessage;
     }
 }
Esempio n. 10
0
        private void OnUserAdd(object sender, EventArgs args)
        {
            try
            {
                if (sender != null)
                {
                    RoomUser value = ((KeyValuePair<int, RoomUser>)sender).Value;
                    if (value != null && value.GetClient() != null && value.GetClient().GetHabbo() != null)
                    {
                        GameClient client = value.GetClient();
                        if (client != null && client.GetHabbo() != null && this.room != null)
                        {
                            if (!value.IsSpectator)
                            {
                                DynamicRoomModel model = this.room.GetGameMap().Model;
                                if (model == null)
                                {
                                    return;
                                }
                                value.SetPos(model.DoorX, model.DoorY, model.DoorZ);
                                value.SetRot(model.DoorOrientation, false);
                                if (this.room.CheckRights(client, true, false))
                                {
                                    value.AddStatus("flatctrl 4", "");
                                }
                                else
                                {
                                    if (this.room.CheckRights(client, false, true))
                                    {
                                        value.AddStatus("flatctrl 1", "");
                                    }
                                    else
                                    {
                                        if (this.room.CheckRights(client))
                                        {
                                            value.AddStatus("flatctrl 1", "");
                                        }
                                    }
                                }
                                value.CurrentItemEffect = ItemEffectType.None;
                                if (!value.IsBot && value.GetClient().GetHabbo().IsTeleporting)
                                {
                                    RoomItem item = this.room.GetRoomItemHandler().GetItem(value.GetClient().GetHabbo().TeleporterId);
                                    if (item != null)
                                    {
                                        item.ExtraData = "2";
                                        item.UpdateState(false, true);
                                        value.SetPos(item.GetX, item.GetY, item.GetZ);
                                        value.SetRot(item.Rot, false);
                                        item.InteractingUser2 = client.GetHabbo().Id;
                                        item.ExtraData = "0";
                                        item.UpdateState(false, true);
                                    }
                                }
                                if (!value.IsBot && value.GetClient().GetHabbo().IsHopping)
                                {
                                    RoomItem item2 = this.room.GetRoomItemHandler().GetItem(value.GetClient().GetHabbo().HopperId);
                                    if (item2 != null)
                                    {
                                        item2.ExtraData = "1";
                                        item2.UpdateState(false, true);
                                        value.SetPos(item2.GetX, item2.GetY, item2.GetZ);
                                        value.SetRot(item2.Rot, false);
                                        value.AllowOverride = false;
                                        item2.InteractingUser2 = client.GetHabbo().Id;
                                        item2.ExtraData = "2";
                                        item2.UpdateState(false, true);
                                    }
                                }

                                if (!value.IsSpectator)
                                {
                                    ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUserMessageComposer);
                                    serverMessage.AppendInt32(1);
                                    value.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
                                    this.room.SendMessage(serverMessage);
                                }
                                if (!value.IsBot)
                                {
                                    ServerMessage serverMessage2 = new ServerMessage();
                                    serverMessage2.Init(Outgoing.UpdateUserDataMessageComposer);
                                    serverMessage2.AppendInt32(value.VirtualId);
                                    serverMessage2.AppendString(value.GetClient().GetHabbo().Look);
                                    serverMessage2.AppendString(value.GetClient().GetHabbo().Gender.ToLower());
                                    serverMessage2.AppendString(value.GetClient().GetHabbo().Motto);
                                    serverMessage2.AppendInt32(value.GetClient().GetHabbo().AchievementPoints);
                                    this.room.SendMessage(serverMessage2);
                                }
                                if (this.room.Owner != client.GetHabbo().Username)
                                {
                                    CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(value.GetClient(), QuestType.SOCIAL_VISIT, 0u);
                                    CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(value.GetClient(), "ACH_RoomEntry", 1, false);
                                }
                            }
                            if (client.GetHabbo().GetMessenger() != null)
                            {
                                client.GetHabbo().GetMessenger().OnStatusChanged(true);
                            }
                            value.GetClient().GetMessageHandler().OnRoomUserAdd();


                            if (this.OnUserEnter != null)
                            {
                                this.OnUserEnter(value, null);
                            }
                            if (this.room.GotMusicController() && this.room.GotMusicController())
                            {
                                this.room.GetRoomMusicController().OnNewUserEnter(value);
                            }


                            this.room.OnUserEnter(value);

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.LogCriticalException(ex.ToString());
            }
        }
Esempio n. 11
0
 internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
 {
     int virtualId = this.primaryPrivateUserID++;
     RoomUser roomUser = new RoomUser(0u, this.room.RoomId, virtualId, this.room, false);
     int num = this.secondaryPrivateUserID++;
     roomUser.InternalRoomID = num;
     this.userlist.Add(num, roomUser);
     DynamicRoomModel model = this.room.GetGameMap().Model;
     Point coord = new Point(Bot.X, Bot.Y);
     if (Bot.X > 0 && Bot.Y > 0 && Bot.X < model.MapSizeX && Bot.Y < model.MapSizeY)
     {
         this.room.GetGameMap().AddUserToMap(roomUser, coord);
         roomUser.SetPos(Bot.X, Bot.Y, Bot.Z);
         roomUser.SetRot(Bot.Rot, false);
     }
     else
     {
         Bot.X = model.DoorX;
         Bot.Y = model.DoorY;
         roomUser.SetPos(model.DoorX, model.DoorY, model.DoorZ);
         roomUser.SetRot(model.DoorOrientation, false);
     }
     roomUser.BotData = Bot;
     checked
     {
         roomUser.BotAI = Bot.GenerateBotAI(roomUser.VirtualId, (int)Bot.BotId);
         if (roomUser.IsPet)
         {
             roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
             roomUser.PetData = PetData;
             roomUser.PetData.VirtualId = roomUser.VirtualId;
         }
         else
         {
             roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
         }
         this.UpdateUserStatus(roomUser, false);
         roomUser.UpdateNeeded = true;
         ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUserMessageComposer);
         serverMessage.AppendInt32(1);
         roomUser.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
         this.room.SendMessage(serverMessage);
         roomUser.BotAI.OnSelfEnterRoom();
         if (roomUser.IsPet)
         {
             if (this.pets.Contains(roomUser.PetData.PetId))
             {
                 this.pets[roomUser.PetData.PetId] = roomUser;
             }
             else
             {
                 this.pets.Add(roomUser.PetData.PetId, roomUser);
             }
             this.petCount++;
         }
         if (roomUser.BotData.AiType == AIType.Generic)
         {
             if (this.bots.Contains(roomUser.BotData.BotId))
             {
                 this.bots[roomUser.BotData.BotId] = roomUser;
             }
             else
             {
                 this.bots.Add(roomUser.BotData.BotId, roomUser);
             }
             serverMessage.Init(Outgoing.DanceStatusMessageComposer);
             serverMessage.AppendInt32(roomUser.VirtualId);
             serverMessage.AppendInt32(roomUser.BotData.DanceId);
             this.room.SendMessage(serverMessage);
             this.petCount++;
         }
         return roomUser;
     }
 }
Esempio n. 12
0
        internal void OnCycle(ref int idleCount)
        {
            this.ToRemove.Clear();
            int count = 0;
            foreach (RoomUser roomUser in this.UserList.Values)
            {
                if (!this.isValid(roomUser))
                {
                    if (roomUser.GetClient() != null)
                        this.RemoveUserFromRoom(roomUser.GetClient(), false, false);
                    else
                        this.RemoveRoomUser(roomUser);
                }
                bool updated = false;
                roomUser.IdleTime++;
                if (!roomUser.IsBot && !roomUser.IsAsleep && roomUser.IdleTime >= 600)
                {
                    roomUser.IsAsleep = true;
                    ServerMessage sleepMsg = new ServerMessage(Outgoing.RoomUserIdleMessageComposer);
                    sleepMsg.AppendInt32(roomUser.VirtualId);
                    sleepMsg.AppendBoolean(true);
                    this.room.SendMessage(sleepMsg);
                }
                if (roomUser.NeedsAutokick && !this.ToRemove.Contains(roomUser))
                {
                    this.ToRemove.Add(roomUser);
                    continue;
                }
                else
                {
                    if (roomUser.CarryItemID > 0)
                    {
                        roomUser.CarryTimer--;
                        if (roomUser.CarryTimer <= 0)
                            roomUser.CarryItem(0);
                    }
                    if (this.room.GotFreeze())
                    {
                        this.room.GetFreeze().CycleUser(roomUser);
                    }

                    if (roomUser.IsPet)
                    {
                        if (!roomUser.IsWalking && roomUser.Statusses.ContainsKey("mv"))
                        {
                            roomUser.ClearMovement(true);
                        }
                    }

                    bool invalidStep = false;
                    if (roomUser.SetStep)
                    {
                        if (this.room.GetGameMap().CanWalk(roomUser.SetX, roomUser.SetY, roomUser.AllowOverride) || roomUser.RidingHorse)
                        {
                            Gamemap gameMap = this.room.GetGameMap();


                            Point coordinate = roomUser.Coordinate;
                            int x = coordinate.X;
                            coordinate = roomUser.Coordinate;
                            int y = coordinate.Y;
                            Point oldCoord = new Point(x, y);
                            Point newCoord = new Point(roomUser.SetX, roomUser.SetY);
                            RoomUser user = roomUser;
                            gameMap.UpdateUserMovement(oldCoord, newCoord, user);
                            List<RoomItem> coordinatedItems = this.room.GetGameMap().GetCoordinatedItems(new Point(roomUser.X, roomUser.Y));
                            roomUser.X = roomUser.SetX;
                            roomUser.Y = roomUser.SetY;
                            roomUser.Z = roomUser.SetZ;
                            this.ToSet.Remove(new Point(roomUser.SetX, roomUser.SetY));

                            if (this.room.GotSoccer())
                            {
                                this.room.GetSoccer().OnUserWalk(roomUser);
                            }

                            lock (coordinatedItems)
                            {
                                foreach (RoomItem itemE in coordinatedItems)
                                {
                                    itemE.UserWalksOffFurni(roomUser);

                                    switch (itemE.GetBaseItem().InteractionType)
                                    {
                                        case InteractionType.tent:
                                        case InteractionType.bedtent:
                                            if (!roomUser.IsBot && roomUser.OnCampingTent)
                                            {
                                                ServerMessage serverMessage = new ServerMessage();
                                                serverMessage.Init(Outgoing.UpdateFloorItemExtraDataMessageComposer);
                                                serverMessage.AppendString(itemE.Id.ToString());
                                                serverMessage.AppendInt32(0);
                                                serverMessage.AppendString("0");
                                                roomUser.GetClient().SendMessage(serverMessage);
                                                roomUser.OnCampingTent = false;
                                            }
                                            break;

                                        case InteractionType.runwaysage:
                                        case InteractionType.shower:
                                            itemE.ExtraData = "0";
                                            itemE.UpdateState();
                                            break;
                                    }
                                }
                            }

                            if (roomUser.X == this.room.GetGameMap().Model.DoorX && roomUser.Y == this.room.GetGameMap().Model.DoorY && !this.ToRemove.Contains(roomUser) && !roomUser.IsBot)
                            {
                                this.ToRemove.Add(roomUser);
                                continue;
                            }
                            else
                                this.UpdateUserStatus(roomUser, true);
                        }
                        else
                        {
                            invalidStep = true;
                        }
                        roomUser.SetStep = false;
                    }

                    if (roomUser.PathRecalcNeeded)
                    {
                        roomUser.Path.Clear();
                        roomUser.Path = PathFinder.FindPath(roomUser, this.room.GetGameMap().DiagonalEnabled, this.room.GetGameMap(), new Vector2D(roomUser.X, roomUser.Y), new Vector2D(roomUser.GoalX, roomUser.GoalY));
                        if (roomUser.Path.Count > 1)
                        {
                            roomUser.PathStep = 1;
                            roomUser.IsWalking = true;
                            roomUser.PathRecalcNeeded = false;
                        }
                        else
                        {
                            roomUser.PathRecalcNeeded = false;
                            roomUser.Path.Clear();
                        }
                    }
                    if (roomUser.IsWalking && !roomUser.Freezed)
                    {
                        if (!roomUser.HasPathBlocked && (invalidStep || roomUser.PathStep >= roomUser.Path.Count || roomUser.GoalX == roomUser.X && roomUser.GoalY == roomUser.Y))
                        {
                            roomUser.IsWalking = false;
                            roomUser.RemoveStatus("mv");
                            this.UpdateUserStatus(roomUser, false);

                            if (roomUser.RidingHorse && !roomUser.IsPet && !roomUser.IsBot)
                            {
                                RoomUser roomUserByVirtualId = this.GetRoomUserByVirtualId(Convert.ToInt32(roomUser.HorseID));
                                roomUserByVirtualId.IsWalking = false;
                                roomUserByVirtualId.RemoveStatus("mv");
                                ServerMessage Message = new ServerMessage(Outgoing.UpdateUserStatusMessageComposer);
                                Message.AppendInt32(1);
                                roomUserByVirtualId.SerializeStatus(Message, "");
                                roomUser.GetClient().GetHabbo().CurrentRoom.SendMessage(Message);
                            }
                        }
                        else
                        {
                            int index1 = checked(roomUser.Path.Count - roomUser.PathStep - 1);
                            Vector2D vector2D = roomUser.Path[index1];
                            checked { ++roomUser.PathStep; }

                            if (roomUser.FastWalking && roomUser.PathStep < roomUser.Path.Count)
                            {
                                int index2 = checked(roomUser.Path.Count - roomUser.PathStep - 1);
                                vector2D = roomUser.Path[index2];
                                checked { ++roomUser.PathStep; }
                            }
                            int x = vector2D.X;
                            int y = vector2D.Y;
                            roomUser.RemoveStatus("mv");

                            if (this.room.GetGameMap().IsValidStep2(roomUser, new Point(roomUser.X, roomUser.Y), new Point(x, y), roomUser.GoalX == x && roomUser.GoalY == y, roomUser.AllowOverride) && this.room.GetGameMap().AntiChoques(x, y, roomUser))
                            {
                                double k = this.room.GetGameMap().SqAbsoluteHeight(x, y);
                                roomUser.SetX = x;
                                roomUser.SetY = y;
                                roomUser.SetZ = k;

                                int num = PathFinder.CalculateRotation(roomUser.X, roomUser.Y, x, y);
                                roomUser.RotBody = num;
                                roomUser.RotHead = num;
                                roomUser.SetStep = true;

                                if (!roomUser.IsBot)
                                {
                                    if (roomUser.IsSitting)
                                    {
                                        roomUser.Statusses.Remove("sit");
                                        roomUser.Z += 0.35;
                                        roomUser.IsSitting = false;
                                        roomUser.UpdateNeeded = true;
                                    }
                                    else if (roomUser.IsLyingDown)
                                    {
                                        roomUser.Statusses.Remove("sit");
                                        roomUser.Z += 0.35;
                                        roomUser.IsLyingDown = false;
                                        roomUser.UpdateNeeded = true;
                                    }
                                }
                                if (!roomUser.IsBot)
                                {
                                    roomUser.Statusses.Remove("lay");
                                    roomUser.Statusses.Remove("sit");
                                }
                                string Status1 = "";
                                string Status2 = "";
                                if (!roomUser.IsBot && !roomUser.IsPet && roomUser.GetClient() != null)
                                {
                                    if (roomUser.GetClient().GetHabbo().IsTeleporting)
                                    {
                                        roomUser.TeleportEnabled = false;
                                        roomUser.GetClient().GetHabbo().IsTeleporting = false;
                                        roomUser.GetClient().GetHabbo().TeleporterId = 0U;
                                    }
                                    else if (roomUser.GetClient().GetHabbo().IsHopping)
                                    {
                                        roomUser.GetClient().GetHabbo().IsHopping = false;
                                        roomUser.GetClient().GetHabbo().HopperId = 0U;
                                    }
                                }


                                if (!ToSet.ContainsKey(new Point(roomUser.SetX, roomUser.SetY)))
                                {
                                    this.ToSet.Add(new Point(roomUser.SetX, roomUser.SetY), roomUser);
                                }

                                if (!roomUser.IsBot && roomUser.RidingHorse && !roomUser.IsPet)
                                {
                                    Status1 = "mv " + x + "," + y + "," + TextHandling.GetString(k + 1.0);
                                    roomUser.AddStatus("mv", x + "," + y + "," + TextHandling.GetString(k + 1.0));
                                    Status2 = "mv " + x + "," + y + "," + TextHandling.GetString(k);
                                }
                                else
                                    roomUser.AddStatus("mv", x + "," + y + "," + TextHandling.GetString(k));

                                this.UpdateUserEffect(roomUser, roomUser.SetX, roomUser.SetY);
                                updated = true;
                                this.room.GetGameMap().GameMap[roomUser.X, roomUser.Y] = roomUser.SqState;
                                roomUser.SqState = this.room.GetGameMap().GameMap[roomUser.SetX, roomUser.SetY];


                                if (!roomUser.IsBot)
                                {
                                    if (roomUser.IsSitting)
                                        roomUser.IsSitting = false;
                                    if (roomUser.IsLyingDown)
                                        roomUser.IsLyingDown = false;
                                }
                                if (roomUser.RidingHorse && !roomUser.IsPet && !roomUser.IsBot)
                                {
                                    RoomUser roomUserByVirtualId = this.GetRoomUserByVirtualId(Convert.ToInt32(roomUser.HorseID));
                                    roomUserByVirtualId.RotBody = num;
                                    roomUserByVirtualId.RotHead = num;
                                    roomUserByVirtualId.SetStep = true;
                                    roomUserByVirtualId.SetX = x;
                                    roomUserByVirtualId.SetY = y;
                                    roomUserByVirtualId.SetZ = k;
                                    this.UpdateUserEffect(roomUserByVirtualId, roomUserByVirtualId.SetX, roomUserByVirtualId.SetY);
                                    updated = true;
                                    ServerMessage Message = new ServerMessage(Outgoing.UpdateUserStatusMessageComposer);
                                    Message.AppendInt32(2);
                                    roomUser.SerializeStatus(Message, Status1);
                                    roomUserByVirtualId.SerializeStatus(Message, Status2);
                                    roomUser.GetClient().GetHabbo().CurrentRoom.SendMessage(Message);
                                    this.UpdateUserEffect(roomUser, roomUser.SetX, roomUser.SetY);
                                    roomUserByVirtualId.UpdateNeeded = true;
                                }

                            }
                            else
                            {
                                roomUser.PathRecalcNeeded = true;
                            }
                        }
                        if (!roomUser.RidingHorse)
                            roomUser.UpdateNeeded = true;
                    }
                    else if (roomUser.Statusses.ContainsKey("mv"))
                    {
                        RoomUser roomUserByVirtualId = this.GetRoomUserByVirtualId(Convert.ToInt32(roomUser.HorseID));
                        roomUser.RemoveStatus("mv");
                        roomUser.UpdateNeeded = true;
                        if (roomUser.RidingHorse)
                        {
                            roomUserByVirtualId.RemoveStatus("mv");
                            roomUserByVirtualId.UpdateNeeded = true;
                        }
                    }
                    if (roomUser.RidingHorse)
                    {
                        roomUser.ApplyEffect(77);
                    }
                    if (roomUser.IsBot)
                    {
                        roomUser.BotAI.OnTimerTick();
                    }
                    else
                    {
                        count++;
                    }
                    if (!updated)
                        this.UpdateUserEffect(roomUser, roomUser.X, roomUser.Y);
                }
            }
            if (count == 0) idleCount++;

            lock (ToRemove)
            {
                foreach (RoomUser user in this.ToRemove)
                {
                    GameClient clientByUserId = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(user.HabboId);
                    if (clientByUserId != null)
                    {
                        this.RemoveUserFromRoom(clientByUserId, true, false);
                        clientByUserId.CurrentRoomUserID = -1;
                    }
                    else
                        this.RemoveRoomUser(user);
                }
            }
            if (this.userCount == count)
                return;
            this.UpdateUserCount(count);
        }
Esempio n. 13
0
		internal void SerializeGroupInfo(Guild Group, ServerMessage Response, GameClient Session, Room Room, bool NewWindow = false)
		{
            if (Room == null) { return; }
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
			DateTime dateTime2 = dateTime.AddSeconds((double)Group.CreateTime);
			Response.Init(Outgoing.GroupDataMessageComposer);
			Response.AppendUInt(Group.Id);
			Response.AppendBoolean(true);
			Response.AppendUInt(Group.State);
			Response.AppendString(Group.Name);
			Response.AppendString(Group.Description);
			Response.AppendString(Group.Badge);
			Response.AppendUInt(Group.RoomId);
			Response.AppendString((CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name);
			Response.AppendInt32((Group.CreatorId == Session.GetHabbo().Id) ? 3 : (Group.Requests.Contains(Session.GetHabbo().Id) ? 2 : (Group.Members.ContainsKey(Session.GetHabbo().Id) ? 1 : 0)));
			Response.AppendInt32(Group.Members.Count);
			Response.AppendBoolean(Session.GetHabbo().FavouriteGroup == Group.Id);
			Response.AppendString(string.Concat(new object[]
			{
				dateTime2.Day,
				"-",
				dateTime2.Month,
				"-",
				dateTime2.Year
			}));
			Response.AppendBoolean(Group.CreatorId == Session.GetHabbo().Id);
			Response.AppendBoolean(Group.Admins.ContainsKey(Session.GetHabbo().Id));
			Response.AppendString((CyberEnvironment.getHabboForId(Group.CreatorId) == null) ? "" : CyberEnvironment.getHabboForId(Group.CreatorId).Username);
			Response.AppendBoolean(NewWindow);
			Response.AppendBoolean(Group.AdminOnlyDeco == 0u);
			Response.AppendInt32(Group.Requests.Count);
			Response.AppendBoolean(Group.HasForum);
			if (Room != null)
			{
				Room.SendMessage(Response);
				return;
			}
			if (Session != null)
			{
				Session.SendMessage(Response);
			}
		}
Esempio n. 14
0
        internal void AddExperience(int Amount)
        {
            checked
            {
                int oldExperienceGoal = this.experienceGoal;
                this.Experience += Amount;
                if (this.Experience >= 51900)
                {
                    return;
                }
                if (this.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    this.DBState = DatabaseUpdateState.NeedsUpdate;
                }
                if (this.Room != null)
                {
                    ServerMessage serverMessage = new ServerMessage(Outgoing.AddPetExperienceMessageComposer);
                    serverMessage.AppendUInt(this.PetId);
                    serverMessage.AppendInt32(this.VirtualId);
                    serverMessage.AppendInt32(Amount);
                    this.Room.SendMessage(serverMessage);

                    if (this.Experience >= oldExperienceGoal)
                    {
                        GameClients.GameClient OwnerSession = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId);

                        // Reset pet commands
                        PetCommands.Clear();
                        PetCommands = PetCommandHandler.GetPetCommands(this);

                        if (OwnerSession != null)
                        {
                            ServerMessage LevelNotify = new ServerMessage(Outgoing.NotifyNewPetLevelMessageComposer);
                            this.SerializeInventory(LevelNotify, true);
                            OwnerSession.SendMessage(LevelNotify);

                            ServerMessage TP = new ServerMessage();
                            TP.Init(Outgoing.PetTrainerPanelMessageComposer);
                            TP.AppendUInt(this.PetId);

                            List<short> AvailableCommands = new List<short>();

                            TP.AppendInt32(PetCommands.Count);
                            foreach (short Sh in PetCommands.Keys)
                            {
                                TP.AppendInt32(Sh);
                                if (PetCommands[Sh] == true)
                                {
                                    AvailableCommands.Add(Sh);
                                }
                            }

                            TP.AppendInt32(AvailableCommands.Count);
                            foreach (short Sh in AvailableCommands)
                            {
                                TP.AppendInt32(Sh);
                            }
                            OwnerSession.SendMessage(TP);
                        }

                    }
                }
            }
        }
		internal void GetPromotionableRooms()
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.CatalogPromotionGetRoomsMessageComposer);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendInt32(this.Session.GetHabbo().UsersRooms.Count);
			foreach (RoomData current in this.Session.GetHabbo().UsersRooms)
			{
				serverMessage.AppendUInt(current.Id);
				serverMessage.AppendString(current.Name);
				serverMessage.AppendBoolean(false);
			}
			this.Response = serverMessage;
			this.SendResponse();
		}
Esempio n. 16
0
		public bool OnCycle()
		{
			long num = CyberEnvironment.Now();
			if (this.Room == null || this.Room.GetRoomItemHandler() == null || this.Room.GetRoomItemHandler().mFloorItems == null)
			{
				return false;
			}
			if (this.mNext < num)
			{
				foreach (RoomItem current in this.mItems)
				{
					if (current != null && this.Room.GetRoomItemHandler().mFloorItems.ContainsKey(current.Id))
					{
						Point left = this.HandleMovement(this.mDir, new Point(current.GetX, current.GetY));
						int num2 = this.HandleRotation(this.mRot, current.Rot);
						if (this.mRoom.GetGameMap().CanRollItemHere(left.X, left.Y) && !this.mRoom.GetGameMap().SquareHasUsers(left.X, left.Y))
						{
							double num3 = 0.0;
							bool flag = true;
							List<RoomItem> roomItemForSquare = this.mRoom.GetGameMap().GetRoomItemForSquare(left.X, left.Y);
							foreach (RoomItem current2 in roomItemForSquare)
							{
								if (current2 != null)
								{
									if (current2.TotalHeight > num3)
									{
										num3 = current.TotalHeight;
									}
									if (flag && !current2.GetBaseItem().Stackable)
									{
										flag = false;
									}
								}
							}
							if (num2 != current.Rot)
							{
								current.Rot = num2;
								ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
								current.Serialize(message);
								this.mRoom.SendMessage(message);
							}
							if (flag && left != current.Coordinate)
							{
								ServerMessage serverMessage = new ServerMessage();
								serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
								serverMessage.AppendInt32(current.GetX);
								serverMessage.AppendInt32(current.GetY);
								serverMessage.AppendInt32(left.X);
								serverMessage.AppendInt32(left.Y);
								serverMessage.AppendInt32(1);
								serverMessage.AppendUInt(current.Id);
								serverMessage.AppendString(TextHandling.GetString(current.GetZ));
								serverMessage.AppendString(TextHandling.GetString(num3));
								serverMessage.AppendInt32(0);
								this.mRoom.SendMessage(serverMessage);
								this.mRoom.GetRoomItemHandler().SetFloorItem(current, left.X, left.Y, num3);
							}
						}
					}
				}
				this.mNext = 0L;
				return true;
			}
			return false;
		}
		internal void GetRoomFilter()
		{
			uint roomID = this.Request.PopWiredUInt();
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(roomID);
			if (room == null || !room.CheckRights(this.Session, true, false))
			{
				return;
			}
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.RoomLoadFilterMessageComposer);
			serverMessage.AppendInt32(room.WordFilter.Count);
			foreach (string current in room.WordFilter)
			{
				serverMessage.AppendString(current);
			}
			this.Response = serverMessage;
			this.SendResponse();
		}
Esempio n. 18
0
		internal void SerializeMessengerAction(int Type, string Name)
		{
			if (this.GetClient() == null)
			{
				return;
			}
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.ConsoleMessengerActionMessageComposer);
			serverMessage.AppendString(this.GetClient().GetHabbo().Id.ToString());
			serverMessage.AppendInt32(Type);
			serverMessage.AppendString(Name);
			foreach (MessengerBuddy current in this.friends.Values)
			{
				if (current.client != null)
				{
					current.client.SendMessage(serverMessage);
				}
			}
		}
		internal void ChooseTVPlaylist()
		{
			uint num = this.Request.PopWiredUInt();
			string playlist = this.Request.PopFixedString();
			
			RoomItem item = this.Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(num);

			if (item.GetBaseItem().InteractionType == InteractionType.youtubetv)
			{
				if (!CyberEnvironment.GetGame().GetVideoManager().PlaylistExists(playlist))
				{
					return;
				}
                PlayerTV playerTV = CyberEnvironment.GetGame().GetVideoManager().AddOrGetTV(num, this.Session.GetHabbo().CurrentRoomId);

				playerTV.SetPlaylist(CyberEnvironment.GetGame().GetVideoManager().GetPlaylist(playlist));
				ServerMessage serverMessage = new ServerMessage();
				serverMessage.Init(Outgoing.YouTubeLoadVideoMessageComposer);
				serverMessage.AppendUInt(num);
				serverMessage.AppendString(playerTV.CurrentVideo);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(playerTV.Playlist.GetDuration(playerTV.CurrentVideo));
				this.Response = serverMessage;
				this.SendResponse();
				item.ExtraData = playerTV.CurrentVideo;
				ServerMessage serverMessage2 = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
				item.Serialize(serverMessage2);
				this.Response = serverMessage2;
				this.SendResponse();
				this.Session.GetHabbo().CurrentRoom.SendMessage(serverMessage2);
			}
		}
Esempio n. 20
0
		internal ServerMessage SerializeBadge(string Badge)
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.ReceiveBadgeMessageComposer);
			serverMessage.AppendInt32(1);
			serverMessage.AppendString(Badge);
			return serverMessage;
		}
		internal void GetTVPlayer()
		{
			uint num = this.Request.PopWiredUInt();
            PlayerTV playerTV = CyberEnvironment.GetGame().GetVideoManager().AddOrGetTV(num, this.Session.GetHabbo().CurrentRoomId);
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.YouTubeLoadVideoMessageComposer);
			serverMessage.AppendUInt(num);
			serverMessage.AppendString(playerTV.CurrentVideo);
			serverMessage.AppendInt32(0);
			serverMessage.AppendInt32((playerTV.Playlist == null) ? 0 : playerTV.Playlist.GetDuration(playerTV.CurrentVideo));
			this.Response = serverMessage;
			this.SendResponse();
			ServerMessage serverMessage2 = new ServerMessage();
			serverMessage2.Init(Outgoing.YouTubeLoadPlaylistsMessageComposer);
			serverMessage2.AppendUInt(num);
			serverMessage2.AppendInt32(CyberEnvironment.GetGame().GetVideoManager().GetPlaylists().Count);
			foreach (Playlist current in CyberEnvironment.GetGame().GetVideoManager().GetPlaylists().Values)
			{
				current.Serialize(serverMessage2);
			}
			serverMessage2.AppendString("");
			this.Response = serverMessage2;
			this.SendResponse();
		}
Esempio n. 22
0
		internal ServerMessage SerializeBadgeReward(bool Success)
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.WiredRewardAlertMessageComposer);
			serverMessage.AppendInt32(Success ? 7 : 1);
			return serverMessage;
		}
Esempio n. 23
0
		internal void SerializeEventInfo(uint RoomId)
		{
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);
			if (room == null)
			{
				return;
			}
			RoomEvent @event = this.GetEvent(RoomId);
			if (@event != null && [email protected])
			{
				if (!this.RoomHasEvents(RoomId))
				{
					return;
				}
				ServerMessage serverMessage = new ServerMessage();
				serverMessage.Init(Outgoing.RoomEventMessageComposer);
				serverMessage.AppendUInt(RoomId);
				serverMessage.AppendInt32(room.OwnerId);
				serverMessage.AppendString(room.Owner);
				serverMessage.AppendInt32(1);
				serverMessage.AppendInt32(1);
				serverMessage.AppendString(@event.Name);
				serverMessage.AppendString(@event.Description);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(checked((int)Math.Floor((double)(@event.Time - CyberEnvironment.GetUnixTimestamp()) / 60.0)));
				room.SendMessage(serverMessage);
			}
		}
Esempio n. 24
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Session == null)
			{
				return;
			}
			RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (roomUserByHabbo == null)
			{
				return;
			}
			checked
			{
				if (Math.Abs(roomUserByHabbo.X - Item.GetX) < 2 && Math.Abs(roomUserByHabbo.Y - Item.GetY) < 2)
				{
                    roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY), false);
					Room room = Item.GetRoom();
					Point point = new Point(0, 0);
					if (roomUserByHabbo.RotBody == 4)
					{
						point = new Point(Item.GetX, Item.GetY + 1);
					}
					else
					{
						if (roomUserByHabbo.RotBody == 0)
						{
							point = new Point(Item.GetX, Item.GetY - 1);
						}
						else
						{
							if (roomUserByHabbo.RotBody == 6)
							{
								point = new Point(Item.GetX - 1, Item.GetY);
							}
							else
							{
								if (roomUserByHabbo.RotBody != 2)
								{
									return;
								}
								point = new Point(Item.GetX + 1, Item.GetY);
							}
						}
					}
					if (room.GetGameMap().validTile(point.X, point.Y))
					{
						double num = Item.GetRoom().GetGameMap().SqAbsoluteHeight(point.X, point.Y);
						ServerMessage serverMessage = new ServerMessage();
						serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
						serverMessage.AppendInt32(Item.GetX);
						serverMessage.AppendInt32(Item.GetY);
						serverMessage.AppendInt32(point.X);
						serverMessage.AppendInt32(point.Y);
						serverMessage.AppendInt32(1);
						serverMessage.AppendUInt(Item.Id);
						serverMessage.AppendString(Item.GetZ.ToString(CyberEnvironment.cultureInfo));
						serverMessage.AppendString(num.ToString(CyberEnvironment.cultureInfo));
						serverMessage.AppendInt32(0);
						room.SendMessage(serverMessage);
						Item.GetRoom().GetRoomItemHandler().SetFloorItem(roomUserByHabbo.GetClient(), Item, point.X, point.Y, Item.Rot, false, false, false);
						return;
					}
				}
				else
				{
					roomUserByHabbo.MoveTo(Item.GetX + 1, Item.GetY);
				}
			}
		}
Esempio n. 25
0
 internal void MovePuck(RoomItem item, GameClient mover, int newX, int newY, Team team)
 {
     if (!this.room.GetGameMap().itemCanBePlacedHere(newX, newY))
         return;
     Point coordinate1 = item.Coordinate;
     double k = (double)this.room.GetGameMap().Model.SqFloorHeight[newX, newY];
     if (coordinate1.X == newX && coordinate1.Y == newY)
         return;
     item.ExtraData = ((int)team).ToString();
     item.UpdateNeeded = true;
     item.UpdateState();
     ServerMessage serverMessage1 = new ServerMessage();
     serverMessage1.Init(Outgoing.ItemAnimationMessageComposer);
     ServerMessage serverMessage2 = serverMessage1;
     Point coordinate2 = item.Coordinate;
     int x = coordinate2.X;
     serverMessage2.AppendInt32(x);
     ServerMessage serverMessage3 = serverMessage1;
     coordinate2 = item.Coordinate;
     int y = coordinate2.Y;
     serverMessage3.AppendInt32(y);
     serverMessage1.AppendInt32(newX);
     serverMessage1.AppendInt32(newY);
     serverMessage1.AppendInt32(1);
     serverMessage1.AppendUInt(item.Id);
     serverMessage1.AppendString(TextHandling.GetString(item.GetZ));
     serverMessage1.AppendString(TextHandling.GetString(k));
     serverMessage1.AppendInt32(1);
     this.room.SendMessage(serverMessage1);
     this.room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false);
     if (mover == null || mover.GetHabbo() == null)
         return;
     RoomUser roomUserByHabbo = mover.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id);
     if (!this.banzaiStarted)
         return;
     this.HandleBanzaiTiles(new Point(newX, newY), team, roomUserByHabbo);
 }
Esempio n. 26
0
		internal void SerializeRoomData(ServerMessage Response, bool FromView, GameClient Session, bool SendRoom = false)
		{
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
			if (room == null || !room.CheckRights(Session, true, false))
			{
				return;
			}
			Response.Init(Outgoing.RoomDataMessageComposer);
			Response.AppendBoolean(true);
			Response.AppendUInt(this.Id);
			Response.AppendString(this.Name);
			Response.AppendBoolean(this.Type == "private");
			Response.AppendInt32(this.OwnerId);
			Response.AppendString(this.Owner);
			Response.AppendInt32(this.State);
			Response.AppendInt32(this.UsersNow);
			Response.AppendInt32(this.UsersMax);
			Response.AppendString(this.Description);
			Response.AppendInt32(this.TradeState);
			Response.AppendInt32(this.Score);
			Response.AppendInt32(0);
            Response.AppendInt32(0);
			Response.AppendInt32(this.Category);
			if (this.GroupId > 0u)
			{
				Response.AppendUInt(this.Group.Id);
				Response.AppendString(this.Group.Name);
				Response.AppendString(this.Group.Badge);
				Response.AppendString("");
			}
			else
			{
				Response.AppendInt32(0);
				Response.AppendString("");
				Response.AppendString("");
				Response.AppendString("");
			}
			Response.AppendInt32(this.TagCount);
			string[] array = this.Tags.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				string s = array[i];
				Response.AppendString(s);
			}
			Response.AppendInt32(0);
			Response.AppendInt32(0);
			Response.AppendInt32(0);
			Response.AppendBoolean(this.AllowPets == 1);
			Response.AppendBoolean(this.AllowPetsEating == 1);
			Response.AppendString("");
			Response.AppendString("");
			Response.AppendInt32(0);
			Response.AppendBoolean(FromView);
			Response.AppendBoolean(CyberEnvironment.GetGame().GetNavigator().RoomIsPublicItem(this.Id));
			Response.AppendBoolean(false);
			Response.AppendBoolean(false);
			Response.AppendInt32(this.WhoCanMute);
			Response.AppendInt32(this.WhoCanKick);
			Response.AppendInt32(this.WhoCanBan);
			Response.AppendBoolean(room.CheckRights(Session, true, false));
			Response.AppendInt32(this.ChatType);
			Response.AppendInt32(this.ChatBalloon);
			Response.AppendInt32(this.ChatSpeed);
			Response.AppendInt32(this.ChatMaxDistance);
			Response.AppendInt32(this.ChatFloodProtection);
			if (SendRoom)
			{
				if (CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Id) != null)
				{
					CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Id).SendMessage(Response);
					return;
				}
			}
			else
			{
				Session.SendMessage(Response);
			}
		}
Esempio n. 27
0
		internal void SendNewItems(uint Id)
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.NewInventoryObjectMessageComposer);
			serverMessage.AppendInt32(1);
			serverMessage.AppendInt32(1);
			serverMessage.AppendInt32(1);
			serverMessage.AppendUInt(Id);
			this.mClient.SendMessage(serverMessage);
		}
		internal void LoadClubGifts()
		{
			if (this.Session == null || this.Session.GetHabbo() == null)
			{
				return;
			}
			int i = 0;
			int i2 = 0;
			this.Session.GetHabbo().GetSubscriptionManager().GetSubscription();
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.LoadCatalogClubGiftsMessageComposer);
			serverMessage.AppendInt32(i);
			serverMessage.AppendInt32(i2);
			serverMessage.AppendInt32(1);
		}
Esempio n. 29
0
		internal static ServerMessage SerializeRoomChatlog(uint roomID)
		{
            // NEW CHATLOGS [March 2014] Coded by Finn
            // Please don't remove credits, this took me some time to do... :(
            // Credits to Itachi for the structure's "context" enigma :D

			ServerMessage Message = new ServerMessage();
            RoomData Room = CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
			if (Room == null)
			{
                throw new NullReferenceException("No room found.");
			}

			Message.Init(Outgoing.ModerationToolRoomChatlogMessageComposer);
			Message.AppendByte(1);
			Message.AppendShort(2);
			Message.AppendString("roomName");
			Message.AppendByte(2);
			Message.AppendString(Room.Name);
			Message.AppendString("roomId");
			Message.AppendByte(1);
			Message.AppendUInt(Room.Id);


            var TempChatlogs = Room.RoomChat.Reverse().Take(60);
            Message.AppendShort(TempChatlogs.Count());
            foreach (Chatlog current in TempChatlogs)
			{
				Habbo Habbo = CyberEnvironment.getHabboForId(current.UserId);
				DateTime Date = CyberEnvironment.UnixToDateTime(current.Timestamp);
                if (Habbo == null)
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendUInt(current.UserId);
                    Message.AppendString("*User not found*");
                    Message.AppendString(current.Message);
                    Message.AppendBoolean(true);
                }
                else
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendUInt(Habbo.Id);
                    Message.AppendString(Habbo.Username);
                    Message.AppendString(current.Message);
                    Message.AppendBoolean(false); // Text is bold
                }
			}
            TempChatlogs = null;

            return Message;
		}
Esempio n. 30
0
		internal ServerMessage UpdateItemOnRoller(RoomItem pItem, Point NextCoord, uint pRolledID, double NextZ)
		{
			ServerMessage serverMessage = new ServerMessage();
			serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
			serverMessage.AppendInt32(pItem.GetX);
			serverMessage.AppendInt32(pItem.GetY);
			serverMessage.AppendInt32(NextCoord.X);
			serverMessage.AppendInt32(NextCoord.Y);
			serverMessage.AppendInt32(1);
			serverMessage.AppendUInt(pItem.Id);
			serverMessage.AppendString(TextHandling.GetString(pItem.GetZ));
			serverMessage.AppendString(TextHandling.GetString(NextZ));
			serverMessage.AppendUInt(pRolledID);
			this.SetFloorItem(pItem, NextCoord.X, NextCoord.Y, NextZ);
			return serverMessage;
		}