• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Mega Mute

Hakur

New Member
Joined
Feb 12, 2012
Messages
145
Reaction score
1
Witam mam problem otóż gdy piszę do npc i dostane na npc channel muta i nadal bd pisał jakieś wiadomości na npc channel to mute cały czas jest 2x większe i mam problem otóż wystarczy zrobić tak parę razy i mamy mute około 3k sekund więc mam pytanie może wiecie jak zrobić że gdy mamy mute to wiadomości były ignorowane npc albo jakoś inaczej zfixować to.
 
no właśnie szukałem wszędzie i dupa ;/ a te mute jest chore bo ciągle się zwiększa.
 
players.cpp
metoda odpowiadajaca za mute wyglada tak
void Player::removeMessageBuffer()
{
if(hasFlag(PlayerFlag_CannotBeMuted))
return;

int32_t maxBuffer = g_config.getNumber(ConfigManager::MAX_MESSAGEBUFFER);
if(!maxBuffer || messageBuffer > maxBuffer + 1 || ++messageBuffer <= maxBuffer)
return;

uint32_t muteCount = 1;
MuteCountMap::iterator it = muteCountMap.find(guid);
if(it != muteCountMap.end())
muteCount = it->second;

uint32_t muteTime = 5 * muteCount * muteCount;
muteCountMap[guid] = muteCount + 1;
if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_MUTED, muteTime * 1000))
addCondition(condition);

char buffer[50];
sprintf(buffer, "You are muted for %d seconds.", muteTime);
sendTextMessage(MSG_STATUS_SMALL, buffer);
}

mozesz pewnie zmienic ja na
void Player::removeMessageBuffer()
{
return;
}
ale to raczej nie jest rozwiazanie bo ci beda spamowac, cos musisz miec raczej z npcami nie tak.
 
No a właśnie chodzi o to że pisząc z npc gdy dostaniemy mute to możemy go sobie powiększyć zamiast dostawać blokadę na pisanie.
 
To już musisz sam sposobem prób i błędów dojść do momentu w którym nie sprawdza tego że jestes muted i nie blokuje ci wiadomości, to powinno nastąpić w tych metodach w chat.cpp i game.cpp:
Code:
bool Chat::talkToChannel(Player* player, SpeakClasses type, const std::string& text, uint16_t channelId)
{
	if(text.empty())
		return false;

	ChatChannel* channel = getChannel(player, channelId);

	if(!channel)
		return false;

	if(!player->hasFlag(PlayerFlag_CannotBeMuted))
	{
		if(!channel->hasFlag(CHANNELFLAG_ACTIVE))
		{
			player->sendTextMessage(MSG_STATUS_SMALL, "You may not speak into this channel.");
			return true;
		}

		if(player->getLevel() < channel->getLevel())
		{
			char buffer[100];
			sprintf(buffer, "You may not speak into this channel as long as you are on level %d.", channel->getLevel());
			player->sendCancel(buffer);
			return true;
		}
[B]
		if(channel->getConditionId() >= 0 && player->hasCondition([COLOR="#FF0000"]CONDITION_MUTED[/COLOR], channel->getConditionId()))
		{
			player->sendCancel(channel->getConditionMessage().c_str());
			return true;
		}[/B]
	}
[...]
Code:
bool Game::playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string& receiver, const std::string& text)
{
	Player* player = getPlayerByID(playerId);
	if(!player || player->isRemoved())
		return false;

	uint32_t muted = 0;
	bool mute = player->[COLOR="#FF0000"]isMuted[/COLOR](channelId, type, muted);
[B]	if(muted && mute)
	{
		char buffer[75];
		sprintf(buffer, "You are still muted for %d seconds.", muted);
		player->sendTextMessage(MSG_STATUS_SMALL, buffer);
		return false;
	}[/B]

	if(player->isAccountManager())
	{
		if(mute)
			player->removeMessageBuffer();

		return internalCreatureSay(player, SPEAK_SAY, text, false);
	}

	if(g_talkActions->onPlayerSay(player, type == SPEAK_SAY ? (unsigned)CHANNEL_DEFAULT : channelId, text, false))
		return true;

	ReturnValue ret = RET_NOERROR;
	if(!muted)
	{
		ret = g_spells->onPlayerSay(player, text);
		if(ret == RET_NOERROR || (ret == RET_NEEDEXCHANGE && !g_config.getBool(ConfigManager::BUFFER_SPELL_FAILURE)))
			return true;
	}

[B]	if(mute)
		player->removeMessageBuffer();[/B]
[..]
 
Back
Top