Skip to content

Commit

Permalink
Fix issue with Pokemon type emojis being empty if pulled form Pokemon…
Browse files Browse the repository at this point in the history
… from game master. (#289)
  • Loading branch information
versx committed Jun 23, 2022
1 parent 0c34765 commit 53d9f7d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Data/GameMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public static PokedexPokemon GetPokemon(uint pokemonId, uint formId = 0)
var useForm = /*!pkmn.Attack.HasValue &&*/ formId > 0 && pkmn.Forms.ContainsKey(formId);
var pkmnForm = useForm ? pkmn.Forms[formId] : pkmn;
pkmnForm.Name = pkmn.Name;
// Check if Pokemon is form and Pokemon types provided, if not use normal Pokemon types as fallback
pkmnForm.Types = useForm && (pkmn.Forms[formId].Types?.Count ?? 0) > 0
? pkmn.Forms[formId].Types
: pkmn.Types;
return pkmnForm;
}

Expand Down
8 changes: 8 additions & 0 deletions src/Services/Webhook/Models/PokemonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ public PokemonData()

#endregion

#region Public Methods

/// <summary>
/// Set despawn times because .NET doesn't support Unix timestamp
/// deserialization to <seealso cref="DateTime"/> class by default.
Expand Down Expand Up @@ -426,6 +428,10 @@ public async Task<DiscordWebhookMessage> GenerateEmbedMessageAsync(AlarmMessageS
};
}

#endregion

#region Private Methods

private async Task<dynamic> GetPropertiesAsync(AlarmMessageSettings properties)
{
var pkmnInfo = GameMaster.GetPokemon(PokemonId, FormId);
Expand Down Expand Up @@ -629,5 +635,7 @@ private async Task<dynamic> GetPropertiesAsync(AlarmMessageSettings properties)
};
return dict;
}

#endregion
}
}
11 changes: 7 additions & 4 deletions src/WhMgr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@
<None Remove="ClientApp\public\index.html" />
</ItemGroup>

<ItemGroup>
<Folder Include="Web\Api\Requests\" />
</ItemGroup>

<ItemGroup>
<Content Remove="ClientApp\package.json" />
<Content Remove="ClientApp\package-lock.json" />
Expand All @@ -96,6 +92,13 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Compile Remove="Web\Api\Requests\**" />
<Content Remove="Web\Api\Requests\**" />
<EmbeddedResource Remove="Web\Api\Requests\**" />
<None Remove="Web\Api\Requests\**" />
</ItemGroup>
<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>
Expand Down

0 comments on commit 53d9f7d

Please sign in to comment.