Fixing Exponential Quest Reward Scrolls (#7800)

* adding quest owner specific rewards. closes #2715

* Updating model to prevent this from being a breaking change.

* Removing duplicate translatable string and readding accidentally deleted portion

* capitalizing according to pr.

* fixing according to comments on pr

* removing final mistakes

* fixing whitespace

* re-adding the onlyOwner field that got deleted when the index.js file was moved and fixed console errors.

* moving cleaning of empty obejct for quest owner updates into quest owner updates method

* Fixing so tests pass by updating variable name and removing unnecessary parameter definition.

* adding a new test and refactoring client side code to use controller method.
This commit is contained in:
Travis
2016-12-28 01:38:52 -06:00
committed by Keith Holliday
parent 7d99873960
commit bf5ad2db1f
9 changed files with 123 additions and 49 deletions

View File

@@ -83,17 +83,26 @@ angular.module('habitrpg')
}
}
text += '---\n\n';
text += '**' + window.env.t('rewards') + ':**\n\n';
if(quest.drop.items) {
for (var item in quest.drop.items) {
text += quest.drop.items[item].text() + '\n\n';
}
text += '**' + window.env.t('rewardsAllParticipants') + ':**\n\n';
var participantRewards = _.reject(quest.drop.items, 'onlyOwner');
if(participantRewards.length > 0) {
_.each(participantRewards, function(item) {
text += item.text() + '\n\n';
});
}
if(quest.drop.exp)
text += quest.drop.exp + ' ' + window.env.t('experience') + '\n\n';
if(quest.drop.gp)
text += quest.drop.gp + ' ' + window.env.t('gold') + '\n\n';
var ownerRewards = _.filter(quest.drop.items, 'onlyOwner');
if(ownerRewards.length > 0) {
text += '**' + window.env.t('rewardsQuestOwner') + ':**\n\n';
_.each(ownerRewards, function(item){
text += item.text() + '\n\n';
});
}
return text;
}
@@ -140,7 +149,7 @@ angular.module('habitrpg')
var quest = response.data.quest;
if (!quest) quest = response.data.data;
resolve(quest);
});;
});
});
}