(in)definite articles for food items. Partial fix for https://github.com/HabitRPG/habitica/issues/3571 (#9658)

* testing additional event trigger for sendMessage

* moved keyup event to newmessage

* added keyup event to tavern vue too

* all food items now have version with definite and indefinite article. foodText also adapted in messages json

* modified api.food, and feed, armoire and drop mechanism

* drops now ok, removed dropArticle, corrected feed test

* test correction

* api doc modification for task completion
This commit is contained in:
Feywood 2018-02-05 19:43:12 +01:00 committed by Matteo Pagliazzi
parent 9a00779698
commit 7c6dd6a6bd
12 changed files with 134 additions and 49 deletions

View file

@ -30,7 +30,7 @@ describe('POST /user/feed/:pet/:food', () => {
data: user.items.pets['Wolf-Base'],
message: t('messageDontEnjoyFood', {
egg: pet.text(),
foodText: food.text(),
foodText: food.textThe(),
}),
});

View file

@ -125,7 +125,7 @@ describe('shared.ops.feed', () => {
expect(data).to.eql(user.items.pets['Wolf-Base']);
expect(message).to.eql(i18n.t('messageLikesFood', {
egg: pet.text(),
foodText: food.text(),
foodText: food.textThe(),
}));
expect(user.items.food.Meat).to.equal(1);
@ -143,7 +143,7 @@ describe('shared.ops.feed', () => {
expect(data).to.eql(user.items.pets['Wolf-Spooky']);
expect(message).to.eql(i18n.t('messageLikesFood', {
egg: pet.text(),
foodText: food.text(),
foodText: food.textThe(),
}));
expect(user.items.food.Milk).to.equal(1);
@ -161,7 +161,7 @@ describe('shared.ops.feed', () => {
expect(data).to.eql(user.items.pets['Wolf-Base']);
expect(message).to.eql(i18n.t('messageDontEnjoyFood', {
egg: pet.text(),
foodText: food.text(),
foodText: food.textThe(),
}));
expect(user.items.food.Milk).to.equal(1);

View file

@ -758,9 +758,9 @@ export default {
dropNotes = Content.eggs[drop.key].notes();
this.drop(this.$t('messageDropEgg', {dropText, dropNotes}), drop);
} else if (drop.type === 'Food') {
dropText = Content.food[drop.key].text();
dropText = Content.food[drop.key].textA();
dropNotes = Content.food[drop.key].notes();
this.drop(this.$t('messageDropFood', {dropArticle: drop.article, dropText, dropNotes}), drop);
this.drop(this.$t('messageDropFood', {dropText, dropNotes}), drop);
} else if (drop.type === 'Quest') {
// TODO $rootScope.selectedQuest = Content.quests[drop.key];
// $rootScope.openModal('questDrop', {controller:'PartyCtrl', size:'sm'});

View file

@ -257,37 +257,97 @@
"premiumPotionAddlNotes": "Not usable on quest pet eggs.",
"foodMeat": "Meat",
"foodMeatThe": "the Meat",
"foodMeatA": "Meat",
"foodMilk": "Milk",
"foodMilkThe": "the Milk",
"foodMilkA": "Milk",
"foodPotatoe": "Potato",
"foodPotatoeThe": "the Potato",
"foodPotatoeA": "a Potato",
"foodStrawberry": "Strawberry",
"foodStrawberryThe": "the Strawberry",
"foodStrawberryA": "a Strawberry",
"foodChocolate": "Chocolate",
"foodChocolateThe": "the Chocolate",
"foodChocolateA": "Chocolate",
"foodFish": "Fish",
"foodFishThe": "the Fish",
"foodFishA": "a Fish",
"foodRottenMeat": "Rotten Meat",
"foodRottenMeatThe": "the Rotten Meat",
"foodRottenMeatA": "Rotten Meat",
"foodCottonCandyPink": "Pink Cotton Candy",
"foodCottonCandyPinkThe": "the Pink Cotton Candy",
"foodCottonCandyPinkA": "Pink Cotton Candy",
"foodCottonCandyBlue": "Blue Cotton Candy",
"foodCottonCandyBlueThe": "the Blue Cotton Candy",
"foodCottonCandyBlueA": "Blue Cotton Candy",
"foodHoney": "Honey",
"foodHoneyThe": "the Honey",
"foodHoneyA": "Honey",
"foodCakeSkeleton": "Bare Bones Cake",
"foodCakeSkeletonThe": "the Bare Bones Cake",
"foodCakeSkeletonA": "a Bare Bones Cake",
"foodCakeBase": "Basic Cake",
"foodCakeBaseThe": "the Basic Cake",
"foodCakeBaseA": "a Basic Cake",
"foodCakeCottonCandyBlue": "Candy Blue Cake",
"foodCakeCottonCandyBlueThe": "the Candy Blue Cake",
"foodCakeCottonCandyBlueA": "a Candy Blue Cake",
"foodCakeCottonCandyPink": "Candy Pink Cake",
"foodCakeCottonCandyPinkThe": "the Candy Pink Cake",
"foodCakeCottonCandyPinkA": "a Candy Pink Cake",
"foodCakeShade": "Chocolate Cake",
"foodCakeShadeThe": "the Chocolate Cake",
"foodCakeShadeA": "a Chocolate Cake",
"foodCakeWhite": "Cream Cake",
"foodCakeWhiteThe": "the Cream Cake",
"foodCakeWhiteA": "a Cream Cake",
"foodCakeGolden": "Honey Cake",
"foodCakeGoldenThe": "the Honey Cake",
"foodCakeGoldenA": "a Honey Cake",
"foodCakeZombie": "Rotten Cake",
"foodCakeZombieThe": "the Rotten Cake",
"foodCakeZombieA": "a Rotten Cake",
"foodCakeDesert": "Sand Cake",
"foodCakeDesertThe": "the Sand Cake",
"foodCakeDesertA": "a Sand Cake",
"foodCakeRed": "Strawberry Cake",
"foodCakeRedThe": "the Strawberry Cake",
"foodCakeRedA": "a Strawberry Cake",
"foodCandySkeleton": "Bare Bones Candy",
"foodCandySkeletonThe": "the Bare Bones Candy",
"foodCandySkeletonA": "Bare Bones Candy",
"foodCandyBase": "Basic Candy",
"foodCandyBaseThe": "the Basic Candy",
"foodCandyBaseA": "Basic Candy",
"foodCandyCottonCandyBlue": "Sour Blue Candy",
"foodCandyCottonCandyBlueThe": "the Sour Blue Candy",
"foodCandyCottonCandyBlueA": "Sour Blue Candy",
"foodCandyCottonCandyPink": "Sour Pink Candy",
"foodCandyCottonCandyPinkThe": "the Sour Pink Candy",
"foodCandyCottonCandyPinkA": "Sour Pink Candy",
"foodCandyShade": "Chocolate Candy",
"foodCandyShadeThe": "the Chocolate Candy",
"foodCandyShadeA": "Chocolate Candy",
"foodCandyWhite": "Vanilla Candy",
"foodCandyWhiteThe": "the Vanilla Candy",
"foodCandyWhiteA": "Vanilla Candy",
"foodCandyGolden": "Honey Candy ",
"foodCandyGoldenThe": "the Honey Candy",
"foodCandyGoldenA": "Honey Candy",
"foodCandyZombie": "Rotten Candy",
"foodCandyZombieThe": "the Rotten Candy",
"foodCandyZombieA": "Rotten Candy",
"foodCandyDesert": "Sand Candy",
"foodCandyDesertThe": "the Sand Candy",
"foodCandyDesertA": "Sand Candy",
"foodCandyRed": "Cinnamon Candy",
"foodCandyRedThe": "the Cinnamon Candy",
"foodCandyRedA": "Cinnamon Candy",
"foodSaddleText": "Saddle",
"foodSaddleNotes": "Instantly raises one of your pets into a mount.",

View file

@ -9,8 +9,8 @@
"messageCannotFeedPet": "Can't feed this pet.",
"messageAlreadyMount": "You already have that mount. Try feeding another pet.",
"messageEvolve": "You have tamed <%= egg %>, let's go for a ride!",
"messageLikesFood": "<%= egg %> really likes the <%= foodText %>!",
"messageDontEnjoyFood": "<%= egg %> eats the <%= foodText %> but doesn't seem to enjoy it.",
"messageLikesFood": "<%= egg %> really likes <%= foodText %>!",
"messageDontEnjoyFood": "<%= egg %> eats <%= foodText %> but doesn't seem to enjoy it.",
"messageBought": "Bought <%= itemText %>",
"messageEquipped": " <%= itemText %> equipped.",
"messageUnEquipped": "<%= itemText %> unequipped.",
@ -21,7 +21,7 @@
"messageNotEnoughGold": "Not Enough Gold",
"messageTwoHandedEquip": "Wielding <%= twoHandedText %> takes two hands, so <%= offHandedText %> has been unequipped.",
"messageTwoHandedUnequip": "Wielding <%= twoHandedText %> takes two hands, so it was unequipped when you armed yourself with <%= offHandedText %>.",
"messageDropFood": "You've found <%= dropArticle %><%= dropText %>!",
"messageDropFood": "You've found <%= dropText %>!",
"messageDropEgg": "You've found a <%= dropText %> Egg!",
"messageDropPotion": "You've found a <%= dropText %> Hatching Potion!",
"messageDropQuest": "You've found a quest!",
@ -35,7 +35,7 @@
"messageHealthAlreadyMin": "Oh no! You have already run out of health so it's too late to buy a health potion, but don't worry - you can revive!",
"armoireEquipment": "<%= image %> You found a piece of rare Equipment in the Armoire: <%= dropText %>! Awesome!",
"armoireFood": "<%= image %> You rummage in the Armoire and find <%= dropArticle %><%= dropText %>. What's that doing in here?",
"armoireFood": "<%= image %> You rummage in the Armoire and find <%= dropText %>. What's that doing in here?",
"armoireExp": "You wrestle with the Armoire and gain Experience. Take that!",
"messageInsufficientGems": "Not enough gems!",

View file

@ -81,7 +81,7 @@
"petNotOwned": "You do not own this pet.",
"mountNotOwned": "You do not own this mount.",
"earnedCompanion": "With all your productivity, you've earned a new companion. Feed it to make it grow!",
"feedPet": "Feed <%= article %><%= text %> to your <%= name %>?",
"feedPet": "Feed <%= text %> to your <%= name %>?",
"useSaddle": "Saddle <%= pet %>?",
"raisedPet": "You grew your <%= pet %>!",
"earnedSteed": "By completing your tasks, you've earned a faithful steed!",

View file

@ -91,7 +91,7 @@ export const ITEM_LIST = {
premiumHatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false },
eggs: { localeKey: 'eggSingular', isEquipment: false },
quests: { localeKey: 'quest', isEquipment: false },
food: { localeKey: 'foodText', isEquipment: false },
food: { localeKey: 'foodTextThe', isEquipment: false },
Saddle: { localeKey: 'foodSaddleText', isEquipment: false },
bundles: { localeKey: 'discountBundle', isEquipment: false },
};

View file

@ -276,8 +276,9 @@ let canDropCakeFood = false;
api.food = {
Meat: {
text: t('foodMeat'),
textA: t('foodMeatA'),
textThe: t('foodMeatThe'),
target: 'Base',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -285,8 +286,9 @@ api.food = {
},
Milk: {
text: t('foodMilk'),
textA: t('foodMilkA'),
textThe: t('foodMilkThe'),
target: 'White',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -294,8 +296,9 @@ api.food = {
},
Potatoe: {
text: t('foodPotatoe'),
textA: t('foodPotatoeA'),
textThe: t('foodPotatoeThe'),
target: 'Desert',
article: 'a ',
canBuy () {
return canBuyNormalFood;
},
@ -303,8 +306,9 @@ api.food = {
},
Strawberry: {
text: t('foodStrawberry'),
textA: t('foodStrawberryA'),
textThe: t('foodStrawberryThe'),
target: 'Red',
article: 'a ',
canBuy () {
return canBuyNormalFood;
},
@ -312,8 +316,9 @@ api.food = {
},
Chocolate: {
text: t('foodChocolate'),
textA: t('foodChocolateA'),
textThe: t('foodChocolateThe'),
target: 'Shade',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -321,8 +326,9 @@ api.food = {
},
Fish: {
text: t('foodFish'),
textA: t('foodFishA'),
textThe: t('foodFishThe'),
target: 'Skeleton',
article: 'a ',
canBuy () {
return canBuyNormalFood;
},
@ -330,8 +336,9 @@ api.food = {
},
RottenMeat: {
text: t('foodRottenMeat'),
textA: t('foodRottenMeatA'),
textThe: t('foodRottenMeatThe'),
target: 'Zombie',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -339,8 +346,9 @@ api.food = {
},
CottonCandyPink: {
text: t('foodCottonCandyPink'),
textA: t('foodCottonCandyPinkA'),
textThe: t('foodCottonCandyPinkThe'),
target: 'CottonCandyPink',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -348,8 +356,9 @@ api.food = {
},
CottonCandyBlue: {
text: t('foodCottonCandyBlue'),
textA: t('foodCottonCandyBlueA'),
textThe: t('foodCottonCandyBlueThe'),
target: 'CottonCandyBlue',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -357,8 +366,9 @@ api.food = {
},
Honey: {
text: t('foodHoney'),
textA: t('foodHoneyA'),
textThe: t('foodHoneyThe'),
target: 'Golden',
article: '',
canBuy () {
return canBuyNormalFood;
},
@ -377,7 +387,6 @@ api.food = {
Cake_Skeleton: {
text: t('foodCakeSkeleton'),
target: 'Skeleton',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -385,8 +394,9 @@ api.food = {
},
Cake_Base: {
text: t('foodCakeBase'),
textA: t('foodCakeBaseA'),
textThe: t('foodCakeBaseThe'),
target: 'Base',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -394,8 +404,9 @@ api.food = {
},
Cake_CottonCandyBlue: {
text: t('foodCakeCottonCandyBlue'),
textA: t('foodCakeCottonCandyBlueA'),
textThe: t('foodCakeCottonCandyBlueThe'),
target: 'CottonCandyBlue',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -403,8 +414,9 @@ api.food = {
},
Cake_CottonCandyPink: {
text: t('foodCakeCottonCandyPink'),
textA: t('foodCakeCottonCandyPinkA'),
textThe: t('foodCakeCottonCandyPinkThe'),
target: 'CottonCandyPink',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -412,8 +424,9 @@ api.food = {
},
Cake_Shade: {
text: t('foodCakeShade'),
textA: t('foodCakeShadeA'),
textThe: t('foodCakeShadeThe'),
target: 'Shade',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -421,8 +434,9 @@ api.food = {
},
Cake_White: {
text: t('foodCakeWhite'),
textA: t('foodCakeWhiteA'),
textThe: t('foodCakeWhiteThe'),
target: 'White',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -430,8 +444,9 @@ api.food = {
},
Cake_Golden: {
text: t('foodCakeGolden'),
textA: t('foodCakeGoldenA'),
textThe: t('foodCakeGoldenThe'),
target: 'Golden',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -439,8 +454,9 @@ api.food = {
},
Cake_Zombie: {
text: t('foodCakeZombie'),
textA: t('foodCakeZombieA'),
textThe: t('foodCakeZombieThe'),
target: 'Zombie',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -448,8 +464,9 @@ api.food = {
},
Cake_Desert: {
text: t('foodCakeDesert'),
textA: t('foodCakeDesertA'),
textThe: t('foodCakeDesertThe'),
target: 'Desert',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -457,8 +474,9 @@ api.food = {
},
Cake_Red: {
text: t('foodCakeRed'),
textA: t('foodCakeRedA'),
textThe: t('foodCakeRedThe'),
target: 'Red',
article: '',
canBuy () {
return canBuyCakeFood;
},
@ -466,8 +484,9 @@ api.food = {
},
Candy_Skeleton: {
text: t('foodCandySkeleton'),
textA: t('foodCandySkeletonA'),
textThe: t('foodCandySkeletonThe'),
target: 'Skeleton',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -475,8 +494,9 @@ api.food = {
},
Candy_Base: {
text: t('foodCandyBase'),
textA: t('foodCandyBaseA'),
textThe: t('foodCandyBaseThe'),
target: 'Base',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -484,8 +504,9 @@ api.food = {
},
Candy_CottonCandyBlue: {
text: t('foodCandyCottonCandyBlue'),
textA: t('foodCandyCottonCandyBlueA'),
textThe: t('foodCandyCottonCandyBlueThe'),
target: 'CottonCandyBlue',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -493,8 +514,9 @@ api.food = {
},
Candy_CottonCandyPink: {
text: t('foodCandyCottonCandyPink'),
textA: t('foodCandyCottonCandyPinkA'),
textThe: t('foodCandyCottonCandyPinkThe'),
target: 'CottonCandyPink',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -502,8 +524,9 @@ api.food = {
},
Candy_Shade: {
text: t('foodCandyShade'),
textA: t('foodCandyShadeA'),
textThe: t('foodCandyShadeThe'),
target: 'Shade',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -511,8 +534,9 @@ api.food = {
},
Candy_White: {
text: t('foodCandyWhite'),
textA: t('foodCandyWhiteA'),
textThe: t('foodCandyWhiteThe'),
target: 'White',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -520,8 +544,9 @@ api.food = {
},
Candy_Golden: {
text: t('foodCandyGolden'),
textA: t('foodCandyGoldenA'),
textThe: t('foodCandyGoldenThe'),
target: 'Golden',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -529,8 +554,9 @@ api.food = {
},
Candy_Zombie: {
text: t('foodCandyZombie'),
textA: t('foodCandyZombieA'),
textThe: t('foodCandyZombieThe'),
target: 'Zombie',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -538,8 +564,9 @@ api.food = {
},
Candy_Desert: {
text: t('foodCandyDesert'),
textA: t('foodCandyDesertA'),
textThe: t('foodCandyDesertThe'),
target: 'Desert',
article: '',
canBuy () {
return canBuyCandyFood;
},
@ -547,8 +574,9 @@ api.food = {
},
Candy_Red: {
text: t('foodCandyRed'),
textA: t('foodCandyRedA'),
textThe: t('foodCandyRedThe'),
target: 'Red',
article: '',
canBuy () {
return canBuyCandyFood;
},

View file

@ -77,8 +77,7 @@ module.exports = function randomDrop (user, options, req = {}, analytics) {
user.items.food[drop.key] += 1;
drop.type = 'Food';
drop.dialog = i18n.t('messageDropFood', {
dropArticle: drop.article,
dropText: drop.text(req.language),
dropText: drop.textA(req.language),
dropNotes: drop.notes(req.language),
}, req.language);
} else if (rarity > 0.3) { // eggs 30% chance

View file

@ -74,14 +74,12 @@ module.exports = function buyArmoire (user, req = {}, analytics) {
message = i18n.t('armoireFood', {
image: `<span class="Pet_Food_${drop.key} pull-left"></span>`,
dropArticle: drop.article,
dropText: drop.text(req.language),
}, req.language);
armoireResp = {
type: 'food',
dropKey: drop.key,
dropArticle: drop.article,
dropText: drop.text(req.language),
dropText: drop.textA(req.language),
};
} else {
let armoireExp = Math.floor(randomVal.trueRandom() * 40 + 10);

View file

@ -62,7 +62,7 @@ module.exports = function feed (user, req = {}) {
} else {
let messageParams = {
egg: pet.text(req.language),
foodText: food.text(req.language),
foodText: food.textThe(req.language),
};
if (food.target === pet.potion || pet.type === 'premium') {

View file

@ -531,7 +531,7 @@ api.updateTask = {
* {"success":true,"data":{"delta":0.9746999906450404,"_tmp":{},"hp":49.06645205596985,"mp":37.2008917491047,"exp":101.93810026267543,"gp":77.09694176716997,"lvl":19,"class":"rogue","points":0,"str":5,"con":3,"int":3,"per":8,"buffs":{"str":9,"int":9,"per":9,"con":9,"stealth":0,"streaks":false,"snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},"training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
*
* @apiSuccessExample {json} Example result with item drop:
* {"success":true,"data":{"delta":1.0259567046270648,"_tmp":{"quest":{"progressDelta":1.2362778290756147,"collection":1},"drop":{"target":"Zombie","article":"","canDrop":true,"value":1,"key":"RottenMeat","type":"Food","dialog":"You've found Rotten Meat! Feed this to a pet and it may grow into a sturdy steed."}},"hp":50,"mp":66.2390716654227,"exp":143.93810026267545,"gp":135.12889840462591,"lvl":20,"class":"rogue","points":0,"str":6,"con":3,"int":3,"per":8,"buffs":{"str":10,"int":10,"per":10,"con":10,"stealth":0,"streaks":false,"snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},"training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
* {"success":true,"data":{"delta":1.0259567046270648,"_tmp":{"quest":{"progressDelta":1.2362778290756147,"collection":1},"drop":{"target":"Zombie","canDrop":true,"value":1,"key":"RottenMeat","type":"Food","dialog":"You've found Rotten Meat! Feed this to a pet and it may grow into a sturdy steed."}},"hp":50,"mp":66.2390716654227,"exp":143.93810026267545,"gp":135.12889840462591,"lvl":20,"class":"rogue","points":0,"str":6,"con":3,"int":3,"per":8,"buffs":{"str":10,"int":10,"per":10,"con":10,"stealth":0,"streaks":false,"snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},"training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
*
* @apiUse TaskNotFound
*/