From 9509b11f38fc7dc42ab81241c56132932ce24cb7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 14 Feb 2010 15:56:49 +0300 Subject: [PATCH] [9378] Not report action button porblems at spec activation. Action bar copied at spec creating and base at fact that talents not copied possible cases when action bars not apporpriate for created spec. So let its drop silencely --- src/game/Player.cpp | 61 +++++++++++++++++++++++----------------- src/game/Player.h | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6768922fc..a24a4c6e1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5650,23 +5650,30 @@ void Player::SendInitialActionButtons() const sLog.outDetail( "Action Buttons for '%u' Initialized", GetGUIDLow() ); } -bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player) +bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player, bool msg) { if(button >= MAX_ACTION_BUTTONS) { - if (player) - sLog.outError( "Action %u not added into button %u for player %s: button must be < %u", action, button, player->GetName(), MAX_ACTION_BUTTONS ); - else - sLog.outError( "Table `playercreateinfo_action` have action %u into button %u : button must be < %u", action, button, MAX_ACTION_BUTTONS ); + if (msg) + { + if (player) + sLog.outError( "Action %u not added into button %u for player %s: button must be < %u", action, button, player->GetName(), MAX_ACTION_BUTTONS ); + else + sLog.outError( "Table `playercreateinfo_action` have action %u into button %u : button must be < %u", action, button, MAX_ACTION_BUTTONS ); + + } return false; } if(action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - if (player) - sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, player->GetName(), MAX_ACTION_BUTTON_ACTION_VALUE ); - else - sLog.outError( "Table `playercreateinfo_action` have action %u into button %u : action must be < %u", action, button, MAX_ACTION_BUTTON_ACTION_VALUE ); + if (msg) + { + if (player) + sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, player->GetName(), MAX_ACTION_BUTTON_ACTION_VALUE ); + else + sLog.outError( "Table `playercreateinfo_action` have action %u into button %u : action must be < %u", action, button, MAX_ACTION_BUTTON_ACTION_VALUE ); + } return false; } @@ -5675,26 +5682,33 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Pl case ACTION_BUTTON_SPELL: if(!sSpellStore.LookupEntry(action)) { - if (player) - sLog.outError( "Spell action %u not added into button %u for player %s: spell not exist", action, button, player->GetName() ); - else - sLog.outError( "Table `playercreateinfo_action` have spell action %u into button %u: spell not exist", action, button ); + if (msg) + { + if (player) + sLog.outError( "Spell action %u not added into button %u for player %s: spell not exist", action, button, player->GetName() ); + else + sLog.outError( "Table `playercreateinfo_action` have spell action %u into button %u: spell not exist", action, button ); + } return false; } if(player && !player->HasSpell(action)) { - sLog.outError( "Spell action %u not added into button %u for player %s: player don't known this spell", action, button, player->GetName() ); + if (msg) + sLog.outError( "Spell action %u not added into button %u for player %s: player don't known this spell", action, button, player->GetName() ); return false; } break; case ACTION_BUTTON_ITEM: if(!ObjectMgr::GetItemPrototype(action)) { - if (player) - sLog.outError( "Item action %u not added into button %u for player %s: item not exist", action, button, player->GetName() ); - else - sLog.outError( "Table `playercreateinfo_action` have item action %u into button %u: item not exist", action, button ); + if (msg) + { + if (player) + sLog.outError( "Item action %u not added into button %u for player %s: item not exist", action, button, player->GetName() ); + else + sLog.outError( "Table `playercreateinfo_action` have item action %u into button %u: item not exist", action, button ); + } return false; } break; @@ -21407,8 +21421,9 @@ void Player::ActivateSpec(uint8 specNum) ActionButtonList const& currentActionButtonList = m_actionButtons[m_activeSpec]; for(ActionButtonList::const_iterator itr = currentActionButtonList.begin(); itr != currentActionButtonList.end(); ++itr) if (itr->second.uState != ACTIONBUTTON_DELETED) - if (!IsActionButtonDataValid(itr->first,itr->second.GetAction(),itr->second.GetType(), this)) - removeActionButton(m_activeSpec,itr->first); + // remove broken without any output (it can be not correct because talents not copied at spec creating) + if (!IsActionButtonDataValid(itr->first,itr->second.GetAction(),itr->second.GetType(), this, false)) + removeActionButton(m_activeSpec,itr->first); ApplyGlyphAuras(true); @@ -21441,10 +21456,6 @@ void Player::UpdateSpecCount(uint8 count) addActionButton(spec,itr->first,itr->second.GetAction(),itr->second.GetType()); } } - - // other data copy - // for(uint8 spec = curCount; spec < count; ++spec) - // ... } // delete spec data for removed specs else if (count < curCount) @@ -21455,8 +21466,6 @@ void Player::UpdateSpecCount(uint8 count) // delete action buttons for removed spec for(uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button) removeActionButton(spec,button); - - // other data remove } } diff --git a/src/game/Player.h b/src/game/Player.h index 959373941..feefc85bd 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1653,7 +1653,7 @@ class MANGOS_DLL_SPEC Player : public Unit m_cinematic = cine; } - static bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player); + static bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player, bool msg = true); ActionButton* addActionButton(uint8 spec, uint8 button, uint32 action, uint8 type); void removeActionButton(uint8 spec, uint8 button); void SendInitialActionButtons() const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5d7ad68c4..c22ce7f8b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9377" + #define REVISION_NR "9378" #endif // __REVISION_NR_H__