Jump to content
Metin2 Network
Create New...
  • Download unlimited resources when you are a Premium Member, Buy now!

[C++] Change Maximum Length of Player Names - A Complete Guide with Python


xpro

Recommended Posts

  • Administrator

Hello, today, I'll present a complete guide on how to increase the length of character names. Simply changing the character limit isn't enough some interfaces need adjustments, such as the friend request window, the field for entering the player's nickname when sending a private message, and during character creation. When designing the interface, consider how many characters will be allowed to ensure that player names fit comfortably.

UserInterface/StdAfx.h

Find:

PLAYER_NAME_MAX_LEN = 12,

Change:

PLAYER_NAME_MAX_LEN = 24, // Specifies the maximum number of characters allowed for a player name.

game/src/input_login.cpp

Find:

void CInputLogin::CharacterCreate (LPDESC d, const char* data)

if (strlen (pinfo->name) > 12)
{
	d->Packet (&packFailure, sizeof (packFailure));
	return;
}

Change:

if (strlen (pinfo->name) > 24)
{
	d->Packet (&packFailure, sizeof (packFailure));
	return;
}

root/uiwhisper.py

Find:

def LoadDialog(self):

self.resizeButton.SetPosition(280, 180)

Change:

self.resizeButton.SetPosition(380, 180)

SQL Queries:

ALTER TABLE player MODIFY COLUMN name VARCHAR(24);
ALTER TABLE player_deleted MODIFY COLUMN name VARCHAR(24);

ALTER TABLE change_name MODIFY COLUMN old_name VARCHAR(24), MODIFY COLUMN new_name VARCHAR(24);
ALTER TABLE command_log MODIFY COLUMN username VARCHAR(24);
ALTER TABLE levellog MODIFY COLUMN name VARCHAR(24);


uiscript/whisperdialog.py

window = {
    "name": "WhisperDialog",
    "style": ("movable", "float",),

    "x": 0,
    "y": 0,

    "width": 450,
    "height": 200,

    "children":
    (
        {
            "name": "board",
            "type": "thinboard",
            "style": ("attach",),

            "x": 0,
            "y": 0,

            "width": 450,
            "height": 200,

            "children":
            (
                {
                    "name": "name_slot",
                    "type": "image",
                    "style": ("attach",),

                    "x": 10,
                    "y": 10,

                    "image": "d:/ymir work/ui/public/Parameter_Slot_06.sub",

                    "children":
                    (
                        {
                            "name": "titlename",
                            "type": "text",

                            "x": 3,
                            "y": 3,

                            "text": uiScriptLocale.WHISPER_NAME,
                        },
                        {
                            "name": "titlename_edit",
                            "type": "editline",

                            "x": 3,
                            "y": 3,

                            "width": 240,
                            "height": 17,

                            "input_limit": PLAYER_NAME_MAX_LEN,

                            "text": uiScriptLocale.WHISPER_NAME,
                        },
                    ),
                },

                {
                    "name": "gamemastermark",
                    "type": "expanded_image",
                    "style": ("attach",),

                    "x": 306,
                    "y": 6,

                    "x_scale": 0.2,
                    "y_scale": 0.2,

                    "image": LOCALE_PATH + "/effect/ymirred.tga",
                },
                {
                    "name": "ignorebutton",
                    "type": "toggle_button",

                    "x": 245,
                    "y": 10,

                    "text": uiScriptLocale.WHISPER_BAN,

                    "default_image": "d:/ymir work/ui/public/small_thin_button_01.sub",
                    "over_image": "d:/ymir work/ui/public/small_thin_button_02.sub",
                    "down_image": "d:/ymir work/ui/public/small_thin_button_03.sub",
                },
                {
                    "name": "reportviolentwhisperbutton",
                    "type": "button",

                    "x": 245,
                    "y": 10,

                    "text": uiScriptLocale.WHISPER_REPORT,

                    "default_image": "d:/ymir work/ui/public/large_button_01.sub",
                    "over_image": "d:/ymir work/ui/public/large_button_02.sub",
                    "down_image": "d:/ymir work/ui/public/large_button_03.sub",
                },
                {
                    "name": "acceptbutton",
                    "type": "button",

                    "x": 235,
                    "y": 9,

                    "text": uiScriptLocale.OK,

                    "default_image": "d:/ymir work/ui/public/small_thin_button_01.sub",
                    "over_image": "d:/ymir work/ui/public/small_thin_button_02.sub",
                    "down_image": "d:/ymir work/ui/public/small_thin_button_03.sub",
                },
                {
                    "name": "minimizebutton",
                    "type": "button",

                    "x": 380,
                    "y": 12,

                    "tooltip_text": uiScriptLocale.MINIMIZE,

                    "default_image": "d:/ymir work/ui/public/minimize_button_01.sub",
                    "over_image": "d:/ymir work/ui/public/minimize_button_02.sub",
                    "down_image": "d:/ymir work/ui/public/minimize_button_03.sub",
                },
                {
                    "name": "closebutton",
                    "type": "button",

                    "x": 406,
                    "y": 12,

                    "tooltip_text": uiScriptLocale.CLOSE,

                    "default_image": "d:/ymir work/ui/public/close_button_01.sub",
                    "over_image": "d:/ymir work/ui/public/close_button_02.sub",
                    "down_image": "d:/ymir work/ui/public/close_button_03.sub",
                },
                {
                    "name": "scrollbar",
                    "type": "thin_scrollbar",

                    "x": 406,
                    "y": 35,

                    "size": 120,
                },
                {
                    "name": "editbar",
                    "type": "bar",

                    "x": 10,
                    "y": 140,

                    "width": 420,
                    "height": 50,

                    "color": 0x77000000,

                    "children":
                    (
                        {
                            "name": "chatline",
                            "type": "editline",

                            "x": 5,
                            "y": 5,

                            "width": 350,
                            "height": 40,

                            "with_codepage": 1,
                            "input_limit": 40,
                            "limit_width": 350,
                            "multi_line": 1,
                        },
                        {
                            "name": "sendbutton",
                            "type": "button",

                            "x": 360,
                            "y": 10,

                            "text": uiScriptLocale.WHISPER_SEND,

                            "default_image": "d:/ymir work/ui/public/xlarge_thin_button_01.sub",
                            "over_image": "d:/ymir work/ui/public/xlarge_thin_button_02.sub",
                            "down_image": "d:/ymir work/ui/public/xlarge_thin_button_03.sub",
                        },
                    ),
                },
            ),
        },
    ),
}


uimessenger.py

Find

def OnPressAddFriendButton(self):

		friendNameBoard.SetTitle(localeInfo.MESSENGER_ADD_FRIEND)


Add after

		friendNameBoard.SetMaxLength(24)


uiscript/createcharacterwindow.py

Find:

"input_limit": 12,

Change:

"input_limit": 24,


Find:

				{
					"name": "character_name_slot",
					"type": "image",
					"x": 97,
					"y": 4,
					"image": "d:/ymir work/ui/public/parameter_slot_04.sub",
				},
 

Change:

				{
					"name": "character_name_slot",
					"type": "image",
					"x": 97,
					"y": 4,
					"image": "d:/ymir work/ui/public/parameter_slot_06.sub",
				},
Link to comment
Share on other sites

  • Bot

Thank you for the post xpro
Now we will take care that your topic reaches many people by adding tags

Forum Description : Metin2 Server Files, Server Files, Metin2 Private Servers, Metin2, Metin2 Systems, C++ and Python, Metin2 Home Pages, Metin2 Private Server, Metin2 Download, Metin2 Support, Metin2 Forum, Metin2 Pvp Servers, Errors, Bugs, Requests, Metin2 Pvp Forum, Everything About Metin2.

Tags:  #Metin2 Server Files, #Server Files, #Metin2 Private Servers, #Metin2, #Metin2 Systems, #C++ and Python, #Metin2 Home Pages, #Metin2 Private Server, #Metin2 Download, #Metin2 Support, #Metin2 Forum, #Metin2 Pvp Servers, #Errors, #Bugs, #Requests, #Metin2 Pvp #Forum .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Service

Write what you are looking for and press enter or click the search icon to begin your search