node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

properjs-gamequest

GameQuest

Keep a log of a games quests and their statuses.

Installation

npm install properjs-gamequest --save-dev

Usage

GameQuest will utilize localStorage. So, quest state is persisted and it will try to load from storage on initialization.

var GameQuest = require( "properjs-gamequest" );
var gameQuest = new GameQuest();
 
// Add a new quest 
if ( !gameQuest.isQuestComplete( "my-quest" ) ) {
    // You now have an un-fulfilled quest in the log 
    gameQuest.addQuest( "my-quest" );
}
 
// Fulfill a quest 
if ( /* some player action */ ) {
    gameQuest.completeQuest( "my-quest" );
}
 
// Also 
gameQuest.getQuest( id );
gameQuest.removeQuest( id );
gameQuest.getQuest( id );
 
// See all 
gameQuest.getQuests();
 
// Save to localStorage manually 
// GameQuest automatically does this for you though 
gameQuest.setQuests();