Show
Ignore:
Timestamp:
11/19/08 13:22:12 (17 years ago)
Author:
yumileroy
Message:

[svn] * Added ACE for Linux and Windows (Thanks Derex for Linux part and partial Windows part)
* Updated to 6721 and 676
* Fixed TrinityScript? logo
* Version updated to 0.2.6721.676

Original author: Neo2003
Date: 2008-10-04 06:17:19-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/NPCHandler.cpp

    r2 r6  
    130130        GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 
    131131 
    132     // Lazy loading at first access 
    133     unit->LoadTrainerSpells(); 
    134  
    135132    // trainer list loaded at check; 
    136133    if(!unit->isCanTrainingOf(_player,true)) 
     
    145142    } 
    146143 
    147     Creature::SpellsList const& trainer_spells = unit->GetTrainerSpells(); 
    148  
    149     WorldPacket data( SMSG_TRAINER_LIST, 8+4+4+trainer_spells.size()*38 + strTitle.size()+1); 
     144    TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); 
     145    if(!trainer_spells) 
     146    { 
     147        sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", guid, unit->GetEntry()); 
     148        return; 
     149    } 
     150 
     151    WorldPacket data( SMSG_TRAINER_LIST, 8+4+4+trainer_spells->spellList.size()*38 + strTitle.size()+1); 
    150152    data << guid; 
    151     data << uint32(unit->GetTrainerType()); 
     153    data << uint32(trainer_spells->trainerType); 
    152154 
    153155    size_t count_pos = data.wpos(); 
    154     data << uint32(trainer_spells.size()); 
     156    data << uint32(trainer_spells->spellList.size()); 
    155157 
    156158    // reputation discount 
     
    158160 
    159161    uint32 count = 0; 
    160     for(Creature::SpellsList::const_iterator itr = trainer_spells.begin(); itr != trainer_spells.end(); ++itr) 
    161     { 
    162         if(!_player->IsSpellFitByClassAndRace(itr->spell->Id)) 
     162    for(TrainerSpellList::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr) 
     163    { 
     164        TrainerSpell const* tSpell = *itr; 
     165 
     166        if(!_player->IsSpellFitByClassAndRace(tSpell->spell)) 
    163167            continue; 
    164168 
    165169        ++count; 
    166170 
    167         bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(itr->spell->Id); 
    168  
    169         SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(itr->spell->Id); 
    170  
    171         data << uint32(itr->spell->Id); 
    172         data << uint8(_player->GetTrainerSpellState(&*itr)); 
    173         data << uint32(floor(itr->spellcost * fDiscountMod)); 
     171        bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->spell); 
     172 
     173        SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(tSpell->spell); 
     174 
     175        data << uint32(tSpell->spell); 
     176        data << uint8(_player->GetTrainerSpellState(tSpell)); 
     177        data << uint32(floor(tSpell->spellcost * fDiscountMod)); 
    174178 
    175179        data << uint32(primary_prof_first_rank ? 1 : 0);    // primary prof. learn confirmation dialog 
    176180        data << uint32(primary_prof_first_rank ? 1 : 0);    // must be equal prev. field to have learn button in enabled state 
    177         data << uint8(itr->reqlevel ? itr->reqlevel : itr->spell->spellLevel); 
    178         data << uint32(itr->reqskill); 
    179         data << uint32(itr->reqskillvalue); 
     181        data << uint8(tSpell->reqlevel); 
     182        data << uint32(tSpell->reqskill); 
     183        data << uint32(tSpell->reqskillvalue); 
    180184        data << uint32(chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); 
    181185        data << uint32(chain_node && chain_node->prev ? chain_node->req : 0); 
     
    210214        GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 
    211215 
    212     // Lazy loading at first access 
    213     unit->LoadTrainerSpells(); 
    214  
    215216    if(!unit->isCanTrainingOf(_player,true)) 
    216217        return; 
    217218 
    218     TrainerSpell const* trainer_spell = NULL; 
    219  
    220219    // check present spell in trainer spell list 
    221     Creature::SpellsList const& trainer_spells = unit->GetTrainerSpells(); 
    222     for(Creature::SpellsList::const_iterator itr = trainer_spells.begin(); itr != trainer_spells.end(); ++itr) 
    223     { 
    224         if(itr->spell->Id == spellId) 
    225         { 
    226             trainer_spell = &*itr; 
    227             break; 
    228         } 
    229     } 
     220    TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); 
     221    if(!trainer_spells) 
     222        return;  
    230223 
    231224    // not found, cheat? 
     225    TrainerSpell const* trainer_spell = trainer_spells->Find(spellId); 
    232226    if(!trainer_spell) 
    233227        return; 
     
    255249 
    256250    // learn explicitly to prevent lost money at lags, learning spell will be only show spell animation 
    257     _player->learnSpell(trainer_spell->spell->Id); 
     251    _player->learnSpell(trainer_spell->spell); 
    258252 
    259253    data.Initialize(SMSG_TRAINER_BUY_SUCCEEDED, 12);