mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Rune system fix, dk crash fix
This commit is contained in:
parent
cb09bd72d3
commit
60b8f30898
4 changed files with 33 additions and 33 deletions
|
|
@ -839,4 +839,3 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket *data)
|
|||
|
||||
*data << int32(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1890,9 +1890,9 @@ void Player::Regenerate(Powers power)
|
|||
} break;
|
||||
case POWER_RUNE:
|
||||
{
|
||||
for(uint32 i = 0; i < 6; ++i)
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
if(uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it...
|
||||
SetRuneCooldown(i, cd - 1); // by 2 sec (because update is every 2 sec)
|
||||
SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec)
|
||||
} break;
|
||||
case POWER_FOCUS:
|
||||
case POWER_HAPPINESS:
|
||||
|
|
@ -14083,6 +14083,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
InitStatsForLevel();
|
||||
InitTaxiNodesForLevel();
|
||||
InitGlyphsForLevel();
|
||||
InitRunes();
|
||||
|
||||
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
|
||||
|
||||
|
|
@ -14239,8 +14240,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
_LoadDeclinedNames(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES));
|
||||
|
||||
InitRunes();
|
||||
|
||||
m_achievementMgr.LoadFromDB(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS));
|
||||
m_achievementMgr.CheckAllAchievementCriteria();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -238,9 +238,9 @@ enum RuneType
|
|||
|
||||
struct RuneInfo
|
||||
{
|
||||
uint8 BaseRune:1;
|
||||
uint8 CurrentRune:1;
|
||||
uint8 Cooldown:1;
|
||||
uint8 BaseRune;
|
||||
uint8 CurrentRune;
|
||||
uint8 Cooldown;
|
||||
};
|
||||
|
||||
struct Runes
|
||||
|
|
@ -2092,16 +2092,9 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
WorldLocation& GetTeleportDest() { return m_teleport_dest; }
|
||||
|
||||
DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
|
||||
RuneInfo const* GetRuneInfo(uint8 index) { return &m_runes->runes[index]; }
|
||||
uint8 GetBaseRune(uint8 index) { return m_runes->runes[index].BaseRune; }
|
||||
uint8 GetCurrentRune(uint8 index) { return m_runes->runes[index].CurrentRune; }
|
||||
uint8 GetRuneCooldown(uint8 index) { return m_runes->runes[index].Cooldown; }
|
||||
void SetRuneInfo(uint8 index, uint8 baseRune, uint8 currentRune, uint8 cooldown)
|
||||
{
|
||||
m_runes->runes[index].BaseRune = baseRune;
|
||||
m_runes->runes[index].CurrentRune = currentRune;
|
||||
m_runes->runes[index].Cooldown = cooldown;
|
||||
}
|
||||
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; }
|
||||
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; }
|
||||
|
|
|
|||
|
|
@ -3160,20 +3160,31 @@ uint8 Spell::CheckRuneCost(uint32 runeCostID)
|
|||
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
||||
|
||||
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||
{
|
||||
runeCost[i] = src->RuneCost[i];
|
||||
}
|
||||
|
||||
runeCost[RUNE_DEATH] = 0; // calculated later
|
||||
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
if(!plr->GetRuneCooldown(i))
|
||||
runeCost[plr->GetCurrentRune(i)]--;
|
||||
{
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
{
|
||||
runeCost[rune]--;
|
||||
}
|
||||
}
|
||||
|
||||
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||
{
|
||||
if(runeCost[i] > 0)
|
||||
{
|
||||
runeCost[RUNE_DEATH] += runeCost[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(runeCost[RUNE_DEATH] > 0)
|
||||
return SPELL_FAILED_REAGENTS; // not sure if result code is correct
|
||||
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3196,20 +3207,19 @@ void Spell::TakeRunePower()
|
|||
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
||||
|
||||
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||
{
|
||||
runeCost[i] = src->RuneCost[i];
|
||||
}
|
||||
|
||||
runeCost[RUNE_DEATH] = 0; // calculated later
|
||||
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
if(!plr->GetRuneCooldown(i))
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
{
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
if(runeCost[rune] > 0)
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
runeCost[rune]--;
|
||||
}
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
runeCost[rune]--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3219,13 +3229,12 @@ void Spell::TakeRunePower()
|
|||
{
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
if(!plr->GetRuneCooldown(i) && plr->GetCurrentRune(i) == RUNE_DEATH)
|
||||
uint8 rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
runeCost[plr->GetCurrentRune(i)]--;
|
||||
uint8 base = plr->GetBaseRune(i);
|
||||
plr->SetCurrentRune(i, base);
|
||||
plr->ConvertRune(i, base);
|
||||
runeCost[rune]--;
|
||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
||||
if(runeCost[RUNE_DEATH] == 0)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue