Implemented EQEmu::TintProfile

This commit is contained in:
Uleat
2016-06-01 04:58:52 -04:00
parent 767dfaef70
commit ae3c98c692
28 changed files with 296 additions and 423 deletions
+5 -5
View File
@@ -2965,12 +2965,12 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
ns->spawn.equipment[i].EliteMaterial = item->EliteMaterial;
ns->spawn.equipment[i].HeroForgeModel = item->HerosForgeModel;
if (armor_tint[i])
ns->spawn.colors[i].Color = armor_tint[i];
ns->spawn.equipment_tint.Slot[i].Color = armor_tint[i];
else
ns->spawn.colors[i].Color = item->Color;
ns->spawn.equipment_tint.Slot[i].Color = item->Color;
} else {
if (armor_tint[i])
ns->spawn.colors[i].Color = armor_tint[i];
ns->spawn.equipment_tint.Slot[i].Color = armor_tint[i];
}
}
}
@@ -2982,7 +2982,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[EQEmu::textures::TexturePrimary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[EQEmu::textures::TexturePrimary].Color = GetEquipmentColor(EQEmu::textures::TexturePrimary);
ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQEmu::textures::TexturePrimary);
}
}
@@ -2993,7 +2993,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[EQEmu::textures::TextureSecondary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[EQEmu::textures::TextureSecondary].Color = GetEquipmentColor(EQEmu::textures::TextureSecondary);
ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQEmu::textures::TextureSecondary);
}
}
}
+3 -3
View File
@@ -3062,19 +3062,19 @@ void Client::Tell_StringID(uint32 string_id, const char *who, const char *messag
}
void Client::SetTint(int16 in_slot, uint32 color) {
Color_Struct new_color;
EQEmu::Tint_Struct new_color;
new_color.Color = color;
SetTint(in_slot, new_color);
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color);
}
// Still need to reconcile bracer01 versus bracer02
void Client::SetTint(int16 in_slot, Color_Struct& color) {
void Client::SetTint(int16 in_slot, EQEmu::Tint_Struct& color) {
uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot);
if (matslot != EQEmu::textures::TextureInvalid)
{
m_pp.item_tint[matslot].Color = color.Color;
m_pp.item_tint.Slot[matslot].Color = color.Color;
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.Color);
}
+2 -2
View File
@@ -253,7 +253,7 @@ public:
void SendBuyerPacket(Client* Buyer);
GetItems_Struct* GetTraderItems();
void SendBazaarWelcome();
void DyeArmor(DyeStruct* dye);
void DyeArmor(EQEmu::TintProfile* dye);
uint8 SlotConvert(uint8 slot,bool bracer=false);
void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0);
void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
@@ -802,7 +802,7 @@ public:
uint32 NukeItem(uint32 itemnum, uint8 where_to_check =
(invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor));
void SetTint(int16 slot_id, uint32 color);
void SetTint(int16 slot_id, Color_Struct& color);
void SetTint(int16 slot_id, EQEmu::Tint_Struct& color);
void SetMaterial(int16 slot_id, uint32 item_id);
void Undye();
int32 GetItemIDAt(int16 slot_id);
+5 -5
View File
@@ -1315,9 +1315,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
/* Set item material tint */
for (int i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTexture; i++)
{
if (m_pp.item_tint[i].RGB.UseTint == 1 || m_pp.item_tint[i].RGB.UseTint == 255)
if (m_pp.item_tint.Slot[i].UseTint == 1 || m_pp.item_tint.Slot[i].UseTint == 255)
{
m_pp.item_tint[i].RGB.UseTint = 0xFF;
m_pp.item_tint.Slot[i].UseTint = 0xFF;
}
}
@@ -5379,10 +5379,10 @@ void Client::Handle_OP_DumpName(const EQApplicationPacket *app)
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
{
if (app->size != sizeof(DyeStruct))
printf("Wrong size of DyeStruct, Got: %i, Expected: %zu\n", app->size, sizeof(DyeStruct));
if (app->size != sizeof(EQEmu::TintProfile))
printf("Wrong size of DyeStruct, Got: %i, Expected: %zu\n", app->size, sizeof(EQEmu::TintProfile));
else{
DyeStruct* dye = (DyeStruct*)app->pBuffer;
EQEmu::TintProfile* dye = (EQEmu::TintProfile*)app->pBuffer;
DyeArmor(dye);
}
return;
+1 -1
View File
@@ -7128,7 +7128,7 @@ void Client::Undye() {
database.SaveInventory(CharacterID(), inst, slot2);
}
m_pp.item_tint[cur_slot].Color = 0;
m_pp.item_tint.Slot[cur_slot].Color = 0;
SendWearChange(cur_slot);
}
+15 -17
View File
@@ -116,15 +116,15 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std:
pc->Lock();
/* Load Item Tints */
pc->item_tint[0].Color = pcs->item_tint[0].Color;
pc->item_tint[1].Color = pcs->item_tint[1].Color;
pc->item_tint[2].Color = pcs->item_tint[2].Color;
pc->item_tint[3].Color = pcs->item_tint[3].Color;
pc->item_tint[4].Color = pcs->item_tint[4].Color;
pc->item_tint[5].Color = pcs->item_tint[5].Color;
pc->item_tint[6].Color = pcs->item_tint[6].Color;
pc->item_tint[7].Color = pcs->item_tint[7].Color;
pc->item_tint[8].Color = pcs->item_tint[8].Color;
pc->item_tint.Head.Color = pcs->item_tint.Head.Color;
pc->item_tint.Chest.Color = pcs->item_tint.Chest.Color;
pc->item_tint.Arms.Color = pcs->item_tint.Arms.Color;
pc->item_tint.Wrist.Color = pcs->item_tint.Wrist.Color;
pc->item_tint.Hands.Color = pcs->item_tint.Hands.Color;
pc->item_tint.Legs.Color = pcs->item_tint.Legs.Color;
pc->item_tint.Feet.Color = pcs->item_tint.Feet.Color;
pc->item_tint.Primary.Color = pcs->item_tint.Primary.Color;
pc->item_tint.Secondary.Color = pcs->item_tint.Secondary.Color;
/* Load Physical Appearance */
pc->haircolor = pcs->haircolor;
@@ -162,7 +162,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
{
corpse_graveyard_timer.Disable();
memset(item_tint, 0, sizeof(item_tint));
//memset(item_tint, 0, sizeof(item_tint));
is_corpse_changed = false;
is_player_corpse = false;
@@ -277,7 +277,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
corpse_graveyard_timer.Disable();
}
memset(item_tint, 0, sizeof(item_tint));
//memset(item_tint, 0, sizeof(item_tint));
for (i = 0; i < MAX_LOOTERS; i++){
allowed_looters[i] = 0;
@@ -321,7 +321,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
}
// get their tints
memcpy(item_tint, &client->GetPP().item_tint, sizeof(item_tint));
memcpy(&item_tint.Slot, &client->GetPP().item_tint, sizeof(item_tint));
// TODO soulbound items need not be added to corpse, but they need
// to go into the regular slots on the player, out of bags
@@ -502,7 +502,7 @@ in_helmtexture,
if (!zone->HasGraveyard() || wasAtGraveyard)
corpse_graveyard_timer.Disable();
memset(item_tint, 0, sizeof(item_tint));
//memset(item_tint, 0, sizeof(item_tint));
is_corpse_changed = false;
is_player_corpse = true;
@@ -591,7 +591,7 @@ bool Corpse::Save() {
dbpc->helmtexture = this->helmtexture;
dbpc->exp = rez_experience;
memcpy(dbpc->item_tint, item_tint, sizeof(dbpc->item_tint));
memcpy(&dbpc->item_tint.Slot, &item_tint.Slot, sizeof(dbpc->item_tint));
dbpc->haircolor = haircolor;
dbpc->beardcolor = beardcolor;
dbpc->eyecolor2 = eyecolor1;
@@ -1420,9 +1420,7 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
item = database.GetItem(GetEquipment(material_slot));
if(item != NO_ITEM) {
return item_tint[material_slot].RGB.UseTint ?
item_tint[material_slot].Color :
item->Color;
return (item_tint.Slot[material_slot].UseTint ? item_tint.Slot[material_slot].Color : item->Color);
}
return 0;
+1 -1
View File
@@ -154,7 +154,7 @@ private:
Timer corpse_delay_timer;
Timer corpse_graveyard_timer;
Timer loot_cooldown_timer; /* Delay between loot actions on the corpse entity */
Color_Struct item_tint[9];
EQEmu::TintProfile item_tint;
};
+10 -10
View File
@@ -2019,28 +2019,28 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
safe_delete(qspack);
}
void Client::DyeArmor(DyeStruct* dye){
void Client::DyeArmor(EQEmu::TintProfile* dye){
int16 slot=0;
for (int i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTintableTexture; i++) {
if ((m_pp.item_tint[i].Color & 0x00FFFFFF) != (dye->dye[i].Color & 0x00FFFFFF)) {
if ((m_pp.item_tint.Slot[i].Color & 0x00FFFFFF) != (dye->Slot[i].Color & 0x00FFFFFF)) {
slot = m_inv.HasItem(32557, 1, invWherePersonal);
if (slot != INVALID_INDEX){
DeleteItemInInventory(slot,1,true);
uint8 slot2=SlotConvert(i);
ItemInst* inst = this->m_inv.GetItem(slot2);
if(inst){
uint32 armor_color = ((uint32)dye->dye[i].RGB.Red << 16) | ((uint32)dye->dye[i].RGB.Green << 8) | ((uint32)dye->dye[i].RGB.Blue);
uint32 armor_color = ((uint32)dye->Slot[i].Red << 16) | ((uint32)dye->Slot[i].Green << 8) | ((uint32)dye->Slot[i].Blue);
inst->SetColor(armor_color);
database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color);
database.SaveInventory(CharacterID(),inst,slot2);
if(dye->dye[i].RGB.UseTint)
m_pp.item_tint[i].RGB.UseTint = 0xFF;
if(dye->Slot[i].UseTint)
m_pp.item_tint.Slot[i].UseTint = 0xFF;
else
m_pp.item_tint[i].RGB.UseTint=0x00;
m_pp.item_tint.Slot[i].UseTint=0x00;
}
m_pp.item_tint[i].RGB.Blue=dye->dye[i].RGB.Blue;
m_pp.item_tint[i].RGB.Red=dye->dye[i].RGB.Red;
m_pp.item_tint[i].RGB.Green=dye->dye[i].RGB.Green;
m_pp.item_tint.Slot[i].Blue=dye->Slot[i].Blue;
m_pp.item_tint.Slot[i].Red=dye->Slot[i].Red;
m_pp.item_tint.Slot[i].Green=dye->Slot[i].Green;
SendWearChange(i);
}
else{
@@ -2636,7 +2636,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const
const EQEmu::ItemBase *item = database.GetItem(GetEquipment(material_slot));
if(item != nullptr)
return ((m_pp.item_tint[material_slot].RGB.UseTint) ? m_pp.item_tint[material_slot].Color : item->Color);
return ((m_pp.item_tint.Slot[material_slot].UseTint) ? m_pp.item_tint.Slot[material_slot].Color : item->Color);
return 0;
}
+1 -1
View File
@@ -1162,7 +1162,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.equipment[i].Material = GetEquipmentMaterial(i);
ns->spawn.equipment[i].EliteMaterial = IsEliteMaterialItem(i);
ns->spawn.equipment[i].HeroForgeModel = GetHerosForgeModel(i);
ns->spawn.colors[i].Color = GetEquipmentColor(i);
ns->spawn.equipment_tint.Slot[i].Color = GetEquipmentColor(i);
}
}
+25 -25
View File
@@ -1170,10 +1170,10 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile
for (auto row = results.begin(); row != results.end(); ++row) {
r = 0;
i = atoi(row[r]); /* Slot */ r++;
pp->item_tint[i].RGB.Blue = atoi(row[r]); r++;
pp->item_tint[i].RGB.Green = atoi(row[r]); r++;
pp->item_tint[i].RGB.Red = atoi(row[r]); r++;
pp->item_tint[i].RGB.UseTint = atoi(row[r]);
pp->item_tint.Slot[i].Blue = atoi(row[r]); r++;
pp->item_tint.Slot[i].Green = atoi(row[r]); r++;
pp->item_tint.Slot[i].Red = atoi(row[r]); r++;
pp->item_tint.Slot[i].UseTint = atoi(row[r]);
}
return true;
}
@@ -3627,9 +3627,9 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c
dbpc->plat, dbpc->haircolor, dbpc->beardcolor, dbpc->eyecolor1,
dbpc->eyecolor2, dbpc->hairstyle, dbpc->face, dbpc->beard,
dbpc->drakkin_heritage, dbpc->drakkin_tattoo, dbpc->drakkin_details,
dbpc->item_tint[0].Color, dbpc->item_tint[1].Color, dbpc->item_tint[2].Color,
dbpc->item_tint[3].Color, dbpc->item_tint[4].Color, dbpc->item_tint[5].Color,
dbpc->item_tint[6].Color, dbpc->item_tint[7].Color, dbpc->item_tint[8].Color,
dbpc->item_tint.Head.Color, dbpc->item_tint.Chest.Color, dbpc->item_tint.Arms.Color,
dbpc->item_tint.Wrist.Color, dbpc->item_tint.Hands.Color, dbpc->item_tint.Legs.Color,
dbpc->item_tint.Feet.Color, dbpc->item_tint.Primary.Color, dbpc->item_tint.Secondary.Color,
db_id);
auto results = QueryDatabase(query);
@@ -3720,15 +3720,15 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui
dbpc->drakkin_heritage,
dbpc->drakkin_tattoo,
dbpc->drakkin_details,
dbpc->item_tint[0].Color,
dbpc->item_tint[1].Color,
dbpc->item_tint[2].Color,
dbpc->item_tint[3].Color,
dbpc->item_tint[4].Color,
dbpc->item_tint[5].Color,
dbpc->item_tint[6].Color,
dbpc->item_tint[7].Color,
dbpc->item_tint[8].Color
dbpc->item_tint.Head.Color,
dbpc->item_tint.Chest.Color,
dbpc->item_tint.Arms.Color,
dbpc->item_tint.Wrist.Color,
dbpc->item_tint.Hands.Color,
dbpc->item_tint.Legs.Color,
dbpc->item_tint.Feet.Color,
dbpc->item_tint.Primary.Color,
dbpc->item_tint.Secondary.Color
);
auto results = QueryDatabase(query);
uint32 last_insert_id = results.LastInsertedID();
@@ -3900,15 +3900,15 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
pcs->drakkin_heritage = atoul(row[i++]); // drakkin_heritage,
pcs->drakkin_tattoo = atoul(row[i++]); // drakkin_tattoo,
pcs->drakkin_details = atoul(row[i++]); // drakkin_details,
pcs->item_tint[0].Color = atoul(row[i++]); // wc_1,
pcs->item_tint[1].Color = atoul(row[i++]); // wc_2,
pcs->item_tint[2].Color = atoul(row[i++]); // wc_3,
pcs->item_tint[3].Color = atoul(row[i++]); // wc_4,
pcs->item_tint[4].Color = atoul(row[i++]); // wc_5,
pcs->item_tint[5].Color = atoul(row[i++]); // wc_6,
pcs->item_tint[6].Color = atoul(row[i++]); // wc_7,
pcs->item_tint[7].Color = atoul(row[i++]); // wc_8,
pcs->item_tint[8].Color = atoul(row[i++]); // wc_9
pcs->item_tint.Head.Color = atoul(row[i++]); // wc_1,
pcs->item_tint.Chest.Color = atoul(row[i++]); // wc_2,
pcs->item_tint.Arms.Color = atoul(row[i++]); // wc_3,
pcs->item_tint.Wrist.Color = atoul(row[i++]); // wc_4,
pcs->item_tint.Hands.Color = atoul(row[i++]); // wc_5,
pcs->item_tint.Legs.Color = atoul(row[i++]); // wc_6,
pcs->item_tint.Feet.Color = atoul(row[i++]); // wc_7,
pcs->item_tint.Primary.Color = atoul(row[i++]); // wc_8,
pcs->item_tint.Secondary.Color = atoul(row[i++]); // wc_9
}
query = StringFormat(
"SELECT \n"
+1 -1
View File
@@ -169,7 +169,7 @@ struct PlayerCorpse_Struct {
uint32 silver;
uint32 gold;
uint32 plat;
Color_Struct item_tint[9];
EQEmu::TintProfile item_tint;
uint8 haircolor;
uint8 beardcolor;
uint8 eyecolor1;