mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 01:48:07 +00:00
fix: hardcore mode fixes (#1882)
fixes hardcore modes uscore drops adds config option for excluded item drops
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user