[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
This commit is contained in:
VladimirMangos 2010-02-14 15:56:49 +03:00
parent ec26a61b5d
commit 9509b11f38
3 changed files with 37 additions and 28 deletions

View file

@ -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 (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 (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;
}
@ -5674,27 +5681,34 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Pl
{
case ACTION_BUTTON_SPELL:
if(!sSpellStore.LookupEntry(action))
{
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))
{
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 (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,7 +21421,8 @@ 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))
// 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
}
}

View file

@ -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;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9377"
#define REVISION_NR "9378"
#endif // __REVISION_NR_H__