Witam o to KOD w 100% Dzia?aj?cy, zrobiony przez mojego znajomego z Realu. Huczu/Sid .
Chat.cpp:
Pod:
Dodaj:
Upewnij si? ?e numer kana?u 0x02 jest wolny.
Game.cpp:
Pod:
O
Na koncu:
Player.h:
W public:
Pod:
Pod:
Nad:
Dodaj:
Pod:
Przykladowo w funkcji:
zamien:
Zamien:
dostepne kolory to zolty, pomaranczowy i czerwony. Probowalem bialy ale niestety nie dziala. W razie problemow zapraszam na gg.
Nie zapomnij do projektu dodac:
Chat.cpp:
Pod:
Chat::Chat()
{
// Create the default channels
ChatChannel *newChannel;
Dodaj:
#ifdef HUCZU_SERVER_LOG
newChannel = new ChatChannel(0x02, "Server Log");
if(newChannel)
m_normalChannels[0x02] = newChannel;
#endif
Upewnij si? ?e numer kana?u 0x02 jest wolny.
Game.cpp:
Pod:
O
Dodaj:TSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::creatureTalkToChannel");
Player.cpp:#ifdef HUCZU_SERVER_LOG
if(player && channelId == 0x02)
return;
#endif
Na koncu:
#ifdef HUCZU_SERVER_LOG
void Player::sendFromSystem(SpeakClasses type, const std::string &text){
client->sendFromSystem(type, text);
}
#endif
Player.h:
W public:
Protocol.h:#ifdef HUCZU_SERVER_LOG
void sendFromSystem(SpeakClasses type, const std::string &text);
#endif
Pod:
Dodaj:virtual void RemoveItemContainer(NetworkMessage &msg,unsigned char cid,unsigned short slot) = 0;
Protocol76.cpp:#ifdef HUCZU_SERVER_LOG
virtual void sendFromSystem(SpeakClasses type, const std::string &text) = 0;
virtual void AddSystemSpeak(NetworkMessage &msg, SpeakClasses type, std::string text, unsigned short channelId) = 0;
#endif
Pod:
Dodaj:g_chat.removeUserFromChannel(player, channelId);
#ifdef HUCZU_SERVER_LOG
if(channelId == 0x02)
sendChannel(0x02, "Server Log");
#endif
Nad:
void Protocol76::sendToChannel(const Creature * creature, SpeakClasses type, const std::string &text, unsigned short channelId)
Dodaj:
i Pod:#ifdef HUCZU_SERVER_LOG
void Protocol76::sendFromSystem(SpeakClasses type, const std::string &text)
{
NetworkMessage newmsg;
AddSystemSpeak(newmsg, type, text, 0x02);
WriteBuffer(newmsg);
}
void Protocol76::AddSystemSpeak(NetworkMessage &msg, SpeakClasses type, std::string text, unsigned short channelId)
{
msg.AddByte(0xAA);
msg.AddString("System");
msg.AddByte(type);
switch(type){
case SPEAK_SAY:
case SPEAK_WHISPER:
case SPEAK_CHANNEL_Y:
case SPEAK_CHANNEL_R1:
case SPEAK_CHANNEL_R2:
case SPEAK_CHANNEL_O:
msg.AddU16(channelId);
break;
}
msg.AddString(text);
}
#endif
Dodaj:AddPlayerInventoryItem(msg,player, 10);
Protocol76.h:#ifdef HUCZU_SERVER_LOG
NetworkMessage newmsg;
newmsg.AddByte(0xAC);
newmsg.AddU16(0x02);
newmsg.AddString("Server Log");
WriteBuffer(newmsg);
#endif
Pod:
Dodaj:virtual void sendIcons(int icons);
Teraz wg schematu:#ifdef HUCZU_SERVER_LOG
virtual void sendFromSystem(SpeakClasses type, const std::string &text);
virtual void AddSystemSpeak(NetworkMessage &msg, SpeakClasses type, std::string text, unsigned short channelId);
#endif
Przykladowo w funkcji:
void Game::CreateDamageUpdate(Creature* creature, Creature* attackCreature, int damage)
zamien:
na:player->sendTextMessage(MSG_EVENT, dmgmesg.str().c_str());
W przypadku loot info:#ifdef HUCZU_SERVER_LOG
player->sendFromSystem(SPEAK_CHANNEL_O, dmgmesg.str().c_str());
#else
player->sendTextMessage(MSG_EVENT, dmgmesg.str().c_str());
#endif
Zamien:
na:atakujacy->sendTextMessage(MSG_INFO, ss.str().c_str());
i tak wszedzie gdzie pragniesz. Wystarczy znalezc czesc komunikatu i tam podmienic na cos podobnego jak wyzej podane.#ifdef HUCZU_SERVER_LOG
atakujacy->sendFromSystem(SPEAK_CHANNEL_O, ss.str().c_str());
#else
atakujacy->sendTextMessage(MSG_INFO, ss.str().c_str());
#endif
dostepne kolory to zolty, pomaranczowy i czerwony. Probowalem bialy ale niestety nie dziala. W razie problemow zapraszam na gg.
Nie zapomnij do projektu dodac:
-DHUCZU_SERVER_LOG