Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Linq;
- using Phoenix.WorldData;
- namespace Phoenix.Scripts.DP.Skills
- {
- public class Taming
- {
- [Executable("tamingtrain"), BlockMultipleExecutions("taming")]
- public void Train()
- {
- UOItem staff = World.Player.Layers.FindType(0x13F4, 0x04B9);
- Tame(staff);
- }
- [Executable("taming"), BlockMultipleExecutions("taming")]
- public void Normal()
- {
- UOItem staff = World.Player.Layers.FindType(0x13F4, 0x096D);
- if (!staff.Exist)
- {
- staff = World.Player.Layers.FindType(0x13F4, 0x076B);
- if (!staff.Exist)
- throw new ScriptErrorException("Taming staff not found.");
- UOItem shrink = World.Player.Layers.FindType(0x1843, 0x0724);
- if (!shrink.Exist)
- {
- shrink = World.Player.Layers.FindType(0x0F09, 0x045E);
- if (!shrink.Exist)
- throw new ScriptErrorException("Shrink not found.");
- }
- using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(staff))
- {
- shrink.WaitTarget();
- staff.Use();
- if (!ew.Wait(2000))
- throw new ScriptErrorException("Error during taming staff charging.");
- UO.Wait(500);
- }
- staff = World.Player.Layers.FindType(0x13F4, 0x096D);
- }
- Tame(staff);
- foreach (UOItem item in World.Ground)
- if (Enumerable.Range(0x20C8, 0x2137 - 0x20C8).Any(i => i == item.Graphic))
- item.GrabEx();
- }
- private void Tame(UOItem staff)
- {
- if (!staff.Exist)
- throw new ScriptErrorException("Invalid staff.");
- UOCharacter animal = new UOCharacter(UIManager.TargetObject());
- if (!animal.Exist)
- throw new ScriptErrorException("Invalid target.");
- do
- {
- Journal.Clear();
- animal.WaitTarget();
- staff.Use();
- UO.Wait(1000);
- Journal.WaitForText(pass.Concat(end).ToArray());
- } while (!Journal.Contains(end));
- }
- private string[] pass = {
- "Your taming failed, try again.",
- "Ochoceni se nezdarilo",
- };
- private string[] end = {
- "byl tamnut",
- "Not tamable.",
- "Too far..",
- "You are not able to tame this animal",
- "Jsi moc daleko",
- "toto zvire nelze ochocit.",
- "zviratko uz ma majitele",
- "toto zvire nedokazes"
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement