Advertisement
WIXXZI

Untitled

Feb 6th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #include "MapManager.h"
  2.  
  3. class PhasedDueling : public PlayerScript
  4. {
  5. public:
  6. PhasedDueling() : PlayerScript("PhasedDueling") { }
  7.  
  8. void OnDuelStart(Player* firstplayer, Player* secondplayer)
  9. {
  10. uint32 PlayersInsidePhase = 0;
  11. uint32 PhaseToCheck = 1;
  12. Map* map = sMapMgr->FindMap(firstplayer->GetMapId(), firstplayer->GetInstanceId());
  13.  
  14. if (!map)
  15. return;
  16. Map::PlayerList const& players = map->GetPlayers();
  17. for (Map::PlayerList::const_iterator iter = players.begin(); iter != players.end(); ++iter)
  18. {
  19. Player* check = iter->GetSource();
  20. if (!check || !check->GetSession())
  21. continue;
  22.  
  23. if (check->GetPhaseMask() == PhaseToCheck)
  24. {
  25. ++PlayersInsidePhase;
  26. ++PhaseToCheck;
  27. PlayersInsidePhase = 0;
  28. }
  29. }
  30.  
  31. if (PlayersInsidePhase == 0)
  32. {
  33. firstplayer->SetPhaseMask(PhaseToCheck, true);
  34. secondplayer->SetPhaseMask(PhaseToCheck, true);
  35. }
  36. }
  37.  
  38. void OnDuelEnd(Player* winner, Player* loser, DuelCompleteType type)
  39. {
  40. }
  41. uint32 PlayersInsidePhase = 0;
  42. uint32 PhaseToCheck = 1;
  43. Map* map = sMapMgr->FindMap(firstplayer->GetMapId(), firstplayer->GetInstanceId());
  44.  
  45. if (!map)
  46. return;
  47. Map::PlayerList const& players = map->GetPlayers();
  48. for (Map::PlayerList::const_iterator iter = players.begin(); iter != players.end(); ++iter)
  49. {
  50. Player* check = iter->GetSource();
  51. if (!check || !check->GetSession())
  52. continue;
  53.  
  54. if (check->GetPhaseMask() == PhaseToCheck)
  55. {
  56. ++PlayersInsidePhase;
  57. ++PhaseToCheck;
  58. PlayersInsidePhase = 0;
  59. }
  60. }
  61.  
  62. if (PlayersInsidePhase == 0)
  63. {
  64. firstplayer->SetPhaseMask(PhaseToCheck, false);
  65. secondplayer->SetPhaseMask(PhaseToCheck, false);
  66. }
  67. }
  68. };
  69.  
  70. void AddSC_PhasedDueling()
  71. {
  72. new PhasedDueling();
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement