fix: Codegens more misc items (#1216)

This commit is contained in:
Kamron Batman 2022-10-29 16:08:23 -07:00 • committed by GitHub
parent 32a5825ddd
commit 39e6f62ec9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 3042 additions and 3780 deletions

View file

@ -1,87 +1,70 @@
using System;
using ModernUO.Serialization;
using Server.Engines.PartySystem;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class MoonstoneGate : Moongate
{
public class MoonstoneGate : Moongate
private Mobile _caster;
public MoonstoneGate(Point3D loc, Map map, Map targetMap, Mobile caster, int hue) : base(loc, targetMap)
{
private readonly Mobile m_Caster;
MoveToWorld(loc, map);
Dispellable = false;
Hue = hue;
public MoonstoneGate(Point3D loc, Map map, Map targetMap, Mobile caster, int hue) : base(loc, targetMap)
_caster = caster;
new InternalTimer(this).Start();
Effects.PlaySound(loc, map, 0x20E);
}
public override void CheckGate(Mobile m, int range)
{
if (m.Kills >= 5)
{
MoveToWorld(loc, map);
Dispellable = false;
Hue = hue;
m_Caster = caster;
new InternalTimer(this).Start();
Effects.PlaySound(loc, map, 0x20E);
return;
}
public MoonstoneGate(Serial serial) : base(serial)
var casterParty = Party.Get(_caster);
var userParty = Party.Get(m);
if (m == _caster || casterParty != null && userParty == casterParty)
{
}
public override void CheckGate(Mobile m, int range)
{
if (m.Kills >= 5)
{
return;
}
var casterParty = Party.Get(m_Caster);
var userParty = Party.Get(m);
if (m == m_Caster || casterParty != null && userParty == casterParty)
{
base.CheckGate(m, range);
}
}
public override void UseGate(Mobile m)
{
if (m.Kills >= 5)
{
return;
}
var casterParty = Party.Get(m_Caster);
var userParty = Party.Get(m);
if (m == m_Caster || casterParty != null && userParty == casterParty)
{
base.UseGate(m);
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
Delete();
}
private class InternalTimer : Timer
{
private readonly Item m_Item;
public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0)) => m_Item = item;
protected override void OnTick()
{
m_Item.Delete();
}
base.CheckGate(m, range);
}
}
public override void UseGate(Mobile m)
{
if (m.Kills >= 5)
{
return;
}
var casterParty = Party.Get(_caster);
var userParty = Party.Get(m);
if (m == _caster || casterParty != null && userParty == casterParty)
{
base.UseGate(m);
}
}
[AfterDeserialization(false)]
private void AfterDeserialization()
{
Delete();
}
private class InternalTimer : Timer
{
private Item _item;
public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0)) => _item = item;
protected override void OnTick() => _item.Delete();
}
}