This is what i use in C++ (power types)
PHP Code:
enum class WoWPowerType
{
Mana,
Rage,
Focus,
Energy,
Chi,
Runes,
RunicPower,
SoulShards,
Eclipse,
HolyPower,
Alternate,
DarkForce,
LightForce,
ShadowOrbs,
BurningEmbers,
DemonicFury,
};
WoWPowerType WoWUnit::GetPowerType()
{
uint32 overridePowerId = Descriptor<uint32>(UNIT_FIELD_OVERRIDE_DISPLAY_POWER_ID);
if (overridePowerId == 0)
return (WoWPowerType)(Descriptor<uint32>(UNIT_FIELD_DISPLAY_POWER) & 0xFF);
else
return (WoWPowerType)overridePowerId;
}
std::string WoWUnit::GetPowerTypeName()
{
switch (PowerType)
{
case WoWPowerType::Mana: return "Mana";
case WoWPowerType::Rage: return "Rage";
case WoWPowerType::Focus: return "Focus";
case WoWPowerType::Chi: return "Chi";
case WoWPowerType::Runes: return "Runes";
case WoWPowerType::RunicPower: return "Runic Power";
case WoWPowerType::SoulShards: return "Soulshards";
case WoWPowerType::Eclipse: return "Eclipse";
case WoWPowerType::HolyPower: return "Holy Power";
case WoWPowerType::Alternate: return "Alternate";
case WoWPowerType::DarkForce: return "Dark Force";
case WoWPowerType::LightForce: return "Light Force";
case WoWPowerType::ShadowOrbs: return "Shadow Orbs";
case WoWPowerType::BurningEmbers: return "Burning Embers";
case WoWPowerType::DemonicFury: return "Demonic Fury";
default: return "";
}
}
Getting auras is a bit more complicated then reading an address but I'll post the code I use for it here
You have to search for the offsets, I have not updated them for 6.2 yet.
In this function I also search for matching string in a table of all the spells in the game, you can just modify it to work with spell ids.
PHP Code:
bool WoWUnit::HasAura(std::string name)
{
uint32 auraCount = Read<uint32>(UnitAuraCount1);
uint32 auraTable = Read<uint32>(UnitAuraTable1);
if (auraCount == -1)
{
auraCount = Read<uint32>(UnitAuraCount2);
auraTable = Read<uint32>(UnitAuraTable2);
}
for (uint32 i = 0; i < auraCount; ++i)
{
uint32 base = (auraTable + (UnitAuraSize * i));
WoWGuid ownerGuid;
uint32 spellId;
int8 flags;
int8 stack;
uint32 level;
uint32 size;
ownerGuid.LoWord = ReadRelative<uint64>(base + UnitAuraOwnerGUID);
ownerGuid.HiWord = ReadRelative<uint64>(base + (UnitAuraOwnerGUID + 0x8));
spellId = ReadRelative<uint32>(base + UnitAuraSpellId);
flags = ReadRelative<int8>(base + UnitAuraFlags);
stack = ReadRelative<int8>(base + UnitAuraStack);
level = ReadRelative<uint32>(base + UnitAuraCasterLevel);
// time left
size = ReadRelative<uint32>(base + UnitAuraSize);
if (spellId && (flags & 20)) // Filter out spells without id and flag 0x20 (whatever that is, but it works)
if (m_ObjMgr->Spell[spellId] == name) // Should probably make a SpellManager class...
return true;
}
return false;
}
That should get you started.
Edit:
Oh and I think alternative powers are in the descriptors, UNIT_FIELD_POWER takes up 6 DWORDs, just look it up in CE and see what is what.