From 65c12d49982fc3c1dc113a861d5ea07bb7d26d92 Mon Sep 17 00:00:00 2001 From: b482518 Date: Fri, 1 Jan 2010 18:19:44 +0300 Subject: [PATCH] [9095] Allow apply .modify scale to targeted creature (without save scale). Also add command description to mangos.sql. Signed-off-by: VladimirMangos --- sql/mangos.sql | 4 ++-- sql/updates/9095_01_mangos_command.sql | 6 ++++++ sql/updates/Makefile.am | 2 ++ src/game/Level1.cpp | 25 ++++++++++++++----------- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 sql/updates/9095_01_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 9076fb05d..f60a1707a 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9074_01_mangos_command` bit(1) default NULL + `required_9095_01_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -662,7 +662,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',1,'Syntax: .modify scale #scale\r\n\r\nChange model scale for targeted player (util relogin) or creature (until respawn).'), ('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 10.'), ('modify spell',1,''), ('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), diff --git a/sql/updates/9095_01_mangos_command.sql b/sql/updates/9095_01_mangos_command.sql new file mode 100644 index 000000000..cd5913433 --- /dev/null +++ b/sql/updates/9095_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_9074_01_mangos_command required_9095_01_mangos_command bit; + +DELETE FROM command where name IN ('modify scale'); + +INSERT INTO `command` VALUES +('modify scale',1,'Syntax: .modify scale #scale\r\n\r\nChange model scale for targeted player (util relogin) or creature (until respawn).'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index c6782d2ea..7d2089db7 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -224,6 +224,7 @@ pkgdata_DATA = \ 9068_02_mangos_spell_chain.sql \ 9070_01_mangos_spell_proc_event.sql \ 9074_01_mangos_command.sql \ + 9095_01_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -428,4 +429,5 @@ EXTRA_DIST = \ 9068_02_mangos_spell_chain.sql \ 9070_01_mangos_spell_proc_event.sql \ 9074_01_mangos_command.sql \ + 9095_01_mangos_command.sql \ README diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 2c3faefb7..50b6a8b1d 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -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; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a5def3e3d..5b7977621 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9094" + #define REVISION_NR "9095" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 1d1a0c56c..9dc1eac37 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_8874_01_characters_character_skills" - #define REVISION_DB_MANGOS "required_9074_01_mangos_command" + #define REVISION_DB_MANGOS "required_9095_01_mangos_command" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #endif // __REVISION_SQL_H__