summaryrefslogtreecommitdiff
path: root/src/server/game/Cache/WhoListCacheMgr.h
blob: cfa7f08ab29ee939f26e6a3575dcd35265ef52be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _WHO_LISTCACHE_H_
#define _WHO_LISTCACHE_H_

#include "Common.h"
#include "ObjectGuid.h"
#include "SharedDefines.h"

class WhoListPlayerInfo
{
public:
    WhoListPlayerInfo(ObjectGuid guid, TeamId team, AccountTypes security, uint8 level, uint8 clss, uint8 race, uint32 zoneid, uint8 gender, bool visible, std::wstring const& widePlayerName,
        std::wstring const& wideGuildName, std::string const& playerName, std::string const& guildName) :
        _guid(guid),
        _team(team),
        _security(security),
        _level(level),
        _class(clss),
        _race(race),
        _zoneid(zoneid),
        _gender(gender),
        _visible(visible),
        _widePlayerName(widePlayerName),
        _wideGuildName(wideGuildName),
        _playerName(playerName),
        _guildName(guildName) { }

    ObjectGuid GetGuid() const { return _guid; }
    TeamId GetTeamId() const { return _team; }
    AccountTypes GetSecurity() const { return _security; }
    uint8 GetLevel() const { return _level; }
    uint8 GetClass() const { return _class; }
    uint8 GetRace() const { return _race; }
    uint32 GetZoneId() const { return _zoneid; }
    uint8 GetGender() const { return _gender; }
    bool IsVisible() const { return _visible; }
    std::wstring const& GetWidePlayerName() const { return _widePlayerName; }
    std::wstring const& GetWideGuildName() const { return _wideGuildName; }
    std::string const& GetPlayerName() const { return _playerName; }
    std::string const& GetGuildName() const { return _guildName; }

private:
    ObjectGuid _guid;
    TeamId _team;
    AccountTypes _security;
    uint8 _level;
    uint8 _class;
    uint8 _race;
    uint32 _zoneid;
    uint8 _gender;
    bool _visible;
    std::wstring _widePlayerName;
    std::wstring _wideGuildName;
    std::string _playerName;
    std::string _guildName;
};

using WhoListInfoVector = std::vector<WhoListPlayerInfo>;

class AC_GAME_API WhoListCacheMgr
{
    WhoListCacheMgr() = default;
    ~WhoListCacheMgr() = default;

    WhoListCacheMgr(WhoListCacheMgr const&) = delete;
    WhoListCacheMgr(WhoListCacheMgr&&) = delete;

    WhoListCacheMgr& operator= (WhoListCacheMgr const&) = delete;
    WhoListCacheMgr& operator= (WhoListCacheMgr&&) = delete;
public:
    static WhoListCacheMgr* instance();

    void Update();
    WhoListInfoVector const& GetWhoList() const { return _whoListStorage; }

protected:
    WhoListInfoVector _whoListStorage;
};

#define sWhoListCacheMgr WhoListCacheMgr::instance()

#endif