public byte[] AddClassified(OSDMap request)
        {
            Classified info = new Classified();

            info.FromOSD((OSDMap)request["Classified"]);

            ProfileConnector.AddClassified(info);

            string xmlString = OSDParser.SerializeJsonString(new OSDMap());
            //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString);
            UTF8Encoding encoding = new UTF8Encoding();

            return(encoding.GetBytes(xmlString));
        }
Exemplo n.º 2
0
        public void ClassifiedInfoUpdate(UUID queryClassifiedID, uint queryCategory, string queryName,
                                         string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos,
                                         byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            IScenePresence p = remoteClient.Scene.GetScenePresence(remoteClient.AgentId);

            if (p == null)
            {
                return; //Just fail
            }
            IScheduledMoneyModule scheduledMoneyModule = p.Scene.RequestModuleInterface <IScheduledMoneyModule> ();
            IMoneyModule          moneyModule          = p.Scene.RequestModuleInterface <IMoneyModule> ();
            Classified            classcheck           = ProfileFrontend.GetClassified(queryClassifiedID);

            if (((queryclassifiedFlags & 32) != 32) && moneyModule != null)
            {
                //Single week
                if (!moneyModule.Charge(remoteClient.AgentId, queryclassifiedPrice, "Add Classified", TransactionType.ClassifiedCharge))
                {
                    remoteClient.SendAlertMessage("You do not have enough money to create this classified.");
                    return;
                }
            }
            else if (scheduledMoneyModule != null)
            {
                //Auto-renew
                if (classcheck != null)
                {
                    scheduledMoneyModule.RemoveFromScheduledCharge("[Classified: " + queryClassifiedID + "]");
                }

                var payOK = scheduledMoneyModule.Charge(
                    remoteClient.AgentId,                                                       // who to charge
                    queryclassifiedPrice,                                                       // how much
                    "Add Reoccurring Classified (" + queryClassifiedID + ")",                   // description
                    TransactionType.ClassifiedCharge,                                           // transaction type
                    "[Classified: " + queryClassifiedID + "]",                                  // scheduler identifier
                    true,                                                                       // charger immediately
                    false);                                                                     // run once
                if (!payOK)
                {
                    remoteClient.SendAlertMessage("You do not have enough money to create this classified.");
                    return;
                }
            }

            UUID    creatorUUID     = remoteClient.AgentId;
            UUID    classifiedUUID  = queryClassifiedID;
            uint    category        = queryCategory;
            string  name            = queryName;
            string  description     = queryDescription;
            uint    parentestate    = queryParentEstate;
            UUID    snapshotUUID    = querySnapshotID;
            string  simname         = remoteClient.Scene.RegionInfo.RegionName;
            Vector3 globalpos       = queryGlobalPos;
            byte    classifiedFlags = queryclassifiedFlags;
            int     classifiedPrice = queryclassifiedPrice;

            UUID   parceluuid = p.CurrentParcelUUID;
            string parcelname = "Unknown";
            IParcelManagementModule parcelManagement = remoteClient.Scene.RequestModuleInterface <IParcelManagementModule> ();

            if (parcelManagement != null)
            {
                ILandObject parcel = parcelManagement.GetLandObject(p.AbsolutePosition.X, p.AbsolutePosition.Y);
                if (parcel != null)
                {
                    parcelname = parcel.LandData.Name;
                    parceluuid = parcel.LandData.GlobalID;
                }
            }

            uint creationdate = (uint)Util.UnixTimeSinceEpoch();

            uint expirationdate = (uint)Util.UnixTimeSinceEpoch() + (365 * 24 * 60 * 60);

            Classified classified = new Classified {
                ClassifiedUUID  = classifiedUUID,
                CreatorUUID     = creatorUUID,
                CreationDate    = creationdate,
                ExpirationDate  = expirationdate,
                Category        = category,
                Name            = name,
                Description     = description,
                ParcelUUID      = parceluuid,
                ParentEstate    = parentestate,
                SnapshotUUID    = snapshotUUID,
                SimName         = simname,
                GlobalPos       = globalpos,
                ParcelName      = parcelname,
                ClassifiedFlags = classifiedFlags,
                PriceForListing = classifiedPrice,
                ScopeID         = remoteClient.ScopeID
            };

            ProfileFrontend.AddClassified(classified);
        }
        public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName,
                                         string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos,
                                         byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            IScenePresence p = remoteClient.Scene.GetScenePresence(remoteClient.AgentId);

            if (p == null)
            {
                return; //Just fail
            }
            IMoneyModule money = p.Scene.RequestModuleInterface <IMoneyModule>();

            if (money != null)
            {
                Classified classcheck = ProfileFrontend.GetClassified(queryclassifiedID);
                if (classcheck == null)
                {
                    if (!money.Charge(remoteClient.AgentId, queryclassifiedPrice, "Add Classified"))
                    {
                        remoteClient.SendAlertMessage("You do not have enough money to create this classified.");
                        return;
                    }
                }
            }

            UUID    creatorUUID     = remoteClient.AgentId;
            UUID    classifiedUUID  = queryclassifiedID;
            uint    category        = queryCategory;
            string  name            = queryName;
            string  description     = queryDescription;
            uint    parentestate    = queryParentEstate;
            UUID    snapshotUUID    = querySnapshotID;
            string  simname         = remoteClient.Scene.RegionInfo.RegionName;
            Vector3 globalpos       = queryGlobalPos;
            byte    classifiedFlags = queryclassifiedFlags;
            int     classifiedPrice = queryclassifiedPrice;

            UUID   parceluuid = p.CurrentParcelUUID;
            string parcelname = "Unknown";
            IParcelManagementModule parcelManagement =
                remoteClient.Scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILandObject parcel = parcelManagement.GetLandObject(p.AbsolutePosition.X, p.AbsolutePosition.Y);
                if (parcel != null)
                {
                    parcelname = parcel.LandData.Name;
                    parceluuid = parcel.LandData.InfoUUID;
                }
            }

            uint creationdate = (uint)Util.UnixTimeSinceEpoch();

            uint expirationdate = (uint)Util.UnixTimeSinceEpoch() + (365 * 24 * 60 * 60);

            Classified classified = new Classified
            {
                ClassifiedUUID  = classifiedUUID,
                CreatorUUID     = creatorUUID,
                CreationDate    = creationdate,
                ExpirationDate  = expirationdate,
                Category        = category,
                Name            = name,
                Description     = description,
                ParcelUUID      = parceluuid,
                ParentEstate    = parentestate,
                SnapshotUUID    = snapshotUUID,
                SimName         = simname,
                GlobalPos       = globalpos,
                ParcelName      = parcelname,
                ClassifiedFlags = classifiedFlags,
                PriceForListing = classifiedPrice,
                ScopeID         = remoteClient.ScopeID
            };

            ProfileFrontend.AddClassified(classified);
        }