Skip to content
Merged

Deploy #1811

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
4 changes: 4 additions & 0 deletions apps/frontend/components/auctions/AuctionsSidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
name: 'Commodities',
slug: 'commodities',
},
{
name: 'Recipes',
slug: 'recipes',
},
{
name: 'Extra Pets',
slug: 'extra-pets',
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/components/auctions/AuctionsView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import Missing from './AuctionsMissing.svelte';
import MissingBigResults from './AuctionsMissingBigResults.svelte';
import RadioGroup from '@/shared/components/forms/RadioGroup.svelte';
import Recipes from './recipes/Recipes.svelte';
import Select from '@/shared/components/forms/Select.svelte';
import SpecificItem from './AuctionsSpecificItem.svelte';
import TextInput from '@/shared/components/forms/TextInput.svelte';
Expand Down Expand Up @@ -87,6 +88,7 @@
'missing-recipes': MissingBigResults,
'sell-commodities': Commodities,
'sell-extra-pets': ExtraPets,
'sell-recipes': Recipes,
'specific-item': SpecificItem,
};

Expand Down
3 changes: 1 addition & 2 deletions apps/frontend/components/auctions/commodities/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export class CommodityAuctionsStore {
private static url = '/api/auctions/commodities';
private cache: CommodityData = null;

async fetch() // auctionState: AuctionState
: Promise<CommodityData> {
async fetch(): Promise<CommodityData> {
let ret: CommodityData;

if (this.cache !== null) {
Expand Down
39 changes: 39 additions & 0 deletions apps/frontend/components/auctions/recipes/Item.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script lang="ts">
import connectedRealmName from '@/utils/connected-realm-name';
import type { UserAuctionDataAuction } from '@/types/data';
import type { HasNameAndRealm, UserItem } from '@/types/shared';
import ParsedText from '@/shared/components/parsed-text/ParsedText.svelte';
import ItemLink from '@/shared/components/links/ItemLink.svelte';

type Props = {
auctions: UserAuctionDataAuction[];
haveItems: [HasNameAndRealm, UserItem[]][];
itemId: number;
};
let { auctions, haveItems, itemId }: Props = $props();

let totalCount = haveItems.reduce((acc, b) => acc + b[1].length, 0);
</script>

<table class="table table-striped">
<thead>
<tr>
<th colspan="2">
<ItemLink id={itemId}>
<ParsedText text={`{item:${itemId}}`} />
</ItemLink>
</th>
<th>
{totalCount}
</th>
</tr>
</thead>
<tbody>
{#each auctions as auction}
<tr>
<td>{connectedRealmName(auction.connectedRealmId)}</td>
<td>{Math.floor(auction.buyoutPrice / 10_000).toLocaleString()} g</td>
</tr>
{/each}
</tbody>
</table>
42 changes: 42 additions & 0 deletions apps/frontend/components/auctions/recipes/Recipes.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script lang="ts">
import sortBy from 'lodash/sortBy';

import { Region } from '@/enums/region';
import { userState } from '@/user-home/state/user';
import { getNumberKeyedEntries } from '@/utils/get-number-keyed-entries';
import type { UserAuctionDataAuction } from '@/types/data';
import type { HasNameAndRealm, UserItem } from '@/types/shared';

import { recipesAuctionStore, type RecipesData } from './store';
import Item from './Item.svelte';

type ProcessedAuctions = [number, UserAuctionDataAuction[], [HasNameAndRealm, UserItem[]][]][];
function processAuctions(auctions: RecipesData): ProcessedAuctions {
const ret: ProcessedAuctions = [];
const regionId = userState.general.allRegions[0] || Region.US;

for (const [itemId, itemAuctions] of getNumberKeyedEntries(auctions[regionId])) {
// NOTE: this assumes that recipe items aren't soulbound if they can be listed on the AH
const haveItems = userState.general.itemsById[itemId] || [];
if (haveItems.length === 0) {
continue;
}

ret.push([itemId, itemAuctions, haveItems]);
}

ret.sort((a, b) => b[1][0].buyoutPrice - a[1][0].buyoutPrice);
console.log(ret);

return ret;
}
</script>

{#await recipesAuctionStore.fetch()}
MOO
{:then auctions}
{@const haveData = processAuctions(auctions)}
{#each haveData as [itemId, auctions, haveItems]}
<Item {auctions} {haveItems} {itemId} />
{/each}
{/await}
58 changes: 58 additions & 0 deletions apps/frontend/components/auctions/recipes/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
UserAuctionDataAuction,
type UserAuctionDataAuctionArray,
} from '@/types/data/user-auctions';
import { getNumberKeyedEntries } from '@/utils/get-number-keyed-entries';

export type RecipesData = Record<number, Record<number, UserAuctionDataAuction[]>>;
type RecipesResponse = Record<
number,
{
rawAuctions: Record<number, UserAuctionDataAuctionArray[]>;
}
>;

export class RecipesAuctionsStore {
private static url = '/api/auctions/recipes';
private cache: RecipesData = null;

async fetch(): Promise<RecipesData> {
let ret: RecipesData;

if (this.cache !== null) {
ret = this.cache;
} else {
const xsrf = document.getElementById('app').getAttribute('data-xsrf');

const response = await fetch(RecipesAuctionsStore.url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
RequestVerificationToken: xsrf,
},
});

ret = {};
if (response.ok) {
const responseData = (await response.json()) as RecipesResponse;

for (const [region, itemAuctions] of getNumberKeyedEntries(responseData)) {
ret[region] = {};

for (const [itemId, rawAuctions] of getNumberKeyedEntries(
itemAuctions.rawAuctions
)) {
ret[region][itemId] = rawAuctions.map(
(auctionArray) => new UserAuctionDataAuction(...auctionArray)
);
}
}
}

this.cache = ret;
}

return ret;
}
}
export const recipesAuctionStore = new RecipesAuctionsStore();
42 changes: 40 additions & 2 deletions apps/frontend/data/achievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,29 @@ export const extraCategories: ExtraAchievementCategory[] = [
41597, // Glory of the Omega Raider
],
},
{
targetSlug: 'player-vs-player/world',
nameType: 1,
onlyAchievementIds: true,
achievementIds: [
40087, // Unbound Battle
40097, // Ruffious's Bid
40088, // A Champion's Tour: The War Within
40086, // Tour of Duty: Azj-Kahet
40085, // Tour of Duty: Hallowfall
40084, // Tour of Duty: The Ringing Deeps
40083, // Tour of Duty: Isle of Dorn
40089, // Spoiled Goods 1
40090, // Spoiled Goods 2
40091, // Slightly Spoiled
41522, // Tour of Duty: Undermine
42131, // Tour of Duty: K'aresh
40468, // Unbound Glory 1
40466, // Unbound Glory 2
40467, // Unbound Glory 3
40465, // Unbound Bounty
],
},
null,
{
targetSlug: 'expansion-features/skyriding',
Expand Down Expand Up @@ -483,14 +506,28 @@ export const extraCategories: ExtraAchievementCategory[] = [
{
targetSlug: 'delves/midnight',
nameType: 1,
achievementIds: [],
achievementIds: [
63718, // Lock and Key
63719, // Lock and Key Master
63720, // Happy Hexmask Collector
63721, // The Labyrinth of Kindo'jan
63722, // Whose Labyrinth?
63723, // My Labyrinth
63724, // Knock Knock
63717, // Kindo'jan's Labyrinth Discoveries
63727, // Treasures Upon Treasures
63728, // A Few More Can't Hurt
],
},
{
targetSlug: 'dungeons-raids/midnight-dungeon',
nameType: 3,
overrideName: 'Dungeons',
overrideSlug: 'dungeons',
achievementIds: [61567, 61568],
achievementIds: [
61567, // Midnight Dungeon Hero
61568, // Glory of the Midnight Hero
],
},
{
targetSlug: 'dungeons-raids/midnight-raid',
Expand All @@ -499,6 +536,7 @@ export const extraCategories: ExtraAchievementCategory[] = [
overrideSlug: 'raids',
achievementIds: [
61380, // Glory of the Midnight Raider
63254, // Glory of the Venomous Raider
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/data/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export const currencyExtra: Record<number, number[]> = {
3028, // Restored Coffer Key
2803, // Undercoin
3356, // Untainted Mana-Crystals
3513, // Nebulous Voidcore (new?)
3418, // Nebulous Voidcore
null,
3442, // Adventurer Mistcrest
3443, // Veteran Mistcrest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
reputationSetsIndex,
slug,
})}
{@const repId =
reputationSet.both?.id || reputationSet.alliance?.id || reputationSet.horde?.id}
{@const repIcon =
reputationSet.both?.icon ||
reputationSet.alliance?.icon ||
reputationSet.horde?.icon}
<div
class="account-rep {cls} flex-wrapper"
use:componentTooltip={{
Expand All @@ -100,8 +106,8 @@
}}
>
<div class="icon">
<WowheadLink type="faction" id={reputationSet.both.id}>
<WowthingImage name={reputationSet.both.icon} size={48} border={2} />
<WowheadLink type="faction" id={repId}>
<WowthingImage name={repIcon} size={48} border={2} />
</WowheadLink>
</div>
<div class="data">
Expand Down
5 changes: 1 addition & 4 deletions apps/tool/Data/IgnoredJournalItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ public static partial class Hardcoded
{
public static readonly HashSet<int> IgnoredJournalItems = new()
{
// Things screwed up by Duos
37686, // Cracked Epoch Grasps (CoS)
37687, // Gloves of Distorted Time (CoS)

56376, // Thundercall (now 133251)
120163, // Thruk's Fishing Rod
178708, // Unbound Changeling??
};
}

7 changes: 7 additions & 0 deletions apps/tool/Enums/InstanceContentAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Wowthing.Tool.Enums;

public enum InstanceContentAction
{
Add = 0,
Remove = 1,
}
7 changes: 5 additions & 2 deletions apps/tool/Models/Instances/DataInstanceContent.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace Wowthing.Tool.Models.Instances;
using Wowthing.Tool.Enums;

namespace Wowthing.Tool.Models.Instances;

public class DataInstanceContent
{
public int ItemId { get; set; }
public string Difficulties { get; set; }
public InstanceContentAction Action { get; set; }
public string? Difficulties { get; set; }
}
42 changes: 25 additions & 17 deletions apps/tool/Tools/JournalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using Serilog.Context;
using Wowthing.Lib.Models.Wow;
using Wowthing.Tool.Enums;
using Wowthing.Tool.Models;
using Wowthing.Tool.Models.Instances;
using Wowthing.Tool.Models.Items;
Expand Down Expand Up @@ -661,24 +662,31 @@ await context.WowPet
{
foreach (var dataContent in dataInstanceEncounter.Contents.EmptyIfNull())
{
var dropDifficultiesString = string.IsNullOrEmpty(dataContent.Difficulties)
? dataInstance.Difficulties
: dataContent.Difficulties;
var parts = dropDifficultiesString.Split('_');
int[] dropDifficulties = parts.Skip(1)
.Select(part => _dataInstanceDifficulties[parts[0]][part])
.ToArray();
difficultiesByEncounterItemId[1_000_000 + dataContent.ItemId] = dropDifficulties;

encounterItems.Add(new DumpJournalEncounterItem
if (dataContent.Action == InstanceContentAction.Add)
{
ID = 1000000 + dataContent.ItemId,
DifficultyMask = 0,
FactionMask = 0,
Flags = 0,
ItemID = dataContent.ItemId,
JournalEncounterID = encounter.ID,
});
var dropDifficultiesString = string.IsNullOrEmpty(dataContent.Difficulties)
? dataInstance.Difficulties
: dataContent.Difficulties;
var parts = dropDifficultiesString.Split('_');
int[] dropDifficulties = parts.Skip(1)
.Select(part => _dataInstanceDifficulties[parts[0]][part])
.ToArray();

difficultiesByEncounterItemId[1_000_000 + dataContent.ItemId] = dropDifficulties;

encounterItems.Add(new DumpJournalEncounterItem
{
ID = 1000000 + dataContent.ItemId,
DifficultyMask = 0,
FactionMask = 0,
Flags = 0,
ItemID = dataContent.ItemId,
JournalEncounterID = encounter.ID,
});
} else if (dataContent.Action == InstanceContentAction.Remove)
{
encounterItems.RemoveAll(item => item.ItemID == dataContent.ItemId);
}
}
}

Expand Down
Loading
Loading