123 lines
2.3 KiB
Elixir
123 lines
2.3 KiB
Elixir
defmodule Odinsea.Constants.Server do
|
|
@moduledoc """
|
|
Server constants ported from Java ServerConstants.
|
|
These define the MapleStory client version and protocol details.
|
|
"""
|
|
|
|
# MapleStory Client Version (GMS v342)
|
|
@maple_version 342
|
|
@maple_patch "1"
|
|
@client_version 99
|
|
|
|
# Protocol constants
|
|
@packet_header_size 4
|
|
@aes_key_size 32
|
|
@block_size 1460
|
|
|
|
# RSA Keys (from ServerConstants.java)
|
|
@pub_key ""
|
|
@maplogin_default "default"
|
|
@maplogin_custom "custom"
|
|
|
|
# Packet sequence constants
|
|
@iv_length 4
|
|
@short_size 2
|
|
@int_size 4
|
|
@long_size 8
|
|
|
|
@doc """
|
|
Returns the MapleStory client version.
|
|
"""
|
|
def maple_version, do: @maple_version
|
|
|
|
@doc """
|
|
Returns the MapleStory patch version.
|
|
"""
|
|
def maple_patch, do: @maple_patch
|
|
|
|
@doc """
|
|
Returns the full client version string.
|
|
"""
|
|
def client_version, do: @client_version
|
|
|
|
@doc """
|
|
Returns the packet header size in bytes.
|
|
"""
|
|
def packet_header_size, do: @packet_header_size
|
|
|
|
@doc """
|
|
Returns the AES key size in bytes.
|
|
"""
|
|
def aes_key_size, do: @aes_key_size
|
|
|
|
@doc """
|
|
Returns the network block size.
|
|
"""
|
|
def block_size, do: @block_size
|
|
|
|
@doc """
|
|
Returns the RSA public key.
|
|
"""
|
|
def pub_key do
|
|
Application.get_env(:odinsea, :rsa_pub_key, @pub_key)
|
|
end
|
|
|
|
@doc """
|
|
Returns the default login background.
|
|
"""
|
|
def maplogin_default, do: @maplogin_default
|
|
|
|
@doc """
|
|
Returns the custom login background.
|
|
"""
|
|
def maplogin_custom, do: @maplogin_custom
|
|
|
|
@doc """
|
|
Returns the IV (initialization vector) length.
|
|
"""
|
|
def iv_length, do: @iv_length
|
|
|
|
@doc """
|
|
Returns the size of a short in bytes.
|
|
"""
|
|
def short_size, do: @short_size
|
|
|
|
@doc """
|
|
Returns the size of an int in bytes.
|
|
"""
|
|
def int_size, do: @int_size
|
|
|
|
@doc """
|
|
Returns the size of a long in bytes.
|
|
"""
|
|
def long_size, do: @long_size
|
|
|
|
@doc """
|
|
Returns server info from configuration.
|
|
"""
|
|
def server_info do
|
|
Application.get_env(:odinsea, :server, [])
|
|
end
|
|
|
|
@doc """
|
|
Returns the server name.
|
|
"""
|
|
def server_name do
|
|
server_info()[:name] || "Luna"
|
|
end
|
|
|
|
@doc """
|
|
Returns the server host.
|
|
"""
|
|
def server_host do
|
|
server_info()[:host] || "127.0.0.1"
|
|
end
|
|
|
|
@doc """
|
|
Returns the server revision.
|
|
"""
|
|
def server_revision do
|
|
server_info()[:revision] || 1
|
|
end
|
|
end
|