public override void ServerInit() { this.SetupRigidBody(); this.ResetRemovalTime(); this.resourceDispenser = (ResourceDispenser)((Component)this).GetComponent <ResourceDispenser>(); base.ServerInit(); }
public override void PhysicsInit(Mesh mesh) { base.PhysicsInit(mesh); if (!base.isServer) { return; } resourceDispenser = GetComponent <ResourceDispenser>(); float num = Mathf.Clamp01(GetComponent <Rigidbody>().mass / massReductionScalar); resourceDispenser.containedItems = new List <ItemAmount>(); if (num > 0.75f && hqMetal != null) { resourceDispenser.containedItems.Add(new ItemAmount(hqMetal, Mathf.CeilToInt(7f * num))); } if (num > 0f) { if (metalFragments != null) { resourceDispenser.containedItems.Add(new ItemAmount(metalFragments, Mathf.CeilToInt(150f * num))); } if (charcoal != null) { resourceDispenser.containedItems.Add(new ItemAmount(charcoal, Mathf.CeilToInt(80f * num))); } } resourceDispenser.Initialize(); }
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { BasePlayer player = entity.ToPlayer(); if (player == null) { return; } if (AdminMode) { if (player.IsAdmin) { SendReply(player, (string.Format(lang.GetMessage("AdminMode", this), "RESOURCE", item.info.displayName.english, item.info.shortname))); } } int gr = CheckPlayerPerms(player); if (gr >= 0) { if (permData.PermissionsGroups[gr].CustomRateMultResource.ContainsKey(item.info.shortname)) { CustomList(item, permData.PermissionsGroups[gr].CustomRateMultResource[item.info.shortname]); } else { GatherMultiplier(item, permData.PermissionsGroups[gr].DayRateMultResource, permData.PermissionsGroups[gr].NightRateMultResource); } } }
void OnDispenserBonus(ResourceDispenser dispenser, BasePlayer player, Item item) { if (config.EnableGatherRate) { item.amount = ChangeGather(item.amount, gathermultiplier[item.info.shortname]); } }
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (sd.OnGather.ContainsKey(item.info.displayName.english) == false) { sd.OnGather.Add(item.info.displayName.english, 0.1); } else { if (entity.ToPlayer().IsValid()) { if (sd.PlayerXP.ContainsKey(entity.ToPlayer().UserIDString) == false) { sd.PlayerXP.Add(entity.ToPlayer().UserIDString, 0); } if (sd.PlayerLevel.ContainsKey(entity.ToPlayer().UserIDString) == false) { sd.PlayerLevel.Add(entity.ToPlayer().UserIDString, 1); } XPToAdd[entity.ToPlayer()] = XPToAdd[entity.ToPlayer()] + sd.OnGather[item.info.displayName.english]; PlayerStreakEnded[entity.ToPlayer()] = false; PlayerStreakTime[entity.ToPlayer()] = sd.StreakTimeEnd; if (sd.PlayerXP[entity.ToPlayer().UserIDString] >= (sd.XpNeededPerLevel_Will_be_Mutiplied_By_Level * sd.PlayerLevel[entity.ToPlayer().UserIDString]) * sd.PlayerLevel[entity.ToPlayer().UserIDString]) { sd.PlayerXP[entity.ToPlayer().UserIDString] = 0; sd.PlayerLevel[entity.ToPlayer().UserIDString] = sd.PlayerLevel[entity.ToPlayer().UserIDString] + 1; Reconomy.Call("GiveMoney", entity.ToPlayer(), sd.MoneyPerLevel_Will_be_Mutiplied_By_Level * sd.PlayerLevel[entity.ToPlayer().UserIDString], "You leveled up!", true); } } } }
// Хуки для заполнения данных_________________________________________________________________________ //топор/кирка void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { BasePlayer player = entity.ToPlayer(); if (player == null) { return; } if (!data.ContainsKey(player.userID)) { CreatePlayerData(player.userID); } switch (item.info.shortname) { case "wood": data[player.userID].gather.wood += item.amount; break; case "stones": data[player.userID].gather.stone += item.amount; break; case "metal.ore": data[player.userID].gather.metalOre += item.amount; break; case "sulfur.ore": data[player.userID].gather.sulfurOre += item.amount; break; case "hq.metal.ore": data[player.userID].gather.hqmetalOre += item.amount; break; } }
public override void ServerInit() { SetupRigidBody(); ResetRemovalTime(); resourceDispenser = GetComponent <ResourceDispenser>(); base.ServerInit(); }
void OnDispenserBonus(ResourceDispenser dispenser, BasePlayer player, Item item) { if (dispenserEnabled) { DoGather(player, item); } }
//Get apple from Tree void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (entity is BasePlayer) { if (dispenser.GetComponent <BaseEntity>() is TreeEntity) { if (UnityEngine.Random.Range(0, 100) < AppleChance) { ItemManager.CreateByName(AppleItem, 1).Drop(new Vector3(entity.transform.position.x, entity.transform.position.y + 20f, entity.transform.position.z), Vector3.zero); if (enableBroadcast) { SendReply(entity as BasePlayer, String.Format(msg("Apple"))); } } if (UnityEngine.Random.Range(0, 100) < SpoiledAppleChance) { ItemManager.CreateByName(SpoiledAppleItem, 1).Drop(new Vector3(entity.transform.position.x, entity.transform.position.y + 20f, entity.transform.position.z), Vector3.zero); if (enableBroadcast) { SendReply(entity as BasePlayer, String.Format(msg("SpoiledApple"))); } } } } }
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (!entity.ToPlayer()) { return; } var gatherType = dispenser.gatherType.ToString("G"); var amount = item.amount; if (GatherResourceModifiers.ContainsKey(item.info.displayName.english)) { item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]); } else if (GatherResourceModifiers.ContainsKey("*")) { item.amount = (int)(item.amount * GatherResourceModifiers["*"]); } if (!GatherDispenserModifiers.ContainsKey(gatherType)) { return; } var dispenserModifier = GatherDispenserModifiers[gatherType]; dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier; if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0) { item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount; } }
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (dispenser.GetComponent <BaseEntity>() is TreeEntity) { if (Oxide.Core.Random.Range(0, 100) < appleChance) { if (Oxide.Core.Random.Range(0, 100) < rAppleChance) { ItemManager.CreateByName("apple.spoiled", 1).Drop(new Vector3(entity.transform.position.x, entity.transform.position.y + 20f, entity.transform.position.z), Vector3.zero); } else { ItemManager.CreateByName("apple", 1).Drop(new Vector3(entity.transform.position.x, entity.transform.position.y + 20f, entity.transform.position.z), Vector3.zero); } if (enableBroadcast) { SendReply(entity as BasePlayer, String.Format(msg("Apple"))); } } } if (Oxide.Core.Random.Range(0, 100) < toolBreak && !permission.UserHasPermission((entity as BasePlayer).net.connection.userid.ToString(), unbreakPerm)) { (entity as BasePlayer).GetActiveItem().condition = (entity as BasePlayer).GetActiveItem().condition / 3; SendReply(entity as BasePlayer, String.Format(msg("ToolBreak"))); } }
void TriggerSpotting(BasePlayer player, InputState input) { Item activeItem = player.GetActiveItem(); if (activeItem == null) { return; } if (activeItem.info.category != ItemCategory.Weapon) { return; } this.inputCooldown.Add(player); bool spot = false; RaycastHit hit; if (Physics.Raycast(player.eyes.position, Quaternion.Euler(input.current.aimAngles) * Vector3.forward, out hit, 2000, spottingMask)) { BaseEntity hitEntity = hit.GetEntity(); ResourceDispenser dispenser = hitEntity.GetComponentInParent <ResourceDispenser>(); if (hitEntity == null) { return; } if (hitEntity is BasePlayer) { spot = true; } else if (hitEntity is BaseNpc) { spot = true; } else if (hitEntity is AutoTurret) { spot = true; } else if (hitEntity is BaseHelicopter) { spot = true; } else if (dispenser is ResourceDispenser) { spot = true; } if (spot) { SpotTarget(player, hitEntity); } } timer.Once(1, delegate() { this.inputCooldown.Remove(player); }); }
object OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { BasePlayer player = entity?.ToPlayer(); if (player == null) { return(null); } var tree = dispenser.GetComponentInParent <TreeEntity>(); if (tree != null) { if (playerGathered.ContainsKey(player.userID)) { foreach (Stumps stump in playerGathered[player.userID]) { if (stump.netid == entity.net.ID) { //Puts("Blocking gather for this player."); return(true); } } } } return(null); }
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { var player = entity.ToPlayer(); if (!player || !HasPerm(player)) { return; } var activeItem = player.GetActiveItem(); if (activeItem != null) { var toolName = activeItem.info.shortname; if (config.tools.ContainsKey(toolName)) { item.amount = (int)(item.amount * config.tools[toolName]); if (TOD_Sky.Instance.IsNight) { item.amount = (int)(item.amount * config.nightrate); } else if (TOD_Sky.Instance.IsDay) { item.amount = (int)(item.amount * config.dayrate); } return; } } }
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (currentEvent.Name != "Default" && !playerComplete.ContainsKey(entity.net.connection.username)) { if (item.info.shortname == currentEvent.Item) { playerFarm[entity.GetComponent <BasePlayer>().net.connection.userid] += item.amount; if (playerFarm[entity.GetComponent <BasePlayer>().net.connection.userid] >= currentEvent.Goal) { if (playerComplete.Count < currentEvent.Places) { playerComplete.Add(entity.GetComponent <BasePlayer>().net.connection.username, DateTime.Now); CuiHelper.DestroyUi(entity.GetComponent <BasePlayer>(), "FarmGUI"); Server.Broadcast(String.Format(msg("Finished"), entity.GetComponent <BasePlayer>().net.connection.username, DateTime.Now.ToShortTimeString())); playerFarm.Remove(entity.GetComponent <BasePlayer>().net.connection.userid); return; } else { CuiHelper.DestroyUi(entity.GetComponent <BasePlayer>(), "FarmGUI"); return; } } updateGUI(entity.GetComponent <BasePlayer>()); } } }
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (entity == null || !(entity is BaseEntity) || item == null || dispenser == null) { return; } // Cast the entity to a BasePlayer BasePlayer player = (BasePlayer)entity; if (dispenser.gatherType == ResourceDispenser.GatherType.Tree) { LevelHandler(player, item, SkillList.woodcutting); } if (dispenser.gatherType == ResourceDispenser.GatherType.Ore) { LevelHandler(player, item, SkillList.mining); } if (dispenser.gatherType == ResourceDispenser.GatherType.Flesh) { LevelHandler(player, item, SkillList.skinning); } }
void SpotTarget(BasePlayer player, BaseEntity hitEntity, Type hitEntityType, string hook) { MonoBehaviour target = hitEntity as MonoBehaviour; ResourceDispenser dispenser = hitEntity.GetComponentInParent <ResourceDispenser> (); var distanceTo = player.Distance(hitEntity); List <MonoBehaviour> playerSpotCooldown; if (!spotCooldown.TryGetValue(player, out playerSpotCooldown)) { spotCooldown.Add(player, playerSpotCooldown = new List <MonoBehaviour> ()); } if (!playerSpotCooldown.Contains(target)) { playerSpotCooldown.Add(target); Interface.Oxide.CallHook(hook, player, hitEntity, distanceTo); timer.Once(6, delegate() { playerSpotCooldown.Remove(target); }); } }
public static void AwardBadlandsBonusIfApplicable(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (!Instance.Options.Badlands.Enabled) { return; } var player = entity as BasePlayer; if (player == null) { return; } User user = Instance.Users.Get(player); if (user.CurrentArea == null) { Instance.PrintWarning("Player gathered outside of a defined area. This shouldn't happen."); return; } if (user.CurrentArea.Type == AreaType.Badlands) { var bonus = (int)(item.amount * Instance.Options.Taxes.BadlandsGatherBonus); item.amount += bonus; } }
public static void Gathering(ResourceDispenser dispenser, BaseEntity to, ItemAmount itemAmt, int amount) { itemAmt.amount += amount; BaseEntity from = (BaseEntity)dispenser.GetFieldValue("baseEntity"); GatherEvent ge = new GatherEvent(dispenser, from, to, itemAmt, amount); OnGathering.OnNext(ge); if (ge.Amount > 0) { amount = Mathf.RoundToInt(Mathf.Min((float)ge.Amount, itemAmt.amount)); if (amount > 0) { itemAmt.amount -= amount; if (itemAmt.amount < 0) { itemAmt.amount = 0; } Item item = ItemManager.CreateByItemID(itemAmt.itemid, amount, false); if (item == null) { return; } to.GiveItem(item); } } }
void OnDispenserGather(ResourceDispenser Dispenser, BaseEntity Entity, Item Item) { if (Dispenser == null || Entity == null || Item == null) { return; } if (TaxLevel > 0 && President > 0) { int Tax = Convert.ToInt32(Math.Round((Item.amount * TaxLevel) / 100)); Item.amount = Item.amount - Tax; if (TaxContainer == null) { TaxChestX = 0; TaxChestY = 0; TaxChestZ = 0; SaveTaxContainer(); LoadTaxContainer(); return; } if (!TaxContainer.inventory.IsFull()) { ItemDefinition ToAdd = ItemManager.FindItemDefinition(Item.info.itemid); if (ToAdd != null) { TaxContainer.inventory.AddItem(ToAdd, Tax); } } } }
private void OnDispenserBonus(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (!entity.ToPlayer()) { return; } item.amount = item.amount * config.CurrentMultiplier; }
private object OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { var player = entity as BasePlayer; return(player == null || player.IsNpc || player.net?.connection == null || !IsLimited(player) ? (object)null : false); }
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (entity is BasePlayer) { executeQuery("INSERT INTO stats_player_gather_resource (player, resource, count, date) VALUES (@0, @1, @2, @3)" + "ON DUPLICATE KEY UPDATE count = count + " + item.amount, ((BasePlayer)entity).userID, item.info.displayName.english, item.amount, getDate()); } }
private void OnDispenserGather(ResourceDispenser dispenser, BasePlayer entity) { if (!dispenser.name.Contains("cactus")) { return; } Hurt(entity, _config.harvestingDamage, dispenser.GetComponent <BaseEntity>() ?? entity); }
void OnDispenserBonus(ResourceDispenser dispenser, BasePlayer player, Item item) { if (config.BlockedItems.Contains(player.GetHeldEntity().GetItem().info.shortname)) { item.amount = 0; SendReply(player, string.Format(lang.GetMessage("CannotGather", this, player.UserIDString), player.GetHeldEntity().GetItem().info.displayName.english)); } }
private object OnDispenserBonus(ResourceDispenser dispenser, BasePlayer player, Item item) { if (!OnGather(item, player)) { return(null); } item.Remove(); return(false); }
public override void ServerInit() { base.ServerInit(); this.resourceDispenser = base.GetComponent <ResourceDispenser>(); if (this.health == 0f) { this.health = this.startHealth; } }
void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { BasePlayer player = entity.ToPlayer(); if (player == null) { return; } if (!configData.CanUseByAllPlayers && !permission.UserHasPermission(player.UserIDString, "enchanttool.use")) { return; } if (EnchantedTools.Contains(player.GetActiveItem().GetHashCode())) { switch (item.info.shortname) { case "sulfur.ore": ReplaceContents(-891243783, ref item); break; case "hq.metal.ore": ReplaceContents(374890416, ref item); break; case "metal.ore": ReplaceContents(688032252, ref item); break; case "wolfmeat.raw": ReplaceContents(-1691991080, ref item); break; case "meat.boar": ReplaceContents(991728250, ref item); break; case "fish.raw": ReplaceContents(-2078972355, ref item); break; case "chicken.raw": ReplaceContents(1734319168, ref item); break; case "bearmeat": ReplaceContents(-2043730634, ref item); break; case "wood": ReplaceContents(1436001773, ref item); break; } } }
public override void ServerInit() { base.ServerInit(); this.resourceDispenser = (ResourceDispenser)((Component)this).GetComponent <ResourceDispenser>(); if ((double)this.health != 0.0) { return; } this.health = this.startHealth; }
//Player Gather resource void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (entity is BasePlayer) { string properName = EncodeNonAsciiCharacters(((BasePlayer)entity).displayName); executeQuery( "INSERT INTO player_resource_gather (player_id, resource, amount, date, player_name) VALUES (@0, @1, @2, @3, @4)" + "ON DUPLICATE KEY UPDATE amount = amount + " + item.amount, ((BasePlayer)entity).userID, item.info.displayName.english, item.amount, getDate(), properName); } }
public GatherEvent(ResourceDispenser dispenser, BaseEntity from, BaseEntity to, ItemAmount itemAmt, int amount) { if (to is BasePlayer) { _gatherer = Server.GetPlayer((BasePlayer) to); _resource = new Entity(from); _resourceDispenser = dispenser; _itemAmount = itemAmt; _amount = (int)(amount * World.GetInstance().ResourceGatherMultiplier); } }
/// <summary> /// Increase gather rates from trees, ores, animals, etc /// </summary> private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { var player = entity.ToPlayer(); if (player == null) return; if (this.IsInBadlands(player)) { item.amount = Convert.ToInt32(item.amount * 3); } }
public GatherEvent(ResourceDispenser resourceDispenser, BaseEntity from, BaseEntity to, ItemAmount itemAmount, int amount) { if (to is BasePlayer) { ResourceDispenser = resourceDispenser; Resource = new Entity(from); Gatherer = Server.GetPlayer(to as BasePlayer); ItemAmount = itemAmount; Amount = (int)(amount * World.GetInstance().ResourceGatherMultiplier); } }
/// <summary> /// Increase gather rates from trees, ores, animals, etc /// </summary> private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { if (entity.ToPlayer() == null) return; item.amount = Convert.ToInt32(item.amount * 2); }
public void OnGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { BasePlayer player = entity.ToPlayer(); if (player == null) return; var gatherType = dispenser.gatherType; RPGInfo rpgInfo = RPGInfo(player); int experience = item.amount; if (rpgInfo == null) return; if (gatherType == ResourceDispenser.GatherType.Tree) { if (rpgInfo.Skills.ContainsKey(HRK.LumberJack)) { var modifier = SkillTable[HRK.LumberJack].Modifiers[HRK.GatherModifier]; int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.LumberJack], Convert.ToInt32(modifier.Args[0]), item.amount); item.amount = newAmount; } experience = item.amount; } if (gatherType == ResourceDispenser.GatherType.Ore) { if (rpgInfo.Skills.ContainsKey(HRK.Miner)) { var modifier = SkillTable[HRK.Miner].Modifiers[HRK.GatherModifier]; int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.Miner], Convert.ToInt32(modifier.Args[0]), item.amount); item.amount = newAmount; } experience = (int) ((float)item.amount/3); } if (gatherType == ResourceDispenser.GatherType.Flesh) { if (rpgInfo.Skills.ContainsKey(HRK.Hunter)) { var modifier = SkillTable[HRK.Hunter].Modifiers[HRK.GatherModifier]; int newAmount = SkillMethods.GatherModifier(rpgInfo.Skills[HRK.Hunter], Convert.ToInt32(modifier.Args[0]), item.amount); item.amount = newAmount; } experience = item.amount * 5; } ExpGain(rpgInfo, experience, player); }
public static void Gathering(ResourceDispenser dispenser, BaseEntity to, ItemAmount itemAmt, int amount) { itemAmt.amount += amount; BaseEntity from = (BaseEntity)dispenser.GetFieldValue("baseEntity"); GatherEvent ge = new GatherEvent(dispenser, from, to, itemAmt, amount); OnGathering.OnNext(ge); if (ge.Amount > 0) { if (amount > 0) { itemAmt.amount -= amount; if (itemAmt.amount < 0) itemAmt.amount = 0; Item item = ItemManager.CreateByItemID(itemAmt.itemid, ge.Amount, false); if (item == null) { return; } to.GiveItem(item); } } }
private void OnResourceExitZone(Zone zone, ResourceDispenser resource) { resourceZones[resource]?.Remove(zone); }
private void OnResourceEnterZone(Zone zone, ResourceDispenser entity) { HashSet<Zone> zones; if (!resourceZones.TryGetValue(entity, out zones)) resourceZones[entity] = zones = new HashSet<Zone>(); if (!zones.Add(zone)) return; //Puts("OnResourceEnterZone: {0}", entity.GetType()); }
private void OnResourceExitZone(Zone zone, ResourceDispenser resource) { HashSet<Zone> zones; if (resourceZones.TryGetValue(resource, out zones)) { if (!zones.Remove(zone)) return; if (zones.Count <= 0) resourceZones.Remove(resource); } //Puts("OnResourceExitZone: {0}", resource.GetType()); }
/// <summary> /// Called from <c>ResourceDispenser.GiveResourceFromItem(BaseEntity, ItemAmount, float, float, AttackEntity)</c> . /// </summary> public static void On_PlayerGathering(ResourceDispenser dispenser, BaseEntity to, ItemAmount itemAmount, float gatherDamage, float destroyFraction) { BaseEntity from = (BaseEntity)dispenser.GetFieldValue("baseEntity"); if (itemAmount.amount == 0) return; float num = gatherDamage / from.MaxHealth(); float num2 = itemAmount.startAmount / (float)dispenser.GetFieldValue("startingItemCounts"); float value = itemAmount.startAmount * num / num2; float num3 = Mathf.Clamp(value, 0, itemAmount.amount); float num4 = num3 * destroyFraction * 2; if (itemAmount.amount < num3 + num4) { itemAmount.amount -= destroyFraction * num3; num3 = itemAmount.amount; num4 = 0; } float amount = itemAmount.amount; itemAmount.amount -= num3; if (itemAmount.amount < 0) { itemAmount.amount = 0; } int num5 = Mathf.Clamp(Mathf.RoundToInt(num3), 0, Mathf.CeilToInt(amount)); itemAmount.amount -= num4; if (itemAmount.amount < 0) { itemAmount.amount = 0; } GatherEvent ge = new GatherEvent(dispenser, from, to, itemAmount, num5); OnNext("On_PlayerGathering", ge); if (ge.Amount <= 0) return; Item item = ItemManager.CreateByItemID(itemAmount.itemid, ge.Amount); if (item == null) return; to.GiveItem(item, BaseEntity.GiveItemReason.ResourceHarvested); }
private object OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { return Interface.CallDeprecatedHook("OnGather", dispenser, entity, item); }
private void OnResourceEnterZone(Zone zone, ResourceDispenser entity) { HashSet<Zone> zones; if (!resourceZones.TryGetValue(entity, out zones)) resourceZones[entity] = zones = new HashSet<Zone>(); zones.Add(zone); }
/// <summary> /// Increase gather rates from trees, ores, animals, etc /// </summary> private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { var player = entity.ToPlayer(); if (player == null) return; var rateMultipliers = this.GetRateMultipliers(player); float multiplier; switch (dispenser.gatherType) { case ResourceDispenser.GatherType.Tree: multiplier = rateMultipliers.Tree; // Increase gather rate rateMultipliers.Tree = this.IncreaseRate(rateMultipliers.Tree); break; case ResourceDispenser.GatherType.Ore: multiplier = rateMultipliers.Ore; // Increase gather rate rateMultipliers.Ore = this.IncreaseRate(rateMultipliers.Ore); break; case ResourceDispenser.GatherType.Flesh: multiplier = rateMultipliers.Flesh; // Increase gather rate rateMultipliers.Flesh = this.IncreaseRate(rateMultipliers.Flesh); break; default: multiplier = rateMultipliers.Other; // Increase gather rate rateMultipliers.Other = this.IncreaseRate(rateMultipliers.Other); break; } // Apply rate multiplier item.amount = Convert.ToInt32(item.amount * multiplier); // Save changes made to rate multipliers this.SaveRateMultipliers(player.userID, rateMultipliers); }
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { HookCalled("OnDispenserGather"); // TODO: Print item to be gathered }