public static void EventSink_Movement(MovementEventArgs e)
{
Mobile from = e.Mobile;
if (!from.Alive || from.IsStaff())
return;
if (!from.Player)
{
// Else it won't work on monsters.
Spells.Ninjitsu.DeathStrike.AddStep(from);
return;
}
int maxWeight = GetMaxWeight(from) + OverloadAllowance;
int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;
if (overWeight > 0)
{
from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);
if (from.Stam == 0)
{
from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight!
e.Blocked = true;
return;
}
}
if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10)
--from.Stam;
if (from.Stam == 0)
{
from.SendLocalizedMessage(500110); // You are too fatigued to move.
e.Blocked = true;
return;
}
if (from is PlayerMobile)
{
int amt = (from.Mounted ? 48 : 16);
PlayerMobile pm = (PlayerMobile)from;
if ((++pm.StepsTaken % amt) == 0)
--from.Stam;
}
Spells.Ninjitsu.DeathStrike.AddStep(from);
}
public static int GetStamLoss(Mobile from, int overWeight, bool running)
{
int loss = 5 + (overWeight / 25);
if (from.Mounted)
loss /= 3;
if (running)
loss *= 2;
return loss;
}
Sorry, don't know for sure. Try searching for Throttle in the code. Seems to me you will find it in Mobile.cs in the Server core, but again, I could be wrong. If you want to prevent someone from dropping down to a walk, you could possibly change the get{ } code of Stam so that if Stam is less than 2 it automatically goes up to 2.
There are two checks there to block movement 1) If you're overweight and IF your Stam = 0; 2) Just checks if Stam = 0
The rest of it is just checking if you're over limit on the max weight you can can carry, then if you're walking, running, or mounted and calculates Stam loss on movement basd on those conditions.
We use essential cookies to make this site work, and optional cookies to enhance your experience.