Honorable Member xP3NG3Rx 19674 Posted October 21, 2017 Honorable Member Share Posted October 21, 2017 Hello everyone. Here is a little snippet for the chat history. I made this to turn back the "All" state if you turn off every each button. Spoiler 1. Open PythonChat.h and add the following function declaration to the public list of the PythonChat class: BOOL GetChatMode(DWORD dwID, int * iSum); 2. Open PythonChat.cpp and paste the next function anywhere you want: BOOL CPythonChat::GetChatMode(DWORD dwID, int * iSum) { TChatSet * pChatSet = GetChatSetPtr(dwID); if (!pChatSet) return FALSE; #ifdef ENABLE_DICE_SYSTEM BYTE byChatHistoryLogModes[7] = { CHAT_TYPE_TALKING, CHAT_TYPE_INFO, CHAT_TYPE_NOTICE, CHAT_TYPE_PARTY, CHAT_TYPE_GUILD, CHAT_TYPE_SHOUT, CHAT_TYPE_DICE_INFO }; #else BYTE byChatHistoryLogModes[6] = { CHAT_TYPE_TALKING, CHAT_TYPE_INFO, CHAT_TYPE_NOTICE, CHAT_TYPE_PARTY, CHAT_TYPE_GUILD, CHAT_TYPE_SHOUT }; #endif int iRet = 0; for (BYTE i = 0; i < sizeof(byChatHistoryLogModes) / sizeof(*byChatHistoryLogModes); i++) { if (pChatSet->CheckMode(byChatHistoryLogModes[i])) iRet += 1 << byChatHistoryLogModes[i]; } *iSum = iRet; return (iRet > 0) ? TRUE : FALSE; } 3. Open PythonChatModule.cpp and add the following function: PyObject * chatGetChatMode(PyObject* poSelf, PyObject* poArgs) { int iID; if (!PyTuple_GetInteger(poArgs, 0, &iID)) return Py_BuildException(); int iSum; BOOL bRet = CPythonChat::Instance().GetChatMode(iID, &iSum); return Py_BuildValue("ii", bRet, iSum); } //[...] { "GetChatMode", chatGetChatMode, METH_VARARGS }, 4. Open uiChat.py and replace the whole function by name; ToggleChatMode with this: def ToggleChatMode(self, mode): if self.allChatMode: self.allChatMode = False for i in self.CHAT_MODE_INDEX: chat.DisableChatMode(self.chatID, i) chat.EnableChatMode(self.chatID, mode) self.btnAll.SetUp() else: chat.ToggleChatMode(self.chatID, mode) ison, modeflag = chat.GetChatMode(self.chatID) if not ison: self.btnAll.Down() self.ToggleAllChatMode() 1 1 9 Link to comment Share on other sites More sharing options...
Active Member Exygo 1091 Posted October 21, 2017 Active Member Share Posted October 21, 2017 Good to know, I didn't even observed this little bug https://www.youtube.com/channel/UCQ8mAeda9TWq6SsTzB53emw/videos Link to comment Share on other sites More sharing options...
Lajk 7 Posted October 21, 2017 Share Posted October 21, 2017 Good but can you move sort buttons for chat window (Enter) ? Link to comment Share on other sites More sharing options...
metin2-factory 1010 Posted October 25, 2017 Share Posted October 25, 2017 ison, modeflag = chat.GetChatMode(self.chatID) what is the modeflag variable used for? is it needed anywhere or you added it just for debugging your code? because i can't see it being used anywhere Link to comment Share on other sites More sharing options...
Tasho 243 Posted October 25, 2017 Share Posted October 25, 2017 33 minutes ago, metin2-factory said: ison, modeflag = chat.GetChatMode(self.chatID) what is the modeflag variable used for? is it needed anywhere or you added it just for debugging your code? because i can't see it being used anywhere Maybe he was want to do something with the sum. Should look like that: Spoiler //PythonChat.h BOOL GetChatMode(DWORD dwID); //PythonChat.cpp BOOL CPythonChat::GetChatMode(DWORD dwID) { TChatSet * pChatSet = GetChatSetPtr(dwID); if (!pChatSet) return FALSE; BYTE byChatHistoryLogModes[] = { CHAT_TYPE_TALKING, CHAT_TYPE_INFO, CHAT_TYPE_NOTICE, CHAT_TYPE_PARTY, CHAT_TYPE_GUILD, CHAT_TYPE_SHOUT, #ifdef ENABLE_DICE_SYSTEM CHAT_TYPE_DICE_INFO #endif }; int iRet = 0; for (BYTE i = 0; i < _countof(byChatHistoryLogModes); i++) { if (pChatSet->CheckMode(byChatHistoryLogModes[i])) iRet += 1 << byChatHistoryLogModes[i]; } return iRet > 0; } //PythonChatModule.cpp PyObject * chatGetChatMode(PyObject* poSelf, PyObject* poArgs) { int iID; if (!PyTuple_GetInteger(poArgs, 0, &iID)) return Py_BuildException(); return Py_BuildValue("b", CPythonChat::Instance().GetChatMode(iID)); } //Python def ToggleChatMode(self, mode): if self.allChatMode: self.allChatMode = False for i in self.CHAT_MODE_INDEX: chat.DisableChatMode(self.chatID, i) chat.EnableChatMode(self.chatID, mode) self.btnAll.SetUp() else: chat.ToggleChatMode(self.chatID, mode) if not chat.GetChatMode(self.chatID): self.btnAll.Down() self.ToggleAllChatMode() Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19674 Posted October 25, 2017 Author Honorable Member Share Posted October 25, 2017 Yes, that is only for debug. Link to comment Share on other sites More sharing options...
metin2-factory 1010 Posted October 25, 2017 Share Posted October 25, 2017 8 hours ago, Tasho said: Maybe he was want to do something with the sum. Should look like that: Hide contents //PythonChat.h BOOL GetChatMode(DWORD dwID); //PythonChat.cpp BOOL CPythonChat::GetChatMode(DWORD dwID) { TChatSet * pChatSet = GetChatSetPtr(dwID); if (!pChatSet) return FALSE; BYTE byChatHistoryLogModes[] = { CHAT_TYPE_TALKING, CHAT_TYPE_INFO, CHAT_TYPE_NOTICE, CHAT_TYPE_PARTY, CHAT_TYPE_GUILD, CHAT_TYPE_SHOUT, #ifdef ENABLE_DICE_SYSTEM CHAT_TYPE_DICE_INFO #endif }; int iRet = 0; for (BYTE i = 0; i < _countof(byChatHistoryLogModes); i++) { if (pChatSet->CheckMode(byChatHistoryLogModes[i])) iRet += 1 << byChatHistoryLogModes[i]; } return iRet > 0; } //PythonChatModule.cpp PyObject * chatGetChatMode(PyObject* poSelf, PyObject* poArgs) { int iID; if (!PyTuple_GetInteger(poArgs, 0, &iID)) return Py_BuildException(); return Py_BuildValue("b", CPythonChat::Instance().GetChatMode(iID)); } //Python def ToggleChatMode(self, mode): if self.allChatMode: self.allChatMode = False for i in self.CHAT_MODE_INDEX: chat.DisableChatMode(self.chatID, i) chat.EnableChatMode(self.chatID, mode) self.btnAll.SetUp() else: chat.ToggleChatMode(self.chatID, mode) if not chat.GetChatMode(self.chatID): self.btnAll.Down() self.ToggleAllChatMode() well, since iRet is just for debug, this will be better. BOOL CPythonChat::IsChatModeEnabled(DWORD dwID) { TChatSet * pChatSet = GetChatSetPtr(dwID); if (!pChatSet) return FALSE; for (BYTE i = 0; i < CHAT_TYPE_MAX_NUM; i++) { if (pChatSet->CheckMode(i)) return TRUE; } return FALSE; } isModeEnabled = chat.IsChatModeEnabled(self.chatID) if not isModeEnabled: self.btnAll.Down() self.ToggleAllChatMode() But anyway, it's not a big deal. everyone has its own style Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19674 Posted November 1, 2017 Author Honorable Member Share Posted November 1, 2017 @metin2-factory Just try that code what you paste 2 Link to comment Share on other sites More sharing options...
attila1995 3 Posted April 21, 2018 Share Posted April 21, 2018 Did you see that bug, when you choose a chat mode in chat history dialog and after you open the chat edit dialog (Enter) you can see first four chat messages don't show in chat list if those four chat message's modes are same with selected chat mode, but if you don't set top it (click for the chat edit dialog), it works everytime. It is tipical bug, this bug is in orignal Metin2 too. Can somebody to fix it? I tryed it, but i dont know to how to fix it. Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 188 Posted December 5, 2018 Active Member Share Posted December 5, 2018 The biggest bug in the history of Metin2 chat interface is when you switch keyboard languages. Some clients do not even clear the textbox... But no one has fixed that so far EDIT: I don't know why but I'm getting this error: networkModule.SetSelectCharacterPhase - <type 'exceptions.SyntaxError'>:invalid syntax (uiChat.py, line 1059) I've checked tabulations and code compatibility. It hits at self.btnAll.Down() which I've checked and confirmed that is valid. Link to comment Share on other sites More sharing options...
Premium DemOnJR 564 Posted July 30, 2023 Premium Share Posted July 30, 2023 (edited) Thanks, tested on martysama and is working. Edited July 30, 2023 by DemOnJR Link to comment Share on other sites More sharing options...
Recommended Posts