// // set player position // private void SetPlayerPosition() { if (!Scanning) { return; } player = GameMemory.GetPlayer(); if (player.Name.Length > 0 && (int)Map.ID > 0) { SetPlayerIcon(player); try { double x = Math.Round(MapHelper.ConvertCoordinatesIntoMapPosition((double)Map.SizeFactor, (double)Map.OffsetX, player.X), 2); double y = Math.Round(MapHelper.ConvertCoordinatesIntoMapPosition((double)Map.SizeFactor, (double)Map.OffsetY, player.Y), 2); // set map pos mappos.Text = String.Format("x {0} / y {1} - [{2} / {3}] - [OX: {4} / OY: {5}]", x, y, player.X, player.Y, Map.OffsetX, Map.OffsetY ); } catch { } } }
/// <summary> /// Memory scan timer /// </summary> private void ScanIntervalAction() { // if scanning disabled, do nothing if (Scanning) { ActorItem player = GameMemory.GetPlayer(); // if player has moved map, disable memory timer if (TrackingPlayer.HasMovedMap()) { // clear markers TrackingEnemies.Clear(); TrackingNpcs.Clear(); // disable tickers SetScanningState(false); MapViewer.SetMapCountdown("Zoning ..."); // get the map viewer to request latest map, // once it has done it, it will renable memory timer MapViewer.RequestLatestMap(); } else { // scan for enemies TrackingEnemies.Scan(); TrackingNpcs.Scan(); } } }
/// <summary> /// Request the latest map /// </summary> public void RequestLatestMap() { // show loading uint MapId = GameMemory.GetPlayer().MapID; API.GetMapImage(MapId); }
/// <summary> /// Mark a map as complete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnMarkComplete_Click(object sender, EventArgs e) { Logger.Add("Manually submitting XIVAPI data ..."); TrackingEnemies.SubmitData(); TrackingNpcs.SubmitData(); Logger.Add("Marking the map as complete!"); API.MarkMapComplete(GameMemory.GetPlayer().MapID); }
/// <summary> /// Read Player /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Readplayer_Click(object sender, EventArgs e) { player = GameMemory.GetPlayer(); try { output.Text = String.Format("Outputting Player:") + Environment.NewLine + Environment.NewLine; PrintEntity(player); } catch (Exception ex) { Logger.Exception(ex, "Viewer -> readplayer_Click"); } }
/// <summary> /// called when app initialized, this is delayed /// </summary> private void Initialized() { // set player name ActorItem player = GameMemory.GetPlayer(); labelPlayerName.Text = player.Name; // create timer System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += (sender, e) => { ScanIntervalAction(); }; aTimer.Interval = Properties.Settings.Default.ScanTimerSpeed; aTimer.Enabled = true; }
/// <summary> /// Scan current target /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Readtarget_Click(object sender, EventArgs e) { player = GameMemory.GetPlayer(); ActorItem entity = GameMemory.GetCurrentTarget(); try { output.Text = String.Format("Outputting Target:") + Environment.NewLine + Environment.NewLine; PrintEntity(entity); } catch (Exception ex) { Logger.Exception(ex, "Viewer -> readtarget_Click"); } }
/// <summary> /// Scan for enemies /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { player = GameMemory.GetPlayer(); // GameMemory.getNpcsAroundPlayer(); List <ActorItem> entities = App.Instance.TrackingEnemies.GetEntities(); // reset output output.Text = String.Format("Found: {0}", entities.Count) + Environment.NewLine + Environment.NewLine; // spit out all entities foreach (ActorItem entity in entities) { PrintEntity(entity); } }
// // Checks if the player has changed map, // if it returns true, it means the player has moved // maps, otherwise false the map has not changed // public bool HasMovedMap() { ActorItem Player = GameMemory.GetPlayer(); // Check for map id if (Player.MapID > 0 && Player.MapID != MapId) { // set map MapId = Player.MapID; Logger.Add($"> MAP ID: {Player.MapID}"); // Tell app to change map return(true); } return(false); }
/// <summary> /// Init timer, basically a "delay" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitializeTimer_Tick(object sender, EventArgs e) { ActorItem player = GameMemory.GetPlayer(); Logger.Add(" "); Logger.Add($"~ Hello {player.Name}!"); Logger.Add(" "); if (player.MapID == 0) { Logger.Add("Oh no, the MapID is 0, either the offsets are broke, you're not logged in, or idk... Ask Vekien."); Logger.Add("No mapping today"); SetStatus("/sadface"); } // disable initialize timer, and add memory timer InitializeTimer.Enabled = false; Initialized(); }
/// <summary> /// Get a list of entities /// </summary> /// <returns></returns> public List <ActorItem> GetEntities() { Player = GameMemory.GetPlayer(); List <ActorItem> entities = GameMemory.GetMonstersAroundPlayer(); // remove junk for (var i = 0; i < entities.Count; i++) { ActorItem entity = entities[i]; // check if we're ignoring this entity if (IsIgnored("BNPC", entity)) { entities.RemoveAt(i); continue; } } return(entities); }
/// <summary> /// Scan for entities /// </summary> public void Scan() { Player = GameMemory.GetPlayer(); // get npcs List <ActorItem> entities = GameMemory.GetNpcsAroundPlayer(); if (entities.Count == 0) { return; } // loop through npcs foreach (var entity in entities) { // check if we're ignoring this entity if (IsIgnored("ENPC", entity)) { continue; } // check we havent already tracked it if (list.IndexOf(entity.NPCID2) == -1) { total++; // add to existing list list.Add(entity.NPCID2); LogEntity("ENPC", entity); // add to map App.Instance.MapViewer.AddNpcIcon(entity); App.Instance.labelTotalNpcs.Text = total.ToString(); // save npc to file Saver.SaveNpc(entity); } } }
/// <summary> /// Scan for enemies /// </summary> public void Scan() { Player = GameMemory.GetPlayer(); List <ActorItem> entities = GameMemory.GetMonstersAroundPlayer(); if (entities.Count == 0) { return; } // loop through monsters foreach (var entity in entities) { // check if we're ignoring this entity if (IsIgnored("BNPC", entity)) { continue; } // check we havent already tracked it if (list.IndexOf(entity.ID) == -1) { total++; // add to list list.Add(entity.ID); LogEntity("BNPC", entity); // add to map App.Instance.MapViewer.AddEnemyIcon(entity); App.Instance.labelTotalEnemies.Text = total.ToString(); // save enemy Saver.SaveEnemy(entity); } } }
/// <summary> /// Open the current map on XIVAPI /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOpenXIVAPI_Click(object sender, EventArgs e) { API.OpenOnXivApi(GameMemory.GetPlayer().MapID); }