コード例 #1
0
        public DenIVs(int idx, DenManager dm)
        {
            InitializeComponent();
            this.dm = dm;
            Den den = dm.GetDen(idx);

            seedBox.Text         = den.seed.ToString("X");
            denBox.SelectedIndex = idx;
        }
コード例 #2
0
        public IEnumerable <Entry> GetAllEntriesWithStarcount(Den den, int stars)
        {
            Nest[] denDetails;
            ulong  hash;

            if (den.event_den)
            {
                denDetails = this.game == GameVersion.SW ? nestDetails.SwordNestsEvent : nestDetails.ShieldNestsEvent;
                Nest res = denDetails.Where(nest => nest.TableID == DenEventHash).FirstOrDefault();
                return(res.entries.Where(nest => nest.Probabilities[stars] > 0));
            }
            else
            {
                ulong[] hashes = DenHashes[den.idx];
                denDetails = this.game == GameVersion.SW ? nestDetails.SwordNests : nestDetails.ShieldNests;
                Nest res  = denDetails.Where(nest => nest.TableID == hashes[0]).FirstOrDefault();
                Nest res2 = denDetails.Where(nest => nest.TableID == hashes[1]).FirstOrDefault();
                return(res.entries.Where(nest => nest.Probabilities[stars] > 0).Union(res2.entries.Where(nest => nest.Probabilities[stars] > 0)));
            }
        }
コード例 #3
0
        private void denBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Den den = dm.GetDen(denBox.SelectedIndex);

            this.seedBox.Text = den.seed.ToString("X");
            this.speciesList.Items.Clear();
            var s = GameInfo.Strings;

            for (int stars = min_stars[dm.badges]; stars <= max_stars[dm.badges]; stars++)
            {
                var entries = dm.GetAllEntriesWithStarcount(den, stars);
                foreach (var entry in entries)
                {
                    ComboboxItem item = new ComboboxItem();
                    item.Text  = string.Format("{0}\u2605 {1}", stars + 1, s.Species[entry.Species]);
                    item.Value = entry;
                    this.speciesList.Items.Add(item);
                }
            }
            speciesList.SelectedIndex = 0;
        }
コード例 #4
0
        public Pkmn GetPkmnFromDen(Den den)
        {
            Nest[] denDetails;
            ulong  hash;

            if (den.event_den)
            {
                hash       = DenEventHash;
                denDetails = this.game == GameVersion.SW ? nestDetails.SwordNestsEvent : nestDetails.ShieldNestsEvent;
            }
            else
            {
                ulong[] hashes = DenHashes[den.idx];
                hash       = den.rare_den ? hashes[1] : hashes[0];
                denDetails = this.game == GameVersion.SW ? nestDetails.SwordNests : nestDetails.ShieldNests;
            }
            Nest  res  = denDetails.Where(nest => nest.TableID == hash).FirstOrDefault();
            Entry pkmn = getPkmn(res.entries, den.stars, den.roll);

            return(GetPkmnFromDetails(den.seed, pkmn));
        }
コード例 #5
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Den den = dm.GetDen(denBox.SelectedIndex);
            Pkmn pkmn = dm.GetPkmnFromDen(den);
            activeBox.Checked = den.active_den;
            rareBox.Checked = den.rare_den;
            EventBox.Checked = den.event_den;
            denSeed.Text = den.seed.ToString("X");

            // draw stars
            var star = "\u2605";
            var output = star;
            for (int i = 0; i < den.stars; i++) output += star;
            StarLbl.Text = output;
            
            var s = GameInfo.Strings;
            abilityLbl.Text = s.Ability[pkmn.ability];

            natureLbl.Text = s.natures[pkmn.nature];
            TextBox[] ivtextw = { TB_HP_IV1, TB_ATK_IV1, TB_DEF_IV1, TB_SPA_IV1, TB_SPD_IV1, TB_SPE_IV1 };
            for(int i=0; i < 6; i++)
            {
                ivtextw[i].Text = pkmn.ivs[i].ToString();
            }

            Image sprite = PKHeX.Drawing.SpriteUtil.GetSprite(pkmn.species, pkmn.form, pkmn.gender, 0, false, pkmn.shinytype > 0);
            if (pkmn.isGigantamax)
            {
                var gm = Properties.Resources.dyna;
                sprite = ImageUtil.LayerImage(sprite, gm, (sprite.Width - gm.Width) / 2, 0);
            }
            if (!activeBox.Checked)
            {
                sprite = MakeGrayscale((Bitmap) sprite);
            }
            PB_PK1.BackgroundImage = sprite;
            shinyframes.Text = shiny_in(den.seed).ToString();
            locationLabel.Text = den.location;
        }
コード例 #6
0
        public DenManager(RaidSpawnList8 raids, GameVersion game, int badges, uint tid, uint sid)
        {
            this.raids  = raids;
            this.game   = game;
            this.badges = NumberOfSetBits(badges);
            this.tid    = tid;
            this.sid    = sid;

            this.denList = new Den[99];
            var allRaids = raids.GetAllRaids();

            for (int i = 0; i < 99; i++)
            {
                int idx = i;
                if (idx >= 15)
                {
                    idx++;
                }
                var currentRaid = allRaids[idx];
                Den den         = new Den(i, currentRaid.Seed, currentRaid.Stars, currentRaid.RandRoll, currentRaid.Flags, currentRaid.DenType, (int)DenHashes[i][2]);
                this.denList[i] = den;
            }
        }