///////////////////////////////////////////////////////////////////////// // // www.ultima.smoce.net // Name: Magery Train // ///////////////////////////////////////////////////////////////////////// using System; using System.Collections.Generic; using System.Text; using Phoenix; using Phoenix.WorldData; namespace Phoenix.Scripts { [RuntimeObject] public class MageryTrain { protected int method = 1; protected ushort[] bp = {0x0F7A, 0x0000}; protected ushort[] ns = {0x0F88, 0x0000}; protected ushort keg = 0x1843; protected ushort potion = 0x0F09; protected ushort[] emptyPotion = {0x0F0E, 0x0000}; protected ushort mr = 0x0005; protected ushort[] bandages = {0x0E21, 0x0000}; public MageryTrain() { } [Executable] public void train_magery() { while (!World.Player.Dead) { while (World.Player.Mana >= 5 && World.Player.Hits >= 10) { if (UO.Count(this.ns[0], this.ns[1]) == 0 || UO.Count(this.bp[0], this.bp[1]) == 0) { throw new System.ApplicationException("Nemas regy!"); } UO.Cast("Magic Arrow", Aliases.Self); UO.Wait(2000); } this.heal(); switch (this.method) { case 0: this.medit(); break; case 1: this.drinkMr(); break; } } } protected void heal() { while (World.Player.Hits < World.Player.MaxHits) { UO.DeleteJournal(); if (UO.Count(this.bandages[0], this.bandages[1]) == 0) { throw new System.ApplicationException("Nemas bandy!"); } UO.WaitTargetSelf(); UO.UseType(this.bandages[0], this.bandages[1]); string[] stopText = { "You put the bloody bandage in your pack.", "You put the bloody bandagess in your pack.", "You apply the bandages, but they barely help." }; Journal.WaitForText(stopText); } } protected void medit() { while (World.Player.Mana < World.Player.Intelligence) { UO.UseSkill("Meditation"); UO.Wait(2500); } } protected void drinkMr() { if (UO.Count(this.potion, this.mr) == 0) { UO.WaitTargetType(this.emptyPotion[0], this.emptyPotion[1]); UO.UseType(this.keg, this.mr); UO.Wait(500); } UO.UseType(this.potion, this.mr); UO.Wait(500); } } }