From a1f9716ffaccbbd8d087fb6fc054d02184e8229b Mon Sep 17 00:00:00 2001 From: ratkosrb Date: Mon, 9 Dec 2019 19:37:21 +0200 Subject: [PATCH] Add a cheat command category. --- sql/migrations/20191209173550_world.sql | 59 ++++ src/game/AutoTesting/AutoTestingMgr.cpp | 4 +- src/game/AutoTesting/Tests/Generic.cpp | 4 +- src/game/AutoTesting/Tests/Warlock.cpp | 4 +- src/game/Chat/Chat.cpp | 25 +- src/game/Chat/Chat.h | 21 +- src/game/Commands/CharacterCommands.cpp | 415 ++++++++++++++++++++---- src/game/Commands/MiscCommands.cpp | 53 --- src/game/Commands/UnitCommands.cpp | 2 +- src/game/Handlers/MiscHandler.cpp | 5 +- src/game/Language.h | 54 ++- src/game/Maps/MapManager.cpp | 3 +- src/game/Objects/Object.cpp | 9 - src/game/Objects/Player.cpp | 104 +++++- src/game/Objects/Player.h | 57 ++-- src/game/Objects/Unit.cpp | 18 +- src/game/PlayerBots/PlayerBotAI.cpp | 2 +- src/game/Spells/Spell.cpp | 32 +- src/game/Spells/SpellEffects.cpp | 4 +- src/game/UnitAuraProcHandler.cpp | 2 +- 20 files changed, 651 insertions(+), 226 deletions(-) create mode 100644 sql/migrations/20191209173550_world.sql diff --git a/sql/migrations/20191209173550_world.sql b/sql/migrations/20191209173550_world.sql new file mode 100644 index 000000000..792cba4b6 --- /dev/null +++ b/sql/migrations/20191209173550_world.sql @@ -0,0 +1,59 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20191209173550'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20191209173550'); +-- Add your query below. + + +DELETE FROM `mangos_string` WHERE `entry` IN (636, 637, 638); +UPDATE `mangos_string` SET `entry`=372 WHERE `entry`=640; +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (353, 'NO COOLDWON cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (354, 'NO COOLDWON cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (355, 'You set no cooldown mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (356, 'Your no cooldown mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (368, 'You set god mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (369, 'Your god mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (370, 'INSTACAST cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (371, 'INSTACAST cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (619, 'You set instant casting mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (620, 'Your instant casting mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (621, 'NO POWER COST cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (622, 'NO POWER COST cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (623, 'You set no power cost mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (624, 'Your no power cost mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (625, 'IMMUNE TO AURA cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (626, 'IMMUNE TO AURA cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (627, 'You set immune to aura mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (628, 'Your immune to aura mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (629, 'ALWAYS CRIT cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (630, 'ALWAYS CRIT cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (631, 'You set always crit mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (632, 'Your always crit mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (633, 'NO CAST CHECKS cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (634, 'NO CAST CHECKS cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (635, 'You set no cast checks mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (636, 'Your no cast checks mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (637, 'ALWAYS PROC cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (638, 'ALWAYS PROC cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (639, 'You set always proc mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (640, 'Your always proc mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (641, 'TRIGGER PASS cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (642, 'TRIGGER PASS cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (643, 'You set trigger pass mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (644, 'Your trigger pass mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (645, 'IGNORE TRIGGERS cheat is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (646, 'IGNORE TRIGGERS cheat is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (647, 'You set ignore triggers mode to %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (648, 'Your ignore triggers mode has been turned %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/AutoTesting/AutoTestingMgr.cpp b/src/game/AutoTesting/AutoTestingMgr.cpp index 29c874a99..6ce9b2723 100644 --- a/src/game/AutoTesting/AutoTestingMgr.cpp +++ b/src/game/AutoTesting/AutoTestingMgr.cpp @@ -122,8 +122,8 @@ Player* SingleTest::GetTestPlayer(uint32 num, uint32 options) Fail("Unable to find player %u", num); if (!initialized) { - p->SetGodMode(!(options & TESTPLAYER_NO_GODMODE)); - p->SetOption(PLAYER_CHEAT_UNRANDOMIZE, true); + p->SetCheatGod(!(options & TESTPLAYER_NO_GODMODE)); + //p->SetCheatOption(PLAYER_CHEAT_UNRANDOMIZE, true); } if (options & TESTPLAYER_FFA_ON) p->SetFFAPvP(true); diff --git a/src/game/AutoTesting/Tests/Generic.cpp b/src/game/AutoTesting/Tests/Generic.cpp index 582f94e2d..a4fa63b8c 100644 --- a/src/game/AutoTesting/Tests/Generic.cpp +++ b/src/game/AutoTesting/Tests/Generic.cpp @@ -40,8 +40,8 @@ public: { Player* player1 = GetTestPlayer(0); Player* player2 = GetTestPlayer(1); - player1->EnableOption(PLAYER_CHEAT_NO_CAST_TIME); - player2->EnableOption(PLAYER_CHEAT_NO_CAST_TIME); + player1->EnableCheatOption(PLAYER_CHEAT_NO_CAST_TIME); + player2->EnableCheatOption(PLAYER_CHEAT_NO_CAST_TIME); player1->AddItem(ITEM_SOUL_SHARD, 1); player2->AddItem(ITEM_SOUL_SHARD, 1); player1->CastSpell(player1, SPELL_SUMMON_SUCCUBUS, false); diff --git a/src/game/AutoTesting/Tests/Warlock.cpp b/src/game/AutoTesting/Tests/Warlock.cpp index c9605a39d..b781eb375 100644 --- a/src/game/AutoTesting/Tests/Warlock.cpp +++ b/src/game/AutoTesting/Tests/Warlock.cpp @@ -233,7 +233,7 @@ public: case 1: { Player* p = GetTestPlayer(0, TESTPLAYER_MAXLEVEL); - p->EnableOption(PLAYER_CHEAT_NO_CAST_TIME); + p->EnableCheatOption(PLAYER_CHEAT_NO_CAST_TIME); p->CastSpell(p, SPELL_SUMMON_IMP, false); Wait(2000); // GCD break; @@ -241,7 +241,7 @@ public: case 2: { Player* p = GetTestPlayer(0, TESTPLAYER_MAXLEVEL); - p->RemoveOption(PLAYER_CHEAT_NO_CAST_TIME); + p->RemoveCheatOption(PLAYER_CHEAT_NO_CAST_TIME); p->CastSpell(p, SPELL_SUMMON_IMP, false); Wait(500); break; diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index d9dd49c2d..fd476273c 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -194,6 +194,24 @@ ChatCommand * ChatHandler::getCommandTable() { MSTR, nullptr, 0, false, nullptr, "", nullptr } }; + static ChatCommand cheatCommandTable[] = + { + { NODE, "god", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatGodCommand, "", nullptr }, + { NODE, "cooldown", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatCooldownCommand, "", nullptr }, + { NODE, "casttime", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatCastTimeCommand, "", nullptr }, + { NODE, "powercost", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatPowerCommand, "", nullptr }, + { NODE, "immunetoauras", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatImmuneToAuraCommand, "", nullptr }, + { NODE, "crit", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatAlwaysCritCommand, "", nullptr }, + { NODE, "castchecks", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatNoCastCheckCommand, "", nullptr }, + { NODE, "proc", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatAlwaysProcCommand, "", nullptr }, + { NODE, "triggerpass", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatTriggerPassCommand, "", nullptr }, + { NODE, "ignoretriggers", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatIgnoreTriggersCommand, "", nullptr }, + { NODE, "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatWaterwalkCommand, "", nullptr }, + { NODE, "wallclimb", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatWallclimbCommand, "", nullptr }, + { NODE, "status", SEC_GAMEMASTER, false, &ChatHandler::HandleCheatStatusCommand, "", nullptr }, + { MSTR, nullptr, 0, false, nullptr, "", nullptr } + }; + static ChatCommand debugPlayCommandTable[] = { { NODE, "cinematic", SEC_TICKETMASTER, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", nullptr }, @@ -289,7 +307,6 @@ ChatCommand * ChatHandler::getCommandTable() { NODE, "ingame", SEC_PLAYER, true, &ChatHandler::HandleGMListIngameCommand, "", nullptr }, { NODE, "list", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMListFullCommand, "", nullptr }, { NODE, "visible", SEC_TICKETMASTER, false, &ChatHandler::HandleGMVisibleCommand, "", nullptr }, - { NODE, "options", SEC_GAMEMASTER, false, &ChatHandler::HandleGMOptionsCommand, "", nullptr }, { NODE, "setview", SEC_TICKETMASTER, false, &ChatHandler::HandleSetViewCommand, "", nullptr }, { NODE, "", SEC_TICKETMASTER, false, &ChatHandler::HandleGMCommand, "", nullptr }, { MSTR, nullptr, 0, false, nullptr, "", nullptr } @@ -997,8 +1014,9 @@ ChatCommand * ChatHandler::getCommandTable() { NODE, "auction", SEC_TICKETMASTER, false, nullptr, "", auctionCommandTable }, { NODE, "cast", SEC_DEVELOPPER, false, nullptr, "", castCommandTable }, { NODE, "character", SEC_TICKETMASTER, true, nullptr, "", characterCommandTable}, + { NODE, "cheat", SEC_GAMEMASTER, false, nullptr, "", cheatCommandTable }, { NODE, "debug", SEC_TICKETMASTER, true, nullptr, "", debugCommandTable }, - { NODE, "replenish", SEC_GAMEMASTER, false, &ChatHandler::HandleReplenishCommand, "", nullptr }, + { NODE, "replenish", SEC_GAMEMASTER, false, &ChatHandler::HandleReplenishCommand, "", nullptr }, { NODE, "replay", SEC_ADMINISTRATOR, false, nullptr, "", replayCommandTable }, { NODE, "event", SEC_GAMEMASTER, false, nullptr, "", eventCommandTable }, { NODE, "gm", SEC_PLAYER, true, nullptr, "", gmCommandTable }, @@ -1033,7 +1051,6 @@ ChatCommand * ChatHandler::getCommandTable() { NODE, "bg", SEC_GAMEMASTER, false, nullptr, "", bgCommandTable}, { NODE, "spell", SEC_GAMEMASTER, true, nullptr, "", spellCommandTable}, { NODE, "variable", SEC_DEVELOPPER, true, &ChatHandler::HandleVariableCommand, "", nullptr}, - { NODE, "god", SEC_GAMEMASTER, false, &ChatHandler::HandleGodCommand, "", nullptr }, { NODE, "aura", SEC_BASIC_ADMIN, false, &ChatHandler::HandleAuraCommand, "", nullptr }, { NODE, "nameaura", SEC_BASIC_ADMIN, false, &ChatHandler::HandleNameAuraCommand, "", nullptr }, { NODE, "unaura", SEC_GAMEMASTER, false, &ChatHandler::HandleUnAuraCommand, "", nullptr }, @@ -1105,8 +1122,6 @@ ChatCommand * ChatHandler::getCommandTable() { NODE, "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", nullptr }, { NODE, "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", nullptr }, { NODE, "stable", SEC_TICKETMASTER, false, &ChatHandler::HandleStableCommand, "", nullptr }, - { NODE, "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", nullptr }, - { NODE, "wallclimb", SEC_GAMEMASTER, false, &ChatHandler::HandleWallclimbCommand, "", nullptr }, { NODE, "quit", SEC_CONSOLE, true, &ChatHandler::HandleQuitCommand, "", nullptr }, { NODE, "mmap", SEC_GAMEMASTER, false, nullptr, "", mmapCommandTable }, { NODE, "video", SEC_GAMEMASTER, false, nullptr, "", videosCommandTable }, diff --git a/src/game/Chat/Chat.h b/src/game/Chat/Chat.h index 39a6c6ecc..aeda2c80b 100644 --- a/src/game/Chat/Chat.h +++ b/src/game/Chat/Chat.h @@ -181,14 +181,29 @@ class MANGOS_DLL_SPEC ChatHandler void CheckIntegrity(ChatCommand *table, ChatCommand *parentCommand); void FillFullCommandsName(ChatCommand* table, std::string prefix); ChatCommand* getCommandTable(); - bool HandleGodCommand(char *); - bool HandleGMOptionsCommand(char *); + bool HandleAnticheatCommand(char *); bool HandleClientInfosCommand(char* ); bool HandleClientSearchCommand(char* ); bool HandleReloadAnticheatCommand(char*); bool HandleRunTestCommand(char* ); bool HandleViewLogCommand(char* ); + + //Cheats + bool HandleCheatStatusCommand(char *); + bool HandleCheatGodCommand(char *); + bool HandleCheatCooldownCommand(char *); + bool HandleCheatCastTimeCommand(char *); + bool HandleCheatPowerCommand(char *); + bool HandleCheatImmuneToAuraCommand(char *); + bool HandleCheatAlwaysCritCommand(char *); + bool HandleCheatNoCastCheckCommand(char *); + bool HandleCheatAlwaysProcCommand(char *); + bool HandleCheatTriggerPassCommand(char *); + bool HandleCheatIgnoreTriggersCommand(char *); + bool HandleCheatWaterwalkCommand(char* args); + bool HandleCheatWallclimbCommand(char* args); + //Custom bool HandleListAddonsCommand(char *); bool HandleUpdateWorldStateCommand(char *); @@ -891,8 +906,6 @@ class MANGOS_DLL_SPEC ChatHandler bool HandleCombatStopCommand(char* args); bool HandleRepairitemsCommand(char* args); bool HandleStableCommand(char* args); - bool HandleWaterwalkCommand(char* args); - bool HandleWallclimbCommand(char* args); bool HandleQuitCommand(char* args); //! Development Commands diff --git a/src/game/Commands/CharacterCommands.cpp b/src/game/Commands/CharacterCommands.cpp index 3818c69f7..290e85ccf 100644 --- a/src/game/Commands/CharacterCommands.cpp +++ b/src/game/Commands/CharacterCommands.cpp @@ -71,7 +71,7 @@ bool ChatHandler::HandleXpCommand(char* args) return true; } -bool ChatHandler::HandleGodCommand(char* args) +bool ChatHandler::HandleCheatGodCommand(char* args) { if (*args) { @@ -87,12 +87,355 @@ bool ChatHandler::HandleGodCommand(char* args) if (!ExtractPlayerTarget(&args, &target)) return false; - target->SetGodMode(value, true); + target->SetCheatGod(value, true); + + PSendSysMessage(LANG_YOU_SET_GOD, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_GOD_SET, value ? "on" : "off", GetNameLink().c_str()); } return true; } +bool ChatHandler::HandleCheatCooldownCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatNoCooldown(value, true); + + PSendSysMessage(LANG_YOU_SET_NO_CD, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_NO_CD_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatCastTimeCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatInstantCast(value, true); + + PSendSysMessage(LANG_YOU_SET_INSTANT_CAST, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_INSTANT_CAST_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatPowerCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatNoPowerCost(value, true); + + PSendSysMessage(LANG_YOU_SET_NO_POWER_COST, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_NO_POWER_COST_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatImmuneToAuraCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatImmuneToAura(value, true); + + PSendSysMessage(LANG_YOU_SET_IMMUNE_TO_AURA, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_IMMUNE_TO_AURA_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatAlwaysCritCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatAlwaysCrit(value, true); + + PSendSysMessage(LANG_YOU_SET_ALWAYS_CRIT, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ALWAYS_CRIT_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatNoCastCheckCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatNoCastCheck(value, true); + + PSendSysMessage(LANG_YOU_SET_NO_CAST_CHECK, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_NO_CAST_CHECK_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatAlwaysProcCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatAlwaysProc(value, true); + + PSendSysMessage(LANG_YOU_SET_ALWAYS_PROC, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ALWAYS_PROC_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatTriggerPassCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatTriggerPass(value, true); + + PSendSysMessage(LANG_YOU_SET_TRIGGER_PASS, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_TRIGGER_PASS_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatIgnoreTriggersCommand(char* args) +{ + if (*args) + { + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + target->SetCheatIgnoreTriggers(value, true); + + PSendSysMessage(LANG_YOU_SET_IGNORE_TRIGGERS, value ? "on" : "off", GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_IGNORE_TRIGGERS_SET, value ? "on" : "off", GetNameLink().c_str()); + } + + return true; +} + +bool ChatHandler::HandleCheatWaterwalkCommand(char* args) +{ + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player *player = GetSelectedPlayer(); + + if (!player) + { + PSendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(player)) + return false; + + if (value) + player->SetWaterWalking(true); + else + player->SetWaterWalking(false); + + PSendSysMessage(LANG_YOU_SET_WATERWALK, value ? "on" : "off", GetNameLink(player).c_str()); + if (needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, value ? "on" : "off", GetNameLink().c_str()); + return true; +} + +bool ChatHandler::HandleCheatWallclimbCommand(char* args) +{ + bool value; + if (!ExtractOnOff(&args, value)) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + Player *player = GetSelectedPlayer(); + + if (!player) + { + PSendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(player)) + return false; + + if (value) + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0); + else + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0); + + PSendSysMessage(LANG_YOU_SET_WALLCLIMB, value ? "on" : "off", GetNameLink(player).c_str()); + if (needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WALLCLIMB_SET, value ? "on" : "off", GetNameLink().c_str()); + return true; +} + +bool ChatHandler::HandleCheatStatusCommand(char* args) +{ + Player* target; + if (!ExtractPlayerTarget(&args, &target)) + return false; + + if (!target->GetCheatOptions()) + { + PSendSysMessage("No cheats enabled on %s.", target->GetName()); + return true; + } + + PSendSysMessage("Cheats active on %s:", target->GetName()); + if (target->HasCheatOption(PLAYER_CHEAT_GOD)) + SendSysMessage("- God"); + if (target->HasCheatOption(PLAYER_CHEAT_NO_COOLDOWN)) + SendSysMessage("- No cooldowns"); + if (target->HasCheatOption(PLAYER_CHEAT_NO_CAST_TIME)) + SendSysMessage("- No cast time"); + if (target->HasCheatOption(PLAYER_CHEAT_NO_POWER)) + SendSysMessage("- No power costs"); + if (target->HasCheatOption(PLAYER_CHEAT_IMMUNE_AURA)) + SendSysMessage("- Immune to auras"); + if (target->HasCheatOption(PLAYER_CHEAT_ALWAYS_CRIT)) + SendSysMessage("- Always crit"); + if (target->HasCheatOption(PLAYER_CHEAT_NO_CHECK_CAST)) + SendSysMessage("- No cast checks"); + if (target->HasCheatOption(PLAYER_CHEAT_ALWAYS_PROC)) + SendSysMessage("- Always proc"); + if (target->HasCheatOption(PLAYER_CHEAT_TRIGGER_PASS)) + SendSysMessage("- Areatrigger pass"); + if (target->HasCheatOption(PLAYER_CHEAT_IGNORE_TRIGGERS)) + SendSysMessage("- Ignore areatriggers"); + + return true; +} + bool ChatHandler::HandleReviveCommand(char* args) { Player* target; @@ -5059,74 +5402,6 @@ bool ChatHandler::HandleRepairitemsCommand(char* args) return true; } -bool ChatHandler::HandleWaterwalkCommand(char* args) -{ - bool value; - if (!ExtractOnOff(&args, value)) - { - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; - } - - Player *player = GetSelectedPlayer(); - - if (!player) - { - PSendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - // check online security - if (HasLowerSecurity(player)) - return false; - - if (value) - player->SetWaterWalking(true); - else - player->SetWaterWalking(false); - - PSendSysMessage(LANG_YOU_SET_WATERWALK, value ? "on" : "off", GetNameLink(player).c_str()); - if (needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, value ? "on" : "off", GetNameLink().c_str()); - return true; -} - -bool ChatHandler::HandleWallclimbCommand(char* args) -{ - bool value; - if (!ExtractOnOff(&args, value)) - { - SendSysMessage(LANG_USE_BOL); - SetSentErrorMessage(true); - return false; - } - - Player *player = GetSelectedPlayer(); - - if (!player) - { - PSendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } - - // check online security - if (HasLowerSecurity(player)) - return false; - - if (value) - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0); - else - player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0); - - PSendSysMessage(LANG_YOU_SET_WALLCLIMB, value ? "on" : "off", GetNameLink(player).c_str()); - if (needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_YOUR_WALLCLIMB_SET, value ? "on" : "off", GetNameLink().c_str()); - return true; -} - bool ChatHandler::HandleCombatStopCommand(char* args) { Player* target; diff --git a/src/game/Commands/MiscCommands.cpp b/src/game/Commands/MiscCommands.cpp index 93398a2d7..02f246356 100644 --- a/src/game/Commands/MiscCommands.cpp +++ b/src/game/Commands/MiscCommands.cpp @@ -198,59 +198,6 @@ bool ChatHandler::HandleSetViewCommand(char* /*args*/) return true; } -bool ChatHandler::HandleGMOptionsCommand(char* args) -{ - if (!args) - return false; - - std::string sArgs(args); - bool enable = true; - uint32 flags = 0; - if (sArgs.find("off") != std::string::npos) - enable = false; - if (sArgs.find("OFF") != std::string::npos) - enable = false; - if (sArgs.find("GOD") != std::string::npos || sArgs.find("god") != std::string::npos) - flags |= PLAYER_CHEAT_GOD; - if (sArgs.find("CD") != std::string::npos || sArgs.find("cd") != std::string::npos || sArgs.find("cooldown") != std::string::npos || sArgs.find("COOLDOWN") != std::string::npos) - flags |= PLAYER_CHEAT_NO_COOLDOWN; - if (sArgs.find("CAST") != std::string::npos || sArgs.find("cast") != std::string::npos) - flags |= PLAYER_CHEAT_NO_CAST_TIME; - if (sArgs.find("SPEED") != std::string::npos || sArgs.find("speed") != std::string::npos) - flags |= PLAYER_CHEAT_NO_MOD_SPEED; - if (sArgs.find("power") != std::string::npos || sArgs.find("POWER") != std::string::npos || sArgs.find("mana") != std::string::npos || sArgs.find("MANA") != std::string::npos) - flags |= PLAYER_CHEAT_NO_POWER; - if (sArgs.find("crit") != std::string::npos || sArgs.find("CRIT") != std::string::npos) - flags |= PLAYER_CHEAT_ALWAYS_CRIT; - if (sArgs.find("checkcast") != std::string::npos || sArgs.find("CHECKCAST") != std::string::npos || sArgs.find("check") != std::string::npos || sArgs.find("CHECK") != std::string::npos) - flags |= PLAYER_CHEAT_NO_CHECK_CAST; - if (sArgs.find("proc") != std::string::npos || sArgs.find("PROC") != std::string::npos) - flags |= PLAYER_CHEAT_ALWAYS_PROC; - if (sArgs.find("video") != std::string::npos || sArgs.find("VIDEO") != std::string::npos) - flags |= PLAYER_VIDEO_MODE; - - Player* pTarget = GetSelectedPlayer(); - if (!pTarget) - pTarget = m_session->GetPlayer(); - PSendSysMessage("%s flags 0x%x for `%s`.", enable ? "Adding" : "Removing", flags, pTarget->GetName()); - if (enable) - pTarget->EnableOption(flags); - else - pTarget->RemoveOption(flags); - - if (flags & PLAYER_VIDEO_MODE) - { - UpdateMask m; - m.SetCount(UNIT_END); - m.SetBit(UNIT_FIELD_FLAGS); - pTarget->RefreshBitsForVisibleUnits(&m, TYPEMASK_UNIT); - m.SetCount(PLAYER_END); - m.SetBit(UNIT_FIELD_FLAGS); - pTarget->RefreshBitsForVisibleUnits(&m, TYPEMASK_PLAYER); - } - return true; -} - /// Display the list of GMs bool ChatHandler::HandleGMListFullCommand(char* /*args*/) { diff --git a/src/game/Commands/UnitCommands.cpp b/src/game/Commands/UnitCommands.cpp index 532b9cc7b..8244cdfbd 100644 --- a/src/game/Commands/UnitCommands.cpp +++ b/src/game/Commands/UnitCommands.cpp @@ -1847,7 +1847,7 @@ bool ChatHandler::HandleDieHelper(Unit* target) return false; if (player->IsGod()) - player->SetGodMode(false); + player->SetCheatGod(false); } if (target->IsAlive()) diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp index 0115aa6c1..211c91ddd 100644 --- a/src/game/Handlers/MiscHandler.cpp +++ b/src/game/Handlers/MiscHandler.cpp @@ -753,6 +753,9 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) Player* const pPlayer = GetPlayer(); + if (pPlayer->HasCheatOption(PLAYER_CHEAT_IGNORE_TRIGGERS)) + return; + if (pPlayer->IsTaxiFlying()) { DEBUG_LOG("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID: %u", pPlayer->GetName(), pPlayer->GetGUIDLow(), triggerId); @@ -885,7 +888,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) pPlayer->SpawnCorpseBones(); } - if (!pPlayer->IsGameMaster()) + if (!pPlayer->IsGameMaster() && !pPlayer->HasCheatOption(PLAYER_CHEAT_TRIGGER_PASS)) { bool const bLevelCheck = pPlayer->GetLevel() < pTeleTrigger->requiredLevel && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_LEVEL); bool const bConditionCheck = pTeleTrigger->requiredCondition && !IsConditionSatisfied(pTeleTrigger->requiredCondition, pPlayer, pPlayer->GetMap(), pPlayer, CONDITION_FROM_AREATRIGGER); diff --git a/src/game/Language.h b/src/game/Language.h index caa073f0e..e8da20245 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -345,10 +345,10 @@ enum MangosStrings LANG_GOD_OFF = 350, LANG_YOU_SET_WALLCLIMB = 351, LANG_YOUR_WALLCLIMB_SET = 352, - // 353 not used - // 354 not used - // 355 not used - // 356 not used + LANG_CHEAT_NO_CD_ON = 353, + LANG_CHEAT_NO_CD_OFF = 354, + LANG_YOU_SET_NO_CD = 355, + LANG_YOUR_NO_CD_SET = 356, LANG_AREATRIGER_NOT_HAS_TARGET = 357, LANG_COMMAND_NOTRIGGERFOUND = 358, LANG_TRIGGER_TARGET_LIST_CHAT = 359, @@ -360,11 +360,11 @@ enum MangosStrings LANG_TRIGGER_QUEST = 365, LANG_TRIGGER_EXPLORE_QUEST = 366, LANG_TRIGGER_REQ_LEVEL = 367, - // = 368, not used - // = 369, not used - // 370 used in master branch - // 371 used in master branch - // 372 used in master branch + LANG_YOU_SET_GOD = 368, + LANG_YOUR_GOD_SET = 369, + LANG_CHEAT_INSTANT_CAST_ON = 370, + LANG_CHEAT_INSTANT_CAST_OFF = 371, + LANG_GROUP_INFO = 372, LANG_COMMAND_TICKETRESPONSE = 373, LANG_COMMAND_TICKETCOUNT_CONSOLE = 374, LANG_COMMAND_TICKETNOTEXIST_NAME = 375, @@ -575,8 +575,6 @@ enum MangosStrings LANG_PINFO_LEVEL = 549, LANG_PINFO_NO_REP = 550, - LANG_GROUP_INFO = 640, - LANG_YOU_SET_EXPLORE_ALL = 551, LANG_YOU_SET_EXPLORE_NOTHING = 552, LANG_YOURS_EXPLORE_SET_ALL = 553, @@ -661,9 +659,37 @@ enum MangosStrings LANG_COMMAND_SOUND_NOT_FOUND = 617, LANG_COMMAND_SOUND_LIST = 618, - //LANG_BG_EY_START_ONE_MINUTE = 636, - //LANG_BG_EY_START_HALF_MINUTE = 637, - //LANG_BG_EY_HAS_BEGUN = 638, + // cheat commands + LANG_YOU_SET_INSTANT_CAST = 619, + LANG_YOUR_INSTANT_CAST_SET = 620, + LANG_CHEAT_NO_POWER_COST_ON = 621, + LANG_CHEAT_NO_POWER_COST_OFF = 622, + LANG_YOU_SET_NO_POWER_COST = 623, + LANG_YOUR_NO_POWER_COST_SET = 624, + LANG_CHEAT_IMMUNE_TO_AURA_ON = 625, + LANG_CHEAT_IMMUNE_TO_AURA_OFF = 626, + LANG_YOU_SET_IMMUNE_TO_AURA = 627, + LANG_YOUR_IMMUNE_TO_AURA_SET = 628, + LANG_CHEAT_ALWAYS_CRIT_ON = 629, + LANG_CHEAT_ALWAYS_CRIT_OFF = 630, + LANG_YOU_SET_ALWAYS_CRIT = 631, + LANG_YOUR_ALWAYS_CRIT_SET = 632, + LANG_CHEAT_NO_CAST_CHECK_ON = 633, + LANG_CHEAT_NO_CAST_CHECK_OFF = 634, + LANG_YOU_SET_NO_CAST_CHECK = 635, + LANG_YOUR_NO_CAST_CHECK_SET = 636, + LANG_CHEAT_ALWAYS_PROC_ON = 637, + LANG_CHEAT_ALWAYS_PROC_OFF = 638, + LANG_YOU_SET_ALWAYS_PROC = 639, + LANG_YOUR_ALWAYS_PROC_SET = 640, + LANG_CHEAT_TRIGGER_PASS_ON = 641, + LANG_CHEAT_TRIGGER_PASS_OFF = 642, + LANG_YOU_SET_TRIGGER_PASS = 643, + LANG_YOUR_TRIGGER_PASS_SET = 644, + LANG_CHEAT_IGNORE_TRIGGERS_ON = 645, + LANG_CHEAT_IGNORE_TRIGGERS_OFF = 646, + LANG_YOU_SET_IGNORE_TRIGGERS = 647, + LANG_YOUR_IGNORE_TRIGGERS_SET = 648, // 639 - 649 not used LANG_BG_ALLY = 650, diff --git a/src/game/Maps/MapManager.cpp b/src/game/Maps/MapManager.cpp index fde49a23f..ab6e43610 100644 --- a/src/game/Maps/MapManager.cpp +++ b/src/game/Maps/MapManager.cpp @@ -187,7 +187,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) if (entry->IsRaid()) { // GMs can avoid raid limitations - if (!player->IsGameMaster() && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_RAID)) + if (!player->IsGameMaster() && !player->HasCheatOption(PLAYER_CHEAT_TRIGGER_PASS) && + !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_RAID)) { // can only enter in a raid group Group* group = player->GetGroup(); diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 6771a39af..c0b74279c 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -596,8 +596,6 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * updateMask->SetBit(GAMEOBJECT_DYN_FLAGS); } - if (target->HasOption(PLAYER_VIDEO_MODE) && isType(TYPEMASK_UNIT)) - updateMask->SetBit(UNIT_FIELD_FLAGS); } else // case UPDATETYPE_VALUES { @@ -693,9 +691,6 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * (index >= PLAYER_FIELD_RES_BUFF_MODS_NEGATIVE && index <= (PLAYER_FIELD_RES_BUFF_MODS_NEGATIVE + 6)) || (index >= PLAYER_FIELD_POSSTAT0 && index <= PLAYER_FIELD_POSSTAT4)) *data << uint32(m_floatValues[index]); - // Video maker - hide unit name, etc ... - else if (index == UNIT_FIELD_FLAGS && target->HasOption(PLAYER_VIDEO_MODE) && target != this) - *data << (m_uint32Values[index] | UNIT_FLAG_NOT_SELECTABLE); // Gamemasters should be always able to select units and view auras else if (index == UNIT_FIELD_FLAGS && target->IsGameMaster()) *data << ((m_uint32Values[index] | UNIT_FLAG_AURAS_VISIBLE) & ~UNIT_FLAG_NOT_SELECTABLE); @@ -3629,10 +3624,6 @@ SpellMissInfo WorldObject::MagicSpellHitResult(Unit* pVictim, SpellEntry const* int32 missChance = 10000 - hitChance; int32 rand = irand(0, 10000); - if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || - (pVictim->IsPlayer() && pVictim->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) - missChance = 0; - if (rand < missChance) return SPELL_MISS_RESIST; diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 6a239fb25..f31f43a3d 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -575,7 +575,7 @@ Player::Player(WorldSession *session) : Unit(), // Phasing worldMask = WORLD_DEFAULT_CHAR; i_AI = nullptr; - _playerOptions = 0x0; + m_cheatOptions = 0x0; m_DbSaveDisabled = false; m_lastFromClientCastedSpellID = 0; @@ -2700,17 +2700,106 @@ void Player::SetGMVisible(bool on, bool notify) CharacterDatabase.PExecute("UPDATE characters SET extra_flags = %u WHERE guid = %u", m_ExtraFlags, GetGUIDLow()); } -void Player::SetGodMode(bool on, bool notify) +void Player::SetCheatGod(bool on, bool notify) { - SetOption(PLAYER_CHEAT_GOD, on); + SetCheatOption(PLAYER_CHEAT_GOD, on); if (notify) { - ChatHandler(this).SendSysMessage(on ? LANG_GOD_ON : LANG_GOD_OFF); GetSession()->SendNotification(on ? LANG_GOD_ON : LANG_GOD_OFF); } } +void Player::SetCheatNoCooldown(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_NO_COOLDOWN, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_NO_CD_ON : LANG_CHEAT_NO_CD_OFF); + } +} + +void Player::SetCheatInstantCast(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_NO_CAST_TIME, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_INSTANT_CAST_ON : LANG_CHEAT_INSTANT_CAST_OFF); + } +} + +void Player::SetCheatNoPowerCost(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_NO_POWER, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_NO_POWER_COST_ON : LANG_CHEAT_NO_POWER_COST_OFF); + } +} + +void Player::SetCheatImmuneToAura(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_IMMUNE_AURA, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_IMMUNE_TO_AURA_ON : LANG_CHEAT_IMMUNE_TO_AURA_OFF); + } +} + +void Player::SetCheatAlwaysCrit(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_ALWAYS_CRIT, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_ALWAYS_CRIT_ON : LANG_CHEAT_ALWAYS_CRIT_OFF); + } +} + +void Player::SetCheatNoCastCheck(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_NO_CHECK_CAST, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_NO_CAST_CHECK_ON : LANG_CHEAT_NO_CAST_CHECK_OFF); + } +} + +void Player::SetCheatAlwaysProc(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_ALWAYS_PROC, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_ALWAYS_PROC_ON : LANG_CHEAT_ALWAYS_PROC_OFF); + } +} + +void Player::SetCheatTriggerPass(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_TRIGGER_PASS, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_TRIGGER_PASS_ON : LANG_CHEAT_TRIGGER_PASS_OFF); + } +} + +void Player::SetCheatIgnoreTriggers(bool on, bool notify) +{ + SetCheatOption(PLAYER_CHEAT_IGNORE_TRIGGERS, on); + + if (notify) + { + GetSession()->SendNotification(on ? LANG_CHEAT_IGNORE_TRIGGERS_ON : LANG_CHEAT_IGNORE_TRIGGERS_OFF); + } +} + bool Player::IsAllowedWhisperFrom(ObjectGuid guid) const { if (PlayerSocial const* social = GetSocial()) @@ -7210,7 +7299,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) ApplySpellMod(spellInfo->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance); - if (roll_chance_f(chance) || HasOption(PLAYER_CHEAT_ALWAYS_PROC)) + if (roll_chance_f(chance) || HasCheatOption(PLAYER_CHEAT_ALWAYS_PROC)) { uint32 charges = item->GetEnchantmentCharges(EnchantmentSlot(e_slot)); @@ -14919,7 +15008,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) SetAcceptWhispers(true); break; } - SetGodMode(true); + SetCheatGod(true); } if (extraflags & PLAYER_EXTRA_WHISP_RESTRICTION) @@ -20856,6 +20945,9 @@ bool Player::ChangeQuestsForRace(uint8 oldRace, uint8 newRace) bool Player::IsImmuneToSpellEffect(SpellEntry const *spellInfo, SpellEffectIndex index, bool castOnSelf) const { + if (HasCheatOption(PLAYER_CHEAT_IMMUNE_AURA) && spellInfo->EffectApplyAuraName[index] && !spellInfo->IsPositiveEffect(index)) + return true; + switch (spellInfo->Effect[index]) { case SPELL_EFFECT_ATTACK_ME: diff --git a/src/game/Objects/Player.h b/src/game/Objects/Player.h index 011f770ee..603823e0c 100644 --- a/src/game/Objects/Player.h +++ b/src/game/Objects/Player.h @@ -384,19 +384,18 @@ enum AtLoginFlags AT_LOGIN_FIRST = 0x20, }; -// Nostalrius -enum PlayerCheatOptions +enum PlayerCheatOptions : uint16 { - PLAYER_CHEAT_GOD = 0x001, - PLAYER_CHEAT_NO_COOLDOWN = 0x002, - PLAYER_CHEAT_NO_CAST_TIME = 0x004, - PLAYER_CHEAT_NO_POWER = 0x008, - PLAYER_CHEAT_NO_MOD_SPEED = 0x010, - PLAYER_CHEAT_ALWAYS_CRIT = 0x020, - PLAYER_CHEAT_NO_CHECK_CAST = 0x040, - PLAYER_CHEAT_ALWAYS_PROC = 0x080, - PLAYER_VIDEO_MODE = 0x100, - PLAYER_CHEAT_UNRANDOMIZE = 0x200, + PLAYER_CHEAT_GOD = 0x001, + PLAYER_CHEAT_NO_COOLDOWN = 0x002, + PLAYER_CHEAT_NO_CAST_TIME = 0x004, + PLAYER_CHEAT_NO_POWER = 0x008, + PLAYER_CHEAT_IMMUNE_AURA = 0x010, + PLAYER_CHEAT_ALWAYS_CRIT = 0x020, + PLAYER_CHEAT_NO_CHECK_CAST = 0x040, + PLAYER_CHEAT_ALWAYS_PROC = 0x080, + PLAYER_CHEAT_TRIGGER_PASS = 0x100, + PLAYER_CHEAT_IGNORE_TRIGGERS = 0x200, }; typedef std::map QuestStatusMap; @@ -916,33 +915,43 @@ class MANGOS_DLL_SPEC Player final: public Unit private: uint32 m_gmInvisibilityLevel; uint32 m_currentTicketCounter; - uint32 _playerOptions; + uint16 m_cheatOptions; public: bool IsAcceptTickets() const { return GetSession()->GetSecurity() >= SEC_GAMEMASTER && (m_ExtraFlags & PLAYER_EXTRA_GM_ACCEPT_TICKETS); } void SetAcceptTicket(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_GM_ACCEPT_TICKETS; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_ACCEPT_TICKETS; } - bool IsGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; } void SetGameMaster(bool on, bool notify = false); bool IsGMChat() const { return GetSession()->GetSecurity() >= SEC_MODERATOR && (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT); } void SetGMChat(bool on, bool notify = false); bool IsTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; } void SetTaxiCheater(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } + void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } bool IsGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); } void SetGMVisible(bool on, bool notify = false); - void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } - void SetGodMode(bool on, bool notify = false); - bool IsGod() const { return HasOption(PLAYER_CHEAT_GOD); } - - bool HasOption(uint32 o) const { return (_playerOptions & o); } - void EnableOption(uint32 o) { _playerOptions |= o; } - void RemoveOption(uint32 o) { _playerOptions &= (~o); } - void SetOption(PlayerCheatOptions o, bool on) + + void SetCheatGod(bool on, bool notify = false); + bool IsGod() const { return HasCheatOption(PLAYER_CHEAT_GOD); } + void SetCheatNoCooldown(bool on, bool notify = false); + void SetCheatInstantCast(bool on, bool notify = false); + void SetCheatNoPowerCost(bool on, bool notify = false); + void SetCheatImmuneToAura(bool on, bool notify = false); + void SetCheatAlwaysCrit(bool on, bool notify = false); + void SetCheatNoCastCheck(bool on, bool notify = false); + void SetCheatAlwaysProc(bool on, bool notify = false); + void SetCheatTriggerPass(bool on, bool notify = false); + void SetCheatIgnoreTriggers(bool on, bool notify = false); + uint16 GetCheatOptions() const { return m_cheatOptions; } + bool HasCheatOption(PlayerCheatOptions o) const { return (m_cheatOptions & o); } + void EnableCheatOption(PlayerCheatOptions o) { m_cheatOptions |= o; } + void RemoveCheatOption(PlayerCheatOptions o) { m_cheatOptions &= (~o); } + void SetCheatOption(PlayerCheatOptions o, bool on) { if (on) - EnableOption(o); + EnableCheatOption(o); else - RemoveOption(o); + RemoveCheatOption(o); } + uint32 GetGMInvisibilityLevel() const { return m_gmInvisibilityLevel; } void SetGMInvisibilityLevel(uint32 level) { m_gmInvisibilityLevel = level; } uint32 GetGMTicketCounter() const { return m_currentTicketCounter; } diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index e80334455..88fa495fa 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -602,8 +602,6 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage) { if (!HasAuraType(auraType)) return; - if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) - return; // The chance to dispel an aura depends on the damage taken with respect to the casters level. uint32 max_dmg = GetLevel() > 8 ? 25 * GetLevel() - 150 : 50; @@ -628,8 +626,6 @@ void Unit::RemoveFearEffectsByDamageTaken(uint32 damage, uint32 exceptSpellId, D { if (!HasAuraType(SPELL_AURA_MOD_FEAR)) return; - if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) - return; // Formula derived from Youfie's post here: // https://forum.nostalrius.org/viewtopic.php?f=5&t=17424#p119432 @@ -2209,7 +2205,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackT MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted) const { // Nostalrius : cheat. - if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_ALWAYS_CRIT)) + if (IsPlayer() && ToPlayer()->HasCheatOption(PLAYER_CHEAT_ALWAYS_CRIT)) return MELEE_HIT_CRIT; if (pVictim->IsCreature() && ((Creature*)pVictim)->IsInEvadeMode()) @@ -2345,9 +2341,6 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackT tmp = crit_chance; if (IsPlayer() && SpellCasted && tmp > 0) { - if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || - (pVictim->IsPlayer() && pVictim->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) - tmp = 0; if (roll_chance_i(tmp / 100)) { DEBUG_LOG("RollMeleeOutcomeAgainst: BLOCKED CRIT"); @@ -2510,8 +2503,7 @@ bool Unit::IsSpellBlocked(WorldObject* pCaster, Unit* pVictim, SpellEntry const* if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) blockChance *= pVictim->GetLevel() / 10.0f; - if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || (blockChance < 0) || - (pCaster->IsPlayer() && pCaster->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) + if (blockChance < 0) blockChance = 0; return roll_chance_f(blockChance); @@ -5102,7 +5094,7 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS if (IsCreature() && !GetOwnerGuid().IsPlayer()) return false; - if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_ALWAYS_CRIT)) + if (IsPlayer() && ToPlayer()->HasCheatOption(PLAYER_CHEAT_ALWAYS_CRIT)) return true; // not critting spell @@ -5191,11 +5183,9 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS DEBUG_UNIT(this, DEBUG_SPELL_COMPUTE_RESISTS, "%s [ID:%u] Crit chance %f.", spellProto->SpellName[2].c_str(), spellProto->Id, crit_chance); - if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || - (pVictim->IsPlayer() && pVictim->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) - crit_chance = 0; if (roll_chance_f(crit_chance)) return true; + return false; } diff --git a/src/game/PlayerBots/PlayerBotAI.cpp b/src/game/PlayerBots/PlayerBotAI.cpp index 19ab7d534..3fb9b5c27 100644 --- a/src/game/PlayerBots/PlayerBotAI.cpp +++ b/src/game/PlayerBots/PlayerBotAI.cpp @@ -41,7 +41,7 @@ void PlayerBotAI::Remove() void PlayerBotFleeingAI::OnPlayerLogin() { me->GetMotionMaster()->MoveFleeing(me); - me->SetGodMode(true); + me->SetCheatGod(true); } /// MageOrgrimmarAttackerAI event diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index a37759863..f8c005fcc 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -1549,9 +1549,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) for (int eff = 0; eff < MAX_EFFECT_INDEX; ++eff) if (unit->IsEffectResist(m_spellInfo, eff)) { - if ((pRealUnitCaster && pRealUnitCaster->IsPlayer() && pRealUnitCaster->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || - (unit->IsPlayer() && unit->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) - break; effectMask &= ~(1 << eff); if (!effectMask) return; @@ -3354,8 +3351,8 @@ SpellCastResult Spell::prepare(Aura* triggeredByAura, uint32 chance) // Fill cost data m_powerCost = CalculatePowerCost(m_spellInfo, m_casterUnit, this, m_CastItem); - if (Player* pPlayerCaster = m_caster->ToPlayer()) - if (pPlayerCaster->HasOption(PLAYER_CHEAT_NO_POWER)) + if (Player* pPlayer = m_caster->ToPlayer()) + if (pPlayer->HasCheatOption(PLAYER_CHEAT_NO_POWER)) m_powerCost = 0; if (!IsChannelingVisual()) @@ -3398,7 +3395,7 @@ SpellCastResult Spell::prepare(Aura* triggeredByAura, uint32 chance) m_casttime = m_spellInfo->GetCastTime(this); if (Player* pPlayerCaster = m_caster->ToPlayer()) - if (pPlayerCaster->HasOption(PLAYER_CHEAT_NO_CAST_TIME)) + if (pPlayerCaster->HasCheatOption(PLAYER_CHEAT_NO_CAST_TIME)) m_casttime = 0; m_duration = m_spellInfo->CalculateDuration(m_caster); @@ -4004,8 +4001,14 @@ void Spell::SendSpellCooldown() if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE)) return; - if (m_caster->ToPlayer() && m_caster->ToPlayer()->HasOption(PLAYER_CHEAT_NO_COOLDOWN)) - return; + if (Player* pPlayer = m_casterUnit->ToPlayer()) + { + if (pPlayer->HasCheatOption(PLAYER_CHEAT_NO_COOLDOWN)) + { + pPlayer->RemoveSpellCooldown(m_spellInfo->Id, true); + return; + } + } m_casterUnit->AddSpellAndCategoryCooldowns(m_spellInfo, m_CastItem ? m_CastItem->GetEntry() : 0, this); } @@ -4290,7 +4293,7 @@ void Spell::HandleAddTargetTriggerAuras() // Calculate chance at that moment (can be depend for example from combo points) int32 auraBasePoints = (*i)->GetBasePoints(); int32 chance = m_casterUnit->CalculateSpellDamage(target, auraSpellInfo, auraSpellIdx, &auraBasePoints); - if ((m_casterUnit->IsPlayer() && m_casterUnit->ToPlayer()->HasOption(PLAYER_CHEAT_ALWAYS_PROC)) || roll_chance_i(chance)) + if ((m_casterUnit->IsPlayer() && m_casterUnit->ToPlayer()->HasCheatOption(PLAYER_CHEAT_ALWAYS_PROC)) || roll_chance_i(chance)) m_casterUnit->CastSpell(target, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, nullptr, (*i)); } } @@ -5054,6 +5057,10 @@ void Spell::TakePower() if (m_CastItem || m_triggeredByAuraSpell || IsChannelingVisual() || !m_casterUnit) return; + if (Player* pPlayer = m_casterUnit->ToPlayer()) + if (pPlayer->HasCheatOption(PLAYER_CHEAT_NO_POWER)) + return; + // health as power used if (m_spellInfo->powerType == POWER_HEALTH) { @@ -5333,7 +5340,7 @@ void Spell::RemoveChanneledAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mo SpellCastResult Spell::CheckCast(bool strict) { - if (m_caster->IsPlayer() && m_caster->ToPlayer()->HasOption(PLAYER_CHEAT_NO_CHECK_CAST)) + if (m_caster->IsPlayer() && m_caster->ToPlayer()->HasCheatOption(PLAYER_CHEAT_NO_CHECK_CAST)) return SPELL_CAST_OK; // Prevent casting while sitting unless the spell allows it @@ -7763,9 +7770,6 @@ void Spell::Delayed() if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) return; - if (m_caster->IsPlayer() && m_caster->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) - return; - //check resist chance int32 resistChance = 100; //must be initialized to 100 for percent modifiers ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, resistChance, this); @@ -8510,7 +8514,7 @@ void Spell::TriggerGlobalCooldown() return; if (Player* pPlayer = m_casterUnit->ToPlayer()) - if (pPlayer->HasOption(PLAYER_CHEAT_NO_COOLDOWN)) + if (pPlayer->HasCheatOption(PLAYER_CHEAT_NO_COOLDOWN)) return; int32 gcd = m_spellInfo->StartRecoveryTime; diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index d9c0ad169..4d3336eb5 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -4532,13 +4532,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) case 20114: // BM Only OFF { if (Player* pPlayer = ToPlayer(m_caster)) - pPlayer->SetGodMode(false, true); + pPlayer->SetCheatGod(false, true); return; } case 20115: // BM Only ON { if (Player* pPlayer = ToPlayer(m_caster)) - pPlayer->SetGodMode(true, true); + pPlayer->SetCheatGod(true, true); return; } case 29313: // CooldownAll diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 2637be4b1..c942d8d6d 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -459,7 +459,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S if (Player* modOwner = GetSpellModOwner()) { modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance); - if (modOwner->HasOption(PLAYER_CHEAT_ALWAYS_PROC)) + if (modOwner->HasCheatOption(PLAYER_CHEAT_ALWAYS_PROC)) return true; }