Advertisement
expired6978

Update equipment

Jun 9th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1.         Actor * actor = DYNAMIC_CAST(thisObj, TESForm, Actor);
  2.         if(actor) {
  3.  
  4.             TESNPC * actorBase = DYNAMIC_CAST(actor->baseForm, TESForm, TESNPC);
  5.             if(actorBase) {
  6.                 actorBase->skinForm.skin = (TESObjectARMO*)LookupFormByID(0x7EF20FB4);
  7.             }
  8.  
  9.             if(actor->unk300) {
  10.                 ActorEquipData * equipData[2];
  11.                 equipData[0] = actor->equipData;
  12.                 equipData[1] = actor == (*g_player) ? (*g_player)->playerEquipData : nullptr;
  13.  
  14.                 for(UInt32 s = 0; s < (actor == (*g_player) ? 2 : 1); s++)
  15.                 {
  16.                     if(equipData[s])
  17.                     {
  18.                         for(UInt32 i = 0; i < 31; ++i)
  19.                         {
  20.                             NiPointer<NiAVObject> slotNode(equipData[s]->slots[i].node);
  21.                             if(slotNode)
  22.                             {
  23.  
  24.                                 bool hasSkinChildren = VisitObjects(slotNode, [&](NiAVObject * node)
  25.                                 {
  26.                                     BSTriShape * trishape = node->GetAsBSTriShape();
  27.                                     if(trishape) {
  28.                                         BSLightingShaderProperty * shaderProperty = ni_cast(trishape->shaderProperty, BSLightingShaderProperty);
  29.                                         if(shaderProperty) {
  30.                                             BSLightingShaderMaterialBase * newMaterial = static_cast<BSLightingShaderMaterialBase *>(shaderProperty->shaderMaterial);
  31.                                             if(newMaterial->GetType() == BSLightingShaderMaterialBase::kType_SkinTint) {
  32.                                                 return true;
  33.                                             }
  34.                                         }
  35.                                     }
  36.                                     return false;
  37.                                 });
  38.  
  39.                                 if(hasSkinChildren)
  40.                                 {
  41.                                     NiPointer<NiNode> parent(slotNode->m_parent);
  42.                                     if(parent) {
  43.                                         parent->Remove(slotNode);
  44.                                     }
  45.                                 }
  46.                             }
  47.                         }
  48.                     }
  49.                 }
  50.  
  51.                 CALL_MEMBER_FN(actor->unk300, UpdateEquipment)(actor, 0x11);
  52.             }
  53.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement