Esempio n. 1
0
 public RentableSpaceData(FarmingSpace FarmingSpace, int ItemId)
 {
     this.OwnerId      = FarmingSpace.OwnerId;
     this.Enabled      = FarmingSpace.OwnerId == 0 ? false : true;
     this.ItemId       = ItemId;
     this.House        = null;
     this.FarmingSpace = FarmingSpace;
     this.TimeLeft     = FarmingSpace.Expiration;
 }
Esempio n. 2
0
 public RentableSpaceData(House House, int ItemId)
 {
     this.OwnerId      = House.OwnerId;
     this.Enabled      = !House.ForSale;
     this.ItemId       = ItemId;
     this.House        = House;
     this.FarmingSpace = null;
     this.TimeLeft     = (30 * 24 * 60 * 60);
 }
Esempio n. 3
0
        public RentableSpaceData(int Item)
        {
            ItemId = Item;
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `room_items_rentable_space` WHERE `item_id` = '" + ItemId + "' LIMIT 1");
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    dbClient.RunQuery("INSERT INTO `room_items_rentable_space` VALUES ('" + ItemId + "','0','0','0')");
                    dbClient.SetQuery("SELECT * FROM `room_items_rentable_space` WHERE `item_id` = '" + ItemId + "' LIMIT 1");
                    Row = dbClient.getRow();
                }

                this.OwnerId      = Convert.ToInt32(Row["owner_id"]);
                this.TimeLeft     = Convert.ToInt32(Row["time_left"]);
                this.Enabled      = PlusEnvironment.EnumToBool(Row["enabled"].ToString());
                this.House        = null;
                this.FarmingSpace = null;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Lets you place a furni in the desired location
        /// </summary>
        public static Item PlaceItemToRoom(GameClient Session, int BaseId, int GroupId, int X, int Y, double Z, int Rot, bool FromInventory, int roomid, bool ToDB = true, string ExtraData = "", bool IsFood = false, string deliverytype = "", House House = null, FarmingSpace FarmingSpace = null, TexasHoldEmItem TexasHoldEmData = null)
        {
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                Room Room    = GenerateRoom(roomid, false);
                int  ItDemId = 0;

                // Start at 1 bill to prevent item glitches
                int ItemId = 10000000;

                if (House != null)
                {
                    ItemId = PlusEnvironment.GetGame().GetHouseManager().SignMultiplier + House.RoomId;
                }
                else if (FarmingSpace != null)
                {
                    ItemId = FarmingManager.SignMultiplier + FarmingSpace.Id;
                }
                else if (ToDB)
                {
                    dbClient.SetQuery("INSERT INTO items (user_id,base_item,room_id) VALUES (1, " + BaseId + ", " + roomid + ")");
                    dbClient.RunQuery();
                    dbClient.SetQuery("SELECT id FROM items WHERE user_id = '1' AND room_id = '" + roomid + "' AND base_item = '" + BaseId + "' ORDER BY id DESC LIMIT 1");
                    ItDemId = dbClient.getInteger();
                    ItemId  = ItDemId;
                }
                else
                {
                    while (Room.GetRoomItemHandler().GetFloor.Where(x => x.Id == ItemId).ToList().Count > 0)
                    {
                        ItemId++;
                    }
                }

                Item NewItem = new Item(ItemId, Room.RoomId, BaseId, ExtraData, X, Y, Z, Rot, 0, GroupId, 0, 0, "", null, House, FarmingSpace, TexasHoldEmData);
                NewItem.DeliveryType = deliverytype;

                if (NewItem != null && NewItem.FarmingData != null && NewItem.GetBaseItem().InteractionType == InteractionType.FARMING && Session != null && Session.GetHabbo() != null)
                {
                    NewItem.FarmingData.OwnerId = Session.GetHabbo().Id;

                    new Thread(() =>
                    {
                        if (NewItem != null && NewItem.FarmingData != null)
                        {
                            NewItem.FarmingData.BeingFarmed = true;
                        }

                        Thread.Sleep(3000);

                        if (Session != null && NewItem != null && NewItem.FarmingData != null)
                        {
                            Session.SendWhisper("O/A " + NewItem.GetBaseItem().PublicName + " que você acabou de plantar está pronto para ser regado!", 1);
                            NewItem.FarmingData.BeingFarmed = false;
                        }
                    }).Start();
                }

                if (IsFood == true)
                {
                    if (Session != null)
                    {
                        NewItem.InteractingUser = Session.GetHabbo().Id;
                        Session = null;
                    }
                }

                if (NewItem != null)
                {
                    Room.GetRoomItemHandler().SetFloorItem(Session, NewItem, X, Y, Rot, true, false, true, false, false, null, Z, true);
                }

                return(NewItem);
            }
        }