mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-21 06:48:39 -04:00
Fix scrub message having doubled articles, add articles to fake names (#7044)
This commit is contained in:
@@ -1967,8 +1967,8 @@ void StaticData::HintTable_Init_Item() {
|
||||
hintTextTable[RHT_ROCS_FEATHER] = HintText(CustomMessage("Roc's Feather", /*german*/"Greifenfeder", /*french*/"Plume de Roc"),
|
||||
{}, {
|
||||
CustomMessage("a feather", /*german*/TODO_TRANSLATE, /*french*/"une plume"),
|
||||
CustomMessage("a chicken wing", /*german*/TODO_TRANSLATE, /*french*/"une aile de poulet"),
|
||||
CustomMessage("a blue wing", /*german*/TODO_TRANSLATE, /*french*/"une aile bleue")});
|
||||
CustomMessage("a chicken wing", /*german*/TODO_TRANSLATE, /*french*/"une aile de poulet"),
|
||||
CustomMessage("a blue wing", /*german*/TODO_TRANSLATE, /*french*/"une aile bleue")});
|
||||
|
||||
hintTextTable[RHT_BEAN_SOUL] = HintText(CustomMessage("a bean soul", /*german*/"eine bohnenseele", /*french*/"une âme de haricot"));
|
||||
|
||||
@@ -2166,7 +2166,7 @@ void StaticData::HintTable_Init_Item() {
|
||||
hintTextTable[RHT_HINT_MYSTERIOUS] = HintText(CustomMessage("something mysterious", /*german*/"etwas Mysteriöses", /*french*/"un sacré mystère"));
|
||||
// /*spanish*/algo misterioso
|
||||
|
||||
hintTextTable[RHT_MYSTERIOUS_ITEM] = HintText(CustomMessage("mysterious item", /*german*/"ein mysteriöser Gegenstand", /*french*/"objet mystérieux"));
|
||||
hintTextTable[RHT_MYSTERIOUS_ITEM] = HintText(CustomMessage("a mysterious item", /*german*/"ein mysteriöser Gegenstand", /*french*/"un objet mystérieux"));
|
||||
// /*spanish*/algo misterioso
|
||||
|
||||
hintTextTable[RHT_MYSTERIOUS_ITEM_CAPITAL] = HintText(CustomMessage("Mysterious Item", /*german*/"Mysteriöser Gegenstand", /*french*/"Objet Mystérieux"));
|
||||
|
||||
@@ -309,6 +309,9 @@ static void WriteAllLocations() {
|
||||
.GetEnglish();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickName"] = ctx->overrides[location->GetRandomizerCheck()].GetTrickName().GetEnglish();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickArticle"] =
|
||||
ctx->overrides[location->GetRandomizerCheck()].GetTrickArticle().GetEnglish();
|
||||
break;
|
||||
case 1:
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
@@ -318,6 +321,9 @@ static void WriteAllLocations() {
|
||||
.GetGerman();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickName"] = ctx->overrides[location->GetRandomizerCheck()].GetTrickName().GetGerman();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickArticle"] =
|
||||
ctx->overrides[location->GetRandomizerCheck()].GetTrickArticle().GetGerman();
|
||||
break;
|
||||
case 2:
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
@@ -327,6 +333,9 @@ static void WriteAllLocations() {
|
||||
.GetFrench();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickName"] = ctx->overrides[location->GetRandomizerCheck()].GetTrickName().GetFrench();
|
||||
jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]
|
||||
["trickArticle"] =
|
||||
ctx->overrides[location->GetRandomizerCheck()].GetTrickArticle().GetFrench();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,27 @@ void BuildMerchantMessage(CustomMessage& msg, RandomizerCheck rc, bool mysteriou
|
||||
RandomizerGet rgid = location->GetPlacedRandomizerGet();
|
||||
CustomMessage itemName;
|
||||
std::string color = Rando::StaticData::RetrieveItem(static_cast<RandomizerGet>(rgid)).GetColor();
|
||||
// Shop lists want a bare name, everyone else speaks in sentences and wants an article
|
||||
bool inShop = Rando::StaticData::GetLocation(rc)->IsShop();
|
||||
if (mysterious) {
|
||||
itemName = Rando::StaticData::hintTextTable[RHT_MYSTERIOUS_ITEM_CAPITAL].GetHintMessage();
|
||||
if (!inShop) {
|
||||
itemName = CustomMessage("a ", "einen ", "un ") + itemName;
|
||||
}
|
||||
color = "%g";
|
||||
} else if (rgid == RG_ICE_TRAP) {
|
||||
rgid = RAND_GET_OVERRIDE(rc).LooksLike();
|
||||
itemName = CustomMessage(RAND_GET_OVERRIDE(rc).GetTrickName());
|
||||
color = "%g";
|
||||
} else {
|
||||
const Rando::Item& item = Rando::StaticData::RetrieveItem(rgid);
|
||||
if (Rando::StaticData::GetLocation(rc)->IsShop()) {
|
||||
itemName = CustomMessage(Rando::StaticData::RetrieveItem(rgid).GetName());
|
||||
} else {
|
||||
itemName = item.GetHint().GetHintMessage();
|
||||
Text trickName = RAND_GET_OVERRIDE(rc).GetTrickName();
|
||||
if (!inShop) {
|
||||
trickName = RAND_GET_OVERRIDE(rc).GetTrickArticle() + trickName;
|
||||
}
|
||||
itemName = CustomMessage(trickName);
|
||||
color = "%g";
|
||||
} else if (inShop) {
|
||||
itemName = CustomMessage(Rando::StaticData::RetrieveItem(rgid).GetName());
|
||||
} else {
|
||||
// Hint text brings its own article
|
||||
itemName = Rando::StaticData::RetrieveItem(rgid).GetHint().GetHintMessage();
|
||||
}
|
||||
msg.Replace("[[color]]", color);
|
||||
msg.InsertNames({ itemName, CustomMessage(std::to_string(location->GetPrice())) });
|
||||
@@ -135,23 +142,23 @@ void BuildScrubMessage(uint16_t* textId, bool* loadFromMessageTable) {
|
||||
CustomMessage msg;
|
||||
if (price == 0) {
|
||||
msg = CustomMessage("\x12\x38\x82"
|
||||
"All right! You win! In return for sparing me, I will give you a [[color]][[1]]%w!&Please, "
|
||||
"All right! You win! In return for sparing me, I will give you [[color]][[1]]%w!&Please, "
|
||||
"take it!\x07\x10\xA3",
|
||||
"\x12\x38\x82"
|
||||
"In Ordnung! Du gewinnst! Im Austausch dafür, dass Du mich verschont hast, werde ich Dir "
|
||||
"einen [[color]][[1]]%w geben!\x07\x10\xA3",
|
||||
"[[color]][[1]]%w geben!\x07\x10\xA3",
|
||||
"\x12\x38\x82"
|
||||
"J'me rends! Laisse-moi partir et en échange, je te donne un [[color]][[1]]%w! Vas-y "
|
||||
"J'me rends! Laisse-moi partir et en échange, je te donne [[color]][[1]]%w! Vas-y "
|
||||
"prends le!\x07\x10\xA3");
|
||||
} else {
|
||||
msg = CustomMessage(
|
||||
"\x12\x38\x82"
|
||||
"All right! You win! In return for sparing me, I will sell you a [[color]][[1]]%w! %y[[2]] Rupees%w it "
|
||||
"All right! You win! In return for sparing me, I will sell you [[color]][[1]]%w! %y[[2]] Rupees%w it "
|
||||
"is!\x07\x10\xA3",
|
||||
"\x12\x38\x82"
|
||||
"Ich gebe auf! Ich verkaufe Dir einen [[color]][[1]]%w für %y[[2]] Rubine%w!\x07\x10\xA3",
|
||||
"Ich gebe auf! Ich verkaufe Dir [[color]][[1]]%w für %y[[2]] Rubine%w!\x07\x10\xA3",
|
||||
"\x12\x38\x82"
|
||||
"J'abandonne! Tu veux bien m'acheter un [[color]][[1]]%w? Ça fera %y[[2]] Rubis%w!\x07\x10\xA3");
|
||||
"J'abandonne! Tu veux bien m'acheter [[color]][[1]]%w? Ça fera %y[[2]] Rubis%w!\x07\x10\xA3");
|
||||
}
|
||||
BuildMerchantMessage(msg, rc,
|
||||
!RAND_GET_OPTION(RSK_SCRUB_TEXT_HINT) ||
|
||||
|
||||
@@ -888,7 +888,7 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) {
|
||||
.Padding(ImVec2(10.f, 6.f)))) {
|
||||
plandoLogData[index].iceTrapName =
|
||||
Rando::Traps::GetTrapName(plandoLogData[index].iceTrapModel.GetRandomizerGet())
|
||||
.GetForLanguage(CVarGetInteger(CVAR_SETTING("Languages"), 0))
|
||||
.name.GetForLanguage(CVarGetInteger(CVAR_SETTING("Languages"), 0))
|
||||
.c_str();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -343,7 +343,9 @@ void Context::CreateItemOverrides() {
|
||||
if (itemLoc->GetPlacedRandomizerGet() == RG_ICE_TRAP) {
|
||||
ItemOverride val(locKey, Traps::GetTrapTrickModel(&rando_state));
|
||||
iceTrapModels[locKey] = val.LooksLike();
|
||||
val.SetTrickName(Traps::GetTrapName(val.LooksLike(), &rando_state));
|
||||
Traps::TrickName trickName = Traps::GetTrapName(val.LooksLike(), &rando_state);
|
||||
val.SetTrickName(trickName.name);
|
||||
val.SetTrickArticle(trickName.article);
|
||||
// If this is ice trap is in a shop, change the name based on what the model will look like
|
||||
overrides[locKey] = val;
|
||||
}
|
||||
@@ -445,6 +447,8 @@ void Context::ParseItemLocationsJson(const nlohmann::json& spoilerFileJson) {
|
||||
overrides[rc] = ItemOverride(rc, StaticData::itemNameToEnum[itemit.value().get<std::string>()]);
|
||||
} else if (itemit.key() == "trickName") {
|
||||
overrides[rc].SetTrickName(Text(itemit.value().get<std::string>()));
|
||||
} else if (itemit.key() == "trickArticle") {
|
||||
overrides[rc].SetTrickArticle(Text(itemit.value().get<std::string>()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,12 @@
|
||||
|
||||
namespace Rando {
|
||||
namespace Traps {
|
||||
Text GetTrapName(uint16_t id, uint64_t* state = nullptr);
|
||||
/// @brief A fake item name for an ice trap, with the article to use when it appears in a sentence
|
||||
struct TrickName {
|
||||
Text name;
|
||||
Text article;
|
||||
};
|
||||
TrickName GetTrapName(uint16_t id, uint64_t* state = nullptr);
|
||||
RandomizerGet GetTrapTrickModel(uint64_t* state = nullptr);
|
||||
bool ShouldJunkItemBeTrap();
|
||||
void BuildIceTrapMessage(CustomMessage& msg, GetItemEntry getItemEntry);
|
||||
|
||||
@@ -516,7 +516,9 @@ const HintText Hint::GetItemHintText(uint8_t slot, bool mysterious) const {
|
||||
if (mysterious) {
|
||||
return StaticData::hintTextTable[RHT_MYSTERIOUS_ITEM];
|
||||
} else if (targetRG == RG_ICE_TRAP) { // RANDOTODO store in item hint instead of item
|
||||
return HintText(CustomMessage({ ctx->overrides[hintedCheck].GetTrickName() }));
|
||||
// item hints read as sentences, so the fake name needs its article like a real item's hint has
|
||||
return HintText(CustomMessage(
|
||||
{ ctx->overrides[hintedCheck].GetTrickArticle() + ctx->overrides[hintedCheck].GetTrickName() }));
|
||||
} else {
|
||||
return ctx->GetItemLocation(hintedCheck)->GetPlacedItem().GetHint();
|
||||
}
|
||||
|
||||
@@ -32,4 +32,12 @@ Text& ItemOverride::GetTrickName() {
|
||||
void ItemOverride::SetTrickName(Text trickName) {
|
||||
mTrickName = std::move(trickName);
|
||||
}
|
||||
|
||||
Text& ItemOverride::GetTrickArticle() {
|
||||
return mTrickArticle;
|
||||
}
|
||||
|
||||
void ItemOverride::SetTrickArticle(Text trickArticle) {
|
||||
mTrickArticle = std::move(trickArticle);
|
||||
}
|
||||
} // namespace Rando
|
||||
@@ -15,10 +15,13 @@ class ItemOverride {
|
||||
RandomizerGet& RefLooksLike();
|
||||
Text& GetTrickName();
|
||||
void SetTrickName(Text trickName);
|
||||
Text& GetTrickArticle();
|
||||
void SetTrickArticle(Text trickArticle);
|
||||
|
||||
private:
|
||||
RandomizerCheck mLocation;
|
||||
RandomizerGet mLooksLike;
|
||||
Text mTrickName;
|
||||
Text mTrickArticle;
|
||||
};
|
||||
} // namespace Rando
|
||||
@@ -173,6 +173,12 @@ void SaveManager::LoadRandomizer() {
|
||||
SaveManager::Instance->LoadData("german", randoContext->GetItemOverride(i).GetTrickName().german);
|
||||
SaveManager::Instance->LoadData("french", randoContext->GetItemOverride(i).GetTrickName().french);
|
||||
});
|
||||
SaveManager::Instance->LoadStruct("trickArticle", [&]() {
|
||||
Text& article = randoContext->GetItemOverride(i).GetTrickArticle();
|
||||
SaveManager::Instance->LoadData("english", article.english);
|
||||
SaveManager::Instance->LoadData("german", article.german);
|
||||
SaveManager::Instance->LoadData("french", article.french);
|
||||
});
|
||||
}
|
||||
uint16_t price = 0;
|
||||
SaveManager::Instance->LoadData("price", price, (uint16_t)0);
|
||||
@@ -306,6 +312,14 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f
|
||||
SaveManager::Instance->SaveData("french",
|
||||
randoContext->GetItemOverride(i).GetTrickName().GetFrench());
|
||||
});
|
||||
SaveManager::Instance->SaveStruct("trickArticle", [&]() {
|
||||
SaveManager::Instance->SaveData("english",
|
||||
randoContext->GetItemOverride(i).GetTrickArticle().GetEnglish());
|
||||
SaveManager::Instance->SaveData("german",
|
||||
randoContext->GetItemOverride(i).GetTrickArticle().GetGerman());
|
||||
SaveManager::Instance->SaveData("french",
|
||||
randoContext->GetItemOverride(i).GetTrickArticle().GetFrench());
|
||||
});
|
||||
}
|
||||
if (randoContext->GetItemLocation(i)->IsExcluded()) {
|
||||
SaveManager::Instance->SaveData("excluded", true);
|
||||
|
||||
Reference in New Issue
Block a user