Skip to content

Commit

Permalink
Fix rechargeable items being mergeable
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Oct 2, 2024
1 parent fa01ddd commit 4ffe004
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Edelstein.Protocol.Gameplay.Constants;
using Edelstein.Protocol.Gameplay.Entities.Inventories;
using Edelstein.Protocol.Gameplay.Entities.Inventories.Modifiers;
using Edelstein.Protocol.Gameplay.Entities.Inventories.Modifiers.Operations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Edelstein.Protocol.Gameplay.Constants;
using Edelstein.Protocol.Network.Packets.Types;

namespace Edelstein.Protocol.Gameplay.Entities.Inventories;
Expand Down Expand Up @@ -65,7 +66,8 @@ public static StructuredItemSlot ToStructured(this ItemSlotBase item)

Number = bundle.Number,
Title = new LPString(bundle.Title ?? ""),
Attribute = bundle.Attribute
Attribute = bundle.Attribute,
SN = bundle.TemplateID.IsRechargeableItem() ? 0 : null
},
ItemSlotPet pet => new StructuredItemSlotInfoPet
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Edelstein.Protocol.Gameplay.Entities.Inventories;
using Edelstein.Protocol.Gameplay.Constants;

namespace Edelstein.Protocol.Gameplay.Entities.Inventories;

public record ItemSlotBundle : ItemSlotBase
{
Expand All @@ -8,7 +10,8 @@ public record ItemSlotBundle : ItemSlotBase
public string? Title { get; set; }

public bool IsMergeableWith(ItemSlotBundle bundle)
=> TemplateID == bundle.TemplateID &&
=> !TemplateID.IsRechargeableItem() &&
TemplateID == bundle.TemplateID &&
Attribute == bundle.Attribute &&
Title == bundle.Title &&
DateExpire == bundle.DateExpire;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BinarySerialization;
using Edelstein.Protocol.Gameplay.Constants;
using Edelstein.Protocol.Network.Packets.Types;

namespace Edelstein.Protocol.Gameplay.Entities.Inventories;
Expand All @@ -8,5 +9,7 @@ public record StructuredItemSlotInfoBundle : StructuredItemSlotInfoBase
[FieldOrder(0)] public short Number { get; init; }
[FieldOrder(1)] public LPString Title { get; init; } = new();
[FieldOrder(2)] public short Attribute { get; init; }
[FieldOrder(3)] public long? SN { get; init; }

[FieldOrder(3)]
public long? SN { get; init; }
}

0 comments on commit 4ffe004

Please sign in to comment.