Exemple #1
0
        private void BuyLot(GamePlayer player, byte response)
        {
            if (response != 0x01)
            {
                return;
            }

            lock (DatabaseItem)             // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
            {
                if (!string.IsNullOrEmpty(DatabaseItem.OwnerID))
                {
                    return;
                }

                if (HouseMgr.GetHouseNumberByPlayer(player) != 0 && player.Client.Account.PrivLevel != (int)ePrivLevel.Admin)
                {
                    ChatUtil.SendMerchantMessage(player, "You already own another lot or house (Number " + HouseMgr.GetHouseNumberByPlayer(player) + ").");
                    return;
                }

                long totalCost = HouseTemplateMgr.GetLotPrice(DatabaseItem);
                if (player.RemoveMoney(totalCost, "You just bought this lot for {0}.",
                                       eChatType.CT_Merchant, eChatLoc.CL_SystemWindow))
                {
                    InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, totalCost);
                    DatabaseItem.LastPaid = DateTime.Now;
                    DatabaseItem.OwnerID  = player.ObjectId;
                    CreateHouse(player, 0);
                }
                else
                {
                    ChatUtil.SendMerchantMessage(player, "You dont have enough money!");
                }
            }
        }
Exemple #2
0
        public override IList GetExamineMessages(GamePlayer player)
        {
            IList list = new ArrayList();

            list.Add("You target lot number " + DatabaseItem.HouseNumber + ".");

            if (string.IsNullOrEmpty(DatabaseItem.OwnerID))
            {
                list.Add(" It can be bought for " + Money.GetString(HouseTemplateMgr.GetLotPrice(DatabaseItem)) + ".");
            }
            else if (!string.IsNullOrEmpty(DatabaseItem.Name))
            {
                list.Add(" It is owned by " + DatabaseItem.Name + ".");
            }

            return(list);
        }
Exemple #3
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);
        }