Locale String Renewal

Metin2 general format specifiers have been added such as %d, %u, %s, %lu, %lld and %f. If you wish to add others, edit the table. Flags, precision and width parameters have not been implemented because they weren’t really used besides floating numbers which are always set to 2 decimals places precision. You can also use this as a template for quest strings, which have been moved to client side on official servers.

Chat function takes 3 main arguments:

  • Chat type,
  • String index,
  • String.

You can modify it’s structure to your likings. You can use the default structure which takes chat type and string as arguments and find index of the string in the function it self. Without string index, client will not be able to find the right string. Without string, server will not be able to find format specifiers and pull arguments to send them to client.

Old:

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Item Trade: %s, %s"), owner->GetName(), item->GetName());

New:

LocaleChatPacket(CHAT_TYPE_INFO, 449, "Item Trade: %s, %s", owner->GetName(), item->GetName());

// Or:

LocaleChatPacket(CHAT_TYPE_INFO, 449, "%s %s", owner->GetName(), item->GetName());

// Or:

enum ELocaleStrings
{
	ITEM_TRADE_%S_%S = 449,
};

LocaleChatPacket(CHAT_TYPE_INFO, ITEM_TRADE_%S_%S, "%s %s", owner->GetName(), item->GetName());
Download

2 comments

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s