mirror of
https://github.com/ServUO/ServUO
synced 2026-08-11 20:23:04 -04:00
* - Internal Galleon Update: Galleon Facing now uses the Multi Component List to change the ID's of fixtures. Some of the ID's (weapon pads) were not using the correct ID's, and this way the code is much more simplified. All fixture lists have been consolidated into one list. - Gargish Jewels no longer drop on non-SA Core - Fixed issue with trapped boxes - Added Event Sink for sending detailed house foundation packet. - Fixed issue where imbued jewelry weren't getting durability. * update solution fixed graphical issue * Bug Fixes - Added Blackthorne DUngeon stealables - Added proper base resists to Leather Ninja Hood - Medusa now drops Medusa Floor Tile Addon Deed (THANKS MILVA!) - AOSWeaponAttributes now work on Armor - Protection now expires after player death - Fixed crash in PVP Arena Gumps - Exceptional Damage Inc no longer gives extra points for Clean up Britannia Turn In - Fixed Loyalty Gump Crash - Fixed Stygian Dragon arty drops per EA * Potential Crash Fix * csproj update * Fixed conflict issue... WTF? * Bug Fixes *Requires Core Recompile* - Fixed cliloc on new belt craftables - failed craft no longer deletes crimson cincture and luck mempo - Added a core edit to Container.cs (had to do it folks) for better resource evaluation when considering resources to consume while crafting. In this instance, we don't want VvV or Faction items being used as craftable resources due to thier ease of obtaining. - Consolidated no-delete resources in CraftSystem.cs - Fellowship Data now serializes to prevent generation at each server start * Resolve Conflicts * Bug Fixes - Shield bash forumula no more EA like (still not perfect) - Healers now show to dead players (needs work) - Honor buff now persists through death - * crash fix * Moongate Fix - You have to be 1 tile to double click it. All other range checks are correct. * crash fix * Crash Fix
130 lines
3.7 KiB
C#
130 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using Server.Mobiles;
|
|
using Server.Items;
|
|
|
|
namespace Server.Misc
|
|
{
|
|
public class WeightOverloading
|
|
{
|
|
public const int OverloadAllowance = 4;// We can be four stones overweight without getting fatigued
|
|
|
|
public static void Initialize()
|
|
{
|
|
EventSink.Movement += new MovementEventHandler(EventSink_Movement);
|
|
Mobile.FatigueHandler = FatigueOnDamage;
|
|
}
|
|
|
|
public static void FatigueOnDamage(Mobile m, int damage, DFAlgorithm df)
|
|
{
|
|
double fatigue = 0.0;
|
|
var hits = Math.Max(1, m.Hits);
|
|
|
|
switch (m.DFA)
|
|
{
|
|
case DFAlgorithm.Standard:
|
|
{
|
|
fatigue = (damage * (m.HitsMax / hits) * ((double)m.Stam / m.StamMax)) - 5;
|
|
}
|
|
break;
|
|
case DFAlgorithm.PainSpike:
|
|
{
|
|
fatigue = (damage * ((m.HitsMax / hits) + ((50.0 + m.Stam) / m.StamMax) - 1.0)) - 5;
|
|
}
|
|
break;
|
|
}
|
|
|
|
var reduction = BaseArmor.GetInherentStaminaLossReduction(m) + 1;
|
|
|
|
if (reduction > 1)
|
|
{
|
|
fatigue = fatigue / reduction;
|
|
}
|
|
|
|
if (fatigue > 0)
|
|
{
|
|
// On EA, if follows this special rule to reduce the chances of your stamina being dropped to 0
|
|
if (m.Stam - fatigue <= 10)
|
|
{
|
|
m.Stam -= (int)(fatigue * ((double)m.Hits / (double)m.HitsMax));
|
|
}
|
|
else
|
|
{
|
|
m.Stam -= (int)fatigue;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void EventSink_Movement(MovementEventArgs e)
|
|
{
|
|
Mobile from = e.Mobile;
|
|
|
|
if (!from.Alive || from.IsStaff())
|
|
return;
|
|
|
|
if (!from.Player)
|
|
{
|
|
return;
|
|
}
|
|
|
|
int maxWeight = from.MaxWeight + 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 (!Core.SA && ((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10)
|
|
{
|
|
--from.Stam;
|
|
}
|
|
|
|
if (from.Stam == 0)
|
|
{
|
|
from.SendLocalizedMessage(from.Mounted ? 500108 : 500110); // Your mount is too fatigued to move. : You are too fatigued to move.
|
|
e.Blocked = true;
|
|
return;
|
|
}
|
|
|
|
var pm = from as PlayerMobile;
|
|
|
|
if (pm != null)
|
|
{
|
|
int amt = Core.SA ? 10 : (from.Mounted ? 48 : 16);
|
|
|
|
if ((++pm.StepsTaken % amt) == 0)
|
|
--from.Stam;
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public static bool IsOverloaded(Mobile m)
|
|
{
|
|
if (!m.Player || !m.Alive || m.IsStaff())
|
|
return false;
|
|
|
|
return ((Mobile.BodyWeight + m.TotalWeight) > (m.MaxWeight + OverloadAllowance));
|
|
}
|
|
}
|
|
}
|