Jump to content
View in the app

A better way to browse. Learn more.

Shaiya.gg

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Implementing Player Name Color Change on Client Side

Hello everyone,

 

First and foremost, I want to express my gratitude for this wonderful forum where we can share knowledge and seek assistance from fellow enthusiasts.

 

I have a question regarding implementing a feature on the client side of my project, and I'm hoping someone here might be able to offer some guidance.

 

I'm looking to modify the color of player names based on specific text contained within them. For instance, if a player's name includes "Shaiya," I want their name to appear in green. Similarly, if the name contains "Test," it should be displayed in orange.

 

I am particularly interested in achieving this on the client side only. I understand that altering the appearance of player names dynamically can enhance the user experience and add a layer of customization.

 

PS: I am using Essential files

Featured Replies

my answer requires this project.

 

https://github.com/kurtekat/shaiya-episode-6/tree/main/client/0x16021200

 

i set the detour here because it won't interfere with party, admin, or enemy name colors.

 

void hook::name_color()
{
   // user name color
   util::detour((void*)0x45381B, naked_0x45381B, 6);
}

 

the function return value (eax) should be copied to ebp (the argb value), unless the return value is null. i don't think you need to save/restore registers in this case. use your own judgement and edit the asm as needed.

 

unsigned u0x453821 = 0x453821;
void __declspec(naked) naked_0x45381B()
{
   __asm
   {
       push esi // user
       call func
       add esp,0x4
       test eax,eax

       je original
       mov ebp,eax

       original:
       cmp dword ptr ds:[0x22AA7F8],ebx
       jmp u0x453821
   }
}

 

i would use a map (aka dictionary) to store the text and colors. the function explains itself well enough. i'm not sure if case sensitivity matters to you. use google if it does. :p

 

#include <map>
#include <string>

#include <include/main.h>
#include <include/util.h>
#include <include/shaiya/include/CCharacter.h>
using namespace shaiya;

using Color = unsigned int;

const std::map<std::string, Color> text_to_color
{
   { "Shaiya", 0xFF00FF40 },
   { "Test", 0xFFFF8000 }
};

Color func(CCharacter* user)
{
   if (!user)
       return 0;

   std::string charName(user->charName.data());

   for (const auto& [text, color] : text_to_color)
       if (charName.contains(text))
           return color;

   return 0;
}

  • Author

Hello [mention=7]Bowie[/mention] , awesome work sir!

 

Yes, I will try to create an API for that and call it when the game starts to get the names and its colors.

 

Thanks a lot :)

Create an account or sign in to comment

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.