示例#1
0
        public void Fill(DataRow Row)
        {
            this.Id = (uint)Row["id"];
            this.Name = (string)Row["caption"];
            this.Description = (string)Row["description"];
            this.Type = (string)Row["roomtype"];
            this.Owner = (string)Row["owner"];

            switch (Row["state"].ToString().ToLower())
            {
                case "open":

                    this.State = 0;
                    break;

                case "password":

                    this.State = 2;
                    break;

                case "locked":
                default:

                    this.State = 1;
                    break;
            }

            this.Category = (int)Row["category"];
            this.UsersNow = (int)Row["users_now"];
            this.UsersMax = (int)Row["users_max"];
            this.ModelName = (string)Row["model_name"];
            this.CCTs = (string)Row["public_ccts"];
            this.Score = (int)Row["score"];
            this.Tags = new List<string>();
            this.AllowPets = UberEnvironment.EnumToBool(Row["allow_pets"].ToString());
            this.AllowPetsEating = UberEnvironment.EnumToBool(Row["allow_pets_eat"].ToString());
            this.AllowWalkthrough = UberEnvironment.EnumToBool(Row["allow_walkthrough"].ToString());
            this.Hidewall = UberEnvironment.EnumToBool(Row["allow_hidewall"].ToString());
            this.Password = (string)Row["password"];
            this.Wallpaper = (string)Row["wallpaper"];
            this.Floor = (string)Row["floor"];
            this.Landscape = (string)Row["landscape"];
            this.Event = null;

            Dictionary<int, int> IconItems = new Dictionary<int, int>();

            if (Row["icon_items"].ToString() != "")
            {
                foreach (string Bit in Row["icon_items"].ToString().Split('|'))
                {
                    IconItems.Add(int.Parse(Bit.Split(',')[0]), int.Parse(Bit.Split(',')[1]));
                }
            }

            this.myIcon = new RoomIcon((int)Row["icon_bg"], (int)Row["icon_fg"], IconItems);

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                this.Tags.Add(Tag);
            }
        }
示例#2
0
 public void FillNull(uint Id)
 {
     this.Id = Id;
     this.Name = "Unknown Room";
     this.Description = "-";
     this.Type = "private";
     this.Owner = "-";
     this.Category = 0;
     this.UsersNow = 0;
     this.UsersMax = 0;
     this.ModelName = "NO_MODEL";
     this.CCTs = "";
     this.Score = 0;
     this.Tags = new List<string>();
     this.AllowPets = true;
     this.AllowPetsEating = false;
     this.AllowWalkthrough = true;
     this.Hidewall = false;
     this.Password = "";
     this.Wallpaper = "0.0";
     this.Floor = "0.0";
     this.Landscape = "0.0";
     this.Event = null;
     this.myIcon = new RoomIcon(1, 1, new Dictionary<int, int>());
 }
示例#3
0
        public void RemoveUserFromRoom(GameClient Session, Boolean NotifyClient, Boolean NotifyKick)
        {
            /*
            ServerMessage SendReminder = new ServerMessage(7);
            SendReminder.AppendString("");
            SendMessage(SendReminder);
            */

            try
            {
                if (Session == null)
                {
                    return;
                }

                RoomUser User = GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (!UserList.Remove(GetRoomUserByHabbo(Session.GetHabbo().Id)))
                {
                    return;
                }

                if (NotifyClient)
                {
                    if (NotifyKick)
                    {
                        ServerPacket packet = new ServerPacket(33);
                        packet.AppendInt32(4008);
                        Session.SendPacket(packet);
                    }

                    Session.SendPacket(new ServerPacket(18));
                }

                List<RoomUser> PetsToRemove = new List<RoomUser>();

                if (!User.IsSpectator)
                {
                    if (User != null)
                    {
                        UserMatrix[User.X, User.Y] = false;

                        ServerPacket LeaveMessage = new ServerPacket(29);
                        LeaveMessage.AppendRawInt32(User.VirtualId);
                        SendMessage(LeaveMessage);
                    }

                    if (Session.GetHabbo() != null)
                    {
                        if (HasActiveTrade(Session.GetHabbo().Id))
                        {
                            TryStopTrade(Session.GetHabbo().Id);
                        }

                        if (Session.GetHabbo().Username.ToLower() == Owner.ToLower())
                        {
                            if (HasOngoingEvent)
                            {
                                Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                                if (Room == null || Room.Event == null)
                                {
                                    return;
                                }

                                Event = null;

                                ServerPacket Message = new ServerPacket(370);
                                Message.AppendStringWithBreak("-1");
                                SendMessage(Message);
                            }
                        }

                        Session.GetHabbo().OnLeaveRoom();
                    }
                }

                if (!User.IsSpectator)
                {
                    UpdateUserCount();

                    List<RoomUser> Bots = new List<RoomUser>();

                    foreach (RoomUser Usr in UserList)
                    {
                        if (!Usr.IsBot)
                        {
                            continue;
                        }

                        Bots.Add(Usr);
                    }

                    foreach (RoomUser Bot in Bots)
                    {
                        Bot.BotAI.OnUserLeaveRoom(Session);

                        if (Bot.IsPet && Bot.PetData.OwnerId == Session.GetHabbo().Id && !CheckRights(Session, true))
                        {
                            PetsToRemove.Add(Bot);
                        }
                    }
                }

                foreach (RoomUser toRemove in PetsToRemove)
                {
                    Session.GetHabbo().GetInventoryComponent().AddPet(toRemove.PetData);
                    RemoveBot(toRemove.VirtualId, false);
                }
            }
            catch { UberEnvironment.GetLogging().WriteLine("error in removeruserfromroom", Core.LogLevel.Error); }
        }
示例#4
0
 public void Fill(Room Room)
 {
     this.Id = Room.RoomId;
     this.Name = Room.Name;
     this.Description = Room.Description;
     this.Type = Room.Type;
     this.Owner = Room.Owner;
     this.Category = Room.Category;
     this.State = Room.State;
     this.UsersNow = Room.UsersNow;
     this.UsersMax = Room.UsersMax;
     this.ModelName = Room.ModelName;
     this.CCTs = Room.CCTs;
     this.Score = Room.Score;
     this.Tags = Room.Tags;
     this.AllowPets = Room.AllowPets;
     this.AllowPetsEating = Room.AllowPetsEating;
     this.AllowWalkthrough = Room.AllowWalkthrough;
     this.Hidewall = Room.Hidewall;
     this.myIcon = Room.Icon;
     this.Password = Room.Password;
     this.Event = Room.Event;
     this.Wallpaper = Room.Wallpaper;
     this.Floor = Room.Floor;
     this.Landscape = Room.Landscape;
 }
示例#5
0
        public Room(uint Id, string Name, string Description, string Type, string Owner, int Category,
            int State, int UsersMax, string ModelName, string CCTs, int Score, List<string> Tags, bool AllowPets,
            bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor,
            string Landscape)
        {
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.CCTs = CCTs;
            this.Score = Score;
            this.Tags = Tags;
            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;
            this.UserCounter = 0;
            this.UserList = new List<RoomUser>();
            this.myIcon = Icon;
            this.Password = Password;
            this.Bans = new Dictionary<uint, double>();
            this.Event = null;
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.Items = new List<RoomItem>();
            this.ActiveTrades = new List<Trade>();
            this.UserMatrix = new bool[Model.MapSizeX, Model.MapSizeY];

            this.IdleTime = 0;

            this.KeepAlive = true;

            this.HasWaterEffect = new List<uint>();
            this.HasThread = new Dictionary<uint, Thread>();
            this.BallThread = new Dictionary<uint, Thread>();

            LoadRights();
            LoadFurniture();

            GenerateMaps();
        }