Exemplo n.º 1
0
        /// <summary>
        /// Gets a formatted collection of a player's body equipment.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public static IDictionary <string, string> GetPlayerEquipment(Player player)
        {
            var dict = new Dictionary <string, string>();
            int acc  = 1;
            int van  = 1;
            int unk  = 1;

            for (int i = 0; i < player.armor.Length; i++)
            {
                string key;
                Item   item = player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (i == 0)
                {
                    key = "Head";
                }
                else if (i == 1)
                {
                    key = "Body";
                }
                else if (i == 2)
                {
                    key = "Legs";
                }
                else if (PlayerItemHelpers.IsAccessorySlot(player, i))
                {
                    key = "Accessory " + acc;
                    acc++;
                }
                else if (PlayerItemHelpers.IsVanitySlot(player, i))
                {
                    key = "Vanity " + van;
                    van++;
                }
                else
                {
                    key = "? " + unk;
                    unk++;
                }

                dict[key] = item.HoverName;
            }

            return(dict);
        }
        public static IList <string> GetCurrentPlayerEquipment()
        {
            Player player = Main.LocalPlayer;
            var    list   = new List <string>();

            for (int i = 0; i < player.armor.Length; i++)
            {
                string output = "";
                Item   item   = player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (i == 0)
                {
                    output += "Head: ";
                }
                else if (i == 1)
                {
                    output += "Body: ";
                }
                else if (i == 2)
                {
                    output += "Legs: ";
                }
                else if (PlayerItemHelpers.IsAccessorySlot(player, i))
                {
                    output += "Accessory: ";
                }
                else if (PlayerItemHelpers.IsVanitySlot(player, i))
                {
                    output += "Vanity: ";
                }

                output += item.HoverName;

                list.Add(output);
            }

            return(list);
        }