1. /*
  2. *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
  3. *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
  4. *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
  5. *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
  6. * http://emudevs.com
  7. */
  8. #include "VotePoints.h"
  9. class cmd_vote_points : public CommandScript
  10. {
  11. public:
  12. cmd_vote_points() : CommandScript("cmd_vote_points") { }
  13. std::vector<ChatCommand> GetCommands() const override
  14. {
  15. static std::vector<ChatCommand> pointCommandTable =
  16. {
  17. { "showpoints", rbac::RBAC_PERM_COMMAND_SHOWPOINTS, false, &HandleGetPointsCommand, "" },
  18. };
  19. static std::vector<ChatCommand> commandTable =
  20. {
  21. { "vote", rbac::RBAC_PERM_COMMAND_VOTE, true, NULL, "", pointCommandTable },
  22. };
  23. return commandTable;
  24. }
  25. static bool HandleGetPointsCommand(ChatHandler* handler, char const* args)
  26. {
  27. Player* player = handler->GetSession()->GetPlayer();
  28. VotePointSystem* voteSystem = sVoteSystemMgr->GetPointsByAccountId(player->GetSession()->GetAccountId());
  29. ChatHandler(player->GetSession()).PSendSysMessage("You have %u vote points", voteSystem->Points());
  30. return true;
  31. }
  32. };
  33. void AddSC_vote_points()
  34. {
  35. new cmd_vote_points;
  36. }

Votecommand.cpp