Beispiel #1
0
    public static ulong FindSkin(int itemID, int skinID)
    {
        ItemDefinition itemDefinition = ItemManager.FindItemDefinition(itemID);

        if (Object.op_Equality((Object)itemDefinition, (Object)null))
        {
            return(0);
        }
        Inventory.Definition definition = ((BaseSteamworks)Global.get_SteamServer()).get_Inventory().FindDefinition(skinID);
        if (definition != null)
        {
            ulong property1 = (ulong)definition.GetProperty <ulong>("workshopdownload");
            if (property1 != 0UL)
            {
                string property2 = (string)definition.GetProperty <string>("itemshortname");
                if (property2 == itemDefinition.shortname || property2 == ((Object)itemDefinition).get_name())
                {
                    return(property1);
                }
            }
        }
        for (int index = 0; index < itemDefinition.skins.Length; ++index)
        {
            if (itemDefinition.skins[index].id == skinID)
            {
                return((ulong)skinID);
            }
        }
        return(0);
    }
    public void GiveDefaultItems()
    {
        this.Strip();
        ulong skin    = 0;
        int   infoInt = this.baseEntity.GetInfoInt("client.rockskin", 0);

        if (infoInt > 0 && this.baseEntity.blueprints.steamInventory.HasItem(infoInt))
        {
            Inventory.Definition definition = ((BaseSteamworks)Global.get_SteamServer()).get_Inventory().FindDefinition(infoInt);
            if (definition != null)
            {
                skin = (ulong)definition.GetProperty <ulong>("workshopdownload");
            }
        }
        this.GiveItem(ItemManager.CreateByName("rock", 1, skin), this.containerBelt);
        this.GiveItem(ItemManager.CreateByName("torch", 1, 0UL), this.containerBelt);
        if (PlayerInventory.IsBirthday())
        {
            this.GiveItem(ItemManager.CreateByName("cakefiveyear", 1, 0UL), this.containerBelt);
            this.GiveItem(ItemManager.CreateByName("partyhat", 1, 0UL), this.containerWear);
        }
        if (!PlayerInventory.IsChristmas())
        {
            return;
        }
        this.GiveItem(ItemManager.CreateByName("snowball", 1, 0UL), this.containerBelt);
        this.GiveItem(ItemManager.CreateByName("snowball", 1, 0UL), this.containerBelt);
        this.GiveItem(ItemManager.CreateByName("snowball", 1, 0UL), this.containerBelt);
    }