Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/08/18 in all areas

  1. Hi, In this thread I'm going to show you how to make a game-client or client-game communication with packets, instead of using the old quest-client, client-quest communication. Lets start with the game-client, in this example I will send 1 variable to the client. First start with the HEADER, open your binary source and navigate to UserInterface/Packet.h. Now you will see many headers, create a new one, but search for an empty number. I will use 57, because its not used. GC means it's used for Game -> Client packet, it's just a prefix. HEADER_GC_METIN2DEV Now add the structure for the packet, this is most important part. Structure is the "body" of the packet, it contains the HEADER as BYTE and the other optional variables. As I said I just want to send one int type to the client, so add it. typedef struct command_metin2dev_packet { BYTE bHeader; int M2int; } TPacketGCMetin2Dev; Now navigate to UserInterface/PythonNetworkStream.cpp and add your header to the CMainPacketHeaderMap class. The first parameter of the Set is the HEADER, second is the size of the structure. We will use just static size packets in this tutorial, but the third argument can be dynamic size too. Set(HEADER_GC_METIN2DEV, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCMetin2Dev), STATIC_SIZE_PACKET)); Now navigate to UserInterface/PythonNtworkStreamPhaseGame.cpp and add the function to the switch. case HEADER_GC_METIN2DEV: ret = RecvM2DevPacket(); break; The name of the function will be RecvM2DevPacket: Now declarate the function, navigate to UserInterface/PythonNetworkStream.h and add it as public: bool RecvM2DevPacket(); Now add the receiver part of the code. Recv "picks" out xy bytes from the buffer and the return type of it is false if there was no data in the buffer by that size otherwise true, which means it was successful. xy = size of the structure bool CPythonNetworkStream::RecvM2DevPacket() { TPacketGCMetin2Dev Metin2DevGC; if (!Recv(sizeof(TPacketGCMetin2Dev), &Metin2DevGC)) { Tracen("Recv Metin2DevGC Packet Error"); return false; } } Now we are calling the BINARY_M2DEV_Test function in game.py and passing the received data. PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_M2DEV_Test", Py_BuildValue("(i)", Metin2DevGC.M2int)); This was the client-side of the game-client communication, lets start the server-side: First of all we need to add the header again, navigate to game/packet.h and add this: And the structure: typedef struct packet_metin2dev_packet { BYTE byHeader; int M2int; } TPacketGCMetin2Dev; Now navigate to game/char.cpp and create a function which sends the packet. void CHARACTER::SendMetin2DevPacket() { } Declare it in the game/char.h: void SendMetin2DevPacket(); Now lets add the content of the function. Create a new instance of the structure, set the values of it and send it to the client. void CHARACTER::SendMetin2DevPacket() { if (!GetDesc()) { return; } TPacketGCMetin2Dev Metin2DevGC; Metin2DevGC.byHeader = HEADER_GC_METIN2DEV; Metin2DevGC.M2int = GetPlayerID(); GetDesc()->Packet(&Metin2DevGC, sizeof(TPacketGCMetin2Dev)); } Now add the last function to game.py, this will be called by the binary: def BINARY_M2DEV_Test(self, M2int): import dbg dbg.LogBox(str(M2int)) Finally, lets check how it works: If you have any question or suggestion, please just reply to this topic. Kind Regards, Sanchez
    1 point
  2. M2 Download Center Download Here ( Internal ) Hello Guys, 2 x 2 Map for ("Run, Level, Farm, PvP") SizeOfFile: 30.2 MB unpacked / 3.35 MB packed Download: [Hidden Content] Password: forevermetin2 Virustotal: [Hidden Content] Have fun,
    1 point
  3. Oh yeah I forgot for you guys it's dwType not bType
    1 point
  4. Ofc it crash when you call function GetVnum() through a null pointer bool CItem::IsExceptions(DWORD dwVnum) { switch (dwVnum) { case 30036: return true; break; } return false; } bool CItem::IsItemBox() { //LPITEM item; // why ? return (GetType() == ITEM_MATERIAL && !IsExceptions(GetVnum())); // Just call GetVnum() or like that: this->GetVnum() }
    1 point
  5. My question: "When i mount it shows the npc/mount but it dismounts the character right away. Any solutions?" #Edit1 So i have been looking around the code and found out that the costume mount was beeing called 2 times when used, "i guess", so i removed some lines in char_item.cpp Fix: char_item.cpp Search: if (COSTUME_MOUNT == item->GetSubType()) { quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false); } Replace with: /* if (COSTUME_MOUNT == item->GetSubType()) { quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false); } */ Make sure you have this line above: if (UNIQUE_SPECIAL_RIDE == item->GetSubType() && IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_USE)) { quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false); } I'm still testing it out so if there is any problem just reverse it all back. ~edit2 #EDIT2 Everything looks fine! #EDIT3 - Mount time fix for TXT DB rev40250 Fix: ride.quest Search item.get_socket(2)*60 Replace with: item.get_value(0)*60
    1 point
  6. //@root/introLoading.py //@Mr.Big Dick //1.) Search: self.loadingGage=self.GetChild("FullGage") //2.) Add bellow: self.loadingInfo = self.GetChild("LoadingInfo_Text") //3.) Search: self.loadingGage.SetPercentage(2+98*p/100, 100) //4.) Add bellow: self.loadingInfo.SetText("Loading: %s" % (self.txtLoadingProgressDict[p])) //5.) Search: self.errMsg.Hide() //6.) Add bellow: self.txtLoadingProgressDict = { 0: "InitData", 10: "Map", 30: "Sound", 40: "Effect", 50: "Warrior", 60: "Assasin", 70: "Sura", 80: "Shaman", 90: "Skill", 93: "Enemy", 97: "NPC", 98: "Guild Building", 100: "Start game" } //@locale/xx/loadingwindow.py //1.) Search: "name" : "FullGage", //2.) And add under this section: -> [Hidden Content] { "name" : "LoadingInfo_Text", "type" : "text", "x" : 190, "y" : -20, "fontname" : "Tahoma:19", "text" : "", "vertical_align" : "center", },
    1 point
  7. When adding items in mall disappear i need resolving in source please
    1 point
  8. this my syserr plz tell me on big problem in this syserr in this link : [Hidden Content] click on the اضغط هنا لتنزيل الملف to download files
    1 point
  9. thanks for reply my syserr 190 mega i have down core problem my core Sometimes crashed
    1 point
×
×
  • 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.