public void RegisterUnequip(ItemClasses.Item item) {
		if (item != null) {
			increaseStrength(-item.GetValueFromAttribute(Attribute.Strength));
			increaseIntellect(-item.GetValueFromAttribute(Attribute.Intellect));
			increaseVitality(-item.GetValueFromAttribute(Attribute.Vitality));
		}
	}
        private void clear_all_inputs()
        {
            //Universal properties
            ItemIDNO.Value = 0;
            ItemCost.Value = 0;
            ItemName.Clear();
            ItemTier.Value = 0;
            ItemClasses.ClearSelected();

            //Potion properties
            PotionType.SelectedIndex = -1;
            PotionPotency.Value      = 0;

            //Armor properties
            ArmorAbValue.Value      = 0;
            ArmorPadValue.Value     = 0;
            ArmorRigValue.Value     = 0;
            ArmorInsValue.Value     = 0;
            ArmorHdValue.Value      = 0;
            ArmorInteg.Value        = 0;
            ArmorOverArmor.Checked  = false;
            ArmorUnderArmor.Checked = false;
            ArmorHelmet.Checked     = false;

            //Weapon properties
            WeaponHands.Value  = 1;
            WeaponMaxDmg.Value = 0;
            WeaponMinDmg.Value = 0;
            WeaponRange.Value  = 1;
            WeaponType.ClearSelected();

            //Scroll properties
        }
示例#3
0
        public FilesContainer(IMemory memory)
        {
            _Memory         = memory;
            ItemClasses     = new ItemClasses();
            FilesFromMemory = new FilesFromMemory(_Memory);

            ReloadFiles();
        }
示例#4
0
 //Warning Will need to update this as new classes that subscribe to IItem get added.
 public static IItem CreateItem(ItemClasses itemClass)
 {
     if (itemClass == ItemClasses.Baseclass)
     {
         return(new BaseItem());
     }
     return(null);
 }
示例#5
0
 public Item()
 {
     mName = "[unknown]";
       mCount = 1;
       mStackable = false;
       mClass = ItemClasses.unknown;
       mOneOnly = false;
 }
 public void Display(ItemClasses.Item item, string mtext)
 {
     this.iteminfo = item;
     this.textcolor = Color.White;
     this.midstring = mtext;
     previousTimeSec = (float)gameTime.ElapsedGameTime.TotalSeconds + 2.0f;
     this.Active = true;
 }
示例#7
0
 public FsController(Memory mem)
 {
     _mem          = mem;
     _files        = GetAllFiles();
     ItemClasses   = new ItemClasses();
     BaseItemTypes = new BaseItemTypes(mem, FindFile("Data/BaseItemTypes.dat"));
     Stats         = new StatsDat(mem, FindFile("Data/Stats.dat"));
     Tags          = new TagsDat(mem, FindFile("Data/Tags.dat"));
     Mods          = new ModsDat(mem, FindFile("Data/Mods.dat"), Stats, Tags);
 }
	public void EquipRightClick(ItemClasses.Item item) {
		if (item == null)
			return;
		
		foreach (var slot in slots) {
			if (slot.slotType == item.Type) {
				slot.Place (item);
				break;
			}
		}
	}
		private ItemClasses.AttributeTag[] findHighestSchools(ItemClasses.Item content) {
			ItemClasses.AttributeTag[] schools = content.GetAllTags ();

			int highest = 0, second_highest = 0, h_index = -1, sh_index = -1;

			for (int i = 0; i < schools.Length; i++) {
				if (schools [i].Value > highest) {
					//Put the old highest as second highest
					second_highest = highest;
					sh_index = h_index;

					//Update the values for the new highest
					highest = schools [i].Value;
					h_index = i;

					Debug.Log ("Found an attribute with higher values: " + schools [i].Name);

					continue;
				}

				//Update the second highest value in-case the value is higher
				if (schools [i].Value > second_highest) {
					second_highest = schools [i].Value;
					sh_index = i;
				}
			}

			var ret = new ItemClasses.AttributeTag[2];

			//Set both schools to null, if all schools are 0
			if (h_index == -1) {
				ret [0] = null;
				ret [1] = null;

				return ret;
			} 

			//Set secondary school to null, if only one school is higher than 0
			if (h_index != -1 && sh_index == -1) {
				ret [0] = schools [h_index];
				ret [1] = null;

				return ret;
			} 
			//There are points in two schools, add them to the array
			ret [0] = schools [h_index];
			ret [1] = schools [sh_index];

			Debug.Log ("Highest school: " + ret[0]);
			Debug.Log ("Other school: " + ret [1]);

			return ret;
		}
		public override void Place (ItemClasses.Item content)
		{
			base.Place (content);
			if (content != null) {
				var highest = findHighestSchools (content);
				Spell newSpell = GameRegistry.SpellDatabase.GetSpellFromCrystal (highest);

				Debug.Log ("Should assign: " + newSpell.Name);

				holder.UpdateSpells (newSpell, position);
			}
		}
示例#11
0
 /// <summary>
 /// Disables all the slots in the inventory display, except those from a certain class
 /// </summary>
 /// <param name="itemClass">Item class.</param>
 public virtual void DisableAllBut(ItemClasses itemClass)
 {
     for (int i = 0; i < SlotContainer.Count; i++)
     {
         if (InventoryItem.IsNull(TargetInventory.Content[i]))
         {
             continue;
         }
         if (TargetInventory.Content[i].ItemClass != itemClass)
         {
             SlotContainer[i].GetComponent <InventorySlot>().DisableSlot();
         }
     }
 }
示例#12
0
        // Returns a list of all the items in the inventory that match the specified class
        public virtual List <int> InventoryContains(ItemClasses searchedClass)
        {
            List <int> list = new List <int>();

            for (int i = 0; i < Content.Length; i++)
            {
                if (InventoryItem.IsNull(Content[i]))
                {
                    continue;
                }
                if (Content[i].ItemClass == searchedClass)
                {
                    list.Add(i);
                }
            }
            return(list);
        }
示例#13
0
        public FilesContainer(IMemory memory)
        {
            _Memory         = memory;
            ItemClasses     = new ItemClasses();
            FilesFromMemory = new FilesFromMemory(_Memory);

            ReloadFiles();

            Task.Run(() =>
            {
                using (new PerformanceTimer("Preload stats and mods"))
                {
                    var _  = this.Stats.records.Count;
                    var __ = this.Mods.records.Count;
                    this.ParseFiles(this.AllFiles);
                }
            });
        }
示例#14
0
        public FilesContainer(IMemory memory)
        {
            _memory         = memory;
            ItemClasses     = new ItemClasses();
            FilesFromMemory = new FilesFromMemory(_memory);
            using (new PerformanceTimer("Load files from memory"))
            {
                AllFiles = FilesFromMemory.GetAllFiles();
            }

            Task.Run(() =>
            {
                using (new PerformanceTimer("Preload stats and mods"))
                {
                    var test  = Stats.records.Count;
                    var test2 = Mods.records.Count;
                    ParseFiles(AllFiles);
                }
            });
        }
示例#15
0
        public FilesContainer(IMemory memory)
        {
            _memory         = memory;
            ItemClasses     = new ItemClasses();
            FilesFromMemory = new FilesFromMemory(_memory);

            using (new PerformanceTimer("Load files from memory"))
            {
                AllFiles = FilesFromMemory.GetAllFiles();

                Trace.WriteLine($"Loaded {AllFiles.Count} files from memory {AllFiles.Values.Count(x => x.Ptr > 0)}/{AllFiles.Count} has pointers.");
            }

            /*Task.Run(() =>
             * {
             *  using (new PerformanceTimer("Preload stats and mods"))
             *  {
             *      var test = Stats.records.Count;
             *      var test2 = Mods.records.Count;
             *      ParseFiles(AllFiles);
             *  }
             * });*/
        }
				/// <summary>
		/// Determines if some slot accepts a given ItemType
		/// </summary>
		/// <returns><c>true</c> if the item is a Magic item, <c>false</c> otherwise.
		/// </returns>
		/// <param name="type">Type to check for.</param>
		public override bool DoesAccept (ItemClasses.ItemType type)
		{
			return type == ItemClasses.ItemType.Magic;
		}
		public void Drop(ItemClasses.Item item, Vector2 position) {
			var inst = Instantiate (itemdropPrefab);
			inst.GetComponent<IDropable>().Drop (item);
			inst.transform.position = position;
		}
示例#18
0
		public void Drop(ItemClasses.Item i) {
			DropStack (i, 1);
		}
示例#19
0
	public virtual void Equip(ItemClasses.Item item) {}
示例#20
0
		public void DropStack(ItemClasses.Item i, int stacksize) {
			this.heldItem = i;
			this.stacksize = stacksize;
			GetComponent<SpriteRenderer> ().sprite = i.icon;
			Destroy (this.gameObject, lifetime);
		}