knyox, think you could kinda go into detail a little more on your CastSpellByName function ya got there?
knyox, think you could kinda go into detail a little more on your CastSpellByName function ya got there?
arynock, in case you're interested heres how i handle it. its non injection based.
then to cast i use PressString("/cast fishing*"); or you can do PressString("/cast maul*"); or etcCode:void PressString(char *buf) { for (int x = 0; x < strlen(buf);x++) { if (buf[x] == '/') Press(AsciiToVK('*')); // if special character, convert to VK_ then press if (buf[x] == '*') // '*' is for enter key Press(AsciiToVK(buf[x])); else Press(buf[x]); } }; void Press(int key) { Sleep(20); // to keep from sending keys too fast SendMessage(hwnd, WM_KEYDOWN, key, 0); // Using SendMessage so key presses arent system wide (like with keybd_event) SendMessage(hwnd, WM_CHAR, key, 0); Sleep(20); // pause between pushing a key down and releasing SendMessage(hwnd, WM_KEYUP, key, 0); };
Rofl. Kynox's code is to be used in injection.
I use GetSpellIDByName to get the spell ID I want:
.text:004C41D0 GetSpellIdByName proc near ; CODE XREF: Lua_CastSpellByName+8Bp
.text:004C41D0 ; IsValidSpell+Cp ...
.text:004C41D0
Then CastSpellByID:
.text:006FC520 CastSpellById proc near ; CODE XREF: sub_495810+Cp
.text:006FC520 ; sub_4A1380+7Cp ...
.text:006FC520
Or if you prefer to use LUA and have the appropriate offsets you can use Blizz's API:
.text:004C42E0 Lua_CastSpellByName proc near ; DATA XREF: .data:00B9C0F4o
.text:004C42E0
The offset you need:
.text:00706C80 lua_dostring proc near ; CODE XREF: sub_495E90+35p
.text:00706C80 ; sub_701AC0+353p ...
.text:00706C80
I think that's the only one....
@korknob: NoMorePasting.com & NoMorePasting.com
My initial injection, while it seemed correct in theory, caused crashes from time to time for me. I changed it a few weeks ago and apparently never updated it in public.
Anyway, as we all know, this is an ugly and inefficient way of doing it. Whenever I stop being quite as busy, I think I'm going to go with DLL injection so I don't have to worry about managing codecaves and creating threads and the overhead that is inherent in either and/or both. I'd suggest others go in the same direction and stay away from these kinds of unprofessional and newbie hacks (yes, even though it's mine, I know it's poor).
Last edited by Shynd; 08-09-2008 at 11:06 AM. Reason: Added other NMP link
Yeah, I thought about it, but it'd be far easier to just go in a different direction and use C/++ for the injection and C# for the logic handling. Shared DLL / named pipes / socket communication between the injected DLL and the C# app == more fun to write, easier to do, and more powerful by far.
o.O
More powerful? What the hell are you smoking.
Whats wrong with hooking WoW's LUA engine and doing a UI in LUA, or hooking DX and using CEGUI. I fail to see how having to worry about IPC is more 'fun' and 'powerful' than just doing an injected UI (which has the added benifit you don't need to alt+tab to use it).
Hi, more powerful than the way I did it that was linked above. Duh, hooking the LUA engine and having an in-game UI is the best way--I've never said it wasn't, never even alluded to it being inferior to anything--but I just don't want to do it that way yet. Trust me, I remember bubba's teleporting cheat, back in the day, and I was wow-ed by it just like most other people and have understood the allure of an in-game UI ever since. I understand that you feel some stupid need to constantly be contrary, but, really, I'm sitting here agreeing with you on just about everything; there's no need to be combative.
IPC is a huge headache and alt-tabbing is an even bigger headache (one that affects the user as well as the developer) and I'll get to the point where I'm done with the core parts of my tool and ready to go on to making it more user-friendly sooner or later but, for now, this is the direction I'm going out of a combination of ease-of-design and power. Is that okay with you?
Last edited by Shynd; 08-11-2008 at 06:01 PM. Reason: clarification
lol.... that is some funny shit...
Quite amusing; would've been moreso if the implied accusation was accurate, but, still, worthy of the guffaw it got out of me.