feat: add pickup radius
This commit is contained in:
parent
ca86371137
commit
ee37ffb219
@ -118,6 +118,7 @@ namespace Client.Application.ViewModels
|
|||||||
public uint DelevelingAttackDistance { get => delevelingAttackDistance; set { if (value != delevelingAttackDistance) { delevelingAttackDistance = value; OnPropertyChanged(); } } }
|
public uint DelevelingAttackDistance { get => delevelingAttackDistance; set { if (value != delevelingAttackDistance) { delevelingAttackDistance = value; OnPropertyChanged(); } } }
|
||||||
public uint DelevelingSkillId { get => delevelingSkillId; set { if (value != delevelingSkillId) { delevelingSkillId = value; OnPropertyChanged(); } } }
|
public uint DelevelingSkillId { get => delevelingSkillId; set { if (value != delevelingSkillId) { delevelingSkillId = value; OnPropertyChanged(); } } }
|
||||||
public byte MaxPassableHeight { get => maxPassableHeight; set { if (value != maxPassableHeight) { maxPassableHeight = value; OnPropertyChanged(); } } }
|
public byte MaxPassableHeight { get => maxPassableHeight; set { if (value != maxPassableHeight) { maxPassableHeight = value; OnPropertyChanged(); } } }
|
||||||
|
public short PickupRadius { get => pickupRadius; set { if (value != pickupRadius) { pickupRadius = value; OnPropertyChanged(); } } }
|
||||||
|
|
||||||
public void LoadConfig()
|
public void LoadConfig()
|
||||||
{
|
{
|
||||||
@ -153,6 +154,7 @@ namespace Client.Application.ViewModels
|
|||||||
DelevelingAttackDistance = config.Deleveling.AttackDistance;
|
DelevelingAttackDistance = config.Deleveling.AttackDistance;
|
||||||
DelevelingSkillId = config.Deleveling.SkillId;
|
DelevelingSkillId = config.Deleveling.SkillId;
|
||||||
MaxPassableHeight = config.Combat.MaxPassableHeight;
|
MaxPassableHeight = config.Combat.MaxPassableHeight;
|
||||||
|
PickupRadius = config.Combat.PickupRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveConfig()
|
private void SaveConfig()
|
||||||
@ -184,6 +186,7 @@ namespace Client.Application.ViewModels
|
|||||||
config.Deleveling.AttackDistance = DelevelingAttackDistance;
|
config.Deleveling.AttackDistance = DelevelingAttackDistance;
|
||||||
config.Deleveling.SkillId = DelevelingSkillId;
|
config.Deleveling.SkillId = DelevelingSkillId;
|
||||||
config.Combat.MaxPassableHeight = MaxPassableHeight;
|
config.Combat.MaxPassableHeight = MaxPassableHeight;
|
||||||
|
config.Combat.PickupRadius = PickupRadius;
|
||||||
SaveCollections();
|
SaveCollections();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,5 +347,6 @@ namespace Client.Application.ViewModels
|
|||||||
private uint delevelingAttackDistance = 0;
|
private uint delevelingAttackDistance = 0;
|
||||||
private uint delevelingSkillId = 0;
|
private uint delevelingSkillId = 0;
|
||||||
private byte? mobLevelUpperLimit = null;
|
private byte? mobLevelUpperLimit = null;
|
||||||
|
private short pickupRadius = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,9 +202,18 @@
|
|||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" IsChecked="{Binding PickupIfPossible}">Pickup if possible</CheckBox>
|
<CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" IsChecked="{Binding PickupIfPossible}">Pickup if possible</CheckBox>
|
||||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
|
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
|
<Label>Pickup radius:</Label>
|
||||||
|
<TextBox Width="100" HorizontalAlignment="Left">
|
||||||
|
<TextBox.Text>
|
||||||
|
<Binding Path="PickupRadius" UpdateSourceTrigger="PropertyChanged"/>
|
||||||
|
</TextBox.Text>
|
||||||
|
</TextBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
<Label>Max delta z:</Label>
|
<Label>Max delta z:</Label>
|
||||||
<TextBox Width="100" HorizontalAlignment="Left">
|
<TextBox Width="100" HorizontalAlignment="Left">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
@ -212,7 +221,7 @@
|
|||||||
</TextBox.Text>
|
</TextBox.Text>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
|
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
<Label>Pickup attempts count:</Label>
|
<Label>Pickup attempts count:</Label>
|
||||||
<TextBox Width="100" HorizontalAlignment="Left">
|
<TextBox Width="100" HorizontalAlignment="Left">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
@ -221,13 +230,13 @@
|
|||||||
</TextBox>
|
</TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<components:MultipleObjectSelector
|
<components:MultipleObjectSelector
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Source="{Binding ExcludedItems}"
|
Source="{Binding ExcludedItems}"
|
||||||
Target="{Binding SelectedExcludedItems}"
|
Target="{Binding SelectedExcludedItems}"
|
||||||
Header="Excluded:"/>
|
Header="Excluded:"/>
|
||||||
<components:MultipleObjectSelector
|
<components:MultipleObjectSelector
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Source="{Binding IncludedItems}"
|
Source="{Binding IncludedItems}"
|
||||||
Target="{Binding SelectedIncludedItems}"
|
Target="{Binding SelectedIncludedItems}"
|
||||||
|
@ -34,7 +34,7 @@ namespace Client.Domain.AI.Combat
|
|||||||
return null;
|
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)
|
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 => config.Combat.IncludedItemIdsToPickup.ContainsKey(x.ItemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = result.Where(x => x.Transform.Position.HorizontalDistance(hero.Transform.Position) <= config.Combat.PickupRadius);
|
||||||
|
|
||||||
return result.ToList();
|
return result.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,6 @@ namespace Client.Domain.AI.Combat
|
|||||||
return false;
|
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))
|
if (worldHandler.Hero.Target != null && (worldHandler.Hero.AttackerIds.Contains(worldHandler.Hero.Target.Id) || worldHandler.Hero.Target.VitalStats.IsDead))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -48,6 +48,7 @@ namespace Client.Domain.AI
|
|||||||
public byte PickupAttemptsCount { get; set; } = 10;
|
public byte PickupAttemptsCount { get; set; } = 10;
|
||||||
public Dictionary<uint, bool> ExcludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
public Dictionary<uint, bool> ExcludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
||||||
public Dictionary<uint, bool> IncludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
public Dictionary<uint, bool> IncludedItemIdsToPickup { get; set; } = new Dictionary<uint, bool>();
|
||||||
|
public short PickupRadius = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DelevelingSection
|
public class DelevelingSection
|
||||||
|
@ -15,7 +15,14 @@ namespace Client.Domain.AI.State
|
|||||||
|
|
||||||
public List<Drop> GetDrops(WorldHandler worldHandler, Config config)
|
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--)
|
for (var i = drops.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (pickupAttempts.ContainsKey(drops[0].Id) && pickupAttempts[drops[0].Id] > config.Combat.PickupAttemptsCount)
|
if (pickupAttempts.ContainsKey(drops[0].Id) && pickupAttempts[drops[0].Id] > config.Combat.PickupAttemptsCount)
|
||||||
|
@ -78,4 +78,4 @@ private:
|
|||||||
|
|
||||||
const std::wstring Application::PIPE_NAME = std::wstring(L"PipeL2Bot");
|
const std::wstring Application::PIPE_NAME = std::wstring(L"PipeL2Bot");
|
||||||
const uint16_t Application::CREATURE_RADIUS = 4000;
|
const uint16_t Application::CREATURE_RADIUS = 4000;
|
||||||
const uint16_t Application::DROP_RADIUS = 1000;
|
const uint16_t Application::DROP_RADIUS = 4000;
|
Loading…
Reference in New Issue
Block a user