CalculateStats() public method

Calculate and return the list of effective stats based on item level and quality.
public CalculateStats ( ) : List
return List
    // Token: 0x060000DF RID: 223 RVA: 0x00011944 File Offset: 0x0000FB44
    private void OnTooltip(bool show)
    {
        InvGameItem invGameItem = show ? this.mItem : null;

        if (invGameItem != null)
        {
            InvBaseItem baseItem = invGameItem.baseItem;
            if (baseItem != null)
            {
                string text = string.Concat(new string[]
                {
                    "[",
                    NGUIText.EncodeColor(invGameItem.color),
                    "]",
                    invGameItem.name,
                    "[-]\n"
                });
                text = string.Concat(new object[]
                {
                    text,
                    "[AFAFAF]Level ",
                    invGameItem.itemLevel,
                    " ",
                    baseItem.slot
                });
                List <InvStat> list  = invGameItem.CalculateStats();
                int            i     = 0;
                int            count = list.Count;
                while (i < count)
                {
                    InvStat invStat = list[i];
                    if (invStat.amount != 0)
                    {
                        if (invStat.amount < 0)
                        {
                            text = text + "\n[FF0000]" + invStat.amount;
                        }
                        else
                        {
                            text = text + "\n[00FF00]+" + invStat.amount;
                        }
                        if (invStat.modifier == InvStat.Modifier.Percent)
                        {
                            text += "%";
                        }
                        text  = text + " " + invStat.id;
                        text += "[-]";
                    }
                    i++;
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    text = text + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.Show(text);
                return;
            }
        }
        UITooltip.Hide();
    }
Example #2
0
    /// <summary>
    /// Show a tooltip with the tooltip text for the specified item.
    /// </summary>

    static public void ShowItem(InvGameItem item)
    {
        if (item != null)
        {
            InvBaseItem bi = item.baseItem;

            if (bi != null)
            {
                string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";

                t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;

                List <InvStat> stats = item.CalculateStats();

                for (int i = 0, imax = stats.Count; i < imax; ++i)
                {
                    InvStat stat = stats[i];
                    if (stat.amount == 0)
                    {
                        continue;
                    }

                    if (stat.amount < 0)
                    {
                        t += "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        t += "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent)
                    {
                        t += "%";
                    }
                    t += " " + stat.id;
                    t += "[-]";
                }

                if (!string.IsNullOrEmpty(bi.description))
                {
                    t += "\n[FF9900]" + bi.description;
                }
                ShowText(t);
                return;
            }
        }
        if (mInstance != null)
        {
            mInstance.mTarget = 0f;
        }
    }
Example #3
0
    /// <summary>
    /// Show a tooltip for the item.
    /// </summary>

    void OnTooltip(bool show)
    {
        InvGameItem item = show ? mItem : null;

        if (item != null)
        {
            InvBaseItem bi = item.baseItem;

            if (bi != null)
            {
                string t = "[" + NGUIText.EncodeColor(item.color) + "]" + item.name + "[-]\n";

                t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;

                List <InvStat> stats = item.CalculateStats();

                for (int i = 0, imax = stats.Count; i < imax; ++i)
                {
                    InvStat stat = stats[i];
                    if (stat.amount == 0)
                    {
                        continue;
                    }

                    if (stat.amount < 0)
                    {
                        t += "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        t += "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent)
                    {
                        t += "%";
                    }
                    t += " " + stat.id;
                    t += "[-]";
                }

                if (!string.IsNullOrEmpty(bi.description))
                {
                    t += "\n[FF9900]" + bi.description;
                }
                UITooltip.Show(t);
                return;
            }
        }
        UITooltip.Hide();
    }
    private void OnTooltip(bool show)
    {
        InvGameItem item = !show ? null : this.mItem;

        if (item != null)
        {
            InvBaseItem baseItem = item.baseItem;
            if (baseItem != null)
            {
                string[]       textArray1  = new string[] { "[", NGUITools.EncodeColor(item.color), "]", item.name, "[-]\n" };
                string         str2        = string.Concat(textArray1);
                object[]       objArray1   = new object[] { str2, "[AFAFAF]Level ", item.itemLevel, " ", baseItem.slot };
                string         tooltipText = string.Concat(objArray1);
                List <InvStat> list        = item.CalculateStats();
                int            num         = 0;
                int            count       = list.Count;
                while (num < count)
                {
                    InvStat stat = list[num];
                    if (stat.amount != 0)
                    {
                        if (stat.amount < 0)
                        {
                            tooltipText = tooltipText + "\n[FF0000]" + stat.amount;
                        }
                        else
                        {
                            tooltipText = tooltipText + "\n[00FF00]+" + stat.amount;
                        }
                        if (stat.modifier == InvStat.Modifier.Percent)
                        {
                            tooltipText = tooltipText + "%";
                        }
                        tooltipText = (tooltipText + " " + stat.id) + "[-]";
                    }
                    num++;
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    tooltipText = tooltipText + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.ShowText(tooltipText);
                return;
            }
        }
        UITooltip.ShowText(null);
    }
Example #5
0
    /// <summary>
    /// Show a tooltip with the tooltip text for the specified item.
    /// </summary>
    public static void ShowItem(InvGameItem item)
    {
        if (item != null)
        {
            InvBaseItem bi = item.baseItem;

            if (bi != null)
            {
                string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";

                t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;

                List<InvStat> stats = item.CalculateStats();

                for (int i = 0, imax = stats.Count; i < imax; ++i)
                {
                    InvStat stat = stats[i];
                    if (stat.amount == 0) continue;

                    if (stat.amount < 0)
                    {
                        t += "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        t += "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent) t += "%";
                    t += " " + stat.id;
                    t += "[-]";
                }

                if (!string.IsNullOrEmpty(bi.description)) t += "\n[FF9900]" + bi.description;
                ShowText(t);
                return;
            }
        }
        if (mInstance != null) mInstance.mTarget = 0f;
    }
Example #6
0
    private void OnTooltip(bool show)
    {
        InvGameItem invGameItem = (!show) ? null : mItem;

        if (invGameItem != null)
        {
            InvBaseItem baseItem = invGameItem.baseItem;
            if (baseItem != null)
            {
                string text  = "[" + NGUITools.EncodeColor(invGameItem.color) + "]" + invGameItem.name + "[-]\n";
                string text2 = text;
                text = text2 + "[AFAFAF]Level " + invGameItem.itemLevel + " " + baseItem.slot;
                List <InvStat> list = invGameItem.CalculateStats();
                int            i    = 0;
                for (int count = list.Count; i < count; i++)
                {
                    InvStat invStat = list[i];
                    if (invStat.amount != 0)
                    {
                        text = ((invStat.amount >= 0) ? (text + "\n[00FF00]+" + invStat.amount) : (text + "\n[FF0000]" + invStat.amount));
                        if (invStat.modifier == InvStat.Modifier.Percent)
                        {
                            text += "%";
                        }
                        text  = text + " " + invStat.id;
                        text += "[-]";
                    }
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    text = text + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.ShowText(text);
                return;
            }
        }
        UITooltip.ShowText(null);
    }