Skip to content

Commit

Permalink
add harvest XP to crop lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Jan 19, 2025
1 parent b98e66e commit 109e492
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 2 deletions.
15 changes: 13 additions & 2 deletions LookupAnything/Framework/Lookups/Items/ItemSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public override IEnumerable<ICustomField> GetData()
}

// crop fields
foreach (ICustomField field in this.GetCropFields(this.FromDirt, this.FromCrop ?? this.SeedForCrop, isSeed))
foreach (ICustomField field in this.GetCropFields(this.FromDirt, this.FromCrop ?? this.SeedForCrop, obj, isSeed))
yield return field;

// indoor pot crop
Expand Down Expand Up @@ -508,8 +508,9 @@ private string GetTypeValue(Item item)
/// <summary>Get the custom fields for a crop.</summary>
/// <param name="dirt">The dirt the crop is planted in, if applicable.</param>
/// <param name="crop">The crop to represent.</param>
/// <param name="producedItem">The object that will be produced by this crop.</param>
/// <param name="isSeed">Whether the crop being displayed is for an unplanted seed.</param>
private IEnumerable<ICustomField> GetCropFields(HoeDirt? dirt, Crop? crop, bool isSeed)
private IEnumerable<ICustomField> GetCropFields(HoeDirt? dirt, Crop? crop, SObject? producedItem, bool isSeed)
{
var data = new CropDataParser(crop, isPlanted: !isSeed);
if (data.CropData is null || crop is null)
Expand Down Expand Up @@ -568,6 +569,16 @@ private IEnumerable<ICustomField> GetCropFields(HoeDirt? dirt, Crop? crop, bool
else
summary.Add(I18n.Crop_Summary_DropsX(count: 1));

// harvest XP
// based on Crop.harvest
if (crop.forageCrop.Value)
summary.Add(I18n.Crop_Summary_ForagingXp(amount: 3));
else
{
int price = producedItem?.Price ?? 0;
int experience = (int)Math.Round((float)(16 * Math.Log(.018 * price + 1, Math.E)));
summary.Add(I18n.Crop_Summary_FarmingXp(amount: experience));
}

// crop sale price
Item drop = data.GetSampleDrop();
Expand Down
1 change: 1 addition & 0 deletions LookupAnything/docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Release notes
## Upcoming release
* Added experience gained from harvesting crops to their lookup.
* Added integration with [Iconic Framework](https://www.nexusmods.com/stardewvalley/mods/11026) to look up what's in front of the player or open the search UI.
* Internal changes to Generic Mod Config Menu integration.
* Improved translations. Thanks to BlackRosePetals (updated Chinese)!
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": "Gibt {{min}} bis {{max}} her. ({{percent}}% Chance auf extra Saat)",
"crop.summary.harvest-once": "Ernte nach {{daysToFirstHarvest}} Tagen.",
"crop.summary.harvest-multi": "Ernte nach {{daysToFirstHarvest}} Tagen, danach alle {{daysToNextHarvests}} Tage.",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "Wächst im {{seasons}}.",
"crop.summary.sells-for": "Lässt sich für {{price}} verkaufen.",
"crop.harvest.too-late": "Zu spät in der Jahrezeit für eine weitere Ernte (wäre am {{date}}).",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@
"crop.summary.drops-X-to-Y": "drops {{min}} to {{max}} ({{percent}}% chance of extra crops)",
"crop.summary.harvest-once": "harvest after {{daysToFirstHarvest}} days",
"crop.summary.harvest-multi": "harvest after {{daysToFirstHarvest}} days, then every {{daysToNextHarvests}} days",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest",
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest",
"crop.summary.seasons": "grows in {{seasons}}",
"crop.summary.sells-for": "sells for {{price}}",
"crop.harvest.too-late": "too late in the season for the next harvest (would be on {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
"crop.summary.drops-X-to-Y": "Suelta de {{min}} a {{max}} ({{percent}}% de probabilidad de cultivos extra)",
"crop.summary.harvest-once": "Crece en {{daysToFirstHarvest}} días",
"crop.summary.harvest-multi": "Crece en {{daysToFirstHarvest}} días, después cada {{daysToNextHarvests}} días",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "Crece en {{seasons}}",
"crop.summary.sells-for": "Se vende por {{price}}",
"crop.harvest.too-late": "Demasiado tarde para cosecharlo esta temporada (sería en {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@
"crop.summary.drops-X-to-Y": "donne de {{min}} à {{max}} ({{percent}}% chance de culture supplémentaire)",
"crop.summary.harvest-once": "récolté après {{daysToFirstHarvest}} jours",
"crop.summary.harvest-multi": "récolté après {{daysToFirstHarvest}} jours, puis tout les {{daysToNextHarvests}} jours",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "pousse en {{seasons}}",
"crop.summary.sells-for": "vendu pour {{price}}",
"crop.harvest.too-late": "trop tard dans la saison pour la prochaine récolte (sera le {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
"crop.summary.drops-X-to-Y": "{{min}} és {{max}} darab között termel ({{percent}}% esély van extrára)",
"crop.summary.harvest-once": "begyűjthető {{daysToFirstHarvest}} nap múlva",
"crop.summary.harvest-multi": "begyűjthető {{daysToFirstHarvest}} nap múlva, és utána pedig {{daysToNextHarvests}} naponként újra terem",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "a következő évszakban nő: {{seasons}}",
"crop.summary.sells-for": "ára: {{price}}",
"crop.harvest.too-late": "ebben az évszakban már nincs ideje teremni (a következő termőnap ekkor lenne: {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@
"crop.summary.drops-X-to-Y": "ne facadere da {{min}} a {{max}} ({{percent}}% di probabilità in più di raccolto extra)",
"crop.summary.harvest-once": "raccogli dopo {{daysToFirstHarvest}} giorni",
"crop.summary.harvest-multi": "raccogli dopo {{daysToFirstHarvest}} giorni, e successivamente ogni {{daysToNextHarvests}} giorni",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "cresce in {{seasons}}",
"crop.summary.sells-for": "vendibile a {{price}}",
"crop.harvest.too-late": "sei troppo avanti nella stagione attuale per la prossima raccolta (finirebbe il {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": " {{min}}-{{max}}個収穫可能({{percent}}%の確率で追加の収穫)",
"crop.summary.harvest-once": " 植えてから{{daysToFirstHarvest}}日後に収穫可能",
"crop.summary.harvest-multi": " 植えてから{{daysToFirstHarvest}}日後に収穫可能。また{{daysToNextHarvests}}日毎に再収穫可能",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": " {{seasons}}に成長する",
"crop.summary.sells-for": " {{price}}で売れる",
"crop.harvest.too-late": "次の収穫には間に合わない({{date}}で収穫可能になるため)",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": "{{min}} ~ {{max}}개의 추가 작물을 ({{percent}}%의 확률로 획득 가능)",
"crop.summary.harvest-once": "{{daysToFirstHarvest}}일 후에 수확 가능",
"crop.summary.harvest-multi": "{{daysToFirstHarvest}}일 후에 수확 가능, 그 후 매 {{daysToNextHarvests}}일마다 주기적 수확 가능.",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "{{seasons}}에 자람",
"crop.summary.sells-for": "판매 가격: {{price}}",
"crop.harvest.too-late": "작물을 수확하기엔 너무 늦은 계절이다 (다음 수확까지 {{date}}일 걸림)",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": "można zebrać od {{min}} do {{max}} ({{percent}}% szans na dodatkowe plony)",
"crop.summary.harvest-once": "zbiory po {{daysToFirstHarvest}} dniach",
"crop.summary.harvest-multi": "zbiory po {{daysToFirstHarvest}} dniach, następnie co {{daysToNextHarvests}} dni",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "rośnie w {{seasons}}",
"crop.summary.sells-for": "sprzedaż za {{price}}",
"crop.harvest.too-late": "za późno w sezonie na następne zbiory (byłyby na {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
"crop.summary.drops-X-to-Y": "Solta de {{min}} pra no máximo {{max}} unidades({{percent}}% chance de colher unidades a mais)",
"crop.summary.harvest-once": "Colher após {{daysToFirstHarvest}} dias",
"crop.summary.harvest-multi": "Colhe depois de {{daysToFirstHarvest}} dias, depois a cada {{daysToNextHarvests}} dias",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "Cresce no(a) {{seasons}}",
"crop.summary.sells-for": "Vende por {{price}}",
"crop.harvest.too-late": "Muito tarde para colher nessa estação (deveria ser no {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": "Сбор от {{min}} до {{max}} ({{percent}}% шанс на дополнительный сбор)",
"crop.summary.harvest-once": "урожай через {{daysToFirstHarvest}} дн.",
"crop.summary.harvest-multi": "урожай через {{daysToFirstHarvest}} дн., затем каждые {{daysToNextHarvests}} дн.",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "сезон роста - {{seasons}}",
"crop.summary.sells-for": "продаётся за {{price}}",
"crop.harvest.too-late": "слишком поздно в этом сезоне для следующего сбора (урожай {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
"crop.summary.drops-X-to-Y": "ได้รับ {{min}}-{{max}} ({{percent}}% โอกาสของพืชผลพิเศษ)",
"crop.summary.harvest-once": "เก็บเกี่ยวได้หลังผ่านไป {{daysToFirstHarvest}} วัน",
"crop.summary.harvest-multi": "เก็บเกี่ยวได้หลังผ่านไป {{daysToFirstHarvest}} วัน, แล้วก็ทุก {{daysToNextHarvests}} วัน",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "เติบโตใน{{seasons}}",
"crop.summary.sells-for": "ขายได้ {{price}}",
"crop.harvest.too-late": "สายเกินไปสำหรับฤดูเก็บเกี่ยวครั้งถัดไป (จะอยู่ถึงวันที่ {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@
"crop.summary.drops-X-to-Y": "{{min}}'den {{max}} taneye kadar düşer ({{percent}}% ekstra mahsul şansı)",
"crop.summary.harvest-once": "{{daysToFirstHarvest}} gün sonra hasat edilir",
"crop.summary.harvest-multi": "{{daysToFirstHarvest}} günün ardından her {{daysToNextHarvests}} günde bir hasat edilir",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "{{seasons}} mevsiminde büyür",
"crop.summary.sells-for": "{{price}} satılır",
"crop.harvest.too-late": "sonraki hasat için sezon çok geç (muhtemelen {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
"crop.summary.drops-X-to-Y": "Збір з {{min}} до {{max}} ({{percent}}% на додатковий збір)",
"crop.summary.harvest-once": "Врожай через {{daysToFirstHarvest}} дн.",
"crop.summary.harvest-multi": "Врожай через {{daysToFirstHarvest}} дн., потім кожні {{daysToNextHarvests}} дн.",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "Сезон росту : {{seasons}}",
"crop.summary.sells-for": "Продається за {{price}}",
"crop.harvest.too-late": "Занадто пізно цього сезону для наступного збору (врожай {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"crop.summary.drops-X-to-Y": "rơi ra từ {{min}} đến {{max}} ({{percent}}% cơ hội có thêm vụ mùa)",
"crop.summary.harvest-once": "thu hoạch sau {{daysToFirstHarvest}} ngày",
"crop.summary.harvest-multi": "thu hoạch sau {{daysToFirstHarvest}} ngày, sau đó mỗi {{daysToNextHarvests}} ngày",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "phát triển trong {{seasons}}",
"crop.summary.sells-for": "bán được {{price}}",
"crop.harvest.too-late": "quá muộn thu hoạch trong mùa này (thu hoạch sẽ vào {{date}})",
Expand Down
2 changes: 2 additions & 0 deletions LookupAnything/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@
"crop.summary.drops-X-to-Y": "收获{{min}}至{{max}}份({{percent}}%几率收获额外作物)",
"crop.summary.harvest-once": "{{daysToFirstHarvest}}天后收获",
"crop.summary.harvest-multi": "{{daysToFirstHarvest}}天后收获,之后每隔{{daysToNextHarvests}}天收获一次",
"crop.summary.farming-xp": "gives +{{amount}} farming XP per harvest", // TODO
"crop.summary.foraging-xp": "gives +{{amount}} foraging XP per harvest", // TODO
"crop.summary.seasons": "在{{seasons}}生长",
"crop.summary.sells-for": "以{{price}}出售",
"crop.harvest.too-late": "下次收获超出本季(下次收获将在{{date}})",
Expand Down

0 comments on commit 109e492

Please sign in to comment.