Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Streamlines potion drink effect #1851

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using ModernUO.Serialization;
using Server.Engines.ConPVP;
using Server.Spells;

namespace Server.Items;
Expand Down Expand Up @@ -34,11 +33,6 @@ public override void Drink(Mobile from)
if (DoAgility(from))
{
PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,15 @@ private void Deserialize(IGenericReader reader, int version)

public abstract void Drink(Mobile from);

public static void PlayDrinkEffect(Mobile m)
public void PlayDrinkEffect(Mobile m)
{
m.RevealingAction();

m.PlaySound(0x2D6);

if (!DuelContext.IsFreeConsume(m))
{
Consume();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like side effects, but we already do it. So I am cleaning this up.

m.AddToBackpack(new Bottle());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ModernUO.Serialization;
using Server.Engines.ConPVP;
using Server.Spells;
using Server.Spells.Necromancy;

Expand Down Expand Up @@ -71,11 +70,6 @@ public override void Drink(Mobile from)

from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
from.PlaySound(0x1E0);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using ModernUO.Serialization;
using Server.Engines.ConPVP;

namespace Server.Items;

Expand Down Expand Up @@ -50,11 +49,6 @@ public override void Drink(Mobile from)

PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}

Timer.StartTimer(TimeSpan.FromSeconds(Delay), from.EndAction<BaseHealPotion>);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public override void Drink(Mobile from)
return;
}

Consume();
Timer.StartTimer(TimeSpan.FromSeconds(2), () => Hide(from), out var timerToken);
m_Table[from] = timerToken;
PlayDrinkEffect(from);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ModernUO.Serialization;
using Server.Engines.ConPVP;

namespace Server.Items;

Expand All @@ -22,11 +21,6 @@ public override void Drink(Mobile from)
from.PlaySound(0x1E3);

PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ModernUO.Serialization;
using Server.Engines.ConPVP;

namespace Server.Items;

Expand All @@ -25,10 +24,5 @@ public override void Drink(Mobile from)
DoPoison(from);

PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ModernUO.Serialization;
using Server.Engines.ConPVP;

namespace Server.Items;

Expand All @@ -19,11 +18,6 @@ public override void Drink(Mobile from)
from.Stam += Scale(from, (int)(Refresh * from.StamMax));

PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using ModernUO.Serialization;
using Server.Engines.ConPVP;
using Server.Spells;

namespace Server.Items;
Expand Down Expand Up @@ -34,11 +33,6 @@ public override void Drink(Mobile from)
if (DoStrength(from))
{
PlayDrinkEffect(from);

if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
}
}
}
Loading