private static void WorldEx_MobileUpdated(Serial serial) { if (serial != World.Player.Serial && serial != healSerial) { return; } if (IsHealing || World.Player.IsGhost || !World.Player.Visible) { return; } Mobile target; if (enabled && (World.Player.Hits < World.Player.HitsMax * 0.90 || World.Player.Poisoned)) { IsHealing = !Bandages.Valid || Bandages.Enchanced ? ebs.Perform() : BandageSelf(); } else if (healSerial.IsValid && (target = World.FindMobile(healSerial)) != null && target.Hits < target.HitsMax * 0.90 && Utility.Distance(target.Position, World.Player.Position) < 3 && Bandages.Valid) { prevQueue = Targeting.QueuedTarget; Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(healSerial); return(true); }; Bandages.Use(); IsHealing = true; } }
void Awake() { myTransform = transform; // TODO make this check for controller == null, otherwise // it always overrides the one chosen in the editor. controller = GetComponent <IController> (); attackCaster = GetComponentInChildren <AttackCast> (); if (attackCaster != null) { attackCaster.gameObject.SetActive(false); } stamina = GetComponent <Stamina> (); health = GetComponent <Health> (); bandages = GetComponent <Bandages> (); if (swingTrail == null) { swingTrail = GetComponentInChildren <TrailRenderer> (); if (swingTrail != null) { swingTrail.renderer.enabled = false; } } }
private static bool BandageSelf() { if (targetTimer != null && targetTimer.Running) { return(false); } if (Targeting.HasTarget) { targetTimer = Timer.DelayedCallback(TimeSpan.FromSeconds(5), OnTargetTimer); targetTimer.Start(); return(false); } if (!Bandages.Valid) { return(false); } prevQueue = Targeting.QueuedTarget; Targeting.CancelTarget(); Targeting.QueuedTarget = Targeting.DoTargetSelf; Bandages.Use(); return(true); }