void Channel::Join(ObjectGuid p, const char *pass) { WorldPacket data; if (IsOn(p)) { if(!IsConstant()) // non send error message for built-in channels { MakePlayerAlreadyMember(&data, p); SendToOne(&data, p); } return; } if (IsBanned(p)) { MakeBanned(&data); SendToOne(&data, p); return; } if(m_password.length() > 0 && strcmp(pass, m_password.c_str())) { MakeWrongPassword(&data); SendToOne(&data, p); return; } Player *plr = sObjectMgr.GetPlayer(p); if(plr) { if(HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER ) { MakeNotInLfg(&data); SendToOne(&data, p); return; } if(plr->GetGuildId() && (GetFlags() == 0x38)) return; plr->JoinedChannel(this); } if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL) )) { MakeJoined(&data, p); SendToAll(&data); } data.clear(); PlayerInfo& pinfo = m_players[p]; pinfo.player = p; pinfo.flags = 0; MakeYouJoined(&data); SendToOne(&data, p); JoinNotify(p); // if no owner first logged will become if(!IsConstant() && !m_ownerGuid) { SetOwner(p, (m_players.size() > 1 ? true : false)); m_players[p].SetModerator(true); } }
void Channel::JoinChannel(Player* player, std::string const& pass) { uint64 guid = player->GetGUID(); if (IsOn(guid)) { // Do not send error message for built-in channels if (!IsConstant()) { WorldPacket data; MakePlayerAlreadyMember(&data, guid); SendToOne(&data, guid); } return; } if (IsBanned(guid)) { WorldPacket data; MakeBanned(&data); SendToOne(&data, guid); return; } if (!_password.empty() && pass != _password) { WorldPacket data; MakeWrongPassword(&data); SendToOne(&data, guid); return; } if (HasFlag(CHANNEL_FLAG_LFG) && sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup()) { WorldPacket data; MakeNotInLfg(&data); SendToOne(&data, guid); return; } player->JoinedChannel(this); if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { WorldPacket data; MakeJoined(&data, guid); SendToAll(&data); } PlayerInfo pinfo; pinfo.player = guid; pinfo.flags = MEMBER_FLAG_NONE; playersStore[guid] = pinfo; WorldPacket data; MakeYouJoined(&data); SendToOne(&data, guid); JoinNotify(guid); // Custom channel handling if (!IsConstant()) { // Update last_used timestamp in db if (!playersStore.empty()) UpdateChannelUseageInDB(); // If the channel has no owner yet and ownership is allowed, set the new owner. if (!_ownerGUID && _ownership) { SetOwner(guid, playersStore.size() > 1); playersStore[guid].SetModerator(true); } } }
void Channel::JoinChannel(Player* player, std::string const& pass) { ObjectGuid const& guid = player->GetGUID(); if (IsOn(guid)) { // Do not send error message for built-in channels if (!IsConstant()) { WorldPackets::Channel::ChannelNotify notify; MakePlayerAlreadyMember(notify, guid); player->SendDirectMessage(notify.Write()); } return; } if (IsBanned(guid)) { WorldPackets::Channel::ChannelNotify notify; MakeBanned(notify); player->SendDirectMessage(notify.Write()); return; } if (!_password.empty() && pass != _password) { WorldPackets::Channel::ChannelNotify notify; MakeWrongPassword(notify); player->SendDirectMessage(notify.Write()); return; } if (HasFlag(CHANNEL_FLAG_LFG) && sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && //FIXME: Move to RBAC player->GetGroup()) { WorldPackets::Channel::ChannelNotify notify; MakeNotInLfg(notify); player->SendDirectMessage(notify.Write()); return; } player->JoinedChannel(this); if (_announce && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL)) { WorldPackets::Channel::ChannelNotify notify; MakeJoined(notify, guid); SendToAll(notify.Write()); } PlayerInfo playerInfo; playerInfo.PlayerGuid = guid; _playersStore[guid] = playerInfo; /* WorldPackets::Channel::ChannelNotify notify; MakeYouJoined(notify); player->SendDirectMessage(notify.Write()); */ WorldPackets::Channel::ChannelNotifyJoined notify; //notify.ChannelWelcomeMsg = ""; notify.ChatChannelID = _channelId; //notify.InstanceID = 0; notify._ChannelFlags = _flags; notify._Channel = _name; player->SendDirectMessage(notify.Write()); JoinNotify(player); // Custom channel handling if (!IsConstant()) { // Update last_used timestamp in db if (!_playersStore.empty()) UpdateChannelUseageInDB(); // If the channel has no owner yet and ownership is allowed, set the new owner. if (_ownerGUID.IsEmpty() && _ownership) { SetOwner(guid, _playersStore.size() > 1); _playersStore[guid].SetModerator(true); } } }
void Channel::Join(uint64 p, const char *pass) { WorldPacket data; if (IsOn(p)) { if (!IsConstant()) // non send error message for built-in channels { MakePlayerAlreadyMember(&data, p); SendToOne(&data, p); } return; } if (IsBanned(p)) { MakeBanned(&data); SendToOne(&data, p); return; } if (m_password.length() > 0 && strcmp(pass, m_password.c_str())) { MakeWrongPassword(&data); SendToOne(&data, p); return; } Player *player = ObjectAccessor::FindPlayer(p); if (player) { if (HasFlag(CHANNEL_FLAG_LFG) && sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup()) { MakeNotInLfg(&data); SendToOne(&data, p); return; } player->JoinedChannel(this); } if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { MakeJoined(&data, p); SendToAll(&data); } data.clear(); PlayerInfo pinfo; pinfo.player = p; pinfo.flags = MEMBER_FLAG_NONE; players[p] = pinfo; MakeYouJoined(&data); SendToOne(&data, p); JoinNotify(p); // Custom channel handling if (!IsConstant()) { // Update last_used timestamp in db if (!players.empty()) UpdateChannelUseageInDB(); // If the channel has no owner yet and ownership is allowed, set the new owner. if (!m_ownerGUID && m_ownership) { SetOwner(p, (players.size() > 1 ? true : false)); players[p].SetModerator(true); } } }
void Channel::Join(uint64 p, const char *pass) { WorldPacket data; if(IsOn(p)) { if(!IsConstant()) // non send error message for built-in channels { MakePlayerAlreadyMember(&data, p); SendToOne(&data, p); } return; } if(IsBanned(p)) { MakeBanned(&data); SendToOne(&data, p); return; } if(m_password.length() > 0 && strcmp(pass, m_password.c_str())) { MakeWrongPassword(&data); SendToOne(&data, p); return; } Player *plr = objmgr.GetPlayer(p); if(plr) { if(HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && (plr->GetGroup() || plr->m_lookingForGroup.Empty()) ) { MakeNotInLfg(&data); SendToOne(&data, p); return; } if(plr->GetGuildId() && (GetFlags() == 0x38)) return; plr->JoinedChannel(this); } if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) )) { MakeJoined(&data, p); SendToAll(&data); } data.clear(); PlayerInfo pinfo; pinfo.player = p; pinfo.flags = 0; players[p] = pinfo; MakeYouJoined(&data); SendToOne(&data, p); sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_JOIN); JoinNotify(p); }