Merge commit 'origin/master' into 310

This commit is contained in:
tomrus88 2009-05-02 19:56:19 +04:00
commit 335b32dbc3
7 changed files with 51 additions and 36 deletions

View file

@ -155,6 +155,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
// reputation discount // reputation discount
float fDiscountMod = _player->GetReputationPriceDiscount(unit); float fDiscountMod = _player->GetReputationPriceDiscount(unit);
bool can_learn_primary_prof = GetPlayer()->GetFreePrimaryProffesionPoints() > 0;
uint32 count = 0; uint32 count = 0;
for(TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr) 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)) if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell))
continue; continue;
++count;
bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell);
SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(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 << 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(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 << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state
data << uint8(tSpell->reqLevel); data << uint8(tSpell->reqLevel);
data << uint32(tSpell->reqSkill); data << uint32(tSpell->reqSkill);
data << uint32(tSpell->reqSkillValue); data << uint32(tSpell->reqSkillValue);
data << uint32(chain_node ? (chain_node->prev ? 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(chain_node && chain_node->prev ? chain_node->req : 0); data << uint32(!tSpell->IsCastable() && chain_node && chain_node->prev ? chain_node->req : 0);
data << uint32(0); data << uint32(0);
++count;
} }
data << strTitle; data << strTitle;

View file

@ -3690,7 +3690,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
// check primary prof. limit // check primary prof. limit
if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProffesionPoints() == 0) if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProffesionPoints() == 0)
return TRAINER_SPELL_RED; return TRAINER_SPELL_GREEN_DISABLED;
return TRAINER_SPELL_GREEN; return TRAINER_SPELL_GREEN;
} }

View file

@ -121,7 +121,8 @@ enum TrainerSpellState
{ {
TRAINER_SPELL_GREEN = 0, TRAINER_SPELL_GREEN = 0,
TRAINER_SPELL_RED = 1, 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 enum ActionButtonUpdateState

View file

@ -748,7 +748,7 @@ void Spell::prepareDataForTriggerSystem()
{ {
//========================================================================================== //==========================================================================================
// Now fill data for trigger system, need know: // 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) // Create base triggers flags for Attacker and Victim ( m_procAttacker and m_procVictim)
//========================================================================================== //==========================================================================================
// Fill flag can spell trigger or not // 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) // 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... ) // 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() ) if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); {
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
}
if(((Creature*)unit)->AI()) if(((Creature*)unit)->AI())
((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo); ((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) // 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... ) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); {
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
}
} }
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
@ -2691,30 +2697,33 @@ void Spell::update(uint32 difftime)
// channeled spell processed independently for quest targeting // channeled spell processed independently for quest targeting
// cast at creature (or GO) quest objectives update at successful cast channel finished // 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... ) // 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<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
{ {
TargetInfo* target = &*ihit; for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
if(!IS_CREATURE_GUID(target->targetGUID)) {
continue; 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); Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
if (unit==NULL) if (unit==NULL)
continue; continue;
((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
} }
for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
{ {
GOTargetInfo* target = &*ihit; GOTargetInfo* target = &*ihit;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
if(!go) if(!go)
continue; continue;
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
}
} }
} }

View file

@ -352,6 +352,10 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.12f); damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.12f);
break; break;
} }
// Cataclysmic Bolt
case 38441:
damage = unitTarget->GetMaxHealth() / 2;
break;
} }
break; break;
} }

View file

@ -7348,10 +7348,9 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
Unit *Unit::GetOwner() const Unit *Unit::GetOwner() const
{ {
uint64 ownerid = GetOwnerGUID(); if(uint64 ownerid = GetOwnerGUID())
if(!ownerid) return ObjectAccessor::GetUnit(*this, ownerid);
return NULL; return NULL;
return ObjectAccessor::GetUnit(*this, ownerid);
} }
Unit *Unit::GetCharmer() const Unit *Unit::GetCharmer() const

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7738" #define REVISION_NR "7743"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__