Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 • committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -185,7 +185,7 @@ namespace Server.Mobiles
public void OnRequestedAnimation(Mobile from)
{
StatuePackets.SendUpdateStatueAnimation(from.NetState, Serial, 1, m_Animation, m_Frames);
from.Send(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
}
public override void OnAosSingleClick(Mobile from)
@ -364,14 +364,22 @@ namespace Server.Mobiles
{
ProcessDelta();
Packet p = null;
IPooledEnumerable<NetState> eable = Map.GetClientsInRange(Location);
foreach (NetState state in eable)
{
state.Mobile.ProcessDelta();
StatuePackets.SendUpdateStatueAnimation(state, Serial, 1, m_Animation, m_Frames);
if (p == null)
p = Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
state.Send(p);
}
Packet.Release(p);
eable.Free();
}
}
@ -416,8 +424,9 @@ namespace Server.Mobiles
{
}
public override int LabelNumber =>
(Statue?.StatueType ?? m_Type) switch
public override int LabelNumber
{
get
{
StatueType t = m_Type;
@ -439,7 +448,13 @@ namespace Server.Mobiles
[CommandProperty(AccessLevel.GameMaster)]
public StatueType StatueType
{
get => Statue?.StatueType ?? m_Type;
get
{
if (Statue != null)
return Statue.StatueType;
return m_Type;
}
set => m_Type = value;
}
@ -596,11 +611,18 @@ namespace Server.Mobiles
from.SendGump(new CharacterStatueGump(m_Maker, statue, from));
}
else if (result == AddonFitResult.Blocked)
{
from.SendLocalizedMessage(500269); // You cannot build that there.
}
else if (result == AddonFitResult.NotInHouse)
{
from.SendLocalizedMessage(
1076192); // Statues can only be placed in houses where you are the owner or co-owner.
else if (result == AddonFitResult.DoorTooClose) from.SendLocalizedMessage(500271); // You cannot build near the door.
}
else if (result == AddonFitResult.DoorTooClose)
{
from.SendLocalizedMessage(500271); // You cannot build near the door.
}
}
else
{
@ -608,9 +630,15 @@ namespace Server.Mobiles
}
}
public static AddonFitResult CouldFit(Point3D p, Map map, Mobile from, ref BaseHouse house) =>
!map.CanFit(p.X, p.Y, p.Z, 20, true) ? AddonFitResult.Blocked :
!BaseAddon.CheckHouse(from, p, map, 20, ref house) ? AddonFitResult.NotInHouse : CheckDoors(p, 20, house);
public static AddonFitResult CouldFit(Point3D p, Map map, Mobile from, ref BaseHouse house)
{
if (!map.CanFit(p.X, p.Y, p.Z, 20, true))
return AddonFitResult.Blocked;
if (!BaseAddon.CheckHouse(from, p, map, 20, ref house))
return AddonFitResult.NotInHouse;
return CheckDoors(p, 20, house);
}
public static AddonFitResult CheckDoors(Point3D p, int height, BaseHouse house)
{

View file

@ -66,8 +66,9 @@ namespace Server.Gumps
}
}
private int GetMaterialNumber(StatueType type, StatueMaterial material) =>
material switch
private int GetMaterialNumber(StatueType type, StatueMaterial material)
{
switch (material)
{
case StatueMaterial.Antique:
@ -125,7 +126,7 @@ namespace Server.Gumps
m_Maker?.Delete();
m_Statue.Sculpt(sender.Mobile);
m_Statue.Sculpt(state.Mobile);
}
else if (info.ButtonID == (int)Buttons.PosePrev)
{
@ -173,11 +174,11 @@ namespace Server.Gumps
}
else // Close
{
sendGump = !m_Statue.Demolish(sender.Mobile);
sendGump = !m_Statue.Demolish(state.Mobile);
}
if (sendGump)
sender.Mobile.SendGump(new CharacterStatueGump(m_Maker, m_Statue, m_Owner));
state.Mobile.SendGump(new CharacterStatueGump(m_Maker, m_Statue, m_Owner));
}
private enum Buttons

View file

@ -1,25 +1,20 @@
using Server.Buffers;
namespace Server.Network
{
public static class StatuePackets
public class UpdateStatueAnimation : Packet
{
public static void SendUpdateStatueAnimation(NetState ns, Serial m, int status, int animation, int frame)
public UpdateStatueAnimation(Mobile m, int status, int animation, int frame) : base(0xBF, 17)
{
if (ns == null)
return;
SpanWriter writer = new SpanWriter(stackalloc byte[17]);
writer.Write((byte)0xBF); // Extended Packet ID
writer.Write((short)17); // Dynamic Length
writer.Write((short)0x19);
writer.Write((byte)0x5);
writer.Write(m);
writer.Write((short)0xFF);
writer.Write((byte)status);
writer.Write((short)animation);
writer.Write((short)frame);
m_Stream.Write((short)0x11);
m_Stream.Write((short)0x19);
m_Stream.Write((byte)0x5);
m_Stream.Write(m.Serial);
m_Stream.Write((byte)0);
m_Stream.Write((byte)0xFF);
m_Stream.Write((byte)status);
m_Stream.Write((byte)0);
m_Stream.Write((byte)animation);
m_Stream.Write((byte)0);
m_Stream.Write((byte)frame);
}
}
}
}

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using Server.Network;
namespace Server.Gumps
@ -52,7 +51,17 @@ namespace Server.Gumps
m_Option.OnOptionSelected(sender.Mobile, info.ButtonID);
}
private bool Contains(int chosen) => m_Options?.Any(option => option.ID == chosen) == true;
private bool Contains(int chosen)
{
if (m_Options == null)
return false;
foreach (RewardOption option in m_Options)
if (option.ID == chosen)
return true;
return false;
}
}
public class RewardOption