5 Commits

Author SHA1 Message Date
Иванов Иван
ad7a4c3074 Merge branch 'master' of https://github.com/k0t9i/L2Bot2.0 2024-08-18 17:42:46 +02:00
Иванов Иван
5f19cc1f76 feat: add check for line of sight for range and skill attacks 2024-08-18 17:32:29 +02:00
Иванов Иван
abadf90d4a fix: switch to non critical exception for most cases in network handler 2024-08-16 09:23:25 +02:00
Иванов Иван
4a45d1d615 feat: add map levels 2024-08-16 09:22:34 +02:00
k0t9i
248099b323 refactor: add AI description 2024-08-15 22:41:09 +04:00
19 changed files with 112 additions and 55 deletions

View File

@@ -13,6 +13,10 @@
MouseLeave="ContentControl_MouseLeave"
MouseMove="ContentControl_MouseMove"
>
<ContentControl.Resources>
<BitmapImage x:Key="FallbackImage" UriSource="../../Assets/maps/fallback.jpg" />
<Int32Collection x:Key="mapLevels">0,1,2,3,4,5</Int32Collection>
</ContentControl.Resources>
<Grid Background="Transparent">
<Grid.InputBindings>
<MouseBinding Gesture="LeftClick" Command="{Binding MouseLeftClickCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Grid}}" />
@@ -29,7 +33,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image
Source="{Binding ImageSource,Mode=OneWay}"
Source="{Binding ImageSource,Mode=OneWay,FallbackValue={StaticResource FallbackImage},TargetNullValue={StaticResource FallbackImage}}"
Width="{Binding Size,Mode=OneWay}"
Height="{Binding Size,Mode=OneWay}"
Visibility="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"
@@ -286,10 +290,17 @@
<StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Right" Background="#66ffffff">
<Grid Margin="10 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="90"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Padding="0 0 0 3">
<StackPanel Orientation="Horizontal">
<Label>Map level:</Label>
<ComboBox
SelectedValue="{Binding MapLevel}"
ItemsSource="{StaticResource mapLevels}" Margin="0,0,10,0"/>
</StackPanel>
<TextBlock Grid.Column="1" Padding="0 0 0 3" VerticalAlignment="Center">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0:F0}, {1:F0}">
<Binding Path="MousePosition.X" Mode="OneWay"/>
@@ -297,7 +308,7 @@
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Grid.Column="1" Text="{Binding Scale,Mode=OneWay,StringFormat='{}1:{0}'}" HorizontalAlignment="Right" />
<Label Grid.Column="2" Content="{Binding Scale,Mode=OneWay,StringFormat='{}1:{0}'}" HorizontalAlignment="Right" />
</Grid>
</StackPanel>
</Grid>

View File

@@ -11,7 +11,7 @@ namespace Client.Application.ViewModels
{
public class MapBlockViewModel : ObservableObject
{
public string ImageSource => "/Assets/maps/" + mapBlock.BlockX + "_" + mapBlock.BlockY + ".jpg";
public string ImageSource => "/Assets/maps/" + mapBlock.BlockX + "_" + mapBlock.BlockY + (mapBlock.Level > 0 ? "_" + mapBlock.Level : "") + ".jpg";
public float DeltaX => mapBlock.DeltaX;
public float DeltaY => mapBlock.DeltaY;
public float Size => mapBlock.Size;

View File

@@ -1,4 +1,5 @@
using Client.Application.Commands;
using Client.Application.Components;
using Client.Domain.Common;
using Client.Domain.DTO;
using Client.Domain.Entities;
@@ -83,6 +84,19 @@ namespace Client.Application.ViewModels
}
}
public int MapLevel
{
get => mapLevel;
set
{
if (mapLevel != value)
{
mapLevel = value;
UpdateMap();
}
}
}
public Vector3 MousePosition
{
get => mousePosition;
@@ -107,7 +121,7 @@ namespace Client.Application.ViewModels
if (hero != null)
{
var blocks = selector.SelectImages((float)ViewportWidth, (float)ViewportHeight, hero.Transform.Position, Scale);
var blocks = selector.SelectImages((float)ViewportWidth, (float)ViewportHeight, hero.Transform.Position, Scale, MapLevel);
foreach (var block in blocks)
{
@@ -328,7 +342,7 @@ namespace Client.Application.ViewModels
public readonly static float MAX_SCALE = 128;
private readonly AsyncPathMoverInterface pathMover;
private MapImageSelector selector = new MapImageSelector();
private Dictionary<uint, MapBlockViewModel> blocks = new Dictionary<uint, MapBlockViewModel>();
private Dictionary<int, MapBlockViewModel> blocks = new Dictionary<int, MapBlockViewModel>();
private Hero? hero;
private float scale = 8;
private double viewportWidth = 0;
@@ -336,5 +350,6 @@ namespace Client.Application.ViewModels
private Vector3 mousePosition = new Vector3(0, 0, 0);
private object pathCollectionLock = new object();
private AICombatZoneMapViewModel? combatZone = null;
private int mapLevel = 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -47,11 +47,11 @@ namespace Client.Domain.AI
if (isEnabled && worldHandler.Hero != null)
{
states[currentState].Execute();
foreach (var transition in locator.Get(Type).Build())
foreach (var transition in locator.Get(Type).Build(worldHandler, config, asyncPathMover))
{
if (transition.fromStates.ContainsKey(BaseState.Type.Any) && transition.toState != currentState || transition.fromStates.ContainsKey(currentState))
{
if (transition.predicate(worldHandler, config, states[currentState]))
if (transition.predicate(states[currentState]))
{
states[currentState].OnLeave();
currentState = transition.toState;

View File

@@ -27,10 +27,7 @@ namespace Client.Domain.AI.Combat
{
continue;
}
if (skill.IsReadyToUse && hero.VitalStats.Mp >= skill.Cost)
{
return skill;
}
return skill;
}
}

View File

@@ -12,25 +12,25 @@ namespace Client.Domain.AI.Combat
{
public class TransitionBuilder : TransitionBuilderInterface
{
public List<TransitionBuilderInterface.Transition> Build()
public List<TransitionBuilderInterface.Transition> Build(WorldHandler worldHandler, Config config, AsyncPathMoverInterface pathMover)
{
if (transitions.Count == 0)
{
transitions = new List<TransitionBuilderInterface.Transition>()
{
new(new List<BaseState.Type>{BaseState.Type.Any}, BaseState.Type.Dead, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Any}, BaseState.Type.Dead, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.VitalStats.IsDead;
}),
new(new List<BaseState.Type>{BaseState.Type.Dead}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Dead}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return !worldHandler.Hero.VitalStats.IsDead;
}),
new(new List<BaseState.Type>{BaseState.Type.Idle, BaseState.Type.MoveToTarget, BaseState.Type.Rest, BaseState.Type.MoveToSpot}, BaseState.Type.FindTarget, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Idle, BaseState.Type.MoveToTarget, BaseState.Type.Rest, BaseState.Type.MoveToSpot}, BaseState.Type.FindTarget, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -45,13 +45,13 @@ namespace Client.Domain.AI.Combat
return worldHandler.Hero.AttackerIds.Count > 0;
}),
new(new List<BaseState.Type>{BaseState.Type.FindTarget}, BaseState.Type.MoveToTarget, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.FindTarget}, BaseState.Type.MoveToTarget, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.HasValidTarget;
}),
new(new List<BaseState.Type>{BaseState.Type.FindTarget}, BaseState.Type.MoveToSpot, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.FindTarget}, BaseState.Type.MoveToSpot, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -59,7 +59,7 @@ namespace Client.Domain.AI.Combat
return Helper.GetMobsToAttackByConfig(worldHandler, config, worldHandler.Hero).Count == 0
&& !Helper.IsOnSpot(worldHandler, config, worldHandler.Hero);
}),
new(new List<BaseState.Type>{BaseState.Type.MoveToSpot}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.MoveToSpot}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -70,27 +70,27 @@ namespace Client.Domain.AI.Combat
return Helper.IsOnSpot(worldHandler, config, worldHandler.Hero);
}),
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return !worldHandler.Hero.HasValidTarget;
}),
new(new List<BaseState.Type>{BaseState.Type.Idle}, BaseState.Type.Rest, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Idle}, BaseState.Type.Rest, (state) => {
if (worldHandler.Hero == null) {
return false;
};
return worldHandler.Hero.AttackerIds.Count == 0 && (worldHandler.Hero.VitalStats.HpPercent < config.Combat.RestStartPercentHp
|| worldHandler.Hero.VitalStats.MpPercent < config.Combat.RestStartPecentMp);
}),
new(new List<BaseState.Type>{BaseState.Type.Rest}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Rest}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.VitalStats.HpPercent >= config.Combat.RestEndPecentHp
&& worldHandler.Hero.VitalStats.MpPercent >= config.Combat.RestEndPecentMp;
}),
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Attack, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Attack, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -99,6 +99,11 @@ namespace Client.Domain.AI.Combat
return false;
}
if (!pathMover.Pathfinder.HasLineOfSight(worldHandler.Hero.Transform.Position, worldHandler.Hero.Target.Transform.Position))
{
return false;
}
if (config.Combat.SpoilIsPriority) {
var spoil = worldHandler.GetSkillById(config.Combat.SpoilSkillId);
if (spoil != null && !spoil.IsReadyToUse) {
@@ -109,21 +114,21 @@ namespace Client.Domain.AI.Combat
var distance = worldHandler.Hero.Transform.Position.HorizontalDistance(worldHandler.Hero.Target.Transform.Position);
return distance < Helper.GetAttackDistanceByConfig(worldHandler, config, worldHandler.Hero, worldHandler.Hero.Target);
}),
new(new List<BaseState.Type>{BaseState.Type.Attack}, BaseState.Type.Pickup, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Attack}, BaseState.Type.Pickup, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return !worldHandler.Hero.HasValidTarget;
}),
new(new List<BaseState.Type>{BaseState.Type.Attack}, BaseState.Type.FindTarget, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Attack}, BaseState.Type.FindTarget, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.HasValidTarget && worldHandler.Hero.AttackerIds.Count > 0 && !worldHandler.Hero.AttackerIds.Contains(worldHandler.Hero.TargetId);
}),
new(new List<BaseState.Type>{BaseState.Type.Pickup}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Pickup}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}

View File

@@ -12,37 +12,39 @@ namespace Client.Domain.AI.Deleveling
{
public class TransitionBuilder : TransitionBuilderInterface
{
public List<TransitionBuilderInterface.Transition> Build()
// todo add MoveToDropState, SweepState
public List<TransitionBuilderInterface.Transition> Build(WorldHandler worldHandler, Config config, AsyncPathMoverInterface pathMover)
{
if (transitions.Count == 0)
{
transitions = new List<TransitionBuilderInterface.Transition>()
{
new(new List<BaseState.Type>{BaseState.Type.Any}, BaseState.Type.Dead, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Any}, BaseState.Type.Dead, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.VitalStats.IsDead;
}),
new(new List<BaseState.Type>{BaseState.Type.Dead}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Dead}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return !worldHandler.Hero.VitalStats.IsDead;
}),
new(new List<BaseState.Type>{BaseState.Type.FindGuard}, BaseState.Type.MoveToTarget, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.FindGuard}, BaseState.Type.MoveToTarget, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.Target != null;
}),
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Idle, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.Idle, (state) => {
if (worldHandler.Hero == null) {
return false;
}
return worldHandler.Hero.Target == null;
}),
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.AttackGuard, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.MoveToTarget}, BaseState.Type.AttackGuard, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -55,7 +57,7 @@ namespace Client.Domain.AI.Deleveling
var expectedDistance = config.Deleveling.AttackDistance;
return distance < expectedDistance;
}),
new(new List<BaseState.Type>{BaseState.Type.AttackGuard}, BaseState.Type.FindGuard, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.AttackGuard}, BaseState.Type.FindGuard, (state) => {
if (worldHandler.Hero == null) {
return false;
}
@@ -68,7 +70,7 @@ namespace Client.Domain.AI.Deleveling
var expectedDistance = config.Deleveling.AttackDistance;
return distance >= expectedDistance;
}),
new(new List<BaseState.Type>{BaseState.Type.Idle}, BaseState.Type.FindGuard, (worldHandler, config, state) => {
new(new List<BaseState.Type>{BaseState.Type.Idle}, BaseState.Type.FindGuard, (state) => {
if (worldHandler.Hero == null) {
return false;
}

View File

@@ -48,7 +48,7 @@ namespace Client.Domain.AI.State
}
var skill = Helper.GetSkillByConfig(worldHandler, config, hero, hero.Target);
if (skill != null)
if (skill != null && skill.IsReadyToUse && hero.VitalStats.Mp >= skill.Cost)
{
worldHandler.RequestUseSkill(skill.Id, false, false);
}

View File

@@ -25,7 +25,8 @@ namespace Client.Domain.AI.State
{
return;
}
if (distance >= Helper.GetAttackDistanceByConfig(worldHandler, config, hero, target))
var hasLineOfSight = asyncPathMover.Pathfinder.HasLineOfSight(hero.Transform.Position, target.Transform.Position);
if (distance >= Helper.GetAttackDistanceByConfig(worldHandler, config, hero, target) || !hasLineOfSight)
{
asyncPathMover.MoveAsync(target.Transform.Position);
}

View File

@@ -14,16 +14,16 @@ namespace Client.Domain.AI
{
public readonly Dictionary<BaseState.Type, BaseState.Type> fromStates;
public readonly BaseState.Type toState;
public readonly Func<WorldHandler, Config, BaseState, bool> predicate;
public readonly Func<BaseState, bool> predicate;
public Transition(List<BaseState.Type> fromStates, BaseState.Type toState, Func<WorldHandler, Config, BaseState, bool>? predicate = null)
public Transition(List<BaseState.Type> fromStates, BaseState.Type toState, Func<BaseState, bool>? predicate = null)
{
this.fromStates = fromStates.ToDictionary(x => x, x => x);
this.toState = toState;
this.predicate = predicate != null ? predicate : (worldHandler, config, state) => { return true; };
this.predicate = predicate != null ? predicate : (state) => { return true; };
}
}
List<Transition> Build();
List<Transition> Build(WorldHandler worldHandler, Config config, AsyncPathMoverInterface pathMover);
}
}

View File

@@ -11,6 +11,7 @@ namespace Client.Domain.Service
{
public interface AsyncPathMoverInterface
{
public PathfinderInterface Pathfinder { get; }
public ObservableCollection<PathSegment> Path { get; }
public Task<bool> MoveAsync(Vector3 location);
public Task MoveUntilReachedAsync(Vector3 location);

View File

@@ -14,7 +14,7 @@ namespace Client.Domain.Service
private static readonly uint DELTA_X = 20;
private static readonly uint DELTA_Y = 18;
public List<MapBlock> SelectImages(float viewportWidth, float viewportHeight, Vector3 heroPosition, float scale)
public List<MapBlock> SelectImages(float viewportWidth, float viewportHeight, Vector3 heroPosition, float scale, int level)
{
var viewportCenter = new Tuple<float, float>(viewportWidth / 2, viewportHeight / 2);
@@ -46,7 +46,7 @@ namespace Client.Domain.Service
(blockTopLeft.Item2 - topLeft.Item2) / scale
);
result.Add(new MapBlock(x, y, delta.Item1, delta.Item2, BLOCK_SIZE / scale));
result.Add(new MapBlock(x, y, delta.Item1, delta.Item2, BLOCK_SIZE / scale, level));
}
}

View File

@@ -11,5 +11,6 @@ namespace Client.Domain.Service
public interface PathfinderInterface
{
public List<PathSegment> FindPath(Vector3 start, Vector3 end);
public bool HasLineOfSight(Vector3 start, Vector3 end);
}
}

View File

@@ -13,20 +13,24 @@ namespace Client.Domain.ValueObjects
private float deltaY;
private float size;
public uint Id => (BlockX + BlockY) * (BlockX + BlockY + 1) / 2 + BlockX;
public int Id => (IdWithOutLevel + Level) * (IdWithOutLevel + Level + 1) / 2 + IdWithOutLevel;
public uint BlockX { get; set; }
public uint BlockY { get; set; }
public float DeltaX { get => deltaX; set { if (value != deltaX) { deltaX = value; OnPropertyChanged(); } } }
public float DeltaY { get => deltaY; set { if (value != deltaY) { deltaY = value; OnPropertyChanged(); } } }
public float Size { get => size; set { if (value != size) { size = value; OnPropertyChanged(); } } }
public int Level { get; set; }
public MapBlock(uint blockX, uint blockY, float deltaX, float deltaY, float size)
private int IdWithOutLevel => (int) ((BlockX + BlockY) * (BlockX + BlockY + 1) / 2 + BlockX);
public MapBlock(uint blockX, uint blockY, float deltaX, float deltaY, float size, int level)
{
BlockX = blockX;
BlockY = blockY;
DeltaX = deltaX;
DeltaY = deltaY;
Size = size;
Level = level;
}
}
}

View File

@@ -27,6 +27,7 @@ namespace Client.Infrastructure.Service
private readonly int nextNodeDistanceTolerance;
private CancellationTokenSource? cancellationTokenSource;
public PathfinderInterface Pathfinder => pathfinder;
public ObservableCollection<PathSegment> Path { get; private set; } = new ObservableCollection<PathSegment>();
public bool IsLocked { get; private set; } = false;

View File

@@ -17,6 +17,9 @@ namespace Client.Infrastructure.Service
[DllImport("L2JGeoDataPathFinder.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern uint ReleasePath(IntPtr arrayPtr);
[DllImport("L2JGeoDataPathFinder.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern bool HasLineOfSight(string geoDataDirectory, float startX, float startY, float startZ, float endX, float endY, ushort maxPassableHeight);
public L2jGeoDataPathfinder(string geodataDirectory, ushort maxPassableHeight)
{
this.geodataDirectory = geodataDirectory;
@@ -48,6 +51,11 @@ namespace Client.Infrastructure.Service
return BuildPath(nodes);
}
public bool HasLineOfSight(Vector3 start, Vector3 end)
{
return HasLineOfSight(GetGeodataFullpath(), start.X, start.Y, start.Z, end.X, end.Y, maxPassableHeight);
}
private List<PathSegment> BuildPath(List<PathNode> nodes)
{
var result = new List<PathSegment>();

View File

@@ -52,7 +52,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::GetNextCreature failed");
throw RuntimeException(L"UNetworkHandler::GetNextCreature failed");
}
}
@@ -83,7 +83,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::GetUser failed");
throw RuntimeException(L"UNetworkHandler::GetUser failed");
}
}
@@ -97,7 +97,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::GetItem failed");
throw RuntimeException(L"UNetworkHandler::GetItem failed");
}
}
@@ -110,7 +110,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::MTL failed");
throw RuntimeException(L"UNetworkHandler::MTL failed");
}
}
@@ -123,7 +123,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::Action failed");
throw RuntimeException(L"UNetworkHandler::Action failed");
}
}
@@ -136,7 +136,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::RequestMagicSkillUse failed");
throw RuntimeException(L"UNetworkHandler::RequestMagicSkillUse failed");
}
}
@@ -150,7 +150,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::RequestUseItem failed");
throw RuntimeException(L"UNetworkHandler::RequestUseItem failed");
}
}
@@ -163,7 +163,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::RequestAutoSoulShot failed");
throw RuntimeException(L"UNetworkHandler::RequestAutoSoulShot failed");
}
}
@@ -176,7 +176,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::ChangeWaitType failed");
throw RuntimeException(L"UNetworkHandler::ChangeWaitType failed");
}
}
@@ -190,7 +190,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::RequestItemList failed");
throw RuntimeException(L"UNetworkHandler::RequestItemList failed");
}
}
@@ -203,7 +203,7 @@ namespace Interlude
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
throw CriticalRuntimeException(L"UNetworkHandler::RequestRestartPoint failed");
throw RuntimeException(L"UNetworkHandler::RequestRestartPoint failed");
}
}

View File

@@ -18,3 +18,14 @@ Communication between the client and the injected code occurs through a named pi
Pathfinding is done using [L2jGeodataPathFinder](https://github.com/k0t9i/L2jGeodataPathFinder).
![image_2023-10-29_20-53-56](https://github.com/k0t9i/L2Bot2.0/assets/7733997/104e5ff2-7435-4def-be5c-3223f02e37c5)
## AI
The bot client have two AI: combat and deleveling.
Combat AI can attack and spoil mobs in any combination depending on the settings. It can also collect the selected drop and rest when it reaches a certain level of HP and MP.
Deleveling AI can automatically attack guards in any town/village until it reaches a configured level.
Both AIs use pathfinding to achieve desired goals.
![image](https://github.com/user-attachments/assets/8e566c98-e996-4997-afbb-7100e0d0e6a9)