Skip to content

Commit

Permalink
Fix GMs / Admins being affected by stealth speed penalty in some cases
Browse files Browse the repository at this point in the history
Follows f6c7b5f incomplete changes.
  • Loading branch information
bm01 committed Aug 3, 2024
1 parent bfbccf0 commit ce265f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
22 changes: 8 additions & 14 deletions GameServer/ECS-Effects/StealthECSEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,13 @@ public override void OnStartEffect()

OwnerPlayer.Sprint(false);

if (OwnerPlayer.Client.Account.PrivLevel == 1 || OwnerPlayer.Client.Account.PrivLevel == 0)
foreach (GamePlayer player in OwnerPlayer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
//GameEventMgr.AddHandler(this, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(Unstealth));
foreach (GamePlayer player in OwnerPlayer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
if (player == null || player == OwnerPlayer) continue;
if (!player.CanDetect(OwnerPlayer))
player.Out.SendObjectDelete(OwnerPlayer);
}
OwnerPlayer.Out.SendUpdateMaxSpeed();
if (player == OwnerPlayer)
continue;

if (!player.CanDetect(OwnerPlayer))
player.Out.SendObjectDelete(OwnerPlayer);
}

StealthStateChanged();
Expand Down Expand Up @@ -106,10 +103,7 @@ public override void OnStopEffect()
private void StealthStateChanged()
{
OwnerPlayer.Notify(GamePlayerEvent.StealthStateChanged, OwnerPlayer, null);
if (OwnerPlayer.Client.Account.PrivLevel == 1 || OwnerPlayer.Client.Account.PrivLevel == 0)
{
OwnerPlayer.Out.SendUpdateMaxSpeed();
}
OwnerPlayer.OnMaxSpeedChange();
}
}
}
}
5 changes: 3 additions & 2 deletions GameServer/propertycalc/MaxSpeedCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override int CalcValue(GameLiving living, eProperty property)
speed *= 1.25; // New run speed is 125% when no buff.
}

if (player.IsOverencumbered && player.Client.Account.PrivLevel < 2 && ServerProperties.Properties.ENABLE_ENCUMBERANCE_SPEED_LOSS)
if (player.IsOverencumbered && player.Client.Account.PrivLevel == 1 && ServerProperties.Properties.ENABLE_ENCUMBERANCE_SPEED_LOSS)
{
double Enc = player.Encumberance; // Calculating player.Encumberance is a bit slow with all those locks, don't call it much.

Expand All @@ -67,7 +67,8 @@ public override int CalcValue(GameLiving living, eProperty property)
else
player.IsOverencumbered = false;
}
if (player.IsStealthed)

if (player.IsStealthed && player.Client.Account.PrivLevel == 1)
{
AtlasOF_MasteryOfStealth mos = player.GetAbility<AtlasOF_MasteryOfStealth>();
//GameSpellEffect bloodrage = SpellHandler.FindEffectOnTarget(player, "BloodRage");
Expand Down

0 comments on commit ce265f6

Please sign in to comment.