Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] MUnique OpenMU ChatServer

Developer
Joined
Aug 6, 2005
Messages
545
Reaction score
292
It's not used further in this ChatServer... only relevant for OpenMU full server
 
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
310
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
310
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.
 
Developer
Joined
Aug 6, 2005
Messages
545
Reaction score
292
-.- 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);
        
}
That's code of the "Full" OpenMU Server. Believe me, you don't need these changes ;)
 
Elite Diviner
Joined
Aug 29, 2011
Messages
494
Reaction score
33
-.- 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();
//...
}

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?
 
Mythic Archon
Joined
Jun 12, 2005
Messages
744
Reaction score
68
I can install vs 2017 cause i use ssd 120 gigs and i am out of space. Is there any way someone rebuild chat server with ip 192.168.1.5?

this.publicIp = "192.168.1.5";
 
Last edited:
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
310


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:
Mythic Archon
Joined
Jun 12, 2005
Messages
744
Reaction score
68


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
jMNhtyP - [Release] MUnique OpenMU ChatServer - RaGEZONE Forums

and logs from chat server and dataserver

 
Developer
Joined
Aug 6, 2005
Messages
545
Reaction score
292
Can you find out where the Client tries to connect when you start a chat?

With netstat and/or wireshark, for example.
 
Experienced Elementalist
Joined
May 4, 2017
Messages
219
Reaction score
310
@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:
Elite Diviner
Joined
Aug 29, 2011
Messages
494
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

2018-04-03 20:09:42,099 [ERROR] [ExDbClient] - An error occured while processing an incoming packet from ExDB: C1 16 A1 00 02 00 54 65 63 4D 55 00 00 00 00 00 82 2E 03 00 01 00
System.ArgumentException: RegisterClient: Could not find chat room with id 512 for 'TecMU'.
Nome do parâmetro: roomId
em MUnique.OpenMU.ChatServer.ChatServerListener.RegisterClient(UInt16 roomId, String clientName) na C:\src\src\ChatServer\ChatServerListener.cs:linha 94
em MUnique.OpenMU.ChatServer.ExDbConnector.ExDbClient.ReadChatRoomInvitation(Byte[] packet) na C:\src\src\ChatServer\ExDbConnector\ExDbClient.cs:linha 144
em MUnique.OpenMU.ChatServer.ExDbConnector.ExDbClient.ExDbPacketReceived(Object sender, Byte[] packet) na C:\src\src\ChatServer\ExDbConnector\ExDbClient.cs:linha 116
 
Last edited:
Mythic Archon
Joined
Jun 12, 2005
Messages
744
Reaction score
68
@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);

This is really work!
Thank you!
 
Developer
Joined
Aug 6, 2005
Messages
545
Reaction score
292
Added release for version 0.1.7. Fixes:
- Public IP is not determined anymore, because it wasn't used
- Fixed reading the room id for invitation requests

Thanks for your feedback :)
 
Back
Top