Jump to content

Discord Rich Presence


Recommended Posts

  • Premium
1 hour ago, Minton said:

VS2019, after i compiled the discordrpc.lib, this error occurs:

 

  Reveal hidden contents

90936385_572731853646751_298963834431864

 

The error occurs due to the fact that the libs were compiled with a older version of VS. follow Mali's tutorial and just do the same, it will work for sure.
Libs link: 

This is the hidden content, please

Quote

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 53
  • Facepalm 1
  • Dislove 1
  • Not Good 1
  • Cry 1
  • Think 1
  • Good 13
  • Love 6
  • Love 29

Engineer @ CNH Industrial

Link to comment
Share on other sites

13 hours ago, xAres said:

The error occurs due to the fact that the libs were compiled with a older version of VS. follow Mali's tutorial and just do the same, it will work for sure.
Libs link: 

This is the hidden content, please

 

Yes, i did the same thats why i wrote "after i compiled"....

  • Metin2 Dev 8
  • Good 3
  • Love 1
  • Love 5

System Administrator @ Hungarian Government
System Administrator @ Vibestro
Freelancer Developer @ Various projects

Link to comment
Share on other sites

  • Honorable Member
11 hours ago, r00t3r said:

I am shaman f on game and on discord it show M -> https://metin2.download/picture/3qai9R5r253qM8dMg4B0wnQst8WZOpSN/.png , is an problem for me or what ?

fixed

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hello i have this error: 
Error    2    error C2797: 'IoThreadHolder::keepRunning': list initialization inside member initializer list or non-static data member initializer is not implemented    c:\users\patri\desktop\pvm projekt\#clientsource\discord_rpc\discord_rpc.cpp    82    1    discord_rpc
 

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 2 months later...
  • 2 months later...
Severity Code Description Project File Line Hide Status Error C1047 '.. \ .. \ extern \ lib \ libjpeg-MT.lib' object or library file was created by a different version of the compiler than other objects such as '.. \ .. \ extern \ lib \ discord_rpc_r.lib'; Recompile all objects and libraries with the same compiler UserInterface

@Mali61

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...
  • Active Member

@MaliWould be really nice if you can add playerGetLevel() function instad of guild name next to the player name. I found some piece of code, but I don't know how to split player name with level.

Spoiler
#include "InstanceBase.h"
  
CInstanceBase* pkMainInstance = CPythonCharacterManager::Instance().GetMainInstancePtr();
char info[32 + 1];
snprintf(info, sizeof(info), "Lv. %u", pkMainInstance->GetLevel());

 

If you will have some free time to publish it, I'll be really glad as many others.

Thanks for possible answer!

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Honorable Member
11 hours ago, ReFresh said:

@MaliWould be really nice if you can add playerGetLevel() function instad of guild name next to the player name. I found some piece of code, but I don't know how to split player name with level.

https://metin2.download/picture/8SFLL19c83n64x9XVPS70Hq4j7Rx9emd/.png

73M4HTZ.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 8
  • Good 4
  • Love 4
  • Love 5

 

Link to comment
Share on other sites

  • Active Member

@Mali Thank you very much! And one more thing. Do you know some solution for diacritics? I mean letters diacritics worte in source code - letters like: "ěščřžýáíöóú". It would be nice too. But I don't know how hard it could be or if it's possible at all. I'm 100% sure, many people facing the same "issue".

 

@LethalStrikeR Just download and compile your libjpeg library with the same toolset as you compile your client.

Edited by ReFresh
  • Dislove 1

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 3 weeks later...

Maybe someone can make use of it:
 

spacer.png

 

Sourcechanges:

Spoiler


discord_rpc.h (in the rpc source & your extern folder)

// Search the struct and replace it

typedef struct DiscordRichPresence {
    const char* state;   /* max 128 bytes */
    const char* details; /* max 128 bytes */
    int64_t startTimestamp;
    int64_t endTimestamp;
    const char* largeImageKey;  /* max 32 bytes */
    const char* largeImageText; /* max 128 bytes */
    const char* smallImageKey;  /* max 32 bytes */
    const char* smallImageText; /* max 128 bytes */
    const char* partyId;        /* max 128 bytes */
    int partySize;
    int partyMax;
    const char* matchSecret;    /* max 128 bytes */
    const char* joinSecret;     /* max 128 bytes */
    const char* spectateSecret; /* max 128 bytes */
    const char* buttonLabel; /* max 128 bytes */
    const char* buttonURL; /* max 128 bytes */
    int8_t instance;
} DiscordRichPresence;

 

serialization.cpp (in the rpc source):

// Search:

                if ((presence->partyId && presence->partyId[0]) || presence->partySize ||
                    presence->partyMax) {

// Add ABOVE:

                if (presence->buttonLabel && presence->buttonLabel[0] && presence->buttonURL && presence->buttonURL[0]) {
                    WriteArray assets(writer, "buttons");
                    WriteObject btn1(writer);
                    WriteOptionalString(writer, "label", presence->buttonLabel);
                    WriteOptionalString(writer, "url", presence->buttonURL);
                }

 

In your client source you have to add it to the RPC update:
 

	discordPresence.buttonLabel = "Join Servername2's Discord";
	discordPresence.buttonURL = "https://discord.gg/ASDASDASDIASDASDAOPS";

	Discord_UpdatePresence(&discordPresence);


 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 2
  • Love 5
Link to comment
Share on other sites

  • 5 weeks later...

Announcements



×
×
  • 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.