Postado Maio 2, 2020 5 anos [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 Maio 3, 2020 5 anos por Mathias Kenfi (veja o histórico de edições)
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.