Code coverage report for ./src/client/app/dialogue/dialogue.controller.js

Statements: 16.67% (6 / 36)      Branches: 0% (0 / 4)      Functions: 12.5% (1 / 8)      Lines: 16.67% (6 / 36)      Ignored: none     

All files » ./src/client/app/dialogue/ » dialogue.controller.js
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 641     1       1     1                                                                   1                 1                    
(function() {
    'use strict';
 
    angular
        .module('app.dialogue')
        .controller('DialogueController', DialogueController);
 
    DialogueController.$inject = ['dialogueService', 'progressService', 'mainService', 'inventoryService'];
 
    /* @ngInject */
    function DialogueController(dialogueService, progressService, mainService, inventoryService) {
        var vm = this;
        dialogueService.initAllDialogues();
        activate();
        vm.passText = 'You have the passcode?';
        
        vm.switchTemplate = function(template) {
            mainService.switchTemplate(template);
        };
 
        vm.switchDialogue = function(input, master) {
            vm.currentMaster = dialogueService[master];
            vm.currentDialogue = vm.currentMaster.dialogue[input];
            vm.locationText = vm.currentDialogue.text;
            special();
        };
 
        vm.switchLevel = function(level) {
            vm.currentLocation = mainService.switchLevel(level);
        };
 
        vm.passSubmit = function() {
            vm.passcode = vm.passcode.toUpperCase();
            if (vm.passcode === 'AQKX') {
                vm.passComplete = true;
                progressService.progress.passCode = true;
                inventoryService.itemDictionary['sweetJacket'][1][1] = 1;
                vm.passText = 'Nice!  Thats the passcode alright.  You solved my riddle, now here is your prize. *The man hands you a [Sweet Jacket]!*';
            }
            else {
                vm.passText = 'Hey! Thats not the passcode!';
            }
        };
 
        function special() {
            if (typeof vm.currentDialogue.special !== 'undefined') {
                vm.currentDialogue.special();
            }
        }
 
        ////////////////
 
 
        function activate() {
            var location = mainService.currentLocation;
            var initDialogue = location.dialogue;
            var key = initDialogue.initDialogue();
            vm.passcode = '';
            vm.currentDialogue = initDialogue.dialogue[key];
            vm.locationText = vm.currentDialogue.text;
            special();
        }
    }
})();