Hey. I've been working on the bald players problem for 2-3 days now. For those who don't know about the problem, one of the hairstyle for every race/gender combo doesn't show as it should on luclin models and we see a bald player instead of the selected hairstyle.
Here is what I found:
-There are two groups of race/gender combos that are affected by this problem. The race/genders that have 3 hairstyle selections and the race/genders that have 4 hairstyle selections.
ex:Human/Female: You can choose from 3 different hairstyles. (Values 0 or 1 or 2)
Human/Male: You can choose from 4 different hairstyles. (Values 255 or 0 or 1 or 2)
*Hairstyle 255 is the bald player model that you can choose on the character creation menu, only available for male characters and troll/ogre female characters.
-The problem we want to solve always happen with hairstyle "0".
-Instead of getting the value "0" when this is what the user pick on character creation, it somehow end up with the value "255". This is why we see a bald character when choosing hairstyle "0", it actually show hairstyle "255".
Note:
-The hairstyle 0 is correctly shown on the character selection screen.
-The hairstyle 0 is correctly shown after using /facepick, but after zoning or dying the bald player problem comes back.
-After selecting hairstyle 0 on character creation menu, the value "0" seems to be stored correctly in pp.hairstyle, but somehow gets lost along the way and is modified to "255".
-Could it be because we transfer a value between int, int8, uint8 and int32 variables?
Anyway, here is a way to fix the bug:
In client.cpp, on line 951, add:
Code:
//Temporary fix for missing hairstyle.
if (cc->hairstyle == 0)
{
pp.eyecolor1 = 99;
}
In titanium.ccp, replace line 470 with:
Code:
//Temporary fix for missing hairstyle.
if (emu->eyecolor1 == 99)
{
eq->hairstyle = 0;
eq->eyecolor1 = emu->eyecolor2;
}
else
{
eq->hairstyle = emu->hairstyle;
}
In client_packet.cpp, on line 4390, add:
Code:
//Temporary fix for missing hairstyle.
if (fc->hairstyle == 0)
{
m_pp.eyecolor1 = 99;
}
Basically, what it does is using the variable eyecolor1 to pass a flag value when hairstyle is equal to 0. Then, before the character is drawn, I set back eyecolor1 value using eyecolor2.
*Important: For the fix to work on an old character (if it's affected by the the bug), you have to do a /facepick in game to have it's hairstyle fixed. This only need to be done once.
*Any existing character can pick the new hair style with /facepick.
*New characters automatically have the bug fixed.
*The fix does not affect people who don't use luclin graphic since pre-luclin only uses the variable "face" and is not using the variable "hairstyle".
*If this ends up in the EqEmu code, I could also fix other appearance bugs, using different flag values in eyecolor1, that would only add 2-3 lines to the previous code.
**(An other appearance bug, for example, is when we select the haircolor 0 (ex.: dark brown for human male), we end up with haircolor 255 (ex.: white for human male)).
The best would be to find why the hairstyle value gets switched from "0" to "255". I really start to think it's an int, int8, int32, uint8 problem, but to be honest, I'm not very good with structs and pointers, so after many hours I was not able to find it. But meanwhile (or if no one feels like working on that), this fix solves the problem.