aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamus <nikson.91@mail.ru>2011-03-21 13:21:19 +0200
committerRamus <nikson.91@mail.ru>2011-03-21 13:21:19 +0200
commit0676da0ea100f853e85776e5eaa5ddc42b023521 (patch)
tree5a6947bff1de2074de7336494ee2a234a38375c2
parent2f79b0f266e48778f13f9e183b41bfd8baa6f8bd (diff)
Allow apply .modify scale to targeted creature.
-rw-r--r--sql/base/world_database.sql2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp27
2 files changed, 16 insertions, 13 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql
index caea467b71d..790f3d8726a 100644
--- a/sql/base/world_database.sql
+++ b/sql/base/world_database.sql
@@ -502,7 +502,7 @@ INSERT INTO `command` VALUES
('modify rage',1,'Syntax: .modify rage #newrage\r\n\r\nModify the rage of the selected player. If no player is selected, modify your rage.'),
('modify rep',2,'Syntax: .modify rep #repId (#repvalue | $rankname [#delta])\r\nSets the selected players reputation with faction #repId to #repvalue or to $reprank.\r\nIf the reputation rank name is provided, the resulting reputation will be the lowest reputation for that rank plus the delta amount, if specified.\r\nYou can use ''.pinfo rep'' to list all known reputation ids, or use ''.lookup faction $name'' to locate a specific faction id.'),
('modify runicpower',1,'Syntax: .modify runicpower #newrunicpower\r\n\r\nModify the runic power of the selected player. If no player is selected, modify your runic power.'),
-('modify scale',1,'.modify scale $parameter\nModify size of the selected player to \"normal scale\"*rate. If no player is selected, modify your size.\n#rate may range from 0.1 to 10.'),
+('modify scale',1,'.modify scale #scale\nModify size of the selected player or creature to \"normal scale\"*rate. If no player or creature is selected, modify your size.\n#rate may range from 0.1 to 10.'),
('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'),
('modify spell',1,'TODO'),
('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'),
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 60944575d68..8902e0757ea 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -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);