fix: hardcore mode fixes (#1882)

fixes hardcore modes uscore drops
adds config option for excluded item drops
This commit is contained in:
David Markowitz
2025-09-21 18:36:32 -07:00
committed by GitHub
parent 4a577f233d
commit 4a5dd68e87
6 changed files with 47 additions and 24 deletions

View File

@@ -52,6 +52,25 @@ std::vector<LOT> EntityManager::m_GhostingExcludedLOTs = {
4967
};
void EntityManager::ReloadConfig() {
auto hcmode = Game::config->GetValue("hardcore_mode");
m_HardcoreMode = hcmode.empty() ? false : (hcmode == "1");
auto hcUscorePercent = Game::config->GetValue("hardcore_lose_uscore_on_death_percent");
m_HardcoreLoseUscoreOnDeathPercent = hcUscorePercent.empty() ? 10 : std::stoi(hcUscorePercent);
auto hcUscoreMult = Game::config->GetValue("hardcore_uscore_enemies_multiplier");
m_HardcoreUscoreEnemiesMultiplier = hcUscoreMult.empty() ? 2 : std::stoi(hcUscoreMult);
auto hcDropInv = Game::config->GetValue("hardcore_dropinventory_on_death");
m_HardcoreDropinventoryOnDeath = hcDropInv.empty() ? false : (hcDropInv == "1");
auto hcExcludedItemDrops = Game::config->GetValue("hardcore_excluded_item_drops");
m_HardcoreExcludedItemDrops.clear();
for (const auto& strLot : GeneralUtils::SplitString(hcExcludedItemDrops, ',')) {
const auto lot = GeneralUtils::TryParse<LOT>(strLot);
if (lot) {
m_HardcoreExcludedItemDrops.insert(lot.value());
}
}
}
void EntityManager::Initialize() {
// Check if this zone has ghosting enabled
m_GhostingEnabled = std::find(
@@ -61,15 +80,8 @@ void EntityManager::Initialize() {
) == m_GhostingExcludedZones.end();
// grab hardcore mode settings and load them with sane defaults
auto hcmode = Game::config->GetValue("hardcore_mode");
m_HardcoreMode = hcmode.empty() ? false : (hcmode == "1");
auto hcUscorePercent = Game::config->GetValue("hardcore_lose_uscore_on_death_percent");
m_HardcoreLoseUscoreOnDeathPercent = hcUscorePercent.empty() ? 10 : std::stoi(hcUscorePercent);
auto hcUscoreMult = Game::config->GetValue("hardcore_uscore_enemies_multiplier");
m_HardcoreUscoreEnemiesMultiplier = hcUscoreMult.empty() ? 2 : std::stoi(hcUscoreMult);
auto hcDropInv = Game::config->GetValue("hardcore_dropinventory_on_death");
m_HardcoreDropinventoryOnDeath = hcDropInv.empty() ? false : (hcDropInv == "1");
Game::config->AddConfigHandler([]() {Game::entityManager->ReloadConfig();});
Game::entityManager->ReloadConfig();
// If cloneID is not zero, then hardcore mode is disabled
// aka minigames and props
if (Game::zoneManager->GetZoneID().GetCloneID() != 0) m_HardcoreMode = false;