Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using ScriptSDK;
- using ScriptSDK.API;
- using ScriptSDK.Mobiles;
- using ScriptSDK.Engines;
- using XScript;
- namespace SpiderVsSpider
- {
- class Program
- {
- public static PlayerMobile Self = PlayerMobile.GetPlayer();
- public static Mobile SpiderA = new Mobile(new Serial(703003));
- public static Mobile SpiderB = new Mobile(new Serial(4697258));
- public static bool IsCasting = false;
- public static bool IsAttacking = false;
- public static DateTime AttackTime;
- static List<Mobile> Spiders = new List<Mobile>
- {
- new Mobile(new Serial(703003)),
- new Mobile(new Serial(4697258))
- };
- /// <summary>
- /// Method for posting messages to the console
- /// with a timestamp
- /// </summary>
- /// <param name="message">string: message to send to the console</param>
- /// <param name="args">(optional)object[]: additional arguments</param>
- public static void ConsoleMessage(string message, params object[] args)
- {
- Console.Write("[{0}-{1}] ", Self.Name, DateTime.Now.ToString("hh:mm:ss"));
- Console.WriteLine(message, args);
- }
- /// <summary>
- /// Method for posting messages to the console
- /// with a timestamp and optional color
- /// </summary>
- /// <param name="message">string: message to send to the console</param>
- /// <param name="color">(optional)enum ConsoleColor: the color you want the message to be</param>
- /// <param name="args">(optional)object[]: additional arguments</param>
- public static void ConsoleMessage(string message, ConsoleColor color = ConsoleColor.White, params object[] args)
- {
- Console.Write("[{0}-{1}] ", Self.Name, DateTime.Now.ToString("hh:mm:ss"));
- Console.ForegroundColor = color;
- Console.WriteLine(message, args);
- Console.ResetColor();
- }
- [STAThread]
- static void Main(string[] args)
- {
- while (Stealth.Client.GetConnectedStatus())
- {
- //Spiders = Spiders.OrderBy(x => x.HealthPercent).ToList();
- foreach (Mobile _spider in Spiders)
- {
- var _currentHealth = _spider.HealthPercent;
- var _hits = _spider.Hits;
- var _maxHits = _spider.MaxHits;
- var _serial = _spider.Serial.Value;
- Thread.Sleep(50);
- if (_currentHealth < 70 && !IsCasting)
- {
- ConsoleMessage("Healing {0} because HP%: {1}, MaxHits: {2}, Hits: {3}", ConsoleColor.Yellow,
- _serial,
- _currentHealth,
- _maxHits,
- _hits);
- Heal(_serial);
- }
- if (_currentHealth < 30 || Self.Mana < 10)
- {
- ConsoleMessage("Telling pets to stop attacking!", ConsoleColor.Red);
- Stealth.Client.SendTextToUO("all stop");
- Thread.Sleep(1000);
- Stealth.Client.CancelTarget();
- Stealth.Client.UseSkill("Meditation");
- }
- }
- TimeSpan _attackDuration = (DateTime.Now - AttackTime);
- if (Spiders.All(x => x.HealthPercent > 40) && _attackDuration.Seconds > 20)
- {
- AttackTime = DateTime.Now;
- ConsoleMessage("Telling pets to start attacking.", ConsoleColor.Green);
- IsAttacking = true;
- Stealth.Client.CancelTarget();
- Stealth.Client.SendTextToUO("a attack");
- Stealth.Client.WaitTargetObject(SpiderB.Serial.Value);
- Thread.Sleep(500);
- Stealth.Client.CancelTarget();
- Stealth.Client.SendTextToUO("b attack");
- Stealth.Client.WaitTargetObject(SpiderA.Serial.Value);
- IsAttacking = false;
- }
- Thread.Sleep(500);
- }
- }
- static void Heal(uint Target)
- {
- IsCasting = true;
- Stealth.Client.CancelTarget();
- Self.Cast("Greater Heal", Target);
- Thread.Sleep(1100);
- IsCasting = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement