ChannelList Chat::getChannelList(Player* player) { ChannelList list; NormalChannelMap::iterator itn; PrivateChannelMap::iterator it; bool gotPrivate = false; // If has guild if(player->getGuildId() && player->getGuildName().length()){ ChatChannel *channel = getChannel(player, CHANNEL_GUILD); if(channel) list.push_back(channel); else if((channel = createChannel(player, CHANNEL_GUILD))) list.push_back(channel); } if(player->getParty()){ ChatChannel *channel = getChannel(player, CHANNEL_PARTY); if(channel) list.push_back(channel); else if((channel = createChannel(player, CHANNEL_PARTY))) list.push_back(channel); } for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){ if(!player->hasFlag(PlayerFlag_CannotBeMuted)){ if(itn->first == CHANNEL_TRADE && player->getVocationId() == 0) continue; if(itn->first == CHANNEL_TRADE_ROOK && player->getVocationId() != 0) continue; } ChatChannel *channel = itn->second; list.push_back(channel); } for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){ PrivateChatChannel* channel = it->second; if(channel){ if(channel->isInvited(player)) list.push_back(channel); if(channel->getOwner() == player->getGUID()) gotPrivate = true; } } if(!gotPrivate) list.push_front(dummyPrivate); return list; }
ChannelList Chat::getChannelList(Player* player) { ChannelList list; NormalChannelMap::iterator itn; PrivateChannelMap::iterator it; bool gotPrivate = false; // If has guild if(player->getGuildId() && player->getGuildName().length()){ ChatChannel *channel = getChannel(player, 0x00); if(channel) list.push_back(channel); else if((channel = createChannel(player, 0x00))) list.push_back(channel); } for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){ if(itn->first == 0x03 && !player->hasFlag(PlayerFlag_CanAnswerRuleViolations)){ //Rule violations channel continue; } ChatChannel *channel = itn->second; list.push_back(channel); } for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){ PrivateChatChannel* channel = it->second; if(channel){ if(channel->isInvited(player)) list.push_back(channel); if(channel->getOwner() == player->getGUID()) gotPrivate = true; } } if(!gotPrivate) list.push_front(dummyPrivate); return list; }
ChannelList Chat::getChannelList(Player* player) { ChannelList list; if(!player || player->isRemoved()) return list; ChatChannel* channel = NULL; if(player->getParty() && ((channel = getChannel(player, CHANNEL_PARTY)) || (channel = createChannel(player, CHANNEL_PARTY)))) list.push_back(channel); if(player->getGuildId() && player->getGuildName().length() && ((channel = getChannel( player, CHANNEL_GUILD)) || (channel = createChannel(player, CHANNEL_GUILD)))) list.push_back(channel); for(NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it) { if((channel = getChannel(player, it->first))) list.push_back(it->second); } bool hasPrivate = false; PrivateChatChannel* privChannel = NULL; for(PrivateChannelMap::iterator pit = m_privateChannels.begin(); pit != m_privateChannels.end(); ++pit) { if(!(privChannel = pit->second)) continue; if(privChannel->isInvited(player)) list.push_back(privChannel); if(privChannel->getOwner() == player->getGUID()) hasPrivate = true; } if(!hasPrivate && player->isPremium()) list.push_front(dummyPrivate); return list; }