Advertisement
EmuDevs

EmuDevs: TrinityCore - OutdoorPvP Template (Source File)

Aug 16th, 2013
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. /*
  2.     EmuDevs OutdoorPvP Tutorial
  3.     http://emudevs.com
  4.     TrinityCore Tutorial
  5. */
  6. #include "OutdoorPvPHPP.h"
  7.  
  8. OutdoorPvPHellFire::OutdoorPvPHellFire()
  9. {
  10.     m_TypeId = OUTDOOR_PVP_HPP;
  11.     hordeResources = 300;
  12.     allyResources = 300;
  13. }
  14.  
  15. bool OutdoorPvPHellFire::SetupOutdoorPvP()
  16. {
  17.     for (uint8 i = 0; i < sizeof(OutdoorPvPZone) / sizeof(uint32); ++i)
  18.         RegisterZone(OutdoorPvPZone[i]);
  19.     return true;
  20. }
  21.  
  22. void OutdoorPvPHellFire::HandlePlayerEnterZone(Player* player, uint32 zone)
  23. {
  24.     ChatHandler(player->GetSession()).SendSysMessage("You have entered a war zone!");
  25.     OutdoorPvP::HandlePlayerEnterZone(player, zone);
  26. }
  27.  
  28. void OutdoorPvPHellFire::HandlePlayerLeaveZone(Player* player, uint32 zone)
  29. {
  30.     OutdoorPvP::HandlePlayerLeaveZone(player, zone);
  31. }
  32.  
  33. void OutdoorPvPHellFire::HandleKill(Player* player, Unit* killed)
  34. {
  35.     if (killed->GetTypeId() != TYPEID_PLAYER)
  36.     {
  37.         switch (killed->GetEntry())
  38.         {
  39.             case 10000: // Horde guard
  40.                 hordeResources -= 5;
  41.                 break;
  42.         }
  43.     }
  44.     OutdoorPvP::HandleKill(player, killed);
  45. }
  46.  
  47. bool OutdoorPvPHellFire::Update(uint32 diff)
  48. {
  49.     allyResources -= 3;
  50.     hordeResources -= 3;
  51.     if (allyResources <= 0)
  52.     {
  53.     // Horde wins
  54.     }
  55.  
  56.     if (hordeResources <= 0)
  57.     {
  58.     // Ally wins
  59.     }
  60.     OutdoorPvP::Update(diff);
  61.     return false;
  62. }
  63.  
  64. class pvp_resource_hellfire : public OutdoorPvPScript
  65. {
  66. public:
  67.     pvp_resource_hellfire() : OutdoorPvPScript("pvp_resource_hellfire") { }
  68.  
  69.     OutdoorPvP* GetOutdoorPvP() const
  70.     {
  71.         return new OutdoorPvPHellFire();
  72.     }
  73. };
  74.  
  75. void AddSC_pvp_hp()
  76. {
  77.     new pvp_resource_hellfire;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement