fix(core): Converts book packets (#413)
- [X] Splits out BaseBook - [X] Converts book packets - [X] Makes FixHtml faster
This commit is contained in:
parent
3d7c4583a8
commit
a146955f6c
8 changed files with 427 additions and 228 deletions
62
Projects/UOContent/Items/Books/BookContent.cs
Normal file
62
Projects/UOContent/Items/Books/BookContent.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class BookContent
|
||||
{
|
||||
public BookContent(string title, string author, params BookPageInfo[] pages)
|
||||
{
|
||||
Title = title;
|
||||
Author = author;
|
||||
Pages = pages;
|
||||
}
|
||||
|
||||
public string Title { get; }
|
||||
|
||||
public string Author { get; }
|
||||
|
||||
public BookPageInfo[] Pages { get; }
|
||||
|
||||
public BookPageInfo[] Copy()
|
||||
{
|
||||
var copy = new BookPageInfo[Pages.Length];
|
||||
|
||||
for (var i = 0; i < copy.Length; ++i)
|
||||
{
|
||||
copy[i] = new BookPageInfo(Pages[i].Lines);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
public bool IsMatch(BookPageInfo[] cmp)
|
||||
{
|
||||
if (cmp.Length != Pages.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < cmp.Length; ++i)
|
||||
{
|
||||
var a = Pages[i].Lines;
|
||||
var b = cmp[i].Lines;
|
||||
|
||||
if (a.Length != b.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a != b)
|
||||
{
|
||||
for (var j = 0; j < a.Length; ++j)
|
||||
{
|
||||
if (a[j] != b[j])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue