Пример #1
0
        // TODO: AddEquipTexture

        /*public int AddEquipTexture(ModItem item, EquipType type, string texture, string armTexture = "", string femaleTexture = "") {
         *      int slot = EquipLoader.ReserveEquipID(type);
         *      EquipLoader.equips[type][texture] = slot;
         *
         *      ModLoader.GetTexture(texture);
         *
         *      if (type == EquipType.Body) {
         *              EquipLoader.armTextures[slot] = armTexture;
         *              EquipLoader.femaleTextures[slot] = femaleTexture.Length > 0 ? femaleTexture : texture;
         *
         *              ModLoader.GetTexture(armTexture);
         *              ModLoader.GetTexture(femaleTexture);
         *      }
         *
         *      if (type == EquipType.Head || type == EquipType.Body || type == EquipType.Legs) {
         *              EquipLoader.slotToId[type][slot] = item.item.type;
         *      }
         *
         *      return slot;
         * }*/

        private void AutoloadItem(Type type)
        {
            ModItem item = (ModItem)Activator.CreateInstance(type);

            item.mod = this;
            string name    = type.Name;
            string texture = (type.Namespace + "." + type.Name).Replace('.', '/');

            // TODO: IList<EquipType> equips = new List<EquipType>();

            if (item.Autoload(ref name, ref texture /*, equips*/))
            {
                AddItem(name, item, texture);

                /*if (equips.Count > 0) {
                 *      EquipLoader.idToSlot[item.item.type] = new Dictionary<EquipType, int>();
                 *
                 *      foreach (EquipType equip in equips) {
                 *              string equipTexture = texture + "_" + equip.ToString();
                 *              string armTexture = texture + "_Arms";
                 *              string femaleTexture = texture + "_FemaleBody";
                 *
                 *              item.AutoloadEquip(equip, ref equipTexture, ref armTexture, ref femaleTexture);
                 *              int slot = AddEquipTexture(item, equip, equipTexture, armTexture, femaleTexture);
                 *              EquipLoader.idToSlot[item.item.type][equip] = slot;
                 *      }
                 * }*/
            }
        }
Пример #2
0
        internal void SetupModItem(Item item)
        {
            ModItem newItem = (ModItem)Activator.CreateInstance(GetType());

            newItem.item = item;
            item.modItem = newItem;
            newItem.mod  = mod;
        }
Пример #3
0
        public int ItemType(string name)
        {
            ModItem item = GetItem(name);

            if (item == null)
            {
                return(0);
            }

            return(item.item.type);
        }
Пример #4
0
        public void AddItem(string name, ModItem item, string texture)
        {
            int id = ItemLoader.ReserveItemID();

            item.item.SetNameOverride(name);
            item.item.ResetStats(id);
            items[name]          = item;
            ItemLoader.items[id] = item;
            item.texture         = texture;
            item.mod             = this;
        }