public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { float length; int ab; int chance; switch (perkLevel) { case 1: length = 12.0f; ab = 1; chance = 10; break; case 2: length = 12.0f; ab = 1; chance = 20; break; case 3: length = 12.0f; ab = 2; chance = 20; break; case 4: length = 12.0f; ab = 2; chance = 30; break; case 5: length = 12.0f; ab = 3; chance = 30; break; default: return; } if (creature.IsPlayer) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object); int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck; chance += luck; } if (RandomService.Random(100) + 1 <= chance) { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), creature.Object, length); creature.SendMessage(ColorTokenService.Combat("You perform a defensive maneuver.")); } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); target.RemoveEffect(EFFECT_TYPE_REGENERATE); int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky); int perkDurationBonus = PerkService.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + item.MedicineBonus; int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent); int perkBlastBonus = PerkService.GetPCPerkLevel(player, PerkType.ImmediateImprovement); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (RandomService.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object); } float interval = 6.0f; BackgroundType background = (BackgroundType)player.Class1; if (background == BackgroundType.Medic) { interval *= 0.5f; } _.PlaySound("use_bacta"); Effect regeneration = _.EffectRegenerate(restoreAmount, interval); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration); player.SendMessage("You successfully treat " + target.Name + "'s wounds. The healing kit will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The healing kit that you applied to " + target.Name + " has expired."); }); if (target.IsPlayer) { int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int luck = PerkService.GetCreaturePerkLevel(player, PerkType.Lucky); int perkDurationBonus = PerkService.GetCreaturePerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus + effectiveStats.Medicine; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + (rank / 10); int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent) + item.MedicineBonus; int perkBlastBonus = PerkService.GetCreaturePerkLevel(player, PerkType.ImmediateForcePack); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (RandomService.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } AbilityService.RestorePlayerFP(target.Object, blastHeal); } float interval = 6.0f; BackgroundType background = (BackgroundType)player.Class1; if (background == BackgroundType.Medic) { interval *= 0.5f; } string data = (int)interval + ", " + restoreAmount; CustomEffectService.ApplyCustomEffect(user, target.Object, CustomEffectType.ForcePack, (int)duration, restoreAmount, data); player.SendMessage("You successfully apply a force pack to " + target.Name + ". The force pack will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The force pack that you applied to " + target.Name + " has expired."); }); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.SpeedyFirstAid) * 10) { return(0.1f); } int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); return(12.0f - (rank + effectiveStats.Medicine / 2) * 0.1f); }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { int chance; int amount; switch (perkLevel) { case 1: chance = 50; amount = 1; break; case 2: chance = 50; amount = 2; break; case 3: chance = 50; amount = 3; break; case 4: chance = 75; amount = 3; break; case 5: chance = 75; amount = 4; break; default: return; } if (creature.IsPlayer) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object); int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck; chance += luck; } if (RandomService.Random(100) + 1 <= chance) { Effect heal = _.EffectHeal(amount); _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, heal, creature.Object); } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); CustomEffectService.RemovePCCustomEffect(target.Object, CustomEffectType.Bleeding); player.SendMessage("You finish bandaging " + target.Name + "'s wounds."); int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int healAmount = 2 + effectiveStats.Medicine / 2; healAmount += item.MedicineBonus; if (rank >= item.RecommendedLevel && item.MedicineBonus > 0) { _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(healAmount), target); } if (target.IsPlayer) { int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(100, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); } }
private float CalculateEquipmentBonus(NWPlayer player, SkillType skillType) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int equipmentBonus = 0; float multiplier = 0.5f; int atmosphere = CraftService.CalculateAreaAtmosphereBonus(player.Area); if (atmosphere >= 150) { multiplier = 0.8f; } else if (atmosphere >= 75) { multiplier = 0.7f; } else if (atmosphere >= 25) { multiplier = 0.6f; } switch (skillType) { case SkillType.Armorsmith: equipmentBonus = effectiveStats.Armorsmith; break; case SkillType.Weaponsmith: equipmentBonus = effectiveStats.Weaponsmith; break; case SkillType.Cooking: equipmentBonus = effectiveStats.Cooking; break; case SkillType.Engineering: equipmentBonus = effectiveStats.Engineering; break; case SkillType.Fabrication: equipmentBonus = effectiveStats.Fabrication; break; case SkillType.Medicine: equipmentBonus = effectiveStats.Medicine; break; } return(equipmentBonus * multiplier); // +0.5%, +0.6%, +0.7%, or 0.8% per equipment bonus }
// New component items will be spawned and the appropriate properties from the base item will be transferred. public bool Run(params object[] args) { _player = (NWPlayer)args[0]; _playerItemStats = PlayerStatService.GetPlayerItemEffectiveStats(_player); int xp = 100; // Always grant at least this much XP to player. // Remove the immobilization effect foreach (var effect in _player.Effects) { if (_.GetEffectTag(effect) == "CRAFTING_IMMOBILIZATION") { _.RemoveEffect(_player, effect); } } string serializedSalvageItem = (string)args[1]; NWPlaceable tempStorage = _.GetObjectByTag("TEMP_ITEM_STORAGE"); NWItem item = SerializationService.DeserializeItem(serializedSalvageItem, tempStorage); int salvageComponentTypeID = (int)args[2]; _componentType = DataService.Get <ComponentType>(salvageComponentTypeID); // Create an item with no bonuses every time. _.CreateItemOnObject(_componentType.ReassembledResref, _player); // First check is for attack bonuses foreach (var prop in item.ItemProperties) { int propTypeID = _.GetItemPropertyType(prop); if (propTypeID == _.ITEM_PROPERTY_ATTACK_BONUS) { // Get the amount of Attack Bonus int amount = _.GetItemPropertyCostTableValue(prop); xp += ProcessProperty(amount, 3, ComponentBonusType.AttackBonusUp); } } // Now check specific custom properties which are stored as local variables on the item. xp += ProcessProperty(item.CustomAC, 3, ComponentBonusType.ACUp); xp += ProcessProperty(item.HarvestingBonus, 3, ComponentBonusType.HarvestingUp); xp += ProcessProperty(item.PilotingBonus, 3, ComponentBonusType.PilotingUp); xp += ProcessProperty(item.ScanningBonus, 3, ComponentBonusType.ScanningUp); xp += ProcessProperty(item.ScavengingBonus, 3, ComponentBonusType.ScavengingUp); xp += ProcessProperty(item.CastingSpeed, 3, ComponentBonusType.CastingSpeedUp); xp += ProcessProperty(item.CraftBonusArmorsmith, 3, ComponentBonusType.ArmorsmithUp); xp += ProcessProperty(item.CraftBonusWeaponsmith, 3, ComponentBonusType.WeaponsmithUp); xp += ProcessProperty(item.CraftBonusCooking, 3, ComponentBonusType.CookingUp); xp += ProcessProperty(item.CraftBonusEngineering, 3, ComponentBonusType.EngineeringUp); xp += ProcessProperty(item.CraftBonusFabrication, 3, ComponentBonusType.FabricationUp); xp += ProcessProperty(item.HPBonus, 5, ComponentBonusType.HPUp, 0.5f); xp += ProcessProperty(item.FPBonus, 5, ComponentBonusType.FPUp, 0.5f); xp += ProcessProperty(item.EnmityRate, 3, ComponentBonusType.EnmityUp); xp += ProcessProperty(item.ForcePotencyBonus, 3, ComponentBonusType.ForcePotencyUp); xp += ProcessProperty(item.ForceAccuracyBonus, 3, ComponentBonusType.ForceAccuracyUp); xp += ProcessProperty(item.ForceDefenseBonus, 3, ComponentBonusType.ForceDefenseUp); xp += ProcessProperty(item.ElectricalPotencyBonus, 3, ComponentBonusType.ElectricalPotencyUp); xp += ProcessProperty(item.MindPotencyBonus, 3, ComponentBonusType.MindPotencyUp); xp += ProcessProperty(item.LightPotencyBonus, 3, ComponentBonusType.LightPotencyUp); xp += ProcessProperty(item.DarkPotencyBonus, 3, ComponentBonusType.DarkPotencyUp); xp += ProcessProperty(item.ElectricalDefenseBonus, 3, ComponentBonusType.ElectricalDefenseUp); xp += ProcessProperty(item.MindDefenseBonus, 3, ComponentBonusType.MindDefenseUp); xp += ProcessProperty(item.LightDefenseBonus, 3, ComponentBonusType.LightDefenseUp); xp += ProcessProperty(item.DarkDefenseBonus, 3, ComponentBonusType.DarkDefenseUp); xp += ProcessProperty(item.LuckBonus, 3, ComponentBonusType.LuckUp); xp += ProcessProperty(item.MeditateBonus, 3, ComponentBonusType.MeditateUp); xp += ProcessProperty(item.RestBonus, 3, ComponentBonusType.RestUp); xp += ProcessProperty(item.MedicineBonus, 3, ComponentBonusType.MedicineUp); xp += ProcessProperty(item.HPRegenBonus, 3, ComponentBonusType.HPRegenUp); xp += ProcessProperty(item.FPRegenBonus, 3, ComponentBonusType.FPRegenUp); xp += ProcessProperty(item.BaseAttackBonus, 3, ComponentBonusType.BaseAttackBonusUp, 6f); xp += ProcessProperty(item.StructureBonus, 3, ComponentBonusType.StructureBonusUp); xp += ProcessProperty(item.SneakAttackBonus, 3, ComponentBonusType.SneakAttackUp); xp += ProcessProperty(item.DamageBonus, 3, ComponentBonusType.DamageUp); xp += ProcessProperty(item.StrengthBonus, 3, ComponentBonusType.StrengthUp); xp += ProcessProperty(item.DexterityBonus, 3, ComponentBonusType.DexterityUp); xp += ProcessProperty(item.ConstitutionBonus, 3, ComponentBonusType.ConstitutionUp); xp += ProcessProperty(item.WisdomBonus, 3, ComponentBonusType.WisdomUp); xp += ProcessProperty(item.IntelligenceBonus, 3, ComponentBonusType.IntelligenceUp); xp += ProcessProperty(item.CharismaBonus, 3, ComponentBonusType.CharismaUp); xp += ProcessProperty(item.DurationBonus, 3, ComponentBonusType.DurationUp); item.Destroy(); SkillService.GiveSkillXP(_player, SkillType.Harvesting, xp); return(true); }
// Heal Formula: // Power = floor(WIS÷2) + floor(CHA÷4) + ((Force Support Skill+Item Potency)÷2) // Base = floor((Power - Power Floor) ÷ Rate ) + Base Potency // Completely stolen from: https://www.bg-wiki.com/index.php?title=Cure_Formula&oldid=537717 and tweaked. private void HealTarget(NWPlayer oPC, NWObject oTarget, int perkLevel, int skillRank, CustomFeatType spellFeat) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); int itemPotency = effectiveStats.ForcePotency + effectiveStats.LightPotency; int power = (oPC.Wisdom / 2) + (oPC.Charisma / 4) + ((skillRank + itemPotency) / 2); ForceHealPotency potencyStats = null; // The same rules are used for each Force Heal tier. // However, using a lower tier ability will cap out regardless of your perk level. // I.E: If you are on perk level 8 and you use Force Heal I, the recovery amount will cap as if you were level 3. // Ranks 1-3: Force Heal I if (spellFeat == CustomFeatType.ForceHeal) { if (perkLevel > 3) { perkLevel = 3; } switch (perkLevel) { case 1: // Rank 1, Tier 1: if (power < 20) { potencyStats = _potencyLookup[1]; } // Rank 1, Tier 2: else { potencyStats = _potencyLookup[2]; } break; case 2: // Rank 2, Tier 1: if (power < 125) { potencyStats = _potencyLookup[3]; } // Rank 2, Tier 2: else { potencyStats = _potencyLookup[4]; } break; case 3: // Rank 3, Tier 1: if (power < 600) { potencyStats = _potencyLookup[5]; } // Rank 3, Tier 2: else { potencyStats = _potencyLookup[6]; } break; } } // Ranks 4-6: Force Heal II else if (spellFeat == CustomFeatType.ForceHeal2) { if (perkLevel > 6) { perkLevel = 6; } switch (perkLevel) { case 4: // Rank 4, Tier 1: if (power < 70) { potencyStats = _potencyLookup[7]; } // Rank 4, Tier 2: else { potencyStats = _potencyLookup[8]; } break; case 5: // Rank 5, Tier 1: if (power < 200) { potencyStats = _potencyLookup[9]; } // Rank 5, Tier 2: else { potencyStats = _potencyLookup[10]; } break; case 6: // Rank 6, Tier 1: if (power < 700) { potencyStats = _potencyLookup[11]; } // Rank 6, Tier 2: else { potencyStats = _potencyLookup[12]; } break; } } // Ranks 7-8: Force Heal III else if (spellFeat == CustomFeatType.ForceHeal3) { if (perkLevel > 8) { perkLevel = 8; } switch (perkLevel) { case 7: // Rank 7, Tier 1: if (power < 125) { potencyStats = _potencyLookup[13]; } // Rank 7, Tier 2: else { potencyStats = _potencyLookup[14]; } break; case 8: // Rank 8, Tier 1: if (power < 300) { potencyStats = _potencyLookup[15]; } // Rank 8, Tier 2: else if (power < 700) { potencyStats = _potencyLookup[16]; } // Rank 8, Tier 3: else { potencyStats = _potencyLookup[17]; } break; } } // Ranks 9-10: Force Heal IV else if (spellFeat == CustomFeatType.ForceHeal4) { if (perkLevel > 10) { perkLevel = 10; } switch (perkLevel) { case 9: // Rank 9, Tier 1: if (power < 200) { potencyStats = _potencyLookup[18]; } // Rank 9, Tier 2: else { potencyStats = _potencyLookup[19]; } break; case 10: // Rank 10, Tier 1: if (power < 400) { potencyStats = _potencyLookup[20]; } // Rank 10, Tier 2: else { potencyStats = _potencyLookup[21]; } break; } } if (potencyStats == null) { throw new Exception("Unable to identify Force Heal rules."); } // Calculate the amount based on the level and tier values int amount = (int)((power - potencyStats.PowerFloor) / potencyStats.Rate) + potencyStats.BasePotency; // Don't go over the hard cap, if there is one. if (potencyStats.HardCap > 0 && amount > potencyStats.HardCap) { amount = potencyStats.HardCap; } // Do a lucky check. Increases damage by 50% if successful. int luck = PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { amount = (int)(amount * 1.5f); oPC.SendMessage("Lucky heal!"); } // Apply the heal. oPC.AssignCommand(() => { Effect heal = _.EffectHeal(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, heal, oTarget); Effect vfx = _.EffectVisualEffect(VFX_IMP_HEALING_M); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object); }); SkillService.RegisterPCToAllCombatTargetsForSkill(oPC, SkillType.ForceSupport, null); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { float recoveryPercent; int basePotency; const float Tier1Modifier = 1; const float Tier2Modifier = 2; const float Tier3Modifier = 0; const float Tier4Modifier = 0; switch (perkLevel) { case 1: basePotency = 10; recoveryPercent = 0.2f; break; case 2: basePotency = 15; recoveryPercent = 0.2f; break; case 3: basePotency = 20; recoveryPercent = 0.4f; break; case 4: basePotency = 25; recoveryPercent = 0.4f; break; case 5: basePotency = 30; recoveryPercent = 0.5f; break; default: return; } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { recoveryPercent = 1.0f; player.SendMessage("Lucky drain life!"); } var calc = CombatService.CalculateForceDamage( player, target.Object, ForceAbilityType.Dark, basePotency, Tier1Modifier, Tier2Modifier, Tier3Modifier, Tier4Modifier); _.AssignCommand(player, () => { int heal = (int)(calc.Damage * recoveryPercent); if (heal > target.CurrentHP) { heal = target.CurrentHP; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(calc.Damage), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(heal), player); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_MIND), target, 1.0f); }); _.PlaySound("v_pro_drain"); SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceCombat, target.Object); CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Dark); }
private void OnCompleteSmelt(OnCompleteSmelt data) { NWPlayer player = data.Player; string oreResref = data.OreResref; List <ItemProperty> itemProperties = data.ItemProperties; player.IsBusy = false; int rank = SkillService.GetPCSkillRank(player, SkillType.Harvesting); int level = CraftService.GetIngotLevel(oreResref); string ingotResref = CraftService.GetIngotResref(oreResref); if (level < 0 || string.IsNullOrWhiteSpace(ingotResref)) { return; } int delta = rank - level; int count = 2; if (delta > 2) { count = delta; } if (count > 4) { count = 4; } if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.Lucky)) { count++; } if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.ProcessingEfficiency) * 10) { count++; } for (int x = 1; x <= count; x++) { var item = (_.CreateItemOnObject(ingotResref, player.Object)); int chance; switch (x) { case 1: case 2: chance = 100; break; case 3: chance = 70; break; case 4: chance = 60; break; case 5: chance = 50; break; default: chance = 30; break; } foreach (var ip in itemProperties) { if (RandomService.D100(1) <= chance) { BiowareXP2.IPSafeAddItemProperty(item, ip, 0.0f, AddItemPropertyPolicy.IgnoreExisting, true, true); } } } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int harvestingSkill = SkillService.GetPCSkillRank(player, SkillType.Harvesting); int perkBonus = PerkService.GetCreaturePerkLevel(player, PerkType.StronidiumRefining) + 1; int stronidiumAmount = 10 + effectiveStats.Harvesting + harvestingSkill + RandomService.Random(1, 5); stronidiumAmount *= perkBonus; _.CreateItemOnObject("stronidium", player.Object, stronidiumAmount); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(100, level, rank); SkillService.GiveSkillXP(player, SkillType.Harvesting, xp); }
public bool Run(params object[] args) { NWPlaceable container = (Object.OBJECT_SELF); NWPlayer oPC = (_.GetLastDisturbed()); int type = _.GetInventoryDisturbType(); NWItem item = (_.GetInventoryDisturbItem()); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); if (type != _.INVENTORY_DISTURB_TYPE_ADDED) { return(false); } int plantID = item.GetLocalInt("PLANT_ID"); if (plantID <= 0) { ItemService.ReturnItem(oPC, item); oPC.SendMessage("You cannot plant that item."); return(true); } Plant plant = FarmingService.GetPlantByID(plantID); if (plant == null) { ItemService.ReturnItem(oPC, item); oPC.SendMessage("You cannot plant that item."); return(true); } int rank = SkillService.GetPCSkillRank(oPC, SkillType.Farming); if (rank + 2 < plant.Level) { ItemService.ReturnItem(oPC, item); oPC.SendMessage("You do not have enough Farming skill to plant that seed. (Required: " + (plant.Level - 2) + ")"); return(true); } item.Destroy(); string areaTag = container.Area.Tag; Location plantLocation = container.Location; int perkBonus = PerkService.GetPCPerkLevel(oPC, PerkType.FarmingEfficiency) * 2; int ticks = (int)(plant.BaseTicks - ((PerkService.GetPCPerkLevel(oPC, PerkType.ExpertFarmer) * 0.05f)) * plant.BaseTicks); Data.Entity.GrowingPlant growingPlant = new Data.Entity.GrowingPlant { PlantID = plant.ID, RemainingTicks = ticks, LocationAreaTag = areaTag, LocationOrientation = _.GetFacingFromLocation(plantLocation), LocationX = _.GetPositionFromLocation(plantLocation).m_X, LocationY = _.GetPositionFromLocation(plantLocation).m_Y, LocationZ = _.GetPositionFromLocation(plantLocation).m_Z, IsActive = true, DateCreated = DateTime.UtcNow, LongevityBonus = perkBonus }; DataService.SubmitDataChange(growingPlant, DatabaseActionType.Insert); NWPlaceable hole = (container.GetLocalObject("FARM_SMALL_HOLE")); NWPlaceable plantPlc = (_.CreateObject(_.OBJECT_TYPE_PLACEABLE, "growing_plant", hole.Location)); plantPlc.SetLocalString("GROWING_PLANT_ID", growingPlant.ID.ToString()); plantPlc.Name = "Growing Plant (" + plant.Name + ")"; container.Destroy(); hole.Destroy(); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(200, plant.Level, rank); if (RandomService.Random(100) + 1 <= PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck) { xp *= 2; } SkillService.GiveSkillXP(oPC, SkillType.Farming, xp); return(true); }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = user.Object; var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int skillRank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int perkLevel = PerkService.GetCreaturePerkLevel(player, PerkType.ResuscitationDevices); int rank = item.GetLocalInt("RANK"); int baseHeal; switch (rank) { case 1: baseHeal = 1; break; case 2: baseHeal = 11; break; case 3: baseHeal = 31; break; case 4: baseHeal = 51; break; default: return; } baseHeal += perkLevel * 2; baseHeal += effectiveStats.Medicine / 2; baseHeal += item.MedicineBonus / 2; int delta = item.RecommendedLevel - skillRank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } if (target.IsPlayer) { baseHeal = (int)(baseHeal * effectivenessPercent); Player dbPlayer = DataService.Player.GetByID(target.GlobalID); int fpRecover = (int)(dbPlayer.MaxFP * (0.01f * baseHeal)); int hpRecover = (int)(target.MaxHP * (0.01f * baseHeal)); _.PlaySound("use_bacta"); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(hpRecover), target); dbPlayer.CurrentFP = fpRecover; DataService.SubmitDataChange(dbPlayer, DatabaseActionType.Update); player.SendMessage("You successfully resuscitate " + target.Name + "!"); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(600, item.RecommendedLevel, skillRank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); } else { baseHeal = (int)(baseHeal * effectivenessPercent); int hpRecover = (int)(target.MaxHP * (0.01f * baseHeal)); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(hpRecover), target); player.SendMessage("You successfully resuscitate " + target.Name + "!"); } }
// New component items will be spawned and the appropriate properties from the base item will be transferred. public bool Run(params object[] args) { _player = (NWPlayer)args[0]; int xp = 100; // Always grant at least this much XP to player. // Remove the immobilization effect foreach (var effect in _player.Effects) { if (_.GetEffectTag(effect) == "CRAFTING_IMMOBILIZATION") { _.RemoveEffect(_player, effect); } } // Check for a fuel cell in the player's inventory again. If it doesn't exist, we exit early with an error message. NWItem fuel = _.GetItemPossessedBy(_player, "ass_power"); if (!fuel.IsValid) { _player.SendMessage(ColorTokenService.Red("A 'Reassembly Fuel Cell' was not found in your inventory. Reassembly failed.")); return(false); } // Otherwise the fuel cell was found. Destroy it and continue on with the process. fuel.Destroy(); _playerItemStats = PlayerStatService.GetPlayerItemEffectiveStats(_player); string serializedSalvageItem = (string)args[1]; NWPlaceable tempStorage = _.GetObjectByTag("TEMP_ITEM_STORAGE"); NWItem item = SerializationService.DeserializeItem(serializedSalvageItem, tempStorage); int salvageComponentTypeID = (int)args[2]; _componentType = DataService.Get <ComponentType>(salvageComponentTypeID); // Create an item with no bonuses every time. _.CreateItemOnObject(_componentType.ReassembledResref, _player); // Now check specific custom properties which are stored as local variables on the item. xp += ProcessProperty(item.HarvestingBonus, 3, ComponentBonusType.HarvestingUp); xp += ProcessProperty(item.PilotingBonus, 3, ComponentBonusType.PilotingUp); xp += ProcessProperty(item.ScanningBonus, 3, ComponentBonusType.ScanningUp); xp += ProcessProperty(item.ScavengingBonus, 3, ComponentBonusType.ScavengingUp); xp += ProcessProperty(item.CooldownRecovery, 3, ComponentBonusType.CooldownRecoveryUp); xp += ProcessProperty(item.CraftBonusArmorsmith, 3, ComponentBonusType.ArmorsmithUp); xp += ProcessProperty(item.CraftBonusWeaponsmith, 3, ComponentBonusType.WeaponsmithUp); xp += ProcessProperty(item.CraftBonusCooking, 3, ComponentBonusType.CookingUp); xp += ProcessProperty(item.CraftBonusEngineering, 3, ComponentBonusType.EngineeringUp); xp += ProcessProperty(item.CraftBonusFabrication, 3, ComponentBonusType.FabricationUp); xp += ProcessProperty(item.HPBonus, 5, ComponentBonusType.HPUp, 0.5f); xp += ProcessProperty(item.FPBonus, 5, ComponentBonusType.FPUp, 0.5f); xp += ProcessProperty(item.EnmityRate, 3, ComponentBonusType.EnmityUp); xp += ProcessProperty(item.LuckBonus, 3, ComponentBonusType.LuckUp); xp += ProcessProperty(item.MeditateBonus, 3, ComponentBonusType.MeditateUp); xp += ProcessProperty(item.RestBonus, 3, ComponentBonusType.RestUp); xp += ProcessProperty(item.MedicineBonus, 3, ComponentBonusType.MedicineUp); xp += ProcessProperty(item.HPRegenBonus, 3, ComponentBonusType.HPRegenUp); xp += ProcessProperty(item.FPRegenBonus, 3, ComponentBonusType.FPRegenUp); xp += ProcessProperty(item.BaseAttackBonus, 3, ComponentBonusType.BaseAttackBonusUp, 6f); xp += ProcessProperty(item.StructureBonus, 3, ComponentBonusType.StructureBonusUp); xp += ProcessProperty(item.SneakAttackBonus, 3, ComponentBonusType.SneakAttackUp); xp += ProcessProperty(item.DamageBonus, 3, ComponentBonusType.DamageUp); xp += ProcessProperty(item.StrengthBonus, 3, ComponentBonusType.StrengthUp); xp += ProcessProperty(item.DexterityBonus, 3, ComponentBonusType.DexterityUp); xp += ProcessProperty(item.ConstitutionBonus, 3, ComponentBonusType.ConstitutionUp); xp += ProcessProperty(item.WisdomBonus, 3, ComponentBonusType.WisdomUp); xp += ProcessProperty(item.IntelligenceBonus, 3, ComponentBonusType.IntelligenceUp); xp += ProcessProperty(item.CharismaBonus, 3, ComponentBonusType.CharismaUp); xp += ProcessProperty(item.DurationBonus, 3, ComponentBonusType.DurationUp); item.Destroy(); SkillService.GiveSkillXP(_player, SkillType.Harvesting, xp); return(true); }
public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID) { float length; int damage; switch (level) { case 1: damage = RandomService.D4(1); length = 3; break; case 2: damage = RandomService.D4(1); length = 6; break; case 3: damage = RandomService.D6(1); length = 6; break; case 4: damage = RandomService.D8(1); length = 6; break; case 5: damage = RandomService.D8(1); length = 9; break; default: return; } SkillService.RegisterPCToNPCForSkill(player, target, SkillType.ForceCombat); // Resistance affects length for this perk. ForceResistanceResult resistance = CombatService.CalculateResistanceRating(player, target.Object, ForceAbilityType.Mind); length = length * resistance.Amount; if (length <= 0.0f || resistance.Type != ResistanceType.Zero) { player.SendMessage("Your Force Push effect was resisted."); return; } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { length = length * 2; player.SendMessage("Lucky force push!"); } _.PlaySound("v_imp_frcpush"); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_POSITIVE), target); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, length); CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Light); }
public void Main() { NWPlaceable point = (_.OBJECT_SELF); NWPlayer oPC = (_.GetLastOpenedBy()); if (!oPC.IsPlayer) { return; } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); const int baseChanceToFullyHarvest = 50; bool hasBeenSearched = point.GetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED") == 1; if (hasBeenSearched) { oPC.SendMessage("There's nothing left to harvest here..."); return; } if (!oPC.IsPlayer && !oPC.IsDM) { return; } int rank = SkillService.GetPCSkillRank(oPC, SkillType.Scavenging); int lootTableID = point.GetLocalInt("SCAVENGE_POINT_LOOT_TABLE_ID"); int level = point.GetLocalInt("SCAVENGE_POINT_LEVEL"); int delta = level - rank; if (delta > 8) { oPC.SendMessage("You aren't skilled enough to scavenge through this. (Required Level: " + (level - 8) + ")"); oPC.AssignCommand(() => _.ActionInteractObject(point.Object)); return; } int dc = 6 + delta; if (dc <= 4) { dc = 4; } int searchAttempts = 1 + CalculateSearchAttempts(oPC); int luck = PerkService.GetCreaturePerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck / 2) { dc--; } oPC.AssignCommand(() => _.ActionPlayAnimation(Animation.LoopingGetLow, 1.0f, 2.0f)); for (int attempt = 1; attempt <= searchAttempts; attempt++) { int roll = RandomService.Random(20) + 1; if (roll >= dc) { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *success*: (" + roll + " vs. DC: " + dc + ")")); ItemVO spawnItem = LootService.PickRandomItemFromLootTable(lootTableID); if (spawnItem == null) { return; } if (!string.IsNullOrWhiteSpace(spawnItem.Resref) && spawnItem.Quantity > 0) { _.CreateItemOnObject(spawnItem.Resref, point.Object, spawnItem.Quantity); } float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(200, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } else { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *failure*: (" + roll + " vs. DC: " + dc + ")")); float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(50, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } dc += RandomService.Random(3) + 1; } // Chance to destroy the scavenge point. int chanceToFullyHarvest = baseChanceToFullyHarvest - (PerkService.GetCreaturePerkLevel(oPC, PerkType.CarefulScavenger) * 5); if (chanceToFullyHarvest <= 5) { chanceToFullyHarvest = 5; } point.SetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED", 1); oPC.SendMessage("This resource has been fully harvested..."); point.SetLocalInt("SCAVENGE_POINT_DESPAWN_TICKS", 30); }
public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID) { int length; int dotAmount; int basePotency; const float Tier1Modifier = 1.0f; const float Tier2Modifier = 1.6f; const float Tier3Modifier = 2.2f; const float Tier4Modifier = 0; switch (level) { case 1: basePotency = 15; length = 0; dotAmount = 0; break; case 2: basePotency = 20; length = 6; dotAmount = 4; break; case 3: basePotency = 25; length = 6; dotAmount = 6; break; case 4: basePotency = 40; length = 12; dotAmount = 6; break; case 5: basePotency = 50; length = 12; dotAmount = 6; break; case 6: basePotency = 60; length = 12; dotAmount = 6; break; case 7: basePotency = 70; length = 12; dotAmount = 6; break; case 8: basePotency = 80; length = 12; dotAmount = 8; break; case 9: basePotency = 90; length = 12; dotAmount = 8; break; case 10: basePotency = 100; length = 12; dotAmount = 10; break; default: return; } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { length = length * 2; player.SendMessage("Lucky force lightning!"); } var calc = CombatService.CalculateForceDamage( player, target.Object, ForceAbilityType.Electrical, basePotency, Tier1Modifier, Tier2Modifier, Tier3Modifier, Tier4Modifier); player.AssignCommand(() => { Effect damage = _.EffectDamage(calc.Damage, DAMAGE_TYPE_ELECTRICAL); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, target); }); if (length > 0.0f && dotAmount > 0) { CustomEffectService.ApplyCustomEffect(player, target.Object, CustomEffectType.ForceShock, length, level, dotAmount.ToString()); } SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceCombat, target.Object); player.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_LIGHTNING), target, 1.0f); }); _.PlaySound("v_pro_lightning"); CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Electrical); }
public bool Run(params object[] args) { NWPlaceable point = (Object.OBJECT_SELF); NWPlayer oPC = (_.GetLastOpenedBy()); if (!oPC.IsPlayer) { return(false); } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); const int baseChanceToFullyHarvest = 50; bool alwaysDestroys = point.GetLocalInt("SCAVENGE_POINT_ALWAYS_DESTROYS") == 1; bool hasBeenSearched = point.GetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED") == 1; if (hasBeenSearched) { oPC.SendMessage("There's nothing left to harvest here..."); return(true); } // Not fully harvested but the timer hasn't counted down yet. int refillTick = point.GetLocalInt("SCAVENGE_POINT_REFILL_TICKS"); if (refillTick > 0) { oPC.SendMessage("You couldn't find anything new here. Check back later..."); return(true); } if (!oPC.IsPlayer && !oPC.IsDM) { return(false); } int rank = SkillService.GetPCSkillRank(oPC, SkillType.Scavenging); int lootTableID = point.GetLocalInt("SCAVENGE_POINT_LOOT_TABLE_ID"); int level = point.GetLocalInt("SCAVENGE_POINT_LEVEL"); int delta = level - rank; if (delta > 8) { oPC.SendMessage("You aren't skilled enough to scavenge through this. (Required Level: " + (level - 8) + ")"); oPC.AssignCommand(() => _.ActionInteractObject(point.Object)); return(true); } int dc = 6 + delta; if (dc <= 4) { dc = 4; } int searchAttempts = 1 + CalculateSearchAttempts(oPC); int luck = PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck / 2) { dc--; } oPC.AssignCommand(() => _.ActionPlayAnimation(_.ANIMATION_LOOPING_GET_LOW, 1.0f, 2.0f)); for (int attempt = 1; attempt <= searchAttempts; attempt++) { int roll = RandomService.Random(20) + 1; if (roll >= dc) { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *success*: (" + roll + " vs. DC: " + dc + ")")); ItemVO spawnItem = LootService.PickRandomItemFromLootTable(lootTableID); if (spawnItem == null) { return(false); } if (!string.IsNullOrWhiteSpace(spawnItem.Resref) && spawnItem.Quantity > 0) { NWItem resource = _.CreateItemOnObject(spawnItem.Resref, point.Object, spawnItem.Quantity); var componentIP = resource.ItemProperties.FirstOrDefault(x => _.GetItemPropertyType(x) == (int)CustomItemPropertyType.ComponentType); if (componentIP != null) { // Add properties to the item based on Scavenging skill. Similar logic to the resource harvester. var chance = RandomService.Random(1, 100) + PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; ResourceQuality quality; if (chance < 50) { quality = ResourceQuality.Low; } else if (chance < 75) { quality = ResourceQuality.Normal; } else if (chance < 95) { quality = ResourceQuality.High; } else { quality = ResourceQuality.VeryHigh; } int ipBonusChance = ResourceService.CalculateChanceForComponentBonus(oPC, (level / 10 + 1), quality, true); if (RandomService.Random(1, 100) <= ipBonusChance) { var ip = ResourceService.GetRandomComponentBonusIP(ResourceQuality.Normal); BiowareXP2.IPSafeAddItemProperty(resource, ip.Item1, 0.0f, AddItemPropertyPolicy.IgnoreExisting, true, true); switch (ip.Item2) { case 0: resource.Name = ColorTokenService.Green(resource.Name); break; case 1: resource.Name = ColorTokenService.Blue(resource.Name); break; case 2: resource.Name = ColorTokenService.Purple(resource.Name); break; case 3: resource.Name = ColorTokenService.Orange(resource.Name); break; } } } } float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(200, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } else { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *failure*: (" + roll + " vs. DC: " + dc + ")")); float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(50, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } dc += RandomService.Random(3) + 1; } // Chance to destroy the scavenge point. int chanceToFullyHarvest = baseChanceToFullyHarvest - (PerkService.GetPCPerkLevel(oPC, PerkType.CarefulScavenger) * 5); string growingPlantID = point.GetLocalString("GROWING_PLANT_ID"); if (!string.IsNullOrWhiteSpace(growingPlantID)) { Data.Entity.GrowingPlant growingPlant = FarmingService.GetGrowingPlantByID(new Guid(growingPlantID)); chanceToFullyHarvest = chanceToFullyHarvest - (growingPlant.LongevityBonus); } if (chanceToFullyHarvest <= 5) { chanceToFullyHarvest = 5; } if (alwaysDestroys || RandomService.Random(100) + 1 <= chanceToFullyHarvest) { point.SetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED", 1); oPC.SendMessage("This resource has been fully harvested..."); } // Otherwise the scavenge point will be refilled in 10-20 minutes. else { point.SetLocalInt("SCAVENGE_POINT_REFILL_TICKS", 100 + RandomService.Random(100)); } point.SetLocalInt("SCAVENGE_POINT_DESPAWN_TICKS", 30); return(true); }
public bool Run(params object[] args) { NWPlaceable point = (Object.OBJECT_SELF); NWPlayer oPC = (_.GetLastOpenedBy()); if (!oPC.IsPlayer) { return(false); } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); const int baseChanceToFullyHarvest = 50; bool alwaysDestroys = point.GetLocalInt("SCAVENGE_POINT_ALWAYS_DESTROYS") == 1; bool hasBeenSearched = point.GetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED") == 1; if (hasBeenSearched) { oPC.SendMessage("There's nothing left to harvest here..."); return(true); } // Not fully harvested but the timer hasn't counted down yet. int refillTick = point.GetLocalInt("SCAVENGE_POINT_REFILL_TICKS"); if (refillTick > 0) { oPC.SendMessage("You couldn't find anything new here. Check back later..."); return(true); } if (!oPC.IsPlayer && !oPC.IsDM) { return(false); } int rank = SkillService.GetPCSkillRank(oPC, SkillType.Scavenging); int lootTableID = point.GetLocalInt("SCAVENGE_POINT_LOOT_TABLE_ID"); int level = point.GetLocalInt("SCAVENGE_POINT_LEVEL"); int delta = level - rank; if (delta > 8) { oPC.SendMessage("You aren't skilled enough to scavenge through this. (Required Level: " + (level - 8) + ")"); oPC.AssignCommand(() => _.ActionInteractObject(point.Object)); return(true); } int dc = 6 + delta; if (dc <= 4) { dc = 4; } int searchAttempts = 1 + CalculateSearchAttempts(oPC); int luck = PerkService.GetCreaturePerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck / 2) { dc--; } oPC.AssignCommand(() => _.ActionPlayAnimation(_.ANIMATION_LOOPING_GET_LOW, 1.0f, 2.0f)); for (int attempt = 1; attempt <= searchAttempts; attempt++) { int roll = RandomService.Random(20) + 1; if (roll >= dc) { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *success*: (" + roll + " vs. DC: " + dc + ")")); ItemVO spawnItem = LootService.PickRandomItemFromLootTable(lootTableID); if (spawnItem == null) { return(false); } if (!string.IsNullOrWhiteSpace(spawnItem.Resref) && spawnItem.Quantity > 0) { _.CreateItemOnObject(spawnItem.Resref, point.Object, spawnItem.Quantity); } float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(200, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } else { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *failure*: (" + roll + " vs. DC: " + dc + ")")); float xp = SkillService.CalculateRegisteredSkillLevelAdjustedXP(50, level, rank); SkillService.GiveSkillXP(oPC, SkillType.Scavenging, (int)xp); } dc += RandomService.Random(3) + 1; } // Chance to destroy the scavenge point. int chanceToFullyHarvest = baseChanceToFullyHarvest - (PerkService.GetCreaturePerkLevel(oPC, PerkType.CarefulScavenger) * 5); string growingPlantID = point.GetLocalString("GROWING_PLANT_ID"); if (!string.IsNullOrWhiteSpace(growingPlantID)) { Data.Entity.GrowingPlant growingPlant = FarmingService.GetGrowingPlantByID(new Guid(growingPlantID)); chanceToFullyHarvest = chanceToFullyHarvest - (growingPlant.LongevityBonus); } if (chanceToFullyHarvest <= 5) { chanceToFullyHarvest = 5; } if (alwaysDestroys || RandomService.Random(100) + 1 <= chanceToFullyHarvest) { point.SetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED", 1); oPC.SendMessage("This resource has been fully harvested..."); } // Otherwise the scavenge point will be refilled in 10-20 minutes. else { point.SetLocalInt("SCAVENGE_POINT_REFILL_TICKS", 100 + RandomService.Random(100)); } point.SetLocalInt("SCAVENGE_POINT_DESPAWN_TICKS", 30); return(true); }