Explorar o código

convenience shortcut wrappers for map markers

Lilith Song %!s(int64=2) %!d(string=hai) anos
pai
achega
74643d07d5

+ 2 - 0
HuntBuddy/Location.cs

@@ -494,6 +494,8 @@ public static class Location {
 				throw new ArgumentOutOfRangeException(nameof(openType), openType, null);
 		}
 	}
+	public static unsafe void CreateMapMarker(MobHuntEntry mob, OpenType openType) => CreateMapMarker(mob.TerritoryType, mob.MapId, mob.MobHuntId, mob.Name, openType);
+	public static unsafe void CreateMapMarker(MobHuntEntry mob) => CreateMapMarker(mob.TerritoryType, mob.MapId, mob.MobHuntId, mob.Name);
 
 	private static (int X, int Y) MapToWorldCoordinates(Vector2 pos, uint mapId) {
 		ushort scale = Service.DataManager.GetExcelSheet<Map>()?.GetRow(mapId)?.SizeFactor ?? 100;

+ 2 - 12
HuntBuddy/Windows/LocalHuntsWindow.cs

@@ -61,12 +61,7 @@ public class LocalHuntsWindow: Window {
 
 			if (Location.Database.ContainsKey(mobHuntEntry.MobHuntId)) {
 				if (InterfaceUtil.IconButton(FontAwesomeIcon.MapMarkerAlt, $"pin##{mobHuntEntry.MobHuntId}")) {
-					Location.CreateMapMarker(
-						mobHuntEntry.TerritoryType,
-						mobHuntEntry.MapId,
-						mobHuntEntry.MobHuntId,
-						mobHuntEntry.Name,
-						Location.OpenType.None);
+					Location.CreateMapMarker(mobHuntEntry, Location.OpenType.None);
 				}
 
 				if (ImGui.IsItemHovered()) {
@@ -83,12 +78,7 @@ public class LocalHuntsWindow: Window {
 						includeArea = !includeArea;
 					}
 
-					Location.CreateMapMarker(
-						mobHuntEntry.TerritoryType,
-						mobHuntEntry.MapId,
-						mobHuntEntry.MobHuntId,
-						mobHuntEntry.Name,
-						includeArea ? Location.OpenType.ShowOpen : Location.OpenType.MarkerOpen);
+					Location.CreateMapMarker(mobHuntEntry, includeArea ? Location.OpenType.ShowOpen : Location.OpenType.MarkerOpen);
 				}
 
 				if (ImGui.IsItemHovered()) {

+ 2 - 12
HuntBuddy/Windows/MainWindow.cs

@@ -97,12 +97,7 @@ public class MainWindow: Window {
 				foreach (MobHuntEntry? mobHuntEntry in entry.Value) {
 					if (Location.Database.ContainsKey(mobHuntEntry.MobHuntId)) {
 						if (InterfaceUtil.IconButton(FontAwesomeIcon.MapMarkerAlt, $"pin##{mobHuntEntry.MobHuntId}")) {
-							Location.CreateMapMarker(
-								mobHuntEntry.TerritoryType,
-								mobHuntEntry.MapId,
-								mobHuntEntry.MobHuntId,
-								mobHuntEntry.Name,
-								Location.OpenType.None);
+							Location.CreateMapMarker(mobHuntEntry, Location.OpenType.None);
 						}
 
 						if (ImGui.IsItemHovered()) {
@@ -119,12 +114,7 @@ public class MainWindow: Window {
 								includeArea = !includeArea;
 							}
 
-							Location.CreateMapMarker(
-								mobHuntEntry.TerritoryType,
-								mobHuntEntry.MapId,
-								mobHuntEntry.MobHuntId,
-								mobHuntEntry.Name,
-								includeArea ? Location.OpenType.ShowOpen : Location.OpenType.MarkerOpen);
+							Location.CreateMapMarker(mobHuntEntry, includeArea ? Location.OpenType.ShowOpen : Location.OpenType.MarkerOpen);
 						}
 
 						if (ImGui.IsItemHovered()) {