Core/Commands: Added a command that shows what cheat commands you have active

Closes #7721

(Modified)
This commit is contained in:
Myran2
2012-09-13 15:32:17 +01:00
committed by Nay
parent b9434b6377
commit 13e140cfac
4 changed files with 50 additions and 13 deletions

View File

@@ -41,6 +41,7 @@ public:
{ "cooldown", SEC_GAMEMASTER, false, &HandleCoolDownCheatCommand, "", NULL },
{ "power", SEC_GAMEMASTER, false, &HandlePowerCheatCommand, "", NULL },
{ "waterwalk", SEC_GAMEMASTER, false, &HandleWaterWalkCheatCommand, "", NULL },
{ "status", SEC_GAMEMASTER, false, &HandleCheatStatusCommand, "", NULL },
{ "taxi", SEC_GAMEMASTER, false, &HandleTaxiCheatCommand, "", NULL },
{ "explore", SEC_GAMEMASTER, false, &HandleExploreCheatCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
@@ -159,6 +160,22 @@ public:
return false;
}
static bool HandleCheatStatusCommand(ChatHandler* handler, const char* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
const char* enabled = "enabled";
const char* disabled = "disabled";
handler->SendSysMessage(LANG_COMMAND_CHEAT_STATUS);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_CD, player->GetCommandStatus(CHEAT_COOLDOWN) ? enabled : disabled);
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);
return true;
}
static bool HandleWaterWalkCheatCommand(ChatHandler* handler, const char* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())

View File

@@ -26,6 +26,8 @@
#include "SpellScript.h"
#include "Vehicle.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
class spell_generic_quest_update_entry_SpellScript : public SpellScript
{
@@ -1322,7 +1324,7 @@ enum Quest11010_11102_11023Data
SPELL_FLAK_CANNON_TRIGGER = 40110,
SPELL_CHOOSE_LOC = 40056,
SPELL_AGGRO_CHECK = 40112,
// NPCs
// NPCs
NPC_FEL_CANNON2 = 23082
};
@@ -1364,21 +1366,21 @@ class spell_q11010_q11102_q11023_aggro_check : public SpellScriptLoader
class spell_q11010_q11102_q11023_aggro_check_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11010_q11102_q11023_aggro_check_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Player* playerTarget = GetHitPlayer())
// Check if found player target is on fly mount or using flying form
// Check if found player target is on fly mount or using flying form
if (playerTarget->HasAuraType(SPELL_AURA_FLY) || playerTarget->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
playerTarget->CastSpell(playerTarget, SPELL_FLAK_CANNON_TRIGGER, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_q11010_q11102_q11023_aggro_check_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_q11010_q11102_q11023_aggro_check_SpellScript();
@@ -1423,28 +1425,28 @@ class spell_q11010_q11102_q11023_choose_loc : public SpellScriptLoader
class spell_q11010_q11102_q11023_choose_loc_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11010_q11102_q11023_choose_loc_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
// Check for player that is in 65 y range
// Check for player that is in 65 y range
std::list<Player*> playerList;
Trinity::AnyPlayerInObjectRangeCheck checker(caster, 765.0f);
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(caster, playerList, checker);
caster->VisitNearbyWorldObject(65.0f, searcher);
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(caster, playerList, checker);
caster->VisitNearbyWorldObject(65.0f, searcher);
for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
// Check if found player target is on fly mount or using flying form
// Check if found player target is on fly mount or using flying form
if ((*itr)->HasAuraType(SPELL_AURA_FLY) || (*itr)->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
// Summom Fel Cannon (bunny version) at found player
caster->SummonCreature(NPC_FEL_CANNON2, (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ());
}
void Register()
{
OnEffectHit += SpellEffectFn(spell_q11010_q11102_q11023_choose_loc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_q11010_q11102_q11023_choose_loc_SpellScript();