//----------------------------------------------- // equip : // Compute the equipmenent worn. //----------------------------------------------- void CPlayerR2CL::equip(SLOTTYPE::EVisualSlot slot, uint index, uint color) { // Get the sheet according to the visual slot _Items[slot].Sheet = SheetMngr.getItem(slot, index); if(_Items[slot].Sheet) { const CItemSheet *item = _Items[slot].Sheet; // If the gender is a female get the right shape. if(_Gender == GSGENDER::female) equip(slot, item->getShapeFemale(), item); // Else get the default shape. else equip(slot, item->getShape(), item); // Check there is a shape. UInstance pInst = _Instances[slot].createLoadingFromCurrent(); if(!pInst.empty()) { // Set the right texture variation (quality). pInst.selectTextureSet((uint)item->MapVariant); _Instances[slot].TextureSet = item->MapVariant; // If Hair, color is for the head slot. if(slot == SLOTTYPE::HEAD_SLOT && item->Family != ITEMFAMILY::ARMOR) applyColorSlot(_Instances[slot], skin(), 0, color, _EyesColor); else { // Set the User Color. if(item->Color == -1) applyColorSlot(_Instances[slot], skin(), color, _HairColor, _EyesColor); // Set the Item Color. else if(item->Color != -2) applyColorSlot(_Instances[slot], skin(), item->Color, _HairColor, _EyesColor); // Else let the default color. else applyColorSlot(_Instances[slot], skin(), 0, _HairColor, _EyesColor); } } } // Default equipment. else { nlwarning("PL:equip(2):%d: VS '%d' default equipement used.", _Slot, slot); //sint idx = SheetMngr.getVSIndex(_PlayerSheet->GenderInfos[_Gender].Items[slot], slot); sint idx = SheetMngr.getVSIndex(getGenderInfo()->Items[slot], slot); if(idx != -1) { if(SheetMngr.getItem(slot, (uint)idx)) { // If the gender is a female get the right shape. if(_Gender == GSGENDER::female) equip(slot, SheetMngr.getItem(slot, (uint)idx)->getShapeFemale()); // Else get the default shape. else equip(slot, SheetMngr.getItem(slot, (uint)idx)->getShape()); } } } }// equip //