Core/Player: update rune regeneration and consumption for Cataclysm Classic

* the regeneration bonus from haste is tied to the HasteRegen update field and must be implemented first before we can handle it
This commit is contained in:
Ovahlord
2024-07-11 17:13:55 +02:00
parent 3bb327b2bc
commit fe97a86415
5 changed files with 296 additions and 164 deletions
+5 -8
View File
@@ -758,7 +758,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
Player const* player = ToPlayer();
bool HasSceneInstanceIDs = !player->GetSceneMgr().GetSceneTemplateByInstanceMap().empty();
bool HasRuneState = ToUnit()->GetPowerIndex(POWER_RUNES) != MAX_POWERS;
bool HasRuneState = ToUnit()->GetPowerIndex(POWER_RUNE_BLOOD) != MAX_POWERS;
bool HasActionButtons = true;
data->WriteBit(HasSceneInstanceIDs);
@@ -773,14 +773,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
}
if (HasRuneState)
{
float baseCd = float(player->GetRuneBaseCooldown());
uint32 maxRunes = uint32(player->GetMaxPower(POWER_RUNES));
*data << uint8((1 << maxRunes) - 1);
*data << uint8((1 << MAX_RUNES) - 1);
*data << uint8(player->GetRunesState());
*data << uint32(maxRunes);
for (uint32 i = 0; i < maxRunes; ++i)
*data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255);
*data << uint32(MAX_RUNES);
for (uint32 i = 0; i < MAX_RUNES; ++i)
*data << uint8(player->GetRuneCooldown(i) * uint32(255) / uint32(RUNE_BASE_COOLDOWN));
}
if (HasActionButtons)
{