예제 #1
0
        /// <summary>
        /// Sell water available on a particular parcel
        /// </summary>
        /// <param name="sellerId"></param>
        /// <param name="buyerId"></param>
        /// <param name="amount"></param>
        /// <param name="price"></param>
        public void SellWater(UUID sellerId, UUID buyerId, int amount, int price)
        {
            Player buyer  = GetPlayer(buyerId);
            Player seller = GetPlayer(sellerId);

            if (m_controller.AttachedToVe)
            {
                if (amount > seller.Water)
                {
                    // A messy abstraction breaking hack to alert the player that they can't go ahead.
                    m_controller.HudManager.m_playerIdToHud[seller.Uuid].m_statusButton.SendAlert(
                        seller.Uuid,
                        string.Format(
                            "Can't sell {0} to {1} since you only have {2}",
                            WaterWarsUtils.GetWaterUnitsText(amount), buyer.Name,
                            WaterWarsUtils.GetWaterUnitsText(seller.Water)));
                }
                else
                {
                    new AskWaterBuyerInteraction(
                        m_controller,
                        m_controller.HudManager.m_playerIdToHud[seller.Uuid],
                        m_controller.HudManager.m_playerIdToHud[buyer.Uuid],
                        amount,
                        price);
                }
            }
            else
            {
                m_controller.State.SellWater(seller, buyer, amount, price);
            }
        }
예제 #2
0
        /// <summary>
        /// Request water from other players
        /// </summary>
        /// <param name="requesterId"></param>
        /// <param name="amount"></param>
        public void RequestWater(UUID requesterId, int amount)
        {
            Player requester = GetPlayer(requesterId);

            m_log.InfoFormat(
                "[WATER WARS]: Starting process of player {0} requesting {1} water",
                requester.Name, amount);

            m_controller.Events.PostToAll(
                string.Format("{0} would like to lease {1}",
                              requester.Name, WaterWarsUtils.GetWaterUnitsText(amount)),
                EventLevel.Alert);
        }