ok guys,
this WASNT made by me, and i give full credits to who ever did.
i just changed it so i could use it ALOT easyer, instead of all the other stuff.
it just uses GUID.
// Function Taken and modified from
// NoMorePasting.com
// Thanks to who ever made it
basicly this gets PlayerName from GUID.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsoleDruidHeals.Managers;
namespace ConsoleDruidHeals.WoWFunctions
{
internal enum UnitName : uint
{
PlayerNameCachePointer = 0xC9ACC0 + 0x08,
PlayerNameMaskOffset = 0x024,
PlayerNameBaseOffset = 0x01c,
PlayerNameStringOffset = 0x020
}
public static class PlayerNames
{
// Function Taken and modified from
// http://www.nomorepasting.com/getpaste.php?pasteid=17694
// Thanks to who ever made it
public static string GetPlayerName(ulong GUID)
{
uint var1 = ProcessManager.WoWProcess.ReadUInt((uint)UnitName.PlayerNameCachePointer + (uint)UnitName.PlayerNameMaskOffset);
//here we're getting the pointer to the start of the linked list
uint var2 = ProcessManager.WoWProcess.ReadUInt((uint)UnitName.PlayerNameCachePointer + (uint)UnitName.PlayerNameBaseOffset);
var1 &= (uint)GUID;
var1 += var1 * 2;
var1 = (var2 + (var1 * 4) + 4);
var1 = ProcessManager.WoWProcess.ReadUInt((var1 + 4));
//iterate through the linked list until the current entry has
//the same GUID as the object whose name we want
while (ProcessManager.WoWProcess.ReadUInt(var1) != (uint)GUID)
{
uint var3 = ProcessManager.WoWProcess.ReadUInt((uint)UnitName.PlayerNameCachePointer + (uint)UnitName.PlayerNameBaseOffset);
var2 = (uint)GUID;
var2 &= ProcessManager.WoWProcess.ReadUInt((uint)UnitName.PlayerNameCachePointer + (uint)UnitName.PlayerNameMaskOffset);
var2 += var2 * 2;
var2 = ProcessManager.WoWProcess.ReadUInt(var3 + (var2 * 4));
var2 += var1;
var1 = ProcessManager.WoWProcess.ReadUInt(var2 + 4);
}
//now that we have the correct entry in the linked list,
//read its name from entry+0x20
return ProcessManager.WoWProcess.ReadASCIIString(var1 + (uint)UnitName.PlayerNameStringOffset, 40);
}
}
}