## Changes
- [X] Adds OPL convenience methods
- `opl.Add(cliloc, value)` and `opl.Add(value)` - value as an integer or string works just like `opl.Add(cliloc, $"{value}")`
- `opl.AddLocalized(cliloc, clilocValue)` - works the same as `opl.Add(cliloc, $"#{clilocValue}");`
- [X] Simplifies basic `list.Add()` situations
- [X] Changes cliloc as an argument so it works with custom IPropertyList implementations (HTML)
- [X] Fixes plants so they support the old localization and new (changed in 7.0.12.0+)
- [X] Exposes more methods to override for Item to make creating custom OPL possible.
## Important Notes
* Using a ternary as an argument, like this `opl.Add(number, showType ? $"{type}\t{value}" : $"{value}");` _will not use the correct string interpolation_. This means if you use a custom PropertyList (for HTML or some other purpose), the property list won't be localized properly.
* All localization values must be interpolated, even if they are literal strings, or integers. Example: `opl.Add(number, $"{"Charges"}\t{m_Charges}");` is correct. Using the following: `$"Charges\t{m_Charges}"` will not work for custom PropertyList implementations!
60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public class ArcaneFocus : TransientItem
|
|
{
|
|
[Constructible]
|
|
public ArcaneFocus()
|
|
: this(TimeSpan.FromHours(1), 1)
|
|
{
|
|
}
|
|
|
|
[Constructible]
|
|
public ArcaneFocus(int lifeSpan, int strengthBonus)
|
|
: this(TimeSpan.FromSeconds(lifeSpan), strengthBonus)
|
|
{
|
|
}
|
|
|
|
public ArcaneFocus(TimeSpan lifeSpan, int strengthBonus) : base(0x3155, lifeSpan)
|
|
{
|
|
LootType = LootType.Blessed;
|
|
StrengthBonus = strengthBonus;
|
|
}
|
|
|
|
public ArcaneFocus(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override int LabelNumber => 1032629; // Arcane Focus
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public int StrengthBonus { get; set; }
|
|
|
|
public override TextDefinition InvalidTransferMessage => 1073480; // Your arcane focus disappears.
|
|
public override bool Nontransferable => true;
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
list.Add(1060485, StrengthBonus); // strength bonus ~1_val~
|
|
}
|
|
|
|
public override void Serialize(IGenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
writer.Write(0);
|
|
|
|
writer.Write(StrengthBonus);
|
|
}
|
|
|
|
public override void Deserialize(IGenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
var version = reader.ReadInt();
|
|
|
|
StrengthBonus = reader.ReadInt();
|
|
}
|
|
}
|
|
}
|