54 static const char *
const NAME =
"name";
55 static const char *
const RELATION =
"relation";
69 bool operator() (const
std::
string &str1,
70 const
std::
string &str2)
const
72 std::string s1 = str1;
73 std::string s2 = str2;
85 PlayerRelation *>, std::map<std::string, PlayerRelation *> *>
97 if (cobj ==
nullptr ||
98 value.second ==
nullptr)
102 cobj->setValue(
NAME, value.first);
104 CAST_S32(value.second->mRelation)));
109 std::map<std::string, PlayerRelation *> *
111 std::map<std::string, PlayerRelation *>
112 *
const container)
const override final
114 if (cobj ==
nullptr ||
115 container ==
nullptr)
119 const std::string name = cobj->getValue(
NAME,
"");
123 if ((*container)[name] ==
nullptr)
125 const int v = cobj->getValueInt(
RELATION,
144 EMOTE | SPEECH_FLOAT,
152 mPersistIgnores(false),
183 const std::string &name)
185 const STD_VECTOR<PlayerIgnoreStrategy *> *
const strategies
188 if (strategies ==
nullptr)
191 const size_t sz = strategies->size();
192 for (
size_t i = 0; i < sz; i++)
194 if ((*strategies)[i]->mShortName == name)
210 const std::string ignore_strategy_name = cfg->
getValue(
213 ignore_strategy_name);
215 if (ignore_strategy_index >= 0)
218 [ignore_strategy_index]);
221 cfg->
getList<std::pair<std::string, PlayerRelation *>,
222 std::map<std::string, PlayerRelation *> *>
245 std::pair<std::string, PlayerRelation *>,
246 std::map<std::string, PlayerRelation *> *>
262 (*it)->updatedPlayer(name);
269 if (being !=
nullptr &&
278 const std::string &player_name,
const unsigned int flags)
const
280 const std::map<std::string, PlayerRelation *>::const_iterator
311 return permissions & flags;
315 const unsigned int flags)
const
317 if (being ==
nullptr)
323 being->
getName(), flags)) == flags;
329 const unsigned int flags)
const
334 const unsigned int rejections = flags
336 const bool permitted = (rejections == 0);
380 if (it->second !=
nullptr)
381 retval->push_back(it->first);
396 if ((it->second !=
nullptr) &&
397 it->second->mRelation == rel)
399 retval->push_back(it->first);
417 const std::string &name)
const
419 const std::map<std::string, PlayerRelation *>::const_iterator
422 return (*it).second->mRelation;
517 if (being ==
nullptr)
520 logger->
log(
"ignoring: " + being->getName());
521 being->setSpeech(
"...");
542 if (being ==
nullptr)
545 logger->
log(
"ignoring: " + being->getName());
546 being->flashName(200);
554 const std::string &description,
555 const std::string &shortname) :
568 if (being ==
nullptr)
576 STD_VECTOR<PlayerIgnoreStrategy *> *
584 _(
"Floating '...' bubble"),
588 _(
"Floating bubble"),
599 const size_t size = name.size();
604 const std::map<std::string, PlayerRelation *>::const_iterator
614 if (being ==
nullptr)
619 const std::string &name = being->
getName();
620 const size_t size = name.size();
625 const std::map<std::string, PlayerRelation *>::const_iterator
637 const size_t size = name.size();
639 const std::string lastChar = name.substr(
size - 1, 1);
641 if (name.substr(0, 1) ==
" " ||
644 name.find(
" ") != std::string::npos)
648 else if (check.empty())
652 else if (name.find_first_of(check) != std::string::npos)
ActorManager * actorManager
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
const std::string & getName() const
void setGoodStatus(const int n)
ActorTypeT getType() const
int getGoodStatus() const
std::string getValue(const std::string &key, const std::string &deflt) const
void setList(const std::string &name, IT begin, IT end, ConfigurationListManager< T, CONT > *manager)
CONT getList(const std::string &name, CONT empty, ConfigurationListManager< T, CONT > *manager)
std::string getStringValue(const std::string &key) const
void setValue(const std::string &key, const std::string &value)
void log(const char *const log_text,...)
void ignore(Being *const being, const unsigned int flags) const
void ignore(Being *const being, const unsigned int flags) const
PIS_emote(const uint8_t emote_nr, const std::string &description, const std::string &shortname)
void ignore(Being *const being, const unsigned int flags) const
void ignore(Being *const being, const unsigned int flags) const
virtual void ignore(Being *const being, const unsigned int flags) const =0
unsigned int mDefaultPermissions
StringVect * getPlayers() const
void setDefault(const unsigned int permissions)
void setPlayerIgnoreStrategy(PlayerIgnoreStrategy *const strategy)
bool isGoodName(Being *const being) const
std::vector< PlayerIgnoreStrategy * > mIgnoreStrategies
PlayerIgnoreStrategy * mIgnoreStrategy
StringVect * getPlayersByRelation(const RelationT rel) const
std::vector< PlayerIgnoreStrategy * > * getPlayerIgnoreStrategies()
unsigned int getDefault() const
static bool checkName(const std::string &name)
~PlayerRelationsManager()
void ignoreTrade(const std::string &name) const
RelationT getRelation(const std::string &name) const
void signalUpdate(const std::string &name)
bool hasPermission(const Being *const being, const unsigned int flags) const
bool checkBadRelation(const std::string &name) const
int getPlayerIgnoreStrategyIndex(const std::string &shortname)
std::map< std::string, PlayerRelation * > mRelations
unsigned int checkPermissionSilently(const std::string &player_name, const unsigned int flags) const
void removePlayer(const std::string &name)
std::list< PlayerRelationsListener * > mListeners
void setRelation(const std::string &name, const RelationT relation)
std::map< std::string, PlayerRelation * > * readConfigItem(const ConfigurationObject *const cobj, std::map< std::string, PlayerRelation * > *const container) const
Configuration serverConfig
void delete_all(Container &c)
#define FOR_EACHP(type, iter, array)
#define FOR_EACH(type, iter, array)
#define A_DELETE_COPY(func)
#define A_DEFAULT_COPY(func)
LocalPlayer * localPlayer
std::string toLower(std::string const &s)
std::string toString(T const &value)
converts any type to a string
class anonymous_namespace{playerrelations.cpp}::SortPlayersFunctor playersRelSorter
static const unsigned int FIRST_IGNORE_EMOTE
static const char *const DEFAULT_PERMISSIONS
PlayerRelations::const_iterator PlayerRelationsCIter
static PlayerConfSerialiser player_conf_serialiser
static const char *const PERSIST_IGNORE_LIST
static const unsigned int IGNORE_EMOTE_TIME
static const char *const PLAYER_IGNORE_STRATEGY_NOP
static const char *const RELATION
PlayerRelationListeners::const_iterator PlayerRelationListenersCIter
static const char *const DEFAULT_IGNORE_STRATEGY
static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0
static const char *const NAME
std::list< PlayerRelationsListener * > PlayerRelationListeners
std::map< std::string, PlayerRelation * > PlayerRelations
static const char *const PLAYER_IGNORE_STRATEGY
PlayerRelationsManager playerRelations
StringVect::const_iterator StringVectCIter
std::vector< std::string > StringVect
static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]