misc fixes - sep 17 (#9045)

* not locking pre-owned gear - pin removed gear on revive

* fix createAnimal (check for function) - hide pet-popover while dragging food

* fix dragging popover text color

* fix drop toasts

* selectMembersModal: load members on item change
This commit is contained in:
negue
2017-09-19 22:45:28 +02:00
committed by GitHub
parent b1652ddd97
commit 2cb9228a7c
9 changed files with 68 additions and 29 deletions

View File

@@ -171,6 +171,10 @@
position: inherit; position: inherit;
width: 180px; width: 180px;
} }
.popover-content {
color: white;
}
} }
</style> </style>

View File

@@ -99,7 +99,7 @@
:popoverPosition="'top'", :popoverPosition="'top'",
:progress="context.item.progress", :progress="context.item.progress",
:emptyItem="!context.item.isOwned()", :emptyItem="!context.item.isOwned()",
:showPopover="true", :showPopover="currentDraggingFood == null",
:highlightBorder="highlightPet == context.item.key", :highlightBorder="highlightPet == context.item.key",
@click="petClicked(context.item)" @click="petClicked(context.item)"
) )
@@ -453,6 +453,10 @@
position: inherit; position: inherit;
width: 100px; width: 100px;
} }
.popover-content {
color: white;
}
} }
.hatchablePopover { .hatchablePopover {
@@ -909,11 +913,13 @@
}, },
petClicked (pet) { petClicked (pet) {
if (this.currentDraggingFood !== null && pet.isAllowedToFeed()) { if (this.currentDraggingFood !== null) {
// food process if (pet.isAllowedToFeed()) {
this.feedAction(pet.key, this.currentDraggingFood.key); // food process
this.currentDraggingFood = null; this.feedAction(pet.key, this.currentDraggingFood.key);
this.foodClickMode = false; this.currentDraggingFood = null;
this.foodClickMode = false;
}
} else { } else {
if (pet.isOwned()) { if (pet.isOwned()) {
this.selectPet(pet); this.selectPet(pet);

View File

@@ -11,9 +11,8 @@ div
span.item-label(v-if="label") {{ label }} span.item-label(v-if="label") {{ label }}
b-popover( b-popover(
v-if="showPopover",
:target="itemId", :target="itemId",
triggers="hover", :triggers="showPopover ? 'hover' : ''",
:placement="popoverPosition", :placement="popoverPosition",
) )
slot(name="popoverContent", :item="item") slot(name="popoverContent", :item="item")

View File

@@ -161,7 +161,7 @@ export default {
}, },
}, },
watch: { watch: {
groupId () { item () {
this.getMembers(); this.getMembers();
}, },
}, },

View File

@@ -459,7 +459,8 @@ export default {
} }
if (drop) { if (drop) {
let text; let dropText;
let dropNotes;
let type; let type;
this.$root.$emit('playSound', 'Item_Drop'); this.$root.$emit('playSound', 'Item_Drop');
@@ -483,14 +484,17 @@ export default {
} }
if (drop.type === 'HatchingPotion') { if (drop.type === 'HatchingPotion') {
text = Content.hatchingPotions[drop.key].text(); dropText = Content.hatchingPotions[drop.key].text();
this.drop(this.$t('messageDropPotion', {dropText: text}), drop); dropNotes = Content.hatchingPotions[drop.key].notes();
this.drop(this.$t('messageDropPotion', {dropText, dropNotes}), drop);
} else if (drop.type === 'Egg') { } else if (drop.type === 'Egg') {
text = Content.eggs[drop.key].text(); dropText = Content.eggs[drop.key].text();
this.drop(this.$t('messageDropEgg', {dropText: text}), drop); dropNotes = Content.eggs[drop.key].notes();
this.drop(this.$t('messageDropEgg', {dropText, dropNotes}), drop);
} else if (drop.type === 'Food') { } else if (drop.type === 'Food') {
text = Content.food[drop.key].text(); dropText = Content.food[drop.key].text();
this.drop(this.$t('messageDropFood', {dropArticle: drop.article, dropText: text}), drop); dropNotes = Content.food[drop.key].notes();
this.drop(this.$t('messageDropFood', {dropArticle: drop.article, dropText, dropNotes}), drop);
} else if (drop.type === 'Quest') { } else if (drop.type === 'Quest') {
// TODO $rootScope.selectedQuest = Content.quests[drop.key]; // TODO $rootScope.selectedQuest = Content.quests[drop.key];
// $rootScope.openModal('questDrop', {controller:'PartyCtrl', size:'sm'}); // $rootScope.openModal('questDrop', {controller:'PartyCtrl', size:'sm'});

View File

@@ -1,3 +1,13 @@
function getText (textOrFunction) {
if (textOrFunction instanceof Function) {
return textOrFunction();
} else {
return textOrFunction;
}
}
export default function createAnimal (egg, potion, type, content, userItems) { export default function createAnimal (egg, potion, type, content, userItems) {
let animalKey = `${egg.key}-${potion.key}`; let animalKey = `${egg.key}-${potion.key}`;
@@ -5,9 +15,9 @@ export default function createAnimal (egg, potion, type, content, userItems) {
key: animalKey, key: animalKey,
class: type === 'pet' ? `Pet Pet-${animalKey}` : `Mount_Icon_${animalKey}`, class: type === 'pet' ? `Pet Pet-${animalKey}` : `Mount_Icon_${animalKey}`,
eggKey: egg.key, eggKey: egg.key,
eggName: egg.text, eggName: getText(egg.text),
potionKey: potion.key, potionKey: potion.key,
potionName: potion.text, potionName: getText(potion.text),
name: content[`${type}Info`][animalKey].text(), name: content[`${type}Info`][animalKey].text(),
isOwned () { isOwned () {
return userItems[`${type}s`][animalKey] > 0; return userItems[`${type}s`][animalKey] > 0;

View File

@@ -102,6 +102,13 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
if (gear.canOwn) { if (gear.canOwn) {
gear.locked = !gear.canOwn(user); gear.locked = !gear.canOwn(user);
} }
let itemOwned = user.items.gear.owned[gear.key];
if (itemOwned === false) {
gear.locked = false;
}
} }
}; };

View File

@@ -10,6 +10,19 @@ const officialPinnedItems = content.officialPinnedItems;
import updateStore from '../libs/updateStore'; import updateStore from '../libs/updateStore';
function addPinnedGear (user, type, path) {
const foundIndex = user.pinnedItems.findIndex(pinnedItem => {
return pinnedItem.path === path;
});
if (foundIndex === -1) {
user.pinnedItems.push({
type,
path,
});
}
}
function addPinnedGearByClass (user) { function addPinnedGearByClass (user) {
if (user.flags.classSelected) { if (user.flags.classSelected) {
let newPinnedItems = updateStore(user); let newPinnedItems = updateStore(user);
@@ -17,16 +30,7 @@ function addPinnedGearByClass (user) {
for (let item of newPinnedItems) { for (let item of newPinnedItems) {
let itemInfo = getItemInfo(user, 'marketGear', item); let itemInfo = getItemInfo(user, 'marketGear', item);
const foundIndex = user.pinnedItems.findIndex(pinnedItem => { addPinnedGear(user, itemInfo.pinType, itemInfo.path);
return pinnedItem.path === itemInfo.path;
});
if (foundIndex === -1) {
user.pinnedItems.push({
type: 'marketGear',
path: itemInfo.path,
});
}
} }
} }
} }
@@ -124,6 +128,7 @@ function togglePinnedItem (user, {item, type, path}, req = {}) {
module.exports = { module.exports = {
addPinnedGearByClass, addPinnedGearByClass,
addPinnedGear,
removePinnedGearByClass, removePinnedGearByClass,
removePinnedGearAddPossibleNewOnes, removePinnedGearAddPossibleNewOnes,
togglePinnedItem, togglePinnedItem,

View File

@@ -9,7 +9,8 @@ import {
import randomVal from '../libs/randomVal'; import randomVal from '../libs/randomVal';
import predictableRandom from '../fns/predictableRandom'; import predictableRandom from '../fns/predictableRandom';
import { removePinnedGearByClass, addPinnedGearByClass } from './pinnedGearUtils'; import { removePinnedGearByClass, addPinnedGearByClass, addPinnedGear } from './pinnedGearUtils';
import getItemInfo from '../libs/getItemInfo';
module.exports = function revive (user, req = {}, analytics) { module.exports = function revive (user, req = {}, analytics) {
if (user.stats.hp > 0) { if (user.stats.hp > 0) {
@@ -89,6 +90,9 @@ module.exports = function revive (user, req = {}, analytics) {
addPinnedGearByClass(user); addPinnedGearByClass(user);
let itemInfo = getItemInfo(user, 'marketGear', item);
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
if (user.items.gear.equipped[item.type] === lostItem) { if (user.items.gear.equipped[item.type] === lostItem) {
user.items.gear.equipped[item.type] = `${item.type}_base_0`; user.items.gear.equipped[item.type] = `${item.type}_base_0`;
} }