Effects packets (#308)

- [X] Changes effect packets
- [X] Updates playing sounds
- [X] Updates Effects class to have more options so there are less direct calls to building the packets
- [X] Changes bonding status packet
This commit is contained in:
Kamron Batman 2020-11-12 00:52:38 -08:00 committed by GitHub
parent 1c9439e4fd
commit 361ec4dba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 958 additions and 833 deletions

View file

@ -67,7 +67,7 @@ namespace Server.Items
Location = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
}
Effects.PlaySound(this, Map, m_Open ? OpenedSound : ClosedSound);
Effects.PlaySound(this, m_Open ? OpenedSound : ClosedSound);
if (m_Open)
{

View file

@ -81,24 +81,21 @@ namespace Server.Items
{
if (dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto(from, dropped, point))
{
Packet p = new PlaySound(0x127, GetWorldLocation());
p.Acquire();
if (RootParent == from)
{
from.Send(p);
from.SendSound(0x127, GetWorldLocation());
}
else
{
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength];
OutgoingEffectPackets.CreateSoundEffect(ref buffer, 0x127, GetWorldLocation());
foreach (var state in GetClientsInRange(2))
{
state.Send(p);
state.Send(buffer);
}
}
p.Release();
return true;
}

View file

@ -886,7 +886,7 @@ namespace Server.Items
m_Chest.Z++;
}
Effects.PlaySound(m_Chest, m_Map, 0x33B);
Effects.PlaySound(m_Chest.Location, m_Map, 0x33B);
}
if (m_Chest?.Location.Z >= m_Location.Z)

View file

@ -180,7 +180,7 @@ namespace Server.Items
{
if (from.AccessLevel == AccessLevel.Player || !from.Hidden)
{
from.Send(new PlaySound(0x20E, from.Location));
from.SendSound(0x20E, from);
}
from.CloseGump<MoongateConfirmGump>();

View file

@ -414,7 +414,7 @@ namespace Server.Items
rune.Delete();
from.Send(new PlaySound(0x42, GetWorldLocation()));
from.SendSound(0x42, GetWorldLocation());
from.SendMessage((rune.Description?.Trim()).DefaultIfNullOrEmpty("(indescript)"));
@ -432,7 +432,7 @@ namespace Server.Items
{
if (CurCharges < MaxCharges)
{
from.Send(new PlaySound(0x249, GetWorldLocation()));
from.SendSound(0x249, GetWorldLocation());
var amount = dropped.Amount;

View file

@ -591,7 +591,7 @@ namespace Server.Items
scroll.Delete();
from.Send(new PlaySound(0x249, GetWorldLocation()));
from.SendSound(0x249, GetWorldLocation());
return true;
}
}

View file

@ -58,7 +58,7 @@ namespace Server.Items
}
}
public void Use(Mobile from, IPoint3D loc)
public void Use(Mobile from, Point3D loc)
{
if (!CheckUse(from))
{
@ -84,23 +84,14 @@ namespace Server.Items
from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);
from.PlaySound(0x15F);
Effects.SendPacket(
Effects.SendMovingEffect(
from,
from.Map,
new HuedEffect(
EffectType.Moving,
from.Serial,
Serial.Zero,
0x36D4,
from.Location,
loc,
5,
0,
false,
true,
0,
0
)
loc,
0x36D4,
5,
0,
false,
true
);
var eable = from.Map.GetMobilesInRange(new Point3D(loc), 2);
@ -241,14 +232,14 @@ namespace Server.Items
return;
}
IPoint3D loc;
Point3D loc;
if (targeted is Item item)
{
loc = item.GetWorldLocation();
}
else
{
loc = targeted as IPoint3D;
loc = new Point3D(targeted as IPoint3D);
}
m_Horn.Use(from, loc);

View file

@ -214,11 +214,11 @@ namespace Server.Items
}
}
public void DoFireEffect(IPoint3D target)
public void DoFireEffect(Point3D target)
{
var map = Map;
if (target == null || map == null)
if (map == null)
{
return;
}
@ -228,7 +228,7 @@ namespace Server.Items
for (var count = Utility.Random(3); count > 0; count--)
{
IPoint3D location = new Point3D(
Point3D location = new Point3D(
target.X + Utility.RandomMinMax(-1, 1),
target.Y + Utility.RandomMinMax(-1, 1),
target.Z
@ -320,9 +320,11 @@ namespace Server.Items
break;
}
if (allow && Utility.InRange(new Point3D(p), m_Cannon.Location, 14))
var loc = new Point3D(p);
if (allow && Utility.InRange(loc, m_Cannon.Location, 14))
{
m_Cannon.DoFireEffect(p);
m_Cannon.DoFireEffect(loc);
}
else
{

View file

@ -408,7 +408,7 @@ namespace Server.Items
20,
5042
);
Effects.PlaySound(m_Creature, m_Creature.Map, 0x201);
Effects.PlaySound(m_Creature, 0x201);
m_Creature.Delete();
}

View file

@ -58,7 +58,8 @@ namespace Server.Mobiles
20,
5042
);
Effects.PlaySound(m_Mobile, m_Mobile.Map, 0x201);
Effects.PlaySound(m_Mobile,0x201);
m_Mobile.Delete();
}
@ -405,13 +406,13 @@ namespace Server.Mobiles
/*
// An area attack that only damages staff, wtf?
private DateTime m_NextWave;
public void AreaHeatDamage()
{
Mobile mob = ControlMaster;
if (mob != null)
{
if (mob.InRange( Location, 2 ))
@ -422,9 +423,9 @@ namespace Server.Mobiles
mob.SendLocalizedMessage( 1008112 ); // The intense heat is damaging you!
}
}
GuardedRegion r = Region as GuardedRegion;
if (r != null && mob.Alive)
{
foreach ( Mobile m in GetMobilesInRange( 2 ) )
@ -434,7 +435,7 @@ namespace Server.Mobiles
}
}
}
m_NextWave = DateTime.UtcNow + TimeSpan.FromSeconds( 3 );
}
*/

View file

@ -3550,7 +3550,7 @@ namespace Server.Items
20,
5042
);
Effects.PlaySound(defender, defender.Map, 0x201);
Effects.PlaySound(defender, 0x201);
defender.Delete();
}