Note: I no longer play WoW. I just never paid attention how easy it is to create a fishing bot. And i did it only for the experience, not that i will use it. But let's not throw the resources to waste. Here is the download for my source code. But read this post before you download.
https://mega.nz/file/uwACELKR#YZTahx...F9EVHAsC_sDkbo
This bot is for WoW Wotlk 3.3.5 (Not retail). The source code is not entirely mine. I used the WTS function copy pasted from Lazy Bot. As i said i only wanted to do it for the experience, i paid no attention to quality ect. So i quickly copy pasted the WTS function that is not even accurate.
If a noob reads this post/source code, then i will explain here how the bot works.
Here is the loop that loops the entire object manager.
Code:
// This is your character guil
// As we loop through the object list, we identify our character by this guid
playerGuide = lib.ReadUlong(ObjectManager + 0xC0);
while ((FirstObject & 1) == 0 && FirstObject != 0) // we read all objects till we see 0 result
{
var guid = lib.ReadUlong(FirstObject + 0x30); // Object GUID
var type = lib.ReadInt(FirstObject + 0x14); // Object type
var x = lib.ReadFloat(FirstObject + 0x79C); // Moving Object X Y Z
var y = lib.ReadFloat(FirstObject + 0x798); // Moving Object X Y Z
var z = lib.ReadFloat(FirstObject + 0x7A0); // Moving Object X Y Z
// Check if the current object is our character
if (playerGuide == guid)
{
// Entering the unit fields to check if our character is channeling a spell
var localPlayerUnitFields = lib.ReadUInt(FirstObject + 0x8);
var channelingSpell = lib.ReadInt(localPlayerUnitFields + 0x58); // Channeling spell ID
// If channeling spell ID is 0, means our character is not casting
if (channelingSpell == 0)
{
// Pressing the Key F
// In game you must set the hotkey for your fishing as F
pressKeyF();
}
}
// Checking the object type
switch ((Constants.TypeId)type)
{
default:
break;
case Constants.TypeId.Object:
break;
case Constants.TypeId.AiGroup:
break;
case Constants.TypeId.AreaTrigger:
break;
case Constants.TypeId.Container:
break;
case Constants.TypeId.DynamicObject:
break;
case Constants.TypeId.Corpse:
break;
case Constants.TypeId.Unit:
break;
case Constants.TypeId.Item:
break;
case Constants.TypeId.Player:
break;
case Constants.TypeId.GameObject:
// GameObject is the type of all mines/herbs/player created objects.
// Player created objects, that also means fishing hooks that were
// created by your fishing ability.
// Getting the X Y Z position of the object
var x_obj = lib.ReadFloat(FirstObject + 0xE8); // Static Object X Y Z
var y_obj = lib.ReadFloat(FirstObject + 0xEC); // Static Object X Y Z
var z_obj = lib.ReadFloat(FirstObject + 0xF0); // Static Object X Y Z
// Unit Fields
var obj_structure1 = lib.ReadUInt(FirstObject + 0x8);
// Creator
var obj_creator = lib.ReadUlong(obj_structure1 + 0x18);
// Display ID
var obj_id = lib.ReadInt(obj_structure1 + 0x20);
// Flags
var obj_flags = lib.ReadInt(obj_structure1 + 0x24);
// Check if the object is a fishing hook
// And also check if the object creator is our character
if (obj_id == 668 && obj_creator == playerGuide)
{
// 0 - Fish is not ready
// 32 - Fish is ready
if (obj_flags == 32)
{
rightClickObject(x_obj, y_obj, z_obj);
Thread.Sleep(500);
}
}
break;
}
var nextobj = lib.ReadUInt(FirstObject + 0x3C);
if (nextobj == FirstObject)
{
break;
}
FirstObject = nextobj;
}
There are all types of objects, players,npcs ect. The fishing hook that is being created after you cast your fishing ability is also object.
It's type is GameObject. In the object manager you have 2 sets of xyz cordinates.
Those are for objects that are moving (Players,Npc..)
Code:
var x = lib.ReadFloat(FirstObject + 0x79C); // Moving Object X Y Z
var y = lib.ReadFloat(FirstObject + 0x798); // Moving Object X Y Z
var z = lib.ReadFloat(FirstObject + 0x7A0); // Moving Object X Y Z
And those are for static objects, objects that are not moving.
Code:
var x_obj = lib.ReadFloat(FirstObject + 0xE8); // Static Object X Y Z
var y_obj = lib.ReadFloat(FirstObject + 0xEC); // Static Object X Y Z
var z_obj = lib.ReadFloat(FirstObject + 0xF0); // Static Object X Y Z
Since our fishing hook is not a moving object, we read the static cordinates.
We will use those cordinates later to translate them to screen cordinates so we can move our mouse to that position and RIGHT CLICK to auto loot the fish.
How do we detect the fishing hook object?
The hook object has data stored in the unit fields.
We access the data like so..
Code:
// Getting the X Y Z position of the object
var x_obj = lib.ReadFloat(FirstObject + 0xE8); // Static Object X Y Z
var y_obj = lib.ReadFloat(FirstObject + 0xEC); // Static Object X Y Z
var z_obj = lib.ReadFloat(FirstObject + 0xF0); // Static Object X Y Z
// Unit Fields
var obj_structure1 = lib.ReadUInt(FirstObject + 0x8);
// Creator
var obj_creator = lib.ReadUlong(obj_structure1 + 0x18);
// Display ID
var obj_id = lib.ReadInt(obj_structure1 + 0x20);
// Flags
var obj_flags = lib.ReadInt(obj_structure1 + 0x24);
// Check if the object is a fishing hook
// And also check if the object creator is our character
if (obj_id == 668 && obj_creator == playerGuide)
{
// 0 - Fish is not ready
// 32 - Fish is ready
if (obj_flags == 32)
{
rightClickObject(x_obj, y_obj, z_obj);
Thread.Sleep(500);
}
}
break;
So, before the object manager loop starts, we already read our character guid from memory.
We will use this guid to identify who is the creator of the fishing hook.
Code:
// This is your character guild
// As we loop through the object list, we identify our character by this guid
playerGuide = lib.ReadUlong(ObjectManager + 0xC0);
So in the end, when the object manager loop hits object of type GameObject
Here is how we are gonna identify if this is the hook.
From the unit fields of the object, we read 3 values. The display ID, the creator of the object, and flags.
Code:
// Unit Fields
var obj_structure1 = lib.ReadUInt(FirstObject + 0x8);
// Creator
var obj_creator = lib.ReadUlong(obj_structure1 + 0x18);
// Display ID
var obj_id = lib.ReadInt(obj_structure1 + 0x20);
// Flags
var obj_flags = lib.ReadInt(obj_structure1 + 0x24);
This is all we need to identify the fishing hook. The caster must be your character, the display ID of the hook is 668, and the flags identify if the fish is ready to be hooked or not(Ready to loot). We are doing the check here.
Code:
// Check if the object is a fishing hook
// And also check if the object creator is our character
if (obj_id == 668 && obj_creator == playerGuide)
{
// 0 - Fish is not ready
// 32 - Fish is ready
if (obj_flags == 32)
{
rightClickObject(x_obj, y_obj, z_obj);
Thread.Sleep(500);
}
}
That's enough. The bot is far from perfect. As i said, i don't aim for quality. I just did it for the experience. The source code is yours to improve it or do whatever you want with it. This was coded for like 1 hour. So there are several issues with the code. The world to screen function is not accurate. You must find your own way to move your mouse to the position of the hook, or call internal function from wow ect. Besides that, the bot is working. But my initial idea was to make this a smart fishing bot. You can count the players for example in the object manager, and you can prevent the bot from fishing if there is any player around. Just something like that...
Code:
public int players = 0;
Code:
switch ((Constants.TypeId)type)
{
default:
break;
case Constants.TypeId.Object:
break;
case Constants.TypeId.AiGroup:
break;
case Constants.TypeId.AreaTrigger:
break;
case Constants.TypeId.Container:
break;
case Constants.TypeId.DynamicObject:
break;
case Constants.TypeId.Corpse:
break;
case Constants.TypeId.Unit:
break;
case Constants.TypeId.Item:
break;
case Constants.TypeId.Player:
// Make sure the current player is not our character
if (guid != playerGuide)
{
players++;
}
break;