defmodule Odinsea.Constants.Server do @moduledoc """ Server constants ported from Java ServerConstants. These define the MapleStory client version and protocol details. """ # MapleStory Client Version (MapleSEA v112.4) # Ported from ServerConstants.java @maple_version 112 @maple_patch "4" @maple_locale 7 @client_version 99 # Protocol constants @packet_header_size 4 @aes_key_size 32 @block_size 1460 # RSA Keys (from ServerConstants.java) # Default MapleStory RSA public key for password encryption @pub_key "30819F300D06092A864886F70D010101050003818D0030818902818100994F4E66B003A7843C944E67BE4375203DAA203C676908E59839C9BADE95F53E848AAFE61DB9C09E80F48675CA2696F4E897B7F18CCB6398D221C4EC5823D11CA1FB9764A78F84711B8B6FCA9F01B171A51EC66C02CDA9308887CEE8E59C4FF0B146BF71F697EB11EDCEBFCE02FB0101A7076A3FEB64F6F6022C8417EB6B87270203010001" @maplogin_default "MapLogin" @maplogin_custom "MapLoginLuna" # 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 MapleStory locale (region code). For SEA/MSEA this is 7. """ def maple_locale, do: @maple_locale @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