So yesterday I decided to add a fishing state to my fsm. I estimated that I could get the whole thing going in an hour or less considering that fishing is such an elementary task.
I should have counted on getting screwed by Murphy, damn Murphy.
Notes to add:
1.All of this code is being pulsed using an endscene hook called by a managed class library.
2.The CLR is running.
3. I'm using Apoc's whitemagic library as a read/write wrapper.
The problem I'm facing at the moment is interacting with the bobber.
specifically.. I'm not interacting with the bobber at all.
I have an interact function that works fine for looting but the implementation doesn't seem to give a s*** about my fishing bobber and hence is inherently flawed.
A debug version of my implementation of 'Interact' is as follows
Code://Wow version 3.3.0 [UnmanagedFunctionPointer(CallingConvention.ThisCall)] private delegate IntPtr InteractDelegate(IntPtr instance); private InteractDelegate _interact; public void InteractWithObject(WoWObject obj) { if (_interact == null) { IntPtr InteractAddress = m.GetObjectVtableFunction(ObjPtr, (uint)VFTableIndex.Interact); //<--That's index 42 _interact = m.RegisterDelegate<InteractDelegate>(InteractAddress); } try { _interact(obj); } catch (System.Exception ex) { string debug = ex.ToString(); } }
I might also add some other design details which may or may not assist in diagnosing this issue but could quite possibly feed some searchers some day.
My bobber is wrapped as follows:
and GameObject contains the method:Code://Wow version 3.3.0 public class FishingBobber : WoWGameObject { public FishingBobber(IntPtr objPtr) : base(objPtr) { ObjPtr = objPtr; } public bool IsSplashing { get { return m.Read<short>((uint)ObjPtr + 0xBC) == 1 ? true : false; } } }
finding my fishing bobber from a List<GameObjects> reads:Code:public ulong CreatedByGuid { get { return ReadDescriptor<ulong>(Descriptors.GameObjectFields.OBJECT_FIELD_CREATED_BY); } }
Code:public void FindFishingBobber() { var list = from c in GameObjectList where c.Name == "Fishing Bobber" select c; foreach (WoWGameObject wGo in list) { if (wGo.CreatedByGuid == ObjectManager.Me.Guid) { _fishingBobber = new FishingBobber(wGo); return; } } _fishingBobber = new FishingBobber(IntPtr.Zero); }
To the point:
When it's time to interact with the fishing bobber I send InteractWithObject(_fishingBobber). The function executes with no exceptions but nothing appears to happen in the game world. I've done a bunch of searching and although I have a semi working CTM wrapper, I'd rather not go down that path, I'd also rather not write the guid to mouseover and call a keystroke. I want something that attempts to interact with any wowobject which is what I thought I had.
also. I might add that my reversing skills aren't honed and currently I only really use ida to reverse the statics posted on this site to see the calling conventions and args, I havent attempted to reverse the object structures at all but I'd sure like to figure out how someday.
Any hints on where I'm going wrong, methods I should look for or something obvious I'm unaware of with regards to gameObjects or the interact function?
Thanks in advance.