replace RareIcon when wallpaper is red (#928)

* use alt-redstar when wall is red

* add rare_icon_alt

* add rare_icon_alt

* Add files via upload
This commit is contained in:
pokecal 2017-03-09 01:46:25 +09:00 committed by Kaphotics
parent 0a1a30eb5a
commit 57c9b78108
4 changed files with 37 additions and 4 deletions

View file

@ -11,7 +11,7 @@ namespace PKHeX.WinForms
string str = PKX.getBallString(ball);
return (Image)Resources.ResourceManager.GetObject(str) ?? Resources._ball4; // Poké Ball (default)
}
public static Image getSprite(int species, int form, int gender, int item, bool isegg, bool shiny, int generation = -1)
public static Image getSprite(int species, int form, int gender, int item, bool isegg, bool shiny, int generation = -1, bool isBoxBGRed = false)
{
if (species == 0)
return Resources._0;
@ -35,6 +35,9 @@ namespace PKHeX.WinForms
if (shiny)
{
// Add shiny star to top left of image.
if (isBoxBGRed)
baseImage = ImageUtil.LayerImage(baseImage, Resources.rare_icon_alt, 0, 0, 0.7);
else
baseImage = ImageUtil.LayerImage(baseImage, Resources.rare_icon, 0, 0, 0.7);
}
if (item > 0)
@ -78,6 +81,10 @@ namespace PKHeX.WinForms
{
return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.SpriteItem, pkm.IsEgg, pkm.IsShiny, pkm.Format);
}
private static Image getSprite(PKM pkm, bool isBoxBGRed)
{
return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.SpriteItem, pkm.IsEgg, pkm.IsShiny, pkm.Format, isBoxBGRed);
}
private static Image getSprite(SaveFile SAV)
{
string file = "tr_00";
@ -95,7 +102,19 @@ namespace PKHeX.WinForms
if (!pkm.Valid)
return null;
var sprite = pkm.Species != 0 ? pkm.Sprite() : null;
bool isBoxBGRed = false;
if (SAV.Generation == 7 || SAV.Generation == 6)
{
switch (SAV.getBoxWallpaper(box))
{
case 5: // Volcano
case 12: // PokeCenter
case 20: // Special5 Flare/Magma
isBoxBGRed = true;
break;
}
}
var sprite = pkm.Species != 0 ? (isBoxBGRed ? pkm.Sprite(true) : pkm.Sprite()) : null;
if (flagIllegal && slot > -1)
{
pkm.Box = box;
@ -122,6 +141,7 @@ namespace PKHeX.WinForms
public static Image Sprite(this MysteryGift gift) => getSprite(gift);
public static Image Sprite(this SaveFile SAV) => getSprite(SAV);
public static Image Sprite(this PKM pkm) => getSprite(pkm);
public static Image Sprite(this PKM pkm, bool isBoxBGRed) => getSprite(pkm, isBoxBGRed);
public static Image Sprite(this PKM pkm, SaveFile SAV, int box, int slot, bool flagIllegal = false)
=> getSprite(pkm, SAV, box, slot, flagIllegal);
}

View file

@ -18223,6 +18223,16 @@ namespace PKHeX.Core.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap rare_icon_alt {
get {
object obj = ResourceManager.GetObject("rare_icon_alt", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to ID,3DS Region
///0,Japan (日本)

View file

@ -7447,4 +7447,7 @@
<data name="encounter_silver_h" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_silver_h.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="rare_icon_alt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\misc\rare_icon_alt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B