aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Chat.cpp2
-rw-r--r--src/game/Level3.cpp4
-rw-r--r--src/game/MiscHandler.cpp2
-rw-r--r--src/game/Pet.cpp4
-rw-r--r--src/game/Player.cpp26
-rw-r--r--src/game/Player.h2
-rw-r--r--src/shared/Database/DBCStores.cpp4
-rw-r--r--src/shared/Database/DBCStructure.h5
8 files changed, 26 insertions, 23 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 5b194373f91..026111cbcb0 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -1431,7 +1431,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text)
return 0;
int32 rank = param1_str ? (uint32)atol(param1_str) : 0;
- if(rank >= 5)
+ if(rank >= MAX_TALENT_RANK)
return 0;
if(rank < 0)
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 51aa6930a76..13ea1a33ff3 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -2299,8 +2299,8 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/)
// search highest talent rank
uint32 spellid = 0;
- int rank = 4;
- for(; rank >= 0; --rank)
+
+ for(int rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
if(talentInfo->RankID[rank]!=0)
{
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index b284db806d7..7dc3154bec7 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1198,7 +1198,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
// find talent rank
uint32 curtalent_maxrank = 0;
- for(uint32 k = 5; k > 0; --k)
+ for(uint32 k = MAX_TALENT_RANK; k > 0; --k)
{
if(talentInfo->RankID[k-1] && plr->HasSpell(talentInfo->RankID[k-1]))
{
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 5200ebf1d3d..02f09991650 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -1267,7 +1267,7 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell
{
if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
{
- for(int i=0; i <5; ++i)
+ for(int i=0; i < MAX_TALENT_RANK; ++i)
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[i];
@@ -1544,7 +1544,7 @@ bool Pet::resetTalents(bool no_cost)
if(!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
continue;
- for (int j = 0; j < 5; j++)
+ for (int j = 0; j < MAX_TALENT_RANK; j++)
{
for(PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();)
{
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index db7f0ad1ae9..0dcd07a956e 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -2818,7 +2818,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
{
- for(int i=0; i <5; ++i)
+ for(int i=0; i < MAX_TALENT_RANK; ++i)
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[i];
@@ -3440,7 +3440,7 @@ bool Player::resetTalents(bool no_cost)
if( (getClassMask() & talentTabInfo->ClassMask) == 0 )
continue;
- for (int j = 0; j < 5; j++)
+ for (int j = 0; j < MAX_TALENT_RANK; j++)
{
for(PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
{
@@ -20627,7 +20627,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
if(CurTalentPoints == 0)
return;
- if (talentRank > 4)
+ if (talentRank >= MAX_TALENT_RANK)
return;
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId );
@@ -20646,7 +20646,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
- for(int32 k = 4; k > -1; --k)
+ for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))
{
@@ -20669,7 +20669,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
- for (int i = talentInfo->DependsOnRank; i <= 4; i++)
+ for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++)
{
if (depTalentInfo->RankID[i] != 0)
if (HasSpell(depTalentInfo->RankID[i]))
@@ -20695,7 +20695,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
{
if (tmpTalent->TalentTab == tTab)
{
- for (int j = 0; j <= 4; j++)
+ for (int j = 0; j < MAX_TALENT_RANK; j++)
{
if (tmpTalent->RankID[j] != 0)
{
@@ -20711,7 +20711,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
- if(spentPoints < (talentInfo->Row * 5))
+ if(spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
return;
// spell not set in talent.dbc
@@ -20749,7 +20749,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if(CurTalentPoints == 0)
return;
- if (talentRank > 2)
+ if (talentRank >= MAX_PET_TALENT_RANK)
return;
TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId);
@@ -20781,7 +20781,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
- for(int32 k = 4; k > -1; --k)
+ for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && pet->HasSpell(talentInfo->RankID[k]))
{
@@ -20804,7 +20804,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
- for (int i = talentInfo->DependsOnRank; i <= 4; i++)
+ for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++)
{
if (depTalentInfo->RankID[i] != 0)
if (pet->HasSpell(depTalentInfo->RankID[i]))
@@ -20830,7 +20830,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
{
if (tmpTalent->TalentTab == tTab)
{
- for (int j = 0; j <= 4; j++)
+ for (int j = 0; j < MAX_TALENT_RANK; j++)
{
if (tmpTalent->RankID[j] != 0)
{
@@ -20846,7 +20846,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
- if(spentPoints < (talentInfo->Row * 3))
+ if(spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
return;
// spell not set in talent.dbc
@@ -20863,7 +20863,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// learn! (other talent ranks will unlearned at learning)
pet->learnSpell(spellid);
- sLog.outDetail("TalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
+ sLog.outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
// update free talent points
pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
diff --git a/src/game/Player.h b/src/game/Player.h
index 3019babd7ba..d425011cfb7 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -627,7 +627,7 @@ enum KeyRingSlots // 32 slots
enum VanityPetSlots // 18 slots
{
VANITYPET_SLOT_START = 118, // not use, vanity pets stored as spells
- VANITYPET_SLOT_END = 136 // not alloed any content in.
+ VANITYPET_SLOT_END = 136 // not allowed any content in.
};
enum CurrencyTokenSlots // 32 slots
diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp
index b15bb456945..9589865b9ac 100644
--- a/src/shared/Database/DBCStores.cpp
+++ b/src/shared/Database/DBCStores.cpp
@@ -345,7 +345,7 @@ void LoadDBCStores(const std::string& dataPath)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
- for (int j = 0; j < 5; j++)
+ for (int j = 0; j < MAX_TALENT_RANK; j++)
if(talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
@@ -369,7 +369,7 @@ void LoadDBCStores(const std::string& dataPath)
// find talent rank
uint32 curtalent_maxrank = 0;
- for(uint32 k = 5; k > 0; --k)
+ for(uint32 k = MAX_TALENT_RANK; k > 0; --k)
{
if(talentInfo->RankID[k-1])
{
diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h
index 6fb43567a3a..ec60105a230 100644
--- a/src/shared/Database/DBCStructure.h
+++ b/src/shared/Database/DBCStructure.h
@@ -1408,13 +1408,16 @@ struct SummonPropertiesEntry
uint32 Flags; // 5
};
+#define MAX_TALENT_RANK 5
+#define MAX_PET_TALENT_RANK 3 // use in calculations, expected <= MAX_TALENT_RANK
+
struct TalentEntry
{
uint32 TalentID; // 0
uint32 TalentTab; // 1 index in TalentTab.dbc (TalentTabEntry)
uint32 Row; // 2
uint32 Col; // 3
- uint32 RankID[5]; // 4-8
+ uint32 RankID[MAX_TALENT_RANK]; // 4-8
// 9-12 not used, always 0, maybe not used high ranks
uint32 DependsOn; // 13 index in Talent.dbc (TalentEntry)
// 14-15 not used