Jump to content
  • 0

How to reduce default 23 characters to 10 character only


xmaniacx

Question


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   1
  • Joined:  04/03/12
  • Last Seen:  

when creating a character you have to put name, i want it to be up to 10 only not 23, i wonder if you have to do it in source!! if so please teach me..... thank you in advanced

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  12/20/12
  • Last Seen:  

In src/common/mmo.h

search this

//For character names, title names, guilds, maps, etc.

//Includes null-terminator as it is the length of the array.

#define NAME_LENGTH (23 + 1)

:)

I think is there

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   1
  • Joined:  04/03/12
  • Last Seen:  

Thank you.....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

how about just reducing it to 10 on character creation, but would still allow up to 23 chars to allow the integration of some sort of titles via achievement system?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  12/20/12
  • Last Seen:  

Just set a new var, #define CREATE_NAME_LENGTH

In Src/char/char.c search this

int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style)

{

char name[NAME_LENGTH];

int i;

safestrncpy(name, name_, NAME_LENGTH);

normalize_name(name,TRIM_CHARS);

// check length of character name

if( name[0] == '\0' )

return -2; // empty character name

// check content of character name

if( remove_control_chars(name) )

return -2; // control chars in name

// check for reserved names

if( strcmpi(name, main_chat_nick) == 0 || strcmpi(name, wisp_server_name) == 0 || strcmpi(name, ally_chat_nick) == 0 )

return -1; // nick reserved for internal server messages

// Check Authorised letters/symbols in the name of the character

if( char_name_option == 1 ) { // only letters/symbols in char_name_letters are authorised

for( i = 0; i < NAME_LENGTH && name; i++ )

if( strchr(char_name_letters, name) == NULL )

return -2;

} else

if( char_name_option == 2 ) { // letters/symbols in char_name_letters are forbidden

for( i = 0; i < NAME_LENGTH && name; i++ )

if( strchr(char_name_letters, name) != NULL )

return -2;

} // else, all letters/symbols are authorised (except control char removed before)

// check name (already in use?)

ARR_FIND( 0, char_num, i,

(name_ignoring_case && strncmp(char_dat.status.name, name, NAME_LENGTH) == 0) ||

(!name_ignoring_case && strncmpi(char_dat.status.name, name, NAME_LENGTH) == 0) );

if( i < char_num )

return -1; // name already exists

//check other inputs

if((slot >= MAX_CHARS) // slots

|| (hair_style >= 24) // hair style

|| (hair_color >= 9) // hair color

|| (str + agi + vit + int_ + dex + luk != 6*5 ) // stats

|| (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values

|| (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs

return -2; // invalid input

// check char slot

ARR_FIND( 0, char_num, i, char_dat.status.account_id == sd->account_id && char_dat.status.slot == slot );

if( i < char_num )

return -2; // slot already in use

if (char_num >= char_max) {

char_max += 256;

RECREATE(char_dat, struct character_data, char_max);

if (!char_dat) {

ShowFatalError("Out of memory: make_new_char (realloc of char_dat).\n");

char_log("Out of memory: make_new_char (realloc of char_dat).\n");

exit(EXIT_FAILURE);

}

}

// validation success, log result

char_log("make new char: account: %d, slot %d, name: %s, stats: %d/%d/%d/%d/%d/%d, hair: %d, hair color: %d.\n",

sd->account_id, slot, name, str, agi, vit, int_, dex, luk, hair_style, hair_color);

i = char_num;

memset(&char_dat, 0, sizeof(struct character_data));

char_dat.status.char_id = char_id_count++;

char_dat.status.account_id = sd->account_id;

char_dat.status.slot = slot;

safestrncpy(char_dat.status.name,name,NAME_LENGTH);

char_dat.status.class_ = 0;

char_dat.status.base_level = 1;

char_dat.status.job_level = 1;

char_dat.status.base_exp = 0;

char_dat.status.job_exp = 0;

char_dat.status.zeny = start_zeny;

char_dat.status.str = str;

char_dat.status.agi = agi;

char_dat.status.vit = vit;

char_dat.status.int_ = int_;

char_dat.status.dex = dex;

char_dat.status.luk = luk;

char_dat.status.max_hp = 40 * (100 + char_dat.status.vit) / 100;

char_dat.status.max_sp = 11 * (100 + char_dat.status.int_) / 100;

char_dat.status.hp = char_dat.status.max_hp;

char_dat.status.sp = char_dat.status.max_sp;

char_dat.status.status_point = 0;

char_dat.status.skill_point = 0;

char_dat.status.option = 0;

char_dat.status.karma = 0;

char_dat.status.manner = 0;

char_dat.status.party_id = 0;

char_dat.status.guild_id = 0;

char_dat.status.hair = hair_style;

char_dat.status.hair_color = hair_color;

char_dat.status.clothes_color = 0;

char_dat.status.inventory[0].nameid = start_weapon; // Knife

char_dat.status.inventory[0].amount = 1;

char_dat.status.inventory[0].identify = 1;

char_dat.status.inventory[1].nameid = start_armor; // Cotton Shirt

char_dat.status.inventory[1].amount = 1;

char_dat.status.inventory[1].identify = 1;

char_dat.status.weapon = 0; // W_FIST

char_dat.status.shield = 0;

char_dat.status.head_top = 0;

char_dat.status.head_mid = 0;

char_dat.status.head_bottom = 0;

memcpy(&char_dat.status.last_point, &start_point, sizeof(start_point));

memcpy(&char_dat.status.save_point, &start_point, sizeof(start_point));

char_num++;

ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s\n", sd->account_id, i, slot, name);

mmo_char_sync();

return i;

}

Then change the variable, example

int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style)

{

char name[CREATE_NAME_LENGTH];

int i;

safestrncpy(name, name_, CREATE_NAME_LENGTH);

in all the function (cause it is only the create char function)

recomplire and.. i think this should work :S

If you have any error plz post and i helpyou n_n ~

Edited by aisha
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

oh. makes sense. I'll try it later as soon as I get to my files. thanks. /ok

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
Answer this question...

×   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...