示例#1
0
        private static InfoMessage FormatFlags([NotNull] string header, [NotNull] IEnumerable <string> flags, int headerLength)
        {
            Assert.ArgumentNotNullOrWhiteSpace(header, "header");
            Assert.ArgumentNotNull(flags, "flags");

            var infoMessage = new InfoMessage(header.PadRight(headerLength) + ": ", TextColor.BrightWhite);

            if (flags.Any())
            {
                infoMessage.AppendText(string.Join(", ", flags), TextColor.Cyan);
            }
            else
            {
                infoMessage.AppendText("NONE", TextColor.Cyan);
            }

            return(infoMessage);
        }
示例#2
0
        /// <summary>
        /// Gets the info message representing this affect.
        /// </summary>
        /// <returns><see cref="InfoMessage"/> instance.</returns>
        public override InfoMessage ConvertToInfoMessage()
        {
            var infoMessage = new InfoMessage(string.Format(CultureInfo.CurrentUICulture, " " + Resources.SkillResist, SkillName, ResistValue));

            if (NecessarySetItemsCount > 0)
            {
                infoMessage.AppendText(string.Format(" (Необходимо {0} предмет{1} из набора)", NecessarySetItemsCount, NecessarySetItemsCount < 5 ? "а" : "ов"), TextColor.BrightYellow);
            }

            return(infoMessage);
        }
示例#3
0
        /// <summary>
        /// Gets the info message representing this affect.
        /// </summary>
        /// <returns><see cref="InfoMessage"/> instance.</returns>
        public override InfoMessage ConvertToInfoMessage()
        {
            var infoMessage = new InfoMessage(string.Format(CultureInfo.CurrentUICulture, " " + Resources.AffectEnvenom, GetAsciiTime(Duration)));

            if (NecessarySetItemsCount > 0)
            {
                infoMessage.AppendText(string.Format(" (Необходимо {0} предмет{1} из набора)", NecessarySetItemsCount, NecessarySetItemsCount < 5 ? "а" : "ов"), TextColor.BrightYellow);
            }

            return(infoMessage);
        }
示例#4
0
        /// <summary>
        /// Gets the info message representing this affect.
        /// </summary>
        /// <returns><see cref="InfoMessage"/> instance.</returns>
        public override InfoMessage ConvertToInfoMessage()
        {
            var infoMessage = new InfoMessage(" " + ModifiedParameter + ": ");

            infoMessage.AppendText(Value.ToString("+#;-#;", CultureInfo.CurrentCulture), Value > 0 ? TextColor.BrightGreen : TextColor.BrightRed);

            if (!string.IsNullOrEmpty(SourceSkill))
            {
                infoMessage.AppendText(string.Format(CultureInfo.CurrentUICulture, " ({0})", SourceSkill), TextColor.White);
            }

            if (Duration > 0)
            {
                infoMessage.AppendText(string.Format(CultureInfo.CurrentUICulture, " [{0}]", GetAsciiTime(Duration)), TextColor.White);
            }

            if (NecessarySetItemsCount > 0)
            {
                infoMessage.AppendText(string.Format(" (Необходимо {0} предмет{1} из набора)", NecessarySetItemsCount, NecessarySetItemsCount < 5 ? "а" : "ов"), TextColor.BrightYellow);
            }

            return(infoMessage);
        }
示例#5
0
        public IEnumerable <InfoMessage> ConvertToMessages()
        {
            var result = new List <InfoMessage>();

            {
                var infoMessage = new InfoMessage(Resources.Object + " ", TextColor.BrightWhite);
                infoMessage.AppendText("'" + ObjectName + "'", TextColor.BrightCyan);
                infoMessage.AppendText(", " + Resources.ObjectType + ": " + ObjectType, TextColor.BrightWhite);
                result.Add(infoMessage);
            }

            if (IsFull)
            {
                int maxLength = 0;
                maxLength = Math.Max(maxLength, Resources.CanBeWeared.Length);
                maxLength = Math.Max(maxLength, Resources.ObjectAffects.Length);
                maxLength = Math.Max(maxLength, Resources.ObjectFlags.Length);
                maxLength = Math.Max(maxLength, Resources.RestrictionFlags.Length);
                maxLength = Math.Max(maxLength, Resources.NoFlags.Length);
                maxLength = Math.Max(maxLength, Resources.Affects.Length);
                maxLength++;
                if (ObjectAffects.Any())
                {
                    result.Add(FormatFlags(Resources.ObjectAffects, ObjectAffects, maxLength));
                }

                result.Add(FormatFlags(Resources.CanBeWeared, WearSlots.Select(slot => Resources.ResourceManager.GetString("Wear" + slot, CultureInfo.CurrentUICulture)), maxLength));
                result.Add(FormatFlags(Resources.ObjectFlags, Properties, maxLength));
                result.Add(FormatFlags(Resources.RestrictionFlags, Restrictions, maxLength));
                result.Add(FormatFlags(Resources.NoFlags, BannedFor, maxLength));
                result.Add(FormatFlags(Resources.Affects, Affects, maxLength));
            }

            result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.CommonStats, Weight, Price, RentPrice, RentPriceEquipped, Timer, OfflineTimer, Material)));
            if (MinLevel > 1)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.MinLevel, MinLevel)));
            }

            if (WearingAffect != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.WearingAffect, WearingAffect.AffectName, WearingAffect.Level, WearingAffect.ResetTimeout)));
            }

            if (ScrollOrPotionSpells.Any())
            {
                {
                    var infoMessage = new InfoMessage(Resources.Spells + ": ", TextColor.BrightWhite);
                    infoMessage.AppendText(string.Join(", ", ScrollOrPotionSpells.Select(sp => sp.SpellName)), TextColor.Green);
                    result.Add(infoMessage);
                }
            }

            if (WandOrStaffSpell != null)
            {
                {
                    var infoMessage = new InfoMessage(Resources.Spells + ": ", TextColor.BrightWhite);
                    infoMessage.AppendText(WandOrStaffSpell.SpellName, TextColor.Green);
                    result.Add(infoMessage);
                }
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.StaffCharges, WandOrStaffSpell.TotalCharges, WandOrStaffSpell.ChargesLeft)));
            }

            if (WeaponStats != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.WeaponPower, WeaponStats.DiceSides, WeaponStats.DiceCount, WeaponStats.AverageDamage)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.WeaponSkill, WeaponStats.RequiredSkill)));
            }

            if (ArmorStats != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.ArmorClass, ArmorStats.ArmorClass)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.Armor, ArmorStats.Armor)));
            }

            if (SpellBook != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.SpellProfession, SpellBook.Profession)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.SpellMinLevel, SpellBook.LearnLevel)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.SpellBookSpell, SpellBook.SpellName)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.SpellCastCount, SpellBook.CastCount > 0 ? SpellBook.CastCount.ToString(CultureInfo.InvariantCulture) : Resources.SpellCastCountInfinity)));
            }

            if (Ingredient != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.IngredientColor, Ingredient.Color)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.IngredientPower, Ingredient.Power)));
            }

            if (CraftBook != null)
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.CraftBookRecipeName, CraftBook.Name)));
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.CraftBookRecipeDescription, CraftBook.Description)));
                if (CraftBook.MinLevel > 1)
                {
                    result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.CraftBookMinLevel, CraftBook.MinLevel)));
                }

                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentUICulture, Resources.CraftBookMinSkillLevel, CraftBook.MinSkillLevel)));
            }

            if (AppliedAffects.Any())
            {
                result.Add(new InfoMessage(Resources.AppliedAffects));
                result.AddRange(AppliedAffects.Select(appliedAffect => appliedAffect.ConvertToInfoMessage()));
            }

            if (ItemSetAffects.AppliedAffects.Any())
            {
                result.Add(new InfoMessage(string.Format("Аффекты набора \"{0}\":", ItemSetAffects.Name)));

                for (int i = 0; i < 10; i++)
                {
                    if (ItemSetAffects.AppliedAffects.Any(affects => affects.NecessarySetItemsCount == i))
                    {
                        result.AddRange(ItemSetAffects.AppliedAffects.Where(affects => affects.NecessarySetItemsCount == i)
                                        .Select(appliedAffect => appliedAffect.ConvertToInfoMessage()));
                    }
                }
            }

            if (!string.IsNullOrEmpty(Comments))
            {
                result.Add(new InfoMessage(string.Format(CultureInfo.CurrentCulture, Resources.Comments, Comments)));
            }

            return(result);
        }