Scripts/Commands: Add taxinodes cheat status to

* Some cleanup

Closes #15065

(cherry picked from commit 558ce7d877)

Conflicts:
	src/server/scripts/Commands/cs_cheat.cpp
This commit is contained in:
duhow
2015-07-12 23:59:24 +02:00
committed by Carbenium
parent c8b91dd511
commit 28bdb50d80
3 changed files with 23 additions and 28 deletions

View File

@@ -0,0 +1,2 @@
DELETE FROM `trinity_string` WHERE `entry` = 364;
INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES (364, 'Taxinodes: %s.');

View File

@@ -388,7 +388,8 @@ enum TrinityStrings
LANG_COMMAND_CHEAT_POWER = 361,
LANG_COMMAND_CHEAT_WW = 362,
LANG_COMMAND_WHISPEROFFPLAYER = 363,
// Room for more level 2 364-399 not used
LANG_COMMAND_CHEAT_TAXINODES = 364,
// Room for more level 2 365-399 not used
// level 3 chat
LANG_SCRIPTS_RELOADED = 400,

View File

@@ -24,7 +24,6 @@ EndScriptData */
#include "Chat.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -163,8 +162,8 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
const char* enabled = "enabled";
const char* disabled = "disabled";
const char* enabled = "ON";
const char* disabled = "OFF";
handler->SendSysMessage(LANG_COMMAND_CHEAT_STATUS);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
@@ -172,6 +171,7 @@ public:
handler->PSendSysMessage(LANG_COMMAND_CHEAT_CT, player->GetCommandStatus(CHEAT_CASTTIME) ? enabled : disabled);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_POWER, player->GetCommandStatus(CHEAT_POWER) ? enabled : disabled);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_WW, player->GetCommandStatus(CHEAT_WATERWALK) ? enabled : disabled);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_TAXINODES, player->isTaxiCheater() ? enabled : disabled);
return true;
}
@@ -184,13 +184,7 @@ public:
Player* target = handler->GetSession()->GetPlayer();
if (!*args)
{
argstr = (target->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
if (target->GetCommandStatus(CHEAT_WATERWALK))
argstr = "off";
else
argstr = "on";
}
if (argstr == "off")
{
@@ -212,15 +206,8 @@ public:
static bool HandleTaxiCheatCommand(ChatHandler* handler, const char* args)
{
if (!*args)
{
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
return false;
}
std::string argstr = (char*)args;
Player* chr = handler->getSelectedPlayer();
if (!chr)
@@ -228,7 +215,20 @@ public:
else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security
return false;
if (argstr == "on")
if (!*args)
argstr = (chr->isTaxiCheater()) ? "off" : "on";
if (argstr == "off")
{
chr->SetTaxiCheater(false);
handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
if (handler->needReportToTarget(chr))
ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
return true;
}
else if (argstr == "on")
{
chr->SetTaxiCheater(true);
handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
@@ -237,15 +237,6 @@ public:
return true;
}
if (argstr == "off")
{
chr->SetTaxiCheater(false);
handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
if (handler->needReportToTarget(chr))
ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
@@ -257,10 +248,11 @@ public:
if (!*args)
return false;
// std::int flag = (char*)args;
int flag = atoi((char*)args);
Player* chr = handler->getSelectedPlayer();
if (chr == NULL)
if (!chr)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);