feat(quests): Improve buy confirm dialog

This commit is contained in:
Sabe Jones
2015-07-16 12:56:26 -05:00
parent 668a8bb6f6
commit 2407c9eeb8
2 changed files with 13 additions and 5 deletions

View File

@@ -44,12 +44,14 @@
"scrollsText1": "Quests require parties. If you want to quest solo,", "scrollsText1": "Quests require parties. If you want to quest solo,",
"scrollsText2": "create an empty party", "scrollsText2": "create an empty party",
"scrollsPre": "You haven't unlocked this quest yet!", "scrollsPre": "You haven't unlocked this quest yet!",
"alreadyEarnedQuestLevel": "You already earned this quest by attaining Level <%= level %>. ",
"alreadyEarnedQuestReward": "You already earned this quest by completing <%= priorQuest %>. ",
"completedQuests": "Completed the following quests", "completedQuests": "Completed the following quests",
"mustComplete": "You must first complete <%= quest %>.", "mustComplete": "You must first complete <%= quest %>.",
"mustLevel": "You must be level <%= level %>.", "mustLevel": "You must be level <%= level %> to begin this quest.",
"mustLvlQuest": "You must be level <%= level %> to buy this quest!", "mustLvlQuest": "You must be level <%= level %> to buy this quest!",
"mustInviteFriend": "To earn this Quest, invite a friend to your Party. Invite someone now?", "mustInviteFriend": "To earn this quest, invite a friend to your Party. Invite someone now?",
"unlockByQuesting": "To earn this Quest, complete <%= title %>.", "unlockByQuesting": "To earn this quest, complete <%= title %>.",
"sureCancel": "Are you sure you want to cancel this quest? All invitation acceptances will be lost. The quest owner will retain possession of the quest scroll.", "sureCancel": "Are you sure you want to cancel this quest? All invitation acceptances will be lost. The quest owner will retain possession of the quest scroll.",
"sureAbort": "Are you sure you want to abort this mission? It will abort it for everyone in your party and all progress will be lost. The quest scroll will be returned to the quest owner.", "sureAbort": "Are you sure you want to abort this mission? It will abort it for everyone in your party and all progress will be lost. The quest scroll will be returned to the quest owner.",
"doubleSureAbort": "Are you double sure? Make sure they won't hate you forever!", "doubleSureAbort": "Are you double sure? Make sure they won't hate you forever!",

View File

@@ -226,6 +226,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
var gems = user.balance * 4; var gems = user.balance * 4;
var price = item.value; var price = item.value;
var message;
var itemName = window.env.t(Content.itemList[type].localeKey) var itemName = window.env.t(Content.itemList[type].localeKey)
@@ -240,10 +241,15 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
if (gems < price) return $rootScope.openModal('buyGems'); if (gems < price) return $rootScope.openModal('buyGems');
var message = window.env.t('buyThis', {text: itemName, price: price, gems: gems}); if (type === 'quests') {
if (item.previous) {message = window.env.t('alreadyEarnedQuestReward', {priorQuest: Content.quests[item.previous].text()})}
else if (item.lvl) {message = window.env.t('alreadyEarnedQuestLevel', {level: item.lvl})}
} else message = "";
message += window.env.t('buyThis', {text: itemName, price: price, gems: gems});
if ($window.confirm(message)) if ($window.confirm(message))
user.ops.purchase({params:{type:type,key:item.key}}); user.ops.purchase({params:{type:type,key:item.key}});
} };
function _canBuyEquipment(itemKey) { function _canBuyEquipment(itemKey) {
if (user.items.gear.owned[itemKey]) { if (user.items.gear.owned[itemKey]) {