Skip to content

Commit

Permalink
Add config option to disable durability loss (vmangos#2712)
Browse files Browse the repository at this point in the history
Also remove the following unused parameters:
DurabilityLossChance.Absorb
DurabilityLossChance.Parry
DurabilityLossChance.Block
  • Loading branch information
Stoabrogga authored Aug 5, 2024
1 parent 6912e11 commit d910f62
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5326,6 +5326,9 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory)

void Player::DurabilityPointsLoss(Item* item, int32 points)
{
if (!sWorld.getConfig(CONFIG_BOOL_DURABILITY_LOSS_ENABLE))
return;

int32 pMaxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
int32 pOldDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
int32 pNewDurability = pOldDurability - points;
Expand Down
1 change: 1 addition & 0 deletions src/game/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ void World::LoadConfigSettings(bool reload)

setConfigMinMax(CONFIG_FLOAT_RATE_TARGET_POS_RECALCULATION_RANGE, "TargetPosRecalculateRange", 1.5f, CONTACT_DISTANCE, ATTACK_DISTANCE);

setConfig(CONFIG_BOOL_DURABILITY_LOSS_ENABLE, "DurabilityLoss.Enable", true);
setConfigPos(CONFIG_FLOAT_RATE_DURABILITY_LOSS_DAMAGE, "DurabilityLossChance.Damage", 0.5f);

setConfigPos(CONFIG_FLOAT_LISTEN_RANGE_SAY, "ListenRange.Say", 25.0f);
Expand Down
1 change: 1 addition & 0 deletions src/game/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ enum eConfigBoolValues
CONFIG_BOOL_LFG_MATCHMAKING,
CONFIG_BOOL_LIMIT_PLAY_TIME,
CONFIG_BOOL_RESTRICT_UNVERIFIED_ACCOUNTS,
CONFIG_BOOL_DURABILITY_LOSS_ENABLE,
CONFIG_BOOL_VALUE_COUNT
};

Expand Down
9 changes: 6 additions & 3 deletions src/mangosd/mangosd.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,11 @@ Visibility.ForceActiveObjects = 1
# Default: 1 (enabled)
# 0 (disabled)
#
# DurabilityLoss.Enable
# Description: Enable durability loss
# Default: 1 (enabled)
# 0 (disabled)
#
# DurabilityLossChance.Damage
# Chance to lose durability on an equipped item when taking or dealing damage
# Default: 0.5
Expand Down Expand Up @@ -2625,10 +2630,8 @@ SkillChance.SkinningSteps = 0
SkillFail.Loot.Fishing = 0
SkillFail.Gain.Fishing = 0
SkillFail.Possible.FishingPool = 1
DurabilityLoss.Enable = 1
DurabilityLossChance.Damage = 0.5
DurabilityLossChance.Absorb = 0.5
DurabilityLossChance.Parry = 0.05
DurabilityLossChance.Block = 0.05
Death.SicknessLevel = 11
Death.CorpseReclaimDelay.PvP = 1
Death.CorpseReclaimDelay.PvE = 1
Expand Down

0 comments on commit d910f62

Please sign in to comment.