Advertisement
imk0tter

Untitled

Jul 12th, 2011
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. /*
  2. * Created by SharpDevelop.
  3. * User: Administrator
  4. * Date: 7/12/2011
  5. * Time: 6:53 AM
  6. *
  7. * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8. */
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using Delta9;
  13. using pwnagebot.LotroInterface;
  14. namespace SomeScript
  15. {
  16. /// <summary>
  17. /// Description of MyClass.
  18. /// </summary>
  19. public class AutoFighter : Delta9Methods, Delta9Method
  20. {
  21. public AutoFighter(LotroInterface i, string args) : base(i,args) {
  22. scriptName = "AutoFighter V1.0";
  23. }
  24. public LotroEntity FindTarget(ArrayList entityList) {
  25. LotroEntity e =GetEntityByName(entityList,0,false,false,true,100);
  26. if (e == null)
  27. e = GetEntityByName(entityList,200);
  28. Debug("Scanning for target");
  29. if (e != null) {
  30. Debug("Found target... walking within 35m");
  31. WalkToWait(e,35);
  32. }
  33. return e;
  34. }
  35. public void InitTarget(LotroEntity e) {
  36. if (e != null) {
  37. Debug("Attempting to pull target...");
  38. SelectTarget(e);
  39. Wait(100);
  40. Face(e);
  41. Wait(100);
  42. PressHotkey(0);
  43. Wait(3000);
  44. Face(e);
  45. Wait(100);
  46. }
  47. }
  48. public void AttackTargetTillDead(LotroEntity e) {
  49. Debug("Attacking target till dead...");
  50. while (Running && e != null && e.Dead == false && newTarget == false) {
  51. WalkToWait(e, 35);
  52. if (GetMe().DistanceTo(e) > 35) {
  53. WalkToWait(e,35);
  54. InitTarget(e);
  55. }
  56. SelectTarget(e);
  57. Wait(200,300);
  58. Face(e);
  59. Wait(200,300);
  60. PressHotkey(1);//Hotkey 2
  61. Wait(1000,1500);
  62. }
  63. if (newTarget == true) {
  64. Debug("Finding new target...");
  65. newTarget = false;
  66. }
  67. }
  68. public void MoveInRange(int range) {
  69. LotroEntity me = GetMe();
  70. if (me.DistanceTo(startX,startY,startZ) > range) {
  71. Debug("Moving back in range...");
  72. WalkToWait(startX,startY,startZ);
  73. }
  74. }
  75. public void WaitForHealth() {
  76. while (Running && GetMe().Health < 50 && GetMe().CombatActive == false) {
  77. Wait(1000);
  78. PressHotkey(3);
  79. Wait(1000);
  80. }
  81. }
  82. private float startX;
  83. private float startY;
  84. private float startZ;
  85. private bool newTarget;
  86. public override void Run() {
  87. Debug("Script now running successfully...");
  88. Interface.OnLineOfSight += new EventHandler<EventArgs>(NewTarget);
  89. Interface.OnInvalidTarget += new EventHandler<EventArgs>(NewTarget);
  90. Interface.OnMustFaceTarget += new EventHandler<EventArgs>(MustFaceTarget);
  91. ArrayList targetList = new ArrayList();
  92. targetList.Add("Midgewater Warrior");
  93. targetList.Add("Midgewater Scout");
  94. targetList.Add("Midgewater Defender");
  95. targetList.Add("Midgewater Sapper");
  96. startX = GetMe().X;
  97. startY = GetMe().Y;
  98. startZ = GetMe().Z;
  99. newTarget = false;
  100. while (Running) {
  101. LotroEntity e = FindTarget(targetList);
  102. if (e != null) {
  103. InitTarget(e);
  104. Wait(100);
  105. AttackTargetTillDead(e);
  106. Wait(100);
  107. MoveInRange(50);
  108. WaitForHealth();
  109. Wait(100);
  110. }
  111. else {
  112. Wait(1000);
  113. }
  114. }
  115. MoveStop();
  116. }
  117. public override void OnDeath(object o, EventArgs e)
  118. {
  119. Debug("You have just died... Halting script");
  120. Stop();
  121. }
  122.  
  123. public void NewTarget(object o, EventArgs e) {
  124. newTarget = true;
  125. }
  126. public void MustFaceTarget(object o, EventArgs e) {
  127.  
  128. }
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement