diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index ad63584b1..05b77b4b4 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -155,6 +155,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) // reputation discount float fDiscountMod = _player->GetReputationPriceDiscount(unit); + bool can_learn_primary_prof = GetPlayer()->GetFreePrimaryProffesionPoints() > 0; uint32 count = 0; for(TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr) @@ -164,24 +165,25 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell)) continue; - ++count; - bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); - SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(tSpell->learnedSpell); + TrainerSpellState state = _player->GetTrainerSpellState(tSpell); data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) - data << uint8(_player->GetTrainerSpellState(tSpell)); + data << uint8(state==TRAINER_SPELL_GREEN_DISABLED ? TRAINER_SPELL_GREEN : state); data << uint32(floor(tSpell->spellCost * fDiscountMod)); - data << uint32(primary_prof_first_rank ? 1 : 0); // primary prof. learn confirmation dialog + data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0); + // primary prof. learn confirmation dialog data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state data << uint8(tSpell->reqLevel); data << uint32(tSpell->reqSkill); data << uint32(tSpell->reqSkillValue); - data << uint32(chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); - data << uint32(chain_node && chain_node->prev ? chain_node->req : 0); + data << uint32(!tSpell->IsCastable() && chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); + data << uint32(!tSpell->IsCastable() && chain_node && chain_node->prev ? chain_node->req : 0); data << uint32(0); + + ++count; } data << strTitle; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index aedde8c48..717963ee8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3690,7 +3690,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell // check primary prof. limit if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProffesionPoints() == 0) - return TRAINER_SPELL_RED; + return TRAINER_SPELL_GREEN_DISABLED; return TRAINER_SPELL_GREEN; } diff --git a/src/game/Player.h b/src/game/Player.h index 5ca0d5ca7..24dd953b1 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -121,7 +121,8 @@ enum TrainerSpellState { TRAINER_SPELL_GREEN = 0, TRAINER_SPELL_RED = 1, - TRAINER_SPELL_GRAY = 2 + TRAINER_SPELL_GRAY = 2, + TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed }; enum ActionButtonUpdateState diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f33cb0936..1556095ec 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -748,7 +748,7 @@ void Spell::prepareDataForTriggerSystem() { //========================================================================================== // Now fill data for trigger system, need know: - // Ņan spell trigger another or not ( m_canTrigger ) + // an spell trigger another or not ( m_canTrigger ) // Create base triggers flags for Attacker and Victim ( m_procAttacker and m_procVictim) //========================================================================================== // Fill flag can spell trigger or not @@ -1091,8 +1091,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( !((Creature*)unit)->isPet() && m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) - ((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + { + if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + } if(((Creature*)unit)->AI()) ((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo); @@ -1237,8 +1240,11 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) - ((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + { + if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + } } void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) @@ -2691,30 +2697,33 @@ void Spell::update(uint32 difftime) // channeled spell processed independently for quest targeting // cast at creature (or GO) quest objectives update at successful cast channel finished // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() ) + if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() ) { - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) { - TargetInfo* target = &*ihit; - if(!IS_CREATURE_GUID(target->targetGUID)) - continue; + for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + { + TargetInfo* target = &*ihit; + if(!IS_CREATURE_GUID(target->targetGUID)) + continue; - Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID); - if (unit==NULL) - continue; + Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID); + if (unit==NULL) + continue; - ((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); - } + p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + } - for(std::list::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) - { - GOTargetInfo* target = &*ihit; + for(std::list::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) + { + GOTargetInfo* target = &*ihit; - GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); - if(!go) - continue; + GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); + if(!go) + continue; - ((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + } } } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 99d547ebe..92c4b02e6 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -352,6 +352,10 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.12f); break; } + // Cataclysmic Bolt + case 38441: + damage = unitTarget->GetMaxHealth() / 2; + break; } break; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6724175d8..e26539987 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7348,10 +7348,9 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) Unit *Unit::GetOwner() const { - uint64 ownerid = GetOwnerGUID(); - if(!ownerid) - return NULL; - return ObjectAccessor::GetUnit(*this, ownerid); + if(uint64 ownerid = GetOwnerGUID()) + return ObjectAccessor::GetUnit(*this, ownerid); + return NULL; } Unit *Unit::GetCharmer() const diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6944268d7..0ead86321 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7738" + #define REVISION_NR "7743" #endif // __REVISION_NR_H__