-
[Resolved] How to stop Object Manager in the correct spot
Hello again.
I've recently switched to C# and have been crossing some of my AutoIt hacks and bots over, including this fishing bot.
Problem is, it's not properly finding the fishing bobber.
I've made a little script, showing how it's not working:
Code:
uint g_clientConnect = WoW.ReadUInt(0x12705B0);
uint s_curMgr = WoW.ReadUInt(g_clientConnect + 0x2D94);
uint curObj = WoW.ReadUInt(s_curMgr + 0xAC);
uint nextObj = curObj;
int Started = 1;
while (Started == 1)
{
ObjectName = WoW.ReadASCIIString(WoW.ReadUInt(WoW.ReadUInt(curObj + 0x1A4) + 0x90), 256);
if (ObjectName == "Fishing Bobber")
{
MessageBox.Show("Bobber found.");
}
nextObj = WoW.ReadUInt(curObj + 0x3C);
if (nextObj == curObj)
{
curObj = WoW.ReadUInt(s_curMgr + 0xAC);
nextObj = curObj;
}
else
{
curObj = nextObj;
}
}
However, I get two problems. The first one is that there is no messagebox come up when I'm fishing. Second one is that after all the objects are scanned (it is then supposed to start the scan again) the program stops and gives me a 'ReadUInt Failed' error.
Can anyone help?
And also, please refrain from flaming, I haven't been using C# for long, and I know I've probably made a stupid mistake.
Thanks.
Last edited by Jadd; 11-16-2009 at 07:21 AM.
-
Member
Originally Posted by
Jadd
Hello again.
I've recently switched to C# and have been crossing some of my AutoIt hacks and bots over, including this fishing bot.
Problem is, it's not properly finding the fishing bobber.
I've made a little script, showing how it's not working:
Code:
uint g_clientConnect = WoW.ReadUInt(0x12705B0);
uint s_curMgr = WoW.ReadUInt(g_clientConnect + 0x2D94);
uint curObj = WoW.ReadUInt(s_curMgr + 0xAC);
uint nextObj = curObj;
int Started = 1;
while (Started == 1)
{
ObjectName = WoW.ReadASCIIString(WoW.ReadUInt(WoW.ReadUInt(curObj + 0x1A4) + 0x90), 256);
if (ObjectName == "Fishing Bobber")
{
MessageBox.Show("Bobber found.");
}
nextObj = WoW.ReadUInt(curObj + 0x3C);
if (nextObj == curObj)
{
curObj = WoW.ReadUInt(s_curMgr + 0xAC);
nextObj = curObj;
}
else
{
curObj = nextObj;
}
}
However, I get two problems. The first one is that there is no messagebox come up when I'm fishing. Second one is that after all the objects are scanned (it is then supposed to start the scan again) the program stops and gives me a 'ReadUInt Failed' error.
Can anyone help?
And also, please refrain from flaming, I haven't been using C# for long, and I know I've probably made a stupid mistake.
Thanks.
Debug your program. Check when iterating objects can you get any object name? Find out what is causing the ReadUInt error because that's probably related to the object name problem you have. I don't use C#, and I haven't used memory reading in ages so I don't really have a clue what your problem could be. All I have to say is really, debug your code and you should find out pretty fast what the problem is.
-
Active Member
1) Only game objects has name on that offset - filter results by object type
2) End of linked list = when pointer to next node isn't valid.. That means it's equal to 0 or it's odd number ( pointer % 2 == 1 )
-
Post Thanks / Like - 2 Thanks
-
★ Elder ★
Code:
var curObj = Wow.Read<uint>(CurMgr + 0xAC);
var objectList = new List<WoWObject>();
while (curObj != 0 && (curObj & 1) == 0)
{
var cGuid = Wow.Read<ulong>(curObj + 0x30);
var curType = (WoWObjectType)Wow.Read<uint>(curObj + 0x14);
switch (curType)
{
case WoWObjectType.GameObject:
objectList.Add(new WoWGameObject(curObj); // derieves from WoWObject so we can add it as a WoWGameObject :o
break;
default:
objectList.Add(new WoWObject(curObj);
break;
}
var nextObj = Wow.Read<uint>(curObj + 0x3C);
if (nextObj == curObj)
break;
curObj = nextObj;
}
After you got ure list of objects you can use a LINQ a loop or something to get the bobber 
Code:
var bobber = (objectList.Where(
b => b.CreatedBy == ObjectManager.Me.Guid &&
b.DisplayId == 668)).FirstOrDefault();

Last edited by Nesox; 11-15-2009 at 08:12 AM.
-
Active Member
I love how people are so willing to help known people with these types of problems, but if a new person comes in, they flame. Just a thought.
-
but Jadd has already tried something, he already has a code (not copy/pasted), that's not everyone case.
Last edited by Norus; 11-22-2009 at 05:14 AM.
-
Kynox's Sister's Pimp
Originally Posted by
Nesox
Code:
var curObj = Wow.Read<uint>(CurMgr + 0xAC);
var objectList = new List<WoWObject>();
while (curObj != 0 && (curObj & 1) == 0)
{
var cGuid = Wow.Read<ulong>(curObj + 0x30);
var curType = (WoWObjectType)Wow.Read<uint>(curObj + 0x14);
switch (curType)
{
case WoWObjectType.GameObject:
objectList.Add(new WoWGameObject(curObj); // derieves from WoWObject so we can add it as a WoWGameObject :o
break;
default:
objectList.Add(new WoWObject(curObj);
break;
}
var nextObj = Wow.Read<uint>(curObj + 0x3C);
if (nextObj == curObj)
break;
curObj = nextObj;
}
After you got ure list of objects you can use a LINQ a loop or something to get the bobber 
Code:
var bobber = (objectList.Where(
b => b.CreatedBy == ObjectManager.Me.Guid &&
b.DisplayId == 668)).FirstOrDefault();

Lol, C# is so awesome.
I love it when someone writes half a page of code, then someone else comes along and says:
"Oh, just use language feature X"
or
"Oh, just use System.DotNet.Needs.Deeper.Nesting.Wtf.Y"
-
★ Elder ★
Originally Posted by
Cypher
Lol, C# is so awesome.
Why don't you drop C++ then and learn a real language ? 
Jadd is past the state of flaming he's immune, darn it !
-
Active Member
"Oh, just use System.DotNet.Needs.Deeper.Nesting.Wtf.Y"
That kinda reminds me whenever I work with boost.
boost::give::me::more::namespaces::damn::it (
boost::give::me::more::namespaces::damn::wuz,
boost::give::me::more::namespaces::damn:
hyeah);
Yeah, I know, typedefs + using xy but its still annoying.
Hey, it compiles! Ship it!
-
Kynox's Sister's Pimp
Originally Posted by
Nesox
Why don't you drop C++ then and learn a real language ? 
Jadd is past the state of flaming he's immune, darn it !
Because .NET isn't low level enough for my needs. I need to be able to compile directly to a platform native form.
Originally Posted by
flo8464
That kinda reminds me whenever I work with boost.
boost::give::me::more::namespaces::damn::it (
boost::give::me::more::namespaces::damn::wuz,
boost::give::me::more::namespaces::damn:

hyeah);
Yeah, I know, typedefs + using xy but its still annoying.
Namespace aliases dude.
namespace fs = boost::filesystem;
Or whatever.
That way you don't have to dump the entire namespace into global scope, but you also don't have to clutter up your code with the full name.
-
Originally Posted by
Nesox
Jadd is past the state of flaming he's immune, darn it !
Finally!
'
Edit: Fixed it by the way (the lazy man's way), instead of:
Code:
if (nextObj == curObj)
I used:
Code:
if ((nextObj % 2) == 1)
+Rep to Kryso and Nesox!
Last edited by Jadd; 11-16-2009 at 07:19 AM.
-
Post Thanks / Like - 1 Thanks
timginter (1 members gave Thanks to Jadd for this useful post)