Example #1
0
        private static void HandleTriggerSave(IWiredTrigger handler, WiredHandler manager, Room room, uint itemID)
        {
            RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
            if (item == null)
                return;

            item.wiredHandler = handler;
            manager.RemoveFurniture(item); //Removes it from le manager just in case there is annything registered allready
            manager.AddFurniture(item);

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                handler.SaveToDatabase(dbClient);
            }
        }
Example #2
0
 internal WiredHandler GetWiredHandler()
 {
     if (wiredHandler == null)
         wiredHandler = new WiredHandler(this);
     return wiredHandler;
 }
Example #3
0
        private static void HandleItemLoad(IWiredTrigger handler, WiredHandler wiredHandler, RoomItem item)
        {
            if (item.wiredHandler != null)
                item.wiredHandler.Dispose();

            item.wiredHandler = handler;
        }
Example #4
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 = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Pici.Storage.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)");
                }
            }

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