Esempio n. 1
0
        public bool ConfirmCancel(GameClient Session, RentableSpaceItem RentableSpace)
        {
            if (Session == null)
            {
                return(false);
            }

            if (Session.GetHabbo() == null)
            {
                return(false);
            }

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

            if (!RentableSpace.IsRented())
            {
                return(false);
            }

            if (RentableSpace.OwnerId != Session.GetHabbo().Id)
            {
                return(false);
            }

            RentableSpace.OwnerId       = 0;
            RentableSpace.OwnerUsername = "";
            RentableSpace.ExpireStamp   = 0;

            using (IQueryAdapter con = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                con.SetQuery("UPDATE `items_rentablespace` SET owner = @owner, ownerusername = @username, expire = @expire WHERE item_id = @itemid LIMIT 1");
                con.AddParameter("itemid", RentableSpace.ItemId);
                con.AddParameter("owner", 0);
                con.AddParameter("username", "");
                con.AddParameter("expire", 0);
                con.RunQuery();
            }

            return(true);
        }
Esempio n. 2
0
        public int GetCancelErrorCode(GameClient Session, RentableSpaceItem RentableSpace)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return(400);
            }

            if (!RentableSpace.IsRented())
            {
                return(101);
            }

            if (RentableSpace.OwnerId != Session.GetHabbo().Id)
            {
                return(102);
            }

            return(0);
        }