Esempio n. 1
0
        void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            if (quarry.OwnerID == 0)
            {
                GatherMultiplier(item, DayRateMultStaticQuarry, NightRateMultStaticQuarry);
                return;
            }
            int        gr     = -1;
            BasePlayer player = BasePlayer.FindByID(quarry.OwnerID);

            if (player == null)
            {
                BasePlayer player1 = BasePlayer.FindSleeping(quarry.OwnerID);
                if (player1 == null)
                {
                    return;
                }
                gr = CheckPlayerPerm(player1, -1);
            }
            else
            {
                gr = CheckPlayerPerms(player);
            }
            if (gr >= 0)
            {
                if (permData.PermissionsGroups[gr].CustomRateMultQuarry.ContainsKey(item.info.shortname))
                {
                    CustomList(item, permData.PermissionsGroups[gr].CustomRateMultQuarry[item.info.shortname]);
                }
                else
                {
                    GatherMultiplier(item, permData.PermissionsGroups[gr].DayRateMultQuarry, permData.PermissionsGroups[gr].NightRateMultQuarry);
                }
            }
        }
Esempio n. 2
0
 void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     if (config.EnableGatherRate)
     {
         item.amount = ChangeGather(item.amount, config.GatherRateQuarry);
     }
 }
Esempio n. 3
0
 // quarries
 void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     if (quarryEnabled == true)
     {
         BasePlayer player = BasePlayer.FindByID(quarry.OwnerID) ?? BasePlayer.FindSleeping(quarry.OwnerID);
         DoGather(player, item);
     }
 }
 void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     if (!enabled)
     {
         return;
     }
     CheckItem(item);
 }
Esempio n. 5
0
 private void OnMiningQuarryEnabled(MiningQuarry quarry)
 {
     if (MiningQuarryResourceTickRate == DefaultMiningQuarryResourceTickRate)
     {
         return;
     }
     quarry.CancelInvoke("ProcessResources");
     quarry.InvokeRepeating("ProcessResources", MiningQuarryResourceTickRate, MiningQuarryResourceTickRate);
 }
Esempio n. 6
0
    public void StopEngine(BaseEntity.RPCMessage msg)
    {
        MiningQuarry parentEntity = base.GetParentEntity() as MiningQuarry;

        if (parentEntity)
        {
            parentEntity.EngineSwitch(false);
        }
    }
Esempio n. 7
0
 public void DoSpawn(MiningQuarry owner)
 {
     if (prefabToSpawn.isValid)
     {
         instance = GameManager.server.CreateEntity(prefabToSpawn.resourcePath, origin.transform.localPosition, origin.transform.localRotation);
         instance.SetParent(owner);
         instance.Spawn();
     }
 }
Esempio n. 8
0
    public void StopEngine(BaseEntity.RPCMessage msg)
    {
        MiningQuarry parentEntity = this.GetParentEntity() as MiningQuarry;

        if (!Object.op_Implicit((Object)parentEntity))
        {
            return;
        }
        parentEntity.EngineSwitch(false);
    }
Esempio n. 9
0
 public void DoSpawn(MiningQuarry owner)
 {
     if (!this.prefabToSpawn.isValid)
     {
         return;
     }
     this.instance = GameManager.server.CreateEntity(this.prefabToSpawn.resourcePath, this.origin.transform.localPosition, this.origin.transform.localRotation, true);
     this.instance.SetParent(owner, false, false);
     this.instance.Spawn();
 }
Esempio n. 10
0
        void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            var uid = quarry.OwnerID;

            if (!uid.IsSteamId())
            {
                return;
            }
            DoGather(uid, QUARRY_GATHER, item);
        }
Esempio n. 11
0
    public void StopEngine(RPCMessage msg)
    {
        MiningQuarry miningQuarry = GetParentEntity() as MiningQuarry;

        if ((bool)miningQuarry)
        {
            miningQuarry.EngineSwitch(false);
            Interface.CallHook("OnQuarryToggled", miningQuarry, msg.player);
        }
    }
Esempio n. 12
0
 private void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     if (QuarryResourceModifiers.ContainsKey(item.info.displayName.english))
     {
         item.amount = (int)(item.amount * QuarryResourceModifiers[item.info.displayName.english]);
     }
     else if (QuarryResourceModifiers.ContainsKey("*"))
     {
         item.amount = (int)(item.amount * QuarryResourceModifiers["*"]);
     }
 }
Esempio n. 13
0
        private void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            float modifier;

            if (QuarryResourceModifiers.TryGetValue(item.info.displayName.english, out modifier))
            {
                item.amount = (int)(item.amount * modifier);
            }
            else if (QuarryResourceModifiers.TryGetValue("*", out modifier))
            {
                item.amount = (int)(item.amount * modifier);
            }
        }
Esempio n. 14
0
        void AddPlayerQuarry(ulong userId, MiningQuarry quarry)
        {
            if (userId == 0)
            {
                return;
            }
            List <MiningQuarry> playerquarries;

            if (!playersQuarries.TryGetValue(userId, out playerquarries))
            {
                playersQuarries[userId] = playerquarries = new List <MiningQuarry>();
            }
            playerquarries.Add(quarry);
        }
Esempio n. 15
0
        //
        // Add custom item to quarries on fuel consumed
        //
        void OnItemUse(Item item, int amountToUse)
        {
            try
            {
                if (BaseNetworkable.serverEntities.Find(item.parent.entityOwner.parentEntity.uid) is MiningQuarry)
                {
                    MiningQuarry quarry = BaseNetworkable.serverEntities.Find(item.parent.entityOwner.parentEntity.uid) as MiningQuarry;

                    if (quarry.canExtractLiquid)
                    {
                        return;
                    }

                    if (!permission.UserHasPermission(quarry.OwnerID.ToString(), "oldschoolquarries.customloot"))
                    {
                        return;
                    }

                    ItemContainer hopper = (quarry.hopperPrefab.instance as StorageContainer).inventory;

                    double value = (rng.Next(0, 100) + rng.NextDouble());
                    if (value > 100d)
                    {
                        value = 100d;
                    }
                    if (config.Custom_Items == null)
                    {
                        return;
                    }
                    foreach (CustomItem cItem in config.Custom_Items)
                    {
                        if (!cItem.valid || cItem.chance == 0 || cItem.amount == 0)
                        {
                            continue;
                        }
                        if (value <= cItem.chance)
                        {
                            try
                            {
                                hopper.AddItem(ItemManager.itemList.Find(x => x.shortname == cItem.shortname), cItem.amount);
                            }
                            catch { }
                        }
                    }
                }
            }
            catch { }
        }
Esempio n. 16
0
        void RemovePlayerQuarry(ulong userId, MiningQuarry quarry)
        {
            if (userId == 0)
            {
                return;
            }
            List <MiningQuarry> playerquarries;

            if (playersQuarries.TryGetValue(userId, out playerquarries))
            {
                playerquarries.Remove(quarry);
                if (playerquarries.Count == 0)
                {
                    playersQuarries.Remove(userId);
                }
            }
        }
Esempio n. 17
0
        void OnQuarryToggled(MiningQuarry aExtractor, BasePlayer aPlayer)
        {
            /* This check takes care of 2 simple cases:
             *   1> The player is whitelisted, just remove
             *   2> Extractor was turned off, don't care about player ID, just remove
             */
            if (permission.UserHasPermission(aPlayer.UserIDString, CPermWhitelist) || !aExtractor.IsEngineOn())
            {
                FPlayerExtractorList.RemoveAll(x => aExtractor.net.ID == x.ExtractorId);
                return;
            }

            ExtractorType type;

            if (CPumpJackPrefabs.Contains(aExtractor.ShortPrefabName))
            {
                type = ExtractorType.PumpJack;
            }
            else if (CQuarryPrefabs.Contains(aExtractor.ShortPrefabName))
            {
                type = ExtractorType.Quarry;
            }
            else
            {
                // Skip anything we don't care about
                return;
            }

            if (FPlayerExtractorList.Count(x => aPlayer.userID == x.PlayerId && (FConfigData.IgnoreExtractorType || type == x.Type)) > 0)
            {
                // Turn engine OFF
                aExtractor.EngineSwitch(false);
                // Warn the player
                aPlayer.ChatMessage(lang.GetMessage("Warning Message Text", this, aPlayer.UserIDString));
                return;
            }

            FPlayerExtractorList.Add(new QuarryState {
                PlayerId = aPlayer.userID, ExtractorId = aExtractor.net.ID, Type = type
            });
        }
Esempio n. 18
0
        void OnItemUse(Item item, int amount)
        {
            if (item.info.shortname != "lowgradefuel")
            {
                return;
            }
            MiningQuarry quarry = item?.parent?.entityOwner?.GetParentEntity() as MiningQuarry;

            if (quarry != null)
            {
                var uid = quarry.OwnerID;
                if (uid == 0)
                {
                    return;
                }
                int fuelDiv = 1;
                if (PermissionService.HasPermission(uid, PERM_FUEL_DIV_4))
                {
                    fuelDiv = 4;
                }
                else if (PermissionService.HasPermission(uid, PERM_FUEL_DIV_2))
                {
                    fuelDiv = 2;
                }
                if (!fuelConsumable.ContainsKey(quarry))
                {
                    fuelConsumable[quarry] = 0;
                }
                var fuel = fuelConsumable[quarry];
                fuel++;
                if (fuel < fuelDiv)
                {
                    item.amount += 1;
                }
                else
                {
                    fuel = 0;
                }
                fuelConsumable[quarry] = fuel;
            }
        }
Esempio n. 19
0
        //горнодобывающий

        void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            BasePlayer player = BasePlayer.FindByID(quarry.OwnerID) ?? BasePlayer.FindSleeping(quarry.OwnerID);

            if (player == null)
            {
                return;
            }
            if (!data.ContainsKey(player.userID))
            {
                CreatePlayerData(player.userID);
            }
            switch (item.info.shortname)
            {
            case "stones":
                data[player.userID].quarry.stone += item.amount;
                break;

            case "metal.ore":
                data[player.userID].quarry.metalOre += item.amount;
                break;

            case "metal.fragments":
                data[player.userID].quarry.metal += item.amount;
                break;

            case "sulfur.ore":
                data[player.userID].quarry.sulfurOre += item.amount;
                break;

            case "hq.metal.ore":
                data[player.userID].quarry.hqmetalOre += item.amount;
                break;

            case "metal.refined":
                data[player.userID].quarry.hqmetal += item.amount;
                break;
            }
        }
        public void callSpawn(string name, int randomnumber, MiningQuarry quarry)
        {
            int    t     = 1;
            string item1 = "Item" + t;

            if ((string)Config[item1, "Item"] == null)
            {
                return;
            }

            do
            {
                string itemslot = "Item" + t;
                if ((string)Config[itemslot, "Item"] != null)
                {
                    if ((bool)Config [itemslot, "Active"])
                    {
                        if (name == (string)Config[itemslot, "SpawnsOn"])
                        {
                            if (randomnumber >= (int)Config[itemslot, "RandomNumberMin"] && randomnumber <= (int)Config[itemslot, "RandomNumberMax"])
                            {
                                var gather = ItemManager.CreateByName((string)Config[itemslot, "Item"], (int)Config[itemslot, "Amount"]);
                                gather.MoveToContainer(quarry.hopperPrefab.instance.GetComponent <StorageContainer>().inventory);
                            }
                        }
                    }
                }
                else
                {
                    break;
                }

                t++;
            } while (t != 100);

            return;
        }
Esempio n. 21
0
        private void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            BasePlayer player = BasePlayer.FindByID(quarry.OwnerID) ?? BasePlayer.FindSleeping(quarry.OwnerID);

            if (player == null)
            {
                return;
            }
            try
            {
                if (!playerData.playerD.ContainsKey(player.userID))
                {
                    OnPlayerInit(player);
                }
                else
                {
                    item.amount = (int)(item.amount * playerData.playerD[player.userID].playerQuarry);
                }
            }
            catch (System.Exception)
            {
                return;
            }
        }
 private void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     item.amount = (int)(item.amount * GatherRate);
 }
        void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            var sulfur = ItemManager.CreateByName("sulfur.ore", 1);
            var metal  = ItemManager.CreateByName("metal.ore", 1);
            var frags  = ItemManager.CreateByName("metal.fragments", 1);
            var stones = ItemManager.CreateByName("stones", 1);
            var hqm    = ItemManager.CreateByName("hq.metal.ore", 1);

            int randomnumber;

            System.Random generator = new System.Random();

            randomnumber = generator.Next(1, 101);

            if (item.info.itemid == sulfur.info.itemid)
            {
                callSpawn("SulfurOre", randomnumber, quarry);
                if (!(bool)Config["Options", "SulfurOreGather"])
                {
                    item.amount = 0;
                    item.Remove(0f);
                    return;
                }
                return;
            }
            if (item.info.itemid == metal.info.itemid)
            {
                callSpawn("MetalOre", randomnumber, quarry);
                if (!(bool)Config["Options", "MetalOreGather"])
                {
                    item.amount = 0;
                    item.Remove(0f);
                    return;
                }
                return;
            }
            if (item.info.itemid == frags.info.itemid)
            {
                callSpawn("MetalFrags", randomnumber, quarry);
                if (!(bool)Config["Options", "MetalFragsGather"])
                {
                    item.amount = 0;
                    item.Remove(0f);
                    return;
                }
                return;
            }
            if (item.info.itemid == stones.info.itemid)
            {
                callSpawn("Stones", randomnumber, quarry);
                if (!(bool)Config["Options", "StonesGather"])
                {
                    item.amount = 0;
                    item.Remove(0f);
                    return;
                }
                return;
            }
            if (item.info.itemid == hqm.info.itemid)
            {
                callSpawn("HQMetalOre", randomnumber, quarry);
                if (!(bool)Config["Options", "HighQualityMetalOreGather"])
                {
                    item.amount = 0;
                    item.Remove(0f);
                    return;
                }
                return;
            }
            return;
        }
Esempio n. 24
0
 private object OnQuarryEnabled(MiningQuarry quarry)
 {
     return Interface.CallDeprecatedHook("OnMiningQuarryEnabled", quarry);
 }
Esempio n. 25
0
 public static void On_QuarryMining(MiningQuarry miningQuarry)
 {
     OnNext("On_QuarryMining", miningQuarry);
 }
Esempio n. 26
0
 public void On_QuarryMining(MiningQuarry mq)
 {
     SetHookWorking("On_QuarryMining");
     Broadcast(mq.ShortPrefabName + " mined");
 }
Esempio n. 27
0
 void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     State.CollectTaxFrom(item);
 }
Esempio n. 28
0
 private void OnQuarryGather(MiningQuarry miningQuarry, Item item)
 {
     HookCalled("OnQuarryGather");
 }
Esempio n. 29
0
 /// <summary>
 /// Called from <c>MiningQuarry.ProcessResources()</c> .
 /// </summary>
 public static void On_QuarryMining(MiningQuarry mq) => OnNext("On_QuarryMining", mq);
Esempio n. 30
0
 public static void ProcessResources(MiningQuarry miningQuarry)
 {
     OnMining.OnNext(miningQuarry);
 }
Esempio n. 31
0
 private void OnMiningQuarryEnabled(MiningQuarry quarry)
 {
     quarry.CancelInvoke("ProcessResources");
     quarry.InvokeRepeating("ProcessResources", 20f * (float)config.CurrentMultiplier, 20f * (float)config.CurrentMultiplier);
 }
Esempio n. 32
0
 private void OnQuarryToggled(MiningQuarry quarry)
 {
     Interface.Oxide.CallDeprecatedHook("OnQuarryEnabled", "OnQuarryToggled(MiningQuarry quarry)",
                                        new System.DateTime(2020, 4, 1), quarry);
 }
Esempio n. 33
0
 private void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     HookCalled("OnQuarryGather");
 }
Esempio n. 34
0
 int GetFuel(MiningQuarry mine)
 {
     return(mine.fuelStoragePrefab.instance.GetComponent <StorageContainer>()
            .inventory.GetAmount(28178745, true));
 }
        private void OnQuarryGather(MiningQuarry quarry, Item item)
        {
            if (this.IsInBadlands(quarry))
            {
                var multiplier = this.rand.Next(this.quarryMinRate, this.quarryMaxRate);
                item.amount = item.amount * multiplier;
            }

            // // Remove HQM in the badlands + south of it
            // if (quarry.transform.position.z < this.zoneTop)
            // {
            //     if (item.info.displayName.english == this.hqmName)
            //     {
            //         item.RemoveFromContainer();
            //         //item.Remove(0f);
            //     }
            // }

            // // Remove Oil in the badlands + noth of it
            // if (quarry.transform.position.z > this.zoneBottom)
            // {
            //     if (item.info.displayName.english == this.oilName)
            //     {
            //         item.RemoveFromContainer();
            //         //item.Remove(0f);
            //     }
            // }
        }
Esempio n. 36
0
 private void OnQuarryGather(MiningQuarry quarry, Item item)
 {
     item.amount = item.amount * config.CurrentMultiplier * config.CurrentMultiplier;
 }