/* * Copyright (C) 2008-2018 TrinityCore * * 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 . */ #include "LFG.h" #include "Language.h" #include "ObjectMgr.h" #include namespace lfg { std::string ConcatenateDungeons(LfgDungeonSet const& dungeons) { std::string dungeonstr = ""; if (!dungeons.empty()) { std::ostringstream o; LfgDungeonSet::const_iterator it = dungeons.begin(); o << (*it); for (++it; it != dungeons.end(); ++it) o << ", " << uint32(*it); dungeonstr = o.str(); } return dungeonstr; } std::string GetRolesString(uint8 roles) { std::string rolesstr = ""; if (roles & PLAYER_ROLE_TANK) rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_TANK)); if (roles & PLAYER_ROLE_HEALER) { if (!rolesstr.empty()) rolesstr.append(", "); rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_HEALER)); } if (roles & PLAYER_ROLE_DAMAGE) { if (!rolesstr.empty()) rolesstr.append(", "); rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_DAMAGE)); } if (roles & PLAYER_ROLE_LEADER) { if (!rolesstr.empty()) rolesstr.append(", "); rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_LEADER)); } if (rolesstr.empty()) rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_NONE)); return rolesstr; } std::string GetStateString(LfgState state) { int32 entry = LANG_LFG_ERROR; switch (state) { case LFG_STATE_NONE: entry = LANG_LFG_STATE_NONE; break; case LFG_STATE_ROLECHECK: entry = LANG_LFG_STATE_ROLECHECK; break; case LFG_STATE_QUEUED: entry = LANG_LFG_STATE_QUEUED; break; case LFG_STATE_PROPOSAL: entry = LANG_LFG_STATE_PROPOSAL; break; case LFG_STATE_DUNGEON: entry = LANG_LFG_STATE_DUNGEON; break; case LFG_STATE_FINISHED_DUNGEON: entry = LANG_LFG_STATE_FINISHED_DUNGEON; break; case LFG_STATE_RAIDBROWSER: entry = LANG_LFG_STATE_RAIDBROWSER; break; } return std::string(sObjectMgr->GetTrinityStringForDBCLocale(entry)); } } // namespace lfg