Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- GrindBot v1.0 by l0l1dk
- -- Credit to Chaotic and cdmichaelb, for pieces of their scripts that I used in this
- --- User Variables ---
- MountMacro = "Mount"; -- Change this to your mount macro name
- Color = 0xFFFFD700;
- HealSpell = "Rejuvenation"; -- Name of your healing spell
- HealPercent = 0.30; -- When to heal, 1.0 is full health, 0.5 is 50%.
- SpecificTarget = 0;-- The name of a specific mob to target. Set to 0 to target all
- AttackMacro = "Attack"; -- Name of your attack macro
- FoodName = ""; -- Name of the food to be eaten out of combat, can be a spell
- DrinkName = ""; -- Not currently working -- Name of the drink to be drank out of combat, can be a spell
- Speed = 1.0; -- Speedhack speed (Ignore players should be set to false)
- NoCombatHealth = 0.40; -- What percent to not enter combat again until healed
- IgnorePlayers = true; -- Set to false if you want to stop grinding when a player is near
- CheckClass = true; -- Whether to determine if you're a melee by your class.
- -- If you're a Enh Shaman or a Balance Druid, this needs to be false, and the isMelee global to be changed
- RotationBot = false;
- -- Whether to do rotations the same way as RotationBot
- -- Use it if you have modules for your class/spec, it's smarter than AttackMacro
- ----------------------
- ------ Globals -------
- SHDisabled = false;
- Stopped = false;
- CurrentWaypoint = 0;
- Started = false;
- Pause = false;
- Wait = 0;
- One = false;
- Two = false;
- Three = false;
- Sleep = 0;
- Loot = Player.Pointer;
- PlayerLevel = game.getLevel(Player.Pointer);
- isMelee = false; -- isMelee Global
- MountPause = 0;
- Eating = 0;
- Time1 = 0;
- Time2 = 0;
- Time3 = 0;
- BadTarget = 0;
- isRezing = 0;
- ----------------------
- -- Waypoint list --
- Waypoint =
- {
- --List must always end with {0,0,0},
- {-1923.0455322266, 2313.78515625, 38.856819152832},
- {-1915.8654785156, 2321.4404296875, 38.778018951416},
- {-1909.8558349609, 2329.744140625, 39.068874359131},
- {-1910.5057373047, 2339.4353027344, 37.92626953125},
- {-1919.4293212891, 2344.2529296875, 35.357757568359},
- {-1929.2352294922, 2344.6599121094, 34.267276763916},
- {-1936.5455322266, 2337.9064941406, 34.148983001709},
- {-1941.9899902344, 2328.81640625, 34.593441009521},
- {-1946.6790771484, 2319.7907714844, 34.693256378174},
- {-1951.5794677734, 2310.3586425781, 34.809047698975},
- {-1951.3131103516, 2300.2585449219, 35.863285064697},
- {-1946.7491455078, 2291.0895996094, 37.703338623047},
- {-1938.0968017578, 2293.0661621094, 38.99295425415},
- {-1930.7525634766, 2300.9477539063, 38.848087310791},
- {0, 0, 0},
- }
- function Load()
- if MountID == 0 and PlayerLevel > 19 then
- game.printChat("Please set the 'MountID' variable.",0xffff0000);
- return 0;
- end
- game.printChat("GrindBot v1.0 loaded.",Color);
- if CheckClass == true then
- GetMelee();
- end
- system.setSpeedhack(Speed);
- system.collisionlite(1);
- system.collision(1);
- system.setTimerCallback("Time",15);
- system.setCommandCallback("Commands");
- end
- function Commands(Cmd)
- Cmd = string.lower(Cmd);
- if Cmd == ".gb goto" then
- GetNearestWaypoint();
- teleport.addEvent(Waypoint[CurrentWaypoint][1],Waypoint[CurrentWaypoint][2],Waypoint[CurrentWaypoint][3]);
- game.printChat("Teleporting to nearest waypoint.",Color);
- end
- if Cmd == ".gb start" and Pause == true then
- Pause = false;
- end
- if Cmd == ".gb stop" and Pause == false then
- Pause = true;
- end
- end
- function Time()
- Time1 = Time1 + 1;
- Time2 = Time2 + 1;
- if Time1 > 2 then -- and game.isLootable(Loot) == 0
- Bot();
- Time1 = 0;
- end
- --[[if Time2 > 5 and game.isLootable(Loot) == 1 then
- Timer();
- Time2 = 0;
- end]]
- end
- function Bot()
- if Target.Pointer ~= 0 then
- Time3 = Time3 + 1;
- end
- if Sleep > 0 then
- Sleep = Sleep - 1;
- return;
- end
- if Pause == true then
- return;
- end
- if Player.Life < 2 then
- Rez();
- end
- if Target.Pointer == BadTarget then
- game.doString("RunMacroText('/cleartarget');");
- end
- if game.isInCombat(Player.Pointer) == 1 and Target.Pointer == 0 then
- move.stop();
- return;
- end
- X, Y, Z = game.getCoordinates(Loot);
- if GetDistance3D(X,Y,Z,Player.X,Player.Y,Player.Z) < 6 and Loot ~= Player.Pointer and game.isLootable(Loot) == 1 then
- game.useObject(Loot);
- Sleep = 25;
- return;
- end
- if Target.Life / Target.MaxLife > 0.8 and Target.Pointer ~= 0 and game.isInCombat(Player.Pointer) == 0 then
- if Time3 > 50 then
- game.doString("RunMacroText('/cleartarget');");
- BadTarget = Target.Pointer;
- Time3 = 0;
- GetNextWaypoint();
- move.to(Waypoint[CurrentWaypoint][1],Waypoint[CurrentWaypoint][2],Waypoint[CurrentWaypoint][3]);
- end
- end
- if IgnorePlayers == false then
- CheckArea();
- end
- if Stopped == false or game.isInCombat(Player.Pointer) == 1 then
- if Target.Pointer == 0 then
- if game.getLife(Player.Pointer) / game.getMaxLife(Player.Pointer) < NoCombatHealth and game.isInCombat(Player.Pointer) == 0 then
- Sleep = 200;
- game.doString((string.format("RunMacroText('/cast %s');",FoodName)));
- game.doString((string.format("RunMacroText('/cast %s');",DrinkName)));
- else
- GetTarget();
- if game.isMounted(Player.Pointer) == 0 and PlayerLevel > 19 then
- Mount();
- Sleep = 20;
- else
- if move.isMoving(Player.Pointer) == 0 then
- if Started == false then
- GetNearestWaypoint();
- Started = true;
- else
- GetNextWaypoint();
- end
- move.to(Waypoint[CurrentWaypoint][1],Waypoint[CurrentWaypoint][2],Waypoint[CurrentWaypoint][3]);
- -- Waypoint[CurrentWaypoint][3]
- end
- end
- end
- end
- if Target.Pointer ~= 0 and game.getLife(Target.Pointer) ~= 0 then
- Combat();
- end
- if Target.Pointer ~= 0 and game.getLife(Target.Pointer) == 0 then
- game.doString("RunMacroText('/cleartarget');");
- end
- end
- end
- function Mount()
- if game.isMounted(Player.Pointer) == 0 then
- game.doString("RunMacro('Mount');");
- end
- end
- function GetTarget()
- if SpecificTarget == 0 and game.isInCombat(Player.Pointer) == 0 then
- game.doString("RunMacroText('/targetenemy')");
- end
- if SpecificTarget ~= 0 and game.isInCombat(Player.Pointer) == 0 then
- game.doString((string.format("RunMacroText('/target %s');",SpecificTarget)));
- end
- end
- function Heal()
- game.doString("RunMacroText('/cast Healing Surge')"); -- Change "Healing Surge" to the name of your healing spell
- end
- function Rez()
- if One == false then
- game.doString("RepopMe()");
- Sleep = 100;
- One = true;
- return;
- end
- if Two == false then
- X, Y, Z = game.getCorpseCoordinates();
- teleport.addEvent(X,Y,Z);
- Two = true;
- Sleep = 50;
- return;
- end
- if Three == false then
- game.doString("RepopMe()");
- Sleep = 50;
- One = false;
- Two = false;
- Three = false;
- return;
- end
- end
- function Combat()
- Eating = 0;
- Wait = 70;
- if Target.Pointer ~= 0 then
- Loot = Target.Pointer;
- end
- if game.getLife(Player.Pointer) / game.getMaxLife(Player.Pointer) < NoCombatHealth and game.isInCombat(Player.Pointer) == 0 then
- Heal();
- return 0;
- end
- if isMelee == true then
- if GetDistance3D(Player.X,Player.Y,Player.Z,Target.X,Target.Y,Target.Z) > 3 then
- move.to(Target.X,Target.Y,Target.Z);
- end
- if GetDistance3D(Player.X,Player.Y,Player.Z,Target.X,Target.Y,Target.Z) < 4 and move.isMoving(Player.Pointer) == 1 then
- move.stop();
- end
- end
- move.faceObject(Target.Pointer);
- if move.isMoving(Player.Pointer) == 1 and isMelee == false then
- move.stop();
- end
- if game.getLife(Player.Pointer) / game.getMaxLife(Player.Pointer) < HealPercent then
- game.doString(string.format("RunMacroText('/cast %s')",HealSpell));
- else
- if RotationBot == true then
- game.doString(string.format("RunMacroText('/fr pwn')"));
- else
- game.doString(string.format("RunMacro('%s');",AttackMacro));
- end
- end
- Timer();
- end
- function CheckArea() -- Credit to Chaotic and cdmichaelb for this function
- local EntryCount,ThisObject, PlayerFound, isChanneling;
- game.updateObjectList();
- EntryCount = game.getObjectListEntryCount();
- PlayerFound = false;
- for i = 0, EntryCount, 1 do
- ThisObject = game.getObjectListEntry(i);
- if ThisObject ~= Player.Pointer and game.getType(ThisObject) == TYPE_PLAYER then
- PlayerFound = true;
- break;
- end
- end
- isChanneling = game.getObjectAttribute(Player.Pointer,0x16);
- if PlayerFound == true then
- if SHDisabled == false and isChanneling == 0 then
- SHDisabled = true;
- Stopped = true;
- system.setSpeedhack(1.0);
- -- system.collisionlite(0);
- -- system.climbhack(0);
- end
- else
- if SHDisabled == true and isChanneling == 0 then
- SHDisabled = false;
- Stopped = false;
- system.setSpeedhack(Speed);
- -- system.collisionlite(1);
- -- system.climbhack(1);
- end
- end
- end
- function GetMelee()
- Class = game.getClass(Player.Pointer);
- if Class == "Warrior" then
- isMelee = true;
- elseif Class == "Paladin" then
- isMelee = true;
- elseif Class == "Warlock" then
- isMelee = false;
- elseif Class == "Mage" then
- isMelee = false;
- elseif Class == "Druid" then
- isMelee = true;
- elseif Class == "Shaman" then
- isMelee = false;
- elseif Class == "Priest" then
- isMelee = false;
- elseif Class == "Death Knight" then
- isMelee = true;
- elseif Class == "Hunter" then
- isMelee = false;
- elseif Class == "Rogue" then
- isMelee = true;
- end
- end
- -- Credit to Chaotic for everything below here
- function GetNextWaypoint()
- CurrentWaypoint = CurrentWaypoint + 1;
- if Waypoint[CurrentWaypoint][1] == 0 then
- CurrentWaypoint = 1;
- end
- end
- function GetNearestWaypoint()
- --Get nearest waypoint to current position
- local Distance,BestDistance,i;
- i = 1;
- while Waypoint[i][1] ~= 0 do
- Distance = GetDistance2D(Player.X,Player.Y,Waypoint[i][1],Waypoint[i][2]);
- if i == 1 or Distance < BestDistance and Distance > 5 then
- BestDistance = Distance;
- CurrentWaypoint = i;
- end
- i = i + 1;
- end
- end
- function GetDistance2D(x1,y1,x2,y2)
- --c² = a² + b²
- local d1,d2;
- d1 = x2 - x1;
- d1 = d1*d1;
- d2 = y2 - y1;
- d2 = d2*d2;
- return math.sqrt(d1+d2);
- end
- function GetDistance3D(x1,y1,z1,x2,y2,z2)
- local d1,d2,d3;
- d1 = x2 - x1;
- d1 = d1*d1;
- d2 = y2 - y1;
- d2 = d2*d2;
- d3 = z2 - z1;
- d3 = d3*d3;
- return math.sqrt(d1+d2+d3);
- end
- function IsInRange( Object )
- local ObjectX, ObjectY, ObjectZ;
- ObjectX, ObjectY, ObjectZ = game.getCoordinates(Object);
- if GetDistance3D( Player.X, Player.Y, Player.Z, ObjectX, ObjectY, ObjectZ ) < 5 then
- return 1;
- end
- return 0;
- end
- TickPause = 0;
- function Timer()
- if TickPause > 0 then
- TickPause = TickPause - 1;
- return;
- end
- if move.isMoving(Player.Pointer) == 1 or game.isInCombat(Player.Pointer) == 1 and game.isMounted(Player.Pointer) == 1 then
- TickPause = 1;
- return;
- end
- local EntryCount,ThisObject;
- game.updateObjectList();
- EntryCount = game.getObjectListEntryCount();
- for i = 0, EntryCount, 1 do
- ThisObject = game.getObjectListEntry(i);
- if ThisObject ~= Player.Pointer and game.getType(ThisObject) == TYPE_NPC
- and game.getLife(ThisObject) == 0 and IsInRange(ThisObject) == 1 and game.isLootable(ThisObject) == 1 and game.isInCombat(Player.Pointer) == 0 then
- if Loot == true then
- game.useObject(ThisObject);
- end
- TickPause = 3;
- return;
- end
- if ThisObject ~= Player.Pointer and game.getType(ThisObject) == TYPE_PLAYER
- and game.getLife(ThisObject) == 0 and IsInRange(ThisObject) == 1 and game.isLootable(ThisObject) == 1 and game.isInCombat(Player.Pointer) == 0 then
- game.useObject(ThisObject);
- TickPause = 3;
- return;
- end
- end
- end
Add Comment
Please, Sign In to add comment