fix: Codegens tools and magical skill items (#1299)
This commit is contained in:
parent
f314c63175
commit
899c2e868d
24 changed files with 1529 additions and 1732 deletions
|
|
@ -1,356 +1,320 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[Flippable(0x1f14, 0x1f15, 0x1f16, 0x1f17)]
|
||||
[SerializationGenerator(2, false)]
|
||||
public partial class RecallRune : Item
|
||||
{
|
||||
[Flippable(0x1f14, 0x1f15, 0x1f16, 0x1f17)]
|
||||
public class RecallRune : Item
|
||||
[InvalidateProperties]
|
||||
[SerializableField(1)]
|
||||
[SerializedCommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
private string _description;
|
||||
|
||||
[SerializableField(3)]
|
||||
[SerializedCommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
private Point3D _target;
|
||||
|
||||
[Constructible]
|
||||
public RecallRune() : base(0x1F14)
|
||||
{
|
||||
private string m_Description;
|
||||
private BaseHouse m_House;
|
||||
private bool m_Marked;
|
||||
private Map m_TargetMap;
|
||||
Weight = 1.0;
|
||||
CalculateHue();
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RecallRune() : base(0x1F14)
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public BaseHouse House
|
||||
{
|
||||
get
|
||||
{
|
||||
Weight = 1.0;
|
||||
CalculateHue();
|
||||
}
|
||||
|
||||
public RecallRune(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public BaseHouse House
|
||||
{
|
||||
get
|
||||
if (_house?.Deleted == true)
|
||||
{
|
||||
if (m_House?.Deleted == true)
|
||||
{
|
||||
House = null;
|
||||
}
|
||||
|
||||
return m_House;
|
||||
House = null;
|
||||
}
|
||||
set
|
||||
|
||||
return _house;
|
||||
}
|
||||
set
|
||||
{
|
||||
_house = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializableProperty(2)]
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public bool Marked
|
||||
{
|
||||
get => _marked;
|
||||
set
|
||||
{
|
||||
if (_marked != value)
|
||||
{
|
||||
m_House = value;
|
||||
_marked = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public string Description
|
||||
[SerializableProperty(4)]
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public Map TargetMap
|
||||
{
|
||||
get => _targetMap;
|
||||
set
|
||||
{
|
||||
get => m_Description;
|
||||
set
|
||||
if (_targetMap != value)
|
||||
{
|
||||
m_Description = value;
|
||||
_targetMap = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public bool Marked
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
get => m_Marked;
|
||||
set
|
||||
{
|
||||
if (m_Marked != value)
|
||||
case 1:
|
||||
{
|
||||
m_Marked = value;
|
||||
_house = reader.ReadEntity<BaseHouse>();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
_description = reader.ReadString();
|
||||
_marked = reader.ReadBool();
|
||||
Target = reader.ReadPoint3D();
|
||||
_targetMap = reader.ReadMap();
|
||||
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public Point3D Target { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public Map TargetMap
|
||||
private void CalculateHue()
|
||||
{
|
||||
if (!_marked)
|
||||
{
|
||||
get => m_TargetMap;
|
||||
set
|
||||
{
|
||||
if (m_TargetMap != value)
|
||||
{
|
||||
m_TargetMap = value;
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
Hue = 0;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
else if (_targetMap == Map.Trammel)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
if (m_House?.Deleted == false)
|
||||
{
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(m_House);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
writer.Write(m_Description);
|
||||
writer.Write(m_Marked);
|
||||
writer.Write(Target);
|
||||
writer.Write(m_TargetMap);
|
||||
Hue = House != null ? 0x47F : 50;
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
else if (_targetMap == Map.Felucca)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_House = reader.ReadEntity<BaseHouse>();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Description = reader.ReadString();
|
||||
m_Marked = reader.ReadBool();
|
||||
Target = reader.ReadPoint3D();
|
||||
m_TargetMap = reader.ReadMap();
|
||||
|
||||
CalculateHue();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
Hue = House != null ? 0x66D : 0;
|
||||
}
|
||||
|
||||
private void CalculateHue()
|
||||
else if (_targetMap == Map.Ilshenar)
|
||||
{
|
||||
if (!m_Marked)
|
||||
{
|
||||
Hue = 0;
|
||||
}
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
{
|
||||
Hue = House != null ? 0x47F : 50;
|
||||
}
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
{
|
||||
Hue = House != null ? 0x66D : 0;
|
||||
}
|
||||
else if (m_TargetMap == Map.Ilshenar)
|
||||
{
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
}
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
{
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
}
|
||||
else if (m_TargetMap == Map.Tokuno)
|
||||
{
|
||||
Hue = House != null ? 0x47F : 1154;
|
||||
}
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
}
|
||||
|
||||
public void Mark(Mobile m)
|
||||
else if (_targetMap == Map.Malas)
|
||||
{
|
||||
m_Marked = true;
|
||||
Hue = House != null ? 0x55F : 1102;
|
||||
}
|
||||
else if (_targetMap == Map.Tokuno)
|
||||
{
|
||||
Hue = House != null ? 0x47F : 1154;
|
||||
}
|
||||
}
|
||||
|
||||
var setDesc = false;
|
||||
if (Core.AOS)
|
||||
public void Mark(Mobile m)
|
||||
{
|
||||
_marked = true;
|
||||
|
||||
var setDesc = false;
|
||||
if (Core.AOS)
|
||||
{
|
||||
_house = BaseHouse.FindHouseAt(m);
|
||||
|
||||
if (_house == null)
|
||||
{
|
||||
m_House = BaseHouse.FindHouseAt(m);
|
||||
|
||||
if (m_House == null)
|
||||
{
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sign = m_House.Sign;
|
||||
|
||||
m_Description = (sign?.Name?.Trim()).DefaultIfNullOrEmpty("an unnamed house");
|
||||
|
||||
setDesc = true;
|
||||
|
||||
var x = m_House.BanLocation.X;
|
||||
var y = m_House.BanLocation.Y + 2;
|
||||
var z = m_House.BanLocation.Z;
|
||||
|
||||
var map = m_House.Map;
|
||||
|
||||
if (map?.CanFit(x, y, z, 16, false, false) == false)
|
||||
{
|
||||
z = map.GetAverageZ(x, y);
|
||||
}
|
||||
|
||||
Target = new Point3D(x, y, z);
|
||||
m_TargetMap = map;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_House = null;
|
||||
Target = m.Location;
|
||||
m_TargetMap = m.Map;
|
||||
}
|
||||
|
||||
if (!setDesc)
|
||||
{
|
||||
m_Description = BaseRegion.GetRuneNameFor(Region.Find(Target, m_TargetMap));
|
||||
}
|
||||
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_Marked)
|
||||
{
|
||||
string desc;
|
||||
|
||||
if ((desc = m_Description) == null || (desc = desc.Trim()).Length == 0)
|
||||
{
|
||||
desc = "an unknown location";
|
||||
}
|
||||
|
||||
if (m_TargetMap == Map.Tokuno)
|
||||
{
|
||||
list.Add(House != null ? 1063260 : 1063259, $"a recall rune for {desc}"); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
}
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
{
|
||||
list.Add(House != null ? 1062454 : 1060804, $"a recall rune for {desc}"); // ~1_val~ (Malas)[(House)]
|
||||
}
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
{
|
||||
list.Add(House != null ? 1062452 : 1060805, $"a recall rune for {desc}"); // ~1_val~ (Felucca)[(House)]
|
||||
}
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
{
|
||||
list.Add(House != null ? 1062453 : 1060806, $"a recall rune for {desc}"); // ~1_val~ (Trammel)[(House)]
|
||||
}
|
||||
else if (House != null)
|
||||
{
|
||||
list.Add($"a recall rune for {desc} ({m_TargetMap})(House)");
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add($"a recall rune for {desc} ({m_TargetMap})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (m_Marked)
|
||||
{
|
||||
var desc = (m_Description?.Trim()).DefaultIfNullOrEmpty("an unknown location");
|
||||
|
||||
if (m_TargetMap == Map.Tokuno)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1063260 : 1063259, // ~1_val~ (Tokuno Islands)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (m_TargetMap == Map.Malas)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062454 : 1060804, // ~1_val~ (Malas)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (m_TargetMap == Map.Felucca)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062452 : 1060805, // ~1_val~ (Felucca)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (m_TargetMap == Map.Trammel)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062453 : 1060806, // ~1_val~ (Trammel)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (House != null)
|
||||
{
|
||||
LabelTo(from, $"a recall rune for {desc} ({m_TargetMap})(House)");
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, $"a recall rune for {desc} ({m_TargetMap})");
|
||||
}
|
||||
}
|
||||
_targetMap = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, "an unmarked recall rune");
|
||||
var sign = _house.Sign;
|
||||
|
||||
_description = (sign?.Name?.Trim()).DefaultIfNullOrEmpty("an unnamed house");
|
||||
|
||||
setDesc = true;
|
||||
|
||||
var x = _house.BanLocation.X;
|
||||
var y = _house.BanLocation.Y + 2;
|
||||
var z = _house.BanLocation.Z;
|
||||
|
||||
var map = _house.Map;
|
||||
|
||||
if (map?.CanFit(x, y, z, 16, false, false) == false)
|
||||
{
|
||||
z = map.GetAverageZ(x, y);
|
||||
}
|
||||
|
||||
Target = new Point3D(x, y, z);
|
||||
_targetMap = map;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
else
|
||||
{
|
||||
int number;
|
||||
_house = null;
|
||||
Target = m.Location;
|
||||
_targetMap = m.Map;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
if (!setDesc)
|
||||
{
|
||||
_description = BaseRegion.GetRuneNameFor(Region.Find(Target, _targetMap));
|
||||
}
|
||||
|
||||
CalculateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_marked)
|
||||
{
|
||||
string desc;
|
||||
|
||||
if ((desc = _description) == null || (desc = desc.Trim()).Length == 0)
|
||||
{
|
||||
number = 1042001; // That must be in your pack for you to use it.
|
||||
desc = "an unknown location";
|
||||
}
|
||||
|
||||
if (_targetMap == Map.Tokuno)
|
||||
{
|
||||
list.Add(House != null ? 1063260 : 1063259, $"a recall rune for {desc}"); // ~1_val~ (Tokuno Islands)[(House)]
|
||||
}
|
||||
else if (_targetMap == Map.Malas)
|
||||
{
|
||||
list.Add(House != null ? 1062454 : 1060804, $"a recall rune for {desc}"); // ~1_val~ (Malas)[(House)]
|
||||
}
|
||||
else if (_targetMap == Map.Felucca)
|
||||
{
|
||||
list.Add(House != null ? 1062452 : 1060805, $"a recall rune for {desc}"); // ~1_val~ (Felucca)[(House)]
|
||||
}
|
||||
else if (_targetMap == Map.Trammel)
|
||||
{
|
||||
list.Add(House != null ? 1062453 : 1060806, $"a recall rune for {desc}"); // ~1_val~ (Trammel)[(House)]
|
||||
}
|
||||
else if (House != null)
|
||||
{
|
||||
number = 1062399; // You cannot edit the description for this rune.
|
||||
}
|
||||
else if (m_Marked)
|
||||
{
|
||||
number = 501804; // Please enter a description for this marked object.
|
||||
|
||||
from.Prompt = new RenamePrompt(this);
|
||||
list.Add($"a recall rune for {desc} ({_targetMap})(House)");
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501805; // That rune is not yet marked.
|
||||
list.Add($"a recall rune for {desc} ({_targetMap})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(number);
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (_marked)
|
||||
{
|
||||
var desc = (_description?.Trim()).DefaultIfNullOrEmpty("an unknown location");
|
||||
|
||||
if (_targetMap == Map.Tokuno)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1063260 : 1063259, // ~1_val~ (Tokuno Islands)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (_targetMap == Map.Malas)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062454 : 1060804, // ~1_val~ (Malas)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (_targetMap == Map.Felucca)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062452 : 1060805, // ~1_val~ (Felucca)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else if (_targetMap == Map.Trammel)
|
||||
{
|
||||
LabelTo(
|
||||
from,
|
||||
House != null ? 1062453 : 1060806, // ~1_val~ (Trammel)[(House)]
|
||||
$"a recall rune for {desc}"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (House != null)
|
||||
{
|
||||
LabelTo(from, $"a recall rune for {desc} ({_targetMap})(House)");
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, $"a recall rune for {desc} ({_targetMap})");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, "an unmarked recall rune");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
int number;
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
number = 1042001; // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (House != null)
|
||||
{
|
||||
number = 1062399; // You cannot edit the description for this rune.
|
||||
}
|
||||
else if (_marked)
|
||||
{
|
||||
number = 501804; // Please enter a description for this marked object.
|
||||
|
||||
from.Prompt = new RenamePrompt(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501805; // That rune is not yet marked.
|
||||
}
|
||||
|
||||
private class RenamePrompt : Prompt
|
||||
from.SendLocalizedMessage(number);
|
||||
}
|
||||
|
||||
private class RenamePrompt : Prompt
|
||||
{
|
||||
private RecallRune _rune;
|
||||
|
||||
public RenamePrompt(RecallRune rune) => _rune = rune;
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
private readonly RecallRune m_Rune;
|
||||
|
||||
public RenamePrompt(RecallRune rune) => m_Rune = rune;
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
if (_rune.House == null && _rune.Marked)
|
||||
{
|
||||
if (m_Rune.House == null && m_Rune.Marked)
|
||||
{
|
||||
m_Rune.Description = text;
|
||||
from.SendLocalizedMessage(1010474); // The etching on the rune has been changed.
|
||||
}
|
||||
_rune.Description = text;
|
||||
from.SendLocalizedMessage(1010474); // The etching on the rune has been changed.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue