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 (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::Join(Player *p, const char *pass) { WorldPacket data; if(IsOn(p)) { MakeAlreadyOn(&data,p); SendToOne(&data,p); } else if(IsBanned(p->GetGUID())) { MakeYouAreBanned(&data); SendToOne(&data,p); } else if(password.length() > 0 && strcmp(pass,password.c_str())) { MakeWrongPass(&data); SendToOne(&data,p); } else { PlayerInfo pinfo; pinfo.player = p; pinfo.muted = false; pinfo.owner = false; pinfo.moderator = false; MakeJoined(&data,p); p->JoinedChannel(this); if(p->m_gmInvisible); else if(announce) SendToAll(&data); data.clear(); players[p] = pinfo; MakeYouJoined(&data, p); SendToOne(&data,p); if(!IsGeneralChannel() && !constant && owner == NULL) { SetOwner(p); players[p].moderator = true; } else if(p->GetSession()->GetSecurity() >= 3) { SetOwner(p); players[p].moderator = true; } else if(p->GetSession()->GetSecurity() >= 1) players[p].moderator = true; } }
void Channel::Join(uint64 p, const char *pass) { WorldPacket data; if(IsOn(p)) { if(!IsConstant()) // non send error message for built-in channels { MakeAlreadyOn(&data,p); SendToOne(&data,p); } } else if(IsBanned(p)) { MakeYouAreBanned(&data); SendToOne(&data,p); } else if(password.length() > 0 && strcmp(pass,password.c_str())) { MakeWrongPass(&data); SendToOne(&data,p); } else { PlayerInfo pinfo; pinfo.player = p; pinfo.muted = false; pinfo.owner = false; pinfo.moderator = false; Player *plr = objmgr.GetPlayer(p); if(plr) plr->JoinedChannel(this); if(announce) { MakeJoined(&data,p); SendToAll(&data); } data.clear(); players[p] = pinfo; MakeYouJoined(&data,p); SendToOne(&data,p); // if no owner first logged will become if(!IsConstant() && !m_ownerGUID) { SetOwner(p, (players.size()>1?true:false)); players[p].moderator = 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 = sObjectMgr->GetPlayer(p); if (plr) { if (HasFlag(CHANNEL_FLAG_LFG) && sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup()) { MakeNotInLfg(&data); SendToOne(&data, p); return; } plr->JoinedChannel(this); } if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !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(Player* player, const char* password) { ObjectGuid guid = player->GetObjectGuid(); WorldPacket data; if (IsOn(guid)) { if (!IsConstant()) // non send error message for built-in channels { MakePlayerAlreadyMember(&data, guid); SendToOne(&data, guid); } return; } if (IsBanned(guid)) { MakeBanned(&data); SendToOne(&data, guid); return; } if (m_password.length() > 0 && strcmp(password, m_password.c_str())) { MakeWrongPassword(&data); SendToOne(&data, guid); return; } if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && player->GetSession()->GetSecurity() == SEC_PLAYER) { MakeNotInLfg(&data); SendToOne(&data, guid); return; } if (player->GetGuildId() && (GetFlags() == 0x38)) return; // join channel player->JoinedChannel(this); if (m_announce && (player->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL))) { MakeJoined(&data, guid); SendToAll(&data); } data.clear(); PlayerInfo& pinfo = m_players[guid]; pinfo.player = guid; pinfo.flags = MEMBER_FLAG_NONE; MakeYouJoined(&data); SendToOne(&data, guid); JoinNotify(guid); // if no owner first logged will become if (!IsConstant() && !m_ownerGuid) { SetOwner(guid, (m_players.size() > 1 ? true : false)); m_players[guid].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()) && //FIXME: Move to RBAC player->GetGroup()) { WorldPacket data; MakeNotInLfg(&data); SendToOne(&data, guid); return; } player->JoinedChannel(this); if (_announce && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_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::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 = sObjectMgr.GetPlayer(p); if(plr) { if(HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_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_BOOL_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); JoinNotify(p); // if no owner first logged will become if(!IsConstant() && !m_ownerGUID) { SetOwner(p, (players.size() > 1 ? true : false)); players[p].SetModerator(true); } }
void Channel::Join(uint64 p, const char *pass) { WorldPacket data; std::string worldChatChannelName = sWorld->GetWorldChatChannelName(); uint64 worldChatOwnerGuid = sWorld->GetWorldChatOwnerGuid(); uint64 worldChatIdleGuid = sWorld->GetWorldChatIdleGuid(); if (IsOn(p)) { if ( m_name != worldChatChannelName ) { if (!IsConstant()) { 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); if ( m_name != worldChatChannelName ) { if (!IsConstant() && !m_ownerGUID) { SetOwner(p, (players.size() > 1 ? true : false)); players[p].SetModerator(true); } } else { if ( p == worldChatOwnerGuid ) { SetOwner(worldChatOwnerGuid, true); players[worldChatOwnerGuid].SetModerator(true); } else { SetOwner(worldChatIdleGuid, true); players[worldChatIdleGuid].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; pinfo.lastSpeakTime = 0; pinfo.plrPtr = player; playersStore[guid] = pinfo; if (_channelRights.joinMessage.length()) ChatHandler(player->GetSession()).PSendSysMessage("%s", _channelRights.joinMessage.c_str()); WorldPacket data; MakeYouJoined(&data); SendToOne(&data, guid); JoinNotify(player); // Custom channel handling if (!IsConstant()) { // Update last_used timestamp in db if (!playersStore.empty()) UpdateChannelUseageInDB(); if (_channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end()) { playersStore[guid].SetModerator(true); FlagsNotify(player); } // If the channel has no owner yet and ownership is allowed, set the new owner. if (!_ownerGUID && _ownership) SetOwner(guid, false); if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) playersStore[guid].SetMuted(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; } Player *plr = sObjectMgr.GetPlayer(p); if ((!plr || !plr->isGameMaster()) && !IsConstant() && m_name != "world" && m_name != "engworld" && m_name != "handel") { uint32 limitCount = sWorld.getConfig(CONFIG_PRIVATE_CHANNEL_LIMIT); if (limitCount && players.size() > limitCount) { MakeInvalidName(&data); SendToOne(&data, p); return; } } if (!m_ownerGUID && (!plr || !plr->CanSpeak())) // muted players can't create new channels { MakeBanned(&data);//no idea what to send SendToOne(&data, p); return; } if (IsBanned(p) && (!plr || !plr->isGameMaster())) { MakeBanned(&data); SendToOne(&data, p); return; } if (m_password.length() > 0 && strcmp(pass, m_password.c_str()) && (!plr || !plr->isGameMaster())) { MakeWrongPassword(&data); SendToOne(&data, p); return; } if (plr) { if (IsLFG() && sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && !plr->GetSession()->HasPermissions(PERM_GMT) && 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()->HasPermissions(PERM_GMT) || !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); JoinNotify(p); // if no owner first logged will become if (!IsConstant() && !m_ownerGUID) { 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); }