Skip to content

Commit 99e2467

Browse files
committed
Fix: Forgot to set the correct item category
1 parent 476424b commit 99e2467

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Backend/Appearance.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ public Proto.Appearances.AppearanceFlagMarket GetOrCreateMarketFlags()
330330
otbItem.MaxTextLenOnce = (ushort)flags.WriteOnce.MaxTextLengthOnce;
331331
}
332332

333-
333+
if (this.HasMarket && Data.Flags.Market.HasCategory)
334+
{
335+
change.AddChange("itemCategory", otbItem.ItemCategory.ToString() ?? "", Data.Flags.Market.Category.ToString(), "Market.Category");
336+
otbItem.ItemCategory = Data.Flags.Market.Category;
337+
}
334338

335339
if (this.HasBank && otbItem.Speed != flags.Bank.Waypoints)
336340
{
@@ -361,6 +365,7 @@ public Proto.Appearances.AppearanceFlagMarket GetOrCreateMarketFlags()
361365
otbItem.MinimapColor = (ushort)flags.Automap.Color;
362366
}
363367

368+
364369
// Otb flags
365370
if (Data.Flags.Hook != null)
366371
{
@@ -445,6 +450,7 @@ private void handleFlag(ChangeEntry entry, bool value, ItemTypeFlag flag, string
445450
public bool HasLight { get => Data.Flags.Light != null; }
446451

447452
public bool HasBank { get => Data.Flags.Bank != null && Data.Flags.Bank.HasWaypoints; }
453+
448454
public bool HasMarket { get => Data.Flags.Market != null; }
449455
public bool HasUpgradeClassification { get => Data.Flags.Upgradeclassification?.HasUpgradeClassification ?? false; }
450456

Backend/OtbData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ private void WriteItemTypes(OtbWriter writer, GameData gameData)
624624
}
625625

626626
// Item category
627+
if (otbItem.HasItemCategory)
627628
{
628629
writer.WriteAttributeType(OtbItemAttribute.ItemCategory, 1);
629630
writer.WriteU8((byte)otbItem.ItemCategory);

Backend/Tibia11/OtbItem.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public OtbItem()
2424
public string? Article { get; set; }
2525
public string? Description { get; set; }
2626

27-
public ItemCategory ItemCategory { get; set; } = ItemCategory.Others;
27+
public ItemCategory? ItemCategory { get; set; }
2828

2929
public ushort? LightLevel { get; set; }
3030
public ushort? LightColor { get; set; }
@@ -66,6 +66,9 @@ public OtbItem()
6666
[MemberNotNullWhen(returnValue: true, member: nameof(Description))]
6767
public bool HasDescription => Description != null;
6868

69+
[MemberNotNullWhen(returnValue: true, member: nameof(ItemCategory))]
70+
public bool HasItemCategory => ItemCategory != null;
71+
6972

7073
[MemberNotNullWhen(returnValue: true, member: nameof(MaxTextLen))]
7174
public bool HasMaxTextLen => MaxTextLen != null;

0 commit comments

Comments
 (0)