mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8519] Use RuneType enum where appropriate and more explicit data for rune init.
This commit is contained in:
parent
e4ed2ce29c
commit
1c59403b39
6 changed files with 24 additions and 15 deletions
|
|
@ -19599,7 +19599,7 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
|
|||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::ConvertRune(uint8 index, uint8 newType)
|
||||
void Player::ConvertRune(uint8 index, RuneType newType)
|
||||
{
|
||||
SetCurrentRune(index, newType);
|
||||
|
||||
|
|
@ -19627,6 +19627,15 @@ void Player::AddRunePower(uint8 index)
|
|||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
static RuneType runeSlotTypes[MAX_RUNES] = {
|
||||
/*0*/ RUNE_BLOOD,
|
||||
/*1*/ RUNE_BLOOD,
|
||||
/*2*/ RUNE_UNHOLY,
|
||||
/*3*/ RUNE_UNHOLY,
|
||||
/*4*/ RUNE_FROST,
|
||||
/*5*/ RUNE_FROST
|
||||
};
|
||||
|
||||
void Player::InitRunes()
|
||||
{
|
||||
if(getClass() != CLASS_DEATH_KNIGHT)
|
||||
|
|
@ -19638,8 +19647,8 @@ void Player::InitRunes()
|
|||
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
SetBaseRune(i, i / 2); // init base types
|
||||
SetCurrentRune(i, i / 2); // init current types
|
||||
SetBaseRune(i, runeSlotTypes[i]); // init base types
|
||||
SetCurrentRune(i, runeSlotTypes[i]); // init current types
|
||||
SetRuneCooldown(i, 0); // reset cooldowns
|
||||
m_runes->SetRuneState(i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2206,13 +2206,13 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
|
||||
DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
|
||||
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; }
|
||||
RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); }
|
||||
RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); }
|
||||
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 SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
|
||||
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
|
||||
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 ConvertRune(uint8 index, RuneType newType);
|
||||
void ResyncRunes(uint8 count);
|
||||
void AddRunePower(uint8 index);
|
||||
void InitRunes();
|
||||
|
|
|
|||
|
|
@ -3540,7 +3540,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
|
|||
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
runeCost[rune]--;
|
||||
}
|
||||
|
|
@ -3583,7 +3583,7 @@ void Spell::TakeRunePower()
|
|||
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
|
|
@ -3597,7 +3597,7 @@ void Spell::TakeRunePower()
|
|||
{
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
|
|
|
|||
|
|
@ -7280,13 +7280,13 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real)
|
|||
{
|
||||
if(!plr->GetRuneCooldown(i))
|
||||
{
|
||||
plr->ConvertRune(i, GetSpellProto()->EffectMiscValueB[m_effIndex]);
|
||||
plr->ConvertRune(i, RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(plr->GetCurrentRune(i) == GetSpellProto()->EffectMiscValueB[m_effIndex])
|
||||
if(plr->GetCurrentRune(i) == RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex]))
|
||||
{
|
||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -6881,7 +6881,7 @@ void Spell::EffectActivateRune(uint32 eff_idx)
|
|||
|
||||
for(uint32 j = 0; j < MAX_RUNES; ++j)
|
||||
{
|
||||
if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == m_spellInfo->EffectMiscValue[eff_idx])
|
||||
if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx]))
|
||||
{
|
||||
plr->SetRuneCooldown(j, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8518"
|
||||
#define REVISION_NR "8519"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue