Skip to content

Commit

Permalink
Merge pull request cracrayol#68 from lonevvolf/master
Browse files Browse the repository at this point in the history
Fix for Kai Levels over 10 (Grand Master/New Order)
  • Loading branch information
cracrayol authored Oct 7, 2024
2 parents 4630111 + 53e8de1 commit 49596cc
Show file tree
Hide file tree
Showing 4 changed files with 39,687 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ www/js
src/js

# Distribution directory
dist
/dist

# NPM / node.js stuff
npm-debug.log
Expand Down
4 changes: 1 addition & 3 deletions src/ts/model/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,7 @@ export class Book {
// Normalize
if ( nDisciplines < 1 ) {
nDisciplines = 1;
} else if ( nDisciplines > 10 ) {
nDisciplines = 10;
}
}

// Get the title
const countOffset = $(this.bookXml).find('section[id="levels"] > data > ol').attr("start");
Expand Down
14 changes: 11 additions & 3 deletions src/ts/views/printActionChartView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const printActionChartView = {

const bookSeries = state.book.getBookSeries();

const url = `/images/action-charts/${BookSeriesId[bookSeries.id]}.pdf`;
const url = `/images/action-charts/${BookSeriesId[bookSeries.id].toLowerCase()}.pdf`;
const existingPdfBytes = await fetch(url).then(res => res.arrayBuffer());
const pdfDoc = await pdfLib.PDFDocument.load(existingPdfBytes);
const helveticaFont = await pdfDoc.embedFont(pdfLib.StandardFonts.Helvetica);
Expand Down Expand Up @@ -390,7 +390,7 @@ export const printActionChartView = {
printActionChartView.printField(
pages,
mappingsField.page - 1,
kaiWeapon.name,
kaiWeapon.name + (kaiWeaponAC.damage !== 0 ? " (damaged)" : ""),
mappingsField.x,
mappingsField.y,
15,
Expand Down Expand Up @@ -451,11 +451,19 @@ export const printActionChartView = {
// Print Quiver
if (!onlyPermanent) {
mappingsField = bookMappings.quiver;

let quiversCount = 0;
for(let i = 0; i < actionChart.specialItems.length; i++) {
if (actionChart.specialItems[i].getItem().id === "quiver29" || actionChart.specialItems[i].getItem().id === "quiver") {
quiversCount++;
}
}

if (mappingsField) {
printActionChartView.printField(
pages,
mappingsField.page - 1,
(actionChart.getMaxArrowCount() / 6).toFixed(),
quiversCount.toFixed(),
mappingsField.x,
mappingsField.y,
15,
Expand Down
Loading

0 comments on commit 49596cc

Please sign in to comment.