Skip to content

Commit

Permalink
- Finished up to section 207
Browse files Browse the repository at this point in the history
- Clean up related to missing illustrations/cover/map
- Added separators to New Game book dropdown
  • Loading branch information
lonevvolf committed Sep 21, 2024
1 parent 7bf35f4 commit 8b9d672
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 30 deletions.
2 changes: 2 additions & 0 deletions src/ts/controller/mapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const mapController = {
mapView.setMapBook11();
} else {
mapView.setSectionContent( mapSection );
// Hide map controls if there is no map (Book 29)
$("#map-section img").length ? $("#map-controls").show() : $("#map-controls").hide();
}
mapView.bindEvents();
}, null);
Expand Down
6 changes: 5 additions & 1 deletion src/ts/model/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ export class Book {
/**
* Get the book cover image URL
*/
public getCoverURL(): string {
public getCoverURL(): string|null {
// Book 29 has no illustrations
if (this.bookNumber === 29) {
return null;
}
return Book.getBaseUrl() + this.bookNumber.toFixed() + "/cover.jpg";
}

Expand Down
10 changes: 1 addition & 9 deletions src/ts/views/mapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ export const mapView = {
* @param section The map Section
*/
setSectionContent( section: Section ) {

/*const titleText = section.getTitleText();
document.title = titleText;
$('#map-title').text( titleText );
// Render the map, with the illustrations text. On book 5, it's the
// map description
$('#map-section').html( section.getHtml(true) );*/
mapView.setContent( section.getTitleText() , section.getHtml(true) );
},

Expand All @@ -35,8 +28,7 @@ export const mapView = {
setContent( titleText: string , mapSectionHtml: string ) {
document.title = titleText;
$("#map-title").text( titleText );
// Render the map, with the illustrations text. On book 5, there is a textual
// map description
// Render the map, with the illustrations text. On books 5 and 29, there is a textual map description
$("#map-section").html( mapSectionHtml );
},

Expand Down
21 changes: 17 additions & 4 deletions src/ts/views/newGameView.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { projectAon, translations, newGameController, state, pwa } from "..";
import { projectAon, translations, newGameController, state, pwa, Book, BookSeriesId } from "..";
import { BookData } from "../scripts/bookData";

/**
* The new game view API
Expand All @@ -9,7 +10,13 @@ export const newGameView = {

// Add supported books
let html = "";
let series: BookSeriesId|null = null;
for ( let i = 1; i <= projectAon.supportedBooks.length; i++) {
let seriesId = new Book(i).getBookSeries().id;
if (seriesId !== series) {
html += `<optgroup label="${translations.text(BookSeriesId[seriesId])}"></optgroup>`;
series = seriesId;
}
const title = projectAon.getBookTitle( i )
html += '<option value="' + i.toFixed() + '" >' + i.toFixed() + ". " + title + "</option>";
}
Expand Down Expand Up @@ -58,8 +65,14 @@ export const newGameView = {
* Change the current book cover
* @param {string} url The cover URL
*/
setCoverImage(url: string) {
$("#newgame-cover").attr("src", "");
$("#newgame-cover").attr("src", url);
setCoverImage(url: string|null) {
if (url === null) {
$("#newgame-cover").hide();
} else {
$("#newgame-cover").show();
$("#newgame-cover").attr("src", "");
$("#newgame-cover").attr("src", url);
}

}
};
4 changes: 4 additions & 0 deletions src/ts/views/viewsUtils/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export class Translations {
//////////////////////////////////////

"youMustAgree" : "You must agree the license to continue",
"Kai": "Kai",
"Magnakai": "Magnakai",
"GrandMaster": "Grand Master",
"NewOrder": "New Order",

//////////////////////////////////////
// Settings
Expand Down
6 changes: 3 additions & 3 deletions www/data/mechanics-27.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2103,9 +2103,9 @@
<section id="sect311">
<object objectId="dagger" />
<object objectId="axe" />
<object objectId="laumspur" index="0" />
<object objectId="laumspur" index="1" />
<object objectId="laumspur" index="2" />
<object objectId="laumspurpotion4" index="0" />
<object objectId="laumspurpotion4" index="1" />
<object objectId="laumspurpotion4" index="2" />
<object objectId="meal" index="0" />
<object objectId="meal" index="1" />
<object objectId="meal" index="2" />
Expand Down
10 changes: 5 additions & 5 deletions www/data/mechanics-28.xml
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@
</section>

<section id="sect87">
<object objectId="laumspur" index="0" />
<object objectId="laumspur" index="1" />
<object objectId="laumspurpotion4" index="0" />
<object objectId="laumspurpotion4" index="1" />
<object objectId="potiongallowbrush" />
<object objectId="ashexaconcentrate" />
</section>
Expand Down Expand Up @@ -1075,13 +1075,13 @@
</section>

<section id="sect196">
<test not="true" hasObject="laumspur">
<test not="true" hasObject="laumspurpotion4">
<choiceState section="sect297" set="disabled" />
</test>
<test not="true" hasObject="klorvapotion">
<choiceState section="sect120" set="disabled" />
</test>
<test hasObject="laumspur|klorvapotion">
<test hasObject="laumspurpotion4|klorvapotion">
<choiceState section="sect90" set="disabled" />
</test>
</section>
Expand Down Expand Up @@ -1635,7 +1635,7 @@
</section>

<section id="sect297">
<drop objectId="laumspur" />
<drop objectId="laumspurpotion4" />
</section>

<section id="sect300">
Expand Down
119 changes: 118 additions & 1 deletion www/data/mechanics-29.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
<section id="sect38">
<pick class="meal" count="-1" />

<object objectId="laumspur" price="5" />
<object objectId="laumspurpotion4" price="5" />
<object objectId="tazheng" price="6" />
<object objectId="sabitotincture" price="8" />
<object objectId="karmo" price="12" />
Expand Down Expand Up @@ -802,6 +802,8 @@
<sell objectId="ashexapotion" price="20" currency="ren" />
<sell objectId="klorvapotion" price="20" currency="ren" />
<sell objectId="sabitotincture" price="20" currency="ren" />
<sell objectId="laumwortpotion" price="20" currency="ren" />
<sell objectId="tazheng" price="20" currency="ren" />
<sell objectId="karmo" price="200" currency="ren" />
</section>

Expand Down Expand Up @@ -1224,6 +1226,121 @@
<unregisterGlobalRule id="ansengskirusami-loss" />
</section>

<section id="sect189">
<choiceState section="all" set="disabled" />
<randomTable>
<case to="5">
<choiceState section="sect121" set="enabled" />
</case>
<case from="6">
<choiceState section="sect198" set="enabled" />
</case>
</randomTable>
<test hasWeaponskillWith="bow">
<randomTableIncrement increment="+5" />
</test>
</section>

<section id="sect191">
<test not="true" expression="[MONEY] >= 2">
<choiceState section="sect156" set="disabled" />
</test>
<choiceSelected section="sect156">
<pick class="money" count="-2" />
</choiceSelected>
</section>

<section id="sect192">
<pick objectId="eyeofagarash" />
<onInventoryEvent>
<choiceState section="all" set="disabled" />
<test not="true" objectOnSection="eyeofagarash">
<choiceState section="all" set="enabled" />
</test>
<test objectOnSection="eyeofagarash">
<choiceState section="all" set="disabled" />
</test>
</onInventoryEvent>
</section>

<section id="sect194">
<choiceState section="all" set="disabled" />
<combat />
<afterCombats>
<choiceState section="sect283" set="enabled" />
</afterCombats>
<afterCombatTurn turn="1">
<disableCombats />
<test expression="[COMBATSENDURANCELOST] &lt;= [COMBATSENEMYLOST]">
<choiceState section="sect283" set="enabled" />
</test>
<test expression="[COMBATSENDURANCELOST] > [COMBATSENEMYLOST]">
<choiceState section="sect315" set="enabled" />
</test>
</afterCombatTurn>
</section>

<section id="sect195">
<choiceState section="all" set="disabled" />
<combat />
<afterCombats>
<choiceState section="all" set="enabled" />
</afterCombats>
</section>

<section id="sect196">
<choiceState section="sect122" set="disabled" />
<test hasDiscipline="element">
<test expression="[KAILEVEL] >= 9">
<choiceState section="sect122" set="enabled" />
<choiceState section="sect11" set="disabled" />
</test>
</test>
</section>

<section id="sect199">
<object objectId="laumwortpotion" index="0" />
<object objectId="laumwortpotion" index="1" />
<object objectId="laumspurpotion4" index="0" />
<object objectId="laumspurpotion4" index="1" />
<object objectId="laumspurpotion4" index="2" />
<object objectId="oxydinepotion" />
<object objectId="potionofstrength" />
<object objectId="malavanpotion" />
</section>

<section id="sect200">
<object objectId="laumspurpotion4" price="5" />
<object objectId="tazheng" price="6" />
<object objectId="sabitotincture" price="8" />
<object objectId="karmo" price="12" />
</section>

<section id="sect206">
<endurance count="-3" />
</section>

<section id="sect207">
<choiceState section="all" set="disabled" />
<combat combatSkillModifier="+6" />
<afterCombats>
<choiceState section="all" set="enabled" />
<endurance count="-3" />
</afterCombats>
</section>

<section id="sect254">
<test not="true" expression="[MONEY] >= 3">
<choiceState section="sect200" set="disabled" />
</test>
<test expression="[MONEY] >= 3">
<choiceState section="sect339" set="disabled" />
</test>
<choiceSelected section="sect200">
<pick class="money" count="-3" />
</choiceSelected>
</section>

<section id="sect291">
<numberPicker text="Choose the number of Gold Crowns you want to bet" min="1"
money="true" actionButton="Bet" />
Expand Down
15 changes: 9 additions & 6 deletions www/data/objects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1115,8 +1115,10 @@
<description>Endows it wearer with a limited protection from evil.</description>
</special>

<!-- TODO: Implement Eye of Agarash -->
<special id="eyeofagarash" droppable="false">
<name>Eye of Agarash</name>
<description>The Eye radiates an evil energy that will periodically drain you of ENDURANCE points. You will be told whenever this energy drain occurs. If you possess the Grand Master Discipline of Kai-screen, the loss of ENDURANCE will be limited to only 1 point each time an energy drain occurs.</description>
</special>

<special id="wardstone">
Expand Down Expand Up @@ -2312,12 +2314,6 @@
<effect class="backpackSlots" increment="+5" />
</object>

<object id="laumspur">
<name>Laumspur</name>
<description>Restores 4 ENDURANCE points when swallowed after combat</description>
<usage class="endurance" increment="+4" />
</object>

<!-- BOOK 28 -->
<object id="ashexaconcentrate" usageCount="1">
<name>Ashexa Concentrate</name>
Expand Down Expand Up @@ -2417,6 +2413,13 @@
<effect class="endurance" increment="+2" />
</object>

<object id="laumwortpotion">
<name>Potion of Laumwort</name>
<description>Restores 2 ENDURANCE when swallowed at any time.</description>
<image book="1|9" name="potion.png" />
<usage class="endurance" increment="+2" />
</object>

<!-- OTHERS -->

<!-- This not really an object, but needed for mechanics -->
Expand Down
2 changes: 1 addition & 1 deletion www/views/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h1 id="map-title">Map</h1>

<p>
<p id="map-controls">
<span data-translation="map-clickinfo">Click on the map to fit the screen width / restore to its original size.</span><br/>
<span data-translation="map-changezoom">Change zoom:</span>
<a href="#" class="btn btn-primary" id="map-increasezoom">
Expand Down

0 comments on commit 8b9d672

Please sign in to comment.