Config: pathfinding and Hardcore keys read once at start, no console flood
A worldserver.conf from before 0.1.37 has no Pathfinding.PetLiquidCost, and the pet path filter read it with sConfigMgr on every path of every player's pet, so each read printed "Missing name ... in config file" and the console filled with it (0.1.37.1). The other pathfinding keys (PreferRoads, RoadCost, RoadCostMounted, SlopeCoefficient) were read the same way on every path of every unit, and Classic.Hardcore on every resurrection, and Classic.Hardcore was not in worldserver.conf.dist at all. All six are World config values now: read once at start (and on .reload config, except Classic.Hardcore), with at most one warning each, and the hot paths read the stored value. Classic.Hardcore gets its entry in worldserver.conf.dist.
This commit is contained in:
@@ -4739,7 +4739,7 @@ bool Player::RefuseHardcoreResurrect()
|
||||
{
|
||||
// Classic 1.60 Hardcore ruleset realm (Classic.Hardcore = 1): death is permanent, no spirit healer, corpse run or resurrection spell
|
||||
// brings the character back, also not on game master accounts. Only staff using the .revive command can (SetHardcoreReviveAllowed).
|
||||
if (IsAlive() || m_hardcoreReviveAllowed || !sConfigMgr->GetBoolDefault("Classic.Hardcore", false))
|
||||
if (IsAlive() || m_hardcoreReviveAllowed || !sWorld->getBoolConfig(CONFIG_CLASSIC_HARDCORE))
|
||||
return false;
|
||||
|
||||
ChatHandler(GetSession()).SendSysMessage("Hardcore: this character has fallen. Death is permanent on this realm.");
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Metric.h"
|
||||
#include "PhasingHandler.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -947,7 +948,7 @@ void PathGenerator::CreateFilter()
|
||||
// is flat, so water was the cheapest ground there is: a hunter's pet swam across a lake to reach a target on the far
|
||||
// shore when the walk round it was barely longer, and when the land and water routes cost about the same, each re-path
|
||||
// picked the other one and the pet turned back and forth. Swimming is also about a third slower than running.
|
||||
float const liquidCost = std::max(1.0f, sConfigMgr->GetFloatDefault("Pathfinding.PetLiquidCost", 2.5f));
|
||||
float const liquidCost = std::max(1.0f, sWorld->getFloatConfig(CONFIG_PATHFINDING_PET_LIQUID_COST));
|
||||
_filter.setAreaCost(NAV_AREA_WATER, liquidCost);
|
||||
_filter.setAreaCost(NAV_AREA_MAGMA_SLIME, liquidCost);
|
||||
}
|
||||
@@ -989,16 +990,16 @@ void PathGenerator::CreateFilter()
|
||||
// Pathfinding.PreferRoads = 1
|
||||
// Pathfinding.RoadCost = 0.5 (lower = stronger preference)
|
||||
// Pathfinding.RoadCostMounted = 0.35 (extra discount when mounted)
|
||||
if (sConfigMgr->GetBoolDefault("Pathfinding.PreferRoads", false))
|
||||
if (sWorld->getBoolConfig(CONFIG_PATHFINDING_PREFER_ROADS))
|
||||
{
|
||||
float roadCost = sConfigMgr->GetFloatDefault("Pathfinding.RoadCost", 0.5f);
|
||||
float roadCost = sWorld->getFloatConfig(CONFIG_PATHFINDING_ROAD_COST);
|
||||
|
||||
// Mount-aware: a mounted unit gains additional benefit from
|
||||
// roads (mount speed buff cleanly applies, no terrain skidding).
|
||||
// Apply a tighter cost when the source unit is mounted.
|
||||
if (Unit const* sourceUnit = _source ? _source->ToUnit() : nullptr)
|
||||
if (sourceUnit->IsMounted())
|
||||
roadCost = sConfigMgr->GetFloatDefault("Pathfinding.RoadCostMounted", 0.35f);
|
||||
roadCost = sWorld->getFloatConfig(CONFIG_PATHFINDING_ROAD_COST_MOUNTED);
|
||||
|
||||
_filter.setAreaCost(NAV_AREA_ROAD, roadCost);
|
||||
}
|
||||
@@ -1013,7 +1014,7 @@ void PathGenerator::CreateFilter()
|
||||
// a hill for the road bonus alone. Default 0.0 (disabled, stock pathing);
|
||||
// the bot module's playerbot.conf sets 1.0:
|
||||
// Pathfinding.SlopeCoefficient = 1.0
|
||||
float slopeCoef = sConfigMgr->GetFloatDefault("Pathfinding.SlopeCoefficient", 0.0f);
|
||||
float slopeCoef = sWorld->getFloatConfig(CONFIG_PATHFINDING_SLOPE_COEFFICIENT);
|
||||
_filter.SetSlopeCoefficient(slopeCoef);
|
||||
|
||||
// Map-type gate: dungeon/raid instances have spurious "road" tags on
|
||||
|
||||
@@ -720,6 +720,10 @@ void World::LoadConfigSettings(bool reload)
|
||||
{ .Name = "Classic.AutoEquipNewBags"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_AUTO_EQUIP_NEW_BAGS },
|
||||
{ .Name = "Classic.CreatureHealth.Raids"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_CREATURE_HEALTH_RAIDS },
|
||||
{ .Name = "Forever.VanillaAoE"sv, .DefaultValue = false, .Index = CONFIG_FOREVER_VANILLA_AOE },
|
||||
// read here once, not on every path or every death: a key missing from an older worldserver.conf warned on every read
|
||||
// and flooded the console ("Missing name Pathfinding.PetLiquidCost", 0.1.37.1)
|
||||
{ .Name = "Pathfinding.PreferRoads"sv, .DefaultValue = false, .Index = CONFIG_PATHFINDING_PREFER_ROADS },
|
||||
{ .Name = "Classic.Hardcore"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_HARDCORE, .Reloadable = false },
|
||||
} };
|
||||
|
||||
static constexpr ConfigOptionLoadDefinitionArray<uint32, INT_CONFIG_VALUE_COUNT> ints =
|
||||
@@ -970,6 +974,10 @@ void World::LoadConfigSettings(bool reload)
|
||||
{ .Name = "Pvp.FactionBalance.Pct5"sv, .DefaultValue = 0.6f, .Index = CONFIG_CALL_TO_ARMS_5_PCT },
|
||||
{ .Name = "Pvp.FactionBalance.Pct10"sv, .DefaultValue = 0.7f, .Index = CONFIG_CALL_TO_ARMS_10_PCT },
|
||||
{ .Name = "Pvp.FactionBalance.Pct20"sv, .DefaultValue = 0.8f, .Index = CONFIG_CALL_TO_ARMS_20_PCT },
|
||||
{ .Name = "Pathfinding.RoadCost"sv, .DefaultValue = 0.5f, .Index = CONFIG_PATHFINDING_ROAD_COST },
|
||||
{ .Name = "Pathfinding.RoadCostMounted"sv, .DefaultValue = 0.35f, .Index = CONFIG_PATHFINDING_ROAD_COST_MOUNTED },
|
||||
{ .Name = "Pathfinding.SlopeCoefficient"sv, .DefaultValue = 0.0f, .Index = CONFIG_PATHFINDING_SLOPE_COEFFICIENT },
|
||||
{ .Name = "Pathfinding.PetLiquidCost"sv, .DefaultValue = 2.5f, .Index = CONFIG_PATHFINDING_PET_LIQUID_COST },
|
||||
} };
|
||||
|
||||
static constexpr ConfigOptionLoadDefinitionArray<float, MAX_RATES> rates =
|
||||
@@ -1294,7 +1302,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
_gameRules.push_back({ .Rule = ::GameRule::EncounterJournalDisabled, .Value = int32(sConfigMgr->GetBoolDefault("Classic.AdventureGuide", false) ? 0 : 1) });
|
||||
|
||||
// Classic 1.60 Hardcore ruleset realm: C_GameRules.IsHardcoreActive() drives the client's Hardcore UI
|
||||
if (sConfigMgr->GetBoolDefault("Classic.Hardcore", false))
|
||||
if (getBoolConfig(CONFIG_CLASSIC_HARDCORE))
|
||||
_gameRules.push_back({ .Rule = ::GameRule::HardcoreRuleset, .Value = true });
|
||||
|
||||
// PremadeGroupFinderStyle (93) = 2 is in the list above: the client loads its "Vanilla style" group finder
|
||||
|
||||
@@ -216,6 +216,8 @@ enum WorldBoolConfigs : uint32
|
||||
CONFIG_CLASSIC_AUTO_EQUIP_NEW_BAGS,
|
||||
CONFIG_CLASSIC_CREATURE_HEALTH_RAIDS,
|
||||
CONFIG_FOREVER_VANILLA_AOE,
|
||||
CONFIG_PATHFINDING_PREFER_ROADS,
|
||||
CONFIG_CLASSIC_HARDCORE,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
@@ -247,6 +249,10 @@ enum WorldFloatConfigs : uint32
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_INSTANCE,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_BATTLEGROUND,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_ARENA,
|
||||
CONFIG_PATHFINDING_ROAD_COST,
|
||||
CONFIG_PATHFINDING_ROAD_COST_MOUNTED,
|
||||
CONFIG_PATHFINDING_SLOPE_COEFFICIENT,
|
||||
CONFIG_PATHFINDING_PET_LIQUID_COST,
|
||||
FLOAT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -4988,6 +4988,15 @@ Load.Locales = 1
|
||||
###################################################################################################
|
||||
# DEATH RECAP (deathcam)
|
||||
#
|
||||
# Classic.Hardcore
|
||||
# Description: Classic 1.60 Hardcore ruleset realm: death is permanent (no spirit healer, corpse run or resurrection
|
||||
# brings a character back; only staff with .revive), and the client shows its Hardcore interface.
|
||||
# Read at server start.
|
||||
# Default: 0 - (Normal realm)
|
||||
# 1 - (Hardcore realm)
|
||||
|
||||
Classic.Hardcore = 0
|
||||
|
||||
# Recap.Enable
|
||||
# Description: Record the last seconds around players and let anyone watch a death again
|
||||
# (".recap <number>", or click [Recap] with the ForeverRecap addon).
|
||||
|
||||
Reference in New Issue
Block a user