private static void onClickedSkillset(SleekButton button)
 {
     Characters.skillify((EPlayerSkillset)(button.positionOffset_Y / 40));
 }
 private static void onTypedNameField(SleekField field, string text)
 {
     Characters.rename(text);
 }
 private static void onTypedNickField(SleekField field, string text)
 {
     Characters.renick(text);
 }
Ejemplo n.º 4
0
 public static void paintSkin(Color color)
 {
     Characters.active.skin = color;
     Characters.apply(false, false);
 }
Ejemplo n.º 5
0
 public static void paintColor(Color color)
 {
     Characters.active.color = color;
     Characters.apply(false, false);
 }
Ejemplo n.º 6
0
 public static void growHair(byte hair)
 {
     Characters.active.hair = hair;
     Characters.apply(false, false);
 }
Ejemplo n.º 7
0
 public static void growBeard(byte beard)
 {
     Characters.active.beard = beard;
     Characters.apply(false, false);
 }
Ejemplo n.º 8
0
        public static void load()
        {
            Characters.initialApply = false;
            Provider.provider.economyService.refreshInventory();
            if (Characters.list != null)
            {
                byte b = 0;
                while ((int)b < Characters.list.Length)
                {
                    if (Characters.list[(int)b] != null)
                    {
                        if (Characters.onCharacterUpdated != null)
                        {
                            Characters.onCharacterUpdated(b, Characters.list[(int)b]);
                        }
                    }
                    b += 1;
                }
                return;
            }
            Characters.list          = new Character[(int)(Customization.FREE_CHARACTERS + Customization.PRO_CHARACTERS)];
            Characters._packageSkins = new List <ulong>();
            if (ReadWrite.fileExists("/Characters.dat", true))
            {
                Block block = ReadWrite.readBlock("/Characters.dat", true, 0);
                if (block != null)
                {
                    byte b2 = block.readByte();
                    if (b2 >= 12)
                    {
                        if (b2 >= 14)
                        {
                            ushort num = block.readUInt16();
                            for (ushort num2 = 0; num2 < num; num2 += 1)
                            {
                                ulong num3 = block.readUInt64();
                                if (num3 != 0UL)
                                {
                                    Characters.packageSkins.Add(num3);
                                }
                            }
                        }
                        Characters._selected = block.readByte();
                        if (!Provider.isPro && Characters.selected >= Customization.FREE_CHARACTERS)
                        {
                            Characters._selected = 0;
                        }
                        byte b3 = 0;
                        while ((int)b3 < Characters.list.Length)
                        {
                            ushort newShirt           = block.readUInt16();
                            ushort newPants           = block.readUInt16();
                            ushort newHat             = block.readUInt16();
                            ushort newBackpack        = block.readUInt16();
                            ushort newVest            = block.readUInt16();
                            ushort newMask            = block.readUInt16();
                            ushort newGlasses         = block.readUInt16();
                            ulong  newPackageShirt    = block.readUInt64();
                            ulong  newPackagePants    = block.readUInt64();
                            ulong  newPackageHat      = block.readUInt64();
                            ulong  newPackageBackpack = block.readUInt64();
                            ulong  newPackageVest     = block.readUInt64();
                            ulong  newPackageMask     = block.readUInt64();
                            ulong  newPackageGlasses  = block.readUInt64();
                            ushort newPrimaryItem     = block.readUInt16();
                            byte[] newPrimaryState    = block.readByteArray();
                            ushort newSecondaryItem   = block.readUInt16();
                            byte[] newSecondaryState  = block.readByteArray();
                            byte   b4      = block.readByte();
                            byte   b5      = block.readByte();
                            byte   b6      = block.readByte();
                            Color  color   = block.readColor();
                            Color  color2  = block.readColor();
                            bool   newHand = block.readBoolean();
                            string newName = block.readString();
                            if (b2 < 19)
                            {
                                newName = Provider.clientName;
                            }
                            string   newNick  = block.readString();
                            CSteamID csteamID = block.readSteamID();
                            byte     b7       = block.readByte();
                            if (!Provider.provider.communityService.checkGroup(csteamID))
                            {
                                csteamID = CSteamID.Nil;
                            }
                            if (b7 >= Customization.SKILLSETS)
                            {
                                b7 = 0;
                            }
                            if (b2 < 16)
                            {
                                b7 = (byte)Random.Range(1, (int)Customization.SKILLSETS);
                            }
                            if (b2 > 16 && b2 < 20)
                            {
                                block.readBoolean();
                            }
                            if (!Provider.isPro)
                            {
                                if (b4 >= Customization.FACES_FREE)
                                {
                                    b4 = (byte)Random.Range(0, (int)Customization.FACES_FREE);
                                }
                                if (b5 >= Customization.HAIRS_FREE)
                                {
                                    b5 = (byte)Random.Range(0, (int)Customization.HAIRS_FREE);
                                }
                                if (b6 >= Customization.BEARDS_FREE)
                                {
                                    b6 = 0;
                                }
                                if (!Customization.checkSkin(color))
                                {
                                    color = Customization.SKINS[Random.Range(0, Customization.SKINS.Length)];
                                }
                                if (!Customization.checkColor(color2))
                                {
                                    color2 = Customization.COLORS[Random.Range(0, Customization.COLORS.Length)];
                                }
                            }
                            Characters.list[(int)b3] = new Character(newShirt, newPants, newHat, newBackpack, newVest, newMask, newGlasses, newPackageShirt, newPackagePants, newPackageHat, newPackageBackpack, newPackageVest, newPackageMask, newPackageGlasses, newPrimaryItem, newPrimaryState, newSecondaryItem, newSecondaryState, b4, b5, b6, color, color2, newHand, newName, newNick, csteamID, (EPlayerSkillset)b7);
                            if (Characters.onCharacterUpdated != null)
                            {
                                Characters.onCharacterUpdated(b3, Characters.list[(int)b3]);
                            }
                            b3 += 1;
                        }
                    }
                    else
                    {
                        byte b8 = 0;
                        while ((int)b8 < Characters.list.Length)
                        {
                            Characters.list[(int)b8] = new Character();
                            if (Characters.onCharacterUpdated != null)
                            {
                                Characters.onCharacterUpdated(b8, Characters.list[(int)b8]);
                            }
                            b8 += 1;
                        }
                    }
                }
            }
            else
            {
                Characters._selected = 0;
            }
            byte b9 = 0;

            while ((int)b9 < Characters.list.Length)
            {
                if (Characters.list[(int)b9] == null)
                {
                    Characters.list[(int)b9] = new Character();
                    if (Characters.onCharacterUpdated != null)
                    {
                        Characters.onCharacterUpdated(b9, Characters.list[(int)b9]);
                    }
                }
                b9 += 1;
            }
            Characters.apply();
            Characters.hasLoaded = true;
        }
Ejemplo n.º 9
0
 public static void growFace(byte face)
 {
     Characters.active.face = face;
     Characters.apply(false, false);
 }
Ejemplo n.º 10
0
 private static void onInventoryRefreshed()
 {
     if (Characters.clothes != null && Characters.list != null && Characters.packageSkins != null)
     {
         for (int i = Characters.packageSkins.Count - 1; i >= 0; i--)
         {
             ulong num = Characters.packageSkins[i];
             if (num != 0UL && Provider.provider.economyService.getInventoryItem(num) == 0)
             {
                 Characters.packageSkins.RemoveAt(i);
             }
         }
         for (int j = 0; j < Characters.list.Length; j++)
         {
             Character character = Characters.list[j];
             if (character != null)
             {
                 if (character.packageShirt != 0UL && Provider.provider.economyService.getInventoryItem(character.packageShirt) == 0)
                 {
                     character.packageShirt = 0UL;
                 }
                 if (character.packagePants != 0UL && Provider.provider.economyService.getInventoryItem(character.packagePants) == 0)
                 {
                     character.packagePants = 0UL;
                 }
                 if (character.packageHat != 0UL && Provider.provider.economyService.getInventoryItem(character.packageHat) == 0)
                 {
                     character.packageHat = 0UL;
                 }
                 if (character.packageBackpack != 0UL && Provider.provider.economyService.getInventoryItem(character.packageBackpack) == 0)
                 {
                     character.packageBackpack = 0UL;
                 }
                 if (character.packageVest != 0UL && Provider.provider.economyService.getInventoryItem(character.packageVest) == 0)
                 {
                     character.packageVest = 0UL;
                 }
                 if (character.packageMask != 0UL && Provider.provider.economyService.getInventoryItem(character.packageMask) == 0)
                 {
                     character.packageMask = 0UL;
                 }
                 if (character.packageGlasses != 0UL && Provider.provider.economyService.getInventoryItem(character.packageGlasses) == 0)
                 {
                     character.packageGlasses = 0UL;
                 }
             }
         }
         if (!Characters.initialApply)
         {
             Characters.initialApply = true;
             Characters.apply();
         }
     }
     if (Characters.hasDropped)
     {
         return;
     }
     Characters.hasDropped = true;
     if (Characters.hasPlayed)
     {
         Provider.provider.economyService.dropInventory();
     }
 }
Ejemplo n.º 11
0
        public static void apply(bool showItems, bool showCosmetics)
        {
            if (Characters.active == null)
            {
                Debug.LogError("Failed to find an active character.");
                return;
            }
            if (Characters.clothes == null)
            {
                Debug.LogError("Failed to find character clothes.");
                return;
            }
            Characters.character.localScale = new Vector3((float)((!Characters.active.hand) ? 1 : -1), 1f, 1f);
            if (showItems)
            {
                Characters.clothes.shirt    = Characters.active.shirt;
                Characters.clothes.pants    = Characters.active.pants;
                Characters.clothes.hat      = Characters.active.hat;
                Characters.clothes.backpack = Characters.active.backpack;
                Characters.clothes.vest     = Characters.active.vest;
                Characters.clothes.mask     = Characters.active.mask;
                Characters.clothes.glasses  = Characters.active.glasses;
            }
            else
            {
                Characters.clothes.shirt    = 0;
                Characters.clothes.pants    = 0;
                Characters.clothes.hat      = 0;
                Characters.clothes.backpack = 0;
                Characters.clothes.vest     = 0;
                Characters.clothes.mask     = 0;
                Characters.clothes.glasses  = 0;
            }
            if (showCosmetics)
            {
                if (Characters.active.packageShirt != 0UL)
                {
                    Characters.clothes.visualShirt = Provider.provider.economyService.getInventoryItem(Characters.active.packageShirt);
                }
                else
                {
                    Characters.clothes.visualShirt = 0;
                }
                if (Characters.active.packagePants != 0UL)
                {
                    Characters.clothes.visualPants = Provider.provider.economyService.getInventoryItem(Characters.active.packagePants);
                }
                else
                {
                    Characters.clothes.visualPants = 0;
                }
                if (Characters.active.packageHat != 0UL)
                {
                    Characters.clothes.visualHat = Provider.provider.economyService.getInventoryItem(Characters.active.packageHat);
                }
                else
                {
                    Characters.clothes.visualHat = 0;
                }
                if (Characters.active.packageBackpack != 0UL)
                {
                    Characters.clothes.visualBackpack = Provider.provider.economyService.getInventoryItem(Characters.active.packageBackpack);
                }
                else
                {
                    Characters.clothes.visualBackpack = 0;
                }
                if (Characters.active.packageVest != 0UL)
                {
                    Characters.clothes.visualVest = Provider.provider.economyService.getInventoryItem(Characters.active.packageVest);
                }
                else
                {
                    Characters.clothes.visualVest = 0;
                }
                if (Characters.active.packageMask != 0UL)
                {
                    Characters.clothes.visualMask = Provider.provider.economyService.getInventoryItem(Characters.active.packageMask);
                }
                else
                {
                    Characters.clothes.visualMask = 0;
                }
                if (Characters.active.packageGlasses != 0UL)
                {
                    Characters.clothes.visualGlasses = Provider.provider.economyService.getInventoryItem(Characters.active.packageGlasses);
                }
                else
                {
                    Characters.clothes.visualGlasses = 0;
                }
            }
            else
            {
                Characters.clothes.visualShirt    = 0;
                Characters.clothes.visualPants    = 0;
                Characters.clothes.visualHat      = 0;
                Characters.clothes.visualBackpack = 0;
                Characters.clothes.visualVest     = 0;
                Characters.clothes.visualMask     = 0;
                Characters.clothes.visualGlasses  = 0;
            }
            Characters.clothes.face  = Characters.active.face;
            Characters.clothes.hair  = Characters.active.hair;
            Characters.clothes.beard = Characters.active.beard;
            Characters.clothes.skin  = Characters.active.skin;
            Characters.clothes.color = Characters.active.color;
            Characters.clothes.hand  = Characters.active.hand;
            Characters.clothes.apply();
            byte b = 0;

            while ((int)b < Characters.slots.Length)
            {
                Characters.apply(b, showItems);
                b += 1;
            }
        }
Ejemplo n.º 12
0
 public static void apply()
 {
     Characters.apply(true, true);
 }
Ejemplo n.º 13
0
 private static void apply(byte slot)
 {
     Characters.apply(slot, true);
 }
Ejemplo n.º 14
0
        public static void package(ulong package)
        {
            int inventoryItem = Provider.provider.economyService.getInventoryItem(package);

            if (inventoryItem == 0)
            {
                return;
            }
            ushort inventoryItemID = Provider.provider.economyService.getInventoryItemID(inventoryItem);

            if (inventoryItemID == 0)
            {
                return;
            }
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, inventoryItemID);

            if (itemAsset != null)
            {
                if (itemAsset.proPath == null || itemAsset.proPath.Length == 0)
                {
                    if (Provider.provider.economyService.getInventorySkinID(inventoryItem) == 0)
                    {
                        return;
                    }
                    if (!Characters.packageSkins.Remove(package))
                    {
                        for (int i = 0; i < Characters.packageSkins.Count; i++)
                        {
                            ulong num = Characters.packageSkins[i];
                            if (num != 0UL)
                            {
                                int inventoryItem2 = Provider.provider.economyService.getInventoryItem(num);
                                if (inventoryItem2 != 0)
                                {
                                    ushort inventoryItemID2 = Provider.provider.economyService.getInventoryItemID(inventoryItem2);
                                    if (inventoryItemID2 != 0)
                                    {
                                        if (inventoryItemID == inventoryItemID2)
                                        {
                                            Characters.packageSkins.RemoveAt(i);
                                        }
                                    }
                                }
                            }
                        }
                        Characters.packageSkins.Add(package);
                    }
                }
                else if (itemAsset.type == EItemType.SHIRT)
                {
                    if (Characters.active.packageShirt == package)
                    {
                        Characters.active.packageShirt = 0UL;
                    }
                    else
                    {
                        Characters.active.packageShirt = package;
                    }
                }
                else if (itemAsset.type == EItemType.PANTS)
                {
                    if (Characters.active.packagePants == package)
                    {
                        Characters.active.packagePants = 0UL;
                    }
                    else
                    {
                        Characters.active.packagePants = package;
                    }
                }
                else if (itemAsset.type == EItemType.HAT)
                {
                    if (Characters.active.packageHat == package)
                    {
                        Characters.active.packageHat = 0UL;
                    }
                    else
                    {
                        Characters.active.packageHat = package;
                    }
                }
                else if (itemAsset.type == EItemType.BACKPACK)
                {
                    if (Characters.active.packageBackpack == package)
                    {
                        Characters.active.packageBackpack = 0UL;
                    }
                    else
                    {
                        Characters.active.packageBackpack = package;
                    }
                }
                else if (itemAsset.type == EItemType.VEST)
                {
                    if (Characters.active.packageVest == package)
                    {
                        Characters.active.packageVest = 0UL;
                    }
                    else
                    {
                        Characters.active.packageVest = package;
                    }
                }
                else if (itemAsset.type == EItemType.MASK)
                {
                    if (Characters.active.packageMask == package)
                    {
                        Characters.active.packageMask = 0UL;
                    }
                    else
                    {
                        Characters.active.packageMask = package;
                    }
                }
                else if (itemAsset.type == EItemType.GLASSES)
                {
                    if (Characters.active.packageGlasses == package)
                    {
                        Characters.active.packageGlasses = 0UL;
                    }
                    else
                    {
                        Characters.active.packageGlasses = package;
                    }
                }
                Characters.apply(false, true);
                if (Characters.onCharacterUpdated != null)
                {
                    Characters.onCharacterUpdated(Characters.selected, Characters.active);
                }
            }
        }