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); } } }
void OnQuarryGather(MiningQuarry quarry, Item item) { if (config.EnableGatherRate) { item.amount = ChangeGather(item.amount, config.GatherRateQuarry); } }
// 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); }
private void OnMiningQuarryEnabled(MiningQuarry quarry) { if (MiningQuarryResourceTickRate == DefaultMiningQuarryResourceTickRate) { return; } quarry.CancelInvoke("ProcessResources"); quarry.InvokeRepeating("ProcessResources", MiningQuarryResourceTickRate, MiningQuarryResourceTickRate); }
public void StopEngine(BaseEntity.RPCMessage msg) { MiningQuarry parentEntity = base.GetParentEntity() as MiningQuarry; if (parentEntity) { parentEntity.EngineSwitch(false); } }
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(); } }
public void StopEngine(BaseEntity.RPCMessage msg) { MiningQuarry parentEntity = this.GetParentEntity() as MiningQuarry; if (!Object.op_Implicit((Object)parentEntity)) { return; } parentEntity.EngineSwitch(false); }
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(); }
void OnQuarryGather(MiningQuarry quarry, Item item) { var uid = quarry.OwnerID; if (!uid.IsSteamId()) { return; } DoGather(uid, QUARRY_GATHER, item); }
public void StopEngine(RPCMessage msg) { MiningQuarry miningQuarry = GetParentEntity() as MiningQuarry; if ((bool)miningQuarry) { miningQuarry.EngineSwitch(false); Interface.CallHook("OnQuarryToggled", miningQuarry, msg.player); } }
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["*"]); } }
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); } }
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); }
// // 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 { } }
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); } } }
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 }); }
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; } }
//горнодобывающий 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; }
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; }
private object OnQuarryEnabled(MiningQuarry quarry) { return Interface.CallDeprecatedHook("OnMiningQuarryEnabled", quarry); }
public static void On_QuarryMining(MiningQuarry miningQuarry) { OnNext("On_QuarryMining", miningQuarry); }
public void On_QuarryMining(MiningQuarry mq) { SetHookWorking("On_QuarryMining"); Broadcast(mq.ShortPrefabName + " mined"); }
void OnQuarryGather(MiningQuarry quarry, Item item) { State.CollectTaxFrom(item); }
private void OnQuarryGather(MiningQuarry miningQuarry, Item item) { HookCalled("OnQuarryGather"); }
/// <summary> /// Called from <c>MiningQuarry.ProcessResources()</c> . /// </summary> public static void On_QuarryMining(MiningQuarry mq) => OnNext("On_QuarryMining", mq);
public static void ProcessResources(MiningQuarry miningQuarry) { OnMining.OnNext(miningQuarry); }
private void OnMiningQuarryEnabled(MiningQuarry quarry) { quarry.CancelInvoke("ProcessResources"); quarry.InvokeRepeating("ProcessResources", 20f * (float)config.CurrentMultiplier, 20f * (float)config.CurrentMultiplier); }
private void OnQuarryToggled(MiningQuarry quarry) { Interface.Oxide.CallDeprecatedHook("OnQuarryEnabled", "OnQuarryToggled(MiningQuarry quarry)", new System.DateTime(2020, 4, 1), quarry); }
private void OnQuarryGather(MiningQuarry quarry, Item item) { HookCalled("OnQuarryGather"); }
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); // } // } }
private void OnQuarryGather(MiningQuarry quarry, Item item) { item.amount = item.amount * config.CurrentMultiplier * config.CurrentMultiplier; }