Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-11-14 13:02:54 +03:00
commit 23bfcccd77
31 changed files with 399 additions and 246 deletions

View file

@ -5547,18 +5547,24 @@ void Player::SendInitialActionButtons() const
sLog.outDetail( "Action Buttons for '%u' Initialized", GetGUIDLow() );
}
ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player)
{
if(button >= MAX_ACTION_BUTTONS)
{
sLog.outError( "Action %u not added into button %u for player %s: button must be < 144", action, button, GetName() );
return NULL;
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)
{
sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE );
return NULL;
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;
}
switch(type)
@ -5566,27 +5572,41 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if(!sSpellStore.LookupEntry(action))
{
sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() );
return NULL;
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(!HasSpell(action))
if(player && !player->HasSpell(action))
{
sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() );
return NULL;
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))
{
sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() );
return NULL;
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;
default:
break; // pther cases not checked at this moment
break; // other cases not checked at this moment
}
return true;
}
ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
{
if (!IsActionButtonDataValid(button,action,type,this))
return NULL;
// it create new button (NEW state) if need or return existed
ActionButton& ab = m_actionButtons[button];