Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/03/19 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. Here is your fix : EterLib/CRenderTarget.cpp [Hidden Content] Thanks to @Shang Can you share with me the type and subtype from your uitooltip
    1 point
  3. To make such a thing the best solution is to set your main board on self.Hide() After In class ToolTip after : parentWindow = self.GetParentProxy() if parentWindow: (gx, gy) = parentWindow.GetGlobalPosition() x -= gx y -= gy self.SetPosition(x, y) Add: try: if app.IsPressed(app.DIK_LCONTROL): if not self.vRenderTargetMain.IsShow(): self.vRenderTargetMain.Show() else: if self.vRenderTargetMain.IsShow(): self.vRenderTargetMain.Hide() except:pass Good idea about public
    1 point
  4. Hi i would like share with u guys how to add new mounts to attack and do dmg On game u will need find the pvp.cpp and find switch( pkChr->GetMountVnum() ) { case 0: Then above case 0: u should add the mount id u want like this exemple switch( pkChr->GetMountVnum() ) { case 0: case 19000: case 19001: case 19002: case 19003: Now client side u will need open the file InstanceBase.cpp and find UINT CInstanceBase::SHORSE::GetLevel() { if (m_pkActor) { DWORD mount = m_pkActor->GetRace(); switch (mount) { Then u will add all case and end with a return 3 like this UINT CInstanceBase::SHORSE::GetLevel() { if (m_pkActor) { DWORD mount = m_pkActor->GetRace(); switch (mount) { case 19001: case 19002: case 19003: return 3;
    1 point
  5. Hm.. I've rewritten the quest for your sake, personally the first thing i worry about when i write a quest is that if someone breaks into my server, i don't want them to look at my quests and think it has been a bonobo monkey to write them. (but no one ever breaks, really) [Hidden Content] It's untested but should work regardless.
    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.