Skip to content
Permalink
Browse files

Update WoW Plugin to build 19034

Update WoW plugin, including switching to 128-bit GUIDs, which I've
naively done with a structure containing two 64-bit integers instead.
There's probably a nicer way to do this.
  • Loading branch information...
fwaggle authored and mkrautz committed Oct 17, 2014
1 parent 78b6cc4 commit 8ab0c4a6b14976b921dbfd0d3f341b6ab8de7c92
Showing with 47 additions and 32 deletions.
  1. +47 −32 plugins/wow/wow.cpp
@@ -39,8 +39,13 @@ typedef long long uint64_t;

#include "../mumble_plugin_win32.h"

struct guid {
uint64_t first;
uint64_t second;
};

uint32_t p_playerBase;
uint64_t g_playerGUID;
guid g_playerGUID;

/*
* To update visit http://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing
@@ -50,10 +55,11 @@ uint64_t g_playerGUID;
* call each value, to ease in upgrading. "[_]" means the value name may or may not
* have an underscore in it depending on who's posting the offset.
*/
static uint32_t ptr_ClientConnection=0xEC4628; // ClientConnection or CurMgrPointer
static size_t off_ObjectManager=0x462C; // objectManager or CurMgrOffset
static uint32_t ptr_WorldFrame=0xD64E5C; // Camera[_]Pointer
static size_t off_CameraOffset=0x8208; // Camera[_]Offset
static uint32_t ptr_ClientConnection=0xED38E8; // ClientConnection or CurMgrPointer
static size_t off_ObjectManager=0x62C; // objectManager or CurMgrOffset
static uint32_t ptr_WorldFrame=0xD91A90; // Camera[_]Pointer
static size_t off_CameraOffset=0x7610; // Camera[_]Offset


uint32_t getInt32(uint32_t ptr) {
uint32_t result;
@@ -161,25 +167,29 @@ uint32_t getPlayerBase() {
uint32_t gClientConnection;
uint32_t sCurMgr;
uint32_t curObj;
uint64_t playerGUID;
guid playerGUID;
uint32_t playerBase;

uint32_t nextObj;
uint64_t GUID;
guid GUID;

playerBase=0;

gClientConnection=getInt32((uint32_t)pModule + ptr_ClientConnection);
sCurMgr=getInt32(gClientConnection + off_ObjectManager);
if (sCurMgr != 0) {
playerGUID=getInt64(sCurMgr+0xE8); // localGUID
if (playerGUID != 0) {
g_playerGUID = playerGUID;
curObj=getInt32(sCurMgr+0xCC); // firstObject
playerGUID.first=getInt64(sCurMgr+0xF8); // localGUID
playerGUID.second=getInt64(sCurMgr+0xF8 + 0x8);
if (playerGUID.second != 0) {
g_playerGUID.first = playerGUID.first;
g_playerGUID.second = playerGUID.second;

curObj=getInt32(sCurMgr+0xD8); // firstObject
while (curObj != 0) {
nextObj=getInt32(curObj + 0x34); // nextObject
GUID=getInt64(curObj + 0x28);
if (playerGUID == GUID) {
nextObj=getInt32(curObj + 0x3C); // nextObject
GUID.first=getInt64(curObj + 0x28);
GUID.second=getInt64(curObj + 0x28 + 0x8);
if (playerGUID.first == GUID.first && playerGUID.second == GUID.second) {
playerBase = curObj;
break;
} else if (curObj == nextObj) {
@@ -205,7 +215,8 @@ void getPlayerName(std::wstring &identity) {
** instead of traversing through the NameStore, and since no one's updated
** nameStorePtr yet I figured I'd try just doing it this way.
*/
getWString((uint32_t)pModule +0xEC4668, identity);
getWString((uint32_t)pModule +0xED3928, identity);
// printf("Name: %ls\n", identity.data());
return;

/*
@@ -239,7 +250,6 @@ void getPlayerName(std::wstring &identity) {
}
getWString(current + nameStringOffset, identity);
*/
//printf("%ls\n", identity.data());
}

void getCamera(float camera_pos[3], float camera_front[3], float camera_top[3]) {
@@ -278,7 +288,7 @@ typedef class WowData {
std::wstring nameAvatar;
bool nameAvatarValid;

uint64_t playerGUID;
guid playerGUID;
uint32_t pointerPlayerObject;

public:
@@ -317,22 +327,26 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
}

/* are we still looking at the right object? */
uint64_t peekGUID, tempGUID;
peekGUID=getInt64(p_playerBase+0x30);
if (g_playerGUID != peekGUID) {
guid peekGUID, tempGUID;
peekGUID.first=getInt64(p_playerBase+0x30);
peekGUID.second=getInt64(p_playerBase+0x30+0x8);
if (g_playerGUID.first != peekGUID.first || g_playerGUID.second != peekGUID.second) {
/* no? Try to resynch to the new address. Happens when walking through portals quickly (aka no or short loading screen) */
tempGUID = g_playerGUID;
tempGUID.first = g_playerGUID.first;
tempGUID.second = g_playerGUID.second;
p_playerBase=getPlayerBase();
if (tempGUID != g_playerGUID) {
if (tempGUID.first != g_playerGUID.first || tempGUID.first != g_playerGUID.first) {
/* GUID of actor changed, likely a character and/or realm change */
wow.refresh();
}
peekGUID=getInt64(p_playerBase+0x28);
if (g_playerGUID != peekGUID) {
peekGUID.first=getInt64(p_playerBase+0x28);
peekGUID.second=getInt64(p_playerBase+0x28+0x8);
if (g_playerGUID.first != peekGUID.first || g_playerGUID.second != peekGUID.second) {
/* no? we are still getting the expected GUID for our avatar, but we don't have it's current position */
return true;
}
}

context.clear();
std::wstringstream identityStream;
identityStream << wow.getNameAvatar();
@@ -347,15 +361,16 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
// ... which isn't a right-hand coordinate system.

float pos[3];
ok = ok && peekProc((BYTE *) p_playerBase + 0x838, pos, sizeof(float)*3);
ok = ok && peekProc((BYTE *) p_playerBase + 0xA50, pos, sizeof(float)*3);
if (! ok) {
if (g_playerGUID == 0xffffffffffffffff) {
if (g_playerGUID.second == 0xffffffffffffffff) {
return false;
} else if (g_playerGUID == 0) {
} else if (g_playerGUID.second == 0) {
return true;
} else {
/* FIXME need a better way to mark PlayerBase invalid */
g_playerGUID=0;
g_playerGUID.first=0;
g_playerGUID.second=0;
return true; /* we got a good reference for an avatar, but no good position */
}
}
@@ -366,12 +381,12 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
avatar_pos[2] = pos[0];

float heading=0.0;
ok = ok && peekProc((BYTE *) p_playerBase + 0x848, &heading, sizeof(heading));
ok = ok && peekProc((BYTE *) p_playerBase + 0xA60, &heading, sizeof(heading));
if (! ok)
return false;

float pitch=0.0;
ok = ok && peekProc((BYTE *) p_playerBase + 0x84C, &pitch, sizeof(pitch));
ok = ok && peekProc((BYTE *) p_playerBase + 0xA70, &pitch, sizeof(pitch));
if (! ok)
return false;

@@ -427,10 +442,10 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi
}

static const std::wstring longdesc() {
return std::wstring(L"Supports World of Warcraft 5.4.7 (18291), with identity support.");
return std::wstring(L"Supports World of Warcraft 6.0.2 (19034), with identity support.");
}

static std::wstring description(L"World of Warcraft 5.4.7 (18291)");
static std::wstring description(L"World of Warcraft 6.0.2 (19034)");

static std::wstring shortname(L"World of Warcraft");

0 comments on commit 8ab0c4a

Please sign in to comment.
You can’t perform that action at this time.