Skip to content
Merged

Deploy #1748

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
45 changes: 35 additions & 10 deletions apps/backend/Jobs/Data/DataAuctionsJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class DataAuctionsJob : JobBase

private int _connectedRealmId;
private Dictionary<int, WowItemBonus> _itemAppearanceBonuses;
private Dictionary<int, WowItemBonus> _itemScalingBonuses;
private ItemModifiedAppearanceCache _itemModifiedAppearances;
private WowRegion _region;

Expand Down Expand Up @@ -146,6 +147,17 @@ public override async Task Run(string[] data)

var itemBonuses = await MemoryCacheService.GetItemBonuses();
_itemAppearanceBonuses = itemBonuses.ByType[WowItemBonusType.SetItemAppearanceModifier];

_itemScalingBonuses = [];
foreach (var bonus in itemBonuses.ByType.GetValueOrDefault(WowItemBonusType.ScaleConfig))
{
_itemScalingBonuses[bonus.Key] = bonus.Value;
}
foreach (var bonus in itemBonuses.ByType.GetValueOrDefault(WowItemBonusType.ScaleCrafted))
{
_itemScalingBonuses[bonus.Key] = bonus.Value;
}

_itemModifiedAppearances = await MemoryCacheService.GetItemModifiedAppearances();

await using var connection = Context.GetConnection();
Expand Down Expand Up @@ -316,27 +328,40 @@ Dictionary<int, List<ApiDataAuctionsAuction>> commodities
{
int? appearanceId = null;
string appearanceSource = null;
short itemLevel = 0;

if (connectedRealmId < 100000)
{
short modifier = 0;
int priority = 999;
foreach (int bonusId in auction.Item.BonusLists.EmptyIfNull())
{
if (!_itemAppearanceBonuses.TryGetValue(bonusId, out var itemBonus))
if (_itemAppearanceBonuses.TryGetValue(bonusId, out var itemBonus))
{
continue;
foreach (var bonus in itemBonus.Bonuses)
{
if (bonus[0] == (int)WowItemBonusType.SetItemAppearanceModifier)
{
int bonusPriority = bonus.Count >= 3 ? bonus[2] : 0;
if (bonusPriority < priority)
{
modifier = (short)bonus[1];
priority = bonusPriority;
}
}
}
}

foreach (var bonus in itemBonus.Bonuses)
if (_itemScalingBonuses.TryGetValue(bonusId, out itemBonus))
{
if (bonus[0] == (int)WowItemBonusType.SetItemAppearanceModifier)
foreach (var bonus in itemBonus.Bonuses)
{
int bonusPriority = bonus.Count >= 3 ? bonus[2] : 0;
if (bonusPriority < priority)
if (bonus[0] == (int)WowItemBonusType.ScaleConfig && bonus[1] == 266)
{
itemLevel = 206;
} else if (bonus[0] == (int)WowItemBonusType.ScaleCrafted)
{
modifier = (short)bonus[1];
priority = bonusPriority;
itemLevel += (short)bonus[1];
}
}
}
Expand Down Expand Up @@ -392,11 +417,11 @@ record = _itemModifiedAppearances.ByItemIdAndModifier[(auction.Item.Id, modifier
}
else if (!string.IsNullOrWhiteSpace(appearanceSource))
{
groupKey = $"source:{appearanceSource}";
groupKey = $"source:{appearanceSource}:{itemLevel}";
}
else
{
groupKey = $"item:{auction.Item.Id}";
groupKey = $"item:{auction.Item.Id}:{itemLevel}";
}

await writer.StartRowAsync();
Expand Down
10 changes: 6 additions & 4 deletions apps/frontend/auctions/components/results/ResultsRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
const ret = new AuctionInfo();

if (groupKey.startsWith('item:')) {
const itemId = parseInt(groupKey.split(':')[1]);
const parts = groupKey.split(':');
const itemId = parseInt(parts[1]);
const item = wowthingData.items.items[itemId];

if (item.allianceOnly) {
Expand All @@ -50,15 +51,16 @@
}

ret.icon = `item/${itemId}`;
ret.itemLevel = item?.itemLevel || 1;
ret.itemLevel = parseInt(parts[2]) || item?.itemLevel || 1;
ret.name = `{${groupKey}}`;
} else if (groupKey.startsWith('pet:')) {
const pet = wowthingData.static.petById.get(parseInt(groupKey.split(':')[1]));
ret.icon = `npc/${pet.creatureId}`;
ret.itemLevel = 1;
ret.name = pet.name;
} else if (groupKey.startsWith('source:')) {
const sourceParts = groupKey.split(':')[1].split('_');
const parts = groupKey.split(':');
const sourceParts = parts[1].split('_');
const itemId = parseInt(sourceParts[0]);
const item = wowthingData.items.items[itemId];

Expand All @@ -69,7 +71,7 @@
}

ret.icon = `item/${sourceParts.slice(0, sourceParts[1] === '0' ? 1 : 2).join('_')}`;
ret.itemLevel = item?.itemLevel || 1;
ret.itemLevel = parseInt(parts[2]) || item?.itemLevel || 1;
ret.name = `{item:${itemId}}`;
if (sourceParts[1] !== '0') {
const modifier = itemModifierMap[parseInt(sourceParts[1])];
Expand Down
22 changes: 21 additions & 1 deletion apps/frontend/auctions/components/results/Selected.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@

import IconifyWrapper from '@/shared/components/images/IconifyWrapper.svelte';

export let selected: string;
let { selected }: { selected: string } = $props();

const statModifier: Record<number, string> = {
75: 'Inspiration',
76: 'Resourcefulness',
77: 'Finesse',
78: 'Deftness',
79: 'Perception',
80: 'Crafting Speed',
81: 'Multicraft',
82: 'Ingenuity',
};

function formatPrice(price: number): string {
price = price / 100;
Expand Down Expand Up @@ -52,6 +63,9 @@
text-align: right;
width: 9.5rem;
}
.stat {
color: var(--color-shrug);
}
</style>

<div class="selected">
Expand All @@ -76,10 +90,11 @@
<td class="price"></td>
</tr>
{:then auctions}
{#each auctions as auction}

Check warning on line 93 in apps/frontend/auctions/components/results/Selected.svelte

View workflow job for this annotation

GitHub Actions / Lint

Each block should have a key
{@const realm = wowthingData.static.connectedRealmById.get(
auction.connectedRealmId
)}
{@const statIndex = auction.modifierTypes.indexOf(29)}
<tr>
<td class="realm text-overflow" data-tooltip={realm.displayText}>
<!-- <code>[{Region[realm.region]}]</code> -->
Expand Down Expand Up @@ -126,6 +141,11 @@
<td class="price">
<code>{@html formatPrice(auction.buyoutPrice)}</code>
</td>
{#if statIndex >= 0}
<td class="stat">
{statModifier[auction.modifierValues[statIndex]]}
</td>
{/if}
</tr>
{:else}
<tr>
Expand Down
4 changes: 4 additions & 0 deletions apps/frontend/auctions/stores/specific.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SpecificStore {
): Promise<UserAuctionDataAuction[]> {
let things: UserAuctionDataAuction[] = [];

console.log(groupKey);
const cacheKey = [auctionAppState.region, groupKey].join('--');

if (this.cache[cacheKey]) {
Expand All @@ -25,15 +26,18 @@ class SpecificStore {
region: auctionAppState.region,
appearanceSource: '',
itemId: 0,
itemLevel: 0,
petSpeciesId: 0,
};

if (groupKeyParts[0] === 'item') {
data.itemId = parseInt(groupKeyParts[1]);
data.itemLevel = parseInt(groupKeyParts[2]) || 0;
} else if (groupKeyParts[0] === 'pet') {
data.petSpeciesId = parseInt(groupKeyParts[1]);
} else if (groupKeyParts[0] === 'source') {
data.appearanceSource = groupKeyParts[1];
data.itemLevel = parseInt(groupKeyParts[2]) || 0;
}

const xsrf = document.getElementById('app').getAttribute('data-xsrf');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@
</script>

<style lang="scss">
.level {
text-align: right;
white-space: nowrap;
}
.map-level {
display: flex;
gap: 0.2rem;
}
</style>

<tr class={cls}>
<td>
<td class="level">
{#if progress.level > 0}
{progress.level}
{/if}
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/data/dungeon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const raidVaultItemLevel: Record<number, Array<number>> = {
};

export const worldVaultItemLevel: Array<Array<number>> = [
[13, 272, 4], // Hero 5 (ritual 5?)
[13, 269, 4], // Hero 4 (ritual 5?)
[12, 263, 4], // Hero 2 (ritual 4?)
[8, 259, 4], // Hero 1
[7, 256, 3], // Champion 4
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/shared/components/parsed-text/ParsedText.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
html = text || '';

html = html.replace(
/(- )?\|A:Professions-ChatIcon-Quality-Tier(\d):20:20\|a/,
/(- )?\|A:Professions-ChatIcon-Quality-Tier(\d+):20:20\|a/,
'{craftedQuality:$2}'
);
// TODO: fix with Midnight tier icons later
html = html.replace(
/(- )?\|A:Professions-Icon-Quality-12-Tier(\d)-Small[:\d]+\|a/,
/(- )?\|A:Professions-(?:ChatIcon|Icon)-Quality-12-Tier(\d+)(?:-Small)?[:\d]+\|a/,
'{craftedQuality:$2}'
);

Expand Down
8 changes: 7 additions & 1 deletion apps/web/Controllers/API/AuctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ public async Task<IActionResult> Specific([FromBody] ApiAuctionsSpecificForm for

var timer = new JankTimer();

var data = await _auctionService.Specific(form.Region, form.AppearanceSource, form.ItemId, form.PetSpeciesId);
var data = await _auctionService.Specific(
form.Region,
form.AppearanceSource,
form.ItemId,
form.ItemLevel,
form.PetSpeciesId
);

timer.AddPoint("Data");

Expand Down
1 change: 1 addition & 0 deletions apps/web/Forms/ApiAuctionsSpecificForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class ApiAuctionsSpecificForm
{
public string AppearanceSource { get; set; }
public int ItemId { get; set; }
public int ItemLevel { get; set; }
public int PetSpeciesId { get; set; }
public WowRegion Region { get; set; }
}
13 changes: 12 additions & 1 deletion apps/web/Services/AuctionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ public async Task<AuctionBrowseQuery[]> Search(WowRegion region, string query)
return auctions;
}

public async Task<WowAuction[]> Specific(WowRegion region, string appearanceSource, int itemId, int petSpeciesId)
public async Task<WowAuction[]> Specific(
WowRegion region,
string appearanceSource,
int itemId,
int itemLevel,
int petSpeciesId
)
{
var connectedRealmIds = await _context.WowRealm
.Where(realm => realm.Region == region)
Expand All @@ -137,6 +143,11 @@ public async Task<WowAuction[]> Specific(WowRegion region, string appearanceSour
auctionQuery = auctionQuery.Where(auction => auction.PetSpeciesId == petSpeciesId);
}

if (itemLevel > 0)
{
auctionQuery = auctionQuery.Where(auction => auction.GroupKey.EndsWith($":{itemLevel}"));
}

var auctions = await auctionQuery
.OrderBy(auction => auction.BuyoutPrice)
.ToArrayAsync();
Expand Down
4 changes: 2 additions & 2 deletions packages/csharp-lib/Enums/WowItemBonusType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public enum WowItemBonusType : long
Unknown46 = 46,
Unknown47 = 47,
Unknown48 = 48,
Unknown49 = 49,
ScaleConfig = 49,
Unknown50 = 50,
Unknown51 = 51,
Unknown52 = 52,
ScaleCrafted = 52,
Unknown53 = 53,
Unknown54 = 54,
Unknown55 = 55,
Expand Down
Loading