Skip to content

Commit

Permalink
fix for proection is on casting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeannsebold6666 committed Feb 26, 2024
1 parent 33d1aff commit a0ad0eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
19 changes: 17 additions & 2 deletions src/ClassicUO.Client/Dust765/External/OnCastingGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using ClassicUO.Renderer;
using ClassicUO.Dust765.Managers;
using System;
using ClassicUO.Game.Data;

namespace ClassicUO.Dust765.External
{
Expand Down Expand Up @@ -53,17 +54,31 @@ public void Start(uint _spell_id, uint _re = 0)
{
_startTime = Time.Ticks;
uint circle;
System.TimeSpan spellTime;

Check warning on line 57 in src/ClassicUO.Client/Dust765/External/OnCastingGump.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

The variable 'spellTime' is declared but never used

Check warning on line 57 in src/ClassicUO.Client/Dust765/External/OnCastingGump.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The variable 'spellTime' is declared but never used

Check warning on line 57 in src/ClassicUO.Client/Dust765/External/OnCastingGump.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The variable 'spellTime' is declared but never used

if (!ProfileManager.CurrentProfile.OnCastingGump_hidden)
{
IsVisible = true;
}

try
{
{
SpellAction spell = (SpellAction)_spell_id;
circle = (uint)SpellManager.GetCircle(spell);
_endTime = _startTime + 400 + circle * 250 + _re; // (0.5+ 0.25 * circle) * 1000
uint protection_delay = 0;
if (World.Player.IsBuffIconExists(BuffIconType.Protection))
{
protection_delay = 1;
if (circle != 9)
{
protection_delay = protection_delay + 2;
} else
{
protection_delay = protection_delay + 5;
circle = circle + 2;
}
}
_endTime = _startTime + 400 + (circle + protection_delay) * 250 + _re; // (0.5+ 0.25 * circle) * 1000
GameActions.iscasting = true;
}
catch
Expand Down
14 changes: 8 additions & 6 deletions src/ClassicUO.Client/Dust765/Shared/SpellManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public enum SpellCircle
Fifth,
Sixth,
Seventh,
Eighth
Eighth,
Nine
}

public enum SpellAction : ushort
Expand Down Expand Up @@ -247,7 +248,6 @@ public static SpellCircle GetCircle(SpellAction spell)
case SpellAction.Strength:
case SpellAction.CurseWeapon:
case SpellAction.PainSpike:
case SpellAction.AttuneWeapon:
case SpellAction.CleansebyFire:
case SpellAction.Thunderstorm:
return SpellCircle.Second;
Expand All @@ -265,8 +265,6 @@ public static SpellCircle GetCircle(SpellAction spell)
case SpellAction.SummonFey:
case SpellAction.SummonFiend:
case SpellAction.ReaperForm:
case SpellAction.Wildfire:
case SpellAction.EssenceofWind:
case SpellAction.DryadAllure:
case SpellAction.EtherealVoyage:
case SpellAction.WordofDeath:
Expand All @@ -281,7 +279,6 @@ public static SpellCircle GetCircle(SpellAction spell)
case SpellAction.ManaDrain:
case SpellAction.Recall:
case SpellAction.RemoveCurse:
case SpellAction.GiftofLife:
case SpellAction.ArcaneCircle:
case SpellAction.HorrificBeast:
case SpellAction.Exorcism:
Expand Down Expand Up @@ -337,8 +334,13 @@ public static SpellCircle GetCircle(SpellAction spell)
case SpellAction.EarthElemental:
case SpellAction.FireElemental:
case SpellAction.WaterElemental:
case SpellAction.GiftofRenewal:
return SpellCircle.Eighth;
case SpellAction.GiftofRenewal:
case SpellAction.AttuneWeapon:
case SpellAction.GiftofLife:
case SpellAction.Wildfire:
case SpellAction.EssenceofWind:
return SpellCircle.Nine;
}
throw new InvalidOperationException();
}
Expand Down

0 comments on commit a0ad0eb

Please sign in to comment.