mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
Texture work
This commit is contained in:
+225
-429
@@ -140,7 +140,7 @@ Mob::Mob(
|
||||
if (in_lastname) {
|
||||
strn0cpy(lastname, in_lastname, 64);
|
||||
}
|
||||
cur_hp = in_cur_hp;
|
||||
current_hp = in_cur_hp;
|
||||
max_hp = in_max_hp;
|
||||
base_hp = in_max_hp;
|
||||
gender = in_gender;
|
||||
@@ -265,7 +265,7 @@ Mob::Mob(
|
||||
hidden = false;
|
||||
improved_hidden = false;
|
||||
invulnerable = false;
|
||||
IsFullHP = (cur_hp == max_hp);
|
||||
IsFullHP = (current_hp == max_hp);
|
||||
qglobal = 0;
|
||||
spawned = false;
|
||||
rare_spawn = false;
|
||||
@@ -935,77 +935,76 @@ uint8 Mob::GetArchetype() const {
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho) {
|
||||
void Mob::CreateSpawnPacket(EQApplicationPacket *app, Mob *ForWho)
|
||||
{
|
||||
app->SetOpcode(OP_NewSpawn);
|
||||
app->size = sizeof(NewSpawn_Struct);
|
||||
app->size = sizeof(NewSpawn_Struct);
|
||||
app->pBuffer = new uchar[app->size];
|
||||
memset(app->pBuffer, 0, app->size);
|
||||
NewSpawn_Struct* ns = (NewSpawn_Struct*)app->pBuffer;
|
||||
NewSpawn_Struct *ns = (NewSpawn_Struct *) app->pBuffer;
|
||||
FillSpawnStruct(ns, ForWho);
|
||||
|
||||
if(RuleB(NPC, UseClassAsLastName) && strlen(ns->spawn.lastName) == 0)
|
||||
{
|
||||
switch(ns->spawn.class_)
|
||||
{
|
||||
case TRIBUTE_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Tribute Master");
|
||||
break;
|
||||
case ADVENTURERECRUITER:
|
||||
strcpy(ns->spawn.lastName, "Adventure Recruiter");
|
||||
break;
|
||||
case BANKER:
|
||||
strcpy(ns->spawn.lastName, "Banker");
|
||||
break;
|
||||
case ADVENTUREMERCHANT:
|
||||
strcpy(ns->spawn.lastName,"Adventure Merchant");
|
||||
break;
|
||||
case WARRIORGM:
|
||||
strcpy(ns->spawn.lastName, "GM Warrior");
|
||||
break;
|
||||
case PALADINGM:
|
||||
strcpy(ns->spawn.lastName, "GM Paladin");
|
||||
break;
|
||||
case RANGERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Ranger");
|
||||
break;
|
||||
case SHADOWKNIGHTGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shadowknight");
|
||||
break;
|
||||
case DRUIDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Druid");
|
||||
break;
|
||||
case BARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Bard");
|
||||
break;
|
||||
case ROGUEGM:
|
||||
strcpy(ns->spawn.lastName, "GM Rogue");
|
||||
break;
|
||||
case SHAMANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shaman");
|
||||
break;
|
||||
case NECROMANCERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Necromancer");
|
||||
break;
|
||||
case WIZARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Wizard");
|
||||
break;
|
||||
case MAGICIANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Magician");
|
||||
break;
|
||||
case ENCHANTERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Enchanter");
|
||||
break;
|
||||
case BEASTLORDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Beastlord");
|
||||
break;
|
||||
case BERSERKERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Berserker");
|
||||
break;
|
||||
case MERCERNARY_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Mercenary Recruiter");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (RuleB(NPC, UseClassAsLastName) && strlen(ns->spawn.lastName) == 0) {
|
||||
switch (ns->spawn.class_) {
|
||||
case TRIBUTE_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Tribute Master");
|
||||
break;
|
||||
case ADVENTURERECRUITER:
|
||||
strcpy(ns->spawn.lastName, "Adventure Recruiter");
|
||||
break;
|
||||
case BANKER:
|
||||
strcpy(ns->spawn.lastName, "Banker");
|
||||
break;
|
||||
case ADVENTUREMERCHANT:
|
||||
strcpy(ns->spawn.lastName, "Adventure Merchant");
|
||||
break;
|
||||
case WARRIORGM:
|
||||
strcpy(ns->spawn.lastName, "GM Warrior");
|
||||
break;
|
||||
case PALADINGM:
|
||||
strcpy(ns->spawn.lastName, "GM Paladin");
|
||||
break;
|
||||
case RANGERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Ranger");
|
||||
break;
|
||||
case SHADOWKNIGHTGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shadowknight");
|
||||
break;
|
||||
case DRUIDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Druid");
|
||||
break;
|
||||
case BARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Bard");
|
||||
break;
|
||||
case ROGUEGM:
|
||||
strcpy(ns->spawn.lastName, "GM Rogue");
|
||||
break;
|
||||
case SHAMANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shaman");
|
||||
break;
|
||||
case NECROMANCERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Necromancer");
|
||||
break;
|
||||
case WIZARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Wizard");
|
||||
break;
|
||||
case MAGICIANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Magician");
|
||||
break;
|
||||
case ENCHANTERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Enchanter");
|
||||
break;
|
||||
case BEASTLORDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Beastlord");
|
||||
break;
|
||||
case BERSERKERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Berserker");
|
||||
break;
|
||||
case MERCERNARY_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Mercenary Recruiter");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1269,7 +1268,7 @@ void Mob::CreateDespawnPacket(EQApplicationPacket* app, bool Decay)
|
||||
|
||||
void Mob::CreateHPPacket(EQApplicationPacket* app)
|
||||
{
|
||||
this->IsFullHP=(cur_hp>=max_hp);
|
||||
this->IsFullHP=(current_hp>=max_hp);
|
||||
app->SetOpcode(OP_MobHealth);
|
||||
app->size = sizeof(SpawnHPUpdate_Struct2);
|
||||
app->pBuffer = new uchar[app->size];
|
||||
@@ -1312,7 +1311,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
* If our HP is different from last HP update call - let's update selves
|
||||
*/
|
||||
if (IsClient()) {
|
||||
if (cur_hp != last_hp || force_update_all) {
|
||||
if (current_hp != last_hp || force_update_all) {
|
||||
|
||||
/**
|
||||
* This is to prevent excessive packet sending under trains/fast combat
|
||||
@@ -1321,17 +1320,16 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
Log(Logs::General, Logs::HP_Update,
|
||||
"Mob::SendHPUpdate :: Update HP of self (%s) HP: %i last: %i skip_self: %s",
|
||||
this->GetCleanName(),
|
||||
cur_hp,
|
||||
current_hp,
|
||||
last_hp,
|
||||
(skip_self ? "true" : "false")
|
||||
);
|
||||
|
||||
if (!skip_self || this->CastToClient()->ClientVersion() >= EQEmu::versions::ClientVersion::SoD) {
|
||||
auto client_packet = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
|
||||
auto client_packet = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
|
||||
auto *hp_packet_client = (SpawnHPUpdate_Struct *) client_packet->pBuffer;
|
||||
|
||||
SpawnHPUpdate_Struct *hp_packet_client = (SpawnHPUpdate_Struct *) client_packet->pBuffer;
|
||||
|
||||
hp_packet_client->cur_hp = CastToClient()->GetHP() - itembonuses.HP;
|
||||
hp_packet_client->cur_hp = static_cast<uint32>(CastToClient()->GetHP() - itembonuses.HP);
|
||||
hp_packet_client->spawn_id = GetID();
|
||||
hp_packet_client->max_hp = CastToClient()->GetMaxHP() - itembonuses.HP;
|
||||
|
||||
@@ -1345,12 +1343,12 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
/**
|
||||
* Used to check if HP has changed to update self next round
|
||||
*/
|
||||
last_hp = cur_hp;
|
||||
last_hp = current_hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int8 current_hp_percent = (max_hp == 0 ? 0 : static_cast<int>(cur_hp * 100 / max_hp));
|
||||
int8 current_hp_percent = static_cast<int8>(max_hp == 0 ? 0 : static_cast<int>(current_hp * 100 / max_hp));
|
||||
|
||||
Log(Logs::General,
|
||||
Logs::HP_Update,
|
||||
@@ -1680,129 +1678,171 @@ void Mob::GMMove(float x, float y, float z, float heading, bool SendUpdate) {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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
|
||||
)
|
||||
{
|
||||
|
||||
uint16 BaseRace = GetBaseRace();
|
||||
|
||||
if (in_race == 0)
|
||||
{
|
||||
if (in_race == 0) {
|
||||
race = BaseRace;
|
||||
if (in_gender == 0xFF)
|
||||
if (in_gender == 0xFF) {
|
||||
gender = GetBaseGender();
|
||||
else
|
||||
}
|
||||
else {
|
||||
gender = in_gender;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
race = in_race;
|
||||
if (in_gender == 0xFF)
|
||||
if (in_gender == 0xFF) {
|
||||
gender = GetDefaultGender(race, gender);
|
||||
else
|
||||
}
|
||||
else {
|
||||
gender = in_gender;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_texture == 0xFF)
|
||||
{
|
||||
if (IsPlayerRace(in_race))
|
||||
if (in_texture == 0xFF) {
|
||||
if (IsPlayerRace(in_race)) {
|
||||
texture = 0xFF;
|
||||
else
|
||||
}
|
||||
else {
|
||||
texture = GetTexture();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
texture = in_texture;
|
||||
}
|
||||
|
||||
if (in_helmtexture == 0xFF)
|
||||
{
|
||||
if (IsPlayerRace(in_race))
|
||||
if (in_helmtexture == 0xFF) {
|
||||
if (IsPlayerRace(in_race)) {
|
||||
helmtexture = 0xFF;
|
||||
else if (in_texture != 0xFF)
|
||||
}
|
||||
else if (in_texture != 0xFF) {
|
||||
helmtexture = in_texture;
|
||||
else
|
||||
}
|
||||
else {
|
||||
helmtexture = GetHelmTexture();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
helmtexture = in_helmtexture;
|
||||
}
|
||||
|
||||
if (in_haircolor == 0xFF)
|
||||
if (in_haircolor == 0xFF) {
|
||||
haircolor = GetHairColor();
|
||||
else
|
||||
}
|
||||
else {
|
||||
haircolor = in_haircolor;
|
||||
}
|
||||
|
||||
if (in_beardcolor == 0xFF)
|
||||
if (in_beardcolor == 0xFF) {
|
||||
beardcolor = GetBeardColor();
|
||||
else
|
||||
}
|
||||
else {
|
||||
beardcolor = in_beardcolor;
|
||||
}
|
||||
|
||||
if (in_eyecolor1 == 0xFF)
|
||||
if (in_eyecolor1 == 0xFF) {
|
||||
eyecolor1 = GetEyeColor1();
|
||||
else
|
||||
}
|
||||
else {
|
||||
eyecolor1 = in_eyecolor1;
|
||||
}
|
||||
|
||||
if (in_eyecolor2 == 0xFF)
|
||||
if (in_eyecolor2 == 0xFF) {
|
||||
eyecolor2 = GetEyeColor2();
|
||||
else
|
||||
}
|
||||
else {
|
||||
eyecolor2 = in_eyecolor2;
|
||||
}
|
||||
|
||||
if (in_hairstyle == 0xFF)
|
||||
if (in_hairstyle == 0xFF) {
|
||||
hairstyle = GetHairStyle();
|
||||
else
|
||||
}
|
||||
else {
|
||||
hairstyle = in_hairstyle;
|
||||
}
|
||||
|
||||
if (in_luclinface == 0xFF)
|
||||
if (in_luclinface == 0xFF) {
|
||||
luclinface = GetLuclinFace();
|
||||
else
|
||||
}
|
||||
else {
|
||||
luclinface = in_luclinface;
|
||||
}
|
||||
|
||||
if (in_beard == 0xFF)
|
||||
if (in_beard == 0xFF) {
|
||||
beard = GetBeard();
|
||||
else
|
||||
}
|
||||
else {
|
||||
beard = in_beard;
|
||||
}
|
||||
|
||||
aa_title = in_aa_title;
|
||||
|
||||
if (in_drakkin_heritage == 0xFFFFFFFF)
|
||||
if (in_drakkin_heritage == 0xFFFFFFFF) {
|
||||
drakkin_heritage = GetDrakkinHeritage();
|
||||
else
|
||||
}
|
||||
else {
|
||||
drakkin_heritage = in_drakkin_heritage;
|
||||
}
|
||||
|
||||
if (in_drakkin_tattoo == 0xFFFFFFFF)
|
||||
if (in_drakkin_tattoo == 0xFFFFFFFF) {
|
||||
drakkin_tattoo = GetDrakkinTattoo();
|
||||
else
|
||||
}
|
||||
else {
|
||||
drakkin_tattoo = in_drakkin_tattoo;
|
||||
}
|
||||
|
||||
if (in_drakkin_details == 0xFFFFFFFF)
|
||||
if (in_drakkin_details == 0xFFFFFFFF) {
|
||||
drakkin_details = GetDrakkinDetails();
|
||||
else
|
||||
}
|
||||
else {
|
||||
drakkin_details = in_drakkin_details;
|
||||
}
|
||||
|
||||
if (in_size <= 0.0f)
|
||||
if (in_size <= 0.0f) {
|
||||
size = GetSize();
|
||||
else
|
||||
}
|
||||
else {
|
||||
size = in_size;
|
||||
}
|
||||
|
||||
// Reset features to Base from the Player Profile
|
||||
if (IsClient() && in_race == 0)
|
||||
{
|
||||
race = CastToClient()->GetBaseRace();
|
||||
gender = CastToClient()->GetBaseGender();
|
||||
texture = 0xFF;
|
||||
helmtexture = 0xFF;
|
||||
haircolor = CastToClient()->GetBaseHairColor();
|
||||
beardcolor = CastToClient()->GetBaseBeardColor();
|
||||
eyecolor1 = CastToClient()->GetBaseEyeColor();
|
||||
eyecolor2 = CastToClient()->GetBaseEyeColor();
|
||||
hairstyle = CastToClient()->GetBaseHairStyle();
|
||||
luclinface = CastToClient()->GetBaseFace();
|
||||
beard = CastToClient()->GetBaseBeard();
|
||||
aa_title = 0xFF;
|
||||
if (IsClient() && in_race == 0) {
|
||||
race = CastToClient()->GetBaseRace();
|
||||
gender = CastToClient()->GetBaseGender();
|
||||
texture = 0xFF;
|
||||
helmtexture = 0xFF;
|
||||
haircolor = CastToClient()->GetBaseHairColor();
|
||||
beardcolor = CastToClient()->GetBaseBeardColor();
|
||||
eyecolor1 = CastToClient()->GetBaseEyeColor();
|
||||
eyecolor2 = CastToClient()->GetBaseEyeColor();
|
||||
hairstyle = CastToClient()->GetBaseHairStyle();
|
||||
luclinface = CastToClient()->GetBaseFace();
|
||||
beard = CastToClient()->GetBaseBeard();
|
||||
aa_title = 0xFF;
|
||||
drakkin_heritage = CastToClient()->GetBaseHeritage();
|
||||
drakkin_tattoo = CastToClient()->GetBaseTattoo();
|
||||
drakkin_details = CastToClient()->GetBaseDetails();
|
||||
switch(race){
|
||||
drakkin_tattoo = CastToClient()->GetBaseTattoo();
|
||||
drakkin_details = CastToClient()->GetBaseDetails();
|
||||
switch (race) {
|
||||
case OGRE:
|
||||
size = 9;
|
||||
break;
|
||||
@@ -1832,25 +1872,25 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture,
|
||||
}
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct));
|
||||
Illusion_Struct* 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 = texture;
|
||||
is->helmtexture = helmtexture;
|
||||
is->haircolor = haircolor;
|
||||
is->beardcolor = beardcolor;
|
||||
is->beard = beard;
|
||||
is->eyecolor1 = eyecolor1;
|
||||
is->eyecolor2 = eyecolor2;
|
||||
is->hairstyle = hairstyle;
|
||||
is->face = luclinface;
|
||||
is->race = race;
|
||||
is->gender = gender;
|
||||
is->texture = texture;
|
||||
is->helmtexture = helmtexture;
|
||||
is->haircolor = haircolor;
|
||||
is->beardcolor = beardcolor;
|
||||
is->beard = beard;
|
||||
is->eyecolor1 = eyecolor1;
|
||||
is->eyecolor2 = eyecolor2;
|
||||
is->hairstyle = hairstyle;
|
||||
is->face = luclinface;
|
||||
is->drakkin_heritage = drakkin_heritage;
|
||||
is->drakkin_tattoo = drakkin_tattoo;
|
||||
is->drakkin_details = drakkin_details;
|
||||
is->size = size;
|
||||
is->drakkin_tattoo = drakkin_tattoo;
|
||||
is->drakkin_details = drakkin_details;
|
||||
is->size = size;
|
||||
|
||||
entity_list.QueueClients(this, outapp);
|
||||
safe_delete(outapp);
|
||||
@@ -1858,8 +1898,23 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture,
|
||||
/* Refresh armor and tints after send illusion packet */
|
||||
this->SendArmorAppearance();
|
||||
|
||||
Log(Logs::Detail, Logs::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f",
|
||||
race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size);
|
||||
Log(Logs::Detail,
|
||||
Logs::Spells,
|
||||
"Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f",
|
||||
race,
|
||||
gender,
|
||||
texture,
|
||||
helmtexture,
|
||||
haircolor,
|
||||
beardcolor,
|
||||
eyecolor1,
|
||||
eyecolor2,
|
||||
hairstyle,
|
||||
luclinface,
|
||||
drakkin_heritage,
|
||||
drakkin_tattoo,
|
||||
drakkin_details,
|
||||
size);
|
||||
}
|
||||
|
||||
bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
|
||||
@@ -2810,275 +2865,11 @@ uint32 Mob::RandomTimer(int min,int max) {
|
||||
return r;
|
||||
}
|
||||
|
||||
uint32 NPC::GetEquipment(uint8 material_slot) const
|
||||
{
|
||||
if(material_slot > 8)
|
||||
return 0;
|
||||
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
|
||||
if (invslot == INVALID_INDEX)
|
||||
return 0;
|
||||
return equipment[invslot];
|
||||
}
|
||||
|
||||
void Mob::SendArmorAppearance(Client *one_client)
|
||||
{
|
||||
// one_client of 0 means sent to all clients
|
||||
//
|
||||
// Despite the fact that OP_NewSpawn and OP_ZoneSpawns include the
|
||||
// armor being worn and its mats, the client doesn't update the display
|
||||
// on arrival of these packets reliably.
|
||||
//
|
||||
// Send Wear changes if mob is a PC race and item is an armor slot.
|
||||
// The other packets work for primary/secondary.
|
||||
|
||||
if (IsPlayerRace(race))
|
||||
{
|
||||
if (!IsClient())
|
||||
{
|
||||
const EQEmu::ItemData *item = nullptr;
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
item = database.GetItem(GetEquipment(i));
|
||||
if (item != 0)
|
||||
{
|
||||
SendWearChange(i, one_client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::SendWearChange(uint8 material_slot, Client *one_client)
|
||||
{
|
||||
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
|
||||
WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer;
|
||||
|
||||
wc->spawn_id = GetID();
|
||||
wc->material = GetEquipmentMaterial(material_slot);
|
||||
wc->elite_material = IsEliteMaterialItem(material_slot);
|
||||
wc->hero_forge_model = GetHerosForgeModel(material_slot);
|
||||
|
||||
#ifdef BOTS
|
||||
if (IsBot()) {
|
||||
auto item_inst = CastToBot()->GetBotItem(EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot));
|
||||
if (item_inst)
|
||||
wc->color.Color = item_inst->GetColor();
|
||||
else
|
||||
wc->color.Color = 0;
|
||||
}
|
||||
else {
|
||||
wc->color.Color = GetEquipmentColor(material_slot);
|
||||
}
|
||||
#else
|
||||
wc->color.Color = GetEquipmentColor(material_slot);
|
||||
#endif
|
||||
|
||||
wc->wear_slot_id = material_slot;
|
||||
|
||||
if (!one_client)
|
||||
{
|
||||
entity_list.QueueClients(this, outapp);
|
||||
}
|
||||
else
|
||||
{
|
||||
one_client->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
|
||||
}
|
||||
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Mob::SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model, uint32 elite_material, uint32 unknown06, uint32 unknown18)
|
||||
{
|
||||
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
|
||||
WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer;
|
||||
|
||||
wc->spawn_id = this->GetID();
|
||||
wc->material = texture;
|
||||
if (this->IsClient())
|
||||
wc->color.Color = GetEquipmentColor(slot);
|
||||
else
|
||||
wc->color.Color = this->GetArmorTint(slot);
|
||||
wc->wear_slot_id = slot;
|
||||
|
||||
wc->unknown06 = unknown06;
|
||||
wc->elite_material = elite_material;
|
||||
wc->hero_forge_model = hero_forge_model;
|
||||
wc->unknown18 = unknown18;
|
||||
|
||||
|
||||
entity_list.QueueClients(this, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)
|
||||
{
|
||||
uint32 color;
|
||||
color = (red_tint & 0xFF) << 16;
|
||||
color |= (green_tint & 0xFF) << 8;
|
||||
color |= (blue_tint & 0xFF);
|
||||
color |= (color) ? (0xFF << 24) : 0;
|
||||
armor_tint.Slot[material_slot].Color = color;
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
|
||||
WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer;
|
||||
|
||||
wc->spawn_id = this->GetID();
|
||||
wc->material = GetEquipmentMaterial(material_slot);
|
||||
wc->hero_forge_model = GetHerosForgeModel(material_slot);
|
||||
wc->color.Color = color;
|
||||
wc->wear_slot_id = material_slot;
|
||||
|
||||
entity_list.QueueClients(this, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 hero_forge_model)
|
||||
{
|
||||
armor_tint.Slot[material_slot].Color = color;
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
|
||||
WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer;
|
||||
|
||||
wc->spawn_id = this->GetID();
|
||||
wc->material = texture;
|
||||
wc->hero_forge_model = hero_forge_model;
|
||||
wc->color.Color = color;
|
||||
wc->wear_slot_id = material_slot;
|
||||
|
||||
entity_list.QueueClients(this, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
|
||||
{
|
||||
uint32 equipmaterial = 0;
|
||||
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
|
||||
const EQEmu::ItemData *item = nullptr;
|
||||
item = database.GetItem(GetEquipment(material_slot));
|
||||
|
||||
if (item != 0)
|
||||
{
|
||||
// For primary and secondary we need the model, not the material
|
||||
if (material_slot == EQEmu::textures::weaponPrimary || material_slot == EQEmu::textures::weaponSecondary)
|
||||
{
|
||||
if (this->IsClient())
|
||||
{
|
||||
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
|
||||
if (invslot == INVALID_INDEX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const EQEmu::ItemInstance* inst = CastToClient()->m_inv[invslot];
|
||||
if (inst)
|
||||
{
|
||||
if (inst->GetOrnamentationAug(ornamentationAugtype))
|
||||
{
|
||||
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
|
||||
if (item && strlen(item->IDFile) > 2)
|
||||
{
|
||||
equipmaterial = atoi(&item->IDFile[2]);
|
||||
}
|
||||
}
|
||||
else if (inst->GetOrnamentationIDFile())
|
||||
{
|
||||
equipmaterial = inst->GetOrnamentationIDFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (equipmaterial == 0 && strlen(item->IDFile) > 2)
|
||||
{
|
||||
equipmaterial = atoi(&item->IDFile[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
equipmaterial = item->Material;
|
||||
}
|
||||
}
|
||||
|
||||
return equipmaterial;
|
||||
}
|
||||
|
||||
int32 Mob::GetHerosForgeModel(uint8 material_slot) const
|
||||
{
|
||||
uint32 HeroModel = 0;
|
||||
if (material_slot >= 0 && material_slot < EQEmu::textures::weaponPrimary)
|
||||
{
|
||||
uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
|
||||
const EQEmu::ItemData *item = nullptr;
|
||||
item = database.GetItem(GetEquipment(material_slot));
|
||||
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
|
||||
|
||||
if (item != 0 && invslot != INVALID_INDEX)
|
||||
{
|
||||
if (IsClient())
|
||||
{
|
||||
const EQEmu::ItemInstance* inst = CastToClient()->m_inv[invslot];
|
||||
if (inst)
|
||||
{
|
||||
if (inst->GetOrnamentationAug(ornamentationAugtype))
|
||||
{
|
||||
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
|
||||
HeroModel = item->HerosForgeModel;
|
||||
}
|
||||
else if (inst->GetOrnamentHeroModel())
|
||||
{
|
||||
HeroModel = inst->GetOrnamentHeroModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HeroModel == 0)
|
||||
{
|
||||
HeroModel = item->HerosForgeModel;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsNPC())
|
||||
{
|
||||
HeroModel = CastToNPC()->GetHeroForgeModel();
|
||||
// Robes require full model number, and should only be sent to chest, arms, wrists, and legs slots
|
||||
if (HeroModel > 1000 && material_slot != 1 && material_slot != 2 && material_slot != 3 && material_slot != 5)
|
||||
{
|
||||
HeroModel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-Convert Hero Model to match the slot
|
||||
// Otherwise, use the exact Model if model is > 999
|
||||
// Robes for example are 11607 to 12107 in RoF
|
||||
if (HeroModel > 0 && HeroModel < 1000)
|
||||
{
|
||||
HeroModel *= 100;
|
||||
HeroModel += material_slot;
|
||||
}
|
||||
|
||||
return HeroModel;
|
||||
}
|
||||
|
||||
uint32 Mob::GetEquipmentColor(uint8 material_slot) const
|
||||
{
|
||||
const EQEmu::ItemData *item = nullptr;
|
||||
|
||||
if (armor_tint.Slot[material_slot].Color)
|
||||
{
|
||||
return armor_tint.Slot[material_slot].Color;
|
||||
}
|
||||
|
||||
item = database.GetItem(GetEquipment(material_slot));
|
||||
if (item != 0)
|
||||
return item->Color;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const
|
||||
{
|
||||
const EQEmu::ItemData *item = nullptr;
|
||||
|
||||
item = database.GetItem(GetEquipment(material_slot));
|
||||
item = database.GetItem(GetEquippedItemFromTextureSlot(material_slot));
|
||||
if(item != 0)
|
||||
{
|
||||
return item->EliteMaterial;
|
||||
@@ -3090,26 +2881,31 @@ uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const
|
||||
// works just like a printf
|
||||
void Mob::Say(const char *format, ...)
|
||||
{
|
||||
char buf[1000];
|
||||
char buf[1000];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vsnprintf(buf, 1000, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
Mob* talker = this;
|
||||
if(spellbonuses.VoiceGraft != 0) {
|
||||
if(spellbonuses.VoiceGraft == GetPetID())
|
||||
Mob *talker = this;
|
||||
if (spellbonuses.VoiceGraft != 0) {
|
||||
if (spellbonuses.VoiceGraft == GetPetID()) {
|
||||
talker = entity_list.GetMob(spellbonuses.VoiceGraft);
|
||||
else
|
||||
}
|
||||
else {
|
||||
spellbonuses.VoiceGraft = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(!talker)
|
||||
if (!talker) {
|
||||
talker = this;
|
||||
}
|
||||
|
||||
entity_list.MessageClose_StringID(talker, false, 200, 10,
|
||||
GENERIC_SAY, GetCleanName(), buf);
|
||||
entity_list.MessageClose_StringID(
|
||||
talker, false, 200, 10,
|
||||
GENERIC_SAY, GetCleanName(), buf
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user