1 /* 2 * The ManaPlus Client 3 * Copyright (C) 2011-2019 The ManaPlus Developers 4 * Copyright (C) 2019-2021 Andrei Karas 5 * 6 * This file is part of The ManaPlus Client. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #ifndef BEING_BEINGCACHEENTRY_H 23 #define BEING_BEINGCACHEENTRY_H 24 25 #include "enums/simpletypes/beingid.h" 26 27 #include "localconsts.h" 28 29 #include <string> 30 31 class BeingCacheEntry final 32 { 33 public: BeingCacheEntry(const BeingId id)34 explicit BeingCacheEntry(const BeingId id) : 35 mName(), 36 mPartyName(), 37 mGuildName(), 38 mIp(), 39 mId(id), 40 mLevel(0), 41 mPvpRank(0), 42 mTime(0), 43 mFlags(0), 44 mTeamId(0U), 45 mIsAdvanced(false) 46 { 47 } 48 A_DELETE_COPY(BeingCacheEntry)49 A_DELETE_COPY(BeingCacheEntry) 50 51 BeingId getId() const 52 { return mId; } 53 54 /** 55 * Returns the name of the being. 56 */ getName()57 const std::string &getName() const 58 { return mName; } 59 60 /** 61 * Sets the name for the being. 62 * 63 * @param name The name that should appear. 64 */ setName(const std::string & name)65 void setName(const std::string &name) 66 { mName = name; } 67 68 /** 69 * Following are set from the server (mainly for players) 70 */ setPartyName(const std::string & name)71 void setPartyName(const std::string &name) 72 { mPartyName = name; } 73 setGuildName(const std::string & name)74 void setGuildName(const std::string &name) 75 { mGuildName = name; } 76 getPartyName()77 const std::string &getPartyName() const 78 { return mPartyName; } 79 getGuildName()80 const std::string &getGuildName() const 81 { return mGuildName; } 82 setLevel(const int n)83 void setLevel(const int n) 84 { mLevel = n; } 85 getLevel()86 int getLevel() const 87 { return mLevel; } 88 setTime(const time_t n)89 void setTime(const time_t n) 90 { mTime = n; } 91 getTime()92 time_t getTime() const 93 { return mTime; } 94 getPvpRank()95 unsigned getPvpRank() const 96 { return mPvpRank; } 97 setPvpRank(const int r)98 void setPvpRank(const int r) 99 { mPvpRank = r; } 100 getIp()101 std::string getIp() const 102 { return mIp; } 103 setIp(const std::string & ip)104 void setIp(const std::string &ip) 105 { mIp = ip; } 106 isAdvanced()107 bool isAdvanced() const 108 { return mIsAdvanced; } 109 setAdvanced(const bool a)110 void setAdvanced(const bool a) 111 { mIsAdvanced = a; } 112 getFlags()113 int getFlags() const 114 { return mFlags; } 115 setFlags(const int flags)116 void setFlags(const int flags) 117 { mFlags = flags; } 118 getTeamId()119 uint16_t getTeamId() const 120 { return mTeamId; } 121 setTeamId(const uint16_t teamId)122 void setTeamId(const uint16_t teamId) 123 { mTeamId = teamId; } 124 125 protected: 126 std::string mName; /**< Name of character */ 127 std::string mPartyName; 128 std::string mGuildName; 129 std::string mIp; 130 BeingId mId; /**< Unique sprite id */ 131 int mLevel; 132 unsigned int mPvpRank; 133 time_t mTime; 134 int mFlags; 135 uint16_t mTeamId; 136 bool mIsAdvanced; 137 }; 138 139 #endif // BEING_BEINGCACHEENTRY_H 140