Skip to content

Commit

Permalink
remove superfluous arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
IcculusC committed Aug 12, 2024
1 parent 4c15aec commit f6e211c
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Projects/Server/Events/EventSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public static partial class EventSink
public static event Action<Mobile> PlayerDeath;
public static void InvokePlayerDeath(Mobile m) => PlayerDeath?.Invoke(m);

public static event Action<Mobile, List<AggressorInfo>, Mobile> MobileDeath;
public static void InvokeMobileDeath(Mobile mobile, List<AggressorInfo> aggressors, Mobile killer = null) => MobileDeath?.Invoke(mobile, aggressors, killer);
public static event Action<Mobile> MobileDeath;
public static void InvokeMobileDeath(Mobile mobile) => MobileDeath?.Invoke(mobile);

public static event Action<Mobile, int> VirtueMacroRequest;

Expand Down
138 changes: 102 additions & 36 deletions Projects/Server/Mobiles/Mobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,7 @@ public Target Target
}
}

[IgnoreDupe]
public bool Pushing { get; set; }
[IgnoreDupe] public bool Pushing { get; set; }

public virtual bool IsDeadBondedPet => false;

Expand Down Expand Up @@ -2847,6 +2846,7 @@ public virtual void ProcessDelta()
Layer.FacialHair
);
}

ourState.Send(facialHairPacket);
}

Expand Down Expand Up @@ -2984,6 +2984,7 @@ public virtual void ProcessDelta()
Layer.FacialHair
);
}

state.Send(facialHairPacket);
}

Expand Down Expand Up @@ -3429,7 +3430,6 @@ public virtual void ValidateSkillMods()
Skills[mod.Skill]?.Update();
}
}

}

public virtual void AddSkillMod(SkillMod mod)
Expand Down Expand Up @@ -4825,39 +4825,38 @@ public virtual void OnDeath(Container c)

if (!m_Player)
{
EventSink.InvokeMobileDeath(this, Aggressors, LastKiller);
EventSink.InvokeMobileDeath(this);
Delete();
return;
}
else
{
m_NetState.SendDeathStatus();

Warmode = false;
m_NetState.SendDeathStatus();

BodyMod = 0;
// Body = this.Female ? 0x193 : 0x192;
Body = Race.GhostBody(this);
Warmode = false;

var deathShroud = new Item(0x204E) { Movable = false, Layer = Layer.OuterTorso };
BodyMod = 0;
// Body = this.Female ? 0x193 : 0x192;
Body = Race.GhostBody(this);

AddItem(deathShroud);
var deathShroud = new Item(0x204E) { Movable = false, Layer = Layer.OuterTorso };

Items.Remove(deathShroud);
Items.Insert(0, deathShroud);
AddItem(deathShroud);

Poison = null;
Combatant = null;
Items.Remove(deathShroud);
Items.Insert(0, deathShroud);

Hits = 0;
Stam = 0;
Mana = 0;
Poison = null;
Combatant = null;

EventSink.InvokePlayerDeath(this);
Hits = 0;
Stam = 0;
Mana = 0;

ProcessDelta();
EventSink.InvokePlayerDeath(this);

CheckStatTimers();
}
ProcessDelta();

CheckStatTimers();
}

public virtual bool CheckTarget(Mobile from, Target targ, object targeted) => true;
Expand Down Expand Up @@ -5071,7 +5070,8 @@ public virtual void Lift(Item item, int amount, out bool rejected, out LRReason
{
var rootItem = root as Item;

Span<byte> buffer = stackalloc byte[OutgoingPlayerPackets.DragEffectPacketLength].InitializePacket();
Span<byte> buffer = stackalloc byte[OutgoingPlayerPackets.DragEffectPacketLength]
.InitializePacket();

foreach (var ns in map.GetClientsInRange(from.Location))
{
Expand Down Expand Up @@ -5589,7 +5589,8 @@ public virtual void DoSpeech(string text, int[] keywords, MessageType type, int
ProcessDelta();

Span<byte> regBuffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
Span<byte> mutBuffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(mutatedText)].InitializePacket();
Span<byte> mutBuffer =
stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(mutatedText)].InitializePacket();

// TODO: Should this be sorted like onSpeech is below?
for (var i = 0; i < hears.Count; ++i)
Expand All @@ -5599,7 +5600,16 @@ public virtual void DoSpeech(string text, int[] keywords, MessageType type, int
if (mutatedArgs == null || !CheckHearsMutatedSpeech(heard, mutateContext))
{
var length = OutgoingMessagePackets.CreateMessage(
regBuffer, Serial, Body, type, hue, 3, false, m_Language, Name, text
regBuffer,
Serial,
Body,
type,
hue,
3,
false,
m_Language,
Name,
text
);

if (length != regBuffer.Length)
Expand All @@ -5613,7 +5623,16 @@ public virtual void DoSpeech(string text, int[] keywords, MessageType type, int
else
{
var length = OutgoingMessagePackets.CreateMessage(
mutBuffer, Serial, Body, type, hue, 3, false, m_Language, Name, mutatedText
mutBuffer,
Serial,
Body,
type,
hue,
3,
false,
m_Language,
Name,
mutatedText
);

if (length != mutBuffer.Length)
Expand Down Expand Up @@ -6900,10 +6919,12 @@ public void SendEverything()
}
}

var range = new Rectangle2D(m_Location.X - Core.GlobalMaxUpdateRange,
var range = new Rectangle2D(
m_Location.X - Core.GlobalMaxUpdateRange,
m_Location.Y - Core.GlobalMaxUpdateRange,
Core.GlobalMaxUpdateRange * 2 + 1,
Core.GlobalMaxUpdateRange * 2 + 1);
Core.GlobalMaxUpdateRange * 2 + 1
);

foreach (var multi in m_Map.GetMultisInBounds(range))
{
Expand Down Expand Up @@ -8073,7 +8094,8 @@ public Map.MobileBoundsEnumerable<T> GetMobilesInRange<T>(int range) where T : M
m_Map == null ? Map.MobileBoundsEnumerable<T>.Empty : m_Map.GetMobilesInRange<T>(m_Location, range);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Map.ClientAtEnumerable GetClientsAt() => m_Map == null ? Map.ClientAtEnumerable.Empty : Map.GetClientsAt(m_Location);
public Map.ClientAtEnumerable GetClientsAt() =>
m_Map == null ? Map.ClientAtEnumerable.Empty : Map.GetClientsAt(m_Location);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Map.ClientBoundsEnumerable GetClientsInRange(int range) =>
Expand Down Expand Up @@ -8853,7 +8875,16 @@ public void PublicOverheadMessage(
)
{
var length = OutgoingMessagePackets.CreateMessage(
buffer, Serial, Body, type, hue, 3, ascii, Language, Name, text
buffer,
Serial,
Body,
type,
hue,
3,
ascii,
Language,
Name,
text
);

if (length != buffer.Length)
Expand All @@ -8880,7 +8911,15 @@ public void PublicOverheadMessage(MessageType type, int hue, int number, string
if (state.Mobile.CanSee(this) && (noLineOfSight || state.Mobile.InLOS(this)))
{
var length = OutgoingMessagePackets.CreateMessageLocalized(
buffer, Serial, Body, type, hue, 3, number, Name, args
buffer,
Serial,
Body,
type,
hue,
3,
number,
Name,
args
);

if (length != buffer.Length)
Expand Down Expand Up @@ -8916,7 +8955,17 @@ public void PublicOverheadMessage(
)
{
var length = OutgoingMessagePackets.CreateMessageLocalizedAffix(
buffer, Serial, Body, type, hue, 3, number, Name, affixType, affix, args
buffer,
Serial,
Body,
type,
hue,
3,
number,
Name,
affixType,
affix,
args
);

if (length != buffer.Length)
Expand Down Expand Up @@ -8960,7 +9009,15 @@ public void NonlocalOverheadMessage(MessageType type, int hue, int number, strin
if (state != m_NetState && state.Mobile.CanSee(this))
{
var length = OutgoingMessagePackets.CreateMessageLocalized(
buffer, Serial, Body, type, hue, 3, number, Name, args
buffer,
Serial,
Body,
type,
hue,
3,
number,
Name,
args
);

if (length != buffer.Length)
Expand All @@ -8987,7 +9044,16 @@ public void NonlocalOverheadMessage(MessageType type, int hue, bool ascii, strin
if (state != m_NetState && state.Mobile.CanSee(this))
{
var length = OutgoingMessagePackets.CreateMessage(
buffer, Serial, Body, type, hue, 3, ascii, Language, Name, text
buffer,
Serial,
Body,
type,
hue,
3,
ascii,
Language,
Name,
text
);

if (length != buffer.Length)
Expand Down

0 comments on commit f6e211c

Please sign in to comment.