Exemple #1
0
        public override bool Interact(GamePlayer player)
        {
            if (!base.Interact(player))
            {
                return(false);
            }

            House house = HouseMgr.GetHouseByPlayer(player);

            if (house != null)
            {
                //the player might be targeting a lot he already purchased that has no house on it yet
                if (house.HouseNumber != DatabaseItem.HouseNumber && player.Client.Account.PrivLevel != (int)ePrivLevel.Admin)
                {
                    ChatUtil.SendSystemMessage(player, "You already own a house!");
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(DatabaseItem.OwnerID))
            {
                player.Out.SendCustomDialog("Do you want to buy this lot?\r\n It costs " + Money.GetString(HouseTemplateMgr.GetLotPrice(DatabaseItem)) + "!", BuyLot);
            }
            else
            {
                if (HouseMgr.IsOwner(DatabaseItem, player))
                {
                    player.Out.SendMerchantWindow(HouseTemplateMgr.GetLotMarkerItems(this), eMerchantWindowType.Normal);
                }
                else
                {
                    ChatUtil.SendSystemMessage(player, "You do not own this lot!");
                }
            }

            return(true);
        }
Exemple #2
0
        public override bool ReceiveItem(GameLiving source, InventoryItem item)
        {
            if (source == null || item == null)
            {
                return(false);
            }

            if (!(source is GamePlayer))
            {
                return(false);
            }

            var player = (GamePlayer)source;

            if (HouseMgr.IsOwner(DatabaseItem, player))
            {
                switch (item.Id_nb)
                {
                case "housing_alb_cottage_deed":
                    CreateHouse(player, 1);
                    break;

                case "housing_alb_house_deed":
                    CreateHouse(player, 2);
                    break;

                case "housing_alb_villa_deed":
                    CreateHouse(player, 3);
                    break;

                case "housing_alb_mansion_deed":
                    CreateHouse(player, 4);
                    break;

                case "housing_mid_cottage_deed":
                    CreateHouse(player, 5);
                    break;

                case "housing_mid_house_deed":
                    CreateHouse(player, 6);
                    break;

                case "housing_mid_villa_deed":
                    CreateHouse(player, 7);
                    break;

                case "housing_mid_mansion_deed":
                    CreateHouse(player, 8);
                    break;

                case "housing_hib_cottage_deed":
                    CreateHouse(player, 9);
                    break;

                case "housing_hib_house_deed":
                    CreateHouse(player, 10);
                    break;

                case "housing_hib_villa_deed":
                    CreateHouse(player, 11);
                    break;

                case "housing_hib_mansion_deed":
                    CreateHouse(player, 12);
                    break;

                default:
                    return(false);
                }

                player.Inventory.RemoveItem(item);

                // Tolakram:  Is this always null when purchasing a house?
                InventoryLogging.LogInventoryAction(player, "(HOUSE;" + (CurrentHouse == null ? DatabaseItem.HouseNumber : CurrentHouse.HouseNumber) + ")", eInventoryActionType.Other, item.Template, item.Count);

                return(true);
            }

            ChatUtil.SendSystemMessage(player, "You do not own this lot!");

            return(false);
        }