*Add Dual Spec support, original by EnderGT, thanks to Thyros and XTElite1 for helping me test :)

--HG--
branch : trunk
This commit is contained in:
maximius
2009-08-14 17:24:52 -07:00
parent c7aa2f64e3
commit 2fd68eab44
12 changed files with 532 additions and 42 deletions
+33 -8
View File
@@ -94,6 +94,12 @@ struct PlayerSpell
bool disabled : 1; // first rank has been learned in result talent learn but currently talent unlearned, save max learned ranks
};
struct PlayerTalent
{
PlayerSpellState state : 8;
uint8 spec : 8;
};
// Spell modifier (used for modify other spells)
struct SpellModifier
{
@@ -107,6 +113,7 @@ struct SpellModifier
Aura *const ownerAura;
};
typedef UNORDERED_MAP<uint32, PlayerTalent*> PlayerTalentMap;
typedef UNORDERED_MAP<uint32, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList;
@@ -790,7 +797,9 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19,
PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20,
PLAYER_LOGIN_QUERY_LOADBGDATA = 21,
MAX_PLAYER_LOGIN_QUERY = 22
PLAYER_LOGIN_QUERY_LOADGLYPHS = 22,
PLAYER_LOGIN_QUERY_LOADTALENTS = 23,
MAX_PLAYER_LOGIN_QUERY = 24
};
enum PlayerDelayedOperations
@@ -1463,20 +1472,28 @@ class MANGOS_DLL_SPEC Player : public Unit
void LearnTalent(uint32 talentId, uint32 talentRank);
void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank);
bool AddTalent(uint32 spell, uint8 spec, bool learning);
bool HasTalent(uint32 spell_id, uint8 spec) const;
uint32 CalculateTalentsPoints() const;
// Dual Spec
void UpdateSpecCount(uint8 count);
uint32 GetActiveSpec() { return m_activeSpec; }
void SetActiveSpec(uint32 spec) { m_activeSpec = spec; }
uint32 GetSpecsCount() { return m_specsCount; }
void SetSpecsCount(uint32 count) { m_specsCount = count; }
void ActivateSpec(uint32 specNum);
void SetActiveSpec(uint8 spec) { m_activeSpec = spec; }
uint8 GetSpecsCount() { return m_specsCount; }
void SetSpecsCount(uint8 count) { m_specsCount = count; }
void ActivateSpec(uint8 spec);
void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
void SetGlyph(uint8 slot, uint32 glyph) { SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); }
uint32 GetGlyph(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot); }
void SetGlyph(uint8 slot, uint32 glyph)
{
m_Glyphs[m_activeSpec][slot] = glyph;
SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph);
}
uint32 GetGlyph(uint8 slot) { return m_Glyphs[m_activeSpec][slot]; }
uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); }
@@ -1550,7 +1567,8 @@ class MANGOS_DLL_SPEC Player : public Unit
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
void removeActionButton(uint8 button);
void SendInitialActionButtons() const;
void SendInitialActionButtons() const { SendActionButtons(0); }
void SendActionButtons(uint32 spec) const;
PvPInfo pvpInfo;
void UpdatePvPState(bool onlyFFA = false);
@@ -2238,6 +2256,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadArenaTeamInfo(QueryResult *result);
void _LoadEquipmentSets(QueryResult *result);
void _LoadBGData(QueryResult* result);
void _LoadGlyphs(QueryResult *result);
void _LoadTalents(QueryResult *result);
/*********************************************************/
/*** SAVE SYSTEM ***/
@@ -2252,6 +2272,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void _SaveSpells();
void _SaveEquipmentSets();
void _SaveBGData();
void _SaveGlyphs();
void _SaveTalents();
void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
@@ -2300,11 +2322,14 @@ class MANGOS_DLL_SPEC Player : public Unit
PlayerMails m_mail;
PlayerSpellMap m_spells;
PlayerTalentMap *m_talents[MAX_TALENT_SPECS];
uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
uint32 m_activeSpec;
uint32 m_specsCount;
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX];
ActionButtonList m_actionButtons;
float m_auraBaseMod[BASEMOD_END][MOD_END];