From 4f2660779f5b2c25ab0a80868847f06c8792d5e1 Mon Sep 17 00:00:00 2001 From: Roc13x Date: Sat, 17 Mar 2018 11:47:48 +0000 Subject: Core/Channels: Fix channel joins/changes (#21645) --- src/server/game/Chat/Channels/Channel.cpp | 12 +++++++----- src/server/game/Chat/Channels/Channel.h | 2 +- src/server/game/Entities/Player/Player.cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 98bcf8c7e48..b56b456a3e3 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -241,14 +241,16 @@ void Channel::JoinChannel(Player* player, std::string const& pass) SendToOne(builder, guid); */ - auto builder = [&](LocaleConstant /*locale*/) + auto builder = [&](LocaleConstant locale) { + LocaleConstant localeIdx = sWorld->GetAvailableDbcLocale(locale); + WorldPackets::Channel::ChannelNotifyJoined* notify = new WorldPackets::Channel::ChannelNotifyJoined(); //notify->ChannelWelcomeMsg = ""; notify->ChatChannelID = _channelId; //notify->InstanceID = 0; notify->_ChannelFlags = _channelFlags; - notify->_Channel = _channelName; + notify->_Channel = GetName(localeIdx); return notify; }; @@ -276,7 +278,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass) } } -void Channel::LeaveChannel(Player* player, bool send) +void Channel::LeaveChannel(Player* player, bool send, bool suspend) { ObjectGuid const& guid = player->GetGUID(); if (!IsOn(guid)) @@ -306,8 +308,8 @@ void Channel::LeaveChannel(Player* player, bool send) WorldPackets::Channel::ChannelNotifyLeft* notify = new WorldPackets::Channel::ChannelNotifyLeft(); notify->Channel = GetName(localeIdx); - notify->ChatChannelID = 0; - //notify->Suspended = false; + notify->ChatChannelID = _channelId; + notify->Suspended = suspend; return notify; }; diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index ed67204f290..b4455decdb9 100644 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -197,7 +197,7 @@ class TC_GAME_API Channel AreaTableEntry const* GetZoneEntry() const { return _zoneEntry; } void JoinChannel(Player* player, std::string const& pass); - void LeaveChannel(Player* player, bool send = true); + void LeaveChannel(Player* player, bool send = true, bool suspend = false); void KickOrBan(Player const* player, std::string const& badname, bool ban); void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1ad659210fc..1298f5815bc 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4760,7 +4760,7 @@ void Player::UpdateLocalChannels(uint32 newZone) if (removeChannel) { - removeChannel->LeaveChannel(this, sendRemove); // Leave old channel + removeChannel->LeaveChannel(this, sendRemove, true); // Leave old channel LeftChannel(removeChannel); // Remove from player's channel list cMgr->LeftChannel(removeChannel->GetChannelId(), removeChannel->GetZoneEntry()); // Delete if empty -- cgit v1.2.3