Advertisement
Etox

Trainer Spawn

Sep 7th, 2013
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.52 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "ScriptedGossip.h"
  3.  
  4. class npc_trainerspawn : public CreatureScript
  5. {
  6. public:
  7.     npc_trainerspawn() : CreatureScript("npc_trainerspawn") { }
  8.  
  9.     bool OnGossipHello(Player *player, Creature *_Creature)
  10.     {
  11.         player->PlayerTalkClass->ClearMenus();
  12.  
  13.         if (player->isInCombat())
  14.         {
  15.             player->PlayerTalkClass->SendCloseGossip();
  16.             _Creature->MonsterSay("You are in combat!", LANG_UNIVERSAL, NULL);
  17.             return true;
  18.         }
  19.         if (player->GetMap()->IsBattlegroundOrArena())
  20.         {
  21.             player->PlayerTalkClass->SendCloseGossip();
  22.             _Creature->MonsterSay("You can't summon trainers while in battleground or Arena!", LANG_UNIVERSAL, NULL);
  23.             return true;
  24.         }
  25.  
  26.         _Creature->MonsterWhisper("Welcome dear player, please choose the trainer desired for your class.", player->GetGUID());
  27.  
  28.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Spawn your Class Trainer."    , GOSSIP_SENDER_MAIN, 1);
  29.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Spawn Max Payne."             , GOSSIP_SENDER_MAIN, 7);
  30.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Maybe later."                 , GOSSIP_SENDER_MAIN, 2);
  31.         player->PlayerTalkClass->SendGossipMenu(85004, _Creature->GetGUID());
  32.         return true;
  33.     }
  34.  
  35.     bool OnGossipSelect(Player *player, Creature *_Creature, uint32 sender, uint32 action)
  36.     {
  37.  
  38.         switch(action)
  39.         {
  40.         case 1:
  41.             switch(player->getClass())
  42.             {
  43.             case CLASS_DEATH_KNIGHT:
  44.                 player->PlayerTalkClass->SendCloseGossip();
  45.                 player->SummonCreature(28474,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  46.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  47.                 _Creature->DisappearAndDie();
  48.                 break;
  49.  
  50.             case CLASS_DRUID:
  51.                 player->PlayerTalkClass->SendCloseGossip();
  52.                 player->SummonCreature(12042,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  53.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  54.                 _Creature->DisappearAndDie();
  55.                 break;
  56.  
  57.             case CLASS_HUNTER:
  58.                 player->PlayerTalkClass->SendCloseGossip();
  59.                 player->SummonCreature(3406,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  60.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  61.                 _Creature->DisappearAndDie();
  62.                 break;
  63.  
  64.             case CLASS_MAGE:
  65.                 player->PlayerTalkClass->SendCloseGossip();
  66.                 player->SummonCreature(5882,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  67.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  68.                 _Creature->DisappearAndDie();
  69.                 break;
  70.  
  71.             case CLASS_PALADIN:
  72.                 player->PlayerTalkClass->SendCloseGossip();
  73.                 player->SummonCreature(20406,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  74.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  75.                 _Creature->DisappearAndDie();
  76.                 break;
  77.  
  78.             case CLASS_PRIEST:
  79.                 player->PlayerTalkClass->SendCloseGossip();
  80.                 player->SummonCreature(6018,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  81.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  82.                 _Creature->DisappearAndDie();
  83.                 break;
  84.  
  85.             case CLASS_ROGUE:
  86.                 player->PlayerTalkClass->SendCloseGossip();
  87.                 player->SummonCreature(3327,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  88.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  89.                 _Creature->DisappearAndDie();
  90.                 break;
  91.  
  92.             case CLASS_SHAMAN:
  93.                 player->PlayerTalkClass->SendCloseGossip();
  94.                 player->SummonCreature(3344,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  95.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  96.                 _Creature->DisappearAndDie();
  97.                 break;
  98.  
  99.             case CLASS_WARLOCK:
  100.                 player->PlayerTalkClass->SendCloseGossip();
  101.                 player->SummonCreature(3325,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  102.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  103.                 _Creature->DisappearAndDie();
  104.                 break;
  105.  
  106.             case CLASS_WARRIOR:
  107.                 player->PlayerTalkClass->SendCloseGossip();
  108.                 player->SummonCreature(4593,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  109.                 _Creature->MonsterWhisper("You got your trainer, i must say farewell..", player->GetGUID());
  110.                 _Creature->DisappearAndDie();
  111.                 break;
  112.  
  113.             default: break;
  114.             }
  115.             break;
  116.         case 7:
  117.                 player->PlayerTalkClass->SendCloseGossip();
  118.                 player->SummonCreature(77777,player->GetPositionX() ,player->GetPositionY()+1, player->GetPositionZ(), 0,TEMPSUMMON_TIMED_DESPAWN,45000);
  119.                 _Creature->MonsterWhisper("Max Payne is here, i must say farewell..", player->GetGUID());
  120.                 _Creature->DisappearAndDie();
  121.                 break;
  122.         case 2:
  123.             _Creature->MonsterWhisper("Please come again.", player->GetGUID());
  124.             player->PlayerTalkClass->SendCloseGossip();
  125.             _Creature->DisappearAndDie();
  126.             break;
  127.  
  128.         }
  129.  
  130.         return true;
  131.     }
  132.  
  133. };
  134.  
  135. void AddSC_npc_trainerspawn()
  136. {
  137.     new npc_trainerspawn();
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement