Skip to content

Commit 53d9f7d

Browse files
authored
Fix issue with Pokemon type emojis being empty if pulled form Pokemon from game master. (#289)
1 parent 0c34765 commit 53d9f7d

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/Data/GameMaster.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public static PokedexPokemon GetPokemon(uint pokemonId, uint formId = 0)
110110
var useForm = /*!pkmn.Attack.HasValue &&*/ formId > 0 && pkmn.Forms.ContainsKey(formId);
111111
var pkmnForm = useForm ? pkmn.Forms[formId] : pkmn;
112112
pkmnForm.Name = pkmn.Name;
113+
// Check if Pokemon is form and Pokemon types provided, if not use normal Pokemon types as fallback
114+
pkmnForm.Types = useForm && (pkmn.Forms[formId].Types?.Count ?? 0) > 0
115+
? pkmn.Forms[formId].Types
116+
: pkmn.Types;
113117
return pkmnForm;
114118
}
115119

src/Services/Webhook/Models/PokemonData.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ public PokemonData()
342342

343343
#endregion
344344

345+
#region Public Methods
346+
345347
/// <summary>
346348
/// Set despawn times because .NET doesn't support Unix timestamp
347349
/// deserialization to <seealso cref="DateTime"/> class by default.
@@ -426,6 +428,10 @@ public async Task<DiscordWebhookMessage> GenerateEmbedMessageAsync(AlarmMessageS
426428
};
427429
}
428430

431+
#endregion
432+
433+
#region Private Methods
434+
429435
private async Task<dynamic> GetPropertiesAsync(AlarmMessageSettings properties)
430436
{
431437
var pkmnInfo = GameMaster.GetPokemon(PokemonId, FormId);
@@ -629,5 +635,7 @@ private async Task<dynamic> GetPropertiesAsync(AlarmMessageSettings properties)
629635
};
630636
return dict;
631637
}
638+
639+
#endregion
632640
}
633641
}

src/WhMgr.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@
7676
<None Remove="ClientApp\public\index.html" />
7777
</ItemGroup>
7878

79-
<ItemGroup>
80-
<Folder Include="Web\Api\Requests\" />
81-
</ItemGroup>
82-
8379
<ItemGroup>
8480
<Content Remove="ClientApp\package.json" />
8581
<Content Remove="ClientApp\package-lock.json" />
@@ -96,6 +92,13 @@
9692
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9793
</Content>
9894
</ItemGroup>
95+
96+
<ItemGroup>
97+
<Compile Remove="Web\Api\Requests\**" />
98+
<Content Remove="Web\Api\Requests\**" />
99+
<EmbeddedResource Remove="Web\Api\Requests\**" />
100+
<None Remove="Web\Api\Requests\**" />
101+
</ItemGroup>
99102
<ItemGroup>
100103
<None Include="..\README.md">
101104
<Pack>True</Pack>

0 commit comments

Comments
 (0)