4141#include < filesystem>
4242#include < fstream>
4343
44+
4445using json = nlohmann::json;
4546
4647namespace GUI ::StickerInspect
@@ -424,6 +425,7 @@ void RunInGameInspect(std::string& protoData)
424425 i--;
425426 }
426427
428+
427429 size_t stickerIndex = 0 ;
428430 for (auto & sticker : itemPreviewPB.stickers ())
429431 {
@@ -449,6 +451,30 @@ void RunInGameInspect(std::string& protoData)
449451 stickerIndex++;
450452 }
451453
454+ // lovely, valve literally jsut copy pasted everything from stickers
455+ size_t chainIndex = 0 ;
456+ for (auto & chain : itemPreviewPB.keychains ())
457+ {
458+ const int stickerID = chain.sticker_id ();
459+ const int schema = chain.slot ();
460+ std::string stickerPrefix = " keychain slot " + std::to_string (chainIndex);
461+
462+ g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), (stickerPrefix + " id" ).c_str (), *((float *)&stickerID));
463+
464+ if (chain.has_offset_x () && chain.offset_x () != 0 )
465+ g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), (stickerPrefix + " offset x" ).c_str (), chain.offset_x ());
466+
467+ if (chain.has_offset_y () && chain.offset_y () != 0 )
468+ g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), (stickerPrefix + " offset y" ).c_str (), chain.offset_y ());
469+
470+ if (chain.has_offset_z () && chain.offset_z () != 0 )
471+ g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), (stickerPrefix + " offset z" ).c_str (), chain.offset_z ());
472+
473+ if (chain.has_pattern () && chain.pattern () != 0 )
474+ g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), (stickerPrefix + " pattern" ).c_str (), chain.pattern ());
475+ chainIndex++;
476+ }
477+
452478 g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), " set item texture prefab" , itemPreviewPB.paintindex ());
453479 g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), " set item texture wear" , itemPreviewPB.paintwear ());
454480 g_pSetAttribute (econItem.m_NetworkedDynamicAttributes (), " set item texture seed" , itemPreviewPB.paintseed ());
@@ -459,19 +485,8 @@ void RunInGameInspect(std::string& protoData)
459485 if (legacyMapIt != g_LegacyModelMap.end ())
460486 isLegacyModel = legacyMapIt->second ;
461487
488+ // if paint skin is visible on ground but not in hands its likely because the weapon was spawned before items game keyvalues was parsed as it parses only the items_game_workshop file that does not exist before compiling a skin
462489 ((CSkeletonInstance*)(weapon->m_CBodyComponent ()->m_pSceneNode ()))->m_modelState ().m_MeshGroupMask = isLegacyModel ? 2 : 1 ;
463-
464- CCSPlayer_ViewModelServices* pViewModelServices =
465- pawn->m_pViewModelServices ();
466-
467- if (!pViewModelServices) continue ;
468-
469- CBaseViewModel* pViewModel =
470- pViewModelServices->m_hViewModel ()[0 ].Get ();
471-
472- if (!pViewModel) continue ;
473-
474- ((CSkeletonInstance*)(pViewModel->m_CBodyComponent ()->m_pSceneNode ()))->m_modelState ().m_MeshGroupMask = isLegacyModel ? 2 : 1 ;
475490 }
476491 });
477492}
0 commit comments