mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Add shiny1 batch editor, add ctrl-shiny (1)
GUI: Ctrl click star to get shiny1, shift click for shiny0, any-click to get random make Alt click modify the SID instead of PID add SetShinySID shiny type
This commit is contained in:
parent
36051e0f82
commit
9264150b2b
5 changed files with 32 additions and 20 deletions
|
@ -514,7 +514,7 @@ namespace PKHeX.Core
|
|||
else if (cmd.PropertyName == nameof(PKM.EncryptionConstant) && cmd.PropertyValue == nameof(PKM.PID))
|
||||
pk.EncryptionConstant = pk.PID;
|
||||
else if (cmd.PropertyName == nameof(PKM.PID) && cmd.PropertyValue.StartsWith(CONST_SHINY, true, CultureInfo.CurrentCulture))
|
||||
CommonEdits.SetShiny(pk, cmd.PropertyValue.EndsWith("0") ? Shiny.AlwaysSquare : Shiny.AlwaysStar);
|
||||
CommonEdits.SetShiny(pk, cmd.PropertyValue.EndsWith("0") ? Shiny.AlwaysSquare : cmd.PropertyValue.EndsWith("1") ? Shiny.AlwaysStar : Shiny.Random);
|
||||
else if (cmd.PropertyName == nameof(PKM.Species) && cmd.PropertyValue == "0")
|
||||
Array.Clear(pk.Data, 0, pk.Data.Length);
|
||||
else if (cmd.PropertyName.StartsWith("IV") && cmd.PropertyValue == CONST_RAND)
|
||||
|
|
|
@ -137,23 +137,19 @@ namespace PKHeX.Core
|
|||
/// <returns>Returns true if the <see cref="PKM"/> data was modified.</returns>
|
||||
public static bool SetShiny(PKM pk, Shiny type = Shiny.Random)
|
||||
{
|
||||
if (pk.IsShiny)
|
||||
if (pk.IsShiny && type.IsValid(pk))
|
||||
return false;
|
||||
|
||||
if (pk.FatefulEncounter || pk.Version == (int)GameVersion.GO || type == Shiny.Random)
|
||||
if (type == Shiny.Random || pk.FatefulEncounter || pk.Version == (int)GameVersion.GO || pk.Format <= 2)
|
||||
{
|
||||
pk.SetShiny();
|
||||
return true;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
pk.SetShiny();
|
||||
do { pk.SetShiny(); }
|
||||
while (!type.IsValid(pk));
|
||||
|
||||
var xor = pk.ShinyXor;
|
||||
if (type == Shiny.AlwaysSquare ? xor == 0 : xor != 0)
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -900,12 +900,20 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Applies a shiny <see cref="SID"/> to the <see cref="PKM"/>.
|
||||
/// </summary>
|
||||
public void SetShinySID()
|
||||
public void SetShinySID(Shiny shiny = Shiny.Random)
|
||||
{
|
||||
if (IsShiny)
|
||||
if (IsShiny && shiny.IsValid(this))
|
||||
return;
|
||||
|
||||
var xor = TID ^ (PID >> 16) ^ (PID & 0xFFFF);
|
||||
SID = (int)(xor & 0xFFF8) | Util.Rand.Next(8);
|
||||
var bits = shiny switch
|
||||
{
|
||||
Shiny.AlwaysSquare => 0,
|
||||
Shiny.AlwaysStar => 1,
|
||||
_ => Util.Rand.Next(8)
|
||||
};
|
||||
|
||||
SID = (int)xor ^ bits;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1439,11 +1439,11 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
private void UpdateShinyPID(object sender, EventArgs e)
|
||||
{
|
||||
var ShinyPID = Entity.Format <= 2 || ModifierKeys != Keys.Control;
|
||||
UpdateShiny(ShinyPID);
|
||||
var changePID = Entity.Format >= 3 && (ModifierKeys & Keys.Alt) == 0;
|
||||
UpdateShiny(changePID);
|
||||
}
|
||||
|
||||
private void UpdateShiny(bool PID)
|
||||
private void UpdateShiny(bool changePID)
|
||||
{
|
||||
Entity.PID = Util.GetHexValue(TB_PID.Text);
|
||||
Entity.Nature = WinFormsUtil.GetIndex(CB_Nature);
|
||||
|
@ -1453,9 +1453,15 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
if (Entity.Format > 2)
|
||||
{
|
||||
if (PID)
|
||||
var type = (ModifierKeys & ~Keys.Alt) switch
|
||||
{
|
||||
CommonEdits.SetShiny(Entity, ModifierKeys == Keys.Shift ? Shiny.AlwaysSquare : Shiny.AlwaysStar);
|
||||
Keys.Shift => Shiny.AlwaysSquare,
|
||||
Keys.Control => Shiny.AlwaysStar,
|
||||
_ => Shiny.Random
|
||||
};
|
||||
if (changePID)
|
||||
{
|
||||
CommonEdits.SetShiny(Entity, type);
|
||||
TB_PID.Text = Entity.PID.ToString("X8");
|
||||
|
||||
int gen = Entity.GenNumber;
|
||||
|
@ -1465,7 +1471,7 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
Entity.SetShinySID();
|
||||
Entity.SetShinySID(type);
|
||||
TID_Trainer.UpdateSID();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ Control + Click on...
|
|||
- PP Ups Label: Set all PP Ups to 0. (Click = 3)
|
||||
- Friendship Label: Set Friendship to 0. (Click = 255 or Base)
|
||||
- Level box: Set Level to 100.
|
||||
- Shiny Button: Make Star Shiny (Xor1)
|
||||
|
||||
Alt + Click on...
|
||||
- Preview Sprite to load from a QR url on your clipboard.
|
||||
|
@ -39,11 +40,12 @@ Alt + Click on...
|
|||
- Individual IVs: Set IV to 0.
|
||||
- Individual AVs: Set AV to 0.
|
||||
- Individual EVs: Set EV to 0.
|
||||
- Shiny Button: Set SID instead of PID when making shiny
|
||||
|
||||
Shift + Click on...
|
||||
- Preview Sprite to bring up a QR for the viewed Pokémon.
|
||||
- Individual IVs: Hyper Train the IV (toggles Hyper Training in Gen7 onwards)
|
||||
- Shiny Button: Make Square Shiny
|
||||
- Shiny Button: Make Square Shiny (Xor0)
|
||||
- Moves: Apply random moveset.
|
||||
|
||||
Hold Control when dragging to save encrypted (ekx).
|
||||
|
|
Loading…
Add table
Reference in a new issue