JSON (Right-click, save-as -- restore to new, empty tease):
https://milovana.com/webteases/geteossc ... ae797ac48c
Link to example game (Meant to show how to use game engine, not to play):
https://milovana.com/webteases/showteas ... ae797ac48c
The above game is not meant to be a playable game. It's simply an example trying to show how to use as many core features as possible when creating your own, and a base to update from when/if bug-fixes and/or new features are rolled out.
Ask for help, report bugs and make feature requests here.
Notes:
- You will need some familiarity with JavaScript in order to modify game settings.
- The code is a bit of a tangled mess, mainly due to unfortunate hacks and design decisions early on that I'm too lazy to refactor.
- If you make useful changes/bug fixes to any core game pages, please post them here so they can be merged in upstream with the core game.
- While debugging your tease, open your browser's console and look for errors. FapJack's engine does its best to report things like missing images loader pages, etc. (It's also very verbose when DEBUG mode is enabled, so you can see what it's doing behind the scenes.)
Code: Select all
/********************************
* FapJack v1.16.0
* by: fapnip@milovana
* https://milovana.com/forum/viewtopic.php?f=2&t=23858
********************************
* Sorry about the spaghetti. Tough to keep code clean without imports and a proper IDE.
*
* To anyone that ripped this game's code:
* Feel free to use any of this code in your own tease, but be nice and don't claim it as your own.
* It may well be a mess, but it's my mess.
*
* Always base your FapJack games off fapnip's development example game:
* https://milovana.com/webteases/showtease.php?id=47408&key=ae797ac48c
*
*/
/*--magpie-warn
Need help with FapJack?
Ask here!
https://milovana.com/forum/viewtopic.php?f=2&t=23858
*/
/*****************
* READ ME
*****************
*
* Unless you're heavily modifying this game (my deepest apologies if you attempt that),
* >>> you shouldn't change anything in this Init Script. <<<
*
* If you do modify this init script, you'll have a more difficult time updating it with new versions.
*
* Anything you'd normally add to this init script can be placed in an eval in core-config.
*
* Avoid modifying game engine pages (start, play, cum-round-*, penalty-*, settings*, etc.)
* If there's a feature you need, and you can't implement it using the existing hooks
* (like with round intermission pages) request the feature in Milovana's forms.
* You'll have a hell of a time installing future updates if you don't heed this.
*
* !!! Read "CORE GAME PAGES", "REQUIRED GAME PAGES" and "INSTALLING UPDATES", below !!!
*
* Basic usage:
*
* 1. Edit evals in core-config, setting values in game.setConfig({...}) object, and
* reviewing/editing/removing setting configuration option examples.
* (See comments in evals for details)
* 2. Create pages for your game rounds, based on your game settings. Use existing pages as guide.
* 3. Edit what the dealer(s) can say in core-verbiage
*
* See: core-config page for game settings and configuration
* See: core-verbiage and optional [mode]-verbiage-[level/cum-mode] pages for verbiage/language changes
*
* For round images, see: (first page found is used)
*
* [mode]-image-[level/cum-mode]-[hand] (discrete image loader)
* [mode]-image-[level/cum-mode]-[hand]plus (range image loader ***)
* [mode]-image-[level/cum-mode] (level image loader)
* [mode]-image (mode image loader)
* round-image (fall-back image loader)
*
* *** A range image loader page example would be:
*
* melody-image-1-3plus
*
* This would be used to load images for any level 1 hand at or above index 3 that does not
* have a discrete image loader page or a more applicable range loader that would
* take precedence.
*
* For (optional) penalty images, see: (first page found is used)
*
* [mode]-[penaltyId (edge/stroke/etc.)]-[level/cum-mode]-[hand]
* [mode]-[penaltyId (edge/stroke/etc.)]-[level/cum-mode]-[hand]plus
* [mode]-[penaltyId (edge/stroke/etc.)]-[level/cum-mode]
* [mode]-[penaltyId (edge/stroke/etc.)]
* penalty-[penaltyId (edge/stroke/etc.)]-image
* penalty-image
*
* For game over and win images, see: (first page found is used)
*
* - Game Over Image Selection
* [mode]-game-over-[level/cum-mode]-[hand]
* [mode]-game-over-[level/cum-mode]-[hand]plus
* [mode]-game-over-[level/cum-mode]
* [mode]-game-over
* game-over-image
*
* - Cum Tease Images (Shows when play can cum)
* [mode]-cumtease-[level/cum-mode]-[hand]
* [mode]-cumtease-[level/cum-mode]-[hand]plus
* [mode]-cumtease-[level/cum-mode]
* [mode]-cumtease
* win-cumtease-image
*
* - Win Game Images (Displayed on win page)
* [mode]-win-[level/cum-mode]-[hand]
* [mode]-win-[level/cum-mode]-[hand]plus
* [mode]-win-[level/cum-mode]
* [mode]-win
* win-image
*
* Cum round entry image:
*
* - For each cum round mode, you'll need a page to welcome player to the cum round:
* [mode]-cum-round-[cum-mode]
*
* Multiple game modes selection image:
*
* - If you have multiple game modes defined, you'll need to change the image in:
* game-mode-select-image
*
* Multiple cum round mode selection image:
*
* - If you have multiple cum round modes defined for a given game mode, you'll need:
* [mode]-cum-round-select
*
* Round intermission pages:
*
* To interrupt a round, and display another page before the given hand starts,
* create a page with the name:
* [mode]-inter-[level/cum-mode]-[hand]
*
* To interrupt a round, and display another page after the given hand ends,
* create a page with the name:
* [mode]-interp-[level/cum-mode]-[hand]
*
* The page will be called before or after the given hand.
* Once you're done with your intermission, in an eval, execute:
*
* returnToCaller();
*
*
* Game loss mode pages (instruct player when they lose):
*
* There are 4 core game loss mode page examples that when present and enabled
* will enable that game loss mode as a selectable option for the player:
* (You will need to modify the content of the example pages to match for tease.)
*
* game-lost-ruin - Default. Will be forced to ruin if they lose.
* game-lost-deny - Will be denied if they don't win the final round. Will be forced to ruin if they cum early.
* game-lost-cei - Will be told to cum if they haven't yet, then eat it. (Only if a cei kink is enabled.)
* game-lost-rand - Will randomize the above on loss. (Don't modify this page.)
*
* To disable or delete the above pages to disable the setting option(s) for the player.
*
* To override the core loss mode page per game mode, level/cum-mode and hand,
* create page(s) with following patterns, with the first found being used:
*
* [mode]-game-lost-[loss-mode]-[level/cum-mode]-[hand]
* [mode]-game-lost-[loss-mode]-[level/cum-mode]-[hand]plus
* [mode]-game-lost-[loss-mode]-[level/cum-mode]
* [mode]-game-lost-[loss-mode]
* game-lost-[loss-mode]
*
*
* Verbiage Pages (Changing what the dealer says):
*
* - To modify what the dealer says globally, modify the evals in:
*
* core-verbiage
*
* - To modify what the dealers says per level, create a page:
*
* [mode]-verbiage-[level/cum-mode]
*
* Add an eval action to that page that overrides one or more verbiage keys, like:
*
* game.setVerbiage({
* edge: [ // Tell player to edge
* "Get right to the edge, but don't cum!",
* "Go on, " + "edge for me!".bold().color('hotpink'),
* "Get as close as you can!",
* "Keep stroking until you edge!",
* "Get right to the edge for me. Don't go over!",
* "Stroke until you almost explode, but don't!",
* "Do what you need to do to reach that edge!",
* ],
* });
*
* (See: game.setVerbiage(...) evals in core-verbiage for more examples.)
*
* Styling Text:
*
* You can add style (size, color, bold, italic, etc.) to verbiage strings using:
*
* "My String".color([html color code]) // See: https://www.w3schools.com/colors/colors_names.asp
* and https://www.w3schools.com/colors/colors_hexadecimal.asp
* and https://htmlcolorcodes.com/color-picker/
* "My String".size([decimal size, 1 = 100%, 1.5 = 150%])
* "My String".spacing([decimal size, like 0.2, or 'normal'])
* "My String".italic()
* "My String".bold()
* "My String".underline()
* "My String".br() // Add line break
* "My String".p() + "My Next Paragraph" // Start new paragraph
*
* You can combine styles:
*
* "My String".bold().italic().size(1.2).color('hotpink')
*
* Changing/Adding metronome sounds
*
* Metronome sounds are in --audio-x pages. Follow the existing files as a template.
*
* Getting info on game state:
*
* game.getLevel() will return the current level
* game.getRoundIndex() will return the current hand of the current level
* game.isCumRound() will return true if the player has reached the "cum round"
* (There are a ton more. Ask for assistance in Milovana's forums.)
*
* Creating custom penalties:
*
* See examples in core-config-example
*
* Overriding penalty probability, etc.:
*
* See examples in core-config-example
*
*/
/***************************************************
* CORE GAME PAGES
* *************************************************
* Do not modify any of these pages! ***
* If you need to add something, ask
* in a feature request.
*
* *** NOTE: If an action in a given page is prefixed
* by an eval containing: --auto-magpie-merge: ...
* then you can modify ONLY the action that follows
* the --auto-magpie-merge: eval.
* (auto-magpie-merge eval prefixes must be in
* both source and target.
* DO NOT ADD/CHANGE --auto-magpie-merge: EVALs!!!
* DO NOT DELETE THE ACTION following the EVAL!
* DO NOT ADD AN ACTION!
* ONLY MODIFY THE EXISTING ACTION!)
*
* *************************************************
*/
/*--auto-magpie-code:FapJack_base */
/*--auto-magpie-core:
start
--audio-*
alternate-game-page-example
core-config-example
core-verbiage-example
cum-round
cum-round-pause
cum-round-select
game-difficulty-select
game-lost
game-lost-check
game-lost-rand
game-mode-select
notification-round
penalty*
play
play-shuffle-notice
play-start
rest
rest-end
settings*
win
win-check
win-check2
win-tease
welcome
*/
/*****************************************
* REQUIRED GAME PAGES
* ***************************************
* These pages are required for game to
* function, but you'll likely need to
* modify them to fit your needs.
* ***************************************
*/
/*--auto-magpie-required:
core-config
core-verbiage
game-difficulty-select-image
game-mode-select-image
instructions
welcome-image
common-ending
game-lost-cei
game-lost-ruin
game-lost-deny
*/
/*********************
* INSTALLING UPDATES
*********************
*
* To merge FapJack updates into an existing FapJack:
*
* 1. Backup your existing tease. (Very important!)
* 2. Open FapJack Base in Eos Magpie:
* https://codepen.io/fapnip/full/GRjwPXP?id=47408&key=ae797ac48c
* 3. As the "target" tease, enter your tease's URL
* 4. Review pre-selected items. (If you've modified this init script,
* auto-update may not work.)
* 5. Click the big blue download button.
* 6. Import the downloaded JSON over your tease.
* 7. If there were changes to core-config-example or core-verbiage-example, check to see if
* you need to implement any of those changes in your core-config or core-verbiage pages.
* Review CHANGE LOG to see if there's anything else you may need to do.
* (Don't modify *-example pages. They're there for reference only.)
* 8. Test your tease. If broken, restore from backup and try again.
*
*/
/*****************
* CHANGE LOG
*****************
*
* 1.16.0
* - Move stroking options to settings-stroking page
* - Add Game Difficulty option to control stroke speed, etc.
* - Add aliasOf setting property to allow linking to same setting from multple places
* - Alias new "Game Difficulty" setting from stroking options as "Intensity"
*
* 1.15.6
* - Update to SimpleBeats 0.8.3 to try to avoid beat playing on init
*
* 1.15.5
* - Update "-audio-1" beat sound to one that works on more devices
* (Update your -audio-1 page if you used the old "beat-pop-*" sounds there.)
*
* 1.15.4
* - Update timer polyfill
*
* 1.15.3
* - Destroy Sound instances before loading new audio page.
*
* 1.15.2
* - Update setTimeout and SimpleBeats
*
* 1.15.1
* - Tweak some beat settings
*
* 1.15.0
* - Update mergeObect string field merger to allow more flexible method calling
* - To help with metronome issues on older devices:
* - Update setTimeout polyfill to v1.1
* - Use new, simplified, SimpleBeats instead of Beats for dynamic metronome
* - Remove TitleAnimator that Beats used, but FapJack didn't need
* - (Changes are in Init Script and start page)
*
* 1.14.9
* - Fix volume adjustment (Init Script and settings-beat-volume)
*
* 1.14.8
* - Add onGameReset hook
* - Add onSaveState hook
* - Add onGameRestore hook
* - Add public setGameState setter
* - Add public getGameState getter
*
* 1.14.7
* - Don't use remapped level for penalty option generators
*
* 1.14.6
* - Fix potential infinite loop in resetToCore
*
* 1.12.17 - 1.14.5
* - Too many changes to list, too lazy to add
*
* 1.12.17
* - Set defaults for some settings in Init Script
*
* 1.12.15
* - Track moan play state
*
* 1.12.14
* - Add playMoans feature, and ability to call it from verbiage
*
* 1.12.13
* - Fix incorrect inRoundNoFapTime
*
* 1.12.12
* - Allow parent setting's reset to realod reset audio profile
*
* 1.12.11
* - update audio profile example
*
* 1.12.10
* - Allow Reset to work on audio profiles setting page
*
* 1.12.9
* - Allow defined audio profile pages and profile page array to differ in length.
*
* 1.12.8
* - Add audio profiles
*
* 1.12.7
* - Fix penalty occurrence merging
*
* 1.12.6
* - Fix hang introduced in 1.12.5
*
* 1.12.5
* - Fix some bugs in settings
* - Allow integer options in radio buttons
*
* 1.12.4
* - Add String.prototyle.style([style], [class])
*
* 1.12.3
* - Add String.color([html color]), .size(1.2), .spacing(1.2),
* .bold(), .italic(), .underline(), .br(), .p()
* for text styling in verbiage strings.
*
* 1.12.2
* - Allow reloading randomized round image pages
*
* 1.12.1
* - Fix issue with penalty id resolution
*
* 1.12.0
* - Unified/simplified image loaders
*
* 1.11.5
* - Added winCheckBpm and winCheckRefresh settings
* - Modify win-check to refresh cum tease
* - Added [mode]-cumtease-[cum-mode] image page for cum tease.
*
* 1.11.4
* - Move buttons to verbiage
* - Change select page timers
* - Move sounds to start so they preload when Eos loads tease
* - Add welcome-image
*
* 1.11.3
* - Fix issue with resetting a blocked setting
*
* 1.11.2
* - Update instructions
* - Fix bug in game.getRadioObject
* - Add block method to settings
* - Add example settings blocker (see kinkAnal override in core-config-example)
*
* 1.11.1
* - Add rouletteBpm game setting to allow overriding sound for bpm.
*
* 1.11.0
* - Refactor "mergeObject(randomString(t.verbiageKey), game)" to "game.text('verbiageKey')"
*
* 1.10.14
* - Fix issue with re-locking game
*
* 1.10.13
* - When ulp (unlocked) setting is reset, try to rest to locked game config
* - Fixed bug in random mode select skipper
*
* 1.10.12
* - Generate titles and show buttons in difficulty/game/cumround-select
* using common methods instead of in-line.
*
* 1.10.11
* - Add 'alternateGamePage' options to game modes
*
* 1.10.10
* - Add post-hand intermission pages: [mode]-interp-[level/cum-mode]-[hand]
*
* 1.10.9
* - Properly clear random selector button
*
* 1.10.8
* - Add random selector button to mode select pages
* - Fix a couple bugs
*
* 1.10.7
* - Fix bugs
*
* 1.10.6
* - Add skip/timer settings
*
* 1.10.5
* - Add missing game.getRadioObject method
*
* 1.10.4
* - Add setting radio button selections and examples
*
* 1.10.3
* - Make setSettingOption index position relative to setting's page
*
* 1.10.2
* - Automatically generate settings reset message so it doesn't have to be defined.
* - Add example of how to add a new settings menu page.
*
* 1.10.1
* - Fix a couple bugs introduced in 1.10.0
* - Add simple "penalty-custom-example", and use example.
*
* 1.10.0
* - Dynamically build settings pages
* - Allow easy addition of custom setting options
* - Allow modification of existing setting option lables/icons/placement
* - Add showSetting game option object for hiding/showing setting options
* - Merge existing penalty occurrence definitions instead of replace
*
* 1.9.30
* - Fix bug in penalty occurrence probability overrides
*
* 1.9.29
* - Fix some bugs.
* - Fix penalty limit override examples
*
* 1.9.28
* - Update auto-magpie instructions
* - Add penalty limit override examples in core-config-example
* - Add custom penalty override examples in core-config-example
*
* 1.9.27
* - Add hooks for setting penalty limits (faps, bpms, etc.)
* - Implement game difficulty selection
* (update your game-difficulty-select-image)
* - Add difficultyAutoSelect, difficultySelect1, difficultySelect2 verbiage
* (update your core-verbiage!)
* - Add difficulties game config option.
* (update your core-config!)
*
* 1.9.26
* - Add Eos Magpie auto-update
*
* 1.9.25
* - Change update instructions
*
* 1.9.24
* - Allow rest to skip all penalties instead of just edge
*
* 1.9.23
* - Fix image load time timer offset
*
* 1.9.22
* - Update instructions in Init Script
*
* 1.9.21
* - Fix core verbiage not being consistently re-loaded between levels
*
* 1.9.20
* - Fix the way config file loads are detected
*
* 1.9.19
* - Rename cumToWinTimeMin to winToCumTimeMin, since that's what it's used for
*
* 1.9.18
* - Add cumToWinTimeMin game setting
*
* 1.9.17
* - Fix cum round beat issue
*
* 1.9.16
* - !! You must update your 'play' page !!
* - Properly save intermission state
* - Restart cum round from beginning on game restore
* - Simplify play page, move code to game.checkStatus
* - Fix potential crash in play loop
*
* 1.9.15
* - Add Intermission pages:
* [mode]-inter-[level/cum-mode]-[hand]
*
* 1.9.14
* - Update image page use documentation
*
* 1.9.13
* - Yet more dev mode fixes
* - Update comments
*
* 1.9.12
* - More dev mode fixes
*
* 1.9.11
* - In winToCum rounds, don't count time images take to load against time left
*
* 1.9.10
* - Fix mode arrays not being reset in development mode
*
* 1.9.9
* - Restore accidentally removed 'hasChangedSettings' function
*
* 1.9.8
* - Let user know when we start to attempt the long process of decrypting locked features
*
* 1.9.6
* - Add penalty occurrence overrides
*
* 1.9.5
* - Add done button to instructions so you don't have to click through the
* entire thing if you don't want to.
*
* 1.9.4
* - Automate fall-back for game over and win images in order of preference:
* [mode]-game-over-[level/cum-mode]
* [mode]-game-over
* game-over-image
* [mode]-win-[level/cum-mode]
* [mode]-win
* win-image
*
* 1.9.3
* - Automate fall-back to image loaders in order of preference:
* [mode]-image-[level]-[hand] (discrete image loader)
* [mode]-image-[level]-[1 through current-hand]plus (*** range image loader)
* [mode]-image-[level] (level image loader)
*
* *** A range image loader page example would be:
* melody-image-1-3plus
* This would load images for any level 1 hand at or above index 3 that does not
* have a discrete image loader page or a more applicable range loader that would
* take precedence.
*
* 1.9.2
* - Fix an issue with the verbiage randomizer.
*
* 1.9.1
* - Added game.setHandConfigOverride({...}) and game.setHandVerbiageOverride({...}) methods
* to be used in [mode]-image-[level]-[hand] pages, allowing overriding game settings
* on a per hand basis. Example:
* game.setHandConfigOverride({dealerName: 'Different Name'});
* To override dealer name for a single hand.
*
* 1.9.0
* - Move game configuration variables to "core-config" page
* - Move verbiage configuration to "core-verbiage" and "[mode]-verbiage-[level/cum-mode]" pages
*
* 1.8.1
* - Added cumToWinTimer game option to enable use of remaining winToCum round time
* as time limit to cum.
*
* 1.8.0
* - Reset config to core before loading level config.
* - Added optional roundLimits option to mode configuration,
* allowing some levels to be shorter than others.
* - Validate configuration and image pages before attempting to load them.
*
* 1.7.4
* - Better adjustment to blackjack win notification class
*
* 1.7.3
* - Fix an issue with object randomizer
*
* 1.7.2
* - Adjust class of blackjack win notifications to work on mobile devices
*
* 1.7.1
* - Move some game getter/setters/vars below the game setting area.
*
* 1.7
* - Adjust penalty probabilities
*
* 1.6
* - Optimize object randomizer
*
* 1.5 and below
* - Too many changes to list
*
*/


