stoneharry

Untitled

Jun 2nd, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. void WorldSession::SendTrainerList(Creature* pCreature)
  2. {
  3.     Trainer* pTrainer = pCreature->GetTrainer();
  4.     //if(pTrainer == 0 || !CanTrainAt(_player, pTrainer)) return;
  5.     if(pTrainer == NULL)
  6.         return;
  7.  
  8.     if(! _player->CanTrainAt(pTrainer))
  9.         Arcemu::Gossip::Menu::SendSimpleMenu(pCreature->GetGUID(), pTrainer->Cannot_Train_GossipTextId, GetPlayer());
  10.     else
  11.     {
  12.         WorldPacket data(SMSG_TRAINER_LIST, 5000);
  13.         TrainerSpell* pSpell;
  14.         uint32 Spacer = 0;
  15.         uint32 Count = 0;
  16.         uint8 Status;
  17.         string Text;
  18.  
  19.         data << pCreature->GetGUID();
  20.         data << pTrainer->TrainerType;
  21.  
  22.         data << uint32(0);
  23.         for(vector<TrainerSpell>::iterator itr = pTrainer->Spells.begin(); itr != pTrainer->Spells.end(); ++itr)
  24.         {
  25.             pSpell = &(*itr);
  26.             Status = TrainerGetSpellStatus(pSpell);
  27.             if(pSpell->pCastRealSpell != NULL)
  28.                 data << pSpell->pCastSpell->Id;
  29.             else if(pSpell->pLearnSpell)
  30.                 data << pSpell->pLearnSpell->Id;
  31.             else
  32.                 continue;
  33.  
  34.             data << Status;
  35.             data << pSpell->Cost;
  36.             data << Spacer;
  37.             data << uint32(pSpell->IsProfession);
  38.             data << uint8(pSpell->RequiredLevel);
  39.             data << pSpell->RequiredSkillLine;
  40.             data << pSpell->RequiredSkillLineValue;
  41.             data << pSpell->RequiredSpell;
  42.             data << Spacer; //this is like a spell override or something, ex : (id=34568 or id=34547) or (id=36270 or id=34546) or (id=36271 or id=34548)
  43.             data << Spacer;
  44.             ++Count;
  45.         }
  46.  
  47.         *(uint32*)&data.contents()[12] = Count;
  48.  
  49.         if(stricmp(pTrainer->UIMessage, "DMSG") == 0)
  50.             data << _player->GetSession()->LocalizedWorldSrv(37);
  51.         else
  52.             data << pTrainer->UIMessage;
  53.         SendPacket(&data);
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment