[8477] Implemented "on demand" regeneration of power in Spell::CheckPower (limited to 500ms frequency).

Correctly set UNIT_FLAG2_REGENERATE_POWER to notify client to stop/start regen in bar.
thx. also for nos4r2zod

From original patch was removed usage of getMSTime() and rewrited this part.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
Trazom 2009-09-06 01:26:19 +02:00 committed by ApoC
parent 7a2df3c309
commit dffa5d43bd
6 changed files with 63 additions and 32 deletions

View file

@ -269,7 +269,7 @@ struct Areas
};
#define MAX_RUNES 6
#define RUNE_COOLDOWN 5 // 5*2=10 sec
#define RUNE_COOLDOWN 10000 // msec
enum RuneType
{
@ -282,9 +282,9 @@ enum RuneType
struct RuneInfo
{
uint8 BaseRune;
uint8 CurrentRune;
uint8 Cooldown;
uint8 BaseRune;
uint8 CurrentRune;
uint16 Cooldown; // msec
};
struct Runes
@ -1403,9 +1403,9 @@ class MANGOS_DLL_SPEC Player : public Unit
void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker );
void SendPetSkillWipeConfirm();
void CalcRage( uint32 damage,bool attacker );
void RegenerateAll();
void Regenerate(Powers power);
void RegenerateHealth();
void RegenerateAll(uint32 diff = REGEN_TIME_FULL);
void Regenerate(Powers power, uint32 diff);
void RegenerateHealth(uint32 diff);
void setRegenTimer(uint32 time) {m_regenTimer = time;}
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
@ -2208,10 +2208,10 @@ class MANGOS_DLL_SPEC Player : public Unit
uint8 GetRunesState() const { return m_runes->runeState; }
uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; }
uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
uint16 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, uint8 currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
void SetRuneCooldown(uint8 index, uint16 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
void ConvertRune(uint8 index, uint8 newType);
void ResyncRunes(uint8 count);
void AddRunePower(uint8 index);