mirror of
https://github.com/mangosfour/server.git
synced 2025-12-20 16:37:04 +00:00
[11215] Replace direct code use in .npc tame by spell cast.
Only work different from old way: target creature despawned. So if this not expected use .respawn to it in gm mode or area respawn. Code simplification suggested originally by rsa.
This commit is contained in:
parent
9312ef7e78
commit
06fe777f82
6 changed files with 50 additions and 99 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include "VMapFactory.h"
|
||||
#include "BattleGround.h"
|
||||
#include "Util.h"
|
||||
#include "Chat.h"
|
||||
|
||||
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
|
||||
|
||||
|
|
@ -5003,7 +5004,15 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
|
||||
Player* plrCaster = (Player*)caster;
|
||||
|
||||
if(plrCaster->getClass() != CLASS_HUNTER)
|
||||
bool gmmode = m_triggeredBySpellInfo == NULL;
|
||||
|
||||
if (gmmode && !ChatHandler(plrCaster).FindCommand("npc tame"))
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_UNKNOWNERROR);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if(plrCaster->getClass() != CLASS_HUNTER && !gmmode)
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_UNITSCANTTAME);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
|
@ -5017,13 +5026,13 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if (target->getLevel() > plrCaster->getLevel())
|
||||
if (target->getLevel() > plrCaster->getLevel() && !gmmode)
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_TOOHIGHLEVEL);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if (target->GetCreatureInfo()->IsExotic() && !plrCaster->CanTameExoticPets())
|
||||
if (target->GetCreatureInfo()->IsExotic() && !plrCaster->CanTameExoticPets() && !gmmode)
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_CANTCONTROLEXOTIC);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue