Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/11/16 in all areas

  1. 1 point
  2. looks like new dungeon system copied from League of Legends
    1 point
  3. Hi everyone, I forgot to wrote the Client-Game communication last week, but here it is now: First start again with the HEADER, the name of mine would be HEADER_CG_METIN2DEVORG. Navigate to UserInterface/Packet.h and add this: HEADER_CG_METIN2DEVORG = 58, I will send the VID of the player to the server with one int variable: typedef struct command_metin2dev_send_packet { BYTE byHeader; int data; } TPacketCGMetin2DevOrg; Now navigate to UserInterface/PythonNetworkStreamModule.cpp and add this: PyObject* netCallM2DevPacket(PyObject* poSelf, PyObject* poArgs) { int iData; if (!PyArg_ParseTuple(poArgs, "i", &iData)) { return Py_BuildException(); } if (iData < 0) { return Py_BuildNone(); } CPythonNetworkStream& rns = CPythonNetworkStream::Instance(); rns.SendMetin2DevOrgPacket(iData); return Py_BuildNone(); } Open UserInterface/PythonNetworkStream.h and search for this: bool RecvMallOpenPacket(); Add this over that: bool SendMetin2DevOrgPacket(int data); Open PythonNetworkStreamPhaseGame.cpp and the fill the content of the send function: bool CPythonNetworkStream::SendMetin2DevOrgPacket(int data) { TPacketCGMetin2DevOrg M2DevPacket; M2DevPacket.byHeader = HEADER_CG_METIN2DEVORG; M2DevPacket.data = data; if (!Send(sizeof(M2DevPacket), &M2DevPacket)) return false; return SendSequence(); } Now add the latest codes on the client side, navigate to UserInterface/PythonNetworkStreamModule.cpp and add this: // M2DEV { "SendM2DevPacket", netCallM2DevPacket, METH_VARARGS }, Lets continue with the server-side, first start again with the HEADER in game/packet.h: HEADER_CG_METIN2DEVORG = 58, And with the structure: typedef struct command_metin2dev_send_packet { BYTE byHeader; int data; } TPacketCGMetin2DevOrg; The first argument of Set is HEADER, second is the size of the structure, third is an optional string and the fourth is a boolean. Nearly the most important part of the function is the boolean, we can decide here, do we want to use sequence check? In this case I want, so set it to true. Open game/packet_info.cpp and add this to the CPacketInfoCG::CPacketInfoCG(): Set(HEADER_CG_METIN2DEVORG, sizeof(TPacketCGMetin2DevOrg), "Metin2Dev", true); Now navigate to game/input_main.cpp and add this to the switch at the end of the file: case HEADER_CG_METIN2DEVORG: Metin2DevReceivePacket(ch, c_pData); break; Create the function for the Metin2DevReceivePacket still in game/input_main.cpp: void CInputMain::Metin2DevReceivePacket(LPCHARACTER ch, const char* c_pData) { } Now add declaration of the Metin2DevReceivePacket to the CInputMain class in game/input.h: void Metin2DevReceivePacket(LPCHARACTER ch, const char* c_pData); Fill the content of the function: TPacketCGMetin2DevOrg* p = (TPacketCGMetin2DevOrg*)c_pData; sys_log(0, "PLAYER ID: %i", p->data); Thats all, now just make a simple button in the game to call this function: net.SendM2DevPacket(player.GetTargetVID()) Example: def Button1_Event(self): net.SendM2DevPacket(player.GetTargetVID()) Finally, check how it works: Kind Regards, Sanchez
    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.