Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: Administrator
- * Date: 7/12/2011
- * Time: 6:53 AM
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Delta9;
- using pwnagebot.LotroInterface;
- namespace SomeScript
- {
- /// <summary>
- /// Description of MyClass.
- /// </summary>
- public class AutoFighter : Delta9Methods, Delta9Method
- {
- public AutoFighter(LotroInterface i, string args) : base(i,args) {
- scriptName = "AutoFighter V1.0";
- }
- public LotroEntity FindTarget(ArrayList entityList) {
- LotroEntity e =GetEntityByName(entityList,0,false,false,true,100);
- if (e == null)
- e = GetEntityByName(entityList,200);
- Debug("Scanning for target");
- if (e != null) {
- Debug("Found target... walking within 35m");
- WalkToWait(e,35);
- }
- return e;
- }
- public void InitTarget(LotroEntity e) {
- if (e != null) {
- Debug("Attempting to pull target...");
- SelectTarget(e);
- Wait(100);
- Face(e);
- Wait(100);
- PressHotkey(0);
- Wait(3000);
- Face(e);
- Wait(100);
- }
- }
- public void AttackTargetTillDead(LotroEntity e) {
- Debug("Attacking target till dead...");
- while (Running && e != null && e.Dead == false && newTarget == false) {
- WalkToWait(e, 35);
- if (GetMe().DistanceTo(e) > 35) {
- WalkToWait(e,35);
- InitTarget(e);
- }
- SelectTarget(e);
- Wait(200,300);
- Face(e);
- Wait(200,300);
- PressHotkey(1);//Hotkey 2
- Wait(1000,1500);
- }
- if (newTarget == true) {
- Debug("Finding new target...");
- newTarget = false;
- }
- }
- public void MoveInRange(int range) {
- LotroEntity me = GetMe();
- if (me.DistanceTo(startX,startY,startZ) > range) {
- Debug("Moving back in range...");
- WalkToWait(startX,startY,startZ);
- }
- }
- public void WaitForHealth() {
- while (Running && GetMe().Health < 50 && GetMe().CombatActive == false) {
- Wait(1000);
- PressHotkey(3);
- Wait(1000);
- }
- }
- private float startX;
- private float startY;
- private float startZ;
- private bool newTarget;
- public override void Run() {
- Debug("Script now running successfully...");
- Interface.OnLineOfSight += new EventHandler<EventArgs>(NewTarget);
- Interface.OnInvalidTarget += new EventHandler<EventArgs>(NewTarget);
- Interface.OnMustFaceTarget += new EventHandler<EventArgs>(MustFaceTarget);
- ArrayList targetList = new ArrayList();
- targetList.Add("Midgewater Warrior");
- targetList.Add("Midgewater Scout");
- targetList.Add("Midgewater Defender");
- targetList.Add("Midgewater Sapper");
- startX = GetMe().X;
- startY = GetMe().Y;
- startZ = GetMe().Z;
- newTarget = false;
- while (Running) {
- LotroEntity e = FindTarget(targetList);
- if (e != null) {
- InitTarget(e);
- Wait(100);
- AttackTargetTillDead(e);
- Wait(100);
- MoveInRange(50);
- WaitForHealth();
- Wait(100);
- }
- else {
- Wait(1000);
- }
- }
- MoveStop();
- }
- public override void OnDeath(object o, EventArgs e)
- {
- Debug("You have just died... Halting script");
- Stop();
- }
- public void NewTarget(object o, EventArgs e) {
- newTarget = true;
- }
- public void MustFaceTarget(object o, EventArgs e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement