Example #1
0
        public bool OnCycle()
        {
            if (this.SetItems.Count == 0 || !Requested)
            {
                return(false);
            }

            long Now = RocketEmulador.Now();

            if (_next < Now)
            {
                foreach (Item Item in this.SetItems.Values.ToList())
                {
                    if (Item == null)
                    {
                        continue;
                    }

                    if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        Item n = null;
                        SetItems.TryRemove(Item.Id, out n);
                        continue;
                    }

                    Item.Interactor.OnWiredTrigger(Item);
                }

                Requested = false;

                this._next     = 0;
                this.TickCount = Delay;
            }
            return(true);
        }
Example #2
0
        public bool Execute(params object[] Params)
        {
            if (this._next == 0 || this._next < RocketEmulador.Now())
            {
                this._next = RocketEmulador.Now() + this.Delay;
            }


            this.Requested = true;
            this.TickCount = Delay;
            return(true);
        }
Example #3
0
        public bool Execute(params object[] Params)
        {
            if (this.SetItems.Count == 0)
            {
                return(false);
            }

            if (this._next == 0 || this._next < RocketEmulador.Now())
            {
                this._next = RocketEmulador.Now() + this.Delay;
            }

            if (!Requested)
            {
                this.TickCount = this.Delay;
                this.Requested = true;
            }
            return(true);
        }
Example #4
0
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = RocketEmulador.Now();

            if (_next < Now)
            {
                foreach (Item Item in this.SetItems.Values.ToList())
                {
                    if (Item == null)
                    {
                        continue;
                    }

                    if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        continue;
                    }

                    Item toRemove = null;

                    if (Instance.GetWired().OtherBoxHasItem(this, Item.Id))
                    {
                        this.SetItems.TryRemove(Item.Id, out toRemove);
                    }

                    Point Point = Instance.GetGameMap().GetChaseMovement(Item);

                    Instance.GetWired().onUserFurniCollision(Instance, Item);

                    if (!Instance.GetGameMap().ItemCanMove(Item, Point))
                    {
                        continue;
                    }

                    if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y))
                    {
                        Double  NewZ        = Item.GetZ;
                        Boolean CanBePlaced = true;

                        List <Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point);

                        foreach (Item IItem in Items.ToList())
                        {
                            if (IItem == null || IItem.Id == Item.Id)
                            {
                                continue;
                            }

                            if (!IItem.GetBaseItem().Walkable)
                            {
                                _next       = 0;
                                CanBePlaced = false;
                                break;
                            }

                            if (IItem.TotalHeight > NewZ)
                            {
                                NewZ = IItem.TotalHeight;
                            }

                            if (CanBePlaced == true && !IItem.GetBaseItem().Stackable)
                            {
                                CanBePlaced = false;
                            }
                        }

                        if (CanBePlaced && Point != Item.Coordinate)
                        {
                            Instance.SendMessage(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X,
                                                                               Point.Y, NewZ, 0, 0, Item.Id));
                            Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ);
                        }
                    }
                }

                _next = 0;
                return(true);
            }
            return(false);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom || Session.GetHabbo().Credits < RocketEmulador.GetGame().GetCameraManager().PurchaseCoinsPrice || Session.GetHabbo().Duckets < RocketEmulador.GetGame().GetCameraManager().PurchaseDucketsPrice)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null || User.LastPhotoPreview == null)
            {
                return;
            }

            CameraPhotoPreview preview = User.LastPhotoPreview;

            if (RocketEmulador.GetGame().GetCameraManager().PurchaseCoinsPrice > 0)
            {
                Session.GetHabbo().Credits -= RocketEmulador.GetGame().GetCameraManager().PurchaseCoinsPrice;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            if (RocketEmulador.GetGame().GetCameraManager().PurchaseDucketsPrice > 0)
            {
                Session.GetHabbo().Duckets -= RocketEmulador.GetGame().GetCameraManager().PurchaseDucketsPrice;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `camera_photos` SET `file_state` = 'purchased' WHERE `id` = '" + preview.Id + "' LIMIT 1");
                Console.WriteLine(@"Oinhe wulles fez isso aq");
            }

            Item photoPoster = ItemFactory.CreateSingleItemNullable(RocketEmulador.GetGame().GetCameraManager().PhotoPoster, Session.GetHabbo(),
                                                                    "{\"w\":\"" + StringCharFilter.EscapeJSONString(RocketEmulador.GetGame().GetCameraManager().GetPath(CameraPhotoType.PURCHASED, preview.Id, preview.CreatorId)) + "\", \"n\":\"" + StringCharFilter.EscapeJSONString(Session.GetHabbo().Username) + "\", \"s\":\"" + Session.GetHabbo().Id + "\", \"u\":\"" + preview.Id + "\", \"t\":\"" + (long)RocketEmulador.Now() + "\"}", "");

            if (photoPoster != null)
            {
                Session.GetHabbo().GetInventoryComponent().TryAddItem(photoPoster);

                Session.SendMessage(new FurniListAddComposer(photoPoster));
                Session.SendMessage(new FurniListUpdateComposer());
                Session.SendMessage(new FurniListNotificationComposer(photoPoster.Id, 1));
            }

            Session.SendMessage(new CameraPhotoPurchaseOkComposer());
        }