Skip to content

Commit

Permalink
Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
bm01 committed Aug 18, 2024
1 parent 079ba69 commit bf02dc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions GameServer/ECS-Components/Actions/NpcAttackAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace DOL.GS
{
public class NpcAttackAction : AttackAction
{
private const int HEALTH_PERCENT_TRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT = 80;
private const double TIME_TO_TARGET_TRESHOLD_BEFORE_MELEE_SWITCH = 250; // NPCs will switch to melee if within melee range + (this * maxSpeed * 0.001).
private const double TIME_TO_TARGET_TRESHOLD_BEFORE_RANGED_SWITCH = 1000; // NPCs will switch to ranged if further than melee range + (this * maxSpeed * 0.001).
private const int HEALTH_PERCENT_THRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT = 80;
private const double TIME_TO_TARGET_THRESHOLD_BEFORE_MELEE_SWITCH = 250; // NPCs will switch to melee if within melee range + (this * maxSpeed * 0.001).
private const double TIME_TO_TARGET_THRESHOLD_BEFORE_RANGED_SWITCH = 1000; // NPCs will switch to ranged if further than melee range + (this * maxSpeed * 0.001).

private GameNPC _npcOwner;
private bool _hasLos;
Expand All @@ -33,7 +33,7 @@ public override void OnAimInterrupt(GameObject attacker)

// Guard archers and immobile NPCs should ignore the health threshold.
// They will still switch to melee if their target gets in melee range.
if ((!IsGuardArcherOrImmobile && _npcOwner.HealthPercent < HEALTH_PERCENT_TRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT) ||
if ((!IsGuardArcherOrImmobile && _npcOwner.HealthPercent < HEALTH_PERCENT_THRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT) ||
(attacker is GameLiving livingAttacker && livingAttacker.ActiveWeaponSlot is not eActiveWeaponSlot.Distance && livingAttacker.IsWithinRadius(_npcOwner, livingAttacker.attackComponent.AttackRange)))
SwitchToMeleeAndTick();
}
Expand Down Expand Up @@ -71,7 +71,7 @@ protected override bool PrepareMeleeAttack()
int maxSpeed = _npcOwner.MaxSpeed;

if (maxSpeed > 0)
offsetMeleeAttackRange += (int) (TIME_TO_TARGET_TRESHOLD_BEFORE_RANGED_SWITCH * maxSpeed * 0.001);
offsetMeleeAttackRange += (int) (TIME_TO_TARGET_THRESHOLD_BEFORE_RANGED_SWITCH * maxSpeed * 0.001);

// NPCs try to switch to their ranged weapon whenever possible.
if (!_npcOwner.IsBeingInterrupted &&
Expand Down Expand Up @@ -136,7 +136,7 @@ protected override bool FinalizeRangedAttack()
int maxSpeed = _npcOwner.MaxSpeed;

if (maxSpeed > 0)
offsetMeleeAttackRange += (int) (TIME_TO_TARGET_TRESHOLD_BEFORE_MELEE_SWITCH * maxSpeed * 0.001);
offsetMeleeAttackRange += (int) (TIME_TO_TARGET_THRESHOLD_BEFORE_MELEE_SWITCH * maxSpeed * 0.001);

// Switch to melee if the target is close enough.
if (_npcOwner != null &&
Expand Down
4 changes: 2 additions & 2 deletions GameServer/ECS-Components/PlayerMovementComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PlayerMovementComponent : MovementComponent
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

private const int BROADCAST_MINIMUM_INTERVAL = 200; // Clients send a position or heading update packet every 200ms at most (when moving or rotating).
private const int SOFT_LINK_DEATH_TRESHOLD = 5000; // How long does it take without receiving a packet for a client to enter the soft link death state.
private const int SOFT_LINK_DEATH_THRESHOLD = 5000; // How long does it take without receiving a packet for a client to enter the soft link death state.

private long _lastPositionUpdatePacketReceivedTime;
private long _nextPositionBroadcast;
Expand All @@ -32,7 +32,7 @@ public override void Tick()
{
if (!Owner.IsLinkDeathTimerRunning)
{
if (ServiceUtils.ShouldTickNoEarly(_lastPositionUpdatePacketReceivedTime + SOFT_LINK_DEATH_TRESHOLD))
if (ServiceUtils.ShouldTickNoEarly(_lastPositionUpdatePacketReceivedTime + SOFT_LINK_DEATH_THRESHOLD))
{
if (log.IsInfoEnabled)
log.Info($"Position update timeout on client. Calling link death. ({Owner.Client})");
Expand Down

0 comments on commit bf02dc1

Please sign in to comment.