diff options
| author | QAston <qaston@gmail.com> | 2011-08-06 22:49:25 +0200 |
|---|---|---|
| committer | QAston <qaston@gmail.com> | 2011-08-06 22:50:46 +0200 |
| commit | df87f00e73722117c5d49632dc39505f64512fa1 (patch) | |
| tree | 1fd97fa72d3fba057ad9323fd013bf252fabc7fb /src/server/game/Chat/Commands | |
| parent | 7187b1e88921fe92c03c8e2f944a669c2f9be3bf (diff) | |
Core/Commands: Add .cast dest #spellid #x #y #z which orders selected unit to cast a spell at selected destination.
Diffstat (limited to 'src/server/game/Chat/Commands')
| -rwxr-xr-x | src/server/game/Chat/Commands/Level3.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 1959feaaa0e..901d41e5c54 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -3957,6 +3957,51 @@ bool ChatHandler::HandleCastTargetCommand(const char *args) 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) |
