private static ParcelInfo LoadParcel(XmlTextReader reader, GridVector regionSize, List <ParcelAccessEntry> whiteList, List <ParcelAccessEntry> blackList) { var pinfo = new ParcelInfo((int)regionSize.X / 4, (int)regionSize.Y / 4); for (;;) { if (!reader.Read()) { throw new OARFormatException(); } switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name != "LandData") { throw new OARFormatException(); } LoadParcelInner(reader, pinfo, whiteList, blackList); return(pinfo); default: break; } } }
void ISimulationDataParcelStorageInterface.Store(UUID regionID, ParcelInfo parcel) { var p = new Dictionary <string, object> { ["RegionID"] = regionID, ["ParcelID"] = parcel.ID, ["LocalID"] = parcel.LocalID, ["Bitmap"] = parcel.LandBitmap.Data, ["BitmapWidth"] = parcel.LandBitmap.BitmapWidth, ["BitmapHeight"] = parcel.LandBitmap.BitmapHeight, ["Name"] = parcel.Name, ["Description"] = parcel.Description, ["Owner"] = parcel.Owner, ["IsGroupOwned"] = parcel.GroupOwned, ["Area"] = parcel.Area, ["AuctionID"] = parcel.AuctionID, ["AuthBuyer"] = parcel.AuthBuyer, ["Category"] = parcel.Category, ["ClaimDate"] = parcel.ClaimDate.AsULong, ["ClaimPrice"] = parcel.ClaimPrice, ["Group"] = parcel.Group, ["Flags"] = parcel.Flags, ["LandingType"] = parcel.LandingType, ["LandingPosition"] = parcel.LandingPosition, ["LandingLookAt"] = parcel.LandingLookAt, ["Status"] = parcel.Status, ["MusicURI"] = parcel.MusicURI, ["MediaURI"] = parcel.MediaURI, ["MediaType"] = parcel.MediaType, ["MediaWidth"] = parcel.MediaWidth, ["MediaHeight"] = parcel.MediaHeight, ["MediaID"] = parcel.MediaID, ["SnapshotID"] = parcel.SnapshotID, ["SalePrice"] = parcel.SalePrice, ["OtherCleanTime"] = parcel.OtherCleanTime, ["MediaAutoScale"] = parcel.MediaAutoScale, ["MediaDescription"] = parcel.MediaDescription, ["MediaLoop"] = parcel.MediaLoop, ["ObscureMedia"] = parcel.ObscureMedia, ["ObscureMusic"] = parcel.ObscureMusic, ["RentPrice"] = parcel.RentPrice, ["AABBMin"] = parcel.AABBMin, ["AABBMax"] = parcel.AABBMax, ["ParcelPrimBonus"] = parcel.ParcelPrimBonus, ["PassPrice"] = parcel.PassPrice, ["PassHours"] = parcel.PassHours, ["ActualArea"] = parcel.ActualArea, ["BillableArea"] = parcel.BillableArea, ["SeeAvatars"] = parcel.SeeAvatars, ["AnyAvatarSounds"] = parcel.AnyAvatarSounds, ["GroupAvatarSounds"] = parcel.GroupAvatarSounds, ["IsPrivate"] = parcel.IsPrivate }; using (var connection = new MySqlConnection(m_ConnectionString)) { connection.Open(); MySQLUtilities.ReplaceInto(connection, "parcels", p); } }
public override void ResetParcels() { ClearParcels(); var pi = new ParcelInfo((int)SizeX / 4, (int)SizeY / 4) { AABBMin = new Vector3(0, 0, 0), AABBMax = new Vector3(SizeX - 1, SizeY - 1, 0), ActualArea = (int)(SizeX * SizeY), Area = (int)(SizeX * SizeY), AuctionID = 0, LocalID = 1, ID = UUID.Random, Name = "Your Parcel", Owner = Owner, Flags = ParcelFlags.None, /* we keep all flags disabled initially */ BillableArea = (int)(SizeX * SizeY), LandingPosition = new Vector3(128, 128, 23), LandingLookAt = new Vector3(1, 0, 0), ClaimDate = new Date(), Status = ParcelStatus.Leased }; pi.LandBitmap.SetAllBits(); lock (m_ParcelUpdateLock) { m_SimulationDataStorage.Parcels.Store(ID, pi); base.ClearParcels(); AddParcel(pi); } }
void Start() { argsBuffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments); positions = new Vector4[instanceCount]; colors = new Vector4[instanceCount]; scales = new Vector4[instanceCount]; matrixs = new Matrix4x4[instanceCount]; priceHeight = new float[instanceCount]; for (int i = 0; i < N; i++) { ParcelInfos[i] = new ParcelInfo(i); } CreateMouseTriggers(); // InvokeRepeating("UpdateColliders", 5, 5); UpdateBuffers(bUpdatePositionBuffer, bUpdateColorBuffer, bUpdateMatrixBuffer, bUpdateScaleBuffer, bArgsBuffer); ReadMapBaseFromPNG(); // StartCoroutine(ParcelPublicationAPI.AsyncFetchAllOpen()); 次数太多,吃不消 //Districts StartCoroutine(DistrictsAPI.AsyncFetchAll()); }
public void Test1(decimal length, decimal breadth, decimal height, decimal weight, PackageTypes type) { var parser = new ParseTheParcel(ParcelTypeParserFactory.GetParcelTypeParser()); var info = new ParcelInfo(length, breadth, height, weight); var parcel = parser.CalculateCost(info); Assert.Equal(type, parcel.Type); }
public bool CrossesParcelBoundary(IObject obj, Vector3 newPos, out ParcelInfo toParcel) { ParcelInfo fromParcel; return(Parcels.TryGetValue(newPos, out toParcel) && Parcels.TryGetValue(obj.GlobalPosition, out fromParcel) && fromParcel.LocalID != toParcel.LocalID); }
public int CalcMaxTotalParcelPrims(ParcelInfo p) { int regionTotal = RegionSettings.MaxTotalPrims; long regionArea = (long)SizeX * SizeY; long parcelPrims = p.Area * regionTotal / regionArea; return((int)(p.ParcelPrimBonus * parcelPrims)); }
public void Add(ParcelInfo parcelInfo) { lock (m_SceneUpdateLock) { m_Scene.AddParcel(parcelInfo); m_Scene.m_SimulationDataStorage.Parcels.Store(m_Scene.ID, parcelInfo); } }
public void HandleParcelDisableObjects(Message m) { var req = (ParcelReturnObjects)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } ParcelInfo pinfo = null; IAgent agent; var returnlist = new List <UUID>(); if (Agents.TryGetValue(req.AgentID, out agent) && (req.LocalID == -1 || Parcels.TryGetValue(req.LocalID, out pinfo))) { foreach (Object.ObjectGroup grp in ObjectGroups) { if (grp.IsAttached) { continue; } if (pinfo != null && !pinfo.LandBitmap.ContainsLocation(grp.GlobalPosition)) { continue; } bool isOwner = grp.Owner.EqualsGrid(pinfo.Owner); if (!CanReturn(agent, grp, grp.GlobalPosition)) { continue; } if (((req.ReturnType & ObjectReturnType.Owner) != 0 && isOwner) || ((req.ReturnType & ObjectReturnType.Other) != 0 && !isOwner) || ((req.ReturnType & ObjectReturnType.Group) != 0 && grp.Group == pinfo.Group) || ((req.ReturnType & ObjectReturnType.Sell) != 0 && grp.SaleType != InventoryItem.SaleInfoData.SaleType.NoSale) || ((req.ReturnType & ObjectReturnType.List) != 0 && req.TaskIDs.Contains(grp.ID)) || ((req.ReturnType & ObjectReturnType.List) != 0 && req.OwnerIDs.Contains(grp.Owner.ID))) { foreach (ObjectPart part in grp.Values) { foreach (ObjectPartInventoryItem item in part.Inventory.Values) { ScriptInstance instance = item.ScriptInstance; if (item.ScriptInstance != null) { item.ScriptInstance.IsRunning = false; } } } } } } }
public bool CanGodMarkParcelAsContent(UGUI agentOwner, ParcelInfo parcelInfo) { if (IsPossibleGod(agentOwner)) { return(true); } return(false); }
public bool CanGodForceParcelOwner(UGUI agentOwner, ParcelInfo parcelInfo) { if (IsPossibleGod(agentOwner)) { return(true); } return(false); }
public override void SendUpdatedParcelInfo(ParcelInfo pinfo, UUID fromSceneID) { AgentCircuit circuit; if (Circuits.TryGetValue(fromSceneID, out circuit)) { var props = circuit.Scene.ParcelInfo2ParcelProperties(Owner.ID, pinfo, NextParcelSequenceId, ParcelProperties.RequestResultType.Single); circuit.SendMessage(props); } }
private void QuoteBtn_Click(object sender, EventArgs e) { if (!(is_tbValidate())) { // Initializes the variables to pass to the MessageBox.Show method. string message = "Some information is missing. Please check again the form."; string caption = "Error Detected in Input"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } } else { if (!(formatValidate())) { string message = "Some information is in invalid format. Please check again."; string caption = "Invalid Format"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } } else { bool parcelTypeResult; if (rbParcel.Checked) { parcelTypeResult = false; } else { parcelTypeResult = true; } ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text), Convert.ToSingle(tbWeight.Text), 0, 0); decimal quoteFee = ParcelController.Quote(cbSenderLocation.Text, tbSenderPosCode.Text, cbReceiverLocation.Text, tbReceiverPosCode.Text, parcelInfo, null); price.Text = Convert.ToString(quoteFee); ConfirmBtn.Enabled = true; } } }
void Parcels_ParcelInfoReply(object sender, ParcelInfoReplyEventArgs e) { if (e.Parcel.ID != parcelID) { return; } if (InvokeRequired) { if (!instance.MonoRuntime || IsHandleCreated) { BeginInvoke(new MethodInvoker(() => Parcels_ParcelInfoReply(sender, e))); } return; } this.parcel = e.Parcel; pnlDetail.Visible = true; if (parcel.SnapshotID != UUID.Zero) { SLImageHandler img = new SLImageHandler(instance, parcel.SnapshotID, ""); img.Dock = DockStyle.Fill; pnlDetail.Controls.Add(img); pnlDetail.Disposed += (object senderx, EventArgs ex) => { img.Dispose(); }; img.BringToFront(); } btnTeleport.Enabled = true; btnShowOnMap.Enabled = true; if (parcelLocation) { localPosition = new Vector3(); localPosition.X = parcel.GlobalX % 256; localPosition.Y = parcel.GlobalY % 256; localPosition.Z = parcel.GlobalZ; } if (decodedLandmark == null) { txtParcelName.Text = string.Format("{0} - {1} ", parcel.Name, parcel.SimName); } else { txtParcelName.Text = string.Format("{0} - {1} ({2}, {3}, {4}) ", parcel.Name, parcel.SimName, (int)decodedLandmark.Position.X, (int)decodedLandmark.Position.Y, (int)decodedLandmark.Position.Z); } txtParcelDescription.Text = parcel.Description; }
public virtual Parcel Calculate(ParcelInfo info) { if (info == null) { throw new ArgumentNullException(nameof(info)); } if (this.IsParcelFitMe(info)) { return(this.GetFittingParcel(info)); } return(this.Next.Calculate(info)); }
public bool DivideParcel(UGUI requestingAgent, int start_x, int start_y, int end_x, int end_y) { ParcelInfo pInfo; if (!Parcels.TryGetValue(new Vector3(start_x, start_y, 0), out pInfo)) { return(false); } ParcelInfo.ParcelDataLandBitmap bmap = pInfo.LandBitmap; if (!bmap[start_x, end_y - 1] || !bmap[end_x - 1, start_x] || !bmap[end_x - 1, end_y - 1]) { /* not dividable */ return(false); } start_x &= (~3); start_y &= (~3); end_x &= (~3); end_y &= (~3); for (int py = start_y; py < end_y; py += 4) { for (int px = start_x; px < end_x; px += 4) { if (!bmap[px, py]) { return(false); } } } if (!CanDivideJoinParcel(requestingAgent, pInfo)) { return(false); } var newParcel = new ParcelInfo(pInfo, true); newParcel.ID = UUID.Random; Parcels.Add(newParcel); ParcelInfo.ParcelDataLandBitmap newBmap = newParcel.LandBitmap; for (int py = start_y; py < end_y; ++py) { for (int px = start_x; px < end_x; ++px) { newBmap[px, py] = true; bmap[px, py] = false; } } TriggerParcelUpdate(pInfo); TriggerParcelUpdate(newParcel); return(true); }
void Parcels_ParcelInfoReply(object sender, ParcelInfoReplyEventArgs e) { if (e.Parcel.ID != parcelID) { return; } if (InvokeRequired) { if (!instance.MonoRuntime || IsHandleCreated) { BeginInvoke(new MethodInvoker(() => Parcels_ParcelInfoReply(sender, e))); } return; } parcel = e.Parcel; pnlDetail.Visible = true; if (parcel.SnapshotID != UUID.Zero) { SLImageHandler img = new SLImageHandler(instance, parcel.SnapshotID, "") { Dock = DockStyle.Fill }; pnlDetail.Controls.Add(img); pnlDetail.Disposed += (senderx, ex) => { img.Dispose(); }; img.BringToFront(); } btnTeleport.Enabled = true; btnShowOnMap.Enabled = true; if (parcelLocation) { localPosition = new Vector3 { X = parcel.GlobalX % 256, Y = parcel.GlobalY % 256, Z = parcel.GlobalZ }; } txtParcelName.Text = decodedLandmark == null ? $"{parcel.Name} - {parcel.SimName} " : $"{parcel.Name} - {parcel.SimName} ({(int) decodedLandmark.Position.X}, {(int) decodedLandmark.Position.Y}, {(int) decodedLandmark.Position.Z}) "; txtParcelDescription.Text = parcel.Description; }
private void ConfirmBtn_Click(object sender, EventArgs e) { string message = "Do you want to confirm the parcel details?"; string caption = "Confirmation"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } else { int senderIDType = 0; if (cbIdtype.Text == "IC Number") { senderIDType = 1; } else if (cbIdtype.Text == " Old IC Number") { senderIDType = 2; } else { senderIDType = 3; } bool parcelTypeResult; if (rbParcel.Checked) { parcelTypeResult = false; } else { parcelTypeResult = true; } PersonInfo sender1 = new PersonInfo(tbSenderName.Text, tbSenderEmail.Text, tbSenderContactNo.Text, tbSenderAddress.Text, tbSenderPosCode.Text, cbSenderLocation.Text, tbSenderCity.Text, tbSenderState.Text); PersonInfo receiver1 = new PersonInfo(tbReceiverName.Text, tbReceiverEmail.Text, tbReceiverContactNo.Text, tbReceiverAddress.Text, tbReceiverPosCode.Text, cbReceiverLocation.Text, tbReceiverCity.Text, tbReceiverState.Text); ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text), Convert.ToSingle(tbWeight.Text), Convert.ToDecimal(price.Text), 0); ParcelController.Create(Convert.ToByte(senderIDType), tbSenderidNumber.Text, sender1, receiver1, parcelInfo, Authentication.CurrentStaff.BranchId); MessageBox.Show("Add Success!"); this.Close(); admin.registerHereLoad(); } }
public bool CanReclaimParcel(UGUI agentOwner, ParcelInfo parcelInfo) { if (IsPossibleGod(agentOwner)) { return(true); } if (parcelInfo.Owner.EqualsGrid(agentOwner)) { return(true); } return(false); }
public bool JoinParcels(UGUI requestingAgent, int start_x, int start_y, int end_x, int end_y) { start_x &= (~3); start_y &= (~3); end_x &= (~3); end_y &= (~3); var parcels = new List <ParcelInfo>(); for (int py = start_y; py < end_y; py += 4) { for (int px = start_x; px < end_x; px += 4) { ParcelInfo pInfo; if (Parcels.TryGetValue(new Vector3(px, py, 0), out pInfo) && !parcels.Contains(pInfo)) { parcels.Add(pInfo); } } } if (parcels.Count < 2) { return(false); } ParcelInfo remainingParcel = parcels[0]; /* check rights on parcels */ foreach (ParcelInfo pInfo in parcels) { if (!remainingParcel.Owner.EqualsGrid(pInfo.Owner) || !CanDivideJoinParcel(requestingAgent, pInfo)) { return(false); } } parcels.RemoveAt(0); /* merge parcels */ foreach (ParcelInfo pInfo in parcels) { RemoveParcel(pInfo, remainingParcel.ID); } return(true); }
public bool CanEjectFromParcel(UGUI requestingAgent, Vector3 position, out ParcelInfo pInfo) { if (Parcels.TryGetValue(position, out pInfo)) { if (!pInfo.GroupOwned && pInfo.Owner.EqualsGrid(requestingAgent)) { return(true); } if (pInfo.GroupOwned && HasGroupPower(requestingAgent, pInfo.Group, SilverSim.Types.Groups.GroupPowers.LandEjectAndFreeze)) { return(true); } } return(false); }
public Parcel CalculateCost(ParcelInfo info) { try { var parcel = this.parser.Calculate(info); return(parcel); } catch (ArgumentNullException ane) { // Logs } catch (Exception ex) { // Logs } return(new Parcel()); }
public override bool RemoveParcel(ParcelInfo p, UUID mergeTo) { bool removed = false; ParcelInfo mergeParcel; lock (m_ParcelUpdateLock) { if (m_Parcels.TryGetValue(mergeTo, out mergeParcel)) { removed = m_Parcels.Remove(p.ID); m_SimulationDataStorage.Parcels.Remove(ID, p.ID); mergeParcel.LandBitmap.Merge(p.LandBitmap); TriggerParcelUpdate(mergeParcel); } } return(removed); }
public bool CanReleaseParcel(UGUI agentOwner, ParcelInfo parcelInfo) { if (IsPossibleGod(agentOwner)) { return(true); } if (parcelInfo.Owner.EqualsGrid(agentOwner)) { return(true); } if (HasGroupPower(agentOwner, parcelInfo.Group, GroupPowers.LandRelease)) { return(true); } return(false); }
public bool CanEditParcelDetails(UGUI agentOwner, ParcelInfo parcelInfo) { if (IsPossibleGod(agentOwner)) { return(true); } if (parcelInfo.Owner.EqualsGrid(agentOwner)) { return(true); } if (HasGroupPower(agentOwner, parcelInfo.Group, GroupPowers.LandEdit)) { return(true); } return(false); }
public bool TryGetValue(Vector3 pos, out ParcelInfo pinfo) { pinfo = null; var x = (int)pos.X; var y = (int)pos.Y; if (pos.X < 0 || pos.Y < 0 || x < 0 || y < 0 || x >= m_Scene.SizeX || y >= m_Scene.SizeY) { return(false); } foreach (ParcelInfo p in m_Scene.m_Parcels.Values) { if (p.LandBitmap[x / 4, y / 4]) { pinfo = p; return(true); } } return(false); }
// UI thread public void DisplayPlace(ParcelInfo place) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => DisplayPlace(place))); return; } if (place.Name == null) { return; } string sForSale = ""; if (place.SalePrice > 0) { sForSale = "For Sale for L$" + place.SalePrice.ToString(CultureInfo.CurrentCulture); } txtName.Text = place.Name; txtDescription.Text = place.Description; txtInformation.Text = "Traffic: " + place.Dwell + " Area: " + place.ActualArea.ToString(CultureInfo.CurrentCulture) + " sq. m. " + sForSale; chkMature.Checked = place.Mature; // Convert Global pos to local float locX = (float)place.GlobalX;; float locY = (float)place.GlobalY; float locX1; float locY1; Helpers.GlobalPosToRegionHandle(locX, locY, out locX1, out locY1); fX = locX1; fY = locY1; fZ = (float)place.GlobalZ; //sSIM = place.SimName; txtLocation.Text = place.SimName.ToString(CultureInfo.CurrentCulture) + " " + fX.ToString(CultureInfo.CurrentCulture) + ", " + fY.ToString(CultureInfo.CurrentCulture) + ", " + fZ.ToString(CultureInfo.CurrentCulture); }
public LandInfo(ParcelInfo parcelInfo, UkrainianCadastralExchangeFile data) { cadastralZoneNumber = data.InfoPart.CadastralZoneInfo.CadastralZoneNumber; cadastralQuarterNumber = data.InfoPart.CadastralZoneInfo.CadastralQuarters.CadastralQuarterInfo.CadastralQuarterNumber; parcelID = parcelInfo.ParcelMetricInfo.ParcelID; settlement = parcelInfo.ParcelLocationInfo.Settlement; region = parcelInfo.ParcelLocationInfo.Region; measurementUnit = parcelInfo.ParcelMetricInfo.Area.MeasurementUnit; size = parcelInfo.ParcelMetricInfo.Area.Size; try { building = parcelInfo.ParcelLocationInfo.ParcelAddress.Building; } catch (Exception) { building = "--"; } try { streetType = parcelInfo.ParcelLocationInfo.ParcelAddress.StreetType; } catch (Exception) { streetType = "--"; } try { streetName = parcelInfo.ParcelLocationInfo.ParcelAddress.StreetName; } catch (Exception) { streetName = "--"; } }
public override void TriggerParcelUpdate(ParcelInfo pInfo) { lock (m_ParcelUpdateLock) { if (m_Parcels.ContainsKey(pInfo.ID)) { m_SimulationDataStorage.Parcels.Store(ID, pInfo); } } foreach (IAgent agent in RootAgents) { var x = (int)agent.Position.X; var y = (int)agent.Position.Y; if (agent.Position.X < 0 || agent.Position.Y < 0 || x < 0 || y < 0 || x >= SizeX || y >= SizeY) { continue; } if (pInfo.LandBitmap[x / 4, y / 4]) { agent.SendUpdatedParcelInfo(pInfo, ID); } } }
private void ChangeParcelOwnership(SceneInterface scene, ParcelInfo pinfo, UGUI newOwner, int soldforprice, ParcelBuy req) { bool sellParcelObjects = (pinfo.Flags & ParcelFlags.SellParcelObjects) != 0; UGUI oldOwner = pinfo.Owner; UGI oldGroup = pinfo.Group; bool wasGroupOwned = pinfo.GroupOwned; pinfo.Owner = newOwner; pinfo.Group = UGI.Unknown; pinfo.GroupOwned = false; pinfo.ClaimDate = Date.Now; pinfo.ClaimPrice = soldforprice; pinfo.SalePrice = 0; pinfo.AuthBuyer = UGUI.Unknown; pinfo.Flags &= ~(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); scene.TriggerParcelUpdate(pinfo); if (sellParcelObjects) { foreach (ObjectGroup grp in scene.ObjectGroups) { try { if (pinfo.LandBitmap.ContainsLocation(grp.GlobalPosition) && wasGroupOwned ? (grp.IsGroupOwned && grp.Group == oldGroup) : (!grp.IsGroupOwned && grp.Owner == oldOwner)) { grp.Owner = newOwner; } } catch { /* do not trip on this */ } } } }