aboutsummaryrefslogtreecommitdiff
path: root/src/game/NPCHandler.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-01 01:33:08 -0500
committermegamage <none@none>2009-05-01 01:33:08 -0500
commit85fbe3ada2bf9fd08acb97e40e2dddefc6e38e0a (patch)
treec5177de62d1c860c86d619a8318b77f2d89f5565 /src/game/NPCHandler.cpp
parent8a57a94eca3367dd11afdce7b11d3aba415ae0bf (diff)
[7740] More correct flags in trainer list data for profession ranks. Author: VladimirMangos
Note: this is not fix problem with gren show recently learned non-first rank of primary profession. Thanks to Seizerkiller for help in reseach. --HG-- branch : trunk
Diffstat (limited to 'src/game/NPCHandler.cpp')
-rw-r--r--src/game/NPCHandler.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp
index 7d2985c0643..30d316afd83 100644
--- a/src/game/NPCHandler.cpp
+++ b/src/game/NPCHandler.cpp
@@ -157,6 +157,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)
@@ -166,25 +167,27 @@ 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);
uint32 req_spell = spellmgr.GetSpellRequired(tSpell->spell);
+ 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 : req_spell);
- data << uint32(chain_node && chain_node->prev ? req_spell : 0);
+ //prev + req or req + 0
+ data << uint32(!tSpell->IsCastable() && chain_node && chain_node->prev ? chain_node->prev : req_spell);
+ data << uint32(!tSpell->IsCastable() && chain_node && chain_node->prev ? req_spell : 0);
data << uint32(0);
+
+ ++count;
}
data << strTitle;