66 const int type =
msg.readUInt8(
"type");
67 const int flag =
msg.readUInt8(
"flag");
114 const int chatMsgLength =
msg.readInt16(
"len") - 4;
115 if (chatMsgLength <= 0)
127 const int msgId =
msg.readInt16(
"msg id");
130 if (msgId >= 1266 && msgId <= 1269)
139 chatMsg =
_(
"Can't cast skill in this area.");
143 chatMsg =
_(
"Can't use item in this area.");
147 chatMsg =
_(
"Can't equip. Wrong level.");
151 chatMsg =
_(
"Can't use. Wrong level.");
155 chatMsg =
_(
"Work in progress.");
158 chatMsg =
strprintf(
"Message #%d", msgId);
166 const int msgId =
msg.readInt16(
"msg id");
167 const int value =
msg.readInt32(
"value");
175 "Message #%d, value: %d", msgId, value);
181 const int msgId =
msg.readInt16(
"msg id");
182 msg.readInt32(
"color");
185 "Message #%d", msgId);
191 const int strLen =
msg.readInt16(
"len") - 6;
192 const int msgId =
msg.readInt16(
"msg id");
193 const std::string message =
msg.readString(strLen,
"value");
196 "Message #%d, value: %s", msgId, message.c_str());
202 const int strLen =
msg.readInt16(
"len") - 10;
203 const int msgId =
msg.readInt16(
"msg id");
205 msg.readInt32(
"color");
206 const std::string message =
msg.readString(strLen,
"value");
209 "Message #%d, value: %s", msgId, message.c_str());
215 const int skillId =
msg.readInt16(
"skill id");
216 const int msgId =
msg.readInt32(
"msg id");
219 "Message #%d, skill: %d", msgId, skillId);
226 int chatMsgLength =
msg.readInt16(
"len") - 4;
227 msg.readInt32(
"unused");
228 msg.readInt32(
"chat color");
230 if (chatMsgLength <= 0)
236 std::string message =
msg.readRawString(chatMsgLength,
"message");
237 std::string
msg2 = message;
240 const size_t idx =
msg2.find(
"' channel for '");
241 if (idx != std::string::npos && (
chatWindow !=
nullptr))
244 msg2.substr(0, idx)),
false);
251 if (nick.size() > 1 && nick[0] ==
'#')
253 if (message ==
strprintf(
"[ %s ] %s : \302\202\302",
265 std::string
msg = chatMsg;
269 const size_t idx =
msg.find(
" ] ");
270 if (idx != std::string::npos)
272 channel = std::string(
"#").append(
msg.substr(0, idx));
273 chatMsg =
msg.substr(idx + 3);
293 const size_t pos = chatMsg.find(
" : ", 0);
294 if (pos != std::string::npos)
295 chatMsg.erase(0, pos + 3);
310 const int chatMsgLength =
msg.readInt16(
"len") - 4;
311 if (chatMsgLength <= 0)
317 std::string chatMsg =
msg.readRawString(chatMsgLength,
"message");
329 const int chatMsgLength =
msg.readInt16(
"len") - 16;
330 msg.readInt32(
"font color");
331 msg.readInt16(
"font type");
332 msg.readInt16(
"font size");
333 msg.readInt16(
"font align");
334 msg.readInt16(
"font y");
337 const std::string chatMsg =
msg.readRawString(chatMsgLength,
343 msg.readRawString(chatMsgLength,
"message");
351 if (
msg.getVersion() >= 20091104)
353 const int chatMsgLength =
msg.readInt16(
"len") - packetLen;
354 std::string nick =
msg.readString(24,
"nick");
355 if (
msg.getVersion() >= 20091104)
356 msg.readInt32(
"admin flag");
358 if (chatMsgLength <= 0)
371 const uint8_t type =
msg.readUInt8(
"response");
372 if (
msg.getVersion() >= 20131223)
373 msg.readBeingId(
"being id");
377 if (nick.size() > 1 && nick[0] ==
'#')
381 strprintf(
_(
"Message could not be sent, channel "
382 "%s is not exists."), nick.c_str()),
398 const int count = (
msg.readInt16(
"len") - 4) / 24;
399 for (
int f = 0; f < count; f ++)
400 msg.readString(24,
"nick");
407 const int len =
msg.readInt16(
"len") - 17;
409 obj->
ownerId =
msg.readBeingId(
"owner account id");
413 obj->
type =
msg.readUInt8(
"type");
414 obj->
title =
msg.readString(len,
"title");
418 if (dstBeing !=
nullptr)
424 const int count = (
msg.readInt16(
"len") - 8) / 28;
425 const int id =
msg.readInt32(
"chat id");
428 for (
int f = 0; f < count; f ++)
430 msg.readInt32(
"role");
431 msg.readString(24,
"name");
436 if (oldChat !=
nullptr)
442 if (oldChat !=
nullptr)
459 msg.readInt16(
"users");
460 const std::string name =
msg.readString(24,
"name");
461 const int status =
msg.readUInt8(
"flag");
486 if (being !=
nullptr)
496 const std::string channel =
msg.readString(24,
"channel name");
497 const int flag =
msg.readUInt8(
"flag");
499 if (channel.size() < 2)
508 "%s is not exists."), channel.c_str()),
517 channel.substr(1)),
false);
526 if (chatMsg.find(
"\302\202G") == 0 || chatMsg.find(
"\302\202A") == 0)
532 if (chatMsg.find(
"\302\202!") == 0)
533 chatMsg = chatMsg.substr(2);
535 if (nick !=
"Server")
560 const int chatMsgLength =
msg.readInt16(
"len") - 8;
563 if (chatMsgLength <= 0)
569 std::string chatMsg =
msg.readRawString(chatMsgLength,
"message");
574 const size_t pos = chatMsg.find(
" : ", 0);
575 std::string sender_name = ((pos == std::string::npos)
576 ?
"" : chatMsg.substr(0, pos));
578 if ((being !=
nullptr) && sender_name != being->
getName()
582 sender_name = being->
getName();
586 chatMsg.erase(0, pos + 3);
599 removeColors(sender_name).append(
" : ").append(chatMsg),
618 const int result =
msg.readUInt8(
"flag");
651 const int chatId =
msg.readInt32(
"chat id");
659 const int result =
msg.readUInt8(
"flag");
693 msg.readInt16(
"users");
694 const std::string name =
msg.readString(24,
"name");
702 const int sz =
msg.readInt16(
"len") - 17;
703 const BeingId ownerId =
msg.readBeingId(
"owner id");
704 const int chatId =
msg.readInt32(
"chat id");
705 const uint16_t limit =
msg.readInt16(
"limit");
706 msg.readInt16(
"users");
707 const uint8_t type =
msg.readUInt8(
"type");
708 const std::string &title =
msg.readString(sz,
"title");
710 if ((chat !=
nullptr) && chat->
chatId == chatId)
715 if (chat->
title != title)
728 const int role =
msg.readInt32(
"role");
729 const std::string name =
msg.readString(24,
"name");
747 msg.readItemId(
"item id");
753 msg.readInt32(
"exp");
763 const int result =
msg.readInt32(
"type");
779 const int result =
msg.readUInt8(
"type");
780 const std::string name =
msg.readString(24,
"gm name");
798 msg.readBeingId(
"being id");
799 const std::string message =
msg.readString(80,
"message");
809 const int sz =
msg.readInt16(
"len") - 24 - 8;
810 msg.readBeingId(
"account id");
811 msg.readString(24,
"nick");
812 msg.readString(sz,
"message");
817 const int sz =
msg.readInt16(
"len") - 8;
818 msg.readBeingId(
"being id");
819 const std::string message =
msg.readString(sz,
"message");
828 const int sz =
msg.readInt16(
"len") - 8;
829 msg.readInt32(
"color");
830 const std::string message =
msg.readString(sz,
"message");
ActorManager * actorManager
ChatMsgType ::T ChatMsgTypeT
Being * findBeing(const BeingId id) const
void updateRoom(const ChatObject *const newChat)
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
void removeRoom(const int chatId)
void setChat(ChatObject *const obj)
ChatObject * getChat() const
const std::string & getName() const
void setSpeech(const std::string &text)
ActorTypeT getType() const
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
void addWhisper(const std::string &nick, const std::string &mes, const ChatMsgTypeT own)
void channelChatLog(const std::string &channel, const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
ChatTab * addChannelTab(const std::string &name, const bool switchTo)
bool resortChatLog(std::string line, ChatMsgTypeT own, const std::string &channel, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
void joinRoom(const bool isJoin)
void addGlobalMessage(const std::string &line)
bool hasPermission(const Being *const being, const unsigned int flags) const
unsigned int checkPermissionSilently(const std::string &player_name, const unsigned int flags) const
const std::string GENERAL_CHANNEL
const bool IgnoreRecord_false
LocalPlayer * localPlayer
#define UNIMPLEMENTEDPACKETFIELD(field)
#define UNIMPLEMENTEDPACKET
bool msg(InputEvent &event)
bool msg2(InputEvent &event)
std::string trim(std::string const &str)
void processChatContinue(std::string chatMsg, const ChatMsgTypeT own)
void processFormatMessageString(Net::MessageIn &msg)
void processIgnoreNickAck(Net::MessageIn &msg)
void processBeingChat(Net::MessageIn &msg)
void processChatRoomSettings(Net::MessageIn &msg)
void processMVPItem(Net::MessageIn &msg)
void processWhisper(Net::MessageIn &msg)
void processWhisperContinue(const std::string &nick, std::string chatMsg)
std::string extractChannelFromMessage(std::string &chatMsg)
void processChatTalkieBox(Net::MessageIn &msg)
void processMVPNoItem(Net::MessageIn &msg)
void processGmChat(Net::MessageIn &msg)
void processChatSilence(Net::MessageIn &msg)
void processFormatColor(Net::MessageIn &msg)
void processFormatMessage(Net::MessageIn &msg)
void processMannerMessage(Net::MessageIn &msg)
void processColorChat(Net::MessageIn &msg)
void processScriptMessage(Net::MessageIn &msg)
void processChatRoomJoinAck(Net::MessageIn &msg)
void processJoinChannel(Net::MessageIn &msg)
void processChatRoomRoleChange(Net::MessageIn &msg)
void processChatIgnoreList(Net::MessageIn &msg)
void processMVPExp(Net::MessageIn &msg)
void processChat(Net::MessageIn &msg)
void processServiceMessageColor(Net::MessageIn &msg)
void processWhisperResponse(Net::MessageIn &msg)
void processChatDisplay(Net::MessageIn &msg)
void processBattleChatMessage(Net::MessageIn &msg)
void processChatRoomCreateAck(Net::MessageIn &msg)
void processChatRoomDestroy(Net::MessageIn &msg)
void processChatRoomAddMember(Net::MessageIn &msg)
void processFormatMessageNumber(Net::MessageIn &msg)
void processChatRoomJoinFailed(Net::MessageIn &msg)
void processFormatMessageStringColor(Net::MessageIn &msg)
void processChatRoomLeave(Net::MessageIn &msg)
void processFormatMessageSkill(Net::MessageIn &msg)
void processGmChat2(Net::MessageIn &msg)
void handleMercenaryMessage(const int cmd)
void processWhisperResponseContinue(Net::MessageIn &msg, const uint8_t type)
std::string getLastWhisperNick()
WhisperQueue mSentWhispers
void notify(const unsigned int message)
@ UNIGNORE_PLAYER_UNKNOWN
@ IGNORE_PLAYER_TYPE_UNKNOWN
@ UNIGNORE_PLAYER_SUCCESS
@ ROOM_ERROR_WRONG_PASSWORD
@ UNIGNORE_PLAYER_FAILURE
void setRoomName(const std::string &name)
#define BLOCK_START(name)
PlayerRelationsManager playerRelations
std::string removeColors(std::string msg)
std::string strprintf(const char *const format,...)
bool findCutFirst(std::string &str1, const std::string &str2)
bool findCutLast(std::string &str1, const std::string &str2)
static ChatObject * findById(const int id)
static const unsigned int SPEECH_FLOAT
static const unsigned int SPEECH_LOG
static const unsigned int WHISPER
const bool TryRemoveColors_true
const bool TryRemoveColors_false