mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7468] Convert pet cast check code to use SpellCastResult and finaly fix SPELL_CAST_OK value (255 custom value now)
This commit is contained in:
parent
0e987bf59e
commit
5d6cb5fe80
7 changed files with 20 additions and 20 deletions
|
|
@ -189,7 +189,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||
|
||||
Spell *spell = new Spell(pet, spellInfo, false);
|
||||
|
||||
int16 result = spell->PetCanCast(unit_target);
|
||||
SpellCastResult result = spell->CheckPetCast(unit_target);
|
||||
|
||||
//auto turn to target unless possessed
|
||||
if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
|
||||
|
|
@ -200,10 +200,10 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||
if(Unit* powner = pet->GetCharmerOrOwner())
|
||||
if(powner->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer((Player*)powner);
|
||||
result = -1;
|
||||
result = SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
if(result == -1)
|
||||
if(result == SPELL_CAST_OK)
|
||||
{
|
||||
((Creature*)pet)->AddCreatureSpellCooldown(spellid);
|
||||
if (((Creature*)pet)->isPet())
|
||||
|
|
@ -610,8 +610,8 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
|||
spell->m_cast_count = cast_count; // probably pending spell cast
|
||||
spell->m_targets = targets;
|
||||
|
||||
int16 result = spell->PetCanCast(NULL);
|
||||
if(result == -1)
|
||||
SpellCastResult result = spell->CheckPetCast(NULL);
|
||||
if(result == SPELL_CAST_OK)
|
||||
{
|
||||
pet->AddCreatureSpellCooldown(spellid);
|
||||
if(pet->isPet())
|
||||
|
|
|
|||
|
|
@ -683,8 +683,7 @@ enum SpellEffects
|
|||
|
||||
enum SpellCastResult
|
||||
{
|
||||
SPELL_CAST_OK = 0, //FIXME: used as success result currently
|
||||
SPELL_FAILED_AFFECTING_COMBAT = 0, //FIXME: used as success result currently
|
||||
SPELL_FAILED_AFFECTING_COMBAT = 0,
|
||||
SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 1,
|
||||
SPELL_FAILED_ALREADY_AT_FULL_MANA = 2,
|
||||
SPELL_FAILED_ALREADY_AT_FULL_POWER = 3,
|
||||
|
|
@ -865,7 +864,9 @@ enum SpellCastResult
|
|||
SPELL_FAILED_ITEM_AT_MAX_CHARGES = 178,
|
||||
SPELL_FAILED_NOT_IN_BARBERSHOP = 179,
|
||||
SPELL_FAILED_FISHING_TOO_LOW = 180,
|
||||
SPELL_FAILED_UNKNOWN = 181
|
||||
SPELL_FAILED_UNKNOWN = 181,
|
||||
|
||||
SPELL_CAST_OK = 255 //custom value, don't must be send to client
|
||||
};
|
||||
|
||||
// Spell aura states
|
||||
|
|
|
|||
|
|
@ -4394,7 +4394,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
int16 Spell::PetCanCast(Unit* target)
|
||||
SpellCastResult Spell::CheckPetCast(Unit* target)
|
||||
{
|
||||
if(!m_caster->isAlive())
|
||||
return SPELL_FAILED_CASTER_DEAD;
|
||||
|
|
@ -4458,11 +4458,7 @@ int16 Spell::PetCanCast(Unit* target)
|
|||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
|
||||
SpellCastResult result = CheckCast(true);
|
||||
if(result != SPELL_CAST_OK)
|
||||
return result;
|
||||
else
|
||||
return -1; //this allows to check spell fail 0, in combat
|
||||
return CheckCast(true);
|
||||
}
|
||||
|
||||
SpellCastResult Spell::CheckCasterAuras() const
|
||||
|
|
@ -4589,9 +4585,9 @@ bool Spell::CanAutoCast(Unit* target)
|
|||
}
|
||||
}
|
||||
|
||||
int16 result = PetCanCast(target);
|
||||
SpellCastResult result = CheckPetCast(target);
|
||||
|
||||
if(result == -1 || result == SPELL_FAILED_UNIT_NOT_INFRONT)
|
||||
if(result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
|
||||
{
|
||||
FillTargetMap();
|
||||
//check if among target units, our WANTED target is as well (->only self cast spells return false)
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ class Spell
|
|||
void TriggerSpell();
|
||||
|
||||
SpellCastResult CheckCast(bool strict);
|
||||
int16 PetCanCast(Unit* target);
|
||||
SpellCastResult CheckPetCast(Unit* target);
|
||||
|
||||
// handlers
|
||||
void handle_immediate();
|
||||
|
|
|
|||
|
|
@ -10615,8 +10615,11 @@ Player* Unit::GetSpellModOwner()
|
|||
}
|
||||
|
||||
///----------Pet responses methods-----------------
|
||||
void Unit::SendPetCastFail(uint32 spellid, uint8 msg)
|
||||
void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg)
|
||||
{
|
||||
if(msg == SPELL_CAST_OK)
|
||||
return;
|
||||
|
||||
Unit *owner = GetCharmerOrOwner();
|
||||
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void ClearComboPointHolders();
|
||||
|
||||
///----------Pet responses methods-----------------
|
||||
void SendPetCastFail(uint32 spellid, uint8 msg);
|
||||
void SendPetCastFail(uint32 spellid, SpellCastResult msg);
|
||||
void SendPetActionFeedback (uint8 msg);
|
||||
void SendPetTalk (uint32 pettalk);
|
||||
void SendPetSpellCooldown (uint32 spellid, time_t cooltime);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7467"
|
||||
#define REVISION_NR "7468"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue