[7290] Command .npc setdeathstate on/off.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
GriffonHeart 2009-02-17 13:31:30 +03:00 committed by VladimirMangos
parent 25a57cca18
commit 74fdc7bee7
8 changed files with 45 additions and 2 deletions

View file

@ -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.'),

View file

@ -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.');

View file

@ -176,6 +176,7 @@ pkgdata_DATA = \
7252_02_mangos_mangos_string.sql \
7255_01_characters_characters.sql \
7267_01_characters_auctionhouse.sql \
7290_01_mangos_command.sql \
README
## Additional files to include when running 'make dist'
@ -332,4 +333,5 @@ EXTRA_DIST = \
7252_02_mangos_mangos_string.sql \
7255_01_characters_characters.sql \
7267_01_characters_auctionhouse.sql \
7290_01_mangos_command.sql \
README

View file

@ -439,6 +439,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL },
{ "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", 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 },

View file

@ -197,6 +197,7 @@ class ChatHandler
bool HandleNpcUnFollowCommand(const char* args);
bool HandleNpcWhisperCommand(const char* args);
bool HandleNpcYellCommand(const char* args);
bool HandleNpcSetDeathStateCommand(const char* args);
bool HandleReloadAllCommand(const char* args);
bool HandleReloadAllAreaCommand(const char* args);

View file

@ -608,6 +608,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
uint32 GetGlobalCooldown() const { return m_GlobalCooldown; }
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);

View file

@ -4301,3 +4301,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;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7289"
#define REVISION_NR "7290"
#endif // __REVISION_NR_H__