Skip to content

Commit fc000c1

Browse files
committed
add more products
1 parent 30bcdea commit fc000c1

2 files changed

Lines changed: 117 additions & 51 deletions

File tree

9cWebMarket.Frontend/Pages/Market.razor

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@
3535
<div id="categories" class="w-50 h-auto mb-1">
3636
<div class="mt-1 pt-3 pb-2 container bg-body-secondary rounded-2 h-100">
3737
<h4>Category</h4>
38-
@for (int i = 6; i <= 10; i++)
38+
@for (int i = 6; i <= 22; i++)
3939
{
4040
var itemSubType = (ItemSubType) i;
41+
if(SubTypesBlacklist.Contains(itemSubType)) continue;
42+
4143
var buttonColor = itemSubType == _subtype ? "btn-primary" : "btn-secondary";
4244
<button class="btn badge @buttonColor m-1" @onclick="_ => Refresh(itemSubType)">@itemSubType</button>
4345
}
4446
</div>
4547
</div>
46-
<div id="sorting" class="w-50">
47-
<div class="mt-1 pt-3 pb-2 container bg-body-secondary rounded-2">
48+
<div id="sorting" class="w-50 h-auto mb-1">
49+
<div class="mt-1 pt-3 pb-2 container bg-body-secondary rounded-2 h-100">
4850
<h4>Sorting</h4>
4951
@foreach (var productSortBy in Enum.GetValues<ProductSortBy>())
5052
{
@@ -75,10 +77,13 @@
7577
}
7678
</div>
7779
</div>
78-
<div id="search" class="mt-1 pt-3 pb-2 container bg-body-secondary rounded-2 flex-grow-1">
79-
<h4>Search</h4>
80-
<input type="text" class="form-control" placeholder="min. 3 characters" @onchange="OnSearchInputChange">
81-
</div>
80+
@if(_selectedMarketService == "9CAPI")
81+
{
82+
<div id="search" class="mt-1 pt-3 pb-2 container bg-body-secondary rounded-2 flex-grow-1">
83+
<h4>Search</h4>
84+
<input type="text" class="form-control" placeholder="min. 3 characters" @onchange="OnSearchInputChange">
85+
</div>
86+
}
8287
</div>
8388

8489
</div>
@@ -89,6 +94,21 @@
8994
private const string MarketServiceQueryKey = "marketService";
9095
private const string DefaultPlanet = "heimdall";
9196
private const string DefaultMarketService = "9CAPI";
97+
98+
private static readonly HashSet<ItemSubType> SubTypesBlacklist =
99+
[
100+
ItemSubType.Aura,
101+
ItemSubType.EarCostume,
102+
ItemSubType.EquipmentMaterial,
103+
ItemSubType.FoodMaterial,
104+
ItemSubType.Grimoire,
105+
ItemSubType.EyeCostume,
106+
ItemSubType.HairCostume,
107+
ItemSubType.MonsterPart,
108+
ItemSubType.NormalMaterial,
109+
ItemSubType.TailCostume,
110+
ItemSubType.Chest
111+
];
92112

93113
private ItemSubType _subtype = ItemSubType.Weapon;
94114
private ProductSortBy _sortBy = ProductSortBy.CP;

9cWebMarket.Frontend/Pages/MarketList.razor

Lines changed: 90 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@inject NavigationManager NavigationManager
1212

1313
<div id="list" class="mt-4">
14-
@if ((int) SubType >= 6 && (int) SubType <= 10)
14+
@if (!SubTypesBlacklist.Contains(SubType))
1515
{
1616
if (Loading)
1717
{
@@ -36,65 +36,86 @@
3636
</div>
3737
<div id="product-information-@item.Object.ProductId"
3838
class="row row-cols-2 justify-content-between">
39-
<div name="combatPoints" class="col">
40-
<span class="text-nowrap">@(item.CombatPoint?.ToString() ?? "?") CP</span>
41-
@if (item is {CombatPoint: > 0})
42-
{
43-
<div>(~@(item.CombatPoint / item.Object.Price.Quantity.ToInt(1)) CP/
39+
@if (SubTypesFungibles.Contains(item.Object.Equipment.ItemSubType))
40+
{
41+
<div name="fungibles" class="col">
42+
<span class="text-nowrap">
43+
@item.Object.ItemCount x
44+
</span>
45+
<div>(~@(Math.Round(item.Object.Price.Quantity.ToInt(1) / (decimal)item.Object.ItemCount, 6))
4446
<img
4547
alt="Gold"
4648
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/NCG.png"
47-
style="width: 16px;"/>)
49+
style="width: 16px;"/> / per item)
4850
</div>
49-
}
50-
</div>
51-
<div name="crystals" class="col flex-grow-1">
52-
<span class="text-nowrap">
53-
@(item.Crystal?.ToString() ?? "?")
54-
<img alt="Crystal"
55-
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/CRYSTAL.png"
56-
style="width: 16px;"/>
57-
</span>
58-
@if (item is {Crystal: > 0})
59-
{
60-
<div>(@item.CrystalPerPrice
51+
</div>
52+
}
53+
else
54+
{
55+
<div name="combatPoints" class="col">
56+
<span class="text-nowrap">@(item.CombatPoint?.ToString() ?? "?") CP</span>
57+
@if (item is {CombatPoint: > 0})
58+
{
59+
<div>(~@(item.CombatPoint / item.Object.Price.Quantity.ToInt(1)) CP/
60+
<img
61+
alt="Gold"
62+
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/NCG.png"
63+
style="width: 16px;"/>)
64+
</div>
65+
}
66+
</div>
67+
<div name="crystals" class="col flex-grow-1">
68+
<span class="text-nowrap">
69+
@(item.Crystal?.ToString() ?? "?")
6170
<img alt="Crystal"
6271
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/CRYSTAL.png"
63-
style="width: 16px;"/>/
64-
<img
65-
alt="NCG"
66-
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/NCG.png"
67-
style="width: 16px;"/>)
68-
</div>
69-
}
70-
</div>
71-
72+
style="width: 16px;"/>
73+
</span>
74+
@if (item is {Crystal: > 0})
75+
{
76+
<div>(@item.CrystalPerPrice
77+
<img alt="Crystal"
78+
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/CRYSTAL.png"
79+
style="width: 16px;"/>/
80+
<img
81+
alt="NCG"
82+
src="@(HostEnvironment.BaseAddress)icons/FungibleAssetValue/NCG.png"
83+
style="width: 16px;"/>)
84+
</div>
85+
}
86+
</div>
87+
}
88+
7289
@if (!string.IsNullOrEmpty(item.Object.SellerAgentAddress))
7390
{
7491
<div name="seller" class="text-nowrap">
7592
<b>Seller:</b> @(item.Object.SellerAgentAddress[..8])
7693
</div>
7794
}
7895
</div>
79-
<div class="accordion accordion-flush">
80-
<div class="accordion-item">
81-
<h2 class="accordion-header">
82-
<button class="accordion-button btn-sm collapsed" type="button"
83-
data-bs-toggle="collapse"
84-
data-bs-target="#collapse-@item.Object.ProductId"
85-
aria-expanded="false"
86-
aria-controls="collapse-@item.Object.ProductId">
87-
Details
88-
</button>
89-
</h2>
96+
@if (!SubTypesFungibles.Contains(item.Object.Equipment.ItemSubType))
97+
{
98+
<div class="accordion accordion-flush">
99+
<div class="accordion-item">
100+
<h2 class="accordion-header">
101+
<button class="accordion-button btn-sm collapsed" type="button"
102+
data-bs-toggle="collapse"
103+
data-bs-target="#collapse-@item.Object.ProductId"
104+
aria-expanded="false"
105+
aria-controls="collapse-@item.Object.ProductId">
106+
Details
107+
</button>
108+
</h2>
90109

91-
<div class="collapse" id="collapse-@item.Object.ProductId">
92-
<div>
93-
<ItemDetails Item="item"/>
110+
<div class="collapse" id="collapse-@item.Object.ProductId">
111+
<div>
112+
<ItemDetails Item="item"/>
113+
</div>
94114
</div>
95115
</div>
96-
</div>
97-
</div>
116+
</div>
117+
}
118+
98119
</div>
99120
</div>
100121
}
@@ -140,6 +161,31 @@
140161
[Parameter] public string? Search { get; set; }
141162

142163
private const int Take = 12;
164+
165+
private static readonly HashSet<ItemSubType> SubTypesBlacklist =
166+
[
167+
ItemSubType.Aura,
168+
ItemSubType.EarCostume,
169+
ItemSubType.EquipmentMaterial,
170+
ItemSubType.FoodMaterial,
171+
ItemSubType.Grimoire,
172+
ItemSubType.EyeCostume,
173+
ItemSubType.HairCostume,
174+
ItemSubType.MonsterPart,
175+
ItemSubType.NormalMaterial,
176+
ItemSubType.TailCostume,
177+
ItemSubType.Chest
178+
];
179+
180+
private static readonly HashSet<ItemSubType> SubTypesFungibles =
181+
[
182+
ItemSubType.ApStone,
183+
ItemSubType.Food,
184+
ItemSubType.Circle,
185+
ItemSubType.Hourglass,
186+
ItemSubType.Scroll,
187+
];
188+
143189
private int _currentPageIndex;
144190
private int Skip => Take * _currentPageIndex;
145191
private IEnumerable<int>? _itemIds = [];

0 commit comments

Comments
 (0)