示例#1
0
        public static List <string> GearsLarge(int stdoutIndex, D2Gear gear, int barLength)
        {
            var stdoutIndexStr = stdoutIndex.ToString().ToCharArray().Length < 2 ? "0" + stdoutIndex.ToString() : stdoutIndex.ToString();

            try
            {
                var l         = new List <string>();
                var name      = Translate.Name(gear.name);
                var rarity    = Translate.Rarity(gear.rarity);
                var slot      = Translate.Slot(gear.slot);
                var brand     = Translate.Brand(gear.brand);
                var brandDesc = Translate.BrandDesc(brand);
                var coreStr   = string.Empty;
                if (gear.core != null && !string.IsNullOrEmpty(gear.core))
                {
                    coreStr = gear.core + "<br/>";
                }
                var         attribute  = Translate.AttrValAndText(coreStr + gear.attributes);
                AttrValType?mod        = Translate.Mod(gear.mods);
                var         talent     = Translate.Talents(gear.talents);
                var         talentDesc = Translate.TalentsDesc(talent);
                var         format     = "".PadLeft((stdoutIndexStr + ". ").Length);
                l.Add(stdoutIndexStr + ". " + name);
                l.Add(format + rarity + "§w [" + slot + "] " + brand);
                l.Add(format + gear.armor + " 装甲 " + Translate.Vendor(gear.vendor));
                l.Add("");
                var lattrmain = new List <string>();
                var lattroff  = new List <string>();
                foreach (var attr in attribute)
                {
                    if (attr.val == 0 || attr.valMax == 0)
                    {
                        continue;
                    }
                    var valMax = attr.valMax == Translate.ATTRVALMAXDEFAULT ? "???" : attr.valMax.ToString();
                    var tmp    = new List <string>();
                    var str    = attr.val >= attr.valMax ? "§o▲§w +" : "+";
                    if (attr.isMainAttr && attr.valType == AttrValType.Utility)
                    {
                        str = "+";
                    }
                    var checkValError = attr.val > (attr.valMax * 1.67) ? " §y数值异常?§w" : "";
                    tmp.Add(str + attr.val + (attr.type == AttributeType.Percent ? "%" : "") + " " + attr.desc + "§w / " +
                            valMax + (attr.type == AttributeType.Percent ? "%" : "") + checkValError);
                    var bl       = int.Parse(Config.GetValueConf("barLength"));
                    var percent  = (int)Math.Floor(attr.val / attr.valMax * (barLength - 1)) / bl;
                    var percent2 = (int)Math.Floor(((barLength - 1) - (double)percent * bl) / bl);
                    if (percent2 < 0)
                    {
                        percent += percent2;
                        percent2 = 0;
                    }
                    var color = "";
                    switch (attr.valType)
                    {
                    case AttrValType.Offensive:
                        color = "§r";
                        break;

                    case AttrValType.Defensive:
                        color = "§c";
                        break;

                    case AttrValType.Utility:
                        color = "§y";
                        break;

                    case AttrValType.Unknown:
                    default:
                        color = "§w";
                        break;
                    }
                    var barStr = new StringBuilder();
                    for (int i = 0; i < percent; i++)
                    {
                        barStr.Append("█");
                    }
                    for (int i = 0; i < percent2; i++)
                    {
                        barStr.Append("▁");
                    }
                    tmp.Add(color + barStr.ToString());
                    if (attr.isMainAttr)
                    {
                        lattrmain.AddRange(tmp);
                    }
                    else
                    {
                        lattroff.AddRange(tmp);
                    }
                }
                l.Add("主要属性:");
                l.AddRange(lattrmain);
                l.Add("");
                l.Add("次要属性:");
                l.AddRange(lattroff);
                if (mod.HasValue)
                {
                    l.Add("");
                    l.Add("模组槽位:" + Translate.TransAttrValType(mod.Value));
                }
                if (!string.IsNullOrWhiteSpace(talent))
                {
                    l.Add("");
                    l.Add("天赋:" + talent);
                    if (talentDesc.Length != 0)
                    {
                        foreach (string str in talentDesc)
                        {
                            l.Add(str);
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(brandDesc))
                {
                    l.Add("");
                    l.Add(brand + " 套装效果:");
                    foreach (string str in brandDesc.Split('\n'))
                    {
                        l.Add(str);
                    }
                }
                return(l);
                // 装备名称 色泽名称 栏位图标 装甲/伤害值 装备分数
                // 品牌套组名称 品牌套组三件套效果
                // 核心属性、值、条
                // 次属性、值、条
                // 改造模块颜色
                // 价格
            }
            catch (Exception)
            {
                var l = new List <string>();
                l.Add(stdoutIndexStr + ". " + gear.name);
                l.Add("");
                l.Add("");
                l.Add("数据源信息无法正常显示");
                l.Add("可能是源录入错误");
                l.Add("可自行打开当周json文件排错");
                return(l);
            }
        }
示例#2
0
        public static List <string> GearsList(int stdoutIndex, D2Gear gear)
        {
            var stdoutIndexStr = stdoutIndex.ToString().ToCharArray().Length < 2 ? "0" + stdoutIndex.ToString() : stdoutIndex.ToString();

            try
            {
                var l       = new List <string>();
                var name    = Translate.Name(gear.name);
                var slot    = Translate.Slot(gear.slot);
                var brand   = Translate.Brand(gear.brand);
                var coreStr = string.Empty;
                if (gear.core != null && !string.IsNullOrEmpty(gear.core))
                {
                    coreStr = gear.core + "<br/>";
                }
                var         attribute = Translate.AttrValAndText(coreStr + gear.attributes);
                AttrValType?mod       = Translate.Mod(gear.mods);
                var         talent    = Translate.Talents(gear.talents);
                l.Add(stdoutIndexStr + ". " + name);
                l.Add("[" + slot + "] " + brand);
                var attrstr     = string.Empty;
                var attrstrmain = new List <string>();
                var attrstroff  = new List <string>();
                foreach (var attr in attribute)
                {
                    string tmp;
                    if (attr.val == 0)
                    {
                        tmp = Translate.TransAttrValType(attr.valType);
                    }
                    else
                    {
                        if (attr.val >= attr.valMax && attr.val / attr.valMax < 3)
                        {
                            if (attr.isMainAttr && attr.valType == AttrValType.Utility)
                            {
                                tmp = Translate.TransAttrValType(attr.valType);
                            }
                            else
                            {
                                tmp = Translate.TransAttrValType(attr.valType) + "[满]";
                            }
                        }
                        else
                        {
                            tmp = Translate.TransAttrValType(attr.valType);
                        }
                    }
                    if (attr.isMainAttr)
                    {
                        attrstrmain.Add(tmp);
                    }
                    else
                    {
                        attrstroff.Add(tmp);
                    }
                }
                attrstr += "主属性:" + string.Join(" ", attrstrmain);
                l.Add(attrstr);
                attrstr = "次属性:" + string.Join(" ", attrstroff);
                l.Add(attrstr);
                var modAndTal = new StringBuilder();
                if (mod.HasValue)
                {
                    modAndTal.Append("模组:" + Translate.TransAttrValType(mod.Value) + "§- ");
                }
                if (!String.IsNullOrWhiteSpace(talent))
                {
                    modAndTal.Append("天赋:" + talent);
                }
                if (modAndTal.Length > 0)
                {
                    l.Add(modAndTal.ToString());
                }
                return(l);
                // 装备名称 品牌套组名称 核心属性数值 次属性是否满值 改造模块颜色
            }
            catch (Exception)
            {
                var l = new List <string>();
                l.Add(stdoutIndexStr + ". " + gear.name);
                l.Add("");
                l.Add("");
                l.Add("数据源异常");
                return(l);
            }
        }