当前位置: 首页>>代码示例>>C#>>正文


C# PKHeX.PK6类代码示例

本文整理汇总了C#中PKHeX.PK6的典型用法代码示例。如果您正苦于以下问题:C# PK6类的具体用法?C# PK6怎么用?C# PK6使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PK6类属于PKHeX命名空间,在下文中一共展示了PK6类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: B_Save_Click

 private void B_Save_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < seen.Length; i++)
     {
         PKM tempPkm = new PK6();
         tempPkm.Species = i + 1;
         SAV.setSeen(tempPkm, seen[i]);
         SAV.setCaught(tempPkm, caught[i]);
     }
     SAV.Data.CopyTo(Main.SAV.Data, 0);
     Main.SAV.Edited = true;
     Close();
 }
开发者ID:goofwear,项目名称:PKHeX,代码行数:13,代码来源:SAV_SimplePokedex.cs

示例2: SAV_SimplePokedex

        public SAV_SimplePokedex()
        {
            InitializeComponent();
            Util.TranslateInterface(this, Main.curlanguage);
            seen = new bool[SAV.MaxSpeciesID];
            caught = new bool[SAV.MaxSpeciesID];

            string[] spec = Util.getSpeciesList(Main.curlanguage);
            for (int i = 0; i < seen.Length; i++)
            {
                PKM tempPkm = new PK6();
                tempPkm.Species = i + 1;
                seen[i] = SAV.getSeen(tempPkm);
                caught[i] = SAV.getCaught(tempPkm);
                CLB_Seen.Items.Add(spec[i + 1]);
                CLB_Caught.Items.Add(spec[i + 1]);
                CLB_Seen.SetItemChecked(i, seen[i]);
                CLB_Caught.SetItemChecked(i, caught[i]);
            }
            initialized = true;
        }
开发者ID:goofwear,项目名称:PKHeX,代码行数:21,代码来源:SAV_SimplePokedex.cs

示例3: pbBoxSlot_MouseDown

        // Drag & Drop within Box
        private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e)
        {
            if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Shift || ModifierKeys == (Keys.Control | Keys.Alt))
            { clickSlot(sender, e); return; }
            PictureBox pb = (PictureBox)(sender);
            if (pb.Image == null)
                return;

            pkm_from_slot = getSlot(sender);
            int offset = getPKXOffset(pkm_from_slot);
            if (e.Button != MouseButtons.Left || e.Clicks != 1) return;
            // Create Temp File to Drag
            string basepath = Application.StartupPath;
            Cursor.Current = Cursors.Hand;

            // Prepare Data
            pkm_from = SAV.getData(offset, PK6.SIZE_STORED);
            pkm_from_offset = offset;

            // Make a new file name based off the PID
            byte[] dragdata = PKX.decryptArray(pkm_from);
            Array.Resize(ref dragdata, PK6.SIZE_STORED);
            var pkx = new PK6(dragdata, "Boxes");
            string filename = pkx.Nickname;
            if (filename != specieslist[pkx.Species])
                filename += " (" + pkx.Species + ")";
            filename += " - " + pkx.PID + ".pk6";

            // Make File
            string newfile = Path.Combine(basepath, Util.CleanFileName(filename));
            try
            {
                File.WriteAllBytes(newfile, dragdata);

                string[] filesToDrag = { newfile };
                DoDragDrop(new DataObject(DataFormats.FileDrop, filesToDrag), DragDropEffects.Move);
                File.Delete(newfile); // after drop, delete the temporary file
            }
            catch (ArgumentException x)
            { Util.Error("Drag & Drop Error:", x.ToString()); }
            File.Delete(newfile);
            pkm_from_offset = 0;
        }
开发者ID:jaceyen,项目名称:PKHeX,代码行数:44,代码来源:f1-Main.cs

示例4: clickSet

        private void clickSet(object sender, EventArgs e)
        {
            if (!verifiedPKX()) { return; }
            int slot = getSlot(sender);
            if (slot == 30 && (CB_Species.SelectedIndex == 0 || CHK_IsEgg.Checked)) { Util.Alert("Can't have empty/egg first slot."); return; }
            int offset = getPKXOffset(slot);

            byte[] pkxdata = preparepkx();
            if (!SAV.ORAS)
            {
                PK6 pk = new PK6(pkxdata);
                // User Protection
                string err = "";
                if (pk.Moves.Any(m => m > 617))
                    err = "Move does not exist in X/Y.";
                else if (pk.Ability > 188)
                    err = "Ability does not exist in X/Y.";
                else if (pk.HeldItem > 717)
                    err = "Item does not exist in X/Y.";

                if ((err != "") && Util.Prompt(MessageBoxButtons.YesNo, err, "Continue?") != DialogResult.Yes)
                    return;
            }
            if (slot >= 30 && slot < 36) // Party
                SAV.setPK6Party(new PK6(pkxdata), offset);
            else if (slot < 30 || (slot >= 36 && slot < 42 && DEV_Ability.Enabled))
                SAV.setPK6Stored(new PK6(pkxdata), offset);
            else return;

            if (slot >= 30 && slot < 36)
                setParty();
            else
                getQuickFiller(SlotPictureBoxes[slot], pkxdata);

            getSlotColor(slot, Properties.Resources.slotSet);
        }
开发者ID:jaceyen,项目名称:PKHeX,代码行数:36,代码来源:f1-Main.cs

示例5: setPK6Stored

        public void setPK6Stored(PK6 pk6, int offset, bool? trade = null, bool? dex = null)
        {
            if (pk6 == null) return;
            if (trade ?? SetUpdatePK6)
                setPK6(pk6);
            if (dex ?? SetUpdateDex)
                setDex(pk6);

            setData(pk6.EncryptedBoxData, offset);
            Edited = true;
        }
开发者ID:suloku,项目名称:PKHeX,代码行数:11,代码来源:SAV6.cs

示例6: setEK6Stored

        public void setEK6Stored(byte[] ek6, int offset, bool? trade = null, bool? dex = null)
        {
            if (ek6 == null) return;
            PK6 pk6 = new PK6(decryptArray(ek6));
            if (trade ?? SetUpdatePK6)
                setPK6(pk6);
            if (dex ?? SetUpdateDex)
                setDex(pk6);

            Array.Resize(ref ek6, PK6.SIZE_STORED);
            setData(ek6, offset);
            Edited = true;
        }
开发者ID:suloku,项目名称:PKHeX,代码行数:13,代码来源:SAV6.cs

示例7: convertToPKM

        public override PKM convertToPKM(SaveFile SAV)
        {
            if (!IsPokémon)
                return null;

            int currentLevel = Level > 0 ? Level : (int)(Util.rnd32()%100 + 1);
            PK6 pk = new PK6
            {
                Species = Species,
                HeldItem = HeldItem,
                TID = TID,
                SID = SID,
                Met_Level = currentLevel,
                Nature = Nature != 0xFF ? Nature : (int)(Util.rnd32() % 25),
                Gender = PersonalTable.AO[Species].Gender == 255 ? 2 : (Gender != 3 ? Gender : PersonalTable.AO[Species].RandomGender),
                AltForm = Form,
                EncryptionConstant = EncryptionConstant == 0 ? Util.rnd32() : EncryptionConstant,
                Version = OriginGame == 0 ? SAV.Game : OriginGame,
                Language = Language == 0 ? SAV.Language : Language,
                Ball = Ball,
                Country = SAV.Country,
                Region = SAV.SubRegion,
                ConsoleRegion = SAV.ConsoleRegion,
                Move1 = Move1, Move2 = Move2, Move3 = Move3, Move4 = Move4,
                RelearnMove1 = RelearnMove1, RelearnMove2 = RelearnMove2,
                RelearnMove3 = RelearnMove3, RelearnMove4 = RelearnMove4,
                Met_Location = MetLocation,
                Egg_Location = EggLocation,
                CNT_Cool = CNT_Cool,
                CNT_Beauty = CNT_Beauty,
                CNT_Cute = CNT_Cute,
                CNT_Smart = CNT_Smart,
                CNT_Tough = CNT_Tough,
                CNT_Sheen = CNT_Sheen,

                OT_Name = OT.Length > 0 ? OT : SAV.OT,
                OT_Gender = OTGender != 3 ? OTGender % 2 : SAV.Gender,
                HT_Name = OT.Length > 0 ? SAV.OT : "",
                HT_Gender = OT.Length > 0 ? SAV.Gender : 0,
                CurrentHandler = OT.Length > 0 ? 1 : 0,

                EXP = PKX.getEXP(Level, Species),

                // Ribbons
                RibbonCountry = RibbonCountry,
                RibbonNational = RibbonNational,

                RibbonEarth = RibbonEarth,
                RibbonWorld = RibbonWorld,
                RibbonClassic = RibbonClassic,
                RibbonPremier = RibbonPremier,
                RibbonEvent = RibbonEvent,
                RibbonBirthday = RibbonBirthday,
                RibbonSpecial = RibbonSpecial,
                RibbonSouvenir = RibbonSouvenir,

                RibbonWishing = RibbonWishing,
                RibbonChampionBattle = RibbonChampionBattle,
                RibbonChampionRegional = RibbonChampionRegional,
                RibbonChampionNational = RibbonChampionNational,
                RibbonChampionWorld = RibbonChampionWorld,

                OT_Friendship = PersonalTable.AO[Species].BaseFriendship,
                OT_Intensity = OT_Intensity,
                OT_Memory = OT_Memory,
                OT_TextVar = OT_TextVar,
                OT_Feeling = OT_Feeling,
                FatefulEncounter = true,
            };
            pk.Move1_PP = pk.getMovePP(Move1, 0);
            pk.Move2_PP = pk.getMovePP(Move2, 0);
            pk.Move3_PP = pk.getMovePP(Move3, 0);
            pk.Move4_PP = pk.getMovePP(Move4, 0);

            if (Date.HasValue)
            {
                pk.MetDate = Date.Value;
            }
            else
            {
                // No datetime set, typical for wc6full
                // Set it to now, instead of zeroing it out.
                pk.MetDate = DateTime.Now;
            }

            if (pk.CurrentHandler == 0) // OT
            {
                pk.OT_Memory = 3;
                pk.OT_TextVar = 9;
                pk.OT_Intensity = 1;
                pk.OT_Feeling = Util.rand.Next(0, 9);
            }
            else
            {
                pk.HT_Memory = 3;
                pk.HT_TextVar = 9;
                pk.HT_Intensity = 1;
                pk.HT_Feeling = Util.rand.Next(0, 9);
                pk.HT_Friendship = pk.OT_Friendship;
            }
//.........这里部分代码省略.........
开发者ID:goofwear,项目名称:PKHeX,代码行数:101,代码来源:WC6.cs

示例8: dragout_MouseDown

        // Decrypted Export
        private void dragout_MouseDown(object sender, MouseEventArgs e)
        {
            if (!verifiedPKX()) { return; }
            {
                // Create Temp File to Drag
                Cursor.Current = Cursors.Hand;

                // Make a new file name
                byte[] dragdata = preparepkx();
                var pkx = new PK6(dragdata, "Tabs");
                string filename = Path.GetFileNameWithoutExtension(pkx.FileName) + ((e.Button == MouseButtons.Right) ? ".ek6" : ".pk6");
                dragdata = (e.Button == MouseButtons.Right) ? PKX.encryptArray(preparepkx()) : preparepkx();
                // Strip out party stats (if they are there)
                Array.Resize(ref dragdata, PK6.SIZE_STORED);
                // Make file
                string newfile = Path.Combine(Path.GetTempPath(), Util.CleanFileName(filename));
                try
                {
                    File.WriteAllBytes(newfile, dragdata);
                    DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move);
                }
                catch (Exception x)
                { Util.Error("Drag & Drop Error", x.ToString()); }
                File.Delete(newfile);
            }
        }
开发者ID:CocoaHoo,项目名称:PKHeX,代码行数:27,代码来源:f1-Main.cs

示例9: convertToPK6

        public PK6 convertToPK6(SAV6 SAV)
        {
            if (!IsPokémon)
                return null;

            int currentLevel = Level > 0 ? Level : (int)(Util.rnd32()%100 + 1);
            PK6 pk = new PK6
            {
                Species = Species,
                HeldItem = HeldItem,
                TID = TID,
                SID = SID,
                Met_Level = currentLevel,
                Nature = Nature != 0xFF ? Nature : (int)(Util.rnd32() % 25),
                Gender = PKX.Personal[Species].Gender == 255 ? 2 : (Gender != 3 ? Gender : PKX.Personal[Species].RandomGender),
                AltForm = Form,
                EncryptionConstant = EncryptionConstant == 0 ? Util.rnd32() : EncryptionConstant,
                Version = OriginGame == 0 ? SAV.Game : OriginGame,
                Language = Language == 0 ? SAV.Language : Language,
                Ball = Pokéball,
                Country = SAV.Country,
                Region = SAV.SubRegion,
                ConsoleRegion = SAV.ConsoleRegion,
                Move1 = Move1, Move2 = Move2, Move3 = Move3, Move4 = Move4,
                Move1_PP = PKX.getBasePP(Move1),
                Move2_PP = PKX.getBasePP(Move2),
                Move3_PP = PKX.getBasePP(Move3),
                Move4_PP = PKX.getBasePP(Move4),
                RelearnMove1 = RelearnMove1, RelearnMove2 = RelearnMove2,
                RelearnMove3 = RelearnMove3, RelearnMove4 = RelearnMove4,
                Met_Location = MetLocation,
                Egg_Location = EggLocation,
                CNT_Cool = CNT_Cool,
                CNT_Beauty = CNT_Beauty,
                CNT_Cute = CNT_Cute,
                CNT_Smart = CNT_Smart,
                CNT_Tough = CNT_Tough,
                CNT_Sheen = CNT_Sheen,

                OT_Name = OT.Length > 0 ? OT : SAV.OT,
                OT_Gender = OTGender != 3 ? OTGender % 2 : SAV.Gender,
                HT_Name = OT.Length > 0 ? SAV.OT : "",
                HT_Gender = OT.Length > 0 ? SAV.Gender : 0,
                CurrentHandler = OT.Length > 0 ? 1 : 0,
                
                EXP = PKX.getEXP(Level, Species),

                // Ribbons
                RIB2_6 = RIB0_3, // Country Ribbon
                RIB2_7 = RIB0_4, // National Ribbon

                RIB3_0 = RIB0_5, // Earth Ribbon
                RIB3_1 = RIB0_6, // World Ribbon
                RIB3_2 = RIB1_5, // Classic Ribbon
                RIB3_3 = RIB1_6, // Premier Ribbon
                RIB3_4 = RIB0_7, // Event Ribbon
                RIB3_5 = RIB1_1, // Birthday Ribbon
                RIB3_6 = RIB1_2, // Special Ribbon
                RIB3_7 = RIB1_3, // Souvenir Ribbon

                RIB4_0 = RIB1_4, // Wishing Ribbon
                RIB4_1 = RIB0_0, // Battle Champ Ribbon
                RIB4_2 = RIB0_1, // Regional Champ Ribbon
                RIB4_3 = RIB0_2, // National Champ Ribbon
                RIB4_4 = RIB1_0, // World Champ Ribbon
                
                OT_Friendship = PKX.getBaseFriendship(Species),
                FatefulEncounter = true,
            };

            if (Day + Month + Year == 0) // No datetime set, typical for wc6full
            {
                DateTime dt = DateTime.Now;
                pk.Met_Day = dt.Day;
                pk.Met_Month = dt.Month;
                pk.Met_Year = dt.Year - 2000;
            }
            else
            {
                pk.Met_Day = (int)Day;
                pk.Met_Month = (int)Month;
                pk.Met_Year = (int)(Year - 2000);
            }

            if (pk.CurrentHandler == 0) // OT
            {
                pk.OT_Memory = 3;
                pk.OT_TextVar = 9;
                pk.OT_Intensity = 1;
                pk.OT_Feeling = Util.rand.Next(0, 9);
            }
            else
            {
                pk.HT_Memory = 3;
                pk.HT_TextVar = 9;
                pk.HT_Intensity = 1;
                pk.HT_Feeling = Util.rand.Next(0, 9);
                pk.HT_Friendship = pk.OT_Friendship;
            }
            pk.IsNicknamed = IsNicknamed;
//.........这里部分代码省略.........
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:101,代码来源:WC6.cs

示例10: changeMainLanguage

 // Language Translation
 private void changeMainLanguage(object sender, EventArgs e)
 {
     PK6 pk = new PK6((fieldsInitialized ? preparepkx() : pk6).Data);
     bool alreadyInit = fieldsInitialized;
     fieldsInitialized = false;
     Menu_Options.DropDown.Close();
     InitializeStrings();
     InitializeLanguage();
     Util.TranslateInterface(this, lang_val[CB_MainLanguage.SelectedIndex]); // Translate the UI to language.
     populateFields(pk); // put data back in form
     fieldsInitialized |= alreadyInit;
 }
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:13,代码来源:f1-Main.cs

示例11: clickShowdownImportPK6

        // Misc Options
        private void clickShowdownImportPK6(object sender, EventArgs e)
        {
            if (!formInitialized)
                return;
            if (!Clipboard.ContainsText())
            { Util.Alert("Clipboard does not contain text."); return; }

            // Get Simulator Data
            PKX.ShowdownSet Set = new PKX.ShowdownSet(Clipboard.GetText());

            if (Set.Species < 0)
            { Util.Alert("Set data not found in clipboard."); return; }

            if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Import this set?", Clipboard.GetText())) 
            { return; }

            // Set Species & Nickname
            CB_Species.SelectedValue = Set.Species;
            CHK_Nicknamed.Checked = Set.Nickname != null;
            if (Set.Nickname != null)
                TB_Nickname.Text = Set.Nickname;
            if (Set.Gender != null && PKX.getGender(Set.Gender) != 2 && PKX.getGender(Set.Gender) != 2)
            {
                int Gender = PKX.getGender(Set.Gender);
                Label_Gender.Text = gendersymbols[Gender];
                Label_Gender.ForeColor = Gender == 2 ? Label_Species.ForeColor : (Gender == 1 ? Color.Red : Color.Blue);
            }

            // Set Form
            string[] formStrings = PKX.getFormList(Set.Species,
                Util.getStringList("types", "en"),
                Util.getStringList("forms", "en"), gendersymbols);
            int form = 0;
            for (int i = 0; i < formStrings.Length; i++)
                if (formStrings[i].Contains(Set.Form ?? ""))
                { form = i; break; }
            CB_Form.SelectedIndex = form;

            // Set Ability
            byte[] abilities = PKX.getAbilities(Set.Species, form);
            int ability = Array.IndexOf(abilities, (byte)Set.Ability);
            if (ability < 0) ability = 0;
            CB_Ability.SelectedIndex = ability;
            ComboBox[] m = { CB_Move1, CB_Move2, CB_Move3, CB_Move4, };
            for (int i = 0; i < 4; i++) m[i].SelectedValue = Set.Moves[i];

            // Set Item and Nature
            CB_HeldItem.SelectedValue = Set.Item < 0 ? 0 : Set.Item;
            CB_Nature.SelectedValue = Set.Nature < 0 ? 0 : Set.Nature;

            // Set IVs
            TB_HPIV.Text = Set.IVs[0].ToString();
            TB_ATKIV.Text = Set.IVs[1].ToString();
            TB_DEFIV.Text = Set.IVs[2].ToString();
            TB_SPAIV.Text = Set.IVs[3].ToString();
            TB_SPDIV.Text = Set.IVs[4].ToString();
            TB_SPEIV.Text = Set.IVs[5].ToString();

            // Set EVs
            TB_HPEV.Text = Set.EVs[0].ToString();
            TB_ATKEV.Text = Set.EVs[1].ToString();
            TB_DEFEV.Text = Set.EVs[2].ToString();
            TB_SPAEV.Text = Set.EVs[3].ToString();
            TB_SPDEV.Text = Set.EVs[4].ToString();
            TB_SPEEV.Text = Set.EVs[5].ToString();

            // Set Level and Friendship
            TB_Level.Text = Set.Level.ToString();
            TB_Friendship.Text = Set.Friendship.ToString();

            // Reset IV/EVs
            BTN_RerollPID.PerformClick();
            BTN_RerollEC.PerformClick();
            if (Set.Shiny) BTN_Shinytize.PerformClick();
            pk6 = preparepkx();
            updateLegality();
        }
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:78,代码来源:f1-Main.cs

示例12: getQuickFiller

        private void getQuickFiller(PictureBox pb, PK6 pk = null)
        {
            if (!fieldsInitialized) return;
            pk = pk ?? preparepkx(false); // don't perform control loss click

            if (pb == dragout) mnuLQR.Enabled = pk.Species != 0; // Species
            pb.Image = pk.Sprite;
            if (pb.BackColor == Color.Red)
                pb.BackColor = Color.Transparent;
        }
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:10,代码来源:f1-Main.cs

示例13: clickClone

        private void clickClone(object sender, EventArgs e)
        {
            if (getSlot(sender) > 30) return; // only perform action if cloning to boxes
            if (!verifiedPKX()) return; // don't copy garbage to the box

            PK6 pk;
            int box = CB_BoxSelect.SelectedIndex + 1; // get box we're cloning to

            if (Util.Prompt(MessageBoxButtons.YesNo, $"Clone Pokemon from Editing Tabs to all slots in Box {box}?") == DialogResult.Yes)
                pk = preparepkx();
            else if (Util.Prompt(MessageBoxButtons.YesNo, $"Delete Pokemon from all slots in Box {box}?") == DialogResult.Yes)
                pk = new PK6();
            else
                return; // abort clone/delete

            for (int i = 0; i < 30; i++) // write encrypted array to all box slots
            {
                SAV.setPK6Stored(pk, getPKXOffset(i));
                getQuickFiller(SlotPictureBoxes[i], pk);
            }
        }
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:21,代码来源:f1-Main.cs

示例14: showLegality

 private void showLegality(PK6 pk, bool tabs, bool verbose)
 {
     LegalityAnalysis la = new LegalityAnalysis(pk);
     if (tabs)
         updateLegality(la);
     Util.Alert(verbose ? la.VerboseReport : la.Report);
 }
开发者ID:gnmmarechal,项目名称:PKHeX_unleashed,代码行数:7,代码来源:f1-Main.cs

示例15: getQuickFiller

        private void getQuickFiller(PictureBox pb, PK6 pk = null)
        {
            if (!fieldsInitialized) return;
            pk = pk ?? preparepkx(false); // don't perform control loss click

            if (pb == dragout) L_QR.Visible = pk.Species != 0; // Species
            pb.Image = pk.Sprite;
        }
开发者ID:Bluestar012,项目名称:PKHeX,代码行数:8,代码来源:f1-Main.cs


注:本文中的PKHeX.PK6类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。