Jump to content
  • 0

Change position for setunittitle and name centered


WhiteEagle

Question


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

Hey there~

I want to switch the order of the name and title, but after a few hours, I give up. So, it would be nice if you could help me out with my problem.
Here is my problem: When you use 'setunittitle', the title appears above the NPC name. As an example:

image.png.b2b25890e0f88239c3ccd31599a52b89.png

But I want the title beneath the name, like here:
image.png.aec626d4ff84b327e498b9dec3f3d703.png

"I know I could simply use the name in 'setunittitle' and change the NPC name to the title name,
but, well... that's not the intended use, is it?" 😄

In clif.cpp, the section where the name and title are defined is located:
void clif_name( struct block_list* src, struct block_list *bl, send_target target ){

                case BL_HOM:
		case BL_MER:
		case BL_PET:
		case BL_NPC:
		case BL_ELEM: {
			PACKET_ZC_ACK_REQNAMEALL_NPC packet = { 0 };

			packet.packet_id = HEADER_ZC_ACK_REQNAMEALL_NPC;
			packet.gid = bl->id;

			switch (bl->type) {
				case BL_HOM:
					memcpy(packet.name, ((TBL_HOM *)bl)->homunculus.name, NAME_LENGTH);
					break;
				case BL_MER:
					memcpy(packet.name, ((TBL_MER *)bl)->db->name.c_str(), NAME_LENGTH);
					break;
				case BL_PET:
					safestrncpy(packet.name, ((TBL_PET *)bl)->pet.name, NAME_LENGTH);
					break;
				case BL_NPC:
					safestrncpy(packet.name, ((TBL_NPC *)bl)->name, NAME_LENGTH);
					break;
				case BL_ELEM:
					safestrncpy(packet.name, ((TBL_ELEM *)bl)->db->name.c_str(), NAME_LENGTH);
					break;
			}

#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130
			unit_data *ud = unit_bl2ud(bl);

			if (ud != nullptr) {
				memcpy(packet.title, ud->title, NAME_LENGTH);
				packet.groupId = ud->group_id;
			}
#endif

			clif_send(&packet, sizeof(packet), src, target);
		}




The next consideration is whether it would be possible to add a function that centers the name beneath the title.
As you can observe, when the name is shorter than the title, it looks quite unappealing.


image.png.c52120e580f518449e30ba223d80a371.png



It would be a good change for rAthena, I think, as I am not the only one bothered by this and centering the name would be a generally positive modification.
I would greatly appreciate it if someone could provide me with the solution. Thank you.

  • Love 1
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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