Code coverage report for ./src/client/app/inventory/inventory.service.js

Statements: 1.55% (6 / 388)      Branches: 0% (0 / 14)      Functions: 10% (1 / 10)      Lines: 1.55% (6 / 388)      Ignored: none     

All files » ./src/client/app/inventory/ » inventory.service.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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 5551     1       1     1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1                           1                            
(function() {
    'use strict';
 
    angular
        .module('app.inventory')
        .service('inventoryService', inventoryService);
 
    inventoryService.$inject = ['progressService'];
 
    /* @ngInject */
    function inventoryService(progressService) {
    	var vm = this;
    	vm.progress = progressService.progress;
		vm.itemDictionary = [];
 
		this.Item = function() {
			this.buyable = false,
			this.removeAfterBuy = false,
			this.craftTime = 5000,
			this.recipe  = undefined,
			this.quantity = 0,
			this.cat = 'default',
			this.spawn = undefined,
			this.name = 'Default',
			this.slug = function() {
				var slug = this.name.toLowerCase();
				return slug;
			},
			this.attackSpeedMessage = function() {
				var message = '';
				if (this.attackSpeed === 2) {
					message = 'Average Speed';
				}
				else if (this.attackSpeed > 2) {
					message = 'Slow Speed';
 
				} else if (this.attackSpeed < 2) {
					message = 'Fast Speed';
				}
				return message;
			}
		};
 
 
 
 
		//weapons
		this.fists = new this.Item();
		this.fists.name = 'Fists';
		this.fists.desc = 'just some fists'
		this.fists.damage = 1;
		this.fists.attackSpeed = 1;
		this.fists.slug = 'fists';
 
		this.sword = new this.Item();
		this.sword.name = 'Wooden Sword';
		this.sword.desc = 'Sourced from 100% Organic Non-GMO Trees';
		this.sword.buyable = true;
		this.sword.removeAfterBuy = true;
		this.sword.price = 200;
		this.sword.recipe = ['wood-100'];
		this.sword.cat = 'weapon';
		this.sword.damage = 4;
		this.sword.attackSpeed = 2;
		this.sword.slug = 'sword';
 
		this.decentSword = new this.Item();
		this.decentSword.name = 'Decent Sword';
		this.decentSword.desc = 'It is alright';
		this.decentSword.buyable = true;
		this.decentSword.removeAfterBuy = true;
		this.decentSword.price = 4000;
		this.decentSword.damage = 10;
		this.decentSword.attackSpeed = 2;
		this.decentSword.slug = 'decentSword';
 
		this.bearClaws = new this.Item();
		this.bearClaws.name = 'Bear Arms';
		this.bearClaws.desc = 'Just like the founding fathers intended';
		this.bearClaws.damage = 2;
		this.bearClaws.attackSpeed = 1;
		this.bearClaws.slug = 'bearClaws';
 
		this.minotaurHammer = new this.Item();
		this.minotaurHammer.name = 'Minotaur Hammer';
		this.minotaurHammer.desc = 'This thing is a beast';
		this.minotaurHammer.damage = 30;
		this.minotaurHammer.attackSpeed = 4;
		this.minotaurHammer.slug = 'minotaurHammer';
 
		this.claws = new this.Item();
		this.claws.name = 'Crab Claws';
		this.claws.slug = 'claws';
		this.claws.desc = 'Big, Meaty, Claws!';
		this.claws.damage = 45;
		this.claws.attackSpeed = 4;
 
		this.giantCarrot = new this.Item();
		this.giantCarrot.name = 'Giant Carrot';
		this.giantCarrot.desc = 'Formerly known as Garys nose';
		this.giantCarrot.damage = 15;
		this.giantCarrot.attackSpeed = 1;
		this.giantCarrot.slug = 'giantCarrot';
		this.giantCarrot.lootOnce = true;
 
		vm.itemDictionary['fists'] = [['item', this.fists], ['amount', 1]];
		vm.itemDictionary['sword'] = [['item', this.sword], ['amount', 0]];
		vm.itemDictionary['decentSword'] = [['item', this.decentSword], ['amount', 0]];
		vm.itemDictionary['bearClaws'] = [['item', this.bearClaws], ['amount', 0]];
		vm.itemDictionary['minotaurHammer'] = [['item', this.minotaurHammer], ['amount', 0]];
		vm.itemDictionary['claws'] = [['item', this.claws], ['amount', 0]];
		vm.itemDictionary['giantCarrot'] = [['item', this.giantCarrot], ['amount', 0]];
 
		//armor
		this.clothArmor = new this.Item();
		this.clothArmor.name = 'Cloth Armor';
		this.clothArmor.desc = 'Better than nothing?';
		this.clothArmor.armor = 0;
		this.clothArmor.slug = 'clothArmor';
 
		this.woodArmor = new this.Item();
		this.woodArmor.name = 'Wood Armor';
		this.woodArmor.desc = 'Hope for no splinters!';
		this.woodArmor.cat = 'armor';
		this.woodArmor.armor = 0.15;
		this.woodArmor.buyable = true;
		this.woodArmor.removeAfterBuy = true;
		this.woodArmor.price = 200;
		this.woodArmor.slug = 'woodArmor';
 
		this.boneArmor = new this.Item();
		this.boneArmor.name = 'Bone Armor';
		this.boneArmor.desc = 'Bonez';
		this.boneArmor.cat = 'armor';
		this.boneArmor.armor = 0.2;
		this.boneArmor.price = 300;
		this.boneArmor.removeAfterBuy = true;
		this.boneArmor.slug = 'boneArmor';
 
		this.polarArmor = new this.Item();
		this.polarArmor.name = 'Tuxedo';
		this.polarArmor.desc = 'dapper';
		this.polarArmor.armor = 0.3;
		this.polarArmor.slug = 'polarArmor';
 
		this.healthArmor = new this.Item();
		this.healthArmor.name = 'health armor';
		this.healthArmor.desc = 'health armor';
		this.healthArmor.armor = 0;
		this.healthArmor.healthMult = 2;
		this.healthArmor.slug = 'healthArmor';
 
		this.ghostArmor = new this.Item();
		this.ghostArmor.name = 'Spooky Aura';
		this.ghostArmor.desc = 'Feels like a ghost hug <3';
		this.ghostArmor.armor = 0;
		this.ghostArmor.damageMult = 50;
		this.ghostArmor.slug = 'ghostArmor';
 
		this.robotArmor = new this.Item();
		this.robotArmor.name = 'Mech Suit';
		this.robotArmor.desc = 'Battle Ready Armor';
		this.robotArmor.armor = 0.40;
		this.robotArmor.damageMult = 15;
		this.robotArmor.slug = 'robotArmor';
 
		this.bugExoskeleton = new this.Item();
		this.bugExoskeleton.name = 'Stick Bug Exoskeleton';
		this.bugExoskeleton.slug = 'bugExoskeleton';
		this.bugExoskeleton.desc = 'Seems useful';
		this.bugExoskeleton.armor = 0.5;
		this.bugExoskeleton.damageMult = -25;
 
		this.potionArmor = new this.Item();
		this.potionArmor.name = 'Potion Armor';
		this.potionArmor.desc = 'Feels like a ghost hug <3';
		this.potionArmor.armor = 0;
		this.potionArmor.healthRate = 20;
		this.potionArmor.slug = 'potionArmor';
 
		vm.itemDictionary['robotArmor'] = [['item', this.robotArmor], ['amount', 0]];
		vm.itemDictionary['potionArmor'] = [['item', this.potionArmor], ['amount', 0]];
		vm.itemDictionary['ghostArmor'] = [['item', this.ghostArmor], ['amount', 0]];
		vm.itemDictionary['woodArmor'] = [['item', this.woodArmor], ['amount', 0]];
		vm.itemDictionary['bugExoskeleton'] = [['item', this.bugExoskeleton], ['amount', 0]];
		vm.itemDictionary['boneArmor'] = [['item', this.boneArmor], ['amount', 0]];
		vm.itemDictionary['healthArmor'] = [['item', this.healthArmor], ['amount', 0]];
		vm.itemDictionary['clothArmor'] = [['item', this.clothArmor], ['amount', 1]];
		vm.itemDictionary['polarArmor'] = [['item', this.polarArmor], ['amount', 0]];
 
		//consumables
		this.potion = new this.Item();
		this.potion.name = 'Health Potion';
		this.potion.slug = 'potion';
		this.potion.desc = 'Heals ' + this.potion.strength + ' health';
		this.potion.buyable = true;
		this.potion.price = 100;
		this.potion.quantity = 0;
 
		vm.itemDictionary['potion'] = [['item', this.potion], ['amount', 0]];
 
		//other items
		this.trueOffense = new this.Item();
		this.trueOffense.name = 'Offensive Sprit';
		this.trueOffense.slug = 'trueOffense';
		this.trueOffense.desc = 'Elder seal of approval';
		this.trueOffense.message = 'Damage increased by 25%';
		this.trueOffense.damageMult = 25;
 
		this.trueDefense = new this.Item();
		this.trueDefense.name = 'Defensive Sprit';
		this.trueDefense.slug = 'trueDefense';
		this.trueDefense.desc = 'Elder seal of approval';
		this.trueDefense.message = 'Armor increased by 25%';
		this.trueDefense.defenseMult = 25;
 
		this.trueHealth = new this.Item();
		this.trueHealth.name = 'Kind Spirit';
		this.trueHealth.slug = 'trueHealth';
		this.trueHealth.desc = 'Elder seal of approval';
		this.trueHealth.message = 'Health increased by 25%';
		this.trueHealth.healthMult = 25;
 
		this.winterCoat = new this.Item();
		this.winterCoat.name = 'Winter Sweater';
		this.winterCoat.slug = 'winterCoat';
		this.winterCoat.desc = 'Covered in cute deer and trees~';
		this.winterCoat.message = 'Keeps you warm and cozy so you can visit the snow wastes safely! +25 Health';
		this.winterCoat.health = 25;
		this.winterCoat.buyable = true;
		this.winterCoat.price = 5000;
		this.winterCoat.removeAfterBuy = true;
		this.winterCoat.special = function() {
			vm.progress.hasSweater = true;
		};
 
		this.pearl = new this.Item();
		this.pearl.name = 'Shiny Pearl';
		this.pearl.slug = 'pearl';
		this.pearl.desc = '';
		this.pearl.message = 'Holder gains +25 gold a second';
		this.pearl.money = 25;
 
		this.piggyBank = new this.Item();
		this.piggyBank.name = 'Cat Bank';
		this.piggyBank.slug = 'piggyBank';
		this.piggyBank.desc = 'Like a Piggy Bank, but a Cat instead';
		this.piggyBank.message = 'Holder gains +15 gold a second';
		this.piggyBank.money = 15;
		this.piggyBank.buyable = true;
		this.piggyBank.removeAfterBuy = true;
		this.piggyBank.price = 2500;
 
		this.wizardsHair = new this.Item();
		this.wizardsHair.name = 'Wizards Hair';
		this.wizardsHair.slug = 'wizardsHair';
		this.wizardsHair.desc = 'Rumored to grant the holder great power.';
		this.wizardsHair.message = '5% increased damage, 5% increased armor, 5% increased health';
		this.wizardsHair.healthMult = 5;
		this.wizardsHair.damageMult = 5;
		this.wizardsHair.defenseMult = 5;
		this.wizardsHair.buyable = true;
		this.wizardsHair.price = 10000;
		this.wizardsHair.removeAfterBuy = true;
 
		this.deerAntlers = new this.Item();
		this.deerAntlers.name = 'Deer Antlers';
		this.deerAntlers.slug = 'deerAntlers';
		this.deerAntlers.desc = 'The latest in deer fashion';
		this.deerAntlers.message = 'Attacks deal +1 damage.';
		this.deerAntlers.lootOnce = true;
		this.deerAntlers.damage = 1;
 
		this.snowmanHat = new this.Item();
		this.snowmanHat.name = 'Snowmans Hat';
		this.snowmanHat.slug = 'snowmanHat';
		this.snowmanHat.desc = 'No one will ever wear it as good as the snowman...';
		this.snowmanHat.message = 'Attacks deal +5 damage';
		this.snowmanHat.lootOnce = true;
		this.snowmanHat.damage = 5;
 
		this.sleepingBag = new this.Item();
		this.sleepingBag.name = 'Deluxe Sleeping Bag';
		this.sleepingBag.slug = 'sleepingBag';
		this.sleepingBag.desc = 'Deluxe model is 23% cozier';
		this.sleepingBag.message = 'Allows you to sleep outside and rest anywhere';
		this.sleepingBag.buyable = true;
		this.sleepingBag.price = 2000;
		this.sleepingBag.removeAfterBuy = true;
		this.sleepingBag.special = function() {
			vm.progress.hasSleepingBag = true;
		};
 
		this.gorillaFoot = new this.Item();
		this.gorillaFoot.name = 'Lucky Gorilla Foot';
		this.gorillaFoot.slug = 'gorillaFoot';
		this.gorillaFoot.desc = 'Luckiest of all animal feet';
		this.gorillaFoot.message = 'Holder gains +5 gold a second';
		this.gorillaFoot.lootOnce = true;
		this.gorillaFoot.money = 5;
 
		this.pocketSand = new this.Item();
		this.pocketSand.name = 'Pocket Sand';
		this.pocketSand.slug = 'pocketSand';
		this.pocketSand.desc = 'Wingo! Pocket sand!';
		this.pocketSand.message = '1% chance to evade damage.';
		this.pocketSand.lootOnce = true;
		this.pocketSand.evade = 1;
 
		this.mantisClaw = new this.Item();
		this.mantisClaw.name = 'Mantis Claw';
		this.mantisClaw.slug = 'mantisClaw';
		this.mantisClaw.desc = 'Scythe like';
		this.mantisClaw.message = 'Attacks deal +5 damage';
		this.mantisClaw.lootOnce = true;
		this.mantisClaw.damage = 5;
 
 
 
		this.bigHeavyWood = new this.Item();
		this.bigHeavyWood.name = 'Log';
		this.bigHeavyWood.slug = 'bigHeavyWood';
		this.bigHeavyWood.desc = 'Its big, its heavy, its wood!';
		this.bigHeavyWood.message = '+25 health';
		this.bigHeavyWood.lootOnce = true;
		this.bigHeavyWood.health = 25;
 
		this.pie = new this.Item();
		this.pie.name = 'Memories of pie';
		this.pie.slug = 'pie';
		this.pie.desc = 'Remembering the pie, it fills you with determination.';
		this.pie.message = '+50 health';
		this.pie.health = 50;
 
		this.unicornHorn = new this.Item();
		this.unicornHorn.name = 'Unicorn Horn';
		this.unicornHorn.slug = 'unicornHorn';
		this.unicornHorn.desc = '';
		this.unicornHorn.message = '';
		this.unicornHorn.health = '';
 
		this.snowmenBlessing = new this.Item();
		this.snowmenBlessing.name = 'Snowmens Blessing';
		this.snowmenBlessing.slug = 'snowmenBlessing';
		this.snowmenBlessing.desc = 'RIP Gary & Friends';
		this.snowmenBlessing.message = 'Increases health by 50 and gives +10 gold a second.';
		this.snowmenBlessing.health = 50;
		this.snowmenBlessing.money = 10;
 
		this.abomItem = new this.Item();
		this.abomItem.name = 'Lucky Yeti Boots';
		this.abomItem.slug = 'abomItem';
		this.abomItem.desc = 'A little too big';
		this.abomItem.message = '+50 health and wearer gains +20 gold a second.';
		this.abomItem.health = 50;
		this.abomItem.money = 20;
 
		this.mammothFur = new this.Item();
		this.mammothFur.name = 'Mammoth Fur Scarf';
		this.mammothFur.slug = 'mammothFur';
		this.mammothFur.desc = 'Kind of itchy..';
		this.mammothFur.message = 'Health increased by 5%';
		this.mammothFur.healthMult = 5;
 
		this.frozenBanana = new this.Item();
		this.frozenBanana.name = 'Frozen Banana';
		this.frozenBanana.slug = 'frozenBanana';
		this.frozenBanana.desc = 'Maybe it will melt someday';
		this.frozenBanana.message = 'Damage increased by 4%';
		this.frozenBanana.damageMult = 4;
 
		this.kingCrown = new this.Item();
		this.kingCrown.name = 'Crown of the King';
		this.kingCrown.slug = 'kingCrown';
		this.kingCrown.desc = 'Slightly bloody';
		this.kingCrown.message = '+50 health and armor increased by 5%';
		this.kingCrown.health = 50;
		this.kingCrown.defenseMult = 5;
 
		this.vampireTeeth = new this.Item();
		this.vampireTeeth.name = 'Vampire Teeth';
		this.vampireTeeth.slug = 'vampireTeeth';
		this.vampireTeeth.desc = 'Made from plastic?';
		this.vampireTeeth.message = 'Attacks deal +5 damage';
		this.vampireTeeth.damage = 5;
 
		this.sweetJacket = new this.Item();
		this.sweetJacket.name = 'Sweet Jacket';
		this.sweetJacket.slug = 'sweetJacket';
		this.sweetJacket.desc = 'Makes you look tough and has pockets for snacks!';
		this.sweetJacket.message = 'Damage increased by 10%, Armor increased by 10%, +100 coolness';
		this.sweetJacket.damageMult = 10;
		this.sweetJacket.defenseMult = 10;
 
		this.undeadItem = new this.Item();
		this.undeadItem.name = 'Soul Fragment';
		this.undeadItem.desc = 'A piece of The Lichs soul';
		this.undeadItem.slug = 'undeadItem';
		this.undeadItem.message = 'Damage increased by 5%, Armor increased by 5%, +100 health';
		this.undeadItem.damageMult = 5;
		this.undeadItem.defenseMult = 5;
		this.undeadItem.health = 100;
 
		this.lichItem = new this.Item();
		this.lichItem.name = 'The Lichs Phylactery';
		this.lichItem.desc = '';
		this.lichItem.slug = 'lichItem';
		this.lichItem.message = '';
 
		vm.itemDictionary['lichItem'] = [['item', this.lichItem], ['amount', 0]];
		vm.itemDictionary['undeadItem'] = [['item', this.undeadItem], ['amount', 0]];
		vm.itemDictionary['sweetJacket'] = [['item', this.sweetJacket], ['amount', 0]];
		vm.itemDictionary['vampireTeeth'] = [['item', this.vampireTeeth], ['amount', 0]];
		vm.itemDictionary['kingCrown'] = [['item', this.kingCrown], ['amount', 0]];
		vm.itemDictionary['frozenBanana'] = [['item', this.frozenBanana], ['amount', 0]];
		vm.itemDictionary['mammothFur'] = [['item', this.mammothFur], ['amount', 0]];
		vm.itemDictionary['abomItem'] = [['item', this.abomItem], ['amount', 0]];
		vm.itemDictionary['snowmenBlessing'] = [['item', this.snowmenBlessing], ['amount', 0]];
		vm.itemDictionary['piggyBank'] = [['item', this.piggyBank], ['amount', 0]];
		vm.itemDictionary['pie'] = [['item', this.pie], ['amount', 0]];
		vm.itemDictionary['trueOffense'] = [['item', this.trueOffense], ['amount', 0]];
		vm.itemDictionary['trueDefense'] = [['item', this.trueDefense], ['amount', 0]];
		vm.itemDictionary['trueHealth'] = [['item', this.trueHealth], ['amount', 0]];
		vm.itemDictionary['bigHeavyWood'] = [['item', this.bigHeavyWood], ['amount', 0]];
		vm.itemDictionary['mantisClaw'] = [['item', this.mantisClaw], ['amount', 0]];
		vm.itemDictionary['pocketSand'] = [['item', this.pocketSand], ['amount', 0]];
		vm.itemDictionary['gorillaFoot'] = [['item', this.gorillaFoot], ['amount', 0]];
		vm.itemDictionary['pearl'] = [['item', this.pearl], ['amount, 0']];
		vm.itemDictionary['sleepingBag'] = [['item', this.sleepingBag], ['amount', 0]];
		vm.itemDictionary['snowmanHat'] = [['item', this.snowmanHat], ['amount', 0]];
		vm.itemDictionary['deerAntlers'] = [['item', this.deerAntlers], ['amount', 0]];
		vm.itemDictionary['winterCoat'] = [['item', this.winterCoat], ['amount', 0]];
		vm.itemDictionary['wizardsHair'] = [['item', this.wizardsHair], ['amount', 0]];
 
 
		//misc
		this.compendium = new this.Item();
		this.compendium.name = 'Beast Compendium';
		this.compendium.desc = 'Basically a scrapbook';
		this.compendium.message = 'Keeps track of enemies you encounter.';
		this.compendium.slug = 'compendium';
		this.compendium.buyable = true;
		this.compendium.price = 500;
		this.compendium.removeAfterBuy = true;
 
		vm.itemDictionary['compendium'] = [['item', this.compendium], ['amount', 0]];
 
		////////////////
 
		vm.otherItems = [vm.itemDictionary['trueHealth'],
						 vm.itemDictionary['trueOffense'],
						 vm.itemDictionary['trueDefense'],
						 vm.itemDictionary['bigHeavyWood'],
						 vm.itemDictionary['pie'],
						 vm.itemDictionary['winterCoat'],
						 vm.itemDictionary['deerAntlers'],
						 vm.itemDictionary['wizardsHair'],
						 vm.itemDictionary['sleepingBag'],
						 vm.itemDictionary['piggyBank'],
						 vm.itemDictionary['gorillaFoot'],
						 vm.itemDictionary['pocketSand'],
						 vm.itemDictionary['vampireTeeth'],
						 vm.itemDictionary['kingCrown'],
						 vm.itemDictionary['pearl'],
						 vm.itemDictionary['mantisClaw'],
						 vm.itemDictionary['abomItem'],
						 vm.itemDictionary['snowmanHat'],
						 vm.itemDictionary['snowmenBlessing'],
						 vm.itemDictionary['mammothFur'],
						 vm.itemDictionary['frozenBanana'],
						 vm.itemDictionary['sweetJacket'],
						 vm.itemDictionary['undeadItem'],
						 vm.itemDictionary['lichItem'],
						 vm.itemDictionary['compendium']];
 
		vm.buyableItems = ['potion', 
						   'sword', 
						   'woodArmor',
						   'decentSword', 
						   'winterCoat', 
						   'wizardsHair', 
						   'compendium',
						   'piggyBank',
						   'sleepingBag'];
 
		vm.weapons = [vm.itemDictionary['fists'],
					  vm.itemDictionary['sword'],
					  vm.itemDictionary['bearClaws'],
					  vm.itemDictionary['decentSword'],
					  vm.itemDictionary['minotaurHammer'],
					  vm.itemDictionary['claws'],
					  vm.itemDictionary['giantCarrot']];
 
 
		vm.armor = [vm.itemDictionary['clothArmor'],
					vm.itemDictionary['woodArmor'],
					vm.itemDictionary['healthArmor'],
					vm.itemDictionary['ghostArmor'],
					vm.itemDictionary['bugExoskeleton'],
					vm.itemDictionary['potionArmor'],
					vm.itemDictionary['polarArmor'],
					vm.itemDictionary['robotArmor']];
 
		vm.keys = ['fists', 'sword', 'decentSword', 'bearClaws', 'minotaurHammer', 'claws', 'giantCarrot',
				   'robotArmor', 'potionArmor', 'ghostArmor', 'woodArmor', 'bugExoskeleton', 'boneArmor', 'healthArmor', 'polarArmor', 'clothArmor',
				   'potion', 'compendium', 'wizardsHair', 'winterCoat', 'deerAntlers', 'sleepingBag', 'snowmanHat', 'pearl', 'gorillaFoot', 'pocketSand',
				   'mantisClaw', 'bigHeavyWood', 'trueOffense', 'trueDefense', 'trueHealth', 'pie', 'piggyBank', 'snowmenBlessing', 'abomItem',
				   'mammothFur', 'frozenBanana', 'kingCrown', 'vampireTeeth', 'sweetJacket', 'undeadItem', 'lichItem'];
 
		vm.findVal = function() {
			var keys = ['damage', 'health', 'evade', 'money', 'defense', 'defenseMult', 'damageMult', 'healthMult'];
			vm.stats = {
				damage: 0,
				health: 0,
				evade: 0,
				money: 0,
				defense: 0,
				defenseMult: 0,
				damageMult: 0,
				healthMult: 0
			}
			addVal(keys, vm.stats);
			vm.statReset = true;
		}
 
 
		function loadItems() {
            if (localStorage['itemSave']) {
                var items = JSON.parse(atob(localStorage['itemSave']));
                for (var i = 0; i < items.length; i++) {
                	if (items[i][1] > 0) {
                		console.log('tset')
                		vm.itemDictionary[items[i][0]][1][1] = 1;
                	}
                }
                console.log(items);
            }
		}
		loadItems();
 
		function addVal(keys, stats) {
			for (var i = 0; i < vm.otherItems.length; i++) {
				if (vm.otherItems[i][1][1] > 0) {
					for (var k = 0; k < keys.length; k++) {
						if (typeof vm.otherItems[i][0][1][keys[k]] !== 'undefined') {
							stats[keys[k]] = stats[keys[k]] + vm.otherItems[i][0][1][keys[k]];
						}
					}
				}
			}
		}
 
		vm.findVal();
    }
})();