コード例 #1
0
        private static RaidParameters[] InitializeDenList(RaidSpawnList8 raids, RaidSpawnList8 raidsArmor)
        {
            // current release has these numbers bugged

            var dl       = new RaidParameters[raids.CountUsed + raidsArmor.CountUsed];
            var allRaids = raids.GetAllRaids();

            for (int i = 0; i < raids.CountUsed; i++)
            {
                int idx         = i;
                var currentRaid = allRaids[i];
                var detail      = NestLocations.Nests[i];
                dl[idx] = new RaidParameters(idx, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }

            var allArmorRaids = raidsArmor.GetAllRaids();

            for (int i = 0; i < raidsArmor.CountUsed; i++)
            {
                int idx         = raids.CountUsed + i;
                var currentRaid = allArmorRaids[i];
                var detail      = NestLocations.Nests[idx];
                dl[idx] = new RaidParameters(idx, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }

            return(dl);
        }
コード例 #2
0
        private void LoadDen(RaidParameters raidParameters)
        {
            CHK_Active.Checked  = raidParameters.IsActive;
            CHK_Rare.Checked    = raidParameters.IsRare;
            CHK_Event.Checked   = raidParameters.IsEvent;
            CHK_Wishing.Checked = raidParameters.IsWishingPiece;
            CHK_Watts.Checked   = raidParameters.WattsHarvested;
            L_DenSeed.Text      = $"{raidParameters.Seed:X16}";
            L_Stars.Text        = RaidUtil.GetStarString(raidParameters);

            var pkm = _raids.GenerateFromIndex(raidParameters);
            var s   = GameInfo.Strings;

            L_Ability.Text       = $"Ability: {s.Ability[pkm.Ability]}";
            L_Nature.Text        = $"Nature: {s.natures[pkm.Nature]}";
            L_ShinyInFrames.Text = $"距闪还有: {RandUtil.GetNextShinyFrame(raidParameters.Seed)}帧";
            L_Shiny.Visible      = pkm.ShinyType != 0;
            L_Shiny.Text         = pkm.ShinyType == 1 ? "Shiny: 星闪" : pkm.ShinyType == 2? (pkm.ForcedShinyType == 2 ? "Shiny: Forced Square" : "Shiny: 方闪!!!") : "Shiny locked";

            for (int i = 0; i < 6; i++)
            {
                IVs[i].Text = $"{pkm.IVs[i]:00}";
            }

            PB_PK1.BackgroundImage = RaidUtil.GetRaidResultSprite(pkm, CHK_Active.Checked);
            L_Location.Text        = raidParameters.Location;

            if (raidParameters.X > 0 && raidParameters.Y > 0)
            {
                DenMap.BackgroundImage = RaidUtil.GetNestMap(raidParameters);
            }
        }
コード例 #3
0
        private void DenBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidParameters raidParameters = Raids[denBox.SelectedIndex];

            seedBox.Text = raidParameters.Seed.ToString("X");
            speciesList.Items.Clear();
            var s = GameInfo.Strings;

            if (raidParameters.IsCrystal)
            {
                var entries = Raids.GetAllTemplatesWithStarCount(raidParameters, 0);
                foreach (var entry in entries)
                {
                    ComboboxItem item = new ComboboxItem($"{entry.MinRank + 1}\u2605 {s.Species[entry.Species]}", entry);
                    speciesList.Items.Add(item);
                }
            }
            else
            {
                for (int stars = min_stars[Raids.BadgeCount]; stars <= max_stars[Raids.BadgeCount]; stars++)
                {
                    var entries = Raids.GetAllTemplatesWithStarCount(raidParameters, stars);
                    foreach (var entry in entries)
                    {
                        ComboboxItem item = new ComboboxItem($"{stars + 1}\u2605 {s.Species[entry.Species]}", entry);
                        speciesList.Items.Add(item);
                    }
                }
            }
            speciesList.SelectedIndex = 0;
        }
コード例 #4
0
 internal static ulong getEventHash(RaidParameters raidParameters)
 {
     if (raidParameters.Index >= 100)
     {
         return(EventHash_Rigel1);
     }
     return(EventHash);
 }
コード例 #5
0
        public static Bitmap GetNestMap(RaidParameters raidParameters)
        {
            Pen redPen = new Pen(Color.Red, 10);
            var map    = Resources.map;

            using (var graphics = Graphics.FromImage(map))
                graphics.DrawArc(redPen, raidParameters.X - 5, raidParameters.Y - 5, 15, 15, 0, 360);
            return(map);
        }
コード例 #6
0
        public static Bitmap GetNestMap(RaidParameters raidParameters)
        {
            Pen redPen = new Pen(Color.Red, 10);
            var map    = Resources.map;

            if (raidParameters.Index >= 100)
            {
                if (raidParameters.Index >= 190)
                {
                    map = Resources.map_ct;
                }
                else
                {
                    map = Resources.map_ioa;
                }
                using (var graphics = Graphics.FromImage(map))
                    graphics.DrawArc(redPen, raidParameters.X - 1, raidParameters.Y - 1, 2, 2, 0, 360);
                int start_point_x = raidParameters.X - 172 / 2;
                int start_point_y = raidParameters.Y - 402 / 2;
                if (start_point_x < 0)
                {
                    start_point_x = 0;
                }
                if (start_point_x + 172 > map.Width)
                {
                    start_point_x = map.Width - 172;
                }
                if (start_point_y < 0)
                {
                    start_point_y = 0;
                }
                if (start_point_y + 402 > map.Width)
                {
                    start_point_y = map.Height - 402;
                }
                Rectangle cropRect = new Rectangle(start_point_x, start_point_y, 172, 402);
                Bitmap    src      = map as Bitmap;
                Bitmap    target   = new Bitmap(cropRect.Width, cropRect.Height);

                using (Graphics g = Graphics.FromImage(target))
                {
                    g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
                                cropRect,
                                GraphicsUnit.Pixel);
                }
                map = target;
            }
            else
            {
                using (var graphics = Graphics.FromImage(map))
                    graphics.DrawArc(redPen, raidParameters.X - 5, raidParameters.Y - 5, 15, 15, 0, 360);
            }

            return(map);
        }
コード例 #7
0
        public static string GetStarString(RaidParameters raidParameters)
        {
            const string star   = "\u2605";
            var          output = star;

            for (int i = 0; i < raidParameters.Stars; i++)
            {
                output += star;
            }
            return(output);
        }
コード例 #8
0
 internal static ulong getEventHash(RaidParameters raidParameters)
 {
     if (raidParameters.Index >= PKHeX.Core.RaidSpawnList8.RaidCountLegal_O0 + PKHeX.Core.RaidSpawnList8.RaidCountLegal_R1)
     {
         return(EventHash_Rigel2);
     }
     if (raidParameters.Index >= PKHeX.Core.RaidSpawnList8.RaidCountLegal_O0)
     {
         return(EventHash_Rigel1);
     }
     return(EventHash);
 }
コード例 #9
0
        private static RaidParameters[] InitializeDenList(RaidSpawnList8 raids)
        {
            var dl       = new RaidParameters[100];
            var allRaids = raids.GetAllRaids();

            for (int i = 0; i < dl.Length; i++)
            {
                int idx         = i;
                var currentRaid = allRaids[idx];
                var detail      = NestLocations.Nests[i];
                dl[i] = new RaidParameters(i, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }
            return(dl);
        }
コード例 #10
0
 public RaidPKM GenerateFromIndex(RaidParameters raidParameters)
 {
     if (raidParameters.IsCrystal)
     {
         return(_raidTables.CrytalNestsEvent.ConvertToPKM(raidParameters, 0, TID, SID));
     }
     if (raidParameters.IsEvent)
     {
         var denDetails = Game == GameVersion.SW ? _raidTables.SwordNestsEvent : _raidTables.ShieldNestsEvent;
         return(denDetails.ConvertToPKM(raidParameters, NestLocations.getEventHash(raidParameters), TID, SID));
     }
     else
     {
         var detail     = NestLocations.Nests[raidParameters.Index];
         var hash       = raidParameters.IsRare ? detail.RareHash : detail.CommonHash;
         var denDetails = Game == GameVersion.SW ? _raidTables.SwordNests : _raidTables.ShieldNests;
         return(denDetails.ConvertToPKM(raidParameters, hash, TID, SID));
     }
 }
コード例 #11
0
        private static RaidParameters[] InitializeDenList(RaidSpawnList8 raids, RaidSpawnList8 raidsArmor, RaidSpawnList8 raidsCrown)
        {
            // current release has these numbers bugged
            int NormalUsed = raids.CountUsed;
            int ArmorUsed  = raidsArmor.CountUsed;
            int CrownUsed  = 86;

            var dl       = new RaidParameters[NormalUsed + ArmorUsed + CrownUsed];
            var allRaids = raids.GetAllRaids();

            for (int i = 0; i < NormalUsed; i++)
            {
                int idx         = i;
                var currentRaid = allRaids[i];
                var detail      = NestLocations.Nests[i];
                dl[idx] = new RaidParameters(idx, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }

            var allArmorRaids = raidsArmor.GetAllRaids();

            for (int i = 0; i < ArmorUsed; i++)
            {
                int idx         = NormalUsed + i;
                var currentRaid = allArmorRaids[i];
                var detail      = NestLocations.Nests[idx];
                dl[idx] = new RaidParameters(idx, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }

            var allCrownRaids = raidsCrown.GetAllRaids();

            for (int i = 0; i < CrownUsed; i++)
            {
                int idx         = NormalUsed + ArmorUsed + i;
                var currentRaid = allCrownRaids[i];
                var detail      = NestLocations.Nests[idx];
                dl[idx] = new RaidParameters(idx, currentRaid, detail.Location, detail.MapX, detail.MapY);
            }

            return(dl);
        }
コード例 #12
0
 public IEnumerable <RaidTemplate> GetAllTemplatesWithStarCount(RaidParameters raidParameters, int stars)
 {
     if (raidParameters.IsCrystal)
     {
         var tables = _raidTables.CrytalNestsEvent;
         var nest   = Array.Find(tables, table => table.TableID == 0);
         return(nest.Entries.AsEnumerable());
     }
     if (raidParameters.IsEvent)
     {
         var tables = Game == GameVersion.SW ? _raidTables.SwordNestsEvent : _raidTables.ShieldNestsEvent;
         var nest   = Array.Find(tables, table => table.TableID == NestLocations.EventHash);
         return(nest.Entries.Where(table => table.CanObtainWith(stars)));
     }
     else
     {
         var detail = NestLocations.Nests[raidParameters.Index];
         var tables = Game == GameVersion.SW ? _raidTables.SwordNests : _raidTables.ShieldNests;
         var common = Array.Find(tables, table => table.TableID == detail.CommonHash);
         var rare   = Array.Find(tables, table => table.TableID == detail.RareHash);
         return(common.Entries.Where(table => table.CanObtainWith(stars)).Union(rare.Entries.Where(table => table.CanObtainWith(stars))));
     }
 }
コード例 #13
0
        public static RaidPKM ConvertToPKM(this RaidTemplateTable raidTemplateTable, RaidParameters raidParameters, uint TID, uint SID)
        {
            var template = raidTemplateTable.Entries.GetTemplateFrom(raidParameters);

            return(template.ConvertToPKM(raidParameters.Seed, TID, SID));
        }
コード例 #14
0
        public static RaidPKM ConvertToPKM(this RaidTemplateTable[] denDetails, RaidParameters raidParameters, ulong hash, uint TID, uint SID)
        {
            var nest = Array.Find(denDetails, n => n.TableID == hash);

            return(nest.ConvertToPKM(raidParameters, TID, SID));
        }
コード例 #15
0
        public static RaidTemplate GetTemplateFrom(this IReadOnlyList <RaidTemplate> entries, RaidParameters param)
        {
            var index = entries.GetIndex(param.Stars, param.RandRoll);

            return(entries[index]);
        }