public static WeaponSkin ReadWeaponSkin32(this BinaryReader br)
        {
            WeaponSkin weaponSkin = (WeaponSkin)br.ReadUInt32();

            //Debug.Assert(Enum.IsDefined(typeof(WeaponSkin), weaponSkin));
            return(weaponSkin);
        }
Exemple #2
0
        //public Skin skin2 = new Skin();

        public async Task getSkins()
        {
            Task <ObservableCollection <WeaponSkin> > getSkinTask = SkinReceiver.GetSkins();

            skins = await getSkinTask;

            skin1 = skins[0];
        }
        public static WeaponSkin ReadWeaponSkin64(this BinaryReader br)
        {
            const ulong WeaponSkinMask = 0x0350000000000000ul;
            ulong       value          = br.ReadUInt64();

            Debug.Assert((value & 0xFFFFFFFF00000000ul) == WeaponSkinMask);
            WeaponSkin weaponSkin = (WeaponSkin)(value & 0xFFFFFFFFu);

            //Debug.Assert(Enum.IsDefined(typeof(WeaponSkin), weaponSkin));
            return(weaponSkin);
        }
Exemple #4
0
        partial void Merge(WeaponSkin entity, SkinDTO dto, object state)
        {
            var weapon = dto.Weapon;

            if (weapon == null)
            {
                return;
            }

            entity.DamageType = this.damageTypeConverter.Convert(weapon.DamageType, weapon);
        }
Exemple #5
0
 private static void TraceUnlocks(Hero hero, Skin skin, WeaponSkin weapon, HighlightIntro intro, Spray[] sprays = null, Emote[] emotes = null, VoiceLine[] voiceLines = null)
 {
     if (sprays != null)
     {
         foreach (var spray in sprays)
         {
             if (!IsDefined(spray))
             {
                 Tracer.TraceNoDupe("unlocks.sprays", $"{hero}_spray_{(int)spray:X8} = 0x{(int)spray:X8},");
             }
         }
     }
     if (voiceLines != null)
     {
         foreach (var voiceLine in voiceLines)
         {
             if (!IsDefined(voiceLine))
             {
                 Tracer.TraceNoDupe("unlocks.voiceLines", $"{hero}_voiceline_{(int)voiceLine:X8} = 0x{(int)voiceLine:X8},");
             }
         }
     }
     if (emotes != null)
     {
         foreach (var emote in emotes)
         {
             if (!IsDefined(emote))
             {
                 Tracer.TraceNoDupe("unlocks.emotes", $"{hero}_emote_{(int)emote:X8} = 0x{(int)emote:X8},");
             }
         }
     }
     if (!IsDefined(skin))
     {
         Tracer.TraceNoDupe("unlocks.skins", $"{hero}_skin_{(int)skin:X8} = 0x{(int)skin:X8},");
     }
     if (!IsDefined(intro))
     {
         Tracer.TraceNoDupe("unlocks.highlightIntros", $"{hero}_intro_{(int)intro:X8} = 0x{(int)intro:X8},");
     }
     if (!IsDefined(weapon))
     {
         if (IsDefined(skin))
         {
             Tracer.TraceNoDupe("unlocks.weaponskins", $"{skin}_weapon_{(int)weapon:X8} = 0x{(int)weapon:X8},");
         }
         else
         {
             Tracer.TraceNoDupe("unlocks.weaponskins", $"{hero}_skin_{(int)skin:X8}_weapon_{(int)weapon:X8} = 0x{(int)weapon:X8},");
         }
     }
 }
Exemple #6
0
        partial void Merge(WeaponSkin entity, SkinDTO dto, object state)
        {
            var details = dto.Details;

            if (details == null)
            {
                return;
            }

            if (details.DamageClass != null)
            {
                entity.DamageType = this.damageClassConverter.Convert(details.DamageClass, details);
            }
        }
        private void GetPriceButton_Click(object sender, RoutedEventArgs e)
        {
            //string s = DataReceiver.GetMarketPriceoverview("3", ((WeaponSkin)((Button)sender).DataContext).AppId, ((WeaponSkin)((Button)sender).DataContext).Market_hash_name);
            WeaponSkin skin = ((WeaponSkin)((Button)sender).DataContext);

            SteamPrice price = DataReceiver.GetMarketPriceoverview("3", skin.AppId, skin.Market_hash_name);

            //skin.PriceCol.Insert(0, DataReceiver.GetMarketPriceoverview("3", skin.AppId, skin.Market_hash_name));
            foreach (WeaponSkin s in ViewModel.Inventory.SteamInventory)
            {
                if (s.Market_hash_name == skin.Market_hash_name)
                {
                    if (s.PriceCol == null)
                    {
                        s.PriceCol = new ObservableCollection <Models.SteamInventory.SteamItem.SteamPrice>();
                    }
                    s.PriceCol.Insert(0, price);
                }
            }
        }
Exemple #8
0
        public static async Task <ObservableCollection <WeaponSkin> > GetSkins()
        {
            //Collection of the skins
            ObservableCollection <WeaponSkin> SkinCollection = new ObservableCollection <WeaponSkin>();

            //CSGO-File where the URIs are stored in
            StorageFile inputFile = await GetSkinsFileAsync();

            //Saves the text of the inputFile in a string for further editing
            string text = await Windows.Storage.FileIO.ReadTextAsync(inputFile);

            //erases all entries in the text before the first url
            if (!text.StartsWith("weapon"))
            {
                text = text.Substring(text.IndexOf("weapon"));
            }

            //downloading the pictures from the different urls
            while (text.Length != 0)
            {
                WeaponSkin skin = new WeaponSkin();
                skin.Id  = text.Substring(0, text.IndexOf("="));
                text     = text.Substring(text.IndexOf("=") + 1);
                skin.Url = text.Substring(0, text.IndexOf("\r\n"));
                text     = text.Substring(text.IndexOf("\n") + 1);
                try
                {
                    //downloading the pictures from the urls
                    Uri sourceUri = new Uri("ms-appx:///Images/WeaponSkins/defaultSkin.png");

                    string destination = "ms-appx:///Images/WeaponSkins/" + skin.Id + ".png";

                    //getting the destination Folder for the pictures, by receiving the parent folder from a default file
                    StorageFile defaultFile = await StorageFile.GetFileFromApplicationUriAsync(sourceUri);

                    Windows.Storage.StorageFolder storageFolder = await defaultFile.GetParentAsync();

                    //creating the .png file for the picture
                    Windows.Storage.StorageFile destinationFile = await storageFolder.CreateFileAsync(skin.Id + ".png", Windows.Storage.CreationCollisionOption.ReplaceExisting);

                    //StorageFile destinationFile = await KnownFolders.PicturesLibrary.CreateFileAsync(destination, CreationCollisionOption.GenerateUniqueName);

                    //downloading the picture from the url
                    BackgroundDownloader downloader = new BackgroundDownloader();
                    DownloadOperation    download   = downloader.CreateDownload(new Uri(skin.Url), destinationFile);

                    // Attach progress and completion handlers.
                    var result = download.StartAsync();

                    //assign the downloaded picture to the skin
                    skin.Icon = destinationFile.Path;
                }
                catch (Exception ex)
                {
                    //LogException("Download Error", ex);
                }
                //adding the skin to the collection
                SkinCollection.Add(skin);
            }
            return(SkinCollection);
        }
        /* Mit dieser Funktion werden aus den beiden Json-Files aus der Steam-API die Elemente aus dem Inventar bereitgestellt.
         * Die Links zu den Json-Files:
         * Json 1 : http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/?key=BD53E35BE3185B7BEE6E28B4564907B4&SteamID=76561197988463243 mit API-Key: BD53E35BE3185B7BEE6E28B4564907B4 und Steam64ID: 76561197988463243
         * Json 2 : http://steamcommunity.com/profiles/76561197988463243/inventory/json/730/2 mit Steam64ID: 76561197988463243
         * -
         *  */
        public void ParseJsonInventory()
        {
            #region inventoryString1

            JsonObject root1 = JsonObject.Parse(GetInventoryString()[0]);

            JsonObject rgInventory    = root1.GetNamedObject("rgInventory");
            JsonObject rgDescriptions = root1.GetNamedObject("rgDescriptions");
            JsonArray  rgCurrency     = root1.GetNamedArray("rgCurrency");
            bool       success        = root1.GetNamedBoolean("success");
            bool       more           = root1.GetNamedBoolean("more");
            bool       more_start     = root1.GetNamedBoolean("more_start");

            for (int i = 0; i < rgInventory.Count; i++)
            {
                WeaponSkin skin    = new WeaponSkin();
                JsonObject element = rgInventory.GetNamedObject(rgInventory.ElementAt(i).Key);
                skin.Id         = element.GetNamedString("id");
                skin.ClassId    = element.GetNamedString("classid");
                skin.InstanceId = element.GetNamedString("instanceid");
                skin.Amount     = element.GetNamedString("amount");
                skin.Pos        = element.GetNamedNumber("pos");

                skin.PriceCol = new ObservableCollection <SteamItem.SteamPrice>();
                skin.PriceCol.Add(new SteamItem.SteamPrice());
                skin.BuyPrice = new SteamItem.PurchaseData();

                SteamInventory.Add(skin);
            }

            for (int i = 0; i < rgDescriptions.Count; i++)
            {
                JsonObject element = rgDescriptions.GetNamedObject(rgDescriptions.ElementAt(i).Key);
                var        skinSel = from skins in SteamInventory where string.Equals(element.GetNamedString("classid"), skins.ClassId) select skins;
                int        j       = skinSel.Count();
                for (int n = 0; n < j; n++)
                {
                    WeaponSkin skin = skinSel.ElementAt(n);
                    //skin.AppId = element.GetNamedString("appid");
                    skin.Icon_url = element.GetNamedString("icon_url");
                    if (element.ContainsKey("icon_url_large"))
                    {
                        skin.Icon_url_large = element.GetNamedString("icon_url_large");
                    }
                    if (element.ContainsKey("icon_drag_url"))
                    {
                        skin.Icon_drag_url = element.GetNamedString("icon_drag_url");
                    }
                    if (element.ContainsKey("name"))
                    {
                        skin.Name = element.GetNamedString("name");
                    }
                    if (element.ContainsKey("market_hash_name"))
                    {
                        skin.Market_hash_name = element.GetNamedString("market_hash_name");
                    }
                    if (element.ContainsKey("market_name"))
                    {
                        skin.Market_name = element.GetNamedString("market_name");
                    }
                    if (element.ContainsKey("name_color"))
                    {
                        skin.Name_color = element.GetNamedString("name_color");
                    }
                    if (element.ContainsKey("background_color"))
                    {
                        skin.Background_color = element.GetNamedString("background_color");
                    }
                    if (element.ContainsKey("type"))
                    {
                        skin.Type = element.GetNamedString("type");
                    }
                    if (element.ContainsKey("tradable"))
                    {
                        skin.Tradable = element.GetNamedNumber("tradable");
                    }
                    if (element.ContainsKey("marketable"))
                    {
                        skin.Marketable = element.GetNamedNumber("marketable");
                    }
                    if (element.ContainsKey("commodity"))
                    {
                        skin.Commodity = element.GetNamedNumber("commodity");
                    }
                    if (element.ContainsKey("market_tradable_restriction"))
                    {
                        skin.Market_tradable_restriction = element.GetNamedString("market_tradable_restriction");
                    }
                    if (element.ContainsKey("appid"))
                    {
                        skin.AppId = element.GetNamedString("appid");
                    }
                    if (element.ContainsKey("descriptions"))
                    {
                        skin.Descriptions = new List <CsgoItem.Description>();
                        var des = element.GetNamedArray("descriptions");
                        for (uint m = 0; m < des.Count; m++)
                        {
                            var u = des.GetObjectAt(m);

                            CsgoItem.Description d = new CsgoItem.Description();
                            if (u.ContainsKey("type"))
                            {
                                d.Type = u.GetNamedString("type");
                            }
                            if (u.ContainsKey("value"))
                            {
                                d.Value = u.GetNamedString("value");
                            }
                            if (u.ContainsKey("color"))
                            {
                                d.Color = u.GetNamedString("color");
                            }

                            skin.Descriptions.Add(d);
                        }
                    }
                    if (element.ContainsKey("tags"))
                    {
                        skin.Tags = new List <CsgoItem.Tag>();
                        var tags = element.GetNamedArray("tags");
                        for (uint o = 0; o < tags.Count; o++)
                        {
                            var tag = tags.GetObjectAt(o);

                            CsgoItem.Tag t = new Models.CsgoItem.Tag();
                            if (tag.ContainsKey("internal_name"))
                            {
                                t.Internal_name = tag.GetNamedString("internal_name");
                            }
                            if (tag.ContainsKey("name"))
                            {
                                t.Name = tag.GetNamedString("name");
                            }
                            if (tag.ContainsKey("category"))
                            {
                                t.Category = tag.GetNamedString("category");
                            }
                            if (tag.ContainsKey("color"))
                            {
                                t.Color = tag.GetNamedString("color");
                            }
                            if (tag.ContainsKey("category_name"))
                            {
                                t.Category_name = tag.GetNamedString("category_name");
                            }

                            skin.Tags.Add(t);
                        }
                    }

                    //JsonArray elementTags = element.GetNamedArray("tags");
                    //for (uint o = 0; o < elementTags.Count; o++)
                    //{
                    //    WeaponSkins.Tag tag = new WeaponSkins.Tag();
                    //    JsonObject tagObj = elementMarketActions.GetObjectAt(o);
                    //    tag.Internal_name = tagObj.GetNamedString("internal_name");
                    //    tag.Name = tagObj.GetNamedString("name");
                    //    tag.Category = tagObj.GetNamedString("category");
                    //    if (tagObj.ContainsKey("color"))
                    //    {
                    //        tag.Color = tagObj.GetNamedString("color");
                    //    }
                    //    tag.Category_name = tagObj.GetNamedString("category_name");
                    //}

                    #region nicht einheitliche Elemente

                    // hier müssen nocht if oder exceptions eingefügt werden, um zu verhindern, das das Objekt nicht gefunden werden kann

                    //JsonArray elementDes = element.GetNamedArray("descriptions");
                    //for (uint k = 0; k < elementDes.Count; k++)
                    //{
                    //    Description des = new Description();
                    //    JsonObject desObj = elementDes.GetObjectAt(k);
                    //    des.Type = desObj.GetNamedString("type");
                    //    des.Value = desObj.GetNamedString("value");
                    //    des.Color = desObj.GetNamedString("color");

                    //    JsonObject appData = desObj.GetNamedObject("app_data");
                    //    if (appData.ContainsKey("def_index)
                    //    {
                    //        des.App_data.Def_index = appData.GetNamedString("def_index");
                    //    }
                    //    //des.App_data.Def_index = appData.GetNamedString("def_index");
                    //    des.App_data.Is_Itemset_name = appData.GetNamedNumber("is_itemset_name");
                    //    des.App_data.Limited = appData.GetNamedNumber("limited");
                    //    skin.Descriptions.Add(des);
                    //}

                    //JsonArray elementActions = element.GetNamedArray("actions");
                    //for (uint l = 0; l < elementActions.Count; l++)
                    //{
                    //    WeaponSkins.Action act = new WeaponSkins.Action();
                    //    JsonObject actObj = elementDes.GetObjectAt(l);
                    //    act.Name = actObj.GetNamedString("name");
                    //    act.Link = actObj.GetNamedString("link");
                    //    skin.Actions.Add(act);
                    //}

                    //JsonArray elementMarketActions = element.GetNamedArray("market_actions");
                    //for (uint m = 0; m < elementMarketActions.Count; m++)
                    //{
                    //    WeaponSkins.MarketAction marAct = new WeaponSkins.MarketAction();
                    //    JsonObject actObj = elementMarketActions.GetObjectAt(m);
                    //    marAct.Name = actObj.GetNamedString("name");
                    //    marAct.Link = actObj.GetNamedString("link");
                    //}



                    #endregion
                }
            }
            #endregion

            #region inventoryString2

            //API funktioniert nicht mehr

            //JsonObject root2 = JsonObject.Parse(inventoryString2);
            //JsonObject result = root2.GetNamedObject("result");
            //double status = result.GetNamedNumber("status");
            //JsonArray items = result.GetNamedArray("items");
            //for (int i = 0; i < items.Count; i++)
            //{
            //    JsonObject itemObj = items.ElementAt(i).GetObject();
            //    var skinSel2 = from skins in SteamInventory where string.Equals(itemObj.GetNamedNumber("id").ToString(), skins.Id) select skins;
            //    WeaponSkin skin = skinSel2.First();
            //    JsonArray itemObjAttr = itemObj.GetNamedArray("attributes");
            //    for (int j = 0; j < itemObjAttr.Count; j++)
            //    {
            //        JsonObject Attribute = itemObjAttr.ElementAt(j).GetObject();
            //        if (Attribute.GetNamedNumber("defindex")==8&&Attribute.ContainsKey("float_value")) { skin.Float_value = Attribute.GetNamedNumber("float_value"); }
            //    }
            //}


            #endregion
        }
Exemple #10
0
        public static void RunForHeroWithUnlocks(Hero hero, Skin skin, WeaponSkin weapon, HighlightIntro intro, Spray[] sprays = null, Emote[] emotes = null, VoiceLine[] voiceLines = null)
        {
            if (sprays != null)
            {
                foreach (var spray in sprays)
                {
                    if (IsDefined(spray))
                    {
                        Debug.Assert(spray.ToString().StartsWith($"{hero}_") || spray.ToString().StartsWith("Common_"), $"Spray {spray} should belong to '{hero}', maybe it's a Common spray?");
                        if (spray.ToString().StartsWith($"{hero}_spray_"))
                        {
                            Debug.Assert(spray.ToString() == $"{hero}_spray_{(int)spray:X8}");
                        }
                        else if (spray.ToString().StartsWith($"Common_spray_"))
                        {
                            Debug.Assert(spray.ToString() == $"Common_spray_{(int)spray:X8}");
                        }
                    }
                }
            }
            if (voiceLines != null)
            {
                foreach (var voiceLine in voiceLines)
                {
                    if (IsDefined(voiceLine))
                    {
                        Debug.Assert(voiceLine.ToString().StartsWith($"{hero}_"));
                        if (voiceLine.ToString().StartsWith($"{hero}_voiceline_"))
                        {
                            Debug.Assert(voiceLine.ToString() == $"{hero}_voiceline_{(int)voiceLine:X8}");
                        }
                    }
                }
            }
            if (emotes != null)
            {
                foreach (var emote in emotes)
                {
                    if (IsDefined(emote))
                    {
                        Debug.Assert(emote.ToString().StartsWith($"{hero}_"));
                        if (emote.ToString().StartsWith($"{hero}_emote_"))
                        {
                            Debug.Assert(emote.ToString() == $"{hero}_emote_{(int)emote:X8}");
                        }
                    }
                }
            }
            if (IsDefined(skin))
            {
                Debug.Assert(skin.ToString().StartsWith($"{hero}_"));
                if (skin.ToString().StartsWith($"{hero}_skin_"))
                {
                    Debug.Assert(skin.ToString() == $"{hero}_skin_{(int)skin:X8}");
                }
            }
            if (IsDefined(weapon))
            {
                Debug.Assert(weapon.ToString().StartsWith($"{hero}_"));
                if (weapon.ToString().StartsWith($"{hero}_skin_"))
                {
                    Debug.Assert(weapon.ToString() == $"{hero}_skin_{(int)skin:X8}_weapon_{(int)weapon:X8}");
                }
            }
            if (IsDefined(intro) && intro != HighlightIntro.None)
            {
                Debug.Assert(intro.ToString().StartsWith($"{hero}_"));
                if (intro.ToString().StartsWith($"{hero}_intro_"))
                {
                    Debug.Assert(intro.ToString() == $"{hero}_intro_{(int)intro:X8}");
                }
            }
            if (IsDefined(skin) && IsDefined(weapon))
            {
                Debug.Assert(weapon.ToString().StartsWith(skin.ToString()));
            }
            else if (IsDefined(skin) && !IsDefined(weapon))
            {
                Debug.Assert(false, $"Defined skin {skin} but corresponding weapon {(int)weapon:X8} is not defined");
            }
            else if (!IsDefined(skin) && IsDefined(weapon))
            {
                Debug.Assert(false, $"Defined weapon {weapon} but corresponding skin {(int)skin:X8} is not defined");
            }

            TraceUnlocks(hero, skin, weapon, intro, sprays, emotes, voiceLines);
        }
Exemple #11
0
        public HighlightInfo(BinaryReader br, MajorVersion gameMajorVersion)
        {
            // player name of the highlight protagonist (will differ for other people's POTGs)
            this.playerName = br.ReadNullPaddedUTF8();

            // wheeeeeeee
            if (gameMajorVersion >= new MajorVersion(1, 16, VersionBranch.None))
            {
                byte unknown1 = br.ReadByte();
                Debug.Assert(unknown1 == 0);
            }

            // 1 for potg, 0 for top5 highlight, 4 for manual highlight
            this.typeFlags = (HighlightTypeFlag)br.ReadByte();
            Debug.Assert(Extensions.AreAllFlagsDefined(typeFlags));

            this.unknown2 = br.ReadUInt32();
            Debug.Assert((unknown2 & 0x80000000u) == 0x80000000u);
            Debug.Assert((unknown2 & 0x7FFFFFFFu) <= 0x0000FFFFu);

            this.unknown3 = br.ReadUInt32();
            Debug.Assert((unknown3 & 0x80000000u) == 0x80000000u);
            Debug.Assert((unknown3 & 0x7FFFFFFFu) <= 0x0000FFFFu);

            Debug.Assert(unknown3 >= unknown2);

            this.unknown4 = br.ReadSingle();
            Debug.Assert(!float.IsInfinity(unknown4) && !float.IsNaN(unknown4));

            this.unknown5 = br.ReadSingle();
            Debug.Assert(!float.IsInfinity(unknown5) && !float.IsNaN(unknown5));

            // seems to be nonzero if the player starts the highlight in the air - elevation?
            this.unknown6 = br.ReadUInt32();

            if (gameMajorVersion >= new MajorVersion(1, 17, VersionBranch.None))
            {
                // 0 for defense team, 1 for attack team. not sure how this handles oasis/nepal/ilios/lijiangtower yet
                this.unknown7 = br.ReadUInt32();
                Debug.Assert(unknown7 == 0 || unknown7 == 1 || unknown7 == 4);
            }

            this.highlightIntroPosition = br.ReadVec3();
            Debug.Assert(highlightIntroPosition.IsFinite());

            this.highlightIntroDirection = br.ReadVec3();
            Debug.Assert(highlightIntroDirection.IsFinite());
            Debug.Assert(highlightIntroDirection.IsUnitVector());

            this.upVector = br.ReadVec3();
            Debug.Assert(upVector.IsFinite());
            Debug.Assert(upVector.IsUnitVector());
            Debug.Assert(Math.Round(upVector.x) == 0);
            Debug.Assert(Math.Round(upVector.y) == 1);
            Debug.Assert(Math.Round(upVector.z) == 0);

            this.hero       = br.ReadHero64();
            this.skin       = br.ReadSkin64();
            this.weaponSkin = br.ReadWeaponSkin64();

            // at a hazy guess these might be to do with the new country-specific skins for the world cup?
            if (gameMajorVersion >= new MajorVersion(1, 17, VersionBranch.None))
            {
                this.unknown8 = br.ReadUInt64();
                Debug.Assert(unknown8 == 0);
                this.unknown9 = br.ReadUInt64();
                Debug.Assert(unknown9 == 0);
            }

            this.highlightIntro = br.ReadHighlightIntro64();

            this.category = br.ReadHighlightCategory64();

            this.timestamp = br.ReadUInt64();
            this.uuid      = new HighlightUUID(br);

            UnlockValidator.RunForHeroWithUnlocks(hero, skin, weaponSkin, highlightIntro);

            Debug.Assert(this.unknown3 >= this.unknown2);
        }
        public HeroWithUnlockables(BinaryReader br, MajorVersion gameMajorVersion)
        {
            this.skin       = br.ReadSkin32();
            this.weaponSkin = br.ReadWeaponSkin32();

            this.highlightIntro = br.ReadHighlightIntro32();

            int numSprays = br.ReadInt32();

            this.sprays = br.ReadSpray32s(numSprays);

            int numVoiceLines = br.ReadInt32();

            this.voiceLines = br.ReadVoiceLine32s(numVoiceLines);

            int numEmotes = br.ReadInt32();

            this.emotes = br.ReadEmote32s(numEmotes);

            // might be to do with team affiliation? seems to be either 0 or 1 depending on team - not sure about -1??
            if (gameMajorVersion >= new MajorVersion(1, 17, VersionBranch.None))
            {
                this.unknownInV17 = br.ReadInt32();
                Debug.Assert(unknownInV17 == -1 || unknownInV17 == 0 || unknownInV17 == 1 || unknownInV17 == 4);
            }

            this.hero = br.ReadHero64();

            // AI players in custom matches have no HighlightIntro, no unlocks, and always use classic skins
            // Bots in the Junkenstein/Uprising modes sometimes use non-classic skins.
            if (highlightIntro == HighlightIntro.None)
            {
                Debug.Assert(this.sprays.Length == 0);
                Debug.Assert(this.voiceLines.Length == 0);
                Debug.Assert(this.emotes.Length == 0);
                Debug.Assert(
                    ($"{skin}" == $"{hero}_Classic") ||
                    (hero == Hero.Junkrat && skin == Skin.Junkrat_DrJunkenstein) ||
                    (hero == Hero.Mercy && skin == Skin.Mercy_Witch) ||
                    (hero == Hero.Reaper && skin == Skin.Reaper_Dracula) ||
                    (hero == Hero.Roadhog && skin == Skin.Roadhog_JunkensteinsMonster) ||
                    (hero == Hero.Orisa && skin == Skin.Orisa_NullSector) ||
                    (hero == Hero.UprisingEvent_00000173 && skin == Skin.UprisingEvent_00000173_Classic) ||
                    (hero == Hero.UprisingEvent_00000178 && skin == Skin.UprisingEvent_00000178_Classic) ||
                    (hero == Hero.UprisingEvent_00000179 && skin == Skin.UprisingEvent_00000179_Classic) ||
                    (hero == Hero.RetributionEvent_000001AC && skin == Skin.RetributionEvent_000001AC_Classic) ||
                    (hero == Hero.RetributionEvent_000001B8 && skin == Skin.RetributionEvent_000001B8_Classic) ||
                    (hero == Hero.RetributionEvent_000001BA && skin == Skin.RetributionEvent_000001BA_Classic) ||
                    (hero == Hero.RetributionEvent_000001BB && skin == Skin.RetributionEvent_000001BB_Classic) ||
                    (hero == Hero.RetributionEvent_000001CE && skin == Skin.RetributionEvent_000001CE_Classic)
                    );
                Debug.Assert(
                    ($"{weaponSkin}" == $"{hero}_Classic") ||
                    (hero == Hero.Junkrat && weaponSkin == WeaponSkin.Junkrat_DrJunkenstein) ||
                    (hero == Hero.Mercy && weaponSkin == WeaponSkin.Mercy_Witch) ||
                    (hero == Hero.Reaper && weaponSkin == WeaponSkin.Reaper_Dracula) ||
                    (hero == Hero.Roadhog && weaponSkin == WeaponSkin.Roadhog_JunkensteinsMonster) ||
                    (hero == Hero.Orisa && weaponSkin == WeaponSkin.Orisa_NullSector) ||
                    (hero == Hero.UprisingEvent_00000173 && weaponSkin == WeaponSkin.UprisingEvent_00000173_Classic) ||
                    (hero == Hero.UprisingEvent_00000178 && weaponSkin == WeaponSkin.UprisingEvent_00000178_Classic) ||
                    (hero == Hero.UprisingEvent_00000179 && weaponSkin == WeaponSkin.UprisingEvent_00000179_Classic) ||
                    (hero == Hero.RetributionEvent_000001AC && weaponSkin == WeaponSkin.RetributionEvent_000001AC_Classic) ||
                    (hero == Hero.RetributionEvent_000001B8 && weaponSkin == WeaponSkin.RetributionEvent_000001B8_Classic) ||
                    (hero == Hero.RetributionEvent_000001BA && weaponSkin == WeaponSkin.RetributionEvent_000001BA_Classic) ||
                    (hero == Hero.RetributionEvent_000001BB && weaponSkin == WeaponSkin.RetributionEvent_000001BB_Classic) ||
                    (hero == Hero.RetributionEvent_000001CE && weaponSkin == WeaponSkin.RetributionEvent_000001CE_Classic)
                    );
            }

            // Ensure that unlocks are correctly mapped to heroes
            UnlockValidator.RunForHeroWithUnlocks(hero, skin, weaponSkin, highlightIntro, sprays, emotes, voiceLines);
        }
Exemple #13
0
        public void UnSheatheWeapons(bool unsheathe)
        {
            // Create variables
            Transform rightHandParentTransform = null;
            Transform rightHandTransform       = null;
            Transform leftHandParentTransform  = null;
            Transform leftHandTransform        = null;

            // Destroy the current weapon objects
            if (rightHandWeaponObject)
            {
                Destroy(rightHandWeaponObject);
            }
            if (leftHandWeaponObject)
            {
                Destroy(leftHandWeaponObject);
            }

            // Get the weapon skin informations
            WeaponSkin weaponSkin = null;

            if (isPlayerCharacter)
            {
                weaponSkin = weapon.defaultSkin;
            }
            else if (isHostileCharacter)
            {
                weaponSkin = hostileCharacter.enemy.weaponSkin;
            }

            // Identify which part of the character should be used as a parent
            if (unsheathe)
            {
                rightHandParentTransform = GetComponentsInChildren <RightHand>()[0].gameObject.transform;
                rightHandTransform       = weaponSkin.rightHandWieldTransform;
                leftHandParentTransform  = GetComponentsInChildren <LeftHand>()[0].gameObject.transform;
                leftHandTransform        = weaponSkin.leftHandWieldTransform;
            }
            else
            {
                if (weaponSkin.rightHandCarryLocation == "spine")
                {
                    rightHandParentTransform = GetComponentsInChildren <Spine>()[0].gameObject.transform;
                }
                else if (weaponSkin.rightHandCarryLocation == "waist")
                {
                    rightHandParentTransform = GetComponentsInChildren <Waist>()[0].gameObject.transform;
                }
                rightHandTransform = weaponSkin.rightHandCarryTransform;

                if (weaponSkin.leftHandCarryLocation == "spine")
                {
                    leftHandParentTransform = GetComponentsInChildren <Spine>()[0].gameObject.transform;
                }
                else if (weaponSkin.leftHandCarryLocation == "waist")
                {
                    leftHandParentTransform = GetComponentsInChildren <Waist>()[0].gameObject.transform;
                }
                leftHandTransform = weaponSkin.leftHandCarryTransform;
            }

            if (weaponSkin.rightHandPrefab != null)
            {
                // Create the weapon
                rightHandWeaponObject = Instantiate(weaponSkin.rightHandPrefab, rightHandParentTransform);

                // Apply the Transforms
                rightHandWeaponObject.transform.localPosition = rightHandTransform.localPosition;
                rightHandWeaponObject.transform.localRotation = rightHandTransform.localRotation;
                rightHandWeaponObject.transform.localScale    = rightHandTransform.localScale;
            }

            if (weaponSkin.leftHandPrefab != null)
            {
                // Create the weapon
                leftHandWeaponObject = Instantiate(weaponSkin.leftHandPrefab, leftHandParentTransform);

                // Apply the Transforms
                leftHandWeaponObject.transform.localPosition = leftHandTransform.localPosition;
                leftHandWeaponObject.transform.localRotation = leftHandTransform.localRotation;
                leftHandWeaponObject.transform.localScale    = leftHandTransform.localScale;
            }

            // Set the variables and animator parameters
            if (unsheathe)
            {
                hasWeaponsOut = true;
                animator.SetBool("Weapons Out", true);
            }
            else
            {
                hasWeaponsOut = false;
                animator.SetBool("Weapons Out", false);
            }
        }