diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 669aaac059..4de1b1f99e 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -8328,7 +8328,7 @@ if(typeof module != 'undefined' && module.exports){ if (((_ref1 = user.flags) != null ? _ref1.dropsEnabled : void 0) && Math.random() < (.05 * chanceMultiplier)) { rarity = Math.random(); if (rarity > .6) { - drop = helpers.randomVal(items.items.food); + drop = helpers.randomVal(_.omit(items.items.food, 'Saddle')); if ((_base1 = user.items.food)[_name = drop.name] == null) { _base1[_name] = 0; } @@ -9708,178 +9708,130 @@ try { }, eggs: { Wolf: { - text: 'Wolf', - name: 'Wolf', - value: 3 + text: 'Wolf' }, TigerCub: { - text: 'Tiger Cub', - name: 'TigerCub', - value: 3 + text: 'Tiger Cub' }, PandaCub: { - text: 'Panda Cub', - name: 'PandaCub', - value: 3 + text: 'Panda Cub' }, LionCub: { - text: 'Lion Cub', - name: 'LionCub', - value: 3 + text: 'Lion Cub' }, Fox: { - text: 'Fox', - name: 'Fox', - value: 3 + text: 'Fox' }, FlyingPig: { - text: 'Flying Pig', - name: 'FlyingPig', - value: 3 + text: 'Flying Pig' }, Dragon: { - text: 'Dragon', - name: 'Dragon', - value: 3 + text: 'Dragon' }, Cactus: { - text: 'Cactus', - name: 'Cactus', - value: 3 + text: 'Cactus' }, BearCub: { - text: 'Bear Cub', - name: 'BearCub', - value: 3 + text: 'Bear Cub' } }, hatchingPotions: { Base: { + value: 1, text: 'Base', - name: 'Base', - notes: "Hatches your pet in it's base form.", - value: 1 + notes: "Hatches your pet in it's base form." }, White: { + value: 2, text: 'White', - name: 'White', - notes: 'Turns your animal into a White pet.', - value: 2 + notes: 'Turns your animal into a White pet.' }, Desert: { + value: 2, text: 'Desert', - name: 'Desert', - notes: 'Turns your animal into a Desert pet.', - value: 2 + notes: 'Turns your animal into a Desert pet.' }, Red: { + value: 3, text: 'Red', - name: 'Red', - notes: 'Turns your animal into a Red pet.', - value: 3 + notes: 'Turns your animal into a Red pet.' }, Shade: { + value: 3, text: 'Shade', - name: 'Shade', - notes: 'Turns your animal into a Shade pet.', - value: 3 + notes: 'Turns your animal into a Shade pet.' }, Skeleton: { + value: 3, text: 'Skeleton', - name: 'Skeleton', - notes: 'Turns your animal into a Skeleton.', - value: 3 + notes: 'Turns your animal into a Skeleton.' }, Zombie: { + value: 4, text: 'Zombie', - name: 'Zombie', - notes: 'Turns your animal into a Zombie.', - value: 4 + notes: 'Turns your animal into a Zombie.' }, CottonCandyPink: { + value: 4, text: 'Cotton Candy Pink', - name: 'CottonCandyPink', - notes: 'Turns your animal into a Cotton Candy Pink pet.', - value: 4 + notes: 'Turns your animal into a Cotton Candy Pink pet.' }, CottonCandyBlue: { + value: 4, text: 'Cotton Candy Blue', - name: 'CottonCandyBlue', - notes: 'Turns your animal into a Cotton Candy Blue pet.', - value: 4 + notes: 'Turns your animal into a Cotton Candy Blue pet.' }, Golden: { + value: 5, text: 'Golden', - name: 'Golden', - notes: 'Turns your animal into a Golden pet.', - value: 5 + notes: 'Turns your animal into a Golden pet.' } }, food: { Meat: { text: 'Meat', - name: 'Meat', - value: 1, target: 'Base' }, Milk: { text: 'Milk', - name: 'Milk', - value: 1, target: 'White' }, Potatoe: { text: 'Potatoe', - name: 'Potatoe', - value: 1, target: 'Desert' }, Strawberry: { text: 'Strawberry', - name: 'Strawberry', - value: 1, target: 'Red' }, Chocolate: { text: 'Chocolate', - name: 'Chocolate', - value: 1, target: 'Shade' }, Fish: { text: 'Fish', - name: 'Fish', - value: 1, target: 'Skeleton' }, RottenMeat: { text: 'Rotten Meat', - name: 'RottenMeat', - value: 1, target: 'Zombie' }, CottonCandyPink: { text: 'Pink Cotton Candy', - name: 'CottonCandyPink', - value: 1, target: 'CottonCandyPink' }, CottonCandyBlue: { text: 'Blue Cotton Candy', - name: 'CottonCandyBlue', - value: 1, target: 'CottonCandyBlue' }, Honey: { text: 'Honey', - name: 'Honey', - value: 1, target: 'Golden' }, Saddle: { text: 'Saddle', - name: 'Saddle', - value: 10 + value: 5, + notes: 'Instantly raises your pet into a mount.' } } }; @@ -9898,16 +9850,27 @@ try { }); }); - _.each(items.eggs, function(pet) { - return pet.notes = 'Find a hatching potion to pour on this egg, and it will hatch into a loyal pet.'; + _.each(items.eggs, function(egg, k) { + return _.defaults(egg, { + value: 3, + name: k, + notes: 'Find a hatching potion to pour on this egg, and it will hatch into a loyal pet.' + }); }); - _.each(items.hatchingPotions, function(hatchingPotion) { - return hatchingPotion.notes = "Pour this on an egg, and it will hatch as a " + hatchingPotion.text + " pet."; + _.each(items.hatchingPotions, function(pot, k) { + return _.defaults(pot, { + name: k, + notes: "Pour this on an egg, and it will hatch as a " + pot.text + " pet." + }); }); - _.each(items.food, function(food) { - return food.notes = "Feed this to a pet and it may grown into a sturdy steed."; + _.each(items.food, function(food, k) { + return _.defaults(food, { + value: 1, + name: k, + notes: "Feed this to a pet and it may grown into a sturdy steed." + }); }); module.exports.buyItem = function(user, type) { diff --git a/script/algos.coffee b/script/algos.coffee index a66382ee09..8e4441af3b 100644 --- a/script/algos.coffee +++ b/script/algos.coffee @@ -134,7 +134,8 @@ randomDrop = (user, delta, priority, streak = 0, options={}) -> # Food: 40% chance if rarity > .6 - drop = helpers.randomVal(items.items.food) + + drop = helpers.randomVal _.omit(items.items.food, 'Saddle') user.items.food[drop.name] ?= 0 user.items.food[drop.name]+= 1 drop.type = 'Food' diff --git a/script/items.coffee b/script/items.coffee index 68ff955f1e..fc089ad673 100644 --- a/script/items.coffee +++ b/script/items.coffee @@ -46,44 +46,46 @@ items = module.exports.items = reroll: {type: 'reroll', text: "Re-Roll", classes: 'reroll', notes: "Resets your task values back to 0 (yellow). Useful when everything's red and it's hard to stay alive.", value:0 } eggs: - Wolf: {text: 'Wolf', name: 'Wolf', value: 3} - TigerCub: {text: 'Tiger Cub', name: 'TigerCub', value: 3} - #{text: 'Polar Bear Cub', name: 'PolarBearCub', value: 3} #commented out because there are no polarbear modifiers yet, special drop? - PandaCub: {text: 'Panda Cub', name: 'PandaCub', value: 3} - LionCub: {text: 'Lion Cub', name: 'LionCub', value: 3} - Fox: {text: 'Fox', name: 'Fox', value: 3} - FlyingPig: {text: 'Flying Pig', name: 'FlyingPig', value: 3} - Dragon: {text: 'Dragon', name: 'Dragon', value: 3} - Cactus: {text: 'Cactus', name: 'Cactus', value: 3} - BearCub: {text: 'Bear Cub', name: 'BearCub', value: 3} + Wolf: text: 'Wolf' # values set below + TigerCub: text: 'Tiger Cub' + PandaCub: text: 'Panda Cub' + LionCub: text: 'Lion Cub' + Fox: text: 'Fox' + FlyingPig: text: 'Flying Pig' + Dragon: text: 'Dragon' + Cactus: text: 'Cactus' + BearCub: text: 'Bear Cub' + #{text: 'Polar Bear Cub', name: 'PolarBearCub', value: 3} hatchingPotions: - Base: {text: 'Base', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1} - White: {text: 'White', name: 'White', notes: 'Turns your animal into a White pet.', value: 2} - Desert: {text: 'Desert', name: 'Desert', notes: 'Turns your animal into a Desert pet.', value: 2} - Red: {text: 'Red', name: 'Red', notes: 'Turns your animal into a Red pet.', value: 3} - Shade: {text: 'Shade', name: 'Shade', notes: 'Turns your animal into a Shade pet.', value: 3} - Skeleton: {text: 'Skeleton', name: 'Skeleton', notes: 'Turns your animal into a Skeleton.', value: 3} - Zombie: {text: 'Zombie', name: 'Zombie', notes: 'Turns your animal into a Zombie.', value: 4} - CottonCandyPink: {text: 'Cotton Candy Pink', name: 'CottonCandyPink', notes: 'Turns your animal into a Cotton Candy Pink pet.', value: 4} - CottonCandyBlue: {text: 'Cotton Candy Blue', name: 'CottonCandyBlue', notes: 'Turns your animal into a Cotton Candy Blue pet.', value: 4} - Golden: {text: 'Golden', name: 'Golden', notes: 'Turns your animal into a Golden pet.', value: 5} + Base: value: 1, text: 'Base', notes: "Hatches your pet in it's base form." + White: value: 2, text: 'White', notes: 'Turns your animal into a White pet.' + Desert: value: 2, text: 'Desert', notes: 'Turns your animal into a Desert pet.' + Red: value: 3, text: 'Red', notes: 'Turns your animal into a Red pet.' + Shade: value: 3, text: 'Shade', notes: 'Turns your animal into a Shade pet.' + Skeleton: value: 3, text: 'Skeleton', notes: 'Turns your animal into a Skeleton.' + Zombie: value: 4, text: 'Zombie', notes: 'Turns your animal into a Zombie.' + CottonCandyPink: value: 4, text: 'Cotton Candy Pink', notes: 'Turns your animal into a Cotton Candy Pink pet.' + CottonCandyBlue: value: 4, text: 'Cotton Candy Blue', notes: 'Turns your animal into a Cotton Candy Blue pet.' + Golden: value: 5, text: 'Golden', notes: 'Turns your animal into a Golden pet.' food: - Meat: {text: 'Meat', name: 'Meat', value: 1, target: 'Base'} - Milk: {text: 'Milk', name: 'Milk', value: 1, target: 'White'} - Potatoe: {text: 'Potatoe', name: 'Potatoe', value: 1, target: 'Desert'} - Strawberry: {text: 'Strawberry', name: 'Strawberry', value: 1, target: 'Red'} - Chocolate: {text: 'Chocolate', name: 'Chocolate', value: 1, target: 'Shade'} - Fish: {text: 'Fish', name: 'Fish', value: 1, target: 'Skeleton'} - RottenMeat: {text: 'Rotten Meat', name: 'RottenMeat', value: 1, target: 'Zombie'} - CottonCandyPink: {text: 'Pink Cotton Candy', name: 'CottonCandyPink', value: 1, target: 'CottonCandyPink'} - CottonCandyBlue: {text: 'Blue Cotton Candy', name: 'CottonCandyBlue', value: 1, target: 'CottonCandyBlue'} - Honey: {text: 'Honey', name: 'Honey', value: 1, target: 'Golden'} - #Cheese: {text: 'Cheese', name: 'Cheese', value: 1, target: 'Golden'} - #Watermelon: {text: 'Watermelon', name: 'Watermelon', value: 1, target: 'Golden'} - #SeaWeed: {text: 'SeaWeed', name: 'SeaWeed', value: 1, target: 'Golden'} - Saddle: {text: 'Saddle', name: 'Saddle', value: 10} + Meat: text: 'Meat', target: 'Base' + Milk: text: 'Milk', target: 'White' + Potatoe: text: 'Potatoe', target: 'Desert' + Strawberry: text: 'Strawberry', target: 'Red' + Chocolate: text: 'Chocolate', target: 'Shade' + Fish: text: 'Fish', target: 'Skeleton' + RottenMeat: text: 'Rotten Meat', target: 'Zombie' + CottonCandyPink: text: 'Pink Cotton Candy', target: 'CottonCandyPink' + CottonCandyBlue: text: 'Blue Cotton Candy', target: 'CottonCandyBlue' + Honey: text: 'Honey', target: 'Golden' + # FIXME what to do with these extra items? Should we add "targets" (plural) for food instead of singular, so we don't have awkward extras? + #Cheese: text: 'Cheese', target: 'Golden' + #Watermelon: text: 'Watermelon', target: 'Golden' + #SeaWeed: text: 'SeaWeed', target: 'Golden' + + Saddle: text: 'Saddle', value: 5, notes: 'Instantly raises your pet into a mount.' # we somtimes want item arrays above in reverse order, for backward lookups (you'll see later in the code) reversed = {} @@ -94,9 +96,14 @@ _.each ['weapon', 'armor', 'head', 'shield'], (type) -> # Also add canOwn(), which we use when comparing if user is a backer or contributor - but defaulted to `return true` _.each items[type], (item) -> _.defaults(item, {type, canOwn: ->true}) -_.each items.eggs, (pet) -> pet.notes = 'Find a hatching potion to pour on this egg, and it will hatch into a loyal pet.' -_.each items.hatchingPotions, (hatchingPotion) -> hatchingPotion.notes = "Pour this on an egg, and it will hatch as a #{hatchingPotion.text} pet." -_.each items.food, (food) -> food.notes = "Feed this to a pet and it may grown into a sturdy steed." +_.each items.eggs, (egg,k) -> + _.defaults egg, {value: 3, name: k, notes: 'Find a hatching potion to pour on this egg, and it will hatch into a loyal pet.'} + +_.each items.hatchingPotions, (pot,k) -> + _.defaults pot, {name: k, notes: "Pour this on an egg, and it will hatch as a #{pot.text} pet."} + +_.each items.food, (food,k) -> + _.defaults food, {value: 1, name: k, notes: "Feed this to a pet and it may grown into a sturdy steed."} module.exports.buyItem = (user, type) -> nextItem =