Im using Pulse now and health comes out as -3753472532?? And using latest version.
You're right, it did initialize ObjectManage.Me, and populated it, but didn't read the descriptors appropriately. That has been fixed, and a new revision is up on the SVN and as a download, which should display your health properly:
And the testing code I used:[23/04/2010 14:49:38] - Type: 4
BaseAddress: 0x775334xxx
GUID: 360287xxxx2076xxxx
Health: 69
Location: 1680.705,-4443.605,19.18787
The only problem I've run into is that when you foreach loop WowPlayer, it throws an exception about not being able to convert WowItem to WowPlayer. Yet have to find out where that originates.Code:lst_Objects.Items.Add("Me Type: " + ObjectManager.Me.Type); lst_Objects.Items.Add(string.Format("Me BaseAddress: 0x{0:X}", ObjectManager.Me.BaseAddress)); lst_Objects.Items.Add("Me GUID: " + ObjectManager.Me.GUID); lst_Objects.Items.Add(ObjectManager.Me.ToString()); lst_Objects.Items.Add(ObjectManager.Me.Health);
Anyway, download the new lib/src and you should be going again.
As a sidenote, if you want to rely on Blackmagic, so might want to try the new 1.1 version with built-in asm support I think. Didn't test it, but API seems to be quite the same. Get it from GameDeception.com.
Sooner or later I would suggest to write your own memory implementation is a more Apoc-style with generics and IntPtr instead of uint addresses for some people on x64.
One big advantage of .net 4, and that was because I downloaded the VS 10 RC at that time, is, that IntPtr got the long awaited offset operator and .Add/Substract methods. While not affecting efficiency it is a gratification for my eyes to use
instead of something likeCode:Memory.Read<IntPtr>(BaseAddress + 0x546548);
Great to see someone doing something for the beginners in this forum to get an insight into how to combine all that source snippetsCode:Memory.Read<IntPtr>(new IntPtr(BaseAddress.ToInt64() + 0x546548));
EDIT: Forget about what I said about the Blackmagic 1.1 and the fasm dependency. I just examined the project and I haven't noticed any changes.
Last edited by Bananenbrot; 04-24-2010 at 02:47 PM.
I might implement an IntPtr based memory library at a later point in time, but as of now, BlackMagic does its job perfectly. I'm based on an x64 system myself, and haven't had any trouble at all with BlackMagic, or fasm_managed.
Currently, I'm working on better and more detailed Exception handling, and logging. Thanks for the suggestion.
I already explained to seifer why it was throwing exceptions, and how to fix it.
You can't convert a WoWItem to a WoWPlayer. Go read up on OOP, and how inheritance works.Code:foreach(var obj in ObjectList.OfType<WowPlayer>()) { DoStuff(); }
Alright, I've been rate lazy and finally kicked my own bollocks into updating this again. Should've done it long ago, since Apoc just spoon-fed the solution, basically.
This update will fix the problem people had with the "Unable to cast object of type 'BlackRain.Common.Objects.WowItem' to type 'BlackRain.Common.Objects.WowGameObject'.".
Where we used to do:
We now do:Code:foreach (WowPlayer obj in ObjectManager.Objects)
This requires the System.Linq reference in the file where you are calling the list, and the Type.Code:foreach (WowPlayer obj in ObjectManager.Objects.OfType<WowPlayer>())
Somewhere in the coming weeks I'll be kicking this rig up again, and use LINQ to get Object "Searching" done, and make this something proper and up to standards again.
Small push to the SVN to reflect these changes. Enjoy.
// Edit - No bins this time around, everything you need is on the SVN. If you want the "latest compiled binary", even though changes are extremely minimal; grab it from the SVN.
Last edited by Seifer; 05-31-2010 at 07:14 AM.
I'm doing it with a single query and mostly with named paramters.
The actual implementation is (needless to say) ugly, especially the prototype:
Searching for an object boils down to something like:Code:public static IEnumerable<T> Search<T>(int minLevel = int.MinValue, int maxLevel = int.MaxValue, int exactLevel = int.MaxValue, bool? dead = null, bool? canAttack = null, bool lineOfSight = false, bool includeMe = true, string name = "", float minDistance = float.MinValue, float maxDistance = float.MaxValue, ulong guid = 0) where T: WoWObject { if (guid != 0) return new T[] { GetObjectByGuid(guid) as T }; var query = ObjectList.OfType<T>(); if (exactLevel != int.MaxValue) query = query.Where(o => (o as WoWUnit).Level == exactLevel); else { if (minLevel != int.MinValue) query = query.Where(o => (o as WoWUnit).Level >= minLevel); if (maxLevel != int.MinValue) query = query.Where(o => (o as WoWUnit).Level <= maxLevel); } if (dead.HasValue) query = query.Where(o => (o as WoWUnit).IsDead == dead); if (canAttack.HasValue) query = query.Where(o => (o as WoWUnit).IsCritter == !canAttack); if (lineOfSight) query = query.Where(o => o.IsInLineOfSight); if (!includeMe) query = query.Where(o => !(o as WoWUnit).IsMe); if(minDistance != float.MinValue) query = query.Where(o => o.Distance(ObjectManager.Me) >= minDistance); if(maxDistance != float.MaxValue) query = query.Where(o => o.Distance(ObjectManager.Me) <= maxDistance); return query; }
Code:var nextMob = ObjectManager.Search<WoWUnit>( minLevel: 1, maxLevel: 3, dead: false, canAttack: true, includeMe: false, ).OrderBy(u => u.Distance(ObjectManager.Me)).First();
Very nice work on the library. Few questions though. I'm just wondering why you aren't using a dictionary structure for your wow objects. I always thought it was a better data structure for that, but I could be mistaken. Also, have you planned on using locks in the manager at some point for use in multi-threaded applications?
Thanks. And I prefer lists over dictionaries, because I have no reason whatsoever to use the TKey, TValue structure, I just want a list of my objects and then use LINQ to search what I need, rather than Dictionary[index] and Dictionarty.ContainsKey stuff, which - in my opinion - is just rubbish. Feel free to use dictionaries for it, though. :P
And no, I don't plan to implement locks in the near future.
I personally use Dictionary because in theory it should be faster than list when we are refreshing it, unless you are destroying and re-creating all objects in which case speed should be about the same.
Tea and cake or death?!