Skip to content

Commit 997ecea

Browse files
committed
Update the parsing of effects 2154
1 parent 031780d commit 997ecea

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

Cyberia.Api/Data/Items/ItemData.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ public bool Tradeable()
178178
var hasEffectPreventingTrade = GetItemStatsData()?.Effects.Any(x =>
179179
(x is MarkNotTradableEffect markNotTradableEffect && markNotTradableEffect.IsInfinite()) ||
180180
(x is MarkNotTradableStrongEffect markNotTradableStrongEffect && markNotTradableStrongEffect.IsInfinite()) ||
181-
x is LockToAccountEffect ||
182-
(x is LockToAccountUntilEffect lockToAccountUntilEffect && lockToAccountUntilEffect.DateTime > DateTime.Now) ||
183-
x is ItemUnbreakableEffect) ?? false;
181+
(x is LockToAccountUntilEffect lockToAccountUntilEffect && lockToAccountUntilEffect.IsInfinite()) ||
182+
x is LockToAccountEffect || x is ItemUnbreakableEffect) ?? false;
184183

185184
return !IsQuestItem() && !Cursed && !hasEffectPreventingTrade;
186185
}

Cyberia.Api/Factories/Effects/Elements/LockToAccountUntilEffect.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,31 @@ namespace Cyberia.Api.Factories.Effects.Elements;
88

99
public sealed record LockToAccountUntilEffect : Effect
1010
{
11-
public DateTime DateTime { get; init; }
11+
public DateTime Until { get; init; }
1212

13-
private LockToAccountUntilEffect(int id, int duration, int probability, CriteriaReadOnlyCollection criteria, bool dispellable, EffectArea effectArea, DateTime dateTime)
13+
private LockToAccountUntilEffect(int id, int duration, int probability, CriteriaReadOnlyCollection criteria, bool dispellable, EffectArea effectArea, DateTime until)
1414
: base(id, duration, probability, criteria, dispellable, effectArea)
1515
{
16-
DateTime = dateTime;
16+
Until = until;
1717
}
1818

1919
internal static LockToAccountUntilEffect Create(int effectId, EffectParameters parameters, int duration, int probability, CriteriaReadOnlyCollection criteria, bool dispellable, EffectArea effectArea)
2020
{
2121
return new(effectId, duration, probability, criteria, dispellable, effectArea, GameDateFormatter.CreateDateTimeFromEffectParameters(parameters));
2222
}
2323

24+
public bool IsInfinite()
25+
{
26+
return Until == DateTime.MaxValue;
27+
}
28+
2429
public override DescriptionString GetDescription(CultureInfo? culture = null)
2530
{
26-
return GetDescription(culture, DateTime.ToShortRolePlayString(culture));
31+
if (IsInfinite())
32+
{
33+
return GetDescription(culture, string.Empty);
34+
}
35+
36+
return GetDescription(culture, Until.ToShortRolePlayString(culture));
2737
}
2838
}

Cyberia.Api/api/custom/effects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@
426426
},
427427
{
428428
"id": 2154,
429-
"d": "Verrouillé au compte jusqu'au : #1",
429+
"d": "Verrouillé au compte #1",
430430
"p": -100,
431431
"o": "/",
432432
"t": true

0 commit comments

Comments
 (0)