Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added EventItem sheet #40

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private static IServiceCollection AddQueries(this IServiceCollection serviceColl
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<CraftActionLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<EmoteLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<ENpcResidentLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<EventItemLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<FateLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<ItemLite>>()
.AddSingleton<ISearchByNameQuery, SearchByNameQuery<LeveLite>>()
Expand All @@ -53,6 +54,7 @@ private static IServiceCollection AddAdapters(this IServiceCollection serviceCol
.AddSingleton<IContentTypeAdapter<CraftActionLite>, CraftActionAdapter>()
.AddSingleton<IContentTypeAdapter<EmoteLite>, EmoteAdapter>()
.AddSingleton<IContentTypeAdapter<ENpcResidentLite>, ENpcResidentAdapter>()
.AddSingleton<IContentTypeAdapter<EventItemLite>, EventItemAdapter>()
.AddSingleton<IContentTypeAdapter<FateLite>, FateAdapter>()
.AddSingleton<IContentTypeAdapter<ItemLite>, ItemAdapter>()
.AddSingleton<IContentTypeAdapter<LeveLite>, LeveAdapter>()
Expand Down
25 changes: 25 additions & 0 deletions EasyTranslate.Infrastructure/GameData/Adapters/EventItemAdapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using EasyTranslate.Domain.Entities;
using EasyTranslate.Infrastructure.GameData.Sheets;

namespace EasyTranslate.Infrastructure.GameData.Adapters;

public class EventItemAdapter : IContentTypeAdapter<EventItemLite>
{
public Func<EventItemLite, bool> WhereClause(string searchName)
{
return item => item.Name.RawString.Contains(searchName, StringComparison.OrdinalIgnoreCase);
}

public Func<EventItemLite, Content> MapToContent(EventItemLite english, EventItemLite french, EventItemLite german,
EventItemLite japanese)
{
return item => new Content(
ContentType.Item,
item.Icon,
english.Name.RawString,
french.Name.RawString,
german.Name.RawString,
// The Name field is always empty in japanese
japanese.Singular.RawString);
}
}
24 changes: 24 additions & 0 deletions EasyTranslate.Infrastructure/GameData/Sheets/EventItemLite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Lumina.Data;
using Lumina.Excel;
using Lumina.Text;

namespace EasyTranslate.Infrastructure.GameData.Sheets;

[Sheet("EventItem")]
// ReSharper disable once ClassNeverInstantiated.Global
public class EventItemLite : ExcelRow
{
// Needed because the Name property doesn't seem to be used in japanese
public SeString Singular { get; private set; } = null!;
public SeString Name { get; private set; } = null!;
public ushort Icon { get; private set; }

public override void PopulateData(RowParser parser, Lumina.GameData gameData, Language language)
{
base.PopulateData(parser, gameData, language);

Singular = parser.ReadOffset<SeString>(0)!;
Name = parser.ReadOffset<SeString>(8)!;
Icon = parser.ReadOffset<ushort>(24);
}
}
11 changes: 11 additions & 0 deletions EasyTranslate.Integration.Tests/SearchContentByNameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ public async Task ENpcResident_SearchContentByName_ReturnsMatchingResults()
Snapshot.Match(results.ToList());
}

[Fact]
public async Task EventItemLite_SearchContentByName_ReturnsMatchingResults()
{
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute(
"Ulan's note",
Language.English
);

Snapshot.Match(results.ToList());
}

[Fact]
public async Task Fate_SearchContentByName_ReturnsMatchingResults()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,14 @@
"GermanName": "Ein Schluck am Morgen vertreibt die Sorgen",
"JapaneseName": "大口依頼:朝食の一杯"
},
{
"Type": "Item",
"IconId": 24353,
"EnglishName": "Salt-cured Antelope",
"FrenchName": "Viande d'antilope salée",
"GermanName": "Antilopen-Pökelfleisch",
"JapaneseName": "アンテロープの塩漬け肉"
},
{
"Type": "Item",
"IconId": 30664,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@
"GermanName": "abgespalten[a] Klumpen",
"JapaneseName": "分裂シタ人形タチ"
},
{
"Type": "Item",
"IconId": 59403,
"EnglishName": "Limpet Bomb",
"FrenchName": "Bombo collant",
"GermanName": "Haft-Bomber",
"JapaneseName": "リムペットボム"
},
{
"Type": "Item",
"IconId": 29729,
Expand Down Expand Up @@ -407,6 +415,14 @@
"GermanName": "Petyr Winsome",
"JapaneseName": "ピーター・ウィンソム"
},
{
"Type": "Item",
"IconId": 22627,
"EnglishName": "Kedtrap Petal",
"FrenchName": "Pétale de piège-poux",
"GermanName": "Fiegenfallen-Blüte",
"JapaneseName": "妖花の花弁"
},
{
"Type": "Item",
"IconId": 22402,
Expand Down Expand Up @@ -580,9 +596,17 @@
"IconId": null,
"EnglishName": "impetuous youth",
"FrenchName": "Hhetsarro perdu",
"GermanName": "ratlos[a] Hhetsarro ",
"GermanName": "ratlos[a] Hhetsarro",
"JapaneseName": "途方に暮れたヘイザ・アロ族"
},
{
"Type": "Item",
"IconId": 26151,
"EnglishName": "Signed Petition",
"FrenchName": "Pétition signée",
"GermanName": "Linienflug-Petition",
"JapaneseName": "ハイウィンド飛空社宛の嘆願書"
},
{
"Type": "Item",
"IconId": 52022,
Expand Down Expand Up @@ -663,6 +687,22 @@
"GermanName": "Träum-Mogry",
"JapaneseName": "まだまだモーグリ"
},
{
"Type": "Item",
"IconId": 21261,
"EnglishName": "Limpet Bomb Core",
"FrenchName": "Noyau de bombo collant",
"GermanName": "Haft-Bomber-Essenz",
"JapaneseName": "リムペットボムの心核"
},
{
"Type": "Item",
"IconId": 22251,
"EnglishName": "Witchweed Petals",
"FrenchName": "Pétale d'herbe des sorcières",
"GermanName": "Hexenkraut-Blüte",
"JapaneseName": "ウィッチウィードの巨大な花弁"
},
{
"Type": "Fate",
"IconId": 63914,
Expand Down Expand Up @@ -758,45 +798,5 @@
"FrenchName": "Fabrication: potions alchimiques améliorant la concentration",
"GermanName": "Konzentration im Glas",
"JapaneseName": "製作依頼:作業に集中する錬金薬"
},
{
"Type": "Status",
"IconId": 16603,
"EnglishName": "Poppet Resistance",
"FrenchName": "Immunité aux poupées",
"GermanName": "Puppen-Resistenz",
"JapaneseName": "ドール無効"
},
{
"Type": "Status",
"IconId": 15024,
"EnglishName": "Poppet Resistance",
"FrenchName": "Immunité aux poupées",
"GermanName": "Puppen-Resistenz",
"JapaneseName": "ドール無効"
},
{
"Type": "Action",
"IconId": 405,
"EnglishName": "Rheognosis Petrine",
"FrenchName": "Leonosis petros",
"GermanName": "Rheognose Petros",
"JapaneseName": "レーオノシス・ペトゥロス"
},
{
"Type": "Npc",
"IconId": null,
"EnglishName": "potent petrosphere",
"FrenchName": "super pétrosphère",
"GermanName": "Petrosphäre[p] I",
"JapaneseName": "ペトロスフィアII"
},
{
"Type": "Npc",
"IconId": null,
"EnglishName": "ianthine petalouda",
"FrenchName": "iodopétalouda",
"GermanName": "Ianthine-Petalouda",
"JapaneseName": "イアンティネ・ペタルダ"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"Type": "Item",
"IconId": 26189,
"EnglishName": "Ulan's Note",
"FrenchName": "Mémento d'Ulan",
"GermanName": "Ulans Liste",
"JapaneseName": "ウランのメモ"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@
"GermanName": "Atelier-Toffelsalat",
"JapaneseName": "開拓工房のポポトサラダ"
},
{
"Type": "Item",
"IconId": 25453,
"EnglishName": "Flying Popoto Repellent",
"FrenchName": "Répulsif anti popotos volantes",
"GermanName": "Flugtoffel-Abwehrmittel",
"JapaneseName": "フライングポポト避けの苦汁"
},
{
"Type": "Item",
"IconId": 23741,
Expand Down