Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. std::list<WorldObject*> tankList;
  2. std::list<WorldObject*> healerList;
  3. std::list<WorldObject*> dpsList;
  4.  
  5. for (auto const& target : targets)
  6. {
  7. if (auto player = target->ToPlayer())
  8. {
  9. if (player->isInTankSpec())
  10. tankList.push_back(target);
  11. else if (player->GetSpecializationRole() == ROLES_HEALER)
  12. healerList.push_back(target);
  13. else
  14. dpsList.push_back(target);
  15. }
  16. }
  17.  
  18. targets.clear();
  19.  
  20. Trinity::Containers::RandomResizeList(tankList, 1);
  21. Trinity::Containers::RandomResizeList(healerList, 1);
  22.  
  23. uint8 resizeCount = 5;
  24.  
  25. if (!tankList.empty())
  26. --resizeCount;
  27.  
  28. if (!healerList.empty())
  29. --resizeCount;
  30.  
  31. if (!dpsList.empty())
  32. Trinity::Containers::RandomResizeList(dpsList, resizeCount);
  33.  
  34. targets.splice(targets.end(), tankList);
  35. targets.splice(targets.end(), healerList);
  36. targets.splice(targets.end(), dpsList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement