Beispiel #1
0
        static private LoadoutItem ProcessItem(Item item, string container)
        {
            LoadoutItem iItem = new LoadoutItem();

            iItem.amount    = item.amount;
            iItem.mods      = new List <int>();
            iItem.container = container;
            iItem.skinid    = Convert.ToInt32(item.skin);
            iItem.itemid    = item.info.itemid;
            iItem.weapon    = false;
            iItem.slot      = item.position;

            if (item.info.category.ToString() == "Weapon")
            {
                BaseProjectile weapon = item.GetHeldEntity() as BaseProjectile;
                if (weapon != null)
                {
                    if (weapon.primaryMagazine != null)
                    {
                        iItem.weapon = true;
                        if (item.contents != null)
                        {
                            foreach (var mod in item.contents.itemList)
                            {
                                if (mod.info.itemid != 0)
                                {
                                    iItem.mods.Add(mod.info.itemid);
                                }
                            }
                        }
                    }
                }
            }
            return(iItem);
        }
Beispiel #2
0
        //Gets player's loadout.
        static List <LoadoutItem> getPlayerLoadout(BasePlayer player)
        {
            List <LoadoutItem> Litem = new List <LoadoutItem>();

            foreach (Item item in player.inventory.containerWear.itemList)
            {
                if (item != null)
                {
                    LoadoutItem Iitem = ProcessItem(item, "wear");
                    Litem.Add(Iitem);
                }
            }
            foreach (Item item in player.inventory.containerMain.itemList)
            {
                if (item != null)
                {
                    LoadoutItem Iitem = ProcessItem(item, "main");
                    Litem.Add(Iitem);
                }
            }
            foreach (Item item in player.inventory.containerBelt.itemList)
            {
                if (item != null)
                {
                    LoadoutItem Iitem = ProcessItem(item, "belt");
                    Litem.Add(Iitem);
                }
            }
            return(Litem);
        }
        private void addItem()
        {
            _newItem            = new LoadoutItem();
            _newItem.Equipment  = _purchasedItem.Equipment;
            _newItem.Equipment1 = _purchasedItem.Equipment1;
            _newItem.Loadout    = _loadout.Id;
            _newItem.Loadout1   = _loadout;

            _allLoadoutItems.Add(_newItem);
            _itemList.Add(_newItem);
            RaisePropertyChanged("loadOutItems");
        }
        public void addItem()
        {
            _newItem            = new LoadoutItem();
            _newItem.Equipment  = selectedItem.Id;
            _newItem.Equipment1 = selectedItem;
            _newItem.Loadout    = _loadout.Id;
            _newItem.Loadout1   = _loadout;

            _loadOutList.Add(_newItem);

            RaisePropertyChanged("addItem");
            RaisePropertyChanged("isLoadOutNull");
        }
 public LoadoutItemEntity(LoadoutItem item)
 {
     ItemId   = item.ItemId;
     ItemName = item.ItemName;
     Points   = item.Points;
 }