aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2012-06-18 15:00:45 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2012-06-19 20:42:11 +0200
commitc19f13e6fcf48650888254a759bfd4a9c17a26c6 (patch)
treec68d879e9469f8b3f158519c3ce658bf0d1d3c55 /src/server/game
parentf90f5b6fb7fdff50dab0df5c821151b5ce7e19d2 (diff)
Core/Commands: Convert cast commands in commandscript
Diffstat (limited to 'src/server/game')
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp12
-rwxr-xr-xsrc/server/game/Chat/Chat.h7
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp256
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp2
4 files changed, 2 insertions, 275 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 72011a339f8..7d23b14110b 100755
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -92,17 +92,6 @@ ChatCommand* ChatHandler::getCommandTable()
{ NULL, 0, false, NULL, "", NULL }
};
- static ChatCommand castCommandTable[] =
- {
- { "back", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastBackCommand>, "", NULL },
- { "dist", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDistCommand>, "", NULL },
- { "self", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastSelfCommand>, "", NULL },
- { "target", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastTargetCommand>, "", NULL },
- { "dest", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDestCommand>, "", NULL },
- { "", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
static ChatCommand characterDeletedCommandTable[] =
{
{ "delete", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedDeleteCommand>, "", NULL },
@@ -328,7 +317,6 @@ ChatCommand* ChatHandler::getCommandTable()
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
{ "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
- { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
{ "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 0a5cd9391f6..1612de741a6 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -147,13 +147,6 @@ class ChatHandler
bool HandleBanListCharacterCommand(const char* args);
bool HandleBanListIPCommand(const char* args);
- bool HandleCastCommand(const char *args);
- bool HandleCastBackCommand(const char *args);
- bool HandleCastDistCommand(const char *args);
- bool HandleCastSelfCommand(const char *args);
- bool HandleCastTargetCommand(const char *args);
- bool HandleCastDestCommand(const char *args);
-
bool HandleCharacterCustomizeCommand(const char* args);
bool HandleCharacterChangeFactionCommand(const char* args);
bool HandleCharacterChangeRaceCommand(const char * args);
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index 4decc7a523f..3898232fa40 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -3814,227 +3814,6 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args)
return true;
}
-bool ChatHandler::HandleCastCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- m_session->GetPlayer()->CastSpell(target, spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastBackCommand(const char *args)
-{
- Creature* caster = getSelectedCreature();
-
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(m_session->GetPlayer(), spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastDistCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- char *distStr = strtok(NULL, " ");
-
- float dist = 0;
-
- if (distStr)
- sscanf(distStr, "%f", &dist);
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, dist);
-
- m_session->GetPlayer()->CastSpell(x, y, z, spell, triggered);
- return true;
-}
-
-bool ChatHandler::HandleCastTargetCommand(const char *args)
-{
- Creature* caster = getSelectedCreature();
-
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!caster->getVictim())
- {
- SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(caster->getVictim(), spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastDestCommand(const char *args)
-{
- Unit* caster = getSelectedUnit();
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* px = strtok(NULL, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
-
- if (!px || !py || !pz)
- return false;
-
- float x = (float)atof(px);
- float y = (float)atof(py);
- float z = (float)atof(pz);
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(x, y, z, spell, triggered);
-
- return true;
-}
-
/*
ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
Without this function 3rd party scripting library will get linking errors (unresolved external)
@@ -4061,41 +3840,6 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
return true;
}
-bool ChatHandler::HandleCastSelfCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- return false;
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- target->CastSpell(target, spell, false);
-
- return true;
-}
-
/// Define the 'Message of the day' for the realm
bool ChatHandler::HandleServerSetMotdCommand(const char *args)
{
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index a1a23ca7074..8bc4ce24665 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -46,6 +46,7 @@ void AddSC_SmartSCripts();
//Commands
void AddSC_account_commandscript();
void AddSC_achievement_commandscript();
+void AddSC_cast_commandscript();
void AddSC_debug_commandscript();
void AddSC_event_commandscript();
void AddSC_gm_commandscript();
@@ -649,6 +650,7 @@ void AddCommandScripts()
{
AddSC_account_commandscript();
AddSC_achievement_commandscript();
+ AddSC_cast_commandscript();
AddSC_debug_commandscript();
AddSC_event_commandscript();
AddSC_gm_commandscript();