Jump to content

VegaS™

Forum Moderator
  • Posts

    656
  • Joined

  • Last visited

  • Days Won

    187
  • Feedback

    100%

Everything posted by VegaS™

  1. def OnKeyDown(self, key): try: self.onPressKeyDict[key]() except KeyError: pass except: raise return True
  2. The title says it all. - Programming meme - Metin2 meme Please, no memes with people with disabilities. Please use also the spoiler function. I'll start: @martysama0134
  3. @dmitry Your problem is in localeInfo.py (korean characters + bad encoding) Here's your localeInfo.py fixed. [Hidden Content] For those who have the same issue, check this reply, you'll find the file rewritted with non-korean shits and a lot of checks useless:
  4. Not everything should be written in source, but here's a method. (2 years ago - i posted it in another forum) //@Src/Server/game/src/input_login.cpp // Add to the beginning of the file: inline bool AllowedToWarp(const DWORD dwMapIndex, const DWORD dwLevel) { struct set_struct { const unsigned short map_index; const unsigned short minimum_level; } set_fields[] = { { 91, 75 }, // Grotto of Exile 1st Floor { 82, 75 }, // Grotto of Exile 2nd Floor { 216, 75 }, // Devils Catacomb { 218, 90 }, // Cape Dragon Head { 219, 90 }, // Dawn Mist Wood { 220, 90 }, // Mount Thunder { 221, 90 } // Bay Black Sand }; for (unsigned short i = 0; i < _countof(set_fields); ++i) { if (dwMapIndex == set_fields[i].map_index && dwLevel < set_fields[i].minimum_level) return false; } return true; } //1.) Search for: ch->SendGreetMessage(); //2.) Add after: if (!AllowedToWarp(ch->GetMapIndex(), ch->GetLevel())) ch->GoHome();
  5. Maybe could be used like this too, but the concept which i did for him was as unknown-reason for me. I know, but maybe for someone is useful and can take something from here.
  6. Yes, we can do this in server/client-side, but need some extra-checks for item attr/scokets + if exists in inventory. But have no sense to fix it since you don't want the players to do this. Why you don't disable the function chatGetLinkFromHyperlink from source client and python and showing just the tooltip when you put the mouse over the link, remove ALT+LEFT CLICK. root/game.py [Hidden Content] root/uiWhisper.py root/uiChat.py Srcs/Client/UserInterface/PythonChatModule.cpp Srcs/Client/UserInterface/PythonApplicationModule.cpp Srcs/Client/UserInterface/Locale_inc.h
  7. Try this. Search for: self.itemSlot = self.GetChild("item_slot") Add after: self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem)) self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) Search for: self.itemSlot.SetOverInItemEvent = lambda arg = vnum: self.OverInItem(arg) self.itemSlot.SetOverOutItemEvent = lambda arg = self.tooltipItem: self.OverOutItem(arg) Replace it with: # Clear the tooltip line. self.tooltipItem.ClearToolTip() # Insert the description of item. self.tooltipItem.SetInventoryItem(vnum) # Hide the tooltip line because after you insert a description, the ShowToolTip is called. self.tooltipItem.HideToolTip() Search for: def OverInItem(self, vnum): self.tooltipItem.SetInventoryItem(vnum) self.tooltipItem.Show() def OverOutItem(self, tooltip): self.tooltipItem.HideToolTip() self.tooltipItem.ClearToolTip() Replace it with: def OverInItem(self): if self.tooltipItem: self.tooltipItem.ShowToolTip() def OverOutItem(self): if self.tooltipItem: self.tooltipItem.HideToolTip()
  8. @Sonitex That's a ugly way, i'd rather something more clean. Src/Server/game/src/input_main.cpp [Hidden Content] Src/Server/common.h #define ENABLE_CHAT_SHOUT_LIMIT_HYPERLINK
  9. In your case WARP_SCROLLS is the index not the tuple or list that you are searching, because it is non-iterable type, you are getting this error. m2devList = [1000, 2000, 3000] for item in m2devList: print item >> 1000 >> 2000 >> 3000 You're attempting to check if 22010 is in itemVnum, which does not make sense. in smth operator expects an iterable object on the right side but you are providing an integer. Either use: #elif itemVnum in WARP_SCROLLS: elif itemVnum == WARP_SCROLLS: # do smth Or fix your problem, go in uiToolTip.py and replace: WARP_SCROLLS=22010 With: WARP_SCROLLS = (22010, )
  10. Thanks for report, i commited the fix and now works fine. [Hidden Content]
  11. Wrong arguments. -- pc_set_another_quest_flag pc.setf('channel_syserr','open', 999) -- pc_get_another_quest_flag local value = pc.getf("channel_syserr", "open")
  12. #ifdef ENABLE_EXTENDED_ALIGNMENT_SYSTEM const auto itor = g_TitleNameMap.find(iAlignmentGrade); #else std::map<int, std::string>::iterator itor = g_TitleNameMap.find(iAlignmentGrade); #endif
  13. Haha, i did it long time ago, now you make it public, danke sexy p3nger. ? I think i will post my full version, soon.
  14. I don't know why you need it, but have fun. How-To-Use: # General: chrmgr.GetPlayerID(vid) # Example: uiTarget.py import chat, chrmgr def SetTargetVID(self, vid): self.vid = vid chat.AppendChat(chat.CHAT_TYPE_INFO, 'SetTargetVID - vid({:d}), pid({:d})'.format(self.vid, chrmgr.GetPlayerID(self.vid))) Src/Client/UserInterface/InstanceBase.h //1.1) Search for: public: const TPixelPosition& NEW_GetDstPixelPositionRef(); //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT public: void SetPlayerID(const DWORD dwPID) { m_dwPlayerID = dwPID; } const DWORD GetPlayerID() { return m_dwPlayerID; } protected: DWORD m_dwPlayerID; #endif Src/Client/UserInterface/InstanceBase.cpp //1.1) Search for: SetVirtualID(c_rkCreateData.m_dwVID); //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT if (IsPC()) SetPlayerID(c_rkCreateData.m_dwPlayerID); #endif //2.1) Search for: m_dwEmoticonTime = 0; //2.2) Add after: #ifdef ENABLE_PID_TO_CLIENT m_dwPlayerID = 0; #endif Src/Client/UserInterface/PythonCharacterManagerModule.cpp //1.1) Search for: { "RegisterTitleColor", chrmgrRegisterTitleColor, METH_VARARGS }, //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT { "GetPlayerID", chrmgGetPID, METH_VARARGS }, #endif //2.1) Search for: { "RegisterTitleColor", chrmgrRegisterTitleColor, METH_VARARGS }, //2.2) Add after: #ifdef ENABLE_PID_TO_CLIENT PyObject * chrmgGetPID(PyObject* poSelf, PyObject* poArgs) { int nVID; if (!PyTuple_GetInteger(poArgs, 0, &nVID)) return Py_BadArgument(); CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance(); CInstanceBase * pkInstBase = rkChrMgr.GetInstancePtr(nVID); if (!pkInstBase) return Py_BuildValue("i", 0); return Py_BuildValue("i", (pkInstBase->IsPC()) ? pkInstBase->GetPlayerID() : 0); } #endif Src/Client/UserInterface/NetworkActorManager.cpp //1.1) Search for: CInstanceBase::SCreateData kCreateData; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT kCreateData.m_dwPlayerID=rkNetActorData.m_dwPlayerID; #endif //2.1) Search in SNetworkActorData::SNetworkActorData() for: m_dwVID=0; //2.2) Add after: #ifdef ENABLE_PID_TO_CLIENT m_dwPlayerID = 0; #endif //3.1) Search in void SNetworkActorData::__copy__(const SNetworkActorData& src) for: m_dwVID = src.m_dwVID; //3.2) Add after: #ifdef ENABLE_PID_TO_CLIENT m_dwPlayerID = src.m_dwPlayerID; #endif Src/Client/UserInterface/NetworkActorManager.h //1.1) Search for: DWORD m_dwVID; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT DWORD m_dwPlayerID; #endif Src/Client/UserInterface/PythonNetworkStreamPhaseGameActor.cpp //1.1) Search for: kNetActorData.m_stName = chrInfoPacket.name; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT kNetActorData.m_dwPlayerID = chrInfoPacket.dwPlayerID; #endif Src/Client/UserInterface/Packet.h //1.1) Search in packet_char_additional_info for: DWORD dwVID; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT DWORD dwPlayerID; #endif Src/Client/UserInterface/Locale_inc.h #define ENABLE_PID_TO_CLIENT ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ Src/Server/game/src/char.cpp //1.1) Search for: addPacket.bEmpire = m_bEmpire; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT addPacket.dwPlayerID = IsPC() ? GetPlayerID() : 0; #endif Src/Server/game/src/packet.h //1.1) Search in packet_char_additional_info for: DWORD dwVID; //1.2) Add after: #ifdef ENABLE_PID_TO_CLIENT DWORD dwPlayerID; #endif Src/Server/common/service.h #define ENABLE_PID_TO_CLIENT
  15. You can use: localeInfo.NumberToMoneyString def NumberToMoneyString(n) : if n <= 0 : return "0 %s" % (MONETARY_UNIT0) return "%s %s" % ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]), MONETARY_UNIT0) The current function return a value + MONETARY_UNIT0, you can split it and don't need any new function. print localeInfo.NumberToMoneyString(2147483647) #Result: 2.147.483.647 Yang print localeInfo.NumberToMoneyString(2147483647).split(' ')[0] #Result: 2.147.483.647 I don't know what structure you have in hpMobsList, but here's a example. maxHP = self.hpMobsList[chr.GetRace()] minHP = int(float(hpPercentage) / 100.00 * float(maxHP)) self.textHP.SetText("TP: {:s}/{:s}".format(localeInfo.NumberToMoneyString(minHP).split(' ')[0], localeInfo.NumberToMoneyString(int(maxHP)).split(' ')[0]))
  16. Try to replace: vnums = sorted(vnums) With: vnums.sort()
  17. M2 Download Center Download Here ( Internal ) Download Here ( GitHub ) Metin2 Color Formatter A simple class writted for Python and C++ which convert the param-values into an string by a specific color rgb as hexadecimals. Color constants module: [Hidden Content] [Hidden Content] Python: from cff import CFF text = CFF.format('Metin2', 'green') text = CFF.format(8000, 'banana') text = CFF.format(412.55, 'red') text = CFF.format('Pending', '#113355') text = CFF.format('Item name:', 'springgreen', CFF.FLAG_NEW_TAB) + CFF.format(item.GetItemName(), 'chocolate') text = CFF.multi_format(('a', 'b', 'c'), 'red') # text[0], text[1], text[2] C++: #include "cff.h" std::string text = CFF::format("Metin2", "green"); std::string text = CFF::format(std::to_string(8000), "banana"); std::string text = CFF::format(std::to_string(412.55), "red"); std::string text = CFF::format("Pending", "#113355"); std::string text = CFF::format("Item name:", "springgreen", CFF::FLAG_NEW_TAB) + CFF::format(pItemData->GetName(), "chocolate"); std::vector<string> text = CFF::multi_format({"a", "b", "c"}, "red"); // text[0], text[1], text[2] Github repository: [Hidden Content]
  18. [Hidden Content] - 07:38 [Hidden Content] - 07:45 (1.3) Spamming Do not spam in this board. Posting a topic or a question once is enough. If you don't get an answer maybe your question needs more description. Or nobody is able to help you there. Double post aswell as double threads will be punished with an infraction.
  19. Good idea, but you should return false if GetDesc is nullptr, not true. static const bool __FN_check_ip_ptr(const LPCHARACTER pkChr, const LPCHARACTER pkTargetChr) { if (!pkChr || !pkTargetChr) return false; const LPDESC pkDesc = pkChr->GetDesc(); const LPDESC pkTargetDesc = pkTargetChr->GetDesc(); if (!pkDesc || !pkTargetDesc) return false; const std::string & stIPAddress1 = pkDesc->GetHostName(); const std::string & stIPAddress2 = pkTargetDesc->GetHostName(); return (!stIPAddress1.compare(stIPAddress2)); } static const bool __FN_check_ip_str(const std::string & stIPAddress1, const std::string & stIPAddress2) { return (!stIPAddress1.compare(stIPAddress2)); } // const bool bIsSameIP = __FN_check_ip_ptr(ch, tch); // const bool bIsSameIP = __FN_check_ip_str(row[0], row[1]); It's a little bit useless if two guys play metin2 from same network connection, as @Chyu ^^ said. We can use HWID (Hardware Identification) for this detection, much better.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.