Beispiel #1
0
        internal void FillNull(UInt32 pId)
        {
            this.Id               = pId;
            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.WallThickness    = 0;
            this.FloorThickness   = 0;
            //this.Event = null;
            this.AllowRightsOverride = false;
            this.myIcon = new RoomIcon(1, 1, new Dictionary <int, int>());

            mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, pId);
        }
Beispiel #2
0
        internal 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 = new List <string>();
            foreach (string tag in Room.Tags.ToArray())
            {
                this.Tags.Add(tag);
            }
            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;
            this.FloorThickness   = Room.FloorThickness;
            this.WallThickness    = Room.WallThickness;

            mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id);
        }
Beispiel #3
0
        internal void DeadFill(DataRow Row)
        {
            this.Id = Convert.ToUInt32(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"];

            if (!string.IsNullOrEmpty(Row["active_users"].ToString()))
                this.UsersNow = (int)Row["active_users"];
            else
                this.UsersNow = 0;
            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 = ButterflyEnvironment.EnumToBool(Row["allow_pets"].ToString());
            this.AllowPetsEating = ButterflyEnvironment.EnumToBool(Row["allow_pets_eat"].ToString());
            this.AllowWalkthrough = ButterflyEnvironment.EnumToBool(Row["allow_walkthrough"].ToString());
            this.AllowRightsOverride = ButterflyEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString());
            this.Hidewall = ButterflyEnvironment.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.Landscape = (string)Row["landscape"];
            this.FloorThickness = (int)Row["floorthickness"];
            //this.Event = null;

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

            if (!string.IsNullOrEmpty(Row["icon_items"].ToString()))
            {
                foreach (string Bit in Row["icon_items"].ToString().Split('|'))
                {
                    if (string.IsNullOrEmpty(Bit))
                        continue;

                    string[] tBit = Bit.Replace('.', ',').Split(',');

                    int a = 0;
                    int b = 0;

                    if (tBit.Length > 1)
                        int.TryParse(tBit[1], out b);
                    else
                        int.TryParse(tBit[0], out a);

                    try
                    {
                        if (!IconItems.ContainsKey(a))
                            IconItems.Add(a, b);
                    }
                    catch (Exception e)
                    {
                        Logging.LogException("Exception: " + e.ToString() + "[" + Bit + "]");
                    }
                }
            }

            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);
            }
        }
Beispiel #4
0
        internal void FillNull(UInt32 pId)
        {
            this.Id = pId;
            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.WallThickness = 0;
            this.FloorThickness = 0;
            //this.Event = null;
            this.AllowRightsOverride = false;
            this.myIcon = new RoomIcon(1, 1, new Dictionary<int, int>());

            mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, pId);
        }
Beispiel #5
0
        internal 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 = new List<string>();
            foreach (string tag in Room.Tags.ToArray())
                this.Tags.Add(tag);
            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;
            this.FloorThickness = Room.FloorThickness;
            this.WallThickness = Room.WallThickness;

            mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id);
        }
Beispiel #6
0
        internal void DeadFill(DataRow Row)
        {
            this.Id          = Convert.ToUInt32(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"];

            if (!string.IsNullOrEmpty(Row["active_users"].ToString()))
            {
                this.UsersNow = (int)Row["active_users"];
            }
            else
            {
                this.UsersNow = 0;
            }
            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           = ButterflyEnvironment.EnumToBool(Row["allow_pets"].ToString());
            this.AllowPetsEating     = ButterflyEnvironment.EnumToBool(Row["allow_pets_eat"].ToString());
            this.AllowWalkthrough    = ButterflyEnvironment.EnumToBool(Row["allow_walkthrough"].ToString());
            this.AllowRightsOverride = ButterflyEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString());
            this.Hidewall            = ButterflyEnvironment.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.Landscape           = (string)Row["landscape"];
            this.FloorThickness      = (int)Row["floorthickness"];
            //this.Event = null;

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

            if (!string.IsNullOrEmpty(Row["icon_items"].ToString()))
            {
                foreach (string Bit in Row["icon_items"].ToString().Split('|'))
                {
                    if (string.IsNullOrEmpty(Bit))
                    {
                        continue;
                    }

                    string[] tBit = Bit.Replace('.', ',').Split(',');

                    int a = 0;
                    int b = 0;


                    if (tBit.Length > 1)
                    {
                        int.TryParse(tBit[1], out b);
                    }
                    else
                    {
                        int.TryParse(tBit[0], out a);
                    }

                    try
                    {
                        if (!IconItems.ContainsKey(a))
                        {
                            IconItems.Add(a, b);
                        }
                    }
                    catch (Exception e)
                    {
                        Logging.LogException("Exception: " + e.ToString() + "[" + Bit + "]");
                    }
                }
            }

            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);
            }
        }
Beispiel #7
0
        private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category,
                                int State, int UsersMax, string ModelName, string CCTs, int Score, List <string> pTags, bool AllowPets,
                                bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor,
                                string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness)
        {
            this.mDisposed   = false;
            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;

            tagCount  = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets        = AllowPets;
            this.AllowPetsEating  = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall         = Hidewall;


            this.myIcon             = Icon;
            this.Password           = Password;
            this.Bans               = new Dictionary <UInt32, double>();
            this.Wallpaper          = Wallpaper;
            this.Floor              = Floor;
            this.Landscape          = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.groups             = new QueuedDictionary <int, Group>();
            this.ActiveTrades       = new ArrayList();


            this.mCycleEnded = false;

            this.mRoomData         = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages     = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages       = new Queue();
            this.roomAlerts         = new Queue();
            this.roomBadge          = new Queue();
            this.roomKick           = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime           = 0;
            this.RoomMuted          = false;
            this.WallThickness      = walltickness;
            this.FloorThickness     = floorthickness;

            this.gamemap          = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager  = new RoomUserManager(this);
            this.wiredHandler     = new WiredHandler(this);

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                {
                    dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
                }
                else
                {
                    dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " +
                                          "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " +
                                          "ELSE " +
                                          "INSERT INTO room_active VALUES (" + Id + ",1)");
                }
            }

            ButterflyEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }