Esempio n. 1
0
        public void SaveCharacterApperance(Client sender, params object[] args)
        {
            ClothingData cData = new ClothingData
            {
                Head      = Convert.ToInt32(args[0]),
                Eyes      = Convert.ToInt32(args[1]),
                Hair      = Convert.ToInt32(args[2]),
                HairColor = Convert.ToInt32(args[3]),
            };

            API.shared.setEntityData(sender, nameof(User.ClothingData), cData);
            db_Accounts.SavePlayerAccount(sender);
            sender.dimension = API.getEntityData(sender, "Dimension");
            sender.position  = API.getEntityData(sender, "LastPosition");
            sender.freeze(false);
            sender.SetLoggedIn(true);
            sender
            .SetSkinByGender()
            .UnwearTops()
            .UnwearPants()
            .UnwearShoes()
            .ApplyApperance(cData);

            InventoryManager.LoadPlayerEquippedItems(sender);
            UserManager.LoadPlayerStats(sender);
        }
Esempio n. 2
0
    private SpriteData SetUpSheetForClothingData(ClothingData clothingData)
    {
        var SpriteInfos = new SpriteData();

        SpriteInfos.List = new List <List <List <SpriteHandler.SpriteInfo> > >();
        int c = 0;

        SpriteInfos.List.Add(SpriteFunctions.CompleteSpriteSetup(clothingData.Base.Equipped));
        variantStore[ClothingVariantType.Default] = c;
        c++;

        if (clothingData.Base_Adjusted.Equipped.Texture != null)
        {
            SpriteInfos.List.Add(SpriteFunctions.CompleteSpriteSetup(clothingData.Base_Adjusted.Equipped));
            variantStore[ClothingVariantType.Tucked] = c;
            c++;
        }

        if (clothingData.DressVariant.Equipped.Texture != null)
        {
            SpriteInfos.List.Add(SpriteFunctions.CompleteSpriteSetup(clothingData.DressVariant.Equipped));
            variantStore[ClothingVariantType.Skirt] = c;
            c++;
        }
        if (clothingData.Variants.Count > 0)
        {
            foreach (var Variant in clothingData.Variants)
            {
                SpriteInfos.List.Add(SpriteFunctions.CompleteSpriteSetup(Variant.Equipped));
                variantStore[ClothingVariantType.Skirt] = c;
                c++;
            }
        }
        return(SpriteInfos);
    }
Esempio n. 3
0
    public void SyncFindData(string syncString)
    {
        if (string.IsNullOrEmpty(syncString))
        {
            return;
        }

        SynchronisedString = syncString;
        if (ClothFactory.Instance.ClothingStoredData.ContainsKey(syncString))
        {
            clothingData = ClothFactory.Instance.ClothingStoredData[syncString];
            TryInit();
        }
        else if (ClothFactory.Instance.BackpackStoredData.ContainsKey(syncString))
        {
            containerData = ClothFactory.Instance.BackpackStoredData[syncString];
            TryInit();
        }
        else if (ClothFactory.Instance.HeadSetStoredData.ContainsKey(syncString))
        {
            headsetData = ClothFactory.Instance.HeadSetStoredData[syncString];
            TryInit();
        }
        else
        {
            Logger.LogError($"No Cloth Data found for {syncString}", Category.SpriteHandler);
        }
    }
Esempio n. 4
0
 public void GatherData()
 {
     PlayerCustomisationData.getPlayerCustomisationDatas(DataPCD);
     ClothingData.getClothingDatas(DataClothingData);
     ContainerData.getContainerData(DataContainerData);
     HeadsetData.getHeadsetData(DataHeadsetData);
     PlayerTextureData.getClothingDatas(DataRaceData);
 }
Esempio n. 5
0
    private static GameObject CreateCloth(ClothingData ClothingData, Vector3?worldPos = null, Transform parent = null,
                                          ClothingVariantType CVT = ClothingVariantType.Default, int variant   = -1, GameObject PrefabOverride = null)
    {
        if (uniCloth == null)
        {
            uniCloth = GetPrefabByName("UniCloth");
        }
        if (uniCloth == null)
        {
            Logger.LogError("UniCloth Prefab not found", Category.SpriteHandler);
            return(null);
        }

        GameObject clothObj;

        if (PrefabOverride != null && PrefabOverride != uniCloth)
        {
            clothObj = Spawn.ServerPrefab(PrefabOverride, worldPos, parent).GameObject;
        }
        else
        {
            clothObj = Spawn.ServerPrefab(uniCloth, worldPos, parent).GameObject;
        }

        var _Clothing = clothObj.GetComponent <Clothing>();
        var Item      = clothObj.GetComponent <ItemAttributes>();

        _Clothing.SpriteInfo = StaticSpriteHandler.SetUpSheetForClothingData(ClothingData, _Clothing);
        _Clothing.SetSynchronise(CD: ClothingData);
        Item.SetUpFromClothingData(ClothingData.Base, ClothingData.ItemAttributes);
        switch (CVT)
        {
        case ClothingVariantType.Default:
            if (variant > -1)
            {
                if (!(ClothingData.Variants.Count >= variant))
                {
                    Item.SetUpFromClothingData(ClothingData.Variants[variant], ClothingData.ItemAttributes);
                }
            }

            break;

        case ClothingVariantType.Skirt:
            Item.SetUpFromClothingData(ClothingData.DressVariant, ClothingData.ItemAttributes);
            break;

        case ClothingVariantType.Tucked:
            Item.SetUpFromClothingData(ClothingData.Base_Adjusted, ClothingData.ItemAttributes);
            break;
        }

        clothObj.name = ClothingData.name;
        return(clothObj);
    }
Esempio n. 6
0
        public bool CanWearClothing(int value)
        {
            ClothingData clothingData = ClothingBlock.GetClothingData(Terrain.ExtractData(value));
            IList <int>  list         = GetClothes(clothingData.Slot);

            if (list.Count == 0)
            {
                return(true);
            }
            ClothingData clothingData2 = ClothingBlock.GetClothingData(Terrain.ExtractData(list[list.Count - 1]));

            return(clothingData.Layer > clothingData2.Layer);
        }
Esempio n. 7
0
 public void SetSynchronise(ClothingData CD = null, ContainerData ConD = null, HeadsetData HD = null)
 {
     if (CD != null)
     {
         SynchronisedString = CD.name;
         clothingData       = CD;
     }
     else if (ConD != null)
     {
         SynchronisedString = ConD.name;
         containerData      = ConD;
     }
     else if (HD != null)
     {
         SynchronisedString = HD.name;
         headsetData        = HD;
     }
 }
Esempio n. 8
0
        public async Task OnGetAsync(int?id, int?categoryID)
        {
            ClothingD = new ClothingData();

            ClothingD.Clothes = await _context.Clothing
                                .Include(b => b.Brand)
                                .Include(b => b.ClothingCategories)
                                .ThenInclude(b => b.Category)
                                .AsNoTracking()
                                .OrderBy(b => b.Name)
                                .ToListAsync();

            if (id != null)
            {
                ClothingID = id.Value;
                Clothing clothing = ClothingD.Clothes
                                    .Where(i => i.ID == id.Value).Single();
                ClothingD.Categories = clothing.ClothingCategories.Select(s => s.Category);
            }
        }
    /// <summary>
    /// Initializes it to display the document
    /// </summary>
    /// <param name="resultDoc">document to display</param>
    public void Initialize(Document resultDoc)
    {
        if (resultDoc.Get("isClothing").Equals("0"))
        {
            prefab = PoolManager.GetPrefabByName(resultDoc.Get("name"));
            Sprite toUse = prefab.GetComponentInChildren <SpriteRenderer>()?.sprite;
            if (toUse != null)
            {
                image.sprite = toUse;
            }

            detailText.text = "Prefab";
        }
        else
        {
            var newClothingData = ClothFactory.Instance.ClothingStoredData[resultDoc.Get("name")];
            detailText.text = $"{newClothingData.name}";
            clothingData    = newClothingData;
            image.sprite    = newClothingData.Base.ItemIcon.Sprites[0];
        }
        titleText.text = resultDoc.Get("name");
    }
Esempio n. 10
0
        public void ProcessSlotItems(int slotIndex, int value, int count, int processCount, out int processedValue, out int processedCount)
        {
            processedCount = 0;
            processedValue = 0;
            if (processCount != 1)
            {
                return;
            }
            Block block = BlocksManager.Blocks[Terrain.ExtractContents(value)];

            if (block.GetNutritionalValue(value) > 0f)
            {
                if (block is BucketBlock)
                {
                    processedValue = Terrain.MakeBlockValue(90, 0, Terrain.ExtractData(value));
                    processedCount = 1;
                }
                if (count > 1 && processedCount > 0 && processedValue != value)
                {
                    processedValue = value;
                    processedCount = processCount;
                }
                else if (!m_componentVitalStats.Eat(value))
                {
                    processedValue = value;
                    processedCount = processCount;
                }
            }
            if (block is ClothingBlock)
            {
                ClothingData clothingData = ClothingBlock.GetClothingData(Terrain.ExtractData(value));
                List <int>   list         = new List <int>(GetClothes(clothingData.Slot));
                list.Add(value);
                SetClothes(clothingData.Slot, list);
            }
        }
Esempio n. 11
0
 public void UpdateRenderTargets()
 {
     if (m_skinTexture == null || m_componentPlayer.PlayerData.CharacterSkinName != m_skinTextureName)
     {
         m_skinTexture     = CharacterSkinsManager.LoadTexture(m_componentPlayer.PlayerData.CharacterSkinName);
         m_skinTextureName = m_componentPlayer.PlayerData.CharacterSkinName;
         Utilities.Dispose(ref m_innerClothedTexture);
         Utilities.Dispose(ref m_outerClothedTexture);
     }
     if (m_innerClothedTexture == null || m_innerClothedTexture.Width != m_skinTexture.Width || m_innerClothedTexture.Height != m_skinTexture.Height)
     {
         m_innerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, ColorFormat.Rgba8888, DepthFormat.None);
         m_componentHumanModel.TextureOverride = m_innerClothedTexture;
         m_clothedTexturesValid = false;
     }
     if (m_outerClothedTexture == null || m_outerClothedTexture.Width != m_skinTexture.Width || m_outerClothedTexture.Height != m_skinTexture.Height)
     {
         m_outerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, ColorFormat.Rgba8888, DepthFormat.None);
         m_componentOuterClothingModel.TextureOverride = m_outerClothedTexture;
         m_clothedTexturesValid = false;
     }
     if (DrawClothedTexture && !m_clothedTexturesValid)
     {
         m_clothedTexturesValid = true;
         Rectangle      scissorRectangle = Display.ScissorRectangle;
         RenderTarget2D renderTarget     = Display.RenderTarget;
         try
         {
             Display.RenderTarget = m_innerClothedTexture;
             Display.Clear(new Vector4(Color.Transparent));
             int             num             = 0;
             TexturedBatch2D texturedBatch2D = m_primitivesRenderer.TexturedBatch(m_skinTexture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp);
             texturedBatch2D.QueueQuad(Vector2.Zero, new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, Color.White);
             ClothingSlot[] innerSlotsOrder = m_innerSlotsOrder;
             foreach (ClothingSlot slot in innerSlotsOrder)
             {
                 foreach (int clothe in GetClothes(slot))
                 {
                     int          data         = Terrain.ExtractData(clothe);
                     MekClothData clothingData = MekClothingBlock.GetClothingData(data);
                     Color        fabricColor  = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data));
                     texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp);
                     if (!clothingData.IsOuter)
                     {
                         texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor);
                     }
                 }
             }
             m_primitivesRenderer.Flush();
             Display.RenderTarget = m_outerClothedTexture;
             Display.Clear(new Vector4(Color.Transparent));
             num             = 0;
             innerSlotsOrder = m_outerSlotsOrder;
             foreach (ClothingSlot slot2 in innerSlotsOrder)
             {
                 foreach (int clothe2 in GetClothes(slot2))
                 {
                     int          data2         = Terrain.ExtractData(clothe2);
                     ClothingData clothingData2 = ClothingBlock.GetClothingData(data2);
                     Color        fabricColor2  = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data2));
                     texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData2.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp);
                     if (clothingData2.IsOuter)
                     {
                         texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_outerClothedTexture.Width, m_outerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor2);
                     }
                 }
             }
             m_primitivesRenderer.Flush();
         }
         finally
         {
             Display.RenderTarget     = renderTarget;
             Display.ScissorRectangle = scissorRectangle;
         }
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Create a dev spawner document representing the specified clothing
 /// </summary>
 /// <param name="data"></param>
 public static DevSpawnerDocument ForClothing(ClothingData data)
 {
     return(new DevSpawnerDocument(data.name, SpawnableType.CLOTHING_DATA));
 }
Esempio n. 13
0
 public static Client ApplyApperance(this Client player, ClothingData data)
 {
     player.setClothes(0, data.Head, 0);
     player.setClothes(2, data.Hair, data.HairColor);
     return(player);
 }