fix(core): Converts mobile stats packets (#360)

- [X] Converts mobile stats packets
- [X] Removes human racial from non-players
This commit is contained in:
Kamron Batman 2020-12-27 14:44:03 -08:00 • committed by GitHub
parent d73afdba8e
commit 5b69f1d389
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 413 additions and 423 deletions

View file

@ -50,46 +50,36 @@ namespace Server.Engines.PartySystem
public void OnStamChanged(Mobile m)
{
Packet p = null;
Span<byte> p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength];
OutgoingMobilePackets.CreateMobileStam(ref p, m, true);
for (var i = 0; i < Members.Count; ++i)
{
var c = Members[i].Mobile;
var ns = c.NetState;
if (c != m && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
{
if (p == null)
{
p = Packet.Acquire(new MobileStamN(m));
}
c.Send(p);
ns.Send(p);
}
}
Packet.Release(p);
}
public void OnManaChanged(Mobile m)
{
Packet p = null;
Span<byte> p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength];
OutgoingMobilePackets.CreateMobileMana(ref p, m, true);
for (var i = 0; i < Members.Count; ++i)
{
var c = Members[i].Mobile;
var ns = c.NetState;
if (c != m && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
{
if (p == null)
{
p = Packet.Acquire(new MobileManaN(m));
}
c.Send(p);
ns.Send(p);
}
}
Packet.Release(p);
}
public void OnStatsQuery(Mobile beholder, Mobile beheld)
@ -102,7 +92,7 @@ namespace Server.Engines.PartySystem
beholder.Send(new MobileStatusCompact(beheld.CanBeRenamedBy(beholder), beheld));
}
beholder.Send(new MobileAttributesN(beheld));
beholder.NetState.SendMobileAttributes(beheld, true);
}
}
@ -198,11 +188,13 @@ namespace Server.Engines.PartySystem
if (mi == null)
{
var ns = m.NetState;
Members.Add(new PartyMemberInfo(m));
m.Party = this;
var memberList = Packet.Acquire(new PartyMemberList(this));
var attrs = Packet.Acquire(new MobileAttributesN(m));
Span<byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength];
OutgoingMobilePackets.CreateMobileAttributes(ref attrsPacket, m, true);
for (var i = 0; i < Members.Count; ++i)
{
@ -213,14 +205,13 @@ namespace Server.Engines.PartySystem
if (f != m)
{
f.Send(new MobileStatusCompact(m.CanBeRenamedBy(f), m));
f.Send(attrs);
f.NetState?.Send(attrsPacket);
m.Send(new MobileStatusCompact(f.CanBeRenamedBy(m), f));
m.Send(new MobileAttributesN(f));
ns.SendMobileAttributes(f, true);
}
}
Packet.Release(memberList);
Packet.Release(attrs);
}
}
@ -516,7 +507,10 @@ namespace Server.Engines.PartySystem
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(m_Mobile.Name, "")];
buffer.InitializePacket();
var attrs = Packet.Acquire(new MobileAttributesN(m_Mobile));
Span<byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength];
OutgoingMobilePackets.CreateMobileAttributes(ref attrsPacket, m_Mobile, true);
var ns = m_Mobile.NetState;
foreach (var mi in p.Members)
{
@ -544,13 +538,11 @@ namespace Server.Engines.PartySystem
m.NetState?.Send(buffer);
m.Send(new MobileStatusCompact(m_Mobile.CanBeRenamedBy(m), m_Mobile));
m.Send(attrs);
m.NetState?.Send(attrsPacket);
m_Mobile.Send(new MobileStatusCompact(m.CanBeRenamedBy(m_Mobile), m));
m_Mobile.Send(new MobileAttributesN(m));
ns.SendMobileAttributes(m, true);
}
}
Packet.Release(attrs);
}
}
}

View file

@ -61,9 +61,14 @@ namespace Server.Misc
points += 40;
}
if (Core.ML && from.Race == Race.Human) // Is this affected by the cap?
if (Core.ML && from is PlayerMobile) // does racial bonus go before/after?
{
points += 2;
if (from.Race == Race.Human)
{
points += 2;
}
points = Math.Min(points, 18);
}
if (points < 0)
@ -71,11 +76,6 @@ namespace Server.Misc
points = 0;
}
if (Core.ML && from is PlayerMobile) // does racial bonus go before/after?
{
points = Math.Min(points, 18);
}
if (CheckTransform(from, typeof(HorrificBeastSpell)))
{
points += 20;
@ -86,7 +86,7 @@ namespace Server.Misc
points += from.Skills.Ninjitsu.Fixed / 30;
}
return TimeSpan.FromSeconds(1.0 / (0.1 * (1 + points)));
return TimeSpan.FromSeconds(10.0 / (1 + points));
}
private static TimeSpan Mobile_StamRegenRate(Mobile from)

View file

@ -913,7 +913,7 @@ namespace Server.Mobiles
public virtual TimeSpan BondingDelay => TimeSpan.FromDays(7.0);
public virtual TimeSpan BondingAbandonDelay => TimeSpan.FromDays(1.0);
public override bool CanRegenHits => !IsDeadPet && base.CanRegenHits;
public override bool CanRegenHits => !IsDeadPet && !Summoned && base.CanRegenHits;
public override bool CanRegenStam => !IsParagon && !IsDeadPet && base.CanRegenStam;
public override bool CanRegenMana => !IsDeadPet && base.CanRegenMana;