fix: Codegens fishing pole (#1288)
This commit is contained in:
parent
0b4cd460de
commit
af29fa0243
5 changed files with 79 additions and 121 deletions
|
|
@ -1,77 +1,55 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ModernUO.Serialization;
|
||||||
using Server.ContextMenus;
|
using Server.ContextMenus;
|
||||||
using Server.Engines.Harvest;
|
using Server.Engines.Harvest;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items;
|
||||||
|
|
||||||
|
[SerializationGenerator(0, false)]
|
||||||
|
public partial class FishingPole : Item
|
||||||
{
|
{
|
||||||
public class FishingPole : Item
|
[Constructible]
|
||||||
|
public FishingPole() : base(0x0DC0)
|
||||||
{
|
{
|
||||||
[Constructible]
|
Layer = Layer.TwoHanded;
|
||||||
public FishingPole() : base(0x0DC0)
|
Weight = 8.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDoubleClick(Mobile from)
|
||||||
|
{
|
||||||
|
var loc = GetWorldLocation();
|
||||||
|
|
||||||
|
if (!from.InLOS(loc) || !from.InRange(loc, 2))
|
||||||
{
|
{
|
||||||
Layer = Layer.TwoHanded;
|
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
|
||||||
Weight = 8.0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
public FishingPole(Serial serial) : base(serial)
|
|
||||||
{
|
{
|
||||||
}
|
Fishing.System.BeginHarvesting(from, this);
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
|
||||||
{
|
|
||||||
var loc = GetWorldLocation();
|
|
||||||
|
|
||||||
if (!from.InLOS(loc) || !from.InRange(loc, 2))
|
|
||||||
{
|
|
||||||
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Fishing.System.BeginHarvesting(from, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
|
||||||
{
|
|
||||||
base.GetContextMenuEntries(from, list);
|
|
||||||
|
|
||||||
BaseHarvestTool.AddContextMenuEntries(from, this, list, Fishing.System);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CheckConflictingLayer(Mobile m, Item item, Layer layer)
|
|
||||||
{
|
|
||||||
if (base.CheckConflictingLayer(m, item, layer))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layer == Layer.OneHanded)
|
|
||||||
{
|
|
||||||
m.SendLocalizedMessage(500214); // You already have something in both hands.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
base.Serialize(writer);
|
|
||||||
|
|
||||||
writer.Write(1); // version
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
|
||||||
{
|
|
||||||
base.Deserialize(reader);
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
if (version < 1 && Layer == Layer.OneHanded)
|
|
||||||
{
|
|
||||||
Layer = Layer.TwoHanded;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||||
|
{
|
||||||
|
base.GetContextMenuEntries(from, list);
|
||||||
|
|
||||||
|
BaseHarvestTool.AddContextMenuEntries(from, this, list, Fishing.System);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CheckConflictingLayer(Mobile m, Item item, Layer layer)
|
||||||
|
{
|
||||||
|
if (base.CheckConflictingLayer(m, item, layer))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layer == Layer.OneHanded)
|
||||||
|
{
|
||||||
|
m.SendLocalizedMessage(500214); // You already have something in both hands.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using ModernUO.Serialization;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Multis;
|
using Server.Multis;
|
||||||
using Server.Spells;
|
using Server.Spells;
|
||||||
|
|
@ -6,7 +7,8 @@ using Server.Targeting;
|
||||||
|
|
||||||
namespace Server.Items;
|
namespace Server.Items;
|
||||||
|
|
||||||
public class SpecialFishingNet : Item
|
[SerializationGenerator(0, false)]
|
||||||
|
public partial class SpecialFishingNet : Item
|
||||||
{
|
{
|
||||||
private static int[] _hues =
|
private static int[] _hues =
|
||||||
{
|
{
|
||||||
|
|
@ -37,6 +39,10 @@ public class SpecialFishingNet : Item
|
||||||
0x1797, 0x179C
|
0x1797, 0x179C
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[SerializableField(0)]
|
||||||
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||||
|
private bool _inUse;
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public SpecialFishingNet() : base(0x0DCA)
|
public SpecialFishingNet() : base(0x0DCA)
|
||||||
{
|
{
|
||||||
|
|
@ -44,15 +50,8 @@ public class SpecialFishingNet : Item
|
||||||
Hue = Utility.RandomDouble() < 0.01 ? _hues.RandomElement() : 0x8A0;
|
Hue = Utility.RandomDouble() < 0.01 ? _hues.RandomElement() : 0x8A0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpecialFishingNet(Serial serial) : base(serial)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int LabelNumber => 1041079; // a special fishing net
|
public override int LabelNumber => 1041079; // a special fishing net
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
public bool InUse { get; set; }
|
|
||||||
|
|
||||||
public virtual bool RequireDeepWater => true;
|
public virtual bool RequireDeepWater => true;
|
||||||
|
|
||||||
public override void GetProperties(IPropertyList list)
|
public override void GetProperties(IPropertyList list)
|
||||||
|
|
@ -68,42 +67,18 @@ public class SpecialFishingNet : Item
|
||||||
list.Add(1017410); // Special Fishing Net
|
list.Add(1017410); // Special Fishing Net
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
[AfterDeserialization]
|
||||||
|
private void AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.Serialize(writer);
|
if (_inUse)
|
||||||
|
|
||||||
writer.Write(1); // version
|
|
||||||
|
|
||||||
writer.Write(InUse);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
|
||||||
{
|
|
||||||
base.Deserialize(reader);
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
switch (version)
|
|
||||||
{
|
{
|
||||||
case 1:
|
Delete();
|
||||||
{
|
|
||||||
InUse = reader.ReadBool();
|
|
||||||
|
|
||||||
if (InUse)
|
|
||||||
{
|
|
||||||
Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stackable = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (InUse)
|
if (_inUse)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(1010483); // Someone is already using that net!
|
from.SendLocalizedMessage(1010483); // Someone is already using that net!
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +95,7 @@ public class SpecialFishingNet : Item
|
||||||
|
|
||||||
public void OnTarget(Mobile from, object obj)
|
public void OnTarget(Mobile from, object obj)
|
||||||
{
|
{
|
||||||
if (Deleted || InUse)
|
if (Deleted || _inUse)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -422,15 +397,12 @@ public class SpecialFishingNet : Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FabledFishingNet : SpecialFishingNet
|
[SerializationGenerator(0, false)]
|
||||||
|
public partial class FabledFishingNet : SpecialFishingNet
|
||||||
{
|
{
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public FabledFishingNet() => Hue = 0x481;
|
public FabledFishingNet() => Hue = 0x481;
|
||||||
|
|
||||||
public FabledFishingNet(Serial serial) : base(serial)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int LabelNumber => 1063451; // a fabled fishing net
|
public override int LabelNumber => 1063451; // a fabled fishing net
|
||||||
|
|
||||||
protected override void AddNetProperties(IPropertyList list)
|
protected override void AddNetProperties(IPropertyList list)
|
||||||
|
|
@ -445,18 +417,4 @@ public class FabledFishingNet : SpecialFishingNet
|
||||||
|
|
||||||
base.FinishEffect(p, map, from);
|
base.FinishEffect(p, map, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Items.FabledFishingNet"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Items.FishingPole"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Items.SpecialFishingNet",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "InUse",
|
||||||
|
"type": "bool",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue