-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
4,460 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
using PKHeX.Core; | ||
using System.Collections.Generic; | ||
using WangPlugin.SortBase; | ||
namespace WangPlugin.Plugins | ||
{ | ||
internal class SortPlugin: WangPlugin | ||
{ | ||
public override string Name => "排序/Sort"; | ||
public override int Priority => 6; | ||
|
||
|
||
|
||
protected override void AddPluginControl(ToolStripDropDownItem modmenu) | ||
{ | ||
int gen = SaveFileEditor.SAV.Generation; | ||
GameVersion version = SaveFileEditor.SAV.Version; | ||
bool isLetsGo = version == GameVersion.GP || version == GameVersion.GE; | ||
|
||
modmenu.DropDownItems.RemoveByKey("SortBoxesBy"); | ||
ToolStripMenuItem sortBoxesItem = new ToolStripMenuItem("全部箱子排序/All Boxes Sort") | ||
{ | ||
Name = "全部箱子排序/All Boxes Sort" | ||
}; | ||
sortBoxesItem.Image = Properties.Resources.Sort; | ||
modmenu.DropDownItems.Add(sortBoxesItem); | ||
ToolStripItemCollection sortItems = sortBoxesItem.DropDownItems; | ||
if (isLetsGo) | ||
{ | ||
sortItems.Add(GetSortButton("Gen 7 关东图鉴(去皮去伊)", Gen7_Kanto.GetSortFunctions())); | ||
} | ||
else | ||
{ | ||
bool isSwSh = version == GameVersion.SW || version == GameVersion.SH; | ||
bool isBDSP = version == GameVersion.BD || version == GameVersion.SP; | ||
bool isPLA = version == GameVersion.PLA; | ||
if (gen != 1) | ||
{ | ||
ToolStripMenuItem sortButton = new ToolStripMenuItem("按照全国图鉴排序"); | ||
sortButton.Click += (s, e) => SortByNationalDex(); | ||
sortItems.Add(sortButton); | ||
} | ||
if (gen >= 1) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 1关东图鉴(红黄蓝绿)排序", Gen1_Kanto.GetSortFunctions())); | ||
|
||
} | ||
|
||
if (gen >= 2) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 2 城都图鉴(金银)排序", Gen2_Johto.GetSortFunctions())); | ||
} | ||
|
||
if (gen >= 3) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 3 丰缘图鉴(红,蓝,绿宝石)排序", Gen3_Hoenn.GetSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 3 关东图鉴(火红叶绿)排序", Gen3_Kanto.GetSortFunctions())); | ||
} | ||
|
||
if (gen >= 4) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 4 神奥图鉴(珍珠钻石)排序", Gen4_Sinnoh.GetDPSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 4 神奥图鉴(白金)排序", Gen4_Sinnoh.GetPtSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 4 城都图鉴(心金魂银)排序", Gen4_Johto.GetSortFunctions())); | ||
} | ||
|
||
if (gen >= 5 && !isBDSP) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 5 合众图鉴(黑白)排序", Gen5_Unova.GetBWSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 5 合众图鉴(黑2白2)排序", Gen5_Unova.GetB2W2SortFunctions())); | ||
} | ||
|
||
if (gen >= 6 && !isBDSP) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 6 卡洛斯排序", Gen6_Kalos.GetSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 6 丰缘(始源红宝石,蓝宝石)排序", Gen6_Hoenn.GetSortFunctions())); | ||
} | ||
|
||
if (gen >= 7 && !isBDSP && !isPLA) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 7 阿罗拉(太阳月亮)排序", Gen7_Alola.GetFullSMSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 7 阿罗拉(究极太阳究极月亮)排序", Gen7_Alola.GetFullUSUMSortFunctions())); | ||
} | ||
|
||
if (gen >= 8) | ||
{ | ||
if (isSwSh) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 7 关东(去皮去伊)排序", Gen7_Kanto.GetSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 8 伽勒尔排序", Gen8_Galar.GetGalarDexSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 8 伽勒尔(铠岛)排序", Gen8_Galar.GetIoADexSortFunctions())); | ||
sortItems.Add(GetSortButton("按照Gen 8 伽勒尔(冰冠)排序", Gen8_Galar.GetCTDexSortFunction())); | ||
sortItems.Add(GetSortButton("按照Gen 8 伽勒尔完整排序", Gen8_Galar.GetFullGalarDexSortFunctions())); | ||
} | ||
else if (isBDSP) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 8 神奥(珍钻复刻)排序", Gen8_Sinnoh.GetSortFunctions())); | ||
} | ||
else if (isPLA) | ||
{ | ||
sortItems.Add(GetSortButton("按照Gen 8 洗翠排序", Gen8_Hisui.GetSortFunctions())); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
} | ||
private ToolStripDropDownItem GetSortButton(string dex, Func<PKM, IComparable>[] sortFunctions) | ||
{ | ||
ToolStripMenuItem dexSortButton = new ToolStripMenuItem($"{dex}(地区图鉴)"); | ||
dexSortButton.Click += (s, e) => SortByRegionalDex(sortFunctions); | ||
return dexSortButton; | ||
} | ||
private void SortByRegionalDex(Func<PKM, IComparable>[] sortFunctions) | ||
{ | ||
IEnumerable<PKM> sortMethod(IEnumerable<PKM> pkms, int i) => pkms.OrderByCustom(sortFunctions); | ||
SaveFileEditor.SAV.SortBoxes(0, -1, sortMethod); | ||
SaveFileEditor.ReloadSlots(); | ||
} | ||
|
||
private void SortByNationalDex() | ||
{ | ||
SaveFileEditor.SAV.SortBoxes(); | ||
SaveFileEditor.ReloadSlots(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
using PKHeX.Core; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace WangPlugin.SortBase | ||
{ | ||
internal class Gen1_Kanto : SortingBase | ||
{ | ||
|
||
protected static readonly Dictionary<Species, int> dex = new Dictionary<Species, int>() { | ||
{Species.Bulbasaur, 1}, | ||
{Species.Ivysaur, 2}, | ||
{Species.Venusaur, 3}, | ||
{Species.Charmander, 4}, | ||
{Species.Charmeleon, 5}, | ||
{Species.Charizard, 6}, | ||
{Species.Squirtle, 7}, | ||
{Species.Wartortle, 8}, | ||
{Species.Blastoise, 9}, | ||
{Species.Caterpie, 10}, | ||
{Species.Metapod, 11}, | ||
{Species.Butterfree, 12}, | ||
{Species.Weedle, 13}, | ||
{Species.Kakuna, 14}, | ||
{Species.Beedrill, 15}, | ||
{Species.Pidgey, 16}, | ||
{Species.Pidgeotto, 17}, | ||
{Species.Pidgeot, 18}, | ||
{Species.Rattata, 19}, | ||
{Species.Raticate, 20}, | ||
{Species.Spearow, 21}, | ||
{Species.Fearow, 22}, | ||
{Species.Ekans, 23}, | ||
{Species.Arbok, 24}, | ||
{Species.Pikachu, 25}, | ||
{Species.Raichu, 26}, | ||
{Species.Sandshrew, 27}, | ||
{Species.Sandslash, 28}, | ||
{Species.NidoranF, 29}, | ||
{Species.Nidorina, 30}, | ||
{Species.Nidoqueen, 31}, | ||
{Species.NidoranM, 32}, | ||
{Species.Nidorino, 33}, | ||
{Species.Nidoking, 34}, | ||
{Species.Clefairy, 35}, | ||
{Species.Clefable, 36}, | ||
{Species.Vulpix, 37}, | ||
{Species.Ninetales, 38}, | ||
{Species.Jigglypuff, 39}, | ||
{Species.Wigglytuff, 40}, | ||
{Species.Zubat, 41}, | ||
{Species.Golbat, 42}, | ||
{Species.Oddish, 43}, | ||
{Species.Gloom, 44}, | ||
{Species.Vileplume, 45}, | ||
{Species.Paras, 46}, | ||
{Species.Parasect, 47}, | ||
{Species.Venonat, 48}, | ||
{Species.Venomoth, 49}, | ||
{Species.Diglett, 50}, | ||
{Species.Dugtrio, 51}, | ||
{Species.Meowth, 52}, | ||
{Species.Persian, 53}, | ||
{Species.Psyduck, 54}, | ||
{Species.Golduck, 55}, | ||
{Species.Mankey, 56}, | ||
{Species.Primeape, 57}, | ||
{Species.Growlithe, 58}, | ||
{Species.Arcanine, 59}, | ||
{Species.Poliwag, 60}, | ||
{Species.Poliwhirl, 61}, | ||
{Species.Poliwrath, 62}, | ||
{Species.Abra, 63}, | ||
{Species.Kadabra, 64}, | ||
{Species.Alakazam, 65}, | ||
{Species.Machop, 66}, | ||
{Species.Machoke, 67}, | ||
{Species.Machamp, 68}, | ||
{Species.Bellsprout, 69}, | ||
{Species.Weepinbell, 70}, | ||
{Species.Victreebel, 71}, | ||
{Species.Tentacool, 72}, | ||
{Species.Tentacruel, 73}, | ||
{Species.Geodude, 74}, | ||
{Species.Graveler, 75}, | ||
{Species.Golem, 76}, | ||
{Species.Ponyta, 77}, | ||
{Species.Rapidash, 78}, | ||
{Species.Slowpoke, 79}, | ||
{Species.Slowbro, 80}, | ||
{Species.Magnemite, 81}, | ||
{Species.Magneton, 82}, | ||
{Species.Farfetchd, 83}, | ||
{Species.Doduo, 84}, | ||
{Species.Dodrio, 85}, | ||
{Species.Seel, 86}, | ||
{Species.Dewgong, 87}, | ||
{Species.Grimer, 88}, | ||
{Species.Muk, 89}, | ||
{Species.Shellder, 90}, | ||
{Species.Cloyster, 91}, | ||
{Species.Gastly, 92}, | ||
{Species.Haunter, 93}, | ||
{Species.Gengar, 94}, | ||
{Species.Onix, 95}, | ||
{Species.Drowzee, 96}, | ||
{Species.Hypno, 97}, | ||
{Species.Krabby, 98}, | ||
{Species.Kingler, 99}, | ||
{Species.Voltorb, 100}, | ||
{Species.Electrode, 101}, | ||
{Species.Exeggcute, 102}, | ||
{Species.Exeggutor, 103}, | ||
{Species.Cubone, 104}, | ||
{Species.Marowak, 105}, | ||
{Species.Hitmonlee, 106}, | ||
{Species.Hitmonchan, 107}, | ||
{Species.Lickitung, 108}, | ||
{Species.Koffing, 109}, | ||
{Species.Weezing, 110}, | ||
{Species.Rhyhorn, 111}, | ||
{Species.Rhydon, 112}, | ||
{Species.Chansey, 113}, | ||
{Species.Tangela, 114}, | ||
{Species.Kangaskhan, 115}, | ||
{Species.Horsea, 116}, | ||
{Species.Seadra, 117}, | ||
{Species.Goldeen, 118}, | ||
{Species.Seaking, 119}, | ||
{Species.Staryu, 120}, | ||
{Species.Starmie, 121}, | ||
{Species.MrMime, 122}, | ||
{Species.Scyther, 123}, | ||
{Species.Jynx, 124}, | ||
{Species.Electabuzz, 125}, | ||
{Species.Magmar, 126}, | ||
{Species.Pinsir, 127}, | ||
{Species.Tauros, 128}, | ||
{Species.Magikarp, 129}, | ||
{Species.Gyarados, 130}, | ||
{Species.Lapras, 131}, | ||
{Species.Ditto, 132}, | ||
{Species.Eevee, 133}, | ||
{Species.Vaporeon, 134}, | ||
{Species.Jolteon, 135}, | ||
{Species.Flareon, 136}, | ||
{Species.Porygon, 137}, | ||
{Species.Omanyte, 138}, | ||
{Species.Omastar, 139}, | ||
{Species.Kabuto, 140}, | ||
{Species.Kabutops, 141}, | ||
{Species.Aerodactyl, 142}, | ||
{Species.Snorlax, 143}, | ||
{Species.Articuno, 144}, | ||
{Species.Zapdos, 145}, | ||
{Species.Moltres, 146}, | ||
{Species.Dratini, 147}, | ||
{Species.Dragonair, 148}, | ||
{Species.Dragonite, 149}, | ||
{Species.Mewtwo, 150}, | ||
{Species.Mew, 151}, | ||
}; | ||
|
||
public static Func<PKM, IComparable>[] GetSortFunctions() | ||
{ | ||
return GenerateSortingFunctions(dex); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.