Skip to content

Commit 9c4e0d2

Browse files
committed
Add LimitCategory to items
1 parent b1c8c0f commit 9c4e0d2

9 files changed

Lines changed: 949 additions & 932 deletions

File tree

assets/database/db.bin

2.63 KB
Binary file not shown.

assets/database/db.json

Lines changed: 677 additions & 677 deletions
Large diffs are not rendered by default.

assets/database/leftover_db.bin

833 Bytes
Binary file not shown.

assets/database/leftover_db.json

Lines changed: 240 additions & 240 deletions
Large diffs are not rendered by default.

proto/ui.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ message UINPC {
4747
// Contains all information about an Item needed by the UI.
4848
// Generally this will include everything needed by the sim, plus some
4949
// additional data for displaying / filtering.
50-
// Next tag: 30.
50+
// Next tag: 32.
5151
message UIItem {
5252
int32 id = 1;
5353
string name = 2;
@@ -75,6 +75,8 @@ message UIItem {
7575
int32 phase = 16;
7676
ItemQuality quality = 17;
7777
bool unique = 18;
78+
// How many of that item can be equipped at once.
79+
int32 limit_category = 32;
7880
string name_description = 19;
7981

8082
// Classes that are allowed to use the item. Empty indicates no special class restrictions.

tools/database/dbc/item.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type Item struct {
4242
SocketModifier []float64 // Todo: Figure out if this is socket modifier in disguise or something else - I call it that for now.
4343
NameDescription string // Contains information for i.E. Thunderforging. Normal = Thunderforged, HC = Heroic Thunderforged
4444
UpgradeID int
45+
LimitCategory int
4546
}
4647

4748
func (item *Item) ToUIItem() *proto.UIItem {
@@ -67,6 +68,7 @@ func (item *Item) ToScaledUIItem(itemLevel int) *proto.UIItem {
6768
GemSockets: item.GetGemSlots(),
6869
SocketBonus: NullFloat(item.GetGemBonus().ToProtoArray()),
6970
NameDescription: item.NameDescription,
71+
LimitCategory: int32(item.LimitCategory),
7072
}
7173

7274
item.ParseItemFlags(uiItem)

tools/database/tables.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func ScanRawItemData(rows *sql.Rows) (dbc.Item, error) {
5858
&raw.ItemSubClass,
5959
&raw.NameDescription,
6060
&raw.UpgradeID,
61+
&raw.LimitCategory,
6162
)
6263
if err != nil {
6364
panic(err)
@@ -129,7 +130,8 @@ func LoadAndWriteRawItems(dbHelper *DBHelper, filter string, inputsDir string) (
129130
i.ClassID,
130131
i.SubClassID,
131132
COALESCE(ind.Description_lang, ''),
132-
COALESCE(riu.ItemUpgradeID, 0)
133+
COALESCE(riu.ItemUpgradeID, 0),
134+
s.LimitCategory
133135
FROM Item i
134136
JOIN ItemSparse s ON i.ID = s.ID
135137
JOIN ItemClass ic ON i.ClassID = ic.ClassID

ui/core/components/individual_sim_ui/bulk_tab.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class BulkTab extends SimTab {
9595
super(parentElem, simUI, { identifier: 'bulk-tab', title: i18n.t('bulk_tab.title') });
9696

9797
this.simUI = simUI;
98-
this.playerCanDualWield = this.simUI.player.getPlayerSpec().canDualWield && (this.simUI.player.getClass() !== Class.ClassHunter);
98+
this.playerCanDualWield = this.simUI.player.getPlayerSpec().canDualWield && this.simUI.player.getClass() !== Class.ClassHunter;
9999
this.playerIsFuryWarrior = this.simUI.player.getSpec() === Spec.SpecFuryWarrior;
100100

101101
const setupTabBtnRef = ref<HTMLButtonElement>();
@@ -482,7 +482,13 @@ export class BulkTab extends SimTab {
482482

483483
const pickerGroup = this.pickerGroups.get(bulkItemSlot)!;
484484
const allItemOptions: EquippedItem[] = Array.from(pickerGroup.pickers.values()).map(picker => picker.item);
485-
all2HWeapons = all2HWeapons.concat(allItemOptions.filter(equippedItem => ![RangedWeaponType.RangedWeaponTypeUnknown, RangedWeaponType.RangedWeaponTypeWand].includes(equippedItem.item.rangedWeaponType) || (equippedItem.item.handType == HandType.HandTypeTwoHand)));
485+
all2HWeapons = all2HWeapons.concat(
486+
allItemOptions.filter(
487+
equippedItem =>
488+
![RangedWeaponType.RangedWeaponTypeUnknown, RangedWeaponType.RangedWeaponTypeWand].includes(equippedItem.item.rangedWeaponType) ||
489+
equippedItem.item.handType == HandType.HandTypeTwoHand,
490+
),
491+
);
486492
}
487493

488494
for (const twoHandWeapon of all2HWeapons) {
@@ -517,7 +523,9 @@ export class BulkTab extends SimTab {
517523
const oneHandGroup = this.pickerGroups.get(BulkSimItemSlot.ItemSlotHandWeapon);
518524

519525
if (oneHandGroup?.pickers.size) {
520-
const allOneHandWeapons: EquippedItem[] = Array.from(oneHandGroup.pickers.values()).map(picker => picker.item).filter(item => !all2HWeapons.includes(item));
526+
const allOneHandWeapons: EquippedItem[] = Array.from(oneHandGroup.pickers.values())
527+
.map(picker => picker.item)
528+
.filter(item => !all2HWeapons.includes(item));
521529

522530
for (let i = 0; i < allOneHandWeapons.length; i++) {
523531
for (let j = i; j < allOneHandWeapons.length; j++) {
@@ -555,7 +563,10 @@ export class BulkTab extends SimTab {
555563
}
556564

557565
for (const [bulkItemSlot, pickerGroup] of this.pickerGroups.entries()) {
558-
if ((pickerGroup.pickers.size == 0) || [BulkSimItemSlot.ItemSlotMainHand, BulkSimItemSlot.ItemSlotOffHand, BulkSimItemSlot.ItemSlotHandWeapon].includes(bulkItemSlot)) {
566+
if (
567+
pickerGroup.pickers.size == 0 ||
568+
[BulkSimItemSlot.ItemSlotMainHand, BulkSimItemSlot.ItemSlotOffHand, BulkSimItemSlot.ItemSlotHandWeapon].includes(bulkItemSlot)
569+
) {
559570
continue;
560571
}
561572

@@ -596,10 +607,7 @@ export class BulkTab extends SimTab {
596607

597608
const numOptions: number = pickerGroup.pickers.size;
598609

599-
if (
600-
numOptions > 1 &&
601-
[BulkSimItemSlot.ItemSlotFinger, BulkSimItemSlot.ItemSlotTrinket].includes(bulkItemSlot)
602-
) {
610+
if (numOptions > 1 && [BulkSimItemSlot.ItemSlotFinger, BulkSimItemSlot.ItemSlotTrinket].includes(bulkItemSlot)) {
603611
numCombinations *= binomialCoefficient(numOptions, 2);
604612
} else {
605613
numCombinations *= Math.max(numOptions, 1);
@@ -787,8 +795,8 @@ export class BulkTab extends SimTab {
787795
updatedGear = updatedGear.withEquippedItem(
788796
itemSlot,
789797
equippedItemInSlot
790-
? equippedItemInSlot.withItem(equippedItem.item)
791-
: new EquippedItem({ item: equippedItem.item, challengeMode: challengeModeEnabled }),
798+
? equippedItemInSlot.withItem(equippedItem.item).withUpgrade(equippedItem._upgrade)
799+
: equippedItem.withChallengeMode(challengeModeEnabled),
792800
this.playerIsFuryWarrior,
793801
);
794802

@@ -882,7 +890,6 @@ export class BulkTab extends SimTab {
882890
} finally {
883891
this.simUI.player.setGear(TypedEvent.nextEventID(), this.originalGear!);
884892
await this.simUI.sim.updateCharacterStats(TypedEvent.nextEventID());
885-
886893
this.isRunning = false;
887894
if (!waitAbort) this.bulkSimButton.disabled = false;
888895
if (isAborted) {
@@ -891,6 +898,7 @@ export class BulkTab extends SimTab {
891898
body: i18n.t('bulk_tab.notifications.bulk_sim_cancelled'),
892899
});
893900
}
901+
this.simUI.resultsViewer.hideAll();
894902
this.isPending = false;
895903
}
896904
});

ui/core/proto_utils/gear.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ abstract class BaseGear {
103103
}
104104

105105
private removeUniqueItems(gear: Partial<InternalGear>, newItem: EquippedItem) {
106-
if (newItem.item.unique) {
106+
if (newItem.item.unique || newItem.item.limitCategory) {
107107
this.getItemSlots()
108108
.map(slot => Number(slot) as ItemSlot)
109109
.forEach(slot => {
110-
if (gear[slot]?.item.id == newItem.item.id) {
110+
if (
111+
(newItem.item.limitCategory && gear[slot]?.item.limitCategory == newItem.item.limitCategory) ||
112+
(newItem.item.unique && gear[slot]?.item.id == newItem.item.id)
113+
) {
111114
gear[slot] = null;
112115
}
113116
});

0 commit comments

Comments
 (0)