[9095] Allow apply .modify scale to targeted creature (without save scale).

Also add command description to mangos.sql.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
b482518 2010-01-01 18:19:44 +03:00 committed by VladimirMangos
parent 15193ab9c3
commit 65c12d4998
6 changed files with 26 additions and 15 deletions

View file

@ -1320,30 +1320,33 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
return false;
float Scale = (float)atof((char*)args);
if (Scale > 3.0f || Scale <= 0.0f)
if (Scale > 10.0f || Scale <= 0.0f)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
return false;
}
Player *chr = getSelectedPlayer();
if (chr == NULL)
Unit *target = getSelectedUnit();
if (target == NULL)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(chr, 0))
return false;
if (target->GetTypeId()==TYPEID_PLAYER)
{
// check online security
if (HasLowerSecurity((Player*)target, 0))
return false;
PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, GetNameLink(chr).c_str());
if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetNameLink().c_str(), Scale);
PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, GetNameLink((Player*)target).c_str());
if (needReportToTarget((Player*)target))
ChatHandler((Player*)target).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetNameLink().c_str(), Scale);
}
chr->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
return true;
}