mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7165] More strict checking for client casted spells.
Allow explictly cast character spell from client only if it non-passive and show in spellbook/etc base at server data.
This commit is contained in:
parent
68b537dc30
commit
df13468ee1
4 changed files with 13 additions and 4 deletions
|
|
@ -3560,7 +3560,15 @@ void Player::DestroyForPlayer( Player *target ) const
|
||||||
bool Player::HasSpell(uint32 spell) const
|
bool Player::HasSpell(uint32 spell) const
|
||||||
{
|
{
|
||||||
PlayerSpellMap::const_iterator itr = m_spells.find(spell);
|
PlayerSpellMap::const_iterator itr = m_spells.find(spell);
|
||||||
return (itr != m_spells.end() && itr->second->state != PLAYERSPELL_REMOVED && !itr->second->disabled);
|
return (itr != m_spells.end() && itr->second->state != PLAYERSPELL_REMOVED &&
|
||||||
|
!itr->second->disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Player::HasActiveSpell(uint32 spell) const
|
||||||
|
{
|
||||||
|
PlayerSpellMap::const_iterator itr = m_spells.find(spell);
|
||||||
|
return (itr != m_spells.end() && itr->second->state != PLAYERSPELL_REMOVED &&
|
||||||
|
itr->second->active && !itr->second->disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell) const
|
TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell) const
|
||||||
|
|
|
||||||
|
|
@ -1476,6 +1476,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void CharmSpellInitialize();
|
void CharmSpellInitialize();
|
||||||
void PossessSpellInitialize();
|
void PossessSpellInitialize();
|
||||||
bool HasSpell(uint32 spell) const;
|
bool HasSpell(uint32 spell) const;
|
||||||
|
bool HasActiveSpell(uint32 spell) const; // show in spellbook
|
||||||
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
|
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
|
||||||
bool IsSpellFitByClassAndRace( uint32 spell_id ) const;
|
bool IsSpellFitByClassAndRace( uint32 spell_id ) const;
|
||||||
bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
|
bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,8 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not have spell or spell passive and not casted by client
|
// not have spell in spellbook or spell passive and not casted by client
|
||||||
if ( !_player->HasSpell (spellId) || IsPassiveSpell(spellId) )
|
if ( !_player->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
|
||||||
{
|
{
|
||||||
//cheater? kick? ban?
|
//cheater? kick? ban?
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7164"
|
#define REVISION_NR "7165"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue