Morph command update (#2641)

* changed morph command

removed demorph and adapted morph to include a reset option

* command info updated

* Update data/sql/updates/pending_db_world/rev_1580747652284896800.sql

Co-Authored-By: Barbz <BarbzYHOOL@users.noreply.github.com>

* Added subcommand system for Morph

- Subcommands
- Descriptions on database

* travis

* two single quotes query

* Update data/sql/updates/pending_db_world/rev_1580747652284896800.sql

Co-Authored-By: Barbz <BarbzYHOOL@users.noreply.github.com>

* Update data/sql/updates/pending_db_world/rev_1580747652284896800.sql

Co-Authored-By: Barbz <BarbzYHOOL@users.noreply.github.com>

* Update data/sql/updates/pending_db_world/rev_1580747652284896800.sql

Co-Authored-By: Barbz <BarbzYHOOL@users.noreply.github.com>

Co-authored-by: Barbz <BarbzYHOOL@users.noreply.github.com>
This commit is contained in:
gengarshadowball
2020-03-01 09:34:56 +00:00
committed by GitHub
parent 2eb0705668
commit 857e799298
2 changed files with 30 additions and 22 deletions

View File

@@ -0,0 +1,5 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1580747652284896800');
DELETE FROM `command` WHERE `name`='demorph';
INSERT INTO `command` (`name`, `security`, `help`) VALUES ('morph target', '1', 'Syntax: .morph target #displayid - Change the selected target''s current model id to #displayid.');
INSERT INTO `command` (`name`, `security`, `help`) VALUES ('morph reset', '1', 'Syntax: .morph reset - Doesn''t use any parameters to reset the selected target''s model');
UPDATE `command` SET `help`='Syntax: .morph $subcommand\r\nType .morph to see the list of possible subcommands or ".help morph" to see info on subcommands' WHERE `name`='morph';

View File

@@ -60,11 +60,17 @@ public:
{ "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "" },
{ "speed", SEC_GAMEMASTER, false, nullptr, "", modifyspeedCommandTable }
};
static std::vector<ChatCommand> morphCommandTable =
{
{ "reset", SEC_GAMEMASTER, false, &HandleMorphResetCommand, "" },
{ "target", SEC_GAMEMASTER, false, &HandleMorphTargetCommand, "" }
};
static std::vector<ChatCommand> commandTable =
{
{ "morph", SEC_MODERATOR, false, &HandleModifyMorphCommand, "" },
{ "demorph", SEC_MODERATOR, false, &HandleDeMorphCommand, "" },
{ "modify", SEC_GAMEMASTER, false, nullptr, "", modifyCommandTable }
{ "morph", SEC_MODERATOR, false, nullptr, "", morphCommandTable },
{ "modify", SEC_GAMEMASTER, false, nullptr, "", modifyCommandTable }
};
return commandTable;
}
@@ -1247,15 +1253,12 @@ public:
handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
return true;
}
//morph creature or player
static bool HandleModifyMorphCommand(ChatHandler* handler, const char* args)
static bool HandleMorphTargetCommand(ChatHandler* handler, const char* args)
{
if (!*args)
return false;
uint32 display_id = (uint32)atoi((char*)args);
Unit* target = handler->getSelectedUnit();
if (!target)
target = handler->GetSession()->GetPlayer();
@@ -1269,6 +1272,21 @@ public:
return true;
}
//morph creature or player
static bool HandleMorphResetCommand(ChatHandler* handler, const char* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
target = handler->GetSession()->GetPlayer();
// check online security
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
return false;
target->DeMorph();
return true;
}
//set temporary phase mask for player
static bool HandleModifyPhaseCommand(ChatHandler* handler, const char* args)
{
@@ -1384,21 +1402,6 @@ public:
return true;
}
//demorph player or unit
static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
target = handler->GetSession()->GetPlayer();
// check online security
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
return false;
target->DeMorph();
return true;
}
};
void AddSC_modify_commandscript()