Пример #1
0
            public void Open(BasePlayer looter)
            {
                if (IsOpen)
                {
                    Instance.PrintToChat(looter, Instance.lang.GetMessage("Backpack Already Open", Instance, looter.UserIDString));
                    return;
                }

                if (Instance.EventManager?.Call <bool>("isPlaying", looter) ?? false)
                {
                    Instance.PrintToChat(looter, Instance.lang.GetMessage("May Not Open Backpack In Event", Instance, looter.UserIDString));
                    return;
                }

                _boxEntity = SpawnContainer(Size, looter.transform.position - new Vector3(0, UnityEngine.Random.Range(100, 5000), 0));

                foreach (var backpackItem in Inventory.Items)
                {
                    var item = backpackItem.ToItem();
                    item?.MoveToContainer(Container.inventory, item.position);
                }

                _looter = looter;

                PlayerLootContainer(looter, Container);
                StorageCloser.Attach(_boxEntity, Close);
            }
Пример #2
0
            public void Open(BasePlayer looter)
            {
                if (IsOpen)
                {
                    _instance.PrintToChat(looter, _instance.lang.GetMessage("Backpack Already Open", _instance, looter.UserIDString));
                    return;
                }

                if (_instance.EventManager?.Call <bool>("isPlaying", looter) ?? false)
                {
                    _instance.PrintToChat(looter, _instance.lang.GetMessage("May Not Open Backpack In Event", _instance, looter.UserIDString));
                    return;
                }

                _boxEntity = SpawnContainer(Size, looter.transform.position - new Vector3(0, UnityEngine.Random.Range(100, 5000), 0));


                foreach (var backpackItem in Inventory.Items)
                {
                    var item = backpackItem.ToItem();
                    if (item.position > Configuration.backpackSlots * (int)Size)
                    {
                        item?.MoveToContainer(
                            !looter.inventory.containerMain.FindPosition(item)
                                ? looter.inventory.containerMain
                                : Container.inventory, item.position);
                    }
                    else
                    {
                        item?.MoveToContainer(Container.inventory, item.position);
                    }
                }

                Container.inventory.capacity = (Configuration.backpackSlots * (int)Size) > Inventory.Items.Count ? Configuration.backpackSlots * (int)Size : Inventory.Items.Count;

                _looter = looter;

                PlayerLootContainer(looter, Container);
                StorageCloser.Attach(_boxEntity, Close);
            }
Пример #3
0
            public void Open(BasePlayer player)
            {
                if (IsOpen)
                {
                    Instance.PrintToChat(player, Instance.lang.GetMessage("Backpack Already Open", Instance, player.UserIDString));
                    return;
                }

                entity = SpawnContainer(Configuration.BackpackSize, player.transform.position - new Vector3(0, 100, 0));

                foreach (var backpackItem in Inventory.Items)
                {
                    backpackItem.ToItem().MoveToContainer(container.inventory);
                }

                PlayerLootContainer(player, entity.GetComponent <StorageContainer>());
                StorageCloser.Attach(entity, Close);

                foreach (var backpackItem in Inventory.Items)
                {
                    Instance.PrintWarning($"{backpackItem.ToItem().info.displayName.english}: {backpackItem.FlameFuel}");
                }
            }