diff options
author | Machiavelli <none@none> | 2009-08-15 23:31:58 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-08-15 23:31:58 +0200 |
commit | 00d53460c8dc34fbc0ea038973943a7ea666cd3d (patch) | |
tree | 9a26b8c1a99cea4f70827295091fdcfb07ae1e3a /src | |
parent | eb9d9ff071936aa0b3b8aead01025da77e1c6b2a (diff) |
* Better way to toggle between action bars for duel speccing, with help from thenecromancer's patch, thank you.
* Correctly adopt spec 1's action bars into spec 2 when learning a new spec.
* Correct handling for UpdateSpecCount where count == 1.
* Other small cleanup and consistency variables.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 30 | ||||
-rw-r--r-- | src/game/Player.h | 4 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 3 |
3 files changed, 21 insertions, 16 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d1358e5a5c3..8fc7a170f70 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5771,12 +5771,12 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const return 0; } -void Player::SendActionButtons(uint32 spec) const +void Player::SendActionButtons(uint32 state) const { - sLog.outDetail( "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), spec ); + sLog.outDetail( "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); - data << uint8(spec); // can be 0, 1, 2 (talent spec) + data << uint8(state); // can be 0, 1, 2 for(int button = 0; button < MAX_ACTION_BUTTONS; ++button) { ActionButtonList::const_iterator itr = m_actionButtons.find(button); @@ -5787,7 +5787,7 @@ void Player::SendActionButtons(uint32 spec) const } GetSession()->SendPacket( &data ); - sLog.outDetail( "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), spec ); + sLog.outDetail( "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec ); } ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) @@ -15067,7 +15067,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) delete result; // sanity check - if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPECS) // if (m_specsCount < 2) is not logical + if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || + m_specsCount < MIN_TALENT_SPECS || m_activeSpec < MIN_TALENT_SPEC ) // if (m_specsCount < 2) is not logical { m_activeSpec = 0; sLog.outError("Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName(), GetGUIDLow(), m_specsCount, m_activeSpec); @@ -15231,9 +15232,7 @@ bool Player::isAllowedToLoot(Creature* creature) void Player::_LoadActions(QueryResult *result) { m_actionButtons.clear(); - - //QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow()); - + if(result) { do @@ -16382,7 +16381,7 @@ void Player::_SaveActions() ++itr; break; case ACTIONBUTTON_DELETED: - CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u' and button = '%u'", GetGUIDLow(), (uint32)itr->first ); + CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, (uint32)m_activeSpec ); m_actionButtons.erase(itr++); break; default: @@ -21703,20 +21702,21 @@ void Player::UpdateSpecCount(uint8 count) if(GetSpecsCount() == count) return; - if(count == 1) + if(count == MIN_TALENT_SPECS) { _SaveActions(); // make sure the button list is cleaned up // active spec becomes only spec? CharacterDatabase.PExecute("DELETE FROM character_action WHERE spec<>'%u' AND guid='%u'",m_activeSpec, GetGUIDLow()); - CharacterDatabase.PExecute("UPDATE character_action SET spec='%u' WHERE guid='%u'", m_activeSpec, GetGUIDLow()); + CharacterDatabase.PExecute("UPDATE character_action SET spec='0' WHERE guid='%u'", GetGUIDLow()); + m_activeSpec = 0; } - else if (count == 2) + else if (count == MAX_TALENT_SPECS) { _SaveActions(); // make sure the button list is cleaned up for(ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr) { CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type,spec) VALUES ('%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), count ); + GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), 1 ); } } else @@ -21737,6 +21737,8 @@ void Player::ActivateSpec(uint8 spec) if(GetSpecsCount() != MAX_TALENT_SPECS) return; + _SaveActions(); + uint32 const* talentTabIds = GetTalentTabPages(getClass()); for(uint8 i = 0; i < 3; ++i) @@ -21832,6 +21834,6 @@ void Player::ActivateSpec(uint8 spec) _LoadActions(result); } UnsummonPetTemporaryIfAny(); - SendActionButtons(m_activeSpec); + SendActionButtons(1); SetPower(getPowerType(), 0); } diff --git a/src/game/Player.h b/src/game/Player.h index 71cf1852b0b..7d417ffda11 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1480,7 +1480,7 @@ class MANGOS_DLL_SPEC Player : public Unit // Dual Spec void UpdateSpecCount(uint8 count); uint32 GetActiveSpec() { return m_activeSpec; } - void SetActiveSpec(uint8 spec) { m_activeSpec = spec; } + void SetActiveSpec(uint8 spec){ m_activeSpec = spec; } uint8 GetSpecsCount() { return m_specsCount; } void SetSpecsCount(uint8 count) { m_specsCount = count; } void ActivateSpec(uint8 spec); @@ -1568,7 +1568,7 @@ class MANGOS_DLL_SPEC Player : public Unit ActionButton* addActionButton(uint8 button, uint32 action, uint8 type); void removeActionButton(uint8 button); void SendInitialActionButtons() const { SendActionButtons(0); } - void SendActionButtons(uint32 spec) const; + void SendActionButtons(uint32 state) const; PvPInfo pvpInfo; void UpdatePvPState(bool onlyFFA = false); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ffd6c0ce2ee..ad94bf4e6f2 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -450,6 +450,9 @@ enum SpellCategory #define SPELL_ATTR_EX6_UNK30 0x40000000 // 30 not set in 3.0.3 #define SPELL_ATTR_EX6_UNK31 0x80000000 // 31 not set in 3.0.3 +#define MIN_TALENT_SPEC 0 +#define MAX_TALENT_SPEC 1 +#define MIN_TALENT_SPECS 1 #define MAX_TALENT_SPECS 2 #define MAX_GLYPH_SLOT_INDEX 6 |