Пример #1
0
        private TemTem GetMatchup(string TemName)
        {
            int    index   = TemNames.IndexOf(TemName);
            TemTem TemInfo = TemTems[index];

            return(TemInfo);
        }
Пример #2
0
        private List <TemTem> PopulateList()
        {
            List <TemTem> temTemps = File.ReadAllLines("Resources\\TemTemList.csv")
                                     .Skip(1)
                                     .Select(v => TemTem.FromCsv(v))
                                     .ToList();

            return(temTemps);
        }
Пример #3
0
 private void SetTrait(TemTem Tem)
 {
     string[] Traits = Tem.Trait.ToString().Split(':');
     if (Traits.Length > 0)
     {
         //Set Trait Name
         EnemyTemTraitName1.Content = Traits[0];
         //Set Trait Description
         int      index    = TemTraits.FindIndex(x => x.Name.Contains(Traits[0]));
         TemTrait TemTrait = TemTraits[index];
         EnemyTemTraitDescription1.Text = TemTrait.Description;
     }
     if (Traits.Length > 1)
     {
         //Set Trait Name
         EnemyTemTraitName2.Content = Traits[1];
         //Set Trait Description
         int      index    = TemTraits.FindIndex(x => x.Name.Contains(Traits[1]));
         TemTrait TemTrait = TemTraits[index];
         EnemyTemTraitDescription2.Text = TemTrait.Description;
     }
 }
Пример #4
0
        public static TemTem FromCsv(string csvLine)
        {
            string[] values    = csvLine.Split(',');
            TemTem   temValues = new TemTem();

            temValues.Number       = Convert.ToInt32(values[0]);
            temValues.Name         = Convert.ToString(values[1]);
            temValues.Type1        = Convert.ToString(values[2]);
            temValues.Type2        = Convert.ToString(values[3]);
            temValues.Trait        = Convert.ToString(values[4]);
            temValues.TypeNeutral  = (float)Convert.ToDouble(values[5]);
            temValues.TypeFire     = (float)Convert.ToDouble(values[6]);
            temValues.TypeWater    = (float)Convert.ToDouble(values[7]);
            temValues.TypeNature   = (float)Convert.ToDouble(values[8]);
            temValues.TypeElectric = (float)Convert.ToDouble(values[9]);
            temValues.TypeEarth    = (float)Convert.ToDouble(values[10]);
            temValues.TypeMental   = (float)Convert.ToDouble(values[11]);
            temValues.TypeWind     = (float)Convert.ToDouble(values[12]);
            temValues.TypeDigital  = (float)Convert.ToDouble(values[13]);
            temValues.TypeMelee    = (float)Convert.ToDouble(values[14]);
            temValues.TypeCrystal  = (float)Convert.ToDouble(values[15]);
            temValues.TypeToxic    = (float)Convert.ToDouble(values[16]);
            return(temValues);
        }
Пример #5
0
        private void ScanScreenTem(bool save)
        {
            //Init
            Bitmap memoryImageLeft;

            memoryImageLeft = new Bitmap(ResolutionSettings.SnipW, ResolutionSettings.SnipH);
            System.Drawing.Size sL = new System.Drawing.Size(ResolutionSettings.SnipW, ResolutionSettings.SnipH);

            Graphics memoryGraphicsLeft = Graphics.FromImage(memoryImageLeft);

            //Scan TemTem Left
            memoryGraphicsLeft.CopyFromScreen(ResolutionSettings.TemLeftX, ResolutionSettings.TemLeftY, 0, 0, sL);

            //Tesseract OCR
            memoryImageLeft = OCR.Whitify(memoryImageLeft);
            string temOCR = OCR.Tesseract(memoryImageLeft);

            //log.Info($"FoundOCR-L:{temOCR}");
            temOCR = temOCR.Split(' ')[0];
            temOCR = new String(temOCR.Where(Char.IsLetter).ToArray());
            int temOCRindex = TemTems.FindIndex(x => x.Name.Contains(temOCR));

            //Set left Tem label text
            if (!OCR.ScanForMenu() || (EnemyTemLeft.Content.ToString() != temOCR && temOCR != "" && temOCRindex > 0))
            {
                if (TemValid(temOCR))
                {
                    EnemyTemLeft.Content = temOCR;
                }
            }

            //If we found a tem update the table
            if (EnemyTemLeft.Content.ToString() != "")
            {
                //Get Tem Details
                TemLeft = GetMatchup(EnemyTemLeft.Content.ToString());

                if (!TemLeft.Type2.Equals("None"))
                {
                    EnemyTemLeftType.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemLeft.Type2 + ".png", UriKind.Relative));
                    EnemyTemLeftType2.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemLeft.Type1 + ".png", UriKind.Relative));
                }
                else
                {
                    EnemyTemLeftType.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemLeft.Type1 + ".png", UriKind.Relative));
                    EnemyTemLeftType2.Source = null;
                }

                //Get Type Defense
                LMNeutral.Content  = TypeString(TemLeft.TypeNeutral);
                LMFire.Content     = TypeString(TemLeft.TypeFire);
                LMWater.Content    = TypeString(TemLeft.TypeWater);
                LMNature.Content   = TypeString(TemLeft.TypeNature);
                LMElectric.Content = TypeString(TemLeft.TypeElectric);
                LMEarth.Content    = TypeString(TemLeft.TypeEarth);
                LMMental.Content   = TypeString(TemLeft.TypeMental);
                LMWind.Content     = TypeString(TemLeft.TypeWind);
                LMDigital.Content  = TypeString(TemLeft.TypeDigital);
                LMMelee.Content    = TypeString(TemLeft.TypeMelee);
                LMCrystal.Content  = TypeString(TemLeft.TypeCrystal);
                LMToxic.Content    = TypeString(TemLeft.TypeToxic);

                //Add Green/Red background color
                AddColor(LeftMatchup.Children);
                LeftMatchup.Visibility = Visibility.Visible;
                LeftType.Visibility    = Visibility.Visible;
            }
            else
            {
                LeftMatchup.Visibility = Visibility.Collapsed;
                LeftType.Visibility    = Visibility.Collapsed;
            }

            //Init
            Bitmap memoryImageRight;

            memoryImageRight = new Bitmap(ResolutionSettings.SnipW, ResolutionSettings.SnipH);
            System.Drawing.Size sR = new System.Drawing.Size(ResolutionSettings.SnipW, ResolutionSettings.SnipH);

            Graphics memoryGraphicsRight = Graphics.FromImage(memoryImageRight);

            //Scan TemTem Right
            memoryGraphicsRight.CopyFromScreen(ResolutionSettings.TemRightX, ResolutionSettings.TemRightY, 0, 0, sR);

            //Tesseract OCR
            memoryImageRight = OCR.Whitify(memoryImageRight);
            //string fileName = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
            //    @"\TemTem\" +
            //    DateTime.Now.ToString("(dd_MMMM_hh_mm_ss_tt)") + "R.png");
            //memoryImageRight.Save(fileName);
            temOCR = OCR.Tesseract(memoryImageRight);
            //log.Info($"FoundOCR-R:{temOCR}");
            temOCR      = temOCR.Split(' ')[0];
            temOCR      = new String(temOCR.Where(Char.IsLetter).ToArray());
            temOCRindex = TemTems.FindIndex(x => x.Name.Contains(temOCR));

            //Set left Tem label text
            if (!OCR.ScanForMenu() || (EnemyTemRight.Content.ToString() != temOCR && temOCR != "" && temOCRindex > 0))
            {
                if (TemValid(temOCR))
                {
                    EnemyTemRight.Content = temOCR;
                }
            }
            ;

            //If we found a Tem update the table
            if (EnemyTemRight.Content.ToString() != "")
            {
                //Get Tem Details
                TemRight = GetMatchup(EnemyTemRight.Content.ToString());

                if (!TemRight.Type2.Equals("None"))
                {
                    EnemyTemRightType.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemRight.Type2 + ".png", UriKind.Relative));
                    EnemyTemRightType2.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemRight.Type1 + ".png", UriKind.Relative));
                }
                else
                {
                    EnemyTemRightType.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Resources/" + TemRight.Type1 + ".png", UriKind.Relative));
                    EnemyTemRightType2.Source = null;
                }

                //Get Type Defense
                RMNeutral.Content  = TypeString(TemRight.TypeNeutral);
                RMFire.Content     = TypeString(TemRight.TypeFire);
                RMWater.Content    = TypeString(TemRight.TypeWater);
                RMNature.Content   = TypeString(TemRight.TypeNature);
                RMElectric.Content = TypeString(TemRight.TypeElectric);
                RMEarth.Content    = TypeString(TemRight.TypeEarth);
                RMMental.Content   = TypeString(TemRight.TypeMental);
                RMWind.Content     = TypeString(TemRight.TypeWind);
                RMDigital.Content  = TypeString(TemRight.TypeDigital);
                RMMelee.Content    = TypeString(TemRight.TypeMelee);
                RMCrystal.Content  = TypeString(TemRight.TypeCrystal);
                RMToxic.Content    = TypeString(TemRight.TypeToxic);
                //Add Green/Red Background color
                AddColor(RightMatchup.Children);
                RightMatchup.Visibility = Visibility.Visible;
                RightType.Visibility    = Visibility.Visible;
            }
            else
            {
                RightMatchup.Visibility = Visibility.Collapsed;
                RightType.Visibility    = Visibility.Collapsed;
            }

            if (!TemTypeDef && (EnemyTemLeft.Content.ToString() != "" || EnemyTemRight.Content.ToString() != "") && !AlwaysShowDefense)
            {
                TemTacOverlay.BeginStoryboard((Storyboard)this.Resources["TypeDefenseShow"]);
                TemTypeDef = true;
            }
            else if (TemTypeDef && (EnemyTemLeft.Content.ToString() == "" && EnemyTemRight.Content.ToString() == "") && !AlwaysShowDefense)
            {
                TemTacOverlay.BeginStoryboard((Storyboard)this.Resources["TypeDefenseHide"]);
                TemTypeDef = false;
            }
        }
Пример #6
0
        private void ScanScreenTem(bool save)
        {
            Bitmap memoryImage;

            memoryImage = new Bitmap(150, 35);
            System.Drawing.Size s = new System.Drawing.Size(150, 35);

            Graphics memoryGraphics = Graphics.FromImage(memoryImage);

            //Scan TemTem Left
            memoryGraphics.CopyFromScreen(1166, 23, 0, 0, s);

            //Save image (Used for gathering Dataset)
            if (save)
            {
                string fileName = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                                                @"\TemTem\" +
                                                DateTime.Now.ToString("(dd_MMMM_hh_mm_ss_tt)") + "L.png");
                memoryImage.Save(fileName);
            }

            string TempTemScan = ImageCorrelation(memoryImage).ToString();

            //Set left Tem label text
            if (!ScanForMenu() || (EnemyTemLeft.Content.ToString() != TempTemScan && TempTemScan != ""))
            {
                EnemyTemLeft.Content = TempTemScan;
            }

            //If we found a tem update the table
            if (EnemyTemLeft.Content.ToString() != "")
            {
                TemTem TemLeft = GetMatchup(EnemyTemLeft.Content.ToString());

                LMNeutral.Content  = TemLeft.TypeNeutral.ToString().TrimStart(new Char[] { '0' });
                LMFire.Content     = TemLeft.TypeFire.ToString().TrimStart(new Char[] { '0' });
                LMWater.Content    = TemLeft.TypeWater.ToString().TrimStart(new Char[] { '0' });
                LMNature.Content   = TemLeft.TypeNature.ToString().TrimStart(new Char[] { '0' });
                LMElectric.Content = TemLeft.TypeElectric.ToString().TrimStart(new Char[] { '0' });
                LMEarth.Content    = TemLeft.TypeEarth.ToString().TrimStart(new Char[] { '0' });
                LMMental.Content   = TemLeft.TypeMental.ToString().TrimStart(new Char[] { '0' });
                LMWind.Content     = TemLeft.TypeWind.ToString().TrimStart(new Char[] { '0' });
                LMDigital.Content  = TemLeft.TypeDigital.ToString().TrimStart(new Char[] { '0' });
                LMMelee.Content    = TemLeft.TypeMelee.ToString().TrimStart(new Char[] { '0' });
                LMCrystal.Content  = TemLeft.TypeCrystal.ToString().TrimStart(new Char[] { '0' });
                LMToxic.Content    = TemLeft.TypeToxic.ToString().TrimStart(new Char[] { '0' });
                AddColor(LeftMatchup.Children);
                LeftMatchup.Visibility = Visibility.Visible;
            }
            else
            {
                LeftMatchup.Visibility = Visibility.Collapsed;
            }

            //Scan TemTem Right
            memoryGraphics.CopyFromScreen(1564, 79, 0, 0, s);

            //Save image
            if (save)
            {
                string fileName = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                                                @"\TemTem\" +
                                                DateTime.Now.ToString("(dd_MMMM_hh_mm_ss_tt)") + "R.png");
                memoryImage.Save(fileName);
            }

            TempTemScan = ImageCorrelation(memoryImage).ToString();
            //Set left Tem label text
            if (!ScanForMenu() || (EnemyTemLeft.Content.ToString() != TempTemScan && TempTemScan != ""))
            {
                EnemyTemRight.Content = TempTemScan;
            }
            ;

            //If we found a Tem update the table
            if (EnemyTemRight.Content.ToString() != "")
            {
                TemTem TemRight = GetMatchup(EnemyTemRight.Content.ToString());

                RMNeutral.Content  = TemRight.TypeNeutral.ToString().TrimStart(new Char[] { '0' });
                RMFire.Content     = TemRight.TypeFire.ToString().TrimStart(new Char[] { '0' });
                RMWater.Content    = TemRight.TypeWater.ToString().TrimStart(new Char[] { '0' });
                RMNature.Content   = TemRight.TypeNature.ToString().TrimStart(new Char[] { '0' });
                RMElectric.Content = TemRight.TypeElectric.ToString().TrimStart(new Char[] { '0' });
                RMEarth.Content    = TemRight.TypeEarth.ToString().TrimStart(new Char[] { '0' });
                RMMental.Content   = TemRight.TypeMental.ToString().TrimStart(new Char[] { '0' });
                RMWind.Content     = TemRight.TypeWind.ToString().TrimStart(new Char[] { '0' });
                RMDigital.Content  = TemRight.TypeDigital.ToString().TrimStart(new Char[] { '0' });
                RMMelee.Content    = TemRight.TypeMelee.ToString().TrimStart(new Char[] { '0' });
                RMCrystal.Content  = TemRight.TypeCrystal.ToString().TrimStart(new Char[] { '0' });
                RMToxic.Content    = TemRight.TypeToxic.ToString().TrimStart(new Char[] { '0' });
                AddColor(RightMatchup.Children);
                RightMatchup.Visibility = Visibility.Visible;
            }
            else
            {
                RightMatchup.Visibility = Visibility.Collapsed;
            }

            TemTacOverlay.Visibility = (LeftMatchup.Visibility == Visibility.Collapsed && RightMatchup.Visibility == Visibility.Collapsed) ? Visibility.Collapsed : Visibility.Visible;
        }