fix(core): Converts some player packets (#372)

- [X] Converts some player packets

Note:
- Not caching weather packet because it is copying directly from stackalloc using aggressive inlining. Don't need to do more optimizations.
This commit is contained in:
Kamron Batman 2020-12-29 23:47:56 -08:00 committed by GitHub
parent 67c23bf9ad
commit a59fda6a3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 350 additions and 276 deletions

View file

@ -60,7 +60,7 @@ namespace Server.Misc
var body = beheld.Profile ?? "";
var serial = beholder != beheld || !beheld.ProfileLocked ? beheld.Serial : Serial.Zero;
beholder.Send(new DisplayProfile(serial, header, body, footer));
beholder.NetState.SendDisplayProfile(serial, header, body, footer);
}
private static string GetAccountDuration(Mobile m)

View file

@ -354,8 +354,6 @@ namespace Server.Misc
type = 2;
}
Packet weatherPacket = null;
foreach (var ns in TcpServer.Instances)
{
var mob = ns.Mobile;
@ -377,15 +375,8 @@ namespace Server.Misc
continue;
}
if (weatherPacket == null)
{
weatherPacket = Packet.Acquire(new Network.Weather(type, density, temperature));
}
ns.Send(weatherPacket);
ns.SendWeather((byte)type, (byte)density, (byte)temperature);
}
Packet.Release(weatherPacket);
}
m_Stage++;

View file

@ -216,7 +216,7 @@ namespace Server.Spells
if (moveID != -1)
{
m.Send(new ToggleSpecialAbility(moveID + 1, false));
m.NetState.SendToggleSpecialAbility(moveID + 1, false);
}
}
}
@ -278,7 +278,7 @@ namespace Server.Spells
if (moveID > 0)
{
m.Send(new ToggleSpecialAbility(moveID + 1, true));
m.NetState.SendToggleSpecialAbility(moveID + 1, true);
}
TextDefinition.SendMessageTo(m, move.AbilityMessage);
@ -297,7 +297,7 @@ namespace Server.Spells
if (moveID > 0)
{
m.Send(new ToggleSpecialAbility(moveID + 1, false));
m.NetState.SendToggleSpecialAbility(moveID + 1, false);
}
}
}

View file

@ -126,7 +126,7 @@ namespace Server.Spells.Bushido
if (spellID > 0)
{
caster.Send(new ToggleSpecialAbility(spellID + 1, true));
caster.NetState.SendToggleSpecialAbility(spellID + 1, true);
}
}
@ -136,7 +136,7 @@ namespace Server.Spells.Bushido
if (spellID > 0)
{
caster.Send(new ToggleSpecialAbility(spellID + 1, false));
caster.NetState.SendToggleSpecialAbility(spellID + 1, false);
}
}
}