////////////////

        internal void UpdateRuinedAccessoriesForPlayer(Player player)
        {
            for (int i = PlayerItemLibraries.VanillaAccessorySlotFirst; PlayerItemLibraries.IsAccessorySlot(player, i); i++)
            {
                Item accItem = player.armor[i];
                if (accItem?.active != true || accItem.prefix != ModContent.PrefixType <RuinedPrefix>())
                {
                    continue;
                }

                this.ConveyRuinedAccessoryStatsToPlayer(player);
            }
        }
Example #2
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 (PlayerItemLibraries.IsAccessorySlot(player, i))
                {
                    key = "Accessory " + acc;
                    acc++;
                }
                else if (PlayerItemLibraries.IsVanitySlot(player, i))
                {
                    key = "Vanity " + van;
                    van++;
                }
                else
                {
                    key = "? " + unk;
                    unk++;
                }

                dict[key] = item.HoverName;
            }

            return(dict);
        }