Exemplo n.º 1
0
    //This function changes the color of the RarityPanel depending on the rarity of the card
    public void DefineRarity()
    {
        switch (rarity.ToString())
        {
        case ("Common"):
            rarityColor.color = cardBackground.color;
            return;

        case ("Bronze"):
            rarityColor.color = new Color32(205, 127, 50, 255);
            return;

        case ("Silver"):
            rarityColor.color = new Color32(192, 192, 192, 255);
            return;

        case ("Gold"):
            rarityColor.color = new Color32(255, 215, 0, 255);
            return;

        case ("Mythological"):
            rarityColor.color = new Color32(199, 21, 103, 255);
            return;
        }
    }
Exemplo n.º 2
0
        private async Task UpdateBrowseMenuAsync(CommandContext ctx, DiscordMessage msg, int upgradesPerPage, int page, int totalPages)
        {
            DiscordEmbedBuilder newMenuPage = new DiscordEmbedBuilder
            {
                Title       = "List of Upgrades",
                Description = $"Page {page}/{totalPages}",
                Color       = DiscordColor.Azure,
                Footer      = new DiscordEmbedBuilder.EmbedFooter {
                    Text = $"Total Upgrades: {BotInfoHandler.gameHandler.pool.upgrades.Count()}"
                }
            };

            Rarity lastRarity = Rarity.NO_RARITY;

            string pageInfo = string.Empty;

            for (int i = upgradesPerPage * (page - 1); i < upgradesPerPage * page && i < BotInfoHandler.gameHandler.pool.upgrades.Count(); i++)
            {
                if (lastRarity != BotInfoHandler.gameHandler.pool.upgrades[i].rarity)
                {
                    if (lastRarity != Rarity.NO_RARITY)
                    {
                        newMenuPage.AddField(lastRarity.ToString(), pageInfo);
                    }
                    pageInfo   = string.Empty;
                    lastRarity = BotInfoHandler.gameHandler.pool.upgrades[i].rarity;
                }
                pageInfo += $"{i + 1}) {BotInfoHandler.gameHandler.pool.upgrades[i].name}\n";
            }
            newMenuPage.AddField(lastRarity.ToString(), pageInfo);

            await msg.ModifyAsync(embed : newMenuPage.Build()).ConfigureAwait(false);
        }
Exemplo n.º 3
0
    // todo: refactor into shared with LargeCardView
    private Sprite GetSprite(Rarity r)
    {
        switch (r)
        {
        case Rarity.Common:
            return(Resources.Load <Sprite> ("Icon/Rarity/Common"));

            break;

        case Rarity.Uncommon:
            return(Resources.Load <Sprite> ("Icon/Rarity/Uncommon"));

            break;

        case Rarity.Rare:
            return(Resources.Load <Sprite> ("Icon/Rarity/Rare"));

            break;

        case Rarity.MegaRare:
            return(Resources.Load <Sprite> ("Icon/Rarity/MegaRare"));

            break;

        default:
            Debug.Log("!!! Error - no rarity sprite found for rarity: " + r.ToString());
            return(null);

            break;
        }
    }
Exemplo n.º 4
0
    public GameObject createItem(BaseItem baseItem, float rarityMult = 1f)
    {
        GameObject item = null;

        try{
            BaseItem b = baseItem;
            Debug.Log(b);
            Item thisItem = null;
            switch (b)
            {
            case BaseItem.map:
                Debug.Log("in map");
                item = Instantiate(mapItemPrefab, new Vector2(0, 0), mapItemPrefab.transform.rotation);
                break;

            case BaseItem.material:
                Debug.Log("in matterials");
                item = Instantiate(itemPrefab, new Vector2(0, 0), itemPrefab.transform.rotation);
                break;
            }

            thisItem = item.GetComponent <Item>();
            Rarity r = determineRarity(rarityMult);

            thisItem.init(item, r.ToString() + " " + b.ToString(), r, b);

            ++itemId;
        }
        catch (System.ArgumentException ex) {
            Debug.Log(ex.GetType().Name + ": " + ex.Message);
        }
        return(item);
    }
Exemplo n.º 5
0
        public static HUDTextType ToHudTextType(this Rarity rarity)
        {
            switch (rarity)
            {
            case Rarity.Common:
                return(HUDTextType.EquipmentCommon);

            case Rarity.Magic:
                return(HUDTextType.EquipmentUncommon);

            case Rarity.Epic:
                return(HUDTextType.EquipmentMagic);

            case Rarity.Legendary:
                return(HUDTextType.EquipmentRare);

            case Rarity.Mythic:
                return(HUDTextType.EquipmentLegendary);

            case Rarity.Ultimate:
                return(HUDTextType.EquipmentMythic);

            case Rarity.Ultimate2:
                return(HUDTextType.EquipmentUltimate);

            default:
#if UNITY_EDITOR
                throw new Exception("Not found hud type for " + rarity.ToString());
#endif
                return(HUDTextType.EquipmentCommon);
            }
        }
Exemplo n.º 6
0
        private IEnumerable <RecipeResult> getNextResult(Dictionary <string, List <Gear> > buckets, Func <Gear, bool> constraint)
        {
            foreach (var baseTypeBucket in buckets)
            {
                List <Gear> gears = baseTypeBucket.Value; // though, technically, gear is a mass noun

                if (gears == null || gears.Count == 0)
                {
                    continue;
                }

                bool stop = false;
                while (!stop)
                {
                    RecipeResult result = new RecipeResult();
                    result.MatchedItems = new List <Item>();
                    result.Missing      = new List <string>();
                    result.PercentMatch = 0;
                    result.Instance     = this;

                    Dictionary <Rarity, Gear> set = new Dictionary <Rarity, Gear>();
                    set.Add(Rarity.Normal, gears.FirstOrDefault(g => g.Rarity == Rarity.Normal && constraint(g)));
                    set.Add(Rarity.Magic, gears.FirstOrDefault(g => g.Rarity == Rarity.Magic && constraint(g)));
                    set.Add(Rarity.Rare, gears.FirstOrDefault(g => g.Rarity == Rarity.Rare && constraint(g)));
                    // TODO: Handle case with a unique item.

                    decimal numKeys = set.Keys.Count;
                    foreach (var pair in set)
                    {
                        Rarity rarity = pair.Key;
                        Gear   gear   = pair.Value;
                        if (gear != null)
                        {
                            result.PercentMatch += (decimal)100.0 / numKeys;
                            result.MatchedItems.Add(gear);
                        }
                        else
                        {
                            result.Missing.Add(string.Format("Item with {0} rarity", rarity.ToString()));
                        }
                    }

                    result.IsMatch = result.PercentMatch > base.ReturnMatchesGreaterThan;
                    if (result.IsMatch) // only remove the items if they are in a "match" -- close enough to show in the UI
                    {
                        foreach (var pair in set)
                        {
                            gears.Remove(pair.Value);
                        }
                        yield return(result);
                    }

                    if (result.Missing.Count > 0 || gears.Count == 0)
                    {
                        stop = true;
                    }
                }
            }
        }
Exemplo n.º 7
0
 public Gegenstand(string name, int wert, double gewicht, Rarity seltenheit, string beschreibung)
 {
     Name         = name;
     Wert         = wert;
     Gewicht      = gewicht;
     Seltenheit   = seltenheit.ToString();
     Beschreibung = beschreibung;
 }
Exemplo n.º 8
0
    public override void initItem(int mapLevel = 1)
    {
        this.equipType = EquipType.oneHand;
        int baseDmg = 0;

        // type = (Type)Random.Range(0, 7);
        weaponType = WeaponType.sword;
        print("Items/Weapons/Sprite/" + this.weaponType.ToString());
        this._obj = Resources.Load <Sprite>("Items/Weapons/Sprite/" + this.weaponType.ToString());
        //this._icon = Resources.Load<GameObject>("Items/Weapons/Icon/" + this.type.ToString());

        switch (weaponType)
        {
        case WeaponType.sword:
            this.itemName = rarity.ToString() + " sword";
            baseDmg       = 10;
            attackSpeed   = 1 + Random.Range(0, (int)rarity / 10);
            maxDamage     = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage     = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity, baseDmg - (int)rarity));
            break;

        case WeaponType.axe:
            baseDmg     = 15;
            attackSpeed = 0.8f + Random.Range(0, (int)rarity / 10);
            maxDamage   = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage   = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity * 2, baseDmg - (int)rarity) * 2);
            break;

        case WeaponType.hammer:
            baseDmg     = 25;
            attackSpeed = 0.5f + Random.Range(0, (int)rarity / 10);
            maxDamage   = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage   = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity, baseDmg - (int)rarity));
            break;

        case WeaponType.bow:
            baseDmg     = 10;
            attackSpeed = 1 + Random.Range(0, (int)rarity / 10);
            maxDamage   = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage   = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity, baseDmg - (int)rarity));
            break;

        case WeaponType.crossBow:
            baseDmg     = 15;
            attackSpeed = 0.6f + Random.Range(0, (int)rarity / 10);
            maxDamage   = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage   = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity, baseDmg - (int)rarity));
            break;

        case WeaponType.dagger:
            baseDmg     = 5;
            attackSpeed = 1.5f + Random.Range(0, (int)rarity / 10);
            maxDamage   = baseDmg + mapLevel + (int)Mathf.Sqrt((int)rarity) + Random.Range((int)Mathf.Sqrt((int)rarity), (int)Mathf.Sqrt((int)rarity) + mapLevel + 2);
            minDamage   = maxDamage - (Random.Range(baseDmg / 2 - (int)rarity, baseDmg - (int)rarity));
            break;
        }
    }
Exemplo n.º 9
0
        private void rarityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_item == null || !rarityComboBox.IsEnabled)
            {
                return;
            }
            Rarity rarity = rarityForIndex(rarityComboBox.SelectedIndex);

            EventLogger.logEvent("rarityComboBox_SelectionChanged", new Dictionary <string, object>()
            {
                { "rarity", rarity.ToString() }
            });
            _item.Rarity = rarity;
            this.saveChanges?.Execute(_item);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Get the significant details of what needs approval
        /// </summary>
        /// <returns>A list of strings</returns>
        public override IDictionary <string, string> SignificantDetails()
        {
            IDictionary <string, string> returnList = base.SignificantDetails();

            returnList.Add("Amount Multiplier", AmountMultiplier.ToString());
            returnList.Add("Rarity", Rarity.ToString());
            returnList.Add("Puissance Variance", PuissanceVariance.ToString());
            returnList.Add("Elevation", string.Format("{0} - {1}", ElevationRange.Low, ElevationRange.High));
            returnList.Add("Temperature", string.Format("{0} - {1}", TemperatureRange.Low, TemperatureRange.High));
            returnList.Add("Humidity", string.Format("{0} - {1}", HumidityRange.Low, HumidityRange.High));

            foreach (Biome occur in OccursIn)
            {
                returnList.Add("Occurs In", occur.ToString());
            }

            return(returnList);
        }
Exemplo n.º 11
0
        public override string ToString()
        {
            string longStringOfProps = "";

            for (int i = 0; i < Properties.Count; i++)
            {
                if (i != Properties.Count - 1)
                {
                    longStringOfProps += Properties[i].ToString() + "*,*";
                }
                else
                {
                    longStringOfProps += Properties[i].ToString();
                }
            }

            return(Name + "*|*" + Template.ToString() + "*|*" + Rarity.ToString() + "*|*" + longStringOfProps + "*|*" + ImagePath + "*|*" + Category);
        }
Exemplo n.º 12
0
        public void Save(int itemNum)
        {
            if (!Directory.Exists(Paths.DataPath + "Item"))
            {
                Directory.CreateDirectory(Paths.DataPath + "Item");
            }
            using (XmlWriter writer = XmlWriter.Create(Paths.DataPath + "Item\\" + itemNum + ".xml", Logger.XmlWriterSettings))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("ItemEntry");

                #region Basic data

                writer.WriteStartElement("General");
                writer.WriteElementString("Name", Name);
                writer.WriteElementString("Description", Desc);
                writer.WriteElementString("ItemType", Type.ToString());
                writer.WriteElementString("Price", Price.ToString());
                writer.WriteElementString("Rarity", Rarity.ToString());
                writer.WriteElementString("Sprite", Sprite.ToString());
                writer.WriteElementString("Requirement", Req.ToString());
                writer.WriteElementString("Req1", Req1.ToString());
                writer.WriteElementString("Req2", Req2.ToString());
                writer.WriteElementString("Req3", Req3.ToString());
                writer.WriteElementString("Req4", Req4.ToString());
                writer.WriteElementString("Req5", Req5.ToString());
                writer.WriteElementString("Effect", Effect.ToString());
                writer.WriteElementString("Effect1", Effect1.ToString());
                writer.WriteElementString("Effect2", Effect2.ToString());
                writer.WriteElementString("Effect3", Effect3.ToString());
                writer.WriteElementString("ThrowEffect", ThrowEffect.ToString());
                writer.WriteElementString("Throw1", Throw1.ToString());
                writer.WriteElementString("Throw2", Throw2.ToString());
                writer.WriteElementString("Throw3", Throw3.ToString());
                writer.WriteEndElement();

                #endregion Basic data

                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
        }
Exemplo n.º 13
0
    public Effect GenerateEffect(EquipmentType ET, Rarity rarity)
    {
        LevelAndTypeSpecificEffects.Clear();
        foreach (Effect effect in Effects.EffectList)
        {
            if (effect.EquipmentType == ET.ToString() && effect.Rarity == rarity.ToString())
            {
                LevelAndTypeSpecificEffects.Add(effect);
            }
        }
        Effect newEffect;
        int    effectIndex;

        switch (ET)
        {
        case EquipmentType.Weapon:
            effectIndex = Random.Range(0, WeaponEffects.Count);
            newEffect   = CheckForEffect(WeaponEffects[effectIndex]);
            return(newEffect);

        case EquipmentType.Armor:
            effectIndex = Random.Range(0, ArmorEffects.Count);
            newEffect   = CheckForEffect(ArmorEffects[effectIndex]);
            return(newEffect);

        case EquipmentType.Accessory:
            effectIndex = Random.Range(0, AccessoryEffects.Count);
            newEffect   = CheckForEffect(AccessoryEffects[effectIndex]);
            return(newEffect);

        case EquipmentType.Upgrade:
            effectIndex = Random.Range(0, UpgradeEffects.Count);
            newEffect   = CheckForEffect(UpgradeEffects[effectIndex]);
            return(newEffect);

        default:
            return(null);
        }
    }
Exemplo n.º 14
0
        public override string ToString()
        {
            string ret = rarity.ToString() + " Item\nSlot: " + slot.ToString() + "\n";

            if (bonusAttack > 0)
            {
                ret += "\nAttack: " + bonusAttack;
            }
            if (bonusHealth > 0)
            {
                ret += "\nHealth: " + bonusHealth;
            }
            if (bonusSpeed > 0)
            {
                ret += "\nSpeed: " + bonusSpeed;
            }
            if (bonusJump > 0)
            {
                ret += "\nJump: " + bonusJump;
            }
            return(ret);
        }
Exemplo n.º 15
0
    // Render this property in a GUI context.
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        Rarity current = (Rarity)property.enumValueIndex;

        Debug.Log(property.enumValueIndex);
        Rarity[] rarities = System.Enum.GetValues(typeof(Rarity)) as Rarity[];

        float btnWidth = position.width / rarities.Length;

        for (int i = 0; i < rarities.Length; i++)
        {
            Rarity rarity = rarities[i];

            Rect rect = EditorGUI.IndentedRect(position);
            rect.xMin += btnWidth * i;
            rect.width = btnWidth;

            Color prevGuiColor = GUI.color;

            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
            buttonStyle.fontStyle = FontStyle.Bold;
            if (rarity == current)
            {
                GUI.color = RARITY_COLORS[rarity];
            }
            else
            {
                buttonStyle.normal.textColor = RARITY_COLORS[rarity];
            }

            string btnLabel = rarity.ToString().Substring(0, 1);
            if (GUI.Button(rect, btnLabel, buttonStyle))
            {
                property.enumValueIndex = i;
            }

            GUI.color = prevGuiColor;
        }
    }
Exemplo n.º 16
0
        public static string ToDisplayString(this Rarity rarity)
        {
            var attribute = rarity.GetType().GetMember(rarity.ToString()).First().GetCustomAttributes(typeof(RarityAttribute), false).FirstOrDefault() as RarityAttribute;

            return(attribute?.Name ?? rarity.ToString());
        }
Exemplo n.º 17
0
 public override string ToString()
 {
     return(rarity.ToString() + " " + Name);
 }
Exemplo n.º 18
0
 public override string ToString()
 {
     return($"{Category.ToString()} - {Type.ToString()} - {Rarity.ToString()} - {Time.ToString()} - {ChatId}");
 }
Exemplo n.º 19
0
        static void test(string Name)
        {
            Rarity currentRare = Rarity.none;
            Clan   currentClan = Clan.nilfgaard;

            Parser currentType = Parser.units;

            int linesOfCard = 0;

            string[]      lines       = File.ReadAllLines("../Parse/" + Name + ".txt");
            List <string> res         = new List <string>();
            List <string> currentCard = new List <string>();

            foreach (string line in lines)
            {
                if (line.IndexOf("--") == 0)
                {
                    string rest = line.Substring(2);
                    if (rest == "GOLD")
                    {
                        currentRare = Rarity.gold;
                    }
                    if (rest == "SILVER")
                    {
                        currentRare = Rarity.silver;
                    }
                    if (rest == "BRONZE")
                    {
                        currentRare = Rarity.bronze;
                    }
                    if (rest == "SPECIALS")
                    {
                        currentType = Parser.specials;
                    }
                    if (rest == "UNITS")
                    {
                        currentType = Parser.units;
                    }
                    if (rest == "LEADERS")
                    {
                        currentType = Parser.leaders;
                    }
                    res.Add("// < > " + rest);
                    continue;
                }
                if (line == "")
                {
                    if (linesOfCard == 2)
                    {
                        res.AddRange(currentCard);
                        res.AddRange(new List <string>()
                        {
                            "\t\t", "\t\treturn " + (currentType == Parser.specials ? "spec;" : "self;"), "\t}", "}"
                        });
                        currentCard.Clear();
                        linesOfCard = 0;
                    }
                    continue;
                }
                if (linesOfCard == 0)
                {
                    linesOfCard++;
                    string name        = line;
                    bool   needchanges = line.Last() == '?';
                    if (needchanges)
                    {
                        currentCard.Add("// Suggest anything to improove this card!");
                        name = name.Substring(0, name.Length - 1);
                    }
                    string nameNoSpace = "";
                    foreach (char c in name)
                    {
                        if (Card.Alphabet.IndexOf(c) >= 0)
                        {
                            nameNoSpace += c;
                        }
                    }
                    switch (currentType)
                    {
                    case Parser.units: currentCard.AddRange(new List <string>()
                        {
                            "public static Unit " + nameNoSpace, "{", "\tget", "\t{", "\t\tUnit self = new Unit();"
                        }); break;

                    case Parser.leaders: currentCard.AddRange(new List <string>()
                        {
                            "public static Leader " + nameNoSpace, "{", "\tget", "\t{", "\t\tLeader self = new Leader();"
                        }); break;

                    default: currentCard.AddRange(new List <string>()
                        {
                            "public static Special " + nameNoSpace, "{", "\tget", "\t{", "\t\tSpecial spec = new Special();"
                        }); break;
                    }
                    currentCard.Add(String.Format("\t\t{0}.setAttributes(Clan.{1}, Rarity.{2}, \"{3}\");",
                                                  currentType == Parser.specials ? "spec" : "self", currentClan.ToString(), currentRare.ToString(), name));
                    //self.setAttributes(Clan.skellige, Rarity.gold, "Harald the Cripple");
                    continue;
                }
                if (linesOfCard == 1)
                {
                    linesOfCard++;
                    List <string> tagsAndPower = line.Split(' ').ToList();
                    int           power        = 0;
                    if (currentType != Parser.specials)
                    {
                        power = int.Parse(tagsAndPower.Last());
                        tagsAndPower.Remove(tagsAndPower.Last());
                    }
                    //self.setUnitAttributes(6, Tag.clanAnCraite);
                    //spec.setSpecialAttributes(Tag.alchemy, Tag.item);
                    string tagString = "";
                    foreach (string tag in tagsAndPower)
                    {
                        if (tag != "Leader" && tag != "Special")
                        {
                            tagString += String.Format("Tag.{0}{1}", tag.ToLower(), tag == tagsAndPower.Last() ? "" : ", ");
                        }
                    }
                    if (power == 0)
                    {
                        currentCard.Add(String.Format("\t\tspec.setSpecialAttributes({0});", tagString));
                    }
                    else
                    {
                        currentCard.Add(String.Format("\t\tself.setUnitAttributes({1}, {0});", tagString, power));
                    }
                    if (currentType == Parser.leaders)
                    {
                        currentCard.Add("\t\tself.setLeaderAttributes();");
                    }
                    currentCard.Add("\t\t");
                    continue;
                }
                if (linesOfCard == 2)
                {
                    currentCard.Add("\t\t// Do not forget to check and RECHECK correctence of current ability,");
                    currentCard.Add("\t\t// its triggering condition and signature of delegate!");
                    currentCard.Add(String.Format("\t\t{0}.setOnDeploy ((s, f) => ", currentType == Parser.specials ? "spec" : "self"));
                    currentCard.Add("\t\t{}, \"" + line + "\");");
                    continue;
                }
            }
            string resString = "";

            foreach (string s in res)
            {
                resString += s + Environment.NewLine;
            }
            File.WriteAllText("../Parse/" + Name + "_parsed.txt", resString);
            int x = 10;
        }
Exemplo n.º 20
0
 public string GetTier()
 {
     return(Rarity.ToString().ToLower());
 }
Exemplo n.º 21
0
        public static string GetString(this Rarity rarity)
        {
            TextInfo textInfo = CultureInfo.InvariantCulture.TextInfo;

            return(textInfo.ToTitleCase(rarity.ToString().ToLowerInvariant()));
        }
Exemplo n.º 22
0
 public string GetRarity()
 {
     return(rarity.ToString());
 }
Exemplo n.º 23
0
 public Potion(Rarity rarity) : base(rarity)
 {
     GeneratePotion();
     name        = rarity.ToString() + " " + potionSize + " healing potion";
     description = "restore " + healingPer.ToString() + "% health";
 }
Exemplo n.º 24
0
 public Armor(Rarity rarity) : base(rarity)
 {
     GenerateArmor();
     name        = rarity.ToString() + " " + material.ToString() + " " + armorType.ToString();
     description = "+" + armor.ToString() + " ARM";
 }
Exemplo n.º 25
0
 public Weapon(Rarity rarity) : base(rarity)
 {
     GenerateWeapon();
     name        = rarity.ToString() + " " + material.ToString() + " " + weaponType.ToString();
     description = "+" + damage.ToString() + " DMG";
 }
Exemplo n.º 26
0
 public string getRarity()
 {
     return(rar.ToString());
 }
    //Obscure last enchantment
    public string GetTooltip(bool hideLastEnchantment)
    {
        StringBuilder sb       = new StringBuilder();
        bool          anyAdded = false;

        //Gear stats
        if (ItemType == Type.Gear)
        {
            if (BasePhysicalAttack > 0)
            {
                sb.AppendFormat("{0,-18} {1,4}", "Physical Attack", PhysicalAttack);
                anyAdded = true;
            }
            if (BasePhysicalDefense > 0)
            {
                if (anyAdded)
                {
                    sb.Append("\n");
                }
                sb.AppendFormat("{0,-18} {1,4}", "Physical Defense", PhysicalDefense);
                anyAdded = true;
            }
            if (BaseMagicalAttack > 0)
            {
                if (anyAdded)
                {
                    sb.Append("\n");
                }
                sb.AppendFormat("{0,-18} {1,4}", "Magical Attack", MagicalAttack);
                anyAdded = true;
            }
            if (BaseMagicalDefense > 0)
            {
                if (anyAdded)
                {
                    sb.Append("\n");
                }
                sb.AppendFormat("{0,-18} {1,4}", "Magical Defense", MagicalDefense);
                anyAdded = true;
            }
            if (BaseSpeed > 0)
            {
                if (anyAdded)
                {
                    sb.Append("\n");
                }
                sb.AppendFormat("{0,-18} {1,4}", "Speed", Speed);
                anyAdded = true;
            }
            //Rarity is only for gear
            if (anyAdded)
            {
                sb.Append("\n");
            }
            sb.AppendFormat("{0,-10} {1,12}", "Rarity", ItemRarity.ToString().Replace('_', ' '));
            anyAdded = true;
        }
        //Item tier, if applicable
        if (Tier > 0)
        {
            if (anyAdded)
            {
                sb.Append("\n");
            }
            sb.AppendFormat("{0,-18} {1,4}", "Tier", Tier);
            anyAdded = true;
        }
        //If there are any enchantments, list them
        if (Enchantments.Count > 0)
        {
            if (anyAdded)
            {
                sb.Append("\n");
            }
            sb.Append("     Enchantments");
            //Hide last enchantment
            int limit = (hideLastEnchantment ? Enchantments.Count - 1 : Enchantments.Count);
            for (int i = 0; i < limit; i++)
            {
                sb.Append("\n");
                sb.Append(Enchantments[i].GetDescription());
            }
            if (hideLastEnchantment)
            {
                sb.Append("\n");
                sb.Append("+ New Enchantment");
            }
            anyAdded = true;
        }
        //Creator, if applicable
        if (!string.IsNullOrEmpty(Creator))
        {
            if (anyAdded)
            {
                sb.Append("\n");
            }
            sb.AppendFormat("{0,-10} {1,12}", "Creator", Creator);
        }

        return(sb.ToString());
    }
Exemplo n.º 28
0
 public static string GetLocalize(this Rarity rarity)
 {
     return(LocalizationText.GetString(rarity.ToString().ToUpper()));
 }
Exemplo n.º 29
0
 public override string ToString()
 {
     return("Rarity: " + rarity.ToString());
 }
Exemplo n.º 30
0
 public static Sprite Get(Rarity rarity)
 => Get($"frame_{rarity.ToString().ToLower()}");