mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Commands: Allow .cooldown command to work on player pets
This commit is contained in:
1
sql/updates/world/3.3.5/2016_07_16_06_world.sql
Normal file
1
sql/updates/world/3.3.5/2016_07_16_06_world.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `command` SET `help`='Syntax: .cooldown [#spell_id]\r\n\r\nRemove all (if spell_id not provided) or #spel_id spell cooldown from selected character or their pet or you (if no selection).' WHERE `name`='cooldown';
|
||||
@@ -703,7 +703,7 @@ public:
|
||||
|
||||
static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
Unit* target = handler->getSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
@@ -711,7 +711,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string nameLink = handler->GetNameLink(target);
|
||||
Player* owner = target->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (!owner)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string nameLink = handler->GetNameLink(owner);
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
@@ -728,13 +736,13 @@ public:
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellIid);
|
||||
if (!spellInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
handler->PSendSysMessage(LANG_UNKNOWN_SPELL, owner == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->GetSpellHistory()->ResetCooldown(spellIid, true);
|
||||
handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, owner == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user