-
Notifications
You must be signed in to change notification settings - Fork 14
/
sheepshaving.csx
43 lines (38 loc) · 1.57 KB
/
sheepshaving.csx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#load "Specs.csx"
#load "walking.csx"
public static class SheepShaving
{
public static void ShaveSheeps()
{
var previousItemInHand = UO.Items.OnLayer(Layer.OneHandedWeapon).FirstOrDefault() ?? UO.Items.OnLayer(Layer.TwoHandedWeapon).FirstOrDefault();
var sheep = UO.Mobiles.Matching(Specs.Sheep).OrderByDistance().FirstOrDefault();
while (sheep != null)
{
while (sheep != null && sheep.GetDistance(UO.Me.Location) > 1)
{
Walking.StepToward(sheep);
sheep = UO.Mobiles[sheep.Id];
}
if (sheep != null)
{
UO.Use(Specs.Knives);
UO.WaitForTarget();
UO.Target(sheep);
UO.Journal.WaitAny("You put the piles of wool in your pack.", "You put the pile of wool in your pack",
"You can't think of a way to use that item.", "You must wait for the wool to grow back");
UO.Wait(1000);
}
sheep = UO.Mobiles.Matching(Specs.Sheep).OrderByDistance().FirstOrDefault();
}
if (previousItemInHand != null)
{
var itemInHand = UO.Items.OnLayer(Layer.OneHandedWeapon).FirstOrDefault() ?? UO.Items.OnLayer(Layer.TwoHandedWeapon).FirstOrDefault();
if (previousItemInHand.Id != itemInHand.Id)
{
UO.Wear(previousItemInHand, Layer.OneHandedWeapon);
UO.Wait(100);
}
}
}
}
UO.RegisterCommand("shavesheeps", SheepShaving.ShaveSheeps);