internal void CopyToSkeleton(Skeleton skeleton, GameObject parent, Item item) { foreach (SkeletonSkin skeletonSkin in this.SkeletonSkins) { GameObject gameObject1 = new GameObject(); gameObject1.get_transform().set_parent(parent.get_transform()); GameObject gameObject2 = gameObject1; Skeleton skeleton1 = skeleton; skeletonSkin.DuplicateAndRetarget(gameObject2, skeleton1).set_updateWhenOffscreen(true); if (item != null && item.skin > 0UL) { ItemSkinDirectory.Skin skin = ((IEnumerable <ItemSkinDirectory.Skin>)item.info.skins).FirstOrDefault <ItemSkinDirectory.Skin>((Func <ItemSkinDirectory.Skin, bool>)(x => (long)x.id == (long)item.skin)); if (skin.id == 0 && item.skin > 0UL) { WorkshopSkin.Apply(gameObject1, item.skin, (Action)null); break; } if ((long)skin.id != (long)item.skin) { break; } ItemSkin invItem = skin.invItem as ItemSkin; if (Object.op_Equality((Object)invItem, (Object)null)) { break; } invItem.ApplySkin(gameObject1); } } }
private static void TrySkinChangeItem(ref ItemDefinition template, ref ulong skinId) { if (skinId == 0L) { return; } ItemSkinDirectory.Skin skin = ItemSkinDirectory.FindByInventoryDefinitionId((int)skinId); if (skin.id != 0) { ItemSkin itemSkin = skin.invItem as ItemSkin; if (!(itemSkin == null) && !(itemSkin.Redirect == null)) { template = itemSkin.Redirect; skinId = 0uL; } } }
internal void CopyToSkeleton(Skeleton skeleton, GameObject parent, Item item) { Func <ItemSkinDirectory.Skin, bool> func = null; SkeletonSkin[] skeletonSkins = this.SkeletonSkins; for (int i = 0; i < (int)skeletonSkins.Length; i++) { SkeletonSkin skeletonSkin = skeletonSkins[i]; GameObject gameObject = new GameObject(); gameObject.transform.parent = parent.transform; skeletonSkin.DuplicateAndRetarget(gameObject, skeleton).updateWhenOffscreen = true; if (item != null && item.skin > (long)0) { ItemSkinDirectory.Skin[] skinArray = item.info.skins; Func <ItemSkinDirectory.Skin, bool> func1 = func; if (func1 == null) { Func <ItemSkinDirectory.Skin, bool> func2 = (ItemSkinDirectory.Skin x) => (long)x.id == item.skin; Func <ItemSkinDirectory.Skin, bool> func3 = func2; func = func2; func1 = func3; } ItemSkinDirectory.Skin skin = ((IEnumerable <ItemSkinDirectory.Skin>)skinArray).FirstOrDefault <ItemSkinDirectory.Skin>(func1); if (skin.id == 0 && item.skin > (long)0) { Rust.Workshop.WorkshopSkin.Apply(gameObject, item.skin, null); return; } if ((long)skin.id != item.skin) { return; } ItemSkin itemSkin = skin.invItem as ItemSkin; if (itemSkin == null) { return; } itemSkin.ApplySkin(gameObject); } } }
public bool HasUnlocked(ItemDefinition targetItem) { int i; if (!targetItem.Blueprint || !targetItem.Blueprint.NeedsSteamItem) { int[] numArray = ItemManager.defaultBlueprints; for (i = 0; i < (int)numArray.Length; i++) { if (numArray[i] == targetItem.itemid) { return(true); } } if (!base.baseEntity.isServer) { return(false); } return(this.IsUnlocked(targetItem)); } if (targetItem.steamItem != null && !this.steamInventory.HasItem(targetItem.steamItem.id)) { return(false); } if (targetItem.steamItem == null) { bool flag = false; ItemSkinDirectory.Skin[] skinArray = targetItem.skins; i = 0; while (i < (int)skinArray.Length) { ItemSkinDirectory.Skin skin = skinArray[i]; if (!this.steamInventory.HasItem(skin.id)) { i++; } else { flag = true; break; } } if (!flag && targetItem.skins2 != null) { InventoryDef[] inventoryDefArray = targetItem.skins2; i = 0; while (i < (int)inventoryDefArray.Length) { InventoryDef inventoryDef = inventoryDefArray[i]; if (!this.steamInventory.HasItem(inventoryDef.Id)) { i++; } else { flag = true; break; } } } if (!flag) { return(false); } } return(true); }