fix(Core/Command): cheat explore (#2862)
Co-authored-by: P-Kito <p-kito@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1586480454432011500');
|
||||||
|
|
||||||
|
DELETE FROM `command` WHERE `name`='cheat explore';
|
||||||
|
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||||
|
('cheat explore', 2, 'Syntax: .cheat explore #flag\r\nReveal or hide all maps for the selected player. If no player is selected, hide or reveal maps to you.\r\nUse a #flag of value 1 to reveal, use a #flag value of 0 to hide all maps.');
|
||||||
@@ -24,6 +24,7 @@ public:
|
|||||||
{ "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCheatCommand, "" },
|
{ "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCheatCommand, "" },
|
||||||
{ "status", SEC_GAMEMASTER, false, &HandleCheatStatusCommand, "" },
|
{ "status", SEC_GAMEMASTER, false, &HandleCheatStatusCommand, "" },
|
||||||
{ "taxi", SEC_GAMEMASTER, false, &HandleTaxiCheatCommand, "" },
|
{ "taxi", SEC_GAMEMASTER, false, &HandleTaxiCheatCommand, "" },
|
||||||
|
{ "explore", SEC_GAMEMASTER, false, &HandleExploreCheatCommand, "" },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
|
static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
|
||||||
{
|
{
|
||||||
std::string argStr = (char*)args;
|
std::string argStr = (char*)args;
|
||||||
@@ -222,6 +223,39 @@ public:
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int flag = atoi((char*)args);
|
||||||
|
|
||||||
|
Player* target = handler->getSelectedPlayerOrSelf();
|
||||||
|
|
||||||
|
for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
|
||||||
|
{
|
||||||
|
if (flag != 0)
|
||||||
|
target->SetFlag(PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF);
|
||||||
|
else
|
||||||
|
target->RemoveFlag(PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag != 0)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(target).c_str());
|
||||||
|
if (handler->needReportToTarget(target))
|
||||||
|
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(target).c_str());
|
||||||
|
if (handler->needReportToTarget(target))
|
||||||
|
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_cheat_commandscript()
|
void AddSC_cheat_commandscript()
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ public:
|
|||||||
{ "unstuck", SEC_GAMEMASTER, true, &HandleUnstuckCommand, "" },
|
{ "unstuck", SEC_GAMEMASTER, true, &HandleUnstuckCommand, "" },
|
||||||
{ "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "" },
|
{ "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "" },
|
||||||
{ "neargrave", SEC_GAMEMASTER, false, &HandleNearGraveCommand, "" },
|
{ "neargrave", SEC_GAMEMASTER, false, &HandleNearGraveCommand, "" },
|
||||||
{ "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "" },
|
|
||||||
{ "showarea", SEC_GAMEMASTER, false, &HandleShowAreaCommand, "" },
|
{ "showarea", SEC_GAMEMASTER, false, &HandleShowAreaCommand, "" },
|
||||||
{ "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "" },
|
{ "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "" },
|
||||||
{ "additem", SEC_GAMEMASTER, false, &HandleAddItemCommand, "" },
|
{ "additem", SEC_GAMEMASTER, false, &HandleAddItemCommand, "" },
|
||||||
@@ -1324,45 +1323,6 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args)
|
|
||||||
{
|
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int32 flag = int32(atoi((char*)args));
|
|
||||||
|
|
||||||
Player* playerTarget = handler->getSelectedPlayer();
|
|
||||||
if (!playerTarget)
|
|
||||||
{
|
|
||||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag != 0)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str());
|
|
||||||
if (handler->needReportToTarget(playerTarget))
|
|
||||||
ChatHandler(playerTarget->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str());
|
|
||||||
if (handler->needReportToTarget(playerTarget))
|
|
||||||
ChatHandler(playerTarget->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
|
|
||||||
{
|
|
||||||
if (flag != 0)
|
|
||||||
handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF);
|
|
||||||
else
|
|
||||||
handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1 + i, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
|
static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
|||||||
Reference in New Issue
Block a user