private void lvwMapMarkers_SelectedIndexChanged(object sender, EventArgs e) { if (lvwMapMarkers.SelectedItems.Count == 0) { return; } ListViewItem selectedItem = lvwMapMarkers.SelectedItems[0]; StructureMarker selectedMarker = new StructureMarker(); if (selectedItem.Tag is ArkStructure) { ArkStructure selectedStructure = (ArkStructure)selectedItem.Tag; selectedMarker.Colour = "White"; selectedMarker.Lat = (double)selectedStructure.Location?.Latitude.GetValueOrDefault(0); selectedMarker.Lon = (double)selectedStructure.Location?.Longitude.GetValueOrDefault(0); selectedMarker.X = selectedStructure.Location.X; selectedMarker.Y = selectedStructure.Location.Y; selectedMarker.Z = selectedStructure.Location.Z; } else if (selectedItem.Tag is StructureMarker) { selectedMarker = (StructureMarker)selectedItem.Tag; } HighlightStructure?.Invoke(this, selectedMarker); }
public frmStructureInventoryViewer(ArkStructure structure) { InitializeComponent(); selectedStructure = structure; string structureName = structure.ClassName; StructureClassMap classMap = Program.ProgramConfig.StructureMap.Where(d => d.ClassName == structure.ClassName).FirstOrDefault(); if (classMap != null && classMap.FriendlyName.Length > 0) { structureName = classMap.FriendlyName; } lblStructureName.Text = structureName; //inventory images imageList1.Images.Clear(); int x = 1; while (true) { Image itemImage = (Image)ARKViewer.Properties.Resources.ResourceManager.GetObject($"item_{x}"); if (itemImage == null) { break; } imageList1.Images.Add(itemImage); x++; } PopulateStructureInventory(); }
private void btnCopyCommand_Click(object sender, EventArgs e) { if (cboConsoleCommands.SelectedItem == null) { return; } if (lvwMapMarkers.SelectedItems.Count <= 0) { return; } ListViewItem selectedItem = lvwMapMarkers.SelectedItems[0]; StructureMarker selectedMarker = new StructureMarker(); if (selectedItem.Tag is ArkStructure) { ArkStructure selectedStructure = (ArkStructure)selectedItem.Tag; selectedMarker.Colour = "White"; selectedMarker.Lat = (double)selectedStructure.Location?.Latitude.GetValueOrDefault(0); selectedMarker.Lon = (double)selectedStructure.Location?.Latitude.GetValueOrDefault(0); selectedMarker.X = selectedStructure.Location.X; selectedMarker.Y = selectedStructure.Location.Y; selectedMarker.Z = selectedStructure.Location.Z; } else if (selectedItem.Tag is StructureMarker) { selectedMarker = (StructureMarker)selectedItem.Tag; } var commandText = cboConsoleCommands.SelectedItem.ToString(); if (commandText != null) { commandText = commandText.Replace("<x>", System.FormattableString.Invariant($"{selectedMarker.X:0.00}")); commandText = commandText.Replace("<y>", System.FormattableString.Invariant($"{selectedMarker.Y:0.00}")); commandText = commandText.Replace("<z>", System.FormattableString.Invariant($"{selectedMarker.Z + 500:0.00}")); //+500 switch (Program.ProgramConfig.CommandPrefix) { case 1: commandText = $"admincheat {commandText}"; break; case 2: commandText = $"cheat {commandText}"; break; } Clipboard.SetText(commandText); MessageBox.Show($"Command copied to the clipboard:\n\n{commandText}", "Command Copied", MessageBoxButtons.OK, MessageBoxIcon.Information); } }