public OperationResults EquipItem(Item.Item item, out Item.Item oldItem, InventoryEquipSlot preferSlot = InventoryEquipSlot.None) { oldItem = null; /*if (item.InventoryEquipSlot == InventoryEquipSlot.None) * { * InventoryEquipSlot target= InventoryEquipSlot.None; * target = GetEquipSlot(item); * if ((target == InventoryEquipSlot.Earring && preferSlot == InventoryEquipSlot.Earring2) || (target == InventoryEquipSlot.Ring && preferSlot == InventoryEquipSlot.Ring2)) * { * target = preferSlot; * } * if (target != InventoryEquipSlot.None) * { * if (equip[target] == null) * { * equip[target] = item; * item.InventoryEquipSlot = target; * return OperationResults.EQUIPT; * } * else * { * oldItem = equip[target]; * oldItem.InventoryEquipSlot = InventoryEquipSlot.None; * equip[target] = item; * item.InventoryEquipSlot = target; * return OperationResults.EQUIPT; * } * } * else * return OperationResults.FAILED; * } * else*/ return(OperationResults.FAILED); }
public Equipment GetEquipmentBySlot(InventoryEquipSlot slot) { Equipment equipment; if (m_EquipmentMap.TryGetValue((int)slot, out equipment)) { return(equipment); } return(null); }
private PlayerEquipmentCellData CreateCellData(InventoryEquipSlot slot) { var equipment = GamePlayMgr.S.playerMgr.role.equipComponent.GetEquipmentBySlot(slot); if (equipment != null) { return(new PlayerEquipmentCellData(equipment)); } return(null); }
public Item(string id, string name, string description, string smallIcon, string icon, InventoryEquipSlot equippableIn, bool createGlobally = true) { ID = id; Name = name; Description = description; SmallIcon = smallIcon; Icon = icon; EquippableIn = equippableIn; if (createGlobally) { Items.Add(id, this); } }
public ItemSlotReference this[InventoryEquipSlot slot] { get { if (this[_equips[slot]].IsEmptyReference || !(this[_equips[slot]].Item.EquippableIn.HasFlag(slot))) { return(this[EMPTY_SLOT]); } return(this[_equips[slot]]); } set { if (value.IsEmptyReference || !value.Item.EquippableIn.HasFlag(slot)) { _equips[slot] = EMPTY_SLOT; } else { _equips[slot] = value.Slot; } } }
private bool CheckCanEquip(InventoryEquipSlot slot, EquipmentType type) { switch (slot) { case InventoryEquipSlot.Helmet: if (type == EquipmentType.Helmet) { return(true); } break; case InventoryEquipSlot.Torso: if (type == EquipmentType.Torso) { return(true); } break; case InventoryEquipSlot.Hands: if (type == EquipmentType.Hands) { return(true); } break; case InventoryEquipSlot.Legs: if (type == EquipmentType.Legs) { return(true); } break; case InventoryEquipSlot.Hips: if (type == EquipmentType.Hips) { return(true); } break; case InventoryEquipSlot.Shoulders: if (type == EquipmentType.Shoulders) { return(true); } break; case InventoryEquipSlot.Back: if (type == EquipmentType.Back) { return(true); } break; case InventoryEquipSlot.Weapon: if (type == EquipmentType.Weapon) { return(true); } break; } return(false); }
public CombatItem(string id, string name, string description, string smallIcon, string icon, InventoryEquipSlot equippableIn, bool createGlobally = true) : base(id, name, description, smallIcon, icon, equippableIn, createGlobally) { }
public WeaponItem(string id, string name, string description, string smallIcon, string icon, InventoryEquipSlot equippableIn, Tuple <int, int> damageRange, bool isAgility, bool createGlobally = true) : base(id, name, description, smallIcon, icon, equippableIn, createGlobally) { DamageRange = damageRange; UsesAgility = isAgility; }
public ArmorItem(string id, string name, string description, string smallIcon, string icon, ProtectionType protectionType, int armorValue, InventoryEquipSlot equippableIn, bool createGlobally = true) : base(id, name, description, smallIcon, icon, equippableIn, createGlobally) { Protection = protectionType; ArmorValue = armorValue; }