[Release] MUnique OpenMU ChatServer

Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
318
It's not used further in this ChatServer... only relevant for OpenMU full server

-.- That string "publicIp" is used to pass to Player when ChatRoom created

Code:
public void ChatRoomCreated(ChatServerAuthenticationInfo authenticationInfo, string friendname, bool success)        
{
            var authenticationTokenArray = uint.Parse(authenticationInfo.AuthenticationToken).ToBytesSmallEndian();
            var chatRoomId = authenticationInfo.RoomId;
            var packet = new byte[]            {                0xC3, 0x24, 0xCA,                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // chat server ip (without port)
                chatRoomId.GetLowByte(), chatRoomId.GetHighByte(),
                authenticationTokenArray[3], authenticationTokenArray[2],
 authenticationTokenArray[1], authenticationTokenArray[0],
                0x01, // type
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // friendname                success ? (byte)1 : (byte)0
            };
            // chatserver unavailable would have success = 2, type = 0xAF
            [COLOR=#ff0000]var chatServerIp = this.friendServer.GetChatserverIP();
[/COLOR]            Encoding.ASCII.GetBytes(chatServerIp, 0, chatServerIp.Length, packet, 3);
            Encoding.UTF8.GetBytes(friendname, 0, friendname.Length, packet, 25);
            this.connection.Send(packet);
        
}

Adding WANIP to config file
ChatServer.ExDbConnector ChatServer.cfg
Code:
[COLOR=#ff0000]WANIP=192.168.xx.xx
[/COLOR]
ChatServerListenerPort=55980

ExDbHost=127.0.0.1
ExDbPort=55906Xor32

Key=AB 11 CD FE 18 23 C5 A3 CA 33 C1 CC 66 67 21 F3 32 12 15 35 29 FF FE 1D 44 EF CD 41 26 3C 4E 4D

ChatServer ChatServerListener.cs
Code:
//...
[COLOR=#ff0000]public string PublicIp { get; set; }
[/COLOR]private readonly string publicIp;
//...
this.publicIp = PublicIpResolver.GetIPv4().ToString();
//this.publicIp = "192.168.xxx.xxx";

ChatServer.ExDbConnector Setting.cs
Code:
internal class Settings
    {
//...
public string ChatServerWANIP
        {
            get
            {
                if (this["WANIP"] != null)
                {
                    var s = this["WANIP"];
                    var match = Regex.Match(s, @".*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*");
                    return match.Success ? s : null;
                }
                return null;
            }
        }
//...
}

ChatServer.ExDbConnector Program.cs
Code:
internal static void Main(string[] args)
{
//...               
        var chatServer = new ChatServerListener(chatServerListenerPort);
        [COLOR=#ff0000]//Get WANIP Config, If it's null. keep the IP retrieved from //https://api.ipify.org/?format=text
[/COLOR]        [COLOR=#ff0000]chatServer.PublicIp = settings.ChatServerWANIP ?? chatServer.PublicIp;
[/COLOR]        [COLOR=#ff0000]Log.Info($"WANIP = {chatServer.PublicIp}");
[/COLOR]        chatServer.Xor32Key = customXor32Key ?? chatServer.Xor32Key;                chatServer.Start();
//...
}
 
Last edited:
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
318
So there is no need to change
Change WANIP in config file ChatServer.cfg if you re-code like above. (keep PublicIpResolver.GetIPv4().ToString(); in case you are failed to retrieved WANIP from .cfg)... good for publishment

or just set this.publicIp ="xxx.xxx.xxx.xxx" manually. good if just only you use it.
 
Joined
Aug 6, 2005
Messages
552
Reaction score
298
That's code of the "Full" OpenMU Server. Believe me, you don't need these changes
 
Joined
Aug 29, 2011
Messages
512
Reaction score
33

That's code of the "Full" OpenMU Server. Believe me, you don't need these changes



he managed to make it work.
I'm using the default and I can not make it work.
solarismu
Could you post the configuration files of your dataserver and the chatserver?
 
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
318


remember edit:
WANIP in CharServer.cfg & WANIP in DataServer\IGCDS.ini
ExDbPort in CharServer & ExDataServerPort in DataServer\IGCDS.ini

Ps: if it works, let me know ty
 
Last edited:
Joined
Jun 12, 2005
Messages
746
Reaction score
69


remember edit:
WANIP in CharServer.cfg & WANIP in DataServer\IGCDS.ini
ExDbPort in CharServer & ExDataServerPort in DataServer\IGCDS.ini

Ps: if it works, let me know ty

Thank you my friend but nothing.
Here is an image

and logs from chat server and dataserver

 

Attachments

You must be registered for see attachments list
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
318
@or30n
I've checked ADMTec Files...

You also have to check ServerInfo.bmd chatport
Or in IGCDLL source > ServerInfo.cpp
Code:
m_ChatServerPort = GetPrivateProfileIntA("Connection", "ChatPort", 55980, filedec);
set it to 55980 for sure, like this.
Code:
m_ChatServerPort = 55980;
//m_ChatServerPort = GetPrivateProfileIntA("Connection", "ChatPort", 55980, filedec);
 
Last edited:
Joined
Aug 29, 2011
Messages
512
Reaction score
33
@solarismu

Can you find out where the Client tries to connect when you start a chat?

With netstat and/or wireshark, for example.


I'm having an error when I'm going to invite another player to chat

 
Last edited:
Joined
Jun 12, 2005
Messages
746
Reaction score
69

This is really work!
Thank you!