mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Scripts/Player): some refactor related to PlayerCommand functions (#8975)
This commit is contained in:
@@ -16,12 +16,9 @@
|
||||
*/
|
||||
|
||||
#include "PlayerCommand.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
bool PlayerCommand::Learn(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all)
|
||||
bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all)
|
||||
{
|
||||
if (!spell)
|
||||
return false;
|
||||
@@ -77,7 +74,7 @@ bool PlayerCommand::Learn(ChatHandler* handler, Player* targetPlayer, uint32 spe
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlayerCommand::UnLearn(ChatHandler* handler, Player* target, uint32 spellId, char const* allStr)
|
||||
bool Acore::PlayerCommand::HandleUnlearnSpellCommand(ChatHandler* handler, Player* target, uint32 spellId, char const* allStr)
|
||||
{
|
||||
if (!spellId)
|
||||
return false;
|
||||
|
||||
@@ -15,19 +15,19 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PLAYER_COMMAND_H_
|
||||
#define _PLAYER_COMMAND_H_
|
||||
#ifndef _PLAYER_COMMAND_H
|
||||
#define _PLAYER_COMMAND_H
|
||||
#include "Chat.h"
|
||||
#include "Player.h"
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
class ChatHandler;
|
||||
class Player;
|
||||
|
||||
class PlayerCommand
|
||||
namespace Acore
|
||||
{
|
||||
public:
|
||||
static bool Learn(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all);
|
||||
static bool UnLearn(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all);
|
||||
// Used in player/character commands
|
||||
namespace PlayerCommand
|
||||
{
|
||||
bool HandleLearnSpellCommand(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all);
|
||||
bool HandleUnlearnSpellCommand(ChatHandler* handler, Player* targetPlayer, uint32 spell, char const* all);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PLAYER_COMMAND_H
|
||||
@@ -22,13 +22,11 @@ Comment: All learn related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "Chat.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "PlayerCommand.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
@@ -38,7 +36,7 @@ EndScriptData */
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class learn_commandscript : public CommandScript, public PlayerCommand
|
||||
class learn_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
learn_commandscript() : CommandScript("learn_commandscript") { }
|
||||
@@ -94,7 +92,7 @@ public:
|
||||
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
|
||||
uint32 spell = handler->extractSpellIdFromLink((char*)args);
|
||||
char const* all = strtok(nullptr, " ");
|
||||
return Learn(handler, targetPlayer, spell, all);
|
||||
return Acore::PlayerCommand::HandleLearnSpellCommand(handler, targetPlayer, spell, all);
|
||||
}
|
||||
|
||||
static bool HandleLearnAllGMCommand(ChatHandler* handler, char const* /*args*/)
|
||||
@@ -461,7 +459,7 @@ public:
|
||||
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
|
||||
uint32 spellId = handler->extractSpellIdFromLink((char*)args);
|
||||
char const* allStr = strtok(nullptr, " ");
|
||||
return UnLearn(handler, target, spellId, allStr);
|
||||
return Acore::PlayerCommand::HandleUnlearnSpellCommand(handler, target, spellId, allStr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "PlayerCommand.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Language.h"
|
||||
#include "PlayerCommand.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
@@ -27,7 +25,7 @@
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class player_commandscript : public CommandScript, public PlayerCommand
|
||||
class player_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
player_commandscript() : CommandScript("player_commandscript") { }
|
||||
@@ -68,7 +66,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
return Learn(handler, targetPlayer, spell, all);
|
||||
return Acore::PlayerCommand::HandleLearnSpellCommand(handler, targetPlayer, spell, all);
|
||||
}
|
||||
|
||||
static bool HandlePlayerUnLearnCommand(ChatHandler* handler, char const* args)
|
||||
@@ -93,7 +91,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
return UnLearn(handler, targetPlayer, spell, all);
|
||||
return Acore::PlayerCommand::HandleUnlearnSpellCommand(handler, targetPlayer, spell, all);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user