mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 08:21:28 +00:00
[Commands] Cleanup #randomizefeatures Command. (#2118)
- Cleanup messages and logic. - Make #randomizefeatures function for Iksar and Vah Shir.
This commit is contained in:
parent
2f962c2c8a
commit
6e15fae6a0
@ -2,17 +2,33 @@
|
|||||||
|
|
||||||
void command_randomfeatures(Client *c, const Seperator *sep)
|
void command_randomfeatures(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
Mob *target = c->GetTarget();
|
if (!c->GetTarget()) {
|
||||||
if (!target) {
|
c->Message(Chat::White, "You must have a target to use this command.");
|
||||||
c->Message(Chat::White, "Error: This command requires a target");
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (target->RandomizeFeatures()) {
|
auto target = c->GetTarget();
|
||||||
c->Message(Chat::White, "Features Randomized");
|
|
||||||
}
|
if (target->RandomizeFeatures()) {
|
||||||
else {
|
c->Message(
|
||||||
c->Message(Chat::White, "This command requires a Playable Race as the target");
|
Chat::White,
|
||||||
}
|
fmt::format(
|
||||||
|
"{} ({}) has had their features randomized.",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} ({}) is not a player race, their race is {} ({}).",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID(),
|
||||||
|
GetRaceIDName(target->GetRace()),
|
||||||
|
target->GetRace()
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
392
zone/mob.cpp
392
zone/mob.cpp
@ -2609,194 +2609,223 @@ void Mob::SendIllusionPacket(
|
|||||||
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 Gender = GetGender();
|
uint8 current_gender = GetGender();
|
||||||
uint8 Texture = 0xFF;
|
uint8 new_texture = 0xFF;
|
||||||
uint8 HelmTexture = 0xFF;
|
uint8 new_helm_texture = 0xFF;
|
||||||
uint8 HairColor = 0xFF;
|
uint8 new_hair_color = 0xFF;
|
||||||
uint8 BeardColor = 0xFF;
|
uint8 new_beard_color = 0xFF;
|
||||||
uint8 EyeColor1 = 0xFF;
|
uint8 new_eye_color_one = 0xFF;
|
||||||
uint8 EyeColor2 = 0xFF;
|
uint8 new_eye_color_two = 0xFF;
|
||||||
uint8 HairStyle = 0xFF;
|
uint8 new_hair_style = 0xFF;
|
||||||
uint8 LuclinFace = 0xFF;
|
uint8 new_luclin_face = 0xFF;
|
||||||
uint8 Beard = 0xFF;
|
uint8 new_beard = 0xFF;
|
||||||
uint32 DrakkinHeritage = 0xFFFFFFFF;
|
uint32 new_drakkin_heritage = 0xFFFFFFFF;
|
||||||
uint32 DrakkinTattoo = 0xFFFFFFFF;
|
uint32 new_drakkin_tattoo = 0xFFFFFFFF;
|
||||||
uint32 DrakkinDetails = 0xFFFFFFFF;
|
uint32 new_drakkin_details = 0xFFFFFFFF;
|
||||||
|
|
||||||
// Set some common feature settings
|
// Set some common feature settings
|
||||||
EyeColor1 = zone->random.Int(0, 9);
|
new_eye_color_one = zone->random.Int(0, 9);
|
||||||
EyeColor2 = zone->random.Int(0, 9);
|
new_eye_color_two = zone->random.Int(0, 9);
|
||||||
LuclinFace = zone->random.Int(0, 7);
|
new_luclin_face = zone->random.Int(0, 7);
|
||||||
|
|
||||||
// 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()) {
|
||||||
case HUMAN:
|
case HUMAN:
|
||||||
HairColor = zone->random.Int(0, 19);
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
if (Gender == MALE) {
|
|
||||||
BeardColor = HairColor;
|
if (current_gender == MALE) {
|
||||||
HairStyle = zone->random.Int(0, 3);
|
new_beard_color = new_hair_color;
|
||||||
Beard = zone->random.Int(0, 5);
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
}
|
new_beard = zone->random.Int(0, 5);
|
||||||
if (Gender == FEMALE) {
|
} else if (current_gender == FEMALE) {
|
||||||
HairStyle = zone->random.Int(0, 2);
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case BARBARIAN:
|
break;
|
||||||
HairColor = zone->random.Int(0, 19);
|
case BARBARIAN:
|
||||||
LuclinFace = zone->random.Int(0, 87);
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
if (Gender == MALE) {
|
new_luclin_face = zone->random.Int(0, 87);
|
||||||
BeardColor = HairColor;
|
|
||||||
HairStyle = zone->random.Int(0, 3);
|
if (current_gender == MALE) {
|
||||||
Beard = zone->random.Int(0, 5);
|
new_beard_color = new_hair_color;
|
||||||
}
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
if (Gender == FEMALE) {
|
new_beard = zone->random.Int(0, 5);
|
||||||
HairStyle = zone->random.Int(0, 2);
|
} else if (current_gender == FEMALE) {
|
||||||
}
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
break;
|
}
|
||||||
case ERUDITE:
|
|
||||||
if (Gender == MALE) {
|
break;
|
||||||
BeardColor = zone->random.Int(0, 19);
|
case ERUDITE:
|
||||||
Beard = zone->random.Int(0, 5);
|
if (current_gender == MALE) {
|
||||||
LuclinFace = zone->random.Int(0, 57);
|
new_beard_color = zone->random.Int(0, 19);
|
||||||
}
|
new_beard = zone->random.Int(0, 5);
|
||||||
if (Gender == FEMALE) {
|
new_luclin_face = zone->random.Int(0, 57);
|
||||||
LuclinFace = zone->random.Int(0, 87);
|
} else if (current_gender == FEMALE) {
|
||||||
}
|
new_luclin_face = zone->random.Int(0, 87);
|
||||||
break;
|
}
|
||||||
case WOOD_ELF:
|
|
||||||
HairColor = zone->random.Int(0, 19);
|
break;
|
||||||
if (Gender == MALE) {
|
case WOOD_ELF:
|
||||||
HairStyle = zone->random.Int(0, 3);
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
}
|
|
||||||
if (Gender == FEMALE) {
|
if (current_gender == MALE) {
|
||||||
HairStyle = zone->random.Int(0, 2);
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
}
|
} else if (current_gender == FEMALE) {
|
||||||
break;
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
case HIGH_ELF:
|
}
|
||||||
HairColor = zone->random.Int(0, 14);
|
|
||||||
if (Gender == MALE) {
|
break;
|
||||||
HairStyle = zone->random.Int(0, 3);
|
case HIGH_ELF:
|
||||||
LuclinFace = zone->random.Int(0, 37);
|
new_hair_color = zone->random.Int(0, 14);
|
||||||
BeardColor = HairColor;
|
|
||||||
}
|
if (current_gender == MALE) {
|
||||||
if (Gender == FEMALE) {
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
HairStyle = zone->random.Int(0, 2);
|
new_luclin_face = zone->random.Int(0, 37);
|
||||||
}
|
new_beard_color = new_hair_color;
|
||||||
break;
|
} else if (current_gender == FEMALE) {
|
||||||
case DARK_ELF:
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
HairColor = zone->random.Int(13, 18);
|
}
|
||||||
if (Gender == MALE) {
|
|
||||||
HairStyle = zone->random.Int(0, 3);
|
break;
|
||||||
LuclinFace = zone->random.Int(0, 37);
|
case DARK_ELF:
|
||||||
BeardColor = HairColor;
|
new_hair_color = zone->random.Int(13, 18);
|
||||||
}
|
|
||||||
if (Gender == FEMALE) {
|
if (current_gender == MALE) {
|
||||||
HairStyle = zone->random.Int(0, 2);
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
}
|
new_luclin_face = zone->random.Int(0, 37);
|
||||||
break;
|
new_beard_color = new_hair_color;
|
||||||
case HALF_ELF:
|
} else if (current_gender == FEMALE) {
|
||||||
HairColor = zone->random.Int(0, 19);
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
if (Gender == MALE) {
|
}
|
||||||
HairStyle = zone->random.Int(0, 3);
|
|
||||||
LuclinFace = zone->random.Int(0, 37);
|
break;
|
||||||
BeardColor = HairColor;
|
case HALF_ELF:
|
||||||
}
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
if (Gender == FEMALE) {
|
|
||||||
HairStyle = zone->random.Int(0, 2);
|
if (current_gender == MALE) {
|
||||||
}
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
break;
|
new_luclin_face = zone->random.Int(0, 37);
|
||||||
case DWARF:
|
new_beard_color = new_hair_color;
|
||||||
HairColor = zone->random.Int(0, 19);
|
} else if (current_gender == FEMALE) {
|
||||||
BeardColor = HairColor;
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
if (Gender == MALE) {
|
}
|
||||||
HairStyle = zone->random.Int(0, 3);
|
|
||||||
Beard = zone->random.Int(0, 5);
|
break;
|
||||||
}
|
case DWARF:
|
||||||
if (Gender == FEMALE) {
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
HairStyle = zone->random.Int(0, 2);
|
new_beard_color = new_hair_color;
|
||||||
LuclinFace = zone->random.Int(0, 17);
|
|
||||||
}
|
if (current_gender == MALE) {
|
||||||
break;
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
case TROLL:
|
new_beard = zone->random.Int(0, 5);
|
||||||
EyeColor1 = zone->random.Int(0, 10);
|
} else if (current_gender == FEMALE) {
|
||||||
EyeColor2 = zone->random.Int(0, 10);
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
if (Gender == FEMALE) {
|
new_luclin_face = zone->random.Int(0, 17);
|
||||||
HairStyle = zone->random.Int(0, 3);
|
}
|
||||||
HairColor = zone->random.Int(0, 23);
|
|
||||||
}
|
break;
|
||||||
break;
|
case TROLL:
|
||||||
case OGRE:
|
new_eye_color_one = zone->random.Int(0, 10);
|
||||||
if (Gender == FEMALE) {
|
new_eye_color_two = zone->random.Int(0, 10);
|
||||||
HairStyle = zone->random.Int(0, 3);
|
|
||||||
HairColor = zone->random.Int(0, 23);
|
if (current_gender == FEMALE) {
|
||||||
}
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
break;
|
new_hair_color = zone->random.Int(0, 23);
|
||||||
case HALFLING:
|
}
|
||||||
HairColor = zone->random.Int(0, 19);
|
|
||||||
if (Gender == MALE) {
|
break;
|
||||||
BeardColor = HairColor;
|
case OGRE:
|
||||||
HairStyle = zone->random.Int(0, 3);
|
if (current_gender == FEMALE) {
|
||||||
Beard = zone->random.Int(0, 5);
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
}
|
new_hair_color = zone->random.Int(0, 23);
|
||||||
if (Gender == FEMALE) {
|
}
|
||||||
HairStyle = zone->random.Int(0, 2);
|
|
||||||
}
|
break;
|
||||||
break;
|
case HALFLING:
|
||||||
case GNOME:
|
new_hair_color = zone->random.Int(0, 19);
|
||||||
HairColor = zone->random.Int(0, 24);
|
|
||||||
if (Gender == MALE) {
|
if (current_gender == MALE) {
|
||||||
BeardColor = HairColor;
|
new_beard_color = new_hair_color;
|
||||||
HairStyle = zone->random.Int(0, 3);
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
Beard = zone->random.Int(0, 5);
|
new_beard = zone->random.Int(0, 5);
|
||||||
}
|
} else if (current_gender == FEMALE) {
|
||||||
if (Gender == FEMALE) {
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
HairStyle = zone->random.Int(0, 2);
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case IKSAR:
|
case GNOME:
|
||||||
case VAHSHIR:
|
new_hair_color = zone->random.Int(0, 24);
|
||||||
break;
|
|
||||||
case FROGLOK:
|
if (current_gender == MALE) {
|
||||||
LuclinFace = zone->random.Int(0, 9);
|
new_beard_color = new_hair_color;
|
||||||
case DRAKKIN:
|
new_hair_style = zone->random.Int(0, 3);
|
||||||
HairColor = zone->random.Int(0, 3);
|
new_beard = zone->random.Int(0, 5);
|
||||||
BeardColor = HairColor;
|
} else if (current_gender == FEMALE) {
|
||||||
EyeColor1 = zone->random.Int(0, 11);
|
new_hair_style = zone->random.Int(0, 2);
|
||||||
EyeColor2 = zone->random.Int(0, 11);
|
}
|
||||||
LuclinFace = zone->random.Int(0, 6);
|
|
||||||
DrakkinHeritage = zone->random.Int(0, 6);
|
break;
|
||||||
DrakkinTattoo = zone->random.Int(0, 7);
|
case IKSAR:
|
||||||
DrakkinDetails = zone->random.Int(0, 7);
|
case VAHSHIR:
|
||||||
if (Gender == MALE) {
|
new_luclin_face = zone->random.Int(0, 7);
|
||||||
Beard = zone->random.Int(0, 12);
|
break;
|
||||||
HairStyle = zone->random.Int(0, 8);
|
case FROGLOK:
|
||||||
}
|
new_luclin_face = zone->random.Int(0, 9);
|
||||||
if (Gender == FEMALE) {
|
break;
|
||||||
Beard = zone->random.Int(0, 3);
|
case DRAKKIN:
|
||||||
HairStyle = zone->random.Int(0, 7);
|
new_hair_color = zone->random.Int(0, 3);
|
||||||
}
|
new_beard_color = new_hair_color;
|
||||||
break;
|
new_eye_color_one = zone->random.Int(0, 11);
|
||||||
default:
|
new_eye_color_two = zone->random.Int(0, 11);
|
||||||
break;
|
new_luclin_face = zone->random.Int(0, 6);
|
||||||
|
new_drakkin_heritage = zone->random.Int(0, 6);
|
||||||
|
new_drakkin_tattoo = zone->random.Int(0, 7);
|
||||||
|
new_drakkin_details = zone->random.Int(0, 7);
|
||||||
|
|
||||||
|
if (current_gender == MALE) {
|
||||||
|
new_beard = zone->random.Int(0, 12);
|
||||||
|
new_hair_style = zone->random.Int(0, 8);
|
||||||
|
} else if (current_gender == FEMALE) {
|
||||||
|
new_beard = zone->random.Int(0, 3);
|
||||||
|
new_hair_style = zone->random.Int(0, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_variables) {
|
if (set_variables) {
|
||||||
haircolor = HairColor;
|
haircolor = new_hair_color;
|
||||||
beardcolor = BeardColor;
|
beardcolor = new_beard_color;
|
||||||
eyecolor1 = EyeColor1;
|
eyecolor1 = new_eye_color_one;
|
||||||
eyecolor2 = EyeColor2;
|
eyecolor2 = new_eye_color_two;
|
||||||
hairstyle = HairStyle;
|
hairstyle = new_hair_style;
|
||||||
luclinface = LuclinFace;
|
luclinface = new_luclin_face;
|
||||||
beard = Beard;
|
beard = new_beard;
|
||||||
drakkin_heritage = DrakkinHeritage;
|
drakkin_heritage = new_drakkin_heritage;
|
||||||
drakkin_tattoo = DrakkinTattoo;
|
drakkin_tattoo = new_drakkin_tattoo;
|
||||||
drakkin_details = DrakkinDetails;
|
drakkin_details = new_drakkin_details;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send_illusion) {
|
if (send_illusion) {
|
||||||
SendIllusionPacket(GetRace(), Gender, Texture, HelmTexture, HairColor, BeardColor,
|
SendIllusionPacket(
|
||||||
EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF, DrakkinHeritage,
|
GetRace(),
|
||||||
DrakkinTattoo, DrakkinDetails);
|
current_gender,
|
||||||
|
new_texture,
|
||||||
|
new_helm_texture,
|
||||||
|
new_hair_color,
|
||||||
|
new_beard_color,
|
||||||
|
new_eye_color_one,
|
||||||
|
new_eye_color_two,
|
||||||
|
new_hair_style,
|
||||||
|
new_luclin_face,
|
||||||
|
new_beard,
|
||||||
|
0xFF,
|
||||||
|
new_drakkin_heritage,
|
||||||
|
new_drakkin_tattoo,
|
||||||
|
new_drakkin_details
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2807,8 +2836,13 @@ bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
|
|||||||
|
|
||||||
bool Mob::IsPlayerRace(uint16 in_race) {
|
bool Mob::IsPlayerRace(uint16 in_race) {
|
||||||
|
|
||||||
if ((in_race >= HUMAN && in_race <= GNOME) || in_race == IKSAR || in_race == VAHSHIR || in_race == FROGLOK || in_race == DRAKKIN)
|
if (
|
||||||
{
|
(in_race >= HUMAN && in_race <= GNOME) ||
|
||||||
|
in_race == IKSAR ||
|
||||||
|
in_race == VAHSHIR ||
|
||||||
|
in_race == FROGLOK ||
|
||||||
|
in_race == DRAKKIN
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user