public override string BookAuthor() { // %ba BookFile bookFile = new BookFile(); bookFile.OpenBook(DaggerfallUnity.Instance.Arena2Path, BookFile.messageToBookFilename(parent.message)); // Should the bookfile get closed? return(bookFile.Author); }
// Notes: // Book files have text pre-paginated based on classic 320x200. // This has no meaning with custom fonts and languages as book might require more or fewer pages. // Reformat process will structure book instead as a list of word-wrapped labels and breaks. // Book reader UI can then break these back into pages based on fixed text height. // For some reason the first line of first paragraph of many books is centre justified. // After reformatting this results in entire first paragraph being centre justified. public bool ReformatBook(int id) { if (DaggerfallUnity.Settings.CustomBooksImport) { return(ReformatBook(DaggerfallUnity.Instance.ItemHelper.GetBookFileName(id))); } return(ReformatBook(BookFile.messageToBookFilename(id))); }
public virtual bool OpenBook(int message) { if (DaggerfallUnity.Settings.CustomBooksImport) { return(OpenBook(DaggerfallUnity.Instance.ItemHelper.GetBookFileNameByMessage(message))); } return(OpenBook(BookFile.messageToBookFilename(message))); }
public override string BookAuthor() { // %ba BookFile bookFile = new BookFile(); string name = BookFile.messageToBookFilename(parent.message); if (!BookReplacement.TryImportBook(name, bookFile)) { bookFile.OpenBook(DaggerfallUnity.Instance.Arena2Path, name); } return(bookFile.Author); }
/// <summary> /// Creates a new random book /// </summary> /// <returns>DaggerfallUnityItem.</returns> public static DaggerfallUnityItem CreateRandomBook() { Array enumArray = DaggerfallUnity.Instance.ItemHelper.GetEnumArray(ItemGroups.Books); DaggerfallUnityItem book = new DaggerfallUnityItem(ItemGroups.Books, Array.IndexOf(enumArray, Books.Book0)); book.message = DaggerfallUnity.Instance.ItemHelper.getRandomBookID(); book.CurrentVariant = UnityEngine.Random.Range(0, book.TotalVariants); // Update item value for this book. BookFile bookFile = new BookFile(); string name = BookFile.messageToBookFilename(book.message); if (!BookReplacement.TryImportBook(name, bookFile)) { bookFile.OpenBook(DaggerfallUnity.Instance.Arena2Path, name); } book.value = bookFile.Price; return(book); }
/// <summary> /// Creates a new book. /// </summary> /// <param name="id">The numeric id of book resource.</param> /// <returns>An instance of the book item or null.</returns> public static DaggerfallUnityItem CreateBook(int id) { var bookFile = new BookFile(); string name = DaggerfallUnity.Settings.CustomBooksImport ? GameManager.Instance.ItemHelper.GetBookFileName(id) : BookFile.messageToBookFilename(id); if (!BookReplacement.TryImportBook(name, bookFile) && !bookFile.OpenBook(DaggerfallUnity.Instance.Arena2Path, name)) { return(null); } return(new DaggerfallUnityItem(ItemGroups.Books, 0) { message = id, value = bookFile.Price }); }
public override string BookAuthor() { // %ba BookFile bookFile = new BookFile(); string name = DaggerfallUnity.Settings.CustomBooksImport ? GameManager.Instance.ItemHelper.GetBookFileName(parent.message) : BookFile.messageToBookFilename(parent.message); if (name != null) { if (!BookReplacement.TryImportBook(name, bookFile)) { bookFile.OpenBook(DaggerfallUnity.Instance.Arena2Path, name); } if (bookFile.Author != null) { return(bookFile.Author); } } return(TextManager.Instance.GetText("DaggerfallUI", "unknownAuthor")); }
public virtual bool OpenBook(int message) { return(OpenBook(BookFile.messageToBookFilename(message))); }