Exemplo n.º 1
0
 public void Dispose()
 {
     disposed = true;
     this.handler.GetRoom().GetGameManager().OnGameEnd -= delegateFunction;
     this.item = null;
     this.handler = null;
 }
Exemplo n.º 2
0
 public void Dispose()
 {
     handler.GetRoom().GetGameManager().OnScoreChanged -= scoreChangedDelegate;
     handler.GetRoom().GetGameManager().OnGameEnd -= gameEndDeletgate;
     this.item = null;
     this.handler = null;
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     isDisposed = true;
     room = null;
     item = null;
     handler = null;
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     handler.GetRoom().OnUserSays -= delegateFunction;
     item = null;
     handler = null;
     triggerMessage = null;
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     gameManager.OnGameStart -= delegateFunction;
     gameManager = null;
     delegateFunction = null;
     handler = null;
 }
Exemplo n.º 6
0
 public void Dispose()
 {
     handler = null;
     userName = null;
     if (item != null && item.GetRoom() != null)
         item.GetRoom().GetRoomUserManager().OnUserEnter -= delegateFunction;
     item = null;
 }
Exemplo n.º 7
0
        public GameEnds(RoomItem item, WiredHandler handler, GameManager gameManager)
        {
            this.item = item;
            this.handler = handler;
            this.gameEndsDeletgate = new RoomEventDelegate(gameManager_OnGameEnd);

            gameManager.OnGameEnd += gameEndsDeletgate;
        }
Exemplo n.º 8
0
 public TriggerUserIsOnFurni(RoomItem item, List<RoomItem> items, WiredHandler handler)
 {
     this.item = item;
     this.items = items;
     this.isDisposed = false;
     this.handler = handler;
     AttatchListenersToItems();
 }
Exemplo n.º 9
0
 public Collision(RoomItem item, WiredHandler handler, Room room)
 {
     Item = item;
     Room = room;
     OtherString = string.Empty;
     OtherBool = false;
     _handler = handler;
 }
Exemplo n.º 10
0
 public LessThanTimer(int timeout, Room room, RoomItem item, WiredHandler handler)
 {
     this.timeout = timeout;
     this.room = room;
     this.isDisposed = false;
     this.item = item;
     this.handler = handler;
 }
Exemplo n.º 11
0
 public void Dispose()
 {
     isDisposed = true;
     room = null;
     handler = null;
     if (items != null)
         items.Clear();
     items = null;
 }
Exemplo n.º 12
0
 public FurniHasFurni(RoomItem item, List<RoomItem> items, WiredHandler handler, bool allItems)
 {
     this.item = item;
     this.items = items;
     this.isDisposed = false;
     this.handler = handler;
     this.allItems = allItems;
     AttatchListenersToItems();
 }
Exemplo n.º 13
0
        public Repeater(WiredHandler handler, RoomItem item, int cyclesRequired)
        {
            this.handler = handler;
            this.cyclesRequired = cyclesRequired;
            this.item = item;

            handler.RequestCycle(this);
            this.disposed = false;
        }
Exemplo n.º 14
0
 public void Dispose()
 {
     disposed = true;
     gamemap = null;
     handler = null;
     if (items != null)
         items.Clear();
     delayedTriggeringUsers.Clear();
 }
Exemplo n.º 15
0
 public TimerReset(Room room, WiredHandler handler, List<RoomItem> items, int delay, uint itemID)
 {
     this.room = room;
     this.handler = handler;
     this.items = items;
     this.delay = delay;
     this.cycles = 0;
     this.disposed = false;
 }
Exemplo n.º 16
0
        public UserSays(RoomItem item, WiredHandler handler, bool isOwnerOnly, string triggerMessage, Room room)
        {
            this.item = item;
            this.handler = handler;
            this.isOwnerOnly = isOwnerOnly;
            this.triggerMessage = triggerMessage;
            this.delegateFunction = new RoomUserSaysDelegate(roomUserManager_OnUserSays);

            room.OnUserSays += delegateFunction;
        }
Exemplo n.º 17
0
 public ToggleItemState(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, uint itemID)
 {
     this.gamemap = gamemap;
     this.handler = handler;
     this.items = items;
     this.delay = delay;
     this.cycles = 0;
     this.delayedTriggeringUsers = new Queue();
     this.disposed = false;
 }
Exemplo n.º 18
0
        public EntersRoom(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager, bool isOneUser, string userName)
        {
            this.item = item;
            this.handler = handler;
            this.isOneUser = isOneUser;
            this.userName = userName;
            this.delegateFunction = new RoomEventDelegate(roomUserManager_OnUserEnter);

            roomUserManager.OnUserEnter += delegateFunction;
        }
Exemplo n.º 19
0
 public PositionReset(List<RoomItem> items, int delay, RoomItemHandling roomItemHandler, WiredHandler handler, uint itemID)
 {
     this.items = items;
     this.delay = delay;
     this.roomItemHandler = roomItemHandler;
     this.cycles = 0;
     this.itemID = itemID;
     this.handler = handler;
     this.disposed = false;
 }
Exemplo n.º 20
0
 public void Dispose()
 {
     isDisposed = true;
     item = null;
     handler = null;
     DetatchFromListeners();
     if (items != null)
         items.Clear();
     items = null;
 }
Exemplo n.º 21
0
        public Timer(RoomItem item, WiredHandler handler, int cycleCount, GameManager gameManager)
        {
            this.item = item;
            this.handler = handler;
            this.requiredCycles = cycleCount;
            this.currentCycle = 0;
            this.delegateFunction = new RoomEventDelegate(gameManager_OnGameEnd);

            gameManager.OnGameEnd += delegateFunction;
            this.disposed = false;
        }
Exemplo n.º 22
0
 public TimerReset(Room room, WiredHandler handler, List<RoomItem> items, int delay, RoomItem item)
 {
     this.room = room;
     this.handler = handler;
     this.items = items;
     this.delay = delay;
     this.cycles = 0;
     this.disposed = false;
     this.item = item;
     AttatchListenersToItems();
 }
Exemplo n.º 23
0
 public void Dispose()
 {
     disposed = true;
     gamemap = null;
     handler = null;
     if (items != null)
         items.Clear();
     items = null;
     if (delayedUsers != null)
         delayedUsers.Clear();
 }
Exemplo n.º 24
0
 public TeleportToItem(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, uint itemID)
 {
     this.gamemap = gamemap;
     this.handler = handler;
     this.items = items;
     this.delay = delay;
     this.itemID = itemID;
     this.cycles = 0;
     this.delayedUsers = new Queue();
     this.rnd = new Random();
     this.disposed = false;
 }
Exemplo n.º 25
0
        public GiveScore(int maxCountPerGame, int scoreToGive, GameManager gameManager, RoomItem item, WiredHandler handler)
        {
            this.maxCountPerGame = maxCountPerGame;
            this.currentGameCount = 0;
            this.scoreToGive = scoreToGive;
            this.delegateFunction = new RoomEventDelegate(gameManager_OnGameStart);
            this.gameManager = gameManager;
            this.item = item;
            this.handler = handler;

            gameManager.OnGameStart += delegateFunction;
        }
Exemplo n.º 26
0
        public ScoreAchieved(RoomItem item, WiredHandler handler, int scoreLevel, GameManager gameManager)
        {
            this.item = item;
            this.handler = handler;
            this.scoreLevel = scoreLevel;
            this.used = false;
            this.scoreChangedDelegate = new TeamScoreChangedDelegate(gameManager_OnScoreChanged);
            this.gameEndDeletgate = new RoomEventDelegate(gameManager_OnGameEnd);

            gameManager.OnScoreChanged += scoreChangedDelegate;
            gameManager.OnGameEnd += gameEndDeletgate;
        }
Exemplo n.º 27
0
 public MoveRotate(MovementState movement, RotationState rotation, List<RoomItem> items, int delay, Room room, WiredHandler handler, uint itemID)
 {
     this.movement = movement;
     this.rotation = rotation;
     this.items = items;
     this.delay = delay;
     this.room = room;
     this.handler = handler;
     this.cycles = 0;
     this.itemID = itemID;
     this.isDisposed = false;
 }
Exemplo n.º 28
0
 public TeleportToItem(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, RoomItem item)
 {
     this.gamemap = gamemap;
     this.handler = handler;
     this.items = items;
     this.delay = delay;
     this.item = item;
     this.cycles = 0;
     this.delayedUsers = new Queue();
     this.rnd = new Random();
     this.disposed = false;
     AttatchListenersToItems();
 }
Exemplo n.º 29
0
 public void Dispose()
 {
     disposed = true;
     if (items != null)
     {
         foreach (RoomItem targetItem in items)
         {
             targetItem.OnUserWalksOnFurni -= delegateFunction;
         }
         items.Clear();
     }
     items = null;
     this.item = null;
     this.handler = null;
 }
Exemplo n.º 30
0
        public void Dispose()
        {
            disposed = true;
            handler = null;

            if (items != null)
            {
                foreach (RoomItem _item in items)
                {
                    _item.itemTriggerEventHandler -= delegateFunction;
                }

                items.Clear();
            }
            items = null;
        }
Exemplo n.º 31
0
        public bool OnCycle()
        {
            var num = Plus.Now();

            if (_mNext >= num)
            {
                return(false);
            }
            var conditions = Room.GetWiredHandler().GetConditions(this);
            var effects    = Room.GetWiredHandler().GetEffects(this);

            if (conditions.Any())
            {
                foreach (var current in conditions)
                {
                    if (!current.Execute(null))
                    {
                        return(false);
                    }
                    WiredHandler.OnEvent(current);
                }
            }
            if (effects.Any())
            {
                foreach (var current2 in effects)
                {
                    if (current2.Execute(null, Type))
                    {
                        WiredHandler.OnEvent(current2);
                    }
                }
            }
            _mNext = (Plus.Now() + (Delay));

            return(false);
        }
Exemplo n.º 32
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];

            if (roomUser == null)
            {
                return(false);
            }

            List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this);
            List <IWiredItem> effects    = Room.GetWiredHandler().GetEffects(this);

            if (conditions.Any())
            {
                foreach (IWiredItem current in conditions)
                {
                    if (!current.Execute(roomUser))
                    {
                        return(false);
                    }

                    WiredHandler.OnEvent(current);
                }
            }

            if (effects.Any())
            {
                foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(roomUser, Type)))
                {
                    WiredHandler.OnEvent(current2);
                }
            }

            WiredHandler.OnEvent(this);
            return(true);
        }
Exemplo n.º 33
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];

            if (!string.IsNullOrEmpty(OtherString) && roomUser.GetUserName() != OtherString && !roomUser.GetClient().GetHabbo().IsTeleporting)
            {
                return(false);
            }

            List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this);
            List <IWiredItem> effects    = Room.GetWiredHandler().GetEffects(this);

            if (conditions.Any())
            {
                foreach (IWiredItem current in conditions)
                {
                    if (!current.Execute(roomUser))
                    {
                        return(false);
                    }

                    WiredHandler.OnEvent(current);
                }
            }

            if (effects.Any())
            {
                foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(roomUser, Type)))
                {
                    WiredHandler.OnEvent(current2);
                }
            }

            WiredHandler.OnEvent(this);
            return(true);
        }
Exemplo n.º 34
0
 public void Dispose()
 {
     this.handler.GetRoom().OnUserCls -= this.delegateFunction;
     this.item    = (Item)null;
     this.handler = (WiredHandler)null;
 }
Exemplo n.º 35
0
        internal bool SetFloorItem(GameClient Session, RoomItem Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses)
        {
            bool NeedsReAdd = false;

            if (!newItem)
            {
                NeedsReAdd = room.GetGameMap().RemoveFromMap(Item);
            }
            Dictionary <int, ThreeDCoord> AffectedTiles = GameMap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);

            if (!room.GetGameMap().ValidTile(newX, newY) || room.GetGameMap().SquareHasUsers(newX, newY) && !Item.GetBaseItem().IsSeat)
            {
                if (NeedsReAdd)
                {
                    AddItem(Item);
                    room.GetGameMap().AddToMap(Item);
                }
                return(false);
            }

            foreach (ThreeDCoord Tile in AffectedTiles.Values)
            {
                if (!room.GetGameMap().ValidTile(Tile.X, Tile.Y) || (room.GetGameMap().SquareHasUsers(Tile.X, Tile.Y) && !Item.GetBaseItem().IsSeat))
                {
                    if (NeedsReAdd)
                    {
                        AddItem(Item);
                        room.GetGameMap().AddToMap(Item);
                    }
                    return(false);
                }
            }

            // Start calculating new Z coordinate
            Double newZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];

            if (!OnRoller)
            {
                // Is the item trying to stack on itself!?
                //if (Item.Rot == newRot && Item.GetX == newX && Item.GetY == newY && Item.GetZ != newZ)
                //{
                //    if (NeedsReAdd)
                //        AddItem(Item);
                //    return false;
                //}

                // Make sure this tile is open and there are no users here
                if (room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
                {
                    if (NeedsReAdd)
                    {
                        AddItem(Item);
                        room.GetGameMap().AddToMap(Item);
                    }
                    return(false);
                }

                foreach (ThreeDCoord Tile in AffectedTiles.Values)
                {
                    if (room.GetGameMap().Model.SqState[Tile.X, Tile.Y] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
                    {
                        if (NeedsReAdd)
                        {
                            AddItem(Item);
                            room.GetGameMap().AddToMap(Item);
                        }
                        return(false);
                    }
                }

                // And that we have no users
                if (!Item.GetBaseItem().IsSeat&& !Item.IsRoller)
                {
                    foreach (ThreeDCoord Tile in AffectedTiles.Values)
                    {
                        if (room.GetGameMap().GetRoomUnits(new Point(Tile.X, Tile.Y)).Count > 0)
                        {
                            if (NeedsReAdd)
                            {
                                AddItem(Item);
                                room.GetGameMap().AddToMap(Item);
                            }
                            return(false);
                        }
                    }
                }
            }

            // Find affected objects
            List <RoomItem> ItemsOnTile   = GetFurniObjects(newX, newY);
            List <RoomItem> ItemsAffected = new List <RoomItem>();
            List <RoomItem> ItemsComplete = new List <RoomItem>();

            foreach (ThreeDCoord Tile in AffectedTiles.Values)
            {
                List <RoomItem> Temp = GetFurniObjects(Tile.X, Tile.Y);

                if (Temp != null)
                {
                    ItemsAffected.AddRange(Temp);
                }
            }


            ItemsComplete.AddRange(ItemsOnTile);
            ItemsComplete.AddRange(ItemsAffected);

            if (!OnRoller)
            {
                // Check for items in the stack that do not allow stacking on top of them
                foreach (RoomItem I in ItemsComplete)
                {
                    if (I == null)
                    {
                        continue;
                    }

                    if (I.Id == Item.Id)
                    {
                        continue;
                    }

                    if (I.GetBaseItem() == null)
                    {
                        continue;
                    }

                    if (!I.GetBaseItem().Stackable)
                    {
                        if (NeedsReAdd)
                        {
                            AddItem(Item);
                            room.GetGameMap().AddToMap(Item);
                        }
                        return(false);
                    }
                }
            }

            //if (!Item.IsRoller)
            {
                // If this is a rotating action, maintain item at current height
                if (Item.Rot != newRot && Item.GetX == newX && Item.GetY == newY)
                {
                    newZ = Item.GetZ;
                }

                // Are there any higher objects in the stack!?
                foreach (RoomItem I in ItemsComplete)
                {
                    if (I.Id == Item.Id)
                    {
                        continue; // cannot stack on self
                    }

                    if (I.TotalHeight > newZ)
                    {
                        newZ = I.TotalHeight;
                    }
                }
            }

            // Verify the rotation is correct
            //if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8)
            //{
            //    newRot = 0;
            //}

            //Item.GetX = newX;
            //Item.GetY = newY;
            //Item.GetZ = newZ;


            Item.Rot = newRot;
            int oldX = Item.GetX;
            int oldY = Item.GetY;

            Item.SetState(newX, newY, newZ, AffectedTiles);

            if (!OnRoller && Session != null)
            {
                Item.Interactor.OnPlace(Session, Item);
            }


            if (newItem)
            {
                if (mFloorItems.ContainsKey(Item.Id))
                {
                    if (Session != null)
                    {
                        Session.SendNotif(LanguageLocale.GetValue("room.itemplaced"));
                    }

                    //Remove from map!!!
                    return(true);
                }

                /*else if (mFloorItems.ContainsKey(Item.Id) && Item.MagicRemove)
                 * {
                 *  RemoveFurniture(Session, Item.Id);
                 *  if (mFloorItems.ContainsKey(Item.Id))
                 *  {
                 *      Logging.WriteLine("lul?");
                 *      mFloorItems.Remove(Item.Id);
                 *  }
                 * }*/

                //using (DatabaseClient dbClient = FirewindEnvironment.GetDatabase().GetClient())
                //{
                //    dbClient.addParameter("extra_data", ((StringData)Item.data).Data);
                //    dbClient.runFastQuery("INSERT INTO room_items (id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('" + Item.Id + "','" + RoomId + "','" + Item.BaseItem + "',@extra_data,'" + Item.GetX + "','" + Item.GetY + "','" + Item.GetZ + "','" + Item.Rot + "','')");
                //}
                //if (mRemovedItems.ContainsKey(Item.Id))
                //    mRemovedItems.Remove(Item.Id);
                //if (mAddedItems.ContainsKey(Item.Id))
                //    return false;

                //mAddedItems.Add(Item.Id, Item);

                if (Item.IsFloorItem && !mFloorItems.ContainsKey(Item.Id))
                {
                    mFloorItems.Add(Item.Id, Item);
                }
                else if (Item.IsWallItem && !mWallItems.ContainsKey(Item.Id))
                {
                    mWallItems.Add(Item.Id, Item);
                }

                AddItem(Item);

                if (sendMessage)
                {
                    ServerMessage Message = new ServerMessage(Outgoing.ObjectAdd);
                    Item.Serialize(Message, room.OwnerId);
                    Message.AppendString(room.Owner);
                    room.SendMessage(Message);
                }
            }
            else
            {
                //using (DatabaseClient dbClient = FirewindEnvironment.GetDatabase().GetClient())
                //{
                //    dbClient.runFastQuery("UPDATE room_items SET x = '" + Item.GetX + "', y = '" + Item.GetY + "', z = '" + Item.GetZ + "', rot = '" + Item.Rot + "', wall_pos = '' WHERE id = '" + Item.Id + "' LIMIT 1");
                //}
                UpdateItem(Item);

                if (!OnRoller && sendMessage)
                {
                    ServerMessage Message = new ServerMessage(Outgoing.ObjectUpdate);
                    Item.Serialize(Message, room.OwnerId);
                    //Message.AppendString(room.Owner);
                    room.SendMessage(Message);
                }
            }

            if (!newItem)
            {
                room.GetWiredHandler().RemoveWiredItem(new System.Drawing.Point(oldX, oldY));

                if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
                {
                    room.GetWiredHandler().AddWire(Item, new System.Drawing.Point(newX, newY), newRot, Item.GetBaseItem().InteractionType);
                }
            }
            else
            {
                if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
                {
                    room.GetWiredHandler().AddWire(Item, Item.Coordinate, newRot, Item.GetBaseItem().InteractionType);
                }
            }

            //GenerateMaps(false);
            room.GetGameMap().AddToMap(Item);

            if (Item.GetBaseItem().IsSeat)
            {
                updateRoomUserStatuses = true;
            }

            if (updateRoomUserStatuses)
            {
                room.GetRoomUserManager().UpdateUserStatuses();
            }

            return(true);
        }
Exemplo n.º 36
0
 public DiamantesCustom(string message, WiredHandler handler, RoomItem itemID)
 {
     this.itemID = itemID;
     this.handler = handler;
     this.message = message;
 }
Exemplo n.º 37
0
        private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category,
                                int State, int UsersMax, string ModelName, int Score, List <string> pTags, bool AllowPets,
                                bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor,
                                string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.OwnerId     = OwnerId;
            this.Category    = Category;
            this.State       = State;
            this.UsersNow    = 0;
            this.UsersMax    = UsersMax;
            this.ModelName   = ModelName;
            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.Password           = Password;
            this.Bans               = new Dictionary <UInt32, double>();
            this.Wallpaper          = Wallpaper;
            this.Floor              = Floor;
            this.Landscape          = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            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);

            this.Group = group;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
            }

            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
Exemplo n.º 38
0
 public void Dispose()
 {
     this.handler.GetRoom().GetGameManager().OnGameEnd -= this.gameEndsDeletgate;
     this.item    = (Item)null;
     this.handler = (WiredHandler)null;
 }
Exemplo n.º 39
0
 public LeaveTeam(WiredHandler handler, RoomItem itemID)
 {
     this.itemID  = itemID;
     this.handler = handler;
 }
Exemplo n.º 40
0
        internal void LoadFurniture()
        {
            //this.Items.Clear();
            this.mFloorItems.Clear();
            this.mWallItems.Clear();
            DataTable Data;

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Pici.Storage.Database.DatabaseType.MySQL)
                {
                    dbClient.setQuery("CALL getroomitems(@roomid)");
                    dbClient.addParameter("roomid", room.RoomId);
                }
                else
                {
                    dbClient.setQuery("EXECUTE getroomitems " + room.RoomId);
                }

                Data = dbClient.getTable();


                uint           itemID;
                decimal        x;
                decimal        y;
                sbyte          n;
                uint           baseID;
                string         extradata;
                WallCoordinate wallCoord;
                foreach (DataRow dRow in Data.Rows)
                {
                    itemID = Convert.ToUInt32(dRow[0]);
                    x      = Convert.ToDecimal(dRow[1]);
                    y      = Convert.ToDecimal(dRow[2]);
                    n      = Convert.ToSByte(dRow[3]);
                    baseID = Convert.ToUInt32(dRow[4]);
                    if (DBNull.Value.Equals(dRow[5]))
                    {
                        extradata = string.Empty;
                    }
                    else
                    {
                        extradata = (string)dRow[5];
                    }

                    if (n > 6) // Is wallitem
                    {
                        wallCoord = new WallCoordinate((double)x, (double)y, n);
                        RoomItem item = new RoomItem(itemID, room.RoomId, baseID, extradata, wallCoord, room);

                        if (!mWallItems.ContainsKey(itemID))
                        {
                            mWallItems.Inner.Add(itemID, item);
                        }
                    }
                    else //Is flooritem
                    {
                        int coordX, coordY;
                        TextHandling.Split((double)x, out coordX, out coordY);

                        RoomItem item = new RoomItem(itemID, room.RoomId, baseID, extradata, coordX, coordY, (double)y, n, room);
                        if (!mFloorItems.ContainsKey(itemID))
                        {
                            mFloorItems.Inner.Add(itemID, item);
                        }
                    }
                }

                foreach (RoomItem Item in mFloorItems.Values)
                {
                    if (Item.IsRoller)
                    {
                        mGotRollers = true;
                    }
                    else if (Item.GetBaseItem().InteractionType == Pici.HabboHotel.Items.InteractionType.dimmer)
                    {
                        if (room.MoodlightData == null)
                        {
                            room.MoodlightData = new MoodlightData(Item.Id);
                        }
                    }
                    else if (WiredUtillity.TypeIsWired(Item.GetBaseItem().InteractionType))
                    {
                        WiredLoader.LoadWiredItem(Item, room, dbClient);
                    }

                    if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
                    {
                        room.GetWiredHandler().AddWire(Item, Item.Coordinate, Item.Rot, Item.GetBaseItem().InteractionType);
                    }
                }
            }
        }
Exemplo n.º 41
0
        public PositionReset(List <RoomItem> items, int delay, string data, Dictionary <uint, OriginalItemLocation> originalItemlocation, RoomItemHandling roomItemHandler, WiredHandler handler, RoomItem itemID)
        {
            this.items = items;
            this.originalItemLocation = originalItemlocation;

            if (originalItemlocation.Count <= 0 && this.items.Count > 0)
            {
                foreach (RoomItem nItem in items)
                {
                    this.originalItemLocation.Add(nItem.Id, new OriginalItemLocation(nItem.Id, nItem.GetX, nItem.GetY, nItem.TotalHeight, nItem.Rot, nItem.ExtraData));
                }
            }

            this.delay           = delay;
            this.roomItemHandler = roomItemHandler;
            this.cycles          = 0;
            this.itemID          = itemID;
            this.handler         = handler;
            this.disposed        = false;

            if (data.Length > 0 && data.Contains(","))
            {
                this.FurniState     = int.Parse(data.Split(',')[0]);
                this.FurniDirection = int.Parse(data.Split(',')[1]);
                this.FurniPosition  = int.Parse(data.Split(',')[2]);
            }
        }
Exemplo n.º 42
0
 public void Dispose()
 {
     handler.GetRoom().GetGameManager().OnGameStart -= gameStartsDeletgate;
     this.item    = null;
     this.handler = null;
 }
Exemplo n.º 43
0
        private void Dispose()
        {
            if (!mDisposed)
            {
                try
                {
                    mDisposed   = true;
                    mCycleEnded = true;
                    OtanixEnvironment.GetGame().GetRoomManager().QueueActiveRoomRemove(mRoomData);

                    using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        GetRoomItemHandler().SaveFurniture(dbClient);
                        saveBots();
                    }

                    WorkRoomServerMessageThread();
                    WorkRoomChatServerMessageThread();

                    ClearMute();
                    UsersWithRights.Clear();
                    Bans.Clear();

                    foreach (var item in GetRoomItemHandler().mFloorItems.Values)
                    {
                        item.Destroy();
                    }

                    foreach (var item in GetRoomItemHandler().mWallItems.Values)
                    {
                        item.Destroy();
                    }

                    roomUserManager.Destroy();
                    roomUserManager = null;

                    chatMessageManager.Destroy();
                    chatMessageManager = null;

                    roomItemHandling.Destroy();
                    roomItemHandling = null;

                    if (GetGameManager() != null)
                    {
                        GetGameManager().Destroy();
                        games = null;
                    }

                    if (GotSoccer())
                    {
                        GetSoccer().Destroy();
                        soccer = null;
                    }

                    if (GotWired())
                    {
                        GetWiredHandler().Destroy();
                        wiredHandler = null;
                    }

                    if (GotMusicController())
                    {
                        GetRoomMusicController().Destroy();
                        musicController = null;
                    }

                    if (GetGameMap() != null)
                    {
                        GetGameMap().Destroy();
                        gamemap = null;
                    }
                }
                catch (Exception e)
                {
                    Logging.LogCriticalException("Unload of room " + e);
                }
            }
        }
Exemplo n.º 44
0
        private void Initialize(RoomData RoomData)
        {
            this.Id = RoomData.Id;

            this.mDisposed         = false;
            this.RoomMuted         = false;
            this.muteSignalEnabled = false;

            this.Bans               = new Dictionary <UInt32, double>();
            this.Mutes              = new Dictionary <UInt32, MuteUser>();
            this.FilterWords        = new List <string>();
            this.chatMessageManager = new ChatMessageManager();
            this.lastTimerReset     = DateTime.Now;
            this.IsRoomLoaded       = false;

            this.mCycleEnded     = false;
            this.HeightMapLoaded = false;

            this.mRoomData = RoomData;

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

            this.roomMessages           = new Queue();
            this.roomAlerts             = new Queue();
            this.roomBadge              = new Queue();
            this.roomDiamonds           = new Queue();
            this.roomCredits            = new Queue();
            this.roomPiruletas          = new Queue();
            this.roomKick               = new Queue();
            this.roomServerMessages     = new Queue();
            this.roomChatServerMessages = new Queue();

            this.groupAddQueue    = new Queue();
            this.groupRemoveQueue = new Queue();
            this.groupsOnRoom     = new Dictionary <uint, int>();

            this.roomUserFloorItems = new Dictionary <uint, uint>();
            this.roomUserWallItems  = new Dictionary <uint, uint>();

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

            this.roomPoll = new RoomQuestionary();
            if (!this.roomPoll.LoadQuestionary(this.Id))
            {
                this.roomPoll = null;
            }

            this.LoadFilterWords();
            this.LoadRights();
            this.GetRoomItemHandler().LoadFurniture();
            this.GetGameMap().GenerateMaps();
            this.GetRoomUserManager().OnUserUpdateStatus(); // Update Bots State.
            this.LoadMusic();

            if (this.RoomData.State != 3)
            {
                OtanixEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
            }
        }
Exemplo n.º 45
0
 public void Dispose()
 {
     room    = null;
     handler = null;
 }
Exemplo n.º 46
0
 public JoinToTeam(WiredHandler handler, RoomItem itemID, Team team)
 {
     this.itemID     = itemID;
     this.handler    = handler;
     this.staticTeam = team;
 }
Exemplo n.º 47
0
 public void Dispose()
 {
     this.isDisposed = true;
     this.room       = (Room)null;
     this.handler    = (WiredHandler)null;
 }
Exemplo n.º 48
0
 public BotGiveHanditem(string message, WiredHandler handler, int itemID)
 {
     this.itemID  = itemID;
     this.handler = handler;
     this.message = message;
 }
Exemplo n.º 49
0
 public ShowMessage(string message, WiredHandler handler, uint itemID)
 {
     this.itemID  = itemID;
     this.handler = handler;
     this.message = message;
 }
Exemplo n.º 50
0
 public void Dispose()
 {
     disposed = true;
     room     = null;
     handler  = null;
 }
Exemplo n.º 51
0
 public PositionReset(List <RoomItem> items, int delay, RoomItemHandling roomItemHandler, WiredHandler handler, uint itemID)
 {
     this.items           = items;
     this.delay           = delay;
     this.roomItemHandler = roomItemHandler;
     this.cycles          = 0;
     this.itemID          = itemID;
     this.handler         = handler;
     this.disposed        = false;
 }
Exemplo n.º 52
0
 public void Dispose()
 {
     handler.GetRoom().GetGameManager().OnGameEnd -= gameEndsDeletgate;
     item    = null;
     handler = null;
 }
Exemplo n.º 53
0
 public Repeater(WiredHandler handler, int cyclesRequired)
 {
     this.cyclesRequired = cyclesRequired;
 }
Exemplo n.º 54
0
 public void Dispose()
 {
     this.disposed = true;
     this.handler  = (WiredHandler)null;
 }
Exemplo n.º 55
0
 public void Dispose()
 {
     disposed = true;
     handler  = null;
     item     = null;
 }
Exemplo n.º 56
0
 public MoveRotate(MovementState movement, RotationState rotation, List <RoomItem> items, int delay, Room room, WiredHandler handler, RoomItem itemID)
 {
     this.movement   = movement;
     this.rotation   = rotation;
     this.items      = items;
     this.delay      = delay;
     this.room       = room;
     this.handler    = handler;
     this.cycles     = 0;
     this.item       = itemID;
     this.isDisposed = false;
 }
Exemplo n.º 57
0
        public PositionReset(List <Item> items, int delay, RoomItemHandling roomItemHandler, WiredHandler handler, int itemID, int etatActuel, int directionActuel, int positionActuel)
        {
            this.Delay           = delay;
            this.roomItemHandler = roomItemHandler;
            this.itemID          = itemID;
            this.handler         = handler;
            this.disposed        = false;

            this.EtatActuel      = etatActuel;
            this.DirectionActuel = directionActuel;
            this.PositionActuel  = positionActuel;

            this.items = new ConcurrentDictionary <int, ItemsPosReset>();

            foreach (Item roomItem in items)
            {
                if (!this.items.ContainsKey(roomItem.Id))
                {
                    this.items.TryAdd(roomItem.Id, new ItemsPosReset(roomItem, roomItem.GetX, roomItem.GetY, roomItem.GetZ, roomItem.Rotation, roomItem.ExtraData));
                }
                else
                {
                    ItemsPosReset RemoveItem = null;
                    this.items.TryRemove(roomItem.Id, out RemoveItem);
                    this.items.TryAdd(roomItem.Id, new ItemsPosReset(roomItem, roomItem.GetX, roomItem.GetY, roomItem.GetZ, roomItem.Rotation, roomItem.ExtraData));
                }
            }
        }