-
Notifications
You must be signed in to change notification settings - Fork 9
/
story.twee
32 lines (24 loc) · 2.36 KB
/
story.twee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
::StoryTitle
twine-achievements
::StoryAbout
This is Twee 3 code. Learn more here: [[https://twinery.org/cookbook/terms/terms_twee.html]].
Icon used ("icon-achievement" passage): [[https://game-icons.net/1x1/skoll/achievement.html]]. You ''must'' properly credit the original, or use your own image.
Features:
* displays notification in lower-right corner when achievement is awarded
* adds a button to sidebar to view player's achievements progress
* remembers achievements between playthroughs and page reloads
* achievements include title, description and (optionally) date when it was awarded
* achievements can be "hidden" to avoid spoilers and hints
* achievements can have "weight", so, for example, "golden" trophy contributes 10% of overall progress, "silver" just 5% and so on.
Conditions for achievements are tested when player transits to a passage, but you can call it manually any time:
{{{"""<<script>>window.achievementRenderer.manager.test()<</script>>"""}}}
Prerequisites:
* You should include {{{menuButton.js}}}: [[https://github.com/hogart/sugar-cube-utils#menubuttonjs]]
* You should include pluralizer of some sort (or write your own): [[https://github.com/hogart/sugar-cube-utils#plurals-enjs-and-plurals-rujs]]
::icon-achievement
<!-- https://game-icons.net/1x1/delapouite/ribbon-medal.html -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="achievement-icon">
<path d="M305.975 298.814l22.704 2.383V486l-62.712-66.965V312.499l18.214 8.895zm-99.95 0l-22.716 2.383V486l62.711-66.965V312.499l-18.213 8.895zm171.98-115.78l7.347 25.574-22.055 14.87-1.847 26.571-25.81 6.425-10.803 24.314-26.46-2.795-18.475 19.087L256 285.403l-23.902 11.677-18.475-19.15-26.46 2.795-10.803-24.313-25.81-6.363-1.847-26.534-22.118-14.92 7.348-25.573-15.594-21.544 15.644-21.52-7.398-25.523 22.068-14.87L150.5 73.03l25.86-6.362 10.803-24.313 26.46 2.794L232.098 26 256 37.677 279.902 26l18.475 19.149 26.46-2.794 10.803 24.313 25.81 6.425 1.847 26.534 22.055 14.87-7.347 25.574 15.656 21.407zm-49.214-21.556a72.242 72.242 0 1 0-72.242 72.242 72.355 72.355 0 0 0 72.242-72.242zm-72.242-52.283a52.282 52.282 0 1 0 52.282 52.283 52.395 52.395 0 0 0-52.282-52.245z"/>
</svg>
::StoryInit
<<script>>window.achievementRenderer = new scUtils.AchievementRenderer(window.game.achievements);<</script>>