Core/Channels: allow to disable ownership of channels

This commit is contained in:
ShinDarth
2016-08-15 14:27:13 +02:00
parent f81ec2bee4
commit eddebedb2d
4 changed files with 11 additions and 6 deletions

View File

@@ -0,0 +1,4 @@
ALTER TABLE characters_db_version CHANGE COLUMN 2016_08_12_00 2016_08_15_00 bit;
ALTER TABLE `channels`
ADD `ownership` tinyint(3) unsigned NOT NULL DEFAULT '1' AFTER `announce`;

View File

@@ -25,9 +25,9 @@
#include "AccountMgr.h"
#include "Player.h"
Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, TeamId teamId, bool announce):
Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, TeamId teamId, bool announce, bool ownership):
_announce(announce),
_ownership(true),
_ownership(ownership),
_IsSaved(false),
_flags(0),
_channelId(channelId),

View File

@@ -187,7 +187,7 @@ class Channel
};
public:
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true);
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true, bool ownership = true);
std::string const& GetName() const { return _name; }
uint32 GetChannelId() const { return _channelId; }
bool IsConstant() const { return _channelId != 0; }

View File

@@ -48,7 +48,8 @@ void ChannelMgr::LoadChannels()
uint32 oldMSTime = getMSTime();
uint32 count = 0;
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
// 0 1 2 3 4 5
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, ownership, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
if (!result)
{
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
@@ -64,11 +65,11 @@ void ChannelMgr::LoadChannels()
uint32 channelDBId = fields[0].GetUInt32();
std::string channelName = fields[1].GetString();
std::string password = fields[4].GetString();
std::string password = fields[5].GetString();
std::wstring channelWName;
Utf8toWStr(channelName, channelWName);
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8());
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8(), fields[4].GetUInt8());
newChannel->SetPassword(password);
channels[channelWName] = newChannel;