Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jeannsebold6666 committed Aug 16, 2024
1 parent c4e2b8b commit b6414df
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/ClassicUO.Client/ClassicUO.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<ApplicationIcon>cuoicon.ico</ApplicationIcon>
<AssemblyName>ClassicUO</AssemblyName>
<RootNamespace>ClassicUO</RootNamespace>
Expand Down
4 changes: 2 additions & 2 deletions src/ClassicUO.Client/Dust765/AIBot/SpellCaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static TimeSpan GetCursorTime( SpellAction spell )
{
case SpellAction.MiniHeal:
case SpellAction.MagicArrow:
return TimeSpan.FromSeconds( 0.52 );
return TimeSpan.FromSeconds( 0.800 );

case SpellAction.Clumsy:
case SpellAction.Feeblemind:
Expand All @@ -126,7 +126,7 @@ public static TimeSpan GetCursorTime( SpellAction spell )
case SpellAction.Telekinesis:
case SpellAction.Teleport:
case SpellAction.WallOfStone:
return TimeSpan.FromSeconds( 1.0 );
return TimeSpan.FromSeconds( 1.1 );

case SpellAction.ArchCure:
case SpellAction.ArchProtection:
Expand Down
2 changes: 1 addition & 1 deletion src/ClassicUO.Client/Dust765/AIBot/SpellTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public SpellAction Action
}

public event Action OnSpellChange;
public bool IsCasting => Action != SpellAction.Unknown && Elapsed < SpellCaster.GetCursorTime( this.Action );
public bool IsCasting => GameActions.iscasting;
public bool IsActive => Action != SpellAction.Unknown && !IsCasting && Elapsed < SpellTimer.CursorDuration;
}
}
10 changes: 7 additions & 3 deletions src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,9 @@ public static bool MultiFieldPreview(Multi obj)
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55 || GameActions.LastSpellIndexCursor == 22)


if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -809,7 +811,8 @@ public static bool StaticFieldPreview(Static obj)
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55 || GameActions.LastSpellIndexCursor == 22)

if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -1043,7 +1046,8 @@ public static bool LandFieldPreview(Land obj)
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55 || GameActions.LastSpellIndexCursor == 22)

if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down
16 changes: 9 additions & 7 deletions src/ClassicUO.Client/Dust765/External/OnCastingGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using ClassicUO.Dust765.Managers;
using System;
using ClassicUO.Game.Data;
using ClassicUO.Game.GameObjects;
using ClassicUO.Game.Managers;

namespace ClassicUO.Dust765.External
{
Expand All @@ -22,6 +24,7 @@ class OnCastingGump : Gump
private Label _text;
//private TextureControl _icon;
private StaticPic _icon;
public SpellAction _spell;

public OnCastingGump() : base(0, 0)
{
Expand All @@ -31,7 +34,6 @@ public OnCastingGump() : base(0, 0)
CanCloseWithRightClick = false;
GameActions.iscasting = false;
IsVisible = false;

BuildGump();
}

Expand Down Expand Up @@ -62,16 +64,16 @@ public void Start(uint _spell_id, uint _re = 0)

try
{
SpellAction spell = (SpellAction)_spell_id;
circle = (uint)SpellManager.GetCircle(spell);
_spell = (SpellAction)_spell_id;
circle = (uint)SpellManager.GetCircle(_spell);
uint protection_delay = 0;
bool ignore_proctetion_delay = (spell == SpellAction.Protection || spell == SpellAction.ArchProtection);
bool ignore_proctetion_delay = (_spell == SpellAction.Protection || _spell == SpellAction.ArchProtection);
if (World.Player.IsBuffIconExists(BuffIconType.Protection) && !ignore_proctetion_delay
|| World.Player.IsBuffIconExists(BuffIconType.EssenceOfWind))
{
protection_delay = 2;
}
_endTime = _startTime + 400 + (circle + protection_delay) * 250 + _re; // (0.5+ 0.25 * circle) * 1000
_endTime = _startTime + 400 + (circle + protection_delay) * 200 + _re; // (0.5+ 0.25 * circle) * 1000
GameActions.iscasting = true;
}
catch
Expand All @@ -82,11 +84,11 @@ public void Start(uint _spell_id, uint _re = 0)
}
}


public void Stop()
{
GameActions.iscasting = false;
IsVisible = false;

IsVisible = false;
}
/*
public void OnMessage(string text, uint hue, string name, bool isunicode = true)
Expand Down
103 changes: 103 additions & 0 deletions src/ClassicUO.Client/Game/GameActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#endregion

using System;
using ClassicUO.Assets;
using ClassicUO.Configuration;
using ClassicUO.Game.Data;
using ClassicUO.Game.GameObjects;
Expand Down Expand Up @@ -80,6 +81,108 @@ public static void RequestWarMode(bool war)
Socket.Send_ChangeWarMode(war);
}

public static void TargetRelativeClient()
{

int x = World.Player.X;
int y = World.Player.Y;

int offsetX = 0;
int offsetY = 0;
int destinationX = 0;
int destinationY = 0;

// TODO



Direction direction = World.Player.Direction;


switch (direction)
{
case Direction.North:
offsetY = -1;

break;

case Direction.South:
offsetY = 1;

break;

case Direction.East:
offsetX = -1;
offsetY = -1;

break;

case Direction.West:
offsetX = -1;
break;

case Direction.Right:
offsetX = -1;
offsetY = -1;

break;

case Direction.Left:
offsetX = 1;
offsetY = -1;

break;

case Direction.Up:
offsetX = -1;
offsetY = 1;

break;

case Direction.Down:
offsetX = -1;
offsetY = -1;

break;
default:
throw new ArgumentOutOfRangeException();
}

for (int i = 11; i >= 0; i--)
{
int totalOffsetX = offsetX * i;
int totalOffsetY = offsetY * i;
int distX = x + totalOffsetX;
int distY = y + totalOffsetY;

GameObject tile = World.Map.GetTile(distX, distY);


if (tile is Static || tile is Multi || tile is Land)
{
ref var itemData = ref TileDataLoader.Instance.StaticData[tile.Graphic];
if (itemData.IsImpassable)
{

continue;
}
else
{
Console.WriteLine("teleport: " + " " + distX + " " + " " + distY + " i " + i);
destinationX = x + totalOffsetX;
destinationY = y + totalOffsetY;
break;

}
}

}

TargetManager.Target((ushort)0, (ushort)destinationX, (ushort)destinationY, (short)0);


}

public static void OpenMacroGump(string name)
{
MacroGump macroGump = UIManager.GetGump<MacroGump>();
Expand Down
1 change: 1 addition & 0 deletions src/ClassicUO.Client/Game/GameObjects/PlayerMobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@ public bool Walk(Direction direction, bool run)
if ((oldDirection & Direction.Mask) == (direction & Direction.Mask))
{
// ## BEGIN - END ## // ONCASTINGGUMP

if (GameActions.iscasting) return false;
// ## BEGIN - END ## // ONCASTINGGUMP
Direction newDir = direction;
Expand Down
1 change: 1 addition & 0 deletions src/ClassicUO.Client/Game/Managers/HotkeysManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ internal enum HotkeyAction
Salute,
AlwaysRun,
EquipLastWeapon,
TeleportRelative

#endregion
}
Expand Down
Loading

0 comments on commit b6414df

Please sign in to comment.