Пример #1
0
        private void Destroy(int id)
        {
            LootBag bag = LootBagsList.Where(x => x.Id == id).FirstOrDefault();

            if (bag == null)
            {
                return;
            }

            bag.Prop.Delete();
            bag.Colshape.Delete();
            bag.Label.Delete();

            LootBagsList.Remove(bag);
        }
Пример #2
0
        public void TakeItem(Player player, int id)
        {
            LootBag bag = LootBagsList.Where(x => x.Id == id).FirstOrDefault();

            if (bag == null)
            {
                return;
            }

            // other

            if (bag.Items.ItemsList.Count == 0)
            {
                Close(player);
                Destroy(id);
            }
        }
Пример #3
0
        public void Create(Player player)
        {
            LootBag bag = new LootBag();

            LootBagsList.Add(bag);

            Vector3 pos = Utils.UtilityFuncs.GetPosFrontOfPlayer(player, 0.5);

            bag.Owner    = new PlayerInfo(player).GetDbID();
            bag.Prop     = NAPI.Object.CreateObject(1585260068, new Vector3(pos.X, pos.Y, pos.Z - 0.95), new Vector3(90, player.Heading, 0), 255, player.Dimension);
            bag.Colshape = NAPI.ColShape.CreateSphereColShape(player.Position, 1.5f, player.Dimension);
            bag.Label    = NAPI.TextLabel.CreateTextLabel("Press: \"E\"", new Vector3(pos.X, pos.Y, pos.Z - 0.8), 4f, 3f, 8, new Color(255, 255, 255), dimension: player.Dimension);

            bag.Id = LootBagsList.IndexOf(bag);

            bag.Colshape.SetData("LootBagColShapeId", bag.Id);

            Console.WriteLine($"Created loot bag: " + bag.ToString());
        }