Esempio n. 1
0
        public static ItemInfo GatherUnlock(ulong key)
        {
            STUUnlock unlock = GetInstance <STUUnlock>(key);

            if (unlock == null)
            {
                return(null);
            }

            string name        = GetString(unlock.CosmeticName);
            string description = GetDescriptionString(unlock.CosmeticDescription);
            string availableIn = GetString(unlock.CosmeticAvailableIn);

            if (unlock is STUUnlock_Currency)
            {
                name = $"{(unlock as STUUnlock_Currency).Amount} Credits";
            }
            else if (unlock is STULevelPortrait)
            {
                STULevelPortrait portrait = unlock as STULevelPortrait;
                name = $"{portrait.Tier} Star: {portrait.Star} Level: {portrait.Level}";
            }

            if (name == null)
            {
                name = $"{GUID.LongKey(key):X12}";
            }

            return(new ItemInfo(name, unlock.CosmeticRarity.ToString(), unlock.RealName, description, availableIn, unlock, key));
        }
Esempio n. 2
0
 public ItemInfo(string name, string rarity, string type, string description, string availableIn, STUUnlock unlock, ulong guid)
 {
     Name        = name.TrimEnd(' '); // ffs blizz, why do the names end in a space sometimes
     Rarity      = rarity;
     Type        = type;
     Description = description;
     AvailableIn = availableIn;
     Unlock      = unlock;
     GUID        = guid;
 }
Esempio n. 3
0
        private void Init(STUUnlock unlock, ulong guid)
        {
            Name        = GetString(unlock.m_name)?.TrimEnd(' ');      // ffs blizz, why do the names end in a space sometimes
            AvailableIn = GetString(unlock.m_53145FAF);
            Rarity      = unlock.m_rarity;
            Description = GetDescriptionString(unlock.m_3446F580);

            GUID = guid;
            STU  = unlock;

            Type = GetTypeName(unlock);
        }
Esempio n. 4
0
        /// <summary>
        /// Get an array of <see cref="Unlock"/> from an array of GUIDs
        /// </summary>
        /// <param name="guids">GUID collection</param>
        /// <returns>Array of <see cref="Unlock"/></returns>
        public static Unlock[] GetArray(IEnumerable <ulong> guids)
        {
            if (guids == null)
            {
                return(null);
            }
            List <Unlock> unlocks = new List <Unlock>();

            foreach (ulong guid in guids)
            {
                STUUnlock stu = GetInstance <STUUnlock>(guid);
                if (stu == null)
                {
                    continue;
                }
                Unlock unlock = new Unlock(stu, guid);
                unlocks.Add(unlock);
            }
            return(unlocks.ToArray());
        }
Esempio n. 5
0
            private string DumpGUID(IndentHelper indentHelper, ulong guid)
            {
                string baseString = $"\r\n{indentHelper + 1}[{GetGUIDTypeName(guid)}]";

                STUInstance[] instances;
                switch (GUID.Type(guid))
                {
                default:
                    return("");

                case 0x7C:
                case 0xA9:
                    return($"{baseString} \"{GetOWString(guid, _handler, _map)}\"");

                case 0x90:
                    instances = GetInstances(guid, _handler, _map);
                    if (instances[0] == null)
                    {
                        return(null);
                    }
                    STUEncryptionKey encryptionKey = instances[0] as STUEncryptionKey;
                    return($"{baseString} {encryptionKey?.KeyNameProper}:{encryptionKey?.Key}");

                case 0xA5:
                    instances = GetInstances(guid, _handler, _map);
                    STUUnlock unlock      = instances.OfType <STUUnlock>().First();
                    string    baseString2 = $"\r\n{indentHelper + 1}[{GetGUIDTypeName(guid)}";
                    if (unlock == null)
                    {
                        return(null);
                    }
                    if (unlock is STUUnlock_Currency)
                    {
                        return($"{baseString2}:Credits] {(unlock as STUUnlock_Currency).Amount} Credits");
                    }
                    else if (unlock is STULevelPortrait)
                    {
                        STULevelPortrait portrait = unlock as STULevelPortrait;
                        return
                            ($"{baseString2}:Credits] {portrait.Tier} Star:{portrait.Star} Level:{portrait.Level}");
                    }
                    else if (unlock is STUCompetitiveCurrencyReward)
                    {
                        STUCompetitiveCurrencyReward competitiveCurrencyReward = unlock as STUCompetitiveCurrencyReward;
                        return
                            ($"{baseString2}:CompetitivePoints] {competitiveCurrencyReward.Amount} points");
                    }
                    else
                    {
                        return($"{baseString2}:{unlock.GetType().Name}] \"{GetOWString(unlock.CosmeticName, _handler, _map)}\"");
                    }

                case 0x9E:
                    instances = GetInstances(guid, _handler, _map);
                    if (instances[0] == null)
                    {
                        return(null);
                    }
                    STULoadout ability = instances[0] as STULoadout;
                    return($"{baseString} \"{GetOWString(ability?.Name, _handler, _map)}\" ({ability?.Category})");

                case 0xC5:
                    instances = GetInstances(guid, _handler, _map);
                    if (instances[0] == null)
                    {
                        return(null);
                    }
                    STUGamemode gamemode = instances[0] as STUGamemode;
                    return($"{baseString} \"{GetOWString(gamemode?.DisplayName, _handler, _map)}\"");

                case 0xC6:
                    instances = GetInstances(guid, _handler, _map);
                    if (instances[0] == null)
                    {
                        return(null);
                    }
                    STUGameRulesetSchema gameRulsetSchema = instances[0] as STUGameRulesetSchema;
                    return($"{baseString} \"{GetOWString(gameRulsetSchema?.Name, _handler, _map)}\"");

                case 0x75:
                    instances = GetInstances(guid, _handler, _map);
                    if (instances[0] == null)
                    {
                        return(null);
                    }
                    STUHero hero = instances[0] as STUHero;
                    return($"{baseString} \"{GetOWString(hero?.Name, _handler, _map)}\"");
                }
            }
Esempio n. 6
0
 /// <summary>
 /// Get user friendly type name
 /// </summary>
 /// <param name="unlock">Source unlock</param>
 /// <returns>Friendly type name</returns>
 /// <exception cref="NotImplementedException">Unlock type is unknown</exception>
 private static string GetTypeName(STUUnlock unlock)
 {
     return(GetTypeName(unlock.GetType()));
 }
Esempio n. 7
0
 public Unlock(STUUnlock unlock, ulong guid)
 {
     Init(unlock, guid);
 }