示例#1
0
文件: SMWE.cs 项目: tom-overton/pk3DS
        public static Bitmap GetTableImg(this EncounterTable table, Font font)
        {
            var img = new Bitmap(10 * 40, 10 * 30);

            using (var g = Graphics.FromImage(img))
            {
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
                for (int i = 0; i < table.Rates.Length; i++)
                {
                    g.DrawString($"{table.Rates[i]}%", font, Brushes.Black, new PointF((40 * i) + 10, 10));
                }
                g.DrawString("Weather: ", font, Brushes.Black, new PointF(10, 280));

                // Draw Sprites
                for (int i = 0; i < table.Encounter7s.Length - 1; i++)
                {
                    for (int j = 0; j < table.Encounter7s[i].Length; j++)
                    {
                        var slot   = table.Encounter7s[i][j];
                        var sprite = GetSprite((int)slot.Species, (int)slot.Forme);
                        g.DrawImage(sprite, new Point(40 * j, 30 * (i + 1)));
                    }
                }

                for (int i = 0; i < table.AdditionalSOS.Length; i++)
                {
                    var slot   = table.AdditionalSOS[i];
                    var sprite = GetSprite((int)slot.Species, (int)slot.Forme);
                    g.DrawImage(sprite, new Point((40 * i) + 60, 270));
                }
            }
        private void RandomizeTable7(EncounterTable Table, int slotStart, int slotStop)
        {
            int end = slotStop < 0 ? Table.Encounter7s.Length : slotStop;

            for (int s = slotStart; s < end; s++)
            {
                var EncounterSet = Table.Encounter7s[s];
                foreach (var enc in EncounterSet.Where(enc => enc.Species != 0))
                {
                    enc.Species = (uint)RandSpec.GetRandomSpecies((int)enc.Species);
                    enc.Forme   = (uint)RandForm.GetRandomForme((int)enc.Species);
                }
            }
        }
示例#3
0
文件: SMWE.cs 项目: nichan200/pk3DS
 private void LoadTable(EncounterTable table)
 {
     NUP_Min.Value   = table.MinLevel;
     NUP_Max.Minimum = table.MinLevel;
     NUP_Max.Value   = table.MaxLevel;
     for (int slot = 0; slot < table.Encounter7s.Length; slot++)
     {
         for (int i = 0; i < table.Encounter7s[slot].Length; i++)
         {
             var sl = table.Encounter7s[slot];
             if (slot == 8)
             {
                 sl = table.AdditionalSOS;
             }
             rate_spec[i].Value             = table.Rates[i];
             cb_spec[slot][i].SelectedIndex = (int)sl[i].Species;
             nup_spec[slot][i].Value        = (int)sl[i].Forme;
         }
     }
 }
示例#4
0
        private void UpdatePanel(object sender, EventArgs e)
        {
            if (loadingdata)
            {
                return;
            }
            loadingdata = true;
            var Map = Areas[CB_LocationID.SelectedIndex];

            GB_Encounters.Enabled = Map.HasTables;
            if (!Map.HasTables)
            {
                loadingdata = false;
                return;
            }
            CurrentTable    = new EncounterTable(Map.Tables[CB_TableID.SelectedIndex].Data);
            NUP_Min.Value   = CurrentTable.MinLevel;
            NUP_Max.Minimum = CurrentTable.MinLevel;
            NUP_Max.Value   = CurrentTable.MaxLevel;
            for (int slot = 0; slot < CurrentTable.Encounter7s.Length; slot++)
            {
                for (int i = 0; i < CurrentTable.Encounter7s[slot].Length; i++)
                {
                    var sl = CurrentTable.Encounter7s[slot];
                    if (slot == 8)
                    {
                        sl = CurrentTable.AdditionalSOS;
                    }
                    rate_spec[i].Value             = CurrentTable.Rates[i];
                    cb_spec[slot][i].SelectedIndex = (int)sl[i].Species;
                    nup_spec[slot][i].Value        = (int)sl[i].Forme;
                }
            }
            loadingdata = false;

            int base_id = CB_TableID.SelectedIndex / 2;

            base_id            *= 2;
            PB_DayTable.Image   = Map.Tables[base_id].GetTableImg(font);
            PB_NightTable.Image = Map.Tables[base_id + 1].GetTableImg(font);
        }
示例#5
0
文件: SMWE.cs 项目: nichan200/pk3DS
        private void UpdatePanel(object sender, EventArgs e)
        {
            if (loadingdata)
            {
                return;
            }
            loadingdata = true;

            var Map = Areas[CB_LocationID.SelectedIndex];

            GB_Encounters.Enabled = Map.HasTables;
            if (!Map.HasTables)
            {
                loadingdata = false;
                return;
            }
            CurrentTable = new EncounterTable(Map.Tables[CB_TableID.SelectedIndex].Data);
            LoadTable(CurrentTable);

            loadingdata = false;
            RefreshTableImages(Map);
        }