Skip to content
Merged

Deploy #1737

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

<style lang="scss">
span {
--scale: 0.9;

padding-left: 0;
text-align: right;
width: 5rem;

:global(a + a) {
margin-left: -0.5rem;
margin-left: -0.2rem;
}
}
</style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { RewardType } from '@/enums/reward-type';
import { rewardTypeIcons } from '@/shared/icons/mappings';
import { wowthingData } from '@/shared/stores/data';
import { userState } from '@/user-home/state/user';
import type { Character } from '@/types';
import type {
ManualDataReputationReputation,
Expand All @@ -12,60 +13,68 @@

import IconifyWrapper from '@/shared/components/images/IconifyWrapper.svelte';
import WowthingImage from '@/shared/components/images/sources/WowthingImage.svelte';
import { userState } from '@/user-home/state/user';

export let faction: Faction = Faction.Neutral;
export let reputation: ManualDataReputationReputation;
export let set: ManualDataReputationSet;

let rewards: {
id: number;
name: string;
type: RewardType;
have: boolean;
}[];
let totalParagon = 0;
$: {
rewards = [];
if (set.paragon) {
totalParagon = userState.general.activeCharacters.reduce(
(a: number, b: Character) => a + (b.paragons?.[reputation.id]?.received ?? 0),
0
);
type Props = {
reputation: ManualDataReputationReputation;
set: ManualDataReputationSet;
faction?: Faction;
};
let { reputation, set, faction = Faction.Neutral }: Props = $props();

if (reputation.rewards) {
for (const reward of reputation.rewards) {
let have = false;
let name: string;
if (reward.type === RewardType.Mount) {
have = userState.general.hasMountById.has(reward.id);
const mount = wowthingData.static.mountById.get(reward.id);
name = mount ? mount.name : `Mount #${reward.id}`;
} else if (reward.type === RewardType.Pet) {
have = userState.general.hasPetById.has(reward.id);
const pet = wowthingData.static.petById.get(reward.id);
name = pet ? pet.name : `Pet #${reward.id}`;
} else if (reward.type === RewardType.Toy) {
have = userState.general.hasToyById.has(reward.id);
const toy = wowthingData.static.toyById.get(reward.id);
name = toy ? toy.name : `Toy #${reward.id}`;
} else if (reward.type === RewardType.Transmog) {
const item = wowthingData.items.items[reward.id];
have = userState.general.hasAppearanceById.has(
item?.appearances[0]?.appearanceId || 0
);
name = item?.name || `Item #${reward.id}`;
}
let totalParagon = $derived(
!set.paragon
? 0
: userState.general.activeCharacters.reduce(
(a: number, b: Character) => a + (b.paragons?.[reputation.id]?.received ?? 0),
0
)
);
let rewards = $derived.by(() => {
const ret: {
id: number;
name: string;
type: RewardType;
have: boolean;
}[] = [];

rewards.push({
...reward,
have,
name,
});
if (set.paragon && reputation.rewards) {
for (const reward of reputation.rewards) {
let have = false;
let name: string;
if (reward.type === RewardType.Mount) {
have = userState.general.hasMountById.has(reward.id);
const mount = wowthingData.static.mountById.get(reward.id);
name = mount ? mount.name : `Mount #${reward.id}`;
} else if (reward.type === RewardType.Pet) {
have = userState.general.hasPetById.has(reward.id);
const pet = wowthingData.static.petById.get(reward.id);
name = pet ? pet.name : `Pet #${reward.id}`;
} else if (reward.type === RewardType.Toy) {
have =
userState.general.hasToyById.has(reward.id) ||
userState.general.hasToyByItemId.has(reward.id);
const toy =
wowthingData.static.toyById.get(reward.id) ||
wowthingData.static.toyByItemId.get(reward.id);
name = toy ? toy.name : `Toy #${reward.id}`;
} else if (reward.type === RewardType.Transmog) {
const item = wowthingData.items.items[reward.id];
have = userState.general.hasAppearanceById.has(
item?.appearances[0]?.appearanceId || 0
);
name = item?.name || `Item #${reward.id}`;
}

ret.push({
...reward,
have,
name,
});
}
}
}

return ret;
});
</script>

<style lang="scss">
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/enums/progress-data-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export enum ProgressDataType {
AccountQuest,
Item,
SpellKnown,
QuestLine,
Quests,
}
8 changes: 5 additions & 3 deletions apps/frontend/scss/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@
--color-class-12: #a330c9; // Demon Hunter
--color-class-13: #33937f; // Evoker

// svelte-multiselect
// svelte-multiselect - vars got real weird after updating
--sms-li-active-bg: #003048;
--sms-options-bg: #0a0b0c;
--sms-options-border: 1px solid #8b8d8f;
--sms-bg: #0a0b0c;
--sms-options-bg: var(--sms-bg);
--sms-border: 1px solid #8b8d8f;
--sms-options-border: var(--sms-border);
--sms-placeholder-color: #bbb;
--sms-selected-li-padding: 0 0.2rem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
</script>

<style lang="scss">
.collecting {
// dropdowns need to appear outside of this container
overflow: visible;
}
table {
--image-border-width: 1px;
--image-margin-top: -4px;
Expand All @@ -65,16 +69,28 @@
.character {
--width: 20rem;

padding: 0.25m 0.3rem 0.25rem 0;

:global(ul.selected) {
flex-wrap: none;
flex-direction: column;
padding: 0.25rem 0;
}
:global(ul.selected > li) {
margin-top: 1px;
padding: 0 0 0 0.3rem;
width: 15.5rem;
}
:global(ul.selected > input) {
border-color: var(--border-color);
border-radius: var(--border-radius);
margin: 0 2pt;
padding: 0 0 0 0.3rem;
width: 15.5rem;
}
}
</style>

<div class="settings-block">
<div class="settings-block collecting">
<h3>Collecting</h3>
<p>
Which specific characters to use when checking if a recipe has been collected. Any secondary
Expand Down
40 changes: 38 additions & 2 deletions apps/frontend/utils/get-progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ProgressDataType } from '@/enums/progress-data-type';
import { QuestStatus } from '@/enums/quest-status';
import { wowthingData } from '@/shared/stores/data';
import { userState } from '@/user-home/state/user';
import { toNiceNumber } from '@/utils/formatting';
import { leftPad, toNiceNumber } from '@/utils/formatting';
import type {
Character,
CharacterShadowlandsCovenant,
Expand All @@ -25,7 +25,7 @@ export default function getProgress(
group: ManualDataProgressGroup,
countAccountWide = true
): ProgressInfo {
let have: number;
let have: number = 0;
let missingRequired = false;
let showCurrency = 0;
let total = 0;
Expand Down Expand Up @@ -298,6 +298,42 @@ export default function getProgress(
break;
}

case ProgressDataType.Quests: {
const haveQuests = data.ids.map((questId) =>
checkCharacterQuestIds(character.id, [questId])
);
const haveCount = haveQuests.filter((have) => have).length;
const questName =
wowthingData.static.questNameById.get(data.ids[0]) ||
data.name ||
`Quest #${data.ids[0]}`;

haveThis = haveQuests.at(-1);
nameOverride[dataIndex] =
`[${leftPad(haveCount, 2, '0')}/${leftPad(haveQuests.length, 2, '0')}] ${questName}`;

break;
}

case ProgressDataType.QuestLine: {
const questLine = wowthingData.static.questLineById.get(data.ids[0]);
if (!questLine) {
console.warn('bad questLine?', data.ids);
break;
}

const haveQuests = questLine.questIds.map((questId) =>
checkCharacterQuestIds(character.id, [questId])
);
const haveCount = haveQuests.filter((have) => have).length;

haveThis = haveQuests.at(-1);
nameOverride[dataIndex] =
`[${leftPad(haveCount, 2, '0')}/${leftPad(haveQuests.length, 2, '0')}] ${questLine.name}`;

break;
}

case ProgressDataType.AccountQuest: {
haveThis = checkAccountQuestIds(data.ids);
nameOverride[dataIndex] =
Expand Down
2 changes: 2 additions & 0 deletions packages/csharp-lib/Enums/Progress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public enum ProgressDataType
AccountQuest,
Item,
SpellKnown,
QuestLine,
Quests,
}
Loading