Esempio n. 1
0
            SpellCastResult CheckCast()
            {
                if (Unit* caster = GetCaster())
                {
                    if (caster->HasUnitState(UNIT_STATE_ROOT))
                    {
                        SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_DO_WHILE_ROOTED);
                        return SPELL_FAILED_CUSTOM_ERROR;
                    }
                }

                if (Unit* caster = GetCaster())
                {
                    Position const* pos = GetExplTargetDest();
                    MotionMaster* motionMaster = caster->GetMotionMaster();
                    float x, y, z;
                    caster->GetContactPoint(caster, x, y, z, CONTACT_DISTANCE);
                    float dist = ((pos->GetPositionZ()) - z);

                    if(dist > 5.0f || dist < -5.0f)
                        return SPELL_FAILED_NOPATH;
                }

                return SPELL_CAST_OK;
            }
            SpellCastResult CheckCast()
            {
                if (Unit* caster = GetCaster())
                {
                    if (caster->HasUnitState(UNIT_STATE_ROOT))
                    {
                        SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_DO_WHILE_ROOTED);
                        return SPELL_FAILED_CUSTOM_ERROR;
                    }
                }

                if (Unit* caster = GetCaster())
                {
                    Position const* pos = GetExplTargetDest();
                    float x, y, z;
                    caster->GetContactPoint(caster, x, y, z, CONTACT_DISTANCE);
                    float dist = ((pos->GetPositionZ()) - z);
                    float delta = 7.5f;

                    if(caster->ToPlayer()->IsFalling())
                        delta = 40.0f;
                    if(dist > delta)
                        return SPELL_FAILED_NOPATH;
                }
                return SPELL_CAST_OK;
            }
Esempio n. 3
0
        SpellCastResult CheckCast()
        {
            if (Unit* target = GetExplTargetUnit())
                if (target->GetEntry() == NPC_LUCKY_WILHELM)
                    return SPELL_CAST_OK;

            SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
            return SPELL_FAILED_CUSTOM_ERROR;
        }
            SpellCastResult CheckTarget()
            {
                if (IsVampire(GetExplTargetUnit()))
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
Esempio n. 5
0
            SpellCastResult CheckClass()
            {
                if (GetCaster()->getClass() != CLASS_DEATH_KNIGHT)
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_DEATH_KNIGHT);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
            SpellCastResult CheckFireTotem()
            {
                // fire totem
                if (!GetCaster()->m_SummonSlot[1])
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
 SpellCastResult CheckRequirement()
 {
     if(GetCaster()->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID) == 46106 ||
         GetCaster()->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID) == 46069 ||
         GetCaster()->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID) == 46070)
     {
         GetCaster()->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
         return SPELL_CAST_OK;
     } else {
         SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_LANCE_EQUIPPED);
         return SPELL_FAILED_CUSTOM_ERROR;
     }
 }
Esempio n. 8
0
            SpellCastResult CheckCast()
            {
				Unit* pet = GetCaster()->GetGuardianPet();
				if (!pet)
					pet = GetCaster()->GetCharm();

				if (!pet)
					return SPELL_FAILED_NO_PET;

				if (!pet->IsAlive())
				{
					SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD);
                    return SPELL_FAILED_CUSTOM_ERROR;
				}

				if (!GetCaster()->IsWithinLOSInMap(pet))
					return SPELL_FAILED_LINE_OF_SIGHT;

                return SPELL_CAST_OK;
            }