Exemplo n.º 1
0
 public void DropItem(Item item)
 {
     FreeInventory.Remove(item);
     item.Owner = null;
     OnInventoryChanged();
     OnItemDropped(item);
 }
Exemplo n.º 2
0
        public FreeData(PlayerEntity player)
        {
            this.Player = player;
            this.key    = "player";
            this.id     = player.entityKey.Value.EntityId;

            this.skill = new UnitSkill(this);

            this.freeInventory = new FreeInventory();

            this.Bufs = new PlayerBuf(player);

            this.paras = new SimpleParaList();

            this.StateTimer = new PlayerStateTimer(player);

            AddFields(new ObjectFields(player.playerInfo));
            AddFields(new ObjectFields(player.gamePlay));
            AddFields(new ObjectFields(player.orientation));
            AddFields(new ObjectFields(player.weaponState));
            AddFields(new PlayerFields(player));
            if (player.hasPlayerMask)
            {
                AddFields(new ObjectFields(player.playerMask));
            }
        }
Exemplo n.º 3
0
        public void Unequip(int equipSlot)
        {
            Item item = EquippedInventory[equipSlot];

            EquippedInventory[equipSlot] = null;
            FreeInventory.Add(item);
            OnEquipmentChanged(new EquipmentChangedEventArgs(equipSlot));
        }
Exemplo n.º 4
0
        public void Equip(int itemIndex, int equipSlot)
        {
            EquippableItem item = FreeInventory[itemIndex] as EquippableItem;

            if (item == null)
            {
                throw new NotSupportedException();
            }

            switch (equipSlot)
            {
            case EquipSlot.SKILL1:
            case EquipSlot.SKILL2:
            case EquipSlot.SKILL3:
            case EquipSlot.SKILL4:
            case EquipSlot.SKILL5:
            case EquipSlot.SKILL6:
                if (item.Category != EquippableItem.SlotCategory.Skill)
                {
                    throw new NotSupportedException();
                }
                break;

            case EquipSlot.CLASS:
                if (item.Category != EquippableItem.SlotCategory.Class)
                {
                    throw new NotSupportedException();
                }
                break;

            case EquipSlot.PERK1:
            case EquipSlot.PERK2:
            case EquipSlot.PERK3:
                if (item.Category != EquippableItem.SlotCategory.Perk)
                {
                    throw new NotSupportedException();
                }
                break;

            default:
                throw new NotSupportedException();
            }
            FreeInventory.RemoveAt(itemIndex);
            if (EquippedInventory[equipSlot] != null)
            {
                FreeInventory.Add(EquippedInventory[equipSlot]);
            }
            EquippedInventory[equipSlot] = item;
            OnEquipmentChanged(new EquipmentChangedEventArgs(equipSlot));
        }
Exemplo n.º 5
0
 public void ObtainItem(Item item)
 {
     item.Owner = this;
     FreeInventory.Add(item);
     OnInventoryChanged();
 }