Exemplo n.º 1
0
        bool SpawnPromocodeItem()
        {
            var item = PromocodeItem;

            PromocodeItem = null;
            item?.Remove();
            LootContainer lootContainer = null;
            int           i             = 0;

            PromocodeItem = CreatePromocodeItem();
            do
            {
                if (++i > 50)
                {
                    break;
                }
                PromocodeZonePosition = PositionsOfMonuments.GetRandom();
                if (PromocodeZone)
                {
                    PromocodeZone.transform.position = PromocodeZonePosition;
                }
                lootContainer = GetPromocodeContainer(PromocodeZonePosition);
            } while (lootContainer == null || lootContainer.inventory.CanAcceptItem(PromocodeItem) != ItemContainer.CanAcceptResult.CanAccept || !(bool)(RustyLoot?.Call("IgnoreContainer", lootContainer) ?? false));
            if (lootContainer == null)
            {
                PromocodeItem.Remove();
                PromocodeItem = null;
                this.Broadcast("LOOTCONTAINER.MISSING");
                return(false);
            }
            PromocodeLootContainer = lootContainer;
            this.Broadcast("PROMOCODE.SPAWNED");
            PrintWarning(lootContainer.GetNetworkPosition().ToString());
            return(true);
        }