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 ScriptDotNet2;
- using ScriptDotNet2.Data;
- using ScriptDotNet2.Model;
- using ScriptAPI;
- namespace Combot
- {
- /* 4 / 6 Chiv Cast Times
- * Consecrate Weapon is 750ms
- * Cleanse by Fire is 750
- * Divine Fury is 750
- * Close Wounds is 1350
- * Remove Curse is 1350
- *
- * */
- public class Combat : Routine
- {
- #region Constants
- public static Creature Leader = new Creature(8439902);
- static List<Creature> GroupList = new List<Creature>
- {
- new Creature(8439902), //Sadok
- new Creature(37928828), //Splendora
- new Creature(11914331), //Caithlyn
- new Creature(13342484), //Sadok2
- new Creature(39645748) //Auto Bot
- };
- static List<Creature> ActiveGroupList = new List<Creature>();
- static List<Item> MooringLines = new List<Item> {
- new Item(1097816179),
- new Item(1097816198),
- new Item(1097816200),
- new Item(1097816189),
- new Item(1097816188),
- new Item(1097816211),
- new Item(1097816195),
- new Item(1097816181)
- };
- #endregion
- static void moveToLeader()
- {
- Stealth.Default.SetMoveThroughNPC(0);
- Stealth.Default.MoveXY((ushort)Leader.X, (ushort)Leader.Y, true, 0, true);
- }
- static void onBuff(object sender, Buff_DebuffSystemEventArgs e)
- {
- String buffstatus = (e.IsEnabled) ? "Turned On" : "Turned Off";
- String outputString = String.Format("Buff ID:{0} has just {1}", e.AttributeId, buffstatus);
- Stealth.Default.AddToSystemJournal(outputString);
- throw new NotImplementedException();
- }
- static void response(string message)
- {
- Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
- }
- public static void routine()
- {
- /*
- Stealth.Default.SetDress();
- Stealth.Default.Equip();
- */
- //Console.WriteLin
- response("Combat routine started...");
- while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
- {
- #region Events
- //Stealth.Default.Buff_DebuffSystem += onBuff;
- Stealth.Default.UnicodeSpeech += onSpeech;
- Stealth.Default.PartyInvite += onInvite;
- #endregion Events
- #region Position Check
- if (Leader.IsExists && Self.X != Leader.X || Self.Y != Leader.Y)
- moveToLeader();
- #endregion
- #region Health Check
- //check if group member exists and sort them by lowest health first
- ActiveGroupList = GroupList.Where(x => x.IsExists).OrderBy(x => x.hpPerc).ToList();
- foreach (Creature GroupMember in ActiveGroupList)
- {
- if (GroupMember.IsExists)
- Heal.checkHealth(GroupMember);
- }
- #endregion
- #region Revenant check
- Find.FindDistance = 4;
- List<Item> Revenants = Find.FindItems(400);
- Revenants = Revenants.Where(x => x.Name == "a revenant").ToList();
- foreach (Item Revenant in Revenants)
- {
- response("Casting Dispel Evil.");
- //keep trying until the bastard is gone!
- while (Revenant.IsExists)
- {
- Self.Cast("Dispel Evil");
- Script.Wait(750); //can't do anything while casting
- }
- }
- #endregion Revenant check
- #region Attack routine
- Attack.checkAttack();
- #endregion
- Script.Wait(500); //slow down program
- }
- }
- static void onSpeech(object sender, UnicodeSpeechEventArgs e)
- {
- if (e.SenderId == Leader.ID && e.Text == "boat")
- {
- MooringLines = MooringLines.OrderBy(x => x.Distance).ToList();
- Item Result = new Item(MooringLines[0].ID);
- Result.Use();
- }
- throw new NotImplementedException();
- }
- static void onInvite(object sender, PartyInviteEventArgs e)
- {
- if (e.InviterId == Leader.ID)
- Stealth.Default.PartyAcceptInvite();
- throw new NotImplementedException();
- }
- }
- public class Attack : Combat
- {
- static Creature AttackTarget = new Creature(Self.ID);
- public static void response(string message)
- {
- Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
- }
- public static void checkAttack()
- {
- AttackTarget = new Creature(12295117);
- if (AttackTarget.IsExists && AttackTarget.Distance < 3)
- Stealth.Default.Attack(AttackTarget.ID);
- stamCheck();
- }
- static void stamCheck()
- {
- if (Self.Stamina < Self.MaxStamina * .8)
- {
- Self.Cast("Divine Fury");
- Script.Wait(750);
- }
- }
- }
- public class Heal : Combat
- {
- static Item bandages = Find.FindItem(3617, Self.Backpack.ID);
- static bool bandaging = false;
- public static void response(string message)
- {
- Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
- }
- public static void checkHealth(Creature HealTarget)
- {
- Thread bandageThread = new Thread(() => bandage(HealTarget));
- if (HealTarget.IsExists)
- {
- if (HealTarget.IsPoisoned)
- cleanse(HealTarget);
- if (HealTarget.hpPerc < 60)
- closeWounds(HealTarget);
- if (HealTarget.hpPerc > 60 && HealTarget.hpPerc < 85 && !bandaging && bandages != null)
- bandageThread.Start();
- }
- }
- static void closeWounds(Creature HealTarget)
- {
- if (HealTarget.Distance < 4 && Self.Mana > 7)
- {
- Self.Cast("Close Wounds", HealTarget);
- response("casting Close Wounds on " + HealTarget.Name + ".");
- Script.Wait(1350);
- }
- }
- static void bandage(Creature HealTarget)
- {
- if (HealTarget.Distance < 2 && bandages != null)
- {
- bandaging = true;
- bandages.Use();
- Stealth.Default.WaitTargetObject(HealTarget.ID);
- response("using bandage on " + HealTarget.Name + ".");
- Stealth.Default.WaitJournalLine(DateTime.Now, "You finish applying the bandages|You apply the bandages, but they barely help|You heal what little damage your patient had|You did not stay close enough to heal your patient|That is too far away", 15000);
- }
- bandaging = false;
- }
- static void cleanse(Creature HealTarget)
- {
- Find.FindDistance = 10;
- if (Self.Mana > 7)
- {
- Self.Cast("Cleanse by Fire", HealTarget);
- response("casting Cleanse by Fire on " + HealTarget.Name + ".");
- Script.Wait(750);
- }
- }
- }
- public class Group : Combat
- {
- public static void response(string message)
- {
- Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
- }
- static Group()
- {
- Console.WriteLine("Group was instantiated.");
- if (Self.ID == 11914331)
- Leader = new Creature(8439902);
- if (Self.ID == 39645748)
- Leader = new Creature(37928828);
- if (Self.ID == 13342484)
- Leader = new Creature(11914331);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement