mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
i.e. world update start
This commit is contained in:
committed by
Francesco Borzì
parent
1b7522ff0e
commit
51b8773528
@@ -7,6 +7,7 @@
|
||||
#include "ChannelMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "World.h"
|
||||
#include "DatabaseEnv.h"
|
||||
@@ -22,6 +23,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
||||
_channelDBId(channelDBId),
|
||||
_teamId(teamId),
|
||||
_ownerGUID(0),
|
||||
lastSpeakTime(0),
|
||||
_name(name),
|
||||
_password("")
|
||||
{
|
||||
@@ -83,7 +85,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
||||
bool Channel::IsBanned(uint64 guid) const
|
||||
{
|
||||
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
|
||||
return itr != bannedStore.end() && itr->second > time(NULL);
|
||||
return itr != bannedStore.end() && itr->second > GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Channel::UpdateChannelInDB() const
|
||||
@@ -198,7 +200,6 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
||||
PlayerInfo pinfo;
|
||||
pinfo.player = guid;
|
||||
pinfo.flags = MEMBER_FLAG_NONE;
|
||||
pinfo.lastSpeakTime = 0;
|
||||
pinfo.plrPtr = player;
|
||||
|
||||
playersStore[guid] = pinfo;
|
||||
@@ -405,8 +406,8 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
||||
{
|
||||
if (!IsBanned(victim))
|
||||
{
|
||||
bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION);
|
||||
bannedStore[GUID_LOPART(victim)] = GameTime::GetGameTime() + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(GUID_LOPART(victim), GameTime::GetGameTime() + CHANNEL_BAN_DURATION);
|
||||
|
||||
if (notify)
|
||||
{
|
||||
@@ -786,9 +787,9 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
||||
else if (playersStore.size() >= 10)
|
||||
speakDelay = 5;
|
||||
|
||||
if (!pinfo.IsAllowedToSpeak(speakDelay))
|
||||
if (IsAllowedToSpeak(speakDelay))
|
||||
{
|
||||
std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime());
|
||||
std::string timeStr = secsToTimeString(lastSpeakTime + speakDelay - GameTime::GetGameTime());
|
||||
if (_channelRights.speakMessage.length() > 0)
|
||||
player->GetSession()->SendNotification("%s", _channelRights.speakMessage.c_str());
|
||||
player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str());
|
||||
@@ -1235,3 +1236,14 @@ void Channel::RemoveWatching(Player* p)
|
||||
if (itr != playersWatchingStore.end())
|
||||
playersWatchingStore.erase(itr);
|
||||
}
|
||||
|
||||
bool Channel::IsAllowedToSpeak(uint32 speakDelay)
|
||||
{
|
||||
if (lastSpeakTime+speakDelay <= GameTime::GetGameTime())
|
||||
{
|
||||
lastSpeakTime = GameTime::GetGameTime();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
#include "Opcodes.h"
|
||||
#include "WorldPacket.h"
|
||||
@@ -139,7 +140,6 @@ class Channel
|
||||
{
|
||||
uint64 player;
|
||||
uint8 flags;
|
||||
uint32 lastSpeakTime; // pussywizard
|
||||
Player* plrPtr; // pussywizard
|
||||
|
||||
bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
@@ -162,16 +162,6 @@ class Channel
|
||||
if (state) flags |= MEMBER_FLAG_MUTED;
|
||||
else flags &= ~MEMBER_FLAG_MUTED;
|
||||
}
|
||||
bool IsAllowedToSpeak(uint32 speakDelay) // pussywizard
|
||||
{
|
||||
if (lastSpeakTime+speakDelay <= sWorld->GetGameTime())
|
||||
{
|
||||
lastSpeakTime = sWorld->GetGameTime();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -219,6 +209,7 @@ class Channel
|
||||
// pussywizard:
|
||||
void AddWatching(Player* p);
|
||||
void RemoveWatching(Player* p);
|
||||
bool IsAllowedToSpeak(uint32 speakDelay); // pussywizard
|
||||
|
||||
private:
|
||||
// initial packet data (notify type and channel name)
|
||||
@@ -320,6 +311,7 @@ class Channel
|
||||
uint32 _channelDBId;
|
||||
TeamId _teamId;
|
||||
uint64 _ownerGUID;
|
||||
uint32 lastSpeakTime;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
ChannelRights _channelRights;
|
||||
|
||||
Reference in New Issue
Block a user