Share Pastebin
Guest
Public paste!

Supabad

By: a guest | Mar 20th, 2010 | Syntax: None | Size: 2.66 KB | Hits: 51 | Expires: Never
Copy text to clipboard
  1. #include "ScriptedPch.h"
  2.  
  3. enum eBloodmaul
  4. {
  5.     NPC_OGRE_BRUTE        = 19995,
  6.     NPC_QUEST_CREDIT      = 21241,
  7.     GO_KEG                = 184315
  8. };
  9.  
  10. struct npc_bloodmaul_brutebaneAI : public ScriptedAI
  11. {
  12.     npc_bloodmaul_brutebaneAI(Creature *c) : ScriptedAI(c)
  13.     {      
  14.        if(Creature* Ogre = m_creature->FindNearestCreature(NPC_OGRE_BRUTE, 50, true))
  15.        {          
  16.            Ogre->SetReactState(REACT_DEFENSIVE);
  17.            Ogre->GetMotionMaster()->MovePoint(1, m_creature->GetPositionX()-1, m_creature->GetPositionY()+1, m_creature->GetPositionZ());                      
  18.        }
  19.     }
  20.  
  21.     uint64 OgreGUID;
  22.    
  23.     void Reset()
  24.     {
  25.         OgreGUID = 0;        
  26.     }    
  27.  
  28.     void UpdateAI(const uint32 uiDiff) {}
  29. };
  30.  
  31.  
  32. CreatureAI* GetAI_npc_bloodmaul_brutebane(Creature* pCreature)
  33. {
  34.     return new npc_bloodmaul_brutebaneAI (pCreature);
  35. }
  36.  
  37. //Ogre Brute
  38.  
  39. struct npc_ogre_bruteAI : public ScriptedAI
  40. {
  41.     npc_ogre_bruteAI(Creature *c) : ScriptedAI(c) {}
  42.    
  43.     uint64 PlayerGUID;        
  44.  
  45.     void Reset()
  46.     {
  47.         PlayerGUID = 0;
  48.     }
  49.  
  50.     void MoveInLineOfSight(Unit *who)
  51.     {
  52.         if (!who || (!who->isAlive())) return;
  53.  
  54.         if (m_creature->IsWithinDistInMap(who, 50.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(10512) == QUEST_STATUS_INCOMPLETE)
  55.         {
  56.             PlayerGUID = who->GetGUID();            
  57.         }
  58.     }
  59.    
  60.     void MovementInform(uint32 type, uint32 id)
  61.     {
  62.         Player* pPlayer = Unit::GetPlayer(PlayerGUID);
  63.         if(id == 1)
  64.         {            
  65.             GameObject* Keg = m_creature->FindNearestGameObject(GO_KEG, 20);
  66.             if(Keg)        
  67.                 Keg->Delete();            
  68.             m_creature->HandleEmoteCommand(7);
  69.             Creature* Credit = m_creature->FindNearestCreature(NPC_QUEST_CREDIT, 50, true);            
  70.             if(pPlayer)
  71.                 pPlayer->KilledMonster(Credit->GetCreatureInfo(),Credit->GetGUID());
  72.         }
  73.     }
  74.    
  75.     void UpdateAI(const uint32 diff)
  76.     {        
  77.         if (!UpdateVictim())
  78.             return;
  79.         DoMeleeAttackIfReady();        
  80.     }
  81. };
  82.  
  83. CreatureAI* GetAI_npc_ogre_brute(Creature* pCreature)
  84. {
  85.     return new npc_ogre_bruteAI(pCreature);
  86. }
  87.  
  88. void AddSC_npc_bloodmaul_brutebane()
  89. {
  90.     Script* newscript;
  91.  
  92.     newscript = new Script;
  93.     newscript->Name = "npc_bloodmaul_brutebane";
  94.     newscript->GetAI = &GetAI_npc_bloodmaul_brutebane;
  95.     newscript->RegisterSelf();    
  96.  
  97.     newscript = new Script;
  98.     newscript->Name = "npc_ogre_brute";
  99.     newscript->GetAI = &GetAI_npc_ogre_brute;
  100.     newscript->RegisterSelf();
  101. }