public bool Run(params object[] args) { NWPlayer player = (NWPlayer)args[0]; string oreResref = (string)args[1]; List <ItemProperty> itemProperties = (List <ItemProperty>)args[2]; player.IsBusy = false; int rank = _skill.GetPCSkillRank(player, SkillType.Engineering); int level = _craft.GetIngotLevel(oreResref); string ingotResref = _craft.GetIngotResref(oreResref); if (level < 0 || string.IsNullOrWhiteSpace(ingotResref)) { return(false); } int delta = rank - level; int count = 2; if (delta > 2) { count = delta; } if (count > 4) { count = 4; } if (_random.Random(100) + 1 <= _perk.GetPCPerkLevel(player, PerkType.Lucky)) { count++; } if (_random.Random(100) + 1 <= _perk.GetPCPerkLevel(player, PerkType.ProcessingEfficiency) * 10) { count++; } for (int x = 1; x <= count; x++) { var item = (_.CreateItemOnObject(ingotResref, player.Object)); foreach (var ip in itemProperties) { _biowareXP2.IPSafeAddItemProperty(item, ip, 0.0f, AddItemPropertyPolicy.IgnoreExisting, true, true); } } var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); int stronidiumAmount = 2 + effectiveStats.Harvesting; _.CreateItemOnObject("stronidium", player.Object, stronidiumAmount); int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(100, level, rank); _skill.GiveSkillXP(player, SkillType.Engineering, xp); return(true); }
private bool CheckValidity(NWPlaceable forge, NWPlayer pc, NWItem item) { if (pc.IsBusy) { ReturnItemToPC(pc, item, "You are too busy."); return(false); } if (_.GetIsObjectValid(forge.GetLocalObject("FORGE_USER")) == NWScript.TRUE) { ReturnItemToPC(pc, item, "This forge is currently in use. Please wait..."); return(false); } string[] allowed = { "power_core", "raw_veldite", "raw_scordspar", "raw_plagionite", "raw_keromber", "raw_jasioclase", "raw_hemorgite", "raw_ochne", "raw_croknor", "raw_arkoxit", "raw_bisteiss" }; if (!allowed.Contains(item.Resref)) { ReturnItemToPC(pc, item, "Only power cores and raw materials may be placed inside."); return(false); } int level = _craft.GetIngotLevel(item.Resref); int rank = _skill.GetPCSkillRank(pc, SkillType.Engineering); int delta = rank - level; if (delta <= -4) { ReturnItemToPC(pc, item, "You do not have enough skill to refine this material."); return(false); } int pcPerkLevel = _perk.GetPCPerkLevel(pc, PerkType.Refining); int orePerkLevel = _craft.GetIngotPerkLevel(item.Resref); if (pcPerkLevel < orePerkLevel) { ReturnItemToPC(pc, item, "You do not have the perk necessary to refine this material."); return(false); } return(true); }
public bool Run(params object[] args) { NWPlayer player = NWPlayer.Wrap(Object.OBJECT_SELF); NWPlaceable forge = NWPlaceable.Wrap(player.GetLocalObject("FORGE")); string resref = forge.GetLocalString("FORGE_ORE"); forge.DeleteLocalObject("FORGE_USER"); player.DeleteLocalObject("FORGE"); forge.DeleteLocalString("FORGE_ORE"); player.IsBusy = false; PCSkill pcSkill = _skill.GetPCSkill(player, SkillType.Engineering); int level = _craft.GetIngotLevel(resref); string ingotResref = _craft.GetIngotResref(resref); if (pcSkill == null || level < 0 || string.IsNullOrWhiteSpace(ingotResref)) { return(false); } int delta = pcSkill.Rank - level; int count = 2; if (delta > 2) { count = delta; } if (count > 6) { count = 6; } if (_random.Random(100) + 1 <= _perk.GetPCPerkLevel(player, PerkType.Lucky)) { count++; } if (_random.Random(100) + 1 <= _perk.GetPCPerkLevel(player, PerkType.ProcessingEfficiency) * 10) { count++; } for (int x = 1; x <= count; x++) { _.CreateItemOnObject(ingotResref, player.Object); } int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(100, level, pcSkill.Rank); _skill.GiveSkillXP(player, SkillType.Engineering, xp); if (_random.Random(100) + 1 <= 3) { _food.DecreaseHungerLevel(player, 1); } return(true); }
private bool checkValidity(NWPlaceable forge, NWPlayer pc, NWItem item) { if (pc.IsBusy) { ReturnItemToPC(pc, item, "You are too busy."); return(false); } if (_.GetIsObjectValid(forge.GetLocalObject("FORGE_USER")) == TRUE) { ReturnItemToPC(pc, item, "This forge is currently in use. Please wait..."); return(false); } string[] allowed = { "coal", "copper_ore", "tin_ore", "iron_ore", "gold_ore", "platinum_ore", "adamantium_ore", "cobalt_ore", "silver_ore", "titanium_ore", "mithril_ore" }; if (!allowed.Contains(item.Resref)) { ReturnItemToPC(pc, item, "Only coal and ore may be placed inside."); return(false); } int level = _craft.GetIngotLevel(item.Resref); PCSkill pcSkill = _skill.GetPCSkill(pc, SkillType.Metalworking); if (pcSkill == null) { return(false); } int delta = pcSkill.Rank - level; if (delta <= -4) { ReturnItemToPC(pc, item, "You do not have enough skill to smelt this ore."); return(false); } int pcPerklevel = _perk.GetPCPerkLevel(pc, PerkType.Smelting); int orePerkLevel = _craft.GetIngotPerkLevel(item.Resref); if (pcPerklevel < orePerkLevel) { ReturnItemToPC(pc, item, "You do not have the perk necessary to smelt this ore."); return(false); } return(true); }