Advertisement
Guest User

Monarch.h

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. // vim: ts=4 sw=4
  2. #ifndef METIN2_MONARCH_H
  3. #define METIN2_MONARCH_H
  4.  
  5. #include "../../libthecore/include/stdafx.h"
  6. #include <map>
  7. #include <vector>
  8. #include "../../common/singleton.h"
  9. #include "../../common/service.h"
  10. #include "../../common/length.h"
  11. #include "../../common/tables.h"
  12.  
  13. class CMonarch : public singleton<CMonarch>
  14. {
  15. public:
  16. typedef std::map<DWORD, MonarchElectionInfo*> MAP_MONARCHELECTION;
  17. typedef std::vector<MonarchCandidacy> VEC_MONARCHCANDIDACY;
  18.  
  19. CMonarch();
  20. virtual ~CMonarch();
  21.  
  22. bool VoteMonarch(DWORD pid, DWORD selectedpid);
  23. void ElectMonarch();
  24.  
  25. bool IsCandidacy(DWORD pid);
  26. bool AddCandidacy(DWORD pid, const char * name);
  27. bool DelCandidacy(const char * name);
  28.  
  29. bool LoadMonarch();
  30. bool SetMonarch(const char * name);
  31. bool DelMonarch(int Empire);
  32. bool DelMonarch(const char * name);
  33.  
  34. bool IsMonarch(int Empire, DWORD pid);
  35. bool AddMoney(int Empire, int64_t Money);
  36. bool DecMoney(int Empire, int64_t Money);
  37. bool TakeMoney(int Empire, DWORD pid, int64_t Money);
  38.  
  39. TMonarchInfo* GetMonarch()
  40. {
  41. return &m_MonarchInfo;
  42. }
  43.  
  44. VEC_MONARCHCANDIDACY& GetVecMonarchCandidacy()
  45. {
  46. return m_vec_MonarchCandidacy;
  47. }
  48.  
  49. size_t MonarchCandidacySize()
  50. {
  51. return m_vec_MonarchCandidacy.size();
  52. }
  53.  
  54. private:
  55. int GetCandidacyIndex(DWORD pid);
  56.  
  57. MAP_MONARCHELECTION m_map_MonarchElection;
  58. VEC_MONARCHCANDIDACY m_vec_MonarchCandidacy;
  59. TMonarchInfo m_MonarchInfo;
  60.  
  61. MonarchElectionInfo* GetMonarchElection(DWORD pid)
  62. {
  63. MAP_MONARCHELECTION::iterator it = m_map_MonarchElection.find(pid);
  64.  
  65. if (it != m_map_MonarchElection.end())
  66. return it->second;
  67.  
  68. return NULL;
  69. }
  70. };
  71.  
  72. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement