Seems that armor color is sent in Bot::FillSpawnStruct:
Code:
void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(ns) {
Mob::FillSpawnStruct(ns, ForWho);
ns->spawn.afk = 0;
ns->spawn.lfg = 0;
ns->spawn.anon = 0;
ns->spawn.gm = 0;
if(IsInAGuild())
ns->spawn.guildID = GuildID();
else
ns->spawn.guildID = 0xFFFFFFFF; // 0xFFFFFFFF = NO GUILD, 0 = Unknown Guild
ns->spawn.is_npc = 0; // 0=no, 1=yes
ns->spawn.is_pet = 0;
ns->spawn.guildrank = 0;
ns->spawn.showhelm = 1;
ns->spawn.flymode = 0;
ns->spawn.size = 0;
ns->spawn.NPC = 0; // 0=player,1=npc,2=pc corpse,3=npc corpse
ns->spawn.helm = helmtexture; //0xFF;
ns->spawn.equip_chest2 = texture; //0xFF;
const Item_Struct* item = 0;
const ItemInst* inst = 0;
uint32 spawnedbotid = 0;
spawnedbotid = this->GetBotID();
inst = GetBotItem(MainHands);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialHands] = item->Material;
ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands);
}
}
inst = GetBotItem(MainHead);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialHead] = item->Material;
ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead);
}
}
inst = GetBotItem(MainArms);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialArms] = item->Material;
ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms);
}
}
inst = GetBotItem(MainWrist1);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialWrist] = item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
}
/*
// non-live behavior
inst = GetBotItem(MainWrist2);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialWrist] = item->Material;
ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist);
}
}
*/
inst = GetBotItem(MainChest);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialChest] = item->Material;
ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest);
}
}
inst = GetBotItem(MainLegs);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialLegs] = item->Material;
ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs);
}
}
inst = GetBotItem(MainFeet);
if(inst) {
item = inst->GetItem();
if(item) {
ns->spawn.equipment[MaterialFeet] = item->Material;
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
}
}
inst = GetBotItem(MainPrimary);
if(inst) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
}
}
inst = GetBotItem(MainSecondary);
if(inst) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
}
}
}
}
And the code for Bot::GetEquipmentColor looks like this:
Code:
uint32 Bot::GetEquipmentColor(uint8 material_slot) const
{
//Bot tints
uint32 slotid = 0;
uint32 returncolor = 0;
uint32 botid = this->GetBotID();
//Translate code slot # to DB slot #
slotid = Inventory::CalcSlotFromMaterial(material_slot);
//read from db
char* Query = 0;
MYSQL_RES* DatasetResult;
MYSQL_ROW DataRow;
if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
if(mysql_num_rows(DatasetResult) == 1) {
DataRow = mysql_fetch_row(DatasetResult);
if(DataRow)
returncolor = atoul(DataRow[0]);
}
mysql_free_result(DatasetResult);
safe_delete_array(Query);
}
return returncolor;
}
In this the default is 0 which is what armor would be if the color of the armor in the database hadn't been set otherwise, which is weird as to why the bot's armor would have a green color with a value of 0. Is this done differently in for clients? Could this difference be causing the color issue? I'll need to look at the client color code to see, hope this helps a bit.
Edit: Maybe 0 isn't a good default value as 4278190080 shows as colorless or "white".