<commit_before>using System;
using System.Collections.Generic;
using System.Diagnostics; 
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace FFTools {
    // Program settings.
    //private static const Keys K_CAST = Keys.D2;

    public class Mining {
        public static void Main() {
            String MineType= "Mature Tree"; //set to desired farming type ex: Mineral Deposit, Mature Tree
            byte[] MineTypeByteArray = Encoding.ASCII.GetBytes(MineType);

            MemoryManager theMemory = new MemoryManager();
            if (theMemory.initialize() > 0) Environment.Exit(1);
            Player thePlayer = theMemory.readPlayer();
            System.Console.WriteLine(thePlayer);
            List<string> theGenDiagList = theMemory.readGeneralDialogueList();

            //List<MineralDeposit> theMinDepList = theMemory.readMineralDepositList();
            //foreach (MineralDeposit md in theMinDepList) {
                //System.Console.WriteLine(md);
            //}

            while (true) {
                List<IntPtr> MineTypeAddresses = theMemory.findAddresses(MineTypeByteArray);
                List<MineralDeposit> theMinDepList = theMemory.readMineralDepositList(MineTypeAddresses);
                System.Console.WriteLine("-------");
                System.Console.WriteLine("Nearest mineral deposit is at...");
                MineralDeposit md = nearestVisibleMineralDeposit(thePlayer, theMinDepList);
                System.Console.WriteLine(md);
                System.Console.WriteLine("With a distance of " + findDistanceBetween(thePlayer, md.x, md.y));
                System.Console.WriteLine("Need to face " + findOrientationRelativeTo(thePlayer, md.x, md.y));
                System.Console.WriteLine("Traveling to the node...");
                travelTo(theMemory, md.x, md.y);
                mineFrom(theMemory);
                System.Console.WriteLine("Done with this node!");
            }
        }

        private static void mineFrom(MemoryManager theMemory) {
            theMemory.sendKeyPressMsg(Keys.End, 500);
            Thread.Sleep(500);
            theMemory.sendKeyPressMsg(Keys.F9, 500);
            Thread.Sleep(200);
            theMemory.sendKeyPressMsg(Keys.NumPad1, 500);
            Thread.Sleep(1500);
            for (int i = 0; i < 4; i++) {
                theMemory.sendKeyPressMsg(Keys.NumPad1, 500);
                Thread.Sleep(3600);
            }
            Thread.Sleep(3000);
        }

        // Distance between player and targetx,targety.
        private static float findDistanceBetween(Player thePlayer, float tx, float ty) {
            float dx = thePlayer.x - tx;
            float dy = thePlayer.y - ty;
            return (float)Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2));
        }

        // Angle between player and targetx,targety.
        private static float findAngleBetween(Player thePlayer, float tx, float ty) {
            float prot = thePlayer.rot;<commit_msg>Mining should check player position everytime we look for new nodes<commit_after>using System;
using System.Collections.Generic;
using System.Diagnostics; 
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace FFTools {
    // Program settings.
    //private static const Keys K_CAST = Keys.D2;

    public class Mining {
        public static void Main() {
            String MineType= "Mature Tree"; //set to desired farming type ex: Mineral Deposit, Mature Tree
            byte[] MineTypeByteArray = Encoding.ASCII.GetBytes(MineType);

            MemoryManager theMemory = new MemoryManager();
            if (theMemory.initialize() > 0) Environment.Exit(1);
            Player thePlayer = theMemory.readPlayer();
            System.Console.WriteLine(thePlayer);
            List<string> theGenDiagList = theMemory.readGeneralDialogueList();

            //List<MineralDeposit> theMinDepList = theMemory.readMineralDepositList();
            //foreach (MineralDeposit md in theMinDepList) {
                //System.Console.WriteLine(md);
            //}

            while (true) {
                thePlayer = theMemory.readPlayer();
                List<IntPtr> MineTypeAddresses = theMemory.findAddresses(MineTypeByteArray);
                List<MineralDeposit> theMinDepList = theMemory.readMineralDepositList(MineTypeAddresses);
                System.Console.WriteLine("-------");
                System.Console.WriteLine("Nearest mineral deposit is at...");
                MineralDeposit md = nearestVisibleMineralDeposit(thePlayer, theMinDepList);
                System.Console.WriteLine(md);
                System.Console.WriteLine("With a distance of " + findDistanceBetween(thePlayer, md.x, md.y));
                System.Console.WriteLine("Need to face " + findOrientationRelativeTo(thePlayer, md.x, md.y));
                Console.ReadLine();
                System.Console.WriteLine("Traveling to the node...");
                travelTo(theMemory, md.x, md.y);
                mineFrom(theMemory);
                System.Console.WriteLine("Done with this node!");
            }
        }

        private static void mineFrom(MemoryManager theMemory) {
            theMemory.sendKeyPressMsg(Keys.End, 500);
            Thread.Sleep(500);
            theMemory.sendKeyPressMsg(Keys.Enter, 500);
            Thread.Sleep(200);
            theMemory.sendKeyPressMsg(Keys.Enter, 500);
            Thread.Sleep(1500);
            for (int i = 0; i < 4; i++) {
                theMemory.sendKeyPressMsg(Keys.Enter, 500);
                Thread.Sleep(3600);
            }
            Thread.Sleep(3000);
        }

        // Distance between player and targetx,targety.
        private static float findDistanceBetween(Player thePlayer, float tx, float ty) {
            float dx = thePlayer.x - tx;
            float dy = thePlayer.y - ty;
            return (float)Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2));
        }

        // Angle between player and targetx,targety.
        private static float findAngleBetween(Player thePlayer, float tx, float ty) {
            float prot = thePlayer.rot;
{'fraction_non_alphanumeric': 0.10261763288903164, 'fraction_numerical': 0.012365505058615707, 'mean_word_length': 2.1791730474732005, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6671639', 'n_tokens_mistral': 1778, 'n_tokens_neox': 1614, 'n_words': 382}