- /*
- *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
- *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
- *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
- *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
- * http://emudevs.com
- */
- class VotePointSystem
- {
- public:
- VotePointSystem();
- ~VotePointSystem();
- bool GetPlayerAccount(uint32 acctId) const { return acctId == accountId; }
- bool LoadFromDB(Field* fields);
- void SaveToDB(SQLTransaction& trans) const;
- uint32 Points() const { return votePoints; }
- uint32 GetAccountId() const { return accountId; }
- private:
- uint32 accountId;
- uint32 votePoints;
- };
- class VotePointSystemMgr
- {
- private:
- VotePointSystemMgr();
- ~VotePointSystemMgr();
- public:
- static VotePointSystemMgr* GetInstance()
- {
- static VotePointSystemMgr instance;
- return &instance;
- }
- void LoadVoteSystem();
- typedef std::map<uint32, VotePointSystem*> VotePointList;
- VotePointSystem* GetPointsByAccountId(uint32 id)
- {
- for (VotePointList::const_iterator itr = _voteList.begin(); itr != _voteList.end(); ++itr)
- if (itr->second && itr->second->GetPlayerAccount(id))
- return itr->second;
- return NULL;
- }
- void SaveToList(VotePointSystem* voteSystem);
- protected:
- VotePointList _voteList;
- };
- #define sVoteSystemMgr VotePointSystemMgr::GetInstance()
VotePoints.h Header file!