feat: add pickup radius
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Client.Domain.AI.Combat
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Drop> GetDropByConfig(WorldHandler worldHandler, Config config)
|
||||
public static List<Drop> GetDropByConfig(WorldHandler worldHandler, Config config, Hero hero)
|
||||
{
|
||||
if (!config.Combat.PickupIfPossible)
|
||||
{
|
||||
@@ -49,6 +49,8 @@ namespace Client.Domain.AI.Combat
|
||||
result = result.Where(x => config.Combat.IncludedItemIdsToPickup.ContainsKey(x.ItemId));
|
||||
}
|
||||
|
||||
result = result.Where(x => x.Transform.Position.HorizontalDistance(hero.Transform.Position) <= config.Combat.PickupRadius);
|
||||
|
||||
return result.ToList();
|
||||
}
|
||||
|
||||
|
@@ -35,9 +35,6 @@ namespace Client.Domain.AI.Combat
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO если нет цели, а тебя атаковали, то моб берется автоматом в таргет, из-за этого баг в Rest и MoveToSpot
|
||||
// а без этой проверки зацикливается MoveToTarget->FindTarget->MoveToTarget
|
||||
// один из вариантов решения, брать себя в таргет при входе в Rest и MoveToSpot
|
||||
if (worldHandler.Hero.Target != null && (worldHandler.Hero.AttackerIds.Contains(worldHandler.Hero.Target.Id) || worldHandler.Hero.Target.VitalStats.IsDead))
|
||||
{
|
||||
return false;
|
||||
|
@@ -48,6 +48,7 @@ namespace Client.Domain.AI
|
||||
public byte PickupAttemptsCount { get; set; } = 10;
|
||||
public Dictionary<uint, bool> ExcludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
||||
public Dictionary<uint, bool> IncludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
||||
public short PickupRadius = 200;
|
||||
}
|
||||
|
||||
public class DelevelingSection
|
||||
|
@@ -15,7 +15,14 @@ namespace Client.Domain.AI.State
|
||||
|
||||
public List<Drop> GetDrops(WorldHandler worldHandler, Config config)
|
||||
{
|
||||
var drops = Helper.GetDropByConfig(worldHandler, config);
|
||||
var hero = worldHandler.Hero;
|
||||
|
||||
if (hero == null)
|
||||
{
|
||||
return new List<Drop>();
|
||||
}
|
||||
|
||||
var drops = Helper.GetDropByConfig(worldHandler, config, hero);
|
||||
for (var i = drops.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (pickupAttempts.ContainsKey(drops[0].Id) && pickupAttempts[drops[0].Id] > config.Combat.PickupAttemptsCount)
|
||||
|
Reference in New Issue
Block a user