예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
파일: Inventory.cs 프로젝트: teamstor/aod
        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;
                }
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
파일: CombatItem.cs 프로젝트: teamstor/aod
 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)
 {
 }
예제 #8
0
 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;
 }
예제 #9
0
 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;
 }