[Bug Fix] Fix Appearance Issues (#3520)

* [Bug Fix] Fix Appearance Issues

# Notes
- Changing race, gender, or texture of a Mob could result in it changing sizes due to use not sending the size as part of the appearance packet.
- Also converts the parameterized method to a struct parameter so that we can optionally send things without back-filling multiple arguments.

* Gender cleanup.

* Fix.

* Formatting.
This commit is contained in:
Alex King 2023-07-31 21:15:13 -04:00 committed by GitHub
parent 6cff433d23
commit fb20d92166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 963 additions and 592 deletions

View File

@ -1594,11 +1594,13 @@ float GetRaceGenderDefaultHeight(int race, int gender)
const auto size = sizeof(male_height) / sizeof(male_height[0]);
if (race >= size)
if (race >= size) {
return 6.0f;
}
if (gender == 1)
if (gender == FEMALE) {
return female_height[race];
}
return male_height[race];
}

View File

@ -268,26 +268,48 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
case SE_IllusionCopy:
case SE_Illusion: {
if (spell.base_value[x1] == -1) {
if (gender == 1)
gender = 0;
else if (gender == 0)
gender = 1;
SendIllusionPacket(GetRace(), gender, 0xFF, 0xFF);
}
else if (spell.base_value[x1] == -2) // WTF IS THIS
if (gender == FEMALE) {
gender = MALE;
} else if (gender == MALE) {
gender = FEMALE;
}
SendIllusionPacket(
AppearanceStruct{
.gender_id = gender,
.race_id = GetRace(),
}
);
} else if (spell.base_value[x1] == -2) // WTF IS THIS
{
if (GetRace() == IKSAR || GetRace() == VAHSHIR || GetRace() <= GNOME) {
SendIllusionPacket(GetRace(), GetGender(), spell.limit_value[x1], spell.max_value[x1]);
SendIllusionPacket(
AppearanceStruct{
.gender_id = GetGender(),
.helmet_texture = static_cast<uint8>(spell.max_value[x1]),
.race_id = GetRace(),
.texture = static_cast<uint8>(spell.limit_value[x1]),
}
);
}
} else if (spell.max_value[x1] > 0) {
SendIllusionPacket(
AppearanceStruct{
.helmet_texture = static_cast<uint8>(spell.max_value[x1]),
.race_id = static_cast<uint16>(spell.base_value[x1]),
.texture = static_cast<uint8>(spell.limit_value[x1]),
}
);
} else {
SendIllusionPacket(
AppearanceStruct{
.helmet_texture = static_cast<uint8>(spell.max_value[x1]),
.race_id = static_cast<uint16>(spell.base_value[x1]),
.texture = static_cast<uint8>(spell.limit_value[x1]),
}
);
}
else if (spell.max_value[x1] > 0)
{
SendIllusionPacket(spell.base_value[x1], 0xFF, spell.limit_value[x1], spell.max_value[x1]);
}
else
{
SendIllusionPacket(spell.base_value[x1], 0xFF, 0xFF, 0xFF);
}
switch (spell.base_value[x1]) {
case OGRE:
SendAppearancePacket(AT_Size, 9);

View File

@ -63,6 +63,7 @@
#include "water_map.h"
#include "worldserver.h"
#include "dialogue_window.h"
#include "mob.h"
#include <fmt/format.h>
@ -8819,26 +8820,28 @@ void helper_bot_appearance_form_final(Client *bot_owner, Bot *my_bot)
void helper_bot_appearance_form_update(Bot *my_bot)
{
if (!my_bot)
if (!my_bot) {
return;
}
my_bot->SendIllusionPacket(
my_bot->GetRace(),
my_bot->GetGender(),
0xFF, //my_bot->GetTexture(), // 0xFF - change back if issues arise
0xFF, //my_bot->GetHelmTexture(), // 0xFF - change back if issues arise
my_bot->GetHairColor(),
my_bot->GetBeardColor(),
my_bot->GetEyeColor1(),
my_bot->GetEyeColor2(),
my_bot->GetHairStyle(),
my_bot->GetLuclinFace(),
my_bot->GetBeard(),
0xFF, // aa_title (0xFF)
my_bot->GetDrakkinHeritage(),
my_bot->GetDrakkinTattoo(),
my_bot->GetDrakkinDetails(),
my_bot->GetSize()
AppearanceStruct{
.beard = my_bot->GetBeard(),
.beard_color = my_bot->GetBeardColor(),
.drakkin_details = my_bot->GetDrakkinDetails(),
.drakkin_heritage = my_bot->GetDrakkinHeritage(),
.drakkin_tattoo = my_bot->GetDrakkinTattoo(),
.eye_color_one = my_bot->GetEyeColor1(),
.eye_color_two = my_bot->GetEyeColor2(),
.face = my_bot->GetLuclinFace(),
.gender_id = my_bot->GetGender(),
.hair = my_bot->GetHairStyle(),
.hair_color = my_bot->GetHairColor(),
.helmet_texture = my_bot->GetHelmTexture(),
.race_id = my_bot->GetRace(),
.size = my_bot->GetSize(),
.texture = my_bot->GetTexture(),
}
);
}
@ -10002,7 +10005,7 @@ void bot_command_pickpocket(Client *c, const Seperator *sep)
if (helper_command_disabled(c, RuleB(Bots, AllowPickpocketCommand), "pickpocket")) {
return;
}
if (helper_command_alias_fail(c, "bot_command_pickpocket", sep->arg[0], "pickpocket")) {
return;
}
@ -10037,7 +10040,7 @@ void bot_command_pickpocket(Client *c, const Seperator *sep)
float mob_xy_distance = ((mob_distance.x * mob_distance.x) + (mob_distance.y * mob_distance.y));
float mob_z_distance = (mob_distance.z * mob_distance.z);
float z_offset_diff = target_mob->GetZOffset() - c->GetZOffset();
if (mob_z_distance >= (35-z_offset_diff) || mob_xy_distance > 250) {
c->Message(Chat::White, "You must be closer to an enemy to use this command");
return;

View File

@ -30,6 +30,7 @@ uint8 GetCommandStatus(std::string command_name);
void ListModifyNPCStatMap(Client *c);
std::map<std::string, std::string> GetModifyNPCStatMap();
std::string GetModifyNPCStatDescription(std::string stat);
void SendFeatureSubCommands(Client *c);
void SendNPCEditSubCommands(Client *c);
void SendRuleSubCommands(Client *c);
void SendGuildSubCommands(Client *c);

View File

@ -1047,42 +1047,42 @@ void Perl__processmobswhilezoneempty(bool on)
quest_manager.processmobswhilezoneempty(on);
}
void Perl__npcrace(int race_id)
void Perl__npcrace(uint16 race_id)
{
quest_manager.npcrace(race_id);
}
void Perl__npcgender(int gender_id)
void Perl__npcgender(uint8 gender_id)
{
quest_manager.npcgender(gender_id);
}
void Perl__npcsize(int size)
void Perl__npcsize(float size)
{
quest_manager.npcsize(size);
}
void Perl__npctexture(int texture_id)
void Perl__npctexture(uint8 texture_id)
{
quest_manager.npctexture(texture_id);
}
void Perl__playerrace(int race_id)
void Perl__playerrace(uint16 race_id)
{
quest_manager.playerrace(race_id);
}
void Perl__playergender(int gender_id)
void Perl__playergender(uint8 gender_id)
{
quest_manager.playergender(gender_id);
}
void Perl__playersize(int newsize)
void Perl__playersize(float size)
{
quest_manager.playersize(newsize);
quest_manager.playersize(size);
}
void Perl__playertexture(int texture_id)
void Perl__playertexture(uint8 texture_id)
{
quest_manager.playertexture(texture_id);
}

View File

@ -67,23 +67,24 @@ void command_appearanceeffects(Client *c, const Seperator *sep)
);
} else if (is_remove) {
t->SendIllusionPacket(
t->GetRace(),
t->GetGender(),
t->GetTexture(),
t->GetHelmTexture(),
t->GetHairColor(),
t->GetBeardColor(),
t->GetEyeColor1(),
t->GetEyeColor2(),
t->GetHairStyle(),
t->GetLuclinFace(),
t->GetBeard(),
0xFF,
t->GetDrakkinHeritage(),
t->GetDrakkinTattoo(),
t->GetDrakkinDetails(),
t->GetSize(),
false
AppearanceStruct{
.beard = t->GetBeard(),
.beard_color = t->GetBeardColor(),
.drakkin_details = t->GetDrakkinDetails(),
.drakkin_heritage = t->GetDrakkinHeritage(),
.drakkin_tattoo = t->GetDrakkinTattoo(),
.eye_color_one = t->GetEyeColor1(),
.eye_color_two = t->GetEyeColor2(),
.face = t->GetLuclinFace(),
.gender_id = t->GetGender(),
.hair = t->GetHairStyle(),
.hair_color = t->GetHairColor(),
.helmet_texture = t->GetHelmTexture(),
.race_id = t->GetRace(),
.send_effects = false,
.size = t->GetSize(),
.texture = t->GetTexture(),
}
);
t->ClearAppearenceEffects();
c->Message(

View File

@ -2,55 +2,35 @@
void command_feature(Client *c, const Seperator *sep)
{
// nested command aliasing
std::string command = sep->arg[0] ? sep->arg[0] : "";
bool is_size_alias = sep->arg[0] && Strings::Contains(command, "#size");
bool is_nested_alias = (is_size_alias);
const bool is_size_alias = sep->arg[0] && Strings::Contains(command, "#size");
const bool is_nested_alias = is_size_alias;
int arguments = sep->argnum;
const auto arguments = sep->argnum;
if ((arguments < 2 || !sep->IsNumber(2)) && !is_nested_alias) {
auto feature_save_link = Saylink::Silent("#npcedit featuresave");
c->Message(Chat::White, "Usage: #feature beard [Beard] - Change your or your target's Beard");
c->Message(Chat::White, "Usage: #feature beardcolor [Beard Color] - Change your or your target's Beard Color");
c->Message(Chat::White, "Usage: #feature details [Details] - Change your or your target's Drakkin Details");
c->Message(Chat::White, "Usage: #feature eyes [Eye Color] - Change your or your target's Eyes");
c->Message(Chat::White, "Usage: #feature face [Face] - Change your or your target's Face");
c->Message(Chat::White, "Usage: #feature gender [Gender] - Change your or your target's Gender");
c->Message(Chat::White, "Usage: #feature hair [Hair] - Change your or your target's Hair");
c->Message(Chat::White, "Usage: #feature haircolor [Hair Color] - Change your or your target's Hair Color");
c->Message(Chat::White, "Usage: #feature helm [Helmet Texture] - Change your or your target's Helmet Texture");
c->Message(Chat::White, "Usage: #feature heritage [Heritage] - Change your or your target's Drakkin Heritage");
c->Message(Chat::White, "Usage: #feature race [Race ID] - Change your or your target's Race");
c->Message(Chat::White, "Usage: #feature size [Size] - Change your or your target's Size (Valid values are 0 to 255, decimal increments are allowed.)");
c->Message(Chat::White, "Usage: #feature tattoo [Tattoo] - Change your or your target's Drakkin Tattoos");
c->Message(Chat::White, "Usage: #feature texture [Texture] - Change your or your target's Texture");
c->Message(
Chat::White,
fmt::format(
"Note: All features are temporary. If your target is an NPC, you can save these features to the database using {}.",
feature_save_link
).c_str()
);
SendFeatureSubCommands(c);
return;
}
Mob* target = c->GetTarget() ? c->GetTarget() : c;
Mob* t = c;
if (c->GetTarget()) {
t = c->GetTarget();
}
bool is_beard = !strcasecmp(sep->arg[1], "beard");
bool is_beard_color = !strcasecmp(sep->arg[1], "beardcolor");
bool is_details = !strcasecmp(sep->arg[1], "details");
bool is_eyes = !strcasecmp(sep->arg[1], "eyes");
bool is_face = !strcasecmp(sep->arg[1], "face");
bool is_gender = !strcasecmp(sep->arg[1], "gender");
bool is_hair = !strcasecmp(sep->arg[1], "hair");
bool is_hair_color = !strcasecmp(sep->arg[1], "haircolor");
bool is_helm = !strcasecmp(sep->arg[1], "helm");
bool is_heritage = !strcasecmp(sep->arg[1], "heritage");
bool is_race = !strcasecmp(sep->arg[1], "race");
bool is_size = !strcasecmp(sep->arg[1], "size") || is_size_alias;
bool is_tattoo = !strcasecmp(sep->arg[1], "tattoo");
bool is_texture = !strcasecmp(sep->arg[1], "texture");
const bool is_beard = !strcasecmp(sep->arg[1], "beard");
const bool is_beard_color = !strcasecmp(sep->arg[1], "beardcolor");
const bool is_details = !strcasecmp(sep->arg[1], "details");
const bool is_eyes = !strcasecmp(sep->arg[1], "eyes");
const bool is_face = !strcasecmp(sep->arg[1], "face");
const bool is_gender = !strcasecmp(sep->arg[1], "gender");
const bool is_hair = !strcasecmp(sep->arg[1], "hair");
const bool is_hair_color = !strcasecmp(sep->arg[1], "haircolor");
const bool is_helm = !strcasecmp(sep->arg[1], "helm");
const bool is_heritage = !strcasecmp(sep->arg[1], "heritage");
const bool is_race = !strcasecmp(sep->arg[1], "race");
const bool is_size = !strcasecmp(sep->arg[1], "size") || is_size_alias;
const bool is_tattoo = !strcasecmp(sep->arg[1], "tattoo");
const bool is_texture = !strcasecmp(sep->arg[1], "texture");
if (
!is_beard &&
@ -68,103 +48,82 @@ void command_feature(Client *c, const Seperator *sep)
!is_tattoo &&
!is_texture
) {
auto feature_save_link = Saylink::Silent("#npcedit featuresave");
c->Message(Chat::White, "Usage: #feature beard [Beard] - Change your or your target's Beard");
c->Message(Chat::White, "Usage: #feature beardcolor [Beard Color] - Change your or your target's Beard Color");
c->Message(Chat::White, "Usage: #feature details [Details] - Change your or your target's Drakkin Details");
c->Message(Chat::White, "Usage: #feature eyes [Eye Color] - Change your or your target's Eyes");
c->Message(Chat::White, "Usage: #feature face [Face] - Change your or your target's Face");
c->Message(Chat::White, "Usage: #feature gender [Gender] - Change your or your target's Gender");
c->Message(Chat::White, "Usage: #feature hair [Hair] - Change your or your target's Hair");
c->Message(Chat::White, "Usage: #feature haircolor [Hair Color] - Change your or your target's Hair Color");
c->Message(Chat::White, "Usage: #feature helm [Helmet Texture] - Change your or your target's Helmet Texture");
c->Message(Chat::White, "Usage: #feature heritage [Heritage] - Change your or your target's Drakkin Heritage");
c->Message(Chat::White, "Usage: #feature race [Race ID] - Change your or your target's Race");
c->Message(Chat::White, "Usage: #feature size [Size] - Change your or your target's Size (Valid values are 0 to 255, decimal increments are allowed.)");
c->Message(Chat::White, "Usage: #feature tattoo [Tattoo] - Change your or your target's Drakkin Tattoos");
c->Message(Chat::White, "Usage: #feature texture [Texture] - Change your or your target's Texture");
c->Message(
Chat::White,
fmt::format(
"Note: All features are temporary. If your target is an NPC, you can save these features to the database using {}.",
feature_save_link
).c_str()
);
SendFeatureSubCommands(c);
return;
}
FaceChange_Struct face{};
face.haircolor = target->GetHairColor();
face.beardcolor = target->GetBeardColor();
face.eyecolor1 = target->GetEyeColor1();
face.eyecolor2 = target->GetEyeColor2();
face.hairstyle = target->GetHairStyle();
face.face = target->GetLuclinFace();
face.beard = target->GetBeard();
face.drakkin_heritage = target->GetDrakkinHeritage();
face.drakkin_tattoo = target->GetDrakkinTattoo();
face.drakkin_details = target->GetDrakkinDetails();
FaceChange_Struct f{
.haircolor = t->GetHairColor(),
.beardcolor = t->GetBeardColor(),
.eyecolor1 = t->GetEyeColor1(),
.eyecolor2 = t->GetEyeColor2(),
.hairstyle = t->GetHairStyle(),
.beard = t->GetBeard(),
.face = t->GetLuclinFace(),
.drakkin_heritage = t->GetDrakkinHeritage(),
.drakkin_tattoo = t->GetDrakkinTattoo(),
.drakkin_details = t->GetDrakkinDetails(),
};
auto gender = target->GetGender();
auto helm_texture = target->GetHelmTexture();
auto race = target->GetModel();
auto size = target->GetSize();
auto texture = target->GetTexture();
uint8 gender = t->GetGender();
uint8 helm_texture = t->GetHelmTexture();
uint16 race = t->GetModel();
float size = t->GetSize();
uint8 texture = t->GetTexture();
std::string feature_changed;
float value_changed = 0.0f;
if (is_beard) {
face.beard = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.beard = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Beard";
value_changed = face.beard;
value_changed = f.beard;
} else if (is_beard_color) {
face.beardcolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.beardcolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Beard Color";
value_changed = face.beardcolor;
value_changed = f.beardcolor;
} else if (is_details) {
if (target->GetRace() != DRAKKIN) {
if (t->GetRace() != DRAKKIN) {
c->Message(Chat::White, "You must target a Drakkin to use this command.");
return;
}
face.drakkin_details = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.drakkin_details = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Drakkin Details";
value_changed = static_cast<float>(face.drakkin_details);
value_changed = static_cast<float>(f.drakkin_details);
} else if (is_eyes) {
face.eyecolor1 = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.eyecolor1 = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Eyes";
value_changed = face.eyecolor1; // eyecolor2 isn't used
value_changed = f.eyecolor1; // eyecolor2 isn't used
} else if (is_face) {
face.face = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.face = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Face";
value_changed = face.face;
value_changed = f.face;
} else if (is_gender) {
gender = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Gender";
value_changed = gender;
} else if (is_hair) {
face.hairstyle = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.hairstyle = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Hair";
value_changed = face.hairstyle;
value_changed = f.hairstyle;
} else if (is_hair_color) {
face.haircolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.haircolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Hair Color";
value_changed = face.haircolor;
value_changed = f.haircolor;
} else if (is_helm) {
helm_texture = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Helmet Texture";
value_changed = helm_texture;
} else if (is_heritage) {
if (target->GetRace() != DRAKKIN) {
if (t->GetRace() != DRAKKIN) {
c->Message(Chat::White, "You must target a Drakkin to use this command.");
return;
}
face.drakkin_heritage = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.drakkin_heritage = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Drakkin Heritage";
value_changed = static_cast<float>(face.drakkin_heritage);
value_changed = static_cast<float>(f.drakkin_heritage);
} else if (is_race) {
race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Race";
@ -189,14 +148,14 @@ void command_feature(Client *c, const Seperator *sep)
feature_changed = "Size";
value_changed = size;
} else if (is_tattoo) {
if (target->GetRace() != DRAKKIN) {
if (t->GetRace() != DRAKKIN) {
c->Message(Chat::White, "You must target a Drakkin to use this command.");
return;
}
face.drakkin_tattoo = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
f.drakkin_tattoo = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Drakkin Tattoos";
value_changed = static_cast<float>(face.drakkin_tattoo);
value_changed = static_cast<float>(f.drakkin_tattoo);
} else if (is_texture) {
texture = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
feature_changed = "Texture";
@ -206,29 +165,34 @@ void command_feature(Client *c, const Seperator *sep)
// For now face number is not set through SetFace. This is because the
// client may not update face features after being set to an invalid face
// until a specific valid face number is re-sent (needs more research)
if (!is_gender && !is_helm && !is_race && !is_size && !is_texture && !is_face)
{
target->SetFaceAppearance(face);
}
else
{
target->SendIllusionPacket(
race,
gender,
texture,
helm_texture,
face.haircolor,
face.beardcolor,
target->GetEyeColor1(),
target->GetEyeColor2(),
face.hairstyle,
face.face,
face.beard,
0xFF,
face.drakkin_heritage,
face.drakkin_tattoo,
face.drakkin_details,
size
if (
!is_face &&
!is_gender &&
!is_helm &&
!is_race &&
!is_size &&
!is_texture
) {
t->SetFaceAppearance(f);
} else {
t->SendIllusionPacket(
AppearanceStruct{
.beard = f.beard,
.beard_color = f.beardcolor,
.drakkin_details = f.drakkin_details,
.drakkin_heritage = f.drakkin_heritage,
.drakkin_tattoo = f.drakkin_tattoo,
.eye_color_one = t->GetEyeColor1(),
.eye_color_two = t->GetEyeColor2(),
.face = f.face,
.gender_id = gender,
.hair = f.hairstyle,
.hair_color = f.haircolor,
.helmet_texture = helm_texture,
.race_id = race,
.size = size,
.texture = texture,
}
);
}
@ -237,7 +201,7 @@ void command_feature(Client *c, const Seperator *sep)
fmt::format(
"{} set for {} to {}.",
feature_changed,
c->GetTargetDescription(target),
c->GetTargetDescription(t),
(
is_size ?
fmt::format(
@ -253,3 +217,29 @@ void command_feature(Client *c, const Seperator *sep)
);
}
void SendFeatureSubCommands(Client *c)
{
const std::string& feature_save_link = Saylink::Silent("#npcedit featuresave");
c->Message(Chat::White, "Usage: #feature beard [Beard] - Change your or your target's Beard");
c->Message(Chat::White, "Usage: #feature beardcolor [Beard Color] - Change your or your target's Beard Color");
c->Message(Chat::White, "Usage: #feature details [Details] - Change your or your target's Drakkin Details");
c->Message(Chat::White, "Usage: #feature eyes [Eye Color] - Change your or your target's Eyes");
c->Message(Chat::White, "Usage: #feature face [Face] - Change your or your target's Face");
c->Message(Chat::White, "Usage: #feature gender [Gender] - Change your or your target's Gender");
c->Message(Chat::White, "Usage: #feature hair [Hair] - Change your or your target's Hair");
c->Message(Chat::White, "Usage: #feature haircolor [Hair Color] - Change your or your target's Hair Color");
c->Message(Chat::White, "Usage: #feature helm [Helmet Texture] - Change your or your target's Helmet Texture");
c->Message(Chat::White, "Usage: #feature heritage [Heritage] - Change your or your target's Drakkin Heritage");
c->Message(Chat::White, "Usage: #feature race [Race ID] - Change your or your target's Race");
c->Message(Chat::White, "Usage: #feature size [Size] - Change your or your target's Size (Valid values are 0 to 255, decimal increments are allowed.)");
c->Message(Chat::White, "Usage: #feature tattoo [Tattoo] - Change your or your target's Drakkin Tattoos");
c->Message(Chat::White, "Usage: #feature texture [Texture] - Change your or your target's Texture");
c->Message(
Chat::White,
fmt::format(
"Note: All features are temporary. If your target is an NPC, you can save these features to the database using {}.",
feature_save_link
).c_str()
);
}

View File

@ -60,11 +60,11 @@ void command_fixmob(Client *c, const Seperator *sep)
ChangeSetting = Race;
}
else if (strcasecmp(command, "gender") == 0) {
if (Gender == 0 && codeMove == 'p') {
Gender = 2;
if (Gender == MALE && codeMove == 'p') {
Gender = NEUTER;
}
else if (Gender >= 2 && codeMove != 'p') {
Gender = 0;
else if (Gender >= NEUTER && codeMove != 'p') {
Gender = MALE;
}
else {
Gender += Adjustment;
@ -238,9 +238,22 @@ void command_fixmob(Client *c, const Seperator *sep)
}
else {
target->SendIllusionPacket(
Race, Gender, Texture, HelmTexture, HairColor, BeardColor,
EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF,
DrakkinHeritage, DrakkinTattoo, DrakkinDetails
AppearanceStruct{
.beard = Beard,
.beard_color = BeardColor,
.drakkin_details = DrakkinDetails,
.drakkin_heritage = DrakkinHeritage,
.drakkin_tattoo = DrakkinTattoo,
.eye_color_one = EyeColor1,
.eye_color_two = EyeColor2,
.face = LuclinFace,
.gender_id = Gender,
.hair = HairStyle,
.hair_color = HairColor,
.helmet_texture = HelmTexture,
.race_id = Race,
.texture = Texture,
}
);
c->Message(Chat::White, "%s=%i", ChangeType, ChangeSetting);

View File

@ -22,8 +22,11 @@ void SetGender(Client *c, const Seperator *sep)
}
t->SendIllusionPacket(
t->GetRace(),
gender_id
AppearanceStruct{
.gender_id = gender_id,
.race_id = t->GetRace(),
.size = t->GetSize(),
}
);
c->Message(

View File

@ -30,7 +30,13 @@ void SetGenderPermanent(Client *c, const Seperator *sep)
t->SetBaseGender(gender_id);
t->Save();
t->SendIllusionPacket(t->GetRace(), gender_id);
t->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = t->GetRace(),
.size = t->GetSize(),
}
);
c->Message(
Chat::White,

View File

@ -37,7 +37,12 @@ void SetRace(Client *c, const Seperator *sep)
return;
}
t->SendIllusionPacket(race_id);
t->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
.size = t->GetSize(),
}
);
c->Message(
Chat::White,

View File

@ -31,7 +31,13 @@ void SetRacePermanent(Client *c, const Seperator *sep)
t->SetBaseRace(race_id);
t->SetBaseGender(gender_id);
t->Save();
t->SendIllusionPacket(race_id, gender_id);
t->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = race_id,
.size = t->GetSize()
}
);
c->Message(
Chat::White,

View File

@ -8,8 +8,8 @@ void SetTexture(Client *c, const Seperator *sep)
return;
}
const uint16 texture = Strings::ToUnsignedInt(sep->arg[2]);
const uint8 helmet_texture = (
const uint8 texture = Strings::ToUnsignedInt(sep->arg[2]);
const uint8 helmet_texture = (
sep->IsNumber(3) ?
Strings::ToUnsignedInt(sep->arg[3]) :
0
@ -30,10 +30,12 @@ void SetTexture(Client *c, const Seperator *sep)
}
} else { // Non-Player Races only need Illusion Packets to be sent for texture
t->SendIllusionPacket(
t->GetModel(),
t->GetGender(),
texture,
helmet_texture
AppearanceStruct{
.gender_id = t->GetGender(),
.helmet_texture = helmet_texture,
.race_id = t->GetModel(),
.texture = texture,
}
);
}

View File

@ -1554,19 +1554,33 @@ void Lua_Mob::SetFlyMode(int in) {
self->SetFlyMode(static_cast<GravityBehavior>(in));
}
void Lua_Mob::SetTexture(int in) {
void Lua_Mob::SetTexture(uint8 texture) {
Lua_Safe_Call_Void();
self->SendIllusionPacket(self->GetRace(), 0xFF, in);
self->SendIllusionPacket(
AppearanceStruct{
.race_id = self->GetRace(),
.texture = texture
}
);
}
void Lua_Mob::SetRace(int in) {
void Lua_Mob::SetRace(uint16 race_id) {
Lua_Safe_Call_Void();
self->SendIllusionPacket(in);
self->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id
}
);
}
void Lua_Mob::SetGender(int in) {
void Lua_Mob::SetGender(uint8 gender_id) {
Lua_Safe_Call_Void();
self->SendIllusionPacket(self->GetRace(), in);
self->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = self->GetRace(),
}
);
}
void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
@ -1740,24 +1754,26 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
}
self->SendIllusionPacket(
race,
gender,
texture,
helmtexture,
haircolor,
beardcolor,
eyecolor1,
eyecolor2,
hairstyle,
luclinface,
beard,
aa_title,
drakkin_heritage,
drakkin_tattoo,
drakkin_details,
size,
send_appearance_effects,
target
AppearanceStruct{
.aa_title = aa_title,
.beard = beard,
.beard_color = beardcolor,
.drakkin_details = drakkin_details,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.eye_color_one = eyecolor1,
.eye_color_two = eyecolor2,
.face = luclinface,
.gender_id = gender,
.hair = hairstyle,
.hair_color = haircolor,
.helmet_texture = helmtexture,
.race_id = race,
.send_effects = send_appearance_effects,
.size = size,
.target = target,
.texture = texture,
}
);
}
@ -3605,7 +3621,7 @@ luabind::scope lua_register_mob() {
.def("SetExtraHaste", (void(Lua_Mob::*)(int))&Lua_Mob::SetExtraHaste)
.def("SetFlurryChance", (void(Lua_Mob::*)(int))&Lua_Mob::SetFlurryChance)
.def("SetFlyMode", (void(Lua_Mob::*)(int))&Lua_Mob::SetFlyMode)
.def("SetGender", (void(Lua_Mob::*)(int))&Lua_Mob::SetGender)
.def("SetGender", (void(Lua_Mob::*)(uint8))&Lua_Mob::SetGender)
.def("SetGlobal", (void(Lua_Mob::*)(const char*,const char*,int,const char*))&Lua_Mob::SetGlobal)
.def("SetGlobal", (void(Lua_Mob::*)(const char*,const char*,int,const char*,Lua_Mob))&Lua_Mob::SetGlobal)
.def("SetHP", &Lua_Mob::SetHP)
@ -3622,14 +3638,14 @@ luabind::scope lua_register_mob() {
.def("SetPet", &Lua_Mob::SetPet)
.def("SetPetOrder", (void(Lua_Mob::*)(int))&Lua_Mob::SetPetOrder)
.def("SetPseudoRoot", (void(Lua_Mob::*)(bool))&Lua_Mob::SetPseudoRoot)
.def("SetRace", (void(Lua_Mob::*)(int))&Lua_Mob::SetRace)
.def("SetRace", (void(Lua_Mob::*)(uint16))&Lua_Mob::SetRace)
.def("SetRunning", (void(Lua_Mob::*)(bool))&Lua_Mob::SetRunning)
.def("SetSlotTint", (void(Lua_Mob::*)(int,int,int,int))&Lua_Mob::SetSlotTint)
.def("SetSpecialAbility", (void(Lua_Mob::*)(int,int))&Lua_Mob::SetSpecialAbility)
.def("SetSpecialAbilityParam", (void(Lua_Mob::*)(int,int,int))&Lua_Mob::SetSpecialAbilityParam)
.def("SetTarget", &Lua_Mob::SetTarget)
.def("SetTargetable", (void(Lua_Mob::*)(bool))&Lua_Mob::SetTargetable)
.def("SetTexture", (void(Lua_Mob::*)(int))&Lua_Mob::SetTexture)
.def("SetTexture", (void(Lua_Mob::*)(uint8))&Lua_Mob::SetTexture)
.def("SetTimer", &Lua_Mob::SetTimer)
.def("SetTimerMS", &Lua_Mob::SetTimerMS)
.def("StopAllTimers", &Lua_Mob::StopAllTimers)

View File

@ -351,9 +351,9 @@ public:
void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5);
void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Lua_Client specific_target);
void SetFlyMode(int in);
void SetTexture(int in);
void SetRace(int in);
void SetGender(int in);
void SetTexture(uint8 texture);
void SetRace(uint16 race_id);
void SetGender(uint8 gender_id);
void SendIllusionPacket(luabind::adl::object illusion);
void ChangeRace(int in);
void ChangeGender(int in);

View File

@ -4323,7 +4323,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
npc_type->race = merc_template->RaceID;
// Use the Gender and Size of the Merchant if possible
uint8 tmpgender = 0;
uint8 tmpgender = MALE;
float tmpsize = 6.0f;
if(merchant_id > 0)
{
@ -5624,7 +5624,7 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().myTemplate = nullptr;
GetMercInfo().IsSuspended = false;
GetMercInfo().SuspendedTime = 0;
GetMercInfo().Gender = 0;
GetMercInfo().Gender = MALE;
GetMercInfo().State = 0;
memset(GetMercInfo().merc_name, 0, 64);
Log(Logs::General, Logs::Mercenaries, "SetMerc No Merc for %s.", GetName());

View File

@ -3518,135 +3518,100 @@ void Mob::GMMove(const glm::vec4 &position) {
}
}
void Mob::SendIllusionPacket(
uint16 in_race,
uint8 in_gender,
uint8 in_texture,
uint8 in_helmtexture,
uint8 in_haircolor,
uint8 in_beardcolor,
uint8 in_eyecolor1,
uint8 in_eyecolor2,
uint8 in_hairstyle,
uint8 in_luclinface,
uint8 in_beard,
uint8 in_aa_title,
uint32 in_drakkin_heritage,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
float in_size,
bool send_appearance_effects,
Client* target
)
void Mob::SendIllusionPacket(const AppearanceStruct& a)
{
uint8 new_texture = in_texture;
uint8 new_helmtexture = in_helmtexture;
uint8 new_haircolor;
uint8 new_beardcolor;
uint8 new_eyecolor1;
uint8 new_eyecolor2;
uint8 new_hairstyle;
uint8 new_luclinface;
uint8 new_beard;
uint8 new_aa_title;
uint32 new_drakkin_heritage;
uint32 new_drakkin_tattoo;
uint32 new_drakkin_details;
uint16 new_race = (
a.race_id != RACE_DOUG_0 ?
a.race_id :
(use_model ? use_model : GetBaseRace())
);
race = in_race;
if (race == 0) {
race = use_model ? use_model : GetBaseRace();
}
uint8 new_gender = (
a.gender_id != UINT8_MAX ?
a.gender_id :
(a.race_id ? GetDefaultGender(a.race_id, a.gender_id) : GetBaseGender())
);
if (in_gender != 0xFF) {
gender = in_gender;
}
else {
gender = in_race ? GetDefaultGender(race, gender) : GetBaseGender();
}
float new_size = a.size <= 0.0f ? GetRaceGenderDefaultHeight(race, gender) : a.size;
if (in_texture == 0xFF && !IsPlayerRace(race)) {
new_texture = GetTexture();
}
uint8 new_texture = a.texture == UINT8_MAX && !IsPlayerRace(a.race_id) ? GetTexture() : a.texture;
uint8 new_helmet_texture = a.helmet_texture == UINT8_MAX && !IsPlayerRace(race) ? GetHelmTexture() : a.helmet_texture;
if (in_helmtexture == 0xFF && !IsPlayerRace(race)) {
new_helmtexture = GetHelmTexture();
}
uint8 new_hair = a.hair == UINT8_MAX ? GetHairStyle() : a.hair;
uint8 new_hair_color = a.hair_color == UINT8_MAX ? GetHairColor() : a.hair_color;
new_haircolor = (in_haircolor == 0xFF) ? GetHairColor() : in_haircolor;
new_beardcolor = (in_beardcolor == 0xFF) ? GetBeardColor() : in_beardcolor;
new_eyecolor1 = (in_eyecolor1 == 0xFF) ? GetEyeColor1() : in_eyecolor1;
new_eyecolor2 = (in_eyecolor2 == 0xFF) ? GetEyeColor2() : in_eyecolor2;
new_hairstyle = (in_hairstyle == 0xFF) ? GetHairStyle() : in_hairstyle;
new_luclinface = (in_luclinface == 0xFF) ? GetLuclinFace() : in_luclinface;
new_beard = (in_beard == 0xFF) ? GetBeard() : in_beard;
new_drakkin_heritage = (in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage;
new_drakkin_tattoo = (in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo;
new_drakkin_details = (in_drakkin_details == 0xFFFFFFFF) ? GetDrakkinDetails() : in_drakkin_details;
new_aa_title = in_aa_title;
uint8 new_beard = a.beard == UINT8_MAX ? GetBeard() : a.beard;
uint8 new_beard_color = a.beard_color == UINT8_MAX ? GetBeardColor() : a.beard_color;
uint8 new_eye_color_one = a.eye_color_one == UINT8_MAX ? GetEyeColor1() : a.eye_color_one;
uint8 new_eye_color_two = a.eye_color_two == UINT8_MAX ? GetEyeColor2() : a.eye_color_two;
uint8 new_face = a.face == UINT8_MAX ? GetLuclinFace() : a.face;
uint32 new_drakkin_details = a.drakkin_details == UINT32_MAX ? GetDrakkinDetails() : a.drakkin_details;
uint32 new_drakkin_heritage = a.drakkin_heritage == UINT32_MAX ? GetDrakkinHeritage() : a.drakkin_heritage;
uint32 new_drakkin_tattoo = a.drakkin_tattoo == UINT32_MAX ? GetDrakkinTattoo() : a.drakkin_tattoo;
// Reset features to Base from the Player Profile
if (IsClient() && in_race == 0) {
race = CastToClient()->GetBaseRace();
gender = CastToClient()->GetBaseGender();
new_texture = texture = 0xFF;
new_helmtexture = helmtexture = 0xFF;
new_haircolor = haircolor = CastToClient()->GetBaseHairColor();
new_beardcolor = beardcolor = CastToClient()->GetBaseBeardColor();
new_eyecolor1 = eyecolor1 = CastToClient()->GetBaseEyeColor();
new_eyecolor2 = eyecolor2 = CastToClient()->GetBaseEyeColor();
new_hairstyle = hairstyle = CastToClient()->GetBaseHairStyle();
new_luclinface = luclinface = CastToClient()->GetBaseFace();
new_beard = beard = CastToClient()->GetBaseBeard();
new_aa_title = aa_title = 0xFF;
new_drakkin_heritage = drakkin_heritage = CastToClient()->GetBaseHeritage();
new_drakkin_tattoo = drakkin_tattoo = CastToClient()->GetBaseTattoo();
new_drakkin_details = drakkin_details = CastToClient()->GetBaseDetails();
if (IsClient() && a.race_id == RACE_DOUG_0) {
new_beard = CastToClient()->GetBaseBeard();
new_beard_color = CastToClient()->GetBaseBeardColor();
new_drakkin_details = CastToClient()->GetBaseDetails();
new_drakkin_heritage = CastToClient()->GetBaseHeritage();
new_drakkin_tattoo = CastToClient()->GetBaseTattoo();
new_eye_color_one = CastToClient()->GetBaseEyeColor();
new_eye_color_two = CastToClient()->GetBaseEyeColor();
new_face = CastToClient()->GetBaseFace();
new_gender = CastToClient()->GetBaseGender();
new_helmet_texture = UINT8_MAX;
new_hair = CastToClient()->GetBaseHairStyle();
new_hair_color = CastToClient()->GetBaseHairColor();
new_race = CastToClient()->GetBaseRace();
new_size = CastToClient()->GetSize();
new_texture = UINT8_MAX;
}
// update internal values for mob
size = (in_size <= 0.0f) ? GetRaceGenderDefaultHeight(race, gender) : in_size;
if (new_texture != 0xFF) {
texture = new_texture;
}
if (new_helmtexture != 0xFF) {
helmtexture = new_helmtexture;
}
haircolor = new_haircolor;
beardcolor = new_beardcolor;
eyecolor1 = new_eyecolor1;
eyecolor2 = new_eyecolor2;
hairstyle = new_hairstyle;
luclinface = new_luclinface;
beard = new_beard;
beardcolor = new_beard_color;
drakkin_heritage = new_drakkin_heritage;
drakkin_tattoo = new_drakkin_tattoo;
drakkin_details = new_drakkin_details;
eyecolor1 = new_eye_color_one;
eyecolor2 = new_eye_color_two;
luclinface = new_face;
gender = new_gender;
hairstyle = new_hair;
haircolor = new_hair_color;
helmtexture = new_helmet_texture;
race = new_race;
size = new_size;
texture = new_texture;
auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct));
auto is = (Illusion_Struct *) outapp->pBuffer;
auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct));
Illusion_Struct *is = (Illusion_Struct *) outapp->pBuffer;
is->spawnid = GetID();
strcpy(is->charname, GetCleanName());
is->race = race;
is->gender = gender;
is->texture = new_texture;
is->helmtexture = new_helmtexture;
is->haircolor = new_haircolor;
is->beardcolor = new_beardcolor;
strn0cpy(is->charname, GetCleanName(), sizeof(is->charname));
is->beardcolor = new_beard_color;
is->beard = new_beard;
is->eyecolor1 = new_eyecolor1;
is->eyecolor2 = new_eyecolor2;
is->hairstyle = new_hairstyle;
is->face = new_luclinface;
is->drakkin_heritage = new_drakkin_heritage;
is->drakkin_tattoo = new_drakkin_tattoo;
is->drakkin_details = new_drakkin_details;
is->size = size;
is->eyecolor1 = new_eye_color_one;
is->eyecolor2 = new_eye_color_two;
is->face = new_face;
is->gender = new_gender;
is->hairstyle = new_hair;
is->haircolor = new_hair_color;
is->helmtexture = new_helmet_texture;
is->race = new_race;
is->size = new_size;
is->texture = new_texture;
if (!target) {
if (!a.target) {
entity_list.QueueClients(this, outapp);
} else {
target->QueuePacket(outapp, false);
a.target->QueuePacket(outapp, false);
}
safe_delete(outapp);
@ -3654,7 +3619,7 @@ void Mob::SendIllusionPacket(
/* Refresh armor and tints after send illusion packet */
SendArmorAppearance();
if (send_appearance_effects) {
if (a.send_effects) {
SendSavedAppearenceEffects(nullptr);
}
@ -3663,17 +3628,17 @@ void Mob::SendIllusionPacket(
race,
gender,
new_texture,
new_helmtexture,
new_haircolor,
new_beardcolor,
new_eyecolor1,
new_eyecolor2,
new_hairstyle,
new_luclinface,
new_helmet_texture,
new_hair_color,
new_beard_color,
new_eye_color_one,
new_eye_color_two,
new_hair,
new_face,
new_drakkin_heritage,
new_drakkin_tattoo,
new_drakkin_details,
size,
new_size,
target ? target->GetCleanName() : "No Target"
);
}
@ -3903,21 +3868,22 @@ bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
if (send_illusion) {
SendIllusionPacket(
GetRace(),
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
AppearanceStruct{
.beard = new_beard,
.beard_color = new_beard_color,
.drakkin_details = new_drakkin_details,
.drakkin_heritage = new_drakkin_heritage,
.drakkin_tattoo = new_drakkin_tattoo,
.eye_color_one = new_eye_color_one,
.eye_color_two = new_eye_color_two,
.face = new_luclin_face,
.gender_id = current_gender,
.hair = new_hair_style,
.hair_color = new_hair_color,
.helmet_texture = new_helm_texture,
.race_id = GetRace(),
.texture = new_texture,
}
);
}
@ -8153,21 +8119,23 @@ void Mob::CloneAppearance(Mob* other, bool clone_name)
}
SendIllusionPacket(
other->GetRace(),
other->GetGender(),
other->GetTexture(),
other->GetHelmTexture(),
other->GetHairColor(),
other->GetBeardColor(),
other->GetEyeColor1(),
other->GetEyeColor2(),
other->GetHairStyle(),
other->GetBeard(),
0xFF,
other->GetRace() == DRAKKIN ? other->GetDrakkinHeritage() : 0xFFFFFFFF,
other->GetRace() == DRAKKIN ? other->GetDrakkinTattoo() : 0xFFFFFFFF,
other->GetRace() == DRAKKIN ? other->GetDrakkinDetails() : 0xFFFFFFFF,
other->GetSize()
AppearanceStruct{
.beard = other->GetBeard(),
.beard_color = other->GetBeardColor(),
.drakkin_details = other->GetDrakkinDetails(),
.drakkin_heritage = other->GetDrakkinHeritage(),
.drakkin_tattoo = other->GetDrakkinTattoo(),
.eye_color_one = other->GetEyeColor1(),
.eye_color_two = other->GetEyeColor2(),
.face = other->GetLuclinFace(),
.gender_id = other->GetGender(),
.hair = other->GetHairStyle(),
.hair_color = other->GetHairColor(),
.helmet_texture = other->GetHelmTexture(),
.race_id = other->GetRace(),
.size = other->GetSize(),
.texture = other->GetTexture(),
}
);
for (

View File

@ -69,6 +69,27 @@ enum class eSpecialAttacks : int {
ChaoticStab
};
struct AppearanceStruct {
uint8 aa_title = UINT8_MAX;
uint8 beard = UINT8_MAX;
uint8 beard_color = UINT8_MAX;
uint32 drakkin_details = UINT32_MAX;
uint32 drakkin_heritage = UINT32_MAX;
uint32 drakkin_tattoo = UINT32_MAX;
uint8 eye_color_one = UINT8_MAX;
uint8 eye_color_two = UINT8_MAX;
uint8 face = UINT8_MAX;
uint8 gender_id = UINT8_MAX;
uint8 hair = UINT8_MAX;
uint8 hair_color = UINT8_MAX;
uint8 helmet_texture = UINT8_MAX;
uint16 race_id = RACE_DOUG_0;
bool send_effects = true;
float size = -1.0f;
Client *target = nullptr;
uint8 texture = UINT8_MAX;
};
class DataBucketKey;
class Mob : public Entity {
public:
@ -889,26 +910,7 @@ public:
int64 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false, uint16 casterid = 0, Mob *caster = nullptr);
uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0);
void SendIllusionPacket(
uint16 in_race,
uint8 in_gender = 0xFF,
uint8 in_texture = 0xFF,
uint8 in_helmtexture = 0xFF,
uint8 in_haircolor = 0xFF,
uint8 in_beardcolor = 0xFF,
uint8 in_eyecolor1 = 0xFF,
uint8 in_eyecolor2 = 0xFF,
uint8 in_hairstyle = 0xFF,
uint8 in_luclinface = 0xFF,
uint8 in_beard = 0xFF,
uint8 in_aa_title = 0xFF,
uint32 in_drakkin_heritage = 0xFFFFFFFF,
uint32 in_drakkin_tattoo = 0xFFFFFFFF,
uint32 in_drakkin_details = 0xFFFFFFFF,
float in_size = -1.0f,
bool send_appearance_effects = true,
Client* target = nullptr
);
void SendIllusionPacket(const AppearanceStruct& a);
void CloneAppearance(Mob* other, bool clone_name = false);
void SetFaceAppearance(const FaceChange_Struct& face, bool skip_sender = false);
bool RandomizeFeatures(bool send_illusion = true, bool set_variables = true);

View File

@ -1219,7 +1219,7 @@ void NPC::SpawnGridNodeNPC(const glm::vec4 &position, int32 grid_id, int32 grid_
npc_type->current_hp = 4000000;
npc_type->max_hp = 4000000;
npc_type->race = 2254;
npc_type->gender = 2;
npc_type->gender = NEUTER;
npc_type->class_ = 9;
npc_type->deity = 1;
npc_type->level = 200;

View File

@ -529,7 +529,7 @@ void PathfinderWaypoint::ShowNode(const Node &n) {
npc_type->current_hp = 4000000;
npc_type->max_hp = 4000000;
npc_type->race = 2254;
npc_type->gender = 2;
npc_type->gender = NEUTER;
npc_type->class_ = 9;
npc_type->deity = 1;
npc_type->level = 75;

View File

@ -1809,10 +1809,26 @@ void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2, in
void Perl_Mob_RemoveAllAppearanceEffects(Mob* self) // @categories Script Utility
{
self->SendIllusionPacket(self->GetRace(), self->GetGender(), self->GetTexture(), self->GetHelmTexture(),
self->GetHairColor(), self->GetBeardColor(), self->GetEyeColor1(), self->GetEyeColor2(),
self->GetHairStyle(), self->GetLuclinFace(), self->GetBeard(), 0xFF,
self->GetDrakkinHeritage(), self->GetDrakkinTattoo(), self->GetDrakkinDetails(), self->GetSize(), false);
self->SendIllusionPacket(
AppearanceStruct{
.beard = self->GetBeard(),
.beard_color = self->GetBeardColor(),
.drakkin_details = self->GetDrakkinDetails(),
.drakkin_heritage = self->GetDrakkinHeritage(),
.drakkin_tattoo = self->GetDrakkinTattoo(),
.eye_color_one = self->GetEyeColor1(),
.eye_color_two = self->GetEyeColor2(),
.face = self->GetLuclinFace(),
.gender_id = self->GetGender(),
.hair = self->GetHairStyle(),
.hair_color = self->GetHairColor(),
.helmet_texture = self->GetHelmTexture(),
.race_id = self->GetRace(),
.send_effects = false,
.size = self->GetSize(),
.texture = self->GetTexture(),
}
);
self->ClearAppearenceEffects();
}
@ -1821,134 +1837,416 @@ void Perl_Mob_SetFlyMode(Mob* self, int flymode) // @categories Script Utility
self->SetFlyMode(static_cast<GravityBehavior>(flymode));
}
void Perl_Mob_SetTexture(Mob* self, int32 texture) // @categories Stats and Attributes
void Perl_Mob_SetTexture(Mob* self, uint8 texture) // @categories Stats and Attributes
{
self->SendIllusionPacket(self->GetRace(), 0xFF, texture);
self->SendIllusionPacket(
AppearanceStruct{
.race_id = self->GetRace(),
.texture = texture,
}
);
}
void Perl_Mob_SetRace(Mob* self, int32 race) // @categories Stats and Attributes
void Perl_Mob_SetRace(Mob* self, uint16 race_id) // @categories Stats and Attributes
{
self->SendIllusionPacket(race);
self->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
}
);
}
void Perl_Mob_SetGender(Mob* self, int32 gender) // @categories Stats and Attributes
void Perl_Mob_SetGender(Mob* self, uint8 gender_id) // @categories Stats and Attributes
{
self->SendIllusionPacket(self->GetRace(), gender);
self->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = self->GetRace(),
}
);
}
// todo: SendIllusion should be sent in a hash like lua
void Perl_Mob_SendIllusion(Mob* self, uint16 race) // @categories Script Utility
void Perl_Mob_SendIllusion(Mob *self, uint16 race_id) // @categories Script Utility
{
self->SendIllusionPacket(race);
self->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender) // @categories Script Utility
void Perl_Mob_SendIllusion(Mob *self, uint16 race_id, uint8 gender_id) // @categories Script Utility
{
self->SendIllusionPacket(race, gender);
self->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = race_id,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture) // @categories Script Utility
void Perl_Mob_SendIllusion(Mob *self, uint16 race_id, uint8 gender_id, uint8 texture) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture);
self->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture);
self->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, face);
self->SendIllusionPacket(
AppearanceStruct{
.face = face,
.gender_id = gender_id,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, 0xFF, 0xFF, 0xFF, 0xFF, hairstyle, face);
self->SendIllusionPacket(
AppearanceStruct{
.face = face,
.gender_id = gender_id,
.hair = hair,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, 0xFF, 0xFF, 0xFF, hairstyle, face);
self->SendIllusionPacket(
AppearanceStruct{
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, 0xFF, 0xFF, 0xFF, hairstyle, face, beard);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color,
uint32 drakkin_heritage
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_heritage = drakkin_heritage,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color,
uint32 drakkin_heritage,
uint32 drakkin_tattoo
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo, uint32 drakkin_details) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color,
uint32 drakkin_heritage,
uint32 drakkin_tattoo,
uint32 drakkin_details
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_details = drakkin_details,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo, uint32 drakkin_details, float size) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color,
uint32 drakkin_heritage,
uint32 drakkin_tattoo,
uint32 drakkin_details,
float size
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details, size);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_details = drakkin_details,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.size = size,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo, uint32 drakkin_details, float size, Client* target) // @categories Script Utility
void Perl_Mob_SendIllusion(
Mob *self,
uint16 race_id,
uint8 gender_id,
uint8 texture,
uint8 helmet_texture,
uint8 face,
uint8 hair,
uint8 hair_color,
uint8 beard,
uint8 beard_color,
uint32 drakkin_heritage,
uint32 drakkin_tattoo,
uint32 drakkin_details,
float size,
Client *target
) // @categories Script Utility
{
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details, size, true, target);
self->SendIllusionPacket(
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_details = drakkin_details,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.size = size,
.target = target,
.texture = texture,
}
);
}
void Perl_Mob_SendIllusionPacket(Mob* self, perl::reference table_ref)
{
perl::hash table = table_ref;
uint16 race = table.exists("race") ? table["race"] : self->GetRace();
uint8 gender = table.exists("gender") ? table["gender"] : self->GetGender();
uint8 texture = table.exists("texture") ? table["texture"] : self->GetTexture();
uint8 helmtexture = table.exists("helmtexture") ? table["helmtexture"] : self->GetHelmTexture();
uint8 haircolor = table.exists("haircolor") ? table["haircolor"] : self->GetHairColor();
uint8 beardcolor = table.exists("beardcolor") ? table["beardcolor"] : self->GetBeardColor();
uint8 eyecolor1 = table.exists("eyecolor1") ? table["eyecolor1"] : self->GetEyeColor1();
uint8 eyecolor2 = table.exists("eyecolor2") ? table["eyecolor2"] : self->GetEyeColor2();
uint8 hairstyle = table.exists("hairstyle") ? table["hairstyle"] : self->GetHairStyle();
uint8 luclinface = table.exists("luclinface") ? table["luclinface"] : self->GetLuclinFace();
uint8 beard = table.exists("beard") ? table["beard"] : self->GetBeard();
uint8 aa_title = table.exists("aa_title") ? table["aa_title"] : 255;
uint32 drakkin_heritage = table.exists("drakkin_heritage") ? table["drakkin_heritage"] : self->GetDrakkinHeritage();
uint32 drakkin_tattoo = table.exists("drakkin_tattoo") ? table["drakkin_tattoo"] : self->GetDrakkinTattoo();
uint32 drakkin_details = table.exists("drakkin_details") ? table["drakkin_details"] : self->GetDrakkinDetails();
float size = table.exists("size") ? table["size"] : self->GetSize();
bool send_appearance_effects = table.exists("send_appearance_effects") ? table["send_appearance_effects"] : true;
Client* target = table.exists("target") ? static_cast<Client *>(table["target"]) : nullptr;
uint16 race_id = table.exists("race") ? table["race"] : self->GetRace();
uint8 gender_id = table.exists("gender") ? table["gender"] : self->GetGender();
uint8 texture = table.exists("texture") ? table["texture"] : self->GetTexture();
uint8 helmet_texture = table.exists("helmtexture") ? table["helmtexture"] : self->GetHelmTexture();
uint8 hair_color = table.exists("haircolor") ? table["haircolor"] : self->GetHairColor();
uint8 beard_color = table.exists("beardcolor") ? table["beardcolor"] : self->GetBeardColor();
uint8 eye_color_one = table.exists("eyecolor1") ? table["eyecolor1"] : self->GetEyeColor1();
uint8 eye_color_two = table.exists("eyecolor2") ? table["eyecolor2"] : self->GetEyeColor2();
uint8 hair = table.exists("hairstyle") ? table["hairstyle"] : self->GetHairStyle();
uint8 face = table.exists("luclinface") ? table["luclinface"] : self->GetLuclinFace();
uint8 beard = table.exists("beard") ? table["beard"] : self->GetBeard();
uint8 aa_title = table.exists("aa_title") ? table["aa_title"] : 255;
uint32 drakkin_heritage = table.exists("drakkin_heritage") ? table["drakkin_heritage"] : self->GetDrakkinHeritage();
uint32 drakkin_tattoo = table.exists("drakkin_tattoo") ? table["drakkin_tattoo"] : self->GetDrakkinTattoo();
uint32 drakkin_details = table.exists("drakkin_details") ? table["drakkin_details"] : self->GetDrakkinDetails();
float size = table.exists("size") ? table["size"] : self->GetSize();
bool send_appearance_effects = table.exists("send_appearance_effects") ? table["send_appearance_effects"] : true;
Client *target = table.exists("target") ? static_cast<Client *>(table["target"]) : nullptr;
self->SendIllusionPacket(
race,
gender,
texture,
helmtexture,
haircolor,
beardcolor,
eyecolor1,
eyecolor2,
hairstyle,
luclinface,
beard,
aa_title,
drakkin_heritage,
drakkin_tattoo,
drakkin_details,
size,
send_appearance_effects,
target
AppearanceStruct{
.beard = beard,
.beard_color = beard_color,
.drakkin_details = drakkin_details,
.drakkin_heritage = drakkin_heritage,
.drakkin_tattoo = drakkin_tattoo,
.face = face,
.gender_id = gender_id,
.hair = hair,
.hair_color = hair_color,
.helmet_texture = helmet_texture,
.race_id = race_id,
.send_effects = send_appearance_effects,
.size = size,
.target = target,
.texture = texture,
}
);
}

View File

@ -2187,7 +2187,7 @@ bool QuestManager::isdooropen(uint32 doorid) {
return false;
}
void QuestManager::npcrace(int race_id)
void QuestManager::npcrace(uint16 race_id)
{
QuestManagerCurrentQuestVars();
@ -2195,10 +2195,14 @@ void QuestManager::npcrace(int race_id)
return;
}
owner->SendIllusionPacket(race_id);
owner->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
}
);
}
void QuestManager::npcgender(int gender_id)
void QuestManager::npcgender(uint8 gender_id)
{
QuestManagerCurrentQuestVars();
@ -2206,10 +2210,15 @@ void QuestManager::npcgender(int gender_id)
return;
}
owner->SendIllusionPacket(owner->GetRace(), gender_id);
owner->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = owner->GetRace(),
}
);
}
void QuestManager::npcsize(int newsize)
void QuestManager::npcsize(float size)
{
QuestManagerCurrentQuestVars();
@ -2217,10 +2226,10 @@ void QuestManager::npcsize(int newsize)
return;
}
owner->ChangeSize(newsize, true);
owner->ChangeSize(size, true);
}
void QuestManager::npctexture(int newtexture)
void QuestManager::npctexture(uint8 texture)
{
QuestManagerCurrentQuestVars();
@ -2228,10 +2237,15 @@ void QuestManager::npctexture(int newtexture)
return;
}
owner->SendIllusionPacket(owner->GetRace(), 0xFF, newtexture);
owner->SendIllusionPacket(
AppearanceStruct{
.race_id = owner->GetRace(),
.texture = texture,
}
);
}
void QuestManager::playerrace(int race_id)
void QuestManager::playerrace(uint16 race_id)
{
QuestManagerCurrentQuestVars();
@ -2239,10 +2253,14 @@ void QuestManager::playerrace(int race_id)
return;
}
initiator->SendIllusionPacket(race_id);
initiator->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
}
);
}
void QuestManager::playergender(int gender_id)
void QuestManager::playergender(uint8 gender_id)
{
QuestManagerCurrentQuestVars();
@ -2250,10 +2268,15 @@ void QuestManager::playergender(int gender_id)
return;
}
initiator->SendIllusionPacket(initiator->GetRace(), gender_id);
initiator->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = initiator->GetRace(),
}
);
}
void QuestManager::playersize(int newsize)
void QuestManager::playersize(float size)
{
QuestManagerCurrentQuestVars();
@ -2261,10 +2284,10 @@ void QuestManager::playersize(int newsize)
return;
}
initiator->ChangeSize(newsize, true);
initiator->ChangeSize(size, true);
}
void QuestManager::playertexture(int newtexture)
void QuestManager::playertexture(uint8 texture)
{
QuestManagerCurrentQuestVars();
@ -2272,7 +2295,12 @@ void QuestManager::playertexture(int newtexture)
return;
}
initiator->SendIllusionPacket(initiator->GetRace(), 0xFF, newtexture);
initiator->SendIllusionPacket(
AppearanceStruct{
.race_id = initiator->GetRace(),
.texture = texture,
}
);
}
void QuestManager::playerfeature(const char* feature, int setting)
@ -2334,22 +2362,23 @@ void QuestManager::playerfeature(const char* feature, int setting)
}
initiator->SendIllusionPacket(
Race,
Gender,
Texture,
HelmTexture,
HairColor,
BeardColor,
EyeColor1,
EyeColor2,
HairStyle,
LuclinFace,
Beard,
0xFF,
DrakkinHeritage,
DrakkinTattoo,
DrakkinDetails,
Size
AppearanceStruct{
.beard = Beard,
.beard_color = BeardColor,
.drakkin_details = DrakkinDetails,
.drakkin_heritage = DrakkinHeritage,
.drakkin_tattoo = DrakkinTattoo,
.eye_color_one = EyeColor1,
.eye_color_two = EyeColor2,
.face = LuclinFace,
.gender_id = Gender,
.hair = HairStyle,
.hair_color = HairColor,
.helmet_texture = HelmTexture,
.race_id = Race,
.size = Size,
.texture = Texture,
}
);
}
@ -2412,22 +2441,23 @@ void QuestManager::npcfeature(const char* feature, int setting)
}
owner->SendIllusionPacket(
Race,
Gender,
Texture,
HelmTexture,
HairColor,
BeardColor,
EyeColor1,
EyeColor2,
HairStyle,
LuclinFace,
Beard,
0xFF,
DrakkinHeritage,
DrakkinTattoo,
DrakkinDetails,
Size
AppearanceStruct{
.beard = Beard,
.beard_color = BeardColor,
.drakkin_details = DrakkinDetails,
.drakkin_heritage = DrakkinHeritage,
.drakkin_tattoo = DrakkinTattoo,
.eye_color_one = EyeColor1,
.eye_color_two = EyeColor2,
.face = LuclinFace,
.gender_id = Gender,
.hair = HairStyle,
.hair_color = HairColor,
.helmet_texture = HelmTexture,
.race_id = Race,
.size = Size,
.texture = Texture,
}
);
}

View File

@ -201,13 +201,14 @@ public:
void forcedoorclose(uint32 doorid, bool altmode);
void toggledoorstate(uint32 doorid);
bool isdooropen(uint32 doorid);
void npcrace(int race_id);
void npcgender(int gender_id); void npcsize(int newsize);
void npctexture(int newtexture);
void playerrace(int race_id);
void playergender(int gender_id);
void playersize(int newsize);
void playertexture(int newtexture);
void npcrace(uint16 race_id);
void npcgender(uint8 gender_id);
void npcsize(float size);
void npctexture(uint8 texture);
void playerrace(uint16 race_id);
void playergender(uint8 gender_id);
void playersize(float size);
void playertexture(uint8 texture);
void playerfeature(const char* feature, int setting);
void npcfeature(const char* feature, int setting);
void popup(const char *title, const char *text, uint32 popupid, uint32 buttons, uint32 Duration);

View File

@ -1474,9 +1474,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if(caster && caster->GetTarget()){
SendIllusionPacket
(
caster->GetTarget()->GetRace(),
caster->GetTarget()->GetGender(),
caster->GetTarget()->GetTexture()
AppearanceStruct{
.gender_id = caster->GetTarget()->GetGender(),
.race_id = caster->GetTarget()->GetRace(),
.texture = caster->GetTarget()->GetTexture(),
}
);
caster->SendAppearancePacket(AT_Size, static_cast<uint32>(caster->GetTarget()->GetSize()));
@ -4265,7 +4267,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
case SE_IllusionCopy:
case SE_Illusion:
{
SendIllusionPacket(0, GetBaseGender());
SendIllusionPacket(AppearanceStruct{});
// The GetSize below works because the above setting race to zero sets size back.
SendAppearancePacket(AT_Size, GetSize());
@ -10199,36 +10201,29 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
if (base == -1) {
// Specific Gender Illusions
if (spell_id == SPELL_ILLUSION_MALE || spell_id == SPELL_ILLUSION_FEMALE) {
int specific_gender = -1;
// Male
if (spell_id == SPELL_ILLUSION_MALE)
specific_gender = 0;
// Female
else if (spell_id == SPELL_ILLUSION_FEMALE)
specific_gender = 1;
if (specific_gender > -1) {
if (caster && caster->GetTarget()) {
SendIllusionPacket
(
caster->GetTarget()->GetBaseRace(),
specific_gender,
caster->GetTarget()->GetTexture()
);
}
uint8 specific_gender = spell_id == SPELL_ILLUSION_MALE ? MALE : FEMALE;
if (caster && caster->GetTarget()) {
SendIllusionPacket(
AppearanceStruct{
.gender_id = specific_gender,
.race_id = caster->GetTarget()->GetBaseRace(),
.texture = caster->GetTarget()->GetTexture(),
}
);
}
}
// Change Gender Illusions
// Change Gender Illusions
else {
if (caster && caster->GetTarget()) {
int opposite_gender = 0;
if (caster->GetTarget()->GetGender() == 0)
opposite_gender = 1;
uint8 opposite_gender = caster->GetTarget()->GetGender() == MALE ? FEMALE : MALE;
SendIllusionPacket
(
caster->GetTarget()->GetRace(),
opposite_gender,
caster->GetTarget()->GetTexture()
SendIllusionPacket(
AppearanceStruct{
.gender_id = opposite_gender,
.race_id = caster->GetTarget()->GetRace(),
.texture = caster->GetTarget()->GetTexture(),
}
);
}
}
@ -10254,46 +10249,52 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
if (max > 0) {
if (limit == 0) {
SendIllusionPacket(
base,
gender_id
AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id),
.race_id = static_cast<uint16>(base),
}
);
}
else {
} else {
if (max != 3) {
SendIllusionPacket(
base,
gender_id,
limit,
max
AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id),
.helmet_texture = static_cast<uint8>(max),
.race_id = static_cast<uint16>(base),
.texture = static_cast<uint8>(limit),
}
);
}
else {
} else {
SendIllusionPacket(
base,
gender_id,
limit,
limit
AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id),
.helmet_texture = static_cast<uint8>(limit),
.race_id = static_cast<uint16>(base),
.texture = static_cast<uint8>(limit),
}
);
}
}
}
else {
} else {
SendIllusionPacket(
base,
gender_id,
limit,
max
AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id),
.helmet_texture = static_cast<uint8>(max),
.race_id = static_cast<uint16>(base),
.texture = static_cast<uint8>(limit),
}
);
}
}
else {
} else {
SendIllusionPacket(
base,
gender_id,
limit
AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id),
.race_id = static_cast<uint16>(base),
.texture = static_cast<uint8>(limit),
}
);
}
SendAppearancePacket(AT_Size, race_size);
}

View File

@ -510,7 +510,7 @@ void Trap::CreateHiddenTrigger()
make_npc->runspeed = 0.0f;
make_npc->bodytype = BT_Special;
make_npc->race = 127;
make_npc->gender = 0;
make_npc->gender = MALE;
make_npc->loottable_id = 0;
make_npc->npc_spells_id = 0;
make_npc->d_melee_texture1 = 0;

View File

@ -11,6 +11,7 @@
#include "aa_ability.h"
#include "event_codes.h"
#include "../common/repositories/doors_repository.h"
#include "../common/races.h"
#include "bot_database.h"
@ -339,7 +340,7 @@ namespace BeastlordPetData {
uint16 race_id = WOLF;
uint8 texture = 0;
uint8 helm_texture = 0;
uint8 gender = 2;
uint8 gender = NEUTER;
float size_modifier = 1.0f;
uint8 face = 0;
};