Example #1
0
        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);
        }
Example #2
0
        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);
        }