## 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.
131 lines
4.1 KiB
C#
131 lines
4.1 KiB
C#
using ModernUO.Serialization;
|
|
|
|
namespace Server.Items
|
|
{
|
|
[SerializationGenerator(0)]
|
|
public partial class TranslatedGargoyleJournal : BlueBook
|
|
{
|
|
public static readonly BookContent Content = new(
|
|
"Translated Journal",
|
|
"Velis",
|
|
new BookPageInfo(
|
|
"This text has been",
|
|
"translated from a",
|
|
"gargoyle's journal",
|
|
"following his capture",
|
|
"and subsequent",
|
|
"reeducation.",
|
|
"",
|
|
" -Velis"
|
|
),
|
|
new BookPageInfo(
|
|
"I write this in the",
|
|
"hopes that someday a",
|
|
"soul of pure heart and",
|
|
"mind will read it. We",
|
|
"are not the evil beings",
|
|
"that our cousin",
|
|
"gargoyles have made",
|
|
"us out to be. We"
|
|
),
|
|
new BookPageInfo(
|
|
"consider them",
|
|
"uncivilized and they",
|
|
"have no concept of the",
|
|
"Principles. To you",
|
|
"who reads this, I beg",
|
|
"for your help in",
|
|
"saving my brethern",
|
|
"and preserving my"
|
|
),
|
|
new BookPageInfo(
|
|
"race. We stand at the",
|
|
"edge of destruction as",
|
|
"does the rest of the",
|
|
"world. Once it was",
|
|
"written law that we",
|
|
"would not allow the",
|
|
"knowledge of our",
|
|
"civilization to spread"
|
|
),
|
|
new BookPageInfo(
|
|
"into the world, no we",
|
|
"are left with little",
|
|
"choice...contact the",
|
|
"outside world in the hopes",
|
|
"of finding help to save",
|
|
"it or becoming the",
|
|
"unwilling bringers of",
|
|
"its damnation."
|
|
),
|
|
new BookPageInfo(
|
|
" I fear my capture is",
|
|
"certain, the",
|
|
"controllers grow ever",
|
|
"closer to my hiding",
|
|
"place and I know if",
|
|
"they discover me, my",
|
|
"fate will be as that of",
|
|
"my brothers."
|
|
),
|
|
new BookPageInfo(
|
|
"Although we resisted",
|
|
"with all our strength",
|
|
"it is now clear that we",
|
|
"must have assistance",
|
|
"or our people will be",
|
|
"gone. And if our",
|
|
"oppressor achieves",
|
|
"his goals our race will"
|
|
),
|
|
new BookPageInfo(
|
|
"surely be joined buy",
|
|
"others.",
|
|
" Those of us who",
|
|
"have not yet been",
|
|
"taken hope to open a",
|
|
"path from the outside",
|
|
"world into the city.",
|
|
"We believe we have"
|
|
),
|
|
new BookPageInfo(
|
|
"found weak areas in",
|
|
"the mountains that we",
|
|
"can successfully",
|
|
"knock through with",
|
|
"our limited supplies.",
|
|
"We will have to work",
|
|
"quickly and the risk",
|
|
"of being discovered is"
|
|
),
|
|
new BookPageInfo(
|
|
"great, but no choice",
|
|
"remains..."
|
|
),
|
|
new BookPageInfo(),
|
|
new BookPageInfo(),
|
|
new BookPageInfo(
|
|
"Kai Hohiro, 12pm.",
|
|
"10.11.2001",
|
|
"first one to be here"
|
|
)
|
|
);
|
|
|
|
[Constructible]
|
|
public TranslatedGargoyleJournal() : base(false)
|
|
{
|
|
}
|
|
|
|
public override BookContent DefaultContent => Content;
|
|
|
|
public override void AddNameProperty(IPropertyList list)
|
|
{
|
|
list.Add("Translated Gargoyle Journal");
|
|
}
|
|
|
|
public override void OnSingleClick(Mobile from)
|
|
{
|
|
LabelTo(from, "Translated Gargoyle Journal");
|
|
}
|
|
}
|
|
}
|