## Breaking Changes (New API)
ObjectPropertyList supports the following API:
```cs
list.Add(500000);
list.Add(500001, stringArgument);
list.Add("Some text");
list.Add($"Some text with {argument}");
list.Add(500002, $"{arg1}\t{arg2}");
```
## Notes
1. All API uses that require a formatter like this:
```cs
list.Add(500002, "{0}\t{1}", arg1, arg2);
```
Should be changed to use string interpolation, for example:
```cs
list.Add(500002, $"{arg1}\t{arg2}");
```
2. The following paradigm should no longer be used:
```cs
list.Add(1061170, prop.ToString()); // strength requirement ~1_val~
```
The new string interpolation API will avoid having to convert the argument to a string before writing it to the packet. Instead use the following:
```cs
list.Add(1061170, $"{prop}"); // strength requirement ~1_val~
```
### Benchmarks
```cs
| Method | Mean | Error | StdDev | Gen 0 | Allocated |
|------------------------------- |---------:|--------:|--------:|-------:|----------:|
| BenchmarkOldOPL | 241.0 ns | 0.56 ns | 0.47 ns | 0.0105 | 88 B |
| BenchmarkStringInterpolatedOPL | 199.9 ns | 2.44 ns | 2.39 ns | - | - |
```
### Changes
- [X] Removes crash in STArray.Return when array is null.
- [X] Fixes NPE in OPL when entity is null. Serial in packet will be 0 when entity is null.
- [X] Fixes NPE in AosAttributes when Parent is null.
- [X] Changes OPL to use string interpolation.
- [X] Introduces `IPropertyList` to allow extending PropertyList for other uses.
150 lines
4.7 KiB
C#
150 lines
4.7 KiB
C#
using ModernUO.Serialization;
|
|
|
|
namespace Server.Items
|
|
{
|
|
[SerializationGenerator(0)]
|
|
public partial class FropozJournal : RedBook
|
|
{
|
|
public static readonly BookContent Content = new(
|
|
"Journal",
|
|
"Fropoz",
|
|
new BookPageInfo(
|
|
"I have done as my",
|
|
"Master has",
|
|
"instructed me.",
|
|
"",
|
|
"The painted humans",
|
|
"have been driven into",
|
|
"Britannia and are even",
|
|
"now wreaking havoc"
|
|
),
|
|
new BookPageInfo(
|
|
"across the land,",
|
|
"providing us with the",
|
|
"distraction my Master",
|
|
"requested. We",
|
|
"have provided them",
|
|
"with the masks",
|
|
"necessary to defeat",
|
|
"the orcs, thus"
|
|
),
|
|
new BookPageInfo(
|
|
"causing even more",
|
|
"distress for the people",
|
|
"of Britannia. The",
|
|
"unsuspecting fools",
|
|
"are too busy dealing",
|
|
"with the orc hordes to",
|
|
"continue their",
|
|
"exploration of our"
|
|
),
|
|
new BookPageInfo(
|
|
"lands. We are",
|
|
"safe...for now.",
|
|
" ----",
|
|
"The attacks",
|
|
"continue exactly as",
|
|
"planned. My Master",
|
|
"is pleased with my",
|
|
"work and we are"
|
|
),
|
|
new BookPageInfo(
|
|
"closer to our goals than",
|
|
"ever before. The",
|
|
"gargoyles have proven",
|
|
"to be more troublesome",
|
|
"than we first",
|
|
"anticipated, but I",
|
|
"believe we can",
|
|
"subjugate them fully"
|
|
),
|
|
new BookPageInfo(
|
|
"given enough time. It's",
|
|
"unfortunate that we",
|
|
"did not discover their",
|
|
"knowledge sooner.",
|
|
"Even now they",
|
|
"prepare our armies",
|
|
"for battle, but not",
|
|
"without resistance."
|
|
),
|
|
new BookPageInfo(
|
|
"Now that some of",
|
|
"them know of the",
|
|
"other lands and of",
|
|
"humans, they will",
|
|
"double their efforts to",
|
|
"seek help. This",
|
|
"cannot be allowed.",
|
|
" -----"
|
|
),
|
|
new BookPageInfo(
|
|
"Damn them!! The",
|
|
"humans proved",
|
|
"more resourcefull than",
|
|
"we thought them",
|
|
"capable of. Already",
|
|
"their homes are free",
|
|
"of orcs and savages",
|
|
"and they once again"
|
|
),
|
|
new BookPageInfo(
|
|
"are treading in our",
|
|
"lands. We may have to",
|
|
"move sooner than we",
|
|
"thought. I will",
|
|
"prepar my brethern",
|
|
"and our golems.",
|
|
"Hopefully, we can",
|
|
"buy our Master some"
|
|
),
|
|
new BookPageInfo(
|
|
"more time before the",
|
|
"humans discover us.",
|
|
" -----",
|
|
"It's too late. The",
|
|
"gargoyles whom have",
|
|
"evaded our capture",
|
|
"have opened the doors",
|
|
"to our land."
|
|
),
|
|
new BookPageInfo(
|
|
"They pray the",
|
|
"humans will help",
|
|
"them, despite the",
|
|
"actions of their",
|
|
"cousins in Britannia. I",
|
|
"fear they are right.",
|
|
"I must go to warn",
|
|
"the MastKai Hohiro,"
|
|
),
|
|
new BookPageInfo(),
|
|
new BookPageInfo(
|
|
"10.11.2001",
|
|
"first one to be here",
|
|
"",
|
|
"Congrats. I didn't really",
|
|
"care to log on earlier,",
|
|
"nor did I come straight",
|
|
"here. 2pm, Magus"
|
|
)
|
|
);
|
|
|
|
[Constructible]
|
|
public FropozJournal() : base(false)
|
|
{
|
|
}
|
|
|
|
public override BookContent DefaultContent => Content;
|
|
|
|
public override void AddNameProperty(IPropertyList list)
|
|
{
|
|
list.Add("Fropoz's Journal");
|
|
}
|
|
|
|
public override void OnSingleClick(Mobile from)
|
|
{
|
|
LabelTo(from, "Fropoz's Journal");
|
|
}
|
|
}
|
|
}
|