[Cleanup] Cleanup RandomizeFeatures() (#3958)

# Notes
- Uses pre-defined constants and cleanup code.
- Move `IsPlayerRace()` check so it's an early return instead of using an `else`.
This commit is contained in:
Alex King 2024-01-12 02:50:06 -05:00 committed by GitHub
parent ef635cb257
commit b61649a2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3663,25 +3663,23 @@ void Mob::SetFaceAppearance(const FaceChange_Struct& face, bool skip_sender)
bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables) bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
{ {
if (IsPlayerRace(GetRace())) { if (!IsPlayerRace(GetRace())) {
uint8 current_gender = GetGender(); return false;
uint8 new_texture = 0xFF; }
uint8 new_helm_texture = 0xFF;
uint8 new_hair_color = 0xFF;
uint8 new_beard_color = 0xFF;
uint8 new_eye_color_one = 0xFF;
uint8 new_eye_color_two = 0xFF;
uint8 new_hair_style = 0xFF;
uint8 new_luclin_face = 0xFF;
uint8 new_beard = 0xFF;
uint32 new_drakkin_heritage = 0xFFFFFFFF;
uint32 new_drakkin_tattoo = 0xFFFFFFFF;
uint32 new_drakkin_details = 0xFFFFFFFF;
// Set some common feature settings uint8 current_gender = GetGender();
new_eye_color_one = zone->random.Int(0, 9); uint8 new_texture = UINT8_MAX;
new_eye_color_two = zone->random.Int(0, 9); uint8 new_helm_texture = UINT8_MAX;
new_luclin_face = zone->random.Int(0, 7); uint8 new_hair_color = UINT8_MAX;
uint8 new_beard_color = UINT8_MAX;
uint8 new_eye_color_one = zone->random.Int(0, 9);
uint8 new_eye_color_two = zone->random.Int(0, 9);
uint8 new_hair_style = UINT8_MAX;
uint8 new_luclin_face = zone->random.Int(0, 7);
uint8 new_beard = UINT8_MAX;
uint32 new_drakkin_heritage = UINT32_MAX;
uint32 new_drakkin_tattoo = UINT32_MAX;
uint32 new_drakkin_details = UINT32_MAX;
// Adjust all settings based on the min and max for each feature of each race and gender // Adjust all settings based on the min and max for each feature of each race and gender
switch (GetRace()) { switch (GetRace()) {
@ -3885,8 +3883,6 @@ bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
} }
return true; return true;
}
return false;
} }
uint16 Mob::GetFactionRace() { uint16 Mob::GetFactionRace() {