Ir para conteúdo
  • Cadastre-se

Programação [Raids Channel] -- Tutorial como adicionar Raids Channel


Posts Recomendados

[TESTADO EM OTX 2.x.x SERIES] 8.60

 

Primeiramente vá em game.cpp e procure por:

 

bool Game::broadcastMessage(const std::string& text, MessageClasses type)
{
	std::clog << "> Broadcasted message: \"" << text << "\"." << std::endl;
	for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
		it->second->sendTextMessage(type, text);

	return true;
}

Abaixo adicione:

bool Game::globalSendChannelMessage(std::string author, std::string text, MessageClasses type, uint16_t channel)
{
	std::clog << "> Channel message: \"" << text << "\"." << std::endl;
	for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
		it->second->sendChannelMessage(author, text, type, channel);

	return true;
}

Depois vá em game.h e procure por:

bool broadcastMessage(const std::string& text, MessageClasses type);

Abaixo adicione:

bool globalSendChannelMessage(std::string author, std::string text, MessageClasses type, uint16_t channel);

 

Agora vá em raids.cpp e procure por:

bool AnnounceEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;

	std::string strValue;
	if(!readXMLString(eventNode, "message", strValue))
	{
		std::clog << "[Error - AnnounceEvent::configureRaidEvent] Message tag missing for announce event." << std::endl;
		return false;
	}

	m_message = strValue;
	if(readXMLString(eventNode, "type", strValue))
	{
		std::string tmpStrValue = asLowerCaseString(strValue);
		if(tmpStrValue == "warning")
			m_messageType = MSG_STATUS_WARNING;
		else if(tmpStrValue == "event")
			m_messageType = MSG_EVENT_ADVANCE;
		else if(tmpStrValue == "default")
			m_messageType = MSG_EVENT_DEFAULT;
		else if(tmpStrValue == "description")
			m_messageType = MSG_INFO_DESCR;
		else if(tmpStrValue == "status")
			m_messageType = MSG_STATUS_SMALL;
		else if(tmpStrValue == "blue")
			m_messageType = MSG_STATUS_CONSOLE_BLUE;
		else if(tmpStrValue == "red")
			m_messageType = MSG_STATUS_CONSOLE_RED;
		else
			std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Unknown type tag for announce event, using default: "
				<< (int32_t)m_messageType << std::endl;
	}
	else
		std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Missing type tag for announce event. Using default: "
			<< (int32_t)m_messageType << std::endl;

	return true;
}

Altere para:

bool AnnounceEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;
	
	std::string strName;
	
	if(!readXMLString(eventNode, "name", strName))
	{
		std::clog << "[Error - AnnounceEvent::configureRaidEvent] Name tag missing for announce event." << std::endl;
		return false;	
	}
	m_messageAuthor = strName;

	std::string strValue;
	if(!readXMLString(eventNode, "message", strValue))
	{
		std::clog << "[Error - AnnounceEvent::configureRaidEvent] Message tag missing for announce event." << std::endl;
		return false;
	}

	m_message = strValue;
	if(readXMLString(eventNode, "type", strValue))
	{
		std::string tmpStrValue = asLowerCaseString(strValue);
		if(tmpStrValue == "warning")
			m_messageType = MSG_STATUS_WARNING;
		else if(tmpStrValue == "event")
			m_messageType = MSG_EVENT_ADVANCE;
		else if(tmpStrValue == "default")
			m_messageType = MSG_EVENT_DEFAULT;
		else if(tmpStrValue == "description")
			m_messageType = MSG_INFO_DESCR;
		else if(tmpStrValue == "status")
			m_messageType = MSG_STATUS_SMALL;
		else if(tmpStrValue == "blue")
			m_messageType = MSG_STATUS_CONSOLE_BLUE;
		else if(tmpStrValue == "red")
			m_messageType = MSG_STATUS_CONSOLE_RED;
		else if(tmpStrValue == "channel")
			m_messageType = MSG_CHANNEL;
		else if(tmpStrValue == "channel-management")
			m_messageType = MSG_CHANNEL_MANAGEMENT;
		else if(tmpStrValue == "channel-highlight")
			m_messageType = MSG_CHANNEL_HIGHLIGHT;
		else if(tmpStrValue == "channel-gamemaster")
			m_messageType = MSG_GAMEMASTER_CHANNEL;
		else
			std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Unknown type tag for announce event, using default: "
				<< (int32_t)m_messageType << std::endl;
	}
	else
		std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Missing type tag for announce event. Using default: "
			<< (int32_t)m_messageType << std::endl;

	return true;
}

Logo abaixo você verá:

bool AnnounceEvent::executeEvent(const std::string&) const
{
	g_game.broadcastMessage(m_message, m_messageType);
	return true;
}

Substitua por:

bool AnnounceEvent::executeEvent(const std::string&) const
{
	if(m_messageType == MSG_CHANNEL_HIGHLIGHT || m_messageType == MSG_CHANNEL || m_messageType == MSG_CHANNEL_MANAGEMENT || m_messageType == MSG_GAMEMASTER_CHANNEL)
		g_game.globalSendChannelMessage(m_messageAuthor, m_message, (MessageClasses)m_messageType, 12);
	else
		g_game.broadcastMessage(m_message, m_messageType);
	
	return true;
}

Agora em raids.h procure por:

class AnnounceEvent : public RaidEvent
{
	public:
		AnnounceEvent(Raid* raid, bool ref): RaidEvent(raid, ref),
			m_messageType(MSG_EVENT_ADVANCE) {}
		virtual ~AnnounceEvent() {}

		virtual bool configureRaidEvent(xmlNodePtr eventNode);
		virtual bool executeEvent(const std::string& name) const;

	private:
		std::string m_message;
		MessageClasses m_messageType;
};

Substitua por:

class AnnounceEvent : public RaidEvent
{
	public:
		AnnounceEvent(Raid* raid, bool ref): RaidEvent(raid, ref),
			m_messageType(MSG_EVENT_ADVANCE) {}
		virtual ~AnnounceEvent() {}

		virtual bool configureRaidEvent(xmlNodePtr eventNode);
		virtual bool executeEvent(const std::string& name) const;

	private:
		std::string m_messageAuthor;
		std::string m_message;
		MessageClasses m_messageType;
};

Agora em data/XML/channels.xml crie um novo canal de ID 12 para seu Raids channel:

 

<channel id="12" name="Raids" logged="yes" active="0" enable="0"/>

Agora sempre que você for criar um raids de anuncio deve colocar as tags como mostrado abaixo:

<announce delay="1000" name="Tower" type="channel" message="Mensagem" />

Você pode optar por 4 tipo de mensagens em channel:

type="channel" <!-- cor padrão -->
type="channel-highlight" <!-- cor laranja escuro -->
type="channel-management" <!-- cor branca -->
type="channel-gamemaster" <!-- cor vermelha -->

Além de que pode optar por utilizar o broadcastMessage apenas definindo as cores padrão do mesmo:

type="warning" <!-- msg aviso -->
type="event" <!-- msg branca/advance -->
type="default"
type="description" <!-- msg verde -->
type="status" <!-- msg small -->
type="blue" <!-- msg azul -->
type="red" <!-- msg red -->

 

Editado por Mathias Kenfi (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Muvuka
      Alguem tem anti-nuker igual a esse 
       

       
    • Por Muvuka
      [SQLite] -=[TFS]=- 0.4 8.60 Alguem faz apk mobile pra mim ip: dexsoft.ddns.net
       
      pra mim
       
      https://www.mediafire.com/file/5klqnyy6k7jda0u/OTClientV8.rar/file
       
      TA TUDO AI
    • Por yuriowns
      Salve rapazes, estou precisando de um client próprio para o meu servidor 7.4, preciso que algum programador experiente e com referências faça um client do jeito que eu procuro. Responda aqui para fazermos um orçamento, obrigado!

      Não sei se estou no lugar certo, se não me desculpem e peço que movam por gentileza!
    • Por paulo thush
      Pessoal to com um grande problema, estou com um servidor TFS 1.4x 10.98, recentemente começou dar um problema, sempre quando falava "trade" com o npc dava um erros, com qual quer npc, o erro e o seguinte.
       
       
      me falaram que o problema e nas sourcer que precisava mudar umas coisas me passaram um link no github esse aqui 
      https://github.com/otland/forgottenserver/pull/3996/files
       
      porem eu vi vídeos no youtube ensinando a compilar, já vi muitos tópicos como compilar a sourcer, ai quando vou compilar da esse erro
      já tentei instalar, desinstala muitas coisas, alterar também não vai, minha sourcer e essa 
      https://github.com/otland/forgottenserver
       
       
      Alguém poderia me ajuda com esse erro, ou ate compilar 100% as sourcer. os Tópicos que eu tentei para compilar e esse daqui, se não poder o link me desculpe.
      https://forums.otserv.com.br/index.php?/forums/topic/169234-windowsvc2019-compilando-sources-tfs-14-vcpkg/
       
      alguém me da uma luz por favor kkk
    • Por Ryzek
      Uso tfs 0.4 trunk3884 bem simples.
      Queria acrescentar magic effects para 255 pois o meu só vai até 69. Encontrei um tópico que falava sobre porém parece ter sido removido, não consigo acessar!
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo