Allow apply .modify scale to targeted creature.

This commit is contained in:
Ramus
2011-03-21 13:21:19 +02:00
parent 2f79b0f266
commit 0676da0ea1
2 changed files with 16 additions and 13 deletions
+15 -12
View File
@@ -676,35 +676,38 @@ public:
return true;
}
//Edit Player Scale
//Edit Player or Creature Scale
static bool HandleModifyScaleCommand(ChatHandler* handler, const char* args)
{
if (!*args)
return false;
float Scale = (float)atof((char*)args);
if (Scale > 10.0f || Scale < 0.1f)
if (Scale > 10.0f || Scale < 0.0f)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
Player* target = handler->getSelectedPlayer();
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
// check online security
if (handler->HasLowerSecurity(target, 0))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
(ChatHandler(target)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
if (target->GetTypeId()==TYPEID_PLAYER)
{
// check online security
if (handler->HasLowerSecurity((Player*)target, 0))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink((Player*)target).c_str());
if (handler->needReportToTarget((Player*)target))
(ChatHandler((Player*)target)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
}
target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);