Exemple #1
0
        public void AuctionEnd(int localID)
        {
            IParcelManagementModule parcelManagement = m_scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject landObject = parcelManagement.GetLandObject(localID);
                if (landObject == null)
                {
                    return;
                }

                AuctionInfo info = GetAuctionInfo(localID);
                if (info == null)
                {
                    return; // cannot find this auction??
                }
                AuctionBid highestBid = new AuctionBid()
                {
                    Amount = 0
                };
                foreach (AuctionBid bid in info.AuctionBids)
                {
                    if (highestBid.Amount < bid.Amount)
                    {
                        highestBid = bid;
                    }
                }

                IOfflineMessagesConnector offlineMessages =
                    Framework.Utilities.DataManager.RequestPlugin <IOfflineMessagesConnector>();
                if (offlineMessages != null)
                {
                    offlineMessages.AddOfflineMessage(new GridInstantMessage()
                    {
                        BinaryBucket  = new byte[0],
                        Dialog        = (byte)InstantMessageDialog.MessageBox,
                        FromAgentID   = UUID.Zero,
                        FromAgentName = "System",
                        FromGroup     = false,
                        SessionID     = UUID.Random(),
                        Message       =
                            "You won the auction for the parcel " +
                            landObject.LandData.Name + ", paying " +
                            highestBid.Amount + " for it",
                        Offline        = 0,
                        ParentEstateID = 0,
                        Position       = Vector3.Zero,
                        RegionID       = m_scene.RegionInfo.RegionID,
                        Timestamp      = (uint)Util.UnixTimeSinceEpoch(),
                        ToAgentID      = highestBid.AuctionBidder
                    });
                }
                landObject.UpdateLandSold(highestBid.AuctionBidder, UUID.Zero, false, landObject.LandData.AuctionID,
                                          highestBid.Amount, landObject.LandData.Area);
            }
        }