diff options
-rw-r--r-- | sql/mangos.sql | 3 | ||||
-rw-r--r-- | sql/updates/7290_01_mangos_command.sql | 5 | ||||
-rw-r--r-- | src/game/Chat.cpp | 2 | ||||
-rw-r--r-- | src/game/Chat.h | 1 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/Level2.cpp | 31 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
7 files changed, 44 insertions, 2 deletions
diff --git a/sql/mangos.sql b/sql/mangos.sql index 6233ed7a46b..d09fb2ab9a7 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, - `required_7252_02_mangos_mangos_string` bit(1) default NULL + `required_7290_01_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -401,6 +401,7 @@ INSERT INTO `command` VALUES ('npc name',2,'Syntax: .npc name $name\r\n\r\nChange the name of the selected creature or character to $name.\r\n\r\nCommand disabled.'), ('npc phase',3,'Syntax: .npc phase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), ('npc playemote',3,'Syntax: .npc playemote #emoteid\r\n\r\nMake the selected creature emote with an emote of id #emoteid.'), +('npc setdeathstate',2,'Syntax: .npc setdeathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'), ('npc setmodel',2,'Syntax: .npc setmodel #displayid\r\n\r\nChange the model id of the selected creature to #displayid.'), ('npc setmovetype',2,'Syntax: .npc setmovetype [#creature_guid] stay/random/way [NODEL]\r\n\r\nSet for creature pointed by #creature_guid (or selected if #creature_guid not provided) movement type and move it to respawn position (if creature alive). Any existing waypoints for creature will be removed from the database if you do not use NODEL. If the creature is dead then movement type will applied at creature respawn.\r\nMake sure you use NODEL, if you want to keep the waypoints.'), ('npc spawndist',2,'Syntax: .npc spawndist #dist\r\n\r\nAdjust spawndistance of selected creature to dist.'), diff --git a/sql/updates/7290_01_mangos_command.sql b/sql/updates/7290_01_mangos_command.sql new file mode 100644 index 00000000000..b84a579e431 --- /dev/null +++ b/sql/updates/7290_01_mangos_command.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_7252_02_mangos_mangos_string required_7290_01_mangos_command bit; + +DELETE FROM `command` WHERE `name` = 'npc setdeathstate'; +INSERT INTO `command` VALUES +('npc setdeathstate',2,'Syntax: .npc setdeathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index bc2ed1d27dc..4730269b167 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -468,6 +468,8 @@ ChatCommand * ChatHandler::getCommandTable() { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, + { "tame", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTameCommand, "", NULL }, + { "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL }, //{ TODO: fix or remove this commands { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index a47397212d8..7ff89e5071c 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -208,6 +208,7 @@ class ChatHandler bool HandleNpcWhisperCommand(const char* args); bool HandleNpcYellCommand(const char* args); bool HandleNpcAddFormationCommand(const char* args); + bool HandleNpcSetDeathStateCommand(const char* args); bool HandleReloadAllCommand(const char* args); bool HandleReloadAllAreaCommand(const char* args); diff --git a/src/game/Creature.h b/src/game/Creature.h index d218e2dcd93..8351c76a718 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -642,6 +642,8 @@ class TRINITY_DLL_SPEC Creature : public Unit uint32 GetFormationID(){return m_formationID;} Unit *SelectVictim(); + void SetDeadByDefault (bool death_state) {m_isDeadByDefault = death_state;} + protected: bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL); bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 8d560783d89..05af6cbcbfe 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -4495,3 +4495,34 @@ bool ChatHandler::HandleGOPhaseCommand(const char* args) obj->SaveToDB(); return true; } + +bool ChatHandler::HandleNpcSetDeathStateCommand(const char* args) +{ + if (!*args) + return false; + + Creature* pCreature = getSelectedCreature(); + if(!pCreature || pCreature->isPet()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (strncmp(args, "on", 3) == 0) + pCreature->SetDeadByDefault(true); + else if (strncmp(args, "off", 4) == 0) + pCreature->SetDeadByDefault(false); + else + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + pCreature->SaveToDB(); + pCreature->Respawn(); + + return true; +} + diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d254fae6a3b..8c65ce49575 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 "7289" + #define REVISION_NR "7290" #endif // __REVISION_NR_H__ |